@yongdall/web 0.4.6 → 0.5.0
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/boot.mjs +1 -1
- package/boot.mjs.map +1 -1
- package/index.d.mts +7 -6
- package/index.mjs +14 -14
- package/index.mjs.map +1 -1
- package/package.json +4 -4
- package/yongdall.plugin.yml +1 -0
package/boot.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{application as e,findPluginIdRegex as t,importStyle as n,importWidget as r,start as i}from"@yongdall/web";async function a(){let{theme:a,route:o,authenticator:s,skin:c}=e;async function
|
|
1
|
+
import{application as e,findPluginIdRegex as t,importStyle as n,importWidget as r,start as i}from"@yongdall/web";async function a(){let{theme:a,route:o,authenticator:s,skin:c,type:l}=e;c&&await n(c).catch(()=>null);async function u(){if(!s||typeof s!=`string`)return{};let e=await r(s);if(typeof e==`function`&&(e=await e()),!e)return{};let n=t.exec(s)?.groups?.pluginId;return!n||!e.styleFiles?.length?{...e,styleFiles:[]}:{...e,styleFiles:[...e.styleFiles||[]].map(e=>[e,n])}}if(l===`authenticator`||!a||typeof a!=`string`){i(u);return}async function d(){if(!a||typeof a!=`string`)return{};let e=await r(a);if(typeof e==`function`&&(e=await e()),!e)return{};let n=t.exec(a)?.groups?.pluginId;return!n||!e.styleFiles?.length?{...e,styleFiles:[]}:{...e,styleFiles:[...e.styleFiles||[]].map(e=>[e,n])}}async function f(){return o?r(o):null}i(u,d,f)}a();
|
|
2
2
|
//# sourceMappingURL=boot.mjs.map
|
package/boot.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.mjs","names":[],"sources":["../../packages/web/boot.mjs"],"sourcesContent":["/** @import { Authenticator, Theme } from './typesDefine.mjs' */\nimport { application, start } from '@yongdall/web';\nimport { importWidget, importStyle } from '@yongdall/web';\nimport { findPluginIdRegex } from '@yongdall/web';\n\n/** @typedef {[file: string, plugin: string]} uiStyle */\n\n\n\n\n\nasync function init() {\n\n\n\tconst { theme, route, authenticator, skin } = application;\n\n\t/** @returns {Promise<Partial<Omit<Authenticator, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadAuthenticator() {\n\t\tif (!authenticator || typeof authenticator !== 'string') { return {}; }\n\t\t/** @type {Partial<Authenticator> | (() => Partial<Authenticator> | PromiseLike<Partial<Authenticator>>) | undefined} */\n\t\tlet authenticatorWidget = await importWidget(authenticator);\n\t\tif (typeof authenticatorWidget === 'function') { authenticatorWidget = await authenticatorWidget(); }\n\t\tif (!authenticatorWidget) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(authenticator)?.groups?.pluginId;\n\t\tif (!pluginId || !authenticatorWidget.styleFiles?.length) { return { ...authenticatorWidget, styleFiles: [] }; }\n\t\treturn { ...authenticatorWidget, styleFiles: [...authenticatorWidget.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\t/** @returns {Promise<Partial<Omit<Theme, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadTheme() {\n\t\tif (!theme || typeof theme !== 'string') { return {}; }\n\t\t/** @type {Partial<Theme> | (() => Partial<Theme> | PromiseLike<Partial<Theme>>) | undefined} */\n\t\tlet uis = await importWidget(theme);\n\t\tif (typeof uis === 'function') { uis = await uis(); }\n\t\tif (!uis) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(theme)?.groups?.pluginId;\n\t\tif (!pluginId || !uis.styleFiles?.length) { return { ...uis, styleFiles: [] }; }\n\t\treturn { ...uis, styleFiles: [...uis.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\n\tasync function _loadRoute() {\n\t\tif (!route) { return null; }\n\t\treturn importWidget(route);\n\t}\n\
|
|
1
|
+
{"version":3,"file":"boot.mjs","names":[],"sources":["../../packages/web/boot.mjs"],"sourcesContent":["/** @import { Authenticator, Theme } from './typesDefine.mjs' */\nimport { application, start } from '@yongdall/web';\nimport { importWidget, importStyle } from '@yongdall/web';\nimport { findPluginIdRegex } from '@yongdall/web';\n\n/** @typedef {[file: string, plugin: string]} uiStyle */\n\n\n\n\n\nasync function init() {\n\n\n\tconst { theme, route, authenticator, skin, type } = application;\n\tif (skin) { await importStyle(skin).catch(() => null); }\n\n\t/** @returns {Promise<Partial<Omit<Authenticator, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadAuthenticator() {\n\t\tif (!authenticator || typeof authenticator !== 'string') { return {}; }\n\t\t/** @type {Partial<Authenticator> | (() => Partial<Authenticator> | PromiseLike<Partial<Authenticator>>) | undefined} */\n\t\tlet authenticatorWidget = await importWidget(authenticator);\n\t\tif (typeof authenticatorWidget === 'function') { authenticatorWidget = await authenticatorWidget(); }\n\t\tif (!authenticatorWidget) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(authenticator)?.groups?.pluginId;\n\t\tif (!pluginId || !authenticatorWidget.styleFiles?.length) { return { ...authenticatorWidget, styleFiles: [] }; }\n\t\treturn { ...authenticatorWidget, styleFiles: [...authenticatorWidget.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\tif (type === 'authenticator' || !theme || typeof theme !== 'string') {\n\t\tstart(_loadAuthenticator);\n\t\treturn;\n\t}\n\t/** @returns {Promise<Partial<Omit<Theme, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadTheme() {\n\t\tif (!theme || typeof theme !== 'string') { return {}; }\n\t\t/** @type {Partial<Theme> | (() => Partial<Theme> | PromiseLike<Partial<Theme>>) | undefined} */\n\t\tlet uis = await importWidget(theme);\n\t\tif (typeof uis === 'function') { uis = await uis(); }\n\t\tif (!uis) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(theme)?.groups?.pluginId;\n\t\tif (!pluginId || !uis.styleFiles?.length) { return { ...uis, styleFiles: [] }; }\n\t\treturn { ...uis, styleFiles: [...uis.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\n\tasync function _loadRoute() {\n\t\tif (!route)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AAM,CADL,KAGtB,EAAM,EAAoB,EAAY,EAAW,CAGlD,GAAM"}
|
package/index.d.mts
CHANGED
|
@@ -1502,6 +1502,7 @@ type User = {
|
|
|
1502
1502
|
plugins?: Record<string, Record<string, any>> | undefined;
|
|
1503
1503
|
};
|
|
1504
1504
|
declare namespace User {
|
|
1505
|
+
const visitor: boolean;
|
|
1505
1506
|
const multi: boolean;
|
|
1506
1507
|
const single: boolean;
|
|
1507
1508
|
const session: User | null;
|
|
@@ -1931,7 +1932,7 @@ interface Authenticator {
|
|
|
1931
1932
|
elements: Element | Element[];
|
|
1932
1933
|
/** 添加到根节点上的类名 */
|
|
1933
1934
|
rootClassName: string;
|
|
1934
|
-
login(signal: AbortSignal): PromiseLike<void> | void;
|
|
1935
|
+
login(signal: AbortSignal, onlyAuthenticator: boolean): PromiseLike<void> | void;
|
|
1935
1936
|
}
|
|
1936
1937
|
interface Theme {
|
|
1937
1938
|
title(page: CurrentPage): string;
|
|
@@ -2861,16 +2862,15 @@ declare function buildPlugin(pluginId: string): {
|
|
|
2861
2862
|
/**
|
|
2862
2863
|
*
|
|
2863
2864
|
* @param {typeof loadAuthenticator} _loadAuthenticator
|
|
2864
|
-
* @param {
|
|
2865
|
-
* @param {() => MaybePromise<PageIdent.Router?>} _loadRoute
|
|
2865
|
+
* @param {() => MaybePromise<Partial<WorkbenchTheme>>} [_loadTheme]
|
|
2866
|
+
* @param {() => MaybePromise<PageIdent.Router?>} [_loadRoute]
|
|
2866
2867
|
* @returns
|
|
2867
2868
|
*/
|
|
2868
|
-
declare function start(_loadAuthenticator: typeof loadAuthenticator, _loadTheme
|
|
2869
|
+
declare function start(_loadAuthenticator: typeof loadAuthenticator, _loadTheme?: () => MaybePromise<Partial<WorkbenchTheme>>, _loadRoute?: () => MaybePromise<PageIdent.Router | null>): Promise<void>;
|
|
2869
2870
|
type uiStyle = [file: string, plugin: string];
|
|
2871
|
+
type WorkbenchTheme = Omit<Theme, "styleFiles"> & Record<"styleFiles", uiStyle[]>;
|
|
2870
2872
|
/** @type {() => MaybePromise<Partial<Omit<Authenticator, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>} */
|
|
2871
2873
|
declare let loadAuthenticator: () => MaybePromise<Partial<Omit<Authenticator, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>;
|
|
2872
|
-
/** @type {() => MaybePromise<Partial<Omit<Theme, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>} */
|
|
2873
|
-
declare let loadTheme: () => MaybePromise<Partial<Omit<Theme, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>;
|
|
2874
2874
|
//#endregion
|
|
2875
2875
|
//#region packages/web/configuration.d.mts
|
|
2876
2876
|
/** @type {Record<string, Plugin>} */
|
|
@@ -2882,6 +2882,7 @@ declare namespace application {
|
|
|
2882
2882
|
export const theme: string | undefined;
|
|
2883
2883
|
export const route: string | undefined;
|
|
2884
2884
|
export const authenticator: string | undefined;
|
|
2885
|
+
export const type: string | undefined;
|
|
2885
2886
|
export const skin: string | undefined;
|
|
2886
2887
|
export const menus: any[];
|
|
2887
2888
|
export const userMenus: any[];
|