@vervedoc/core 3.0.11 → 3.3.12

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 (55) hide show
  1. package/README.md +194 -71
  2. package/dist/assets/editor-worker-CG2Et0Mg.js +244 -0
  3. package/dist/assets/editor-worker-CG2Et0Mg.js.map +1 -0
  4. package/dist/assets/thumbnail-worker-BGjZ82h0.js +52 -0
  5. package/dist/assets/thumbnail-worker-BGjZ82h0.js.map +1 -0
  6. package/dist/command-chain.d.ts +40 -0
  7. package/dist/constants.d.ts +21 -0
  8. package/dist/core.js +16405 -3930
  9. package/dist/core.js.map +1 -1
  10. package/dist/core.umd.cjs +413 -134
  11. package/dist/core.umd.cjs.map +1 -1
  12. package/dist/docx-editor.d.ts +110 -0
  13. package/dist/index.d.ts +20 -23
  14. package/dist/shortcut.d.ts +60 -0
  15. package/dist/workers/compute.d.ts +17 -0
  16. package/dist/workers/thumbnail-manager.d.ts +19 -0
  17. package/dist/workers/worker-manager.d.ts +44 -0
  18. package/package.json +53 -60
  19. package/dist/DocxEditor.d.ts +0 -17
  20. package/dist/actuator/Actuator.d.ts +0 -22
  21. package/dist/assets/runtime.worker-glNChxsd.js.map +0 -1
  22. package/dist/docxParser/constants.d.ts +0 -42
  23. package/dist/docxParser/docx.parser.d.ts +0 -13
  24. package/dist/docxParser/index.d.ts +0 -13
  25. package/dist/docxParser/types.d.ts +0 -170
  26. package/dist/docxParser/worker/builder/element.builder.d.ts +0 -6
  27. package/dist/docxParser/worker/numbering.resolver.d.ts +0 -29
  28. package/dist/docxParser/worker/parsers/chart.parser.d.ts +0 -16
  29. package/dist/docxParser/worker/parsers/comment.parser.d.ts +0 -5
  30. package/dist/docxParser/worker/parsers/hyperlink.parser.d.ts +0 -14
  31. package/dist/docxParser/worker/parsers/image.parser.d.ts +0 -12
  32. package/dist/docxParser/worker/parsers/list.parser.d.ts +0 -6
  33. package/dist/docxParser/worker/parsers/ooxml.chart.parser.d.ts +0 -4
  34. package/dist/docxParser/worker/parsers/paragraph.parser.d.ts +0 -10
  35. package/dist/docxParser/worker/parsers/run.parser.d.ts +0 -22
  36. package/dist/docxParser/worker/parsers/section.parser.d.ts +0 -20
  37. package/dist/docxParser/worker/parsers/table.parser.d.ts +0 -11
  38. package/dist/docxParser/worker/parsers/toc.parser.d.ts +0 -13
  39. package/dist/docxParser/worker/relationship.resolver.d.ts +0 -17
  40. package/dist/docxParser/worker/style.resolver.d.ts +0 -33
  41. package/dist/docxParser/worker/theme.resolver.d.ts +0 -21
  42. package/dist/docxParser/worker/xml.helper.d.ts +0 -36
  43. package/dist/export/ExportComponent.d.ts +0 -9
  44. package/dist/i18n/I18n.d.ts +0 -14
  45. package/dist/index-DCzhFl4v.js +0 -16770
  46. package/dist/index-DCzhFl4v.js.map +0 -1
  47. package/dist/table-contextmenu/TableContextMenu.d.ts +0 -48
  48. package/dist/table-contextmenu/TableContextMenuComponent.d.ts +0 -7
  49. package/dist/utils/clipboard.d.ts +0 -11
  50. package/dist/utils/print.d.ts +0 -7
  51. package/dist/worker/WorkerComponent.d.ts +0 -8
  52. package/dist/worker/WorkerManager.d.ts +0 -21
  53. package/dist/worker/WorkerMessage.d.ts +0 -21
  54. /package/dist/{docxParser/worker/docx.parse.worker.d.ts → workers/editor-worker.d.ts} +0 -0
  55. /package/dist/{worker/runtime.worker.d.ts → workers/thumbnail-worker.d.ts} +0 -0
