@tarojs/runtime 3.5.0-canary.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 (68) hide show
  1. package/dist/bom/document.d.ts +2 -3
  2. package/dist/bom/getComputedStyle.d.ts +3 -3
  3. package/dist/bom/navigator.d.ts +1 -15
  4. package/dist/bom/raf.d.ts +5 -4
  5. package/dist/bom/window.d.ts +2 -1
  6. package/dist/constants/index.d.ts +47 -47
  7. package/dist/current.d.ts +19 -17
  8. package/dist/dom/class-list.d.ts +14 -14
  9. package/dist/dom/document.d.ts +20 -17
  10. package/dist/dom/element.d.ts +38 -37
  11. package/dist/dom/event-source.d.ts +7 -7
  12. package/dist/dom/event-target.d.ts +7 -9
  13. package/dist/dom/event.d.ts +22 -26
  14. package/dist/dom/form.d.ts +7 -7
  15. package/dist/dom/node.d.ts +75 -79
  16. package/dist/dom/node_types.d.ts +10 -10
  17. package/dist/dom/root.d.ts +15 -15
  18. package/dist/dom/style.d.ts +14 -13
  19. package/dist/dom/style_properties.d.ts +3 -3
  20. package/dist/dom/svg.d.ts +3 -3
  21. package/dist/dom/text.d.ts +14 -13
  22. package/dist/dom/tree.d.ts +4 -4
  23. package/dist/dom-external/element.d.ts +3 -4
  24. package/dist/dom-external/index.d.ts +1 -0
  25. package/dist/dom-external/inner-html/html.d.ts +2 -3
  26. package/dist/dom-external/inner-html/parser.d.ts +25 -25
  27. package/dist/dom-external/inner-html/scaner.d.ts +30 -30
  28. package/dist/dom-external/inner-html/style.d.ts +27 -27
  29. package/dist/dom-external/inner-html/tags.d.ts +8 -8
  30. package/dist/dom-external/inner-html/utils.d.ts +1 -1
  31. package/dist/dom-external/mutation-observer/implements.d.ts +52 -52
  32. package/dist/dom-external/mutation-observer/index.d.ts +13 -12
  33. package/dist/dom-external/mutation-observer/record.d.ts +24 -24
  34. package/dist/dom-external/node.d.ts +11 -12
  35. package/dist/dsl/common.d.ts +15 -15
  36. package/dist/dsl/instance.d.ts +85 -82
  37. package/dist/emitter/emitter.d.ts +4 -29
  38. package/dist/env.d.ts +7 -2
  39. package/dist/hydrate.d.ts +10 -10
  40. package/dist/index.d.ts +26 -29
  41. package/dist/interface/element.d.ts +4 -4
  42. package/dist/interface/event-target.d.ts +10 -10
  43. package/dist/interface/event.d.ts +15 -15
  44. package/dist/interface/hydrate.d.ts +30 -29
  45. package/dist/interface/index.d.ts +7 -10
  46. package/dist/interface/node.d.ts +7 -7
  47. package/dist/interface/options.d.ts +16 -16
  48. package/dist/interface/utils.d.ts +2 -2
  49. package/dist/next-tick.d.ts +2 -2
  50. package/dist/options.d.ts +2 -2
  51. package/dist/perf.d.ts +7 -7
  52. package/dist/runtime.esm.d.ts +537 -0
  53. package/dist/runtime.esm.js +3146 -4650
  54. package/dist/runtime.esm.js.map +1 -1
  55. package/dist/utils/index.d.ts +23 -16
  56. package/package.json +10 -16
  57. package/dist/constants/events.d.ts +0 -5
  58. package/dist/constants/identifiers.d.ts +0 -61
  59. package/dist/container/default-hooks.d.ts +0 -4
  60. package/dist/container/index.d.ts +0 -3
  61. package/dist/container/plugin-hooks.d.ts +0 -2
  62. package/dist/container/store.d.ts +0 -15
  63. package/dist/dom-external/element-impl.d.ts +0 -4
  64. package/dist/dom-external/node-impl.d.ts +0 -8
  65. package/dist/hooks.d.ts +0 -32
  66. package/dist/interface/container.d.ts +0 -12
  67. package/dist/interface/document.d.ts +0 -14
  68. package/dist/interface/hooks.d.ts +0 -162
