@pnkx-lib/ui 1.9.191 → 1.9.193
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/dist/style.css +1 -1
- package/es/chunks/{AntdIcon-yV_Jlg2I.js → AntdIcon-ZIq9SabE.js} +71 -5
- package/es/chunks/{bundle-mjs-BME7zF0Z.js → bundle-mjs-BBFHkixS.js} +1 -1
- package/es/chunks/createClass-CBKC8ctW.js +77 -0
- package/es/chunks/defineProperty-DPy3D8dn.js +50 -0
- package/es/chunks/{defineProperty-DKmbVXax.js → index-mzHK7Za8.js} +2 -51
- package/es/chunks/{index.esm-DPdCEbIy.js → index.esm-o4O8pXMN.js} +7 -17
- package/es/chunks/{layout-DLP6LR8f.js → layout-DnU0VrHH.js} +41 -1206
- package/es/constants/index.js +2 -2
- package/es/fields/CascaderField.js +1 -1
- package/es/fields/DatePicker.js +5 -77
- package/es/fields/Input.js +1 -1
- package/es/fields/PnkxField.js +1 -1
- package/es/fields/Select.js +1 -1
- package/es/fields/SliderRanger.js +1 -1
- package/es/fields/SliderSingle.js +1 -1
- package/es/fields/Switch.js +1 -1
- package/es/fields/Textarea.js +1 -1
- package/es/fields/TinyMCE.js +47 -11
- package/es/fields/Upload.js +1 -1
- package/es/ui/BreadcrumbHeading.js +2 -2
- package/es/ui/CategoryStatus.js +1 -1
- package/es/ui/Container.js +1 -1
- package/es/ui/Heading.js +2 -2
- package/es/ui/Layout.js +1 -1
- package/es/ui/SearchFilterForm.js +2 -2
- package/es/ui/Sidebar.js +3 -3
- package/es/ui/UploadImage.js +1 -1
- package/es/ui/index.js +15 -15
- package/package.json +2 -2
- package/types/components/ui/BulkActions/index.d.ts +11 -3
- package/types/components/ui/Table/index.d.ts +12 -1
- package/types/constants/table.d.ts +2 -2
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { _ as _typeof, c as _arrayLikeToArray, a as _unsupportedIterableToArray, b as _defineProperty } from './defineProperty-DPy3D8dn.js';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import React__default, { useContext, createContext, useState, useEffect, useRef } from 'react';
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
4
|
+
import { c as className } from './index-mzHK7Za8.js';
|
|
5
|
+
import { _ as _createClass, a as _classCallCheck, b as _inherits, c as _createSuper, d as _assertThisInitialized } from './createClass-CBKC8ctW.js';
|
|
6
|
+
import { I as Icon, _ as _extends, w as warningOnce, a as _slicedToArray, b as warning$1, c as canUseDom, d as _objectSpread2, u as updateCSS, r as removeCSS, e as _arrayWithHoles, f as _nonIterableRest, g as resetWarned$1, F as FastColor, h as generate, p as presetPrimaryColors, i as presetPalettes, j as _objectWithoutProperties, k as IconContext } from './AntdIcon-ZIq9SabE.js';
|
|
5
7
|
|
|
6
8
|
// This icon file is generated automatically.
|
|
7
9
|
var BarsOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "bars", "theme": "outlined" };
|
|
8
10
|
|
|
9
11
|
var BarsOutlined = function BarsOutlined(props, ref) {
|
|
10
|
-
return /*#__PURE__*/React.createElement(Icon, _extends
|
|
12
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
11
13
|
ref: ref,
|
|
12
14
|
icon: BarsOutlined$1
|
|
13
15
|
}));
|
|
@@ -23,7 +25,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
23
25
|
var LeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" };
|
|
24
26
|
|
|
25
27
|
var LeftOutlined = function LeftOutlined(props, ref) {
|
|
26
|
-
return /*#__PURE__*/React.createElement(Icon, _extends
|
|
28
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
27
29
|
ref: ref,
|
|
28
30
|
icon: LeftOutlined$1
|
|
29
31
|
}));
|
|
@@ -39,7 +41,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
39
41
|
var RightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
|
|
40
42
|
|
|
41
43
|
var RightOutlined = function RightOutlined(props, ref) {
|
|
42
|
-
return /*#__PURE__*/React.createElement(Icon, _extends
|
|
44
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
43
45
|
ref: ref,
|
|
44
46
|
icon: RightOutlined$1
|
|
45
47
|
}));
|
|
@@ -51,10 +53,31 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
51
53
|
RefIcon.displayName = 'RightOutlined';
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
function useMemo(getValue, condition, shouldUpdate) {
|
|
57
|
+
var cacheRef = React.useRef({});
|
|
58
|
+
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
59
|
+
cacheRef.current.value = getValue();
|
|
60
|
+
cacheRef.current.condition = condition;
|
|
61
|
+
}
|
|
62
|
+
return cacheRef.current.value;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var REACT_ELEMENT_TYPE_18 = Symbol.for('react.element');
|
|
66
|
+
var REACT_ELEMENT_TYPE_19 = Symbol.for('react.transitional.element');
|
|
67
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Compatible with React 18 or 19 to check if node is a Fragment.
|
|
71
|
+
*/
|
|
72
|
+
function isFragment(object) {
|
|
73
|
+
return (
|
|
74
|
+
// Base object type
|
|
75
|
+
object && _typeof(object) === 'object' && (
|
|
76
|
+
// React Element type
|
|
77
|
+
object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) &&
|
|
78
|
+
// React Fragment type
|
|
79
|
+
object.type === REACT_FRAGMENT_TYPE
|
|
80
|
+
);
|
|
58
81
|
}
|
|
59
82
|
|
|
60
83
|
function _arrayWithoutHoles(r) {
|
|
@@ -65,14 +88,6 @@ function _iterableToArray(r) {
|
|
|
65
88
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
66
89
|
}
|
|
67
90
|
|
|
68
|
-
function _unsupportedIterableToArray(r, a) {
|
|
69
|
-
if (r) {
|
|
70
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
71
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
72
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
91
|
function _nonIterableSpread() {
|
|
77
92
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
93
|
}
|
|
@@ -91,103 +106,6 @@ function omit(obj, fields) {
|
|
|
91
106
|
return clone;
|
|
92
107
|
}
|
|
93
108
|
|
|
94
|
-
function _arrayWithHoles(r) {
|
|
95
|
-
if (Array.isArray(r)) return r;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _iterableToArrayLimit(r, l) {
|
|
99
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
100
|
-
if (null != t) {
|
|
101
|
-
var e,
|
|
102
|
-
n,
|
|
103
|
-
i,
|
|
104
|
-
u,
|
|
105
|
-
a = [],
|
|
106
|
-
f = true,
|
|
107
|
-
o = false;
|
|
108
|
-
try {
|
|
109
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
110
|
-
if (Object(t) !== t) return;
|
|
111
|
-
f = !1;
|
|
112
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
113
|
-
} catch (r) {
|
|
114
|
-
o = true, n = r;
|
|
115
|
-
} finally {
|
|
116
|
-
try {
|
|
117
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
118
|
-
} finally {
|
|
119
|
-
if (o) throw n;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return a;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function _nonIterableRest() {
|
|
127
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function _slicedToArray(r, e) {
|
|
131
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function _typeof(o) {
|
|
135
|
-
"@babel/helpers - typeof";
|
|
136
|
-
|
|
137
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
138
|
-
return typeof o;
|
|
139
|
-
} : function (o) {
|
|
140
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
141
|
-
}, _typeof(o);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function toPrimitive(t, r) {
|
|
145
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
146
|
-
var e = t[Symbol.toPrimitive];
|
|
147
|
-
if (void 0 !== e) {
|
|
148
|
-
var i = e.call(t, r);
|
|
149
|
-
if ("object" != _typeof(i)) return i;
|
|
150
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
151
|
-
}
|
|
152
|
-
return ("string" === r ? String : Number)(t);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function toPropertyKey(t) {
|
|
156
|
-
var i = toPrimitive(t, "string");
|
|
157
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function _defineProperty(e, r, t) {
|
|
161
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
162
|
-
value: t,
|
|
163
|
-
enumerable: true,
|
|
164
|
-
configurable: true,
|
|
165
|
-
writable: true
|
|
166
|
-
}) : e[r] = t, e;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function ownKeys(e, r) {
|
|
170
|
-
var t = Object.keys(e);
|
|
171
|
-
if (Object.getOwnPropertySymbols) {
|
|
172
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
173
|
-
r && (o = o.filter(function (r) {
|
|
174
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
175
|
-
})), t.push.apply(t, o);
|
|
176
|
-
}
|
|
177
|
-
return t;
|
|
178
|
-
}
|
|
179
|
-
function _objectSpread2(e) {
|
|
180
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
181
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
182
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
183
|
-
_defineProperty(e, r, t[r]);
|
|
184
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
185
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
return e;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
109
|
/* eslint-disable */
|
|
192
110
|
// Inspired by https://github.com/garycourt/murmurhash-js
|
|
193
111
|
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
|
|
@@ -242,269 +160,6 @@ function murmur2(str) {
|
|
|
242
160
|
return ((h ^ h >>> 15) >>> 0).toString(36);
|
|
243
161
|
}
|
|
244
162
|
|
|
245
|
-
function canUseDom() {
|
|
246
|
-
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function contains(root, n) {
|
|
250
|
-
if (!root) {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// Use native if support
|
|
255
|
-
if (root.contains) {
|
|
256
|
-
return root.contains(n);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// `document.contains` not support with IE11
|
|
260
|
-
var node = n;
|
|
261
|
-
while (node) {
|
|
262
|
-
if (node === root) {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
node = node.parentNode;
|
|
266
|
-
}
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
var APPEND_ORDER = 'data-rc-order';
|
|
271
|
-
var APPEND_PRIORITY = 'data-rc-priority';
|
|
272
|
-
var MARK_KEY = "rc-util-key";
|
|
273
|
-
var containerCache = new Map();
|
|
274
|
-
function getMark() {
|
|
275
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
276
|
-
mark = _ref.mark;
|
|
277
|
-
if (mark) {
|
|
278
|
-
return mark.startsWith('data-') ? mark : "data-".concat(mark);
|
|
279
|
-
}
|
|
280
|
-
return MARK_KEY;
|
|
281
|
-
}
|
|
282
|
-
function getContainer(option) {
|
|
283
|
-
if (option.attachTo) {
|
|
284
|
-
return option.attachTo;
|
|
285
|
-
}
|
|
286
|
-
var head = document.querySelector('head');
|
|
287
|
-
return head || document.body;
|
|
288
|
-
}
|
|
289
|
-
function getOrder(prepend) {
|
|
290
|
-
if (prepend === 'queue') {
|
|
291
|
-
return 'prependQueue';
|
|
292
|
-
}
|
|
293
|
-
return prepend ? 'prepend' : 'append';
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Find style which inject by rc-util
|
|
298
|
-
*/
|
|
299
|
-
function findStyles(container) {
|
|
300
|
-
return Array.from((containerCache.get(container) || container).children).filter(function (node) {
|
|
301
|
-
return node.tagName === 'STYLE';
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
function injectCSS(css) {
|
|
305
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
306
|
-
if (!canUseDom()) {
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
var csp = option.csp,
|
|
310
|
-
prepend = option.prepend,
|
|
311
|
-
_option$priority = option.priority,
|
|
312
|
-
priority = _option$priority === void 0 ? 0 : _option$priority;
|
|
313
|
-
var mergedOrder = getOrder(prepend);
|
|
314
|
-
var isPrependQueue = mergedOrder === 'prependQueue';
|
|
315
|
-
var styleNode = document.createElement('style');
|
|
316
|
-
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
317
|
-
if (isPrependQueue && priority) {
|
|
318
|
-
styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
|
|
319
|
-
}
|
|
320
|
-
if (csp !== null && csp !== void 0 && csp.nonce) {
|
|
321
|
-
styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
|
|
322
|
-
}
|
|
323
|
-
styleNode.innerHTML = css;
|
|
324
|
-
var container = getContainer(option);
|
|
325
|
-
var firstChild = container.firstChild;
|
|
326
|
-
if (prepend) {
|
|
327
|
-
// If is queue `prepend`, it will prepend first style and then append rest style
|
|
328
|
-
if (isPrependQueue) {
|
|
329
|
-
var existStyle = (option.styles || findStyles(container)).filter(function (node) {
|
|
330
|
-
// Ignore style which not injected by rc-util with prepend
|
|
331
|
-
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
|
|
332
|
-
return false;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// Ignore style which priority less then new style
|
|
336
|
-
var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
337
|
-
return priority >= nodePriority;
|
|
338
|
-
});
|
|
339
|
-
if (existStyle.length) {
|
|
340
|
-
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
341
|
-
return styleNode;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// Use `insertBefore` as `prepend`
|
|
346
|
-
container.insertBefore(styleNode, firstChild);
|
|
347
|
-
} else {
|
|
348
|
-
container.appendChild(styleNode);
|
|
349
|
-
}
|
|
350
|
-
return styleNode;
|
|
351
|
-
}
|
|
352
|
-
function findExistNode(key) {
|
|
353
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
354
|
-
var container = getContainer(option);
|
|
355
|
-
return (option.styles || findStyles(container)).find(function (node) {
|
|
356
|
-
return node.getAttribute(getMark(option)) === key;
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
function removeCSS(key) {
|
|
360
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
361
|
-
var existNode = findExistNode(key, option);
|
|
362
|
-
if (existNode) {
|
|
363
|
-
var container = getContainer(option);
|
|
364
|
-
container.removeChild(existNode);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* qiankun will inject `appendChild` to insert into other
|
|
370
|
-
*/
|
|
371
|
-
function syncRealContainer(container, option) {
|
|
372
|
-
var cachedRealContainer = containerCache.get(container);
|
|
373
|
-
|
|
374
|
-
// Find real container when not cached or cached container removed
|
|
375
|
-
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
|
376
|
-
var placeholderStyle = injectCSS('', option);
|
|
377
|
-
var parentNode = placeholderStyle.parentNode;
|
|
378
|
-
containerCache.set(container, parentNode);
|
|
379
|
-
container.removeChild(placeholderStyle);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
function updateCSS(css, key) {
|
|
383
|
-
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
384
|
-
var container = getContainer(originOption);
|
|
385
|
-
var styles = findStyles(container);
|
|
386
|
-
var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
|
|
387
|
-
styles: styles
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
// Sync real parent
|
|
391
|
-
syncRealContainer(container, option);
|
|
392
|
-
var existNode = findExistNode(key, option);
|
|
393
|
-
if (existNode) {
|
|
394
|
-
var _option$csp, _option$csp2;
|
|
395
|
-
if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
|
|
396
|
-
var _option$csp3;
|
|
397
|
-
existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
|
|
398
|
-
}
|
|
399
|
-
if (existNode.innerHTML !== css) {
|
|
400
|
-
existNode.innerHTML = css;
|
|
401
|
-
}
|
|
402
|
-
return existNode;
|
|
403
|
-
}
|
|
404
|
-
var newNode = injectCSS(css, option);
|
|
405
|
-
newNode.setAttribute(getMark(option), key);
|
|
406
|
-
return newNode;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
410
|
-
if (null == r) return {};
|
|
411
|
-
var t = {};
|
|
412
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
413
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
414
|
-
t[n] = r[n];
|
|
415
|
-
}
|
|
416
|
-
return t;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function _objectWithoutProperties(e, t) {
|
|
420
|
-
if (null == e) return {};
|
|
421
|
-
var o,
|
|
422
|
-
r,
|
|
423
|
-
i = _objectWithoutPropertiesLoose(e, t);
|
|
424
|
-
if (Object.getOwnPropertySymbols) {
|
|
425
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
426
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
427
|
-
}
|
|
428
|
-
return i;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
function useMemo(getValue, condition, shouldUpdate) {
|
|
432
|
-
var cacheRef = React.useRef({});
|
|
433
|
-
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
434
|
-
cacheRef.current.value = getValue();
|
|
435
|
-
cacheRef.current.condition = condition;
|
|
436
|
-
}
|
|
437
|
-
return cacheRef.current.value;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/* eslint-disable no-console */
|
|
441
|
-
var warned = {};
|
|
442
|
-
var preWarningFns = [];
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Pre warning enable you to parse content before console.error.
|
|
446
|
-
* Modify to null will prevent warning.
|
|
447
|
-
*/
|
|
448
|
-
var preMessage = function preMessage(fn) {
|
|
449
|
-
preWarningFns.push(fn);
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Warning if condition not match.
|
|
454
|
-
* @param valid Condition
|
|
455
|
-
* @param message Warning message
|
|
456
|
-
* @example
|
|
457
|
-
* ```js
|
|
458
|
-
* warning(false, 'some error'); // print some error
|
|
459
|
-
* warning(true, 'some error'); // print nothing
|
|
460
|
-
* warning(1 === 2, 'some error'); // print some error
|
|
461
|
-
* ```
|
|
462
|
-
*/
|
|
463
|
-
function warning$1(valid, message) {
|
|
464
|
-
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
465
|
-
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
466
|
-
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');
|
|
467
|
-
}, message);
|
|
468
|
-
if (finalMessage) {
|
|
469
|
-
console.error("Warning: ".concat(finalMessage));
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
/** @see Similar to {@link warning} */
|
|
475
|
-
function note(valid, message) {
|
|
476
|
-
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
477
|
-
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
478
|
-
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');
|
|
479
|
-
}, message);
|
|
480
|
-
if (finalMessage) {
|
|
481
|
-
console.warn("Note: ".concat(finalMessage));
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
function resetWarned$1() {
|
|
486
|
-
warned = {};
|
|
487
|
-
}
|
|
488
|
-
function call(method, valid, message) {
|
|
489
|
-
if (!valid && !warned[message]) {
|
|
490
|
-
method(false, message);
|
|
491
|
-
warned[message] = true;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
496
|
-
function warningOnce(valid, message) {
|
|
497
|
-
call(warning$1, valid, message);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
501
|
-
function noteOnce(valid, message) {
|
|
502
|
-
call(note, valid, message);
|
|
503
|
-
}
|
|
504
|
-
warningOnce.preMessage = preMessage;
|
|
505
|
-
warningOnce.resetWarned = resetWarned$1;
|
|
506
|
-
warningOnce.noteOnce = noteOnce;
|
|
507
|
-
|
|
508
163
|
/**
|
|
509
164
|
* Deeply compares two object literals.
|
|
510
165
|
* @param obj1 object 1
|
|
@@ -557,22 +212,6 @@ function isEqual(obj1, obj2) {
|
|
|
557
212
|
return deepEqual(obj1, obj2);
|
|
558
213
|
}
|
|
559
214
|
|
|
560
|
-
function _classCallCheck(a, n) {
|
|
561
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
function _defineProperties(e, r) {
|
|
565
|
-
for (var t = 0; t < r.length; t++) {
|
|
566
|
-
var o = r[t];
|
|
567
|
-
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
function _createClass(e, r, t) {
|
|
571
|
-
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
572
|
-
writable: false
|
|
573
|
-
}), e;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
215
|
// [times, realValue]
|
|
577
216
|
|
|
578
217
|
var SPLIT = '%';
|
|
@@ -668,64 +307,6 @@ var StyleContext = /*#__PURE__*/React.createContext({
|
|
|
668
307
|
defaultCache: true
|
|
669
308
|
});
|
|
670
309
|
|
|
671
|
-
function _assertThisInitialized(e) {
|
|
672
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
673
|
-
return e;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
function _setPrototypeOf(t, e) {
|
|
677
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
678
|
-
return t.__proto__ = e, t;
|
|
679
|
-
}, _setPrototypeOf(t, e);
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
function _inherits(t, e) {
|
|
683
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
684
|
-
t.prototype = Object.create(e && e.prototype, {
|
|
685
|
-
constructor: {
|
|
686
|
-
value: t,
|
|
687
|
-
writable: true,
|
|
688
|
-
configurable: true
|
|
689
|
-
}
|
|
690
|
-
}), Object.defineProperty(t, "prototype", {
|
|
691
|
-
writable: false
|
|
692
|
-
}), e && _setPrototypeOf(t, e);
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
function _getPrototypeOf(t) {
|
|
696
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
697
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
|
698
|
-
}, _getPrototypeOf(t);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
function _isNativeReflectConstruct() {
|
|
702
|
-
try {
|
|
703
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
704
|
-
} catch (t) {}
|
|
705
|
-
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
|
706
|
-
return !!t;
|
|
707
|
-
})();
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
function _possibleConstructorReturn(t, e) {
|
|
711
|
-
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
|
|
712
|
-
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
713
|
-
return _assertThisInitialized(t);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
function _createSuper(t) {
|
|
717
|
-
var r = _isNativeReflectConstruct();
|
|
718
|
-
return function () {
|
|
719
|
-
var e,
|
|
720
|
-
o = _getPrototypeOf(t);
|
|
721
|
-
if (r) {
|
|
722
|
-
var s = _getPrototypeOf(this).constructor;
|
|
723
|
-
e = Reflect.construct(o, arguments, s);
|
|
724
|
-
} else e = o.apply(this, arguments);
|
|
725
|
-
return _possibleConstructorReturn(this, e);
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
|
|
729
310
|
// ================================== Cache ==================================
|
|
730
311
|
|
|
731
312
|
function sameDerivativeOption(left, right) {
|
|
@@ -1349,16 +930,6 @@ function useCacheToken(theme, tokens) {
|
|
|
1349
930
|
return cachedToken;
|
|
1350
931
|
}
|
|
1351
932
|
|
|
1352
|
-
function _extends() {
|
|
1353
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
1354
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
1355
|
-
var t = arguments[e];
|
|
1356
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1357
|
-
}
|
|
1358
|
-
return n;
|
|
1359
|
-
}, _extends.apply(null, arguments);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
933
|
var unitlessKeys = {
|
|
1363
934
|
animationIterationCount: 1,
|
|
1364
935
|
borderImageOutset: 1,
|
|
@@ -2776,724 +2347,6 @@ const seedToken = Object.assign(Object.assign({}, defaultPresetColors), {
|
|
|
2776
2347
|
motion: true
|
|
2777
2348
|
});
|
|
2778
2349
|
|
|
2779
|
-
const round = Math.round;
|
|
2780
|
-
|
|
2781
|
-
/**
|
|
2782
|
-
* Support format, alpha unit will check the % mark:
|
|
2783
|
-
* - rgba(102, 204, 255, .5) -> [102, 204, 255, 0.5]
|
|
2784
|
-
* - rgb(102 204 255 / .5) -> [102, 204, 255, 0.5]
|
|
2785
|
-
* - rgb(100%, 50%, 0% / 50%) -> [255, 128, 0, 0.5]
|
|
2786
|
-
* - hsl(270, 60, 40, .5) -> [270, 60, 40, 0.5]
|
|
2787
|
-
* - hsl(270deg 60% 40% / 50%) -> [270, 60, 40, 0.5]
|
|
2788
|
-
*
|
|
2789
|
-
* When `base` is provided, the percentage value will be divided by `base`.
|
|
2790
|
-
*/
|
|
2791
|
-
function splitColorStr(str, parseNum) {
|
|
2792
|
-
const match = str
|
|
2793
|
-
// Remove str before `(`
|
|
2794
|
-
.replace(/^[^(]*\((.*)/, '$1')
|
|
2795
|
-
// Remove str after `)`
|
|
2796
|
-
.replace(/\).*/, '').match(/\d*\.?\d+%?/g) || [];
|
|
2797
|
-
const numList = match.map(item => parseFloat(item));
|
|
2798
|
-
for (let i = 0; i < 3; i += 1) {
|
|
2799
|
-
numList[i] = parseNum(numList[i] || 0, match[i] || '', i);
|
|
2800
|
-
}
|
|
2801
|
-
|
|
2802
|
-
// For alpha. 50% should be 0.5
|
|
2803
|
-
if (match[3]) {
|
|
2804
|
-
numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3];
|
|
2805
|
-
} else {
|
|
2806
|
-
// By default, alpha is 1
|
|
2807
|
-
numList[3] = 1;
|
|
2808
|
-
}
|
|
2809
|
-
return numList;
|
|
2810
|
-
}
|
|
2811
|
-
const parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
|
|
2812
|
-
|
|
2813
|
-
/** round and limit number to integer between 0-255 */
|
|
2814
|
-
function limitRange(value, max) {
|
|
2815
|
-
const mergedMax = max || 255;
|
|
2816
|
-
if (value > mergedMax) {
|
|
2817
|
-
return mergedMax;
|
|
2818
|
-
}
|
|
2819
|
-
if (value < 0) {
|
|
2820
|
-
return 0;
|
|
2821
|
-
}
|
|
2822
|
-
return value;
|
|
2823
|
-
}
|
|
2824
|
-
class FastColor {
|
|
2825
|
-
constructor(input) {
|
|
2826
|
-
/**
|
|
2827
|
-
* All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
|
|
2828
|
-
*/
|
|
2829
|
-
_defineProperty(this, "isValid", true);
|
|
2830
|
-
/**
|
|
2831
|
-
* Red, R in RGB
|
|
2832
|
-
*/
|
|
2833
|
-
_defineProperty(this, "r", 0);
|
|
2834
|
-
/**
|
|
2835
|
-
* Green, G in RGB
|
|
2836
|
-
*/
|
|
2837
|
-
_defineProperty(this, "g", 0);
|
|
2838
|
-
/**
|
|
2839
|
-
* Blue, B in RGB
|
|
2840
|
-
*/
|
|
2841
|
-
_defineProperty(this, "b", 0);
|
|
2842
|
-
/**
|
|
2843
|
-
* Alpha/Opacity, A in RGBA/HSLA
|
|
2844
|
-
*/
|
|
2845
|
-
_defineProperty(this, "a", 1);
|
|
2846
|
-
// HSV privates
|
|
2847
|
-
_defineProperty(this, "_h", void 0);
|
|
2848
|
-
_defineProperty(this, "_s", void 0);
|
|
2849
|
-
_defineProperty(this, "_l", void 0);
|
|
2850
|
-
_defineProperty(this, "_v", void 0);
|
|
2851
|
-
// intermediate variables to calculate HSL/HSV
|
|
2852
|
-
_defineProperty(this, "_max", void 0);
|
|
2853
|
-
_defineProperty(this, "_min", void 0);
|
|
2854
|
-
_defineProperty(this, "_brightness", void 0);
|
|
2855
|
-
/**
|
|
2856
|
-
* Always check 3 char in the object to determine the format.
|
|
2857
|
-
* We not use function in check to save bundle size.
|
|
2858
|
-
* e.g. 'rgb' -> { r: 0, g: 0, b: 0 }.
|
|
2859
|
-
*/
|
|
2860
|
-
function matchFormat(str) {
|
|
2861
|
-
return str[0] in input && str[1] in input && str[2] in input;
|
|
2862
|
-
}
|
|
2863
|
-
if (!input) ; else if (typeof input === 'string') {
|
|
2864
|
-
const trimStr = input.trim();
|
|
2865
|
-
function matchPrefix(prefix) {
|
|
2866
|
-
return trimStr.startsWith(prefix);
|
|
2867
|
-
}
|
|
2868
|
-
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
|
|
2869
|
-
this.fromHexString(trimStr);
|
|
2870
|
-
} else if (matchPrefix('rgb')) {
|
|
2871
|
-
this.fromRgbString(trimStr);
|
|
2872
|
-
} else if (matchPrefix('hsl')) {
|
|
2873
|
-
this.fromHslString(trimStr);
|
|
2874
|
-
} else if (matchPrefix('hsv') || matchPrefix('hsb')) {
|
|
2875
|
-
this.fromHsvString(trimStr);
|
|
2876
|
-
}
|
|
2877
|
-
} else if (input instanceof FastColor) {
|
|
2878
|
-
this.r = input.r;
|
|
2879
|
-
this.g = input.g;
|
|
2880
|
-
this.b = input.b;
|
|
2881
|
-
this.a = input.a;
|
|
2882
|
-
this._h = input._h;
|
|
2883
|
-
this._s = input._s;
|
|
2884
|
-
this._l = input._l;
|
|
2885
|
-
this._v = input._v;
|
|
2886
|
-
} else if (matchFormat('rgb')) {
|
|
2887
|
-
this.r = limitRange(input.r);
|
|
2888
|
-
this.g = limitRange(input.g);
|
|
2889
|
-
this.b = limitRange(input.b);
|
|
2890
|
-
this.a = typeof input.a === 'number' ? limitRange(input.a, 1) : 1;
|
|
2891
|
-
} else if (matchFormat('hsl')) {
|
|
2892
|
-
this.fromHsl(input);
|
|
2893
|
-
} else if (matchFormat('hsv')) {
|
|
2894
|
-
this.fromHsv(input);
|
|
2895
|
-
} else {
|
|
2896
|
-
throw new Error('@ant-design/fast-color: unsupported input ' + JSON.stringify(input));
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
|
|
2900
|
-
// ======================= Setter =======================
|
|
2901
|
-
|
|
2902
|
-
setR(value) {
|
|
2903
|
-
return this._sc('r', value);
|
|
2904
|
-
}
|
|
2905
|
-
setG(value) {
|
|
2906
|
-
return this._sc('g', value);
|
|
2907
|
-
}
|
|
2908
|
-
setB(value) {
|
|
2909
|
-
return this._sc('b', value);
|
|
2910
|
-
}
|
|
2911
|
-
setA(value) {
|
|
2912
|
-
return this._sc('a', value, 1);
|
|
2913
|
-
}
|
|
2914
|
-
setHue(value) {
|
|
2915
|
-
const hsv = this.toHsv();
|
|
2916
|
-
hsv.h = value;
|
|
2917
|
-
return this._c(hsv);
|
|
2918
|
-
}
|
|
2919
|
-
|
|
2920
|
-
// ======================= Getter =======================
|
|
2921
|
-
/**
|
|
2922
|
-
* Returns the perceived luminance of a color, from 0-1.
|
|
2923
|
-
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
2924
|
-
*/
|
|
2925
|
-
getLuminance() {
|
|
2926
|
-
function adjustGamma(raw) {
|
|
2927
|
-
const val = raw / 255;
|
|
2928
|
-
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
|
|
2929
|
-
}
|
|
2930
|
-
const R = adjustGamma(this.r);
|
|
2931
|
-
const G = adjustGamma(this.g);
|
|
2932
|
-
const B = adjustGamma(this.b);
|
|
2933
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
2934
|
-
}
|
|
2935
|
-
getHue() {
|
|
2936
|
-
if (typeof this._h === 'undefined') {
|
|
2937
|
-
const delta = this.getMax() - this.getMin();
|
|
2938
|
-
if (delta === 0) {
|
|
2939
|
-
this._h = 0;
|
|
2940
|
-
} else {
|
|
2941
|
-
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
return this._h;
|
|
2945
|
-
}
|
|
2946
|
-
getSaturation() {
|
|
2947
|
-
if (typeof this._s === 'undefined') {
|
|
2948
|
-
const delta = this.getMax() - this.getMin();
|
|
2949
|
-
if (delta === 0) {
|
|
2950
|
-
this._s = 0;
|
|
2951
|
-
} else {
|
|
2952
|
-
this._s = delta / this.getMax();
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
return this._s;
|
|
2956
|
-
}
|
|
2957
|
-
getLightness() {
|
|
2958
|
-
if (typeof this._l === 'undefined') {
|
|
2959
|
-
this._l = (this.getMax() + this.getMin()) / 510;
|
|
2960
|
-
}
|
|
2961
|
-
return this._l;
|
|
2962
|
-
}
|
|
2963
|
-
getValue() {
|
|
2964
|
-
if (typeof this._v === 'undefined') {
|
|
2965
|
-
this._v = this.getMax() / 255;
|
|
2966
|
-
}
|
|
2967
|
-
return this._v;
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
|
-
/**
|
|
2971
|
-
* Returns the perceived brightness of the color, from 0-255.
|
|
2972
|
-
* Note: this is not the b of HSB
|
|
2973
|
-
* @see http://www.w3.org/TR/AERT#color-contrast
|
|
2974
|
-
*/
|
|
2975
|
-
getBrightness() {
|
|
2976
|
-
if (typeof this._brightness === 'undefined') {
|
|
2977
|
-
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1000;
|
|
2978
|
-
}
|
|
2979
|
-
return this._brightness;
|
|
2980
|
-
}
|
|
2981
|
-
|
|
2982
|
-
// ======================== Func ========================
|
|
2983
|
-
|
|
2984
|
-
darken(amount = 10) {
|
|
2985
|
-
const h = this.getHue();
|
|
2986
|
-
const s = this.getSaturation();
|
|
2987
|
-
let l = this.getLightness() - amount / 100;
|
|
2988
|
-
if (l < 0) {
|
|
2989
|
-
l = 0;
|
|
2990
|
-
}
|
|
2991
|
-
return this._c({
|
|
2992
|
-
h,
|
|
2993
|
-
s,
|
|
2994
|
-
l,
|
|
2995
|
-
a: this.a
|
|
2996
|
-
});
|
|
2997
|
-
}
|
|
2998
|
-
lighten(amount = 10) {
|
|
2999
|
-
const h = this.getHue();
|
|
3000
|
-
const s = this.getSaturation();
|
|
3001
|
-
let l = this.getLightness() + amount / 100;
|
|
3002
|
-
if (l > 1) {
|
|
3003
|
-
l = 1;
|
|
3004
|
-
}
|
|
3005
|
-
return this._c({
|
|
3006
|
-
h,
|
|
3007
|
-
s,
|
|
3008
|
-
l,
|
|
3009
|
-
a: this.a
|
|
3010
|
-
});
|
|
3011
|
-
}
|
|
3012
|
-
|
|
3013
|
-
/**
|
|
3014
|
-
* Mix the current color a given amount with another color, from 0 to 100.
|
|
3015
|
-
* 0 means no mixing (return current color).
|
|
3016
|
-
*/
|
|
3017
|
-
mix(input, amount = 50) {
|
|
3018
|
-
const color = this._c(input);
|
|
3019
|
-
const p = amount / 100;
|
|
3020
|
-
const calc = key => (color[key] - this[key]) * p + this[key];
|
|
3021
|
-
const rgba = {
|
|
3022
|
-
r: round(calc('r')),
|
|
3023
|
-
g: round(calc('g')),
|
|
3024
|
-
b: round(calc('b')),
|
|
3025
|
-
a: round(calc('a') * 100) / 100
|
|
3026
|
-
};
|
|
3027
|
-
return this._c(rgba);
|
|
3028
|
-
}
|
|
3029
|
-
|
|
3030
|
-
/**
|
|
3031
|
-
* Mix the color with pure white, from 0 to 100.
|
|
3032
|
-
* Providing 0 will do nothing, providing 100 will always return white.
|
|
3033
|
-
*/
|
|
3034
|
-
tint(amount = 10) {
|
|
3035
|
-
return this.mix({
|
|
3036
|
-
r: 255,
|
|
3037
|
-
g: 255,
|
|
3038
|
-
b: 255,
|
|
3039
|
-
a: 1
|
|
3040
|
-
}, amount);
|
|
3041
|
-
}
|
|
3042
|
-
|
|
3043
|
-
/**
|
|
3044
|
-
* Mix the color with pure black, from 0 to 100.
|
|
3045
|
-
* Providing 0 will do nothing, providing 100 will always return black.
|
|
3046
|
-
*/
|
|
3047
|
-
shade(amount = 10) {
|
|
3048
|
-
return this.mix({
|
|
3049
|
-
r: 0,
|
|
3050
|
-
g: 0,
|
|
3051
|
-
b: 0,
|
|
3052
|
-
a: 1
|
|
3053
|
-
}, amount);
|
|
3054
|
-
}
|
|
3055
|
-
onBackground(background) {
|
|
3056
|
-
const bg = this._c(background);
|
|
3057
|
-
const alpha = this.a + bg.a * (1 - this.a);
|
|
3058
|
-
const calc = key => {
|
|
3059
|
-
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
|
|
3060
|
-
};
|
|
3061
|
-
return this._c({
|
|
3062
|
-
r: calc('r'),
|
|
3063
|
-
g: calc('g'),
|
|
3064
|
-
b: calc('b'),
|
|
3065
|
-
a: alpha
|
|
3066
|
-
});
|
|
3067
|
-
}
|
|
3068
|
-
|
|
3069
|
-
// ======================= Status =======================
|
|
3070
|
-
isDark() {
|
|
3071
|
-
return this.getBrightness() < 128;
|
|
3072
|
-
}
|
|
3073
|
-
isLight() {
|
|
3074
|
-
return this.getBrightness() >= 128;
|
|
3075
|
-
}
|
|
3076
|
-
|
|
3077
|
-
// ======================== MISC ========================
|
|
3078
|
-
equals(other) {
|
|
3079
|
-
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
3080
|
-
}
|
|
3081
|
-
clone() {
|
|
3082
|
-
return this._c(this);
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
// ======================= Format =======================
|
|
3086
|
-
toHexString() {
|
|
3087
|
-
let hex = '#';
|
|
3088
|
-
const rHex = (this.r || 0).toString(16);
|
|
3089
|
-
hex += rHex.length === 2 ? rHex : '0' + rHex;
|
|
3090
|
-
const gHex = (this.g || 0).toString(16);
|
|
3091
|
-
hex += gHex.length === 2 ? gHex : '0' + gHex;
|
|
3092
|
-
const bHex = (this.b || 0).toString(16);
|
|
3093
|
-
hex += bHex.length === 2 ? bHex : '0' + bHex;
|
|
3094
|
-
if (typeof this.a === 'number' && this.a >= 0 && this.a < 1) {
|
|
3095
|
-
const aHex = round(this.a * 255).toString(16);
|
|
3096
|
-
hex += aHex.length === 2 ? aHex : '0' + aHex;
|
|
3097
|
-
}
|
|
3098
|
-
return hex;
|
|
3099
|
-
}
|
|
3100
|
-
|
|
3101
|
-
/** CSS support color pattern */
|
|
3102
|
-
toHsl() {
|
|
3103
|
-
return {
|
|
3104
|
-
h: this.getHue(),
|
|
3105
|
-
s: this.getSaturation(),
|
|
3106
|
-
l: this.getLightness(),
|
|
3107
|
-
a: this.a
|
|
3108
|
-
};
|
|
3109
|
-
}
|
|
3110
|
-
|
|
3111
|
-
/** CSS support color pattern */
|
|
3112
|
-
toHslString() {
|
|
3113
|
-
const h = this.getHue();
|
|
3114
|
-
const s = round(this.getSaturation() * 100);
|
|
3115
|
-
const l = round(this.getLightness() * 100);
|
|
3116
|
-
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
|
|
3117
|
-
}
|
|
3118
|
-
|
|
3119
|
-
/** Same as toHsb */
|
|
3120
|
-
toHsv() {
|
|
3121
|
-
return {
|
|
3122
|
-
h: this.getHue(),
|
|
3123
|
-
s: this.getSaturation(),
|
|
3124
|
-
v: this.getValue(),
|
|
3125
|
-
a: this.a
|
|
3126
|
-
};
|
|
3127
|
-
}
|
|
3128
|
-
toRgb() {
|
|
3129
|
-
return {
|
|
3130
|
-
r: this.r,
|
|
3131
|
-
g: this.g,
|
|
3132
|
-
b: this.b,
|
|
3133
|
-
a: this.a
|
|
3134
|
-
};
|
|
3135
|
-
}
|
|
3136
|
-
toRgbString() {
|
|
3137
|
-
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
|
|
3138
|
-
}
|
|
3139
|
-
toString() {
|
|
3140
|
-
return this.toRgbString();
|
|
3141
|
-
}
|
|
3142
|
-
|
|
3143
|
-
// ====================== Privates ======================
|
|
3144
|
-
/** Return a new FastColor object with one channel changed */
|
|
3145
|
-
_sc(rgb, value, max) {
|
|
3146
|
-
const clone = this.clone();
|
|
3147
|
-
clone[rgb] = limitRange(value, max);
|
|
3148
|
-
return clone;
|
|
3149
|
-
}
|
|
3150
|
-
_c(input) {
|
|
3151
|
-
return new this.constructor(input);
|
|
3152
|
-
}
|
|
3153
|
-
getMax() {
|
|
3154
|
-
if (typeof this._max === 'undefined') {
|
|
3155
|
-
this._max = Math.max(this.r, this.g, this.b);
|
|
3156
|
-
}
|
|
3157
|
-
return this._max;
|
|
3158
|
-
}
|
|
3159
|
-
getMin() {
|
|
3160
|
-
if (typeof this._min === 'undefined') {
|
|
3161
|
-
this._min = Math.min(this.r, this.g, this.b);
|
|
3162
|
-
}
|
|
3163
|
-
return this._min;
|
|
3164
|
-
}
|
|
3165
|
-
fromHexString(trimStr) {
|
|
3166
|
-
const withoutPrefix = trimStr.replace('#', '');
|
|
3167
|
-
function connectNum(index1, index2) {
|
|
3168
|
-
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
|
|
3169
|
-
}
|
|
3170
|
-
if (withoutPrefix.length < 6) {
|
|
3171
|
-
// #rgb or #rgba
|
|
3172
|
-
this.r = connectNum(0);
|
|
3173
|
-
this.g = connectNum(1);
|
|
3174
|
-
this.b = connectNum(2);
|
|
3175
|
-
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
|
|
3176
|
-
} else {
|
|
3177
|
-
// #rrggbb or #rrggbbaa
|
|
3178
|
-
this.r = connectNum(0, 1);
|
|
3179
|
-
this.g = connectNum(2, 3);
|
|
3180
|
-
this.b = connectNum(4, 5);
|
|
3181
|
-
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
|
|
3182
|
-
}
|
|
3183
|
-
}
|
|
3184
|
-
fromHsl({
|
|
3185
|
-
h,
|
|
3186
|
-
s,
|
|
3187
|
-
l,
|
|
3188
|
-
a
|
|
3189
|
-
}) {
|
|
3190
|
-
this._h = h % 360;
|
|
3191
|
-
this._s = s;
|
|
3192
|
-
this._l = l;
|
|
3193
|
-
this.a = typeof a === 'number' ? a : 1;
|
|
3194
|
-
if (s <= 0) {
|
|
3195
|
-
const rgb = round(l * 255);
|
|
3196
|
-
this.r = rgb;
|
|
3197
|
-
this.g = rgb;
|
|
3198
|
-
this.b = rgb;
|
|
3199
|
-
}
|
|
3200
|
-
let r = 0,
|
|
3201
|
-
g = 0,
|
|
3202
|
-
b = 0;
|
|
3203
|
-
const huePrime = h / 60;
|
|
3204
|
-
const chroma = (1 - Math.abs(2 * l - 1)) * s;
|
|
3205
|
-
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
3206
|
-
if (huePrime >= 0 && huePrime < 1) {
|
|
3207
|
-
r = chroma;
|
|
3208
|
-
g = secondComponent;
|
|
3209
|
-
} else if (huePrime >= 1 && huePrime < 2) {
|
|
3210
|
-
r = secondComponent;
|
|
3211
|
-
g = chroma;
|
|
3212
|
-
} else if (huePrime >= 2 && huePrime < 3) {
|
|
3213
|
-
g = chroma;
|
|
3214
|
-
b = secondComponent;
|
|
3215
|
-
} else if (huePrime >= 3 && huePrime < 4) {
|
|
3216
|
-
g = secondComponent;
|
|
3217
|
-
b = chroma;
|
|
3218
|
-
} else if (huePrime >= 4 && huePrime < 5) {
|
|
3219
|
-
r = secondComponent;
|
|
3220
|
-
b = chroma;
|
|
3221
|
-
} else if (huePrime >= 5 && huePrime < 6) {
|
|
3222
|
-
r = chroma;
|
|
3223
|
-
b = secondComponent;
|
|
3224
|
-
}
|
|
3225
|
-
const lightnessModification = l - chroma / 2;
|
|
3226
|
-
this.r = round((r + lightnessModification) * 255);
|
|
3227
|
-
this.g = round((g + lightnessModification) * 255);
|
|
3228
|
-
this.b = round((b + lightnessModification) * 255);
|
|
3229
|
-
}
|
|
3230
|
-
fromHsv({
|
|
3231
|
-
h,
|
|
3232
|
-
s,
|
|
3233
|
-
v,
|
|
3234
|
-
a
|
|
3235
|
-
}) {
|
|
3236
|
-
this._h = h % 360;
|
|
3237
|
-
this._s = s;
|
|
3238
|
-
this._v = v;
|
|
3239
|
-
this.a = typeof a === 'number' ? a : 1;
|
|
3240
|
-
const vv = round(v * 255);
|
|
3241
|
-
this.r = vv;
|
|
3242
|
-
this.g = vv;
|
|
3243
|
-
this.b = vv;
|
|
3244
|
-
if (s <= 0) {
|
|
3245
|
-
return;
|
|
3246
|
-
}
|
|
3247
|
-
const hh = h / 60;
|
|
3248
|
-
const i = Math.floor(hh);
|
|
3249
|
-
const ff = hh - i;
|
|
3250
|
-
const p = round(v * (1.0 - s) * 255);
|
|
3251
|
-
const q = round(v * (1.0 - s * ff) * 255);
|
|
3252
|
-
const t = round(v * (1.0 - s * (1.0 - ff)) * 255);
|
|
3253
|
-
switch (i) {
|
|
3254
|
-
case 0:
|
|
3255
|
-
this.g = t;
|
|
3256
|
-
this.b = p;
|
|
3257
|
-
break;
|
|
3258
|
-
case 1:
|
|
3259
|
-
this.r = q;
|
|
3260
|
-
this.b = p;
|
|
3261
|
-
break;
|
|
3262
|
-
case 2:
|
|
3263
|
-
this.r = p;
|
|
3264
|
-
this.b = t;
|
|
3265
|
-
break;
|
|
3266
|
-
case 3:
|
|
3267
|
-
this.r = p;
|
|
3268
|
-
this.g = q;
|
|
3269
|
-
break;
|
|
3270
|
-
case 4:
|
|
3271
|
-
this.r = t;
|
|
3272
|
-
this.g = p;
|
|
3273
|
-
break;
|
|
3274
|
-
case 5:
|
|
3275
|
-
default:
|
|
3276
|
-
this.g = p;
|
|
3277
|
-
this.b = q;
|
|
3278
|
-
break;
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
|
-
fromHsvString(trimStr) {
|
|
3282
|
-
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
3283
|
-
this.fromHsv({
|
|
3284
|
-
h: cells[0],
|
|
3285
|
-
s: cells[1],
|
|
3286
|
-
v: cells[2],
|
|
3287
|
-
a: cells[3]
|
|
3288
|
-
});
|
|
3289
|
-
}
|
|
3290
|
-
fromHslString(trimStr) {
|
|
3291
|
-
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
3292
|
-
this.fromHsl({
|
|
3293
|
-
h: cells[0],
|
|
3294
|
-
s: cells[1],
|
|
3295
|
-
l: cells[2],
|
|
3296
|
-
a: cells[3]
|
|
3297
|
-
});
|
|
3298
|
-
}
|
|
3299
|
-
fromRgbString(trimStr) {
|
|
3300
|
-
const cells = splitColorStr(trimStr, (num, txt) =>
|
|
3301
|
-
// Convert percentage to number. e.g. 50% -> 128
|
|
3302
|
-
txt.includes('%') ? round(num / 100 * 255) : num);
|
|
3303
|
-
this.r = cells[0];
|
|
3304
|
-
this.g = cells[1];
|
|
3305
|
-
this.b = cells[2];
|
|
3306
|
-
this.a = cells[3];
|
|
3307
|
-
}
|
|
3308
|
-
}
|
|
3309
|
-
|
|
3310
|
-
var hueStep = 2; // 色相阶梯
|
|
3311
|
-
var saturationStep = 0.16; // 饱和度阶梯,浅色部分
|
|
3312
|
-
var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
|
|
3313
|
-
var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
|
|
3314
|
-
var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
|
|
3315
|
-
var lightColorCount = 5; // 浅色数量,主色上
|
|
3316
|
-
var darkColorCount = 4; // 深色数量,主色下
|
|
3317
|
-
|
|
3318
|
-
// 暗色主题颜色映射关系表
|
|
3319
|
-
var darkColorMap = [{
|
|
3320
|
-
index: 7,
|
|
3321
|
-
amount: 15
|
|
3322
|
-
}, {
|
|
3323
|
-
index: 6,
|
|
3324
|
-
amount: 25
|
|
3325
|
-
}, {
|
|
3326
|
-
index: 5,
|
|
3327
|
-
amount: 30
|
|
3328
|
-
}, {
|
|
3329
|
-
index: 5,
|
|
3330
|
-
amount: 45
|
|
3331
|
-
}, {
|
|
3332
|
-
index: 5,
|
|
3333
|
-
amount: 65
|
|
3334
|
-
}, {
|
|
3335
|
-
index: 5,
|
|
3336
|
-
amount: 85
|
|
3337
|
-
}, {
|
|
3338
|
-
index: 4,
|
|
3339
|
-
amount: 90
|
|
3340
|
-
}, {
|
|
3341
|
-
index: 3,
|
|
3342
|
-
amount: 95
|
|
3343
|
-
}, {
|
|
3344
|
-
index: 2,
|
|
3345
|
-
amount: 97
|
|
3346
|
-
}, {
|
|
3347
|
-
index: 1,
|
|
3348
|
-
amount: 98
|
|
3349
|
-
}];
|
|
3350
|
-
function getHue(hsv, i, light) {
|
|
3351
|
-
var hue;
|
|
3352
|
-
// 根据色相不同,色相转向不同
|
|
3353
|
-
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
3354
|
-
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
3355
|
-
} else {
|
|
3356
|
-
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
3357
|
-
}
|
|
3358
|
-
if (hue < 0) {
|
|
3359
|
-
hue += 360;
|
|
3360
|
-
} else if (hue >= 360) {
|
|
3361
|
-
hue -= 360;
|
|
3362
|
-
}
|
|
3363
|
-
return hue;
|
|
3364
|
-
}
|
|
3365
|
-
function getSaturation(hsv, i, light) {
|
|
3366
|
-
// grey color don't change saturation
|
|
3367
|
-
if (hsv.h === 0 && hsv.s === 0) {
|
|
3368
|
-
return hsv.s;
|
|
3369
|
-
}
|
|
3370
|
-
var saturation;
|
|
3371
|
-
if (light) {
|
|
3372
|
-
saturation = hsv.s - saturationStep * i;
|
|
3373
|
-
} else if (i === darkColorCount) {
|
|
3374
|
-
saturation = hsv.s + saturationStep;
|
|
3375
|
-
} else {
|
|
3376
|
-
saturation = hsv.s + saturationStep2 * i;
|
|
3377
|
-
}
|
|
3378
|
-
// 边界值修正
|
|
3379
|
-
if (saturation > 1) {
|
|
3380
|
-
saturation = 1;
|
|
3381
|
-
}
|
|
3382
|
-
// 第一格的 s 限制在 0.06-0.1 之间
|
|
3383
|
-
if (light && i === lightColorCount && saturation > 0.1) {
|
|
3384
|
-
saturation = 0.1;
|
|
3385
|
-
}
|
|
3386
|
-
if (saturation < 0.06) {
|
|
3387
|
-
saturation = 0.06;
|
|
3388
|
-
}
|
|
3389
|
-
return Math.round(saturation * 100) / 100;
|
|
3390
|
-
}
|
|
3391
|
-
function getValue(hsv, i, light) {
|
|
3392
|
-
var value;
|
|
3393
|
-
if (light) {
|
|
3394
|
-
value = hsv.v + brightnessStep1 * i;
|
|
3395
|
-
} else {
|
|
3396
|
-
value = hsv.v - brightnessStep2 * i;
|
|
3397
|
-
}
|
|
3398
|
-
// Clamp value between 0 and 1
|
|
3399
|
-
value = Math.max(0, Math.min(1, value));
|
|
3400
|
-
return Math.round(value * 100) / 100;
|
|
3401
|
-
}
|
|
3402
|
-
function generate(color) {
|
|
3403
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3404
|
-
var patterns = [];
|
|
3405
|
-
var pColor = new FastColor(color);
|
|
3406
|
-
var hsv = pColor.toHsv();
|
|
3407
|
-
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
3408
|
-
var c = new FastColor({
|
|
3409
|
-
h: getHue(hsv, i, true),
|
|
3410
|
-
s: getSaturation(hsv, i, true),
|
|
3411
|
-
v: getValue(hsv, i, true)
|
|
3412
|
-
});
|
|
3413
|
-
patterns.push(c);
|
|
3414
|
-
}
|
|
3415
|
-
patterns.push(pColor);
|
|
3416
|
-
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
3417
|
-
var _c = new FastColor({
|
|
3418
|
-
h: getHue(hsv, _i),
|
|
3419
|
-
s: getSaturation(hsv, _i),
|
|
3420
|
-
v: getValue(hsv, _i)
|
|
3421
|
-
});
|
|
3422
|
-
patterns.push(_c);
|
|
3423
|
-
}
|
|
3424
|
-
|
|
3425
|
-
// dark theme patterns
|
|
3426
|
-
if (opts.theme === 'dark') {
|
|
3427
|
-
return darkColorMap.map(function (_ref) {
|
|
3428
|
-
var index = _ref.index,
|
|
3429
|
-
amount = _ref.amount;
|
|
3430
|
-
return new FastColor(opts.backgroundColor || '#141414').mix(patterns[index], amount).toHexString();
|
|
3431
|
-
});
|
|
3432
|
-
}
|
|
3433
|
-
return patterns.map(function (c) {
|
|
3434
|
-
return c.toHexString();
|
|
3435
|
-
});
|
|
3436
|
-
}
|
|
3437
|
-
|
|
3438
|
-
// Generated by script. Do NOT modify!
|
|
3439
|
-
|
|
3440
|
-
var presetPrimaryColors = {
|
|
3441
|
-
"red": "#F5222D",
|
|
3442
|
-
"volcano": "#FA541C",
|
|
3443
|
-
"orange": "#FA8C16",
|
|
3444
|
-
"gold": "#FAAD14",
|
|
3445
|
-
"yellow": "#FADB14",
|
|
3446
|
-
"lime": "#A0D911",
|
|
3447
|
-
"green": "#52C41A",
|
|
3448
|
-
"cyan": "#13C2C2",
|
|
3449
|
-
"blue": "#1677FF",
|
|
3450
|
-
"geekblue": "#2F54EB",
|
|
3451
|
-
"purple": "#722ED1",
|
|
3452
|
-
"magenta": "#EB2F96",
|
|
3453
|
-
"grey": "#666666"
|
|
3454
|
-
};
|
|
3455
|
-
var red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
|
|
3456
|
-
red.primary = red[5];
|
|
3457
|
-
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
|
|
3458
|
-
volcano.primary = volcano[5];
|
|
3459
|
-
var orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
|
|
3460
|
-
orange.primary = orange[5];
|
|
3461
|
-
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
|
|
3462
|
-
gold.primary = gold[5];
|
|
3463
|
-
var yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
|
|
3464
|
-
yellow.primary = yellow[5];
|
|
3465
|
-
var lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
|
|
3466
|
-
lime.primary = lime[5];
|
|
3467
|
-
var green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
|
|
3468
|
-
green.primary = green[5];
|
|
3469
|
-
var cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
|
|
3470
|
-
cyan.primary = cyan[5];
|
|
3471
|
-
var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
|
|
3472
|
-
blue.primary = blue[5];
|
|
3473
|
-
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
|
|
3474
|
-
geekblue.primary = geekblue[5];
|
|
3475
|
-
var purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
|
|
3476
|
-
purple.primary = purple[5];
|
|
3477
|
-
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
|
|
3478
|
-
magenta.primary = magenta[5];
|
|
3479
|
-
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
|
|
3480
|
-
grey.primary = grey[5];
|
|
3481
|
-
var presetPalettes = {
|
|
3482
|
-
red: red,
|
|
3483
|
-
volcano: volcano,
|
|
3484
|
-
orange: orange,
|
|
3485
|
-
gold: gold,
|
|
3486
|
-
yellow: yellow,
|
|
3487
|
-
lime: lime,
|
|
3488
|
-
green: green,
|
|
3489
|
-
cyan: cyan,
|
|
3490
|
-
blue: blue,
|
|
3491
|
-
geekblue: geekblue,
|
|
3492
|
-
purple: purple,
|
|
3493
|
-
magenta: magenta,
|
|
3494
|
-
grey: grey
|
|
3495
|
-
};
|
|
3496
|
-
|
|
3497
2350
|
function genColorMapToken(seed, {
|
|
3498
2351
|
generateColorPalettes,
|
|
3499
2352
|
generateNeutralColorPalettes
|
|
@@ -4151,24 +3004,6 @@ var getCompVarPrefix = function getCompVarPrefix(component, prefix) {
|
|
|
4151
3004
|
return "".concat([prefix, component.replace(/([A-Z]+)([A-Z][a-z]+)/g, '$1-$2').replace(/([a-z])([A-Z])/g, '$1-$2')].filter(Boolean).join('-'));
|
|
4152
3005
|
};
|
|
4153
3006
|
|
|
4154
|
-
var REACT_ELEMENT_TYPE_18 = Symbol.for('react.element');
|
|
4155
|
-
var REACT_ELEMENT_TYPE_19 = Symbol.for('react.transitional.element');
|
|
4156
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
4157
|
-
|
|
4158
|
-
/**
|
|
4159
|
-
* Compatible with React 18 or 19 to check if node is a Fragment.
|
|
4160
|
-
*/
|
|
4161
|
-
function isFragment(object) {
|
|
4162
|
-
return (
|
|
4163
|
-
// Base object type
|
|
4164
|
-
object && _typeof(object) === 'object' && (
|
|
4165
|
-
// React Element type
|
|
4166
|
-
object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) &&
|
|
4167
|
-
// React Fragment type
|
|
4168
|
-
object.type === REACT_FRAGMENT_TYPE
|
|
4169
|
-
);
|
|
4170
|
-
}
|
|
4171
|
-
|
|
4172
3007
|
function getComponentToken(component, token, defaultToken, options) {
|
|
4173
3008
|
var customToken = _objectSpread2({}, token[component]);
|
|
4174
3009
|
if (options !== null && options !== void 0 && options.deprecatedTokens) {
|
|
@@ -5845,7 +4680,7 @@ const generateId = (() => {
|
|
|
5845
4680
|
const Sider = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
5846
4681
|
const {
|
|
5847
4682
|
prefixCls: customizePrefixCls,
|
|
5848
|
-
className,
|
|
4683
|
+
className: className$1,
|
|
5849
4684
|
trigger,
|
|
5850
4685
|
children,
|
|
5851
4686
|
defaultCollapsed = false,
|
|
@@ -5923,7 +4758,7 @@ const Sider = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
5923
4758
|
// special trigger when collapsedWidth == 0
|
|
5924
4759
|
const zeroWidthTrigger = parseFloat(String(collapsedWidth || 0)) === 0 ? (/*#__PURE__*/React.createElement("span", {
|
|
5925
4760
|
onClick: toggle,
|
|
5926
|
-
className:
|
|
4761
|
+
className: className(`${prefixCls}-zero-width-trigger`, `${prefixCls}-zero-width-trigger-${reverseArrow ? 'right' : 'left'}`),
|
|
5927
4762
|
style: zeroWidthTriggerStyle
|
|
5928
4763
|
}, trigger || /*#__PURE__*/React.createElement(RefIcon$2, null))) : null;
|
|
5929
4764
|
const reverseIcon = direction === 'rtl' === !reverseArrow;
|
|
@@ -5946,12 +4781,12 @@ const Sider = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
5946
4781
|
minWidth: siderWidth,
|
|
5947
4782
|
width: siderWidth
|
|
5948
4783
|
});
|
|
5949
|
-
const siderCls =
|
|
4784
|
+
const siderCls = className(prefixCls, `${prefixCls}-${theme}`, {
|
|
5950
4785
|
[`${prefixCls}-collapsed`]: !!collapsed,
|
|
5951
4786
|
[`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
|
|
5952
4787
|
[`${prefixCls}-below`]: !!below,
|
|
5953
4788
|
[`${prefixCls}-zero-width`]: parseFloat(siderWidth) === 0
|
|
5954
|
-
}, className, hashId, cssVarCls);
|
|
4789
|
+
}, className$1, hashId, cssVarCls);
|
|
5955
4790
|
const contextValue = React.useMemo(() => ({
|
|
5956
4791
|
siderCollapsed: collapsed
|
|
5957
4792
|
}), [collapsed]);
|
|
@@ -6010,7 +4845,7 @@ const Basic = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
6010
4845
|
const {
|
|
6011
4846
|
prefixCls: customizePrefixCls,
|
|
6012
4847
|
suffixCls,
|
|
6013
|
-
className,
|
|
4848
|
+
className: className$1,
|
|
6014
4849
|
tagName: TagName
|
|
6015
4850
|
} = props,
|
|
6016
4851
|
others = __rest(props, ["prefixCls", "suffixCls", "className", "tagName"]);
|
|
@@ -6021,7 +4856,7 @@ const Basic = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
6021
4856
|
const [wrapSSR, hashId, cssVarCls] = useStyle$1(prefixCls);
|
|
6022
4857
|
const prefixWithSuffixCls = suffixCls ? `${prefixCls}-${suffixCls}` : prefixCls;
|
|
6023
4858
|
return wrapSSR(/*#__PURE__*/React.createElement(TagName, Object.assign({
|
|
6024
|
-
className:
|
|
4859
|
+
className: className(customizePrefixCls || prefixWithSuffixCls, className$1, hashId, cssVarCls),
|
|
6025
4860
|
ref: ref
|
|
6026
4861
|
}, others)));
|
|
6027
4862
|
});
|
|
@@ -6032,7 +4867,7 @@ const BasicLayout = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
6032
4867
|
const [siders, setSiders] = React.useState([]);
|
|
6033
4868
|
const {
|
|
6034
4869
|
prefixCls: customizePrefixCls,
|
|
6035
|
-
className,
|
|
4870
|
+
className: className$1,
|
|
6036
4871
|
rootClassName,
|
|
6037
4872
|
children,
|
|
6038
4873
|
hasSider,
|
|
@@ -6049,10 +4884,10 @@ const BasicLayout = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
6049
4884
|
const prefixCls = getPrefixCls('layout', customizePrefixCls);
|
|
6050
4885
|
const mergedHasSider = useHasSider(siders, children, hasSider);
|
|
6051
4886
|
const [wrapCSSVar, hashId, cssVarCls] = useStyle$1(prefixCls);
|
|
6052
|
-
const classString =
|
|
4887
|
+
const classString = className(prefixCls, {
|
|
6053
4888
|
[`${prefixCls}-has-sider`]: mergedHasSider,
|
|
6054
4889
|
[`${prefixCls}-rtl`]: direction === 'rtl'
|
|
6055
|
-
}, contextClassName, className, rootClassName, hashId, cssVarCls);
|
|
4890
|
+
}, contextClassName, className$1, rootClassName, hashId, cssVarCls);
|
|
6056
4891
|
const contextValue = React.useMemo(() => ({
|
|
6057
4892
|
siderHook: {
|
|
6058
4893
|
addSider: id => {
|