Socket
Socket
Sign inDemoInstall

@tarojs/shared

Package Overview
Dependencies
Maintainers
3
Versions
634
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tarojs/shared - npm Package Compare versions

Comparing version 3.2.0-beta.0 to 3.2.0-beta.1

dist/native-apis.d.ts

639

dist/components.d.ts

@@ -8,628 +8,21 @@ export declare const styles: {

};
export declare const touchEvents: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
};
export declare const animationEvents: {
bindAnimationStart: string;
bindAnimationIteration: string;
bindAnimationEnd: string;
bindTransitionEnd: string;
};
export declare const specialEvents: Set<string>;
export declare function singleQuote(s: string): string;
export declare const internalComponents: {
View: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
'hover-class': string;
'hover-stop-propagation': string;
'hover-start-time': string;
'hover-stay-time': string;
animation: string;
bindAnimationStart: string;
bindAnimationIteration: string;
bindAnimationEnd: string;
bindTransitionEnd: string;
};
Icon: {
type: string;
size: string;
color: string;
};
Progress: {
percent: string;
'show-info': string;
'border-radius': string;
'font-size': string;
'stroke-width': string;
color: string;
activeColor: string;
backgroundColor: string;
active: string;
'active-mode': string;
duration: string;
bindActiveEnd: string;
};
RichText: {
nodes: string;
space: string;
};
Text: {
selectable: string;
space: string;
decode: string;
};
Button: {
size: string;
type: string;
plain: string;
disabled: string;
loading: string;
'form-type': string;
'open-type': string;
'hover-class': string;
'hover-stop-propagation': string;
'hover-start-time': string;
'hover-stay-time': string;
lang: string;
'session-from': string;
'send-message-title': string;
'send-message-path': string;
'send-message-img': string;
'app-parameter': string;
'show-message-card': string;
bindGetUserInfo: string;
bindGetAuthorize: string;
bindContact: string;
bindGetPhoneNumber: string;
bindError: string;
bindOpenSetting: string;
bindLaunchApp: string;
scope: string;
name: string;
};
Checkbox: {
value: string;
disabled: string;
checked: string;
color: string;
name: string;
};
CheckboxGroup: {
bindChange: string;
name: string;
};
Editor: {
'read-only': string;
placeholder: string;
'show-img-size': string;
'show-img-toolbar': string;
'show-img-resize': string;
focus: string;
bindReady: string;
bindFocus: string;
bindBlur: string;
bindInput: string;
bindStatusChange: string;
name: string;
};
Form: {
'report-submit': string;
'report-submit-timeout': string;
bindSubmit: string;
bindReset: string;
name: string;
};
Input: {
value: string;
type: string;
password: string;
placeholder: string;
'placeholder-style': string;
'placeholder-class': string;
disabled: string;
maxlength: string;
'cursor-spacing': string;
'auto-focus': string;
focus: string;
'confirm-type': string;
'confirm-hold': string;
cursor: string;
'selection-start': string;
'selection-end': string;
'adjust-position': string;
'hold-keyboard': string;
bindInput: string;
bindFocus: string;
bindBlur: string;
bindConfirm: string;
bindKeyboardHeightChange: string;
name: string;
};
Label: {
for: string;
name: string;
};
Picker: {
mode: string;
disabled: string;
bindCancel: string;
range: string;
'range-key': string;
value: string;
bindChange: string;
bindColumnChange: string;
start: string;
end: string;
fields: string;
'custom-item': string;
name: string;
};
PickerView: {
value: string;
'indicator-style': string;
'indicator-class': string;
'mask-style': string;
'mask-class': string;
bindChange: string;
bindPickStart: string;
bindPickEnd: string;
name: string;
};
PickerViewColumn: {
name: string;
};
Radio: {
value: string;
checked: string;
disabled: string;
color: string;
name: string;
};
RadioGroup: {
bindChange: string;
name: string;
};
Slider: {
min: string;
max: string;
step: string;
disabled: string;
value: string;
color: string;
'selected-color': string;
activeColor: string;
backgroundColor: string;
'block-size': string;
'block-color': string;
'show-value': string;
bindChange: string;
bindChanging: string;
name: string;
};
Switch: {
checked: string;
disabled: string;
type: string;
color: string;
bindChange: string;
name: string;
};
CoverImage: {
src: string;
bindLoad: string;
bindError: string;
};
Textarea: {
value: string;
placeholder: string;
'placeholder-style': string;
'placeholder-class': string;
disabled: string;
maxlength: string;
'auto-focus': string;
focus: string;
'auto-height': string;
fixed: string;
'cursor-spacing': string;
cursor: string;
'show-confirm-bar': string;
'selection-start': string;
'selection-end': string;
'adjust-position': string;
'hold-keyboard': string;
bindFocus: string;
bindBlur: string;
bindLineChange: string;
bindInput: string;
bindConfirm: string;
bindKeyboardHeightChange: string;
name: string;
};
CoverView: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
'scroll-top': string;
};
MatchMedia: {
'min-width': string;
'max-width': string;
width: string;
'min-height': string;
'max-height': string;
height: string;
orientation: string;
};
MovableArea: {
'scale-area': string;
};
MovableView: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
direction: string;
inertia: string;
'out-of-bounds': string;
x: string;
y: string;
damping: string;
friction: string;
disabled: string;
scale: string;
'scale-min': string;
'scale-max': string;
'scale-value': string;
animation: string;
bindAnimationEnd: string;
bindChange: string;
bindScale: string;
htouchmove: string;
vtouchmove: string;
width: string;
height: string;
};
ScrollView: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
'scroll-x': string;
'scroll-y': string;
'upper-threshold': string;
'lower-threshold': string;
'scroll-top': string;
'scroll-left': string;
'scroll-into-view': string;
'scroll-with-animation': string;
'enable-back-to-top': string;
'enable-flex': string;
'scroll-anchoring': string;
'refresher-enabled': string;
'refresher-threshold': string;
'refresher-default-style': string;
'refresher-background': string;
'refresher-triggered': string;
enhanced: string;
bounces: string;
'show-scrollbar': string;
'paging-enabled': string;
'fast-deceleration': string;
bindRefresherPulling: string;
bindRefresherRefresh: string;
bindRefresherRestore: string;
bindRefresherAbort: string;
bindScrollToUpper: string;
bindScrollToLower: string;
bindScroll: string;
animation: string;
bindTransitionEnd: string;
bindAnimationStart: string;
bindAnimationIteration: string;
bindAnimationEnd: string;
bindDragStart: string;
bindDragging: string;
bindDragEnd: string;
};
Swiper: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
'indicator-dots': string;
'indicator-color': string;
'indicator-active-color': string;
autoplay: string;
current: string;
interval: string;
duration: string;
circular: string;
vertical: string;
'previous-margin': string;
'next-margin': string;
'snap-to-edge': string;
'display-multiple-items': string;
'skip-hidden-item-layout': string;
'easing-function': string;
bindChange: string;
bindTransition: string;
bindAnimationFinish: string;
};
SwiperItem: {
'item-id': string;
};
FunctionalPageNavigator: {
version: string;
name: string;
args: string;
bindSuccess: string;
bindFail: string;
bindCancel: string;
};
Navigator: {
target: string;
url: string;
'open-type': string;
delta: string;
'app-id': string;
path: string;
'extra-data': string;
version: string;
'hover-class': string;
'hover-stop-propagation': string;
'hover-start-time': string;
'hover-stay-time': string;
bindSuccess: string;
bindFail: string;
bindComplete: string;
};
Audio: {
id: string;
src: string;
loop: string;
controls: string;
poster: string;
name: string;
author: string;
bindError: string;
bindPlay: string;
bindPause: string;
bindTimeUpdate: string;
bindEnded: string;
};
Camera: {
mode: string;
'device-position': string;
flash: string;
'frame-size': string;
bindStop: string;
bindError: string;
bindInitDone: string;
bindScanCode: string;
};
Image: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
src: string;
mode: string;
webp: string;
'lazy-load': string;
'show-menu-by-longpress': string;
bindError: string;
bindLoad: string;
};
LivePlayer: {
src: string;
mode: string;
autoplay: string;
muted: string;
orientation: string;
'object-fit': string;
'background-mute': string;
'min-cache': string;
'max-cache': string;
'sound-mode': string;
'auto-pause-if-navigate': string;
'auto-pause-if-open-native': string;
'picture-in-picture-mode': string;
animation: string;
bindStateChange: string;
bindFullScreenChange: string;
bindNetStatus: string;
bindAudioVolumeNotify: string;
bindEnterPictureInPicture: string;
bindLeavePictureInPicture: string;
};
LivePusher: {
url: string;
mode: string;
autopush: string;
muted: string;
'enable-camera': string;
'auto-focus': string;
orientation: string;
beauty: string;
whiteness: string;
aspect: string;
'min-bitrate': string;
'max-bitrate': string;
'audio-quality': string;
'waiting-image': string;
'waiting-image-hash': string;
zoom: string;
'device-position': string;
'background-mute': string;
mirror: string;
'remote-mirror': string;
'local-mirror': string;
'audio-reverb-type': string;
'enable-mic': string;
'enable-agc': string;
'enable-ans': string;
'audio-volume-type': string;
'video-width': string;
'video-height': string;
animation: string;
bindStateChange: string;
bindNetStatus: string;
bindBgmStart: string;
bindBgmProgress: string;
bindBgmComplete: string;
};
Video: {
src: string;
duration: string;
controls: string;
'danmu-list': string;
'danmu-btn': string;
'enable-danmu': string;
autoplay: string;
loop: string;
muted: string;
'initial-time': string;
'page-gesture': string;
direction: string;
'show-progress': string;
'show-fullscreen-btn': string;
'show-play-btn': string;
'show-center-play-btn': string;
'enable-progress-gesture': string;
'object-fit': string;
poster: string;
'show-mute-btn': string;
title: string;
'play-btn-position': string;
'enable-play-gesture': string;
'auto-pause-if-navigate': string;
'auto-pause-if-open-native': string;
'vslide-gesture': string;
'vslide-gesture-in-fullscreen': string;
'ad-unit-id': string;
'poster-for-crawler': string;
'show-casting-button': string;
'picture-in-picture-mode': string;
'enable-auto-rotation': string;
'show-screen-lock-button': string;
animation: string;
bindPlay: string;
bindPause: string;
bindEnded: string;
bindTimeUpdate: string;
bindFullScreenChange: string;
bindWaiting: string;
bindError: string;
bindProgress: string;
bindLoadedMetadata: string;
bindControlsToggle: string;
bindEnterPictureInPicture: string;
bindLeavePictureInPicture: string;
bindSeekComplete: string;
};
Canvas: {
type: string;
'canvas-id': string;
'disable-scroll': string;
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongtap: string;
bindError: string;
};
Ad: {
'ad-intervals': string;
'ad-type': string;
'ad-theme': string;
bindLoad: string;
bindError: string;
bindClose: string;
};
OfficialAccount: {
bindLoad: string;
bindError: string;
};
OpenData: {
type: string;
'open-gid': string;
lang: string;
'default-text': string;
'default-avatar': string;
bindError: string;
};
WebView: {
src: string;
bindMessage: string;
bindLoad: string;
};
NavigationBar: {
title: string;
loading: string;
'front-color': string;
'background-color': string;
'color-animation-duration': string;
'color-animation-timing-func': string;
};
PageMeta: {
'background-text-style': string;
'background-color': string;
'background-color-top': string;
'background-color-bottom': string;
'scroll-top': string;
'scroll-duration': string;
'page-style': string;
'root-font-size': string;
bindResize: string;
bindScroll: string;
bindScrollDone: string;
};
Block: {};
Map: {
bindTouchStart: string;
bindTouchMove: string;
bindTouchEnd: string;
bindTouchCancel: string;
bindLongTap: string;
longitude: string;
latitude: string;
scale: string;
markers: string;
covers: string;
polyline: string;
circles: string;
controls: string;
'include-points': string;
'show-location': string;
polygons: string;
subkey: string;
'layer-style': string;
rotate: string;
skew: string;
'enable-3D': string;
'show-compass': string;
'show-scale': string;
'enable-overlooking': string;
'enable-zoom': string;
'enable-scroll': string;
'enable-rotate': string;
'enable-satellite': string;
'enable-traffic': string;
bindMarkerTap: string;
bindLabelTap: string;
bindControlTap: string;
bindCalloutTap: string;
bindUpdated: string;
bindRegionChange: string;
bindPoiTap: string;
};
Slot: {
name: string;
};
SlotView: {
name: string;
};
};
export declare const internalComponents: Record<string, Record<string, string>>;
export declare const controlledComponent: Set<string>;
export declare const focusComponents: Set<string>;
export declare const voidElements: Set<string>;
export declare const nestElements: Map<string, number>;

@@ -6,1 +6,2 @@ export * from './is';

export * from './template';
export * from './native-apis';

@@ -44,24 +44,2 @@ 'use strict';

