@blueking/bk-weweb 0.0.28-beta.2 → 0.0.29-beta.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/dist/base-app/collect-source.esm.js +125 -95
- package/dist/base-app/collect-source.esm.js.map +1 -1
- package/dist/index.d.mts +14 -8
- package/dist/index.esm.js +125 -95
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,10 +11,10 @@ declare class Script {
|
|
|
11
11
|
constructor({ async, code, defer, fromHtml, initial, isModule, url }: IScriptOption);
|
|
12
12
|
/**
|
|
13
13
|
* @param app 应用
|
|
14
|
-
* @param
|
|
14
|
+
* @param needReplaceScriptElement 是否需要替换script标签
|
|
15
15
|
* @returns 返回执行后的script标签或注释
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
executeCode(app: BaseModel, needReplaceScriptElement?: boolean): Promise<Comment | HTMLScriptElement | undefined>;
|
|
18
18
|
executeMemoryScript(app: BaseModel, scopedCode: string): void;
|
|
19
19
|
executeSourceScript(scriptElement: HTMLScriptElement, scopedCode: string): void;
|
|
20
20
|
getCode(app?: BaseModel): Promise<string>;
|
|
@@ -42,11 +42,11 @@ declare class Style {
|
|
|
42
42
|
* @param app 应用实例
|
|
43
43
|
* @returns 返回执行后的style标签
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
executeCode(app: BaseModel): Promise<HTMLStyleElement>;
|
|
46
46
|
getCode(app?: BaseModel): Promise<string>;
|
|
47
47
|
linkedBaseStyle(styleElement: HTMLStyleElement, app: BaseModel): boolean;
|
|
48
48
|
resetPackRule(rule: CSSMediaRule | CSSSupportsRule, prefix: string, packName: string): string;
|
|
49
|
-
resetUrlHost(cssText: string,
|
|
49
|
+
resetUrlHost(cssText: string, uri: string, linkPath?: string): string;
|
|
50
50
|
scopeRule(rules: CSSRule[], cssPrefix: string): string;
|
|
51
51
|
scopeStyleRule(rule: CSSStyleRule, prefix: string): string;
|
|
52
52
|
scopedLinkCSS(app: BaseModel, linkElement: HTMLLinkElement): HTMLStyleElement;
|
|
@@ -113,7 +113,7 @@ declare class SandBox {
|
|
|
113
113
|
* @param data data for sandbox
|
|
114
114
|
* @description active hook for sandbox
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
activated(data?: Record<string, unknown>): void;
|
|
117
117
|
/**
|
|
118
118
|
*
|
|
119
119
|
* @description decativated hook for sandbox
|
|
@@ -176,13 +176,15 @@ declare class EntrySource {
|
|
|
176
176
|
collectScriptAndStyle(parent: HTMLElement): void;
|
|
177
177
|
getScript(url: string): Script | undefined;
|
|
178
178
|
getStyle(urlOrCode: string): Style | undefined;
|
|
179
|
-
|
|
179
|
+
importEntry(app: BaseModel): Promise<void>;
|
|
180
180
|
importHtmlEntry(app: MicroAppModel): Promise<void>;
|
|
181
|
-
importInstanceEntry(): Promise<void>;
|
|
181
|
+
importInstanceEntry(app: BaseModel): Promise<void>;
|
|
182
182
|
setScript(url: string, script: IScriptOption | Script): void;
|
|
183
183
|
setStyle(url: string, style: Style): void;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
declare function fetchSource(url: string, options?: {}, app?: BaseModel): Promise<string>;
|
|
187
|
+
|
|
186
188
|
interface IBaseModelProps {
|
|
187
189
|
[WewebCustomAttrs.mode]?: WewebMode;
|
|
188
190
|
[WewebCustomAttrs.url]: string;
|
|
@@ -233,6 +235,7 @@ interface BaseModel {
|
|
|
233
235
|
start(): Promise<void>;
|
|
234
236
|
unmount(needDestroy?: boolean): void;
|
|
235
237
|
url: string;
|
|
238
|
+
fetchSource?: typeof fetchSource;
|
|
236
239
|
}
|
|
237
240
|
declare enum WewebMode {
|
|
238
241
|
APP = "app",
|
|
@@ -311,7 +314,10 @@ declare class MicroInstanceModel implements BaseModel {
|
|
|
311
314
|
showSourceCode: boolean;
|
|
312
315
|
source?: EntrySource;
|
|
313
316
|
url: string;
|
|
314
|
-
|
|
317
|
+
fetchSource?: typeof fetchSource;
|
|
318
|
+
constructor(props: IJsModelProps & {
|
|
319
|
+
fetchSource?: typeof fetchSource;
|
|
320
|
+
});
|
|
315
321
|
activated<T>(container: HTMLElement | ShadowRoot, callback?: (instance: BaseModel, exportInstance?: T) => void): void;
|
|
316
322
|
deactivated(): void;
|
|
317
323
|
mount<T>(container?: HTMLElement | ShadowRoot, callback?: (instance: MicroInstanceModel, exportInstance: T) => void): void;
|