shineout 3.10.3 → 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.3'
549
+ version: '3.10.4-beta.2'
550
550
  };
package/dist/shineout.js CHANGED
@@ -3274,7 +3274,8 @@ const figma = [
3274
3274
  },
3275
3275
  {
3276
3276
  name: 'backgroundPopup',
3277
- value: '#FFFFFF',
3277
+ value: 'Neutral-fill-1',
3278
+ // value: 'var(--soui-neutral-fill-1)',
3278
3279
  describe: '浮层容器背景色',
3279
3280
  token: 'Background-popup',
3280
3281
  locked: false,
@@ -13737,7 +13738,7 @@ var handleStyle = function handleStyle(style) {
13737
13738
  };
13738
13739
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
13739
13740
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
13740
- /* harmony default export */ var version = ('3.10.3');
13741
+ /* harmony default export */ var version = ('3.10.4-beta.2');
13741
13742
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
13742
13743
 
13743
13744
 
@@ -13978,7 +13979,7 @@ var Token = {
13978
13979
  'Brand-8': '#0040AD',
13979
13980
  'Brand-9': '#002D87',
13980
13981
  'Background-layout': '#F4F5F8',
13981
- 'Background-popup': '#FFFFFF',
13982
+ 'Background-popup': 'Neutral-fill-1',
13982
13983
  'Cyan-1': '#e8fffb',
13983
13984
  'Cyan-10': '#00424d',
13984
13985
  'Cyan-2': '#b7f1e9',
@@ -14275,8 +14276,45 @@ Object.keys(Token).forEach(function (key) {
14275
14276
  });
14276
14277
 
14277
14278
  /* harmony default export */ var token_token = (Token);
14279
+ ;// CONCATENATED MODULE: ../theme/src/utils/token-alias.ts
14280
+
14281
+
14282
+
14283
+ // 别名链的最大层数,超出视为配置错误
14284
+ var MAX_DEPTH = 5;
14285
+
14286
+ /**
14287
+ * token 的值可以直接写成另一个 token 的名称(如 'Neutral-fill-1'),
14288
+ * 解析为对该 token 的 css 变量引用,并以被引用 token 的实际值作为回退:
14289
+ * 'Neutral-fill-1' => var(--soui-neutral-fill-1,#FFFFFF)
14290
+ *
14291
+ * - 不是 token 名称的值(如 '#FFFFFF'、'transparent')原样返回
14292
+ * - lookup 返回非字符串(含 Object.prototype 上的属性)视为不是 token 名称
14293
+ * - 别名链循环或超过 MAX_DEPTH 层时无法解析,原样返回并在开发环境告警
14294
+ */
14295
+ var resolveTokenAlias = function resolveTokenAlias(value, lookup) {
14296
+ var chain = [];
14297
+ var current = value;
14298
+ var target = lookup(current);
14299
+ while (typeof target === 'string') {
14300
+ if (chain.includes(current) || chain.length >= MAX_DEPTH) {
14301
+ if (false) {}
14302
+ return value;
14303
+ }
14304
+ chain.push(current);
14305
+ current = target;
14306
+ target = lookup(current);
14307
+ }
14308
+ if (!chain.length) return value;
14309
+ var _getConfig = getConfig(),
14310
+ prefix = _getConfig.prefix;
14311
+ return chain.reduceRight(function (fallback, name) {
14312
+ return "var(--".concat(prefix, "-").concat(replaceNonAlphanumeric(name), ",").concat(fallback, ")");
14313
+ }, current);
14314
+ };
14278
14315
  ;// CONCATENATED MODULE: ../theme/src/token/index.ts
14279
14316
 
14317
+
14280
14318
  var _require = __webpack_require__(297),
14281
14319
  figma = _require.figma,
14282
14320
  compile = _require.compile;
@@ -14297,7 +14335,11 @@ var tokenToVars = function tokenToVars(componentToken, tokens) {
14297
14335
  var _TOKEN$tokenKey;
14298
14336
  var Key = key;
14299
14337
  var tokenKey = componentToken[Key];
14300
- token[Key] = cssvar(tokenKey, ((_TOKEN$tokenKey = TOKEN[tokenKey]) === null || _TOKEN$tokenKey === void 0 ? void 0 : _TOKEN$tokenKey.value) || tokenKey, key, SIZE);
14338
+ var value = resolveTokenAlias(((_TOKEN$tokenKey = TOKEN[tokenKey]) === null || _TOKEN$tokenKey === void 0 ? void 0 : _TOKEN$tokenKey.value) || tokenKey, function (name) {
14339
+ var _TOKEN$name;
14340
+ return (_TOKEN$name = TOKEN[name]) === null || _TOKEN$name === void 0 ? void 0 : _TOKEN$name.value;
14341
+ });
14342
+ token[Key] = cssvar(tokenKey, value, key, SIZE);
14301
14343
  });
14302
14344
  return token;
14303
14345
  };
