@tarojs/runtime 3.6.0 → 3.6.1-alpha.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 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.
package/dist/bom/URL.d.ts CHANGED
@@ -37,6 +37,17 @@ export declare class URL {
37
37
  href: string;
38
38
  };
39
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
+ };
40
51
  export declare function parseUrlBase(url: string, base?: string): {
41
52
  href: string;
42
53
  origin: string;
@@ -29,20 +29,8 @@ 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
  }
36
- export declare function resolveRelativePath(path: string, relative: string): string;
37
- export declare function parseUrl(url?: string): {
38
- href: string;
39
- origin: string;
40
- protocol: string;
41
- hostname: string;
42
- host: string;
43
- port: string;
44
- pathname: string;
45
- search: string;
46
- hash: string;
47
- };
48
36
  export {};
@@ -52,7 +52,7 @@ export declare const A = "a";
52
52
  */
53
53
  export declare enum CONTEXT_ACTIONS {
54
54
  INIT = "0",
55
- RECOVER = "1",
56
- RESTORE = "2",
55
+ RESTORE = "1",
56
+ RECOVER = "2",
57
57
  DESTORY = "3"
58
58
  }
package/dist/index.d.ts CHANGED
@@ -2,9 +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';
7
- export { URL } from './bom/URL';
9
+ export { parseUrl, URL } from './bom/URL';
8
10
  export { URLSearchParams } from './bom/URLSearchParams';
9
11
  export { history, location, window } from './bom/window';
10
12
  export { TaroElement } from './dom/element';
@@ -16,7 +18,6 @@ export { Style } from './dom/style';
16
18
  export { SVGElement } from './dom/svg';
17
19
  export { TaroText } from './dom/text';
18
20
  export { MutationObserver } from './dom-external/mutation-observer';
19
- export { parseUrl } from './bom/location';
20
21
  export { Current, getCurrentInstance } from './current';
21
22
  export { eventSource } from './dom/event-source';
22
23
  export { addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getPageInstance, injectPageInstance, removePageInstance, safeExecute, stringify } from './dsl/common';
@@ -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;
@@ -382,6 +477,17 @@ declare class URL {
382
477
  href: string;
383
478
  };
384
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
+ };
385
491
  declare let window: any;
386
492
  declare const location: any;
387
493
  declare const history: any;
@@ -472,22 +578,6 @@ declare class MutationObserver {
472
578
  takeRecords(): MutationRecord[];
473
579
  static record(record: MutationRecord): void;
474
580
  }
475
- declare const eventCenter: Events;
476
- type EventsType = typeof Events;
477
- type Options$0 = {
478
- window: any;
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
- };
491
581
  interface Instance<T> extends Component<T>, Show, PageInstance {
492
582
  tid?: string;
493
583
  $forceUpdate?(): void;
@@ -610,4 +700,4 @@ declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
610
700
  declare const options: Options;
611
701
  declare const incrementId: () => () => string;
612
702
  export { hooks } from '@tarojs/shared';
613
- export { document, getComputedStyle, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, URL, URLSearchParams, history, location, window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, parseUrl, 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 };
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 };