@tarojs/runtime 3.5.0-beta.0 → 3.5.0-beta.1

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 (38) hide show
  1. package/dist/bom/document.d.ts +2 -3
  2. package/dist/bom/navigator.d.ts +1 -15
  3. package/dist/bom/raf.d.ts +2 -2
  4. package/dist/bom/window.d.ts +2 -1
  5. package/dist/current.d.ts +1 -0
  6. package/dist/dom/document.d.ts +10 -7
  7. package/dist/dom/element.d.ts +4 -3
  8. package/dist/dom/event-target.d.ts +1 -3
  9. package/dist/dom/event.d.ts +1 -1
  10. package/dist/dom/node.d.ts +5 -5
  11. package/dist/dom/root.d.ts +1 -1
  12. package/dist/dom/text.d.ts +1 -0
  13. package/dist/dom-external/element.d.ts +1 -2
  14. package/dist/dom-external/index.d.ts +1 -0
  15. package/dist/dom-external/inner-html/html.d.ts +1 -2
  16. package/dist/dom-external/mutation-observer/index.d.ts +4 -3
  17. package/dist/dom-external/node.d.ts +2 -3
  18. package/dist/emitter/emitter.d.ts +3 -28
  19. package/dist/env.d.ts +7 -2
  20. package/dist/hydrate.d.ts +1 -1
  21. package/dist/index.d.ts +19 -22
  22. package/dist/interface/index.d.ts +3 -6
  23. package/dist/runtime.esm.js +1214 -2869
  24. package/dist/runtime.esm.js.map +1 -1
  25. package/dist/utils/index.d.ts +7 -1
  26. package/package.json +4 -6
  27. package/dist/constants/events.d.ts +0 -5
  28. package/dist/constants/identifiers.d.ts +0 -61
  29. package/dist/container/default-hooks.d.ts +0 -4
  30. package/dist/container/index.d.ts +0 -3
  31. package/dist/container/plugin-hooks.d.ts +0 -2
  32. package/dist/container/store.d.ts +0 -15
  33. package/dist/dom-external/element-impl.d.ts +0 -4
  34. package/dist/dom-external/node-impl.d.ts +0 -8
  35. package/dist/hooks.d.ts +0 -32
  36. package/dist/interface/container.d.ts +0 -12
  37. package/dist/interface/document.d.ts +0 -14
  38. package/dist/interface/hooks.d.ts +0 -162
@@ -1,3 +1,2 @@
1
- import type { TaroDocumentInstance } from '../interface';
2
- export declare function createDocument(): TaroDocumentInstance;
3
- export declare const document: TaroDocumentInstance;
1
+ declare let document: any;
2
+ export { document };
@@ -1,15 +1 @@
1
- export declare const navigator: Navigator | {
2
- appCodeName: string;
3
- appName: string;
4
- appVersion: string;
5
- cookieEnabled: boolean;
6
- mimeTypes: never[];
7
- onLine: boolean;
8
- platform: string;
9
- plugins: never[];
10
- product: string;
11
- productSub: string;
12
- userAgent: string;
13
- vendor: string;
14
- vendorSub: string;
15
- };
1
+ export declare const navigator: any;
package/dist/bom/raf.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- export declare let now: any;
2
+ export declare let now: () => number;
3
3
  declare const raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
4
4
  declare const caf: typeof cancelAnimationFrame;
