@jx3box/jx3box-ui 2.0.4 → 2.0.6
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/.storybook/main.js +208 -0
- package/.storybook/preview.js +93 -0
- package/.storybook/storybookMocks.js +191 -0
- package/README.md +29 -82
- package/assets/css/bread/admin.less +20 -2
- package/assets/css/bread/breadcrumb.less +5 -2
- package/assets/css/comment/quick-reply.less +1 -1
- package/assets/css/common/left-sidebar.less +1 -1
- package/assets/css/interact/like2.less +5 -2
- package/assets/css/single/author.less +15 -10
- package/assets/css/single/cms-single.less +1 -0
- package/assets/css/single/thx.less +34 -11
- package/assets/data/nav.json +344 -10
- package/assets/img/comment/comment.svg +1 -1
- package/assets/img/comment/heart_1.svg +1 -1
- package/assets/img/comment/hide.svg +1 -1
- package/assets/img/leftsidebar/medal.svg +1 -1
- package/assets/img/leftsidebar/post.svg +27 -46
- package/i18n/messages/en-US.js +357 -22
- package/i18n/messages/vi.js +350 -22
- package/i18n/messages/zh-CN.js +469 -20
- package/i18n/messages/zh-TW.js +350 -22
- package/index.js +19 -7
- package/package.json +15 -5
- package/service/cms.js +22 -0
- package/service/commit-history.js +18 -0
- package/service/community.js +60 -0
- package/service/fav.js +5 -6
- package/src/App.vue +154 -80
- package/src/Breadcrumb.vue +24 -11
- package/src/CommonFooter.vue +4 -4
- package/src/Footer.vue +13 -5
- package/src/LeftSideToggle.vue +10 -3
- package/src/LeftSidebar.vue +19 -5
- package/src/Main.vue +9 -2
- package/src/RightSidebar.vue +12 -3
- package/src/SuspendCommon.vue +52 -38
- package/src/author/AuthorFans.vue +7 -5
- package/src/author/AuthorFollow.vue +14 -7
- package/src/author/AuthorGift.vue +25 -17
- package/src/author/AuthorInfo.vue +46 -19
- package/src/author/AuthorLink.vue +3 -1
- package/src/author/AuthorMedals.vue +5 -2
- package/src/author/AuthorPosts.vue +31 -13
- package/src/author/AuthorRss.vue +7 -3
- package/src/author/AuthorTeams.vue +3 -1
- package/src/author/UserPop.vue +29 -17
- package/src/bread/Admin.vue +55 -32
- package/src/bread/AdminDirectMessage.vue +15 -8
- package/src/bread/AdminDrop.vue +124 -45
- package/src/bread/CommunityAdmin.vue +527 -0
- package/src/bread/DesignTask.vue +30 -26
- package/src/bread/ListAdmin.vue +199 -0
- package/src/bread/MigrateCommunity.vue +192 -0
- package/src/bread/MoveToCommunityDialog.vue +234 -0
- package/src/comment/Avatar.vue +18 -24
- package/src/comment/CommentContent.vue +57 -37
- package/src/comment/CommentContentSimple.vue +61 -63
- package/src/comment/CommentInputForm.vue +45 -34
- package/src/comment/CommentWithReply.vue +9 -6
- package/src/comment/QuickReply.vue +5 -1
- package/src/comment/ReplyForReply.vue +6 -4
- package/src/comment/ReplyList.vue +28 -18
- package/src/comment/Upload.vue +24 -6
- package/src/filters/clientBy.vue +10 -8
- package/src/filters/markBy.vue +35 -31
- package/src/filters/menuBy.vue +20 -22
- package/src/filters/orderBy.vue +17 -11
- package/src/filters/tagBy.vue +4 -2
- package/src/filters/topicBy.vue +12 -10
- package/src/filters/versionBy.vue +5 -3
- package/src/filters/zlpBy.vue +29 -25
- package/src/footer/copyright.vue +5 -5
- package/src/footer/links.vue +2 -2
- package/src/footer/official.vue +1 -1
- package/src/footer/resource.vue +41 -8
- package/src/header/alternate.vue +35 -18
- package/src/header/asset.vue +9 -19
- package/src/header/box.vue +20 -8
- package/src/header/box2.vue +25 -13
- package/src/header/client.vue +7 -7
- package/src/header/lang.vue +41 -6
- package/src/header/logo.vue +2 -3
- package/src/header/manage.vue +2 -2
- package/src/header/message.vue +3 -3
- package/src/header/nav.vue +26 -23
- package/src/header/publish.vue +2 -2
- package/src/header/search.vue +2 -2
- package/src/header/shop.vue +2 -2
- package/src/header/user.vue +4 -4
- package/src/header/userInfo.vue +22 -24
- package/src/header/vip.vue +2 -2
- package/src/interact/BoxcoinAdmin.vue +30 -16
- package/src/interact/BoxcoinRecords.vue +28 -11
- package/src/interact/BoxcoinUser.vue +33 -17
- package/src/interact/Fav.vue +5 -1
- package/src/interact/Homework.vue +318 -0
- package/src/interact/Like.vue +4 -2
- package/src/interact/Rss.vue +10 -4
- package/src/interact/Share.vue +18 -19
- package/src/interact/WatchLater.vue +5 -1
- package/src/main.js +1 -0
- package/src/single/Author.vue +5 -1
- package/src/single/CmsSingle.vue +29 -15
- package/src/single/Collection.vue +36 -26
- package/src/single/Comment.vue +19 -13
- package/src/single/Creators.vue +5 -3
- package/src/single/PostCollection.vue +158 -0
- package/src/single/PostDirectory.vue +0 -126
- package/src/single/PostGuide.vue +93 -0
- package/src/single/PostHeader.vue +39 -17
- package/src/single/PostTopic.vue +3 -3
- package/src/single/PostVersion.vue +219 -0
- package/src/single/RightAffix.vue +160 -0
- package/src/single/SimpleThx.vue +4 -2
- package/src/single/Thx.vue +14 -2
- package/src/single/VersionDialog.vue +238 -0
- package/src/stories/components/StoryPropsTable.vue +137 -0
- package/src/stories/filters/FilterGallery.stories.js +110 -0
- package/src/stories/filters/clientBy.stories.js +24 -0
- package/src/stories/filters/markBy.stories.js +6 -0
- package/src/stories/filters/menuBy.stories.js +6 -0
- package/src/stories/filters/orderBy.stories.js +6 -0
- package/src/stories/filters/tagBy.stories.js +6 -0
- package/src/stories/filters/topicBy.stories.js +6 -0
- package/src/stories/filters/versionBy.stories.js +6 -0
- package/src/stories/filters/zlpBy.stories.js +6 -0
- package/src/stories/layout/BaseShell.stories.js +38 -0
- package/src/stories/layout/Breadcrumb.stories.js +40 -0
- package/src/stories/layout/CommonFooter.stories.js +22 -0
- package/src/stories/layout/CommonHeader.stories.js +39 -0
- package/src/stories/layout/LeftSideToggle.stories.js +78 -0
- package/src/stories/layout/LeftSidebar.stories.js +40 -0
- package/src/stories/layout/Main.stories.js +41 -0
- package/src/stories/layout/RightSidebar.stories.js +36 -0
- package/src/stories/layout/StorybookShell.vue +271 -0
- package/src/stories/layout/SuspendCommon.stories.js +67 -0
- package/src/stories/layout/SuspendCommonStage.vue +143 -0
- package/src/stories/mockData.js +275 -0
- package/src/stories/other/UserPop.stories.js +51 -0
- package/src/stories/single/Author.stories.js +19 -0
- package/src/stories/single/AuthorStoryStage.vue +103 -0
- package/src/stories/single/CmsSingle.stories.js +19 -0
- package/src/stories/single/CmsSingleStoryStage.vue +118 -0
- package/src/stories/single/Collection.stories.js +34 -0
- package/src/stories/single/Comment.stories.js +36 -0
- package/src/stories/single/Creators.stories.js +34 -0
- package/src/stories/single/PostCollection.stories.js +34 -0
- package/src/stories/single/PostDirectory.stories.js +31 -0
- package/src/stories/single/PostGuide.stories.js +47 -0
- package/src/stories/single/PostHeader.stories.js +39 -0
- package/src/stories/single/PostVersion.stories.js +41 -0
- package/src/stories/single/RightAffix.stories.js +84 -0
- package/src/stories/single/SimpleThx.stories.js +39 -0
- package/src/stories/single/SingleGallery.stories.js +207 -0
- package/src/stories/single/Thx.stories.js +38 -0
- package/vue.config.js +2 -12
- package/assets/css/common/bottom.less +0 -25
- package/assets/css/editor/article.less +0 -36
- package/assets/css/editor/combo.less +0 -362
- package/assets/css/editor/resource.less +0 -399
- package/assets/css/editor/tinymce.less +0 -100
- package/assets/css/editor/upload.less +0 -136
- package/assets/css/module/author.less +0 -231
- package/assets/css/module/buff.less +0 -88
- package/assets/css/module/directory.less +0 -165
- package/assets/css/module/icon.less +0 -25
- package/assets/css/module/item.less +0 -279
- package/assets/css/module/item_simple.less +0 -58
- package/assets/css/module/jx3_element.less +0 -5
- package/assets/css/module/macro.less +0 -89
- package/assets/css/module/npc.less +0 -265
- package/assets/css/module/resource.less +0 -93
- package/assets/css/module/skill.less +0 -74
- package/assets/css/module/talent.less +0 -495
- package/assets/js/a.js +0 -46
- package/assets/js/code.js +0 -13
- package/assets/js/combo.js +0 -40
- package/assets/js/directory.js +0 -114
- package/assets/js/filter2.js +0 -186
- package/assets/js/fold.js +0 -11
- package/assets/js/gallery.js +0 -14
- package/assets/js/hljs_languages.js +0 -177
- package/assets/js/iframe.js +0 -38
- package/assets/js/img.js +0 -23
- package/assets/js/item/attribute_percent.js +0 -88
- package/assets/js/item/bind.js +0 -18
- package/assets/js/item/border.js +0 -19
- package/assets/js/item/border_quest.js +0 -12
- package/assets/js/item/color.js +0 -25
- package/assets/js/item/hljs_languages.js +0 -177
- package/assets/js/item/icon_url.js +0 -15
- package/assets/js/item/second_format.js +0 -19
- package/assets/js/jx3_element.js +0 -73
- package/assets/js/katex.js +0 -181
- package/assets/js/macro.js +0 -16
- package/assets/js/nextpage.js +0 -4
- package/assets/js/pswp.js +0 -67
- package/assets/js/pswp_template.js +0 -66
- package/assets/js/pz_iframe.js +0 -30
- package/assets/js/qixue.js +0 -28
- package/assets/js/renderImgPreview.js +0 -18
- package/assets/js/script.js +0 -6
- package/assets/js/stat.js +0 -107
- package/assets/js/talent2.js +0 -21
- package/assets/js/tex-mml-chtml.js +0 -36310
- package/assets/js/voice.js +0 -238
- package/assets/js/xss.js +0 -130
- package/src/editor/Article.vue +0 -230
- package/src/editor/BoxResource.vue +0 -441
- package/src/editor/Resource.vue +0 -623
- package/src/editor/Tinymce.vue +0 -204
- package/src/editor/Upload.vue +0 -277
- package/src/editor/UploadAlum.vue +0 -176
- package/src/editor/UploadBanner.vue +0 -156
- package/src/editor/components/Author.vue +0 -322
- package/src/editor/components/Avatar.vue +0 -95
- package/src/editor/components/Buff.vue +0 -80
- package/src/editor/components/Combo.vue +0 -259
- package/src/editor/components/Equip.vue +0 -299
- package/src/editor/components/GameText.vue +0 -242
- package/src/editor/components/Item.vue +0 -325
- package/src/editor/components/ItemSimple.vue +0 -134
- package/src/editor/components/Medal.vue +0 -43
- package/src/editor/components/Npc.vue +0 -215
- package/src/editor/components/PostAuthor.vue +0 -102
- package/src/editor/components/Skill.vue +0 -71
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const lessResourcePatterns = [
|
|
4
|
+
path.resolve(__dirname, '../node_modules/@jx3box/jx3box-common/css/var.less'),
|
|
5
|
+
path.resolve(__dirname, '../node_modules/@jx3box/jx3box-common/css/mixin.less'),
|
|
6
|
+
path.resolve(__dirname, '../assets/css/var.less'),
|
|
7
|
+
path.resolve(__dirname, '../assets/css/mixin.less'),
|
|
8
|
+
path.resolve(__dirname, '../node_modules/csslab/base.less'),
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
function walkRules(rules, visitor) {
|
|
12
|
+
if (!Array.isArray(rules)) return;
|
|
13
|
+
rules.forEach((rule) => {
|
|
14
|
+
visitor(rule);
|
|
15
|
+
if (Array.isArray(rule.oneOf)) walkRules(rule.oneOf, visitor);
|
|
16
|
+
if (Array.isArray(rule.rules)) walkRules(rule.rules, visitor);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function ensureVueSvgInlineLoader(config) {
|
|
21
|
+
walkRules(config.module?.rules, (rule) => {
|
|
22
|
+
if (!Array.isArray(rule.use)) return;
|
|
23
|
+
|
|
24
|
+
const hasVueLoader = rule.use.some((use) => {
|
|
25
|
+
const loader = typeof use === 'string' ? use : use?.loader;
|
|
26
|
+
return loader && loader.includes('vue-loader');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (!hasVueLoader) return;
|
|
30
|
+
|
|
31
|
+
const hasSvgInlineLoader = rule.use.some((use) => {
|
|
32
|
+
const loader = typeof use === 'string' ? use : use?.loader;
|
|
33
|
+
return loader && loader.includes('vue-svg-inline-loader');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (!hasSvgInlineLoader) {
|
|
37
|
+
rule.use.push({
|
|
38
|
+
loader: require.resolve('vue-svg-inline-loader'),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function ensureLessGlobalResources(config) {
|
|
45
|
+
walkRules(config.module?.rules, (rule) => {
|
|
46
|
+
if (!Array.isArray(rule.use)) return;
|
|
47
|
+
|
|
48
|
+
for (let i = 0; i < rule.use.length; i += 1) {
|
|
49
|
+
const currentUse = rule.use[i];
|
|
50
|
+
const loader = typeof currentUse === 'string' ? currentUse : currentUse?.loader;
|
|
51
|
+
|
|
52
|
+
if (!loader || !loader.includes('less-loader')) continue;
|
|
53
|
+
|
|
54
|
+
const hasStyleResource = rule.use.some((use) => {
|
|
55
|
+
const useLoader = typeof use === 'string' ? use : use?.loader;
|
|
56
|
+
return useLoader && useLoader.includes('style-resources-loader');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (!hasStyleResource) {
|
|
60
|
+
rule.use.splice(i + 1, 0, {
|
|
61
|
+
loader: require.resolve('style-resources-loader'),
|
|
62
|
+
options: {
|
|
63
|
+
patterns: lessResourcePatterns,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function removeVueDocgenLoader(config) {
|
|
74
|
+
walkRules(config.module?.rules, (rule) => {
|
|
75
|
+
const directLoader = typeof rule.loader === 'string' ? rule.loader : '';
|
|
76
|
+
if (directLoader.includes('vue-docgen-loader')) {
|
|
77
|
+
rule.__remove = true;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!Array.isArray(rule.use)) return;
|
|
82
|
+
rule.use = rule.use.filter((use) => {
|
|
83
|
+
const loader = typeof use === 'string' ? use : use?.loader;
|
|
84
|
+
return !(loader && loader.includes('vue-docgen-loader'));
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (Array.isArray(config.module?.rules)) {
|
|
89
|
+
config.module.rules = config.module.rules.filter((rule) => !rule.__remove);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function ensureStyleRules(config) {
|
|
94
|
+
const rules = config.module?.rules || [];
|
|
95
|
+
const hasLessRule = rules.some((rule) => String(rule.test).includes('less'));
|
|
96
|
+
const hasScssRule = rules.some((rule) => String(rule.test).includes('scss'));
|
|
97
|
+
const hasCssRule = rules.some((rule) => String(rule.test).includes('\\.css$'));
|
|
98
|
+
|
|
99
|
+
if (hasCssRule) {
|
|
100
|
+
walkRules(rules, (rule) => {
|
|
101
|
+
if (!String(rule.test).includes('\\.css$') || !Array.isArray(rule.use)) return;
|
|
102
|
+
const hasPostcss = rule.use.some((use) => {
|
|
103
|
+
const loader = typeof use === 'string' ? use : use?.loader;
|
|
104
|
+
return loader && loader.includes('postcss-loader');
|
|
105
|
+
});
|
|
106
|
+
if (!hasPostcss) {
|
|
107
|
+
rule.use.push({
|
|
108
|
+
loader: require.resolve('postcss-loader'),
|
|
109
|
+
options: {
|
|
110
|
+
postcssOptions: {
|
|
111
|
+
config: path.resolve(__dirname, '../postcss.config.js'),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!hasLessRule) {
|
|
120
|
+
rules.push({
|
|
121
|
+
test: /\.less$/i,
|
|
122
|
+
use: [
|
|
123
|
+
require.resolve('style-loader'),
|
|
124
|
+
{
|
|
125
|
+
loader: require.resolve('css-loader'),
|
|
126
|
+
options: { importLoaders: 1 },
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
loader: require.resolve('postcss-loader'),
|
|
130
|
+
options: {
|
|
131
|
+
postcssOptions: {
|
|
132
|
+
config: path.resolve(__dirname, '../postcss.config.js'),
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
loader: require.resolve('less-loader'),
|
|
138
|
+
options: {
|
|
139
|
+
lessOptions: {
|
|
140
|
+
javascriptEnabled: true,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
loader: require.resolve('style-resources-loader'),
|
|
146
|
+
options: {
|
|
147
|
+
patterns: lessResourcePatterns,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!hasScssRule) {
|
|
155
|
+
rules.push({
|
|
156
|
+
test: /\.s[ac]ss$/i,
|
|
157
|
+
use: [
|
|
158
|
+
require.resolve('style-loader'),
|
|
159
|
+
require.resolve('css-loader'),
|
|
160
|
+
{
|
|
161
|
+
loader: require.resolve('postcss-loader'),
|
|
162
|
+
options: {
|
|
163
|
+
postcssOptions: {
|
|
164
|
+
config: path.resolve(__dirname, '../postcss.config.js'),
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
require.resolve('sass-loader'),
|
|
169
|
+
],
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
config.module.rules = rules;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @type { import('@storybook/vue3-webpack5').StorybookConfig } */
|
|
177
|
+
module.exports = {
|
|
178
|
+
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
|
|
179
|
+
addons: [
|
|
180
|
+
{
|
|
181
|
+
name: '@storybook/addon-essentials',
|
|
182
|
+
options: {
|
|
183
|
+
docs: false,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
'@storybook/addon-interactions',
|
|
187
|
+
],
|
|
188
|
+
framework: {
|
|
189
|
+
name: '@storybook/vue3-webpack5',
|
|
190
|
+
options: {
|
|
191
|
+
docgen: false,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
webpackFinal: async (config) => {
|
|
195
|
+
config.resolve = config.resolve || {};
|
|
196
|
+
config.resolve.alias = {
|
|
197
|
+
...(config.resolve.alias || {}),
|
|
198
|
+
'@': path.resolve(__dirname, '../src'),
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
removeVueDocgenLoader(config);
|
|
202
|
+
ensureStyleRules(config);
|
|
203
|
+
ensureVueSvgInlineLoader(config);
|
|
204
|
+
ensureLessGlobalResources(config);
|
|
205
|
+
|
|
206
|
+
return config;
|
|
207
|
+
},
|
|
208
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { setup } from '@storybook/vue3';
|
|
2
|
+
import ElementPlus from 'element-plus';
|
|
3
|
+
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
|
4
|
+
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
|
|
7
|
+
import { install } from '../index';
|
|
8
|
+
import { Jx3boxUiI18n } from '../i18n';
|
|
9
|
+
import navData from '../assets/data/nav.json';
|
|
10
|
+
import boxData from '../assets/data/box.json';
|
|
11
|
+
import { resolveAdapter, resolveStorybookMock } from './storybookMocks';
|
|
12
|
+
|
|
13
|
+
import '@jx3box/jx3box-common/css/normalize.css';
|
|
14
|
+
import '@jx3box/jx3box-common/css/font.css';
|
|
15
|
+
import 'element-plus/dist/index.css';
|
|
16
|
+
import '@jx3box/jx3box-common/css/tailwind.css';
|
|
17
|
+
|
|
18
|
+
let axiosPatched = false;
|
|
19
|
+
|
|
20
|
+
function patchAxiosForStorybook() {
|
|
21
|
+
if (axiosPatched) return;
|
|
22
|
+
|
|
23
|
+
const originalCreate = axios.create.bind(axios);
|
|
24
|
+
const originalGet = axios.get.bind(axios);
|
|
25
|
+
|
|
26
|
+
const withMockAdapter = (instance) => {
|
|
27
|
+
const defaultAdapter = resolveAdapter(axios, instance.defaults.adapter);
|
|
28
|
+
instance.defaults.adapter = async (config) => {
|
|
29
|
+
const mocked = resolveStorybookMock(config);
|
|
30
|
+
if (mocked) return mocked;
|
|
31
|
+
if (defaultAdapter) return defaultAdapter(config);
|
|
32
|
+
throw new Error(`Unmocked request in Storybook: ${config?.url || ''}`);
|
|
33
|
+
};
|
|
34
|
+
return instance;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
axios.create = (...args) => withMockAdapter(originalCreate(...args));
|
|
38
|
+
axios.get = (url, ...args) => {
|
|
39
|
+
const config = { method: 'get', url, ...(args[0] || {}) };
|
|
40
|
+
const mocked = resolveStorybookMock(config);
|
|
41
|
+
if (mocked) {
|
|
42
|
+
return Promise.resolve(mocked);
|
|
43
|
+
}
|
|
44
|
+
return originalGet(url, ...args);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
axiosPatched = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function bootstrapRuntimeData() {
|
|
51
|
+
try {
|
|
52
|
+
sessionStorage.setItem('nav', JSON.stringify(navData));
|
|
53
|
+
sessionStorage.setItem('box', JSON.stringify(boxData));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
// ignore session storage failures in restricted contexts
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
localStorage.removeItem('token');
|
|
60
|
+
localStorage.removeItem('uid');
|
|
61
|
+
localStorage.removeItem('group');
|
|
62
|
+
localStorage.removeItem('created_at');
|
|
63
|
+
localStorage.removeItem('name');
|
|
64
|
+
localStorage.removeItem('status');
|
|
65
|
+
localStorage.removeItem('avatar');
|
|
66
|
+
} catch (e) {
|
|
67
|
+
// ignore local storage failures in restricted contexts
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
setup((app) => {
|
|
72
|
+
app.use(Jx3boxUiI18n, { locale: 'zh-CN' });
|
|
73
|
+
app.use(ElementPlus, { locale: zhCn });
|
|
74
|
+
install(app);
|
|
75
|
+
|
|
76
|
+
for (const [name, component] of Object.entries(ElementPlusIconsVue)) {
|
|
77
|
+
app.component(name, component);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
patchAxiosForStorybook();
|
|
82
|
+
bootstrapRuntimeData();
|
|
83
|
+
|
|
84
|
+
export const parameters = {
|
|
85
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
86
|
+
controls: {
|
|
87
|
+
matchers: {
|
|
88
|
+
color: /(background|color)$/i,
|
|
89
|
+
date: /Date$/i,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
layout: 'fullscreen',
|
|
93
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mockBoxcoinConfig,
|
|
3
|
+
mockBoxcoinRecords,
|
|
4
|
+
mockCommitHistories,
|
|
5
|
+
mockCollection,
|
|
6
|
+
mockCommentPage,
|
|
7
|
+
mockCommentPower,
|
|
8
|
+
mockCreators,
|
|
9
|
+
mockHonor,
|
|
10
|
+
mockMedals,
|
|
11
|
+
mockSearchUser,
|
|
12
|
+
mockTeams,
|
|
13
|
+
mockUserInfo,
|
|
14
|
+
mockUserPosts,
|
|
15
|
+
} from '../src/stories/mockData';
|
|
16
|
+
|
|
17
|
+
function resolveAdapter(axiosModule, adapter) {
|
|
18
|
+
if (!adapter) return null;
|
|
19
|
+
if (typeof adapter === 'function') return adapter;
|
|
20
|
+
if (typeof axiosModule?.getAdapter === 'function') {
|
|
21
|
+
return axiosModule.getAdapter(adapter);
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function normalizePath(config) {
|
|
27
|
+
const rawUrl = config?.url || '';
|
|
28
|
+
const baseURL = config?.baseURL || '';
|
|
29
|
+
const base = baseURL
|
|
30
|
+
? new URL(baseURL, 'https://storybook.local').toString()
|
|
31
|
+
: 'https://storybook.local';
|
|
32
|
+
const url = rawUrl.startsWith('http') ? new URL(rawUrl) : new URL(rawUrl || '/', base);
|
|
33
|
+
return url.pathname.replace(/^\/__proxy\/[^/]+/, '');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function respond(config, data, status = 200) {
|
|
37
|
+
return {
|
|
38
|
+
data,
|
|
39
|
+
status,
|
|
40
|
+
statusText: 'OK',
|
|
41
|
+
headers: {},
|
|
42
|
+
config,
|
|
43
|
+
request: {},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function mockCmsConfig(key) {
|
|
48
|
+
if (key === 'boxcoin') return { val: 1 };
|
|
49
|
+
if (key === 'admin_boxcoin_visible') return { val: 1 };
|
|
50
|
+
if (key === 'level_has_gift_permission') return { val: 0 };
|
|
51
|
+
if (key === 'comment_strict') return { val: 0 };
|
|
52
|
+
return { val: '' };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function resolveStorybookMock(config) {
|
|
56
|
+
const method = String(config?.method || 'get').toLowerCase();
|
|
57
|
+
const path = normalizePath(config);
|
|
58
|
+
const params = config?.params || {};
|
|
59
|
+
|
|
60
|
+
if (path.includes('/config/global.json')) {
|
|
61
|
+
return respond(config, { token_version: 'storybook' });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (method === 'get' && path === '/api/cms/config') {
|
|
65
|
+
return respond(config, { data: mockCmsConfig(params.key) });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (method === 'get' && path.match(/^\/api\/cms\/post\/\d+\/authors$/)) {
|
|
69
|
+
return respond(config, { data: mockCreators });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (method === 'get' && path.match(/^\/api\/cms\/post\/collection\/\d+$/)) {
|
|
73
|
+
return respond(config, { data: mockCollection });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (method === 'get' && path.match(/^\/api\/cms\/user\/\d+\/info$/)) {
|
|
77
|
+
return respond(config, { data: mockUserInfo });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (method === 'get' && path.match(/^\/api\/cms\/user\/honor\/\d+\/using$/)) {
|
|
81
|
+
return respond(config, { data: mockHonor });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (method === 'get' && path === '/api/cms/user/search') {
|
|
85
|
+
return respond(config, { data: mockSearchUser });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (method === 'get' && path.match(/^\/api\/cms\/posts\/user\/\d+\/latest$/)) {
|
|
89
|
+
return respond(config, { data: { list: mockUserPosts } });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (method === 'get' && path === '/api/cms/user/decoration') {
|
|
93
|
+
return respond(config, { data: [] });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (method === 'get' && path === '/api/cms/account/permission/i') {
|
|
97
|
+
return respond(config, { data: { permission: [{ action: 'manage_boxcoin_bbs' }] } });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (method === 'get' && path.match(/^\/api\/next2\/user\/\d+\/medals$/)) {
|
|
101
|
+
return respond(config, { data: mockMedals });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (method === 'get' && path === '/api/team/relation/public') {
|
|
105
|
+
return respond(config, { data: mockTeams });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (method === 'get' && path.match(/^\/api\/next2\/rss\/overview\/author\/\d+$/)) {
|
|
109
|
+
return respond(config, { data: { total: 128, subscribed: false } });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (method === 'get' && path.match(/^\/api\/inspire\/article\/.+\/boxcoin\/limit$/)) {
|
|
113
|
+
return respond(config, { data: mockBoxcoinConfig });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (method === 'get' && path.match(/^\/api\/inspire\/article\/.+\/history$/)) {
|
|
117
|
+
return respond(config, { data: mockBoxcoinRecords });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (method === 'get' && path.match(/^\/api\/next2\/comment\/.+\/i-am-author$/)) {
|
|
121
|
+
return respond(config, mockCommentPower);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (method === 'get' && path.match(/^\/api\/next2\/comment\/.+\/comment\/page\/\d+$/)) {
|
|
125
|
+
return respond(config, mockCommentPage);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (method === 'get' && path.match(/^\/api\/next2\/comment\/.+\/comment\/\d+\/reply\/page\/\d+$/)) {
|
|
129
|
+
return respond(config, mockCommentPage);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (method === 'get' && path.match(/^\/api\/next2\/userdata\/commit-history\/content-meta\/\d+\/commit\/history$/)) {
|
|
133
|
+
return respond(config, {
|
|
134
|
+
data: {
|
|
135
|
+
list: mockCommitHistories.map(({ content, ...item }) => item),
|
|
136
|
+
page: {
|
|
137
|
+
total: mockCommitHistories.length,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (method === 'get' && path.match(/^\/api\/next2\/userdata\/commit-history\/content-meta\/\d+\/commit\/by-hash\/.+$/)) {
|
|
144
|
+
const hash = path.split('/').pop();
|
|
145
|
+
const matched = mockCommitHistories.find((item) => item.commit_hash === hash) || mockCommitHistories[0];
|
|
146
|
+
return respond(config, {
|
|
147
|
+
data: {
|
|
148
|
+
content: matched?.content || '',
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (['post', 'put', 'delete'].includes(method) && path.startsWith('/api/next2/comment/')) {
|
|
154
|
+
return respond(config, { code: 0, data: {} });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (['post', 'delete'].includes(method) && path.startsWith('/api/next2/rss/')) {
|
|
158
|
+
return respond(config, { code: 0, data: { subscribed: method === 'post' } });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (['post', 'delete', 'get'].includes(method) && path.startsWith('/api/article/favorites/')) {
|
|
162
|
+
return respond(config, { code: 0, data: { id: 1, totalFavorites: 12 } });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (method === 'get' && path === '/api/vip/i') {
|
|
166
|
+
return respond(config, {
|
|
167
|
+
data: {
|
|
168
|
+
was_vip: 0,
|
|
169
|
+
expire_date: '1970-02-02T16:00:00.000Z',
|
|
170
|
+
total_day: 0,
|
|
171
|
+
was_pro: 0,
|
|
172
|
+
pro_expire_date: '1970-02-02T16:00:00.000Z',
|
|
173
|
+
pro_total_day: 0,
|
|
174
|
+
rename_card_count: 0,
|
|
175
|
+
had_renamed: 0,
|
|
176
|
+
namespace_card_count: 0,
|
|
177
|
+
box_coin: 300,
|
|
178
|
+
points: 16800,
|
|
179
|
+
experience: 16800,
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (method === 'post' && path === '/api/next2/userdata/watch-later/item') {
|
|
185
|
+
return respond(config, { code: 0, data: {} });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { resolveAdapter };
|
package/README.md
CHANGED
|
@@ -5,40 +5,35 @@
|
|
|
5
5
|
|
|
6
6
|
## 模块
|
|
7
7
|
|
|
8
|
-
###
|
|
8
|
+
### 全局
|
|
9
|
+
- CommonHeader 公共头
|
|
10
|
+
- Breadcrumb 面包屑
|
|
11
|
+
- Main 默认内容框架(非必须)
|
|
12
|
+
- LeftSidebar 左侧边栏(非必须)
|
|
13
|
+
- LeftSideToggle 左侧边栏触发器(非必须,可独立使用)
|
|
14
|
+
- RightSidebar 右侧边栏(非必须)
|
|
15
|
+
- CommonFooter 公共底
|
|
16
|
+
- SuspendCommon 移动侧浮窗底(此组件需要手动引入)
|
|
17
|
+
|
|
18
|
+
### 内容单页 single
|
|
9
19
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- AuthorFans 粉丝榜
|
|
13
|
-
- AuthorFollow 关注用户(区分rss,此处用户更新不会收到消息)
|
|
14
|
-
- AuthorGift 打赏用户
|
|
15
|
-
- AuthorHonor 用户称号
|
|
16
|
-
- AuthorInfo 用户基础信息
|
|
17
|
-
- AuthorLink 用户绑定平台账号(微博,github,直播间)
|
|
18
|
-
- AuthorMedals 用户勋章
|
|
19
|
-
- AuthorPosts 用户作品
|
|
20
|
-
- AuthorRss 订阅用户
|
|
21
|
-
- AuthorTeams 所在团队
|
|
22
|
-
- Avatar 头像
|
|
23
|
-
- UserPop 搜索用户弹窗
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
### 管理员模块 bread
|
|
27
|
-
|
|
28
|
-
一般用于文章详情的右上角管理按钮
|
|
29
|
-
|
|
30
|
-
- AdminDrop 管理模块触发器
|
|
31
|
-
- Admin 文章管理模块(管理员)
|
|
32
|
-
- AdminDirectMessage 管理员私信
|
|
33
|
-
- Crumb 栏目动态
|
|
34
|
-
- DesignTask 设计任务
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### 评论模块 comment
|
|
20
|
+
主要是用于详情页的展示内容
|
|
38
21
|
|
|
39
|
-
|
|
22
|
+
- CmsSingle 单页框架
|
|
23
|
+
- Author 侧边栏作者信息整合
|
|
24
|
+
- PostDirectory 目录
|
|
25
|
+
- PostHeader 创作信息
|
|
26
|
+
- Creators 联合创作
|
|
27
|
+
- Collection 小册
|
|
28
|
+
- Thx 交互组件
|
|
29
|
+
- SimpleThx 交互组件简化版(仅PVP栏目使用,需要手动引入)
|
|
30
|
+
- Comment 评论
|
|
31
|
+
- RightAffix 固钉
|
|
32
|
+
- PostGuide 快速跳转至上下篇
|
|
33
|
+
- PostVersion 修改历史
|
|
34
|
+
- PostCollection 关联小册
|
|
40
35
|
|
|
41
|
-
### 筛选模块
|
|
36
|
+
### 筛选模块 list
|
|
42
37
|
|
|
43
38
|
主要用于各栏目的列表筛选
|
|
44
39
|
|
|
@@ -46,58 +41,10 @@
|
|
|
46
41
|
- markBy 标记筛选
|
|
47
42
|
- menuBy 通用筛选
|
|
48
43
|
- orderBy 排序筛选
|
|
49
|
-
- tagBy
|
|
44
|
+
- tagBy 标签筛选
|
|
50
45
|
- topicBy 主题筛选
|
|
51
46
|
- versionBy 版本筛选
|
|
52
47
|
- zlpBy 资料片筛选
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
主要是header的模块
|
|
58
|
-
|
|
59
|
-
- alternate 马甲切换
|
|
60
|
-
- asset 用户资产
|
|
61
|
-
- box 魔盒矩阵(移动端)
|
|
62
|
-
- box2 魔盒矩阵(PC)
|
|
63
|
-
- client 客户端切换
|
|
64
|
-
- lang 语言切换
|
|
65
|
-
- logo
|
|
66
|
-
- manage 后台管理入口
|
|
67
|
-
- message 消息中心入口
|
|
68
|
-
- nav 导航栏
|
|
69
|
-
- publish 创作中心入口
|
|
70
|
-
- search 搜索框
|
|
71
|
-
- shop 商城入口
|
|
72
|
-
- user 用户头像+信息pop
|
|
73
|
-
- 会员中心入口
|
|
74
|
-
|
|
75
|
-
### 交互模块
|
|
76
|
-
|
|
77
|
-
主要是文章详情中用于用户交互的组件,包含打赏,分享,收藏等等
|
|
78
|
-
|
|
79
|
-
- BoxcoinAdmin 管理员品鉴
|
|
80
|
-
- BoxcoinRecords 品鉴+打赏记录
|
|
81
|
-
- BoxcoinUser 用户打赏
|
|
82
|
-
- Contributors 多人合作文章中打赏目标选择
|
|
83
|
-
- Fav 收藏
|
|
84
|
-
- Like 点赞
|
|
85
|
-
- Rss 订阅
|
|
86
|
-
- Share 分享
|
|
87
|
-
- WatchLater 稍后再看
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### 单页
|
|
91
|
-
|
|
92
|
-
主要是用于详情页的展示内容
|
|
93
|
-
|
|
94
|
-
- Author 侧边栏作者信息
|
|
95
|
-
- CmsSingle 单页框架
|
|
96
|
-
- Collection 小册
|
|
97
|
-
- Comment 评论
|
|
98
|
-
- Creators 联合创作
|
|
99
|
-
- PostDirectory 目录
|
|
100
|
-
- PostHeader 创作信息
|
|
101
|
-
- PostTopic 右侧边栏头条
|
|
102
|
-
- SimpleThx 简单交互组件集合
|
|
103
|
-
- Thx 交互组件
|
|
49
|
+
### 其他
|
|
50
|
+
- UserPop 搜索用户弹窗
|
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
/* assets/css/bread/admin.less */
|
|
44
44
|
margin-left: 10px;;
|
|
45
45
|
}
|
|
46
|
+
.m-status-op {
|
|
47
|
+
.flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
.c-admin-highlight-checkbox {
|
|
@@ -64,7 +68,7 @@
|
|
|
64
68
|
/* assets/css/bread/admin.less */
|
|
65
69
|
.u-banner {
|
|
66
70
|
/* assets/css/bread/admin.less */
|
|
67
|
-
.mt(
|
|
71
|
+
.mt(10px);
|
|
68
72
|
}
|
|
69
73
|
.u-btn {
|
|
70
74
|
/* assets/css/bread/admin.less */
|
|
@@ -82,6 +86,20 @@
|
|
|
82
86
|
box-sizing: border-box;
|
|
83
87
|
}
|
|
84
88
|
overflow: hidden;
|
|
89
|
+
|
|
90
|
+
background-color: #fbfdff;
|
|
91
|
+
border: 1px dashed #c0ccda;
|
|
92
|
+
border-radius: 6px;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
width: 148px;
|
|
95
|
+
height: 148px;
|
|
96
|
+
line-height: 146px;
|
|
97
|
+
vertical-align: top;
|
|
98
|
+
|
|
99
|
+
&:hover {
|
|
100
|
+
/* assets/css/bread/admin.less */
|
|
101
|
+
border-color: #409eff;
|
|
102
|
+
}
|
|
85
103
|
}
|
|
86
104
|
|
|
87
105
|
.c-admin-info {
|
|
@@ -116,7 +134,7 @@
|
|
|
116
134
|
}
|
|
117
135
|
.el-select {
|
|
118
136
|
/* assets/css/bread/admin.less */
|
|
119
|
-
.el-
|
|
137
|
+
.el-select__wrapper {
|
|
120
138
|
/* assets/css/bread/admin.less */
|
|
121
139
|
border-top-left-radius: 0;
|
|
122
140
|
border-bottom-left-radius: 0;
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
/* assets/css/bread/breadcrumb.less */
|
|
42
42
|
.u-title {
|
|
43
43
|
/* assets/css/bread/breadcrumb.less */
|
|
44
|
-
color:
|
|
44
|
+
color: var(--el-color-primary);
|
|
45
45
|
}
|
|
46
46
|
.u-channel-logo svg {
|
|
47
47
|
/* assets/css/bread/breadcrumb.less */
|
|
48
|
-
fill:
|
|
48
|
+
fill: var(--el-color-primary);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
/* assets/css/bread/breadcrumb.less */
|
|
123
123
|
.pa;
|
|
124
124
|
.rt(10px);
|
|
125
|
+
.flex(y);gap:10px;
|
|
126
|
+
|
|
127
|
+
.el-button{margin:0 !important;}
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
.c-breadcrumb.isOverlay {
|