@sheinx/theme 3.0.0-alpha.27 → 3.0.0-alpha.29
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/alert/token.js +4 -1
- package/cjs/alert/type.d.ts +4 -4
- package/cjs/breadcrumb/token.js +6 -1
- package/cjs/breadcrumb/type.d.ts +16 -16
- package/cjs/button/token.js +2 -1
- package/cjs/button/type.d.ts +1 -1
- package/cjs/card/token.js +6 -1
- package/cjs/card/type.d.ts +13 -13
- package/cjs/cascader/cascader.d.ts.map +1 -1
- package/cjs/cascader/cascader.js +1 -0
- package/cjs/cascader/token.js +9 -3
- package/cjs/cascader/type.d.ts +21 -15
- package/cjs/cascader/type.d.ts.map +1 -1
- package/cjs/checkbox/token.js +5 -1
- package/cjs/checkbox/type.d.ts +13 -13
- package/cjs/collapse/token.js +9 -1
- package/cjs/collapse/type.d.ts +25 -25
- package/cjs/config.d.ts +19 -4
- package/cjs/config.d.ts.map +1 -1
- package/cjs/config.js +50 -10
- package/cjs/date-picker/date-picker.d.ts.map +1 -1
- package/cjs/date-picker/date-picker.js +1 -0
- package/cjs/date-picker/token.js +1 -0
- package/cjs/date-picker/type.d.ts +6 -0
- package/cjs/date-picker/type.d.ts.map +1 -1
- package/cjs/descriptions/descriptions.d.ts.map +1 -1
- package/cjs/descriptions/descriptions.js +5 -7
- package/cjs/descriptions/rule.js +3 -3
- package/cjs/descriptions/token.js +33 -24
- package/cjs/descriptions/type.d.ts +41 -53
- package/cjs/descriptions/type.d.ts.map +1 -1
- package/cjs/dropdown/token.js +13 -1
- package/cjs/dropdown/type.d.ts +50 -50
- package/cjs/form/token.js +8 -2
- package/cjs/form/type.d.ts +11 -11
- package/cjs/icon/icon.d.ts +2 -2
- package/cjs/icon/icon.d.ts.map +1 -1
- package/cjs/icon/icon.js +2 -2
- package/cjs/icon/token.js +3 -1
- package/cjs/icon/type.d.ts +1 -1
- package/cjs/image/token.js +2 -1
- package/cjs/image/type.d.ts +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +14 -0
- package/cjs/input/token.js +5 -1
- package/cjs/input/type.d.ts +12 -12
- package/cjs/list/token.js +4 -1
- package/cjs/list/type.d.ts +12 -12
- package/cjs/menu/token.js +8 -1
- package/cjs/menu/type.d.ts +29 -29
- package/cjs/message/token.js +3 -1
- package/cjs/message/type.d.ts +5 -5
- package/cjs/modal/modal.d.ts.map +1 -1
- package/cjs/modal/modal.js +2 -1
- package/cjs/modal/token.js +17 -2
- package/cjs/modal/type.d.ts +34 -28
- package/cjs/modal/type.d.ts.map +1 -1
- package/cjs/popover/token.js +2 -1
- package/cjs/popover/type.d.ts +1 -1
- package/cjs/progress/token.js +6 -1
- package/cjs/progress/type.d.ts +18 -18
- package/cjs/radio/token.js +8 -1
- package/cjs/radio/type.d.ts +14 -14
- package/cjs/rate/rate.js +1 -1
- package/cjs/rate/token.js +4 -2
- package/cjs/rate/type.d.ts +7 -7
- package/cjs/select/select.d.ts.map +1 -1
- package/cjs/select/select.js +1 -0
- package/cjs/select/token.js +7 -2
- package/cjs/select/type.d.ts +17 -11
- package/cjs/select/type.d.ts.map +1 -1
- package/cjs/slider/slider.js +1 -1
- package/cjs/slider/token.js +8 -2
- package/cjs/slider/type.d.ts +25 -25
- package/cjs/slider/type.d.ts.map +1 -1
- package/cjs/spin/token.js +2 -1
- package/cjs/spin/type.d.ts +1 -1
- package/cjs/steps/token.js +2 -1
- package/cjs/steps/type.d.ts +1 -1
- package/cjs/sticky/token.js +1 -1
- package/cjs/sticky/type.d.ts +1 -1
- package/cjs/switch/token.js +6 -1
- package/cjs/switch/type.d.ts +32 -32
- package/cjs/table/token.js +13 -1
- package/cjs/table/type.d.ts +28 -28
- package/cjs/tabs/token.js +6 -1
- package/cjs/tabs/type.d.ts +7 -7
- package/cjs/tag/token.js +4 -2
- package/cjs/tag/type.d.ts +168 -168
- package/cjs/textarea/token.js +6 -1
- package/cjs/textarea/type.d.ts +29 -29
- package/cjs/tooltip/token.js +4 -2
- package/cjs/tooltip/tooltip.js +1 -1
- package/cjs/tooltip/type.d.ts +5 -5
- package/cjs/transfer/token.js +3 -1
- package/cjs/transfer/type.d.ts +2 -2
- package/cjs/tree/token.js +5 -1
- package/cjs/tree/type.d.ts +13 -13
- package/cjs/tree-select/token.js +5 -2
- package/cjs/tree-select/tree-select.d.ts.map +1 -1
- package/cjs/tree-select/tree-select.js +1 -0
- package/cjs/tree-select/type.d.ts +9 -3
- package/cjs/tree-select/type.d.ts.map +1 -1
- package/cjs/utils/css-var.d.ts +1 -0
- package/cjs/utils/css-var.d.ts.map +1 -1
- package/cjs/utils/css-var.js +4 -1
- package/cjs/utils/notification.d.ts +16 -0
- package/cjs/utils/notification.d.ts.map +1 -0
- package/cjs/utils/notification.js +52 -0
- package/cjs/utils/token-setter.d.ts +57 -0
- package/cjs/utils/token-setter.d.ts.map +1 -0
- package/cjs/utils/token-setter.js +74 -0
- package/esm/alert/token.js +4 -1
- package/esm/alert/type.d.ts +4 -4
- package/esm/breadcrumb/token.js +6 -1
- package/esm/breadcrumb/type.d.ts +16 -16
- package/esm/button/token.js +2 -1
- package/esm/button/type.d.ts +1 -1
- package/esm/card/token.js +6 -1
- package/esm/card/type.d.ts +13 -13
- package/esm/cascader/cascader.d.ts.map +1 -1
- package/esm/cascader/cascader.js +1 -0
- package/esm/cascader/token.js +9 -3
- package/esm/cascader/type.d.ts +21 -15
- package/esm/cascader/type.d.ts.map +1 -1
- package/esm/checkbox/token.js +5 -1
- package/esm/checkbox/type.d.ts +13 -13
- package/esm/collapse/token.js +9 -1
- package/esm/collapse/type.d.ts +25 -25
- package/esm/config.d.ts +19 -4
- package/esm/config.d.ts.map +1 -1
- package/esm/config.js +50 -10
- package/esm/date-picker/date-picker.d.ts.map +1 -1
- package/esm/date-picker/date-picker.js +1 -0
- package/esm/date-picker/token.js +1 -0
- package/esm/date-picker/type.d.ts +6 -0
- package/esm/date-picker/type.d.ts.map +1 -1
- package/esm/descriptions/descriptions.d.ts.map +1 -1
- package/esm/descriptions/descriptions.js +5 -7
- package/esm/descriptions/rule.js +3 -3
- package/esm/descriptions/token.js +33 -24
- package/esm/descriptions/type.d.ts +41 -53
- package/esm/descriptions/type.d.ts.map +1 -1
- package/esm/dropdown/token.js +13 -1
- package/esm/dropdown/type.d.ts +50 -50
- package/esm/form/token.js +8 -2
- package/esm/form/type.d.ts +11 -11
- package/esm/icon/icon.d.ts +2 -2
- package/esm/icon/icon.d.ts.map +1 -1
- package/esm/icon/icon.js +2 -2
- package/esm/icon/token.js +3 -1
- package/esm/icon/type.d.ts +1 -1
- package/esm/image/token.js +2 -1
- package/esm/image/type.d.ts +1 -1
- package/esm/index.d.ts +3 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +14 -0
- package/esm/input/token.js +5 -1
- package/esm/input/type.d.ts +12 -12
- package/esm/list/token.js +4 -1
- package/esm/list/type.d.ts +12 -12
- package/esm/menu/token.js +8 -1
- package/esm/menu/type.d.ts +29 -29
- package/esm/message/token.js +3 -1
- package/esm/message/type.d.ts +5 -5
- package/esm/modal/modal.d.ts.map +1 -1
- package/esm/modal/modal.js +2 -1
- package/esm/modal/token.js +17 -2
- package/esm/modal/type.d.ts +34 -28
- package/esm/modal/type.d.ts.map +1 -1
- package/esm/popover/token.js +2 -1
- package/esm/popover/type.d.ts +1 -1
- package/esm/progress/token.js +6 -1
- package/esm/progress/type.d.ts +18 -18
- package/esm/radio/token.js +8 -1
- package/esm/radio/type.d.ts +14 -14
- package/esm/rate/rate.js +1 -1
- package/esm/rate/token.js +4 -2
- package/esm/rate/type.d.ts +7 -7
- package/esm/select/select.d.ts.map +1 -1
- package/esm/select/select.js +1 -0
- package/esm/select/token.js +7 -2
- package/esm/select/type.d.ts +17 -11
- package/esm/select/type.d.ts.map +1 -1
- package/esm/slider/slider.js +1 -1
- package/esm/slider/token.js +8 -2
- package/esm/slider/type.d.ts +25 -25
- package/esm/slider/type.d.ts.map +1 -1
- package/esm/spin/token.js +2 -1
- package/esm/spin/type.d.ts +1 -1
- package/esm/steps/token.js +2 -1
- package/esm/steps/type.d.ts +1 -1
- package/esm/sticky/token.js +1 -1
- package/esm/sticky/type.d.ts +1 -1
- package/esm/switch/token.js +6 -1
- package/esm/switch/type.d.ts +32 -32
- package/esm/table/token.js +13 -1
- package/esm/table/type.d.ts +28 -28
- package/esm/tabs/token.js +6 -1
- package/esm/tabs/type.d.ts +7 -7
- package/esm/tag/token.js +4 -2
- package/esm/tag/type.d.ts +168 -168
- package/esm/textarea/token.js +6 -1
- package/esm/textarea/type.d.ts +29 -29
- package/esm/tooltip/token.js +4 -2
- package/esm/tooltip/tooltip.js +1 -1
- package/esm/tooltip/type.d.ts +5 -5
- package/esm/transfer/token.js +3 -1
- package/esm/transfer/type.d.ts +2 -2
- package/esm/tree/token.js +5 -1
- package/esm/tree/type.d.ts +13 -13
- package/esm/tree-select/token.js +5 -2
- package/esm/tree-select/tree-select.d.ts.map +1 -1
- package/esm/tree-select/tree-select.js +1 -0
- package/esm/tree-select/type.d.ts +9 -3
- package/esm/tree-select/type.d.ts.map +1 -1
- package/esm/utils/css-var.d.ts +1 -0
- package/esm/utils/css-var.d.ts.map +1 -1
- package/esm/utils/css-var.js +4 -1
- package/esm/utils/notification.d.ts +16 -0
- package/esm/utils/notification.d.ts.map +1 -0
- package/esm/utils/notification.js +52 -0
- package/esm/utils/token-setter.d.ts +57 -0
- package/esm/utils/token-setter.d.ts.map +1 -0
- package/esm/utils/token-setter.js +74 -0
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Tokens } from '../token/type';
|
|
2
|
+
export interface Attributes {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface Options {
|
|
6
|
+
/**
|
|
7
|
+
* @cn 承载 token 标签的文档挂载点,默认为 document.head
|
|
8
|
+
* @en The document mount point that carries the token tag, default is document.head
|
|
9
|
+
* @default document.head
|
|
10
|
+
*/
|
|
11
|
+
target?: string | HTMLElement | null | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* @cn 承载 token 的标签,默认为 style 标签
|
|
14
|
+
* @en The tag that carries the token, default is the style tag
|
|
15
|
+
* @default 'style'
|
|
16
|
+
*/
|
|
17
|
+
tagName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @cn 生效 token 的选择器,默认为 body,语法为 css 选择器
|
|
20
|
+
* @en The selector of the effective token, default is body, the syntax is css selector
|
|
21
|
+
* @default 'body'
|
|
22
|
+
*/
|
|
23
|
+
selector?: string;
|
|
24
|
+
/**
|
|
25
|
+
* @cn token 的名称,将作为自定义属性插入标签,默认为 data-token
|
|
26
|
+
* @en The name of the token, which will be inserted as a custom attribute into the tag, default is data-token
|
|
27
|
+
* @default 'data-token'
|
|
28
|
+
*/
|
|
29
|
+
tokenName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @cn 标签的自定义属性
|
|
32
|
+
* @en Custom attributes of the tag
|
|
33
|
+
* @default undefined
|
|
34
|
+
*/
|
|
35
|
+
attributes?: Attributes;
|
|
36
|
+
/**
|
|
37
|
+
* @cn 生效 token 的选择器,默认为 body,语法为 css 选择器
|
|
38
|
+
* @en The selector of the effective token, default is body, the syntax is css selector
|
|
39
|
+
* @default 'body'
|
|
40
|
+
*/
|
|
41
|
+
token?: Tokens;
|
|
42
|
+
/**
|
|
43
|
+
* @cn 是否只生效关键 token,默认为 false
|
|
44
|
+
* @en Whether only the key token is effective, default is false
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
onlyExtra?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @cn 关键 token 列表
|
|
50
|
+
* @en Key token list
|
|
51
|
+
* @default undefined
|
|
52
|
+
*/
|
|
53
|
+
extraToken?: string[];
|
|
54
|
+
}
|
|
55
|
+
declare const setToken: (options?: Options) => void;
|
|
56
|
+
export default setToken;
|
|
57
|
+
//# sourceMappingURL=token-setter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-setter.d.ts","sourceRoot":"","sources":["token-setter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvC,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAUD,QAAA,MAAM,QAAQ,aAAc,OAAO,SA4DlC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
9
|
+
require("core-js/modules/es.array.filter.js");
|
|
10
|
+
require("core-js/modules/es.array.includes.js");
|
|
11
|
+
require("core-js/modules/es.string.includes.js");
|
|
12
|
+
require("core-js/modules/es.array.concat.js");
|
|
13
|
+
var _token = _interopRequireDefault(require("../token/token"));
|
|
14
|
+
var _cssVar = require("../utils/css-var");
|
|
15
|
+
var _config = require("../config");
|
|
16
|
+
var getExtraToken = function getExtraToken(prefix) {
|
|
17
|
+
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)"];
|
|
18
|
+
};
|
|
19
|
+
var setToken = function setToken(options) {
|
|
20
|
+
var _ref = options || {},
|
|
21
|
+
_ref$tagName = _ref.tagName,
|
|
22
|
+
tagName = _ref$tagName === void 0 ? 'style' : _ref$tagName,
|
|
23
|
+
_ref$selector = _ref.selector,
|
|
24
|
+
selector = _ref$selector === void 0 ? 'body' : _ref$selector,
|
|
25
|
+
target = _ref.target,
|
|
26
|
+
tokenName = _ref.tokenName,
|
|
27
|
+
token = _ref.token,
|
|
28
|
+
attributes = _ref.attributes,
|
|
29
|
+
onlyExtra = _ref.onlyExtra,
|
|
30
|
+
customExtraToken = _ref.extraToken;
|
|
31
|
+
var _getConfig = (0, _config.getConfig)(),
|
|
32
|
+
prefix = _getConfig.prefix;
|
|
33
|
+
var tag = document.createElement(tagName);
|
|
34
|
+
var tokens = [];
|
|
35
|
+
var defaultToken = token || _token.default;
|
|
36
|
+
var extraToken = getExtraToken(prefix);
|
|
37
|
+
if (onlyExtra) {
|
|
38
|
+
Object.keys(defaultToken).filter(function (item) {
|
|
39
|
+
return (customExtraToken || ['Brand-6', 'Neutral-6']).includes(item);
|
|
40
|
+
}).forEach(function (key) {
|
|
41
|
+
var token = "--".concat(prefix, "-").concat((0, _cssVar.replaceNonAlphanumeric)(key), ":").concat(_token.default[key]);
|
|
42
|
+
tokens.push(token);
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
Object.keys(defaultToken).forEach(function (key) {
|
|
46
|
+
var token = "--".concat(prefix, "-").concat((0, _cssVar.replaceNonAlphanumeric)(key), ":").concat(_token.default[key]);
|
|
47
|
+
tokens.push(token);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (attributes) {
|
|
51
|
+
Object.keys(attributes).forEach(function (key) {
|
|
52
|
+
tag.setAttribute(key, attributes[key]);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
tag.setAttribute('data-token', tokenName || '');
|
|
56
|
+
tag.innerHTML = "".concat(selector, " {").concat(tokens.concat(extraToken).join(';'), "}");
|
|
57
|
+
if (!target) {
|
|
58
|
+
document.head.appendChild(tag);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (target && target instanceof HTMLElement) {
|
|
62
|
+
target.appendChild(tag);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (typeof target === 'string') {
|
|
66
|
+
var el = document.getElementById(target);
|
|
67
|
+
if (el instanceof HTMLElement) {
|
|
68
|
+
el.appendChild(tag);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var _default = setToken;
|
|
74
|
+
exports.default = _default;
|