@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.
Files changed (348) hide show
  1. package/es/action-sheet/ActionSheet.mjs +97 -67
  2. package/es/action-sheet/index.mjs +43 -28
  3. package/es/action-sheet/props.mjs +39 -8
  4. package/es/app-bar/AppBar.mjs +129 -56
  5. package/es/app-bar/index.mjs +10 -5
  6. package/es/app-bar/props.mjs +6 -3
  7. package/es/avatar/Avatar.mjs +97 -87
  8. package/es/avatar/index.mjs +10 -5
  9. package/es/avatar/props.mjs +8 -5
  10. package/es/avatar-group/AvatarGroup.mjs +26 -20
  11. package/es/avatar-group/index.mjs +10 -5
  12. package/es/avatar-group/props.mjs +5 -2
  13. package/es/back-top/BackTop.mjs +71 -53
  14. package/es/back-top/index.mjs +10 -5
  15. package/es/back-top/props.mjs +6 -3
  16. package/es/badge/Badge.mjs +74 -46
  17. package/es/badge/index.mjs +10 -5
  18. package/es/badge/props.mjs +7 -4
  19. package/es/bottom-navigation/BottomNavigation.mjs +100 -97
  20. package/es/bottom-navigation/index.mjs +10 -5
  21. package/es/bottom-navigation/props.mjs +7 -4
  22. package/es/bottom-navigation/provide.mjs +13 -9
  23. package/es/bottom-navigation-item/BottomNavigationItem.mjs +93 -74
  24. package/es/bottom-navigation-item/index.mjs +10 -5
  25. package/es/bottom-navigation-item/props.mjs +7 -4
  26. package/es/bottom-navigation-item/provide.mjs +14 -11
  27. package/es/breadcrumb/Breadcrumb.mjs +51 -36
  28. package/es/breadcrumb/index.mjs +10 -5
  29. package/es/breadcrumb/props.mjs +6 -3
  30. package/es/breadcrumb/provide.mjs +12 -11
  31. package/es/breadcrumbs/Breadcrumbs.mjs +26 -24
  32. package/es/breadcrumbs/index.mjs +10 -5
  33. package/es/breadcrumbs/props.mjs +6 -3
  34. package/es/breadcrumbs/provide.mjs +11 -9
  35. package/es/button/Button.mjs +88 -90
  36. package/es/button/index.mjs +10 -5
  37. package/es/button/props.mjs +31 -10
  38. package/es/button/provide.mjs +8 -9
  39. package/es/button-group/ButtonGroup.mjs +38 -26
  40. package/es/button-group/index.mjs +8 -4
  41. package/es/button-group/props.mjs +8 -5
  42. package/es/button-group/provide.mjs +9 -9
  43. package/es/card/Card.mjs +292 -189
  44. package/es/card/index.mjs +10 -5
  45. package/es/card/props.mjs +9 -6
  46. package/es/cell/Cell.mjs +96 -52
  47. package/es/cell/index.mjs +10 -5
  48. package/es/cell/props.mjs +6 -3
  49. package/es/checkbox/Checkbox.mjs +136 -130
  50. package/es/checkbox/index.mjs +10 -5
  51. package/es/checkbox/props.mjs +9 -6
  52. package/es/checkbox/provide.mjs +10 -9
  53. package/es/checkbox-group/CheckboxGroup.mjs +63 -96
  54. package/es/checkbox-group/index.mjs +10 -5
  55. package/es/checkbox-group/props.mjs +9 -6
  56. package/es/checkbox-group/provide.mjs +11 -9
  57. package/es/chip/Chip.mjs +66 -50
  58. package/es/chip/index.mjs +10 -5
  59. package/es/chip/props.mjs +10 -7
  60. package/es/col/Col.mjs +60 -55
  61. package/es/col/index.mjs +10 -5
  62. package/es/col/props.mjs +7 -4
  63. package/es/col/provide.mjs +8 -9
  64. package/es/collapse/Collapse.mjs +70 -73
  65. package/es/collapse/index.mjs +10 -5
  66. package/es/collapse/props.mjs +7 -4
  67. package/es/collapse/provide.mjs +11 -9
  68. package/es/collapse-item/CollapseItem.mjs +156 -93
  69. package/es/collapse-item/index.mjs +10 -5
  70. package/es/collapse-item/props.mjs +6 -3
  71. package/es/collapse-item/provide.mjs +12 -11
  72. package/es/context/index.mjs +9 -5
  73. package/es/context/lock.mjs +18 -22
  74. package/es/context/zIndex.mjs +19 -16
  75. package/es/countdown/Countdown.mjs +73 -70
  76. package/es/countdown/index.mjs +10 -5
  77. package/es/countdown/props.mjs +7 -4
  78. package/es/counter/Counter.mjs +169 -173
  79. package/es/counter/index.mjs +10 -5
  80. package/es/counter/props.mjs +8 -5
  81. package/es/counter/provide.ts +3 -0
  82. package/es/date-picker/DatePicker.mjs +411 -304
  83. package/es/date-picker/index.mjs +10 -5
  84. package/es/date-picker/props.mjs +71 -45
  85. package/es/date-picker/src/day-picker-panel.mjs +270 -208
  86. package/es/date-picker/src/month-picker-panel.mjs +205 -175
  87. package/es/date-picker/src/panel-header.mjs +101 -83
  88. package/es/date-picker/src/year-picker-panel.mjs +64 -54
  89. package/es/dialog/Dialog.mjs +171 -106
  90. package/es/dialog/index.mjs +49 -33
  91. package/es/dialog/props.mjs +39 -9
  92. package/es/divider/Divider.mjs +56 -51
  93. package/es/divider/index.mjs +10 -5
  94. package/es/divider/props.mjs +5 -2
  95. package/es/drag/Drag.mjs +126 -144
  96. package/es/drag/index.mjs +10 -5
  97. package/es/drag/props.mjs +8 -5
  98. package/es/ellipsis/Ellipsis.mjs +81 -50
  99. package/es/ellipsis/index.mjs +8 -4
  100. package/es/ellipsis/props.mjs +5 -2
  101. package/es/fab/Fab.mjs +73 -75
  102. package/es/fab/index.mjs +8 -4
  103. package/es/fab/props.mjs +14 -11
  104. package/es/field-decorator/FieldDecorator.mjs +215 -110
  105. package/es/field-decorator/props.mjs +9 -6
  106. package/es/form/Form.mjs +69 -79
  107. package/es/form/index.mjs +11 -6
  108. package/es/form/props.mjs +6 -3
  109. package/es/form/provide.mjs +35 -22
  110. package/es/form-details/FormDetails.mjs +81 -39
  111. package/es/form-details/index.mjs +10 -5
  112. package/es/form-details/props.mjs +7 -4
  113. package/es/hover/index.mjs +37 -40
  114. package/es/hover-overlay/HoverOverlay.mjs +18 -14
  115. package/es/hover-overlay/index.mjs +13 -8
  116. package/es/hover-overlay/props.mjs +5 -2
  117. package/es/icon/Icon.mjs +50 -33
  118. package/es/icon/index.mjs +10 -5
  119. package/es/icon/props.mjs +7 -4
  120. package/es/image/Image.mjs +76 -82
  121. package/es/image/index.mjs +10 -5
  122. package/es/image/props.mjs +7 -4
  123. package/es/image-preview/ImagePreview.mjs +176 -193
  124. package/es/image-preview/index.mjs +44 -30
  125. package/es/image-preview/props.mjs +34 -9
  126. package/es/index-anchor/IndexAnchor.mjs +45 -42
  127. package/es/index-anchor/index.mjs +10 -5
  128. package/es/index-anchor/props.mjs +5 -2
  129. package/es/index-anchor/provide.mjs +12 -11
  130. package/es/index-bar/IndexBar.mjs +130 -131
  131. package/es/index-bar/index.mjs +10 -5
  132. package/es/index-bar/props.mjs +6 -3
  133. package/es/index-bar/provide.mjs +11 -9
  134. package/es/index.bundle.mjs +1 -1
  135. package/es/index.mjs +1 -1
  136. package/es/input/Input.mjs +231 -247
  137. package/es/input/index.mjs +10 -5
  138. package/es/input/props.mjs +38 -8
  139. package/es/input/provide.ts +3 -0
  140. package/es/lazy/index.mjs +94 -87
  141. package/es/link/Link.mjs +39 -45
  142. package/es/link/index.mjs +10 -5
  143. package/es/link/props.mjs +8 -5
  144. package/es/list/List.mjs +144 -97
  145. package/es/list/index.mjs +10 -5
  146. package/es/list/props.mjs +8 -5
  147. package/es/list/provide.mjs +8 -9
  148. package/es/loading/Loading.mjs +165 -72
  149. package/es/loading/index.mjs +10 -5
  150. package/es/loading/props.mjs +7 -4
  151. package/es/loading-bar/LoadingBar.mjs +19 -16
  152. package/es/loading-bar/index.mjs +37 -30
  153. package/es/loading-bar/props.mjs +5 -2
  154. package/es/locale/en-US.mjs +76 -73
  155. package/es/locale/index.mjs +52 -41
  156. package/es/locale/zh-CN.mjs +76 -73
  157. package/es/menu/Menu.mjs +76 -57
  158. package/es/menu/index.mjs +10 -5
  159. package/es/menu/props.mjs +11 -8
  160. package/es/menu/usePopover.mjs +214 -207
  161. package/es/option/Option.mjs +86 -70
  162. package/es/option/index.mjs +10 -5
  163. package/es/option/props.mjs +5 -2
  164. package/es/option/provide.mjs +10 -11
  165. package/es/overlay/Overlay.mjs +29 -31
  166. package/es/overlay/index.mjs +10 -5
  167. package/es/overlay/props.mjs +7 -4
  168. package/es/pagination/Pagination.mjs +334 -202
  169. package/es/pagination/index.mjs +10 -5
  170. package/es/pagination/props.mjs +8 -5
  171. package/es/paper/Paper.mjs +43 -31
  172. package/es/paper/index.mjs +10 -5
  173. package/es/paper/props.mjs +6 -3
  174. package/es/picker/Picker.mjs +288 -224
  175. package/es/picker/index.mjs +24 -23
  176. package/es/picker/props.mjs +37 -7
  177. package/es/popup/Popup.mjs +68 -58
  178. package/es/popup/index.mjs +10 -5
  179. package/es/popup/props.mjs +9 -6
  180. package/es/popup/provide.mjs +12 -15
  181. package/es/progress/Progress.mjs +186 -114
  182. package/es/progress/index.mjs +10 -5
  183. package/es/progress/props.mjs +7 -4
  184. package/es/pull-refresh/PullRefresh.mjs +136 -116
  185. package/es/pull-refresh/index.mjs +10 -5
  186. package/es/pull-refresh/props.mjs +8 -5
  187. package/es/radio/Radio.mjs +122 -118
  188. package/es/radio/index.mjs +10 -5
  189. package/es/radio/props.mjs +8 -5
  190. package/es/radio/provide.mjs +8 -9
  191. package/es/radio-group/RadioGroup.mjs +50 -58
  192. package/es/radio-group/index.mjs +10 -5
  193. package/es/radio-group/props.mjs +10 -7
  194. package/es/radio-group/provide.mjs +11 -9
  195. package/es/rate/Rate.mjs +103 -132
  196. package/es/rate/index.mjs +10 -5
  197. package/es/rate/props.mjs +10 -7
  198. package/es/rate/provide.ts +3 -0
  199. package/es/result/Empty.mjs +21 -12
  200. package/es/result/Error.mjs +18 -9
  201. package/es/result/Info.mjs +18 -9
  202. package/es/result/Question.mjs +18 -9
  203. package/es/result/Result.mjs +102 -55
  204. package/es/result/Success.mjs +84 -40
  205. package/es/result/Warning.mjs +18 -9
  206. package/es/result/index.mjs +10 -5
  207. package/es/result/props.mjs +6 -3
  208. package/es/ripple/index.mjs +89 -101
  209. package/es/row/Row.mjs +40 -45
  210. package/es/row/index.mjs +10 -5
  211. package/es/row/props.mjs +8 -5
  212. package/es/row/provide.mjs +9 -9
  213. package/es/select/Select.mjs +308 -298
  214. package/es/select/index.mjs +10 -5
  215. package/es/select/props.mjs +40 -10
  216. package/es/select/provide.mjs +9 -9
  217. package/es/skeleton/Skeleton.mjs +182 -71
  218. package/es/skeleton/index.mjs +10 -5
  219. package/es/skeleton/props.mjs +5 -2
  220. package/es/slider/Slider.mjs +310 -260
  221. package/es/slider/index.mjs +10 -5
  222. package/es/slider/props.mjs +15 -11
  223. package/es/slider/provide.ts +3 -0
  224. package/es/snackbar/Snackbar.mjs +47 -34
  225. package/es/snackbar/core.mjs +140 -77
  226. package/es/snackbar/index.mjs +111 -97
  227. package/es/snackbar/props.mjs +35 -14
  228. package/es/space/Space.mjs +30 -28
  229. package/es/space/index.mjs +10 -5
  230. package/es/space/margin.mjs +22 -23
  231. package/es/space/props.mjs +8 -5
  232. package/es/step/Step.mjs +96 -74
  233. package/es/step/index.mjs +10 -5
  234. package/es/step/props.mjs +6 -3
  235. package/es/step/provide.mjs +10 -11
  236. package/es/steps/Steps.mjs +31 -30
  237. package/es/steps/index.mjs +10 -5
  238. package/es/steps/props.mjs +7 -4
  239. package/es/steps/provide.mjs +9 -8
  240. package/es/sticky/Sticky.mjs +104 -92
  241. package/es/sticky/index.mjs +10 -5
  242. package/es/sticky/props.mjs +6 -3
  243. package/es/style-provider/StyleProvider.mjs +19 -18
  244. package/es/style-provider/index.mjs +15 -11
  245. package/es/style-provider/props.mjs +6 -3
  246. package/es/swipe/Swipe.mjs +281 -268
  247. package/es/swipe/index.mjs +10 -5
  248. package/es/swipe/props.mjs +6 -3
  249. package/es/swipe/provide.mjs +11 -9
  250. package/es/swipe-item/SwipeItem.mjs +29 -29
  251. package/es/swipe-item/index.mjs +8 -4
  252. package/es/swipe-item/provide.mjs +10 -11
  253. package/es/switch/Switch.mjs +143 -103
  254. package/es/switch/index.mjs +10 -5
  255. package/es/switch/props.mjs +7 -4
  256. package/es/switch/provide.ts +3 -0
  257. package/es/tab/Tab.mjs +48 -61
  258. package/es/tab/index.mjs +10 -5
  259. package/es/tab/props.mjs +6 -3
  260. package/es/tab/provide.mjs +10 -11
  261. package/es/tab-item/TabItem.mjs +27 -32
  262. package/es/tab-item/index.mjs +10 -5
  263. package/es/tab-item/props.mjs +5 -2
  264. package/es/tab-item/provide.mjs +17 -18
  265. package/es/table/Table.mjs +54 -25
  266. package/es/table/index.mjs +10 -5
  267. package/es/table/props.mjs +6 -3
  268. package/es/tabs/Tabs.mjs +162 -134
  269. package/es/tabs/index.mjs +10 -5
  270. package/es/tabs/props.mjs +15 -12
  271. package/es/tabs/provide.mjs +9 -9
  272. package/es/tabs-items/TabsItems.mjs +61 -65
  273. package/es/tabs-items/index.mjs +10 -5
  274. package/es/tabs-items/props.mjs +7 -4
  275. package/es/tabs-items/provide.mjs +11 -9
  276. package/es/themes/dark/actionSheet.mjs +8 -5
  277. package/es/themes/dark/appBar.mjs +6 -3
  278. package/es/themes/dark/avatar.mjs +7 -4
  279. package/es/themes/dark/badge.mjs +6 -3
  280. package/es/themes/dark/bottomNavigation.mjs +7 -4
  281. package/es/themes/dark/bottomNavigationItem.mjs +6 -3
  282. package/es/themes/dark/breadcrumb.mjs +6 -3
  283. package/es/themes/dark/button.mjs +7 -4
  284. package/es/themes/dark/card.mjs +10 -7
  285. package/es/themes/dark/cell.mjs +7 -4
  286. package/es/themes/dark/checkbox.mjs +7 -4
  287. package/es/themes/dark/chip.mjs +7 -4
  288. package/es/themes/dark/collapse.mjs +8 -5
  289. package/es/themes/dark/countdown.mjs +6 -3
  290. package/es/themes/dark/datePicker.mjs +10 -7
  291. package/es/themes/dark/dialog.mjs +8 -5
  292. package/es/themes/dark/divider.mjs +7 -4
  293. package/es/themes/dark/fieldDecorator.mjs +7 -4
  294. package/es/themes/dark/index.mjs +69 -51
  295. package/es/themes/dark/link.mjs +6 -3
  296. package/es/themes/dark/menu.mjs +6 -3
  297. package/es/themes/dark/option.mjs +6 -3
  298. package/es/themes/dark/pagination.mjs +11 -8
  299. package/es/themes/dark/paper.mjs +6 -3
  300. package/es/themes/dark/picker.mjs +11 -8
  301. package/es/themes/dark/popup.mjs +6 -3
  302. package/es/themes/dark/progress.mjs +6 -3
  303. package/es/themes/dark/pullRefresh.mjs +6 -3
  304. package/es/themes/dark/radio.mjs +7 -4
  305. package/es/themes/dark/result.mjs +12 -9
  306. package/es/themes/dark/select.mjs +6 -3
  307. package/es/themes/dark/skeleton.mjs +11 -6
  308. package/es/themes/dark/steps.mjs +8 -5
  309. package/es/themes/dark/switch.mjs +7 -4
  310. package/es/themes/dark/tab.mjs +6 -3
  311. package/es/themes/dark/table.mjs +12 -9
  312. package/es/themes/dark/tabs.mjs +6 -3
  313. package/es/themes/dark/timePicker.mjs +9 -6
  314. package/es/themes/dark/uploader.mjs +10 -7
  315. package/es/themes/dark/watermark.mjs +6 -3
  316. package/es/themes/index.mjs +7 -5
  317. package/es/time-picker/TimePicker.mjs +297 -232
  318. package/es/time-picker/clock.mjs +222 -172
  319. package/es/time-picker/index.mjs +10 -5
  320. package/es/time-picker/props.mjs +14 -8
  321. package/es/time-picker/utils.mjs +46 -86
  322. package/es/tooltip/Tooltip.mjs +82 -62
  323. package/es/tooltip/index.mjs +10 -5
  324. package/es/tooltip/props.mjs +12 -9
  325. package/es/uploader/Uploader.mjs +315 -308
  326. package/es/uploader/index.mjs +10 -5
  327. package/es/uploader/props.mjs +10 -7
  328. package/es/uploader/provide.ts +3 -0
  329. package/es/utils/components.mjs +158 -127
  330. package/es/utils/elements.mjs +106 -123
  331. package/es/utils/logger.mjs +9 -5
  332. package/es/utils/shared.mjs +25 -23
  333. package/es/utils/test.mjs +105 -93
  334. package/es/varlet.esm.js +12464 -13425
  335. package/es/watermark/Watermark.mjs +191 -109
  336. package/es/watermark/index.mjs +8 -4
  337. package/es/watermark/props.mjs +8 -5
  338. package/highlight/web-types.en-US.json +3 -3
  339. package/highlight/web-types.zh-CN.json +2 -2
  340. package/lib/varlet.cjs.js +9187 -10199
  341. package/package.json +7 -7
  342. package/umd/varlet.js +4 -4
  343. package/es/counter/provide.mjs +0 -1
  344. package/es/input/provide.mjs +0 -1
  345. package/es/rate/provide.mjs +0 -1
  346. package/es/slider/provide.mjs +0 -1
  347. package/es/switch/provide.mjs +0 -1
  348. package/es/uploader/provide.mjs +0 -1
