@gantfdt/semiword 0.0.0-stage → 1.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.
Files changed (97) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +258 -2
  3. package/dist-lib/FlowchartEditor-EFUVACVN.mjs +442 -0
  4. package/dist-lib/FlowchartEditor-EFUVACVN.mjs.map +1 -0
  5. package/dist-lib/MindmapEditor-CCJRPI4I.mjs +141 -0
  6. package/dist-lib/MindmapEditor-CCJRPI4I.mjs.map +1 -0
  7. package/dist-lib/WhiteboardEditor-STZ7W7XX.mjs +120 -0
  8. package/dist-lib/WhiteboardEditor-STZ7W7XX.mjs.map +1 -0
  9. package/dist-lib/ai.d.mts +33 -0
  10. package/dist-lib/ai.mjs +14 -0
  11. package/dist-lib/ai.mjs.map +1 -0
  12. package/dist-lib/chunk-347SCO7S.mjs +3 -0
  13. package/dist-lib/chunk-347SCO7S.mjs.map +1 -0
  14. package/dist-lib/chunk-4F4NEVHE.mjs +100 -0
  15. package/dist-lib/chunk-4F4NEVHE.mjs.map +1 -0
  16. package/dist-lib/chunk-4W6PPBHQ.mjs +474 -0
  17. package/dist-lib/chunk-4W6PPBHQ.mjs.map +1 -0
  18. package/dist-lib/chunk-7AAZUM6M.mjs +45 -0
  19. package/dist-lib/chunk-7AAZUM6M.mjs.map +1 -0
  20. package/dist-lib/chunk-BBZ5ZBEK.mjs +1510 -0
  21. package/dist-lib/chunk-BBZ5ZBEK.mjs.map +1 -0
  22. package/dist-lib/chunk-CREU4TZJ.mjs +24 -0
  23. package/dist-lib/chunk-CREU4TZJ.mjs.map +1 -0
  24. package/dist-lib/chunk-EEUFVA37.mjs +4024 -0
  25. package/dist-lib/chunk-EEUFVA37.mjs.map +1 -0
  26. package/dist-lib/chunk-EOIJPQZI.mjs +370 -0
  27. package/dist-lib/chunk-EOIJPQZI.mjs.map +1 -0
  28. package/dist-lib/chunk-EOUNN3NA.mjs +1517 -0
  29. package/dist-lib/chunk-EOUNN3NA.mjs.map +1 -0
  30. package/dist-lib/chunk-FOIP7DEC.mjs +12 -0
  31. package/dist-lib/chunk-FOIP7DEC.mjs.map +1 -0
  32. package/dist-lib/chunk-GGIOCI2I.mjs +2442 -0
  33. package/dist-lib/chunk-GGIOCI2I.mjs.map +1 -0
  34. package/dist-lib/chunk-IICCIMZU.mjs +5272 -0
  35. package/dist-lib/chunk-IICCIMZU.mjs.map +1 -0
  36. package/dist-lib/chunk-JC5ZZPSL.mjs +600 -0
  37. package/dist-lib/chunk-JC5ZZPSL.mjs.map +1 -0
  38. package/dist-lib/chunk-K7Z56Q4M.mjs +6327 -0
  39. package/dist-lib/chunk-K7Z56Q4M.mjs.map +1 -0
  40. package/dist-lib/chunk-NPPS63UI.mjs +285 -0
  41. package/dist-lib/chunk-NPPS63UI.mjs.map +1 -0
  42. package/dist-lib/chunk-PFA3XERW.mjs +19 -0
  43. package/dist-lib/chunk-PFA3XERW.mjs.map +1 -0
  44. package/dist-lib/chunk-QWDJU3H7.mjs +18 -0
  45. package/dist-lib/chunk-QWDJU3H7.mjs.map +1 -0
  46. package/dist-lib/chunk-TOA6CRSJ.mjs +3917 -0
  47. package/dist-lib/chunk-TOA6CRSJ.mjs.map +1 -0
  48. package/dist-lib/chunk-W627LLF4.mjs +16 -0
  49. package/dist-lib/chunk-W627LLF4.mjs.map +1 -0
  50. package/dist-lib/chunk-XAEALEVP.mjs +547 -0
  51. package/dist-lib/chunk-XAEALEVP.mjs.map +1 -0
  52. package/dist-lib/chunk-ZM3WULHX.mjs +910 -0
  53. package/dist-lib/chunk-ZM3WULHX.mjs.map +1 -0
  54. package/dist-lib/context-DKwyjx1q.d.mts +37 -0
  55. package/dist-lib/designer.d.mts +215 -0
  56. package/dist-lib/designer.mjs +15 -0
  57. package/dist-lib/designer.mjs.map +1 -0
  58. package/dist-lib/document.d.mts +12 -0
  59. package/dist-lib/document.mjs +4 -0
  60. package/dist-lib/document.mjs.map +1 -0
  61. package/dist-lib/editor.d.mts +408 -0
  62. package/dist-lib/editor.mjs +19 -0
  63. package/dist-lib/editor.mjs.map +1 -0
  64. package/dist-lib/gant-ai.d.mts +40 -0
  65. package/dist-lib/gant-ai.mjs +217 -0
  66. package/dist-lib/gant-ai.mjs.map +1 -0
  67. package/dist-lib/index.d.mts +22 -0
  68. package/dist-lib/index.mjs +19 -0
  69. package/dist-lib/index.mjs.map +1 -0
  70. package/dist-lib/interface-RYndHNLS.d.mts +91 -0
  71. package/dist-lib/io.d.mts +75 -0
  72. package/dist-lib/io.mjs +9 -0
  73. package/dist-lib/io.mjs.map +1 -0
  74. package/dist-lib/memoryHistoryStore-DY47xjO_.d.mts +280 -0
  75. package/dist-lib/mindmapConstants-X75XUXV3.mjs +4 -0
  76. package/dist-lib/mindmapConstants-X75XUXV3.mjs.map +1 -0
  77. package/dist-lib/resolve-BMcwblyP.d.mts +114 -0
  78. package/dist-lib/sdk.d.mts +60 -0
  79. package/dist-lib/sdk.mjs +137 -0
  80. package/dist-lib/sdk.mjs.map +1 -0
  81. package/dist-lib/shapes-5SMSF6ML.mjs +4 -0
  82. package/dist-lib/shapes-5SMSF6ML.mjs.map +1 -0
  83. package/dist-lib/storage.d.mts +91 -0
  84. package/dist-lib/storage.mjs +5 -0
  85. package/dist-lib/storage.mjs.map +1 -0
  86. package/dist-lib/template.d.mts +155 -0
  87. package/dist-lib/template.mjs +6 -0
  88. package/dist-lib/template.mjs.map +1 -0
  89. package/dist-lib/types-CO6ppyIY.d.mts +18 -0
  90. package/dist-lib/types-CUsV1hUm.d.mts +49 -0
  91. package/dist-lib/types-ClQ38-C_.d.mts +256 -0
  92. package/dist-lib/types-D1D2miCr.d.mts +117 -0
  93. package/dist-lib/types-DiyyKlc1.d.mts +355 -0
  94. package/dist-lib/types-s1JYaGtG.d.mts +56 -0
  95. package/dist-lib/types-vl8k8NDK.d.mts +562 -0
  96. package/dist-lib/useDocumentPersistence-DOpnQsZQ.d.mts +228 -0
  97. package/package.json +282 -4
