@tarojs/runtime 3.5.0-theta.1 → 3.5.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.
Files changed (56) hide show
  1. package/dist/bom/document.d.ts +2 -0
  2. package/dist/bom/getComputedStyle.d.ts +3 -0
  3. package/dist/bom/navigator.d.ts +1 -0
  4. package/dist/bom/raf.d.ts +5 -0
  5. package/dist/bom/window.d.ts +2 -0
  6. package/dist/constants/index.d.ts +47 -0
  7. package/dist/current.d.ts +19 -0
  8. package/dist/dom/class-list.d.ts +14 -0
  9. package/dist/dom/document.d.ts +20 -0
  10. package/dist/dom/element.d.ts +38 -0
  11. package/dist/dom/event-source.d.ts +7 -0
  12. package/dist/dom/event-target.d.ts +7 -0
  13. package/dist/dom/event.d.ts +22 -0
  14. package/dist/dom/form.d.ts +7 -0
  15. package/dist/dom/node.d.ts +75 -0
  16. package/dist/dom/node_types.d.ts +10 -0
  17. package/dist/dom/root.d.ts +15 -0
  18. package/dist/dom/style.d.ts +14 -0
  19. package/dist/dom/style_properties.d.ts +3 -0
  20. package/dist/dom/svg.d.ts +3 -0
  21. package/dist/dom/text.d.ts +14 -0
  22. package/dist/dom/tree.d.ts +4 -0
  23. package/dist/dom-external/element.d.ts +3 -0
  24. package/dist/dom-external/index.d.ts +1 -0
  25. package/dist/dom-external/inner-html/html.d.ts +2 -0
  26. package/dist/dom-external/inner-html/parser.d.ts +25 -0
  27. package/dist/dom-external/inner-html/scaner.d.ts +30 -0
  28. package/dist/dom-external/inner-html/style.d.ts +27 -0
  29. package/dist/dom-external/inner-html/tags.d.ts +8 -0
  30. package/dist/dom-external/inner-html/utils.d.ts +1 -0
  31. package/dist/dom-external/mutation-observer/implements.d.ts +52 -0
  32. package/dist/dom-external/mutation-observer/index.d.ts +13 -0
  33. package/dist/dom-external/mutation-observer/record.d.ts +24 -0
  34. package/dist/dom-external/node.d.ts +11 -0
  35. package/dist/dsl/common.d.ts +15 -0
  36. package/dist/dsl/instance.d.ts +85 -0
  37. package/dist/emitter/emitter.d.ts +4 -0
  38. package/dist/env.d.ts +7 -0
  39. package/dist/hydrate.d.ts +10 -0
  40. package/dist/index.d.ts +26 -0
  41. package/dist/interface/element.d.ts +4 -0
  42. package/dist/interface/event-target.d.ts +10 -0
  43. package/dist/interface/event.d.ts +15 -0
  44. package/dist/interface/hydrate.d.ts +30 -0
  45. package/dist/interface/index.d.ts +7 -0
  46. package/dist/interface/node.d.ts +7 -0
  47. package/dist/interface/options.d.ts +16 -0
  48. package/dist/interface/utils.d.ts +2 -0
  49. package/dist/next-tick.d.ts +2 -0
  50. package/dist/options.d.ts +2 -0
  51. package/dist/perf.d.ts +7 -0
  52. package/dist/runtime.esm.d.ts +28 -28
  53. package/dist/runtime.esm.js +87 -70
  54. package/dist/runtime.esm.js.map +1 -1
  55. package/dist/utils/index.d.ts +23 -0
  56. package/package.json +6 -6