function selectEnv(options) {
var option;
if (process.env.TARO_ENV === 'alipay') {
option = options.alipay;
}
else if (process.env.TARO_ENV === 'jd') {
option = options.jd;
}
else if (process.env.TARO_ENV === 'qq') {
option = options.qq;
}
else if (process.env.TARO_ENV === 'swan') {
option = options.swan;
}
else if (process.env.TARO_ENV === 'tt') {
option = options.tt;
}
else if (process.env.TARO_ENV === 'weapp') {
option = options.weapp;
}
return option || options.default || Object.create(null);
}
var styles = {

@@ -81,2 +59,8 @@ style: ("i." + ("st")),

};
var animationEvents = {
bindAnimationStart: '',
bindAnimationIteration: '',
bindAnimationEnd: '',
bindTransitionEnd: ''
};
var specialEvents = new Set([

@@ -89,3 +73,3 @@ 'htouchmove',

}
var View = Object.assign({ 'hover-class': singleQuote('none'), 'hover-stop-propagation': 'false', 'hover-start-time': '50', 'hover-stay-time': '400', animation: '', bindAnimationStart: '', bindAnimationIteration: '', bindAnimationEnd: '', bindTransitionEnd: '' }, touchEvents);
var View = Object.assign(Object.assign({ 'hover-class': singleQuote('none'), 'hover-stop-propagation': 'false', 'hover-start-time': '50', 'hover-stay-time': '400', animation: '' }, touchEvents), animationEvents);
var Icon = {

@@ -96,15 +80,5 @@ type: '',

};
var Map$1 = Object.assign(Object.assign({ longitude: '', latitude: '', scale: '16', markers: '[]', covers: '', polyline: '[]', circles: '[]', controls: '', 'include-points': '[]', 'show-location': '', polygons: '', subkey: '', 'layer-style': '1', rotate: '0', skew: 'skew', 'enable-3D': 'false', 'show-compass': 'false', 'show-scale': 'false', 'enable-overlooking': 'false', 'enable-zoom': 'true', 'enable-scroll': 'true', 'enable-rotate': 'false', 'enable-satellite': 'false', 'enable-traffic': 'false', bindMarkerTap: '', bindLabelTap: '', bindControlTap: '', bindCalloutTap: '', bindUpdated: '', bindRegionChange: '', bindPoiTap: '' }, touchEvents), selectEnv({
alipay: {
setting: '{}'
},
default: {
setting: '[]'
}
}));
var MapComp = Object.assign({ longitude: '', latitude: '', scale: '16', markers: '[]', covers: '', polyline: '[]', circles: '[]', controls: '[]', 'include-points': '[]', 'show-location': '', 'layer-style': '1', bindMarkerTap: '', bindControlTap: '', bindCalloutTap: '', bindUpdated: '' }, touchEvents);
var Progress = {
percent: '',
'show-info': 'false',
'border-radius': '0',
'font-size': '16',
'stroke-width': '6',

@@ -116,8 +90,6 @@ color: singleQuote('#09BB07'),

'active-mode': singleQuote('backwards'),
duration: '30',
bindActiveEnd: ''
'show-info': 'false'
};
var RichText = {
nodes: '[]',
space: ''
nodes: '[]'
};

@@ -129,9 +101,16 @@ var Text = {

};
var Button = Object.assign({ size: singleQuote('default'), type: '', plain: 'false', disabled: '', loading: 'false', 'form-type': '', 'open-type': '', 'hover-class': singleQuote('button-hover'), 'hover-stop-propagation': 'false', 'hover-start-time': '20', 'hover-stay-time': '70', lang: 'en', 'session-from': '', 'send-message-title': '', 'send-message-path': '', 'send-message-img': '', 'app-parameter': '', 'show-message-card': 'false', bindGetUserInfo: '', bindGetAuthorize: '', bindContact: '', bindGetPhoneNumber: '', bindError: '', bindOpenSetting: '', bindLaunchApp: '', scope: '', name: '' }, selectEnv({
qq: {
'app-packagename': '',
'app-bundleid': '',
'app-connect-id': ''
}
}));
var Button = {
size: singleQuote('default'),
type: '',
plain: 'false',
disabled: '',
loading: 'false',
'form-type': '',
'open-type': '',
'hover-class': singleQuote('button-hover'),
'hover-stop-propagation': 'false',
'hover-start-time': '20',
'hover-stay-time': '70',
name: ''
};
var Checkbox = {

@@ -148,32 +127,30 @@ value: '',

};
var Editor = {
'read-only': 'false',
var Form = {
'report-submit': 'false',
bindSubmit: '',
bindReset: '',
name: ''
};
var Input = {
value: '',
type: singleQuote(''),
password: 'false',
placeholder: '',
'show-img-size': 'false',
'show-img-toolbar': 'false',
'show-img-resize': 'false',
'placeholder-style': '',
'placeholder-class': singleQuote('input-placeholder'),
disabled: '',
maxlength: '140',
'cursor-spacing': '0',
focus: 'false',
bindReady: '',
'confirm-type': singleQuote('done'),
'confirm-hold': 'false',
cursor: 'i.value.length',
'selection-start': '-1',
'selection-end': '-1',
bindInput: '',
bindFocus: '',
bindBlur: '',
bindInput: '',
bindStatusChange: '',
bindConfirm: '',
name: ''
};
var Form = {
'report-submit': 'false',
'report-submit-timeout': '0',
bindSubmit: '',
bindReset: '',
name: ''
};
var Input = Object.assign({ value: '', type: singleQuote(''), password: 'false', placeholder: '', 'placeholder-style': '', 'placeholder-class': singleQuote('input-placeholder'), disabled: '', maxlength: '140', 'cursor-spacing': '0', 'auto-focus': 'false', focus: 'false', 'confirm-type': singleQuote('done'), 'confirm-hold': 'false', cursor: 'i.value.length', 'selection-start': '-1', 'selection-end': '-1', 'adjust-position': 'true', 'hold-keyboard': 'false', bindInput: '', bindFocus: '', bindBlur: '', bindConfirm: '', bindKeyboardHeightChange: '', name: '' }, selectEnv({
alipay: {
'random-number': 'false',
controlled: 'false'
},
weapp: {
'always-embed': 'false'
}
}));
var Label = {

@@ -186,8 +163,5 @@ for: '',

disabled: '',
bindCancel: '',
range: '',
'range-key': '',
value: '',
bindChange: '',
bindColumnChange: '',
start: '',

@@ -197,3 +171,6 @@ end: '',

'custom-item': '',
name: ''
name: '',
bindCancel: '',
bindChange: '',
bindColumnChange: ''
};

@@ -207,4 +184,2 @@ var PickerView = {

bindChange: '',
bindPickStart: '',
bindPickEnd: '',
name: ''

@@ -232,4 +207,2 @@ };

value: '0',
color: singleQuote('#e9e9e9'),
'selected-color': singleQuote('#1aad19'),
activeColor: singleQuote('#1aad19'),

@@ -252,7 +225,2 @@ backgroundColor: singleQuote('#e9e9e9'),

};
var CoverImage = {
src: '',
bindLoad: 'eh',
bindError: 'eh'
};
var Textarea = {

@@ -271,7 +239,4 @@ value: '',

cursor: '-1',
'show-confirm-bar': 'true',
'selection-start': '-1',
'selection-end': '-1',
'adjust-position': 'true',
'hold-keyboard': 'false',
bindFocus: '',

@@ -282,51 +247,23 @@ bindBlur: '',

bindConfirm: '',
bindKeyboardHeightChange: '',
name: ''
};
var CoverImage = {
src: '',
bindLoad: 'eh',
bindError: 'eh'
};
var CoverView = Object.assign({ 'scroll-top': 'false' }, touchEvents);
var MatchMedia = {
'min-width': '',
'max-width': '',
width: '',
'min-height': '',
'max-height': '',
height: '',
orientation: ''
};
var MovableArea = {
'scale-area': 'false'
};
var MovableView = Object.assign({ direction: 'none', inertia: 'false', 'out-of-bounds': 'false', x: '', y: '', damping: '20', friction: '2', disabled: '', scale: 'false', 'scale-min': '0.5', 'scale-max': '10', 'scale-value': '1', animation: 'true', bindAnimationEnd: '', bindChange: '', bindScale: '', htouchmove: '', vtouchmove: '', width: singleQuote('10px'), height: singleQuote('10px') }, touchEvents);
var ScrollView = Object.assign(Object.assign({ 'scroll-x': 'false', 'scroll-y': 'false', 'upper-threshold': '50', 'lower-threshold': '50', 'scroll-top': '', 'scroll-left': '', 'scroll-into-view': '', 'scroll-with-animation': 'false', 'enable-back-to-top': 'false', 'enable-flex': 'false', 'scroll-anchoring': 'false', 'refresher-enabled': 'false', 'refresher-threshold': '45', 'refresher-default-style': singleQuote('black'), 'refresher-background': singleQuote('#FFF'), 'refresher-triggered': 'false', enhanced: 'false', bounces: 'true', 'show-scrollbar': 'true', 'paging-enabled': 'false', 'fast-deceleration': 'false', bindRefresherPulling: '', bindRefresherRefresh: '', bindRefresherRestore: '', bindRefresherAbort: '', bindScrollToUpper: '', bindScrollToLower: '', bindScroll: '', animation: '', bindTransitionEnd: '', bindAnimationStart: '', bindAnimationIteration: '', bindAnimationEnd: '', bindDragStart: '', bindDragging: '', bindDragEnd: '' }, touchEvents), selectEnv({
alipay: {
'scroll-animation-duration': '',
'trap-scroll': 'false'
}
}));
var Swiper = Object.assign(Object.assign({ 'indicator-dots': 'false', 'indicator-color': singleQuote('rgba(0, 0, 0, .3)'), 'indicator-active-color': singleQuote('#000000'), autoplay: 'false', current: '0', interval: '5000', duration: '500', circular: 'false', vertical: 'false', 'previous-margin': '\'0px\'', 'next-margin': '\'0px\'', 'snap-to-edge': 'false', 'display-multiple-items': '1', 'skip-hidden-item-layout': 'false', 'easing-function': singleQuote('default'), bindChange: '', bindTransition: '', bindAnimationFinish: '' }, touchEvents), selectEnv({
alipay: {
acceleration: 'false',
'disable-touch': 'false'
}
}));
var MovableView = Object.assign(Object.assign({ direction: 'none', inertia: 'false', 'out-of-bounds': 'false', x: '', y: '', damping: '20', friction: '2', disabled: '', scale: 'false', 'scale-min': '0.5', 'scale-max': '10', 'scale-value': '1', animation: 'true', bindChange: '', bindScale: '', htouchmove: '', vtouchmove: '', width: singleQuote('10px'), height: singleQuote('10px') }, touchEvents), animationEvents);
var ScrollView = Object.assign(Object.assign({ 'scroll-x': 'false', 'scroll-y': 'false', 'upper-threshold': '50', 'lower-threshold': '50', 'scroll-top': '', 'scroll-left': '', 'scroll-into-view': '', 'scroll-with-animation': 'false', 'enable-back-to-top': 'false', bindScrollToUpper: '', bindScrollToLower: '', bindScroll: '' }, touchEvents), animationEvents);
var Swiper = Object.assign({ 'indicator-dots': 'false', 'indicator-color': singleQuote('rgba(0, 0, 0, .3)'), 'indicator-active-color': singleQuote('#000000'), autoplay: 'false', current: '0', interval: '5000', duration: '500', circular: 'false', vertical: 'false', 'previous-margin': '\'0px\'', 'next-margin': '\'0px\'', 'display-multiple-items': '1', bindChange: '', bindTransition: '', bindAnimationFinish: '' }, touchEvents);
var SwiperItem = {
'item-id': ''
};
var FunctionalPageNavigator = {
version: singleQuote('release'),
name: '',
args: '',
bindSuccess: '',
bindFail: '',
bindCancel: ''
};
var Navigator = {
target: singleQuote('self'),
url: '',
'open-type': singleQuote('navigate'),
delta: '1',
'app-id': '',
path: '',
'extra-data': '',
version: singleQuote('version'),
'hover-class': singleQuote('navigator-hover'),

@@ -355,15 +292,10 @@ 'hover-stop-propagation': 'false',

var Camera = {
mode: singleQuote('normal'),
'device-position': singleQuote('back'),
flash: singleQuote('auto'),
'frame-size': singleQuote('medium'),
bindStop: '',
bindError: '',
bindInitDone: '',
bindScanCode: ''
bindError: ''
};
var Image = Object.assign({ src: '', mode: singleQuote('scaleToFill'), webp: 'false', 'lazy-load': 'false', 'show-menu-by-longpress': 'false', bindError: '', bindLoad: '' }, touchEvents);
var Image = Object.assign({ src: '', mode: singleQuote('scaleToFill'), 'lazy-load': 'false', bindError: '', bindLoad: '' }, touchEvents);
var LivePlayer = {
src: '',
mode: singleQuote('live'),
autoplay: 'false',

@@ -376,50 +308,7 @@ muted: 'false',

'max-cache': '3',
'sound-mode': singleQuote('speaker'),
'auto-pause-if-navigate': 'true',
'auto-pause-if-open-native': 'true',
'picture-in-picture-mode': '[]',
animation: '',
bindStateChange: '',
bindFullScreenChange: '',
bindNetStatus: '',
bindAudioVolumeNotify: '',
bindEnterPictureInPicture: '',
bindLeavePictureInPicture: ''
bindNetStatus: ''
};
var LivePusher = {
url: '',
mode: singleQuote('RTC'),
autopush: 'false',
muted: 'false',
'enable-camera': 'true',
'auto-focus': 'true',
orientation: singleQuote('vertical'),
beauty: '0',
whiteness: '0',
aspect: singleQuote('9:16'),
'min-bitrate': '200',
'max-bitrate': '1000',
'audio-quality': singleQuote('high'),
'waiting-image': '',
'waiting-image-hash': '',
zoom: 'false',
'device-position': singleQuote('front'),
'background-mute': 'false',
mirror: 'false',
'remote-mirror': 'false',
'local-mirror': 'false',
'audio-reverb-type': '0',
'enable-mic': 'true',
'enable-agc': 'false',
'enable-ans': 'false',
'audio-volume-type': singleQuote('voicecall'),
'video-width': '360',
'video-height': '640',
animation: '',
bindStateChange: '',
bindNetStatus: '',
bindBgmStart: '',
bindBgmProgress: '',
bindBgmComplete: ''
};
var Video = {

@@ -446,20 +335,2 @@ src: '',

'show-mute-btn': 'false',
title: '',
'play-btn-position': singleQuote('bottom'),
'enable-play-gesture': 'false',
'auto-pause-if-navigate': 'true',
'auto-pause-if-open-native': 'true',
'vslide-gesture': 'false',
'vslide-gesture-in-fullscreen': 'true',
'ad-unit-id': '',
'poster-for-crawler': '',
'show-casting-button': 'false',
'picture-in-picture-mode': '[]',
// picture-in-picture-show-progress 属性先注释掉的原因如下:
// 该属性超过了 wxml 属性的长度限制,实际无法使用且导致编译报错。可等微信官方修复后再放开。
// 参考1:https://developers.weixin.qq.com/community/develop/doc/000a429beb87f0eac07acc0fc5b400
// 参考2: https://developers.weixin.qq.com/community/develop/doc/0006883619c48054286a4308258c00?_at=vyxqpllafi
// 'picture-in-picture-show-progress': 'false',
'enable-auto-rotation': 'false',
'show-screen-lock-button': 'false',
animation: '',

@@ -472,71 +343,18 @@ bindPlay: '',

bindWaiting: '',
bindError: '',
bindProgress: '',
bindLoadedMetadata: '',
bindControlsToggle: '',
bindEnterPictureInPicture: '',
bindLeavePictureInPicture: '',
bindSeekComplete: ''
};
var Canvas = {
type: '',
'canvas-id': '',
'disable-scroll': 'false',
bindTouchStart: '',
bindTouchMove: '',
bindTouchEnd: '',
bindTouchCancel: '',
bindLongtap: '',
bindError: ''
};
var Ad = Object.assign({ 'ad-intervals': '', 'ad-type': singleQuote('banner'), 'ad-theme': singleQuote('white'), bindLoad: '', bindError: '', bindClose: '' }, selectEnv({
swan: {
appid: '',
apid: '',
type: singleQuote('feed'),
updatetime: '',
bindStatus: ''
},
default: {
'unit-id': ''
}
}));
var OfficialAccount = {
var Canvas = Object.assign({ 'canvas-id': '', 'disable-scroll': 'false', bindError: '' }, touchEvents);
var Ad = {
'unit-id': '',
'ad-intervals': '',
bindLoad: '',
bindError: ''
bindError: '',
bindClose: ''
};
var OpenData = {
type: '',
'open-gid': '',
lang: singleQuote('en'),
'default-text': '',
'default-avatar': '',
bindError: ''
};
var WebView = {
src: '',
bindMessage: '',
bindLoad: ''
bindLoad: '',
bindError: ''
};
var NavigationBar = {
title: '',
loading: 'false',
'front-color': '',
'background-color': '',
'color-animation-duration': '0',
'color-animation-timing-func': singleQuote('linear')
};
var PageMeta = {
'background-text-style': '',
'background-color': '',
'background-color-top': '',
'background-color-bottom': '',
'scroll-top': singleQuote(''),
'scroll-duration': '300',
'page-style': singleQuote(''),
'root-font-size': singleQuote(''),
bindResize: '',
bindScroll: '',
bindScrollDone: ''
};
var Block = {};

@@ -563,3 +381,2 @@ // For Vue,因为 slot 标签被 vue 占用了

CheckboxGroup: CheckboxGroup,
Editor: Editor,
Form: Form,

@@ -578,3 +395,2 @@ Input: Input,

CoverView: CoverView,
MatchMedia: MatchMedia,
MovableArea: MovableArea,

@@ -585,3 +401,2 @@ MovableView: MovableView,

SwiperItem: SwiperItem,
FunctionalPageNavigator: FunctionalPageNavigator,
Navigator: Navigator,

@@ -592,13 +407,8 @@ Audio: Audio,

LivePlayer: LivePlayer,
LivePusher: LivePusher,
Video: Video,
Canvas: Canvas,
Ad: Ad,
OfficialAccount: OfficialAccount,
OpenData: OpenData,
WebView: WebView,
NavigationBar: NavigationBar,
PageMeta: PageMeta,
Block: Block,
Map: Map$1,
Map: MapComp,
Slot: Slot,

@@ -619,5 +429,35 @@ SlotView: SlotView

'input',
'textarea'
]);
var voidElements = new Set([
'progress',
'icon',
'rich-text',
'input',
'textarea',
'editor'
'slider',
'switch',
'audio',
'ad',
'official-account',
'open-data',
'navigation-bar'
]);
var nestElements = new Map([
['view', -1],
['catch-view', -1],
['cover-view', -1],
['static-view', -1],
['pure-view', -1],
['block', -1],
['text', -1],
['static-text', 6],
['slot', 8],
['slot-view', 8],
['label', 6],
['form', 4],
['scroll-view', 4],
['swiper', 4],
['swiper-item', 4]
]);

@@ -630,2 +470,3 @@ var EMPTY_OBJ = {};

};
var defaultReconciler = {};
/**

@@ -664,2 +505,5 @@ * box creates a boxed value.

}
var toKebabCase = function (string) {
return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
};
function capitalize(s) {

@@ -689,2 +533,83 @@ return s.charAt(0).toUpperCase() + s.slice(1);

}
function queryToJson(str) {
var dec = decodeURIComponent;
var qp = str.split('&');
var ret = {};
var name;
var val;
for (var i = 0, l = qp.length, item = (void 0); i < l; ++i) {
item = qp[i];
if (item.length) {
var s = item.indexOf('=');
if (s < 0) {
name = dec(item);
val = '';
}
else {
name = dec(item.slice(0, s));
val = dec(item.slice(s + 1));
}
if (typeof ret[name] === 'string') { // inline'd type check
ret[name] = [ret[name]];
}
if (Array.isArray(ret[name])) {
ret[name].push(val);
}
else {
ret[name] = val;
}
}
}
return ret; // Object
}
var _uniqueId = 1;
var _loadTime = (new Date()).getTime().toString();
function getUniqueKey() {
return _loadTime + (_uniqueId++);
}
var cacheData = {};
function cacheDataSet(key, val) {
cacheData[key] = val;
}
function cacheDataGet(key, delelteAfterGet) {
var temp = cacheData[key];
delelteAfterGet && delete cacheData[key];
return temp;
}
function cacheDataHas(key) {
return key in cacheData;
}
function mergeInternalComponents(components) {
Object.keys(components).forEach(function (name) {
if (name in internalComponents) {
Object.assign(internalComponents[name], components[name]);
}
else {
internalComponents[name] = components[name];
}
});
}
function mergeReconciler(hostConfig) {
Object.assign(defaultReconciler, hostConfig);
}
function unsupport(api) {
return function () {
console.warn(("小程序暂不支持 " + api));
};
}
function setUniqueKeyToRoute(key, obj) {
var routerParamsPrivateKey = '__key_';
var useDataCacheApis = [
'navigateTo',
'redirectTo',
'reLaunch',
'switchTab'
];
if (useDataCacheApis.indexOf(key) > -1) {
var url = obj.url = obj.url || '';
var hasMark = url.indexOf('?') > -1;
var cacheKey = getUniqueKey();
obj.url += (hasMark ? '&' : '?') + routerParamsPrivateKey + "=" + cacheKey;
}
}

@@ -704,31 +629,2 @@ /**

*/
var voidElements = new Set([
'progress',
'icon',
'rich-text',
'input',
'textarea',
'slider',
'switch',
'audio',
'live-pusher',
'video',
'ad',
'official-account',
'open-data',
'navigation-bar'
]);
var nestElements = new Map([
['view', -1],
['cover-view', -1],
['block', -1],
['text', -1],
['slot', 8],
['slot-view', 8],
['label', 6],
['form', 4],
['scroll-view', 4],
['swiper', 4],
['swiper-item', 4]
]);
var weixinAdapter = {

@@ -751,4 +647,12 @@ if: 'wx:if',

this.Adapter = weixinAdapter;
/** 组件列表 */
this.internalComponents = internalComponents;
/** 可以 focus 聚焦的组件 */
this.focusComponents = focusComponents;
/** 不需要渲染子节点的元素 */
this.voidElements = voidElements;
/** 可以递归调用自身的组件 */
this.nestElements = nestElements;
this.buildPageTemplate = function (baseTempPath) {
var template = "<import src=\"" + baseTempPath + "\"/>\n <template is=\"taro_tmpl\" data=\"{{" + (this$1.dataKeymap('root:root')) + "}}\" />";
var template = "<import src=\"" + baseTempPath + "\"/>\n<template is=\"taro_tmpl\" data=\"{{" + (this$1.dataKeymap('root:root')) + "}}\" />";
return template;

@@ -760,4 +664,11 @@ };

: this$1.dataKeymap('i:i');
return ("<import src=\"./base" + ext + "\" />\n <template is=\"tmpl_0_" + ("container") + "\" data=\"{{" + data + "}}\" />");
return ("<import src=\"./base" + ext + "\" />\n<template is=\"tmpl_0_" + ("container") + "\" data=\"{{" + data + "}}\" />");
};
this.buildCustomComponentTemplate = function (ext) {
var Adapter = this$1.Adapter;
var data = !this$1.isSupportRecursive && this$1.supportXS
? ("" + (this$1.dataKeymap('i:item,l:\'\'')))
: this$1.dataKeymap('i:item');
return ("<import src=\"./base" + ext + "\" />\n <block " + (Adapter.for) + "=\"{{i." + ("cn") + "}}\" " + (Adapter.key) + "=\"uid\">\n <template is=\"tmpl_0_container\" data=\"{{" + data + "}}\" />\n </block>");
};
this.buildXScript = function () {

@@ -771,3 +682,3 @@ return ((this$1.exportExpr) + " {\n a: " + (this$1.buildXSTmplName()) + ",\n b: function (a, b) {\n return a === undefined ? b : a\n },\n c: function(i, prefix) {\n var s = i.focus !== undefined ? 'focus' : 'blur'\n return prefix + i." + ("nn") + " + '_' + s\n },\n d: function (i, v) {\n return i === undefined ? v : i\n },\n e: function (n) {\n return 'tmpl_' + n + '_" + ("container") + "'\n },\n " + (this$1.buildXSTmpExtra()) + "\n}");

return Object.keys(attrs)
.map(function (k) { return (k + "=\"" + (k.startsWith('bind') || k.startsWith('on') ? attrs[k] : ("{" + (this$1.getAttrValue(attrs[k], k, nodeName)) + "}")) + "\" "); })
.map(function (k) { return (k + "=\"" + (k.startsWith('bind') || k.startsWith('on') || k.startsWith('catch') ? attrs[k] : ("{" + (this$1.getAttrValue(attrs[k], k, nodeName)) + "}")) + "\" "); })
.join('');

@@ -817,2 +728,29 @@ };

}
if (compName === 'view') {
var reg = /^(bind|on)(touchmove|TouchMove)$/;
var comp = Object.assign({}, newComp);
Object.keys(comp).forEach(function (originKey) {
if (!reg.test(originKey))
{ return; }
var key = originKey.replace(reg, 'catch$2');
comp[key] = comp[originKey];
delete comp[originKey];
});
result['catch-view'] = comp;
}
if (compName === 'view' || compName === 'text' || compName === 'image') {
var comp$1 = {};
Object.keys(newComp).forEach(function (key) {
var value = newComp[key];
if (value !== 'eh')
{ comp$1[key] = value; }
});
result[("static-" + compName)] = comp$1;
if (compName === 'view') {
result['pure-view'] = {
style: comp$1.style,
class: comp$1.class
};
}
}
if (compName === 'slot' || compName === 'slot-view') {

@@ -839,4 +777,9 @@ result[compName] = {

return Array.from(attrs).reduce(function (str, attr) {
if (attr.startsWith('@')) { // vue event
return str + "bind" + (attr.slice(1)) + "=\"eh\" ";
if (attr.startsWith('@')) {
// vue2
var value = attr.slice(1);
if (value.indexOf('-') > -1) {
value = ":" + value;
}
return str + "bind" + value + "=\"eh\" ";
}

@@ -847,3 +790,9 @@ else if (attr.startsWith('bind')) {

else if (attr.startsWith('on')) {
return str + "bind" + (attr.slice(2).toLowerCase()) + "=\"eh\" ";
// react, vue3
var value$1 = toKebabCase(attr.slice(2));
if (value$1.indexOf('-') > -1) {
// 兼容如 vant 某些组件的 bind:a-b 这类属性
value$1 = ":" + value$1;
}
return str + "bind" + value$1 + "=\"eh\" ";
}

@@ -854,3 +803,3 @@ return str + attr + "=\"{{i." + (toCamelCase(attr)) + "}}\" ";

BaseTemplate.prototype.buildComponentTemplate = function buildComponentTemplate (comp, level) {
return focusComponents.has(comp.nodeName)
return this.focusComponents.has(comp.nodeName)
? this.buildFocusComponentTemplte(comp, level)

@@ -872,3 +821,3 @@ : this.buildStandardComponentTemplate(comp, level);

var nextLevel = isSupportRecursive ? 0 : level + 1;
var data = !this.isSupportRecursive
var data = !this.isSupportRecursive && this.supportXS
? ("" + (this.dataKeymap('i:item,l:l')))

@@ -878,7 +827,7 @@ : this.dataKeymap('i:item');

? ("<template is=\"{{xs.e(" + (isSupportRecursive ? 0 : 'cid+1') + ")}}\" data=\"{{" + data + "}}\" />")
: ("<template is=\"tmpl_" + nextLevel + "_" + ("container") + "\" data=\"{{" + (this.dataKeymap('i:item')) + "}}\" />");
: ("<template is=\"tmpl_" + nextLevel + "_" + ("container") + "\" data=\"{{" + data + "}}\" />");
if (isFunction(this.modifyLoopBody)) {
child = this.modifyLoopBody(child, comp.nodeName);
}
var children = voidElements.has(comp.nodeName)
var children = this.voidElements.has(comp.nodeName)
? ''

@@ -889,3 +838,21 @@ : ("\n <block " + (Adapter.for) + "=\"{{i." + ("cn") + "}}\" " + (Adapter.key) + "=\"uid\">\n " + child + "\n </block>\n ");

}
var nodeName = comp.nodeName === 'slot' || comp.nodeName === 'slot-view' ? 'view' : comp.nodeName;
var nodeName = '';
switch (comp.nodeName) {
case 'slot':
case 'slot-view':
case 'catch-view':
case 'static-view':
case 'pure-view':
nodeName = 'view';
break;
case 'static-text':
nodeName = 'text';
break;
case 'static-image':
nodeName = 'image';
break;
default:
nodeName = comp.nodeName;
break;
}
var res = "\n<template name=\"tmpl_" + level + "_" + (comp.nodeName) + "\">\n <" + nodeName + " " + (this.buildAttribute(comp.attributes, comp.nodeName)) + " id=\"{{i.uid}}\">" + children + "</" + nodeName + ">\n</template>\n";

@@ -906,9 +873,21 @@ if (isFunction(this.modifyTemplateResult)) {

var isSupportRecursive = ref.isSupportRecursive;
var supportXS = ref.supportXS;
var nestElements = ref.nestElements;
var nextLevel = isSupportRecursive ? 0 : level + 1;
var template = '';
var data = !this.isSupportRecursive && this.supportXS
var data = !isSupportRecursive && supportXS
? ("" + (this.dataKeymap('i:item,l:l')))
: this.dataKeymap('i:item');
componentConfig.thirdPartyComponents.forEach(function (attrs, compName) {
template += "\n<template name=\"tmpl_" + level + "_" + compName + "\">\n <" + compName + " " + (this$1.buildThirdPartyAttr(attrs)) + " id=\"{{i.uid}}\">\n <block " + (Adapter.for) + "=\"{{i." + ("cn") + "}}\" " + (Adapter.key) + "=\"uid\">\n <template is=\"tmpl_" + nextLevel + "_" + ("container") + "\" data=\"{{" + data + "}}\" />\n </block>\n </" + compName + ">\n</template>\n ";
if (compName === 'custom-wrapper') {
template += "\n<template name=\"tmpl_" + level + "_" + compName + "\">\n <" + compName + " i=\"{{i}}\" l=\"{{l}}\" id=\"{{i.uid}}\">\n </" + compName + ">\n</template>\n ";
}
else {
if (!isSupportRecursive && supportXS && nestElements.has(compName) && level + 1 > nestElements.get(compName))
{ return; }
var child = supportXS
? ("<template is=\"{{xs.e(" + (isSupportRecursive ? 0 : 'cid+1') + ")}}\" data=\"{{" + data + "}}\" />")
: ("<template is=\"tmpl_" + nextLevel + "_" + ("container") + "\" data=\"{{" + data + "}}\" />");
template += "\n<template name=\"tmpl_" + level + "_" + compName + "\">\n <" + compName + " " + (this$1.buildThirdPartyAttr(attrs)) + " id=\"{{i.uid}}\">\n <block " + (Adapter.for) + "=\"{{i." + ("cn") + "}}\" " + (Adapter.key) + "=\"uid\">\n " + child + "\n </block>\n </" + compName + ">\n</template>\n ";
}
});

@@ -922,8 +901,3 @@ return template;

if (restart) {
if (!this.isSupportRecursive && this.supportXS) {
tmpl = '<comp i="{{i}}" l="{{l}}" />';
}
else {
tmpl = '<comp i="{{i}}" />';
}
tmpl = "<block " + (this.Adapter.if) + "=\"{{i.nn === '#text'}}\">\n <template is=\"tmpl_0_#text\" data=\"{{i:i}}\" />\n </block>\n <block " + (this.Adapter.else) + ">\n " + (!this.isSupportRecursive && this.supportXS ? '<comp i="{{i}}" l="{{l}}" />' : '<comp i="{{i}}" />') + "\n </block>";
}

@@ -955,2 +929,5 @@ else {

};
BaseTemplate.prototype.mergeComponents = function mergeComponents (ctx, patch) {
ctx.helper.recursiveMerge(this.internalComponents, patch);
};
BaseTemplate.prototype.buildXSTmplName = function buildXSTmplName () {

@@ -971,3 +948,3 @@ return "function (l, n) {\n return 'tmpl_' + l + '_' + n\n }";

if (!this$1.miniComponents) {
this$1.miniComponents = this$1.createMiniComponents(internalComponents);
this$1.miniComponents = this$1.createMiniComponents(this$1.internalComponents);
}

@@ -1004,3 +981,3 @@ var ZERO_FLOOR = 0;

if (!this$1.miniComponents) {
this$1.miniComponents = this$1.createMiniComponents(internalComponents);
this$1.miniComponents = this$1.createMiniComponents(this$1.internalComponents);
}

@@ -1053,3 +1030,3 @@ var components = Object.keys(this$1.miniComponents)

if (level !== 0) {
if (!nestElements.has(nodeName)) {
if (!this$1.nestElements.has(nodeName)) {
// 不可嵌套自身的组件只需输出一层模板

@@ -1060,3 +1037,3 @@ return current;

// 部分可嵌套自身的组件实际上不会嵌套过深,这里按阈值限制层数
var max = nestElements.get(nodeName);
var max = this$1.nestElements.get(nodeName);
if (max > 0 && level >= max) {

@@ -1077,15 +1054,20 @@ return current;

UnRecursiveTemplate.prototype.buildXSTmplName = function buildXSTmplName () {
var comps = Array.from(nestElements.keys()).concat( Array.from(this.componentConfig.thirdPartyComponents.keys())
var isLoopComps = Array.from(this.nestElements.keys()).concat( Array.from(this.componentConfig.thirdPartyComponents.keys())
);
var isLoopCompsSet = new Set(isLoopComps);
var hasMaxComps = [];
nestElements.forEach(function (max, comp) {
if (max > -1)
{ hasMaxComps.push(comp); }
this.nestElements.forEach(function (max, comp) {
if (max > 1) {
hasMaxComps.push(comp);
}
else if (max === 1 && isLoopCompsSet.has(comp)) {
isLoopCompsSet.delete(comp);
}
});
return ("function (l, n, s) {\n var a = " + (JSON.stringify(comps)) + "\n var b = " + (JSON.stringify(hasMaxComps)) + "\n if (a.indexOf(n) === -1) {\n l = 0\n }\n if (b.indexOf(n) > -1) {\n var u = s.split(',')\n var depth = 0\n for (var i = 0; i < u.length; i++) {\n if (u[i] === n) depth++\n }\n l = depth\n }\n return 'tmpl_' + l + '_' + n\n }");
return ("function (l, n, s) {\n var a = " + (JSON.stringify(Array.from(isLoopCompsSet))) + "\n var b = " + (JSON.stringify(hasMaxComps)) + "\n if (a.indexOf(n) === -1) {\n l = 0\n }\n if (b.indexOf(n) > -1) {\n var u = s.split(',')\n var depth = 0\n for (var i = 0; i < u.length; i++) {\n if (u[i] === n) depth++\n }\n l = depth\n }\n return 'tmpl_' + l + '_' + n\n }");
};
UnRecursiveTemplate.prototype.buildXSTmpExtra = function buildXSTmpExtra () {
var hasMaxComps = [];
nestElements.forEach(function (max, comp) {
if (max > -1)
this.nestElements.forEach(function (max, comp) {
if (max > 1)
{ hasMaxComps.push(comp); }

@@ -1101,2 +1083,379 @@ });

var noPromiseApis = new Set([
'clearStorageSync',
'getBatteryInfoSync',
'getExtConfigSync',
'getFileSystemManager',
'getLaunchOptionsSync',
'getStorageInfoSync',
'getStorageSync',
'getSystemInfoSync',
'offAccelerometerChange',
'offAppHide',
'offAppShow',
'offAudioInterruptionBegin',
'offAudioInterruptionEnd',
'offBLECharacteristicValueChange',
'offBLEConnectionStateChange',
'offBluetoothAdapterStateChange',
'offBluetoothDeviceFound',
'offCompassChange',
'offError',
'offGetWifiList',
'offGyroscopeChange',
'offMemoryWarning',
'offNetworkStatusChange',
'offPageNotFound',
'offUnhandledRejection',
'offUserCaptureScreen',
'onAccelerometerChange',
'onAppHide',
'onAppShow',
'onAudioInterruptionBegin',
'onAudioInterruptionEnd',
'onBLECharacteristicValueChange',
'onBLEConnectionStateChange',
'onBeaconServiceChange',
'onBeaconUpdate',
'onBluetoothAdapterStateChange',
'onBluetoothDeviceFound',
'onCompassChange',
'onDeviceMotionChange',
'onError',
'onGetWifiList',
'onGyroscopeChange',
'onMemoryWarning',
'onNetworkStatusChange',
'onPageNotFound',
'onSocketClose',
'onSocketError',
'onSocketMessage',
'onSocketOpen',
'onUnhandledRejection',
'onUserCaptureScreen',
'removeStorageSync',
'reportAnalytics',
'setStorageSync',
'arrayBufferToBase64',
'base64ToArrayBuffer',
'canIUse',
'createAnimation',
'createCameraContext',
'createCanvasContext',
'createInnerAudioContext',
'createIntersectionObserver',
'createInterstitialAd',
'createLivePlayerContext',
'createMapContext',
'createSelectorQuery',
'createVideoContext',
'getBackgroundAudioManager',
'getMenuButtonBoundingClientRect',
'getRecorderManager',
'getUpdateManager'
]);
var needPromiseApis = new Set([
'addPhoneContact',
'authorize',
'canvasGetImageData',
'canvasPutImageData',
'canvasToTempFilePath',
'checkSession',
'chooseAddress',
'chooseImage',
'chooseInvoiceTitle',
'chooseLocation',
'chooseVideo',
'clearStorage',
'closeBLEConnection',
'closeBluetoothAdapter',
'closeSocket',
'compressImage',
'connectSocket',
'createBLEConnection',
'downloadFile',
'getAvailableAudioSources',
'getBLEDeviceCharacteristics',
'getBLEDeviceServices',
'getBatteryInfo',
'getBeacons',
'getBluetoothAdapterState',
'getBluetoothDevices',
'getClipboardData',
'getConnectedBluetoothDevices',
'getConnectedWifi',
'getExtConfig',
'getFileInfo',
'getImageInfo',
'getLocation',
'getNetworkType',
'getSavedFileInfo',
'getSavedFileList',
'getScreenBrightness',
'getSetting',
'getStorage',
'getStorageInfo',
'getSystemInfo',
'getUserInfo',
'getWifiList',
'hideHomeButton',
'hideShareMenu',
'hideTabBar',
'hideTabBarRedDot',
'loadFontFace',
'login',
'makePhoneCall',
'navigateBack',
'navigateBackMiniProgram',
'navigateTo',
'navigateToBookshelf',
'navigateToMiniProgram',
'notifyBLECharacteristicValueChange',
'hideKeyboard',
'hideLoading',
'hideNavigationBarLoading',
'hideToast',
'openBluetoothAdapter',
'openDocument',
'openLocation',
'openSetting',
'pageScrollTo',
'previewImage',
'queryBookshelf',
'reLaunch',
'readBLECharacteristicValue',
'redirectTo',
'removeSavedFile',
'removeStorage',
'removeTabBarBadge',
'requestSubscribeMessage',
'saveFile',
'saveImageToPhotosAlbum',
'saveVideoToPhotosAlbum',
'scanCode',
'sendSocketMessage',
'setBackgroundColor',
'setBackgroundTextStyle',
'setClipboardData',
'setEnableDebug',
'setInnerAudioOption',
'setKeepScreenOn',
'setNavigationBarColor',
'setNavigationBarTitle',
'setScreenBrightness',
'setStorage',
'setTabBarBadge',
'setTabBarItem',
'setTabBarStyle',
'showActionSheet',
'showFavoriteGuide',
'showLoading',
'showModal',
'showShareMenu',
'showTabBar',
'showTabBarRedDot',
'showToast',
'startBeaconDiscovery',
'startBluetoothDevicesDiscovery',
'startDeviceMotionListening',
'startPullDownRefresh',
'stopBeaconDiscovery',
'stopBluetoothDevicesDiscovery',
'stopCompass',
'startCompass',
'startAccelerometer',
'stopAccelerometer',
'showNavigationBarLoading',
'stopDeviceMotionListening',
'stopPullDownRefresh',
'switchTab',
'uploadFile',
'vibrateLong',
'vibrateShort',
'writeBLECharacteristicValue'
]);
function getCanIUseWebp(taro) {
return function () {
if (typeof taro.getSystemInfoSync !== 'function') {
console.error('不支持 API canIUseWebp');
return false;
}
var ref = taro.getSystemInfoSync();
var platform = ref.platform;
var platformLower = platform.toLowerCase();
if (platformLower === 'android' || platformLower === 'devtools') {
return true;
}
return false;
};
}
function getNormalRequest(global) {
return function request(options) {
options = options || {};
if (typeof options === 'string') {
options = {
url: options
};
}
var originSuccess = options.success;
var originFail = options.fail;
var originComplete = options.complete;
var requestTask;
var p = new Promise(function (resolve, reject) {
options.success = function (res) {
originSuccess && originSuccess(res);
resolve(res);
};
options.fail = function (res) {
originFail && originFail(res);
reject(res);
};
options.complete = function (res) {
originComplete && originComplete(res);
};
requestTask = global.request(options);
});
p.abort = function (cb) {
cb && cb();
if (requestTask) {
requestTask.abort();
}
return p;
};
return p;
};
}
function processApis(taro, global, config) {
if ( config === void 0 ) config = {};
var patchNoPromiseApis = config.noPromiseApis || [];
var patchNeedPromiseApis = config.needPromiseApis || [];
var _noPromiseApis = new Set(patchNoPromiseApis.concat( noPromiseApis));
var _needPromiseApis = new Set(patchNeedPromiseApis.concat( needPromiseApis));
var apis = _noPromiseApis.concat( _needPromiseApis);
apis.forEach(function (key) {
if (_needPromiseApis.has(key)) {
var originKey = key;
taro[originKey] = function (options) {
if ( options === void 0 ) options = {};
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
var key = originKey;
// 第一个参数 options 为字符串,单独处理
if (typeof options === 'string') {
if (args.length) {
return global[key].apply(global, [ options ].concat( args ));
}
return global[key](options);
}
// 改变 key 或 option 字段,如需要把支付宝标准的字段对齐微信标准的字段
if (config.transformMeta) {
var transformResult = config.transformMeta(key, options);
key = transformResult.key;
options = transformResult.options;
// 新 key 可能不存在
if (!global.hasOwnProperty(key)) {
return unsupport(key)();
}
}
var task = null;
var obj = Object.assign({}, options);
// 为页面跳转相关的 API 设置一个随机数作为路由参数。为了给 runtime 区分页面。
setUniqueKeyToRoute(key, options);
// Promise 化
var p = new Promise(function (resolve, reject) {
obj.success = function (res) {
var _a, _b;
(_a = config.modifyAsyncResult) === null || _a === void 0 ? void 0 : _a.call(config, key, res);
(_b = options.success) === null || _b === void 0 ? void 0 : _b.call(options, res);
if (key === 'connectSocket') {
resolve(Promise.resolve().then(function () { return Object.assign(task, res); }));
}
else {
resolve(res);
}
};
obj.fail = function (res) {
var _a;
(_a = options.fail) === null || _a === void 0 ? void 0 : _a.call(options, res);
reject(res);
};
obj.complete = function (res) {
var _a;
(_a = options.complete) === null || _a === void 0 ? void 0 : _a.call(options, res);
};
if (args.length) {
task = global[key].apply(global, [ obj ].concat( args ));
}
else {
task = global[key](obj);
}
});
// 给 promise 对象挂载属性
if (key === 'uploadFile' || key === 'downloadFile') {
p.progress = function (cb) {
task === null || task === void 0 ? void 0 : task.onProgressUpdate(cb);
return p;
};
p.abort = function (cb) {
cb === null || cb === void 0 ? void 0 : cb();
task === null || task === void 0 ? void 0 : task.abort();
return p;
};
}
return p;
};
}
else {
// API 不存在
if (!global.hasOwnProperty(key)) {
taro[key] = unsupport(key);
return;
}
taro[key] = function () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
if (config.handleSyncApis) {
return config.handleSyncApis(key, global, args);
}
else {
return global[key].apply(global, args);
}
};
}
});
!config.isOnlyPromisify && equipCommonApis(taro, global, config);
}
/**
* 挂载常用 API
* @param taro Taro 对象
* @param global 小程序全局对象,如微信的 wx,支付宝的 my
*/
function equipCommonApis(taro, global, apis) {
if ( apis === void 0 ) apis = {};
taro.canIUseWebp = getCanIUseWebp(taro);
taro.getCurrentPages = getCurrentPages || unsupport('getCurrentPages');
taro.getApp = getApp || unsupport('getApp');
taro.env = global.env || {};
try {
taro.requirePlugin = requirePlugin || unsupport('requirePlugin');
}
catch (error) {
taro.requirePlugin = unsupport('requirePlugin');
}
// request & interceptors
var request = apis.request ? apis.request : getNormalRequest(global);
function taroInterceptor(chain) {
return request(chain.requestParams);
}
var link = new taro.Link(taroInterceptor);
taro.request = link.request.bind(link);
taro.addInterceptor = link.addInterceptor.bind(link);
taro.cleanInterceptors = link.cleanInterceptors.bind(link);
taro.miniGlobal = global;
}
exports.BaseTemplate = BaseTemplate;

@@ -1107,8 +1466,14 @@ exports.EMPTY_ARR = EMPTY_ARR;

exports.UnRecursiveTemplate = UnRecursiveTemplate;
exports.animationEvents = animationEvents;
exports.box = box;
exports.cacheDataGet = cacheDataGet;
exports.cacheDataHas = cacheDataHas;
exports.cacheDataSet = cacheDataSet;
exports.capitalize = capitalize;
exports.controlledComponent = controlledComponent;
exports.defaultReconciler = defaultReconciler;
exports.ensure = ensure;
exports.events = events;
exports.focusComponents = focusComponents;
exports.getUniqueKey = getUniqueKey;
exports.hasOwn = hasOwn;

@@ -1125,3 +1490,9 @@ exports.internalComponents = internalComponents;

exports.isUndefined = isUndefined;
exports.mergeInternalComponents = mergeInternalComponents;
exports.mergeReconciler = mergeReconciler;
exports.nestElements = nestElements;
exports.noop = noop;
exports.processApis = processApis;
exports.queryToJson = queryToJson;
exports.setUniqueKeyToRoute = setUniqueKeyToRoute;
exports.singleQuote = singleQuote;

@@ -1132,4 +1503,8 @@ exports.specialEvents = specialEvents;

exports.toDashed = toDashed;
exports.toKebabCase = toKebabCase;
exports.touchEvents = touchEvents;
exports.unbox = unbox;
exports.unsupport = unsupport;
exports.voidElements = voidElements;
exports.warn = warn;
//# sourceMappingURL=index.js.map

@@ -6,5 +6,5 @@ export declare function isString(o: unknown): o is string;

export declare function isBoolean(o: unknown): o is boolean;
export declare function isFunction(o: unknown): o is Function;
export declare function isFunction(o: unknown): o is (...args: any[]) => any;
export declare function isNumber(o: unknown): o is number;
export declare function isBooleanStringLiteral(o: unknown): o is string;
export declare const isArray: (arg: any) => arg is any[];

@@ -27,24 +27,2 @@ function isString(o) {

function selectEnv(options) {
let option;
if (process.env.TARO_ENV === 'alipay') {
option = options.alipay;
}
else if (process.env.TARO_ENV === 'jd') {
option = options.jd;
}
else if (process.env.TARO_ENV === 'qq') {
option = options.qq;
}
else if (process.env.TARO_ENV === 'swan') {
option = options.swan;
}
else if (process.env.TARO_ENV === 'tt') {
option = options.tt;
}
else if (process.env.TARO_ENV === 'weapp') {
option = options.weapp;
}
return option || options.default || Object.create(null);
}
const styles = {

@@ -64,2 +42,8 @@ style: `i.${"st" /* Style */}`,

};
const animationEvents = {
bindAnimationStart: '',
bindAnimationIteration: '',
bindAnimationEnd: '',
bindTransitionEnd: ''
};
const specialEvents = new Set([

@@ -72,3 +56,3 @@ 'htouchmove',

}
const View = Object.assign({ 'hover-class': singleQuote('none'), 'hover-stop-propagation': 'false', 'hover-start-time': '50', 'hover-stay-time': '400', animation: '', bindAnimationStart: '', bindAnimationIteration: '', bindAnimationEnd: '', bindTransitionEnd: '' }, touchEvents);
const View = Object.assign(Object.assign({ 'hover-class': singleQuote('none'), 'hover-stop-propagation': 'false', 'hover-start-time': '50', 'hover-stay-time': '400', animation: '' }, touchEvents), animationEvents);
const Icon = {

@@ -79,15 +63,5 @@ type: '',

};
const Map$1 = Object.assign(Object.assign({ longitude: '', latitude: '', scale: '16', markers: '[]', covers: '', polyline: '[]', circles: '[]', controls: '', 'include-points': '[]', 'show-location': '', polygons: '', subkey: '', 'layer-style': '1', rotate: '0', skew: 'skew', 'enable-3D': 'false', 'show-compass': 'false', 'show-scale': 'false', 'enable-overlooking': 'false', 'enable-zoom': 'true', 'enable-scroll': 'true', 'enable-rotate': 'false', 'enable-satellite': 'false', 'enable-traffic': 'false', bindMarkerTap: '', bindLabelTap: '', bindControlTap: '', bindCalloutTap: '', bindUpdated: '', bindRegionChange: '', bindPoiTap: '' }, touchEvents), selectEnv({
alipay: {
setting: '{}'
},
default: {
setting: '[]'
}
}));
const MapComp = Object.assign({ longitude: '', latitude: '', scale: '16', markers: '[]', covers: '', polyline: '[]', circles: '[]', controls: '[]', 'include-points': '[]', 'show-location': '', 'layer-style': '1', bindMarkerTap: '', bindControlTap: '', bindCalloutTap: '', bindUpdated: '' }, touchEvents);
const Progress = {
percent: '',
'show-info': 'false',
'border-radius': '0',
'font-size': '16',
'stroke-width': '6',

@@ -99,8 +73,6 @@ color: singleQuote('#09BB07'),

'active-mode': singleQuote('backwards'),
duration: '30',
bindActiveEnd: ''
'show-info': 'false'
};
const RichText = {
nodes: '[]',
space: ''
nodes: '[]'
};

@@ -112,9 +84,16 @@ const Text = {

};
const Button = Object.assign({ size: singleQuote('default'), type: '', plain: 'false', disabled: '', loading: 'false', 'form-type': '', 'open-type': '', 'hover-class': singleQuote('button-hover'), 'hover-stop-propagation': 'false', 'hover-start-time': '20', 'hover-stay-time': '70', lang: 'en', 'session-from': '', 'send-message-title': '', 'send-message-path': '', 'send-message-img': '', 'app-parameter': '', 'show-message-card': 'false', bindGetUserInfo: '', bindGetAuthorize: '', bindContact: '', bindGetPhoneNumber: '', bindError: '', bindOpenSetting: '', bindLaunchApp: '', scope: '', name: '' }, selectEnv({
qq: {
'app-packagename': '',
'app-bundleid': '',
'app-connect-id': ''
}
}));
const Button = {
size: singleQuote('default'),
type: '',
plain: 'false',
disabled: '',
loading: 'false',
'form-type': '',
'open-type': '',
'hover-class': singleQuote('button-hover'),
'hover-stop-propagation': 'false',
'hover-start-time': '20',
'hover-stay-time': '70',
name: ''
};
const Checkbox = {

@@ -131,32 +110,30 @@ value: '',

};
const Editor = {
'read-only': 'false',
const Form = {
'report-submit': 'false',
bindSubmit: '',
bindReset: '',
name: ''
};
const Input = {
value: '',
type: singleQuote(''),
password: 'false',
placeholder: '',
'show-img-size': 'false',
'show-img-toolbar': 'false',
'show-img-resize': 'false',
'placeholder-style': '',
'placeholder-class': singleQuote('input-placeholder'),
disabled: '',
maxlength: '140',
'cursor-spacing': '0',
focus: 'false',
bindReady: '',
'confirm-type': singleQuote('done'),
'confirm-hold': 'false',
cursor: 'i.value.length',
'selection-start': '-1',
'selection-end': '-1',
bindInput: '',
bindFocus: '',
bindBlur: '',
bindInput: '',
bindStatusChange: '',
bindConfirm: '',
name: ''
};
const Form = {
'report-submit': 'false',
'report-submit-timeout': '0',
bindSubmit: '',
bindReset: '',
name: ''
};
const Input = Object.assign({ value: '', type: singleQuote(''), password: 'false', placeholder: '', 'placeholder-style': '', 'placeholder-class': singleQuote('input-placeholder'), disabled: '', maxlength: '140', 'cursor-spacing': '0', 'auto-focus': 'false', focus: 'false', 'confirm-type': singleQuote('done'), 'confirm-hold': 'false', cursor: 'i.value.length', 'selection-start': '-1', 'selection-end': '-1', 'adjust-position': 'true', 'hold-keyboard': 'false', bindInput: '', bindFocus: '', bindBlur: '', bindConfirm: '', bindKeyboardHeightChange: '', name: '' }, selectEnv({
alipay: {
'random-number': 'false',
controlled: 'false'
},
weapp: {
'always-embed': 'false'
}
}));
const Label = {

@@ -169,8 +146,5 @@ for: '',

disabled: '',
bindCancel: '',
range: '',
'range-key': '',
value: '',
bindChange: '',
bindColumnChange: '',
start: '',

@@ -180,3 +154,6 @@ end: '',

'custom-item': '',
name: ''
name: '',
bindCancel: '',
bindChange: '',
bindColumnChange: ''
};

@@ -190,4 +167,2 @@ const PickerView = {

bindChange: '',
bindPickStart: '',
bindPickEnd: '',
name: ''

@@ -215,4 +190,2 @@ };

value: '0',
color: singleQuote('#e9e9e9'),
'selected-color': singleQuote('#1aad19'),
activeColor: singleQuote('#1aad19'),

@@ -235,7 +208,2 @@ backgroundColor: singleQuote('#e9e9e9'),

};
const CoverImage = {
src: '',
bindLoad: 'eh',
bindError: 'eh'
};
const Textarea = {

@@ -254,7 +222,4 @@ value: '',

cursor: '-1',
'show-confirm-bar': 'true',
'selection-start': '-1',
'selection-end': '-1',
'adjust-position': 'true',
'hold-keyboard': 'false',
bindFocus: '',

@@ -265,51 +230,23 @@ bindBlur: '',

bindConfirm: '',
bindKeyboardHeightChange: '',
name: ''
};
const CoverImage = {
src: '',
bindLoad: 'eh',
bindError: 'eh'
};
const CoverView = Object.assign({ 'scroll-top': 'false' }, touchEvents);
const MatchMedia = {
'min-width': '',
'max-width': '',
width: '',
'min-height': '',
'max-height': '',
height: '',
orientation: ''
};
const MovableArea = {
'scale-area': 'false'
};
const MovableView = Object.assign({ direction: 'none', inertia: 'false', 'out-of-bounds': 'false', x: '', y: '', damping: '20', friction: '2', disabled: '', scale: 'false', 'scale-min': '0.5', 'scale-max': '10', 'scale-value': '1', animation: 'true', bindAnimationEnd: '', bindChange: '', bindScale: '', htouchmove: '', vtouchmove: '', width: singleQuote('10px'), height: singleQuote('10px') }, touchEvents);
const ScrollView = Object.assign(Object.assign({ 'scroll-x': 'false', 'scroll-y': 'false', 'upper-threshold': '50', 'lower-threshold': '50', 'scroll-top': '', 'scroll-left': '', 'scroll-into-view': '', 'scroll-with-animation': 'false', 'enable-back-to-top': 'false', 'enable-flex': 'false', 'scroll-anchoring': 'false', 'refresher-enabled': 'false', 'refresher-threshold': '45', 'refresher-default-style': singleQuote('black'), 'refresher-background': singleQuote('#FFF'), 'refresher-triggered': 'false', enhanced: 'false', bounces: 'true', 'show-scrollbar': 'true', 'paging-enabled': 'false', 'fast-deceleration': 'false', bindRefresherPulling: '', bindRefresherRefresh: '', bindRefresherRestore: '', bindRefresherAbort: '', bindScrollToUpper: '', bindScrollToLower: '', bindScroll: '', animation: '', bindTransitionEnd: '', bindAnimationStart: '', bindAnimationIteration: '', bindAnimationEnd: '', bindDragStart: '', bindDragging: '', bindDragEnd: '' }, touchEvents), selectEnv({
alipay: {
'scroll-animation-duration': '',
'trap-scroll': 'false'
}
}));
const Swiper = Object.assign(Object.assign({ 'indicator-dots': 'false', 'indicator-color': singleQuote('rgba(0, 0, 0, .3)'), 'indicator-active-color': singleQuote('#000000'), autoplay: 'false', current: '0', interval: '5000', duration: '500', circular: 'false', vertical: 'false', 'previous-margin': '\'0px\'', 'next-margin': '\'0px\'', 'snap-to-edge': 'false', 'display-multiple-items': '1', 'skip-hidden-item-layout': 'false', 'easing-function': singleQuote('default'), bindChange: '', bindTransition: '', bindAnimationFinish: '' }, touchEvents), selectEnv({
alipay: {
acceleration: 'false',
'disable-touch': 'false'
}
}));
const MovableView = Object.assign(Object.assign({ direction: 'none', inertia: 'false', 'out-of-bounds': 'false', x: '', y: '', damping: '20', friction: '2', disabled: '', scale: 'false', 'scale-min': '0.5', 'scale-max': '10', 'scale-value': '1', animation: 'true', bindChange: '', bindScale: '', htouchmove: '', vtouchmove: '', width: singleQuote('10px'), height: singleQuote('10px') }, touchEvents), animationEvents);
const ScrollView = Object.assign(Object.assign({ 'scroll-x': 'false', 'scroll-y': 'false', 'upper-threshold': '50', 'lower-threshold': '50', 'scroll-top': '', 'scroll-left': '', 'scroll-into-view': '', 'scroll-with-animation': 'false', 'enable-back-to-top': 'false', bindScrollToUpper: '', bindScrollToLower: '', bindScroll: '' }, touchEvents), animationEvents);
const Swiper = Object.assign({ 'indicator-dots': 'false', 'indicator-color': singleQuote('rgba(0, 0, 0, .3)'), 'indicator-active-color': singleQuote('#000000'), autoplay: 'false', current: '0', interval: '5000', duration: '500', circular: 'false', vertical: 'false', 'previous-margin': '\'0px\'', 'next-margin': '\'0px\'', 'display-multiple-items': '1', bindChange: '', bindTransition: '', bindAnimationFinish: '' }, touchEvents);
const SwiperItem = {
'item-id': ''
};
const FunctionalPageNavigator = {
version: singleQuote('release'),
name: '',
args: '',
bindSuccess: '',
bindFail: '',
bindCancel: ''
};
const Navigator = {
target: singleQuote('self'),
url: '',
'open-type': singleQuote('navigate'),
delta: '1',
'app-id': '',
path: '',
'extra-data': '',
version: singleQuote('version'),
'hover-class': singleQuote('navigator-hover'),

@@ -338,15 +275,10 @@ 'hover-stop-propagation': 'false',

const Camera = {
mode: singleQuote('normal'),
'device-position': singleQuote('back'),
flash: singleQuote('auto'),
'frame-size': singleQuote('medium'),
bindStop: '',
bindError: '',
bindInitDone: '',
bindScanCode: ''
bindError: ''
};
const Image = Object.assign({ src: '', mode: singleQuote('scaleToFill'), webp: 'false', 'lazy-load': 'false', 'show-menu-by-longpress': 'false', bindError: '', bindLoad: '' }, touchEvents);
const Image = Object.assign({ src: '', mode: singleQuote('scaleToFill'), 'lazy-load': 'false', bindError: '', bindLoad: '' }, touchEvents);
const LivePlayer = {
src: '',
mode: singleQuote('live'),
autoplay: 'false',

@@ -359,50 +291,7 @@ muted: 'false',

'max-cache': '3',
'sound-mode': singleQuote('speaker'),
'auto-pause-if-navigate': 'true',
'auto-pause-if-open-native': 'true',
'picture-in-picture-mode': '[]',
animation: '',
bindStateChange: '',
bindFullScreenChange: '',
bindNetStatus: '',
bindAudioVolumeNotify: '',
bindEnterPictureInPicture: '',
bindLeavePictureInPicture: ''
bindNetStatus: ''
};
const LivePusher = {
url: '',
mode: singleQuote('RTC'),
autopush: 'false',
muted: 'false',
'enable-camera': 'true',
'auto-focus': 'true',
orientation: singleQuote('vertical'),
beauty: '0',
whiteness: '0',
aspect: singleQuote('9:16'),
'min-bitrate': '200',
'max-bitrate': '1000',
'audio-quality': singleQuote('high'),
'waiting-image': '',
'waiting-image-hash': '',
zoom: 'false',
'device-position': singleQuote('front'),
'background-mute': 'false',
mirror: 'false',
'remote-mirror': 'false',
'local-mirror': 'false',
'audio-reverb-type': '0',
'enable-mic': 'true',
'enable-agc': 'false',
'enable-ans': 'false',
'audio-volume-type': singleQuote('voicecall'),
'video-width': '360',
'video-height': '640',
animation: '',
bindStateChange: '',
bindNetStatus: '',
bindBgmStart: '',
bindBgmProgress: '',
bindBgmComplete: ''
};
const Video = {

@@ -429,20 +318,2 @@ src: '',

'show-mute-btn': 'false',
title: '',
'play-btn-position': singleQuote('bottom'),
'enable-play-gesture': 'false',
'auto-pause-if-navigate': 'true',
'auto-pause-if-open-native': 'true',
'vslide-gesture': 'false',
'vslide-gesture-in-fullscreen': 'true',
'ad-unit-id': '',
'poster-for-crawler': '',
'show-casting-button': 'false',
'picture-in-picture-mode': '[]',
// picture-in-picture-show-progress 属性先注释掉的原因如下:
// 该属性超过了 wxml 属性的长度限制,实际无法使用且导致编译报错。可等微信官方修复后再放开。
// 参考1:https://developers.weixin.qq.com/community/develop/doc/000a429beb87f0eac07acc0fc5b400
// 参考2: https://developers.weixin.qq.com/community/develop/doc/0006883619c48054286a4308258c00?_at=vyxqpllafi
// 'picture-in-picture-show-progress': 'false',
'enable-auto-rotation': 'false',
'show-screen-lock-button': 'false',
animation: '',

@@ -455,71 +326,18 @@ bindPlay: '',

bindWaiting: '',
bindError: '',
bindProgress: '',
bindLoadedMetadata: '',
bindControlsToggle: '',
bindEnterPictureInPicture: '',
bindLeavePictureInPicture: '',
bindSeekComplete: ''
};
const Canvas = {
type: '',
'canvas-id': '',
'disable-scroll': 'false',
bindTouchStart: '',
bindTouchMove: '',
bindTouchEnd: '',
bindTouchCancel: '',
bindLongtap: '',
bindError: ''
};
const Ad = Object.assign({ 'ad-intervals': '', 'ad-type': singleQuote('banner'), 'ad-theme': singleQuote('white'), bindLoad: '', bindError: '', bindClose: '' }, selectEnv({
swan: {
appid: '',
apid: '',
type: singleQuote('feed'),
updatetime: '',
bindStatus: ''
},
default: {
'unit-id': ''
}
}));
const OfficialAccount = {
const Canvas = Object.assign({ 'canvas-id': '', 'disable-scroll': 'false', bindError: '' }, touchEvents);
const Ad = {
'unit-id': '',
'ad-intervals': '',
bindLoad: '',
bindError: ''
bindError: '',
bindClose: ''
};
const OpenData = {
type: '',
'open-gid': '',
lang: singleQuote('en'),
'default-text': '',
'default-avatar': '',
bindError: ''
};
const WebView = {
src: '',
bindMessage: '',
bindLoad: ''
bindLoad: '',
bindError: ''
};
const NavigationBar = {
title: '',
loading: 'false',
'front-color': '',
'background-color': '',
'color-animation-duration': '0',
'color-animation-timing-func': singleQuote('linear')
};
const PageMeta = {
'background-text-style': '',
'background-color': '',
'background-color-top': '',
'background-color-bottom': '',
'scroll-top': singleQuote(''),
'scroll-duration': '300',
'page-style': singleQuote(''),
'root-font-size': singleQuote(''),
bindResize: '',
bindScroll: '',
bindScrollDone: ''
};
const Block = {};

@@ -546,3 +364,2 @@ // For Vue,因为 slot 标签被 vue 占用了

CheckboxGroup,
Editor,
Form,

@@ -561,3 +378,2 @@ Input,

CoverView,
MatchMedia,
MovableArea,

@@ -568,3 +384,2 @@ MovableView,

SwiperItem,
FunctionalPageNavigator,
Navigator,

@@ -575,13 +390,8 @@ Audio,

LivePlayer,
LivePusher,
Video,
Canvas,
Ad,
OfficialAccount,
OpenData,
WebView,
NavigationBar,
PageMeta,
Block,
Map: Map$1,
Map: MapComp,
Slot,

@@ -602,5 +412,35 @@ SlotView

'input',
'textarea'
]);
const voidElements = new Set([
'progress',
'icon',
'rich-text',
'input',
'textarea',
'editor'
'slider',
'switch',
'audio',
'ad',
'official-account',
'open-data',
'navigation-bar'
]);
const nestElements = new Map([
['view', -1],
['catch-view', -1],
['cover-view', -1],
['static-view', -1],
['pure-view', -1],
['block', -1],
['text', -1],
['static-text', 6],
['slot', 8],
['slot-view', 8],
['label', 6],
['form', 4],
['scroll-view', 4],
['swiper', 4],
['swiper-item', 4]
]);

@@ -610,2 +450,3 @@ const EMPTY_OBJ = {};

const noop = (..._) => { };
const defaultReconciler = {};
/**

@@ -644,2 +485,5 @@ * box creates a boxed value.

}
const toKebabCase = function (string) {
return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
};
function capitalize(s) {

@@ -669,2 +513,83 @@ return s.charAt(0).toUpperCase() + s.slice(1);

}
function queryToJson(str) {
const dec = decodeURIComponent;
const qp = str.split('&');
const ret = {};
let name;
let val;
for (let i = 0, l = qp.length, item; i < l; ++i) {
item = qp[i];
if (item.length) {
const s = item.indexOf('=');
if (s < 0) {
name = dec(item);
val = '';
}
else {
name = dec(item.slice(0, s));
val = dec(item.slice(s + 1));
}
if (typeof ret[name] === 'string') { // inline'd type check
ret[name] = [ret[name]];
}
if (Array.isArray(ret[name])) {
ret[name].push(val);
}
else {
ret[name] = val;
}
}
}
return ret; // Object
}
let _uniqueId = 1;
const _loadTime = (new Date()).getTime().toString();
function getUniqueKey() {
return _loadTime + (_uniqueId++);
}
const cacheData = {};
function cacheDataSet(key, val) {
cacheData[key] = val;
}
function cacheDataGet(key, delelteAfterGet) {
const temp = cacheData[key];
delelteAfterGet && delete cacheData[key];
return temp;
}
function cacheDataHas(key) {
return key in cacheData;
}
function mergeInternalComponents(components) {
Object.keys(components).forEach(name => {
if (name in internalComponents) {
Object.assign(internalComponents[name], components[name]);
}
else {
internalComponents[name] = components[name];
}
});
}
function mergeReconciler(hostConfig) {
Object.assign(defaultReconciler, hostConfig);
}
function unsupport(api) {
return function () {
console.warn(`小程序暂不支持 ${api}`);
};
}
function setUniqueKeyToRoute(key, obj) {
const routerParamsPrivateKey = '__key_';
const useDataCacheApis = [
'navigateTo',
'redirectTo',
'reLaunch',
'switchTab'
];
if (useDataCacheApis.indexOf(key) > -1) {
const url = obj.url = obj.url || '';
const hasMark = url.indexOf('?') > -1;
const cacheKey = getUniqueKey();
obj.url += (hasMark ? '&' : '?') + `${routerParamsPrivateKey}=${cacheKey}`;
}
}

@@ -684,31 +609,2 @@ /**

*/
const voidElements = new Set([
'progress',
'icon',
'rich-text',
'input',
'textarea',
'slider',
'switch',
'audio',
'live-pusher',
'video',
'ad',
'official-account',
'open-data',
'navigation-bar'
]);
const nestElements = new Map([
['view', -1],
['cover-view', -1],
['block', -1],
['text', -1],
['slot', 8],
['slot-view', 8],
['label', 6],
['form', 4],
['scroll-view', 4],
['swiper', 4],
['swiper-item', 4]
]);
const weixinAdapter = {

@@ -730,5 +626,13 @@ if: 'wx:if',

this.Adapter = weixinAdapter;
/** 组件列表 */
this.internalComponents = internalComponents;
/** 可以 focus 聚焦的组件 */
this.focusComponents = focusComponents;
/** 不需要渲染子节点的元素 */
this.voidElements = voidElements;
/** 可以递归调用自身的组件 */
this.nestElements = nestElements;
this.buildPageTemplate = (baseTempPath) => {
const template = `<import src="${baseTempPath}"/>
<template is="taro_tmpl" data="{{${this.dataKeymap('root:root')}}}" />`;
<template is="taro_tmpl" data="{{${this.dataKeymap('root:root')}}}" />`;
return template;

@@ -741,4 +645,14 @@ };

return `<import src="./base${ext}" />
<template is="tmpl_0_${"container" /* Container */}" data="{{${data}}}" />`;
<template is="tmpl_0_${"container" /* Container */}" data="{{${data}}}" />`;
};
this.buildCustomComponentTemplate = (ext) => {
const Adapter = this.Adapter;
const data = !this.isSupportRecursive && this.supportXS
? `${this.dataKeymap('i:item,l:\'\'')}`
: this.dataKeymap('i:item');
return `<import src="./base${ext}" />
<block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="uid">
<template is="tmpl_0_container" data="{{${data}}}" />
</block>`;
};
this.buildXScript = () => {

@@ -766,3 +680,3 @@ return `${this.exportExpr} {

return Object.keys(attrs)
.map(k => `${k}="${k.startsWith('bind') || k.startsWith('on') ? attrs[k] : `{${this.getAttrValue(attrs[k], k, nodeName)}}`}" `)
.map(k => `${k}="${k.startsWith('bind') || k.startsWith('on') || k.startsWith('catch') ? attrs[k] : `{${this.getAttrValue(attrs[k], k, nodeName)}}`}" `)
.join('');

@@ -812,2 +726,29 @@ }

}
if (compName === 'view') {
const reg = /^(bind|on)(touchmove|TouchMove)$/;
const comp = Object.assign({}, newComp);
Object.keys(comp).forEach(originKey => {
if (!reg.test(originKey))
return;
const key = originKey.replace(reg, 'catch$2');
comp[key] = comp[originKey];
delete comp[originKey];
});
result['catch-view'] = comp;
}
if (compName === 'view' || compName === 'text' || compName === 'image') {
const comp = {};
Object.keys(newComp).forEach(key => {
const value = newComp[key];
if (value !== 'eh')
comp[key] = value;
});
result[`static-${compName}`] = comp;
if (compName === 'view') {
result['pure-view'] = {
style: comp.style,
class: comp.class
};
}
}
if (compName === 'slot' || compName === 'slot-view') {

@@ -840,4 +781,9 @@ result[compName] = {

return Array.from(attrs).reduce((str, attr) => {
if (attr.startsWith('@')) { // vue event
return str + `bind${attr.slice(1)}="eh" `;
if (attr.startsWith('@')) {
// vue2
let value = attr.slice(1);
if (value.indexOf('-') > -1) {
value = `:${value}`;
}
return str + `bind${value}="eh" `;
}

@@ -848,3 +794,9 @@ else if (attr.startsWith('bind')) {

else if (attr.startsWith('on')) {
return str + `bind${attr.slice(2).toLowerCase()}="eh" `;
// react, vue3
let value = toKebabCase(attr.slice(2));
if (value.indexOf('-') > -1) {
// 兼容如 vant 某些组件的 bind:a-b 这类属性
value = `:${value}`;
}
return str + `bind${value}="eh" `;
}

@@ -855,3 +807,3 @@ return str + `${attr}="{{i.${toCamelCase(attr)}}}" `;

buildComponentTemplate(comp, level) {
return focusComponents.has(comp.nodeName)
return this.focusComponents.has(comp.nodeName)
? this.buildFocusComponentTemplte(comp, level)

@@ -883,3 +835,3 @@ : this.buildStandardComponentTemplate(comp, level);

const nextLevel = isSupportRecursive ? 0 : level + 1;
const data = !this.isSupportRecursive
const data = !this.isSupportRecursive && this.supportXS
? `${this.dataKeymap('i:item,l:l')}`

@@ -889,7 +841,7 @@ : this.dataKeymap('i:item');

? `<template is="{{xs.e(${isSupportRecursive ? 0 : 'cid+1'})}}" data="{{${data}}}" />`
: `<template is="tmpl_${nextLevel}_${"container" /* Container */}" data="{{${this.dataKeymap('i:item')}}}" />`;
: `<template is="tmpl_${nextLevel}_${"container" /* Container */}" data="{{${data}}}" />`;
if (isFunction(this.modifyLoopBody)) {
child = this.modifyLoopBody(child, comp.nodeName);
}
let children = voidElements.has(comp.nodeName)
let children = this.voidElements.has(comp.nodeName)
? ''

@@ -904,3 +856,21 @@ : `

}
const nodeName = comp.nodeName === 'slot' || comp.nodeName === 'slot-view' ? 'view' : comp.nodeName;
let nodeName = '';
switch (comp.nodeName) {
case 'slot':
case 'slot-view':
case 'catch-view':
case 'static-view':
case 'pure-view':
nodeName = 'view';
break;
case 'static-text':
nodeName = 'text';
break;
case 'static-image':
nodeName = 'image';
break;
default:
nodeName = comp.nodeName;
break;
}
let res = `

@@ -924,14 +894,28 @@ <template name="tmpl_${level}_${comp.nodeName}">

buildThirdPartyTemplate(level, componentConfig) {
const { Adapter, isSupportRecursive } = this;
const { Adapter, isSupportRecursive, supportXS, nestElements } = this;
const nextLevel = isSupportRecursive ? 0 : level + 1;
let template = '';
const data = !this.isSupportRecursive && this.supportXS
const data = !isSupportRecursive && supportXS
? `${this.dataKeymap('i:item,l:l')}`
: this.dataKeymap('i:item');
componentConfig.thirdPartyComponents.forEach((attrs, compName) => {
template += `
if (compName === 'custom-wrapper') {
template += `
<template name="tmpl_${level}_${compName}">
<${compName} i="{{i}}" l="{{l}}" id="{{i.uid}}">
</${compName}>
</template>
`;
}
else {
if (!isSupportRecursive && supportXS && nestElements.has(compName) && level + 1 > nestElements.get(compName))
return;
const child = supportXS
? `<template is="{{xs.e(${isSupportRecursive ? 0 : 'cid+1'})}}" data="{{${data}}}" />`
: `<template is="tmpl_${nextLevel}_${"container" /* Container */}" data="{{${data}}}" />`;
template += `
<template name="tmpl_${level}_${compName}">
<${compName} ${this.buildThirdPartyAttr(attrs)} id="{{i.uid}}">
<block ${Adapter.for}="{{i.${"cn" /* Childnodes */}}}" ${Adapter.key}="uid">
<template is="tmpl_${nextLevel}_${"container" /* Container */}" data="{{${data}}}" />
${child}
</block>

@@ -941,2 +925,3 @@ </${compName}>

`;
}
});

@@ -948,8 +933,8 @@ return template;

if (restart) {
if (!this.isSupportRecursive && this.supportXS) {
tmpl = '<comp i="{{i}}" l="{{l}}" />';
}
else {
tmpl = '<comp i="{{i}}" />';
}
tmpl = `<block ${this.Adapter.if}="{{i.nn === '#text'}}">
<template is="tmpl_0_#text" data="{{i:i}}" />
</block>
<block ${this.Adapter.else}>
${!this.isSupportRecursive && this.supportXS ? '<comp i="{{i}}" l="{{l}}" />' : '<comp i="{{i}}" />'}
</block>`;
}

@@ -985,2 +970,5 @@ else {

}
mergeComponents(ctx, patch) {
ctx.helper.recursiveMerge(this.internalComponents, patch);
}
buildXSTmplName() {

@@ -1002,3 +990,3 @@ return `function (l, n) {

if (!this.miniComponents) {
this.miniComponents = this.createMiniComponents(internalComponents);
this.miniComponents = this.createMiniComponents(this.internalComponents);
}

@@ -1027,3 +1015,3 @@ const ZERO_FLOOR = 0;

if (!this.miniComponents) {
this.miniComponents = this.createMiniComponents(internalComponents);
this.miniComponents = this.createMiniComponents(this.internalComponents);
}

@@ -1064,3 +1052,3 @@ const components = Object.keys(this.miniComponents)

if (level !== 0) {
if (!nestElements.has(nodeName)) {
if (!this.nestElements.has(nodeName)) {
// 不可嵌套自身的组件只需输出一层模板

@@ -1071,3 +1059,3 @@ return current;

// 部分可嵌套自身的组件实际上不会嵌套过深,这里按阈值限制层数
const max = nestElements.get(nodeName);
const max = this.nestElements.get(nodeName);
if (max > 0 && level >= max) {

@@ -1088,13 +1076,18 @@ return current;

buildXSTmplName() {
const comps = [
...Array.from(nestElements.keys()),
const isLoopComps = [
...Array.from(this.nestElements.keys()),
...Array.from(this.componentConfig.thirdPartyComponents.keys())
];
const isLoopCompsSet = new Set(isLoopComps);
const hasMaxComps = [];
nestElements.forEach((max, comp) => {
if (max > -1)
this.nestElements.forEach((max, comp) => {
if (max > 1) {
hasMaxComps.push(comp);
}
else if (max === 1 && isLoopCompsSet.has(comp)) {
isLoopCompsSet.delete(comp);
}
});
return `function (l, n, s) {
var a = ${JSON.stringify(comps)}
var a = ${JSON.stringify(Array.from(isLoopCompsSet))}
var b = ${JSON.stringify(hasMaxComps)}

@@ -1117,4 +1110,4 @@ if (a.indexOf(n) === -1) {

const hasMaxComps = [];
nestElements.forEach((max, comp) => {
if (max > -1)
this.nestElements.forEach((max, comp) => {
if (max > 1)
hasMaxComps.push(comp);

@@ -1133,3 +1126,368 @@ });

export { BaseTemplate, EMPTY_ARR, EMPTY_OBJ, RecursiveTemplate, UnRecursiveTemplate, box, capitalize, controlledComponent, ensure, events, focusComponents, hasOwn, internalComponents, isArray, isBoolean, isBooleanStringLiteral, isFunction, isNull, isNumber, isObject, isString, isUndefined, noop, singleQuote, specialEvents, styles, toCamelCase, toDashed, unbox, warn };
const noPromiseApis = new Set([
'clearStorageSync',
'getBatteryInfoSync',
'getExtConfigSync',
'getFileSystemManager',
'getLaunchOptionsSync',
'getStorageInfoSync',
'getStorageSync',
'getSystemInfoSync',
'offAccelerometerChange',
'offAppHide',
'offAppShow',
'offAudioInterruptionBegin',
'offAudioInterruptionEnd',
'offBLECharacteristicValueChange',
'offBLEConnectionStateChange',
'offBluetoothAdapterStateChange',
'offBluetoothDeviceFound',
'offCompassChange',
'offError',
'offGetWifiList',
'offGyroscopeChange',
'offMemoryWarning',
'offNetworkStatusChange',
'offPageNotFound',
'offUnhandledRejection',
'offUserCaptureScreen',
'onAccelerometerChange',
'onAppHide',
'onAppShow',
'onAudioInterruptionBegin',
'onAudioInterruptionEnd',
'onBLECharacteristicValueChange',
'onBLEConnectionStateChange',
'onBeaconServiceChange',
'onBeaconUpdate',
'onBluetoothAdapterStateChange',
'onBluetoothDeviceFound',
'onCompassChange',
'onDeviceMotionChange',
'onError',
'onGetWifiList',
'onGyroscopeChange',
'onMemoryWarning',
'onNetworkStatusChange',
'onPageNotFound',
'onSocketClose',
'onSocketError',
'onSocketMessage',
'onSocketOpen',
'onUnhandledRejection',
'onUserCaptureScreen',
'removeStorageSync',
'reportAnalytics',
'setStorageSync',
'arrayBufferToBase64',
'base64ToArrayBuffer',
'canIUse',
'createAnimation',
'createCameraContext',
'createCanvasContext',
'createInnerAudioContext',
'createIntersectionObserver',
'createInterstitialAd',
'createLivePlayerContext',
'createMapContext',
'createSelectorQuery',
'createVideoContext',
'getBackgroundAudioManager',
'getMenuButtonBoundingClientRect',
'getRecorderManager',
'getUpdateManager'
]);
const needPromiseApis = new Set([
'addPhoneContact',
'authorize',
'canvasGetImageData',
'canvasPutImageData',
'canvasToTempFilePath',
'checkSession',
'chooseAddress',
'chooseImage',
'chooseInvoiceTitle',
'chooseLocation',
'chooseVideo',
'clearStorage',
'closeBLEConnection',
'closeBluetoothAdapter',
'closeSocket',
'compressImage',
'connectSocket',
'createBLEConnection',
'downloadFile',
'getAvailableAudioSources',
'getBLEDeviceCharacteristics',
'getBLEDeviceServices',
'getBatteryInfo',
'getBeacons',
'getBluetoothAdapterState',
'getBluetoothDevices',
'getClipboardData',
'getConnectedBluetoothDevices',
'getConnectedWifi',
'getExtConfig',
'getFileInfo',
'getImageInfo',
'getLocation',
'getNetworkType',
'getSavedFileInfo',
'getSavedFileList',
'getScreenBrightness',
'getSetting',
'getStorage',
'getStorageInfo',
'getSystemInfo',
'getUserInfo',
'getWifiList',
'hideHomeButton',
'hideShareMenu',
'hideTabBar',
'hideTabBarRedDot',
'loadFontFace',
'login',
'makePhoneCall',
'navigateBack',
'navigateBackMiniProgram',
'navigateTo',
'navigateToBookshelf',
'navigateToMiniProgram',
'notifyBLECharacteristicValueChange',
'hideKeyboard',
'hideLoading',
'hideNavigationBarLoading',
'hideToast',
'openBluetoothAdapter',
'openDocument',
'openLocation',
'openSetting',
'pageScrollTo',
'previewImage',
'queryBookshelf',
'reLaunch',
'readBLECharacteristicValue',
'redirectTo',
'removeSavedFile',
'removeStorage',
'removeTabBarBadge',
'requestSubscribeMessage',
'saveFile',
'saveImageToPhotosAlbum',
'saveVideoToPhotosAlbum',
'scanCode',
'sendSocketMessage',
'setBackgroundColor',
'setBackgroundTextStyle',
'setClipboardData',
'setEnableDebug',
'setInnerAudioOption',
'setKeepScreenOn',
'setNavigationBarColor',
'setNavigationBarTitle',
'setScreenBrightness',
'setStorage',
'setTabBarBadge',
'setTabBarItem',
'setTabBarStyle',
'showActionSheet',
'showFavoriteGuide',
'showLoading',
'showModal',
'showShareMenu',
'showTabBar',
'showTabBarRedDot',
'showToast',
'startBeaconDiscovery',
'startBluetoothDevicesDiscovery',
'startDeviceMotionListening',
'startPullDownRefresh',
'stopBeaconDiscovery',
'stopBluetoothDevicesDiscovery',
'stopCompass',
'startCompass',
'startAccelerometer',
'stopAccelerometer',
'showNavigationBarLoading',
'stopDeviceMotionListening',
'stopPullDownRefresh',
'switchTab',
'uploadFile',
'vibrateLong',
'vibrateShort',
'writeBLECharacteristicValue'
]);
function getCanIUseWebp(taro) {
return function () {
if (typeof taro.getSystemInfoSync !== 'function') {
console.error('不支持 API canIUseWebp');
return false;
}
const { platform } = taro.getSystemInfoSync();
const platformLower = platform.toLowerCase();
if (platformLower === 'android' || platformLower === 'devtools') {
return true;
}
return false;
};
}
function getNormalRequest(global) {
return function request(options) {
options = options || {};
if (typeof options === 'string') {
options = {
url: options
};
}
const originSuccess = options.success;
const originFail = options.fail;
const originComplete = options.complete;
let requestTask;
const p = new Promise((resolve, reject) => {
options.success = res => {
originSuccess && originSuccess(res);
resolve(res);
};
options.fail = res => {
originFail && originFail(res);
reject(res);
};
options.complete = res => {
originComplete && originComplete(res);
};
requestTask = global.request(options);
});
p.abort = (cb) => {
cb && cb();
if (requestTask) {
requestTask.abort();
}
return p;
};
return p;
};
}
function processApis(taro, global, config = {}) {
const patchNoPromiseApis = config.noPromiseApis || [];
const patchNeedPromiseApis = config.needPromiseApis || [];
const _noPromiseApis = new Set([...patchNoPromiseApis, ...noPromiseApis]);
const _needPromiseApis = new Set([...patchNeedPromiseApis, ...needPromiseApis]);
const apis = [..._noPromiseApis, ..._needPromiseApis];
apis.forEach(key => {
if (_needPromiseApis.has(key)) {
const originKey = key;
taro[originKey] = (options = {}, ...args) => {
let key = originKey;
// 第一个参数 options 为字符串,单独处理
if (typeof options === 'string') {
if (args.length) {
return global[key](options, ...args);
}
return global[key](options);
}
// 改变 key 或 option 字段,如需要把支付宝标准的字段对齐微信标准的字段
if (config.transformMeta) {
const transformResult = config.transformMeta(key, options);
key = transformResult.key;
options = transformResult.options;
// 新 key 可能不存在
if (!global.hasOwnProperty(key)) {
return unsupport(key)();
}
}
let task = null;
const obj = Object.assign({}, options);
// 为页面跳转相关的 API 设置一个随机数作为路由参数。为了给 runtime 区分页面。
setUniqueKeyToRoute(key, options);
// Promise 化
const p = new Promise((resolve, reject) => {
obj.success = res => {
var _a, _b;
(_a = config.modifyAsyncResult) === null || _a === void 0 ? void 0 : _a.call(config, key, res);
(_b = options.success) === null || _b === void 0 ? void 0 : _b.call(options, res);
if (key === 'connectSocket') {
resolve(Promise.resolve().then(() => Object.assign(task, res)));
}
else {
resolve(res);
}
};
obj.fail = res => {
var _a;
(_a = options.fail) === null || _a === void 0 ? void 0 : _a.call(options, res);
reject(res);
};
obj.complete = res => {
var _a;
(_a = options.complete) === null || _a === void 0 ? void 0 : _a.call(options, res);
};
if (args.length) {
task = global[key](obj, ...args);
}
else {
task = global[key](obj);
}
});
// 给 promise 对象挂载属性
if (key === 'uploadFile' || key === 'downloadFile') {
p.progress = cb => {
task === null || task === void 0 ? void 0 : task.onProgressUpdate(cb);
return p;
};
p.abort = cb => {
cb === null || cb === void 0 ? void 0 : cb();
task === null || task === void 0 ? void 0 : task.abort();
return p;
};
}
return p;
};
}
else {
// API 不存在
if (!global.hasOwnProperty(key)) {
taro[key] = unsupport(key);
return;
}
taro[key] = (...args) => {
if (config.handleSyncApis) {
return config.handleSyncApis(key, global, args);
}
else {
return global[key].apply(global, args);
}
};
}
});
!config.isOnlyPromisify && equipCommonApis(taro, global, config);
}
/**
* 挂载常用 API
* @param taro Taro 对象
* @param global 小程序全局对象,如微信的 wx,支付宝的 my
*/
function equipCommonApis(taro, global, apis = {}) {
taro.canIUseWebp = getCanIUseWebp(taro);
taro.getCurrentPages = getCurrentPages || unsupport('getCurrentPages');
taro.getApp = getApp || unsupport('getApp');
taro.env = global.env || {};
try {
taro.requirePlugin = requirePlugin || unsupport('requirePlugin');
}
catch (error) {
taro.requirePlugin = unsupport('requirePlugin');
}
// request & interceptors
const request = apis.request ? apis.request : getNormalRequest(global);
function taroInterceptor(chain) {
return request(chain.requestParams);
}
const link = new taro.Link(taroInterceptor);
taro.request = link.request.bind(link);
taro.addInterceptor = link.addInterceptor.bind(link);
taro.cleanInterceptors = link.cleanInterceptors.bind(link);
taro.miniGlobal = global;
}
export { BaseTemplate, EMPTY_ARR, EMPTY_OBJ, RecursiveTemplate, UnRecursiveTemplate, animationEvents, box, cacheDataGet, cacheDataHas, cacheDataSet, capitalize, controlledComponent, defaultReconciler, ensure, events, focusComponents, getUniqueKey, hasOwn, internalComponents, isArray, isBoolean, isBooleanStringLiteral, isFunction, isNull, isNumber, isObject, isString, isUndefined, mergeInternalComponents, mergeReconciler, nestElements, noop, processApis, queryToJson, setUniqueKeyToRoute, singleQuote, specialEvents, styles, toCamelCase, toDashed, toKebabCase, touchEvents, unbox, unsupport, voidElements, warn };
//# sourceMappingURL=shared.esm.js.map

@@ -49,2 +49,10 @@ /**

Adapter: IAdapter;
/** 组件列表 */
internalComponents: Record<string, Record<string, string>>;
/** 可以 focus 聚焦的组件 */
focusComponents: Set<string>;
/** 不需要渲染子节点的元素 */
voidElements: Set<string>;
/** 可以递归调用自身的组件 */
nestElements: Map<string, number>;
private buildAttribute;

@@ -67,3 +75,5 @@ protected replacePropName(name: string, value: string, _componentName?: string): string;

buildBaseComponentTemplate: (ext: string) => string;
buildCustomComponentTemplate: (ext: string) => string;
buildXScript: () => string;
mergeComponents(ctx: any, patch: Record<string, Record<string, string>>): void;
protected buildXSTmplName(): string;

@@ -70,0 +80,0 @@ protected buildXSTmpExtra(): string;

export declare const EMPTY_OBJ: any;
export declare const EMPTY_ARR: never[];
export declare const noop: (..._: unknown[]) => void;
export declare const defaultReconciler: {};
/**

@@ -32,4 +33,5 @@ * Boxed value.

export declare function toCamelCase(s: string): string;
export declare const toKebabCase: (string: any) => any;
export declare function capitalize(s: string): string;
export declare const hasOwn: (val: object, key: string | symbol) => any;
export declare const hasOwn: (val: Record<any, any>, key: string | symbol) => any;
/**

@@ -43,1 +45,10 @@ * ensure takes a condition and throw a error if the condition fails,

export declare function warn(condition: boolean, msg: string): void;
export declare function queryToJson(str: any): {};
export declare function getUniqueKey(): string;
export declare function cacheDataSet(key: any, val: any): void;
export declare function cacheDataGet(key: any, delelteAfterGet?: any): any;
export declare function cacheDataHas(key: any): boolean;
export declare function mergeInternalComponents(components: any): void;
export declare function mergeReconciler(hostConfig: any): void;
export declare function unsupport(api: any): () => void;
export declare function setUniqueKeyToRoute(key: string, obj: any): void;
{
"name": "@tarojs/shared",
"version": "3.2.0-beta.0",
"version": "3.2.0-beta.1",
"description": "> TODO: description",

@@ -9,3 +9,3 @@ "author": "yuche <i@yuche.me>",

"main": "dist/index.js",
"module": "dist/index.esm.js",
"module": "dist/shared.esm.js",
"types": "dist/index.d.ts",

@@ -29,3 +29,3 @@ "files": [

},
"gitHead": "2b734bbdae643a14d6c046d658a74292702be570"
"gitHead": "af5df397da00541ad9ecb5c9cd8fcba41233d569"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc