@tarojs/runtime 4.0.1 → 4.0.3-alpha.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.
- package/LICENSE +8 -8
- package/dist/bom/URL.d.ts +2 -2
- package/dist/bom/URL.js +3 -2
- package/dist/bom/URL.js.map +1 -1
- package/dist/bom/URLSearchParams.js.map +1 -1
- package/dist/bom/document.d.ts +2 -2
- package/dist/bom/document.js +3 -2
- package/dist/bom/document.js.map +1 -1
- package/dist/bom/getComputedStyle.d.ts +2 -2
- package/dist/bom/getComputedStyle.js +3 -2
- package/dist/bom/getComputedStyle.js.map +1 -1
- package/dist/bom/history.js.map +1 -1
- package/dist/bom/location.js +3 -3
- package/dist/bom/location.js.map +1 -1
- package/dist/bom/raf.d.ts +1 -0
- package/dist/bom/raf.js +2 -2
- package/dist/bom/raf.js.map +1 -1
- package/dist/bom/window.d.ts +5 -4
- package/dist/bom/window.js +7 -6
- package/dist/bom/window.js.map +1 -1
- package/dist/current.d.ts +1 -1
- package/dist/dom/anchor-element.js.map +1 -1
- package/dist/dom/class-list.js.map +1 -1
- package/dist/dom/document.js.map +1 -1
- package/dist/dom/element.js +0 -3
- package/dist/dom/element.js.map +1 -1
- package/dist/dom/event-target.js.map +1 -1
- package/dist/dom/event.js.map +1 -1
- package/dist/dom/form.js +1 -1
- package/dist/dom/form.js.map +1 -1
- package/dist/dom/node.js +2 -2
- package/dist/dom/node.js.map +1 -1
- package/dist/dom/root.js.map +1 -1
- package/dist/dom/style.js.map +1 -1
- package/dist/dom/style_properties.js.map +1 -1
- package/dist/dom/tree.js.map +1 -1
- package/dist/dom-external/element.js.map +1 -1
- package/dist/dom-external/index.js +1 -1
- package/dist/dom-external/index.js.map +1 -1
- package/dist/dom-external/inner-html/html.js.map +1 -1
- package/dist/dom-external/inner-html/parser.js.map +1 -1
- package/dist/dom-external/inner-html/scaner.js.map +1 -1
- package/dist/dom-external/inner-html/style.js.map +1 -1
- package/dist/dom-external/inner-html/tags.js +4 -4
- package/dist/dom-external/inner-html/tags.js.map +1 -1
- package/dist/dom-external/inner-html/utils.js.map +1 -1
- package/dist/dom-external/mutation-observer/implements.js.map +1 -1
- package/dist/dom-external/mutation-observer/index.js.map +1 -1
- package/dist/dom-external/node.js.map +1 -1
- package/dist/dsl/common.d.ts +2 -1
- package/dist/dsl/common.js +5 -5
- package/dist/dsl/common.js.map +1 -1
- package/dist/hydrate.js.map +1 -1
- package/dist/index.cjs.d.ts +44 -22
- package/dist/index.cjs.js +3329 -3287
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{instance-0f017c6e.d.ts → instance-4c64b022.d.ts} +4 -14
- package/dist/next-tick.js.map +1 -1
- package/dist/perf.d.ts +3 -1
- package/dist/perf.js +24 -3
- package/dist/perf.js.map +1 -1
- package/dist/polyfill/array.js.map +1 -1
- package/dist/polyfill/index.js.map +1 -1
- package/dist/polyfill/intersection-observer.js +4 -3
- package/dist/polyfill/intersection-observer.js.map +1 -1
- package/dist/polyfill/object.js.map +1 -1
- package/dist/runtime.esm.d.ts +44 -22
- package/dist/runtime.esm.js +3312 -3282
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lodash.d.ts +2 -1
- package/dist/utils/lodash.js +11 -1
- package/dist/utils/lodash.js.map +1 -1
- package/dist/utils/router.js +3 -3
- package/dist/utils/router.js.map +1 -1
- package/package.json +16 -24
- /package/dist/{options-0f017c6e.d.ts → options-4c64b022.d.ts} +0 -0
package/dist/runtime.esm.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="react" />
|
|
1
3
|
import { Shortcuts, Events } from "@tarojs/shared";
|
|
2
|
-
import VueCtor from "vue";
|
|
3
|
-
import { ComponentOptions, VNode } from "vue";
|
|
4
4
|
import { Component as Vue3Component } from "@vue/runtime-core";
|
|
5
5
|
import { Component, ComponentClass } from "react";
|
|
6
|
-
import { CombinedVueInstance } from "vue/types/vue";
|
|
7
6
|
declare class ClassList {
|
|
8
7
|
private el;
|
|
9
8
|
private tokenList;
|
|
@@ -44,8 +43,8 @@ interface AddEventListenerOptions extends EventListenerOptions {
|
|
|
44
43
|
once?: boolean;
|
|
45
44
|
passive?: boolean;
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
interface EventHandler<T = any, R = void> {
|
|
47
|
+
(...args: T[]): R;
|
|
49
48
|
_stop?: boolean;
|
|
50
49
|
}
|
|
51
50
|
// Note: @tarojs/runtime 不依赖 @tarojs/taro, 所以不能改为从 @tarojs/taro 引入 (可能导致循环依赖)
|
|
@@ -331,9 +330,11 @@ interface Env {
|
|
|
331
330
|
document: TaroDocument;
|
|
332
331
|
}
|
|
333
332
|
declare const env: Env;
|
|
334
|
-
|
|
333
|
+
// Note: 小程序端 vite 打包成 commonjs,const document = xxx 会报错,所以把 document 改为 taroDocumentProvider
|
|
334
|
+
declare const taroDocumentProvider: TaroDocument;
|
|
335
335
|
type TGetComputedStyle = typeof window.getComputedStyle | ((el: TaroElement) => Style);
|
|
336
|
-
|
|
336
|
+
// Note: 小程序端 vite 打包成 commonjs,const getComputedStyle = xxx 会报错,所以把 GetComputedStyle 改为 taroGetComputedStyleProvider
|
|
337
|
+
declare const taroGetComputedStyleProvider: TGetComputedStyle;
|
|
337
338
|
declare const eventCenter: Events;
|
|
338
339
|
type EventsType = typeof Events;
|
|
339
340
|
/**
|
|
@@ -463,7 +464,8 @@ declare class TaroURL {
|
|
|
463
464
|
href: string;
|
|
464
465
|
};
|
|
465
466
|
}
|
|
466
|
-
|
|
467
|
+
// Note: 小程序端 vite 打包成 commonjs,const URL = xxx 会报错,所以把 URL 改为 TaroURLProvider
|
|
468
|
+
declare const TaroURLProvider: typeof TaroURL;
|
|
467
469
|
declare function parseUrl(url?: string): {
|
|
468
470
|
href: string;
|
|
469
471
|
origin: string;
|
|
@@ -493,9 +495,10 @@ declare class TaroWindow extends Events {
|
|
|
493
495
|
setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
|
|
494
496
|
clearTimeout(...args: Parameters<typeof clearTimeout>): void;
|
|
495
497
|
}
|
|
496
|
-
|
|
497
|
-
declare const
|
|
498
|
-
declare const
|
|
498
|
+
// Note: 小程序端 vite 打包成 commonjs,const window = xxx 会报错,所以把 window 改为 taroWindowProvider,location 和 history 同理
|
|
499
|
+
declare const taroWindowProvider: TaroWindow;
|
|
500
|
+
declare const taroLocationProvider: TaroLocation;
|
|
501
|
+
declare const taroHistoryProvider: TaroHistory;
|
|
499
502
|
// for Vue3
|
|
500
503
|
declare class SVGElement extends TaroElement {
|
|
501
504
|
}
|
|
@@ -649,14 +652,6 @@ interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInst
|
|
|
649
652
|
$nextTick?(cb: () => void): void;
|
|
650
653
|
$options: Instance;
|
|
651
654
|
}
|
|
652
|
-
interface VueAppInstance extends ComponentOptions<VueCtor> {
|
|
653
|
-
$options: AppInstance;
|
|
654
|
-
}
|
|
655
|
-
type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
|
|
656
|
-
interface VueInternal {
|
|
657
|
-
_render(): VNode;
|
|
658
|
-
_update(vnode: VNode, hyrate: boolean): void;
|
|
659
|
-
}
|
|
660
655
|
interface PageProps {
|
|
661
656
|
tid?: string;
|
|
662
657
|
}
|
|
@@ -717,8 +712,8 @@ interface Show {
|
|
|
717
712
|
}
|
|
718
713
|
interface AppInstance extends Show {
|
|
719
714
|
componentDidShow?(options?: Record<string, unknown>): void;
|
|
720
|
-
mount?(component: React.ComponentClass |
|
|
721
|
-
mount?(component: React.ComponentClass |
|
|
715
|
+
mount?(component: React.ComponentClass | Vue3Component, id: string, cb: (...args: any[]) => void): void;
|
|
716
|
+
mount?(component: React.ComponentClass | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
|
|
722
717
|
onError?(error: string): void;
|
|
723
718
|
onLaunch?(options?: Record<string, unknown>): void;
|
|
724
719
|
onPageNotFound?(res: any): void;
|
|
@@ -772,8 +767,35 @@ declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
|
772
767
|
declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
773
768
|
declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
|
|
774
769
|
declare const options: Options;
|
|
770
|
+
declare class Performance {
|
|
771
|
+
#private;
|
|
772
|
+
private recorder;
|
|
773
|
+
start(id: string): void;
|
|
774
|
+
stop(id: string, now?: number): void;
|
|
775
|
+
delayStop(id: string, delay?: number): ((...args: any[]) => void) | undefined;
|
|
776
|
+
}
|
|
777
|
+
declare const perf: Performance;
|
|
775
778
|
declare const incrementId: () => () => string;
|
|
779
|
+
declare function isElement(node: TaroNode): node is TaroElement;
|
|
780
|
+
declare function isText(node: TaroNode): node is TaroText;
|
|
781
|
+
declare function isComment(node: TaroNode): boolean;
|
|
776
782
|
declare function isHasExtractProp(el: TaroElement): boolean;
|
|
783
|
+
/**
|
|
784
|
+
* 往上寻找组件树直到 root,寻找是否有祖先组件绑定了同类型的事件
|
|
785
|
+
* @param node 当前组件
|
|
786
|
+
* @param type 事件类型
|
|
787
|
+
*/
|
|
788
|
+
declare function isParentBinded(node: TaroElement | null, type: string): boolean;
|
|
789
|
+
declare function shortcutAttr(key: string): string;
|
|
790
|
+
declare const customWrapperCache: Map<string, Record<string, any>>;
|
|
791
|
+
interface Ctor {
|
|
792
|
+
new (...args: any[]): any;
|
|
793
|
+
}
|
|
794
|
+
declare function extend(ctor: Ctor, methodName: string, options: TFunc | Record<string, any>): void;
|
|
795
|
+
declare function getComponentsAlias(): any;
|
|
796
|
+
declare function convertNumber2PX(value: number): string;
|
|
797
|
+
declare function throttle(fn: any, threshold?: number, scope?: any): (...args: any[]) => void;
|
|
798
|
+
declare function debounce(fn: any, ms?: number, scope?: any): (...args: any[]) => void;
|
|
777
799
|
// export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
|
|
778
800
|
// export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
|
|
779
801
|
declare const addLeadingSlash: (url?: string) => string;
|
|
@@ -785,4 +807,4 @@ declare const getHomePage: (path?: string, basename?: string, customRoutes?: Rec
|
|
|
785
807
|
declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
|
|
786
808
|
declare function handlePolyfill(): void;
|
|
787
809
|
export { hooks } from '@tarojs/shared';
|
|
788
|
-
export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, isHasExtractProp, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance,
|
|
810
|
+
export { taroDocumentProvider as document, taroGetComputedStyleProvider as getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, TaroURLProvider as URL, URLSearchParams, taroHistoryProvider as history, taroLocationProvider as location, taroWindowProvider as window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, perf, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, debounce, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
|