@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.
Files changed (227) hide show
  1. package/cjs/alert/token.js +4 -1
  2. package/cjs/alert/type.d.ts +4 -4
  3. package/cjs/breadcrumb/token.js +6 -1
  4. package/cjs/breadcrumb/type.d.ts +16 -16
  5. package/cjs/button/token.js +2 -1
  6. package/cjs/button/type.d.ts +1 -1
  7. package/cjs/card/token.js +6 -1
  8. package/cjs/card/type.d.ts +13 -13
  9. package/cjs/cascader/cascader.d.ts.map +1 -1
  10. package/cjs/cascader/cascader.js +1 -0
  11. package/cjs/cascader/token.js +9 -3
  12. package/cjs/cascader/type.d.ts +21 -15
  13. package/cjs/cascader/type.d.ts.map +1 -1
  14. package/cjs/checkbox/token.js +5 -1
  15. package/cjs/checkbox/type.d.ts +13 -13
  16. package/cjs/collapse/token.js +9 -1
  17. package/cjs/collapse/type.d.ts +25 -25
  18. package/cjs/config.d.ts +19 -4
  19. package/cjs/config.d.ts.map +1 -1
  20. package/cjs/config.js +50 -10
  21. package/cjs/date-picker/date-picker.d.ts.map +1 -1
  22. package/cjs/date-picker/date-picker.js +1 -0
  23. package/cjs/date-picker/token.js +1 -0
  24. package/cjs/date-picker/type.d.ts +6 -0
  25. package/cjs/date-picker/type.d.ts.map +1 -1
  26. package/cjs/descriptions/descriptions.d.ts.map +1 -1
  27. package/cjs/descriptions/descriptions.js +5 -7
  28. package/cjs/descriptions/rule.js +3 -3
  29. package/cjs/descriptions/token.js +33 -24
  30. package/cjs/descriptions/type.d.ts +41 -53
  31. package/cjs/descriptions/type.d.ts.map +1 -1
  32. package/cjs/dropdown/token.js +13 -1
  33. package/cjs/dropdown/type.d.ts +50 -50
  34. package/cjs/form/token.js +8 -2
  35. package/cjs/form/type.d.ts +11 -11
  36. package/cjs/icon/icon.d.ts +2 -2
  37. package/cjs/icon/icon.d.ts.map +1 -1
  38. package/cjs/icon/icon.js +2 -2
  39. package/cjs/icon/token.js +3 -1
  40. package/cjs/icon/type.d.ts +1 -1
  41. package/cjs/image/token.js +2 -1
  42. package/cjs/image/type.d.ts +1 -1
  43. package/cjs/index.d.ts +3 -1
  44. package/cjs/index.d.ts.map +1 -1
  45. package/cjs/index.js +14 -0
  46. package/cjs/input/token.js +5 -1
  47. package/cjs/input/type.d.ts +12 -12
  48. package/cjs/list/token.js +4 -1
  49. package/cjs/list/type.d.ts +12 -12
  50. package/cjs/menu/token.js +8 -1
  51. package/cjs/menu/type.d.ts +29 -29
  52. package/cjs/message/token.js +3 -1
  53. package/cjs/message/type.d.ts +5 -5
  54. package/cjs/modal/modal.d.ts.map +1 -1
  55. package/cjs/modal/modal.js +2 -1
  56. package/cjs/modal/token.js +17 -2
  57. package/cjs/modal/type.d.ts +34 -28
  58. package/cjs/modal/type.d.ts.map +1 -1
  59. package/cjs/popover/token.js +2 -1
  60. package/cjs/popover/type.d.ts +1 -1
  61. package/cjs/progress/token.js +6 -1
  62. package/cjs/progress/type.d.ts +18 -18
  63. package/cjs/radio/token.js +8 -1
  64. package/cjs/radio/type.d.ts +14 -14
  65. package/cjs/rate/rate.js +1 -1
  66. package/cjs/rate/token.js +4 -2
  67. package/cjs/rate/type.d.ts +7 -7
  68. package/cjs/select/select.d.ts.map +1 -1
  69. package/cjs/select/select.js +1 -0
  70. package/cjs/select/token.js +7 -2
  71. package/cjs/select/type.d.ts +17 -11
  72. package/cjs/select/type.d.ts.map +1 -1
  73. package/cjs/slider/slider.js +1 -1
  74. package/cjs/slider/token.js +8 -2
  75. package/cjs/slider/type.d.ts +25 -25
  76. package/cjs/slider/type.d.ts.map +1 -1
  77. package/cjs/spin/token.js +2 -1
  78. package/cjs/spin/type.d.ts +1 -1
  79. package/cjs/steps/token.js +2 -1
  80. package/cjs/steps/type.d.ts +1 -1
  81. package/cjs/sticky/token.js +1 -1
  82. package/cjs/sticky/type.d.ts +1 -1
  83. package/cjs/switch/token.js +6 -1
  84. package/cjs/switch/type.d.ts +32 -32
  85. package/cjs/table/token.js +13 -1
  86. package/cjs/table/type.d.ts +28 -28
  87. package/cjs/tabs/token.js +6 -1
  88. package/cjs/tabs/type.d.ts +7 -7
  89. package/cjs/tag/token.js +4 -2
  90. package/cjs/tag/type.d.ts +168 -168
  91. package/cjs/textarea/token.js +6 -1
  92. package/cjs/textarea/type.d.ts +29 -29
  93. package/cjs/tooltip/token.js +4 -2
  94. package/cjs/tooltip/tooltip.js +1 -1
  95. package/cjs/tooltip/type.d.ts +5 -5
  96. package/cjs/transfer/token.js +3 -1
  97. package/cjs/transfer/type.d.ts +2 -2
  98. package/cjs/tree/token.js +5 -1
  99. package/cjs/tree/type.d.ts +13 -13
  100. package/cjs/tree-select/token.js +5 -2
  101. package/cjs/tree-select/tree-select.d.ts.map +1 -1
  102. package/cjs/tree-select/tree-select.js +1 -0
  103. package/cjs/tree-select/type.d.ts +9 -3
  104. package/cjs/tree-select/type.d.ts.map +1 -1
  105. package/cjs/utils/css-var.d.ts +1 -0
  106. package/cjs/utils/css-var.d.ts.map +1 -1
  107. package/cjs/utils/css-var.js +4 -1
  108. package/cjs/utils/notification.d.ts +16 -0
  109. package/cjs/utils/notification.d.ts.map +1 -0
  110. package/cjs/utils/notification.js +52 -0
  111. package/cjs/utils/token-setter.d.ts +57 -0
  112. package/cjs/utils/token-setter.d.ts.map +1 -0
  113. package/cjs/utils/token-setter.js +74 -0
  114. package/esm/alert/token.js +4 -1
  115. package/esm/alert/type.d.ts +4 -4
  116. package/esm/breadcrumb/token.js +6 -1
  117. package/esm/breadcrumb/type.d.ts +16 -16
  118. package/esm/button/token.js +2 -1
  119. package/esm/button/type.d.ts +1 -1
  120. package/esm/card/token.js +6 -1
  121. package/esm/card/type.d.ts +13 -13
  122. package/esm/cascader/cascader.d.ts.map +1 -1
  123. package/esm/cascader/cascader.js +1 -0
  124. package/esm/cascader/token.js +9 -3
  125. package/esm/cascader/type.d.ts +21 -15
  126. package/esm/cascader/type.d.ts.map +1 -1
  127. package/esm/checkbox/token.js +5 -1
  128. package/esm/checkbox/type.d.ts +13 -13
  129. package/esm/collapse/token.js +9 -1
  130. package/esm/collapse/type.d.ts +25 -25
  131. package/esm/config.d.ts +19 -4
  132. package/esm/config.d.ts.map +1 -1
  133. package/esm/config.js +50 -10
  134. package/esm/date-picker/date-picker.d.ts.map +1 -1
  135. package/esm/date-picker/date-picker.js +1 -0
  136. package/esm/date-picker/token.js +1 -0
  137. package/esm/date-picker/type.d.ts +6 -0
  138. package/esm/date-picker/type.d.ts.map +1 -1
  139. package/esm/descriptions/descriptions.d.ts.map +1 -1
  140. package/esm/descriptions/descriptions.js +5 -7
  141. package/esm/descriptions/rule.js +3 -3
  142. package/esm/descriptions/token.js +33 -24
  143. package/esm/descriptions/type.d.ts +41 -53
  144. package/esm/descriptions/type.d.ts.map +1 -1
  145. package/esm/dropdown/token.js +13 -1
  146. package/esm/dropdown/type.d.ts +50 -50
  147. package/esm/form/token.js +8 -2
  148. package/esm/form/type.d.ts +11 -11
  149. package/esm/icon/icon.d.ts +2 -2
  150. package/esm/icon/icon.d.ts.map +1 -1
  151. package/esm/icon/icon.js +2 -2
  152. package/esm/icon/token.js +3 -1
  153. package/esm/icon/type.d.ts +1 -1
  154. package/esm/image/token.js +2 -1
  155. package/esm/image/type.d.ts +1 -1
  156. package/esm/index.d.ts +3 -1
  157. package/esm/index.d.ts.map +1 -1
  158. package/esm/index.js +14 -0
  159. package/esm/input/token.js +5 -1
  160. package/esm/input/type.d.ts +12 -12
  161. package/esm/list/token.js +4 -1
  162. package/esm/list/type.d.ts +12 -12
  163. package/esm/menu/token.js +8 -1
  164. package/esm/menu/type.d.ts +29 -29
  165. package/esm/message/token.js +3 -1
  166. package/esm/message/type.d.ts +5 -5
  167. package/esm/modal/modal.d.ts.map +1 -1
  168. package/esm/modal/modal.js +2 -1
  169. package/esm/modal/token.js +17 -2
  170. package/esm/modal/type.d.ts +34 -28
  171. package/esm/modal/type.d.ts.map +1 -1
  172. package/esm/popover/token.js +2 -1
  173. package/esm/popover/type.d.ts +1 -1
  174. package/esm/progress/token.js +6 -1
  175. package/esm/progress/type.d.ts +18 -18
  176. package/esm/radio/token.js +8 -1
  177. package/esm/radio/type.d.ts +14 -14
  178. package/esm/rate/rate.js +1 -1
  179. package/esm/rate/token.js +4 -2
  180. package/esm/rate/type.d.ts +7 -7
  181. package/esm/select/select.d.ts.map +1 -1
  182. package/esm/select/select.js +1 -0
  183. package/esm/select/token.js +7 -2
  184. package/esm/select/type.d.ts +17 -11
  185. package/esm/select/type.d.ts.map +1 -1
  186. package/esm/slider/slider.js +1 -1
  187. package/esm/slider/token.js +8 -2
  188. package/esm/slider/type.d.ts +25 -25
  189. package/esm/slider/type.d.ts.map +1 -1
  190. package/esm/spin/token.js +2 -1
  191. package/esm/spin/type.d.ts +1 -1
  192. package/esm/steps/token.js +2 -1
  193. package/esm/steps/type.d.ts +1 -1
  194. package/esm/sticky/token.js +1 -1
  195. package/esm/sticky/type.d.ts +1 -1
  196. package/esm/switch/token.js +6 -1
  197. package/esm/switch/type.d.ts +32 -32
  198. package/esm/table/token.js +13 -1
  199. package/esm/table/type.d.ts +28 -28
  200. package/esm/tabs/token.js +6 -1
  201. package/esm/tabs/type.d.ts +7 -7
  202. package/esm/tag/token.js +4 -2
  203. package/esm/tag/type.d.ts +168 -168
  204. package/esm/textarea/token.js +6 -1
  205. package/esm/textarea/type.d.ts +29 -29
  206. package/esm/tooltip/token.js +4 -2
  207. package/esm/tooltip/tooltip.js +1 -1
  208. package/esm/tooltip/type.d.ts +5 -5
  209. package/esm/transfer/token.js +3 -1
  210. package/esm/transfer/type.d.ts +2 -2
  211. package/esm/tree/token.js +5 -1
  212. package/esm/tree/type.d.ts +13 -13
  213. package/esm/tree-select/token.js +5 -2
  214. package/esm/tree-select/tree-select.d.ts.map +1 -1
  215. package/esm/tree-select/tree-select.js +1 -0
  216. package/esm/tree-select/type.d.ts +9 -3
  217. package/esm/tree-select/type.d.ts.map +1 -1
  218. package/esm/utils/css-var.d.ts +1 -0
  219. package/esm/utils/css-var.d.ts.map +1 -1
  220. package/esm/utils/css-var.js +4 -1
  221. package/esm/utils/notification.d.ts +16 -0
  222. package/esm/utils/notification.d.ts.map +1 -0
  223. package/esm/utils/notification.js +52 -0
  224. package/esm/utils/token-setter.d.ts +57 -0
  225. package/esm/utils/token-setter.d.ts.map +1 -0
  226. package/esm/utils/token-setter.js +74 -0
  227. 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/theme",
3
- "version": "3.0.0-alpha.27",
3
+ "version": "3.0.0-alpha.29",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",