Initial ESlint conversion

This commit is contained in:
Dolan Miu
2022-08-31 07:52:27 +01:00
parent d7a9cb2168
commit 1bdf9a4987
210 changed files with 4685 additions and 333 deletions

265
.eslintrc.js Normal file
View File

@ -0,0 +1,265 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
sourceType: "module",
},
plugins: [
"eslint-plugin-import",
"eslint-plugin-no-null",
"eslint-plugin-unicorn",
"eslint-plugin-jsdoc",
"eslint-plugin-prefer-arrow",
"@typescript-eslint",
"@typescript-eslint/tslint",
],
root: true,
rules: {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
{
default: "array",
},
],
"@typescript-eslint/ban-types": [
"error",
{
types: {
Object: {
message: "Avoid using the `Object` type. Did you mean `object`?",
},
Function: {
message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
},
Boolean: {
message: "Avoid using the `Boolean` type. Did you mean `boolean`?",
},
Number: {
message: "Avoid using the `Number` type. Did you mean `number`?",
},
String: {
message: "Avoid using the `String` type. Did you mean `string`?",
},
Symbol: {
message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
},
},
},
],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: false,
allowTypedFunctionExpressions: false,
allowHigherOrderFunctions: false,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "explicit",
overrides: {
accessors: "explicit",
},
},
],
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
allowArgumentsExplicitlyTypedAsAny: true,
allowDirectConstAssertionInArrowFunctions: true,
allowHigherOrderFunctions: false,
allowTypedFunctionExpressions: false,
},
],
"@typescript-eslint/indent": [
"error",
4,
{
ObjectExpression: "first",
FunctionDeclaration: {
parameters: "first",
},
FunctionExpression: {
parameters: "first",
},
},
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["objectLiteralProperty"],
leadingUnderscore: "allow",
format: ["camelCase"],
custom: {
regex: "^w:.+",
match: false,
},
},
],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-shadow": [
"error",
{
hoist: "all",
},
],
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/triple-slash-reference": [
"error",
{
path: "always",
types: "prefer-import",
lib: "always",
},
],
"@typescript-eslint/typedef": [
"error",
{
parameter: true,
propertyDeclaration: true,
},
],
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "error",
complexity: "off",
"constructor-super": "error",
curly: "error",
"dot-notation": "off",
eqeqeq: ["error", "smart"],
"guard-for-in": "error",
"id-denylist": ["error", "any", "Number", "number", "String", "string", "Boolean", "boolean", "Undefined", "undefined"],
"id-match": "error",
"import/no-default-export": "error",
"import/no-extraneous-dependencies": "off",
"import/no-internal-modules": "off",
"import/order": "error",
indent: "off",
"jsdoc/check-alignment": "error",
"jsdoc/check-indentation": "error",
"jsdoc/newline-after-description": "error",
"max-classes-per-file": "off",
"max-len": "off",
"new-parens": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "error",
"no-empty-function": "off",
"no-eval": "error",
"no-extra-bind": "error",
"no-fallthrough": "off",
"no-invalid-this": "off",
"no-multiple-empty-lines": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-null/no-null": "error",
"no-param-reassign": "error",
"no-redeclare": "error",
"no-return-await": "error",
"no-sequences": "error",
"no-shadow": "off",
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": "error",
"no-unsafe-finally": "error",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-use-before-define": "off",
"no-useless-constructor": "error",
"no-var": "error",
"object-shorthand": "off",
"one-var": ["error", "never"],
"prefer-arrow/prefer-arrow-functions": "error",
"prefer-const": "error",
"prefer-object-spread": "error",
radix: "error",
"space-in-parens": ["error", "never"],
"spaced-comment": [
"error",
"always",
{
markers: ["/"],
},
],
"unicorn/filename-case": "error",
"unicorn/prefer-ternary": "error",
"use-isnan": "error",
"valid-typeof": "off",
"@typescript-eslint/tslint/config": [
"error",
{
rules: {
"no-delete": true,
"no-method-signature": true,
"no-mixed-interface": true,
"readonly-keyword": true,
"return-undefined": true,
whitespace: [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast",
"check-type-operator",
"check-rest-spread",
],
},
},
],
},
overrides: [
{
// enable the rule specifically for TypeScript files
files: ["*.spec.ts"],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
},
},
],
};

4178
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"test.coverage": "nyc npm test", "test.coverage": "nyc npm test",
"test.watch": "npm test -- --watch", "test.watch": "npm test -- --watch",
"prepublishOnly": "npm run build --production", "prepublishOnly": "npm run build --production",
"lint": "tslint --project .", "lint": "eslint -c .eslintrc.js --ext .ts .",
"build": "npm run webpack && npm run fix-types", "build": "npm run webpack && npm run fix-types",
"webpack": "rimraf ./build && webpack --config ./webpack.config.ts", "webpack": "rimraf ./build && webpack --config ./webpack.config.ts",
"demo": "npm run build && npm run ts-node --skip-project ./demo", "demo": "npm run build && npm run ts-node --skip-project ./demo",
@ -72,10 +72,19 @@
"@types/sinon": "^10.0.0", "@types/sinon": "^10.0.0",
"@types/unzipper": "^0.10.4", "@types/unzipper": "^0.10.4",
"@types/webpack": "^5.0.0", "@types/webpack": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/eslint-plugin-tslint": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"chai": "^3.5.0", "chai": "^3.5.0",
"cspell": "^6.2.2", "cspell": "^6.2.2",
"docsify-cli": "^4.3.0", "docsify-cli": "^4.3.0",
"eslint": "^8.23.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.6",
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-unicorn": "^43.0.2",
"glob": "^8.0.1", "glob": "^8.0.1",
"jszip": "^3.1.5", "jszip": "^3.1.5",
"mocha": "^10.0.0", "mocha": "^10.0.0",

View File

