litos-ui 0.20.1 → 0.22.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.
Files changed (421) hide show
  1. package/README.md +119 -15
  2. package/README.zh-CN.md +153 -0
  3. package/lib/base.d.ts +1 -0
  4. package/lib/base.js +1 -1
  5. package/lib/button/index.js +4 -4
  6. package/lib/{style-gKR_qwzm.js → button/index.less_inline.js} +2 -3
  7. package/lib/button/style.js +6 -2
  8. package/lib/calendar/index.js +140 -2
  9. package/lib/calendar/index.less_inline.js +4 -0
  10. package/lib/calendar/langs.js +12 -0
  11. package/lib/card/index.js +64 -2
  12. package/lib/card/index.less_inline.js +4 -0
  13. package/lib/carousel/index.js +257 -2
  14. package/lib/carousel/index.less_inline.js +4 -0
  15. package/lib/carousel/item.js +15 -2
  16. package/lib/carousel/item.less_inline.js +4 -0
  17. package/lib/carousel/timer.js +19 -0
  18. package/lib/check/check.d.ts +1 -0
  19. package/lib/check/check.js +117 -0
  20. package/lib/check/check.less_inline.js +4 -0
  21. package/lib/check/checkbox.js +18 -2
  22. package/lib/{checkbox-DhGHJXwI.js → check/checkbox.less_inline.js} +2 -14
  23. package/lib/check/checkbox_group.js +1 -1
  24. package/lib/check/index.d.ts +1 -0
  25. package/lib/{check-DFlwStH9.js → check/index.js} +10 -9
  26. package/lib/check/index.less_inline.js +4 -0
  27. package/lib/check/radio.js +15 -2
  28. package/lib/{radio-C9NPQWGI.js → check/radio.less_inline.js} +2 -11
  29. package/lib/check/radio_group.js +1 -1
  30. package/lib/collapse/index.js +103 -2
  31. package/lib/collapse/index.less_inline.js +4 -0
  32. package/lib/collapse/item.d.ts +1 -0
  33. package/lib/collapse/item.js +118 -2
  34. package/lib/collapse/item.less_inline.js +4 -0
  35. package/lib/collapse/types.d.ts +1 -0
  36. package/lib/color_picker/index.js +42 -2
  37. package/lib/color_picker/index.less_inline.js +4 -0
  38. package/lib/date_picker/index.js +100 -3
  39. package/lib/date_picker/index.less_inline.js +4 -0
  40. package/lib/date_picker_ori/index.js +121 -2
  41. package/lib/date_picker_ori/index.less_inline.js +4 -0
  42. package/lib/description_panel/index.js +54 -2
  43. package/lib/description_panel/index.less_inline.js +4 -0
  44. package/lib/dialog/dialog_box.js +11 -11
  45. package/lib/dialog/dialog_container.css_inline.js +4 -0
  46. package/lib/dialog/dialog_container.d.ts +1 -1
  47. package/lib/dialog/dialog_container.js +156 -2
  48. package/lib/dialog/dialog_container_style.d.ts +2 -0
  49. package/lib/dialog/dialog_container_style.js +6 -0
  50. package/lib/dialog/index.js +1 -1
  51. package/lib/entries/base.d.ts +2 -0
  52. package/lib/entries/base.js +2 -0
  53. package/lib/entries/button.d.ts +2 -0
  54. package/lib/entries/button.js +6 -0
  55. package/lib/entries/calendar.d.ts +2 -0
  56. package/lib/entries/calendar.js +6 -0
  57. package/lib/entries/card.d.ts +2 -0
  58. package/lib/entries/card.js +6 -0
  59. package/lib/entries/carousel-item.d.ts +2 -0
  60. package/lib/entries/carousel-item.js +6 -0
  61. package/lib/entries/carousel.d.ts +5 -0
  62. package/lib/entries/carousel.js +6 -0
  63. package/lib/entries/checkbox-group.d.ts +3 -0
  64. package/lib/entries/checkbox-group.js +6 -0
  65. package/lib/entries/checkbox.d.ts +2 -0
  66. package/lib/entries/checkbox.js +6 -0
  67. package/lib/entries/collapse-item.d.ts +3 -0
  68. package/lib/entries/collapse-item.js +6 -0
  69. package/lib/entries/collapse.d.ts +3 -0
  70. package/lib/entries/collapse.js +6 -0
  71. package/lib/entries/color-picker.d.ts +3 -0
  72. package/lib/entries/color-picker.js +6 -0
  73. package/lib/entries/date-picker-ori.d.ts +2 -0
  74. package/lib/entries/date-picker-ori.js +6 -0
  75. package/lib/entries/date-picker.d.ts +9 -0
  76. package/lib/entries/date-picker.js +6 -0
  77. package/lib/entries/description-panel.d.ts +4 -0
  78. package/lib/entries/description-panel.js +6 -0
  79. package/lib/entries/dialog-box.d.ts +6 -0
  80. package/lib/entries/dialog-box.js +2 -0
  81. package/lib/entries/dialog-container.d.ts +4 -0
  82. package/lib/entries/dialog-container.js +6 -0
  83. package/lib/entries/dialog.d.ts +3 -0
  84. package/lib/entries/dialog.js +2 -0
  85. package/lib/entries/form-item.d.ts +2 -0
  86. package/lib/entries/form-item.js +6 -0
  87. package/lib/entries/form.d.ts +3 -0
  88. package/lib/entries/form.js +6 -0
  89. package/lib/entries/icon-arrow-down.d.ts +2 -0
  90. package/lib/entries/icon-arrow-down.js +6 -0
  91. package/lib/entries/icon-arrow-left.d.ts +2 -0
  92. package/lib/entries/icon-arrow-left.js +6 -0
  93. package/lib/entries/icon-arrow-right.d.ts +2 -0
  94. package/lib/entries/icon-arrow-right.js +6 -0
  95. package/lib/entries/icon-arrow-up.d.ts +2 -0
  96. package/lib/entries/icon-arrow-up.js +6 -0
  97. package/lib/entries/icon-base.d.ts +2 -0
  98. package/lib/entries/icon-base.js +6 -0
  99. package/lib/entries/icon-calendar.d.ts +2 -0
  100. package/lib/entries/icon-calendar.js +6 -0
  101. package/lib/entries/icon-caret-bottom.d.ts +2 -0
  102. package/lib/entries/icon-caret-bottom.js +6 -0
  103. package/lib/entries/icon-caret-top.d.ts +2 -0
  104. package/lib/entries/icon-caret-top.js +6 -0
  105. package/lib/entries/icon-close-filled.d.ts +2 -0
  106. package/lib/entries/icon-close-filled.js +6 -0
  107. package/lib/entries/icon-close.d.ts +2 -0
  108. package/lib/entries/icon-close.js +6 -0
  109. package/lib/entries/icon-copy.d.ts +2 -0
  110. package/lib/entries/icon-copy.js +6 -0
  111. package/lib/entries/icon-d-arrow-left.d.ts +2 -0
  112. package/lib/entries/icon-d-arrow-left.js +6 -0
  113. package/lib/entries/icon-d-arrow-right.d.ts +2 -0
  114. package/lib/entries/icon-d-arrow-right.js +6 -0
  115. package/lib/entries/icon-delete.d.ts +2 -0
  116. package/lib/entries/icon-delete.js +6 -0
  117. package/lib/entries/icon-eye-outline.d.ts +2 -0
  118. package/lib/entries/icon-eye-outline.js +6 -0
  119. package/lib/entries/icon-font-icon.d.ts +2 -0
  120. package/lib/entries/icon-font-icon.js +6 -0
  121. package/lib/entries/icon-info.d.ts +2 -0
  122. package/lib/entries/icon-info.js +6 -0
  123. package/lib/entries/icon-loading.d.ts +2 -0
  124. package/lib/entries/icon-loading.js +6 -0
  125. package/lib/entries/icon-minus.d.ts +2 -0
  126. package/lib/entries/icon-minus.js +6 -0
  127. package/lib/entries/icon-moon.d.ts +2 -0
  128. package/lib/entries/icon-moon.js +6 -0
  129. package/lib/entries/icon-more.d.ts +2 -0
  130. package/lib/entries/icon-more.js +6 -0
  131. package/lib/entries/icon-picture.d.ts +2 -0
  132. package/lib/entries/icon-picture.js +6 -0
  133. package/lib/entries/icon-plus.d.ts +2 -0
  134. package/lib/entries/icon-plus.js +6 -0
  135. package/lib/entries/icon-reduction.d.ts +2 -0
  136. package/lib/entries/icon-reduction.js +6 -0
  137. package/lib/entries/icon-refresh-left.d.ts +2 -0
  138. package/lib/entries/icon-refresh-left.js +6 -0
  139. package/lib/entries/icon-refresh-right.d.ts +2 -0
  140. package/lib/entries/icon-refresh-right.js +6 -0
  141. package/lib/entries/icon-refresh.d.ts +2 -0
  142. package/lib/entries/icon-refresh.js +6 -0
  143. package/lib/entries/icon-search.d.ts +2 -0
  144. package/lib/entries/icon-search.js +6 -0
  145. package/lib/entries/icon-select.d.ts +2 -0
  146. package/lib/entries/icon-select.js +6 -0
  147. package/lib/entries/icon-sort.d.ts +2 -0
  148. package/lib/entries/icon-sort.js +6 -0
  149. package/lib/entries/icon-success.d.ts +2 -0
  150. package/lib/entries/icon-success.js +6 -0
  151. package/lib/entries/icon-sun.d.ts +2 -0
  152. package/lib/entries/icon-sun.js +6 -0
  153. package/lib/entries/icon-theme-default.d.ts +2 -0
  154. package/lib/entries/icon-theme-default.js +6 -0
  155. package/lib/entries/icon-warn.d.ts +2 -0
  156. package/lib/entries/icon-warn.js +6 -0
  157. package/lib/entries/icon-zoom-in.d.ts +2 -0
  158. package/lib/entries/icon-zoom-in.js +6 -0
  159. package/lib/entries/icon-zoom-out.d.ts +2 -0
  160. package/lib/entries/icon-zoom-out.js +6 -0
  161. package/lib/entries/image-preview.d.ts +10 -0
  162. package/lib/entries/image-preview.js +6 -0
  163. package/lib/entries/image.d.ts +2 -0
  164. package/lib/entries/image.js +6 -0
  165. package/lib/entries/input-number.d.ts +2 -0
  166. package/lib/entries/input-number.js +6 -0
  167. package/lib/entries/input.d.ts +2 -0
  168. package/lib/entries/input.js +6 -0
  169. package/lib/entries/list.d.ts +3 -0
  170. package/lib/entries/list.js +6 -0
  171. package/lib/entries/loading.d.ts +2 -0
  172. package/lib/entries/loading.js +2 -0
  173. package/lib/entries/mask.d.ts +2 -0
  174. package/lib/entries/mask.js +6 -0
  175. package/lib/entries/md-input.d.ts +2 -0
  176. package/lib/entries/md-input.js +6 -0
  177. package/lib/entries/menu.d.ts +3 -0
  178. package/lib/entries/menu.js +6 -0
  179. package/lib/entries/message.d.ts +6 -0
  180. package/lib/entries/message.js +2 -0
  181. package/lib/entries/modal-box.d.ts +6 -0
  182. package/lib/entries/modal-box.js +2 -0
  183. package/lib/entries/modal.d.ts +4 -0
  184. package/lib/entries/modal.js +6 -0
  185. package/lib/entries/notification.d.ts +7 -0
  186. package/lib/entries/notification.js +6 -0
  187. package/lib/entries/page-header.d.ts +4 -0
  188. package/lib/entries/page-header.js +6 -0
  189. package/lib/entries/pagination.d.ts +9 -0
  190. package/lib/entries/pagination.js +6 -0
  191. package/lib/entries/polygon.d.ts +2 -0
  192. package/lib/entries/polygon.js +6 -0
  193. package/lib/entries/popconfirm.d.ts +3 -0
  194. package/lib/entries/popconfirm.js +2 -0
  195. package/lib/entries/popover.d.ts +1 -0
  196. package/lib/entries/popover.js +2 -0
  197. package/lib/entries/qrcode.d.ts +2 -0
  198. package/lib/entries/qrcode.js +6 -0
  199. package/lib/entries/radio-group.d.ts +3 -0
  200. package/lib/entries/radio-group.js +6 -0
  201. package/lib/entries/radio.d.ts +2 -0
  202. package/lib/entries/radio.js +6 -0
  203. package/lib/entries/select-ori.d.ts +2 -0
  204. package/lib/entries/select-ori.js +6 -0
  205. package/lib/entries/select.d.ts +4 -0
  206. package/lib/entries/select.js +6 -0
  207. package/lib/entries/space.d.ts +2 -0
  208. package/lib/entries/space.js +6 -0
  209. package/lib/entries/switch.d.ts +2 -0
  210. package/lib/entries/switch.js +6 -0
  211. package/lib/entries/tabbar-item.d.ts +2 -0
  212. package/lib/entries/tabbar-item.js +6 -0
  213. package/lib/entries/tabbar.d.ts +3 -0
  214. package/lib/entries/tabbar.js +6 -0
  215. package/lib/entries/table.d.ts +3 -0
  216. package/lib/entries/table.js +6 -0
  217. package/lib/entries/tabs.d.ts +3 -0
  218. package/lib/entries/tabs.js +2 -0
  219. package/lib/entries/tag.d.ts +2 -0
  220. package/lib/entries/tag.js +6 -0
  221. package/lib/entries/theme-color.d.ts +3 -0
  222. package/lib/entries/theme-color.js +6 -0
  223. package/lib/entries/theme.d.ts +9 -0
  224. package/lib/entries/theme.js +6 -0
  225. package/lib/entries/transition.d.ts +1 -0
  226. package/lib/entries/transition.js +2 -0
  227. package/lib/entries/upload.d.ts +3 -0
  228. package/lib/entries/upload.js +6 -0
  229. package/lib/entries/utils.d.ts +1 -0
  230. package/lib/entries/utils.js +2 -0
  231. package/lib/form/form_inner.d.ts +1 -0
  232. package/lib/{form_inner-Cnwb6f_Q.js → form/form_inner.js} +9 -9
  233. package/lib/form/form_item.d.ts +2 -1
  234. package/lib/form/form_item.js +148 -2
  235. package/lib/form/form_item.less_inline.js +4 -0
  236. package/lib/form/index.d.ts +3 -2
  237. package/lib/form/index.js +191 -2
  238. package/lib/form/index.less_inline.js +4 -0
  239. package/lib/icon/arrow_down.js +1 -1
  240. package/lib/icon/arrow_left.js +1 -1
  241. package/lib/icon/arrow_right.js +1 -1
  242. package/lib/icon/arrow_up.js +1 -1
  243. package/lib/icon/base.d.ts +2 -1
  244. package/lib/icon/base.js +63 -2
  245. package/lib/icon/calendar.js +1 -1
  246. package/lib/icon/caret_bottom.js +1 -1
  247. package/lib/icon/caret_top.js +1 -1
  248. package/lib/icon/close.js +1 -1
  249. package/lib/icon/close_filled.js +1 -1
  250. package/lib/icon/copy.d.ts +6 -0
  251. package/lib/icon/copy.js +13 -0
  252. package/lib/icon/d_arrow_left.js +1 -1
  253. package/lib/icon/d_arrow_right.js +1 -1
  254. package/lib/icon/delete.d.ts +5 -0
  255. package/lib/icon/delete.js +10 -0
  256. package/lib/icon/eye_outline.d.ts +6 -0
  257. package/lib/icon/eye_outline.js +13 -0
  258. package/lib/icon/font_icon.js +1 -1
  259. package/lib/icon/icon_style.d.ts +2 -0
  260. package/lib/icon/icon_style.js +6 -0
  261. package/lib/icon/index.less_inline.js +4 -0
  262. package/lib/icon/info.js +1 -1
  263. package/lib/icon/loading.js +1 -1
  264. package/lib/icon/minus.d.ts +5 -0
  265. package/lib/icon/minus.js +10 -0
  266. package/lib/icon/moon.js +1 -1
  267. package/lib/icon/more.js +1 -1
  268. package/lib/icon/picture.d.ts +5 -0
  269. package/lib/icon/picture.js +10 -0
  270. package/lib/icon/plus.d.ts +5 -0
  271. package/lib/icon/plus.js +10 -0
  272. package/lib/icon/reduction.js +1 -1
  273. package/lib/icon/refresh.js +1 -1
  274. package/lib/icon/refresh_left.js +1 -1
  275. package/lib/icon/refresh_right.js +1 -1
  276. package/lib/icon/search.js +1 -1
  277. package/lib/icon/select.js +1 -1
  278. package/lib/icon/sort.js +1 -1
  279. package/lib/icon/success.js +1 -1
  280. package/lib/icon/sun.js +1 -1
  281. package/lib/icon/theme_default.js +1 -1
  282. package/lib/icon/warn.js +1 -1
  283. package/lib/icon/zoom_in.js +1 -1
  284. package/lib/icon/zoom_out.js +1 -1
  285. package/lib/image/image_preview.js +91 -2
  286. package/lib/image/image_preview.less_inline.js +4 -0
  287. package/lib/image/index.js +163 -2
  288. package/lib/image/index.less_inline.js +4 -0
  289. package/lib/index.d.ts +14 -0
  290. package/lib/index.js +75 -65
  291. package/lib/input/index.js +4 -4
  292. package/lib/{input-DUBlLEXS.js → input/index.less_inline.js} +1 -1
  293. package/lib/{input_inner-x4GfLGjj.js → input/input_inner.less_inline.js} +1 -1
  294. package/lib/input_number/index.d.ts +59 -0
  295. package/lib/input_number/index.js +203 -0
  296. package/lib/input_number/index.less_inline.js +4 -0
  297. package/lib/input_number/style.d.ts +2 -0
  298. package/lib/input_number/style.js +6 -0
  299. package/lib/list/index.js +52 -2
  300. package/lib/list/index.less_inline.js +4 -0
  301. package/lib/loading/index.js +1 -1
  302. package/lib/mask/index.d.ts +1 -1
  303. package/lib/mask/index.js +109 -2
  304. package/lib/mask/index.less_inline.js +4 -0
  305. package/lib/md_input/index.js +59 -2
  306. package/lib/md_input/index.less_inline.js +4 -0
  307. package/lib/menu/index.js +275 -2
  308. package/lib/menu/index.less_inline.js +4 -0
  309. package/lib/message/index.js +1 -1
  310. package/lib/modal/index.js +199 -2
  311. package/lib/modal/index.less_inline.js +4 -0
  312. package/lib/modal/modal_box.d.ts +22 -0
  313. package/lib/modal/modal_box.js +21 -22
  314. package/lib/notification/index.d.ts +212 -0
  315. package/lib/notification/index.js +380 -0
  316. package/lib/notification/index.less_inline.js +4 -0
  317. package/lib/notification/placement.d.ts +49 -0
  318. package/lib/notification/placement.js +48 -0
  319. package/lib/notification/style.d.ts +2 -0
  320. package/lib/notification/style.js +6 -0
  321. package/lib/page_header/index.js +100 -2
  322. package/lib/page_header/index.less_inline.js +4 -0
  323. package/lib/pagination/index.js +214 -2
  324. package/lib/pagination/index.less_inline.js +4 -0
  325. package/lib/polygon/index.js +21 -2
  326. package/lib/{polygon-DhhovlrG.js → polygon/index.less_inline.js} +2 -18
  327. package/lib/qrcode/index.js +65 -2
  328. package/lib/qrcode/index.less_inline.js +4 -0
  329. package/lib/select/index.js +355 -3
  330. package/lib/select/index.less_inline.js +4 -0
  331. package/lib/select_ori/index.js +58 -2
  332. package/lib/select_ori/index.less_inline.js +4 -0
  333. package/lib/space/index.js +40 -2
  334. package/lib/space/index.less_inline.js +4 -0
  335. package/lib/{animation-Bo4jbSGK.js → styles/animation/index.css_inline.js} +2 -3
  336. package/lib/styles/animation/index.js +6 -2
  337. package/lib/{mask-Ox6CoyFB.js → styles/mask/index.css_inline.js} +2 -3
  338. package/lib/styles/mask/index.js +6 -2
  339. package/lib/switch/index.js +51 -2
  340. package/lib/switch/index.less_inline.js +4 -0
  341. package/lib/tabbar/index.js +97 -2
  342. package/lib/tabbar/index.less_inline.js +4 -0
  343. package/lib/tabbar/item.js +61 -2
  344. package/lib/tabbar/item.less_inline.js +4 -0
  345. package/lib/table/index.js +234 -2
  346. package/lib/table/index.less_inline.js +4 -0
  347. package/lib/tabs/index.js +1 -1
  348. package/lib/tag/index.js +75 -2
  349. package/lib/tag/index.less_inline.js +4 -0
  350. package/lib/theme/index.js +86 -2
  351. package/lib/theme/index.less_inline.js +4 -0
  352. package/lib/theme/theme_color.js +1 -1
  353. package/lib/upload/index.d.ts +170 -0
  354. package/lib/upload/index.js +848 -0
  355. package/lib/upload/index.less_inline.js +4 -0
  356. package/lib/upload/style.d.ts +2 -0
  357. package/lib/upload/style.js +6 -0
  358. package/lib/utils/context_provide.d.ts +1 -0
  359. package/lib/utils/context_provide.js +1 -1
  360. package/lib/utils/event.d.ts +30 -0
  361. package/lib/utils/index.d.ts +3 -0
  362. package/lib/utils/index.js +1 -1
  363. package/lib/utils/popover.js +1 -1
  364. package/lib/utils/signal_types.d.ts +5 -0
  365. package/lib/utils/transition.d.ts +28 -0
  366. package/lib/utils/transition.js +1 -1
  367. package/package.json +39 -18
  368. package/styles/animation.css +2 -2
  369. package/styles/container.css +8 -8
  370. package/styles/datepicker.css +9 -9
  371. package/styles/dialog.css +7 -7
  372. package/styles/loading.css +17 -17
  373. package/styles/message.css +9 -9
  374. package/styles/modal_box.css +3 -3
  375. package/styles/notification.css +17 -0
  376. package/styles/popover.css +11 -14
  377. package/styles/reset.css +13 -15
  378. package/styles/scrollbar.css +5 -5
  379. package/styles/select.css +6 -6
  380. package/styles/tabs.css +3 -3
  381. package/styles/theme-coral.css +35 -0
  382. package/styles/theme-jade.css +35 -0
  383. package/styles/theme-tangerine.css +35 -0
  384. package/styles/transition.css +1 -1
  385. package/styles/vars.css +41 -7
  386. package/lib/base-Dyj1rzaK.js +0 -61
  387. package/lib/calendar-CvlUsN6w.js +0 -146
  388. package/lib/card-3DM-lJQV.js +0 -63
  389. package/lib/carousel-DvkZ1YXq.js +0 -276
  390. package/lib/check-doQ2ZpQj.js +0 -117
  391. package/lib/collapse-B6-Rn05A.js +0 -102
  392. package/lib/color_picker-0a-IGZY9.js +0 -41
  393. package/lib/date_picker-BDN2PAz5.js +0 -99
  394. package/lib/date_picker_ori-BXFs1eET.js +0 -120
  395. package/lib/description_panel--AKXBzLL.js +0 -53
  396. package/lib/dialog_container-BNPQ9n0V.js +0 -145
  397. package/lib/esm-DAha108i.js +0 -270
  398. package/lib/form-DJxvBiLy.js +0 -190
  399. package/lib/form_item-BqPMRABd.js +0 -147
  400. package/lib/image-CVQai6NX.js +0 -162
  401. package/lib/image_preview-DfQAKSJH.js +0 -90
  402. package/lib/item-CQ2Sknbz.js +0 -14
  403. package/lib/item-DI6mQXtB.js +0 -117
  404. package/lib/item-D_ZOPXuE.js +0 -60
  405. package/lib/list-MG8PRzos.js +0 -51
  406. package/lib/mask-Bx-yNIJv.js +0 -108
  407. package/lib/md_input-BX3bujz8.js +0 -58
  408. package/lib/menu-DKscK5mw.js +0 -274
  409. package/lib/modal-Cwi3qlEf.js +0 -198
  410. package/lib/page_header-ujV3pncE.js +0 -99
  411. package/lib/pagination-aRbGd3Rf.js +0 -213
  412. package/lib/qrcode-Dip8uLSA.js +0 -64
  413. package/lib/select-BZMDj5VE.js +0 -354
  414. package/lib/select_ori-C7sUZxen.js +0 -57
  415. package/lib/space-CKuTk0YB.js +0 -39
  416. package/lib/switch-wh2-ivty.js +0 -50
  417. package/lib/tabbar-CBXK-_AV.js +0 -96
  418. package/lib/table-BQxMD2Ae.js +0 -233
  419. package/lib/tag-Di1z9PoZ.js +0 -74
  420. package/lib/theme-CLbBS-in.js +0 -85
  421. package/styles/dark.css +0 -13
@@ -0,0 +1,4 @@
1
+ //#region src/components/modal/index.less?inline
2
+ var e = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex,100)}.l-modal-wrapper{width:100%;height:100%;z-index:calc(var(--l-modal-zindex,100) + 1);position:fixed;top:0;left:0}.l-modal{--l-modal-translate:translate3d(0, 80px, 0);border-radius:var(--l-modal-border-radius,5px);width:var(--l-modal-width,27%);opacity:1;transform:var(--l-modal-translate) scale3d(1, 1, 1);background-color:#fff;margin:auto;transition:opacity .3s,transform .3s;position:relative;box-shadow:0 0 8px #0000001a}.l-modal-header{padding:var(--l-modal-header-padding,10px);border-bottom:1px solid var(--l-modal-line-color,#0000000f);align-items:center;gap:5px;font-size:16px;font-weight:600;display:flex}.l-modal-footer{padding:var(--l-modal-footer-padding,10px);border-top:1px solid var(--l-modal-line-color,#0000000f);justify-content:flex-end;gap:10px;display:flex}.l-modal-container{padding:var(--l-modal-container-padding,15px 10px);font-size:14px}.l-btn-modal-close{--l-form-control-height:auto;position:absolute}.l-modal-close1{top:8px;right:5px}.l-modal-close1::part(default){border:none;width:auto;height:auto;padding:5px;font-size:16px}.l-modal-close2{top:-10px;right:-10px}.l-modal-close2::part(default){background-color:#fff;width:20px;height:20px;padding:0}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translate(0,0)scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:#0000;justify-content:center;padding:20px 10px 5px;display:flex}.l-modal--mobile .l-modal-container{--l-modal-container-padding:5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{text-align:center;justify-content:stretch;align-items:stretch;gap:0;height:50px;padding:0;display:flex}.l-modal--mobile .l-modal-footer-btn{flex-grow:1;height:100%}.l-modal--mobile .l-modal-footer-btn+.l-modal-footer-btn{border-left:1px solid var(--l-modal-line-color,#0000000f)}.l-modal--middle{--l-modal-translate:translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate:translate3d(0, -100%, 0);border-bottom-right-radius:0;border-bottom-left-radius:0;width:100%;top:100%}@media screen and (width<=768px){:host{--l-modal-width:80%}}";
3
+ //#endregion
4
+ export { e as default };
@@ -0,0 +1,22 @@
1
+ type AlertOptions = {
2
+ /** 是否显示取消按钮 */
3
+ showCancel?: boolean;
4
+ /** 右上角关闭按钮, 1-显示在框内,2-显示在框角, 0-不显示, 默认: 0 */
5
+ close?: number;
6
+ /** 点击蒙层是否允许关闭, 默认: false */
7
+ maskClosable?: boolean;
8
+ /** 显示图标 */
9
+ icon?: () => HTMLElement;
10
+ };
11
+ type PromptOptions = AlertOptions & {
12
+ placeholder?: string;
13
+ };
14
+ declare function alert(content: string, title?: string, option?: AlertOptions): Promise<boolean>;
15
+ declare function confirm(content: string, title?: string, option?: AlertOptions): Promise<string | boolean>;
16
+ declare function prompt(label: string, title?: string, option?: PromptOptions): Promise<string | boolean>;
17
+ declare const _default: {
18
+ alert: typeof alert;
19
+ confirm: typeof confirm;
20
+ prompt: typeof prompt;
21
+ };
22
+ export default _default;
@@ -2,10 +2,10 @@ import { regist as e } from "../utils/index.js";
2
2
  import t from "../icon/info.js";
3
3
  import n from "../button/index.js";
4
4
  import r from "../icon/close.js";
5
- import { t as i } from "../form_item-BqPMRABd.js";
5
+ import i from "../form/form_item.js";
6
6
  import a from "../input/index.js";
7
- import { t as o } from "../modal-Cwi3qlEf.js";
8
- import { $$ as s, $one as c, on as l } from "ph-utils/browser";
7
+ import o from "./index.js";
8
+ import { $$ as s, $one as c, on as l } from "utilane/browser";
9
9
  //#region src/components/modal/modal_box.ts
10
10
  function u(e, t, n, r = "alert") {
11
11
  return new Promise((i) => {
@@ -34,27 +34,26 @@ function u(e, t, n, r = "alert") {
34
34
  });
35
35
  }
36
36
  function d(t, i, a) {
37
- return e([
37
+ e([
38
+ r,
38
39
  n,
39
- o,
40
- r
41
- ]), new Promise((e) => {
42
- let n = {
43
- showCancel: !1,
44
- close: 0,
45
- maskClosable: !1,
46
- icon: void 0,
47
- ...a
48
- };
49
- return u(i || "提示", t, n, "alert");
50
- });
40
+ o
41
+ ]);
42
+ let s = {
43
+ showCancel: !1,
44
+ close: 0,
45
+ maskClosable: !1,
46
+ icon: void 0,
47
+ ...a
48
+ };
49
+ return u(i || "提示", t, s, "alert").then((e) => e === !0);
51
50
  }
52
51
  function f(i, a, c) {
53
52
  e([
54
- n,
55
- o,
56
53
  r,
57
- t
54
+ t,
55
+ n,
56
+ o
58
57
  ]);
59
58
  let l = {
60
59
  showCancel: !0,
@@ -67,12 +66,12 @@ function f(i, a, c) {
67
66
  }
68
67
  function p(s, c, l) {
69
68
  e([
70
- n,
71
- o,
72
69
  r,
73
70
  t,
74
71
  i,
75
- a
72
+ a,
73
+ n,
74
+ o
76
75
  ]);
77
76
  let d = {
78
77
  showCancel: !0,
@@ -0,0 +1,212 @@
1
+ import BaseComponent from "../base";
2
+ import type { NotificationPlacement } from "./placement";
3
+ export type { NotificationPlacement };
4
+ /** 通知状态类型 */
5
+ export type NotificationType = "info" | "success" | "error" | "warning";
6
+ /** 命令式调用配置 */
7
+ export interface NotificationOptions {
8
+ /** 自定义通知 id, 不传则自动生成 */
9
+ id?: string;
10
+ /** 标题 */
11
+ title?: string;
12
+ /** 消息内容, 支持 HTML 字符串 */
13
+ message?: string;
14
+ /** 状态类型, 默认: `info` */
15
+ type?: NotificationType;
16
+ /** 显示方位, 默认: `topRight` */
17
+ placement?: NotificationPlacement;
18
+ /** 自动关闭时间(毫秒), 设置为 `0` 时不自动关闭, 默认: `4500` */
19
+ duration?: number;
20
+ /** 是否显示关闭按钮, 默认: `true` */
21
+ closable?: boolean;
22
+ /** 是否显示状态图标, 默认: `true` */
23
+ showIcon?: boolean;
24
+ /** 通知宽度, 数字会自动转换为 `px` */
25
+ width?: string | number;
26
+ /** 距离视口边缘的距离(px), 默认: `16` */
27
+ offset?: number;
28
+ /** 层级, 默认: `2000` */
29
+ zIndex?: number;
30
+ /** 同一个方位最多同时显示的通知数量, `0` 表示不限制 */
31
+ maxCount?: number;
32
+ /** 行动点按钮文本, 用于给出用户下一步的操作 */
33
+ action?: string;
34
+ /** 自定义类名, 多个使用空格分隔 */
35
+ customClass?: string;
36
+ /** 关闭后的回调 */
37
+ onClose?: (id: string) => void;
38
+ /** 点击行动点的回调 */
39
+ onAction?: (id: string) => void;
40
+ }
41
+ type NotificationState = {
42
+ open: boolean;
43
+ type: NotificationType;
44
+ title: string;
45
+ message: string;
46
+ placement: NotificationPlacement;
47
+ duration: number;
48
+ closable: boolean;
49
+ showIcon: boolean;
50
+ width: string;
51
+ offset: number;
52
+ zIndex: number;
53
+ maxCount: number;
54
+ action: string;
55
+ customClass: string;
56
+ };
57
+ /**
58
+ * 设置全局默认配置, 之后创建的通知都会使用该配置
59
+ * @param option 配置项
60
+ */
61
+ declare function configNotification(option: NotificationOptions): void;
62
+ /**
63
+ * 创建一条通知
64
+ * @param option 通知内容或配置项
65
+ * @param type 状态类型, 会覆盖配置项中的 `type`
66
+ * @returns 通知 id, 可以配合 `Notification.close` 手动关闭
67
+ */
68
+ declare function showNotification(option: string | NotificationOptions, type?: NotificationType): string;
69
+ /**
70
+ * 关闭指定 id 的通知
71
+ * @param id 通知 id
72
+ */
73
+ declare function closeNotification(id: string): void;
74
+ /**
75
+ * 关闭所有通知
76
+ * @param placement 只关闭指定方位的通知, 不传递则关闭所有方位
77
+ */
78
+ declare function closeAllNotification(placement?: NotificationPlacement): void;
79
+ export default class Notification extends BaseComponent<NotificationState> {
80
+ static baseName: string;
81
+ /** 显示通知, 返回通知 id */
82
+ static show: typeof showNotification;
83
+ /** 显示普通通知 */
84
+ static info: (option: string | NotificationOptions) => string;
85
+ /** 显示成功通知 */
86
+ static success: (option: string | NotificationOptions) => string;
87
+ /** 显示错误通知 */
88
+ static error: (option: string | NotificationOptions) => string;
89
+ /** 显示警告通知 */
90
+ static warning: (option: string | NotificationOptions) => string;
91
+ /** 显示警告通知, `warning` 的别名 */
92
+ static warn: (option: string | NotificationOptions) => string;
93
+ /** 关闭指定 id 的通知 */
94
+ static close: typeof closeNotification;
95
+ /** 关闭所有通知 */
96
+ static closeAll: typeof closeAllNotification;
97
+ /** 设置全局默认配置 */
98
+ static config: typeof configNotification;
99
+ /** 关闭后是否从文档中移除, 命令式 API 创建的通知为 `true` */
100
+ removeOnClose: boolean;
101
+ /** 当前是否显示 */
102
+ private _visible;
103
+ /** 自动关闭定时器 */
104
+ private _timer?;
105
+ /** 定时器开始时间 */
106
+ private _startTime;
107
+ /** 剩余自动关闭时间 */
108
+ private _remaining;
109
+ /** 已经应用到宿主节点上的自定义类名 */
110
+ private _appliedClasses;
111
+ /** 取消当前进行中的动画 */
112
+ private _cancelAnimation?;
113
+ /** 监听内容尺寸变化, 尺寸变化时重新排布 */
114
+ private _resizeObserver?;
115
+ private $icon?;
116
+ private $title?;
117
+ private $titleText?;
118
+ private $message?;
119
+ private $messageText?;
120
+ private $actionWrap?;
121
+ private $actionBtn?;
122
+ private $actionSlot?;
123
+ private $closeBtn?;
124
+ constructor();
125
+ /** 距离视口边缘的距离(px) */
126
+ get notificationOffset(): number;
127
+ /** 与相邻通知的间距(px) */
128
+ get notificationGap(): number;
129
+ /** 当前显示方位 */
130
+ get placement(): NotificationPlacement;
131
+ get open(): boolean;
132
+ set open(value: boolean);
133
+ static get observedAttributes(): string[];
134
+ protected attributeChanged(name: string, _oldValue: string, newValue: string): void;
135
+ protected updateDOM(changedProps: Set<string>): void;
136
+ connectedCallback(): void;
137
+ disconnectedCallback(): void;
138
+ render_v2(): {
139
+ styleSheets: CSSStyleSheet[];
140
+ template: HTMLElement;
141
+ };
142
+ afterInit(): void;
143
+ beforeDestroy(): void;
144
+ render(): HTMLElement;
145
+ /** 显示通知 */
146
+ show(): void;
147
+ /** 关闭通知 */
148
+ close(): void;
149
+ private _initRefs;
150
+ private _bindEvents;
151
+ private _unbindEvents;
152
+ private _syncAll;
153
+ /** 同步状态图标 */
154
+ private _syncIcon;
155
+ /** 同步标题与内容 */
156
+ private _syncSections;
157
+ /**
158
+ * 同步内容区域
159
+ * @param $wrap 区域节点
160
+ * @param $text 通过属性渲染的内容节点
161
+ * @param value 属性值
162
+ * @param asText 是否按照纯文本渲染, 否则按照 HTML 渲染
163
+ */
164
+ private _syncSection;
165
+ /** 同步行动点 */
166
+ private _syncActions;
167
+ /** 同步关闭按钮 */
168
+ private _syncClose;
169
+ /** 同步宽度 */
170
+ private _syncWidth;
171
+ /** 同步偏移与层级 */
172
+ private _syncOffset;
173
+ /** 同步自定义类名 */
174
+ private _syncCustomClass;
175
+ /** 插槽中是否存在有效内容(忽略空白文本) */
176
+ private _hasSlotContent;
177
+ /** 方位变化时重新排布 */
178
+ private _updatePlacement;
179
+ private _toggleOpen;
180
+ private _show;
181
+ private _hide;
182
+ /** 超出同一方位的最大数量时, 关闭最早的通知 */
183
+ private _enforceMaxCount;
184
+ /**
185
+ * 入场动画
186
+ *
187
+ * 先应用起始状态(此时还没有过渡), 再开启过渡并移除起始状态,
188
+ * 避免从已显示状态反向过渡。
189
+ */
190
+ private _enter;
191
+ /** 离场动画 */
192
+ private _leave;
193
+ /** 过渡时长(毫秒) */
194
+ private _transitionDuration;
195
+ /** 监听指定属性的过渡结束, 同时提供兜底处理 */
196
+ private _onceTransitionEnd;
197
+ private _cancelPendingAnimation;
198
+ /** 内容尺寸变化时重新排布 */
199
+ private _observeSize;
200
+ private _unobserveSize;
201
+ private _startTimer;
202
+ private _clearTimer;
203
+ /** 鼠标悬浮时暂停自动关闭 */
204
+ private _pauseTimer;
205
+ /** 鼠标移出时继续自动关闭 */
206
+ private _resumeTimer;
207
+ private _handleMouseEnter;
208
+ private _handleMouseLeave;
209
+ private _handleCloseClick;
210
+ private _handleActionClick;
211
+ private _handleSlotChange;
212
+ }
@@ -0,0 +1,380 @@
1
+ import e from "../base.js";
2
+ import { kebabToCamel as t, parseAttrValue as n, regist as r, unitNumberStr as i, useId as a } from "../utils/index.js";
3
+ import o from "../icon/close_filled.js";
4
+ import s from "../icon/success.js";
5
+ import c from "../icon/warn.js";
6
+ import l from "../icon/info.js";
7
+ import u from "../icon/close.js";
8
+ import d from "./style.js";
9
+ import { DEFAULT_ZINDEX as f, getGroupSize as p, getOldestNotification as m, layoutGroup as h, normalizePlacement as g, registerNotification as _, unregisterNotification as v } from "./placement.js";
10
+ import { $$ as y, $one as b, off as x, on as S } from "utilane/browser";
11
+ //#region src/components/notification/index.ts
12
+ var C = "l-notification", w = 4500, T = {
13
+ info: "info",
14
+ success: "success",
15
+ error: "close-filled",
16
+ warning: "warn"
17
+ }, E = !1, D = {};
18
+ function O() {
19
+ E ||= (r([
20
+ l,
21
+ s,
22
+ c,
23
+ o,
24
+ u
25
+ ]), !0);
26
+ }
27
+ function k(e) {
28
+ D = {
29
+ ...D,
30
+ ...e
31
+ };
32
+ }
33
+ function A(e, t) {
34
+ O(), r(N);
35
+ let n = {
36
+ ...D,
37
+ ...typeof e == "string" ? { message: e } : e
38
+ };
39
+ t && (n.type = t);
40
+ let i = n.id || a(), o = g(n.placement), s = document.createElement(C);
41
+ return s.id = i, s.removeOnClose = !0, s.setAttribute("open", ""), s.setAttribute("type", n.type || "info"), s.setAttribute("placement", o), n.title != null && s.setAttribute("title", n.title), n.message != null && s.setAttribute("message", n.message), s.setAttribute("duration", `${n.duration ?? w}`), n.closable === !1 && s.setAttribute("closable", "false"), n.showIcon === !1 && s.setAttribute("show-icon", "false"), n.width != null && s.setAttribute("width", `${n.width}`), n.offset != null && s.setAttribute("offset", `${n.offset}`), n.zIndex != null && s.setAttribute("z-index", `${n.zIndex}`), n.maxCount != null && s.setAttribute("max-count", `${n.maxCount}`), n.action && s.setAttribute("action", n.action), n.customClass && s.setAttribute("custom-class", n.customClass), n.onClose && S(s, "close", () => n.onClose?.(i)), n.onAction && S(s, "action", () => n.onAction?.(i)), document.body.appendChild(s), i;
42
+ }
43
+ function j(e) {
44
+ let t = document.getElementById(e);
45
+ t && typeof t.close == "function" && t.close();
46
+ }
47
+ function M(e) {
48
+ let t = e ? [g(e)] : void 0, n = document.querySelectorAll(C);
49
+ for (let e of Array.from(n)) {
50
+ let n = e;
51
+ typeof n.close == "function" && (t && !t.includes(n.placement) || n.close());
52
+ }
53
+ }
54
+ var N = class extends e {
55
+ static baseName = "notification";
56
+ static show = A;
57
+ static info = (e) => A(e, "info");
58
+ static success = (e) => A(e, "success");
59
+ static error = (e) => A(e, "error");
60
+ static warning = (e) => A(e, "warning");
61
+ static warn = (e) => A(e, "warning");
62
+ static close = j;
63
+ static closeAll = M;
64
+ static config = k;
65
+ removeOnClose = !1;
66
+ _visible = !1;
67
+ _timer;
68
+ _startTime = 0;
69
+ _remaining = 0;
70
+ _appliedClasses = [];
71
+ _cancelAnimation;
72
+ _resizeObserver;
73
+ $icon;
74
+ $title;
75
+ $titleText;
76
+ $message;
77
+ $messageText;
78
+ $actionWrap;
79
+ $actionBtn;
80
+ $actionSlot;
81
+ $closeBtn;
82
+ constructor() {
83
+ super(), this.version = 2, this._state = {
84
+ open: !1,
85
+ type: "info",
86
+ title: "",
87
+ message: "",
88
+ placement: "topRight",
89
+ duration: 0,
90
+ closable: !0,
91
+ showIcon: !0,
92
+ width: "",
93
+ offset: 16,
94
+ zIndex: f,
95
+ maxCount: 0,
96
+ action: "",
97
+ customClass: ""
98
+ };
99
+ }
100
+ get notificationOffset() {
101
+ return this._state.offset;
102
+ }
103
+ get notificationGap() {
104
+ let e = parseFloat(getComputedStyle(this).getPropertyValue("--l-notification-gap"));
105
+ return Number.isFinite(e) ? e : 16;
106
+ }
107
+ get placement() {
108
+ return this._state.placement;
109
+ }
110
+ get open() {
111
+ return this._state.open;
112
+ }
113
+ set open(e) {
114
+ e ? this.show() : this.close();
115
+ }
116
+ static get observedAttributes() {
117
+ return [
118
+ "open",
119
+ "type",
120
+ "title",
121
+ "message",
122
+ "placement",
123
+ "duration",
124
+ "closable",
125
+ "show-icon",
126
+ "width",
127
+ "offset",
128
+ "z-index",
129
+ "max-count",
130
+ "action",
131
+ "custom-class"
132
+ ];
133
+ }
134
+ attributeChanged(e, r, a) {
135
+ switch (e) {
136
+ case "type":
137
+ this._state.type = a || "info";
138
+ break;
139
+ case "title":
140
+ this._state.title = a || "";
141
+ break;
142
+ case "message":
143
+ this._state.message = a || "";
144
+ break;
145
+ case "action":
146
+ this._state.action = a || "";
147
+ break;
148
+ case "custom-class":
149
+ this._state.customClass = a || "";
150
+ break;
151
+ case "placement":
152
+ this._state.placement = g(a);
153
+ break;
154
+ case "width":
155
+ this._state.width = i(a) || "";
156
+ break;
157
+ case "duration":
158
+ case "offset":
159
+ case "z-index":
160
+ case "max-count":
161
+ this._state[t(e)] = Number(a) || 0;
162
+ break;
163
+ case "open":
164
+ case "closable":
165
+ case "show-icon": this._state[t(e)] = n(a, !1, e);
166
+ }
167
+ }
168
+ updateDOM(e) {
169
+ (e.has("type") || e.has("show-icon")) && this._syncIcon(), (e.has("title") || e.has("message")) && this._syncSections(), e.has("action") && this._syncActions(), e.has("closable") && this._syncClose(), e.has("width") && this._syncWidth(), e.has("custom-class") && this._syncCustomClass(), (e.has("offset") || e.has("z-index")) && this._syncOffset(), e.has("placement") && this._updatePlacement(), e.has("duration") && this._visible && this._startTimer(), e.has("open") && this._toggleOpen();
170
+ }
171
+ connectedCallback() {
172
+ O(), super.connectedCallback();
173
+ }
174
+ disconnectedCallback() {
175
+ super.disconnectedCallback(), v(this), this._cancelPendingAnimation(), this._unobserveSize(), this._clearTimer(), this._visible = !1;
176
+ }
177
+ render_v2() {
178
+ return this._changedProperties.clear(), {
179
+ styleSheets: [d],
180
+ template: this.render()
181
+ };
182
+ }
183
+ afterInit() {
184
+ this._initRefs(), this._bindEvents(), this._syncAll(), this._state.open ? this._visible ? this._startTimer() : this._show() : (this._visible = !1, this.setAttribute("hidden", ""));
185
+ }
186
+ beforeDestroy() {
187
+ this._unbindEvents();
188
+ }
189
+ render() {
190
+ let e = y("div", {
191
+ class: "l-notification",
192
+ part: "default"
193
+ });
194
+ e.appendChild(y("div", {
195
+ class: "l-notification-icon",
196
+ part: "icon"
197
+ }));
198
+ let t = y("div", { class: "l-notification-content" });
199
+ return t.innerHTML = [
200
+ "<div class=\"l-notification-title\" part=\"title\">",
201
+ "<span class=\"l-notification-title-text\"></span>",
202
+ "<slot name=\"title\"></slot>",
203
+ "</div>",
204
+ "<div class=\"l-notification-message\" part=\"message\">",
205
+ "<span class=\"l-notification-message-text\"></span>",
206
+ "<slot></slot>",
207
+ "</div>",
208
+ "<div class=\"l-notification-actions\" part=\"actions\">",
209
+ "<button type=\"button\" class=\"l-notification-action\" part=\"action\"></button>",
210
+ "<slot name=\"action\"></slot>",
211
+ "</div>"
212
+ ].join(""), e.appendChild(t), e.appendChild(y("button", {
213
+ class: "l-notification-close",
214
+ part: "close",
215
+ type: "button",
216
+ "aria-label": "关闭",
217
+ innerHTML: "<l-close-icon></l-close-icon>"
218
+ })), e;
219
+ }
220
+ show() {
221
+ this._state.open = !0, this._toggleOpen();
222
+ }
223
+ close() {
224
+ this._state.open = !1, this._toggleOpen();
225
+ }
226
+ _initRefs() {
227
+ let e = this.root;
228
+ this.$icon = b(".l-notification-icon", e), this.$title = b(".l-notification-title", e), this.$titleText = b(".l-notification-title-text", e), this.$message = b(".l-notification-message", e), this.$messageText = b(".l-notification-message-text", e), this.$actionWrap = b(".l-notification-actions", e), this.$actionBtn = b(".l-notification-action", e), this.$actionSlot = b("slot[name=\"action\"]", e), this.$closeBtn = b(".l-notification-close", e);
229
+ }
230
+ _bindEvents() {
231
+ S(this, "mouseenter", this._handleMouseEnter), S(this, "mouseleave", this._handleMouseLeave), this.$closeBtn && S(this.$closeBtn, "click", this._handleCloseClick), this.$actionBtn && S(this.$actionBtn, "click", this._handleActionClick), this.root.querySelectorAll("slot").forEach((e) => {
232
+ S(e, "slotchange", this._handleSlotChange);
233
+ });
234
+ }
235
+ _unbindEvents() {
236
+ x(this, "mouseenter", this._handleMouseEnter), x(this, "mouseleave", this._handleMouseLeave), this.$closeBtn && x(this.$closeBtn, "click", this._handleCloseClick), this.$actionBtn && x(this.$actionBtn, "click", this._handleActionClick), this.root.querySelectorAll("slot").forEach((e) => {
237
+ x(e, "slotchange", this._handleSlotChange);
238
+ });
239
+ }
240
+ _syncAll() {
241
+ this._syncIcon(), this._syncSections(), this._syncActions(), this._syncClose(), this._syncWidth(), this._syncOffset(), this._syncCustomClass();
242
+ }
243
+ _syncIcon() {
244
+ let e = this.$icon;
245
+ if (!e) return;
246
+ let t = T[this._state.type] || T.info;
247
+ e.dataset.icon !== t && (e.dataset.icon = t, e.innerHTML = `<l-${t}-icon></l-${t}-icon>`), e.toggleAttribute("hidden", !this._state.showIcon);
248
+ }
249
+ _syncSections() {
250
+ this._syncSection(this.$title, this.$titleText, this._state.title, !0), this._syncSection(this.$message, this.$messageText, this._state.message, !1);
251
+ }
252
+ _syncSection(e, t, n = "", r = !1) {
253
+ if (!e || !t) return;
254
+ r ? t.textContent = n : t.innerHTML = n;
255
+ let i = e.querySelector("slot"), a = this._hasSlotContent(i), o = n !== "";
256
+ t.toggleAttribute("hidden", a || !o), e.toggleAttribute("hidden", !(a || o));
257
+ }
258
+ _syncActions() {
259
+ let e = this.$actionWrap, t = this.$actionBtn;
260
+ if (!e || !t) return;
261
+ let n = this._state.action;
262
+ t.textContent = n;
263
+ let r = this._hasSlotContent(this.$actionSlot);
264
+ t.toggleAttribute("hidden", r || n === ""), e.toggleAttribute("hidden", !(r || n !== ""));
265
+ }
266
+ _syncClose() {
267
+ this.$closeBtn && this.$closeBtn.toggleAttribute("hidden", !this._state.closable);
268
+ }
269
+ _syncWidth() {
270
+ this._state.width ? this.style.setProperty("--l-notification-width", this._state.width) : this.style.removeProperty("--l-notification-width");
271
+ }
272
+ _syncOffset() {
273
+ this.style.setProperty("--l-notification-offset", `${this._state.offset}px`), this.style.setProperty("--l-notification-zindex", `${this._state.zIndex}`), this._visible && h(this._state.placement);
274
+ }
275
+ _syncCustomClass() {
276
+ for (let e of this._appliedClasses) this.classList.remove(e);
277
+ this._appliedClasses = this._state.customClass ? this._state.customClass.split(/\s+/).filter(Boolean) : [];
278
+ for (let e of this._appliedClasses) this.classList.add(e);
279
+ }
280
+ _hasSlotContent(e) {
281
+ return e ? e.assignedNodes().some((e) => e.nodeType !== 3 || (e.textContent || "").trim() !== "") : !1;
282
+ }
283
+ _updatePlacement() {
284
+ this._visible && _(this, this._state.placement);
285
+ }
286
+ _toggleOpen() {
287
+ this.rendered && (this._state.open ? this._show() : this._hide());
288
+ }
289
+ _show() {
290
+ this._visible || (this._visible = !0, this.removeAttribute("hidden"), _(this, this._state.placement), this._observeSize(), this._enter(), this._startTimer(), this._enforceMaxCount());
291
+ }
292
+ _hide() {
293
+ this._visible && (this._visible = !1, this._clearTimer(), this._unobserveSize(), v(this), this.emit("close", { detail: { id: this.id } }), this._leave(() => {
294
+ this.removeOnClose ? this.remove() : this.setAttribute("hidden", "");
295
+ }));
296
+ }
297
+ _enforceMaxCount() {
298
+ let e = this._state.maxCount;
299
+ if (e <= 0) return;
300
+ let t = this._state.placement;
301
+ for (; p(t) > e;) {
302
+ let e = m(t);
303
+ if (!e || e === this) break;
304
+ e.close();
305
+ }
306
+ }
307
+ _enter() {
308
+ this.classList.add("l-notification-enter"), this.offsetHeight, this.classList.add("l-notification-enter-active"), this.classList.remove("l-notification-enter"), this._onceTransitionEnd("opacity", () => {
309
+ this.classList.remove("l-notification-enter-active");
310
+ });
311
+ }
312
+ _leave(e) {
313
+ this.classList.add("l-notification-leave-active"), this.offsetHeight, this.classList.add("l-notification-leave"), this._onceTransitionEnd("opacity", () => {
314
+ this.classList.remove("l-notification-leave-active"), this.classList.remove("l-notification-leave"), e();
315
+ });
316
+ }
317
+ _transitionDuration() {
318
+ let e = (getComputedStyle(this).transitionDuration || "").split(",")[0].trim(), t = parseFloat(e);
319
+ return t ? e.endsWith("ms") ? t : t * 1e3 : 300;
320
+ }
321
+ _onceTransitionEnd(e, t) {
322
+ this._cancelPendingAnimation();
323
+ let n = !1, r = 0, i = (t) => {
324
+ let n = t;
325
+ n.target === this && n.propertyName === e && a();
326
+ }, a = () => {
327
+ n || (n = !0, this.removeEventListener("transitionend", i), clearTimeout(r), this._cancelAnimation = void 0, t());
328
+ };
329
+ this._cancelAnimation = () => {
330
+ n = !0, this.removeEventListener("transitionend", i), clearTimeout(r), this._cancelAnimation = void 0;
331
+ }, this.addEventListener("transitionend", i), r = window.setTimeout(a, this._transitionDuration() + 100);
332
+ }
333
+ _cancelPendingAnimation() {
334
+ let e = this._cancelAnimation;
335
+ e && (this._cancelAnimation = void 0, e());
336
+ }
337
+ _observeSize() {
338
+ this._resizeObserver || typeof ResizeObserver > "u" || (this._resizeObserver = new ResizeObserver(() => {
339
+ this._visible && h(this._state.placement);
340
+ }), this._resizeObserver.observe(this));
341
+ }
342
+ _unobserveSize() {
343
+ this._resizeObserver &&= (this._resizeObserver.disconnect(), void 0);
344
+ }
345
+ _startTimer() {
346
+ this._clearTimer();
347
+ let e = this._state.duration;
348
+ e <= 0 || (this._remaining = e, this._startTime = Date.now(), this._timer = window.setTimeout(() => {
349
+ this._timer = void 0, this.close();
350
+ }, e));
351
+ }
352
+ _clearTimer() {
353
+ this._timer != null && (clearTimeout(this._timer), this._timer = void 0), this._remaining = 0;
354
+ }
355
+ _pauseTimer() {
356
+ this._timer != null && (clearTimeout(this._timer), this._timer = void 0, this._remaining = Math.max(0, this._remaining - (Date.now() - this._startTime)));
357
+ }
358
+ _resumeTimer() {
359
+ this._timer != null || this._remaining <= 0 || (this._startTime = Date.now(), this._timer = window.setTimeout(() => {
360
+ this._timer = void 0, this.close();
361
+ }, this._remaining));
362
+ }
363
+ _handleMouseEnter = () => {
364
+ this._pauseTimer();
365
+ };
366
+ _handleMouseLeave = () => {
367
+ this._resumeTimer();
368
+ };
369
+ _handleCloseClick = (e) => {
370
+ e.stopPropagation(), this.close();
371
+ };
372
+ _handleActionClick = () => {
373
+ this.emit("action", { detail: { id: this.id } });
374
+ };
375
+ _handleSlotChange = () => {
376
+ this._syncSections(), this._syncActions();
377
+ };
378
+ };
379
+ //#endregion
380
+ export { N as default };