@@ -0,0 +1,2 @@
1
+ declare let document: any;
2
+ export { document };
@@ -0,0 +1,3 @@
1
+ import type { TaroElement } from '../dom/element';
2
+ import type { Style } from '../dom/style';
3
+ export declare function getComputedStyle(element: TaroElement): Style;
@@ -0,0 +1 @@
1
+ export declare const nav: any;
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ export declare let now: () => number;
3
+ declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
4
+ declare const _caf: typeof cancelAnimationFrame;
5
+ export { _caf as caf, _raf as raf };
@@ -0,0 +1,2 @@
1
+ declare let window: any;
2
+ export { window };
@@ -0,0 +1,47 @@
1
+ export declare const PROPERTY_THRESHOLD = 2046;
2
+ export declare const TARO_RUNTIME = "Taro runtime";
3
+ export declare const HOOKS_APP_ID = "taro-app";
4
+ export declare const SET_DATA = "\u5C0F\u7A0B\u5E8F setData";
5
+ export declare const PAGE_INIT = "\u9875\u9762\u521D\u59CB\u5316";
6
+ export declare const ROOT_STR = "root";
7
+ export declare const HTML = "html";
8
+ export declare const HEAD = "head";
9
+ export declare const BODY = "body";
10
+ export declare const APP = "app";
11
+ export declare const CONTAINER = "container";
12
+ export declare const DOCUMENT_ELEMENT_NAME = "#document";
13
+ export declare const DOCUMENT_FRAGMENT = "document-fragment";
14
+ export declare const ID = "id";
15
+ export declare const UID = "uid";
16
+ export declare const CLASS = "class";
17
+ export declare const STYLE = "style";
18
+ export declare const FOCUS = "focus";
19
+ export declare const VIEW = "view";
20
+ export declare const STATIC_VIEW = "static-view";
21
+ export declare const PURE_VIEW = "pure-view";
22
+ export declare const PROPS = "props";
23
+ export declare const DATASET = "dataset";
24
+ export declare const OBJECT = "object";
25
+ export declare const VALUE = "value";
26
+ export declare const INPUT = "input";
27
+ export declare const CHANGE = "change";
28
+ export declare const CUSTOM_WRAPPER = "custom-wrapper";
29
+ export declare const TARGET = "target";
30
+ export declare const CURRENT_TARGET = "currentTarget";
31
+ export declare const TYPE = "type";
32
+ export declare const CONFIRM = "confirm";
33
+ export declare const TIME_STAMP = "timeStamp";
34
+ export declare const KEY_CODE = "keyCode";
35
+ export declare const TOUCHMOVE = "touchmove";
36
+ export declare const DATE = "Date";
37
+ export declare const SET_TIMEOUT = "setTimeout";
38
+ export declare const CATCHMOVE = "catchMove";
39
+ export declare const CATCH_VIEW = "catch-view";
40
+ export declare const COMMENT = "comment";
41
+ export declare const ON_LOAD = "onLoad";
42
+ export declare const ON_READY = "onReady";
43
+ export declare const ON_SHOW = "onShow";
44
+ export declare const ON_HIDE = "onHide";
45
+ export declare const OPTIONS = "options";
46
+ export declare const EXTERNAL_CLASSES = "externalClasses";
47
+ export declare const BEHAVIORS = "behaviors";
@@ -0,0 +1,19 @@
1
+ import { AppInstance, PageInstance } from './dsl/instance';
2
+ export interface Router {
3
+ params: Record<string, unknown>;
4
+ path: string;
5
+ $taroPath: string;
6
+ onReady: string;
7
+ onHide: string;
8
+ onShow: string;
9
+ exitState?: any;
10
+ }
11
+ interface Current {
12
+ app: AppInstance | null;
13
+ router: Router | null;
14
+ page: PageInstance | null;
15
+ preloadData?: any;
16
+ }
17
+ export declare const Current: Current;
18
+ export declare const getCurrentInstance: () => Current;
19
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { TaroElement } from './element';
2
+ export declare class ClassList extends Set<string> {
3
+ private el;
4
+ constructor(className: string, el: TaroElement);
5
+ get value(): string;
6
+ add(s: string): this;
7
+ get length(): number;
8
+ remove(s: string): void;
9
+ toggle(s: string): void;
10
+ replace(s1: string, s2: string): void;
11
+ contains(s: string): boolean;
12
+ toString(): string;
13
+ private _update;
14
+ }
@@ -0,0 +1,20 @@
1
+ import { TaroElement } from '../dom/element';
2
+ import { createEvent } from '../dom/event';
3
+ import { FormElement } from '../dom/form';
4
+ import { TaroRootElement } from '../dom/root';
5
+ import { TaroText } from '../dom/text';
6
+ export declare class TaroDocument extends TaroElement {
7
+ documentElement: TaroElement;
8
+ head: TaroElement;
9
+ body: TaroElement;
10
+ createEvent: typeof createEvent;
11
+ constructor();
12
+ createElement(type: string): TaroElement | TaroRootElement | FormElement;
13
+ createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
14
+ createTextNode(text: string): TaroText;
15
+ getElementById<T extends TaroElement>(id: string | undefined | null): T | null;
16
+ querySelector<T extends TaroElement>(query: string): T | null;
17
+ querySelectorAll(): never[];
18
+ createComment(): TaroText;
19
+ get defaultView(): any;
20
+ }
@@ -0,0 +1,38 @@
1
+ import type { Attributes, Func } from '../interface';
2
+ import { ClassList } from './class-list';
3
+ import type { TaroEvent } from './event';
4
+ import { TaroNode } from './node';
5
+ import { Style } from './style';
6
+ export declare class TaroElement extends TaroNode {
7
+ tagName: string;
8
+ props: Record<string, any>;
9
+ style: Style;
10
+ dataset: Record<string, unknown>;
11
+ innerHTML: string;
12
+ constructor();
13
+ private _stopPropagation;
14
+ get id(): string;
15
+ set id(val: string);
16
+ get className(): string;
17
+ set className(val: string);
18
+ get cssText(): string;
19
+ get classList(): ClassList;
20
+ get children(): TaroElement[];
21
+ get attributes(): Attributes[];
22
+ get textContent(): string;
23
+ set textContent(text: string);
24
+ hasAttribute(qualifiedName: string): boolean;
25
+ hasAttributes(): boolean;
26
+ get focus(): () => void;
27
+ set focus(value: () => void);
28
+ blur(): void;
29
+ setAttribute(qualifiedName: string, value: any): void;
30
+ removeAttribute(qualifiedName: string): void;
31
+ getAttribute(qualifiedName: string): string;
32
+ getElementsByTagName(tagName: string): TaroElement[];
33
+ getElementsByClassName(className: string): TaroElement[];
34
+ dispatchEvent(event: TaroEvent): boolean;
35
+ addEventListener(type: any, handler: any, options: any): void;
36
+ removeEventListener(type: any, handler: any, sideEffect?: boolean): void;
37
+ static extend(methodName: string, options: Func | Record<string, any>): void;
38
+ }
@@ -0,0 +1,7 @@
1
+ import type { TaroNode } from './node';
2
+ interface IEventSource extends Map<string | undefined | null, TaroNode> {
3
+ removeNode(child: TaroNode): void;
4
+ removeNodeTree(child: TaroNode): void;
5
+ }
6
+ export declare const eventSource: IEventSource;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { AddEventListenerOptions, EventHandler } from '../interface';
2
+ export declare class TaroEventTarget {
3
+ __handlers: Record<string, EventHandler[]>;
4
+ addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
5
+ removeEventListener(type: string, handler: EventHandler): void;
6
+ isAnyEventBinded(): boolean;
7
+ }
@@ -0,0 +1,22 @@
1
+ import type { EventOptions, MpEvent } from '../interface';
2
+ import type { TaroElement } from './element';
3
+ export declare class TaroEvent {
4
+ private cacheTarget;
5
+ private cacheCurrentTarget;
6
+ type: string;
7
+ bubbles: boolean;
8
+ cancelable: boolean;
9
+ _stop: boolean;
10
+ _end: boolean;
11
+ defaultPrevented: boolean;
12
+ timeStamp: number;
13
+ mpEvent: MpEvent | undefined;
14
+ constructor(type: string, opts: EventOptions, event?: MpEvent);
15
+ stopPropagation(): void;
16
+ stopImmediatePropagation(): void;
17
+ preventDefault(): void;
18
+ get target(): any;
19
+ get currentTarget(): any;
20
+ }
21
+ export declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
22
+ export declare function eventHandler(event: MpEvent): void;
@@ -0,0 +1,7 @@
1
+ import { TaroElement } from './element';
2
+ import type { TaroEvent } from './event';
3
+ export declare class FormElement extends TaroElement {
4
+ get value(): string | boolean | number | any[];
5
+ set value(val: string | boolean | number | any[]);
6
+ dispatchEvent(event: TaroEvent): boolean;
7
+ }
@@ -0,0 +1,75 @@
1
+ import type { Func, UpdatePayload } from '../interface';
2
+ import type { TaroDocument } from './document';
3
+ import type { TaroElement } from './element';
4
+ import { TaroEventTarget } from './event-target';
5
+ import { NodeType } from './node_types';
6
+ import type { TaroRootElement } from './root';
7
+ interface RemoveChildOptions {
8
+ cleanRef?: boolean;
9
+ doUpdate?: boolean;
10
+ }
11
+ export declare class TaroNode extends TaroEventTarget {
12
+ uid: string;
13
+ sid: string;
14
+ nodeType: NodeType;
15
+ nodeName: string;
16
+ parentNode: TaroNode | null;
17
+ childNodes: TaroNode[];
18
+ constructor();
19
+ private hydrate;
20
+ private updateChildNodes;
21
+ get _root(): TaroRootElement | null;
22
+ protected findIndex(refChild: TaroNode): number;
23
+ get _path(): string;
24
+ get nextSibling(): TaroNode | null;
25
+ get previousSibling(): TaroNode | null;
26
+ get parentElement(): TaroElement | null;
27
+ get firstChild(): TaroNode | null;
28
+ get lastChild(): TaroNode | null;
29
+ /**
30
+ * @textContent 目前只能置空子元素
31
+ * @TODO 等待完整 innerHTML 实现
32
+ */
33
+ set textContent(text: string);
34
+ /**
35
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/insertBefore
36
+ * @scenario
37
+ * [A,B,C]
38
+ * 1. insert D before C, D has no parent
39
+ * 2. insert D before C, D has the same parent of C
40
+ * 3. insert D before C, D has the different parent of C
41
+ */
42
+ insertBefore<T extends TaroNode>(newChild: T, refChild?: TaroNode | null, isReplace?: boolean): T;
43
+ /**
44
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/appendChild
45
+ * @scenario
46
+ * [A,B,C]
47
+ * 1. append C, C has no parent
48
+ * 2. append C, C has the same parent of B
49
+ * 3. append C, C has the different parent of B
50
+ */
51
+ appendChild(newChild: TaroNode): TaroNode;
52
+ /**
53
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
54
+ * @scenario
55
+ * [A,B,C]
56
+ * 1. replace B with C, C has no parent
57
+ * 2. replace B with C, C has no parent, C has the same parent of B
58
+ * 3. replace B with C, C has no parent, C has the different parent of B
59
+ */
60
+ replaceChild(newChild: TaroNode, oldChild: TaroNode): TaroNode | undefined;
61
+ /**
62
+ * @doc https://developer.mozilla.org/zh-CN/docs/Web/API/Node/removeChild
63
+ * @scenario
64
+ * [A,B,C]
65
+ * 1. remove A or B
66
+ * 2. remove C
67
+ */
68
+ removeChild<T extends TaroNode>(child: T, options?: RemoveChildOptions): T;
69
+ remove(options?: RemoveChildOptions): void;
70
+ hasChildNodes(): boolean;
71
+ enqueueUpdate(payload: UpdatePayload): void;
72
+ get ownerDocument(): TaroDocument;
73
+ static extend(methodName: string, options: Func | Record<string, any>): void;
74
+ }
75
+ export {};
@@ -0,0 +1,10 @@
1
+ export declare const enum NodeType {
2
+ ELEMENT_NODE = 1,
3
+ ATTRIBUTE_NODE = 2,
4
+ TEXT_NODE = 3,
5
+ CDATA_SECTION_NODE = 4,
6
+ ENTITY_REFERENCE_NODE = 5,
7
+ COMMENT_NODE = 6,
8
+ PROCESSING_INSTRUCTION_NODE = 7,
9
+ DOCUMENT_NODE = 9
10
+ }
@@ -0,0 +1,15 @@
1
+ import type { Func, MpInstance, UpdatePayload } from '../interface';
2
+ import { TaroElement } from './element';
3
+ export declare class TaroRootElement extends TaroElement {
4
+ private updatePayloads;
5
+ private updateCallbacks;
6
+ pendingUpdate: boolean;
7
+ ctx: null | MpInstance;
8
+ constructor();
9
+ get _path(): string;
10
+ get _root(): TaroRootElement;
11
+ enqueueUpdate(payload: UpdatePayload): void;
12
+ performUpdate(initRender?: boolean, prerender?: Func): void;
13
+ enqueueUpdateCallback(cb: Func, ctx?: Record<string, any>): void;
14
+ flushUpdateCallback(): void;
15
+ }
@@ -0,0 +1,14 @@
1
+ import { TaroElement } from './element';
2
+ export declare class Style {
3
+ _pending: boolean;
4
+ _usedStyleProp: Set<string>;
5
+ _value: Partial<CSSStyleDeclaration>;
6
+ _element: TaroElement;
7
+ constructor(element: TaroElement);
8
+ private setCssVariables;
9
+ get cssText(): string;
10
+ set cssText(str: string);
11
+ setProperty(propertyName: string, value?: string | null): void;
12
+ removeProperty(propertyName: string): string;
13
+ getPropertyValue(propertyName: string): any;
14
+ }
@@ -0,0 +1,3 @@
1
+ declare const styleProperties: string[];
2
+ /** 非常用 style */
3
+ export { styleProperties };
@@ -0,0 +1,3 @@
1
+ import { TaroElement } from './element';
2
+ export declare class SVGElement extends TaroElement {
3
+ }
@@ -0,0 +1,14 @@
1
+ import { TaroNode } from './node';
2
+ import { NodeType } from './node_types';
3
+ export declare class TaroText extends TaroNode {
4
+ _value: string;
5
+ nodeType: NodeType;
6
+ nodeName: string;
7
+ constructor(value: any);
8
+ set textContent(text: string);
9
+ get textContent(): string;
10
+ set nodeValue(text: string);
11
+ get nodeValue(): string;
12
+ set data(text: string);
13
+ get data(): string;
14
+ }
@@ -0,0 +1,4 @@
1
+ import type { TaroElement } from './element';
2
+ declare type Filter = (element: TaroElement) => boolean;
3
+ export declare function treeToArray(root: TaroElement, predict?: Filter): TaroElement[];
4
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { TaroElement } from 'src/dom/element';
2
+ export declare function getBoundingClientRectImpl(this: TaroElement): Promise<null>;
3
+ export declare function getTemplateContent(ctx: TaroElement): TaroElement | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { TaroNode } from '../../dom/node';
2
+ export declare function setInnerHTML(element: TaroNode, html: string): void;
@@ -0,0 +1,25 @@
1
+ import type { TaroDocument } from '../../dom/document';
2
+ import type { TaroElement } from '../../dom/element';
3
+ interface Node {
4
+ type: string;
5
+ }
6
+ interface Comment extends Node {
7
+ type: 'comment';
8
+ content: string;
9
+ }
10
+ export interface Text extends Node {
11
+ type: 'text';
12
+ content: string;
13
+ }
14
+ export interface Element extends Node {
15
+ type: 'element';
16
+ tagName: string;
17
+ children: ChildNode[];
18
+ attributes: string[];
19
+ }
20
+ export interface ParsedTaroElement extends TaroElement {
21
+ h5tagName?: string;
22
+ }
23
+ declare type ChildNode = Comment | Text | Element;
24
+ export declare function parser(html: string, document: TaroDocument): (import("../..").TaroText | TaroElement)[];
25
+ export {};
@@ -0,0 +1,30 @@
1
+ interface Position {
2
+ index: number;
3
+ column: number;
4
+ line: number;
5
+ }
6
+ export interface Token {
7
+ type: string;
8
+ content?: string;
9
+ position?: {
10
+ start?: Position;
11
+ end?: Position;
12
+ };
13
+ close?: boolean;
14
+ }
15
+ export declare class Scaner {
16
+ private tokens;
17
+ private position;
18
+ private html;
19
+ constructor(html: string);
20
+ scan(): Token[];
21
+ private scanText;
22
+ private scanComment;
23
+ private scanTag;
24
+ private scanTagStart;
25
+ private scanTagEnd;
26
+ private scanTagName;
27
+ private scanAttrs;
28
+ private scanSkipTag;
29
+ }
30
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { ParsedTaroElement } from './parser';
2
+ interface ISelector {
3
+ isChild: boolean;
4
+ isGeneralSibling: boolean;
5
+ isAdjacentSibling: boolean;
6
+ tag: string | null;
7
+ id: string | null;
8
+ class: string[];
9
+ attrs: {
10
+ all: boolean;
11
+ key: string;
12
+ value?: string | null;
13
+ }[];
14
+ }
15
+ interface IStyle {
16
+ content: string;
17
+ selectorList: ISelector[];
18
+ }
19
+ export default class StyleTagParser {
20
+ styles: IStyle[];
21
+ extractStyle(src: string): string;
22
+ stringToSelector(style: string): void;
23
+ parseSelector(src: string): ISelector[];
24
+ matchStyle(tagName: string, el: ParsedTaroElement, list: number[]): string;
25
+ matchCurrent(tagName: string, el: ParsedTaroElement, selector: ISelector): boolean;
26
+ }
27
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
2
+ export declare const specialMiniElements: {
3
+ img: string;
4
+ iframe: string;
5
+ };
6
+ export declare const isMiniElements: (key: string) => boolean;
7
+ export declare const isInlineElements: (key: string) => boolean;
8
+ export declare const isBlockElements: (key: string) => boolean;
@@ -0,0 +1 @@
1
+ export declare function unquote(str: string): string;
@@ -0,0 +1,52 @@
1
+ import type { TaroNode } from '../../dom/node';
2
+ import type { MutationRecord } from './record';
3
+ export declare type MutationCallback = (mutations: MutationRecord[]) => any;
4
+ /**
5
+ * @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
6
+ */
7
+ export interface MutationObserverInit {
8
+ attributeFilter?: string[];
9
+ attributeOldValue?: boolean;
10
+ attributes?: boolean;
11
+ characterData?: boolean;
12
+ characterDataOldValue?: boolean;
13
+ childList?: boolean;
14
+ subtree?: boolean;
15
+ }
16
+ /**
17
+ * The MutationObserver provides the ability
18
+ * to watch for changes being made to the DOM tree.
19
+ * It will invoke a specified callback function
20
+ * when DOM changes occur.
21
+ * @see https://dom.spec.whatwg.org/#mutationobserver
22
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
23
+ */
24
+ export declare class MutationObserverImpl {
25
+ callback: MutationCallback;
26
+ target: TaroNode | null;
27
+ options: MutationObserverInit;
28
+ records: MutationRecord[];
29
+ constructor(callback: MutationCallback);
30
+ /**
31
+ * Configures the MutationObserver
32
+ * to begin receiving notifications
33
+ * through its callback function
34
+ * when DOM changes matching the given options occur.
35
+ *
36
+ * Options matching is to be implemented.
37
+ */
38
+ observe(target: TaroNode, options?: MutationObserverInit): void;
39
+ /**
40
+ * Stop the MutationObserver instance
41
+ * from receiving further notifications
42
+ * until and unless observe() is called again.
43
+ */
44
+ disconnect(): void;
45
+ /**
46
+ * Removes all pending notifications
47
+ * from the MutationObserver's notification queue
48
+ * and returns them in a new Array of MutationRecord objects.
49
+ */
50
+ takeRecords(): MutationRecord[];
51
+ }
52
+ export declare function recordMutation(record: MutationRecord): void;
@@ -0,0 +1,13 @@
1
+ import type { TaroNode } from '../../dom/node';
2
+ import type { MutationCallback, MutationObserverInit } from './implements';
3
+ import { MutationObserverImpl } from './implements';
4
+ import { MutationRecord, MutationRecordType } from './record';
5
+ export declare class MutationObserver {
6
+ core: Pick<MutationObserverImpl, 'observe' | 'disconnect' | 'takeRecords'>;
7
+ constructor(callback: MutationCallback);
8
+ observe(...args: [TaroNode, MutationObserverInit?]): void;
9
+ disconnect(): void;
10
+ takeRecords(): MutationRecord[];
11
+ static record(record: MutationRecord): void;
12
+ }
13
+ export { MutationRecordType };
@@ -0,0 +1,24 @@
1
+ import type { TaroNode } from '../../dom/node';
2
+ /**
3
+ * A MutationRecord represents an individual DOM mutation.
4
+ * It is the object that is passed to MutationObserver's callback.
5
+ * @see https://dom.spec.whatwg.org/#interface-mutationrecord
6
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
7
+ */
8
+ export interface MutationRecord {
9
+ readonly target: TaroNode;
10
+ readonly addedNodes?: TaroNode[];
11
+ readonly removedNodes?: TaroNode[];
12
+ readonly previousSibling?: TaroNode | null;
13
+ readonly nextSibling?: TaroNode | null;
14
+ readonly attributeName?: string | null;
15
+ readonly attributeNamespace?: string | null;
16
+ oldValue?: string | null;
17
+ readonly type: MutationRecordType;
18
+ readonly value?: string | null;
19
+ }
20
+ export declare const enum MutationRecordType {
21
+ ATTRIBUTES = "attributes",
22
+ CHARACTER_DATA = "characterData",
23
+ CHILD_LIST = "childList"
24
+ }
@@ -0,0 +1,11 @@
1
+ import type { TaroNode } from 'src/dom/node';
2
+ export declare type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
3
+ /**
4
+ * An implementation of `Element.insertAdjacentHTML()`
5
+ * to support Vue 3 with a version of or greater than `vue@3.1.2`
6
+ */
7
+ export declare function insertAdjacentHTML(this: TaroNode, position: IPosition, html: string): void;
8
+ export declare function cloneNode(this: TaroNode, isDeep?: boolean): any;
9
+ export declare function contains(this: TaroNode, node: TaroNode & {
10
+ id?: string;
11
+ }): boolean;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import type { PageConfig } from '@tarojs/taro';
3
+ import type { Instance, PageInstance, PageProps } from './instance';
4
+ export declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
5
+ export declare function getPageInstance(id: string): Instance | undefined;
6
+ export declare function addLeadingSlash(path?: string): string;
7
+ export declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
8
+ export declare function stringify(obj?: Record<string, unknown>): string;
9
+ export declare function getPath(id: string, options?: Record<string, unknown>): string;
10
+ export declare function getOnReadyEventKey(path: string): string;
11
+ export declare function getOnShowEventKey(path: string): string;
12
+ export declare function getOnHideEventKey(path: string): string;
13
+ export declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
14
+ export declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
15
+ export declare function createRecursiveComponentConfig(componentName?: string): any;