pro-design-vue 1.2.7 → 1.2.9

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.
@@ -1,4 +1,4 @@
1
- /*! Pro Design Vue v1.2.7 */
1
+ /*! Pro Design Vue v1.2.9 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('ant-design-vue'), require('vue'), require('ant-design-vue/es/locale/zh_CN.js')) :
@@ -32,7 +32,7 @@
32
32
  const DEFAULT_NAMESPACE = "pro";
33
33
  const DEFAULT_LOCALE = "zh-CN";
34
34
 
35
- const version$1 = "1.2.7";
35
+ const version$1 = "1.2.9";
36
36
 
37
37
  const makeInstaller = (components = []) => {
38
38
  const install = (app) => {
@@ -3391,7 +3391,7 @@
3391
3391
  if (colorValue) {
3392
3392
  const hslColor = convertToHslCssVar(colorValue);
3393
3393
  colorVariables[`--${namespace}-${name}-${key}`] = hslColor;
3394
- if (alias) {
3394
+ if (alias && alias !== name) {
3395
3395
  colorVariables[`--${namespace}-${alias}-${key}`] = hslColor;
3396
3396
  }
3397
3397
  if (key === "500") {
@@ -8268,10 +8268,10 @@
8268
8268
  return vue.inject(proConfigProviderContextKey, {});
8269
8269
  };
8270
8270
 
8271
- function updateCSSVariables(variables, id = "__pro-styles__") {
8271
+ function updateCSSVariables(variables, className = ":root", id = "__pro-styles__") {
8272
8272
  const styleElement = document.querySelector(`#${id}`) || document.createElement("style");
8273
8273
  styleElement.id = id;
8274
- let cssText = ":root {";
8274
+ let cssText = className + " {";
8275
8275
  for (const key in variables) {
8276
8276
  if (Object.prototype.hasOwnProperty.call(variables, key)) {
8277
8277
  cssText += `${key}: ${variables[key]};`;
@@ -8309,18 +8309,24 @@
8309
8309
  vue.watch(
8310
8310
  [token, isDark],
8311
8311
  ([newToken, dark], [oldToken]) => {
8312
+ const changedColorVariables = [
8313
+ { alias: "primary", color: newToken.colorPrimary, name: "primary", key: "colorPrimary" },
8314
+ { alias: "warning", color: newToken.colorWarning, name: "yellow", key: "colorWarning" },
8315
+ { alias: "success", color: newToken.colorSuccess, name: "green", key: "colorSuccess" },
8316
+ { alias: "error", color: newToken.colorError, name: "red", key: "colorError" }
8317
+ ].filter((item) => {
8318
+ const defaultColor = dark ? defaultDarkToken[item.key] : defaultToken[item.key];
8319
+ const oldColor = (oldToken == null ? void 0 : oldToken[item.key]) || defaultColor;
8320
+ return newToken[item.key] !== defaultColor || newToken[item.key] === defaultColor && oldColor !== defaultColor;
8321
+ });
8312
8322
  const colorVariables = generatorColorVariables(
8313
- [
8314
- { color: newToken.colorPrimary, name: "primary", key: "colorPrimary" },
8315
- { alias: "warning", color: newToken.colorWarning, name: "yellow", key: "colorWarning" },
8316
- { alias: "success", color: newToken.colorSuccess, name: "green", key: "colorSuccess" },
8317
- { alias: "error", color: newToken.colorError, name: "red", key: "colorError" }
8318
- ].filter((item) => {
8319
- const defaultColor = dark ? defaultDarkToken[item.key] : defaultToken[item.key];
8320
- const oldColor = (oldToken == null ? void 0 : oldToken[item.key]) || defaultColor;
8321
- return newToken[item.key] !== defaultColor || newToken[item.key] === defaultColor && oldColor !== defaultColor;
8322
- }),
8323
- dark,
8323
+ changedColorVariables,
8324
+ false,
8325
+ DEFAULT_NAMESPACE
8326
+ );
8327
+ const darkColorVariables = generatorColorVariables(
8328
+ changedColorVariables,
8329
+ true,
8324
8330
  DEFAULT_NAMESPACE
8325
8331
  );
8326
8332
  const colorMappings = {
@@ -8336,6 +8342,11 @@
8336
8342
  }
8337
8343
  });
8338
8344
  updateCSSVariables(colorVariables);
8345
+ updateCSSVariables(
8346
+ darkColorVariables,
8347
+ ".dark, .dark[data-theme='custom'], .dark[data-theme='default']",
8348
+ "__pro-dark-styles__"
8349
+ );
8339
8350
  if (defaultToken.borderRadius !== newToken.borderRadius) {
8340
8351
  document.documentElement.style.setProperty(
8341
8352
  `--${DEFAULT_NAMESPACE}-radius`,