@lingfan-engine/editor 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/package.json +39 -3
- package/src/chapters/build.ts +180 -0
- package/src/chapters/index.ts +34 -0
- package/src/chapters/types.ts +71 -0
- package/src/contracts/diagnostics.ts +62 -0
- package/src/contracts/editing.ts +26 -0
- package/src/contracts/forms.ts +69 -0
- package/src/contracts/index.ts +22 -0
- package/src/contracts/texts.ts +204 -0
- package/src/diagnostics/analyze.ts +161 -0
- package/src/diagnostics/grouping.ts +164 -0
- package/src/diagnostics/index.ts +35 -0
- package/src/diagnostics/message.ts +60 -0
- package/src/diagnostics/refs.ts +123 -0
- package/src/diagnostics/symbols.ts +221 -0
- package/src/editing/columnGrouping.ts +331 -0
- package/src/editing/graphConnect.ts +88 -0
- package/src/editing/index.ts +72 -0
- package/src/editing/pointers.ts +291 -0
- package/src/editing/saveNormalization.ts +58 -0
- package/src/editing/session.ts +134 -0
- package/src/editing/storyOps.ts +268 -0
- package/src/editing/tsSourceGuard.ts +40 -0
- package/src/element/drag.ts +22 -0
- package/src/element/dragCreate.ts +60 -0
- package/src/element/index.ts +11 -0
- package/src/i18n/coverage.ts +191 -0
- package/src/i18n/extract.ts +38 -0
- package/src/i18n/index.ts +47 -0
- package/src/i18n/reconcile.ts +71 -0
- package/src/i18n/skeleton.ts +112 -0
- package/src/i18n/storyKeys.ts +27 -0
- package/src/i18n/surfaces.ts +54 -0
- package/src/i18n/table.ts +235 -0
- package/src/index.ts +342 -0
- package/src/layout/index.ts +14 -0
- package/src/layout/steps.ts +378 -0
- package/src/schema/catalog.ts +300 -0
- package/src/schema/elementForms.ts +307 -0
- package/src/schema/elementPalette.ts +100 -0
- package/src/schema/forms.ts +196 -0
- package/src/schema/index.ts +55 -0
- package/src/schema/opSchemas/commands.ts +374 -0
- package/src/schema/opSchemas/fragments.ts +24 -0
- package/src/schema/opSchemas/index.ts +16 -0
- package/src/schema/opSchemas/map.ts +134 -0
- package/src/schema/opSchemas/types.ts +42 -0
- package/src/schema/opSchemas/validate.ts +184 -0
- package/src/schema/surface.ts +101 -0
- package/src/schema/validation.ts +92 -0
- package/src/schema/walk.ts +167 -0
- package/src/script/expr/audit/index.ts +8 -0
- package/src/script/expr/audit/parser.ts +370 -0
- package/src/script/expr/audit/token.ts +23 -0
- package/src/script/expr/build.ts +203 -0
- package/src/script/expr/index.ts +17 -0
- package/src/script/expr/registry.ts +130 -0
- package/src/script/index.ts +168 -0
- package/src/script/vocabulary-gen.ts +202 -0
- package/src/script/vocabulary.g.ts +175 -0
- package/src/script/words/audio.ts +114 -0
- package/src/script/words/cells.ts +78 -0
- package/src/script/words/compile-time.ts +27 -0
- package/src/script/words/composite.ts +125 -0
- package/src/script/words/elements.ts +202 -0
- package/src/script/words/extension.ts +25 -0
- package/src/script/words/flow.ts +391 -0
- package/src/script/words/index.ts +23 -0
- package/src/script/words/interaction.ts +44 -0
- package/src/script/words/minigame.ts +66 -0
- package/src/script/words/narrative.ts +261 -0
- package/src/script/words/save.ts +54 -0
- package/src/script/words/vars.ts +155 -0
- package/src/script/words/video.ts +80 -0
- package/src/shared/guards.ts +19 -0
- package/src/shared/index.ts +6 -0
- package/src/shared/pointer.ts +23 -0
- package/README.md +0 -3
package/src/index.ts
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lingfan-engine/editor 公共出口:op schema 单一事实源 + 编辑期诊断 +
|
|
3
|
+
* 故事树纯映射器:只读写故事 JSON,不碰运行时与 Rust;
|
|
4
|
+
* 作者视图偏好(列分组 / 折叠)走**注入式存储**、不入故事树。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
AnalyzeOptions,
|
|
9
|
+
ContainerField,
|
|
10
|
+
ContainerInfo,
|
|
11
|
+
Diagnostic,
|
|
12
|
+
DiagnosticSeverity,
|
|
13
|
+
FieldDescriptor,
|
|
14
|
+
FieldKind,
|
|
15
|
+
OpFormDescriptor,
|
|
16
|
+
OpGroup,
|
|
17
|
+
OpMeta,
|
|
18
|
+
StoryListener,
|
|
19
|
+
SymbolIndex,
|
|
20
|
+
UndoEntry,
|
|
21
|
+
} from "./contracts/index.ts";
|
|
22
|
+
export { escapePointerToken, joinPointer } from "./contracts/index.ts";
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
coerceFieldValue,
|
|
26
|
+
describeForm,
|
|
27
|
+
describeNodeLabel,
|
|
28
|
+
listOps,
|
|
29
|
+
} from "./schema/index.ts";
|
|
30
|
+
export {
|
|
31
|
+
describeElement,
|
|
32
|
+
elementLabel,
|
|
33
|
+
listElementTypes,
|
|
34
|
+
specificAttrsOf,
|
|
35
|
+
UNIMPLEMENTED_ELEMENT_ATTRS,
|
|
36
|
+
type ElementFormDescriptor,
|
|
37
|
+
} from "./schema/index.ts";
|
|
38
|
+
export {
|
|
39
|
+
ELEMENT_TYPE_GROUPS,
|
|
40
|
+
listOpGroups,
|
|
41
|
+
OP_GROUP_LABELS,
|
|
42
|
+
OP_GROUP_ORDER,
|
|
43
|
+
type ElementTypeGroup,
|
|
44
|
+
type OpGroupEntries,
|
|
45
|
+
} from "./schema/index.ts";
|
|
46
|
+
export { draggedPosition, parseNumericPosition } from "./element/index.ts";
|
|
47
|
+
export {
|
|
48
|
+
createElementDraft,
|
|
49
|
+
planElementDrop,
|
|
50
|
+
type DropContainerHit,
|
|
51
|
+
type ElementDropPlan,
|
|
52
|
+
} from "./element/index.ts";
|
|
53
|
+
export { OP_SCHEMAS, validateCommand } from "./schema/index.ts";
|
|
54
|
+
/**
|
|
55
|
+
* 内建 op 判别联合(op 决定字段)+ 单 op 命令类型 + 标量值口径——
|
|
56
|
+
* 全部派生自 op schema 单一事实源;词汇层 builder 返回与裸写命令注解共用。
|
|
57
|
+
*/
|
|
58
|
+
export type {
|
|
59
|
+
CommandOf,
|
|
60
|
+
ScriptCommand,
|
|
61
|
+
ScriptOpName,
|
|
62
|
+
ScriptValue,
|
|
63
|
+
} from "./schema/index.ts";
|
|
64
|
+
/** 词汇层构建期轻类型校验警告(expr/cond 组装时按引擎类型规则产出;drain 取走) */
|
|
65
|
+
export type { ExpressionWarning } from "./script/index.ts";
|
|
66
|
+
export {
|
|
67
|
+
BUILTIN_OP_SURFACE,
|
|
68
|
+
mergeOpMeta,
|
|
69
|
+
mergeOpSchemas,
|
|
70
|
+
mergeOpSurface,
|
|
71
|
+
type OpSurface,
|
|
72
|
+
} from "./schema/index.ts";
|
|
73
|
+
export { validateStory } from "./schema/index.ts";
|
|
74
|
+
export {
|
|
75
|
+
walkCommandBodies,
|
|
76
|
+
walkStoryCommands,
|
|
77
|
+
walkStoryElements,
|
|
78
|
+
} from "./schema/index.ts";
|
|
79
|
+
|
|
80
|
+
export { analyzeStory, extractExpressionRefs, indexStory } from "./diagnostics/index.ts";
|
|
81
|
+
export {
|
|
82
|
+
diagnosticCodeLabel,
|
|
83
|
+
diagnosticSummaryText,
|
|
84
|
+
filterDiagnosticsBySeverity,
|
|
85
|
+
groupDiagnostics,
|
|
86
|
+
summarizeDiagnostics,
|
|
87
|
+
type DiagnosticGroup,
|
|
88
|
+
type DiagnosticSummary,
|
|
89
|
+
type SeverityFilter,
|
|
90
|
+
} from "./diagnostics/index.ts";
|
|
91
|
+
export {
|
|
92
|
+
diagnosticBrief,
|
|
93
|
+
splitDiagnosticMessage,
|
|
94
|
+
type DiagnosticMessageParts,
|
|
95
|
+
} from "./diagnostics/index.ts";
|
|
96
|
+
export {
|
|
97
|
+
buildChapterIndex,
|
|
98
|
+
chapterDirOf,
|
|
99
|
+
chapterGroupOf,
|
|
100
|
+
chapterLabelOf,
|
|
101
|
+
chapterSummaryText,
|
|
102
|
+
sceneTypeBadgeOf,
|
|
103
|
+
type ChapterDir,
|
|
104
|
+
type ChapterGroup,
|
|
105
|
+
type ChapterIndex,
|
|
106
|
+
type ChapterInput,
|
|
107
|
+
type ChapterNode,
|
|
108
|
+
} from "./chapters/index.ts";
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
addTranslationRow,
|
|
112
|
+
columnStoryKey,
|
|
113
|
+
coverageLabelOf,
|
|
114
|
+
coveragePercentOf,
|
|
115
|
+
coverageWeightedPercentOf,
|
|
116
|
+
coverageStateOf,
|
|
117
|
+
extractStoryKeys,
|
|
118
|
+
formatTranslationReport,
|
|
119
|
+
groupKeysByStory,
|
|
120
|
+
isTableDirty,
|
|
121
|
+
langCoverage,
|
|
122
|
+
parseTranslationTable,
|
|
123
|
+
planOverlaySkeleton,
|
|
124
|
+
reconcileTranslations,
|
|
125
|
+
removeTranslationRow,
|
|
126
|
+
renameTranslationRow,
|
|
127
|
+
serializeTranslationTable,
|
|
128
|
+
setTranslationValue,
|
|
129
|
+
TRANSLATE_SURFACES,
|
|
130
|
+
valuesAtPath,
|
|
131
|
+
workbenchOverview,
|
|
132
|
+
type CoverageState,
|
|
133
|
+
type LangCoverage,
|
|
134
|
+
type OverlaySkeletonFile,
|
|
135
|
+
type SkeletonLayout,
|
|
136
|
+
type SkeletonLayoutChoice,
|
|
137
|
+
type SkeletonOptions,
|
|
138
|
+
type SkeletonPlaceholder,
|
|
139
|
+
type TableEdit,
|
|
140
|
+
type TableParse,
|
|
141
|
+
type TranslationReconcileReport,
|
|
142
|
+
type TranslationRow,
|
|
143
|
+
type WorkbenchOverview,
|
|
144
|
+
} from "./i18n/index.ts";
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
describeSelection,
|
|
148
|
+
getAtPointer,
|
|
149
|
+
insertAtPointer,
|
|
150
|
+
moveAtPointer,
|
|
151
|
+
nearestCommandPointer,
|
|
152
|
+
removeAtPointer,
|
|
153
|
+
setAtPointer,
|
|
154
|
+
type SelectionDescription,
|
|
155
|
+
type SelectionKind,
|
|
156
|
+
type SelectionNodeKind,
|
|
157
|
+
} from "./editing/index.ts";
|
|
158
|
+
export {
|
|
159
|
+
addColumn,
|
|
160
|
+
columnContainers,
|
|
161
|
+
containerPointer,
|
|
162
|
+
firstColumnIdOfSourcePath,
|
|
163
|
+
insertCommand,
|
|
164
|
+
moveCommand,
|
|
165
|
+
removeColumn,
|
|
166
|
+
removeCommand,
|
|
167
|
+
renameColumn,
|
|
168
|
+
suggestColumnId,
|
|
169
|
+
updateCommandField,
|
|
170
|
+
} from "./editing/index.ts";
|
|
171
|
+
export { EditorSession } from "./editing/index.ts";
|
|
172
|
+
export {
|
|
173
|
+
branchPointerToCommand,
|
|
174
|
+
isBranchTarget,
|
|
175
|
+
planBranchInsertion,
|
|
176
|
+
type BranchColumnLike,
|
|
177
|
+
type BranchPlan,
|
|
178
|
+
} from "./editing/index.ts";
|
|
179
|
+
export {
|
|
180
|
+
addGroup,
|
|
181
|
+
assignColumn,
|
|
182
|
+
COLUMN_GROUPING_KEY_PREFIX,
|
|
183
|
+
createColumnGroupingStore,
|
|
184
|
+
emptyGroupingView,
|
|
185
|
+
layoutColumns,
|
|
186
|
+
parseGroupingView,
|
|
187
|
+
pruneGroupingView,
|
|
188
|
+
removeGroup,
|
|
189
|
+
renameColumnMember,
|
|
190
|
+
renameGroup,
|
|
191
|
+
serializeGroupingView,
|
|
192
|
+
toggleCollapsed,
|
|
193
|
+
} from "./editing/index.ts";
|
|
194
|
+
export type {
|
|
195
|
+
ColumnGroup,
|
|
196
|
+
ColumnGroupingView,
|
|
197
|
+
GroupedLayout,
|
|
198
|
+
KeyValueStorage,
|
|
199
|
+
} from "./editing/index.ts";
|
|
200
|
+
export {
|
|
201
|
+
describeNormalization,
|
|
202
|
+
NORMALIZATION_NOTICE_PREF_KEY,
|
|
203
|
+
readSkipNormalizationNotice,
|
|
204
|
+
writeSkipNormalizationNotice,
|
|
205
|
+
} from "./editing/index.ts";
|
|
206
|
+
export {
|
|
207
|
+
TS_SOURCE_MANIFEST_KEY,
|
|
208
|
+
TS_SOURCE_READONLY_HINT,
|
|
209
|
+
assertTsSourceWritable,
|
|
210
|
+
isTsSourceProject,
|
|
211
|
+
tsSourceWriteBlockers,
|
|
212
|
+
} from "./editing/index.ts";
|
|
213
|
+
/**
|
|
214
|
+
* 步骤布局:列内切分为「步骤」(等待态边界)+ 列间分支边。
|
|
215
|
+
* 边界判据取自引擎的等待声明表(`@lingfan-engine/core` 的 `waitingStateOfOp`),本模块不做逐 op 判定。
|
|
216
|
+
*/
|
|
217
|
+
export {
|
|
218
|
+
columnSteps,
|
|
219
|
+
storySteps,
|
|
220
|
+
type StepEdge,
|
|
221
|
+
type StepFork,
|
|
222
|
+
type StepLane,
|
|
223
|
+
type StepLayout,
|
|
224
|
+
type StepOptions,
|
|
225
|
+
type StoryStep,
|
|
226
|
+
} from "./layout/index.ts";
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Script 词汇层:构建期作者词汇——builder 全部产出 StoryCommand
|
|
230
|
+
* 数据(与 JSON 同族)。**命名空间导出**:词汇是子语言,`script` 是它的整体入口;
|
|
231
|
+
* 作者 `const { say, menu, when } = script` 解构即用。单个词函数的具名出口见文件末尾。
|
|
232
|
+
*/
|
|
233
|
+
export * as script from "./script/index.ts";
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 字符串域类型扩充点:词汇层声明的空注册表接口必须经**包根**再导出一次,
|
|
237
|
+
* 生成物 `stories.gen.d.ts` 的 `declare module "@lingfan-engine/editor"` 才合得上——
|
|
238
|
+
* 模块增强只认包根出口面,`export * as script` 是命名空间、不是根出口
|
|
239
|
+
* (不 re-export 时增强静默落空,注册表恒为空表、收窄失效)。
|
|
240
|
+
*/
|
|
241
|
+
export {
|
|
242
|
+
type ColumnNameRegistry,
|
|
243
|
+
type GuardNameRegistry,
|
|
244
|
+
type InterpolationKeyRegistry,
|
|
245
|
+
} from "./script/index.ts";
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* 词函数**具名**出口:`script` 命名空间里的词函数同时经包根再导出一次,
|
|
249
|
+
* 于是 `import { say, menu } from "@lingfan-engine/editor"` 与
|
|
250
|
+
* `const { say } = script` 取到同一个函数对象。
|
|
251
|
+
*
|
|
252
|
+
* 为什么要有这一层:编译器子语言只认具名导入与 `script` 命名空间两条路
|
|
253
|
+
* (`import { say }` 的 `say` 会去 `WORD_NAMES` 里核对),但两条路里具名那条
|
|
254
|
+
* 需要包根真的导出该名字——只写 `export * as script` 时,仓内靠生成物
|
|
255
|
+
* 侥幸通过,**仓外消费者 tsc 报 TS2305「does not provide an export named 'say'」**。
|
|
256
|
+
*
|
|
257
|
+
* 只转发函数值,不转发类型:类型面由上方各域出口与词汇层注册表出口提供,
|
|
258
|
+
* 此处再转发会与根出口的既有类型名重复声明。
|
|
259
|
+
*/
|
|
260
|
+
export {
|
|
261
|
+
ambient,
|
|
262
|
+
animate,
|
|
263
|
+
animateBlock,
|
|
264
|
+
arrayPop,
|
|
265
|
+
arrayPush,
|
|
266
|
+
assert,
|
|
267
|
+
autoSave,
|
|
268
|
+
background,
|
|
269
|
+
bgSwitch,
|
|
270
|
+
bgm,
|
|
271
|
+
breakLoop,
|
|
272
|
+
buttonElement,
|
|
273
|
+
call,
|
|
274
|
+
cell,
|
|
275
|
+
character,
|
|
276
|
+
cond,
|
|
277
|
+
continueLoop,
|
|
278
|
+
cutscene,
|
|
279
|
+
define,
|
|
280
|
+
defineVars,
|
|
281
|
+
dialogWindow,
|
|
282
|
+
dict,
|
|
283
|
+
dictSet,
|
|
284
|
+
drainExpressionWarnings,
|
|
285
|
+
expr,
|
|
286
|
+
extOp,
|
|
287
|
+
forEach,
|
|
288
|
+
forIn,
|
|
289
|
+
func,
|
|
290
|
+
guard,
|
|
291
|
+
hide,
|
|
292
|
+
imageElement,
|
|
293
|
+
input,
|
|
294
|
+
interaction,
|
|
295
|
+
jump,
|
|
296
|
+
letVar,
|
|
297
|
+
load,
|
|
298
|
+
localVar,
|
|
299
|
+
menu,
|
|
300
|
+
minigame,
|
|
301
|
+
navigate,
|
|
302
|
+
newArray,
|
|
303
|
+
notify,
|
|
304
|
+
nvl,
|
|
305
|
+
option,
|
|
306
|
+
pause,
|
|
307
|
+
pauseVideo,
|
|
308
|
+
random,
|
|
309
|
+
resumeVideo,
|
|
310
|
+
ret,
|
|
311
|
+
reward,
|
|
312
|
+
save,
|
|
313
|
+
saveDelete,
|
|
314
|
+
say,
|
|
315
|
+
sceneSetup,
|
|
316
|
+
sceneType,
|
|
317
|
+
se,
|
|
318
|
+
seekVideo,
|
|
319
|
+
set,
|
|
320
|
+
setZ,
|
|
321
|
+
shake,
|
|
322
|
+
show,
|
|
323
|
+
staticFor,
|
|
324
|
+
stopAmbient,
|
|
325
|
+
stopBgm,
|
|
326
|
+
stopVideo,
|
|
327
|
+
stopVoice,
|
|
328
|
+
style,
|
|
329
|
+
switchOn,
|
|
330
|
+
textElement,
|
|
331
|
+
textTypewriter,
|
|
332
|
+
transition,
|
|
333
|
+
uncharacter,
|
|
334
|
+
undef,
|
|
335
|
+
video,
|
|
336
|
+
videoSkipable,
|
|
337
|
+
voice,
|
|
338
|
+
wait,
|
|
339
|
+
when,
|
|
340
|
+
whenChain,
|
|
341
|
+
whileDo,
|
|
342
|
+
} from "./script/index.ts";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 步骤布局域出口:把每列切分为「步骤」(等待态边界)并给出列间分支边。
|
|
3
|
+
* 边界判据取自引擎的等待声明表,本域不做逐 op 判定。
|
|
4
|
+
*/
|
|
5
|
+
export {
|
|
6
|
+
columnSteps,
|
|
7
|
+
storySteps,
|
|
8
|
+
type StepFork,
|
|
9
|
+
type StoryStep,
|
|
10
|
+
type StepLane,
|
|
11
|
+
type StepEdge,
|
|
12
|
+
type StepLayout,
|
|
13
|
+
type StepOptions,
|
|
14
|
+
} from "./steps.ts";
|