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,445 +0,0 @@
|
|
|
1
|
-
import { EMPTY_OBJ, EMPTY_ARR } from '../constants';
|
|
2
|
-
import { Component } from '../component';
|
|
3
|
-
import { Fragment } from '../create-element';
|
|
4
|
-
import { diffChildren } from './children';
|
|
5
|
-
import { diffProps, setProperty } from './props';
|
|
6
|
-
import { assign, removeNode } from '../util';
|
|
7
|
-
import options from '../options';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Diff two virtual nodes and apply proper changes to the DOM
|
|
11
|
-
* @param {import('../internal').PreactElement} parentDom The parent of the DOM element
|
|
12
|
-
* @param {import('../internal').VNode} newVNode The new virtual node
|
|
13
|
-
* @param {import('../internal').VNode} oldVNode The old virtual node
|
|
14
|
-
* @param {object} globalContext The current context object. Modified by getChildContext
|
|
15
|
-
* @param {boolean} isSvg Whether or not this element is an SVG node
|
|
16
|
-
* @param {Array<import('../internal').PreactElement>} excessDomChildren
|
|
17
|
-
* @param {Array<import('../internal').Component>} commitQueue List of components
|
|
18
|
-
* which have callbacks to invoke in commitRoot
|
|
19
|
-
* @param {Element | Text} oldDom The current attached DOM
|
|
20
|
-
* element any new dom elements should be placed around. Likely `null` on first
|
|
21
|
-
* render (except when hydrating). Can be a sibling DOM element when diffing
|
|
22
|
-
* Fragments that have siblings. In most cases, it starts out as `oldChildren[0]._dom`.
|
|
23
|
-
* @param {boolean} [isHydrating] Whether or not we are in hydration
|
|
24
|
-
*/
|
|
25
|
-
export function diff(
|
|
26
|
-
parentDom,
|
|
27
|
-
newVNode,
|
|
28
|
-
oldVNode,
|
|
29
|
-
globalContext,
|
|
30
|
-
isSvg,
|
|
31
|
-
excessDomChildren,
|
|
32
|
-
commitQueue,
|
|
33
|
-
oldDom,
|
|
34
|
-
isHydrating
|
|
35
|
-
) {
|
|
36
|
-
let tmp,
|
|
37
|
-
newType = newVNode.type;
|
|
38
|
-
|
|
39
|
-
// When passing through createElement it assigns the object
|
|
40
|
-
// constructor as undefined. This to prevent JSON-injection.
|
|
41
|
-
if (newVNode.constructor !== undefined) return null;
|
|
42
|
-
|
|
43
|
-
if ((tmp = options._diff)) tmp(newVNode);
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
outer: if (typeof newType == 'function') {
|
|
47
|
-
let c, isNew, oldProps, oldState, snapshot, clearProcessingException;
|
|
48
|
-
let newProps = newVNode.props;
|
|
49
|
-
|
|
50
|
-
// Necessary for createContext api. Setting this property will pass
|
|
51
|
-
// the context value as `this.context` just for this component.
|
|
52
|
-
tmp = newType.contextType;
|
|
53
|
-
let provider = tmp && globalContext[tmp._id];
|
|
54
|
-
let componentContext = tmp
|
|
55
|
-
? provider
|
|
56
|
-
? provider.props.value
|
|
57
|
-
: tmp._defaultValue
|
|
58
|
-
: globalContext;
|
|
59
|
-
|
|
60
|
-
// Get component and set it to `c`
|
|
61
|
-
if (oldVNode._component) {
|
|
62
|
-
c = newVNode._component = oldVNode._component;
|
|
63
|
-
clearProcessingException = c._processingException = c._pendingError;
|
|
64
|
-
} else {
|
|
65
|
-
// Instantiate the new component
|
|
66
|
-
if ('prototype' in newType && newType.prototype.render) {
|
|
67
|
-
newVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap
|
|
68
|
-
} else {
|
|
69
|
-
newVNode._component = c = new Component(newProps, componentContext);
|
|
70
|
-
c.constructor = newType;
|
|
71
|
-
c.render = doRender;
|
|
72
|
-
}
|
|
73
|
-
if (provider) provider.sub(c);
|
|
74
|
-
|
|
75
|
-
c.props = newProps;
|
|
76
|
-
if (!c.state) c.state = {};
|
|
77
|
-
c.context = componentContext;
|
|
78
|
-
c._globalContext = globalContext;
|
|
79
|
-
isNew = c._dirty = true;
|
|
80
|
-
c._renderCallbacks = [];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Invoke getDerivedStateFromProps
|
|
84
|
-
if (c._nextState == null) {
|
|
85
|
-
c._nextState = c.state;
|
|
86
|
-
}
|
|
87
|
-
if (newType.getDerivedStateFromProps != null) {
|
|
88
|
-
if (c._nextState == c.state) {
|
|
89
|
-
c._nextState = assign({}, c._nextState);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
assign(c._nextState, newType.getDerivedStateFromProps(newProps, c._nextState));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
oldProps = c.props;
|
|
96
|
-
oldState = c.state;
|
|
97
|
-
|
|
98
|
-
// Invoke pre-render lifecycle methods
|
|
99
|
-
if (isNew) {
|
|
100
|
-
if (newType.getDerivedStateFromProps == null && c.componentWillMount != null) {
|
|
101
|
-
c.componentWillMount();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (c.componentDidMount != null) {
|
|
105
|
-
c._renderCallbacks.push(c.componentDidMount);
|
|
106
|
-
}
|
|
107
|
-
} else {
|
|
108
|
-
if (
|
|
109
|
-
newType.getDerivedStateFromProps == null &&
|
|
110
|
-
newProps !== oldProps &&
|
|
111
|
-
c.componentWillReceiveProps != null
|
|
112
|
-
) {
|
|
113
|
-
c.componentWillReceiveProps(newProps, componentContext);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
-
(!c._force &&
|
|
118
|
-
c.shouldComponentUpdate != null &&
|
|
119
|
-
c.shouldComponentUpdate(newProps, c._nextState, componentContext) === false) ||
|
|
120
|
-
(newVNode._original === oldVNode._original && !c._processingException)
|
|
121
|
-
) {
|
|
122
|
-
c.props = newProps;
|
|
123
|
-
c.state = c._nextState;
|
|
124
|
-
// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8
|
|
125
|
-
if (newVNode._original !== oldVNode._original) c._dirty = false;
|
|
126
|
-
c._vnode = newVNode;
|
|
127
|
-
newVNode._dom = oldVNode._dom;
|
|
128
|
-
newVNode._children = oldVNode._children;
|
|
129
|
-
if (c._renderCallbacks.length) {
|
|
130
|
-
commitQueue.push(c);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
for (tmp = 0; tmp < newVNode._children.length; tmp++) {
|
|
134
|
-
if (newVNode._children[tmp]) {
|
|
135
|
-
newVNode._children[tmp]._parent = newVNode;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
break outer;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (c.componentWillUpdate != null) {
|
|
143
|
-
c.componentWillUpdate(newProps, c._nextState, componentContext);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (c.componentDidUpdate != null) {
|
|
147
|
-
c._renderCallbacks.push(() => {
|
|
148
|
-
c.componentDidUpdate(oldProps, oldState, snapshot);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
c.context = componentContext;
|
|
154
|
-
c.props = newProps;
|
|
155
|
-
c.state = c._nextState;
|
|
156
|
-
|
|
157
|
-
if ((tmp = options._render)) tmp(newVNode);
|
|
158
|
-
|
|
159
|
-
c._dirty = false;
|
|
160
|
-
c._vnode = newVNode;
|
|
161
|
-
c._parentDom = parentDom;
|
|
162
|
-
|
|
163
|
-
tmp = c.render(c.props, c.state, c.context);
|
|
164
|
-
let isTopLevelFragment = tmp != null && tmp.type == Fragment && tmp.key == null;
|
|
165
|
-
newVNode._children = isTopLevelFragment
|
|
166
|
-
? tmp.props.children
|
|
167
|
-
: Array.isArray(tmp)
|
|
168
|
-
? tmp
|
|
169
|
-
: [tmp];
|
|
170
|
-
|
|
171
|
-
if (c.getChildContext != null) {
|
|
172
|
-
globalContext = assign(assign({}, globalContext), c.getChildContext());
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (!isNew && c.getSnapshotBeforeUpdate != null) {
|
|
176
|
-
snapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
diffChildren(
|
|
180
|
-
parentDom,
|
|
181
|
-
newVNode,
|
|
182
|
-
oldVNode,
|
|
183
|
-
globalContext,
|
|
184
|
-
isSvg,
|
|
185
|
-
excessDomChildren,
|
|
186
|
-
commitQueue,
|
|
187
|
-
oldDom,
|
|
188
|
-
isHydrating
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
c.base = newVNode._dom;
|
|
192
|
-
|
|
193
|
-
if (c._renderCallbacks.length) {
|
|
194
|
-
commitQueue.push(c);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (clearProcessingException) {
|
|
198
|
-
c._pendingError = c._processingException = null;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
c._force = false;
|
|
202
|
-
} else if (excessDomChildren == null && newVNode._original === oldVNode._original) {
|
|
203
|
-
newVNode._children = oldVNode._children;
|
|
204
|
-
newVNode._dom = oldVNode._dom;
|
|
205
|
-
} else {
|
|
206
|
-
newVNode._dom = diffElementNodes(
|
|
207
|
-
oldVNode._dom,
|
|
208
|
-
newVNode,
|
|
209
|
-
oldVNode,
|
|
210
|
-
globalContext,
|
|
211
|
-
isSvg,
|
|
212
|
-
excessDomChildren,
|
|
213
|
-
commitQueue,
|
|
214
|
-
isHydrating
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if ((tmp = options.diffed)) tmp(newVNode);
|
|
219
|
-
} catch (e) {
|
|
220
|
-
newVNode._original = null;
|
|
221
|
-
options._catchError(e, newVNode, oldVNode);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return newVNode._dom;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* @param {Array<import('../internal').Component>} commitQueue List of components
|
|
229
|
-
* which have callbacks to invoke in commitRoot
|
|
230
|
-
* @param {import('../internal').VNode} root
|
|
231
|
-
*/
|
|
232
|
-
export function commitRoot(commitQueue, root) {
|
|
233
|
-
if (options._commit) options._commit(root, commitQueue);
|
|
234
|
-
|
|
235
|
-
commitQueue.some((c) => {
|
|
236
|
-
try {
|
|
237
|
-
commitQueue = c._renderCallbacks;
|
|
238
|
-
c._renderCallbacks = [];
|
|
239
|
-
commitQueue.some((cb) => {
|
|
240
|
-
cb.call(c);
|
|
241
|
-
});
|
|
242
|
-
} catch (e) {
|
|
243
|
-
options._catchError(e, c._vnode);
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Diff two virtual nodes representing DOM element
|
|
250
|
-
* @param {import('../internal').PreactElement} dom The DOM element representing
|
|
251
|
-
* the virtual nodes being diffed
|
|
252
|
-
* @param {import('../internal').VNode} newVNode The new virtual node
|
|
253
|
-
* @param {import('../internal').VNode} oldVNode The old virtual node
|
|
254
|
-
* @param {object} globalContext The current context object
|
|
255
|
-
* @param {boolean} isSvg Whether or not this DOM node is an SVG node
|
|
256
|
-
* @param {*} excessDomChildren
|
|
257
|
-
* @param {Array<import('../internal').Component>} commitQueue List of components
|
|
258
|
-
* which have callbacks to invoke in commitRoot
|
|
259
|
-
* @param {boolean} isHydrating Whether or not we are in hydration
|
|
260
|
-
* @returns {import('../internal').PreactElement}
|
|
261
|
-
*/
|
|
262
|
-
function diffElementNodes(
|
|
263
|
-
dom,
|
|
264
|
-
newVNode,
|
|
265
|
-
oldVNode,
|
|
266
|
-
globalContext,
|
|
267
|
-
isSvg,
|
|
268
|
-
excessDomChildren,
|
|
269
|
-
commitQueue,
|
|
270
|
-
isHydrating
|
|
271
|
-
) {
|
|
272
|
-
let i;
|
|
273
|
-
let oldProps = oldVNode.props;
|
|
274
|
-
let newProps = newVNode.props;
|
|
275
|
-
|
|
276
|
-
// Tracks entering and exiting SVG namespace when descending through the tree.
|
|
277
|
-
isSvg = newVNode.type === 'svg' || isSvg;
|
|
278
|
-
|
|
279
|
-
if (excessDomChildren != null) {
|
|
280
|
-
for (i = 0; i < excessDomChildren.length; i++) {
|
|
281
|
-
const child = excessDomChildren[i];
|
|
282
|
-
|
|
283
|
-
// if newVNode matches an element in excessDomChildren or the `dom`
|
|
284
|
-
// argument matches an element in excessDomChildren, remove it from
|
|
285
|
-
// excessDomChildren so it isn't later removed in diffChildren
|
|
286
|
-
if (
|
|
287
|
-
child != null &&
|
|
288
|
-
((newVNode.type === null ? child.nodeType === 3 : child.localName === newVNode.type) ||
|
|
289
|
-
dom == child)
|
|
290
|
-
) {
|
|
291
|
-
dom = child;
|
|
292
|
-
excessDomChildren[i] = null;
|
|
293
|
-
break;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (dom == null) {
|
|
299
|
-
if (newVNode.type === null) {
|
|
300
|
-
addOP(`createtext ${newProps}`);
|
|
301
|
-
return document.createTextNode(newProps);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
dom = isSvg
|
|
305
|
-
? document.createElementNS('http://www.w3.org/2000/svg', newVNode.type)
|
|
306
|
-
: document.createElement(newVNode.type, newProps.is && { is: newProps.is });
|
|
307
|
-
addOP(`createdom ${newVNode.type}`);
|
|
308
|
-
// we created a new parent, so none of the previously attached children can be reused:
|
|
309
|
-
excessDomChildren = null;
|
|
310
|
-
// we are creating a new node, so we can assume this is a new subtree (in case we are hydrating), this deopts the hydrate
|
|
311
|
-
isHydrating = false;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (newVNode.type === null) {
|
|
315
|
-
if (oldProps !== newProps && dom.data != newProps) {
|
|
316
|
-
addOP(`setdata ${newProps}`);
|
|
317
|
-
dom.data = newProps;
|
|
318
|
-
}
|
|
319
|
-
} else {
|
|
320
|
-
if (excessDomChildren != null) {
|
|
321
|
-
excessDomChildren = EMPTY_ARR.slice.call(dom.childNodes);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
oldProps = oldVNode.props || EMPTY_OBJ;
|
|
325
|
-
|
|
326
|
-
let oldHtml = oldProps.dangerouslySetInnerHTML;
|
|
327
|
-
let newHtml = newProps.dangerouslySetInnerHTML;
|
|
328
|
-
|
|
329
|
-
// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)
|
|
330
|
-
// @TODO we should warn in debug mode when props don't match here.
|
|
331
|
-
if (!isHydrating) {
|
|
332
|
-
if (oldProps === EMPTY_OBJ) {
|
|
333
|
-
oldProps = {};
|
|
334
|
-
for (let i = 0; i < dom.attributes.length; i++) {
|
|
335
|
-
oldProps[dom.attributes[i].name] = dom.attributes[i].value;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (newHtml || oldHtml) {
|
|
340
|
-
// Avoid re-applying the same '__html' if it did not changed between re-render
|
|
341
|
-
if (!newHtml || !oldHtml || newHtml.__html != oldHtml.__html) {
|
|
342
|
-
dom.innerHTML = (newHtml && newHtml.__html) || '';
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
diffProps(dom, newProps, oldProps, isSvg, isHydrating);
|
|
348
|
-
|
|
349
|
-
// If the new vnode didn't have dangerouslySetInnerHTML, diff its children
|
|
350
|
-
if (newHtml) {
|
|
351
|
-
newVNode._children = [];
|
|
352
|
-
} else {
|
|
353
|
-
newVNode._children = newVNode.props.children;
|
|
354
|
-
diffChildren(
|
|
355
|
-
dom,
|
|
356
|
-
newVNode,
|
|
357
|
-
oldVNode,
|
|
358
|
-
globalContext,
|
|
359
|
-
newVNode.type === 'foreignObject' ? false : isSvg,
|
|
360
|
-
excessDomChildren,
|
|
361
|
-
commitQueue,
|
|
362
|
-
EMPTY_OBJ,
|
|
363
|
-
isHydrating
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// (as above, don't diff props during hydration)
|
|
368
|
-
if (!isHydrating) {
|
|
369
|
-
if ('value' in newProps && (i = newProps.value) !== undefined && i !== dom.value) {
|
|
370
|
-
setProperty(dom, 'value', i, oldProps.value, false);
|
|
371
|
-
}
|
|
372
|
-
if ('checked' in newProps && (i = newProps.checked) !== undefined && i !== dom.checked) {
|
|
373
|
-
setProperty(dom, 'checked', i, oldProps.checked, false);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return dom;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Invoke or update a ref, depending on whether it is a function or object ref.
|
|
383
|
-
* @param {object|function} ref
|
|
384
|
-
* @param {any} value
|
|
385
|
-
* @param {import('../internal').VNode} vnode
|
|
386
|
-
*/
|
|
387
|
-
export function applyRef(ref, value, vnode) {
|
|
388
|
-
try {
|
|
389
|
-
if (typeof ref == 'function') ref(value);
|
|
390
|
-
else ref.current = value;
|
|
391
|
-
} catch (e) {
|
|
392
|
-
options._catchError(e, vnode);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Unmount a virtual node from the tree and apply DOM changes
|
|
398
|
-
* @param {import('../internal').VNode} vnode The virtual node to unmount
|
|
399
|
-
* @param {import('../internal').VNode} parentVNode The parent of the VNode that
|
|
400
|
-
* initiated the unmount
|
|
401
|
-
* @param {boolean} [skipRemove] Flag that indicates that a parent node of the
|
|
402
|
-
* current element is already detached from the DOM.
|
|
403
|
-
*/
|
|
404
|
-
export function unmount(vnode, parentVNode, skipRemove) {
|
|
405
|
-
let r;
|
|
406
|
-
if (options.unmount) options.unmount(vnode);
|
|
407
|
-
|
|
408
|
-
if ((r = vnode.ref)) {
|
|
409
|
-
if (!r.current || r.current === vnode._dom) applyRef(r, null, parentVNode);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
let dom;
|
|
413
|
-
if (!skipRemove && typeof vnode.type != 'function') {
|
|
414
|
-
skipRemove = (dom = vnode._dom) != null;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Must be set to `undefined` to properly clean up `_nextDom`
|
|
418
|
-
// for which `null` is a valid value. See comment in `create-element.js`
|
|
419
|
-
vnode._dom = vnode._nextDom = undefined;
|
|
420
|
-
|
|
421
|
-
if ((r = vnode._component) != null) {
|
|
422
|
-
if (r.componentWillUnmount) {
|
|
423
|
-
try {
|
|
424
|
-
r.componentWillUnmount();
|
|
425
|
-
} catch (e) {
|
|
426
|
-
options._catchError(e, parentVNode);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
r.base = r._parentDom = null;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
if ((r = vnode._children)) {
|
|
434
|
-
for (let i = 0; i < r.length; i++) {
|
|
435
|
-
if (r[i]) unmount(r[i], parentVNode, skipRemove);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
if (dom != null) removeNode(dom);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/** The `.render()` method for a PFC backing instance. */
|
|
443
|
-
function doRender(props, state, context) {
|
|
444
|
-
return this.constructor(props, context);
|
|
445
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { IS_NON_DIMENSIONAL } from '../constants';
|
|
2
|
-
import options from '../options';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Diff the old and new properties of a VNode and apply changes to the DOM node
|
|
6
|
-
* @param {import('../internal').PreactElement} dom The DOM node to apply
|
|
7
|
-
* changes to
|
|
8
|
-
* @param {object} newProps The new props
|
|
9
|
-
* @param {object} oldProps The old props
|
|
10
|
-
* @param {boolean} isSvg Whether or not this node is an SVG node
|
|
11
|
-
* @param {boolean} hydrate Whether or not we are in hydration mode
|
|
12
|
-
*/
|
|
13
|
-
export function diffProps(dom, newProps, oldProps, isSvg, hydrate) {
|
|
14
|
-
let i;
|
|
15
|
-
|
|
16
|
-
for (i in oldProps) {
|
|
17
|
-
if (i !== 'children' && i !== 'key' && !(i in newProps)) {
|
|
18
|
-
setProperty(dom, i, null, oldProps[i], isSvg);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
for (i in newProps) {
|
|
23
|
-
if (
|
|
24
|
-
(!hydrate || typeof newProps[i] == 'function') &&
|
|
25
|
-
i !== 'children' &&
|
|
26
|
-
i !== 'key' &&
|
|
27
|
-
i !== 'value' &&
|
|
28
|
-
i !== 'checked' &&
|
|
29
|
-
oldProps[i] !== newProps[i]
|
|
30
|
-
) {
|
|
31
|
-
setProperty(dom, i, newProps[i], oldProps[i], isSvg);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function setStyle(style, key, value) {
|
|
37
|
-
if (key[0] === '-') {
|
|
38
|
-
style.setProperty(key, value);
|
|
39
|
-
} else if (typeof value == 'number' && IS_NON_DIMENSIONAL.test(key) === false) {
|
|
40
|
-
style[key] = value + 'px';
|
|
41
|
-
} else if (value == null) {
|
|
42
|
-
style[key] = '';
|
|
43
|
-
} else {
|
|
44
|
-
style[key] = value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Set a property value on a DOM node
|
|
50
|
-
* @param {import('../internal').PreactElement} dom The DOM node to modify
|
|
51
|
-
* @param {string} name The name of the property to set
|
|
52
|
-
* @param {*} value The value to set the property to
|
|
53
|
-
* @param {*} oldValue The old value the property had
|
|
54
|
-
* @param {boolean} isSvg Whether or not this DOM node is an SVG node or not
|
|
55
|
-
*/
|
|
56
|
-
export function setProperty(dom, name, value, oldValue, isSvg) {
|
|
57
|
-
let s, useCapture, nameLower;
|
|
58
|
-
|
|
59
|
-
if (isSvg) {
|
|
60
|
-
if (name === 'className') {
|
|
61
|
-
name = 'class';
|
|
62
|
-
}
|
|
63
|
-
} else if (name === 'class') {
|
|
64
|
-
name = 'className';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
let showValue = typeof value == 'function' ? 'function' :
|
|
68
|
-
typeof value == 'object' ? JSON.stringify(value) :
|
|
69
|
-
value;
|
|
70
|
-
addOP(`setProperty ${name}=${showValue}`);
|
|
71
|
-
|
|
72
|
-
if (name === 'style') {
|
|
73
|
-
s = dom.style;
|
|
74
|
-
|
|
75
|
-
if (typeof value == 'string') {
|
|
76
|
-
s.cssText = value;
|
|
77
|
-
} else {
|
|
78
|
-
if (typeof oldValue == 'string') {
|
|
79
|
-
s.cssText = '';
|
|
80
|
-
oldValue = null;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (oldValue) {
|
|
84
|
-
for (let i in oldValue) {
|
|
85
|
-
if (!(value && i in value)) {
|
|
86
|
-
setStyle(s, i, '');
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (value) {
|
|
92
|
-
for (let i in value) {
|
|
93
|
-
if (!oldValue || value[i] !== oldValue[i]) {
|
|
94
|
-
setStyle(s, i, value[i]);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6
|
|
101
|
-
else if (name[0] === 'o' && name[1] === 'n') {
|
|
102
|
-
useCapture = name !== (name = name.replace(/Capture$/, ''));
|
|
103
|
-
nameLower = name.toLowerCase();
|
|
104
|
-
name = (nameLower in dom ? nameLower : name).slice(2);
|
|
105
|
-
|
|
106
|
-
if (value) {
|
|
107
|
-
if (!oldValue) dom.addEventListener(name, eventProxy, useCapture);
|
|
108
|
-
(dom._listeners || (dom._listeners = {}))[name] = value;
|
|
109
|
-
} else {
|
|
110
|
-
dom.removeEventListener(name, eventProxy, useCapture);
|
|
111
|
-
}
|
|
112
|
-
} else if (
|
|
113
|
-
name !== 'list' &&
|
|
114
|
-
name !== 'tagName' &&
|
|
115
|
-
// HTMLButtonElement.form and HTMLInputElement.form are read-only but can be set using
|
|
116
|
-
// setAttribute
|
|
117
|
-
name !== 'form' &&
|
|
118
|
-
name !== 'type' &&
|
|
119
|
-
name !== 'size' &&
|
|
120
|
-
!isSvg &&
|
|
121
|
-
name in dom
|
|
122
|
-
) {
|
|
123
|
-
dom[name] = value == null ? '' : value;
|
|
124
|
-
} else if (typeof value != 'function' && name !== 'dangerouslySetInnerHTML') {
|
|
125
|
-
if (name !== (name = name.replace(/^xlink:?/, ''))) {
|
|
126
|
-
if (value == null || value === false) {
|
|
127
|
-
dom.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());
|
|
128
|
-
} else {
|
|
129
|
-
dom.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);
|
|
130
|
-
}
|
|
131
|
-
} else if (
|
|
132
|
-
value == null ||
|
|
133
|
-
(value === false &&
|
|
134
|
-
// ARIA-attributes have a different notion of boolean values.
|
|
135
|
-
// The value `false` is different from the attribute not
|
|
136
|
-
// existing on the DOM, so we can't remove it. For non-boolean
|
|
137
|
-
// ARIA-attributes we could treat false as a removal, but the
|
|
138
|
-
// amount of exceptions would cost us too many bytes. On top of
|
|
139
|
-
// that other VDOM frameworks also always stringify `false`.
|
|
140
|
-
!/^ar/.test(name))
|
|
141
|
-
) {
|
|
142
|
-
dom.removeAttribute(name);
|
|
143
|
-
} else {
|
|
144
|
-
dom.setAttribute(name, value);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Proxy an event to hooked event handlers
|
|
151
|
-
* @param {Event} e The event object from the browser
|
|
152
|
-
* @private
|
|
153
|
-
*/
|
|
154
|
-
function eventProxy(e) {
|
|
155
|
-
// console.log('*** eventProxy', e.type);
|
|
156
|
-
let f = this._listeners[e.type];
|
|
157
|
-
if(f) {
|
|
158
|
-
f(options.event ? options.event(e) : e);
|
|
159
|
-
}
|
|
160
|
-
else{
|
|
161
|
-
console.error('eventProxy no listener found for event type', e.type);
|
|
162
|
-
}
|
|
163
|
-
}
|