litos-ui 0.21.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 +121 -15
- package/README.zh-CN.md +155 -0
- package/lib/base.d.ts +1 -0
- package/lib/base.js +1 -1
- package/lib/button/index.js +4 -4
- package/lib/{style-gKR_qwzm.js → button/index.less_inline.js} +2 -3
- package/lib/button/style.js +8 -2
- package/lib/calendar/index.js +140 -2
- package/lib/calendar/index.less_inline.js +4 -0
- package/lib/calendar/langs.js +12 -0
- package/lib/card/index.js +64 -2
- package/lib/card/index.less_inline.js +4 -0
- package/lib/carousel/index.js +257 -2
- package/lib/carousel/index.less_inline.js +4 -0
- package/lib/carousel/item.js +15 -2
- package/lib/carousel/item.less_inline.js +4 -0
- package/lib/carousel/timer.js +19 -0
- package/lib/check/check.d.ts +1 -0
- package/lib/check/check.js +117 -0
- package/lib/check/check.less_inline.js +4 -0
- package/lib/check/checkbox.js +18 -2
- package/lib/{checkbox-DhGHJXwI.js → check/checkbox.less_inline.js} +2 -14
- package/lib/check/checkbox_group.js +1 -1
- package/lib/check/index.d.ts +1 -0
- package/lib/{check-DFlwStH9.js → check/index.js} +10 -9
- package/lib/check/index.less_inline.js +4 -0
- package/lib/check/radio.js +15 -2
- package/lib/{radio-C9NPQWGI.js → check/radio.less_inline.js} +2 -11
- package/lib/check/radio_group.js +1 -1
- package/lib/collapse/index.js +103 -2
- package/lib/collapse/index.less_inline.js +4 -0
- package/lib/collapse/item.d.ts +1 -0
- package/lib/collapse/item.js +118 -2
- package/lib/collapse/item.less_inline.js +4 -0
- package/lib/collapse/types.d.ts +1 -0
- package/lib/color_picker/index.js +42 -2
- package/lib/color_picker/index.less_inline.js +4 -0
- package/lib/date_picker/index.js +100 -3
- package/lib/date_picker/index.less_inline.js +4 -0
- package/lib/date_picker_ori/index.js +121 -2
- package/lib/date_picker_ori/index.less_inline.js +4 -0
- package/lib/description_panel/index.js +54 -2
- package/lib/description_panel/index.less_inline.js +4 -0
- package/lib/dialog/dialog_box.js +10 -10
- package/lib/{dialog_container_style-C1s0aBf7.js → dialog/dialog_container.css_inline.js} +2 -3
- package/lib/dialog/dialog_container.d.ts +1 -0
- package/lib/dialog/dialog_container.js +71 -60
- package/lib/dialog/dialog_container_style.js +8 -2
- package/lib/dialog/index.d.ts +1 -0
- package/lib/dialog/index.js +11 -6
- package/lib/entries/base.d.ts +2 -0
- package/lib/entries/base.js +2 -0
- package/lib/entries/button.d.ts +2 -0
- package/lib/entries/button.js +6 -0
- package/lib/entries/calendar.d.ts +2 -0
- package/lib/entries/calendar.js +6 -0
- package/lib/entries/card.d.ts +2 -0
- package/lib/entries/card.js +6 -0
- package/lib/entries/carousel-item.d.ts +2 -0
- package/lib/entries/carousel-item.js +6 -0
- package/lib/entries/carousel.d.ts +5 -0
- package/lib/entries/carousel.js +6 -0
- package/lib/entries/checkbox-group.d.ts +3 -0
- package/lib/entries/checkbox-group.js +6 -0
- package/lib/entries/checkbox.d.ts +2 -0
- package/lib/entries/checkbox.js +6 -0
- package/lib/entries/collapse-item.d.ts +3 -0
- package/lib/entries/collapse-item.js +6 -0
- package/lib/entries/collapse.d.ts +3 -0
- package/lib/entries/collapse.js +6 -0
- package/lib/entries/color-picker.d.ts +3 -0
- package/lib/entries/color-picker.js +6 -0
- package/lib/entries/date-picker-ori.d.ts +2 -0
- package/lib/entries/date-picker-ori.js +6 -0
- package/lib/entries/date-picker.d.ts +9 -0
- package/lib/entries/date-picker.js +6 -0
- package/lib/entries/description-panel.d.ts +4 -0
- package/lib/entries/description-panel.js +6 -0
- package/lib/entries/dialog-box.d.ts +6 -0
- package/lib/entries/dialog-box.js +2 -0
- package/lib/entries/dialog-container.d.ts +4 -0
- package/lib/entries/dialog-container.js +6 -0
- package/lib/entries/dialog.d.ts +3 -0
- package/lib/entries/dialog.js +2 -0
- package/lib/entries/form-item.d.ts +2 -0
- package/lib/entries/form-item.js +6 -0
- package/lib/entries/form.d.ts +3 -0
- package/lib/entries/form.js +6 -0
- package/lib/entries/icon-arrow-down.d.ts +2 -0
- package/lib/entries/icon-arrow-down.js +6 -0
- package/lib/entries/icon-arrow-left.d.ts +2 -0
- package/lib/entries/icon-arrow-left.js +6 -0
- package/lib/entries/icon-arrow-right.d.ts +2 -0
- package/lib/entries/icon-arrow-right.js +6 -0
- package/lib/entries/icon-arrow-up.d.ts +2 -0
- package/lib/entries/icon-arrow-up.js +6 -0
- package/lib/entries/icon-base.d.ts +2 -0
- package/lib/entries/icon-base.js +6 -0
- package/lib/entries/icon-calendar.d.ts +2 -0
- package/lib/entries/icon-calendar.js +6 -0
- package/lib/entries/icon-caret-bottom.d.ts +2 -0
- package/lib/entries/icon-caret-bottom.js +6 -0
- package/lib/entries/icon-caret-top.d.ts +2 -0
- package/lib/entries/icon-caret-top.js +6 -0
- package/lib/entries/icon-close-filled.d.ts +2 -0
- package/lib/entries/icon-close-filled.js +6 -0
- package/lib/entries/icon-close.d.ts +2 -0
- package/lib/entries/icon-close.js +6 -0
- package/lib/entries/icon-copy.d.ts +2 -0
- package/lib/entries/icon-copy.js +6 -0
- package/lib/entries/icon-d-arrow-left.d.ts +2 -0
- package/lib/entries/icon-d-arrow-left.js +6 -0
- package/lib/entries/icon-d-arrow-right.d.ts +2 -0
- package/lib/entries/icon-d-arrow-right.js +6 -0
- package/lib/entries/icon-delete.d.ts +2 -0
- package/lib/entries/icon-delete.js +6 -0
- package/lib/entries/icon-eye-outline.d.ts +2 -0
- package/lib/entries/icon-eye-outline.js +6 -0
- package/lib/entries/icon-font-icon.d.ts +2 -0
- package/lib/entries/icon-font-icon.js +6 -0
- package/lib/entries/icon-info.d.ts +2 -0
- package/lib/entries/icon-info.js +6 -0
- package/lib/entries/icon-loading.d.ts +2 -0
- package/lib/entries/icon-loading.js +6 -0
- package/lib/entries/icon-minus.d.ts +2 -0
- package/lib/entries/icon-minus.js +6 -0
- package/lib/entries/icon-moon.d.ts +2 -0
- package/lib/entries/icon-moon.js +6 -0
- package/lib/entries/icon-more.d.ts +2 -0
- package/lib/entries/icon-more.js +6 -0
- package/lib/entries/icon-picture.d.ts +2 -0
- package/lib/entries/icon-picture.js +6 -0
- package/lib/entries/icon-plus.d.ts +2 -0
- package/lib/entries/icon-plus.js +6 -0
- package/lib/entries/icon-reduction.d.ts +2 -0
- package/lib/entries/icon-reduction.js +6 -0
- package/lib/entries/icon-refresh-left.d.ts +2 -0
- package/lib/entries/icon-refresh-left.js +6 -0
- package/lib/entries/icon-refresh-right.d.ts +2 -0
- package/lib/entries/icon-refresh-right.js +6 -0
- package/lib/entries/icon-refresh.d.ts +2 -0
- package/lib/entries/icon-refresh.js +6 -0
- package/lib/entries/icon-search.d.ts +2 -0
- package/lib/entries/icon-search.js +6 -0
- package/lib/entries/icon-select.d.ts +2 -0
- package/lib/entries/icon-select.js +6 -0
- package/lib/entries/icon-sort.d.ts +2 -0
- package/lib/entries/icon-sort.js +6 -0
- package/lib/entries/icon-success.d.ts +2 -0
- package/lib/entries/icon-success.js +6 -0
- package/lib/entries/icon-sun.d.ts +2 -0
- package/lib/entries/icon-sun.js +6 -0
- package/lib/entries/icon-theme-default.d.ts +2 -0
- package/lib/entries/icon-theme-default.js +6 -0
- package/lib/entries/icon-warn.d.ts +2 -0
- package/lib/entries/icon-warn.js +6 -0
- package/lib/entries/icon-zoom-in.d.ts +2 -0
- package/lib/entries/icon-zoom-in.js +6 -0
- package/lib/entries/icon-zoom-out.d.ts +2 -0
- package/lib/entries/icon-zoom-out.js +6 -0
- package/lib/entries/image-preview.d.ts +10 -0
- package/lib/entries/image-preview.js +6 -0
- package/lib/entries/image.d.ts +2 -0
- package/lib/entries/image.js +6 -0
- package/lib/entries/input-number.d.ts +2 -0
- package/lib/entries/input-number.js +6 -0
- package/lib/entries/input.d.ts +2 -0
- package/lib/entries/input.js +6 -0
- package/lib/entries/list.d.ts +3 -0
- package/lib/entries/list.js +6 -0
- package/lib/entries/loading.d.ts +2 -0
- package/lib/entries/loading.js +2 -0
- package/lib/entries/mask.d.ts +2 -0
- package/lib/entries/mask.js +6 -0
- package/lib/entries/md-input.d.ts +2 -0
- package/lib/entries/md-input.js +6 -0
- package/lib/entries/menu.d.ts +3 -0
- package/lib/entries/menu.js +6 -0
- package/lib/entries/message.d.ts +6 -0
- package/lib/entries/message.js +2 -0
- package/lib/entries/modal-box.d.ts +6 -0
- package/lib/entries/modal-box.js +2 -0
- package/lib/entries/modal.d.ts +4 -0
- package/lib/entries/modal.js +6 -0
- package/lib/entries/notification-box.d.ts +2 -0
- package/lib/entries/notification-box.js +2 -0
- package/lib/entries/notification.d.ts +2 -0
- package/lib/entries/notification.js +2 -0
- package/lib/entries/page-header.d.ts +4 -0
- package/lib/entries/page-header.js +6 -0
- package/lib/entries/pagination.d.ts +9 -0
- package/lib/entries/pagination.js +6 -0
- package/lib/entries/polygon.d.ts +2 -0
- package/lib/entries/polygon.js +6 -0
- package/lib/entries/popconfirm.d.ts +3 -0
- package/lib/entries/popconfirm.js +2 -0
- package/lib/entries/popover.d.ts +1 -0
- package/lib/entries/popover.js +2 -0
- package/lib/entries/qrcode.d.ts +2 -0
- package/lib/entries/qrcode.js +6 -0
- package/lib/entries/radio-group.d.ts +3 -0
- package/lib/entries/radio-group.js +6 -0
- package/lib/entries/radio.d.ts +2 -0
- package/lib/entries/radio.js +6 -0
- package/lib/entries/select-ori.d.ts +2 -0
- package/lib/entries/select-ori.js +6 -0
- package/lib/entries/select.d.ts +4 -0
- package/lib/entries/select.js +6 -0
- package/lib/entries/space.d.ts +2 -0
- package/lib/entries/space.js +6 -0
- package/lib/entries/switch.d.ts +2 -0
- package/lib/entries/switch.js +6 -0
- package/lib/entries/tabbar-item.d.ts +2 -0
- package/lib/entries/tabbar-item.js +6 -0
- package/lib/entries/tabbar.d.ts +3 -0
- package/lib/entries/tabbar.js +6 -0
- package/lib/entries/table.d.ts +3 -0
- package/lib/entries/table.js +6 -0
- package/lib/entries/tabs.d.ts +3 -0
- package/lib/entries/tabs.js +2 -0
- package/lib/entries/tag.d.ts +2 -0
- package/lib/entries/tag.js +6 -0
- package/lib/entries/theme-color.d.ts +3 -0
- package/lib/entries/theme-color.js +6 -0
- package/lib/entries/theme.d.ts +9 -0
- package/lib/entries/theme.js +6 -0
- package/lib/entries/transition.d.ts +1 -0
- package/lib/entries/transition.js +2 -0
- package/lib/entries/upload.d.ts +3 -0
- package/lib/entries/upload.js +6 -0
- package/lib/entries/utils.d.ts +1 -0
- package/lib/entries/utils.js +2 -0
- package/lib/form/form_inner.d.ts +1 -0
- package/lib/{form_inner-Cnwb6f_Q.js → form/form_inner.js} +9 -9
- package/lib/form/form_item.d.ts +2 -1
- package/lib/form/form_item.js +148 -2
- package/lib/form/form_item.less_inline.js +4 -0
- package/lib/form/index.d.ts +3 -2
- package/lib/form/index.js +191 -2
- package/lib/form/index.less_inline.js +4 -0
- package/lib/icon/base.js +1 -1
- package/lib/icon/delete.d.ts +5 -0
- package/lib/icon/delete.js +10 -0
- package/lib/icon/eye_outline.d.ts +6 -0
- package/lib/icon/eye_outline.js +13 -0
- package/lib/icon/icon_style.js +8 -2
- package/lib/{icon_style-J7iiDS_a.js → icon/index.less_inline.js} +2 -3
- package/lib/icon/minus.d.ts +5 -0
- package/lib/icon/minus.js +10 -0
- package/lib/icon/picture.d.ts +5 -0
- package/lib/icon/picture.js +10 -0
- package/lib/icon/plus.d.ts +5 -0
- package/lib/icon/plus.js +10 -0
- package/lib/image/image_preview.js +91 -2
- package/lib/image/image_preview.less_inline.js +4 -0
- package/lib/image/index.js +163 -2
- package/lib/image/index.less_inline.js +4 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +48 -40
- package/lib/input/index.js +4 -4
- package/lib/{input-DUBlLEXS.js → input/index.less_inline.js} +1 -1
- package/lib/{input_inner-x4GfLGjj.js → input/input_inner.less_inline.js} +1 -1
- package/lib/input_number/index.js +3 -3
- package/lib/{style-C5wUmE2b.js → input_number/index.less_inline.js} +2 -3
- package/lib/input_number/style.js +8 -2
- package/lib/list/index.js +52 -2
- package/lib/list/index.less_inline.js +4 -0
- package/lib/loading/index.js +1 -1
- package/lib/mask/index.d.ts +1 -1
- package/lib/mask/index.js +109 -2
- package/lib/mask/index.less_inline.js +4 -0
- package/lib/md_input/index.js +59 -2
- package/lib/md_input/index.less_inline.js +4 -0
- package/lib/menu/index.js +275 -2
- package/lib/menu/index.less_inline.js +4 -0
- package/lib/message/index.js +1 -1
- package/lib/modal/index.js +199 -2
- package/lib/modal/index.less_inline.js +4 -0
- package/lib/modal/modal_box.js +21 -22
- package/lib/notification/index.d.ts +171 -0
- package/lib/notification/index.js +326 -0
- package/lib/notification/index.less_inline.js +4 -0
- package/lib/notification/notification_box.d.ts +40 -0
- package/lib/notification/notification_box.js +57 -0
- package/lib/notification/placement.d.ts +49 -0
- package/lib/notification/placement.js +48 -0
- package/lib/notification/style.d.ts +2 -0
- package/lib/notification/style.js +8 -0
- package/lib/page_header/index.js +100 -2
- package/lib/page_header/index.less_inline.js +4 -0
- package/lib/pagination/index.js +214 -2
- package/lib/pagination/index.less_inline.js +4 -0
- package/lib/polygon/index.js +21 -2
- package/lib/{polygon-DhhovlrG.js → polygon/index.less_inline.js} +2 -18
- package/lib/qrcode/index.js +65 -2
- package/lib/qrcode/index.less_inline.js +4 -0
- package/lib/select/index.js +355 -3
- package/lib/select/index.less_inline.js +4 -0
- package/lib/select_ori/index.js +58 -2
- package/lib/select_ori/index.less_inline.js +4 -0
- package/lib/space/index.js +40 -2
- package/lib/space/index.less_inline.js +4 -0
- package/lib/{animation-Bo4jbSGK.js → styles/animation/index.css_inline.js} +2 -3
- package/lib/styles/animation/index.js +8 -2
- package/lib/{mask-Ox6CoyFB.js → styles/mask/index.css_inline.js} +2 -3
- package/lib/styles/mask/index.js +8 -2
- package/lib/switch/index.js +51 -2
- package/lib/switch/index.less_inline.js +4 -0
- package/lib/tabbar/index.js +97 -2
- package/lib/tabbar/index.less_inline.js +4 -0
- package/lib/tabbar/item.js +61 -2
- package/lib/tabbar/item.less_inline.js +4 -0
- package/lib/table/index.js +234 -2
- package/lib/table/index.less_inline.js +4 -0
- package/lib/tabs/index.js +1 -1
- package/lib/tag/index.js +75 -2
- package/lib/tag/index.less_inline.js +4 -0
- package/lib/theme/index.js +86 -2
- package/lib/theme/index.less_inline.js +4 -0
- package/lib/theme/theme_color.js +1 -1
- package/lib/upload/index.d.ts +170 -0
- package/lib/upload/index.js +848 -0
- package/lib/upload/index.less_inline.js +4 -0
- package/lib/upload/style.d.ts +2 -0
- package/lib/upload/style.js +8 -0
- package/lib/utils/context_provide.d.ts +1 -0
- package/lib/utils/context_provide.js +1 -1
- package/lib/utils/event.d.ts +30 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +1 -1
- package/lib/utils/popover.js +1 -1
- package/lib/utils/signal_types.d.ts +5 -0
- package/lib/utils/transition.d.ts +28 -0
- package/lib/utils/transition.js +1 -1
- package/package.json +39 -18
- package/styles/animation.css +2 -2
- package/styles/container.css +8 -8
- package/styles/dark.css +21 -1
- package/styles/datepicker.css +9 -9
- package/styles/dialog.css +7 -7
- package/styles/loading.css +17 -17
- package/styles/message.css +9 -9
- package/styles/modal_box.css +3 -3
- package/styles/notification.css +17 -0
- package/styles/popover.css +11 -14
- package/styles/reset.css +13 -15
- package/styles/scrollbar.css +5 -5
- package/styles/select.css +6 -6
- package/styles/tabs.css +3 -3
- package/styles/theme-coral.css +35 -0
- package/styles/theme-jade.css +35 -0
- package/styles/theme-tangerine.css +35 -0
- package/styles/transition.css +1 -1
- package/styles/vars.css +7 -7
- package/lib/calendar-CvlUsN6w.js +0 -146
- package/lib/card-3DM-lJQV.js +0 -63
- package/lib/carousel-DvkZ1YXq.js +0 -276
- package/lib/check-doQ2ZpQj.js +0 -117
- package/lib/collapse-B6-Rn05A.js +0 -102
- package/lib/color_picker-0a-IGZY9.js +0 -41
- package/lib/date_picker-BDN2PAz5.js +0 -99
- package/lib/date_picker_ori-BXFs1eET.js +0 -120
- package/lib/description_panel--AKXBzLL.js +0 -53
- package/lib/esm-DAha108i.js +0 -270
- package/lib/form-DJxvBiLy.js +0 -190
- package/lib/form_item-BqPMRABd.js +0 -147
- package/lib/image-CVQai6NX.js +0 -162
- package/lib/image_preview-DfQAKSJH.js +0 -90
- package/lib/item-CQ2Sknbz.js +0 -14
- package/lib/item-DI6mQXtB.js +0 -117
- package/lib/item-D_ZOPXuE.js +0 -60
- package/lib/list-MG8PRzos.js +0 -51
- package/lib/mask-Bx-yNIJv.js +0 -108
- package/lib/md_input-BX3bujz8.js +0 -58
- package/lib/menu-DKscK5mw.js +0 -274
- package/lib/modal-Cwi3qlEf.js +0 -198
- package/lib/page_header-ujV3pncE.js +0 -99
- package/lib/pagination-aRbGd3Rf.js +0 -213
- package/lib/qrcode-Dip8uLSA.js +0 -64
- package/lib/select-BZMDj5VE.js +0 -354
- package/lib/select_ori-C7sUZxen.js +0 -57
- package/lib/space-CKuTk0YB.js +0 -39
- package/lib/switch-wh2-ivty.js +0 -50
- package/lib/tabbar-CBXK-_AV.js +0 -96
- package/lib/table-BQxMD2Ae.js +0 -233
- package/lib/tag-Di1z9PoZ.js +0 -74
- package/lib/theme-CLbBS-in.js +0 -85
package/README.md
CHANGED
|
@@ -1,49 +1,155 @@
|
|
|
1
1
|
# litos-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** | [简体中文](./README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A framework-agnostic UI component library built with native Web Components and TypeScript, featuring customizable themes and dark mode.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The name comes from the Greek adjective “λιτός” (`litós`), meaning simple or plain. Components use the `l-` prefix, such as `l-button` and `l-input`.
|
|
8
|
+
|
|
9
|
+
Built on native Web Components, litos-ui runs in modern browsers and can be used with React, Vue, Angular, or plain HTML and JavaScript.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
8
12
|
|
|
9
13
|
```bash
|
|
10
14
|
npm install litos-ui
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Import the base variables and the component subpaths you need in your client entry point. Element subpaths automatically register their built-in dependencies. The library ships as ESM.
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import "litos-ui/styles/vars.css";
|
|
23
|
+
import "litos-ui/button";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then use the custom element in your markup:
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<l-button type="primary">Get started</l-button>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Themes and Dark Mode
|
|
33
|
+
|
|
34
|
+
Import the base variables first, then optionally import **one** preset theme:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import "litos-ui/styles/vars.css";
|
|
38
|
+
import "litos-ui/styles/theme-jade.css";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<!-- prettier-ignore -->
|
|
42
|
+
| Theme | File | Primary color |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| Jade | `theme-jade.css` | `#00AA7E` |
|
|
45
|
+
| Coral | `theme-coral.css` | `#FF6448` |
|
|
46
|
+
| Tangerine | `theme-tangerine.css` | `#FF7802` |
|
|
47
|
+
|
|
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
|
+
|
|
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
|
+
|
|
52
|
+
```js
|
|
53
|
+
import "litos-ui/styles/dark.css";
|
|
54
|
+
|
|
55
|
+
document.documentElement.classList.add("dark");
|
|
56
|
+
// Restore light mode:
|
|
57
|
+
document.documentElement.classList.remove("dark");
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
See the [theme guide](https://dvshu.github.io/litos-ui/en/theme) for details.
|
|
61
|
+
|
|
62
|
+
## Browser and SSR Usage
|
|
63
|
+
|
|
64
|
+
The components use browser APIs such as Custom Elements, Shadow DOM, and constructable stylesheets (`CSSStyleSheet` and `adoptedStyleSheets`). Use a modern browser with support for these APIs.
|
|
65
|
+
|
|
66
|
+
Component modules access browser APIs when imported. In server-rendered applications, import and register them inside a client-only entry point or lifecycle hook. For example, run this code only on the client:
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
const { Button, regist } = await import("litos-ui");
|
|
70
|
+
regist([Button]);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Framework-specific configuration may also be needed to recognize custom elements and handle properties and custom events.
|
|
74
|
+
|
|
75
|
+
## Optional Auto-imports
|
|
76
|
+
|
|
77
|
+
For optional automatic imports of service APIs such as `Message` and `ModalBox`, together with their styles, install the resolver and auto-import plugin:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install -D litosui-unplugin-resolver unplugin-auto-import
|
|
81
|
+
```
|
|
14
82
|
|
|
15
83
|
```js
|
|
16
84
|
// vite.config.js
|
|
85
|
+
import { defineConfig } from "vite";
|
|
17
86
|
import AutoImport from "unplugin-auto-import/vite";
|
|
18
87
|
import LitosuiResolver from "litosui-unplugin-resolver";
|
|
19
88
|
|
|
20
|
-
// https://vitejs.dev/config/
|
|
21
89
|
export default defineConfig({
|
|
22
90
|
plugins: [
|
|
23
|
-
...,
|
|
24
91
|
AutoImport({
|
|
25
92
|
resolvers: [LitosuiResolver()],
|
|
26
93
|
dts: "src/auto-imports.d.ts",
|
|
27
94
|
}),
|
|
28
95
|
],
|
|
29
|
-
...
|
|
30
96
|
});
|
|
31
97
|
```
|
|
32
98
|
|
|
33
|
-
##
|
|
99
|
+
## Development and Build
|
|
34
100
|
|
|
35
|
-
|
|
101
|
+
For development in this repository, use Node.js 24 LTS and pnpm 12.5.1 to match CI. These versions describe the contributor environment, not a Node.js runtime requirement for browser applications.
|
|
36
102
|
|
|
37
|
-
```
|
|
38
|
-
|
|
103
|
+
```bash
|
|
104
|
+
pnpm install --frozen-lockfile
|
|
105
|
+
pnpm docs:dev
|
|
106
|
+
pnpm lib:build
|
|
107
|
+
pnpm docs:build
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Use `pnpm docs:dev` to preview the documentation and component examples. `pnpm dev` is a separate debugging entry point; currently, `src/main.ts` does not register any components.
|
|
111
|
+
|
|
112
|
+
Run `pnpm lint` and `pnpm fmt:check` to check the code, or `pnpm fmt` to format it. Running `npm pack` or `npm publish` automatically builds the library and type declarations first. Use `npm pack --dry-run` to inspect the package contents before publishing.
|
|
113
|
+
|
|
114
|
+
### Markdown Table Formatting
|
|
39
115
|
|
|
40
|
-
|
|
116
|
+
Use compact Markdown tables in README files and both documentation languages: one space around each cell, with no padding for source-column alignment. Use `| --- | --- |` for separator rows and preserve alignment markers such as `:---`, `---:`, and `:---:`. Keep cell content, escaped pipes, and code examples unchanged.
|
|
117
|
+
|
|
118
|
+
Place `<!-- prettier-ignore -->` immediately above each table header, with no blank line between them. This local directive keeps Oxfmt from padding the table while the rest of the Markdown file remains formatted. Do not add directives inside code examples or exclude whole Markdown files.
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
<!-- prettier-ignore -->
|
|
122
|
+
| Attribute | Default |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `disabled` | `false` |
|
|
41
125
|
```
|
|
42
126
|
|
|
43
|
-
|
|
127
|
+
Format only the files you changed, then check them; replace these README paths with the corresponding Chinese and English component documentation paths when needed:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pnpm exec oxfmt README.md README.zh-CN.md
|
|
131
|
+
pnpm exec oxfmt --check README.md README.zh-CN.md
|
|
132
|
+
pnpm fmt:check
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Confirm that formatting does not add table padding. A formatting check does not independently enforce compact tables inside ignored blocks, so review their source and rendered output. Follow the [repository guidelines](./AGENTS.md) and [translation guide](./TRANSLATION_GUIDE.md). These rules apply to new and edited tables; migration of existing tables and editor settings remains tracked in the task list.
|
|
136
|
+
|
|
137
|
+
## Documentation
|
|
44
138
|
|
|
45
|
-
[
|
|
139
|
+
[Documentation](https://dvshu.github.io/litos-ui/en/)
|
|
46
140
|
|
|
47
|
-
|
|
141
|
+
The English documentation structure is available; page content is currently copied from Chinese and awaits translation.
|
|
142
|
+
|
|
143
|
+
## License
|
|
48
144
|
|
|
49
145
|
[](LICENSE)
|
|
146
|
+
|
|
147
|
+
## On-demand Imports
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
import "litos-ui/styles/vars.css";
|
|
151
|
+
import "litos-ui/button";
|
|
152
|
+
import "litos-ui/input-number";
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
These client-only element entries register their built-in dependencies, including Button's loading icon. Root imports with manual regist() remain supported. Service subpaths, such as Message from "litos-ui/message", require explicit API calls and do not install global styles. CSS imports are currently commented out for future Vite plugin configuration. See the [complete entry list and SSR guidance](https://dvshu.github.io/litos-ui/en/on_demand).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# litos-ui
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
基于原生 Web Components 和 TypeScript 的跨框架 UI 组件库,支持 CSS 变量主题定制与暗黑模式。
|
|
6
|
+
|
|
7
|
+
源自于希腊语中,表示“简洁、朴素”的形容词 "λιτός" (`litós`);所有组件均以 `l-` 为前缀,如 `l-button`、`l-input` 等。
|
|
8
|
+
|
|
9
|
+
采用原生 `Web Components` 作为技术栈,可运行在现代浏览器上。跨平台、跨框架,可运行在 `React`、`Vue`、`Angular` 等框架中。
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install litos-ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 使用
|
|
18
|
+
|
|
19
|
+
在客户端入口引入基础变量和需要的组件子路径,自动注册组件及内建依赖。组件库提供 ESM 产物,使用 ES Module `import` 引入。
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import "litos-ui/styles/vars.css";
|
|
23
|
+
import "litos-ui/button";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
然后在页面中使用自定义元素:
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<l-button type="primary">开始使用</l-button>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 主题与暗黑模式
|
|
33
|
+
|
|
34
|
+
先引入基础变量,再按需选择**一套**预置主题:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import "litos-ui/styles/vars.css";
|
|
38
|
+
import "litos-ui/styles/theme-jade.css";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<!-- prettier-ignore -->
|
|
42
|
+
| 主题 | 文件 | 主色 |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| 翡翠绿 | `theme-jade.css` | `#00AA7E` |
|
|
45
|
+
| 珊瑚红 | `theme-coral.css` | `#FF6448` |
|
|
46
|
+
| 活力橙 | `theme-tangerine.css` | `#FF7802` |
|
|
47
|
+
|
|
48
|
+
预置主题通过 `:root` 定义全局 CSS 变量。一次选择一套,同时引入多套时,后加载的主题会覆盖先加载的主题。不引入预置主题时,使用默认蓝色主题,也可以在自己的样式文件中覆盖单个变量。
|
|
49
|
+
|
|
50
|
+
暗黑模式变量独立放在 `dark.css` 中。在 `vars.css` 之后引入,再通过客户端代码切换根元素的 `dark` 类:
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import "litos-ui/styles/dark.css";
|
|
54
|
+
|
|
55
|
+
document.documentElement.classList.add("dark");
|
|
56
|
+
// 恢复浅色模式:
|
|
57
|
+
document.documentElement.classList.remove("dark");
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
更多用法见[主题切换指南](https://dvshu.github.io/litos-ui/theme)。
|
|
61
|
+
|
|
62
|
+
## 浏览器与 SSR 使用
|
|
63
|
+
|
|
64
|
+
组件使用 Custom Elements、Shadow DOM 和可构造样式表(`CSSStyleSheet`、`adoptedStyleSheets`)等浏览器 API,需要使用支持这些能力的现代浏览器。
|
|
65
|
+
|
|
66
|
+
组件模块在导入时就会访问浏览器 API。服务端渲染项目需要在客户端专用入口或生命周期中导入、注册组件,不能在服务端直接执行组件导入。例如,以下代码仅在客户端执行:
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
const { Button, regist } = await import("litos-ui");
|
|
70
|
+
regist([Button]);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
集成具体框架时,可能还需要配置自定义元素识别,以及属性和自定义事件的处理。
|
|
74
|
+
|
|
75
|
+
## 可选自动导入
|
|
76
|
+
|
|
77
|
+
如果需要自动导入 `Message`、`ModalBox` 等服务 API 及其样式,可选用以下插件:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install -D litosui-unplugin-resolver unplugin-auto-import
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
// vite.config.js
|
|
85
|
+
import { defineConfig } from "vite";
|
|
86
|
+
import AutoImport from "unplugin-auto-import/vite";
|
|
87
|
+
import LitosuiResolver from "litosui-unplugin-resolver";
|
|
88
|
+
|
|
89
|
+
export default defineConfig({
|
|
90
|
+
plugins: [
|
|
91
|
+
AutoImport({
|
|
92
|
+
resolvers: [LitosuiResolver()],
|
|
93
|
+
dts: "src/auto-imports.d.ts",
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 开发与构建
|
|
100
|
+
|
|
101
|
+
参与本仓库开发时,使用 Node.js 24 LTS 和 pnpm 12.5.1,与 CI 保持一致。这是贡献者的开发环境约定,不是浏览器应用使用组件库的 Node.js 运行时要求。
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pnpm install --frozen-lockfile
|
|
105
|
+
pnpm docs:dev
|
|
106
|
+
pnpm lib:build
|
|
107
|
+
pnpm docs:build
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
使用 `pnpm docs:dev` 预览文档和组件示例。`pnpm dev` 是独立的调试入口,当前 `src/main.ts` 尚未注册组件。
|
|
111
|
+
|
|
112
|
+
可使用 `pnpm lint`、`pnpm fmt:check` 检查代码,使用 `pnpm fmt` 格式化。执行 `npm pack` 或 `npm publish` 前会自动构建组件库和类型声明;发布前可通过 `npm pack --dry-run` 检查文件清单。
|
|
113
|
+
|
|
114
|
+
### Markdown 表格格式
|
|
115
|
+
|
|
116
|
+
README 和中英文文档的 Markdown 表格采用紧凑写法:单元格两侧各保留一个空格,不为源码列对齐添加填充空格。分隔行使用 `| --- | --- |`,保留 `:---`、`---:`、`:---:` 等对齐标记,不改变单元格内容、转义竖线和代码示例。
|
|
117
|
+
|
|
118
|
+
每个表头前紧贴一行 `<!-- prettier-ignore -->`,两者之间不留空行。该局部指令防止 Oxfmt 为表格补齐空格,其余 Markdown 仍正常格式化;不在代码示例内添加指令,也不忽略整份 Markdown。
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
<!-- prettier-ignore -->
|
|
122
|
+
| 属性 | 默认值 |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `disabled` | `false` |
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
优先只格式化本次修改的文件,再执行检查;维护组件文档时,将以下 README 路径替换为对应的中英文组件文档路径:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pnpm exec oxfmt README.md README.zh-CN.md
|
|
131
|
+
pnpm exec oxfmt --check README.md README.zh-CN.md
|
|
132
|
+
pnpm fmt:check
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
确认格式化后没有回填表格空格。格式检查不会独立约束被忽略表格内部的紧凑写法,因此还需核对源码和渲染结果。具体遵循[仓库协作规范](./AGENTS.md)与[翻译指南](./TRANSLATION_GUIDE.md)。此约定适用于新增和编辑的表格,历史表格迁移及编辑器配置仍按待完成清单单独跟踪。
|
|
136
|
+
|
|
137
|
+
## 文档
|
|
138
|
+
|
|
139
|
+
[中文文档](https://dvshu.github.io/litos-ui/)
|
|
140
|
+
|
|
141
|
+
英文文档结构已建立,页面正文暂时保留中文,待后续翻译。
|
|
142
|
+
|
|
143
|
+
## 许可证
|
|
144
|
+
|
|
145
|
+
[](LICENSE)
|
|
146
|
+
|
|
147
|
+
## 按需导入
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
import "litos-ui/styles/vars.css";
|
|
151
|
+
import "litos-ui/button";
|
|
152
|
+
import "litos-ui/input-number";
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
在客户端入口加载后即可使用,自动注册内建依赖(包括 Button 的 loading 图标)。原有总入口加手动 regist() 用法继续支持。服务子路径(如默认导入 litos-ui/message)不自动引入全局样式(入口仅保留 CSS 引入注释,后续由 Vite 插件配置),仍需显式调用 API。完整入口、类型及 SSR 限制见[按需导入指南](https://dvshu.github.io/litos-ui/on_demand)。
|
package/lib/base.d.ts
CHANGED
package/lib/base.js
CHANGED
package/lib/button/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import e from "../base.js";
|
|
2
2
|
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "../utils/index.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { $one as o, addClass as s, formatClass as c, formatStyle as l, off as u, on as d, removeClass as f } from "
|
|
6
|
-
import { adjust as p } from "
|
|
3
|
+
import i from "../styles/animation/index.js";
|
|
4
|
+
import a from "./style.js";
|
|
5
|
+
import { $one as o, addClass as s, formatClass as c, formatStyle as l, off as u, on as d, removeClass as f } from "utilane/browser";
|
|
6
|
+
import { adjust as p } from "utilane";
|
|
7
7
|
//#region src/components/button/index.ts
|
|
8
8
|
var m = class extends e {
|
|
9
9
|
static baseName = "button";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/components/button/index.less?inline
|
|
2
|
-
var e = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--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;--l-btn-height:var(--l-form-control-height,32px);width:auto;height:var(--l-btn-height);text-indent:0;box-sizing:border-box;border-radius:var(--l-border-radius,3px);display:inline-flex}:host([block]){width:100%}:host(.l-btn-small){--l-btn-height:24px;--l-btn-padding:0 7px}:host(.l-btn-large){--l-border-radius:6px;--l-btn-height:40px;--l-btn-padding:0 15px;font-size:16px}.l-btn{cursor:pointer;box-sizing:border-box;vertical-align:middle;width:100%;padding:var(--l-btn-padding);border-radius:inherit;height:100%;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);justify-content:center;align-items:center;gap:var(--l-btn-gap,5px);line-height:1;font-size:inherit;outline:none;transition:border-color .3s,background-color .3s,color .3s;display:inline-flex;position:relative}.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-box-shadow:hover{box-shadow:0 4px 12px var(--l-primary-color-light4)}.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-normal-v2{--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:transparent;--l-btn-active-background:transparent;--l-btn-hover-border-color:var(--l-btn-hover-text-color);--l-btn-active-border-color:var(--l-btn-active-text-color)}.l-btn-normal-v2{--l-btn-hover-background:var(--l-primary-color-light5);--l-btn-active-background:var(--l-primary-color-light4)}.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-disabled-border-color:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-background:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-color:#fff}.l-btn: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.l-btn-loading{cursor:default}.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;--l-btn-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-control-height,32px) / 2)}.l-btn-circle{width:var(--l-form-control-height,32px);border-radius:50%;padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background:#ffffff14;--l-btn-disabled-color:#ffffff4d;--l-btn-disabled-border-color:#ffffff4d}"
|
|
3
|
-
t.replaceSync(e);
|
|
2
|
+
var e = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--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;--l-btn-height:var(--l-form-control-height,32px);width:auto;height:var(--l-btn-height);text-indent:0;box-sizing:border-box;border-radius:var(--l-border-radius,3px);display:inline-flex}:host([block]){width:100%}:host(.l-btn-small){--l-btn-height:24px;--l-btn-padding:0 7px}:host(.l-btn-large){--l-border-radius:6px;--l-btn-height:40px;--l-btn-padding:0 15px;font-size:16px}.l-btn{cursor:pointer;box-sizing:border-box;vertical-align:middle;width:100%;padding:var(--l-btn-padding);border-radius:inherit;height:100%;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);justify-content:center;align-items:center;gap:var(--l-btn-gap,5px);line-height:1;font-size:inherit;outline:none;transition:border-color .3s,background-color .3s,color .3s;display:inline-flex;position:relative}.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-box-shadow:hover{box-shadow:0 4px 12px var(--l-primary-color-light4)}.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-normal-v2{--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:transparent;--l-btn-active-background:transparent;--l-btn-hover-border-color:var(--l-btn-hover-text-color);--l-btn-active-border-color:var(--l-btn-active-text-color)}.l-btn-normal-v2{--l-btn-hover-background:var(--l-primary-color-light5);--l-btn-active-background:var(--l-primary-color-light4)}.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-disabled-border-color:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-background:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-color:#fff}.l-btn: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.l-btn-loading{cursor:default}.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;--l-btn-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-control-height,32px) / 2)}.l-btn-circle{width:var(--l-form-control-height,32px);border-radius:50%;padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background:#ffffff14;--l-btn-disabled-color:#ffffff4d;--l-btn-disabled-border-color:#ffffff4d}";
|
|
4
3
|
//#endregion
|
|
5
|
-
export {
|
|
4
|
+
export { e as default };
|
package/lib/button/style.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "./index.less_inline.js";
|
|
2
|
+
//#region src/components/button/style.ts
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
7
|
+
//#endregion
|
|
8
|
+
export { t as default };
|
package/lib/calendar/index.js
CHANGED
|
@@ -1,2 +1,140 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import { parseAttrValue as t } from "../utils/index.js";
|
|
3
|
+
import n from "./index.less_inline.js";
|
|
4
|
+
import { langs as r } from "./langs.js";
|
|
5
|
+
import { $one as i, get as a, hasClass as o, off as s, on as c, shouldEventNext as l } from "utilane/browser";
|
|
6
|
+
import { endOf as u, format as d, startOf as f, timestamp as p } from "utilane";
|
|
7
|
+
//#region src/components/calendar/index.ts
|
|
8
|
+
var m = class extends e {
|
|
9
|
+
static baseName = "calendar";
|
|
10
|
+
_langData;
|
|
11
|
+
$container;
|
|
12
|
+
_selectDates;
|
|
13
|
+
_range;
|
|
14
|
+
_value;
|
|
15
|
+
constructor() {
|
|
16
|
+
super(), this.version = 2;
|
|
17
|
+
let e = a("l_app_locale", "zh-CN", { storage: "session" }), t = /* @__PURE__ */ new Date();
|
|
18
|
+
this._value = "", this._state = {
|
|
19
|
+
locale: e,
|
|
20
|
+
minDate: -Infinity,
|
|
21
|
+
maxDate: Infinity,
|
|
22
|
+
year: t.getFullYear(),
|
|
23
|
+
type: "select",
|
|
24
|
+
month: t.getMonth()
|
|
25
|
+
}, this._langData = r[e], this._selectDates = /* @__PURE__ */ new Set(), this._range = [0, 0];
|
|
26
|
+
}
|
|
27
|
+
get value() {
|
|
28
|
+
return this._value;
|
|
29
|
+
}
|
|
30
|
+
set value(e) {
|
|
31
|
+
this.setValue(e);
|
|
32
|
+
}
|
|
33
|
+
setValue(e) {
|
|
34
|
+
e != this._value && (this._value = e, this._updateValue());
|
|
35
|
+
}
|
|
36
|
+
_updateValue() {
|
|
37
|
+
this._state.type === "range" ? (this._range = this._value ? this._value.split(",").map((e) => /^\d+$/.test(e) ? e.length === 10 ? Number(e) * 1e3 : Number(e) : p(e, "ms")) : [0, 0], this._selectDates.clear()) : (this._selectDates = new Set(this._value.split("&")), this._range = [0, 0]), this.batchUpdate();
|
|
38
|
+
}
|
|
39
|
+
afterInit() {
|
|
40
|
+
this.$container = i(".calendar-table", this.root), c(this.root, "click", this.handleCellClick), c(this.$container, "mouseover", this.handleCellHover);
|
|
41
|
+
}
|
|
42
|
+
beforeDestroy() {
|
|
43
|
+
s(this.root, "click", this.handleCellClick), this.$container &&= (s(this.$container, "mouseover", this.handleCellHover), void 0);
|
|
44
|
+
}
|
|
45
|
+
static get observedAttributes() {
|
|
46
|
+
return [
|
|
47
|
+
"value",
|
|
48
|
+
"locale",
|
|
49
|
+
"year",
|
|
50
|
+
"month",
|
|
51
|
+
"min-date",
|
|
52
|
+
"max-date",
|
|
53
|
+
"type"
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
handleCellClick = (e) => {
|
|
57
|
+
let [t, n, r] = l(e, "l-day", this.root);
|
|
58
|
+
t && this._emitDayAction(r, "click", n);
|
|
59
|
+
};
|
|
60
|
+
handleCellHover = (e) => {
|
|
61
|
+
let [t, n, r] = l(e, "l-day", this.root);
|
|
62
|
+
t && this._emitDayAction(r, "hover", n);
|
|
63
|
+
};
|
|
64
|
+
_emitDayAction(e, t, n) {
|
|
65
|
+
this.emit(`day-${t}`, { detail: {
|
|
66
|
+
minTimestamp: this._state.minDate,
|
|
67
|
+
maxTimestamp: this._state.maxDate,
|
|
68
|
+
dayTimestamp: Number(n),
|
|
69
|
+
day: e.title,
|
|
70
|
+
isActiveMonth: !o(e, "excluded")
|
|
71
|
+
} });
|
|
72
|
+
}
|
|
73
|
+
attributeChanged(e, n, i) {
|
|
74
|
+
switch (e) {
|
|
75
|
+
case "locale":
|
|
76
|
+
r.hasOwnProperty(i) && (this._state.locale = i, this._langData = r[i]);
|
|
77
|
+
break;
|
|
78
|
+
case "min-date":
|
|
79
|
+
this._state.minDate = f(i).getTime();
|
|
80
|
+
break;
|
|
81
|
+
case "max-date":
|
|
82
|
+
this._state.maxDate = u(i).getTime();
|
|
83
|
+
break;
|
|
84
|
+
case "year":
|
|
85
|
+
this._state.year = t(i, this._state.year);
|
|
86
|
+
break;
|
|
87
|
+
case "month":
|
|
88
|
+
this._state.month = t(i, this._state.month + 1) - 1;
|
|
89
|
+
break;
|
|
90
|
+
case "type":
|
|
91
|
+
this._state.type = i, this._updateValue();
|
|
92
|
+
break;
|
|
93
|
+
case "value": this.setValue(i);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
updateDOM(e) {
|
|
97
|
+
e.has("locale") ? this.rerenderHeader() : e.has("year") || e.has("month") ? this.$container && (this.$container.innerHTML = this.rerender()) : this.rerenderBody();
|
|
98
|
+
}
|
|
99
|
+
_renderHeader() {
|
|
100
|
+
return `<tr>${this._langData.weekdays.map((e) => `<th>${e}</th>`).join("")}</tr>`;
|
|
101
|
+
}
|
|
102
|
+
_renderBody() {
|
|
103
|
+
let e = this._state.year, t = this._state.month, n = d(null, "yyyy-mm-dd"), r = new Date(e, t, 1), i = r.getDay() - 1;
|
|
104
|
+
i < 0 && (i = 6);
|
|
105
|
+
let a = new Date(e, t + 1, 0), o = a.getDate(), s = d(a, "yyyy-mm"), c = new Date(e, t, 0), l = c.getDate(), u = d(c, "yyyy-mm"), f = new Date(e, t + 1, 1), p = d(f, "yyyy-mm"), m = new Date(r);
|
|
106
|
+
m.setDate(m.getDate() - i);
|
|
107
|
+
let h = m.setHours(0, 0, 0, 0), g = "", [_, v] = this._range || [];
|
|
108
|
+
for (let e = 0; e < 42; e++) {
|
|
109
|
+
e % 7 == 0 && (g += "<tr>");
|
|
110
|
+
let t, r = "day", a = "";
|
|
111
|
+
e < i ? (t = `${l - i + e + 1}`, r += " excluded", a = u) : e < i + o ? (t = `${e - i + 1}`, a = s) : (t = `${e - i - o + 1}`, r += " excluded", a = p), (h < this._state.minDate || h > this._state.maxDate) && (r += " disabled");
|
|
112
|
+
let c = `${a}-${t.padStart(2, "0")}`;
|
|
113
|
+
c === n && (r += " today"), this._selectDates.has(c) && (r += " active"), _ && v && (_ === h ? r += " range-start" : v === h ? r += " range-end" : _ < h && h < v && (r += " range")), g += `<td class="${r}" title="${c}" l-day="${h}">${t}</td>`, h += 864e5, e % 7 == 6 && (g += "</tr>");
|
|
114
|
+
}
|
|
115
|
+
return g;
|
|
116
|
+
}
|
|
117
|
+
rerenderHeader() {
|
|
118
|
+
if (this.$container) {
|
|
119
|
+
let e = i("thead", this.$container);
|
|
120
|
+
e.innerHTML = this._renderHeader();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
rerenderBody() {
|
|
124
|
+
if (this.$container) {
|
|
125
|
+
let e = i("tbody", this.$container);
|
|
126
|
+
e.innerHTML = this._renderBody();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
rerender() {
|
|
130
|
+
return `<thead>${this._renderHeader()}</thead><tbody>${this._renderBody()}</tbody>`;
|
|
131
|
+
}
|
|
132
|
+
render_v2() {
|
|
133
|
+
return {
|
|
134
|
+
template: `<table class="calendar-table" l-day="__stop__">${this.rerender()}</table>`,
|
|
135
|
+
style: [n]
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { m as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/calendar/index.less?inline
|
|
2
|
+
var e = ":host{box-sizing:border-box;width:100%;height:100%;display:block}.calendar-table{border-collapse:collapse;table-layout:fixed;width:100%;height:100%}.calendar-table thead{height:var(--l-calendar-header-height,32px)}.calendar-table th{cursor:default;font-weight:400}.calendar-table .excluded{color:var(--l-calendar-off-text-color,#a8abb2)}.day{text-align:center;cursor:pointer;font-size:14px;transition:background-color .2s}:where(.day:hover){background-color:#0000000a}.day.disabled{color:var(--l-calendar-off-text-color,#a8abb2);cursor:not-allowed}.day.active:not(.disabled){background-color:var(--l-primary-color,#007bff);color:#fff;font-weight:700}.day.today{color:var(--l-primary-color,#007bff)}.day.range{background-color:var(--l-primary-color-light4,#cce6ff)}.day.range-start,.day.range-end{background-color:var(--l-primary-color,#007bff);color:#fff}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/card/index.js
CHANGED
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import { kebabToCamel as t, parseAttrValue as n } from "../utils/index.js";
|
|
3
|
+
import r from "./index.less_inline.js";
|
|
4
|
+
import { $$ as i } from "utilane/browser";
|
|
5
|
+
//#region src/components/card/index.ts
|
|
6
|
+
var a = class extends e {
|
|
7
|
+
static baseName = "card";
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this.version = 2, this._state = {
|
|
10
|
+
headerText: "",
|
|
11
|
+
showHeader: !0,
|
|
12
|
+
footerText: "",
|
|
13
|
+
showFooter: !1
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return [
|
|
18
|
+
"header-text",
|
|
19
|
+
"show-header",
|
|
20
|
+
"footer-text",
|
|
21
|
+
"show-footer"
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
attributeChanged(e, r, i) {
|
|
25
|
+
switch (e) {
|
|
26
|
+
case "header-text":
|
|
27
|
+
case "footer-text":
|
|
28
|
+
this._state[t(e)] = i;
|
|
29
|
+
break;
|
|
30
|
+
case "show-header":
|
|
31
|
+
case "show-footer": this._state[t(e)] = n(i, !1, e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
render_v2() {
|
|
35
|
+
return {
|
|
36
|
+
style: r,
|
|
37
|
+
template: this.render()
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
let e = document.createDocumentFragment();
|
|
42
|
+
if (this._state.showHeader) {
|
|
43
|
+
let t = i("div", {
|
|
44
|
+
class: "l-card__header",
|
|
45
|
+
part: "header"
|
|
46
|
+
}, [this._state.headerText ? i("span", { textContent: this._state.headerText }) : i("slot", { name: "header" }), i("slot", { name: "header-extra" })]);
|
|
47
|
+
e.appendChild(t);
|
|
48
|
+
}
|
|
49
|
+
let t = i("div", {
|
|
50
|
+
class: "l-card__body",
|
|
51
|
+
part: "body"
|
|
52
|
+
}, [i("slot")]);
|
|
53
|
+
if (e.appendChild(t), this._state.showFooter) {
|
|
54
|
+
let t = i("div", {
|
|
55
|
+
class: "l-card__footer",
|
|
56
|
+
part: "footer"
|
|
57
|
+
}, [this._state.footerText ? i("span", { textContent: this._state.footerText }) : i("slot", { name: "footer" })]);
|
|
58
|
+
e.appendChild(t);
|
|
59
|
+
}
|
|
60
|
+
return e;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { a as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/card/index.less?inline
|
|
2
|
+
var e = ":host{border:1px solid var(--l-card-border-color,var(--l-border-color,#e8e8e8));background-color:var(--l-card-bg,#fff);color:var(--l-card-text-color,#333);border-radius:4px;display:block;box-shadow:0 1px 3px #0000001a,0 1px 2px -1px #0000001a}.l-card__header{border-bottom:1px solid var(--l-card-border-color,var(--l-border-color,#e8e8e8));box-sizing:border-box;justify-content:space-between;align-items:center;padding:15px;display:flex}.l-card__footer{border-top:1px solid var(--l-card-border-color,var(--l-border-color,#e8e8e8));box-sizing:border-box;padding:15px}.l-card__body{padding:15px}.l-header-extra:empty{display:none}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|