@jx3box/jx3box-editor 3.2.5 → 3.2.7
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 +70 -0
- package/.storybook/middleware.js +73 -0
- package/.storybook/preview.js +90 -0
- package/package.json +9 -1
- package/src/Article.vue +6 -1
- package/src/ArticleMarkdown.vue +1 -1
- package/src/assets/css/markdown/markdown-article.less +13 -13
- package/src/assets/css/markdown/markdown-editor.less +11 -11
- package/src/components/Author.vue +312 -52
- package/src/components/QRcode.vue +1 -1
- package/src/service/cms.js +13 -1
- package/src/storybook/storybook-vars.less +1 -0
- package/src/storybook/storybook.helpers.js +154 -0
- package/stories/components/Author.stories.js +36 -0
- package/stories/components/Avatar.stories.js +55 -0
- package/stories/components/Combo.stories.js +37 -0
- package/stories/components/Letter.stories.js +30 -0
- package/stories/components/PostAuthor.stories.js +32 -0
- package/stories/components/QRcode.stories.js +37 -0
- package/stories/components/SkillMartial.stories.js +31 -0
- package/stories/exports/Article.stories.js +48 -0
- package/stories/exports/BoxResource.stories.js +31 -0
- package/stories/exports/Buff.stories.js +38 -0
- package/stories/exports/GameText.stories.js +38 -0
- package/stories/exports/Item.stories.js +51 -0
- package/stories/exports/ItemSimple.stories.js +50 -0
- package/stories/exports/Markdown.stories.js +46 -0
- package/stories/exports/Npc.stories.js +35 -0
- package/stories/exports/Resource.stories.js +29 -0
- package/stories/exports/Skill.stories.js +38 -0
- package/stories/exports/Tinymce.stories.js +46 -0
- package/stories/exports/Upload.stories.js +41 -0
- package/stories/exports/UploadAlbum.stories.js +31 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Author from "../../src/components/Author.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Author",
|
|
6
|
+
component: Author,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
uid: 10086,
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
uid: {
|
|
13
|
+
description: "作者 UID。",
|
|
14
|
+
control: "text",
|
|
15
|
+
table: { type: { summary: "String | Number" }, category: "required" },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "padded",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: "作者信息卡片。组件会在侦听 `uid` 后请求远程作者数据,因此在 Storybook 中主要用于查看 props 文档。",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Overview = previewStory(Author, {
|
|
29
|
+
title: "作者卡片预览",
|
|
30
|
+
description: "这里直接使用项目 demo 中出现过的作者 UID:`8`。如果接口可用,就能看到完整作者卡片,而不是只有 props 表。",
|
|
31
|
+
code: `<Author :uid="8" />`,
|
|
32
|
+
style: "min-width: 420px; display: flex; justify-content: flex-start;",
|
|
33
|
+
});
|
|
34
|
+
Overview.args = {
|
|
35
|
+
uid: 8,
|
|
36
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Avatar from "../../src/components/Avatar.vue";
|
|
2
|
+
import { componentStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Avatar",
|
|
6
|
+
component: Avatar,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
uid: 10086,
|
|
10
|
+
url: "https://cdn.jx3box.com/image/avatar/1024.jpg",
|
|
11
|
+
frame: "",
|
|
12
|
+
size: "s",
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
uid: {
|
|
16
|
+
description: "用户 UID。",
|
|
17
|
+
control: "text",
|
|
18
|
+
table: { type: { summary: "String | Number" }, category: "required" },
|
|
19
|
+
},
|
|
20
|
+
url: {
|
|
21
|
+
description: "头像地址,为空时走默认头像逻辑。",
|
|
22
|
+
control: "text",
|
|
23
|
+
table: { type: { summary: "String" }, defaultValue: { summary: "''" } },
|
|
24
|
+
},
|
|
25
|
+
frame: {
|
|
26
|
+
description: "头像框标识。",
|
|
27
|
+
control: "text",
|
|
28
|
+
table: { type: { summary: "String" }, defaultValue: { summary: "''" } },
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
description: "头像尺寸,可传内置尺寸名或数值。",
|
|
32
|
+
control: "text",
|
|
33
|
+
table: { type: { summary: "String | Number" }, defaultValue: { summary: "'s'" } },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
parameters: {
|
|
37
|
+
layout: "padded",
|
|
38
|
+
docs: {
|
|
39
|
+
description: {
|
|
40
|
+
component: "展示用户头像与可选头像框。适合直接查看 `uid`、`url`、`frame`、`size` 的传值方式。",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Default = componentStory(Avatar, {
|
|
47
|
+
style: "padding: 24px; background: #f8fafc; display: inline-flex; border-radius: 12px;",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const Large = componentStory(Avatar, {
|
|
51
|
+
style: "padding: 24px; background: #f8fafc; display: inline-flex; border-radius: 12px;",
|
|
52
|
+
});
|
|
53
|
+
Large.args = {
|
|
54
|
+
size: 136,
|
|
55
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Combo from "../../src/components/Combo.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Combo",
|
|
6
|
+
component: Combo,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
modelValue: false,
|
|
10
|
+
subtype: "通用",
|
|
11
|
+
query: "",
|
|
12
|
+
client: "std",
|
|
13
|
+
strict: false,
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
modelValue: { description: "控制连招面板的显隐。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "false" } } },
|
|
17
|
+
subtype: { description: "心法或分类。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'通用'" } } },
|
|
18
|
+
query: { description: "默认搜索关键字。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "''" } } },
|
|
19
|
+
client: { description: "客户端类型。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'std'" } } },
|
|
20
|
+
strict: { description: "是否开启精确搜索。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "false" } } },
|
|
21
|
+
},
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: "padded",
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component: "技能连招编辑组件。依赖技能数据接口、右键菜单和拖拽交互,适合先通过 Storybook 查看 props 定义。",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Overview = previewStory(Combo, {
|
|
33
|
+
title: "连招编辑区域预览",
|
|
34
|
+
description: "这里直接渲染组件主体。虽然完整交互依赖远程技能数据,但至少可以看到 tabs、已选区域和整体布局,不再只是说明文字。",
|
|
35
|
+
code: `<Combo :modelValue="false" subtype="通用" client="std" />`,
|
|
36
|
+
style: "min-width: 1180px;",
|
|
37
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Letter from "../../src/components/Letter.vue";
|
|
2
|
+
import { componentStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Letter",
|
|
6
|
+
component: Letter,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
data: {
|
|
10
|
+
slug: "demo",
|
|
11
|
+
remark: "示例信纸标题",
|
|
12
|
+
style: ".letter--demo{padding:24px;border:1px solid #d4b483;border-radius:12px;background:linear-gradient(180deg,#fff9ef,#fff3dc)}.letter-title--demo{font-size:20px;font-weight:700;color:#7c4a03}",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
data: { description: "信纸数据对象,需要至少包含 `slug`、`remark`、`style`。", control: "object", table: { type: { summary: "Object" }, defaultValue: { summary: "undefined" } } },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "padded",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: "信纸渲染组件。使用时必须传入完整的 `data` 对象,否则组件会在立即执行的 watcher 中报错。",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Default = componentStory(Letter, {
|
|
29
|
+
style: "min-width: 360px; background: #faf7f2; padding: 24px; border-radius: 12px;",
|
|
30
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import PostAuthor from "../../src/components/PostAuthor.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/PostAuthor",
|
|
6
|
+
component: PostAuthor,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
id: 1,
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
id: { description: "作者或内容关联 ID。", control: "text", table: { type: { summary: "String | Number" }, defaultValue: { summary: "''" } } },
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: "padded",
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: "帖子作者信息组件。侦听 `id` 后会请求情绪或作者详情接口,当前 Storybook 主要展示 props。",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Overview = previewStory(PostAuthor, {
|
|
25
|
+
title: "帖子作者信息预览",
|
|
26
|
+
description: "该组件依赖远程接口。这里给出一个最小可运行示例,便于直接观察渲染结构。",
|
|
27
|
+
code: `<PostAuthor :id="3102" />`,
|
|
28
|
+
style: "min-width: 420px; display: flex; justify-content: flex-start;",
|
|
29
|
+
});
|
|
30
|
+
Overview.args = {
|
|
31
|
+
id: 3102,
|
|
32
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import QRcode from "../../src/components/QRcode.vue";
|
|
2
|
+
import { componentStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/QRcode",
|
|
6
|
+
component: QRcode,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
href: "https://editor.jx3box.com",
|
|
10
|
+
s: 120,
|
|
11
|
+
v: "static",
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
href: { description: "二维码目标地址;为空时使用当前页面地址。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "''" } } },
|
|
15
|
+
s: { description: "二维码尺寸。", control: "text", table: { type: { summary: "String | Number" }, defaultValue: { summary: "100" } } },
|
|
16
|
+
v: { description: "展示模式,可选 `cms` 或 `static`。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'cms'" } } },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "padded",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: "二维码组件,可用于 CMS 悬浮入口或静态展示模式。",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Static = componentStory(QRcode, {
|
|
29
|
+
style: "padding: 24px; background: #f8fafc; border-radius: 12px;",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const CmsTrigger = componentStory(QRcode, {
|
|
33
|
+
style: "padding: 24px; background: #f8fafc; border-radius: 12px;",
|
|
34
|
+
});
|
|
35
|
+
CmsTrigger.args = {
|
|
36
|
+
v: "cms",
|
|
37
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import SkillMartial from "../../src/components/SkillMartial.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/SkillMartial",
|
|
6
|
+
component: SkillMartial,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
subtype: "通用",
|
|
10
|
+
client: "std",
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
subtype: { description: "心法或技能分类。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'通用'" } } },
|
|
14
|
+
client: { description: "客户端类型。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'std'" } } },
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "padded",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: "武学技能组件。挂载后会根据 `subtype` 和 `client` 拉取技能与天赋数据,适合先在 Storybook 中确认 props 调用方式。",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Overview = previewStory(SkillMartial, {
|
|
27
|
+
title: "门派武学预览",
|
|
28
|
+
description: "这里直接渲染默认的 `通用 + std` 模式。接口可用时会展示技能分组列表,能更直观看到组件的实际用途。",
|
|
29
|
+
code: `<SkillMartial subtype="通用" client="std" />`,
|
|
30
|
+
style: "min-width: 960px;",
|
|
31
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Article from "../../src/Article.vue";
|
|
2
|
+
import { previewStory, useDemoText } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/Article",
|
|
6
|
+
component: Article,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
post_mode: "tinymce",
|
|
10
|
+
content: "<p>示例内容</p>",
|
|
11
|
+
cdnDomain: "https://cdn.jx3box.com",
|
|
12
|
+
linkWhitelist: [],
|
|
13
|
+
linkStrict: false,
|
|
14
|
+
iframeWhitelist: [],
|
|
15
|
+
directorybox: "",
|
|
16
|
+
pageable: true,
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
post_mode: { description: "文章来源模式。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'tinymce'" } } },
|
|
20
|
+
content: { description: "待渲染的 HTML 内容。", control: "text", table: { type: { summary: "String" } } },
|
|
21
|
+
cdnDomain: { description: "相对资源地址拼接使用的 CDN 域名。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'https://cdn.jx3box.com'" } } },
|
|
22
|
+
linkWhitelist: { description: "链接白名单。", control: "object", table: { type: { summary: "Array" }, defaultValue: { summary: "[]" } } },
|
|
23
|
+
linkStrict: { description: "开启后不在白名单的链接将被禁用。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "false" } } },
|
|
24
|
+
iframeWhitelist: { description: "iframe 白名单。", control: "object", table: { type: { summary: "Array" }, defaultValue: { summary: "[]" } } },
|
|
25
|
+
directorybox: { description: "目录容器选择器。", control: "text", table: { type: { summary: "String" } } },
|
|
26
|
+
pageable: { description: "是否分页展示长文。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "true" } } },
|
|
27
|
+
},
|
|
28
|
+
parameters: {
|
|
29
|
+
layout: "padded",
|
|
30
|
+
docs: {
|
|
31
|
+
description: {
|
|
32
|
+
component: "富文本文章渲染组件。依赖较多运行时行为、目录处理和内嵌弹层组件,Storybook 主要用于查看 props。",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Overview = previewStory(Article, {
|
|
39
|
+
title: "富文本文章预览",
|
|
40
|
+
description: "这里直接加载项目现有的 `public/demo/article_basic.html` 作为示例内容。这样能看到分页后的文章排版、图片、表格和基础富文本效果。",
|
|
41
|
+
code: `<Article :content="html" post_mode="tinymce" :pageable="true" />`,
|
|
42
|
+
style: "min-width: 960px;",
|
|
43
|
+
setup() {
|
|
44
|
+
const { content } = useDemoText("/demo/article_basic.html", "<p>加载中...</p>");
|
|
45
|
+
return { html: content };
|
|
46
|
+
},
|
|
47
|
+
template: `<StoryComponent v-bind="args" :content="html" />`,
|
|
48
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import BoxResource from "../../src/BoxResource.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/BoxResource",
|
|
6
|
+
component: BoxResource,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
enable: true,
|
|
10
|
+
subtype: "通用",
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
enable: { description: "是否允许打开资源面板。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "true" } } },
|
|
14
|
+
subtype: { description: "心法分类,会影响连招等子资源。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'通用'" } } },
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "padded",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: "JX3BOX 资源插入组件。挂载后会组合作者、情绪、信纸、连招等多类资源数据。",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Overview = previewStory(BoxResource, {
|
|
27
|
+
title: "魔盒资源入口预览",
|
|
28
|
+
description: "这个预览直接展示魔盒资源按钮。点击后会进入作者、连招、趣图、信纸等资源的真实弹窗流程。",
|
|
29
|
+
code: `<BoxResource :enable="true" subtype="通用" @insert="handleInsert" />`,
|
|
30
|
+
style: "min-width: 360px; display: flex; justify-content: flex-start; align-items: center;",
|
|
31
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Buff from "../../src/Buff.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/Buff",
|
|
6
|
+
component: Buff,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
client: "std",
|
|
10
|
+
id: "",
|
|
11
|
+
level: "",
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
client: { description: "客户端类型。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'std'" } } },
|
|
15
|
+
id: { description: "Buff ID。", control: "text", table: { type: { summary: "String | Number" }, defaultValue: { summary: "''" } } },
|
|
16
|
+
level: { description: "Buff 等级。", control: "text", table: { type: { summary: "String | Number" }, defaultValue: { summary: "''" } } },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "padded",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: "Buff 信息展示组件。根据 `client`、`id`、`level` 拉取对应 Buff 数据。",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Overview = previewStory(Buff, {
|
|
29
|
+
title: "Buff 信息预览",
|
|
30
|
+
description: "这里直接使用项目 demo 中出现过的 Buff 参数:`id=122`、`level=1`。如果接口可用,就能直接看到实际 Buff 卡片。",
|
|
31
|
+
code: `<Buff client="std" :id="122" :level="1" />`,
|
|
32
|
+
style: "min-width: 420px; display: flex; justify-content: flex-start;",
|
|
33
|
+
});
|
|
34
|
+
Overview.args = {
|
|
35
|
+
client: "std",
|
|
36
|
+
id: 122,
|
|
37
|
+
level: 1,
|
|
38
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import GameText from "../../src/GameText.vue";
|
|
2
|
+
import { componentStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/GameText",
|
|
6
|
+
component: GameText,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
text: "普通文本示例",
|
|
10
|
+
ignoreColor: false,
|
|
11
|
+
client: "std",
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
text: { description: "游戏内 Text 标签文本或普通文本。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "''" } } },
|
|
15
|
+
ignoreColor: { description: "是否忽略游戏文本中的颜色信息。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "false" } } },
|
|
16
|
+
client: { description: "客户端类型。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'std'" } } },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: "padded",
|
|
20
|
+
docs: {
|
|
21
|
+
description: {
|
|
22
|
+
component: "用于渲染游戏内 Text 标签文本。普通文本场景可直接在 Storybook 中查看效果。",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const PlainText = componentStory(GameText, {
|
|
29
|
+
style: "padding: 24px; min-width: 320px; background: #fff; border-radius: 12px;",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const IgnoreColor = componentStory(GameText, {
|
|
33
|
+
style: "padding: 24px; min-width: 320px; background: #fff; border-radius: 12px;",
|
|
34
|
+
});
|
|
35
|
+
IgnoreColor.args = {
|
|
36
|
+
text: "支持关闭颜色渲染的文本示例",
|
|
37
|
+
ignoreColor: true,
|
|
38
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import Item from "../../src/Item.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/Item",
|
|
6
|
+
component: Item,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
item: undefined,
|
|
10
|
+
item_id: "",
|
|
11
|
+
client: "std",
|
|
12
|
+
jx3ClientType: 1,
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
item: { description: "已完整准备好的物品数据对象。", control: "object", table: { type: { summary: "Object" } } },
|
|
16
|
+
item_id: { description: "物品 ID;传入后会触发数据请求。", control: "text", table: { type: { summary: "String" } } },
|
|
17
|
+
client: { description: "客户端类型。", control: "text", table: { type: { summary: "String" } } },
|
|
18
|
+
jx3ClientType: { description: "客户端数字类型,1 为重制,2 为缘起。", control: "number", table: { type: { summary: "Number" } } },
|
|
19
|
+
},
|
|
20
|
+
parameters: {
|
|
21
|
+
layout: "padded",
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component: "物品详情组件。可以直接传完整 `item` 对象,也可以通过 `item_id` 触发远程拉取。",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Overview = previewStory(Item, {
|
|
31
|
+
title: "物品详情预览",
|
|
32
|
+
description: "这里使用手工 mock 的 `item` 对象直接渲染详情组件,便于先看清布局和信息密度。实际业务里也可以改用 `item_id` 让组件自行拉取。",
|
|
33
|
+
code: `<Item :item="itemData" :jx3ClientType="1" />`,
|
|
34
|
+
style: "min-width: 520px; display: flex; justify-content: flex-start;",
|
|
35
|
+
});
|
|
36
|
+
Overview.args = {
|
|
37
|
+
item: {
|
|
38
|
+
Name: "示例道具",
|
|
39
|
+
IconID: 1024,
|
|
40
|
+
Quality: 4,
|
|
41
|
+
MaxDurability: 100,
|
|
42
|
+
Durable: 80,
|
|
43
|
+
Desc: "用于 Storybook 预览的示例道具描述。",
|
|
44
|
+
Level: 120,
|
|
45
|
+
Genre: 1,
|
|
46
|
+
DetailType: 1,
|
|
47
|
+
Source: "Storybook Mock",
|
|
48
|
+
GetType: "演示生成",
|
|
49
|
+
},
|
|
50
|
+
jx3ClientType: 1,
|
|
51
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import ItemSimple from "../../src/ItemSimple.vue";
|
|
2
|
+
import { componentStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
const demoItem = {
|
|
5
|
+
id: "10001",
|
|
6
|
+
Name: "示例道具",
|
|
7
|
+
Quality: 4,
|
|
8
|
+
IconID: 1024,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: "Exports/ItemSimple",
|
|
13
|
+
component: ItemSimple,
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
args: {
|
|
16
|
+
item: demoItem,
|
|
17
|
+
onlyIcon: false,
|
|
18
|
+
iconSize: "48px",
|
|
19
|
+
withName: true,
|
|
20
|
+
jx3ClientType: 1,
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
item: { description: "道具对象,至少建议包含 `id`、`Name`、`Quality`、`IconID`。", control: "object", table: { type: { summary: "Object" } } },
|
|
24
|
+
onlyIcon: { description: "是否仅显示图标。", control: "boolean", table: { type: { summary: "Boolean" } } },
|
|
25
|
+
iconSize: { description: "图标尺寸。", control: "text", table: { type: { summary: "String | Number" } } },
|
|
26
|
+
withName: { description: "是否显示名称。", control: "boolean", table: { type: { summary: "Boolean" } } },
|
|
27
|
+
jx3ClientType: { description: "客户端数字类型。", control: "number", table: { type: { summary: "Number" } } },
|
|
28
|
+
},
|
|
29
|
+
parameters: {
|
|
30
|
+
layout: "padded",
|
|
31
|
+
docs: {
|
|
32
|
+
description: {
|
|
33
|
+
component: "简化版道具展示组件。适合在列表和内联文本中快速展示道具图标与名称。",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Default = componentStory(ItemSimple, {
|
|
40
|
+
style: "padding: 24px; min-width: 240px; background: #0f172a; border-radius: 12px;",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const IconOnly = componentStory(ItemSimple, {
|
|
44
|
+
style: "padding: 24px; min-width: 120px; background: #0f172a; border-radius: 12px;",
|
|
45
|
+
});
|
|
46
|
+
IconOnly.args = {
|
|
47
|
+
onlyIcon: true,
|
|
48
|
+
withName: false,
|
|
49
|
+
iconSize: "56px",
|
|
50
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import Markdown from "../../src/Markdown.vue";
|
|
2
|
+
import { previewStory, useDemoText } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/Markdown",
|
|
6
|
+
component: Markdown,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
modelValue: "",
|
|
10
|
+
content: "",
|
|
11
|
+
editable: true,
|
|
12
|
+
attachmentEnable: true,
|
|
13
|
+
resourceEnable: true,
|
|
14
|
+
placeholder: "支持 Markdown,支持 Ctrl+V 粘贴图片上传",
|
|
15
|
+
height: 720,
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
modelValue: { description: "Vue 3 `v-model` 绑定值。", control: "text", table: { type: { summary: "String" } } },
|
|
19
|
+
content: { description: "兼容旧用法的初始内容。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "''" } } },
|
|
20
|
+
editable: { description: "是否可编辑。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "true" } } },
|
|
21
|
+
attachmentEnable: { description: "是否启用附件上传。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "true" } } },
|
|
22
|
+
resourceEnable: { description: "是否启用资源插入。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "true" } } },
|
|
23
|
+
placeholder: { description: "编辑器占位文本。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'支持 Markdown,支持 Ctrl+V 粘贴图片上传'" } } },
|
|
24
|
+
height: { description: "编辑器高度。", control: "text", table: { type: { summary: "String | Number" }, defaultValue: { summary: "720" } } },
|
|
25
|
+
},
|
|
26
|
+
parameters: {
|
|
27
|
+
layout: "padded",
|
|
28
|
+
docs: {
|
|
29
|
+
description: {
|
|
30
|
+
component: "Markdown 编辑器组件。依赖 Vditor、上传接口和浏览器编辑环境,当前 Storybook 主要用于 props 文档。",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Overview = previewStory(Markdown, {
|
|
37
|
+
title: "Markdown 编辑器预览",
|
|
38
|
+
description: "使用项目调试页同一份 Markdown 示例内容,直接展示编辑器加载后的样子。",
|
|
39
|
+
code: `<Markdown v-model="content" :editable="true" :height="720" />`,
|
|
40
|
+
style: "min-width: 1080px;",
|
|
41
|
+
setup() {
|
|
42
|
+
const { content } = useDemoText("/demo/article_markdown.html", "# 加载中");
|
|
43
|
+
return { content };
|
|
44
|
+
},
|
|
45
|
+
template: `<StoryComponent v-bind="args" v-model="content" />`,
|
|
46
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Npc from "../../src/Npc.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/Npc",
|
|
6
|
+
component: Npc,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
client: "std",
|
|
10
|
+
id: "",
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
client: { description: "客户端类型。", control: "text", table: { type: { summary: "String" }, defaultValue: { summary: "'std'" } } },
|
|
14
|
+
id: { description: "NPC ID。", control: "text", table: { type: { summary: "String | Number" }, defaultValue: { summary: "''" } } },
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: "padded",
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: "NPC 信息展示组件。根据 `client` 与 `id` 查询 NPC 数据。",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Overview = previewStory(Npc, {
|
|
27
|
+
title: "NPC 信息预览",
|
|
28
|
+
description: "这里使用项目 demo 中出现的 NPC 参数:`id=69700`。接口可用时可以直接看到实际 NPC 信息卡片。",
|
|
29
|
+
code: `<Npc client="std" :id="69700" />`,
|
|
30
|
+
style: "min-width: 420px; display: flex; justify-content: flex-start;",
|
|
31
|
+
});
|
|
32
|
+
Overview.args = {
|
|
33
|
+
client: "std",
|
|
34
|
+
id: 69700,
|
|
35
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Resource from "../../src/Resource.vue";
|
|
2
|
+
import { previewStory } from "../../src/storybook/storybook.helpers";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Exports/Resource",
|
|
6
|
+
component: Resource,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
args: {
|
|
9
|
+
enable: true,
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
enable: { description: "是否允许点击打开资源面板。", control: "boolean", table: { type: { summary: "Boolean" }, defaultValue: { summary: "true" } } },
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: "padded",
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: "剑三数据库资源选择组件。主要通过弹窗检索并插入 Buff、Skill、Item、NPC 等资源。",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Overview = previewStory(Resource, {
|
|
25
|
+
title: "剑三资源入口预览",
|
|
26
|
+
description: "这个预览先展示触发按钮本身。点击后会进入真实的资源弹窗逻辑,适合确认组件在页面中的入口外观和基础交互。",
|
|
27
|
+
code: `<Resource :enable="true" @insert="handleInsert" />`,
|
|
28
|
+
style: "min-width: 360px; display: flex; justify-content: flex-start; align-items: center;",
|
|
29
|
+
});
|