@@ -1,16 +1,23 @@
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>>;
1
+ import type { TaroElement } from '../dom/element';
2
+ import type { TaroNode } from '../dom/node';
3
+ import type { TaroText } from '../dom/text';
4
+ import { Func } from '../interface';
5
+ export declare const incrementId: () => () => string;
6
+ export declare function isElement(node: TaroNode): node is TaroElement;
7
+ export declare function isText(node: TaroNode): node is TaroText;
8
+ export declare function isComment(node: TaroNode): boolean;
9
+ export declare function isHasExtractProp(el: TaroElement): boolean;
10
+ /**
11
+ * 往上寻找组件树直到 root,寻找是否有祖先组件绑定了同类型的事件
12
+ * @param node 当前组件
13
+ * @param type 事件类型
14
+ */
15
+ export declare function isParentBinded(node: TaroElement | null, type: string): boolean;
16
+ export declare function shortcutAttr(key: string): string;
17
+ export declare const customWrapperCache: Map<string, Record<string, any>>;
18
+ interface Ctor {
19
+ new (...args: any[]): any;
20
+ }
21
+ export declare function extend(ctor: Ctor, methodName: string, options: Func | Record<string, any>): void;
22
+ export declare function getComponentsAlias(): any;
23
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/runtime",
3
- "version": "3.5.0-canary.1",
3
+ "version": "3.5.0",
4
4
  "description": "taro runtime for mini apps.",
5
5
  "main": "dist/runtime.esm.js",
6
6
  "module": "dist/runtime.esm.js",
@@ -8,12 +8,6 @@
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
- "scripts": {
12
- "test": "jest",
13
- "test:ci": "jest -i --coverage false",
14
- "build": "rollup -c",
15
- "dev": "rollup -c -w"
16
- },
17
11
  "repository": {
18
12
  "type": "git",
19
13
  "url": "https://github.com/NervJS/taro/tree/master/packages/taro-runtime"
@@ -24,13 +18,13 @@
24
18
  "access": "public"
25
19
  },
26
20
  "dependencies": {
27
- "@tarojs/shared": "3.5.0-canary.1",
28
- "inversify": "5.1.1",
29
- "lodash-es": "4.17.15",
30
- "reflect-metadata": "^0.1.13"
21
+ "@tarojs/shared": "3.5.0",
22
+ "lodash-es": "4.17.21"
31
23
  },
32
- "devDependencies": {
33
- "@tarojs/taro": "3.5.0-canary.1"
34
- },
35
- "gitHead": "c61624d2f763e6d31e67d6cf9c564efc8b0d0887"
36
- }
24
+ "scripts": {
25
+ "build": "rimraf ./dist && tsc -emitDeclarationOnly && rollup -c",
26
+ "dev": "rollup -c -w",
27
+ "test": "jest",
28
+ "test:ci": "jest -i --coverage false"
29
+ }
30
+ }
@@ -1,5 +0,0 @@
1
- /**
2
- * 支持冒泡的事件, 除 支付宝小程序外,其余的可冒泡事件都和微信保持一致
3
- * 详见 见 https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/event.html
4
- */
5
- export declare const BUBBLE_EVENTS: Set<string>;
@@ -1,61 +0,0 @@
1
- export declare const SID_TARO_ELEMENT = "0";
2
- export declare const SID_TARO_ELEMENT_FACTORY = "1";
3
- export declare const SID_TARO_TEXT = "2";
4
- export declare const SID_TARO_TEXT_FACTORY = "3";
5
- export declare const SID_TARO_NODE_IMPL = "4";
6
- export declare const SID_TARO_ELEMENT_IMPL = "5";
7
- export declare const SID_HOOKS = "6";
8
- export declare const SID_ON_REMOVE_ATTRIBUTE = "7";
9
- export declare const SID_GET_MINI_LIFECYCLE = "8";
10
- export declare const SID_GET_LIFECYCLE = "9";
11
- export declare const SID_GET_PATH_INDEX = "10";
12
- export declare const SID_GET_EVENT_CENTER = "11";
13
- export declare const SID_IS_BUBBLE_EVENTS = "12";
14
- export declare const SID_GET_SPECIAL_NODES = "13";
15
- export declare const SID_EVENT_CENTER = "14";
16
- export declare const SID_MODIFY_MP_EVENT = "15";
17
- export declare const SID_MODIFY_TARO_EVENT = "16";
18
- export declare const SID_MODIFY_DISPATCH_EVENT = "17";
19
- export declare const SID_BATCHED_EVENT_UPDATES = "18";
20
- export declare const SID_MERGE_PAGE_INSTANCE = "19";
21
- export declare const SID_CREATE_PULLDOWN_COMPONENT = "20";
22
- export declare const SID_GET_DOM_NODE = "21";
23
- export declare const SID_INIT_NATIVE_API = "22";
24
- export declare const SID_MODIFY_HYDRATE_DATA = "23";
25
- export declare const SID_MODIFY_SET_ATTR_PAYLOAD = "24";
26
- export declare const SID_MODIFY_RM_ATTR_PAYLOAD = "25";
27
- export declare const SID_ON_ADD_EVENT = "26";
28
- export declare const SID_PATCH_ELEMENT = "27";
29
- export declare const SID_MODIFY_PAGE_OBJECT = "28";
30
- declare const SERVICE_IDENTIFIER: {
31
- TaroElement: string;
32
- TaroElementFactory: string;
33
- TaroText: string;
34
- TaroTextFactory: string;
35
- TaroNodeImpl: string;
36
- TaroElementImpl: string;
37
- Hooks: string;
38
- onRemoveAttribute: string;
39
- getMiniLifecycle: string;
40
- getLifecycle: string;
41
- getPathIndex: string;
42
- getEventCenter: string;
43
- isBubbleEvents: string;
44
- getSpecialNodes: string;
45
- eventCenter: string;
46
- modifyMpEvent: string;
47
- modifyTaroEvent: string;
48
- modifyDispatchEvent: string;
49
- batchedEventUpdates: string;
50
- mergePageInstance: string;
51
- createPullDownComponent: string;
52
- getDOMNode: string;
53
- initNativeApi: string;
54
- modifyHydrateData: string;
55
- modifySetAttrPayload: string;
56
- modifyRmAttrPayload: string;
57
- onAddEvent: string;
58
- patchElement: string;
59
- modifyPageObject: string;
60
- };
61
- export default SERVICE_IDENTIFIER;
@@ -1,4 +0,0 @@
1
- import { ContainerModule } from 'inversify';
2
- import type { MiniLifecycle } from '../interface';
3
- export declare const defaultMiniLifecycle: MiniLifecycle;
4
- export declare const DefaultHooksContainer: ContainerModule;
@@ -1,3 +0,0 @@
1
- import { Container } from 'inversify';
2
- declare const container: Container;
3
- export default container;
@@ -1,2 +0,0 @@
1
- import type { Container } from 'inversify';
2
- export default function processPluginHooks(container: Container): void;
@@ -1,15 +0,0 @@
1
- import { TaroDocumentInstance } from '../interface';
2
- import type { Container } from 'inversify';
3
- import type { IHooks, InstanceNamedFactory } from '../interface';
4
- import type { TaroNodeImpl } from '../dom-external/node-impl';
5
- import type { TaroElementImpl } from '../dom-external/element-impl';
6
- interface IStore {
7
- container: Container | null;
8
- }
9
- export declare const store: IStore;
10
- export declare function getHooks(): IHooks;
11
- export declare function getElementFactory(): InstanceNamedFactory;
12
- export declare function getNodeImpl(): TaroNodeImpl;
13
- export declare function getElementImpl(): TaroElementImpl;
14
- export declare function getDocument(): TaroDocumentInstance;
15
- export {};
@@ -1,4 +0,0 @@
1
- import type { Ctx } from '../interface';
2
- export declare class TaroElementImpl {
3
- bind(ctx: Ctx): void;
4
- }
@@ -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
- }
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
- }
@@ -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,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 {};