@@ -15085,7 +15127,8 @@ var common = {
15085
15127
  defaultBorder: 'Border-1',
15086
15128
  iconCirclePadding: 'Padding-4',
15087
15129
  transparent: 'transparent',
15088
- backgroundPopup: 'Background-popup',
15130
+ // 未设置 Background-popup 时回退到 Neutral-fill-1,兼容仅覆盖 Neutral-fill-* 的暗黑主题
15131
+ backgroundPopup: 'Neutral-fill-1',
15089
15132
  backgroundLayout: 'Background-layout'
15090
15133
  };
15091
15134
  /* harmony default export */ var common_common = (common);
@@ -24063,6 +24106,7 @@ function createHash(obj) {
24063
24106
 
24064
24107
 
24065
24108
 
24109
+
24066
24110
  var getExtraToken = function getExtraToken(prefix) {
24067
24111
  return ["--primary-color: var(--".concat(prefix, "-brand-6)"), "--gray-500: var(--".concat(prefix, "-neutral-6)"), "--primary-color-fade-50: rgba(25,122,250,0.5)"];
24068
24112
  };
@@ -24076,6 +24120,11 @@ var replaceCssVarValue = function replaceCssVarValue(innerHTML, cssvar, targetVa
24076
24120
  }
24077
24121
  return innerHTML.replace(regex, "".concat(cssvar, ": ").concat(targetValue, ";"));
24078
24122
  };
24123
+ var resolveValue = function resolveValue(value) {
24124
+ return typeof value === 'string' ? resolveTokenAlias(value, function (name) {
24125
+ return token_token[name];
24126
+ }) : value;
24127
+ };
24079
24128
  var isCustomToken = function isCustomToken(key) {
24080
24129
  if (key.startsWith('--')) return true;
24081
24130
  return false;
@@ -24125,7 +24174,7 @@ var setToken = function setToken(options) {
24125
24174
  }
24126
24175
  Object.keys(token).forEach(function (key) {
24127
24176
  var cssvar = isCustomToken(key) ? key : "--".concat(prefix, "-").concat(camelCaseToDash(key));
24128
- var targetValue = token[key];
24177
+ var targetValue = resolveValue(token[key]);
24129
24178
  tag.innerHTML = replaceCssVarValue(tag.innerHTML, cssvar, targetValue);
24130
24179
  });
24131
24180
  return;
@@ -24135,13 +24184,13 @@ var setToken = function setToken(options) {
24135
24184
  return (customExtraToken || ['Brand-6', 'Neutral-6']).includes(item);
24136
24185
  }).forEach(function (key) {
24137
24186
  var cssvar = isCustomToken(key) ? key : "--".concat(prefix, "-").concat(camelCaseToDash(key));
24138
- var token = "".concat(cssvar, ":").concat(defaultToken[key]);
24187
+ var token = "".concat(cssvar, ":").concat(resolveValue(defaultToken[key]));
24139
24188
  tokens.push(token);
24140
24189
  });
