shineout 3.10.4-beta.1 → 3.10.4-beta.2

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
@@ -546,5 +546,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
546
546
  // 此文件由脚本自动生成,请勿直接修改。
547
547
  // This file was generated automatically by a script. Please do not modify it directly.
548
548
  var _default = exports.default = {
549
- version: '3.10.4-beta.1'
549
+ version: '3.10.4-beta.2'
550
550
  };
package/dist/shineout.js CHANGED
@@ -13738,7 +13738,7 @@ var handleStyle = function handleStyle(style) {
13738
13738
  };
13739
13739
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
13740
13740
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
13741
- /* harmony default export */ var version = ('3.10.4-beta.1');
13741
+ /* harmony default export */ var version = ('3.10.4-beta.2');
13742
13742
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
13743
13743
 
13744
13744
 
@@ -24221,13 +24221,9 @@ var setToken = function setToken(options) {
24221
24221
  };
24222
24222
  /* harmony default export */ var token_setter = (setToken);
24223
24223
  ;// CONCATENATED MODULE: ../shineout-style/src/normalize.ts
24224
- // 1. Change from `box-sizing: content-box` so that `width` is not affected by `padding` or `border`.
24225
- // 2. Change the default font family in all browsers.
24226
- // 3. Correct the line height in all browsers.
24227
- // 4. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS.
24228
- // 5. Setting @viewport causes scrollbars to overlap content in IE11 and Edge, so
24229
- // we force a non-overlapping, non-auto-hiding scrollbar to counteract.
24230
- // 6. Change the default tap highlight to be completely transparent in iOS.
24224
+ // 全局基础样式(normalize)与 jss 插入点。
24225
+ // 引入本模块会产生副作用:在浏览器环境下向 document.head 最前面依次插入 normalize 样式和 jss 插入点,
24226
+ // 并通过 setToken 向 html 注入主题 token。
24231
24227
 
24232
24228
 
24233
24229
 
