@tarojs/shared 3.5.0-beta.3 → 3.5.0-beta.6

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.
@@ -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 {};
@@ -1,10 +0,0 @@
1
- export declare const enum Shortcuts {
2
- Container = "container",
3
- Childnodes = "cn",
4
- Text = "v",
5
- NodeType = "nt",
6
- NodeName = "nn",
7
- Style = "st",
8
- Class = "cl",
9
- Src = "src"
10
- }
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;