@tarojs/runtime 3.5.0-canary.1 → 3.5.0-theta.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 (68) hide show
  1. package/dist/runtime.esm.d.ts +537 -0
  2. package/dist/runtime.esm.js +3129 -4650
  3. package/dist/runtime.esm.js.map +1 -1
  4. package/package.json +5 -11
  5. package/LICENSE +0 -21
  6. package/dist/bom/document.d.ts +0 -3
  7. package/dist/bom/getComputedStyle.d.ts +0 -3
  8. package/dist/bom/navigator.d.ts +0 -15
  9. package/dist/bom/raf.d.ts +0 -4
  10. package/dist/bom/window.d.ts +0 -1
  11. package/dist/constants/events.d.ts +0 -5
  12. package/dist/constants/identifiers.d.ts +0 -61
  13. package/dist/constants/index.d.ts +0 -47
  14. package/dist/container/default-hooks.d.ts +0 -4
  15. package/dist/container/index.d.ts +0 -3
  16. package/dist/container/plugin-hooks.d.ts +0 -2
  17. package/dist/container/store.d.ts +0 -15
  18. package/dist/current.d.ts +0 -17
  19. package/dist/dom/class-list.d.ts +0 -14
  20. package/dist/dom/document.d.ts +0 -17
  21. package/dist/dom/element.d.ts +0 -37
  22. package/dist/dom/event-source.d.ts +0 -7
  23. package/dist/dom/event-target.d.ts +0 -9
  24. package/dist/dom/event.d.ts +0 -26
  25. package/dist/dom/form.d.ts +0 -7
  26. package/dist/dom/node.d.ts +0 -79
  27. package/dist/dom/node_types.d.ts +0 -10
  28. package/dist/dom/root.d.ts +0 -15
  29. package/dist/dom/style.d.ts +0 -13
  30. package/dist/dom/style_properties.d.ts +0 -3
  31. package/dist/dom/svg.d.ts +0 -3
  32. package/dist/dom/text.d.ts +0 -13
  33. package/dist/dom/tree.d.ts +0 -4
  34. package/dist/dom-external/element-impl.d.ts +0 -4
  35. package/dist/dom-external/element.d.ts +0 -4
  36. package/dist/dom-external/inner-html/html.d.ts +0 -3
  37. package/dist/dom-external/inner-html/parser.d.ts +0 -25
  38. package/dist/dom-external/inner-html/scaner.d.ts +0 -30
  39. package/dist/dom-external/inner-html/style.d.ts +0 -27
  40. package/dist/dom-external/inner-html/tags.d.ts +0 -8
  41. package/dist/dom-external/inner-html/utils.d.ts +0 -1
  42. package/dist/dom-external/mutation-observer/implements.d.ts +0 -52
  43. package/dist/dom-external/mutation-observer/index.d.ts +0 -12
  44. package/dist/dom-external/mutation-observer/record.d.ts +0 -24
  45. package/dist/dom-external/node-impl.d.ts +0 -8
  46. package/dist/dom-external/node.d.ts +0 -12
  47. package/dist/dsl/common.d.ts +0 -15
  48. package/dist/dsl/instance.d.ts +0 -82
  49. package/dist/emitter/emitter.d.ts +0 -29
  50. package/dist/env.d.ts +0 -2
  51. package/dist/hooks.d.ts +0 -32
  52. package/dist/hydrate.d.ts +0 -10
  53. package/dist/index.d.ts +0 -29
  54. package/dist/interface/container.d.ts +0 -12
  55. package/dist/interface/document.d.ts +0 -14
  56. package/dist/interface/element.d.ts +0 -4
  57. package/dist/interface/event-target.d.ts +0 -10
  58. package/dist/interface/event.d.ts +0 -15
  59. package/dist/interface/hooks.d.ts +0 -162
  60. package/dist/interface/hydrate.d.ts +0 -29
  61. package/dist/interface/index.d.ts +0 -10
  62. package/dist/interface/node.d.ts +0 -7
  63. package/dist/interface/options.d.ts +0 -16
  64. package/dist/interface/utils.d.ts +0 -2
  65. package/dist/next-tick.d.ts +0 -2
  66. package/dist/options.d.ts +0 -2
  67. package/dist/perf.d.ts +0 -7
  68. package/dist/utils/index.d.ts +0 -16
