├── .github
└── workflows
│ └── gh-repo.yml
├── .gitignore
├── .jsbeautifyrc
├── .jshintrc
├── .npmignore
├── .yarnrc
├── CNAME
├── LICENSE
├── README.md
├── api_demo
├── .jshintrc
├── .npmignore
├── .prettierrc
├── README.md
├── assets
│ ├── component.svg
│ ├── global.svg
│ ├── icon.png
│ ├── icons.json
│ ├── ip.svg
│ ├── nokia.jpeg
│ └── prefs.json
├── components
│ ├── api.js
│ ├── component.js
│ ├── component_base.js
│ ├── empty.js
│ ├── file.js
│ ├── icons.js
│ ├── index.js
│ ├── more.js
│ ├── search.js
│ ├── storage.js
│ └── types
│ │ ├── article.js
│ │ ├── audio.js
│ │ ├── bottomTab.js
│ │ ├── drawer.js
│ │ ├── image.js
│ │ ├── list.js
│ │ ├── nested.js
│ │ ├── topTab.js
│ │ ├── video.js
│ │ └── webview.js
├── jsconfig.json
├── main.js
├── package.json
├── scripts
│ └── dom.js
├── tasks
│ └── get_ip.js
└── yarn.lock
├── bing_wallpaper
├── .prettierrc
├── assets
│ ├── bing.png
│ └── prefs.json
├── components
│ └── index.js
├── main.js
└── package.json
├── jsconfig.json
├── package.json
├── readhub
├── .jsbeautifyrc
├── .jshintrc
├── .npmignore
├── .prettierrc
├── assets
│ └── icon.png
├── components
│ ├── index.js
│ ├── news.js
│ ├── topic_detail.js
│ └── topics.js
├── main.js
└── package.json
└── unsplash
├── .jsbeautifyrc
├── .jshintrc
├── .npmignore
├── .prettierrc
├── assets
├── icon.png
└── prefs.json
├── components
└── index.js
├── main.js
├── package.json
└── yarn.lock
/.github/workflows/gh-repo.yml:
--------------------------------------------------------------------------------
1 | name: Addon Repo CI
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 |
10 | strategy:
11 | matrix:
12 | node-version: [10.x]
13 |
14 | steps:
15 | - uses: actions/checkout@v1
16 | - name: Use Node.js ${{ matrix.node-version }}
17 | uses: actions/setup-node@v1
18 | with:
19 | node-version: ${{ matrix.node-version }}
20 | - name: Build and Deploy
21 | uses: JamesIves/github-pages-deploy-action@master
22 | env:
23 | ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
24 | BRANCH: gh-pages
25 | FOLDER: dist
26 | BUILD_SCRIPT: npm install && npm run build && cp ./CNAME ./dist/CNAME
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Node template
3 | # Logs
4 | logs
5 | *.log
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 | lerna-debug.log*
10 |
11 | # Diagnostic reports (https://nodejs.org/api/report.html)
12 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
13 |
14 | # Runtime data
15 | pids
16 | *.pid
17 | *.seed
18 | *.pid.lock
19 |
20 | # Directory for instrumented libs generated by jscoverage/JSCover
21 | lib-cov
22 |
23 | # Coverage directory used by tools like istanbul
24 | coverage
25 | *.lcov
26 |
27 | # nyc test coverage
28 | .nyc_output
29 |
30 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
31 | .grunt
32 |
33 | # Bower dependency directory (https://bower.io/)
34 | bower_components
35 |
36 | # node-waf configuration
37 | .lock-wscript
38 |
39 | # Compiled binary addons (https://nodejs.org/api/addons.html)
40 | build/Release
41 |
42 | # Dependency directories
43 | node_modules/
44 | jspm_packages/
45 |
46 | # TypeScript v1 declaration files
47 | typings/
48 |
49 | # TypeScript cache
50 | *.tsbuildinfo
51 |
52 | # Optional npm cache directory
53 | .npm
54 |
55 | # Optional eslint cache
56 | .eslintcache
57 |
58 | # Optional REPL history
59 | .node_repl_history
60 |
61 | # Output of 'npm pack'
62 | *.tgz
63 |
64 | # Yarn Integrity file
65 | .yarn-integrity
66 |
67 | # dotenv environment variables file
68 | .env
69 | .env.test
70 |
71 | # parcel-bundler cache (https://parceljs.org/)
72 | .cache
73 |
74 | # next.js build output
75 | .next
76 |
77 | # nuxt.js build output
78 | .nuxt
79 |
80 | # vuepress build output
81 | .vuepress/dist
82 |
83 | # Serverless directories
84 | .serverless/
85 |
86 | # FuseBox cache
87 | .fusebox/
88 |
89 | # DynamoDB Local files
90 | .dynamodb/
91 |
92 | .output
93 | *.log
94 | dist/
95 | package-lock.json
96 | .vscode
97 | .pnp.js
--------------------------------------------------------------------------------
/.jsbeautifyrc:
--------------------------------------------------------------------------------
1 | {
2 | "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
3 | "brace_style": "collapse,preserve-inline",
4 | "break_chained_methods": false,
5 | "e4x": false,
6 | "end_with_newline": true,
7 | "indent_char": " ",
8 | "indent_level": 0,
9 | "indent_size": 2,
10 | "indent_with_tabs": false,
11 | "jslint_happy": false,
12 | "keep_array_indentation": false,
13 | "keep_function_indentation": false,
14 | "max_preserve_newlines": 0,
15 | "preserve_newlines": true,
16 | "space_after_anon_function": false,
17 | "space_before_conditional": true,
18 | "space_in_empty_paren": false,
19 | "space_in_paren": false,
20 | "unescape_strings": false,
21 | "wrap_line_length": 0
22 | }
23 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "asi": true,
3 | "esversion": 8,
4 | "indent": true
5 | }
6 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | dist/
--------------------------------------------------------------------------------
/.yarnrc:
--------------------------------------------------------------------------------
1 | plugnplay-override true
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | repo.dorajs.com
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 linroid
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Dora.js 扩展示例
2 |
3 | 点击添加:[海外](https://share.dorajs.com/?type=repo&url=https://repo.dorajs.com/index.json&name=Official) | [国内](https://share.dorajs.com/?type=repo&url=https://dorajs.gitee.io/samples/index.json&name=官方)
4 |
--------------------------------------------------------------------------------
/api_demo/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "asi": true,
3 | "esversion": 8,
4 | "indent": true
5 | }
6 |
--------------------------------------------------------------------------------
/api_demo/.npmignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | dist/
3 | .pnp.js
4 |
--------------------------------------------------------------------------------
/api_demo/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "useTabs": false,
4 | "semi": false,
5 | "singleQuote": true,
6 | "trailingComma": "none",
7 | "bracketSpacing": true,
8 | "arrowParens": "avoid"
9 | }
10 |
--------------------------------------------------------------------------------
/api_demo/README.md:
--------------------------------------------------------------------------------
1 | # API Demo
2 |
3 | [Dora.js](https://dorajs.com) 的示例扩展程序,在这里可以快速体验 Dora.js 的所有能力
--------------------------------------------------------------------------------
/api_demo/assets/component.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api_demo/assets/global.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api_demo/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dorajs/samples/0960cc9ce967407af238958fdfdb098a295344b6/api_demo/assets/icon.png
--------------------------------------------------------------------------------
/api_demo/assets/icons.json:
--------------------------------------------------------------------------------
1 | ["3d_rotation","accessibility","accessible","account_balance","account_balance_wallet","account_box","account_circle","add_shopping_cart","alarm","alarm_add","alarm_off","alarm_on","all_out","android","announcement","aspect_ratio","assessment","assignment","assignment_ind","assignment_late","assignment_return","assignment_returned","assignment_turned_in","autorenew","backup","book","bookmark","bookmark_border","bug_report","build","cached","card_giftcard","card_membership","card_travel","change_history","check_circle","chrome_reader_mode","class","code","compare_arrows","copyright","credit_card","dashboard","date_range","delete","delete_forever","description","dns","done","done_all","donut_large","donut_small","euro_symbol","event","event_seat","exit_to_app","explore","extension","face","favorite","favorite_border","feedback","find_in_page","find_replace","fingerprint","flight_land","flight_takeoff","flip_to_back","flip_to_front","g_translate","gavel","get_app","grade","group_work","help","highlight_off","history","home","hourglass_empty","hourglass_full","http","https","important_devices","info","info_outline","input","invert_colors","label","label_outline","language","launch","lightbulb_outline","line_style","line_weight","list","lock","lock_open","lock_outline","loyalty","markunread_mailbox","motorcycle","note_add","opacity","open_in_browser","open_in_new","open_with","pageview","pan_tool","payment","perm_camera_mic","perm_contact_calendar","perm_data_setting","perm_device_information","perm_identity","perm_media","perm_phone_msg","perm_scan_wifi","pets","picture_in_picture","picture_in_picture_alt","play_for_work","polymer","power_settings_new","pregnant_woman","print","query_builder","question_answer","receipt","record_voice_over","redeem","remove_shopping_cart","report_problem","restore","restore_page","room","rounded_corner","rowing","schedule","search","settings","settings_applications","settings_backup_restore","settings_bluetooth","settings_brightness","settings_cell","settings_ethernet","settings_input_antenna","settings_input_component","settings_input_composite","settings_input_hdmi","settings_input_svideo","settings_overscan","settings_phone","settings_power","settings_remote","settings_voice","shop","shop_two","shopping_basket","shopping_cart","speaker_notes","speaker_notes_off","spellcheck","stars","store","subject","supervisor_account","swap_horiz","swap_vert","swap_vertical_circle","system_update_alt","tab","tab_unselected","theaters","thumb_down","thumb_up","thumbs_up_down","timeline","toc","today","toll","touch_app","track_changes","translate","trending_down","trending_flat","trending_up","turned_in","turned_in_not","update","verified_user","view_agenda","view_array","view_carousel","view_column","view_day","view_headline","view_list","view_module","view_quilt","view_stream","view_week","visibility","visibility_off","watch_later","work","youtube_searched_for","add_alert","error","error_outline","warning","add_to_queue","airplay","album","art_track","av_timer","branding_watermark","call_to_action","closed_caption","equalizer","explicit","fast_forward","fast_rewind","featured_play_list","featured_video","fiber_dvr","fiber_manual_record","fiber_new","fiber_pin","fiber_smart_record","forward_10","forward_30","forward_5","games","hearing","high_quality","library_add","library_books","library_music","loop","mic","mic_none","mic_off","movie","music_video","new_releases","not_interested","note","pause","pause_circle_filled","pause_circle_outline","play_arrow","play_circle_filled","play_circle_filled_white","play_circle_outline","playlist_add","playlist_add_check","playlist_play","queue","queue_music","queue_play_next","radio","recent_actors","remove_from_queue","repeat","repeat_one","replay_10","replay_30","replay","replay_5","shuffle","skip_next","skip_previous","slow_motion_video","snooze","stop","subscriptions","subtitles","surround_sound","video_call","video_label","video_library","videocam","videocam_off","volume_down","volume_mute","volume_off","volume_up","web","web_asset","business","call","call_end","call_made","call_merge","call_missed","call_missed_outgoing","call_received","call_split","chat","chat_bubble","chat_bubble_outline","clear_all","comment","contact_mail","contact_phone","contacts","dialer_sip","dialpad","email","forum","import_contacts","import_export","invert_colors_off","live_help","location_off","location_on","mail_outline","message","no_sim","phone","portable_wifi_off","present_to_all","ring_volume","rss_feed","screen_share","speaker_phone","stay_current_landscape","stay_current_portrait","stay_primary_landscape","stay_primary_portrait","stop_screen_share","swap_calls","textsms","voicemail","vpn_key","add","add_box","add_circle","add_circle_outline","archive","backspace","block","clear","content_copy","content_cut","content_paste","create","delete_sweep","drafts","filter_list","flag","forward","gesture","inbox","link","low_priority","mail","markunread","move_to_inbox","next_week","redo","remove","remove_circle","remove_circle_outline","reply","reply_all","report","save","select_all","send","sort","text_format","unarchive","undo","weekend","access_alarm","access_alarms","access_time","add_alarm","airplanemode_active","airplanemode_inactive","battery_20","battery_30","battery_50","battery_60","battery_80","battery_90","battery_alert","battery_charging_20","battery_charging_30","battery_charging_50","battery_charging_60","battery_charging_80","battery_charging_90","battery_charging_full","battery_full","battery_std","battery_unknown","bluetooth","bluetooth_connected","bluetooth_disabled","bluetooth_searching","brightness_auto","brightness_high","brightness_low","brightness_medium","data_usage","developer_mode","devices","dvr","gps_fixed","gps_not_fixed","gps_off","graphic_eq","location_disabled","location_searching","network_cell","network_wifi","nfc","screen_lock_landscape","screen_lock_portrait","screen_lock_rotation","screen_rotation","sd_storage","settings_system_daydream","signal_cellular_0_bar","signal_cellular_1_bar","signal_cellular_2_bar","signal_cellular_3_bar","signal_cellular_4_bar","signal_cellular_connected_no_internet_0_bar","signal_cellular_connected_no_internet_1_bar","signal_cellular_connected_no_internet_2_bar","signal_cellular_connected_no_internet_3_bar","signal_cellular_connected_no_internet_4_bar","signal_cellular_no_sim","signal_cellular_null","signal_cellular_off","signal_wifi_0_bar","signal_wifi_1_bar","signal_wifi_1_bar_lock","signal_wifi_2_bar","signal_wifi_2_bar_lock","signal_wifi_3_bar","signal_wifi_3_bar_lock","signal_wifi_4_bar","signal_wifi_4_bar_lock","signal_wifi_off","storage","usb","wallpaper","widgets","wifi_lock","wifi_tethering","attach_file","attach_money","border_all","border_bottom","border_clear","border_color","border_horizontal","border_inner","border_left","border_outer","border_right","border_style","border_top","border_vertical","bubble_chart","drag_handle","format_align_center","format_align_justify","format_align_left","format_align_right","format_bold","format_clear","format_color_fill","format_color_reset","format_color_text","format_indent_decrease","format_indent_increase","format_italic","format_line_spacing","format_list_bulleted","format_list_numbered","format_paint","format_quote","format_shapes","format_size","format_strikethrough","format_textdirection_l_to_r","format_textdirection_r_to_l","format_underlined","functions","highlight","insert_chart","insert_comment","insert_drive_file","insert_emoticon","insert_invitation","insert_link","insert_photo","linear_scale","merge_type","mode_comment","mode_edit","monetization_on","multiline_chart","pie_chart","pie_chart_outlined","publish","short_text","show_chart","space_bar","strikethrough_s","text_fields","title","vertical_align_bottom","vertical_align_center","vertical_align_top","wrap_text","attachment","cloud","cloud_circle","cloud_done","cloud_download","cloud_off","cloud_queue","cloud_upload","create_new_folder","file_download","file_upload","folder","folder_open","folder_shared","cast","cast_connected","computer","desktop_mac","desktop_windows","developer_board","devices_other","dock","gamepad","headset","headset_mic","keyboard","keyboard_arrow_down","keyboard_arrow_left","keyboard_arrow_right","keyboard_arrow_up","keyboard_backspace","keyboard_capslock","keyboard_hide","keyboard_return","keyboard_tab","keyboard_voice","laptop","laptop_chromebook","laptop_mac","laptop_windows","memory","mouse","phone_android","phone_iphone","phonelink","phonelink_off","power_input","router","scanner","security","sim_card","smartphone","speaker","speaker_group","tablet","tablet_android","tablet_mac","toys","tv","videogame_asset","watch","add_a_photo","add_to_photos","adjust","assistant","assistant_photo","audiotrack","blur_circular","blur_linear","blur_off","blur_on","brightness_1","brightness_2","brightness_3","brightness_4","brightness_5","brightness_6","brightness_7","broken_image","brush","burst_mode","camera","camera_alt","camera_front","camera_rear","camera_roll","center_focus_strong","center_focus_weak","collections","color_lens","colorize","compare","control_point","control_point_duplicate","crop_16_9","crop_3_2","crop","crop_5_4","crop_7_5","crop_din","crop_free","crop_landscape","crop_original","crop_portrait","crop_rotate","crop_square","dehaze","details","edit","exposure","exposure_neg_1","exposure_neg_2","exposure_plus_1","exposure_plus_2","exposure_zero","filter_1","filter_2","filter_3","filter_4","filter","filter_5","filter_6","filter_7","filter_8","filter_9","filter_9_plus","filter_b_and_w","filter_center_focus","filter_drama","filter_frames","filter_hdr","filter_none","filter_tilt_shift","filter_vintage","flare","flash_auto","flash_off","flash_on","flip","gradient","grain","grid_off","grid_on","hdr_off","hdr_on","hdr_strong","hdr_weak","healing","image","image_aspect_ratio","iso","landscape","leak_add","leak_remove","lens","linked_camera","looks_3","looks_4","looks","looks_5","looks_6","looks_one","looks_two","loupe","monochrome_photos","movie_creation","movie_filter","music_note","nature","nature_people","navigate_before","navigate_next","palette","panorama","panorama_fish_eye","panorama_horizontal","panorama_vertical","panorama_wide_angle","photo","photo_album","photo_camera","photo_filter","photo_library","picture_as_pdf","portrait","remove_red_eye","rotate_90_degrees_ccw","rotate_left","rotate_right","slideshow","straighten","style","switch_camera","switch_video","tag_faces","texture","timelapse","timer_10","timer_3","timer","timer_off","tonality","transform","tune","view_comfy","view_compact","wb_auto","wb_cloudy","wb_incandescent","wb_iridescent","wb_sunny","add_location","beenhere","directions","directions_bike","directions_boat","directions_bus","directions_car","directions_railway","directions_run","directions_subway","directions_transit","directions_walk","edit_location","ev_station","flight","hotel","layers","layers_clear","local_activity","local_airport","local_atm","local_bar","local_cafe","local_car_wash","local_convenience_store","local_dining","local_drink","local_florist","local_gas_station","local_grocery_store","local_hospital","local_hotel","local_laundry_service","local_library","local_mall","local_movies","local_offer","local_parking","local_pharmacy","local_phone","local_pizza","local_play","local_post_office","local_printshop","local_see","local_shipping","local_taxi","map","my_location","navigation","near_me","person_pin","person_pin_circle","pin_drop","place","rate_review","restaurant","restaurant_menu","satellite","store_mall_directory","streetview","subway","terrain","traffic","train","tram","transfer_within_a_station","zoom_out_map","apps","arrow_back","arrow_downward","arrow_drop_down","arrow_drop_down_circle","arrow_drop_up","arrow_forward","arrow_upward","cancel","check","chevron_left","chevron_right","close","expand_less","expand_more","first_page","fullscreen","fullscreen_exit","last_page","menu","more_horiz","more_vert","refresh","subdirectory_arrow_left","subdirectory_arrow_right","unfold_less","unfold_more","adb","airline_seat_flat","airline_seat_flat_angled","airline_seat_individual_suite","airline_seat_legroom_extra","airline_seat_legroom_normal","airline_seat_legroom_reduced","airline_seat_recline_extra","airline_seat_recline_normal","bluetooth_audio","confirmation_number","disc_full","do_not_disturb","do_not_disturb_alt","do_not_disturb_off","do_not_disturb_on","drive_eta","enhanced_encryption","event_available","event_busy","event_note","folder_special","live_tv","mms","more","network_check","network_locked","no_encryption","ondemand_video","personal_video","phone_bluetooth_speaker","phone_forwarded","phone_in_talk","phone_locked","phone_missed","phone_paused","power","priority_high","rv_hookup","sd_card","sim_card_alert","sms","sms_failed","sync","sync_disabled","sync_problem","system_update","tap_and_play","time_to_leave","vibration","voice_chat","vpn_lock","wc","wifi","ac_unit","airport_shuttle","all_inclusive","beach_access","business_center","casino","child_care","child_friendly","fitness_center","free_breakfast","golf_course","hot_tub","kitchen","pool","room_service","rv_hookup","smoke_free","smoking_rooms","spa","cake","domain","group","group_add","location_city","mood","mood_bad","notifications","notifications_active","notifications_none","notifications_off","notifications_paused","pages","party_mode","people","people_outline","person","person_add","person_outline","plus_one","poll","public","school","sentiment_dissatisfied","sentiment_neutral","sentiment_satisfied","sentiment_very_dissatisfied","sentiment_very_satisfied","share","whatshot","check_box","check_box_outline_blank","radio_button_checked","radio_button_unchecked","star_half"]
--------------------------------------------------------------------------------
/api_demo/assets/ip.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/api_demo/assets/nokia.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dorajs/samples/0960cc9ce967407af238958fdfdb098a295344b6/api_demo/assets/nokia.jpeg
--------------------------------------------------------------------------------
/api_demo/assets/prefs.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": {
3 | "type": "string",
4 | "default": "unkown",
5 | "title": "姓名"
6 | },
7 | "age": {
8 | "type": "number",
9 | "default": 0,
10 | "title": "年龄"
11 | },
12 | "showRecommend": {
13 | "type": "boolean",
14 | "default": true,
15 | "title": "是否显示推荐"
16 | },
17 | "password": {
18 | "type": "password",
19 | "default": null,
20 | "title": "密码"
21 | },
22 | "education": {
23 | "type": "string",
24 | "default": "bachelor",
25 | "title": "学历",
26 | "options": [{
27 | "value": "bachelor",
28 | "title": "本科"
29 | },
30 | {
31 | "value": "master",
32 | "title": "研究生"
33 | }
34 | ]
35 | }
36 | }
--------------------------------------------------------------------------------
/api_demo/components/api.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | fetch() {
3 | return [
4 | // $ui
5 | {
6 | title: '$ui',
7 | style: 'category'
8 | },
9 | {
10 | title: '显示一个 Toast 消息',
11 | summary: '$ui.toast(title: string)',
12 | onClick: () => {
13 | $ui.toast('Hello World!')
14 | }
15 | },
16 | {
17 | title: '显示一个弹窗警告',
18 | summary: '$ui.alert(message: string)',
19 | onClick: async () => {
20 | await $ui.alert('Hello World')
21 | console.log('alert finished')
22 | }
23 | },
24 | {
25 | title: '打开浏览器',
26 | summary: '$ui.browser(url: string)',
27 | onClick: () => {
28 | $ui.browser('https://www.npmjs.com/')
29 | }
30 | },
31 | {
32 | title: '查看一个 npm 用户',
33 | summary: '$ui.viewUser(userId: string)',
34 | onClick: () => {
35 | $ui.viewUser('linroid')
36 | }
37 | },
38 | // $input
39 | {
40 | title: '$input',
41 | style: 'category'
42 | },
43 | {
44 | title: '显示一个确认弹窗',
45 | summary: '$input.confirm(params: ConfirmParams)',
46 | onClick: async () => {
47 | let ok = await $input.confirm({
48 | title: 'Confirmation',
49 | message: 'Are you sure?',
50 | okBtn: 'okBtn'
51 | })
52 | $ui.toast(`ok=${ok}`)
53 | }
54 | },
55 | {
56 | title: '请求输入文本',
57 | summary: '$input.text(params: InputParams)',
58 | onClick: async () => {
59 | let name = await $input.prompt({
60 | title: '输入姓名',
61 | hint: '姓名',
62 | value: ''
63 | })
64 | $ui.toast(`Hello ${name}`)
65 | }
66 | },
67 | {
68 | title: '请求输入数字',
69 | summary: '$input.text(params: InputParams)',
70 | onClick: async () => {
71 | let age = await $input.number({
72 | title: '输入年龄',
73 | hint: '年龄',
74 | value: ''
75 | })
76 | $ui.toast(`年龄: ${age}`)
77 | }
78 | },
79 | {
80 | title: '请求输入密码',
81 | summary: '$input.password(params: InputParams)',
82 | onClick: async () => {
83 | let age = await $input.password({
84 | title: '输入密码',
85 | hint: '密码',
86 | value: ''
87 | })
88 | $ui.toast(`密码: ${age}`)
89 | }
90 | },
91 | {
92 | title: '进行单项选择',
93 | summary: '$input.select(data: object)',
94 | onClick: async () => {
95 | let selected = await $input.select({
96 | title: 'Dora.js select',
97 | options: [
98 | {
99 | id: 'option2',
100 | title: 'Option 1'
101 | },
102 | {
103 | id: 'option2',
104 | title: 'Option 2'
105 | }
106 | ]
107 | })
108 | $ui.toast(`Selected ${JSON.stringify(selected)}`)
109 | }
110 | },
111 | {
112 | title: '进行多项选择',
113 | summary: '$input.select(data: object)',
114 | onClick: async () => {
115 | let selected = await $input.select({
116 | title: 'Dora.js select',
117 | multiple: true,
118 | options: [
119 | {
120 | id: 'option2',
121 | title: 'Option 1'
122 | },
123 | {
124 | id: 'option2',
125 | title: 'Option 2'
126 | }
127 | ]
128 | })
129 | $ui.toast(`Selected ${JSON.stringify(selected)}`)
130 | }
131 | },
132 | // $router
133 | {
134 | title: '$router',
135 | style: 'category'
136 | },
137 | {
138 | title: '跳转指定路由',
139 | summary: '$router.to(route: Route)',
140 | onClick: () => {
141 | $router.to($route('index'))
142 | }
143 | },
144 |
145 | // $prefs
146 | {
147 | title: '$prefs',
148 | style: 'category'
149 | },
150 | {
151 | title: '打开配置页',
152 | summary: '$prefs.open()',
153 | onClick: () => {
154 | $prefs.open()
155 | }
156 | },
157 | {
158 | title: '获取一个配置值',
159 | summary: '$prefs.get(key: string): any',
160 | onClick: () => {
161 | this.dump($prefs.get('name'))
162 | }
163 | },
164 | {
165 | title: '设置一个配置',
166 | summary: '$prefs.set(key: string, value: any)',
167 | onClick: () => {
168 | $prefs.set('name', 'Dora.js')
169 | this.dump($prefs.get('name'))
170 | }
171 | },
172 | {
173 | title: '获取所有配置',
174 | summary: '$prefs.all(): object',
175 | onClick: () => {
176 | this.dump($prefs.all())
177 | }
178 | },
179 |
180 | // $storage
181 | {
182 | title: '$storage',
183 | style: 'category'
184 | },
185 | {
186 | title: '获取一个值',
187 | summary: '$storage.get(key: string): any',
188 | onClick: () => {
189 | this.dump($storage.get('author'))
190 | }
191 | },
192 | {
193 | title: '设置一个值',
194 | summary: '$storage.put(key: string, value: any)',
195 | onClick: () => {
196 | $storage.put('author', {
197 | name: 'linroid',
198 | github: 'https://github.com/linroid'
199 | })
200 | this.dump($storage.get('author'))
201 | }
202 | },
203 | {
204 | title: '删除一个值',
205 | summary: '$storage.remove(key: string)',
206 | onClick: () => {
207 | $storage.remove('author')
208 | this.dump($storage.get('author'))
209 | }
210 | },
211 | {
212 | title: '获取所有存储值',
213 | summary: '$storage.all(): object',
214 | onClick: () => {
215 | this.dump($storage.all())
216 | }
217 | },
218 | // $dora
219 | {
220 | title: '$dora',
221 | style: 'category'
222 | },
223 | {
224 | title: '获取已安装的扩展列表',
225 | summary: '$dora.addons(): Promise',
226 | onClick: async () => {
227 | const addons = await $dora.addons()
228 | $ui.showCode(JSON.stringify(addons, null, ' '))
229 | }
230 | },
231 | {
232 | title: '安装一个扩展',
233 | summary: '$dora.install(url: Url): Promise',
234 | onClick: async () => {
235 | const result = await $dora.install('npm://@dora.js/unsplash')
236 | $ui.toast(`install result: ${result}`)
237 | }
238 | },
239 | {
240 | title: '卸载一个扩展',
241 | summary: '$dora.uninstall(uuid: string): Promise',
242 | onClick: async () => {
243 | const addons = await $dora.addons()
244 | const item = await $input.select({
245 | title: '卸载哪一个?',
246 | options: addons.map(addon => ({
247 | title: addon.displayName,
248 | uuid: addon.uuid
249 | }))
250 | })
251 | const result = await $dora.uninstall(item.uuid)
252 | $ui.toast(`uninstall result: ${result}`)
253 | }
254 | },
255 | {
256 | title: '判断是否安装指定扩展',
257 | summary: '$dora.isInstalled(uuid: string): boolean',
258 | onClick: () => {
259 | const result = $dora.isInstalled(
260 | '2f33d8de-c474-4f38-a19b-cf2cab4228cc'
261 | )
262 | $ui.toast(`is installed: ${result}`)
263 | }
264 | },
265 | // permission
266 | {
267 | title: '权限申请',
268 | style: 'category'
269 | },
270 | {
271 | title: '申请权限',
272 | summary: '$permission.request(family: string)',
273 | onClick: async () => {
274 | const result = await $permission.request('sdcard')
275 | $ui.toast(`申请结果: ${result}`)
276 | }
277 | },
278 |
279 | // downloder
280 | {
281 | title: '$downloader',
282 | style: 'category'
283 | },
284 | {
285 | title: '下载文件',
286 | summary: '$downloader.add(params: DownloadParams)',
287 | onClick: () => {
288 | $downloader.add({
289 | url:'http://r.cnpmjs.org/@dora.js/api-demo/download/@dora.js/api-demo-1.4.0.tgz',
290 | filename: 'api-demo-1.4.0.dora',
291 | headers: {
292 | "User-Agent": "api_demo/1.0.0"
293 | }
294 | })
295 | }
296 | },
297 | // downloder
298 | {
299 | title: '$task',
300 | style: 'category'
301 | },
302 | {
303 | title: '执行任务',
304 | summary: '$task.add(params: TaskParams)',
305 | onClick: () => {
306 | $task.schedule({
307 | name: 'get_ip',
308 | at: Date()
309 | })
310 | }
311 | },
312 | // global
313 | {
314 | title: 'global',
315 | style: 'category'
316 | },
317 | {
318 | title: '生成 assets 目录下的文件 Url',
319 | summary: '$assets(path: string)',
320 | onClick: () => {
321 | $ui.toast($assets('nokia.jpeg'))
322 | }
323 | },
324 | {
325 | title: '生成一个内置图标 Url',
326 | summary: '$icon(name: string, color: string|null)',
327 | onClick: () => {
328 | $ui.toast($icon('ic_settings', 'black'))
329 | }
330 | },
331 | {
332 | title: '生成一个路由',
333 | summary: '$route(path: string, data: object)',
334 | onClick: () => {
335 | $ui.toast(JSON.stringify($route('index', { id: 1 })))
336 | }
337 | }
338 | ]
339 | },
340 | dump(data) {
341 | $ui.toast(JSON.stringify(data, null, ' '))
342 | }
343 | }
344 |
--------------------------------------------------------------------------------
/api_demo/components/component.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'list',
3 | fetch() {
4 | return [
5 | {
6 | title: '组件基础操作',
7 | summary: '',
8 | route: $route('component_base')
9 | },
10 | {
11 | title: 'list',
12 | summary: '列表组件',
13 | route: $route('types/list')
14 | },
15 | {
16 | title: 'video',
17 | summary: '视频组件',
18 | route: $route('types/video')
19 | },
20 | {
21 | title: 'audio',
22 | summary: '音频组件',
23 | route: $route('types/audio')
24 | },
25 | {
26 | title: 'article',
27 | summary: '文章组件',
28 | route: $route('types/article')
29 | },
30 | {
31 | title: 'image',
32 | summary: '图片组件',
33 | route: $route('types/image')
34 | },
35 | {
36 | title: 'webview',
37 | summary: '浏览器组件',
38 | route: $route('types/webview')
39 | },
40 | {
41 | title: 'topTab',
42 | summary: 'topTab 组件',
43 | route: $route('types/topTab')
44 | },
45 | {
46 | title: 'drawer',
47 | summary: 'drawer 组件',
48 | route: $route('types/drawer')
49 | },
50 | {
51 | title: 'bottomTab',
52 | summary: 'bottomTab 组件',
53 | route: $route('types/bottomTab')
54 | }
55 | ,
56 | {
57 | title: '嵌套',
58 | summary: 'drawer、topTab、bottomTab 等类型互相嵌套',
59 | route: $route('types/nested')
60 | }
61 | ]
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/api_demo/components/component_base.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'list',
3 | allowBookmark: true,
4 | searchRoute: $route('search'),
5 | items: [
6 | {
7 | style: 'label',
8 | title: '修改标题',
9 | onClick: async function () {
10 | const newTitle = await $input.text({
11 | title: '输入标题',
12 | hint: '标题'
13 | })
14 | if (newTitle) {
15 | this.title = newTitle
16 | }
17 | }
18 | },
19 | {
20 | style: 'label',
21 | title: '修改副标题',
22 | onClick: async function () {
23 | const newSubtitle = await $input.text({
24 | title: '输入副标题',
25 | hint: '副标题'
26 | })
27 | if (newSubtitle) {
28 | this.subtitle = newSubtitle
29 | }
30 | }
31 | },
32 | {
33 | style: 'label',
34 | title: '是否允许收藏',
35 | onClick: async function () {
36 | const option = await $input.select({
37 | title: '允许添加收藏?',
38 | options: [
39 | {
40 | title: '允许',
41 | value: true
42 | },
43 | {
44 | title: '不允许',
45 | value: false
46 | }
47 | ]
48 | })
49 | if (option) {
50 | this.allowBookmark = option.value
51 | }
52 | }
53 | },
54 | {
55 | style: 'label',
56 | title: '结束组件',
57 | onClick: async function () {
58 | this.finish()
59 | }
60 | },
61 | {
62 | style: 'label',
63 | title: '刷新组件数据',
64 | onClick: async function () {
65 | this.refresh()
66 | }
67 | }
68 | ],
69 | beforeCreate() {
70 | console.log('before create')
71 | },
72 | fetch() {
73 | console.log('fetch')
74 | },
75 | created() {
76 | console.log('created')
77 | },
78 | activated() {
79 | console.log('activated')
80 | },
81 | inactivated() {
82 | console.log('inactivated')
83 | },
84 | beforeDestroy() {
85 | console.log('beforeDestroy')
86 | },
87 | destroyed() {
88 | console.log('destroyed')
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/api_demo/components/empty.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'article',
3 | fetch() {
4 | return {
5 | content: {
6 | text: 'Hello world!'
7 | }
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/api_demo/components/file.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 | const path = require('path')
3 | module.exports = {
4 | type: 'list',
5 | async beforeCreate() {
6 | console.log(this)
7 | this.title = 'Files'
8 | this.subtitle = this.route.args.path
9 | await $permission.request('sdcard')
10 | },
11 | fetch({ args }) {
12 | console.log(`list files in : ${args.path}`)
13 | const items = fs.readdirSync(args.path).map(name => {
14 | const file = path.resolve(args.path, name)
15 | const stat = fs.statSync(file)
16 | return {
17 | title: name,
18 | image: stat.isDirectory() ? $icon('folder', 'yellow') : $icon('insert_drive_file', 'black'),
19 | onClick: () => {
20 | console.log($ui)
21 | if (stat.isDirectory()) {
22 | $router.to($route('file', {
23 | path: file
24 | }))
25 | } else {
26 | $ui.viewFile(file)
27 | }
28 | }
29 | }
30 | })
31 | return items
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/api_demo/components/icons.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 | module.exports = {
3 | type: 'list',
4 | fetch() {
5 | console.log(process.cwd())
6 | let json = fs.readFileSync('assets/icons.json')
7 | let icons = JSON.parse(json)
8 | return icons.map(name => {
9 | return {
10 | id: name,
11 | title: name,
12 | style: 'icon',
13 | image: $icon(name, this.color()),
14 | onClick: (item) => {
15 | $clipboard.text = `$icon('${item.id}', '${this.color()}')`
16 | $ui.toast('已复制到剪切板')
17 | }
18 | }
19 | })
20 | },
21 | beforeCreate() {
22 | console.log($storage.all())
23 | this.actions = [{
24 | title: 'Set color',
25 | onClick: async (menu) => {
26 | console.log(menu)
27 | console.log(this)
28 | let color = await $input.prompt({
29 | title: 'Set color',
30 | hint: 'color',
31 | value: this.color()
32 | })
33 | $storage.put('icon_color', color)
34 | this.refresh()
35 | },
36 | asAction: true
37 | }]
38 | },
39 | color() {
40 | return $storage.get('icon_color') || 'black'
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/api_demo/components/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'bottomTab',
3 | title: 'API Demo',
4 | items: [
5 | {
6 | title: '组件',
7 | route: $route('component'),
8 | image: $assets('component.svg')
9 | },
10 | {
11 | title: '全局 API',
12 | route: $route('api'),
13 | image: $assets('global.svg')
14 | },
15 | {
16 | title: 'icons',
17 | route: $route('icons'),
18 | image: $icon('mood')
19 | },
20 | {
21 | title: '更多',
22 | route: $route('more'),
23 | image: $icon('more_vert')
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/api_demo/components/more.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'list',
3 | fetch() {
4 | return [{
5 | title: 'File system',
6 | route: $route('file', {
7 | path: `/`
8 | })
9 | }]
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/api_demo/components/search.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'list',
3 | fetch({ args, page }) {
4 | return [
5 | {
6 | title: `keyword: ${args.keyword}`
7 | }
8 | ]
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/api_demo/components/storage.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dorajs/samples/0960cc9ce967407af238958fdfdb098a295344b6/api_demo/components/storage.js
--------------------------------------------------------------------------------
/api_demo/components/types/article.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'article',
3 | title: '欢迎使用 Dora.js,官网:https://dorajs.com/',
4 | image: 'https://www.wangbase.com/blogimg/asset/201909/bg2019091201.jpg',
5 | async fetch() {
6 | const resp = await $axios.get('https://docs.dorajs.com/README.md')
7 | return {
8 | content: {
9 | markdown: resp.data,
10 | charset: 'utf-8'
11 | },
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/api_demo/components/types/audio.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'audio',
3 | fetch() {
4 | return {
5 | title: 'Sample Audio',
6 | url: 'https://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_1MG.mp3',
7 | image: 'https://goss.veer.com/creative/vcg/veer/800water/veer-310433275.jpg'
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/api_demo/components/types/bottomTab.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'bottomTab',
3 | items: [
4 | {
5 | title: 'Tab 1',
6 | image: $icon('favorite_border'),
7 | route: $route('empty')
8 | },
9 | {
10 | title: 'Tab 2',
11 | image: $icon('feedback'),
12 | route: $route('empty')
13 | },
14 | {
15 | title: 'Tab 3',
16 | image: $icon('get_app'),
17 | route: $route('empty')
18 | },
19 | {
20 | title: 'Tab 4',
21 | image: $icon('home'),
22 | route: $route('empty')
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/api_demo/components/types/drawer.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'drawer',
3 | items: [
4 | {
5 | title: 'Tab 1',
6 | route: $route('empty')
7 | },
8 | {
9 | title: 'Tab 2',
10 | route: $route('empty')
11 | },
12 | {
13 | title: 'Tab 3',
14 | route: $route('empty')
15 | },
16 | {
17 | title: 'Tab 4',
18 | route: $route('empty')
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/api_demo/components/types/image.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'image',
3 | fetch() {
4 | return {
5 | // url: 'https://raw.githubusercontent.com/DoraKit/vscode-extension/master/docs/explorer.png',
6 | url: {
7 | value: 'https://raw.githubusercontent.com/DoraKit/vscode-extension/master/docs/explorer.png',
8 | headers: {
9 | Test: 'Test-Header'
10 | }
11 | },
12 | summary: 'Dora.js 的 VSCode 开发插件',
13 | title: 'Dora.js vscode extension',
14 | link: 'https://github.com/DoraKit/vscode-extension',
15 | author: {
16 | name: 'linroid',
17 | avatar: 'https://avatars0.githubusercontent.com/u/3192142?s=460&v=4',
18 | route: $route('https://github.com/linroid')
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/api_demo/components/types/list.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 |
3 | module.exports = {
4 | type: 'list',
5 | style: 'simple',
6 | actions: [
7 | {
8 | id: 'update_menu',
9 | title: 'Update title',
10 | onClick: async function () {
11 | let newTitle = await $input.prompt({
12 | title: 'Update title',
13 | hint: 'new title',
14 | value: this.title
15 | })
16 | this.title = newTitle
17 | }
18 | }
19 | ],
20 | async fetch() {
21 | return [
22 | // label
23 | {
24 | title: '样式: label',
25 | style: 'category'
26 | },
27 | {
28 | title: 'Label 1',
29 | style: 'label'
30 | },
31 | {
32 | title: 'Label 2',
33 | style: 'label'
34 | },
35 | {
36 | title: 'Label 3',
37 | style: 'label'
38 | },
39 | {
40 | title: 'Label 4',
41 | style: 'label'
42 | },
43 | // chips
44 | {
45 | title: '样式: chips',
46 | style: 'category'
47 | },
48 | {
49 | title: 'Chips title',
50 | style: 'chips',
51 | actions: [
52 | {
53 | title: 'Action 1'
54 | },
55 | {
56 | title: 'Action 2'
57 | },
58 | {
59 | title: 'Action 3'
60 | },
61 | {
62 | title: 'Action 4'
63 | }
64 | ]
65 | },
66 | // simple
67 | {
68 | title: '样式:simple',
69 | style: 'category'
70 | },
71 | {
72 | title: 'Hello World!',
73 | style: 'simple'
74 | },
75 | {
76 | title: 'Hello World!',
77 | style: 'simple',
78 | summary: '一个简单的样式'
79 | },
80 | {
81 | title: 'Hello World!',
82 | style: 'simple',
83 | image: $icon('face', 'black'),
84 | summary: '一个简单的样式'
85 | },
86 | // icon
87 | {
88 | title: '样式:icon',
89 | style: 'category'
90 | },
91 | {
92 | title: 'icon',
93 | style: 'icon',
94 | image: $icon('face', 'red')
95 | },
96 | {
97 | title: 'icon',
98 | style: 'icon',
99 | image: $icon('code')
100 | },
101 | {
102 | title: 'icon',
103 | style: 'icon',
104 | image: $icon('build', 'green')
105 | },
106 | // dashboard
107 | {
108 | title: '样式:dashboard',
109 | style: 'category'
110 | },
111 | {
112 | style: 'dashboard',
113 | image: $icon('memory'),
114 | title: '内存使用',
115 | summary: '1024 MB',
116 | color: '#8B355E',
117 | textColor: 'white'
118 | },
119 | {
120 | style: 'dashboard',
121 | image: $icon('battery_alert'),
122 | title: '电池使用',
123 | summary: '1024MB',
124 | color: '#81AF37',
125 | textColor: 'white'
126 | },
127 | // vod
128 | {
129 | title: '样式:vod',
130 | style: 'category'
131 | },
132 | {
133 | title: '冰雪奇缘2',
134 | style: 'vod',
135 | thumb:
136 | 'https://p0.meituan.net/moviemachine/58ee13be6dc60bf5e636cf915bbbaaa55787785.jpg@464w_644h_1e_1c',
137 | label: '喜剧,动画,冒险',
138 | summary:
139 | '为什么艾莎(伊迪娜·门泽尔 配音)天生就拥有神奇魔法?谜题的答案一直呼唤着她,也威胁着王国的安全。她将和安娜(克里斯汀·贝尔 配音)、克斯托夫(乔纳森·格罗夫 配音)、雪宝(乔什·盖德 配音)和驯鹿斯特共同开启一场非凡的冒险旅程。艾莎曾担心世界不能接受自己的冰雪魔法,但在《冰雪奇缘2》中她却必须祈祷自己的魔法足够强大,能够拯救世界。本片由奥斯卡金牌团队打造——导演珍妮弗·李和克里斯·巴克、制作人彼得·戴尔·维克以及词曲作者克里斯汀·安德森-洛佩兹及罗伯特·洛佩兹悉数回归,原配音班底伊迪娜·门泽尔、克里斯汀·贝尔、乔纳森·格罗夫和乔什·盖德再度加盟。华特迪士尼动画工作室荣誉出品《冰雪奇缘2》将于2019年11月22日登陆北美院线。'
140 | },
141 | {
142 | title: '复仇者联盟4:终局之战d',
143 | style: 'vod',
144 | thumb:
145 | 'https://p0.meituan.net/moviemachine/f7d2ad70eb79d6d9b8a197713db9b8c41711752.jpg@464w_644h_1e_1c',
146 | label: '动作,冒险,奇幻',
147 | summary:
148 | '一声响指,宇宙间半数生命灰飞烟灭。几近绝望的复仇者们在惊奇队长(布丽·拉尔森 饰)的帮助下找到灭霸(乔什·布洛林 饰)归隐之处,却得知六颗无限宝石均被销毁,希望彻底破灭。如是过了五年,迷失在量子领域的蚁人(保罗·路德 饰)意外回到现实世界,他的出现为幸存的复仇者们点燃了希望。与美国队长(克里斯·埃文斯 饰)冰释前嫌的托尼(小罗伯特·唐尼 饰)找到了穿越时空的方法,星散各地的超级英雄再度集结,他们分别穿越不同的时代去搜集无限宝石。而在这一过程中,平行宇宙的灭霸察觉了他们的计划。 注定要载入史册的最终决战,超级英雄们为了心中恪守的信念前仆后继……'
149 | },
150 | // live
151 | {
152 | title: '样式:live',
153 | style: 'category'
154 | },
155 | {
156 | title: 'Coding...',
157 | style: 'live',
158 | image: 'https://weiliicimg9.pstatp.com/weili/l/778002376200945690.webp',
159 | label: '英雄联盟',
160 | viewerCount: '1.1k',
161 | author: {
162 | name: 'linroid',
163 | avatar: 'https://linroid.com/avatar.png'
164 | }
165 | },
166 | {
167 | title: 'Coding...',
168 | style: 'live',
169 | image: 'https://weiliicimg9.pstatp.com/weili/l/778002376200945690.webp',
170 | label: '英雄联盟',
171 | author: {
172 | name: 'linroid',
173 | avatar: 'https://linroid.com/avatar.png'
174 | }
175 | },
176 | {
177 | title: 'Coding...',
178 | style: 'live',
179 | image: 'https://weiliicimg9.pstatp.com/weili/l/778002376200945690.webp',
180 | spanCount: 12,
181 | label: '英雄联盟',
182 | author: {
183 | name: 'linroid',
184 | avatar: 'https://linroid.com/avatar.png'
185 | }
186 | },
187 | // richMedia
188 | {
189 | title: '样式:richMedia',
190 | style: 'category'
191 | },
192 | {
193 | title: 'Title goes here',
194 | style: 'richMedia',
195 | image: 'https://weiliicimg9.pstatp.com/weili/l/778002376200945690.webp',
196 | rating: {
197 | score: 4.5,
198 | total: 5,
199 | text: '4.5(1000)'
200 | },
201 | summary:
202 | 'Secondary line text Lorem ipsum dolor sit amet, nec no nominavi scaevola. Per et sint sapientem, nobis perpetua salutandi mei te.',
203 | subtitle: 'Subtitle goes here',
204 | tags: [
205 | {
206 | title: 'Tag 1',
207 | onClick: this.simpleOnClick
208 | },
209 | {
210 | title: 'Tag 2',
211 | onClick: this.simpleOnClick
212 | },
213 | {
214 | title: 'Tag 3',
215 | onClick: this.simpleOnClick
216 | }
217 | ],
218 | actions: [
219 | {
220 | title: 'Action1',
221 | onClick: this.simpleOnClick
222 | },
223 | {
224 | title: 'Action 2',
225 | onClick: this.simpleOnClick
226 | }
227 | ]
228 | },
229 | // category
230 | {
231 | title: '样式:gallery',
232 | style: 'category'
233 | },
234 | {
235 | title: 'gallery',
236 | style: 'gallery',
237 | image: 'https://weiliicimg9.pstatp.com/weili/l/778002376200945690.webp',
238 | author: {
239 | name: 'linroid',
240 | avatar: 'https://avatars0.githubusercontent.com/u/3192142?s=460&v=4'
241 | }
242 | },
243 | // category
244 | {
245 | title: '样式:book',
246 | style: 'category'
247 | },
248 | {
249 | image: 'https://img1.doubanio.com/view/subject/l/public/s2768378.jpg',
250 | title: '三体',
251 | style: 'book'
252 | },
253 | {
254 | image: 'https://img3.doubanio.com/view/subject/l/public/s8958650.jpg',
255 | title: 'JavaScript高级程序设计',
256 | style: 'book'
257 | },
258 | // article
259 | {
260 | title: '样式: article',
261 | style: 'category'
262 | },
263 | {
264 | time: 'just now',
265 | title: '任天堂 Switch 国行版上市, 腾讯提供本地化网络服务',
266 | style: 'article',
267 | author: {
268 | name: 'xx媒体'
269 | },
270 | image: 'https://weiliicimg9.pstatp.com/weili/l/778002376200945690.webp',
271 | summary:
272 | '12 月 4 日,腾讯集团和任天堂在上海举行发布会,宣布腾讯引进的任天堂新世代游戏机 Nintendo Switch 将于 12 月 10 日正式发售 ... 有「马力欧之父」称号的任天堂株式会社代表取缔役、专门领域开发主导宫本茂通过视频形式表示:任天堂长久以来,一直希望可以为中国顾客提供任天堂的游戏娱乐,现在这个梦想得以实现,真的感到十分高兴,也十分感谢 ... 腾讯游戏任天堂合作部总经理钱赓介绍,关于未来 Nintendo Switch 的网络服务方面,腾讯在国内架设了适合中国网络环境的网络系统,将通过云服务,设立了本地化的网络服务'
273 | },
274 | // richContent
275 | {
276 | title: '样式: richContent',
277 | style: 'category'
278 | },
279 | {
280 | title: 'README.md',
281 | style: 'richContent',
282 | content: {
283 | url: 'https://docs.dorajs.com/',
284 | markdown: this.readReadme()
285 | }
286 | },
287 | {
288 | title: '百度一下',
289 | style: 'richContent',
290 | content: {
291 | url: 'https://baidu.com/'
292 | }
293 | }
294 | ]
295 | },
296 | simpleOnClick(data) {
297 | $ui.toast(`onClick ${JSON.stringify(data)}`)
298 | },
299 | readReadme() {
300 | return fs.readFileSync('./README.md', { encoding: 'utf8' })
301 | }
302 | }
303 |
--------------------------------------------------------------------------------
/api_demo/components/types/nested.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'drawer',
3 | items: [
4 | {
5 | title: '-> bottomTab > topTab',
6 | route: $route('@bottomTab', {
7 | items: [
8 | {
9 | title: 'topTab',
10 | image: $icon('favorite_border'),
11 | route: $route('types/topTab')
12 | },
13 | {
14 | title: 'Tab 2',
15 | image: $icon('feedback'),
16 |
17 | route: $route('empty')
18 | },
19 | {
20 | title: 'Tab 3',
21 | image: $icon('home'),
22 | route: $route('empty')
23 | }
24 | ]
25 | })
26 | },
27 | {
28 | title: '> bottomTab',
29 | route: $route('types/bottomTab')
30 | },
31 | {
32 | title: '> topTab',
33 | route: $route('types/topTab')
34 | }
35 | ]
36 | }
37 |
--------------------------------------------------------------------------------
/api_demo/components/types/topTab.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'topTab',
3 | actions: [
4 | {
5 | title: 'tabMode',
6 | onClick: async function () {
7 | const option = await $input.select({
8 | title: '选择 tabMode',
9 | options: [
10 | {
11 | title: 'fixed',
12 | value: 'fixed'
13 | },
14 | {
15 | title: 'scrollable',
16 | value: 'scrollable'
17 | }
18 | ]
19 | })
20 | this.tabMode = option.value
21 | }
22 | }
23 | ],
24 | items: [
25 | {
26 | title: 'Tab 1',
27 | route: $route('empty')
28 | },
29 | {
30 | title: 'Tab 2',
31 | route: $route('empty')
32 | },
33 | {
34 | title: 'Tab 3',
35 | route: $route('empty')
36 | },
37 | {
38 | title: 'Tab 4',
39 | route: $route('empty')
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/api_demo/components/types/video.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'video',
3 | title: '示例视频',
4 | danmuScheduler: null,
5 | fetch() {
6 | return {
7 | // url: 'http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/gear5/prog_index.m3u8',
8 | url: {
9 | value: 'http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/gear5/prog_index.m3u8',
10 | headers: {
11 | 'Test-Key': 'Test-Value'
12 | }
13 | },
14 | image:
15 | 'https://goss.veer.com/creative/vcg/veer/800water/veer-310433275.jpg'
16 | }
17 | },
18 | startDanmaku() {
19 | console.log('startDanmaku')
20 | var seq = 0
21 | this.danmuScheduler = setInterval(() => {
22 | seq++
23 | this.addDanmaku({
24 | nick: '测试消息',
25 | content: `Danmaku ${seq}`
26 | })
27 | }, 100)
28 | },
29 | stopDanmaku() {
30 | console.log('stopDanmaku')
31 | clearInterval(this.danmuScheduler)
32 | },
33 | sendDanmaku(message) {
34 | $ui.toast(`send ${message}`)
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/api_demo/components/types/webview.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'webview',
3 | uiOptions: {
4 | toolBar: true,
5 | statusBar: true
6 | },
7 | script: 'dom.js',
8 | fetch() {
9 | console.log('webview fetch')
10 | return {
11 | url: "https://www.npmjs.com/",
12 | }
13 | },
14 | created() {
15 | this.actions = [{
16 | title: "Send Event",
17 | onClick: () => {
18 | console.log(this)
19 | this.runScript('$dora.sendEvent("test")')
20 | }
21 | }, {
22 | title: "Redirect",
23 | onClick: async () => {
24 | let newUrl = await $input.prompt({
25 | title: "Url"
26 | })
27 | this.redirect(newUrl)
28 | }
29 | }, {
30 | title: "Get cookies",
31 | onClick: () => {
32 | $ui.toast(JSON.stringify(this.cookies))
33 | }
34 | }, {
35 | title: "Set cookies",
36 | onClick: () => {
37 | console.log('Set cookies')
38 | this.cookies = {
39 | token: '1234567'
40 | }
41 | console.log(this.cookies)
42 | $ui.toast(JSON.stringify(this.cookies))
43 | }
44 | }]
45 | },
46 | onPageFinished(url) {
47 | console.log(`onPageFinished: ${url}`)
48 | },
49 | onEvent(name, data) {
50 | if (name == 'test') {
51 | $ui.toast(`Event: name=${name}, data=${JSON.stringify(data)}`)
52 | }
53 | console.log(`Event: name=${name}, data=${JSON.stringify(data)}`)
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/api_demo/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "commonjs"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/api_demo/main.js:
--------------------------------------------------------------------------------
1 | console.log(process.versions)
--------------------------------------------------------------------------------
/api_demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "uuid": "2f33d8de-c474-4f38-a19b-cf2cab4228cc",
3 | "name": "@dora.js/api-demo",
4 | "displayName": "示例扩展",
5 | "version": "1.8.0",
6 | "description": "快速体验 Dora.js 提供的各种能力",
7 | "license": "MIT",
8 | "updates": "添加 $permission.request() 示例\n需要升级 Dora.js 到 1.8.0-beta",
9 | "homepage": "https://github.com/Dorajs/samples/tree/master/api_demo",
10 | "repository": {
11 | "type": "git",
12 | "directory": "api_demo",
13 | "url": "https://github.com/Dorajs/samples.git"
14 | },
15 | "author": {
16 | "name": "linroid",
17 | "fullname": "Lin Zhang",
18 | "email": "linroid@gmail.com"
19 | },
20 | "engines": {
21 | "dora": ">=1.8.0"
22 | },
23 | "keywords": [
24 | "Dora.js"
25 | ],
26 | "icon": "assets/icon.png",
27 | "main": "main.js",
28 | "contributes": {
29 | "search": "search",
30 | "tasks": {
31 | "get_ip": {
32 | "icon": "assets/ip.svg",
33 | "label": "Sample: 获取外网 IP"
34 | }
35 | }
36 | },
37 | "dependencies": {
38 | "axios": "^0.21.1",
39 | "cheerio": "^1.0.0-rc.3",
40 | "lru-cache": "^5.1.1"
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/api_demo/scripts/dom.js:
--------------------------------------------------------------------------------
1 | console.log(document);
2 | $dora.sendEvent("number", 1);
3 | $dora.sendEvent("bool", 1.0);
4 | $dora.sendEvent("string", 1.0);
5 | $dora.sendEvent("array", [1, 2, 3]);
6 | $dora.sendEvent("object", {
7 | to: 'foo@example.com',
8 | name: 'Foo'
9 | });
10 |
--------------------------------------------------------------------------------
/api_demo/tasks/get_ip.js:
--------------------------------------------------------------------------------
1 | module.exports = async () => {
2 | let resp = await $axios.get('https://api.ipify.org?format=json')
3 | return {
4 | message: `外网 IP: ${resp.data.ip}`,
5 | succeed: true
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/api_demo/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | "@types/node@*":
6 | version "13.13.5"
7 | resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.5.tgz#96ec3b0afafd64a4ccea9107b75bf8489f0e5765"
8 | integrity sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==
9 |
10 | axios@^0.21.1:
11 | version "0.21.1"
12 | resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
13 | integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
14 | dependencies:
15 | follow-redirects "^1.10.0"
16 |
17 | boolbase@~1.0.0:
18 | version "1.0.0"
19 | resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
20 | integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
21 |
22 | cheerio@^1.0.0-rc.3:
23 | version "1.0.0-rc.3"
24 | resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.3.tgz#094636d425b2e9c0f4eb91a46c05630c9a1a8bf6"
25 | integrity sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==
26 | dependencies:
27 | css-select "~1.2.0"
28 | dom-serializer "~0.1.1"
29 | entities "~1.1.1"
30 | htmlparser2 "^3.9.1"
31 | lodash "^4.15.0"
32 | parse5 "^3.0.1"
33 |
34 | css-select@~1.2.0:
35 | version "1.2.0"
36 | resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858"
37 | integrity sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=
38 | dependencies:
39 | boolbase "~1.0.0"
40 | css-what "2.1"
41 | domutils "1.5.1"
42 | nth-check "~1.0.1"
43 |
44 | css-what@2.1:
45 | version "2.1.3"
46 | resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2"
47 | integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==
48 |
49 | dom-serializer@0:
50 | version "0.2.2"
51 | resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51"
52 | integrity sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==
53 | dependencies:
54 | domelementtype "^2.0.1"
55 | entities "^2.0.0"
56 |
57 | dom-serializer@~0.1.1:
58 | version "0.1.1"
59 | resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0"
60 | integrity sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==
61 | dependencies:
62 | domelementtype "^1.3.0"
63 | entities "^1.1.1"
64 |
65 | domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1:
66 | version "1.3.1"
67 | resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f"
68 | integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==
69 |
70 | domelementtype@^2.0.1:
71 | version "2.0.1"
72 | resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.0.1.tgz#1f8bdfe91f5a78063274e803b4bdcedf6e94f94d"
73 | integrity sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==
74 |
75 | domhandler@^2.3.0:
76 | version "2.4.2"
77 | resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803"
78 | integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==
79 | dependencies:
80 | domelementtype "1"
81 |
82 | domutils@1.5.1:
83 | version "1.5.1"
84 | resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf"
85 | integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=
86 | dependencies:
87 | dom-serializer "0"
88 | domelementtype "1"
89 |
90 | domutils@^1.5.1:
91 | version "1.7.0"
92 | resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a"
93 | integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==
94 | dependencies:
95 | dom-serializer "0"
96 | domelementtype "1"
97 |
98 | entities@^1.1.1, entities@~1.1.1:
99 | version "1.1.2"
100 | resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56"
101 | integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==
102 |
103 | entities@^2.0.0:
104 | version "2.0.0"
105 | resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4"
106 | integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==
107 |
108 | follow-redirects@^1.10.0:
109 | version "1.13.3"
110 | resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267"
111 | integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==
112 |
113 | htmlparser2@^3.9.1:
114 | version "3.10.1"
115 | resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f"
116 | integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==
117 | dependencies:
118 | domelementtype "^1.3.1"
119 | domhandler "^2.3.0"
120 | domutils "^1.5.1"
121 | entities "^1.1.1"
122 | inherits "^2.0.1"
123 | readable-stream "^3.1.1"
124 |
125 | inherits@^2.0.1, inherits@^2.0.3:
126 | version "2.0.4"
127 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
128 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
129 |
130 | lodash@^4.15.0:
131 | version "4.17.21"
132 | resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
133 | integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
134 |
135 | lru-cache@^5.1.1:
136 | version "5.1.1"
137 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
138 | integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==
139 | dependencies:
140 | yallist "^3.0.2"
141 |
142 | nth-check@~1.0.1:
143 | version "1.0.2"
144 | resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c"
145 | integrity sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==
146 | dependencies:
147 | boolbase "~1.0.0"
148 |
149 | parse5@^3.0.1:
150 | version "3.0.3"
151 | resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c"
152 | integrity sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==
153 | dependencies:
154 | "@types/node" "*"
155 |
156 | readable-stream@^3.1.1:
157 | version "3.6.0"
158 | resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198"
159 | integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
160 | dependencies:
161 | inherits "^2.0.3"
162 | string_decoder "^1.1.1"
163 | util-deprecate "^1.0.1"
164 |
165 | safe-buffer@~5.2.0:
166 | version "5.2.0"
167 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
168 | integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
169 |
170 | string_decoder@^1.1.1:
171 | version "1.3.0"
172 | resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
173 | integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
174 | dependencies:
175 | safe-buffer "~5.2.0"
176 |
177 | util-deprecate@^1.0.1:
178 | version "1.0.2"
179 | resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
180 | integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
181 |
182 | yallist@^3.0.2:
183 | version "3.1.1"
184 | resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
185 | integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
186 |
--------------------------------------------------------------------------------
/bing_wallpaper/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "useTabs": false,
4 | "semi": false,
5 | "singleQuote": true,
6 | "trailingComma": "none",
7 | "bracketSpacing": true,
8 | "arrowParens": "avoid"
9 | }
10 |
--------------------------------------------------------------------------------
/bing_wallpaper/assets/bing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dorajs/samples/0960cc9ce967407af238958fdfdb098a295344b6/bing_wallpaper/assets/bing.png
--------------------------------------------------------------------------------
/bing_wallpaper/assets/prefs.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/bing_wallpaper/components/index.js:
--------------------------------------------------------------------------------
1 | const WonderfulBingWallpaper = require('wonderful-bing-wallpaper')
2 | const wbw = new WonderfulBingWallpaper({
3 | size: 10,
4 | local: 'zh-CN'
5 | })
6 | module.exports = {
7 | type: 'list',
8 | translucent: true,
9 | async fetch({ args, page }) {
10 | let json = await wbw.getWallpapers()
11 | let wallpapers = wbw.humanizeWallpapers(json)
12 | console.log(wallpapers)
13 | return wallpapers.map(item => {
14 | return {
15 | title: item.bsTitle,
16 | image: item.humanizeUrl,
17 | style: 'gallery',
18 | summary: item.copyright,
19 | route: $route('@image', {
20 | url: item.humanizeUrl,
21 | title: item.bsTitle
22 | })
23 | }
24 | })
25 | },
26 | onClick(item) {
27 | $ui.toast(`Clicked ${item.title}`)
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/bing_wallpaper/main.js:
--------------------------------------------------------------------------------
1 | if (typeof $dora == undefined) {
2 | console.log('This project can only run on Dora app, please visit https://dorajs.com for more information')
3 | process.exit(-1)
4 | }
5 |
6 | console.log('Congratulation, your addon run successfully!')
7 |
--------------------------------------------------------------------------------
/bing_wallpaper/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "uuid": "c5258f19-e0a1-4678-9880-04d87a69e0c8",
3 | "name": "@dora.js/bing_wallpaper",
4 | "displayName": "Bing 每日壁纸",
5 | "version": "1.1.1",
6 | "description": "Bing 每日壁纸",
7 | "icon": "assets/bing.png",
8 | "prefs": "assets/prefs.json",
9 | "main": "main.js",
10 | "homepage": "https://github.com/Dorajs/samples/tree/master/bing_wallpaper",
11 | "repository": {
12 | "type": "git",
13 | "directory": "bing_wallpaper",
14 | "url": "https://github.com/Dorajs/samples.git"
15 | },
16 | "author": {
17 | "name": "linroid",
18 | "fullname": "Lin Zhang",
19 | "email": "linroid@gmail.com"
20 | },
21 | "engines": {
22 | "dora": ">=1.8.0"
23 | },
24 | "keywords": [
25 | "Dora.js"
26 | ],
27 | "dependencies": {
28 | "wonderful-bing-wallpaper": "^0.2.1"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "commonjs"
5 | }
6 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dora-addons",
3 | "version": "1.0.0",
4 | "displayName": "官方",
5 | "description": "Dora 官方示例扩展仓库",
6 | "main": "index.js",
7 | "repository": "https://github.com:DoraKit/addons.git",
8 | "author": "linroid ",
9 | "license": "",
10 | "scripts": {
11 | "build": "dora repo --url https://dorajs.gitee.io/samples/"
12 | },
13 | "dependencies": {
14 | "@dora-app/cli": "^1.1.2",
15 | "archiver": "^3.1.1",
16 | "read-package-json": "^2.1.0"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/readhub/.jsbeautifyrc:
--------------------------------------------------------------------------------
1 | {
2 | "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
3 | "brace_style": "collapse,preserve-inline",
4 | "break_chained_methods": false,
5 | "e4x": false,
6 | "end_with_newline": true,
7 | "indent_char": " ",
8 | "indent_level": 0,
9 | "indent_size": 2,
10 | "indent_with_tabs": false,
11 | "jslint_happy": false,
12 | "keep_array_indentation": false,
13 | "keep_function_indentation": false,
14 | "max_preserve_newlines": 0,
15 | "preserve_newlines": true,
16 | "space_after_anon_function": false,
17 | "space_before_conditional": true,
18 | "space_in_empty_paren": false,
19 | "space_in_paren": false,
20 | "unescape_strings": false,
21 | "wrap_line_length": 0
22 | }
23 |
--------------------------------------------------------------------------------
/readhub/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "asi": true,
3 | "esversion": 8,
4 | "indent": true
5 | }
--------------------------------------------------------------------------------
/readhub/.npmignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | dist/
--------------------------------------------------------------------------------
/readhub/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "useTabs": false,
4 | "semi": false,
5 | "singleQuote": true,
6 | "trailingComma": "none",
7 | "bracketSpacing": true,
8 | "arrowParens": "avoid"
9 | }
10 |
--------------------------------------------------------------------------------
/readhub/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dorajs/samples/0960cc9ce967407af238958fdfdb098a295344b6/readhub/assets/icon.png
--------------------------------------------------------------------------------
/readhub/components/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'topTab',
3 | tabMode: 'fixed',
4 | fetch() {
5 | return [{
6 | title: '热门话题',
7 | route: $route('topics', {}),
8 | image: $icon('cake')
9 | }, {
10 | title: '科技动态',
11 | route: $route('news', { column: 'news' }),
12 | image: $icon('mood')
13 | }, {
14 | title: '开发者',
15 | route: $route('news', { column: 'technews' }),
16 | image: $icon('android')
17 | },
18 | {
19 | title: '区块链',
20 | route: $route('news', { column: 'blockchain' })
21 | }
22 | ]
23 | },
24 | onClick(item) {
25 | $ui.toast(`Clicked ${item.title}`)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/readhub/components/news.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'list',
3 | async fetch({ args, page }) {
4 | let resp = await $axios.get(`https://api.readhub.cn/${args.column}?lastCursor=${page || ''}&pageSize=${this.pageSize}`)
5 | let list = resp.data.data
6 | let items = list.map(data => ({
7 | id: data.id,
8 | time: data.publishDate,
9 | title: data.title,
10 | style: 'article',
11 | link: data.mobileUrl,
12 | author: {
13 | name: data.authorName
14 | },
15 | summary: data.summary,
16 | route: $route('@article', {
17 | id: data.id,
18 | content: {
19 | url: data.mobileUrl
20 | }
21 | })
22 | }))
23 | let nextPage = null
24 | if (list.length > 0) {
25 | let publishDate = list[list.length - 1].publishDate
26 | nextPage = Date.parse(publishDate)
27 | }
28 | return {
29 | nextPage: nextPage,
30 | items: items
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/readhub/components/topic_detail.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'article',
3 | async fetch({ args }) {
4 | let resp = await $axios.get(`https://api.readhub.cn/topic/${args.id}`)
5 | let data = resp.data
6 | return {
7 | content: {
8 | url: `https://readhub.cn/topic/${args.id}`,
9 | text: data.summary
10 | },
11 | title: data.title,
12 | time: data.createdAt
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/readhub/components/topics.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: 'list',
3 | async fetch({ page }) {
4 | let resp = await $axios.get(`https://api.readhub.cn/topic?lastCursor=${page || ''}&pageSize=${this.pageSize}`)
5 | let list = resp.data.data
6 | let items = list.map(data => {
7 | return {
8 | id: data.id,
9 | time: data.createdAt,
10 | title: data.title,
11 | style: 'article',
12 | summary: data.summary,
13 | route: $route('topic_detail', {
14 | id: data.id
15 | })
16 | }
17 | })
18 | let nextPage = null
19 | if (list.length > 0) {
20 | nextPage = list[list.length - 1].order
21 | }
22 | return {
23 | nextPage: nextPage,
24 | items: items
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/readhub/main.js:
--------------------------------------------------------------------------------
1 | $dora.mixin({
2 | pageSize: 20
3 | })
--------------------------------------------------------------------------------
/readhub/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "uuid": "36c0507b-d500-475b-98e9-827eae523448",
3 | "name": "@dora.js/readhub",
4 | "displayName": "Readhub",
5 | "version": "1.2.5",
6 | "description": "每天三分钟的科技新闻聚合阅读",
7 | "license": "MIT",
8 | "homepage": "https://github.com/Dorajs/samples/tree/master/readhub",
9 | "repository": {
10 | "type": "git",
11 | "directory": "readhub",
12 | "url": "https://github.com/Dorajs/samples.git"
13 | },
14 | "author": {
15 | "name": "linroid",
16 | "fullname": "Lin Zhang",
17 | "email": "linroid@gmail.com"
18 | },
19 | "engines": {
20 | "dora": ">=1.8.0"
21 | },
22 | "keywords": ["Dora.js"],
23 | "icon": "assets/icon.png",
24 | "main": "main.js",
25 | "dependencies": {}
26 | }
27 |
--------------------------------------------------------------------------------
/unsplash/.jsbeautifyrc:
--------------------------------------------------------------------------------
1 | {
2 | "allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
3 | "brace_style": "collapse,preserve-inline",
4 | "break_chained_methods": false,
5 | "e4x": false,
6 | "end_with_newline": true,
7 | "indent_char": " ",
8 | "indent_level": 0,
9 | "indent_size": 2,
10 | "indent_with_tabs": false,
11 | "jslint_happy": false,
12 | "keep_array_indentation": false,
13 | "keep_function_indentation": false,
14 | "max_preserve_newlines": 0,
15 | "preserve_newlines": true,
16 | "space_after_anon_function": false,
17 | "space_before_conditional": true,
18 | "space_in_empty_paren": false,
19 | "space_in_paren": false,
20 | "unescape_strings": false,
21 | "wrap_line_length": 0
22 | }
23 |
--------------------------------------------------------------------------------
/unsplash/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "asi": true,
3 | "esversion": 8,
4 | "indent": true
5 | }
--------------------------------------------------------------------------------
/unsplash/.npmignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | dist/
--------------------------------------------------------------------------------
/unsplash/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 2,
3 | "useTabs": false,
4 | "semi": false,
5 | "singleQuote": true,
6 | "trailingComma": "none",
7 | "bracketSpacing": true,
8 | "arrowParens": "avoid"
9 | }
10 |
--------------------------------------------------------------------------------
/unsplash/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Dorajs/samples/0960cc9ce967407af238958fdfdb098a295344b6/unsplash/assets/icon.png
--------------------------------------------------------------------------------
/unsplash/assets/prefs.json:
--------------------------------------------------------------------------------
1 | {
2 | "quality": {
3 | "type": "string",
4 | "default": "regular",
5 | "title": "图片质量",
6 | "options": [{
7 | "value": "regular",
8 | "title": "一般"
9 | }, {
10 | "value": "full",
11 | "title": "完整"
12 | }, {
13 | "value": "raw",
14 | "title": "原始"
15 | }]
16 | }
17 | }
--------------------------------------------------------------------------------
/unsplash/components/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | type: "list",
3 | translucent: true,
4 | actions: [{
5 | title: '官网',
6 | route: $route('https://unsplash.com/')
7 | }],
8 |
9 | async fetch({ page }) {
10 | page = page || 1
11 | let quality = $prefs.get('quality')
12 | let photos = await unsplash.photos
13 | .listPhotos(page, 15, "latest")
14 | .then(res => res.json())
15 | return {
16 | nextPage: page + 1,
17 | items: photos.map(photo => {
18 | return this.convert(photo, quality)
19 | })
20 | }
21 | },
22 |
23 | convert(photo, quality) {
24 | return {
25 | title: photo.title,
26 | route: $route('@image', {
27 | url: photo.urls[quality]
28 | }),
29 | style: 'gallery',
30 | summary: photo.description || photo.alt_description,
31 | author: {
32 | name: photo.user.name,
33 | avatar: photo.user.profile_image.small,
34 | route: $route(photo.user.links.html)
35 | },
36 | image: photo.urls.small,
37 | color: photo.color,
38 | aspect: photo.width / photo.height
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/unsplash/main.js:
--------------------------------------------------------------------------------
1 | // require syntax
2 | const Unsplash = require('unsplash-js').default
3 | const fetch = require('node-fetch')
4 | const ASSESS_TOKEN = '7a96a77d719e9967f935da53784d6a3eb58a4fb174dda25e89ec69059e46c815'
5 | // $axios.defaults.headers.common['Authorization'] = `Client-ID ${ASSESS_TOKEN}`
6 | module.exports = {
7 | fetch: fetch,
8 | unsplash: new Unsplash({ accessKey: ASSESS_TOKEN })
9 | }
10 |
--------------------------------------------------------------------------------
/unsplash/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "uuid": "8ce7453e-dc59-11e9-9d36-2a2ae2dbcce4",
3 | "name": "@dora.js/unsplash",
4 | "displayName": "Unsplash",
5 | "version": "1.2.1",
6 | "homepage": "https://github.com/Dorajs/samples/tree/master/unsplash",
7 | "repository": {
8 | "type": "git",
9 | "directory": "unsplash",
10 | "url": "https://github.com/Dorajs/samples.git"
11 | },
12 | "author": {
13 | "name": "linroid",
14 | "fullname": "Lin Zhang",
15 | "email": "linroid@gmail.com"
16 | },
17 | "license": "MIT",
18 | "description": "高清晰度免费图片素材,适用个人和商业",
19 | "engines": {
20 | "dora": ">=1.8.0"
21 | },
22 | "keywords": [
23 | "Dora.js"
24 | ],
25 | "icon": "assets/icon.png",
26 | "prefs": "assets/prefs.json",
27 | "main": "main.js",
28 | "dependencies": {
29 | "node-fetch": "^2.6.0",
30 | "unsplash-js": "^6.0.0"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/unsplash/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | form-urlencoded@1.2.0:
6 | version "1.2.0"
7 | resolved "https://registry.yarnpkg.com/form-urlencoded/-/form-urlencoded-1.2.0.tgz#16ce2cafa76d2e48b9e513ab723228aea5993396"
8 | integrity sha1-Fs4sr6dtLki55ROrcjIorqWZM5Y=
9 |
10 | lodash.get@4.4.2:
11 | version "4.4.2"
12 | resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
13 | integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
14 |
15 | node-fetch@^2.6.0:
16 | version "2.6.1"
17 | resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
18 | integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
19 |
20 | querystring@0.2.0:
21 | version "0.2.0"
22 | resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
23 | integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=
24 |
25 | querystringify@^2.0.0:
26 | version "2.1.1"
27 | resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e"
28 | integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==
29 |
30 | requires-port@^1.0.0:
31 | version "1.0.0"
32 | resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
33 | integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
34 |
35 | unsplash-js@^6.0.0:
36 | version "6.0.0"
37 | resolved "https://registry.yarnpkg.com/unsplash-js/-/unsplash-js-6.0.0.tgz#f13bd12817e115f440f0526bce18e1cb7b0fde16"
38 | integrity sha512-R7Zwd6mfjJ2mYGldWZpZ/LfVLh6Zi+iRUS8y3dx0jZNFU0nt6r6q4wtL+Gr/qv3TgMQFg/hRFxYKzXcdhkasyg==
39 | dependencies:
40 | form-urlencoded "1.2.0"
41 | lodash.get "4.4.2"
42 | querystring "0.2.0"
43 | url-parse "1.4.4"
44 |
45 | url-parse@1.4.4:
46 | version "1.4.4"
47 | resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.4.tgz#cac1556e95faa0303691fec5cf9d5a1bc34648f8"
48 | integrity sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==
49 | dependencies:
50 | querystringify "^2.0.0"
51 | requires-port "^1.0.0"
52 |
--------------------------------------------------------------------------------