@2kog/kacha 0.0.0-stage → 0.1.1

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.
Files changed (40) hide show
  1. package/README.md +63 -2
  2. package/bin/init-project.js +63 -0
  3. package/bin/kacha.js +51 -0
  4. package/index.html +5 -0
  5. package/package.json +45 -4
  6. package/server/asset-directories.js +65 -0
  7. package/server/asset-watch.js +35 -0
  8. package/server/character-assets.js +399 -0
  9. package/server/image-assets.js +652 -0
  10. package/server/index.js +15 -0
  11. package/server/project-brand.js +56 -0
  12. package/server/project-paths.js +4 -0
  13. package/server/project-settings.js +55 -0
  14. package/src/App.vue +34 -0
  15. package/src/assets/css/workbench.css +272 -0
  16. package/src/assets/img/rabbit-mark.svg +1 -0
  17. package/src/components/AssetDeleteButton.vue +53 -0
  18. package/src/components/AssetHistory.vue +40 -0
  19. package/src/components/AssetStoryEditor.vue +32 -0
  20. package/src/components/AssetTagInput.vue +26 -0
  21. package/src/components/ProjectMarkdown.vue +33 -0
  22. package/src/i18n/en.json +163 -0
  23. package/src/i18n/index.js +40 -0
  24. package/src/layouts/WorkbenchLayout.vue +61 -0
  25. package/src/main.js +7 -0
  26. package/src/router/index.js +38 -0
  27. package/src/service/assets.js +13 -0
  28. package/src/service/project-markdown.js +26 -0
  29. package/src/views/assets/AudioAssets.vue +325 -0
  30. package/src/views/assets/CharacterAssets.vue +412 -0
  31. package/src/views/assets/ImageAssets.vue +456 -0
  32. package/src/views/settings/ProjectSettings.vue +80 -0
  33. package/templates/project/AGENTS.md +14 -0
  34. package/templates/project/README.md +7 -0
  35. package/templates/project/assets/audio/README.md +5 -0
  36. package/templates/project/assets/characters/README.md +5 -0
  37. package/templates/project/assets/other/README.md +3 -0
  38. package/templates/project/assets/props/README.md +3 -0
  39. package/templates/project/assets/scenes/README.md +3 -0
  40. package/vite.config.js +10 -0
