uni-shared.cjs.js 46.2 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6
'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var shared = require('@vue/shared');

7
const BUILT_IN_TAG_NAMES = [
fxy060608's avatar
fxy060608 已提交
8
    'ad',
fxy060608's avatar
fxy060608 已提交
9 10
    'ad-content-page',
    'ad-draw',
fxy060608's avatar
fxy060608 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    'audio',
    'button',
    'camera',
    'canvas',
    'checkbox',
    'checkbox-group',
    'cover-image',
    'cover-view',
    'editor',
    'form',
    'functional-page-navigator',
    'icon',
    'image',
    'input',
    'label',
    'live-player',
    'live-pusher',
    'map',
    'movable-area',
    'movable-view',
    'navigator',
    'official-account',
    'open-data',
    'picker',
    'picker-view',
    'picker-view-column',
    'progress',
    'radio',
    'radio-group',
    'rich-text',
    'scroll-view',
    'slider',
    'swiper',
    'swiper-item',
    'switch',
    'text',
    'textarea',
    'video',
    'view',
    'web-view',
51 52
];
const BUILT_IN_TAGS = BUILT_IN_TAG_NAMES.map((tag) => 'uni-' + tag);
fxy060608's avatar
fxy060608 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
const TAGS = [
    'app',
    'layout',
    'content',
    'main',
    'top-window',
    'left-window',
    'right-window',
    'tabbar',
    'page',
    'page-head',
    'page-wrapper',
    'page-body',
    'page-refresh',
    'actionsheet',
    'modal',
    'toast',
    'resize-sensor',
    'shadow-root',
].map((tag) => 'uni-' + tag);
fxy060608's avatar
fxy060608 已提交
73
const NVUE_BUILT_IN_TAGS = [
fxy060608's avatar
fxy060608 已提交
74 75 76 77 78 79 80 81 82 83 84 85
    'svg',
    'view',
    'a',
    'div',
    'img',
    'image',
    'text',
    'span',
    'input',
    'textarea',
    'spinner',
    'select',
fxy060608's avatar
fxy060608 已提交
86 87
    // slider 被自定义 u-slider 替代
    // 'slider',
fxy060608's avatar
fxy060608 已提交
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
    'slider-neighbor',
    'indicator',
    'canvas',
    'list',
    'cell',
    'header',
    'loading',
    'loading-indicator',
    'refresh',
    'scrollable',
    'scroller',
    'video',
    'web',
    'embed',
    'tabbar',
    'tabheader',
    'datepicker',
    'timepicker',
    'marquee',
    'countdown',
fxy060608's avatar
fxy060608 已提交
108
    'dc-switch',
109 110 111
    'waterfall',
    'richtext',
    'recycle-list',
fxy060608's avatar
fxy060608 已提交
112
    'u-scalable',
fxy060608's avatar
fxy060608 已提交
113
    'barcode',
fxy060608's avatar
fxy060608 已提交
114
    'gcanvas',
fxy060608's avatar
fxy060608 已提交
115 116
];
const NVUE_U_BUILT_IN_TAGS = [
fxy060608's avatar
fxy060608 已提交
117 118 119 120 121 122 123 124 125
    'u-text',
    'u-image',
    'u-input',
    'u-textarea',
    'u-video',
    'u-web-view',
    'u-slider',
    'u-ad',
    'u-ad-draw',
fxy060608's avatar
fxy060608 已提交
126
    'u-rich-text',
fxy060608's avatar
fxy060608 已提交
127
];
fxy060608's avatar
fxy060608 已提交
128
function isBuiltInComponent(tag) {
129 130
    // h5 平台会被转换为 v-uni-
    return BUILT_IN_TAGS.indexOf('uni-' + tag.replace('v-uni-', '')) !== -1;
fxy060608's avatar
fxy060608 已提交
131
}
fxy060608's avatar
fxy060608 已提交
132
function isH5CustomElement(tag) {
fxy060608's avatar
fxy060608 已提交
133 134
    return TAGS.indexOf(tag) !== -1 || BUILT_IN_TAGS.indexOf(tag) !== -1;
}
fxy060608's avatar
fxy060608 已提交
135
function isH5NativeTag(tag) {
fxy060608's avatar
fxy060608 已提交
136 137 138
    return (tag !== 'head' &&
        (shared.isHTMLTag(tag) || shared.isSVGTag(tag)) &&
        !isBuiltInComponent(tag));
fxy060608's avatar
fxy060608 已提交
139
}
fxy060608's avatar
fxy060608 已提交
140
function isAppNativeTag(tag) {
fxy060608's avatar
fxy060608 已提交
141 142
    return shared.isHTMLTag(tag) || shared.isSVGTag(tag) || isBuiltInComponent(tag);
}
fxy060608's avatar
fxy060608 已提交
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
const NVUE_CUSTOM_COMPONENTS = [
    'ad',
    'ad-draw',
    'button',
    'checkbox-group',
    'checkbox',
    'form',
    'icon',
    'label',
    'movable-area',
    'movable-view',
    'navigator',
    'picker',
    'progress',
    'radio-group',
    'radio',
    'rich-text',
    'swiper-item',
    'swiper',
    'switch',
fxy060608's avatar
fxy060608 已提交
163
    'slider',
fxy060608's avatar
fxy060608 已提交
164 165 166
    'picker-view',
    'picker-view-column',
];
fxy060608's avatar
fxy060608 已提交
167
function isAppNVueNativeTag(tag) {
fxy060608's avatar
fxy060608 已提交
168 169 170
    if (NVUE_BUILT_IN_TAGS.includes(tag)) {
        return true;
    }
fxy060608's avatar
fxy060608 已提交
171 172 173
    if (NVUE_CUSTOM_COMPONENTS.includes(tag)) {
        return false;
    }
fxy060608's avatar
fxy060608 已提交
174 175 176
    if (isBuiltInComponent(tag)) {
        return true;
    }
fxy060608's avatar
fxy060608 已提交
177
    // u-text,u-video...
fxy060608's avatar
fxy060608 已提交
178
    if (NVUE_U_BUILT_IN_TAGS.includes(tag)) {
fxy060608's avatar
fxy060608 已提交
179 180 181 182
        return true;
    }
    return false;
}
fxy060608's avatar
fxy060608 已提交
183 184 185 186 187 188 189
function isMiniProgramNativeTag(tag) {
    return isBuiltInComponent(tag);
}
function createIsCustomElement(tags = []) {
    return function isCustomElement(tag) {
        return tags.includes(tag);
    };
fxy060608's avatar
fxy060608 已提交
190
}
fxy060608's avatar
fxy060608 已提交
191 192 193
function isComponentTag(tag) {
    return tag[0].toLowerCase() + tag.slice(1) === 'component';
}
fxy060608's avatar
fxy060608 已提交
194 195 196
const COMPONENT_SELECTOR_PREFIX = 'uni-';
const COMPONENT_PREFIX = 'v-' + COMPONENT_SELECTOR_PREFIX;

fxy060608's avatar
fxy060608 已提交
197 198 199 200 201
const LINEFEED = '\n';
const NAVBAR_HEIGHT = 44;
const TABBAR_HEIGHT = 50;
const ON_REACH_BOTTOM_DISTANCE = 50;
const RESPONSIVE_MIN_WIDTH = 768;
fxy060608's avatar
fxy060608 已提交
202
const UNI_STORAGE_LOCALE = 'UNI_LOCALE';
fxy060608's avatar
fxy060608 已提交
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
// quickapp-webview 不能使用 default 作为插槽名称
const SLOT_DEFAULT_NAME = 'd';
const COMPONENT_NAME_PREFIX = 'VUni';
const I18N_JSON_DELIMITERS = ['%', '%'];
const PRIMARY_COLOR = '#007aff';
const SELECTED_COLOR = '#0062cc'; // 选中的颜色,如选项卡默认的选中颜色
const BACKGROUND_COLOR = '#f7f7f7'; // 背景色,如标题栏默认背景色
const UNI_SSR = '__uniSSR';
const UNI_SSR_TITLE = 'title';
const UNI_SSR_STORE = 'store';
const UNI_SSR_DATA = 'data';
const UNI_SSR_GLOBAL_DATA = 'globalData';
const SCHEME_RE = /^([a-z-]+:)?\/\//i;
const DATA_RE = /^data:.*,.*/;
const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE';
const WXS_PROTOCOL = 'wxs://';
const JSON_PROTOCOL = 'json://';
const WXS_MODULES = 'wxsModules';
const RENDERJS_MODULES = 'renderjsModules';
// lifecycle
// App and Page
const ON_SHOW = 'onShow';
const ON_HIDE = 'onHide';
//App
const ON_LAUNCH = 'onLaunch';
const ON_ERROR = 'onError';
const ON_THEME_CHANGE = 'onThemeChange';
const ON_KEYBOARD_HEIGHT_CHANGE = 'onKeyboardHeightChange';
const ON_PAGE_NOT_FOUND = 'onPageNotFound';
const ON_UNHANDLE_REJECTION = 'onUnhandledRejection';
//Page
const ON_LOAD = 'onLoad';
const ON_READY = 'onReady';
const ON_UNLOAD = 'onUnload';
fxy060608's avatar
fxy060608 已提交
237 238
// 百度特有
const ON_INIT = 'onInit';
fxy060608's avatar
fxy060608 已提交
239 240
// 微信特有
const ON_SAVE_EXIT_STATE = 'onSaveExitState';
fxy060608's avatar
fxy060608 已提交
241 242 243 244 245 246 247 248 249 250 251
const ON_RESIZE = 'onResize';
const ON_BACK_PRESS = 'onBackPress';
const ON_PAGE_SCROLL = 'onPageScroll';
const ON_TAB_ITEM_TAP = 'onTabItemTap';
const ON_REACH_BOTTOM = 'onReachBottom';
const ON_PULL_DOWN_REFRESH = 'onPullDownRefresh';
const ON_SHARE_TIMELINE = 'onShareTimeline';
const ON_ADD_TO_FAVORITES = 'onAddToFavorites';
const ON_SHARE_APP_MESSAGE = 'onShareAppMessage';
// navigationBar
const ON_NAVIGATION_BAR_BUTTON_TAP = 'onNavigationBarButtonTap';
252
const ON_NAVIGATION_BAR_CHANGE = 'onNavigationBarChange';
fxy060608's avatar
fxy060608 已提交
253 254 255 256 257 258 259 260 261 262
const ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = 'onNavigationBarSearchInputClicked';
const ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = 'onNavigationBarSearchInputChanged';
const ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = 'onNavigationBarSearchInputConfirmed';
const ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = 'onNavigationBarSearchInputFocusChanged';
// framework
const ON_APP_ENTER_FOREGROUND = 'onAppEnterForeground';
const ON_APP_ENTER_BACKGROUND = 'onAppEnterBackground';
const ON_WEB_INVOKE_APP_SERVICE = 'onWebInvokeAppService';
const ON_WXS_INVOKE_CALL_METHOD = 'onWxsInvokeCallMethod';

