diff --git a/crates/native_binding/binding.d.ts b/crates/native_binding/binding.d.ts index d1c87704d427..3c2d2b1ab843 100644 --- a/crates/native_binding/binding.d.ts +++ b/crates/native_binding/binding.d.ts @@ -23,6 +23,7 @@ export interface CreateOptions { version?: string date?: string typescript?: boolean + buildEs5?: boolean template: string pageName?: string compiler?: CompilerType @@ -105,6 +106,7 @@ export interface Project { npm: NpmType description?: string typescript?: boolean + buildEs5?: boolean template: string css: CSSType autoInstall?: boolean diff --git a/crates/native_binding/package.json b/crates/native_binding/package.json index 430f43ae7c6f..b07ff12e35a0 100644 --- a/crates/native_binding/package.json +++ b/crates/native_binding/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/binding", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Node binding for taro", "main": "binding.js", "typings": "binding.d.ts", diff --git a/crates/native_binding/src/lib.rs b/crates/native_binding/src/lib.rs index 5100146bb1da..0c943f831657 100644 --- a/crates/native_binding/src/lib.rs +++ b/crates/native_binding/src/lib.rs @@ -18,6 +18,7 @@ pub async fn create_project( conf.npm, conf.description, conf.typescript, + conf.build_es5, conf.template, conf.css, conf.framework, diff --git a/crates/swc_plugin_compile_mode/src/tests/attributes.rs b/crates/swc_plugin_compile_mode/src/tests/attributes.rs index 891279df343b..9b8bce0eb7dd 100644 --- a/crates/swc_plugin_compile_mode/src/tests/attributes.rs +++ b/crates/swc_plugin_compile_mode/src/tests/attributes.rs @@ -47,6 +47,7 @@ test!( {}} id={myId}> {}} id="myImg" /> + {}} onScrollUpdateWorklet="onScrollUpdate" onGestureWorklet="onGesture" shouldResponseOnMoveWorklet="shouldResponseOnMoveCallBack"> ) } diff --git a/crates/swc_plugin_compile_mode/src/transform.rs b/crates/swc_plugin_compile_mode/src/transform.rs index 4cbca1f71b64..f650e47e9481 100644 --- a/crates/swc_plugin_compile_mode/src/transform.rs +++ b/crates/swc_plugin_compile_mode/src/transform.rs @@ -342,6 +342,15 @@ impl TransformVisitor { Some(jsx_attr_value) => { match jsx_attr_value { JSXAttrValue::Lit(Lit::Str(Str { value, .. })) => { + // 处理worklet事件 + if is_event { + let event_name_str = event_name.unwrap(); + if event_name_str.starts_with("worklet:") { + props.insert(event_name_str, value.to_string()); + return false; + } + } + // 静态属性在 xml 中保留即可,jsx 中可以删除 if jsx_attr_name != COMPILE_MODE { props.insert(miniapp_attr_name, value.to_string()); diff --git a/crates/swc_plugin_compile_mode/src/utils/mod.rs b/crates/swc_plugin_compile_mode/src/utils/mod.rs index 0cc8130517f8..3c6738673350 100644 --- a/crates/swc_plugin_compile_mode/src/utils/mod.rs +++ b/crates/swc_plugin_compile_mode/src/utils/mod.rs @@ -88,6 +88,19 @@ pub fn check_is_event_attr(val: &str) -> bool { } pub fn identify_jsx_event_key(val: &str, platform: &str) -> Option { + + // 处理worklet事件及callback + // 事件: onScrollUpdateWorklet -> worklet:onscrollupdate + // callback:shouldResponseOnMoveWorklet -> worklet:should-response-on-move + if val.ends_with("Worklet") { + let worklet_name = val.trim_end_matches("Worklet"); + if worklet_name.starts_with("on") { + return Some(format!("worklet:{}", worklet_name.to_lowercase())); + } else { + return Some(format!("worklet:{}", to_kebab_case(worklet_name))); + } + } + if check_is_event_attr(val) { let event_name = val.get(2..).unwrap().to_lowercase(); let event_name = if event_name == "click" { diff --git a/crates/swc_plugin_compile_mode/tests/__swc_snapshots__/src/tests/attributes.rs/should_handle_events.js b/crates/swc_plugin_compile_mode/tests/__swc_snapshots__/src/tests/attributes.rs/should_handle_events.js index 2a9fea02d0b1..7920816bbfd2 100644 --- a/crates/swc_plugin_compile_mode/tests/__swc_snapshots__/src/tests/attributes.rs/should_handle_events.js +++ b/crates/swc_plugin_compile_mode/tests/__swc_snapshots__/src/tests/attributes.rs/should_handle_events.js @@ -1,8 +1,14 @@ -const TARO_TEMPLATES_f0t0 = ''; +const TARO_TEMPLATES_f0t0 = ''; function Index() { return + - {}} id={myId}> - {}} /> - + + {}} id={myId}> + + {}}/> + + {}}> + + ; } diff --git a/crates/taro_init/src/creator.rs b/crates/taro_init/src/creator.rs index 78a4b4c84c5c..c28857fd8cdc 100644 --- a/crates/taro_init/src/creator.rs +++ b/crates/taro_init/src/creator.rs @@ -30,6 +30,7 @@ pub struct CreateOptions { pub version: Option, pub date: Option, pub typescript: Option, + pub build_es5: Option, pub template: String, pub page_name: Option, pub compiler: Option, diff --git a/crates/taro_init/src/page.rs b/crates/taro_init/src/page.rs index 49897e507ae7..5df8631c1c9f 100644 --- a/crates/taro_init/src/page.rs +++ b/crates/taro_init/src/page.rs @@ -113,6 +113,7 @@ impl Page { set_page_name: None, set_sub_pkg_page_name: None, change_ext: None, + build_es5: None, is_custom_template: self.is_custom_template.clone(), plugin_type: None, }; diff --git a/crates/taro_init/src/plugin.rs b/crates/taro_init/src/plugin.rs index 0acfdefc1aeb..229f3f282ae7 100644 --- a/crates/taro_init/src/plugin.rs +++ b/crates/taro_init/src/plugin.rs @@ -56,6 +56,7 @@ impl Plugin { version: Some(self.version.clone()), date: None, typescript: None, + build_es5: None, template: self.template.clone(), page_name: None, compiler: None, diff --git a/crates/taro_init/src/project.rs b/crates/taro_init/src/project.rs index ca720e44f970..6632b4046883 100644 --- a/crates/taro_init/src/project.rs +++ b/crates/taro_init/src/project.rs @@ -19,6 +19,7 @@ pub struct Project { pub npm: NpmType, pub description: Option, pub typescript: Option, + pub build_es5: Option, pub template: String, pub css: CSSType, pub auto_install: Option, @@ -37,6 +38,7 @@ impl Project { npm: NpmType, description: Option, typescript: Option, + build_es5: Option, template: String, css: CSSType, framework: FrameworkType, @@ -53,6 +55,7 @@ impl Project { npm, description, typescript, + build_es5, template, css, auto_install, @@ -103,6 +106,7 @@ impl Project { version: Some(self.version.clone()), date: self.date.clone(), typescript: self.typescript.clone(), + build_es5: self.build_es5.clone(), template: self.template.clone(), page_name: Some("index".to_string()), compiler: self.compiler.clone(), diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index a08c5eaf98fd..ceb74f7f5d16 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,7 +1,7 @@ { "name": "@tarojs/binding-darwin-arm64", "description": "Native binding for taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "os": [ "darwin" ], diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index 11e6d17d4749..b00fb6806c8d 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,7 +1,7 @@ { "name": "@tarojs/binding-darwin-x64", "description": "Native binding for taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "os": [ "darwin" ], diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json index 3396b086e31a..147fd8ca2f71 100644 --- a/npm/linux-x64-gnu/package.json +++ b/npm/linux-x64-gnu/package.json @@ -1,7 +1,7 @@ { "name": "@tarojs/binding-linux-x64-gnu", "description": "Native binding for taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "os": [ "linux" ], diff --git a/npm/linux-x64-musl/package.json b/npm/linux-x64-musl/package.json index 5edbdd6ffa64..afcdf47fab09 100644 --- a/npm/linux-x64-musl/package.json +++ b/npm/linux-x64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/binding-linux-x64-musl", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "os": [ "linux" ], diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json index ecb60b79dfee..931977177092 100644 --- a/npm/win32-x64-msvc/package.json +++ b/npm/win32-x64-msvc/package.json @@ -1,7 +1,7 @@ { "name": "@tarojs/binding-win32-x64-msvc", "description": "Native binding for taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "os": [ "win32" ], diff --git a/package.json b/package.json index 6aa82133e838..7cc6c63936d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "开放式跨端跨框架开发解决方案", "homepage": "https://github.com/NervJS/taro#readme", "author": "O2Team", diff --git a/packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json b/packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json index 22ed5420235f..683140fd9c3c 100644 --- a/packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json +++ b/packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx-to-rn-stylesheet", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Transform stylesheet selector to style in JSX Elements.", "author": "O2Team", "license": "MIT", diff --git a/packages/babel-plugin-transform-solid-jsx/package.json b/packages/babel-plugin-transform-solid-jsx/package.json index 453d7329ce0f..8570d3b58233 100644 --- a/packages/babel-plugin-transform-solid-jsx/package.json +++ b/packages/babel-plugin-transform-solid-jsx/package.json @@ -1,7 +1,7 @@ { "name": "babel-plugin-transform-solid-jsx", "description": "A JSX to DOM plugin that wraps expressions for fine grained change detection", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "license": "MIT", "repository": { "type": "git", diff --git a/packages/babel-plugin-transform-taroapi/package.json b/packages/babel-plugin-transform-taroapi/package.json index 1a87d76d2b66..07bedf5bc8d1 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": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "author": "O2Team", "license": "MIT", "main": "dist/index.js", diff --git a/packages/babel-preset-taro/package.json b/packages/babel-preset-taro/package.json index e2ac88d2ddf1..4dc479ea532d 100644 --- a/packages/babel-preset-taro/package.json +++ b/packages/babel-preset-taro/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro babel preset", "author": "O2Team", "license": "MIT", diff --git a/packages/create-app/package.json b/packages/create-app/package.json index c0ba3dd3733c..26e9aba7a96e 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/create-app", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "create taro app with one command", "author": "O2Team", "license": "MIT", diff --git a/packages/css-to-react-native/package.json b/packages/css-to-react-native/package.json index 1e16e4cd0727..99709f9cbc23 100644 --- a/packages/css-to-react-native/package.json +++ b/packages/css-to-react-native/package.json @@ -1,7 +1,7 @@ { "name": "taro-css-to-react-native", "description": "Convert CSS text to a React Native stylesheet object", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "author": "O2Team", "license": "MIT", "main": "dist/index.js", diff --git a/packages/eslint-config-taro/package.json b/packages/eslint-config-taro/package.json index b6ee54c4691f..0f9551e39be7 100644 --- a/packages/eslint-config-taro/package.json +++ b/packages/eslint-config-taro/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro specific linting rules for ESLint", "author": "O2Team", "license": "MIT", diff --git a/packages/jest-helper/package.json b/packages/jest-helper/package.json index dc8f29459cd5..b1687c5d7ad6 100644 --- a/packages/jest-helper/package.json +++ b/packages/jest-helper/package.json @@ -1,6 +1,6 @@ { "name": "jest-taro-helper", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "jest helper for taro", "private": true, "author": "O2Team", diff --git a/packages/postcss-html-transform/package.json b/packages/postcss-html-transform/package.json index 47709435d527..7aa1d6c5c409 100644 --- a/packages/postcss-html-transform/package.json +++ b/packages/postcss-html-transform/package.json @@ -1,6 +1,6 @@ { "name": "postcss-html-transform", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "transform html tag name selector", "author": "O2Team", "license": "MIT", diff --git a/packages/postcss-plugin-constparse/package.json b/packages/postcss-plugin-constparse/package.json index e7e2c0d44962..44e4dbdcd0ea 100644 --- a/packages/postcss-plugin-constparse/package.json +++ b/packages/postcss-plugin-constparse/package.json @@ -1,6 +1,6 @@ { "name": "postcss-plugin-constparse", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "parse constants defined in config", "author": "O2Team", "license": "MIT", diff --git a/packages/postcss-pxtransform/package.json b/packages/postcss-pxtransform/package.json index 8228faf9184c..f8effe9671de 100644 --- a/packages/postcss-pxtransform/package.json +++ b/packages/postcss-pxtransform/package.json @@ -1,6 +1,6 @@ { "name": "postcss-pxtransform", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "PostCSS plugin px 转小程序 rpx及h5 rem 单位", "author": "O2Team", "license": "MIT", diff --git a/packages/postcss-unit-transform/package.json b/packages/postcss-unit-transform/package.json index 97aa42e83389..d0c814764fdd 100644 --- a/packages/postcss-unit-transform/package.json +++ b/packages/postcss-unit-transform/package.json @@ -1,6 +1,6 @@ { "name": "postcss-taro-unit-transform", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "小程序单位转换", "author": "O2Team", "license": "MIT", diff --git a/packages/rollup-plugin-copy/package.json b/packages/rollup-plugin-copy/package.json index 8e3c3a1d68d6..67ffa41d5c0b 100644 --- a/packages/rollup-plugin-copy/package.json +++ b/packages/rollup-plugin-copy/package.json @@ -1,6 +1,6 @@ { "name": "rollup-plugin-copy", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "rollup-plugin-copy for taro", "private": true, "author": "O2Team", diff --git a/packages/shared/package.json b/packages/shared/package.json index 4c174f468b07..1b581af652ee 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/shared", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro utils internal use.", "author": "O2Team", "license": "MIT", diff --git a/packages/shared/src/components.ts b/packages/shared/src/components.ts index cecf29e8f695..9082a4e1ff54 100644 --- a/packages/shared/src/components.ts +++ b/packages/shared/src/components.ts @@ -525,10 +525,10 @@ export const voidElements = new Set([ export const nestElements = new Map([ ['view', -1], ['catch-view', -1], - ['click-view', -1], ['cover-view', -1], ['static-view', -1], ['pure-view', -1], + ['click-view', -1], ['block', -1], ['text', -1], ['static-text', 6], diff --git a/packages/shared/src/template.ts b/packages/shared/src/template.ts index d931524b155a..f33d62bbffef 100644 --- a/packages/shared/src/template.ts +++ b/packages/shared/src/template.ts @@ -217,10 +217,11 @@ export class BaseTemplate { style: comp.style, class: comp.class } + result['click-view'] = { style: comp.style, class: comp.class, - bindtap: 'eh' + ...this.getClickEvent() } } } @@ -412,9 +413,9 @@ export class BaseTemplate { case 'slot': case 'slot-view': case 'catch-view': - case 'click-view': case 'static-view': case 'pure-view': + case 'click-view': nodeName = 'view' break case 'static-text': @@ -515,6 +516,10 @@ export class BaseTemplate { return events } + protected getClickEvent (): any { + return { bindtap: 'eh' } + } + protected getAttrValue (value: string, _key: string, _nodeName: string) { return `{${value}}` } diff --git a/packages/stylelint-config-taro-rn/package.json b/packages/stylelint-config-taro-rn/package.json index b755fde5c912..be6e8aaf57cb 100644 --- a/packages/stylelint-config-taro-rn/package.json +++ b/packages/stylelint-config-taro-rn/package.json @@ -1,6 +1,6 @@ { "name": "stylelint-config-taro-rn", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Shareable stylelint config for React Native CSS modules", "author": "O2Team", "license": "MIT", diff --git a/packages/stylelint-taro-rn/package.json b/packages/stylelint-taro-rn/package.json index 7d4a4cccbe06..7bc82b6cc9f0 100644 --- a/packages/stylelint-taro-rn/package.json +++ b/packages/stylelint-taro-rn/package.json @@ -1,6 +1,6 @@ { "name": "stylelint-taro-rn", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "A collection of React Native specific rules for stylelint", "author": "O2Team", "license": "MIT", diff --git a/packages/stylelint-taro/package.json b/packages/stylelint-taro/package.json index b59f41621faa..922f3a1fb20e 100644 --- a/packages/stylelint-taro/package.json +++ b/packages/stylelint-taro/package.json @@ -1,6 +1,6 @@ { "name": "stylelint-taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro stylelint 规则集合", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-api/package.json b/packages/taro-api/package.json index fe8b92b7d060..10320bc071f3 100644 --- a/packages/taro-api/package.json +++ b/packages/taro-api/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/api", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro common API", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-cli-convertor/package.json b/packages/taro-cli-convertor/package.json index 6a94af2d7898..ab4fa7ee5f58 100644 --- a/packages/taro-cli-convertor/package.json +++ b/packages/taro-cli-convertor/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/cli-convertor", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "cli tool for taro-convert", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-cli/package.json b/packages/taro-cli/package.json index 24c6e075e2d6..e62deae4bd1a 100644 --- a/packages/taro-cli/package.json +++ b/packages/taro-cli/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/cli", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "cli tool for taro", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-cli/src/create/project.ts b/packages/taro-cli/src/create/project.ts index 2b91578f9c70..7b892494a17a 100644 --- a/packages/taro-cli/src/create/project.ts +++ b/packages/taro-cli/src/create/project.ts @@ -33,6 +33,7 @@ export interface IProjectConf { template: string description?: string typescript?: boolean + buildEs5?: boolean css: CSSType date?: string src?: string @@ -105,6 +106,7 @@ export default class Project extends Creator { this.askDescription(conf, prompts) this.askFramework(conf, prompts) this.askTypescript(conf, prompts) + this.askBuildEs5(conf, prompts) this.askCSS(conf, prompts) this.askNpm(conf, prompts) const answers = await inquirer.prompt(prompts) @@ -185,6 +187,17 @@ export default class Project extends Creator { } } + askBuildEs5: AskMethods = function (conf, prompts) { + if (typeof conf.buildEs5 !== 'boolean') { + prompts.push({ + type: 'confirm', + name: 'buildEs5', + message: '是否需要编译为 ES5 ?', + default: false + }) + } + } + askCSS: AskMethods = function (conf, prompts) { const cssChoices = [ { @@ -462,6 +475,7 @@ export default class Project extends Creator { templateRoot: getRootPath(), version: getPkgVersion(), typescript: this.conf.typescript, + buildEs5: this.conf.buildEs5, date: this.conf.date, description: this.conf.description, compiler: this.conf.compiler, diff --git a/packages/taro-cli/templates/default/babel.config.js b/packages/taro-cli/templates/default/babel.config.js index 182dac1717e5..64f06f056d35 100644 --- a/packages/taro-cli/templates/default/babel.config.js +++ b/packages/taro-cli/templates/default/babel.config.js @@ -1,11 +1,14 @@ // babel-preset-taro 更多选项和默认值: -// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md +// https://docs.taro.zone/docs/next/babel-config module.exports = { presets: [ ['taro', { framework: '{{ to_lower_case framework }}', ts: {{ typescript }}, compiler: '{{ to_lower_case compiler }}', + {{#if buildEs5 }} + useBuiltIns: process.env.TARO_ENV === 'h5' ? 'usage' : false + {{/if}} }] ] } diff --git a/packages/taro-cli/templates/default/config/index.js b/packages/taro-cli/templates/default/config/index.js index 6e864d307112..d79bb7a259f2 100644 --- a/packages/taro-cli/templates/default/config/index.js +++ b/packages/taro-cli/templates/default/config/index.js @@ -90,6 +90,11 @@ export default defineConfig{{#if typescript }}<'{{ to_lower_case compiler }}'>{{ } } } + + {{#if buildEs5 }} + process.env.BROWSERSLIST_ENV = process.env.NODE_ENV + {{/if}} + if (process.env.NODE_ENV === 'development') { // 本地开发构建配置(不混淆压缩) return merge({}, baseConfig, devConfig) diff --git a/packages/taro-cli/templates/default/config/prod.js b/packages/taro-cli/templates/default/config/prod.js index 7689cc126070..fc0757a50c0f 100644 --- a/packages/taro-cli/templates/default/config/prod.js +++ b/packages/taro-cli/templates/default/config/prod.js @@ -3,6 +3,19 @@ export default { mini: {}, h5: { + {{#if buildEs5 }} + {{#if (eq compiler 'Vite')}} + // 确保产物为 es5 + legacy: true, + {{else if (eq compiler 'Webpack5')}} + compile: { + include: [ + // 确保产物为 es5 + filename => /node_modules\/(?!(@babel|core-js|style-loader|css-loader|react|react-dom))/.test(filename) + ] + }, + {{/if}} + {{/if}} /** * WebpackChain 插件配置 * @docs https://github.com/neutrinojs/webpack-chain diff --git a/packages/taro-cli/templates/default/package.json.tmpl b/packages/taro-cli/templates/default/package.json.tmpl index 6df034b97071..b33bbb79799f 100644 --- a/packages/taro-cli/templates/default/package.json.tmpl +++ b/packages/taro-cli/templates/default/package.json.tmpl @@ -29,10 +29,24 @@ "dev:jd": "npm run build:jd -- --watch", "dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch" }, + {{#if buildEs5 }} + "browserslist": { + "development": [ + "defaults and fully supports es6-module", + "maintained node versions" + ], + "production": [ + "last 3 versions", + "Android >= 4.1", + "ios >= 8" + ] + }, + {{else}} "browserslist": [ "defaults and fully supports es6-module", "maintained node versions" ], + {{/if}} "author": "", "dependencies": { "@babel/runtime": "^7.24.4", diff --git a/packages/taro-components-advanced/package.json b/packages/taro-components-advanced/package.json index febf09f4a0fa..8778fb9114e9 100644 --- a/packages/taro-components-advanced/package.json +++ b/packages/taro-components-advanced/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components-advanced", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-components-library-react/package.json b/packages/taro-components-library-react/package.json index d94c3e0870fa..8bb8eb815342 100644 --- a/packages/taro-components-library-react/package.json +++ b/packages/taro-components-library-react/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components-library-react", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 组件库 React 版本库", "private": true, "author": "O2Team", diff --git a/packages/taro-components-library-solid/package.json b/packages/taro-components-library-solid/package.json index 0a4cd2d19d23..8c144953332d 100644 --- a/packages/taro-components-library-solid/package.json +++ b/packages/taro-components-library-solid/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components-library-solid", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 组件库 Solid 版本库", "private": true, "main": "index.js", diff --git a/packages/taro-components-library-vue3/package.json b/packages/taro-components-library-vue3/package.json index 3494edf9c67d..68b1381bfc78 100644 --- a/packages/taro-components-library-vue3/package.json +++ b/packages/taro-components-library-vue3/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components-library-vue3", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 组件库 Vue3 版本库", "private": true, "author": "O2Team", diff --git a/packages/taro-components-react/package.json b/packages/taro-components-react/package.json index f0ef3d59558b..f683b69947df 100644 --- a/packages/taro-components-react/package.json +++ b/packages/taro-components-react/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components-react", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "", "main:h5": "dist/index.js", "main": "dist/index.js", diff --git a/packages/taro-components-rn/package.json b/packages/taro-components-rn/package.json index 3f1d25bc08e8..f93533cc89cf 100644 --- a/packages/taro-components-rn/package.json +++ b/packages/taro-components-rn/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components-rn", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "React Native 基础组件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-components/package.json b/packages/taro-components/package.json index 6b044a1b4707..1281c7cef0d0 100644 --- a/packages/taro-components/package.json +++ b/packages/taro-components/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/components", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 组件库", "browser": "dist/index.js", "main:h5": "dist/index.js", diff --git a/packages/taro-components/scripts/stencil/stencil.config.ts b/packages/taro-components/scripts/stencil/stencil.config.ts index 801a31fc6361..3208e0b8eaf4 100644 --- a/packages/taro-components/scripts/stencil/stencil.config.ts +++ b/packages/taro-components/scripts/stencil/stencil.config.ts @@ -88,7 +88,11 @@ export const config: Config = { { components: ['taro-swiper-core', 'taro-swiper-item-core'] }, { components: ['taro-video-core', 'taro-video-control', 'taro-video-danmu'] } ], - buildEs5: 'prod', + /** + * Note: Taro内部有很多地方都直接引用了dist/components,最终的编译产物中有很多super(),导致低版安装白屏 + * 为彻底解决此包导致的白屏问题,故暂不在包构建是转为es5,而是将此包加入到项目的babel编译中 + */ + // buildEs5: 'prod', /** * Note: 由于 Stencil 的获取 jest 依赖的方式,硬链接模式下仅可使用更目录依赖的版本,所以当前未将相关依赖置于 devDependencies 中声明。 * 该问题可以通过为 pnpm 新增配置 `package-import-method: clone-or-copy` 修复,不过由于在 Mac 中,[NodeJS 存在问题问题](https://github.com/libuv/libuv/pull/2578), diff --git a/packages/taro-components/src/components/double-tap-gesture-handler/readme.md b/packages/taro-components/src/components/double-tap-gesture-handler/readme.md new file mode 100644 index 000000000000..7cc944e3580b --- /dev/null +++ b/packages/taro-components/src/components/double-tap-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-double-tap-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/double-tap-gesture-handler/script.tsx b/packages/taro-components/src/components/double-tap-gesture-handler/script.tsx new file mode 100644 index 000000000000..133734acf5f3 --- /dev/null +++ b/packages/taro-components/src/components/double-tap-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-double-tap-gesture-handler-core' +}) +export class DoubleTapGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('DoubleTapGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/force-press-gesture-handler/readme.md b/packages/taro-components/src/components/force-press-gesture-handler/readme.md new file mode 100644 index 000000000000..922006757d1d --- /dev/null +++ b/packages/taro-components/src/components/force-press-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-force-press-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/force-press-gesture-handler/script.tsx b/packages/taro-components/src/components/force-press-gesture-handler/script.tsx new file mode 100644 index 000000000000..276c2f10f4a5 --- /dev/null +++ b/packages/taro-components/src/components/force-press-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-force-press-gesture-handler-core' +}) +export class ForcePressGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('ForcePressGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/horizontal-drag-gesture-handler/readme.md b/packages/taro-components/src/components/horizontal-drag-gesture-handler/readme.md new file mode 100644 index 000000000000..0ca380b0d62a --- /dev/null +++ b/packages/taro-components/src/components/horizontal-drag-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-horizontal-drag-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/horizontal-drag-gesture-handler/script.tsx b/packages/taro-components/src/components/horizontal-drag-gesture-handler/script.tsx new file mode 100644 index 000000000000..e6222f881e34 --- /dev/null +++ b/packages/taro-components/src/components/horizontal-drag-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-horizontal-drag-gesture-handler-core' +}) +export class HorizontalDragGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('HorizontalDragGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/long-press-gesture-handler/readme.md b/packages/taro-components/src/components/long-press-gesture-handler/readme.md new file mode 100644 index 000000000000..e9b68704147f --- /dev/null +++ b/packages/taro-components/src/components/long-press-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-long-press-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/long-press-gesture-handler/script.tsx b/packages/taro-components/src/components/long-press-gesture-handler/script.tsx new file mode 100644 index 000000000000..4755b7d88491 --- /dev/null +++ b/packages/taro-components/src/components/long-press-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-long-press-gesture-handler-core' +}) +export class LongPressGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('LongPressGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/pan-gesture-handler/readme.md b/packages/taro-components/src/components/pan-gesture-handler/readme.md new file mode 100644 index 000000000000..b41c46cdf14e --- /dev/null +++ b/packages/taro-components/src/components/pan-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-pan-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/pan-gesture-handler/script.tsx b/packages/taro-components/src/components/pan-gesture-handler/script.tsx new file mode 100644 index 000000000000..9873121c5a64 --- /dev/null +++ b/packages/taro-components/src/components/pan-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-pan-gesture-handler-core' +}) +export class PanGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('PanGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/scale-gesture-handler/readme.md b/packages/taro-components/src/components/scale-gesture-handler/readme.md new file mode 100644 index 000000000000..7db19e25a200 --- /dev/null +++ b/packages/taro-components/src/components/scale-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-scale-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/scale-gesture-handler/script.tsx b/packages/taro-components/src/components/scale-gesture-handler/script.tsx new file mode 100644 index 000000000000..43f749d406db --- /dev/null +++ b/packages/taro-components/src/components/scale-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-scale-gesture-handler-core' +}) +export class ScaleGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('ScaleGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/script/readme.md b/packages/taro-components/src/components/script/readme.md new file mode 100644 index 000000000000..94690d7a3980 --- /dev/null +++ b/packages/taro-components/src/components/script/readme.md @@ -0,0 +1,10 @@ +# taro-script-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/script/script.tsx b/packages/taro-components/src/components/script/script.tsx new file mode 100644 index 000000000000..b2cc0bb3224e --- /dev/null +++ b/packages/taro-components/src/components/script/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-script-core' +}) +export class Script implements ComponentInterface { + componentDidLoad () { + notSupport('Script', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/tap-gesture-handler/readme.md b/packages/taro-components/src/components/tap-gesture-handler/readme.md new file mode 100644 index 000000000000..e9dae843179b --- /dev/null +++ b/packages/taro-components/src/components/tap-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-tap-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/tap-gesture-handler/script.tsx b/packages/taro-components/src/components/tap-gesture-handler/script.tsx new file mode 100644 index 000000000000..17782d47d82f --- /dev/null +++ b/packages/taro-components/src/components/tap-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-tap-gesture-handler-core' +}) +export class TapGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('TapGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/src/components/vertical-drag-gesture-handler/readme.md b/packages/taro-components/src/components/vertical-drag-gesture-handler/readme.md new file mode 100644 index 000000000000..32940ee44eb5 --- /dev/null +++ b/packages/taro-components/src/components/vertical-drag-gesture-handler/readme.md @@ -0,0 +1,10 @@ +# taro-vertical-drag-gesture-handler-core + + + + + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/packages/taro-components/src/components/vertical-drag-gesture-handler/script.tsx b/packages/taro-components/src/components/vertical-drag-gesture-handler/script.tsx new file mode 100644 index 000000000000..f46efe8efad6 --- /dev/null +++ b/packages/taro-components/src/components/vertical-drag-gesture-handler/script.tsx @@ -0,0 +1,18 @@ +import { Component, ComponentInterface, h, Host } from '@stencil/core' + +import { notSupport } from '../../utils' + +@Component({ + tag: 'taro-vertical-drag-gesture-handler-core' +}) +export class VerticalDragGestureHandler implements ComponentInterface { + componentDidLoad () { + notSupport('VerticalDragGestureHandler', this) + } + + render () { + return ( + + ) + } +} diff --git a/packages/taro-components/types/DraggableSheet.d.ts b/packages/taro-components/types/DraggableSheet.d.ts index be16f7c4d42c..04c3643febbc 100644 --- a/packages/taro-components/types/DraggableSheet.d.ts +++ b/packages/taro-components/types/DraggableSheet.d.ts @@ -32,6 +32,11 @@ interface DraggableSheetProps extends StandardProps { * @default [] */ snapSizes?: any[] + /** + * 尺寸发生变化时触发,仅支持 worklet 作为回调。event = {pixels, size} + * @supported weapp + */ + onSizeUpdateWorklet?: string } /** diff --git a/packages/taro-components/types/Input.d.ts b/packages/taro-components/types/Input.d.ts index 69efb7ad8692..a61e5943546c 100644 --- a/packages/taro-components/types/Input.d.ts +++ b/packages/taro-components/types/Input.d.ts @@ -78,6 +78,10 @@ interface InputProps extends StandardProps, FormItemProps { * @supported weapp, alipay, swan, tt, qq, jd, rn, harmony */ cursor?: number + /** 光标颜色。iOS 下的格式为十六进制颜色值 #000000,安卓下的只支持 default 和 green,Skyline 下无限制 + * @supported weapp + */ + cursorColor?: string /** 光标起始位置,自动聚集时有效,需与selection-end搭配使用 * @default -1 * @supported weapp, alipay, swan, tt, qq, jd, rn @@ -194,6 +198,26 @@ interface InputProps extends StandardProps, FormItemProps { * @supported weapp */ onNickNameReview?: CommonEventFunction + /** 选区改变事件, {selectionStart, selectionEnd} + * @supported weapp + */ + onSelectionChange?: CommonEventFunction + /** 输入法开始新的输入时触发 (仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionStart?: CommonEventFunction + /** 输入法输入字符时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionUpdate?: CommonEventFunction + /** 输入法输入结束时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionEnd?: CommonEventFunction + /** 键盘高度变化时触发。event.detail = {height: height, pageBottomPadding: pageBottomPadding}; height: 键盘高度,pageBottomPadding: 页面上推高度 + * @supported weapp + */ + onKeyoardHeightChangeWorklet?: string } declare namespace InputProps { /** Input 类型 */ diff --git a/packages/taro-components/types/RichText.d.ts b/packages/taro-components/types/RichText.d.ts index 106dac705288..454fb0bb27a5 100644 --- a/packages/taro-components/types/RichText.d.ts +++ b/packages/taro-components/types/RichText.d.ts @@ -52,6 +52,11 @@ interface RichTextProps extends StandardProps { * @supported alipay */ onLongtap?: CommonEventFunction + /** 布局兼容模式 + * @supported weapp + * @default default + */ + mode?: 'default' | 'compat' | 'aggressive' | 'inline-block' | 'web' } /** 节点类型 * > 现支持两种节点,通过type来区分,分别是元素节点和文本节点,默认是元素节点,在富文本区域里显示的HTML节点 元素节点:type = node* diff --git a/packages/taro-components/types/ScrollView.d.ts b/packages/taro-components/types/ScrollView.d.ts index 61183a1207ad..9cdb3871b9ff 100644 --- a/packages/taro-components/types/ScrollView.d.ts +++ b/packages/taro-components/types/ScrollView.d.ts @@ -144,6 +144,14 @@ interface ScrollViewProps extends StandardProps { * @default 'list' */ type?: 'list' | 'custom' | 'nested' + /** 关联的滚动容器 + * draggable-sheet - 关联 draggable-sheet 组件 3.2.0 + * nested-scroll-view - 关联 type=nested 嵌套模式 3.2.0 + * pop-gesture - 关联 页面手势返回 3.4.0 + * @supported weapp + * @default '' + */ + associativeContainer?: 'draggable-sheet' | 'nested-scroll-view' | 'pop-gesture' /** 是否反向滚动。一般初始滚动位置是在顶部,反向滚动则是在底部。 * @supported weapp * @default false @@ -289,6 +297,22 @@ interface ScrollViewProps extends StandardProps { * @supported alipay */ onTouchCancel?: CommonEventFunction + /** 同 bindscrollstart,但仅支持 worklet 作为回调 + * @supported weapp + */ + onScrollStartWorklet?: string + /** 同 bindscroll ,但仅支持 worklet 作为回调 + * @supported weapp + */ + onScrollUpdateWorklet?: string + /** 同 bindscrollend,但仅支持 worklet 作为回调 + * @supported weapp + */ + onScrollEndWorklet?: string + /** 指定手指抬起时做惯性滚动的初速度。(velocity: number) => number + * @supported weapp + */ + adjustDecelerationVelocityWorklet?: string } declare namespace ScrollViewProps { interface onScrollDetail { diff --git a/packages/taro-components/types/ShareElement.d.ts b/packages/taro-components/types/ShareElement.d.ts index 79530a366c9e..4b00ba995ea2 100644 --- a/packages/taro-components/types/ShareElement.d.ts +++ b/packages/taro-components/types/ShareElement.d.ts @@ -59,11 +59,11 @@ interface ShareElementProps extends StandardProps { | 'bounceIn' | 'bounceOut' | 'bounceInOut' - | 'cubic-bezier(x1,' + | 'cubic-bezier(x1, y1, x2, y2)' /** 动画帧回调 * @supported weapp */ - onFrame?: string + onFrameWorklet?: string } /** 共享元素 * diff --git a/packages/taro-components/types/StickyHeader.d.ts b/packages/taro-components/types/StickyHeader.d.ts index 2e08d996922d..df5ead076e98 100644 --- a/packages/taro-components/types/StickyHeader.d.ts +++ b/packages/taro-components/types/StickyHeader.d.ts @@ -13,6 +13,12 @@ interface StickyHeaderProps extends StandardProps { * @default [0, 0, 0, 0] */ padding?: [number, number, number, number] + /** + * 吸顶状态变化事件,仅支持非 worklet 的组件方法作为回调。event.detail = { isStickOnTop },当 sticky-header 吸顶时为 true,否则为 false。 + * @supported weapp + * @version >=3.6.2 + */ + onStickOnTopChange?: CommonEventFunction } /** diff --git a/packages/taro-components/types/Swiper.d.ts b/packages/taro-components/types/Swiper.d.ts index d4783a93c1e2..a9eed8ba9c66 100644 --- a/packages/taro-components/types/Swiper.d.ts +++ b/packages/taro-components/types/Swiper.d.ts @@ -141,16 +141,6 @@ interface SwiperProps extends StandardProps { * @supported swan */ disableTouchmove?: string - /** 改变 current 时使用动画过渡 - * @supported weapp - * @default true - */ - scrollWithAnimation?: boolean - /** 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) - * @supported weapp - * @default 0 - */ - cacheExtent?: number /** swiper11 相关的动效参数,具体见文档 https://swiperjs.com/swiper-api#parameters * @supported h5 */ @@ -171,6 +161,78 @@ interface SwiperProps extends StandardProps { * @supported alipay */ onAnimationEnd?: CommonEventFunction + /** 渲染模式 + * @supported weapp + * @default normal + */ + layoutType?: 'normal' | 'stackLeft' | 'stackRight' | 'tinder' | 'transformer' + /** layout-type 为 transformer 时指定动画类型 + * @supported weapp + * @default scaleAndFade + */ + transformerType?: 'scaleAndFade' | 'accordion' | 'threeD' | 'zoomIn' | 'zoomOut' | 'deepthPage' + /** 指示点动画类型 + * @supported weapp + * @default normal + */ + indicatorType?: 'normal' | 'worm' | 'wormThin' | 'wormUnderground' | 'wormThinUnderground' | 'expand' | 'jump' | 'jumpWithOffset' | 'scroll' | 'scrollFixedCenter' | 'slide' | 'slideUnderground' | 'scale' | 'swap' | 'swapYRotation' | 'color' + /** 指示点四周边距 + * @supported weapp + * @default 10 + */ + indicatorMargin?: number + /** 指示点间距 + * @supported weapp + * @default 4 + */ + indicatorSpacing?: number + /** 指示点圆角大小 + * @supported weapp + * @default 4 + */ + indicatorRadius?: number + /** 指示点宽度 + * @supported weapp + * @default 8 + */ + indicatorWidth?: number + /** 指示点高度 + * @supported weapp + * @default 8 + */ + indicatorHeight?: number + /** 指示点的相对位置 + * @supported weapp + * @default auto + */ + indicatorAlignment?: [number, number] | string + /** 指示点位置的偏移量 + * @supported weapp + * @default [0, 0] + */ + indicatorOffset?: [number, number] + /** 改变 current 时使用动画过渡 + * @supported weapp + * @default true + */ + scrollWithAnimation?: boolean + /** 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) + * @supported weapp + * @default 0 + */ + cacheExtent?: number + /** 滑动开始时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} + * @supported weapp + */ + onScrollStartWorklet?: string + /** 滑动位置更新时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} + * @supported weapp + */ + onScrollUpdateWorklet?: string + /** 滑动结束时触发,仅支持 worklet 作为回调。event.detail = {dx: dx, dy: dy} + * @supported weapp + */ + onScrollEndWorklet?: string } declare namespace SwiperProps { /** 导致变更的原因 */ diff --git a/packages/taro-components/types/Text.d.ts b/packages/taro-components/types/Text.d.ts index b93e11dbadd7..883edfb07d21 100644 --- a/packages/taro-components/types/Text.d.ts +++ b/packages/taro-components/types/Text.d.ts @@ -27,7 +27,7 @@ interface TextProps extends StandardProps { numberOfLines?: number /** * 文本溢出处理 - * @supported weapp-skyline + * @supported weapp * @default 'visible' */ overflow?: keyof TextProps.Overflow diff --git a/packages/taro-components/types/Textarea.d.ts b/packages/taro-components/types/Textarea.d.ts index be1322484e7e..a70e745b580e 100644 --- a/packages/taro-components/types/Textarea.d.ts +++ b/packages/taro-components/types/Textarea.d.ts @@ -154,6 +154,27 @@ interface TextareaProps extends StandardProps, FormItemProps { * @supported weapp, tt, harmony */ onKeyboardHeightChange?: CommonEventFunction + + /** 需传入对象,格式为 { fontSize: number, fontWeight: string, color: string } + * @supported weapp + */ + placeholderStyle?: string + /** 选区改变事件, {selectionStart, selectionEnd} + * @supported weapp + */ + onSelectionChange?: CommonEventFunction + /** 输入法开始新的输入时触发 (仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionStart?: CommonEventFunction + /** 输入法输入字符时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionUpdate?: CommonEventFunction + /** 输入法输入结束时触发(仅当输入法支持时触发) + * @supported weapp + */ + onKeyboardCompositionEnd?: CommonEventFunction } declare namespace TextareaProps { interface onFocusEventDetail { diff --git a/packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts b/packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts new file mode 100644 index 000000000000..3c20c8ec337a --- /dev/null +++ b/packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface DoubleTapGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/** 双击时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, DoubleTapGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const DoubleTapGestureHandler: ComponentType + +export { DoubleTapGestureHandler, DoubleTapGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts b/packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts new file mode 100644 index 000000000000..c36aec9a465b --- /dev/null +++ b/packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts @@ -0,0 +1,49 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface ForcePressGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**iPhone 设备重按时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, ForcePressGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const ForcePressGestureHandler: ComponentType + +export { ForcePressGestureHandler, ForcePressGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts b/packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts new file mode 100644 index 000000000000..dce2509d440a --- /dev/null +++ b/packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface HorizontalDragGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**横向滑动时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, HorizontalDragGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const HorizontalDragGestureHandler: ComponentType + +export { HorizontalDragGestureHandler, HorizontalDragGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/LongPressGestureHandler.d.ts b/packages/taro-components/types/gesture/LongPressGestureHandler.d.ts new file mode 100644 index 000000000000..567c64a1457d --- /dev/null +++ b/packages/taro-components/types/gesture/LongPressGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface LongPressGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**长按时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, LongPressGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const LongPressGestureHandler: ComponentType + +export { LongPressGestureHandler, LongPressGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/PanGestureHandler.d.ts b/packages/taro-components/types/gesture/PanGestureHandler.d.ts new file mode 100644 index 000000000000..1318dc91edca --- /dev/null +++ b/packages/taro-components/types/gesture/PanGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface PanGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**拖动(横向/纵向)时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, PanGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const PanGestureHandler: ComponentType + +export { PanGestureHandler, PanGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/ScaleGestureHandler.d.ts b/packages/taro-components/types/gesture/ScaleGestureHandler.d.ts new file mode 100644 index 000000000000..370396eefa7f --- /dev/null +++ b/packages/taro-components/types/gesture/ScaleGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface ScaleGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**多指缩放时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, ScaleGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const ScaleGestureHandler: ComponentType + +export { ScaleGestureHandler, ScaleGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/TapGestureHandler.d.ts b/packages/taro-components/types/gesture/TapGestureHandler.d.ts new file mode 100644 index 000000000000..c9286f9920ec --- /dev/null +++ b/packages/taro-components/types/gesture/TapGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface TapGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**点击时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, TapGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const TapGestureHandler: ComponentType + +export { TapGestureHandler, TapGestureHandlerProps } diff --git a/packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts b/packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts new file mode 100644 index 000000000000..4521ec9ad122 --- /dev/null +++ b/packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts @@ -0,0 +1,53 @@ +import { ComponentType } from 'react' + +import { StandardProps } from '../common' + +interface VerticalDragGestureHandlerProps extends StandardProps { + /** 声明手势协商时的组件标识 + * @supported weapp + */ + tag?: string + /** 手势识别成功的回调 + * @supported weapp + */ + onGestureWorklet?: string + /** 手指移动过程中手势是否响应 + * @supported weapp + */ + shouldResponseOnMoveWorklet?: string + /** 手势是否应该被识别 + * @supported weapp + */ + shouldAcceptGestureWorklet?: string + /** 声明可同时触发的手势节点 + * @supported weapp + */ + simultaneousHandlers?: string[] + /** 代理的原生节点类型 + * @supported weapp + */ + nativeView?: string +} + +/**纵向滑动时触发手势 + * 微信小程序下 skyline 的手势标签,只能在 CompileMode 中使用 + * @supported weapp + * @example_react + * ```tsx + * import { Component } from 'react' + * import { View, VerticalDragGestureHandler } from '@tarojs/components' + * + * export function Index () { + * return ( + * + * + * + * + * + * ) + * } + * ``` + */ +declare const VerticalDragGestureHandler: ComponentType + +export { VerticalDragGestureHandler, VerticalDragGestureHandlerProps } diff --git a/packages/taro-components/types/index.d.ts b/packages/taro-components/types/index.d.ts index b9e401cbe090..3405a60a4573 100644 --- a/packages/taro-components/types/index.d.ts +++ b/packages/taro-components/types/index.d.ts @@ -42,6 +42,14 @@ export { Switch } from './Switch' export { Textarea } from './Textarea' /** Skyline */ +export { DoubleTapGestureHandler } from './gesture/DoubleTapGestureHandler' +export { ForcePressGestureHandler } from './gesture/ForcePressGestureHandler' +export { HorizontalDragGestureHandler } from './gesture/HorizontalDragGestureHandler' +export { LongPressGestureHandler } from './gesture/LongPressGestureHandler' +export { PanGestureHandler } from './gesture/PanGestureHandler' +export { ScaleGestureHandler } from './gesture/ScaleGestureHandler' +export { TapGestureHandler } from './gesture/TapGestureHandler' +export { VerticalDragGestureHandler } from './gesture/VerticalDragGestureHandler' export { GridView } from './GridView' export { GridBuilder } from './GridBuilder' export { ListView } from './ListView' @@ -113,4 +121,4 @@ export { CustomWrapper } from './CustomWrapper' export { Slot } from './Slot' export { NativeSlot } from './NativeSlot' export { Script } from './Script' -export { PullToRefresh } from './PullToRefresh' \ No newline at end of file +export { PullToRefresh } from './PullToRefresh' diff --git a/packages/taro-extend/package.json b/packages/taro-extend/package.json index 490bd3c4da8d..3a29ce96cbe9 100644 --- a/packages/taro-extend/package.json +++ b/packages/taro-extend/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/extend", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro extend functionality", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-framework-react/package.json b/packages/taro-framework-react/package.json index 1a78e9f05224..10c0a0ea136b 100644 --- a/packages/taro-framework-react/package.json +++ b/packages/taro-framework-react/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-framework-react", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "React/Preact 框架插件", "author": "O2Team", "homepage": "https://github.com/nervjs/taro", diff --git a/packages/taro-framework-solid/package.json b/packages/taro-framework-solid/package.json index a175bf350cef..b233e08d6c57 100644 --- a/packages/taro-framework-solid/package.json +++ b/packages/taro-framework-solid/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-framework-solid", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Solid 框架插件", "author": "drchan", "homepage": "https://github.com/nervjs/taro", diff --git a/packages/taro-framework-vue3/package.json b/packages/taro-framework-vue3/package.json index 495289de9eb1..458011247b05 100644 --- a/packages/taro-framework-vue3/package.json +++ b/packages/taro-framework-vue3/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-framework-vue3", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Vue3 框架插件", "author": "O2Team", "homepage": "https://github.com/nervjs/taro", diff --git a/packages/taro-h5/package.json b/packages/taro-h5/package.json index de2c5b9c23f5..16bc1a79a70a 100644 --- a/packages/taro-h5/package.json +++ b/packages/taro-h5/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/taro-h5", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro h5 framework", "browser": "dist/index.js", "main:h5": "dist/index.esm.js", diff --git a/packages/taro-h5/src/api/route/index.ts b/packages/taro-h5/src/api/route/index.ts index dfebece1e20b..fad4b0169921 100644 --- a/packages/taro-h5/src/api/route/index.ts +++ b/packages/taro-h5/src/api/route/index.ts @@ -1,10 +1,22 @@ +import { temporarilyNotSupport } from '../../utils' + +const router = { + addRouteBuilder: /* @__PURE__ */ temporarilyNotSupport('addRouteBuilder'), + getRouteContext: /* @__PURE__ */ temporarilyNotSupport('getRouteContext'), + removeRouteBuilder: /* @__PURE__ */ temporarilyNotSupport('removeRouteBuilder') +} + // 路由 export { navigateBack, navigateTo, redirectTo, reLaunch, - switchTab + switchTab, } from '@tarojs/router' +export { + router +} + // FIXME 方法导出类型未对齐,后续修复 diff --git a/packages/taro-h5/src/api/taro.ts b/packages/taro-h5/src/api/taro.ts index fca10b97f453..7142f88118cc 100644 --- a/packages/taro-h5/src/api/taro.ts +++ b/packages/taro-h5/src/api/taro.ts @@ -2,7 +2,7 @@ import Taro from '@tarojs/api' import { history } from '@tarojs/router' import { isFunction, PLATFORM_TYPE } from '@tarojs/shared' -import { getApp, getCurrentInstance, getCurrentPages, navigateBack, navigateTo, nextTick, redirectTo, reLaunch, switchTab } from '../api' +import { getApp, getCurrentInstance, getCurrentPages, navigateBack, navigateTo, nextTick, redirectTo, reLaunch, router, switchTab, worklet } from '../api' import { permanentlyNotSupport } from '../utils' const { @@ -19,7 +19,9 @@ const { preload } = Taro as any -const taro: typeof Taro = { +type ModifiedTaro = Omit & { router: any }; + +const taro: ModifiedTaro = { // @ts-ignore Behavior, getEnv, @@ -40,7 +42,9 @@ const taro: typeof Taro = { reLaunch, redirectTo, getCurrentPages, - switchTab + switchTab, + router, + worklet, } const requirePlugin = /* @__PURE__ */ permanentlyNotSupport('requirePlugin') diff --git a/packages/taro-h5/src/api/ui/animation/worklet.ts b/packages/taro-h5/src/api/ui/animation/worklet.ts new file mode 100644 index 000000000000..cf4345616954 --- /dev/null +++ b/packages/taro-h5/src/api/ui/animation/worklet.ts @@ -0,0 +1,30 @@ +import { temporarilyNotSupport } from '../../../utils' + +const createNotSupportedObject = (obj, methods) => { + methods.forEach(method => { + Object.defineProperty(obj, method, { + get: () => temporarilyNotSupport(method) + }) + }) + return obj +} + +const easingMethods = [ + 'bounce', 'ease', 'elastic', 'linear', 'quad', 'cubic', 'poly', + 'bezier', 'circle', 'sin', 'exp', 'in', 'out', 'inOut' +] + +const workletMethods = [ + 'cancelAnimation', 'derived', 'shared', 'decay', 'spring', + 'timing', 'delay', 'repeat', 'sequence', 'runOnJS', 'runOnUI' +] + +const worklet = createNotSupportedObject({}, workletMethods) + +worklet.Easing = createNotSupportedObject({}, easingMethods) + +worklet.scrollViewContext = createNotSupportedObject({}, ['scrollTo']) + +export { + worklet +} diff --git a/packages/taro-h5/src/api/ui/index.ts b/packages/taro-h5/src/api/ui/index.ts index cca602fc41c2..59ae9053f19b 100644 --- a/packages/taro-h5/src/api/ui/index.ts +++ b/packages/taro-h5/src/api/ui/index.ts @@ -1,4 +1,5 @@ export * from './animation' +export * from './animation/worklet' export * from './background' export * from './custom-component' export * from './fonts' diff --git a/packages/taro-helper/package.json b/packages/taro-helper/package.json index 054f0682123d..6f4a6f9f6be0 100644 --- a/packages/taro-helper/package.json +++ b/packages/taro-helper/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/helper", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro Helper", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-loader/package.json b/packages/taro-loader/package.json index 21bde5c14b6a..dbcb916752ea 100644 --- a/packages/taro-loader/package.json +++ b/packages/taro-loader/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/taro-loader", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro runner use webpack loader", "author": "O2Team", "license": "MIT", @@ -29,7 +29,8 @@ "node": ">= 18" }, "dependencies": { - "@tarojs/helper": "workspace:*" + "@tarojs/helper": "workspace:*", + "@tarojs/shared": "workspace:*" }, "devDependencies": { "@tarojs/taro": "workspace:*", diff --git a/packages/taro-loader/src/independentPage.ts b/packages/taro-loader/src/independentPage.ts index c30daf93de28..00236fd7bd5b 100644 --- a/packages/taro-loader/src/independentPage.ts +++ b/packages/taro-loader/src/independentPage.ts @@ -37,6 +37,7 @@ export default function (this: webpack.LoaderContext, source: string) { ? ['!', raw, entryCacheLoader, this.resourcePath].join('!') : ['!', entryCacheLoader, this.resourcePath].join('!') const runtimePath = Array.isArray(options.runtimePath) ? options.runtimePath : [options.runtimePath] + const behaviorsName = options.behaviorsName let setReconcilerPost = '' const setReconciler = runtimePath.reduce((res, item) => { if (REG_POST.test(item)) { @@ -65,7 +66,11 @@ ${creator}(App, ${frameworkArgsCopy}) var component = require(${stringify(componentPath)}).default ${config.enableShareTimeline ? 'component.enableShareTimeline = true' : ''} ${config.enableShareAppMessage ? 'component.enableShareAppMessage = true' : ''} -var inst = Page(createPageConfig(component, '${pageName}', {}, config || {})) +var taroOption = createPageConfig(component, '${pageName}', {}, config || {}) +if (component && component.behaviors) { + taroOption.${behaviorsName} = (taroOption.${behaviorsName} || []).concat(component.behaviors) +} +var inst = Page(taroOption) ${options.prerender ? prerender : ''} export default component ` diff --git a/packages/taro-loader/src/native-component.ts b/packages/taro-loader/src/native-component.ts index 0a29a5142374..359625c68b38 100644 --- a/packages/taro-loader/src/native-component.ts +++ b/packages/taro-loader/src/native-component.ts @@ -15,6 +15,7 @@ export default function (this: webpack.LoaderContext, source: string) { const configString = JSON.stringify(config) const stringify = (s: string): string => stringifyRequest(this, s) const pageName = options.name + const behaviorsName = options.behaviorsName // raw is a placeholder loader to locate changed .vue resource const entryCacheLoader = path.join(__dirname, 'entry-cache.js') + `?name=${pageName}` entryCache.set(pageName, source) @@ -39,7 +40,11 @@ import { createNativeComponentConfig } from '${creatorLocation}' ${importFrameworkStatement} var component = require(${stringify(componentPath)}).default var config = ${configString}; -var inst = Component(createNativeComponentConfig(component, ${frameworkArgs})) +var taroOption = createNativeComponentConfig(component, ${frameworkArgs}) +if (component && component.behaviors) { + taroOption.${behaviorsName} = (taroOption.${behaviorsName} || []).concat(component.behaviors) +} +var inst = Component(taroOption) ${options.prerender ? prerender : ''} export default component ` diff --git a/packages/taro-loader/src/native-page.ts b/packages/taro-loader/src/native-page.ts index 9ab98bfb7afb..c5bd6e8ea697 100644 --- a/packages/taro-loader/src/native-page.ts +++ b/packages/taro-loader/src/native-page.ts @@ -14,6 +14,7 @@ export default function (this: webpack.LoaderContext, source: string) { const configString = JSON.stringify(config) const stringify = (s: string): string => stringifyRequest(this, s) const pageName = options.name + const behaviorsName = options.behaviorsName // raw is a placeholder loader to locate changed .vue resource const entryCacheLoader = path.join(__dirname, 'entry-cache.js') + `?name=${pageName}` entryCache.set(pageName, source) @@ -51,7 +52,11 @@ var component = require(${stringify(componentPath)}).default var config = ${configString}; ${config.enableShareTimeline ? 'component.enableShareTimeline = true' : ''} ${config.enableShareAppMessage ? 'component.enableShareAppMessage = true' : ''} -var inst = Page(createNativePageConfig(component, '${pageName}', {root:{cn:[]}}, ${frameworkArgs})) +var taroOption = createNativePageConfig(component, '${pageName}', {root:{cn:[]}}, ${frameworkArgs}) +if (component && component.behaviors) { + taroOption.${behaviorsName} = (taroOption.${behaviorsName} || []).concat(component.behaviors) +} +var inst = Page(taroOption) ${options.prerender ? prerender : ''} ${hmr} ` diff --git a/packages/taro-loader/src/page.ts b/packages/taro-loader/src/page.ts index 20a89c0fd960..0e5f99080d22 100644 --- a/packages/taro-loader/src/page.ts +++ b/packages/taro-loader/src/page.ts @@ -1,5 +1,7 @@ import * as path from 'node:path' +import { PLATFORM_TYPE } from '@tarojs/shared' + import { entryCache } from './entry-cache' import { stringifyRequest } from './util' @@ -17,6 +19,7 @@ export default function (this: webpack.LoaderContext, source: string) { const configString = JSON.stringify(config) const stringify = (s: string): string => stringifyRequest(this, s) const pageName = options.name + const behaviorsName = options.behaviorsName const { isNeedRawLoader, modifyInstantiate } = options.loaderMeta // raw is a placeholder loader to locate changed .vue resource const entryCacheLoader = path.join(__dirname, 'entry-cache.js') + `?name=${pageName}` @@ -45,6 +48,17 @@ if (typeof PRERENDER !== 'undefined') { let instantiatePage = `var inst = Page(createPageConfig(component, '${pageName}', {root:{cn:[]}}, config || {}))` + // 上面保留的instantiatePage是为了避免影响存在modifyInstantiate的平台 + if (process.env.TARO_PLATFORM === PLATFORM_TYPE.MINI) { + instantiatePage = ` +var taroOption = createPageConfig(component, '${pageName}', {root:{cn:[]}}, config || {}) +if (component && component.behaviors) { + taroOption.${behaviorsName} = (taroOption.${behaviorsName} || []).concat(component.behaviors) +} +var inst = Page(taroOption) +` + } + if (typeof modifyInstantiate === 'function') { instantiatePage = modifyInstantiate(instantiatePage, 'page') } diff --git a/packages/taro-platform-alipay/package.json b/packages/taro-platform-alipay/package.json index b3d1cdc09bd8..9358c3a8b1b2 100644 --- a/packages/taro-platform-alipay/package.json +++ b/packages/taro-platform-alipay/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-alipay", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "支付宝小程序平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-alipay/src/program.ts b/packages/taro-platform-alipay/src/program.ts index 765881b7825c..7fbccaf70bf4 100644 --- a/packages/taro-platform-alipay/src/program.ts +++ b/packages/taro-platform-alipay/src/program.ts @@ -18,6 +18,8 @@ export default class Alipay extends TaroPlatformBase { xs: '.sjs' } + behaviorsName = 'mixins' + template = new Template() /** diff --git a/packages/taro-platform-alipay/src/template.ts b/packages/taro-platform-alipay/src/template.ts index 4f604516468a..177e56e86044 100644 --- a/packages/taro-platform-alipay/src/template.ts +++ b/packages/taro-platform-alipay/src/template.ts @@ -41,6 +41,12 @@ export class Template extends RecursiveTemplate { return name } + getClickEvent () { + return { + onTap: 'eh' + } + } + getEvents () { return { onTap: 'eh', diff --git a/packages/taro-platform-h5/package.json b/packages/taro-platform-h5/package.json index 1095d0749f9c..ae3a2c1b8c6f 100644 --- a/packages/taro-platform-h5/package.json +++ b/packages/taro-platform-h5/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-h5", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Web 端平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json b/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json index e348f111a397..32222d2a421c 100644 --- a/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json +++ b/packages/taro-platform-harmony-hybrid/build/config/harmony-definition.json @@ -2175,6 +2175,9 @@ "scroll-top": false }, "custom-wrapper": true, + "double-tap-gesture-handler": { + "should-response-on-move-worklet": false + }, "draggable-sheet": { "initial-child-size": false, "min-child-size": false, @@ -2190,6 +2193,7 @@ "show-img-resize": false }, "follow-swan": false, + "force-press-gesture-handler": false, "form": { "report-submit": false, "report-submit-timeout": false @@ -2231,6 +2235,9 @@ }, "padding": false }, + "horizontal-drag-gesture-handler": { + "should-response-on-move-worklet": false + }, "icon": { "type": { "success": true, @@ -2310,7 +2317,8 @@ "safe-password-nonce": false, "safe-password-salt": false, "safe-password-custom-hash": false, - "default-value": false + "default-value": false, + "cursor-color": false }, "keyboard-accessory": false, "label": { @@ -2452,6 +2460,9 @@ "fps": false }, "login": false, + "long-press-gesture-handler": { + "should-response-on-move-worklet": false + }, "lottie": false, "map": { "longitude": true, @@ -2628,6 +2639,9 @@ "page-font-size": false, "page-orientation": false }, + "pan-gesture-handler": { + "should-response-on-move-worklet": false + }, "picker": { "mode": { "selector": { @@ -2713,6 +2727,13 @@ "ensp": false, "emsp": false, "nbsp": false + }, + "mode": { + "default": false, + "compat": false, + "aggressive": false, + "inline-block": false, + "web": false } }, "root-portal": { @@ -2720,6 +2741,9 @@ }, "rtc-room": false, "rtc-room-item": false, + "scale-gesture-handler": { + "should-response-on-move-worklet": false + }, "script": { "src": false, "module": false @@ -2771,7 +2795,12 @@ "refresher-two-level-close-threshold": false, "refresher-two-level-scroll-enabled": false, "refresher-ballistic-refresh-enabled": false, - "refresher-two-level-pinned": false + "refresher-two-level-pinned": false, + "associative-container": { + "draggable-sheet": false, + "nested-scroll-view": false, + "pop-gesture": false + } }, "share-element": { "key": false, @@ -2795,7 +2824,7 @@ "bounceIn": false, "bounceOut": false, "bounceInOut": false, - "cubic-bezier(x1,": false + "cubic-bezier(x1, y1, x2, y2)": false } }, "slider": { @@ -2851,9 +2880,7 @@ "easeInCubic": false, "easeOutCubic": false, "easeInOutCubic": false - }, - "scroll-with-animation": false, - "cache-extent": false + } }, "swiper-item": { "item-id": true, @@ -2871,6 +2898,9 @@ }, "tab-item": false, "tabs": false, + "tap-gesture-handler": { + "should-response-on-move-worklet": false + }, "text": { "selectable": false, "user-select": false, @@ -2919,6 +2949,9 @@ "adjust-keyboard-to": false, "default-value": false }, + "vertical-drag-gesture-handler": { + "should-response-on-move-worklet": false + }, "video": { "src": true, "duration": true, diff --git a/packages/taro-platform-harmony-hybrid/package.json b/packages/taro-platform-harmony-hybrid/package.json index 5d94a9805766..8a8e649cadbf 100644 --- a/packages/taro-platform-harmony-hybrid/package.json +++ b/packages/taro-platform-harmony-hybrid/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-harmony-hybrid", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Harmony 端平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-harmony/package.json b/packages/taro-platform-harmony/package.json index 2bed85f8b76f..ab19004bc037 100644 --- a/packages/taro-platform-harmony/package.json +++ b/packages/taro-platform-harmony/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-harmony-ets", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "OpenHarmony & 鸿蒙系统插件", "author": "O2Team", "homepage": "https://gitee.com/openharmony-sig/taro", diff --git a/packages/taro-platform-harmony/src/template.ts b/packages/taro-platform-harmony/src/template.ts index af1a09b151a1..f297e3bbac31 100644 --- a/packages/taro-platform-harmony/src/template.ts +++ b/packages/taro-platform-harmony/src/template.ts @@ -83,6 +83,7 @@ ${elements} const result: Components = super.createMiniComponents(components) delete result['pure-view'] + delete result['click-view'] delete result['static-view'] delete result['static-text'] delete result['static-image'] diff --git a/packages/taro-platform-jd/package.json b/packages/taro-platform-jd/package.json index 59959e82b925..bf8b77e20363 100644 --- a/packages/taro-platform-jd/package.json +++ b/packages/taro-platform-jd/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-jd", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "京东小程序平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-qq/package.json b/packages/taro-platform-qq/package.json index 9b6c18240179..f3f1d196cd57 100644 --- a/packages/taro-platform-qq/package.json +++ b/packages/taro-platform-qq/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-qq", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "QQ 小程序平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-swan/package.json b/packages/taro-platform-swan/package.json index bcf0b0cf8c75..cce66b843d41 100644 --- a/packages/taro-platform-swan/package.json +++ b/packages/taro-platform-swan/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-swan", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "百度小程序平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-swan/src/template.ts b/packages/taro-platform-swan/src/template.ts index 113b6e52a7ce..fb637ce9e80f 100644 --- a/packages/taro-platform-swan/src/template.ts +++ b/packages/taro-platform-swan/src/template.ts @@ -58,9 +58,9 @@ export class Template extends RecursiveTemplate { this.legacyMiniComponents = { ...result } delete result['pure-view'] + delete result['click-view'] delete result['static-view'] delete result['catch-view'] - delete result['click-view'] return result } diff --git a/packages/taro-platform-tt/package.json b/packages/taro-platform-tt/package.json index 77d709168cf1..c302ded91193 100644 --- a/packages/taro-platform-tt/package.json +++ b/packages/taro-platform-tt/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-tt", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "头条小程序平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-weapp/package.json b/packages/taro-platform-weapp/package.json index 0525214507eb..77d532ec6550 100644 --- a/packages/taro-platform-weapp/package.json +++ b/packages/taro-platform-weapp/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-platform-weapp", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "微信小程序平台插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-platform-weapp/src/components-react.ts b/packages/taro-platform-weapp/src/components-react.ts index 449ad301d5eb..923527074209 100644 --- a/packages/taro-platform-weapp/src/components-react.ts +++ b/packages/taro-platform-weapp/src/components-react.ts @@ -28,3 +28,11 @@ export const OpenContainer = 'open-container' export const DraggableSheet = 'draggable-sheet' export const NestedScrollHeader = 'nested-scroll-header' export const NestedScrollBody = 'nested-scroll-body' +export const DoubleTapGestureHandler = 'double-tap-gesture-handler' +export const ForcePressGestureHandler = 'force-press-gesture-handler' +export const HorizontalDragGestureHandler = 'horizontal-drag-gesture-handler' +export const LongPressGestureHandler = 'long-press-gesture-handler' +export const PanGestureHandler = 'pan-gesture-handler' +export const ScaleGestureHandler = 'scale-gesture-handler' +export const TapGestureHandler = 'tap-gesture-handler' +export const VerticalDragGestureHandler = 'vertical-drag-gesture-handler' diff --git a/packages/taro-platform-weapp/src/components.ts b/packages/taro-platform-weapp/src/components.ts index 31357b5f2c12..5599f3ca685e 100644 --- a/packages/taro-platform-weapp/src/components.ts +++ b/packages/taro-platform-weapp/src/components.ts @@ -14,7 +14,8 @@ export const components = { }, RichText: { space: _empty, - 'user-select': _false + 'user-select': _false, + mode: "'default'" }, Text: { 'user-select': _false, @@ -85,8 +86,13 @@ export const components = { 'safe-password-salt': '', 'safe-password-custom-hash': '', 'auto-fill': _empty, + 'cursor-color': '', bindKeyboardHeightChange: _empty, - bindNicknameReview: _empty + bindNicknameReview: _empty, + bindSelectionChange: _empty, + bindKeyboardCompositionStart: _empty, + bindKeyboardCompositionUpdate: _empty, + bindKeyboardCompositionEnd: _empty, }, Picker: { 'header-text': _empty, @@ -108,7 +114,12 @@ export const components = { 'disable-default-padding': _false, 'confirm-type': "'return'", 'confirm-hold': _false, - bindKeyboardHeightChange: _empty + 'adjust-keyboard-to': "'cursor'", + bindKeyboardHeightChange: _empty, + bindSelectionChange: _empty, + bindKeyboardCompositionStart: _empty, + bindKeyboardCompositionUpdate: _empty, + bindKeyboardCompositionEnd: _empty, }, ScrollView: { 'enable-flex': _false, @@ -126,6 +137,7 @@ export const components = { 'show-scrollbar': _true, 'fast-deceleration': _false, type: "'list'", + 'associative-container': "''", reverse: _false, clip: _true, 'enable-back-to-top': _false, @@ -194,7 +206,19 @@ export const components = { }, Swiper: { 'snap-to-edge': _false, - 'easing-function': "'default'" + 'easing-function': "'default'", + 'layout-type': "'normal'", + 'transformer-type': "'scaleAndFade'", + 'indicator-type': "'normal'", + 'indicator-margin': '10', + 'indicator-spacing': '4', + 'indicator-radius': '4', + 'indicator-width': '8', + 'indicator-height': '8', + 'indicator-alignment': "'auto'", + 'indicator-offset': '[0, 0]', + 'scroll-with-animation': _true, + 'cache-extent': '0', }, SwiperItem: { 'skip-hidden-item-layout': _false @@ -215,7 +239,8 @@ export const components = { }, Image: { webp: _false, - 'show-menu-by-longpress': _false + 'show-menu-by-longpress': _false, + 'fade-in': _false }, LivePlayer: { mode: "'live'", @@ -432,7 +457,11 @@ export const components = { mapkey: _empty, transform: _false, duration: '300', - 'easing-function': "'ease-out'" + 'easing-function': "'ease-out'", + 'transition-on-gesture': _false, + 'shuttle-on-push': "'to'", + 'shuttle-on-pop': "'to'", + 'rect-tween-type': "'materialRectArc'" }, KeyboardAccessory: {}, RootPortal: { @@ -476,4 +505,13 @@ export const components = { }, NestedScrollHeader: {}, NestedScrollBody: {}, + // skyline手势组件 + DoubleTapGestureHandler: {}, + ForcePressGestureHandler: {}, + HorizontalDragGestureHandler: {}, + LongPressGestureHandler: {}, + PanGestureHandler: {}, + ScaleGestureHandler: {}, + TapGestureHandler: {}, + VerticalDragGestureHandler: {}, } diff --git a/packages/taro-plugin-html/package.json b/packages/taro-plugin-html/package.json index 6ff8a7c4a67a..46ec1f067dba 100644 --- a/packages/taro-plugin-html/package.json +++ b/packages/taro-plugin-html/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-html", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 小程序端支持使用 HTML 标签的插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-plugin-html/src/runtime.ts b/packages/taro-plugin-html/src/runtime.ts index 25586a6dd6ae..80dce9688bc3 100644 --- a/packages/taro-plugin-html/src/runtime.ts +++ b/packages/taro-plugin-html/src/runtime.ts @@ -79,15 +79,16 @@ hooks.tap('modifySetAttrPayload', (element, key, payload, componentsAlias) => { const viewAlias = componentsAlias.view._num const staticViewAlias = componentsAlias['static-view']._num const catchViewAlias = componentsAlias['catch-view']._num + const clickViewAlias = componentsAlias['click-view']._num const qualifiedNameInCamelCase = toCamelCase(key) const dataPath = `${_path}.${Shortcuts.NodeName}` if (qualifiedNameInCamelCase === 'catchMove') { // catchMove = true: catch-view - // catchMove = false: view or static-view + // catchMove = false: view or click-view or static-view element.enqueueUpdate({ path: dataPath, value: payload.value ? catchViewAlias : ( - element.isAnyEventBinded() ? viewAlias : staticViewAlias + element.isOnlyClickBinded() ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : staticViewAlias) ) }) } else if (isHasExtractProp(element) && !element.isAnyEventBinded()) { @@ -132,13 +133,14 @@ hooks.tap('modifyRmAttrPayload', (element, key, payload, componentsAlias) => { const viewAlias = componentsAlias.view._num const staticViewAlias = componentsAlias['static-view']._num const pureViewAlias = componentsAlias['pure-view']._num + const clickViewAlias = componentsAlias['click-view']._num const qualifiedNameInCamelCase = toCamelCase(key) const dataPath = `${_path}.${Shortcuts.NodeName}` if (qualifiedNameInCamelCase === 'catchMove') { - // catch-view => view or static-view or pure-view + // catch-view => view or click-view or static-view or pure-view element.enqueueUpdate({ path: dataPath, - value: element.isAnyEventBinded() ? viewAlias : (isHasExtractProp(element) ? staticViewAlias : pureViewAlias) + value: element.isOnlyClickBinded() ? clickViewAlias : (element.isAnyEventBinded() ? viewAlias : (isHasExtractProp(element) ? staticViewAlias : pureViewAlias)) }) } else if (!isHasExtractProp(element)) { // static-view => pure-view diff --git a/packages/taro-plugin-html/src/utils.ts b/packages/taro-plugin-html/src/utils.ts index 4cffb97b70ed..e80620706aa7 100644 --- a/packages/taro-plugin-html/src/utils.ts +++ b/packages/taro-plugin-html/src/utils.ts @@ -39,7 +39,12 @@ export function getMappedType (nodeName: string, rawProps: Record, } } } - if (!node || node.isAnyEventBinded()) { + if (!node) { + return 'view' + } + if (node.isOnlyClickBinded()) { + return 'click-view' + } else if (node.isAnyEventBinded()) { return 'view' } else if (isHasExtractProp(node)) { return 'static-view' diff --git a/packages/taro-plugin-http/package.json b/packages/taro-plugin-http/package.json index 1ed8f7633df9..f147d5d38715 100644 --- a/packages/taro-plugin-http/package.json +++ b/packages/taro-plugin-http/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-http", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 小程序端支持使用 web 请求 的插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-plugin-inject/README.md b/packages/taro-plugin-inject/README.md index 0d5548cb2934..ca0d0e551f9e 100644 --- a/packages/taro-plugin-inject/README.md +++ b/packages/taro-plugin-inject/README.md @@ -218,6 +218,7 @@ export const nestElements = new Map([ ['cover-view', -1], ['static-view', -1], ['pure-view', -1], + ['click-view', -1], ['block', -1], ['text', -1], ['static-text', 6], diff --git a/packages/taro-plugin-inject/package.json b/packages/taro-plugin-inject/package.json index 5aaefdfa113a..064dbe02ef31 100644 --- a/packages/taro-plugin-inject/package.json +++ b/packages/taro-plugin-inject/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-inject", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 小程序端平台中间层插件", "author": "O2Team", "homepage": "https://github.com/nervjs/taro", diff --git a/packages/taro-plugin-mini-ci/package.json b/packages/taro-plugin-mini-ci/package.json index e1b98c822345..8f78f3df0300 100644 --- a/packages/taro-plugin-mini-ci/package.json +++ b/packages/taro-plugin-mini-ci/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-mini-ci", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 小程序端构建后支持CI(持续集成)的插件", "keywords": [ "Taro", diff --git a/packages/taro-plugin-react-devtools/package.json b/packages/taro-plugin-react-devtools/package.json index fb504b76b17e..655fdac07018 100644 --- a/packages/taro-plugin-react-devtools/package.json +++ b/packages/taro-plugin-react-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-react-devtools", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 小程序端支持使用 React DevTools 的插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-plugin-vue-devtools/package.json b/packages/taro-plugin-vue-devtools/package.json index 71d2ca050acf..9d83b63069b5 100644 --- a/packages/taro-plugin-vue-devtools/package.json +++ b/packages/taro-plugin-vue-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/plugin-vue-devtools", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro 小程序端支持使用 Vue DevTools 的插件", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-react/package.json b/packages/taro-react/package.json index e247a0bc284e..d92831c5b0d4 100644 --- a/packages/taro-react/package.json +++ b/packages/taro-react/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/react", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "like react-dom, but for mini apps.", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-rn-runner/package.json b/packages/taro-rn-runner/package.json index 0acc58e6e383..fa04b74726b5 100644 --- a/packages/taro-rn-runner/package.json +++ b/packages/taro-rn-runner/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/rn-runner", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "ReactNative build tool for taro", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-rn-style-transformer/package.json b/packages/taro-rn-style-transformer/package.json index fd8d13f54eca..180f407aae33 100644 --- a/packages/taro-rn-style-transformer/package.json +++ b/packages/taro-rn-style-transformer/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/rn-style-transformer", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "提供 Taro RN 统一处理样式文件能力", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-rn-supporter/package.json b/packages/taro-rn-supporter/package.json index 4975cddb1b0d..99f236c7d812 100644 --- a/packages/taro-rn-supporter/package.json +++ b/packages/taro-rn-supporter/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/rn-supporter", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro rn supporter", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-rn-transformer/package.json b/packages/taro-rn-transformer/package.json index 758ed7186aff..79efffdb42fd 100644 --- a/packages/taro-rn-transformer/package.json +++ b/packages/taro-rn-transformer/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/rn-transformer", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro RN 入口文件处理", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-rn/package.json b/packages/taro-rn/package.json index 9ee6def81f57..63f5ed1c8e97 100644 --- a/packages/taro-rn/package.json +++ b/packages/taro-rn/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/taro-rn", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro RN framework", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-router-rn/package.json b/packages/taro-router-rn/package.json index 23d11f4a4d20..fef21f2f3a82 100644 --- a/packages/taro-router-rn/package.json +++ b/packages/taro-router-rn/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/router-rn", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro-router-rn", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-router/package.json b/packages/taro-router/package.json index 1faaba0f15a6..bb3284097b48 100644 --- a/packages/taro-router/package.json +++ b/packages/taro-router/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/router", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro-router", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-runner-utils/package.json b/packages/taro-runner-utils/package.json index 80520a4e5628..ea50fd5118b1 100644 --- a/packages/taro-runner-utils/package.json +++ b/packages/taro-runner-utils/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/runner-utils", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro runner utilities.", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-runtime-rn/package.json b/packages/taro-runtime-rn/package.json index ace5be37f6cb..1c346fa0bce4 100644 --- a/packages/taro-runtime-rn/package.json +++ b/packages/taro-runtime-rn/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/runtime-rn", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "taro-runtime-rn", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-runtime/package.json b/packages/taro-runtime/package.json index 021265aa3a59..c48055460525 100644 --- a/packages/taro-runtime/package.json +++ b/packages/taro-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/runtime", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "taro runtime for mini apps.", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-runtime/src/constants/index.ts b/packages/taro-runtime/src/constants/index.ts index f2ccf9e11fc4..4d69348c8df7 100644 --- a/packages/taro-runtime/src/constants/index.ts +++ b/packages/taro-runtime/src/constants/index.ts @@ -19,6 +19,7 @@ export const FOCUS = 'focus' export const VIEW = 'view' export const STATIC_VIEW = 'static-view' export const PURE_VIEW = 'pure-view' +export const CLICK_VIEW = 'click-view' export const PROPS = 'props' export const DATASET = 'dataset' export const OBJECT = 'object' @@ -38,7 +39,6 @@ export const SET_TIMEOUT = 'setTimeout' export const COMPILE_MODE = 'compileMode' export const CATCHMOVE = 'catchMove' export const CATCH_VIEW = 'catch-view' -export const CLICK_VIEW = 'click-view' export const COMMENT = 'comment' export const ON_LOAD = 'onLoad' export const ON_READY = 'onReady' diff --git a/packages/taro-runtime/src/dom/element.ts b/packages/taro-runtime/src/dom/element.ts index 89e4711e28d8..2305f38a1030 100644 --- a/packages/taro-runtime/src/dom/element.ts +++ b/packages/taro-runtime/src/dom/element.ts @@ -4,6 +4,7 @@ import { CATCH_VIEW, CATCHMOVE, CLASS, + CLICK_VIEW, EVENT_CALLBACK_RESULT, FOCUS, ID, @@ -181,6 +182,7 @@ export class TaroElement extends TaroNode { const componentsAlias = getComponentsAlias() const _alias = componentsAlias[this.nodeName] const viewAlias = componentsAlias[VIEW]._num + const clickViewAlias = componentsAlias[CLICK_VIEW]._num const staticViewAlias = componentsAlias[STATIC_VIEW]._num const catchViewAlias = componentsAlias[CATCH_VIEW]._num const _path = this._path @@ -205,11 +207,11 @@ export class TaroElement extends TaroNode { if (this.nodeName === VIEW) { if (qualifiedNameInCamelCase === CATCHMOVE) { // catchMove = true: catch-view - // catchMove = false: view or static-view + // catchMove = false: view or click-view or static-view this.enqueueUpdate({ path: `${_path}.${Shortcuts.NodeName}`, value: value ? catchViewAlias : ( - this.isAnyEventBinded() ? viewAlias : staticViewAlias + this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias) ) }) } else if (isPureView && isHasExtractProp(this)) { @@ -254,6 +256,7 @@ export class TaroElement extends TaroNode { const viewAlias = componentsAlias[VIEW]._num const staticViewAlias = componentsAlias[STATIC_VIEW]._num const pureViewAlias = componentsAlias[PURE_VIEW]._num + const clickViewAlias = componentsAlias[CLICK_VIEW]._num const _path = this._path qualifiedName = shortcutAttr(qualifiedName) @@ -275,10 +278,10 @@ export class TaroElement extends TaroNode { if (this.nodeName === VIEW) { if (qualifiedNameInCamelCase === CATCHMOVE) { - // catch-view => view or static-view or pure-view + // catch-view => view or click-view or static-view or pure-view this.enqueueUpdate({ path: `${_path}.${Shortcuts.NodeName}`, - value: this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias) + value: this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias)) }) } else if (isStaticView && !isHasExtractProp(this)) { // static-view => pure-view diff --git a/packages/taro-runtime/src/dom/root.ts b/packages/taro-runtime/src/dom/root.ts index f3e49d73e794..d698dd16665e 100644 --- a/packages/taro-runtime/src/dom/root.ts +++ b/packages/taro-runtime/src/dom/root.ts @@ -76,17 +76,8 @@ export class TaroRootElement extends TaroElement { } public scheduleTask(fn: TFunc) { - if (isFunction(Promise)) { - Promise.resolve() - .then(fn) - .catch((error) => { - setTimeout(() => { - throw error - }) - }) - } else { - setTimeout(fn) - } + // 这里若使用微任务可略微提前setData的执行时机,但在部分场景下可能会出现连续setData两次,造成更大的性能问题 + setTimeout(fn) } public enqueueUpdate (payload: UpdatePayload): void { diff --git a/packages/taro-runtime/src/dsl/common.ts b/packages/taro-runtime/src/dsl/common.ts index a2bdffe5a4ab..8bb109b75b5a 100644 --- a/packages/taro-runtime/src/dsl/common.ts +++ b/packages/taro-runtime/src/dsl/common.ts @@ -378,7 +378,6 @@ export function createRecursiveComponentConfig (componentName?: string) { } }, options: { - addGlobalClass: true, virtualHost: !isCustomWrapper }, methods: { diff --git a/packages/taro-runtime/src/hydrate.ts b/packages/taro-runtime/src/hydrate.ts index 2287e3e4884b..70ea4b2a5c9a 100644 --- a/packages/taro-runtime/src/hydrate.ts +++ b/packages/taro-runtime/src/hydrate.ts @@ -53,15 +53,17 @@ export function hydrate (node: TaroElement | TaroText): MiniData { data.uid = node.uid } - if (!node.isAnyEventBinded() && SPECIAL_NODES.indexOf(nodeName) > -1) { - data[Shortcuts.NodeName] = `static-${nodeName}` - if (nodeName === VIEW && !isHasExtractProp(node)) { - data[Shortcuts.NodeName] = PURE_VIEW + if (SPECIAL_NODES.indexOf(nodeName) > -1) { + if (!node.isAnyEventBinded()) { + data[Shortcuts.NodeName] = `static-${nodeName}` + if (nodeName === VIEW && !isHasExtractProp(node)) { + data[Shortcuts.NodeName] = PURE_VIEW + } } - } - if (nodeName === VIEW && node.isOnlyClickBinded()) { - data[Shortcuts.NodeName] = CLICK_VIEW + if (nodeName === VIEW && node.isOnlyClickBinded()) { + data[Shortcuts.NodeName] = CLICK_VIEW + } } const { props } = node diff --git a/packages/taro-service/package.json b/packages/taro-service/package.json index 6680821c30ff..8644a63e9b3d 100644 --- a/packages/taro-service/package.json +++ b/packages/taro-service/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/service", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro Service", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-service/src/platform-plugin-base/mini.ts b/packages/taro-service/src/platform-plugin-base/mini.ts index 94b729f991e0..6c6dc750cb60 100644 --- a/packages/taro-service/src/platform-plugin-base/mini.ts +++ b/packages/taro-service/src/platform-plugin-base/mini.ts @@ -156,7 +156,8 @@ ${exampleCommand}`)) Object.assign( { runtimePath: this.runtimePath, - taroComponentsPath: this.taroComponentsPath + taroComponentsPath: this.taroComponentsPath, + behaviorsName: this.behaviorsName, }, extraOptions ) diff --git a/packages/taro-service/src/platform-plugin-base/platform.ts b/packages/taro-service/src/platform-plugin-base/platform.ts index 362dc8d12a04..3ec913641ca1 100644 --- a/packages/taro-service/src/platform-plugin-base/platform.ts +++ b/packages/taro-service/src/platform-plugin-base/platform.ts @@ -45,6 +45,8 @@ export default abstract class TaroPlatform { abstract platform: string abstract runtimePath: string | string[] + behaviorsName?: string + protected setupTransaction = new Transaction() protected buildTransaction = new Transaction() diff --git a/packages/taro-transformer-wx/package.json b/packages/taro-transformer-wx/package.json index 469660e7cf77..2c696de24e1b 100644 --- a/packages/taro-transformer-wx/package.json +++ b/packages/taro-transformer-wx/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/transformer-wx", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Transfrom Nerv Component to Wechat mini program.", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-vite-runner/package.json b/packages/taro-vite-runner/package.json index 91b2aca7a2cc..495168f97fa1 100644 --- a/packages/taro-vite-runner/package.json +++ b/packages/taro-vite-runner/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/vite-runner", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "main": "index.js", "license": "MIT", "files": [ diff --git a/packages/taro-vite-runner/src/mini/emit.ts b/packages/taro-vite-runner/src/mini/emit.ts index c9d0a9ca3f19..8c234cfa38a1 100644 --- a/packages/taro-vite-runner/src/mini/emit.ts +++ b/packages/taro-vite-runner/src/mini/emit.ts @@ -116,10 +116,11 @@ export default function (viteCompilerContext: ViteMiniCompilerContext): PluginOp // 如微信、QQ 不支持递归模版的小程序,需要使用自定义组件协助递归 const baseCompConfig = { component: true, + styleIsolation: 'apply-shared', usingComponents: { [baseCompName]: `./${baseCompName}` } - } + } as Config & { component?: boolean, usingComponents: Record } if (isUsingCustomWrapper) { baseCompConfig.usingComponents[customWrapperName] = `./${customWrapperName}` } @@ -139,6 +140,7 @@ export default function (viteCompilerContext: ViteMiniCompilerContext): PluginOp filePath: customWrapperName, config: { component: true, + styleIsolation: 'apply-shared', usingComponents: { [customWrapperName]: `./${customWrapperName}` } @@ -151,6 +153,7 @@ export default function (viteCompilerContext: ViteMiniCompilerContext): PluginOp filePath: customWrapperName, config: { component: true, + styleIsolation: 'apply-shared', usingComponents: { [customWrapperName]: `./${customWrapperName}` } diff --git a/packages/taro-vite-runner/src/utils/component.ts b/packages/taro-vite-runner/src/utils/component.ts index d931619c6778..05b11164d4b6 100644 --- a/packages/taro-vite-runner/src/utils/component.ts +++ b/packages/taro-vite-runner/src/utils/component.ts @@ -1,7 +1,7 @@ import type { IComponentConfig } from '@tarojs/taro/types/compile/hooks' export const componentConfig: IComponentConfig = { - includes: new Set(['view', 'catch-view', 'click-view', 'static-view', 'pure-view', 'scroll-view', 'image', 'static-image', 'text', 'static-text']), + includes: new Set(['view', 'catch-view', 'static-view', 'pure-view', 'click-view', 'scroll-view', 'image', 'static-image', 'text', 'static-text']), exclude: new Set(), thirdPartyComponents: new Map(), includeAll: false diff --git a/packages/taro-vite-runner/src/utils/constants.ts b/packages/taro-vite-runner/src/utils/constants.ts index 11fdc313e2dc..ffbaa213d4c8 100644 --- a/packages/taro-vite-runner/src/utils/constants.ts +++ b/packages/taro-vite-runner/src/utils/constants.ts @@ -36,6 +36,7 @@ export const DEFAULT_TERSER_OPTIONS = { unused: true, conditionals: true, dead_code: true, + directives: false, evaluate: true, }, output: { diff --git a/packages/taro-webpack5-prebundle/package.json b/packages/taro-webpack5-prebundle/package.json index 891a3e4df931..a7ddf4770a74 100644 --- a/packages/taro-webpack5-prebundle/package.json +++ b/packages/taro-webpack5-prebundle/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/webpack5-prebundle", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro app webpack5 prebundle", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-webpack5-runner/package.json b/packages/taro-webpack5-runner/package.json index 620bfdab0199..fd1c00a90c75 100644 --- a/packages/taro-webpack5-runner/package.json +++ b/packages/taro-webpack5-runner/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/webpack5-runner", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro app runner", "author": "O2Team", "license": "MIT", diff --git a/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts b/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts index 815cc0f90f69..26b59f4c9ba2 100644 --- a/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts +++ b/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts @@ -63,6 +63,7 @@ interface IOptions extends ITaroMiniPluginOptions { frameworkExts: string[] template: RecursiveTemplate | UnRecursiveTemplate runtimePath: string | string[] + behaviorsName: string isBuildPlugin: boolean blended: boolean newBlended: boolean @@ -121,6 +122,7 @@ export default class TaroMiniPlugin { frameworkExts: miniBuildConfig.frameworkExts || [], template, runtimePath: miniBuildConfig.runtimePath || '', + behaviorsName: miniBuildConfig.behaviorsName || 'behaviors', isBuildPlugin: miniBuildConfig.isBuildPlugin || false, blended: miniBuildConfig.blended || false, newBlended: miniBuildConfig.newBlended || false, @@ -264,6 +266,7 @@ export default class TaroMiniPlugin { prerender: this.prerenderPages.size > 0, config: this.appConfig, runtimePath: this.options.runtimePath, + behaviorsName: this.options.behaviorsName, blended: this.options.blended, newBlended: this.options.newBlended, pxTransformConfig @@ -296,6 +299,7 @@ export default class TaroMiniPlugin { config: this.filesConfig, appConfig: this.appConfig, runtimePath: this.options.runtimePath, + behaviorsName: this.options.behaviorsName, hot: this.options.hot } }) @@ -310,7 +314,8 @@ export default class TaroMiniPlugin { loaderMeta, name: module.name, prerender: this.prerenderPages.has(module.name), - runtimePath: this.options.runtimePath + runtimePath: this.options.runtimePath, + behaviorsName: this.options.behaviorsName, } }) } @@ -1128,6 +1133,7 @@ export default class TaroMiniPlugin { // 如微信、QQ 不支持递归模版的小程序,需要使用自定义组件协助递归 this.generateConfigFile(compilation, compiler, `${name}/${baseCompName}`, { component: true, + styleIsolation: 'apply-shared', usingComponents: { [baseCompName]: `./${baseCompName}`, [customWrapperName]: `./${customWrapperName}` @@ -1137,6 +1143,7 @@ export default class TaroMiniPlugin { } this.generateConfigFile(compilation, compiler, `${name}/${customWrapperName}`, { component: true, + styleIsolation: 'apply-shared', usingComponents: { [customWrapperName]: `./${customWrapperName}` } @@ -1220,10 +1227,11 @@ export default class TaroMiniPlugin { const baseCompConfig = { component: true, + styleIsolation: 'apply-shared', usingComponents: { [baseCompName]: `./${baseCompName}` } - } + } as Config & { component?: boolean, usingComponents: Record } if (isUsingCustomWrapper) { baseCompConfig.usingComponents[customWrapperName] = `./${customWrapperName}` @@ -1242,6 +1250,7 @@ export default class TaroMiniPlugin { if (isUsingCustomWrapper) { this.generateConfigFile(compilation, compiler, customWrapperName, { component: true, + styleIsolation: 'apply-shared', usingComponents: { [customWrapperName]: `./${customWrapperName}` } diff --git a/packages/taro-webpack5-runner/src/prerender/prerender.ts b/packages/taro-webpack5-runner/src/prerender/prerender.ts index 49f5e71d3e47..6e0fef6ec2da 100644 --- a/packages/taro-webpack5-runner/src/prerender/prerender.ts +++ b/packages/taro-webpack5-runner/src/prerender/prerender.ts @@ -221,7 +221,7 @@ export class Prerender { return data[Shortcuts.Text] } - if (nodeName === 'static-view' || nodeName === 'pure-view') { + if (nodeName === 'static-view' || nodeName === 'pure-view' || nodeName === 'click-view') { nodeName = 'view' } else if (nodeName === 'static-text') { nodeName = 'text' diff --git a/packages/taro-webpack5-runner/src/utils/component.ts b/packages/taro-webpack5-runner/src/utils/component.ts index 2204ba6826e2..c214d8970730 100644 --- a/packages/taro-webpack5-runner/src/utils/component.ts +++ b/packages/taro-webpack5-runner/src/utils/component.ts @@ -1,7 +1,7 @@ import type { IComponentConfig } from '@tarojs/taro/types/compile/hooks' export const componentConfig: IComponentConfig = { - includes: new Set(['view', 'catch-view', 'click-view', 'static-view', 'pure-view', 'scroll-view', 'image', 'static-image', 'text', 'static-text']), + includes: new Set(['view', 'catch-view', 'static-view', 'pure-view', 'click-view', 'scroll-view', 'image', 'static-image', 'text', 'static-text']), exclude: new Set(), thirdPartyComponents: new Map(), includeAll: false diff --git a/packages/taro-webpack5-runner/src/utils/types.ts b/packages/taro-webpack5-runner/src/utils/types.ts index b7bd441cc81b..23619588e908 100644 --- a/packages/taro-webpack5-runner/src/utils/types.ts +++ b/packages/taro-webpack5-runner/src/utils/types.ts @@ -62,6 +62,7 @@ export interface IMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig { template: RecursiveTemplate | UnRecursiveTemplate runtimePath?: string | string[] taroComponentsPath: string + behaviorsName: string blended?: boolean hot?: boolean } diff --git a/packages/taro-webpack5-runner/src/webpack/H5WebpackModule.ts b/packages/taro-webpack5-runner/src/webpack/H5WebpackModule.ts index a01d4c4b9ce9..3f47127c2ea4 100644 --- a/packages/taro-webpack5-runner/src/webpack/H5WebpackModule.ts +++ b/packages/taro-webpack5-runner/src/webpack/H5WebpackModule.ts @@ -271,7 +271,7 @@ export class H5WebpackModule { if (Array.isArray(compile.exclude)) { rule.exclude = [...compile.exclude] } else { - rule.exclude = [filename => /@tarojs[\\/]components/.test(filename)] + rule.exclude = [] } return rule diff --git a/packages/taro-webpack5-runner/src/webpack/MiniBaseConfig.ts b/packages/taro-webpack5-runner/src/webpack/MiniBaseConfig.ts index 6b3f925fe179..6d3d5f3776d2 100644 --- a/packages/taro-webpack5-runner/src/webpack/MiniBaseConfig.ts +++ b/packages/taro-webpack5-runner/src/webpack/MiniBaseConfig.ts @@ -34,6 +34,7 @@ export class MiniBaseConfig extends BaseConfig { unused: true, conditionals: true, dead_code: true, + directives: false, evaluate: true, }, output: { diff --git a/packages/taro-with-weapp/package.json b/packages/taro-with-weapp/package.json index 0197053f8d1c..8655012406c7 100644 --- a/packages/taro-with-weapp/package.json +++ b/packages/taro-with-weapp/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/with-weapp", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "taroize 之后的运行时", "author": "O2Team", "license": "MIT", diff --git a/packages/taro/package.json b/packages/taro/package.json index b7df9dc570d3..00f4514489ec 100644 --- a/packages/taro/package.json +++ b/packages/taro/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/taro", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "Taro framework", "author": "O2Team", "license": "MIT", diff --git a/packages/taro/types/api/route/index.d.ts b/packages/taro/types/api/route/index.d.ts index 4d5cbf8e4e84..8bc89d4b8b42 100644 --- a/packages/taro/types/api/route/index.d.ts +++ b/packages/taro/types/api/route/index.d.ts @@ -44,10 +44,16 @@ declare module '../../index' { interface Option { /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ url: string - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: (res: TaroGeneral.CallbackResult) => void /** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。 */ events?: TaroGeneral.IAnyObject + /** 2.29.2 自定义路由类型 */ + routeType?: string + /** 3.4.0 自定义路由配置 */ + routeConfig?: TaroGeneral.IAnyObject + /** 3.4.0 自定义路由参数 */ + routeOptions?: TaroGeneral.IAnyObject + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: (res: TaroGeneral.CallbackResult) => void /** 接口调用失败的回调函数 */ fail?: (res: TaroGeneral.CallbackResult) => void /** 接口调用成功的回调函数 */ @@ -115,6 +121,103 @@ declare module '../../index' { ): void } + namespace router { + type CustomRouteBuilder = (routeContext: CustomRouteContext, routeOptions: Record) => CustomRouteConfig + + interface SharedValue { + value: T + } + + interface CustomRouteContext { + // 动画控制器,影响推入页面的进入和退出过渡效果 + primaryAnimation: SharedValue + // 动画控制器状态 + primaryAnimationStatus: SharedValue + // 动画控制器,影响栈顶页面的推出过渡效果 + secondaryAnimation: SharedValue + // 动画控制器状态 + secondaryAnimationStatus: SharedValue + // 当前路由进度由手势控制 + userGestureInProgress: SharedValue + // 手势开始控制路由 + startUserGesture: () => void + // 手势不再控制路由 + stopUserGesture: () => void + // 返回上一级,效果同 wx.navigateBack + didPop: () => void + } + + interface CustomRouteConfig { + // 下一个页面推入后,不显示前一个页面 + opaque?: boolean + // 是否保持前一个页面状态 + maintainState?: boolean + // 页面推入动画时长,单位 ms + transitionDuration?: number + // 页面推出动画时长,单位 ms + reverseTransitionDuration?: number + // 遮罩层背景色,支持 rgba() 和 #RRGGBBAA 写法 + barrierColor?: string + // 点击遮罩层返回上一页 + barrierDismissible?: boolean + // 无障碍语义 + barrierLabel?: string + // 是否与下一个页面联动,决定当前页 secondaryAnimation 是否生效 + canTransitionTo?: boolean + // 是否与前一个页面联动,决定前一个页 secondaryAnimation 是否生效 + canTransitionFrom?: boolean + // 处理当前页的进入/退出动画,返回 StyleObject + handlePrimaryAnimation?: RouteAnimationHandler + // 处理当前页的压入/压出动画,返回 StyleObject + handleSecondaryAnimation?: RouteAnimationHandler + // 处理上一级页面的压入/压出动画,返回 StyleObject 基础库 <3.0.0> 起支持 + handlePreviousPageAnimation?: RouteAnimationHandler + // 页面进入时是否采用 snapshot 模式优化动画性能 基础库 <3.2.0> 起支持 + allowEnterRouteSnapshotting?: boolean + // 页面退出时是否采用 snapshot 模式优化动画性能 基础库 <3.2.0> 起支持 + allowExitRouteSnapshotting?: boolean + // 右滑返回时,可拖动范围是否撑满屏幕,基础库 <3.2.0> 起支持,常用于半屏弹窗 + fullscreenDrag?: boolean + // 返回手势方向 基础库 <3.4.0> 起支持 + popGestureDirection?: 'horizontal' | 'vertical' | 'multi' + } + + type RouteAnimationHandler = () => { [key: string] : any} + + /** 自定义路由 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/wx.router.html + */ + interface router { + /** 添加自定义路由配置 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.addRouteBuilder.html + */ + addRouteBuilder( + /** 路由类型 */ + routeType: string, + /** 路由动画定义函数 */ + routeBuilder: CustomRouteBuilder + ): void + /** 获取页面对应的自定义路由上下文对象 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.getRouteContext.html + */ + getRouteContext( + /** 页面/自定义组件实例 */ + instance: TaroGeneral.IAnyObject + ): CustomRouteContext + /** 移除自定义路由配置 + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.removeRouteBuilder.html + */ + removeRouteBuilder( + /** 路由类型 */ + routeType: string, + ): void + } + } + interface TaroStatic { /** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面 * @supported weapp, h5, rn, tt, harmony, harmony_hybrid @@ -216,5 +319,6 @@ declare module '../../index' { * @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html */ navigateBack(option?: navigateBack.Option): Promise + router: router.router } } diff --git a/packages/taro/types/api/skyline/index.d.ts b/packages/taro/types/api/skyline/index.d.ts index d6a5700e6d76..447c50a2d26e 100644 --- a/packages/taro/types/api/skyline/index.d.ts +++ b/packages/taro/types/api/skyline/index.d.ts @@ -56,4 +56,290 @@ declare module '../../index' { } } } + + /** + * DraggableSheet 实例,可通过 Taro.createSelectorQuery 的 NodesRef.node 方法获取。 + * + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.html + */ + interface DraggableSheetContext { + /** + * 滚动到指定位置。size 取值 [0, 1],size = 1 时表示撑满 draggable-sheet 组件。size 和 pixels 同时传入时,仅 size 生效。 + * @param option + * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.scrollTo.html + */ + scrollTo(option: DraggableSheetContext.scrollTo.Option): void + } + + namespace DraggableSheetContext { + namespace scrollTo { + interface Option { + /** 相对目标位置 */ + size?: number + /** 绝对目标位置 */ + pixels?: number + /** + * 是否启用滚动动画 + * @default true + */ + animated?: boolean + /** + * 滚动动画时长(ms) + * @default 300 + */ + duration?: number + /** + * 缓动函数 + * @default ease + */ + easingFunction?: string + } + } + } + + /** + * worklet 对象,可以通过 wx.worklet 获取 + * + * @supported weapp + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html + */ + interface worklet { + /** + * 取消由 SharedValue 驱动的动画 + * @param SharedValue + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.cancelAnimation.html + */ + cancelAnimation(SharedValue: worklet.SharedValue): void + /** + * 衍生值 DerivedValue,可基于已有的 SharedValue 生成其它共享变量。 + * @param updaterWorklet + * @returns 返回 DerivedValue 类型值,可被 worklet 函数捕获。DerivedValue 也是 SharedValue 类型。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.derived.html + */ + derived(updaterWorklet: worklet.WorkletFunction): worklet.DerivedValue + /** + * ScrollView 实例,可在 worklet 函数内操作 scroll-view 组件。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.html + */ + scrollViewContext: { + /** + * 滚动至指定位置 + * @param object + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.scrollTo.html + */ + scrollTo(NodesRef: TaroGeneral.IAnyObject, object: worklet.scrollViewContext.Option): void + } + /** + * 创建共享变量 SharedValue,用于跨线程共享数据和驱动动画。 + * @param initialValue + * @returns 返回 SharedValue 类型值,可被 worklet 函数捕获。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.shared.html + */ + shared(initialValue: number | string | bool | null | undefined | Object | Array | Function): worklet.SharedValue + /** + * 基于滚动衰减的动画。 + * @param options 动画配置 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.decay.html + */ + decay(options?: worklet.decay.Option, callback?: (flag: boolean) => void): worklet.AnimationObject + Easing: worklet.Easing + /** + * 基于物理的动画。 + * @param toValue 目标值 + * @param options 动画配置 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.spring.html + */ + spring(toValue: number | string, options?: worklet.spring.Option, callback?: (flag: boolean) => void): worklet.AnimationObject + /** + * 基于时间的动画。 + * @param toValue 目标值 + * @param options 动画配置 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.timing.html + */ + timing(toValue: number | string, options?: worklet.timing.Option, callback?: (flag: boolean) => void): worklet.AnimationObject + /** + * 延迟执行动画。 + * @param delayMS 动画开始前等待的时间,单位:毫秒 + * @param delayedAnimation 动画对象 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.delay.html + */ + delay(delayMS: number, delayedAnimation: worklet.AnimationObject): worklet.AnimationObject + /** + * 重复执行动画。 + * @param animation 动画对象 + * @param numberOfReps 重复次数。为负值时一直循环,直到被取消动画。 + * @param reverse 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。 + * @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.repeat.html + */ + repeat(delayedAnimation: worklet.AnimationObject, numberOfReps: number, reverse?: boolean, callback?: (flag: boolean) => void): worklet.AnimationObject + /** + * 组合动画序列,依次执行传入的动画。 + * @param animation 动画对象 + * @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.sequence.html + */ + sequence(...delayedAnimation: worklet.AnimationObject): worklet.AnimationObject + /** + * worklet 函数运行在 UI 线程时,捕获的外部函数可能为 worklet 类型或普通函数,为了更明显的对其区分,要求必须使用 runOnJS 调回 JS 线程的普通函数。 有这样的要求是因为,调用其它 worklet 函数时是同步调用,但在 UI 线程执行 JS 线程的函数只能是异步,开发者容易混淆,试图同步获取 JS 线程的返回值。 + * @param fn worklet 类型函数 + * @returns runOnJS 为高阶函数,返回一个函数,执行时运行在 JS 线程 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnJS.html + */ + runOnJS(fn: TaroGeneral.TFunc): TaroGeneral.TFunc + /** + * 在 UI 线程执行 worklet 函数 + * @param fn worklet 类型函数 + * @returns runOnUI 为高阶函数,返回一个函数,执行时运行在 UI 线程 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnUI.html + */ + runOnUI(fn: TaroGeneral.TFunc): TaroGeneral.TFunc + } + + namespace worklet { + type SharedValue = TaroGeneral.IAnyObject + type DerivedValue = worklet.SharedValue + type AnimationObject = TaroGeneral.IAnyObject + type WorkletFunction = TaroGeneral.TFunc + + namespace scrollViewContext { + interface Option { + /** 顶部距离 */ + top?: number + /** 左边界距离 */ + left?: number + /** 滚动动画时长 */ + duration?: number + /** 是否启用滚动动画 */ + animated?: boolean + /** 动画曲线 */ + easingFunction?: string + } + } + + namespace decay { + interface Option { + /** 初速度 */ + velocity?: number + /** 衰减速率 */ + deceleration?: number + /** 边界值,长度为 2 的数组 */ + clamp?: Array + } + } + + interface Easing { + /** + * 简单的反弹效果 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + bounce(t: number): any; + /** + * 简单的惯性动画 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + ease(t: number): any; + /** + * 简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + elastic(bounciness?: number): any; + /** + * 线性函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + linear(t: number): any; + /** + * 二次方函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + quad(t: number): any; + /** + * 立方函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + cubic(t: number): any; + /** + * 高阶函数,返回幂函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + poly(n: number): any; + /** + * 三次贝塞尔曲线,效果同 css transition-timing-function + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + bezier(x1: number, y1: number, x2: number, y2: number): any; + /** + * 圆形曲线 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + circle(t: number): any; + /** + * 正弦函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + sin(t: number): any; + /** + * 指数函数 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + exp(t: number): any; + /** + * 正向运行 easing function,高阶函数。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + in(easing: (t: number) => any): any; + /** + * 反向运行 easing function,高阶函数。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + out(easing: (t: number) => any): any; + /** + * 前半程正向,后半程反向,高阶函数。 + * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html + */ + inOut(easing: (t: number) => any): any; + } + + namespace spring { + interface Option { + /** 阻尼系数 */ + damping?: number + /** 重量系数,值越大移动越慢 */ + mass?: number + /** 弹性系数 */ + stiffness?: number + /** 动画是否可以在指定值上反弹 */ + overshootClamping?: boolean + /** 弹簧静止时的位移 */ + restDisplacementThreshold?: number + /** 弹簧静止的速度 */ + restSpeedThreshold?: number + /** 速度 */ + velocity?: number + } + } + + namespace timing { + interface Option { + /** 动画时长 */ + duration?: number + /** 动画曲线 */ + easing?: (t: number) => number + } + } + } + + interface TaroStatic { + worklet: worklet + } } diff --git a/packages/taro/types/compile/config/h5.d.ts b/packages/taro/types/compile/config/h5.d.ts index 088d4164c5c1..d0fb0ee7f538 100644 --- a/packages/taro/types/compile/config/h5.d.ts +++ b/packages/taro/types/compile/config/h5.d.ts @@ -119,8 +119,9 @@ export interface IH5Config { /** Web 编译过程的相关配置 */ compile?: { - exclude?: (string | RegExp)[] - include?: (string | RegExp)[] + exclude?: any[] + include?: any[] + /** 对应 @rollup/plugin-babel 插件的 filter 配置。只在 vite 编译模式下有效 */ filter?: (filename: string) => boolean } /** 生成的代码是否要兼容旧版浏览器,值为 true 时,会去读取 package.json 的 browserslist 字段。只在 vite 编译模式下有效 */ diff --git a/packages/taro/types/compile/config/mini.d.ts b/packages/taro/types/compile/config/mini.d.ts index 4bc69cc634c8..d7514669e3bf 100644 --- a/packages/taro/types/compile/config/mini.d.ts +++ b/packages/taro/types/compile/config/mini.d.ts @@ -91,8 +91,9 @@ export interface IMiniAppConfig /** 小程序编译过程的相关配置 */ compile?: { - exclude?: (string | RegExp)[] - include?: (string | RegExp)[] + exclude?: any[] + include?: any[] + /** 对应 @rollup/plugin-babel 插件的 filter 配置。只在 vite 编译模式下有效 */ filter?: (filename: string) => boolean } diff --git a/packages/taro/types/taro.component.d.ts b/packages/taro/types/taro.component.d.ts index d1d36c31a059..5ae244eaee6d 100644 --- a/packages/taro/types/taro.component.d.ts +++ b/packages/taro/types/taro.component.d.ts @@ -130,6 +130,26 @@ declare module './index' { /** 是否返回变更的 data 字段信息 */ withDataPaths?: boolean }, listener: () => void): void + /** + * 绑定由 worklet 驱动的样式到相应的节点 + * @param selector 节点选择器 + * @param updater worklet 样式更新函数 + * @param config 配置项 + * @param callback 完成样式绑定的回调 + * */ + applyAnimatedStyle?(selector: string, updater: TaroGeneral.TFunc, config?: { + /** 是否立即执行一次 updater 函数 */ + immediate?: boolean + /** 刷新时机,枚举值 async / sync */ + flush?: string + }, callback?: TaroGeneral.TFunc): void + /** + * 清除节点上 worklet 驱动样式的绑定关系 + * @param selector 节点选择器 + * @param styleIds 需要清除的 styleId 集合 + * @param callback 清除样式绑定的回调 + * */ + clearAnimatedStyle?(selector: string, styleIds: Array, callback?: TaroGeneral.TFunc): void } interface PageInstance extends PageLifeCycle, ComponentInstance { /** 页面配置 */ diff --git a/packages/taroize/package.json b/packages/taroize/package.json index 72b74975adf3..53de051c608f 100644 --- a/packages/taroize/package.json +++ b/packages/taroize/package.json @@ -1,6 +1,6 @@ { "name": "@tarojs/taroize", - "version": "4.0.8-beta.0", + "version": "4.0.8-beta.1", "description": "转换原生微信小程序代码为 Taro 代码", "author": "O2Team", "license": "MIT", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73639f78dbb0..2b94338362bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1357,6 +1357,9 @@ importers: '@tarojs/helper': specifier: workspace:* version: link:../taro-helper + '@tarojs/shared': + specifier: workspace:* + version: link:../shared devDependencies: '@tarojs/taro': specifier: workspace:* diff --git a/scripts/debug.js b/scripts/debug.js index 1da0b437df01..db760bbfed8c 100644 --- a/scripts/debug.js +++ b/scripts/debug.js @@ -64,7 +64,15 @@ function forceInstall() { } function runDevConcurrently() { - const commands = packages.map(pkg => `pnpm --filter ${pkg} run dev`) + const excludePkg = ['@tarojs/taro'] + const commands = packages.filter(pkg => !excludePkg.includes(pkg)).map(pkg => { + const devMap = { + '@tarojs/components': 'dev:components' + } + return `pnpm --filter ${pkg} run ${devMap[pkg] || 'dev'}` + }) + + if (!commands.length) return const { result } = concurrently(commands, { prefix: 'name', diff --git a/tests/__tests__/__snapshots__/babel.spec.ts.snap b/tests/__tests__/__snapshots__/babel.spec.ts.snap index d5f161c297b7..fe7604080eb8 100644 --- a/tests/__tests__/__snapshots__/babel.spec.ts.snap +++ b/tests/__tests__/__snapshots__/babel.spec.ts.snap @@ -83,7 +83,8 @@ require("./runtime"); }, RichText: { space: _empty, - "user-select": _false + "user-select": _false, + mode: "'default'" }, Text: { "user-select": _false, @@ -154,8 +155,13 @@ require("./runtime"); "safe-password-salt": "", "safe-password-custom-hash": "", "auto-fill": _empty, + "cursor-color": "", bindKeyboardHeightChange: _empty, - bindNicknameReview: _empty + bindNicknameReview: _empty, + bindSelectionChange: _empty, + bindKeyboardCompositionStart: _empty, + bindKeyboardCompositionUpdate: _empty, + bindKeyboardCompositionEnd: _empty }, Picker: { "header-text": _empty, @@ -177,7 +183,12 @@ require("./runtime"); "disable-default-padding": _false, "confirm-type": "'return'", "confirm-hold": _false, - bindKeyboardHeightChange: _empty + "adjust-keyboard-to": "'cursor'", + bindKeyboardHeightChange: _empty, + bindSelectionChange: _empty, + bindKeyboardCompositionStart: _empty, + bindKeyboardCompositionUpdate: _empty, + bindKeyboardCompositionEnd: _empty }, ScrollView: { "enable-flex": _false, @@ -195,6 +206,7 @@ require("./runtime"); "show-scrollbar": _true, "fast-deceleration": _false, type: "'list'", + "associative-container": "''", reverse: _false, clip: _true, "enable-back-to-top": _false, @@ -263,7 +275,19 @@ require("./runtime"); }, Swiper: { "snap-to-edge": _false, - "easing-function": "'default'" + "easing-function": "'default'", + "layout-type": "'normal'", + "transformer-type": "'scaleAndFade'", + "indicator-type": "'normal'", + "indicator-margin": "10", + "indicator-spacing": "4", + "indicator-radius": "4", + "indicator-width": "8", + "indicator-height": "8", + "indicator-alignment": "'auto'", + "indicator-offset": "[0, 0]", + "scroll-with-animation": _true, + "cache-extent": "0" }, SwiperItem: { "skip-hidden-item-layout": _false @@ -284,7 +308,8 @@ require("./runtime"); }, Image: { webp: _false, - "show-menu-by-longpress": _false + "show-menu-by-longpress": _false, + "fade-in": _false }, LivePlayer: { mode: "'live'", @@ -495,7 +520,11 @@ require("./runtime"); mapkey: _empty, transform: _false, duration: "300", - "easing-function": "'ease-out'" + "easing-function": "'ease-out'", + "transition-on-gesture": _false, + "shuttle-on-push": "'to'", + "shuttle-on-pop": "'to'", + "rect-tween-type": "'materialRectArc'" }, KeyboardAccessory: {}, RootPortal: { @@ -538,7 +567,15 @@ require("./runtime"); snapSizes: "[]" }, NestedScrollHeader: {}, - NestedScrollBody: {} + NestedScrollBody: {}, + DoubleTapGestureHandler: {}, + ForcePressGestureHandler: {}, + HorizontalDragGestureHandler: {}, + LongPressGestureHandler: {}, + PanGestureHandler: {}, + ScaleGestureHandler: {}, + TapGestureHandler: {}, + VerticalDragGestureHandler: {} }; const hostConfig = { initNativeApi: initNativeApi, @@ -716,20 +753,20 @@ require("./runtime"); -