pixuireactcomponents 1.2.0 → 1.2.2

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 (400) hide show
  1. package/README.md +5 -6
  2. package/package.json +9 -66
  3. package/tsconfig.json +27 -13
  4. package/{src/pixUIReactComponents/ui → ui}/components/slapface/Slapface.tsx +17 -17
  5. package/ui/sample/Slapface/SlapfaceDemo.tsx +30 -0
  6. package/.eslintignore +0 -7
  7. package/.eslintrc.js +0 -48
  8. package/.pixiderc/apps.json +0 -12
  9. package/.pixiderc/devel-config.meta.json +0 -23
  10. package/.pixiderc/postinstall.js +0 -17
  11. package/.pixiderc/util.js +0 -136
  12. package/.pixiderc/webpack.js +0 -180
  13. package/faas/helloworld.js +0 -8
  14. package/gen/pbo/pandora_pb.d.ts +0 -1179
  15. package/gen/pbo/pandora_pb.js +0 -10475
  16. package/gen/pbo/pandora_pb_service.d.ts +0 -1317
  17. package/gen/pbo/pandora_pb_service.js +0 -2307
  18. package/gen/pbo/test_pb.d.ts +0 -99
  19. package/gen/pbo/test_pb.js +0 -889
  20. package/gen/pbo/test_pb_service.d.ts +0 -82
  21. package/gen/pbo/test_pb_service.js +0 -117
  22. package/lib/assets/border.png +0 -0
  23. package/lib/assets/check.html +0 -54
  24. package/lib/assets/pixui.png +0 -0
  25. package/lib/assets/preact.png +0 -0
  26. package/lib/check/main.less +0 -63
  27. package/lib/check/main.tsx +0 -42
  28. package/lib/check/tool.js +0 -3
  29. package/lib/check/util.tsx +0 -107
  30. package/lib/dom.ts +0 -16
  31. package/lib/ext.d.ts +0 -95
  32. package/lib/grpc-web/dist/ChunkParser.js +0 -115
  33. package/lib/grpc-web/dist/ChunkParser.js.map +0 -1
  34. package/lib/grpc-web/dist/Code.js +0 -58
  35. package/lib/grpc-web/dist/Code.js.map +0 -1
  36. package/lib/grpc-web/dist/client.js +0 -299
  37. package/lib/grpc-web/dist/client.js.map +0 -1
  38. package/lib/grpc-web/dist/debug.js +0 -16
  39. package/lib/grpc-web/dist/debug.js.map +0 -1
  40. package/lib/grpc-web/dist/detach.js +0 -7
  41. package/lib/grpc-web/dist/detach.js.map +0 -1
  42. package/lib/grpc-web/dist/index.js +0 -29
  43. package/lib/grpc-web/dist/index.js.map +0 -1
  44. package/lib/grpc-web/dist/invoke.js +0 -32
  45. package/lib/grpc-web/dist/invoke.js.map +0 -1
  46. package/lib/grpc-web/dist/message.js +0 -3
  47. package/lib/grpc-web/dist/message.js.map +0 -1
  48. package/lib/grpc-web/dist/metadata.js +0 -5
  49. package/lib/grpc-web/dist/metadata.js.map +0 -1
  50. package/lib/grpc-web/dist/service.js +0 -3
  51. package/lib/grpc-web/dist/service.js.map +0 -1
  52. package/lib/grpc-web/dist/transports/Transport.js +0 -13
  53. package/lib/grpc-web/dist/transports/Transport.js.map +0 -1
  54. package/lib/grpc-web/dist/transports/http/fetch.js +0 -112
  55. package/lib/grpc-web/dist/transports/http/fetch.js.map +0 -1
  56. package/lib/grpc-web/dist/transports/http/http.js +0 -15
  57. package/lib/grpc-web/dist/transports/http/http.js.map +0 -1
  58. package/lib/grpc-web/dist/transports/http/xhr.js +0 -127
  59. package/lib/grpc-web/dist/transports/http/xhr.js.map +0 -1
  60. package/lib/grpc-web/dist/transports/http/xhrUtil.js +0 -37
  61. package/lib/grpc-web/dist/transports/http/xhrUtil.js.map +0 -1
  62. package/lib/grpc-web/dist/transports/websocket/websocket.js +0 -95
  63. package/lib/grpc-web/dist/transports/websocket/websocket.js.map +0 -1
  64. package/lib/grpc-web/dist/typings/ChunkParser.d.ts +0 -17
  65. package/lib/grpc-web/dist/typings/Code.d.ts +0 -20
  66. package/lib/grpc-web/dist/typings/client.d.ts +0 -22
  67. package/lib/grpc-web/dist/typings/debug.d.ts +0 -1
  68. package/lib/grpc-web/dist/typings/detach.d.ts +0 -1
  69. package/lib/grpc-web/dist/typings/index.d.ts +0 -60
  70. package/lib/grpc-web/dist/typings/invoke.d.ts +0 -17
  71. package/lib/grpc-web/dist/typings/message.d.ts +0 -8
  72. package/lib/grpc-web/dist/typings/metadata.d.ts +0 -2
  73. package/lib/grpc-web/dist/typings/service.d.ts +0 -16
  74. package/lib/grpc-web/dist/typings/transports/Transport.d.ts +0 -22
  75. package/lib/grpc-web/dist/typings/transports/http/fetch.d.ts +0 -6
  76. package/lib/grpc-web/dist/typings/transports/http/http.d.ts +0 -5
  77. package/lib/grpc-web/dist/typings/transports/http/xhr.d.ts +0 -27
  78. package/lib/grpc-web/dist/typings/transports/http/xhrUtil.d.ts +0 -3
  79. package/lib/grpc-web/dist/typings/transports/websocket/websocket.d.ts +0 -2
  80. package/lib/grpc-web/dist/typings/unary.d.ts +0 -20
  81. package/lib/grpc-web/dist/typings/util.d.ts +0 -2
  82. package/lib/grpc-web/dist/unary.js +0 -44
  83. package/lib/grpc-web/dist/unary.js.map +0 -1
  84. package/lib/grpc-web/dist/util.js +0 -11
  85. package/lib/grpc-web/dist/util.js.map +0 -1
  86. package/lib/grpcTransport/PixHttp2Transport.ts +0 -104
  87. package/lib/grpcTransport/PixLuaTransport.ts +0 -80
  88. package/lib/pi_component/tinyList/tinyList.js +0 -573
  89. package/lib/pi_component/tinyList/tinyList.tsx +0 -586
  90. package/lib/preact/compat/src/Children.js +0 -26
  91. package/lib/preact/compat/src/PureComponent.js +0 -19
  92. package/lib/preact/compat/src/events.js +0 -36
  93. package/lib/preact/compat/src/forwardRef.js +0 -29
  94. package/lib/preact/compat/src/index.d.ts +0 -121
  95. package/lib/preact/compat/src/index.js +0 -159
  96. package/lib/preact/compat/src/internal.d.ts +0 -45
  97. package/lib/preact/compat/src/memo.js +0 -34
  98. package/lib/preact/compat/src/portals.js +0 -85
  99. package/lib/preact/compat/src/render.js +0 -166
  100. package/lib/preact/compat/src/suspense-list.d.ts +0 -14
  101. package/lib/preact/compat/src/suspense-list.js +0 -127
  102. package/lib/preact/compat/src/suspense.d.ts +0 -15
  103. package/lib/preact/compat/src/suspense.js +0 -165
  104. package/lib/preact/compat/src/util.js +0 -23
  105. package/lib/preact/hooks/src/index.d.ts +0 -133
  106. package/lib/preact/hooks/src/index.js +0 -339
  107. package/lib/preact/hooks/src/internal.d.ts +0 -55
  108. package/lib/preact/src/clone-element.js +0 -27
  109. package/lib/preact/src/compat.ts +0 -0
  110. package/lib/preact/src/component.js +0 -219
  111. package/lib/preact/src/constants.js +0 -3
  112. package/lib/preact/src/create-context.js +0 -55
  113. package/lib/preact/src/create-element.js +0 -102
  114. package/lib/preact/src/css.d.ts +0 -30341
  115. package/lib/preact/src/diff/catch-error.js +0 -41
  116. package/lib/preact/src/diff/children.js +0 -259
  117. package/lib/preact/src/diff/index.js +0 -445
  118. package/lib/preact/src/diff/props.js +0 -163
  119. package/lib/preact/src/index.d.ts +0 -275
  120. package/lib/preact/src/index.js +0 -14
  121. package/lib/preact/src/internal.d.ts +0 -94
  122. package/lib/preact/src/jsx.d.ts +0 -884
  123. package/lib/preact/src/options.js +0 -16
  124. package/lib/preact/src/render.js +0 -98
  125. package/lib/preact/src/util.js +0 -25
  126. package/lib/preact-router/.travis.yml +0 -3
  127. package/lib/preact-router/LICENSE +0 -21
  128. package/lib/preact-router/README.md +0 -254
  129. package/lib/preact-router/index.d.ts +0 -71
  130. package/lib/preact-router/match/index.d.ts +0 -16
  131. package/lib/preact-router/match/package.json +0 -13
  132. package/lib/preact-router/match/src/cjs.js +0 -4
  133. package/lib/preact-router/match/src/index.js +0 -36
  134. package/lib/preact-router/package-lock.json +0 -12330
  135. package/lib/preact-router/package.json +0 -78
  136. package/lib/preact-router/src/cjs.js +0 -11
  137. package/lib/preact-router/src/index.js +0 -270
  138. package/lib/preact-router/src/util.js +0 -87
  139. package/lib/react-window/src/FixedSizeGrid.js +0 -244
  140. package/lib/react-window/src/FixedSizeList.js +0 -130
  141. package/lib/react-window/src/VariableSizeGrid.js +0 -507
  142. package/lib/react-window/src/VariableSizeList.js +0 -316
  143. package/lib/react-window/src/__tests__/FixedSizeGrid.js +0 -1336
  144. package/lib/react-window/src/__tests__/FixedSizeList.js +0 -966
  145. package/lib/react-window/src/__tests__/VariableSizeGrid.js +0 -779
  146. package/lib/react-window/src/__tests__/VariableSizeList.js +0 -442
  147. package/lib/react-window/src/__tests__/__snapshots__/FixedSizeGrid.js.snap +0 -912
  148. package/lib/react-window/src/__tests__/__snapshots__/FixedSizeList.js.snap +0 -568
  149. package/lib/react-window/src/__tests__/__snapshots__/VariableSizeGrid.js.snap +0 -542
  150. package/lib/react-window/src/__tests__/__snapshots__/VariableSizeList.js.snap +0 -331
  151. package/lib/react-window/src/__tests__/areEqual.js +0 -32
  152. package/lib/react-window/src/__tests__/shouldComponentUpdate.js +0 -36
  153. package/lib/react-window/src/areEqual.js +0 -18
  154. package/lib/react-window/src/createGridComponent.js +0 -919
  155. package/lib/react-window/src/createListComponent.js +0 -729
  156. package/lib/react-window/src/domHelpers.js +0 -72
  157. package/lib/react-window/src/index.js +0 -9
  158. package/lib/react-window/src/shallowDiffers.js +0 -17
  159. package/lib/react-window/src/shouldComponentUpdate.js +0 -16
  160. package/lib/react-window/src/test.js.flow +0 -382
  161. package/lib/react-window/src/timer.js +0 -36
  162. package/src/app/demopage.tsx +0 -77
  163. package/src/app/index.html +0 -48
  164. package/src/app/main.tsx +0 -30
  165. package/src/asset/Textures/Alert/bg_tips.png +0 -0
  166. package/src/asset/Textures/Alert/btn_zhedie_a.png +0 -0
  167. package/src/asset/Textures/Alert/com_home_bg_left.png +0 -0
  168. package/src/asset/Textures/Alert/com_home_bg_rightbar.png +0 -0
  169. package/src/asset/Textures/Commons/com_home_bg_a.png +0 -0
  170. package/src/asset/Textures/Commons/com_home_bg_back_top.png +0 -0
  171. package/src/asset/Textures/Commons/com_home_bg_bottombar_sheet.png +0 -0
  172. package/src/asset/Textures/Commons/com_home_bg_list_xiala.png +0 -0
  173. package/src/asset/Textures/Commons/com_home_bg_rightbar_line.png +0 -0
  174. package/src/asset/Textures/Commons/com_home_bg_rightbar_selected.png +0 -0
  175. package/src/asset/Textures/Commons/com_home_bg_touxiang_140.png +0 -0
  176. package/src/asset/Textures/Commons/com_home_bg_touxiang_60.png +0 -0
  177. package/src/asset/Textures/Commons/com_home_bg_touxiang_80.png +0 -0
  178. package/src/asset/Textures/Commons/com_home_btn_back.png +0 -0
  179. package/src/asset/Textures/Commons/com_home_btn_bottombar.png +0 -0
  180. package/src/asset/Textures/Commons/com_home_btn_bottombar_fadongtai.png +0 -0
  181. package/src/asset/Textures/Commons/com_home_btn_close.png +0 -0
  182. package/src/asset/Textures/Commons/com_home_btn_guanzhu_126.png +0 -0
  183. package/src/asset/Textures/Commons/com_home_btn_guanzhu_86.png +0 -0
  184. package/src/asset/Textures/Commons/com_home_btn_left_bianji.png +0 -0
  185. package/src/asset/Textures/Commons/com_home_btn_left_dongtai.png +0 -0
  186. package/src/asset/Textures/Commons/com_home_btn_left_touxiang.png +0 -0
  187. package/src/asset/Textures/Commons/com_home_btn_selet.png +0 -0
  188. package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_126.png +0 -0
  189. package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_86.png +0 -0
  190. package/src/asset/Textures/Commons/com_home_icon_bottombar_fadongtai.png +0 -0
  191. package/src/asset/Textures/Commons/com_home_icon_bottombar_red.png +0 -0
  192. package/src/asset/Textures/Commons/com_home_icon_loading.png +0 -0
  193. package/src/asset/Textures/Commons/com_home_pic_touxiang_moren.png +0 -0
  194. package/src/asset/Textures/Commons/com_home_tab_left_a.png +0 -0
  195. package/src/asset/Textures/Commons/com_home_tab_left_b.png +0 -0
  196. package/src/asset/Textures/Commons/com_home_tab_left_c.png +0 -0
  197. package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_v.png +0 -0
  198. package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_yonghurenzheng.png +0 -0
  199. package/src/asset/Textures/Commons/feedItems/pinglun_bg.png +0 -0
  200. package/src/asset/Textures/Commons/feedItems/pinglun_bg_line.png +0 -0
  201. package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_chakan.png +0 -0
  202. package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_input.png +0 -0
  203. package/src/asset/Textures/Commons/feedItems/pinglun_bg_zan.png +0 -0
  204. package/src/asset/Textures/Commons/feedItems/pinglun_btn_middle_input.png +0 -0
  205. package/src/asset/Textures/Commons/feedItems/pinglun_btn_more.png +0 -0
  206. package/src/asset/Textures/Commons/feedItems/pinglun_btn_normal.png +0 -0
  207. package/src/asset/Textures/Commons/feedItems/pinglun_btn_photo_more.png +0 -0
  208. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a.png +0 -0
  209. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a_shadow.png +0 -0
  210. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_normal.png +0 -0
  211. package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_pressed.png +0 -0
  212. package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_normal.png +0 -0
  213. package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_pressed.png +0 -0
  214. package/src/asset/Textures/Commons/feedItems/pinglun_icon_b_normal.png +0 -0
  215. package/src/asset/Textures/Commons/feedItems/pinglun_icon_c_normal.png +0 -0
  216. package/src/asset/Textures/Commons/feedItems/pinglun_icon_d.png +0 -0
  217. package/src/asset/Textures/Commons/feedItems/pinglun_icon_e.png +0 -0
  218. package/src/asset/Textures/Commons/feedItems/pinglun_icon_f_share.png +0 -0
  219. package/src/asset/Textures/Commons/feedItems/pinglun_icon_middle_input_back.png +0 -0
  220. package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn.png +0 -0
  221. package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn_pressd.png +0 -0
  222. package/src/asset/Textures/Commons/karaoke/rukou_bg_music.png +0 -0
  223. package/src/asset/Textures/Commons/karaoke/rukou_btn_a.png +0 -0
  224. package/src/asset/Textures/Commons/karaoke/rukou_btn_b.png +0 -0
  225. package/src/asset/Textures/Commons/karaoke/rukou_icon_b.png +0 -0
  226. package/src/asset/Textures/Commons/karaoke/rukou_icon_d.png +0 -0
  227. package/src/asset/Textures/Commons/karaoke/rukou_icon_e.png +0 -0
  228. package/src/asset/Textures/Commons/rukou_bg_bottombar_line.png +0 -0
  229. package/src/asset/Textures/Commons/rukou_icon_a.png +0 -0
  230. package/src/asset/Textures/Commons/tc_bianji_tab_a.png +0 -0
  231. package/src/asset/Textures/Commons/tc_zanshang_bg_line.png +0 -0
  232. package/src/asset/Textures/Commons/touxiang_bg_tishikuang.png +0 -0
  233. package/src/asset/Textures/Commons/video/rukou_icon_shipin.png +0 -0
  234. package/src/asset/Textures/Commons/video/xiangce_btn_bofang.png +0 -0
  235. package/src/asset/Textures/Commons/voice/rukou_icon_yuyin.png +0 -0
  236. package/src/asset/Textures/Commons/voice/tc_yuyin_bg.png +0 -0
  237. package/src/asset/Textures/Commons/voice/tc_yuyin_bg_load.png +0 -0
  238. package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_a.png +0 -0
  239. package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_b.png +0 -0
  240. package/src/asset/Textures/Commons/xiangce_icon_bottombar_gulita.png +0 -0
  241. package/src/asset/Textures/SocialSecond/com_tc_bg.png +0 -0
  242. package/src/asset/Textures/SocialSecond/com_tc_bg_bottom.png +0 -0
  243. package/src/asset/Textures/SocialSecond/com_tc_bg_input.png +0 -0
  244. package/src/asset/Textures/SocialSecond/com_tc_bg_tips.png +0 -0
  245. package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_a.png +0 -0
  246. package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_line.png +0 -0
  247. package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo.png +0 -0
  248. package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo_line.png +0 -0
  249. package/src/asset/Textures/SocialSecond/com_tc_bg_zhaopian_line.png +0 -0
  250. package/src/asset/Textures/SocialSecond/com_tc_btn.png +0 -0
  251. package/src/asset/Textures/SocialSecond/com_tc_btn_close.png +0 -0
  252. package/src/asset/Textures/SocialSecond/com_tc_btn_upload_photo.png +0 -0
  253. package/src/asset/Textures/SocialSecond/com_tc_radio_normal.png +0 -0
  254. package/src/asset/Textures/SocialSecond/com_tc_radio_normal_@slice_0.png +0 -0
  255. package/src/asset/Textures/SocialSecond/com_tc_radio_selected.png +0 -0
  256. package/src/asset/Textures/SocialSecond/com_tc_tab_a.png +0 -0
  257. package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar.png +0 -0
  258. package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar_pre.png +0 -0
  259. package/src/asset/Textures/SocialSecond/newmessage_bg_left_line.png +0 -0
  260. package/src/asset/Textures/SocialSecond/newmessage_bg_left_normal.png +0 -0
  261. package/src/asset/Textures/SocialSecond/newmessage_bg_left_selected.png +0 -0
  262. package/src/asset/Textures/SocialSecond/newmessage_bg_middle_new.png +0 -0
  263. package/src/asset/Textures/SocialSecond/paihang_bg_list.png +0 -0
  264. package/src/asset/Textures/SocialSecond/paihang_bg_list_line.png +0 -0
  265. package/src/asset/Textures/SocialSecond/paihang_bg_list_my.png +0 -0
  266. package/src/asset/Textures/SocialSecond/paihang_bg_list_top.png +0 -0
  267. package/src/asset/Textures/SocialSecond/paihang_bg_topbar_a.png +0 -0
  268. package/src/asset/Textures/SocialSecond/paihang_icon_topbar_selected.png +0 -0
  269. package/src/asset/Textures/SocialSecond/paihang_pic_1.png +0 -0
  270. package/src/asset/Textures/SocialSecond/paihang_pic_2.png +0 -0
  271. package/src/asset/Textures/SocialSecond/tc_fadongtai_btn_close.png +0 -0
  272. package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar.png +0 -0
  273. package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar_selected.png +0 -0
  274. package/src/asset/Textures/SocialSecond/tc_liwu_bg.png +0 -0
  275. package/src/asset/Textures/SocialSecond/tc_liwu_bg_daoju.png +0 -0
  276. package/src/asset/Textures/SocialSecond/tc_liwu_btn_a.png +0 -0
  277. package/src/asset/Textures/SocialSecond/tc_liwu_btn_b.png +0 -0
  278. package/src/asset/Textures/SocialSecond/tc_liwu_btn_c.png +0 -0
  279. package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju1.png +0 -0
  280. package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju2.png +0 -0
  281. package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju3.png +0 -0
  282. package/src/asset/Textures/SocialSecond/tc_pinglun_bg.png +0 -0
  283. package/src/asset/Textures/SocialSecond/tc_shipin_tianjiashipin.png +0 -0
  284. package/src/asset/Textures/SocialSecond/tc_yuyin_bg.png +0 -0
  285. package/src/asset/Textures/SocialSecond/tc_yuyin_bg_delete.png +0 -0
  286. package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_a.png +0 -0
  287. package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_b.png +0 -0
  288. package/src/asset/Textures/SocialSecond/tc_yuyin_star.png +0 -0
  289. package/src/asset/Textures/SocialSecond/tc_yuyin_stop.png +0 -0
  290. package/src/asset/Textures/SocialSecond/tc_zanshang_bg_line.png +0 -0
  291. package/src/asset/Textures/SocialSecond/touxiang_bg_tishikuang.png +0 -0
  292. package/src/asset/Textures/SocialSecond/xiangce_huadong.png +0 -0
  293. package/src/asset/Textures/SocialSecond/xiangce_huadong_xuanzhong.png +0 -0
  294. package/src/asset/Textures/SocialSecond/xiangce_icon_xiazai.png +0 -0
  295. package/src/asset/Textures/SocialVideo/com_home_btn_close.png +0 -0
  296. package/src/asset/Textures/SocialVideo/tc_shipin_bg_guodu.png +0 -0
  297. package/src/asset/Textures/SocialVideo/tc_shipin_jinduanjian.png +0 -0
  298. package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao.png +0 -0
  299. package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao_hui.png +0 -0
  300. package/src/asset/Textures/SocialVideo/tc_shipin_play.png +0 -0
  301. package/src/asset/Textures/SocialVideo/tc_shipin_play_big.png +0 -0
  302. package/src/asset/Textures/SocialVideo/tc_shipin_stop.png +0 -0
  303. package/src/asset/laugh.gif +0 -0
  304. package/src/asset/npms.png +0 -0
  305. package/src/asset/pixui.png +0 -0
  306. package/src/asset/preact.png +0 -0
  307. package/src/asset/template.html +0 -47
  308. package/src/common/frame/appsettings.js +0 -111
  309. package/src/common/frame/common.js +0 -17
  310. package/src/common/frame/platform-api-callback.js +0 -341
  311. package/src/common/frame/platform-api.d.ts +0 -156
  312. package/src/common/frame/platform-api.js +0 -479
  313. package/src/common/main.less +0 -119
  314. package/src/pixUIReactComponents/README.md +0 -8
  315. package/src/pixUIReactComponents/package.json +0 -11
  316. package/src/pixUIReactComponents/tsconfig.json +0 -45
  317. package/src/pixUIReactComponents/ui/sample/Slapface/SlapfaceDemo.tsx +0 -30
  318. package/src/pixUIReactUtils/GenerateConstructorAndGeterSeter.js +0 -227
  319. package/src/pixUIReactUtils/MakeImage.js +0 -207
  320. package/src/pixUIReactUtils/README.md +0 -124
  321. package/src/pixUIReactUtils/Version.js +0 -3
  322. package/src/pixUIReactUtils/img/makeImage.png +0 -0
  323. package/src/pixUIReactUtils/index.js +0 -1
  324. package/src/pixUIReactUtils/package.json +0 -16
  325. package/src/preprocess/index.html +0 -48
  326. package/src/preprocess/main.tsx +0 -17
  327. package/src/preprocess/preprocesspage.tsx +0 -41
  328. /package/{src/pixUIReactComponents/cmdAfterTsBuild.js → cmdAfterTsBuild.js} +0 -0
  329. /package/{src/pixUIReactComponents/index.js → index.js} +0 -0
  330. /package/{src/pixUIReactComponents/tools → tools}/EventDispatcherJs.tsx +0 -0
  331. /package/{src/pixUIReactComponents/tools → tools}/Logger.tsx +0 -0
  332. /package/{src/pixUIReactComponents/tools → tools}/img/logger.png +0 -0
  333. /package/{src/pixUIReactComponents/tools → tools}/tools.md +0 -0
  334. /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletItemAnimation.tsx +0 -0
  335. /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletScreenAnimation.tsx +0 -0
  336. /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/bullet.less +0 -0
  337. /package/{src/pixUIReactComponents/ui → ui}/components/button/Button.tsx +0 -0
  338. /package/{src/pixUIReactComponents/ui → ui}/components/carousel/Carousel.tsx +0 -0
  339. /package/{src/pixUIReactComponents/ui → ui}/components/checkBox/CheckBox.tsx +0 -0
  340. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/Dropdown.tsx +0 -0
  341. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownOptionUI.tsx +0 -0
  342. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownSpreadMainUI.tsx +0 -0
  343. /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownUnspreadMainUI.tsx +0 -0
  344. /package/{src/pixUIReactComponents/ui → ui}/components/gradient/GradientText.tsx +0 -0
  345. /package/{src/pixUIReactComponents/ui → ui}/components/outlinetext/OutlineText.tsx +0 -0
  346. /package/{src/pixUIReactComponents/ui → ui}/components/progress/Progress.tsx +0 -0
  347. /package/{src/pixUIReactComponents/ui → ui}/components/slapface/less/Slapface.less +0 -0
  348. /package/{src/pixUIReactComponents/ui → ui}/components/slider/Slider.tsx +0 -0
  349. /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tab.tsx +0 -0
  350. /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tabs.tsx +0 -0
  351. /package/{src/pixUIReactComponents/ui → ui}/components/togglegroup/ToggleGroup.tsx +0 -0
  352. /package/{src/pixUIReactComponents/ui → ui}/components/videoplayer/VideoPlayer.tsx +0 -0
  353. /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/WaterfallComponent.jsx +0 -0
  354. /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/less/WaterfallComponent.less +0 -0
  355. /package/{src/pixUIReactComponents/ui → ui}/sample/Images.tsx +0 -0
  356. /package/{src/pixUIReactComponents/ui → ui}/sample/OutlineText/OutlineDemo.tsx +0 -0
  357. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/btn_close.png +0 -0
  358. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/changtai_button.jpg +0 -0
  359. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox0.png +0 -0
  360. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox1.png +0 -0
  361. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_down.png +0 -0
  362. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_up.png +0 -0
  363. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/dot.png +0 -0
  364. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/inner.png +0 -0
  365. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/item_reddot.png +0 -0
  366. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/loading.png +0 -0
  367. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdown.png +0 -0
  368. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdownall.png +0 -0
  369. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/outer.png +0 -0
  370. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic1.png +0 -0
  371. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic2.png +0 -0
  372. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic3.png +0 -0
  373. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic4.png +0 -0
  374. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic5.png +0 -0
  375. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic6.png +0 -0
  376. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tab_choosed.png +0 -0
  377. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tabs_bg.png +0 -0
  378. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_pause.png +0 -0
  379. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_play.png +0 -0
  380. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_reload.png +0 -0
  381. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/xuanfu_button.jpg +0 -0
  382. /package/{src/pixUIReactComponents/ui → ui}/sample/asset/yaxia_button.jpg +0 -0
  383. /package/{src/pixUIReactComponents/ui → ui}/sample/bulletscreen/BulletDemo.tsx +0 -0
  384. /package/{src/pixUIReactComponents/ui → ui}/sample/button/ButtonDemo.tsx +0 -0
  385. /package/{src/pixUIReactComponents/ui → ui}/sample/carousel/carouselDemo.tsx +0 -0
  386. /package/{src/pixUIReactComponents/ui → ui}/sample/checkBox/checkBoxDemo.tsx +0 -0
  387. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/DropdownDemo.tsx +0 -0
  388. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownOption.tsx +0 -0
  389. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownSpreadMain.tsx +0 -0
  390. /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownUnspreadMain.tsx +0 -0
  391. /package/{src/pixUIReactComponents/ui → ui}/sample/gradient/GradientDemo.tsx +0 -0
  392. /package/{src/pixUIReactComponents/ui → ui}/sample/less/video.less +0 -0
  393. /package/{src/pixUIReactComponents/ui → ui}/sample/progress/ProgressDemo.tsx +0 -0
  394. /package/{src/pixUIReactComponents/ui → ui}/sample/slider/SliderDemo.tsx +0 -0
  395. /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TabDemo.tsx +0 -0
  396. /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TopTab.tsx +0 -0
  397. /package/{src/pixUIReactComponents/ui → ui}/sample/togglegroup/ToggleGroupDemo.tsx +0 -0
  398. /package/{src/pixUIReactComponents/ui → ui}/sample/videoplayer/VideoPlayerDemo.tsx +0 -0
  399. /package/{src/pixUIReactComponents/ui → ui}/sample/waterfallcomponent/WaterfallComponentDemo.jsx +0 -0
  400. /package/{src/pixUIReactComponents/ui → ui}/ui.md +0 -0
