@tarojs/shared 3.5.0-beta.4 → 3.5.0-theta.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/dist/index.d.ts +252 -7
- package/dist/index.js +1135 -1135
- package/dist/index.js.map +1 -1
- package/dist/shared.esm.d.ts +252 -0
- package/dist/shared.esm.js +1123 -1123
- package/dist/shared.esm.js.map +1 -1
- package/dist/template.d.ts +112 -113
- package/dist/template.js +1103 -1103
- package/package.json +2 -3
- package/LICENSE +0 -21
- package/dist/components.d.ts +0 -20
- package/dist/event-emitter.d.ts +0 -27
- package/dist/is.d.ts +0 -9
- package/dist/native-apis.d.ts +0 -16
- package/dist/runtime-hooks.d.ts +0 -119
- package/dist/shortcuts.d.ts +0 -10
- package/dist/utils.d.ts +0 -54
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/shared",
|
|
3
|
-
"version": "3.5.0-
|
|
3
|
+
"version": "3.5.0-theta.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "yuche <i@yuche.me>",
|
|
6
6
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/shared#readme",
|
|
@@ -24,6 +24,5 @@
|
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|
|
27
|
-
}
|
|
28
|
-
"gitHead": "7aca7841ed7e2af1b182ff5d24e91f44730ce783"
|
|
27
|
+
}
|
|
29
28
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/components.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const touchEvents: {
|
|
2
|
-
bindTouchStart: string;
|
|
3
|
-
bindTouchMove: string;
|
|
4
|
-
bindTouchEnd: string;
|
|
5
|
-
bindTouchCancel: string;
|
|
6
|
-
bindLongTap: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const animation: {
|
|
9
|
-
animation: string;
|
|
10
|
-
bindAnimationStart: string;
|
|
11
|
-
bindAnimationIteration: string;
|
|
12
|
-
bindAnimationEnd: string;
|
|
13
|
-
bindTransitionEnd: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function singleQuote(s: string): string;
|
|
16
|
-
export declare const internalComponents: Record<string, Record<string, string>>;
|
|
17
|
-
export declare const controlledComponent: Set<string>;
|
|
18
|
-
export declare const focusComponents: Set<string>;
|
|
19
|
-
export declare const voidElements: Set<string>;
|
|
20
|
-
export declare const nestElements: Map<string, number>;
|
package/dist/event-emitter.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare type Callback1<T1> = (arg1: T1) => any;
|
|
2
|
-
declare type Callback2<T1, T2> = (arg1: T1, arg2: T2) => any;
|
|
3
|
-
declare type Callback3<T1, T2, T3> = (arg1: T1, arg2: T2, arg3: T3) => any;
|
|
4
|
-
declare type Callback4<T1, T2, T3, T4> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => any;
|
|
5
|
-
declare type Callback5<T1, T2, T3, T4, T5> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => any;
|
|
6
|
-
declare type Callback6Rest<T1, T2, T3, T4, T5, T6> = (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, ...rest: any[]) => any;
|
|
7
|
-
export declare class Events {
|
|
8
|
-
protected callbacks?: Record<string, unknown>;
|
|
9
|
-
static eventSplitter: RegExp;
|
|
10
|
-
constructor(opts?: any);
|
|
11
|
-
on<T>(event: string, callback: Callback1<T>, context?: any): this;
|
|
12
|
-
on<T1, T2>(event: string, callback: Callback2<T1, T2>, context?: any): this;
|
|
13
|
-
on<T1, T2, T3>(event: string, callback: Callback3<T1, T2, T3>, context?: any): this;
|
|
14
|
-
on<T1, T2, T3, T4>(event: string, callback: Callback4<T1, T2, T3, T4>, comtext: any): this;
|
|
15
|
-
on<T1, T2, T3, T4, T5>(event: string, callback: Callback5<T1, T2, T3, T4, T5>, context?: any): this;
|
|
16
|
-
on<T1, T2, T3, T4, T5, T6>(event: string, callback: Callback6Rest<T1, T2, T3, T4, T5, T6>, context?: any): this;
|
|
17
|
-
once(events: any, callback: any, context: any): this;
|
|
18
|
-
off(events: any, callback?: any, context?: any): this;
|
|
19
|
-
trigger(event: string): any;
|
|
20
|
-
trigger<T1>(event: string, arg: T1): any;
|
|
21
|
-
trigger<T1, T2>(event: string, arg1: T1, arg2: T2): any;
|
|
22
|
-
trigger<T1, T2, T3>(event: string, arg1: T1, arg2: T2, arg3: T3): any;
|
|
23
|
-
trigger<T1, T2, T3, T4>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4): any;
|
|
24
|
-
trigger<T1, T2, T3, T4, T5>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): any;
|
|
25
|
-
trigger<T1, T2, T3, T4, T5, T6>(event: string, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, ...rest: any[]): any;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
package/dist/is.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare function isString(o: unknown): o is string;
|
|
2
|
-
export declare function isUndefined(o: unknown): o is undefined;
|
|
3
|
-
export declare function isNull(o: unknown): o is null;
|
|
4
|
-
export declare function isObject<T>(o: unknown): o is T;
|
|
5
|
-
export declare function isBoolean(o: unknown): o is boolean;
|
|
6
|
-
export declare function isFunction(o: unknown): o is (...args: any[]) => any;
|
|
7
|
-
export declare function isNumber(o: unknown): o is number;
|
|
8
|
-
export declare function isBooleanStringLiteral(o: unknown): o is string;
|
|
9
|
-
export declare const isArray: (arg: any) => arg is any[];
|
package/dist/native-apis.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare type IObject = Record<string, any>;
|
|
2
|
-
interface IProcessApisIOptions {
|
|
3
|
-
noPromiseApis?: Set<string>;
|
|
4
|
-
needPromiseApis?: Set<string>;
|
|
5
|
-
handleSyncApis?: (key: string, global: IObject, args: any[]) => any;
|
|
6
|
-
transformMeta?: (key: string, options: IObject) => {
|
|
7
|
-
key: string;
|
|
8
|
-
options: IObject;
|
|
9
|
-
};
|
|
10
|
-
modifyApis?: (apis: Set<string>) => void;
|
|
11
|
-
modifyAsyncResult?: (key: string, res: any) => void;
|
|
12
|
-
isOnlyPromisify?: boolean;
|
|
13
|
-
[propName: string]: any;
|
|
14
|
-
}
|
|
15
|
-
declare function processApis(taro: any, global: any, config?: IProcessApisIOptions): void;
|
|
16
|
-
export { processApis };
|
package/dist/runtime-hooks.d.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Events } from './event-emitter';
|
|
2
|
-
import type { Shortcuts } from './template';
|
|
3
|
-
declare type Func = (...args: any[]) => any;
|
|
4
|
-
export declare enum HOOK_TYPE {
|
|
5
|
-
SINGLE = 0,
|
|
6
|
-
MULTI = 1,
|
|
7
|
-
WATERFALL = 2
|
|
8
|
-
}
|
|
9
|
-
interface Hook {
|
|
10
|
-
type: HOOK_TYPE;
|
|
11
|
-
initial?: Func | null;
|
|
12
|
-
}
|
|
13
|
-
interface MiniLifecycle {
|
|
14
|
-
app: [
|
|
15
|
-
string,
|
|
16
|
-
string,
|
|
17
|
-
string /** onHide */
|
|
18
|
-
];
|
|
19
|
-
page: [
|
|
20
|
-
string,
|
|
21
|
-
string,
|
|
22
|
-
string,
|
|
23
|
-
string,
|
|
24
|
-
string,
|
|
25
|
-
string[] /** others */
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
interface MiniElementData {
|
|
29
|
-
[Shortcuts.Childnodes]?: MiniData[];
|
|
30
|
-
[Shortcuts.NodeName]: string;
|
|
31
|
-
[Shortcuts.Class]?: string;
|
|
32
|
-
[Shortcuts.Style]?: string;
|
|
33
|
-
uid?: string;
|
|
34
|
-
sid: string;
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
}
|
|
37
|
-
interface MiniTextData {
|
|
38
|
-
[Shortcuts.Text]: string;
|
|
39
|
-
[Shortcuts.NodeName]: string;
|
|
40
|
-
}
|
|
41
|
-
declare type MiniData = MiniElementData | MiniTextData;
|
|
42
|
-
interface UpdatePayload {
|
|
43
|
-
path: string;
|
|
44
|
-
value: string | boolean | (() => MiniData | MiniData[]);
|
|
45
|
-
}
|
|
46
|
-
declare type Target = Record<string, unknown> & {
|
|
47
|
-
dataset: Record<string, unknown>;
|
|
48
|
-
id: string;
|
|
49
|
-
};
|
|
50
|
-
interface MpEvent {
|
|
51
|
-
type: string;
|
|
52
|
-
detail: Record<string, unknown>;
|
|
53
|
-
target: Target;
|
|
54
|
-
currentTarget: Target;
|
|
55
|
-
}
|
|
56
|
-
export declare function TaroHook(type: HOOK_TYPE, initial?: Func): Hook;
|
|
57
|
-
export declare class TaroHooks<T extends Record<string, Func> = any> extends Events {
|
|
58
|
-
hooks: Record<keyof T, Hook>;
|
|
59
|
-
constructor(hooks: Record<keyof T, Hook>, opts?: any);
|
|
60
|
-
private tapOneOrMany;
|
|
61
|
-
tap<K extends Extract<keyof T, string>>(hookName: K, callback: T[K] | T[K][]): void;
|
|
62
|
-
call<K extends Extract<keyof T, string>>(hookName: K, ...rest: Parameters<T[K]>): ReturnType<T[K]> | undefined;
|
|
63
|
-
isExist(hookName: string): boolean;
|
|
64
|
-
}
|
|
65
|
-
declare type ITaroHooks = {
|
|
66
|
-
/** 小程序端 App、Page 构造对象的生命周期方法名称 */
|
|
67
|
-
getMiniLifecycle: (defaultConfig: MiniLifecycle) => MiniLifecycle;
|
|
68
|
-
getMiniLifecycleImpl: () => MiniLifecycle;
|
|
69
|
-
/** 解决 React 生命周期名称的兼容问题 */
|
|
70
|
-
getLifecycle: (instance: any, lifecyle: any) => Func | Array<Func> | undefined;
|
|
71
|
-
/** 解决百度小程序的模版语法问题 */
|
|
72
|
-
getPathIndex: (indexOfNode: number) => string;
|
|
73
|
-
/** 解决支付宝小程序分包时全局作用域不一致的问题 */
|
|
74
|
-
getEventCenter: (EventsClass: typeof Events) => Events;
|
|
75
|
-
isBubbleEvents: (eventName: string) => boolean;
|
|
76
|
-
getSpecialNodes: () => string[];
|
|
77
|
-
/** 解决 Vue2 布尔值属性值的设置问题 */
|
|
78
|
-
onRemoveAttribute: (element: any, qualifiedName: string) => boolean;
|
|
79
|
-
/** 用于把 React 同一事件回调中的所有 setState 合并到同一个更新处理中 */
|
|
80
|
-
batchedEventUpdates: (cb: Func) => void;
|
|
81
|
-
/** 用于处理 React 中的小程序生命周期 hooks */
|
|
82
|
-
mergePageInstance: (prev: any, next: any) => void;
|
|
83
|
-
/** 用于修改传递给小程序 Page 构造器的对象 */
|
|
84
|
-
modifyPageObject: (config: Record<any, any>) => void;
|
|
85
|
-
/** H5 下拉刷新 wrapper */
|
|
86
|
-
createPullDownComponent: (el: any, path: string, framework: any, customWrapper?: any) => void;
|
|
87
|
-
/** H5 获取原生 DOM 对象 */
|
|
88
|
-
getDOMNode: (instance: any) => any;
|
|
89
|
-
/**
|
|
90
|
-
* @todo: multi
|
|
91
|
-
* 修改 Taro DOM 序列化数据
|
|
92
|
-
**/
|
|
93
|
-
modifyHydrateData: (data: Record<string, any>) => void;
|
|
94
|
-
/**
|
|
95
|
-
* @todo: multi
|
|
96
|
-
* 修改 Taro DOM 序列化数据
|
|
97
|
-
**/
|
|
98
|
-
modifySetAttrPayload: (element: any, key: string, payload: UpdatePayload, componentsAlias: Record<string, any>) => void;
|
|
99
|
-
/**
|
|
100
|
-
* @todo: multi
|
|
101
|
-
* 修改 Taro DOM 序列化数据
|
|
102
|
-
**/
|
|
103
|
-
modifyRmAttrPayload: (element: any, key: string, payload: UpdatePayload, componentsAlias: Record<string, any>) => void;
|
|
104
|
-
/**
|
|
105
|
-
* @todo: multi
|
|
106
|
-
* 调用 addEventListener 时触发
|
|
107
|
-
**/
|
|
108
|
-
onAddEvent: (type: string, handler: any, options: any, node: any) => void;
|
|
109
|
-
/** 用于修改小程序原生事件对象 */
|
|
110
|
-
modifyMpEvent: (event: MpEvent) => void;
|
|
111
|
-
modifyMpEventImpl: (event: MpEvent) => void;
|
|
112
|
-
/** 用于修改 Taro DOM 事件对象 */
|
|
113
|
-
modifyTaroEvent: (event: any, element: any) => void;
|
|
114
|
-
modifyDispatchEvent: (event: any, element: any) => void;
|
|
115
|
-
initNativeApi: (taro: Record<string, any>) => void;
|
|
116
|
-
patchElement: (node: any) => void;
|
|
117
|
-
};
|
|
118
|
-
export declare const hooks: TaroHooks<ITaroHooks>;
|
|
119
|
-
export {};
|
package/dist/shortcuts.d.ts
DELETED
package/dist/utils.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { internalComponents } from './components';
|
|
2
|
-
export declare const EMPTY_OBJ: any;
|
|
3
|
-
export declare const EMPTY_ARR: never[];
|
|
4
|
-
export declare const noop: (..._: unknown[]) => void;
|
|
5
|
-
/**
|
|
6
|
-
* Boxed value.
|
|
7
|
-
*
|
|
8
|
-
* @typeparam T Value type.
|
|
9
|
-
*/
|
|
10
|
-
export interface Box<T> {
|
|
11
|
-
v: T;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* box creates a boxed value.
|
|
15
|
-
*
|
|
16
|
-
* @typeparam T Value type.
|
|
17
|
-
* @param v Value.
|
|
18
|
-
* @returns Boxed value.
|
|
19
|
-
*/
|
|
20
|
-
export declare const box: <T>(v: T) => {
|
|
21
|
-
v: T;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* box creates a boxed value.
|
|
25
|
-
*
|
|
26
|
-
* @typeparam T Value type.
|
|
27
|
-
* @param b Boxed value.
|
|
28
|
-
* @returns Value.
|
|
29
|
-
*/
|
|
30
|
-
export declare const unbox: <T>(b: Box<T>) => T;
|
|
31
|
-
export declare function toDashed(s: string): string;
|
|
32
|
-
export declare function toCamelCase(s: string): string;
|
|
33
|
-
export declare const toKebabCase: (string: any) => any;
|
|
34
|
-
export declare function capitalize(s: string): string;
|
|
35
|
-
export declare const hasOwn: (val: Record<any, any>, key: string | symbol) => any;
|
|
36
|
-
/**
|
|
37
|
-
* ensure takes a condition and throw a error if the condition fails,
|
|
38
|
-
* like failure::ensure: https://docs.rs/failure/0.1.1/failure/macro.ensure.html
|
|
39
|
-
* @param condition condition.
|
|
40
|
-
* @param msg error message.
|
|
41
|
-
*/
|
|
42
|
-
export declare function ensure(condition: boolean, msg: string): asserts condition;
|
|
43
|
-
export declare function warn(condition: boolean, msg: string): void;
|
|
44
|
-
export declare function queryToJson(str: any): {};
|
|
45
|
-
export declare function getUniqueKey(): string;
|
|
46
|
-
export declare function cacheDataSet(key: any, val: any): void;
|
|
47
|
-
export declare function cacheDataGet(key: any, delelteAfterGet?: any): any;
|
|
48
|
-
export declare function cacheDataHas(key: any): boolean;
|
|
49
|
-
export declare function mergeInternalComponents(components: any): Record<string, Record<string, string>>;
|
|
50
|
-
export declare function getComponentsAlias(origin: typeof internalComponents): {};
|
|
51
|
-
export declare function mergeReconciler(hostConfig: any, hooksForTest?: any): void;
|
|
52
|
-
export declare function nonsupport(api: any): () => void;
|
|
53
|
-
export declare function setUniqueKeyToRoute(key: string, obj: any): void;
|
|
54
|
-
export declare function indent(str: string, size: number): string;
|