@tarojs/components 3.6.0-canary.10 → 3.6.0-canary.12

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 (350) hide show
  1. package/dist/cjs/taro-swiper-core_2.cjs.entry.js +3 -5
  2. package/dist/cjs/taro-swiper-core_2.cjs.entry.js.map +1 -1
  3. package/dist/collection/components/swiper/swiper.js +3 -5
  4. package/dist/collection/components/swiper/swiper.js.map +1 -1
  5. package/dist/components/helper.js +15 -0
  6. package/dist/components/helper.js.map +1 -0
  7. package/dist/components/hls.js +27622 -0
  8. package/dist/components/hls.js.map +1 -0
  9. package/dist/components/index.d.ts +97 -0
  10. package/dist/components/index.js +79 -0
  11. package/dist/components/index.js.map +1 -0
  12. package/dist/components/index2.js +78 -0
  13. package/dist/components/index2.js.map +1 -0
  14. package/dist/components/index3.js +33 -0
  15. package/dist/components/index3.js.map +1 -0
  16. package/dist/components/intersection-observer.js +728 -0
  17. package/dist/components/intersection-observer.js.map +1 -0
  18. package/dist/components/picker-group.js +220 -0
  19. package/dist/components/picker-group.js.map +1 -0
  20. package/dist/components/taro-ad-core.d.ts +11 -0
  21. package/dist/components/taro-ad-core.js +35 -0
  22. package/dist/components/taro-ad-core.js.map +1 -0
  23. package/dist/components/taro-ad-custom-core.d.ts +11 -0
  24. package/dist/components/taro-ad-custom-core.js +35 -0
  25. package/dist/components/taro-ad-custom-core.js.map +1 -0
  26. package/dist/components/taro-animation-video-core.d.ts +11 -0
  27. package/dist/components/taro-animation-video-core.js +35 -0
  28. package/dist/components/taro-animation-video-core.js.map +1 -0
  29. package/dist/components/taro-animation-view-core.d.ts +11 -0
  30. package/dist/components/taro-animation-view-core.js +35 -0
  31. package/dist/components/taro-animation-view-core.js.map +1 -0
  32. package/dist/components/taro-ar-camera-core.d.ts +11 -0
  33. package/dist/components/taro-ar-camera-core.js +35 -0
  34. package/dist/components/taro-ar-camera-core.js.map +1 -0
  35. package/dist/components/taro-audio-core.d.ts +11 -0
  36. package/dist/components/taro-audio-core.js +80 -0
  37. package/dist/components/taro-audio-core.js.map +1 -0
  38. package/dist/components/taro-aweme-data-core.d.ts +11 -0
  39. package/dist/components/taro-aweme-data-core.js +35 -0
  40. package/dist/components/taro-aweme-data-core.js.map +1 -0
  41. package/dist/components/taro-block-core.d.ts +11 -0
  42. package/dist/components/taro-block-core.js +31 -0
  43. package/dist/components/taro-block-core.js.map +1 -0
  44. package/dist/components/taro-button-core.d.ts +11 -0
  45. package/dist/components/taro-button-core.js +102 -0
  46. package/dist/components/taro-button-core.js.map +1 -0
  47. package/dist/components/taro-camera-core.d.ts +11 -0
  48. package/dist/components/taro-camera-core.js +35 -0
  49. package/dist/components/taro-camera-core.js.map +1 -0
  50. package/dist/components/taro-canvas-core.d.ts +11 -0
  51. package/dist/components/taro-canvas-core.js +57 -0
  52. package/dist/components/taro-canvas-core.js.map +1 -0
  53. package/dist/components/taro-checkbox-core.d.ts +11 -0
  54. package/dist/components/taro-checkbox-core.js +81 -0
  55. package/dist/components/taro-checkbox-core.js.map +1 -0
  56. package/dist/components/taro-checkbox-group-core.d.ts +11 -0
  57. package/dist/components/taro-checkbox-group-core.js +71 -0
  58. package/dist/components/taro-checkbox-group-core.js.map +1 -0
  59. package/dist/components/taro-comment-detail-core.d.ts +11 -0
  60. package/dist/components/taro-comment-detail-core.js +35 -0
  61. package/dist/components/taro-comment-detail-core.js.map +1 -0
  62. package/dist/components/taro-comment-list-core.d.ts +11 -0
  63. package/dist/components/taro-comment-list-core.js +35 -0
  64. package/dist/components/taro-comment-list-core.js.map +1 -0
  65. package/dist/components/taro-contact-button-core.d.ts +11 -0
  66. package/dist/components/taro-contact-button-core.js +35 -0
  67. package/dist/components/taro-contact-button-core.js.map +1 -0
  68. package/dist/components/taro-cover-image-core.d.ts +11 -0
  69. package/dist/components/taro-cover-image-core.js +52 -0
  70. package/dist/components/taro-cover-image-core.js.map +1 -0
  71. package/dist/components/taro-cover-view-core.d.ts +11 -0
  72. package/dist/components/taro-cover-view-core.js +89 -0
  73. package/dist/components/taro-cover-view-core.js.map +1 -0
  74. package/dist/components/taro-custom-wrapper-core.d.ts +11 -0
  75. package/dist/components/taro-custom-wrapper-core.js +31 -0
  76. package/dist/components/taro-custom-wrapper-core.js.map +1 -0
  77. package/dist/components/taro-editor-core.d.ts +11 -0
  78. package/dist/components/taro-editor-core.js +35 -0
  79. package/dist/components/taro-editor-core.js.map +1 -0
  80. package/dist/components/taro-follow-swan-core.d.ts +11 -0
  81. package/dist/components/taro-follow-swan-core.js +35 -0
  82. package/dist/components/taro-follow-swan-core.js.map +1 -0
  83. package/dist/components/taro-form-core.d.ts +11 -0
  84. package/dist/components/taro-form-core.js +140 -0
  85. package/dist/components/taro-form-core.js.map +1 -0
  86. package/dist/components/taro-functional-page-navigator-core.d.ts +11 -0
  87. package/dist/components/taro-functional-page-navigator-core.js +35 -0
  88. package/dist/components/taro-functional-page-navigator-core.js.map +1 -0
  89. package/dist/components/taro-icon-core.d.ts +11 -0
  90. package/dist/components/taro-icon-core.js +48 -0
  91. package/dist/components/taro-icon-core.js.map +1 -0
  92. package/dist/components/taro-image-core.d.ts +11 -0
  93. package/dist/components/taro-image-core.js +81 -0
  94. package/dist/components/taro-image-core.js.map +1 -0
  95. package/dist/components/taro-inline-payment-panel-core.d.ts +11 -0
  96. package/dist/components/taro-inline-payment-panel-core.js +35 -0
  97. package/dist/components/taro-inline-payment-panel-core.js.map +1 -0
  98. package/dist/components/taro-input-core.d.ts +11 -0
  99. package/dist/components/taro-input-core.js +246 -0
  100. package/dist/components/taro-input-core.js.map +1 -0
  101. package/dist/components/taro-keyboard-accessory-core.d.ts +11 -0
  102. package/dist/components/taro-keyboard-accessory-core.js +35 -0
  103. package/dist/components/taro-keyboard-accessory-core.js.map +1 -0
  104. package/dist/components/taro-label-core.d.ts +11 -0
  105. package/dist/components/taro-label-core.js +34 -0
  106. package/dist/components/taro-label-core.js.map +1 -0
  107. package/dist/components/taro-lifestyle-core.d.ts +11 -0
  108. package/dist/components/taro-lifestyle-core.js +35 -0
  109. package/dist/components/taro-lifestyle-core.js.map +1 -0
  110. package/dist/components/taro-like-core.d.ts +11 -0
  111. package/dist/components/taro-like-core.js +35 -0
  112. package/dist/components/taro-like-core.js.map +1 -0
  113. package/dist/components/taro-live-player-core.d.ts +11 -0
  114. package/dist/components/taro-live-player-core.js +35 -0
  115. package/dist/components/taro-live-player-core.js.map +1 -0
  116. package/dist/components/taro-live-pusher-core.d.ts +11 -0
  117. package/dist/components/taro-live-pusher-core.js +35 -0
  118. package/dist/components/taro-live-pusher-core.js.map +1 -0
  119. package/dist/components/taro-login-core.d.ts +11 -0
  120. package/dist/components/taro-login-core.js +35 -0
  121. package/dist/components/taro-login-core.js.map +1 -0
  122. package/dist/components/taro-lottie-core.d.ts +11 -0
  123. package/dist/components/taro-lottie-core.js +35 -0
  124. package/dist/components/taro-lottie-core.js.map +1 -0
  125. package/dist/components/taro-map-core.d.ts +11 -0
  126. package/dist/components/taro-map-core.js +35 -0
  127. package/dist/components/taro-map-core.js.map +1 -0
  128. package/dist/components/taro-match-media-core.d.ts +11 -0
  129. package/dist/components/taro-match-media-core.js +35 -0
  130. package/dist/components/taro-match-media-core.js.map +1 -0
  131. package/dist/components/taro-movable-area-core.d.ts +11 -0
  132. package/dist/components/taro-movable-area-core.js +175 -0
  133. package/dist/components/taro-movable-area-core.js.map +1 -0
  134. package/dist/components/taro-movable-view-core.d.ts +11 -0
  135. package/dist/components/taro-movable-view-core.js +361 -0
  136. package/dist/components/taro-movable-view-core.js.map +1 -0
  137. package/dist/components/taro-native-slot-core.d.ts +11 -0
  138. package/dist/components/taro-native-slot-core.js +35 -0
  139. package/dist/components/taro-native-slot-core.js.map +1 -0
  140. package/dist/components/taro-navigation-bar-core.d.ts +11 -0
  141. package/dist/components/taro-navigation-bar-core.js +35 -0
  142. package/dist/components/taro-navigation-bar-core.js.map +1 -0
  143. package/dist/components/taro-navigator-core.d.ts +11 -0
  144. package/dist/components/taro-navigator-core.js +96 -0
  145. package/dist/components/taro-navigator-core.js.map +1 -0
  146. package/dist/components/taro-official-account-core.d.ts +11 -0
  147. package/dist/components/taro-official-account-core.js +35 -0
  148. package/dist/components/taro-official-account-core.js.map +1 -0
  149. package/dist/components/taro-open-data-core.d.ts +11 -0
  150. package/dist/components/taro-open-data-core.js +35 -0
  151. package/dist/components/taro-open-data-core.js.map +1 -0
  152. package/dist/components/taro-page-container-core.d.ts +11 -0
  153. package/dist/components/taro-page-container-core.js +35 -0
  154. package/dist/components/taro-page-container-core.js.map +1 -0
  155. package/dist/components/taro-page-meta-core.d.ts +11 -0
  156. package/dist/components/taro-page-meta-core.js +35 -0
  157. package/dist/components/taro-page-meta-core.js.map +1 -0
  158. package/dist/components/taro-picker-core.d.ts +11 -0
  159. package/dist/components/taro-picker-core.js +538 -0
  160. package/dist/components/taro-picker-core.js.map +1 -0
  161. package/dist/components/taro-picker-group.d.ts +11 -0
  162. package/dist/components/taro-picker-group.js +8 -0
  163. package/dist/components/taro-picker-group.js.map +1 -0
  164. package/dist/components/taro-picker-view-column-core.d.ts +11 -0
  165. package/dist/components/taro-picker-view-column-core.js +115 -0
  166. package/dist/components/taro-picker-view-column-core.js.map +1 -0
  167. package/dist/components/taro-picker-view-core.d.ts +11 -0
  168. package/dist/components/taro-picker-view-core.js +114 -0
  169. package/dist/components/taro-picker-view-core.js.map +1 -0
  170. package/dist/components/taro-progress-core.d.ts +11 -0
  171. package/dist/components/taro-progress-core.js +62 -0
  172. package/dist/components/taro-progress-core.js.map +1 -0
  173. package/dist/components/taro-pull-to-refresh.d.ts +11 -0
  174. package/dist/components/taro-pull-to-refresh.js +284 -0
  175. package/dist/components/taro-pull-to-refresh.js.map +1 -0
  176. package/dist/components/taro-radio-core.d.ts +11 -0
  177. package/dist/components/taro-radio-core.js +83 -0
  178. package/dist/components/taro-radio-core.js.map +1 -0
  179. package/dist/components/taro-radio-group-core.d.ts +11 -0
  180. package/dist/components/taro-radio-group-core.js +82 -0
  181. package/dist/components/taro-radio-group-core.js.map +1 -0
  182. package/dist/components/taro-rich-text-core.d.ts +11 -0
  183. package/dist/components/taro-rich-text-core.js +86 -0
  184. package/dist/components/taro-rich-text-core.js.map +1 -0
  185. package/dist/components/taro-root-portal-core.d.ts +11 -0
  186. package/dist/components/taro-root-portal-core.js +35 -0
  187. package/dist/components/taro-root-portal-core.js.map +1 -0
  188. package/dist/components/taro-rtc-room-core.d.ts +11 -0
  189. package/dist/components/taro-rtc-room-core.js +35 -0
  190. package/dist/components/taro-rtc-room-core.js.map +1 -0
  191. package/dist/components/taro-rtc-room-item-core.d.ts +11 -0
  192. package/dist/components/taro-rtc-room-item-core.js +35 -0
  193. package/dist/components/taro-rtc-room-item-core.js.map +1 -0
  194. package/dist/components/taro-scroll-view-core.d.ts +11 -0
  195. package/dist/components/taro-scroll-view-core.js +184 -0
  196. package/dist/components/taro-scroll-view-core.js.map +1 -0
  197. package/dist/components/taro-share-element-core.d.ts +11 -0
  198. package/dist/components/taro-share-element-core.js +35 -0
  199. package/dist/components/taro-share-element-core.js.map +1 -0
  200. package/dist/components/taro-slider-core.d.ts +11 -0
  201. package/dist/components/taro-slider-core.js +196 -0
  202. package/dist/components/taro-slider-core.js.map +1 -0
  203. package/dist/components/taro-slot-core.d.ts +11 -0
  204. package/dist/components/taro-slot-core.js +35 -0
  205. package/dist/components/taro-slot-core.js.map +1 -0
  206. package/dist/components/taro-swiper-core.d.ts +11 -0
  207. package/dist/components/taro-swiper-core.js +10165 -0
  208. package/dist/components/taro-swiper-core.js.map +1 -0
  209. package/dist/components/taro-swiper-item-core.d.ts +11 -0
  210. package/dist/components/taro-swiper-item-core.js +34 -0
  211. package/dist/components/taro-swiper-item-core.js.map +1 -0
  212. package/dist/components/taro-switch-core.d.ts +11 -0
  213. package/dist/components/taro-switch-core.js +87 -0
  214. package/dist/components/taro-switch-core.js.map +1 -0
  215. package/dist/components/taro-tab-item-core.d.ts +11 -0
  216. package/dist/components/taro-tab-item-core.js +35 -0
  217. package/dist/components/taro-tab-item-core.js.map +1 -0
  218. package/dist/components/taro-tabbar.d.ts +11 -0
  219. package/dist/components/taro-tabbar.js +457 -0
  220. package/dist/components/taro-tabbar.js.map +1 -0
  221. package/dist/components/taro-tabs-core.d.ts +11 -0
  222. package/dist/components/taro-tabs-core.js +35 -0
  223. package/dist/components/taro-tabs-core.js.map +1 -0
  224. package/dist/components/taro-text-core.d.ts +11 -0
  225. package/dist/components/taro-text-core.js +41 -0
  226. package/dist/components/taro-text-core.js.map +1 -0
  227. package/dist/components/taro-textarea-core.d.ts +11 -0
  228. package/dist/components/taro-textarea-core.js +164 -0
  229. package/dist/components/taro-textarea-core.js.map +1 -0
  230. package/dist/components/taro-video-control.d.ts +11 -0
  231. package/dist/components/taro-video-control.js +8 -0
  232. package/dist/components/taro-video-control.js.map +1 -0
  233. package/dist/components/taro-video-core.d.ts +11 -0
  234. package/dist/components/taro-video-core.js +485 -0
  235. package/dist/components/taro-video-core.js.map +1 -0
  236. package/dist/components/taro-video-danmu.d.ts +11 -0
  237. package/dist/components/taro-video-danmu.js +8 -0
  238. package/dist/components/taro-video-danmu.js.map +1 -0
  239. package/dist/components/taro-view-core.d.ts +11 -0
  240. package/dist/components/taro-view-core.js +101 -0
  241. package/dist/components/taro-view-core.js.map +1 -0
  242. package/dist/components/taro-voip-room-core.d.ts +11 -0
  243. package/dist/components/taro-voip-room-core.js +35 -0
  244. package/dist/components/taro-voip-room-core.js.map +1 -0
  245. package/dist/components/taro-web-view-core.d.ts +11 -0
  246. package/dist/components/taro-web-view-core.js +46 -0
  247. package/dist/components/taro-web-view-core.js.map +1 -0
  248. package/dist/components/video-control.js +233 -0
  249. package/dist/components/video-control.js.map +1 -0
  250. package/dist/components/video-danmu.js +110 -0
  251. package/dist/components/video-danmu.js.map +1 -0
  252. package/dist/esm/taro-swiper-core_2.entry.js +3 -5
  253. package/dist/esm/taro-swiper-core_2.entry.js.map +1 -1
  254. package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
  255. package/dist/esm-es5/taro-swiper-core_2.entry.js.map +1 -1
  256. package/dist/taro-components/{p-d388c097.entry.js → p-22315b9d.entry.js} +2 -2
  257. package/dist/taro-components/p-22315b9d.entry.js.map +1 -0
  258. package/dist/taro-components/{p-6831f7b1.system.entry.js → p-c3c37cbb.system.entry.js} +2 -2
  259. package/dist/taro-components/p-c3c37cbb.system.entry.js.map +1 -0
  260. package/dist/taro-components/p-cb17d8bd.system.js +1 -1
  261. package/dist/taro-components/taro-components.esm.js +1 -1
  262. package/lib/react/components.d.ts +82 -0
  263. package/lib/react/components.js +85 -0
  264. package/lib/react/components.js.map +1 -0
  265. package/lib/react/helper.d.ts +10 -0
  266. package/lib/react/helper.js +7 -0
  267. package/lib/react/helper.js.map +1 -0
  268. package/lib/react/index.d.ts +1 -0
  269. package/lib/react/index.js +2 -0
  270. package/lib/react/index.js.map +1 -0
  271. package/lib/react/interfaces-4f837811.d.ts +30 -0
  272. package/lib/react/react-component-lib/createComponent.d.ts +10 -0
  273. package/lib/react/react-component-lib/createComponent.js +70 -0
  274. package/lib/react/react-component-lib/createComponent.js.map +1 -0
  275. package/lib/react/react-component-lib/createOverlayComponent.d.ts +21 -0
  276. package/lib/react/react-component-lib/createOverlayComponent.js +91 -0
  277. package/lib/react/react-component-lib/createOverlayComponent.js.map +1 -0
  278. package/lib/react/react-component-lib/index.d.ts +2 -0
  279. package/lib/react/react-component-lib/index.js +3 -0
  280. package/lib/react/react-component-lib/index.js.map +1 -0
  281. package/lib/react/react-component-lib/utils/attachProps.d.ts +13 -0
  282. package/lib/react/react-component-lib/utils/attachProps.js +101 -0
  283. package/lib/react/react-component-lib/utils/attachProps.js.map +1 -0
  284. package/lib/react/react-component-lib/utils/case.d.ts +3 -0
  285. package/lib/react/react-component-lib/utils/case.js +9 -0
  286. package/lib/react/react-component-lib/utils/case.js.map +1 -0
  287. package/lib/react/react-component-lib/utils/index.d.ts +11 -0
  288. package/lib/react/react-component-lib/utils/index.js +37 -0
  289. package/lib/react/react-component-lib/utils/index.js.map +1 -0
  290. package/lib/vue2/components.d.ts +352 -0
  291. package/lib/vue2/components.js +620 -0
  292. package/lib/vue2/components.js.map +1 -0
  293. package/lib/vue2/index.d.ts +3 -0
  294. package/lib/vue2/index.js +21 -0
  295. package/lib/vue2/index.js.map +1 -0
  296. package/lib/vue2/vue-component-lib/utils.d.ts +6 -0
  297. package/lib/vue2/vue-component-lib/utils.js +32 -0
  298. package/lib/vue2/vue-component-lib/utils.js.map +1 -0
  299. package/lib/vue3/components.d.ts +82 -0
  300. package/lib/vue3/components.js +386 -0
  301. package/lib/vue3/components.js.map +1 -0
  302. package/lib/vue3/index.d.ts +3 -0
  303. package/lib/vue3/index.js +15 -0
  304. package/lib/vue3/index.js.map +1 -0
  305. package/lib/vue3/vue-component-lib/utils.d.ts +21 -0
  306. package/lib/vue3/vue-component-lib/utils.js +163 -0
  307. package/lib/vue3/vue-component-lib/utils.js.map +1 -0
  308. package/package.json +9 -7
  309. package/types/index.vue3.d.ts +4 -4
  310. package/dist/react/component-lib/index.js +0 -74
  311. package/dist/react/component-lib/input.js +0 -17
  312. package/dist/react/component-lib/reactify-wc.js +0 -206
  313. package/dist/react/components.js +0 -82
  314. package/dist/react/helper.js +0 -8
  315. package/dist/react/index.js +0 -1
  316. package/dist/react/react-component-lib/createComponent.js +0 -99
  317. package/dist/react/react-component-lib/createOverlayComponent.js +0 -178
  318. package/dist/react/react-component-lib/index.js +0 -2
  319. package/dist/react/react-component-lib/interfaces.js +0 -0
  320. package/dist/react/react-component-lib/utils/attachProps.js +0 -98
  321. package/dist/react/react-component-lib/utils/case.js +0 -10
  322. package/dist/react/react-component-lib/utils/dev.js +0 -12
  323. package/dist/react/react-component-lib/utils/index.js +0 -37
  324. package/dist/taro-components/p-6831f7b1.system.entry.js.map +0 -1
  325. package/dist/taro-components/p-d388c097.entry.js.map +0 -1
  326. package/dist/vue2/component-lib/components.js +0 -71
  327. package/dist/vue2/component-lib/createComponent.js +0 -21
  328. package/dist/vue2/component-lib/createFormsComponent.js +0 -53
  329. package/dist/vue2/component-lib/icon.js +0 -19
  330. package/dist/vue2/component-lib/image.js +0 -20
  331. package/dist/vue2/component-lib/index.js +0 -28
  332. package/dist/vue2/component-lib/mixins/listeners.js +0 -14
  333. package/dist/vue2/component-lib/mixins/refs.js +0 -44
  334. package/dist/vue2/component-lib/picker.js +0 -40
  335. package/dist/vue2/component-lib/scroll-view.js +0 -32
  336. package/dist/vue2/component-lib/text.js +0 -20
  337. package/dist/vue2/components.js +0 -542
  338. package/dist/vue2/index.js +0 -22
  339. package/dist/vue2/vue-component-lib/utils.js +0 -40
  340. package/dist/vue3/component-lib/createComponent.js +0 -23
  341. package/dist/vue3/component-lib/createFormsComponent.js +0 -43
  342. package/dist/vue3/component-lib/forwardRef.js +0 -9
  343. package/dist/vue3/component-lib/icon.js +0 -21
  344. package/dist/vue3/component-lib/image.js +0 -22
  345. package/dist/vue3/component-lib/index.js +0 -76
  346. package/dist/vue3/component-lib/scroll-view.js +0 -28
  347. package/dist/vue3/component-lib/text.js +0 -22
  348. package/dist/vue3/components.js +0 -80
  349. package/dist/vue3/index.js +0 -17
  350. package/dist/vue3/vue-component-lib/utils.js +0 -175
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface TaroSwiperItemCore extends Components.TaroSwiperItemCore, HTMLElement {}
4
+ export const TaroSwiperItemCore: {
5
+ prototype: TaroSwiperItemCore;
6
+ new (): TaroSwiperItemCore;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,34 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const SwiperItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.__registerHost();
7
+ this.itemId = undefined;
8
+ }
9
+ render() {
10
+ return (h(Host, { class: 'swiper-slide', "item-id": this.itemId }));
11
+ }
12
+ }, [0, "taro-swiper-item-core", {
13
+ "itemId": [1, "item-id"]
14
+ }]);
15
+ function defineCustomElement$1() {
16
+ if (typeof customElements === "undefined") {
17
+ return;
18
+ }
19
+ const components = ["taro-swiper-item-core"];
20
+ components.forEach(tagName => { switch (tagName) {
21
+ case "taro-swiper-item-core":
22
+ if (!customElements.get(tagName)) {
23
+ customElements.define(tagName, SwiperItem);
24
+ }
25
+ break;
26
+ } });
27
+ }
28
+
29
+ const TaroSwiperItemCore = SwiperItem;
30
+ const defineCustomElement = defineCustomElement$1;
31
+
32
+ export { TaroSwiperItemCore, defineCustomElement };
33
+
34
+ //# sourceMappingURL=taro-swiper-item-core.js.map
@@ -0,0 +1 @@
1
+ {"file":"taro-swiper-item-core.js","mappings":";;MAKa,UAAU;;;;;;EAGrB,MAAM;IACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAC,cAAc,aAAU,IAAI,CAAC,MAAM,GAAG,EACnD;GACF;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/swiper/swiper-item.tsx"],"sourcesContent":["import { Component, h, ComponentInterface, Prop, Host } from '@stencil/core'\n\n@Component({\n tag: 'taro-swiper-item-core'\n})\nexport class SwiperItem implements ComponentInterface {\n @Prop() itemId: string\n\n render () {\n return (\n <Host class='swiper-slide' item-id={this.itemId}/>\n )\n }\n}\n"],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface TaroSwitchCore extends Components.TaroSwitchCore, HTMLElement {}
4
+ export const TaroSwitchCore: {
5
+ prototype: TaroSwitchCore;
6
+ new (): TaroSwitchCore;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,87 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+
3
+ const indexCss = "taro-switch-core{display:inline-block;width:52px;height:32px}taro-switch-core .weui-switch{display:block;width:100%;height:100%}";
4
+
5
+ const Switch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.onChange = createEvent(this, "change", 7);
10
+ this.switchChange = e => {
11
+ e.stopPropagation();
12
+ const value = e.target.checked;
13
+ this.isChecked = value;
14
+ this.onChange.emit({
15
+ value
16
+ });
17
+ };
18
+ this.type = 'switch';
19
+ this.checked = false;
20
+ this.color = '#04BE02';
21
+ this.name = undefined;
22
+ this.disabled = false;
23
+ this.nativeProps = {};
24
+ this.isChecked = undefined;
25
+ this.isWillLoadCalled = false;
26
+ }
27
+ function(newVal, oldVal) {
28
+ if (!this.isWillLoadCalled)
29
+ return;
30
+ if (newVal !== oldVal)
31
+ this.isChecked = newVal;
32
+ }
33
+ componentWillLoad() {
34
+ this.isWillLoadCalled = true;
35
+ this.isChecked = this.checked;
36
+ }
37
+ componentDidLoad() {
38
+ Object.defineProperty(this.el, 'value', {
39
+ get: () => this.isChecked,
40
+ configurable: true
41
+ });
42
+ }
43
+ render() {
44
+ const { type, color, isChecked, name, disabled, nativeProps } = this;
45
+ const style = isChecked
46
+ ? {
47
+ borderColor: color || '04BE02',
48
+ backgroundColor: color || '04BE02'
49
+ }
50
+ : {};
51
+ return (h("input", Object.assign({ type: 'checkbox', class: `weui-${type}`, style: style, checked: isChecked, name: name, disabled: disabled, onChange: this.switchChange }, nativeProps)));
52
+ }
53
+ get el() { return this; }
54
+ static get watchers() { return {
55
+ "checked": ["function"]
56
+ }; }
57
+ static get style() { return indexCss; }
58
+ }, [0, "taro-switch-core", {
59
+ "type": [1],
60
+ "checked": [4],
61
+ "color": [1],
62
+ "name": [1],
63
+ "disabled": [4],
64
+ "nativeProps": [16],
65
+ "isChecked": [32],
66
+ "isWillLoadCalled": [32]
67
+ }]);
68
+ function defineCustomElement$1() {
69
+ if (typeof customElements === "undefined") {
70
+ return;
71
+ }
72
+ const components = ["taro-switch-core"];
73
+ components.forEach(tagName => { switch (tagName) {
74
+ case "taro-switch-core":
75
+ if (!customElements.get(tagName)) {
76
+ customElements.define(tagName, Switch);
77
+ }
78
+ break;
79
+ } });
80
+ }
81
+
82
+ const TaroSwitchCore = Switch;
83
+ const defineCustomElement = defineCustomElement$1;
84
+
85
+ export { TaroSwitchCore, defineCustomElement };
86
+
87
+ //# sourceMappingURL=taro-switch-core.js.map
@@ -0,0 +1 @@
1
+ {"file":"taro-switch-core.js","mappings":";;AAAA,MAAM,QAAQ,GAAG,kIAAkI;;MCMtI,MAAM;;;;;IAoCjB,iBAAY,GAAG,CAAC;MACd,CAAC,CAAC,eAAe,EAAE,CAAA;MACnB,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAA;MAC9B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;MACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACjB,KAAK;OACN,CAAC,CAAA;KACH,CAAA;gBA1Cc,QAAQ;mBACL,KAAK;iBACP,SAAS;;oBAEN,KAAK;uBACF,EAAE;;4BAGI,KAAK;;EAKjC,QAAQ,CAAE,MAAe,EAAE,MAAe;IACxC,IAAI,CAAC,IAAI,CAAC,gBAAgB;MAAE,OAAM;IAClC,IAAI,MAAM,KAAK,MAAM;MAAE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAA;GAC/C;EAOD,iBAAiB;IACf,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAA;IAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAA;GAC9B;EAED,gBAAgB;IACd,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE;MACtC,GAAG,EAAE,MAAM,IAAI,CAAC,SAAS;MACzB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAA;GACH;EAWD,MAAM;IACJ,MAAM,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,WAAW,EACZ,GAAG,IAAI,CAAA;IAER,MAAM,KAAK,GAAG,SAAS;QACnB;QACA,WAAW,EAAE,KAAK,IAAI,QAAQ;QAC9B,eAAe,EAAE,KAAK,IAAI,QAAQ;OACnC;QACC,EAAE,CAAA;IAEN,QACE,2BACE,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,QAAQ,IAAI,EAAE,EACrB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,SAAS,EAClB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,IAAI,CAAC,YAAY,IACvB,WAAW,EACf,EACH;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/switch/style/index.scss?tag=taro-switch-core","./src/components/switch/switch.tsx"],"sourcesContent":["taro-switch-core {\n display: inline-block;\n width: 52px;\n height: 32px;\n\n .weui-switch {\n display: block;\n width: 100%;\n height: 100%;\n }\n}\n","import { Component, h, ComponentInterface, Prop, State, Event, EventEmitter, Watch, Element } from '@stencil/core'\n\n@Component({\n tag: 'taro-switch-core',\n styleUrl: './style/index.scss'\n})\nexport class Switch implements ComponentInterface {\n @Prop() type = 'switch'\n @Prop() checked = false\n @Prop() color = '#04BE02'\n @Prop() name: string\n @Prop() disabled = false\n @Prop() nativeProps = {}\n\n @State() isChecked: boolean\n @State() isWillLoadCalled = false\n\n @Element() el: HTMLElement\n\n @Watch('checked')\n function (newVal: boolean, oldVal: boolean) {\n if (!this.isWillLoadCalled) return\n if (newVal !== oldVal) this.isChecked = newVal\n }\n\n @Event({\n eventName: 'change'\n })\n onChange: EventEmitter\n\n componentWillLoad () {\n this.isWillLoadCalled = true\n this.isChecked = this.checked\n }\n\n componentDidLoad () {\n Object.defineProperty(this.el, 'value', {\n get: () => this.isChecked,\n configurable: true\n })\n }\n\n switchChange = e => {\n e.stopPropagation()\n const value = e.target.checked\n this.isChecked = value\n this.onChange.emit({\n value\n })\n }\n\n render () {\n const {\n type,\n color,\n isChecked,\n name,\n disabled,\n nativeProps\n } = this\n\n const style = isChecked\n ? {\n borderColor: color || '04BE02',\n backgroundColor: color || '04BE02'\n }\n : {}\n\n return (\n <input\n type='checkbox'\n class={`weui-${type}`}\n style={style}\n checked={isChecked}\n name={name}\n disabled={disabled}\n onChange={this.switchChange}\n {...nativeProps}\n />\n )\n }\n}\n"],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface TaroTabItemCore extends Components.TaroTabItemCore, HTMLElement {}
4
+ export const TaroTabItemCore: {
5
+ prototype: TaroTabItemCore;
6
+ new (): TaroTabItemCore;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,35 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { n as notSupport } from './helper.js';
3
+
4
+ const TabItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ this.__registerHost();
8
+ }
9
+ componentDidLoad() {
10
+ notSupport('TabItem', this);
11
+ }
12
+ render() {
13
+ return (h(Host, null));
14
+ }
15
+ }, [0, "taro-tab-item-core"]);
16
+ function defineCustomElement$1() {
17
+ if (typeof customElements === "undefined") {
18
+ return;
19
+ }
20
+ const components = ["taro-tab-item-core"];
21
+ components.forEach(tagName => { switch (tagName) {
22
+ case "taro-tab-item-core":
23
+ if (!customElements.get(tagName)) {
24
+ customElements.define(tagName, TabItem);
25
+ }
26
+ break;
27
+ } });
28
+ }
29
+
30
+ const TaroTabItemCore = TabItem;
31
+ const defineCustomElement = defineCustomElement$1;
32
+
33
+ export { TaroTabItemCore, defineCustomElement };
34
+
35
+ //# sourceMappingURL=taro-tab-item-core.js.map
@@ -0,0 +1 @@
1
+ {"file":"taro-tab-item-core.js","mappings":";;;MAOa,OAAO;;;;;EAClB,gBAAgB;IACd,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;GAC5B;EAED,MAAM;IACJ,QACE,EAAC,IAAI,OAAG,EACT;GACF;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/tabs/tab-item.tsx"],"sourcesContent":["import { Component, ComponentInterface, h, Host } from '@stencil/core'\n\nimport { notSupport } from '../../utils'\n\n@Component({\n tag: 'taro-tab-item-core'\n})\nexport class TabItem implements ComponentInterface {\n componentDidLoad () {\n notSupport('TabItem', this)\n }\n\n render () {\n return (\n <Host />\n )\n }\n}\n"],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface TaroTabbar extends Components.TaroTabbar, HTMLElement {}
4
+ export const TaroTabbar: {
5
+ prototype: TaroTabbar;
6
+ new (): TaroTabbar;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,457 @@
1
+ import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
2
+ import Taro from '@tarojs/taro';
3
+ import { c as classnames } from './index2.js';
4
+
5
+ const splitUrl = _url => {
6
+ let url = _url || '';
7
+ let pos;
8
+ const res = {
9
+ path: null,
10
+ query: null,
11
+ fragment: null
12
+ };
13
+ pos = url.indexOf('#');
14
+ if (pos > -1) {
15
+ res.fragment = url.substring(pos + 1);
16
+ url = url.substring(0, pos);
17
+ }
18
+ pos = url.indexOf('?');
19
+ if (pos > -1) {
20
+ res.query = url.substring(pos + 1);
21
+ url = url.substring(0, pos);
22
+ }
23
+ res.path = url;
24
+ return res;
25
+ };
26
+
27
+ // export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
28
+ // export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
29
+ const addLeadingSlash = (url = '') => (url.charAt(0) === '/' ? url : '/' + url);
30
+ const hasBasename = (path = '', prefix = '') => new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path) || path === prefix;
31
+ const stripBasename = (path = '', prefix = '') => hasBasename(path, prefix) ? path.substring(prefix.length) : path;
32
+ const stripSuffix = (path = '', suffix = '') => path.includes(suffix) ? path.substring(0, path.length - suffix.length) : path;
33
+
34
+ function isAbsolute(pathname) {
35
+ return pathname.charAt(0) === '/';
36
+ }
37
+
38
+ // About 1.5x faster than the two-arg version of Array#splice()
39
+ function spliceOne(list, index) {
40
+ for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
41
+ list[i] = list[k];
42
+ }
43
+
44
+ list.pop();
45
+ }
46
+
47
+ // This implementation is based heavily on node's url.parse
48
+ function resolvePathname(to, from) {
49
+ if (from === undefined) from = '';
50
+
51
+ var toParts = (to && to.split('/')) || [];
52
+ var fromParts = (from && from.split('/')) || [];
53
+
54
+ var isToAbs = to && isAbsolute(to);
55
+ var isFromAbs = from && isAbsolute(from);
56
+ var mustEndAbs = isToAbs || isFromAbs;
57
+
58
+ if (to && isAbsolute(to)) {
59
+ // to is absolute
60
+ fromParts = toParts;
61
+ } else if (toParts.length) {
62
+ // to is relative, drop the filename
63
+ fromParts.pop();
64
+ fromParts = fromParts.concat(toParts);
65
+ }
66
+
67
+ if (!fromParts.length) return '/';
68
+
69
+ var hasTrailingSlash;
70
+ if (fromParts.length) {
71
+ var last = fromParts[fromParts.length - 1];
72
+ hasTrailingSlash = last === '.' || last === '..' || last === '';
73
+ } else {
74
+ hasTrailingSlash = false;
75
+ }
76
+
77
+ var up = 0;
78
+ for (var i = fromParts.length; i >= 0; i--) {
79
+ var part = fromParts[i];
80
+
81
+ if (part === '.') {
82
+ spliceOne(fromParts, i);
83
+ } else if (part === '..') {
84
+ spliceOne(fromParts, i);
85
+ up++;
86
+ } else if (up) {
87
+ spliceOne(fromParts, i);
88
+ up--;
89
+ }
90
+ }
91
+
92
+ if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
93
+
94
+ if (
95
+ mustEndAbs &&
96
+ fromParts[0] !== '' &&
97
+ (!fromParts[0] || !isAbsolute(fromParts[0]))
98
+ )
99
+ fromParts.unshift('');
100
+
101
+ var result = fromParts.join('/');
102
+
103
+ if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
104
+
105
+ return result;
106
+ }
107
+
108
+ const TabbarItem = ({ index, isSelected = false, textColor, iconPath, badgeText, showRedDot = false, text, onSelect }) => {
109
+ const className = classnames('weui-tabbar__item', {
110
+ 'weui-bar__item_on': isSelected
111
+ });
112
+ const badgeStyle = {
113
+ position: 'absolute',
114
+ top: '-2px',
115
+ right: '-13px'
116
+ };
117
+ const dotStyle = {
118
+ position: 'absolute',
119
+ top: '0',
120
+ right: '-6px'
121
+ };
122
+ function onClick() {
123
+ onSelect(index);
124
+ }
125
+ return (h("a", { key: index, href: 'javascript:;', class: className, onClick: onClick },
126
+ h("span", { style: { display: 'inline-block', position: 'relative' } },
127
+ h("img", { src: iconPath, alt: '', class: 'weui-tabbar__icon' }),
128
+ !!badgeText && (h("span", { class: 'weui-badge taro-tabbar-badge', style: badgeStyle }, badgeText)),
129
+ showRedDot && (h("span", { class: 'weui-badge weui-badge_dot', style: dotStyle }))),
130
+ h("p", { class: 'weui-tabbar__label', style: { color: textColor } }, text)));
131
+ };
132
+
133
+ const indexCss = "html,body{height:100%}#app{height:100%}.taro-tabbar__border-white::before{border-top-color:#fff !important}.taro-tabbar__container{display:-ms-flexbox;display:flex;overflow:hidden;-ms-flex-direction:column;flex-direction:column;height:100%}.taro-tabbar__panel{overflow:auto;position:relative;-ms-flex:1;flex:1;-webkit-overflow-scrolling:auto}.taro-tabbar__tabbar{position:relative;width:100%;height:50px;-webkit-transition:bottom 0.2s, top 0.2s;transition:bottom 0.2s, top 0.2s}.taro-tabbar__tabbar-top{top:0}.taro-tabbar__tabbar-bottom{bottom:0;margin-bottom:constant(safe-area-inset-bottom);margin-bottom:env(safe-area-inset-bottom)}.taro-tabbar__tabbar-hide{display:none}.taro-tabbar__tabbar-slideout{top:-52px;-ms-flex:0 0;flex:0 0}.taro-tabbar__panel+.taro-tabbar__tabbar-slideout{top:auto;bottom:-52px}";
134
+
135
+ const STATUS_SHOW = 0;
136
+ const STATUS_HIDE = 1;
137
+ const STATUS_SLIDEOUT = 2;
138
+ const basicTabBarClassName = 'taro-tabbar__tabbar';
139
+ const hideTabBarClassName = 'taro-tabbar__tabbar-hide';
140
+ const hideTabBarWithAnimationClassName = 'taro-tabbar__tabbar-slideout';
141
+ const Tabbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
142
+ constructor() {
143
+ super();
144
+ this.__registerHost();
145
+ this.onLongPress = createEvent(this, "longpress", 7);
146
+ this.homePage = '';
147
+ this.customRoutes = [];
148
+ this.tabbarPos = 'bottom';
149
+ this.getOriginUrl = (url) => {
150
+ const customRoute = this.customRoutes.filter(([, customUrl]) => {
151
+ const pathA = splitUrl(customUrl).path;
152
+ const pathB = splitUrl(url).path;
153
+ return pathA === pathB;
154
+ });
155
+ return stripSuffix(customRoute.length ? customRoute[0][0] : url, '.html');
156
+ };
157
+ this.getSelectedIndex = (url) => {
158
+ let foundIndex = -1;
159
+ this.list.forEach(({ pagePath }, idx) => {
160
+ const pathA = splitUrl(url).path;
161
+ const pathB = splitUrl(pagePath).path;
162
+ if (pathA === pathB) {
163
+ foundIndex = idx;
164
+ }
165
+ });
166
+ return foundIndex;
167
+ };
168
+ this.switchTab = (index) => {
169
+ this.selectedIndex = index;
170
+ Taro.switchTab({
171
+ url: this.list[index].pagePath
172
+ });
173
+ };
174
+ this.switchTabHandler = ({ url, successHandler, errorHandler }) => {
175
+ const currentUrl = this.getOriginUrl(this.getCurrentUrl() || this.homePage);
176
+ const nextTab = resolvePathname(url, currentUrl);
177
+ const foundIndex = this.getSelectedIndex(nextTab);
178
+ if (foundIndex > -1) {
179
+ this.switchTab(foundIndex);
180
+ successHandler({
181
+ errMsg: 'switchTab:ok'
182
+ });
183
+ }
184
+ else {
185
+ errorHandler({
186
+ errMsg: `switchTab:fail page "${nextTab}" is not found`
187
+ });
188
+ }
189
+ };
190
+ this.routerChangeHandler = (options) => {
191
+ var _a;
192
+ const to = (_a = options === null || options === void 0 ? void 0 : options.toLocation) === null || _a === void 0 ? void 0 : _a.path;
193
+ let currentPage;
194
+ if (typeof to === 'string') {
195
+ const routerBasename = this.conf.basename || '/';
196
+ currentPage = stripBasename(addLeadingSlash(to || this.homePage), routerBasename) || '/';
197
+ }
198
+ else {
199
+ currentPage = this.getCurrentUrl();
200
+ }
201
+ this.selectedIndex = this.getSelectedIndex(this.getOriginUrl(currentPage));
202
+ };
203
+ this.setTabBarBadgeHandler = ({ index, text, successHandler, errorHandler }) => {
204
+ const list = [...this.list];
205
+ if (index in list) {
206
+ list[index].showRedDot = false;
207
+ list[index].badgeText = text;
208
+ successHandler({
209
+ errMsg: 'setTabBarBadge:ok'
210
+ });
211
+ }
212
+ else {
213
+ errorHandler({
214
+ errMsg: 'setTabBarBadge:fail tabbar item not found'
215
+ });
216
+ }
217
+ this.list = list;
218
+ };
219
+ this.removeTabBarBadgeHandler = ({ index, successHandler, errorHandler }) => {
220
+ const list = [...this.list];
221
+ if (index in list) {
222
+ list[index].badgeText = null;
223
+ list[index].badgeText = null;
224
+ successHandler({
225
+ errMsg: 'removeTabBarBadge:ok'
226
+ });
227
+ }
228
+ else {
229
+ errorHandler({
230
+ errMsg: 'removeTabBarBadge:fail tabbar item not found'
231
+ });
232
+ }
233
+ this.list = list;
234
+ };
235
+ this.showTabBarRedDotHandler = ({ index, successHandler, errorHandler }) => {
236
+ const list = [...this.list];
237
+ if (index in list) {
238
+ list[index].badgeText = null;
239
+ list[index].showRedDot = true;
240
+ successHandler({
241
+ errMsg: 'showTabBarRedDot:ok'
242
+ });
243
+ }
244
+ else {
245
+ errorHandler({
246
+ errMsg: 'showTabBarRedDot:fail tabbar item not found'
247
+ });
248
+ }
249
+ this.list = list;
250
+ };
251
+ this.hideTabBarRedDotHandler = ({ index, successHandler, errorHandler }) => {
252
+ const list = [...this.list];
253
+ if (index in list) {
254
+ list[index].showRedDot = false;
255
+ successHandler({
256
+ errMsg: 'hideTabBarRedDot:ok'
257
+ });
258
+ }
259
+ else {
260
+ errorHandler({
261
+ errMsg: 'hideTabBarRedDot:fail tabbar item not found'
262
+ });
263
+ }
264
+ this.list = list;
265
+ };
266
+ this.showTabBarHandler = ({ successHandler }) => {
267
+ this.status = STATUS_SHOW;
268
+ successHandler({
269
+ errMsg: 'showTabBar:ok'
270
+ });
271
+ };
272
+ this.hideTabBarHandler = ({ animation, successHandler }) => {
273
+ this.status = animation ? STATUS_SLIDEOUT : STATUS_HIDE;
274
+ successHandler({
275
+ errMsg: 'hideTabBar:ok'
276
+ });
277
+ };
278
+ this.setTabBarStyleHandler = ({ color, selectedColor, backgroundColor, borderStyle, successHandler }) => {
279
+ if (backgroundColor)
280
+ this.backgroundColor = backgroundColor;
281
+ if (borderStyle)
282
+ this.borderStyle = borderStyle;
283
+ if (color)
284
+ this.color = color;
285
+ if (selectedColor)
286
+ this.selectedColor = selectedColor;
287
+ successHandler({
288
+ errMsg: 'setTabBarStyle:ok'
289
+ });
290
+ };
291
+ this.setTabBarItemHandler = ({ index, iconPath, selectedIconPath, text, successHandler, errorHandler }) => {
292
+ const list = [...this.list];
293
+ if (index in list) {
294
+ if (iconPath)
295
+ list[index].iconPath = iconPath;
296
+ if (selectedIconPath)
297
+ list[index].selectedIconPath = selectedIconPath;
298
+ if (text)
299
+ list[index].text = text;
300
+ successHandler({
301
+ errMsg: 'setTabBarItem:ok'
302
+ });
303
+ }
304
+ else {
305
+ errorHandler({
306
+ errMsg: 'setTabBarItem:fail tabbar item not found'
307
+ });
308
+ }
309
+ this.list = list;
310
+ };
311
+ this.conf = undefined;
312
+ this.list = undefined;
313
+ this.borderStyle = undefined;
314
+ this.backgroundColor = undefined;
315
+ this.color = undefined;
316
+ this.selectedColor = undefined;
317
+ this.selectedIndex = -1;
318
+ this.status = STATUS_SHOW;
319
+ const list = this.conf.list;
320
+ const customRoutes = this.conf.customRoutes;
321
+ if (Object.prototype.toString.call(list) !== '[object Array]' ||
322
+ list.length < 2 ||
323
+ list.length > 5) {
324
+ throw new Error('tabBar 配置错误');
325
+ }
326
+ this.homePage = addLeadingSlash(this.conf.homePage);
327
+ for (let key in customRoutes) {
328
+ const path = customRoutes[key];
329
+ key = addLeadingSlash(key);
330
+ if (typeof path === 'string') {
331
+ this.customRoutes.push([key, addLeadingSlash(path)]);
332
+ }
333
+ else if ((path === null || path === void 0 ? void 0 : path.length) > 0) {
334
+ this.customRoutes.push(...path.map(p => [key, addLeadingSlash(p)]));
335
+ }
336
+ }
337
+ list.forEach(item => {
338
+ if (item.pagePath.indexOf('/') !== 0) {
339
+ item.pagePath = '/' + item.pagePath;
340
+ }
341
+ });
342
+ this.list = list;
343
+ this.borderStyle = this.conf.borderStyle;
344
+ this.backgroundColor = this.conf.backgroundColor;
345
+ this.color = this.conf.color;
346
+ this.selectedColor = this.conf.selectedColor;
347
+ }
348
+ getCurrentUrl() {
349
+ const routerMode = this.conf.mode;
350
+ const routerBasename = this.conf.basename || '/';
351
+ let url;
352
+ if (routerMode === 'hash') {
353
+ const href = window.location.href;
354
+ const hashIndex = href.indexOf('#');
355
+ url = hashIndex === -1
356
+ ? ''
357
+ : href.substring(hashIndex + 1);
358
+ }
359
+ else {
360
+ url = location.pathname;
361
+ }
362
+ const processedUrl = addLeadingSlash(stripBasename(url, routerBasename));
363
+ return decodeURI(processedUrl === '/' ? this.homePage : processedUrl);
364
+ }
365
+ bindEvent() {
366
+ Taro.eventCenter.on('__taroRouterChange', this.routerChangeHandler);
367
+ Taro.eventCenter.on('__taroSwitchTab', this.switchTabHandler);
368
+ Taro.eventCenter.on('__taroSetTabBarBadge', this.setTabBarBadgeHandler);
369
+ Taro.eventCenter.on('__taroRemoveTabBarBadge', this.removeTabBarBadgeHandler);
370
+ Taro.eventCenter.on('__taroShowTabBarRedDotHandler', this.showTabBarRedDotHandler);
371
+ Taro.eventCenter.on('__taroHideTabBarRedDotHandler', this.hideTabBarRedDotHandler);
372
+ Taro.eventCenter.on('__taroShowTabBar', this.showTabBarHandler);
373
+ Taro.eventCenter.on('__taroHideTabBar', this.hideTabBarHandler);
374
+ Taro.eventCenter.on('__taroSetTabBarStyle', this.setTabBarStyleHandler);
375
+ Taro.eventCenter.on('__taroSetTabBarItem', this.setTabBarItemHandler);
376
+ }
377
+ removeEvent() {
378
+ Taro.eventCenter.off('__taroRouterChange', this.routerChangeHandler);
379
+ Taro.eventCenter.off('__taroSwitchTab', this.switchTabHandler);
380
+ Taro.eventCenter.off('__taroSetTabBarBadge', this.setTabBarBadgeHandler);
381
+ Taro.eventCenter.off('__taroRemoveTabBarBadge', this.removeTabBarBadgeHandler);
382
+ Taro.eventCenter.off('__taroShowTabBarRedDotHandler', this.showTabBarRedDotHandler);
383
+ Taro.eventCenter.off('__taroHideTabBarRedDotHandler', this.hideTabBarRedDotHandler);
384
+ Taro.eventCenter.off('__taroShowTabBar', this.showTabBarHandler);
385
+ Taro.eventCenter.off('__taroHideTabBar', this.hideTabBarHandler);
386
+ Taro.eventCenter.off('__taroSetTabBarStyle', this.setTabBarStyleHandler);
387
+ Taro.eventCenter.off('__taroSetTabBarItem', this.setTabBarItemHandler);
388
+ }
389
+ componentDidLoad() {
390
+ this.tabbarPos = this.tabbar.nextElementSibling ? 'top' : 'bottom';
391
+ this.bindEvent();
392
+ this.routerChangeHandler();
393
+ }
394
+ disconnectedCallback() {
395
+ this.removeEvent();
396
+ }
397
+ render() {
398
+ const { tabbarPos = 'bottom' } = this;
399
+ const status = this.status;
400
+ const containerCls = classnames('weui-tabbar', {
401
+ [`taro-tabbar__border-${this.borderStyle || 'black'}`]: true
402
+ });
403
+ const shouldHideTabBar = this.selectedIndex === -1 || status === STATUS_HIDE;
404
+ const shouldSlideout = status === STATUS_SLIDEOUT;
405
+ return (h(Host, { class: classnames(basicTabBarClassName, `${basicTabBarClassName}-${tabbarPos}`, {
406
+ [hideTabBarClassName]: shouldHideTabBar,
407
+ [hideTabBarWithAnimationClassName]: shouldSlideout
408
+ }) }, h("div", { class: containerCls, style: {
409
+ backgroundColor: this.backgroundColor || '',
410
+ height: 'inherit'
411
+ } }, this.list.map((item, index) => {
412
+ const isSelected = this.selectedIndex === index;
413
+ let textColor;
414
+ let iconPath;
415
+ if (isSelected) {
416
+ textColor = this.selectedColor || '';
417
+ iconPath = item.selectedIconPath;
418
+ }
419
+ else {
420
+ textColor = this.color || '';
421
+ iconPath = item.iconPath;
422
+ }
423
+ return (h(TabbarItem, { index: index, onSelect: this.switchTab.bind(this), isSelected: isSelected, textColor: textColor, iconPath: iconPath, text: item.text, badgeText: item.badgeText, showRedDot: item.showRedDot }));
424
+ }))));
425
+ }
426
+ get tabbar() { return this; }
427
+ static get style() { return indexCss; }
428
+ }, [0, "taro-tabbar", {
429
+ "conf": [16],
430
+ "list": [32],
431
+ "borderStyle": [32],
432
+ "backgroundColor": [32],
433
+ "color": [32],
434
+ "selectedColor": [32],
435
+ "selectedIndex": [32],
436
+ "status": [32]
437
+ }]);
438
+ function defineCustomElement$1() {
439
+ if (typeof customElements === "undefined") {
440
+ return;
441
+ }
442
+ const components = ["taro-tabbar"];
443
+ components.forEach(tagName => { switch (tagName) {
444
+ case "taro-tabbar":
445
+ if (!customElements.get(tagName)) {
446
+ customElements.define(tagName, Tabbar);
447
+ }
448
+ break;
449
+ } });
450
+ }
451
+
452
+ const TaroTabbar = Tabbar;
453
+ const defineCustomElement = defineCustomElement$1;
454
+
455
+ export { TaroTabbar, defineCustomElement };
456
+
457
+ //# sourceMappingURL=taro-tabbar.js.map