@tarojs/components 3.6.0 → 3.6.1-alpha.1

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.
Files changed (149) hide show
  1. package/LICENSE +119 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/taro-components.cjs.js +1 -1
  4. package/dist/cjs/taro-input-core.cjs.entry.js +1 -1
  5. package/dist/cjs/taro-input-core.cjs.entry.js.map +1 -1
  6. package/dist/cjs/taro-navigator-core.cjs.entry.js.map +1 -1
  7. package/dist/cjs/taro-scroll-view-core.cjs.entry.js +46 -50
  8. package/dist/cjs/taro-scroll-view-core.cjs.entry.js.map +1 -1
  9. package/dist/collection/components/input/input.js +6 -2
  10. package/dist/collection/components/input/input.js.map +1 -1
  11. package/dist/collection/components/navigator/navigator.js +0 -16
  12. package/dist/collection/components/navigator/navigator.js.map +1 -1
  13. package/dist/collection/components/scroll-view/scroll-view.js +93 -51
  14. package/dist/collection/components/scroll-view/scroll-view.js.map +1 -1
  15. package/dist/components/taro-input-core.js +1 -1
  16. package/dist/components/taro-input-core.js.map +1 -1
  17. package/dist/components/taro-navigator-core.js.map +1 -1
  18. package/dist/components/taro-scroll-view-core.js +49 -51
  19. package/dist/components/taro-scroll-view-core.js.map +1 -1
  20. package/dist/esm/loader.js +1 -1
  21. package/dist/esm/taro-components.js +1 -1
  22. package/dist/esm/taro-input-core.entry.js +1 -1
  23. package/dist/esm/taro-input-core.entry.js.map +1 -1
  24. package/dist/esm/taro-navigator-core.entry.js.map +1 -1
  25. package/dist/esm/taro-scroll-view-core.entry.js +46 -50
  26. package/dist/esm/taro-scroll-view-core.entry.js.map +1 -1
  27. package/dist/esm-es5/loader.js +1 -1
  28. package/dist/esm-es5/loader.js.map +1 -1
  29. package/dist/esm-es5/taro-components.js +1 -1
  30. package/dist/esm-es5/taro-components.js.map +1 -1
  31. package/dist/esm-es5/taro-input-core.entry.js +1 -1
  32. package/dist/esm-es5/taro-input-core.entry.js.map +1 -1
  33. package/dist/esm-es5/taro-navigator-core.entry.js.map +1 -1
  34. package/dist/esm-es5/taro-scroll-view-core.entry.js +1 -1
  35. package/dist/esm-es5/taro-scroll-view-core.entry.js.map +1 -1
  36. package/dist/taro-components/p-10046f1a.system.entry.js +2 -0
  37. package/dist/taro-components/p-10046f1a.system.entry.js.map +1 -0
  38. package/dist/taro-components/p-1c446c65.system.js +1 -1
  39. package/dist/taro-components/p-1c446c65.system.js.map +1 -1
  40. package/dist/taro-components/p-9bc9f3a0.entry.js +2 -0
  41. package/dist/taro-components/p-9bc9f3a0.entry.js.map +1 -0
  42. package/dist/taro-components/p-c6385fc2.system.entry.js +2 -0
  43. package/dist/taro-components/p-c6385fc2.system.entry.js.map +1 -0
  44. package/dist/taro-components/p-d621d190.entry.js.map +1 -1
  45. package/dist/taro-components/p-de356b29.system.entry.js.map +1 -1
  46. package/dist/taro-components/{p-5208792d.entry.js → p-fe58b450.entry.js} +2 -2
  47. package/dist/taro-components/p-fe58b450.entry.js.map +1 -0
  48. package/dist/taro-components/taro-components.esm.js +1 -1
  49. package/dist/taro-components/taro-components.esm.js.map +1 -1
  50. package/dist/types/components/input/input.d.ts +1 -1
  51. package/dist/types/components/navigator/navigator.d.ts +0 -16
  52. package/dist/types/components/scroll-view/scroll-view.d.ts +4 -1
  53. package/dist/types/components.d.ts +5 -2
  54. package/lib/react/component-lib/index.d.ts +55 -0
  55. package/lib/react/component-lib/index.js +68 -0
  56. package/lib/react/component-lib/index.js.map +1 -0
  57. package/lib/react/component-lib/input.d.ts +3 -0
  58. package/lib/react/component-lib/input.js +17 -0
  59. package/lib/react/component-lib/input.js.map +1 -0
  60. package/lib/react/component-lib/reactify-wc.d.ts +7 -0
  61. package/lib/react/component-lib/reactify-wc.js +176 -0
  62. package/lib/react/component-lib/reactify-wc.js.map +1 -0
  63. package/lib/react/react-component-lib/utils/attachProps.d.ts +1 -1
  64. package/lib/react/react-component-lib/utils/attachProps.js +1 -15
  65. package/lib/react/react-component-lib/utils/attachProps.js.map +1 -1
  66. package/lib/vue2/component-lib/components.d.ts +111 -0
  67. package/lib/vue2/component-lib/components.js +74 -0
  68. package/lib/vue2/component-lib/components.js.map +1 -0
  69. package/lib/vue2/component-lib/createComponent.d.ts +14 -0
  70. package/lib/vue2/component-lib/createComponent.js +23 -0
  71. package/lib/vue2/component-lib/createComponent.js.map +1 -0
  72. package/lib/vue2/component-lib/createFormsComponent.d.ts +22 -0
  73. package/lib/vue2/component-lib/createFormsComponent.js +53 -0
  74. package/lib/vue2/component-lib/createFormsComponent.js.map +1 -0
  75. package/lib/vue2/component-lib/icon.d.ts +16 -0
  76. package/lib/vue2/component-lib/icon.js +23 -0
  77. package/lib/vue2/component-lib/icon.js.map +1 -0
  78. package/lib/vue2/component-lib/image.d.ts +16 -0
  79. package/lib/vue2/component-lib/image.js +24 -0
  80. package/lib/vue2/component-lib/image.js.map +1 -0
  81. package/lib/vue2/component-lib/index.d.ts +1 -0
  82. package/lib/vue2/component-lib/index.js +30 -0
  83. package/lib/vue2/component-lib/index.js.map +1 -0
  84. package/lib/vue2/component-lib/mixins/listeners.d.ts +6 -0
  85. package/lib/vue2/component-lib/mixins/listeners.js +14 -0
  86. package/lib/vue2/component-lib/mixins/listeners.js.map +1 -0
  87. package/lib/vue2/component-lib/mixins/refs.d.ts +5 -0
  88. package/lib/vue2/component-lib/mixins/refs.js +53 -0
  89. package/lib/vue2/component-lib/mixins/refs.js.map +1 -0
  90. package/lib/vue2/component-lib/picker.d.ts +25 -0
  91. package/lib/vue2/component-lib/picker.js +41 -0
  92. package/lib/vue2/component-lib/picker.js.map +1 -0
  93. package/lib/vue2/component-lib/scroll-view.d.ts +17 -0
  94. package/lib/vue2/component-lib/scroll-view.js +35 -0
  95. package/lib/vue2/component-lib/scroll-view.js.map +1 -0
  96. package/lib/vue2/component-lib/text.d.ts +16 -0
  97. package/lib/vue2/component-lib/text.js +24 -0
  98. package/lib/vue2/component-lib/text.js.map +1 -0
  99. package/lib/vue2/components.d.ts +5 -2
  100. package/lib/vue2/components.js +29 -5
  101. package/lib/vue2/components.js.map +1 -1
  102. package/lib/vue2/index.js +2 -0
  103. package/lib/vue2/index.js.map +1 -1
  104. package/lib/vue2/node_modules/.pnpm/registry.npmjs.org_vue-fragment@1.6.0_vue@2.6.14/node_modules/vue-fragment/dist/vue-fragment.esm.js +4 -0
  105. package/lib/vue2/node_modules/.pnpm/registry.npmjs.org_vue-fragment@1.6.0_vue@2.6.14/node_modules/vue-fragment/dist/vue-fragment.esm.js.map +1 -0
  106. package/lib/vue2/vue-component-lib/utils.js +3 -1
  107. package/lib/vue2/vue-component-lib/utils.js.map +1 -1
  108. package/lib/vue3/component-lib/createComponent.d.ts +10 -0
  109. package/lib/vue3/component-lib/createComponent.js +21 -0
  110. package/lib/vue3/component-lib/createComponent.js.map +1 -0
  111. package/lib/vue3/component-lib/createFormsComponent.d.ts +11 -0
  112. package/lib/vue3/component-lib/createFormsComponent.js +38 -0
  113. package/lib/vue3/component-lib/createFormsComponent.js.map +1 -0
  114. package/lib/vue3/component-lib/forwardRef.d.ts +2 -0
  115. package/lib/vue3/component-lib/forwardRef.js +13 -0
  116. package/lib/vue3/component-lib/forwardRef.js.map +1 -0
  117. package/lib/vue3/component-lib/icon.d.ts +11 -0
  118. package/lib/vue3/component-lib/icon.js +20 -0
  119. package/lib/vue3/component-lib/icon.js.map +1 -0
  120. package/lib/vue3/component-lib/image.d.ts +11 -0
  121. package/lib/vue3/component-lib/image.js +21 -0
  122. package/lib/vue3/component-lib/image.js.map +1 -0
  123. package/lib/vue3/component-lib/index.d.ts +442 -0
  124. package/lib/vue3/component-lib/index.js +68 -0
  125. package/lib/vue3/component-lib/index.js.map +1 -0
  126. package/lib/vue3/component-lib/scroll-view.d.ts +11 -0
  127. package/lib/vue3/component-lib/scroll-view.js +27 -0
  128. package/lib/vue3/component-lib/scroll-view.js.map +1 -0
  129. package/lib/vue3/component-lib/text.d.ts +11 -0
  130. package/lib/vue3/component-lib/text.js +21 -0
  131. package/lib/vue3/component-lib/text.js.map +1 -0
  132. package/lib/vue3/components.d.ts +2 -2
  133. package/lib/vue3/components.js +9 -8
  134. package/lib/vue3/components.js.map +1 -1
  135. package/lib/vue3/vue-component-lib/utils.js +1 -1
  136. package/lib/vue3/vue-component-lib/utils.js.map +1 -1
  137. package/package.json +8 -8
  138. package/types/ChannelLive.d.ts +1 -1
  139. package/types/CommentList.d.ts +1 -0
  140. package/types/Form.d.ts +0 -6
  141. package/types/Navigator.d.ts +8 -8
  142. package/types/RootPortal.d.ts +0 -1
  143. package/dist/taro-components/p-5208792d.entry.js.map +0 -1
  144. package/dist/taro-components/p-5beca045.system.entry.js +0 -2
  145. package/dist/taro-components/p-5beca045.system.entry.js.map +0 -1
  146. package/dist/taro-components/p-6de64a4b.system.entry.js +0 -2
  147. package/dist/taro-components/p-6de64a4b.system.entry.js.map +0 -1
  148. package/dist/taro-components/p-71155a2c.entry.js +0 -2
  149. package/dist/taro-components/p-71155a2c.entry.js.map +0 -1
