vite-plugin-taro-runtime 0.7.12-beta.0 → 0.7.12

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.
Files changed (72) hide show
  1. package/dist/api/dist/tools.d.ts +1 -1
  2. package/dist/api/dist/tools.js +1 -1
  3. package/dist/api/dist/tools.js.map +1 -1
  4. package/dist/components/dist/components/taro-image-core.js +13 -12
  5. package/dist/components/dist/components/taro-scroll-view-core.js +8 -3
  6. package/dist/components/dist/components/taro-web-view-core.js +48 -1
  7. package/dist/components/types/Button.d.ts +7 -0
  8. package/dist/components/types/Image.d.ts +6 -0
  9. package/dist/components/types/Input.d.ts +1 -1
  10. package/dist/components/types/ScrollView.d.ts +5 -0
  11. package/dist/components/types/Textarea.d.ts +1 -1
  12. package/dist/components/types/common.d.ts +24 -1
  13. package/dist/plugin-framework-react/runtime.js +29 -67
  14. package/dist/plugin-framework-react/runtime.js.map +1 -1
  15. package/dist/plugin-platform-h5/definition.json +3 -5
  16. package/dist/plugin-platform-weapp/runtime-utils.js +1 -0
  17. package/dist/plugin-platform-weapp/runtime-utils.js.map +1 -1
  18. package/dist/plugin-platform-weapp/runtime.js +1 -0
  19. package/dist/plugin-platform-weapp/runtime.js.map +1 -1
  20. package/dist/plugin-platform-weapp/types/components.d.ts +1 -0
  21. package/dist/react/index.d.ts +1 -0
  22. package/dist/react/react.esm.js +12 -113
  23. package/dist/react/renderer-host.d.ts +8 -0
  24. package/dist/runtime/bom/document.js +1 -1
  25. package/dist/runtime/dom/element.d.ts +4 -0
  26. package/dist/runtime/dom/element.js +9 -1
  27. package/dist/runtime/dom/element.js.map +1 -1
  28. package/dist/runtime/dom/nearest-ctx.d.ts +9 -0
  29. package/dist/runtime/dom/nearest-ctx.js +49 -0
  30. package/dist/runtime/dom/nearest-ctx.js.map +1 -0
  31. package/dist/runtime/dom/node.d.ts +15 -2
  32. package/dist/runtime/dom/node.js +71 -59
  33. package/dist/runtime/dom/node.js.map +1 -1
  34. package/dist/runtime/dom/root.d.ts +2 -0
  35. package/dist/runtime/dom/root.js +12 -14
  36. package/dist/runtime/dom/root.js.map +1 -1
  37. package/dist/runtime/dom/style.d.ts +2 -0
  38. package/dist/runtime/dom/style.js +15 -14
  39. package/dist/runtime/dom/style.js.map +1 -1
  40. package/dist/runtime/dom/text.d.ts +5 -0
  41. package/dist/runtime/dom/text.js +8 -4
  42. package/dist/runtime/dsl/common.d.ts +1 -1
  43. package/dist/runtime/dsl/common.js +18 -9
  44. package/dist/runtime/dsl/common.js.map +1 -1
  45. package/dist/runtime/index.d.ts +1 -0
  46. package/dist/runtime/index.js +1 -0
  47. package/dist/runtime/index.js.map +1 -1
  48. package/dist/runtime/runtime.esm.d.ts +9 -2
  49. package/dist/runtime/runtime.esm.js +81 -13
  50. package/dist/runtime/runtime.esm.js.map +1 -1
  51. package/dist/taro/package.json +9 -9
  52. package/dist/taro/types/api/device/clipboard.d.ts +5 -0
  53. package/dist/taro/types/api/network/request.d.ts +7 -3
  54. package/dist/taro/types/api/network/upload.d.ts +21 -1
  55. package/dist/taro/types/api/payment/index.d.ts +58 -0
  56. package/dist/taro/types/compile/compiler.d.ts +13 -0
  57. package/dist/taro/types/compile/hooks.d.ts +1 -0
  58. package/dist/taro/types/taro.config.d.ts +64 -0
  59. package/dist/taro-h5/dist/api/base/weapp/app-event.js +15 -5
  60. package/dist/taro-h5/dist/api/base/weapp/app-event.js.map +1 -1
  61. package/dist/taro-h5/dist/api/device/clipboard.js +10 -6
  62. package/dist/taro-h5/dist/api/device/clipboard.js.map +1 -1
  63. package/dist/taro-h5/dist/api/media/map.d.ts +14 -1
  64. package/dist/taro-h5/dist/api/media/map.js +72 -2
  65. package/dist/taro-h5/dist/api/media/map.js.map +1 -1
  66. package/dist/taro-h5/dist/api/taro.d.ts +1 -1
  67. package/dist/taro-h5/dist/api/taro.js +3 -3
  68. package/dist/taro-h5/dist/api/taro.js.map +1 -1
  69. package/dist/taro-h5/dist/api/wxml/IntersectionObserver.js +3 -0
  70. package/dist/taro-h5/dist/api/wxml/IntersectionObserver.js.map +1 -1
  71. package/package.json +22 -16
  72. package/types/tt-document.d.ts +38 -0
@@ -1,5 +1,6 @@
1
1
  import { PLATFORM_TYPE, isObject, isEnableTTDom, isString, isFunction, toCamelCase, UNITLESS_PROPERTIES_SET, isNumber, capitalize, internalComponents, isUndefined, noop, isBoolean, hooks, ensure } from '@tarojs/shared';
2
- import { setInnerHTML, FormElement, convertNumber2PX, eventHandlerTTDom, document } from '@tarojs/runtime';
2
+ import { setInnerHTML, convertNumber2PX, eventHandlerTTDom } from '@tarojs/runtime';
3
+ import host from '\0vpt:renderer-host';
3
4
  import { version } from 'react';
4
5
  import Reconciler from 'react-reconciler';