@@ -1,7 +1,22 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import { defineListenerProp, pickProps } from '../utils/components.mjs';
3
- import { props as fieldDecoratorProps } from '../field-decorator/props.mjs';
4
- export var props = _extends({
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: 'text'
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: () => ['onInput', 'onClear']
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
- 'onUpdate:modelValue': defineListenerProp()
35
- }, pickProps(fieldDecoratorProps, ['size', 'variant', 'placeholder', 'line', 'hint', 'textColor', 'focusColor', 'blurColor', 'disabled', 'clearable', 'onClick']));
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
+ };
@@ -0,0 +1,3 @@
1
+ import { Validation } from '../form/provide'
2
+
3
+ export type InputProvider = Validation
package/es/lazy/index.mjs CHANGED
@@ -1,32 +1,65 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
- import { getAllParentScroller } from '../utils/elements.mjs';
5
- import { removeItem, throttle, doubleRaf, inViewport } from '@varlet/shared';
6
- import { createCache } from '../utils/shared.mjs';
7
- import { call } from '../utils/components.mjs';
8
- var BACKGROUND_IMAGE_ARG_NAME = 'background-image';
9
- var LAZY_LOADING = 'lazy-loading';
10
- var LAZY_ERROR = 'lazy-error';
11
- var LAZY_ATTEMPT = 'lazy-attempt';
12
- var EVENTS = ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove'];
13
- export var PIXEL = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
14
- var lazyElements = [];
15
- var listenTargets = [];
16
- export var imageCache = createCache(100);
17
- export var defaultLazyOptions = {
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
- var checkAllWithThrottle = throttle(checkAll, defaultLazyOptions.throttleWait);
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 = "url(" + src + ")";
60
+ el.style.backgroundImage = `url(${src})`;
28
61
  } else {
29
- el.setAttribute('src', src);
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 = 'error';
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 = 'success';
77
+ el._lazy.state = "success";
45
78
  clear(el);
46
79
  checkAll();
47
80
  }
