diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 3f09d971a52f..7a6e9a579e6a 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: 新建一个新的 Issue - url: https://nervjs.github.io/taro-issue-helper/ + url: https://tls.jd.com/taro-issue-helper about: 请点击 「Open」 按钮打开新链接创建 Issue diff --git a/lerna.json b/lerna.json index e4882ccbe2c8..ae5b152776c4 100644 --- a/lerna.json +++ b/lerna.json @@ -35,6 +35,6 @@ "license": "MIT" } }, - "version": "3.0.6", + "version": "3.0.7", "npmClient": "yarn" } diff --git a/packages/babel-plugin-transform-taroapi/package.json b/packages/babel-plugin-transform-taroapi/package.json index 29fbf96fee4b..d1b4e221dbfd 100644 --- a/packages/babel-plugin-transform-taroapi/package.json +++ b/packages/babel-plugin-transform-taroapi/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-taroapi", - "version": "3.0.6", + "version": "3.0.7", "main": "dist/index.js", "scripts": { "build": "tsc" diff --git a/packages/babel-preset-taro/index.js b/packages/babel-preset-taro/index.js index 7f69ae1d581e..9a38fadb4996 100644 --- a/packages/babel-preset-taro/index.js +++ b/packages/babel-preset-taro/index.js @@ -116,6 +116,8 @@ module.exports = (_, options = {}) => { packageName: '@tarojs/taro', apis }]) + } else { + plugins.push([require('babel-plugin-dynamic-import-node')]) } return { diff --git a/packages/babel-preset-taro/package.json b/packages/babel-preset-taro/package.json index b66554eeeb47..4fb09be4bdff 100644 --- a/packages/babel-preset-taro/package.json +++ b/packages/babel-preset-taro/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-taro", - "version": "3.0.6", + "version": "3.0.7", "description": "> TODO: description", "author": "yuche ", "homepage": "https://github.com/nervjs/taro/tree/master/packages/babel-preset-taro#readme", @@ -33,8 +33,9 @@ "@babel/preset-react": "^7.7.4", "@babel/preset-typescript": "^7.8.0", "@babel/runtime": "^7.7.4", - "@tarojs/taro-h5": "3.0.6", - "babel-plugin-transform-taroapi": "3.0.6", + "@tarojs/taro-h5": "3.0.7", + "babel-plugin-dynamic-import-node": "^2.3.3", + "babel-plugin-transform-taroapi": "3.0.7", "core-js": "^3.6.3" } } diff --git a/packages/eslint-config-taro/package.json b/packages/eslint-config-taro/package.json index a0c9cc436b2a..6dfc29049494 100644 --- a/packages/eslint-config-taro/package.json +++ b/packages/eslint-config-taro/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-taro", - "version": "3.0.6", + "version": "3.0.7", "description": "Taro specific linting rules for ESLint", "main": "index.js", "files": [ diff --git a/packages/eslint-plugin-taro/package.json b/packages/eslint-plugin-taro/package.json index 369c010f22d5..61bfd6a04502 100644 --- a/packages/eslint-plugin-taro/package.json +++ b/packages/eslint-plugin-taro/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-taro", - "version": "3.0.6", + "version": "3.0.7", "description": "Taro specific linting plugin for ESLint", "main": "index.js", "files": [ diff --git a/packages/postcss-plugin-constparse/package.json b/packages/postcss-plugin-constparse/package.json index 69167b12cff1..2f20878a43f3 100644 --- a/packages/postcss-plugin-constparse/package.json +++ b/packages/postcss-plugin-constparse/package.json @@ -1,6 +1,6 @@ { "name": "postcss-plugin-constparse", - "version": "3.0.6", + "version": "3.0.7", "description": "parse constants defined in config", "main": "index.js", "author": "Simba", diff --git a/packages/postcss-pxtransform/package.json b/packages/postcss-pxtransform/package.json index 65eed37fe681..5ec71a2f4e1c 100644 --- a/packages/postcss-pxtransform/package.json +++ b/packages/postcss-pxtransform/package.json @@ -1,6 +1,6 @@ { "name": "postcss-pxtransform", - "version": "3.0.6", + "version": "3.0.7", "description": "PostCSS plugin px 转小程序 rpx及h5 rem 单位", "keywords": [ "postcss", diff --git a/packages/shared/package.json b/packages/shared/package.json index 34afec92441d..336c54fc04b4 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/shared", - "version": "3.0.6", + "version": "3.0.7", "description": "> TODO: description", "author": "yuche ", "homepage": "https://github.com/nervjs/taro/tree/master/packages/shared#readme", diff --git a/packages/shared/src/components.ts b/packages/shared/src/components.ts index bb3f8535331b..f4749dea4f20 100644 --- a/packages/shared/src/components.ts +++ b/packages/shared/src/components.ts @@ -57,12 +57,12 @@ const Map = { longitude: '', latitude: '', scale: '16', - markers: '', + markers: '[]', covers: '', - polyline: '', - circles: '', + polyline: '[]', + circles: '[]', controls: '', - 'include-point': 'false', + 'include-points': '[]', 'show-location': '', polygons: '', subkey: '', @@ -381,6 +381,11 @@ const ScrollView = { bindScrolltoUpper: '', bindScrolltoLower: '', bindScroll: '', + animation: '', + bindTransitionEnd: '', + bindAnimationStart: '', + bindAnimationIteration: '', + bindAnimationEnd: '', ...touchEvents } @@ -485,9 +490,13 @@ const LivePlayer = { 'sound-mode': singleQuote('speaker'), 'auto-pause-if-navigate': 'true', 'auto-pause-if-open-native': 'true', + 'picture-in-picture-mode': '[]', bindStateChange: '', bindFullScreenChange: '', - bindNetStatus: '' + bindNetStatus: '', + bindAudioVolumeNotify: '', + bindEnterPictureInPicture: '', + bindLeavePictureInPicture: '' } const LivePusher = { @@ -555,6 +564,16 @@ const Video = { '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', bindPlay: '', bindPause: '', bindEnded: '', @@ -563,11 +582,15 @@ const Video = { bindWaiting: '', bindError: '', bindProgress: '', - bindLoadedMetadata: '' + bindLoadedMetadata: '', + bindControlsToggle: '', + bindEnterPictureInPicture: '', + bindLeavePictureInPicture: '', + bindSeekComplete: '' } const Canvas = { - type: '', + type: singleQuote('2d'), 'canvas-id': '', 'disable-scroll': 'false', bindTouchStart: '', @@ -581,6 +604,8 @@ const Canvas = { const Ad = { 'unit-id': '', 'ad-intervals': '', + 'ad-type': singleQuote('banner'), + 'ad-theme': singleQuote('white'), bindLoad: '', bindError: '', bindClose: '' diff --git a/packages/shared/src/template.ts b/packages/shared/src/template.ts index cb24ffcb0deb..9ecdf8862f8d 100644 --- a/packages/shared/src/template.ts +++ b/packages/shared/src/template.ts @@ -132,6 +132,10 @@ export class BaseTemplate { Object.assign(newComp, styles, this.getEvents()) } + if (compName === 'swiper-item') { + delete newComp.style + } + if (compName === 'slot' || compName === 'slot-view') { result[compName] = { slot: 'i.name' diff --git a/packages/taro-api/package.json b/packages/taro-api/package.json index b622dcd2bf32..c742a4ee3493 100644 --- a/packages/taro-api/package.json +++ b/packages/taro-api/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/api", - "version": "3.0.6", + "version": "3.0.7", "description": "Taro common API", "author": "yuche ", "homepage": "https://github.com/nervjs/taro/tree/master/packages/api#readme", @@ -29,6 +29,6 @@ "url": "https://github.com/NervJS/taro/issues" }, "dependencies": { - "@tarojs/runtime": "3.0.6" + "@tarojs/runtime": "3.0.7" } } diff --git a/packages/taro-cli/package.json b/packages/taro-cli/package.json index ce75c0c81cb3..6dac468b57a7 100644 --- a/packages/taro-cli/package.json +++ b/packages/taro-cli/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/cli", - "version": "3.0.6", + "version": "3.0.7", "description": "cli tool for taro", "main": "index.js", "scripts": { @@ -44,11 +44,11 @@ "license": "MIT", "dependencies": { "@hapi/joi": "17.1.1", - "@tarojs/helper": "3.0.6", - "@tarojs/service": "3.0.6", - "@tarojs/shared": "3.0.6", - "@tarojs/taro": "3.0.6", - "@tarojs/taroize": "3.0.6", + "@tarojs/helper": "3.0.7", + "@tarojs/service": "3.0.7", + "@tarojs/shared": "3.0.7", + "@tarojs/taro": "3.0.7", + "@tarojs/taroize": "3.0.7", "@tarojs/transformer-wx": "^2.0.4", "@types/request": "^2.48.1", "@typescript-eslint/parser": "^2.0.0", @@ -76,11 +76,11 @@ "ejs": "^2.6.1", "envinfo": "^6.0.1", "eslint": "^6.1.0", - "eslint-config-taro": "3.0.6", + "eslint-config-taro": "3.0.7", "eslint-plugin-import": "^2.8.0", "eslint-plugin-react": "^7.4.0", "eslint-plugin-react-hooks": "^1.6.1", - "eslint-plugin-taro": "3.0.6", + "eslint-plugin-taro": "3.0.7", "eslint-plugin-vue": "^6.2.2", "fbjs": "^1.0.0", "find-yarn-workspace-root": "1.2.1", @@ -103,7 +103,7 @@ "postcss-modules-resolve-imports": "^1.3.0", "postcss-modules-scope": "^1.1.0", "postcss-modules-values": "^1.3.0", - "postcss-pxtransform": "3.0.6", + "postcss-pxtransform": "3.0.7", "postcss-reporter": "^6.0.1", "postcss-taro-unit-transform": "1.2.15", "postcss-url": "^7.3.2", @@ -124,7 +124,7 @@ "xxhashjs": "^0.2.2" }, "devDependencies": { - "@tarojs/mini-runner": "3.0.6", - "@tarojs/webpack-runner": "3.0.6" + "@tarojs/mini-runner": "3.0.7", + "@tarojs/webpack-runner": "3.0.7" } } diff --git a/packages/taro-cli/src/create/project.ts b/packages/taro-cli/src/create/project.ts index 7c8580545168..7b370a0e5b86 100644 --- a/packages/taro-cli/src/create/project.ts +++ b/packages/taro-cli/src/create/project.ts @@ -2,8 +2,11 @@ import * as path from 'path' import * as fs from 'fs-extra' import * as inquirer from 'inquirer' import * as semver from 'semver' +import * as request from 'request' +import * as ora from 'ora' import { DEFAULT_TEMPLATE_SRC, + DEFAULT_TEMPLATE_SRC_GITEE, TARO_CONFIG_FLODER, TARO_BASE_CONFIG, getUserHomeDir, @@ -39,6 +42,8 @@ interface AskMethods { (conf: IProjectConf, prompts: object[], choices?: ITemplates[]): void; } +const NONE_AVALIABLE_TEMPLATE = '无可用模板' + export default class Project extends Creator { public rootPath: string public conf: IProjectConf @@ -63,60 +68,25 @@ export default class Project extends Creator { } init () { - console.log(chalk.green('Taro即将创建一个新项目!')) - console.log('Need help? Go and open issue: https://github.com/NervJS/taro/issues/new') + console.log(chalk.green('Taro 即将创建一个新项目!')) + console.log(`Need help? Go and open issue: ${chalk.blueBright('https://tls.jd.com/taro-issue-helper')}`) console.log() } - create () { - this.fetchTemplates() - .then((templateChoices: ITemplates[]) => { - return this.ask(templateChoices) - }) - .then(answers => { - const date = new Date() - this.conf = Object.assign(this.conf, answers) - this.conf.date = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}` - this.write() - }) - .catch(err => console.log(chalk.red('创建项目失败: ', err))) - } - - async fetchTemplates (): Promise { - const conf = this.conf - // 使用默认模版 - if (conf.template && conf.template === 'default') { - return Promise.resolve([]) + async create () { + try { + const answers = await this.ask() + const date = new Date() + this.conf = Object.assign(this.conf, answers) + this.conf.date = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}` + this.write() + } catch (error) { + console.log(chalk.red('创建项目失败: ', error)) } - - // 处理模版源取值 - if (!conf.templateSource) { - const homedir = getUserHomeDir() - if (!homedir) { - chalk.yellow('找不到用户根目录,使用默认模版源!') - conf.templateSource = DEFAULT_TEMPLATE_SRC - } - - const taroConfigPath = path.join(homedir, TARO_CONFIG_FLODER) - const taroConfig = path.join(taroConfigPath, TARO_BASE_CONFIG) - - if (fs.existsSync(taroConfig)) { - const config = await fs.readJSON(taroConfig) - conf.templateSource = config && config.templateSource ? config.templateSource : DEFAULT_TEMPLATE_SRC - } else { - await fs.createFile(taroConfig) - await fs.writeJSON(taroConfig, { templateSource: DEFAULT_TEMPLATE_SRC }) - conf.templateSource = DEFAULT_TEMPLATE_SRC - } - } - - // 从模板源下载模板 - return fetchTemplate(this.conf.templateSource, this.templatePath(''), this.conf.clone) } - ask (templateChoices: ITemplates[]) { - const prompts: object[] = [] - const templateChoicesPrompts: object[] = [] + async ask () { + let prompts: object[] = [] const conf = this.conf this.askProjectName(conf, prompts) @@ -124,28 +94,19 @@ export default class Project extends Creator { this.askFramework(conf, prompts) this.askTypescript(conf, prompts) this.askCSS(conf, prompts) + await this.askTemplateSource(conf, prompts) - return inquirer.prompt(prompts).then(answers => { - const newTemplateChoices: ITemplates[] = templateChoices - .filter(templateChoice => { - const { platforms } = templateChoice - if (typeof platforms === 'string' && platforms) { - return answers.framework === templateChoice.platforms - } else if (isArray(platforms)) { - return templateChoice.platforms?.includes(answers.framework) - } else { - return true - } - }) - this.askTemplate(conf, templateChoicesPrompts, newTemplateChoices) - return inquirer.prompt(templateChoicesPrompts) - .then(templateChoiceAnswer => { - return { - ...answers, - ...templateChoiceAnswer - } - }) - }) + const answers = await inquirer.prompt(prompts) + + prompts = [] + const templates = await this.fetchTemplates(answers) + await this.askTemplate(conf, prompts, templates) + const templateChoiceAnswer = await inquirer.prompt(prompts) + + return { + ...answers, + ...templateChoiceAnswer + } } askProjectName: AskMethods = function (conf, prompts) { @@ -262,6 +223,79 @@ export default class Project extends Creator { } } + askTemplateSource: AskMethods = async function (conf, prompts) { + if (conf.template === 'default' || conf.templateSource) return + + const homedir = getUserHomeDir() + const taroConfigPath = path.join(homedir, TARO_CONFIG_FLODER) + const taroConfig = path.join(taroConfigPath, TARO_BASE_CONFIG) + + let localTemplateSource: string + + // 检查本地配置 + if (fs.existsSync(taroConfig)) { + // 存在则把模板源读出来 + const config = await fs.readJSON(taroConfig) + localTemplateSource = config?.templateSource + } else { + // 不存在则创建配置 + await fs.createFile(taroConfig) + await fs.writeJSON(taroConfig, { templateSource: DEFAULT_TEMPLATE_SRC }) + localTemplateSource = DEFAULT_TEMPLATE_SRC + } + + const choices = [ + { + name: 'Gitee(最快)', + value: DEFAULT_TEMPLATE_SRC_GITEE + }, + { + name: 'Github(最新)', + value: DEFAULT_TEMPLATE_SRC + }, + { + name: '输入', + value: 'self-input' + }, + { + name: '社区优质模板源', + value: 'open-source' + } + ] + + if (localTemplateSource && localTemplateSource !== DEFAULT_TEMPLATE_SRC && localTemplateSource !== DEFAULT_TEMPLATE_SRC_GITEE) { + choices.unshift({ + name: `本地模板源:${localTemplateSource}`, + value: localTemplateSource + }) + } + + prompts.push({ + type: 'list', + name: 'templateSource', + message: '请选择模板源', + choices + }, { + type: 'input', + name: 'templateSource', + message: '请输入模板源!', + when (answers) { + return answers.templateSource === 'self-input' + } + }, { + type: 'list', + name: 'templateSource', + message: '请选择社区模板源', + async choices (answers) { + const choices = await getOpenSourceTemplates(answers.framework) + return choices + }, + when (answers) { + return answers.templateSource === 'open-source' + } + }) + } + askTemplate: AskMethods = function (conf, prompts, list = []) { const choices = [ { @@ -284,8 +318,60 @@ export default class Project extends Creator { } } + async fetchTemplates (answers): Promise { + const { templateSource, framework } = answers + this.conf.templateSource = this.conf.templateSource || templateSource + + // 使用默认模版 + if (this.conf?.template === 'default' || answers.templateSource === NONE_AVALIABLE_TEMPLATE) return Promise.resolve([]) + + // 从模板源下载模板 + const isClone = /gitee/.test(this.conf.templateSource) || this.conf.clone + const templateChoices = await fetchTemplate(this.conf.templateSource, this.templatePath(''), isClone) + + // 根据用户选择的框架筛选模板 + const newTemplateChoices: ITemplates[] = templateChoices + .filter(templateChoice => { + const { platforms } = templateChoice + if (typeof platforms === 'string' && platforms) { + return framework === templateChoice.platforms + } else if (isArray(platforms)) { + return templateChoice.platforms?.includes(framework) + } else { + return true + } + }) + + return newTemplateChoices + } + write (cb?: () => void) { this.conf.src = SOURCE_DIR createApp(this, this.conf, cb).catch(err => console.log(err)) } } + +function getOpenSourceTemplates (platform) { + return new Promise((resolve, reject) => { + const spinner = ora('正在拉取开源模板列表...').start() + request.get('https://gitee.com/NervJS/awesome-taro/raw/next/index.json', (error, _response, body) => { + if (error) { + spinner.fail(chalk.red('拉取开源模板列表失败!')) + return reject(new Error()) + } + + spinner.succeed(`${chalk.grey('拉取开源模板列表成功!')}`) + + const collection = JSON.parse(body) + + switch (platform) { + case 'react': + return resolve(collection.react) + case 'vue': + return resolve(collection.vue) + default: + return resolve([NONE_AVALIABLE_TEMPLATE]) + } + }) + }) +} diff --git a/packages/taro-components/package.json b/packages/taro-components/package.json index b3955ce366c2..e114fc07731c 100644 --- a/packages/taro-components/package.json +++ b/packages/taro-components/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components", - "version": "3.0.6", + "version": "3.0.7", "description": "", "main:h5": "src/index.js", "main": "dist/index.js", @@ -38,7 +38,7 @@ "license": "MIT", "dependencies": { "@stencil/core": "^1.8.1", - "@tarojs/taro": "3.0.6", + "@tarojs/taro": "3.0.7", "better-scroll": "^1.14.1", "classnames": "^2.2.5", "intersection-observer": "^0.7.0", diff --git a/packages/taro-components/src/components/canvas/canvas.tsx b/packages/taro-components/src/components/canvas/canvas.tsx index f828bbafc586..6c83d2e1a0ed 100644 --- a/packages/taro-components/src/components/canvas/canvas.tsx +++ b/packages/taro-components/src/components/canvas/canvas.tsx @@ -1,5 +1,5 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars -import { Component, h, ComponentInterface, Prop, State, Element, Event } from '@stencil/core' +import { Component, h, ComponentInterface, Prop, Element, Event } from '@stencil/core' const LONG_TAP_DELAY = 500 @@ -9,13 +9,8 @@ const LONG_TAP_DELAY = 500 }) export class Canvas implements ComponentInterface { private timer: NodeJS.Timeout - // @Prop() type: '2d' | 'webgl' - @Prop() canvasId: string - @State() width = 300 - @State() height = 150 - @State() klass: string - @State() css: string + @Prop() canvasId: string @Element() el: HTMLElement @@ -25,26 +20,6 @@ export class Canvas implements ComponentInterface { onLongTap - private canvas?: HTMLCanvasElement - - componentDidLoad () { - const { width, height } = this.el.getBoundingClientRect() - this.width = width - this.height = height - this.klass = this.el.className - this.css = this.el.style.cssText - } - - componentDidUpdate () { - const { width, height } = this.el.getBoundingClientRect() - if (this.width !== width) this.width = width - if (this.height !== height) this.height = height - if (this.canvas) { - this.canvas.className = this.el.className - this.canvas.style.cssText = this.el.style.cssText - } - } - onTouchStart = () => { this.timer = setTimeout(() => { this.onLongTap.emit() @@ -60,18 +35,15 @@ export class Canvas implements ComponentInterface { } render () { - const { - canvasId, - width, - height - } = this + const { canvasId } = this return ( (this.canvas = node!)} - width={width} - height={height} + style={{ + width: '100%', + height: '100%' + }} onTouchStart={this.onTouchStart} onTouchMove={this.onTouchMove} onTouchEnd={this.onTouchEnd} diff --git a/packages/taro-components/types/LivePlayer.d.ts b/packages/taro-components/types/LivePlayer.d.ts index 31ebe040dcef..e9062b16a980 100644 --- a/packages/taro-components/types/LivePlayer.d.ts +++ b/packages/taro-components/types/LivePlayer.d.ts @@ -74,6 +74,11 @@ interface LivePlayerProps extends StandardProps { */ autoPauseIfOpenNavigate?: boolean + /** 设置小窗模式: push, pop,空字符串或通过数组形式设置多种模式(如: ["push", "pop"]) + * @supported weapp + */ + pictureInPictureMode?: ('push' | 'pop')[] | 'push' | 'pop' | '' + /** 播放状态变化事件,detail = {code} * @supported weapp */ @@ -87,12 +92,22 @@ interface LivePlayerProps extends StandardProps { /** 网络状态通知,detail = {info} * @supported weapp */ - onNetstatus?: CommonEventFunction + onNetStatus?: CommonEventFunction /** 播放音量大小通知,detail = {} * @supported weapp */ - onAudioVolumenotify?: CommonEventFunction<{}> + onAudioVolumeNotify?: CommonEventFunction<{}> + + /** 播放器进入小窗 + * @supported weapp + */ + onEnterPictureInPicture?: CommonEventFunction + + /** 播放器退出小窗 + * @supported weapp + */ + onLeavePictureInPicture?: CommonEventFunction } declare namespace LivePlayerProps { diff --git a/packages/taro-components/types/Video.d.ts b/packages/taro-components/types/Video.d.ts index bef8c98ac4ee..3cee1453faf0 100644 --- a/packages/taro-components/types/Video.d.ts +++ b/packages/taro-components/types/Video.d.ts @@ -194,6 +194,36 @@ interface VideoProps extends StandardProps { */ showCastingButton?: boolean + /** + * 设置小窗模式: push, pop,空字符串或通过数组形式设置多种模式(如: ["push", "pop"]) + * @supported weapp + */ + pictureInPictureMode?: ('push' | 'pop')[] | 'push' | 'pop' | '' + + /** + * 是否在小窗模式下显示播放进度(目前有bug,先注释掉) + * @supported weapp + * + * 先注释掉,原因如下: + * 该属性超过了 wxml 属性的长度限制,实际无法使用且导致编译报错。可等微信官方修复后再放开。 + * 参考1:https://developers.weixin.qq.com/community/develop/doc/000a429beb87f0eac07acc0fc5b400 + * 参考2: https://developers.weixin.qq.com/community/develop/doc/0006883619c48054286a4308258c00?_at=vyxqpllafi + * + */ + // pictureInPictureShowProgress?: boolean + + /** + * 是否开启手机横屏时自动全屏,当系统设置开启自动旋转时生效 + * @supported weapp + */ + enableAutoRotation?: boolean + + /** + * 是否显示锁屏按钮,仅在全屏时显示,锁屏后控制栏的操作 + * @supported weapp + */ + showScreenLockButton?: boolean + /** 当开始/继续播放时触发 play 事件 * @supported weapp, h5, swan, alipay, tt */ @@ -246,6 +276,30 @@ interface VideoProps extends StandardProps { * @supported weapp */ onLoadedMetaData?: CommonEventFunction + + /** + * 切换 controls 显示隐藏时触发。event.detail = {show} + * @supported weapp + */ + onControlsToggle?: CommonEventFunction + + /** + * 播放器进入小窗 + * @supported weapp + */ + onEnterPictureInPicture?: CommonEventFunction + + /** + * 播放器退出小窗 + * @supported weapp + */ + onLeavePictureInPicture?: CommonEventFunction + + /** + * seek 完成时触发 + * @supported weapp + */ + onSeekComplete?: CommonEventFunction } declare namespace VideoProps { @@ -297,6 +351,11 @@ declare namespace VideoProps { /** 百分比 */ buffered: number } + + interface onControlsToggleEventDetail { + /** 是否显示 */ + show: boolean + } } /** 视频。相关api:Taro.createVideoContext diff --git a/packages/taro-components/types/common.d.ts b/packages/taro-components/types/common.d.ts index fba2afecc4f4..d5af4ec79608 100644 --- a/packages/taro-components/types/common.d.ts +++ b/packages/taro-components/types/common.d.ts @@ -19,6 +19,13 @@ export interface StandardProps extends EventProps { animation?: { actions: object[] } /** 引用 */ ref?: LegacyRef + /** + * 渲染 HTML + * @see https://taro-docs.jd.com/taro/docs/html + */ + dangerouslySetInnerHTML?: { + __html: string; + } } export interface FormItemProps { diff --git a/packages/taro-extend/package.json b/packages/taro-extend/package.json index 42afaa079759..e6b3f900dad0 100644 --- a/packages/taro-extend/package.json +++ b/packages/taro-extend/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/extend", - "version": "3.0.6", + "version": "3.0.7", "description": "Taro extend functionality", "author": "yuche ", "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro-extend#readme", diff --git a/packages/taro-h5/package.json b/packages/taro-h5/package.json index 359617f05a64..bccd0920e491 100644 --- a/packages/taro-h5/package.json +++ b/packages/taro-h5/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/taro-h5", - "version": "3.0.6", + "version": "3.0.7", "description": "Taro h5 framework", "main:h5": "src/index.js", "main": "dist/index.cjs.js", @@ -33,9 +33,9 @@ "author": "O2Team", "license": "MIT", "dependencies": { - "@tarojs/api": "3.0.6", - "@tarojs/router": "3.0.6", - "@tarojs/runtime": "3.0.6", + "@tarojs/api": "3.0.7", + "@tarojs/router": "3.0.7", + "@tarojs/runtime": "3.0.7", "base64-js": "^1.3.0", "jsonp-retry": "^1.0.3", "mobile-detect": "^1.4.2", diff --git a/packages/taro-helper/package.json b/packages/taro-helper/package.json index 9efc6920d1d9..ca2ef3fc1540 100644 --- a/packages/taro-helper/package.json +++ b/packages/taro-helper/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/helper", - "version": "3.0.6", + "version": "3.0.7", "description": "Taro Helper", "main": "index.js", "types": "types/index.d.ts", @@ -41,7 +41,7 @@ "@babel/preset-typescript": "7.9.0", "@babel/register": "7.9.0", "@babel/runtime": "7.9.2", - "@tarojs/taro": "3.0.6", + "@tarojs/taro": "3.0.7", "babel-plugin-transform-react-jsx": "^6.24.1", "chalk": "3.0.0", "chokidar": "3.3.1", diff --git a/packages/taro-helper/src/constants.ts b/packages/taro-helper/src/constants.ts index 0fcd0e7ade27..c2d36f892e73 100644 --- a/packages/taro-helper/src/constants.ts +++ b/packages/taro-helper/src/constants.ts @@ -97,7 +97,7 @@ export const REG_LESS = /\.less$/ export const REG_STYLUS = /\.styl$/ export const REG_STYLE = /\.(css|scss|sass|less|styl|wxss|acss|ttss|jxss|qss)(\?.*)?$/ export const REG_CSS = /\.(css|wxss|acss|ttss)(\?.*)?$/ -export const REG_MEDIA = /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/ +export const REG_MEDIA = /\.(mp4|webm|ogg|mp3|m4a|wav|flac|aac)(\?.*)?$/ export const REG_IMAGE = /\.(png|jpe?g|gif|bpm|svg|webp)(\?.*)?$/ export const REG_FONT = /\.(woff2?|eot|ttf|otf)(\?.*)?$/ export const REG_JSON = /\.json(\?.*)?$/ @@ -175,6 +175,7 @@ export const DEVICE_RATIO_NAME = 'deviceRatio' export const isWindows = os.platform() === 'win32' export const DEFAULT_TEMPLATE_SRC = 'github:NervJS/taro-project-templates#v3' +export const DEFAULT_TEMPLATE_SRC_GITEE = 'direct:https://gitee.com/o2team/taro-project-templates.git#v3' export const TARO_CONFIG_FLODER = '.taro3' export const TARO_BASE_CONFIG = 'index.json' diff --git a/packages/taro-helper/types/constants.d.ts b/packages/taro-helper/types/constants.d.ts index 2341f5072d08..2c09fbf8c555 100644 --- a/packages/taro-helper/types/constants.d.ts +++ b/packages/taro-helper/types/constants.d.ts @@ -73,8 +73,9 @@ export declare const taroJsMobx = "@tarojs/mobx"; export declare const taroJsMobxCommon = "@tarojs/mobx-common"; export declare const DEVICE_RATIO_NAME = "deviceRatio"; export declare const isWindows: boolean; -export declare const DEFAULT_TEMPLATE_SRC = "github:NervJS/taro-project-templates#2.0"; -export declare const TARO_CONFIG_FLODER = ".taro2"; +export declare const DEFAULT_TEMPLATE_SRC = "github:NervJS/taro-project-templates#v3"; +export declare const DEFAULT_TEMPLATE_SRC_GITEE = "direct:https://gitee.com/o2team/taro-project-templates.git#v3"; +export declare const TARO_CONFIG_FLODER = ".taro3"; export declare const TARO_BASE_CONFIG = "index.json"; export declare const OUTPUT_DIR = "dist"; export declare const SOURCE_DIR = "src"; diff --git a/packages/taro-helper/types/index.d.ts b/packages/taro-helper/types/index.d.ts index c5ff175adca6..a068055643fa 100644 --- a/packages/taro-helper/types/index.d.ts +++ b/packages/taro-helper/types/index.d.ts @@ -132,6 +132,7 @@ declare interface helper { DEVICE_RATIO_NAME: "deviceRatio"; isWindows: boolean; DEFAULT_TEMPLATE_SRC: "github:NervJS/taro-project-templates#v3"; + DEFAULT_TEMPLATE_SRC_GITEE: "direct:https://gitee.com/o2team/taro-project-templates.git#v3"; TARO_CONFIG_FLODER: ".taro3"; TARO_BASE_CONFIG: "index.json"; OUTPUT_DIR: "dist"; diff --git a/packages/taro-loader/package.json b/packages/taro-loader/package.json index b422e7eadc68..d85ecd0ebce0 100644 --- a/packages/taro-loader/package.json +++ b/packages/taro-loader/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/taro-loader", - "version": "3.0.6", + "version": "3.0.7", "description": "> TODO: description", "author": "yuche ", "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro-loader#readme", @@ -32,6 +32,6 @@ "access": "public" }, "devDependencies": { - "@tarojs/taro": "3.0.6" + "@tarojs/taro": "3.0.7" } } diff --git a/packages/taro-mini-runner/__tests__/__snapshots__/alipay.spec.ts.snap b/packages/taro-mini-runner/__tests__/__snapshots__/alipay.spec.ts.snap index 55df99710659..b16b069d7cdb 100644 --- a/packages/taro-mini-runner/__tests__/__snapshots__/alipay.spec.ts.snap +++ b/packages/taro-mini-runner/__tests__/__snapshots__/alipay.spec.ts.snap @@ -125,9 +125,15 @@ require(\\"./taro\\");