@tarojs/runtime 3.7.0-beta.3 → 3.7.0-beta.4
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/runtime.cjs.d.ts +3 -2
- package/dist/runtime.cjs.js +41 -12
- package/dist/runtime.esm.d.ts +3 -2
- package/dist/runtime.esm.js +31 -13
- package/dist/runtime.esm.js.map +1 -1
- package/dist/runtime.h5.d.ts +3 -2
- package/dist/runtime.h5.js +31 -12
- package/package.json +4 -4
package/dist/runtime.h5.d.ts
CHANGED
|
@@ -431,7 +431,7 @@ declare const nav: any;
|
|
|
431
431
|
declare let now: () => number;
|
|
432
432
|
// https://gist.github.com/paulirish/1579671
|
|
433
433
|
// https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
|
|
434
|
-
declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.
|
|
434
|
+
declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timer);
|
|
435
435
|
declare const _caf: typeof cancelAnimationFrame;
|
|
436
436
|
declare class URLSearchParams {
|
|
437
437
|
#private;
|
|
@@ -776,5 +776,6 @@ declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
|
776
776
|
declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
|
|
777
777
|
declare const options: Options;
|
|
778
778
|
declare const incrementId: () => () => string;
|
|
779
|
+
declare function isHasExtractProp(el: TaroElement): boolean;
|
|
779
780
|
export { hooks } from '@tarojs/shared';
|
|
780
|
-
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
|
|
781
|
+
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, isHasExtractProp, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
|
package/dist/runtime.h5.js
CHANGED
|
@@ -124,7 +124,7 @@ class MutationObserver {
|
|
|
124
124
|
constructor(callback) {
|
|
125
125
|
{
|
|
126
126
|
if (process.env.NODE_ENV !== 'production') {
|
|
127
|
-
console.warn('[Taro Warning] 若要使用 MutationObserver,请在 Taro 编译配置中设置 \'mini.enableMutationObserver: true\'');
|
|
127
|
+
console.warn('[Taro Warning] 若要使用 MutationObserver,请在 Taro 编译配置中设置 \'mini.runtime.enableMutationObserver: true\'');
|
|
128
128
|
}
|
|
129
129
|
this.core = {
|
|
130
130
|
observe: shared.noop,
|
|
@@ -198,15 +198,15 @@ function isHasExtractProp(el) {
|
|
|
198
198
|
*/
|
|
199
199
|
function isParentBinded(node, type) {
|
|
200
200
|
var _a;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
201
|
+
while ((node = (node === null || node === void 0 ? void 0 : node.parentElement) || null)) {
|
|
202
|
+
if (!node || node.nodeName === ROOT_STR || node.nodeName === 'root-portal') {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
else if ((_a = node.__handlers[type]) === null || _a === void 0 ? void 0 : _a.length) {
|
|
206
|
+
return true;
|
|
206
207
|
}
|
|
207
|
-
node = node.parentElement;
|
|
208
208
|
}
|
|
209
|
-
return
|
|
209
|
+
return false;
|
|
210
210
|
}
|
|
211
211
|
function shortcutAttr(key) {
|
|
212
212
|
switch (key) {
|
|
@@ -416,7 +416,7 @@ function hydrate(node) {
|
|
|
416
416
|
if (cssText !== '' && nodeName !== 'swiper-item') {
|
|
417
417
|
data["st" /* Shortcuts.Style */] = cssText;
|
|
418
418
|
}
|
|
419
|
-
shared.hooks.call('modifyHydrateData', data);
|
|
419
|
+
shared.hooks.call('modifyHydrateData', data, node);
|
|
420
420
|
const nn = data["nn" /* Shortcuts.NodeName */];
|
|
421
421
|
const componentAlias = componentsAlias[nn];
|
|
422
422
|
if (componentAlias) {
|
|
@@ -428,7 +428,8 @@ function hydrate(node) {
|
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
|
|
431
|
+
const resData = shared.hooks.call('transferHydrateData', data, node, componentAlias);
|
|
432
|
+
return resData || data;
|
|
432
433
|
}
|
|
433
434
|
|
|
434
435
|
class TaroEventTarget {
|
|
@@ -1439,6 +1440,7 @@ class TaroElement extends TaroNode {
|
|
|
1439
1440
|
sideEffect = false;
|
|
1440
1441
|
delete options.sideEffect;
|
|
1441
1442
|
}
|
|
1443
|
+
shared.hooks.call('modifyAddEventListener', this, sideEffect, getComponentsAlias);
|
|
1442
1444
|
if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {
|
|
1443
1445
|
const componentsAlias = getComponentsAlias();
|
|
1444
1446
|
const alias = componentsAlias[name]._num;
|
|
@@ -1453,6 +1455,7 @@ class TaroElement extends TaroNode {
|
|
|
1453
1455
|
super.removeEventListener(type, handler);
|
|
1454
1456
|
const name = this.nodeName;
|
|
1455
1457
|
const SPECIAL_NODES = shared.hooks.call('getSpecialNodes');
|
|
1458
|
+
shared.hooks.call('modifyRemoveEventListener', this, sideEffect, getComponentsAlias);
|
|
1456
1459
|
if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {
|
|
1457
1460
|
const componentsAlias = getComponentsAlias();
|
|
1458
1461
|
const value = isHasExtractProp(this) ? `static-${name}` : `pure-${name}`;
|
|
@@ -2310,6 +2313,17 @@ class AnchorElement extends TaroElement {
|
|
|
2310
2313
|
}
|
|
2311
2314
|
}
|
|
2312
2315
|
|
|
2316
|
+
class TransferElement extends TaroElement {
|
|
2317
|
+
constructor(dataName) {
|
|
2318
|
+
super();
|
|
2319
|
+
this.dataName = dataName;
|
|
2320
|
+
this.isTransferElement = true;
|
|
2321
|
+
}
|
|
2322
|
+
get _path() {
|
|
2323
|
+
return this.dataName;
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2313
2327
|
class TaroDocument extends TaroElement {
|
|
2314
2328
|
constructor() {
|
|
2315
2329
|
super();
|
|
@@ -2330,6 +2344,10 @@ class TaroDocument extends TaroElement {
|
|
|
2330
2344
|
case nodeName === A:
|
|
2331
2345
|
element = new AnchorElement();
|
|
2332
2346
|
break;
|
|
2347
|
+
case nodeName === 'page-meta':
|
|
2348
|
+
case nodeName === 'navigation-bar':
|
|
2349
|
+
element = new TransferElement(shared.toCamelCase(nodeName));
|
|
2350
|
+
break;
|
|
2333
2351
|
default:
|
|
2334
2352
|
element = new TaroElement();
|
|
2335
2353
|
break;
|
|
@@ -3189,7 +3207,7 @@ function createRecursiveComponentConfig(componentName) {
|
|
|
3189
3207
|
}
|
|
3190
3208
|
}
|
|
3191
3209
|
: shared.EMPTY_OBJ;
|
|
3192
|
-
return Object.assign({ properties: {
|
|
3210
|
+
return shared.hooks.call('modifyRecursiveComponentConfig', Object.assign({ properties: {
|
|
3193
3211
|
i: {
|
|
3194
3212
|
type: Object,
|
|
3195
3213
|
value: {
|
|
@@ -3205,7 +3223,7 @@ function createRecursiveComponentConfig(componentName) {
|
|
|
3205
3223
|
virtualHost: !isCustomWrapper
|
|
3206
3224
|
}, methods: {
|
|
3207
3225
|
eh: eventHandler
|
|
3208
|
-
} }, lifeCycles);
|
|
3226
|
+
} }, lifeCycles), { isCustomWrapper });
|
|
3209
3227
|
}
|
|
3210
3228
|
|
|
3211
3229
|
const TIMEOUT = 100;
|
|
@@ -3339,6 +3357,7 @@ exports.history = history;
|
|
|
3339
3357
|
exports.hydrate = hydrate;
|
|
3340
3358
|
exports.incrementId = incrementId;
|
|
3341
3359
|
exports.injectPageInstance = injectPageInstance;
|
|
3360
|
+
exports.isHasExtractProp = isHasExtractProp;
|
|
3342
3361
|
exports.location = location;
|
|
3343
3362
|
exports.navigator = nav;
|
|
3344
3363
|
exports.nextTick = nextTick;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/runtime",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.4",
|
|
4
4
|
"description": "taro runtime for mini apps.",
|
|
5
5
|
"main:h5": "dist/runtime.h5.js",
|
|
6
6
|
"main": "dist/runtime.esm.js",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"lodash-es": "4.17.21",
|
|
23
|
-
"@tarojs/shared": "3.7.0-beta.
|
|
23
|
+
"@tarojs/shared": "3.7.0-beta.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@rollup/plugin-buble": "^0.
|
|
26
|
+
"@rollup/plugin-buble": "^1.0.3",
|
|
27
27
|
"@rollup/plugin-replace": "^5.0.2",
|
|
28
28
|
"@rollup/plugin-typescript": "^11.1.0",
|
|
29
29
|
"@vue/runtime-core": "3.2.41",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "^4.7.4"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"prebuild": "rimraf ./dist",
|
|
40
|
+
"prebuild": "rimraf --impl=move-remove ./dist",
|
|
41
41
|
"build": "pnpm run rollup",
|
|
42
42
|
"dev": "pnpm run rollup --environment TARGET:esm -w",
|
|
43
43
|
"rollup": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs",
|