docxmlater 10.2.4 → 10.2.5

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.
@@ -1,7 +1,8 @@
1
1
  import type { Run } from './Run';
2
2
  import type { Hyperlink } from './Hyperlink';
3
3
  import type { ImageRun } from './ImageRun';
4
- export type RevisionContent = Run | ImageRun | Hyperlink;
4
+ import type { ComplexField } from './Field';
5
+ export type RevisionContent = Run | ImageRun | Hyperlink | ComplexField;
5
6
  export declare function isRunContent(content: RevisionContent): content is Run;
6
7
  export declare function isHyperlinkContent(content: RevisionContent): content is Hyperlink;
7
8
  export declare function isImageRunContent(content: RevisionContent): content is ImageRun;
@@ -1 +1 @@
1
- {"version":3,"file":"RevisionContent.d.ts","sourceRoot":"","sources":["../../src/elements/RevisionContent.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAU3C,MAAM,MAAM,eAAe,GAAG,GAAG,GAAG,QAAQ,GAAG,SAAS,CAAC;AAUzD,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,IAAI,GAAG,CAQrE;AAUD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,IAAI,SAAS,CAKjF;AAWD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,IAAI,QAAQ,CAK/E"}
1
+ {"version":3,"file":"RevisionContent.d.ts","sourceRoot":"","sources":["../../src/elements/RevisionContent.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAW5C,MAAM,MAAM,eAAe,GAAG,GAAG,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;AAUxE,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,IAAI,GAAG,CAQrE;AAUD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,IAAI,SAAS,CAKjF;AAWD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,IAAI,QAAQ,CAK/E"}
@@ -1 +1 @@
1
- {"version":3,"file":"RevisionContent.js","sourceRoot":"","sources":["../../src/elements/RevisionContent.ts"],"names":[],"mappings":";;AAiCA,oCAQC;AAUD,gDAKC;AAWD,8CAKC;AAvCD,SAAgB,YAAY,CAAC,OAAwB;IACnD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAG1D,MAAM,UAAU,GAAG,OAAQ,OAAe,CAAC,OAAO,KAAK,UAAU,CAAC;IAClE,MAAM,SAAS,GAAG,OAAQ,OAAe,CAAC,MAAM,KAAK,UAAU,CAAC;IAEhE,OAAO,UAAU,IAAI,CAAC,SAAS,CAAC;AAClC,CAAC;AAUD,SAAgB,kBAAkB,CAAC,OAAwB;IACzD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAG1D,OAAO,OAAQ,OAAe,CAAC,MAAM,KAAK,UAAU,CAAC;AACvD,CAAC;AAWD,SAAgB,iBAAiB,CAAC,OAAwB;IACxD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAG1D,OAAO,OAAQ,OAAe,CAAC,eAAe,KAAK,UAAU,CAAC;AAChE,CAAC","sourcesContent":["/**\n * RevisionContent - Defines valid content types for tracked changes (revisions)\n *\n * Per ECMA-376, w:ins and w:del elements can contain:\n * - w:r (runs) - Text with formatting\n * - w:r with w:drawing (image runs) - Images embedded in runs\n * - w:hyperlink - Hyperlinks with nested runs\n *\n * This module provides the type definitions and type guards for revision content.\n */\n\nimport type { Run } from './Run';\nimport type { Hyperlink } from './Hyperlink';\nimport type { ImageRun } from './ImageRun';\n\n/**\n * Content types valid within a revision (tracked change)\n *\n * Per ECMA-376 Part 1 section 17.13.5, revision elements can contain:\n * - Run elements (w:r) - the most common case\n * - ImageRun elements (w:r with w:drawing) - for tracked image changes\n * - Hyperlink elements (w:hyperlink) - for tracked hyperlink changes\n */\nexport type RevisionContent = Run | ImageRun | Hyperlink;\n\n/**\n * Type guard to check if content is a Run\n * @param content - The content to check\n * @returns true if content is a Run instance\n *\n * Note: Uses duck typing instead of constructor.name to handle minified builds.\n * Run objects have getText() but NOT getUrl() or getAnchor() methods.\n */\nexport function isRunContent(content: RevisionContent): content is Run {\n if (!content || typeof content !== 'object') return false;\n\n // Duck typing: Runs have getText but no getUrl\n const hasGetText = typeof (content as any).getText === 'function';\n const hasGetUrl = typeof (content as any).getUrl === 'function';\n\n return hasGetText && !hasGetUrl;\n}\n\n/**\n * Type guard to check if content is a Hyperlink\n * @param content - The content to check\n * @returns true if content is a Hyperlink instance\n *\n * Note: Uses duck typing instead of constructor.name to handle minified builds.\n * Hyperlink objects have getUrl() method which Runs don't have.\n */\nexport function isHyperlinkContent(content: RevisionContent): content is Hyperlink {\n if (!content || typeof content !== 'object') return false;\n\n // Duck typing: Hyperlinks have getUrl method\n return typeof (content as any).getUrl === 'function';\n}\n\n/**\n * Type guard to check if content is an ImageRun\n * @param content - The content to check\n * @returns true if content is an ImageRun instance\n *\n * Note: Uses duck typing instead of constructor.name to handle minified builds.\n * ImageRun objects have getImageElement() method which regular Runs don't have.\n * This check should be performed BEFORE isRunContent() since ImageRun extends Run.\n */\nexport function isImageRunContent(content: RevisionContent): content is ImageRun {\n if (!content || typeof content !== 'object') return false;\n\n // Duck typing: ImageRun has getImageElement method which regular Run doesn't have\n return typeof (content as any).getImageElement === 'function';\n}\n"]}
1
+ {"version":3,"file":"RevisionContent.js","sourceRoot":"","sources":["../../src/elements/RevisionContent.ts"],"names":[],"mappings":";;AAmCA,oCAQC;AAUD,gDAKC;AAWD,8CAKC;AAvCD,SAAgB,YAAY,CAAC,OAAwB;IACnD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAG1D,MAAM,UAAU,GAAG,OAAQ,OAAe,CAAC,OAAO,KAAK,UAAU,CAAC;IAClE,MAAM,SAAS,GAAG,OAAQ,OAAe,CAAC,MAAM,KAAK,UAAU,CAAC;IAEhE,OAAO,UAAU,IAAI,CAAC,SAAS,CAAC;AAClC,CAAC;AAUD,SAAgB,kBAAkB,CAAC,OAAwB;IACzD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAG1D,OAAO,OAAQ,OAAe,CAAC,MAAM,KAAK,UAAU,CAAC;AACvD,CAAC;AAWD,SAAgB,iBAAiB,CAAC,OAAwB;IACxD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAG1D,OAAO,OAAQ,OAAe,CAAC,eAAe,KAAK,UAAU,CAAC;AAChE,CAAC","sourcesContent":["/**\n * RevisionContent - Defines valid content types for tracked changes (revisions)\n *\n * Per ECMA-376, w:ins and w:del elements can contain:\n * - w:r (runs) - Text with formatting\n * - w:r with w:drawing (image runs) - Images embedded in runs\n * - w:hyperlink - Hyperlinks with nested runs\n *\n * This module provides the type definitions and type guards for revision content.\n */\n\nimport type { Run } from './Run';\nimport type { Hyperlink } from './Hyperlink';\nimport type { ImageRun } from './ImageRun';\nimport type { ComplexField } from './Field';\n\n/**\n * Content types valid within a revision (tracked change)\n *\n * Per ECMA-376 Part 1 section 17.13.5, revision elements can contain:\n * - Run elements (w:r) - the most common case\n * - ImageRun elements (w:r with w:drawing) - for tracked image changes\n * - Hyperlink elements (w:hyperlink) - for tracked hyperlink changes\n * - ComplexField elements (w:fldChar sequences) - for tracked field code changes\n */\nexport type RevisionContent = Run | ImageRun | Hyperlink | ComplexField;\n\n/**\n * Type guard to check if content is a Run\n * @param content - The content to check\n * @returns true if content is a Run instance\n *\n * Note: Uses duck typing instead of constructor.name to handle minified builds.\n * Run objects have getText() but NOT getUrl() or getAnchor() methods.\n */\nexport function isRunContent(content: RevisionContent): content is Run {\n if (!content || typeof content !== 'object') return false;\n\n // Duck typing: Runs have getText but no getUrl\n const hasGetText = typeof (content as any).getText === 'function';\n const hasGetUrl = typeof (content as any).getUrl === 'function';\n\n return hasGetText && !hasGetUrl;\n}\n\n/**\n * Type guard to check if content is a Hyperlink\n * @param content - The content to check\n * @returns true if content is a Hyperlink instance\n *\n * Note: Uses duck typing instead of constructor.name to handle minified builds.\n * Hyperlink objects have getUrl() method which Runs don't have.\n */\nexport function isHyperlinkContent(content: RevisionContent): content is Hyperlink {\n if (!content || typeof content !== 'object') return false;\n\n // Duck typing: Hyperlinks have getUrl method\n return typeof (content as any).getUrl === 'function';\n}\n\n/**\n * Type guard to check if content is an ImageRun\n * @param content - The content to check\n * @returns true if content is an ImageRun instance\n *\n * Note: Uses duck typing instead of constructor.name to handle minified builds.\n * ImageRun objects have getImageElement() method which regular Runs don't have.\n * This check should be performed BEFORE isRunContent() since ImageRun extends Run.\n */\nexport function isImageRunContent(content: RevisionContent): content is ImageRun {\n if (!content || typeof content !== 'object') return false;\n\n // Duck typing: ImageRun has getImageElement method which regular Run doesn't have\n return typeof (content as any).getImageElement === 'function';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docxmlater",
3
- "version": "10.2.4",
3
+ "version": "10.2.5",
4
4
  "description": "A comprehensive DOCX editing framework for creating, reading, and manipulating Microsoft Word documents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,6 +12,7 @@
12
12
  import type { Run } from './Run';
13
13
  import type { Hyperlink } from './Hyperlink';
14
14
  import type { ImageRun } from './ImageRun';
15
+ import type { ComplexField } from './Field';
15
16
 
16
17
  /**
17
18
  * Content types valid within a revision (tracked change)
@@ -20,8 +21,9 @@ import type { ImageRun } from './ImageRun';
20
21
  * - Run elements (w:r) - the most common case
21
22
  * - ImageRun elements (w:r with w:drawing) - for tracked image changes
22
23
  * - Hyperlink elements (w:hyperlink) - for tracked hyperlink changes
24
+ * - ComplexField elements (w:fldChar sequences) - for tracked field code changes
23
25
  */
24
- export type RevisionContent = Run | ImageRun | Hyperlink;
26
+ export type RevisionContent = Run | ImageRun | Hyperlink | ComplexField;
25
27
 
26
28
  /**
27
29
  * Type guard to check if content is a Run