@@ -1,729 +0,0 @@
1
- // @flow
2
-
3
- import memoizeOne from 'memoize-one';
4
- import { createElement, PureComponent } from 'react';
5
- import { cancelTimeout, requestTimeout } from './timer';
6
- import { getRTLOffsetType } from './domHelpers';
7
-
8
- import type { TimeoutID } from './timer';
9
-
10
- export type ScrollToAlign = 'auto' | 'smart' | 'center' | 'start' | 'end';
11
-
12
- type itemSize = number | ((index: number) => number);
13
- // TODO Deprecate directions "horizontal" and "vertical"
14
- type Direction = 'ltr' | 'rtl' | 'horizontal' | 'vertical';
15
- type Layout = 'horizontal' | 'vertical';
16
-
17
- type RenderComponentProps<T> = {|
18
- data: T,
19
- index: number,
20
- isScrolling?: boolean,
21
- style: Object,
22
- |};
23
- type RenderComponent<T> = React$ComponentType<$Shape<RenderComponentProps<T>>>;
24
-
25
- type ScrollDirection = 'forward' | 'backward';
26
-
27
- type onItemsRenderedCallback = ({
28
- overscanStartIndex: number,
29
- overscanStopIndex: number,
30
- visibleStartIndex: number,
31
- visibleStopIndex: number,
32
- }) => void;
33
- type onScrollCallback = ({
34
- scrollDirection: ScrollDirection,
35
- scrollOffset: number,
36
- scrollUpdateWasRequested: boolean,
37
- }) => void;
38
-
39
- type ScrollEvent = SyntheticEvent<HTMLDivElement>;
40
- type ItemStyleCache = { [index: number]: Object };
41
-
42
- type OuterProps = {|
43
- children: React$Node,
44
- className: string | void,
45
- onScroll: ScrollEvent => void,
46
- style: {
47
- [string]: mixed,
48
- },
49
- |};
50
-
51
- type InnerProps = {|
52
- children: React$Node,
53
- style: {
54
- [string]: mixed,
55
- },
56
- |};
57
-
58
- export type Props<T> = {|
59
- children: RenderComponent<T>,
60
- className?: string,
61
- direction: Direction,
62
- height: number | string,
63
- initialScrollOffset?: number,
64
- innerRef?: any,
65
- innerElementType?: string | React$AbstractComponent<InnerProps, any>,
66
- innerTagName?: string, // deprecated
67
- itemCount: number,
68
- itemData: T,
69
- itemKey?: (index: number, data: T) => any,
70
- itemSize: itemSize,
71
- layout: Layout,
72
- onItemsRendered?: onItemsRenderedCallback,
73
- onScroll?: onScrollCallback,
74
- outerRef?: any,
75
- outerElementType?: string | React$AbstractComponent<OuterProps, any>,
76
- outerTagName?: string, // deprecated
77
- overscanCount: number,
78
- style?: Object,
79
- useIsScrolling: boolean,
80
- width: number | string,
81
- |};
82
-
83
- type State = {|
84
- instance: any,
85
- isScrolling: boolean,
86
- scrollDirection: ScrollDirection,
87
- scrollOffset: number,
88
- scrollUpdateWasRequested: boolean,
89
- |};
90
-
91
- type GetItemOffset = (
92
- props: Props<any>,
93
- index: number,
94
- instanceProps: any
95
- ) => number;
96
- type GetItemSize = (
97
- props: Props<any>,
98
- index: number,
99
- instanceProps: any
100
- ) => number;
101
- type GetEstimatedTotalSize = (props: Props<any>, instanceProps: any) => number;
102
- type GetOffsetForIndexAndAlignment = (
103
- props: Props<any>,
104
- index: number,
105
- align: ScrollToAlign,
106
- scrollOffset: number,
107
- instanceProps: any
108
- ) => number;
109
- type GetStartIndexForOffset = (
110
- props: Props<any>,
111
- offset: number,
112
- instanceProps: any
113
- ) => number;
114
- type GetStopIndexForStartIndex = (
115
- props: Props<any>,
116
- startIndex: number,
117
- scrollOffset: number,
118
- instanceProps: any
119
- ) => number;
120
- type InitInstanceProps = (props: Props<any>, instance: any) => any;
121
- type ValidateProps = (props: Props<any>) => void;
122
-
123
- const IS_SCROLLING_DEBOUNCE_INTERVAL = 150;
124
-
125
- const defaultItemKey = (index: number, data: any) => index;
126
-
127
- // In DEV mode, this Set helps us only log a warning once per component instance.
128
- // This avoids spamming the console every time a render happens.
129
- let devWarningsDirection = null;
130
- let devWarningsTagName = null;
131
- if (process.env.NODE_ENV !== 'production') {
132
- if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
133
- devWarningsDirection = new WeakSet();
134
- devWarningsTagName = new WeakSet();
135
- }
136
- }
137
-
138
- export default function createListComponent({
139
- getItemOffset,
140
- getEstimatedTotalSize,
141
- getItemSize,
142
- getOffsetForIndexAndAlignment,
143
- getStartIndexForOffset,
144
- getStopIndexForStartIndex,
145
- initInstanceProps,
146
- shouldResetStyleCacheOnItemSizeChange,
147
- validateProps,
148
- }: {|
149
- getItemOffset: GetItemOffset,
150
- getEstimatedTotalSize: GetEstimatedTotalSize,
151
- getItemSize: GetItemSize,
152
- getOffsetForIndexAndAlignment: GetOffsetForIndexAndAlignment,
153
- getStartIndexForOffset: GetStartIndexForOffset,
154
- getStopIndexForStartIndex: GetStopIndexForStartIndex,
155
- initInstanceProps: InitInstanceProps,
156
- shouldResetStyleCacheOnItemSizeChange: boolean,
157
- validateProps: ValidateProps,
158
- |}) {
159
- return class List<T> extends PureComponent<Props<T>, State> {
160
- _instanceProps: any = initInstanceProps(this.props, this);
161
- _outerRef: ?HTMLDivElement;
162
- _resetIsScrollingTimeoutId: TimeoutID | null = null;
163
-
164
- static defaultProps = {
165
- direction: 'ltr',
166
- itemData: undefined,
167
- layout: 'vertical',
168
- overscanCount: 2,
169
- useIsScrolling: false,
170
- };
171
-
172
- state: State = {
173
- instance: this,
174
- isScrolling: false,
175
- scrollDirection: 'forward',
176
- scrollOffset:
177
- typeof this.props.initialScrollOffset === 'number'
178
- ? this.props.initialScrollOffset
179
- : 0,
180
- scrollUpdateWasRequested: false,
181
- };
182
-
183
- // Always use explicit constructor for React components.
184
- // It produces less code after transpilation. (#26)
185
- // eslint-disable-next-line no-useless-constructor
186
- constructor(props: Props<T>) {
187
- super(props);
188
- }
189
-
190
- static getDerivedStateFromProps(
191
- nextProps: Props<T>,
192
- prevState: State
193
- ): $Shape<State> | null {
194
- validateSharedProps(nextProps, prevState);
195
- validateProps(nextProps);
196
- return null;
197
- }
198
-
199
- scrollTo(scrollOffset: number): void {
200
- scrollOffset = Math.max(0, scrollOffset);
201
-
202
- this.setState(prevState => {
203
- if (prevState.scrollOffset === scrollOffset) {
204
- return null;
205
- }
206
- return {
207
- scrollDirection:
208
- prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
209
- scrollOffset: scrollOffset,
210
- scrollUpdateWasRequested: true,
211
- };
212
- }, this._resetIsScrollingDebounced);
213
- }
214
-
215
- scrollToItem(index: number, align: ScrollToAlign = 'auto'): void {
216
- const { itemCount } = this.props;
217
- const { scrollOffset } = this.state;
218
-
219
- index = Math.max(0, Math.min(index, itemCount - 1));
220
-
221
- this.scrollTo(
222
- getOffsetForIndexAndAlignment(
223
- this.props,
224
- index,
225
- align,
226
- scrollOffset,
227
- this._instanceProps
228
- )
229
- );
230
- }
231
-
232
- componentDidMount() {
233
- const { direction, initialScrollOffset, layout } = this.props;
234
-
235
- if (typeof initialScrollOffset === 'number' && this._outerRef != null) {
236
- const outerRef = ((this._outerRef: any): HTMLElement);
237
- // TODO Deprecate direction "horizontal"
238
- if (direction === 'horizontal' || layout === 'horizontal') {
239
- outerRef.scrollLeft = initialScrollOffset;
240
- } else {
241
- outerRef.scrollTop = initialScrollOffset;
242
- }
243
- }
244
-
245
- this._callPropsCallbacks();
246
- }
247
-
248
- componentDidUpdate() {
249
- const { direction, layout } = this.props;
250
- const { scrollOffset, scrollUpdateWasRequested } = this.state;
251
-
252
- if (scrollUpdateWasRequested && this._outerRef != null) {
253
- const outerRef = ((this._outerRef: any): HTMLElement);
254
-
255
- // TODO Deprecate direction "horizontal"
256
- if (direction === 'horizontal' || layout === 'horizontal') {
257
- if (direction === 'rtl') {
258
- // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
259
- // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
260
- // So we need to determine which browser behavior we're dealing with, and mimic it.
261
- switch (getRTLOffsetType()) {
262
- case 'negative':
263
- outerRef.scrollLeft = -scrollOffset;
264
- break;
265
- case 'positive-ascending':
266
- outerRef.scrollLeft = scrollOffset;
267
- break;
268
- default:
269
- const { clientWidth, scrollWidth } = outerRef;
270
- outerRef.scrollLeft = scrollWidth - clientWidth - scrollOffset;
271
- break;
272
- }
273
- } else {
274
- outerRef.scrollLeft = scrollOffset;
275
- }
276
- } else {
277
- outerRef.scrollTop = scrollOffset;
278
- }
279
- }
280
-
281
- this._callPropsCallbacks();
282
- }
283
-
284
- componentWillUnmount() {
285
- if (this._resetIsScrollingTimeoutId !== null) {
286
- cancelTimeout(this._resetIsScrollingTimeoutId);
287
- }
288
- }
289
-
290
- render() {
291
- const {
292
- children,
293
- className,
294
- direction,
295
- height,
296
- innerRef,
297
- innerElementType,
298
- innerTagName,
299
- itemCount,
300
- itemData,
301
- itemKey = defaultItemKey,
302
- layout,
303
- outerElementType,
304
- outerTagName,
305
- style,
306
- useIsScrolling,
307
- width,
308
- } = this.props;
309
- const { isScrolling } = this.state;
310
-
311
- // TODO Deprecate direction "horizontal"
312
- const isHorizontal =
313
- direction === 'horizontal' || layout === 'horizontal';
314
-
315
- const onScroll = isHorizontal
316
- ? this._onScrollHorizontal
317
- : this._onScrollVertical;
318
-
319
- const [startIndex, stopIndex] = this._getRangeToRender();
320
-
321
- const items = [];
322
- if (itemCount > 0) {
323
- for (let index = startIndex; index <= stopIndex; index++) {
324
- items.push(
325
- createElement(children, {
326
- data: itemData,
327
- key: itemKey(index, itemData),
328
- index,
329
- isScrolling: useIsScrolling ? isScrolling : undefined,
330
- style: this._getItemStyle(index),
331
- })
332
- );
333
- }
334
- }
335
-
336
- // Read this value AFTER items have been created,
337
- // So their actual sizes (if variable) are taken into consideration.
338
- const estimatedTotalSize = getEstimatedTotalSize(
339
- this.props,
340
- this._instanceProps
341
- );
342
-
343
- return createElement(
344
- outerElementType || outerTagName || 'div',
345
- {
346
- className,
347
- onScroll,
348
- ref: this._outerRefSetter,
349
- style: {
350
- display: 'flex',
351
- flexDirection: 'column',
352
- position: 'relative',
353
- height,
354
- width,
355
- overflow: 'scroll',//'auto',
356
- WebkitOverflowScrolling: 'touch',
357
- willChange: 'transform',
358
- direction,
359
- ...style,
360
- },
361
- },
362
- createElement(innerElementType || innerTagName || 'div', {
363
- children: items,
364
- ref: innerRef,
365
- style: {
366
- flexShrink: 0,
367
- height: isHorizontal ? '100%' : estimatedTotalSize,
368
- pointerEvents: isScrolling ? 'none' : undefined,
369
- width: isHorizontal ? estimatedTotalSize : '100%',
370
- },
371
- })
372
- );
373
- }
374
-
375
- _callOnItemsRendered: (
376
- overscanStartIndex: number,
377
- overscanStopIndex: number,
378
- visibleStartIndex: number,
379
- visibleStopIndex: number
380
- ) => void;
381
- _callOnItemsRendered = memoizeOne(
382
- (
383
- overscanStartIndex: number,
384
- overscanStopIndex: number,
385
- visibleStartIndex: number,
386
- visibleStopIndex: number
387
- ) =>
388
- ((this.props.onItemsRendered: any): onItemsRenderedCallback)({
389
- overscanStartIndex,
390
- overscanStopIndex,
391
- visibleStartIndex,
392
- visibleStopIndex,
393
- })
394
- );
395
-
396
- _callOnScroll: (
397
- scrollDirection: ScrollDirection,
398
- scrollOffset: number,
399
- scrollUpdateWasRequested: boolean
400
- ) => void;
401
- _callOnScroll = memoizeOne(
402
- (
403
- scrollDirection: ScrollDirection,
404
- scrollOffset: number,
405
- scrollUpdateWasRequested: boolean
406
- ) =>
407
- ((this.props.onScroll: any): onScrollCallback)({
408
- scrollDirection,
409
- scrollOffset,
410
- scrollUpdateWasRequested,
411
- })
412
- );
413
-
414
- _callPropsCallbacks() {
415
- if (typeof this.props.onItemsRendered === 'function') {
416
- const { itemCount } = this.props;
417
- if (itemCount > 0) {
418
- const [
419
- overscanStartIndex,
420
- overscanStopIndex,
421
- visibleStartIndex,
422
- visibleStopIndex,
423
- ] = this._getRangeToRender();
424
- this._callOnItemsRendered(
425
- overscanStartIndex,
426
- overscanStopIndex,
427
- visibleStartIndex,
428
- visibleStopIndex
429
- );
430
- }
431
- }
432
-
433
- if (typeof this.props.onScroll === 'function') {
434
- const {
435
- scrollDirection,
436
- scrollOffset,
437
- scrollUpdateWasRequested,
438
- } = this.state;
439
- this._callOnScroll(
440
- scrollDirection,
441
- scrollOffset,
442
- scrollUpdateWasRequested
443
- );
444
- }
445
- }
446
-
447
- // Lazily create and cache item styles while scrolling,
448
- // So that pure component sCU will prevent re-renders.
449
- // We maintain this cache, and pass a style prop rather than index,
450
- // So that List can clear cached styles and force item re-render if necessary.
451
- _getItemStyle: (index: number) => Object;
452
- _getItemStyle = (index: number): Object => {
453
- const { direction, itemSize, layout } = this.props;
454
-
455
- const itemStyleCache = this._getItemStyleCache(
456
- shouldResetStyleCacheOnItemSizeChange && itemSize,
457
- shouldResetStyleCacheOnItemSizeChange && layout,
458
- shouldResetStyleCacheOnItemSizeChange && direction
459
- );
460
-
461
- let style;
462
- if (itemStyleCache.hasOwnProperty(index)) {
463
- style = itemStyleCache[index];
464
- } else {
465
- const offset = getItemOffset(this.props, index, this._instanceProps);
466
- const size = getItemSize(this.props, index, this._instanceProps);
467
-
468
- // TODO Deprecate direction "horizontal"
469
- const isHorizontal =
470
- direction === 'horizontal' || layout === 'horizontal';
471
-
472
- const isRtl = direction === 'rtl';
473
- const offsetHorizontal = isHorizontal ? offset : 0;
474
- itemStyleCache[index] = style = {
475
- position: 'absolute',
476
- left: isRtl ? undefined : offsetHorizontal,
477
- right: isRtl ? offsetHorizontal : undefined,
478
- top: !isHorizontal ? offset : 0,
479
- height: !isHorizontal ? size : '100%',
480
- width: isHorizontal ? size : '100%',
481
- };
482
- }
483
-
484
- return style;
485
- };
486
-
487
- _getItemStyleCache: (_: any, __: any, ___: any) => ItemStyleCache;
488
- _getItemStyleCache = memoizeOne((_: any, __: any, ___: any) => ({}));
489
-
490
- _getRangeToRender(): [number, number, number, number] {
491
- const { itemCount, overscanCount } = this.props;
492
- const { isScrolling, scrollDirection, scrollOffset } = this.state;
493
-
494
- if (itemCount === 0) {
495
- return [0, 0, 0, 0];
496
- }
497
-
498
- const startIndex = getStartIndexForOffset(
499
- this.props,
500
- scrollOffset,
501
- this._instanceProps
502
- );
503
- const stopIndex = getStopIndexForStartIndex(
504
- this.props,
505
- startIndex,
506
- scrollOffset,
507
- this._instanceProps
508
- );
509
-
510
- // Overscan by one item in each direction so that tab/focus works.
511
- // If there isn't at least one extra item, tab loops back around.
512
- const overscanBackward =
513
- !isScrolling || scrollDirection === 'backward'
514
- ? Math.max(1, overscanCount)
515
- : 1;
516
- const overscanForward =
517
- !isScrolling || scrollDirection === 'forward'
518
- ? Math.max(1, overscanCount)
519
- : 1;
520
-
521
- return [
522
- Math.max(0, startIndex - overscanBackward),
523
- Math.max(0, Math.min(itemCount - 1, stopIndex + overscanForward)),
524
- startIndex,
525
- stopIndex,
526
- ];
527
- }
528
-
529
- _onScrollHorizontal = (event: ScrollEvent): void => {
530
- const { clientWidth, scrollLeft, scrollWidth } = event.currentTarget;
531
- this.setState(prevState => {
532
- if (prevState.scrollOffset === scrollLeft) {
533
- // Scroll position may have been updated by cDM/cDU,
534
- // In which case we don't need to trigger another render,
535
- // And we don't want to update state.isScrolling.
536
- return null;
537
- }
538
-
539
- const { direction } = this.props;
540
-
541
- let scrollOffset = scrollLeft;
542
- if (direction === 'rtl') {
543
- // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
544
- // This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
545
- // It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
546
- // So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
547
- switch (getRTLOffsetType()) {
548
- case 'negative':
549
- scrollOffset = -scrollLeft;
550
- break;
551
- case 'positive-descending':
552
- scrollOffset = scrollWidth - clientWidth - scrollLeft;
553
- break;
554
- }
555
- }
556
-
557
- // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
558
- scrollOffset = Math.max(
559
- 0,
560
- Math.min(scrollOffset, scrollWidth - clientWidth)
561
- );
562
-
563
- return {
564
- isScrolling: true,
565
- scrollDirection:
566
- prevState.scrollOffset < scrollLeft ? 'forward' : 'backward',
567
- scrollOffset,
568
- scrollUpdateWasRequested: false,
569
- };
570
- }, this._resetIsScrollingDebounced);
571
- };
572
-
573
- _onScrollVertical = (event: ScrollEvent): void => {
574
- const { clientHeight, scrollHeight, scrollTop } = event.currentTarget;
575
- console.log('onScroll',clientHeight, scrollHeight, scrollTop );
576
- this.setState(prevState => {
577
- if (prevState.scrollOffset === scrollTop) {
578
- // Scroll position may have been updated by cDM/cDU,
579
- // In which case we don't need to trigger another render,
580
- // And we don't want to update state.isScrolling.
581
- return null;
582
- }
583
-
584
- // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
585
- const scrollOffset = Math.max(
586
- 0,
587
- Math.min(scrollTop, scrollHeight - clientHeight)
588
- );
589
-
590
- return {
591
- isScrolling: true,
592
- scrollDirection:
593
- prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
594
- scrollOffset,
595
- scrollUpdateWasRequested: false,
596
- };
597
- }, this._resetIsScrollingDebounced);
598
- };
599
-
600
- _outerRefSetter = (ref: any): void => {
601
- const { outerRef } = this.props;
602
-
603
- this._outerRef = ((ref: any): HTMLDivElement);
604
-
605
- if (typeof outerRef === 'function') {
606
- outerRef(ref);
607
- } else if (
608
- outerRef != null &&
609
- typeof outerRef === 'object' &&
610
- outerRef.hasOwnProperty('current')
611
- ) {
612
- outerRef.current = ref;
613
- }
614
- };
615
-
616
- _resetIsScrollingDebounced = () => {
617
- if (this._resetIsScrollingTimeoutId !== null) {
618
- cancelTimeout(this._resetIsScrollingTimeoutId);
619
- }
620
-
621
- this._resetIsScrollingTimeoutId = requestTimeout(
622
- this._resetIsScrolling,
623
- IS_SCROLLING_DEBOUNCE_INTERVAL
624
- );
625
- };
626
-
627
- _resetIsScrolling = () => {
628
- this._resetIsScrollingTimeoutId = null;
629
-
630
- this.setState({ isScrolling: false }, () => {
631
- // Clear style cache after state update has been committed.
632
- // This way we don't break pure sCU for items that don't use isScrolling param.
633
- this._getItemStyleCache(-1, null);
634
- });
635
- };
636
- };
637
- }
638
-
639
- // NOTE: I considered further wrapping individual items with a pure ListItem component.
640
- // This would avoid ever calling the render function for the same index more than once,
641
- // But it would also add the overhead of a lot of components/fibers.
642
- // I assume people already do this (render function returning a class component),
643
- // So my doing it would just unnecessarily double the wrappers.
644
-
645
- const validateSharedProps = (
646
- {
647
- children,
648
- direction,
649
- height,
650
- layout,
651
- innerTagName,
652
- outerTagName,
653
- width,
654
- }: Props<any>,
655
- { instance }: State
656
- ): void => {
657
- if (process.env.NODE_ENV !== 'production') {
658
- if (innerTagName != null || outerTagName != null) {
659
- if (devWarningsTagName && !devWarningsTagName.has(instance)) {
660
- devWarningsTagName.add(instance);
661
- console.warn(
662
- 'The innerTagName and outerTagName props have been deprecated. ' +
663
- 'Please use the innerElementType and outerElementType props instead.'
664
- );
665
- }
666
- }
667
-
668
- // TODO Deprecate direction "horizontal"
669
- const isHorizontal = direction === 'horizontal' || layout === 'horizontal';
670
-
671
- switch (direction) {
672
- case 'horizontal':
673
- case 'vertical':
674
- if (devWarningsDirection && !devWarningsDirection.has(instance)) {
675
- devWarningsDirection.add(instance);
676
- console.warn(
677
- 'The direction prop should be either "ltr" (default) or "rtl". ' +
678
- 'Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'
679
- );
680
- }
681
- break;
682
- case 'ltr':
683
- case 'rtl':
684
- // Valid values
685
- break;
686
- default:
687
- throw Error(
688
- 'An invalid "direction" prop has been specified. ' +
689
- 'Value should be either "ltr" or "rtl". ' +
690
- `"${direction}" was specified.`
691
- );
692
- }
693
-
694
- switch (layout) {
695
- case 'horizontal':
696
- case 'vertical':
697
- // Valid values
698
- break;
699
- default:
700
- throw Error(
701
- 'An invalid "layout" prop has been specified. ' +
702
- 'Value should be either "horizontal" or "vertical". ' +
703
- `"${layout}" was specified.`
704
- );
705
- }
706
-
707
- if (children == null) {
708
- throw Error(
709
- 'An invalid "children" prop has been specified. ' +
710
- 'Value should be a React component. ' +
711
- `"${children === null ? 'null' : typeof children}" was specified.`
712
- );
713
- }
714
-
715
- if (isHorizontal && typeof width !== 'number') {
716
- throw Error(
717
- 'An invalid "width" prop has been specified. ' +
718
- 'Horizontal lists must specify a number for width. ' +
719
- `"${width === null ? 'null' : typeof width}" was specified.`
720
- );
721
- } else if (!isHorizontal && typeof height !== 'number') {
722
- throw Error(
723
- 'An invalid "height" prop has been specified. ' +
724
- 'Vertical lists must specify a number for height. ' +
725
- `"${height === null ? 'null' : typeof height}" was specified.`
726
- );
727
- }
728
- }
729
- };