@tarojs/components 3.6.2 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/taro-components.cjs.js +1 -1
- package/dist/cjs/taro-grid-view-core.cjs.entry.js +21 -0
- package/dist/cjs/taro-input-core.cjs.entry.js +1 -1
- package/dist/cjs/taro-list-view-core.cjs.entry.js +21 -0
- package/dist/cjs/taro-picker-core_2.cjs.entry.js +1 -1
- package/dist/cjs/taro-sticky-header-core.cjs.entry.js +21 -0
- package/dist/cjs/taro-sticky-section-core.cjs.entry.js +21 -0
- package/dist/cjs/taro-swiper-core_2.cjs.entry.js +28 -18
- package/dist/cjs/taro-textarea-core.cjs.entry.js +13 -3
- package/dist/cjs/taro-video-control_3.cjs.entry.js +3 -1
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/grid-view/grid-view.js +11 -0
- package/dist/collection/components/input/input.js +1 -1
- package/dist/collection/components/list-view/list-view.js +11 -0
- package/dist/collection/components/picker/picker.js +1 -1
- package/dist/collection/components/sticky-header/sticky-header.js +11 -0
- package/dist/collection/components/sticky-section/sticky-section.js +11 -0
- package/dist/collection/components/swiper/swiper-item.js +16 -9
- package/dist/collection/components/swiper/swiper.js +12 -9
- package/dist/collection/components/textarea/textarea.js +23 -6
- package/dist/collection/components/video/video.js +3 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/taro-grid-view-core.d.ts +11 -0
- package/dist/components/taro-grid-view-core.js +33 -0
- package/dist/components/taro-input-core.js +1 -1
- package/dist/components/taro-list-view-core.d.ts +11 -0
- package/dist/components/taro-list-view-core.js +33 -0
- package/dist/components/taro-picker-core.js +1 -1
- package/dist/components/taro-sticky-header-core.d.ts +11 -0
- package/dist/components/taro-sticky-header-core.js +33 -0
- package/dist/components/taro-sticky-section-core.d.ts +11 -0
- package/dist/components/taro-sticky-section-core.js +33 -0
- package/dist/components/taro-swiper-core.js +12 -9
- package/dist/components/taro-swiper-item-core.js +16 -9
- package/dist/components/taro-textarea-core.js +14 -4
- package/dist/components/taro-video-core.js +3 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/taro-components.js +1 -1
- package/dist/esm/taro-grid-view-core.entry.js +17 -0
- package/dist/esm/taro-input-core.entry.js +1 -1
- package/dist/esm/taro-list-view-core.entry.js +17 -0
- package/dist/esm/taro-picker-core_2.entry.js +1 -1
- package/dist/esm/taro-sticky-header-core.entry.js +17 -0
- package/dist/esm/taro-sticky-section-core.entry.js +17 -0
- package/dist/esm/taro-swiper-core_2.entry.js +28 -18
- package/dist/esm/taro-textarea-core.entry.js +13 -3
- package/dist/esm/taro-video-control_3.entry.js +3 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/taro-components.js +1 -1
- package/dist/esm-es5/taro-grid-view-core.entry.js +1 -0
- package/dist/esm-es5/taro-input-core.entry.js +1 -1
- package/dist/esm-es5/taro-list-view-core.entry.js +1 -0
- package/dist/esm-es5/taro-picker-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-sticky-header-core.entry.js +1 -0
- package/dist/esm-es5/taro-sticky-section-core.entry.js +1 -0
- package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
- package/dist/esm-es5/taro-textarea-core.entry.js +1 -1
- package/dist/taro-components/p-02aa7366.system.entry.js +1 -0
- package/dist/taro-components/p-05c757b7.entry.js +1 -0
- package/dist/taro-components/{p-4d390d17.entry.js → p-0b8b3af5.entry.js} +1 -1
- package/dist/taro-components/p-1c446c65.system.js +1 -1
- package/dist/taro-components/p-1eac7c75.system.entry.js +1 -0
- package/dist/taro-components/{p-3e23fa46.system.entry.js → p-39685396.system.entry.js} +1 -1
- package/dist/taro-components/p-4402972b.system.entry.js +1 -0
- package/dist/taro-components/{p-e53feb03.system.entry.js → p-58f9a827.system.entry.js} +1 -1
- package/dist/taro-components/p-5931c82e.entry.js +1 -0
- package/dist/taro-components/{p-ab84c88e.entry.js → p-7704e165.entry.js} +1 -1
- package/dist/taro-components/p-7c1fc8f5.system.entry.js +1 -0
- package/dist/taro-components/p-7df9de66.system.entry.js +1 -0
- package/dist/taro-components/{p-10046f1a.system.entry.js → p-a5afdc47.system.entry.js} +1 -1
- package/dist/taro-components/p-affb28de.entry.js +1 -0
- package/dist/taro-components/{p-8267b686.entry.js → p-c30d1b2d.entry.js} +1 -1
- package/dist/taro-components/p-dfc405a5.entry.js +1 -0
- package/dist/taro-components/p-e753b776.entry.js +1 -0
- package/dist/taro-components/taro-components.esm.js +1 -1
- package/dist/types/components/grid-view/grid-view.d.ts +5 -0
- package/dist/types/components/list-view/list-view.d.ts +5 -0
- package/dist/types/components/sticky-header/sticky-header.d.ts +5 -0
- package/dist/types/components/sticky-section/sticky-section.d.ts +5 -0
- package/dist/types/components/textarea/textarea.d.ts +2 -1
- package/dist/types/components.d.ts +52 -0
- package/lib/react/components.d.ts +81 -77
- package/lib/react/components.js +82 -77
- package/lib/react/components.js.map +1 -1
- package/lib/react/index.js +1 -1
- package/lib/react/{interfaces-4f837811.d.ts → interfaces-f526f1a2.d.ts} +4 -0
- package/lib/react/node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js +221 -0
- package/lib/react/node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js.map +1 -0
- package/lib/react/react-component-lib/createComponent.d.ts +5 -1
- package/lib/react/react-component-lib/createComponent.js +6 -4
- package/lib/react/react-component-lib/createComponent.js.map +1 -1
- package/lib/react/react-component-lib/createOverlayComponent.d.ts +5 -1
- package/lib/react/react-component-lib/createOverlayComponent.js +2 -1
- package/lib/react/react-component-lib/createOverlayComponent.js.map +1 -1
- package/lib/react/react-component-lib/utils/attachProps.d.ts +2 -6
- package/lib/react/react-component-lib/utils/attachProps.js +41 -36
- package/lib/react/react-component-lib/utils/attachProps.js.map +1 -1
- package/lib/react/react-component-lib/utils/case.d.ts +4 -0
- package/lib/react/react-component-lib/utils/case.js +4 -0
- package/lib/react/react-component-lib/utils/case.js.map +1 -1
- package/lib/react/react-component-lib/utils/index.d.ts +5 -1
- package/lib/react/react-component-lib/utils/index.js +4 -0
- package/lib/react/react-component-lib/utils/index.js.map +1 -1
- package/lib/vue2/components-loader.d.ts +2 -0
- package/lib/vue2/components-loader.js +21 -0
- package/lib/vue2/components-loader.js.map +1 -0
- package/lib/vue2/components.d.ts +5 -1
- package/lib/vue2/components.js +141 -224
- package/lib/vue2/components.js.map +1 -1
- package/lib/vue2/index.d.ts +0 -2
- package/lib/vue2/index.js +1 -22
- package/lib/vue2/index.js.map +1 -1
- package/lib/vue2/vue-component-lib/utils.d.ts +7 -3
- package/lib/vue2/vue-component-lib/utils.js +42 -25
- package/lib/vue2/vue-component-lib/utils.js.map +1 -1
- package/lib/vue3/components-loader.d.ts +2 -0
- package/lib/vue3/components-loader.js +13 -0
- package/lib/vue3/components-loader.js.map +1 -0
- package/lib/vue3/components.d.ts +5 -1
- package/lib/vue3/components.js +82 -77
- package/lib/vue3/components.js.map +1 -1
- package/lib/vue3/index.d.ts +0 -2
- package/lib/vue3/index.js +1 -14
- package/lib/vue3/index.js.map +1 -1
- package/lib/vue3/vue-component-lib/utils.js +11 -4
- package/lib/vue3/vue-component-lib/utils.js.map +1 -1
- package/package.json +11 -8
- package/types/Ad.d.ts +2 -31
- package/types/AdCustom.d.ts +0 -4
- package/types/AnimationVideo.d.ts +0 -9
- package/types/AnimationView.d.ts +0 -6
- package/types/ArCamera.d.ts +0 -7
- package/types/Audio.d.ts +0 -18
- package/types/AwemeData.d.ts +0 -6
- package/types/Button.d.ts +3 -106
- package/types/Camera.d.ts +0 -28
- package/types/Canvas.d.ts +2 -17
- package/types/ChannelLive.d.ts +0 -2
- package/types/ChannelVideo.d.ts +0 -6
- package/types/Checkbox.d.ts +1 -8
- package/types/CheckboxGroup.d.ts +0 -2
- package/types/CommentDetail.d.ts +4 -10
- package/types/CommentList.d.ts +4 -20
- package/types/ContactButton.d.ts +0 -7
- package/types/CoverImage.d.ts +0 -11
- package/types/CoverView.d.ts +0 -26
- package/types/Editor.d.ts +0 -10
- package/types/FollowSwan.d.ts +0 -3
- package/types/Form.d.ts +1 -9
- package/types/FunctionalPageNavigator.d.ts +0 -11
- package/types/GridView.d.ts +37 -0
- package/types/Icon.d.ts +0 -14
- package/types/Image.d.ts +0 -31
- package/types/InlinePaymentPanel.d.ts +0 -9
- package/types/Input.d.ts +0 -62
- package/types/Label.d.ts +3 -2
- package/types/Lifestyle.d.ts +0 -3
- package/types/Like.d.ts +0 -17
- package/types/ListView.d.ts +12 -0
- package/types/LivePlayer.d.ts +1 -58
- package/types/LivePusher.d.ts +0 -77
- package/types/Login.d.ts +0 -5
- package/types/Lottie.d.ts +0 -16
- package/types/Map.d.ts +19 -136
- package/types/MatchMedia.d.ts +0 -7
- package/types/MovableArea.d.ts +0 -1
- package/types/MovableView.d.ts +0 -35
- package/types/NavigationBar.d.ts +0 -6
- package/types/Navigator.d.ts +0 -27
- package/types/OfficialAccount.d.ts +0 -12
- package/types/OpenData.d.ts +0 -20
- package/types/PageContainer.d.ts +0 -21
- package/types/PageMeta.d.ts +0 -16
- package/types/Picker.d.ts +17 -45
- package/types/PickerView.d.ts +1 -12
- package/types/Progress.d.ts +0 -13
- package/types/Radio.d.ts +1 -8
- package/types/RadioGroup.d.ts +0 -2
- package/types/RichText.d.ts +1 -22
- package/types/RootPortal.d.ts +1 -2
- package/types/RtcRoom.d.ts +0 -16
- package/types/RtcRoomItem.d.ts +0 -3
- package/types/ScrollView.d.ts +43 -46
- package/types/ShareElement.d.ts +2 -7
- package/types/Slider.d.ts +0 -19
- package/types/StickyHeader.d.ts +12 -0
- package/types/StickySection.d.ts +18 -0
- package/types/Swiper.d.ts +0 -44
- package/types/SwiperItem.d.ts +0 -2
- package/types/Switch.d.ts +2 -11
- package/types/TabItem.d.ts +0 -4
- package/types/Tabs.d.ts +0 -8
- package/types/Text.d.ts +0 -7
- package/types/Textarea.d.ts +2 -38
- package/types/Video.d.ts +1 -112
- package/types/View.d.ts +0 -25
- package/types/VoipRoom.d.ts +0 -6
- package/types/WebView.d.ts +0 -6
- package/types/index.d.ts +4 -0
- package/types/index.vue3.d.ts +8 -0
- package/dist/taro-components/p-0895120a.system.entry.js +0 -1
- package/dist/taro-components/p-0aaf66d2.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../taro-components-library-vue3/src/vue-component-lib/utils.ts"],"sourcesContent":["import { VNode, defineComponent, getCurrentInstance, h, inject, ref, Ref } from 'vue';\n\nexport interface InputProps<T> {\n modelValue?: T;\n}\n\nconst UPDATE_VALUE_EVENT = 'update:modelValue';\nconst MODEL_VALUE = 'modelValue';\nconst ROUTER_LINK_VALUE = 'routerLink';\nconst NAV_MANAGER = 'navManager';\nconst ROUTER_PROP_PREFIX = 'router';\nconst ARIA_PROP_PREFIX = 'aria';\n/**\n * Starting in Vue 3.1.0, all properties are\n * added as keys to the props object, even if\n * they are not being used. In order to correctly\n * account for both value props and v-model props,\n * we need to check if the key exists for Vue <3.1.0\n * and then check if it is not undefined for Vue >= 3.1.0.\n * See https://github.com/vuejs/vue-next/issues/3889\n */\nconst EMPTY_PROP = Symbol();\nconst DEFAULT_EMPTY_PROP = { default: EMPTY_PROP };\n\ninterface NavManager<T = any> {\n navigate: (options: T) => void;\n}\n\nconst getComponentClasses = (classes: unknown) => {\n return (classes as string)?.split(' ') || [];\n};\n\nconst getElementClasses = (\n ref: Ref<HTMLElement | undefined>,\n componentClasses: Set<string>,\n defaultClasses: string[] = []\n) => {\n return [...Array.from(ref.value?.classList || []), ...defaultClasses].filter(\n (c: string, i, self) => !componentClasses.has(c) && self.indexOf(c) === i\n );\n};\n\n/**\n * Create a callback to define a Vue component wrapper around a Web Component.\n *\n * @prop name - The component tag name (i.e. `ion-button`)\n * @prop componentProps - An array of properties on the\n * component. These usually match up with the @Prop definitions\n * in each component's TSX file.\n * @prop customElement - An option custom element instance to pass\n * to customElements.define. Only set if `includeImportCustomElements: true` in your config.\n * @prop modelProp - The prop that v-model binds to (i.e. value)\n * @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)\n * @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been\n * correctly updated when a user's event callback fires.\n */\nexport const defineContainer = <Props, VModelType = string | number | boolean>(\n name: string,\n defineCustomElement: any,\n componentProps: string[] = [],\n modelProp?: string,\n modelUpdateEvent?: string,\n externalModelUpdateEvent?: string\n) => {\n /**\n * Create a Vue component wrapper around a Web Component.\n * Note: The `props` here are not all properties on a component.\n * They refer to whatever properties are set on an instance of a component.\n */\n\n if (defineCustomElement !== undefined) {\n defineCustomElement();\n }\n\n const Container = defineComponent<Props & InputProps<VModelType>>((props: any, { attrs, slots, emit }) => {\n let modelPropValue = props[modelProp];\n const containerRef = ref<HTMLElement>();\n const classes = new Set(getComponentClasses(attrs.class));\n const onVnodeBeforeMount = (vnode: VNode) => {\n // Add a listener to tell Vue to update the v-model\n if (vnode.el) {\n const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];\n eventsNames.forEach((eventName: string) => {\n vnode.el!.addEventListener(eventName.toLowerCase(), (e: Event) => {\n modelPropValue = (e?.target as any)[modelProp];\n emit(UPDATE_VALUE_EVENT, modelPropValue);\n\n /**\n * We need to emit the change event here\n * rather than on the web component to ensure\n * that any v-model bindings have been updated.\n * Otherwise, the developer will listen on the\n * native web component, but the v-model will\n * not have been updated yet.\n */\n if (externalModelUpdateEvent) {\n emit(externalModelUpdateEvent, e);\n }\n });\n });\n }\n };\n\n const currentInstance = getCurrentInstance();\n const hasRouter = currentInstance?.appContext?.provides[NAV_MANAGER];\n const navManager: NavManager | undefined = hasRouter ? inject(NAV_MANAGER) : undefined;\n const handleRouterLink = (ev: Event) => {\n const { routerLink } = props;\n if (routerLink === EMPTY_PROP) return;\n\n if (navManager !== undefined) {\n let navigationPayload: any = { event: ev };\n for (const key in props) {\n const value = props[key];\n if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {\n navigationPayload[key] = value;\n }\n }\n\n navManager.navigate(navigationPayload);\n } else {\n console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.');\n }\n };\n\n return () => {\n modelPropValue = props[modelProp];\n\n getComponentClasses(attrs.class).forEach((value) => {\n classes.add(value);\n });\n\n const oldClick = props.onClick;\n const handleClick = (ev: Event) => {\n if (oldClick !== undefined) {\n oldClick(ev);\n }\n if (!ev.defaultPrevented) {\n handleRouterLink(ev);\n }\n };\n\n let propsToAdd: any = {\n ref: containerRef,\n class: getElementClasses(containerRef, classes),\n onClick: (ev: Event) => { handleClick(ev), emit('tap', ev) },\n onVnodeBeforeMount: modelUpdateEvent ? onVnodeBeforeMount : undefined,\n };\n\n /**\n * We can use Object.entries here\n * to avoid the hasOwnProperty check,\n * but that would require 2 iterations\n * where as this only requires 1.\n */\n for (const key in props) {\n const value = props[key];\n if ((props.hasOwnProperty(key) && value !== EMPTY_PROP) || key.startsWith(ARIA_PROP_PREFIX)) {\n propsToAdd[key] = value;\n }\n }\n\n if (modelProp) {\n /**\n * If form value property was set using v-model\n * then we should use that value.\n * Otherwise, check to see if form value property\n * was set as a static value (i.e. no v-model).\n */\n if (props[MODEL_VALUE] !== EMPTY_PROP) {\n propsToAdd = {\n ...propsToAdd,\n [modelProp]: props[MODEL_VALUE],\n };\n } else if (modelPropValue !== EMPTY_PROP) {\n propsToAdd = {\n ...propsToAdd,\n [modelProp]: modelPropValue,\n };\n }\n }\n\n return h(name, propsToAdd, slots.default && slots.default());\n };\n });\n\n Container.displayName = name;\n\n Container.props = {\n [ROUTER_LINK_VALUE]: DEFAULT_EMPTY_PROP,\n };\n\n componentProps.forEach((componentProp) => {\n Container.props[componentProp] = DEFAULT_EMPTY_PROP;\n });\n\n if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oBAAA,UAAU,GACL,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,UAAU,CACb,EAAA,EAAA,CAAC,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,EAAA,CAChC,CAAC;AACH,iBAAA;qBAAM,IAAI,cAAc,KAAK,UAAU,EAAE;oBACxC,UAAU,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACL,UAAU,CACb,EAAA,EAAA,CAAC,SAAS,GAAG,cAAc,EAAA,CAC5B,CAAC;AACH,iBAAA;AACF,aAAA;AAED,YAAA,OAAO,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AAC/D,SAAC,CAAC;AACJ,KAAC,CAAC,CAAC;AAEH,IAAA,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;IAE7B,SAAS,CAAC,KAAK,GAAG;QAChB,CAAC,iBAAiB,GAAG,kBAAkB;KACxC,CAAC;AAEF,IAAA,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,KAAI;AACvC,QAAA,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,kBAAkB,CAAC;AACtD,KAAC,CAAC,CAAC;AAEH,IAAA,IAAI,SAAS,EAAE;AACb,QAAA,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,kBAAkB,CAAC;QAClD,SAAS,CAAC,KAAK,GAAG,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAC;AAClE,KAAA;AAED,IAAA,OAAO,SAAS,CAAC;AACnB;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../taro-components-library-vue3/src/vue-component-lib/utils.ts"],"sourcesContent":["/**\n * Modify from https://github.com/ionic-team/stencil-ds-output-targets/blob/main/packages/vue-output-target/vue-component-lib/utils.ts\n * MIT License https://github.com/ionic-team/stencil-ds-output-targets/blob/main/LICENSE\n */\nimport { defineComponent, getCurrentInstance, h, inject, Ref,ref, VNode } from 'vue'\n\nexport interface InputProps<T> {\n modelValue?: T\n}\n\nconst UPDATE_VALUE_EVENT = 'update:modelValue'\nconst MODEL_VALUE = 'modelValue'\nconst ROUTER_LINK_VALUE = 'routerLink'\nconst NAV_MANAGER = 'navManager'\nconst ROUTER_PROP_PREFIX = 'router'\nconst ARIA_PROP_PREFIX = 'aria'\n/**\n * Starting in Vue 3.1.0, all properties are\n * added as keys to the props object, even if\n * they are not being used. In order to correctly\n * account for both value props and v-model props,\n * we need to check if the key exists for Vue <3.1.0\n * and then check if it is not undefined for Vue >= 3.1.0.\n * See https://github.com/vuejs/vue-next/issues/3889\n */\nconst EMPTY_PROP = Symbol('EMPTY_PROP')\nconst DEFAULT_EMPTY_PROP = { default: EMPTY_PROP }\n\ninterface NavManager<T = any> {\n navigate: (options: T) => void\n}\n\nconst getComponentClasses = (classes: unknown) => {\n return (classes as string)?.split(' ') || []\n}\n\nconst getElementClasses = (\n ref: Ref<HTMLElement | undefined>,\n componentClasses: Set<string>,\n defaultClasses: string[] = []\n) => {\n return [...Array.from(ref.value?.classList || []), ...defaultClasses].filter(\n (c: string, i, self) => !componentClasses.has(c) && self.indexOf(c) === i\n )\n}\n\n/**\n * Create a callback to define a Vue component wrapper around a Web Component.\n *\n * @prop name - The component tag name (i.e. `ion-button`)\n * @prop componentProps - An array of properties on the\n * component. These usually match up with the @Prop definitions\n * in each component's TSX file.\n * @prop customElement - An option custom element instance to pass\n * to customElements.define. Only set if `includeImportCustomElements: true` in your config.\n * @prop modelProp - The prop that v-model binds to (i.e. value)\n * @prop modelUpdateEvent - The event that is fired from your Web Component when the value changes (i.e. ionChange)\n * @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been\n * correctly updated when a user's event callback fires.\n */\nexport const defineContainer = <Props, VModelType = string | number | boolean>(\n name: string,\n defineCustomElement: any,\n componentProps: string[] = [],\n modelProp?: string,\n modelUpdateEvent?: string,\n externalModelUpdateEvent?: string\n) => {\n /**\n * Create a Vue component wrapper around a Web Component.\n * Note: The `props` here are not all properties on a component.\n * They refer to whatever properties are set on an instance of a component.\n */\n\n if (!DEPRECATED_ADAPTER_COMPONENT && defineCustomElement !== undefined) {\n defineCustomElement()\n }\n\n const Container = defineComponent<Props & InputProps<VModelType>>((props: any, { attrs, slots, emit }) => {\n let modelPropValue = props[modelProp]\n const containerRef = ref<HTMLElement>()\n const classes = new Set(getComponentClasses(attrs.class))\n const onVnodeBeforeMount = (vnode: VNode) => {\n // Add a listener to tell Vue to update the v-model\n if (vnode.el) {\n const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent]\n eventsNames.forEach((eventName: string) => {\n vnode.el!.addEventListener(eventName.toLowerCase(), (e: Event) => {\n modelPropValue = (e?.target as any)[modelProp]\n emit(UPDATE_VALUE_EVENT, modelPropValue)\n\n /**\n * We need to emit the change event here\n * rather than on the web component to ensure\n * that any v-model bindings have been updated.\n * Otherwise, the developer will listen on the\n * native web component, but the v-model will\n * not have been updated yet.\n */\n if (externalModelUpdateEvent) {\n emit(externalModelUpdateEvent, e)\n }\n })\n })\n }\n }\n\n const currentInstance = getCurrentInstance()\n const hasRouter = currentInstance?.appContext?.provides[NAV_MANAGER]\n const navManager: NavManager | undefined = hasRouter ? inject(NAV_MANAGER) : undefined\n const handleRouterLink = (ev: Event) => {\n const { routerLink } = props\n if (routerLink === EMPTY_PROP) return\n\n if (navManager !== undefined) {\n const navigationPayload: any = { event: ev }\n for (const key in props) {\n const value = props[key]\n if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {\n navigationPayload[key] = value\n }\n }\n\n navManager.navigate(navigationPayload)\n } else {\n console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.')\n }\n }\n\n return () => {\n modelPropValue = props[modelProp]\n\n getComponentClasses(attrs.class).forEach((value) => {\n classes.add(value)\n })\n\n const oldClick = props.onClick\n const handleClick = (ev: Event) => {\n if (oldClick !== undefined) {\n oldClick(ev)\n }\n if (!ev.defaultPrevented) {\n handleRouterLink(ev)\n }\n }\n\n let propsToAdd: any = {\n ref: containerRef,\n class: getElementClasses(containerRef, classes),\n onClick: (ev: Event) => {\n handleClick(ev)\n emit('tap', ev) // Note(taro): 为 click 事件绑定 tap 事件\n },\n onVnodeBeforeMount: modelUpdateEvent ? onVnodeBeforeMount : undefined,\n }\n\n /**\n * We can use Object.entries here\n * to avoid the hasOwnProperty check,\n * but that would require 2 iterations\n * where as this only requires 1.\n */\n for (const key in props) {\n const value = props[key]\n if ((props.hasOwnProperty(key) && value !== EMPTY_PROP) || key.startsWith(ARIA_PROP_PREFIX)) {\n propsToAdd[key] = value\n }\n }\n\n if (modelProp) {\n /**\n * If form value property was set using v-model\n * then we should use that value.\n * Otherwise, check to see if form value property\n * was set as a static value (i.e. no v-model).\n */\n if (props[MODEL_VALUE] !== EMPTY_PROP) {\n propsToAdd = {\n ...propsToAdd,\n [modelProp]: props[MODEL_VALUE],\n }\n } else if (modelPropValue !== EMPTY_PROP) {\n propsToAdd = {\n ...propsToAdd,\n [modelProp]: modelPropValue,\n }\n }\n }\n\n return h(name, propsToAdd, slots.default && slots.default())\n }\n })\n\n Container.displayName = name\n\n Container.props = {\n [ROUTER_LINK_VALUE]: DEFAULT_EMPTY_PROP,\n }\n\n componentProps.forEach((componentProp) => {\n Container.props[componentProp] = DEFAULT_EMPTY_PROP\n })\n\n if (modelProp) {\n Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP\n Container.emits = [UPDATE_VALUE_EVENT, externalModelUpdateEvent]\n }\n\n return Container\n}\n"],"names":[],"mappings":";;AAAA;;;AAGG;AAOH,MAAM,kBAAkB,GAAG,mBAAmB,CAAA;AAC9C,MAAM,WAAW,GAAG,YAAY,CAAA;AAChC,MAAM,iBAAiB,GAAG,YAAY,CAAA;AACtC,MAAM,WAAW,GAAG,YAA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,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACL,UAAU,CACb,EAAA,EAAA,CAAC,SAAS,GAAG,cAAc,EAAA,CAC5B,CAAA;AACF,iBAAA;AACF,aAAA;AAED,YAAA,OAAO,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;AAC9D,SAAC,CAAA;AACH,KAAC,CAAC,CAAA;AAEF,IAAA,SAAS,CAAC,WAAW,GAAG,IAAI,CAAA;IAE5B,SAAS,CAAC,KAAK,GAAG;QAChB,CAAC,iBAAiB,GAAG,kBAAkB;KACxC,CAAA;AAED,IAAA,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,KAAI;AACvC,QAAA,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,kBAAkB,CAAA;AACrD,KAAC,CAAC,CAAA;AAEF,IAAA,IAAI,SAAS,EAAE;AACb,QAAA,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,kBAAkB,CAAA;QACjD,SAAS,CAAC,KAAK,GAAG,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAA;AACjE,KAAA;AAED,IAAA,OAAO,SAAS,CAAA;AAClB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.4",
|
|
4
4
|
"description": "Taro 组件库",
|
|
5
5
|
"browser": "dist/index.js",
|
|
6
6
|
"main:h5": "dist/index.js",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"author": "",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stencil/core": "^2.
|
|
33
|
+
"@stencil/core": "^2.22.2",
|
|
34
34
|
"classnames": "^2.2.5",
|
|
35
35
|
"hls.js": "^1.1.5",
|
|
36
36
|
"intersection-observer": "^0.7.0",
|
|
37
37
|
"resolve-pathname": "^3.0.0",
|
|
38
38
|
"swiper": "6.8.0",
|
|
39
39
|
"weui": "^1.1.2",
|
|
40
|
-
"@tarojs/components-advanced": "3.6.
|
|
41
|
-
"@tarojs/router": "3.6.
|
|
42
|
-
"@tarojs/taro": "3.6.
|
|
40
|
+
"@tarojs/components-advanced": "3.6.4",
|
|
41
|
+
"@tarojs/router": "3.6.4",
|
|
42
|
+
"@tarojs/taro": "3.6.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@babel/generator": "^7.20.0",
|
|
@@ -53,9 +53,10 @@
|
|
|
53
53
|
"@types/node": "^14.14.31",
|
|
54
54
|
"change-case": "^4.1.2",
|
|
55
55
|
"csstype": "^3.1.1",
|
|
56
|
+
"esbuild": "^0.14.27",
|
|
56
57
|
"jquery": "^3.4.1",
|
|
57
58
|
"lodash": "^4.17.21",
|
|
58
|
-
"miniapp-types": "1.4.
|
|
59
|
+
"miniapp-types": "1.4.4",
|
|
59
60
|
"puppeteer": "^19.2.0",
|
|
60
61
|
"stencil-vue2-output-target": "0.0.4",
|
|
61
62
|
"ts-node": "^10.9.1",
|
|
@@ -73,14 +74,16 @@
|
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
"scripts": {
|
|
76
|
-
"prebuild": "
|
|
77
|
+
"prebuild": "run-p generate:*",
|
|
77
78
|
"build": "cross-env NODE_ENV=production run-s build:components build:library",
|
|
78
|
-
"build:components": "stencil build
|
|
79
|
+
"build:components": "stencil build",
|
|
79
80
|
"build:library": "pnpm --filter @tarojs/components-library-react --filter @tarojs/components-library-vue2 --filter @tarojs/components-library-vue3 run build:ci",
|
|
80
81
|
"dev:components": "cross-env NODE_ENV=development pnpm run build:components --watch",
|
|
81
82
|
"dev:library-react": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-react run dev",
|
|
82
83
|
"dev:library-vue2": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-vue2 run dev",
|
|
83
84
|
"dev:library-vue3": "cross-env NODE_ENV=development pnpm --filter @tarojs/components-library-vue3 run dev",
|
|
85
|
+
"generate:lib": "mkdir -p lib",
|
|
86
|
+
"generate:stencil-config": "esbuild ./scripts/stencil/stencil.config.ts --bundle --platform=node --outfile=stencil.config.js",
|
|
84
87
|
"test": "cross-env NODE_ENV=test stencil test --spec --e2e",
|
|
85
88
|
"test:ci": "pnpm run test --ci --no-build",
|
|
86
89
|
"test:coverage": "pnpm run test --ci --screenshot --coverage",
|
package/types/Ad.d.ts
CHANGED
|
@@ -5,112 +5,93 @@ interface AdProps extends StandardProps {
|
|
|
5
5
|
* @supported weapp, tt, qq
|
|
6
6
|
*/
|
|
7
7
|
unitId: string
|
|
8
|
-
|
|
9
8
|
/** 广告自动刷新的间隔时间,单位为秒,参数值必须大于等于30(该参数不传入时 Banner 广告不会自动刷新)
|
|
10
9
|
* @supported weapp, tt
|
|
11
10
|
*/
|
|
12
11
|
adIntervals?: number
|
|
13
|
-
|
|
14
12
|
/** 广告类型,默认为展示`banner`,可通过设置该属性为`video`展示视频广告, `grid`为格子广告
|
|
15
13
|
* @supported weapp
|
|
16
14
|
*/
|
|
17
15
|
adType?: 'banner' | 'video' | 'grid'
|
|
18
|
-
|
|
19
16
|
/** 广告主题样式设置
|
|
20
17
|
* @supported weapp
|
|
21
18
|
*/
|
|
22
19
|
adTheme?: 'white' | 'black'
|
|
23
|
-
|
|
24
20
|
/** 小程序应用 ID
|
|
25
21
|
* @supported swan
|
|
26
22
|
*/
|
|
27
23
|
appid?: string
|
|
28
|
-
|
|
29
24
|
/** 小程序广告位 ID
|
|
30
25
|
* @supported swan
|
|
31
26
|
*/
|
|
32
27
|
apid?: string
|
|
33
|
-
|
|
34
28
|
/** 广告类型:banner、feed ,需和百青藤平台上的代码位类型相匹配
|
|
35
29
|
* @supported swan, tt, qq
|
|
36
30
|
* @default feed
|
|
31
|
+
* @swan 支持 banner、feed
|
|
32
|
+
* @qq 支持 banner、card、feeds、block
|
|
37
33
|
*/
|
|
38
34
|
type?: string
|
|
39
|
-
|
|
40
35
|
/** 更改该属性,可以触发广告刷新
|
|
41
36
|
* @supported swan
|
|
42
37
|
*/
|
|
43
38
|
updatetime?: string
|
|
44
|
-
|
|
45
39
|
/** 广告是否在屏幕中固定展示
|
|
46
40
|
* @supported tt
|
|
47
41
|
*/
|
|
48
42
|
fixed?: string
|
|
49
|
-
|
|
50
43
|
/** 广告的缩放比例,100 为标准尺寸
|
|
51
44
|
* @supported tt
|
|
52
45
|
* @default 100
|
|
53
46
|
*/
|
|
54
47
|
scale?: string
|
|
55
|
-
|
|
56
48
|
/** type 为 feeds 时广告左边距(px),必须大于 0
|
|
57
49
|
* @supported qq
|
|
58
50
|
*/
|
|
59
51
|
adLeft?: string
|
|
60
|
-
|
|
61
52
|
/** type 为 feeds 时广告上边距(px),必须大于 0
|
|
62
53
|
* @supported qq
|
|
63
54
|
*/
|
|
64
55
|
adTop?: string
|
|
65
|
-
|
|
66
56
|
/** type 为 feeds 时广告宽度(px),默认 100%,最大值为屏幕宽度,最小值为 265
|
|
67
57
|
* @supported qq
|
|
68
58
|
*/
|
|
69
59
|
adWidth?: string
|
|
70
|
-
|
|
71
60
|
/** type 为 feeds 时广告高度(px),最小 85,最大 160
|
|
72
61
|
* @supported qq
|
|
73
62
|
*/
|
|
74
63
|
adHeight?: string
|
|
75
|
-
|
|
76
64
|
/** type 为 block 时请求积木广告数量(展示以实际拉取广告数量为准)
|
|
77
65
|
* @supported qq
|
|
78
66
|
* @default 1
|
|
79
67
|
*/
|
|
80
68
|
blockSize?: string
|
|
81
|
-
|
|
82
69
|
/** type 为 block 时请求积木广告排列方向
|
|
83
70
|
* @supported qq
|
|
84
71
|
* @default landscape
|
|
85
72
|
*/
|
|
86
73
|
blockOrientation?: 'vertical' | 'landscape'
|
|
87
|
-
|
|
88
74
|
/** 开发者工具下,type 为 banner 时,指定 banner 广告展示三图文还是单图
|
|
89
75
|
* @supported qq
|
|
90
76
|
* @default three
|
|
91
77
|
*/
|
|
92
78
|
testBannerType?: 'one' | 'three'
|
|
93
|
-
|
|
94
79
|
/** 广告加载成功的回调
|
|
95
80
|
* @supported weapp, swan, tt, qq
|
|
96
81
|
*/
|
|
97
82
|
onLoad?: CommonEventFunction
|
|
98
|
-
|
|
99
83
|
/** 当广告发生错误时,触发的事件,可以通过该事件获取错误码及原因,事件对象 event.detail = {errCode: 1002}
|
|
100
84
|
* @supported weapp, swan, tt, qq
|
|
101
85
|
*/
|
|
102
86
|
onError?: CommonEventFunction<AdProps.onErrorEventDetail>
|
|
103
|
-
|
|
104
87
|
/** 广告关闭的回调
|
|
105
88
|
* @supported weapp, swan, tt
|
|
106
89
|
*/
|
|
107
90
|
onClose?: CommonEventFunction
|
|
108
|
-
|
|
109
91
|
/** 贴片类型广告播放期间触发
|
|
110
92
|
* @supported swan
|
|
111
93
|
*/
|
|
112
94
|
onStatus?: CommonEventFunction
|
|
113
|
-
|
|
114
95
|
/** type 为 feeds 时广告实际宽高回调
|
|
115
96
|
* @supported qq
|
|
116
97
|
*/
|
|
@@ -120,7 +101,6 @@ declare namespace AdProps {
|
|
|
120
101
|
interface onErrorEventDetail {
|
|
121
102
|
errCode: keyof AdErrCode
|
|
122
103
|
}
|
|
123
|
-
|
|
124
104
|
/**
|
|
125
105
|
* 广告错误码
|
|
126
106
|
*
|
|
@@ -134,56 +114,48 @@ declare namespace AdProps {
|
|
|
134
114
|
* @solution 一般情况下忽略一段时间即可恢复。
|
|
135
115
|
*/
|
|
136
116
|
1000
|
|
137
|
-
|
|
138
117
|
/**
|
|
139
118
|
* @illustrate 参数错误
|
|
140
119
|
* @reason 使用方法错误
|
|
141
120
|
* @solution 可以前往 developers.weixin.qq.com 确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。
|
|
142
121
|
*/
|
|
143
122
|
1001
|
|
144
|
-
|
|
145
123
|
/**
|
|
146
124
|
* @illustrate 广告单元无效
|
|
147
125
|
* @reason 可能是拼写错误、或者误用了其他APP的广告ID
|
|
148
126
|
* @solution 请重新前往 mp.weixin.qq.com 确认广告位ID。
|
|
149
127
|
*/
|
|
150
128
|
1002
|
|
151
|
-
|
|
152
129
|
/**
|
|
153
130
|
* @illustrate 内部错误
|
|
154
131
|
* @reason 该项错误不是开发者的异常情况
|
|
155
132
|
* @solution 一般情况下忽略一段时间即可恢复。
|
|
156
133
|
*/
|
|
157
134
|
1003
|
|
158
|
-
|
|
159
135
|
/**
|
|
160
136
|
* @illustrate 无合适的广告
|
|
161
137
|
* @reason 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告
|
|
162
138
|
* @solution 属于正常情况,且开发者需要针对这种情况做形态上的兼容。
|
|
163
139
|
*/
|
|
164
140
|
1004
|
|
165
|
-
|
|
166
141
|
/**
|
|
167
142
|
* @illustrate 广告组件审核中
|
|
168
143
|
* @reason 你的广告正在被审核,无法展现广告
|
|
169
144
|
* @solution 请前往 mp.weixin.qq.com 确认审核状态,且开发者需要针对这种情况做形态上的兼容。
|
|
170
145
|
*/
|
|
171
146
|
1005
|
|
172
|
-
|
|
173
147
|
/**
|
|
174
148
|
* @illustrate 广告组件被驳回
|
|
175
149
|
* @reason 你的广告审核失败,无法展现广告
|
|
176
150
|
* @solution 请前往 mp.weixin.qq.com 确认审核状态,且开发者需要针对这种情况做形态上的兼容。
|
|
177
151
|
*/
|
|
178
152
|
1006
|
|
179
|
-
|
|
180
153
|
/**
|
|
181
154
|
* @illustrate 广告组件被封禁
|
|
182
155
|
* @reason 你的广告能力已经被封禁,封禁期间无法展现广告
|
|
183
156
|
* @solution 请前往 mp.weixin.qq.com 确认小程序广告封禁状态。
|
|
184
157
|
*/
|
|
185
158
|
1007
|
|
186
|
-
|
|
187
159
|
/**
|
|
188
160
|
* @illustrate 广告单元已关闭
|
|
189
161
|
* @reason 该广告位的广告能力已经被关闭
|
|
@@ -196,7 +168,6 @@ declare namespace AdProps {
|
|
|
196
168
|
height: number
|
|
197
169
|
}
|
|
198
170
|
}
|
|
199
|
-
|
|
200
171
|
/** Banner 广告
|
|
201
172
|
* @classification open
|
|
202
173
|
* @supported weapp, swan, tt, qq
|
package/types/AdCustom.d.ts
CHANGED
|
@@ -6,23 +6,19 @@ interface AdCustomProps extends StandardProps {
|
|
|
6
6
|
* @supported weapp
|
|
7
7
|
*/
|
|
8
8
|
unitId: string
|
|
9
|
-
|
|
10
9
|
/** 广告自动刷新的间隔时间,单位为秒,参数值必须大于等于30(该参数不传入时 Banner 广告不会自动刷新)
|
|
11
10
|
* @supported weapp
|
|
12
11
|
*/
|
|
13
12
|
adIntervals?: number
|
|
14
|
-
|
|
15
13
|
/** 广告加载成功的回调
|
|
16
14
|
* @supported weapp
|
|
17
15
|
*/
|
|
18
16
|
onLoad?: CommonEventFunction
|
|
19
|
-
|
|
20
17
|
/** 当广告发生错误时,触发的事件,可以通过该事件获取错误码及原因
|
|
21
18
|
* @supported weapp
|
|
22
19
|
*/
|
|
23
20
|
onError?: CommonEventFunction<AdProps.onErrorEventDetail>
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
/** Banner 广告
|
|
27
23
|
* @classification open
|
|
28
24
|
* @supported weapp
|
|
@@ -6,53 +6,44 @@ interface AnimationVideoProps extends StandardProps {
|
|
|
6
6
|
* @default 800
|
|
7
7
|
*/
|
|
8
8
|
resourceWidth?: number
|
|
9
|
-
|
|
10
9
|
/** 组件使用的 video 视频资源的高度(单位:px)
|
|
11
10
|
* @supported swan
|
|
12
11
|
* @default 400
|
|
13
12
|
*/
|
|
14
13
|
resourceHeight?: number
|
|
15
|
-
|
|
16
14
|
/** 用于设置动画画布的 CSS 样式
|
|
17
15
|
* @supported swan
|
|
18
16
|
* @default "width: 400px;height: 400px"
|
|
19
17
|
*/
|
|
20
18
|
canvasStyle?: string
|
|
21
|
-
|
|
22
19
|
/** 动画资源地址,支持相对路径以及远程地址。如果是远程路径,注意 response header 里需要设置 Access-Control-Allow-Origin 来防止跨域问题
|
|
23
20
|
* @supported swan
|
|
24
21
|
*/
|
|
25
22
|
path?: string
|
|
26
|
-
|
|
27
23
|
/** 动画是否循环播放
|
|
28
24
|
* @supported swan
|
|
29
25
|
* @default false
|
|
30
26
|
*/
|
|
31
27
|
loop?: boolean
|
|
32
|
-
|
|
33
28
|
/** 动画是否自动播放
|
|
34
29
|
* @supported swan
|
|
35
30
|
* @default false
|
|
36
31
|
*/
|
|
37
32
|
autoplay?: boolean
|
|
38
|
-
|
|
39
33
|
/** 视频资源中 alpha 通道的方向,left 表示 alpha 通道在资源的左边,right 表示 alpha 通道在资源的右边。详情请参考透明视频设计资源示例
|
|
40
34
|
* @supported swan
|
|
41
35
|
* @default "left"
|
|
42
36
|
*/
|
|
43
37
|
alphaDirection?: string
|
|
44
|
-
|
|
45
38
|
/** 动画开始播放的回调
|
|
46
39
|
* @supported swan
|
|
47
40
|
*/
|
|
48
41
|
onStarted?: CommonEventFunction
|
|
49
|
-
|
|
50
42
|
/** 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及暂停动画不会触发)
|
|
51
43
|
* @supported swan
|
|
52
44
|
*/
|
|
53
45
|
onEnded?: CommonEventFunction
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
/** 透明视频动画
|
|
57
48
|
* @classification media
|
|
58
49
|
* @supported swan
|
package/types/AnimationView.d.ts
CHANGED
|
@@ -5,37 +5,31 @@ interface AnimationViewProps extends StandardProps {
|
|
|
5
5
|
* @supported swan
|
|
6
6
|
*/
|
|
7
7
|
path?: string
|
|
8
|
-
|
|
9
8
|
/** 动画是否循环播放
|
|
10
9
|
* @supported swan
|
|
11
10
|
* @default false
|
|
12
11
|
*/
|
|
13
12
|
loop?: boolean
|
|
14
|
-
|
|
15
13
|
/** 动画是否自动播放
|
|
16
14
|
* @supported swan
|
|
17
15
|
* @default true
|
|
18
16
|
*/
|
|
19
17
|
autoplay?: boolean
|
|
20
|
-
|
|
21
18
|
/** 动画操作,可取值 play、pause、stop
|
|
22
19
|
* @supported swan
|
|
23
20
|
* @default "play"
|
|
24
21
|
*/
|
|
25
22
|
action?: 'play' | 'pause' | 'stop'
|
|
26
|
-
|
|
27
23
|
/** 是否隐藏动画
|
|
28
24
|
* @supported swan
|
|
29
25
|
* @default true
|
|
30
26
|
*/
|
|
31
27
|
hidden?: boolean
|
|
32
|
-
|
|
33
28
|
/** 当播放到末尾时触发 ended 事件(自然播放结束会触发回调,循环播放结束及手动停止动画不会触发)
|
|
34
29
|
* @supported swan
|
|
35
30
|
*/
|
|
36
31
|
onEnded?: CommonEventFunction
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
/** Lottie 动画
|
|
40
34
|
* @classification media
|
|
41
35
|
* @supported swan
|
package/types/ArCamera.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ interface ArCameraProps extends StandardProps {
|
|
|
5
5
|
* @supported swan
|
|
6
6
|
*/
|
|
7
7
|
key?: string
|
|
8
|
-
|
|
9
8
|
/** AR 相机类型,在 DuMixAR 内容开放平台上传生成 AR 项目后获取 AR Type:
|
|
10
9
|
* 2D 跟踪类型:0
|
|
11
10
|
* SLAM 类型:5
|
|
@@ -13,34 +12,28 @@ interface ArCameraProps extends StandardProps {
|
|
|
13
12
|
* @supported swan
|
|
14
13
|
*/
|
|
15
14
|
type?: '0' | '5' | '8'
|
|
16
|
-
|
|
17
15
|
/** 闪光灯,值为 auto、on、off
|
|
18
16
|
* @supported swan
|
|
19
17
|
* @default "off"
|
|
20
18
|
*/
|
|
21
19
|
flash?: 'auto' | 'on' | 'off'
|
|
22
|
-
|
|
23
20
|
/** 用户不允许使用摄像头或扫码失败时触发
|
|
24
21
|
* @supported swan
|
|
25
22
|
*/
|
|
26
23
|
onError?: CommonEventFunction
|
|
27
|
-
|
|
28
24
|
/** AR 加载成功时触发
|
|
29
25
|
* @supported swan
|
|
30
26
|
*/
|
|
31
27
|
onLoad?: CommonEventFunction
|
|
32
|
-
|
|
33
28
|
/** 开发者制作 AR 项目时可自定义按键,用户点击时会收到事件和数据,用户自定义事件格式参见代码示例 2:用户自定义事件
|
|
34
29
|
* @supported swan
|
|
35
30
|
*/
|
|
36
31
|
onMessage?: CommonEventFunction
|
|
37
|
-
|
|
38
32
|
/** 扫描识图结束后触发
|
|
39
33
|
* @supported swan
|
|
40
34
|
*/
|
|
41
35
|
onScanCode?: CommonEventFunction
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
/** AR 相机
|
|
45
38
|
* @classification media
|
|
46
39
|
* @supported swan
|
package/types/Audio.d.ts
CHANGED
|
@@ -5,72 +5,59 @@ interface AudioProps extends StandardProps {
|
|
|
5
5
|
* @supported weapp, swan, qq
|
|
6
6
|
*/
|
|
7
7
|
id?: string
|
|
8
|
-
|
|
9
8
|
/** 要播放音频的资源地址
|
|
10
9
|
* @supported weapp, swan, qq, h5
|
|
11
10
|
*/
|
|
12
11
|
src?: string
|
|
13
|
-
|
|
14
12
|
/** 是否循环播放
|
|
15
13
|
* @default false
|
|
16
14
|
* @supported weapp, swan, qq, h5
|
|
17
15
|
*/
|
|
18
16
|
loop?: boolean
|
|
19
|
-
|
|
20
17
|
/** 是否静音播放
|
|
21
18
|
* @default false
|
|
22
19
|
* @supported h5
|
|
23
20
|
*/
|
|
24
21
|
muted?: boolean
|
|
25
|
-
|
|
26
22
|
/** 是否显示默认控件
|
|
27
23
|
* @default false
|
|
28
24
|
* @supported weapp, swan, qq, h5
|
|
29
25
|
*/
|
|
30
26
|
controls?: boolean
|
|
31
|
-
|
|
32
27
|
/** 默认控件上的音频封面的图片资源地址,如果 controls 属性值为 false 则设置 poster 无效
|
|
33
28
|
* @supported weapp, swan, qq
|
|
34
29
|
*/
|
|
35
30
|
poster?: string
|
|
36
|
-
|
|
37
31
|
/** 默认控件上的音频名字,如果 controls 属性值为 false 则设置 name 无效
|
|
38
32
|
* @default "未知音频"
|
|
39
33
|
* @supported weapp, swan, qq
|
|
40
34
|
*/
|
|
41
35
|
name?: string
|
|
42
|
-
|
|
43
36
|
/** 默认控件上的作者名字,如果 controls 属性值为 false 则设置 author 无效
|
|
44
37
|
* @default "未知作者"
|
|
45
38
|
* @supported weapp, swan, qq
|
|
46
39
|
*/
|
|
47
40
|
author?: string
|
|
48
|
-
|
|
49
41
|
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
|
|
50
42
|
* @supported h5
|
|
51
43
|
*/
|
|
52
44
|
nativeProps?: Record<string, unknown>
|
|
53
|
-
|
|
54
45
|
/** 当发生错误时触发 error 事件,detail = {errMsg: MediaError.code}
|
|
55
46
|
* @supported weapp, swan, qq, h5
|
|
56
47
|
*/
|
|
57
48
|
onError?: CommonEventFunction<AudioProps.onErrorEventDetail>
|
|
58
|
-
|
|
59
49
|
/** 当开始/继续播放时触发play事件
|
|
60
50
|
* @supported weapp, swan, qq, h5
|
|
61
51
|
*/
|
|
62
52
|
onPlay?: CommonEventFunction
|
|
63
|
-
|
|
64
53
|
/** 当暂停播放时触发 pause 事件
|
|
65
54
|
* @supported weapp, swan, qq, h5
|
|
66
55
|
*/
|
|
67
56
|
onPause?: CommonEventFunction
|
|
68
|
-
|
|
69
57
|
/** 当播放进度改变时触发 timeupdate 事件,detail = {currentTime, duration}
|
|
70
58
|
* @supported weapp, swan, qq, h5
|
|
71
59
|
*/
|
|
72
60
|
onTimeUpdate?: CommonEventFunction<AudioProps.onTimeUpdateEventDetail>
|
|
73
|
-
|
|
74
61
|
/** 当播放到末尾时触发 ended 事件
|
|
75
62
|
* @supported weapp, swan, qq, h5
|
|
76
63
|
*/
|
|
@@ -83,7 +70,6 @@ declare namespace AudioProps {
|
|
|
83
70
|
interface onTimeUpdateEventDetail {
|
|
84
71
|
/** 当前时间 */
|
|
85
72
|
currentTime: number
|
|
86
|
-
|
|
87
73
|
/** 持续时间 */
|
|
88
74
|
duration: number
|
|
89
75
|
}
|
|
@@ -91,19 +77,15 @@ declare namespace AudioProps {
|
|
|
91
77
|
interface Code {
|
|
92
78
|
/** 获取资源被用户禁止 */
|
|
93
79
|
1
|
|
94
|
-
|
|
95
80
|
/** 网络错误 */
|
|
96
81
|
2
|
|
97
|
-
|
|
98
82
|
/** 解码错误 */
|
|
99
83
|
3
|
|
100
|
-
|
|
101
84
|
/** 不合适资源 */
|
|
102
85
|
4
|
|
103
86
|
}
|
|
104
87
|
}
|
|
105
88
|
}
|
|
106
|
-
|
|
107
89
|
/** 音频。1.6.0版本开始,该组件不再维护。建议使用能力更强的 Taro.createInnerAudioContext 接口
|
|
108
90
|
* @classification media
|
|
109
91
|
* @deprecated
|
package/types/AwemeData.d.ts
CHANGED
|
@@ -5,35 +5,29 @@ interface AwemeDataProps extends StandardProps {
|
|
|
5
5
|
* @supported tt
|
|
6
6
|
*/
|
|
7
7
|
awemeId?: string
|
|
8
|
-
|
|
9
8
|
/** 类型,可以选择头像或昵称
|
|
10
9
|
* @supported tt
|
|
11
10
|
* @default "avatar"
|
|
12
11
|
*/
|
|
13
12
|
type?: string
|
|
14
|
-
|
|
15
13
|
/** 禁用默认行为。点击头像时,如果用户处于直播状态下默认会跳转到直播间,非直播状态下跳转到个人主页。如果为 true,点击头像时不会有默认行为。
|
|
16
14
|
* @supported tt
|
|
17
15
|
* @default false
|
|
18
16
|
*/
|
|
19
17
|
disableDefault?: boolean
|
|
20
|
-
|
|
21
18
|
/** 获取信息失败时显示的默认头像 url
|
|
22
19
|
* @supported tt
|
|
23
20
|
*/
|
|
24
21
|
defaultAvatar?: string
|
|
25
|
-
|
|
26
22
|
/** 获取信息失败时显示的默认昵称文本
|
|
27
23
|
* @supported tt
|
|
28
24
|
*/
|
|
29
25
|
defaultText?: string
|
|
30
|
-
|
|
31
26
|
/** 当错误发生时触发
|
|
32
27
|
* @supported tt
|
|
33
28
|
*/
|
|
34
29
|
onError?: CommonEventFunction
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
/** 直播间状态组件
|
|
38
32
|
* @classification open
|
|
39
33
|
* @supported tt
|