@opendesign-plus-test/plugins 0.0.1-rc.1 → 0.0.1-rc.10

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.
@@ -0,0 +1,2 @@
1
+ import { ExternalLinkGuardOptions } from '../core/types';
2
+ export declare function setupDomAdapter(options: ExternalLinkGuardOptions): void;
@@ -0,0 +1,2 @@
1
+ import { ExternalLinkGuardOptions } from '../core/types';
2
+ export declare function setupWindowAdapter(options: ExternalLinkGuardOptions): void;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 是否为外链
3
+ */
4
+ export declare function isExternalUrl(url: string): boolean;
5
+ /**
6
+ * 通配符白名单匹配
7
+ * 支持:
8
+ * - *
9
+ * - example.com
10
+ * - *.example.com
11
+ */
12
+ export declare function matchWhitelist(hostname: string, whitelist?: string[]): boolean;
@@ -0,0 +1,2 @@
1
+ import { ExternalLinkGuardOptions } from '../core/types';
2
+ export declare function runConfirm(url: string, options: ExternalLinkGuardOptions): Promise<boolean>;
@@ -0,0 +1,23 @@
1
+ export interface ExternalLinkGuardOptions {
2
+ /**
3
+ * 白名单域名(支持通配符 * 和 *.example.com)
4
+ * 默认为空数组(即无白名单)
5
+ */
6
+ whitelist?: string[];
7
+ /**
8
+ * 自定义提示消息(默认为原生 confirm 提示)
9
+ */
10
+ message?: string;
11
+ /**
12
+ * 是否显示自定义弹窗
13
+ */
14
+ showCustomConfirm?: boolean;
15
+ /**
16
+ * 语言
17
+ */
18
+ lang?: 'zh' | 'en';
19
+ /**
20
+ * 社区名称
21
+ */
22
+ community?: string;
23
+ }
@@ -0,0 +1,3 @@
1
+ import { createExternalLinkGuard } from './plugin';
2
+ import { ExternalLinkGuardOptions } from './core/types';
3
+ export { createExternalLinkGuard, type ExternalLinkGuardOptions };
@@ -0,0 +1,4 @@
1
+ import { ExternalLinkGuardOptions } from './core/types';
2
+ export declare function createExternalLinkGuard(options?: ExternalLinkGuardOptions): {
3
+ install(): void;
4
+ };
@@ -0,0 +1,2 @@
1
+ export type ConfirmLang = 'zh' | 'en';
2
+ export declare function createConfirm(lang: ConfirmLang, url: string, community: string): Promise<boolean>;