shineout 3.4.4 → 3.4.5-beta.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.
- package/cjs/index.js +1 -1
- package/dist/shineout.js +74 -3
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -492,5 +492,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
492
492
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
493
493
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
494
494
|
var _default = exports.default = {
|
|
495
|
-
version: '3.4.
|
|
495
|
+
version: '3.4.5-beta.1'
|
|
496
496
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -11984,7 +11984,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
11984
11984
|
};
|
|
11985
11985
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
11986
11986
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
11987
|
-
/* harmony default export */ var version = ('3.4.
|
|
11987
|
+
/* harmony default export */ var version = ('3.4.5-beta.1');
|
|
11988
11988
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
11989
11989
|
|
|
11990
11990
|
|
|
@@ -32112,6 +32112,67 @@ var card_group_jssStyle = {
|
|
|
32112
32112
|
jssStyle: card_group_jssStyle
|
|
32113
32113
|
}, props));
|
|
32114
32114
|
});
|
|
32115
|
+
;// CONCATENATED MODULE: ../hooks/src/common/use-in-view/use-in-view.ts
|
|
32116
|
+
|
|
32117
|
+
|
|
32118
|
+
var useInView = function useInView() {
|
|
32119
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32120
|
+
var elementRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
32121
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
32122
|
+
_useState2 = slicedToArray_default()(_useState, 2),
|
|
32123
|
+
isInView = _useState2[0],
|
|
32124
|
+
setIsInView = _useState2[1];
|
|
32125
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
32126
|
+
_useState4 = slicedToArray_default()(_useState3, 2),
|
|
32127
|
+
wasInView = _useState4[0],
|
|
32128
|
+
setWasInView = _useState4[1];
|
|
32129
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
32130
|
+
var element = elementRef.current;
|
|
32131
|
+
if (!element) return;
|
|
32132
|
+
var observer = new IntersectionObserver(function (_ref) {
|
|
32133
|
+
var _ref2 = slicedToArray_default()(_ref, 1),
|
|
32134
|
+
entry = _ref2[0];
|
|
32135
|
+
var inView = entry.isIntersecting;
|
|
32136
|
+
setIsInView(inView);
|
|
32137
|
+
if (inView) {
|
|
32138
|
+
setWasInView(true);
|
|
32139
|
+
// 如果设置了 once 选项,且元素已经出现过,则取消观察
|
|
32140
|
+
if (options.once) {
|
|
32141
|
+
observer.disconnect();
|
|
32142
|
+
}
|
|
32143
|
+
}
|
|
32144
|
+
}, {
|
|
32145
|
+
root: options.root || null,
|
|
32146
|
+
rootMargin: options.rootMargin || '0px',
|
|
32147
|
+
threshold: options.threshold || 0
|
|
32148
|
+
});
|
|
32149
|
+
observer.observe(element);
|
|
32150
|
+
return function () {
|
|
32151
|
+
observer.disconnect();
|
|
32152
|
+
};
|
|
32153
|
+
}, [options.root, options.rootMargin, options.threshold, options.once]);
|
|
32154
|
+
return {
|
|
32155
|
+
ref: elementRef,
|
|
32156
|
+
isInView: isInView,
|
|
32157
|
+
wasInView: wasInView
|
|
32158
|
+
};
|
|
32159
|
+
};
|
|
32160
|
+
/* harmony default export */ var use_in_view = (useInView);
|
|
32161
|
+
|
|
32162
|
+
// 使用示例
|
|
32163
|
+
// const Example = () => {
|
|
32164
|
+
// const { ref, isInView } = useInView({
|
|
32165
|
+
// threshold: 0.5,
|
|
32166
|
+
// rootMargin: '50px',
|
|
32167
|
+
// once: true
|
|
32168
|
+
// });
|
|
32169
|
+
|
|
32170
|
+
// return (
|
|
32171
|
+
// <div ref={ref}>
|
|
32172
|
+
// {isInView ? '元素在视窗中' : '元素不在视窗中'}
|
|
32173
|
+
// </div>
|
|
32174
|
+
// );
|
|
32175
|
+
// };
|
|
32115
32176
|
;// CONCATENATED MODULE: ../hooks/src/utils/uid.ts
|
|
32116
32177
|
function generateUUID() {
|
|
32117
32178
|
var c = crypto || typeof window !== 'undefined' && window.crypto; // 获取加密库
|
|
@@ -34088,11 +34149,15 @@ var CheckboxWithContext = function CheckboxWithContext(props) {
|
|
|
34088
34149
|
|
|
34089
34150
|
|
|
34090
34151
|
|
|
34152
|
+
|
|
34091
34153
|
var Item = function Item(props) {
|
|
34092
34154
|
var _props$jssStyle, _props$jssStyle$cardG;
|
|
34093
34155
|
var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(CardGroupContext),
|
|
34094
34156
|
container = _useContext.container;
|
|
34095
34157
|
var classes = (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$cardG = _props$jssStyle.cardGroup) === null || _props$jssStyle$cardG === void 0 ? void 0 : _props$jssStyle$cardG.call(_props$jssStyle);
|
|
34158
|
+
var _useInView = use_in_view(),
|
|
34159
|
+
itemRef = _useInView.ref,
|
|
34160
|
+
isInView = _useInView.isInView;
|
|
34096
34161
|
var handleChange = usePersistFn(function (_, checked) {
|
|
34097
34162
|
if (props.onChange) props.onChange(checked, props.value);
|
|
34098
34163
|
});
|
|
@@ -34116,9 +34181,15 @@ var Item = function Item(props) {
|
|
|
34116
34181
|
className: classes === null || classes === void 0 ? void 0 : classes.checkbox
|
|
34117
34182
|
})]
|
|
34118
34183
|
});
|
|
34184
|
+
var itemStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
|
|
34185
|
+
return objectSpread2_default()(objectSpread2_default()({}, props.style), {}, {
|
|
34186
|
+
visibility: isInView ? 'visible' : 'hidden'
|
|
34187
|
+
});
|
|
34188
|
+
}, [isInView, props.style]);
|
|
34119
34189
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
34190
|
+
ref: itemRef,
|
|
34120
34191
|
className: cls,
|
|
34121
|
-
style:
|
|
34192
|
+
style: itemStyle,
|
|
34122
34193
|
children: renderChildren(content)
|
|
34123
34194
|
});
|
|
34124
34195
|
};
|
|
@@ -65292,7 +65363,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
65292
65363
|
|
|
65293
65364
|
|
|
65294
65365
|
/* harmony default export */ var src_0 = ({
|
|
65295
|
-
version: '3.4.
|
|
65366
|
+
version: '3.4.5-beta.1'
|
|
65296
65367
|
});
|
|
65297
65368
|
}();
|
|
65298
65369
|
/******/ return __webpack_exports__;
|