@tarojs/runtime 4.0.1-alpha.1 → 4.0.1
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 +2 -3
- 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 +2 -3
- package/dist/bom/document.js.map +1 -1
- package/dist/bom/getComputedStyle.d.ts +2 -2
- package/dist/bom/getComputedStyle.js +2 -3
- 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 +0 -1
- package/dist/bom/raf.js +2 -2
- package/dist/bom/raf.js.map +1 -1
- package/dist/bom/window.d.ts +4 -5
- package/dist/bom/window.js +6 -7
- 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 +3 -0
- 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 +1 -2
- 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 +22 -44
- package/dist/index.cjs.js +3321 -3363
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/{instance-4c64b022.d.ts → instance-0f017c6e.d.ts} +14 -4
- package/dist/next-tick.js.map +1 -1
- package/dist/perf.d.ts +1 -3
- package/dist/perf.js +3 -24
- 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 +3 -4
- package/dist/polyfill/intersection-observer.js.map +1 -1
- package/dist/polyfill/object.js.map +1 -1
- package/dist/runtime.esm.d.ts +22 -44
- package/dist/runtime.esm.js +3316 -3346
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/cache.js.map +1 -1
- package/dist/utils/index.d.ts +1 -3
- package/dist/utils/index.js +1 -5
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/lodash.d.ts +1 -2
- package/dist/utils/lodash.js +1 -11
- 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 +24 -16
- /package/dist/{options-4c64b022.d.ts → options-0f017c6e.d.ts} +0 -0
package/dist/runtime.esm.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
1
|
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";
|
|
6
7
|
declare class ClassList {
|
|
7
8
|
private el;
|
|
8
9
|
private tokenList;
|
|
@@ -43,8 +44,8 @@ interface AddEventListenerOptions extends EventListenerOptions {
|
|
|
43
44
|
once?: boolean;
|
|
44
45
|
passive?: boolean;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
48
|
+
interface EventHandler extends Function {
|
|
48
49
|
_stop?: boolean;
|
|
49
50
|
}
|
|
50
51
|
// Note: @tarojs/runtime 不依赖 @tarojs/taro, 所以不能改为从 @tarojs/taro 引入 (可能导致循环依赖)
|
|
@@ -330,11 +331,9 @@ interface Env {
|
|
|
330
331
|
document: TaroDocument;
|
|
331
332
|
}
|
|
332
333
|
declare const env: Env;
|
|
333
|
-
|
|
334
|
-
declare const taroDocumentProvider: TaroDocument;
|
|
334
|
+
declare const document: TaroDocument;
|
|
335
335
|
type TGetComputedStyle = typeof window.getComputedStyle | ((el: TaroElement) => Style);
|
|
336
|
-
|
|
337
|
-
declare const taroGetComputedStyleProvider: TGetComputedStyle;
|
|
336
|
+
declare const getComputedStyle: TGetComputedStyle;
|
|
338
337
|
declare const eventCenter: Events;
|
|
339
338
|
type EventsType = typeof Events;
|
|
340
339
|
/**
|
|
@@ -464,8 +463,7 @@ declare class TaroURL {
|
|
|
464
463
|
href: string;
|
|
465
464
|
};
|
|
466
465
|
}
|
|
467
|
-
|
|
468
|
-
declare const TaroURLProvider: typeof TaroURL;
|
|
466
|
+
declare const URL: typeof TaroURL;
|
|
469
467
|
declare function parseUrl(url?: string): {
|
|
470
468
|
href: string;
|
|
471
469
|
origin: string;
|
|
@@ -495,10 +493,9 @@ declare class TaroWindow extends Events {
|
|
|
495
493
|
setTimeout(...args: Parameters<typeof setTimeout>): NodeJS.Timeout;
|
|
496
494
|
clearTimeout(...args: Parameters<typeof clearTimeout>): void;
|
|
497
495
|
}
|
|
498
|
-
|
|
499
|
-
declare const
|
|
500
|
-
declare const
|
|
501
|
-
declare const taroHistoryProvider: TaroHistory;
|
|
496
|
+
declare const window: TaroWindow;
|
|
497
|
+
declare const location: TaroLocation;
|
|
498
|
+
declare const history: TaroHistory;
|
|
502
499
|
// for Vue3
|
|
503
500
|
declare class SVGElement extends TaroElement {
|
|
504
501
|
}
|
|
@@ -652,6 +649,14 @@ interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInst
|
|
|
652
649
|
$nextTick?(cb: () => void): void;
|
|
653
650
|
$options: Instance;
|
|
654
651
|
}
|
|
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
|
+
}
|
|
655
660
|
interface PageProps {
|
|
656
661
|
tid?: string;
|
|
657
662
|
}
|
|
@@ -712,8 +717,8 @@ interface Show {
|
|
|
712
717
|
}
|
|
713
718
|
interface AppInstance extends Show {
|
|
714
719
|
componentDidShow?(options?: Record<string, unknown>): void;
|
|
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;
|
|
720
|
+
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, cb: (...args: any[]) => void): void;
|
|
721
|
+
mount?(component: React.ComponentClass | ComponentOptions<VueCtor> | Vue3Component, id: string, getCtx: (...args: any[]) => void, cb: (...args: any[]) => void): void;
|
|
717
722
|
onError?(error: string): void;
|
|
718
723
|
onLaunch?(options?: Record<string, unknown>): void;
|
|
719
724
|
onPageNotFound?(res: any): void;
|
|
@@ -767,35 +772,8 @@ declare function createRecursiveComponentConfig(componentName?: string): any;
|
|
|
767
772
|
declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
768
773
|
declare const nextTick: (cb: TFunc, ctx?: Record<string, any>) => void;
|
|
769
774
|
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;
|
|
778
775
|
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;
|
|
782
776
|
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;
|
|
799
777
|
// export const removeLeadingSlash = (str = '') => str.replace(/^\.?\//, '')
|
|
800
778
|
// export const removeTrailingSearch = (str = '') => str.replace(/\?[\s\S]*$/, '')
|
|
801
779
|
declare const addLeadingSlash: (url?: string) => string;
|
|
@@ -807,4 +785,4 @@ declare const getHomePage: (path?: string, basename?: string, customRoutes?: Rec
|
|
|
807
785
|
declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
|
|
808
786
|
declare function handlePolyfill(): void;
|
|
809
787
|
export { hooks } from '@tarojs/shared';
|
|
810
|
-
export {
|
|
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, VueAppInstance, VueInstance, 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 };
|