@ubean/integrations 0.2.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/LICENSE +21 -0
- package/dist/electron/index.d.ts +37 -0
- package/dist/electron/index.js +61 -0
- package/dist/fonts/index.d.ts +43 -0
- package/dist/fonts/index.js +103 -0
- package/dist/index.d.ts +301 -0
- package/dist/index.js +148 -0
- package/dist/pinia/index.d.ts +16 -0
- package/dist/pinia/index.js +30 -0
- package/dist/pwa/index.d.ts +47 -0
- package/dist/pwa/index.js +159 -0
- package/dist/runtime-C_0lCtWE.js +349 -0
- package/dist/types-BXiJV3cm.d.ts +37 -0
- package/dist/types-BsgAJnWk.d.ts +40 -0
- package/dist/types-CpVZH81i.d.ts +106 -0
- package/dist/types-D94CeRo-.d.ts +130 -0
- package/dist/types-Qd7x9Fbj.d.ts +52 -0
- package/dist/ui/index.d.ts +26 -0
- package/dist/ui/index.js +44 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Soybean
|
|
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.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { i as ElectronRendererOptions, n as ElectronOptions, r as ElectronPreloadOptions, t as ElectronMainOptions } from "../types-BsgAJnWk.js";
|
|
2
|
+
import { Plugin } from "vite";
|
|
3
|
+
//#region src/electron/constants.d.ts
|
|
4
|
+
/** main 进程入口默认值 */
|
|
5
|
+
declare const DEFAULT_MAIN_ENTRY = "electron/main.ts";
|
|
6
|
+
/** preload 脚本入口默认值 */
|
|
7
|
+
declare const DEFAULT_PRELOAD_INPUT = "electron/preload.ts";
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/electron/index.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* ubean Electron Vite 插件(基于 vite-plugin-electron)
|
|
12
|
+
*
|
|
13
|
+
* main/preload 有默认值,最简配置只需 `electron: true`。
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* // ubean.config.ts — 最简启用
|
|
18
|
+
* export default defineConfig({ electron: true });
|
|
19
|
+
*
|
|
20
|
+
* // ubean.config.ts — 自定义入口
|
|
21
|
+
* export default defineConfig({
|
|
22
|
+
* electron: {
|
|
23
|
+
* main: { entry: 'electron/main.ts' },
|
|
24
|
+
* preload: { input: 'electron/preload.ts' }
|
|
25
|
+
* }
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* 通常由 ubean module 系统自动加载,无需在 vite.config.ts 中手动调用。
|
|
30
|
+
*/
|
|
31
|
+
declare function ubeanElectronPlugin(options?: ElectronOptions): Promise<Plugin[]>;
|
|
32
|
+
/**
|
|
33
|
+
* 类型安全的 Electron 配置定义辅助函数(透传)
|
|
34
|
+
*/
|
|
35
|
+
declare function defineElectronConfig(options: ElectronOptions): ElectronOptions;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { DEFAULT_MAIN_ENTRY, DEFAULT_PRELOAD_INPUT, type ElectronMainOptions, type ElectronOptions, type ElectronPreloadOptions, type ElectronRendererOptions, ubeanElectronPlugin as default, ubeanElectronPlugin, defineElectronConfig };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import electron from "vite-plugin-electron/simple";
|
|
2
|
+
//#region src/electron/constants.ts
|
|
3
|
+
/** main 进程入口默认值 */
|
|
4
|
+
const DEFAULT_MAIN_ENTRY = "electron/main.ts";
|
|
5
|
+
/** preload 脚本入口默认值 */
|
|
6
|
+
const DEFAULT_PRELOAD_INPUT = "electron/preload.ts";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/electron/index.ts
|
|
9
|
+
/**
|
|
10
|
+
* ubean Electron Vite 插件(基于 vite-plugin-electron)
|
|
11
|
+
*
|
|
12
|
+
* main/preload 有默认值,最简配置只需 `electron: true`。
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // ubean.config.ts — 最简启用
|
|
17
|
+
* export default defineConfig({ electron: true });
|
|
18
|
+
*
|
|
19
|
+
* // ubean.config.ts — 自定义入口
|
|
20
|
+
* export default defineConfig({
|
|
21
|
+
* electron: {
|
|
22
|
+
* main: { entry: 'electron/main.ts' },
|
|
23
|
+
* preload: { input: 'electron/preload.ts' }
|
|
24
|
+
* }
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* 通常由 ubean module 系统自动加载,无需在 vite.config.ts 中手动调用。
|
|
29
|
+
*/
|
|
30
|
+
async function ubeanElectronPlugin(options = {}) {
|
|
31
|
+
if (options.enabled === false) return [{
|
|
32
|
+
name: "ubean:electron:noop",
|
|
33
|
+
enforce: "post"
|
|
34
|
+
}];
|
|
35
|
+
const mainEntry = options.main?.entry ?? "electron/main.ts";
|
|
36
|
+
const preloadInput = options.preload?.input ?? "electron/preload.ts";
|
|
37
|
+
const electronConfig = {
|
|
38
|
+
main: {
|
|
39
|
+
entry: mainEntry,
|
|
40
|
+
...options.main?.vite
|
|
41
|
+
},
|
|
42
|
+
preload: {
|
|
43
|
+
input: preloadInput,
|
|
44
|
+
...options.preload?.vite
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
if (options.renderer) electronConfig.renderer = options.renderer;
|
|
48
|
+
const plugins = await electron(electronConfig);
|
|
49
|
+
return (Array.isArray(plugins) ? plugins : [plugins]).map((p) => ({
|
|
50
|
+
...p,
|
|
51
|
+
name: p.name?.startsWith("ubean:") ? p.name : `ubean:electron(${p.name ?? "unknown"})`
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 类型安全的 Electron 配置定义辅助函数(透传)
|
|
56
|
+
*/
|
|
57
|
+
function defineElectronConfig(options) {
|
|
58
|
+
return options;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { DEFAULT_MAIN_ENTRY, DEFAULT_PRELOAD_INPUT, ubeanElectronPlugin as default, ubeanElectronPlugin, defineElectronConfig };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { a as FontModuleOptions, c as FontStyle, d as GoogleFontsOptions, f as LocalFontOptions, i as FontMetric, l as FontSubset, n as FontFaceDeclaration, o as FontProvider, p as ResolvedFontFace, r as FontFamilyOptions, t as FontDisplay, u as FontWeight } from "../types-CpVZH81i.js";
|
|
2
|
+
import { Plugin } from "vite";
|
|
3
|
+
//#region src/fonts/index.d.ts
|
|
4
|
+
interface UbeanFontsOptions {
|
|
5
|
+
families?: Array<{
|
|
6
|
+
name: string;
|
|
7
|
+
provider?: 'google' | 'bunny' | 'local' | 'custom';
|
|
8
|
+
weights?: number[];
|
|
9
|
+
styles?: Array<'normal' | 'italic'>;
|
|
10
|
+
subsets?: string[];
|
|
11
|
+
display?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional';
|
|
12
|
+
preload?: boolean;
|
|
13
|
+
cssVariable?: string | boolean;
|
|
14
|
+
}>;
|
|
15
|
+
google?: {
|
|
16
|
+
families?: Record<string, {
|
|
17
|
+
weights?: number[];
|
|
18
|
+
styles?: string[];
|
|
19
|
+
subsets?: string[];
|
|
20
|
+
}>;
|
|
21
|
+
display?: string;
|
|
22
|
+
preconnect?: boolean;
|
|
23
|
+
download?: boolean;
|
|
24
|
+
};
|
|
25
|
+
local?: Record<string, {
|
|
26
|
+
src: string | string[];
|
|
27
|
+
weight?: number;
|
|
28
|
+
style?: string;
|
|
29
|
+
preload?: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
defaults?: {
|
|
32
|
+
weights?: number[];
|
|
33
|
+
styles?: string[];
|
|
34
|
+
subsets?: string[];
|
|
35
|
+
display?: string;
|
|
36
|
+
preload?: boolean;
|
|
37
|
+
};
|
|
38
|
+
inject?: boolean;
|
|
39
|
+
devtools?: boolean;
|
|
40
|
+
}
|
|
41
|
+
declare function ubeanFontsPlugin(userOptions?: UbeanFontsOptions): Plugin;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { type FontDisplay, type FontFaceDeclaration, type FontFamilyOptions, type FontMetric, type FontModuleOptions, type FontProvider, type FontStyle, type FontSubset, type FontWeight, type GoogleFontsOptions, type LocalFontOptions, type ResolvedFontFace, UbeanFontsOptions, ubeanFontsPlugin as default, ubeanFontsPlugin };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { a as generateFontCSS, o as generateFontLinks, t as configureFontsRuntime } from "../runtime-C_0lCtWE.js";
|
|
2
|
+
import { defu } from "defu";
|
|
3
|
+
//#region src/fonts/index.ts
|
|
4
|
+
const defaultOptions = {
|
|
5
|
+
families: [],
|
|
6
|
+
google: {
|
|
7
|
+
preconnect: true,
|
|
8
|
+
download: false
|
|
9
|
+
},
|
|
10
|
+
defaults: {
|
|
11
|
+
weights: [400],
|
|
12
|
+
styles: ["normal"],
|
|
13
|
+
subsets: ["latin"],
|
|
14
|
+
display: "swap",
|
|
15
|
+
preload: true
|
|
16
|
+
},
|
|
17
|
+
inject: true,
|
|
18
|
+
devtools: true
|
|
19
|
+
};
|
|
20
|
+
const VIRTUAL_FONTS = "virtual:ubean-fonts";
|
|
21
|
+
const RESOLVED_VIRTUAL_FONTS = `\0${VIRTUAL_FONTS}`;
|
|
22
|
+
function ubeanFontsPlugin(userOptions = {}) {
|
|
23
|
+
const options = defu(userOptions, defaultOptions);
|
|
24
|
+
return {
|
|
25
|
+
name: "ubean:fonts",
|
|
26
|
+
enforce: "pre",
|
|
27
|
+
configResolved() {
|
|
28
|
+
configureFontsRuntime({
|
|
29
|
+
families: options.families,
|
|
30
|
+
google: options.google,
|
|
31
|
+
local: options.local,
|
|
32
|
+
defaults: options.defaults
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
resolveId(id) {
|
|
36
|
+
if (id === VIRTUAL_FONTS) return RESOLVED_VIRTUAL_FONTS;
|
|
37
|
+
return null;
|
|
38
|
+
},
|
|
39
|
+
load(id) {
|
|
40
|
+
if (id === RESOLVED_VIRTUAL_FONTS) {
|
|
41
|
+
const { preconnect, styles, preload } = generateFontLinks();
|
|
42
|
+
const cssVariables = generateFontCSS();
|
|
43
|
+
return `
|
|
44
|
+
export const preconnectLinks = ${JSON.stringify(preconnect)};
|
|
45
|
+
export const stylesheetLinks = ${JSON.stringify(styles)};
|
|
46
|
+
export const preloadLinks = ${JSON.stringify(preload)};
|
|
47
|
+
export const fontCSS = ${JSON.stringify(cssVariables)};
|
|
48
|
+
|
|
49
|
+
export function useFonts() {
|
|
50
|
+
return {
|
|
51
|
+
preconnect: preconnectLinks,
|
|
52
|
+
styles: stylesheetLinks,
|
|
53
|
+
preload: preloadLinks,
|
|
54
|
+
css: fontCSS,
|
|
55
|
+
all: [...preconnectLinks, ...preloadLinks, ...stylesheetLinks].join('\\n')
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default useFonts;
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
},
|
|
64
|
+
transformIndexHtml(html) {
|
|
65
|
+
if (!options.inject) return html;
|
|
66
|
+
const { preconnect, styles, preload } = generateFontLinks();
|
|
67
|
+
return {
|
|
68
|
+
html,
|
|
69
|
+
tags: [
|
|
70
|
+
...preconnect.map((href) => ({
|
|
71
|
+
tag: "link",
|
|
72
|
+
attrs: {
|
|
73
|
+
rel: "preconnect",
|
|
74
|
+
href: href.match(/href="([^"]+)"/)?.[1],
|
|
75
|
+
crossorigin: true
|
|
76
|
+
}
|
|
77
|
+
})),
|
|
78
|
+
...preload.map((href) => ({
|
|
79
|
+
tag: "link",
|
|
80
|
+
attrs: {
|
|
81
|
+
rel: "preload",
|
|
82
|
+
as: "font",
|
|
83
|
+
type: "font/woff2",
|
|
84
|
+
href: href.match(/href="([^"]+)"/)?.[1],
|
|
85
|
+
crossorigin: true
|
|
86
|
+
}
|
|
87
|
+
})),
|
|
88
|
+
...styles.map((href) => {
|
|
89
|
+
return {
|
|
90
|
+
tag: "link",
|
|
91
|
+
attrs: {
|
|
92
|
+
rel: "stylesheet",
|
|
93
|
+
href: href.match(/href="([^"]+)"/)?.[1]
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { ubeanFontsPlugin as default, ubeanFontsPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { i as ElectronRendererOptions, n as ElectronOptions, r as ElectronPreloadOptions, t as ElectronMainOptions } from "./types-BsgAJnWk.js";
|
|
2
|
+
import { a as FontModuleOptions, c as FontStyle, d as GoogleFontsOptions, f as LocalFontOptions, i as FontMetric, l as FontSubset, n as FontFaceDeclaration, o as FontProvider, p as ResolvedFontFace, r as FontFamilyOptions, s as FontProviderOptions, t as FontDisplay, u as FontWeight } from "./types-CpVZH81i.js";
|
|
3
|
+
import { a as ManifestScreenshot, c as RuntimeCachingRule, i as ManifestOrientation, l as UsePwaOptions, n as DisplayMode, o as PwaOptions, r as ManifestIcon, s as PwaState, t as CachingStrategy, u as WebAppManifest } from "./types-D94CeRo-.js";
|
|
4
|
+
import { n as UbeanPiniaOptions, t as PiniaSerializedState } from "./types-Qd7x9Fbj.js";
|
|
5
|
+
import { t as UiOptions } from "./types-BXiJV3cm.js";
|
|
6
|
+
import { App } from "vue";
|
|
7
|
+
//#region src/pwa/runtime.d.ts
|
|
8
|
+
declare function registerSW(swUrl?: string, options?: UsePwaOptions): Promise<ServiceWorkerRegistration | null>;
|
|
9
|
+
declare function updateSW(): void;
|
|
10
|
+
declare function getSWRegistration(): ServiceWorkerRegistration | null;
|
|
11
|
+
declare function usePwa(options?: UsePwaOptions & {
|
|
12
|
+
swUrl?: string;
|
|
13
|
+
}): {
|
|
14
|
+
state: import("vue").ComputedRef<PwaState>;
|
|
15
|
+
isInstalled: import("vue").Ref<boolean, boolean>;
|
|
16
|
+
isUpdateAvailable: import("vue").Ref<boolean, boolean>;
|
|
17
|
+
isOfflineReady: import("vue").Ref<boolean, boolean>;
|
|
18
|
+
needRefresh: import("vue").Ref<boolean, boolean>;
|
|
19
|
+
registration: import("vue").Ref<{
|
|
20
|
+
readonly active: {
|
|
21
|
+
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
|
|
22
|
+
readonly scriptURL: string;
|
|
23
|
+
readonly state: ServiceWorkerState;
|
|
24
|
+
postMessage: {
|
|
25
|
+
(message: any, transfer: Transferable[]): void;
|
|
26
|
+
(message: any, options?: StructuredSerializeOptions): void;
|
|
27
|
+
};
|
|
28
|
+
addEventListener: {
|
|
29
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
30
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
31
|
+
};
|
|
32
|
+
removeEventListener: {
|
|
33
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
34
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
35
|
+
};
|
|
36
|
+
dispatchEvent: (event: Event) => boolean;
|
|
37
|
+
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
|
|
38
|
+
} | null;
|
|
39
|
+
readonly cookies: {
|
|
40
|
+
getSubscriptions: () => Promise<CookieStoreGetOptions[]>;
|
|
41
|
+
subscribe: {
|
|
42
|
+
(subscriptions: CookieStoreGetOptions[]): Promise<void>;
|
|
43
|
+
(subscriptions: Iterable<CookieStoreGetOptions>): Promise<void>;
|
|
44
|
+
};
|
|
45
|
+
unsubscribe: {
|
|
46
|
+
(subscriptions: CookieStoreGetOptions[]): Promise<void>;
|
|
47
|
+
(subscriptions: Iterable<CookieStoreGetOptions>): Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly installing: {
|
|
51
|
+
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
|
|
52
|
+
readonly scriptURL: string;
|
|
53
|
+
readonly state: ServiceWorkerState;
|
|
54
|
+
postMessage: {
|
|
55
|
+
(message: any, transfer: Transferable[]): void;
|
|
56
|
+
(message: any, options?: StructuredSerializeOptions): void;
|
|
57
|
+
};
|
|
58
|
+
addEventListener: {
|
|
59
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
60
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
61
|
+
};
|
|
62
|
+
removeEventListener: {
|
|
63
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
64
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
65
|
+
};
|
|
66
|
+
dispatchEvent: (event: Event) => boolean;
|
|
67
|
+
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
|
|
68
|
+
} | null;
|
|
69
|
+
readonly navigationPreload: {
|
|
70
|
+
disable: () => Promise<void>;
|
|
71
|
+
enable: () => Promise<void>;
|
|
72
|
+
getState: () => Promise<NavigationPreloadState>;
|
|
73
|
+
setHeaderValue: (value: string) => Promise<void>;
|
|
74
|
+
};
|
|
75
|
+
onupdatefound: ((this: ServiceWorkerRegistration, ev: Event) => any) | null;
|
|
76
|
+
readonly scope: string;
|
|
77
|
+
readonly updateViaCache: ServiceWorkerUpdateViaCache;
|
|
78
|
+
readonly waiting: {
|
|
79
|
+
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
|
|
80
|
+
readonly scriptURL: string;
|
|
81
|
+
readonly state: ServiceWorkerState;
|
|
82
|
+
postMessage: {
|
|
83
|
+
(message: any, transfer: Transferable[]): void;
|
|
84
|
+
(message: any, options?: StructuredSerializeOptions): void;
|
|
85
|
+
};
|
|
86
|
+
addEventListener: {
|
|
87
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
88
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
89
|
+
};
|
|
90
|
+
removeEventListener: {
|
|
91
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
92
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
93
|
+
};
|
|
94
|
+
dispatchEvent: (event: Event) => boolean;
|
|
95
|
+
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
|
|
96
|
+
} | null;
|
|
97
|
+
getNotifications: (filter?: GetNotificationOptions) => Promise<Notification[]>;
|
|
98
|
+
showNotification: (title: string, options?: NotificationOptions) => Promise<void>;
|
|
99
|
+
unregister: () => Promise<boolean>;
|
|
100
|
+
update: () => Promise<ServiceWorkerRegistration>;
|
|
101
|
+
addEventListener: {
|
|
102
|
+
<K extends keyof ServiceWorkerRegistrationEventMap>(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
103
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
104
|
+
};
|
|
105
|
+
removeEventListener: {
|
|
106
|
+
<K extends keyof ServiceWorkerRegistrationEventMap>(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
107
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
108
|
+
};
|
|
109
|
+
dispatchEvent: (event: Event) => boolean;
|
|
110
|
+
readonly pushManager: {
|
|
111
|
+
getSubscription: () => Promise<PushSubscription | null>;
|
|
112
|
+
permissionState: (options?: PushSubscriptionOptionsInit) => Promise<PermissionState>;
|
|
113
|
+
subscribe: (options?: PushSubscriptionOptionsInit) => Promise<PushSubscription>;
|
|
114
|
+
};
|
|
115
|
+
} | null, ServiceWorkerRegistration | {
|
|
116
|
+
readonly active: {
|
|
117
|
+
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
|
|
118
|
+
readonly scriptURL: string;
|
|
119
|
+
readonly state: ServiceWorkerState;
|
|
120
|
+
postMessage: {
|
|
121
|
+
(message: any, transfer: Transferable[]): void;
|
|
122
|
+
(message: any, options?: StructuredSerializeOptions): void;
|
|
123
|
+
};
|
|
124
|
+
addEventListener: {
|
|
125
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
126
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
127
|
+
};
|
|
128
|
+
removeEventListener: {
|
|
129
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
130
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
131
|
+
};
|
|
132
|
+
dispatchEvent: (event: Event) => boolean;
|
|
133
|
+
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
|
|
134
|
+
} | null;
|
|
135
|
+
readonly cookies: {
|
|
136
|
+
getSubscriptions: () => Promise<CookieStoreGetOptions[]>;
|
|
137
|
+
subscribe: {
|
|
138
|
+
(subscriptions: CookieStoreGetOptions[]): Promise<void>;
|
|
139
|
+
(subscriptions: Iterable<CookieStoreGetOptions>): Promise<void>;
|
|
140
|
+
};
|
|
141
|
+
unsubscribe: {
|
|
142
|
+
(subscriptions: CookieStoreGetOptions[]): Promise<void>;
|
|
143
|
+
(subscriptions: Iterable<CookieStoreGetOptions>): Promise<void>;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
readonly installing: {
|
|
147
|
+
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
|
|
148
|
+
readonly scriptURL: string;
|
|
149
|
+
readonly state: ServiceWorkerState;
|
|
150
|
+
postMessage: {
|
|
151
|
+
(message: any, transfer: Transferable[]): void;
|
|
152
|
+
(message: any, options?: StructuredSerializeOptions): void;
|
|
153
|
+
};
|
|
154
|
+
addEventListener: {
|
|
155
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
156
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
157
|
+
};
|
|
158
|
+
removeEventListener: {
|
|
159
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
160
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
161
|
+
};
|
|
162
|
+
dispatchEvent: (event: Event) => boolean;
|
|
163
|
+
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
|
|
164
|
+
} | null;
|
|
165
|
+
readonly navigationPreload: {
|
|
166
|
+
disable: () => Promise<void>;
|
|
167
|
+
enable: () => Promise<void>;
|
|
168
|
+
getState: () => Promise<NavigationPreloadState>;
|
|
169
|
+
setHeaderValue: (value: string) => Promise<void>;
|
|
170
|
+
};
|
|
171
|
+
onupdatefound: ((this: ServiceWorkerRegistration, ev: Event) => any) | null;
|
|
172
|
+
readonly scope: string;
|
|
173
|
+
readonly updateViaCache: ServiceWorkerUpdateViaCache;
|
|
174
|
+
readonly waiting: {
|
|
175
|
+
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
|
|
176
|
+
readonly scriptURL: string;
|
|
177
|
+
readonly state: ServiceWorkerState;
|
|
178
|
+
postMessage: {
|
|
179
|
+
(message: any, transfer: Transferable[]): void;
|
|
180
|
+
(message: any, options?: StructuredSerializeOptions): void;
|
|
181
|
+
};
|
|
182
|
+
addEventListener: {
|
|
183
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
184
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
185
|
+
};
|
|
186
|
+
removeEventListener: {
|
|
187
|
+
<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
188
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
189
|
+
};
|
|
190
|
+
dispatchEvent: (event: Event) => boolean;
|
|
191
|
+
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
|
|
192
|
+
} | null;
|
|
193
|
+
getNotifications: (filter?: GetNotificationOptions) => Promise<Notification[]>;
|
|
194
|
+
showNotification: (title: string, options?: NotificationOptions) => Promise<void>;
|
|
195
|
+
unregister: () => Promise<boolean>;
|
|
196
|
+
update: () => Promise<ServiceWorkerRegistration>;
|
|
197
|
+
addEventListener: {
|
|
198
|
+
<K extends keyof ServiceWorkerRegistrationEventMap>(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
199
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
200
|
+
};
|
|
201
|
+
removeEventListener: {
|
|
202
|
+
<K extends keyof ServiceWorkerRegistrationEventMap>(type: K, listener: (this: ServiceWorkerRegistration, ev: ServiceWorkerRegistrationEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
203
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
204
|
+
};
|
|
205
|
+
dispatchEvent: (event: Event) => boolean;
|
|
206
|
+
readonly pushManager: {
|
|
207
|
+
getSubscription: () => Promise<PushSubscription | null>;
|
|
208
|
+
permissionState: (options?: PushSubscriptionOptionsInit) => Promise<PermissionState>;
|
|
209
|
+
subscribe: (options?: PushSubscriptionOptionsInit) => Promise<PushSubscription>;
|
|
210
|
+
};
|
|
211
|
+
} | null>;
|
|
212
|
+
register: () => Promise<void>;
|
|
213
|
+
updateServiceWorker: () => void;
|
|
214
|
+
skipWaiting: () => void;
|
|
215
|
+
closePrompt: () => void;
|
|
216
|
+
};
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/pinia/runtime.d.ts
|
|
219
|
+
/**
|
|
220
|
+
* SSR 序列化:从 Vue app 实例提取 Pinia 的 root state。
|
|
221
|
+
*
|
|
222
|
+
* 在服务端 `renderToString(app)` 完成后由 ubean SSR 渲染器调用。
|
|
223
|
+
* 返回的 `{ pinia }` 会被序列化到 HTML 的 `__UBEAN_STATE__` script 标签中。
|
|
224
|
+
*
|
|
225
|
+
* 若 app 上未检测到 `$pinia`(未安装 pinia 插件),返回空对象,
|
|
226
|
+
* 不会抛出错误(允许在部分页面不使用 pinia)。
|
|
227
|
+
*
|
|
228
|
+
* @param app Vue app 实例(SSR 渲染用的 app)
|
|
229
|
+
* @returns 序列化后的状态对象,包含 `pinia.state.value`
|
|
230
|
+
*/
|
|
231
|
+
declare function serializePiniaState(app: App): PiniaSerializedState;
|
|
232
|
+
/**
|
|
233
|
+
* 客户端水合:将 SSR 序列化的 state 注入到 Pinia 实例。
|
|
234
|
+
*
|
|
235
|
+
* 在 `applyAppConfig`(注册 `createPinia()` 插件)之后、`app.mount()` 之前调用。
|
|
236
|
+
* 必须在 mount 前执行,否则 store 已用默认 state 初始化,水合无效。
|
|
237
|
+
*
|
|
238
|
+
* 若 `state` 为 `null` 或不含 `pinia` 字段,直接返回(no-op),
|
|
239
|
+
* 允许在 CSR 模式或无 SSR state 时安全调用。
|
|
240
|
+
*
|
|
241
|
+
* @param app Vue app 实例(客户端 app,已 install pinia 插件)
|
|
242
|
+
* @param state 从 `__UBEAN_STATE__` 反序列化的状态对象,或 null
|
|
243
|
+
*/
|
|
244
|
+
declare function hydratePiniaState(app: App, state: Record<string, unknown> | null): void;
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/fonts/core.d.ts
|
|
247
|
+
declare const defaultFontWeights: number[];
|
|
248
|
+
declare const defaultFontStyles: FontStyle[];
|
|
249
|
+
declare const defaultFontSubsets: FontSubset[];
|
|
250
|
+
declare const defaultFontDisplay: FontDisplay;
|
|
251
|
+
declare const fallbackFonts: Record<string, string[]>;
|
|
252
|
+
declare function normalizeFontName(name: string): string;
|
|
253
|
+
declare function weightsToString(weights: (FontWeight | number)[]): string;
|
|
254
|
+
declare function getGoogleFontsUrl(options: {
|
|
255
|
+
family: string;
|
|
256
|
+
weights?: (FontWeight | number)[];
|
|
257
|
+
styles?: FontStyle[];
|
|
258
|
+
subsets?: FontSubset[];
|
|
259
|
+
display?: FontDisplay;
|
|
260
|
+
text?: string;
|
|
261
|
+
}): string;
|
|
262
|
+
declare function getBunnyFontsUrl(options: {
|
|
263
|
+
family: string;
|
|
264
|
+
weights?: (FontWeight | number)[];
|
|
265
|
+
styles?: FontStyle[];
|
|
266
|
+
subsets?: FontSubset[];
|
|
267
|
+
display?: FontDisplay;
|
|
268
|
+
}): string;
|
|
269
|
+
declare function getFontshareUrl(family: string, _format?: 'css' | 'json'): string;
|
|
270
|
+
declare function generateFontFace(face: ResolvedFontFace): string;
|
|
271
|
+
declare function generateFontFallbackCSS(familyName: string, metric: FontMetric, fallbackName: string, isItalic?: boolean): string;
|
|
272
|
+
declare function generatePreloadLink(url: string, type?: string, crossorigin?: boolean): string;
|
|
273
|
+
declare function generatePreconnectLink(href: string, crossorigin?: boolean): string;
|
|
274
|
+
declare function generateFontCSSVariable(name: string, family: string): string;
|
|
275
|
+
declare function parseFontFamilyCSS(css: string): ResolvedFontFace[];
|
|
276
|
+
declare function extractFontUrlsFromCSS(css: string): string[];
|
|
277
|
+
declare function createFontHash(config: FontFamilyOptions): string;
|
|
278
|
+
declare function normalizeFontFamily(family: FontFamilyOptions, defaults: {
|
|
279
|
+
weights: number[];
|
|
280
|
+
styles: FontStyle[];
|
|
281
|
+
subsets: FontSubset[];
|
|
282
|
+
display: FontDisplay;
|
|
283
|
+
}): Required<FontFamilyOptions>;
|
|
284
|
+
declare const googleFontMetrics: Record<string, FontMetric>;
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/fonts/runtime.d.ts
|
|
287
|
+
declare function configureFontsRuntime(options?: Partial<FontModuleOptions>): FontModuleOptions;
|
|
288
|
+
declare function getFontsConfig(): FontModuleOptions;
|
|
289
|
+
declare function defineFontFamily(options: FontFamilyOptions): FontFamilyOptions;
|
|
290
|
+
declare function defineLocalFont(options: LocalFontOptions): LocalFontOptions;
|
|
291
|
+
declare function defineGoogleFont(options: GoogleFontsOptions): GoogleFontsOptions;
|
|
292
|
+
declare function generateFontLinks(): {
|
|
293
|
+
preconnect: string[];
|
|
294
|
+
styles: string[];
|
|
295
|
+
preload: string[];
|
|
296
|
+
};
|
|
297
|
+
declare function generateFontCSS(): string;
|
|
298
|
+
declare function getFontFamilies(): Required<FontFamilyOptions>[];
|
|
299
|
+
declare function getFontHash(family: FontFamilyOptions): string;
|
|
300
|
+
//#endregion
|
|
301
|
+
export { CachingStrategy, DisplayMode, ElectronMainOptions, ElectronOptions, ElectronPreloadOptions, ElectronRendererOptions, FontDisplay, FontFaceDeclaration, FontFamilyOptions, FontMetric, FontModuleOptions, FontProvider, FontProviderOptions, FontStyle, FontSubset, FontWeight, GoogleFontsOptions, LocalFontOptions, ManifestIcon, ManifestOrientation, ManifestScreenshot, PiniaSerializedState, PwaOptions, PwaState, ResolvedFontFace, RuntimeCachingRule, UbeanPiniaOptions, UiOptions, UsePwaOptions, WebAppManifest, configureFontsRuntime, createFontHash, defaultFontDisplay, defaultFontStyles, defaultFontSubsets, defaultFontWeights, defineFontFamily, defineGoogleFont, defineLocalFont, extractFontUrlsFromCSS, fallbackFonts, generateFontCSS, generateFontCSSVariable, generateFontFace, generateFontFallbackCSS, generateFontLinks, generatePreconnectLink, generatePreloadLink, getBunnyFontsUrl, getFontFamilies, getFontHash, getFontsConfig, getFontshareUrl, getGoogleFontsUrl, getSWRegistration, googleFontMetrics, hydratePiniaState, normalizeFontFamily, normalizeFontName, parseFontFamilyCSS, registerSW, serializePiniaState, updateSW, usePwa, weightsToString };
|