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:
dependabot[bot]
2024-10-21 03:57:15 +01:00
committed by GitHub
parent 9cff0b2a57
commit 2381ba8a05
214 changed files with 1583 additions and 1586 deletions

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { Alignment, AlignmentType } from "./alignment";
describe("Alignment", () => {

View File

@ -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];
}> {

View File

@ -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", () => {

View File

@ -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) {

View File

@ -1,5 +1,6 @@
// http://officeopenxml.com/WPtextSpecialContent-break.php
import { Attributes, XmlComponent } from "@file/xml-components";
import { Run } from "../run";
const BreakType = {

View File

@ -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>

View File

@ -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 = {

View File

@ -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",

View File

@ -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

View File

@ -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 = {

View File

@ -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", () => {

View File

@ -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 = {}) {

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { PageReference } from "./pageref";
describe("PageReference", () => {

View File

@ -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";

View File

@ -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) {

View File

@ -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 {

View File

@ -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) {

View File

@ -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";

View File

@ -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) {

View File

@ -6,11 +6,11 @@ import { MathNAryProperties } from "./math-n-ary-properties";
import { MathSubScriptElement } from "./math-sub-script";
import { MathSuperScriptElement } from "./math-super-script";
export interface IMathIntegralOptions {
export type IMathIntegralOptions = {
readonly children: readonly MathComponent[];
readonly subScript?: readonly MathComponent[];
readonly superScript?: readonly MathComponent[];
}
};
export class MathIntegral extends XmlComponent {
public constructor(options: IMathIntegralOptions) {

View File

@ -1,13 +1,14 @@
// http://www.datypic.com/sc/ooxml/e-m_limLow-1.html
import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
import { MathBase } from "./math-base";
import { MathLimit } from "./math-limit";
export interface IMathLimitLowerOptions {
export type IMathLimitLowerOptions = {
readonly children: readonly MathComponent[];
readonly limit: readonly MathComponent[];
}
};
export class MathLimitLower extends XmlComponent {
public constructor(options: IMathLimitLowerOptions) {

View File

@ -1,13 +1,14 @@
// http://www.datypic.com/sc/ooxml/e-m_limUpp-1.html
import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
import { MathBase } from "./math-base";
import { MathLimit } from "./math-limit";
export interface IMathLimitUpperOptions {
export type IMathLimitUpperOptions = {
readonly children: readonly MathComponent[];
readonly limit: readonly MathComponent[];
}
};
export class MathLimitUpper extends XmlComponent {
public constructor(options: IMathLimitUpperOptions) {

View File

@ -1,5 +1,6 @@
// http://www.datypic.com/sc/ooxml/e-m_lim-1.html
import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathLimit extends XmlComponent {

View File

@ -7,11 +7,11 @@ import { MathNAryProperties } from "./math-n-ary-properties";
import { MathSubScriptElement } from "./math-sub-script";
import { MathSuperScriptElement } from "./math-super-script";
export interface IMathSumOptions {
export type IMathSumOptions = {
readonly children: readonly MathComponent[];
readonly subScript?: readonly MathComponent[];
readonly superScript?: readonly MathComponent[];
}
};
export class MathSum extends XmlComponent {
public constructor(options: IMathSumOptions) {

View File

@ -1,5 +1,6 @@
// http://www.datypic.com/sc/ooxml/e-m_deg-1.html
import { XmlComponent } from "@file/xml-components";
import { MathComponent } from "../math-component";
export class MathDegree extends XmlComponent {

View File

@ -1,5 +1,6 @@
// http://www.datypic.com/sc/ooxml/e-m_radPr-1.html
import { XmlComponent } from "@file/xml-components";
import { MathDegreeHide } from "./math-degree-hide";
export class MathRadicalProperties extends XmlComponent {

View File

@ -6,10 +6,10 @@ import { MathBase } from "../n-ary";
import { MathDegree } from "./math-degree";
import { MathRadicalProperties } from "./math-radical-properties";
export interface IMathRadicalOptions {
export type IMathRadicalOptions = {
readonly children: readonly MathComponent[];
readonly degree?: readonly MathComponent[];
}
};
export class MathRadical extends XmlComponent {
public constructor(options: IMathRadicalOptions) {

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathPreSubSuperScriptProperties } from "./math-pre-sub-super-script-function-properties";
describe("MathPreSubSuperScriptProperties", () => {

View File

@ -2,8 +2,8 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathRun } from "../../math-run";
import { MathPreSubSuperScript } from "./math-pre-sub-super-script-function";
import { MathRun } from "../../math-run";
describe("MathPreSubScript", () => {
describe("#constructor()", () => {

View File

@ -1,15 +1,15 @@
// http://www.datypic.com/sc/ooxml/e-m_sPre-1.html
import { XmlComponent } from "@file/xml-components";
import { MathPreSubSuperScriptProperties } from "./math-pre-sub-super-script-function-properties";
import { MathComponent } from "../../math-component";
import { MathBase, MathSubScriptElement, MathSuperScriptElement } from "../../n-ary";
import { MathPreSubSuperScriptProperties } from "./math-pre-sub-super-script-function-properties";
export interface IMathPreSubSuperScriptOptions {
export type IMathPreSubSuperScriptOptions = {
readonly children: readonly MathComponent[];
readonly subScript: readonly MathComponent[];
readonly superScript: readonly MathComponent[];
}
};
export class MathPreSubSuperScript extends XmlComponent {
public constructor(options: IMathPreSubSuperScriptOptions) {

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathSubScriptProperties } from "./math-sub-script-function-properties";
describe("MathSubScriptProperties", () => {

View File

@ -2,8 +2,8 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathRun } from "../../math-run";
import { MathSubScript } from "./math-sub-script-function";
import { MathRun } from "../../math-run";
describe("MathSubScript", () => {
describe("#constructor()", () => {

View File

@ -1,14 +1,14 @@
// http://www.datypic.com/sc/ooxml/e-m_sSub-1.html
import { XmlComponent } from "@file/xml-components";
import { MathSubScriptProperties } from "./math-sub-script-function-properties";
import { MathComponent } from "../../math-component";
import { MathBase, MathSubScriptElement } from "../../n-ary";
import { MathSubScriptProperties } from "./math-sub-script-function-properties";
export interface IMathSubScriptOptions {
export type IMathSubScriptOptions = {
readonly children: readonly MathComponent[];
readonly subScript: readonly MathComponent[];
}
};
export class MathSubScript extends XmlComponent {
public constructor(options: IMathSubScriptOptions) {

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathSubSuperScriptProperties } from "./math-sub-super-script-function-properties";
describe("MathSubSuperScriptProperties", () => {

View File

@ -2,8 +2,8 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathRun } from "../../math-run";
import { MathSubSuperScript } from "./math-sub-super-script-function";
import { MathRun } from "../../math-run";
describe("MathSubScript", () => {
describe("#constructor()", () => {

View File

@ -1,15 +1,15 @@
// http://www.datypic.com/sc/ooxml/e-m_sSubSup-1.html
import { XmlComponent } from "@file/xml-components";
import { MathSubSuperScriptProperties } from "./math-sub-super-script-function-properties";
import { MathComponent } from "../../math-component";
import { MathBase, MathSubScriptElement, MathSuperScriptElement } from "../../n-ary";
import { MathSubSuperScriptProperties } from "./math-sub-super-script-function-properties";
export interface IMathSubSuperScriptOptions {
export type IMathSubSuperScriptOptions = {
readonly children: readonly MathComponent[];
readonly subScript: readonly MathComponent[];
readonly superScript: readonly MathComponent[];
}
};
export class MathSubSuperScript extends XmlComponent {
public constructor(options: IMathSubSuperScriptOptions) {

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathSuperScriptProperties } from "./math-super-script-function-properties";
describe("MathSuperScriptProperties", () => {

View File

@ -2,8 +2,8 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathRun } from "../../math-run";
import { MathSuperScript } from "./math-super-script-function";
import { MathRun } from "../../math-run";
describe("MathSuperScript", () => {
describe("#constructor()", () => {

View File

@ -1,14 +1,14 @@
// http://www.datypic.com/sc/ooxml/e-m_sSup-1.html
import { XmlComponent } from "@file/xml-components";
import { MathSuperScriptProperties } from "./math-super-script-function-properties";
import { MathComponent } from "../../math-component";
import { MathBase, MathSuperScriptElement } from "../../n-ary";
import { MathSuperScriptProperties } from "./math-super-script-function-properties";
export interface IMathSuperScriptOptions {
export type IMathSuperScriptOptions = {
readonly children: readonly MathComponent[];
readonly superScript: readonly MathComponent[];
}
};
export class MathSuperScript extends XmlComponent {
public constructor(options: IMathSuperScriptOptions) {

View File

@ -1,11 +1,10 @@
import { afterEach, assert, beforeEach, describe, expect, it, vi } from "vitest";
import * as convenienceFunctions from "@util/convenience-functions";
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared";
import { Formatter } from "@export/formatter";
import { BorderStyle } from "@file/border";
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared";
import { EMPTY_OBJECT } from "@file/xml-components";
import * as convenienceFunctions from "@util/convenience-functions";
import { IViewWrapper } from "../document-wrapper";
import { File } from "../file";
@ -33,7 +32,7 @@ describe("Paragraph", () => {
try {
JSON.parse(stringifiedJson);
} catch (e) {
} catch {
assert.isTrue(false);
}
assert.isTrue(true);

View File

@ -1,12 +1,12 @@
// http://officeopenxml.com/WPparagraph.php
import { FileChild } from "@file/file-child";
import { FootnoteReferenceRun } from "@file/footnotes";
import { IContext, IXmlableObject } from "@file/xml-components";
import { uniqueId } from "@util/convenience-functions";
import { FileChild } from "@file/file-child";
import { CheckBox } from "../checkbox";
import { TargetModeType } from "../relationships/relationship/relationship";
import { DeletedTextRun, InsertedTextRun } from "../track-revision";
import { CheckBox } from "../checkbox";
import { ColumnBreak, PageBreak } from "./formatting/break";
import { Bookmark, ConcreteHyperlink, ExternalHyperlink, InternalHyperlink } from "./links";
import { Math } from "./math";
@ -37,10 +37,10 @@ export type ParagraphChild =
| CommentReference
| CheckBox;
export interface IParagraphOptions extends IParagraphPropertiesOptions {
export type IParagraphOptions = {
readonly text?: string;
readonly children?: readonly ParagraphChild[];
}
} & IParagraphPropertiesOptions;
export class Paragraph extends FileChild {
private readonly properties: ParagraphProperties;

View File

@ -1,9 +1,9 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { DocumentWrapper } from "../document-wrapper";
import { File } from "../file";
import { ParagraphProperties } from "./properties";
describe("ParagraphProperties", () => {
@ -23,13 +23,11 @@ describe("ParagraphProperties", () => {
},
});
const tree = new Formatter().format(properties, {
// tslint:disable-next-line: no-object-literal-type-assertion
file: {
Numbering: {
createConcreteNumberingInstance: (_: string, __: number) => undefined,
},
} as File,
// tslint:disable-next-line: no-object-literal-type-assertion
viewWrapper: new DocumentWrapper({ background: {} }),
stack: [],
});

View File

@ -1,7 +1,9 @@
// http://officeopenxml.com/WPparagraphProperties.php
// https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_suppressLineNumbers_topic_ID0ECJAO.html
/* eslint-disable functional/immutable-data */
import { IContext, IgnoreIfEmptyXmlComponent, IXmlableObject, OnOffElement, XmlComponent } from "@file/xml-components";
import { IContext, IXmlableObject, IgnoreIfEmptyXmlComponent, OnOffElement, XmlComponent } from "@file/xml-components";
import { IRunOptions, RunProperties } from ".";
import { DocumentWrapper } from "../document-wrapper";
import { IShadingAttributesProperties, Shading } from "../shading";
import { Alignment, AlignmentType } from "./formatting/alignment";
@ -13,11 +15,10 @@ import { HeadingLevel, Style } from "./formatting/style";
import { TabStop, TabStopDefinition, TabStopType } from "./formatting/tab-stop";
import { NumberProperties } from "./formatting/unordered-list";
import { WordWrap } from "./formatting/word-wrap";
import { createFrameProperties, IFrameOptions } from "./frame/frame-properties";
import { IFrameOptions, createFrameProperties } from "./frame/frame-properties";
import { OutlineLevel } from "./links";
import { IRunOptions, RunProperties } from ".";
export interface ILevelParagraphStylePropertiesOptions {
export type ILevelParagraphStylePropertiesOptions = {
readonly alignment?: (typeof AlignmentType)[keyof typeof AlignmentType];
readonly thematicBreak?: boolean;
readonly contextualSpacing?: boolean;
@ -34,9 +35,9 @@ export interface ILevelParagraphStylePropertiesOptions {
*/
readonly keepLines?: boolean;
readonly outlineLevel?: number;
}
};
export interface IParagraphStylePropertiesOptions extends ILevelParagraphStylePropertiesOptions {
export type IParagraphStylePropertiesOptions = {
readonly numbering?:
| {
readonly reference: string;
@ -45,9 +46,9 @@ export interface IParagraphStylePropertiesOptions extends ILevelParagraphStylePr
readonly custom?: boolean;
}
| false;
}
} & ILevelParagraphStylePropertiesOptions;
export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOptions {
export type IParagraphPropertiesOptions = {
readonly border?: IBordersOptions;
readonly heading?: (typeof HeadingLevel)[keyof typeof HeadingLevel];
readonly bidirectional?: boolean;
@ -73,7 +74,7 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp
* Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.3.1.29.
*/
readonly run?: IRunOptions;
}
} & IParagraphStylePropertiesOptions;
export class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
// eslint-disable-next-line functional/prefer-readonly-type

View File

@ -1,17 +1,17 @@
import { FileChild } from "@file/file-child";
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export interface ICommentOptions {
export type ICommentOptions = {
readonly id: number;
readonly children: readonly FileChild[];
readonly initials?: string;
readonly author?: string;
readonly date?: Date;
}
};
export interface ICommentsOptions {
export type ICommentsOptions = {
readonly children: readonly ICommentOptions[];
}
};
class CommentAttributes extends XmlAttributeComponent<{
readonly id: number;

View File

@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import {
AnnotationReference,
CarriageReturn,

View File

@ -1,5 +1,5 @@
import { Attributes, XmlComponent } from "@file/xml-components";
import { hexColorValue, signedTwipsMeasureValue, UniversalMeasure } from "@util/values";
import { UniversalMeasure, hexColorValue, signedTwipsMeasureValue } from "@util/values";
export class CharacterSpacing extends XmlComponent {
public constructor(value: number | UniversalMeasure) {

View File

@ -1,10 +1,9 @@
import { DocPropertiesOptions } from "@file/drawing/doc-properties/doc-properties";
import { IContext, IXmlableObject } from "@file/xml-components";
import { hashedId } from "@util/convenience-functions";
import { IContext, IXmlableObject } from "@file/xml-components";
import { DocPropertiesOptions } from "@file/drawing/doc-properties/doc-properties";
import { OutlineOptions } from "../../drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline";
import { Drawing, IFloating } from "../../drawing";
import { OutlineOptions } from "../../drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline";
import { IMediaTransformation } from "../../media";
import { IMediaData } from "../../media/data";
import { Run } from "../run";

View File

@ -5,11 +5,11 @@ import { BuilderElement, XmlComponent } from "@file/xml-components";
// <xsd:attribute name="eastAsia" type="s:ST_Lang" use="optional"/>
// <xsd:attribute name="bidi" type="s:ST_Lang" use="optional"/>
// </xsd:complexType>
export interface ILanguageOptions {
export type ILanguageOptions = {
readonly value?: string;
readonly eastAsia?: string;
readonly bidirectional?: string;
}
};
export const createLanguageComponent = (options: ILanguageOptions): XmlComponent =>
new BuilderElement<{

View File

@ -38,15 +38,14 @@ export const PositionalTabLeader = {
DOT: "dot",
HYPHEN: "hyphen",
UNDERSCORE: "underscore",
// eslint-disable-next-line @typescript-eslint/naming-convention
MIDDLE_DOT: "middleDot",
} as const;
export interface PositionalTabOptions {
export type PositionalTabOptions = {
readonly alignment: (typeof PositionalTabAlignment)[keyof typeof PositionalTabAlignment];
readonly relativeTo: (typeof PositionalTabRelativeTo)[keyof typeof PositionalTabRelativeTo];
readonly leader: (typeof PositionalTabLeader)[keyof typeof PositionalTabLeader];
}
};
// <xsd:complexType name="CT_PTab">
// <xsd:attribute name="alignment" type="ST_PTabAlignment" use="required" />

View File

@ -1,5 +1,5 @@
// https://www.ecma-international.org/wp-content/uploads/ECMA-376-1_5th_edition_december_2016.zip page 297, section 17.3.2.21
/* eslint-disable functional/immutable-data */
import { BorderElement, IBorderOptions } from "@file/border";
import { IShadingAttributesProperties, Shading } from "@file/shading";
import { ChangeAttributes, IChangedAttributesProperties } from "@file/track-revision/track-revision";
@ -15,17 +15,16 @@ import { PositiveUniversalMeasure, UniversalMeasure } from "@util/values";
import { EmphasisMark, EmphasisMarkType } from "./emphasis-mark";
import { CharacterSpacing, Color, Highlight, HighlightComplexScript } from "./formatting";
import { createLanguageComponent, ILanguageOptions } from "./language";
import { ILanguageOptions, createLanguageComponent } from "./language";
import { IFontAttributesProperties, RunFonts } from "./run-fonts";
import { SubScript, SuperScript } from "./script";
import { Underline, UnderlineType } from "./underline";
interface IFontOptions {
type IFontOptions = {
readonly name: string;
readonly hint?: string;
}
};
/* eslint-disable @typescript-eslint/naming-convention */
export const TextEffect = {
BLINK_BACKGROUND: "blinkBackground",
LIGHTS: "lights",
@ -63,9 +62,7 @@ export const HighlightColor = {
YELLOW: "yellow",
} as const;
/* eslint-enable */
export interface IRunStylePropertiesOptions {
export type IRunStylePropertiesOptions = {
readonly noProof?: boolean;
readonly bold?: boolean;
readonly boldComplexScript?: boolean;
@ -106,13 +103,13 @@ export interface IRunStylePropertiesOptions {
readonly specVanish?: boolean;
readonly scale?: number;
readonly math?: boolean;
}
};
export interface IRunPropertiesOptions extends IRunStylePropertiesOptions {
export type IRunPropertiesOptions = {
readonly style?: string;
}
} & IRunStylePropertiesOptions;
export interface IRunPropertiesChangeOptions extends IRunPropertiesOptions, IChangedAttributesProperties {}
export type IRunPropertiesChangeOptions = {} & IRunPropertiesOptions & IChangedAttributesProperties;
// <xsd:group name="EG_RPrBase">
// <xsd:choice>
@ -157,7 +154,6 @@ export interface IRunPropertiesChangeOptions extends IRunPropertiesOptions, ICha
// <xsd:element name="oMath" type="CT_OnOff"/>
// </xsd:choice>
// </xsd:group>
/* eslint-disable functional/immutable-data */
export class RunProperties extends IgnoreIfEmptyXmlComponent {
public constructor(options?: IRunPropertiesOptions) {
@ -326,8 +322,6 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent {
}
}
/* eslint-enable */
export class RunPropertiesChange extends XmlComponent {
public constructor(options: IRunPropertiesChangeOptions) {
super("w:rPrChange");

View File

@ -11,10 +11,10 @@ import { TextAttributes } from "../text-attributes";
// </xsd:simpleContent>
// </xsd:complexType>
interface ITextOptions {
type ITextOptions = {
readonly space?: (typeof SpaceType)[keyof typeof SpaceType];
readonly text?: string;
}
};
export class Text extends XmlComponent {
public constructor(options: string | ITextOptions) {

View File

@ -1,12 +1,12 @@
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export interface IFontAttributesProperties {
export type IFontAttributesProperties = {
readonly ascii?: string;
readonly cs?: string;
readonly eastAsia?: string;
readonly hAnsi?: string;
readonly hint?: string;
}
};
class RunFontAttributes extends XmlAttributeComponent<IFontAttributesProperties> {
protected readonly xmlKeys = {

View File

@ -5,9 +5,10 @@ import { BorderStyle } from "@file/border";
import { ShadingType } from "@file/shading";
import { EmphasisMarkType } from "./emphasis-mark";
import { HighlightColor, TextEffect } from "./properties";
import { PageNumber, Run } from "./run";
import { UnderlineType } from "./underline";
import { HighlightColor, TextEffect } from "./properties";
describe("Run", () => {
describe("#noProof()", () => {
it("turns off spelling and grammar checkers for a run", () => {

View File

@ -1,14 +1,9 @@
// http://officeopenxml.com/WPtext.php
import { XmlComponent } from "@file/xml-components";
import { FootnoteReferenceRun } from "@file/footnotes/footnote/run/reference-run";
import { FieldInstruction } from "@file/table-of-contents/field-instruction";
import { XmlComponent } from "@file/xml-components";
import { Break } from "./break";
import { Begin, End, Separate } from "./field";
import { NumberOfPages, NumberOfPagesSection, Page, CurrentSection } from "./page-number";
import { IRunPropertiesOptions, RunProperties } from "./properties";
import { Text } from "./run-components/text";
import {
AnnotationReference,
CarriageReturn,
@ -28,9 +23,13 @@ import {
YearLong,
YearShort,
} from "./empty-children";
import { Begin, End, Separate } from "./field";
import { CurrentSection, NumberOfPages, NumberOfPagesSection, Page } from "./page-number";
import { PositionalTab } from "./positional-tab";
import { IRunPropertiesOptions, RunProperties } from "./properties";
import { Text } from "./run-components/text";
export interface IRunOptions extends IRunPropertiesOptions {
export type IRunOptions = {
// <xsd:choice>
// <xsd:element name="br" type="CT_Br" />
// <xsd:element name="t" type="CT_Text" />
@ -96,9 +95,8 @@ export interface IRunOptions extends IRunPropertiesOptions {
)[];
readonly break?: number;
readonly text?: string;
}
} & IRunPropertiesOptions;
/* eslint-disable @typescript-eslint/naming-convention */
export const PageNumber = {
CURRENT: "CURRENT",
TOTAL_PAGES: "TOTAL_PAGES",
@ -106,8 +104,6 @@ export const PageNumber = {
CURRENT_SECTION: "SECTION",
} as const;
/* eslint-enable */
export class Run extends XmlComponent {
protected readonly properties: RunProperties;

View File

@ -1,5 +1,6 @@
import { Run } from "@file/paragraph/run";
import { Begin, End, Separate } from "@file/paragraph/run/field";
import { SequentialIdentifierInstruction } from "./sequential-identifier-instruction";
export class SequentialIdentifier extends Run {

View File

@ -1,5 +1,6 @@
// http://www.datypic.com/sc/ooxml/e-w_fldSimple-1.html
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { TextRun } from "./text-run";
class FldSimpleAttrs extends XmlAttributeComponent<{ readonly instr: string }> {

View File

@ -3,8 +3,8 @@ import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { EmphasisMarkType } from "./emphasis-mark";
import { UnderlineType } from "./underline";
import { SymbolRun } from "./symbol-run";
import { UnderlineType } from "./underline";
describe("SymbolRun", () => {
let run: SymbolRun;

View File

@ -1,10 +1,10 @@
import { IRunOptions, Run } from "./run";
import { Symbol } from "./run-components/symbol";
export interface ISymbolRunOptions extends IRunOptions {
export type ISymbolRunOptions = {
readonly char: string;
readonly symbolfont?: string;
}
} & IRunOptions;
export class SymbolRun extends Run {
public constructor(options: ISymbolRunOptions | string) {