263 264 265 266 267 268 269
function isComponentInternalInstance(vm) {
    return !!vm.appContext;
}
function resolveComponentInstance(instance) {
    return (instance &&
        (isComponentInternalInstance(instance) ? instance.proxy : instance));
}
fxy060608's avatar
fxy060608 已提交
270 271 272 273 274 275 276 277 278 279 280
function resolveOwnerVm(vm) {
    if (!vm) {
        return;
    }
    let componentName = vm.type.name;
    while (componentName && isBuiltInComponent(shared.hyphenate(componentName))) {
        // ownerInstance 内置组件需要使用父 vm
        vm = vm.parent;
        componentName = vm.type.name;
    }
    return vm.proxy;
fxy060608's avatar
fxy060608 已提交
281 282 283 284 285 286 287 288 289 290 291 292 293
}
function isElement(el) {
    // Element
    return el.nodeType === 1;
}
function resolveOwnerEl(instance) {
    const { vnode } = instance;
    if (isElement(vnode.el)) {
        return vnode.el;
    }
    const { subTree } = instance;
    // ShapeFlags.ARRAY_CHILDREN = 1<<4
    if (subTree.shapeFlag & 16) {
fxy060608's avatar
fxy060608 已提交
294
        const elemVNode = subTree.children.find((vnode) => vnode.el && isElement(vnode.el));
fxy060608's avatar
fxy060608 已提交
295 296 297 298 299
        if (elemVNode) {
            return elemVNode.el;
        }
    }
    return vnode.el;
fxy060608's avatar
fxy060608 已提交
300 301 302
}
function dynamicSlotName(name) {
    return name === 'default' ? SLOT_DEFAULT_NAME : name;
303 304 305 306
}
const customizeRE = /:/g;
function customizeEvent(str) {
    return shared.camelize(str.replace(customizeRE, '-'));
fxy060608's avatar
fxy060608 已提交
307 308
}

fxy060608's avatar
fxy060608 已提交
309
let lastLogTime = 0;
fxy060608's avatar
fxy060608 已提交
310
function formatLog(module, ...args) {
fxy060608's avatar
fxy060608 已提交
311 312 313 314
    const now = Date.now();
    const diff = lastLogTime ? now - lastLogTime : 0;
    lastLogTime = now;
    return `[${now}][${diff}ms][${module}]:${args
fxy060608's avatar
fxy060608 已提交
315 316 317 318
        .map((arg) => JSON.stringify(arg))
        .join(' ')}`;
}

319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
function cache(fn) {
    const cache = Object.create(null);
    return (str) => {
        const hit = cache[str];
        return hit || (cache[str] = fn(str));
    };
}
function cacheStringFunction(fn) {
    return cache(fn);
}
function getLen(str = '') {
    return ('' + str).replace(/[^\x00-\xff]/g, '**').length;
}
function hasLeadingSlash(str) {
    return str.indexOf('/') === 0;
}
function addLeadingSlash(str) {
    return hasLeadingSlash(str) ? str : '/' + str;
}
function removeLeadingSlash(str) {
fxy060608's avatar
fxy060608 已提交
339
    return hasLeadingSlash(str) ? str.slice(1) : str;
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
}
const invokeArrayFns = (fns, arg) => {
    let ret;
    for (let i = 0; i < fns.length; i++) {
        ret = fns[i](arg);
    }
    return ret;
};
function updateElementStyle(element, styles) {
    for (const attrName in styles) {
        element.style[attrName] = styles[attrName];
    }
}
function once(fn, ctx = null) {
    let res;
    return ((...args) => {
        if (fn) {
            res = fn.apply(ctx, args);
            fn = null;
        }
        return res;
    });
}
const sanitise = (val) => (val && JSON.parse(JSON.stringify(val))) || val;
const _completeValue = (value) => (value > 9 ? value : '0' + value);
function formatDateTime({ date = new Date(), mode = 'date' }) {
    if (mode === 'time') {
        return (_completeValue(date.getHours()) + ':' + _completeValue(date.getMinutes()));
    }
    else {
        return (date.getFullYear() +
            '-' +
            _completeValue(date.getMonth() + 1) +
            '-' +
            _completeValue(date.getDate()));
    }
}
function callOptions(options, data) {
    options = options || {};
379
    if (shared.isString(data)) {
380 381 382 383 384
        data = {
            errMsg: data,
        };
    }
    if (/:ok$/.test(data.errMsg)) {
385
        if (shared.isFunction(options.success)) {
386 387 388 389
            options.success(data);
        }
    }
    else {
390
        if (shared.isFunction(options.fail)) {
391 392 393
            options.fail(data);
        }
    }
394
    if (shared.isFunction(options.complete)) {
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
        options.complete(data);
    }
}
function getValueByDataPath(obj, path) {
    if (!shared.isString(path)) {
        return;
    }
    path = path.replace(/\[(\d+)\]/g, '.$1');
    const parts = path.split('.');
    let key = parts[0];
    if (!obj) {
        obj = {};
    }
    if (parts.length === 1) {
        return obj[key];
    }
    return getValueByDataPath(obj[key], parts.slice(1).join('.'));
D
DCloud_LXH 已提交
412 413 414 415 416 417 418 419 420 421 422 423
}
function sortObject(obj) {
    let sortObj = {};
    if (shared.isPlainObject(obj)) {
        Object.keys(obj)
            .sort()
            .forEach((key) => {
            const _key = key;
            sortObj[_key] = obj[_key];
        });
    }
    return !Object.keys(sortObj) ? obj : sortObj;
424 425
}

Q
qiang 已提交
426 427 428
function formatKey(key) {
    return shared.camelize(key.substring(5));
}
429 430
// question/139181,增加副作用,避免 initCustomDataset 在 build 下被 tree-shaking
const initCustomDatasetOnce = /*#__PURE__*/ once(() => {
Q
qiang 已提交
431 432 433 434
    const prototype = HTMLElement.prototype;
    const setAttribute = prototype.setAttribute;
    prototype.setAttribute = function (key, value) {
        if (key.startsWith('data-') && this.tagName.startsWith('UNI-')) {
fxy060608's avatar
fxy060608 已提交
435 436
            const dataset = this.__uniDataset ||
                (this.__uniDataset = {});
Q
qiang 已提交
437 438 439 440 441 442 443 444 445 446 447 448 449
            dataset[formatKey(key)] = value;
        }
        setAttribute.call(this, key, value);
    };
    const removeAttribute = prototype.removeAttribute;
    prototype.removeAttribute = function (key) {
        if (this.__uniDataset &&
            key.startsWith('data-') &&
            this.tagName.startsWith('UNI-')) {
            delete this.__uniDataset[formatKey(key)];
        }
        removeAttribute.call(this, key);
    };
450
});
Q
qiang 已提交
451
function getCustomDataset(el) {
fxy060608's avatar
fxy060608 已提交
452
    return shared.extend({}, el.dataset, el.__uniDataset);
Q
qiang 已提交
453 454
}

