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

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 TaroViewCore extends Components.TaroViewCore, HTMLElement {}
4
+ export const TaroViewCore: {
5
+ prototype: TaroViewCore;
6
+ new (): TaroViewCore;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,101 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { c as classnames } from './index2.js';
3
+
4
+ const indexCss = "body,html{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}taro-view-core{display:block}";
5
+
6
+ const View = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.onLongPress = createEvent(this, "longpress", 7);
11
+ this.startTime = 0;
12
+ this.animation = undefined;
13
+ this.hoverClass = undefined;
14
+ this.hoverStartTime = 50;
15
+ this.hoverStayTime = 400;
16
+ this.hover = false;
17
+ this.touch = false;
18
+ }
19
+ onTouchStart() {
20
+ if (this.hoverClass) {
21
+ this.touch = true;
22
+ setTimeout(() => {
23
+ if (this.touch) {
24
+ this.hover = true;
25
+ }
26
+ }, this.hoverStartTime);
27
+ }
28
+ this.timeoutEvent = setTimeout(() => {
29
+ this.onLongPress.emit();
30
+ }, 350);
31
+ this.startTime = Date.now();
32
+ }
33
+ onTouchMove() {
34
+ clearTimeout(this.timeoutEvent);
35
+ }
36
+ onTouchEnd() {
37
+ const spanTime = Date.now() - this.startTime;
38
+ if (spanTime < 350) {
39
+ clearTimeout(this.timeoutEvent);
40
+ }
41
+ if (this.hoverClass) {
42
+ this.touch = false;
43
+ setTimeout(() => {
44
+ if (!this.touch) {
45
+ this.hover = false;
46
+ }
47
+ }, this.hoverStayTime);
48
+ }
49
+ }
50
+ componentDidRender() {
51
+ const el = this.el;
52
+ el.childNodes.forEach(item => {
53
+ // Note: ['s-cn'] Content Reference Node
54
+ if (item.nodeType === document.COMMENT_NODE && item['s-cn'])
55
+ item['s-cn'] = false;
56
+ // Note: ['s-sr'] Is a slot reference node (渲染完成后禁用 slotRelocation 特性, 避免 Stencil 组件相互调用时内置排序与第三方 UI 框架冲突导致组件顺序混乱)
57
+ if (item.nodeType !== document.COMMENT_NODE && item['s-sr'])
58
+ item['s-sr'] = false;
59
+ });
60
+ }
61
+ render() {
62
+ const cls = classnames({
63
+ [`${this.hoverClass}`]: this.hover
64
+ });
65
+ let attr = {};
66
+ if (!!this.animation) {
67
+ attr['animation'] = this.animation;
68
+ attr['data-animation'] = this.animation;
69
+ }
70
+ return (h(Host, Object.assign({ class: cls }, attr), h("slot", null)));
71
+ }
72
+ get el() { return this; }
73
+ static get style() { return indexCss; }
74
+ }, [4, "taro-view-core", {
75
+ "animation": [1],
76
+ "hoverClass": [1, "hover-class"],
77
+ "hoverStartTime": [2, "hover-start-time"],
78
+ "hoverStayTime": [2, "hover-stay-time"],
79
+ "hover": [32],
80
+ "touch": [32]
81
+ }, [[1, "touchstart", "onTouchStart"], [1, "touchmove", "onTouchMove"], [1, "touchend", "onTouchEnd"]]]);
82
+ function defineCustomElement$1() {
83
+ if (typeof customElements === "undefined") {
84
+ return;
85
+ }
86
+ const components = ["taro-view-core"];
87
+ components.forEach(tagName => { switch (tagName) {
88
+ case "taro-view-core":
89
+ if (!customElements.get(tagName)) {
90
+ customElements.define(tagName, View);
91
+ }
92
+ break;
93
+ } });
94
+ }
95
+
96
+ const TaroViewCore = View;
97
+ const defineCustomElement = defineCustomElement$1;
98
+
99
+ export { TaroViewCore, defineCustomElement };
100
+
101
+ //# sourceMappingURL=taro-view-core.js.map
@@ -0,0 +1 @@
1
+ {"file":"taro-view-core.js","mappings":";;;AAAA,MAAM,QAAQ,GAAG,2KAA2K;;MCO/K,IAAI;;;;;IAeP,cAAS,GAAG,CAAC,CAAA;;;0BAVI,EAAE;yBACH,GAAG;iBACV,KAAK;iBACL,KAAK;;EAUtB,YAAY;IACV,IAAI,IAAI,CAAC,UAAU,EAAE;MACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;MACjB,UAAU,CAAC;QACT,IAAI,IAAI,CAAC,KAAK,EAAE;UACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;SAClB;OACF,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;KACxB;IAED,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;MAC7B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAA;KACxB,EAAE,GAAG,CAAC,CAAA;IACP,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;GAC5B;EAGD,WAAW;IACT,YAAY,CAAC,IAAI,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AAE,GAAG,IAAM,IAAI,GACxB,eAAa,CACR,EACR;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["classNames"],"sources":["./src/components/view/style/index.scss?tag=taro-view-core","./src/components/view/view.tsx"],"sourcesContent":["body,\nhtml {\n user-select: none;\n -webkit-tap-highlight-color: rgb(0 0 0 / 0%);\n}\n\ntaro-view-core {\n display: block;\n}\n","import { Component, Prop, h, ComponentInterface, Host, Listen, State, Event, EventEmitter, Element } from '@stencil/core'\nimport classNames from 'classnames'\n\n@Component({\n tag: 'taro-view-core',\n styleUrl: './style/index.scss'\n})\nexport class View implements ComponentInterface {\n @Element() el: HTMLElement\n\n @Prop() animation: string\n @Prop() hoverClass: string\n @Prop() hoverStartTime = 50\n @Prop() hoverStayTime = 400\n @State() hover = false\n @State() touch = false\n\n @Event({\n eventName: 'longpress'\n }) onLongPress: EventEmitter\n\n private timeoutEvent: ReturnType<typeof setTimeout>\n private startTime = 0\n\n @Listen('touchstart')\n onTouchStart () {\n if (this.hoverClass) {\n this.touch = true\n setTimeout(() => {\n if (this.touch) {\n this.hover = true\n }\n }, this.hoverStartTime)\n }\n\n this.timeoutEvent = setTimeout(() => {\n this.onLongPress.emit()\n }, 350)\n this.startTime = Date.now()\n }\n\n @Listen('touchmove')\n onTouchMove () {\n clearTimeout(this.timeoutEvent)\n }\n\n @Listen('touchend')\n onTouchEnd () {\n const spanTime = Date.now() - this.startTime\n if (spanTime < 350) {\n clearTimeout(this.timeoutEvent)\n }\n if (this.hoverClass) {\n this.touch = false\n setTimeout(() => {\n if (!this.touch) {\n this.hover = false\n }\n }, this.hoverStayTime)\n }\n }\n\n componentDidRender () {\n const el = this.el\n el.childNodes.forEach(item => {\n // Note: ['s-cn'] Content Reference Node\n if (item.nodeType === document.COMMENT_NODE && item['s-cn']) item['s-cn'] = false\n // Note: ['s-sr'] Is a slot reference node (渲染完成后禁用 slotRelocation 特性, 避免 Stencil 组件相互调用时内置排序与第三方 UI 框架冲突导致组件顺序混乱)\n if (item.nodeType !== document.COMMENT_NODE && item['s-sr']) item['s-sr'] = false\n })\n }\n\n render() {\n const cls = classNames({\n [`${this.hoverClass}`]: this.hover\n })\n let attr = {}\n if (!!this.animation) {\n attr['animation'] = this.animation\n attr['data-animation'] = this.animation\n }\n return (\n <Host class={cls} {...attr}>\n <slot></slot>\n </Host>\n )\n }\n}\n"],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface TaroVoipRoomCore extends Components.TaroVoipRoomCore, HTMLElement {}
4
+ export const TaroVoipRoomCore: {
5
+ prototype: TaroVoipRoomCore;
6
+ new (): TaroVoipRoomCore;
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 VoipRoom = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ this.__registerHost();
8
+ }
9
+ componentDidLoad() {
10
+ notSupport('VoipRoom', this);
11
+ }
12
+ render() {
13
+ return (h(Host, null));
14
+ }
15
+ }, [0, "taro-voip-room-core"]);
16
+ function defineCustomElement$1() {
17
+ if (typeof customElements === "undefined") {
18
+ return;
19
+ }
20
+ const components = ["taro-voip-room-core"];
21
+ components.forEach(tagName => { switch (tagName) {
22
+ case "taro-voip-room-core":
23
+ if (!customElements.get(tagName)) {
24
+ customElements.define(tagName, VoipRoom);
25
+ }
26
+ break;
27
+ } });
28
+ }
29
+
30
+ const TaroVoipRoomCore = VoipRoom;
31
+ const defineCustomElement = defineCustomElement$1;
32
+
33
+ export { TaroVoipRoomCore, defineCustomElement };
34
+
35
+ //# sourceMappingURL=taro-voip-room-core.js.map
@@ -0,0 +1 @@
1
+ {"file":"taro-voip-room-core.js","mappings":";;;MAOa,QAAQ;;;;;EACnB,gBAAgB;IACd,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;GAC7B;EAED,MAAM;IACJ,QACE,EAAC,IAAI,OAAG,EACT;GACF;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/voip-room/voip-room.tsx"],"sourcesContent":["import { Component, ComponentInterface, h, Host } from '@stencil/core'\n\nimport { notSupport } from '../../utils'\n\n@Component({\n tag: 'taro-voip-room-core'\n})\nexport class VoipRoom implements ComponentInterface {\n componentDidLoad () {\n notSupport('VoipRoom', 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 TaroWebViewCore extends Components.TaroWebViewCore, HTMLElement {}
4
+ export const TaroWebViewCore: {
5
+ prototype: TaroWebViewCore;
6
+ new (): TaroWebViewCore;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,46 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
+
3
+ const indexCss = "iframe{border:none}.taro-webview{position:fixed;top:0;bottom:0;z-index:999;width:100%;height:100%}";
4
+
5
+ const WebView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.onLoad = createEvent(this, "load", 7);
10
+ this.onError = createEvent(this, "error", 7);
11
+ this.src = undefined;
12
+ }
13
+ render() {
14
+ const { src, onLoad, onError } = this;
15
+ return (h("iframe", { class: 'taro-webview', onLoad: (e) => {
16
+ e.stopPropagation();
17
+ onLoad.emit({ src });
18
+ }, onError: (e) => {
19
+ e.stopPropagation();
20
+ onError.emit({ src });
21
+ }, src: src }));
22
+ }
23
+ static get style() { return indexCss; }
24
+ }, [0, "taro-web-view-core", {
25
+ "src": [1]
26
+ }]);
27
+ function defineCustomElement$1() {
28
+ if (typeof customElements === "undefined") {
29
+ return;
30
+ }
31
+ const components = ["taro-web-view-core"];
32
+ components.forEach(tagName => { switch (tagName) {
33
+ case "taro-web-view-core":
34
+ if (!customElements.get(tagName)) {
35
+ customElements.define(tagName, WebView);
36
+ }
37
+ break;
38
+ } });
39
+ }
40
+
41
+ const TaroWebViewCore = WebView;
42
+ const defineCustomElement = defineCustomElement$1;
43
+
44
+ export { TaroWebViewCore, defineCustomElement };
45
+
46
+ //# sourceMappingURL=taro-web-view-core.js.map
@@ -0,0 +1 @@
1
+ {"file":"taro-web-view-core.js","mappings":";;AAAA,MAAM,QAAQ,GAAG,oGAAoG;;MCMxG,OAAO;;;;;;;;EAalB,MAAM;IACJ,MAAM,EACJ,GAAG,EACH,MAAM,EACN,OAAO,EACR,GAAG,IAAI,CAAA;IACR,QACE,cACE,KAAK,EAAC,cAAc,EACpB,MAAM,EAAE,CAAC,CAAQ;QACf,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;OACrB,EACD,OAAO,EAAE,CAAC,CAAQ;QAChB,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAA;OACtB,EACD,GAAG,EAAE,GAAG,GACR,EACH;GACF;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/web-view/style/index.scss?tag=taro-web-view-core","./src/components/web-view/web-view.tsx"],"sourcesContent":["iframe {\n border: none;\n}\n\n.taro-webview {\n position: fixed;\n top: 0;\n bottom: 0;\n z-index: 999;\n width: 100%;\n height: 100%;\n}\n","import { Component, h, ComponentInterface, Prop, Event, EventEmitter } from '@stencil/core'\n\n@Component({\n tag: 'taro-web-view-core',\n styleUrl: './style/index.scss'\n})\nexport class WebView implements ComponentInterface {\n @Prop() src: string\n\n @Event({\n eventName: 'load'\n })\n onLoad: EventEmitter\n\n @Event({\n eventName: 'error'\n })\n onError: EventEmitter\n\n render () {\n const {\n src,\n onLoad,\n onError\n } = this\n return (\n <iframe\n class='taro-webview'\n onLoad={(e: Event) => {\n e.stopPropagation()\n onLoad.emit({ src })\n }}\n onError={(e: Event) => {\n e.stopPropagation()\n onError.emit({ src })\n }}\n src={src}\n />\n )\n }\n}\n"],"version":3}
@@ -0,0 +1,233 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const formatTime = (time) => {
4
+ if (!time)
5
+ return '';
6
+ const sec = Math.round(time % 60);
7
+ const min = Math.round((time - sec) / 60);
8
+ return `${min < 10 ? `0${min}` : min}:${sec < 10 ? `0${sec}` : sec}`;
9
+ };
10
+ const calcDist = (x, y) => {
11
+ return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
12
+ };
13
+ const normalizeNumber = (number) => {
14
+ return Math.max(-1, Math.min(number, 1));
15
+ };
16
+ let scene = 'default';
17
+ const screenFn = (function () {
18
+ let val;
19
+ const fnMap = [
20
+ [
21
+ 'requestFullscreen',
22
+ 'exitFullscreen',
23
+ 'fullscreenElement',
24
+ 'fullscreenEnabled',
25
+ 'fullscreenchange',
26
+ 'fullscreenerror'
27
+ ],
28
+ // New WebKit
29
+ [
30
+ 'webkitRequestFullscreen',
31
+ 'webkitExitFullscreen',
32
+ 'webkitFullscreenElement',
33
+ 'webkitFullscreenEnabled',
34
+ 'webkitfullscreenchange',
35
+ 'webkitfullscreenerror'
36
+ ],
37
+ // Old WebKit
38
+ [
39
+ 'webkitRequestFullScreen',
40
+ 'webkitCancelFullScreen',
41
+ 'webkitCurrentFullScreenElement',
42
+ 'webkitCancelFullScreen',
43
+ 'webkitfullscreenchange',
44
+ 'webkitfullscreenerror'
45
+ ],
46
+ [
47
+ 'mozRequestFullScreen',
48
+ 'mozCancelFullScreen',
49
+ 'mozFullScreenElement',
50
+ 'mozFullScreenEnabled',
51
+ 'mozfullscreenchange',
52
+ 'mozfullscreenerror'
53
+ ],
54
+ [
55
+ 'msRequestFullscreen',
56
+ 'msExitFullscreen',
57
+ 'msFullscreenElement',
58
+ 'msFullscreenEnabled',
59
+ 'MSFullscreenChange',
60
+ 'MSFullscreenError'
61
+ ]
62
+ ];
63
+ var defaultIOSMap = [
64
+ 'webkitEnterFullscreen',
65
+ 'webkitExitFullscreen',
66
+ 'webkitCurrentFullScreenElement',
67
+ 'webkitSupportsFullscreen',
68
+ 'fullscreenchange',
69
+ 'fullscreenerror'
70
+ ];
71
+ let i = 0;
72
+ const l = fnMap.length;
73
+ const ret = {};
74
+ // This for loop essentially checks the current document object for the property/methods above.
75
+ for (; i < l; i++) {
76
+ val = fnMap[i];
77
+ if (val && val[1] in document) {
78
+ for (i = 0; i < val.length; i++) {
79
+ ret[fnMap[0][i]] = val[i];
80
+ }
81
+ return ret;
82
+ }
83
+ }
84
+ if (!ret[fnMap[0][0]]) {
85
+ scene = 'iOS';
86
+ // when there is no any APIs be set.
87
+ // In IOS, there is no 'webkitEnterFullscreen' property `in document` but video can use it for fullscreen.
88
+ // ref: https://developer.apple.com/documentation/webkitjs/htmlvideoelement/1633500-webkitenterfullscreen
89
+ for (i = 0; i < defaultIOSMap.length; i++) {
90
+ ret[fnMap[0][i]] = defaultIOSMap[i];
91
+ }
92
+ }
93
+ // If it doesn't find any of them, this whole function returns {}
94
+ // and the fn variable is set to this returned value.
95
+ return ret;
96
+ })();
97
+ const isHls = url => /\.(m3u8)($|\?)/i.test(url);
98
+
99
+ const VideoControl = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
100
+ constructor() {
101
+ super();
102
+ this.__registerHost();
103
+ this.visible = false;
104
+ this.isDraggingProgressBall = false;
105
+ this.percentage = 0;
106
+ this.progressDimensions = {
107
+ left: 0,
108
+ width: 0
109
+ };
110
+ this.calcPercentage = (pageX) => {
111
+ let pos = pageX - this.progressDimensions.left;
112
+ pos = Math.max(pos, 0);
113
+ pos = Math.min(pos, this.progressDimensions.width);
114
+ return pos / this.progressDimensions.width;
115
+ };
116
+ this.onDragProgressBallStart = () => {
117
+ this.isDraggingProgressBall = true;
118
+ this.hideControlsTimer && clearTimeout(this.hideControlsTimer);
119
+ };
120
+ this.onClickProgress = (e) => {
121
+ e.stopPropagation();
122
+ const percentage = this.calcPercentage(e.pageX);
123
+ this.seekFunc(percentage * this.duration);
124
+ this.toggleVisibility(true);
125
+ };
126
+ this.controls = undefined;
127
+ this.currentTime = undefined;
128
+ this.duration = undefined;
129
+ this.isPlaying = undefined;
130
+ this.pauseFunc = undefined;
131
+ this.playFunc = undefined;
132
+ this.seekFunc = undefined;
133
+ this.showPlayBtn = undefined;
134
+ this.showProgress = undefined;
135
+ }
136
+ onDocumentTouchMove(e) {
137
+ if (!this.isDraggingProgressBall)
138
+ return;
139
+ const touchX = e.touches[0].pageX;
140
+ this.percentage = this.calcPercentage(touchX);
141
+ this.setProgressBall(this.percentage);
142
+ this.setCurrentTime(this.percentage * this.duration);
143
+ }
144
+ onDocumentTouchEnd() {
145
+ if (!this.isDraggingProgressBall)
146
+ return;
147
+ this.isDraggingProgressBall = false;
148
+ this.seekFunc(this.percentage * this.duration);
149
+ this.toggleVisibility(true);
150
+ }
151
+ async setProgressBall(percentage) {
152
+ if (this.progressBallRef) {
153
+ this.progressBallRef.style.left = `${percentage * 100}%`;
154
+ }
155
+ }
156
+ async toggleVisibility(nextVisible) {
157
+ const visible = nextVisible === undefined ? !this.visible : nextVisible;
158
+ if (visible) {
159
+ this.hideControlsTimer && clearTimeout(this.hideControlsTimer);
160
+ if (this.isPlaying) {
161
+ this.hideControlsTimer = setTimeout(() => {
162
+ this.toggleVisibility(false);
163
+ }, 2000);
164
+ }
165
+ this.el.style.visibility = 'visible';
166
+ }
167
+ else {
168
+ this.el.style.visibility = 'hidden';
169
+ }
170
+ this.visible = !!visible;
171
+ }
172
+ async getIsDraggingProgressBall() {
173
+ return this.isDraggingProgressBall;
174
+ }
175
+ async setCurrentTime(time) {
176
+ this.currentTimeRef.innerHTML = formatTime(time);
177
+ }
178
+ render() {
179
+ const { controls, currentTime, duration, isPlaying, pauseFunc, playFunc, showPlayBtn, showProgress } = this;
180
+ const formattedDuration = formatTime(duration);
181
+ let playBtn;
182
+ if (!showPlayBtn) {
183
+ playBtn = null;
184
+ }
185
+ else if (isPlaying) {
186
+ playBtn = h("div", { class: 'taro-video-control-button taro-video-control-button-pause', onClick: pauseFunc });
187
+ }
188
+ else {
189
+ playBtn = h("div", { class: 'taro-video-control-button taro-video-control-button-play', onClick: playFunc });
190
+ }
191
+ return (h(Host, { class: 'taro-video-bar taro-video-bar-full' }, controls && (h("div", { class: 'taro-video-controls' }, playBtn, showProgress && (h("div", { class: 'taro-video-current-time', ref: dom => (this.currentTimeRef = dom) }, formatTime(currentTime))), showProgress && (h("div", { class: 'taro-video-progress-container', onClick: this.onClickProgress }, h("div", { class: 'taro-video-progress', ref: ref => {
192
+ if (!ref)
193
+ return;
194
+ const rect = ref.getBoundingClientRect();
195
+ this.progressDimensions.left = rect.left;
196
+ this.progressDimensions.width = rect.width;
197
+ } }, h("div", { class: 'taro-video-progress-buffered', style: { width: '100%' } }), h("div", { class: 'taro-video-ball', ref: dom => (this.progressBallRef = dom), onTouchStart: this.onDragProgressBallStart, style: {
198
+ left: `${formattedDuration ? (this.currentTime / duration) * 100 : 0}%`
199
+ } }, h("div", { class: 'taro-video-inner' }))))), showProgress && h("div", { class: 'taro-video-duration' }, formattedDuration))), h("slot", null)));
200
+ }
201
+ get el() { return this; }
202
+ }, [4, "taro-video-control", {
203
+ "controls": [4],
204
+ "currentTime": [2, "current-time"],
205
+ "duration": [2],
206
+ "isPlaying": [4, "is-playing"],
207
+ "pauseFunc": [16],
208
+ "playFunc": [16],
209
+ "seekFunc": [16],
210
+ "showPlayBtn": [4, "show-play-btn"],
211
+ "showProgress": [4, "show-progress"],
212
+ "setProgressBall": [64],
213
+ "toggleVisibility": [64],
214
+ "getIsDraggingProgressBall": [64],
215
+ "setCurrentTime": [64]
216
+ }, [[5, "touchmove", "onDocumentTouchMove"], [5, "touchend", "onDocumentTouchEnd"], [5, "touchcancel", "onDocumentTouchEnd"]]]);
217
+ function defineCustomElement() {
218
+ if (typeof customElements === "undefined") {
219
+ return;
220
+ }
221
+ const components = ["taro-video-control"];
222
+ components.forEach(tagName => { switch (tagName) {
223
+ case "taro-video-control":
224
+ if (!customElements.get(tagName)) {
225
+ customElements.define(tagName, VideoControl);
226
+ }
227
+ break;
228
+ } });
229
+ }
230
+
231
+ export { VideoControl as V, scene as a, calcDist as c, defineCustomElement as d, formatTime as f, isHls as i, normalizeNumber as n, screenFn as s };
232
+
233
+ //# sourceMappingURL=video-control.js.map
@@ -0,0 +1 @@
1
+ {"file":"video-control.js","mappings":";;MAAa,UAAU,GAAG,CAAC,IAAa;EACtC,IAAI,CAAC,IAAI;IAAE,OAAO,EAAE,CAAA;EACpB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;EACjC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,GAAG,IAAI,EAAE,CAAC,CAAA;EACzC,OAAO,GAAG,GAAG,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,GAAG,EAAE,CAAA;AACtE,EAAC;MAEY,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS;EAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACnD,EAAC;MAEY,eAAe,GAAG,CAAC,MAAc;EAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;AAC1C,EAAC;IAEU,KAAK,GAAG,UAAS;MAEf,QAAQ,GAAG,CAAC;EACvB,IAAI,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P,EACA,YAAY,KACX,WAAK,KAAK,EAAC,+BAA+B,EAAC,OAAO,EAAE,IAAI,CAAC,eAAe,IACtE,WACE,KAAK,EAAC,qBAAqB,EAC3B,GAAG,EAAE,GAAG;QACN,IAAI,CAAC,GAAG;UAAE,OAAM;QAChB,MAAM,IAAI,GAAG,GAAG,CAAC,qBAAqB,EAAE,CAAA;QACxC,IAAI,CAAC,kBAAkB,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACxC,IAAI,CAAC,kBAAkB,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;OAC3C,IACD,WAAK,KAAK,EAAC,8BAA8B,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAI,EACtE,WACE,KAAK,EAAC,iBAAiB,EACvB,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,eAAe,GAAG,GAAqB,CAAC,EAC1D,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAC1C,KAAK,EAAE;QACL,IAAI,EAAE,GAAG,iBAAiB,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,QAAQ,IAAI,GAAG,GAAG,CAAC,GAAG;OACxE,IAED,WAAK,KAAK,EAAC,kBAAkB,GAAG,CAC5B,CACF,CACF,CACP,EACA,YAAY,IAAI,WAAK,KAAK,EAAC,qBAAqB,IAAE,iBAAiB,CAAO,CACvE,CACP,EACD,eAAQ,CACH,EACR;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/video/utils.ts","./src/components/video/video-control.tsx"],"sourcesContent":["export const formatTime = (time?: number): string => {\r\n if (!time) return ''\r\n const sec = Math.round(time % 60)\r\n const min = Math.round((time - sec) / 60)\r\n return `${min < 10 ? `0${min}` : min}:${sec < 10 ? `0${sec}` : sec}`\r\n}\r\n\r\nexport const calcDist = (x: number, y: number): number => {\r\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))\r\n}\r\n\r\nexport const normalizeNumber = (number: number): number => {\r\n return Math.max(-1, Math.min(number, 1))\r\n}\r\n\r\nexport let scene = 'default'\r\n\r\nexport const screenFn = (function () {\r\n let val\r\n const fnMap = [\r\n [\r\n 'requestFullscreen',\r\n 'exitFullscreen',\r\n 'fullscreenElement',\r\n 'fullscreenEnabled',\r\n 'fullscreenchange',\r\n 'fullscreenerror'\r\n ],\r\n // New WebKit\r\n [\r\n 'webkitRequestFullscreen',\r\n 'webkitExitFullscreen',\r\n 'webkitFullscreenElement',\r\n 'webkitFullscreenEnabled',\r\n 'webkitfullscreenchange',\r\n 'webkitfullscreenerror'\r\n ],\r\n // Old WebKit\r\n [\r\n 'webkitRequestFullScreen',\r\n 'webkitCancelFullScreen',\r\n 'webkitCurrentFullScreenElement',\r\n 'webkitCancelFullScreen',\r\n 'webkitfullscreenchange',\r\n 'webkitfullscreenerror'\r\n ],\r\n [\r\n 'mozRequestFullScreen',\r\n 'mozCancelFullScreen',\r\n 'mozFullScreenElement',\r\n 'mozFullScreenEnabled',\r\n 'mozfullscreenchange',\r\n 'mozfullscreenerror'\r\n ],\r\n [\r\n 'msRequestFullscreen',\r\n 'msExitFullscreen',\r\n 'msFullscreenElement',\r\n 'msFullscreenEnabled',\r\n 'MSFullscreenChange',\r\n 'MSFullscreenError'\r\n ]\r\n ]\r\n var defaultIOSMap = [\r\n 'webkitEnterFullscreen',\r\n 'webkitExitFullscreen',\r\n 'webkitCurrentFullScreenElement',\r\n 'webkitSupportsFullscreen',\r\n 'fullscreenchange',\r\n 'fullscreenerror'\r\n ]\r\n let i = 0\r\n const l = fnMap.length\r\n const ret: Record<string, any> = {}\r\n // This for loop essentially checks the current document object for the property/methods above.\r\n for (; i < l; i++) {\r\n val = fnMap[i]\r\n if (val && val[1] in document) {\r\n for (i = 0; i < val.length; i++) {\r\n ret[fnMap[0][i]] = val[i]\r\n }\r\n return ret\r\n }\r\n }\r\n if (!ret[fnMap[0][0]]) {\r\n scene = 'iOS'\r\n // when there is no any APIs be set.\r\n\r\n // In IOS, there is no 'webkitEnterFullscreen' property `in document` but video can use it for fullscreen.\r\n // ref: https://developer.apple.com/documentation/webkitjs/htmlvideoelement/1633500-webkitenterfullscreen\r\n for (i = 0; i < defaultIOSMap.length; i++) {\r\n ret[fnMap[0][i]] = defaultIOSMap[i]\r\n }\r\n }\r\n // If it doesn't find any of them, this whole function returns {}\r\n // and the fn variable is set to this returned value.\r\n return ret\r\n})()\r\n\r\nexport const isHls = url => /\\.(m3u8)($|\\?)/i.test(url)\r\n","import { Component, h, ComponentInterface, Prop, Host, Element, Listen, Method } from '@stencil/core'\nimport { formatTime } from './utils'\n\n@Component({\n tag: 'taro-video-control'\n})\nexport class VideoControl implements ComponentInterface {\n private currentTimeRef: HTMLDivElement\n private progressBallRef: HTMLDivElement\n private visible = false\n private isDraggingProgressBall = false\n private hideControlsTimer: ReturnType<typeof setTimeout>\n private percentage = 0\n private progressDimensions = {\n left: 0,\n width: 0\n }\n\n @Element() el: HTMLElement\n\n @Prop() controls: boolean\n @Prop() currentTime: number\n @Prop() duration: number\n @Prop() isPlaying: boolean\n @Prop() pauseFunc: () => void\n @Prop() playFunc: () => void\n @Prop() seekFunc: (position: number) => void\n @Prop() showPlayBtn: boolean\n @Prop() showProgress: boolean\n\n @Listen('touchmove', {\n target: 'document'\n })\n onDocumentTouchMove (e: TouchEvent) {\n if (!this.isDraggingProgressBall) return\n const touchX = e.touches[0].pageX\n this.percentage = this.calcPercentage(touchX)\n this.setProgressBall(this.percentage)\n this.setCurrentTime(this.percentage * this.duration)\n }\n\n @Listen('touchend', {\n target: 'document'\n })\n @Listen('touchcancel', {\n target: 'document'\n })\n onDocumentTouchEnd () {\n if (!this.isDraggingProgressBall) return\n\n this.isDraggingProgressBall = false\n this.seekFunc(this.percentage * this.duration)\n this.toggleVisibility(true)\n }\n\n @Method()\n async setProgressBall (percentage: number) {\n if (this.progressBallRef) {\n this.progressBallRef.style.left = `${percentage * 100}%`\n }\n }\n\n @Method()\n async toggleVisibility (nextVisible?: boolean) {\n const visible = nextVisible === undefined ? !this.visible : nextVisible\n if (visible) {\n this.hideControlsTimer && clearTimeout(this.hideControlsTimer)\n if (this.isPlaying) {\n this.hideControlsTimer = setTimeout(() => {\n this.toggleVisibility(false)\n }, 2000)\n }\n this.el.style.visibility = 'visible'\n } else {\n this.el.style.visibility = 'hidden'\n }\n this.visible = !!visible\n }\n\n @Method()\n async getIsDraggingProgressBall () {\n return this.isDraggingProgressBall\n }\n\n @Method()\n async setCurrentTime (time: number) {\n this.currentTimeRef.innerHTML = formatTime(time)\n }\n\n calcPercentage = (pageX: number): number => {\n let pos = pageX - this.progressDimensions.left\n pos = Math.max(pos, 0)\n pos = Math.min(pos, this.progressDimensions.width)\n return pos / this.progressDimensions.width\n }\n\n onDragProgressBallStart = () => {\n this.isDraggingProgressBall = true\n this.hideControlsTimer && clearTimeout(this.hideControlsTimer)\n }\n\n onClickProgress = (e: MouseEvent) => {\n e.stopPropagation()\n\n const percentage = this.calcPercentage(e.pageX)\n this.seekFunc(percentage * this.duration)\n this.toggleVisibility(true)\n }\n\n render () {\n const {\n controls,\n currentTime,\n duration,\n isPlaying,\n pauseFunc,\n playFunc,\n showPlayBtn,\n showProgress\n } = this\n\n const formattedDuration = formatTime(duration)\n let playBtn\n\n if (!showPlayBtn) {\n playBtn = null\n } else if (isPlaying) {\n playBtn = <div class='taro-video-control-button taro-video-control-button-pause' onClick={pauseFunc} />\n } else {\n playBtn = <div class='taro-video-control-button taro-video-control-button-play' onClick={playFunc} />\n }\n\n return (\n <Host class='taro-video-bar taro-video-bar-full'>\n {controls && (\n <div class='taro-video-controls'>\n {playBtn}\n {showProgress && (\n <div class='taro-video-current-time' ref={dom => (this.currentTimeRef = dom as HTMLDivElement)}>\n {formatTime(currentTime)}\n </div>\n )}\n {showProgress && (\n <div class='taro-video-progress-container' onClick={this.onClickProgress}>\n <div\n class='taro-video-progress'\n ref={ref => {\n if (!ref) return\n const rect = ref.getBoundingClientRect()\n this.progressDimensions.left = rect.left\n this.progressDimensions.width = rect.width\n }}>\n <div class='taro-video-progress-buffered' style={{ width: '100%' }} />\n <div\n class='taro-video-ball'\n ref={dom => (this.progressBallRef = dom as HTMLDivElement)}\n onTouchStart={this.onDragProgressBallStart}\n style={{\n left: `${formattedDuration ? (this.currentTime / duration) * 100 : 0}%`\n }}\n >\n <div class='taro-video-inner' />\n </div>\n </div>\n </div>\n )}\n {showProgress && <div class='taro-video-duration'>{formattedDuration}</div>}\n </div>\n )}\n <slot />\n </Host>\n )\n }\n}\n"],"version":3}
@@ -0,0 +1,110 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+
3
+ const VideoDanmu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.__registerHost();
7
+ this.list = [];
8
+ this.danmuElList = [];
9
+ this.currentTime = 0;
10
+ this.enable = false;
11
+ this.danmuList = [];
12
+ }
13
+ ensureProperties(danmu) {
14
+ const clonedDanmu = Object.assign({}, danmu);
15
+ if (!('time' in danmu)) {
16
+ clonedDanmu.time = this.currentTime;
17
+ }
18
+ clonedDanmu.key = Math.random();
19
+ clonedDanmu.bottom = `${Math.random() * 90 + 5}%`;
20
+ return clonedDanmu;
21
+ }
22
+ async sendDanmu(danmuList = []) {
23
+ if (Array.isArray(danmuList)) {
24
+ this.list = [
25
+ ...this.list,
26
+ ...danmuList.map(danmu => this.ensureProperties(danmu))
27
+ ];
28
+ }
29
+ else {
30
+ const danmu = danmuList;
31
+ this.list = [
32
+ ...this.list,
33
+ Object.assign({}, this.ensureProperties(danmu))
34
+ ];
35
+ }
36
+ }
37
+ async tick(currentTime) {
38
+ this.currentTime = currentTime;
39
+ if (!this.enable)
40
+ return;
41
+ const danmuList = this.list;
42
+ /**
43
+ * @todo 这个判断对拖拽进度的处理不严谨
44
+ */
45
+ const newDanmuList = danmuList.filter(({ time }) => {
46
+ return currentTime - time < 4 && currentTime > time;
47
+ });
48
+ let shouldUpdate = false;
49
+ const oldDanmuList = this.danmuList;
50
+ if (newDanmuList.length !== oldDanmuList.length) {
51
+ shouldUpdate = true;
52
+ }
53
+ else {
54
+ shouldUpdate = newDanmuList.some(({ key }) => {
55
+ return oldDanmuList.every((danmu) => {
56
+ return key !== danmu.key;
57
+ });
58
+ });
59
+ }
60
+ if (shouldUpdate) {
61
+ this.danmuList = newDanmuList;
62
+ }
63
+ }
64
+ componentDidUpdate() {
65
+ requestAnimationFrame(() => {
66
+ setTimeout(() => {
67
+ const danmuElList = this.danmuElList.splice(0);
68
+ danmuElList.forEach(danmu => {
69
+ danmu.style.left = '0';
70
+ danmu.style.webkitTransform = 'translateX(-100%)';
71
+ danmu.style.transform = 'translateX(-100%)';
72
+ });
73
+ });
74
+ });
75
+ }
76
+ render() {
77
+ if (!this.enable)
78
+ return '';
79
+ return (h(Host, { class: 'taro-video-danmu' }, this.danmuList.map(({ text, color, bottom, key }) => (h("p", { class: 'taro-video-danmu-item', key: key, style: {
80
+ color,
81
+ bottom
82
+ }, ref: ref => {
83
+ if (ref) {
84
+ this.danmuElList.push(ref);
85
+ }
86
+ } }, text)))));
87
+ }
88
+ }, [0, "taro-video-danmu", {
89
+ "enable": [4],
90
+ "danmuList": [32],
91
+ "sendDanmu": [64],
92
+ "tick": [64]
93
+ }]);
94
+ function defineCustomElement() {
95
+ if (typeof customElements === "undefined") {
96
+ return;
97
+ }
98
+ const components = ["taro-video-danmu"];
99
+ components.forEach(tagName => { switch (tagName) {
100
+ case "taro-video-danmu":
101
+ if (!customElements.get(tagName)) {
102
+ customElements.define(tagName, VideoDanmu);
103
+ }
104
+ break;
105
+ } });
106
+ }
107
+
108
+ export { VideoDanmu as V, defineCustomElement as d };
109
+
110
+ //# sourceMappingURL=video-danmu.js.map
@@ -0,0 +1 @@
1
+ {"file":"video-danmu.js","mappings":";;MAaa,UAAU;;;;IACb,SAAI,GAAY,EAAE,CAAA;IAClB,gBAAW,GAA2B,EAAE,CAAA;IACxC,gBAAW,GAAG,CAAC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;SAC3B;OACF,IAEA,IAAI,CACH,CACL,CAAC,CACG,EACR;GACF;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/video/video-danmu.tsx"],"sourcesContent":["import { Component, h, ComponentInterface, Prop, State, Host, Method } from '@stencil/core'\n\nexport interface Danmu {\n text: string\n color: string\n time: number,\n key: number,\n bottom: string\n}\n\n@Component({\n tag: 'taro-video-danmu'\n})\nexport class VideoDanmu implements ComponentInterface {\n private list: Danmu[] = []\n private danmuElList: HTMLParagraphElement[] = []\n private currentTime = 0\n\n @Prop() enable = false\n\n @State() danmuList: Danmu[] = []\n\n ensureProperties (danmu: Partial<Danmu>): Danmu {\n const clonedDanmu = { ...danmu } as Danmu\n if (!('time' in danmu)) {\n clonedDanmu.time = this.currentTime\n }\n clonedDanmu.key = Math.random()\n clonedDanmu.bottom = `${Math.random() * 90 + 5}%`\n return clonedDanmu\n }\n\n @Method()\n async sendDanmu (danmuList: Partial<Danmu> | Partial<Danmu>[] = []) {\n if (Array.isArray(danmuList)) {\n this.list = [\n ...this.list,\n ...danmuList.map(danmu => this.ensureProperties(danmu))\n ]\n } else {\n const danmu = danmuList\n this.list = [\n ...this.list,\n { ...this.ensureProperties(danmu) }\n ]\n }\n }\n\n @Method()\n async tick (currentTime: number) {\n this.currentTime = currentTime\n\n if (!this.enable) return\n\n const danmuList = this.list\n\n /**\n * @todo 这个判断对拖拽进度的处理不严谨\n */\n const newDanmuList = danmuList.filter(({ time }) => {\n return currentTime - time < 4 && currentTime > time\n })\n let shouldUpdate = false\n const oldDanmuList = this.danmuList\n\n if (newDanmuList.length !== oldDanmuList.length) {\n shouldUpdate = true\n } else {\n shouldUpdate = newDanmuList.some(({ key }) => {\n return oldDanmuList.every((danmu) => {\n return key !== danmu.key\n })\n })\n }\n if (shouldUpdate) {\n this.danmuList = newDanmuList\n }\n }\n\n componentDidUpdate () {\n requestAnimationFrame(() => {\n setTimeout(() => {\n const danmuElList = this.danmuElList.splice(0)\n danmuElList.forEach(danmu => {\n danmu.style.left = '0'\n danmu.style.webkitTransform = 'translateX(-100%)'\n danmu.style.transform = 'translateX(-100%)'\n })\n })\n })\n }\n\n render () {\n if (!this.enable) return ''\n\n return (\n <Host class='taro-video-danmu'>\n {this.danmuList.map(({ text, color, bottom, key }) => (\n <p\n class='taro-video-danmu-item'\n key={key}\n style={{\n color,\n bottom\n }}\n ref={ref => {\n if (ref) {\n this.danmuElList.push(ref)\n }\n }}\n >\n {text}\n </p>\n ))}\n </Host>\n )\n }\n}\n"],"version":3}
@@ -9882,11 +9882,9 @@ const Swiper = class {
9882
9882
  this.handleSwiperLoop = debounce(() => {
9883
9883
  if (this.swiper && this.circular) {
9884
9884
  // @ts-ignore
9885
- this.swiper.loopDestroy();
9886
- // @ts-ignore
9887
- this.swiper.loopCreate();
9885
+ this.swiper.loopFix();
9888
9886
  }
9889
- }, 500);
9887
+ }, 50);
9890
9888
  this.handleSwiperSize = debounce(() => {
9891
9889
  if (this.swiper && !this.circular) {
9892
9890
  this.swiper.updateSlides();
@@ -10043,7 +10041,7 @@ const Swiper = class {
10043
10041
  slideChangeTransitionStart(_swiper) {
10044
10042
  if (that.circular) {
10045
10043
  if (_swiper.isBeginning || _swiper.isEnd) {
10046
- _swiper.slideToLoop(this.realIndex, 0); // 更新下标
10044
+ // _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
10047
10045
  return;
10048
10046
  }
10049
10047
  }