@tarojs/runtime 3.6.22-alpha.5 → 3.6.22-nightly.2
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/LICENSE +7 -0
- package/dist/bom/URL.d.ts +7 -14
- package/dist/bom/URL.js +221 -0
- package/dist/bom/URL.js.map +1 -0
- package/dist/bom/URLSearchParams.d.ts +2 -14
- package/dist/bom/URLSearchParams.js +123 -0
- package/dist/bom/URLSearchParams.js.map +1 -0
- package/dist/bom/document.d.ts +2 -1
- package/dist/bom/document.js +39 -0
- package/dist/bom/document.js.map +1 -0
- package/dist/bom/getComputedStyle.d.ts +5 -3
- package/dist/bom/getComputedStyle.js +8 -0
- package/dist/bom/getComputedStyle.js.map +1 -0
- package/dist/bom/history.d.ts +11 -8
- package/dist/bom/history.js +121 -0
- package/dist/bom/history.js.map +1 -0
- package/dist/bom/location.d.ts +7 -4
- package/dist/bom/location.js +240 -0
- package/dist/bom/location.js.map +1 -0
- package/dist/bom/navigator.d.ts +2 -1
- package/dist/bom/navigator.js +24 -0
- package/dist/bom/navigator.js.map +1 -0
- package/dist/bom/raf.d.ts +3 -4
- package/dist/bom/raf.js +33 -0
- package/dist/bom/raf.js.map +1 -0
- package/dist/bom/window.d.ts +25 -4
- package/dist/bom/window.js +92 -0
- package/dist/bom/window.js.map +1 -0
- package/dist/constants/index.d.ts +52 -51
- package/dist/constants/index.js +63 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/current.d.ts +5 -5
- package/dist/current.js +9 -0
- package/dist/current.js.map +1 -0
- package/dist/dom/anchor-element.d.ts +3 -2
- package/dist/dom/anchor-element.js +54 -0
- package/dist/dom/anchor-element.js.map +1 -0
- package/dist/dom/class-list.d.ts +3 -2
- package/dist/dom/class-list.js +92 -0
- package/dist/dom/class-list.js.map +1 -0
- package/dist/dom/document.d.ts +11 -6
- package/dist/dom/document.js +80 -0
- package/dist/dom/document.js.map +1 -0
- package/dist/dom/element.d.ts +8 -7
- package/dist/dom/element.js +318 -0
- package/dist/dom/element.js.map +1 -0
- package/dist/dom/event-source.d.ts +3 -3
- package/dist/dom/event-source.js +17 -0
- package/dist/dom/event-source.js.map +1 -0
- package/dist/dom/event-target.d.ts +3 -2
- package/dist/dom/event-target.js +78 -0
- package/dist/dom/event-target.js.map +1 -0
- package/dist/dom/event.d.ts +6 -5
- package/dist/dom/event.js +151 -0
- package/dist/dom/event.js.map +1 -0
- package/dist/dom/form.d.ts +4 -3
- package/dist/dom/form.js +38 -0
- package/dist/dom/form.js.map +1 -0
- package/dist/dom/node.d.ts +40 -9
- package/dist/dom/node.js +292 -0
- package/dist/dom/node.js.map +1 -0
- package/dist/dom/root.d.ts +6 -5
- package/dist/dom/root.js +169 -0
- package/dist/dom/root.js.map +1 -0
- package/dist/dom/style.d.ts +3 -2
- package/dist/dom/style.js +168 -0
- package/dist/dom/style.js.map +1 -0
- package/dist/dom/style_properties.js +186 -0
- package/dist/dom/style_properties.js.map +1 -0
- package/dist/dom/svg.d.ts +3 -2
- package/dist/dom/svg.js +8 -0
- package/dist/dom/svg.js.map +1 -0
- package/dist/dom/text.d.ts +4 -3
- package/dist/dom/text.js +41 -0
- package/dist/dom/text.js.map +1 -0
- package/dist/dom/transfer.d.ts +3 -2
- package/dist/dom/transfer.js +15 -0
- package/dist/dom/transfer.js.map +1 -0
- package/dist/dom/tree.d.ts +3 -3
- package/dist/dom/tree.js +38 -0
- package/dist/dom/tree.js.map +1 -0
- package/dist/dom-external/element.d.ts +4 -3
- package/dist/dom-external/element.js +29 -0
- package/dist/dom-external/element.js.map +1 -0
- package/dist/dom-external/index.js +38 -0
- package/dist/dom-external/index.js.map +1 -0
- package/dist/dom-external/inner-html/html.d.ts +3 -2
- package/dist/dom-external/inner-html/html.js +28 -0
- package/dist/dom-external/inner-html/html.js.map +1 -0
- package/dist/dom-external/inner-html/parser.d.ts +7 -7
- package/dist/dom-external/inner-html/parser.js +216 -0
- package/dist/dom-external/inner-html/parser.js.map +1 -0
- package/dist/dom-external/inner-html/scaner.d.ts +3 -3
- package/dist/dom-external/inner-html/scaner.js +304 -0
- package/dist/dom-external/inner-html/scaner.js.map +1 -0
- package/dist/dom-external/inner-html/style.d.ts +3 -3
- package/dist/dom-external/inner-html/style.js +235 -0
- package/dist/dom-external/inner-html/style.js.map +1 -0
- package/dist/dom-external/inner-html/tags.d.ts +6 -5
- package/dist/dom-external/inner-html/tags.js +26 -0
- package/dist/dom-external/inner-html/tags.js.map +1 -0
- package/dist/dom-external/inner-html/utils.d.ts +2 -1
- package/dist/dom-external/inner-html/utils.js +12 -0
- package/dist/dom-external/inner-html/utils.js.map +1 -0
- package/dist/dom-external/mutation-observer/implements.d.ts +25 -6
- package/dist/dom-external/mutation-observer/implements.js +108 -0
- package/dist/dom-external/mutation-observer/implements.js.map +1 -0
- package/dist/dom-external/mutation-observer/index.d.ts +5 -6
- package/dist/dom-external/mutation-observer/index.js +35 -0
- package/dist/dom-external/mutation-observer/index.js.map +1 -0
- package/dist/dom-external/node.d.ts +6 -5
- package/dist/dom-external/node.js +74 -0
- package/dist/dom-external/node.js.map +1 -0
- package/dist/dsl/common.d.ts +16 -16
- package/dist/dsl/common.js +337 -0
- package/dist/dsl/common.js.map +1 -0
- package/dist/emitter/emitter.d.ts +2 -2
- package/dist/emitter/emitter.js +7 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/env.d.ts +2 -2
- package/dist/env.js +9 -0
- package/dist/env.js.map +1 -0
- package/dist/hydrate.d.ts +5 -4
- package/dist/hydrate.js +84 -0
- package/dist/hydrate.js.map +1 -0
- package/dist/index-26658829.d.ts +23 -0
- package/dist/index.cjs.d.ts +775 -0
- package/dist/index.cjs.js +4347 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +30 -31
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/{dsl/instance.d.ts → instance-0f017c6e.d.ts} +19 -18
- package/dist/next-tick.d.ts +3 -2
- package/dist/next-tick.js +47 -0
- package/dist/next-tick.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js +32 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/{dom/node_types.d.ts → node_types-9ac5b4dd.d.ts} +2 -1
- package/dist/{interface/options.d.ts → options-0f017c6e.d.ts} +5 -4
- package/dist/options.d.ts +3 -2
- package/dist/options.js +7 -0
- package/dist/options.js.map +1 -0
- package/dist/perf.d.ts +2 -2
- package/dist/perf.js +28 -0
- package/dist/perf.js.map +1 -0
- package/dist/{dom-external/mutation-observer/record.d.ts → record-32b054d8.d.ts} +4 -3
- package/dist/runtime.esm.d.ts +81 -88
- package/dist/runtime.esm.js +347 -355
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.d.ts +2 -1
- package/dist/utils/cache.js +27 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +15 -15
- package/dist/utils/index.js +95 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +19 -9
- package/dist/interface/element.d.ts +0 -4
- package/dist/interface/event-target.d.ts +0 -10
- package/dist/interface/event.d.ts +0 -15
- package/dist/interface/hydrate.d.ts +0 -29
- package/dist/interface/index.d.ts +0 -7
- package/dist/interface/node.d.ts +0 -7
- package/dist/interface/utils.d.ts +0 -2
package/dist/runtime.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { noop, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents,
|
|
1
|
+
import { noop, isFunction, getComponentsAlias as getComponentsAlias$1, internalComponents, EMPTY_OBJ, hooks, toCamelCase, isObject, warn, isArray, ensure, isNull, isUndefined, toDashed, isString, controlledComponent, Events, isNumber } from '@tarojs/shared';
|
|
2
2
|
export { Events, hooks } from '@tarojs/shared';
|
|
3
3
|
|
|
4
4
|
const PROPERTY_THRESHOLD = 2046;
|
|
@@ -393,10 +393,9 @@ class EventSource extends Map {
|
|
|
393
393
|
}
|
|
394
394
|
const eventSource = new EventSource();
|
|
395
395
|
|
|
396
|
-
const isWeb$1 = isWebPlatform();
|
|
397
396
|
const env = {
|
|
398
|
-
window:
|
|
399
|
-
document:
|
|
397
|
+
window: process.env.TARO_PLATFORM === 'web' ? window : EMPTY_OBJ,
|
|
398
|
+
document: process.env.TARO_PLATFORM === 'web' ? document : EMPTY_OBJ
|
|
400
399
|
};
|
|
401
400
|
|
|
402
401
|
let SPECIAL_NODES;
|
|
@@ -2410,7 +2409,7 @@ function contains(node) {
|
|
|
2410
2409
|
return isContains;
|
|
2411
2410
|
}
|
|
2412
2411
|
|
|
2413
|
-
if (
|
|
2412
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
2414
2413
|
if (ENABLE_INNER_HTML) {
|
|
2415
2414
|
TaroNode.extend('innerHTML', {
|
|
2416
2415
|
set(html) {
|
|
@@ -2853,6 +2852,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
2853
2852
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2854
2853
|
PERFORMANCE OF THIS SOFTWARE.
|
|
2855
2854
|
***************************************************************************** */
|
|
2855
|
+
/* global Reflect, Promise */
|
|
2856
|
+
|
|
2856
2857
|
|
|
2857
2858
|
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
2858
2859
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
@@ -2867,7 +2868,7 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
|
2867
2868
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
2868
2869
|
}
|
|
2869
2870
|
|
|
2870
|
-
var
|
|
2871
|
+
var _dict, _a;
|
|
2871
2872
|
const findReg = /[!'()~]|%20|%00/g;
|
|
2872
2873
|
const plusReg = /\+/g;
|
|
2873
2874
|
const replaceCharMap = {
|
|
@@ -2898,93 +2899,94 @@ function decode(str) {
|
|
|
2898
2899
|
function encode(str) {
|
|
2899
2900
|
return encodeURIComponent(str).replace(findReg, replacer);
|
|
2900
2901
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
}
|
|
2910
|
-
for (let pairs = query.split('&'), i = 0, length = pairs.length; i < length; i++) {
|
|
2911
|
-
const value = pairs[i];
|
|
2912
|
-
const index = value.indexOf('=');
|
|
2913
|
-
if (index > -1) {
|
|
2914
|
-
appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
|
|
2915
|
-
}
|
|
2916
|
-
else if (value.length) {
|
|
2917
|
-
appendTo(dict, decode(value), '');
|
|
2902
|
+
const URLSearchParams = process.env.TARO_PLATFORM === 'web' ? env.window.URLSearchParams : (_a = class {
|
|
2903
|
+
constructor(query) {
|
|
2904
|
+
_dict.set(this, Object.create(null));
|
|
2905
|
+
query !== null && query !== void 0 ? query : (query = '');
|
|
2906
|
+
const dict = __classPrivateFieldGet(this, _dict, "f");
|
|
2907
|
+
if (typeof query === 'string') {
|
|
2908
|
+
if (query.charAt(0) === '?') {
|
|
2909
|
+
query = query.slice(1);
|
|
2918
2910
|
}
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2911
|
+
for (let pairs = query.split('&'), i = 0, length = pairs.length; i < length; i++) {
|
|
2912
|
+
const value = pairs[i];
|
|
2913
|
+
const index = value.indexOf('=');
|
|
2914
|
+
if (index > -1) {
|
|
2915
|
+
appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
|
|
2916
|
+
}
|
|
2917
|
+
else if (value.length) {
|
|
2918
|
+
appendTo(dict, decode(value), '');
|
|
2919
|
+
}
|
|
2926
2920
|
}
|
|
2927
2921
|
}
|
|
2928
|
-
else if (query.forEach) {
|
|
2929
|
-
query.forEach(addEach, dict);
|
|
2930
|
-
}
|
|
2931
2922
|
else {
|
|
2932
|
-
|
|
2933
|
-
|
|
2923
|
+
if (isArray(query)) {
|
|
2924
|
+
for (let i = 0, length = query.length; i < length; i++) {
|
|
2925
|
+
const value = query[i];
|
|
2926
|
+
appendTo(dict, value[0], value[1]);
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
else if (query.forEach) {
|
|
2930
|
+
query.forEach(addEach, dict);
|
|
2931
|
+
}
|
|
2932
|
+
else {
|
|
2933
|
+
for (const key in query) {
|
|
2934
|
+
appendTo(dict, key, query[key]);
|
|
2935
|
+
}
|
|
2934
2936
|
}
|
|
2935
2937
|
}
|
|
2936
2938
|
}
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2939
|
+
append(name, value) {
|
|
2940
|
+
appendTo(__classPrivateFieldGet(this, _dict, "f"), name, value);
|
|
2941
|
+
}
|
|
2942
|
+
delete(name) {
|
|
2943
|
+
delete __classPrivateFieldGet(this, _dict, "f")[name];
|
|
2944
|
+
}
|
|
2945
|
+
get(name) {
|
|
2946
|
+
const dict = __classPrivateFieldGet(this, _dict, "f");
|
|
2947
|
+
return name in dict ? dict[name][0] : null;
|
|
2948
|
+
}
|
|
2949
|
+
getAll(name) {
|
|
2950
|
+
const dict = __classPrivateFieldGet(this, _dict, "f");
|
|
2951
|
+
return name in dict ? dict[name].slice(0) : [];
|
|
2952
|
+
}
|
|
2953
|
+
has(name) {
|
|
2954
|
+
return name in __classPrivateFieldGet(this, _dict, "f");
|
|
2955
|
+
}
|
|
2956
|
+
keys() {
|
|
2957
|
+
return Object.keys(__classPrivateFieldGet(this, _dict, "f"));
|
|
2958
|
+
}
|
|
2959
|
+
set(name, value) {
|
|
2960
|
+
__classPrivateFieldGet(this, _dict, "f")[name] = ['' + value];
|
|
2961
|
+
}
|
|
2962
|
+
forEach(callback, thisArg) {
|
|
2963
|
+
const dict = __classPrivateFieldGet(this, _dict, "f");
|
|
2964
|
+
Object.getOwnPropertyNames(dict).forEach(function (name) {
|
|
2965
|
+
dict[name].forEach(function (value) {
|
|
2966
|
+
callback.call(thisArg, value, name, this);
|
|
2967
|
+
}, this);
|
|
2966
2968
|
}, this);
|
|
2967
|
-
}
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2969
|
+
}
|
|
2970
|
+
toJSON() {
|
|
2971
|
+
return {};
|
|
2972
|
+
}
|
|
2973
|
+
toString() {
|
|
2974
|
+
const dict = __classPrivateFieldGet(this, _dict, "f");
|
|
2975
|
+
const query = [];
|
|
2976
|
+
for (const key in dict) {
|
|
2977
|
+
const name = encode(key);
|
|
2978
|
+
for (let i = 0, value = dict[key]; i < value.length; i++) {
|
|
2979
|
+
query.push(name + '=' + encode(value[i]));
|
|
2980
|
+
}
|
|
2979
2981
|
}
|
|
2982
|
+
return query.join('&');
|
|
2980
2983
|
}
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
_URLSearchParams_dict = new WeakMap();
|
|
2984
|
+
},
|
|
2985
|
+
_dict = new WeakMap(),
|
|
2986
|
+
_a);
|
|
2985
2987
|
|
|
2986
|
-
var
|
|
2987
|
-
class
|
|
2988
|
+
var _TaroURL_hash, _TaroURL_hostname, _TaroURL_pathname, _TaroURL_port, _TaroURL_protocol, _TaroURL_search;
|
|
2989
|
+
class TaroURL {
|
|
2988
2990
|
static createObjectURL() {
|
|
2989
2991
|
throw new Error('Oops, not support URL.createObjectURL() in miniprogram.');
|
|
2990
2992
|
}
|
|
@@ -2993,29 +2995,29 @@ class URL {
|
|
|
2993
2995
|
}
|
|
2994
2996
|
constructor(url, base) {
|
|
2995
2997
|
/* private property */
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
2998
|
+
_TaroURL_hash.set(this, '');
|
|
2999
|
+
_TaroURL_hostname.set(this, '');
|
|
3000
|
+
_TaroURL_pathname.set(this, '');
|
|
3001
|
+
_TaroURL_port.set(this, '');
|
|
3002
|
+
_TaroURL_protocol.set(this, '');
|
|
3003
|
+
_TaroURL_search.set(this, void 0);
|
|
3002
3004
|
if (!isString(url))
|
|
3003
3005
|
url = String(url);
|
|
3004
3006
|
const parseResult = parseUrlBase(url, base);
|
|
3005
3007
|
const { hash, hostname, pathname, port, protocol, search } = parseResult;
|
|
3006
|
-
__classPrivateFieldSet(this,
|
|
3007
|
-
__classPrivateFieldSet(this,
|
|
3008
|
-
__classPrivateFieldSet(this,
|
|
3009
|
-
__classPrivateFieldSet(this,
|
|
3010
|
-
__classPrivateFieldSet(this,
|
|
3011
|
-
__classPrivateFieldSet(this,
|
|
3008
|
+
__classPrivateFieldSet(this, _TaroURL_hash, hash, "f");
|
|
3009
|
+
__classPrivateFieldSet(this, _TaroURL_hostname, hostname, "f");
|
|
3010
|
+
__classPrivateFieldSet(this, _TaroURL_pathname, pathname || '/', "f");
|
|
3011
|
+
__classPrivateFieldSet(this, _TaroURL_port, port, "f");
|
|
3012
|
+
__classPrivateFieldSet(this, _TaroURL_protocol, protocol, "f");
|
|
3013
|
+
__classPrivateFieldSet(this, _TaroURL_search, new URLSearchParams(search), "f");
|
|
3012
3014
|
}
|
|
3013
3015
|
/* public property */
|
|
3014
3016
|
get protocol() {
|
|
3015
|
-
return __classPrivateFieldGet(this,
|
|
3017
|
+
return __classPrivateFieldGet(this, _TaroURL_protocol, "f");
|
|
3016
3018
|
}
|
|
3017
3019
|
set protocol(val) {
|
|
3018
|
-
isString(val) && (__classPrivateFieldSet(this,
|
|
3020
|
+
isString(val) && (__classPrivateFieldSet(this, _TaroURL_protocol, val.trim(), "f"));
|
|
3019
3021
|
}
|
|
3020
3022
|
get host() {
|
|
3021
3023
|
return this.hostname + (this.port ? ':' + this.port : '');
|
|
@@ -3029,19 +3031,19 @@ class URL {
|
|
|
3029
3031
|
}
|
|
3030
3032
|
}
|
|
3031
3033
|
get hostname() {
|
|
3032
|
-
return __classPrivateFieldGet(this,
|
|
3034
|
+
return __classPrivateFieldGet(this, _TaroURL_hostname, "f");
|
|
3033
3035
|
}
|
|
3034
3036
|
set hostname(val) {
|
|
3035
|
-
val && isString(val) && (__classPrivateFieldSet(this,
|
|
3037
|
+
val && isString(val) && (__classPrivateFieldSet(this, _TaroURL_hostname, val.trim(), "f"));
|
|
3036
3038
|
}
|
|
3037
3039
|
get port() {
|
|
3038
|
-
return __classPrivateFieldGet(this,
|
|
3040
|
+
return __classPrivateFieldGet(this, _TaroURL_port, "f");
|
|
3039
3041
|
}
|
|
3040
3042
|
set port(val) {
|
|
3041
|
-
isString(val) && (__classPrivateFieldSet(this,
|
|
3043
|
+
isString(val) && (__classPrivateFieldSet(this, _TaroURL_port, val.trim(), "f"));
|
|
3042
3044
|
}
|
|
3043
3045
|
get pathname() {
|
|
3044
|
-
return __classPrivateFieldGet(this,
|
|
3046
|
+
return __classPrivateFieldGet(this, _TaroURL_pathname, "f");
|
|
3045
3047
|
}
|
|
3046
3048
|
set pathname(val) {
|
|
3047
3049
|
if (isString(val)) {
|
|
@@ -3052,31 +3054,31 @@ class URL {
|
|
|
3052
3054
|
temp = temp.replace(HEAD_REG, '');
|
|
3053
3055
|
}
|
|
3054
3056
|
if (temp)
|
|
3055
|
-
__classPrivateFieldSet(this,
|
|
3057
|
+
__classPrivateFieldSet(this, _TaroURL_pathname, '/' + temp, "f");
|
|
3056
3058
|
else
|
|
3057
|
-
__classPrivateFieldSet(this,
|
|
3059
|
+
__classPrivateFieldSet(this, _TaroURL_pathname, '/', "f");
|
|
3058
3060
|
}
|
|
3059
3061
|
}
|
|
3060
3062
|
get search() {
|
|
3061
|
-
const val = __classPrivateFieldGet(this,
|
|
3063
|
+
const val = __classPrivateFieldGet(this, _TaroURL_search, "f").toString();
|
|
3062
3064
|
return (val.length === 0 || val.startsWith('?')) ? val : `?${val}`;
|
|
3063
3065
|
}
|
|
3064
3066
|
set search(val) {
|
|
3065
3067
|
if (isString(val)) {
|
|
3066
3068
|
val = val.trim();
|
|
3067
|
-
__classPrivateFieldSet(this,
|
|
3069
|
+
__classPrivateFieldSet(this, _TaroURL_search, new URLSearchParams(val), "f");
|
|
3068
3070
|
}
|
|
3069
3071
|
}
|
|
3070
3072
|
get hash() {
|
|
3071
|
-
return __classPrivateFieldGet(this,
|
|
3073
|
+
return __classPrivateFieldGet(this, _TaroURL_hash, "f");
|
|
3072
3074
|
}
|
|
3073
3075
|
set hash(val) {
|
|
3074
3076
|
if (isString(val)) {
|
|
3075
3077
|
val = val.trim();
|
|
3076
3078
|
if (val)
|
|
3077
|
-
__classPrivateFieldSet(this,
|
|
3079
|
+
__classPrivateFieldSet(this, _TaroURL_hash, val.startsWith('#') ? val : `#${val}`, "f");
|
|
3078
3080
|
else
|
|
3079
|
-
__classPrivateFieldSet(this,
|
|
3081
|
+
__classPrivateFieldSet(this, _TaroURL_hash, '', "f");
|
|
3080
3082
|
}
|
|
3081
3083
|
}
|
|
3082
3084
|
get href() {
|
|
@@ -3107,7 +3109,7 @@ class URL {
|
|
|
3107
3109
|
}
|
|
3108
3110
|
}
|
|
3109
3111
|
get searchParams() {
|
|
3110
|
-
return __classPrivateFieldGet(this,
|
|
3112
|
+
return __classPrivateFieldGet(this, _TaroURL_search, "f");
|
|
3111
3113
|
}
|
|
3112
3114
|
// public method
|
|
3113
3115
|
toString() {
|
|
@@ -3131,7 +3133,8 @@ class URL {
|
|
|
3131
3133
|
};
|
|
3132
3134
|
}
|
|
3133
3135
|
}
|
|
3134
|
-
|
|
3136
|
+
_TaroURL_hash = new WeakMap(), _TaroURL_hostname = new WeakMap(), _TaroURL_pathname = new WeakMap(), _TaroURL_port = new WeakMap(), _TaroURL_protocol = new WeakMap(), _TaroURL_search = new WeakMap();
|
|
3137
|
+
const URL = process.env.TARO_PLATFORM === 'web' ? env.window.URL : TaroURL;
|
|
3135
3138
|
function parseUrl(url = '') {
|
|
3136
3139
|
const result = {
|
|
3137
3140
|
href: '',
|
|
@@ -3322,49 +3325,42 @@ class TaroDocument extends TaroElement {
|
|
|
3322
3325
|
}
|
|
3323
3326
|
}
|
|
3324
3327
|
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
doc.head = head;
|
|
3356
|
-
doc.body = body;
|
|
3357
|
-
return doc;
|
|
3358
|
-
}
|
|
3359
|
-
document$1 = env.document = createDocument();
|
|
3360
|
-
}
|
|
3361
|
-
else {
|
|
3362
|
-
document$1 = env.document;
|
|
3328
|
+
function createDocument() {
|
|
3329
|
+
/**
|
|
3330
|
+
* <document>
|
|
3331
|
+
* <html>
|
|
3332
|
+
* <head></head>
|
|
3333
|
+
* <body>
|
|
3334
|
+
* <container>
|
|
3335
|
+
* <app id="app" />
|
|
3336
|
+
* </container>
|
|
3337
|
+
* </body>
|
|
3338
|
+
* </html>
|
|
3339
|
+
* </document>
|
|
3340
|
+
*/
|
|
3341
|
+
const doc = new TaroDocument();
|
|
3342
|
+
const documentCreateElement = doc.createElement.bind(doc);
|
|
3343
|
+
const html = documentCreateElement(HTML);
|
|
3344
|
+
const head = documentCreateElement(HEAD);
|
|
3345
|
+
const body = documentCreateElement(BODY);
|
|
3346
|
+
const app = documentCreateElement(APP);
|
|
3347
|
+
app.id = APP;
|
|
3348
|
+
const container = documentCreateElement(CONTAINER); // 多包一层主要为了兼容 vue
|
|
3349
|
+
doc.appendChild(html);
|
|
3350
|
+
html.appendChild(head);
|
|
3351
|
+
html.appendChild(body);
|
|
3352
|
+
body.appendChild(container);
|
|
3353
|
+
container.appendChild(app);
|
|
3354
|
+
doc.documentElement = html;
|
|
3355
|
+
doc.head = head;
|
|
3356
|
+
doc.body = body;
|
|
3357
|
+
return doc;
|
|
3363
3358
|
}
|
|
3359
|
+
const document$1 = process.env.TARO_PLATFORM === 'web' ? env.document : createDocument();
|
|
3364
3360
|
|
|
3365
|
-
function
|
|
3361
|
+
const getComputedStyle = process.env.TARO_PLATFORM === 'web' ? env.window.getComputedStyle : function (element) {
|
|
3366
3362
|
return element.style;
|
|
3367
|
-
}
|
|
3363
|
+
};
|
|
3368
3364
|
|
|
3369
3365
|
const eventCenter = hooks.call('getEventCenter', Events);
|
|
3370
3366
|
|
|
@@ -3393,72 +3389,72 @@ class RuntimeCache {
|
|
|
3393
3389
|
}
|
|
3394
3390
|
}
|
|
3395
3391
|
|
|
3396
|
-
var
|
|
3392
|
+
var _TaroHistory_instances, _TaroHistory_location, _TaroHistory_stack, _TaroHistory_cur, _TaroHistory_window, _TaroHistory_reset;
|
|
3397
3393
|
const cache$1 = new RuntimeCache('history');
|
|
3398
|
-
class
|
|
3394
|
+
class TaroHistory extends Events {
|
|
3399
3395
|
constructor(location, options) {
|
|
3400
3396
|
super();
|
|
3401
|
-
|
|
3397
|
+
_TaroHistory_instances.add(this);
|
|
3402
3398
|
/* private property */
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
__classPrivateFieldSet(this,
|
|
3408
|
-
__classPrivateFieldSet(this,
|
|
3409
|
-
__classPrivateFieldGet(this,
|
|
3399
|
+
_TaroHistory_location.set(this, void 0);
|
|
3400
|
+
_TaroHistory_stack.set(this, []);
|
|
3401
|
+
_TaroHistory_cur.set(this, 0);
|
|
3402
|
+
_TaroHistory_window.set(this, void 0);
|
|
3403
|
+
__classPrivateFieldSet(this, _TaroHistory_window, options.window, "f");
|
|
3404
|
+
__classPrivateFieldSet(this, _TaroHistory_location, location, "f");
|
|
3405
|
+
__classPrivateFieldGet(this, _TaroHistory_location, "f").on('__record_history__', (href) => {
|
|
3410
3406
|
var _a;
|
|
3411
|
-
__classPrivateFieldSet(this,
|
|
3412
|
-
__classPrivateFieldSet(this,
|
|
3413
|
-
__classPrivateFieldGet(this,
|
|
3407
|
+
__classPrivateFieldSet(this, _TaroHistory_cur, (_a = __classPrivateFieldGet(this, _TaroHistory_cur, "f"), _a++, _a), "f");
|
|
3408
|
+
__classPrivateFieldSet(this, _TaroHistory_stack, __classPrivateFieldGet(this, _TaroHistory_stack, "f").slice(0, __classPrivateFieldGet(this, _TaroHistory_cur, "f")), "f");
|
|
3409
|
+
__classPrivateFieldGet(this, _TaroHistory_stack, "f").push({
|
|
3414
3410
|
state: null,
|
|
3415
3411
|
title: '',
|
|
3416
3412
|
url: href
|
|
3417
3413
|
});
|
|
3418
3414
|
}, null);
|
|
3419
|
-
__classPrivateFieldGet(this,
|
|
3420
|
-
__classPrivateFieldGet(this,
|
|
3415
|
+
__classPrivateFieldGet(this, _TaroHistory_location, "f").on('__reset_history__', (href) => {
|
|
3416
|
+
__classPrivateFieldGet(this, _TaroHistory_instances, "m", _TaroHistory_reset).call(this, href);
|
|
3421
3417
|
}, null);
|
|
3422
3418
|
// 切换上下文行为
|
|
3423
3419
|
this.on(CONTEXT_ACTIONS.INIT, () => {
|
|
3424
|
-
__classPrivateFieldGet(this,
|
|
3420
|
+
__classPrivateFieldGet(this, _TaroHistory_instances, "m", _TaroHistory_reset).call(this);
|
|
3425
3421
|
}, null);
|
|
3426
3422
|
this.on(CONTEXT_ACTIONS.RESTORE, (pageId) => {
|
|
3427
3423
|
cache$1.set(pageId, {
|
|
3428
|
-
location: __classPrivateFieldGet(this,
|
|
3429
|
-
stack: __classPrivateFieldGet(this,
|
|
3430
|
-
cur: __classPrivateFieldGet(this,
|
|
3424
|
+
location: __classPrivateFieldGet(this, _TaroHistory_location, "f"),
|
|
3425
|
+
stack: __classPrivateFieldGet(this, _TaroHistory_stack, "f").slice(),
|
|
3426
|
+
cur: __classPrivateFieldGet(this, _TaroHistory_cur, "f")
|
|
3431
3427
|
});
|
|
3432
3428
|
}, null);
|
|
3433
3429
|
this.on(CONTEXT_ACTIONS.RECOVER, (pageId) => {
|
|
3434
3430
|
if (cache$1.has(pageId)) {
|
|
3435
3431
|
const ctx = cache$1.get(pageId);
|
|
3436
|
-
__classPrivateFieldSet(this,
|
|
3437
|
-
__classPrivateFieldSet(this,
|
|
3438
|
-
__classPrivateFieldSet(this,
|
|
3432
|
+
__classPrivateFieldSet(this, _TaroHistory_location, ctx.location, "f");
|
|
3433
|
+
__classPrivateFieldSet(this, _TaroHistory_stack, ctx.stack, "f");
|
|
3434
|
+
__classPrivateFieldSet(this, _TaroHistory_cur, ctx.cur, "f");
|
|
3439
3435
|
}
|
|
3440
3436
|
}, null);
|
|
3441
3437
|
this.on(CONTEXT_ACTIONS.DESTORY, (pageId) => {
|
|
3442
3438
|
cache$1.delete(pageId);
|
|
3443
3439
|
}, null);
|
|
3444
|
-
__classPrivateFieldGet(this,
|
|
3440
|
+
__classPrivateFieldGet(this, _TaroHistory_instances, "m", _TaroHistory_reset).call(this);
|
|
3445
3441
|
}
|
|
3446
3442
|
/* public property */
|
|
3447
3443
|
get length() {
|
|
3448
|
-
return __classPrivateFieldGet(this,
|
|
3444
|
+
return __classPrivateFieldGet(this, _TaroHistory_stack, "f").length;
|
|
3449
3445
|
}
|
|
3450
3446
|
get state() {
|
|
3451
|
-
return __classPrivateFieldGet(this,
|
|
3447
|
+
return __classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")].state;
|
|
3452
3448
|
}
|
|
3453
3449
|
/* public method */
|
|
3454
3450
|
go(delta) {
|
|
3455
3451
|
if (!isNumber(delta) || isNaN(delta))
|
|
3456
3452
|
return;
|
|
3457
|
-
let targetIdx = __classPrivateFieldGet(this,
|
|
3453
|
+
let targetIdx = __classPrivateFieldGet(this, _TaroHistory_cur, "f") + delta;
|
|
3458
3454
|
targetIdx = Math.min(Math.max(targetIdx, 0), this.length - 1);
|
|
3459
|
-
__classPrivateFieldSet(this,
|
|
3460
|
-
__classPrivateFieldGet(this,
|
|
3461
|
-
__classPrivateFieldGet(this,
|
|
3455
|
+
__classPrivateFieldSet(this, _TaroHistory_cur, targetIdx, "f");
|
|
3456
|
+
__classPrivateFieldGet(this, _TaroHistory_location, "f").trigger('__set_href_without_history__', __classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")].url);
|
|
3457
|
+
__classPrivateFieldGet(this, _TaroHistory_window, "f").trigger('popstate', __classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")]);
|
|
3462
3458
|
}
|
|
3463
3459
|
back() {
|
|
3464
3460
|
this.go(-1);
|
|
@@ -3469,40 +3465,41 @@ class History extends Events {
|
|
|
3469
3465
|
pushState(state, title, url) {
|
|
3470
3466
|
if (!url || !isString(url))
|
|
3471
3467
|
return;
|
|
3472
|
-
__classPrivateFieldSet(this,
|
|
3473
|
-
__classPrivateFieldGet(this,
|
|
3468
|
+
__classPrivateFieldSet(this, _TaroHistory_stack, __classPrivateFieldGet(this, _TaroHistory_stack, "f").slice(0, __classPrivateFieldGet(this, _TaroHistory_cur, "f") + 1), "f");
|
|
3469
|
+
__classPrivateFieldGet(this, _TaroHistory_stack, "f").push({
|
|
3474
3470
|
state,
|
|
3475
3471
|
title,
|
|
3476
3472
|
url
|
|
3477
3473
|
});
|
|
3478
|
-
__classPrivateFieldSet(this,
|
|
3479
|
-
__classPrivateFieldGet(this,
|
|
3474
|
+
__classPrivateFieldSet(this, _TaroHistory_cur, this.length - 1, "f");
|
|
3475
|
+
__classPrivateFieldGet(this, _TaroHistory_location, "f").trigger('__set_href_without_history__', url);
|
|
3480
3476
|
}
|
|
3481
3477
|
replaceState(state, title, url) {
|
|
3482
3478
|
if (!url || !isString(url))
|
|
3483
3479
|
return;
|
|
3484
|
-
__classPrivateFieldGet(this,
|
|
3480
|
+
__classPrivateFieldGet(this, _TaroHistory_stack, "f")[__classPrivateFieldGet(this, _TaroHistory_cur, "f")] = {
|
|
3485
3481
|
state,
|
|
3486
3482
|
title,
|
|
3487
3483
|
url
|
|
3488
3484
|
};
|
|
3489
|
-
__classPrivateFieldGet(this,
|
|
3485
|
+
__classPrivateFieldGet(this, _TaroHistory_location, "f").trigger('__set_href_without_history__', url);
|
|
3490
3486
|
}
|
|
3491
3487
|
// For debug
|
|
3492
3488
|
get cache() {
|
|
3493
3489
|
return cache$1;
|
|
3494
3490
|
}
|
|
3495
3491
|
}
|
|
3496
|
-
|
|
3497
|
-
__classPrivateFieldSet(this,
|
|
3492
|
+
_TaroHistory_location = new WeakMap(), _TaroHistory_stack = new WeakMap(), _TaroHistory_cur = new WeakMap(), _TaroHistory_window = new WeakMap(), _TaroHistory_instances = new WeakSet(), _TaroHistory_reset = function _TaroHistory_reset(href = '') {
|
|
3493
|
+
__classPrivateFieldSet(this, _TaroHistory_stack, [
|
|
3498
3494
|
{
|
|
3499
3495
|
state: null,
|
|
3500
3496
|
title: '',
|
|
3501
|
-
url: href || __classPrivateFieldGet(this,
|
|
3497
|
+
url: href || __classPrivateFieldGet(this, _TaroHistory_location, "f").href
|
|
3502
3498
|
}
|
|
3503
3499
|
], "f");
|
|
3504
|
-
__classPrivateFieldSet(this,
|
|
3500
|
+
__classPrivateFieldSet(this, _TaroHistory_cur, 0, "f");
|
|
3505
3501
|
};
|
|
3502
|
+
const History = process.env.TARO_PLATFORM === 'web' ? env.window.History : TaroHistory;
|
|
3506
3503
|
|
|
3507
3504
|
const Current = {
|
|
3508
3505
|
app: null,
|
|
@@ -3511,31 +3508,31 @@ const Current = {
|
|
|
3511
3508
|
};
|
|
3512
3509
|
const getCurrentInstance = () => Current;
|
|
3513
3510
|
|
|
3514
|
-
var
|
|
3511
|
+
var _TaroLocation_instances, _TaroLocation_url, _TaroLocation_noCheckUrl, _TaroLocation_window, _TaroLocation_reset, _TaroLocation_getPreValue, _TaroLocation_rollBack, _TaroLocation_recordHistory, _TaroLocation_checkUrlChange;
|
|
3515
3512
|
const INIT_URL = 'https://taro.com';
|
|
3516
3513
|
const cache = new RuntimeCache('location');
|
|
3517
|
-
class
|
|
3514
|
+
class TaroLocation extends Events {
|
|
3518
3515
|
constructor(options) {
|
|
3519
3516
|
super();
|
|
3520
|
-
|
|
3517
|
+
_TaroLocation_instances.add(this);
|
|
3521
3518
|
/* private property */
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
__classPrivateFieldSet(this,
|
|
3526
|
-
__classPrivateFieldGet(this,
|
|
3519
|
+
_TaroLocation_url.set(this, new URL(INIT_URL));
|
|
3520
|
+
_TaroLocation_noCheckUrl.set(this, false);
|
|
3521
|
+
_TaroLocation_window.set(this, void 0);
|
|
3522
|
+
__classPrivateFieldSet(this, _TaroLocation_window, options.window, "f");
|
|
3523
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_reset).call(this);
|
|
3527
3524
|
this.on('__set_href_without_history__', (href) => {
|
|
3528
|
-
__classPrivateFieldSet(this,
|
|
3529
|
-
const lastHash = __classPrivateFieldGet(this,
|
|
3530
|
-
__classPrivateFieldGet(this,
|
|
3531
|
-
if (lastHash !== __classPrivateFieldGet(this,
|
|
3532
|
-
__classPrivateFieldGet(this,
|
|
3525
|
+
__classPrivateFieldSet(this, _TaroLocation_noCheckUrl, true, "f");
|
|
3526
|
+
const lastHash = __classPrivateFieldGet(this, _TaroLocation_url, "f").hash;
|
|
3527
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").href = generateFullUrl(href);
|
|
3528
|
+
if (lastHash !== __classPrivateFieldGet(this, _TaroLocation_url, "f").hash) {
|
|
3529
|
+
__classPrivateFieldGet(this, _TaroLocation_window, "f").trigger('hashchange');
|
|
3533
3530
|
}
|
|
3534
|
-
__classPrivateFieldSet(this,
|
|
3531
|
+
__classPrivateFieldSet(this, _TaroLocation_noCheckUrl, false, "f");
|
|
3535
3532
|
}, null);
|
|
3536
3533
|
// 切换上下文行为
|
|
3537
3534
|
this.on(CONTEXT_ACTIONS.INIT, () => {
|
|
3538
|
-
__classPrivateFieldGet(this,
|
|
3535
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_reset).call(this);
|
|
3539
3536
|
}, null);
|
|
3540
3537
|
this.on(CONTEXT_ACTIONS.RESTORE, (pageId) => {
|
|
3541
3538
|
cache.set(pageId, {
|
|
@@ -3546,9 +3543,9 @@ class Location extends Events {
|
|
|
3546
3543
|
// 数据恢复时,不需要执行跳转
|
|
3547
3544
|
if (cache.has(pageId)) {
|
|
3548
3545
|
const ctx = cache.get(pageId);
|
|
3549
|
-
__classPrivateFieldSet(this,
|
|
3550
|
-
__classPrivateFieldGet(this,
|
|
3551
|
-
__classPrivateFieldSet(this,
|
|
3546
|
+
__classPrivateFieldSet(this, _TaroLocation_noCheckUrl, true, "f");
|
|
3547
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").href = ctx.lastHref;
|
|
3548
|
+
__classPrivateFieldSet(this, _TaroLocation_noCheckUrl, false, "f");
|
|
3552
3549
|
}
|
|
3553
3550
|
}, null);
|
|
3554
3551
|
this.on(CONTEXT_ACTIONS.DESTORY, (pageId) => {
|
|
@@ -3557,81 +3554,81 @@ class Location extends Events {
|
|
|
3557
3554
|
}
|
|
3558
3555
|
/* public property */
|
|
3559
3556
|
get protocol() {
|
|
3560
|
-
return __classPrivateFieldGet(this,
|
|
3557
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").protocol;
|
|
3561
3558
|
}
|
|
3562
3559
|
set protocol(val) {
|
|
3563
3560
|
const REG = /^(http|https):$/i;
|
|
3564
3561
|
if (!val || !isString(val) || !REG.test(val.trim()))
|
|
3565
3562
|
return;
|
|
3566
3563
|
val = val.trim();
|
|
3567
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3568
|
-
__classPrivateFieldGet(this,
|
|
3569
|
-
if (__classPrivateFieldGet(this,
|
|
3570
|
-
__classPrivateFieldGet(this,
|
|
3564
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3565
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").protocol = val;
|
|
3566
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3567
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3571
3568
|
}
|
|
3572
3569
|
get host() {
|
|
3573
|
-
return __classPrivateFieldGet(this,
|
|
3570
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").host;
|
|
3574
3571
|
}
|
|
3575
3572
|
set host(val) {
|
|
3576
3573
|
if (!val || !isString(val))
|
|
3577
3574
|
return;
|
|
3578
3575
|
val = val.trim();
|
|
3579
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3580
|
-
__classPrivateFieldGet(this,
|
|
3581
|
-
if (__classPrivateFieldGet(this,
|
|
3582
|
-
__classPrivateFieldGet(this,
|
|
3576
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3577
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").host = val;
|
|
3578
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3579
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3583
3580
|
}
|
|
3584
3581
|
get hostname() {
|
|
3585
|
-
return __classPrivateFieldGet(this,
|
|
3582
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").hostname;
|
|
3586
3583
|
}
|
|
3587
3584
|
set hostname(val) {
|
|
3588
3585
|
if (!val || !isString(val))
|
|
3589
3586
|
return;
|
|
3590
3587
|
val = val.trim();
|
|
3591
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3592
|
-
__classPrivateFieldGet(this,
|
|
3593
|
-
if (__classPrivateFieldGet(this,
|
|
3594
|
-
__classPrivateFieldGet(this,
|
|
3588
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3589
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").hostname = val;
|
|
3590
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3591
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3595
3592
|
}
|
|
3596
3593
|
get port() {
|
|
3597
|
-
return __classPrivateFieldGet(this,
|
|
3594
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").port;
|
|
3598
3595
|
}
|
|
3599
3596
|
set port(val) {
|
|
3600
3597
|
const xVal = Number((val = val.trim()));
|
|
3601
3598
|
if (!isNumber(xVal) || xVal <= 0)
|
|
3602
3599
|
return;
|
|
3603
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3604
|
-
__classPrivateFieldGet(this,
|
|
3605
|
-
if (__classPrivateFieldGet(this,
|
|
3606
|
-
__classPrivateFieldGet(this,
|
|
3600
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3601
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").port = val;
|
|
3602
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3603
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3607
3604
|
}
|
|
3608
3605
|
get pathname() {
|
|
3609
|
-
return __classPrivateFieldGet(this,
|
|
3606
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").pathname;
|
|
3610
3607
|
}
|
|
3611
3608
|
set pathname(val) {
|
|
3612
3609
|
if (!val || !isString(val))
|
|
3613
3610
|
return;
|
|
3614
3611
|
val = val.trim();
|
|
3615
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3616
|
-
__classPrivateFieldGet(this,
|
|
3617
|
-
if (__classPrivateFieldGet(this,
|
|
3618
|
-
__classPrivateFieldGet(this,
|
|
3612
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3613
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").pathname = val;
|
|
3614
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3615
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3619
3616
|
}
|
|
3620
3617
|
get search() {
|
|
3621
|
-
return __classPrivateFieldGet(this,
|
|
3618
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").search;
|
|
3622
3619
|
}
|
|
3623
3620
|
set search(val) {
|
|
3624
3621
|
if (!val || !isString(val))
|
|
3625
3622
|
return;
|
|
3626
3623
|
val = val.trim();
|
|
3627
3624
|
val = val.startsWith('?') ? val : `?${val}`;
|
|
3628
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3629
|
-
__classPrivateFieldGet(this,
|
|
3630
|
-
if (__classPrivateFieldGet(this,
|
|
3631
|
-
__classPrivateFieldGet(this,
|
|
3625
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3626
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").search = val;
|
|
3627
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3628
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3632
3629
|
}
|
|
3633
3630
|
get hash() {
|
|
3634
|
-
return __classPrivateFieldGet(this,
|
|
3631
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").hash;
|
|
3635
3632
|
}
|
|
3636
3633
|
// 小程序的navigateTo存在截断hash字符串的问题
|
|
3637
3634
|
set hash(val) {
|
|
@@ -3639,34 +3636,34 @@ class Location extends Events {
|
|
|
3639
3636
|
return;
|
|
3640
3637
|
val = val.trim();
|
|
3641
3638
|
val = val.startsWith('#') ? val : `#${val}`;
|
|
3642
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3643
|
-
__classPrivateFieldGet(this,
|
|
3644
|
-
if (__classPrivateFieldGet(this,
|
|
3645
|
-
__classPrivateFieldGet(this,
|
|
3639
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3640
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").hash = val;
|
|
3641
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3642
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3646
3643
|
}
|
|
3647
3644
|
get href() {
|
|
3648
|
-
return __classPrivateFieldGet(this,
|
|
3645
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").href;
|
|
3649
3646
|
}
|
|
3650
3647
|
set href(val) {
|
|
3651
3648
|
const REG = /^(http:|https:)?\/\/.+/;
|
|
3652
3649
|
if (!val || !isString(val) || !REG.test((val = val.trim())))
|
|
3653
3650
|
return;
|
|
3654
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3655
|
-
__classPrivateFieldGet(this,
|
|
3656
|
-
if (__classPrivateFieldGet(this,
|
|
3657
|
-
__classPrivateFieldGet(this,
|
|
3651
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3652
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").href = val;
|
|
3653
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3654
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3658
3655
|
}
|
|
3659
3656
|
get origin() {
|
|
3660
|
-
return __classPrivateFieldGet(this,
|
|
3657
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f").origin;
|
|
3661
3658
|
}
|
|
3662
3659
|
set origin(val) {
|
|
3663
3660
|
const REG = /^(http:|https:)?\/\/.+/;
|
|
3664
3661
|
if (!val || !isString(val) || !REG.test((val = val.trim())))
|
|
3665
3662
|
return;
|
|
3666
|
-
const preValue = __classPrivateFieldGet(this,
|
|
3667
|
-
__classPrivateFieldGet(this,
|
|
3668
|
-
if (__classPrivateFieldGet(this,
|
|
3669
|
-
__classPrivateFieldGet(this,
|
|
3663
|
+
const preValue = __classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_getPreValue).call(this);
|
|
3664
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").origin = val;
|
|
3665
|
+
if (__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_checkUrlChange).call(this, preValue))
|
|
3666
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_recordHistory).call(this);
|
|
3670
3667
|
}
|
|
3671
3668
|
/* public method */
|
|
3672
3669
|
assign() {
|
|
@@ -3686,7 +3683,7 @@ class Location extends Events {
|
|
|
3686
3683
|
return cache;
|
|
3687
3684
|
}
|
|
3688
3685
|
}
|
|
3689
|
-
|
|
3686
|
+
_TaroLocation_url = new WeakMap(), _TaroLocation_noCheckUrl = new WeakMap(), _TaroLocation_window = new WeakMap(), _TaroLocation_instances = new WeakSet(), _TaroLocation_reset = function _TaroLocation_reset() {
|
|
3690
3687
|
const Current = getCurrentInstance();
|
|
3691
3688
|
const router = Current.router;
|
|
3692
3689
|
if (router) {
|
|
@@ -3696,23 +3693,23 @@ _Location_url = new WeakMap(), _Location_noCheckUrl = new WeakMap(), _Location_w
|
|
|
3696
3693
|
});
|
|
3697
3694
|
const searchStr = searchArr.length > 0 ? '?' + searchArr.join('&') : '';
|
|
3698
3695
|
const url = `${INIT_URL}${path.startsWith('/') ? path : '/' + path}${searchStr}`;
|
|
3699
|
-
__classPrivateFieldSet(this,
|
|
3696
|
+
__classPrivateFieldSet(this, _TaroLocation_url, new URL(url), "f");
|
|
3700
3697
|
this.trigger('__reset_history__', this.href);
|
|
3701
3698
|
}
|
|
3702
|
-
},
|
|
3703
|
-
return __classPrivateFieldGet(this,
|
|
3704
|
-
},
|
|
3705
|
-
__classPrivateFieldGet(this,
|
|
3706
|
-
},
|
|
3699
|
+
}, _TaroLocation_getPreValue = function _TaroLocation_getPreValue() {
|
|
3700
|
+
return __classPrivateFieldGet(this, _TaroLocation_url, "f")._toRaw();
|
|
3701
|
+
}, _TaroLocation_rollBack = function _TaroLocation_rollBack(href) {
|
|
3702
|
+
__classPrivateFieldGet(this, _TaroLocation_url, "f").href = href;
|
|
3703
|
+
}, _TaroLocation_recordHistory = function _TaroLocation_recordHistory() {
|
|
3707
3704
|
this.trigger('__record_history__', this.href);
|
|
3708
|
-
},
|
|
3709
|
-
if (__classPrivateFieldGet(this,
|
|
3705
|
+
}, _TaroLocation_checkUrlChange = function _TaroLocation_checkUrlChange(preValue) {
|
|
3706
|
+
if (__classPrivateFieldGet(this, _TaroLocation_noCheckUrl, "f")) {
|
|
3710
3707
|
return false;
|
|
3711
3708
|
}
|
|
3712
|
-
const { protocol, hostname, port, pathname, search, hash } = __classPrivateFieldGet(this,
|
|
3709
|
+
const { protocol, hostname, port, pathname, search, hash } = __classPrivateFieldGet(this, _TaroLocation_url, "f")._toRaw();
|
|
3713
3710
|
// 跨域三要素不允许修改
|
|
3714
3711
|
if (protocol !== preValue.protocol || hostname !== preValue.hostname || port !== preValue.port) {
|
|
3715
|
-
__classPrivateFieldGet(this,
|
|
3712
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_rollBack).call(this, preValue.href);
|
|
3716
3713
|
return false;
|
|
3717
3714
|
}
|
|
3718
3715
|
// pathname
|
|
@@ -3725,12 +3722,13 @@ _Location_url = new WeakMap(), _Location_noCheckUrl = new WeakMap(), _Location_w
|
|
|
3725
3722
|
}
|
|
3726
3723
|
// hashchange
|
|
3727
3724
|
if (hash !== preValue.hash) {
|
|
3728
|
-
__classPrivateFieldGet(this,
|
|
3725
|
+
__classPrivateFieldGet(this, _TaroLocation_window, "f").trigger('hashchange');
|
|
3729
3726
|
return true;
|
|
3730
3727
|
}
|
|
3731
|
-
__classPrivateFieldGet(this,
|
|
3728
|
+
__classPrivateFieldGet(this, _TaroLocation_instances, "m", _TaroLocation_rollBack).call(this, preValue.href);
|
|
3732
3729
|
return false;
|
|
3733
3730
|
};
|
|
3731
|
+
const Location = process.env.TARO_PLATFORM === 'web' ? env.window.Location : TaroLocation;
|
|
3734
3732
|
function generateFullUrl(val = '') {
|
|
3735
3733
|
const origin = INIT_URL;
|
|
3736
3734
|
if (/^[/?#]/.test(val)) {
|
|
@@ -3743,7 +3741,7 @@ const machine = 'Macintosh';
|
|
|
3743
3741
|
const arch = 'Intel Mac OS X 10_14_5';
|
|
3744
3742
|
const engine = 'AppleWebKit/534.36 (KHTML, like Gecko) NodeJS/v4.1.0 Chrome/76.0.3809.132 Safari/534.36';
|
|
3745
3743
|
const msg = '(' + machine + '; ' + arch + ') ' + engine;
|
|
3746
|
-
const nav =
|
|
3744
|
+
const nav = process.env.TARO_PLATFORM === 'web' ? env.window.navigator : {
|
|
3747
3745
|
appCodeName: 'Mozilla',
|
|
3748
3746
|
appName: 'Netscape',
|
|
3749
3747
|
appVersion: '5.0 ' + msg,
|
|
@@ -3790,88 +3788,83 @@ const _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame
|
|
|
3790
3788
|
clearTimeout(seed);
|
|
3791
3789
|
};
|
|
3792
3790
|
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3816
|
-
console.warn(`[Taro warn] window.${String(property)} 在赋值到 window 时报错`);
|
|
3817
|
-
}
|
|
3791
|
+
class TaroWindow extends Events {
|
|
3792
|
+
constructor() {
|
|
3793
|
+
super();
|
|
3794
|
+
this.navigator = nav;
|
|
3795
|
+
this.requestAnimationFrame = _raf;
|
|
3796
|
+
this.cancelAnimationFrame = _caf;
|
|
3797
|
+
this.getComputedStyle = getComputedStyle;
|
|
3798
|
+
const globalProperties = [
|
|
3799
|
+
...Object.getOwnPropertyNames(global || {}),
|
|
3800
|
+
...Object.getOwnPropertySymbols(global || {})
|
|
3801
|
+
];
|
|
3802
|
+
globalProperties.forEach(property => {
|
|
3803
|
+
if (property === 'atob' || property === 'document')
|
|
3804
|
+
return;
|
|
3805
|
+
if (!Object.prototype.hasOwnProperty.call(this, property)) {
|
|
3806
|
+
// 防止小程序环境下,window 上的某些 get 属性在赋值时报错
|
|
3807
|
+
try {
|
|
3808
|
+
this[property] = global[property];
|
|
3809
|
+
}
|
|
3810
|
+
catch (e) {
|
|
3811
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3812
|
+
console.warn(`[Taro warn] window.${String(property)} 在赋值到 window 时报错`);
|
|
3818
3813
|
}
|
|
3819
3814
|
}
|
|
3820
|
-
}
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
}
|
|
3827
|
-
initEvent()
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3815
|
+
}
|
|
3816
|
+
});
|
|
3817
|
+
this.Date || (this.Date = Date);
|
|
3818
|
+
// 应用启动时,提供给需要读取历史信息的库使用
|
|
3819
|
+
this.location = new Location({ window: this });
|
|
3820
|
+
// @ts-ignore
|
|
3821
|
+
this.history = new History(this.location, { window: this });
|
|
3822
|
+
this.initEvent();
|
|
3823
|
+
}
|
|
3824
|
+
initEvent() {
|
|
3825
|
+
const _location = this.location;
|
|
3826
|
+
const _history = this.history;
|
|
3827
|
+
this.on(CONTEXT_ACTIONS.INIT, (pageId) => {
|
|
3828
|
+
// 页面onload,为该页面建立新的上下文信息
|
|
3829
|
+
_location.trigger(CONTEXT_ACTIONS.INIT, pageId);
|
|
3830
|
+
}, null);
|
|
3831
|
+
this.on(CONTEXT_ACTIONS.RECOVER, (pageId) => {
|
|
3832
|
+
// 页面onshow,恢复当前页面的上下文信息
|
|
3833
|
+
_location.trigger(CONTEXT_ACTIONS.RECOVER, pageId);
|
|
3834
|
+
_history.trigger(CONTEXT_ACTIONS.RECOVER, pageId);
|
|
3835
|
+
}, null);
|
|
3836
|
+
this.on(CONTEXT_ACTIONS.RESTORE, (pageId) => {
|
|
3837
|
+
// 页面onhide,缓存当前页面的上下文信息
|
|
3838
|
+
_location.trigger(CONTEXT_ACTIONS.RESTORE, pageId);
|
|
3839
|
+
_history.trigger(CONTEXT_ACTIONS.RESTORE, pageId);
|
|
3840
|
+
}, null);
|
|
3841
|
+
this.on(CONTEXT_ACTIONS.DESTORY, (pageId) => {
|
|
3842
|
+
// 页面onunload,清除当前页面的上下文信息
|
|
3843
|
+
_location.trigger(CONTEXT_ACTIONS.DESTORY, pageId);
|
|
3844
|
+
_history.trigger(CONTEXT_ACTIONS.DESTORY, pageId);
|
|
3845
|
+
}, null);
|
|
3846
|
+
}
|
|
3847
|
+
get document() {
|
|
3848
|
+
return env.document;
|
|
3849
|
+
}
|
|
3850
|
+
addEventListener(event, callback) {
|
|
3851
|
+
if (!isString(event))
|
|
3852
|
+
return;
|
|
3853
|
+
this.on(event, callback, null);
|
|
3854
|
+
}
|
|
3855
|
+
removeEventListener(event, callback) {
|
|
3856
|
+
if (!isString(event))
|
|
3857
|
+
return;
|
|
3858
|
+
this.off(event, callback, null);
|
|
3859
|
+
}
|
|
3860
|
+
setTimeout(...args) {
|
|
3861
|
+
return setTimeout(...args);
|
|
3862
|
+
}
|
|
3863
|
+
clearTimeout(...args) {
|
|
3864
|
+
return clearTimeout(...args);
|
|
3869
3865
|
}
|
|
3870
|
-
window$1 = env.window = new Window();
|
|
3871
|
-
}
|
|
3872
|
-
else {
|
|
3873
|
-
window$1 = env.window;
|
|
3874
3866
|
}
|
|
3867
|
+
const window$1 = process.env.TARO_PLATFORM === 'web' ? env.window : (env.window || new TaroWindow());
|
|
3875
3868
|
const location = window$1.location;
|
|
3876
3869
|
const history = window$1.history;
|
|
3877
3870
|
|
|
@@ -3882,7 +3875,6 @@ class SVGElement extends TaroElement {
|
|
|
3882
3875
|
/* eslint-disable dot-notation */
|
|
3883
3876
|
const instances = new Map();
|
|
3884
3877
|
const pageId = incrementId();
|
|
3885
|
-
const isWeb = isWebPlatform();
|
|
3886
3878
|
function injectPageInstance(inst, id) {
|
|
3887
3879
|
hooks.call('mergePageInstance', instances.get(id), inst);
|
|
3888
3880
|
instances.set(id, inst);
|
|
@@ -3925,7 +3917,7 @@ function stringify(obj) {
|
|
|
3925
3917
|
}
|
|
3926
3918
|
function getPath(id, options) {
|
|
3927
3919
|
const idx = id.indexOf('?');
|
|
3928
|
-
if (
|
|
3920
|
+
if (process.env.TARO_PLATFORM === 'web') {
|
|
3929
3921
|
return `${idx > -1 ? id.substring(0, idx) : id}${stringify((options === null || options === void 0 ? void 0 : options.stamp) ? { stamp: options.stamp } : {})}`;
|
|
3930
3922
|
}
|
|
3931
3923
|
else {
|
|
@@ -3949,7 +3941,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
3949
3941
|
let unmounting = false;
|
|
3950
3942
|
let prepareMountList = [];
|
|
3951
3943
|
function setCurrentRouter(page) {
|
|
3952
|
-
const router =
|
|
3944
|
+
const router = process.env.TARO_PLATFORM === 'web' ? page.$taroPath : page.route || page.__route__ || page.$taroPath;
|
|
3953
3945
|
Current.router = {
|
|
3954
3946
|
params: page.$taroParams,
|
|
3955
3947
|
path: addLeadingSlash(router),
|
|
@@ -3973,7 +3965,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
3973
3965
|
// this.$taroPath 是页面唯一标识
|
|
3974
3966
|
const uniqueOptions = Object.assign({}, options, { $taroTimestamp: Date.now() });
|
|
3975
3967
|
const $taroPath = this.$taroPath = getPath(id, uniqueOptions);
|
|
3976
|
-
if (
|
|
3968
|
+
if (process.env.TARO_PLATFORM === 'web') {
|
|
3977
3969
|
config.path = $taroPath;
|
|
3978
3970
|
}
|
|
3979
3971
|
// this.$taroParams 作为暴露给开发者的页面参数对象,可以被随意修改
|
|
@@ -3982,7 +3974,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
3982
3974
|
}
|
|
3983
3975
|
setCurrentRouter(this);
|
|
3984
3976
|
// 初始化当前页面的上下文信息
|
|
3985
|
-
if (
|
|
3977
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
3986
3978
|
window$1.trigger(CONTEXT_ACTIONS.INIT, $taroPath);
|
|
3987
3979
|
}
|
|
3988
3980
|
const mount = () => {
|
|
@@ -3991,7 +3983,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
3991
3983
|
ensure(pageElement !== null, '没有找到页面实例。');
|
|
3992
3984
|
safeExecute($taroPath, ON_LOAD, this.$taroParams);
|
|
3993
3985
|
loadResolver();
|
|
3994
|
-
if (
|
|
3986
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
3995
3987
|
pageElement.ctx = this;
|
|
3996
3988
|
pageElement.performUpdate(true, cb);
|
|
3997
3989
|
}
|
|
@@ -4010,7 +4002,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
4010
4002
|
[ONUNLOAD]() {
|
|
4011
4003
|
const $taroPath = this.$taroPath;
|
|
4012
4004
|
// 销毁当前页面的上下文信息
|
|
4013
|
-
if (
|
|
4005
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
4014
4006
|
window$1.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath);
|
|
4015
4007
|
}
|
|
4016
4008
|
// 触发onUnload生命周期
|
|
@@ -4044,7 +4036,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
4044
4036
|
Current.page = this;
|
|
4045
4037
|
setCurrentRouter(this);
|
|
4046
4038
|
// 恢复上下文信息
|
|
4047
|
-
if (
|
|
4039
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
4048
4040
|
window$1.trigger(CONTEXT_ACTIONS.RECOVER, this.$taroPath);
|
|
4049
4041
|
}
|
|
4050
4042
|
// 触发生命周期
|
|
@@ -4055,7 +4047,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
4055
4047
|
},
|
|
4056
4048
|
[ONHIDE]() {
|
|
4057
4049
|
// 缓存当前页面上下文信息
|
|
4058
|
-
if (
|
|
4050
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
4059
4051
|
window$1.trigger(CONTEXT_ACTIONS.RESTORE, this.$taroPath);
|
|
4060
4052
|
}
|
|
4061
4053
|
// 设置 Current 的 page 和 router
|
|
@@ -4128,7 +4120,7 @@ function createComponentConfig(component, componentName, data) {
|
|
|
4128
4120
|
ensure(componentElement !== null, '没有找到组件实例。');
|
|
4129
4121
|
this.$taroInstances = instances.get(path);
|
|
4130
4122
|
safeExecute(path, ON_LOAD);
|
|
4131
|
-
if (
|
|
4123
|
+
if (process.env.TARO_PLATFORM !== 'web') {
|
|
4132
4124
|
componentElement.ctx = this;
|
|
4133
4125
|
componentElement.performUpdate(true);
|
|
4134
4126
|
}
|
|
@@ -4226,7 +4218,7 @@ const nextTick = (cb, ctx) => {
|
|
|
4226
4218
|
var _a, _b, _c;
|
|
4227
4219
|
const pageElement = env.document.getElementById(path);
|
|
4228
4220
|
if (pageElement === null || pageElement === void 0 ? void 0 : pageElement.pendingUpdate) {
|
|
4229
|
-
if (
|
|
4221
|
+
if (process.env.TARO_PLATFORM === 'web') {
|
|
4230
4222
|
// eslint-disable-next-line dot-notation
|
|
4231
4223
|
(_c = (_b = (_a = pageElement.firstChild) === null || _a === void 0 ? void 0 : _a['componentOnReady']) === null || _b === void 0 ? void 0 : _b.call(_a).then(() => {
|
|
4232
4224
|
timerFunc();
|