@tarojs/runtime 3.5.11 → 3.6.0-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.
@@ -0,0 +1,14 @@
1
+ export declare class URLSearchParams {
2
+ #private;
3
+ constructor(query: any);
4
+ append(name: string, value: string): void;
5
+ delete(name: string): void;
6
+ get(name: string): any;
7
+ getAll(name: string): any;
8
+ has(name: string): boolean;
9
+ keys(): string[];
10
+ set(name: string, value: string): void;
11
+ forEach(callback: any, thisArg: any): void;
12
+ toJSON(): {};
13
+ toString(): string;
14
+ }
@@ -0,0 +1,29 @@
1
+ import { Events } from '../emitter/emitter';
2
+ import { RuntimeCache } from '../utils/cache';
3
+ import type * as LocationType from './location';
4
+ export interface HistoryState {
5
+ state: Record<string, any> | null;
6
+ title: string;
7
+ url: string;
8
+ }
9
+ declare type Options = {
10
+ window: any;
11
+ };
12
+ declare type HistoryContext = {
13
+ location: LocationType.Location;
14
+ stack: HistoryState[];
15
+ cur: number;
16
+ };
17
+ export declare class History extends Events {
18
+ #private;
19
+ constructor(location: LocationType.Location, options: Options);
20
+ get length(): number;
21
+ get state(): HistoryState;
22
+ go(delta: number): void;
23
+ back(): void;
24
+ forward(): void;
25
+ pushState(state: any, title: string, url: string): void;
26
+ replaceState(state: any, title: string, url: string): void;
27
+ get cache(): RuntimeCache<HistoryContext>;
28
+ }
29
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Events } from '../emitter/emitter';
2
+ import { RuntimeCache } from '../utils/cache';
3
+ declare type Options = {
4
+ window: any;
5
+ };
6
+ declare type LocationContext = {
7
+ lastHref: string;
8
+ };
9
+ export declare class Location extends Events {
10
+ #private;
11
+ constructor(options: Options);
12
+ get protocol(): string;
13
+ set protocol(val: string);
14
+ get host(): string;
15
+ set host(val: string);
16
+ get hostname(): string;
17
+ set hostname(val: string);
18
+ get port(): string;
19
+ set port(val: string);
20
+ get pathname(): string;
21
+ set pathname(val: string);
22
+ get search(): string;
23
+ set search(val: string);
24
+ get hash(): string;
25
+ set hash(val: string);
26
+ get href(): string;
27
+ set href(val: string);
28
+ get origin(): string;
29
+ set origin(val: string);
30
+ assign(): void;
31
+ reload(): void;
32
+ replace(val: string): void;
33
+ toString(): string;
34
+ get cache(): RuntimeCache<LocationContext>;
35
+ }
36
+ export {};
@@ -1,2 +1,4 @@
1
1
  declare let window: any;
2
+ export declare const location: any;
3
+ export declare const history: any;
2
4
  export { window };
@@ -45,3 +45,12 @@ export declare const ON_HIDE = "onHide";
45
45
  export declare const OPTIONS = "options";
46
46
  export declare const EXTERNAL_CLASSES = "externalClasses";
47
47
  export declare const BEHAVIORS = "behaviors";
48
+ /**
49
+ * 页面上下文切换时的行为
50
+ */
51
+ export declare enum CONTEXT_ACTIONS {
52
+ INIT = "0",
53
+ RECOVER = "1",
54
+ RESTORE = "2",
55
+ DESTORY = "3"
56
+ }
@@ -9,6 +9,7 @@ export declare class TaroEvent {
9
9
  _stop: boolean;
10
10
  _end: boolean;
11
11
  defaultPrevented: boolean;
12
+ button: number;
12
13
  timeStamp: number;
13
14
  mpEvent: MpEvent | undefined;
14
15
  constructor(type: string, opts: EventOptions, event?: MpEvent);
@@ -82,5 +82,6 @@ export interface AppInstance extends Show {
82
82
  onShow?(options?: Record<string, unknown>): void;
83
83
  unmount?(id: string, cb?: () => void): void;
84
84
  taroGlobalData?: Record<any, any>;
85
+ config?: Record<any, any>;
85
86
  }
86
87
  export {};
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@ export { document } from './bom/document';
4
4
  export { getComputedStyle } from './bom/getComputedStyle';
5
5
  export { nav as navigator } from './bom/navigator';
6
6
  export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf';
7
- export { window } from './bom/window';
7
+ export { URLSearchParams } from './bom/URLSearchParams';
8
+ export { history, location, window } from './bom/window';
8
9
  export { TaroElement } from './dom/element';
9
10
  export { createEvent, eventHandler, TaroEvent } from './dom/event';
10
11
  export { FormElement } from './dom/form';
@@ -112,6 +112,8 @@ declare class TaroEvent {
112
112
  _stop: boolean;
113
113
  _end: boolean;
114
114
  defaultPrevented: boolean;
115
+ // Mouse Event botton property, it's used in 3rd lib, like react-router. default 0 in general
116
+ button: number;
115
117
  // timestamp can either be hi-res ( relative to page load) or low-res (relative to UNIX epoch)
116
118
  // here use hi-res timestamp
117
119
  timeStamp: number;
@@ -325,7 +327,23 @@ declare let now: () => number;
325
327
  // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
326
328
  declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
327
329
  declare const _caf: typeof cancelAnimationFrame;
330
+ declare class URLSearchParams {
331
+ #private;
332
+ constructor(query: any);
333
+ append(name: string, value: string): void;
334
+ delete(name: string): void;
335
+ get(name: string): any;
336
+ getAll(name: string): any;
337
+ has(name: string): boolean;
338
+ keys(): string[];
339
+ set(name: string, value: string): void;
340
+ forEach(callback: any, thisArg: any): void;
341
+ toJSON(): {};
342
+ toString(): string;
343
+ }
328
344
  declare let window: any;
345
+ declare const location: any;
346
+ declare const history: any;
329
347
  // for Vue3
330
348
  declare class SVGElement extends TaroElement {
331
349
  }
@@ -491,6 +509,7 @@ interface AppInstance extends Show {
491
509
  onShow?(options?: Record<string, unknown>): void;
492
510
  unmount?(id: string, cb?: () => void): void;
493
511
  taroGlobalData?: Record<any, any>;
512
+ config?: Record<any, any>;
494
513
  }
495
514
  interface Router {
496
515
  params: Record<string, unknown>;
@@ -536,4 +555,4 @@ declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
536
555
  declare const options: Options;
537
556
  declare const incrementId: () => () => string;
538
557
  export { hooks } from '@tarojs/shared';
539
- export { document, getComputedStyle, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, 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 };
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 };