@tarojs/runtime 3.4.0 → 3.4.3
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.
- package/dist/bom/raf.d.ts +2 -1
- package/dist/dom/event.d.ts +2 -8
- package/dist/interface/hooks.d.ts +1 -1
- package/dist/runtime.esm.js +18 -8
- package/dist/runtime.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/bom/raf.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
export declare let now: any;
|
|
2
|
-
declare const raf: typeof requestAnimationFrame;
|
|
3
|
+
declare const raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
|
|
3
4
|
declare const caf: typeof cancelAnimationFrame;
|
|
4
5
|
export { raf, caf };
|
package/dist/dom/event.d.ts
CHANGED
|
@@ -13,14 +13,8 @@ export declare class TaroEvent {
|
|
|
13
13
|
stopPropagation(): void;
|
|
14
14
|
stopImmediatePropagation(): void;
|
|
15
15
|
preventDefault(): void;
|
|
16
|
-
get target():
|
|
17
|
-
|
|
18
|
-
id?: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
get currentTarget(): {
|
|
21
|
-
dataset: any;
|
|
22
|
-
id?: string | undefined;
|
|
23
|
-
};
|
|
16
|
+
get target(): any;
|
|
17
|
+
get currentTarget(): any;
|
|
24
18
|
}
|
|
25
19
|
export declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
|
|
26
20
|
export declare function eventHandler(event: MpEvent): void;
|
|
@@ -74,7 +74,7 @@ export interface ModifySetAttrPayload {
|
|
|
74
74
|
export interface ModifyRmAttrPayload {
|
|
75
75
|
(element: TaroElement, key: string, payload: UpdatePayload): void;
|
|
76
76
|
}
|
|
77
|
-
export interface OnAddEvent<T extends TaroEventTarget =
|
|
77
|
+
export interface OnAddEvent<T extends TaroEventTarget = any> {
|
|
78
78
|
(type: string, handler: EventHandler, options: any, node: T): void;
|
|
79
79
|
}
|
|
80
80
|
export interface PatchElement {
|
package/dist/runtime.esm.js
CHANGED
|
@@ -70,10 +70,9 @@ if (process.env.TARO_ENV === 'h5') {
|
|
|
70
70
|
};
|
|
71
71
|
// Load global or shim versions of Map, Set, and WeakMap
|
|
72
72
|
var functionPrototype = Object.getPrototypeOf(Function);
|
|
73
|
-
var usePolyfill = isObject(process) && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true";
|
|
74
73
|
var _Map = Map;
|
|
75
74
|
var _Set = Set;
|
|
76
|
-
var _WeakMap =
|
|
75
|
+
var _WeakMap = isFunction(WeakMap) ? WeakMap : CreateWeakMapPolyfill();
|
|
77
76
|
// [[Metadata]] internal slot
|
|
78
77
|
// https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots
|
|
79
78
|
var Metadata = new _WeakMap();
|
|
@@ -2831,17 +2830,27 @@ class TaroEvent {
|
|
|
2831
2830
|
this.defaultPrevented = true;
|
|
2832
2831
|
}
|
|
2833
2832
|
get target() {
|
|
2834
|
-
var _a, _b
|
|
2835
|
-
const
|
|
2836
|
-
|
|
2833
|
+
var _a, _b;
|
|
2834
|
+
const target = Object.create(((_a = this.mpEvent) === null || _a === void 0 ? void 0 : _a.target) || null);
|
|
2835
|
+
const element = getDocument().getElementById(target.id);
|
|
2836
|
+
target.dataset = element !== null ? element.dataset : EMPTY_OBJ;
|
|
2837
|
+
for (const key in (_b = this.mpEvent) === null || _b === void 0 ? void 0 : _b.detail) {
|
|
2838
|
+
target[key] = this.mpEvent.detail[key];
|
|
2839
|
+
}
|
|
2840
|
+
return target;
|
|
2837
2841
|
}
|
|
2838
2842
|
get currentTarget() {
|
|
2839
|
-
var _a, _b
|
|
2840
|
-
const
|
|
2843
|
+
var _a, _b;
|
|
2844
|
+
const currentTarget = Object.create(((_a = this.mpEvent) === null || _a === void 0 ? void 0 : _a.currentTarget) || null);
|
|
2845
|
+
const element = getDocument().getElementById(currentTarget.id);
|
|
2841
2846
|
if (element === null) {
|
|
2842
2847
|
return this.target;
|
|
2843
2848
|
}
|
|
2844
|
-
|
|
2849
|
+
currentTarget.dataset = element.dataset;
|
|
2850
|
+
for (const key in (_b = this.mpEvent) === null || _b === void 0 ? void 0 : _b.detail) {
|
|
2851
|
+
currentTarget[key] = this.mpEvent.detail[key];
|
|
2852
|
+
}
|
|
2853
|
+
return currentTarget;
|
|
2845
2854
|
}
|
|
2846
2855
|
}
|
|
2847
2856
|
function createEvent(event, node) {
|
|
@@ -4615,6 +4624,7 @@ function createComponentConfig(component, componentName, data) {
|
|
|
4615
4624
|
Current.app.mount(component, path, () => {
|
|
4616
4625
|
componentElement = document$1.getElementById(path);
|
|
4617
4626
|
ensure(componentElement !== null, '没有找到组件实例。');
|
|
4627
|
+
this.$taroInstances = instances.get(path);
|
|
4618
4628
|
safeExecute(path, ON_LOAD);
|
|
4619
4629
|
if (process.env.TARO_ENV !== 'h5') {
|
|
4620
4630
|
componentElement.ctx = this;
|