@tarojs/runtime 3.6.0-canary.9 → 3.6.1-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018
3
+ Copyright (c) 2018 O2Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,121 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ ========================================================================
24
+
25
+ MIT (react-devtools):
26
+ The following files embed [react-devtools](https://github.com/facebook/react) MIT:
27
+ `/packages/taro-plugin-react-devtools/src/backend/index.js`
28
+ See `/LICENSE` for details of the license.
29
+
30
+ ==================
31
+
32
+ MIT (vue-devtools):
33
+ The following files embed [vue-devtools](https://github.com/vuejs/devtools) MIT:
34
+ `/packages/taro-plugin-vue-devtools/src/backend/*`
35
+ See `/LICENSE` for details of the license.
36
+
37
+ ==================
38
+
39
+ MIT (vite):
40
+ The following files embed [vite](https://github.com/vitejs/vite) MIT:
41
+ `/packages/taro-webpack5-prebundle/src/prebundle/scanImport.ts`,
42
+ `/packages/taro-webpack5-prebundle/src/prebundle/bundle.ts`,
43
+ `/packages/taro-webpack5-prebundle/src/h5.ts`,
44
+ `/packages/taro-webpack5-prebundle/src/min.ts`
45
+ See `/LICENSE` for details of the license.
46
+
47
+ ==================
48
+
49
+ MIT (webpack):
50
+ The following files embed [webpack](https://github.com/webpack/webpack) MIT:
51
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerEntryModule.ts`,
52
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerPlugin.ts`,
53
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerReferencePlugin.ts`,
54
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroModuleFederationPlugin.ts`
55
+ See `/LICENSE` for details of the license.
56
+
57
+ ==================
58
+
59
+ MIT (sizzle):
60
+ The following files embed [sizzle](https://github.com/jquery/sizzle) MIT:
61
+ `/packages/taro-extends/src/jquery/sizzle.js`
62
+ See `/LICENSE.txt` for details of the license.
63
+
64
+ ==================
65
+
66
+ MIT (zepto):
67
+ The following files embed [zepto](https://github.com/madrobby/zepto) MIT:
68
+ `/packages/taro-extends/src/jquery/zepto.js`,
69
+ `/packages/taro-extends/src/jquery/event.js`
70
+ See `/MIT-LICENSE` for details of the license.
71
+
72
+ ==================
73
+
74
+ MIT (css-to-react-native):
75
+ The following files embed [css-to-react-native](https://github.com/styled-components/css-to-react-native) MIT:
76
+ `/packages/css-to-react-native/src/css-to-react-native/*`
77
+ See `/LICENSE.md` for details of the license.
78
+
79
+ ==================
80
+
81
+ MIT (reactify-wc):
82
+ The following files embed [reactify-wc](https://github.com/BBKolton/reactify-wc) MIT:
83
+ `/packages/taro-components-library-react/src/component-lib/reactify-wc.ts`
84
+ See `/LICENSE` for details of the license.
85
+
86
+ ==================
87
+
88
+ MIT (ant-design-mobile-rn):
89
+ The following files embed [ant-design-mobile-rn](https://github.com/ant-design/ant-design-mobile-rn) MIT:
90
+ `/packages/taro-components-rn/src/components/Swiper/carousel.tsx`
91
+ See `/LICENSE` for details of the license.
92
+
93
+ ==================
94
+
95
+ MIT (react-wx-images-viewer):
96
+ The following files embed [react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer) MIT:
97
+ `/packages/taro-h5/src/api/media/image/previewImage.ts`
98
+ See `/LICENSE` for details of the license.
99
+
100
+ ==================
101
+
102
+ MIT (webpack-contrib/css-loader):
103
+ The following files embed [webpack-contrib/css-loader](https://github.com/webpack-contrib/css-loader) MIT:
104
+ `/packages/taro-rn-style-transformer/src/utils/index.ts`
105
+ See `/LICENSE` for details of the license.
106
+
107
+ ==================
108
+
109
+ MIT (react-native):
110
+ The following files embed [react-native](https://github.com/facebook/react-native) MIT:
111
+ `/packages/taro-rn-style-transformer/src/transforms/StyleSheet/*`
112
+ See `/LICENSE` for details of the license.
113
+
114
+ ==================
115
+
116
+ MIT (myrne/performance-now):
117
+ The following files embed [myrne/performance-now](https://github.com/myrne/performance-now) MIT:
118
+ `/packages/taro-runtime/src/bom/raf.ts`
119
+ See `/LICENSE` for details of the license.
120
+
121
+ ==================
122
+
123
+ Apache (chameleon-api):
124
+ The following files embed [chameleon-api](https://github.com/chameleon-team/chameleon-api) Apache:
125
+ `/packages/taro-h5/src/api/device/clipboard.ts`
126
+
127
+ ==================
128
+
129
+ MIT (uni-app):
130
+ The following files embed [uni-app](https://github.com/dcloudio/uni-app) MIT:
131
+ `/packages/taro-components-rn/src/components/Video/index.tsx`
132
+ See `/LICENSE` for details of the license.
133
+
134
+ ==================
135
+
136
+ MIT (miniprogram-render):
137
+ The following files embed [miniprogram-render](https://github.com/Tencent/kbone) MIT:
138
+ `/packages/taro-plugin-http/src/runtime/Cookie.ts`
139
+ See `/LICENSE` for details of the license.
@@ -0,0 +1,61 @@
1
+ import { URLSearchParams } from './URLSearchParams';
2
+ export declare class URL {
3
+ #private;
4
+ static createObjectURL(): void;
5
+ static revokeObjectURL(): void;
6
+ constructor(url: string, base?: string);
7
+ get protocol(): string;
8
+ set protocol(val: string);
9
+ get host(): string;
10
+ set host(val: string);
11
+ get hostname(): string;
12
+ set hostname(val: string);
13
+ get port(): string;
14
+ set port(val: string);
15
+ get pathname(): string;
16
+ set pathname(val: string);
17
+ get search(): string;
18
+ set search(val: string);
19
+ get hash(): string;
20
+ set hash(val: string);
21
+ get href(): string;
22
+ set href(val: string);
23
+ get origin(): string;
24
+ set origin(val: string);
25
+ get searchParams(): URLSearchParams;
26
+ toString(): string;
27
+ toJSON(): string;
28
+ _toRaw(): {
29
+ protocol: string;
30
+ port: string;
31
+ host: string;
32
+ hostname: string;
33
+ pathname: string;
34
+ hash: string;
35
+ search: string;
36
+ origin: string;
37
+ href: string;
38
+ };
39
+ }
40
+ export declare function parseUrl(url?: string): {
41
+ href: string;
42
+ origin: string;
43
+ protocol: string;
44
+ hostname: string;
45
+ host: string;
46
+ port: string;
47
+ pathname: string;
48
+ search: string;
49
+ hash: string;
50
+ };
51
+ export declare function parseUrlBase(url: string, base?: string): {
52
+ href: string;
53
+ origin: string;
54
+ protocol: string;
55
+ hostname: string;
56
+ host: string;
57
+ port: string;
58
+ pathname: string;
59
+ search: string;
60
+ hash: string;
61
+ };
@@ -29,7 +29,7 @@ export declare class Location extends Events {
29
29
  set origin(val: string);
30
30
  assign(): void;
31
31
  reload(): void;
32
- replace(val: string): void;
32
+ replace(url: string): void;
33
33
  toString(): string;
34
34
  get cache(): RuntimeCache<LocationContext>;
35
35
  }
@@ -44,13 +44,15 @@ export declare const ON_SHOW = "onShow";
44
44
  export declare const ON_HIDE = "onHide";
45
45
  export declare const OPTIONS = "options";
46
46
  export declare const EXTERNAL_CLASSES = "externalClasses";
47
+ export declare const EVENT_CALLBACK_RESULT = "e_result";
47
48
  export declare const BEHAVIORS = "behaviors";
49
+ export declare const A = "a";
48
50
  /**
49
51
  * 页面上下文切换时的行为
50
52
  */
51
53
  export declare enum CONTEXT_ACTIONS {
52
54
  INIT = "0",
53
- RECOVER = "1",
54
- RESTORE = "2",
55
+ RESTORE = "1",
56
+ RECOVER = "2",
55
57
  DESTORY = "3"
56
58
  }
@@ -0,0 +1,13 @@
1
+ import { TaroElement } from './element';
2
+ export declare class AnchorElement extends TaroElement {
3
+ get href(): string;
4
+ set href(val: string);
5
+ get protocol(): any;
6
+ get host(): any;
7
+ get search(): any;
8
+ get hash(): any;
9
+ get hostname(): any;
10
+ get port(): any;
11
+ get pathname(): any;
12
+ setAttribute(qualifiedName: string, value: any): void;
13
+ }
@@ -20,4 +20,4 @@ export declare class TaroEvent {
20
20
  get currentTarget(): any;
21
21
  }
22
22
  export declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
23
- export declare function eventHandler(event: MpEvent): void;
23
+ export declare function eventHandler(event: MpEvent): any;
package/dist/index.d.ts CHANGED
@@ -2,8 +2,11 @@ import './dom-external';
2
2
  export { hooks } from '@tarojs/shared';
3
3
  export { document } from './bom/document';
4
4
  export { getComputedStyle } from './bom/getComputedStyle';
5
+ export { History } from './bom/history';
6
+ export { Location } from './bom/location';
5
7
  export { nav as navigator } from './bom/navigator';
6
8
  export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf';
9
+ export { parseUrl, URL } from './bom/URL';
7
10
  export { URLSearchParams } from './bom/URLSearchParams';
8
11
  export { history, location, window } from './bom/window';
9
12
  export { TaroElement } from './dom/element';
@@ -127,7 +127,7 @@ declare class TaroEvent {
127
127
  }
128
128
  declare function createEvent(event: MpEvent | string, node?: TaroElement): TaroEvent;
129
129
  // 小程序的事件代理回调函数
130
- declare function eventHandler(event: MpEvent): void;
130
+ declare function eventHandler(event: MpEvent): any;
131
131
  declare class FormElement extends TaroElement {
132
132
  get value(): string | boolean | number | any[];
133
133
  set value(val: string | boolean | number | any[]);
@@ -320,6 +320,101 @@ declare class TaroElement extends TaroNode {
320
320
  static extend(methodName: string, options: Func | Record<string, any>): void;
321
321
  }
322
322
  declare function getComputedStyle(element: TaroElement): Style;
323
+ declare const eventCenter: Events;
324
+ type EventsType = typeof Events;
325
+ /**
326
+ * 一个小型缓存池,用于在切换页面时,存储一些上下文信息
327
+ */
328
+ declare class RuntimeCache<T> {
329
+ name: string;
330
+ cache: Map<string, T>;
331
+ constructor(name: string);
332
+ has(identifier: string): boolean;
333
+ set(identifier: string, ctx: T): void;
334
+ get(identifier: string): T | undefined;
335
+ delete(identifier: string): void;
336
+ }
337
+ declare namespace LocationType {
338
+ const eventCenter: Events;
339
+ type EventsType = typeof Events;
340
+ /**
341
+ * 一个小型缓存池,用于在切换页面时,存储一些上下文信息
342
+ */
343
+ class RuntimeCache<T> {
344
+ name: string;
345
+ cache: Map<string, T>;
346
+ constructor(name: string);
347
+ has(identifier: string): boolean;
348
+ set(identifier: string, ctx: T): void;
349
+ get(identifier: string): T | undefined;
350
+ delete(identifier: string): void;
351
+ }
352
+ type Options = {
353
+ window: any;
354
+ };
355
+ type LocationContext = {
356
+ lastHref: string;
357
+ };
358
+ class Location extends Events {
359
+ #private;
360
+ constructor(options: Options);
361
+ /* public property */
362
+ get protocol(): string;
363
+ set protocol(val: string);
364
+ get host(): string;
365
+ set host(val: string);
366
+ get hostname(): string;
367
+ set hostname(val: string);
368
+ get port(): string;
369
+ set port(val: string);
370
+ get pathname(): string;
371
+ set pathname(val: string);
372
+ get search(): string;
373
+ set search(val: string);
374
+ get hash(): string;
375
+ // 小程序的navigateTo存在截断hash字符串的问题
376
+ set hash(val: string);
377
+ get href(): string;
378
+ set href(val: string);
379
+ get origin(): string;
380
+ set origin(val: string);
381
+ /* public method */
382
+ assign(): void;
383
+ reload(): void;
384
+ replace(url: string): void;
385
+ toString(): string;
386
+ // For debug
387
+ get cache(): RuntimeCache<LocationContext>;
388
+ }
389
+ }
390
+ interface HistoryState {
391
+ state: Record<string, any> | null;
392
+ title: string;
393
+ url: string;
394
+ }
395
+ type Options$0 = {
396
+ window: any;
397
+ };
398
+ type HistoryContext = {
399
+ location: LocationType.Location;
400
+ stack: HistoryState[];
401
+ cur: number;
402
+ };
403
+ declare class History extends Events {
404
+ #private;
405
+ constructor(location: LocationType.Location, options: Options$0);
406
+ /* public property */
407
+ get length(): number;
408
+ get state(): HistoryState;
409
+ /* public method */
410
+ go(delta: number): void;
411
+ back(): void;
412
+ forward(): void;
413
+ pushState(state: any, title: string, url: string): void;
414
+ replaceState(state: any, title: string, url: string): void;
415
+ // For debug
416
+ get cache(): RuntimeCache<HistoryContext>;
417
+ }
323
418
  declare const nav: any;
324
419
  // https://github.com/myrne/performance-now
325
420
  declare let now: () => number;
@@ -341,6 +436,58 @@ declare class URLSearchParams {
341
436
  toJSON(): {};
342
437
  toString(): string;
343
438
  }
439
+ declare class URL {
440
+ #private;
441
+ static createObjectURL(): void;
442
+ static revokeObjectURL(): void;
443
+ constructor(url: string, base?: string);
444
+ /* public property */
445
+ get protocol(): string;
446
+ set protocol(val: string);
447
+ get host(): string;
448
+ set host(val: string);
449
+ get hostname(): string;
450
+ set hostname(val: string);
451
+ get port(): string;
452
+ set port(val: string);
453
+ get pathname(): string;
454
+ set pathname(val: string);
455
+ get search(): string;
456
+ set search(val: string);
457
+ get hash(): string;
458
+ set hash(val: string);
459
+ get href(): string;
460
+ set href(val: string);
461
+ get origin(): string;
462
+ set origin(val: string);
463
+ get searchParams(): URLSearchParams;
464
+ // public method
465
+ toString(): string;
466
+ toJSON(): string;
467
+ // convenient for deconstructor
468
+ _toRaw(): {
469
+ protocol: string;
470
+ port: string;
471
+ host: string;
472
+ hostname: string;
473
+ pathname: string;
474
+ hash: string;
475
+ search: string;
476
+ origin: string;
477
+ href: string;
478
+ };
479
+ }
480
+ declare function parseUrl(url?: string): {
481
+ href: string;
482
+ origin: string;
483
+ protocol: string;
484
+ hostname: string;
485
+ host: string;
486
+ port: string;
487
+ pathname: string;
488
+ search: string;
489
+ hash: string;
490
+ };
344
491
  declare let window: any;
345
492
  declare const location: any;
346
493
  declare const history: any;
@@ -542,8 +689,6 @@ declare function stringify(obj?: Record<string, unknown>): string;
542
689
  declare function createPageConfig(component: any, pageName?: string, data?: Record<string, unknown>, pageConfig?: PageConfig): PageInstance;
543
690
  declare function createComponentConfig(component: React.ComponentClass, componentName?: string, data?: Record<string, unknown>): any;
544
691
  declare function createRecursiveComponentConfig(componentName?: string): any;
545
- declare const eventCenter: Events;
546
- type EventsType = typeof Events;
547
692
  /**
548
693
  * React also has a fancy function's name for this: `hydrate()`.
549
694
  * You may have been heard `hydrate` as a SSR-related function,
@@ -555,4 +700,4 @@ declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
555
700
  declare const options: Options;
556
701
  declare const incrementId: () => () => string;
557
702
  export { hooks } from '@tarojs/shared';
558
- export { document, getComputedStyle, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options, Func, Ctx };
703
+ 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, Current, getCurrentInstance, eventSource, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };