@tarojs/runtime 3.6.22-nightly.0 → 3.6.22-nightly.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/dist/bom/URL.d.ts +7 -14
- package/dist/bom/URL.js +221 -0
- package/dist/bom/URL.js.map +1 -0
- package/dist/bom/URLSearchParams.d.ts +2 -14
- package/dist/bom/URLSearchParams.js +123 -0
- package/dist/bom/URLSearchParams.js.map +1 -0
- package/dist/bom/document.d.ts +2 -1
- package/dist/bom/document.js +39 -0
- package/dist/bom/document.js.map +1 -0
- package/dist/bom/getComputedStyle.d.ts +5 -3
- package/dist/bom/getComputedStyle.js +8 -0
- package/dist/bom/getComputedStyle.js.map +1 -0
- package/dist/bom/history.d.ts +11 -8
- package/dist/bom/history.js +121 -0
- package/dist/bom/history.js.map +1 -0
- package/dist/bom/location.d.ts +7 -4
- package/dist/bom/location.js +240 -0
- package/dist/bom/location.js.map +1 -0
- package/dist/bom/navigator.d.ts +2 -1
- package/dist/bom/navigator.js +24 -0
- package/dist/bom/navigator.js.map +1 -0
- package/dist/bom/raf.d.ts +3 -4
- package/dist/bom/raf.js +33 -0
- package/dist/bom/raf.js.map +1 -0
- package/dist/bom/window.d.ts +25 -4
- package/dist/bom/window.js +92 -0
- package/dist/bom/window.js.map +1 -0
- package/dist/constants/index.d.ts +52 -50
- package/dist/constants/index.js +63 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/current.d.ts +5 -5
- package/dist/current.js +9 -0
- package/dist/current.js.map +1 -0
- package/dist/dom/anchor-element.d.ts +3 -2
- package/dist/dom/anchor-element.js +54 -0
- package/dist/dom/anchor-element.js.map +1 -0
- package/dist/dom/class-list.d.ts +3 -2
- package/dist/dom/class-list.js +92 -0
- package/dist/dom/class-list.js.map +1 -0
- package/dist/dom/document.d.ts +11 -6
- package/dist/dom/document.js +80 -0
- package/dist/dom/document.js.map +1 -0
- package/dist/dom/element.d.ts +8 -7
- package/dist/dom/element.js +318 -0
- package/dist/dom/element.js.map +1 -0
- package/dist/dom/event-source.d.ts +3 -3
- package/dist/dom/event-source.js +17 -0
- package/dist/dom/event-source.js.map +1 -0
- package/dist/dom/event-target.d.ts +3 -2
- package/dist/dom/event-target.js +78 -0
- package/dist/dom/event-target.js.map +1 -0
- package/dist/dom/event.d.ts +6 -5
- package/dist/dom/event.js +151 -0
- package/dist/dom/event.js.map +1 -0
- package/dist/dom/form.d.ts +4 -3
- package/dist/dom/form.js +38 -0
- package/dist/dom/form.js.map +1 -0
- package/dist/dom/node.d.ts +40 -9
- package/dist/dom/node.js +292 -0
- package/dist/dom/node.js.map +1 -0
- package/dist/dom/root.d.ts +6 -5
- package/dist/dom/root.js +169 -0
- package/dist/dom/root.js.map +1 -0
- package/dist/dom/style.d.ts +3 -2
- package/dist/dom/style.js +168 -0
- package/dist/dom/style.js.map +1 -0
- package/dist/dom/style_properties.js +186 -0
- package/dist/dom/style_properties.js.map +1 -0
- package/dist/dom/svg.d.ts +3 -2
- package/dist/dom/svg.js +8 -0
- package/dist/dom/svg.js.map +1 -0
- package/dist/dom/text.d.ts +4 -3
- package/dist/dom/text.js +41 -0
- package/dist/dom/text.js.map +1 -0
- package/dist/dom/transfer.d.ts +3 -2
- package/dist/dom/transfer.js +15 -0
- package/dist/dom/transfer.js.map +1 -0
- package/dist/dom/tree.d.ts +3 -3
- package/dist/dom/tree.js +38 -0
- package/dist/dom/tree.js.map +1 -0
- package/dist/dom-external/element.d.ts +4 -3
- package/dist/dom-external/element.js +29 -0
- package/dist/dom-external/element.js.map +1 -0
- package/dist/dom-external/index.js +38 -0
- package/dist/dom-external/index.js.map +1 -0
- package/dist/dom-external/inner-html/html.d.ts +3 -2
- package/dist/dom-external/inner-html/html.js +28 -0
- package/dist/dom-external/inner-html/html.js.map +1 -0
- package/dist/dom-external/inner-html/parser.d.ts +7 -7
- package/dist/dom-external/inner-html/parser.js +216 -0
- package/dist/dom-external/inner-html/parser.js.map +1 -0
- package/dist/dom-external/inner-html/scaner.d.ts +3 -3
- package/dist/dom-external/inner-html/scaner.js +304 -0
- package/dist/dom-external/inner-html/scaner.js.map +1 -0
- package/dist/dom-external/inner-html/style.d.ts +3 -3
- package/dist/dom-external/inner-html/style.js +235 -0
- package/dist/dom-external/inner-html/style.js.map +1 -0
- package/dist/dom-external/inner-html/tags.d.ts +6 -5
- package/dist/dom-external/inner-html/tags.js +26 -0
- package/dist/dom-external/inner-html/tags.js.map +1 -0
- package/dist/dom-external/inner-html/utils.d.ts +2 -1
- package/dist/dom-external/inner-html/utils.js +12 -0
- package/dist/dom-external/inner-html/utils.js.map +1 -0
- package/dist/dom-external/mutation-observer/implements.d.ts +25 -6
- package/dist/dom-external/mutation-observer/implements.js +108 -0
- package/dist/dom-external/mutation-observer/implements.js.map +1 -0
- package/dist/dom-external/mutation-observer/index.d.ts +5 -6
- package/dist/dom-external/mutation-observer/index.js +35 -0
- package/dist/dom-external/mutation-observer/index.js.map +1 -0
- package/dist/dom-external/node.d.ts +6 -5
- package/dist/dom-external/node.js +74 -0
- package/dist/dom-external/node.js.map +1 -0
- package/dist/dsl/common.d.ts +16 -16
- package/dist/dsl/common.js +337 -0
- package/dist/dsl/common.js.map +1 -0
- package/dist/emitter/emitter.d.ts +2 -2
- package/dist/emitter/emitter.js +7 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/env.d.ts +2 -2
- package/dist/env.js +9 -0
- package/dist/env.js.map +1 -0
- package/dist/hydrate.d.ts +5 -4
- package/dist/hydrate.js +84 -0
- package/dist/hydrate.js.map +1 -0
- package/dist/index-26658829.d.ts +23 -0
- package/dist/index.cjs.d.ts +775 -0
- package/dist/index.cjs.js +4347 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +30 -31
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/{dsl/instance.d.ts → instance-0f017c6e.d.ts} +19 -18
- package/dist/next-tick.d.ts +3 -2
- package/dist/next-tick.js +47 -0
- package/dist/next-tick.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js +32 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/{dom/node_types.d.ts → node_types-9ac5b4dd.d.ts} +2 -1
- package/dist/{interface/options.d.ts → options-0f017c6e.d.ts} +5 -4
- package/dist/options.d.ts +3 -2
- package/dist/options.js +7 -0
- package/dist/options.js.map +1 -0
- package/dist/perf.d.ts +2 -2
- package/dist/perf.js +28 -0
- package/dist/perf.js.map +1 -0
- package/dist/{dom-external/mutation-observer/record.d.ts → record-32b054d8.d.ts} +4 -3
- package/dist/runtime.esm.d.ts +82 -88
- package/dist/runtime.esm.js +360 -374
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.d.ts +2 -1
- package/dist/utils/cache.js +27 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +15 -15
- package/dist/utils/index.js +95 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +20 -10
- package/dist/interface/element.d.ts +0 -4
- package/dist/interface/event-target.d.ts +0 -10
- package/dist/interface/event.d.ts +0 -15
- package/dist/interface/hydrate.d.ts +0 -30
- package/dist/interface/index.d.ts +0 -7
- package/dist/interface/node.d.ts +0 -7
- package/dist/interface/utils.d.ts +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import env from './env';
|
|
1
|
+
import env from "./env.js";
|
|
3
2
|
export { hooks } from '@tarojs/shared';
|
|
4
|
-
export { document } from
|
|
5
|
-
export { getComputedStyle } from
|
|
6
|
-
export { History } from
|
|
7
|
-
export { Location } from
|
|
8
|
-
export { nav as navigator } from
|
|
9
|
-
export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from
|
|
10
|
-
export { parseUrl, URL } from
|
|
11
|
-
export { URLSearchParams } from
|
|
12
|
-
export { history, location, window } from
|
|
13
|
-
export { TaroElement } from
|
|
14
|
-
export { createEvent, eventHandler, TaroEvent } from
|
|
15
|
-
export { FormElement } from
|
|
16
|
-
export { TaroNode } from
|
|
17
|
-
export { TaroRootElement } from
|
|
18
|
-
export { Style } from
|
|
19
|
-
export { SVGElement } from
|
|
20
|
-
export { TaroText } from
|
|
21
|
-
export { MutationObserver } from
|
|
3
|
+
export { document } from "./bom/document.js";
|
|
4
|
+
export { getComputedStyle } from "./bom/getComputedStyle.js";
|
|
5
|
+
export { History } from "./bom/history.js";
|
|
6
|
+
export { Location } from "./bom/location.js";
|
|
7
|
+
export { nav as navigator } from "./bom/navigator.js";
|
|
8
|
+
export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from "./bom/raf.js";
|
|
9
|
+
export { parseUrl, URL } from "./bom/URL.js";
|
|
10
|
+
export { URLSearchParams } from "./bom/URLSearchParams.js";
|
|
11
|
+
export { history, location, window } from "./bom/window.js";
|
|
12
|
+
export { TaroElement } from "./dom/element.js";
|
|
13
|
+
export { createEvent, eventHandler, TaroEvent } from "./dom/event.js";
|
|
14
|
+
export { FormElement } from "./dom/form.js";
|
|
15
|
+
export { TaroNode } from "./dom/node.js";
|
|
16
|
+
export { TaroRootElement } from "./dom/root.js";
|
|
17
|
+
export { Style } from "./dom/style.js";
|
|
18
|
+
export { SVGElement } from "./dom/svg.js";
|
|
19
|
+
export { TaroText } from "./dom/text.js";
|
|
20
|
+
export { MutationObserver } from "./dom-external/mutation-observer/index.js";
|
|
22
21
|
export { env };
|
|
23
|
-
export * from
|
|
24
|
-
export { Current, getCurrentInstance } from
|
|
25
|
-
export { eventSource } from
|
|
26
|
-
export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from
|
|
27
|
-
export * from
|
|
28
|
-
export { hydrate } from
|
|
29
|
-
export { nextTick } from
|
|
30
|
-
export { options } from
|
|
31
|
-
export { incrementId, isHasExtractProp } from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
22
|
+
export * from "./constants/index.js";
|
|
23
|
+
export { Current, getCurrentInstance } from "./current.js";
|
|
24
|
+
export { eventSource } from "./dom/event-source.js";
|
|
25
|
+
export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from "./dsl/common.js";
|
|
26
|
+
export * from "./emitter/emitter.js";
|
|
27
|
+
export { hydrate } from "./hydrate.js";
|
|
28
|
+
export { nextTick } from "./next-tick.js";
|
|
29
|
+
export { options } from "./options.js";
|
|
30
|
+
export { incrementId, isHasExtractProp } from "./utils/index.js";
|
|
31
|
+
export * from "./instance-0f017c6e.js";
|
|
32
|
+
export * from "./index-26658829.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import './dom-external/index.js';
|
|
2
|
+
export { default as env } from './env.js';
|
|
3
|
+
export { Events, hooks } from '@tarojs/shared';
|
|
4
|
+
export { document } from './bom/document.js';
|
|
5
|
+
export { getComputedStyle } from './bom/getComputedStyle.js';
|
|
6
|
+
export { History } from './bom/history.js';
|
|
7
|
+
export { Location } from './bom/location.js';
|
|
8
|
+
export { nav as navigator } from './bom/navigator.js';
|
|
9
|
+
export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf.js';
|
|
10
|
+
export { URL, parseUrl } from './bom/URL.js';
|
|
11
|
+
export { URLSearchParams } from './bom/URLSearchParams.js';
|
|
12
|
+
export { history, location, window } from './bom/window.js';
|
|
13
|
+
export { TaroElement } from './dom/element.js';
|
|
14
|
+
export { TaroEvent, createEvent, eventHandler } from './dom/event.js';
|
|
15
|
+
export { FormElement } from './dom/form.js';
|
|
16
|
+
export { TaroNode } from './dom/node.js';
|
|
17
|
+
export { TaroRootElement } from './dom/root.js';
|
|
18
|
+
export { Style } from './dom/style.js';
|
|
19
|
+
export { SVGElement } from './dom/svg.js';
|
|
20
|
+
export { TaroText } from './dom/text.js';
|
|
21
|
+
export { MutationObserver } from './dom-external/mutation-observer/index.js';
|
|
22
|
+
export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, COMPILE_MODE, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, HEAD, HOOKS_APP_ID, HTML, ID, INPUT, KEY_CODE, 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, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, UID, VALUE, VIEW } from './constants/index.js';
|
|
23
|
+
export { Current, getCurrentInstance } from './current.js';
|
|
24
|
+
export { eventSource } from './dom/event-source.js';
|
|
25
|
+
export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify } from './dsl/common.js';
|
|
26
|
+
export { eventCenter } from './emitter/emitter.js';
|
|
27
|
+
export { hydrate } from './hydrate.js';
|
|
28
|
+
export { nextTick } from './next-tick.js';
|
|
29
|
+
export { options } from './options.js';
|
|
30
|
+
export { incrementId, isHasExtractProp } from './utils/index.js';
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import VueCtor
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import VueCtor from 'vue';
|
|
2
|
+
import { ComponentOptions, VNode } from "vue";
|
|
3
|
+
import { Component as Vue3Component } from '@vue/runtime-core';
|
|
4
|
+
import { Component, ComponentClass } from 'react';
|
|
5
|
+
import { CombinedVueInstance } from 'vue/types/vue';
|
|
6
|
+
import { TaroElement } from "./dom/element.js";
|
|
7
|
+
import { MpEvent, TFunc } from "./index-26658829.js";
|
|
8
|
+
interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
|
|
8
9
|
tid?: string;
|
|
9
10
|
node?: TaroElement;
|
|
10
11
|
$forceUpdate?(): void;
|
|
11
12
|
$nextTick?(cb: () => void): void;
|
|
12
13
|
$options: Instance;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
interface VueAppInstance extends ComponentOptions<VueCtor> {
|
|
15
16
|
$options: AppInstance;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
|
|
18
19
|
interface VueInternal {
|
|
19
20
|
_render(): VNode;
|
|
20
21
|
_update(vnode: VNode, hyrate: boolean): void;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
interface PageProps {
|
|
23
24
|
tid?: string;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
|
|
28
29
|
componentDidShow?(): void;
|
|
29
30
|
componentDidHide?(): void;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
interface PageLifeCycle extends Show {
|
|
34
35
|
eh?(event: MpEvent): void;
|
|
35
36
|
onAddToFavorites?(): void;
|
|
36
|
-
onLoad?(options: Record<string, unknown>, cb?:
|
|
37
|
+
onLoad?(options: Record<string, unknown>, cb?: TFunc): void;
|
|
37
38
|
onOptionMenuClick?(): void;
|
|
38
39
|
onPageScroll?(obj: {
|
|
39
40
|
scrollTop: number;
|
|
@@ -59,7 +60,7 @@ export interface PageLifeCycle extends Show {
|
|
|
59
60
|
onTitleClick?(): void;
|
|
60
61
|
onUnload?(): void;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
interface PageInstance extends PageLifeCycle {
|
|
63
64
|
/** 页面的初始数据 */
|
|
64
65
|
data?: Record<string, unknown>;
|
|
65
66
|
/** 页面路径 */
|
|
@@ -75,7 +76,7 @@ interface Show {
|
|
|
75
76
|
onShow?(): void;
|
|
76
77
|
onHide?(): void;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
interface AppInstance extends Show {
|
|
79
80
|
componentDidShow?(options?: Record<string, unknown>): void;
|
|
80
81
|
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
|
|
81
82
|
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
|
|
@@ -88,4 +89,4 @@ export interface AppInstance extends Show {
|
|
|
88
89
|
taroGlobalData?: Record<any, any>;
|
|
89
90
|
config?: Record<any, any>;
|
|
90
91
|
}
|
|
91
|
-
export {};
|
|
92
|
+
export { Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance };
|
package/dist/next-tick.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { TFunc } from "./index-26658829.js";
|
|
2
|
+
declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
|
|
3
|
+
export { nextTick };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Current } from './current.js';
|
|
2
|
+
import env from './env.js';
|
|
3
|
+
|
|
4
|
+
const TIMEOUT = 100;
|
|
5
|
+
const nextTick = (cb, ctx) => {
|
|
6
|
+
const beginTime = Date.now();
|
|
7
|
+
const router = Current.router;
|
|
8
|
+
const timerFunc = () => {
|
|
9
|
+
setTimeout(function () {
|
|
10
|
+
ctx ? cb.call(ctx) : cb();
|
|
11
|
+
}, 1);
|
|
12
|
+
};
|
|
13
|
+
if (router === null)
|
|
14
|
+
return timerFunc();
|
|
15
|
+
const path = router.$taroPath;
|
|
16
|
+
/**
|
|
17
|
+
* 三种情况
|
|
18
|
+
* 1. 调用 nextTick 时,pendingUpdate 已经从 true 变为 false(即已更新完成),那么需要光等 100ms
|
|
19
|
+
* 2. 调用 nextTick 时,pendingUpdate 为 true,那么刚好可以搭上便车
|
|
20
|
+
* 3. 调用 nextTick 时,pendingUpdate 还是 false,框架仍未启动更新逻辑,这时最多轮询 100ms,等待 pendingUpdate 变为 true。
|
|
21
|
+
*/
|
|
22
|
+
function next() {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
const pageElement = env.document.getElementById(path);
|
|
25
|
+
if (pageElement === null || pageElement === void 0 ? void 0 : pageElement.pendingUpdate) {
|
|
26
|
+
if (process.env.TARO_PLATFORM === 'web') {
|
|
27
|
+
// eslint-disable-next-line dot-notation
|
|
28
|
+
(_c = (_b = (_a = pageElement.firstChild) === null || _a === void 0 ? void 0 : _a['componentOnReady']) === null || _b === void 0 ? void 0 : _b.call(_a).then(() => {
|
|
29
|
+
timerFunc();
|
|
30
|
+
})) !== null && _c !== void 0 ? _c : timerFunc();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
pageElement.enqueueUpdateCallback(cb, ctx);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (Date.now() - beginTime > TIMEOUT) {
|
|
37
|
+
timerFunc();
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
setTimeout(() => next(), 20);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
next();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { nextTick };
|
|
47
|
+
//# sourceMappingURL=next-tick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-tick.js","sources":["../src/next-tick.ts"],"sourcesContent":["import { Current } from './current'\nimport { TaroRootElement } from './dom/root'\nimport env from './env'\n\nimport type { TFunc } from './interface'\n\nconst TIMEOUT = 100\n\nexport const nextTick = (cb: TFunc, ctx?: Record<string, any>) => {\n const beginTime = Date.now()\n const router = Current.router\n\n const timerFunc = () => {\n setTimeout(function () {\n ctx ? cb.call(ctx) : cb()\n }, 1)\n }\n\n if (router === null) return timerFunc()\n\n const path = router.$taroPath\n\n /**\n * 三种情况\n * 1. 调用 nextTick 时,pendingUpdate 已经从 true 变为 false(即已更新完成),那么需要光等 100ms\n * 2. 调用 nextTick 时,pendingUpdate 为 true,那么刚好可以搭上便车\n * 3. 调用 nextTick 时,pendingUpdate 还是 false,框架仍未启动更新逻辑,这时最多轮询 100ms,等待 pendingUpdate 变为 true。\n */\n function next () {\n const pageElement: TaroRootElement | null = env.document.getElementById<TaroRootElement>(path)\n if (pageElement?.pendingUpdate) {\n if (process.env.TARO_PLATFORM === 'web') {\n // eslint-disable-next-line dot-notation\n pageElement.firstChild?.['componentOnReady']?.().then(() => {\n timerFunc()\n }) ?? timerFunc()\n } else {\n pageElement.enqueueUpdateCallback(cb, ctx)\n }\n } else if (Date.now() - beginTime > TIMEOUT) {\n timerFunc()\n } else {\n setTimeout(() => next(), 20)\n }\n }\n\n next()\n}\n"],"names":[],"mappings":";;;AAMA,MAAM,OAAO,GAAG,GAAG,CAAA;MAEN,QAAQ,GAAG,CAAC,EAAS,EAAE,GAAyB,KAAI;AAC/D,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;AAC5B,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAE7B,MAAM,SAAS,GAAG,MAAK;AACrB,QAAA,UAAU,CAAC,YAAA;AACT,YAAA,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAA;SAC1B,EAAE,CAAC,CAAC,CAAA;AACP,KAAC,CAAA;IAED,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,EAAE,CAAA;AAEvC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAA;AAE7B;;;;;AAKG;AACH,IAAA,SAAS,IAAI,GAAA;;QACX,MAAM,WAAW,GAA2B,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAkB,IAAI,CAAC,CAAA;AAC9F,QAAA,IAAI,WAAW,KAAX,IAAA,IAAA,WAAW,uBAAX,WAAW,CAAE,aAAa,EAAE;AAC9B,YAAA,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,KAAK,EAAE;;AAEvC,gBAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,WAAW,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,kBAAkB,CAAC,MAAK,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA,IAAI,CAAC,MAAK;AACzD,oBAAA,SAAS,EAAE,CAAA;AACb,iBAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,SAAS,EAAE,CAAA;AAClB,aAAA;AAAM,iBAAA;AACL,gBAAA,WAAW,CAAC,qBAAqB,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;AAC3C,aAAA;AACF,SAAA;aAAM,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE;AAC3C,YAAA,SAAS,EAAE,CAAA;AACZ,SAAA;AAAM,aAAA;YACL,UAAU,CAAC,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;AAC7B,SAAA;KACF;AAED,IAAA,IAAI,EAAE,CAAA;AACR;;;;"}
|
package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise */
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
19
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
20
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
21
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
25
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
26
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
27
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
28
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { __classPrivateFieldGet, __classPrivateFieldSet };
|
|
32
|
+
//# sourceMappingURL=tslib.es6.js.map
|
package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@2.5.0/node_modules/tslib/tslib.es6.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tslib.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare const enum NodeType {
|
|
2
2
|
ELEMENT_NODE = 1,
|
|
3
3
|
ATTRIBUTE_NODE = 2,
|
|
4
4
|
TEXT_NODE = 3,
|
|
@@ -8,3 +8,4 @@ export declare const enum NodeType {
|
|
|
8
8
|
PROCESSING_INSTRUCTION_NODE = 7,
|
|
9
9
|
DOCUMENT_NODE = 9
|
|
10
10
|
}
|
|
11
|
+
export { NodeType };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { TaroElement } from "./dom/element.js";
|
|
2
|
+
import { TaroText } from "./dom/text.js";
|
|
3
|
+
import { Element, Text } from "./dom-external/inner-html/parser.js";
|
|
4
|
+
interface Options {
|
|
5
5
|
prerender: boolean;
|
|
6
6
|
debug: boolean;
|
|
7
7
|
html?: {
|
|
@@ -14,3 +14,4 @@ export interface Options {
|
|
|
14
14
|
};
|
|
15
15
|
miniGlobal?: any;
|
|
16
16
|
}
|
|
17
|
+
export { Options };
|
package/dist/options.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Options } from "./index-26658829.js";
|
|
2
|
+
declare const options: Options;
|
|
3
|
+
export { options };
|
package/dist/options.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sources":["../src/options.ts"],"sourcesContent":["import type { Options } from './interface'\n\nexport const options: Options = {\n prerender: true,\n debug: false\n}\n"],"names":[],"mappings":"AAEa,MAAA,OAAO,GAAY;AAC9B,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,KAAK,EAAE,KAAK;;;;;"}
|
package/dist/perf.d.ts
CHANGED
package/dist/perf.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { options } from './options.js';
|
|
2
|
+
|
|
3
|
+
class Performance {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.recorder = new Map();
|
|
6
|
+
}
|
|
7
|
+
start(id) {
|
|
8
|
+
if (!options.debug) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
this.recorder.set(id, Date.now());
|
|
12
|
+
}
|
|
13
|
+
stop(id) {
|
|
14
|
+
if (!options.debug) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
const prev = this.recorder.get(id);
|
|
19
|
+
this.recorder.delete(id);
|
|
20
|
+
const time = now - prev;
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.log(`${id} 时长: ${time}ms`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const perf = new Performance();
|
|
26
|
+
|
|
27
|
+
export { perf };
|
|
28
|
+
//# sourceMappingURL=perf.js.map
|
package/dist/perf.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perf.js","sources":["../src/perf.ts"],"sourcesContent":["import { options } from './options'\n\nclass Performance {\n private recorder = new Map<string, number>()\n\n public start (id: string) {\n if (!options.debug) {\n return\n }\n this.recorder.set(id, Date.now())\n }\n\n public stop (id: string) {\n if (!options.debug) {\n return\n }\n const now = Date.now()\n const prev = this.recorder.get(id)!\n this.recorder.delete(id)\n const time = now - prev\n // eslint-disable-next-line no-console\n console.log(`${id} 时长: ${time}ms`)\n }\n}\n\nexport const perf = new Performance()\n"],"names":[],"mappings":";;AAEA,MAAM,WAAW,CAAA;AAAjB,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;KAoB7C;AAlBQ,IAAA,KAAK,CAAE,EAAU,EAAA;AACtB,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AACD,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;KAClC;AAEM,IAAA,IAAI,CAAE,EAAU,EAAA;AACrB,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YAClB,OAAM;AACP,SAAA;AACD,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAE,CAAA;AACnC,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,QAAA,MAAM,IAAI,GAAG,GAAG,GAAG,IAAI,CAAA;;QAEvB,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,EAAE,CAAQ,KAAA,EAAA,IAAI,CAAI,EAAA,CAAA,CAAC,CAAA;KACnC;AACF,CAAA;AAEY,MAAA,IAAI,GAAG,IAAI,WAAW;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TaroNode } from "./dom/node.js";
|
|
2
2
|
/**
|
|
3
3
|
* A MutationRecord represents an individual DOM mutation.
|
|
4
4
|
* It is the object that is passed to MutationObserver's callback.
|
|
5
5
|
* @see https://dom.spec.whatwg.org/#interface-mutationrecord
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
interface MutationRecord {
|
|
9
9
|
readonly target: TaroNode;
|
|
10
10
|
readonly addedNodes?: TaroNode[];
|
|
11
11
|
readonly removedNodes?: TaroNode[];
|
|
@@ -17,8 +17,9 @@ export interface MutationRecord {
|
|
|
17
17
|
readonly type: MutationRecordType;
|
|
18
18
|
readonly value?: string | null;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
declare const enum MutationRecordType {
|
|
21
21
|
ATTRIBUTES = "attributes",
|
|
22
22
|
CHARACTER_DATA = "characterData",
|
|
23
23
|
CHILD_LIST = "childList"
|
|
24
24
|
}
|
|
25
|
+
export { MutationRecord, MutationRecordType };
|