5
- export { raf, caf };
5
+ export { caf, raf };
@@ -1 +1,2 @@
1
- export declare const window: any;
1
+ declare let window: any;
2
+ export { window };
package/dist/current.d.ts CHANGED
@@ -2,6 +2,7 @@ import { AppInstance, PageInstance } from './dsl/instance';
2
2
  export interface Router {
3
3
  params: Record<string, unknown>;
4
4
  path: string;
5
+ $taroPath: string;
5
6
  onReady: string;
6
7
  onHide: string;
7
8
  onShow: string;
@@ -1,12 +1,14 @@
1
1
  import { TaroElement } from '../dom/element';
2
- import { InstanceFactory } from '../interface';
3
- import type { FormElement } from '../dom/form';
4
- import type { TaroRootElement } from '../dom/root';
5
- import type { TaroText } from '../dom/text';
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
6
  export declare class TaroDocument extends TaroElement {
7
- private _getText;
8
- constructor(// eslint-disable-next-line @typescript-eslint/indent
9
- getText: InstanceFactory<TaroText>);
7
+ documentElement: TaroElement;
8
+ head: TaroElement;
9
+ body: TaroElement;
10
+ createEvent: typeof createEvent;
11
+ constructor();
10
12
  createElement(type: string): TaroElement | TaroRootElement | FormElement;
11
13
  createElementNS(_svgNS: string, type: string): TaroElement | TaroRootElement | FormElement;
12
14
  createTextNode(text: string): TaroText;
@@ -14,4 +16,5 @@ export declare class TaroDocument extends TaroElement {
14
16
  querySelector<T extends TaroElement>(query: string): T | null;
15
17
  querySelectorAll(): never[];
16
18
  createComment(): TaroText;
19
+ get defaultView(): any;
17
20
  }
@@ -1,8 +1,8 @@
1
- import { TaroNode } from './node';
2
- import { Style } from './style';
1
+ import type { Attributes, Func } from '../interface';
3
2
  import { ClassList } from './class-list';
4
3
  import type { TaroEvent } from './event';
5
- import type { Attributes } from '../interface';
4
+ import { TaroNode } from './node';
5
+ import { Style } from './style';
6
6
  export declare class TaroElement extends TaroNode {
7
7
  tagName: string;
8
8
  props: Record<string, any>;
@@ -34,4 +34,5 @@ export declare class TaroElement extends TaroNode {
34
34
  dispatchEvent(event: TaroEvent): boolean;
35
35
  addEventListener(type: any, handler: any, options: any): void;
36
36
  removeEventListener(type: any, handler: any): void;
37
+ static extend(methodName: string, options: Func | Record<string, any>): void;
37
38
  }
@@ -1,8 +1,6 @@
1
- import type { EventHandler, AddEventListenerOptions, IHooks } from '../interface';
1
+ import type { AddEventListenerOptions, EventHandler } from '../interface';
2
2
  export declare class TaroEventTarget {
3
3
  __handlers: Record<string, EventHandler[]>;
4
- hooks: IHooks;
5
- constructor();
6
4
  addEventListener(type: string, handler: EventHandler, options?: boolean | AddEventListenerOptions): void;
7
5
  removeEventListener(type: string, handler: EventHandler): void;
8
6
  isAnyEventBinded(): boolean;
@@ -1,5 +1,5 @@
1
- import type { TaroElement } from './element';
2
1
  import type { EventOptions, MpEvent } from '../interface';
2
+ import type { TaroElement } from './element';
3
3
  export declare class TaroEvent {
4
4
  type: string;
5
5
  bubbles: boolean;
@@ -1,9 +1,9 @@
1
- import { NodeType } from './node_types';
2
- import { TaroEventTarget } from './event-target';
3
- import type { UpdatePayload } from '../interface';
1
+ import type { Func, UpdatePayload } from '../interface';
4
2
  import type { TaroDocument } from './document';
5
- import type { TaroRootElement } from './root';
6
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
7
  interface RemoveChildOptions {
8
8
  cleanRef?: boolean;
9
9
  doUpdate?: boolean;
@@ -15,7 +15,6 @@ export declare class TaroNode extends TaroEventTarget {
15
15
  nodeName: string;
16
16
  parentNode: TaroNode | null;
17
17
  childNodes: TaroNode[];
18
- protected _getElement: import("../interface").InstanceNamedFactory;
19
18
  constructor();
20
19
  private hydrate;
21
20
  /**
@@ -75,5 +74,6 @@ export declare class TaroNode extends TaroEventTarget {
75
74
  hasChildNodes(): boolean;
76
75
  enqueueUpdate(payload: UpdatePayload): void;
77
76
  get ownerDocument(): TaroDocument;
77
+ static extend(methodName: string, options: Func | Record<string, any>): void;
78
78
  }
79
79
  export {};
@@ -1,5 +1,5 @@
1
+ import type { Func, MpInstance, UpdatePayload } from '../interface';
1
2
  import { TaroElement } from './element';
2
- import type { Func, UpdatePayload, MpInstance } from '../interface';
3
3
  export declare class TaroRootElement extends TaroElement {
4
4
  private updatePayloads;
5
5
  private updateCallbacks;
@@ -4,6 +4,7 @@ export declare class TaroText extends TaroNode {
4
4
  _value: string;
5
5
  nodeType: NodeType;
6
6
  nodeName: string;
7
+ constructor(value: any);
7
8
  set textContent(text: string);
8
9
  get textContent(): string;
9
10
  set nodeValue(text: string);
@@ -1,4 +1,3 @@
1
- import type { Ctx } from '../interface';
2
1
  import type { TaroElement } from 'src/dom/element';
3
2
  export declare function getBoundingClientRectImpl(this: TaroElement): Promise<null>;
4
- export declare function getTemplateContent(ctx: Ctx): string | undefined;
3
+ export declare function getTemplateContent(ctx: TaroElement): TaroElement | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,2 @@
1
1
  import type { TaroNode } from '../../dom/node';
2
- import type { TaroDocument } from '../../dom/document';
3
- export declare function setInnerHTML(element: TaroNode, html: string, getDoc: () => TaroDocument): void;
2
+ export declare function setInnerHTML(element: TaroNode, html: string): void;
@@ -1,7 +1,7 @@
1
- import { MutationObserverImpl } from './implements';
2
- import { MutationRecord } from './record';
3
- import type { MutationCallback, MutationObserverInit } from './implements';
4
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
5
  export declare class MutationObserver {
6
6
  core: Pick<MutationObserverImpl, 'observe' | 'disconnect' | 'takeRecords'>;
7
7
  constructor(callback: MutationCallback);
@@ -10,3 +10,4 @@ export declare class MutationObserver {
10
10
  takeRecords(): MutationRecord[];
11
11
  static record(record: MutationRecord): void;
12
12
  }
13
+ export { MutationRecordType };
@@ -1,12 +1,11 @@
1
- import { GetDoc } from '../interface';
2
1
  import type { TaroNode } from 'src/dom/node';
3
2
  export declare type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
4
3
  /**
5
4
  * An implementation of `Element.insertAdjacentHTML()`
6
5
  * to support Vue 3 with a version of or greater than `vue@3.1.2`
7
6
  */
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;
7
+ export declare function insertAdjacentHTML(this: TaroNode, position: IPosition, html: string): void;
8
+ export declare function cloneNode(this: TaroNode, isDeep?: boolean): any;
10
9
  export declare function contains(this: TaroNode, node: TaroNode & {
11
10
  id?: string;
12
11
  }): boolean;
@@ -1,29 +1,4 @@
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;
1
+ import { Events } from '@tarojs/shared';
28
2
  declare const eventCenter: Events;
29
- export { eventCenter };
3
+ export declare type EventsType = typeof Events;
4
+ export { eventCenter, Events };
package/dist/env.d.ts CHANGED
@@ -1,2 +1,7 @@
1
- export declare const doc: Document;
2
- export declare const win: Window;
1
+ import type { TaroDocument } from './dom/document';
2
+ interface Env {
3
+ window: any;
4
+ document: TaroDocument;
5
+ }
6
+ declare const env: Env;
7
+ export default env;
package/dist/hydrate.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { MiniData } from './interface';
2
1
  import type { TaroElement } from './dom/element';
3
2
  import type { TaroText } from './dom/text';
3
+ import type { MiniData } from './interface';
4
4
  /**
5
5
  * React also has a fancy function's name for this: `hydrate()`.
6
6
  * You may have been heard `hydrate` as a SSR-related function,
package/dist/index.d.ts CHANGED
@@ -1,29 +1,26 @@
1
- import './polyfill/reflect-metadata';
2
- export { TaroNode } from './dom/node';
3
- export { TaroText } from './dom/text';
1
+ import './dom-external';
2
+ export { hooks } from '@tarojs/shared';
3
+ export { document } from './bom/document';
4
+ export { getComputedStyle } from './bom/getComputedStyle';
5
+ export { navigator } from './bom/navigator';
6
+ export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf';
7
+ export { window } from './bom/window';
4
8
  export { TaroElement } from './dom/element';
5
- export { TaroRootElement } from './dom/root';
9
+ export { createEvent, eventHandler, TaroEvent } from './dom/event';
6
10
  export { FormElement } from './dom/form';
11
+ export { TaroNode } from './dom/node';
12
+ export { TaroRootElement } from './dom/root';
13
+ export { Style } from './dom/style';
7
14
  export { SVGElement } from './dom/svg';
15
+ export { TaroText } from './dom/text';
8
16
  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
17
  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';
18
+ export { eventSource } from './dom/event-source';
19
+ export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, injectPageInstance, safeExecute, stringify } from './dsl/common';
24
20
  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';
21
+ export { hydrate } from './hydrate';
22
+ export { nextTick } from './next-tick';
23
+ export { options } from './options';
28
24
  export { incrementId } from './utils';
29
- export { eventSource } from './dom/event-source';
25
+ export * from './dsl/instance';
26
+ export * from './interface';
@@ -1,10 +1,7 @@
1
- export * from './event-target';
2
- export * from './node';
3
1
  export * from './element';
4
- export * from './document';
5
- export * from './hydrate';
6
- export * from './container';
7
2
  export * from './event';
3
+ export * from './event-target';
4
+ export * from './hydrate';
5
+ export * from './node';
8
6
  export * from './options';
9
7
  export * from './utils';
10
- export * from './hooks';