@waterwx/dsh-novel-forge 1.10.1 → 2.0.0
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/README.md +287 -281
- package/lib/client.js +19572 -18127
- package/lib/index.js +12171 -6932
- package/lib/types/action-guard.d.ts +61 -0
- package/lib/types/ai-scan.d.ts +30 -0
- package/lib/types/assets.d.ts +20 -9
- package/lib/types/assistant.d.ts +29 -0
- package/lib/types/author-assets.d.ts +1 -3
- package/lib/types/bookshelf.d.ts +13 -3
- package/lib/types/client/api.d.ts +137 -21
- package/lib/types/client/chip-prefs.d.ts +36 -0
- package/lib/types/client/docx.d.ts +2 -2
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/llmLive.d.ts +31 -0
- package/lib/types/client/locales.d.ts +15 -70
- package/lib/types/client/mount.d.ts +0 -2
- package/lib/types/client/panel/AiTag.d.ts +1 -0
- package/lib/types/client/panel/AssistantTab.d.ts +4 -1
- package/lib/types/client/panel/AuthorHome.d.ts +13 -9
- package/lib/types/client/panel/BookAnalysisView.d.ts +4 -0
- package/lib/types/client/panel/CmdPalette.d.ts +12 -0
- package/lib/types/client/panel/CreateBookView.d.ts +5 -1
- package/lib/types/client/panel/DirectorView.d.ts +7 -0
- package/lib/types/client/panel/IdeaInspirationView.d.ts +6 -0
- package/lib/types/client/panel/KnowledgeBaseView.d.ts +4 -0
- package/lib/types/client/panel/LiveFeedLog.d.ts +13 -0
- package/lib/types/client/panel/MarketRadarView.d.ts +5 -0
- package/lib/types/client/panel/ModelManager.d.ts +2 -2
- package/lib/types/client/panel/NovelPanel.d.ts +6 -1
- package/lib/types/client/panel/PageHeader.d.ts +18 -0
- package/lib/types/client/panel/PromptSlotsView.d.ts +11 -0
- package/lib/types/client/panel/SettingsView.d.ts +12 -7
- package/lib/types/client/panel/ShelfView.d.ts +10 -1
- package/lib/types/client/panel/SubPage.d.ts +27 -0
- package/lib/types/client/panel/TensionView.d.ts +18 -0
- package/lib/types/client/panel/TimelineView.d.ts +18 -0
- package/lib/types/client/panel/helpers.d.ts +5 -3
- package/lib/types/client/panel/market-radar-state.d.ts +56 -0
- package/lib/types/client/panel/toast.d.ts +2 -0
- package/lib/types/client/panel/views.d.ts +21 -35
- package/lib/types/client/run-status.d.ts +21 -0
- package/lib/types/client/sidebar-entry.d.ts +0 -2
- package/lib/types/docx-core.d.ts +16 -0
- package/lib/types/docx.d.ts +2 -3
- package/lib/types/engine.d.ts +83 -79
- package/lib/types/global-assets.d.ts +6 -0
- package/lib/types/home.d.ts +11 -0
- package/lib/types/index.d.ts +27 -13
- package/lib/types/llm-live.d.ts +70 -0
- package/lib/types/llm-retry.d.ts +38 -0
- package/lib/types/market-radar-scan.d.ts +18 -0
- package/lib/types/market-radar-sources.d.ts +31 -0
- package/lib/types/migrate-output.d.ts +25 -0
- package/lib/types/model-capability.d.ts +93 -0
- package/lib/types/novel-context.d.ts +80 -0
- package/lib/types/output-budget.d.ts +86 -0
- package/lib/types/prompt-slots.d.ts +57 -0
- package/lib/types/prompting.d.ts +10 -0
- package/lib/types/protocol.d.ts +829 -522
- package/lib/types/revision.d.ts +76 -0
- package/lib/types/routes.d.ts +9 -3
- package/lib/types/run.d.ts +23 -1
- package/lib/types/settings-persist.d.ts +59 -0
- package/lib/types/snapshots.d.ts +46 -0
- package/lib/types/stage-contract.d.ts +58 -0
- package/lib/types/tension.d.ts +53 -0
- package/lib/types/timeline.d.ts +37 -0
- package/package.json +50 -28
- package/src/action-guard.ts +127 -0
- package/src/ai-scan.ts +155 -0
- package/src/assets.ts +1801 -535
- package/src/assistant.ts +1098 -770
- package/src/author-assets.ts +131 -147
- package/src/bookshelf.ts +193 -167
- package/src/client/api.ts +767 -607
- package/src/client/chip-prefs.ts +121 -0
- package/src/client/docx.ts +32 -69
- package/src/client/index.ts +3 -1
- package/src/client/llmLive.ts +111 -0
- package/src/client/locales.ts +15 -274
- package/src/client/mount.tsx +4 -3
- package/src/client/panel/AdaptModeView.tsx +535 -520
- package/src/client/panel/AiTag.tsx +7 -0
- package/src/client/panel/AssetsTab.tsx +448 -458
- package/src/client/panel/AssistantTab.tsx +355 -301
- package/src/client/panel/AuthorAssetsView.tsx +205 -207
- package/src/client/panel/AuthorHome.tsx +309 -202
- package/src/client/panel/BookAnalysisView.tsx +63 -0
- package/src/client/panel/CmdPalette.tsx +102 -0
- package/src/client/panel/CreateBookView.tsx +366 -352
- package/src/client/panel/DirectorView.tsx +200 -0
- package/src/client/panel/GlobalAssetLibraryView.tsx +168 -172
- package/src/client/panel/IdeaInspirationView.tsx +76 -0
- package/src/client/panel/ImportModal.tsx +302 -302
- package/src/client/panel/KnowledgeBaseView.tsx +125 -0
- package/src/client/panel/LiveFeedLog.tsx +204 -0
- package/src/client/panel/MarketRadarView.tsx +415 -0
- package/src/client/panel/ModelManager.tsx +205 -205
- package/src/client/panel/NovelPanel.tsx +5559 -4655
- package/src/client/panel/PageHeader.tsx +37 -0
- package/src/client/panel/ProgressConsole.tsx +63 -64
- package/src/client/panel/PromptSlotsView.tsx +97 -0
- package/src/client/panel/ReaderView.tsx +306 -306
- package/src/client/panel/RunPanel.tsx +56 -24
- package/src/client/panel/SettingsView.tsx +175 -112
- package/src/client/panel/ShelfView.tsx +63 -39
- package/src/client/panel/SubPage.tsx +42 -0
- package/src/client/panel/TensionView.tsx +212 -0
- package/src/client/panel/TimelineView.tsx +208 -0
- package/src/client/panel/WorldTab.tsx +202 -202
- package/src/client/panel/helpers.ts +7 -5
- package/src/client/panel/market-radar-state.ts +79 -0
- package/src/client/panel/panel.module.css +5767 -4199
- package/src/client/panel/toast.ts +51 -0
- package/src/client/panel/views.tsx +316 -314
- package/src/client/run-status.ts +171 -0
- package/src/client/sidebar-entry.ts +3 -3
- package/src/docx-core.ts +53 -0
- package/src/docx.ts +44 -83
- package/src/engine.ts +1610 -1541
- package/src/global-assets.ts +58 -0
- package/src/home.ts +33 -0
- package/src/index.ts +184 -103
- package/src/llm-live.ts +245 -0
- package/src/llm-retry.ts +77 -0
- package/src/market-radar-scan.ts +35 -0
- package/src/market-radar-sources.ts +173 -0
- package/src/migrate-output.ts +76 -0
- package/src/model-capability.ts +215 -0
- package/src/novel-context.ts +286 -0
- package/src/output-budget.ts +147 -0
- package/src/prompt-slots.ts +125 -0
- package/src/prompting.ts +26 -0
- package/src/protocol.ts +2454 -2148
- package/src/revision.ts +283 -0
- package/src/routes.ts +3795 -3359
- package/src/run.ts +113 -17
- package/src/settings-persist.ts +114 -0
- package/src/snapshots.ts +174 -0
- package/src/stage-contract.ts +186 -0
- package/src/tension.ts +251 -0
- package/src/timeline.ts +159 -0
- package/assets/styles/arcane-thick-3d.webp +0 -0
- package/assets/styles/chinese-ink.webp +0 -0
- package/assets/styles/clay-stopmotion-3d.webp +0 -0
- package/assets/styles/dark-ghibli.webp +0 -0
- package/assets/styles/dark-gothic-3d.webp +0 -0
- package/assets/styles/film-photo.webp +0 -0
- package/assets/styles/guofeng-heavy.webp +0 -0
- package/assets/styles/horror-game-3d.webp +0 -0
- package/assets/styles/japan-cel-dark.webp +0 -0
- package/assets/styles/korean-webtoon.webp +0 -0
- package/assets/styles/low-cyberpunk-3d.webp +0 -0
- package/assets/styles/nextgen-cg.webp +0 -0
- package/assets/styles/noir-film.webp +0 -0
- package/assets/styles/openworld-survival.webp +0 -0
- package/assets/styles/paper-cut-3d.webp +0 -0
- package/assets/styles/pixar-adult-3d.webp +0 -0
- package/assets/styles/pop-marvel-2d.webp +0 -0
- package/assets/styles/shinkai-anime.webp +0 -0
- package/assets/styles/tactical-stealth.webp +0 -0
- package/assets/styles/vaporwave-3d.webp +0 -0
- package/assets/styles/vhs90.webp +0 -0
- package/lib/types/client/panel/BookshelfBar.d.ts +0 -11
- package/lib/types/client/panel/FlowGuide.d.ts +0 -21
- package/lib/types/client/panel/MangaRoleLibrary.d.ts +0 -18
- package/lib/types/client/panel/MangaWorkspace.d.ts +0 -15
- package/lib/types/client/panel/ModelPicker.d.ts +0 -11
- package/lib/types/client/panel/ProgressHomeView.d.ts +0 -5
- package/lib/types/client/panel/SceneLibrary.d.ts +0 -14
- package/lib/types/client/panel/StoryboardTab.d.ts +0 -19
- package/lib/types/client/panel/StyleCard.d.ts +0 -8
- package/lib/types/client/panel/StyleGallery.d.ts +0 -1
- package/lib/types/comic-presets.d.ts +0 -12
- package/lib/types/shot-language.d.ts +0 -46
- package/lib/types/story-beat-language.d.ts +0 -35
- package/lib/types/style-library.d.ts +0 -33
- package/skills/chapter-batch/SKILL.md +0 -81
- package/src/client/mount.tsx._new +0 -97
- package/src/client/mount.tsx._nf +0 -97
- package/src/client/mount.tsx._tmp +0 -97
- package/src/client/panel/BookshelfBar.tsx +0 -170
- package/src/client/panel/FlowGuide.tsx +0 -83
- package/src/client/panel/MangaRoleLibrary.tsx +0 -810
- package/src/client/panel/MangaWorkspace.tsx +0 -359
- package/src/client/panel/ProgressHomeView.tsx +0 -87
- package/src/client/panel/SceneLibrary.tsx +0 -396
- package/src/client/panel/StoryboardTab.tsx +0 -466
- package/src/client/panel/StyleCard.tsx +0 -90
- package/src/client/panel/StyleGallery.tsx +0 -58
- package/src/comic-presets.ts +0 -67
- package/src/shot-language.ts +0 -181
- package/src/story-beat-language.ts +0 -130
- package/src/style-library.ts +0 -78
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 场景库(完整版):提炼 / 采纳 / 编辑 / 图集上传 / 详情浮窗。
|
|
3
|
-
* 从 NovelPanel 左导航「场景库」搬入漫剧工作台场景区共用;
|
|
4
|
-
* 浮窗用 createPortal 挂 body(避开 .view backdrop-filter 的 fixed 包含块问题),
|
|
5
|
-
* 提示词全局中英切换 + 复制全部,视觉规则只在主页面显示一次。
|
|
6
|
-
*/
|
|
7
|
-
import { useEffect, useRef, useState } from 'react'
|
|
8
|
-
import { createPortal } from 'react-dom'
|
|
9
|
-
import type { NovelApi } from '../api.ts'
|
|
10
|
-
import type { ProjectState, SceneCard } from '../../protocol.ts'
|
|
11
|
-
import css from './panel.module.css'
|
|
12
|
-
|
|
13
|
-
export function SceneLibrary({
|
|
14
|
-
api,
|
|
15
|
-
project,
|
|
16
|
-
refresh,
|
|
17
|
-
styleId,
|
|
18
|
-
filterId,
|
|
19
|
-
onProgress,
|
|
20
|
-
}: {
|
|
21
|
-
api: NovelApi
|
|
22
|
-
project: ProjectState | null
|
|
23
|
-
/** 场景库变更已持久化后触发(刷新项目)。 */
|
|
24
|
-
refresh: () => void | Promise<void>
|
|
25
|
-
/** 提炼场景时的漫剧基底风格 id(提示词按方案风格措辞)。 */
|
|
26
|
-
styleId?: string
|
|
27
|
-
/** 可选滤镜风格 id。 */
|
|
28
|
-
filterId?: string
|
|
29
|
-
/** 上报到「AI进度」控制台。 */
|
|
30
|
-
onProgress?: (text: string, kind?: 'info' | 'done' | 'error') => void
|
|
31
|
-
}) {
|
|
32
|
-
const [busy, setBusy] = useState(false)
|
|
33
|
-
const [error, setError] = useState('')
|
|
34
|
-
const [notice, setNotice] = useState('')
|
|
35
|
-
const [candidates, setCandidates] = useState<SceneCard[] | null>(null)
|
|
36
|
-
const [detailName, setDetailName] = useState<string | null>(null)
|
|
37
|
-
const [uploadLabel, setUploadLabel] = useState('全景')
|
|
38
|
-
const [uploadTarget, setUploadTarget] = useState<string | null>(null)
|
|
39
|
-
const [draft, setDraft] = useState<SceneCard | null>(null)
|
|
40
|
-
/** 详情浮窗内提示词全局中英切换。 */
|
|
41
|
-
const [sceneLang, setSceneLang] = useState<'zh' | 'en'>('zh')
|
|
42
|
-
const inputRef = useRef<HTMLInputElement | null>(null)
|
|
43
|
-
const rootRef = useRef<HTMLDivElement | null>(null)
|
|
44
|
-
/** 浮窗挂 body 时复制的面板主题变量(--nf-*)。 */
|
|
45
|
-
const [portalVars, setPortalVars] = useState<Record<string, string>>({})
|
|
46
|
-
|
|
47
|
-
const notify = (msg: string): void => { setNotice(msg); setTimeout(() => { setNotice('') }, 3000) }
|
|
48
|
-
const report = (text: string, kind: 'info' | 'done' | 'error' = 'info'): void => { onProgress?.(text, kind) }
|
|
49
|
-
|
|
50
|
-
// Esc 关闭详情浮窗。
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (detailName === null) return
|
|
53
|
-
const onKey = (e: KeyboardEvent): void => {
|
|
54
|
-
if (e.key === 'Escape') setDetailName(null)
|
|
55
|
-
}
|
|
56
|
-
window.addEventListener('keydown', onKey)
|
|
57
|
-
return () => { window.removeEventListener('keydown', onKey) }
|
|
58
|
-
}, [detailName])
|
|
59
|
-
|
|
60
|
-
/** 打开场景详情:记录目标并复制面板主题变量(浮窗在 body 下渲染需要)。 */
|
|
61
|
-
const openDetail = (name: string): void => {
|
|
62
|
-
setDetailName(name)
|
|
63
|
-
setUploadLabel('全景')
|
|
64
|
-
if (rootRef.current !== null) {
|
|
65
|
-
const cs = getComputedStyle(rootRef.current)
|
|
66
|
-
const vars: Record<string, string> = {}
|
|
67
|
-
for (let i = 0; i < cs.length; i++) {
|
|
68
|
-
const key = cs[i]
|
|
69
|
-
if (key.startsWith('--nf-')) {
|
|
70
|
-
const v = cs.getPropertyValue(key).trim()
|
|
71
|
-
if (v !== '') vars[key] = v
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
setPortalVars(vars)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const extract = async (): Promise<void> => {
|
|
79
|
-
setBusy(true); setError('')
|
|
80
|
-
report('按当前方案提炼场景…')
|
|
81
|
-
try {
|
|
82
|
-
const result = await api.scenes({ op: 'extract', styleId, filterId })
|
|
83
|
-
setCandidates(result.candidates ?? [])
|
|
84
|
-
report('场景提炼完成:' + (result.candidates ?? []).length + ' 个候选', 'done')
|
|
85
|
-
} catch (err) {
|
|
86
|
-
const m = (err as Error).message
|
|
87
|
-
setError(m)
|
|
88
|
-
report('场景提炼失败:' + m, 'error')
|
|
89
|
-
} finally { setBusy(false) }
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const adopt = async (s: SceneCard): Promise<void> => {
|
|
93
|
-
setBusy(true); setError('')
|
|
94
|
-
report('采纳场景「' + s.name + '」…')
|
|
95
|
-
try {
|
|
96
|
-
await api.scenes({ op: 'adopt', scene: s })
|
|
97
|
-
setCandidates(prev => (prev ?? []).filter(x => x.name !== s.name))
|
|
98
|
-
await refresh()
|
|
99
|
-
report('已采纳场景「' + s.name + '」', 'done')
|
|
100
|
-
} catch (err) {
|
|
101
|
-
const m = (err as Error).message
|
|
102
|
-
setError(m)
|
|
103
|
-
report('采纳场景「' + s.name + '」失败:' + m, 'error')
|
|
104
|
-
} finally { setBusy(false) }
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const saveDraft = async (): Promise<void> => {
|
|
108
|
-
if (draft === null) return
|
|
109
|
-
const name = draft.name.trim()
|
|
110
|
-
if (name === '') return
|
|
111
|
-
setBusy(true); setError('')
|
|
112
|
-
report('保存场景「' + name + '」…')
|
|
113
|
-
try {
|
|
114
|
-
await api.scenes({ op: 'update', scene: { ...draft, name } })
|
|
115
|
-
await refresh()
|
|
116
|
-
setDraft(null)
|
|
117
|
-
report('已保存场景「' + name + '」', 'done')
|
|
118
|
-
} catch (err) {
|
|
119
|
-
const m = (err as Error).message
|
|
120
|
-
setError(m)
|
|
121
|
-
report('保存场景「' + name + '」失败:' + m, 'error')
|
|
122
|
-
} finally { setBusy(false) }
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const removeScene = async (name: string): Promise<void> => {
|
|
126
|
-
if (!window.confirm('确定删除场景「' + name + '」?')) return
|
|
127
|
-
setBusy(true); setError('')
|
|
128
|
-
report('删除场景「' + name + '」…')
|
|
129
|
-
try {
|
|
130
|
-
await api.scenes({ op: 'remove', name })
|
|
131
|
-
await refresh()
|
|
132
|
-
setDetailName(null)
|
|
133
|
-
report('已删除场景「' + name + '」', 'done')
|
|
134
|
-
} catch (err) {
|
|
135
|
-
const m = (err as Error).message
|
|
136
|
-
setError(m)
|
|
137
|
-
report('删除场景「' + name + '」失败:' + m, 'error')
|
|
138
|
-
} finally { setBusy(false) }
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const uploadImage = async (file: File): Promise<void> => {
|
|
142
|
-
const target = uploadTarget
|
|
143
|
-
if (target === null) return
|
|
144
|
-
const dataUrl = await new Promise<string>((resolve, reject) => {
|
|
145
|
-
const reader = new FileReader()
|
|
146
|
-
reader.onload = () => resolve(String(reader.result))
|
|
147
|
-
reader.onerror = () => reject(reader.error ?? new Error('读取图片失败'))
|
|
148
|
-
reader.readAsDataURL(file)
|
|
149
|
-
})
|
|
150
|
-
const label = uploadLabel.trim() !== '' ? uploadLabel.trim() : '全景'
|
|
151
|
-
setBusy(true); setError('')
|
|
152
|
-
report('上传场景「' + target + '」' + label + '…')
|
|
153
|
-
try {
|
|
154
|
-
await api.scenes({ op: 'image', name: target, dataUrl, label })
|
|
155
|
-
await refresh()
|
|
156
|
-
report('已上传场景「' + target + '」' + label, 'done')
|
|
157
|
-
} catch (err) {
|
|
158
|
-
const m = (err as Error).message
|
|
159
|
-
setError(m)
|
|
160
|
-
report('场景图上传失败:' + m, 'error')
|
|
161
|
-
} finally {
|
|
162
|
-
setBusy(false)
|
|
163
|
-
setUploadTarget(null)
|
|
164
|
-
if (inputRef.current !== null) inputRef.current.value = ''
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const removeImage = async (name: string, label: string): Promise<void> => {
|
|
169
|
-
setBusy(true); setError('')
|
|
170
|
-
try {
|
|
171
|
-
await api.scenes({ op: 'removeImage', name, label })
|
|
172
|
-
await refresh()
|
|
173
|
-
report('已删除「' + name + '」' + label, 'done')
|
|
174
|
-
} catch (err) {
|
|
175
|
-
const m = (err as Error).message
|
|
176
|
-
setError(m)
|
|
177
|
-
report('删除「' + name + '」' + label + ' 失败:' + m, 'error')
|
|
178
|
-
} finally { setBusy(false) }
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (project === null) {
|
|
182
|
-
return <div className={css.card}><span className={css.meta}>请先开书或选择一本书,再进入场景库。</span></div>
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const scenes = project.scenes ?? []
|
|
186
|
-
const detail = detailName !== null ? scenes.find(s => s.name === detailName) : undefined
|
|
187
|
-
|
|
188
|
-
return (
|
|
189
|
-
<div ref={rootRef} className={css.card} style={{ flex: 1, minHeight: 0 }}>
|
|
190
|
-
<div className={css.row} style={{ justifyContent: 'space-between', flexWrap: 'wrap' }}>
|
|
191
|
-
<span className={css.cardTitle} style={{ fontSize: 'var(--nf-fs-16)', fontWeight: 700 }}>🏞️ 场景库</span>
|
|
192
|
-
<span className={css.meta}>场景视觉锚点:提炼自正文,供漫剧分镜/生图锁定「在哪、什么氛围」</span>
|
|
193
|
-
<span className={css.meta} style={{ display: 'block', marginTop: 'var(--nf-space-2)' }}>流程位置:第⑧步(选做)· 前置:已写章节 · 分镜表会自动标注使用场景</span>
|
|
194
|
-
</div>
|
|
195
|
-
|
|
196
|
-
<div className={css.row} style={{ flexWrap: 'wrap', gap: 'var(--nf-space-6)', margin: '8px 0' }}>
|
|
197
|
-
<button type="button" className={`${css.button} ${css.buttonPrimary}`} disabled={busy} onClick={() => { void extract() }}>
|
|
198
|
-
{busy ? '⏳ 提炼中…' : '✨ 按当前方案提炼场景'}
|
|
199
|
-
</button>
|
|
200
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => { void refresh(); report('场景库已刷新', 'done') }}>🔄 刷新</button>
|
|
201
|
-
{candidates !== null && (
|
|
202
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => { setCandidates(null) }}>收起候选</button>
|
|
203
|
-
)}
|
|
204
|
-
</div>
|
|
205
|
-
|
|
206
|
-
{/* 视觉规则:只在主页面显示一次(浮窗内不再重复)。 */}
|
|
207
|
-
{(project.visualRules ?? []).length > 0 && (
|
|
208
|
-
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 'var(--nf-space-4)', alignItems: 'center', margin: '4px 0 8px' }}>
|
|
209
|
-
<span className={css.meta} style={{ fontSize: 'var(--nf-fs-12)' }}>⚠️ 本书视觉规则(已内嵌到所有提示词):</span>
|
|
210
|
-
{(project.visualRules ?? []).map((r, i) => <span key={i} style={{ border: '1px solid var(--nf-warn, #b8860b)', borderRadius: 'var(--nf-radius-999)', padding: '0 var(--nf-space-8)', fontSize: 'var(--nf-fs-12)', color: 'var(--nf-warn, #b8860b)' }}>{r}</span>)}
|
|
211
|
-
</div>
|
|
212
|
-
)}
|
|
213
|
-
|
|
214
|
-
{error !== '' && <div className={css.importError}>{error}</div>}
|
|
215
|
-
{notice !== '' && <div className={css.importResult} style={{ padding: 'var(--nf-space-6) var(--nf-space-10)' }}>{notice}</div>}
|
|
216
|
-
|
|
217
|
-
{/* 编辑场景 */}
|
|
218
|
-
{draft !== null && (
|
|
219
|
-
<div style={{ border: '1px solid var(--nf-accent)', borderRadius: 'var(--nf-radius-10)', padding: 'var(--nf-space-10)', marginBottom: 'var(--nf-space-10)', display: 'flex', flexDirection: 'column', gap: 'var(--nf-space-6)' }}>
|
|
220
|
-
<b style={{ fontSize: 'var(--nf-fs-14)' }}>编辑场景</b>
|
|
221
|
-
<input className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)' }} placeholder="场景名" value={draft.name} onChange={e => { setDraft({ ...draft, name: e.target.value }) }} />
|
|
222
|
-
<input className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)' }} placeholder="一句话定位" value={draft.summary} onChange={e => { setDraft({ ...draft, summary: e.target.value }) }} />
|
|
223
|
-
<div className={css.row} style={{ gap: 'var(--nf-space-6)' }}>
|
|
224
|
-
<input className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)', flex: 1 }} placeholder="幕归属(第一幕后场…)" value={draft.act ?? ''} onChange={e => { setDraft({ ...draft, act: e.target.value }) }} />
|
|
225
|
-
<input className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)', flex: 1 }} placeholder="时间光态(雨夜/闭店后…)" value={draft.moment ?? ''} onChange={e => { setDraft({ ...draft, moment: e.target.value }) }} />
|
|
226
|
-
</div>
|
|
227
|
-
<textarea className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)', minHeight: 48 }} placeholder="关键镜头(每行一条:人物动作+情绪+镜头)" value={(draft.beats ?? []).join('\n')} onChange={e => { setDraft({ ...draft, beats: e.target.value.split(/\n+/).map(x => x.trim()).filter(Boolean) }) }} />
|
|
228
|
-
<input className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)' }} placeholder="人物在场状态(含标志物细节)" value={draft.characterState ?? ''} onChange={e => { setDraft({ ...draft, characterState: e.target.value }) }} />
|
|
229
|
-
<textarea className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)', minHeight: 60 }} placeholder="环境构成(每行一项)" value={(draft.elements ?? []).join('\n')} onChange={e => { setDraft({ ...draft, elements: e.target.value.split(/\n+/).map(x => x.trim()).filter(Boolean) }) }} />
|
|
230
|
-
<textarea className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)', minHeight: 60 }} placeholder="中文生图提示词" value={draft.zh} onChange={e => { setDraft({ ...draft, zh: e.target.value }) }} />
|
|
231
|
-
<textarea className={css.input} style={{ fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-8)', minHeight: 60 }} placeholder="英文生图提示词" value={draft.en} onChange={e => { setDraft({ ...draft, en: e.target.value }) }} />
|
|
232
|
-
<div className={css.row} style={{ gap: 'var(--nf-space-6)' }}>
|
|
233
|
-
<button type="button" className={`${css.button} ${css.buttonPrimary}`} disabled={busy || draft.name.trim() === ''} onClick={() => { void saveDraft() }}>保存</button>
|
|
234
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => { setDraft(null) }}>取消</button>
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
)}
|
|
238
|
-
|
|
239
|
-
{/* 候选场景 */}
|
|
240
|
-
{candidates !== null && candidates.length > 0 && (
|
|
241
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--nf-space-6)', marginBottom: 'var(--nf-space-10)' }}>
|
|
242
|
-
{candidates.map(s => (
|
|
243
|
-
<div key={s.name} style={{ border: '1px solid var(--nf-accent)', borderRadius: 'var(--nf-radius-10)', padding: 'var(--nf-space-8) var(--nf-space-10)', fontSize: 'var(--nf-fs-12)' }}>
|
|
244
|
-
<div className={css.row} style={{ flexWrap: 'wrap', gap: 'var(--nf-space-6)', justifyContent: 'space-between' }}>
|
|
245
|
-
<span><b>{s.name}</b> <span className={css.meta}>· {(s.moods ?? []).join('、')}</span>{s.styleId !== undefined && <span className={css.badge}>🎨 {s.styleId}</span>}</span>
|
|
246
|
-
<span className={css.row} style={{ gap: 'var(--nf-space-4)' }}>
|
|
247
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} disabled={busy} onClick={() => { void adopt(s) }}>采纳</button>
|
|
248
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => { setDraft(s); setCandidates(null) }}>修改后采纳</button>
|
|
249
|
-
</span>
|
|
250
|
-
</div>
|
|
251
|
-
<div className={css.meta} style={{ marginTop: 'var(--nf-space-2)' }}>{s.summary}</div>
|
|
252
|
-
<div className={css.meta} style={{ marginTop: 'var(--nf-space-2)', fontSize: 'var(--nf-fs-12)' }}>要素:{(s.elements ?? []).join(';')}</div>
|
|
253
|
-
</div>
|
|
254
|
-
))}
|
|
255
|
-
</div>
|
|
256
|
-
)}
|
|
257
|
-
|
|
258
|
-
{scenes.length === 0 && candidates === null ? (
|
|
259
|
-
<div className={css.shelfEmpty} style={{ minHeight: 140, flex: 1 }}>
|
|
260
|
-
<span className={css.shelfEmptyIcon}>🏞️</span>
|
|
261
|
-
<span className={css.shelfEmptyTitle}>场景库为空</span>
|
|
262
|
-
<span className={css.meta}>点「✨ 按当前方案提炼场景」自动建立,或手动新增</span>
|
|
263
|
-
</div>
|
|
264
|
-
) : (
|
|
265
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))', gap: 'var(--nf-space-10)' }}>
|
|
266
|
-
{scenes.map(s => {
|
|
267
|
-
const cover = (s.gallery ?? [])[0]
|
|
268
|
-
return (
|
|
269
|
-
<div key={s.name} onClick={() => { openDetail(s.name) }} role="button" tabIndex={0} aria-label={`打开场景 ${s.name}`} onKeyDown={e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openDetail(s.name) } }} style={{ cursor: 'pointer', border: '1px solid var(--nf-border)', borderRadius: 'var(--nf-radius-12)', overflow: 'hidden', background: 'var(--nf-bg-inset)', display: 'flex', flexDirection: 'column' }}>
|
|
270
|
-
<div style={{ height: 100, display: 'flex', alignItems: 'center', justifyContent: 'center', background: 'var(--nf-bg-inset)', borderBottom: '1px solid var(--nf-border)', position: 'relative' }}>
|
|
271
|
-
{cover !== undefined
|
|
272
|
-
? <img src={cover.dataUrl} alt={s.name} style={{ width: '100%', height: '100%', objectFit: 'cover' }} />
|
|
273
|
-
: <span className={css.meta}>暂无场景图</span>}
|
|
274
|
-
<span style={{ position: 'absolute', bottom: 4, right: 4, background: 'rgba(0,0,0,0.6)', color: '#fff', fontSize: 'var(--nf-fs-12)', borderRadius: 'var(--nf-radius-6)', padding: 'var(--nf-space-2) var(--nf-space-6)' }}>🖼 {(s.gallery ?? []).length}</span>
|
|
275
|
-
</div>
|
|
276
|
-
<div style={{ padding: 'var(--nf-space-6)', display: 'flex', flexDirection: 'column', gap: 'var(--nf-space-2)' }}>
|
|
277
|
-
<b style={{ fontSize: 'var(--nf-fs-14)' }}>{s.name}</b>{s.styleId !== undefined && <span className={css.badge} style={{ fontSize: 'var(--nf-fs-12)' }}>🎨 {s.styleId}</span>}
|
|
278
|
-
<div className={css.meta} style={{ fontSize: 'var(--nf-fs-12)' }}>{(s.moods ?? []).join('、') || s.summary.slice(0, 16)}</div>
|
|
279
|
-
</div>
|
|
280
|
-
</div>
|
|
281
|
-
)
|
|
282
|
-
})}
|
|
283
|
-
</div>
|
|
284
|
-
)}
|
|
285
|
-
|
|
286
|
-
{/* 场景详情浮窗(portal 到 body,避免 .view 的 backdrop-filter 破坏 fixed 定位) */}
|
|
287
|
-
{detail !== undefined && createPortal(
|
|
288
|
-
<div style={{ ...portalVars, position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.55)', zIndex: 2147483000, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 'var(--nf-space-24)' }} onClick={e => { if (e.target === e.currentTarget) setDetailName(null) }}>
|
|
289
|
-
<div style={{ position: 'relative', background: 'var(--nf-bg)', border: '1px solid var(--nf-border)', borderRadius: 'var(--nf-radius-16)', padding: 'var(--nf-space-16)', width: 'min(860px, 100%)', maxHeight: '88vh', overflow: 'auto', marginTop: 'var(--nf-space-24)' }}>
|
|
290
|
-
<button type="button" className={css.iconButton} style={{ position: 'absolute', top: 10, right: 10 }} title="关闭" aria-label="关闭" onClick={() => { setDetailName(null) }}>✕</button>
|
|
291
|
-
<div style={{ marginBottom: 'var(--nf-space-12)' }}>
|
|
292
|
-
<div style={{ display: 'flex', alignItems: 'baseline', gap: 'var(--nf-space-8)', flexWrap: 'wrap' }}>
|
|
293
|
-
<b style={{ fontSize: 'var(--nf-fs-20)' }}>{detail.name}</b>
|
|
294
|
-
{detail.styleId !== undefined && <span className={css.badge}>🎨 {detail.styleId}</span>}
|
|
295
|
-
{(detail.act !== undefined && detail.act !== '') && <span className={css.badge} style={{ borderColor: 'var(--nf-accent)', color: 'var(--nf-accent)' }}>{detail.act}</span>}
|
|
296
|
-
{(detail.moment !== undefined && detail.moment !== '') && <span className={css.meta}>{detail.moment}</span>}
|
|
297
|
-
</div>
|
|
298
|
-
<div className={css.meta} style={{ marginTop: 'var(--nf-space-4)' }}>{detail.summary}</div>
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
{/* 图集 */}
|
|
302
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(140px, 1fr))', gap: 'var(--nf-space-8)', marginBottom: 'var(--nf-space-12)' }}>
|
|
303
|
-
{(detail.gallery ?? []).map(img => (
|
|
304
|
-
<div key={img.label} style={{ border: '1px solid var(--nf-border)', borderRadius: 'var(--nf-radius-10)', overflow: 'hidden', position: 'relative' }}>
|
|
305
|
-
<img src={img.dataUrl} alt={img.label} style={{ width: '100%', height: 100, objectFit: 'cover', display: 'block' }} />
|
|
306
|
-
<div style={{ background: 'rgba(0,0,0,0.55)', color: '#fff', fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-2) var(--nf-space-6)', textAlign: 'center' }}>{img.label}</div>
|
|
307
|
-
<button type="button" className={css.iconButton} style={{ position: 'absolute', top: 2, right: 2, fontSize: 'var(--nf-fs-12)' }} title="删除" aria-label="删除" onClick={() => { void removeImage(detail.name, img.label) }}>×</button>
|
|
308
|
-
</div>
|
|
309
|
-
))}
|
|
310
|
-
{(detail.gallery ?? []).length === 0 && <span className={css.meta}>暂无场景图</span>}
|
|
311
|
-
</div>
|
|
312
|
-
|
|
313
|
-
{/* 场景信息(紧凑卡片) */}
|
|
314
|
-
<div style={{ border: '1px solid var(--nf-border)', borderRadius: 'var(--nf-radius-10)', padding: 'var(--nf-space-8) var(--nf-space-10)', marginBottom: 'var(--nf-space-10)', fontSize: 'var(--nf-fs-12)' }}>
|
|
315
|
-
<b style={{ fontSize: 'var(--nf-fs-12)' }}>场景信息</b>
|
|
316
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: '6px 14px', marginTop: 'var(--nf-space-4)', lineHeight: 1.7 }}>
|
|
317
|
-
<div>
|
|
318
|
-
<b style={{ fontSize: 'var(--nf-fs-12)' }}>关键镜头</b>
|
|
319
|
-
<div style={{ marginTop: 'var(--nf-space-2)' }}>{(detail.beats ?? []).map((b, i) => <div key={i} style={{ fontSize: 'var(--nf-fs-12)', color: 'var(--nf-text-2)', marginTop: 'var(--nf-space-2)' }}>🎬 {b}</div>)}</div>
|
|
320
|
-
</div>
|
|
321
|
-
<div>
|
|
322
|
-
{(detail.characterState !== undefined && detail.characterState !== '') && (
|
|
323
|
-
<div style={{ marginBottom: 'var(--nf-space-6)' }}>
|
|
324
|
-
<b style={{ fontSize: 'var(--nf-fs-12)' }}>人物状态</b>
|
|
325
|
-
<div className={css.meta} style={{ marginTop: 'var(--nf-space-2)' }}>{detail.characterState}</div>
|
|
326
|
-
</div>
|
|
327
|
-
)}
|
|
328
|
-
<b style={{ fontSize: 'var(--nf-fs-12)' }}>环境构成</b>
|
|
329
|
-
<div style={{ marginTop: 'var(--nf-space-2)' }}>{(detail.elements ?? []).map(e => <span key={e} style={{ border: '1px solid var(--nf-border)', borderRadius: 'var(--nf-radius-999)', padding: 'var(--nf-space-2) var(--nf-space-8)', fontSize: 'var(--nf-fs-12)', margin: '0 4px 4px 0', display: 'inline-block' }}>{e}</span>)}</div>
|
|
330
|
-
<div style={{ marginTop: 'var(--nf-space-6)' }}><b style={{ fontSize: 'var(--nf-fs-12)' }}>色调光影</b> <span className={css.meta}>{(detail.palette ?? []).join(';') || '—'}</span></div>
|
|
331
|
-
<div style={{ marginTop: 'var(--nf-space-4)' }}><b style={{ fontSize: 'var(--nf-fs-12)' }}>氛围</b> <span className={css.meta}>{(detail.moods ?? []).join('、') || '—'}</span></div>
|
|
332
|
-
<div style={{ marginTop: 'var(--nf-space-4)' }}><b style={{ fontSize: 'var(--nf-fs-12)' }}>依据</b> <span className={css.meta}>{detail.source || '—'}</span></div>
|
|
333
|
-
</div>
|
|
334
|
-
</div>
|
|
335
|
-
</div>
|
|
336
|
-
|
|
337
|
-
{/* 生图提示词:全局中英 + 复制全部 */}
|
|
338
|
-
<div style={{ marginBottom: 'var(--nf-space-12)' }}>
|
|
339
|
-
<div className={css.row} style={{ justifyContent: 'space-between', flexWrap: 'wrap', marginBottom: 'var(--nf-space-6)' }}>
|
|
340
|
-
<b style={{ fontSize: 'var(--nf-fs-14)' }}>🎨 生图提示词</b>
|
|
341
|
-
<span className={css.row} style={{ gap: 'var(--nf-space-6)', flexWrap: 'wrap' }}>
|
|
342
|
-
<button type="button" className={`${css.button} ${css.buttonSmall} ${sceneLang === 'zh' ? css.buttonPrimary : ''}`} onClick={() => { setSceneLang('zh') }}>🇨🇳 中文</button>
|
|
343
|
-
<button type="button" className={`${css.button} ${css.buttonSmall} ${sceneLang === 'en' ? css.buttonPrimary : ''}`} onClick={() => { setSceneLang('en') }}>🇬🇧 English</button>
|
|
344
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => {
|
|
345
|
-
const text = '【中文】\n' + detail.zh + '\n\n【English】\n' + detail.en
|
|
346
|
-
void navigator.clipboard?.writeText(text).then(() => { notify('已复制「' + detail.name + '」中英提示词') }).catch(() => { /* ignore */ })
|
|
347
|
-
}}>📋 复制全部</button>
|
|
348
|
-
</span>
|
|
349
|
-
</div>
|
|
350
|
-
<div style={{ border: '1px solid var(--nf-border)', borderRadius: 'var(--nf-radius-8)', padding: 'var(--nf-space-8)' }}>
|
|
351
|
-
<div className={css.row} style={{ justifyContent: 'space-between', flexWrap: 'wrap' }}>
|
|
352
|
-
<b style={{ fontSize: 'var(--nf-fs-12)' }}>{sceneLang === 'zh' ? '🇨🇳 中文' : '🇬🇧 English'}</b>
|
|
353
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} style={{ padding: 'var(--nf-space-2) var(--nf-space-6)', fontSize: 'var(--nf-fs-12)' }} onClick={() => {
|
|
354
|
-
void navigator.clipboard?.writeText(sceneLang === 'zh' ? detail.zh : detail.en).then(() => { notify('已复制「' + detail.name + '」' + (sceneLang === 'zh' ? '中文' : '英文') + '提示词') }).catch(() => { /* ignore */ })
|
|
355
|
-
}}>复制</button>
|
|
356
|
-
</div>
|
|
357
|
-
<div className={css.meta} style={{ fontSize: 'var(--nf-fs-12)', lineHeight: 1.6, marginTop: 'var(--nf-space-4)', whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>{sceneLang === 'zh' ? detail.zh : detail.en}</div>
|
|
358
|
-
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 'var(--nf-space-4)', marginTop: 'var(--nf-space-8)' }}>
|
|
359
|
-
{(detail.tags ?? []).map(t => <span key={t} style={{ border: '1px solid var(--nf-border)', borderRadius: 'var(--nf-radius-999)', padding: 'var(--nf-space-2) var(--nf-space-8)', fontSize: 'var(--nf-fs-12)' }}>{t}</span>)}
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
</div>
|
|
363
|
-
|
|
364
|
-
{/* 操作条 */}
|
|
365
|
-
<div style={{ borderTop: '1px solid var(--nf-border)', paddingTop: 'var(--nf-space-10)', display: 'flex', flexWrap: 'wrap', gap: 'var(--nf-space-6)', alignItems: 'center' }}>
|
|
366
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => {
|
|
367
|
-
const text = [detail.en, detail.tags.join(', ')].filter(Boolean).join('\n')
|
|
368
|
-
void navigator.clipboard?.writeText(text).then(() => { notify('已复制「' + detail.name + '」英文生图提示词') }).catch(() => { /* ignore */ })
|
|
369
|
-
}}>复制提示词</button>
|
|
370
|
-
<input className={css.input} style={{ width: 130, fontSize: 'var(--nf-fs-12)', padding: 'var(--nf-space-4) var(--nf-space-6)' }} placeholder="图集标签" value={uploadLabel} onChange={e => { setUploadLabel(e.target.value) }} />
|
|
371
|
-
<input
|
|
372
|
-
ref={inputRef}
|
|
373
|
-
type="file"
|
|
374
|
-
accept="image/*"
|
|
375
|
-
style={{ display: 'none' }}
|
|
376
|
-
onChange={e => {
|
|
377
|
-
const file = e.target.files?.[0]
|
|
378
|
-
if (file === undefined || uploadTarget === null) return
|
|
379
|
-
void uploadImage(file)
|
|
380
|
-
}}
|
|
381
|
-
/>
|
|
382
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} disabled={busy} onClick={() => {
|
|
383
|
-
setUploadLabel(uploadLabel.trim() !== '' ? uploadLabel.trim() : '全景')
|
|
384
|
-
setUploadTarget(detail.name)
|
|
385
|
-
inputRef.current?.click()
|
|
386
|
-
}}>📤 上传场景图</button>
|
|
387
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} onClick={() => { setDraft(detail); setDetailName(null) }}>✏️ 编辑</button>
|
|
388
|
-
<button type="button" className={`${css.button} ${css.buttonSmall}`} style={{ color: 'var(--nf-danger, #e05)' }} onClick={() => { void removeScene(detail.name) }}>🗑 删除</button>
|
|
389
|
-
</div>
|
|
390
|
-
</div>
|
|
391
|
-
</div>,
|
|
392
|
-
document.body,
|
|
393
|
-
)}
|
|
394
|
-
</div>
|
|
395
|
-
)
|
|
396
|
-
}
|