48
81
  function bindEvents(listenTarget) {
49
- var _defaultLazyOptions$e;
82
+ var _a;
50
83
  if (listenTargets.includes(listenTarget)) {
51
84
  return;
52
85
  }
53
86
  listenTargets.push(listenTarget);
54
- (_defaultLazyOptions$e = defaultLazyOptions.events) == null ? void 0 : _defaultLazyOptions$e.forEach(event => {
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 _defaultLazyOptions$e2;
63
- (_defaultLazyOptions$e2 = defaultLazyOptions.events) == null ? void 0 : _defaultLazyOptions$e2.forEach(event => {
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 _el$getAttribute, _el$getAttribute2;
71
- var lazyOptions = {
72
- loading: (_el$getAttribute = el.getAttribute(LAZY_LOADING)) != null ? _el$getAttribute : defaultLazyOptions.loading,
73
- error: (_el$getAttribute2 = el.getAttribute(LAZY_ERROR)) != null ? _el$getAttribute2 : defaultLazyOptions.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 = _extends({
107
+ el._lazy = __spreadValues({
77
108
  src: binding.value,
78
109
  arg: binding.arg,
79
110
  currentAttempt: 0,
80
- state: 'pending',
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
- var image = new Image();
118
+ const image = new Image();
88
119
  image.src = attemptSRC;
89
120
  el._lazy.preloadImage = image;
90
- image.addEventListener('load', () => {
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('error', () => {
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
- var {
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(_x) {
118
- return _check.apply(this, arguments);
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(_x2) {
133
- return _add.apply(this, arguments);
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
- var {
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(_x3, _x4) {
155
- return _mounted.apply(this, arguments);
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 _updated() {
168
- _updated = _asyncToGenerator(function* (el, binding) {
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
- if (lazyOptions === void 0) {
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
- var Lazy = {
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('lazy', this);
203
+ app.directive("lazy", this);
204
204
  }
205
205
  };
206
- export var _LazyComponent = Lazy;
207
- export default Lazy;
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 'vue';
2
- import { props } from './props.mjs';
3
- import { call, createNamespace } from '../utils/components.mjs';
4
- import { toSizeUnit } from '../utils/elements.mjs';
5
- var {
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(_ctx.n(), _ctx.n('$--box'), _ctx.n('$--inline-flex'), _ctx.n("--" + _ctx.type), [_ctx.underline !== 'none', _ctx.n("--underline-" + _ctx.underline)], [_ctx.disabled, _ctx.n('--disabled')]),
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(() => [_renderSlot(_ctx.$slots, "default")]),
21
- _: 3 /* FORWARDED */
22
- }, 16 /* FULL_PROPS */, ["class", "style", "onClick"]);
23
+ default: _withCtx(() => [
24
+ _renderSlot(_ctx.$slots, "default")
25
+ ]),
26
+ _: 3
27
+ /* FORWARDED */
28
+ }, 16, ["class", "style", "onClick"]);
23
29
  }
24
- var __sfc__ = defineComponent({
30
+ const __sfc__ = defineComponent({
25
31
  name,
26
32
  props,
27
- setup(props) {
28
- var tag = computed(() => {
29
- if (props.disabled) {
30
- return 'span';
33
+ setup(props2) {
34
+ const tag = computed(() => {
35
+ if (props2.disabled) {
36
+ return "span";
31
37
  }
32
- if (props.href) {
33
- return 'a';
38
+ if (props2.href) {
39
+ return "a";
34
40
  }
35
- if (props.to) {
36
- return 'router-link';
41
+ if (props2.to) {
42
+ return "router-link";
37
43
  }
38
- return 'a';
44
+ return "a";
39
45
  });
40
- var linkProps = computed(() => {
41
- var {
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 (props.disabled) {
60
+ if (props2.disabled) {
70
61
  return;
71
62
  }
72
- call(props.onClick, e);
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
- export default __sfc__;
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 './Link.mjs';
2
- import { withInstall } from '../utils/components.mjs';
1
+ import Link from "./Link.mjs";
2
+ import { withInstall } from "../utils/components.mjs";
3
3
  withInstall(Link);
4
- export { props as linkProps } from './props.mjs';
5
- export var _LinkComponent = Link;
6
- export default Link;
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 '../utils/components.mjs';
2
- export var props = {
1
+ import { defineListenerProp } from "../utils/components.mjs";
2
+ const props = {
3
3
  type: {
4
4
  type: String,
5
- default: '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: 'always'
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
+ };