From 680349031eba6a76bd5904f9ac075a844f690e1f Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Wed, 6 Nov 2024 10:47:20 +0800 Subject: [PATCH 01/13] =?UTF-8?q?perf(setData):=20setData=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E6=9C=BA=E6=94=B9=E5=9B=9E=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=AE=8F=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-runtime/src/dom/root.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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 { From cc5f6dd2ef6ce85fbd56020ae9cc8e2d0184469f Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Wed, 6 Nov 2024 11:19:05 +0800 Subject: [PATCH 02/13] =?UTF-8?q?fix(setData):=20=E4=BF=AE=E5=A4=8Dworklet?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E8=A2=ABterser=E7=A7=BB=E9=99=A4=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20#14902?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-vite-runner/src/utils/constants.ts | 1 + packages/taro-webpack5-runner/src/webpack/MiniBaseConfig.ts | 1 + 2 files changed, 2 insertions(+) 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-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: { From d1c96b1bb7ba0515440aa509575f44fe60be26de Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Wed, 6 Nov 2024 16:50:02 +0800 Subject: [PATCH 03/13] =?UTF-8?q?fix(clickview):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9Dview=E7=82=B9=E5=87=BB=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98&=E5=AE=8C?= =?UTF-8?q?=E5=96=84click-view=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=20#1681?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/shared/src/components.ts | 2 +- packages/shared/src/template.ts | 9 +++++++-- packages/taro-platform-alipay/src/template.ts | 6 ++++++ packages/taro-platform-harmony/src/template.ts | 1 + packages/taro-platform-swan/src/template.ts | 2 +- packages/taro-plugin-html/src/runtime.ts | 10 ++++++---- packages/taro-plugin-html/src/utils.ts | 7 ++++++- packages/taro-plugin-inject/README.md | 1 + packages/taro-runtime/src/constants/index.ts | 2 +- packages/taro-runtime/src/dom/element.ts | 11 +++++++---- packages/taro-runtime/src/hydrate.ts | 16 +++++++++------- packages/taro-vite-runner/src/utils/component.ts | 2 +- .../src/prerender/prerender.ts | 2 +- .../taro-webpack5-runner/src/utils/component.ts | 2 +- 14 files changed, 49 insertions(+), 24 deletions(-) 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/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-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-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-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-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-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/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-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-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 From def9cd87a4f8ff8c680bcef70526e76a4765bc03 Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Wed, 13 Nov 2024 14:06:17 +0800 Subject: [PATCH 04/13] =?UTF-8?q?fix(skyline):=20=E9=80=82=E9=85=8Dskyline?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=8F=8AAPI(=E9=9D=9Eworklet=E9=83=A8?= =?UTF-8?q?=E5=88=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-components/types/Image.d.ts | 2 +- packages/taro-components/types/Input.d.ts | 20 ++++ packages/taro-components/types/RichText.d.ts | 5 + .../taro-components/types/ScrollView.d.ts | 8 ++ .../taro-components/types/ShareElement.d.ts | 2 +- .../taro-components/types/StickyHeader.d.ts | 6 + packages/taro-components/types/Swiper.d.ts | 70 ++++++++++-- packages/taro-components/types/Textarea.d.ts | 21 ++++ packages/taro-h5/src/api/route/index.ts | 14 ++- packages/taro-h5/src/api/taro.ts | 9 +- .../taro-platform-weapp/src/components.ts | 41 ++++++- packages/taro-runtime/src/dsl/common.ts | 1 - packages/taro-vite-runner/src/mini/emit.ts | 3 + .../src/plugins/MiniPlugin.ts | 4 + packages/taro/types/api/route/index.d.ts | 108 +++++++++++++++++- packages/taro/types/api/skyline/index.d.ts | 41 +++++++ 16 files changed, 330 insertions(+), 25 deletions(-) diff --git a/packages/taro-components/types/Image.d.ts b/packages/taro-components/types/Image.d.ts index f0cc0fafe5c2..ca7a8f472e08 100644 --- a/packages/taro-components/types/Image.d.ts +++ b/packages/taro-components/types/Image.d.ts @@ -62,7 +62,7 @@ interface ImageProps extends StandardProps { */ ariaLabel?: string /** 是否渐显 - * @supported weapp + * @supported weapp-skyline * @default false */ fadeIn?: boolean diff --git a/packages/taro-components/types/Input.d.ts b/packages/taro-components/types/Input.d.ts index 69efb7ad8692..5b602ff8f76f 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,22 @@ interface InputProps extends StandardProps, FormItemProps { * @supported weapp */ onNickNameReview?: CommonEventFunction + /** 选区改变事件, {selectionStart, selectionEnd} + * @supported weapp-skyline + */ + onSelectionChange?: CommonEventFunction + /** 输入法开始新的输入时触发 (仅当输入法支持时触发) + * @supported weapp-skyline + */ + onKeyboardCompositionStart?: CommonEventFunction + /** 输入法输入字符时触发(仅当输入法支持时触发) + * @supported weapp-skyline + */ + onKeyboardCompositionUpdate?: CommonEventFunction + /** 输入法输入结束时触发(仅当输入法支持时触发) + * @supported weapp-skyline + */ + onKeyboardCompositionEnd?: CommonEventFunction } declare namespace InputProps { /** Input 类型 */ diff --git a/packages/taro-components/types/RichText.d.ts b/packages/taro-components/types/RichText.d.ts index 106dac705288..1daf3b4d46c8 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-skyline + * @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..e0053b5d3dd9 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 diff --git a/packages/taro-components/types/ShareElement.d.ts b/packages/taro-components/types/ShareElement.d.ts index 79530a366c9e..e981f6c68984 100644 --- a/packages/taro-components/types/ShareElement.d.ts +++ b/packages/taro-components/types/ShareElement.d.ts @@ -59,7 +59,7 @@ interface ShareElementProps extends StandardProps { | 'bounceIn' | 'bounceOut' | 'bounceInOut' - | 'cubic-bezier(x1,' + | 'cubic-bezier(x1, y1, x2, y2)' /** 动画帧回调 * @supported weapp */ 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..e63e81570d10 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,66 @@ interface SwiperProps extends StandardProps { * @supported alipay */ onAnimationEnd?: CommonEventFunction + /** 渲染模式 + * @supported weapp-skyline + * @default normal + */ + layoutType?: 'normal' | 'stackLeft' | 'stackRight' | 'tinder' | 'transformer' + /** layout-type 为 transformer 时指定动画类型 + * @supported weapp-skyline + * @default scaleAndFade + */ + transformerType?: 'scaleAndFade' | 'accordion' | 'threeD' | 'zoomIn' | 'zoomOut' | 'deepthPage' + /** 指示点动画类型 + * @supported weapp-skyline + * @default normal + */ + indicatorType?: 'normal' | 'worm' | 'wormThin' | 'wormUnderground' | 'wormThinUnderground' | 'expand' | 'jump' | 'jumpWithOffset' | 'scroll' | 'scrollFixedCenter' | 'slide' | 'slideUnderground' | 'scale' | 'swap' | 'swapYRotation' | 'color' + /** 指示点四周边距 + * @supported weapp-skyline + * @default 10 + */ + indicatorMargin?: number + /** 指示点间距 + * @supported weapp-skyline + * @default 4 + */ + indicatorSpacing?: number + /** 指示点圆角大小 + * @supported weapp-skyline + * @default 4 + */ + indicatorRadius?: number + /** 指示点宽度 + * @supported weapp-skyline + * @default 8 + */ + indicatorWidth?: number + /** 指示点高度 + * @supported weapp-skyline + * @default 8 + */ + indicatorHeight?: number + /** 指示点的相对位置 + * @supported weapp-skyline + * @default auto + */ + indicatorAlignment?: [number, number] | string + /** 指示点位置的偏移量 + * @supported weapp-skyline + * @default [0, 0] + */ + indicatorOffset?: [number, number] + /** 改变 current 时使用动画过渡 + * @supported weapp-skyline + * @default true + */ + scrollWithAnimation?: boolean + /** 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) + * @supported weapp-skyline + * @default 0 + */ + cacheExtent?: number } declare namespace SwiperProps { /** 导致变更的原因 */ diff --git a/packages/taro-components/types/Textarea.d.ts b/packages/taro-components/types/Textarea.d.ts index be1322484e7e..6638539e8903 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-skyline + */ + placeholderStyle?: string + /** 选区改变事件, {selectionStart, selectionEnd} + * @supported weapp-skyline + */ + onSelectionChange?: CommonEventFunction + /** 输入法开始新的输入时触发 (仅当输入法支持时触发) + * @supported weapp-skyline + */ + onKeyboardCompositionStart?: CommonEventFunction + /** 输入法输入字符时触发(仅当输入法支持时触发) + * @supported weapp-skyline + */ + onKeyboardCompositionUpdate?: CommonEventFunction + /** 输入法输入结束时触发(仅当输入法支持时触发) + * @supported weapp-skyline + */ + onKeyboardCompositionEnd?: CommonEventFunction } declare namespace TextareaProps { interface onFocusEventDetail { 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..556193984335 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 } 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,8 @@ const taro: typeof Taro = { reLaunch, redirectTo, getCurrentPages, - switchTab + switchTab, + router, } const requirePlugin = /* @__PURE__ */ permanentlyNotSupport('requirePlugin') diff --git a/packages/taro-platform-weapp/src/components.ts b/packages/taro-platform-weapp/src/components.ts index 31357b5f2c12..7ec885196cc9 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: { 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-vite-runner/src/mini/emit.ts b/packages/taro-vite-runner/src/mini/emit.ts index c9d0a9ca3f19..2a7ca8406cb3 100644 --- a/packages/taro-vite-runner/src/mini/emit.ts +++ b/packages/taro-vite-runner/src/mini/emit.ts @@ -116,6 +116,7 @@ export default function (viteCompilerContext: ViteMiniCompilerContext): PluginOp // 如微信、QQ 不支持递归模版的小程序,需要使用自定义组件协助递归 const baseCompConfig = { component: true, + styleIsolation: 'apply-shared', usingComponents: { [baseCompName]: `./${baseCompName}` } @@ -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-webpack5-runner/src/plugins/MiniPlugin.ts b/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts index a6ce0e68b4f7..361a46e157e5 100644 --- a/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts +++ b/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts @@ -1128,6 +1128,7 @@ export default class TaroMiniPlugin { // 如微信、QQ 不支持递归模版的小程序,需要使用自定义组件协助递归 this.generateConfigFile(compilation, compiler, `${name}/${baseCompName}`, { component: true, + styleIsolation: 'apply-shared', usingComponents: { [baseCompName]: `./${baseCompName}`, [customWrapperName]: `./${customWrapperName}` @@ -1137,6 +1138,7 @@ export default class TaroMiniPlugin { } this.generateConfigFile(compilation, compiler, `${name}/${customWrapperName}`, { component: true, + styleIsolation: 'apply-shared', usingComponents: { [customWrapperName]: `./${customWrapperName}` } @@ -1220,6 +1222,7 @@ export default class TaroMiniPlugin { const baseCompConfig = { component: true, + styleIsolation: 'apply-shared', usingComponents: { [baseCompName]: `./${baseCompName}` } @@ -1242,6 +1245,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/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..cf8d4fed0c98 100644 --- a/packages/taro/types/api/skyline/index.d.ts +++ b/packages/taro/types/api/skyline/index.d.ts @@ -56,4 +56,45 @@ 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 + } + } + } } From 21ad34d0a69373ae52172b5b3462c13285adea1c Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Tue, 19 Nov 2024 17:33:31 +0800 Subject: [PATCH 05/13] =?UTF-8?q?fix(skyline):=20=E9=80=82=E9=85=8Dskyline?= =?UTF-8?q?=20worklet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/tests/attributes.rs | 1 + .../swc_plugin_compile_mode/src/transform.rs | 9 + .../swc_plugin_compile_mode/src/utils/mod.rs | 13 + .../attributes.rs/should_handle_events.js | 14 +- .../double-tap-gesture-handler/readme.md | 10 + .../double-tap-gesture-handler/script.tsx | 18 ++ .../force-press-gesture-handler/readme.md | 10 + .../force-press-gesture-handler/script.tsx | 18 ++ .../horizontal-drag-gesture-handler/readme.md | 10 + .../script.tsx | 18 ++ .../long-press-gesture-handler/readme.md | 10 + .../long-press-gesture-handler/script.tsx | 18 ++ .../components/pan-gesture-handler/readme.md | 10 + .../components/pan-gesture-handler/script.tsx | 18 ++ .../scale-gesture-handler/readme.md | 10 + .../scale-gesture-handler/script.tsx | 18 ++ .../src/components/script/readme.md | 10 + .../src/components/script/script.tsx | 18 ++ .../components/tap-gesture-handler/readme.md | 10 + .../components/tap-gesture-handler/script.tsx | 18 ++ .../vertical-drag-gesture-handler/readme.md | 10 + .../vertical-drag-gesture-handler/script.tsx | 18 ++ .../taro-components/types/DraggableSheet.d.ts | 5 + packages/taro-components/types/Image.d.ts | 2 +- packages/taro-components/types/Input.d.ts | 12 +- packages/taro-components/types/RichText.d.ts | 2 +- .../taro-components/types/ScrollView.d.ts | 16 ++ .../taro-components/types/ShareElement.d.ts | 2 +- packages/taro-components/types/Swiper.d.ts | 36 ++- packages/taro-components/types/Text.d.ts | 2 +- packages/taro-components/types/Textarea.d.ts | 10 +- .../gesture/DoubleTapGestureHandler.d.ts | 53 ++++ .../gesture/ForcePressGestureHandler.d.ts | 49 ++++ .../gesture/HorizontalDragGestureHandler.d.ts | 53 ++++ .../gesture/LongPressGestureHandler.d.ts | 53 ++++ .../types/gesture/PanGestureHandler.d.ts | 53 ++++ .../types/gesture/ScaleGestureHandler.d.ts | 53 ++++ .../types/gesture/TapGestureHandler.d.ts | 53 ++++ .../gesture/VerticalDragGestureHandler.d.ts | 53 ++++ packages/taro-components/types/index.d.ts | 10 +- packages/taro-h5/src/api/taro.ts | 3 +- .../taro-h5/src/api/ui/animation/worklet.ts | 30 +++ packages/taro-h5/src/api/ui/index.ts | 1 + packages/taro-loader/package.json | 3 +- packages/taro-loader/src/independentPage.ts | 7 +- packages/taro-loader/src/native-component.ts | 7 +- packages/taro-loader/src/native-page.ts | 7 +- packages/taro-loader/src/page.ts | 14 + packages/taro-platform-alipay/src/program.ts | 2 + .../build/config/harmony-definition.json | 45 +++- .../src/components-react.ts | 8 + .../taro-platform-weapp/src/components.ts | 9 + .../src/platform-plugin-base/mini.ts | 3 +- .../src/platform-plugin-base/platform.ts | 2 + packages/taro-vite-runner/src/mini/emit.ts | 2 +- .../src/plugins/MiniPlugin.ts | 9 +- .../taro-webpack5-runner/src/utils/types.ts | 1 + packages/taro/types/api/skyline/index.d.ts | 245 ++++++++++++++++++ packages/taro/types/taro.component.d.ts | 20 ++ pnpm-lock.yaml | 3 + scripts/debug.js | 10 +- 61 files changed, 1191 insertions(+), 46 deletions(-) create mode 100644 packages/taro-components/src/components/double-tap-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/double-tap-gesture-handler/script.tsx create mode 100644 packages/taro-components/src/components/force-press-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/force-press-gesture-handler/script.tsx create mode 100644 packages/taro-components/src/components/horizontal-drag-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/horizontal-drag-gesture-handler/script.tsx create mode 100644 packages/taro-components/src/components/long-press-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/long-press-gesture-handler/script.tsx create mode 100644 packages/taro-components/src/components/pan-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/pan-gesture-handler/script.tsx create mode 100644 packages/taro-components/src/components/scale-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/scale-gesture-handler/script.tsx create mode 100644 packages/taro-components/src/components/script/readme.md create mode 100644 packages/taro-components/src/components/script/script.tsx create mode 100644 packages/taro-components/src/components/tap-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/tap-gesture-handler/script.tsx create mode 100644 packages/taro-components/src/components/vertical-drag-gesture-handler/readme.md create mode 100644 packages/taro-components/src/components/vertical-drag-gesture-handler/script.tsx create mode 100644 packages/taro-components/types/gesture/DoubleTapGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/ForcePressGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/HorizontalDragGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/LongPressGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/PanGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/ScaleGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/TapGestureHandler.d.ts create mode 100644 packages/taro-components/types/gesture/VerticalDragGestureHandler.d.ts create mode 100644 packages/taro-h5/src/api/ui/animation/worklet.ts 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/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/Image.d.ts b/packages/taro-components/types/Image.d.ts index ca7a8f472e08..f0cc0fafe5c2 100644 --- a/packages/taro-components/types/Image.d.ts +++ b/packages/taro-components/types/Image.d.ts @@ -62,7 +62,7 @@ interface ImageProps extends StandardProps { */ ariaLabel?: string /** 是否渐显 - * @supported weapp-skyline + * @supported weapp * @default false */ fadeIn?: boolean diff --git a/packages/taro-components/types/Input.d.ts b/packages/taro-components/types/Input.d.ts index 5b602ff8f76f..a61e5943546c 100644 --- a/packages/taro-components/types/Input.d.ts +++ b/packages/taro-components/types/Input.d.ts @@ -199,21 +199,25 @@ interface InputProps extends StandardProps, FormItemProps { */ onNickNameReview?: CommonEventFunction /** 选区改变事件, {selectionStart, selectionEnd} - * @supported weapp-skyline + * @supported weapp */ onSelectionChange?: CommonEventFunction /** 输入法开始新的输入时触发 (仅当输入法支持时触发) - * @supported weapp-skyline + * @supported weapp */ onKeyboardCompositionStart?: CommonEventFunction /** 输入法输入字符时触发(仅当输入法支持时触发) - * @supported weapp-skyline + * @supported weapp */ onKeyboardCompositionUpdate?: CommonEventFunction /** 输入法输入结束时触发(仅当输入法支持时触发) - * @supported weapp-skyline + * @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 1daf3b4d46c8..454fb0bb27a5 100644 --- a/packages/taro-components/types/RichText.d.ts +++ b/packages/taro-components/types/RichText.d.ts @@ -53,7 +53,7 @@ interface RichTextProps extends StandardProps { */ onLongtap?: CommonEventFunction /** 布局兼容模式 - * @supported weapp-skyline + * @supported weapp * @default default */ mode?: 'default' | 'compat' | 'aggressive' | 'inline-block' | 'web' diff --git a/packages/taro-components/types/ScrollView.d.ts b/packages/taro-components/types/ScrollView.d.ts index e0053b5d3dd9..9cdb3871b9ff 100644 --- a/packages/taro-components/types/ScrollView.d.ts +++ b/packages/taro-components/types/ScrollView.d.ts @@ -297,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 e981f6c68984..4b00ba995ea2 100644 --- a/packages/taro-components/types/ShareElement.d.ts +++ b/packages/taro-components/types/ShareElement.d.ts @@ -63,7 +63,7 @@ interface ShareElementProps extends StandardProps { /** 动画帧回调 * @supported weapp */ - onFrame?: string + onFrameWorklet?: string } /** 共享元素 * diff --git a/packages/taro-components/types/Swiper.d.ts b/packages/taro-components/types/Swiper.d.ts index e63e81570d10..a9eed8ba9c66 100644 --- a/packages/taro-components/types/Swiper.d.ts +++ b/packages/taro-components/types/Swiper.d.ts @@ -162,65 +162,77 @@ interface SwiperProps extends StandardProps { */ onAnimationEnd?: CommonEventFunction /** 渲染模式 - * @supported weapp-skyline + * @supported weapp * @default normal */ layoutType?: 'normal' | 'stackLeft' | 'stackRight' | 'tinder' | 'transformer' /** layout-type 为 transformer 时指定动画类型 - * @supported weapp-skyline + * @supported weapp * @default scaleAndFade */ transformerType?: 'scaleAndFade' | 'accordion' | 'threeD' | 'zoomIn' | 'zoomOut' | 'deepthPage' /** 指示点动画类型 - * @supported weapp-skyline + * @supported weapp * @default normal */ indicatorType?: 'normal' | 'worm' | 'wormThin' | 'wormUnderground' | 'wormThinUnderground' | 'expand' | 'jump' | 'jumpWithOffset' | 'scroll' | 'scrollFixedCenter' | 'slide' | 'slideUnderground' | 'scale' | 'swap' | 'swapYRotation' | 'color' /** 指示点四周边距 - * @supported weapp-skyline + * @supported weapp * @default 10 */ indicatorMargin?: number /** 指示点间距 - * @supported weapp-skyline + * @supported weapp * @default 4 */ indicatorSpacing?: number /** 指示点圆角大小 - * @supported weapp-skyline + * @supported weapp * @default 4 */ indicatorRadius?: number /** 指示点宽度 - * @supported weapp-skyline + * @supported weapp * @default 8 */ indicatorWidth?: number /** 指示点高度 - * @supported weapp-skyline + * @supported weapp * @default 8 */ indicatorHeight?: number /** 指示点的相对位置 - * @supported weapp-skyline + * @supported weapp * @default auto */ indicatorAlignment?: [number, number] | string /** 指示点位置的偏移量 - * @supported weapp-skyline + * @supported weapp * @default [0, 0] */ indicatorOffset?: [number, number] /** 改变 current 时使用动画过渡 - * @supported weapp-skyline + * @supported weapp * @default true */ scrollWithAnimation?: boolean /** 缓存区域大小,值为 1 表示提前渲染上下各一屏区域(swiper 容器大小) - * @supported weapp-skyline + * @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 6638539e8903..a70e745b580e 100644 --- a/packages/taro-components/types/Textarea.d.ts +++ b/packages/taro-components/types/Textarea.d.ts @@ -156,23 +156,23 @@ interface TextareaProps extends StandardProps, FormItemProps { onKeyboardHeightChange?: CommonEventFunction /** 需传入对象,格式为 { fontSize: number, fontWeight: string, color: string } - * @supported weapp-skyline + * @supported weapp */ placeholderStyle?: string /** 选区改变事件, {selectionStart, selectionEnd} - * @supported weapp-skyline + * @supported weapp */ onSelectionChange?: CommonEventFunction /** 输入法开始新的输入时触发 (仅当输入法支持时触发) - * @supported weapp-skyline + * @supported weapp */ onKeyboardCompositionStart?: CommonEventFunction /** 输入法输入字符时触发(仅当输入法支持时触发) - * @supported weapp-skyline + * @supported weapp */ onKeyboardCompositionUpdate?: CommonEventFunction /** 输入法输入结束时触发(仅当输入法支持时触发) - * @supported weapp-skyline + * @supported weapp */ onKeyboardCompositionEnd?: CommonEventFunction } 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-h5/src/api/taro.ts b/packages/taro-h5/src/api/taro.ts index 556193984335..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, router, switchTab } from '../api' +import { getApp, getCurrentInstance, getCurrentPages, navigateBack, navigateTo, nextTick, redirectTo, reLaunch, router, switchTab, worklet } from '../api' import { permanentlyNotSupport } from '../utils' const { @@ -44,6 +44,7 @@ const taro: ModifiedTaro = { getCurrentPages, 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-loader/package.json b/packages/taro-loader/package.json index d4bef62564c9..183713259931 100644 --- a/packages/taro-loader/package.json +++ b/packages/taro-loader/package.json @@ -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/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-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-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 7ec885196cc9..5599f3ca685e 100644 --- a/packages/taro-platform-weapp/src/components.ts +++ b/packages/taro-platform-weapp/src/components.ts @@ -505,4 +505,13 @@ export const components = { }, NestedScrollHeader: {}, NestedScrollBody: {}, + // skyline手势组件 + DoubleTapGestureHandler: {}, + ForcePressGestureHandler: {}, + HorizontalDragGestureHandler: {}, + LongPressGestureHandler: {}, + PanGestureHandler: {}, + ScaleGestureHandler: {}, + TapGestureHandler: {}, + VerticalDragGestureHandler: {}, } 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-vite-runner/src/mini/emit.ts b/packages/taro-vite-runner/src/mini/emit.ts index 2a7ca8406cb3..8c234cfa38a1 100644 --- a/packages/taro-vite-runner/src/mini/emit.ts +++ b/packages/taro-vite-runner/src/mini/emit.ts @@ -120,7 +120,7 @@ export default function (viteCompilerContext: ViteMiniCompilerContext): PluginOp usingComponents: { [baseCompName]: `./${baseCompName}` } - } + } as Config & { component?: boolean, usingComponents: Record } if (isUsingCustomWrapper) { baseCompConfig.usingComponents[customWrapperName] = `./${customWrapperName}` } diff --git a/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts b/packages/taro-webpack5-runner/src/plugins/MiniPlugin.ts index 361a46e157e5..4de8e66f75fe 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, } }) } @@ -1226,7 +1231,7 @@ export default class TaroMiniPlugin { usingComponents: { [baseCompName]: `./${baseCompName}` } - } + } as Config & { component?: boolean, usingComponents: Record } if (isUsingCustomWrapper) { baseCompConfig.usingComponents[customWrapperName] = `./${customWrapperName}` 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/types/api/skyline/index.d.ts b/packages/taro/types/api/skyline/index.d.ts index cf8d4fed0c98..447c50a2d26e 100644 --- a/packages/taro/types/api/skyline/index.d.ts +++ b/packages/taro/types/api/skyline/index.d.ts @@ -97,4 +97,249 @@ declare module '../../index' { } } } + + /** + * 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/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/pnpm-lock.yaml b/pnpm-lock.yaml index ed2421b3a10c..aa37f35f496e 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', From e7059d3b283eb57d2aa5c0834ac0047d0625862d Mon Sep 17 00:00:00 2001 From: yushijie1 Date: Tue, 19 Nov 2024 20:10:31 +0800 Subject: [PATCH 06/13] =?UTF-8?q?test(skyline):=20=E6=9B=B4=E6=96=B0snapsh?= =?UTF-8?q?ots?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__snapshots__/babel.spec.ts.snap | 87 +++- .../compiler-macros.spec.ts.snap | 87 +++- .../__snapshots__/config.spec.ts.snap | 435 +++++++++++++----- .../__snapshots__/css-modules.spec.ts.snap | 174 +++++-- .../__snapshots__/framework.spec.ts.snap | 266 +++++++---- .../__snapshots__/mini-platform.spec.ts.snap | 30 +- .../__snapshots__/parse-html.spec.ts.snap | 87 +++- .../__snapshots__/prerender.spec.ts.snap | 315 +++++++++---- .../__tests__/__snapshots__/sass.spec.ts.snap | 435 +++++++++++++----- .../__snapshots__/skyline.spec.ts.snap | 133 ++++-- .../__snapshots__/subpackages.spec.ts.snap | 103 +++-- .../__snapshots__/tabbar.spec.ts.snap | 218 ++++++--- tests/__tests__/__snapshots__/ts.spec.ts.snap | 87 +++- .../__snapshots__/wx-hybrid.spec.ts.snap | 87 +++- 14 files changed, 1835 insertions(+), 709 deletions(-) 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"); -