fxy060608's avatar
fxy060608 已提交
455 456 457 458 459 460 461 462 463 464 465
const unitRE = new RegExp(`"[^"]+"|'[^']+'|url\\([^)]+\\)|(\\d*\\.?\\d+)[r|u]px`, 'g');
function toFixed(number, precision) {
    const multiplier = Math.pow(10, precision + 1);
    const wholeNumber = Math.floor(number * multiplier);
    return (Math.round(wholeNumber / 10) * 10) / multiplier;
}
const defaultRpx2Unit = {
    unit: 'rem',
    unitRatio: 10 / 320,
    unitPrecision: 5,
};
fxy060608's avatar
fxy060608 已提交
466 467 468 469 470
const defaultMiniProgramRpx2Unit = {
    unit: 'rpx',
    unitRatio: 1,
    unitPrecision: 1,
};
fxy060608's avatar
fxy060608 已提交
471
const defaultNVueRpx2Unit = defaultMiniProgramRpx2Unit;
fxy060608's avatar
fxy060608 已提交
472
function createRpx2Unit(unit, unitRatio, unitPrecision) {
Q
qiang 已提交
473
    // ignore: rpxCalcIncludeWidth
fxy060608's avatar
fxy060608 已提交
474 475 476 477
    return (val) => val.replace(unitRE, (m, $1) => {
        if (!$1) {
            return m;
        }
fxy060608's avatar
fxy060608 已提交
478 479 480
        if (unitRatio === 1) {
            return `${$1}${unit}`;
        }
fxy060608's avatar
fxy060608 已提交
481 482 483 484 485
        const value = toFixed(parseFloat($1) * unitRatio, unitPrecision);
        return value === 0 ? '0' : `${value}${unit}`;
    });
}

fxy060608's avatar
fxy060608 已提交
486 487 488 489 490 491
function passive(passive) {
    return { passive };
}
function normalizeDataset(el) {
    // TODO
    return JSON.parse(JSON.stringify(el.dataset || {}));
fxy060608's avatar
fxy060608 已提交
492 493 494 495 496
}
function normalizeTarget(el) {
    const { id, offsetTop, offsetLeft } = el;
    return {
        id,
Q
qiang 已提交
497
        dataset: getCustomDataset(el),
fxy060608's avatar
fxy060608 已提交
498 499 500
        offsetTop,
        offsetLeft,
    };
fxy060608's avatar
fxy060608 已提交
501 502 503 504 505 506
}
function addFont(family, source, desc) {
    const fonts = document.fonts;
    if (fonts) {
        const fontFace = new FontFace(family, source, desc);
        return fontFace.load().then(() => {
507
            fonts.add && fonts.add(fontFace);
fxy060608's avatar
fxy060608 已提交
508 509 510 511 512 513
        });
    }
    return new Promise((resolve) => {
        const style = document.createElement('style');
        const values = [];
        if (desc) {
514
            const { style, weight, stretch, unicodeRange, variant, featureSettings } = desc;
fxy060608's avatar
fxy060608 已提交
515 516 517 518 519 520 521 522 523 524 525
            style && values.push(`font-style:${style}`);
            weight && values.push(`font-weight:${weight}`);
            stretch && values.push(`font-stretch:${stretch}`);
            unicodeRange && values.push(`unicode-range:${unicodeRange}`);
            variant && values.push(`font-variant:${variant}`);
            featureSettings && values.push(`font-feature-settings:${featureSettings}`);
        }
        style.innerText = `@font-face{font-family:"${family}";src:${source};${values.join(';')}}`;
        document.head.appendChild(style);
        resolve();
    });
fxy060608's avatar
fxy060608 已提交
526
}
D
DCloud_LXH 已提交
527
function scrollTo(scrollTop, duration, isH5) {
fxy060608's avatar
fxy060608 已提交
528 529 530
    if (shared.isString(scrollTop)) {
        const el = document.querySelector(scrollTop);
        if (el) {
D
DCloud_LXH 已提交
531 532 533 534 535
            const { height, top } = el.getBoundingClientRect();
            scrollTop = top + window.pageYOffset;
            if (isH5) {
                scrollTop -= height;
            }
fxy060608's avatar
fxy060608 已提交
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
        }
    }
    if (scrollTop < 0) {
        scrollTop = 0;
    }
    const documentElement = document.documentElement;
    const { clientHeight, scrollHeight } = documentElement;
    scrollTop = Math.min(scrollTop, scrollHeight - clientHeight);
    if (duration === 0) {
        // 部分浏览器(比如微信)中 scrollTop 的值需要通过 document.body 来控制
        documentElement.scrollTop = document.body.scrollTop = scrollTop;
        return;
    }
    if (window.scrollY === scrollTop) {
        return;
    }
    const scrollTo = (duration) => {
        if (duration <= 0) {
            window.scrollTo(0, scrollTop);
            return;
        }
        const distaince = scrollTop - window.scrollY;
        requestAnimationFrame(function () {
            window.scrollTo(0, window.scrollY + (distaince / duration) * 10);
            scrollTo(duration - 10);
        });
    };
    scrollTo(duration);
fxy060608's avatar
fxy060608 已提交
564 565
}

fxy060608's avatar
fxy060608 已提交
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652
const encode = encodeURIComponent;
function stringifyQuery(obj, encodeStr = encode) {
    const res = obj
        ? Object.keys(obj)
            .map((key) => {
            let val = obj[key];
            if (typeof val === undefined || val === null) {
                val = '';
            }
            else if (shared.isPlainObject(val)) {
                val = JSON.stringify(val);
            }
            return encodeStr(key) + '=' + encodeStr(val);
        })
            .filter((x) => x.length > 0)
            .join('&')
        : null;
    return res ? `?${res}` : '';
}
/**
 * Decode text using `decodeURIComponent`. Returns the original text if it
 * fails.
 *
 * @param text - string to decode
 * @returns decoded string
 */
function decode(text) {
    try {
        return decodeURIComponent('' + text);
    }
    catch (err) { }
    return '' + text;
}
function decodedQuery(query = {}) {
    const decodedQuery = {};
    Object.keys(query).forEach((name) => {
        try {
            decodedQuery[name] = decode(query[name]);
        }
        catch (e) {
            decodedQuery[name] = query[name];
        }
    });
    return decodedQuery;
}
const PLUS_RE = /\+/g; // %2B
/**
 * https://github.com/vuejs/vue-router-next/blob/master/src/query.ts
 * @internal
 *
 * @param search - search string to parse
 * @returns a query object
 */
function parseQuery(search) {
    const query = {};
    // avoid creating an object with an empty key and empty value
    // because of split('&')
    if (search === '' || search === '?')
        return query;
    const hasLeadingIM = search[0] === '?';
    const searchParams = (hasLeadingIM ? search.slice(1) : search).split('&');
    for (let i = 0; i < searchParams.length; ++i) {
        // pre decode the + into space
        const searchParam = searchParams[i].replace(PLUS_RE, ' ');
        // allow the = character
        let eqPos = searchParam.indexOf('=');
        let key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
        let value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
        if (key in query) {
            // an extra variable for ts types
            let currentValue = query[key];
            if (!shared.isArray(currentValue)) {
                currentValue = query[key] = [currentValue];
            }
            currentValue.push(value);
        }
        else {
            query[key] = value;
        }
    }
    return query;
}

function parseUrl(url) {
    const [path, querystring] = url.split('?', 2);
    return {
        path,
fxy060608's avatar
fxy060608 已提交
653
        query: parseQuery(querystring || ''),
fxy060608's avatar
fxy060608 已提交
654 655 656
    };
}

fxy060608's avatar
fxy060608 已提交
657 658 659 660 661 662 663 664 665 666 667 668
function parseNVueDataset(attr) {
    const dataset = {};
    if (attr) {
        Object.keys(attr).forEach((key) => {
            if (key.indexOf('data-') === 0) {
                dataset[key.replace('data-', '')] = attr[key];
            }
        });
    }
    return dataset;
}

fxy060608's avatar
fxy060608 已提交
669
function plusReady(callback) {
670
    if (!shared.isFunction(callback)) {
fxy060608's avatar
fxy060608 已提交
671 672 673 674 675 676 677 678
        return;
    }
    if (window.plus) {
        return callback();
    }
    document.addEventListener('plusready', callback);
}

fxy060608's avatar
fxy060608 已提交
679 680 681 682 683 684 685
class DOMException extends Error {
    constructor(message) {
        super(message);
        this.name = 'DOMException';
    }
}

