build(deps-dev): bump eslint from 8.57.1 to 9.13.0 (#2792)
* build(deps-dev): bump eslint from 8.57.1 to 9.13.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.13.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.57.1...v9.13.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Upgrade EsLint * Fix all new lint errors --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { AppPropertiesAttributes } from "./app-properties-attributes";
|
||||
|
||||
export class AppProperties extends XmlComponent {
|
||||
|
@ -22,7 +22,7 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { eighthPointMeasureValue, hexColorValue, pointMeasureValue } from "@util/values";
|
||||
|
||||
export interface IBorderOptions {
|
||||
export type IBorderOptions = {
|
||||
readonly style: (typeof BorderStyle)[keyof typeof BorderStyle];
|
||||
/** Border color, in hex (eg 'FF00AA') */
|
||||
readonly color?: string;
|
||||
@ -30,7 +30,7 @@ export interface IBorderOptions {
|
||||
readonly size?: number;
|
||||
/** Spacing offset. Values are specified in pt */
|
||||
readonly space?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export class BorderElement extends XmlComponent {
|
||||
public constructor(elementName: string, { color, size, space, style }: IBorderOptions) {
|
||||
@ -55,7 +55,6 @@ class BordersAttributes extends XmlAttributeComponent<IBorderOptions> {
|
||||
};
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const BorderStyle = {
|
||||
SINGLE: "single",
|
||||
DASH_DOT_STROKED: "dashDotStroked",
|
||||
@ -85,4 +84,3 @@ export const BorderStyle = {
|
||||
TRIPLE: "triple",
|
||||
WAVE: "wave",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { CheckBoxUtil } from ".";
|
||||
|
||||
describe("CheckBoxUtil", () => {
|
||||
|
@ -7,20 +7,20 @@
|
||||
// </xsd:complexType>
|
||||
// <xsd:element name="checkbox" type="CT_SdtCheckbox"/>
|
||||
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
import { CheckBoxSymbolElement } from "@file/checkbox/checkbox-symbol";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
export interface ICheckboxSymbolProperties {
|
||||
export type ICheckboxSymbolProperties = {
|
||||
readonly value?: string;
|
||||
readonly font?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export interface ICheckboxSymbolOptions {
|
||||
export type ICheckboxSymbolOptions = {
|
||||
readonly alias?: string;
|
||||
readonly checked?: boolean;
|
||||
readonly checkedState?: ICheckboxSymbolProperties;
|
||||
readonly uncheckedState?: ICheckboxSymbolProperties;
|
||||
}
|
||||
};
|
||||
|
||||
export class CheckBoxUtil extends XmlComponent {
|
||||
private readonly DEFAULT_UNCHECKED_SYMBOL: string = "2610";
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { CheckBox } from "./checkbox";
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { SymbolRun } from "@file/paragraph/run/symbol-run";
|
||||
import { StructuredDocumentTagProperties } from "@file/table-of-contents/sdt-properties";
|
||||
import { StructuredDocumentTagContent } from "@file/table-of-contents/sdt-content";
|
||||
import { StructuredDocumentTagProperties } from "@file/table-of-contents/sdt-properties";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { CheckBoxUtil, ICheckboxSymbolOptions } from "./checkbox-util";
|
||||
|
||||
export class CheckBox extends XmlComponent {
|
||||
|
@ -1,5 +1,3 @@
|
||||
// tslint:disable:no-string-literal
|
||||
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ContentTypeAttributes } from "./content-types-attributes";
|
||||
import { Default } from "./default/default";
|
||||
import { Override } from "./override/override";
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { DefaultAttributes } from "./default-attributes";
|
||||
|
||||
export class Default extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { OverrideAttributes } from "./override-attributes";
|
||||
|
||||
export class Override extends XmlComponent {
|
||||
|
@ -45,7 +45,7 @@ describe("Properties", () => {
|
||||
expect(tree["cp:coreProperties"]).to.be.an.instanceof(Array);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const key = (obj: { readonly [key: string]: any }) => Object.keys(obj)[0];
|
||||
const key = (obj: Readonly<Record<string, any>>) => Object.keys(obj)[0];
|
||||
expect(tree["cp:coreProperties"].map(key)).to.include.members([
|
||||
"_attr",
|
||||
"cp:keywords",
|
||||
|
@ -1,19 +1,18 @@
|
||||
import { FontOptions } from "@file/fonts/font-table";
|
||||
import { ICommentsOptions } from "@file/paragraph/run/comment-run";
|
||||
import { ICompatibilityOptions } from "@file/settings/compatibility";
|
||||
import { FontOptions } from "@file/fonts/font-table";
|
||||
import { StringContainer, XmlComponent } from "@file/xml-components";
|
||||
import { dateTimeValue } from "@util/values";
|
||||
|
||||
import { ICustomPropertyOptions } from "../custom-properties";
|
||||
import { IDocumentBackgroundOptions } from "../document";
|
||||
|
||||
import { DocumentAttributes } from "../document/document-attributes";
|
||||
import { ISectionOptions } from "../file";
|
||||
import { INumberingOptions } from "../numbering";
|
||||
import { Paragraph } from "../paragraph";
|
||||
import { IStylesOptions } from "../styles";
|
||||
|
||||
export interface IPropertiesOptions {
|
||||
export type IPropertiesOptions = {
|
||||
readonly sections: readonly ISectionOptions[];
|
||||
readonly title?: string;
|
||||
readonly subject?: string;
|
||||
@ -26,11 +25,14 @@ export interface IPropertiesOptions {
|
||||
readonly styles?: IStylesOptions;
|
||||
readonly numbering?: INumberingOptions;
|
||||
readonly comments?: ICommentsOptions;
|
||||
readonly footnotes?: {
|
||||
readonly [key: string]: {
|
||||
readonly children: readonly Paragraph[];
|
||||
};
|
||||
};
|
||||
readonly footnotes?: Readonly<
|
||||
Record<
|
||||
string,
|
||||
{
|
||||
readonly children: readonly Paragraph[];
|
||||
}
|
||||
>
|
||||
>;
|
||||
readonly background?: IDocumentBackgroundOptions;
|
||||
readonly features?: {
|
||||
readonly trackRevisions?: boolean;
|
||||
@ -42,7 +44,7 @@ export interface IPropertiesOptions {
|
||||
readonly evenAndOddHeaderAndFooters?: boolean;
|
||||
readonly defaultTabStop?: number;
|
||||
readonly fonts?: readonly FontOptions[];
|
||||
}
|
||||
};
|
||||
|
||||
// <xs:element name="coreProperties" type="CT_CoreProperties"/>
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { CustomPropertiesAttributes } from "./custom-properties-attributes";
|
||||
import { CustomProperty, ICustomPropertyOptions } from "./custom-property";
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { CustomPropertyAttributes } from "./custom-property-attributes";
|
||||
|
||||
export interface ICustomPropertyOptions {
|
||||
export type ICustomPropertyOptions = {
|
||||
readonly name: string;
|
||||
readonly value: string;
|
||||
}
|
||||
};
|
||||
|
||||
export class CustomProperty extends XmlComponent {
|
||||
public constructor(id: number, properties: ICustomPropertyOptions) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { XmlComponent } from "./xml-components";
|
||||
import { Document, IDocumentOptions } from "./document";
|
||||
import { Footer } from "./footer/footer";
|
||||
import { FootNotes } from "./footnotes";
|
||||
import { Header } from "./header/header";
|
||||
import { Relationships } from "./relationships";
|
||||
import { XmlComponent } from "./xml-components";
|
||||
|
||||
export interface IViewWrapper {
|
||||
export type IViewWrapper = {
|
||||
readonly View: Document | Footer | Header | FootNotes | XmlComponent;
|
||||
readonly Relationships: Relationships;
|
||||
}
|
||||
};
|
||||
|
||||
export class DocumentWrapper implements IViewWrapper {
|
||||
private readonly document: Document;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
|
||||
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
|
||||
|
||||
import { Column } from "./column";
|
||||
|
||||
|
@ -17,7 +17,6 @@ import { decimalNumber } from "@util/values";
|
||||
// <xsd:attribute name="charSpace" type="ST_DecimalNumber"/>
|
||||
// </xsd:complexType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const DocumentGridType = {
|
||||
DEFAULT: "default",
|
||||
LINES: "lines",
|
||||
@ -25,12 +24,11 @@ export const DocumentGridType = {
|
||||
SNAP_TO_CHARS: "snapToChars",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
export interface IDocGridAttributesProperties {
|
||||
export type IDocGridAttributesProperties = {
|
||||
readonly type?: (typeof DocumentGridType)[keyof typeof DocumentGridType];
|
||||
readonly linePitch?: number;
|
||||
readonly charSpace?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export class DocGridAttributes extends XmlAttributeComponent<IDocGridAttributesProperties> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./header-footer-reference";
|
||||
|
||||
describe("HeaderFooterReference", () => {
|
||||
|
@ -32,10 +32,10 @@ export const HeaderFooterReferenceType = {
|
||||
// <xsd:attribute ref="r:id" use="required"/>
|
||||
// </xsd:complexType>
|
||||
|
||||
export interface IHeaderFooterOptions {
|
||||
export type IHeaderFooterOptions = {
|
||||
readonly type?: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];
|
||||
readonly id?: number;
|
||||
}
|
||||
};
|
||||
|
||||
class FooterReferenceAttributes extends XmlAttributeComponent<{
|
||||
readonly type: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];
|
||||
|
@ -1,6 +1,6 @@
|
||||
// http://officeopenxml.com/WPsectionLineNumbering.php
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@util/values";
|
||||
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
|
||||
|
||||
// <xsd:simpleType name="ST_LineNumberRestart">
|
||||
// <xsd:restriction base="xsd:string">
|
||||
@ -10,13 +10,11 @@ import { decimalNumber, PositiveUniversalMeasure, twipsMeasureValue } from "@uti
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const LineNumberRestartFormat = {
|
||||
NEW_PAGE: "newPage",
|
||||
NEW_SECTION: "newSection",
|
||||
CONTINUOUS: "continuous",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
||||
// <xsd:complexType name="CT_LineNumber">
|
||||
// <xsd:attribute name="countBy" type="ST_DecimalNumber" use="optional"/>
|
||||
|
@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { Formatter } from "@export/formatter";
|
||||
import { BorderStyle } from "@file/border";
|
||||
|
||||
import { PageBorderDisplay, PageBorders, PageBorderZOrder } from "./page-borders";
|
||||
import { PageBorderDisplay, PageBorderZOrder, PageBorders } from "./page-borders";
|
||||
|
||||
describe("PageBorders", () => {
|
||||
describe("#constructor()", () => {
|
||||
|
@ -10,13 +10,11 @@ import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent } from "@file/xml-comp
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const PageBorderDisplay = {
|
||||
ALL_PAGES: "allPages",
|
||||
FIRST_PAGE: "firstPage",
|
||||
NOT_FIRST_PAGE: "notFirstPage",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
||||
// <xsd:simpleType name="ST_PageBorderOffset">
|
||||
// <xsd:restriction base="xsd:string">
|
||||
@ -40,19 +38,19 @@ export const PageBorderZOrder = {
|
||||
FRONT: "front",
|
||||
} as const;
|
||||
|
||||
export interface IPageBorderAttributes {
|
||||
export type IPageBorderAttributes = {
|
||||
readonly display?: (typeof PageBorderDisplay)[keyof typeof PageBorderDisplay];
|
||||
readonly offsetFrom?: (typeof PageBorderOffsetFrom)[keyof typeof PageBorderOffsetFrom];
|
||||
readonly zOrder?: (typeof PageBorderZOrder)[keyof typeof PageBorderZOrder];
|
||||
}
|
||||
};
|
||||
|
||||
export interface IPageBordersOptions {
|
||||
export type IPageBordersOptions = {
|
||||
readonly pageBorders?: IPageBorderAttributes;
|
||||
readonly pageBorderTop?: IBorderOptions;
|
||||
readonly pageBorderRight?: IBorderOptions;
|
||||
readonly pageBorderBottom?: IBorderOptions;
|
||||
readonly pageBorderLeft?: IBorderOptions;
|
||||
}
|
||||
};
|
||||
|
||||
class PageBordersAttributes extends XmlAttributeComponent<IPageBorderAttributes> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { PositiveUniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue, UniversalMeasure } from "@util/values";
|
||||
import { PositiveUniversalMeasure, UniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
|
||||
|
||||
// <xsd:complexType name="CT_PageMar">
|
||||
// <xsd:attribute name="top" type="ST_SignedTwipsMeasure" use="required"/>
|
||||
|
@ -13,7 +13,6 @@ import { decimalNumber } from "@util/values";
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const PageNumberSeparator = {
|
||||
HYPHEN: "hyphen",
|
||||
PERIOD: "period",
|
||||
@ -22,13 +21,11 @@ export const PageNumberSeparator = {
|
||||
EN_DASH: "endash",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
export interface IPageNumberTypeAttributes {
|
||||
export type IPageNumberTypeAttributes = {
|
||||
readonly start?: number;
|
||||
readonly formatType?: (typeof NumberFormat)[keyof typeof NumberFormat];
|
||||
readonly separator?: (typeof PageNumberSeparator)[keyof typeof PageNumberSeparator];
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_PageNumber">
|
||||
// <xsd:attribute name="fmt" type="ST_NumberFormat" use="optional" default="decimal"/>
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { PageTextDirection, PageTextDirectionType } from "./page-text-direction";
|
||||
|
||||
describe("PageTextDirection", () => {
|
||||
|
@ -1,13 +1,10 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const PageTextDirectionType = {
|
||||
LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
|
||||
TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
class PageTextDirectionAttributes extends XmlAttributeComponent<{
|
||||
readonly val: (typeof PageTextDirectionType)[keyof typeof PageTextDirectionType];
|
||||
}> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { SectionType, Type } from "./section-type";
|
||||
|
||||
describe("Type", () => {
|
||||
|
@ -11,7 +11,6 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const SectionType = {
|
||||
NEXT_PAGE: "nextPage",
|
||||
NEXT_COLUMN: "nextColumn",
|
||||
@ -19,7 +18,6 @@ export const SectionType = {
|
||||
EVEN_PAGE: "evenPage",
|
||||
ODD_PAGE: "oddPage",
|
||||
} as const;
|
||||
/* eslint-enable */
|
||||
|
||||
// <xsd:complexType name="CT_SectType">
|
||||
// <xsd:attribute name="val" type="ST_SectionMark"/>
|
||||
|
@ -15,7 +15,7 @@ import { LineNumberRestartFormat } from "./properties/line-number";
|
||||
import { PageBorderOffsetFrom } from "./properties/page-borders";
|
||||
import { PageTextDirectionType } from "./properties/page-text-direction";
|
||||
import { SectionType } from "./properties/section-type";
|
||||
import { sectionMarginDefaults, sectionPageSizeDefaults, SectionProperties } from "./section-properties";
|
||||
import { SectionProperties, sectionMarginDefaults, sectionPageSizeDefaults } from "./section-properties";
|
||||
|
||||
const DEFAULT_MARGINS = {
|
||||
"w:bottom": sectionMarginDefaults.BOTTOM,
|
||||
|
@ -1,14 +1,13 @@
|
||||
// http://officeopenxml.com/WPsection.php
|
||||
// tslint:disable: no-unnecessary-initializer
|
||||
|
||||
import { FooterWrapper } from "@file/footer-wrapper";
|
||||
import { HeaderWrapper } from "@file/header-wrapper";
|
||||
import { VerticalAlign, VerticalAlignElement } from "@file/vertical-align";
|
||||
import { OnOffElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
|
||||
import { Columns, IColumnsAttributes } from "./properties/columns";
|
||||
import { DocumentGrid, IDocGridAttributesProperties } from "./properties/doc-grid";
|
||||
import { HeaderFooterReference, HeaderFooterReferenceType, HeaderFooterType } from "./properties/header-footer-reference";
|
||||
import { ILineNumberAttributes, createLineNumberType } from "./properties/line-number";
|
||||
import { IPageBordersOptions, PageBorders } from "./properties/page-borders";
|
||||
import { IPageMarginAttributes, PageMargin } from "./properties/page-margin";
|
||||
@ -17,13 +16,13 @@ import { IPageSizeAttributes, PageOrientation, PageSize } from "./properties/pag
|
||||
import { PageTextDirection, PageTextDirectionType } from "./properties/page-text-direction";
|
||||
import { SectionType, Type } from "./properties/section-type";
|
||||
|
||||
export interface IHeaderFooterGroup<T> {
|
||||
export type IHeaderFooterGroup<T> = {
|
||||
readonly default?: T;
|
||||
readonly first?: T;
|
||||
readonly even?: T;
|
||||
}
|
||||
};
|
||||
|
||||
export interface ISectionPropertiesOptions {
|
||||
export type ISectionPropertiesOptions = {
|
||||
readonly page?: {
|
||||
readonly size?: IPageSizeAttributes;
|
||||
readonly margin?: IPageMarginAttributes;
|
||||
@ -39,7 +38,7 @@ export interface ISectionPropertiesOptions {
|
||||
readonly verticalAlign?: (typeof VerticalAlign)[keyof typeof VerticalAlign];
|
||||
readonly column?: IColumnsAttributes;
|
||||
readonly type?: (typeof SectionType)[keyof typeof SectionType];
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_SectPr">
|
||||
// <xsd:sequence>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { XmlAttributeComponent } from "@file/xml-components";
|
||||
|
||||
/* cSpell:disable */
|
||||
export interface IDocumentAttributesProperties {
|
||||
export type IDocumentAttributesProperties = {
|
||||
readonly wpc?: string;
|
||||
readonly mc?: string;
|
||||
readonly o?: string;
|
||||
@ -41,7 +41,7 @@ export interface IDocumentAttributesProperties {
|
||||
readonly w16?: string;
|
||||
readonly w16sdtdh?: string;
|
||||
readonly w16se?: string;
|
||||
}
|
||||
};
|
||||
/* cSpell:enable */
|
||||
|
||||
export class DocumentAttributes extends XmlAttributeComponent<IDocumentAttributesProperties> {
|
||||
|
@ -39,12 +39,12 @@ export class DocumentBackgroundAttributes extends XmlAttributeComponent<{
|
||||
};
|
||||
}
|
||||
|
||||
export interface IDocumentBackgroundOptions {
|
||||
export type IDocumentBackgroundOptions = {
|
||||
readonly color?: string;
|
||||
readonly themeColor?: string;
|
||||
readonly themeShade?: string;
|
||||
readonly themeTint?: string;
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_Background">
|
||||
// <xsd:sequence>
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/WPdocument.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ConcreteHyperlink, Paragraph } from "../paragraph";
|
||||
import { Table } from "../table";
|
||||
import { TableOfContents } from "../table-of-contents";
|
||||
@ -7,9 +8,9 @@ import { Body } from "./body";
|
||||
import { DocumentAttributes } from "./document-attributes";
|
||||
import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background";
|
||||
|
||||
export interface IDocumentOptions {
|
||||
export type IDocumentOptions = {
|
||||
readonly background?: IDocumentBackgroundOptions;
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:element name="document" type="CT_Document"/>
|
||||
//
|
||||
@ -80,7 +81,6 @@ export class Document extends XmlComponent {
|
||||
}
|
||||
|
||||
public add(item: Paragraph | Table | TableOfContents | ConcreteHyperlink): Document {
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
this.body.push(item);
|
||||
return this;
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { XmlAttributeComponent } from "@file/xml-components";
|
||||
|
||||
import { IDistance } from "../drawing";
|
||||
|
||||
export interface IAnchorAttributes extends IDistance {
|
||||
export type IAnchorAttributes = {
|
||||
readonly allowOverlap?: "0" | "1";
|
||||
readonly behindDoc?: "0" | "1";
|
||||
readonly layoutInCell?: "0" | "1";
|
||||
readonly locked?: "0" | "1";
|
||||
readonly relativeHeight?: number;
|
||||
readonly simplePos?: "0" | "1";
|
||||
}
|
||||
} & IDistance;
|
||||
|
||||
export class AnchorAttributes extends XmlAttributeComponent<IAnchorAttributes> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { assert, describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { Utility } from "tests/utility";
|
||||
|
||||
import { IDrawingOptions } from "../drawing";
|
||||
|
@ -1,6 +1,7 @@
|
||||
// http://officeopenxml.com/drwPicFloating.php
|
||||
import { IMediaData, IMediaDataTransformation } from "@file/media";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { IDrawingOptions } from "../drawing";
|
||||
import { HorizontalPosition, IFloating, SimplePos, VerticalPosition } from "../floating";
|
||||
import { Graphic } from "../inline/graphic";
|
||||
|
@ -1,7 +1,6 @@
|
||||
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_docPr_topic_ID0ES32OB.html
|
||||
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { ConcreteHyperlink } from "@file/paragraph";
|
||||
|
||||
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { docPropertiesUniqueNumericIdGen } from "@util/convenience-functions";
|
||||
|
||||
import { createHyperlinkClick } from "./doc-properties-children";
|
||||
@ -18,11 +17,11 @@ import { createHyperlinkClick } from "./doc-properties-children";
|
||||
// <attribute name="hidden" type="xsd:boolean" use="optional" default="false" />
|
||||
// </complexType>
|
||||
|
||||
export interface DocPropertiesOptions {
|
||||
export type DocPropertiesOptions = {
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly title: string;
|
||||
}
|
||||
};
|
||||
|
||||
export class DocProperties extends XmlComponent {
|
||||
private readonly docPropertiesUniqueNumericId = docPropertiesUniqueNumericIdGen();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { IContext } from "@file/xml-components";
|
||||
import { Formatter } from "@export/formatter";
|
||||
import { IContext } from "@file/xml-components";
|
||||
|
||||
import { ConcreteHyperlink, TextRun } from "../";
|
||||
import { Drawing, IDrawingOptions } from "./drawing";
|
||||
@ -80,7 +80,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:graphicFrameLocks": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
noChangeAspect: 1,
|
||||
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||
},
|
||||
@ -139,7 +138,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:blip": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
cstate: "none",
|
||||
"r:embed": "rId{test.jpg}",
|
||||
},
|
||||
@ -311,7 +309,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:graphicFrameLocks": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
noChangeAspect: 1,
|
||||
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||
},
|
||||
@ -370,7 +367,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:blip": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
cstate: "none",
|
||||
"r:embed": "rId{test.jpg}",
|
||||
},
|
||||
@ -554,7 +550,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:graphicFrameLocks": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
noChangeAspect: 1,
|
||||
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
||||
},
|
||||
@ -622,7 +617,6 @@ describe("Drawing", () => {
|
||||
{
|
||||
"a:blip": {
|
||||
_attr: {
|
||||
// tslint:disable-next-line:object-literal-key-quotes
|
||||
cstate: "none",
|
||||
"r:embed": "rId{test.jpg}",
|
||||
},
|
||||
|
@ -14,11 +14,11 @@ export type IDistance = {
|
||||
readonly distR?: number;
|
||||
};
|
||||
|
||||
export interface IDrawingOptions {
|
||||
export type IDrawingOptions = {
|
||||
readonly floating?: IFloating;
|
||||
readonly docProperties?: DocPropertiesOptions;
|
||||
readonly outline?: OutlineOptions;
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_Drawing">
|
||||
// <xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
|
@ -4,7 +4,6 @@ import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/ali
|
||||
|
||||
import { ITextWrapping } from "../text-wrap";
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const HorizontalPositionRelativeFrom = {
|
||||
CHARACTER: "character",
|
||||
COLUMN: "column",
|
||||
@ -27,27 +26,26 @@ export const VerticalPositionRelativeFrom = {
|
||||
TOP_MARGIN: "topMargin",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
export interface IHorizontalPositionOptions {
|
||||
export type IHorizontalPositionOptions = {
|
||||
readonly relative?: (typeof HorizontalPositionRelativeFrom)[keyof typeof HorizontalPositionRelativeFrom];
|
||||
readonly align?: (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign];
|
||||
readonly offset?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IVerticalPositionOptions {
|
||||
export type IVerticalPositionOptions = {
|
||||
readonly relative?: (typeof VerticalPositionRelativeFrom)[keyof typeof VerticalPositionRelativeFrom];
|
||||
readonly align?: (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign];
|
||||
readonly offset?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IMargins {
|
||||
export type IMargins = {
|
||||
readonly left?: number;
|
||||
readonly bottom?: number;
|
||||
readonly top?: number;
|
||||
readonly right?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IFloating {
|
||||
export type IFloating = {
|
||||
readonly horizontalPosition: IHorizontalPositionOptions;
|
||||
readonly verticalPosition: IVerticalPositionOptions;
|
||||
readonly allowOverlap?: boolean;
|
||||
@ -57,4 +55,4 @@ export interface IFloating {
|
||||
readonly margins?: IMargins;
|
||||
readonly wrap?: ITextWrapping;
|
||||
readonly zIndex?: number;
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwPicFloating-position.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Align } from "./align";
|
||||
import { HorizontalPositionRelativeFrom, IHorizontalPositionOptions } from "./floating-position";
|
||||
import { PositionOffset } from "./position-offset";
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwPicFloating-position.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Align } from "./align";
|
||||
import { IVerticalPositionOptions, VerticalPositionRelativeFrom } from "./floating-position";
|
||||
import { PositionOffset } from "./position-offset";
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { GraphicFrameLockAttributes } from "./graphic-frame-lock-attributes";
|
||||
|
||||
export class GraphicFrameLocks extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { GraphicFrameLocks } from "./graphic-frame-locks/graphic-frame-locks";
|
||||
|
||||
export class GraphicFrameProperties extends XmlComponent {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
import { IMediaData } from "@file/media";
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
const createSvgBlip = (mediaData: IMediaData): XmlComponent =>
|
||||
new BuilderElement({
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { IMediaData } from "@file/media";
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { createExtentionList } from "./blip-extentions";
|
||||
|
||||
type BlipAttributes = {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { PicLocks } from "./pic-locks/pic-locks";
|
||||
|
||||
export class ChildNonVisualProperties extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { PicLocksAttributes } from "./pic-locks-attributes";
|
||||
|
||||
export class PicLocks extends XmlComponent {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ChildNonVisualProperties } from "./child-non-visual-pic-properties/child-non-visual-pic-properties";
|
||||
import { NonVisualProperties } from "./non-visual-properties/non-visual-properties";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||
import { createHyperlinkClick } from "@file/drawing/doc-properties/doc-properties-children";
|
||||
import { ConcreteHyperlink } from "@file/paragraph";
|
||||
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { NonVisualPropertiesAttributes } from "./non-visual-properties-attributes";
|
||||
|
||||
|
@ -5,8 +5,8 @@ import { XmlComponent } from "@file/xml-components";
|
||||
import { BlipFill } from "./blip/blip-fill";
|
||||
import { NonVisualPicProperties } from "./non-visual-pic-properties/non-visual-pic-properties";
|
||||
import { PicAttributes } from "./pic-attributes";
|
||||
import { ShapeProperties } from "./shape-properties/shape-properties";
|
||||
import { OutlineOptions } from "./shape-properties/outline/outline";
|
||||
import { ShapeProperties } from "./shape-properties/shape-properties";
|
||||
|
||||
export class Pic extends XmlComponent {
|
||||
public constructor({
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { Form } from "./form/form";
|
||||
|
||||
describe("Form", () => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwSp-size.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { ExtentsAttributes } from "./extents-attributes";
|
||||
|
||||
export class Extents extends XmlComponent {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwSp-size.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { OffsetAttributes } from "./off-attributes";
|
||||
|
||||
export class Offset extends XmlComponent {
|
||||
|
@ -1,8 +1,9 @@
|
||||
// http://officeopenxml.com/drwSp-outline.php
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { createNoFill } from "./no-fill";
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
import { SchemeColor } from "./scheme-color";
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
|
||||
// <xsd:complexType name="CT_TextOutlineEffect">
|
||||
// <xsd:sequence>
|
||||
|
@ -2,8 +2,8 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
import { SchemeColor } from "./scheme-color";
|
||||
import { createSolidFill } from "./solid-fill";
|
||||
|
||||
describe("createSolidFill", () => {
|
||||
it("should create of rgb", () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { createSchemeColor, SchemeColor } from "./scheme-color";
|
||||
import { createSolidRgbColor } from "./rgb-color";
|
||||
import { SchemeColor, createSchemeColor } from "./scheme-color";
|
||||
|
||||
export type RgbColorOptions = {
|
||||
readonly type: "rgb";
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/drwSp-prstGeom.php
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { AdjustmentValues } from "./adjustment-values/adjustment-values";
|
||||
import { PresetGeometryAttributes } from "./preset-geometry-attributes";
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
// http://officeopenxml.com/drwSp-SpPr.php
|
||||
import { IMediaDataTransformation } from "@file/media";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Form } from "./form";
|
||||
import { createNoFill } from "./outline/no-fill";
|
||||
import { OutlineOptions, createOutline } from "./outline/outline";
|
||||
import { PresetGeometry } from "./preset-geometry/preset-geometry";
|
||||
import { ShapePropertiesAttributes } from "./shape-properties-attributes";
|
||||
import { createNoFill } from "./outline/no-fill";
|
||||
|
||||
export class ShapeProperties extends XmlComponent {
|
||||
private readonly form: Form;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { createInline } from "./inline";
|
||||
|
||||
describe("Inline", () => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
// http://officeopenxml.com/drwPicInline.php
|
||||
import { IMediaData, IMediaDataTransformation } from "@file/media";
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { DocProperties, DocPropertiesOptions } from "./../doc-properties/doc-properties";
|
||||
import { createEffectExtent } from "./../effect-extent/effect-extent";
|
||||
import { Extent } from "./../extent/extent";
|
||||
|
@ -1,7 +1,6 @@
|
||||
// http://officeopenxml.com/drwPicFloating-textWrap.php
|
||||
import { IDistance } from "../drawing";
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const TextWrappingType = {
|
||||
NONE: 0,
|
||||
SQUARE: 1,
|
||||
@ -16,10 +15,8 @@ export const TextWrappingSide = {
|
||||
LARGEST: "largest",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
export interface ITextWrapping {
|
||||
export type ITextWrapping = {
|
||||
readonly type: (typeof TextWrappingType)[keyof typeof TextWrappingType];
|
||||
readonly side?: (typeof TextWrappingSide)[keyof typeof TextWrappingSide];
|
||||
readonly margins?: IDistance;
|
||||
}
|
||||
};
|
||||
|
@ -5,9 +5,9 @@ import { IDistance } from "../drawing";
|
||||
import { IMargins } from "../floating";
|
||||
import { ITextWrapping, TextWrappingSide } from "./text-wrapping";
|
||||
|
||||
interface IWrapSquareAttributes extends IDistance {
|
||||
type IWrapSquareAttributes = {
|
||||
readonly wrapText?: (typeof TextWrappingSide)[keyof typeof TextWrappingSide];
|
||||
}
|
||||
} & IDistance;
|
||||
|
||||
class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -2,8 +2,10 @@ import { AppProperties } from "./app-properties/app-properties";
|
||||
import { ContentTypes } from "./content-types/content-types";
|
||||
import { CoreProperties, IPropertiesOptions } from "./core-properties";
|
||||
import { CustomProperties } from "./custom-properties";
|
||||
import { DocumentWrapper } from "./document-wrapper";
|
||||
import { HeaderFooterReferenceType, ISectionPropertiesOptions } from "./document/body/section-properties";
|
||||
import { DocumentWrapper } from "./document-wrapper";
|
||||
import { FileChild } from "./file-child";
|
||||
import { FontWrapper } from "./fonts/font-wrapper";
|
||||
import { FooterWrapper, IDocumentFooter } from "./footer-wrapper";
|
||||
import { FootnotesWrapper } from "./footnotes-wrapper";
|
||||
import { Footer, Header } from "./header";
|
||||
@ -16,10 +18,8 @@ import { Settings } from "./settings";
|
||||
import { Styles } from "./styles";
|
||||
import { ExternalStylesFactory } from "./styles/external-styles-factory";
|
||||
import { DefaultStylesFactory } from "./styles/factory";
|
||||
import { FileChild } from "./file-child";
|
||||
import { FontWrapper } from "./fonts/font-wrapper";
|
||||
|
||||
export interface ISectionOptions {
|
||||
export type ISectionOptions = {
|
||||
readonly headers?: {
|
||||
readonly default?: Header;
|
||||
readonly first?: Header;
|
||||
@ -32,7 +32,7 @@ export interface ISectionOptions {
|
||||
};
|
||||
readonly properties?: ISectionPropertiesOptions;
|
||||
readonly children: readonly FileChild[];
|
||||
}
|
||||
};
|
||||
|
||||
export class File {
|
||||
// eslint-disable-next-line functional/prefer-readonly-type
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { createRegularFont } from "./create-regular-font";
|
||||
import { FontOptionsWithKey } from "./font-wrapper";
|
||||
import { CharacterSet } from "./font";
|
||||
import { FontOptionsWithKey } from "./font-wrapper";
|
||||
|
||||
// <xsd:complexType name="CT_FontsList">
|
||||
// <xsd:sequence>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BuilderElement, createStringElement, OnOffElement, XmlComponent } from "@file/xml-components";
|
||||
import { BuilderElement, OnOffElement, XmlComponent, createStringElement } from "@file/xml-components";
|
||||
|
||||
// <xsd:complexType name="CT_Font">
|
||||
// <xsd:sequence>
|
||||
@ -27,7 +27,7 @@ import { BuilderElement, createStringElement, OnOffElement, XmlComponent } from
|
||||
// </xsd:complexType>
|
||||
|
||||
// http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
|
||||
export interface IFontRelationshipOptions {
|
||||
export type IFontRelationshipOptions = {
|
||||
/**
|
||||
* Relationship to Part
|
||||
*/
|
||||
@ -40,7 +40,7 @@ export interface IFontRelationshipOptions {
|
||||
* Embedded Font Is Subsetted
|
||||
*/
|
||||
readonly subsetted?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export const CharacterSet = {
|
||||
ANSI: "00",
|
||||
|
@ -8,10 +8,10 @@ import { Paragraph } from "./paragraph";
|
||||
import { Relationships } from "./relationships";
|
||||
import { Table } from "./table";
|
||||
|
||||
export interface IDocumentFooter {
|
||||
export type IDocumentFooter = {
|
||||
readonly footer: FooterWrapper;
|
||||
readonly type: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];
|
||||
}
|
||||
};
|
||||
|
||||
export class FooterWrapper implements IViewWrapper {
|
||||
private readonly footer: Footer;
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/WPfooters.php
|
||||
import { InitializableXmlComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Paragraph } from "../paragraph";
|
||||
import { Table } from "../table";
|
||||
import { FooterAttributes } from "./footer-attributes";
|
||||
|
@ -6,15 +6,15 @@ import { FootnoteRefRun } from "./run/footnote-ref-run";
|
||||
|
||||
export const FootnoteType = {
|
||||
SEPERATOR: "separator",
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
|
||||
CONTINUATION_SEPERATOR: "continuationSeparator",
|
||||
} as const;
|
||||
|
||||
export interface IFootnoteOptions {
|
||||
export type IFootnoteOptions = {
|
||||
readonly id: number;
|
||||
readonly type?: (typeof FootnoteType)[keyof typeof FootnoteType];
|
||||
readonly children: readonly Paragraph[];
|
||||
}
|
||||
};
|
||||
|
||||
export class Footnote extends XmlComponent {
|
||||
public constructor(options: IFootnoteOptions) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Run } from "@file/paragraph";
|
||||
|
||||
import { ContinuationSeperator } from "./continuation-seperator";
|
||||
|
||||
export class ContinuationSeperatorRun extends Run {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Run } from "@file/paragraph";
|
||||
|
||||
import { Seperator } from "./seperator";
|
||||
|
||||
export class SeperatorRun extends Run {
|
||||
|
@ -8,10 +8,10 @@ import { Paragraph } from "./paragraph";
|
||||
import { Relationships } from "./relationships";
|
||||
import { Table } from "./table";
|
||||
|
||||
export interface IDocumentHeader {
|
||||
export type IDocumentHeader = {
|
||||
readonly header: HeaderWrapper;
|
||||
readonly type: (typeof HeaderFooterReferenceType)[keyof typeof HeaderFooterReferenceType];
|
||||
}
|
||||
};
|
||||
|
||||
export class HeaderWrapper implements IViewWrapper {
|
||||
private readonly header: Header;
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Paragraph } from "./paragraph";
|
||||
import { Table } from "./table";
|
||||
|
||||
export interface IHeaderOptions {
|
||||
export type IHeaderOptions = {
|
||||
readonly children: readonly (Paragraph | Table)[];
|
||||
}
|
||||
};
|
||||
|
||||
export class Header {
|
||||
public readonly options: IHeaderOptions;
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/WPheaders.php
|
||||
import { InitializableXmlComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Paragraph } from "../paragraph";
|
||||
import { Table } from "../table";
|
||||
import { HeaderAttributes } from "./header-attributes";
|
||||
|
@ -1,4 +1,4 @@
|
||||
export interface IMediaDataTransformation {
|
||||
export type IMediaDataTransformation = {
|
||||
readonly pixels: {
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
@ -12,7 +12,7 @@ export interface IMediaDataTransformation {
|
||||
readonly horizontal?: boolean;
|
||||
};
|
||||
readonly rotation?: number;
|
||||
}
|
||||
};
|
||||
|
||||
type CoreMediaData = {
|
||||
readonly fileName: string;
|
||||
|
@ -1,4 +1,3 @@
|
||||
// tslint:disable:object-literal-key-quotes
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import * as convenienceFunctions from "@util/convenience-functions";
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IMediaData } from "./data";
|
||||
|
||||
export interface IMediaTransformation {
|
||||
export type IMediaTransformation = {
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
readonly flip?: {
|
||||
@ -8,7 +8,7 @@ export interface IMediaTransformation {
|
||||
readonly horizontal?: boolean;
|
||||
};
|
||||
readonly rotation?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export class Media {
|
||||
// eslint-disable-next-line functional/prefer-readonly-type
|
||||
|
@ -3,8 +3,8 @@ import { describe, expect, it } from "vitest";
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { AlignmentType, EmphasisMarkType, TabStopPosition } from "../paragraph";
|
||||
import { UnderlineType } from "../paragraph/run/underline";
|
||||
import { HighlightColor } from "../paragraph/run/properties";
|
||||
import { UnderlineType } from "../paragraph/run/underline";
|
||||
import { ShadingType } from "../shading";
|
||||
import { AbstractNumbering } from "./abstract-numbering";
|
||||
import { LevelFormat, LevelSuffix } from "./level";
|
||||
|
@ -202,7 +202,7 @@ export const LevelSuffix = {
|
||||
TAB: "tab",
|
||||
} as const;
|
||||
|
||||
export interface ILevelsOptions {
|
||||
export type ILevelsOptions = {
|
||||
readonly level: number;
|
||||
readonly format?: (typeof LevelFormat)[keyof typeof LevelFormat];
|
||||
readonly text?: string;
|
||||
@ -214,7 +214,7 @@ export interface ILevelsOptions {
|
||||
readonly run?: IRunStylePropertiesOptions;
|
||||
readonly paragraph?: ILevelParagraphStylePropertiesOptions;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_LevelSuffix">
|
||||
// <xsd:attribute name="val" type="ST_LevelSuffix" use="required"/>
|
||||
|
@ -18,18 +18,18 @@ class NumAttributes extends XmlAttributeComponent<{
|
||||
protected readonly xmlKeys = { numId: "w:numId" };
|
||||
}
|
||||
|
||||
interface IOverrideLevel {
|
||||
type IOverrideLevel = {
|
||||
readonly num: number;
|
||||
readonly start?: number;
|
||||
}
|
||||
};
|
||||
|
||||
export interface IConcreteNumberingOptions {
|
||||
export type IConcreteNumberingOptions = {
|
||||
readonly numId: number;
|
||||
readonly abstractNumId: number;
|
||||
readonly reference: string;
|
||||
readonly instance: number;
|
||||
readonly overrideLevels?: readonly IOverrideLevel[];
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_Numbering">
|
||||
// ...
|
||||
|
@ -4,17 +4,17 @@ import { AlignmentType } from "@file/paragraph";
|
||||
import { IContext, IXmlableObject, XmlComponent } from "@file/xml-components";
|
||||
import { abstractNumUniqueNumericIdGen, concreteNumUniqueNumericIdGen, convertInchesToTwip } from "@util/convenience-functions";
|
||||
|
||||
import { DocumentAttributes } from "../document/document-attributes";
|
||||
import { AbstractNumbering } from "./abstract-numbering";
|
||||
import { ILevelsOptions, LevelFormat } from "./level";
|
||||
import { ConcreteNumbering } from "./num";
|
||||
import { DocumentAttributes } from "../document/document-attributes";
|
||||
|
||||
export interface INumberingOptions {
|
||||
export type INumberingOptions = {
|
||||
readonly config: readonly {
|
||||
readonly levels: readonly ILevelsOptions[];
|
||||
readonly reference: string;
|
||||
}[];
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:element name="numbering" type="CT_Numbering"/>
|
||||
//
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { Alignment, AlignmentType } from "./alignment";
|
||||
|
||||
describe("Alignment", () => {
|
||||
|
@ -20,7 +20,6 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
// </xsd:restriction>
|
||||
// </xsd:simpleType>
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const AlignmentType = {
|
||||
/** Align Start */
|
||||
START: "start",
|
||||
@ -50,8 +49,6 @@ export const AlignmentType = {
|
||||
JUSTIFIED: "both",
|
||||
} as const;
|
||||
|
||||
/* eslint-enable */
|
||||
|
||||
export class AlignmentAttributes extends XmlAttributeComponent<{
|
||||
readonly val: (typeof AlignmentType)[keyof typeof AlignmentType];
|
||||
}> {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { BorderStyle } from "@file/border";
|
||||
|
||||
import { Border, ThematicBreak } from "./border";
|
||||
|
||||
describe("Border", () => {
|
||||
|
@ -2,12 +2,12 @@
|
||||
import { BorderElement, BorderStyle, IBorderOptions } from "@file/border";
|
||||
import { IgnoreIfEmptyXmlComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
export interface IBordersOptions {
|
||||
export type IBordersOptions = {
|
||||
readonly top?: IBorderOptions;
|
||||
readonly bottom?: IBorderOptions;
|
||||
readonly left?: IBorderOptions;
|
||||
readonly right?: IBorderOptions;
|
||||
}
|
||||
};
|
||||
|
||||
export class Border extends IgnoreIfEmptyXmlComponent {
|
||||
public constructor(options: IBordersOptions) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://officeopenxml.com/WPtextSpecialContent-break.php
|
||||
import { Attributes, XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { Run } from "../run";
|
||||
|
||||
const BreakType = {
|
||||
|
@ -1,15 +1,15 @@
|
||||
// http://officeopenxml.com/WPindentation.php
|
||||
import { NextAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { PositiveUniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue, UniversalMeasure } from "@util/values";
|
||||
import { PositiveUniversalMeasure, UniversalMeasure, signedTwipsMeasureValue, twipsMeasureValue } from "@util/values";
|
||||
|
||||
export interface IIndentAttributesProperties {
|
||||
export type IIndentAttributesProperties = {
|
||||
readonly start?: number | UniversalMeasure;
|
||||
readonly end?: number | UniversalMeasure;
|
||||
readonly left?: number | UniversalMeasure;
|
||||
readonly right?: number | UniversalMeasure;
|
||||
readonly hanging?: number | PositiveUniversalMeasure;
|
||||
readonly firstLine?: number | PositiveUniversalMeasure;
|
||||
}
|
||||
};
|
||||
|
||||
// <xsd:complexType name="CT_PPrBase">
|
||||
// <xsd:sequence>
|
||||
|
@ -2,21 +2,20 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
export const LineRuleType = {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AT_LEAST: "atLeast",
|
||||
EXACTLY: "exactly",
|
||||
EXACT: "exact",
|
||||
AUTO: "auto",
|
||||
} as const;
|
||||
|
||||
export interface ISpacingProperties {
|
||||
export type ISpacingProperties = {
|
||||
readonly after?: number;
|
||||
readonly before?: number;
|
||||
readonly line?: number;
|
||||
readonly lineRule?: (typeof LineRuleType)[keyof typeof LineRuleType];
|
||||
readonly beforeAutoSpacing?: boolean;
|
||||
readonly afterAutoSpacing?: boolean;
|
||||
}
|
||||
};
|
||||
|
||||
class SpacingAttributes extends XmlAttributeComponent<ISpacingProperties> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,11 +1,11 @@
|
||||
// http://officeopenxml.com/WPtab.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
|
||||
export interface TabStopDefinition {
|
||||
export type TabStopDefinition = {
|
||||
readonly type: (typeof TabStopType)[keyof typeof TabStopType];
|
||||
readonly position: number | (typeof TabStopPosition)[keyof typeof TabStopPosition];
|
||||
readonly leader?: (typeof LeaderType)[keyof typeof LeaderType];
|
||||
}
|
||||
};
|
||||
|
||||
export class TabStop extends XmlComponent {
|
||||
public constructor(tabDefinitions: readonly TabStopDefinition[]) {
|
||||
@ -32,7 +32,7 @@ export const TabStopType = {
|
||||
export const LeaderType = {
|
||||
DOT: "dot",
|
||||
HYPHEN: "hyphen",
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
|
||||
MIDDLE_DOT: "middleDot",
|
||||
NONE: "none",
|
||||
UNDERSCORE: "underscore",
|
||||
|
@ -19,13 +19,13 @@ export const FrameWrap = {
|
||||
AROUND: "around",
|
||||
AUTO: "auto",
|
||||
NONE: "none",
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
|
||||
NOT_BESIDE: "notBeside",
|
||||
THROUGH: "through",
|
||||
TIGHT: "tight",
|
||||
} as const;
|
||||
|
||||
interface IBaseFrameOptions {
|
||||
type IBaseFrameOptions = {
|
||||
readonly anchorLock?: boolean;
|
||||
readonly dropCap?: (typeof DropCapType)[keyof typeof DropCapType];
|
||||
readonly width: number;
|
||||
@ -41,23 +41,23 @@ interface IBaseFrameOptions {
|
||||
readonly vertical: number;
|
||||
};
|
||||
readonly rule?: (typeof HeightRule)[keyof typeof HeightRule];
|
||||
}
|
||||
};
|
||||
|
||||
export interface IXYFrameOptions extends IBaseFrameOptions {
|
||||
export type IXYFrameOptions = {
|
||||
readonly type: "absolute";
|
||||
readonly position: {
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
};
|
||||
}
|
||||
} & IBaseFrameOptions;
|
||||
|
||||
export interface IAlignmentFrameOptions extends IBaseFrameOptions {
|
||||
export type IAlignmentFrameOptions = {
|
||||
readonly type: "alignment";
|
||||
readonly alignment: {
|
||||
readonly x: (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign];
|
||||
readonly y: (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign];
|
||||
};
|
||||
}
|
||||
} & IBaseFrameOptions;
|
||||
|
||||
// Be wary of Typescript's Open types:
|
||||
// https://stackoverflow.com/q/46370222/3481582
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { XmlAttributeComponent } from "@file/xml-components";
|
||||
|
||||
export interface IHyperlinkAttributesProperties {
|
||||
export type IHyperlinkAttributesProperties = {
|
||||
readonly id?: string;
|
||||
readonly anchor?: string;
|
||||
readonly history: number;
|
||||
}
|
||||
};
|
||||
|
||||
export class HyperlinkAttributes extends XmlAttributeComponent<IHyperlinkAttributesProperties> {
|
||||
protected readonly xmlKeys = {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { PageReferenceFieldInstruction } from "./pageref-field-instruction";
|
||||
|
||||
describe("PageReference field instruction", () => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { SpaceType } from "@file/shared";
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { TextAttributes } from "../run/text-attributes";
|
||||
import { IPageReferenceOptions } from "./pageref";
|
||||
import { TextAttributes } from "../run/text-attributes";
|
||||
|
||||
export class PageReferenceFieldInstruction extends XmlComponent {
|
||||
public constructor(bookmarkId: string, options: IPageReferenceOptions = {}) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
|
||||
import { PageReference } from "./pageref";
|
||||
|
||||
describe("PageReference", () => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// See https://www.ecma-international.org/publications/standards/Ecma-376.htm (at Part 1, Page 1234)
|
||||
import { Begin, End } from "@file/paragraph/run/field";
|
||||
|
||||
import { Run } from "../run";
|
||||
import { PageReferenceFieldInstruction } from "./pageref-field-instruction";
|
||||
|
||||
|
@ -4,10 +4,10 @@ import { MathComponent } from "../math-component";
|
||||
import { MathDenominator } from "./math-denominator";
|
||||
import { MathNumerator } from "./math-numerator";
|
||||
|
||||
export interface IMathFractionOptions {
|
||||
export type IMathFractionOptions = {
|
||||
readonly numerator: readonly MathComponent[];
|
||||
readonly denominator: readonly MathComponent[];
|
||||
}
|
||||
};
|
||||
|
||||
export class MathFraction extends XmlComponent {
|
||||
public constructor(options: IMathFractionOptions) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// http://www.datypic.com/sc/ooxml/e-m_fName-1.html
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { MathComponent } from "../math-component";
|
||||
|
||||
export class MathFunctionName extends XmlComponent {
|
||||
|
@ -6,10 +6,10 @@ import { MathBase } from "../n-ary";
|
||||
import { MathFunctionName } from "./math-function-name";
|
||||
import { MathFunctionProperties } from "./math-function-properties";
|
||||
|
||||
export interface IMathFunctionOptions {
|
||||
export type IMathFunctionOptions = {
|
||||
readonly children: readonly MathComponent[];
|
||||
readonly name: readonly MathComponent[];
|
||||
}
|
||||
};
|
||||
|
||||
export class MathFunction extends XmlComponent {
|
||||
public constructor(options: IMathFunctionOptions) {
|
||||
|
@ -2,7 +2,7 @@ import { MathAngledBrackets, MathCurlyBrackets, MathRoundBrackets, MathSquareBra
|
||||
import { MathFraction } from "./fraction";
|
||||
import { MathFunction } from "./function";
|
||||
import { MathRun } from "./math-run";
|
||||
import { MathSum, MathIntegral } from "./n-ary";
|
||||
import { MathIntegral, MathSum } from "./n-ary";
|
||||
import { MathRadical } from "./radical";
|
||||
import { MathSubScript, MathSubSuperScript, MathSuperScript } from "./script";
|
||||
|
||||
|
@ -3,9 +3,9 @@ import { XmlComponent } from "@file/xml-components";
|
||||
|
||||
import { MathComponent } from "./math-component";
|
||||
|
||||
export interface IMathOptions {
|
||||
export type IMathOptions = {
|
||||
readonly children: readonly MathComponent[];
|
||||
}
|
||||
};
|
||||
|
||||
export class Math extends XmlComponent {
|
||||
public constructor(options: IMathOptions) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user