@tarojs/runtime 4.1.0-alpha.2 → 4.1.0

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 (67) hide show
  1. package/dist/bom/URL.d.ts +6 -3
  2. package/dist/bom/URLSearchParams.d.ts +2 -1
  3. package/dist/bom/document.d.ts +3 -2
  4. package/dist/bom/getComputedStyle.d.ts +5 -4
  5. package/dist/bom/history.d.ts +7 -5
  6. package/dist/bom/location.d.ts +5 -3
  7. package/dist/bom/navigator.d.ts +2 -1
  8. package/dist/bom/raf.d.ts +2 -2
  9. package/dist/bom/window.d.ts +9 -8
  10. package/dist/constants/index.d.ts +53 -52
  11. package/dist/current.d.ts +5 -5
  12. package/dist/dom/anchor-element.d.ts +3 -2
  13. package/dist/dom/class-list.d.ts +3 -2
  14. package/dist/dom/document.d.ts +10 -6
  15. package/dist/dom/element.d.ts +7 -6
  16. package/dist/dom/event-source.d.ts +3 -3
  17. package/dist/dom/event-target.d.ts +3 -2
  18. package/dist/dom/event.d.ts +6 -5
  19. package/dist/dom/form.d.ts +4 -3
  20. package/dist/dom/node.d.ts +39 -8
  21. package/dist/dom/root.d.ts +4 -3
  22. package/dist/dom/style.d.ts +3 -2
  23. package/dist/dom/svg.d.ts +3 -2
  24. package/dist/dom/text.d.ts +4 -3
  25. package/dist/dom/transfer.d.ts +3 -2
  26. package/dist/dom/tree.d.ts +3 -3
  27. package/dist/dom-external/element.d.ts +4 -3
  28. package/dist/dom-external/inner-html/html.d.ts +3 -2
  29. package/dist/dom-external/inner-html/parser.d.ts +7 -7
  30. package/dist/dom-external/inner-html/scaner.d.ts +3 -3
  31. package/dist/dom-external/inner-html/style.d.ts +3 -3
  32. package/dist/dom-external/inner-html/tags.d.ts +6 -5
  33. package/dist/dom-external/inner-html/utils.d.ts +2 -1
  34. package/dist/dom-external/mutation-observer/implements.d.ts +25 -6
  35. package/dist/dom-external/mutation-observer/index.d.ts +5 -6
  36. package/dist/dom-external/node.d.ts +6 -5
  37. package/dist/dsl/common.d.ts +15 -14
  38. package/dist/emitter/emitter.d.ts +2 -2
  39. package/dist/env.d.ts +2 -2
  40. package/dist/hydrate.d.ts +5 -4
  41. package/dist/index-26658829.d.ts +23 -0
  42. package/dist/index.cjs.d.ts +813 -0
  43. package/dist/index.cjs.js +4 -4
  44. package/dist/index.d.ts +32 -33
  45. package/dist/{dsl/instance.d.ts → instance-530729bd.d.ts} +14 -13
  46. package/dist/next-tick.d.ts +3 -2
  47. package/dist/{dom/node_types.d.ts → node_types-9ac5b4dd.d.ts} +2 -1
  48. package/dist/{interface/options.d.ts → options-530729bd.d.ts} +5 -4
  49. package/dist/options.d.ts +3 -2
  50. package/dist/perf.d.ts +2 -2
  51. package/dist/polyfill/array.d.ts +3 -2
  52. package/dist/polyfill/intersection-observer.d.ts +2 -1
  53. package/dist/polyfill/object.d.ts +4 -3
  54. package/dist/{dom-external/mutation-observer/record.d.ts → record-32b054d8.d.ts} +4 -3
  55. package/dist/runtime.esm.d.ts +813 -0
  56. package/dist/utils/cache.d.ts +2 -1
  57. package/dist/utils/index.d.ts +18 -17
  58. package/dist/utils/lodash.d.ts +3 -2
  59. package/dist/utils/router.d.ts +8 -7
  60. package/package.json +4 -3
  61. package/dist/interface/element.d.ts +0 -4
  62. package/dist/interface/event-target.d.ts +0 -11
  63. package/dist/interface/event.d.ts +0 -15
  64. package/dist/interface/hydrate.d.ts +0 -29
  65. package/dist/interface/index.d.ts +0 -7
  66. package/dist/interface/node.d.ts +0 -7
  67. package/dist/interface/utils.d.ts +0 -2