@ -38,7 +38,7 @@ export class Compiler {
private readonly imageReplacer: ImageReplacer; private readonly imageReplacer: ImageReplacer;
private readonly numberingReplacer: NumberingReplacer; private readonly numberingReplacer: NumberingReplacer;
constructor() { public constructor() {
this.formatter = new Formatter(); this.formatter = new Formatter();
this.imageReplacer = new ImageReplacer(); this.imageReplacer = new ImageReplacer();
this.numberingReplacer = new NumberingReplacer(); this.numberingReplacer = new NumberingReplacer();

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { AppPropertiesAttributes } from "./app-properties-attributes"; import { AppPropertiesAttributes } from "./app-properties-attributes";
export class AppProperties extends XmlComponent { export class AppProperties extends XmlComponent {
constructor() { public constructor() {
super("Properties"); super("Properties");
this.root.push( this.root.push(

View File

@ -33,7 +33,7 @@ export interface IBorderOptions {
} }
export class BorderElement extends XmlComponent { export class BorderElement extends XmlComponent {
constructor(elementName: string, { color, size, space, style }: IBorderOptions) { public constructor(elementName: string, { color, size, space, style }: IBorderOptions) {
super(elementName); super(elementName);
this.root.push( this.root.push(
new BordersAttributes({ new BordersAttributes({

View File

@ -4,7 +4,7 @@ import { Default } from "./default/default";
import { Override } from "./override/override"; import { Override } from "./override/override";
export class ContentTypes extends XmlComponent { export class ContentTypes extends XmlComponent {
constructor() { public constructor() {
super("Types"); super("Types");
this.root.push( this.root.push(

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { DefaultAttributes } from "./default-attributes"; import { DefaultAttributes } from "./default-attributes";
export class Default extends XmlComponent { export class Default extends XmlComponent {
constructor(contentType: string, extension?: string) { public constructor(contentType: string, extension?: string) {
super("Default"); super("Default");
this.root.push( this.root.push(

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { OverrideAttributes } from "./override-attributes"; import { OverrideAttributes } from "./override-attributes";
export class Override extends XmlComponent { export class Override extends XmlComponent {
constructor(contentType: string, partName?: string) { public constructor(contentType: string, partName?: string) {
super("Override"); super("Override");
this.root.push( this.root.push(

View File

@ -64,7 +64,7 @@ export interface IPropertiesOptions {
/* cSpell:enable */ /* cSpell:enable */
export class CoreProperties extends XmlComponent { export class CoreProperties extends XmlComponent {
constructor(options: Omit<IPropertiesOptions, "sections">) { public constructor(options: Omit<IPropertiesOptions, "sections">) {
super("cp:coreProperties"); super("cp:coreProperties");
this.root.push( this.root.push(
new DocumentAttributes({ new DocumentAttributes({
@ -102,7 +102,7 @@ export class CoreProperties extends XmlComponent {
} }
class TimestampElement extends XmlComponent { class TimestampElement extends XmlComponent {
constructor(name: string) { public constructor(name: string) {
super(name); super(name);
this.root.push( this.root.push(
new DocumentAttributes({ new DocumentAttributes({

View File

@ -7,7 +7,7 @@ export class CustomProperties extends XmlComponent {
private nextId: number; private nextId: number;
private readonly properties: CustomProperty[] = []; private readonly properties: CustomProperty[] = [];
constructor(properties: ICustomPropertyOptions[]) { public constructor(properties: ICustomPropertyOptions[]) {
super("Properties"); super("Properties");
this.root.push( this.root.push(

View File

@ -7,7 +7,7 @@ export interface ICustomPropertyOptions {
} }
export class CustomProperty extends XmlComponent { export class CustomProperty extends XmlComponent {
constructor(id: number, properties: ICustomPropertyOptions) { public constructor(id: number, properties: ICustomPropertyOptions) {
super("property"); super("property");
this.root.push( this.root.push(
new CustomPropertyAttributes({ new CustomPropertyAttributes({
@ -21,7 +21,7 @@ export class CustomProperty extends XmlComponent {
} }
export class CustomPropertyValue extends XmlComponent { export class CustomPropertyValue extends XmlComponent {
constructor(value: string) { public constructor(value: string) {
super("vt:lpwstr"); super("vt:lpwstr");
this.root.push(value); this.root.push(value);
} }

View File

@ -13,7 +13,7 @@ export class DocumentWrapper implements IViewWrapper {
private readonly document: Document; private readonly document: Document;
private readonly relationships: Relationships; private readonly relationships: Relationships;
constructor(options: IDocumentOptions) { public constructor(options: IDocumentOptions) {
this.document = new Document(options); this.document = new Document(options);
this.relationships = new Relationships(); this.relationships = new Relationships();
} }

View File

@ -6,7 +6,7 @@ import { ISectionPropertiesOptions, SectionProperties } from "./section-properti
export class Body extends XmlComponent { export class Body extends XmlComponent {
private readonly sections: SectionProperties[] = []; private readonly sections: SectionProperties[] = [];
constructor() { public constructor() {
super("w:body"); super("w:body");
} }

View File

@ -14,7 +14,7 @@ export class ColumnAttributes extends XmlAttributeComponent<IColumnAttributes> {
} }
export class Column extends XmlComponent { export class Column extends XmlComponent {
constructor({ width, space }: IColumnAttributes) { public constructor({ width, space }: IColumnAttributes) {
super("w:col"); super("w:col");
this.root.push( this.root.push(
new ColumnAttributes({ new ColumnAttributes({

View File

@ -30,7 +30,7 @@ export class ColumnsAttributes extends XmlAttributeComponent<IColumnsAttributes>
} }
export class Columns extends XmlComponent { export class Columns extends XmlComponent {
constructor({ space, count, separate, equalWidth, children }: IColumnsAttributes) { public constructor({ space, count, separate, equalWidth, children }: IColumnsAttributes) {
super("w:cols"); super("w:cols");
this.root.push( this.root.push(
new ColumnsAttributes({ new ColumnsAttributes({

View File

@ -38,7 +38,7 @@ export class DocGridAttributes extends XmlAttributeComponent<IDocGridAttributesP
} }
export class DocumentGrid extends XmlComponent { export class DocumentGrid extends XmlComponent {
constructor(linePitch: number, charSpace?: number, type?: DocumentGridType) { public constructor(linePitch: number, charSpace?: number, type?: DocumentGridType) {
super("w:docGrid"); super("w:docGrid");
this.root.push( this.root.push(

View File

@ -52,7 +52,7 @@ export enum HeaderFooterType {
FOOTER = "w:footerReference", FOOTER = "w:footerReference",
} }
export class HeaderFooterReference extends XmlComponent { export class HeaderFooterReference extends XmlComponent {
constructor(type: HeaderFooterType, options: IHeaderFooterOptions) { public constructor(type: HeaderFooterType, options: IHeaderFooterOptions) {
super(type); super(type);
this.root.push( this.root.push(

View File

@ -39,7 +39,7 @@ export class LineNumberAttributes extends XmlAttributeComponent<ILineNumberAttri
} }
export class LineNumberType extends XmlComponent { export class LineNumberType extends XmlComponent {
constructor({ countBy, start, restart, distance }: ILineNumberAttributes) { public constructor({ countBy, start, restart, distance }: ILineNumberAttributes) {
super("w:lnNumType"); super("w:lnNumType");
this.root.push( this.root.push(
new LineNumberAttributes({ new LineNumberAttributes({

View File

@ -71,7 +71,7 @@ class PageBordersAttributes extends XmlAttributeComponent<IPageBorderAttributes>
// <xsd:attribute name="offsetFrom" type="ST_PageBorderOffset" use="optional" default="text"/> // <xsd:attribute name="offsetFrom" type="ST_PageBorderOffset" use="optional" default="text"/>
// </xsd:complexType> // </xsd:complexType>
export class PageBorders extends IgnoreIfEmptyXmlComponent { export class PageBorders extends IgnoreIfEmptyXmlComponent {
constructor(options?: IPageBordersOptions) { public constructor(options?: IPageBordersOptions) {
super("w:pgBorders"); super("w:pgBorders");
if (!options) { if (!options) {

View File

@ -33,7 +33,7 @@ export class PageMarginAttributes extends XmlAttributeComponent<IPageMarginAttri
} }
export class PageMargin extends XmlComponent { export class PageMargin extends XmlComponent {
constructor( public constructor(
top: number | string, top: number | string,
right: number | string, right: number | string,
bottom: number | string, bottom: number | string,

View File

@ -41,7 +41,7 @@ export class PageNumberTypeAttributes extends XmlAttributeComponent<IPageNumberT
}; };
} }
export class PageNumberType extends XmlComponent { export class PageNumberType extends XmlComponent {
constructor({ start, formatType, separator }: IPageNumberTypeAttributes) { public constructor({ start, formatType, separator }: IPageNumberTypeAttributes) {
super("w:pgNumType"); super("w:pgNumType");
this.root.push( this.root.push(
new PageNumberTypeAttributes({ new PageNumberTypeAttributes({

View File

@ -33,7 +33,7 @@ export class PageSizeAttributes extends XmlAttributeComponent<IPageSizeAttribute
} }
export class PageSize extends XmlComponent { export class PageSize extends XmlComponent {
constructor(width: number | string, height: number | string, orientation: PageOrientation) { public constructor(width: number | string, height: number | string, orientation: PageOrientation) {
super("w:pgSz"); super("w:pgSz");
const flip = orientation === PageOrientation.LANDSCAPE; const flip = orientation === PageOrientation.LANDSCAPE;

View File

@ -10,7 +10,7 @@ class PageTextDirectionAttributes extends XmlAttributeComponent<{ readonly val:
} }
export class PageTextDirection extends XmlComponent { export class PageTextDirection extends XmlComponent {
constructor(value: PageTextDirectionType) { public constructor(value: PageTextDirectionType) {
super("w:textDirection"); super("w:textDirection");
this.root.push( this.root.push(

View File

@ -30,7 +30,7 @@ export class SectionTypeAttributes extends XmlAttributeComponent<{
} }
export class Type extends XmlComponent { export class Type extends XmlComponent {
constructor(value: SectionType) { public constructor(value: SectionType) {
super("w:type"); super("w:type");
this.root.push(new SectionTypeAttributes({ val: value })); this.root.push(new SectionTypeAttributes({ val: value }));
} }

View File

@ -92,7 +92,7 @@ export const sectionPageSizeDefaults = {
}; };
export class SectionProperties extends XmlComponent { export class SectionProperties extends XmlComponent {
constructor({ public constructor({
page: { page: {
size: { size: {
width = sectionPageSizeDefaults.WIDTH, width = sectionPageSizeDefaults.WIDTH,

View File

@ -63,7 +63,7 @@ export interface IDocumentBackgroundOptions {
// </xsd:complexType> // </xsd:complexType>
export class DocumentBackground extends XmlComponent { export class DocumentBackground extends XmlComponent {
constructor(options: IDocumentBackgroundOptions) { public constructor(options: IDocumentBackgroundOptions) {
super("w:background"); super("w:background");
this.root.push( this.root.push(

View File

@ -33,7 +33,7 @@ export interface IDocumentOptions {
export class Document extends XmlComponent { export class Document extends XmlComponent {
private readonly body: Body; private readonly body: Body;
constructor(options: IDocumentOptions) { public constructor(options: IDocumentOptions) {
super("w:document"); super("w:document");
this.root.push( this.root.push(
new DocumentAttributes({ new DocumentAttributes({

View File

@ -37,7 +37,7 @@ import { AnchorAttributes } from "./anchor-attributes";
// <xsd:attribute name="allowOverlap" type="xsd:boolean" use="required"/> // <xsd:attribute name="allowOverlap" type="xsd:boolean" use="required"/>
// </xsd:complexType> // </xsd:complexType>
export class Anchor extends XmlComponent { export class Anchor extends XmlComponent {
constructor(mediaData: IMediaData, transform: IMediaDataTransformation, drawingOptions: IDrawingOptions) { public constructor(mediaData: IMediaData, transform: IMediaDataTransformation, drawingOptions: IDrawingOptions) {
super("wp:anchor"); super("wp:anchor");
const floating: IFloating = { const floating: IFloating = {

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { DocPropertiesAttributes } from "./doc-properties-attributes"; import { DocPropertiesAttributes } from "./doc-properties-attributes";
export class DocProperties extends XmlComponent { export class DocProperties extends XmlComponent {
constructor() { public constructor() {
super("wp:docPr"); super("wp:docPr");
this.root.push( this.root.push(

View File

@ -25,7 +25,7 @@ export interface IDrawingOptions {
export class Drawing extends XmlComponent { export class Drawing extends XmlComponent {
private readonly inline: Inline; private readonly inline: Inline;
constructor(imageData: IMediaData, drawingOptions: IDrawingOptions = {}) { public constructor(imageData: IMediaData, drawingOptions: IDrawingOptions = {}) {
super("w:drawing"); super("w:drawing");
if (!drawingOptions.floating) { if (!drawingOptions.floating) {

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { EffectExtentAttributes } from "./effect-extent-attributes"; import { EffectExtentAttributes } from "./effect-extent-attributes";
export class EffectExtent extends XmlComponent { export class EffectExtent extends XmlComponent {
constructor() { public constructor() {
super("wp:effectExtent"); super("wp:effectExtent");
this.root.push( this.root.push(

View File

@ -5,7 +5,7 @@ import { ExtentAttributes } from "./extent-attributes";
export class Extent extends XmlComponent { export class Extent extends XmlComponent {
private readonly attributes: ExtentAttributes; private readonly attributes: ExtentAttributes;
constructor(x: number, y: number) { public constructor(x: number, y: number) {
super("wp:extent"); super("wp:extent");
this.attributes = new ExtentAttributes({ this.attributes = new ExtentAttributes({

View File

@ -3,7 +3,7 @@ import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/ali
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class Align extends XmlComponent { export class Align extends XmlComponent {
constructor(value: HorizontalPositionAlign | VerticalPositionAlign) { public constructor(value: HorizontalPositionAlign | VerticalPositionAlign) {
super("wp:align"); super("wp:align");
this.root.push(value); this.root.push(value);
} }

View File

@ -13,7 +13,7 @@ class HorizontalPositionAttributes extends XmlAttributeComponent<{
} }
export class HorizontalPosition extends XmlComponent { export class HorizontalPosition extends XmlComponent {
constructor(horizontalPosition: IHorizontalPositionOptions) { public constructor(horizontalPosition: IHorizontalPositionOptions) {
super("wp:positionH"); super("wp:positionH");
this.root.push( this.root.push(

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class PositionOffset extends XmlComponent { export class PositionOffset extends XmlComponent {
constructor(offsetValue: number) { public constructor(offsetValue: number) {
super("wp:posOffset"); super("wp:posOffset");
this.root.push(offsetValue.toString()); this.root.push(offsetValue.toString());
} }

View File

@ -12,7 +12,7 @@ class SimplePosAttributes extends XmlAttributeComponent<{
} }
export class SimplePos extends XmlComponent { export class SimplePos extends XmlComponent {
constructor() { public constructor() {
super("wp:simplePos"); super("wp:simplePos");
// NOTE: It's not fully supported in Microsoft Word, but this element is needed anyway // NOTE: It's not fully supported in Microsoft Word, but this element is needed anyway

View File

@ -13,7 +13,7 @@ class VerticalPositionAttributes extends XmlAttributeComponent<{
} }
export class VerticalPosition extends XmlComponent { export class VerticalPosition extends XmlComponent {
constructor(verticalPosition: IVerticalPositionOptions) { public constructor(verticalPosition: IVerticalPositionOptions) {
super("wp:positionV"); super("wp:positionV");
this.root.push( this.root.push(

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { GraphicFrameLockAttributes } from "./graphic-frame-lock-attributes"; import { GraphicFrameLockAttributes } from "./graphic-frame-lock-attributes";
export class GraphicFrameLocks extends XmlComponent { export class GraphicFrameLocks extends XmlComponent {
constructor() { public constructor() {
super("a:graphicFrameLocks"); super("a:graphicFrameLocks");
this.root.push( this.root.push(

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { GraphicFrameLocks } from "./graphic-frame-locks/graphic-frame-locks"; import { GraphicFrameLocks } from "./graphic-frame-locks/graphic-frame-locks";
export class GraphicFrameProperties extends XmlComponent { export class GraphicFrameProperties extends XmlComponent {
constructor() { public constructor() {
super("wp:cNvGraphicFramePr"); super("wp:cNvGraphicFramePr");
this.root.push(new GraphicFrameLocks()); this.root.push(new GraphicFrameLocks());

View File

@ -7,7 +7,7 @@ import { Pic } from "./pic";
export class GraphicData extends XmlComponent { export class GraphicData extends XmlComponent {
private readonly pic: Pic; private readonly pic: Pic;
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) { public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
super("a:graphicData"); super("a:graphicData");
this.root.push( this.root.push(

View File

@ -6,7 +6,7 @@ import { SourceRectangle } from "./source-rectangle";
import { Stretch } from "./stretch"; import { Stretch } from "./stretch";
export class BlipFill extends XmlComponent { export class BlipFill extends XmlComponent {
constructor(mediaData: IMediaData) { public constructor(mediaData: IMediaData) {
super("pic:blipFill"); super("pic:blipFill");
this.root.push(new Blip(mediaData)); this.root.push(new Blip(mediaData));

View File

@ -12,7 +12,7 @@ class BlipAttributes extends XmlAttributeComponent<{
} }
export class Blip extends XmlComponent { export class Blip extends XmlComponent {
constructor(mediaData: IMediaData) { public constructor(mediaData: IMediaData) {
super("a:blip"); super("a:blip");
this.root.push( this.root.push(
new BlipAttributes({ new BlipAttributes({

View File

@ -1,7 +1,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class SourceRectangle extends XmlComponent { export class SourceRectangle extends XmlComponent {
constructor() { public constructor() {
super("a:srcRect"); super("a:srcRect");
} }
} }

View File

@ -1,13 +1,13 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
class FillRectangle extends XmlComponent { class FillRectangle extends XmlComponent {
constructor() { public constructor() {
super("a:fillRect"); super("a:fillRect");
} }
} }
export class Stretch extends XmlComponent { export class Stretch extends XmlComponent {
constructor() { public constructor() {
super("a:stretch"); super("a:stretch");
this.root.push(new FillRectangle()); this.root.push(new FillRectangle());
} }

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { PicLocks } from "./pic-locks/pic-locks"; import { PicLocks } from "./pic-locks/pic-locks";
export class ChildNonVisualProperties extends XmlComponent { export class ChildNonVisualProperties extends XmlComponent {
constructor() { public constructor() {
super("pic:cNvPicPr"); super("pic:cNvPicPr");
this.root.push(new PicLocks()); this.root.push(new PicLocks());

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { PicLocksAttributes } from "./pic-locks-attributes"; import { PicLocksAttributes } from "./pic-locks-attributes";
export class PicLocks extends XmlComponent { export class PicLocks extends XmlComponent {
constructor() { public constructor() {
super("a:picLocks"); super("a:picLocks");
this.root.push( this.root.push(
new PicLocksAttributes({ new PicLocksAttributes({

View File

@ -3,7 +3,7 @@ import { ChildNonVisualProperties } from "./child-non-visual-pic-properties/chil
import { NonVisualProperties } from "./non-visual-properties/non-visual-properties"; import { NonVisualProperties } from "./non-visual-properties/non-visual-properties";
export class NonVisualPicProperties extends XmlComponent { export class NonVisualPicProperties extends XmlComponent {
constructor() { public constructor() {
super("pic:nvPicPr"); super("pic:nvPicPr");
this.root.push(new NonVisualProperties()); this.root.push(new NonVisualProperties());

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "@file/xml-components";
import { NonVisualPropertiesAttributes } from "./non-visual-properties-attributes"; import { NonVisualPropertiesAttributes } from "./non-visual-properties-attributes";
export class NonVisualProperties extends XmlComponent { export class NonVisualProperties extends XmlComponent {
constructor() { public constructor() {
super("pic:cNvPr"); super("pic:cNvPr");
this.root.push( this.root.push(

View File

@ -8,7 +8,7 @@ import { PicAttributes } from "./pic-attributes";
import { ShapeProperties } from "./shape-properties/shape-properties"; import { ShapeProperties } from "./shape-properties/shape-properties";
export class Pic extends XmlComponent { export class Pic extends XmlComponent {
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) { public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
super("pic:pic"); super("pic:pic");
this.root.push( this.root.push(

View File

@ -5,7 +5,7 @@ import { ExtentsAttributes } from "./extents-attributes";
export class Extents extends XmlComponent { export class Extents extends XmlComponent {
private readonly attributes: ExtentsAttributes; private readonly attributes: ExtentsAttributes;
constructor(x: number, y: number) { public constructor(x: number, y: number) {
super("a:ext"); super("a:ext");
this.attributes = new ExtentsAttributes({ this.attributes = new ExtentsAttributes({

View File

@ -21,7 +21,7 @@ export class FormAttributes extends XmlAttributeComponent<{
export class Form extends XmlComponent { export class Form extends XmlComponent {
private readonly extents: Extents; private readonly extents: Extents;
constructor(options: IMediaDataTransformation) { public constructor(options: IMediaDataTransformation) {
super("a:xfrm"); super("a:xfrm");
this.root.push( this.root.push(

View File

@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
import { OffsetAttributes } from "./off-attributes"; import { OffsetAttributes } from "./off-attributes";
export class Offset extends XmlComponent { export class Offset extends XmlComponent {
constructor() { public constructor() {
super("a:off"); super("a:off");
this.root.push( this.root.push(

View File

@ -1,7 +1,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class NoFill extends XmlComponent { export class NoFill extends XmlComponent {
constructor() { public constructor() {
super("a:noFill"); super("a:noFill");
} }
} }

View File

@ -3,7 +3,7 @@ import { XmlComponent } from "@file/xml-components";
import { NoFill } from "./no-fill"; import { NoFill } from "./no-fill";
export class Outline extends XmlComponent { export class Outline extends XmlComponent {
constructor() { public constructor() {
super("a:ln"); super("a:ln");
this.root.push(new NoFill()); this.root.push(new NoFill());

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class AdjustmentValues extends XmlComponent { export class AdjustmentValues extends XmlComponent {
constructor() { public constructor() {
super("a:avLst"); super("a:avLst");
} }
} }

View File

@ -4,7 +4,7 @@ import { AdjustmentValues } from "./adjustment-values/adjustment-values";
import { PresetGeometryAttributes } from "./preset-geometry-attributes"; import { PresetGeometryAttributes } from "./preset-geometry-attributes";
export class PresetGeometry extends XmlComponent { export class PresetGeometry extends XmlComponent {
constructor() { public constructor() {
super("a:prstGeom"); super("a:prstGeom");
this.root.push( this.root.push(

View File

@ -10,7 +10,7 @@ import { ShapePropertiesAttributes } from "./shape-properties-attributes";
export class ShapeProperties extends XmlComponent { export class ShapeProperties extends XmlComponent {
private readonly form: Form; private readonly form: Form;
constructor(transform: IMediaDataTransformation) { public constructor(transform: IMediaDataTransformation) {
super("pic:spPr"); super("pic:spPr");
this.root.push( this.root.push(

View File

@ -14,7 +14,7 @@ class GraphicAttributes extends XmlAttributeComponent<{
export class Graphic extends XmlComponent { export class Graphic extends XmlComponent {
private readonly data: GraphicData; private readonly data: GraphicData;
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) { public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
super("a:graphic"); super("a:graphic");
this.root.push( this.root.push(
new GraphicAttributes({ new GraphicAttributes({

View File

@ -26,7 +26,7 @@ export class Inline extends XmlComponent {
private readonly extent: Extent; private readonly extent: Extent;
private readonly graphic: Graphic; private readonly graphic: Graphic;
constructor(mediaData: IMediaData, transform: IMediaDataTransformation) { public constructor(mediaData: IMediaData, transform: IMediaDataTransformation) {
super("wp:inline"); super("wp:inline");
this.root.push( this.root.push(

View File

@ -2,7 +2,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class WrapNone extends XmlComponent { export class WrapNone extends XmlComponent {
constructor() { public constructor() {
super("wp:wrapNone"); super("wp:wrapNone");
} }
} }

View File

@ -19,7 +19,7 @@ class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes>
} }
export class WrapSquare extends XmlComponent { export class WrapSquare extends XmlComponent {
constructor( public constructor(
textWrapping: ITextWrapping, textWrapping: ITextWrapping,
margins: IMargins = { margins: IMargins = {
top: 0, top: 0,

View File

@ -14,7 +14,7 @@ class WrapTightAttributes extends XmlAttributeComponent<{
} }
export class WrapTight extends XmlComponent { export class WrapTight extends XmlComponent {
constructor( public constructor(
margins: IMargins = { margins: IMargins = {
top: 0, top: 0,
bottom: 0, bottom: 0,

View File

@ -14,7 +14,7 @@ class WrapTopAndBottomAttributes extends XmlAttributeComponent<{
} }
export class WrapTopAndBottom extends XmlComponent { export class WrapTopAndBottom extends XmlComponent {
constructor( public constructor(
margins: IMargins = { margins: IMargins = {
top: 0, top: 0,
bottom: 0, bottom: 0,

View File

@ -55,7 +55,7 @@ export class File {
private readonly styles: Styles; private readonly styles: Styles;
private readonly comments: Comments; private readonly comments: Comments;
constructor(options: IPropertiesOptions, fileProperties: IFileProperties = {}) { public constructor(options: IPropertiesOptions, fileProperties: IFileProperties = {}) {
this.coreProperties = new CoreProperties({ this.coreProperties = new CoreProperties({
...options, ...options,
creator: options.creator ?? "Un-named", creator: options.creator ?? "Un-named",

View File

@ -17,7 +17,7 @@ export class FooterWrapper implements IViewWrapper {
private readonly footer: Footer; private readonly footer: Footer;
private readonly relationships: Relationships; private readonly relationships: Relationships;
constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) { public constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
this.footer = new Footer(referenceId, initContent); this.footer = new Footer(referenceId, initContent);
this.relationships = new Relationships(); this.relationships = new Relationships();
} }

View File

@ -7,7 +7,7 @@ import { FooterAttributes } from "./footer-attributes";
export class Footer extends InitializableXmlComponent { export class Footer extends InitializableXmlComponent {
private readonly refId: number; private readonly refId: number;
constructor(referenceNumber: number, initContent?: XmlComponent) { public constructor(referenceNumber: number, initContent?: XmlComponent) {
super("w:ftr", initContent); super("w:ftr", initContent);
this.refId = referenceNumber; this.refId = referenceNumber;
if (!initContent) { if (!initContent) {

View File

@ -6,7 +6,7 @@ export class FootnotesWrapper implements IViewWrapper {
private readonly footnotess: FootNotes; private readonly footnotess: FootNotes;
private readonly relationships: Relationships; private readonly relationships: Relationships;
constructor() { public constructor() {
this.footnotess = new FootNotes(); this.footnotess = new FootNotes();
this.relationships = new Relationships(); this.relationships = new Relationships();
} }

View File

@ -16,7 +16,7 @@ export interface IFootnoteOptions {
} }
export class Footnote extends XmlComponent { export class Footnote extends XmlComponent {
constructor(options: IFootnoteOptions) { public constructor(options: IFootnoteOptions) {
super("w:footnote"); super("w:footnote");
this.root.push( this.root.push(
new FootnoteAttributes({ new FootnoteAttributes({

View File

@ -2,7 +2,7 @@ import { Run } from "@file/paragraph";
import { ContinuationSeperator } from "./continuation-seperator"; import { ContinuationSeperator } from "./continuation-seperator";
export class ContinuationSeperatorRun extends Run { export class ContinuationSeperatorRun extends Run {
constructor() { public constructor() {
super({}); super({});
this.root.push(new ContinuationSeperator()); this.root.push(new ContinuationSeperator());

View File

@ -1,7 +1,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class ContinuationSeperator extends XmlComponent { export class ContinuationSeperator extends XmlComponent {
constructor() { public constructor() {
super("w:continuationSeparator"); super("w:continuationSeparator");
} }
} }

View File

@ -3,7 +3,7 @@ import { Run } from "@file/paragraph";
import { FootnoteRef } from "./footnote-ref"; import { FootnoteRef } from "./footnote-ref";
export class FootnoteRefRun extends Run { export class FootnoteRefRun extends Run {
constructor() { public constructor() {
super({ super({
style: "FootnoteReference", style: "FootnoteReference",
}); });

View File

@ -1,7 +1,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class FootnoteRef extends XmlComponent { export class FootnoteRef extends XmlComponent {
constructor() { public constructor() {
super("w:footnoteRef"); super("w:footnoteRef");
} }
} }

View File

@ -10,7 +10,7 @@ export class FootNoteReferenceRunAttributes extends XmlAttributeComponent<{
} }
export class FootnoteReference extends XmlComponent { export class FootnoteReference extends XmlComponent {
constructor(id: number) { public constructor(id: number) {
super("w:footnoteReference"); super("w:footnoteReference");
this.root.push( this.root.push(
@ -22,7 +22,7 @@ export class FootnoteReference extends XmlComponent {
} }
export class FootnoteReferenceRun extends Run { export class FootnoteReferenceRun extends Run {
constructor(id: number) { public constructor(id: number) {
super({ style: "FootnoteReference" }); super({ style: "FootnoteReference" });
this.root.push(new FootnoteReference(id)); this.root.push(new FootnoteReference(id));

View File

@ -2,7 +2,7 @@ import { Run } from "@file/paragraph";
import { Seperator } from "./seperator"; import { Seperator } from "./seperator";
export class SeperatorRun extends Run { export class SeperatorRun extends Run {
constructor() { public constructor() {
super({}); super({});
this.root.push(new Seperator()); this.root.push(new Seperator());

View File

@ -1,7 +1,7 @@
import { XmlComponent } from "@file/xml-components"; import { XmlComponent } from "@file/xml-components";
export class Seperator extends XmlComponent { export class Seperator extends XmlComponent {
constructor() { public constructor() {
super("w:separator"); super("w:separator");
} }
} }

View File

@ -7,7 +7,7 @@ import { SeperatorRun } from "./footnote/run/seperator-run";
import { FootnotesAttributes } from "./footnotes-attributes"; import { FootnotesAttributes } from "./footnotes-attributes";
export class FootNotes extends XmlComponent { export class FootNotes extends XmlComponent {
constructor() { public constructor() {
super("w:footnotes"); super("w:footnotes");
this.root.push( this.root.push(

View File

@ -17,7 +17,7 @@ export class HeaderWrapper implements IViewWrapper {
private readonly header: Header; private readonly header: Header;
private readonly relationships: Relationships; private readonly relationships: Relationships;
constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) { public constructor(private readonly media: Media, referenceId: number, initContent?: XmlComponent) {
this.header = new Header(referenceId, initContent); this.header = new Header(referenceId, initContent);
this.relationships = new Relationships(); this.relationships = new Relationships();
} }

View File

@ -6,9 +6,9 @@ export interface IHeaderOptions {
} }
export class Header { export class Header {
constructor(public readonly options: IHeaderOptions = { children: [] }) {} public constructor(public readonly options: IHeaderOptions = { children: [] }) {}
} }
export class Footer { export class Footer {
constructor(public readonly options: IHeaderOptions = { children: [] }) {} public constructor(public readonly options: IHeaderOptions = { children: [] }) {}
} }

View File

@ -7,7 +7,7 @@ import { HeaderAttributes } from "./header-attributes";
export class Header extends InitializableXmlComponent { export class Header extends InitializableXmlComponent {
private readonly refId: number; private readonly refId: number;
constructor(referenceNumber: number, initContent?: XmlComponent) { public constructor(referenceNumber: number, initContent?: XmlComponent) {
super("w:hdr", initContent); super("w:hdr", initContent);
this.refId = referenceNumber; this.refId = referenceNumber;

View File

@ -15,7 +15,7 @@ export interface IMediaTransformation {
export class Media { export class Media {
private readonly map: Map<string, IMediaData>; private readonly map: Map<string, IMediaData>;
constructor() { public constructor() {
this.map = new Map<string, IMediaData>(); this.map = new Map<string, IMediaData>();
} }

View File

@ -32,7 +32,7 @@ class AbstractNumberingAttributes extends XmlAttributeComponent<{
export class AbstractNumbering extends XmlComponent { export class AbstractNumbering extends XmlComponent {
public readonly id: number; public readonly id: number;
constructor(id: number, levelOptions: ILevelsOptions[]) { public constructor(id: number, levelOptions: ILevelsOptions[]) {
super("w:abstractNum"); super("w:abstractNum");
this.root.push( this.root.push(
new AbstractNumberingAttributes({ new AbstractNumberingAttributes({

View File

@ -38,7 +38,7 @@ class LevelAttributes extends XmlAttributeComponent<{
// <xsd:attribute name="format" type="s:ST_String" use="optional"/> // <xsd:attribute name="format" type="s:ST_String" use="optional"/>
// </xsd:complexType> // </xsd:complexType>
class NumberFormat extends XmlComponent { class NumberFormat extends XmlComponent {
constructor(value: string) { public constructor(value: string) {
super("w:numFmt"); super("w:numFmt");
this.root.push( this.root.push(
new Attributes({ new Attributes({
@ -53,7 +53,7 @@ class NumberFormat extends XmlComponent {
// <xsd:attribute name="null" type="s:ST_OnOff" use="optional"/> // <xsd:attribute name="null" type="s:ST_OnOff" use="optional"/>
// </xsd:complexType> // </xsd:complexType>
class LevelText extends XmlComponent { class LevelText extends XmlComponent {
constructor(value: string) { public constructor(value: string) {
super("w:lvlText"); super("w:lvlText");
this.root.push( this.root.push(
new Attributes({ new Attributes({
@ -64,7 +64,7 @@ class LevelText extends XmlComponent {
} }
class LevelJc extends XmlComponent { class LevelJc extends XmlComponent {
constructor(value: AlignmentType) { public constructor(value: AlignmentType) {
super("w:lvlJc"); super("w:lvlJc");
this.root.push( this.root.push(
new Attributes({ new Attributes({
@ -104,7 +104,7 @@ export interface ILevelsOptions {
// </xsd:restriction> // </xsd:restriction>
// </xsd:simpleType> // </xsd:simpleType>
class Suffix extends XmlComponent { class Suffix extends XmlComponent {
constructor(value: LevelSuffix) { public constructor(value: LevelSuffix) {
super("w:suff"); super("w:suff");
this.root.push( this.root.push(
new Attributes({ new Attributes({
@ -137,7 +137,7 @@ export class LevelBase extends XmlComponent {
private readonly paragraphProperties: ParagraphProperties; private readonly paragraphProperties: ParagraphProperties;
private readonly runProperties: RunProperties; private readonly runProperties: RunProperties;
constructor({ level, format, text, alignment = AlignmentType.START, start = 1, style, suffix }: ILevelsOptions) { public constructor({ level, format, text, alignment = AlignmentType.START, start = 1, style, suffix }: ILevelsOptions) {
super("w:lvl"); super("w:lvl");
this.root.push(new NumberValueElement("w:start", decimalNumber(start))); this.root.push(new NumberValueElement("w:start", decimalNumber(start)));
@ -180,7 +180,7 @@ export class LevelBase extends XmlComponent {
export class Level extends LevelBase { export class Level extends LevelBase {
// This is the level that sits under abstractNum. We make a // This is the level that sits under abstractNum. We make a
// handful of properties required // handful of properties required
constructor(options: ILevelsOptions) { public constructor(options: ILevelsOptions) {
super(options); super(options);
} }
} }

View File

@ -15,7 +15,7 @@ import { Attributes, XmlComponent } from "@file/xml-components";
// </xsd:restriction> // </xsd:restriction>
// </xsd:simpleType> // </xsd:simpleType>
export class MultiLevelType extends XmlComponent { export class MultiLevelType extends XmlComponent {
constructor(value: string) { public constructor(value: string) {
super("w:multiLevelType"); super("w:multiLevelType");
this.root.push( this.root.push(
new Attributes({ new Attributes({

View File

@ -2,7 +2,7 @@ import { Attributes, XmlAttributeComponent, XmlComponent } from "@file/xml-compo
import { decimalNumber } from "@util/values"; import { decimalNumber } from "@util/values";
class AbstractNumId extends XmlComponent { class AbstractNumId extends XmlComponent {
constructor(value: number) { public constructor(value: number) {
super("w:abstractNumId"); super("w:abstractNumId");
this.root.push( this.root.push(
new Attributes({ new Attributes({
@ -45,7 +45,7 @@ export class ConcreteNumbering extends XmlComponent {
public readonly reference: string; public readonly reference: string;
public readonly instance: number; public readonly instance: number;
constructor(options: IConcreteNumberingOptions) { public constructor(options: IConcreteNumberingOptions) {
super("w:num"); super("w:num");
this.numId = options.numId; this.numId = options.numId;
@ -71,7 +71,7 @@ class LevelOverrideAttributes extends XmlAttributeComponent<{ readonly ilvl: num
} }
export class LevelOverride extends XmlComponent { export class LevelOverride extends XmlComponent {
constructor(levelNum: number, start?: number) { public constructor(levelNum: number, start?: number) {
super("w:lvlOverride"); super("w:lvlOverride");
this.root.push(new LevelOverrideAttributes({ ilvl: levelNum })); this.root.push(new LevelOverrideAttributes({ ilvl: levelNum }));
if (start !== undefined) { if (start !== undefined) {
@ -85,7 +85,7 @@ class StartOverrideAttributes extends XmlAttributeComponent<{ readonly val: numb
} }
class StartOverride extends XmlComponent { class StartOverride extends XmlComponent {
constructor(start: number) { public constructor(start: number) {
super("w:startOverride"); super("w:startOverride");
this.root.push(new StartOverrideAttributes({ val: start })); this.root.push(new StartOverrideAttributes({ val: start }));
} }

View File

@ -31,7 +31,7 @@ export class Numbering extends XmlComponent {
private readonly concreteNumberingMap = new Map<string, ConcreteNumbering>(); private readonly concreteNumberingMap = new Map<string, ConcreteNumbering>();
private readonly referenceConfigMap = new Map<string, object>(); private readonly referenceConfigMap = new Map<string, object>();
constructor(options: INumberingOptions) { public constructor(options: INumberingOptions) {
super("w:numbering"); super("w:numbering");
this.root.push( this.root.push(
new DocumentAttributes({ new DocumentAttributes({

View File

@ -18,7 +18,7 @@ export class AlignmentAttributes extends XmlAttributeComponent<{ readonly val: A
} }
export class Alignment extends XmlComponent { export class Alignment extends XmlComponent {
constructor(type: AlignmentType) { public constructor(type: AlignmentType) {
super("w:jc"); super("w:jc");
this.root.push(new AlignmentAttributes({ val: type })); this.root.push(new AlignmentAttributes({ val: type }));
} }

View File

@ -10,7 +10,7 @@ export interface IBordersOptions {
} }
export class Border extends IgnoreIfEmptyXmlComponent { export class Border extends IgnoreIfEmptyXmlComponent {
constructor(options: IBordersOptions) { public constructor(options: IBordersOptions) {
super("w:pBdr"); super("w:pBdr");
if (options.top) { if (options.top) {
@ -32,7 +32,7 @@ export class Border extends IgnoreIfEmptyXmlComponent {
} }
export class ThematicBreak extends XmlComponent { export class ThematicBreak extends XmlComponent {
constructor() { public constructor() {
super("w:pBdr"); super("w:pBdr");
const bottom = new BorderElement("w:bottom", { const bottom = new BorderElement("w:bottom", {
color: "auto", color: "auto",

View File

@ -9,7 +9,7 @@ enum BreakType {
} }
class Break extends XmlComponent { class Break extends XmlComponent {
constructor(type: BreakType) { public constructor(type: BreakType) {
super("w:br"); super("w:br");
this.root.push( this.root.push(
new Attributes({ new Attributes({
@ -20,14 +20,14 @@ class Break extends XmlComponent {
} }
export class PageBreak extends Run { export class PageBreak extends Run {
constructor() { public constructor() {
super({}); super({});
this.root.push(new Break(BreakType.PAGE)); this.root.push(new Break(BreakType.PAGE));
} }
} }
export class ColumnBreak extends Run { export class ColumnBreak extends Run {
constructor() { public constructor() {
super({}); super({});
this.root.push(new Break(BreakType.COLUMN)); this.root.push(new Break(BreakType.COLUMN));
} }
@ -37,7 +37,7 @@ export class ColumnBreak extends Run {
* Add page break before the paragraph if there is no one added before. * Add page break before the paragraph if there is no one added before.
*/ */
export class PageBreakBefore extends XmlComponent { export class PageBreakBefore extends XmlComponent {
constructor() { public constructor() {
super("w:pageBreakBefore"); super("w:pageBreakBefore");
} }
} }

View File

@ -41,7 +41,7 @@ class IndentAttributes extends XmlAttributeComponent<IIndentAttributesProperties
// ... // ...
// <xsd:element name="ind" type="CT_Ind" minOccurs="0"/> // <xsd:element name="ind" type="CT_Ind" minOccurs="0"/>
export class Indent extends XmlComponent { export class Indent extends XmlComponent {
constructor({ start, end, left, right, hanging, firstLine }: IIndentAttributesProperties) { public constructor({ start, end, left, right, hanging, firstLine }: IIndentAttributesProperties) {
super("w:ind"); super("w:ind");
this.root.push( this.root.push(
new IndentAttributes({ new IndentAttributes({

View File

@ -25,7 +25,7 @@ class SpacingAttributes extends XmlAttributeComponent<ISpacingProperties> {
} }
export class Spacing extends XmlComponent { export class Spacing extends XmlComponent {
constructor(options: ISpacingProperties) { public constructor(options: ISpacingProperties) {
super("w:spacing"); super("w:spacing");
this.root.push(new SpacingAttributes(options)); this.root.push(new SpacingAttributes(options));
} }

View File

@ -11,7 +11,7 @@ export enum HeadingLevel {
} }
export class Style extends XmlComponent { export class Style extends XmlComponent {
constructor(styleId: string) { public constructor(styleId: string) {
super("w:pStyle"); super("w:pStyle");
this.root.push( this.root.push(
new Attributes({ new Attributes({

View File

@ -2,7 +2,7 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export class TabStop extends XmlComponent { export class TabStop extends XmlComponent {
constructor(type: TabStopType, position: number, leader?: LeaderType) { public constructor(type: TabStopType, position: number, leader?: LeaderType) {
super("w:tabs"); super("w:tabs");
this.root.push(new TabStopItem(type, position, leader)); this.root.push(new TabStopItem(type, position, leader));
} }
@ -41,7 +41,7 @@ export class TabAttributes extends XmlAttributeComponent<{
} }
export class TabStopItem extends XmlComponent { export class TabStopItem extends XmlComponent {
constructor(value: TabStopType, position: string | number, leader?: LeaderType) { public constructor(value: TabStopType, position: string | number, leader?: LeaderType) {
super("w:tab"); super("w:tab");
this.root.push( this.root.push(
new TabAttributes({ new TabAttributes({

View File

@ -1,7 +1,7 @@
import { Attributes, XmlComponent } from "@file/xml-components"; import { Attributes, XmlComponent } from "@file/xml-components";
export class NumberProperties extends XmlComponent { export class NumberProperties extends XmlComponent {
constructor(numberId: number | string, indentLevel: number) { public constructor(numberId: number | string, indentLevel: number) {
super("w:numPr"); super("w:numPr");
this.root.push(new IndentLevel(indentLevel)); this.root.push(new IndentLevel(indentLevel));
this.root.push(new NumberId(numberId)); this.root.push(new NumberId(numberId));
@ -9,7 +9,7 @@ export class NumberProperties extends XmlComponent {
} }
class IndentLevel extends XmlComponent { class IndentLevel extends XmlComponent {
constructor(level: number) { public constructor(level: number) {
super("w:ilvl"); super("w:ilvl");
if (level > 9) { if (level > 9) {
@ -27,7 +27,7 @@ class IndentLevel extends XmlComponent {
} }
class NumberId extends XmlComponent { class NumberId extends XmlComponent {
constructor(id: number | string) { public constructor(id: number | string) {
super("w:numId"); super("w:numId");
this.root.push( this.root.push(
new Attributes({ new Attributes({

View File

@ -97,7 +97,7 @@ export class FramePropertiesAttributes extends XmlAttributeComponent<{
} }
export class FrameProperties extends XmlComponent { export class FrameProperties extends XmlComponent {
constructor(options: IFrameOptions) { public constructor(options: IFrameOptions) {
super("w:framePr"); super("w:framePr");
this.root.push( this.root.push(
new FramePropertiesAttributes({ new FramePropertiesAttributes({

View File

@ -10,7 +10,7 @@ export class Bookmark {
public readonly children: ParagraphChild[]; public readonly children: ParagraphChild[];
public readonly end: BookmarkEnd; public readonly end: BookmarkEnd;
constructor(options: { readonly id: string; readonly children: ParagraphChild[] }) { public constructor(options: { readonly id: string; readonly children: ParagraphChild[] }) {
const linkId = uniqueNumericId(); const linkId = uniqueNumericId();
this.start = new BookmarkStart(options.id, linkId); this.start = new BookmarkStart(options.id, linkId);
@ -52,7 +52,7 @@ export class Bookmark {
// </xsd:complexType> // </xsd:complexType>
export class BookmarkStart extends XmlComponent { export class BookmarkStart extends XmlComponent {
constructor(id: string, linkId: number) { public constructor(id: string, linkId: number) {
super("w:bookmarkStart"); super("w:bookmarkStart");
const attributes = new BookmarkStartAttributes({ const attributes = new BookmarkStartAttributes({
@ -64,7 +64,7 @@ export class BookmarkStart extends XmlComponent {
} }
export class BookmarkEnd extends XmlComponent { export class BookmarkEnd extends XmlComponent {
constructor(linkId: number) { public constructor(linkId: number) {
super("w:bookmarkEnd"); super("w:bookmarkEnd");
const attributes = new BookmarkEndAttributes({ const attributes = new BookmarkEndAttributes({

View File

@ -13,7 +13,7 @@ export enum HyperlinkType {
export class ConcreteHyperlink extends XmlComponent { export class ConcreteHyperlink extends XmlComponent {
public readonly linkId: string; public readonly linkId: string;
constructor(children: ParagraphChild[], relationshipId: string, anchor?: string) { public constructor(children: ParagraphChild[], relationshipId: string, anchor?: string) {
super("w:hyperlink"); super("w:hyperlink");
this.linkId = relationshipId; this.linkId = relationshipId;
@ -33,13 +33,13 @@ export class ConcreteHyperlink extends XmlComponent {
} }
export class InternalHyperlink extends ConcreteHyperlink { export class InternalHyperlink extends ConcreteHyperlink {
constructor(options: { readonly children: ParagraphChild[]; readonly anchor: string }) { public constructor(options: { readonly children: ParagraphChild[]; readonly anchor: string }) {
super(options.children, uniqueId(), options.anchor); super(options.children, uniqueId(), options.anchor);
} }
} }
export class ExternalHyperlink extends XmlComponent { export class ExternalHyperlink extends XmlComponent {
constructor(public readonly options: { readonly children: ParagraphChild[]; readonly link: string }) { public constructor(public readonly options: { readonly children: ParagraphChild[]; readonly link: string }) {
super("w:externalHyperlink"); super("w:externalHyperlink");
} }
} }

View File

@ -2,7 +2,7 @@
import { Attributes, XmlComponent } from "@file/xml-components"; import { Attributes, XmlComponent } from "@file/xml-components";
export class OutlineLevel extends XmlComponent { export class OutlineLevel extends XmlComponent {
constructor(public readonly level: number) { public constructor(public readonly level: number) {
super("w:outlineLvl"); super("w:outlineLvl");
this.root.push( this.root.push(

View File

@ -5,7 +5,7 @@ import { TextAttributes } from "../run/text-attributes";
import { IPageReferenceOptions } from "./pageref-properties"; import { IPageReferenceOptions } from "./pageref-properties";
export class PageReferenceFieldInstruction extends XmlComponent { export class PageReferenceFieldInstruction extends XmlComponent {
constructor(bookmarkId: string, options: IPageReferenceOptions = {}) { public constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {
super("w:instrText"); super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));

View File

@ -5,7 +5,7 @@ import { PageReferenceFieldInstruction } from "./pageref-field-instruction";
import type { IPageReferenceOptions } from "./pageref-properties"; import type { IPageReferenceOptions } from "./pageref-properties";
export class PageReference extends Run { export class PageReference extends Run {
constructor(bookmarkId: string, options: IPageReferenceOptions = {}) { public constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {
super({ super({
children: [new Begin(true), new PageReferenceFieldInstruction(bookmarkId, options), new End()], children: [new Begin(true), new PageReferenceFieldInstruction(bookmarkId, options), new End()],
}); });

Some files were not shown because too many files have changed in this diff Show More