shineout 3.10.3-beta.6 → 3.10.3-beta.8
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/config.d.ts +2 -0
- package/cjs/config.js +20 -0
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +4 -3
- package/cjs/message/preload-style.d.ts +1 -0
- package/cjs/message/preload-style.js +33 -0
- package/dist/shineout.js +77 -18
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/config.d.ts +2 -0
- package/esm/config.js +15 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +3 -2
- package/esm/message/preload-style.d.ts +1 -0
- package/esm/message/preload-style.js +24 -0
- package/package.json +5 -5
package/cjs/config.d.ts
ADDED
package/cjs/config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setConfig = void 0;
|
|
7
|
+
var _base = require("@sheinx/base");
|
|
8
|
+
var _shineoutStyle = require("@sheinx/shineout-style");
|
|
9
|
+
var _preloadStyle = require("./message/preload-style");
|
|
10
|
+
// 样式相关的配置由 shineout-style 处理,base 不依赖 shineout-style,在这里转发
|
|
11
|
+
var setConfig = exports.setConfig = function setConfig(option) {
|
|
12
|
+
(0, _base.setConfig)(option);
|
|
13
|
+
if (option && 'keepStyleSheet' in option) {
|
|
14
|
+
(0, _shineoutStyle.setJssConfig)({
|
|
15
|
+
keepStyleSheet: !!option.keepStyleSheet
|
|
16
|
+
});
|
|
17
|
+
// 和 normalize 一样在初始化时插入 Message 样式,避免第一次弹出时的开销
|
|
18
|
+
if (option.keepStyleSheet) (0, _preloadStyle.preloadMessageStyle)();
|
|
19
|
+
}
|
|
20
|
+
};
|
package/cjs/index.d.ts
CHANGED
|
@@ -51,7 +51,8 @@ export { default as Tree } from './tree';
|
|
|
51
51
|
export { default as TreeSelect } from './tree-select';
|
|
52
52
|
export { default as Upload } from './upload';
|
|
53
53
|
export { default as Watermark } from './watermark';
|
|
54
|
-
export {
|
|
54
|
+
export { config, setLocale, setIcons, icons } from '@sheinx/base';
|
|
55
|
+
export { setConfig } from './config';
|
|
55
56
|
export type { ConfigOption } from '@sheinx/base';
|
|
56
57
|
export { setToken, useToken } from '@sheinx/theme';
|
|
57
58
|
export { default as Tokens } from '@sheinx/theme';
|
package/cjs/index.js
CHANGED
|
@@ -59,11 +59,11 @@ var _exportNames = {
|
|
|
59
59
|
TreeSelect: true,
|
|
60
60
|
Upload: true,
|
|
61
61
|
Watermark: true,
|
|
62
|
-
setConfig: true,
|
|
63
62
|
config: true,
|
|
64
63
|
setLocale: true,
|
|
65
64
|
setIcons: true,
|
|
66
65
|
icons: true,
|
|
66
|
+
setConfig: true,
|
|
67
67
|
setToken: true,
|
|
68
68
|
useToken: true,
|
|
69
69
|
Tokens: true,
|
|
@@ -433,7 +433,7 @@ Object.defineProperty(exports, "scopeNormalizeStyle", {
|
|
|
433
433
|
Object.defineProperty(exports, "setConfig", {
|
|
434
434
|
enumerable: true,
|
|
435
435
|
get: function get() {
|
|
436
|
-
return
|
|
436
|
+
return _config.setConfig;
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
Object.defineProperty(exports, "setIcons", {
|
|
@@ -521,6 +521,7 @@ var _treeSelect = _interopRequireDefault(require("./tree-select"));
|
|
|
521
521
|
var _upload = _interopRequireDefault(require("./upload"));
|
|
522
522
|
var _watermark = _interopRequireDefault(require("./watermark"));
|
|
523
523
|
var _base = require("@sheinx/base");
|
|
524
|
+
var _config = require("./config");
|
|
524
525
|
var _theme = _interopRequireWildcard(require("@sheinx/theme"));
|
|
525
526
|
var _shineoutStyle = require("@sheinx/shineout-style");
|
|
526
527
|
var _utils = _interopRequireWildcard(require("./utils"));
|
|
@@ -545,5 +546,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
545
546
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
546
547
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
547
548
|
var _default = exports.default = {
|
|
548
|
-
version: '3.10.3-beta.
|
|
549
|
+
version: '3.10.3-beta.8'
|
|
549
550
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const preloadMessageStyle: () => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.preloadMessageStyle = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _hooks = require("@sheinx/hooks");
|
|
10
|
+
var _shineoutStyle = require("@sheinx/shineout-style");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
var preloaded = false;
|
|
15
|
+
|
|
16
|
+
// 挂载一次 Message 用到的样式 hook 后立即卸载,配合 keepStyleSheet 让样式表常驻
|
|
17
|
+
// 这样第一次弹出 Message 时不用在点击回调里插入样式表
|
|
18
|
+
var Preload = function Preload(props) {
|
|
19
|
+
(0, _shineoutStyle.useMessageStyle)();
|
|
20
|
+
(0, _shineoutStyle.useAlertStyle)();
|
|
21
|
+
(0, _react.useEffect)(function () {
|
|
22
|
+
_hooks.util.ReactUnmount(props.container);
|
|
23
|
+
}, []);
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
var preloadMessageStyle = exports.preloadMessageStyle = function preloadMessageStyle() {
|
|
27
|
+
if (preloaded || typeof document === 'undefined') return;
|
|
28
|
+
preloaded = true;
|
|
29
|
+
var container = document.createElement('div');
|
|
30
|
+
_hooks.util.ReactRender( /*#__PURE__*/(0, _jsxRuntime.jsx)(Preload, {
|
|
31
|
+
container: container
|
|
32
|
+
}), container);
|
|
33
|
+
};
|
package/dist/shineout.js
CHANGED
|
@@ -6470,7 +6470,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
6470
6470
|
"default": function() { return /* binding */ src_0; },
|
|
6471
6471
|
icons: function() { return /* reexport */ icons; },
|
|
6472
6472
|
scopeNormalizeStyle: function() { return /* reexport */ scopeNormalizeStyle; },
|
|
6473
|
-
setConfig: function() { return /* reexport */
|
|
6473
|
+
setConfig: function() { return /* reexport */ src_config_setConfig; },
|
|
6474
6474
|
setIcons: function() { return /* reexport */ setIcons; },
|
|
6475
6475
|
setJssConfig: function() { return /* reexport */ setJssConfig; },
|
|
6476
6476
|
setLocale: function() { return /* reexport */ setLocale; },
|
|
@@ -8723,7 +8723,8 @@ var defaultConfig = {
|
|
|
8723
8723
|
avatar: {},
|
|
8724
8724
|
direction: 'ltr',
|
|
8725
8725
|
popupContainer: null,
|
|
8726
|
-
popupEsc: true
|
|
8726
|
+
popupEsc: true,
|
|
8727
|
+
keepStyleSheet: false
|
|
8727
8728
|
};
|
|
8728
8729
|
var state = createWithHooks(defaultConfig);
|
|
8729
8730
|
var config_config = snapshot(state.mutate);
|
|
@@ -8743,7 +8744,7 @@ function getDefaultContainer() {
|
|
|
8743
8744
|
var useConfig = function useConfig() {
|
|
8744
8745
|
return state.useSnapshot();
|
|
8745
8746
|
};
|
|
8746
|
-
var
|
|
8747
|
+
var config_setConfig = function setConfig(option) {
|
|
8747
8748
|
for (var _i = 0, _Object$entries = Object.entries(option); _i < _Object$entries.length; _i++) {
|
|
8748
8749
|
var _Object$entries$_i = slicedToArray_default()(_Object$entries[_i], 2),
|
|
8749
8750
|
key = _Object$entries$_i[0],
|
|
@@ -13736,7 +13737,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
13736
13737
|
};
|
|
13737
13738
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
13738
13739
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
13739
|
-
/* harmony default export */ var version = ('3.10.3-beta.
|
|
13740
|
+
/* harmony default export */ var version = ('3.10.3-beta.8');
|
|
13740
13741
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
13741
13742
|
|
|
13742
13743
|
|
|
@@ -13751,6 +13752,23 @@ var setJssConfig = function setJssConfig(newConfig) {
|
|
|
13751
13752
|
var getJssConfig = function getJssConfig() {
|
|
13752
13753
|
return jss_style_config;
|
|
13753
13754
|
};
|
|
13755
|
+
|
|
13756
|
+
// react-jss 在样式表引用计数归零时会 detach,把 style 标签移出文档,下次挂载再插回
|
|
13757
|
+
// 每次插入/移除样式表都会让浏览器重新处理整套样式(Message、Modal.confirm 这类每次打开都新建 root 的组件尤其明显,拖慢 INP)
|
|
13758
|
+
// 开启 keepStyleSheet 后跳过 detach,类名带版本哈希,常驻不会影响其它元素
|
|
13759
|
+
var shineoutElements = new WeakSet();
|
|
13760
|
+
var keepStyleSheetPlugin = {
|
|
13761
|
+
onProcessSheet: function onProcessSheet(sheet) {
|
|
13762
|
+
if (!sheet) return;
|
|
13763
|
+
var element = sheet.options.element;
|
|
13764
|
+
if (!element || !shineoutElements.has(element)) return;
|
|
13765
|
+
var detach = sheet.detach.bind(sheet);
|
|
13766
|
+
sheet.detach = function () {
|
|
13767
|
+
return jss_style_config.keepStyleSheet ? sheet : detach();
|
|
13768
|
+
};
|
|
13769
|
+
}
|
|
13770
|
+
};
|
|
13771
|
+
react_jss_esm_defaultJss.use(keepStyleSheetPlugin);
|
|
13754
13772
|
var stringToHash = function stringToHash(str) {
|
|
13755
13773
|
var hash = 0;
|
|
13756
13774
|
if (str.length === 0) return '';
|
|
@@ -13785,6 +13803,7 @@ var createClassname = function createClassname(rule, sheet) {
|
|
|
13785
13803
|
|
|
13786
13804
|
var styled = function styled(style, ns) {
|
|
13787
13805
|
var styleElement = typeof window !== 'undefined' ? document.createElement('style') : undefined;
|
|
13806
|
+
if (styleElement) shineoutElements.add(styleElement);
|
|
13788
13807
|
var hoc = createUseStyles(jss_style_handleStyle(style), {
|
|
13789
13808
|
name: ns,
|
|
13790
13809
|
generateId: createClassname,
|
|
@@ -13897,7 +13916,7 @@ function set(name, value) {
|
|
|
13897
13916
|
if (value !== undefined && name in src_config_config) src_config_config[name] = value;
|
|
13898
13917
|
noti.dispatch(name);
|
|
13899
13918
|
}
|
|
13900
|
-
var
|
|
13919
|
+
var setConfig = function setConfig(options) {
|
|
13901
13920
|
var _iterator = _createForOfIteratorHelper(entries(options)),
|
|
13902
13921
|
_step;
|
|
13903
13922
|
try {
|
|
@@ -27954,18 +27973,13 @@ var stepsStyle = {
|
|
|
27954
27973
|
arrowIcon: {
|
|
27955
27974
|
position: 'absolute',
|
|
27956
27975
|
top: 0,
|
|
27957
|
-
right: 0
|
|
27976
|
+
right: 0,
|
|
27958
27977
|
bottom: 0,
|
|
27959
|
-
|
|
27978
|
+
// 1 倍屏下向左压进内容区 0.5px,盖住小数尺寸下亚像素对齐和抗锯齿产生的缝;2 倍屏误差小,偏移 0.25px
|
|
27979
|
+
transform: 'translateX(calc(100% - 0.5px))',
|
|
27960
27980
|
zIndex: 1,
|
|
27961
27981
|
'@media (min-resolution: 2dppx)': {
|
|
27962
|
-
|
|
27963
|
-
},
|
|
27964
|
-
'$withDescription &': {
|
|
27965
|
-
transform: 'translateX(calc(100% - 0.5px))',
|
|
27966
|
-
'@media (min-resolution: 2dppx)': {
|
|
27967
|
-
transform: 'translateX(100%)'
|
|
27968
|
-
}
|
|
27982
|
+
transform: 'translateX(calc(100% - 0.25px))'
|
|
27969
27983
|
},
|
|
27970
27984
|
'& > svg': {
|
|
27971
27985
|
display: 'block',
|
|
@@ -27995,9 +28009,12 @@ var stepsStyle = {
|
|
|
27995
28009
|
display: 'none'
|
|
27996
28010
|
},
|
|
27997
28011
|
'$arrow[dir=rtl] &': {
|
|
27998
|
-
left:
|
|
28012
|
+
left: 0,
|
|
27999
28013
|
right: 'auto',
|
|
28000
|
-
transform: 'translateX(-100%)',
|
|
28014
|
+
transform: 'translateX(calc(-100% + 0.5px))',
|
|
28015
|
+
'@media (min-resolution: 2dppx)': {
|
|
28016
|
+
transform: 'translateX(calc(-100% + 0.25px))'
|
|
28017
|
+
},
|
|
28001
28018
|
'& > svg': {
|
|
28002
28019
|
transform: "rotate(180deg)"
|
|
28003
28020
|
}
|
|
@@ -39384,7 +39401,7 @@ function setLocale(arg) {
|
|
|
39384
39401
|
clone: true
|
|
39385
39402
|
});
|
|
39386
39403
|
}
|
|
39387
|
-
|
|
39404
|
+
config_setConfig({
|
|
39388
39405
|
locale: locale
|
|
39389
39406
|
});
|
|
39390
39407
|
}
|
|
@@ -78022,6 +78039,47 @@ var watermark_jssStyle = {
|
|
|
78022
78039
|
var WatermarkComp = src_watermark_watermark;
|
|
78023
78040
|
WatermarkComp.displayName = 'ShineoutWatermark';
|
|
78024
78041
|
/* harmony default export */ var src_watermark_0 = (WatermarkComp);
|
|
78042
|
+
;// CONCATENATED MODULE: ./src/message/preload-style.tsx
|
|
78043
|
+
|
|
78044
|
+
|
|
78045
|
+
|
|
78046
|
+
|
|
78047
|
+
var preloaded = false;
|
|
78048
|
+
|
|
78049
|
+
// 挂载一次 Message 用到的样式 hook 后立即卸载,配合 keepStyleSheet 让样式表常驻
|
|
78050
|
+
// 这样第一次弹出 Message 时不用在点击回调里插入样式表
|
|
78051
|
+
var Preload = function Preload(props) {
|
|
78052
|
+
useMessageStyle();
|
|
78053
|
+
useAlertStyle();
|
|
78054
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
78055
|
+
ReactUnmount(props.container);
|
|
78056
|
+
}, []);
|
|
78057
|
+
return null;
|
|
78058
|
+
};
|
|
78059
|
+
var preloadMessageStyle = function preloadMessageStyle() {
|
|
78060
|
+
if (preloaded || typeof document === 'undefined') return;
|
|
78061
|
+
preloaded = true;
|
|
78062
|
+
var container = document.createElement('div');
|
|
78063
|
+
ReactRender( /*#__PURE__*/(0,jsx_runtime.jsx)(Preload, {
|
|
78064
|
+
container: container
|
|
78065
|
+
}), container);
|
|
78066
|
+
};
|
|
78067
|
+
;// CONCATENATED MODULE: ./src/config.ts
|
|
78068
|
+
|
|
78069
|
+
|
|
78070
|
+
|
|
78071
|
+
|
|
78072
|
+
// 样式相关的配置由 shineout-style 处理,base 不依赖 shineout-style,在这里转发
|
|
78073
|
+
var src_config_setConfig = function setConfig(option) {
|
|
78074
|
+
config_setConfig(option);
|
|
78075
|
+
if (option && 'keepStyleSheet' in option) {
|
|
78076
|
+
setJssConfig({
|
|
78077
|
+
keepStyleSheet: !!option.keepStyleSheet
|
|
78078
|
+
});
|
|
78079
|
+
// 和 normalize 一样在初始化时插入 Message 样式,避免第一次弹出时的开销
|
|
78080
|
+
if (option.keepStyleSheet) preloadMessageStyle();
|
|
78081
|
+
}
|
|
78082
|
+
};
|
|
78025
78083
|
;// CONCATENATED MODULE: ../theme/src/hooks/useToken/use-token.ts
|
|
78026
78084
|
|
|
78027
78085
|
|
|
@@ -80363,10 +80421,11 @@ var watermark_interface = __webpack_require__(6640);
|
|
|
80363
80421
|
|
|
80364
80422
|
|
|
80365
80423
|
|
|
80424
|
+
|
|
80366
80425
|
|
|
80367
80426
|
|
|
80368
80427
|
/* harmony default export */ var src_0 = ({
|
|
80369
|
-
version: '3.10.3-beta.
|
|
80428
|
+
version: '3.10.3-beta.8'
|
|
80370
80429
|
});
|
|
80371
80430
|
}();
|
|
80372
80431
|
/******/ return __webpack_exports__;
|