shineout 3.5.0-beta.8 → 3.5.0-beta.9

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 CHANGED
@@ -500,5 +500,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
500
500
  // 此文件由脚本自动生成,请勿直接修改。
501
501
  // This file was generated automatically by a script. Please do not modify it directly.
502
502
  var _default = exports.default = {
503
- version: '3.5.0-beta.8'
503
+ version: '3.5.0-beta.9'
504
504
  };
package/dist/shineout.js CHANGED
@@ -6535,9 +6535,9 @@ __webpack_require__.d(detect_namespaceObject, {
6535
6535
  });
6536
6536
 
6537
6537
  // NAMESPACE OBJECT: ./src/utils/dom/document.ts
6538
- var dom_document_namespaceObject = {};
6539
- __webpack_require__.r(dom_document_namespaceObject);
6540
- __webpack_require__.d(dom_document_namespaceObject, {
6538
+ var utils_dom_document_namespaceObject = {};
6539
+ __webpack_require__.r(utils_dom_document_namespaceObject);
6540
+ __webpack_require__.d(utils_dom_document_namespaceObject, {
6541
6541
  addEventListener: function() { return addEventListener; },
6542
6542
  docScroll: function() { return document_docScroll; },
6543
6543
  docSize: function() { return document_docSize; }
@@ -6577,7 +6577,7 @@ __webpack_require__.d(src_utils_namespaceObject, {
6577
6577
  cssAccessors: function() { return cssAccessors; },
6578
6578
  cssInject: function() { return cssInject; },
6579
6579
  detect: function() { return detect_namespaceObject; },
6580
- doc: function() { return dom_document_namespaceObject; },
6580
+ doc: function() { return utils_dom_document_namespaceObject; },
6581
6581
  element: function() { return dom_element_namespaceObject; },
6582
6582
  flat: function() { return utils_flat_namespaceObject; },
6583
6583
  func: function() { return utils_func_namespaceObject; },
@@ -11993,7 +11993,7 @@ var handleStyle = function handleStyle(style) {
11993
11993
  };
11994
11994
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11995
11995
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11996
- /* harmony default export */ var version = ('3.5.0-beta.8');
11996
+ /* harmony default export */ var version = ('3.5.0-beta.9');
11997
11997
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11998
11998
 
11999
11999
 
@@ -28465,15 +28465,6 @@ var isFirefox = function isFirefox() {
28465
28465
  if (!is_isBrowser()) return false;
28466
28466
  return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
28467
28467
  };
28468
- var isChromeLowerThan = function isChromeLowerThan(version) {
28469
- // 服务器端渲染时,不执行版本检查
28470
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
28471
- return false;
28472
- }
28473
- var ua = navigator.userAgent;
28474
- var chrome = ua.match(/chrome\/(\d+)/i);
28475
- return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
28476
- };
28477
28468
  function isDomElement(element) {
28478
28469
  return (typeof HTMLElement === "undefined" ? "undefined" : typeof_default()(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
28479
28470
  : element && typeof_default()(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
@@ -29229,6 +29220,50 @@ function shallowEqual(objA, objB) {
29229
29220
  return true;
29230
29221
  }
29231
29222
  /* harmony default export */ var shallow_equal = (shallowEqual);
29223
+ ;// CONCATENATED MODULE: ../hooks/src/utils/dom/document.ts
29224
+ var cachedZoom = 0;
29225
+ var getCurrentCSSZoom = function getCurrentCSSZoom() {
29226
+ if (cachedZoom) return cachedZoom;
29227
+ if (typeof window === 'undefined' || typeof navigator === 'undefined' || !document.body) {
29228
+ return 1;
29229
+ }
29230
+ var currentCSSZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
29231
+ if (window.ResizeObserver) {
29232
+ // 监听document.body的变化,更新缓存的zoom
29233
+ var resizeObserver = new ResizeObserver(function () {
29234
+ cachedZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
29235
+ });
29236
+ resizeObserver.observe(document.body);
29237
+ }
29238
+ cachedZoom = currentCSSZoom;
29239
+ return currentCSSZoom;
29240
+ };
29241
+
29242
+ // export const getZoomBoundingClientRect = (element: HTMLElement) => {
29243
+ // const currentCSSZoom = getCurrentCSSZoom()
29244
+ // if (currentCSSZoom === 1 || !currentCSSZoom) {
29245
+ // return element.getBoundingClientRect()
29246
+ // }
29247
+ // const isNotZoom = currentCSSZoom === 1 || !currentCSSZoom
29248
+
29249
+ // if (isNotZoom) {
29250
+ // return element.getBoundingClientRect()
29251
+ // }
29252
+
29253
+ // const zoomRatio = 1 / currentCSSZoom
29254
+ // const rect = element.getBoundingClientRect()
29255
+
29256
+ // return {
29257
+ // x: rect.x * zoomRatio,
29258
+ // y: rect.y * zoomRatio,
29259
+ // top: rect.top * zoomRatio,
29260
+ // right: rect.right * zoomRatio,
29261
+ // bottom: rect.bottom * zoomRatio,
29262
+ // left: rect.left * zoomRatio,
29263
+ // width: rect.width * zoomRatio,
29264
+ // height: rect.height * zoomRatio,
29265
+ // }
29266
+ // }
29232
29267
  ;// CONCATENATED MODULE: ../hooks/src/common/use-position-style/index.ts
29233
29268
 
29234
29269
 
@@ -29237,6 +29272,7 @@ function shallowEqual(objA, objB) {
29237
29272
 
29238
29273
 
29239
29274
 
29275
+
29240
29276
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
29241
29277
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
29242
29278
  var hideStyle = {
@@ -29473,13 +29509,14 @@ var usePositionStyle = function usePositionStyle(config) {
29473
29509
  };
29474
29510
  };
29475
29511
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
29512
+ var _scrollElRef$current;
29476
29513
  if (!parentElRef.current) return {
29477
29514
  style: hideStyle
29478
29515
  };
29479
29516
  var rect = context.parentRect;
29480
- if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current) {
29481
- var _scrollElRef$current;
29482
- var visibleRect = ((_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.getBoundingClientRect()) || {};
29517
+ if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
29518
+ var _scrollElRef$current2;
29519
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
29483
29520
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
29484
29521
  return {
29485
29522
  style: hideStyle
@@ -29489,15 +29526,8 @@ var usePositionStyle = function usePositionStyle(config) {
29489
29526
  var _getAbsolutePositionS = getAbsolutePositionStyle(rect, position),
29490
29527
  style = _getAbsolutePositionS.style,
29491
29528
  arrayStyle = _getAbsolutePositionS.arrayStyle;
29492
-
29493
- // TODO: 如果是版本大于chrome128,需要根据currentCSSZoom处理chrome的bug
29494
- if (!isChromeLowerThan(128)) {
29495
- // @ts-ignore currentCSSZoom
29496
- var currentCSSZoom = document.body.currentCSSZoom;
29497
- if (currentCSSZoom === 1 || !currentCSSZoom) return {
29498
- style: style,
29499
- arrayStyle: arrayStyle
29500
- };
29529
+ var currentCSSZoom = getCurrentCSSZoom();
29530
+ if (currentCSSZoom && currentCSSZoom !== 1) {
29501
29531
  if (style.left && typeof style.left === 'number') {
29502
29532
  style.left = style.left * (1 / currentCSSZoom);
29503
29533
  }
@@ -66146,7 +66176,7 @@ var upload_interface = __webpack_require__(8821);
66146
66176
 
66147
66177
 
66148
66178
  /* harmony default export */ var src_0 = ({
66149
- version: '3.5.0-beta.8'
66179
+ version: '3.5.0-beta.9'
66150
66180
  });
66151
66181
  }();
66152
66182
  /******/ return __webpack_exports__;