@@ -0,0 +1,56 @@
1
+ import { readFile, readdir } from 'node:fs/promises'
2
+ import path from 'node:path'
3
+ import { projectRoot } from './project-paths.js'
4
+
5
+ const logoTypes = {
6
+ svg: 'image/svg+xml',
7
+ png: 'image/png',
8
+ webp: 'image/webp',
9
+ avif: 'image/avif',
10
+ jpg: 'image/jpeg',
11
+ jpeg: 'image/jpeg',
12
+ gif: 'image/gif',
13
+ ico: 'image/x-icon',
14
+ bmp: 'image/bmp',
15
+ }
16
+
17
+ const config = path.join(projectRoot, 'config')
18
+ const manifest = path.join(projectRoot, 'package.json')
19
+
20
+ async function readBrand() {
21
+ const metadata = await readFile(manifest, 'utf8').then(JSON.parse).catch(() => null)
22
+ const name = typeof metadata?.name === 'string' ? metadata.name.trim() : ''
23
+ const description = typeof metadata?.description === 'string' ? metadata.description.trim() : ''
24
+ const files = await readdir(config, { withFileTypes: true }).catch(() => [])
25
+ for (const [extension, type] of Object.entries(logoTypes)) {
26
+ const filename = 'logo.' + extension
27
+ if (!files.some(file => file.name === filename && file.isFile())) continue
28
+ const image = await readFile(path.join(config, filename)).catch(() => null)
29
+ if (image?.length) return { name, description, logo: 'data:' + type + ';base64,' + image.toString('base64') }
30
+ }
31
+ return { name, description, logo: '' }
32
+ }
33
+
34
+ export function projectBrand() {
35
+ const id = 'virtual:project-brand'
36
+ return {
37
+ name: 'workbench-project-brand',
38
+ resolveId(source) {
39
+ if (source === id) return '\0' + id
40
+ },
41
+ async load(source) {
42
+ if (source === '\0' + id) return 'export default ' + JSON.stringify(await readBrand())
43
+ },
44
+ configureServer(server) {
45
+ const refresh = filename => {
46
+ if (filename !== manifest && !filename.startsWith(path.join(config, 'logo.'))) return
47
+ const module = server.moduleGraph.getModuleById('\0' + id)
48
+ if (!module) return
49
+ server.moduleGraph.invalidateModule(module)
50
+ server.ws.send({ type: 'full-reload' })
51
+ }
52
+ server.watcher.add([manifest, config])
53
+ server.watcher.on('add', refresh).on('change', refresh).on('unlink', refresh)
54
+ },
55
+ }
56
+ }
@@ -0,0 +1,4 @@
1
+ import path from 'node:path'
2
+
3
+ export const projectRoot = path.resolve(process.env.KACHA_PROJECT_ROOT || process.cwd())
4
+ export const assetRoot = kind => path.join(projectRoot, 'assets', kind)
@@ -0,0 +1,55 @@
1
+ import * as fs from 'node:fs/promises'
2
+ import path from 'node:path'
3
+ import { projectRoot } from './project-paths.js'
4
+
5
+ const root = projectRoot
6
+ const documents = [
7
+ { group: '故事设定', title: '世界观与角色', file: 'docs/世界观与角色.md' },
8
+ { group: '美术设定', title: '角色美术', file: 'docs/角色美术设定.md' },
9
+ { group: '美术设定', title: '场景与空间', file: 'assets/scenes/README.md' },
10
+ { group: '美术设定', title: '道具美术', file: 'docs/道具美术设定.md' },
11
+ { group: '生成与制作', title: '3D 电影 CG 风格', file: 'docs/3D电影CG风格与生成工作流.md' },
12
+ { group: '生成与制作', title: '分镜与视频生成', file: 'docs/agents/production-workflow.md' },
13
+ { group: '生成与制作', title: '角色原画与三视图', file: 'docs/角色双版本与3D高清生成规范.md' },
14
+ ]
15
+ const types = { '.md': 'text/plain; charset=utf-8', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.avif': 'image/avif', '.gif': 'image/gif' }
16
+
17
+ export function projectSettings() {
18
+ return {
19
+ name: 'workbench-project-settings',
20
+ configureServer(server) {
21
+ server.middlewares.use(async (req, res, next) => {
22
+ const url = new URL(req.url, 'http://localhost')
23
+ if (url.pathname !== '/api/settings') return next()
24
+ if (req.method !== 'GET') {
25
+ res.statusCode = 405
26
+ return res.end()
27
+ }
28
+ if (!url.searchParams.has('file')) {
29
+ res.setHeader('Content-Type', 'application/json; charset=utf-8')
30
+ return res.end(JSON.stringify(documents))
31
+ }
32
+ const requested = url.searchParams.get('file')
33
+ const allowedRoot = requested.split('/')[0]
34
+ const file = path.resolve(root, requested)
35
+ const type = types[path.extname(file).toLowerCase()]
36
+ const base = path.resolve(root, allowedRoot)
37
+ if (!['docs', 'assets', 'scripts', 'storyboard'].includes(allowedRoot)
38
+ || !file.startsWith(base + path.sep) || !type || await fs.realpath(file).catch(() => '') !== file) {
39
+ res.statusCode = 404
40
+ return res.end('找不到项目文档或参考图')
41
+ }
42
+ try {
43
+ const data = await fs.readFile(file)
44
+ res.setHeader('Content-Type', type)
45
+ res.setHeader('X-Content-Type-Options', 'nosniff')
46
+ res.setHeader('Cache-Control', 'no-cache')
47
+ res.end(data)
48
+ } catch (cause) {
49
+ res.statusCode = cause.code === 'ENOENT' ? 404 : 500
50
+ res.end('无法读取项目文件')
51
+ }
52
+ })
53
+ },
54
+ }
55
+ }
package/src/App.vue ADDED
@@ -0,0 +1,34 @@
1
+ <script>
2
+ import { ElConfigProvider } from 'element-plus'
3
+ import en from 'element-plus/es/locale/lang/en'
4
+ import zhCn from 'element-plus/es/locale/lang/zh-cn'
5
+ import { language } from '@/i18n/index.js'
6
+ import projectBrand from 'virtual:project-brand'
7
+
8
+ export default {
9
+ components: { ElConfigProvider },
10
+ computed: {
11
+ elementLocale() {
12
+ return language.locale === 'en' ? en : zhCn
13
+ },
14
+ pageTitle() {
15
+ const page = this.$t(this.$route.meta.label || '制作工作台')
16
+ return [page, projectBrand.name].filter(Boolean).join(' · ')
17
+ },
18
+ },
19
+ watch: {
20
+ pageTitle: {
21
+ immediate: true,
22
+ handler(title) {
23
+ document.title = title
24
+ },
25
+ },
26
+ },
27
+ }
28
+ </script>
29
+
30
+ <template>
31
+ <ElConfigProvider :locale="elementLocale">
32
+ <RouterView />
33
+ </ElConfigProvider>
34
+ </template>
@@ -0,0 +1,272 @@
1
+ :root {
2
+ font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
3
+ color: #1f2937;
4
+ background: #f6f8fa;
5
+ font-synthesis: none;
6
+ --muted: #64748b;
7
+ --line: #e2e8f0;
8
+ --accent: #5b5cf5;
9
+ --accent-bg: #eef2ff;
10
+ --focus-border: #818cf8;
11
+ }
12
+ * { box-sizing: border-box; }
13
+ body { margin: 0; }
14
+ button, input, textarea { font: inherit; }
15
+ button { cursor: pointer; }
16
+ button:disabled { cursor: default; opacity: .55; }
17
+ button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
18
+ :is(button, a, summary, input, textarea, select):focus-visible { outline: none; }
19
+ button:focus-visible, summary:focus-visible, input[type="checkbox"]:focus-visible { box-shadow: inset 0 0 0 1px var(--focus-border); }
20
+ a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; }
21
+ .field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible,
22
+ .asset-story-panel textarea:focus-visible { border-color: var(--focus-border); }
23
+ @media (forced-colors: active) { :focus-visible { outline: 1px solid Highlight; outline-offset: -1px; } }
24
+ .shell { display: grid; min-height: 100vh; grid-template-columns: 208px minmax(0, 1fr); }
25
+ .sidebar { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--line); padding: 24px 14px; }
26
+ .brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 40px; }
27
+ .brand-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: #fff; }
28
+ .brand-icon:has(img) { background: transparent; }
29
+ .brand-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
30
+ .brand-rabbit { display: block; width: 84.21%; height: 84.21%; background: currentColor; mask: url('../img/rabbit-mark.svg') center / contain no-repeat; }
31
+ .brand strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
32
+ .brand small { color: var(--muted); font-size: 12px; }
33
+ .nav-title { margin: 0 11px 9px; font-size: 12px; color: var(--muted); }
34
+ .sidebar .nav-link { text-decoration: none; display: flex; align-items: center; gap: 9px; width: 100%; border: 0; border-radius: 8px; padding: 10px 11px; margin-bottom: 4px; background: transparent; color: #4b5367; text-align: left; font-size: 14px; }
35
+ .sidebar .nav-link:hover { background: #f4f4f9; }
36
+ .sidebar .nav-link.selected { color: var(--accent); background: var(--accent-bg); font-weight: 650; }
37
+ .nav-arrow { margin-left: auto; }
38
+ .topbar { display: flex; align-items: center; gap: 9px; height: 65px; padding: 0 34px; background: #fff; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
39
+ .topbar strong { color: #33384a; }
40
+ .topbar .language-control {
41
+ flex: none;
42
+ width: 148px;
43
+ margin-inline-start: auto;
44
+ --el-input-icon-color: var(--accent);
45
+ --el-select-input-color: var(--accent);
46
+ --el-text-color-regular: var(--accent);
47
+ --el-border-color-hover: var(--focus-border);
48
+ }
49
+ .topbar .language-control, .language-options { --el-color-primary: var(--accent); }
50
+ .language-options { --el-fill-color-light: var(--accent-bg); }
51
+ .content { max-width: 1530px; margin: 0 auto; padding: 32px 34px 44px; }
52
+ .heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
53
+ h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.04em; }
54
+ .heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
55
+ .primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: none; padding: 9px 14px; min-height: 38px; border-radius: 8px; font-size: 13px; font-weight: 650; text-decoration: none; }
56
+ .primary { color: #fff; background: var(--accent); border: 1px solid var(--accent); }
57
+ .primary:hover:not(:disabled) { background: #494ae6; }
58
+ .secondary { color: #434b62; background: #fff; border: 1px solid var(--line); }
59
+ .secondary:hover:not(:disabled) { border-color: #a9a5d9; }
60
+ .tools { display: flex; flex-direction: column; gap: 13px; margin: 22px 0 20px; }
61
+ .character-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
62
+ .character-toolbar-actions {
63
+ display: flex;
64
+ align-items: center;
65
+ min-height: 41px;
66
+ max-width: 100%;
67
+ margin-left: auto;
68
+ padding: 4px;
69
+ border: 1px solid var(--line);
70
+ border-radius: 10px;
71
+ background: #fff;
72
+ color: var(--muted);
73
+ font-size: 12px;
74
+ font-weight: 600;
75
+ }
76
+ .voice-filter, .cover-preview-control { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
77
+ .voice-filter { padding: 0 8px; cursor: pointer; }
78
+ .voice-filter .el-switch { --el-switch-on-color: var(--accent); }
79
+ .cover-preview-control { padding: 0 2px 0 8px; border-left: 1px solid var(--line); }
80
+ .cover-preview-options { display: flex; gap: 2px; padding: 2px; border-radius: 7px; background: #eef1f5; }
81
+ .cover-preview-options button {
82
+ min-width: 32px;
83
+ min-height: 24px;
84
+ padding: 0 4px;
85
+ border: 0;
86
+ border-radius: 5px;
87
+ background: transparent;
88
+ color: #4d536b;
89
+ font-size: 12px;
90
+ font-weight: 650;
91
+ }
92
+ .cover-preview-options button:hover { background: #fff; color: var(--accent); }
93
+ .cover-preview-options button[aria-pressed="true"] {
94
+ background: #fff;
95
+ color: var(--accent);
96
+ box-shadow: inset 0 0 0 1px var(--focus-border);
97
+ }
98
+ .search { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 0 12px; width: min(100%, 292px); background: #fff; border: 1px solid var(--line); border-radius: 8px; }
99
+ .search input { min-width: 0; width: 100%; height: 39px; outline: none; border: 0; background: transparent; font-size: 13px; }
100
+ .search:focus-within { border-color: var(--focus-border); }
101
+ .filter-list, .card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
102
+ .tag { color: #535970; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 5px 11px; font-size: 12px; line-height: 1.2; }
103
+ .tag:hover, .tag.chosen { background: var(--accent-bg); color: var(--accent); border-color: #d8d4fa; }
104
+ .tag.compact { background: #f2f2fa; border-color: transparent; font-size: 11px; padding: 4px 8px; }
105
+ .grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
106
+ .card { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: #fff; border-radius: 12px; box-shadow: 0 2px 3px #252a3807; }
107
+ .card:hover { border-color: #c9c4ef; }
108
+ .card-preview { position: relative; }
109
+ .cover { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; border: 0; padding: 0; background: #eeedf6; }
110
+ .cover img { display: block; width: 100%; height: 100%; object-fit: contain; }
111
+ .preview-toggle {
112
+ position: absolute;
113
+ right: 8px;
114
+ bottom: 8px;
115
+ display: flex;
116
+ gap: 2px;
117
+ padding: 2px;
118
+ border: 1px solid rgb(255 255 255 / 18%);
119
+ border-radius: 999px;
120
+ background: rgb(12 11 16 / 65%);
121
+ backdrop-filter: blur(8px);
122
+ box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
123
+ }
124
+ .preview-toggle button {
125
+ min-width: 28px;
126
+ min-height: 20px;
127
+ padding: 0 6px;
128
+ border: 0;
129
+ border-radius: 999px;
130
+ background: transparent;
131
+ color: #e3e1eb;
132
+ font-size: 10px;
133
+ font-weight: 650;
134
+ }
135
+ .preview-toggle button:hover { background: rgb(255 255 255 / 10%); color: #fff; }
136
+ .preview-toggle button[aria-pressed="true"] { background: rgb(231 225 255 / 25%); color: #fff; }
137
+ .preview-toggle button:focus-visible { box-shadow: inset 0 0 0 1px #fff; }
138
+ .placeholder, .detail-placeholder { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; color: #686982; font-size: 12px; }
139
+ .card-info { padding: 11px 12px 0; }
140
+ .character-name { display: block; margin: 0 0 6px; padding: 0; border: 0; background: transparent; color: inherit; font-size: 15px; text-align: left; font-weight: 700; }
141
+ .card-tags { min-height: 21px; }
142
+ .indicators { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 9px; padding: 9px 0; border-top: 1px solid #eef0f6; }
143
+ .indicator { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; white-space: nowrap; color: var(--muted); }
144
+ .indicator-icon { position: relative; display: flex; }
145
+ .status-check { position: absolute; right: -3px; bottom: -2px; display: grid; place-items: center; width: 10px; height: 10px; border: 1px solid #fff; border-radius: 50%; background: #167348; color: #fff; }
146
+ .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
147
+ .empty, .error { padding: 14px; border-radius: 9px; background: #eeedf6; color: var(--muted); font-size: 14px; }
148
+ .error { color: #9e263b; background: #fdf0f3; }
149
+ .dialog { width: min(800px, calc(100vw - 28px)); max-height: calc(100dvh - 36px); padding: 0; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 25px 100px #20203c44; color: inherit; }
150
+ .asset-detail-dialog[open] { display: flex; flex-direction: column; height: min(820px, calc(100dvh - 36px)); overflow: hidden; }
151
+ .asset-detail-dialog > .dialog-head, .asset-detail-dialog > .tabs { flex: none; }
152
+ .asset-detail-dialog > .dialog-body { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
153
+ .dialog::backdrop { background: #19182f88; }
154
+ .small-dialog { width: min(430px, calc(100vw - 28px)); }
155
+ .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
156
+ .dialog-head h2 { margin: 0; font-size: 21px; }
157
+ .dialog-head .card-tags { margin-top: 4px; }
158
+ .dialog-head .card-tags:empty { display: none; }
159
+ .dialog-actions, .media-actions { display: flex; align-items: center; gap: 8px; }
160
+ .create-actions { justify-content: flex-end; }
161
+ .overview-actions { justify-content: space-between; align-items: center; flex-wrap: wrap; }
162
+ .overview-actions .overview-save-button { margin-left: auto; }
163
+ .overview-save-button, .overview-actions .overview-delete-button { min-width: 96px; }
164
+ .overview-actions :is(.overview-save-button, .overview-delete-button) { height: 38px; }
165
+ .overview-actions .overview-delete-button { border-radius: 8px; font-size: 13px; font-weight: 650; }
166
+ .icon-button { display: grid; place-items: center; color: var(--muted); background: #f4f4f9; border: 0; border-radius: 7px; width: 34px; height: 34px; }
167
+ .tabs { display: flex; overflow: auto; padding: 0 15px; border-bottom: 1px solid var(--line); }
168
+ .tabs button { flex: none; color: var(--muted); padding: 12px 10px; font-size: 13px; background: none; border: 0; border-bottom: 2px solid transparent; }
169
+ .tabs .current { color: var(--accent); border-color: var(--accent); font-weight: 650; }
170
+ .dialog-body { padding: 18px 22px 22px; }
171
+ .detail-image { display: block; width: 100%; max-height: 57dvh; object-fit: contain; background: #f4f4f9; border-radius: 9px; }
172
+ .detail-placeholder { min-height: 154px; background: #f4f4f9; border-radius: 9px; margin-bottom: 10px; }
173
+ .media-actions, .prompt, .extra-voice { margin-top: 13px; }
174
+ .upload { position: relative; cursor: pointer; }
175
+ .upload input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
176
+ .upload:focus-within { border-color: var(--focus-border); }
177
+ .asset-tag-field { display: grid; gap: 6px; }
178
+ .asset-tag-field > .field { margin-bottom: 0; }
179
+ .small-dialog .asset-tag-field { margin-bottom: 12px; }
180
+ .asset-story-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
181
+ .asset-story-actions > span { color: var(--muted); font-size: 13px; font-weight: 650; }
182
+ .asset-story-panel { height: 58dvh; overflow: auto; }
183
+ .asset-story-panel textarea { display: block; width: 100%; height: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; resize: none; font-family: ui-monospace, monospace; }
184
+ .edit-form { display: grid; gap: 13px; }
185
+ .field { display: grid; gap: 6px; margin-bottom: 10px; color: #4b5267; font-size: 13px; }
186
+ .field input, .field textarea { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; color: #262a38; background: #fff; }
187
+ .field textarea { resize: vertical; }
188
+ .asset-history a { color: var(--accent); }
189
+ .asset-history { border: 1px solid var(--line); border-radius: 10px; }
190
+ .asset-history-item + .asset-history-item { border-top: 1px solid var(--line); }
191
+ .asset-history-item summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 9px; cursor: pointer; list-style: none; }
192
+ .asset-history-item summary::-webkit-details-marker { display: none; }
193
+ .asset-history-item summary:hover { background: #f7f7fb; }
194
+ .asset-history-item[open] summary { background: var(--accent-bg); color: var(--accent); border-radius: 9px 9px 0 0; }
195
+ .asset-history-icon { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #f1effa; color: var(--accent); }
196
+ .asset-history-item[open] .asset-history-icon { background: #fff; }
197
+ .asset-history-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
198
+ .asset-history-title time { display: inline-block; margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
199
+ .asset-history-title small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
200
+ .asset-history-arrow { flex: none; transition: transform 150ms ease; }
201
+ .asset-history-item[open] .asset-history-arrow { transform: rotate(90deg); }
202
+ .asset-history-item .version-content { display: grid; gap: 12px; margin: 0; padding: 14px; }
203
+ .asset-history-item .version-content pre { white-space: pre-wrap; overflow-wrap: anywhere; }
204
+ @media (prefers-reduced-motion: reduce) { .asset-history-arrow { transition: none; } }
205
+ .version-content img { max-width: 100%; max-height: 40dvh; border-radius: 7px; }
206
+ pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; background: #f4f4f9; border-radius: 7px; }
207
+ audio { max-width: 100%; }
208
+ @media (max-width: 720px) {
209
+ .shell { display: block; }
210
+ .sidebar { position: static; height: auto; display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
211
+ .brand { margin: 0 auto 0 0; }
212
+ .brand-icon { width: 31px; height: 31px; }
213
+ .sidebar nav { display: contents; }
214
+ .sidebar .nav-link { width: auto; margin: 0; }
215
+ .nav-arrow, .nav-title, .brand small { display: none; }
216
+ .topbar { height: 40px; padding: 0 15px; }
217
+ .content { padding: 20px 15px; }
218
+ }
219
+ .media-actions { flex-wrap: wrap; }
220
+ .prompt { border-top: 1px solid var(--line); padding-top: 12px; }
221
+ .prompt-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
222
+ .prompt-heading .secondary { min-height: 30px; padding: 5px 9px; }
223
+ .scene-card-info { padding: 12px; }
224
+ .image-card-tags { margin-bottom: 6px; }
225
+ .image-card-tags .tag.chosen { background: var(--accent-bg); color: var(--accent); border-color: #d8d4fa; }
226
+ .scene-card-info small { color: var(--muted); font-size: 12px; }
227
+ .asset-detail-dialog, .scene-dialog { width: min(940px, calc(100vw - 28px)); }
228
+ .scene-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
229
+ .scene-thumbnails { display: flex; gap: 8px; overflow: auto; padding: 3px; margin: 0 0 13px; }
230
+ .scene-thumbnails button { display: grid; align-content: start; gap: 4px; flex: 0 0 112px; min-width: 0; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); text-align: left; font-size: 11px; }
231
+ .scene-thumbnails button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
232
+ .scene-thumbnails img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; }
233
+ .contain-thumbnails img { object-fit: contain; background: #f4f4f9; }
234
+ .scene-image-info { margin-top: 13px; }
235
+ .scene-image-tags { margin-top: 6px; }
236
+ .scene-image-tags .scene-candidate { background: #fff2d9; color: #795000; }
237
+ .scene-edit { padding: 15px; border-radius: 9px; background: #f6f7fb; }
238
+ .scene-image-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
239
+ .scene-dialog .version-content img { display: block; margin-top: 8px; }
240
+ .scene-dialog .version-content > div + div { padding-top: 12px; border-top: 1px solid var(--line); }
241
+ .scene-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
242
+ .scene-edit select, .scene-select select { width: 100%; border: 1px solid #cfd3df; border-radius: 7px; padding: 8px; background: #fff; color: inherit; font: inherit; }
243
+ .scene-conditions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
244
+
245
+ .character-cover-empty { display: block; width: 64px; height: 64px; background: #a8a1c9; mask: url('../img/rabbit-mark.svg') center / contain no-repeat; }
246
+ .transparent-preview { background-color: #81889a; background-image: conic-gradient(#687083 25%, transparent 0 50%, #687083 0 75%, transparent 0); background-size: 16px 16px; }
247
+ @media (max-width: 380px) {
248
+ .sidebar .nav-link { gap: 4px; padding-inline: 7px; }
249
+ }
250
+ .asset-group-path { margin: 3px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
251
+ .audio-card { padding: 14px; }
252
+ .audio-card .character-name { display: flex; align-items: center; gap: 8px; }
253
+ .audio-card audio, .audio-track audio { display: block; width: 100%; margin: 10px 0; }
254
+ .audio-track { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
255
+ @media (max-width: 720px) {
256
+ .sidebar { flex-wrap: wrap; }
257
+ }
258
+ .sidebar .settings-nav { margin-bottom: 20px; }
259
+ .settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: start; gap: 20px; margin-top: 19px; }
260
+ .settings-index, .settings-reader { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
261
+ .settings-index { padding: 11px; }
262
+ .settings-index > div + div { margin-top: 14px; }
263
+ .settings-index h2 { margin: 4px 8px; font-size: 12px; color: var(--muted); }
264
+ .settings-index button { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 8px; text-align: left; border: 0; border-radius: 6px; background: #fff; color: var(--ink, #21263b); font-size: 13px; }
265
+ .settings-index button.current, .settings-index button:hover { color: var(--accent); background: var(--accent-bg); }
266
+ .settings-reader { padding: clamp(14px, 3vw, 32px); }
267
+ .settings-source { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
268
+ .settings-reader .markdown { line-height: 1.8; }
269
+ @media (max-width: 720px) {
270
+ .sidebar .settings-nav { margin-bottom: 0; }
271
+ .settings-layout { grid-template-columns: minmax(0, 1fr); }
272
+ }
@@ -0,0 +1 @@
1
+ <svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><defs><style>.cls-1{fill:none;stroke:#000;stroke-miterlimit:10;stroke-width:8px;}</style></defs><path class="cls-1" d="M132,98.32c5.5-13.9,6.9-25.9,4.1-35.8-5.9-20.4-17.4-29.1-26.4-18.1-4.6,5.6-5.5,19.1-2.9,40.7a36.83,36.83,0,0,0-6.6-.6,44,44,0,0,0-10.3,1.3c2.8-22,1.9-35.8-2.8-41.4-9-11-20.5-2.3-26.4,18.1-3,10.4-1.3,22.9,4.9,37.7-15.7,15.4-23.4,38-15.2,48.7,13.1,17,87.8,15.2,99.6,0C157.82,138.92,149.12,114,132,98.32Z"/></svg>
@@ -0,0 +1,53 @@
1
+ <script>
2
+ import { ElButton, ElMessageBox } from 'element-plus'
3
+ import 'element-plus/es/components/button/style/css'
4
+ import 'element-plus/es/components/message-box/style/css'
5
+ import { Trash2 } from 'lucide-vue-next'
6
+
7
+ export default {
8
+ components: { ElButton, Trash2 },
9
+ props: {
10
+ assetName: { type: String, required: true },
11
+ busy: Boolean,
12
+ },
13
+ emits: ['confirm'],
14
+ data() {
15
+ return { confirming: false }
16
+ },
17
+ methods: {
18
+ async confirmDelete(event) {
19
+ if (this.busy || this.confirming) return
20
+ const dialog = event.currentTarget.closest('dialog')
21
+ this.confirming = true
22
+ try {
23
+ await ElMessageBox.confirm(
24
+ this.$t('将永久删除「{name}」的整个文件夹,包括历史版本。', { name: this.assetName }),
25
+ this.$t('确认删除'),
26
+ {
27
+ appendTo: dialog || undefined,
28
+ customClass: 'asset-delete-message',
29
+ type: 'warning',
30
+ confirmButtonType: 'danger',
31
+ confirmButtonText: this.$t('确认删除'),
32
+ cancelButtonText: this.$t('取消'),
33
+ closeOnClickModal: false,
34
+ autofocus: false,
35
+ },
36
+ )
37
+ this.$emit('confirm')
38
+ } catch (action) {
39
+ if (action !== 'cancel' && action !== 'close') throw action
40
+ } finally {
41
+ this.confirming = false
42
+ }
43
+ },
44
+ },
45
+ }
46
+ </script>
47
+
48
+ <template>
49
+ <ElButton type="danger" plain class="overview-delete-button" :disabled="busy || confirming" @click="confirmDelete">
50
+ <template #icon><Trash2 :size="15" aria-hidden="true" /></template>
51
+ {{ $t('删除') }}
52
+ </ElButton>
53
+ </template>
@@ -0,0 +1,40 @@
1
+ <script>
2
+ import { ChevronRight, History } from 'lucide-vue-next'
3
+
4
+ export default {
5
+ components: { ChevronRight, History },
6
+ props: {
7
+ versions: { type: Array, required: true },
8
+ group: { type: String, required: true },
9
+ },
10
+ methods: {
11
+ formatTime(value) {
12
+ if (value.length === 10) return value
13
+ const date = new Date(value)
14
+ if (!Number.isFinite(date.getTime())) return ''
15
+ return date.toLocaleString('sv-SE', { timeZone: 'Asia/Shanghai' }).slice(0, 16)
16
+ },
17
+ },
18
+ }
19
+ </script>
20
+
21
+ <template>
22
+ <p v-if="!versions.length" class="empty">{{ $t('还没有归档版本。') }}</p>
23
+ <div v-else class="asset-history">
24
+ <details v-for="version in versions" :key="version.version" :name="group" class="asset-history-item">
25
+ <summary>
26
+ <span class="asset-history-icon"><History :size="16" aria-hidden="true" /></span>
27
+ <span class="asset-history-title">
28
+ {{ version.version }}
29
+ <time v-if="version.createdAt" :datetime="version.createdAt"
30
+ :title="version.timeSource === 'directory' ? $t('目录创建时间') : $t('归档时间')">{{ formatTime(version.createdAt) }}</time>
31
+ <slot name="description" :version="version" />
32
+ </span>
33
+ <ChevronRight class="asset-history-arrow" :size="17" aria-hidden="true" />
34
+ </summary>
35
+ <div class="version-content">
36
+ <slot :version="version" />
37
+ </div>
38
+ </details>
39
+ </div>
40
+ </template>
@@ -0,0 +1,32 @@
1
+ <script>
2
+ import { Pencil } from 'lucide-vue-next'
3
+
4
+ export default {
5
+ components: { Pencil },
6
+ props: {
7
+ draft: { type: String, default: null },
8
+ busy: Boolean,
9
+ },
10
+ emits: ['edit', 'cancel', 'save', 'update:draft'],
11
+ }
12
+ </script>
13
+
14
+ <template>
15
+ <form @submit.prevent="$emit('save')">
16
+ <div class="asset-story-actions">
17
+ <span>README.md</span>
18
+ <div v-if="draft !== null" class="dialog-actions">
19
+ <button type="button" class="secondary" :disabled="busy" @click="$emit('cancel')">{{ $t('取消') }}</button>
20
+ <button class="primary" :disabled="busy">{{ $t('保存') }}</button>
21
+ </div>
22
+ <button v-else type="button" class="secondary" :disabled="busy" @click="$emit('edit')">
23
+ <Pencil :size="15" aria-hidden="true" />{{ $t('编辑') }}
24
+ </button>
25
+ </div>
26
+ <div class="asset-story-panel">
27
+ <textarea v-if="draft !== null" :value="draft" aria-label="README.md" :disabled="busy"
28
+ @input="$emit('update:draft', $event.target.value)"></textarea>
29
+ <slot v-else />
30
+ </div>
31
+ </form>
32
+ </template>
@@ -0,0 +1,26 @@
1
+ <script>
2
+ import { ElInputTag } from 'element-plus'
3
+ import 'element-plus/es/components/input-tag/style/css'
4
+
5
+ export default {
6
+ components: { ElInputTag },
7
+ props: {
8
+ modelValue: { type: Array, required: true },
9
+ },
10
+ emits: ['update:modelValue'],
11
+ }
12
+ </script>
13
+
14
+ <template>
15
+ <ElInputTag class="asset-tag-editor" :model-value="modelValue" :delimiter="/[\s,,]+/"
16
+ tag-type="primary" :placeholder="$t('输入后按空格或回车')"
17
+ @update:model-value="$emit('update:modelValue', [...new Set($event)])" />
18
+ </template>
19
+
20
+ <style scoped>
21
+ .asset-tag-editor.el-input-tag {
22
+ --el-color-primary: var(--accent);
23
+ --el-color-primary-light-9: var(--accent-bg);
24
+ --el-input-tag-input-focus-border-color: var(--focus-border);
25
+ }
26
+ </style>
@@ -0,0 +1,33 @@
1
+ <script>
2
+ import { renderProjectMarkdown } from '@/service/project-markdown.js'
3
+
4
+ export default {
5
+ props: {
6
+ source: { type: String, required: true },
7
+ file: { type: String, default: '' },
8
+ showImages: Boolean,
9
+ },
10
+ computed: {
11
+ html() {
12
+ const options = this.showImages ? { ADD_ATTR: ['loading'] } : { FORBID_TAGS: ['img'] }
13
+ return renderProjectMarkdown(this.source, this.file, options)
14
+ },
15
+ },
16
+ }
17
+ </script>
18
+
19
+ <template>
20
+ <article class="markdown" v-html="html"></article>
21
+ </template>
22
+
23
+ <style scoped>
24
+ .markdown { font-size: 14px; line-height: 1.68; overflow-wrap: anywhere; }
25
+ .markdown :deep(h1) { font-size: 21px; }
26
+ .markdown :deep(a) { color: var(--accent); }
27
+ .markdown :deep(img) { display: block; max-width: 100%; height: auto; border-radius: 7px; }
28
+ .markdown :deep(.markdown-table) { max-width: 100%; margin-block: 12px; overflow-x: auto; }
29
+ .markdown :deep(table) { width: 100%; border-collapse: collapse; }
30
+ .markdown :deep(th), .markdown :deep(td) { padding: 8px 12px; border: 1px solid var(--line); vertical-align: top; }
31
+ .markdown :deep(th) { background: #eef1f5; }
32
+ .markdown :deep(th:not([align])) { text-align: start; }
33
+ </style>