gant-core 0.1.13 → 0.1.14
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/lib/cli/index.js +1 -1
- package/lib/index.d.ts +15 -2
- package/lib/index.js +74 -51
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -1
package/lib/cli/index.js
CHANGED
|
@@ -51294,7 +51294,7 @@ const createCwdConfig = (cwd, name, vue) => {
|
|
|
51294
51294
|
};
|
|
51295
51295
|
|
|
51296
51296
|
var name = "gant-core";
|
|
51297
|
-
var version = "0.1.
|
|
51297
|
+
var version = "0.1.14";
|
|
51298
51298
|
var description = "";
|
|
51299
51299
|
var main = "lib/index.js";
|
|
51300
51300
|
var bin = {
|
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from 'axios';
|
|
|
7
7
|
import * as mitt from 'mitt';
|
|
8
8
|
import * as i18next from 'i18next';
|
|
9
9
|
import { InitOptions, Callback } from 'i18next';
|
|
10
|
+
import { TinyColor } from '@ctrl/tinycolor';
|
|
10
11
|
|
|
11
12
|
declare const PresetColors: readonly ["blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
|
|
12
13
|
type PresetColorKey = (typeof PresetColors)[number];
|
|
@@ -265,6 +266,7 @@ interface SeedToken extends PresetColorType {
|
|
|
265
266
|
* @default 40
|
|
266
267
|
*/
|
|
267
268
|
layoutNavHeight: number;
|
|
269
|
+
gradientColors: string[];
|
|
268
270
|
}
|
|
269
271
|
|
|
270
272
|
interface ColorNeutralMapToken {
|
|
@@ -729,6 +731,16 @@ interface ColorErrorMapToken {
|
|
|
729
731
|
*/
|
|
730
732
|
colorErrorTextActive: string;
|
|
731
733
|
}
|
|
734
|
+
interface ColorGradientToken {
|
|
735
|
+
gradientTop: string;
|
|
736
|
+
gradientBottom: string;
|
|
737
|
+
gradientLeft: string;
|
|
738
|
+
gradientRight: string;
|
|
739
|
+
gradientTopLeft: string;
|
|
740
|
+
gradientTopRight: string;
|
|
741
|
+
gradientBottomLeft: string;
|
|
742
|
+
gradientBottomRight: string;
|
|
743
|
+
}
|
|
732
744
|
interface ColorLinkMapToken {
|
|
733
745
|
/**
|
|
734
746
|
* @nameZH 超链接颜色
|
|
@@ -752,7 +764,7 @@ interface ColorLinkMapToken {
|
|
|
752
764
|
*/
|
|
753
765
|
colorLinkActive: string;
|
|
754
766
|
}
|
|
755
|
-
interface ColorMapToken extends ColorNeutralMapToken, ColorPrimaryMapToken, ColorSuccessMapToken, ColorWarningMapToken, ColorErrorMapToken, ColorInfoMapToken, ColorLinkMapToken {
|
|
767
|
+
interface ColorMapToken extends ColorGradientToken, ColorNeutralMapToken, ColorPrimaryMapToken, ColorSuccessMapToken, ColorWarningMapToken, ColorErrorMapToken, ColorInfoMapToken, ColorLinkMapToken {
|
|
756
768
|
/**
|
|
757
769
|
* @nameZH 纯白色
|
|
758
770
|
* @desc 不随主题变化的纯白色
|
|
@@ -1633,6 +1645,7 @@ declare function getTokenCssVar(data: any, prefix?: string): any;
|
|
|
1633
1645
|
declare const getAlphaColor: (baseColor: string, alpha: number) => string;
|
|
1634
1646
|
declare const getDarkenSolidColor: (baseColor: string, brightness: number) => string;
|
|
1635
1647
|
declare const getLightenSolidColor: (baseColor: string, brightness: number) => string;
|
|
1648
|
+
declare const getBackgroundColor: (baseColor: string, bgBaseColor: string) => TinyColor;
|
|
1636
1649
|
|
|
1637
1650
|
declare const token: AliasToken;
|
|
1638
1651
|
|
|
@@ -2320,4 +2333,4 @@ interface MainOptions extends GlobalOptions {
|
|
|
2320
2333
|
}
|
|
2321
2334
|
declare const _default: ({ microServiceMap, secret, dynamicLangCallback, ...globalOptions }: MainOptions) => Promise<boolean>;
|
|
2322
2335
|
|
|
2323
|
-
export { type AliasToken, type BASE_CONFIG_TYPE, type CONFIG_TYPE, type ColorMapToken, type ColorNeutralMapToken, type ColorPalettes, type CommonMapToken, type DerivativeFunc, type FontMapToken, type GantAxiosRequestConfig, type GantServerOptions, type GlobalOptions, type GlobalToken, type HeightMapToken, type InternalAxiosRequestConfig, type LOGIN_CONFIG, type Language, type LegacyColorPalettes, type LoginResultData, type MAIN_CONFIG_TYPE, MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, type MainOptions, type MapToken, type MappingAlgorithm, PROGRESS_UPDEDATE, type Perferences, type PresetColorKey, type PresetColorType, PresetColors, type ProductInfo, type SSOConfigType, type SYSMGMT_CONFIG_TYPE, type SeedToken, type ServerMenu, type ServerMenuData, type ServerMenuMap, type SizeMapToken, type StyleMapToken, type THEME_TYPE, type ThemeType, type TokenType, type User, type UserAggregateInfo, type GantUserConfig as UserConfig, type UserIdentityType, WS_CONTENT_CLOSE, WS_CONTENT_ERROR, WS_CONTENT_SUCCESS, codeListStore, derivative as compactAlgorithm, _default$1 as companydataStore, derivative$1 as darkAlgorithm, decryptByAES, derivative$2 as defaultAlgorithm, emitter, encryptByAES, expireCache, formatToken as formatAliasToken, getAliasToken, getAlphaColor, getAntdLocaleKey, getDarkenSolidColor, getLightenSolidColor, getLocaleKey, getMaskHeaderKey, getRoutes, getSecretKey, getTokenCssVar, getTraceId, globalStore, _default as init, initDynamicLang, lighten, loginStore, menuStore, parameterStore, Progress as progress, request, requestInstance, seedToken as seed, setLocaleKey, storage as storageStore, toBase64, token, tr, useRequestHeader, useRequestMicroSevices, useResponsedecryptParse, userStore, websocket };
|
|
2336
|
+
export { type AliasToken, type BASE_CONFIG_TYPE, type CONFIG_TYPE, type ColorGradientToken, type ColorMapToken, type ColorNeutralMapToken, type ColorPalettes, type CommonMapToken, type DerivativeFunc, type FontMapToken, type GantAxiosRequestConfig, type GantServerOptions, type GlobalOptions, type GlobalToken, type HeightMapToken, type InternalAxiosRequestConfig, type LOGIN_CONFIG, type Language, type LegacyColorPalettes, type LoginResultData, type MAIN_CONFIG_TYPE, MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, type MainOptions, type MapToken, type MappingAlgorithm, PROGRESS_UPDEDATE, type Perferences, type PresetColorKey, type PresetColorType, PresetColors, type ProductInfo, type SSOConfigType, type SYSMGMT_CONFIG_TYPE, type SeedToken, type ServerMenu, type ServerMenuData, type ServerMenuMap, type SizeMapToken, type StyleMapToken, type THEME_TYPE, type ThemeType, type TokenType, type User, type UserAggregateInfo, type GantUserConfig as UserConfig, type UserIdentityType, WS_CONTENT_CLOSE, WS_CONTENT_ERROR, WS_CONTENT_SUCCESS, codeListStore, derivative as compactAlgorithm, _default$1 as companydataStore, derivative$1 as darkAlgorithm, decryptByAES, derivative$2 as defaultAlgorithm, emitter, encryptByAES, expireCache, formatToken as formatAliasToken, getAliasToken, getAlphaColor, getAntdLocaleKey, getBackgroundColor, getDarkenSolidColor, getLightenSolidColor, getLocaleKey, getMaskHeaderKey, getRoutes, getSecretKey, getTokenCssVar, getTraceId, globalStore, _default as init, initDynamicLang, lighten, loginStore, menuStore, parameterStore, Progress as progress, request, requestInstance, seedToken as seed, setLocaleKey, storage as storageStore, toBase64, token, tr, useRequestHeader, useRequestMicroSevices, useResponsedecryptParse, userStore, websocket };
|
package/lib/index.js
CHANGED
|
@@ -5423,12 +5423,83 @@ const seedToken = {
|
|
|
5423
5423
|
wireframe: false,
|
|
5424
5424
|
// Motion
|
|
5425
5425
|
motion: true,
|
|
5426
|
+
//布局相关
|
|
5426
5427
|
layoutHeaderHeight: 50,
|
|
5427
5428
|
layoutSiderWidth: 200,
|
|
5428
5429
|
layoutIconSize: 24,
|
|
5429
5430
|
layoutNavHeight: 40,
|
|
5431
|
+
//渐变色
|
|
5432
|
+
gradientColors: ['#0040ED', '#00E5ED'],
|
|
5430
5433
|
};
|
|
5431
5434
|
|
|
5435
|
+
/**
|
|
5436
|
+
* Sums the passed percentage to the R, G or B of a HEX color
|
|
5437
|
+
* @param {string} color The color to change
|
|
5438
|
+
* @param {number} amount The amount to change the color by
|
|
5439
|
+
* @returns {string} The processed part of the color
|
|
5440
|
+
*/
|
|
5441
|
+
function addLight(color, amount) {
|
|
5442
|
+
const cc = parseInt(color, 16) + amount;
|
|
5443
|
+
const c = cc > 255 ? 255 : cc;
|
|
5444
|
+
return c.toString(16).length > 1 ? c.toString(16) : `0${c.toString(16)}`;
|
|
5445
|
+
}
|
|
5446
|
+
/**
|
|
5447
|
+
* Lightens a 6 char HEX color according to the passed percentage
|
|
5448
|
+
* @param {string} color The color to change
|
|
5449
|
+
* @param {number} amount The amount to change the color by
|
|
5450
|
+
* @returns {string} The processed color represented as HEX
|
|
5451
|
+
*/
|
|
5452
|
+
function lighten(color, amount) {
|
|
5453
|
+
color = color.indexOf('#') >= 0 ? color.substring(1, color.length) : color;
|
|
5454
|
+
amount = Math.trunc((255 * amount) / 100);
|
|
5455
|
+
return `#${addLight(color.substring(0, 2), amount)}${addLight(color.substring(2, 4), amount)}${addLight(color.substring(4, 6), amount)}`;
|
|
5456
|
+
}
|
|
5457
|
+
function getTokenCssVar(data, prefix) {
|
|
5458
|
+
if (typeof data !== 'object' || Array.isArray(data))
|
|
5459
|
+
return;
|
|
5460
|
+
const tokenCss = {};
|
|
5461
|
+
mapValues(data, (itemValue, name) => {
|
|
5462
|
+
const varName = prefix ? '--' + `${prefix}-` + name : '--' + name;
|
|
5463
|
+
const value = typeof itemValue === 'number' &&
|
|
5464
|
+
!['lineheight', 'opacity', 'weight'].some((key) => toLower(name).includes(key))
|
|
5465
|
+
? itemValue + 'px'
|
|
5466
|
+
: itemValue;
|
|
5467
|
+
if (isObject(itemValue))
|
|
5468
|
+
return getTokenCssVar(value, name);
|
|
5469
|
+
tokenCss[varName] = value;
|
|
5470
|
+
});
|
|
5471
|
+
return tokenCss;
|
|
5472
|
+
}
|
|
5473
|
+
const getAlphaColor$1 = (baseColor, alpha) => {
|
|
5474
|
+
return new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
5475
|
+
};
|
|
5476
|
+
const getDarkenSolidColor = (baseColor, brightness) => {
|
|
5477
|
+
const instance = new TinyColor(baseColor);
|
|
5478
|
+
return instance.darken(brightness).toHexString();
|
|
5479
|
+
};
|
|
5480
|
+
const getLightenSolidColor = (baseColor, brightness) => {
|
|
5481
|
+
const instance = new TinyColor(baseColor);
|
|
5482
|
+
return instance.lighten(brightness).toHexString();
|
|
5483
|
+
};
|
|
5484
|
+
const getBackgroundColor = (baseColor, bgBaseColor) => {
|
|
5485
|
+
const color = new TinyColor(baseColor);
|
|
5486
|
+
return color.onBackground(bgBaseColor);
|
|
5487
|
+
};
|
|
5488
|
+
|
|
5489
|
+
const generateGradientColorPalettes = (bgBaseColor, gradientColors) => {
|
|
5490
|
+
const startColor = getBackgroundColor(gradientColors[0], bgBaseColor);
|
|
5491
|
+
const endColor = getBackgroundColor(gradientColors[1], bgBaseColor);
|
|
5492
|
+
return {
|
|
5493
|
+
gradientBottom: `linear-gradient(to bottom, ${startColor}, ${endColor})`,
|
|
5494
|
+
gradientTop: `linear-gradient(to top, ${startColor}, ${endColor})`,
|
|
5495
|
+
gradientLeft: `linear-gradient(to left, ${startColor}, ${endColor})`,
|
|
5496
|
+
gradientRight: `linear-gradient(to right, ${startColor}, ${endColor})`,
|
|
5497
|
+
gradientTopLeft: `linear-gradient(to top left, ${startColor}, ${endColor})`,
|
|
5498
|
+
gradientTopRight: `linear-gradient(to top right, ${startColor}, ${endColor})`,
|
|
5499
|
+
gradientBottomLeft: `linear-gradient(to bottom left, ${startColor}, ${endColor})`,
|
|
5500
|
+
gradientBottomRight: `linear-gradient(to bottom right, ${startColor}, ${endColor})`,
|
|
5501
|
+
};
|
|
5502
|
+
};
|
|
5432
5503
|
function genColorMapToken(seed, { generateColorPalettes, generateNeutralColorPalettes }) {
|
|
5433
5504
|
const { colorSuccess: colorSuccessBase, colorWarning: colorWarningBase, colorError: colorErrorBase, colorInfo: colorInfoBase, colorPrimary: colorPrimaryBase, colorBgBase, colorTextBase, } = seed;
|
|
5434
5505
|
const primaryColors = generateColorPalettes(colorPrimaryBase);
|
|
@@ -5437,11 +5508,13 @@ function genColorMapToken(seed, { generateColorPalettes, generateNeutralColorPal
|
|
|
5437
5508
|
const errorColors = generateColorPalettes(colorErrorBase);
|
|
5438
5509
|
const infoColors = generateColorPalettes(colorInfoBase);
|
|
5439
5510
|
const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase);
|
|
5511
|
+
const gradientColors = generateGradientColorPalettes(colorBgBase, seed.gradientColors);
|
|
5440
5512
|
// Color Link
|
|
5441
5513
|
const colorLink = seed.colorLink || seed.colorInfo;
|
|
5442
5514
|
const linkColors = generateColorPalettes(colorLink);
|
|
5443
5515
|
return {
|
|
5444
5516
|
...neutralColors,
|
|
5517
|
+
...gradientColors,
|
|
5445
5518
|
colorPrimaryBg: primaryColors[1],
|
|
5446
5519
|
colorPrimaryBgHover: primaryColors[2],
|
|
5447
5520
|
colorPrimaryBorder: primaryColors[3],
|
|
@@ -5571,56 +5644,6 @@ function genCommonMapToken(token) {
|
|
|
5571
5644
|
};
|
|
5572
5645
|
}
|
|
5573
5646
|
|
|
5574
|
-
/**
|
|
5575
|
-
* Sums the passed percentage to the R, G or B of a HEX color
|
|
5576
|
-
* @param {string} color The color to change
|
|
5577
|
-
* @param {number} amount The amount to change the color by
|
|
5578
|
-
* @returns {string} The processed part of the color
|
|
5579
|
-
*/
|
|
5580
|
-
function addLight(color, amount) {
|
|
5581
|
-
const cc = parseInt(color, 16) + amount;
|
|
5582
|
-
const c = cc > 255 ? 255 : cc;
|
|
5583
|
-
return c.toString(16).length > 1 ? c.toString(16) : `0${c.toString(16)}`;
|
|
5584
|
-
}
|
|
5585
|
-
/**
|
|
5586
|
-
* Lightens a 6 char HEX color according to the passed percentage
|
|
5587
|
-
* @param {string} color The color to change
|
|
5588
|
-
* @param {number} amount The amount to change the color by
|
|
5589
|
-
* @returns {string} The processed color represented as HEX
|
|
5590
|
-
*/
|
|
5591
|
-
function lighten(color, amount) {
|
|
5592
|
-
color = color.indexOf('#') >= 0 ? color.substring(1, color.length) : color;
|
|
5593
|
-
amount = Math.trunc((255 * amount) / 100);
|
|
5594
|
-
return `#${addLight(color.substring(0, 2), amount)}${addLight(color.substring(2, 4), amount)}${addLight(color.substring(4, 6), amount)}`;
|
|
5595
|
-
}
|
|
5596
|
-
function getTokenCssVar(data, prefix) {
|
|
5597
|
-
if (typeof data !== 'object' || Array.isArray(data))
|
|
5598
|
-
return;
|
|
5599
|
-
const tokenCss = {};
|
|
5600
|
-
mapValues(data, (itemValue, name) => {
|
|
5601
|
-
const varName = prefix ? '--' + `${prefix}-` + name : '--' + name;
|
|
5602
|
-
const value = typeof itemValue === 'number' &&
|
|
5603
|
-
!['lineheight', 'opacity', 'weight'].some((key) => toLower(name).includes(key))
|
|
5604
|
-
? itemValue + 'px'
|
|
5605
|
-
: itemValue;
|
|
5606
|
-
if (isObject(itemValue))
|
|
5607
|
-
return getTokenCssVar(value, name);
|
|
5608
|
-
tokenCss[varName] = value;
|
|
5609
|
-
});
|
|
5610
|
-
return tokenCss;
|
|
5611
|
-
}
|
|
5612
|
-
const getAlphaColor$1 = (baseColor, alpha) => {
|
|
5613
|
-
return new TinyColor(baseColor).setAlpha(alpha).toRgbString();
|
|
5614
|
-
};
|
|
5615
|
-
const getDarkenSolidColor = (baseColor, brightness) => {
|
|
5616
|
-
const instance = new TinyColor(baseColor);
|
|
5617
|
-
return instance.darken(brightness).toHexString();
|
|
5618
|
-
};
|
|
5619
|
-
const getLightenSolidColor = (baseColor, brightness) => {
|
|
5620
|
-
const instance = new TinyColor(baseColor);
|
|
5621
|
-
return instance.lighten(brightness).toHexString();
|
|
5622
|
-
};
|
|
5623
|
-
|
|
5624
5647
|
const generateColorPalettes$1 = (baseColor) => {
|
|
5625
5648
|
const colors = generate(baseColor);
|
|
5626
5649
|
return {
|
|
@@ -6255,5 +6278,5 @@ var main = async ({ microServiceMap, secret, dynamicLangCallback, ...globalOptio
|
|
|
6255
6278
|
return res;
|
|
6256
6279
|
};
|
|
6257
6280
|
|
|
6258
|
-
export { MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, PROGRESS_UPDEDATE, PresetColors, WS_CONTENT_CLOSE, WS_CONTENT_ERROR, WS_CONTENT_SUCCESS, codeListStore, derivative$1 as compactAlgorithm, index as companydataStore, derivative$2 as darkAlgorithm, decryptByAES, derivative$3 as defaultAlgorithm, emitter, encryptByAES, expireCache, formatToken as formatAliasToken, getAliasToken, getAlphaColor$1 as getAlphaColor, getAntdLocaleKey, getDarkenSolidColor, getLightenSolidColor, getLocaleKey, getMaskHeaderKey, getRoutes, getSecretKey, getTokenCssVar, getTraceId, globalStore, main as init, initDynamicLang, lighten, loginStore, menuStore, parameterStore, Progress as progress, request, requestInstance, seedToken as seed, setLocaleKey, storage as storageStore, toBase64, token, tr, useRequestHeader, useRequestMicroSevices, useResponsedecryptParse, userStore, websocket };
|
|
6281
|
+
export { MENU_BREADCRUMBS_UPDATE, MENU_HISTORY_UPDATE, PROGRESS_UPDEDATE, PresetColors, WS_CONTENT_CLOSE, WS_CONTENT_ERROR, WS_CONTENT_SUCCESS, codeListStore, derivative$1 as compactAlgorithm, index as companydataStore, derivative$2 as darkAlgorithm, decryptByAES, derivative$3 as defaultAlgorithm, emitter, encryptByAES, expireCache, formatToken as formatAliasToken, getAliasToken, getAlphaColor$1 as getAlphaColor, getAntdLocaleKey, getBackgroundColor, getDarkenSolidColor, getLightenSolidColor, getLocaleKey, getMaskHeaderKey, getRoutes, getSecretKey, getTokenCssVar, getTraceId, globalStore, main as init, initDynamicLang, lighten, loginStore, menuStore, parameterStore, Progress as progress, request, requestInstance, seedToken as seed, setLocaleKey, storage as storageStore, toBase64, token, tr, useRequestHeader, useRequestMicroSevices, useResponsedecryptParse, userStore, websocket };
|
|
6259
6282
|
//# sourceMappingURL=index.js.map
|