24141
24190
  } else {
24142
24191
  Object.keys(defaultToken).forEach(function (key) {
24143
24192
  var cssvar = isCustomToken(key) ? key : "--".concat(prefix, "-").concat(camelCaseToDash(key));
24144
- var token = "".concat(cssvar, ":").concat(defaultToken[key]);
24193
+ var token = "".concat(cssvar, ":").concat(resolveValue(defaultToken[key]));
24145
24194
  tokens.push(token);
24146
24195
  });
24147
24196
  }
@@ -24172,13 +24221,9 @@ var setToken = function setToken(options) {
24172
24221
  };
24173
24222
  /* harmony default export */ var token_setter = (setToken);
24174
24223
  ;// CONCATENATED MODULE: ../shineout-style/src/normalize.ts
24175
- // 1. Change from `box-sizing: content-box` so that `width` is not affected by `padding` or `border`.
24176
- // 2. Change the default font family in all browsers.
24177
- // 3. Correct the line height in all browsers.
24178
- // 4. Prevent adjustments of font size after orientation changes in IE on Windows Phone and in iOS.
24179
- // 5. Setting @viewport causes scrollbars to overlap content in IE11 and Edge, so
24180
- // we force a non-overlapping, non-auto-hiding scrollbar to counteract.
24181
- // 6. Change the default tap highlight to be completely transparent in iOS.
24224
+ // 全局基础样式(normalize)与 jss 插入点。
24225
+ // 引入本模块会产生副作用:在浏览器环境下向 document.head 最前面依次插入 normalize 样式和 jss 插入点,
24226
+ // 并通过 setToken 向 html 注入主题 token。
24182
24227
 
24183
24228
 
24184
24229
 
@@ -24186,7 +24231,8 @@ var normalize_token = {
24186
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 )',
24187
24232
  color: 'var(--common-body-color, #141737)',
24188
24233
  fontSize: 'var(--font-size-base, 14px)',
24189
- lineHeight: 'var(--common-line-heigh, 1.42857143)',
24234
+ // 变量名与 shineout 1.x / 2.x 保持一致
24235
+ lineHeight: 'var(--common-line-height, 1.42857143)',
24190
24236
  linkColor: CommonToken['Brand-6'],
24191
24237
  linkHoverDecoration: 'none',
24192
24238
  linkDisabledColor: CommonToken['Brand-3'],
@@ -24196,23 +24242,30 @@ var normalize_token = {
24196
24242
  headingsLineHeight: '1.1',
24197
24243
  headingsSmallColor: '#adb5bd'
24198
24244
  };
24199
- var lineHeightComputed = '20px';
24200
- var lineHeightComputed2 = '10px';
24201
- 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}");
24202
24248
  var normalizeStyleId = 'shineout-next-normalize__' + version;
24203
24249
  var jssInsertionPointId = 'shineout-next-jss-insertion-point__' + version;
24204
- function appendNormalizeStyle(styleString, id) {
24250
+
24251
+ // 创建带标识的 style 节点,并插入到 head 最前面
24252
+ function insertStyleElement(id, cssText) {
24205
24253
  var style = document.createElement('style');
24206
24254
  style.setAttribute('name', id);
24207
24255
  style.setAttribute('data-alita-ignore', 'true');
24208
- style.innerHTML = styleString;
24256
+ if (cssText !== undefined) style.textContent = cssText;
24209
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);
24210
24266
  }
