mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: remove deprecated util global
This commit is contained in:
23 files changed
+9
-80
No files matched your search
@@ -2,6 +2,7 @@
|
||||
export * from './components/dialog';
|
||||
export { default as loadMonaco } from './components/monaco/loader';
|
||||
export { default as Notification } from './components/notification';
|
||||
export { default as selectUser } from './components/selectUser';
|
||||
export { default as Socket } from './components/socket/index';
|
||||
export { default as uploadFiles } from './components/upload';
|
||||
export * from './components/zipDownloader';
|
||||
@@ -16,11 +17,15 @@ export { AnsiUp } from 'ansi_up';
|
||||
export { default as $ } from 'jquery';
|
||||
export { default as _ } from 'lodash';
|
||||
export { default as React } from 'react';
|
||||
export { default as ReactDOM } from 'react-dom/client';
|
||||
export * as redux from 'react-redux';
|
||||
export { default as jsxRuntime } from 'react/jsx-runtime';
|
||||
import ReactDOMMain from 'react-dom';
|
||||
import ReactDOMClient from 'react-dom/client';
|
||||
import { load } from './lazyload';
|
||||
|
||||
Object.assign(ReactDOMMain, ReactDOMClient);
|
||||
|
||||
export const ReactDOM = ReactDOMMain as typeof ReactDOMMain & typeof ReactDOMClient;
|
||||
export default load;
|
||||
export interface EventMap { }
|
||||
|
||||
@@ -51,19 +56,5 @@ declare global {
|
||||
|
||||
// Below are old version api compat
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import * as redux from 'react-redux';
|
||||
|
||||
const modules = {
|
||||
_, $, React, redux, ReactDOM,
|
||||
};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
node_modules: typeof modules;
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(window, { node_modules: modules, $, jQuery: $ });
|
||||
Object.assign(window, { $, jQuery: $ });
|
||||
@@ -20,5 +20,3 @@ export default class AssignSelectAutoComplete<Multi extends boolean> extends Aut
|
||||
return this.ref?.getSelectedItemKeys().join(',') ?? this.$dom.val();
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.AssignSelectAutoComplete = AssignSelectAutoComplete;
|
||||
@@ -21,5 +21,3 @@ export default class CustomSelectAutoComplete<Multi extends boolean> extends Aut
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.CustomSelectAutoComplete = CustomSelectAutoComplete;
|
||||
@@ -16,5 +16,3 @@ export default class DomainSelectAutoComplete<Multi extends boolean> extends Aut
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.DomainSelectAutoComplete = DomainSelectAutoComplete;
|
||||
@@ -24,5 +24,3 @@ export default class FileSelectAutoComplete<Multi extends boolean> extends AutoC
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.FileSelectAutoComplete = FileSelectAutoComplete;
|
||||
@@ -22,5 +22,3 @@ export default class LanguageSelectAutoComplete<Multi extends boolean> extends A
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.LanguageSelectAutoComplete = LanguageSelectAutoComplete;
|
||||
@@ -16,5 +16,3 @@ export default class ProblemSelectAutoComplete extends AutoComplete {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.ProblemSelectAutoComplete = ProblemSelectAutoComplete;
|
||||
@@ -21,5 +21,3 @@ export default class UserSelectAutoComplete<Multi extends boolean> extends AutoC
|
||||
return this.ref?.getSelectedItems()[0] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.UserSelectAutoComplete = UserSelectAutoComplete;
|
||||
@@ -108,5 +108,3 @@ export default class AutoComplete<Options extends Record<string, any> = object,
|
||||
this.ref.focus();
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.autocomplete = AutoComplete;
|
||||
@@ -262,11 +262,3 @@ export async function alert(text: string) {
|
||||
$body: tpl.typoMsg(text),
|
||||
}).open();
|
||||
}
|
||||
|
||||
window.Hydro.components.Dialog = Dialog;
|
||||
window.Hydro.components.InfoDialog = InfoDialog;
|
||||
window.Hydro.components.ActionDialog = ActionDialog;
|
||||
window.Hydro.components.ConfirmDialog = ConfirmDialog;
|
||||
window.Hydro.components.prompt = prompt;
|
||||
window.Hydro.components.confirm = confirm;
|
||||
window.Hydro.components.alert = alert;
|
||||
@@ -94,4 +94,3 @@ export async function load(features = ['markdown']) {
|
||||
}
|
||||
|
||||
export default load;
|
||||
window.Hydro.components.loadMonaco = load;
|
||||
@@ -132,5 +132,3 @@ export default class Notification {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.Notification = Notification;
|
||||
@@ -155,6 +155,3 @@ export async function downloadProblemSet(pids, name = 'Export') {
|
||||
Notification.error(`${e.message} ${e.params?.[0]}`);
|
||||
}
|
||||
}
|
||||
|
||||
window.Hydro.components.downloadProblemSet = downloadProblemSet;
|
||||
window.Hydro.components.download = download;
|
||||
@@ -5,8 +5,6 @@ import $ from 'jquery';
|
||||
window.Hydro = {
|
||||
extraPages: [],
|
||||
components: {},
|
||||
utils: {},
|
||||
node_modules: {},
|
||||
version: process.env.VERSION,
|
||||
};
|
||||
window.externalModules = {};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const lazyModules = {};
|
||||
const features: Record<string, string | (() => Promise<any>)> = {};
|
||||
export default async function load(name: string) {
|
||||
if (window.node_modules[name]) return window.node_modules[name];
|
||||
if (name === 'echarts') return import('echarts');
|
||||
if (name === 'moment') return import('moment');
|
||||
if (!window.lazyloadMetadata?.[`${name}.lazy.js`]) throw new Error(`Module ${name} not found`);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"@types/nunjucks": "^3.2.6",
|
||||
"@types/pickadate": "^3.5.35",
|
||||
"@types/qrcode": "^1.5.6",
|
||||
"@types/react": "^19.2.3",
|
||||
"@types/react": "^19.2.4",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/redux-logger": "^3.0.13",
|
||||
"@types/uuid": "^11.0.0",
|
||||
@@ -130,7 +130,7 @@
|
||||
"esbuild": "0.25.2",
|
||||
"fs-extra": "^11.3.2",
|
||||
"html-to-text": "^9.0.5",
|
||||
"js-yaml": "^4.1.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"jsesc": "^3.1.0",
|
||||
"katex": "^0.16.25",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
@@ -204,16 +204,3 @@ export async function setTemporaryViewTransitionNames(entries, vtPromise: Promis
|
||||
export function getTheme(): 'dark' | 'light' {
|
||||
return ['light', 'dark'].includes(UserContext.theme) ? UserContext.theme : 'light';
|
||||
}
|
||||
|
||||
Object.assign(window.Hydro.utils, {
|
||||
i18n,
|
||||
rawHtml,
|
||||
substitute,
|
||||
secureRandomString,
|
||||
request,
|
||||
tpl,
|
||||
delay,
|
||||
zIndexManager,
|
||||
withTransitionCallback,
|
||||
setTemporaryViewTransitionNames,
|
||||
});
|
||||
@@ -102,4 +102,3 @@ const Base64 = {
|
||||
};
|
||||
|
||||
export default Base64;
|
||||
window.Hydro.utils.base64 = Base64;
|
||||
@@ -71,11 +71,3 @@ export { default as loadReactRedux } from './loadReactRedux';
|
||||
export * as mediaQuery from './mediaQuery';
|
||||
export { default as pjax } from './pjax';
|
||||
export * from './slide';
|
||||
|
||||
const zip = { createZipStream, createZipBlob };
|
||||
Object.assign(window.Hydro.utils, {
|
||||
zip,
|
||||
pipeStream,
|
||||
mongoId,
|
||||
emulateAnchorClick,
|
||||
});
|
||||
@@ -30,5 +30,3 @@ export default async function loadReactRedux<S, A extends Action = UnknownAction
|
||||
store,
|
||||
};
|
||||
}
|
||||
|
||||
window.Hydro.utils.loadReactRedux = loadReactRedux;
|
||||
@@ -11,5 +11,3 @@ export function isBelow(width) {
|
||||
}
|
||||
return window.innerWidth <= width;
|
||||
}
|
||||
|
||||
Object.assign(window.Hydro.utils, { isAbove, isBelow });
|
||||
@@ -146,4 +146,3 @@ function handlePopState(ev) {
|
||||
$(window).on('popstate', handlePopState);
|
||||
|
||||
export default pjax;
|
||||
window.Hydro.utils.pjax = pjax;
|
||||
@@ -55,5 +55,3 @@ export async function slideUp($element, duration, fromCss = {}, toCss = {}) {
|
||||
display: 'none',
|
||||
});
|
||||
}
|
||||
|
||||
window.Hydro.utils.slide = { slideUp, slideDown };
|
||||
Reference in new issue
Block a user