@tarojs/components-react 4.0.0-alpha.29 → 4.0.0-alpha.30
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/dist/components/button/index.js +7 -4
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/icon/index.js +7 -4
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image/index.js +7 -3
- package/dist/components/image/index.js.map +1 -1
- package/dist/components/input/index.js +7 -3
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/pull-down-refresh/index.js +9 -3
- package/dist/components/pull-down-refresh/index.js.map +1 -1
- package/dist/components/scroll-view/index.js +4 -2
- package/dist/components/scroll-view/index.js.map +1 -1
- package/dist/components/swiper/index.js +20 -6
- package/dist/components/swiper/index.js.map +1 -1
- package/dist/components/text/index.js +7 -3
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/view/index.js +6 -2
- package/dist/components/view/index.js.map +1 -1
- package/dist/solid/components/button/index.js +8 -5
- package/dist/solid/components/button/index.js.map +1 -1
- package/dist/solid/components/icon/index.js +9 -5
- package/dist/solid/components/icon/index.js.map +1 -1
- package/dist/solid/components/image/index.js +8 -4
- package/dist/solid/components/image/index.js.map +1 -1
- package/dist/solid/components/input/index.js +7 -3
- package/dist/solid/components/input/index.js.map +1 -1
- package/dist/solid/components/pull-down-refresh/index.js +9 -3
- package/dist/solid/components/pull-down-refresh/index.js.map +1 -1
- package/dist/solid/components/scroll-view/index.js +4 -2
- package/dist/solid/components/scroll-view/index.js.map +1 -1
- package/dist/solid/components/swiper/index.js +21 -7
- package/dist/solid/components/swiper/index.js.map +1 -1
- package/dist/solid/components/text/index.js +8 -4
- package/dist/solid/components/text/index.js.map +1 -1
- package/dist/solid/components/view/index.js +8 -3
- package/dist/solid/components/view/index.js.map +1 -1
- package/dist/solid/utils/index.js +10 -1
- package/dist/solid/utils/index.js.map +1 -1
- package/dist/utils/index.js +12 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { template, spread, mergeProps, memo, insert, delegateEvents } from 'solid-js/web';
|
|
1
|
+
import { template, use, spread, mergeProps, memo, insert, delegateEvents } from 'solid-js/web';
|
|
2
2
|
import { __rest } from 'tslib';
|
|
3
3
|
import './style/index.css.js';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { useState, useEffect } from '../../utils/hooks.js';
|
|
6
|
+
import { createForwardRefComponent } from '../../utils/index.js';
|
|
6
7
|
|
|
7
8
|
var _tmpl$ = /*#__PURE__*/template(`<div>`);
|
|
8
9
|
function View(_a) {
|
|
9
10
|
var {
|
|
10
11
|
className,
|
|
11
12
|
hoverClass,
|
|
13
|
+
forwardedRef,
|
|
12
14
|
onTouchStart,
|
|
13
15
|
onTouchEnd,
|
|
14
16
|
onTouchMove,
|
|
15
17
|
hoverStartTime = 50,
|
|
16
18
|
hoverStayTime = 400
|
|
17
19
|
} = _a,
|
|
18
|
-
other = __rest(_a, ["className", "hoverClass", "onTouchStart", "onTouchEnd", "onTouchMove", "hoverStartTime", "hoverStayTime"]);
|
|
20
|
+
other = __rest(_a, ["className", "hoverClass", "forwardedRef", "onTouchStart", "onTouchEnd", "onTouchMove", "hoverStartTime", "hoverStayTime"]);
|
|
19
21
|
let timeoutEvent;
|
|
20
22
|
let startTime = 0;
|
|
21
23
|
const [hover, setHover] = useState(false);
|
|
@@ -69,6 +71,8 @@ function View(_a) {
|
|
|
69
71
|
_el$.$$touchmove = _onTouchMove;
|
|
70
72
|
_el$.$$touchend = _onTouchEnd;
|
|
71
73
|
_el$.$$touchstart = _onTouchStart;
|
|
74
|
+
var _ref$ = forwardedRef;
|
|
75
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : forwardedRef = _el$;
|
|
72
76
|
spread(_el$, mergeProps({
|
|
73
77
|
get className() {
|
|
74
78
|
return memo(() => "solid" === 'solid')() ? cls() : cls;
|
|
@@ -78,7 +82,8 @@ function View(_a) {
|
|
|
78
82
|
return _el$;
|
|
79
83
|
})();
|
|
80
84
|
}
|
|
85
|
+
var index = createForwardRefComponent(View);
|
|
81
86
|
delegateEvents(["touchstart", "touchend", "touchmove"]);
|
|
82
87
|
|
|
83
|
-
export {
|
|
88
|
+
export { index as default };
|
|
84
89
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/view/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\n\nimport { useEffect, useState } from '../../utils/hooks'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n hoverClass?: string\n hoverStartTime?: number\n hoverStayTime?: number\n onTouchStart?(e: React.TouchEvent<HTMLDivElement>): void\n onTouchEnd?(e: React.TouchEvent<HTMLDivElement>): void\n onTouchMove?(e: React.TouchEvent<HTMLDivElement>): void\n onLongPress?(): void\n}\n\nfunction View ({\n className,\n hoverClass,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n hoverStartTime = 50,\n hoverStayTime = 400,\n ...other\n}: IProps) {\n let timeoutEvent: ReturnType<typeof setTimeout>\n let startTime = 0\n const [hover, setHover] = useState<boolean>(false)\n const [touch, setTouch] = useState<boolean>(false)\n\n const [cls, setCls] = useState<string>(classNames(\n '',\n {\n [`${hoverClass}`]: process.env.FRAMEWORK === 'solid' ? (hover as Exclude<typeof hover, boolean>)() : hover\n },\n className\n ))\n\n const _onTouchStart = e => {\n if (hoverClass) {\n setTouch(true)\n setTimeout(() => {\n if (process.env.FRAMEWORK === 'solid' ? (touch as Exclude<typeof touch, boolean>)() : touch) {\n setHover(true)\n }\n }, hoverStartTime)\n }\n onTouchStart && onTouchStart(e)\n if (other.onLongPress) {\n timeoutEvent = setTimeout(() => {\n other.onLongPress!()\n }, 350)\n startTime = new Date().getTime()\n }\n }\n\n const _onTouchMove = e => {\n clearTimeout(timeoutEvent)\n onTouchMove && onTouchMove(e)\n }\n\n const _onTouchEnd = e => {\n const spanTime = new Date().getTime() - startTime\n if (spanTime < 350) {\n clearTimeout(timeoutEvent)\n }\n if (hoverClass) {\n setTouch(false)\n setTimeout(() => {\n if (process.env.FRAMEWORK === 'solid' ? (touch as Exclude<typeof touch, boolean>)() : touch) {\n setHover(false)\n }\n }, hoverStayTime)\n }\n onTouchEnd && onTouchEnd(e)\n }\n\n useEffect(() => {\n setCls(classNames(\n '',\n {\n [`${hoverClass}`]: process.env.FRAMEWORK === 'solid' ? (hover as Exclude<typeof hover, boolean>)() : hover\n },\n className\n ))\n }, [hover, className])\n\n return (\n <div\n className={process.env.FRAMEWORK === 'solid' ? (cls as Exclude<typeof cls, string>)() : cls as string}\n onTouchStart={_onTouchStart}\n onTouchEnd={_onTouchEnd}\n onTouchMove={_onTouchMove}\n {...other}\n >\n {other.children}\n </div>\n )\n}\n\nexport default View\n"],"names":["View","_a","className","hoverClass","onTouchStart","onTouchEnd","onTouchMove","hoverStartTime","hoverStayTime","other","__rest","timeoutEvent","startTime","hover","setHover","useState","touch","setTouch","cls","setCls","classNames","process","_onTouchStart","e","setTimeout","onLongPress","Date","getTime","_onTouchMove","clearTimeout","_onTouchEnd","spanTime","useEffect","_el$","_tmpl$","$$touchmove","$$touchend","$$touchstart","_$spread","_$mergeProps","_$memo","_$insert","children","_$delegateEvents"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/view/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\n\nimport { useEffect, useState } from '../../utils/hooks'\nimport { createForwardRefComponent } from '../../utils/index'\n\nimport type React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n hoverClass?: string\n hoverStartTime?: number\n hoverStayTime?: number\n onTouchStart?(e: React.TouchEvent<HTMLDivElement>): void\n onTouchEnd?(e: React.TouchEvent<HTMLDivElement>): void\n onTouchMove?(e: React.TouchEvent<HTMLDivElement>): void\n onLongPress?(): void\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n}\n\nfunction View ({\n className,\n hoverClass,\n forwardedRef,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n hoverStartTime = 50,\n hoverStayTime = 400,\n ...other\n}: IProps) {\n let timeoutEvent: ReturnType<typeof setTimeout>\n let startTime = 0\n const [hover, setHover] = useState<boolean>(false)\n const [touch, setTouch] = useState<boolean>(false)\n\n const [cls, setCls] = useState<string>(classNames(\n '',\n {\n [`${hoverClass}`]: process.env.FRAMEWORK === 'solid' ? (hover as Exclude<typeof hover, boolean>)() : hover\n },\n className\n ))\n\n const _onTouchStart = e => {\n if (hoverClass) {\n setTouch(true)\n setTimeout(() => {\n if (process.env.FRAMEWORK === 'solid' ? (touch as Exclude<typeof touch, boolean>)() : touch) {\n setHover(true)\n }\n }, hoverStartTime)\n }\n onTouchStart && onTouchStart(e)\n if (other.onLongPress) {\n timeoutEvent = setTimeout(() => {\n other.onLongPress!()\n }, 350)\n startTime = new Date().getTime()\n }\n }\n\n const _onTouchMove = e => {\n clearTimeout(timeoutEvent)\n onTouchMove && onTouchMove(e)\n }\n\n const _onTouchEnd = e => {\n const spanTime = new Date().getTime() - startTime\n if (spanTime < 350) {\n clearTimeout(timeoutEvent)\n }\n if (hoverClass) {\n setTouch(false)\n setTimeout(() => {\n if (process.env.FRAMEWORK === 'solid' ? (touch as Exclude<typeof touch, boolean>)() : touch) {\n setHover(false)\n }\n }, hoverStayTime)\n }\n onTouchEnd && onTouchEnd(e)\n }\n\n useEffect(() => {\n setCls(classNames(\n '',\n {\n [`${hoverClass}`]: process.env.FRAMEWORK === 'solid' ? (hover as Exclude<typeof hover, boolean>)() : hover\n },\n className\n ))\n }, [hover, className])\n\n return (\n <div\n ref={forwardedRef}\n className={process.env.FRAMEWORK === 'solid' ? (cls as Exclude<typeof cls, string>)() : cls as string}\n onTouchStart={_onTouchStart}\n onTouchEnd={_onTouchEnd}\n onTouchMove={_onTouchMove}\n {...other}\n >\n {other.children}\n </div>\n )\n}\n\n\nexport default createForwardRefComponent(View)\n"],"names":["View","_a","className","hoverClass","forwardedRef","onTouchStart","onTouchEnd","onTouchMove","hoverStartTime","hoverStayTime","other","__rest","timeoutEvent","startTime","hover","setHover","useState","touch","setTouch","cls","setCls","classNames","process","_onTouchStart","e","setTimeout","onLongPress","Date","getTime","_onTouchMove","clearTimeout","_onTouchEnd","spanTime","useEffect","_el$","_tmpl$","$$touchmove","$$touchend","$$touchstart","_ref$","_$use","_$spread","_$mergeProps","_$memo","_$insert","children","createForwardRefComponent","_$delegateEvents"],"mappings":";;;;;;;;AAoBA,SAASA,IAAIA,CAAEC,EAUN,EAAA;MAVM;MACbC,SAAS;MACTC,UAAU;MACVC,YAAY;MACZC,YAAY;MACZC,UAAU;MACVC,WAAW;AACXC,MAAAA,cAAc,GAAG,EAAE;AACnBC,MAAAA,aAAa,GAAG,GAAA;UAET;IADJC,KAAK,GATKC,MAAA,CAAAV,EAAA,EAAA,CAAA,WAAA,EAAA,YAAA,EAAA,cAAA,EAAA,cAAA,EAAA,YAAA,EAAA,aAAA,EAAA,gBAAA,EAAA,eAAA,CAUd,CADS,CAAA;AAER,EAAA,IAAIW,YAA2C,CAAA;EAC/C,IAAIC,SAAS,GAAG,CAAC,CAAA;EACjB,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,QAAQ,CAAU,KAAK,CAAC,CAAA;EAClD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGF,QAAQ,CAAU,KAAK,CAAC,CAAA;EAElD,MAAM,CAACG,GAAG,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAASK,UAAU,CAC/C,EAAE,EACF;AACE,IAAA,CAAC,CAAGlB,EAAAA,UAAU,CAAE,CAAA,GAAGmB,OAAqB,KAAK,OAAO,GAAIR,KAAwC,EAAE,GAAGA,KAAAA;GACtG,EACDZ,SAAS,CACV,CAAC,CAAA;EAEF,MAAMqB,aAAa,GAAGC,CAAC,IAAG;AACxB,IAAA,IAAIrB,UAAU,EA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@
|
|
|
1
|
+
import { createComponent, mergeProps } from 'solid-js/web';
|
|
2
|
+
import { forwardRef } from './hooks.js';
|
|
3
|
+
|
|
1
4
|
function throttle(fn) {
|
|
2
5
|
let threshold = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
|
|
3
6
|
let scope = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -44,6 +47,12 @@ function omit(obj, fields) {
|
|
|
44
47
|
}
|
|
45
48
|
return shallowCopy;
|
|
46
49
|
}
|
|
50
|
+
const createForwardRefComponent = ReactComponent => {
|
|
51
|
+
const forwardRefComponent = (props, ref) => createComponent(ReactComponent, mergeProps(props, {
|
|
52
|
+
forwardedRef: ref
|
|
53
|
+
}));
|
|
54
|
+
return forwardRef(forwardRefComponent);
|
|
55
|
+
};
|
|
47
56
|
|
|
48
|
-
export { debounce, omit, throttle };
|
|
57
|
+
export { createForwardRefComponent, debounce, omit, throttle };
|
|
49
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils/index.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/index.tsx"],"sourcesContent":["/* eslint-disable react/react-in-jsx-scope */\nimport { forwardRef } from './hooks'\n\nexport function throttle (fn, threshold = 250, scope?) {\n let lastTime = 0\n let deferTimer: ReturnType<typeof setTimeout>\n return function (...args) {\n const context = scope || this\n const now = Date.now()\n if (now - lastTime > threshold) {\n fn.apply(this, args)\n lastTime = now\n } else {\n clearTimeout(deferTimer)\n deferTimer = setTimeout(() => {\n lastTime = now\n fn.apply(context, args)\n }, threshold)\n }\n }\n}\n\nexport function debounce (fn, ms = 250, scope?) {\n let timer: ReturnType<typeof setTimeout>\n\n return function (...args) {\n const context = scope || this\n clearTimeout(timer)\n timer = setTimeout(function () {\n fn.apply(context, args)\n }, ms)\n }\n}\n\nexport function omit (obj, fields) {\n const shallowCopy = Object.assign({}, obj)\n for (let i = 0; i < fields.length; i += 1) {\n const key = fields[i]\n delete shallowCopy[key]\n }\n return shallowCopy\n}\n\nexport const createForwardRefComponent = (ReactComponent: any) => {\n const forwardRefComponent = (\n props,\n ref\n ) => <ReactComponent {...props} forwardedRef={ref} />\n\n return forwardRef(forwardRefComponent)\n}\n\n"],"names":["throttle","fn","threshold","arguments","length","undefined","scope","lastTime","deferTimer","_len","args","Array","_key","context","now","Date","apply","clearTimeout","setTimeout","debounce","ms","timer","_len2","_key2","omit","obj","fields","shallowCopy","Object","assign","i","key","createForwardRefComponent","ReactComponent","forwardRefComponent","props","ref","_$createComponent","_$mergeProps","forwardedRef","forwardRef"],"mappings":";;;AAGM,SAAUA,QAAQA,CAAEC,EAAE,EAAyB;AAAA,EAAA,IAAvBC,SAAS,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,GAAG,CAAA;EAAA,IAAEG,KAAM,GAAAH,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA,CAAA;EACnD,IAAIE,QAAQ,GAAG,CAAC,CAAA;AAChB,EAAA,IAAIC,UAAyC,CAAA;AAC7C,EAAA,OAAO,YAAiB;AAAA,IAAA,KAAA,IAAAC,IAAA,GAAAN,SAAA,CAAAC,MAAA,EAAJM,IAAI,GAAAC,IAAAA,KAAA,CAAAF,IAAA,GAAAG,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAH,IAAA,EAAAG,IAAA,EAAA,EAAA;AAAJF,MAAAA,IAAI,CAAAE,IAAA,CAAAT,GAAAA,SAAA,CAAAS,IAAA,CAAA,CAAA;AAAA,KAAA;AACtB,IAAA,MAAMC,OAAO,GAAGP,KAAK,IAAI,IAAI,CAAA;AAC7B,IAAA,MAAMQ,GAAG,GAAGC,IAAI,CAACD,GAAG,EAAE,CAAA;AACtB,IAAA,IAAIA,GAAG,GAAGP,QAAQ,GAAGL,S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AAEU,EAAE,CAAC,CAAA;GACP,CAAA;AACH,CAAA;AAEgB,SAAAI,IAAIA,CAAEC,GAAG,EAAEC,MAAM,EAAA;EAC/B,MAAMC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAAC,EAAE,EAAEJ,GAAG,CAAC,CAAA;AAC1C,EAAA,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,MAAM,CAACtB,MAAM,EAAE0B,CAAC,IAAI,CAAC,EAAE;AACzC,IAAA,MAAMC,GAAG,GAAGL,MAAM,CAACI,CAAC,CAAC,CAAA;IACrB,OAAOH,WAAW,CAACI,GAAG,CAAC,CAAA;AACzB,GAAA;AACA,EAAA,OAAOJ,WAAW,CAAA;AACpB,CAAA;AAEaK,MAAAA,yBAAyB,GAAIC,cAAmB,IAAI;AAC/D,EAAA,MAAMC,mBAAmB,GAAGA,CAC1BC,KAAK,EACLC,GAAG,KAAAC,eAAA,CACCJ,cAAc,EAAAK,UAAA,CAAKH,KAAK,EAAA;AAAEI,IAAAA,YAAY,EAAEH,GAAAA;GAAO,CAAA,CAAA,CAAA;EAErD,OAAOI,UAAU,CAACN,mBAAmB,CAAC,CAAA;AACxC;;;;"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { forwardRef } from './hooks.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable react/react-in-jsx-scope */
|
|
1
5
|
function throttle(fn) {
|
|
2
6
|
let threshold = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
|
|
3
7
|
let scope = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -44,6 +48,13 @@ function omit(obj, fields) {
|
|
|
44
48
|
}
|
|
45
49
|
return shallowCopy;
|
|
46
50
|
}
|
|
51
|
+
const createForwardRefComponent = ReactComponent => {
|
|
52
|
+
const forwardRefComponent = (props, ref) => /*#__PURE__*/jsx(ReactComponent, {
|
|
53
|
+
...props,
|
|
54
|
+
forwardedRef: ref
|
|
55
|
+
});
|
|
56
|
+
return forwardRef(forwardRefComponent);
|
|
57
|
+
};
|
|
47
58
|
|
|
48
|
-
export { debounce, omit, throttle };
|
|
59
|
+
export { createForwardRefComponent, debounce, omit, throttle };
|
|
49
60
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/utils/index.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/utils/index.tsx"],"sourcesContent":["/* eslint-disable react/react-in-jsx-scope */\nimport { forwardRef } from './hooks'\n\nexport function throttle (fn, threshold = 250, scope?) {\n let lastTime = 0\n let deferTimer: ReturnType<typeof setTimeout>\n return function (...args) {\n const context = scope || this\n const now = Date.now()\n if (now - lastTime > threshold) {\n fn.apply(this, args)\n lastTime = now\n } else {\n clearTimeout(deferTimer)\n deferTimer = setTimeout(() => {\n lastTime = now\n fn.apply(context, args)\n }, threshold)\n }\n }\n}\n\nexport function debounce (fn, ms = 250, scope?) {\n let timer: ReturnType<typeof setTimeout>\n\n return function (...args) {\n const context = scope || this\n clearTimeout(timer)\n timer = setTimeout(function () {\n fn.apply(context, args)\n }, ms)\n }\n}\n\nexport function omit (obj, fields) {\n const shallowCopy = Object.assign({}, obj)\n for (let i = 0; i < fields.length; i += 1) {\n const key = fields[i]\n delete shallowCopy[key]\n }\n return shallowCopy\n}\n\nexport const createForwardRefComponent = (ReactComponent: any) => {\n const forwardRefComponent = (\n props,\n ref\n ) => <ReactComponent {...props} forwardedRef={ref} />\n\n return forwardRef(forwardRefComponent)\n}\n\n"],"names":["throttle","fn","threshold","arguments","length","undefined","scope","lastTime","deferTimer","_len","args","Array","_key","context","now","Date","apply","clearTimeout","setTimeout","debounce","ms","timer","_len2","_key2","omit","obj","fields","shallowCopy","Object","assign","i","key","createForwardRefComponent","ReactComponent","forwardRefComponent","props","ref","_jsx","forwardedRef","for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,WAAW,CAACI,GAAG,CAAC,CAAA;AACzB,GAAA;AACA,EAAA,OAAOJ,WAAW,CAAA;AACpB,CAAA;AAEaK,MAAAA,yBAAyB,GAAIC,cAAmB,IAAI;EAC/D,MAAMC,mBAAmB,GAAGA,CAC1BC,KAAK,EACLC,GAAG,kBACAC,GAAA,CAACJ,cAAc,EAAA;AAAA,IAAA,GAAKE,KAAK;AAAEG,IAAAA,YAAY,EAAEF,GAAAA;AAAI,GAAA,CAAG,CAAA;EAErD,OAAOG,UAAU,CAACL,mBAAmB,CAAC,CAAA;AACxC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components-react",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main:h5": "dist/index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"classnames": "^2.2.5",
|
|
29
29
|
"swiper": "6.8.0",
|
|
30
30
|
"tslib": "^2.6.2",
|
|
31
|
-
"@tarojs/taro": "4.0.0-alpha.
|
|
32
|
-
"@tarojs/
|
|
33
|
-
"@tarojs/
|
|
31
|
+
"@tarojs/taro": "4.0.0-alpha.30",
|
|
32
|
+
"@tarojs/shared": "4.0.0-alpha.30",
|
|
33
|
+
"@tarojs/components": "4.0.0-alpha.30"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/preset-react": "^7.24.1",
|
|
37
37
|
"babel-preset-solid": "^1.8.15",
|
|
38
38
|
"react": "^18.2.0",
|
|
39
39
|
"solid-js": "^1.8.16",
|
|
40
|
-
"@tarojs/helper": "4.0.0-alpha.
|
|
41
|
-
"@tarojs/runtime": "4.0.0-alpha.
|
|
40
|
+
"@tarojs/helper": "4.0.0-alpha.30",
|
|
41
|
+
"@tarojs/runtime": "4.0.0-alpha.30"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "*",
|