fxy060608's avatar
fxy060608 已提交
686 687 688 689 690 691 692 693 694 695 696 697
function normalizeEventType(type, options) {
    if (options) {
        if (options.capture) {
            type += 'Capture';
        }
        if (options.once) {
            type += 'Once';
        }
        if (options.passive) {
            type += 'Passive';
        }
    }
fxy060608's avatar
fxy060608 已提交
698 699 700 701
    return `on${shared.capitalize(shared.camelize(type))}`;
}
class UniEvent {
    constructor(type, opts) {
fxy060608's avatar
fxy060608 已提交
702 703 704 705
        this.defaultPrevented = false;
        this.timeStamp = Date.now();
        this._stop = false;
        this._end = false;
fxy060608's avatar
fxy060608 已提交
706
        this.type = type;
fxy060608's avatar
fxy060608 已提交
707 708 709 710 711 712 713 714 715 716 717 718 719
        this.bubbles = !!opts.bubbles;
        this.cancelable = !!opts.cancelable;
    }
    preventDefault() {
        this.defaultPrevented = true;
    }
    stopImmediatePropagation() {
        this._end = this._stop = true;
    }
    stopPropagation() {
        this._stop = true;
    }
}
fxy060608's avatar
fxy060608 已提交
720 721 722 723 724 725 726 727 728 729 730 731
function createUniEvent(evt) {
    if (evt instanceof UniEvent) {
        return evt;
    }
    const [type] = parseEventName(evt.type);
    const uniEvent = new UniEvent(type, {
        bubbles: false,
        cancelable: false,
    });
    shared.extend(uniEvent, evt);
    return uniEvent;
}
fxy060608's avatar
fxy060608 已提交
732
class UniEventTarget {
fxy060608's avatar
fxy060608 已提交
733 734 735
    constructor() {
        this.listeners = Object.create(null);
    }
fxy060608's avatar
fxy060608 已提交
736
    dispatchEvent(evt) {
fxy060608's avatar
fxy060608 已提交
737
        const listeners = this.listeners[evt.type];
fxy060608's avatar
fxy060608 已提交
738
        if (!listeners) {
fxy060608's avatar
fxy060608 已提交
739 740 741
            if ((process.env.NODE_ENV !== 'production')) {
                console.error(formatLog('dispatchEvent', this.nodeId), evt.type, 'not found');
            }
fxy060608's avatar
fxy060608 已提交
742 743
            return false;
        }
fxy060608's avatar
fxy060608 已提交
744 745
        // 格式化事件类型
        const event = createUniEvent(evt);
fxy060608's avatar
fxy060608 已提交
746 747
        const len = listeners.length;
        for (let i = 0; i < len; i++) {
fxy060608's avatar
fxy060608 已提交
748 749
            listeners[i].call(this, event);
            if (event._end) {
fxy060608's avatar
fxy060608 已提交
750 751 752
                break;
            }
        }
fxy060608's avatar
fxy060608 已提交
753
        return event.cancelable && event.defaultPrevented;
fxy060608's avatar
fxy060608 已提交
754 755
    }
    addEventListener(type, listener, options) {
fxy060608's avatar
fxy060608 已提交
756
        type = normalizeEventType(type, options);
fxy060608's avatar
fxy060608 已提交
757
        (this.listeners[type] || (this.listeners[type] = [])).push(listener);
fxy060608's avatar
fxy060608 已提交
758 759
    }
    removeEventListener(type, callback, options) {
fxy060608's avatar
fxy060608 已提交
760
        type = normalizeEventType(type, options);
fxy060608's avatar
fxy060608 已提交
761
        const listeners = this.listeners[type];
fxy060608's avatar
fxy060608 已提交
762 763 764 765 766 767 768 769
        if (!listeners) {
            return;
        }
        const index = listeners.indexOf(callback);
        if (index > -1) {
            listeners.splice(index, 1);
        }
    }
fxy060608's avatar
fxy060608 已提交
770 771 772 773 774 775 776 777 778 779 780 781 782
}
const optionsModifierRE = /(?:Once|Passive|Capture)$/;
function parseEventName(name) {
    let options;
    if (optionsModifierRE.test(name)) {
        options = {};
        let m;
        while ((m = name.match(optionsModifierRE))) {
            name = name.slice(0, name.length - m[0].length);
            options[m[0].toLowerCase()] = true;
        }
    }
    return [shared.hyphenate(name.slice(2)), options];
fxy060608's avatar
fxy060608 已提交
783 784
}

Q
qiang 已提交
785 786 787 788 789 790 791
const EventModifierFlags = /*#__PURE__*/ (() => {
    return {
        stop: 1,
        prevent: 1 << 1,
        self: 1 << 2,
    };
})();
fxy060608's avatar
fxy060608 已提交
792 793 794 795 796 797 798 799 800 801 802 803
function encodeModifier(modifiers) {
    let flag = 0;
    if (modifiers.includes('stop')) {
        flag |= EventModifierFlags.stop;
    }
    if (modifiers.includes('prevent')) {
        flag |= EventModifierFlags.prevent;
    }
    if (modifiers.includes('self')) {
        flag |= EventModifierFlags.self;
    }
    return flag;
fxy060608's avatar
fxy060608 已提交
804 805
}