@@ -17,7 +17,7 @@ export declare class Input implements ComponentInterface {
17
17
  name: string;
18
18
  nativeProps: {};
19
19
  el: HTMLElement;
20
- focus(): void;
20
+ focus(): Promise<void>;
21
21
  watchAutoFocus(newValue: boolean, oldValue: boolean): void;
22
22
  watchValue(newValue: string): void;
23
23
  onInput: EventEmitter;
@@ -1,20 +1,4 @@
1
1
  import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime';
2
- /**
3
- * Navigator组件参数
4
- * @typedef NavigatorProps
5
- * @property {String} appId 当target="miniProgram"时有效,要打开的小程序 appId
6
- * @property {String} ariaLabel 无障碍访问,(属性)元素的额外描述
7
- * @property {Number} delta 当 openType 为 'navigateBack' 时有效,表示回退的层数
8
- * @property {Object} extraData 当target="miniProgram"时有效,需要传递给目标小程序的数据,目标小程序可在 App.onLaunch(),App.onShow() 中获取到这份数据。详情
9
- * @property {String} [openType=navigate] 跳转方式
10
- * @property {String} path 当target="miniProgram"时有效,打开的页面路径,如果为空则打开首页
11
- * @property {String} [target=self] 在哪个目标上发生跳转,默认当前小程序,可选值self/miniProgram
12
- * @property {String} url 当前小程序内的跳转链接
13
- * @property {version} [version=release] 当target="miniProgram"时有效,要打开的小程序版本,有效值 develop(开发版),trial(体验版),release(正式版),仅在当前小程序为开发版或体验版时此参数有效;如果当前小程序是 *式版,则打开的小程序必定是正式版。
14
- * @property {String} onFail 当target="miniProgram"时有效,跳转小程序失败
15
- * @property {String} onComplete 当target="miniProgram"时有效,跳转小程序完成
16
- * @property {String} onSuccess 当target="miniProgram"时有效,跳转小程序成功
17
- */
18
2
  /**
19
3
  * TODO: 参数还需要进一步细化对齐
20
4
  * Navigator组件
@@ -1,4 +1,5 @@
1
1
  import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime';
2
+ import type { ScrollViewContext } from '@tarojs/taro';
2
3
  export declare class ScrollView implements ComponentInterface {
3
4
  private _scrollLeft;
4
5
  private _scrollTop;
@@ -10,7 +11,7 @@ export declare class ScrollView implements ComponentInterface {
10
11
  mpScrollTop: number | string;
11
12
  mpScrollLeft: number | string;
12
13
  mpScrollIntoView: string;
13
- scrollWithAnimation: boolean;
14
+ animated: boolean;
14
15
  onScroll: EventEmitter;
15
16
  onScrollToUpper: EventEmitter;
16
17
  onScrollToLower: EventEmitter;
@@ -18,6 +19,8 @@ export declare class ScrollView implements ComponentInterface {
18
19
  watchScrollTop(newVal: any): void;
19
20
  watchScrollIntoView(newVal: any): void;
20
21
  handleScroll(e: Event): void;
22
+ mpScrollToMethod(object: ScrollViewContext.scrollTo.Option): Promise<void>;
23
+ mpScrollIntoViewMethod(selector: string): Promise<void>;
21
24
  componentDidLoad(): void;
22
25
  upperAndLower: (...args: any[]) => void;
23
26
  render(): any;
@@ -9,6 +9,7 @@ import { Type } from "./components/icon/icon";
9
9
  import { Mode } from "./components/image/image";
10
10
  import { Fields, Mode as Mode1 } from "./components/picker/picker";
11
11
  import { Nodes } from "./components/rich-text/rich-text";
12
+ import { ScrollViewContext } from "@tarojs/taro";
12
13
  import { Conf } from "./components/tabbar/tabbar";
13
14
  import { Danmu } from "./components/video/video-danmu";
14
15
  export namespace Components {
@@ -305,11 +306,13 @@ export namespace Components {
305
306
  interface TaroRtcRoomItemCore {
306
307
  }
307
308
  interface TaroScrollViewCore {
309
+ "animated": boolean;
308
310
  "lowerThreshold": number | string;
309
311
  "mpScrollIntoView": string;
312
+ "mpScrollIntoViewMethod": (selector: string) => Promise<void>;
310
313
  "mpScrollLeft": number | string;
314
+ "mpScrollToMethod": (object: ScrollViewContext.scrollTo.Option) => Promise<void>;
311
315
  "mpScrollTop": number | string;
312
- "scrollWithAnimation": boolean;
313
316
  "scrollX": boolean;
314
317
  "scrollY": boolean;
315
318
  "upperThreshold": number | string;
@@ -1546,6 +1549,7 @@ declare namespace LocalJSX {
1546
1549
  interface TaroRtcRoomItemCore {
1547
1550
  }
1548
1551
  interface TaroScrollViewCore {
1552
+ "animated"?: boolean;
1549
1553
  "lowerThreshold"?: number | string;
1550
1554
  "mpScrollIntoView"?: string;
1551
1555
  "mpScrollLeft"?: number | string;
@@ -1553,7 +1557,6 @@ declare namespace LocalJSX {
1553
1557
  "onScroll"?: (event: TaroScrollViewCoreCustomEvent<any>) => void;
1554
1558
  "onScrolltolower"?: (event: TaroScrollViewCoreCustomEvent<any>) => void;
1555
1559
  "onScrolltoupper"?: (event: TaroScrollViewCoreCustomEvent<any>) => void;
1556
- "scrollWithAnimation"?: boolean;
1557
1560
  "scrollX"?: boolean;
1558
1561
  "scrollY"?: boolean;
1559
1562
  "upperThreshold"?: number | string;
@@ -0,0 +1,55 @@
1
+ declare const CoverImage: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
2
+ declare const CoverView: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
3
+ declare const MatchMedia: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
4
+ declare const MovableArea: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
5
+ declare const MovableView: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
6
+ declare const PageContainer: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
7
+ declare const RootPortal: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
8
+ declare const ScrollView: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
9
+ declare const ShareElement: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
10
+ declare const Swiper: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
11
+ declare const SwiperItem: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
12
+ declare const View: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
13
+ declare const Icon: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
14
+ declare const Progress: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
15
+ declare const RichText: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
16
+ declare const Text: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
17
+ declare const Button: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
18
+ declare const Checkbox: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
19
+ declare const CheckboxGroup: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
20
+ declare const Editor: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
21
+ declare const Form: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
22
+ declare const KeyboardAccessory: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
23
+ declare const Label: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
24
+ declare const Picker: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
25
+ declare const PickerView: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
26
+ declare const PickerViewColumn: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
27
+ declare const Radio: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
28
+ declare const RadioGroup: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
29
+ declare const Slider: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
30
+ declare const Switch: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
31
+ declare const Textarea: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
32
+ declare const FunctionalPageNavigator: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
33
+ declare const Navigator: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
34
+ declare const NavigationBar: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
35
+ declare const Audio: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
36
+ declare const Camera: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
37
+ declare const Image: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
38
+ declare const LivePlayer: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
39
+ declare const LivePusher: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
40
+ declare const Video: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
41
+ declare const VoipRoom: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
42
+ declare const Map: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
43
+ declare const Canvas: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
44
+ declare const Ad: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
45
+ declare const AdCustom: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
46
+ declare const OfficialAccount: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
47
+ declare const OpenData: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
48
+ declare const WebView: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
49
+ declare const PageMeta: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
50
+ declare const Block: import("react").ExoticComponent<{
51
+ children?: import("react").ReactNode;
52
+ }>;
53
+ declare const CustomWrapper: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
54
+ export { CoverImage, CoverView, MatchMedia, MovableArea, MovableView, PageContainer, RootPortal, ScrollView, ShareElement, Swiper, SwiperItem, View, Icon, Progress, RichText, Text, Button, Checkbox, CheckboxGroup, Editor, Form, KeyboardAccessory, Label, Picker, PickerView, PickerViewColumn, Radio, RadioGroup, Slider, Switch, Textarea, FunctionalPageNavigator, Navigator, NavigationBar, Audio, Camera, Image, LivePlayer, LivePusher, Video, VoipRoom, Map, Canvas, Ad, AdCustom, OfficialAccount, OpenData, WebView, PageMeta, Block, CustomWrapper };
55
+ export { default as Input } from "./input";
@@ -0,0 +1,68 @@
1
+ import { Fragment } from 'react';
2
+ import reactifyWebComponent from './reactify-wc.js';
3
+ export { default as Input } from './input.js';
4
+
5
+ // 视图容器
6
+ const CoverImage = reactifyWebComponent('taro-cover-image-core');
7
+ const CoverView = reactifyWebComponent('taro-cover-view-core');
8
+ const MatchMedia = reactifyWebComponent('taro-match-media-core');
9
+ const MovableArea = reactifyWebComponent('taro-movable-area-core');
10
+ const MovableView = reactifyWebComponent('taro-movable-view-core');
11
+ const PageContainer = reactifyWebComponent('taro-page-container-core');
12
+ const RootPortal = reactifyWebComponent('taro-root-portal-core');
13
+ const ScrollView = reactifyWebComponent('taro-scroll-view-core');
14
+ const ShareElement = reactifyWebComponent('taro-share-element-core');
15
+ const Swiper = reactifyWebComponent('taro-swiper-core');
16
+ const SwiperItem = reactifyWebComponent('taro-swiper-item-core');
17
+ const View = reactifyWebComponent('taro-view-core');
18
+ // 基础内容
19
+ const Icon = reactifyWebComponent('taro-icon-core');
20
+ const Progress = reactifyWebComponent('taro-progress-core');
21
+ const RichText = reactifyWebComponent('taro-rich-text-core');
22
+ const Text = reactifyWebComponent('taro-text-core');
23
+ // 表单组件
24
+ const Button = reactifyWebComponent('taro-button-core');
25
+ const Checkbox = reactifyWebComponent('taro-checkbox-core');
26
+ const CheckboxGroup = reactifyWebComponent('taro-checkbox-group-core');
27
+ const Editor = reactifyWebComponent('taro-editor-core');
28
+ const Form = reactifyWebComponent('taro-form-core');
29
+ const KeyboardAccessory = reactifyWebComponent('taro-keyboard-accessory-core');
30
+ const Label = reactifyWebComponent('taro-label-core');
31
+ const Picker = reactifyWebComponent('taro-picker-core');
32
+ const PickerView = reactifyWebComponent('taro-picker-view-core');
33
+ const PickerViewColumn = reactifyWebComponent('taro-picker-view-column-core');
34
+ const Radio = reactifyWebComponent('taro-radio-core');
35
+ const RadioGroup = reactifyWebComponent('taro-radio-group-core');
36
+ const Slider = reactifyWebComponent('taro-slider-core');
37
+ const Switch = reactifyWebComponent('taro-switch-core');
38
+ const Textarea = reactifyWebComponent('taro-textarea-core');
39
+ // 导航
40
+ const FunctionalPageNavigator = reactifyWebComponent('taro-functional-page-navigator-core');
41
+ const Navigator = reactifyWebComponent('taro-navigator-core');
42
+ const NavigationBar = reactifyWebComponent('taro-navigation-bar-core');
43
+ // 媒体组件
44
+ const Audio = reactifyWebComponent('taro-audio-core');
45
+ const Camera = reactifyWebComponent('taro-camera-core');
46
+ const Image = reactifyWebComponent('taro-image-core');
47
+ const LivePlayer = reactifyWebComponent('taro-live-player-core');
48
+ const LivePusher = reactifyWebComponent('taro-live-pusher-core');
49
+ const Video = reactifyWebComponent('taro-video-core');
50
+ const VoipRoom = reactifyWebComponent('taro-voip-room-core');
51
+ // 地图
52
+ const Map = reactifyWebComponent('taro-map-core');
53
+ // 画布
54
+ const Canvas = reactifyWebComponent('taro-canvas-core');
55
+ // 开放能力
56
+ const Ad = reactifyWebComponent('taro-ad-core');
57
+ const AdCustom = reactifyWebComponent('taro-ad-custom-core');
58
+ const OfficialAccount = reactifyWebComponent('taro-official-account-core');
59
+ const OpenData = reactifyWebComponent('taro-open-data-core');
60
+ const WebView = reactifyWebComponent('taro-web-view-core');
61
+ // 页面属性配置节点
62
+ const PageMeta = reactifyWebComponent('taro-page-meta-core');
63
+ // 其他
64
+ const Block = Fragment;
65
+ const CustomWrapper = reactifyWebComponent('taro-custom-wrapper-core');
66
+
67
+ export { Ad, AdCustom, Audio, Block, Button, Camera, Canvas, Checkbox, CheckboxGroup, CoverImage, CoverView, CustomWrapper, Editor, Form, FunctionalPageNavigator, Icon, Image, KeyboardAccessory, Label, LivePlayer, LivePusher, Map, MatchMedia, MovableArea, MovableView, NavigationBar, Navigator, OfficialAccount, OpenData, PageContainer, PageMeta, Picker, PickerView, PickerViewColumn, Progress, Radio, RadioGroup, RichText, RootPortal, ScrollView, ShareElement, Slider, Swiper, SwiperItem, Switch, Text, Textarea, Video, View, VoipRoom, WebView };
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../taro-components-library-react/src/component-lib/index.ts"],"sourcesContent":["import { Fragment } from 'react'\n\nimport reactifyWc from './reactify-wc'\n\n// 视图容器\nexport const CoverImage = reactifyWc('taro-cover-image-core')\nexport const CoverView = reactifyWc('taro-cover-view-core')\nexport const MatchMedia = reactifyWc('taro-match-media-core')\nexport const MovableArea = reactifyWc('taro-movable-area-core')\nexport const MovableView = reactifyWc('taro-movable-view-core')\nexport const PageContainer = reactifyWc('taro-page-container-core')\nexport const RootPortal = reactifyWc('taro-root-portal-core')\nexport const ScrollView = reactifyWc('taro-scroll-view-core')\nexport const ShareElement = reactifyWc('taro-share-element-core')\nexport const Swiper = reactifyWc('taro-swiper-core')\nexport const SwiperItem = reactifyWc('taro-swiper-item-core')\nexport const View = reactifyWc('taro-view-core')\n\n// 基础内容\nexport const Icon = reactifyWc('taro-icon-core')\nexport const Progress = reactifyWc('taro-progress-core')\nexport const RichText = reactifyWc('taro-rich-text-core')\nexport const Text = reactifyWc('taro-text-core')\n\n// 表单组件\nexport const Button = reactifyWc('taro-button-core')\nexport const Checkbox = reactifyWc('taro-checkbox-core')\nexport const CheckboxGroup = reactifyWc('taro-checkbox-group-core')\nexport const Editor = reactifyWc('taro-editor-core')\nexport const Form = reactifyWc('taro-form-core')\nexport { default as Input } from './input'\nexport const KeyboardAccessory = reactifyWc('taro-keyboard-accessory-core')\nexport const Label = reactifyWc('taro-label-core')\nexport const Picker = reactifyWc('taro-picker-core')\nexport const PickerView = reactifyWc('taro-picker-view-core')\nexport const PickerViewColumn = reactifyWc('taro-picker-view-column-core')\nexport const Radio = reactifyWc('taro-radio-core')\nexport const RadioGroup = reactifyWc('taro-radio-group-core')\nexport const Slider = reactifyWc('taro-slider-core')\nexport const Switch = reactifyWc('taro-switch-core')\nexport const Textarea = reactifyWc('taro-textarea-core')\n\n// 导航\nexport const FunctionalPageNavigator = reactifyWc('taro-functional-page-navigator-core')\nexport const Navigator = reactifyWc('taro-navigator-core')\nexport const NavigationBar = reactifyWc('taro-navigation-bar-core')\n\n// 媒体组件\nexport const Audio = reactifyWc('taro-audio-core')\nexport const Camera = reactifyWc('taro-camera-core')\nexport const Image = reactifyWc('taro-image-core')\nexport const LivePlayer = reactifyWc('taro-live-player-core')\nexport const LivePusher = reactifyWc('taro-live-pusher-core')\nexport const Video = reactifyWc('taro-video-core')\nexport const VoipRoom = reactifyWc('taro-voip-room-core')\n\n// 地图\nexport const Map = reactifyWc('taro-map-core')\n\n// 画布\nexport const Canvas = reactifyWc('taro-canvas-core')\n\n// 开放能力\nexport const Ad = reactifyWc('taro-ad-core')\nexport const AdCustom = reactifyWc('taro-ad-custom-core')\nexport const OfficialAccount = reactifyWc('taro-official-account-core')\nexport const OpenData = reactifyWc('taro-open-data-core')\nexport const WebView = reactifyWc('taro-web-view-core')\n\n// 页面属性配置节点\nexport const PageMeta = reactifyWc('taro-page-meta-core')\n\n// 其他\nexport const Block = Fragment\nexport const CustomWrapper = reactifyWc('taro-custom-wrapper-core')\n"],"names":["reactifyWc"],"mappings":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;"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
3
+ export { _default as default };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import reactifyWebComponent from './reactify-wc.js';
3
+
4
+ const Input = reactifyWebComponent('taro-input-core');
5
+ const h = React.createElement;
6
+ // eslint-disable-next-line react/display-name
7
+ var input = React.forwardRef((props, ref) => {
8
+ const args = Object.assign({}, props);
9
+ if (args.hasOwnProperty('focus')) {
10
+ args.autoFocus = Boolean(args.focus);
11
+ delete args.focus;
12
+ }
13
+ return (h(Input, Object.assign(Object.assign({}, args), { ref })));
14
+ });
15
+
16
+ export { input as default };
17
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sources":["../../../../taro-components-library-react/src/component-lib/input.ts"],"sourcesContent":["import React from 'react'\n\nimport reactifyWc from './reactify-wc'\n\nconst Input = reactifyWc('taro-input-core')\n\nconst h = React.createElement\n\n// eslint-disable-next-line react/display-name\nexport default React.forwardRef((props, ref) => {\n const args: Record<string, unknown> = { ...props }\n\n if (args.hasOwnProperty('focus')) {\n args.autoFocus = Boolean(args.focus)\n delete args.focus\n }\n\n return (\n h(Input, { ...args, ref })\n )\n})\n"],"names":["reactifyWc"],"mappings":";;;AAIA,MAAM,KAAK,GAAGA,oBAAU,CAAC,iBAAiB,CAAC,CAAA;AAE3C,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAA;AAE7B;AACA,YAAe,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAI;AAC7C,IAAA,MAAM,IAAI,GAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAiC,KAAK,CAAE,CAAA;AAElD,IAAA,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QAChC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpC,OAAO,IAAI,CAAC,KAAK,CAAA;AAClB,KAAA;IAED,QACE,CAAC,CAAC,KAAK,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAO,IAAI,CAAE,EAAA,EAAA,GAAG,EAAG,CAAA,CAAA,EAC3B;AACH,CAAC,CAAC;;;;"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * https://github.com/BBKolton/reactify-wc/
3
+ * modified event naming
4
+ **/
5
+ import React from 'react';
6
+ declare const reactifyWebComponent: (WC: any) => React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
7
+ export { reactifyWebComponent as default };
@@ -0,0 +1,176 @@
1
+ import React, { createRef, createElement } from 'react';
2
+
3
+ /**
4
+ * https://github.com/BBKolton/reactify-wc/
5
+ * modified event naming
6
+ **/
7
+ const h = React.createElement;
8
+ const SCROLL_VIEW = 'taro-scroll-view-core';
9
+ const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
10
+ // 为了不要覆盖 wc 中 host 内置的 class 和 stencil 加入的 class
11
+ function getClassName(wc, prevProps, props) {
12
+ const classList = Array.from(wc.classList);
13
+ const oldClassNames = (prevProps.className || prevProps.class || '').split(' ');
14
+ let incomingClassNames = (props.className || props.class || '').split(' ');
15
+ let finalClassNames = [];
16
+ classList.forEach(classname => {
17
+ if (incomingClassNames.indexOf(classname) > -1) {
18
+ finalClassNames.push(classname);
19
+ incomingClassNames = incomingClassNames.filter(name => name !== classname);
20
+ }
21
+ else if (oldClassNames.indexOf(classname) === -1) {
22
+ finalClassNames.push(classname);
23
+ }
24
+ });
25
+ finalClassNames = [...finalClassNames, ...incomingClassNames];
26
+ return finalClassNames.join(' ');
27
+ }
28
+ function updateStyle(dom, key, val) {
29
+ if (/^--/.test(key)) {
30
+ // css variable
31
+ dom.style.setProperty(key, val);
32
+ }
33
+ else if (typeof val !== 'number' || IS_NON_DIMENSIONAL.test(key)) {
34
+ dom.style[key] = val;
35
+ }
36
+ else {
37
+ dom.style[key] = val + 'px';
38
+ }
39
+ }
40
+ function updateProp(ctx, comp, propKey, prevProps, props) {
41
+ const dom = ctx.ref.current;
42
+ const val = props[propKey];
43
+ const prevVal = prevProps ? prevProps[propKey] : undefined;
44
+ if (propKey === 'children') {
45
+ return;
46
+ }
47
+ if (propKey.toLowerCase() === 'classname') {
48
+ dom.className = prevProps
49
+ ? getClassName(dom, prevProps, props)
50
+ : val;
51
+ return;
52
+ }
53
+ if (propKey === 'style') {
54
+ if (typeof val === 'string') {
55
+ dom.setAttribute(propKey, val);
56
+ return;
57
+ }
58
+ if (!val) {
59
+ dom.removeAttribute(propKey);
60
+ return;
61
+ }
62
+ if (prevProps) {
63
+ if (typeof prevVal === 'string') {
64
+ dom.style.cssText = '';
65
+ }
66
+ else {
67
+ for (const styleKey in prevVal) {
68
+ updateStyle(dom, styleKey, '');
69
+ }
70
+ }
71
+ }
72
+ for (const styleKey in val) {
73
+ updateStyle(dom, styleKey, val[styleKey]);
74
+ }
75
+ return;
76
+ }
77
+ if (/^data-.+/.test(propKey)) {
78
+ dom.setAttribute(propKey, val);
79
+ }
80
+ if (comp === SCROLL_VIEW) {
81
+ if (propKey === 'scrollTop') {
82
+ dom.mpScrollTop = val;
83
+ return;
84
+ }
85
+ if (propKey === 'scrollLeft') {
86
+ dom.mpScrollLeft = val;
87
+ return;
88
+ }
89
+ if (propKey === 'scrollIntoView') {
90
+ dom.mpScrollIntoView = val;
91
+ return;
92
+ }
93
+ }
94
+ if (typeof val === 'function' && propKey.match(/^on[A-Z]/)) {
95
+ const event = propKey.substr(2).toLowerCase();
96
+ ctx.eventHandlers.push([event, val]);
97
+ return dom.addEventListener(event, val);
98
+ }
99
+ if (typeof val === 'string' || typeof val === 'number') {
100
+ dom.setAttribute(propKey, val);
101
+ dom[propKey] = val;
102
+ return;
103
+ }
104
+ if (typeof val === 'boolean') {
105
+ if (val) {
106
+ dom[propKey] = true;
107
+ return dom.setAttribute(propKey, val);
108
+ }
109
+ dom[propKey] = false;
110
+ return dom.removeAttribute(propKey);
111
+ }
112
+ dom[propKey] = val;
113
+ }
114
+ const reactifyWebComponent = WC => {
115
+ class Index extends React.Component {
116
+ constructor(props) {
117
+ super(props);
118
+ this.eventHandlers = [];
119
+ this.ref = createRef();
120
+ }
121
+ update(prevProps) {
122
+ this.clearEventHandlers();
123
+ if (!this.ref.current)
124
+ return;
125
+ Object.keys(prevProps || {}).forEach((key) => {
126
+ if (key !== 'children' && key !== 'key' && !(key in this.props)) {
127
+ updateProp(this, WC, key, prevProps, this.props);
128
+ }
129
+ });
130
+ Object.keys(this.props).forEach((key) => {
131
+ updateProp(this, WC, key, prevProps, this.props);
132
+ });
133
+ }
134
+ componentDidUpdate(prevProps) {
135
+ this.update(prevProps);
136
+ }
137
+ componentDidMount() {
138
+ const { forwardRef } = this.props;
139
+ if (typeof forwardRef === 'function') {
140
+ forwardRef(this.ref.current);
141
+ }
142
+ else if (forwardRef && typeof forwardRef === 'object' && forwardRef.hasOwnProperty('current')) {
143
+ forwardRef.current = this.ref.current;
144
+ }
145
+ else if (typeof forwardRef === 'string') {
146
+ console.warn('内置组件不支持字符串 ref');
147
+ }
148
+ this.update(undefined);
149
+ }
150
+ componentWillUnmount() {
151
+ this.clearEventHandlers();
152
+ }
153
+ clearEventHandlers() {
154
+ this.eventHandlers.forEach(([event, handler]) => {
155
+ if (!this.ref.current)
156
+ return;
157
+ this.ref.current.removeEventListener(event, handler);
158
+ });
159
+ this.eventHandlers = [];
160
+ }
161
+ render() {
162
+ const { children, dangerouslySetInnerHTML } = this.props;
163
+ const props = {
164
+ ref: this.ref
165
+ };
166
+ if (dangerouslySetInnerHTML)
167
+ props.dangerouslySetInnerHTML = dangerouslySetInnerHTML;
168
+ return createElement(WC, props, children);
169
+ }
170
+ }
171
+ // eslint-disable-next-line react/display-name
172
+ return React.forwardRef((props, ref) => (h(Index, Object.assign(Object.assign({}, props), { forwardRef: ref }))));
173
+ };
174
+
175
+ export { reactifyWebComponent as default };
176
+ //# sourceMappingURL=reactify-wc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactify-wc.js","sources":["../../../../taro-components-library-react/src/component-lib/reactify-wc.ts"],"sourcesContent":["/**\n * https://github.com/BBKolton/reactify-wc/\n * modified event naming\n **/\nimport React, { createElement, createRef } from 'react'\n\nconst h = React.createElement\n\nconst SCROLL_VIEW = 'taro-scroll-view-core'\n\nconst IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i\n\n// 为了不要覆盖 wc 中 host 内置的 class 和 stencil 加入的 class\nfunction getClassName (wc, prevProps, props) {\n const classList = Array.from(wc.classList)\n const oldClassNames = (prevProps.className || prevProps.class || '').split(' ')\n let incomingClassNames = (props.className || props.class || '').split(' ')\n let finalClassNames = []\n\n classList.forEach(classname => {\n if (incomingClassNames.indexOf(classname) > -1) {\n finalClassNames.push(classname)\n incomingClassNames = incomingClassNames.filter(name => name !== classname)\n } else if (oldClassNames.indexOf(classname) === -1) {\n finalClassNames.push(classname)\n }\n })\n\n finalClassNames = [...finalClassNames, ...incomingClassNames]\n\n return finalClassNames.join(' ')\n}\n\nfunction updateStyle (dom, key, val) {\n if (/^--/.test(key)) {\n // css variable\n dom.style.setProperty(key, val)\n } else if (typeof val !== 'number' || IS_NON_DIMENSIONAL.test(key)) {\n dom.style[key] = val\n } else {\n dom.style[key] = val + 'px'\n }\n}\n\nfunction updateProp (ctx, comp, propKey, prevProps, props) {\n const dom = ctx.ref.current\n const val = props[propKey]\n const prevVal = prevProps ? prevProps[propKey] : undefined\n\n if (propKey === 'children') {\n return\n }\n if (propKey.toLowerCase() === 'classname') {\n dom.className = prevProps\n ? getClassName(dom, prevProps, props)\n : val\n return\n }\n if (propKey === 'style') {\n if (typeof val === 'string') {\n dom.setAttribute(propKey, val)\n return\n }\n if (!val) {\n dom.removeAttribute(propKey)\n return\n }\n\n if (prevProps) {\n if (typeof prevVal === 'string') {\n dom.style.cssText = ''\n } else {\n for (const styleKey in prevVal) {\n updateStyle(dom, styleKey, '')\n }\n }\n }\n\n for (const styleKey in val) {\n updateStyle(dom, styleKey, val[styleKey])\n }\n return\n }\n if (/^data-.+/.test(propKey)) {\n dom.setAttribute(propKey, val)\n }\n if (comp === SCROLL_VIEW) {\n if (propKey === 'scrollTop') {\n dom.mpScrollTop = val\n return\n }\n if (propKey === 'scrollLeft') {\n dom.mpScrollLeft = val\n return\n }\n if (propKey === 'scrollIntoView') {\n dom.mpScrollIntoView = val\n return\n }\n }\n if (typeof val === 'function' && propKey.match(/^on[A-Z]/)) {\n const event = propKey.substr(2).toLowerCase()\n\n ctx.eventHandlers.push([event, val])\n return dom.addEventListener(event, val)\n }\n\n if (typeof val === 'string' || typeof val === 'number') {\n dom.setAttribute(propKey, val)\n dom[propKey] = val\n return\n }\n if (typeof val === 'boolean') {\n if (val) {\n dom[propKey] = true\n return dom.setAttribute(\n propKey,\n val\n )\n }\n dom[propKey] = false\n return dom.removeAttribute(propKey)\n }\n dom[propKey] = val\n}\n\nconst reactifyWebComponent = WC => {\n class Index extends React.Component<Record<string, any>> {\n eventHandlers: any[]\n ref: React.RefObject<HTMLElement>\n\n constructor (props) {\n super(props)\n this.eventHandlers = []\n this.ref = createRef()\n }\n\n update (prevProps) {\n this.clearEventHandlers()\n if (!this.ref.current) return\n\n Object.keys(prevProps || {}).forEach((key) => {\n if (key !== 'children' && key !== 'key' && !(key in this.props)) {\n updateProp(this, WC, key, prevProps, this.props)\n }\n })\n\n Object.keys(this.props).forEach((key) => {\n updateProp(this, WC, key, prevProps, this.props)\n })\n }\n\n componentDidUpdate (prevProps) {\n this.update(prevProps)\n }\n\n componentDidMount () {\n const { forwardRef } = this.props\n if (typeof forwardRef === 'function') {\n forwardRef(this.ref.current)\n } else if (forwardRef && typeof forwardRef === 'object' && forwardRef.hasOwnProperty('current')) {\n forwardRef.current = this.ref.current\n } else if (typeof forwardRef === 'string') {\n console.warn('内置组件不支持字符串 ref')\n }\n this.update(undefined)\n }\n\n componentWillUnmount () {\n this.clearEventHandlers()\n }\n\n clearEventHandlers () {\n this.eventHandlers.forEach(([event, handler]) => {\n if (!this.ref.current) return\n this.ref.current.removeEventListener(event, handler)\n })\n this.eventHandlers = []\n }\n\n render () {\n const { children, dangerouslySetInnerHTML } = this.props\n const props: Record<string, any> = {\n ref: this.ref\n }\n if (dangerouslySetInnerHTML) props.dangerouslySetInnerHTML = dangerouslySetInnerHTML\n return createElement(WC, props, children)\n }\n }\n\n // eslint-disable-next-line react/display-name\n return React.forwardRef((props, ref) => (\n h(Index, { ...props, forwardRef: ref })\n ))\n}\n\nexport default reactifyWebComponent\n"],"names":[],"mappings":";;AAAA;;;AAGI;AAGJ,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAA;AAE7B,MAAM,WAAW,GAAG,uBAAuB,CAAA;AAE3C,MAAM,kBAAkB,GAAG,mEAAmE,CAAA;AAE9F;AACA,SAAS,YAAY,CAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAA;IACzC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,CAAA;AAC1C,IAAA,MAAM,aAAa,GAAG,CAAC,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,KAAK,IAAI,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;AAC/E,IAAA,IAAI,kBAAkB,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1E,IAAI,eAAe,GAAG,EAAE,CAAA;AAExB,IAAA,SAAS,CAAC,OAAO,CAAC,SAAS,IAAG;QAC5B,IAAI,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE;AAC9C,YAAA,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;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,CAAC,KAAK,EAAO,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,KAAK,CAAE,EAAA,EAAA,UAAU,EAAE,GAAG,EAAA,CAAA,CAAG,CACxC,CAAC,CAAA;AACJ;;;;"}
@@ -4,7 +4,7 @@ declare const getClassName: (classList: DOMTokenList, newProps: any, oldProps: a
4
4
  * Checks if an event is supported in the current execution environment.
5
5
  * @license Modernizr 3.0.0pre (Custom Build) | MIT
6
6
  */
7
- declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
7
+ declare const isCoveredByReact: (__eventNameSuffix: string) => boolean;
8
8
  declare const syncEvent: (node: Element & {
9
9
  __events?: {
10
10
  [key: string]: (e: Event) => any;
@@ -62,21 +62,7 @@ const getClassName = (classList, newProps, oldProps) => {
62
62
  * Checks if an event is supported in the current execution environment.
63
63
  * @license Modernizr 3.0.0pre (Custom Build) | MIT
64
64
  */
65
- const isCoveredByReact = (eventNameSuffix) => {
66
- if (typeof document === 'undefined') {
67
- return true;
68
- }
69
- else {
70
- const eventName = 'on' + eventNameSuffix;
71
- let isSupported = eventName in document;
72
- if (!isSupported) {
73
- const element = document.createElement('div');
74
- element.setAttribute(eventName, 'return;');
75
- isSupported = typeof element[eventName] === 'function';
76
- }
77
- return isSupported;
78
- }
79
- };
65
+ const isCoveredByReact = (__eventNameSuffix) => false;
80
66
  const syncEvent = (node, eventName, newEventHandler) => {
81
67
  const eventStore = node.__events || (node.__events = {});
82
68
  const oldEventHandler = eventStore[eventName];
@@ -1 +1 @@
1
- {"version":3,"file":"attachProps.js","sources":["../../../../../taro-components-library-react/src/react-component-lib/utils/attachProps.ts"],"sourcesContent":["import { camelToDashCase } from './case';\n\nexport const attachProps = (node: HTMLElement, newProps: any, oldProps: any = {}) => {\n // some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first\n if (node instanceof Element) {\n // add any classes in className to the class list\n const className = getClassName(node.classList, newProps, oldProps);\n if (className !== '') {\n node.className = className;\n }\n\n Object.keys(newProps).forEach((name) => {\n if (\n name === 'children' ||\n name === 'style' ||\n name === 'ref' ||\n name === 'class' ||\n name === 'className' ||\n name === 'forwardedRef'\n ) {\n return;\n }\n if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {\n const eventName = name.substring(2);\n const eventNameLc = eventName.toLowerCase();\n\n if (!isCoveredByReact(eventNameLc)) {\n syncEvent(node, eventNameLc, newProps[name]);\n }\n } else {\n (node as any)[name] = newProps[name];\n const propType = typeof newProps[name];\n if (propType === 'string') {\n node.setAttribute(camelToDashCase(name), newProps[name]);\n }\n }\n });\n }\n};\n\nexport const getClassName = (classList: DOMTokenList, newProps: any, oldProps: any) => {\n const newClassProp: string = newProps.className || newProps.class;\n const oldClassProp: string = oldProps.className || oldProps.class;\n // map the classes to Maps for performance\n const currentClasses = arrayToMap(classList);\n const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);\n const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);\n const finalClassNames: string[] = [];\n // loop through each of the current classes on the component\n // to see if it should be a part of the classNames added\n currentClasses.forEach((currentClass) => {\n if (incomingPropClasses.has(currentClass)) {\n // add it as its already included in classnames coming in from newProps\n finalClassNames.push(currentClass);\n incomingPropClasses.delete(currentClass);\n } else if (!oldPropClasses.has(currentClass)) {\n // add it as it has NOT been removed by user\n finalClassNames.push(currentClass);\n }\n });\n incomingPropClasses.forEach((s) => finalClassNames.push(s));\n return finalClassNames.join(' ');\n};\n\n/**\n * Checks if an event is supported in the current execution environment.\n * @license Modernizr 3.0.0pre (Custom Build) | MIT\n */\nexport const isCoveredByReact = (eventNameSuffix: string) => {\n if (typeof document === 'undefined') {\n return true;\n } else {\n const eventName = 'on' + eventNameSuffix;\n let isSupported = eventName in document;\n\n if (!isSupported) {\n const element = document.createElement('div');\n element.setAttribute(eventName, 'return;');\n isSupported = typeof (element as any)[eventName] === 'function';\n }\n\n return isSupported;\n }\n};\n\nexport const syncEvent = (\n node: Element & { __events?: { [key: string]: ((e: Event) => any) | undefined } },\n eventName: string,\n newEventHandler?: (e: Event) => any\n) => {\n const eventStore = node.__events || (node.__events = {});\n const oldEventHandler = eventStore[eventName];\n\n // Remove old listener so they don't double up.\n if (oldEventHandler) {\n node.removeEventListener(eventName, oldEventHandler);\n }\n\n // Bind new listener.\n node.addEventListener(\n eventName,\n (eventStore[eventName] = function handler(e: Event) {\n if (newEventHandler) {\n newEventHandler.call(this, e);\n }\n })\n );\n};\n\nconst arrayToMap = (arr: string[] | DOMTokenList) => {\n const map = new Map<string, string>();\n (arr as string[]).forEach((s: string) => map.set(s, s));\n return map;\n};\n"],"names":[],"mappings":";;AAEO,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAE,QAAa,EAAE,QAAA,GAAgB,EAAE,KAAI;;IAElF,IAAI,IAAI,YAAY,OAAO,EAAE;;AAE3B,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnE,IAAI,SAAS,KAAK,EAAE,EAAE;AACpB,YAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC5B,SAAA;QAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAI;YACrC,IACE,IAAI,KAAK,UAAU;AACnB,gBAAA,IAAI,KAAK,OAAO;AAChB,gBAAA,IAAI,KAAK,KAAK;AACd,gBAAA,IAAI,KAAK,OAAO;AAChB,gBAAA,IAAI,KAAK,WAAW;gBACpB,IAAI,KAAK,cAAc,EACvB;gBACA,OAAO;AACR,aAAA;YACD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;gBACjE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;A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AA,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;;AAG9C,IAAA,IAAI,eAAe,EAAE;AACnB,QAAA,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;AACtD,KAAA;;AAGD,IAAA,IAAI,CAAC,gBAAgB,CACnB,SAAS,GACR,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS,OAAO,CAAC,CAAQ,EAAA;AAChD,QAAA,IAAI,eAAe,EAAE;AACnB,YAAA,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/B,SAAA;KACF,EACF,CAAC;AACJ,EAAE;AAEF,MAAM,UAAU,GAAG,CAAC,GAA4B,KAAI;AAClD,IAAA,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;AACrC,IAAA,GAAgB,CAAC,OAAO,CAAC,CAAC,CAAS,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACxD,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;;;;"}
1
+ {"version":3,"file":"attachProps.js","sources":["../../../../../taro-components-library-react/src/react-component-lib/utils/attachProps.ts"],"sourcesContent":["import { camelToDashCase } from './case';\n\nexport const attachProps = (node: HTMLElement, newProps: any, oldProps: any = {}) => {\n // some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first\n if (node instanceof Element) {\n // add any classes in className to the class list\n const className = getClassName(node.classList, newProps, oldProps);\n if (className !== '') {\n node.className = className;\n }\n\n Object.keys(newProps).forEach((name) => {\n if (\n name === 'children' ||\n name === 'style' ||\n name === 'ref' ||\n name === 'class' ||\n name === 'className' ||\n name === 'forwardedRef'\n ) {\n return;\n }\n if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {\n const eventName = name.substring(2);\n const eventNameLc = eventName.toLowerCase();\n\n if (!isCoveredByReact(eventNameLc)) {\n syncEvent(node, eventNameLc, newProps[name]);\n }\n } else {\n (node as any)[name] = newProps[name];\n const propType = typeof newProps[name];\n if (propType === 'string') {\n node.setAttribute(camelToDashCase(name), newProps[name]);\n }\n }\n });\n }\n};\n\nexport const getClassName = (classList: DOMTokenList, newProps: any, oldProps: any) => {\n const newClassProp: string = newProps.className || newProps.class;\n const oldClassProp: string = oldProps.className || oldProps.class;\n // map the classes to Maps for performance\n const currentClasses = arrayToMap(classList);\n const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);\n const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);\n const finalClassNames: string[] = [];\n // loop through each of the current classes on the component\n // to see if it should be a part of the classNames added\n currentClasses.forEach((currentClass) => {\n if (incomingPropClasses.has(currentClass)) {\n // add it as its already included in classnames coming in from newProps\n finalClassNames.push(currentClass);\n incomingPropClasses.delete(currentClass);\n } else if (!oldPropClasses.has(currentClass)) {\n // add it as it has NOT been removed by user\n finalClassNames.push(currentClass);\n }\n });\n incomingPropClasses.forEach((s) => finalClassNames.push(s));\n return finalClassNames.join(' ');\n};\n\n/**\n * Checks if an event is supported in the current execution environment.\n * @license Modernizr 3.0.0pre (Custom Build) | MIT\n */\nexport const isCoveredByReact = (__eventNameSuffix: string) => false;\n\nexport const syncEvent = (\n node: Element & { __events?: { [key: string]: ((e: Event) => any) | undefined } },\n eventName: string,\n newEventHandler?: (e: Event) => any\n) => {\n const eventStore = node.__events || (node.__events = {});\n const oldEventHandler = eventStore[eventName];\n\n // Remove old listener so they don't double up.\n if (oldEventHandler) {\n node.removeEventListener(eventName, oldEventHandler);\n }\n\n // Bind new listener.\n node.addEventListener(\n eventName,\n (eventStore[eventName] = function handler(e: Event) {\n if (newEventHandler) {\n newEventHandler.call(this, e);\n }\n })\n );\n};\n\nconst arrayToMap = (arr: string[] | DOMTokenList) => {\n const map = new Map<string, string>();\n (arr as string[]).forEach((s: string) => map.set(s, s));\n return map;\n};\n"],"names":[],"mappings":";;AAEO,MAAM,WAAW,GAAG,CAAC,IAAiB,EA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