24211
24267
  function appendJssInsertionPoint() {
24212
- var insertionPoint = document.createElement('style');
24213
- insertionPoint.setAttribute('name', jssInsertionPointId);
24214
- insertionPoint.setAttribute('data-alita-ignore', 'true');
24215
- document.head.insertBefore(insertionPoint, document.head.firstChild);
24268
+ var insertionPoint = insertStyleElement(jssInsertionPointId);
24216
24269
  react_jss_esm_defaultJss.setup({
24217
24270
  insertionPoint: insertionPoint
24218
24271
  });
@@ -24221,37 +24274,42 @@ if (typeof window !== 'undefined') {
24221
24274
  appendJssInsertionPoint();
24222
24275
  appendNormalizeStyle(normalizeStyle, normalizeStyleId);
24223
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
+ };
24224
24284
  var scopeNormalizeStyle = function scopeNormalizeStyle() {
24285
+ var _sourceElement$sheet, _styleElement$parentN;
24225
24286
  var csScopePrefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '#app';
24226
- var styleElement = document.querySelector("style[name=\"".concat(normalizeStyleId, "\"]"));
24227
- // 移除styleElement
24228
-
24229
- var styleSheet = styleElement === null || styleElement === void 0 ? void 0 : styleElement.sheet;
24230
- var cssRules = styleSheet === null || styleSheet === void 0 ? void 0 : styleSheet.cssRules;
24231
- // 遍历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;
24232
24296
  if (cssRules) {
24233
24297
  for (var i = 0; i < cssRules.length; i++) {
24234
24298
  var rule = cssRules[i];
24235
24299
  if (rule instanceof CSSStyleRule) {
24236
- // 如果选择器包含了body或html,则替换,不是加前缀
24237
- if (rule.selectorText.includes('body')) {
24238
- rule.selectorText = rule.selectorText.replace('body', csScopePrefix);
24239
- } else if (rule.selectorText.includes('html')) {
24240
- rule.selectorText = rule.selectorText.replace('html', csScopePrefix);
24241
- } else {
24242
- var selectors = rule.selectorText.split(',');
24243
- var newSelectors = selectors.map(function (selector) {
24244
- return "".concat(csScopePrefix, " ").concat(selector);
24245
- });
24246
- rule.selectorText = newSelectors.join(',');
24247
- }
24300
+ // 逐个选择器处理,同一条规则里混有 html / body 与其他选择器时也都能正确加前缀
24301
+ rule.selectorText = rule.selectorText.split(',').map(function (selector) {
24302
+ return scopeSelector(selector, csScopePrefix);
24303
+ }).join(',');
24248
24304
  }
24249
24305
  }
24250
24306
  }
24251
24307
  var scopedStyleString = cssRules ? Array.from(cssRules).map(function (rule) {
24252
24308
  return rule.cssText;
24253
24309
  }).join('') : '';
24254
- 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);
24255
24313
  appendNormalizeStyle(scopedStyleString, normalizeStyleId);
24256
24314
  };
24257
24315
  token_setter({
@@ -78085,6 +78143,7 @@ var src_config_setConfig = function setConfig(option) {
78085
78143
 
78086
78144
 
78087
78145
 
78146
+
78088
78147
  var use_token_require = __webpack_require__(297),
78089
78148
  use_token_figma = use_token_require.figma;
78090
78149
  var useToken = function useToken(props) {
@@ -78099,7 +78158,10 @@ var useToken = function useToken(props) {
78099
78158
  });
78100
78159
  var colorToken = {};
78101
78160
  unLockedToken.forEach(function (i) {
78102
- var k = "var(--".concat(prefix, "-").concat(replaceNonAlphanumeric(i.token), ",").concat(i.value, ")");
78161
+ var value = resolveTokenAlias(i.value, function (name) {
78162
+ return token_token[name];
78163
+ });
78164
+ var k = "var(--".concat(prefix, "-").concat(replaceNonAlphanumeric(i.token), ",").concat(value, ")");
78103
78165
  colorToken[i.name] = k;
78104
78166
  });
78105
78167
  if (tokenProps) {
@@ -80425,7 +80487,7 @@ var watermark_interface = __webpack_require__(6640);
80425
80487
 
80426
80488
 
80427
80489
  /* harmony default export */ var src_0 = ({
80428
- version: '3.10.3'
80490
+ version: '3.10.4-beta.2'
80429
80491
  });
80430
80492
  }();
80431
80493
  /******/ return __webpack_exports__;