fxy060608's avatar
fxy060608 已提交
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
const NODE_TYPE_PAGE = 0;
const NODE_TYPE_ELEMENT = 1;
const NODE_TYPE_TEXT = 3;
const NODE_TYPE_COMMENT = 8;
function sibling(node, type) {
    const { parentNode } = node;
    if (!parentNode) {
        return null;
    }
    const { childNodes } = parentNode;
    return childNodes[childNodes.indexOf(node) + (type === 'n' ? 1 : -1)] || null;
}
function removeNode(node) {
    const { parentNode } = node;
    if (parentNode) {
        parentNode.removeChild(node);
    }
}
function checkNodeId(node) {
fxy060608's avatar
fxy060608 已提交
825
    if (!node.nodeId && node.pageNode) {
fxy060608's avatar
fxy060608 已提交
826 827 828
        node.nodeId = node.pageNode.genId();
    }
}
fxy060608's avatar
fxy060608 已提交
829
// 为优化性能,各平台不使用proxy来实现node的操作拦截,而是直接通过pageNode定制
fxy060608's avatar
fxy060608 已提交
830
class UniNode extends UniEventTarget {
fxy060608's avatar
fxy060608 已提交
831
    constructor(nodeType, nodeName, container) {
fxy060608's avatar
fxy060608 已提交
832
        super();
fxy060608's avatar
fxy060608 已提交
833 834 835
        this.pageNode = null;
        this.parentNode = null;
        this._text = null;
fxy060608's avatar
fxy060608 已提交
836 837
        if (container) {
            const { pageNode } = container;
fxy060608's avatar
fxy060608 已提交
838 839 840
            if (pageNode) {
                this.pageNode = pageNode;
                this.nodeId = pageNode.genId();
fxy060608's avatar
fxy060608 已提交
841
                !pageNode.isUnmounted && pageNode.onCreate(this, nodeName);
fxy060608's avatar
fxy060608 已提交
842
            }
fxy060608's avatar
fxy060608 已提交
843
        }
fxy060608's avatar
fxy060608 已提交
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
        this.nodeType = nodeType;
        this.nodeName = nodeName;
        this.childNodes = [];
    }
    get firstChild() {
        return this.childNodes[0] || null;
    }
    get lastChild() {
        const { childNodes } = this;
        const length = childNodes.length;
        return length ? childNodes[length - 1] : null;
    }
    get nextSibling() {
        return sibling(this, 'n');
    }
fxy060608's avatar
fxy060608 已提交
859 860 861 862
    get nodeValue() {
        return null;
    }
    set nodeValue(_val) { }
fxy060608's avatar
fxy060608 已提交
863 864 865 866 867
    get textContent() {
        return this._text || '';
    }
    set textContent(text) {
        this._text = text;
fxy060608's avatar
fxy060608 已提交
868
        if (this.pageNode && !this.pageNode.isUnmounted) {
fxy060608's avatar
fxy060608 已提交
869 870
            this.pageNode.onTextContent(this, text);
        }
fxy060608's avatar
fxy060608 已提交
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902
    }
    get parentElement() {
        const { parentNode } = this;
        if (parentNode && parentNode.nodeType === NODE_TYPE_ELEMENT) {
            return parentNode;
        }
        return null;
    }
    get previousSibling() {
        return sibling(this, 'p');
    }
    appendChild(newChild) {
        return this.insertBefore(newChild, null);
    }
    cloneNode(deep) {
        const cloned = shared.extend(Object.create(Object.getPrototypeOf(this)), this);
        const { attributes } = cloned;
        if (attributes) {
            cloned.attributes = shared.extend({}, attributes);
        }
        if (deep) {
            cloned.childNodes = cloned.childNodes.map((childNode) => childNode.cloneNode(true));
        }
        return cloned;
    }
    insertBefore(newChild, refChild) {
        removeNode(newChild);
        newChild.pageNode = this.pageNode;
        newChild.parentNode = this;
        checkNodeId(newChild);
        const { childNodes } = this;
        if (refChild) {
fxy060608's avatar
fxy060608 已提交
903
            const index = childNodes.indexOf(refChild);
fxy060608's avatar
fxy060608 已提交
904 905 906
            if (index === -1) {
                throw new DOMException(`Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.`);
            }
fxy060608's avatar
fxy060608 已提交
907
            childNodes.splice(index, 0, newChild);
fxy060608's avatar
fxy060608 已提交
908 909 910 911
        }
        else {
            childNodes.push(newChild);
        }
fxy060608's avatar
fxy060608 已提交
912
        return this.pageNode && !this.pageNode.isUnmounted
fxy060608's avatar
fxy060608 已提交
913
            ? this.pageNode.onInsertBefore(this, newChild, refChild)
fxy060608's avatar
fxy060608 已提交
914
            : newChild;
fxy060608's avatar
fxy060608 已提交
915 916 917 918 919 920 921 922 923
    }
    removeChild(oldChild) {
        const { childNodes } = this;
        const index = childNodes.indexOf(oldChild);
        if (index === -1) {
            throw new DOMException(`Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.`);
        }
        oldChild.parentNode = null;
        childNodes.splice(index, 1);
fxy060608's avatar
fxy060608 已提交
924 925 926
        return this.pageNode && !this.pageNode.isUnmounted
            ? this.pageNode.onRemoveChild(oldChild)
            : oldChild;
fxy060608's avatar
fxy060608 已提交
927 928
    }
}
fxy060608's avatar
fxy060608 已提交
929 930
const ATTR_CLASS = 'class';
const ATTR_STYLE = 'style';
fxy060608's avatar
fxy060608 已提交
931 932
const ATTR_INNER_HTML = 'innerHTML';
const ATTR_TEXT_CONTENT = 'textContent';
fxy060608's avatar
fxy060608 已提交
933
const ATTR_V_SHOW = '.vShow';
fxy060608's avatar
fxy060608 已提交
934
const ATTR_V_OWNER_ID = '.vOwnerId';
fxy060608's avatar
fxy060608 已提交
935
const ATTR_V_RENDERJS = '.vRenderjs';
fxy060608's avatar
fxy060608 已提交
936
const ATTR_CHANGE_PREFIX = 'change:';
fxy060608's avatar
fxy060608 已提交
937
class UniBaseNode extends UniNode {
fxy060608's avatar
fxy060608 已提交
938 939
    constructor(nodeType, nodeName, container) {
        super(nodeType, nodeName, container);
fxy060608's avatar
fxy060608 已提交
940 941
        this.attributes = Object.create(null);
        this.style = null;
fxy060608's avatar
fxy060608 已提交
942
        this.vShow = null;
fxy060608's avatar
fxy060608 已提交
943
        this._html = null;
fxy060608's avatar
fxy060608 已提交
944 945
    }
    get className() {
fxy060608's avatar
fxy060608 已提交
946
        return (this.attributes[ATTR_CLASS] || '');
fxy060608's avatar
fxy060608 已提交
947 948
    }
    set className(val) {
fxy060608's avatar
fxy060608 已提交
949
        this.setAttribute(ATTR_CLASS, val);
fxy060608's avatar
fxy060608 已提交
950 951 952 953 954 955 956 957 958
    }
    get innerHTML() {
        return '';
    }
    set innerHTML(html) {
        this._html = html;
    }
    addEventListener(type, listener, options) {
        super.addEventListener(type, listener, options);
fxy060608's avatar
fxy060608 已提交
959
        if (this.pageNode && !this.pageNode.isUnmounted) {
fxy060608's avatar
fxy060608 已提交
960 961 962 963 964 965
            if (listener.wxsEvent) {
                this.pageNode.onAddWxsEvent(this, normalizeEventType(type, options), listener.wxsEvent, encodeModifier(listener.modifiers || []));
            }
            else {
                this.pageNode.onAddEvent(this, normalizeEventType(type, options), encodeModifier(listener.modifiers || []));
            }
fxy060608's avatar
fxy060608 已提交
966
        }
fxy060608's avatar
fxy060608 已提交
967 968 969
    }
    removeEventListener(type, callback, options) {
        super.removeEventListener(type, callback, options);
fxy060608's avatar
fxy060608 已提交
970
        if (this.pageNode && !this.pageNode.isUnmounted) {
fxy060608's avatar
fxy060608 已提交
971
            this.pageNode.onRemoveEvent(this, normalizeEventType(type, options));
fxy060608's avatar
fxy060608 已提交
972
        }
fxy060608's avatar
fxy060608 已提交
973 974
    }
    getAttribute(qualifiedName) {
fxy060608's avatar
fxy060608 已提交
975 976 977
        if (qualifiedName === ATTR_STYLE) {
            return this.style;
        }
fxy060608's avatar
fxy060608 已提交
978
        return this.attributes[qualifiedName];
fxy060608's avatar
fxy060608 已提交
979 980
    }
    removeAttribute(qualifiedName) {
fxy060608's avatar
fxy060608 已提交
981 982 983 984 985 986
        if (qualifiedName == ATTR_STYLE) {
            this.style = null;
        }
        else {
            delete this.attributes[qualifiedName];
        }
fxy060608's avatar
fxy060608 已提交
987
        if (this.pageNode && !this.pageNode.isUnmounted) {
fxy060608's avatar
fxy060608 已提交
988 989
            this.pageNode.onRemoveAttribute(this, qualifiedName);
        }
fxy060608's avatar
fxy060608 已提交
990 991
    }
    setAttribute(qualifiedName, value) {
fxy060608's avatar
fxy060608 已提交
992 993 994 995 996 997
        if (qualifiedName === ATTR_STYLE) {
            this.style = value;
        }
        else {
            this.attributes[qualifiedName] = value;
        }
fxy060608's avatar
fxy060608 已提交
998
        if (this.pageNode && !this.pageNode.isUnmounted) {
fxy060608's avatar
fxy060608 已提交
999 1000
            this.pageNode.onSetAttribute(this, qualifiedName, value);
        }
fxy060608's avatar
fxy060608 已提交
1001
    }
fxy060608's avatar
fxy060608 已提交
1002
    toJSON({ attr, normalize, } = {}) {
fxy060608's avatar
fxy060608 已提交
1003
        const { attributes, style, listeners, _text } = this;
fxy060608's avatar
fxy060608 已提交
1004 1005
        const res = {};
        if (Object.keys(attributes).length) {
fxy060608's avatar
fxy060608 已提交
1006
            res.a = normalize ? normalize(attributes) : attributes;
fxy060608's avatar
fxy060608 已提交
1007
        }
fxy060608's avatar
fxy060608 已提交
1008 1009
        const events = Object.keys(listeners);
        if (events.length) {
fxy060608's avatar
fxy060608 已提交
1010
            let w = undefined;
fxy060608's avatar
fxy060608 已提交
1011 1012 1013 1014 1015
            const e = {};
            events.forEach((name) => {
                const handlers = listeners[name];
                if (handlers.length) {
                    // 可能存在多个 handler 且不同 modifiers 吗?
fxy060608's avatar
fxy060608 已提交
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026
                    const { wxsEvent, modifiers } = handlers[0];
                    const modifier = encodeModifier(modifiers || []);
                    if (!wxsEvent) {
                        e[name] = modifier;
                    }
                    else {
                        if (!w) {
                            w = {};
                        }
                        w[name] = [normalize ? normalize(wxsEvent) : wxsEvent, modifier];
                    }
fxy060608's avatar
fxy060608 已提交
1027 1028
                }
            });
fxy060608's avatar
fxy060608 已提交
1029
            res.e = normalize ? normalize(e, false) : e;
fxy060608's avatar
fxy060608 已提交
1030 1031 1032
            if (w) {
                res.w = normalize ? normalize(w, false) : w;
            }
fxy060608's avatar
fxy060608 已提交
1033
        }
fxy060608's avatar
fxy060608 已提交
1034 1035
        if (style !== null) {
            res.s = normalize ? normalize(style) : style;
fxy060608's avatar
fxy060608 已提交
1036
        }
fxy060608's avatar
fxy060608 已提交
1037
        if (!attr) {
fxy060608's avatar
fxy060608 已提交
1038
            res.i = this.nodeId;
fxy060608's avatar
fxy060608 已提交
1039
            res.n = this.nodeName;
fxy060608's avatar
fxy060608 已提交
1040
        }
fxy060608's avatar
fxy060608 已提交
1041 1042
        if (_text !== null) {
            res.t = normalize ? normalize(_text) : _text;
fxy060608's avatar
fxy060608 已提交
1043 1044 1045 1046 1047 1048
        }
        return res;
    }
}

class UniCommentNode extends UniNode {
fxy060608's avatar
fxy060608 已提交
1049 1050
    constructor(text, container) {
        super(NODE_TYPE_COMMENT, '#comment', container);
fxy060608's avatar
fxy060608 已提交
1051
        this._text = (process.env.NODE_ENV !== 'production') ? text : '';
fxy060608's avatar
fxy060608 已提交
1052
    }
fxy060608's avatar
fxy060608 已提交
1053
    toJSON(opts = {}) {
fxy060608's avatar
fxy060608 已提交
1054
        // 暂时不传递 text 到 view 层,没啥意义,节省点数据量
fxy060608's avatar
fxy060608 已提交
1055
        return opts.attr
fxy060608's avatar
fxy060608 已提交
1056
            ? {}
fxy060608's avatar
fxy060608 已提交
1057 1058 1059
            : {
                i: this.nodeId,
            };
fxy060608's avatar
fxy060608 已提交
1060 1061 1062 1063 1064 1065
        // return opts.attr
        //   ? { t: this._text as string }
        //   : {
        //       i: this.nodeId!,
        //       t: this._text as string,
        //     }
fxy060608's avatar
fxy060608 已提交
1066
    }
fxy060608's avatar
fxy060608 已提交
1067 1068 1069
}

class UniElement extends UniBaseNode {
fxy060608's avatar
fxy060608 已提交
1070 1071
    constructor(nodeName, container) {
        super(NODE_TYPE_ELEMENT, nodeName.toUpperCase(), container);
fxy060608's avatar
fxy060608 已提交
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
        this.tagName = this.nodeName;
    }
}
class UniInputElement extends UniElement {
    get value() {
        return this.getAttribute('value');
    }
    set value(val) {
        this.setAttribute('value', val);
    }
}
class UniTextAreaElement extends UniInputElement {
}

