shineout 3.9.16-beta.2 → 3.9.16-beta.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/cjs/index.js CHANGED
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.9.16-beta.2'
525
+ version: '3.9.16-beta.4'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12326,7 +12326,7 @@ var handleStyle = function handleStyle(style) {
12326
12326
  };
12327
12327
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12328
12328
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12329
- /* harmony default export */ var version = ('3.9.16-beta.2');
12329
+ /* harmony default export */ var version = ('3.9.16-beta.4');
12330
12330
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12331
12331
 
12332
12332
 
@@ -22528,7 +22528,9 @@ var replaceCssVarValue = function replaceCssVarValue(innerHTML, cssvar, targetVa
22528
22528
  var regex = new RegExp("(".concat(cssvar, ":.*?;)"));
22529
22529
  // 如果没有 token ,则向后插入新的 token
22530
22530
  if (innerHTML.indexOf(cssvar) === -1) {
22531
- return innerHTML.slice(0, -1) + ";".concat(cssvar, ": ").concat(targetValue, ";") + innerHTML.slice(-1);
22531
+ var before = innerHTML.slice(0, -1);
22532
+ var separator = before.endsWith('{') ? '' : ';';
22533
+ return before + "".concat(separator).concat(cssvar, ": ").concat(targetValue, ";") + innerHTML.slice(-1);
22532
22534
  }
22533
22535
  return innerHTML.replace(regex, "".concat(cssvar, ": ").concat(targetValue, ";"));
22534
22536
  };
@@ -22562,6 +22564,23 @@ var setToken = function setToken(options) {
22562
22564
  var defaultToken = token || token_token;
22563
22565
  var extraToken = getExtraToken(prefix);
22564
22566
  if (update && token) {
22567
+ // 如果标签不存在,先初始化选择器结构并插入 DOM
22568
+ if (!cacheTag) {
22569
+ tag.setAttribute('data-token', tokenName || '');
22570
+ tag.setAttribute('data-token-id', id);
22571
+ tag.setAttribute('data-token-selector', selector);
22572
+ tag.innerHTML = "".concat(selector, " {}");
22573
+ if (!target) {
22574
+ document.head.appendChild(tag);
22575
+ } else if (target instanceof HTMLElement) {
22576
+ target.appendChild(tag);
22577
+ } else if (typeof target === 'string') {
22578
+ var el = document.getElementById(target);
22579
+ if (el instanceof HTMLElement) {
22580
+ el.appendChild(tag);
22581
+ }
22582
+ }
22583
+ }
22565
22584
  Object.keys(token).forEach(function (key) {
22566
22585
  var cssvar = isCustomToken(key) ? key : "--".concat(prefix, "-").concat(camelCaseToDash(key));
22567
22586
  var targetValue = token[key];
@@ -22602,9 +22621,9 @@ var setToken = function setToken(options) {
22602
22621
  return;
22603
22622
  }
22604
22623
  if (typeof target === 'string') {
22605
- var el = document.getElementById(target);
22606
- if (el instanceof HTMLElement) {
22607
- el.appendChild(tag);
22624
+ var _el = document.getElementById(target);
22625
+ if (_el instanceof HTMLElement) {
22626
+ _el.appendChild(tag);
22608
22627
  return;
22609
22628
  }
22610
22629
  }
@@ -32283,7 +32302,16 @@ var usePositionStyle = function usePositionStyle(config) {
32283
32302
  scrollLeft = _getScrollPosition.scrollLeft;
32284
32303
  if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
32285
32304
  var _scrollElRef$current2;
32286
- var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
32305
+ var rawVisibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
32306
+ // 当 scrollElRef 是 html/body 时,若内容全为 fixed 定位,其 getBoundingClientRect 高度会变为 0
32307
+ // 此时应使用 window.innerHeight/innerWidth 作为可视区域判断依据
32308
+ var isDocumentRoot = scrollElRef.current === document.documentElement || scrollElRef.current === document.body;
32309
+ var visibleRect = isDocumentRoot && rawVisibleRect.height === 0 ? {
32310
+ top: 0,
32311
+ left: 0,
32312
+ bottom: window.innerHeight,
32313
+ right: window.innerWidth
32314
+ } : rawVisibleRect;
32287
32315
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
32288
32316
  return {
32289
32317
  style: hideStyle
@@ -76002,7 +76030,7 @@ var upload_interface = __webpack_require__(8821);
76002
76030
 
76003
76031
 
76004
76032
  /* harmony default export */ var src_0 = ({
76005
- version: '3.9.16-beta.2'
76033
+ version: '3.9.16-beta.4'
76006
76034
  });
76007
76035
  }();
76008
76036
  /******/ return __webpack_exports__;