From 392bc7bec1d81668022d148803231edd178808e3 Mon Sep 17 00:00:00 2001 From: wxm <157215725@qq.com> Date: Wed, 4 Dec 2024 19:02:10 +0800 Subject: [PATCH] feat: update --- src/openxml/drawing/AdjustHandleList.ts | 9 + src/openxml/drawing/AdjustValueList.ts | 10 + src/openxml/drawing/ArcTo.ts | 12 + src/openxml/drawing/BackgroundColor.ts | 4 +- src/openxml/drawing/CloseShapePath.ts | 9 + src/openxml/drawing/ConnectionSiteList.ts | 9 + src/openxml/drawing/CubicBezierCurveTo.ts | 10 + src/openxml/drawing/CustomGeometry.ts | 17 +- .../drawing/DefaultParagraphProperties.ts | 10 + src/openxml/drawing/EffectDag.ts | 9 + src/openxml/drawing/EffectList.ts | 12 +- src/openxml/drawing/EffectReference.ts | 4 +- src/openxml/drawing/Extension.ts | 2 +- src/openxml/drawing/FillRectangle.ts | 8 +- src/openxml/drawing/FillReference.ts | 4 +- src/openxml/drawing/FontReference.ts | 4 +- src/openxml/drawing/ForegroundColor.ts | 18 +- src/openxml/drawing/GradientStop.ts | 4 +- src/openxml/drawing/GroupFill.ts | 9 + src/openxml/drawing/HslColor.ts | 5 +- src/openxml/drawing/LineReference.ts | 4 +- src/openxml/drawing/LineTo.ts | 10 + src/openxml/drawing/ListStyle.ts | 5 +- src/openxml/drawing/MoveTo.ts | 10 + src/openxml/drawing/Paragraph.ts | 4 +- src/openxml/drawing/Path.ts | 34 +- src/openxml/drawing/PathList.ts | 10 + src/openxml/drawing/Point.ts | 10 + src/openxml/drawing/PresetColor.ts | 5 +- src/openxml/drawing/PresetGeometry.ts | 6 +- src/openxml/drawing/QuadraticBezierCurveTo.ts | 10 + src/openxml/drawing/Rectangle.ts | 8 +- src/openxml/drawing/RgbColorModelHex.ts | 5 +- .../drawing/RgbColorModelPercentage.ts | 5 +- src/openxml/drawing/RunProperties.ts | 28 +- src/openxml/drawing/SchemeColor.ts | 5 +- src/openxml/drawing/ShapeGuide.ts | 10 + src/openxml/drawing/ShapeGuideList.ts | 10 + src/openxml/drawing/SolidFill.ts | 4 +- src/openxml/drawing/SourceRectangle.ts | 10 +- src/openxml/drawing/SystemColor.ts | 5 +- src/openxml/drawing/Tile.ts | 12 +- src/openxml/drawing/TileRectangle.ts | 10 +- .../drawing/{_ColorDefinable.ts => _Color.ts} | 2 +- src/openxml/drawing/_ParagraphProperties.ts | 5 + src/openxml/drawing/_Style.ts | 17 + src/openxml/drawing/index.ts | 16 + .../ApplicationNonVisualDrawingProperties.ts | 4 +- .../presentation/BackgroundProperties.ts | 16 +- src/openxml/presentation/ColorMap.ts | 29 +- src/openxml/presentation/CommonSlideData.ts | 2 +- src/openxml/presentation/ConnectionShape.ts | 16 + src/openxml/presentation/DefaultTextStyle.ts | 8 +- src/openxml/presentation/EmbeddedFont.ts | 14 + src/openxml/presentation/EmbeddedFontList.ts | 10 + src/openxml/presentation/ExtensionList.ts | 2 +- src/openxml/presentation/Font.ts | 12 + src/openxml/presentation/GraphicFrame.ts | 14 + .../presentation/GroupShapeProperties.ts | 18 +- .../NonVisualConnectionShapeProperties.ts | 13 + src/openxml/presentation/PlaceholderShape.ts | 2 +- src/openxml/presentation/Presentation.ts | 21 +- src/openxml/presentation/Shape.ts | 12 +- src/openxml/presentation/ShapeProperties.ts | 28 +- src/openxml/presentation/Slide.ts | 22 +- src/openxml/presentation/SlideLayout.ts | 51 ++- src/openxml/presentation/SlideMaster.ts | 305 +----------------- src/openxml/presentation/_Properties.ts | 15 + src/openxml/presentation/_Slide.ts | 21 ++ src/openxml/presentation/_utils.ts | 8 +- src/openxml/presentation/index.ts | 5 + src/utils/tmeplate.ts | 16 - src/utils/xml.ts | 13 - 73 files changed, 575 insertions(+), 531 deletions(-) create mode 100644 src/openxml/drawing/AdjustHandleList.ts create mode 100644 src/openxml/drawing/AdjustValueList.ts create mode 100644 src/openxml/drawing/ArcTo.ts create mode 100644 src/openxml/drawing/CloseShapePath.ts create mode 100644 src/openxml/drawing/ConnectionSiteList.ts create mode 100644 src/openxml/drawing/CubicBezierCurveTo.ts create mode 100644 src/openxml/drawing/DefaultParagraphProperties.ts create mode 100644 src/openxml/drawing/EffectDag.ts create mode 100644 src/openxml/drawing/GroupFill.ts create mode 100644 src/openxml/drawing/LineTo.ts create mode 100644 src/openxml/drawing/MoveTo.ts create mode 100644 src/openxml/drawing/PathList.ts create mode 100644 src/openxml/drawing/Point.ts create mode 100644 src/openxml/drawing/QuadraticBezierCurveTo.ts create mode 100644 src/openxml/drawing/ShapeGuide.ts create mode 100644 src/openxml/drawing/ShapeGuideList.ts rename src/openxml/drawing/{_ColorDefinable.ts => _Color.ts} (93%) create mode 100644 src/openxml/drawing/_ParagraphProperties.ts create mode 100644 src/openxml/drawing/_Style.ts create mode 100644 src/openxml/presentation/ConnectionShape.ts create mode 100644 src/openxml/presentation/EmbeddedFont.ts create mode 100644 src/openxml/presentation/EmbeddedFontList.ts create mode 100644 src/openxml/presentation/Font.ts create mode 100644 src/openxml/presentation/GraphicFrame.ts create mode 100644 src/openxml/presentation/NonVisualConnectionShapeProperties.ts create mode 100644 src/openxml/presentation/_Properties.ts create mode 100644 src/openxml/presentation/_Slide.ts delete mode 100644 src/utils/tmeplate.ts delete mode 100644 src/utils/xml.ts diff --git a/src/openxml/drawing/AdjustHandleList.ts b/src/openxml/drawing/AdjustHandleList.ts new file mode 100644 index 0000000..3320f32 --- /dev/null +++ b/src/openxml/drawing/AdjustHandleList.ts @@ -0,0 +1,9 @@ +import { defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.adjusthandlelist + */ +@defineElement('a:ahLst') +export class AdjustHandleList extends OXML { + // TODO +} diff --git a/src/openxml/drawing/AdjustValueList.ts b/src/openxml/drawing/AdjustValueList.ts new file mode 100644 index 0000000..2dfce1d --- /dev/null +++ b/src/openxml/drawing/AdjustValueList.ts @@ -0,0 +1,10 @@ +import type { ShapeGuide } from './ShapeGuide' +import { defineChildren, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.adjustvaluelist + */ +@defineElement('a:avLst') +export class AdjustValueList extends OXML { + @defineChildren('a:gd') declare value: ShapeGuide[] +} diff --git a/src/openxml/drawing/ArcTo.ts b/src/openxml/drawing/ArcTo.ts new file mode 100644 index 0000000..332ab1b --- /dev/null +++ b/src/openxml/drawing/ArcTo.ts @@ -0,0 +1,12 @@ +import { defineAttribute, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.arcto + */ +@defineElement('a:arcTo') +export class ArcTo extends OXML { + @defineAttribute('hR', 'ST_AdjCoordinate') declare hR: number + @defineAttribute('wR', 'ST_AdjCoordinate') declare wR: number + @defineAttribute('stAng', 'ST_AdjAngle') declare stAng: number + @defineAttribute('swAng', 'ST_AdjAngle') declare swAng: number +} diff --git a/src/openxml/drawing/BackgroundColor.ts b/src/openxml/drawing/BackgroundColor.ts index a939b37..e3f6569 100644 --- a/src/openxml/drawing/BackgroundColor.ts +++ b/src/openxml/drawing/BackgroundColor.ts @@ -1,10 +1,10 @@ import { defineElement } from '../../core' -import { _ColorDefinable } from './_ColorDefinable' +import { _Color } from './_Color' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.backgroundcolor */ @defineElement('a:bgClr') -export class BackgroundColor extends _ColorDefinable { +export class BackgroundColor extends _Color { // } diff --git a/src/openxml/drawing/CloseShapePath.ts b/src/openxml/drawing/CloseShapePath.ts new file mode 100644 index 0000000..e16b1fa --- /dev/null +++ b/src/openxml/drawing/CloseShapePath.ts @@ -0,0 +1,9 @@ +import { defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.closeshapepath + */ +@defineElement('a:close') +export class CloseShapePath extends OXML { + // +} diff --git a/src/openxml/drawing/ConnectionSiteList.ts b/src/openxml/drawing/ConnectionSiteList.ts new file mode 100644 index 0000000..481e6b3 --- /dev/null +++ b/src/openxml/drawing/ConnectionSiteList.ts @@ -0,0 +1,9 @@ +import { defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.connectionsitelist + */ +@defineElement('a:cxnLst') +export class ConnectionSiteList extends OXML { + // TODO +} diff --git a/src/openxml/drawing/CubicBezierCurveTo.ts b/src/openxml/drawing/CubicBezierCurveTo.ts new file mode 100644 index 0000000..7d9a51e --- /dev/null +++ b/src/openxml/drawing/CubicBezierCurveTo.ts @@ -0,0 +1,10 @@ +import type { Point } from './Point' +import { defineChildren, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.cubicbeziercurveto + */ +@defineElement('a:cubicBezTo') +export class CubicBezierCurveTo extends OXML { + @defineChildren('a:pt') declare value: Point[] +} diff --git a/src/openxml/drawing/CustomGeometry.ts b/src/openxml/drawing/CustomGeometry.ts index 8b2fd5e..66c6d8e 100644 --- a/src/openxml/drawing/CustomGeometry.ts +++ b/src/openxml/drawing/CustomGeometry.ts @@ -1,4 +1,9 @@ +import type { AdjustHandleList } from './AdjustHandleList' +import type { AdjustValueList } from './AdjustValueList' +import type { ConnectionSiteList } from './ConnectionSiteList' +import type { PathList } from './PathList' import type { Rectangle } from './Rectangle' +import type { ShapeGuideList } from './ShapeGuideList' import { defineChild, defineElement, OXML } from '../../core' /** @@ -6,10 +11,10 @@ import { defineChild, defineElement, OXML } from '../../core' */ @defineElement('a:custGeom') export class CustomGeometry extends OXML { - @defineChild('a:ahLst') declare ahLst: OXML - @defineChild('a:avLst') declare avLst: OXML - @defineChild('a:cxnLst') declare cxnLst: OXML - @defineChild('a:gdLst') declare gdLst: OXML - @defineChild('a:pathLst') declare pathLst: OXML - @defineChild('a:rect') declare rect: Rectangle + @defineChild('a:ahLst') ahLst?: AdjustHandleList + @defineChild('a:avLst') avLst?: AdjustValueList + @defineChild('a:cxnLst') cxnLst?: ConnectionSiteList + @defineChild('a:gdLst') gdLst?: ShapeGuideList + @defineChild('a:pathLst') pathLst?: PathList + @defineChild('a:rect') rect?: Rectangle } diff --git a/src/openxml/drawing/DefaultParagraphProperties.ts b/src/openxml/drawing/DefaultParagraphProperties.ts new file mode 100644 index 0000000..a791f4b --- /dev/null +++ b/src/openxml/drawing/DefaultParagraphProperties.ts @@ -0,0 +1,10 @@ +import { defineElement } from '../../core' +import { _ParagraphProperties } from './_ParagraphProperties' + +/** + * @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.DefaultParagraphProperties + */ +@defineElement('a:defPPr') +export class DefaultParagraphProperties extends _ParagraphProperties { + // +} diff --git a/src/openxml/drawing/EffectDag.ts b/src/openxml/drawing/EffectDag.ts new file mode 100644 index 0000000..8b2c3e6 --- /dev/null +++ b/src/openxml/drawing/EffectDag.ts @@ -0,0 +1,9 @@ +import { defineElement, OXML } from '../../core' + +/** + * @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.effectdag + */ +@defineElement('a:effectDag') +export class EffectDag extends OXML { + // TODO +} diff --git a/src/openxml/drawing/EffectList.ts b/src/openxml/drawing/EffectList.ts index ee129fc..6a947d9 100644 --- a/src/openxml/drawing/EffectList.ts +++ b/src/openxml/drawing/EffectList.ts @@ -1,9 +1,17 @@ -import { defineElement, OXML } from '../../core' +import { defineChild, defineElement, OXML } from '../../core' /** * @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.effectlist */ @defineElement('a:effectLst') export class EffectList extends OXML { - // + // TODO + @defineChild('blur') blur?: OXML + @defineChild('fillOverlay') fillOverlay?: OXML + @defineChild('glow') glow?: OXML + @defineChild('innerShdw') innerShdw?: OXML + @defineChild('outerShdw') outerShdw?: OXML + @defineChild('prstShdw') prstShdw?: OXML + @defineChild('reflection') reflection?: OXML + @defineChild('softEdge') softEdge?: OXML } diff --git a/src/openxml/drawing/EffectReference.ts b/src/openxml/drawing/EffectReference.ts index 4bc2204..1ad7c78 100644 --- a/src/openxml/drawing/EffectReference.ts +++ b/src/openxml/drawing/EffectReference.ts @@ -1,10 +1,10 @@ import { defineAttribute, defineElement } from '../../core' -import { _ColorDefinable } from './_ColorDefinable' +import { _Color } from './_Color' /** * @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.effectreference */ @defineElement('a:effectRef') -export class EffectReference extends _ColorDefinable { +export class EffectReference extends _Color { @defineAttribute('idx') declare idx: string } diff --git a/src/openxml/drawing/Extension.ts b/src/openxml/drawing/Extension.ts index 663ec4b..846c73b 100644 --- a/src/openxml/drawing/Extension.ts +++ b/src/openxml/drawing/Extension.ts @@ -5,5 +5,5 @@ import { defineAttribute, defineElement, OXML } from '../../core' */ @defineElement('a:ext') export class Extension extends OXML { - @defineAttribute('uri', 'string') declare uri: string + @defineAttribute('uri') declare uri: string } diff --git a/src/openxml/drawing/FillRectangle.ts b/src/openxml/drawing/FillRectangle.ts index 87adbae..d729813 100644 --- a/src/openxml/drawing/FillRectangle.ts +++ b/src/openxml/drawing/FillRectangle.ts @@ -5,8 +5,8 @@ import { defineAttribute, defineElement, OXML } from '../../core' */ @defineElement('a:fillRect') export class FillRectangle extends OXML { - @defineAttribute('b', 'rate') declare b: number - @defineAttribute('l', 'rate') declare l: number - @defineAttribute('r', 'rate') declare r: number - @defineAttribute('t', 'rate') declare t: number + @defineAttribute('b', 'ST_Percentage') declare b: number + @defineAttribute('l', 'ST_Percentage') declare l: number + @defineAttribute('r', 'ST_Percentage') declare r: number + @defineAttribute('t', 'ST_Percentage') declare t: number } diff --git a/src/openxml/drawing/FillReference.ts b/src/openxml/drawing/FillReference.ts index e70596f..b2b0025 100644 --- a/src/openxml/drawing/FillReference.ts +++ b/src/openxml/drawing/FillReference.ts @@ -1,10 +1,10 @@ import { defineAttribute, defineElement } from '../../core' -import { _ColorDefinable } from './_ColorDefinable' +import { _Color } from './_Color' /** * @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.fillreference */ @defineElement('a:fillRef') -export class FillReference extends _ColorDefinable { +export class FillReference extends _Color { @defineAttribute('idx') declare idx: string } diff --git a/src/openxml/drawing/FontReference.ts b/src/openxml/drawing/FontReference.ts index 8ca0bf4..d3dd10d 100644 --- a/src/openxml/drawing/FontReference.ts +++ b/src/openxml/drawing/FontReference.ts @@ -1,10 +1,10 @@ import { defineAttribute, defineElement } from '../../core' -import { _ColorDefinable } from './_ColorDefinable' +import { _Color } from './_Color' /** * @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.fontreference */ @defineElement('a:fontRef') -export class FontReference extends _ColorDefinable { +export class FontReference extends _Color { @defineAttribute('idx') declare idx: string } diff --git a/src/openxml/drawing/ForegroundColor.ts b/src/openxml/drawing/ForegroundColor.ts index 4b14f7c..ace3c94 100644 --- a/src/openxml/drawing/ForegroundColor.ts +++ b/src/openxml/drawing/ForegroundColor.ts @@ -1,20 +1,10 @@ -import type { HslColor } from './HslColor' -import type { PresetColor } from './PresetColor' -import type { RgbColorModelHex } from './RgbColorModelHex' -import type { RgbColorModelPercentage } from './RgbColorModelPercentage' -import type { SchemeColor } from './SchemeColor' -import type { SystemColor } from './SystemColor' -import { defineChild, defineElement, OXML } from '../../core' +import { defineElement } from '../../core' +import { _Color } from './_Color' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.foregroundcolor */ @defineElement('a:fgClr') -export class ForegroundColor extends OXML { - @defineChild('a:hslClr') hslClr?: HslColor - @defineChild('a:prstClr') prstClr?: PresetColor - @defineChild('a:schemeClr') schemeClr?: SchemeColor - @defineChild('a:scrgbClr') scrgbClr?: RgbColorModelPercentage - @defineChild('a:srgbClr') srgbClr?: RgbColorModelHex - @defineChild('a:sysClr') sysClr?: SystemColor +export class ForegroundColor extends _Color { + // } diff --git a/src/openxml/drawing/GradientStop.ts b/src/openxml/drawing/GradientStop.ts index 7b32b94..9fab60e 100644 --- a/src/openxml/drawing/GradientStop.ts +++ b/src/openxml/drawing/GradientStop.ts @@ -1,10 +1,10 @@ import { defineAttribute, defineElement } from '../../core' -import { _ColorDefinable } from './_ColorDefinable' +import { _Color } from './_Color' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.GradientStop */ @defineElement('a:gs') -export class GradientStop extends _ColorDefinable { +export class GradientStop extends _Color { @defineAttribute('pos', 'positiveFixedPercentage') declare pos: number } diff --git a/src/openxml/drawing/GroupFill.ts b/src/openxml/drawing/GroupFill.ts new file mode 100644 index 0000000..5292c5a --- /dev/null +++ b/src/openxml/drawing/GroupFill.ts @@ -0,0 +1,9 @@ +import { defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.groupfill + */ +@defineElement('a:grpFill') +export class GroupFill extends OXML { + // +} diff --git a/src/openxml/drawing/HslColor.ts b/src/openxml/drawing/HslColor.ts index 3a9fd15..6380306 100644 --- a/src/openxml/drawing/HslColor.ts +++ b/src/openxml/drawing/HslColor.ts @@ -1,4 +1,5 @@ -import { defineAttribute, defineElement, OXML } from '../../core' +import type { Alpha } from './Alpha' +import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.hslcolor @@ -8,4 +9,6 @@ export class HslColor extends OXML { @defineAttribute('hue', 'positiveFixedAngle') declare hue: number @defineAttribute('sat', 'percentage') declare sat: number @defineAttribute('lum', 'percentage') declare lum: number + + @defineChild('a:alpha') alpha?: Alpha } diff --git a/src/openxml/drawing/LineReference.ts b/src/openxml/drawing/LineReference.ts index 8b812af..cff79f1 100644 --- a/src/openxml/drawing/LineReference.ts +++ b/src/openxml/drawing/LineReference.ts @@ -1,10 +1,10 @@ import { defineAttribute, defineElement } from '../../core' -import { _ColorDefinable } from './_ColorDefinable' +import { _Color } from './_Color' /** * @link https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.linereference */ @defineElement('a:lnRef') -export class LineReference extends _ColorDefinable { +export class LineReference extends _Color { @defineAttribute('idx') declare idx: string } diff --git a/src/openxml/drawing/LineTo.ts b/src/openxml/drawing/LineTo.ts new file mode 100644 index 0000000..462744c --- /dev/null +++ b/src/openxml/drawing/LineTo.ts @@ -0,0 +1,10 @@ +import type { Point } from './Point' +import { defineChild, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.lineto + */ +@defineElement('a:lnTo') +export class LineTo extends OXML { + @defineChild('a:pt') declare pt: Point +} diff --git a/src/openxml/drawing/ListStyle.ts b/src/openxml/drawing/ListStyle.ts index 99a20ad..3d2fad3 100644 --- a/src/openxml/drawing/ListStyle.ts +++ b/src/openxml/drawing/ListStyle.ts @@ -1,9 +1,10 @@ -import { defineElement, OXML } from '../../core' +import { defineElement } from '../../core' +import { _Style } from './_Style' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.liststyle */ @defineElement('a:lstStyle') -export class ListStyle extends OXML { +export class ListStyle extends _Style { // } diff --git a/src/openxml/drawing/MoveTo.ts b/src/openxml/drawing/MoveTo.ts new file mode 100644 index 0000000..0bff26f --- /dev/null +++ b/src/openxml/drawing/MoveTo.ts @@ -0,0 +1,10 @@ +import type { Point } from './Point' +import { defineChild, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.moveto + */ +@defineElement('a:moveTo') +export class MoveTo extends OXML { + @defineChild('a:pt') declare pt: Point +} diff --git a/src/openxml/drawing/Paragraph.ts b/src/openxml/drawing/Paragraph.ts index b17bac0..fe1775e 100644 --- a/src/openxml/drawing/Paragraph.ts +++ b/src/openxml/drawing/Paragraph.ts @@ -14,9 +14,9 @@ export class Paragraph extends OXML { @defineProperty('pPr.marL', 0) declare marginLeft: number @defineProperty('pPr.marR', 0) declare marginRight: number @defineProperty('pPr.indent', 0) declare textIndent: number + @defineProperty('pPr.lvl') level?: number + @defineProperty('pPr.fontAlgn') fontAlign?: string - get level(): number | undefined { return this.pPr.lvl } get textAlign(): TextAlignmentTypeValues | undefined { return this.pPr.algn } - get fontAlign(): string | undefined { return this.pPr.fontAlgn } get rightToLeft(): string | undefined { return this.pPr.rtl } } diff --git a/src/openxml/drawing/Path.ts b/src/openxml/drawing/Path.ts index f8d1548..f4f9c32 100644 --- a/src/openxml/drawing/Path.ts +++ b/src/openxml/drawing/Path.ts @@ -1,9 +1,39 @@ -import { defineElement, OXML } from '../../core' +import { defineAttribute, defineElement, OXML } from '../../core' +import { ArcTo } from './ArcTo' +import { CloseShapePath } from './CloseShapePath' +import { CubicBezierCurveTo } from './CubicBezierCurveTo' +import { LineTo } from './LineTo' +import { MoveTo } from './MoveTo' +import { QuadraticBezierCurveTo } from './QuadraticBezierCurveTo' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.path */ @defineElement('a:path') export class Path extends OXML { - // + @defineAttribute('extrusionOk', 'boolean') extrusionOk?: boolean + @defineAttribute('fill', 'boolean') fill?: boolean + @defineAttribute('stroke', 'boolean') stroke?: boolean + @defineAttribute('w', 'ST_PositiveCoordinate') declare w: number + @defineAttribute('h', 'ST_PositiveCoordinate') declare h: number + + get commands() { + return Array.from(this.element.children).map((element) => { + switch (element.tagName) { + case 'a:arcTo': + return new ArcTo().fromElement(element) + case 'a:close': + return new CloseShapePath().fromElement(element) + case 'a:lnTo': + return new LineTo().fromElement(element) + case 'a:cubicBezTo': + return new CubicBezierCurveTo().fromElement(element) + case 'a:quadBezTo': + return new QuadraticBezierCurveTo().fromElement(element) + case 'a:moveTo': + default: + return new MoveTo().fromElement(element) + } + }) + } } diff --git a/src/openxml/drawing/PathList.ts b/src/openxml/drawing/PathList.ts new file mode 100644 index 0000000..8cd5d4c --- /dev/null +++ b/src/openxml/drawing/PathList.ts @@ -0,0 +1,10 @@ +import type { Path } from './Path' +import { defineChildren, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.pathlist + */ +@defineElement('a:pathLst') +export class PathList extends OXML { + @defineChildren('a:path') declare value: Path[] +} diff --git a/src/openxml/drawing/Point.ts b/src/openxml/drawing/Point.ts new file mode 100644 index 0000000..55eb630 --- /dev/null +++ b/src/openxml/drawing/Point.ts @@ -0,0 +1,10 @@ +import { defineAttribute, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.point + */ +@defineElement('a:pt') +export class Point extends OXML { + @defineAttribute('x', 'ST_AdjCoordinate') declare x: number + @defineAttribute('y', 'ST_AdjCoordinate') declare y: number +} diff --git a/src/openxml/drawing/PresetColor.ts b/src/openxml/drawing/PresetColor.ts index 1b2949c..7d3cc63 100644 --- a/src/openxml/drawing/PresetColor.ts +++ b/src/openxml/drawing/PresetColor.ts @@ -1,4 +1,5 @@ -import { defineAttribute, defineElement, OXML } from '../../core' +import type { Alpha } from './Alpha' +import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.presetcolor @@ -6,4 +7,6 @@ import { defineAttribute, defineElement, OXML } from '../../core' @defineElement('a:prstClr') export class PresetColor extends OXML { @defineAttribute('val') declare val: string + + @defineChild('a:alpha') alpha?: Alpha } diff --git a/src/openxml/drawing/PresetGeometry.ts b/src/openxml/drawing/PresetGeometry.ts index c9abbbe..06c0071 100644 --- a/src/openxml/drawing/PresetGeometry.ts +++ b/src/openxml/drawing/PresetGeometry.ts @@ -1,9 +1,11 @@ -import { defineAttribute, defineElement, OXML } from '../../core' +import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** - * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.presetgeometry + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.presetgeometry */ @defineElement('a:prstGeom') export class PresetGeometry extends OXML { @defineAttribute('prst') declare prst: string + + @defineChild('a:avLst') avLst?: OXML } diff --git a/src/openxml/drawing/QuadraticBezierCurveTo.ts b/src/openxml/drawing/QuadraticBezierCurveTo.ts new file mode 100644 index 0000000..8583011 --- /dev/null +++ b/src/openxml/drawing/QuadraticBezierCurveTo.ts @@ -0,0 +1,10 @@ +import type { Point } from './Point' +import { defineChildren, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.quadraticbeziercurveto + */ +@defineElement('a:quadBezTo') +export class QuadraticBezierCurveTo extends OXML { + @defineChildren('a:pt') declare value: Point[] +} diff --git a/src/openxml/drawing/Rectangle.ts b/src/openxml/drawing/Rectangle.ts index f897638..e241b11 100644 --- a/src/openxml/drawing/Rectangle.ts +++ b/src/openxml/drawing/Rectangle.ts @@ -5,8 +5,8 @@ import { defineAttribute, defineElement, OXML } from '../../core' */ @defineElement('a:rect') export class Rectangle extends OXML { - @defineAttribute('b', 'adjCoordinate') declare b: number - @defineAttribute('l', 'adjCoordinate') declare l: number - @defineAttribute('r', 'adjCoordinate') declare r: number - @defineAttribute('t', 'adjCoordinate') declare t: number + @defineAttribute('b', 'ST_AdjCoordinate') declare b: number + @defineAttribute('l', 'ST_AdjCoordinate') declare l: number + @defineAttribute('t', 'ST_AdjCoordinate') declare t: number + @defineAttribute('r', 'ST_AdjCoordinate') declare r: number } diff --git a/src/openxml/drawing/RgbColorModelHex.ts b/src/openxml/drawing/RgbColorModelHex.ts index 239ad3f..e948b6d 100644 --- a/src/openxml/drawing/RgbColorModelHex.ts +++ b/src/openxml/drawing/RgbColorModelHex.ts @@ -1,4 +1,5 @@ -import { defineAttribute, defineElement, OXML } from '../../core' +import type { Alpha } from './Alpha' +import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.rgbcolormodelhex @@ -6,4 +7,6 @@ import { defineAttribute, defineElement, OXML } from '../../core' @defineElement('a:srgbClr') export class RgbColorModelHex extends OXML { @defineAttribute('val') declare val: string + + @defineChild('a:alpha') alpha?: Alpha } diff --git a/src/openxml/drawing/RgbColorModelPercentage.ts b/src/openxml/drawing/RgbColorModelPercentage.ts index e14b2c5..3abe991 100644 --- a/src/openxml/drawing/RgbColorModelPercentage.ts +++ b/src/openxml/drawing/RgbColorModelPercentage.ts @@ -1,4 +1,5 @@ -import { defineAttribute, defineElement, OXML } from '../../core' +import type { Alpha } from './Alpha' +import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.rgbcolormodelpercentage @@ -8,4 +9,6 @@ export class RgbColorModelPercentage extends OXML { @defineAttribute('r', 'percentage') declare r: number @defineAttribute('g', 'percentage') declare g: number @defineAttribute('b', 'percentage') declare b: number + + @defineChild('a:alpha') alpha?: Alpha } diff --git a/src/openxml/drawing/RunProperties.ts b/src/openxml/drawing/RunProperties.ts index 707c051..a5ea0dc 100644 --- a/src/openxml/drawing/RunProperties.ts +++ b/src/openxml/drawing/RunProperties.ts @@ -2,20 +2,34 @@ import type { SolidFill } from './SolidFill' import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** - * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.run + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.runproperties */ @defineElement('a:rPr') export class RunProperties extends OXML { + @defineAttribute('altLang') altLang?: string + @defineAttribute('baseline') baseline?: string @defineAttribute('b', 'boolean') b?: boolean + @defineAttribute('bmk') bmk?: string + @defineAttribute('cap') cap?: string + @defineAttribute('dirty') dirty?: string + @defineAttribute('sz', 'fontSize') sz?: number @defineAttribute('i', 'boolean') i?: boolean - @defineAttribute('u') u?: string @defineAttribute('kern', 'emu') kern?: string + @defineAttribute('kumimoji') kumimoji?: string + @defineAttribute('lang') lang?: string + @defineAttribute('noProof') noProof?: string + @defineAttribute('normalizeH') normalizeH?: string + @defineAttribute('Outline') Outline?: string + @defineAttribute('smtClean') smtClean?: string + @defineAttribute('smtId') smtId?: string @defineAttribute('spc', 'fontSize') spc?: number - @defineAttribute('sz', 'fontSize') sz?: number + @defineAttribute('err') err?: string + @defineAttribute('strike') strike?: string + @defineAttribute('u') u?: string - @defineChild('cs') cs?: OXML - @defineChild('ea') ea?: OXML - @defineChild('latin') latin?: OXML - @defineChild('sym') sym?: OXML + @defineChild('a:cs') cs?: OXML + @defineChild('a:ea') ea?: OXML + @defineChild('a:latin') latin?: OXML + @defineChild('a:sym') sym?: OXML @defineChild('a:solidFill') solidFill?: SolidFill } diff --git a/src/openxml/drawing/SchemeColor.ts b/src/openxml/drawing/SchemeColor.ts index ce67767..9daff13 100644 --- a/src/openxml/drawing/SchemeColor.ts +++ b/src/openxml/drawing/SchemeColor.ts @@ -1,4 +1,5 @@ -import { defineAttribute, defineElement, OXML } from '../../core' +import type { Alpha } from './Alpha' +import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.schemecolor @@ -6,4 +7,6 @@ import { defineAttribute, defineElement, OXML } from '../../core' @defineElement('a:schemeClr') export class SchemeColor extends OXML { @defineAttribute('val') declare val: string + + @defineChild('a:alpha') alpha?: Alpha } diff --git a/src/openxml/drawing/ShapeGuide.ts b/src/openxml/drawing/ShapeGuide.ts new file mode 100644 index 0000000..47ae343 --- /dev/null +++ b/src/openxml/drawing/ShapeGuide.ts @@ -0,0 +1,10 @@ +import { defineAttribute, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.shapeguide + */ +@defineElement('a:gd') +export class ShapeGuide extends OXML { + @defineAttribute('name') declare name: string + @defineAttribute('fmla') declare fmla: string +} diff --git a/src/openxml/drawing/ShapeGuideList.ts b/src/openxml/drawing/ShapeGuideList.ts new file mode 100644 index 0000000..a1ade64 --- /dev/null +++ b/src/openxml/drawing/ShapeGuideList.ts @@ -0,0 +1,10 @@ +import type { ShapeGuide } from './ShapeGuide' +import { defineChildren, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.shapeguidelist + */ +@defineElement('a:gdLst') +export class ShapeGuideList extends OXML { + @defineChildren('a:gd') declare value: ShapeGuide[] +} diff --git a/src/openxml/drawing/SolidFill.ts b/src/openxml/drawing/SolidFill.ts index a4c196c..1181d37 100644 --- a/src/openxml/drawing/SolidFill.ts +++ b/src/openxml/drawing/SolidFill.ts @@ -1,10 +1,10 @@ import { defineElement } from '../../core' -import { _ColorDefinable } from './_ColorDefinable' +import { _Color } from './_Color' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.solidfill */ @defineElement('a:solidFill') -export class SolidFill extends _ColorDefinable { +export class SolidFill extends _Color { // } diff --git a/src/openxml/drawing/SourceRectangle.ts b/src/openxml/drawing/SourceRectangle.ts index 72eb1ff..f85d998 100644 --- a/src/openxml/drawing/SourceRectangle.ts +++ b/src/openxml/drawing/SourceRectangle.ts @@ -1,12 +1,12 @@ import { defineAttribute, defineElement, OXML } from '../../core' /** - * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.sourcerectangle + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.sourcerectangle */ @defineElement('a:srcRect') export class SourceRectangle extends OXML { - @defineAttribute('b', 'rate') declare b: number - @defineAttribute('l', 'rate') declare l: number - @defineAttribute('r', 'rate') declare r: number - @defineAttribute('t', 'rate') declare t: number + @defineAttribute('b', 'ST_Percentage') declare b: number + @defineAttribute('l', 'ST_Percentage') declare l: number + @defineAttribute('t', 'ST_Percentage') declare t: number + @defineAttribute('r', 'ST_Percentage') declare r: number } diff --git a/src/openxml/drawing/SystemColor.ts b/src/openxml/drawing/SystemColor.ts index f7b935c..61226d5 100644 --- a/src/openxml/drawing/SystemColor.ts +++ b/src/openxml/drawing/SystemColor.ts @@ -1,4 +1,5 @@ -import { defineAttribute, defineElement, OXML } from '../../core' +import type { Alpha } from './Alpha' +import { defineAttribute, defineChild, defineElement, OXML } from '../../core' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.systemcolor @@ -6,4 +7,6 @@ import { defineAttribute, defineElement, OXML } from '../../core' @defineElement('a:sysClr') export class SystemColor extends OXML { @defineAttribute('val') declare val: string + + @defineChild('a:alpha') alpha?: Alpha } diff --git a/src/openxml/drawing/Tile.ts b/src/openxml/drawing/Tile.ts index dfa1cde..629c760 100644 --- a/src/openxml/drawing/Tile.ts +++ b/src/openxml/drawing/Tile.ts @@ -5,10 +5,10 @@ import { defineAttribute, defineElement, OXML } from '../../core' */ @defineElement('a:tile') export class Tile extends OXML { - @defineAttribute('sx', 'rate') declare sx: number - @defineAttribute('sy', 'rate') declare sy: number - @defineAttribute('tx', 'rate') declare tx: number - @defineAttribute('ty', 'rate') declare ty: number - @defineAttribute('algn') declare algn: string - @defineAttribute('flip') declare flip: string + @defineAttribute('sx', 'ST_Percentage') declare sx: number + @defineAttribute('sy', 'ST_Percentage') declare sy: number + @defineAttribute('tx', 'ST_Coordinate') declare tx: number + @defineAttribute('ty', 'ST_Coordinate') declare ty: number + @defineAttribute('algn', 'ST_RectAlignment') declare algn: string + @defineAttribute('flip', 'ST_TileFlipMode') declare flip: string } diff --git a/src/openxml/drawing/TileRectangle.ts b/src/openxml/drawing/TileRectangle.ts index 5154eb1..538bd15 100644 --- a/src/openxml/drawing/TileRectangle.ts +++ b/src/openxml/drawing/TileRectangle.ts @@ -1,12 +1,12 @@ import { defineAttribute, defineElement, OXML } from '../../core' /** - * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.transform2d + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.drawing.tilerectangle */ @defineElement('a:tileRect') export class TileRectangle extends OXML { - @defineAttribute('b', 'percentage') declare b: number - @defineAttribute('l', 'percentage') declare l: number - @defineAttribute('t', 'percentage') declare t: number - @defineAttribute('r', 'percentage') declare r: number + @defineAttribute('b', 'ST_Percentage') declare b: number + @defineAttribute('l', 'ST_Percentage') declare l: number + @defineAttribute('t', 'ST_Percentage') declare t: number + @defineAttribute('r', 'ST_Percentage') declare r: number } diff --git a/src/openxml/drawing/_ColorDefinable.ts b/src/openxml/drawing/_Color.ts similarity index 93% rename from src/openxml/drawing/_ColorDefinable.ts rename to src/openxml/drawing/_Color.ts index 1a46e8a..b04ac70 100644 --- a/src/openxml/drawing/_ColorDefinable.ts +++ b/src/openxml/drawing/_Color.ts @@ -6,7 +6,7 @@ import type { SchemeColor } from './SchemeColor' import type { SystemColor } from './SystemColor' import { defineChild, OXML } from '../../core' -export class _ColorDefinable extends OXML { +export class _Color extends OXML { @defineChild('a:hslClr') hslClr?: HslColor @defineChild('a:prstClr') prstClr?: PresetColor @defineChild('a:schemeClr') schemeClr?: SchemeColor diff --git a/src/openxml/drawing/_ParagraphProperties.ts b/src/openxml/drawing/_ParagraphProperties.ts new file mode 100644 index 0000000..43432ce --- /dev/null +++ b/src/openxml/drawing/_ParagraphProperties.ts @@ -0,0 +1,5 @@ +import { OXML } from '../../core' + +export class _ParagraphProperties extends OXML { + // +} diff --git a/src/openxml/drawing/_Style.ts b/src/openxml/drawing/_Style.ts new file mode 100644 index 0000000..b37c82a --- /dev/null +++ b/src/openxml/drawing/_Style.ts @@ -0,0 +1,17 @@ +import type { DefaultParagraphProperties } from './DefaultParagraphProperties' +import type { ExtensionList } from './ExtensionList' +import { defineChild, OXML } from '../../core' + +export class _Style extends OXML { + @defineChild('a:defPPr') defPPr?: DefaultParagraphProperties + @defineChild('a:extLst') extLst?: ExtensionList + @defineChild('a:lvl1pPr') lvl1pPr?: OXML + @defineChild('a:lvl2pPr') lvl2pPr?: OXML + @defineChild('a:lvl3pPr') lvl3pPr?: OXML + @defineChild('a:lvl4pPr') lvl4pPr?: OXML + @defineChild('a:lvl5pPr') lvl5pPr?: OXML + @defineChild('a:lvl6pPr') lvl6pPr?: OXML + @defineChild('a:lvl7pPr') lvl7pPr?: OXML + @defineChild('a:lvl8pPr') lvl8pPr?: OXML + @defineChild('a:lvl9pPr') lvl9pPr?: OXML +} diff --git a/src/openxml/drawing/index.ts b/src/openxml/drawing/index.ts index 64592b1..fbbded9 100644 --- a/src/openxml/drawing/index.ts +++ b/src/openxml/drawing/index.ts @@ -1,3 +1,9 @@ +export * from './_Color' +export * from './_ParagraphProperties' +export * from './_Style' +export * from './AdjustHandleList' +export * from './AdjustValueList' +export * from './ArcTo' export * from './AudioFromFile' export * from './BackgroundColor' export * from './Blip' @@ -5,7 +11,11 @@ export * from './BlipFill' export * from './BodyProperties' export * from './ChildExtents' export * from './ChildOffset' +export * from './CloseShapePath' +export * from './ConnectionSiteList' +export * from './CubicBezierCurveTo' export * from './CustomGeometry' +export * from './EffectDag' export * from './EffectList' export * from './EffectReference' export * from './Extension' @@ -17,9 +27,11 @@ export * from './ForegroundColor' export * from './GradientFill' export * from './GradientStop' export * from './GradientStopList' +export * from './GroupFill' export * from './HslColor' export * from './LinearGradientFill' export * from './LineReference' +export * from './LineTo' export * from './ListStyle' export * from './MasterColorMapping' export * from './NoFill' @@ -28,13 +40,17 @@ export * from './Outline' export * from './Paragraph' export * from './ParagraphProperties' export * from './Path' +export * from './PathList' export * from './PatternFill' export * from './PresetColor' export * from './PresetGeometry' +export * from './QuadraticBezierCurveTo' export * from './Rectangle' export * from './RgbColorModelHex' export * from './Run' export * from './RunProperties' +export * from './ShapeGuide' +export * from './ShapeGuideList' export * from './SolidFill' export * from './SourceRectangle' export * from './Stretch' diff --git a/src/openxml/presentation/ApplicationNonVisualDrawingProperties.ts b/src/openxml/presentation/ApplicationNonVisualDrawingProperties.ts index 1b84ec8..195689a 100644 --- a/src/openxml/presentation/ApplicationNonVisualDrawingProperties.ts +++ b/src/openxml/presentation/ApplicationNonVisualDrawingProperties.ts @@ -11,8 +11,8 @@ export class ApplicationNonVisualDrawingProperties extends OXML { @defineChild('a:audioFile') audioFile?: AudioFromFile @defineChild('a:custDataLst') custDataLst?: OXML @defineChild('a:extLst') extLst?: ExtensionList - @defineChild('p:ph') declare ph: PlaceholderShape - @defineChild('quickTimeFile') declare quickTimeFile: OXML + @defineChild('p:ph') ph?: PlaceholderShape + @defineChild('quickTimeFile') quickTimeFile?: OXML @defineChild('a:videoFile') videoFile?: VideoFromFile @defineChild('a:wavAudioFile') wavAudioFile?: OXML } diff --git a/src/openxml/presentation/BackgroundProperties.ts b/src/openxml/presentation/BackgroundProperties.ts index 5cc4795..36bc57c 100644 --- a/src/openxml/presentation/BackgroundProperties.ts +++ b/src/openxml/presentation/BackgroundProperties.ts @@ -1,18 +1,10 @@ -import type { EffectList, GradientFill, NoFill, PatternFill, SolidFill } from '../drawing' -import { defineChild, defineElement, OXML } from '../../core' +import { defineElement } from '../../core' +import { _Properties } from './_Properties' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.backgroundproperties */ @defineElement('p:bgPr') -export class BackgroundProperties extends OXML { - @defineChild('a:blipFill') declare blipFill: OXML - @defineChild('a:effectDag') declare effectDag: OXML - @defineChild('a:effectLst') declare effectLst: EffectList - @defineChild('a:extLst') declare extLst: OXML - @defineChild('a:gradFill') declare gradFill: GradientFill - @defineChild('a:grpFill') declare grpFill: OXML - @defineChild('a:noFill') declare noFill: NoFill - @defineChild('a:pattFill') declare pattFill: PatternFill - @defineChild('a:solidFill') declare solidFill: SolidFill +export class BackgroundProperties extends _Properties { + // } diff --git a/src/openxml/presentation/ColorMap.ts b/src/openxml/presentation/ColorMap.ts index 91492e8..3ac8907 100644 --- a/src/openxml/presentation/ColorMap.ts +++ b/src/openxml/presentation/ColorMap.ts @@ -1,17 +1,20 @@ -import { defineElement, OXML } from '../../core' +import { defineAttribute, defineElement, OXML } from '../../core' +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.colormap + */ @defineElement('p:clrMap') export class ColorMap extends OXML { - // parse(node: VNode | undefined) { - // if (!node) - // return undefined - // const el = node.getEl() - // const length = el.attributes.length - // const map: Record = {} - // for (let i = 0; i < length; i++) { - // const attr = el.attributes.item(i)! - // map[attr.name] = attr.value - // } - // return map - // } + @defineAttribute('accent1') accent1?: string + @defineAttribute('accent2') accent2?: string + @defineAttribute('accent3') accent3?: string + @defineAttribute('accent4') accent4?: string + @defineAttribute('accent5') accent5?: string + @defineAttribute('accent6') accent6?: string + @defineAttribute('bg1') bg1?: string + @defineAttribute('bg2') bg2?: string + @defineAttribute('folHlink') folHlink?: string + @defineAttribute('hlink') hlink?: string + @defineAttribute('tx1') tx1?: string + @defineAttribute('tx2') tx2?: string } diff --git a/src/openxml/presentation/CommonSlideData.ts b/src/openxml/presentation/CommonSlideData.ts index 14e887b..85b8e1e 100644 --- a/src/openxml/presentation/CommonSlideData.ts +++ b/src/openxml/presentation/CommonSlideData.ts @@ -7,6 +7,6 @@ import { defineChild, defineElement, OXML } from '../../core' */ @defineElement('p:cSld') export class CommonSlideData extends OXML { - @defineChild('p:bg') declare bg: Background + @defineChild('p:bg') bg?: Background @defineChild('p:spTree') declare spTree: ShapeTree } diff --git a/src/openxml/presentation/ConnectionShape.ts b/src/openxml/presentation/ConnectionShape.ts new file mode 100644 index 0000000..a1ef4b5 --- /dev/null +++ b/src/openxml/presentation/ConnectionShape.ts @@ -0,0 +1,16 @@ +import type { ExtensionList } from './ExtensionList' +import type { NonVisualConnectionShapeProperties } from './NonVisualConnectionShapeProperties' +import type { ShapeProperties } from './ShapeProperties' +import type { ShapeStyle } from './ShapeStyle' +import { defineChild, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.connectionshape + */ +@defineElement('p:cxnSp') +export class ConnectionShape extends OXML { + @defineChild('p:extLst') extLst?: ExtensionList + @defineChild('p:nvCxnSpPr') declare nvCxnSpPr: NonVisualConnectionShapeProperties + @defineChild('p:spPr') declare spPr: ShapeProperties + @defineChild('p:style') style?: ShapeStyle +} diff --git a/src/openxml/presentation/DefaultTextStyle.ts b/src/openxml/presentation/DefaultTextStyle.ts index a11a4e8..03e8159 100644 --- a/src/openxml/presentation/DefaultTextStyle.ts +++ b/src/openxml/presentation/DefaultTextStyle.ts @@ -1,10 +1,10 @@ -import { defineElement, OXML } from '../../core' +import { defineElement } from '../../core' +import { _Style } from '../drawing' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.defaulttextstyle */ @defineElement('p:defaultTextStyle') -export class DefaultTextStyle extends OXML { - // TODO - // a:lvl1pPr - a:lvl9pPr +export class DefaultTextStyle extends _Style { + // } diff --git a/src/openxml/presentation/EmbeddedFont.ts b/src/openxml/presentation/EmbeddedFont.ts new file mode 100644 index 0000000..858f9ef --- /dev/null +++ b/src/openxml/presentation/EmbeddedFont.ts @@ -0,0 +1,14 @@ +import type { Font } from './Font' +import { defineChild, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.embeddedfont + */ +@defineElement('p:embeddedFont') +export class EmbeddedFont extends OXML { + @defineChild('p:bold') bold?: OXML + @defineChild('p:boldItalic') boldItalic?: OXML + @defineChild('p:font') declare font: Font + @defineChild('p:italic') italic?: OXML + @defineChild('p:regular') regular?: OXML +} diff --git a/src/openxml/presentation/EmbeddedFontList.ts b/src/openxml/presentation/EmbeddedFontList.ts new file mode 100644 index 0000000..611b9d1 --- /dev/null +++ b/src/openxml/presentation/EmbeddedFontList.ts @@ -0,0 +1,10 @@ +import type { EmbeddedFont } from './EmbeddedFont' +import { defineChildren, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.embeddedfontlist + */ +@defineElement('p:embeddedFontLst') +export class EmbeddedFontList extends OXML { + @defineChildren('p:embeddedFont') declare value: EmbeddedFont[] +} diff --git a/src/openxml/presentation/ExtensionList.ts b/src/openxml/presentation/ExtensionList.ts index 4612a92..c0a4f0c 100644 --- a/src/openxml/presentation/ExtensionList.ts +++ b/src/openxml/presentation/ExtensionList.ts @@ -6,5 +6,5 @@ import { defineChildren, defineElement, OXML } from '../../core' */ @defineElement('p:extLst') export class ExtensionList extends OXML { - @defineChildren('p:ext') declare extList: Extension[] + @defineChildren('p:ext') declare value: Extension[] } diff --git a/src/openxml/presentation/Font.ts b/src/openxml/presentation/Font.ts new file mode 100644 index 0000000..24e8613 --- /dev/null +++ b/src/openxml/presentation/Font.ts @@ -0,0 +1,12 @@ +import { defineAttribute, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.font + */ +@defineElement('p:font') +export class Font extends OXML { + @defineAttribute('charset') charset?: string + @defineAttribute('panose') panose?: string + @defineAttribute('pitchFamily') pitchFamily?: string + @defineAttribute('typeface') typeface?: string +} diff --git a/src/openxml/presentation/GraphicFrame.ts b/src/openxml/presentation/GraphicFrame.ts new file mode 100644 index 0000000..a3fb249 --- /dev/null +++ b/src/openxml/presentation/GraphicFrame.ts @@ -0,0 +1,14 @@ +import type { Transform2D } from '../drawing' +import type { ExtensionList } from './ExtensionList' +import { defineChild, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.graphicframe + */ +@defineElement('p:graphicFrame') +export class GraphicFrame extends OXML { + @defineChild('p:extLst') extLst?: ExtensionList + @defineChild('a:graphic') graphic?: OXML + @defineChild('p:nvGraphicFramePr') declare nvGraphicFramePr: OXML + @defineChild('p:xfrm') declare xfrm: Transform2D +} diff --git a/src/openxml/presentation/GroupShapeProperties.ts b/src/openxml/presentation/GroupShapeProperties.ts index 42e0ed8..3e93bd2 100644 --- a/src/openxml/presentation/GroupShapeProperties.ts +++ b/src/openxml/presentation/GroupShapeProperties.ts @@ -1,21 +1,13 @@ -import type { BlipFill, EffectList, GradientFill, NoFill, PatternFill, SolidFill, Transform2D } from '../drawing' -import type { ExtensionList } from './ExtensionList' -import { defineChild, defineElement, OXML } from '../../core' +import type { OXML } from '../../core' +import type { Transform2D } from '../drawing' +import { defineChild, defineElement } from '../../core' +import { _Properties } from './_Properties' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.groupshapeproperties */ @defineElement('p:grpSpPr') -export class GroupShapeProperties extends OXML { - @defineChild('a:blipFill') blipFill?: BlipFill - @defineChild('a:effectDag') effectDag?: OXML - @defineChild('a:effectLst') effectLst?: EffectList - @defineChild('p:extLst') extLst?: ExtensionList - @defineChild('a:gradFill') gradFill?: GradientFill - @defineChild('a:grpFill') grpFill?: OXML - @defineChild('a:noFill') noFill?: NoFill - @defineChild('a:pattFill') pattFill?: PatternFill +export class GroupShapeProperties extends _Properties { @defineChild('a:scene3d') scene3d?: OXML - @defineChild('a:solidFill') solidFill?: SolidFill @defineChild('a:xfrm') xfrm?: Transform2D } diff --git a/src/openxml/presentation/NonVisualConnectionShapeProperties.ts b/src/openxml/presentation/NonVisualConnectionShapeProperties.ts new file mode 100644 index 0000000..58244fe --- /dev/null +++ b/src/openxml/presentation/NonVisualConnectionShapeProperties.ts @@ -0,0 +1,13 @@ +import type { ApplicationNonVisualDrawingProperties } from './ApplicationNonVisualDrawingProperties' +import type { NonVisualDrawingProperties } from './NonVisualDrawingProperties' +import { defineChild, defineElement, OXML } from '../../core' + +/** + * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.nonvisualconnectionshapeproperties + */ +@defineElement('p:nvCxnSpPr') +export class NonVisualConnectionShapeProperties extends OXML { + @defineChild('p:cNvCxnSpPr') declare cNvCxnSpPr: OXML + @defineChild('p:cNvPr') declare cNvPr: NonVisualDrawingProperties + @defineChild('p:nvPr') declare nvPr: ApplicationNonVisualDrawingProperties +} diff --git a/src/openxml/presentation/PlaceholderShape.ts b/src/openxml/presentation/PlaceholderShape.ts index 386cffb..1478f9f 100644 --- a/src/openxml/presentation/PlaceholderShape.ts +++ b/src/openxml/presentation/PlaceholderShape.ts @@ -6,5 +6,5 @@ import { defineAttribute, defineElement, OXML } from '../../core' @defineElement('p:ph') export class PlaceholderShape extends OXML { @defineAttribute('type') type?: string - @defineAttribute('idx', 'number') idx?: number + @defineAttribute('idx') idx?: string } diff --git a/src/openxml/presentation/Presentation.ts b/src/openxml/presentation/Presentation.ts index eb32493..4e21f00 100644 --- a/src/openxml/presentation/Presentation.ts +++ b/src/openxml/presentation/Presentation.ts @@ -1,4 +1,5 @@ import type { DefaultTextStyle } from './DefaultTextStyle' +import type { EmbeddedFontList } from './EmbeddedFontList' import type { NotesSize } from './NotesSize' import type { SlideIdList } from './SlideIdList' import type { SlideMasterIdList } from './SlideMasterIdList' @@ -20,9 +21,19 @@ export class Presentation extends OXML { 'conformance': 'transitional', } - @defineChild('sldMasterIdLst') declare sldMasterIdLst: SlideMasterIdList - @defineChild('sldIdLst') declare sldIdLst: SlideIdList - @defineChild('sldSz') declare sldSz: SlideSize - @defineChild('notesSz') declare notesSz: NotesSize - @defineChild('defaultTextStyle') declare defaultTextStyle: DefaultTextStyle + @defineChild('p:custDataLst') custDataLst?: OXML + @defineChild('p:custShowLst') custShowLst?: OXML + @defineChild('p:defaultTextStyle') declare defaultTextStyle: DefaultTextStyle + @defineChild('p:embeddedFontLst') embeddedFontLst?: EmbeddedFontList + @defineChild('p:extLst') extLst?: OXML + @defineChild('p:handoutMasterIdLst') handoutMasterIdLst?: OXML + @defineChild('p:kinsoku') kinsoku?: OXML + @defineChild('p:modifyVerifier') modifyVerifier?: OXML + @defineChild('p:notesMasterIdLst') notesMasterIdLst?: OXML + @defineChild('p:notesSz') notesSz?: NotesSize + @defineChild('p:photoAlbum') photoAlbum?: OXML + @defineChild('p:sldIdLst') declare sldIdLst: SlideIdList + @defineChild('p:sldMasterIdLst') declare sldMasterIdLst: SlideMasterIdList + @defineChild('p:sldSz') declare sldSz: SlideSize + @defineChild('p:smartTags') smartTags?: OXML } diff --git a/src/openxml/presentation/Shape.ts b/src/openxml/presentation/Shape.ts index 5566aff..9efc6ce 100644 --- a/src/openxml/presentation/Shape.ts +++ b/src/openxml/presentation/Shape.ts @@ -15,11 +15,11 @@ export class Shape extends OXML { @defineChild('p:nvSpPr') declare nvSpPr: NonVisualShapeProperties @defineChild('p:spPr') declare spPr: ShapeProperties @defineChild('p:txBody') declare txBody: TextBody - @defineChild('p:style') declare style: ShapeStyle + @defineChild('p:style') style?: ShapeStyle - @defineProperty('nvSpPr.cNvPr.id') declare id: string - @defineProperty('nvSpPr.cNvPr.name') declare name: string - @defineProperty('nvSpPr.nvPr.ph') declare placeholder: PlaceholderShape + @defineProperty('nvSpPr.cNvPr.id') id?: string + @defineProperty('nvSpPr.cNvPr.name') name?: string + @defineProperty('nvSpPr.nvPr.ph') placeholder?: PlaceholderShape @defineProperty('nvSpPr.cNvSpPr.txBox') declare isTextBox: boolean @defineProperty('spPr.xfrm.off.x') declare left: number @defineProperty('spPr.xfrm.off.y') declare top: number @@ -40,4 +40,8 @@ export class Shape extends OXML { get textAlign(): string | undefined { return this.txBody.bodyPr.anchorCtr ? 'center' : undefined } get useParagraphSpacing(): boolean { return !!this.txBody.bodyPr.spcFirstLastPara } get writingMode(): 'vertical-lr' | 'horizontal-tb' { return this.txBody.bodyPr.upright ? 'vertical-lr' : 'horizontal-tb' } + + get geometry() { + return this.spPr.prstGeom + } } diff --git a/src/openxml/presentation/ShapeProperties.ts b/src/openxml/presentation/ShapeProperties.ts index cf405ed..87670d9 100644 --- a/src/openxml/presentation/ShapeProperties.ts +++ b/src/openxml/presentation/ShapeProperties.ts @@ -1,36 +1,22 @@ +import type { OXML } from '../../core' import type { - BlipFill, CustomGeometry, - EffectList, - ExtensionList, - GradientFill, - NoFill, Outline, - PatternFill, PresetGeometry, - SolidFill, Transform2D, } from '../drawing' -import { defineChild, defineElement, OXML } from '../../core' +import { defineChild, defineElement } from '../../core' +import { _Properties } from './_Properties' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.shapeproperties */ @defineElement('p:spPr') -export class ShapeProperties extends OXML { - @defineChild('a:blipFill') blipFill?: BlipFill +export class ShapeProperties extends _Properties { + @defineChild('a:scene3d') scene3d?: OXML + @defineChild('a:xfrm') declare xfrm: Transform2D + @defineChild('a:prstGeom') prstGeom?: PresetGeometry @defineChild('a:custGeom') custGeom?: CustomGeometry - @defineChild('a:effectDag') effectDag?: OXML - @defineChild('a:effectLst') effectLst?: EffectList - @defineChild('a:extLst') extLst?: ExtensionList - @defineChild('a:gradFill') gradFill?: GradientFill - @defineChild('a:grpFill') grpFill?: OXML @defineChild('a:ln') ln?: Outline - @defineChild('a:noFill') noFill?: NoFill - @defineChild('a:pattFill') pattFill?: PatternFill - @defineChild('a:prstGeom') prstGeom?: PresetGeometry - @defineChild('a:scene3d') scene3d?: OXML - @defineChild('a:solidFill') solidFill?: SolidFill @defineChild('a:sp3d') sp3d?: OXML - @defineChild('a:xfrm') declare xfrm: Transform2D } diff --git a/src/openxml/presentation/Slide.ts b/src/openxml/presentation/Slide.ts index 2e50bfe..1a2b727 100644 --- a/src/openxml/presentation/Slide.ts +++ b/src/openxml/presentation/Slide.ts @@ -1,15 +1,12 @@ import type { ColorMapOverride } from './ColorMapOverride' -import type { CommonSlideData } from './CommonSlideData' -import type { ExtensionList } from './ExtensionList' -import type { Timing } from './Timing' -import { defineChild, defineElement, defineProperty, OXML } from '../../core' -import { getElements } from './_utils' +import { defineChild, defineElement } from '../../core' +import { _Slide } from './_Slide' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.slide */ @defineElement('p:sld') -export class Slide extends OXML { +export class Slide extends _Slide { attrs = { 'xmlns': 'http://schemas.openxmlformats.org/presentationml/2006/main', 'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main', @@ -18,17 +15,4 @@ export class Slide extends OXML { } @defineChild('p:clrMapOvr') declare clrMapOvr: ColorMapOverride - @defineChild('p:cSld') declare cSld: CommonSlideData - @defineChild('p:extLst') declare extLst: ExtensionList - @defineChild('p:timing') declare timing: Timing - @defineChild('p:transition') declare transition: OXML - @defineChild('mc:AlternateContent') declare AlternateContent: OXML - - @defineProperty('cSld.spTree.nvGrpSpPr.cNvPr.id') declare id: string - @defineProperty('cSld.spTree.nvGrpSpPr.cNvPr.name') declare name: string - @defineProperty(['getElements']) declare elements: OXML[] - - getElements(): OXML[] { - return getElements(this.cSld.spTree.element.children) - } } diff --git a/src/openxml/presentation/SlideLayout.ts b/src/openxml/presentation/SlideLayout.ts index 927a2c6..ea1e9d2 100644 --- a/src/openxml/presentation/SlideLayout.ts +++ b/src/openxml/presentation/SlideLayout.ts @@ -1,39 +1,26 @@ -import type { ColorMap } from './ColorMap' -import { defineChild, defineElement, OXML } from '../../core' +import type { OXML } from '../../core' +import type { ColorMapOverride } from './ColorMapOverride' +import { defineAttribute, defineChild, defineElement } from '../../core' +import { _Slide } from './_Slide' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.slidelayout */ @defineElement('p:sldLayout') -export class SlideLayout extends OXML { - @defineChild('p:clrMap') declare clrMap: ColorMap - - override toXmlString(): string { - return ` - - - - - - - - - - - - - - - - - - - - -` +export class SlideLayout extends _Slide { + attrs = { + 'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main', + 'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', + 'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main', } + + @defineAttribute('matchingName') matchingName?: string + @defineAttribute('preserve', 'boolean') preserve?: boolean + @defineAttribute('showMasterPhAnim', 'boolean') showMasterPhAnim?: boolean + @defineAttribute('showMasterSp', 'boolean') showMasterSp?: boolean + @defineAttribute('type', 'ST_SlideLayoutType') type?: string + @defineAttribute('userDrawn', 'boolean') userDrawn?: boolean + + @defineChild('p:clrMapOvr') declare clrMapOvr: ColorMapOverride + @defineChild('p:hf') hf?: OXML } diff --git a/src/openxml/presentation/SlideMaster.ts b/src/openxml/presentation/SlideMaster.ts index e2fb44e..5af90be 100644 --- a/src/openxml/presentation/SlideMaster.ts +++ b/src/openxml/presentation/SlideMaster.ts @@ -1,298 +1,23 @@ +import type { OXML } from '../../core' import type { ColorMap } from './ColorMap' -import { defineChild, defineElement, OXML } from '../../core' +import { defineAttribute, defineChild, defineElement } from '../../core' +import { _Slide } from './_Slide' /** * https://learn.microsoft.com/dotnet/api/documentformat.openxml.presentation.slidemaster */ @defineElement('p:sldMaster') -export class SlideMaster extends OXML { - @defineChild('p:clrMap') declare clrMap: ColorMap - - override toXmlString(): string { - return ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -` +export class SlideMaster extends _Slide { + attrs = { + 'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main', + 'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', + 'xmlns:p': 'http://schemas.openxmlformats.org/presentationml/2006/main', } + + @defineAttribute('preserve', 'boolean') preserve?: boolean + + @defineChild('p:clrMap') declare clrMap: ColorMap + @defineChild('p:hf') hf?: OXML + @defineChild('p:sldLayoutIdLst') declare sldLayoutIdLst: OXML + @defineChild('p:txStyles') declare txStyles: OXML } diff --git a/src/openxml/presentation/_Properties.ts b/src/openxml/presentation/_Properties.ts new file mode 100644 index 0000000..8099dde --- /dev/null +++ b/src/openxml/presentation/_Properties.ts @@ -0,0 +1,15 @@ +import type { BlipFill, EffectDag, EffectList, GradientFill, GroupFill, NoFill, PatternFill, SolidFill } from '../drawing' +import type { ExtensionList } from './ExtensionList' +import { defineChild, OXML } from '../../core' + +export class _Properties extends OXML { + @defineChild('p:extLst') extLst?: ExtensionList + @defineChild('a:effectDag') effectDag?: EffectDag + @defineChild('a:effectLst') effectLst?: EffectList + @defineChild('a:noFill') noFill?: NoFill + @defineChild('a:blipFill') blipFill?: BlipFill + @defineChild('a:gradFill') gradFill?: GradientFill + @defineChild('a:grpFill') grpFill?: GroupFill + @defineChild('a:pattFill') pattFill?: PatternFill + @defineChild('a:solidFill') solidFill?: SolidFill +} diff --git a/src/openxml/presentation/_Slide.ts b/src/openxml/presentation/_Slide.ts new file mode 100644 index 0000000..75cc61b --- /dev/null +++ b/src/openxml/presentation/_Slide.ts @@ -0,0 +1,21 @@ +import type { CommonSlideData } from './CommonSlideData' +import type { ExtensionList } from './ExtensionList' +import type { Timing } from './Timing' +import { defineChild, defineProperty, OXML } from '../../core' +import { getElements } from './_utils' + +export class _Slide extends OXML { + @defineChild('p:cSld') declare cSld: CommonSlideData + @defineChild('p:extLst') declare extLst: ExtensionList + @defineChild('p:timing') declare timing: Timing + @defineChild('p:transition') declare transition: OXML + @defineChild('mc:AlternateContent') declare AlternateContent: OXML + + @defineProperty('cSld.spTree.nvGrpSpPr.cNvPr.id') declare id: string + @defineProperty('cSld.spTree.nvGrpSpPr.cNvPr.name') declare name: string + @defineProperty(['getElements']) declare elements: OXML[] + + getElements(): OXML[] { + return getElements(this.cSld.spTree.element.children) + } +} diff --git a/src/openxml/presentation/_utils.ts b/src/openxml/presentation/_utils.ts index a101d8d..df2965b 100644 --- a/src/openxml/presentation/_utils.ts +++ b/src/openxml/presentation/_utils.ts @@ -1,4 +1,6 @@ import type { OXML } from '../../core' +import { ConnectionShape } from './ConnectionShape' +import { GraphicFrame } from './GraphicFrame' import { GroupShape } from './GroupShape' import { Picture } from './Picture' import { Shape } from './Shape' @@ -12,6 +14,7 @@ export function getElements(children: HTMLCollection): OXML[] { // skip break case 'p:sp': + case 'dsp:sp': elements.push(new Shape().fromElement(element)) break case 'p:pic': @@ -20,9 +23,12 @@ export function getElements(children: HTMLCollection): OXML[] { case 'p:grpSp': elements.push(new GroupShape().fromElement(element)) break - case 'dsp:sp': case 'p:cxnSp': + elements.push(new ConnectionShape().fromElement(element)) + break case 'p:graphicFrame': + elements.push(new GraphicFrame().fromElement(element)) + break default: console.warn(element) break diff --git a/src/openxml/presentation/index.ts b/src/openxml/presentation/index.ts index 53fbb9a..a40f964 100644 --- a/src/openxml/presentation/index.ts +++ b/src/openxml/presentation/index.ts @@ -5,10 +5,15 @@ export * from './BlipFill' export * from './ColorMap' export * from './ColorMapOverride' export * from './CommonSlideData' +export * from './ConnectionShape' export * from './DefaultTextStyle' +export * from './EmbeddedFont' +export * from './EmbeddedFontList' export * from './ExtensionList' +export * from './Font' export * from './GroupShape' export * from './GroupShapeProperties' +export * from './NonVisualConnectionShapeProperties' export * from './NonVisualDrawingProperties' export * from './NonVisualGroupShapeProperties' export * from './NonVisualPictureDrawingProperties' diff --git a/src/utils/tmeplate.ts b/src/utils/tmeplate.ts deleted file mode 100644 index 1ae8000..0000000 --- a/src/utils/tmeplate.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function withAttr(name: string, value?: string | number) { - if (value === undefined) return '' - return `${ name }="${ value }"` -} - -export function withAttrs(attrs: string[]) { - return attrs.length ? ` ${ attrs.filter(Boolean).join(' ') }` : '' -} - -export function withIndents(str: string | string[], deep = 1, ignoreFirstLine = true) { - const spaces = [...Array(deep)].map(_ => ' ').join('') - str = typeof str === 'string' ? str : str.join('\n') - return str.split('\n').map((v, i) => { - return ignoreFirstLine && i === 0 ? v : `${ spaces }${ v }` - }).join('\n') -} diff --git a/src/utils/xml.ts b/src/utils/xml.ts deleted file mode 100644 index 3339101..0000000 --- a/src/utils/xml.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const XML_HEADER = '' - -export function withXmlHeader(str: string) { - return `${ XML_HEADER }\n${ str }` -} - -export function compressXml(str: string) { - return str - .replace(/\n/g, '') - .replace(/> +<') - .replace(/ +([:\w]+=".+?")/g, ' $1') - .replace(/([:\w]+=".+?") +/g, '$1 ') -}