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,339 +0,0 @@
1
- import { options } from 'preact';
2
-
3
- /** @type {number} */
4
- let currentIndex;
5
-
6
- /** @type {import('./internal').Component} */
7
- let currentComponent;
8
-
9
- /** @type {Array<import('./internal').Component>} */
10
- let afterPaintEffects = [];
11
-
12
- let oldBeforeRender = options._render;
13
- let oldAfterDiff = options.diffed;
14
- let oldCommit = options._commit;
15
- let oldBeforeUnmount = options.unmount;
16
-
17
- const RAF_TIMEOUT = 100;
18
- let prevRaf;
19
-
20
- options._render = vnode => {
21
- if (oldBeforeRender) oldBeforeRender(vnode);
22
-
23
- currentComponent = vnode._component;
24
- currentIndex = 0;
25
-
26
- if (currentComponent.__hooks) {
27
- currentComponent.__hooks._pendingEffects.forEach(invokeCleanup);
28
- currentComponent.__hooks._pendingEffects.forEach(invokeEffect);
29
- currentComponent.__hooks._pendingEffects = [];
30
- }
31
- };
32
-
33
- options.diffed = vnode => {
34
- if (oldAfterDiff) oldAfterDiff(vnode);
35
-
36
- const c = vnode._component;
37
- if (!c) return;
38
-
39
- const hooks = c.__hooks;
40
- if (hooks) {
41
- if (hooks._pendingEffects.length) {
42
- afterPaint(afterPaintEffects.push(c));
43
- }
44
- }
45
- };
46
-
47
- options._commit = (vnode, commitQueue) => {
48
- commitQueue.some(component => {
49
- try {
50
- component._renderCallbacks.forEach(invokeCleanup);
51
- component._renderCallbacks = component._renderCallbacks.filter(cb =>
52
- cb._value ? invokeEffect(cb) : true
53
- );
54
- } catch (e) {
55
- commitQueue.some(c => {
56
- if (c._renderCallbacks) c._renderCallbacks = [];
57
- });
58
- commitQueue = [];
59
- options._catchError(e, component._vnode);
60
- }
61
- });
62
-
63
- if (oldCommit) oldCommit(vnode, commitQueue);
64
- };
65
-
66
- options.unmount = vnode => {
67
- if (oldBeforeUnmount) oldBeforeUnmount(vnode);
68
-
69
- const c = vnode._component;
70
- if (!c) return;
71
-
72
- const hooks = c.__hooks;
73
- if (hooks) {
74
- try {
75
- hooks._list.forEach(hook => hook._cleanup && hook._cleanup());
76
- } catch (e) {
77
- options._catchError(e, c._vnode);
78
- }
79
- }
80
- };
81
-
82
- /**
83
- * Get a hook's state from the currentComponent
84
- * @param {number} index The index of the hook to get
85
- * @returns {import('./internal').HookState}
86
- */
87
- function getHookState(index) {
88
- if (options._hook) options._hook(currentComponent);
89
- // Largely inspired by:
90
- // * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs
91
- // * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs
92
- // Other implementations to look at:
93
- // * https://codesandbox.io/s/mnox05qp8
94
- const hooks =
95
- currentComponent.__hooks ||
96
- (currentComponent.__hooks = { _list: [], _pendingEffects: [] });
97
-
98
- if (index >= hooks._list.length) {
99
- hooks._list.push({});
100
- }
101
- return hooks._list[index];
102
- }
103
-
104
- /**
105
- * @param {import('./index').StateUpdater<any>} initialState
106
- */
107
- export function useState(initialState) {
108
- return useReducer(invokeOrReturn, initialState);
109
- }
110
-
111
- /**
112
- * @param {import('./index').Reducer<any, any>} reducer
113
- * @param {import('./index').StateUpdater<any>} initialState
114
- * @param {(initialState: any) => void} [init]
115
- * @returns {[ any, (state: any) => void ]}
116
- */
117
- export function useReducer(reducer, initialState, init) {
118
- /** @type {import('./internal').ReducerHookState} */
119
- const hookState = getHookState(currentIndex++);
120
- if (!hookState._component) {
121
- hookState._component = currentComponent;
122
-
123
- hookState._value = [
124
- !init ? invokeOrReturn(undefined, initialState) : init(initialState),
125
-
126
- action => {
127
- const nextValue = reducer(hookState._value[0], action);
128
- if (hookState._value[0] !== nextValue) {
129
- hookState._value[0] = nextValue;
130
- hookState._component.setState({});
131
- }
132
- }
133
- ];
134
- }
135
-
136
- return hookState._value;
137
- }
138
-
139
- /**
140
- * @param {import('./internal').Effect} callback
141
- * @param {any[]} args
142
- */
143
- export function useEffect(callback, args) {
144
- /** @type {import('./internal').EffectHookState} */
145
- const state = getHookState(currentIndex++);
146
- if (argsChanged(state._args, args)) {
147
- state._value = callback;
148
- state._args = args;
149
-
150
- currentComponent.__hooks._pendingEffects.push(state);
151
- }
152
- }
153
-
154
- /**
155
- * @param {import('./internal').Effect} callback
156
- * @param {any[]} args
157
- */
158
- export function useLayoutEffect(callback, args) {
159
- /** @type {import('./internal').EffectHookState} */
160
- const state = getHookState(currentIndex++);
161
- if (argsChanged(state._args, args)) {
162
- state._value = callback;
163
- state._args = args;
164
-
165
- currentComponent._renderCallbacks.push(state);
166
- }
167
- }
168
-
169
- export function useRef(initialValue) {
170
- return useMemo(() => ({ current: initialValue }), []);
171
- }
172
-
173
- /**
174
- * @param {object} ref
175
- * @param {() => object} createHandle
176
- * @param {any[]} args
177
- */
178
- export function useImperativeHandle(ref, createHandle, args) {
179
- useLayoutEffect(
180
- () => {
181
- if (typeof ref == 'function') ref(createHandle());
182
- else if (ref) ref.current = createHandle();
183
- },
184
- args == null ? args : args.concat(ref)
185
- );
186
- }
187
-
188
- /**
189
- * @param {() => any} factory
190
- * @param {any[]} args
191
- */
192
- export function useMemo(factory, args) {
193
- /** @type {import('./internal').MemoHookState} */
194
- const state = getHookState(currentIndex++);
195
- if (argsChanged(state._args, args)) {
196
- state._args = args;
197
- state._factory = factory;
198
- return (state._value = factory());
199
- }
200
-
201
- return state._value;
202
- }
203
-
204
- /**
205
- * @param {() => void} callback
206
- * @param {any[]} args
207
- */
208
- export function useCallback(callback, args) {
209
- return useMemo(() => callback, args);
210
- }
211
-
212
- /**
213
- * @param {import('./internal').PreactContext} context
214
- */
215
- export function useContext(context) {
216
- const provider = currentComponent.context[context._id];
217
- if (!provider) return context._defaultValue;
218
- const state = getHookState(currentIndex++);
219
- // This is probably not safe to convert to "!"
220
- if (state._value == null) {
221
- state._value = true;
222
- provider.sub(currentComponent);
223
- }
224
- return provider.props.value;
225
- }
226
-
227
- /**
228
- * Display a custom label for a custom hook for the devtools panel
229
- * @type {<T>(value: T, cb?: (value: T) => string | number) => void}
230
- */
231
- export function useDebugValue(value, formatter) {
232
- if (options.useDebugValue) {
233
- options.useDebugValue(formatter ? formatter(value) : value);
234
- }
235
- }
236
-
237
- export function useErrorBoundary(cb) {
238
- const state = getHookState(currentIndex++);
239
- const errState = useState();
240
- state._value = cb;
241
- if (!currentComponent.componentDidCatch) {
242
- currentComponent.componentDidCatch = err => {
243
- if (state._value) state._value(err);
244
- errState[1](err);
245
- };
246
- }
247
- return [
248
- errState[0],
249
- () => {
250
- errState[1](undefined);
251
- }
252
- ];
253
- }
254
-
255
- /**
256
- * After paint effects consumer.
257
- */
258
- function flushAfterPaintEffects() {
259
- afterPaintEffects.some(component => {
260
- if (component._parentDom) {
261
- try {
262
- component.__hooks._pendingEffects.forEach(invokeCleanup);
263
- component.__hooks._pendingEffects.forEach(invokeEffect);
264
- component.__hooks._pendingEffects = [];
265
- } catch (e) {
266
- component.__hooks._pendingEffects = [];
267
- options._catchError(e, component._vnode);
268
- return true;
269
- }
270
- }
271
- });
272
- afterPaintEffects = [];
273
- }
274
-
275
- /**
276
- * Schedule a callback to be invoked after the browser has a chance to paint a new frame.
277
- * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after
278
- * the next browser frame.
279
- *
280
- * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked
281
- * even if RAF doesn't fire (for example if the browser tab is not visible)
282
- *
283
- * @param {() => void} callback
284
- */
285
- function afterNextFrame(callback) {
286
- const done = () => {
287
- clearTimeout(timeout);
288
- cancelAnimationFrame(raf);
289
- setTimeout(callback);
290
- };
291
- const timeout = setTimeout(done, RAF_TIMEOUT);
292
-
293
- let raf;
294
- if (typeof window != 'undefined') {
295
- raf = requestAnimationFrame(done);
296
- }
297
- }
298
-
299
- // Note: if someone used options.debounceRendering = requestAnimationFrame,
300
- // then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.
301
- // Perhaps this is not such a big deal.
302
- /**
303
- * Schedule afterPaintEffects flush after the browser paints
304
- * @param {number} newQueueLength
305
- */
306
- function afterPaint(newQueueLength) {
307
- if (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {
308
- prevRaf = options.requestAnimationFrame;
309
- (prevRaf || afterNextFrame)(flushAfterPaintEffects);
310
- }
311
- }
312
-
313
- /**
314
- * @param {import('./internal').EffectHookState} hook
315
- */
316
- function invokeCleanup(hook) {
317
- if (hook._cleanup) hook._cleanup();
318
- }
319
-
320
- /**
321
- * Invoke a Hook's effect
322
- * @param {import('./internal').EffectHookState} hook
323
- */
324
- function invokeEffect(hook) {
325
- const result = hook._value();
326
- if (typeof result == 'function') hook._cleanup = result;
327
- }
328
-
329
- /**
330
- * @param {any[]} oldArgs
331
- * @param {any[]} newArgs
332
- */
333
- function argsChanged(oldArgs, newArgs) {
334
- return !oldArgs || newArgs.some((arg, index) => arg !== oldArgs[index]);
335
- }
336
-
337
- function invokeOrReturn(arg, f) {
338
- return typeof f == 'function' ? f(arg) : f;
339
- }
@@ -1,55 +0,0 @@
1
- import { Component as PreactComponent } from '../../src/internal';
2
-
3
- export { PreactContext } from '../../src/internal';
4
-
5
- /**
6
- * The type of arguments passed to a Hook function. While this type is not
7
- * strictly necessary, they are given a type name to make it easier to read
8
- * the following types and trace the flow of data.
9
- */
10
- export type HookArgs = any;
11
-
12
- /**
13
- * The return type of a Hook function. While this type is not
14
- * strictly necessary, they are given a type name to make it easier to read
15
- * the following types and trace the flow of data.
16
- */
17
- export type HookReturnValue = any;
18
-
19
- /** The public function a user invokes to use a Hook */
20
- export type Hook = (...args: HookArgs[]) => HookReturnValue;
21
-
22
- // Hook tracking
23
-
24
- export interface ComponentHooks {
25
- /** The list of hooks a component uses */
26
- _list: HookState[];
27
- /** List of Effects to be invoked after the next frame is rendered */
28
- _pendingEffects: EffectHookState[];
29
- }
30
-
31
- export interface Component extends PreactComponent<any, any> {
32
- __hooks?: ComponentHooks;
33
- }
34
-
35
- export type HookState = EffectHookState | MemoHookState | ReducerHookState;
36
-
37
- export type Effect = () => void | Cleanup;
38
- export type Cleanup = () => void;
39
-
40
- export interface EffectHookState {
41
- _value?: Effect;
42
- _args?: any[];
43
- _cleanup?: Cleanup;
44
- }
45
-
46
- export interface MemoHookState {
47
- _value?: any;
48
- _args?: any[];
49
- _factory?: () => any;
50
- }
51
-
52
- export interface ReducerHookState {
53
- _value?: any;
54
- _component?: Component;
55
- }
@@ -1,27 +0,0 @@
1
- import { assign } from './util';
2
- import { EMPTY_ARR } from './constants';
3
- import { createVNode } from './create-element';
4
-
5
- /**
6
- * Clones the given VNode, optionally adding attributes/props and replacing its children.
7
- * @param {import('./internal').VNode} vnode The virtual DOM element to clone
8
- * @param {object} props Attributes/props to add when cloning
9
- * @param {Array<import('./index').ComponentChildren>} rest Any additional arguments will be used as replacement children.
10
- * @returns {import('./internal').VNode}
11
- */
12
- export function cloneElement(vnode, props) {
13
- props = assign(assign({}, vnode.props), props);
14
- if (arguments.length > 2) props.children = EMPTY_ARR.slice.call(arguments, 2);
15
- let normalizedProps = {};
16
- for (const i in props) {
17
- if (i !== 'key' && i !== 'ref') normalizedProps[i] = props[i];
18
- }
19
-
20
- return createVNode(
21
- vnode.type,
22
- normalizedProps,
23
- props.key || vnode.key,
24
- props.ref || vnode.ref,
25
- null
26
- );
27
- }
File without changes
@@ -1,219 +0,0 @@
1
- import { assign } from './util';
2
- import { diff, commitRoot } from './diff/index';
3
- import options from './options';
4
- import { Fragment } from './create-element';
5
-
6
- /**
7
- * Base Component class. Provides `setState()` and `forceUpdate()`, which
8
- * trigger rendering
9
- * @param {object} props The initial component props
10
- * @param {object} context The initial context from parent components'
11
- * getChildContext
12
- */
13
- export function Component(props, context) {
14
- this.props = props;
15
- this.context = context;
16
- }
17
-
18
- /**
19
- * Update component state and schedule a re-render.
20
- * @param {object | ((s: object, p: object) => object)} update A hash of state
21
- * properties to update with new values or a function that given the current
22
- * state and props returns a new partial state
23
- * @param {() => void} [callback] A function to be called once component state is
24
- * updated
25
- */
26
- Component.prototype.setState = function (update, callback) {
27
- // only clone state when copying to nextState the first time.
28
- let s;
29
- if (this._nextState !== this.state) {
30
- s = this._nextState;
31
- } else {
32
- s = this._nextState = assign({}, this.state);
33
- }
34
-
35
- if (typeof update == 'function') {
36
- update = update(s, this.props);
37
- }
38
-
39
- if (update) {
40
- assign(s, update);
41
- }
42
-
43
- // Skip update if updater function returned null
44
- if (update == null) return;
45
-
46
- if (this._vnode) {
47
- if (callback) this._renderCallbacks.push(callback);
48
- enqueueRender(this);
49
- }
50
- };
51
-
52
- /**
53
- * Immediately perform a synchronous re-render of the component
54
- * @param {() => void} [callback] A function to be called after component is
55
- * re-rendered
56
- */
57
- Component.prototype.forceUpdate = function (callback) {
58
- if (this._vnode) {
59
- // Set render mode so that we can differentiate where the render request
60
- // is coming from. We need this because forceUpdate should never call
61
- // shouldComponentUpdate
62
- this._force = true;
63
- if (callback) this._renderCallbacks.push(callback);
64
- enqueueRender(this);
65
- }
66
- };
67
-
68
- /**
69
- * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.
70
- * Virtual DOM is generally constructed via [JSX](http://jasonformat.com/wtf-is-jsx).
71
- * @param {object} props Props (eg: JSX attributes) received from parent
72
- * element/component
73
- * @param {object} state The component's current state
74
- * @param {object} context Context object, as returned by the nearest
75
- * ancestor's `getChildContext()`
76
- * @returns {import('./index').ComponentChildren | void}
77
- */
78
- Component.prototype.render = Fragment;
79
-
80
- /**
81
- * @param {import('./internal').VNode} vnode
82
- * @param {number | null} [childIndex]
83
- */
84
- export function getDomSibling(vnode, childIndex) {
85
- if (childIndex == null) {
86
- // Use childIndex==null as a signal to resume the search from the vnode's sibling
87
- return vnode._parent
88
- ? getDomSibling(vnode._parent, vnode._parent._children.indexOf(vnode) + 1)
89
- : null;
90
- }
91
-
92
- let sibling;
93
- for (; childIndex < vnode._children.length; childIndex++) {
94
- sibling = vnode._children[childIndex];
95
-
96
- if (sibling != null && sibling._dom != null) {
97
- // Since updateParentDomPointers keeps _dom pointer correct,
98
- // we can rely on _dom to tell us if this subtree contains a
99
- // rendered DOM node, and what the first rendered DOM node is
100
- return sibling._dom;
101
- }
102
- }
103
-
104
- // If we get here, we have not found a DOM node in this vnode's children.
105
- // We must resume from this vnode's sibling (in it's parent _children array)
106
- // Only climb up and search the parent if we aren't searching through a DOM
107
- // VNode (meaning we reached the DOM parent of the original vnode that began
108
- // the search)
109
- return typeof vnode.type == 'function' ? getDomSibling(vnode) : null;
110
- }
111
-
112
- /**
113
- * Trigger in-place re-rendering of a component.
114
- * @param {import('./internal').Component} component The component to rerender
115
- */
116
- function renderComponent(component) {
117
- let vnode = component._vnode,
118
- oldDom = vnode._dom,
119
- parentDom = component._parentDom;
120
-
121
- if (parentDom) {
122
- let commitQueue = [];
123
- const oldVNode = assign({}, vnode);
124
- oldVNode._original = oldVNode;
125
-
126
- window.clearOP();
127
-
128
- let newDom = diff(
129
- parentDom,
130
- vnode,
131
- oldVNode,
132
- component._globalContext,
133
- parentDom.ownerSVGElement !== undefined,
134
- null,
135
- commitQueue,
136
- oldDom == null ? getDomSibling(vnode) : oldDom
137
- );
138
- commitRoot(commitQueue, vnode);
139
-
140
- window.dumpOP('renderComponent');
141
-
142
- if (newDom != oldDom) {
143
- updateParentDomPointers(vnode);
144
- }
145
- }
146
- }
147
-
148
- /**
149
- * @param {import('./internal').VNode} vnode
150
- */
151
- function updateParentDomPointers(vnode) {
152
- if ((vnode = vnode._parent) != null && vnode._component != null) {
153
- vnode._dom = vnode._component.base = null;
154
- for (let i = 0; i < vnode._children.length; i++) {
155
- let child = vnode._children[i];
156
- if (child != null && child._dom != null) {
157
- vnode._dom = vnode._component.base = child._dom;
158
- break;
159
- }
160
- }
161
-
162
- return updateParentDomPointers(vnode);
163
- }
164
- }
165
-
166
- /**
167
- * The render queue
168
- * @type {Array<import('./internal').Component>}
169
- */
170
- let rerenderQueue = [];
171
- let rerenderCount = 0;
172
-
173
- /**
174
- * Asynchronously schedule a callback
175
- * @type {(cb: () => void) => void}
176
- */
177
- /* istanbul ignore next */
178
- // Note the following line isn't tree-shaken by rollup cuz of rollup/rollup#2566
179
- const defer =
180
- typeof Promise == 'function' ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout;
181
-
182
- /*
183
- * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is
184
- * important that contributors to Preact can consistently reason about what calls to `setState`, etc.
185
- * do, and when their effects will be applied. See the links below for some further reading on designing
186
- * asynchronous APIs.
187
- * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)
188
- * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)
189
- */
190
-
191
- let prevDebounce;
192
-
193
- /**
194
- * Enqueue a rerender of a component
195
- * @param {import('./internal').Component} c The component to rerender
196
- */
197
- export function enqueueRender(c) {
198
- if (
199
- (!c._dirty && (c._dirty = true) && rerenderQueue.push(c) && !rerenderCount++) ||
200
- prevDebounce !== options.debounceRendering
201
- ) {
202
- prevDebounce = options.debounceRendering;
203
- (prevDebounce || defer)(process);
204
- }
205
- }
206
-
207
- /** Flush the render queue by rerendering all queued components */
208
- function process() {
209
- let queue;
210
- while ((rerenderCount = rerenderQueue.length)) {
211
- queue = rerenderQueue.sort((a, b) => a._vnode._depth - b._vnode._depth);
212
- rerenderQueue = [];
213
- // Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary
214
- // process() calls from getting scheduled while `queue` is still being consumed.
215
- queue.some((c) => {
216
- if (c._dirty) renderComponent(c);
217
- });
218
- }
219
- }
@@ -1,3 +0,0 @@
1
- export const EMPTY_OBJ = {};
2
- export const EMPTY_ARR = [];
3
- export const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
@@ -1,55 +0,0 @@
1
- import { enqueueRender } from './component';
2
-
3
- export let i = 0;
4
-
5
- export function createContext(defaultValue) {
6
- const ctx = {};
7
-
8
- const context = {
9
- _id: '__cC' + i++,
10
- _defaultValue: defaultValue,
11
- Consumer(props, context) {
12
- return props.children(context);
13
- },
14
- Provider(props) {
15
- if (!this.getChildContext) {
16
- const subs = [];
17
- this.getChildContext = () => {
18
- ctx[context._id] = this;
19
- return ctx;
20
- };
21
-
22
- this.shouldComponentUpdate = _props => {
23
- if (this.props.value !== _props.value) {
24
- subs.some(c => {
25
- c.context = _props.value;
26
- enqueueRender(c);
27
- });
28
- }
29
- };
30
-
31
- this.sub = c => {
32
- subs.push(c);
33
- let old = c.componentWillUnmount;
34
- c.componentWillUnmount = () => {
35
- subs.splice(subs.indexOf(c), 1);
36
- old && old.call(c);
37
- };
38
- };
39
- }
40
-
41
- return props.children;
42
- }
43
- };
44
-
45
- context.Consumer.contextType = context;
46
-
47
- // Devtools needs access to the context object when it
48
- // encounters a Provider. This is necessary to support
49
- // setting `displayName` on the context object instead
50
- // of on the component itself. See:
51
- // https://reactjs.org/docs/context.html#contextdisplayname
52
- context.Provider._contextRef = context;
53
-
54
- return context;
55
- }