5
6
  import {
@@ -31,6 +32,7 @@ function getEventPriority(domEventName) {
31
32
  switch (domEventName) {
32
33
  case 'cancel':
33
34
  case 'click':
35
+ case 'tap':
34
36
  case 'close':
35
37
  case 'contextmenu':
36
38
  case 'copy':
@@ -363,7 +365,7 @@ function getUpdatePayload(dom, oldProps, newProps) {
363
365
  (updatePayload = updatePayload || []).push(i, null);
364
366
  }
365
367
  }
366
- const isFormElement = dom instanceof FormElement;
368
+ const isFormElement = host.isFormElement(dom);
367
369
  for (i in newProps) {
368
370
  if (oldProps[i] !== newProps[i] || (isFormElement && i === 'value')) {
369
371
  // 如果都是 style,且 style 里面的值相等,则无需记录到 payload 中
@@ -614,105 +616,6 @@ const taroHostTransitionContext = {
614
616
  };
615
617
  taroHostTransitionContext.Provider = taroHostTransitionContext;
616
618
  taroHostTransitionContext.Consumer = taroHostTransitionContext;
617
- /**
618
- * WX VPT Page outlet projection
619
- * -----------------------------
620
- * VPT retains one React ownership tree while WX exposes one independent setData surface per native Page. The singleton App
621
- * host records live in each Page's `app` data, the current Page records live in `page`, and Page WXML supplies its own template
622
- * as the default light-DOM slot of the virtual recursive App component. Taro restarts deep template recursion through nested
623
- * `comp` components. At every such native component boundary the slot must be forwarded only through the App branch that
624
- * contains the VPT Page outlet rendered for React's `{children}`: forwarding through all sibling branches creates duplicate
625
- * unnamed slot consumers, while forwarding through none loses the Page.
626
- *
627
- * `vo` is the compact, branch-local answer to "does this App subtree contain the VPT Page outlet?". WXML reads only `i.vo`,
628
- * so its decision is O(1) and it never scans descendants or receives Page data. This renderer owns `vo` rather than Taro's
629
- * hydrate or root scheduler because React's commit boundary is the first point where every host mutation has completed and
630
- * the final parent chain is authoritative. TaroElement already supports arbitrary properties: setAttribute updates
631
- * node.props and queues the normal granular `app.*.vo` path. Structural Taro payloads are lazy functions flushed by setTimeout, so they run
632
- * after resetAfterCommit and naturally serialize the same final `vo` props. There is consequently no projection-specific
633
- * hydration mode, update-path translation, or full App snapshot.
634
- *
635
- * High-level commit flow:
636
- * 1. React applies all Taro host insertions, removals, and reparenting synchronously.
637
- * 2. resetAfterCommit obtains the unique VPT Page outlet and walks parentNode from that outlet to the App root.
638
- * 3. The unchanged root-side suffix is skipped; old leaf-side nodes receive vo=false and new ones receive vo=true.
639
- * 4. Ordinary Taro attribute updates join structural updates in the already scheduled App batch.
640
- * 5. Lazy hydration observes node.props.vo, and the App batch fans out unchanged to every retained native Page.
641
- *
642
- * The App root stores the only persistent projection state as a VPT Page outlet-to-root node array. It contains O(D)
643
- * references, where D is outlet depth, so index 0 is the outlet represented by the latest queued native batch. A normal commit
644
- * performs an O(D) parent walk and raw array comparison and emits no native data when the spine is unchanged. A move touches
645
- * only the leaf-side portions outside the common root-side suffix and never depends on total App size W or Page size. React
646
- * can replace a host when moving it across parents; only then (and during initialization) a single O(W) search finds the new
647
- * VPT Page outlet. WXML still performs one constant-time boolean check per recursive boundary.
648
- */
649
- const VPT_PAGE_OUTLET = 'vpt_page_outlet';
650
- const VPT_PAGE_OUTLET_BRANCH = 'vo';
651
- const vptPageOutletSpineKey = Symbol('vptPageOutletSpine');
652
- /** Finds the VPT Page outlet only during initialization or after React replaced the cached VPT Page outlet host. */
653
- function findVptPageOutlet(node) {
654
- if (node.nodeName === VPT_PAGE_OUTLET)
655
- return node;
656
- const children = node.childNodes;
657
- for (let index = 0; index < children.length; index++) {
658
- const vptPageOutlet = findVptPageOutlet(children[index]);
659
- if (vptPageOutlet)
660
- return vptPageOutlet;
661
- }
662
- }
663
- /** Builds the final ancestor identity array from the VPT Page outlet to the App root. */
664
- function collectVptPageOutletSpine(container, vptPageOutlet) {
665
- // This local array is filled once in parent-link order, then retained unchanged as the next VPT Page outlet spine.
666
- const spine = [];
667
- for (let node = vptPageOutlet; node !== container; node = node.parentNode) {
668
- spine.push(node);
669
- }
670
- return spine;
671
- }
672
- /** Reconciles VPT Page outlet branch membership through ordinary Taro host props after one complete React commit. */
673
- function reconcileVptPageOutletSpine(container) {
674
- // Other React roots, including standalone Page/component roots, do not own the singleton VPT App-view projection.
675
- if (!container.parentNode || container.parentNode.nodeName !== 'container')
676
- return;
677
- const previousSpine = container[vptPageOutletSpineKey] || [];
678
- const previousVptPageOutlet = previousSpine[0];
679
- /*
680
- * Reuse the cached VPT Page outlet while it remains under this App root. Cross-parent React reconciliation may replace
681
- * the host rather than reparent its Taro node, so a detached cache entry requires one search of the committed tree.
682
- */
683
- const vptPageOutlet = previousVptPageOutlet && previousVptPageOutlet._root === container
684
- ? previousVptPageOutlet
685
- : findVptPageOutlet(container);
686
- ensure(vptPageOutlet, 'App must render children exactly once.');
687
- const currentSpine = collectVptPageOutletSpine(container, vptPageOutlet);
688
- /*
689
- * VPT Page outlet parent chains are stored outlet-to-root, so equal nodes form a root-side suffix. These mutable indexes
690
- * walk that suffix once without iterator, callback, Set, or intermediate-array allocation; the remaining prefixes are the
691
- * only candidates whose branch marker can differ.
692
- */
693
- let previousIndex = previousSpine.length - 1;
694
- let currentIndex = currentSpine.length - 1;
695
- while (previousIndex >= 0 && currentIndex >= 0 && previousSpine[previousIndex] === currentSpine[currentIndex]) {
696
- previousIndex--;
697
- currentIndex--;
698
- }
699
- /*
700
- * Detached old nodes are already removed by their parent's structural payload. Surviving nodes in the changed old prefix
701
- * still have native records, so clear their marker through Taro's ordinary attribute queue.
702
- */
703
- for (let index = 0; index <= previousIndex; index++) {
704
- const node = previousSpine[index];
705
- if (node._root === container) {
706
- node.setAttribute(VPT_PAGE_OUTLET_BRANCH, false);
707
- }
708
- }
709
- // Write the changed current prefix after clearing the old prefix so any surviving moved identity ends with vo=true.
710
- for (let index = 0; index <= currentIndex; index++) {
711
- currentSpine[index].setAttribute(VPT_PAGE_OUTLET_BRANCH, true);
712
- }
713
- // This is the sole persistent VPT projection state: the ancestor identities in the latest queued native App batch.
714
- container[vptPageOutletSpineKey] = currentSpine;
715
- }
716
619
  const hostConfig = {
717
620
  // React 19 react-reconciler host config additions.
718
621
  setCurrentUpdatePriority(priority) {
@@ -758,19 +661,15 @@ const hostConfig = {
758
661
  getChildHostContext(parentHostContext) {
759
662
  return parentHostContext;
760
663
  },
761
- prepareForCommit(..._) {
664
+ prepareForCommit(container) {
665
+ host.beforeCommit?.(container);
762
666
  return null;
763
667
  },
764
- /*
765
- * React invokes this synchronously after host mutations and before returning from the commit. Taro defers evaluation of
766
- * structural hydrate functions with setTimeout, so VPT Page outlet branch props written here are batched and visible to
767
- * every compact record serialized for this commit.
768
- */
769
668
  resetAfterCommit(container) {
770
- reconcileVptPageOutletSpine(container);
669
+ host.afterCommit(container);
771
670
  },
772
- createInstance(type, props, _rootContainerInstance, _hostContext, internalInstanceHandle) {
773
- const element = document.createElement(type);
671
+ createInstance(type, props, container, context, internalInstanceHandle) {
672
+ const element = host.createElement(container, context, type);
774
673
  precacheFiberNode(internalInstanceHandle, element);
775
674
  updateFiberProps(element, props);
776
675
  return element;
@@ -780,7 +679,7 @@ const hostConfig = {
780
679
  },
781
680
  finalizeInitialChildren(dom, type, props) {
782
681
  let newProps = props;
783
- if (dom instanceof FormElement) {
682
+ if (host.isFormElement(dom)) {
784
683
  const [defaultName, defaultKey] = ['switch', 'checkbox', 'radio'].includes(type) ? ['checked', 'defaultChecked'] : ['value', 'defaultValue'];
785
684
  if (props.hasOwnProperty(defaultKey)) {
786
685
  newProps = Object.assign(Object.assign({}, newProps), { [defaultName]: props[defaultKey] });
@@ -796,8 +695,8 @@ const hostConfig = {
796
695
  shouldSetTextContent() {
797
696
  return false;
798
697
  },
799
- createTextInstance(text, _rootContainerInstance, _hostContext, internalInstanceHandle) {
800
- const textNode = document.createTextNode(text);
698
+ createTextInstance(text, container, context, internalInstanceHandle) {
699
+ const textNode = host.createText(container, context, text);
801
700
  precacheFiberNode(internalInstanceHandle, textNode);
802
701
  return textNode;
803
702
  },
@@ -0,0 +1,8 @@
1
+ /** Host-owned creation, form classification and commit boundaries for the shared React renderer. */
2
+ export type RendererHost<Container, Context, Element, Text> = Readonly<{
3
+ createElement(container: Container, context: Context, type: string): Element
4
+ createText(container: Container, context: Context, text: string): Text
5
+ isFormElement(element: Element): boolean
6
+ beforeCommit?(container: Container): void
7
+ afterCommit(container: Container): void
8
+ }>
@@ -28,7 +28,7 @@ function createDocument() {
28
28
  * same React container and keeps the same id, but can now batch app.* updates through its own ctx just as each Page root
29
29
  * batches page.* updates. Reusing the host itself removes the need for a detached scheduler node.
30
30
  *
31
- * Taro and the framework locate this container by id; the pinned 4.2.1 runtime has no behavior branching on an APP
31
+ * Taro and the framework locate this container by id; the pinned 4.3.0 runtime has no behavior branching on an APP
32
32
  * nodeName or APP tagName. App snapshots hydrate the container's children rather than the container record itself, so
33
33
  * ROOT is never emitted as a native layout node. The observable change is limited to unsupported code directly
34
34
  * inspecting #app.nodeName/tagName or using this support fork with upstream templates. H5 loads the untouched
@@ -30,7 +30,11 @@ declare class TaroElement extends TaroNode {
30
30
  set focus(value: () => void);
31
31
  blur(): void;
32
32
  setAttribute(qualifiedName: string, value: any): void;
33
+ /** Delegates after logical storage and ID/dataset updates; the flag records the prior template view classification. */
34
+ delegateAttributeUpdate(qualifiedName: string, value: unknown, isPureView: boolean): void;
33
35
  removeAttribute(qualifiedName: string): void;
36
+ /** Delegates after successful logical removal; the flag records the prior template view classification. */
37
+ delegateAttributeRemoval(qualifiedName: string, isStaticView: boolean): void;
34
38
  getAttribute(qualifiedName: string): string;
35
39
  getElementsByTagName(tagName: string): TaroElement[];
36
40
  getElementsByClassName(className: string): TaroElement[];
@@ -124,6 +124,10 @@ class TaroElement extends TaroNode {
124
124
  }
125
125
  break;
126
126
  }
127
+ this.delegateAttributeUpdate(qualifiedName, value, isPureView);
128
+ }
129
+ /** Delegates the stored attribute value; isPureView preserves the pre-mutation template classification. */
130
+ delegateAttributeUpdate(qualifiedName, value, isPureView) {
127
131
  // Serialization
128
132
  if (!this._root)
129
133
  return;
@@ -185,6 +189,10 @@ class TaroElement extends TaroNode {
185
189
  }
186
190
  delete this.props[qualifiedName];
187
191
  }
192
+ this.delegateAttributeRemoval(qualifiedName, isStaticView);
193
+ }
194
+ /** Delegates a completed removal; interrupted and absent attributes retain their original early returns. */
195
+ delegateAttributeRemoval(qualifiedName, isStaticView) {
188
196
  // Serialization
189
197
  if (!this._root)
190
198
  return;
@@ -300,7 +308,7 @@ class TaroElement extends TaroNode {
300
308
  hooks.call('modifyRemoveEventListener', this, sideEffect, getComponentsAlias);
301
309
  if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {
302
310
  const componentsAlias = getComponentsAlias();
303
- const value = isHasExtractProp(this) ? `static-${name}` : `pure-${name}`;
311
+ const value = name === VIEW && !isHasExtractProp(this) ? PURE_VIEW : `static-${name}`;
304
312
  const valueAlias = componentsAlias[value]._num;
305
313
  this.enqueueUpdate({
306
314
  path: `${this._path}.${"nn" /* Shortcuts.NodeName */}`,
@@ -1 +1 @@
1
- {"version":3,"file":"element.js","sources":["../../../src/dom/element.ts"],"sourcesContent":["import { EMPTY_OBJ, hooks, isArray, isFunction, isObject, isString, isUndefined, Shortcuts, toCamelCase, warn } from '@tarojs/shared'\n\nimport {\n CATCH_VIEW,\n CATCHMOVE,\n CLASS,\n CLICK_VIEW,\n EVENT_CALLBACK_RESULT,\n FOCUS,\n ID,\n PROPERTY_THRESHOLD,\n PURE_VIEW,\n STATIC_VIEW,\n STYLE,\n VIEW\n} from '../constants'\nimport { MutationObserver, MutationRecordType } from '../dom-external/mutation-observer'\nimport { extend, getComponentsAlias, isElement, isHasExtractProp, shortcutAttr } from '../utils'\nimport { ClassList } from './class-list'\nimport { eventSource } from './event-source'\nimport { TaroNode } from './node'\nimport { NodeType } from './node_types'\nimport { Style } from './style'\nimport { treeToArray } from './tree'\n\nimport type { Attributes, TFunc } from '../interface'\nimport type { TaroEvent } from './event'\n\nexport class TaroElement extends TaroNode {\n public ctx?\n public tagName: string\n public props: Record<string, any> = {}\n public style: Style\n public dataset: Record<string, unknown> = EMPTY_OBJ\n public innerHTML: string\n\n public constructor () {\n super()\n this.nodeType = NodeType.ELEMENT_NODE\n this.style = new Style(this)\n hooks.call('patchElement', this)\n }\n\n private _stopPropagation (event: TaroEvent) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let target = this\n // eslint-disable-next-line no-cond-assign\n while ((target = target.parentNode as this)) {\n const listeners = target.__handlers[event.type]\n\n if (!isArray(listeners)) {\n continue\n }\n\n for (let i = listeners.length; i--;) {\n const l = listeners[i]\n l._stop = true\n }\n }\n }\n\n public get id (): string {\n return this.getAttribute(ID)!\n }\n\n public set id (val: string) {\n this.setAttribute(ID, val)\n }\n\n public get className (): string {\n return this.getAttribute(CLASS) || ''\n }\n\n public set className (val: string) {\n this.setAttribute(CLASS, val)\n }\n\n public get cssText (): string {\n return this.getAttribute(STYLE) || ''\n }\n\n public get classList (): ClassList {\n return new ClassList(this.className, this)\n }\n\n public get children (): TaroElement[] {\n return this.childNodes.filter(isElement)\n }\n\n public get attributes (): Attributes[] {\n const props = this.props\n const propKeys = Object.keys(props)\n const style = this.style.cssText\n const attrs = propKeys.map(key => ({ name: key, value: props[key] }))\n return attrs.concat(style ? { name: STYLE, value: style } : [])\n }\n\n public get textContent (): string {\n let text = ''\n const childNodes = this.childNodes\n\n for (let i = 0; i < childNodes.length; i++) {\n text += childNodes[i].textContent\n }\n\n return text\n }\n\n public set textContent (text: string) {\n super.textContent = text\n }\n\n public hasAttribute (qualifiedName: string): boolean {\n return !isUndefined(this.props[qualifiedName])\n }\n\n public hasAttributes (): boolean {\n return this.attributes.length > 0\n }\n\n public get focus () {\n return function () {\n this.setAttribute(FOCUS, true)\n }\n }\n\n // 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579\n public set focus (value) {\n this.setAttribute(FOCUS, value)\n }\n\n public blur () {\n this.setAttribute(FOCUS, false)\n }\n\n public setAttribute (qualifiedName: string, value: any): void {\n process.env.NODE_ENV !== 'production' && warn(\n isString(value) && value.length > PROPERTY_THRESHOLD,\n `元素 ${this.nodeName} 的 ${qualifiedName} 属性值数据量过大,可能会影响渲染性能。考虑降低图片转为 base64 的阈值或在 CSS 中使用 base64。`\n )\n\n const isPureView = this.nodeName === VIEW && !isHasExtractProp(this) && !this.isAnyEventBinded()\n\n if (qualifiedName !== STYLE) {\n MutationObserver.record({\n target: this,\n type: MutationRecordType.ATTRIBUTES,\n attributeName: qualifiedName,\n oldValue: this.getAttribute(qualifiedName)\n })\n }\n\n switch (qualifiedName) {\n case STYLE:\n this.style.cssText = value as string\n break\n case ID:\n if (this.uid !== this.sid) {\n // eventSource[sid] 永远保留,直到组件卸载\n // eventSource[uid] 可变\n eventSource.delete(this.uid)\n }\n value = String(value)\n this.props[qualifiedName] = this.uid = value\n eventSource.set(value, this)\n break\n default:\n this.props[qualifiedName] = value as string\n\n if (qualifiedName.startsWith('data-')) {\n if (this.dataset === EMPTY_OBJ) {\n this.dataset = Object.create(null)\n }\n this.dataset[toCamelCase(qualifiedName.replace(/^data-/, ''))] = value\n }\n break\n }\n\n // Serialization\n if (!this._root) return\n\n const componentsAlias = getComponentsAlias()\n const _alias = componentsAlias[this.nodeName]\n const viewAlias = componentsAlias[VIEW]._num\n const clickViewAlias = componentsAlias[CLICK_VIEW]._num\n const staticViewAlias = componentsAlias[STATIC_VIEW]._num\n const catchViewAlias = componentsAlias[CATCH_VIEW]._num\n const _path = this._path\n\n qualifiedName = shortcutAttr(qualifiedName)\n\n const qualifiedNameInCamelCase = toCamelCase(qualifiedName)\n const payload = {\n path: `${_path}.${qualifiedNameInCamelCase}`,\n value: isFunction(value) ? () => value : value\n }\n\n hooks.call('modifySetAttrPayload', this, qualifiedName, payload, componentsAlias)\n\n if (_alias) {\n const qualifiedNameAlias = _alias[qualifiedNameInCamelCase] || qualifiedName\n payload.path = `${_path}.${toCamelCase(qualifiedNameAlias)}`\n }\n\n this.enqueueUpdate(payload)\n\n if (this.nodeName === VIEW) {\n if (qualifiedNameInCamelCase === CATCHMOVE) {\n // catchMove = true: catch-view\n // catchMove = false: view or click-view or static-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: value ? catchViewAlias : (\n this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)\n )\n })\n } else if (isPureView && isHasExtractProp(this)) {\n // pure-view => static-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: staticViewAlias\n })\n }\n }\n }\n\n public removeAttribute (qualifiedName: string) {\n const isStaticView = this.nodeName === VIEW && isHasExtractProp(this) && !this.isAnyEventBinded()\n\n MutationObserver.record({\n target: this,\n type: MutationRecordType.ATTRIBUTES,\n attributeName: qualifiedName,\n oldValue: this.getAttribute(qualifiedName)\n })\n\n if (qualifiedName === STYLE) {\n this.style.cssText = ''\n } else {\n const isInterrupt = hooks.call('onRemoveAttribute', this, qualifiedName)\n if (isInterrupt) {\n return\n }\n\n if (!this.props.hasOwnProperty(qualifiedName)) {\n return\n }\n delete this.props[qualifiedName]\n }\n\n // Serialization\n if (!this._root) return\n\n const componentsAlias = getComponentsAlias()\n const _alias = componentsAlias[this.nodeName]\n const viewAlias = componentsAlias[VIEW]._num\n const staticViewAlias = componentsAlias[STATIC_VIEW]._num\n const pureViewAlias = componentsAlias[PURE_VIEW]._num\n const clickViewAlias = componentsAlias[CLICK_VIEW]._num\n const _path = this._path\n\n qualifiedName = shortcutAttr(qualifiedName)\n\n const qualifiedNameInCamelCase = toCamelCase(qualifiedName)\n const payload = {\n path: `${_path}.${qualifiedNameInCamelCase}`,\n value: ''\n }\n\n hooks.call('modifyRmAttrPayload', this, qualifiedName, payload, componentsAlias)\n\n if (_alias) {\n const qualifiedNameAlias = _alias[qualifiedNameInCamelCase] || qualifiedName\n payload.path = `${_path}.${toCamelCase(qualifiedNameAlias)}`\n }\n\n this.enqueueUpdate(payload)\n\n if (this.nodeName === VIEW) {\n if (qualifiedNameInCamelCase === CATCHMOVE) {\n // catch-view => view or click-view or static-view or pure-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))\n })\n } else if (isStaticView && !isHasExtractProp(this)) {\n // static-view => pure-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: pureViewAlias\n })\n }\n }\n }\n\n public getAttribute (qualifiedName: string): string {\n const attr = qualifiedName === STYLE ? this.style.cssText : this.props[qualifiedName]\n return attr ?? ''\n }\n\n public getElementsByTagName (tagName: string): TaroElement[] {\n return treeToArray(this, (el) => {\n return el.nodeName === tagName || (tagName === '*' && this !== el)\n })\n }\n\n public getElementsByClassName (className: string): TaroElement[] {\n const classNames = className.trim().split(/\\s+/)\n\n return treeToArray(this, (el) => {\n const classList = el.classList\n return classNames.every(c => classList.contains(c))\n })\n }\n\n public dispatchEvent (event: TaroEvent): boolean {\n const cancelable = event.cancelable\n\n const listeners = this.__handlers[event.type]\n\n if (!isArray(listeners)) {\n return false\n }\n\n for (let i = listeners.length; i--;) {\n const listener = listeners[i]\n let result: unknown\n if (listener._stop) {\n listener._stop = false\n } else {\n hooks.call('modifyDispatchEvent', event, this)\n result = listener.call(this, event)\n }\n if ((result === false || event._end) && cancelable) {\n event.defaultPrevented = true\n }\n\n if (!isUndefined(result) && event.mpEvent) {\n const res = hooks.call('modifyTaroEventReturn', this, event, result)\n if (res) { event.mpEvent[EVENT_CALLBACK_RESULT] = result }\n }\n\n if (event._end && event._stop) {\n break\n }\n }\n\n if (event._stop) {\n this._stopPropagation(event)\n }\n\n return listeners != null\n }\n\n public addEventListener (type, handler, options) {\n const name = this.nodeName\n const SPECIAL_NODES = hooks.call('getSpecialNodes')!\n\n let sideEffect = true\n if (isObject<Record<string, any>>(options) && options.sideEffect === false) {\n sideEffect = false\n delete options.sideEffect\n }\n\n hooks.call('modifyAddEventListener', this, sideEffect, getComponentsAlias)\n\n if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {\n const componentsAlias = getComponentsAlias()\n const alias = componentsAlias[name]._num\n this.enqueueUpdate({\n path: `${this._path}.${Shortcuts.NodeName}`,\n value: alias\n })\n }\n\n super.addEventListener(type, handler, options)\n }\n\n public removeEventListener (type, handler, sideEffect = true) {\n super.removeEventListener(type, handler)\n\n const name = this.nodeName\n const SPECIAL_NODES = hooks.call('getSpecialNodes')!\n\n hooks.call('modifyRemoveEventListener', this, sideEffect, getComponentsAlias)\n\n if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {\n const componentsAlias = getComponentsAlias()\n const value = isHasExtractProp(this) ? `static-${name}` : `pure-${name}`\n const valueAlias = componentsAlias[value]._num\n this.enqueueUpdate({\n path: `${this._path}.${Shortcuts.NodeName}`,\n value: valueAlias\n })\n }\n }\n\n static extend (methodName: string, options: TFunc | Record<string, any>) {\n extend(TaroElement, methodName, options)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AA4BM,MAAO,WAAY,SAAQ,QAAQ,CAAA;AAQvC,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;QANF,IAAK,CAAA,KAAA,GAAwB,EAAE;QAE/B,IAAO,CAAA,OAAA,GAA4B,S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C,gBAAA,KAAK,EAAE;AACR,aAAA,CAAC;;QAGJ,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC;;AAGzC,IAAA,mBAAmB,CAAE,IAAI,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,EAAA;AAC1D,QAAA,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC;AAExC,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ;QAC1B,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAE;QAEpD,KAAK,CAAC,IAAI,CAAC,2BAA2B,EAAE,IAAI,EAAE,UAAU,EAAE,kBAAkB,CAAC;QAE7E,IAAI,UAAU,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;AACxF,YAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE;AAC5C,YAAA,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAU,OAAA,EAAA,IAAI,EAAE,GAAG,CAAQ,KAAA,EAAA,IAAI,EAAE;YACxE,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI;YAC9C,IAAI,CAAC,aAAa,CAAC;AACjB,gBAAA,IAAI,EAAE,CAAG,EAAA,IAAI,CAAC,KAAK,CAAA,CAAA,EAAI,8BAAoB,CAAA;AAC3C,gBAAA,KAAK,EAAE;AACR,aAAA,CAAC;;;AAIN,IAAA,OAAO,MAAM,CAAE,UAAkB,EAAE,OAAoC,EAAA;AACrE,QAAA,MAAM,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC;;AAE3C;;;;"}
1
+ {"version":3,"file":"element.js","sources":["../../../src/dom/element.ts"],"sourcesContent":["import { EMPTY_OBJ, hooks, isArray, isFunction, isObject, isString, isUndefined, Shortcuts, toCamelCase, warn } from '@tarojs/shared'\n\nimport {\n CATCH_VIEW,\n CATCHMOVE,\n CLASS,\n CLICK_VIEW,\n EVENT_CALLBACK_RESULT,\n FOCUS,\n ID,\n PROPERTY_THRESHOLD,\n PURE_VIEW,\n STATIC_VIEW,\n STYLE,\n VIEW\n} from '../constants'\nimport { MutationObserver, MutationRecordType } from '../dom-external/mutation-observer'\nimport { extend, getComponentsAlias, isElement, isHasExtractProp, shortcutAttr } from '../utils'\nimport { ClassList } from './class-list'\nimport { eventSource } from './event-source'\nimport { TaroNode } from './node'\nimport { NodeType } from './node_types'\nimport { Style } from './style'\nimport { treeToArray } from './tree'\n\nimport type { Attributes, TFunc } from '../interface'\nimport type { TaroEvent } from './event'\n\nexport class TaroElement extends TaroNode {\n public ctx?\n public tagName: string\n public props: Record<string, any> = {}\n public style: Style\n public dataset: Record<string, unknown> = EMPTY_OBJ\n public innerHTML: string\n\n public constructor () {\n super()\n this.nodeType = NodeType.ELEMENT_NODE\n this.style = new Style(this)\n hooks.call('patchElement', this)\n }\n\n private _stopPropagation (event: TaroEvent) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let target = this\n // eslint-disable-next-line no-cond-assign\n while ((target = target.parentNode as this)) {\n const listeners = target.__handlers[event.type]\n\n if (!isArray(listeners)) {\n continue\n }\n\n for (let i = listeners.length; i--;) {\n const l = listeners[i]\n l._stop = true\n }\n }\n }\n\n public get id (): string {\n return this.getAttribute(ID)!\n }\n\n public set id (val: string) {\n this.setAttribute(ID, val)\n }\n\n public get className (): string {\n return this.getAttribute(CLASS) || ''\n }\n\n public set className (val: string) {\n this.setAttribute(CLASS, val)\n }\n\n public get cssText (): string {\n return this.getAttribute(STYLE) || ''\n }\n\n public get classList (): ClassList {\n return new ClassList(this.className, this)\n }\n\n public get children (): TaroElement[] {\n return this.childNodes.filter(isElement)\n }\n\n public get attributes (): Attributes[] {\n const props = this.props\n const propKeys = Object.keys(props)\n const style = this.style.cssText\n const attrs = propKeys.map(key => ({ name: key, value: props[key] }))\n return attrs.concat(style ? { name: STYLE, value: style } : [])\n }\n\n public get textContent (): string {\n let text = ''\n const childNodes = this.childNodes\n\n for (let i = 0; i < childNodes.length; i++) {\n text += childNodes[i].textContent\n }\n\n return text\n }\n\n public set textContent (text: string) {\n super.textContent = text\n }\n\n public hasAttribute (qualifiedName: string): boolean {\n return !isUndefined(this.props[qualifiedName])\n }\n\n public hasAttributes (): boolean {\n return this.attributes.length > 0\n }\n\n public get focus () {\n return function () {\n this.setAttribute(FOCUS, true)\n }\n }\n\n // 兼容 Vue3,详情请见:https://github.com/NervJS/taro/issues/10579\n public set focus (value) {\n this.setAttribute(FOCUS, value)\n }\n\n public blur () {\n this.setAttribute(FOCUS, false)\n }\n\n public setAttribute (qualifiedName: string, value: any): void {\n process.env.NODE_ENV !== 'production' && warn(\n isString(value) && value.length > PROPERTY_THRESHOLD,\n `元素 ${this.nodeName} 的 ${qualifiedName} 属性值数据量过大,可能会影响渲染性能。考虑降低图片转为 base64 的阈值或在 CSS 中使用 base64。`\n )\n\n const isPureView = this.nodeName === VIEW && !isHasExtractProp(this) && !this.isAnyEventBinded()\n\n if (qualifiedName !== STYLE) {\n MutationObserver.record({\n target: this,\n type: MutationRecordType.ATTRIBUTES,\n attributeName: qualifiedName,\n oldValue: this.getAttribute(qualifiedName)\n })\n }\n\n switch (qualifiedName) {\n case STYLE:\n this.style.cssText = value as string\n break\n case ID:\n if (this.uid !== this.sid) {\n // eventSource[sid] 永远保留,直到组件卸载\n // eventSource[uid] 可变\n eventSource.delete(this.uid)\n }\n value = String(value)\n this.props[qualifiedName] = this.uid = value\n eventSource.set(value, this)\n break\n default:\n this.props[qualifiedName] = value as string\n\n if (qualifiedName.startsWith('data-')) {\n if (this.dataset === EMPTY_OBJ) {\n this.dataset = Object.create(null)\n }\n this.dataset[toCamelCase(qualifiedName.replace(/^data-/, ''))] = value\n }\n break\n }\n\n // Serialization\n if (!this._root) return\n\n const componentsAlias = getComponentsAlias()\n const _alias = componentsAlias[this.nodeName]\n const viewAlias = componentsAlias[VIEW]._num\n const clickViewAlias = componentsAlias[CLICK_VIEW]._num\n const staticViewAlias = componentsAlias[STATIC_VIEW]._num\n const catchViewAlias = componentsAlias[CATCH_VIEW]._num\n const _path = this._path\n\n qualifiedName = shortcutAttr(qualifiedName)\n\n const qualifiedNameInCamelCase = toCamelCase(qualifiedName)\n const payload = {\n path: `${_path}.${qualifiedNameInCamelCase}`,\n value: isFunction(value) ? () => value : value\n }\n\n hooks.call('modifySetAttrPayload', this, qualifiedName, payload, componentsAlias)\n\n if (_alias) {\n const qualifiedNameAlias = _alias[qualifiedNameInCamelCase] || qualifiedName\n payload.path = `${_path}.${toCamelCase(qualifiedNameAlias)}`\n }\n\n this.enqueueUpdate(payload)\n\n if (this.nodeName === VIEW) {\n if (qualifiedNameInCamelCase === CATCHMOVE) {\n // catchMove = true: catch-view\n // catchMove = false: view or click-view or static-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: value ? catchViewAlias : (\n this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)\n )\n })\n } else if (isPureView && isHasExtractProp(this)) {\n // pure-view => static-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: staticViewAlias\n })\n }\n }\n }\n\n public removeAttribute (qualifiedName: string) {\n const isStaticView = this.nodeName === VIEW && isHasExtractProp(this) && !this.isAnyEventBinded()\n\n MutationObserver.record({\n target: this,\n type: MutationRecordType.ATTRIBUTES,\n attributeName: qualifiedName,\n oldValue: this.getAttribute(qualifiedName)\n })\n\n if (qualifiedName === STYLE) {\n this.style.cssText = ''\n } else {\n const isInterrupt = hooks.call('onRemoveAttribute', this, qualifiedName)\n if (isInterrupt) {\n return\n }\n\n if (!this.props.hasOwnProperty(qualifiedName)) {\n return\n }\n delete this.props[qualifiedName]\n }\n\n // Serialization\n if (!this._root) return\n\n const componentsAlias = getComponentsAlias()\n const _alias = componentsAlias[this.nodeName]\n const viewAlias = componentsAlias[VIEW]._num\n const staticViewAlias = componentsAlias[STATIC_VIEW]._num\n const pureViewAlias = componentsAlias[PURE_VIEW]._num\n const clickViewAlias = componentsAlias[CLICK_VIEW]._num\n const _path = this._path\n\n qualifiedName = shortcutAttr(qualifiedName)\n\n const qualifiedNameInCamelCase = toCamelCase(qualifiedName)\n const payload = {\n path: `${_path}.${qualifiedNameInCamelCase}`,\n value: ''\n }\n\n hooks.call('modifyRmAttrPayload', this, qualifiedName, payload, componentsAlias)\n\n if (_alias) {\n const qualifiedNameAlias = _alias[qualifiedNameInCamelCase] || qualifiedName\n payload.path = `${_path}.${toCamelCase(qualifiedNameAlias)}`\n }\n\n this.enqueueUpdate(payload)\n\n if (this.nodeName === VIEW) {\n if (qualifiedNameInCamelCase === CATCHMOVE) {\n // catch-view => view or click-view or static-view or pure-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: this.isOnlyClickBinded() && !isHasExtractProp(this) ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))\n })\n } else if (isStaticView && !isHasExtractProp(this)) {\n // static-view => pure-view\n this.enqueueUpdate({\n path: `${_path}.${Shortcuts.NodeName}`,\n value: pureViewAlias\n })\n }\n }\n }\n\n public getAttribute (qualifiedName: string): string {\n const attr = qualifiedName === STYLE ? this.style.cssText : this.props[qualifiedName]\n return attr ?? ''\n }\n\n public getElementsByTagName (tagName: string): TaroElement[] {\n return treeToArray(this, (el) => {\n return el.nodeName === tagName || (tagName === '*' && this !== el)\n })\n }\n\n public getElementsByClassName (className: string): TaroElement[] {\n const classNames = className.trim().split(/\\s+/)\n\n return treeToArray(this, (el) => {\n const classList = el.classList\n return classNames.every(c => classList.contains(c))\n })\n }\n\n public dispatchEvent (event: TaroEvent): boolean {\n const cancelable = event.cancelable\n\n const listeners = this.__handlers[event.type]\n\n if (!isArray(listeners)) {\n return false\n }\n\n for (let i = listeners.length; i--;) {\n const listener = listeners[i]\n let result: unknown\n if (listener._stop) {\n listener._stop = false\n } else {\n hooks.call('modifyDispatchEvent', event, this)\n result = listener.call(this, event)\n }\n if ((result === false || event._end) && cancelable) {\n event.defaultPrevented = true\n }\n\n if (!isUndefined(result) && event.mpEvent) {\n const res = hooks.call('modifyTaroEventReturn', this, event, result)\n if (res) { event.mpEvent[EVENT_CALLBACK_RESULT] = result }\n }\n\n if (event._end && event._stop) {\n break\n }\n }\n\n if (event._stop) {\n this._stopPropagation(event)\n }\n\n return listeners != null\n }\n\n public addEventListener (type, handler, options) {\n const name = this.nodeName\n const SPECIAL_NODES = hooks.call('getSpecialNodes')!\n\n let sideEffect = true\n if (isObject<Record<string, any>>(options) && options.sideEffect === false) {\n sideEffect = false\n delete options.sideEffect\n }\n\n hooks.call('modifyAddEventListener', this, sideEffect, getComponentsAlias)\n\n if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {\n const componentsAlias = getComponentsAlias()\n const alias = componentsAlias[name]._num\n this.enqueueUpdate({\n path: `${this._path}.${Shortcuts.NodeName}`,\n value: alias\n })\n }\n\n super.addEventListener(type, handler, options)\n }\n\n public removeEventListener (type, handler, sideEffect = true) {\n super.removeEventListener(type, handler)\n\n const name = this.nodeName\n const SPECIAL_NODES = hooks.call('getSpecialNodes')!\n\n hooks.call('modifyRemoveEventListener', this, sideEffect, getComponentsAlias)\n\n if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {\n const componentsAlias = getComponentsAlias()\n const value = name === VIEW && !isHasExtractProp(this) ? PURE_VIEW : `static-${name}`\n const valueAlias = componentsAlias[value]._num\n this.enqueueUpdate({\n path: `${this._path}.${Shortcuts.NodeName}`,\n value: valueAlias\n })\n }\n }\n\n static extend (methodName: string, options: TFunc | Record<string, any>) {\n extend(TaroElement, methodName, options)\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AA4BM,MAAO,WAAY,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CAAC;;AAE3C;;;;"}
@@ -0,0 +1,9 @@
1
+ import { MpInstance } from '../interface/hydrate.js';
2
+ import { TaroNode } from './node.js';
3
+ import { TaroRootElement } from './root.js';
4
+
5
+ declare function isNearestCtxEnv(): boolean;
6
+ declare function getNearestCtx(node: TaroNode): MpInstance | null | undefined;
7
+ declare function bumpNearestCtxEpochForRoot(root: TaroRootElement | null | undefined): void;
8
+
9
+ export { bumpNearestCtxEpochForRoot, getNearestCtx, isNearestCtxEnv };
@@ -0,0 +1,49 @@
1
+ const nearestCtxCache = new WeakMap();
2
+ function isNearestCtxEnv() {
3
+ return process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'jd';
4
+ }
5
+ function getNearestCtx(node) {
6
+ if (!isNearestCtxEnv()) {
7
+ return undefined;
8
+ }
9
+ const root = node._root;
10
+ if (root == null) {
11
+ return null;
12
+ }
13
+ const cached = nearestCtxCache.get(node);
14
+ if (cached && cached.nearestCtxEpoch === root.nearestCtxEpoch) {
15
+ return cached.value;
16
+ }
17
+ const value = resolveNearestCtxValue(node, root);
18
+ nearestCtxCache.set(node, { value, nearestCtxEpoch: root.nearestCtxEpoch });
19
+ return value;
20
+ }
21
+ function resolveNearestCtxValue(node, root) {
22
+ var _a;
23
+ if (node.nodeType === 1 /* NodeType.ELEMENT_NODE */) {
24
+ const ctx = node.ctx;
25
+ if (ctx != null)
26
+ return ctx;
27
+ }
28
+ let current = node.parentNode;
29
+ while (current) {
30
+ if (current.nodeType === 1 /* NodeType.ELEMENT_NODE */) {
31
+ const ctx = current.ctx;
32
+ if (ctx != null)
33
+ return ctx;
34
+ }
35
+ current = current.parentNode;
36
+ }
37
+ return (_a = root.ctx) !== null && _a !== void 0 ? _a : null;
38
+ }
39
+ function bumpNearestCtxEpochForRoot(root) {
40
+ if (!isNearestCtxEnv() || root == null) {
41
+ return;
42
+ }
43
+ if (typeof root.bumpNearestCtxEpoch === 'function') {
44
+ root.bumpNearestCtxEpoch();
45
+ }
46
+ }
47
+
48
+ export { bumpNearestCtxEpochForRoot, getNearestCtx, isNearestCtxEnv };
49
+ //# sourceMappingURL=nearest-ctx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nearest-ctx.js","sources":["../../../src/dom/nearest-ctx.ts"],"sourcesContent":["import { NodeType } from './node_types'\n\nimport type { MpInstance } from '../interface'\nimport type { TaroElement } from './element'\nimport type { TaroNode } from './node'\nimport type { TaroRootElement } from './root'\n\nconst nearestCtxCache = new WeakMap<TaroNode, { value: MpInstance | null, nearestCtxEpoch: number }>()\n\nexport function isNearestCtxEnv (): boolean {\n return process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'jd'\n}\n\nexport function getNearestCtx (node: TaroNode): MpInstance | null | undefined {\n if (!isNearestCtxEnv()) {\n return undefined\n }\n const root = node._root\n if (root == null) {\n return null\n }\n const cached = nearestCtxCache.get(node)\n if (cached && cached.nearestCtxEpoch === root.nearestCtxEpoch) {\n return cached.value\n }\n const value = resolveNearestCtxValue(node, root)\n nearestCtxCache.set(node, { value, nearestCtxEpoch: root.nearestCtxEpoch })\n return value\n}\n\nfunction resolveNearestCtxValue (node: TaroNode, root: TaroRootElement): MpInstance | null {\n if (node.nodeType === NodeType.ELEMENT_NODE) {\n const ctx = (node as TaroElement).ctx\n if (ctx != null) return ctx as MpInstance\n }\n let current: TaroNode | null = node.parentNode\n while (current) {\n if (current.nodeType === NodeType.ELEMENT_NODE) {\n const ctx = (current as TaroElement).ctx\n if (ctx != null) return ctx as MpInstance\n }\n current = current.parentNode\n }\n return root.ctx ?? null\n}\n\nexport function bumpNearestCtxEpochForRoot (root: TaroRootElement | null | undefined): void {\n if (!isNearestCtxEnv() || root == null) {\n return\n }\n if (typeof root.bumpNearestCtxEpoch === 'function') {\n root.bumpNearestCtxEpoch()\n }\n}\n"],"names":[],"mappings":"AAOA,MAAM,eAAe,GAAG,IAAI,OAAO,EAAmE;SAEtF,eAAe,GAAA;AAC7B,IAAA,OAAO,OAAO,CAAC,GAAG,CA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AA,KAAA,MAAA,GAAA,EAAA,GAAI,IAAI;AACzB;AAEM,SAAU,0BAA0B,CAAE,IAAwC,EAAA;IAClF,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,IAAI,IAAI,EAAE;QACtC;;AAEF,IAAA,IAAI,OAAO,IAAI,CAAC,mBAAmB,KAAK,UAAU,EAAE;QAClD,IAAI,CAAC,mBAAmB,EAAE;;AAE9B;;;;"}
@@ -1,10 +1,11 @@
1
1
  import { TaroEventTarget } from './event-target.js';
2
2
  import { NodeType } from './node_types.js';
3
- import { TFunc } from '../interface/utils.js';
3
+ import { MpInstance } from '../interface/hydrate.js';
4
4
  import { UpdatePayload } from '../interface/node.js';
5
5
  import { TaroElement } from './element.js';
6
6
  import { TaroDocument } from './document.js';
7
7
  import { TaroRootElement } from './root.js';
8
+ import { TFunc } from '../interface/utils.js';
8
9
 
9
10
  interface RemoveChildOptions {
10
11
  cleanRef?: boolean;
@@ -19,9 +20,11 @@ declare class TaroNode extends TaroEventTarget {
19
20
  childNodes: TaroNode[];
20
21
  constructor();
21
22
  private hydrate;
22
- private updateChildNodes;
23
+ /** Delegates a complete child-list update, including the final reset after element textContent changes. */
24
+ delegateChildReset(isClean?: boolean): void;
23
25
  private updateSingleChild;
24
26
  get _root(): TaroRootElement | null;
27
+ get _scope(): MpInstance | null | undefined;
25
28
  protected findIndex(refChild: TaroNode): number;
26
29
  get _path(): string;
27
30
  get nextSibling(): TaroNode | null;
@@ -69,6 +72,16 @@ declare class TaroNode extends TaroEventTarget {
69
72
  * 2. remove C
70
73
  */
71
74
  removeChild<T extends TaroNode>(child: T, options?: RemoveChildOptions): T;
75
+ /**
76
+ * Delegates an insertion after Taro updates its tree, including detached parents.
77
+ * The index is the insertion offset when refChild is supplied. The default prepares template payloads.
78
+ */
79
+ delegateChildInsertion(newChild: TaroNode, refChild: TaroNode | null | undefined, index: number, isReplace: boolean | undefined): void;
80
+ /**
81
+ * Delegates a removal after logical detachment and event identity cleanup.
82
+ * Every removal is forwarded; options.doUpdate only suppresses the default template update.
83
+ */
84
+ delegateChildRemoval(child: TaroNode, options: RemoveChildOptions): void;
72
85
  remove(options?: RemoveChildOptions): void;
73
86
  hasChildNodes(): boolean;
74
87
  enqueueUpdate(payload: UpdatePayload): void;