class UniTextNode extends UniBaseNode {
fxy060608's avatar
fxy060608 已提交
1087 1088
    constructor(text, container) {
        super(NODE_TYPE_TEXT, '#text', container);
fxy060608's avatar
fxy060608 已提交
1089 1090 1091 1092 1093 1094 1095
        this._text = text;
    }
    get nodeValue() {
        return this._text || '';
    }
    set nodeValue(text) {
        this._text = text;
fxy060608's avatar
fxy060608 已提交
1096
        if (this.pageNode && !this.pageNode.isUnmounted) {
fxy060608's avatar
fxy060608 已提交
1097 1098
            this.pageNode.onNodeValue(this, text);
        }
fxy060608's avatar
fxy060608 已提交
1099 1100 1101
    }
}

fxy060608's avatar
fxy060608 已提交
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
const forcePatchProps = {
    AD: ['data'],
    'AD-DRAW': ['data'],
    'LIVE-PLAYER': ['picture-in-picture-mode'],
    MAP: [
        'markers',
        'polyline',
        'circles',
        'controls',
        'include-points',
        'polygons',
    ],
    PICKER: ['range', 'value'],
    'PICKER-VIEW': ['value'],
    'RICH-TEXT': ['nodes'],
    VIDEO: ['danmu-list', 'header'],
    'WEB-VIEW': ['webview-styles'],
};
const forcePatchPropKeys = ['animation'];

const forcePatchProp = (el, key) => {
    if (forcePatchPropKeys.indexOf(key) > -1) {
        return true;
    }
    const keys = forcePatchProps[el.nodeName];
    if (keys && keys.indexOf(key) > -1) {
        return true;
    }
    return false;
};

fxy060608's avatar
fxy060608 已提交
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
fxy060608's avatar
fxy060608 已提交
1143
const ACTION_TYPE_ADD_WXS_EVENT = 12;
fxy060608's avatar
fxy060608 已提交
1144
const ACTION_TYPE_PAGE_SCROLL = 15;
fxy060608's avatar
fxy060608 已提交
1145 1146
const ACTION_TYPE_EVENT = 20;

fxy060608's avatar
fxy060608 已提交
1147 1148 1149
/**
 * 需要手动传入 timer,主要是解决 App 平台的定制 timer
 */
Q
qiang 已提交
1150
function debounce(fn, delay, { clearTimeout, setTimeout }) {
fxy060608's avatar
fxy060608 已提交
1151 1152
    let timeout;
    const newFn = function () {
Q
qiang 已提交
1153
        clearTimeout(timeout);
fxy060608's avatar
fxy060608 已提交
1154
        const timerFn = () => fn.apply(this, arguments);
Q
qiang 已提交
1155
        timeout = setTimeout(timerFn, delay);
fxy060608's avatar
fxy060608 已提交
1156 1157
    };
    newFn.cancel = function () {
Q
qiang 已提交
1158
        clearTimeout(timeout);
fxy060608's avatar
fxy060608 已提交
1159 1160 1161 1162
    };
    return newFn;
}

fxy060608's avatar
fxy060608 已提交
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
class EventChannel {
    constructor(id, events) {
        this.id = id;
        this.listener = {};
        this.emitCache = {};
        if (events) {
            Object.keys(events).forEach((name) => {
                this.on(name, events[name]);
            });
        }
    }
    emit(eventName, ...args) {
        const fns = this.listener[eventName];
        if (!fns) {
            return (this.emitCache[eventName] || (this.emitCache[eventName] = [])).push(args);
        }
        fns.forEach((opt) => {
            opt.fn.apply(opt.fn, args);
        });
        this.listener[eventName] = fns.filter((opt) => opt.type !== 'once');
    }
    on(eventName, fn) {
        this._addListener(eventName, 'on', fn);
        this._clearCache(eventName);
    }
    once(eventName, fn) {
        this._addListener(eventName, 'once', fn);
        this._clearCache(eventName);
    }
    off(eventName, fn) {
        const fns = this.listener[eventName];
        if (!fns) {
            return;
        }
        if (fn) {
            for (let i = 0; i < fns.length;) {
                if (fns[i].fn === fn) {
                    fns.splice(i, 1);
                    i--;
                }
                i++;
            }
        }
        else {
            delete this.listener[eventName];
        }
    }
    _clearCache(eventName) {
        const cacheArgs = this.emitCache[eventName];
        if (cacheArgs) {
            for (; cacheArgs.length > 0;) {
                this.emit.apply(this, [eventName, ...cacheArgs.shift()]);
            }
        }
    }
    _addListener(eventName, type, fn) {
        (this.listener[eventName] || (this.listener[eventName] = [])).push({
            fn,
            type,
        });
    }
}

fxy060608's avatar
fxy060608 已提交
1226
const PAGE_HOOKS = [
fxy060608's avatar
fxy060608 已提交
1227
    ON_INIT,
1228
    ON_LOAD,
1229 1230
    ON_SHOW,
    ON_HIDE,
1231
    ON_UNLOAD,
fxy060608's avatar
fxy060608 已提交
1232 1233 1234 1235 1236
    ON_BACK_PRESS,
    ON_PAGE_SCROLL,
    ON_TAB_ITEM_TAP,
    ON_REACH_BOTTOM,
    ON_PULL_DOWN_REFRESH,
1237 1238 1239
    ON_SHARE_TIMELINE,
    ON_SHARE_APP_MESSAGE,
    ON_ADD_TO_FAVORITES,
fxy060608's avatar
fxy060608 已提交
1240
    ON_SAVE_EXIT_STATE,
1241 1242 1243 1244 1245
    ON_NAVIGATION_BAR_BUTTON_TAP,
    ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
    ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
    ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
    ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED,
fxy060608's avatar
fxy060608 已提交
1246
];
fxy060608's avatar
fxy060608 已提交
1247 1248 1249 1250
const PAGE_SYNC_HOOKS = [ON_LOAD, ON_SHOW];
function isRootImmediateHook(name) {
    return PAGE_SYNC_HOOKS.indexOf(name) > -1;
}
fxy060608's avatar
fxy060608 已提交
1251 1252
function isRootHook(name) {
    return PAGE_HOOKS.indexOf(name) > -1;
fxy060608's avatar
fxy060608 已提交
1253 1254 1255 1256 1257 1258 1259 1260 1261
}
const UniLifecycleHooks = [
    ON_SHOW,
    ON_HIDE,
    ON_LAUNCH,
    ON_ERROR,
    ON_THEME_CHANGE,
    ON_PAGE_NOT_FOUND,
    ON_UNHANDLE_REJECTION,
fxy060608's avatar
fxy060608 已提交
1262
    ON_INIT,
fxy060608's avatar
fxy060608 已提交
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274
    ON_LOAD,
    ON_READY,
    ON_UNLOAD,
    ON_RESIZE,
    ON_BACK_PRESS,
    ON_PAGE_SCROLL,
    ON_TAB_ITEM_TAP,
    ON_REACH_BOTTOM,
    ON_PULL_DOWN_REFRESH,
    ON_SHARE_TIMELINE,
    ON_ADD_TO_FAVORITES,
    ON_SHARE_APP_MESSAGE,
fxy060608's avatar
fxy060608 已提交
1275
    ON_SAVE_EXIT_STATE,
fxy060608's avatar
fxy060608 已提交
1276 1277 1278 1279 1280
    ON_NAVIGATION_BAR_BUTTON_TAP,
    ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED,
    ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED,
    ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED,
    ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED,
1281
];
Q
qiang 已提交
1282 1283 1284 1285 1286 1287 1288
const MINI_PROGRAM_PAGE_RUNTIME_HOOKS = /*#__PURE__*/ (() => {
    return {
        onPageScroll: 1,
        onShareAppMessage: 1 << 1,
        onShareTimeline: 1 << 2,
    };
})();
fxy060608's avatar
fxy060608 已提交
1289

fxy060608's avatar
fxy060608 已提交
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304
let vueApp;
const createVueAppHooks = [];
/**
 * 提供 createApp 的回调事件,方便三方插件接收 App 对象,处理挂靠全局 mixin 之类的逻辑
 */
function onCreateVueApp(hook) {
    // TODO 每个 nvue 页面都会触发
    if (vueApp) {
        return hook(vueApp);
    }
    createVueAppHooks.push(hook);
}
function invokeCreateVueAppHook(app) {
    vueApp = app;
    createVueAppHooks.forEach((hook) => hook(app));
fxy060608's avatar
fxy060608 已提交
1305 1306 1307 1308 1309 1310
}
const invokeCreateErrorHandler = once((app, createErrorHandler) => {
    if (shared.isFunction(app._component.onError)) {
        return createErrorHandler(app);
    }
});
fxy060608's avatar
fxy060608 已提交
1311

