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.
- package/README.md +5 -6
- package/package.json +9 -66
- package/tsconfig.json +27 -13
- package/{src/pixUIReactComponents/ui → ui}/components/slapface/Slapface.tsx +17 -17
- package/ui/sample/Slapface/SlapfaceDemo.tsx +30 -0
- package/.eslintignore +0 -7
- package/.eslintrc.js +0 -48
- package/.pixiderc/apps.json +0 -12
- package/.pixiderc/devel-config.meta.json +0 -23
- package/.pixiderc/postinstall.js +0 -17
- package/.pixiderc/util.js +0 -136
- package/.pixiderc/webpack.js +0 -180
- package/faas/helloworld.js +0 -8
- package/gen/pbo/pandora_pb.d.ts +0 -1179
- package/gen/pbo/pandora_pb.js +0 -10475
- package/gen/pbo/pandora_pb_service.d.ts +0 -1317
- package/gen/pbo/pandora_pb_service.js +0 -2307
- package/gen/pbo/test_pb.d.ts +0 -99
- package/gen/pbo/test_pb.js +0 -889
- package/gen/pbo/test_pb_service.d.ts +0 -82
- package/gen/pbo/test_pb_service.js +0 -117
- package/lib/assets/border.png +0 -0
- package/lib/assets/check.html +0 -54
- package/lib/assets/pixui.png +0 -0
- package/lib/assets/preact.png +0 -0
- package/lib/check/main.less +0 -63
- package/lib/check/main.tsx +0 -42
- package/lib/check/tool.js +0 -3
- package/lib/check/util.tsx +0 -107
- package/lib/dom.ts +0 -16
- package/lib/ext.d.ts +0 -95
- package/lib/grpc-web/dist/ChunkParser.js +0 -115
- package/lib/grpc-web/dist/ChunkParser.js.map +0 -1
- package/lib/grpc-web/dist/Code.js +0 -58
- package/lib/grpc-web/dist/Code.js.map +0 -1
- package/lib/grpc-web/dist/client.js +0 -299
- package/lib/grpc-web/dist/client.js.map +0 -1
- package/lib/grpc-web/dist/debug.js +0 -16
- package/lib/grpc-web/dist/debug.js.map +0 -1
- package/lib/grpc-web/dist/detach.js +0 -7
- package/lib/grpc-web/dist/detach.js.map +0 -1
- package/lib/grpc-web/dist/index.js +0 -29
- package/lib/grpc-web/dist/index.js.map +0 -1
- package/lib/grpc-web/dist/invoke.js +0 -32
- package/lib/grpc-web/dist/invoke.js.map +0 -1
- package/lib/grpc-web/dist/message.js +0 -3
- package/lib/grpc-web/dist/message.js.map +0 -1
- package/lib/grpc-web/dist/metadata.js +0 -5
- package/lib/grpc-web/dist/metadata.js.map +0 -1
- package/lib/grpc-web/dist/service.js +0 -3
- package/lib/grpc-web/dist/service.js.map +0 -1
- package/lib/grpc-web/dist/transports/Transport.js +0 -13
- package/lib/grpc-web/dist/transports/Transport.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/fetch.js +0 -112
- package/lib/grpc-web/dist/transports/http/fetch.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/http.js +0 -15
- package/lib/grpc-web/dist/transports/http/http.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/xhr.js +0 -127
- package/lib/grpc-web/dist/transports/http/xhr.js.map +0 -1
- package/lib/grpc-web/dist/transports/http/xhrUtil.js +0 -37
- package/lib/grpc-web/dist/transports/http/xhrUtil.js.map +0 -1
- package/lib/grpc-web/dist/transports/websocket/websocket.js +0 -95
- package/lib/grpc-web/dist/transports/websocket/websocket.js.map +0 -1
- package/lib/grpc-web/dist/typings/ChunkParser.d.ts +0 -17
- package/lib/grpc-web/dist/typings/Code.d.ts +0 -20
- package/lib/grpc-web/dist/typings/client.d.ts +0 -22
- package/lib/grpc-web/dist/typings/debug.d.ts +0 -1
- package/lib/grpc-web/dist/typings/detach.d.ts +0 -1
- package/lib/grpc-web/dist/typings/index.d.ts +0 -60
- package/lib/grpc-web/dist/typings/invoke.d.ts +0 -17
- package/lib/grpc-web/dist/typings/message.d.ts +0 -8
- package/lib/grpc-web/dist/typings/metadata.d.ts +0 -2
- package/lib/grpc-web/dist/typings/service.d.ts +0 -16
- package/lib/grpc-web/dist/typings/transports/Transport.d.ts +0 -22
- package/lib/grpc-web/dist/typings/transports/http/fetch.d.ts +0 -6
- package/lib/grpc-web/dist/typings/transports/http/http.d.ts +0 -5
- package/lib/grpc-web/dist/typings/transports/http/xhr.d.ts +0 -27
- package/lib/grpc-web/dist/typings/transports/http/xhrUtil.d.ts +0 -3
- package/lib/grpc-web/dist/typings/transports/websocket/websocket.d.ts +0 -2
- package/lib/grpc-web/dist/typings/unary.d.ts +0 -20
- package/lib/grpc-web/dist/typings/util.d.ts +0 -2
- package/lib/grpc-web/dist/unary.js +0 -44
- package/lib/grpc-web/dist/unary.js.map +0 -1
- package/lib/grpc-web/dist/util.js +0 -11
- package/lib/grpc-web/dist/util.js.map +0 -1
- package/lib/grpcTransport/PixHttp2Transport.ts +0 -104
- package/lib/grpcTransport/PixLuaTransport.ts +0 -80
- package/lib/pi_component/tinyList/tinyList.js +0 -573
- package/lib/pi_component/tinyList/tinyList.tsx +0 -586
- package/lib/preact/compat/src/Children.js +0 -26
- package/lib/preact/compat/src/PureComponent.js +0 -19
- package/lib/preact/compat/src/events.js +0 -36
- package/lib/preact/compat/src/forwardRef.js +0 -29
- package/lib/preact/compat/src/index.d.ts +0 -121
- package/lib/preact/compat/src/index.js +0 -159
- package/lib/preact/compat/src/internal.d.ts +0 -45
- package/lib/preact/compat/src/memo.js +0 -34
- package/lib/preact/compat/src/portals.js +0 -85
- package/lib/preact/compat/src/render.js +0 -166
- package/lib/preact/compat/src/suspense-list.d.ts +0 -14
- package/lib/preact/compat/src/suspense-list.js +0 -127
- package/lib/preact/compat/src/suspense.d.ts +0 -15
- package/lib/preact/compat/src/suspense.js +0 -165
- package/lib/preact/compat/src/util.js +0 -23
- package/lib/preact/hooks/src/index.d.ts +0 -133
- package/lib/preact/hooks/src/index.js +0 -339
- package/lib/preact/hooks/src/internal.d.ts +0 -55
- package/lib/preact/src/clone-element.js +0 -27
- package/lib/preact/src/compat.ts +0 -0
- package/lib/preact/src/component.js +0 -219
- package/lib/preact/src/constants.js +0 -3
- package/lib/preact/src/create-context.js +0 -55
- package/lib/preact/src/create-element.js +0 -102
- package/lib/preact/src/css.d.ts +0 -30341
- package/lib/preact/src/diff/catch-error.js +0 -41
- package/lib/preact/src/diff/children.js +0 -259
- package/lib/preact/src/diff/index.js +0 -445
- package/lib/preact/src/diff/props.js +0 -163
- package/lib/preact/src/index.d.ts +0 -275
- package/lib/preact/src/index.js +0 -14
- package/lib/preact/src/internal.d.ts +0 -94
- package/lib/preact/src/jsx.d.ts +0 -884
- package/lib/preact/src/options.js +0 -16
- package/lib/preact/src/render.js +0 -98
- package/lib/preact/src/util.js +0 -25
- package/lib/preact-router/.travis.yml +0 -3
- package/lib/preact-router/LICENSE +0 -21
- package/lib/preact-router/README.md +0 -254
- package/lib/preact-router/index.d.ts +0 -71
- package/lib/preact-router/match/index.d.ts +0 -16
- package/lib/preact-router/match/package.json +0 -13
- package/lib/preact-router/match/src/cjs.js +0 -4
- package/lib/preact-router/match/src/index.js +0 -36
- package/lib/preact-router/package-lock.json +0 -12330
- package/lib/preact-router/package.json +0 -78
- package/lib/preact-router/src/cjs.js +0 -11
- package/lib/preact-router/src/index.js +0 -270
- package/lib/preact-router/src/util.js +0 -87
- package/lib/react-window/src/FixedSizeGrid.js +0 -244
- package/lib/react-window/src/FixedSizeList.js +0 -130
- package/lib/react-window/src/VariableSizeGrid.js +0 -507
- package/lib/react-window/src/VariableSizeList.js +0 -316
- package/lib/react-window/src/__tests__/FixedSizeGrid.js +0 -1336
- package/lib/react-window/src/__tests__/FixedSizeList.js +0 -966
- package/lib/react-window/src/__tests__/VariableSizeGrid.js +0 -779
- package/lib/react-window/src/__tests__/VariableSizeList.js +0 -442
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeGrid.js.snap +0 -912
- package/lib/react-window/src/__tests__/__snapshots__/FixedSizeList.js.snap +0 -568
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeGrid.js.snap +0 -542
- package/lib/react-window/src/__tests__/__snapshots__/VariableSizeList.js.snap +0 -331
- package/lib/react-window/src/__tests__/areEqual.js +0 -32
- package/lib/react-window/src/__tests__/shouldComponentUpdate.js +0 -36
- package/lib/react-window/src/areEqual.js +0 -18
- package/lib/react-window/src/createGridComponent.js +0 -919
- package/lib/react-window/src/createListComponent.js +0 -729
- package/lib/react-window/src/domHelpers.js +0 -72
- package/lib/react-window/src/index.js +0 -9
- package/lib/react-window/src/shallowDiffers.js +0 -17
- package/lib/react-window/src/shouldComponentUpdate.js +0 -16
- package/lib/react-window/src/test.js.flow +0 -382
- package/lib/react-window/src/timer.js +0 -36
- package/src/app/demopage.tsx +0 -77
- package/src/app/index.html +0 -48
- package/src/app/main.tsx +0 -30
- package/src/asset/Textures/Alert/bg_tips.png +0 -0
- package/src/asset/Textures/Alert/btn_zhedie_a.png +0 -0
- package/src/asset/Textures/Alert/com_home_bg_left.png +0 -0
- package/src/asset/Textures/Alert/com_home_bg_rightbar.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_a.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_back_top.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_bottombar_sheet.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_list_xiala.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_rightbar_line.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_rightbar_selected.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_touxiang_140.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_touxiang_60.png +0 -0
- package/src/asset/Textures/Commons/com_home_bg_touxiang_80.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_back.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_bottombar.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_bottombar_fadongtai.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_close.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_guanzhu_126.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_guanzhu_86.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_left_bianji.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_left_dongtai.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_left_touxiang.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_selet.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_126.png +0 -0
- package/src/asset/Textures/Commons/com_home_btn_yiguanzhu_86.png +0 -0
- package/src/asset/Textures/Commons/com_home_icon_bottombar_fadongtai.png +0 -0
- package/src/asset/Textures/Commons/com_home_icon_bottombar_red.png +0 -0
- package/src/asset/Textures/Commons/com_home_icon_loading.png +0 -0
- package/src/asset/Textures/Commons/com_home_pic_touxiang_moren.png +0 -0
- package/src/asset/Textures/Commons/com_home_tab_left_a.png +0 -0
- package/src/asset/Textures/Commons/com_home_tab_left_b.png +0 -0
- package/src/asset/Textures/Commons/com_home_tab_left_c.png +0 -0
- package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_v.png +0 -0
- package/src/asset/Textures/Commons/feedItems/gc1_huati_icon_middle_yonghurenzheng.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_line.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_chakan.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_middle_input.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_bg_zan.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_middle_input.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_more.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_photo_more.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_a_shadow.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_btn_zhedie_b_pressed.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_a_pressed.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_b_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_c_normal.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_d.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_e.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_f_share.png +0 -0
- package/src/asset/Textures/Commons/feedItems/pinglun_icon_middle_input_back.png +0 -0
- package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn.png +0 -0
- package/src/asset/Textures/Commons/gc1_huati_bg_middle_topbtn_pressd.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_bg_music.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_btn_a.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_btn_b.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_icon_b.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_icon_d.png +0 -0
- package/src/asset/Textures/Commons/karaoke/rukou_icon_e.png +0 -0
- package/src/asset/Textures/Commons/rukou_bg_bottombar_line.png +0 -0
- package/src/asset/Textures/Commons/rukou_icon_a.png +0 -0
- package/src/asset/Textures/Commons/tc_bianji_tab_a.png +0 -0
- package/src/asset/Textures/Commons/tc_zanshang_bg_line.png +0 -0
- package/src/asset/Textures/Commons/touxiang_bg_tishikuang.png +0 -0
- package/src/asset/Textures/Commons/video/rukou_icon_shipin.png +0 -0
- package/src/asset/Textures/Commons/video/xiangce_btn_bofang.png +0 -0
- package/src/asset/Textures/Commons/voice/rukou_icon_yuyin.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg_load.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_a.png +0 -0
- package/src/asset/Textures/Commons/voice/tc_yuyin_bg_xinhao_b.png +0 -0
- package/src/asset/Textures/Commons/xiangce_icon_bottombar_gulita.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_bottom.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_input.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_tips.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_a.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_topbar_line.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_upload_photo_line.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_bg_zhaopian_line.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_btn.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_btn_close.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_btn_upload_photo.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_radio_normal.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_radio_normal_@slice_0.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_radio_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/com_tc_tab_a.png +0 -0
- package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar.png +0 -0
- package/src/asset/Textures/SocialSecond/gc1_huati_bg_middle_topbar_pre.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_left_line.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_left_normal.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_left_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/newmessage_bg_middle_new.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list_line.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list_my.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_list_top.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_bg_topbar_a.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_icon_topbar_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_pic_1.png +0 -0
- package/src/asset/Textures/SocialSecond/paihang_pic_2.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_fadongtai_btn_close.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_guanzhu_bg_topbar_selected.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_bg_daoju.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_btn_a.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_btn_b.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_btn_c.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju1.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju2.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_liwu_pic_daoju3.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_pinglun_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_shipin_tianjiashipin.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg_delete.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_a.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_bg_xinhao_b.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_star.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_yuyin_stop.png +0 -0
- package/src/asset/Textures/SocialSecond/tc_zanshang_bg_line.png +0 -0
- package/src/asset/Textures/SocialSecond/touxiang_bg_tishikuang.png +0 -0
- package/src/asset/Textures/SocialSecond/xiangce_huadong.png +0 -0
- package/src/asset/Textures/SocialSecond/xiangce_huadong_xuanzhong.png +0 -0
- package/src/asset/Textures/SocialSecond/xiangce_icon_xiazai.png +0 -0
- package/src/asset/Textures/SocialVideo/com_home_btn_close.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_bg_guodu.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_jinduanjian.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_jindutiao_hui.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_play.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_play_big.png +0 -0
- package/src/asset/Textures/SocialVideo/tc_shipin_stop.png +0 -0
- package/src/asset/laugh.gif +0 -0
- package/src/asset/npms.png +0 -0
- package/src/asset/pixui.png +0 -0
- package/src/asset/preact.png +0 -0
- package/src/asset/template.html +0 -47
- package/src/common/frame/appsettings.js +0 -111
- package/src/common/frame/common.js +0 -17
- package/src/common/frame/platform-api-callback.js +0 -341
- package/src/common/frame/platform-api.d.ts +0 -156
- package/src/common/frame/platform-api.js +0 -479
- package/src/common/main.less +0 -119
- package/src/pixUIReactComponents/README.md +0 -8
- package/src/pixUIReactComponents/package.json +0 -11
- package/src/pixUIReactComponents/tsconfig.json +0 -45
- package/src/pixUIReactComponents/ui/sample/Slapface/SlapfaceDemo.tsx +0 -30
- package/src/pixUIReactUtils/GenerateConstructorAndGeterSeter.js +0 -227
- package/src/pixUIReactUtils/MakeImage.js +0 -207
- package/src/pixUIReactUtils/README.md +0 -124
- package/src/pixUIReactUtils/Version.js +0 -3
- package/src/pixUIReactUtils/img/makeImage.png +0 -0
- package/src/pixUIReactUtils/index.js +0 -1
- package/src/pixUIReactUtils/package.json +0 -16
- package/src/preprocess/index.html +0 -48
- package/src/preprocess/main.tsx +0 -17
- package/src/preprocess/preprocesspage.tsx +0 -41
- /package/{src/pixUIReactComponents/cmdAfterTsBuild.js → cmdAfterTsBuild.js} +0 -0
- /package/{src/pixUIReactComponents/index.js → index.js} +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/EventDispatcherJs.tsx +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/Logger.tsx +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/img/logger.png +0 -0
- /package/{src/pixUIReactComponents/tools → tools}/tools.md +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletItemAnimation.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/BulletScreenAnimation.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/bulletscreen/bullet.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/button/Button.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/carousel/Carousel.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/checkBox/CheckBox.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/Dropdown.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownOptionUI.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownSpreadMainUI.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/dropdown/DropdownUnspreadMainUI.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/gradient/GradientText.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/outlinetext/OutlineText.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/progress/Progress.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/slapface/less/Slapface.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/slider/Slider.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tab.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/tab/Tabs.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/togglegroup/ToggleGroup.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/videoplayer/VideoPlayer.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/WaterfallComponent.jsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/components/waterfallcomponent/less/WaterfallComponent.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/Images.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/OutlineText/OutlineDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/btn_close.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/changtai_button.jpg +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox0.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/checkbox1.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_down.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/data_arrow_up.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/dot.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/inner.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/item_reddot.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/loading.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdown.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/money_dropdownall.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/outer.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic1.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic2.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic3.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic4.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic5.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/slapface_samplepic6.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tab_choosed.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/tabs_bg.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_pause.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_play.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/video_reload.png +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/xuanfu_button.jpg +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/asset/yaxia_button.jpg +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/bulletscreen/BulletDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/button/ButtonDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/carousel/carouselDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/checkBox/checkBoxDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/DropdownDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownOption.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownSpreadMain.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/dropdown/MoneyDropdownUnspreadMain.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/gradient/GradientDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/less/video.less +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/progress/ProgressDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/slider/SliderDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TabDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/tab/TopTab.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/togglegroup/ToggleGroupDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/videoplayer/VideoPlayerDemo.tsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/sample/waterfallcomponent/WaterfallComponentDemo.jsx +0 -0
- /package/{src/pixUIReactComponents/ui → ui}/ui.md +0 -0
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { Component, toChildArray } from 'preact';
|
|
2
|
-
import { suspended } from './suspense.js';
|
|
3
|
-
|
|
4
|
-
// Indexes to linked list nodes (nodes are stored as arrays to save bytes).
|
|
5
|
-
const SUSPENDED_COUNT = 0;
|
|
6
|
-
const RESOLVED_COUNT = 1;
|
|
7
|
-
const NEXT_NODE = 2;
|
|
8
|
-
|
|
9
|
-
// Having custom inheritance instead of a class here saves a lot of bytes.
|
|
10
|
-
export function SuspenseList() {
|
|
11
|
-
this._next = null;
|
|
12
|
-
this._map = null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Mark one of child's earlier suspensions as resolved.
|
|
16
|
-
// Some pending callbacks may become callable due to this
|
|
17
|
-
// (e.g. the last suspended descendant gets resolved when
|
|
18
|
-
// revealOrder === 'together'). Process those callbacks as well.
|
|
19
|
-
const resolve = (list, child, node) => {
|
|
20
|
-
if (++node[RESOLVED_COUNT] === node[SUSPENDED_COUNT]) {
|
|
21
|
-
// The number a child (or any of its descendants) has been suspended
|
|
22
|
-
// matches the number of times it's been resolved. Therefore we
|
|
23
|
-
// mark the child as completely resolved by deleting it from ._map.
|
|
24
|
-
// This is used to figure out when *all* children have been completely
|
|
25
|
-
// resolved when revealOrder is 'together'.
|
|
26
|
-
list._map.delete(child);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// If revealOrder is falsy then we can do an early exit, as the
|
|
30
|
-
// callbacks won't get queued in the node anyway.
|
|
31
|
-
// If revealOrder is 'together' then also do an early exit
|
|
32
|
-
// if all suspended descendants have not yet been resolved.
|
|
33
|
-
if (
|
|
34
|
-
!list.props.revealOrder ||
|
|
35
|
-
(list.props.revealOrder[0] === 't' && list._map.size)
|
|
36
|
-
) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Walk the currently suspended children in order, calling their
|
|
41
|
-
// stored callbacks on the way. Stop if we encounter a child that
|
|
42
|
-
// has not been completely resolved yet.
|
|
43
|
-
node = list._next;
|
|
44
|
-
while (node) {
|
|
45
|
-
while (node.length > 3) {
|
|
46
|
-
node.pop()();
|
|
47
|
-
}
|
|
48
|
-
if (node[RESOLVED_COUNT] < node[SUSPENDED_COUNT]) {
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
list._next = node = node[NEXT_NODE];
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// Things we do here to save some bytes but are not proper JS inheritance:
|
|
56
|
-
// - call `new Component()` as the prototype
|
|
57
|
-
// - do not set `Suspense.prototype.constructor` to `Suspense`
|
|
58
|
-
SuspenseList.prototype = new Component();
|
|
59
|
-
|
|
60
|
-
SuspenseList.prototype._suspended = function(child) {
|
|
61
|
-
const list = this;
|
|
62
|
-
const delegated = suspended(list._vnode);
|
|
63
|
-
|
|
64
|
-
let node = list._map.get(child);
|
|
65
|
-
node[SUSPENDED_COUNT]++;
|
|
66
|
-
|
|
67
|
-
return unsuspend => {
|
|
68
|
-
const wrappedUnsuspend = () => {
|
|
69
|
-
if (!list.props.revealOrder) {
|
|
70
|
-
// Special case the undefined (falsy) revealOrder, as there
|
|
71
|
-
// is no need to coordinate a specific order or unsuspends.
|
|
72
|
-
unsuspend();
|
|
73
|
-
} else {
|
|
74
|
-
node.push(unsuspend);
|
|
75
|
-
resolve(list, child, node);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
if (delegated) {
|
|
79
|
-
delegated(wrappedUnsuspend);
|
|
80
|
-
} else {
|
|
81
|
-
wrappedUnsuspend();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
SuspenseList.prototype.render = function(props) {
|
|
87
|
-
this._next = null;
|
|
88
|
-
this._map = new Map();
|
|
89
|
-
|
|
90
|
-
const children = toChildArray(props.children);
|
|
91
|
-
if (props.revealOrder && props.revealOrder[0] === 'b') {
|
|
92
|
-
// If order === 'backwards' (or, well, anything starting with a 'b')
|
|
93
|
-
// then flip the child list around so that the last child will be
|
|
94
|
-
// the first in the linked list.
|
|
95
|
-
children.reverse();
|
|
96
|
-
}
|
|
97
|
-
// Build the linked list. Iterate through the children in reverse order
|
|
98
|
-
// so that `_next` points to the first linked list node to be resolved.
|
|
99
|
-
for (let i = children.length; i--; ) {
|
|
100
|
-
// Create a new linked list node as an array of form:
|
|
101
|
-
// [suspended_count, resolved_count, next_node]
|
|
102
|
-
// where suspended_count and resolved_count are numeric counters for
|
|
103
|
-
// keeping track how many times a node has been suspended and resolved.
|
|
104
|
-
//
|
|
105
|
-
// Note that suspended_count starts from 1 instead of 0, so we can block
|
|
106
|
-
// processing callbacks until componentDidMount has been called. In a sense
|
|
107
|
-
// node is suspended at least until componentDidMount gets called!
|
|
108
|
-
//
|
|
109
|
-
// Pending callbacks are added to the end of the node:
|
|
110
|
-
// [suspended_count, resolved_count, next_node, callback_0, callback_1, ...]
|
|
111
|
-
this._map.set(children[i], (this._next = [1, 0, this._next]));
|
|
112
|
-
}
|
|
113
|
-
return props.children;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
SuspenseList.prototype.componentDidUpdate = SuspenseList.prototype.componentDidMount = function() {
|
|
117
|
-
// Iterate through all children after mounting for two reasons:
|
|
118
|
-
// 1. As each node[SUSPENDED_COUNT] starts from 1, this iteration increases
|
|
119
|
-
// each node[RELEASED_COUNT] by 1, therefore balancing the counters.
|
|
120
|
-
// The nodes can now be completely consumed from the linked list.
|
|
121
|
-
// 2. Handle nodes that might have gotten resolved between render and
|
|
122
|
-
// componentDidMount.
|
|
123
|
-
const list = this;
|
|
124
|
-
list._map.forEach((node, child) => {
|
|
125
|
-
resolve(list, child, node);
|
|
126
|
-
});
|
|
127
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Component, ComponentChild } from '../../src';
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
// Suspense/lazy
|
|
5
|
-
// -----------------------------------
|
|
6
|
-
export function lazy<T>(loader: () => Promise<{ default: T }>): T;
|
|
7
|
-
|
|
8
|
-
export interface SuspenseProps {
|
|
9
|
-
children?: preact.ComponentChildren;
|
|
10
|
-
fallback: preact.ComponentChildren;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class Suspense extends Component<SuspenseProps> {
|
|
14
|
-
render(): ComponentChild;
|
|
15
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { Component, createElement, options } from 'preact';
|
|
2
|
-
import { assign } from './util';
|
|
3
|
-
|
|
4
|
-
const oldCatchError = options._catchError;
|
|
5
|
-
options._catchError = function(error, newVNode, oldVNode) {
|
|
6
|
-
if (error.then) {
|
|
7
|
-
/** @type {import('./internal').Component} */
|
|
8
|
-
let component;
|
|
9
|
-
let vnode = newVNode;
|
|
10
|
-
|
|
11
|
-
for (; (vnode = vnode._parent); ) {
|
|
12
|
-
if ((component = vnode._component) && component._childDidSuspend) {
|
|
13
|
-
// Don't call oldCatchError if we found a Suspense
|
|
14
|
-
return component._childDidSuspend(error, newVNode._component);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
oldCatchError(error, newVNode, oldVNode);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function detachedClone(vnode) {
|
|
22
|
-
if (vnode) {
|
|
23
|
-
vnode = assign({}, vnode);
|
|
24
|
-
vnode._component = null;
|
|
25
|
-
vnode._children = vnode._children && vnode._children.map(detachedClone);
|
|
26
|
-
}
|
|
27
|
-
return vnode;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// having custom inheritance instead of a class here saves a lot of bytes
|
|
31
|
-
export function Suspense() {
|
|
32
|
-
// we do not call super here to golf some bytes...
|
|
33
|
-
this._pendingSuspensionCount = 0;
|
|
34
|
-
this._suspenders = null;
|
|
35
|
-
this._detachOnNextRender = null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Things we do here to save some bytes but are not proper JS inheritance:
|
|
39
|
-
// - call `new Component()` as the prototype
|
|
40
|
-
// - do not set `Suspense.prototype.constructor` to `Suspense`
|
|
41
|
-
Suspense.prototype = new Component();
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param {Promise} promise The thrown promise
|
|
45
|
-
* @param {Component<any, any>} suspendingComponent The suspending component
|
|
46
|
-
*/
|
|
47
|
-
Suspense.prototype._childDidSuspend = function(promise, suspendingComponent) {
|
|
48
|
-
/** @type {import('./internal').SuspenseComponent} */
|
|
49
|
-
const c = this;
|
|
50
|
-
|
|
51
|
-
if (c._suspenders == null) {
|
|
52
|
-
c._suspenders = [];
|
|
53
|
-
}
|
|
54
|
-
c._suspenders.push(suspendingComponent);
|
|
55
|
-
|
|
56
|
-
const resolve = suspended(c._vnode);
|
|
57
|
-
|
|
58
|
-
let resolved = false;
|
|
59
|
-
const onResolved = () => {
|
|
60
|
-
if (resolved) return;
|
|
61
|
-
|
|
62
|
-
resolved = true;
|
|
63
|
-
|
|
64
|
-
if (resolve) {
|
|
65
|
-
resolve(onSuspensionComplete);
|
|
66
|
-
} else {
|
|
67
|
-
onSuspensionComplete();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
suspendingComponent._suspendedComponentWillUnmount =
|
|
72
|
-
suspendingComponent.componentWillUnmount;
|
|
73
|
-
suspendingComponent.componentWillUnmount = () => {
|
|
74
|
-
onResolved();
|
|
75
|
-
|
|
76
|
-
if (suspendingComponent._suspendedComponentWillUnmount) {
|
|
77
|
-
suspendingComponent._suspendedComponentWillUnmount();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const onSuspensionComplete = () => {
|
|
82
|
-
if (!--c._pendingSuspensionCount) {
|
|
83
|
-
c._vnode._children[0] = c.state._suspended;
|
|
84
|
-
c.setState({ _suspended: (c._detachOnNextRender = null) });
|
|
85
|
-
|
|
86
|
-
let suspended;
|
|
87
|
-
while ((suspended = c._suspenders.pop())) {
|
|
88
|
-
suspended.forceUpdate();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
if (!c._pendingSuspensionCount++) {
|
|
94
|
-
c.setState({ _suspended: (c._detachOnNextRender = c._vnode._children[0]) });
|
|
95
|
-
}
|
|
96
|
-
promise.then(onResolved, onResolved);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
Suspense.prototype.render = function(props, state) {
|
|
100
|
-
if (this._detachOnNextRender) {
|
|
101
|
-
this._vnode._children[0] = detachedClone(this._detachOnNextRender);
|
|
102
|
-
this._detachOnNextRender = null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return [
|
|
106
|
-
createElement(Component, null, state._suspended ? null : props.children),
|
|
107
|
-
state._suspended && props.fallback
|
|
108
|
-
];
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Checks and calls the parent component's _suspended method, passing in the
|
|
113
|
-
* suspended vnode. This is a way for a parent (e.g. SuspenseList) to get notified
|
|
114
|
-
* that one of its children/descendants suspended.
|
|
115
|
-
*
|
|
116
|
-
* The parent MAY return a callback. The callback will get called when the
|
|
117
|
-
* suspension resolves, notifying the parent of the fact.
|
|
118
|
-
* Moreover, the callback gets function `unsuspend` as a parameter. The resolved
|
|
119
|
-
* child descendant will not actually get unsuspended until `unsuspend` gets called.
|
|
120
|
-
* This is a way for the parent to delay unsuspending.
|
|
121
|
-
*
|
|
122
|
-
* If the parent does not return a callback then the resolved vnode
|
|
123
|
-
* gets unsuspended immediately when it resolves.
|
|
124
|
-
*
|
|
125
|
-
* @param {import('../src/internal').VNode} vnode
|
|
126
|
-
* @returns {((unsuspend: () => void) => void)?}
|
|
127
|
-
*/
|
|
128
|
-
export function suspended(vnode) {
|
|
129
|
-
let component = vnode._parent._component;
|
|
130
|
-
return component && component._suspended && component._suspended(vnode);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function lazy(loader) {
|
|
134
|
-
let prom;
|
|
135
|
-
let component;
|
|
136
|
-
let error;
|
|
137
|
-
|
|
138
|
-
function Lazy(props) {
|
|
139
|
-
if (!prom) {
|
|
140
|
-
prom = loader();
|
|
141
|
-
prom.then(
|
|
142
|
-
exports => {
|
|
143
|
-
component = exports.default || exports;
|
|
144
|
-
},
|
|
145
|
-
e => {
|
|
146
|
-
error = e;
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (error) {
|
|
152
|
-
throw error;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (!component) {
|
|
156
|
-
throw prom;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return createElement(component, props);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
Lazy.displayName = 'Lazy';
|
|
163
|
-
Lazy._forwarded = true;
|
|
164
|
-
return Lazy;
|
|
165
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Assign properties from `props` to `obj`
|
|
3
|
-
* @template O, P The obj and props types
|
|
4
|
-
* @param {O} obj The object to copy properties to
|
|
5
|
-
* @param {P} props The object to copy properties from
|
|
6
|
-
* @returns {O & P}
|
|
7
|
-
*/
|
|
8
|
-
export function assign(obj, props) {
|
|
9
|
-
for (let i in props) obj[i] = props[i];
|
|
10
|
-
return /** @type {O & P} */ (obj);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check if two objects have a different shape
|
|
15
|
-
* @param {object} a
|
|
16
|
-
* @param {object} b
|
|
17
|
-
* @returns {boolean}
|
|
18
|
-
*/
|
|
19
|
-
export function shallowDiffers(a, b) {
|
|
20
|
-
for (let i in a) if (i !== '__source' && !(i in b)) return true;
|
|
21
|
-
for (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { PreactContext, Ref as PreactRef } from '../..';
|
|
2
|
-
|
|
3
|
-
type Inputs = ReadonlyArray<unknown>;
|
|
4
|
-
|
|
5
|
-
export type StateUpdater<S> = (value: S | ((prevState: S) => S)) => void;
|
|
6
|
-
/**
|
|
7
|
-
* Returns a stateful value, and a function to update it.
|
|
8
|
-
* @param initialState The initial value (or a function that returns the initial value)
|
|
9
|
-
*/
|
|
10
|
-
export function useState<S>(initialState: S | (() => S)): [S, StateUpdater<S>];
|
|
11
|
-
|
|
12
|
-
export type Reducer<S, A> = (prevState: S, action: A) => S;
|
|
13
|
-
/**
|
|
14
|
-
* An alternative to `useState`.
|
|
15
|
-
*
|
|
16
|
-
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
|
17
|
-
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
|
18
|
-
* updates because you can pass `dispatch` down instead of callbacks.
|
|
19
|
-
* @param reducer Given the current state and an action, returns the new state
|
|
20
|
-
* @param initialState The initial value to store as state
|
|
21
|
-
*/
|
|
22
|
-
export function useReducer<S, A>(
|
|
23
|
-
reducer: Reducer<S, A>,
|
|
24
|
-
initialState: S
|
|
25
|
-
): [S, (action: A) => void];
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* An alternative to `useState`.
|
|
29
|
-
*
|
|
30
|
-
* `useReducer` is usually preferable to `useState` when you have complex state logic that involves
|
|
31
|
-
* multiple sub-values. It also lets you optimize performance for components that trigger deep
|
|
32
|
-
* updates because you can pass `dispatch` down instead of callbacks.
|
|
33
|
-
* @param reducer Given the current state and an action, returns the new state
|
|
34
|
-
* @param initialArg The initial argument to pass to the `init` function
|
|
35
|
-
* @param init A function that, given the `initialArg`, returns the initial value to store as state
|
|
36
|
-
*/
|
|
37
|
-
export function useReducer<S, A, I>(
|
|
38
|
-
reducer: Reducer<S, A>,
|
|
39
|
-
initialArg: I,
|
|
40
|
-
init: (arg: I) => S
|
|
41
|
-
): [S, (action: A) => void];
|
|
42
|
-
|
|
43
|
-
type PropRef<T> = { current?: T };
|
|
44
|
-
type Ref<T> = { current: T };
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument
|
|
48
|
-
* (`initialValue`). The returned object will persist for the full lifetime of the component.
|
|
49
|
-
*
|
|
50
|
-
* Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable
|
|
51
|
-
* value around similar to how you’d use instance fields in classes.
|
|
52
|
-
*/
|
|
53
|
-
export function useRef<T>(initialValue: T | null): Ref<T>;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* `useRef` without an initial value is the special case handling `ref` props.
|
|
57
|
-
* If you want a non prop-based, mutable ref, you can explicitly give it an initial value of undefined/null/etc.
|
|
58
|
-
* You should explicitly set the type parameter for the expected ref value to either a DOM Element like `HTMLInputElement` or a `Component`
|
|
59
|
-
*/
|
|
60
|
-
export function useRef<T = unknown>(): PropRef<T>;
|
|
61
|
-
|
|
62
|
-
type EffectCallback = () => void | (() => void);
|
|
63
|
-
/**
|
|
64
|
-
* Accepts a function that contains imperative, possibly effectful code.
|
|
65
|
-
* The effects run after browser paint, without blocking it.
|
|
66
|
-
*
|
|
67
|
-
* @param effect Imperative function that can return a cleanup function
|
|
68
|
-
* @param inputs If present, effect will only activate if the values in the list change (using ===).
|
|
69
|
-
*/
|
|
70
|
-
export function useEffect(effect: EffectCallback, inputs?: Inputs): void;
|
|
71
|
-
|
|
72
|
-
type CreateHandle = () => object;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @param ref The ref that will be mutated
|
|
76
|
-
* @param create The function that will be executed to get the value that will be attached to
|
|
77
|
-
* ref.current
|
|
78
|
-
* @param inputs If present, effect will only activate if the values in the list change (using ===).
|
|
79
|
-
*/
|
|
80
|
-
export function useImperativeHandle<T, R extends T>(
|
|
81
|
-
ref: PreactRef<T>,
|
|
82
|
-
create: () => R,
|
|
83
|
-
inputs?: Inputs
|
|
84
|
-
): void;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Accepts a function that contains imperative, possibly effectful code.
|
|
88
|
-
* Use this to read layout from the DOM and synchronously re-render.
|
|
89
|
-
* Updates scheduled inside `useLayoutEffect` will be flushed synchronously, after all DOM mutations but before the browser has a chance to paint.
|
|
90
|
-
* Prefer the standard `useEffect` hook when possible to avoid blocking visual updates.
|
|
91
|
-
*
|
|
92
|
-
* @param effect Imperative function that can return a cleanup function
|
|
93
|
-
* @param inputs If present, effect will only activate if the values in the list change (using ===).
|
|
94
|
-
*/
|
|
95
|
-
export function useLayoutEffect(effect: EffectCallback, inputs?: Inputs): void;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Returns a memoized version of the callback that only changes if one of the `inputs`
|
|
99
|
-
* has changed (using ===).
|
|
100
|
-
*/
|
|
101
|
-
export function useCallback<T extends Function>(callback: T, inputs: Inputs): T;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Pass a factory function and an array of inputs.
|
|
105
|
-
* useMemo will only recompute the memoized value when one of the inputs has changed.
|
|
106
|
-
* This optimization helps to avoid expensive calculations on every render.
|
|
107
|
-
* If no array is provided, a new value will be computed whenever a new function instance is passed as the first argument.
|
|
108
|
-
*/
|
|
109
|
-
// for `inputs`, allow undefined, but don't make it optional as that is very likely a mistake
|
|
110
|
-
export function useMemo<T>(factory: () => T, inputs: Inputs | undefined): T;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Returns the current context value, as given by the nearest context provider for the given context.
|
|
114
|
-
* When the provider updates, this Hook will trigger a rerender with the latest context value.
|
|
115
|
-
*
|
|
116
|
-
* @param context The context you want to use
|
|
117
|
-
*/
|
|
118
|
-
export function useContext<T>(context: PreactContext<T>): T;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Customize the displayed value in the devtools panel.
|
|
122
|
-
*
|
|
123
|
-
* @param value Custom hook name or object that is passed to formatter
|
|
124
|
-
* @param formatter Formatter to modify value before sending it to the devtools
|
|
125
|
-
*/
|
|
126
|
-
export function useDebugValue<T>(
|
|
127
|
-
value: T,
|
|
128
|
-
formatter?: (value: T) => string | number
|
|
129
|
-
): void;
|
|
130
|
-
|
|
131
|
-
export function useErrorBoundary(
|
|
132
|
-
callback?: (error: any) => Promise<void> | void
|
|
133
|
-
): [any, () => void];
|