Skip to content

Commit 79785e8

Browse files
committed
chore: organize folders again
1 parent e37c94f commit 79785e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+641
-910
lines changed

packages/theme-generator/src/Generator.vue

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div id="theme-generator">
3-
<dock
2+
<div class="theme-generator">
3+
<float-dock
44
:drawerVisible="visible"
55
:showSetting="showSetting"
66
@click-setting="handleClickSetting"
@@ -11,25 +11,23 @@
1111
</template>
1212

1313
<script>
14-
import { applyTokenFromLocal, initThemeStyleSheet, syncThemeToIframe, themeStore } from './common/themes';
15-
import { initGeneratorVars } from './common/utils';
14+
import {
15+
applyTokenFromLocal,
16+
initGeneratorVars,
17+
initThemeStyleSheet,
18+
syncModeToGenerator,
19+
syncThemeToIframe,
20+
themeStore,
21+
} from './common/themes';
1622
17-
import Dock from './dock';
23+
import FloatDock from './float-dock';
1824
import PanelDrawer from './panel-drawer';
1925
20-
const activeTabMap = {
21-
color: 0,
22-
font: 1,
23-
radius: 2,
24-
shadow: 3,
25-
size: 4,
26-
};
27-
2826
export default {
2927
name: 'ThemeGenerator',
3028
components: {
29+
FloatDock,
3130
PanelDrawer,
32-
Dock,
3331
},
3432
props: {
3533
propsTop: String,
@@ -48,9 +46,7 @@ export default {
4846
},
4947
data() {
5048
return {
51-
activeTabMap,
5249
visible: 0,
53-
activeTabIdx: activeTabMap.color,
5450
};
5551
},
5652
computed: {
@@ -59,6 +55,7 @@ export default {
5955
},
6056
},
6157
mounted() {
58+
syncModeToGenerator();
6259
initGeneratorVars();
6360
initThemeStyleSheet(this.$theme.enName);
6461
applyTokenFromLocal();
@@ -70,10 +67,8 @@ export default {
7067
},
7168
handleDrawerVisible(v) {
7269
this.visible = v;
73-
this.$emit('panel-drawer-visible', v);
7470
},
7571
handleClickSetting() {
76-
this.$emit('click-setting');
7772
this.visible = false;
7873
},
7974
},
@@ -85,7 +80,7 @@ export default {
8580
@import './styles/tdesign.min.css';
8681
8782
@media screen and (max-width: 960px) {
88-
#theme-generator {
83+
.theme-generator {
8984
display: none;
9085
}
9186
}

packages/theme-generator/src/color-panel/utils/const.js renamed to packages/theme-generator/src/color-panel/built-in/color-map.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
1-
import AgapanthusPurple from '!raw-loader!../assets/AgapanthusPurple'; // 百子莲紫
2-
import DavidiaGreen from '!raw-loader!../assets/DavidiaGreen'; // 珙桐绿
3-
import GovRed from '!raw-loader!../assets/GovRed'; // 政务红
4-
import HyacinthBlue from '!raw-loader!../assets/HyacinthBlue'; //风信子蓝
5-
import MarigoldOrange from '!raw-loader!../assets/MarigoldOrange'; // 万寿菊橙
6-
import MultifloraRed from '!raw-loader!../assets/MultifloraRed'; // 蔷薇红
7-
import PetelotiiYellow from '!raw-loader!../assets/PetelotiiYellow'; //金茶花黄
8-
import PlumbagoBlue from '!raw-loader!../assets/PlumbagoBlue'; // 花丹蓝
9-
import TaxusRed from '!raw-loader!../assets/TaxusRed'; // 豆衫红
10-
import TCloudBlack from '!raw-loader!../assets/TCloudBlack'; // 腾云黑
11-
import TencentBlue from '!raw-loader!../assets/TencentBlue'; //腾讯蓝
12-
import TourismPurple from '!raw-loader!../assets/TourismPurple'; // 文旅紫
13-
import ViridifloraGreen from '!raw-loader!../assets/ViridifloraGreen'; // 鸢尾绿
14-
import WeChatGreen from '!raw-loader!../assets/WeChatGreen'; //微信绿
15-
import YulaniaPink from '!raw-loader!../assets/YulaniaPink'; // 玉兰粉
16-
17-
/* ============================== */
18-
191
export const DEFAULT_BRAND = '#0052D9';
202
const DEFAULT_GRAY = '#ddd';
213
const DEFAULT_SUCCESS = '#2ba471';
224
const DEFAULT_ERROR = '#d54941';
235
const DEFAULT_WARNING = '#e37318';
246

257
export const DEFAULT_FUNCTION_COLORS = {
26-
// TO FIX 腾讯云默认的功能色也不需要存入 local
278
gray: DEFAULT_GRAY,
289
success: DEFAULT_SUCCESS,
2910
error: DEFAULT_ERROR,
@@ -36,19 +17,16 @@ export const DEFAULT_COLORS = [
3617
{
3718
name: '腾讯蓝',
3819
enName: 'Tencent Blue',
39-
subtitle: TencentBlue,
4020
value: DEFAULT_BRAND,
4121
},
4222
{
4323
name: '风信子蓝',
4424
enName: 'Hyacinth Blue',
45-
subtitle: HyacinthBlue,
4625
value: '#0894FA',
4726
},
4827
{
4928
name: '金花茶黄',
5029
enName: 'Petelotii Yellow',
51-
subtitle: PetelotiiYellow,
5230
value: '#F3B814',
5331
},
5432
];
@@ -57,50 +35,41 @@ export const RECOMMEND_COLORS = [
5735
{
5836
name: '珙桐绿',
5937
enName: 'Davidia Green',
60-
subtitle: DavidiaGreen,
6138
value: '#45C58B',
6239
},
6340
{
6441
name: '鸢尾绿',
6542
enName: 'Viridiflora Green',
66-
subtitle: ViridifloraGreen,
6743
value: '#0ED6CA',
6844
},
6945
{
7046
name: '花丹蓝',
7147
enName: 'Plumbago Blue',
72-
subtitle: PlumbagoBlue,
7348
value: '#53B1FD',
7449
},
7550
{
7651
name: '百子莲紫',
7752
enName: 'Agapanthus Purple',
78-
subtitle: AgapanthusPurple,
7953
value: '#7A5AF8',
8054
},
8155
{
8256
name: '玉兰粉',
8357
enName: 'Yulania Pink',
84-
subtitle: YulaniaPink,
8558
value: '#EF45B3',
8659
},
8760
{
8861
name: '豆衫红',
8962
enName: 'Taxus Red',
90-
subtitle: TaxusRed,
9163
value: '#F54343',
9264
},
93-
9465
{
9566
name: '蔷薇红',
9667
enName: 'Multiflora Red',
97-
subtitle: MultifloraRed,
9868
value: '#FF5479',
9969
},
10070
{
10171
name: '万寿菊橙',
10272
enName: 'Marigold Orange',
103-
subtitle: MarigoldOrange,
10473
value: '#FD853A',
10574
},
10675
];
@@ -109,25 +78,21 @@ export const SCENE_COLORS = [
10978
{
11079
name: '微信绿',
11180
enName: 'WeChat Green',
112-
subtitle: WeChatGreen,
11381
value: '#07C160',
11482
},
11583
{
11684
name: '腾云黑',
11785
enName: 'TCloud Black',
118-
subtitle: TCloudBlack,
11986
value: '#262626',
12087
},
12188
{
12289
name: '文旅紫',
12390
enName: 'Tourism Purple',
124-
subtitle: TourismPurple,
12591
value: '#623BFF',
12692
},
12793
{
12894
name: '政务红',
12995
enName: 'Government Red',
130-
subtitle: GovRed,
13196
value: '#EE1C25',
13297
},
13398
];
@@ -190,15 +155,3 @@ export const FUNCTION_TOKEN_MAPS = {
190155
error: ERROR_TOKEN_MAP,
191156
warning: WARNING_TOKEN_MAP,
192157
};
193-
194-
/* ============================== */
195-
196-
export const FONT_COLOR_TOKEN_MAP = [
197-
{ name: '--td-text-color-primary', from: '--td-font-gray-1' },
198-
{ name: '--td-text-color-secondary', from: '--td-font-gray-2' },
199-
{ name: '--td-text-color-placeholder', from: '--td-font-gray-3' },
200-
{ name: '--td-text-color-disabled', from: '--td-font-gray-4' },
201-
{ name: '--td-text-color-anti', value: '#fff' },
202-
{ name: '--td-text-color-brand', from: '--td-brand-color' },
203-
{ name: '--td-text-color-link', from: '--td-brand-color' },
204-
];

packages/theme-generator/src/color-panel/components/ColorCollapse/index.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ import { Edit1Icon, FileCopyIcon } from 'tdesign-icons-vue';
7979
import { Popup as TPopup } from 'tdesign-vue';
8080
import ArrowIcon from 'tdesign-vue/es/common-components/fake-arrow';
8181
82-
import ColorPicker from '../../../common/ColorPicker/index.vue';
83-
import langMixin from '../../../common/i18n/mixin';
84-
import { handleAttach } from '../../../common/utils';
85-
import { collapseAnimation } from '../../../common/utils/animation';
82+
import { ColorPicker } from '../../../common/components';
83+
import { langMixin } from '../../../common/i18n';
84+
import { collapseAnimation, handleAttach } from '../../../common/utils';
8685
8786
export default {
8887
name: 'ColorCollapse',

packages/theme-generator/src/color-panel/components/ColorColumn/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
import { Edit1Icon, ErrorCircleIcon, LinkUnlinkIcon } from 'tdesign-icons-vue';
8585
import { Popup as TPopup } from 'tdesign-vue';
8686
87-
import ColorPicker from '../../../common/ColorPicker/index.vue';
88-
import langMixin from '../../../common/i18n/mixin';
87+
import { ColorPicker } from '../../../common/components';
88+
import { langMixin } from '../../../common/i18n';
8989
import { CUSTOM_TOKEN_ID } from '../../../common/themes';
9090
import { getTokenValue, handleAttach } from '../../../common/utils';
9191

packages/theme-generator/src/color-panel/index.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@
316316
</div>
317317
</div>
318318
</template>
319+
319320
<script lang="jsx">
320321
import { Edit1Icon, FileCopyIcon, HelpCircleIcon } from 'tdesign-icons-vue';
321322
import {
@@ -327,8 +328,8 @@ import {
327328
Tooltip as TTooltip,
328329
} from 'tdesign-vue';
329330
330-
import ColorPicker from '../common/ColorPicker/index.vue';
331-
import langMixin from '../common/i18n/mixin';
331+
import { ColorPicker } from '../common/components';
332+
import { langMixin } from '../common/i18n';
332333
import {
333334
covert2Hex,
334335
generateBrandPalette,
@@ -341,16 +342,16 @@ import {
341342
updateLocalOption,
342343
updateStyleSheetColor,
343344
} from '../common/themes';
344-
import { getThemeMode, getTokenValue, handleAttach, setUpThemeObserver } from '../common/utils';
345-
import { colorAnimation } from '../common/utils/animation';
345+
import { colorAnimation, getThemeMode, getTokenValue, handleAttach, setUpModeObserver } from '../common/utils';
346+
346347
import {
347348
BRAND_TOKEN_MAP,
348349
DEFAULT_COLORS,
349350
DEFAULT_FUNCTION_COLORS,
350351
FUNCTION_TOKEN_MAPS,
351352
RECOMMEND_COLORS,
352353
SCENE_COLORS,
353-
} from './utils/const';
354+
} from './built-in/color-map';
354355
355356
import ColorCollapse from './components/ColorCollapse';
356357
import ColorColumn from './components/ColorColumn';
@@ -433,7 +434,7 @@ export default {
433434
['success', 'error', 'warning'].forEach((type) => {
434435
this.changeFunctionColor(this[`${type}MainColor`], type);
435436
});
436-
setUpThemeObserver((theme) => {
437+
setUpModeObserver((theme) => {
437438
this.updateBrandTokenMap();
438439
this.currentBrandIdx = this.brandIndexes[theme];
439440
this.$forceUpdate();
@@ -515,6 +516,7 @@ export default {
515516
},
516517
};
517518
</script>
519+
518520
<style scoped lang="less">
519521
/deep/ .t-popup[data-popper-placement='bottom-end'] .t-popup__arrow {
520522
left: calc(100% - 16px * 2) !important;

0 commit comments

Comments
 (0)