@textbus/platform-browser 3.1.5 → 3.1.6

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.
@@ -1,56 +1,56 @@
1
- import { Injector } from '@tanbo/di';
2
- import { Attribute, ComponentInstance, Formatter, FormatValue, Slot } from '@textbus/core';
3
- import { ViewOptions } from '../core/types';
4
- export interface ComponentResources {
5
- links?: Array<{
6
- [key: string]: string;
7
- }>;
8
- styles?: string[];
9
- scripts?: string[];
10
- editModeStyles?: string[];
11
- }
12
- export interface SlotParser {
13
- <T extends Slot>(childSlot: T, slotRootElement: HTMLElement, slotContentHostElement?: HTMLElement): T;
14
- }
15
- /**
16
- * 组件加载器
17
- */
18
- export interface ComponentLoader {
19
- /** 组件所需要的外部资源 */
20
- resources?: ComponentResources;
21
- /** 识别组件的匹配方法 */
22
- match(element: HTMLElement): boolean;
23
- /** 读取组件内容的方法 */
24
- read(element: HTMLElement, context: Injector, slotParser: SlotParser): ComponentInstance | Slot;
25
- }
26
- export interface FormatLoaderReadResult<T extends FormatValue> {
27
- formatter: Formatter<T>;
28
- value: T;
29
- }
30
- export interface FormatLoader<T extends FormatValue> {
31
- match(element: HTMLElement): boolean;
32
- read(element: HTMLElement): FormatLoaderReadResult<T>;
33
- }
34
- export interface AttributeLoaderReadResult<T extends FormatValue> {
35
- attribute: Attribute<T>;
36
- value: T;
37
- }
38
- export interface AttributeLoader<T extends FormatValue> {
39
- match(element: HTMLElement): boolean;
40
- read(element: HTMLElement): AttributeLoaderReadResult<T>;
41
- }
42
- export declare class Parser {
43
- private options;
44
- private injector;
45
- static parseHTML(html: string): HTMLElement;
46
- componentLoaders: ComponentLoader[];
47
- formatLoaders: FormatLoader<any>[];
48
- attributeLoaders: AttributeLoader<any>[];
49
- constructor(options: ViewOptions, injector: Injector);
50
- parseDoc(html: string, rootComponentLoader: ComponentLoader): Slot<any> | ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>;
51
- parse(html: string, rootSlot: Slot): Slot<any>;
52
- private readComponent;
53
- private readFormats;
54
- private readSlot;
55
- private applyFormats;
56
- }
1
+ import { Injector } from '@tanbo/di';
2
+ import { Attribute, ComponentInstance, Formatter, FormatValue, Slot } from '@textbus/core';
3
+ import { ViewOptions } from '../core/types';
4
+ export interface ComponentResources {
5
+ links?: Array<{
6
+ [key: string]: string;
7
+ }>;
8
+ styles?: string[];
9
+ scripts?: string[];
10
+ editModeStyles?: string[];
11
+ }
12
+ export interface SlotParser {
13
+ <T extends Slot>(childSlot: T, slotRootElement: HTMLElement, slotContentHostElement?: HTMLElement): T;
14
+ }
15
+ /**
16
+ * 组件加载器
17
+ */
18
+ export interface ComponentLoader {
19
+ /** 组件所需要的外部资源 */
20
+ resources?: ComponentResources;
21
+ /** 识别组件的匹配方法 */
22
+ match(element: HTMLElement): boolean;
23
+ /** 读取组件内容的方法 */
24
+ read(element: HTMLElement, context: Injector, slotParser: SlotParser): ComponentInstance | Slot;
25
+ }
26
+ export interface FormatLoaderReadResult<T extends FormatValue> {
27
+ formatter: Formatter<T>;
28
+ value: T;
29
+ }
30
+ export interface FormatLoader<T extends FormatValue> {
31
+ match(element: HTMLElement): boolean;
32
+ read(element: HTMLElement): FormatLoaderReadResult<T>;
33
+ }
34
+ export interface AttributeLoaderReadResult<T extends FormatValue> {
35
+ attribute: Attribute<T>;
36
+ value: T;
37
+ }
38
+ export interface AttributeLoader<T extends FormatValue> {
39
+ match(element: HTMLElement): boolean;
40
+ read(element: HTMLElement): AttributeLoaderReadResult<T>;
41
+ }
42
+ export declare class Parser {
43
+ private options;
44
+ private injector;
45
+ static parseHTML(html: string): HTMLElement;
46
+ componentLoaders: ComponentLoader[];
47
+ formatLoaders: FormatLoader<any>[];
48
+ attributeLoaders: AttributeLoader<any>[];
49
+ constructor(options: ViewOptions, injector: Injector);
50
+ parseDoc(html: string, rootComponentLoader: ComponentLoader): Slot<any> | ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>;
51
+ parse(html: string, rootSlot: Slot): Slot<any>;
52
+ private readComponent;
53
+ private readFormats;
54
+ private readSlot;
55
+ private applyFormats;
56
+ }