@@ -0,0 +1,408 @@
1
+ import { C as ConnectionStatus, a as CollaborationUser, O as OutlinePanelConfig, b as OutlineState, c as OutlineItem, R as RichEditorProps, E as EditorRef, A as AnyEditorPlugin, P as PluginConfig, d as EditorPlugin, T as ToolbarItem, S as SlashCommandItem, e as AiCommandDef, f as EditorPluginOptions, g as OutlineFeatureConfig } from './types-vl8k8NDK.mjs';
2
+ export { h as CollaborationConfig, i as EditorComponentPluginConfig, j as EditorMode, k as EditorPluginComponentProps, l as EditorPluginConfigEntry, m as EditorPluginInput, n as EditorUpdatePayload, o as PluginCategory, p as ToolbarConfig, q as ToolbarCustomItem, r as ToolbarDropdownOption, s as ToolbarItemType } from './types-vl8k8NDK.mjs';
3
+ export { createDocumentSnapshot, sanitizeHtml } from './document.mjs';
4
+ export { a as SemiWordAiChannel, b as SemiWordToolArgSchema, S as SemiWordToolDef, c as SemiWordToolResult, d as SemiWordToolStatus } from './types-s1JYaGtG.mjs';
5
+ import { g as TemplateFeatureConfig } from './types-DiyyKlc1.mjs';
6
+ export { A as ApplyTemplateRequest, e as ApplyTemplateValue, h as TemplateBlockKind, j as TemplateBlockMeta, w as TemplateDataBindingIssue, l as TemplateDataResolveResult, T as TemplateDataSource, y as TemplateDataVariable, b as TemplateDefinition, d as TemplateOperationResult, i as TemplateSlotDefinition, G as TemplateStructureViolation, H as TemplateValidationIssue, f as TemplateValidationResult, c as TemplateValidationRule } from './types-DiyyKlc1.mjs';
7
+ export { T as TemplateBlockAdapter, a as TemplateBlockRegistration, r as registerTemplateBlocks, b as registerTemplates, c as resolveTemplateData, d as resolveTemplateDataFromSource } from './resolve-BMcwblyP.mjs';
8
+ export { b as DocumentStorage, D as DocumentStore, c as DocumentTemplateSnapshot, d as DocumentVersionEntry, a as DocumentVersionStore, e as DocumentVersionTouchPatch, S as SaveStatus, f as StoredDocument, U as UseDocumentPersistenceOptions, g as UseDocumentPersistenceResult, u as useDocumentPersistence } from './useDocumentPersistence-DOpnQsZQ.mjs';
9
+ export { S as StoredTemplate, c as TemplateHistoryEntry, a as TemplateHistoryStore, T as TemplateStorage, b as TemplateStore } from './types-D1D2miCr.mjs';
10
+ export { a as DesignerBlock, f as DesignerBlockType, D as DesignerTemplate } from './types-ClQ38-C_.mjs';
11
+ export { a as DesignerBlockDescriptor, b as DesignerBlockPaletteItem, c as DesignerBlockSettingsProps, e as TableJsonParseResult, f as TemplateDesigner, g as TemplateHistoryDrawer, j as buildDefinition, k as createMemoryHistoryStore, l as exportTemplate, p as importTemplateFile, r as parseDefinition, s as parseTableJson, t as registerDesignerBlocks, u as useTemplateDraftHistory } from './memoryHistoryStore-DY47xjO_.mjs';
12
+ export { I as ImportTemplateResult, T as TemplateDesignerAiRegistrarProps, a as TemplateDesignerProps, b as TemplateExportFormat, c as TemplateImportFormat } from './interface-RYndHNLS.mjs';
13
+ export { T as TemplateStorageProvider, a as TemplateStorageProviderProps, c as createMemoryTemplateStore, g as getDefaultTemplateStorage, s as setDefaultTemplateStorage, u as useTemplateStorage } from './context-DKwyjx1q.mjs';
14
+ export { ImportFormat, ImportTextResult, detectImportFormat, exportHtml, exportJson, exportMarkdown, htmlToJson, importDocumentFile, jsonToHtml, jsonToMarkdown, markdownToHtml, openImportDialog, parseImportText, textToHtml } from './io.mjs';
15
+ export { D as DocumentIssue, a as DocumentIssueSeverity, b as SEMIWORD_SCHEMA_VERSION, S as SemiWordDocumentSnapshot } from './types-CO6ppyIY.mjs';
16
+ import * as react from 'react';
17
+ import react__default, { ReactNode } from 'react';
18
+ import { Editor, Extensions } from '@tiptap/core';
19
+ import * as react_jsx_runtime from 'react/jsx-runtime';
20
+ import * as Y from 'yjs';
21
+ import { HocuspocusProvider } from '@hocuspocus/provider';
22
+ import '@tiptap/pm/model';
23
+ import './types-CUsV1hUm.mjs';
24
+ import 'antd';
25
+
26
+ /**
27
+ * 协同资源(协同模式由 hook 在 effect 中创建并持有;本地模式全为 null)
28
+ */
29
+ interface CollaborationResources {
30
+ /** 资源是否就绪。本地模式恒 true;协同模式在 effect 创建完成后 true */
31
+ ready: boolean;
32
+ /** 当前资源实例标识;资源重建时变化,用于驱动编辑器重挂载 */
33
+ resourcesKey: string;
34
+ /** Yjs 文档实例(协同模式非 null,本地模式 null) */
35
+ ydoc: Y.Doc | null;
36
+ /** HocuspocusProvider 实例(协同模式非 null,本地模式 null) */
37
+ provider: HocuspocusProvider | null;
38
+ /** 连接状态 */
39
+ connectionStatus: ConnectionStatus;
40
+ /** 在线用户列表(来自 awareness,已去重) */
41
+ onlineUsers: CollaborationUser[];
42
+ /** 错误信息(鉴权失败/连接异常等),经状态栏 Tooltip 展示 */
43
+ error: string | null;
44
+ /** 重新连接 */
45
+ reconnect: () => void;
46
+ }
47
+
48
+ /**
49
+ * CollaborationContext —— 协同资源上下文
50
+ *
51
+ * 暴露 useCollaborationResources 创建的 ydoc/provider/状态/在线用户等,
52
+ * 供子组件(OnlineUsersBadge、EditorStatusBar 等)读取同一套资源实例。
53
+ */
54
+ type CollaborationContextValue = CollaborationResources;
55
+ interface CollaborationProviderProps {
56
+ /** 由 RichEditor 唯一创建的协同资源(本地模式传全 null 的默认值) */
57
+ resources: CollaborationResources;
58
+ children: ReactNode;
59
+ }
60
+ /**
61
+ * CollaborationProvider -- 协同上下文 Provider(薄壳)。
62
+ *
63
+ * 纯透传:接收 RichEditor 唯一创建的协同资源,放入 Context 供子组件读取。
64
+ * 资源生命周期由 RichEditor 中的 useCollaborationResources 管理
65
+ * (effect 中创建/监听/清理/降级),编辑器扩展与 Context 共享同一份 ydoc/provider。
66
+ */
67
+ declare function CollaborationProvider({ resources, children }: CollaborationProviderProps): react_jsx_runtime.JSX.Element;
68
+
69
+ /**
70
+ * 获取协同编辑上下文
71
+ *
72
+ * 必须在 CollaborationProvider 内使用。
73
+ * CollaborationContext 已通过 createContext 设置了降级默认值,
74
+ * 不在 Provider 内时返回该默认值(不抛错),保证离线模式正常工作。
75
+ */
76
+ declare function useCollaboration(): CollaborationContextValue;
77
+
78
+ /**
79
+ * useOutline — 大纲功能核心 Hook
80
+ *
81
+ * 接收 Tiptap Editor 实例,返回大纲状态与操作方法。
82
+ * 自动监听 editor 的 update/selectionUpdate 事件以刷新大纲。
83
+ *
84
+ * 稳定性约束:订阅 effect 只依赖 editor,事件回调经 ref 读取最新实现;
85
+ * setItems 前用 areOutlineItemsEqual 守卫。二者共同避免
86
+ * 「setItems 新引用 → 回调重建 → effect 重跑 → 再 setItems」的自激循环。
87
+ *
88
+ * @param editor Tiptap Editor 实例(可为 null,编辑器未就绪时)
89
+ * @param config 面板配置(控制标题级别范围等)
90
+ */
91
+ declare function useOutline(editor: Editor | null, config?: OutlinePanelConfig): OutlineState;
92
+
93
+ /**
94
+ * 从 Tiptap 文档提取标题节点生成大纲列表。
95
+ *
96
+ * 独立于 useOutline:本函数是无 React 依赖的纯函数公共 API
97
+ * (经 editor/index.ts 导出,RichEditor.getOutlineItems 也直接调用),
98
+ * 消费方不必因此拉入 hook。
99
+ */
100
+
101
+ /** 从文档中提取所有标题节点,生成大纲列表 */
102
+ declare function extractHeadings(editor: Editor, config?: OutlinePanelConfig): OutlineItem[];
103
+
104
+ /**
105
+ * Outline (Table of Contents) feature — 大纲面板 React 组件
106
+ *
107
+ * 渲染可交互的文档大纲导航面板,点击标题项跳转到文档对应位置。
108
+ * 支持层级缩进、激活状态高亮、空状态提示。
109
+ */
110
+
111
+ /** OutlinePanel 组件 Props */
112
+ interface OutlinePanelProps {
113
+ /** Tiptap Editor 实例 */
114
+ editor: Editor | null;
115
+ /** 面板配置 */
116
+ config?: OutlinePanelConfig;
117
+ /** 标题栏右侧自定义内容(如编辑器页的「钉住」开关);不传则仅显示标题 */
118
+ headerExtra?: ReactNode;
119
+ /**
120
+ * 大纲项变化回调:每次提取结果更新时回调最新列表。
121
+ * 供浮层容器判断「文档是否有大纲」——决定浮层显隐与是否让父级预留右侧空间,
122
+ * 面板自身渲染不受影响。
123
+ */
124
+ onItemsChange?: (items: OutlineItem[]) => void;
125
+ }
126
+ /**
127
+ * OutlinePanel — 文档大纲导航面板
128
+ *
129
+ * @example
130
+ * ```tsx
131
+ * import { OutlinePanel } from '@gantfdt/semiword/editor';
132
+ *
133
+ * <div style={{ display: 'flex' }}>
134
+ * <RichEditor ref={ref} ... />
135
+ * <OutlinePanel editor={ref.current?.editor ?? null} />
136
+ * </div>
137
+ * ```
138
+ */
139
+ declare const OutlinePanel: react__default.NamedExoticComponent<OutlinePanelProps>;
140
+
141
+ /**
142
+ * RichEditor —— 富文本编辑器主组件
143
+ *
144
+ * 组合 useCollaborationResources + usePluginRegistry + EditorBody,
145
+ * 通过 forwardRef 暴露 EditorRef 接口。
146
+ * 协同 user/扩展派生、placeholder/template/outline 三级配置注入、imperative handle
147
+ * 分别收敛于 useCollaborationExtensions / resolveEditorPluginConfigs / useEditorRefApi。
148
+ *
149
+ * 协同架构:
150
+ * 1. useCollaborationResources 在 useEffect 中创建 ydoc/provider/persistence(唯一创建点),
151
+ * 通过 ready 状态门控;StrictMode 下 effect cleanup→重跑可安全销毁重建
152
+ * 2. 资源就绪后构建协同扩展(Collaboration + CollaborationCursor),传入 EditorBody
153
+ * 3. EditorBody 在协同资源未就绪时不挂载(渲染占位),就绪后一次性装配协同扩展,
154
+ * 避免 null→非 null 导致的编辑器重建闪烁
155
+ * 4. EditorBody 的 key 取协同资源 key:文档/endpoint/token/offline 配置变化时
156
+ * 强制重挂载,使用新 ydoc/provider 重建编辑器
157
+ * (Tiptap useEditor 不响应运行时 extensions 变化,故切换资源靠 key 重建)
158
+ * 5. CollaborationProvider 接收同一份 resources 放入 Context(不自建),
159
+ * OnlineUsersBadge / EditorStatusBar 从 Context 读取
160
+ *
161
+ * @example
162
+ * ```tsx
163
+ * const ref = useRef<EditorRef>(null);
164
+ * <RichEditor
165
+ * ref={ref}
166
+ * content="<p>初始内容</p>"
167
+ * collaboration
168
+ * collaborationConfig={{ endpoint, documentId, user }}
169
+ * />
170
+ * ```
171
+ */
172
+ declare const RichEditor: react.ForwardRefExoticComponent<RichEditorProps & react.RefAttributes<EditorRef>>;
173
+
174
+ /**
175
+ * 插件注册表
176
+ *
177
+ * 负责:
178
+ * - 插件注册(去重校验)
179
+ * - 用户配置应用(启用/禁用/参数覆盖)
180
+ * - 依赖解析 + 拓扑排序(Kahn 算法,含循环依赖检测)
181
+ * - 构建传给 useEditor 的 extensions / 工具栏项 / 斜杠命令项
182
+ * - 构建结果 memo 化缓存
183
+ */
184
+ declare class PluginRegistry {
185
+ private plugins;
186
+ private configs;
187
+ private version;
188
+ private readonly instanceId;
189
+ /** 已警告过的未知插件配置名(避免 configure/重建后重复告警刷屏) */
190
+ private warnedUnknownPluginNames;
191
+ /** 构建结果缓存(dirty 标记模式),聚合单对象便于整体置空 */
192
+ private cache;
193
+ /** 注册单个插件 */
194
+ register(plugin: AnyEditorPlugin): void;
195
+ /** 批量注册 */
196
+ registerAll(plugins: readonly AnyEditorPlugin[]): void;
197
+ /** 禁用选择集外的可选插件,必需插件与已启用依赖仍由统一解析链路保留。 */
198
+ configureSelection(selection: readonly string[]): void;
199
+ /** 应用用户配置(启用/禁用/覆盖参数) */
200
+ configure(configs: Record<string, PluginConfig>): void;
201
+ /** 获取单个插件 */
202
+ getPlugin(name: string): AnyEditorPlugin | undefined;
203
+ /** 获取全部已注册插件 */
204
+ getAllPlugins(): AnyEditorPlugin[];
205
+ /** 获取全部已注册插件的 name 列表 */
206
+ getPluginNames(): string[];
207
+ /** 使缓存失效,下次构建时重新计算 */
208
+ invalidateCache(): void;
209
+ /**
210
+ * 构建版本标识:`实例序号:实例内变更计数`。
211
+ * 实例内 configure/register 使其变化,重建新实例也必然使其变化,
212
+ * 可安全用作 React key 的组成部分(见 RichEditor 的 editorBodyKey)。
213
+ */
214
+ get revision(): string;
215
+ /**
216
+ * 解析最终启用的插件集合(含依赖解析 + 拓扑排序)
217
+ *
218
+ * 步骤:
219
+ * 1. 收集 defaultEnabled !== false 或必需(optional: false)的插件
220
+ * 2. 应用用户配置覆盖(必需插件不可禁用,只告警不移除)
221
+ * 3. 依赖传播:启用 A 时 A 的 dependencies 也启用
222
+ * 4. 拓扑排序(Kahn 算法),检测循环依赖
223
+ */
224
+ resolveEnabled(): AnyEditorPlugin[];
225
+ /**
226
+ * Kahn 算法拓扑排序
227
+ * 边方向:dep -> name(dep 必须在 name 之前)
228
+ */
229
+ private topologicalSort;
230
+ /**
231
+ * 合并默认配置与用户配置
232
+ *
233
+ * 采用「顶层键浅合并 + 嵌套对象再合并一层」的策略,与 configure() 累积
234
+ * 用户配置时的深合并语义保持一致:defaultConfig 中的嵌套对象字段不会被
235
+ * 用户仅提供部分键的同名对象整体覆盖。
236
+ *
237
+ * 合并规则(对每个顶层键):
238
+ * - 用户未提供该键 → 用 defaultConfig 的值
239
+ * - 两侧同为「纯对象」→ 合并为 { ...默认, ...用户 }(浅合并一层)
240
+ * - 其余情况(数组、函数、原始值,或任一侧非对象)→ 用户值整体覆盖
241
+ *
242
+ * 注意:数组按整体替换处理(符合「用户显式指定即完整覆盖」的直觉),
243
+ * 嵌套仅深合并一层,更深层级仍按整体替换。
244
+ */
245
+ private resolveConfig;
246
+ private buildPluginExtensions;
247
+ private buildPluginToolbarItems;
248
+ private buildPluginSlashCommands;
249
+ private buildPluginAiCommands;
250
+ /**
251
+ * 获取插件最终配置,供生命周期钩子等非构建路径复用。
252
+ * 注意:返回的是同一 version 内的共享缓存对象,调用方不得原地修改,
253
+ * 否则会污染 extensions/toolbar/slash 三路构建的配置。
254
+ */
255
+ getResolvedConfig<TConfig extends object>(plugin: EditorPlugin<TConfig>): TConfig;
256
+ /** 构建传给 useEditor 的 extensions 数组(memo 化) */
257
+ buildExtensions(): Extensions;
258
+ /** 构建工具栏项,按 group 分组、order 排序(memo 化) */
259
+ buildToolbarItems(): ToolbarItem[];
260
+ /** 构建斜杠命令项(memo 化) */
261
+ buildSlashCommands(): SlashCommandItem[];
262
+ /**
263
+ * 构建当前启用插件向 AI 声明的能力条目(memo 化)。
264
+ *
265
+ * 只聚合 resolveEnabled() 结果中各插件的 aiCommands——禁用插件的能力自动从
266
+ * 目录消失(启用状态天然联动,无需运行时通知);顺序沿用启用集的拓扑序,
267
+ * 依赖插件(如 starter)的能力先于依赖方出现,目录展示稳定。
268
+ * 供 EditorRef.getAiCommands(能力目录工具 idocs_doc_command_schema)消费。
269
+ */
270
+ buildAiCommands(): AiCommandDef[];
271
+ }
272
+
273
+ interface EditorContextValue {
274
+ editor: Editor | null;
275
+ registry: PluginRegistry | null;
276
+ }
277
+ declare const EditorContext: react.Context<EditorContextValue | null>;
278
+ declare function useEditorContext(): EditorContextValue;
279
+
280
+ type EditorTranslationType = 'fe' | 'workflow';
281
+ type EditorTranslator = (name: string, args?: unknown[], type?: EditorTranslationType) => string;
282
+ /** 保留现有三参数调用签名;第三参数原样交给宿主翻译器。 */
283
+ declare const tr: EditorTranslator;
284
+
285
+ /**
286
+ * 默认占位文案(函数形式:tr() 在调用期解析当前语言,避免模块顶层求值冻结语言)。
287
+ */
288
+ declare function getDefaultPlaceholder(): string;
289
+
290
+ /**
291
+ * plugins 域内部常量。
292
+ * 曾经放在 core/utils/constants.ts,但唯一的消费者都在 plugins 下,
293
+ * 反向依赖(plugins -> core)无必要,故归位到 plugins。
294
+ */
295
+ declare const DEFAULT_TOOLBAR_GROUP_ORDER: string[];
296
+ declare const MINIMAL_PLUGINS: readonly string[];
297
+
298
+ /**
299
+ * React 接入层:创建并配置 PluginRegistry 实例。
300
+ *
301
+ * plugins 与 RichEditor 公开输入一致;数组在此归一化并完成内联注册和选择。
302
+ * RichEditor 也可传入已合并顶层配置的 Record,以及原选择集和注册签名。
303
+ *
304
+ * @param options.collaboration 是否处于协同模式。协同模式下会向 starter 插件
305
+ * 传入 collaboration: true,使其禁用 StarterKit 的 History(由 Yjs UndoManager 接管)。
306
+ */
307
+ declare function usePluginRegistry(options: {
308
+ plugins?: EditorPluginOptions;
309
+ customPlugins?: readonly AnyEditorPlugin[];
310
+ /** 显式选择集;undefined 与空数组语义不同,空数组仍会禁用全部可选插件。 */
311
+ selection?: readonly string[];
312
+ /** RichEditor 归一化得到的内联注册签名;公开数组输入时由 Hook 自行计算。 */
313
+ registrationSignature?: string;
314
+ minimal?: boolean;
315
+ collaboration?: boolean;
316
+ }): PluginRegistry;
317
+
318
+ /**
319
+ * 内置核心插件集。
320
+ *
321
+ * 插件清单以下方 BUILTIN_PLUGINS 数组为准(按 content / format / media / interaction 分组);
322
+ * 各插件的 name、category、依赖与默认启停见其自身定义(手工维护的说明表易与实现脱节,此处不保留)。
323
+ *
324
+ * 注:drawio 未纳入内置集(默认加载公网 embed.diagrams.net,不满足内网离线要求),
325
+ * 如需离线绘图能力再行评估重建。
326
+ */
327
+ declare const BUILTIN_PLUGINS: AnyEditorPlugin[];
328
+
329
+ /**
330
+ * 可缩放图片扩展:在原版 Image 之上补 width 属性与 React NodeView。
331
+ *
332
+ * width 为拖拽缩放落库的唯一尺寸(高度按自然比例跟随,不单独持久化,
333
+ * 避免宽高分别写库后比例失调);sanitizer 按 schema 白名单放行 attrs,
334
+ * 声明后 width 可随文档 JSON 持久化、粘贴带 width 的 HTML 也能还原。
335
+ *
336
+ * selectable:false —— 图片不可整体选中:点击只落光标、不形成 NodeSelection,
337
+ * 打字/粘贴永远不会把图片整块替换掉(插入后也不会停留在选中态);
338
+ * 编辑(重选图片)与删除改走 NodeView 的 hover 工具栏。
339
+ */
340
+ declare module '@tiptap/extension-image' {
341
+ interface ImageOptions {
342
+ /**
343
+ * hover 工具栏「编辑」按钮的重选图片通道(插件层注入,内部区分
344
+ * base64 内嵌 / uploadImage 上传);resolve 新 src,用户取消或失败时
345
+ * resolve undefined,节点保持原图不变。
346
+ */
347
+ pickImageForEdit?: () => Promise<string | undefined>;
348
+ }
349
+ }
350
+ /**
351
+ * image 插件配置。
352
+ *
353
+ * uploadImage:业务方图片上传通道。提供后,插入图片走「选文件→上传→
354
+ * 以返回的 URL 作为 src」,导出即为轻量链接而非 base64 内嵌,
355
+ * 避免长文档/多图场景文档体积膨胀(base64 约膨胀 33%)。
356
+ * 不提供时回退为 base64 dataURL 内嵌(保持现有行为,零配置可用)。
357
+ */
358
+ interface ImagePluginConfig {
359
+ /**
360
+ * 上传单张图片,返回可访问的图片 URL。
361
+ * 上传失败应抛错(由插件统一提示),返回空串视为失败。
362
+ */
363
+ uploadImage?: (file: File) => Promise<string>;
364
+ }
365
+
366
+ /**
367
+ * 模板 feature 的编辑器接入层。
368
+ *
369
+ * 把模板 feature 的扩展与控制器装配为 EditorPlugin。
370
+ * 保护信息随文档自描述,无需注入快照或协同状态。
371
+ */
372
+
373
+ /** 模板插件运行期配置。 */
374
+ type TemplatePluginConfig = TemplateFeatureConfig;
375
+
376
+ /**
377
+ * 模板插件定义。
378
+ * - tiptapExtensions: 注册 protectedBlock、templateImage、业务块扩展、完整性扩展。
379
+ * - onEditorCreate: 创建 TemplateController,空文档时自动加载 initialTemplateId。
380
+ * - 不提供工具栏按钮或斜杠命令;模板由业务端配置加载,必填校验通过 Ref API 调用。
381
+ */
382
+ declare const templatePlugin: EditorPlugin<TemplatePluginConfig>;
383
+
384
+ /**
385
+ * Outline feature 的编辑器接入层。
386
+ *
387
+ * 将大纲 feature 装配为 EditorPlugin,使其可通过插件系统统一配置/声明依赖。
388
+ * 大纲数据流不经过编辑器:OutlinePanel 通过 props 接收 editor 与 config,
389
+ * RichEditor.getOutlineItems 也直接调用 extractHeadings,
390
+ * 故本插件不注册 Tiptap 扩展、不写 editor.storage,仅承担
391
+ * 「声明 heading 依赖 + 注册插件名供启停配置」的注册表职责。
392
+ */
393
+
394
+ /** 插件运行期配置 */
395
+ type OutlinePluginConfig = OutlineFeatureConfig;
396
+ /**
397
+ * outline 插件定义。
398
+ *
399
+ * - 依赖 heading 插件(大纲需从文档中提取标题节点)
400
+ * - 不注册额外的 Tiptap 扩展(heading 扩展已由 heading 插件提供)
401
+ * - 不提供工具栏按钮或斜杠命令(大纲面板为独立 UI 区域,数据走 props)
402
+ * - 插件启停走 PluginConfig.enabled(defaultEnabled/用户配置),无业务 config 字段,
403
+ * 故不声明 defaultConfig。
404
+ */
405
+ declare const outlinePlugin: EditorPlugin<OutlinePluginConfig>;
406
+
407
+ export { AiCommandDef, AnyEditorPlugin, BUILTIN_PLUGINS, CollaborationProvider, CollaborationUser, ConnectionStatus, DEFAULT_TOOLBAR_GROUP_ORDER, EditorContext, EditorPlugin, EditorPluginOptions, EditorRef, MINIMAL_PLUGINS, OutlineFeatureConfig, OutlineItem, OutlinePanel, OutlinePanelConfig, OutlineState, PluginConfig, PluginRegistry, RichEditor, RichEditorProps, SlashCommandItem, TemplateFeatureConfig, ToolbarItem, tr as editorTr, extractHeadings, getDefaultPlaceholder, outlinePlugin, templatePlugin, useCollaboration, useEditorContext, useOutline, usePluginRegistry };
408
+ export type { EditorContextValue, ImagePluginConfig, OutlinePanelProps, OutlinePluginConfig, TemplatePluginConfig };
@@ -0,0 +1,19 @@
1
+ import './chunk-347SCO7S.mjs';
2
+ export { SEMIWORD_SCHEMA_VERSION, createDocumentSnapshot } from './chunk-QWDJU3H7.mjs';
3
+ export { TemplateDesigner, TemplateHistoryDrawer, exportTemplate, importTemplateFile, useTemplateDraftHistory } from './chunk-TOA6CRSJ.mjs';
4
+ export { CollaborationProvider, EditorContext, RichEditor, useCollaboration, useEditorContext, usePluginRegistry } from './chunk-GGIOCI2I.mjs';
5
+ export { useDocumentPersistence } from './chunk-JC5ZZPSL.mjs';
6
+ export { TemplateStorageProvider, createMemoryHistoryStore, createMemoryTemplateStore, getDefaultTemplateStorage, setDefaultTemplateStorage, useTemplateStorage } from './chunk-4F4NEVHE.mjs';
7
+ export { SemiWordToolStatus } from './chunk-FOIP7DEC.mjs';
8
+ export { buildDefinition, parseDefinition, parseTableJson, registerDesignerBlocks } from './chunk-IICCIMZU.mjs';
9
+ export { OutlinePanel, extractHeadings, useOutline } from './chunk-BBZ5ZBEK.mjs';
10
+ export { resolveTemplateData, resolveTemplateDataFromSource } from './chunk-NPPS63UI.mjs';
11
+ export { detectImportFormat, exportHtml, exportJson, exportMarkdown, htmlToJson, importDocumentFile, jsonToHtml, jsonToMarkdown, markdownToHtml, openImportDialog, parseImportText, textToHtml } from './chunk-XAEALEVP.mjs';
12
+ export { BUILTIN_PLUGINS, DEFAULT_TOOLBAR_GROUP_ORDER, MINIMAL_PLUGINS, PluginRegistry, getDefaultPlaceholder, outlinePlugin, templatePlugin } from './chunk-K7Z56Q4M.mjs';
13
+ import './chunk-ZM3WULHX.mjs';
14
+ export { sanitizeHtml } from './chunk-4W6PPBHQ.mjs';
15
+ export { registerTemplateBlocks, registerTemplates } from './chunk-EOUNN3NA.mjs';
16
+ export { tr as editorTr } from './chunk-W627LLF4.mjs';
17
+ import './chunk-CREU4TZJ.mjs';
18
+ //# sourceMappingURL=editor.mjs.map
19
+ //# sourceMappingURL=editor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"editor.mjs"}
@@ -0,0 +1,40 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { TemplateDesignerAiRegistrarProps } from './designer.mjs';
3
+ import { MutableRefObject, PropsWithChildren } from 'react';
4
+ import { EditorRef } from './editor.mjs';
5
+ import { TemplateDefinition } from './editor.mjs';
6
+ import { CopilotPageConfig } from 'procomponents';
7
+ import { SemiWordToolDef } from './ai.mjs';
8
+ import './types-ClQ38-C_.mjs';
9
+ import '@tiptap/core';
10
+ import './types-D1D2miCr.mjs';
11
+ import './types-CUsV1hUm.mjs';
12
+ import 'yjs';
13
+
14
+ /** 与 LayoutWithCopilot 共用 Gant 全局面板状态的智能助手入口。 */
15
+ declare const GantCopilotEntryButton: () => react_jsx_runtime.JSX.Element | null;
16
+
17
+ /** Gant 设计器注册器:11 个工具、默认 Agent、示例问题与块/单元格选中态同步。 */
18
+ declare const GantDesignerAiRegistrar: ({ context, activeUid, activeCell, activeLabel }: TemplateDesignerAiRegistrarProps) => null;
19
+
20
+ interface GantEditorAiRegistrarProps {
21
+ editorRef: MutableRefObject<EditorRef | null>;
22
+ activeTemplate: TemplateDefinition;
23
+ collabEnabled: boolean;
24
+ }
25
+ /** Gant 编辑器页面级 AI 注册器:15 个工具、默认 Agent、示例问题与选中态同步。 */
26
+ declare const GantEditorAiRegistrar: ({ editorRef, activeTemplate, collabEnabled }: GantEditorAiRegistrarProps) => null;
27
+
28
+ /** 将 Gant 尺寸、毛玻璃与 Copilot 面板装配到 SDK 编辑器。 */
29
+ declare function GantLayoutWithCopilot({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
30
+
31
+ declare const IDOCS_DEFAULT_AGENT = "idocs_agent";
32
+ declare const IDOCS_EDITOR_AGENT = "idocs_editor_agent";
33
+ interface GantCopilotPageConfig extends Omit<CopilotPageConfig, 'tools'> {
34
+ tools: SemiWordToolDef[];
35
+ }
36
+ /** 冻结中立页面配置后接入 procomponents;结果枚举值在两侧结构中一致。 */
37
+ declare function useCopilotPage(config: GantCopilotPageConfig, deps: unknown[]): void;
38
+
39
+ export { GantCopilotEntryButton, GantDesignerAiRegistrar, GantEditorAiRegistrar, GantLayoutWithCopilot, IDOCS_DEFAULT_AGENT, IDOCS_EDITOR_AGENT, useCopilotPage };
40
+ export type { GantCopilotPageConfig, GantEditorAiRegistrarProps };