@varlet/ui 2.16.7 → 2.16.8-alpha.1695118057982
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/es/action-sheet/ActionSheet.mjs +97 -67
- package/es/action-sheet/index.mjs +43 -28
- package/es/action-sheet/props.mjs +39 -8
- package/es/app-bar/AppBar.mjs +129 -56
- package/es/app-bar/index.mjs +10 -5
- package/es/app-bar/props.mjs +6 -3
- package/es/avatar/Avatar.mjs +97 -87
- package/es/avatar/index.mjs +10 -5
- package/es/avatar/props.mjs +8 -5
- package/es/avatar-group/AvatarGroup.mjs +26 -20
- package/es/avatar-group/index.mjs +10 -5
- package/es/avatar-group/props.mjs +5 -2
- package/es/back-top/BackTop.mjs +71 -53
- package/es/back-top/index.mjs +10 -5
- package/es/back-top/props.mjs +6 -3
- package/es/badge/Badge.mjs +74 -46
- package/es/badge/index.mjs +10 -5
- package/es/badge/props.mjs +7 -4
- package/es/bottom-navigation/BottomNavigation.mjs +100 -97
- package/es/bottom-navigation/index.mjs +10 -5
- package/es/bottom-navigation/props.mjs +7 -4
- package/es/bottom-navigation/provide.mjs +13 -9
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +93 -74
- package/es/bottom-navigation-item/index.mjs +10 -5
- package/es/bottom-navigation-item/props.mjs +7 -4
- package/es/bottom-navigation-item/provide.mjs +14 -11
- package/es/breadcrumb/Breadcrumb.mjs +51 -36
- package/es/breadcrumb/index.mjs +10 -5
- package/es/breadcrumb/props.mjs +6 -3
- package/es/breadcrumb/provide.mjs +12 -11
- package/es/breadcrumbs/Breadcrumbs.mjs +26 -24
- package/es/breadcrumbs/index.mjs +10 -5
- package/es/breadcrumbs/props.mjs +6 -3
- package/es/breadcrumbs/provide.mjs +11 -9
- package/es/button/Button.mjs +88 -90
- package/es/button/index.mjs +10 -5
- package/es/button/props.mjs +31 -10
- package/es/button/provide.mjs +8 -9
- package/es/button-group/ButtonGroup.mjs +38 -26
- package/es/button-group/index.mjs +8 -4
- package/es/button-group/props.mjs +8 -5
- package/es/button-group/provide.mjs +9 -9
- package/es/card/Card.mjs +292 -189
- package/es/card/index.mjs +10 -5
- package/es/card/props.mjs +9 -6
- package/es/cell/Cell.mjs +96 -52
- package/es/cell/index.mjs +10 -5
- package/es/cell/props.mjs +6 -3
- package/es/checkbox/Checkbox.mjs +136 -130
- package/es/checkbox/index.mjs +10 -5
- package/es/checkbox/props.mjs +9 -6
- package/es/checkbox/provide.mjs +10 -9
- package/es/checkbox-group/CheckboxGroup.mjs +63 -96
- package/es/checkbox-group/index.mjs +10 -5
- package/es/checkbox-group/props.mjs +9 -6
- package/es/checkbox-group/provide.mjs +11 -9
- package/es/chip/Chip.mjs +66 -50
- package/es/chip/index.mjs +10 -5
- package/es/chip/props.mjs +10 -7
- package/es/col/Col.mjs +60 -55
- package/es/col/index.mjs +10 -5
- package/es/col/props.mjs +7 -4
- package/es/col/provide.mjs +8 -9
- package/es/collapse/Collapse.mjs +70 -73
- package/es/collapse/index.mjs +10 -5
- package/es/collapse/props.mjs +7 -4
- package/es/collapse/provide.mjs +11 -9
- package/es/collapse-item/CollapseItem.mjs +156 -93
- package/es/collapse-item/index.mjs +10 -5
- package/es/collapse-item/props.mjs +6 -3
- package/es/collapse-item/provide.mjs +12 -11
- package/es/context/index.mjs +9 -5
- package/es/context/lock.mjs +18 -22
- package/es/context/zIndex.mjs +19 -16
- package/es/countdown/Countdown.mjs +73 -70
- package/es/countdown/index.mjs +10 -5
- package/es/countdown/props.mjs +7 -4
- package/es/counter/Counter.mjs +169 -173
- package/es/counter/index.mjs +10 -5
- package/es/counter/props.mjs +8 -5
- package/es/counter/provide.ts +3 -0
- package/es/date-picker/DatePicker.mjs +411 -304
- package/es/date-picker/index.mjs +10 -5
- package/es/date-picker/props.mjs +71 -45
- package/es/date-picker/src/day-picker-panel.mjs +270 -208
- package/es/date-picker/src/month-picker-panel.mjs +205 -175
- package/es/date-picker/src/panel-header.mjs +101 -83
- package/es/date-picker/src/year-picker-panel.mjs +64 -54
- package/es/dialog/Dialog.mjs +171 -106
- package/es/dialog/index.mjs +49 -33
- package/es/dialog/props.mjs +39 -9
- package/es/divider/Divider.mjs +56 -51
- package/es/divider/index.mjs +10 -5
- package/es/divider/props.mjs +5 -2
- package/es/drag/Drag.mjs +126 -144
- package/es/drag/index.mjs +10 -5
- package/es/drag/props.mjs +8 -5
- package/es/ellipsis/Ellipsis.mjs +81 -50
- package/es/ellipsis/index.mjs +8 -4
- package/es/ellipsis/props.mjs +5 -2
- package/es/fab/Fab.mjs +73 -75
- package/es/fab/index.mjs +8 -4
- package/es/fab/props.mjs +14 -11
- package/es/field-decorator/FieldDecorator.mjs +215 -110
- package/es/field-decorator/props.mjs +9 -6
- package/es/form/Form.mjs +69 -79
- package/es/form/index.mjs +11 -6
- package/es/form/props.mjs +6 -3
- package/es/form/provide.mjs +35 -22
- package/es/form-details/FormDetails.mjs +81 -39
- package/es/form-details/index.mjs +10 -5
- package/es/form-details/props.mjs +7 -4
- package/es/hover/index.mjs +37 -40
- package/es/hover-overlay/HoverOverlay.mjs +18 -14
- package/es/hover-overlay/index.mjs +13 -8
- package/es/hover-overlay/props.mjs +5 -2
- package/es/icon/Icon.mjs +50 -33
- package/es/icon/index.mjs +10 -5
- package/es/icon/props.mjs +7 -4
- package/es/image/Image.mjs +76 -82
- package/es/image/index.mjs +10 -5
- package/es/image/props.mjs +7 -4
- package/es/image-preview/ImagePreview.mjs +176 -193
- package/es/image-preview/index.mjs +44 -30
- package/es/image-preview/props.mjs +34 -9
- package/es/index-anchor/IndexAnchor.mjs +45 -42
- package/es/index-anchor/index.mjs +10 -5
- package/es/index-anchor/props.mjs +5 -2
- package/es/index-anchor/provide.mjs +12 -11
- package/es/index-bar/IndexBar.mjs +130 -131
- package/es/index-bar/index.mjs +10 -5
- package/es/index-bar/props.mjs +6 -3
- package/es/index-bar/provide.mjs +11 -9
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +231 -247
- package/es/input/index.mjs +10 -5
- package/es/input/props.mjs +38 -8
- package/es/input/provide.ts +3 -0
- package/es/lazy/index.mjs +94 -87
- package/es/link/Link.mjs +39 -45
- package/es/link/index.mjs +10 -5
- package/es/link/props.mjs +8 -5
- package/es/list/List.mjs +144 -97
- package/es/list/index.mjs +10 -5
- package/es/list/props.mjs +8 -5
- package/es/list/provide.mjs +8 -9
- package/es/loading/Loading.mjs +165 -72
- package/es/loading/index.mjs +10 -5
- package/es/loading/props.mjs +7 -4
- package/es/loading-bar/LoadingBar.mjs +19 -16
- package/es/loading-bar/index.mjs +37 -30
- package/es/loading-bar/props.mjs +5 -2
- package/es/locale/en-US.mjs +76 -73
- package/es/locale/index.mjs +52 -41
- package/es/locale/zh-CN.mjs +76 -73
- package/es/menu/Menu.mjs +76 -57
- package/es/menu/index.mjs +10 -5
- package/es/menu/props.mjs +11 -8
- package/es/menu/usePopover.mjs +214 -207
- package/es/option/Option.mjs +86 -70
- package/es/option/index.mjs +10 -5
- package/es/option/props.mjs +5 -2
- package/es/option/provide.mjs +10 -11
- package/es/overlay/Overlay.mjs +29 -31
- package/es/overlay/index.mjs +10 -5
- package/es/overlay/props.mjs +7 -4
- package/es/pagination/Pagination.mjs +334 -202
- package/es/pagination/index.mjs +10 -5
- package/es/pagination/props.mjs +8 -5
- package/es/paper/Paper.mjs +43 -31
- package/es/paper/index.mjs +10 -5
- package/es/paper/props.mjs +6 -3
- package/es/picker/Picker.mjs +288 -224
- package/es/picker/index.mjs +24 -23
- package/es/picker/props.mjs +37 -7
- package/es/popup/Popup.mjs +68 -58
- package/es/popup/index.mjs +10 -5
- package/es/popup/props.mjs +9 -6
- package/es/popup/provide.mjs +12 -15
- package/es/progress/Progress.mjs +186 -114
- package/es/progress/index.mjs +10 -5
- package/es/progress/props.mjs +7 -4
- package/es/pull-refresh/PullRefresh.mjs +136 -116
- package/es/pull-refresh/index.mjs +10 -5
- package/es/pull-refresh/props.mjs +8 -5
- package/es/radio/Radio.mjs +122 -118
- package/es/radio/index.mjs +10 -5
- package/es/radio/props.mjs +8 -5
- package/es/radio/provide.mjs +8 -9
- package/es/radio-group/RadioGroup.mjs +50 -58
- package/es/radio-group/index.mjs +10 -5
- package/es/radio-group/props.mjs +10 -7
- package/es/radio-group/provide.mjs +11 -9
- package/es/rate/Rate.mjs +103 -132
- package/es/rate/index.mjs +10 -5
- package/es/rate/props.mjs +10 -7
- package/es/rate/provide.ts +3 -0
- package/es/result/Empty.mjs +21 -12
- package/es/result/Error.mjs +18 -9
- package/es/result/Info.mjs +18 -9
- package/es/result/Question.mjs +18 -9
- package/es/result/Result.mjs +102 -55
- package/es/result/Success.mjs +84 -40
- package/es/result/Warning.mjs +18 -9
- package/es/result/index.mjs +10 -5
- package/es/result/props.mjs +6 -3
- package/es/ripple/index.mjs +89 -101
- package/es/row/Row.mjs +40 -45
- package/es/row/index.mjs +10 -5
- package/es/row/props.mjs +8 -5
- package/es/row/provide.mjs +9 -9
- package/es/select/Select.mjs +308 -298
- package/es/select/index.mjs +10 -5
- package/es/select/props.mjs +40 -10
- package/es/select/provide.mjs +9 -9
- package/es/skeleton/Skeleton.mjs +182 -71
- package/es/skeleton/index.mjs +10 -5
- package/es/skeleton/props.mjs +5 -2
- package/es/slider/Slider.mjs +310 -260
- package/es/slider/index.mjs +10 -5
- package/es/slider/props.mjs +15 -11
- package/es/slider/provide.ts +3 -0
- package/es/snackbar/Snackbar.mjs +47 -34
- package/es/snackbar/core.mjs +140 -77
- package/es/snackbar/index.mjs +111 -97
- package/es/snackbar/props.mjs +35 -14
- package/es/space/Space.mjs +30 -28
- package/es/space/index.mjs +10 -5
- package/es/space/margin.mjs +22 -23
- package/es/space/props.mjs +8 -5
- package/es/step/Step.mjs +96 -74
- package/es/step/index.mjs +10 -5
- package/es/step/props.mjs +6 -3
- package/es/step/provide.mjs +10 -11
- package/es/steps/Steps.mjs +31 -30
- package/es/steps/index.mjs +10 -5
- package/es/steps/props.mjs +7 -4
- package/es/steps/provide.mjs +9 -8
- package/es/sticky/Sticky.mjs +104 -92
- package/es/sticky/index.mjs +10 -5
- package/es/sticky/props.mjs +6 -3
- package/es/style-provider/StyleProvider.mjs +19 -18
- package/es/style-provider/index.mjs +15 -11
- package/es/style-provider/props.mjs +6 -3
- package/es/swipe/Swipe.mjs +281 -268
- package/es/swipe/index.mjs +10 -5
- package/es/swipe/props.mjs +6 -3
- package/es/swipe/provide.mjs +11 -9
- package/es/swipe-item/SwipeItem.mjs +29 -29
- package/es/swipe-item/index.mjs +8 -4
- package/es/swipe-item/provide.mjs +10 -11
- package/es/switch/Switch.mjs +143 -103
- package/es/switch/index.mjs +10 -5
- package/es/switch/props.mjs +7 -4
- package/es/switch/provide.ts +3 -0
- package/es/tab/Tab.mjs +48 -61
- package/es/tab/index.mjs +10 -5
- package/es/tab/props.mjs +6 -3
- package/es/tab/provide.mjs +10 -11
- package/es/tab-item/TabItem.mjs +27 -32
- package/es/tab-item/index.mjs +10 -5
- package/es/tab-item/props.mjs +5 -2
- package/es/tab-item/provide.mjs +17 -18
- package/es/table/Table.mjs +54 -25
- package/es/table/index.mjs +10 -5
- package/es/table/props.mjs +6 -3
- package/es/tabs/Tabs.mjs +162 -134
- package/es/tabs/index.mjs +10 -5
- package/es/tabs/props.mjs +15 -12
- package/es/tabs/provide.mjs +9 -9
- package/es/tabs-items/TabsItems.mjs +61 -65
- package/es/tabs-items/index.mjs +10 -5
- package/es/tabs-items/props.mjs +7 -4
- package/es/tabs-items/provide.mjs +11 -9
- package/es/themes/dark/actionSheet.mjs +8 -5
- package/es/themes/dark/appBar.mjs +6 -3
- package/es/themes/dark/avatar.mjs +7 -4
- package/es/themes/dark/badge.mjs +6 -3
- package/es/themes/dark/bottomNavigation.mjs +7 -4
- package/es/themes/dark/bottomNavigationItem.mjs +6 -3
- package/es/themes/dark/breadcrumb.mjs +6 -3
- package/es/themes/dark/button.mjs +7 -4
- package/es/themes/dark/card.mjs +10 -7
- package/es/themes/dark/cell.mjs +7 -4
- package/es/themes/dark/checkbox.mjs +7 -4
- package/es/themes/dark/chip.mjs +7 -4
- package/es/themes/dark/collapse.mjs +8 -5
- package/es/themes/dark/countdown.mjs +6 -3
- package/es/themes/dark/datePicker.mjs +10 -7
- package/es/themes/dark/dialog.mjs +8 -5
- package/es/themes/dark/divider.mjs +7 -4
- package/es/themes/dark/fieldDecorator.mjs +7 -4
- package/es/themes/dark/index.mjs +69 -51
- package/es/themes/dark/link.mjs +6 -3
- package/es/themes/dark/menu.mjs +6 -3
- package/es/themes/dark/option.mjs +6 -3
- package/es/themes/dark/pagination.mjs +11 -8
- package/es/themes/dark/paper.mjs +6 -3
- package/es/themes/dark/picker.mjs +11 -8
- package/es/themes/dark/popup.mjs +6 -3
- package/es/themes/dark/progress.mjs +6 -3
- package/es/themes/dark/pullRefresh.mjs +6 -3
- package/es/themes/dark/radio.mjs +7 -4
- package/es/themes/dark/result.mjs +12 -9
- package/es/themes/dark/select.mjs +6 -3
- package/es/themes/dark/skeleton.mjs +11 -6
- package/es/themes/dark/steps.mjs +8 -5
- package/es/themes/dark/switch.mjs +7 -4
- package/es/themes/dark/tab.mjs +6 -3
- package/es/themes/dark/table.mjs +12 -9
- package/es/themes/dark/tabs.mjs +6 -3
- package/es/themes/dark/timePicker.mjs +9 -6
- package/es/themes/dark/uploader.mjs +10 -7
- package/es/themes/dark/watermark.mjs +6 -3
- package/es/themes/index.mjs +7 -5
- package/es/time-picker/TimePicker.mjs +297 -232
- package/es/time-picker/clock.mjs +222 -172
- package/es/time-picker/index.mjs +10 -5
- package/es/time-picker/props.mjs +14 -8
- package/es/time-picker/utils.mjs +46 -86
- package/es/tooltip/Tooltip.mjs +82 -62
- package/es/tooltip/index.mjs +10 -5
- package/es/tooltip/props.mjs +12 -9
- package/es/uploader/Uploader.mjs +315 -308
- package/es/uploader/index.mjs +10 -5
- package/es/uploader/props.mjs +10 -7
- package/es/uploader/provide.ts +3 -0
- package/es/utils/components.mjs +158 -127
- package/es/utils/elements.mjs +106 -123
- package/es/utils/logger.mjs +9 -5
- package/es/utils/shared.mjs +25 -23
- package/es/utils/test.mjs +105 -93
- package/es/varlet.esm.js +12464 -13425
- package/es/watermark/Watermark.mjs +191 -109
- package/es/watermark/index.mjs +8 -4
- package/es/watermark/props.mjs +8 -5
- package/highlight/web-types.en-US.json +3 -3
- package/highlight/web-types.zh-CN.json +2 -2
- package/lib/varlet.cjs.js +9187 -10199
- package/package.json +7 -7
- package/umd/varlet.js +4 -4
- package/es/counter/provide.mjs +0 -1
- package/es/input/provide.mjs +0 -1
- package/es/rate/provide.mjs +0 -1
- package/es/slider/provide.mjs +0 -1
- package/es/switch/provide.mjs +0 -1
- package/es/uploader/provide.mjs +0 -1
package/es/input/props.mjs
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { defineListenerProp, pickProps } from "../utils/components.mjs";
|
|
18
|
+
import { props as fieldDecoratorProps } from "../field-decorator/props.mjs";
|
|
19
|
+
const props = __spreadValues({
|
|
5
20
|
modelValue: String,
|
|
6
21
|
modelModifiers: {
|
|
7
22
|
type: Object,
|
|
@@ -9,7 +24,7 @@ export var props = _extends({
|
|
|
9
24
|
},
|
|
10
25
|
type: {
|
|
11
26
|
type: String,
|
|
12
|
-
default:
|
|
27
|
+
default: "text"
|
|
13
28
|
},
|
|
14
29
|
textarea: Boolean,
|
|
15
30
|
rows: {
|
|
@@ -22,7 +37,7 @@ export var props = _extends({
|
|
|
22
37
|
autofocus: Boolean,
|
|
23
38
|
validateTrigger: {
|
|
24
39
|
type: Array,
|
|
25
|
-
default: () => [
|
|
40
|
+
default: () => ["onInput", "onClear"]
|
|
26
41
|
},
|
|
27
42
|
rules: Array,
|
|
28
43
|
enterkeyhint: String,
|
|
@@ -31,5 +46,20 @@ export var props = _extends({
|
|
|
31
46
|
onInput: defineListenerProp(),
|
|
32
47
|
onChange: defineListenerProp(),
|
|
33
48
|
onClear: defineListenerProp(),
|
|
34
|
-
|
|
35
|
-
}, pickProps(fieldDecoratorProps, [
|
|
49
|
+
"onUpdate:modelValue": defineListenerProp()
|
|
50
|
+
}, pickProps(fieldDecoratorProps, [
|
|
51
|
+
"size",
|
|
52
|
+
"variant",
|
|
53
|
+
"placeholder",
|
|
54
|
+
"line",
|
|
55
|
+
"hint",
|
|
56
|
+
"textColor",
|
|
57
|
+
"focusColor",
|
|
58
|
+
"blurColor",
|
|
59
|
+
"disabled",
|
|
60
|
+
"clearable",
|
|
61
|
+
"onClick"
|
|
62
|
+
]));
|
|
63
|
+
export {
|
|
64
|
+
props
|
|
65
|
+
};
|
package/es/lazy/index.mjs
CHANGED
|
@@ -1,32 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __async = (__this, __arguments, generator) => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
var fulfilled = (value) => {
|
|
20
|
+
try {
|
|
21
|
+
step(generator.next(value));
|
|
22
|
+
} catch (e) {
|
|
23
|
+
reject(e);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var rejected = (value) => {
|
|
27
|
+
try {
|
|
28
|
+
step(generator.throw(value));
|
|
29
|
+
} catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
34
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
import { getAllParentScroller } from "../utils/elements.mjs";
|
|
38
|
+
import { removeItem, throttle, doubleRaf, inViewport } from "@varlet/shared";
|
|
39
|
+
import { createCache } from "../utils/shared.mjs";
|
|
40
|
+
import { call } from "../utils/components.mjs";
|
|
41
|
+
const BACKGROUND_IMAGE_ARG_NAME = "background-image";
|
|
42
|
+
const LAZY_LOADING = "lazy-loading";
|
|
43
|
+
const LAZY_ERROR = "lazy-error";
|
|
44
|
+
const LAZY_ATTEMPT = "lazy-attempt";
|
|
45
|
+
const EVENTS = ["scroll", "wheel", "mousewheel", "resize", "animationend", "transitionend", "touchmove"];
|
|
46
|
+
const PIXEL = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
|
|
47
|
+
const lazyElements = [];
|
|
48
|
+
const listenTargets = [];
|
|
49
|
+
const imageCache = createCache(100);
|
|
50
|
+
const defaultLazyOptions = {
|
|
18
51
|
loading: PIXEL,
|
|
19
52
|
error: PIXEL,
|
|
20
53
|
attempt: 3,
|
|
21
54
|
throttleWait: 300,
|
|
22
55
|
events: EVENTS
|
|
23
56
|
};
|
|
24
|
-
|
|
57
|
+
let checkAllWithThrottle = throttle(checkAll, defaultLazyOptions.throttleWait);
|
|
25
58
|
function setSRC(el, src) {
|
|
26
59
|
if (el._lazy.arg === BACKGROUND_IMAGE_ARG_NAME) {
|
|
27
|
-
el.style.backgroundImage =
|
|
60
|
+
el.style.backgroundImage = `url(${src})`;
|
|
28
61
|
} else {
|
|
29
|
-
el.setAttribute(
|
|
62
|
+
el.setAttribute("src", src);
|
|
30
63
|
}
|
|
31
64
|
}
|
|
32
65
|
function setLoading(el) {
|
|
@@ -35,64 +68,62 @@ function setLoading(el) {
|
|
|
35
68
|
}
|
|
36
69
|
function setError(el) {
|
|
37
70
|
el._lazy.error && setSRC(el, el._lazy.error);
|
|
38
|
-
el._lazy.state =
|
|
71
|
+
el._lazy.state = "error";
|
|
39
72
|
clear(el);
|
|
40
73
|
checkAll();
|
|
41
74
|
}
|
|
42
75
|
function setSuccess(el, attemptSRC) {
|
|
43
76
|
setSRC(el, attemptSRC);
|
|
44
|
-
el._lazy.state =
|
|
77
|
+
el._lazy.state = "success";
|
|
45
78
|
clear(el);
|
|
46
79
|
checkAll();
|
|
47
80
|
}
|
|
48
81
|
function bindEvents(listenTarget) {
|
|
49
|
-
var
|
|
82
|
+
var _a;
|
|
50
83
|
if (listenTargets.includes(listenTarget)) {
|
|
51
84
|
return;
|
|
52
85
|
}
|
|
53
86
|
listenTargets.push(listenTarget);
|
|
54
|
-
(
|
|
55
|
-
listenTarget.addEventListener(event, checkAllWithThrottle, {
|
|
56
|
-
passive: true
|
|
57
|
-
});
|
|
87
|
+
(_a = defaultLazyOptions.events) == null ? void 0 : _a.forEach((event) => {
|
|
88
|
+
listenTarget.addEventListener(event, checkAllWithThrottle, { passive: true });
|
|
58
89
|
});
|
|
59
90
|
}
|
|
60
91
|
function unbindEvents() {
|
|
61
|
-
listenTargets.forEach(listenTarget => {
|
|
62
|
-
var
|
|
63
|
-
(
|
|
92
|
+
listenTargets.forEach((listenTarget) => {
|
|
93
|
+
var _a;
|
|
94
|
+
(_a = defaultLazyOptions.events) == null ? void 0 : _a.forEach((event) => {
|
|
64
95
|
listenTarget.removeEventListener(event, checkAllWithThrottle);
|
|
65
96
|
});
|
|
66
97
|
});
|
|
67
98
|
listenTargets.length = 0;
|
|
68
99
|
}
|
|
69
100
|
function createLazy(el, binding) {
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
loading: (
|
|
73
|
-
error: (
|
|
101
|
+
var _a, _b;
|
|
102
|
+
const lazyOptions = {
|
|
103
|
+
loading: (_a = el.getAttribute(LAZY_LOADING)) != null ? _a : defaultLazyOptions.loading,
|
|
104
|
+
error: (_b = el.getAttribute(LAZY_ERROR)) != null ? _b : defaultLazyOptions.error,
|
|
74
105
|
attempt: el.getAttribute(LAZY_ATTEMPT) ? Number(el.getAttribute(LAZY_ATTEMPT)) : defaultLazyOptions.attempt
|
|
75
106
|
};
|
|
76
|
-
el._lazy =
|
|
107
|
+
el._lazy = __spreadValues({
|
|
77
108
|
src: binding.value,
|
|
78
109
|
arg: binding.arg,
|
|
79
110
|
currentAttempt: 0,
|
|
80
|
-
state:
|
|
111
|
+
state: "pending",
|
|
81
112
|
attemptLock: false
|
|
82
113
|
}, lazyOptions);
|
|
83
114
|
setSRC(el, PIXEL);
|
|
84
115
|
call(defaultLazyOptions.filter, el._lazy);
|
|
85
116
|
}
|
|
86
117
|
function createImage(el, attemptSRC) {
|
|
87
|
-
|
|
118
|
+
const image = new Image();
|
|
88
119
|
image.src = attemptSRC;
|
|
89
120
|
el._lazy.preloadImage = image;
|
|
90
|
-
image.addEventListener(
|
|
121
|
+
image.addEventListener("load", () => {
|
|
91
122
|
el._lazy.attemptLock = false;
|
|
92
123
|
imageCache.add(attemptSRC);
|
|
93
124
|
setSuccess(el, attemptSRC);
|
|
94
125
|
});
|
|
95
|
-
image.addEventListener(
|
|
126
|
+
image.addEventListener("error", () => {
|
|
96
127
|
el._lazy.attemptLock = false;
|
|
97
128
|
el._lazy.currentAttempt >= el._lazy.attempt ? setError(el) : attemptLoad(el);
|
|
98
129
|
});
|
|
@@ -103,9 +134,7 @@ function attemptLoad(el) {
|
|
|
103
134
|
}
|
|
104
135
|
el._lazy.attemptLock = true;
|
|
105
136
|
el._lazy.currentAttempt++;
|
|
106
|
-
|
|
107
|
-
src: attemptSRC
|
|
108
|
-
} = el._lazy;
|
|
137
|
+
const { src: attemptSRC } = el._lazy;
|
|
109
138
|
if (imageCache.has(attemptSRC)) {
|
|
110
139
|
setSuccess(el, attemptSRC);
|
|
111
140
|
el._lazy.attemptLock = false;
|
|
@@ -114,78 +143,49 @@ function attemptLoad(el) {
|
|
|
114
143
|
setLoading(el);
|
|
115
144
|
createImage(el, attemptSRC);
|
|
116
145
|
}
|
|
117
|
-
function check(
|
|
118
|
-
return
|
|
119
|
-
}
|
|
120
|
-
function _check() {
|
|
121
|
-
_check = _asyncToGenerator(function* (el) {
|
|
146
|
+
function check(el) {
|
|
147
|
+
return __async(this, null, function* () {
|
|
122
148
|
yield doubleRaf();
|
|
123
149
|
if (inViewport(el)) {
|
|
124
150
|
attemptLoad(el);
|
|
125
151
|
}
|
|
126
152
|
});
|
|
127
|
-
return _check.apply(this, arguments);
|
|
128
153
|
}
|
|
129
154
|
function checkAll() {
|
|
130
|
-
lazyElements.forEach(el => check(el));
|
|
155
|
+
lazyElements.forEach((el) => check(el));
|
|
131
156
|
}
|
|
132
|
-
function add(
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
function _add() {
|
|
136
|
-
_add = _asyncToGenerator(function* (el) {
|
|
157
|
+
function add(el) {
|
|
158
|
+
return __async(this, null, function* () {
|
|
137
159
|
!lazyElements.includes(el) && lazyElements.push(el);
|
|
138
160
|
getAllParentScroller(el).forEach(bindEvents);
|
|
139
161
|
yield check(el);
|
|
140
162
|
});
|
|
141
|
-
return _add.apply(this, arguments);
|
|
142
163
|
}
|
|
143
164
|
function clear(el) {
|
|
144
165
|
removeItem(lazyElements, el);
|
|
145
166
|
lazyElements.length === 0 && unbindEvents();
|
|
146
167
|
}
|
|
147
168
|
function diff(el, binding) {
|
|
148
|
-
|
|
149
|
-
src,
|
|
150
|
-
arg
|
|
151
|
-
} = el._lazy;
|
|
169
|
+
const { src, arg } = el._lazy;
|
|
152
170
|
return src !== binding.value || arg !== binding.arg;
|
|
153
171
|
}
|
|
154
|
-
function mounted(
|
|
155
|
-
return
|
|
156
|
-
}
|
|
157
|
-
function _mounted() {
|
|
158
|
-
_mounted = _asyncToGenerator(function* (el, binding) {
|
|
172
|
+
function mounted(el, binding) {
|
|
173
|
+
return __async(this, null, function* () {
|
|
159
174
|
createLazy(el, binding);
|
|
160
175
|
yield add(el);
|
|
161
176
|
});
|
|
162
|
-
return _mounted.apply(this, arguments);
|
|
163
|
-
}
|
|
164
|
-
function updated(_x5, _x6) {
|
|
165
|
-
return _updated.apply(this, arguments);
|
|
166
177
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
178
|
+
function updated(el, binding) {
|
|
179
|
+
return __async(this, null, function* () {
|
|
169
180
|
if (!diff(el, binding)) {
|
|
170
181
|
lazyElements.includes(el) && (yield check(el));
|
|
171
182
|
return;
|
|
172
183
|
}
|
|
173
184
|
yield mounted(el, binding);
|
|
174
185
|
});
|
|
175
|
-
return _updated.apply(this, arguments);
|
|
176
186
|
}
|
|
177
|
-
function mergeLazyOptions(lazyOptions) {
|
|
178
|
-
|
|
179
|
-
lazyOptions = {};
|
|
180
|
-
}
|
|
181
|
-
var {
|
|
182
|
-
events,
|
|
183
|
-
loading,
|
|
184
|
-
error,
|
|
185
|
-
attempt,
|
|
186
|
-
throttleWait,
|
|
187
|
-
filter
|
|
188
|
-
} = lazyOptions;
|
|
187
|
+
function mergeLazyOptions(lazyOptions = {}) {
|
|
188
|
+
const { events, loading, error, attempt, throttleWait, filter } = lazyOptions;
|
|
189
189
|
defaultLazyOptions.events = events != null ? events : defaultLazyOptions.events;
|
|
190
190
|
defaultLazyOptions.loading = loading != null ? loading : defaultLazyOptions.loading;
|
|
191
191
|
defaultLazyOptions.error = error != null ? error : defaultLazyOptions.error;
|
|
@@ -193,15 +193,22 @@ function mergeLazyOptions(lazyOptions) {
|
|
|
193
193
|
defaultLazyOptions.throttleWait = throttleWait != null ? throttleWait : defaultLazyOptions.throttleWait;
|
|
194
194
|
defaultLazyOptions.filter = filter;
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
const Lazy = {
|
|
197
197
|
mounted,
|
|
198
198
|
unmounted: clear,
|
|
199
199
|
updated,
|
|
200
200
|
install(app, lazyOptions) {
|
|
201
201
|
mergeLazyOptions(lazyOptions);
|
|
202
202
|
checkAllWithThrottle = throttle(checkAll, defaultLazyOptions.throttleWait);
|
|
203
|
-
app.directive(
|
|
203
|
+
app.directive("lazy", this);
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
const _LazyComponent = Lazy;
|
|
207
|
+
var stdin_default = Lazy;
|
|
208
|
+
export {
|
|
209
|
+
PIXEL,
|
|
210
|
+
_LazyComponent,
|
|
211
|
+
stdin_default as default,
|
|
212
|
+
defaultLazyOptions,
|
|
213
|
+
imageCache
|
|
214
|
+
};
|
package/es/link/Link.mjs
CHANGED
|
@@ -1,75 +1,66 @@
|
|
|
1
|
-
import { computed, defineComponent } from
|
|
2
|
-
import { props } from
|
|
3
|
-
import { call, createNamespace } from
|
|
4
|
-
import { toSizeUnit } from
|
|
5
|
-
|
|
6
|
-
name,
|
|
7
|
-
n,
|
|
8
|
-
classes
|
|
9
|
-
} = createNamespace('link');
|
|
1
|
+
import { computed, defineComponent } from "vue";
|
|
2
|
+
import { props } from "./props.mjs";
|
|
3
|
+
import { call, createNamespace } from "../utils/components.mjs";
|
|
4
|
+
import { toSizeUnit } from "../utils/elements.mjs";
|
|
5
|
+
const { name, n, classes } = createNamespace("link");
|
|
10
6
|
import { renderSlot as _renderSlot, resolveDynamicComponent as _resolveDynamicComponent, mergeProps as _mergeProps, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
11
7
|
function __render__(_ctx, _cache) {
|
|
12
8
|
return _openBlock(), _createBlock(_resolveDynamicComponent(_ctx.tag), _mergeProps(_ctx.linkProps, {
|
|
13
|
-
class: _ctx.classes(
|
|
9
|
+
class: _ctx.classes(
|
|
10
|
+
_ctx.n(),
|
|
11
|
+
_ctx.n("$--box"),
|
|
12
|
+
_ctx.n("$--inline-flex"),
|
|
13
|
+
_ctx.n(`--${_ctx.type}`),
|
|
14
|
+
[_ctx.underline !== "none", _ctx.n(`--underline-${_ctx.underline}`)],
|
|
15
|
+
[_ctx.disabled, _ctx.n("--disabled")]
|
|
16
|
+
),
|
|
14
17
|
style: {
|
|
15
18
|
color: _ctx.textColor,
|
|
16
19
|
fontSize: _ctx.toSizeUnit(_ctx.textSize)
|
|
17
20
|
},
|
|
18
21
|
onClick: _ctx.handleClick
|
|
19
22
|
}), {
|
|
20
|
-
default: _withCtx(() => [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
default: _withCtx(() => [
|
|
24
|
+
_renderSlot(_ctx.$slots, "default")
|
|
25
|
+
]),
|
|
26
|
+
_: 3
|
|
27
|
+
/* FORWARDED */
|
|
28
|
+
}, 16, ["class", "style", "onClick"]);
|
|
23
29
|
}
|
|
24
|
-
|
|
30
|
+
const __sfc__ = defineComponent({
|
|
25
31
|
name,
|
|
26
32
|
props,
|
|
27
|
-
setup(
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
return
|
|
33
|
+
setup(props2) {
|
|
34
|
+
const tag = computed(() => {
|
|
35
|
+
if (props2.disabled) {
|
|
36
|
+
return "span";
|
|
31
37
|
}
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
38
|
+
if (props2.href) {
|
|
39
|
+
return "a";
|
|
34
40
|
}
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
41
|
+
if (props2.to) {
|
|
42
|
+
return "router-link";
|
|
37
43
|
}
|
|
38
|
-
return
|
|
44
|
+
return "a";
|
|
39
45
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
disabled,
|
|
43
|
-
href,
|
|
44
|
-
target,
|
|
45
|
-
to,
|
|
46
|
-
replace,
|
|
47
|
-
rel
|
|
48
|
-
} = props;
|
|
46
|
+
const linkProps = computed(() => {
|
|
47
|
+
const { disabled, href, target, to, replace, rel } = props2;
|
|
49
48
|
if (disabled) {
|
|
50
49
|
return {};
|
|
51
50
|
}
|
|
52
51
|
if (href) {
|
|
53
|
-
return {
|
|
54
|
-
href,
|
|
55
|
-
target,
|
|
56
|
-
rel
|
|
57
|
-
};
|
|
52
|
+
return { href, target, rel };
|
|
58
53
|
}
|
|
59
54
|
if (to) {
|
|
60
|
-
return {
|
|
61
|
-
to,
|
|
62
|
-
target,
|
|
63
|
-
replace
|
|
64
|
-
};
|
|
55
|
+
return { to, target, replace };
|
|
65
56
|
}
|
|
66
57
|
return {};
|
|
67
58
|
});
|
|
68
59
|
function handleClick(e) {
|
|
69
|
-
if (
|
|
60
|
+
if (props2.disabled) {
|
|
70
61
|
return;
|
|
71
62
|
}
|
|
72
|
-
call(
|
|
63
|
+
call(props2.onClick, e);
|
|
73
64
|
}
|
|
74
65
|
return {
|
|
75
66
|
tag,
|
|
@@ -82,4 +73,7 @@ var __sfc__ = defineComponent({
|
|
|
82
73
|
}
|
|
83
74
|
});
|
|
84
75
|
__sfc__.render = __render__;
|
|
85
|
-
|
|
76
|
+
var stdin_default = __sfc__;
|
|
77
|
+
export {
|
|
78
|
+
stdin_default as default
|
|
79
|
+
};
|
package/es/link/index.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import Link from
|
|
2
|
-
import { withInstall } from
|
|
1
|
+
import Link from "./Link.mjs";
|
|
2
|
+
import { withInstall } from "../utils/components.mjs";
|
|
3
3
|
withInstall(Link);
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { props } from "./props.mjs";
|
|
5
|
+
const _LinkComponent = Link;
|
|
6
|
+
var stdin_default = Link;
|
|
7
|
+
export {
|
|
8
|
+
_LinkComponent,
|
|
9
|
+
stdin_default as default,
|
|
10
|
+
props as linkProps
|
|
11
|
+
};
|
package/es/link/props.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineListenerProp } from
|
|
2
|
-
|
|
1
|
+
import { defineListenerProp } from "../utils/components.mjs";
|
|
2
|
+
const props = {
|
|
3
3
|
type: {
|
|
4
4
|
type: String,
|
|
5
|
-
default:
|
|
5
|
+
default: "default"
|
|
6
6
|
},
|
|
7
7
|
href: String,
|
|
8
8
|
target: String,
|
|
@@ -11,10 +11,13 @@ export var props = {
|
|
|
11
11
|
replace: Boolean,
|
|
12
12
|
underline: {
|
|
13
13
|
type: String,
|
|
14
|
-
default:
|
|
14
|
+
default: "always"
|
|
15
15
|
},
|
|
16
16
|
disabled: Boolean,
|
|
17
17
|
textSize: [String, Number],
|
|
18
18
|
textColor: String,
|
|
19
19
|
onClick: defineListenerProp()
|
|
20
|
-
};
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
props
|
|
23
|
+
};
|