@shzlx/ui-default 4.58.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 -0
- package/api.ts +61 -0
- package/backendlib/builder.ts +182 -0
- package/backendlib/markdown-it-imsize.ts +235 -0
- package/backendlib/markdown-it-katex.ts +139 -0
- package/backendlib/markdown-it-media.ts +163 -0
- package/backendlib/markdown-it-xss.ts +200 -0
- package/backendlib/markdown.js +64 -0
- package/backendlib/misc.ts +54 -0
- package/backendlib/template.ts +279 -0
- package/breakpoints.json +5 -0
- package/components/DOMAttachedObject.ts +128 -0
- package/components/autocomplete/AssignSelectAutoComplete.tsx +22 -0
- package/components/autocomplete/CustomSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/DomainSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/FileSelectAutoComplete.tsx +26 -0
- package/components/autocomplete/LanguageSelectAutoComplete.tsx +24 -0
- package/components/autocomplete/ProblemSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/UserSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/components/AssignSelectAutoComplete.tsx +118 -0
- package/components/autocomplete/components/DomainSelectAutoComplete.tsx +53 -0
- package/components/autocomplete/components/FileSelectAutoComplete.tsx +50 -0
- package/components/autocomplete/components/LanguageSelectAutoComplete.tsx +48 -0
- package/components/autocomplete/components/ProblemSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/components/UserSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/domainselectautocomplete.page.styl +6 -0
- package/components/autocomplete/index.tsx +110 -0
- package/components/autocomplete/problemselectautocomplete.page.styl +6 -0
- package/components/autocomplete/userselectautocomplete.page.styl +6 -0
- package/components/browser-update.page.ts +27 -0
- package/components/calendar/calendar.page.styl +129 -0
- package/components/calendar/index.js +367 -0
- package/components/clipboard.page.ts +23 -0
- package/components/contest/contest.page.styl +119 -0
- package/components/contest/contest.page.ts +23 -0
- package/components/contest/contest_sidebar.page.styl +21 -0
- package/components/contest/problem-contest-bg.png +0 -0
- package/components/contest/problem-contest-bg@2x.png +0 -0
- package/components/customFont.page.tsx +90 -0
- package/components/datepicker/datepicker.page.tsx +94 -0
- package/components/dialog/DomDialog.ts +145 -0
- package/components/dialog/dialog.page.styl +40 -0
- package/components/dialog/index.tsx +285 -0
- package/components/discussion/CommentBox.js +103 -0
- package/components/discussion/collapsible.page.styl +40 -0
- package/components/discussion/collapsible.page.tsx +62 -0
- package/components/discussion/comments.page.styl +142 -0
- package/components/discussion/comments.page.tsx +192 -0
- package/components/discussion/discussion.page.styl +17 -0
- package/components/discussion/history.page.tsx +81 -0
- package/components/discussion/reaction.page.styl +30 -0
- package/components/discussion/reaction.page.tsx +103 -0
- package/components/drop/drop.page.styl +40 -0
- package/components/dropdown/Dropdown.js +50 -0
- package/components/dropdown/dropdown.page.styl +33 -0
- package/components/dropdown/dropdown.page.ts +8 -0
- package/components/editor/cmeditor.page.ts +23 -0
- package/components/editor/cmeditor.styl +10 -0
- package/components/editor/index.tsx +293 -0
- package/components/editor/mdeditor.ts +60 -0
- package/components/editor/textareaHandler.ts +29 -0
- package/components/footer/footer.page.styl +94 -0
- package/components/footer/footer.page.ts +26 -0
- package/components/form/button.page.default.styl +59 -0
- package/components/form/button.page.styl +36 -0
- package/components/form/checkbox.page.styl +89 -0
- package/components/form/form.page.styl +200 -0
- package/components/form/form.page.ts +20 -0
- package/components/form/multiSelectCheckbox.page.js +46 -0
- package/components/form/radiobox.page.styl +62 -0
- package/components/form/select.page.styl +29 -0
- package/components/form/textbox.page.styl +79 -0
- package/components/form/textbox.page.ts +21 -0
- package/components/form/var.inc.styl +14 -0
- package/components/header/header.page.styl +79 -0
- package/components/highlighter/code-example.js +111 -0
- package/components/highlighter/highlighter.page.styl +99 -0
- package/components/highlighter/highlighter.page.ts +72 -0
- package/components/highlighter/meta.js +15 -0
- package/components/highlighter/prismjs.js +122 -0
- package/components/hint.page.styl +9 -0
- package/components/hint.ts +19 -0
- package/components/hitokoto/index.page.js +21 -0
- package/components/hotkey/hotkey.page.js +83 -0
- package/components/katex/katex.page.js +26 -0
- package/components/katex/katex.page.styl +2 -0
- package/components/languageselect.tsx +94 -0
- package/components/loader/loader.page.styl +40 -0
- package/components/mantine.page.tsx +39 -0
- package/components/marker/Marker.js +192 -0
- package/components/marker/MarkerReactive.js +55 -0
- package/components/marker/marker.page.js +8 -0
- package/components/marker/marker.page.styl +57 -0
- package/components/media/media.page.js +46 -0
- package/components/menu/menu-heading.page.js +28 -0
- package/components/menu/menu.page.js +18 -0
- package/components/menu/menu.page.styl +68 -0
- package/components/message/index.page.ts +166 -0
- package/components/message/worker.ts +110 -0
- package/components/messagepad/DialogueListItem.page.styl +28 -0
- package/components/messagepad/DialogueListItemComponent.jsx +39 -0
- package/components/messagepad/Message.page.styl +64 -0
- package/components/messagepad/MessageComponent.jsx +33 -0
- package/components/messagepad/MessagePad.page.styl +99 -0
- package/components/messagepad/MessagePadDialogueContentContainer.jsx +104 -0
- package/components/messagepad/MessagePadDialogueListContainer.jsx +49 -0
- package/components/messagepad/MessagePadInputContainer.jsx +100 -0
- package/components/messagepad/index.jsx +49 -0
- package/components/messagepad/reducers/activeId.ts +36 -0
- package/components/messagepad/reducers/dialogues.js +53 -0
- package/components/messagepad/reducers/index.ts +14 -0
- package/components/messagepad/reducers/inputs.js +43 -0
- package/components/messagepad/reducers/isPosting.ts +49 -0
- package/components/monaco/index.ts +178 -0
- package/components/monaco/languages/markdown.ts +97 -0
- package/components/monaco/languages/typescript.ts +45 -0
- package/components/monaco/languages/yaml.ts +22 -0
- package/components/monaco/loader.ts +96 -0
- package/components/monaco/monaco.styl +30 -0
- package/components/monaco/nls.js +31 -0
- package/components/monaco/schema/problemconfig.ts +123 -0
- package/components/navigation/hamburgers.page.styl +87 -0
- package/components/navigation/nav-logo-small_dark.png +0 -0
- package/components/navigation/navigation.page.js +203 -0
- package/components/navigation/navigation.page.styl +211 -0
- package/components/notification/index.ts +105 -0
- package/components/notification/notification.page.js +14 -0
- package/components/notification/notification.page.styl +84 -0
- package/components/nprogress.page.styl +50 -0
- package/components/omnisearch/index.page.tsx +124 -0
- package/components/omnisearch/omnibar.page.styl +138 -0
- package/components/pager/pager.page.styl +57 -0
- package/components/preview/preview.page.ts +187 -0
- package/components/problem/create.page.js +12 -0
- package/components/problem/list.page.js +9 -0
- package/components/problem/rp.page.styl +4 -0
- package/components/problem/tag.page.styl +84 -0
- package/components/problemconfig/BasicForm.tsx +92 -0
- package/components/problemconfig/ProblemConfigEditor.tsx +170 -0
- package/components/problemconfig/ProblemConfigForm.tsx +140 -0
- package/components/problemconfig/ProblemConfigTree.tsx +163 -0
- package/components/problemconfig/ProblemType.tsx +165 -0
- package/components/problemconfig/index.tsx +91 -0
- package/components/problemconfig/reducer/config.ts +173 -0
- package/components/problemconfig/reducer/index.ts +11 -0
- package/components/problemconfig/reducer/testdata.ts +16 -0
- package/components/problemconfig/tree/AddTestcase.tsx +137 -0
- package/components/problemconfig/tree/SelectionManager.tsx +140 -0
- package/components/problemconfig/tree/SubtaskSettings.tsx +180 -0
- package/components/problemconfig/tree/Testcase.tsx +98 -0
- package/components/profile/backgrounds/1.jpg +0 -0
- package/components/profile/backgrounds/10.jpg +0 -0
- package/components/profile/backgrounds/11.jpg +0 -0
- package/components/profile/backgrounds/12.jpg +0 -0
- package/components/profile/backgrounds/13.jpg +0 -0
- package/components/profile/backgrounds/14.jpg +0 -0
- package/components/profile/backgrounds/15.jpg +0 -0
- package/components/profile/backgrounds/16.jpg +0 -0
- package/components/profile/backgrounds/17.jpg +0 -0
- package/components/profile/backgrounds/18.jpg +0 -0
- package/components/profile/backgrounds/19.jpg +0 -0
- package/components/profile/backgrounds/2.jpg +0 -0
- package/components/profile/backgrounds/20.jpg +0 -0
- package/components/profile/backgrounds/21.jpg +0 -0
- package/components/profile/backgrounds/3.jpg +0 -0
- package/components/profile/backgrounds/4.jpg +0 -0
- package/components/profile/backgrounds/5.jpg +0 -0
- package/components/profile/backgrounds/6.jpg +0 -0
- package/components/profile/backgrounds/7.jpg +0 -0
- package/components/profile/backgrounds/8.jpg +0 -0
- package/components/profile/backgrounds/9.jpg +0 -0
- package/components/profile/backgrounds/gen_thumbnails.sh +7 -0
- package/components/profile/backgrounds/thumbnail/1.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/10.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/11.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/12.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/13.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/14.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/15.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/16.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/17.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/18.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/19.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/2.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/20.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/21.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/3.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/4.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/5.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/6.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/7.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/8.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/9.jpg +0 -0
- package/components/profile/profile.page.styl +23 -0
- package/components/react/DomComponent.tsx +14 -0
- package/components/react/IconComponent.tsx +20 -0
- package/components/record/record.page.styl +26 -0
- package/components/rotator/index.js +75 -0
- package/components/rotator/rotator.page.styl +20 -0
- package/components/scratchpad/DataInput.page.styl +17 -0
- package/components/scratchpad/DataInputComponent.jsx +45 -0
- package/components/scratchpad/Editor.page.styl +13 -0
- package/components/scratchpad/Panel.page.styl +18 -0
- package/components/scratchpad/PanelButton.page.styl +15 -0
- package/components/scratchpad/PanelButtonComponent.jsx +19 -0
- package/components/scratchpad/PanelComponent.jsx +25 -0
- package/components/scratchpad/ScratchpadEditorContainer.tsx +137 -0
- package/components/scratchpad/ScratchpadPretestContainer.jsx +57 -0
- package/components/scratchpad/ScratchpadRecordsContainer.jsx +45 -0
- package/components/scratchpad/ScratchpadRecordsRowContainer.jsx +83 -0
- package/components/scratchpad/ScratchpadSettings.tsx +48 -0
- package/components/scratchpad/ScratchpadToolbarContainer.jsx +190 -0
- package/components/scratchpad/Tab.page.styl +24 -0
- package/components/scratchpad/Toolbar.page.styl +53 -0
- package/components/scratchpad/ToolbarComponent.jsx +85 -0
- package/components/scratchpad/index.tsx +132 -0
- package/components/scratchpad/reducers/editor.ts +24 -0
- package/components/scratchpad/reducers/index.ts +17 -0
- package/components/scratchpad/reducers/pretest.ts +34 -0
- package/components/scratchpad/reducers/records.ts +40 -0
- package/components/scratchpad/reducers/state.ts +10 -0
- package/components/scratchpad/reducers/ui.ts +152 -0
- package/components/scratchpad/scratchpad.page.styl +55 -0
- package/components/scratchpad/var.inc.styl +2 -0
- package/components/selectUser.tsx +16 -0
- package/components/signin/signInDialog.page.js +84 -0
- package/components/signin/signin_dialog.page.styl +57 -0
- package/components/smoothscroll/smoothscroll.page.js +44 -0
- package/components/socket/index.ts +68 -0
- package/components/star/star.page.styl +20 -0
- package/components/star/star.page.ts +58 -0
- package/components/sticky/sticky.page.js +66 -0
- package/components/tab/Tab.js +168 -0
- package/components/tab/tab.page.js +9 -0
- package/components/tab/tab.page.styl +105 -0
- package/components/tab/var.inc.styl +3 -0
- package/components/table/StyledTable.js +51 -0
- package/components/table/styledTable.page.js +8 -0
- package/components/table/table.page.styl +73 -0
- package/components/time/time.page.js +47 -0
- package/components/tooltip/Tooltip.js +49 -0
- package/components/tooltip/tooltip.page.js +29 -0
- package/components/tooltip/tooltip.page.styl +69 -0
- package/components/training/training.page.styl +25 -0
- package/components/upload.tsx +103 -0
- package/components/vote/vote.page.js +43 -0
- package/components/zipDownloader/index.ts +157 -0
- package/constant/domain.js +21 -0
- package/constant/message.js +5 -0
- package/constant/record.js +52 -0
- package/context.ts +11 -0
- package/entry.js +72 -0
- package/hydro.ts +112 -0
- package/index.ts +226 -0
- package/lazyload.ts +69 -0
- package/locales/en.yaml +71 -0
- package/locales/ko.yaml +823 -0
- package/locales/zh.yaml +1137 -0
- package/locales/zh_TW.yaml +1133 -0
- package/misc/Page.ts +49 -0
- package/misc/PageLoader.js +31 -0
- package/misc/float.styl +14 -0
- package/misc/grid.styl +1048 -0
- package/misc/immersive-background.jpg +0 -0
- package/misc/immersive-background@2x.jpg +0 -0
- package/misc/immersive.styl +23 -0
- package/misc/nothing.styl +13 -0
- package/misc/puzzled_twd2.svg +1 -0
- package/misc/section.styl +105 -0
- package/misc/slideout.styl +46 -0
- package/misc/structure.styl +158 -0
- package/misc/textalign.styl +11 -0
- package/misc/typography.styl +485 -0
- package/package.json +148 -0
- package/polyfill.ts +90 -0
- package/postcss.config.js +15 -0
- package/sentry.ts +26 -0
- package/service-worker.ts +265 -0
- package/setting.yaml +98 -0
- package/templates/about.html +14 -0
- package/templates/bsod.html +35 -0
- package/templates/components/comments_discussion.html +165 -0
- package/templates/components/comments_solution.html +171 -0
- package/templates/components/contest.html +12 -0
- package/templates/components/form.html +214 -0
- package/templates/components/home.html +20 -0
- package/templates/components/homework.html +8 -0
- package/templates/components/md_hint.html +39 -0
- package/templates/components/noscript_note.html +15 -0
- package/templates/components/nothing.html +6 -0
- package/templates/components/paginator.html +25 -0
- package/templates/components/problem.html +33 -0
- package/templates/components/record.html +21 -0
- package/templates/components/sidemenu.html +11 -0
- package/templates/components/user.html +49 -0
- package/templates/contest_balloon.html +48 -0
- package/templates/contest_clarification.html +103 -0
- package/templates/contest_detail.html +56 -0
- package/templates/contest_edit.html +259 -0
- package/templates/contest_main.html +146 -0
- package/templates/contest_manage.html +80 -0
- package/templates/contest_print.html +27 -0
- package/templates/contest_problemlist.html +231 -0
- package/templates/contest_scoreboard.html +46 -0
- package/templates/contest_scoreboard_download_html.html +71 -0
- package/templates/contest_user.html +47 -0
- package/templates/discussion_create.html +28 -0
- package/templates/discussion_detail.html +149 -0
- package/templates/discussion_edit.html +30 -0
- package/templates/discussion_main_or_node.html +47 -0
- package/templates/domain_base.html +26 -0
- package/templates/domain_create.html +55 -0
- package/templates/domain_dashboard.html +45 -0
- package/templates/domain_edit.html +6 -0
- package/templates/domain_group.html +51 -0
- package/templates/domain_join.html +47 -0
- package/templates/domain_join_applications.html +67 -0
- package/templates/domain_permission.html +66 -0
- package/templates/domain_role.html +71 -0
- package/templates/domain_user.html +86 -0
- package/templates/domain_user_raw.html +5 -0
- package/templates/error.html +25 -0
- package/templates/home_domain.html +64 -0
- package/templates/home_files.html +16 -0
- package/templates/home_messages.html +9 -0
- package/templates/home_security.html +224 -0
- package/templates/home_settings.html +21 -0
- package/templates/homework_detail.html +82 -0
- package/templates/homework_edit.html +138 -0
- package/templates/homework_files.html +24 -0
- package/templates/homework_main.html +76 -0
- package/templates/layout/basic.html +27 -0
- package/templates/layout/home_base.html +13 -0
- package/templates/layout/html5.html +74 -0
- package/templates/layout/immersive.html +22 -0
- package/templates/layout/mail.html +31 -0
- package/templates/layout/simple.html +4 -0
- package/templates/layout/wiki_base.html +16 -0
- package/templates/main.html +22 -0
- package/templates/manage_base.html +24 -0
- package/templates/manage_config.html +6 -0
- package/templates/manage_dashboard.html +27 -0
- package/templates/manage_script.html +56 -0
- package/templates/manage_setting.html +6 -0
- package/templates/manage_user_import.html +23 -0
- package/templates/manage_user_priv.html +76 -0
- package/templates/partials/category.html +19 -0
- package/templates/partials/contest.html +3 -0
- package/templates/partials/contest_balloon.html +37 -0
- package/templates/partials/contest_sidebar.html +150 -0
- package/templates/partials/contest_sidebar_management.html +56 -0
- package/templates/partials/contest_user.html +19 -0
- package/templates/partials/discussion_edit_form.html +45 -0
- package/templates/partials/discussion_list.html +50 -0
- package/templates/partials/discussion_nodes_widget.html +17 -0
- package/templates/partials/files.html +49 -0
- package/templates/partials/footer.html +108 -0
- package/templates/partials/hamburger.html +7 -0
- package/templates/partials/header_mobile.html +12 -0
- package/templates/partials/homepage/bulletin.html +7 -0
- package/templates/partials/homepage/contest.html +48 -0
- package/templates/partials/homepage/discussion.html +13 -0
- package/templates/partials/homepage/discussion_nodes.html +4 -0
- package/templates/partials/homepage/error.html +5 -0
- package/templates/partials/homepage/hitokoto.html +6 -0
- package/templates/partials/homepage/homework.html +45 -0
- package/templates/partials/homepage/problem_search.html +13 -0
- package/templates/partials/homepage/ranking.html +39 -0
- package/templates/partials/homepage/recent_problems.html +17 -0
- package/templates/partials/homepage/starred_problems.html +15 -0
- package/templates/partials/homepage/suggestion.html +34 -0
- package/templates/partials/homepage/training.html +50 -0
- package/templates/partials/homework.html +3 -0
- package/templates/partials/homework_default_penalty_rules.yaml +6 -0
- package/templates/partials/homework_sidebar.html +93 -0
- package/templates/partials/login_dialog.html +56 -0
- package/templates/partials/manage_user_priv.html +78 -0
- package/templates/partials/nav.html +138 -0
- package/templates/partials/problem-sidebar-information.html +25 -0
- package/templates/partials/problem.html +2 -0
- package/templates/partials/problem_category_dialog.html +43 -0
- package/templates/partials/problem_default.md +26 -0
- package/templates/partials/problem_description.html +33 -0
- package/templates/partials/problem_files.html +63 -0
- package/templates/partials/problem_list.html +68 -0
- package/templates/partials/problem_lucky.html +10 -0
- package/templates/partials/problem_sidebar.html +14 -0
- package/templates/partials/problem_sidebar_contest.html +43 -0
- package/templates/partials/problem_sidebar_homework.html +42 -0
- package/templates/partials/problem_sidebar_normal.html +152 -0
- package/templates/partials/problem_stat.html +3 -0
- package/templates/partials/scoreboard.html +79 -0
- package/templates/partials/setting.html +92 -0
- package/templates/partials/training_default.json +14 -0
- package/templates/partials/training_detail.html +153 -0
- package/templates/partials/user.html +2 -0
- package/templates/partials/user_detail/activity.html +18 -0
- package/templates/partials/user_detail/solution.html +29 -0
- package/templates/problem_config.html +39 -0
- package/templates/problem_detail.html +150 -0
- package/templates/problem_edit.html +111 -0
- package/templates/problem_files.html +91 -0
- package/templates/problem_hack.html +41 -0
- package/templates/problem_import.html +58 -0
- package/templates/problem_main.html +100 -0
- package/templates/problem_solution.html +55 -0
- package/templates/problem_statistics.html +96 -0
- package/templates/problem_submit.html +40 -0
- package/templates/ranking.html +81 -0
- package/templates/record_detail.html +134 -0
- package/templates/record_detail_status.html +93 -0
- package/templates/record_detail_summary.html +19 -0
- package/templates/record_main.html +142 -0
- package/templates/record_main_tr.html +35 -0
- package/templates/status.html +75 -0
- package/templates/training_detail.html +120 -0
- package/templates/training_edit.html +68 -0
- package/templates/training_files.html +64 -0
- package/templates/training_main.html +107 -0
- package/templates/user_changemail_mail.html +6 -0
- package/templates/user_changemail_mail_sent.html +9 -0
- package/templates/user_delete_pending.html +10 -0
- package/templates/user_detail.html +181 -0
- package/templates/user_login.html +46 -0
- package/templates/user_logout.html +13 -0
- package/templates/user_lostpass.html +27 -0
- package/templates/user_lostpass_mail.html +6 -0
- package/templates/user_lostpass_mail_sent.html +9 -0
- package/templates/user_lostpass_with_code.html +29 -0
- package/templates/user_register.html +22 -0
- package/templates/user_register_mail.html +6 -0
- package/templates/user_register_mail_sent.html +9 -0
- package/templates/user_register_with_code.html +35 -0
- package/templates/user_sudo.html +54 -0
- package/templates/user_sudo_redirect.html +18 -0
- package/templates/wiki_help.html +189 -0
- package/theme/bp6-compat.css +48 -0
- package/theme/dark.styl +397 -0
- package/theme/default.js +33 -0
- package/typed.d.ts +20 -0
- package/utils/base.ts +209 -0
- package/utils/base64.js +104 -0
- package/utils/db.ts +32 -0
- package/utils/index.ts +73 -0
- package/utils/loadReactRedux.ts +32 -0
- package/utils/mediaQuery.ts +13 -0
- package/utils/pjax.js +148 -0
- package/utils/slide.ts +57 -0
package/theme/dark.styl
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
$content-color = #eee
|
|
2
|
+
$content-second-color = #bdbdbd
|
|
3
|
+
|
|
4
|
+
$accent-color = #55b6e2
|
|
5
|
+
|
|
6
|
+
$main-background-color = #121212
|
|
7
|
+
$second-background-color = #323334
|
|
8
|
+
$hover-background-color = #424242
|
|
9
|
+
|
|
10
|
+
.theme--dark
|
|
11
|
+
html
|
|
12
|
+
color-scheme: dark
|
|
13
|
+
|
|
14
|
+
body
|
|
15
|
+
color: $content-color
|
|
16
|
+
background-color: $main-background-color
|
|
17
|
+
|
|
18
|
+
#panel
|
|
19
|
+
background-color: $main-background-color
|
|
20
|
+
|
|
21
|
+
.nav
|
|
22
|
+
background-color: $second-background-color
|
|
23
|
+
|
|
24
|
+
.nav .nav__item:hover
|
|
25
|
+
background-color: $hover-background-color
|
|
26
|
+
|
|
27
|
+
.nav .nav__item
|
|
28
|
+
color: $content-color
|
|
29
|
+
|
|
30
|
+
.section
|
|
31
|
+
background-color: $second-background-color
|
|
32
|
+
box-shadow: none
|
|
33
|
+
|
|
34
|
+
.footer
|
|
35
|
+
background-color: $second-background-color
|
|
36
|
+
color: $content-color
|
|
37
|
+
|
|
38
|
+
h1, h2, h3, h4, h5, h6
|
|
39
|
+
color: $content-color
|
|
40
|
+
|
|
41
|
+
a, .link, a:visited, .link:visited, a:hover, .link:hover, a:active, .link:active
|
|
42
|
+
color: $content-second-color
|
|
43
|
+
|
|
44
|
+
.typo a:not(.user-profile-name):not(.media-link), .typo .link:not(.user-profile-name):not(.media-link), .typo-a:not(.user-profile-name):not(.media-link), .typo a:visited:not(.user-profile-name):not(.media-link), .typo .link:visited:not(.user-profile-name):not(.media-link), .typo-a:visited:not(.user-profile-name):not(.media-link), .typo a:active:not(.user-profile-name):not(.media-link), .typo .link:active:not(.user-profile-name):not(.media-link), .typo-a:active:not(.user-profile-name):not(.media-link), .typo a:hover:not(.user-profile-name):not(.media-link), .typo .link:hover:not(.user-profile-name):not(.media-link), .typo-a:hover:not(.user-profile-name):not(.media-link)
|
|
45
|
+
color: $accent-color
|
|
46
|
+
|
|
47
|
+
.section__title
|
|
48
|
+
color: $content-second-color
|
|
49
|
+
|
|
50
|
+
.dropdown .menu
|
|
51
|
+
box-shadow: 0 0.125rem 0.4375rem #3d3d3d
|
|
52
|
+
background-color: rgb(15, 15, 15)
|
|
53
|
+
|
|
54
|
+
a.menu__link:not(.disabled):hover, button.menu__link:not(.disabled):hover
|
|
55
|
+
color: #aaa
|
|
56
|
+
background-color: rgb(27, 27, 27)
|
|
57
|
+
|
|
58
|
+
blockquote, blockquote.blue, blockquote.red, blockquote.yellow, blockquote.warn, blockquote.note
|
|
59
|
+
background-color: rgb(23, 23, 23)
|
|
60
|
+
color: #999
|
|
61
|
+
|
|
62
|
+
blockquote
|
|
63
|
+
border-left-color: #323232
|
|
64
|
+
|
|
65
|
+
a.menu__link.active, button.menu__link.active, a.menu__link.active:hover, button.menu__link.active:hover
|
|
66
|
+
background-color: #ed5f82
|
|
67
|
+
color: #fff
|
|
68
|
+
|
|
69
|
+
.menu__seperator
|
|
70
|
+
border-top-color: #212121
|
|
71
|
+
|
|
72
|
+
.menu__link
|
|
73
|
+
color: #aaa
|
|
74
|
+
|
|
75
|
+
.button:not(.codicon)
|
|
76
|
+
background-color: #212121
|
|
77
|
+
border: 1px solid #323232
|
|
78
|
+
|
|
79
|
+
.button:not(.codicon),.button:not(.codicon):visited,.button:not(.codicon):hover,.typo .button:not(.codicon),.typo .button:not(.codicon):visited,.typo .button:not(.codicon):hover
|
|
80
|
+
color: #aaa
|
|
81
|
+
|
|
82
|
+
.button:not(.codicon):not(.disabled):hover,.button:not(.codicon):not(.disabled):focus
|
|
83
|
+
background-color: #3d3d3d
|
|
84
|
+
border-color: #3d3d3d
|
|
85
|
+
box-shadow: 0 4px 15px rgba(56,56,56,.5)
|
|
86
|
+
|
|
87
|
+
.dialog
|
|
88
|
+
background-color: rgba(31, 31, 31, 0.6)
|
|
89
|
+
|
|
90
|
+
.dialog.withBg .dialog__content
|
|
91
|
+
background-color: #1f1f1f
|
|
92
|
+
border: 1px solid #323232
|
|
93
|
+
box-shadow: 0 0.125rem 0.625rem rgba(255 255 255 20%)
|
|
94
|
+
|
|
95
|
+
.section__table-header
|
|
96
|
+
background-color: rgba(0, 0, 0, 0.95)
|
|
97
|
+
box-shadow: 0 0.1875rem 0.125rem rgba(255 255 255 3%)
|
|
98
|
+
|
|
99
|
+
.data-table tr
|
|
100
|
+
border-top: 1px solid #2b2b2b
|
|
101
|
+
border-bottom: 1px solid #2b2b2b
|
|
102
|
+
|
|
103
|
+
.checkbox input
|
|
104
|
+
border-color: #3f3f3f
|
|
105
|
+
|
|
106
|
+
.data-table tr:nth-child(even)
|
|
107
|
+
background-color: #1b1b1b
|
|
108
|
+
|
|
109
|
+
.col--ac-tried, .col--ac-tried
|
|
110
|
+
border-left-color: #2b2b2b
|
|
111
|
+
|
|
112
|
+
.col--status, .col--submit-by, .col--lang, .col--case
|
|
113
|
+
border-right-color: #2b2b2b
|
|
114
|
+
|
|
115
|
+
.col--role
|
|
116
|
+
border-left: 1px solid #2b2b2b
|
|
117
|
+
border-left-color: rgb(43, 43, 43)
|
|
118
|
+
|
|
119
|
+
.sidebar-user-profile .user-profile-name
|
|
120
|
+
color: #bbb
|
|
121
|
+
|
|
122
|
+
.section__tab-header-item:hover
|
|
123
|
+
background-color: #171717
|
|
124
|
+
|
|
125
|
+
.sessionlist__item
|
|
126
|
+
border-bottom-color: #323232
|
|
127
|
+
|
|
128
|
+
.pager.pager-top
|
|
129
|
+
border-bottom-color: #2b2b2b
|
|
130
|
+
.pager__item
|
|
131
|
+
border-bottom-color: #2b2b2b
|
|
132
|
+
|
|
133
|
+
.pager.pager-bottom
|
|
134
|
+
border-top-color: #2b2b2b
|
|
135
|
+
.pager__item
|
|
136
|
+
border-top-color: #2b2b2b
|
|
137
|
+
|
|
138
|
+
input
|
|
139
|
+
background-color: #1f1f1f
|
|
140
|
+
|
|
141
|
+
.search>input
|
|
142
|
+
border-color: #434343
|
|
143
|
+
border-top-color: rgb(67, 67, 67)
|
|
144
|
+
border-bottom-color: rgb(67, 67, 67)
|
|
145
|
+
border-left-color: rgb(67, 67, 67)
|
|
146
|
+
color: #fff
|
|
147
|
+
|
|
148
|
+
.select
|
|
149
|
+
border: 1px solid #323232
|
|
150
|
+
background-color: #1f1f1f
|
|
151
|
+
|
|
152
|
+
.select:focus
|
|
153
|
+
border-color: #2960a0
|
|
154
|
+
outline-color: #102f4e
|
|
155
|
+
|
|
156
|
+
input.textbox, textarea.textbox, span.textbox
|
|
157
|
+
border: 1px solid #323232
|
|
158
|
+
background-color: #1f1f1f
|
|
159
|
+
|
|
160
|
+
.autocomplete-wrapper input
|
|
161
|
+
background-color: #1f1f1f
|
|
162
|
+
color: rgba(255,255,255,.85)
|
|
163
|
+
|
|
164
|
+
.autocomplete-wrapper
|
|
165
|
+
border-color: #363636
|
|
166
|
+
background-color: #1f1f1f
|
|
167
|
+
|
|
168
|
+
label:not(.quick-input-list-label)
|
|
169
|
+
color: #999
|
|
170
|
+
|
|
171
|
+
.scratchpad-container
|
|
172
|
+
background-color: #1f1f1f
|
|
173
|
+
|
|
174
|
+
.toolbar
|
|
175
|
+
background-color: rgba(23, 23, 23, 0.8)
|
|
176
|
+
|
|
177
|
+
pre[class*=language-]
|
|
178
|
+
border: 1px solid #323232
|
|
179
|
+
background-color: #1f1f1f
|
|
180
|
+
|
|
181
|
+
code[class*=language-], pre[class*=language-]
|
|
182
|
+
color: #cbc5c6
|
|
183
|
+
|
|
184
|
+
pre[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,code[class*=language-] ::-moz-selection
|
|
185
|
+
background-color: #ADD6FF26
|
|
186
|
+
|
|
187
|
+
pre[class*=language-]::selection,pre[class*=language-] ::selection,code[class*=language-]::selection,code[class*=language-] ::selection
|
|
188
|
+
background-color: #ADD6FF26
|
|
189
|
+
|
|
190
|
+
:not(pre)>code[class*=language-]
|
|
191
|
+
background-color: #171717
|
|
192
|
+
border: 1px solid #323232
|
|
193
|
+
|
|
194
|
+
.scratchpad__data-input
|
|
195
|
+
border-left-color: #2f2f2f
|
|
196
|
+
background-color: #171717
|
|
197
|
+
color: #999
|
|
198
|
+
|
|
199
|
+
pre, code
|
|
200
|
+
background-color: #171717
|
|
201
|
+
|
|
202
|
+
.scratchpad__toolbar
|
|
203
|
+
background-color: #18191d
|
|
204
|
+
|
|
205
|
+
.scratchpad__toolbar__button.enabled:hover
|
|
206
|
+
color: #8a94a5
|
|
207
|
+
background-color: #27282c
|
|
208
|
+
|
|
209
|
+
.scratchpad__toolbar__split
|
|
210
|
+
background-color: #313131
|
|
211
|
+
|
|
212
|
+
.menu__link.highlight
|
|
213
|
+
background: rgb(40, 11, 20)
|
|
214
|
+
|
|
215
|
+
.typo table thead th
|
|
216
|
+
background: #1e1e1e
|
|
217
|
+
background-color: rgb(30, 30, 30)
|
|
218
|
+
|
|
219
|
+
.typo table th, .typo table td, .typo table caption
|
|
220
|
+
border-color: #666
|
|
221
|
+
color: #999
|
|
222
|
+
|
|
223
|
+
body>.marker
|
|
224
|
+
box-shadow: 0 2px 7px rgba(255 255 255 30%)
|
|
225
|
+
background-color: #1f1f1f
|
|
226
|
+
border-color: #555
|
|
227
|
+
|
|
228
|
+
body>.marker .marker__toolbar
|
|
229
|
+
background-color: #18191d
|
|
230
|
+
|
|
231
|
+
.messagepad__sidebar
|
|
232
|
+
border-right-color: #212121
|
|
233
|
+
|
|
234
|
+
.messagepad__list-item:hover
|
|
235
|
+
border-color: #323232
|
|
236
|
+
background-color: #1b1b1b
|
|
237
|
+
|
|
238
|
+
.messagepad__list-item.active
|
|
239
|
+
border-color: #ed5f82
|
|
240
|
+
background-color: rgba(237,95,130,.07)
|
|
241
|
+
|
|
242
|
+
.messagepad__input
|
|
243
|
+
border-top-color: #212121
|
|
244
|
+
|
|
245
|
+
.section__tab-container.immersive .section__tab-header-item.selected
|
|
246
|
+
background-color: rgb(15, 15, 15)
|
|
247
|
+
color: #999
|
|
248
|
+
box-shadow: 0 0 10px rgba(255 255 255 30%)
|
|
249
|
+
|
|
250
|
+
.dialog--signin__main
|
|
251
|
+
background-color: #1f1f1f
|
|
252
|
+
box-shadow: 0 0 30px rgba(255 255 255 60%)
|
|
253
|
+
|
|
254
|
+
.nothing-icon
|
|
255
|
+
filter: brightness(50%)
|
|
256
|
+
|
|
257
|
+
.scratchpad__data-input:focus
|
|
258
|
+
background: #1f1f1f
|
|
259
|
+
border-color: #1c2d40
|
|
260
|
+
|
|
261
|
+
.section__list__item
|
|
262
|
+
border-bottom-color: #2b2b2b
|
|
263
|
+
|
|
264
|
+
.autocomplete-list
|
|
265
|
+
background-color: #1f1f1f
|
|
266
|
+
li[aria-selected=true]
|
|
267
|
+
background-color: #151515
|
|
268
|
+
li[data-focus=true]
|
|
269
|
+
background-color: #101829
|
|
270
|
+
cursor: pointer
|
|
271
|
+
|
|
272
|
+
.dczcomments__item, .dczcomments__reply
|
|
273
|
+
border-top-color: #2b2b2b
|
|
274
|
+
|
|
275
|
+
.autocomplete-tag
|
|
276
|
+
background-color: #ff0000
|
|
277
|
+
|
|
278
|
+
.problem__tag-link
|
|
279
|
+
background-color: #1f1f1f
|
|
280
|
+
color: #aaa!important
|
|
281
|
+
|
|
282
|
+
label.textbox.material input
|
|
283
|
+
border-color: #333
|
|
284
|
+
color: #aaa
|
|
285
|
+
border-bottom-color: rgba(170,170,170,.4)
|
|
286
|
+
|
|
287
|
+
.widget--category-filter__drop
|
|
288
|
+
background-color: #1f1f1f
|
|
289
|
+
box-shadow: 0 0.125rem 0.4375rem rgba(255 255 255 30%)
|
|
290
|
+
|
|
291
|
+
hr
|
|
292
|
+
border-bottom-color: #404040
|
|
293
|
+
|
|
294
|
+
.section__footer
|
|
295
|
+
border-top-color: #2b2b2b
|
|
296
|
+
|
|
297
|
+
.data-table thead>tr
|
|
298
|
+
border-bottom-color: #2b2b2b
|
|
299
|
+
|
|
300
|
+
blockquote.note
|
|
301
|
+
border-left-color: #29679e
|
|
302
|
+
&:before
|
|
303
|
+
color: #29679e
|
|
304
|
+
|
|
305
|
+
blockquote.warn
|
|
306
|
+
border-left-color: #a80800
|
|
307
|
+
&:before
|
|
308
|
+
color: #a80800
|
|
309
|
+
|
|
310
|
+
blockquote.red
|
|
311
|
+
border-left-color: #a80800
|
|
312
|
+
|
|
313
|
+
blockquote.yellow
|
|
314
|
+
border-left-color: #8f7c00
|
|
315
|
+
|
|
316
|
+
blockquote.blue
|
|
317
|
+
border-left-color: #00396b
|
|
318
|
+
|
|
319
|
+
.token.comment,.token.prolog,.token.doctype,.token.cdata
|
|
320
|
+
color: #57A64A
|
|
321
|
+
font-style: italic
|
|
322
|
+
|
|
323
|
+
.token.namespace
|
|
324
|
+
opacity: .7
|
|
325
|
+
|
|
326
|
+
.token.string
|
|
327
|
+
color: #D69D85
|
|
328
|
+
|
|
329
|
+
.token.punctuation,.token.operator
|
|
330
|
+
color: #B4B4B4
|
|
331
|
+
|
|
332
|
+
.token.url,.token.symbol,.token.number,.token.boolean,.token.variable,.token.constant,.token.inserted
|
|
333
|
+
color: #B5CEA8
|
|
334
|
+
|
|
335
|
+
.token.atrule,.token.keyword,.token.attr-value,.language-autohotkey .token.selector,.language-json .token.boolean,.language-json .token.number,code[class*=language-css]
|
|
336
|
+
color: #569cd6
|
|
337
|
+
|
|
338
|
+
.token.function
|
|
339
|
+
color: #C8C8C8
|
|
340
|
+
|
|
341
|
+
.token.deleted,.language-autohotkey .token.tag
|
|
342
|
+
color: #9a050f
|
|
343
|
+
|
|
344
|
+
.token.selector,.language-autohotkey .token.keyword
|
|
345
|
+
color: #00009f
|
|
346
|
+
|
|
347
|
+
.token.important
|
|
348
|
+
color: #e90
|
|
349
|
+
|
|
350
|
+
.token.important,.token.bold
|
|
351
|
+
font-weight: 700
|
|
352
|
+
|
|
353
|
+
.token.italic
|
|
354
|
+
font-style: italic
|
|
355
|
+
|
|
356
|
+
.token.class-name,.language-json .token.property
|
|
357
|
+
color: #4EC9B0
|
|
358
|
+
|
|
359
|
+
.token.tag,.token.selector
|
|
360
|
+
color: #d7ba7d
|
|
361
|
+
|
|
362
|
+
.token.attr-name,.token.property,.token.regex,.token.entity
|
|
363
|
+
color: #d16969
|
|
364
|
+
|
|
365
|
+
.token.directive.tag .tag
|
|
366
|
+
background: #ffff00
|
|
367
|
+
color: #393a34
|
|
368
|
+
|
|
369
|
+
@media only screen and (max-width: 600px) {
|
|
370
|
+
.footer__category {
|
|
371
|
+
border-bottom-color: #1d1d1d
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.omnibar-toggle
|
|
376
|
+
background-color: $main-background-color
|
|
377
|
+
color: $content-color
|
|
378
|
+
|
|
379
|
+
.omnibar-main
|
|
380
|
+
color: $content-color
|
|
381
|
+
|
|
382
|
+
input
|
|
383
|
+
background-color: $main-background-color !important
|
|
384
|
+
border-color: #3d3d3d !important
|
|
385
|
+
|
|
386
|
+
.omnibar-content-section
|
|
387
|
+
background-color: $main-background-color !important
|
|
388
|
+
border-color: #3d3d3d !important
|
|
389
|
+
|
|
390
|
+
&.hasjs .collapsed #status:not([data-status="7"]) .compiler-text-mask
|
|
391
|
+
background-image: linear-gradient(to bottom, transparent, #000000 25px)
|
|
392
|
+
|
|
393
|
+
&.page--record_detail .subtask
|
|
394
|
+
background-color: #000 !important
|
|
395
|
+
|
|
396
|
+
&.page--contest_scoreboard .star-highlight
|
|
397
|
+
background: #6f757b
|
package/theme/default.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import 'normalize.css/normalize.css';
|
|
2
|
+
import 'allotment/dist/style.css';
|
|
3
|
+
import 'katex/dist/katex.min.css';
|
|
4
|
+
import '@mantine/core/styles.css';
|
|
5
|
+
import '@mantine/notifications/styles.css';
|
|
6
|
+
import 'mantine-contextmenu/styles.css';
|
|
7
|
+
import '@fontsource/fira-code';
|
|
8
|
+
import '@fontsource/source-code-pro';
|
|
9
|
+
import '@fontsource/roboto-mono';
|
|
10
|
+
import '@fontsource/inconsolata';
|
|
11
|
+
import '@fontsource/ubuntu-mono';
|
|
12
|
+
import '@fontsource/pt-mono';
|
|
13
|
+
import '@fontsource/dm-mono';
|
|
14
|
+
import '@fontsource/jetbrains-mono';
|
|
15
|
+
import 'vj/misc/float.styl';
|
|
16
|
+
import 'vj/misc/typography.styl';
|
|
17
|
+
import 'vj/misc/textalign.styl';
|
|
18
|
+
import 'vj/misc/grid.styl';
|
|
19
|
+
import 'vj/misc/slideout.styl';
|
|
20
|
+
import 'vj/misc/.iconfont/webicon.styl';
|
|
21
|
+
import 'vj/misc/immersive.styl';
|
|
22
|
+
import 'vj/misc/structure.styl';
|
|
23
|
+
import 'vj/misc/section.styl';
|
|
24
|
+
import 'vj/misc/nothing.styl';
|
|
25
|
+
import 'vj/components/editor/cmeditor.styl';
|
|
26
|
+
import './dark.styl';
|
|
27
|
+
import './bp6-compat.css';
|
|
28
|
+
|
|
29
|
+
// load all page stylesheets
|
|
30
|
+
const pageStyleReq = require.context('../', true, /\.page\.styl$/i);
|
|
31
|
+
pageStyleReq.keys().map((key) => pageStyleReq(key));
|
|
32
|
+
const pageStyleReqDefault = require.context('../', true, /\.page\.default\.styl$/i);
|
|
33
|
+
pageStyleReqDefault.keys().map((key) => pageStyleReqDefault(key));
|
package/typed.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare module '*.svg?react' {
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
const content: ComponentType;
|
|
4
|
+
export default content;
|
|
5
|
+
}
|
|
6
|
+
declare module '*.vue' {
|
|
7
|
+
export default {} as any;
|
|
8
|
+
}
|
|
9
|
+
declare module '*.css' {
|
|
10
|
+
const content: string;
|
|
11
|
+
export default content;
|
|
12
|
+
}
|
|
13
|
+
declare module '*.styl' {
|
|
14
|
+
const content: string;
|
|
15
|
+
export default content;
|
|
16
|
+
}
|
|
17
|
+
declare module '*.scss' {
|
|
18
|
+
const content: string;
|
|
19
|
+
export default content;
|
|
20
|
+
}
|
package/utils/base.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import ReactDOM from 'react-dom/client';
|
|
5
|
+
import DOMServer from 'react-dom/server';
|
|
6
|
+
|
|
7
|
+
export function substitute(str: string, obj: any) {
|
|
8
|
+
return str.replace(/\{([^{}]+)\}/g, (match, key) => {
|
|
9
|
+
if (obj[key] !== undefined && obj[key] !== null) return obj[key].toString();
|
|
10
|
+
return `{${key}}`;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function i18n(str: string, ...params: any[]) {
|
|
15
|
+
if (!str) return '';
|
|
16
|
+
return substitute((window as any).LOCALES?.[str] || str, params);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function delay(ms) {
|
|
20
|
+
return new Promise((resolve) => { setTimeout(resolve, ms); });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const defaultDict = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
|
|
24
|
+
|
|
25
|
+
export function secureRandomString(digit = 32, dict = defaultDict) {
|
|
26
|
+
let result = '';
|
|
27
|
+
const crypto = window.crypto || (window as any).msCrypto;
|
|
28
|
+
if (!crypto?.getRandomValues) throw new Error('crypto.getRandomValues not supported');
|
|
29
|
+
const array = new Uint32Array(digit);
|
|
30
|
+
crypto.getRandomValues(array);
|
|
31
|
+
for (let i = 0; i < digit; i++) result += dict[array[i] % dict.length];
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Substitution = string | number | { templateRaw: true, html: string };
|
|
36
|
+
|
|
37
|
+
export function tpl<T extends boolean = false>(node: React.ReactNode, reactive?: T): T extends true ? HTMLDivElement : string;
|
|
38
|
+
export function tpl(pieces: TemplateStringsArray, ...substitutions: Substitution[]): string;
|
|
39
|
+
export function tpl(pieces: TemplateStringsArray | React.ReactNode, ...substitutions: Substitution[] | boolean[]) {
|
|
40
|
+
if (React.isValidElement(pieces)) {
|
|
41
|
+
if (substitutions[0]) {
|
|
42
|
+
const div = document.createElement('div');
|
|
43
|
+
ReactDOM.createRoot(div).render(pieces);
|
|
44
|
+
return div;
|
|
45
|
+
}
|
|
46
|
+
return DOMServer.renderToStaticMarkup(pieces);
|
|
47
|
+
}
|
|
48
|
+
let result = pieces[0];
|
|
49
|
+
for (let i = 0; i < substitutions.length; ++i) {
|
|
50
|
+
const subst = substitutions[i];
|
|
51
|
+
let substHtml: string;
|
|
52
|
+
if (subst && typeof subst === 'object' && subst.templateRaw) {
|
|
53
|
+
substHtml = subst.html;
|
|
54
|
+
} else substHtml = _.escape(String(subst));
|
|
55
|
+
result += substHtml + pieces[i + 1];
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
tpl.typoMsg = function (msg: string, raw = false) {
|
|
61
|
+
if (raw) return `<div class="typo"><p>${msg}</p></div>`;
|
|
62
|
+
const lines = msg.trim().split('\n');
|
|
63
|
+
return `<div class="typo">${lines.map((i) => `<p>${_.escape(i)}</p>`).join('\n')}</div>`;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function rawHtml(html: string) {
|
|
67
|
+
return {
|
|
68
|
+
templateRaw: true,
|
|
69
|
+
html,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let zIndexCurrent = 1000;
|
|
74
|
+
|
|
75
|
+
export const zIndexManager = {
|
|
76
|
+
getCurrent() {
|
|
77
|
+
return zIndexCurrent;
|
|
78
|
+
},
|
|
79
|
+
getNext() {
|
|
80
|
+
return ++zIndexCurrent;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export function addSpeculationRules(rules) {
|
|
85
|
+
if (HTMLScriptElement.supports?.('speculationrules')) {
|
|
86
|
+
const specScript = document.createElement('script');
|
|
87
|
+
specScript.type = 'speculationrules';
|
|
88
|
+
specScript.textContent = JSON.stringify(rules);
|
|
89
|
+
document.body.append(specScript);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const request = {
|
|
94
|
+
ajax(options: Record<string, any>) {
|
|
95
|
+
const stack = new Error().stack;
|
|
96
|
+
return new Promise<any>((resolve, reject) => {
|
|
97
|
+
$
|
|
98
|
+
.ajax({
|
|
99
|
+
dataType: 'json',
|
|
100
|
+
headers: {
|
|
101
|
+
Accept: 'application/json',
|
|
102
|
+
},
|
|
103
|
+
...options,
|
|
104
|
+
})
|
|
105
|
+
.fail((jqXHR, textStatus, errorThrown: any) => {
|
|
106
|
+
if (textStatus === 'abort') {
|
|
107
|
+
const err = new Error(i18n('Aborted')) as any;
|
|
108
|
+
err.aborted = true;
|
|
109
|
+
err.isUserFacingError = true;
|
|
110
|
+
reject(err);
|
|
111
|
+
} else if (jqXHR.readyState === 0) {
|
|
112
|
+
const err = new Error(i18n('Network error')) as any;
|
|
113
|
+
err.isUserFacingError = true;
|
|
114
|
+
reject(err);
|
|
115
|
+
} else if (typeof jqXHR.responseJSON === 'object' && jqXHR.responseJSON.error) {
|
|
116
|
+
const { error } = jqXHR.responseJSON;
|
|
117
|
+
if (error.params) {
|
|
118
|
+
const message = i18n(error.message, ...error.params);
|
|
119
|
+
const err = new Error(message === error.message && error.params.length
|
|
120
|
+
? `${error.message}: ${error.params.join(' ')}`
|
|
121
|
+
: message) as any;
|
|
122
|
+
err.rawMessage = error.message;
|
|
123
|
+
err.params = error.params;
|
|
124
|
+
reject(err);
|
|
125
|
+
} else reject(new Error(jqXHR.responseJSON.error.message));
|
|
126
|
+
} else if (errorThrown instanceof Error) {
|
|
127
|
+
reject(errorThrown);
|
|
128
|
+
} else {
|
|
129
|
+
reject(new Error(textStatus));
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
.done(resolve);
|
|
133
|
+
}).catch((e: Error) => {
|
|
134
|
+
e.stack = stack;
|
|
135
|
+
throw e;
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
postFile(url: string, form: FormData, options: any = {}) {
|
|
140
|
+
return this.ajax({
|
|
141
|
+
url,
|
|
142
|
+
data: form,
|
|
143
|
+
processData: false,
|
|
144
|
+
contentType: false,
|
|
145
|
+
type: 'POST',
|
|
146
|
+
dataType: undefined,
|
|
147
|
+
...options,
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
post(url: string, dataOrForm: JQueryStatic | Node | string | Record<string, any> = {}, options: any = {}) {
|
|
152
|
+
let postData;
|
|
153
|
+
// @ts-ignore
|
|
154
|
+
if (dataOrForm instanceof $ && dataOrForm.is('form')) {
|
|
155
|
+
// $form
|
|
156
|
+
postData = (dataOrForm as any).serialize();
|
|
157
|
+
} else if (dataOrForm instanceof Node && $(dataOrForm).is('form')) {
|
|
158
|
+
// form
|
|
159
|
+
postData = $(dataOrForm).serialize();
|
|
160
|
+
} else if (typeof dataOrForm === 'string') {
|
|
161
|
+
// foo=bar&box=boz
|
|
162
|
+
postData = dataOrForm;
|
|
163
|
+
} else {
|
|
164
|
+
// {foo: 'bar'}
|
|
165
|
+
postData = JSON.stringify(dataOrForm);
|
|
166
|
+
options.contentType = 'application/json';
|
|
167
|
+
}
|
|
168
|
+
return request.ajax({
|
|
169
|
+
url,
|
|
170
|
+
method: 'post',
|
|
171
|
+
data: postData,
|
|
172
|
+
...options,
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
get(url: string, qs: Record<string, any> = {}, options: Record<string, any> = {}) {
|
|
177
|
+
return request.ajax({
|
|
178
|
+
url,
|
|
179
|
+
data: qs,
|
|
180
|
+
method: 'get',
|
|
181
|
+
...options,
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
let transition: ViewTransition | null = null;
|
|
187
|
+
|
|
188
|
+
export async function withTransitionCallback(callback: () => (Promise<void> | void)) {
|
|
189
|
+
if (!document.startViewTransition || document.visibilityState === 'hidden') return callback?.();
|
|
190
|
+
transition?.skipTransition?.();
|
|
191
|
+
transition = document.startViewTransition(callback);
|
|
192
|
+
await transition.finished;
|
|
193
|
+
transition = null;
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export async function setTemporaryViewTransitionNames(entries, vtPromise: Promise<void>) {
|
|
198
|
+
for (const [$el, name] of entries) {
|
|
199
|
+
$el.style.viewTransitionName = name;
|
|
200
|
+
}
|
|
201
|
+
await vtPromise;
|
|
202
|
+
for (const [$el] of entries) {
|
|
203
|
+
$el.style.viewTransitionName = '';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function getTheme(): 'dark' | 'light' {
|
|
208
|
+
return ['light', 'dark'].includes(UserContext.theme) ? UserContext.theme : 'light';
|
|
209
|
+
}
|