@@ -1,52 +0,0 @@
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;
@@ -1,12 +0,0 @@
1
- import { MutationObserverImpl } from './implements';
2
- import { MutationRecord } from './record';
3
- import type { MutationCallback, MutationObserverInit } from './implements';
4
- import type { TaroNode } from '../../dom/node';
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
- }
@@ -1,24 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
1
- import { InstanceNamedFactory } from '../interface';
2
- import type { Ctx, GetDoc } from '../interface';
3
- export declare class TaroNodeImpl {
4
- getDoc: GetDoc;
5
- constructor(// eslint-disable-next-line @typescript-eslint/indent
6
- getElement: InstanceNamedFactory);
7
- bind(ctx: Ctx): void;
8
- }
@@ -1,12 +0,0 @@
1
- import { GetDoc } from '../interface';
2
- import type { TaroNode } from 'src/dom/node';
3
- export declare type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
4
- /**
5
- * An implementation of `Element.insertAdjacentHTML()`
6
- * to support Vue 3 with a version of or greater than `vue@3.1.2`
7
- */
8
- export declare function insertAdjacentHTMLImpl(this: TaroNode, getDoc: GetDoc, position: IPosition, html: string): void;
9
- export declare function cloneNode(this: TaroNode, getDoc: any, isDeep?: boolean): any;
10
- export declare function contains(this: TaroNode, node: TaroNode & {
11
- id?: string;
12
- }): boolean;
@@ -1,15 +0,0 @@
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;
@@ -1,82 +0,0 @@
1
- import type { Component, ComponentClass } from 'react';
2
- import VueCtor, { ComponentOptions, VNode } from 'vue';
3
- import type { Component as Vue3Component } from '@vue/runtime-core';
4
- import type { CombinedVueInstance } from 'vue/types/vue';
5
- import type { Func, MpEvent } from '../interface';
6
- import type { TaroElement } from '../dom/element';
7
- export interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
8
- tid?: string;
9
- $forceUpdate?(): void;
10
- $nextTick?(cb: () => void): void;
11
- $options: Instance;
12
- }
13
- export interface VueAppInstance extends ComponentOptions<VueCtor> {
14
- $options: AppInstance;
15
- }
16
- export declare type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
17
- interface VueInternal {
18
- _render(): VNode;
19
- _update(vnode: VNode, hyrate: boolean): void;
20
- }
21
- export interface PageProps {
22
- tid?: string;
23
- }
24
- export interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
25
- }
26
- export interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
27
- componentDidShow?(): void;
28
- componentDidHide?(): void;
29
- }
30
- export interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
31
- }
32
- export interface PageLifeCycle extends Show {
33
- onPullDownRefresh?(): void;
34
- onReachBottom?(): void;
35
- onPageScroll?(obj: {
36
- scrollTop: number;
37
- }): void;
38
- onShareAppMessage?(obj: {
39
- from: string;
40
- target?: TaroElement;
41
- webViewUrl: string;
42
- }): void;
43
- onResize?(options: unknown): void;
44
- onTabItemTap?(obj: {
45
- index: string;
46
- pagePath: string;
47
- text: string;
48
- }): void;
49
- onTitleClick?(): void;
50
- onOptionMenuClick?(): void;
51
- onPopMenuClick?(): void;
52
- onReady?(): void;
53
- onPullIntercept?(): void;
54
- onShareTimeline?(): void;
55
- onAddToFavorites?(): void;
56
- eh?(event: MpEvent): void;
57
- onLoad?(options: Record<string, unknown>, cb?: Func): void;
58
- onUnload?(): void;
59
- }
60
- export interface PageInstance extends PageLifeCycle {
61
- data?: Record<string, unknown>;
62
- path?: string;
63
- options?: Record<string, unknown>;
64
- }
65
- interface Show {
66
- componentDidShow?(): void;
67
- componentDidHide?(): void;
68
- onShow?(): void;
69
- onHide?(): void;
70
- }
71
- export interface AppInstance extends Show {
72
- onLaunch?(options?: Record<string, unknown>): void;
73
- mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
74
- mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: () => void): void;
75
- componentDidShow?(options?: Record<string, unknown>): void;
76
- onShow?(options?: Record<string, unknown>): void;
77
- unmount?(id: string): void;
78
- unmount?(id: string, cb: () => void): void;
79
- onPageNotFound?(res: any): void;
80
- taroGlobalData?: Record<any, any>;
81
- }
82
- export {};
@@ -1,29 +0,0 @@
1
- declare type Callback1<T1> = (arg1: T1) => any;
2
- declare type Callback2<T1, T2> = (arg1: T1, arg2: T2) => any;
3
- declare type Callback3<T1, T2, T3> = (arg1: T1, arg2: T2, arg3: T3) => any;
4
- declare type Callback4<T1, T2, T3, T4> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => any;
5
- declare type Callback5<T1, T2, T3, T4, T5> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => any;
6
- declare type Callback6Rest<T1, T2, T3, T4, T5, T6> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, ...rest: any[]) => any;
7
- export declare class Events {
8
- private callbacks?;
9
- static eventSplitter: RegExp;
10
- constructor(opts?: any);
11
- on<T>(event: string, callback: Callback1<T>, context: any): this;
12
- on<T1, T2>(event: string, callback: Callback2<T1, T2>, context: any): this;
13
- on<T1, T2, T3>(event: string, callback: Callback3<T1, T2, T3>, context: any): this;
14
- on<T1, T2, T3, T4>(event: string, callback: Callback4<T1, T2, T3, T4>, comtext: any): this;
15
- on<T1, T2, T3, T4, T5>(event: string, callback: Callback5<T1, T2, T3, T4, T5>, context: any): this;
16
- on<T1, T2, T3, T4, T5, T6>(event: string, callback: Callback6Rest<T1, T2, T3, T4, T5, T6>, context: any): this;
17
- once(events: any, callback: any, context: any): this;
18
- off(events: any, callback: any, context: any): this;
19
- trigger(event: string): any;
20
- trigger<T1>(event: string, arg: T1): any;
21
- trigger<T1, T2>(event: string, arg1: T1, arg2: T2): any;
22
- trigger<T1, T2, T3>(event: string, arg1: T1, arg2: T2, arg3: T3): any;
23
- trigger<T1, T2, T3, T4>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4): any;
24
- trigger<T1, T2, T3, T4, T5>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): any;
25
- trigger<T1, T2, T3, T4, T5, T6>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, ...rest: any[]): any;
26
- }
27
- export declare type EventsType = typeof Events;
28
- declare const eventCenter: Events;
29
- export { eventCenter };
package/dist/env.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const doc: Document;
2
- export declare const win: Window;
package/dist/hooks.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import type { TaroElement } from './dom/element';
2
- import type { TaroEvent } from './dom/event';
3
- import type { IHooks, OnRemoveAttribute, GetMiniLifecycle, GetLifecycle, GetPathIndex, GetEventCenter, ModifyMpEvent, ModifyTaroEvent, ModifyDispatchEvent, IsBubbleEvents, GetSpecialNodes, BatchedEventUpdates, MergePageInstance, CreatePullDownComponent, GetDOMNode, InitNativeApi, ModifySetAttrPayload, ModifyHydrateData, ModifyRmAttrPayload, MpEvent, OnAddEvent, PatchElement, ModifyPageObject } from './interface';
4
- export declare class Hooks implements IHooks {
5
- getMiniLifecycle: GetMiniLifecycle;
6
- getMiniLifecycleImpl(): import("./interface").MiniLifecycle;
7
- getLifecycle: GetLifecycle;
8
- getPathIndex: GetPathIndex;
9
- getEventCenter: GetEventCenter;
10
- isBubbleEvents: IsBubbleEvents;
11
- getSpecialNodes: GetSpecialNodes;
12
- onRemoveAttribute?: OnRemoveAttribute;
13
- batchedEventUpdates?: BatchedEventUpdates;
14
- mergePageInstance?: MergePageInstance;
15
- modifyPageObject?: ModifyPageObject;
16
- createPullDownComponent?: CreatePullDownComponent;
17
- getDOMNode?: GetDOMNode;
18
- modifyHydrateData?: ModifyHydrateData;
19
- modifySetAttrPayload?: ModifySetAttrPayload;
20
- modifyRmAttrPayload?: ModifyRmAttrPayload;
21
- onAddEvent?: OnAddEvent;
22
- modifyMpEventImpls?: ModifyMpEvent[];
23
- modifyMpEvent(e: MpEvent): void;
24
- modifyTaroEventImpls?: ModifyTaroEvent[];
25
- modifyTaroEvent(e: TaroEvent, element: TaroElement): void;
26
- modifyDispatchEventImpls?: ModifyDispatchEvent[];
27
- modifyDispatchEvent(e: TaroEvent, element: TaroElement): void;
28
- initNativeApiImpls?: InitNativeApi[];
29
- initNativeApi(taro: Record<string, any>): void;
30
- patchElementImpls?: PatchElement[];
31
- patchElement(element: TaroElement): void;
32
- }
package/dist/hydrate.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { MiniData } from './interface';
2
- import type { TaroElement } from './dom/element';
3
- import type { TaroText } from './dom/text';
4
- /**
5
- * React also has a fancy function's name for this: `hydrate()`.
6
- * You may have been heard `hydrate` as a SSR-related function,
7
- * actually, `hydrate` basicly do the `render()` thing, but ignore some properties,
8
- * it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
9
- */
10
- export declare function hydrate(node: TaroElement | TaroText): MiniData;
package/dist/index.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import './polyfill/reflect-metadata';
2
- export { TaroNode } from './dom/node';
3
- export { TaroText } from './dom/text';
4
- export { TaroElement } from './dom/element';
5
- export { TaroRootElement } from './dom/root';
6
- export { FormElement } from './dom/form';
7
- export { SVGElement } from './dom/svg';
8
- export { MutationObserver } from './dom-external/mutation-observer';
9
- export { TaroEvent, createEvent, eventHandler } from './dom/event';
10
- export { createDocument, document } from './bom/document';
11
- export { window } from './bom/window';
12
- export { navigator } from './bom/navigator';
13
- export { default as container } from './container';
14
- export { default as processPluginHooks } from './container/plugin-hooks';
15
- export { default as SERVICE_IDENTIFIER } from './constants/identifiers';
16
- export { addLeadingSlash, safeExecute } from './dsl/common';
17
- export * from './dsl/instance';
18
- export { createPageConfig, injectPageInstance, createComponentConfig, createRecursiveComponentConfig, stringify, getPageInstance } from './dsl/common';
19
- export { Current, getCurrentInstance } from './current';
20
- export { Style } from './dom/style';
21
- export { options } from './options';
22
- export { nextTick } from './next-tick';
23
- export { hydrate } from './hydrate';
24
- export * from './emitter/emitter';
25
- export { raf as requestAnimationFrame, caf as cancelAnimationFrame, now } from './bom/raf';
26
- export { getComputedStyle } from './bom/getComputedStyle';
27
- export * from './interface';
28
- export { incrementId } from './utils';
29
- export { eventSource } from './dom/event-source';
@@ -1,12 +0,0 @@
1
- export declare enum ElementNames {
2
- Element = "Element",
3
- Document = "Document",
4
- RootElement = "RootElement",
5
- FormElement = "FormElement"
6
- }
7
- export interface InstanceFactory<T> {
8
- (...args: any[]): T;
9
- }
10
- export interface InstanceNamedFactory {
11
- <T>(named: string): (...args: any[]) => T;
12
- }
@@ -1,14 +0,0 @@
1
- import type { createEvent } from '../dom/event';
2
- import type { TaroDocument } from '../dom/document';
3
- import type { TaroElement } from '../dom/element';
4
- export interface GetDoc {
5
- (): TaroDocument;
6
- }
7
- export interface TaroDocumentInstance extends TaroDocument {
8
- new (): TaroDocument;
9
- documentElement: TaroElement;
10
- head: TaroElement;
11
- body: TaroElement;
12
- createEvent: typeof createEvent;
13
- defaultView: any;
14
- }
@@ -1,4 +0,0 @@
1
- export interface Attributes {
2
- name: string;
3
- value: string;
4
- }
@@ -1,10 +0,0 @@
1
- export interface EventListenerOptions {
2
- capture?: boolean;
3
- }
4
- export interface AddEventListenerOptions extends EventListenerOptions {
5
- once?: boolean;
6
- passive?: boolean;
7
- }
8
- export interface EventHandler extends Function {
9
- _stop?: boolean;
10
- }
@@ -1,15 +0,0 @@
1
- export interface EventOptions {
2
- bubbles: boolean;
3
- cancelable: boolean;
4
- }
5
- declare type Target = Record<string, unknown> & {
6
- dataset: Record<string, unknown>;
7
- id: string;
8
- };
9
- export interface MpEvent {
10
- type: string;
11
- detail: Record<string, unknown>;
12
- target: Target;
13
- currentTarget: Target;
14
- }
15
- export {};
@@ -1,162 +0,0 @@
1
- import type { TaroElement } from '../dom/element';
2
- import type { PageInstance, Instance, PageProps } from '../dsl/instance';
3
- import type { Func, MpEvent, EventHandler, UpdatePayload } from '../interface';
4
- import type { EventsType } from '../emitter/emitter';
5
- import type { TaroEvent } from '../dom/event';
6
- import type { TaroEventTarget } from '../dom/event-target';
7
- export interface MiniLifecycle {
8
- app: [
9
- string,
10
- string,
11
- string /** onHide */
12
- ];
13
- page: [
14
- string,
15
- string,
16
- string,
17
- string,
18
- string,
19
- string[] /** others */
20
- ];
21
- }
22
- export interface GetMiniLifecycle {
23
- (defaultConfig: MiniLifecycle): MiniLifecycle;
24
- }
25
- export interface GetLifecycle<Instance = any> {
26
- (instance: Instance, lifecyle: keyof PageInstance): Func | Array<Func> | undefined;
27
- }
28
- export interface GetPathIndex {
29
- (indexOfNode: number): string;
30
- }
31
- export interface GetEventCenter {
32
- (Events: EventsType): InstanceType<EventsType>;
33
- }
34
- export interface IsBubbleEvents {
35
- (eventName: string): boolean;
36
- }
37
- export interface GetSpecialNodes {
38
- (): string[];
39
- }
40
- export interface OnRemoveAttribute {
41
- (element: TaroElement, qualifiedName: string): void;
42
- }
43
- export interface ModifyMpEvent {
44
- (event: MpEvent): void;
45
- }
46
- export interface ModifyTaroEvent {
47
- (event: TaroEvent, element: TaroElement): void;
48
- }
49
- export interface ModifyDispatchEvent {
50
- (event: TaroEvent, element: TaroElement): void;
51
- }
52
- export interface BatchedEventUpdates {
53
- (cb: Func): void;
54
- }
55
- declare type Inst = Instance<PageProps>;
56
- export interface MergePageInstance {
57
- (prev: Inst | undefined, next: Inst): void;
58
- }
59
- export interface CreatePullDownComponent<Instance = any> {
60
- (el: Instance, path: string, framework: any, customWrapper?: any): void;
61
- }
62
- export interface GetDOMNode<Instance = any, DOMElement = TaroElement> {
63
- (instance: Instance): DOMElement | undefined;
64
- }
65
- export interface InitNativeApi {
66
- (taro: Record<string, any>): void;
67
- }
68
- export interface ModifyHydrateData {
69
- (data: Record<string, any>): void;
70
- }
71
- export interface ModifySetAttrPayload {
72
- (element: TaroElement, key: string, payload: UpdatePayload): void;
73
- }
74
- export interface ModifyRmAttrPayload {
75
- (element: TaroElement, key: string, payload: UpdatePayload): void;
76
- }
77
- export interface OnAddEvent<T extends TaroEventTarget = TaroEventTarget> {
78
- (type: string, handler: EventHandler, options: any, node: T): void;
79
- }
80
- export interface PatchElement {
81
- (node: TaroElement): void;
82
- }
83
- export interface ModifyPageObject {
84
- (config: Record<any, any>): void;
85
- }
86
- export interface IHooks {
87
- /** 小程序端 App、Page 构造对象的生命周期方法名称 */
88
- getMiniLifecycle: GetMiniLifecycle;
89
- getMiniLifecycleImpl: () => MiniLifecycle;
90
- /** 解决 React 生命周期名称的兼容问题 */
91
- getLifecycle: GetLifecycle;
92
- /** 解决百度小程序的模版语法问题 */
93
- getPathIndex: GetPathIndex;
94
- /** 解决支付宝小程序分包时全局作用域不一致的问题 */
95
- getEventCenter: GetEventCenter;
96
- isBubbleEvents: IsBubbleEvents;
97
- getSpecialNodes: GetSpecialNodes;
98
- /** 解决 Vue2 布尔值属性值的设置问题 */
99
- onRemoveAttribute?: OnRemoveAttribute;
100
- /**
101
- * @multi-inject
102
- * 用于修改小程序原生事件对象
103
- **/
104
- modifyMpEventImpls?: ModifyMpEvent[];
105
- modifyMpEvent: ModifyMpEvent;
106
- /**
107
- * @multi-inject
108
- * 用于修改 Taro DOM 事件对象
109
- **/
110
- modifyTaroEventImpls?: ModifyTaroEvent[];
111
- modifyTaroEvent: ModifyTaroEvent;
112
- /**
113
- * @multi-inject
114
- * 用于修改触发回调前的 Taro DOM 事件对象
115
- * 比 modifyTaroEvent 稍晚,为了可以在 el.__handlers[event.type] 取得回调函数后再修改事件对象
116
- **/
117
- modifyDispatchEventImpls?: ModifyDispatchEvent[];
118
- modifyDispatchEvent: ModifyDispatchEvent;
119
- /** 用于把 React 同一事件回调中的所有 setState 合并到同一个更新处理中 */
120
- batchedEventUpdates?: BatchedEventUpdates;
121
- /** 用于处理 React 中的小程序生命周期 hooks */
122
- mergePageInstance?: MergePageInstance;
123
- /** 用于修改传递给小程序 Page 构造器的对象 */
124
- modifyPageObject?: ModifyPageObject;
125
- /** H5 下拉刷新 wrapper */
126
- createPullDownComponent?: CreatePullDownComponent;
127
- /** H5 获取原生 DOM 对象 */
128
- getDOMNode?: GetDOMNode;
129
- /**
130
- * @multi-inject
131
- * 挂载属性或 API 到 Taro 对象上
132
- **/
133
- initNativeApiImpls?: InitNativeApi[];
134
- initNativeApi?: InitNativeApi;
135
- /**
136
- * @todo: mutiInject
137
- * 修改 Taro DOM 序列化数据
138
- **/
139
- modifyHydrateData?: ModifyHydrateData;
140
- /**
141
- * @todo: mutiInject
142
- * 修改 Taro DOM 序列化数据
143
- **/
144
- modifySetAttrPayload?: ModifySetAttrPayload;
145
- /**
146
- * @todo: mutiInject
147
- * 修改 Taro DOM 序列化数据
148
- **/
149
- modifyRmAttrPayload?: ModifyRmAttrPayload;
150
- /**
151
- * @todo: mutiInject
152
- * 调用 addEventListener 时触发
153
- **/
154
- onAddEvent?: OnAddEvent;
155
- /**
156
- * @todo: mutiInject
157
- * 给 TaroElement 实例注入属性或方法
158
- **/
159
- patchElementImpls?: PatchElement[];
160
- patchElement?: PatchElement;
161
- }
162
- export {};
@@ -1,29 +0,0 @@
1
- import type { Shortcuts } from '@tarojs/shared';
2
- import type { PageConfig } from '@tarojs/taro';
3
- export interface MpInstance {
4
- config: PageConfig;
5
- setData: (data: unknown, cb: () => void) => void;
6
- route?: string;
7
- __route__: string;
8
- $taroParams?: Record<string, unknown>;
9
- $taroPath: string;
10
- __data__: any;
11
- data: any;
12
- selectComponent: (selector: string) => any;
13
- }
14
- export interface MiniElementData {
15
- [Shortcuts.Childnodes]?: MiniData[];
16
- [Shortcuts.NodeName]: string;
17
- [Shortcuts.Class]?: string;
18
- [Shortcuts.Style]?: string;
19
- uid?: string;
20
- sid: string;
21
- [key: string]: unknown;
22
- }
23
- interface MiniTextData {
24
- [Shortcuts.Text]: string;
25
- [Shortcuts.NodeName]: string;
26
- }
27
- export declare type MiniData = MiniElementData | MiniTextData;
28
- export declare type HydratedData = () => MiniData | MiniData[];
29
- export {};
@@ -1,10 +0,0 @@
1
- export * from './event-target';
2
- export * from './node';
3
- export * from './element';
4
- export * from './document';
5
- export * from './hydrate';
6
- export * from './container';
7
- export * from './event';
8
- export * from './options';
9
- export * from './utils';
10
- export * from './hooks';
@@ -1,7 +0,0 @@
1
- import { HydratedData } from './index';
2
- export declare type UpdatePayloadValue = string | boolean | HydratedData;
3
- export declare type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
4
- export interface UpdatePayload {
5
- path: string;
6
- value: UpdatePayloadValue;
7
- }
@@ -1,16 +0,0 @@
1
- import type { TaroText } from '../dom/text';
2
- import type { TaroElement } from '../dom/element';
3
- import type { Text, Element } from '../dom-external/inner-html/parser';
4
- export interface Options {
5
- prerender: boolean;
6
- debug: boolean;
7
- html?: {
8
- skipElements: Set<string>;
9
- voidElements: Set<string>;
10
- closingElements: Set<string>;
11
- transformText?: (taroText: TaroText, text: Text) => TaroText;
12
- transformElement?: (taroElement: TaroElement, element: Element) => TaroElement;
13
- renderHTMLTag: boolean;
14
- };
15
- miniGlobal?: any;
16
- }
@@ -1,2 +0,0 @@
1
- export declare type Func = (...args: any[]) => any;
2
- export declare type Ctx = Record<string, any>;
@@ -1,2 +0,0 @@
1
- import type { Func } from './interface';
2
- export declare const nextTick: (cb: Func, ctx?: Record<string, any> | undefined) => void;
package/dist/options.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import type { Options } from './interface';
2
- export declare const options: Options;
package/dist/perf.d.ts DELETED
@@ -1,7 +0,0 @@
1
- declare class Performance {
2
- private recorder;
3
- start(id: string): void;
4
- stop(id: string): void;
5
- }
6
- export declare const perf: Performance;
7
- export {};
@@ -1,16 +0,0 @@
1
- import type { TaroElement } from '../dom/element';
2
- import type { TaroText } from '../dom/text';
3
- import type { TaroNode } from '../dom/node';
4
- export declare const incrementId: () => () => string;
5
- export declare function isElement(node: TaroNode): node is TaroElement;
6
- export declare function isText(node: TaroNode): node is TaroText;
7
- export declare function isComment(node: TaroNode): boolean;
8
- export declare function isHasExtractProp(el: TaroElement): boolean;
9
- /**
10
- * 往上寻找组件树直到 root,寻找是否有祖先组件绑定了同类型的事件
11
- * @param node 当前组件
12
- * @param type 事件类型
13
- */
14
- export declare function isParentBinded(node: TaroElement | null, type: string): boolean;
15
- export declare function shortcutAttr(key: string): string;
16
- export declare const customWrapperCache: Map<string, Record<string, any>>;