@@ -24235,7 +24231,8 @@ var normalize_token = {
24235
24231
  fontFamily: 'var(--common-body-font-family, PingFang SC, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Helvetica, Hiragino KaKu Gothic Pro, Microsoft YaHei, Arial, sans-serif )',
24236
24232
  color: 'var(--common-body-color, #141737)',
24237
24233
  fontSize: 'var(--font-size-base, 14px)',
24238
- lineHeight: 'var(--common-line-heigh, 1.42857143)',
24234
+ // 变量名与 shineout 1.x / 2.x 保持一致
24235
+ lineHeight: 'var(--common-line-height, 1.42857143)',
24239
24236
  linkColor: CommonToken['Brand-6'],
24240
24237
  linkHoverDecoration: 'none',
24241
24238
  linkDisabledColor: CommonToken['Brand-3'],
@@ -24245,23 +24242,30 @@ var normalize_token = {
24245
24242
  headingsLineHeight: '1.1',
24246
24243
  headingsSmallColor: '#adb5bd'
24247
24244
  };
24248
- var lineHeightComputed = '20px';
24249
- var lineHeightComputed2 = '10px';
24250
- var normalizeStyle = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml {\n font-family: sans-serif;\n line-height: 1.15;\n -ms-overflow-style: scrollbar;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n}\n\narticle,\naside,\ndialog,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nnav,\nsection {\n display: block;\n}\n\nbody {\n margin: 0;\n color: ".concat(normalize_token.color, ";\n font-family: ").concat(normalize_token.fontFamily, ";\n font-size: ").concat(normalize_token.fontSize, ";\n line-height: ").concat(normalize_token.lineHeight, ";\n}\n\n\narticle,\naside,\nfooter,\nheader,\nnav,\nsection {\n display: block;\n}\n\nh1 {\n margin: 0.67em 0;\n font-size: 2em;\n}\n\nfigcaption,\nfigure,\nmain {\n display: block;\n}\n\nfigure {\n margin: 1em 40px;\n}\n\nhr {\n overflow: visible;\n height: 0;\n box-sizing: content-box;\n}\n\npre {\n font-family: \"SFMono-Regular\", Menlo, Monaco, Consolas, \"Courier New\", monospace;\n font-size: 1em;\n}\n\na {\n background-color: transparent;\n color: ").concat(normalize_token.linkColor, ";\n cursor: pointer;\n outline: none;\n text-decoration: ").concat(normalize_token.linkHoverDecoration, ";\n -webkit-text-decoration-skip: objects;\n transition: color 0.3s;\n}\n\na:active,\na:hover {\n color: ").concat(normalize_token.linkColor, ";\n outline: 0;\n text-decoration: ").concat(normalize_token.linkHoverDecoration, ";\n}\na[disabled] {\n color: ").concat(normalize_token.linkDisabledColor, ";\n cursor: not-allowed;\n pointer-events: none;\n}\n\nabbr[title] {\n border-bottom: none;\n text-decoration: underline;\n text-decoration: underline dotted;\n}\n\nb,\nstrong {\n font-weight: inherit;\n}\n\nb,\nstrong {\n font-weight: bolder;\n}\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\ndfn {\n font-style: italic;\n}\n\nmark {\n background-color: #ff0;\n color: #000;\n}\n\nsmall {\n font-size: 80%;\n}\n\nsub,\nsup {\n position: relative;\n font-size: 75%;\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\naudio,\nvideo {\n display: inline-block;\n}\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\nimg {\n border-style: none;\n}\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n margin: 0;\n font-family: inherit;\n font-size: 100%;\n line-height: 1.15;\n}\n\nbutton,\ninput {\n overflow: visible;\n}\n\nbutton,\nselect {\n text-transform: none;\n}\n\nbutton,\nhtml [type=\"button\"],\n[type=\"reset\"],\n[type=\"submit\"] {\n -webkit-appearance: button;\n}\n\nbutton::-moz-focus-inner,\n[type='button']::-moz-focus-inner,\n[type='reset']::-moz-focus-inner,\n[type='submit']::-moz-focus-inner {\n padding: 0;\n border-style: none;\n}\n\nbutton:-moz-focusring,\n[type='button']:-moz-focusring,\n[type='reset']:-moz-focusring,\n[type='submit']:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\nlegend {\n display: table;\n max-width: 100%;\n box-sizing: border-box;\n padding: 0;\n color: inherit;\n white-space: normal;\n}\n\nprogress {\n display: inline-block;\n vertical-align: baseline;\n}\n\ntextarea {\n overflow: auto;\n}\n\n[type='checkbox'],\n[type='radio'] {\n box-sizing: border-box;\n padding: 0;\n}\n\n\n[type='number']::-webkit-inner-spin-button,\n[type='number']::-webkit-outer-spin-button {\n height: auto;\n}\n\n[type='search'] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n\n[type='search']::-webkit-search-cancel-button,\n[type='search']::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n\n::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n\n\ndetails,\nmenu {\n display: block;\n}\n\n\nsummary {\n display: list-item;\n}\n\n\ncanvas {\n display: inline-block;\n}\n\n\ntemplate {\n display: none;\n}\n\n\n[hidden] {\n display: none;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\n.h1,\n.h2,\n.h3,\n.h4,\n.h5,\n.h6 {\n color: ").concat(normalize_token.headingsColor, ";\n font-family: ").concat(normalize_token.headingsFontFamily, ";\n font-weight: ").concat(normalize_token.headingsFontWeight, ";\n line-height: ").concat(normalize_token.headingsLineHeight, ";\n}\nh1 small, h1 .small, .h1 small, .h1 .small,\nh2 small, h2 .small, .h2 small, .h2 .small,\nh3 small, h3 .small, .h3 small, .h3 .small,\nh4 small, h4 .small, .h4 small, .h4 .small,\nh5 small, h5 .small, .h5 small, .h5 .small,\nh6 small, h6 .small, .h6 small, .h6 .small {\n color: ").concat(normalize_token.headingsSmallColor, ";\n font-weight: normal;\n line-height: 1;\n}\n\n\nh1,\n.h1,\nh2,\n.h2,\nh3,\n.h3 {\n margin-top: ").concat(lineHeightComputed, ";\n margin-bottom: ").concat(lineHeightComputed2, ";\n}\n\nhi small, h1 .small, .h1 small, .h1 .small,\nh2 small, h2 .small, .h2 small, .h2 .small,\nh3 small, h3 .small, .h3 small, .h3 .small {\n font-size: 65%;\n}\n\nh4,\n.h4,\nh5,\n.h5,\nh6,\n.h6 {\n margin-top: ").concat(lineHeightComputed2, ";\n margin-bottom: ").concat(lineHeightComputed2, ";\n}\n\nh4 small, h4 .small, .h4 small, .h4 .small,\nh5 small, h5 .small, .h5 small, .h5 .small,\nh6 small, h6 .small, .h6 small, .h6 .small {\n font-size: 75%;\n}\n\np {\n margin: 0 0 ").concat(lineHeightComputed2, ";\n}");
24245
+ var marginLarge = '20px';
24246
+ var marginSmall = '10px';
24247
+ var normalizeStyle = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml {\n font-family: sans-serif;\n line-height: 1.15;\n -ms-overflow-style: scrollbar;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n}\n\narticle,\naside,\ndialog,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nnav,\nsection {\n display: block;\n}\n\nbody {\n margin: 0;\n color: ".concat(normalize_token.color, ";\n font-family: ").concat(normalize_token.fontFamily, ";\n font-size: ").concat(normalize_token.fontSize, ";\n line-height: ").concat(normalize_token.lineHeight, ";\n}\n\nh1 {\n margin: 0.67em 0;\n font-size: 2em;\n}\n\nfigure {\n margin: 1em 40px;\n}\n\nhr {\n overflow: visible;\n height: 0;\n box-sizing: content-box;\n}\n\npre {\n font-family: \"SFMono-Regular\", Menlo, Monaco, Consolas, \"Courier New\", monospace;\n font-size: 1em;\n}\n\na {\n background-color: transparent;\n color: ").concat(normalize_token.linkColor, ";\n cursor: pointer;\n outline: none;\n text-decoration: ").concat(normalize_token.linkHoverDecoration, ";\n -webkit-text-decoration-skip: objects;\n transition: color 0.3s;\n}\n\na:active,\na:hover {\n color: ").concat(normalize_token.linkColor, ";\n outline: 0;\n text-decoration: ").concat(normalize_token.linkHoverDecoration, ";\n}\na[disabled] {\n color: ").concat(normalize_token.linkDisabledColor, ";\n cursor: not-allowed;\n pointer-events: none;\n}\n\nabbr[title] {\n border-bottom: none;\n text-decoration: underline;\n text-decoration: underline dotted;\n}\n\nb,\nstrong {\n font-weight: bolder;\n}\n\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace;\n font-size: 1em;\n}\n\ndfn {\n font-style: italic;\n}\n\nmark {\n background-color: #ff0;\n color: #000;\n}\n\nsmall {\n font-size: 80%;\n}\n\nsub,\nsup {\n position: relative;\n font-size: 75%;\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\naudio,\nvideo {\n display: inline-block;\n}\n\naudio:not([controls]) {\n display: none;\n height: 0;\n}\n\nimg {\n border-style: none;\n}\n\nsvg:not(:root) {\n overflow: hidden;\n}\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n margin: 0;\n font-family: inherit;\n font-size: 100%;\n line-height: 1.15;\n}\n\nbutton,\ninput {\n overflow: visible;\n}\n\nbutton,\nselect {\n text-transform: none;\n}\n\nbutton,\nhtml [type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button;\n}\n\nbutton::-moz-focus-inner,\n[type='button']::-moz-focus-inner,\n[type='reset']::-moz-focus-inner,\n[type='submit']::-moz-focus-inner {\n padding: 0;\n border-style: none;\n}\n\nbutton:-moz-focusring,\n[type='button']:-moz-focusring,\n[type='reset']:-moz-focusring,\n[type='submit']:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\nfieldset {\n padding: 0.35em 0.75em 0.625em;\n}\n\nlegend {\n display: table;\n max-width: 100%;\n box-sizing: border-box;\n padding: 0;\n color: inherit;\n white-space: normal;\n}\n\nprogress {\n display: inline-block;\n vertical-align: baseline;\n}\n\ntextarea {\n overflow: auto;\n}\n\n[type='checkbox'],\n[type='radio'] {\n box-sizing: border-box;\n padding: 0;\n}\n\n[type='number']::-webkit-inner-spin-button,\n[type='number']::-webkit-outer-spin-button {\n height: auto;\n}\n\n[type='search'] {\n -webkit-appearance: textfield;\n outline-offset: -2px;\n}\n\n[type='search']::-webkit-search-cancel-button,\n[type='search']::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n::-webkit-file-upload-button {\n -webkit-appearance: button;\n font: inherit;\n}\n\ndetails,\nmenu {\n display: block;\n}\n\nsummary {\n display: list-item;\n}\n\ncanvas {\n display: inline-block;\n}\n\ntemplate {\n display: none;\n}\n\n[hidden] {\n display: none;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\n.h1,\n.h2,\n.h3,\n.h4,\n.h5,\n.h6 {\n color: ").concat(normalize_token.headingsColor, ";\n font-family: ").concat(normalize_token.headingsFontFamily, ";\n font-weight: ").concat(normalize_token.headingsFontWeight, ";\n line-height: ").concat(normalize_token.headingsLineHeight, ";\n}\nh1 small, h1 .small, .h1 small, .h1 .small,\nh2 small, h2 .small, .h2 small, .h2 .small,\nh3 small, h3 .small, .h3 small, .h3 .small,\nh4 small, h4 .small, .h4 small, .h4 .small,\nh5 small, h5 .small, .h5 small, .h5 .small,\nh6 small, h6 .small, .h6 small, .h6 .small {\n color: ").concat(normalize_token.headingsSmallColor, ";\n font-weight: normal;\n line-height: 1;\n}\n\nh1,\n.h1,\nh2,\n.h2,\nh3,\n.h3 {\n margin-top: ").concat(marginLarge, ";\n margin-bottom: ").concat(marginSmall, ";\n}\n\nh1 small, h1 .small, .h1 small, .h1 .small,\nh2 small, h2 .small, .h2 small, .h2 .small,\nh3 small, h3 .small, .h3 small, .h3 .small {\n font-size: 65%;\n}\n\nh4,\n.h4,\nh5,\n.h5,\nh6,\n.h6 {\n margin-top: ").concat(marginSmall, ";\n margin-bottom: ").concat(marginSmall, ";\n}\n\nh4 small, h4 .small, .h4 small, .h4 .small,\nh5 small, h5 .small, .h5 small, .h5 .small,\nh6 small, h6 .small, .h6 small, .h6 .small {\n font-size: 75%;\n}\n\np {\n margin: 0 0 ").concat(marginSmall, ";\n}");
24251
24248
  var normalizeStyleId = 'shineout-next-normalize__' + version;
24252
24249
  var jssInsertionPointId = 'shineout-next-jss-insertion-point__' + version;
24253
- function appendNormalizeStyle(styleString, id) {
24250
+
24251
+ // 创建带标识的 style 节点,并插入到 head 最前面
24252
+ function insertStyleElement(id, cssText) {
24254
24253
  var style = document.createElement('style');
24255
24254
  style.setAttribute('name', id);
24256
24255
  style.setAttribute('data-alita-ignore', 'true');
24257
- style.innerHTML = styleString;
24256
+ if (cssText !== undefined) style.textContent = cssText;
24258
24257
  document.head.insertBefore(style, document.head.firstChild);
24258
+ return style;
24259
+ }
24260
+
24261
+ // 当前模块实例自己创建的 normalize 节点。
24262
+ // 同一页面里多份 bundle(如嵌入插件与业务项目)版本相同时节点同名,不能按名字查找,否则可能误改对方的节点
24263
+ var normalizeStyleElement = null;
24264
+ function appendNormalizeStyle(styleString, id) {
24265
+ normalizeStyleElement = insertStyleElement(id, styleString);
24259
24266
  }
24260
24267
  function appendJssInsertionPoint() {
24261
- var insertionPoint = document.createElement('style');
24262
- insertionPoint.setAttribute('name', jssInsertionPointId);
24263
- insertionPoint.setAttribute('data-alita-ignore', 'true');
24264
- document.head.insertBefore(insertionPoint, document.head.firstChild);
24268
+ var insertionPoint = insertStyleElement(jssInsertionPointId);
24265
24269
  react_jss_esm_defaultJss.setup({
24266
24270
  insertionPoint: insertionPoint
24267
24271
  });
@@ -24270,37 +24274,42 @@ if (typeof window !== 'undefined') {
24270
24274
  appendJssInsertionPoint();
24271
24275
  appendNormalizeStyle(normalizeStyle, normalizeStyleId);
24272
24276
  }
24277
+
24278
+ // html / body 作为根选择器时替换为 prefix,其余选择器统一加前缀
24279
+ var scopeSelector = function scopeSelector(selector, prefix) {
24280
+ var trimmed = selector.trim();
24281
+ var root = /^(html|body)(?![\w-])/.exec(trimmed);
24282
+ return root ? prefix + trimmed.slice(root[0].length) : "".concat(prefix, " ").concat(trimmed);
24283
+ };
24273
24284
  var scopeNormalizeStyle = function scopeNormalizeStyle() {
24285
+ var _sourceElement$sheet, _styleElement$parentN;
24274
24286
  var csScopePrefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#app';
24275
- var styleElement = document.querySelector("style[name=\"".concat(normalizeStyleId, "\"]"));
24276
- // 移除styleElement
24277
-
24278
- var styleSheet = styleElement === null || styleElement === void 0 ? void 0 : styleElement.sheet;
24279
- var cssRules = styleSheet === null || styleSheet === void 0 ? void 0 : styleSheet.cssRules;
24280
- // 遍历cssRules,给每一个selectorText添加前缀
24287
+ if (typeof document === 'undefined') return;
24288
+ var styleElement = normalizeStyleElement;
24289
+ if (!styleElement || !styleElement.isConnected) return;
24290
+
24291
+ // 始终基于原始 normalizeStyle 重新生成,而不是在已加过前缀的样式上再加一次,保证重复调用结果一致
24292
+ var sourceElement = document.createElement('style');
24293
+ sourceElement.textContent = normalizeStyle;
24294
+ document.head.appendChild(sourceElement);
24295
+ var cssRules = (_sourceElement$sheet = sourceElement.sheet) === null || _sourceElement$sheet === void 0 ? void 0 : _sourceElement$sheet.cssRules;
24281
24296
  if (cssRules) {
24282
24297
  for (var i = 0; i < cssRules.length; i++) {
24283
24298
  var rule = cssRules[i];
24284
24299
  if (rule instanceof CSSStyleRule) {
24285
- // 如果选择器包含了body或html,则替换,不是加前缀
24286
- if (rule.selectorText.includes('body')) {
24287
- rule.selectorText = rule.selectorText.replace('body', csScopePrefix);
24288
- } else if (rule.selectorText.includes('html')) {
24289
- rule.selectorText = rule.selectorText.replace('html', csScopePrefix);
24290
- } else {
24291
- var selectors = rule.selectorText.split(',');
24292
- var newSelectors = selectors.map(function (selector) {
24293
- return "".concat(csScopePrefix, " ").concat(selector);
24294
- });
24295
- rule.selectorText = newSelectors.join(',');
24296
- }
24300
+ // 逐个选择器处理,同一条规则里混有 html / body 与其他选择器时也都能正确加前缀
24301
+ rule.selectorText = rule.selectorText.split(',').map(function (selector) {
24302
+ return scopeSelector(selector, csScopePrefix);
24303
+ }).join(',');
24297
24304
  }
24298
24305
  }
24299
24306
  }
24300
24307
  var scopedStyleString = cssRules ? Array.from(cssRules).map(function (rule) {
24301
24308
  return rule.cssText;
24302
24309
  }).join('') : '';
24303
- document.head.removeChild(styleElement);
24310
+ document.head.removeChild(sourceElement);
24311
+ // 移除旧的 styleElement,用加了前缀的样式替换
24312
+ (_styleElement$parentN = styleElement.parentNode) === null || _styleElement$parentN === void 0 || _styleElement$parentN.removeChild(styleElement);
24304
24313
  appendNormalizeStyle(scopedStyleString, normalizeStyleId);
24305
24314
  };
24306
24315
  token_setter({
@@ -80478,7 +80487,7 @@ var watermark_interface = __webpack_require__(6640);
80478
80487
 
80479
80488
 
80480
80489
  /* harmony default export */ var src_0 = ({
80481
- version: '3.10.4-beta.1'
80490
+ version: '3.10.4-beta.2'
80482
80491
  });
80483
80492
  }();
80484
80493
  /******/ return __webpack_exports__;