@@ -1,6 +0,0 @@
1
- import { ParagraphStyle } from '../../types';
2
- import { NumberingResolver } from '../numbering.resolver';
3
- /**
4
- * 检测段落是否为列表项,并填充列表信息
5
- */
6
- export declare function resolveListInfo(style: ParagraphStyle, numberingResolver: NumberingResolver): void;
@@ -1,4 +0,0 @@
1
- /**
2
- * 解析 OOXML chart XML,返回 ECharts option
3
- */
4
- export declare function parseOoxmlChartToOption(chartXml: string): any | null;
@@ -1,10 +0,0 @@
1
- import { ParagraphNode } from '../../types';
2
- import { StyleResolver } from '../style.resolver';
3
- import { ThemeData } from '../theme.resolver';
4
- import { NumberingResolver } from '../numbering.resolver';
5
- import { RelationshipEntry } from '../relationship.resolver';
6
- import { PageMargins } from './image.parser';
7
- /**
8
- * 解析 <w:p> 元素为 ParagraphNode
9
- */
10
- export declare function parseParagraph(paragraphEl: Element, styleResolver: StyleResolver, theme: ThemeData, numberingResolver: NumberingResolver, rels: Map<string, RelationshipEntry>, mediaMap: Record<string, string>, pageMargins?: PageMargins, defaultFontSize?: number): ParagraphNode;
@@ -1,22 +0,0 @@
1
- import { RunStyle, InlineChunk } from '../../types';
2
- import { StyleResolver } from '../style.resolver';
3
- import { ThemeData } from '../theme.resolver';
4
- /**
5
- * 全局脚注 / 尾注计数器(每次 parseSync 开始前由 DocxParser 重置)
6
- */
7
- export declare const footnoteCounter: {
8
- value: number;
9
- };
10
- /**
11
- * 解析 <w:r> 元素,返回 InlineChunk 列表
12
- *
13
- * 处理内容:
14
- * <w:t> 文本
15
- * <w:br> 换行 / 分页 / 分栏符
16
- * <w:tab> 制表符
17
- * <w:sym> 符号字符
18
- * <w:softHyphen> 软连字符(忽略)
19
- * <w:noBreakHyphen> 不换行连字符(输出 "-")
20
- * <w:footnoteReference> / <w:endnoteReference> 脚注 / 尾注(输出上标序号)
21
- */
22
- export declare function parseRun(runEl: Element, styleResolver: StyleResolver, _theme: ThemeData, baseRunStyle: RunStyle): InlineChunk[];
@@ -1,20 +0,0 @@
1
- import { ParagraphNode, ColumnNode } from '../../types';
2
- /** 分节类型:nextPage / evenPage / oddPage 均产生分页,continuous / nextColumn 不分页 */
3
- export type SectionBreakType = 'nextPage' | 'evenPage' | 'oddPage' | 'continuous' | 'nextColumn';
4
- export interface SectionProperties {
5
- /** 分节类型,默认 nextPage */
6
- breakType: SectionBreakType;
7
- columns: number;
8
- colWidths: number[];
9
- colSpace: number;
10
- separator: boolean;
11
- }
12
- /**
13
- * 解析 <w:sectPr> 中的分节属性(分页类型 + 分栏)
14
- */
15
- export declare function parseSectionProperties(sectPrEl: Element): SectionProperties;
16
- /**
17
- * 将段落列表按分栏属性分组,构建 ColumnNode
18
- * ColumnNode 是编辑器原生分栏格式(推荐)
19
- */
20
- export declare function buildColumnNode(paragraphs: ParagraphNode[], sectionProps: SectionProperties, targetInnerWidth: number): ColumnNode;
@@ -1,11 +0,0 @@
1
- import { TableNode } from '../../types';
2
- import { StyleResolver } from '../style.resolver';
3
- import { ThemeData } from '../theme.resolver';
4
- import { NumberingResolver } from '../numbering.resolver';
5
- import { RelationshipEntry } from '../relationship.resolver';
6
- import { PageMargins } from './image.parser';
7
- /**
8
- * 解析 <w:tbl> 元素为 TableNode
9
- * 支持嵌套表格、合并单元格(colspan / rowspan)、单元格边框
10
- */
11
- export declare function parseTable(tableEl: Element, styleResolver: StyleResolver, theme: ThemeData, numberingResolver: NumberingResolver, rels: Map<string, RelationshipEntry>, mediaMap: Record<string, string>, pageMargins?: PageMargins): TableNode;
@@ -1,13 +0,0 @@
1
- import { ParagraphNode } from '../../types';
2
- import { StyleResolver } from '../style.resolver';
3
- import { ThemeData } from '../theme.resolver';
4
- import { NumberingResolver } from '../numbering.resolver';
5
- import { RelationshipEntry } from '../relationship.resolver';
6
- /**
7
- * 检测元素是否为 TOC(目录)结构化文档标签
8
- */
9
- export declare function isTocSdt(sdtEl: Element): boolean;
10
- /**
11
- * 解析 TOC SDT 为段落列表(当作普通段落处理)
12
- */
13
- export declare function parseTocContent(sdtEl: Element, styleResolver: StyleResolver, theme: ThemeData, numberingResolver: NumberingResolver, rels: Map<string, RelationshipEntry>, mediaMap: Record<string, string>): ParagraphNode[];
@@ -1,17 +0,0 @@
1
- export interface RelationshipEntry {
2
- id: string;
3
- type: string;
4
- target: string;
5
- }
6
- /**
7
- * 解析 .rels 文件,建立 rId → target 映射
8
- */
9
- export declare function parseRelationships(relsXml: string): Map<string, RelationshipEntry>;
10
- /**
11
- * 通过 rId 获取 target 路径
12
- */
13
- export declare function getTargetByRId(rels: Map<string, RelationshipEntry>, rId: string): string | null;
14
- /**
15
- * 查找指定类型的 relationship
16
- */
17
- export declare function findRelByType(rels: Map<string, RelationshipEntry>, typeSubstring: string): RelationshipEntry | null;
@@ -1,33 +0,0 @@
1
- import { ParagraphStyle, RunStyle, ResolvedStyle } from '../types';
2
- import { ThemeData } from './theme.resolver';
3
- /**
4
- * 样式解析器:解析 word/styles.xml,提供完整的样式继承链查询
5
- *
6
- * 合并优先级(低 → 高):
7
- * docDefaults → basedOn 链(从根祖先到直接父级)→ 当前 styleId → 段落/run 局部属性
8
- */
9
- export declare class StyleResolver {
10
- private styleMap;
11
- private defaultParagraphStyle;
12
- private defaultRunStyle;
13
- private theme;
14
- constructor(stylesXml: string | null, theme: ThemeData);
15
- /**
16
- * 解析段落属性 <w:pPr>,返回局部 ParagraphStyle(不含继承链)
17
- */
18
- parseParagraphProperties(pPr: Element): ParagraphStyle;
19
- /**
20
- * 解析 Run 属性 <w:rPr>,返回局部 RunStyle(不含继承链)
21
- */
22
- parseRunProperties(rPr: Element): RunStyle;
23
- /**
24
- * 根据 styleId 解析完整样式(含 docDefaults + 完整继承链)
25
- */
26
- resolveStyle(styleId: string | null): ResolvedStyle;
27
- getDefaultRunStyle(): RunStyle;
28
- getDefaultParagraphStyle(): ParagraphStyle;
29
- private parseStylesXml;
30
- private parseDocDefaults;
31
- private parseStyleElement;
32
- }
33
- export declare function resolveShdFill(shd: Element, theme: ThemeData): string | null;
@@ -1,21 +0,0 @@
1
- export interface ThemeData {
2
- colors: Map<string, string>;
3
- majorFont: string | null;
4
- minorFont: string | null;
5
- }
6
- /**
7
- * 解析 word/theme/theme1.xml,提取颜色方案和字体方案
8
- */
9
- export declare function parseTheme(themeXml: string | null): ThemeData;
10
- /**
11
- * 将主题颜色名(含语义别名)解析为 #RRGGBB 颜色字符串
12
- *
13
- * tint / shade 为 OOXML 十六进制字符串(0x00-0xFF),在 HSL 色彩空间运算:
14
- * tint:L_new = L + (1 - L) * factor (变亮)
15
- * shade:L_new = L * factor (变暗)
16
- */
17
- export declare function resolveThemeColor(theme: ThemeData, themeColorName: string, themeTint?: string, themeShade?: string): string | null;
18
- /**
19
- * 解析主题字体引用(asciiTheme / eastAsiaTheme 属性值)
20
- */
21
- export declare function resolveThemeFont(theme: ThemeData, fontRef: string | null | undefined): string | null;
@@ -1,36 +0,0 @@
1
- /**
2
- * 解析 XML 字符串为 Document
3
- */
4
- export declare function parseXml(xmlString: string): Document;
5
- /**
6
- * 获取指定命名空间下的子元素(直接子元素)
7
- */
8
- export declare function getChildrenByTag(parent: Element, ns: string, localName: string): Element[];
9
- /**
10
- * 获取第一个指定命名空间下的子元素
11
- */
12
- export declare function getFirstChildByTag(parent: Element, ns: string, localName: string): Element | null;
13
- /**
14
- * 获取 w:val 属性值
15
- */
16
- export declare function getWVal(el: Element | null): string | null;
17
- /**
18
- * 获取指定命名空间的属性值
19
- */
20
- export declare function getAttr(el: Element, ns: string, name: string): string | null;
21
- /**
22
- * 获取属性(兼容带前缀和不带前缀的写法)
23
- */
24
- export declare function getAttrVal(el: Element, attrName: string): string | null;
25
- /**
26
- * 遍历直接子元素(所有命名空间)
27
- */
28
- export declare function forEachChild(parent: Element, callback: (child: Element) => void): void;
29
- /**
30
- * 获取所有后代元素(指定命名空间和标签名)
31
- */
32
- export declare function getElementsByTag(parent: Element, ns: string, localName: string): Element[];
33
- /**
34
- * 检查元素是否存在(用于 boolean 属性如 <w:b/>)
35
- */
36
- export declare function hasChild(parent: Element, ns: string, localName: string): boolean;
@@ -1,9 +0,0 @@
1
- type Draw = any;
2
- type Command = any;
3
- export declare class ExportComponent {
4
- private _command;
5
- install(draw: Draw, command: Command): this;
6
- exportDocx(payload?: any): Promise<Blob | null>;
7
- previewHtml(payload?: any): string;
8
- }
9
- export {};
@@ -1,14 +0,0 @@
1
- type Draw = any;
2
- type ILang = any;
3
- type DeepPartial<T> = T;
4
- export declare class I18n {
5
- private _locale;
6
- private _lang;
7
- constructor(locale?: string);
8
- t(key: string, ..._args: any[]): string;
9
- registerLangMap(locale: string, lang: DeepPartial<ILang>): void;
10
- destroy(): void;
11
- install(_draw: Draw): this;
12
- setLang(_locale: string, _lang: DeepPartial<ILang>): void;
13
- }
14
- export {};