fxy060608's avatar
fxy060608 已提交
1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362
const E = function () {
    // Keep this empty so it's easier to inherit from
    // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
};
E.prototype = {
    on: function (name, callback, ctx) {
        var e = this.e || (this.e = {});
        (e[name] || (e[name] = [])).push({
            fn: callback,
            ctx: ctx,
        });
        return this;
    },
    once: function (name, callback, ctx) {
        var self = this;
        function listener() {
            self.off(name, listener);
            callback.apply(ctx, arguments);
        }
        listener._ = callback;
        return this.on(name, listener, ctx);
    },
    emit: function (name) {
        var data = [].slice.call(arguments, 1);
        var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
        var i = 0;
        var len = evtArr.length;
        for (i; i < len; i++) {
            evtArr[i].fn.apply(evtArr[i].ctx, data);
        }
        return this;
    },
    off: function (name, callback) {
        var e = this.e || (this.e = {});
        var evts = e[name];
        var liveEvents = [];
        if (evts && callback) {
            for (var i = 0, len = evts.length; i < len; i++) {
                if (evts[i].fn !== callback && evts[i].fn._ !== callback)
                    liveEvents.push(evts[i]);
            }
        }
        // Remove event from queue to prevent memory leak
        // Suggested by https://github.com/lazd
        // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
        liveEvents.length ? (e[name] = liveEvents) : delete e[name];
        return this;
    },
};
var E$1 = E;

fxy060608's avatar
fxy060608 已提交
1363 1364 1365 1366 1367 1368
function getEnvLocale() {
    const { env } = process;
    const lang = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE;
    return (lang && lang.replace(/[.:].*/, '')) || 'en';
}