@@ -3,7 +3,7 @@ interface Position {
3
3
  column: number;
4
4
  line: number;
5
5
  }
6
- export interface Token {
6
+ interface Token {
7
7
  type: string;
8
8
  content?: string;
9
9
  position?: {
@@ -12,7 +12,7 @@ export interface Token {
12
12
  };
13
13
  close?: boolean;
14
14
  }
15
- export declare class Scaner {
15
+ declare class Scaner {
16
16
  private tokens;
17
17
  private position;
18
18
  private html;
@@ -27,4 +27,4 @@ export declare class Scaner {
27
27
  private scanAttrs;
28
28
  private scanSkipTag;
29
29
  }
30
- export {};
30
+ export { Token, Scaner };
@@ -1,4 +1,4 @@
1
- import type { ParsedTaroElement } from './parser';
1
+ import { ParsedTaroElement } from "./parser.js";
2
2
  interface ISelector {
3
3
  isChild: boolean;
4
4
  isGeneralSibling: boolean;
@@ -16,7 +16,7 @@ interface IStyle {
16
16
  content: string;
17
17
  selectorList: ISelector[];
18
18
  }
19
- export default class StyleTagParser {
19
+ declare class StyleTagParser {
20
20
  styles: IStyle[];
21
21
  extractStyle(src: string): string;
22
22
  stringToSelector(style: string): void;
@@ -24,4 +24,4 @@ export default class StyleTagParser {
24
24
  matchStyle(tagName: string, el: ParsedTaroElement, list: number[]): string;
25
25
  matchCurrent(tagName: string, el: ParsedTaroElement, selector: ISelector): boolean;
26
26
  }
27
- export {};
27
+ export { StyleTagParser as default };
@@ -1,8 +1,9 @@
1
- export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
2
- export declare const specialMiniElements: {
1
+ declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
2
+ declare const specialMiniElements: {
3
3
  img: string;
4
4
  iframe: string;
5
5
  };
6
- export declare const isMiniElements: (key: string) => boolean;
7
- export declare const isInlineElements: (key: string) => boolean;
8
- export declare const isBlockElements: (key: string) => boolean;
6
+ declare const isMiniElements: (key: string) => boolean;
7
+ declare const isInlineElements: (key: string) => boolean;
8
+ declare const isBlockElements: (key: string) => boolean;
9
+ export { makeMap, specialMiniElements, isMiniElements, isInlineElements, isBlockElements };
@@ -1 +1,2 @@
1
- export declare function unquote(str: string): string;
1
+ declare function unquote(str: string): string;
2
+ export { unquote };
@@ -1,10 +1,10 @@
1
- import type { TaroNode } from '../../dom/node';
2
- import type { MutationRecord } from './record';
3
- export type MutationCallback = (mutations: MutationRecord[]) => any;
1
+ import { TaroNode } from "../../dom/node.js";
2
+ import { MutationRecord } from "../../record-32b054d8.js";
3
+ type MutationCallback = (mutations: MutationRecord[]) => any;
4
4
  /**
5
5
  * @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
6
6
  */
7
- export interface MutationObserverInit {
7
+ interface MutationObserverInit {
8
8
  attributeFilter?: string[];
9
9
  attributeOldValue?: boolean;
10
10
  attributes?: boolean;
@@ -21,12 +21,20 @@ export interface MutationObserverInit {
21
21
  * @see https://dom.spec.whatwg.org/#mutationobserver
22
22
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
23
23
  */
24
- export declare class MutationObserverImpl {
24
+ declare class MutationObserverImpl {
25
25
  callback: MutationCallback;
26
26
  target: TaroNode | null;
27
27
  options: MutationObserverInit;
28
28
  records: MutationRecord[];
29
29
  constructor(callback: MutationCallback);
30
+ /**
31
+ * Configures the MutationObserver
32
+ * to begin receiving notifications
33
+ * through its callback function
34
+ * when DOM changes matching the given options occur.
35
+ *
36
+ * Options matching is to be implemented.
37
+ */
30
38
  /**
31
39
  * Configures the MutationObserver
32
40
  * to begin receiving notifications
@@ -36,12 +44,22 @@ export declare class MutationObserverImpl {
36
44
  * Options matching is to be implemented.
37
45
  */
38
46
  observe(target: TaroNode, options?: MutationObserverInit): void;
47
+ /**
48
+ * Stop the MutationObserver instance
49
+ * from receiving further notifications
50
+ * until and unless observe() is called again.
51
+ */
39
52
  /**
40
53
  * Stop the MutationObserver instance
41
54
  * from receiving further notifications
42
55
  * until and unless observe() is called again.
43
56
  */
44
57
  disconnect(): void;
58
+ /**
59
+ * Removes all pending notifications
60
+ * from the MutationObserver's notification queue
61
+ * and returns them in a new Array of MutationRecord objects.
62
+ */
45
63
  /**
46
64
  * Removes all pending notifications
47
65
  * from the MutationObserver's notification queue
@@ -49,4 +67,5 @@ export declare class MutationObserverImpl {
49
67
  */
50
68
  takeRecords(): MutationRecord[];
51
69
  }
52
- export declare function recordMutation(record: MutationRecord): void;
70
+ declare function recordMutation(record: MutationRecord): void;
71
+ export { MutationCallback, MutationObserverInit, MutationObserverImpl, recordMutation };
@@ -1,8 +1,7 @@
1
- import { MutationObserverImpl } from './implements';
2
- import { MutationRecord, MutationRecordType } from './record';
3
- import type { TaroNode } from '../../dom/node';
4
- import type { MutationCallback, MutationObserverInit } from './implements';
5
- export declare class MutationObserver {
1
+ import { MutationObserverImpl, MutationCallback, MutationObserverInit } from "./implements.js";
2
+ import { MutationRecord, MutationRecordType } from "../../record-32b054d8.js";
3
+ import { TaroNode } from "../../dom/node.js";
4
+ declare class MutationObserver {
6
5
  core: Pick<MutationObserverImpl, 'observe' | 'disconnect' | 'takeRecords'>;
7
6
  constructor(callback: MutationCallback);
8
7
  observe(...args: [TaroNode, MutationObserverInit?]): void;
@@ -10,4 +9,4 @@ export declare class MutationObserver {
10
9
  takeRecords(): MutationRecord[];
11
10
  static record(record: MutationRecord): void;
12
11
  }
13
- export { MutationRecordType };
12
+ export { MutationObserver, MutationRecordType };
@@ -1,11 +1,12 @@
1
- import type { TaroNode } from '../dom/node';
2
- export type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
1
+ import { TaroNode } from "../dom/node.js";
2
+ type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
3
3
  /**
4
4
  * An implementation of `Element.insertAdjacentHTML()`
5
5
  * to support Vue 3 with a version of or greater than `vue@3.1.2`
6
6
  */
7
- export declare function insertAdjacentHTML(this: TaroNode, position: IPosition, html: string): void;
8
- export declare function cloneNode(this: TaroNode, isDeep?: boolean): any;
9
- export declare function contains(this: TaroNode, node: TaroNode & {
7
+ declare function insertAdjacentHTML(this: TaroNode, position: IPosition, html: string): void;
8
+ declare function cloneNode(this: TaroNode, isDeep?: boolean): any;
9
+ declare function contains(this: TaroNode, node: TaroNode & {
10
10
  id?: string;
11
11
  }): boolean;
12
+ export { IPosition, insertAdjacentHTML, cloneNode, contains };
@@ -1,15 +1,16 @@
1
1
  /// <reference types="react" />
2
- import type { PageConfig } from '../interface';
3
- import type { Instance, PageInstance, PageProps } from './instance';
4
- export declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
5
- export declare function getPageInstance(id: string): Instance | undefined;
6
- export declare function removePageInstance(id: string): void;
7
- export declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
8
- export declare function stringify(obj?: Record<string, unknown>): string;
9
- export declare function getPath(id: string, options?: Record<string, unknown>): string;
10
- export declare function getOnReadyEventKey(path: string): string;
11
- export declare function getOnShowEventKey(path: string): string;
12
- export declare function getOnHideEventKey(path: string): string;
13
- export declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
14
- export declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
15
- export declare function createRecursiveComponentConfig(componentName?: string): any;
2
+ import { PageConfig } from "../index-26658829.js";
3
+ import { Instance, PageInstance, PageProps } from "../instance-530729bd.js";
4
+ declare function injectPageInstance(inst: Instance<PageProps>, id: string): void;
5
+ declare function getPageInstance(id: string): Instance | undefined;
6
+ declare function removePageInstance(id: string): void;
7
+ declare function safeExecute(path: string, lifecycle: string, ...args: unknown[]): any;
8
+ declare function stringify(obj?: Record<string, unknown>): string;
9
+ declare function getPath(id: string, options?: Record<string, unknown>): string;
10
+ declare function getOnReadyEventKey(path: string): string;
11
+ declare function getOnShowEventKey(path: string): string;
12
+ declare function getOnHideEventKey(path: string): string;
13
+ declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
14
+ declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
15
+ declare function createRecursiveComponentConfig(componentName?: string): any;
16
+ export { injectPageInstance, getPageInstance, removePageInstance, safeExecute, stringify, getPath, getOnReadyEventKey, getOnShowEventKey, getOnHideEventKey, createPageConfig, createComponentConfig, createRecursiveComponentConfig };
@@ -1,4 +1,4 @@
1
1
  import { Events } from '@tarojs/shared';
2
2
  declare const eventCenter: Events;
3
- export type EventsType = typeof Events;
4
- export { eventCenter, Events };
3
+ type EventsType = typeof Events;
4
+ export { EventsType, eventCenter, Events };
package/dist/env.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { TaroDocument } from './dom/document';
1
+ import { TaroDocument } from "./dom/document.js";
2
2
  interface Env {
3
3
  window: any;
4
4
  document: TaroDocument;
5
5
  }
6
6
  declare const env: Env;
7
- export default env;
7
+ export { env as default };
package/dist/hydrate.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import type { TaroElement } from './dom/element';
2
- import type { TaroText } from './dom/text';
3
- import type { MiniData } from './interface';
1
+ import { TaroElement } from "./dom/element.js";
2
+ import { TaroText } from "./dom/text.js";
3
+ import { MiniData } from "./index-26658829.js";
4
4
  /**
5
5
  * React also has a fancy function's name for this: `hydrate()`.
6
6
  * You may have been heard `hydrate` as a SSR-related function,
7
7
  * actually, `hydrate` basicly do the `render()` thing, but ignore some properties,
8
8
  * it's a vnode traverser and modifier: that's exactly what Taro's doing in here.
9
9
  */
10
- export declare function hydrate(node: TaroElement | TaroText): MiniData;
10
+ declare function hydrate(node: TaroElement | TaroText): MiniData;
11
+ export { hydrate };
@@ -0,0 +1,23 @@
1
+ import { Shortcuts } from "@tarojs/shared";
2
+ interface MiniElementData {
3
+ [Shortcuts.Childnodes]?: MiniData[];
4
+ [Shortcuts.NodeName]: string;
5
+ [Shortcuts.Class]?: string;
6
+ [Shortcuts.Style]?: string;
7
+ uid?: string;
8
+ sid: string;
9
+ [key: string]: unknown;
10
+ }
11
+ interface MiniTextData {
12
+ [Shortcuts.Text]: string;
13
+ [Shortcuts.NodeName]: string;
14
+ }
15
+ type MiniData = MiniElementData | MiniTextData;
16
+ type HydratedData = () => MiniData | MiniData[];
17
+ type UpdatePayloadValue = string | boolean | HydratedData;
18
+ type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
19
+ interface UpdatePayload {
20
+ path: string;
21
+ value: UpdatePayloadValue;
22
+ }
23
+ export { UpdatePayloadValue, DataTree, UpdatePayload };