vite-plugin-taro-runtime 0.8.4 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dist/components/taro-picker-core.js +12 -1
- package/dist/components/types/Input.d.ts +2 -1
- package/dist/plugin-platform-weapp/types/template.d.ts +1 -0
- package/dist/router/dist/index.esm.js +13 -13
- package/dist/runtime/bom/window.d.ts +1 -1
- package/dist/runtime/dom/dataset.js +40 -0
- package/dist/runtime/dom/dataset.js.map +1 -0
- package/dist/runtime/dom/element.js +11 -2
- package/dist/runtime/dom/element.js.map +1 -1
- package/dist/runtime/dom/event-target.js +3 -8
- package/dist/runtime/dom/event-target.js.map +1 -1
- package/dist/runtime/dom/node.d.ts +3 -0
- package/dist/runtime/dom/node.js +12 -0
- package/dist/runtime/dom/node.js.map +1 -1
- package/dist/runtime/dom/shadow-root.d.ts +6 -0
- package/dist/runtime/dom/shadow-root.js +8 -0
- package/dist/runtime/dom/shadow-root.js.map +1 -0
- package/dist/runtime/dom-external/node.js +12 -15
- package/dist/runtime/dom-external/node.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/runtime.esm.d.ts +7 -1
- package/dist/runtime/runtime.esm.js +84 -27
- package/dist/runtime/runtime.esm.js.map +1 -1
- package/dist/taro/package.json +9 -9
- package/dist/taro-h5/dist/api/canvas/canvasToTempFilePath.js +5 -3
- package/dist/taro-h5/dist/api/canvas/canvasToTempFilePath.js.map +1 -1
- package/dist/taro-h5/dist/api/media/audio/InnerAudioContext.d.ts +20 -16
- package/dist/taro-h5/dist/api/media/audio/InnerAudioContext.js +54 -24
- package/dist/taro-h5/dist/api/media/audio/InnerAudioContext.js.map +1 -1
- package/dist/taro-h5/dist/api/media/video/chooseMedia.js +69 -61
- package/dist/taro-h5/dist/api/media/video/chooseMedia.js.map +1 -1
- package/dist/taro-h5/dist/api/network/upload.js +1 -1
- package/dist/taro-h5/dist/api/network/upload.js.map +1 -1
- package/dist/taro-h5/dist/api/network/utils.d.ts +1 -1
- package/dist/taro-h5/dist/api/network/utils.js +33 -13
- package/dist/taro-h5/dist/api/network/utils.js.map +1 -1
- package/dist/taro-h5/dist/api/storage/index.js +26 -4
- package/dist/taro-h5/dist/api/storage/index.js.map +1 -1
- package/dist/taro-h5/dist/api/ui/scroll/index.js +10 -11
- package/dist/taro-h5/dist/api/ui/scroll/index.js.map +1 -1
- package/dist/taro-h5/dist/utils/handler.d.ts +1 -1
- package/dist/taro-h5/dist/utils/handler.js +2 -2
- package/dist/taro-h5/dist/utils/handler.js.map +1 -1
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sources":["../../../src/dom-external/node.ts"],"sourcesContent":["import { DATASET, OBJECT, PROPS, STYLE } from '../constants'\nimport { NodeType } from '../dom/node_types'\nimport { parser } from '../dom-external/inner-html/parser'\n\nimport type { TaroNode } from '../dom/node'\n\nexport type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend'\n\n/**\n * An implementation of `Element.insertAdjacentHTML()`\n * to support Vue 3 with a version of or greater than `vue@3.1.2`\n */\nexport function insertAdjacentHTML (\n this: TaroNode,\n position: IPosition,\n html: string\n) {\n const parsedNodes = parser(html, this.ownerDocument)\n\n for (let i = 0; i < parsedNodes.length; i++) {\n const n = parsedNodes[i]\n\n switch (position) {\n case 'beforebegin':\n this.parentNode?.insertBefore(n, this)\n break\n case 'afterbegin':\n
|
|
1
|
+
{"version":3,"file":"node.js","sources":["../../../src/dom-external/node.ts"],"sourcesContent":["import { DATASET, OBJECT, PROPS, STYLE } from '../constants'\nimport { copyDatasetAttributeOrder } from '../dom/dataset'\nimport { NodeType } from '../dom/node_types'\nimport { parser } from '../dom-external/inner-html/parser'\n\nimport type { TaroElement } from '../dom/element'\nimport type { TaroNode } from '../dom/node'\n\nexport type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend'\n\n/**\n * An implementation of `Element.insertAdjacentHTML()`\n * to support Vue 3 with a version of or greater than `vue@3.1.2`\n */\nexport function insertAdjacentHTML (\n this: TaroNode,\n position: IPosition,\n html: string\n) {\n const parsedNodes = parser(html, this.ownerDocument)\n // Keep the insertion anchors stable while adding multiple parsed nodes.\n const firstChild = this.firstChild\n const nextSibling = this.nextSibling\n\n for (let i = 0; i < parsedNodes.length; i++) {\n const n = parsedNodes[i]\n\n switch (position) {\n case 'beforebegin':\n this.parentNode?.insertBefore(n, this)\n break\n case 'afterbegin':\n this.insertBefore(n, firstChild)\n break\n case 'beforeend':\n this.appendChild(n)\n break\n case 'afterend':\n this.parentNode?.insertBefore(n, nextSibling)\n break\n }\n }\n}\n\nexport function cloneNode (this: TaroNode, isDeep = false) {\n const document = this.ownerDocument\n let newNode\n\n if (this.nodeType === NodeType.ELEMENT_NODE) {\n newNode = document.createElement(this.nodeName)\n } else if (this.nodeType === NodeType.TEXT_NODE) {\n newNode = document.createTextNode('')\n }\n\n for (const key in this) {\n const value: any = this[key]\n // eslint-disable-next-line valid-typeof\n if ([PROPS, DATASET].includes(key) && typeof value === OBJECT) {\n newNode[key] = { ...value }\n } else if (key === '_value') {\n newNode[key] = value\n } else if (key === STYLE) {\n newNode.style._value = { ...value._value }\n newNode.style._usedStyleProp = new Set(Array.from(value._usedStyleProp))\n }\n }\n\n if (isDeep) {\n newNode.childNodes = this.childNodes.map(node => {\n const child = (node as any).cloneNode(true)\n child.parentNode = newNode\n return child\n })\n }\n\n if (this.nodeType === NodeType.ELEMENT_NODE) {\n copyDatasetAttributeOrder(this as TaroElement, newNode)\n }\n\n return newNode\n}\n\nexport function contains (this: TaroNode, node: TaroNode | null): boolean {\n while (node) {\n if (node === this) return true\n node = node.parentNode\n }\n return false\n}\n"],"names":[],"mappings":";;;;AAUA;;;AAGG;AACa,SAAA,kBAAkB,CAEhC,QAAmB,EACnB,IAAY,EAAA;;IAEZ,MAAM,WAAW,GA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;;"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -9,12 +9,14 @@ export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from '
|
|
|
9
9
|
export { TaroURLProvider as URL, parseUrl } from './bom/URL.js';
|
|
10
10
|
export { URLSearchParams } from './bom/URLSearchParams.js';
|
|
11
11
|
export { taroHistoryProvider as history, taroLocationProvider as location, taroWindowProvider as window } from './bom/window.js';
|
|
12
|
+
export { TaroDocument } from './dom/document.js';
|
|
12
13
|
export { TaroElement } from './dom/element.js';
|
|
13
14
|
export { TaroEvent, createEvent, eventHandler, eventHandlerTTDom } from './dom/event.js';
|
|
14
15
|
export { FormElement } from './dom/form.js';
|
|
15
16
|
export { bumpNearestCtxEpochForRoot, getNearestCtx, invalidateNearestCtx, isNearestCtxEnv } from './dom/nearest-ctx.js';
|
|
16
17
|
export { TaroNode } from './dom/node.js';
|
|
17
18
|
export { TaroRootElement } from './dom/root.js';
|
|
19
|
+
export { ShadowRoot } from './dom/shadow-root.js';
|
|
18
20
|
export { Style } from './dom/style.js';
|
|
19
21
|
export { SVGElement } from './dom/svg.js';
|
|
20
22
|
export { TaroText } from './dom/text.js';
|
package/dist/runtime/index.js
CHANGED
|
@@ -10,12 +10,14 @@ export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from '
|
|
|
10
10
|
export { TaroURLProvider as URL, parseUrl } from './bom/URL.js';
|
|
11
11
|
export { URLSearchParams } from './bom/URLSearchParams.js';
|
|
12
12
|
export { taroHistoryProvider as history, taroLocationProvider as location, taroWindowProvider as window } from './bom/window.js';
|
|
13
|
+
export { TaroDocument } from './dom/document.js';
|
|
13
14
|
export { TaroElement } from './dom/element.js';
|
|
14
15
|
export { TaroEvent, createEvent, eventHandler, eventHandlerTTDom } from './dom/event.js';
|
|
15
16
|
export { FormElement } from './dom/form.js';
|
|
16
17
|
export { bumpNearestCtxEpochForRoot, getNearestCtx, invalidateNearestCtx, isNearestCtxEnv } from './dom/nearest-ctx.js';
|
|
17
18
|
export { TaroNode } from './dom/node.js';
|
|
18
19
|
export { TaroRootElement } from './dom/root.js';
|
|
20
|
+
export { ShadowRoot } from './dom/shadow-root.js';
|
|
19
21
|
export { Style } from './dom/style.js';
|
|
20
22
|
export { SVGElement } from './dom/svg.js';
|
|
21
23
|
export { TaroText } from './dom/text.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -278,6 +278,9 @@ declare class TaroNode extends TaroEventTarget {
|
|
|
278
278
|
get parentElement(): TaroElement | null;
|
|
279
279
|
get firstChild(): TaroNode | null;
|
|
280
280
|
get lastChild(): TaroNode | null;
|
|
281
|
+
getRootNode(_options?: {
|
|
282
|
+
composed?: boolean;
|
|
283
|
+
}): TaroNode;
|
|
281
284
|
/**
|
|
282
285
|
* @textContent 目前只能置空子元素
|
|
283
286
|
* @TODO 等待完整 innerHTML 实现
|
|
@@ -598,6 +601,9 @@ declare function isNearestCtxEnv(): boolean;
|
|
|
598
601
|
declare function getNearestCtx(node: TaroNode): MpInstance | null | undefined;
|
|
599
602
|
declare function bumpNearestCtxEpochForRoot(root: TaroRootElement | null | undefined): void;
|
|
600
603
|
|
|
604
|
+
declare class ShadowRoot extends TaroElement {
|
|
605
|
+
}
|
|
606
|
+
|
|
601
607
|
declare class SVGElement extends TaroElement {
|
|
602
608
|
}
|
|
603
609
|
|
|
@@ -924,5 +930,5 @@ declare function convertNumber2PX(value: number): string;
|
|
|
924
930
|
|
|
925
931
|
declare function handlePolyfill(): void;
|
|
926
932
|
|
|
927
|
-
export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, CLICK_VIEW, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, TaroURLProvider as URL, URLSearchParams$1 as URLSearchParams, VALUE, VIEW, addLeadingSlash, bumpNearestCtxEpochForRoot, _caf as cancelAnimationFrame, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, debounce, taroDocumentProvider as document, env, eventCenter, eventHandler, eventHandlerTTDom, eventSource, extend, getComponentsAlias, taroGetComputedStyleProvider as getComputedStyle, getCurrentInstance, getCurrentPage, getHomePage, getNearestCtx, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, handlePolyfill, hasBasename, taroHistoryProvider as history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isNearestCtxEnv, isParentBound, isText, taroLocationProvider as location, nav as navigator, nextTick, now, options, parseUrl, perf, removePageInstance, _raf as requestAnimationFrame, safeExecute, setInnerHTML, shortcutAttr, stringify, stripBasename, stripSuffix, stripTrailing, throttle, taroWindowProvider as window };
|
|
933
|
+
export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, CLICK_VIEW, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, ShadowRoot, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroDocument, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, TaroURLProvider as URL, URLSearchParams$1 as URLSearchParams, VALUE, VIEW, addLeadingSlash, bumpNearestCtxEpochForRoot, _caf as cancelAnimationFrame, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, debounce, taroDocumentProvider as document, env, eventCenter, eventHandler, eventHandlerTTDom, eventSource, extend, getComponentsAlias, taroGetComputedStyleProvider as getComputedStyle, getCurrentInstance, getCurrentPage, getHomePage, getNearestCtx, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, handlePolyfill, hasBasename, taroHistoryProvider as history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isNearestCtxEnv, isParentBound, isText, taroLocationProvider as location, nav as navigator, nextTick, now, options, parseUrl, perf, removePageInstance, _raf as requestAnimationFrame, safeExecute, setInnerHTML, shortcutAttr, stringify, stripBasename, stripSuffix, stripTrailing, throttle, taroWindowProvider as window };
|
|
928
934
|
export type { AddEventListenerOptions, AppInstance, Attributes, DataTree, EventHandler, EventListenerOptions, EventOptions, EventsType, HydratedData, Instance, KeyFrame, MiniData, MiniElementData, MiniTextData, MpEvent, MpInstance, Options$2 as Options, PageConfig, PageInstance, PageLifeCycle, PageProps, ReactAppInstance, ReactPageComponent, ReactPageInstance, ScrollTimelineOption, TFunc, UpdatePayload, UpdatePayloadValue };
|
|
@@ -1302,6 +1302,42 @@ class ClassList {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
1304
|
|
|
1305
|
+
// Object property order does not track writes to existing attributes.
|
|
1306
|
+
const attributeOrder = new WeakMap();
|
|
1307
|
+
function recordDatasetAttribute(element, name) {
|
|
1308
|
+
let order = attributeOrder.get(element);
|
|
1309
|
+
if (!order) {
|
|
1310
|
+
order = new Set();
|
|
1311
|
+
attributeOrder.set(element, order);
|
|
1312
|
+
}
|
|
1313
|
+
order.delete(name);
|
|
1314
|
+
order.add(name);
|
|
1315
|
+
}
|
|
1316
|
+
function removeDatasetAttribute(element, name) {
|
|
1317
|
+
const key = toCamelCase(name.replace(/^data-/, ''));
|
|
1318
|
+
const order = attributeOrder.get(element);
|
|
1319
|
+
order === null || order === void 0 ? void 0 : order.delete(name);
|
|
1320
|
+
let remainingAttribute;
|
|
1321
|
+
order === null || order === void 0 ? void 0 : order.forEach(attribute => {
|
|
1322
|
+
if (toCamelCase(attribute.replace(/^data-/, '')) === key) {
|
|
1323
|
+
remainingAttribute = attribute;
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
if (remainingAttribute !== undefined) {
|
|
1327
|
+
element.dataset[key] = element.props[remainingAttribute];
|
|
1328
|
+
}
|
|
1329
|
+
else {
|
|
1330
|
+
delete element.dataset[key];
|
|
1331
|
+
}
|
|
1332
|
+
if ((order === null || order === void 0 ? void 0 : order.size) === 0)
|
|
1333
|
+
attributeOrder.delete(element);
|
|
1334
|
+
}
|
|
1335
|
+
function copyDatasetAttributeOrder(source, target) {
|
|
1336
|
+
const order = attributeOrder.get(source);
|
|
1337
|
+
if (order)
|
|
1338
|
+
attributeOrder.set(target, new Set(order));
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1305
1341
|
class EventSource extends Map {
|
|
1306
1342
|
removeNode(child) {
|
|
1307
1343
|
const { sid, uid } = child;
|
|
@@ -1426,14 +1462,6 @@ class TaroEventTarget {
|
|
|
1426
1462
|
isCapture = Boolean(options.capture);
|
|
1427
1463
|
isOnce = Boolean(options.once);
|
|
1428
1464
|
}
|
|
1429
|
-
if (isOnce) {
|
|
1430
|
-
const wrapper = function () {
|
|
1431
|
-
handler.apply(this, arguments); // this 指向 Element
|
|
1432
|
-
this.removeEventListener(type, wrapper);
|
|
1433
|
-
};
|
|
1434
|
-
this.addEventListener(type, wrapper, Object.assign(Object.assign({}, options), { once: false }));
|
|
1435
|
-
return;
|
|
1436
|
-
}
|
|
1437
1465
|
process.env.NODE_ENV !== 'production' && warn(isCapture, 'Taro 暂未实现 event 的 capture 特性。');
|
|
1438
1466
|
// 某些框架,如 PReact 有委托的机制,handler 始终是同一个函数
|
|
1439
1467
|
// 这会导致多层停止冒泡失败:view -> view(handler.stop = false) -> view(handler.stop = true)
|
|
@@ -1441,6 +1469,9 @@ class TaroEventTarget {
|
|
|
1441
1469
|
// 因此每次绑定事件都新建一个函数,如果带来了性能问题,可以把这段逻辑抽取到 PReact 插件中。
|
|
1442
1470
|
const oldHandler = handler;
|
|
1443
1471
|
handler = function () {
|
|
1472
|
+
// Remove this registration before invoking user code, including reentrant or throwing callbacks.
|
|
1473
|
+
if (isOnce)
|
|
1474
|
+
this.removeEventListener(type, handler);
|
|
1444
1475
|
return oldHandler.apply(this, arguments); // this 指向 Element
|
|
1445
1476
|
};
|
|
1446
1477
|
handler.oldHandler = oldHandler;
|
|
@@ -1616,6 +1647,14 @@ class TaroNode extends TaroEventTarget {
|
|
|
1616
1647
|
const childNodes = this.childNodes;
|
|
1617
1648
|
return childNodes[childNodes.length - 1] || null;
|
|
1618
1649
|
}
|
|
1650
|
+
getRootNode(_options) {
|
|
1651
|
+
// Mini programs have no shadow trees, so composed does not change the root.
|
|
1652
|
+
let root = this;
|
|
1653
|
+
while (root.parentNode) {
|
|
1654
|
+
root = root.parentNode;
|
|
1655
|
+
}
|
|
1656
|
+
return root;
|
|
1657
|
+
}
|
|
1619
1658
|
/**
|
|
1620
1659
|
* @textContent 目前只能置空子元素
|
|
1621
1660
|
* @TODO 等待完整 innerHTML 实现
|
|
@@ -1769,6 +1808,10 @@ class TaroNode extends TaroEventTarget {
|
|
|
1769
1808
|
return;
|
|
1770
1809
|
if (newChild === oldChild)
|
|
1771
1810
|
return oldChild;
|
|
1811
|
+
// An empty fragment inserts nothing, so removal must schedule the update.
|
|
1812
|
+
if (newChild.nodeName === DOCUMENT_FRAGMENT && !newChild.hasChildNodes()) {
|
|
1813
|
+
return this.removeChild(oldChild);
|
|
1814
|
+
}
|
|
1772
1815
|
// Insert the newChild
|
|
1773
1816
|
this.insertBefore(newChild, oldChild, true);
|
|
1774
1817
|
// Destroy the oldChild
|
|
@@ -2334,6 +2377,7 @@ class TaroElement extends TaroNode {
|
|
|
2334
2377
|
this.dataset = Object.create(null);
|
|
2335
2378
|
}
|
|
2336
2379
|
this.dataset[toCamelCase(qualifiedName.replace(/^data-/, ''))] = value;
|
|
2380
|
+
recordDatasetAttribute(this, qualifiedName);
|
|
2337
2381
|
}
|
|
2338
2382
|
break;
|
|
2339
2383
|
}
|
|
@@ -2397,6 +2441,9 @@ class TaroElement extends TaroNode {
|
|
|
2397
2441
|
return;
|
|
2398
2442
|
}
|
|
2399
2443
|
delete this.props[qualifiedName];
|
|
2444
|
+
if (qualifiedName.startsWith('data-')) {
|
|
2445
|
+
removeDatasetAttribute(this, qualifiedName);
|
|
2446
|
+
}
|
|
2400
2447
|
}
|
|
2401
2448
|
// Serialization
|
|
2402
2449
|
if (!this._root)
|
|
@@ -2459,8 +2506,12 @@ class TaroElement extends TaroNode {
|
|
|
2459
2506
|
if (!isArray(listeners)) {
|
|
2460
2507
|
return false;
|
|
2461
2508
|
}
|
|
2462
|
-
|
|
2463
|
-
|
|
2509
|
+
// Freeze this dispatch's registrations while respecting removals before invocation.
|
|
2510
|
+
const dispatchListeners = listeners.slice();
|
|
2511
|
+
for (let i = dispatchListeners.length; i--;) {
|
|
2512
|
+
const listener = dispatchListeners[i];
|
|
2513
|
+
if (!listeners.includes(listener))
|
|
2514
|
+
continue;
|
|
2464
2515
|
let result;
|
|
2465
2516
|
if (listener._stop) {
|
|
2466
2517
|
listener._stop = false;
|
|
@@ -3368,6 +3419,9 @@ function getTemplateContent(ctx) {
|
|
|
3368
3419
|
function insertAdjacentHTML(position, html) {
|
|
3369
3420
|
var _a, _b;
|
|
3370
3421
|
const parsedNodes = parser(html, this.ownerDocument);
|
|
3422
|
+
// Keep the insertion anchors stable while adding multiple parsed nodes.
|
|
3423
|
+
const firstChild = this.firstChild;
|
|
3424
|
+
const nextSibling = this.nextSibling;
|
|
3371
3425
|
for (let i = 0; i < parsedNodes.length; i++) {
|
|
3372
3426
|
const n = parsedNodes[i];
|
|
3373
3427
|
switch (position) {
|
|
@@ -3375,18 +3429,13 @@ function insertAdjacentHTML(position, html) {
|
|
|
3375
3429
|
(_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(n, this);
|
|
3376
3430
|
break;
|
|
3377
3431
|
case 'afterbegin':
|
|
3378
|
-
|
|
3379
|
-
this.insertBefore(n, this.childNodes[0]);
|
|
3380
|
-
}
|
|
3381
|
-
else {
|
|
3382
|
-
this.appendChild(n);
|
|
3383
|
-
}
|
|
3432
|
+
this.insertBefore(n, firstChild);
|
|
3384
3433
|
break;
|
|
3385
3434
|
case 'beforeend':
|
|
3386
3435
|
this.appendChild(n);
|
|
3387
3436
|
break;
|
|
3388
3437
|
case 'afterend':
|
|
3389
|
-
(_b = this.parentNode) === null || _b === void 0 ? void 0 : _b.
|
|
3438
|
+
(_b = this.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(n, nextSibling);
|
|
3390
3439
|
break;
|
|
3391
3440
|
}
|
|
3392
3441
|
}
|
|
@@ -3415,20 +3464,24 @@ function cloneNode(isDeep = false) {
|
|
|
3415
3464
|
}
|
|
3416
3465
|
}
|
|
3417
3466
|
if (isDeep) {
|
|
3418
|
-
newNode.childNodes = this.childNodes.map(node =>
|
|
3467
|
+
newNode.childNodes = this.childNodes.map(node => {
|
|
3468
|
+
const child = node.cloneNode(true);
|
|
3469
|
+
child.parentNode = newNode;
|
|
3470
|
+
return child;
|
|
3471
|
+
});
|
|
3472
|
+
}
|
|
3473
|
+
if (this.nodeType === 1 /* NodeType.ELEMENT_NODE */) {
|
|
3474
|
+
copyDatasetAttributeOrder(this, newNode);
|
|
3419
3475
|
}
|
|
3420
3476
|
return newNode;
|
|
3421
3477
|
}
|
|
3422
3478
|
function contains(node) {
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
const { uid } = childNode;
|
|
3426
|
-
if (uid === node.uid || uid === node.id || childNode.contains(node)) {
|
|
3427
|
-
isContains = true;
|
|
3479
|
+
while (node) {
|
|
3480
|
+
if (node === this)
|
|
3428
3481
|
return true;
|
|
3429
|
-
|
|
3430
|
-
}
|
|
3431
|
-
return
|
|
3482
|
+
node = node.parentNode;
|
|
3483
|
+
}
|
|
3484
|
+
return false;
|
|
3432
3485
|
}
|
|
3433
3486
|
|
|
3434
3487
|
if (process.env.TARO_PLATFORM !== PLATFORM_TYPE.WEB && process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY) {
|
|
@@ -4194,6 +4247,10 @@ function createTTDomDocument() {
|
|
|
4194
4247
|
const taroDocumentProvider = process.env.TARO_PLATFORM === 'web' ? env.document : (env.document =
|
|
4195
4248
|
isEnableTTDom() ? createTTDomDocument() : createDocument());
|
|
4196
4249
|
|
|
4250
|
+
// For Vue's instanceof checks only; mini programs do not support shadow DOM.
|
|
4251
|
+
class ShadowRoot extends TaroElement {
|
|
4252
|
+
}
|
|
4253
|
+
|
|
4197
4254
|
// for Vue3
|
|
4198
4255
|
class SVGElement extends TaroElement {
|
|
4199
4256
|
}
|
|
@@ -5377,5 +5434,5 @@ if (process.env.SUPPORT_TARO_POLYFILL !== 'disabled' && process.env.TARO_PLATFOR
|
|
|
5377
5434
|
handlePolyfill();
|
|
5378
5435
|
}
|
|
5379
5436
|
|
|
5380
|
-
export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, CLICK_VIEW, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver$1 as MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, TaroURLProvider as URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, bumpNearestCtxEpochForRoot, _caf as cancelAnimationFrame, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, debounce, taroDocumentProvider as document, env, eventCenter, eventHandler, eventHandlerTTDom, eventSource, extend, getComponentsAlias, taroGetComputedStyleProvider as getComputedStyle, getCurrentInstance, getCurrentPage, getHomePage, getNearestCtx, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, handlePolyfill, hasBasename, taroHistoryProvider as history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isNearestCtxEnv, isParentBound, isText, taroLocationProvider as location, nav as navigator, nextTick, now, options, parseUrl, perf, removePageInstance, _raf as requestAnimationFrame, safeExecute, setInnerHTML, shortcutAttr, stringify, stripBasename, stripSuffix, stripTrailing, throttle, taroWindowProvider as window };
|
|
5437
|
+
export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, CLICK_VIEW, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver$1 as MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, ShadowRoot, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroDocument, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, TaroURLProvider as URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, bumpNearestCtxEpochForRoot, _caf as cancelAnimationFrame, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, debounce, taroDocumentProvider as document, env, eventCenter, eventHandler, eventHandlerTTDom, eventSource, extend, getComponentsAlias, taroGetComputedStyleProvider as getComputedStyle, getCurrentInstance, getCurrentPage, getHomePage, getNearestCtx, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, handlePolyfill, hasBasename, taroHistoryProvider as history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isNearestCtxEnv, isParentBound, isText, taroLocationProvider as location, nav as navigator, nextTick, now, options, parseUrl, perf, removePageInstance, _raf as requestAnimationFrame, safeExecute, setInnerHTML, shortcutAttr, stringify, stripBasename, stripSuffix, stripTrailing, throttle, taroWindowProvider as window };
|
|
5381
5438
|
//# sourceMappingURL=runtime.esm.js.map
|