fxy060608's avatar
fxy060608 已提交
1369
exports.ACTION_TYPE_ADD_EVENT = ACTION_TYPE_ADD_EVENT;
fxy060608's avatar
fxy060608 已提交
1370
exports.ACTION_TYPE_ADD_WXS_EVENT = ACTION_TYPE_ADD_WXS_EVENT;
fxy060608's avatar
fxy060608 已提交
1371 1372 1373 1374 1375
exports.ACTION_TYPE_CREATE = ACTION_TYPE_CREATE;
exports.ACTION_TYPE_EVENT = ACTION_TYPE_EVENT;
exports.ACTION_TYPE_INSERT = ACTION_TYPE_INSERT;
exports.ACTION_TYPE_PAGE_CREATE = ACTION_TYPE_PAGE_CREATE;
exports.ACTION_TYPE_PAGE_CREATED = ACTION_TYPE_PAGE_CREATED;
fxy060608's avatar
fxy060608 已提交
1376
exports.ACTION_TYPE_PAGE_SCROLL = ACTION_TYPE_PAGE_SCROLL;
fxy060608's avatar
fxy060608 已提交
1377 1378 1379 1380 1381
exports.ACTION_TYPE_REMOVE = ACTION_TYPE_REMOVE;
exports.ACTION_TYPE_REMOVE_ATTRIBUTE = ACTION_TYPE_REMOVE_ATTRIBUTE;
exports.ACTION_TYPE_REMOVE_EVENT = ACTION_TYPE_REMOVE_EVENT;
exports.ACTION_TYPE_SET_ATTRIBUTE = ACTION_TYPE_SET_ATTRIBUTE;
exports.ACTION_TYPE_SET_TEXT = ACTION_TYPE_SET_TEXT;
fxy060608's avatar
fxy060608 已提交
1382
exports.ATTR_CHANGE_PREFIX = ATTR_CHANGE_PREFIX;
fxy060608's avatar
fxy060608 已提交
1383
exports.ATTR_CLASS = ATTR_CLASS;
fxy060608's avatar
fxy060608 已提交
1384
exports.ATTR_INNER_HTML = ATTR_INNER_HTML;
fxy060608's avatar
fxy060608 已提交
1385
exports.ATTR_STYLE = ATTR_STYLE;
fxy060608's avatar
fxy060608 已提交
1386
exports.ATTR_TEXT_CONTENT = ATTR_TEXT_CONTENT;
fxy060608's avatar
fxy060608 已提交
1387
exports.ATTR_V_OWNER_ID = ATTR_V_OWNER_ID;
fxy060608's avatar
fxy060608 已提交
1388
exports.ATTR_V_RENDERJS = ATTR_V_RENDERJS;
fxy060608's avatar
fxy060608 已提交
1389
exports.ATTR_V_SHOW = ATTR_V_SHOW;
fxy060608's avatar
fxy060608 已提交
1390
exports.BACKGROUND_COLOR = BACKGROUND_COLOR;
fxy060608's avatar
fxy060608 已提交
1391
exports.BUILT_IN_TAGS = BUILT_IN_TAGS;
1392
exports.BUILT_IN_TAG_NAMES = BUILT_IN_TAG_NAMES;
fxy060608's avatar
fxy060608 已提交
1393 1394
exports.COMPONENT_NAME_PREFIX = COMPONENT_NAME_PREFIX;
exports.COMPONENT_PREFIX = COMPONENT_PREFIX;
fxy060608's avatar
fxy060608 已提交
1395
exports.COMPONENT_SELECTOR_PREFIX = COMPONENT_SELECTOR_PREFIX;
fxy060608's avatar
fxy060608 已提交
1396
exports.DATA_RE = DATA_RE;
fxy060608's avatar
fxy060608 已提交
1397
exports.Emitter = E$1;
fxy060608's avatar
fxy060608 已提交
1398
exports.EventChannel = EventChannel;
fxy060608's avatar
fxy060608 已提交
1399
exports.EventModifierFlags = EventModifierFlags;
fxy060608's avatar
fxy060608 已提交
1400
exports.I18N_JSON_DELIMITERS = I18N_JSON_DELIMITERS;
fxy060608's avatar
fxy060608 已提交
1401
exports.JSON_PROTOCOL = JSON_PROTOCOL;
fxy060608's avatar
fxy060608 已提交
1402
exports.LINEFEED = LINEFEED;
1403
exports.MINI_PROGRAM_PAGE_RUNTIME_HOOKS = MINI_PROGRAM_PAGE_RUNTIME_HOOKS;
fxy060608's avatar
fxy060608 已提交
1404
exports.NAVBAR_HEIGHT = NAVBAR_HEIGHT;
fxy060608's avatar
fxy060608 已提交
1405 1406 1407 1408
exports.NODE_TYPE_COMMENT = NODE_TYPE_COMMENT;
exports.NODE_TYPE_ELEMENT = NODE_TYPE_ELEMENT;
exports.NODE_TYPE_PAGE = NODE_TYPE_PAGE;
exports.NODE_TYPE_TEXT = NODE_TYPE_TEXT;
fxy060608's avatar
fxy060608 已提交
1409
exports.NVUE_BUILT_IN_TAGS = NVUE_BUILT_IN_TAGS;
fxy060608's avatar
fxy060608 已提交
1410
exports.NVUE_U_BUILT_IN_TAGS = NVUE_U_BUILT_IN_TAGS;
fxy060608's avatar
fxy060608 已提交
1411 1412 1413 1414 1415 1416
exports.ON_ADD_TO_FAVORITES = ON_ADD_TO_FAVORITES;
exports.ON_APP_ENTER_BACKGROUND = ON_APP_ENTER_BACKGROUND;
exports.ON_APP_ENTER_FOREGROUND = ON_APP_ENTER_FOREGROUND;
exports.ON_BACK_PRESS = ON_BACK_PRESS;
exports.ON_ERROR = ON_ERROR;
exports.ON_HIDE = ON_HIDE;
fxy060608's avatar
fxy060608 已提交
1417
exports.ON_INIT = ON_INIT;
1418
exports.ON_KEYBOARD_HEIGHT_CHANGE = ON_KEYBOARD_HEIGHT_CHANGE;
fxy060608's avatar
fxy060608 已提交
1419 1420 1421
exports.ON_LAUNCH = ON_LAUNCH;
exports.ON_LOAD = ON_LOAD;
exports.ON_NAVIGATION_BAR_BUTTON_TAP = ON_NAVIGATION_BAR_BUTTON_TAP;
1422
exports.ON_NAVIGATION_BAR_CHANGE = ON_NAVIGATION_BAR_CHANGE;
fxy060608's avatar
fxy060608 已提交
1423 1424 1425 1426 1427 1428 1429 1430
exports.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED;
exports.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED;
exports.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED;
exports.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED;
exports.ON_PAGE_NOT_FOUND = ON_PAGE_NOT_FOUND;
exports.ON_PAGE_SCROLL = ON_PAGE_SCROLL;
exports.ON_PULL_DOWN_REFRESH = ON_PULL_DOWN_REFRESH;
exports.ON_REACH_BOTTOM = ON_REACH_BOTTOM;
fxy060608's avatar
fxy060608 已提交
1431
exports.ON_REACH_BOTTOM_DISTANCE = ON_REACH_BOTTOM_DISTANCE;
fxy060608's avatar
fxy060608 已提交
1432 1433
exports.ON_READY = ON_READY;
exports.ON_RESIZE = ON_RESIZE;
fxy060608's avatar
fxy060608 已提交
1434
exports.ON_SAVE_EXIT_STATE = ON_SAVE_EXIT_STATE;
fxy060608's avatar
fxy060608 已提交
1435 1436 1437 1438 1439 1440 1441 1442
exports.ON_SHARE_APP_MESSAGE = ON_SHARE_APP_MESSAGE;
exports.ON_SHARE_TIMELINE = ON_SHARE_TIMELINE;
exports.ON_SHOW = ON_SHOW;
exports.ON_TAB_ITEM_TAP = ON_TAB_ITEM_TAP;
exports.ON_THEME_CHANGE = ON_THEME_CHANGE;
exports.ON_UNHANDLE_REJECTION = ON_UNHANDLE_REJECTION;
exports.ON_UNLOAD = ON_UNLOAD;
exports.ON_WEB_INVOKE_APP_SERVICE = ON_WEB_INVOKE_APP_SERVICE;
fxy060608's avatar
fxy060608 已提交
1443
exports.ON_WXS_INVOKE_CALL_METHOD = ON_WXS_INVOKE_CALL_METHOD;
fxy060608's avatar
fxy060608 已提交
1444
exports.PLUS_RE = PLUS_RE;
fxy060608's avatar
fxy060608 已提交
1445
exports.PRIMARY_COLOR = PRIMARY_COLOR;
fxy060608's avatar
fxy060608 已提交
1446
exports.RENDERJS_MODULES = RENDERJS_MODULES;
fxy060608's avatar
fxy060608 已提交
1447
exports.RESPONSIVE_MIN_WIDTH = RESPONSIVE_MIN_WIDTH;
fxy060608's avatar
fxy060608 已提交
1448
exports.SCHEME_RE = SCHEME_RE;
fxy060608's avatar
fxy060608 已提交
1449
exports.SELECTED_COLOR = SELECTED_COLOR;
fxy060608's avatar
fxy060608 已提交
1450
exports.SLOT_DEFAULT_NAME = SLOT_DEFAULT_NAME;
fxy060608's avatar
fxy060608 已提交
1451 1452
exports.TABBAR_HEIGHT = TABBAR_HEIGHT;
exports.TAGS = TAGS;
fxy060608's avatar
fxy060608 已提交
1453 1454 1455
exports.UNI_SSR = UNI_SSR;
exports.UNI_SSR_DATA = UNI_SSR_DATA;
exports.UNI_SSR_GLOBAL_DATA = UNI_SSR_GLOBAL_DATA;
fxy060608's avatar
fxy060608 已提交
1456
exports.UNI_SSR_STORE = UNI_SSR_STORE;
fxy060608's avatar
fxy060608 已提交
1457
exports.UNI_SSR_TITLE = UNI_SSR_TITLE;
fxy060608's avatar
fxy060608 已提交
1458
exports.UNI_STORAGE_LOCALE = UNI_STORAGE_LOCALE;
fxy060608's avatar
fxy060608 已提交
1459 1460 1461 1462 1463
exports.UniBaseNode = UniBaseNode;
exports.UniCommentNode = UniCommentNode;
exports.UniElement = UniElement;
exports.UniEvent = UniEvent;
exports.UniInputElement = UniInputElement;
fxy060608's avatar
fxy060608 已提交
1464
exports.UniLifecycleHooks = UniLifecycleHooks;
fxy060608's avatar
fxy060608 已提交
1465 1466 1467
exports.UniNode = UniNode;
exports.UniTextAreaElement = UniTextAreaElement;
exports.UniTextNode = UniTextNode;
fxy060608's avatar
fxy060608 已提交
1468
exports.WEB_INVOKE_APPSERVICE = WEB_INVOKE_APPSERVICE;
fxy060608's avatar
fxy060608 已提交
1469
exports.WXS_MODULES = WXS_MODULES;
fxy060608's avatar
fxy060608 已提交
1470
exports.WXS_PROTOCOL = WXS_PROTOCOL;
fxy060608's avatar
fxy060608 已提交
1471
exports.addFont = addFont;
fxy060608's avatar
fxy060608 已提交
1472
exports.addLeadingSlash = addLeadingSlash;
fxy060608's avatar
fxy060608 已提交
1473
exports.cache = cache;
fxy060608's avatar
fxy060608 已提交
1474
exports.cacheStringFunction = cacheStringFunction;
Q
qiang 已提交
1475
exports.callOptions = callOptions;
fxy060608's avatar
fxy060608 已提交
1476
exports.createIsCustomElement = createIsCustomElement;
fxy060608's avatar
fxy060608 已提交
1477
exports.createRpx2Unit = createRpx2Unit;
fxy060608's avatar
fxy060608 已提交
1478
exports.createUniEvent = createUniEvent;
1479
exports.customizeEvent = customizeEvent;
fxy060608's avatar
fxy060608 已提交
1480
exports.debounce = debounce;
fxy060608's avatar
fxy060608 已提交
1481 1482
exports.decode = decode;
exports.decodedQuery = decodedQuery;
fxy060608's avatar
fxy060608 已提交
1483
exports.defaultMiniProgramRpx2Unit = defaultMiniProgramRpx2Unit;
fxy060608's avatar
fxy060608 已提交
1484
exports.defaultNVueRpx2Unit = defaultNVueRpx2Unit;
fxy060608's avatar
fxy060608 已提交
1485
exports.defaultRpx2Unit = defaultRpx2Unit;
fxy060608's avatar
fxy060608 已提交
1486
exports.dynamicSlotName = dynamicSlotName;
fxy060608's avatar
fxy060608 已提交
1487
exports.forcePatchProp = forcePatchProp;
D
DCloud_LXH 已提交
1488
exports.formatDateTime = formatDateTime;
fxy060608's avatar
fxy060608 已提交
1489
exports.formatLog = formatLog;
Q
qiang 已提交
1490
exports.getCustomDataset = getCustomDataset;
fxy060608's avatar
fxy060608 已提交
1491
exports.getEnvLocale = getEnvLocale;
fxy060608's avatar
fxy060608 已提交
1492
exports.getLen = getLen;
fxy060608's avatar
fxy060608 已提交
1493
exports.getValueByDataPath = getValueByDataPath;
1494
exports.initCustomDatasetOnce = initCustomDatasetOnce;
fxy060608's avatar
fxy060608 已提交
1495
exports.invokeArrayFns = invokeArrayFns;
fxy060608's avatar
fxy060608 已提交
1496
exports.invokeCreateErrorHandler = invokeCreateErrorHandler;
fxy060608's avatar
fxy060608 已提交
1497
exports.invokeCreateVueAppHook = invokeCreateVueAppHook;
fxy060608's avatar
fxy060608 已提交
1498
exports.isAppNVueNativeTag = isAppNVueNativeTag;
fxy060608's avatar
fxy060608 已提交
1499
exports.isAppNativeTag = isAppNativeTag;
fxy060608's avatar
fxy060608 已提交
1500
exports.isBuiltInComponent = isBuiltInComponent;
1501
exports.isComponentInternalInstance = isComponentInternalInstance;
fxy060608's avatar
fxy060608 已提交
1502
exports.isComponentTag = isComponentTag;
fxy060608's avatar
fxy060608 已提交
1503 1504
exports.isH5CustomElement = isH5CustomElement;
exports.isH5NativeTag = isH5NativeTag;
fxy060608's avatar
fxy060608 已提交
1505
exports.isMiniProgramNativeTag = isMiniProgramNativeTag;
fxy060608's avatar
fxy060608 已提交
1506
exports.isRootHook = isRootHook;
fxy060608's avatar
fxy060608 已提交
1507
exports.isRootImmediateHook = isRootImmediateHook;
fxy060608's avatar
fxy060608 已提交
1508
exports.normalizeDataset = normalizeDataset;
fxy060608's avatar
fxy060608 已提交
1509
exports.normalizeEventType = normalizeEventType;
fxy060608's avatar
fxy060608 已提交
1510
exports.normalizeTarget = normalizeTarget;
fxy060608's avatar
fxy060608 已提交
1511
exports.onCreateVueApp = onCreateVueApp;
fxy060608's avatar
fxy060608 已提交
1512
exports.once = once;
fxy060608's avatar
fxy060608 已提交
1513
exports.parseEventName = parseEventName;
fxy060608's avatar
fxy060608 已提交
1514
exports.parseNVueDataset = parseNVueDataset;
fxy060608's avatar
fxy060608 已提交
1515
exports.parseQuery = parseQuery;
fxy060608's avatar
fxy060608 已提交
1516
exports.parseUrl = parseUrl;
fxy060608's avatar
fxy060608 已提交
1517
exports.passive = passive;
fxy060608's avatar
fxy060608 已提交
1518
exports.plusReady = plusReady;
fxy060608's avatar
fxy060608 已提交
1519
exports.removeLeadingSlash = removeLeadingSlash;
1520
exports.resolveComponentInstance = resolveComponentInstance;
fxy060608's avatar
fxy060608 已提交
1521
exports.resolveOwnerEl = resolveOwnerEl;
fxy060608's avatar
fxy060608 已提交
1522
exports.resolveOwnerVm = resolveOwnerVm;
fxy060608's avatar
fxy060608 已提交
1523
exports.sanitise = sanitise;
fxy060608's avatar
fxy060608 已提交
1524
exports.scrollTo = scrollTo;
D
DCloud_LXH 已提交
1525
exports.sortObject = sortObject;
fxy060608's avatar
fxy060608 已提交
1526
exports.stringifyQuery = stringifyQuery;
fxy060608's avatar
fxy060608 已提交
1527
exports.updateElementStyle = updateElementStyle;