generated from qq15725/starter-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
625 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
import type { TextWrappingValues } from './TextWrappingValues' | ||
import type { | ||
TextAnchoringTypeValues, | ||
TextHorizontalOverflowValues, | ||
TextVerticalOverflowValues, | ||
TextVerticalValues, | ||
TextWrappingValues, | ||
} from './_types' | ||
import { defineAttribute, defineElement, OXML } from '../../core' | ||
import { TextAnchoringTypeValues } from './TextAnchoringTypeValues' | ||
|
||
/** | ||
* @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.bodyproperties | ||
*/ | ||
@defineElement('a:bodyPr') | ||
export class BodyProperties extends OXML { | ||
@defineAttribute('anchor', TextAnchoringTypeValues) declare anchor?: TextAnchoringTypeValues | ||
@defineAttribute('anchor') declare anchor?: TextAnchoringTypeValues | ||
@defineAttribute('anchorCtr', 'boolean') declare anchorCtr?: boolean | ||
@defineAttribute('bIns', 'ST_Coordinate32') declare bIns?: number | ||
@defineAttribute('numCol', 'ST_TextColumnCount') declare numCol?: number | ||
@defineAttribute('spcCol', 'ST_PositiveCoordinate32') declare spcCol?: number | ||
@defineAttribute('compatLnSpc', 'boolean') declare compatLnSpc?: boolean | ||
@defineAttribute('forceAA', 'boolean') declare forceAA?: boolean | ||
@defineAttribute('fromWordArt', 'boolean') declare fromWordArt?: boolean | ||
@defineAttribute('horzOverflow') declare horzOverflow?: TextHorizontalOverflowValues | ||
@defineAttribute('lIns', 'ST_Coordinate32') declare lIns?: number | ||
@defineAttribute('rIns', 'ST_Coordinate32') declare rIns?: number | ||
@defineAttribute('rtlCol', 'boolean') declare rtlCol?: boolean | ||
@defineAttribute('rot', 'ST_Angle') declare rot?: number | ||
@defineAttribute('tIns', 'ST_Coordinate32') declare tIns?: number | ||
@defineAttribute('upright', 'boolean') declare upright?: boolean | ||
@defineAttribute('spcFirstLastPara', 'boolean') declare spcFirstLastPara?: boolean | ||
@defineAttribute('lIns', 'emu') declare lIns?: number | ||
@defineAttribute('tIns', 'emu') declare tIns?: number | ||
@defineAttribute('rIns', 'emu') declare rIns?: number | ||
@defineAttribute('bIns', 'emu') declare bIns?: number | ||
@defineAttribute('rot', 'degree') declare rot?: number | ||
@defineAttribute('vert') declare vert?: TextVerticalValues | ||
@defineAttribute('vertOverflow') declare vertOverflow?: TextVerticalOverflowValues | ||
@defineAttribute('wrap') declare wrap?: TextWrappingValues | ||
@defineAttribute('upright', 'boolean') declare upright?: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineElement, OXML } from '../../core' | ||
|
||
/** | ||
* @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.break | ||
*/ | ||
@defineElement('a:br') | ||
export class Break extends OXML { | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineElement } from '../../core' | ||
import { _Font } from './_Font' | ||
|
||
/** | ||
* https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.complexscriptfont | ||
*/ | ||
@defineElement('a:cs') | ||
export class ComplexScriptFont extends _Font { | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineElement } from '../../core' | ||
import { _Font } from './_Font' | ||
|
||
/** | ||
* https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.eastasianfont | ||
*/ | ||
@defineElement('a:ea') | ||
export class EastAsianFont extends _Font { | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineElement, OXML } from '../../core' | ||
|
||
/** | ||
* @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.endparagraphrunproperties | ||
*/ | ||
@defineElement('a:endParaRPr') | ||
export class EndParagraphRunProperties extends OXML { | ||
// TODO | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineAttribute, defineElement, OXML } from '../../core' | ||
|
||
/** | ||
* @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.field | ||
*/ | ||
@defineElement('a:fld') | ||
export class Field extends OXML { | ||
@defineAttribute('id') declare id?: string | ||
@defineAttribute('type') declare type?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineElement } from '../../core' | ||
import { _Font } from './_Font' | ||
|
||
/** | ||
* https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.latinfont | ||
*/ | ||
@defineElement('a:latin') | ||
export class LatinFont extends _Font { | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { SpacingPercent } from './SpacingPercent' | ||
import type { SpacingPoints } from './SpacingPoints' | ||
import { defineChild, defineElement, OXML } from '../../core' | ||
|
||
/** | ||
* https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.linespacing | ||
*/ | ||
@defineElement('a:lnSpc') | ||
export class LineSpacing extends OXML { | ||
@defineChild('a:spcPct') declare spcPct?: SpacingPercent | ||
@defineChild('a:spcPts') declare spcPts?: SpacingPoints | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,51 @@ | ||
import type { TextAlignmentTypeValues } from './TextAlignmentTypeValues' | ||
import type { Break } from './Break' | ||
import type { EndParagraphRunProperties } from './EndParagraphRunProperties' | ||
import type { Field } from './Field' | ||
import type { ParagraphProperties } from './ParagraphProperties' | ||
import type { Run } from './Run' | ||
import { defineChild, defineElement, defineProperty, OXML } from '../../core' | ||
import { ParagraphProperties } from './ParagraphProperties' | ||
import { Run } from './Run' | ||
|
||
/** | ||
* https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.paragraph | ||
*/ | ||
@defineElement('a:p') | ||
export class Paragraph extends OXML { | ||
@defineChild('p:pPr', ParagraphProperties) declare pPr: ParagraphProperties | ||
@defineChild('p:r', Run) declare rList: Run[] | ||
@defineChild('a:fld') declare fld?: Field | ||
@defineChild('a:pPr') declare pPr: ParagraphProperties | ||
|
||
@defineProperty('pPr.marL', 0) declare marginLeft: number | ||
@defineProperty('pPr.marR', 0) declare marginRight: number | ||
@defineProperty('pPr.indent', 0) declare textIndent: number | ||
@defineProperty() style = new _ParagraphStyle(this) | ||
@defineProperty('pPr.lvl') declare level?: number | ||
@defineProperty('pPr.fontAlgn') declare fontAlign?: string | ||
@defineProperty('_children') declare children?: (Break | Run | EndParagraphRunProperties)[] | ||
|
||
get textAlign(): TextAlignmentTypeValues | undefined { return this.pPr.algn } | ||
get rightToLeft(): string | undefined { return this.pPr.rtl } | ||
get _children(): (Break | Run | EndParagraphRunProperties)[] { | ||
return Array.from(this.element.children).map((element) => { | ||
switch (element.tagName) { | ||
case 'a:fld': | ||
case 'a:pPr': | ||
return undefined | ||
case 'a:br': | ||
case 'a:r': | ||
case 'a:endParaRPr': | ||
default: | ||
return OXML.make(element) | ||
} | ||
}).filter(Boolean) as any | ||
} | ||
} | ||
|
||
export class _ParagraphStyle extends OXML { | ||
@defineProperty('_parent.pPr.marL') declare marginLeft?: number | ||
@defineProperty('_parent.pPr.marR') declare marginRight?: number | ||
@defineProperty('_parent.pPr.indent') declare textIndent: number | ||
@defineProperty('_parent.pPr.lnSpc.spcPct.val') declare lineHeight?: number | ||
|
||
get textAlign() { return this._parent.pPr.algn } | ||
get rightToLeft(): string | undefined { return this._parent.pPr.rtl } | ||
|
||
constructor( | ||
protected _parent: Paragraph, | ||
) { | ||
super() | ||
} | ||
} |
Oops, something went wrong.