@tarojs/runtime 3.6.5-alpha → 3.6.5-alpha.2

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.
@@ -6,10 +6,10 @@ export interface HistoryState {
6
6
  title: string;
7
7
  url: string;
8
8
  }
9
- declare type Options = {
9
+ type Options = {
10
10
  window: any;
11
11
  };
12
- declare type HistoryContext = {
12
+ type HistoryContext = {
13
13
  location: LocationType.Location;
14
14
  stack: HistoryState[];
15
15
  cur: number;
@@ -1,9 +1,9 @@
1
1
  import { Events } from '../emitter/emitter';
2
2
  import { RuntimeCache } from '../utils/cache';
3
- declare type Options = {
3
+ type Options = {
4
4
  window: any;
5
5
  };
6
- declare type LocationContext = {
6
+ type LocationContext = {
7
7
  lastHref: string;
8
8
  };
9
9
  export declare class Location extends Events {
@@ -1,4 +1,4 @@
1
1
  import type { TaroElement } from './element';
2
- declare type Filter = (element: TaroElement) => boolean;
2
+ type Filter = (element: TaroElement) => boolean;
3
3
  export declare function treeToArray(root: TaroElement, predict?: Filter): TaroElement[];
4
4
  export {};
@@ -20,6 +20,6 @@ export interface Element extends Node {
20
20
  export interface ParsedTaroElement extends TaroElement {
21
21
  h5tagName?: string;
22
22
  }
23
- declare type ChildNode = Comment | Text | Element;
23
+ type ChildNode = Comment | Text | Element;
24
24
  export declare function parser(html: string, document: TaroDocument): (import("../..").TaroText | TaroElement)[];
25
25
  export {};
@@ -1,6 +1,6 @@
1
1
  import type { TaroNode } from '../../dom/node';
2
2
  import type { MutationRecord } from './record';
3
- export declare type MutationCallback = (mutations: MutationRecord[]) => any;
3
+ export type MutationCallback = (mutations: MutationRecord[]) => any;
4
4
  /**
5
5
  * @see https://dom.spec.whatwg.org/#dictdef-mutationobserverinit
6
6
  */
@@ -1,5 +1,5 @@
1
1
  import type { TaroNode } from '../dom/node';
2
- export declare type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
2
+ export type IPosition = 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend';
3
3
  /**
4
4
  * An implementation of `Element.insertAdjacentHTML()`
5
5
  * to support Vue 3 with a version of or greater than `vue@3.1.2`
@@ -13,7 +13,7 @@ export interface Instance<T = Record<string, any>> extends Component<T>, Show, P
13
13
  export interface VueAppInstance extends ComponentOptions<VueCtor> {
14
14
  $options: AppInstance;
15
15
  }
16
- export declare type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
16
+ export type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
17
17
  interface VueInternal {
18
18
  _render(): VNode;
19
19
  _update(vnode: VNode, hyrate: boolean): void;
@@ -1,4 +1,4 @@
1
1
  import { Events } from '@tarojs/shared';
2
2
  declare const eventCenter: Events;
3
- export declare type EventsType = typeof Events;
3
+ export type EventsType = typeof Events;
4
4
  export { eventCenter, Events };
@@ -2,7 +2,7 @@ export interface EventOptions {
2
2
  bubbles: boolean;
3
3
  cancelable: boolean;
4
4
  }
5
- declare type Target = Record<string, unknown> & {
5
+ type Target = Record<string, unknown> & {
6
6
  dataset: Record<string, unknown>;
7
7
  id: string;
8
8
  };
@@ -25,6 +25,6 @@ interface MiniTextData {
25
25
  [Shortcuts.Text]: string;
26
26
  [Shortcuts.NodeName]: string;
27
27
  }
28
- export declare type MiniData = MiniElementData | MiniTextData;
29
- export declare type HydratedData = () => MiniData | MiniData[];
28
+ export type MiniData = MiniElementData | MiniTextData;
29
+ export type HydratedData = () => MiniData | MiniData[];
30
30
  export {};
@@ -1,6 +1,6 @@
1
1
  import { HydratedData } from './index';
2
- export declare type UpdatePayloadValue = string | boolean | HydratedData;
3
- export declare type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
2
+ export type UpdatePayloadValue = string | boolean | HydratedData;
3
+ export type DataTree = Record<string, UpdatePayloadValue | ReturnType<HydratedData>>;
4
4
  export interface UpdatePayload {
5
5
  path: string;
6
6
  value: UpdatePayloadValue;
@@ -1,2 +1,2 @@
1
- export declare type Func = (...args: any[]) => any;
2
- export declare type Ctx = Record<string, any>;
1
+ export type Func = (...args: any[]) => any;
2
+ export type Ctx = Record<string, any>;
@@ -578,7 +578,7 @@ declare class MutationObserver {
578
578
  takeRecords(): MutationRecord[];
579
579
  static record(record: MutationRecord): void;
580
580
  }
581
- interface Instance<T> extends Component<T>, Show, PageInstance {
581
+ interface Instance<T = Record<string, any>> extends Component<T>, Show, PageInstance {
582
582
  tid?: string;
583
583
  $forceUpdate?(): void;
584
584
  $nextTick?(cb: () => void): void;
@@ -587,7 +587,7 @@ interface Instance<T> extends Component<T>, Show, PageInstance {
587
587
  interface VueAppInstance extends ComponentOptions<VueCtor> {
588
588
  $options: AppInstance;
589
589
  }
590
- type VueInstance<M, P> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
590
+ type VueInstance<M = Record<string, any>, P = Record<string, any>> = CombinedVueInstance<VueCtor, Record<string, any>, M, P, Record<never, any>> & VueInternal;
591
591
  interface VueInternal {
592
592
  _render(): VNode;
593
593
  _update(vnode: VNode, hyrate: boolean): void;
@@ -595,13 +595,13 @@ interface VueInternal {
595
595
  interface PageProps {
596
596
  tid?: string;
597
597
  }
598
- interface ReactPageComponent<T> extends ComponentClass<T>, PageInstance {
598
+ interface ReactPageComponent<T = PageProps> extends ComponentClass<T>, PageInstance {
599
599
  }
600
- interface ReactPageInstance<T> extends Component<T>, PageInstance {
600
+ interface ReactPageInstance<T = PageProps> extends Component<T>, PageInstance {
601
601
  componentDidShow?(): void;
602
602
  componentDidHide?(): void;
603
603
  }
604
- interface ReactAppInstance<T> extends Component<T>, AppInstance {
604
+ interface ReactAppInstance<T = AppInstance> extends Component<T>, AppInstance {
605
605
  }
606
606
  interface PageLifeCycle extends Show {
607
607
  eh?(event: MpEvent): void;
@@ -2795,8 +2795,7 @@ function encode(str) {
2795
2795
  class URLSearchParams {
2796
2796
  constructor(query) {
2797
2797
  _URLSearchParams_dict.set(this, Object.create(null));
2798
- if (!query)
2799
- return;
2798
+ query !== null && query !== void 0 ? query : (query = '');
2800
2799
  const dict = __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2801
2800
  if (typeof query === 'string') {
2802
2801
  if (query.charAt(0) === '?') {
@@ -2880,6 +2879,12 @@ _URLSearchParams_dict = new WeakMap();
2880
2879
 
2881
2880
  var _URL_hash, _URL_hostname, _URL_pathname, _URL_port, _URL_protocol, _URL_search;
2882
2881
  class URL {
2882
+ static createObjectURL() {
2883
+ throw new Error('Oops, not support URL.createObjectURL() in miniprogram.');
2884
+ }
2885
+ static revokeObjectURL() {
2886
+ throw new Error('Oops, not support URL.revokeObjectURL() in miniprogram.');
2887
+ }
2883
2888
  constructor(url, base) {
2884
2889
  /* private property */
2885
2890
  _URL_hash.set(this, '');
@@ -2887,7 +2892,7 @@ class URL {
2887
2892
  _URL_pathname.set(this, '');
2888
2893
  _URL_port.set(this, '');
2889
2894
  _URL_protocol.set(this, '');
2890
- _URL_search.set(this, '');
2895
+ _URL_search.set(this, void 0);
2891
2896
  if (!isString(url))
2892
2897
  url = String(url);
2893
2898
  const parseResult = parseUrlBase(url, base);
@@ -2897,13 +2902,7 @@ class URL {
2897
2902
  __classPrivateFieldSet(this, _URL_pathname, pathname || '/', "f");
2898
2903
  __classPrivateFieldSet(this, _URL_port, port, "f");
2899
2904
  __classPrivateFieldSet(this, _URL_protocol, protocol, "f");
2900
- __classPrivateFieldSet(this, _URL_search, search, "f");
2901
- }
2902
- static createObjectURL() {
2903
- throw new Error('Oops, not support URL.createObjectURL() in miniprogram.');
2904
- }
2905
- static revokeObjectURL() {
2906
- throw new Error('Oops, not support URL.revokeObjectURL() in miniprogram.');
2905
+ __classPrivateFieldSet(this, _URL_search, new URLSearchParams(search), "f");
2907
2906
  }
2908
2907
  /* public property */
2909
2908
  get protocol() {
@@ -2953,15 +2952,13 @@ class URL {
2953
2952
  }
2954
2953
  }
2955
2954
  get search() {
2956
- return __classPrivateFieldGet(this, _URL_search, "f");
2955
+ const val = __classPrivateFieldGet(this, _URL_search, "f").toString();
2956
+ return (val.length === 0 || val.startsWith('?')) ? val : `?${val}`;
2957
2957
  }
2958
2958
  set search(val) {
2959
2959
  if (isString(val)) {
2960
2960
  val = val.trim();
2961
- if (val)
2962
- __classPrivateFieldSet(this, _URL_search, val.startsWith('?') ? val : `?${val}`, "f");
2963
- else
2964
- __classPrivateFieldSet(this, _URL_search, '', "f");
2961
+ __classPrivateFieldSet(this, _URL_search, new URLSearchParams(val), "f");
2965
2962
  }
2966
2963
  }
2967
2964
  get hash() {
@@ -3004,7 +3001,7 @@ class URL {
3004
3001
  }
3005
3002
  }
3006
3003
  get searchParams() {
3007
- return new URLSearchParams(this.search);
3004
+ return __classPrivateFieldGet(this, _URL_search, "f");
3008
3005
  }
3009
3006
  // public method
3010
3007
  toString() {