@ksconsole/qiankun-plus
Version:
A completed implementation of Micro Frontends
45 lines (44 loc) • 2.35 kB
TypeScript
export declare const styleElementTargetSymbol: unique symbol;
export declare const styleElementRefNodeNo: unique symbol;
declare const overwrittenSymbol: unique symbol;
type DynamicDomMutationTarget = 'head' | 'body';
declare global {
interface HTMLLinkElement {
[styleElementTargetSymbol]: DynamicDomMutationTarget;
[styleElementRefNodeNo]?: Exclude<number, -1>;
}
interface HTMLStyleElement {
[styleElementTargetSymbol]: DynamicDomMutationTarget;
[styleElementRefNodeNo]?: Exclude<number, -1>;
}
interface Function {
[overwrittenSymbol]: boolean;
}
}
export declare const getAppWrapperHeadElement: (appWrapper: Element | ShadowRoot) => Element;
export declare function isExecutableScriptType(script: HTMLScriptElement): boolean;
export declare function isHijackingTag(tagName?: string): boolean;
/**
* Check if a style element is a styled-component liked.
* A styled-components liked element is which not have textContext but keep the rules in its styleSheet.cssRules.
* Such as the style element generated by styled-components and emotion.
* @param element
*/
export declare function isStyledComponentsLike(element: HTMLStyleElement): number | false | undefined;
export declare function calcAppCount(appName: string, calcType: 'increase' | 'decrease', status: 'bootstrapping' | 'mounting'): void;
export declare function isAllAppsUnmounted(): boolean;
export declare function recordStyledComponentsCSSRules(styleElements: HTMLStyleElement[]): void;
export declare function getStyledElementCSSRules(styledElement: HTMLStyleElement): CSSRuleList | undefined;
export type ContainerConfig = {
appName: string;
proxy: WindowProxy;
strictGlobal: boolean;
speedySandbox: boolean;
dynamicStyleSheetElements: Array<HTMLStyleElement | HTMLLinkElement>;
appWrapperGetter: CallableFunction;
scopedCSS: boolean;
excludeAssetFilter?: CallableFunction;
};
export declare function patchHTMLDynamicAppendPrototypeFunctions(isInvokedByMicroApp: (element: HTMLElement) => boolean, containerConfigGetter: (element: HTMLElement) => ContainerConfig): () => void;
export declare function rebuildCSSRules(styleSheetElements: HTMLStyleElement[], reAppendElement: (stylesheetElement: HTMLStyleElement) => boolean): void;
export {};