From 034cd187ab8d9d15fc81d1a437b3b886af5b2e76 Mon Sep 17 00:00:00 2001 From: Tom Hunkapiller Date: Sat, 29 May 2021 05:51:06 +0300 Subject: [PATCH] change shading val -> type --- demo/32-merge-and-shade-table-cells.ts | 8 ++++---- demo/46-shading-text.ts | 4 ++-- demo/60-track-revisions.ts | 2 +- docs/usage/paragraph.md | 2 +- docs/usage/text.md | 2 +- src/file/numbering/abstract-numbering.spec.ts | 4 ++-- src/file/paragraph/paragraph.spec.ts | 2 +- src/file/paragraph/run/run.spec.ts | 2 +- src/file/shading/shading.spec.ts | 2 +- src/file/shading/shading.ts | 8 ++++---- src/file/styles/style/character-style.spec.ts | 4 ++-- src/file/styles/style/paragraph-style.spec.ts | 4 ++-- src/file/table/table-cell/table-cell.spec.ts | 2 +- src/file/table/table-properties/table-properties.spec.ts | 2 +- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index cc01753acc..a3e2451f12 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -98,7 +98,7 @@ const table3 = new Table({ children: [new Paragraph("Bar1")], shading: { fill: "b79c2f", - val: ShadingType.REVERSE_DIAGONAL_STRIPE, + type: ShadingType.REVERSE_DIAGONAL_STRIPE, color: "auto", }, }), @@ -106,7 +106,7 @@ const table3 = new Table({ children: [new Paragraph("Bar2")], shading: { fill: "42c5f4", - val: ShadingType.PERCENT_95, + type: ShadingType.PERCENT_95, color: "auto", }, }), @@ -114,7 +114,7 @@ const table3 = new Table({ children: [new Paragraph("Bar3")], shading: { fill: "880aa8", - val: ShadingType.PERCENT_10, + type: ShadingType.PERCENT_10, color: "e2df0b", }, }), @@ -122,7 +122,7 @@ const table3 = new Table({ children: [new Paragraph("Bar4")], shading: { fill: "FF0000", - val: ShadingType.CLEAR, + type: ShadingType.CLEAR, color: "auto", }, }), diff --git a/demo/46-shading-text.ts b/demo/46-shading-text.ts index b8d76b08f2..289691bd25 100644 --- a/demo/46-shading-text.ts +++ b/demo/46-shading-text.ts @@ -21,7 +21,7 @@ const doc = new Document({ name: "Garamond", }, shading: { - val: ShadingType.REVERSE_DIAGONAL_STRIPE, + type: ShadingType.REVERSE_DIAGONAL_STRIPE, color: "00FFFF", fill: "FF0000", }, @@ -30,7 +30,7 @@ const doc = new Document({ }), new Paragraph({ shading: { - val: ShadingType.DIAGONAL_CROSS, + type: ShadingType.DIAGONAL_CROSS, color: "00FFFF", fill: "FF0000", }, diff --git a/demo/60-track-revisions.ts b/demo/60-track-revisions.ts index 11c7aee524..ced597806c 100644 --- a/demo/60-track-revisions.ts +++ b/demo/60-track-revisions.ts @@ -94,7 +94,7 @@ const doc = new Document({ name: "Garamond", }, shading: { - val: ShadingType.REVERSE_DIAGONAL_STRIPE, + type: ShadingType.REVERSE_DIAGONAL_STRIPE, color: "00FFFF", fill: "FF0000", }, diff --git a/docs/usage/paragraph.md b/docs/usage/paragraph.md index cc571aa81e..0176a43793 100644 --- a/docs/usage/paragraph.md +++ b/docs/usage/paragraph.md @@ -156,7 +156,7 @@ Add color to an entire paragraph block const paragraph = new Paragraph({ text: "shading", shading: { - val: ShadingType.REVERSE_DIAGONAL_STRIPE, + type: ShadingType.REVERSE_DIAGONAL_STRIPE, color: "00FFFF", fill: "FF0000", }, diff --git a/docs/usage/text.md b/docs/usage/text.md index e1fe67e1ab..0b7b88686b 100644 --- a/docs/usage/text.md +++ b/docs/usage/text.md @@ -83,7 +83,7 @@ const text = new TextRun({ const text = new TextRun({ text: "shading", shading: { - val: ShadingType.REVERSE_DIAGONAL_STRIPE, + type: ShadingType.REVERSE_DIAGONAL_STRIPE, color: "00FFFF", fill: "FF0000", }, diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index b332e0d94a..8ab0845ed8 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -619,7 +619,7 @@ describe("AbstractNumbering", () => { const shadingTests = [ { shading: { - val: ShadingType.DIAGONAL_STRIPE, + type: ShadingType.DIAGONAL_STRIPE, fill: "006622", color: "0000FF", }, @@ -627,7 +627,7 @@ describe("AbstractNumbering", () => { }, { shading: { - val: ShadingType.PERCENT_10, + type: ShadingType.PERCENT_10, fill: "00FFFF", color: "FF0000", }, diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index ae6107f6e1..d898777b12 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -850,7 +850,7 @@ describe("Paragraph", () => { it("should set shading to the given value", () => { const paragraph = new Paragraph({ shading: { - val: ShadingType.REVERSE_DIAGONAL_STRIPE, + type: ShadingType.REVERSE_DIAGONAL_STRIPE, color: "00FFFF", fill: "FF0000", }, diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index a3178df35e..aaa2a640de 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -226,7 +226,7 @@ describe("Run", () => { it("it should add shadow to the properties", () => { const run = new Run({ shading: { - val: ShadingType.PERCENT_10, + type: ShadingType.PERCENT_10, fill: "00FFFF", color: "FF0000", }, diff --git a/src/file/shading/shading.spec.ts b/src/file/shading/shading.spec.ts index 8e5b192a41..7b808aa829 100644 --- a/src/file/shading/shading.spec.ts +++ b/src/file/shading/shading.spec.ts @@ -17,7 +17,7 @@ describe("Shading", () => { }); it("should create with params", () => { - const shading = new Shading({ val: ShadingType.PERCENT_40, color: "FF0000", fill: "555555" }); + const shading = new Shading({ type: ShadingType.PERCENT_40, color: "FF0000", fill: "555555" }); const tree = new Formatter().format(shading); expect(tree).to.deep.equal({ "w:shd": { diff --git a/src/file/shading/shading.ts b/src/file/shading/shading.ts index c356c2a0d7..9199122c78 100644 --- a/src/file/shading/shading.ts +++ b/src/file/shading/shading.ts @@ -23,25 +23,25 @@ import { hexColorValue } from "../values"; export interface IShadingAttributesProperties { readonly fill?: string; readonly color?: string; - readonly val?: ShadingType; + readonly type?: ShadingType; } class ShadingAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { fill: "w:fill", color: "w:color", - val: "w:val", + type: "w:val", }; } export class Shading extends XmlComponent { - constructor({ fill, color, val }: IShadingAttributesProperties) { + constructor({ fill, color, type }: IShadingAttributesProperties) { super("w:shd"); this.root.push( new ShadingAttributes({ fill: fill === undefined ? undefined : hexColorValue(fill), color: color === undefined ? undefined : hexColorValue(color), - val, + type, }), ); } diff --git a/src/file/styles/style/character-style.spec.ts b/src/file/styles/style/character-style.spec.ts index 08e6779f7d..4ddf087f2d 100644 --- a/src/file/styles/style/character-style.spec.ts +++ b/src/file/styles/style/character-style.spec.ts @@ -778,7 +778,7 @@ describe("CharacterStyle", () => { const shadingTests = [ { shading: { - val: ShadingType.PERCENT_10, + type: ShadingType.PERCENT_10, fill: "00FFFF", color: "FF0000", }, @@ -786,7 +786,7 @@ describe("CharacterStyle", () => { }, { shading: { - val: ShadingType.SOLID, + type: ShadingType.SOLID, fill: "AA0000", color: "DD0000", }, diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index c125e803ad..28f229677b 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -650,7 +650,7 @@ describe("ParagraphStyle", () => { const shadingTests = [ { shading: { - val: ShadingType.PERCENT_10, + type: ShadingType.PERCENT_10, fill: "00FFFF", color: "FF0000", }, @@ -658,7 +658,7 @@ describe("ParagraphStyle", () => { }, { shading: { - val: ShadingType.DIAGONAL_CROSS, + type: ShadingType.DIAGONAL_CROSS, fill: "0066FF", color: "0000FF", }, diff --git a/src/file/table/table-cell/table-cell.spec.ts b/src/file/table/table-cell/table-cell.spec.ts index 25e6e26672..b4fa5e7429 100644 --- a/src/file/table/table-cell/table-cell.spec.ts +++ b/src/file/table/table-cell/table-cell.spec.ts @@ -435,7 +435,7 @@ describe("TableCell", () => { shading: { fill: "FF0000", color: "0000ff", - val: ShadingType.PERCENT_10, + type: ShadingType.PERCENT_10, }, }); diff --git a/src/file/table/table-properties/table-properties.spec.ts b/src/file/table/table-properties/table-properties.spec.ts index d072dc4c22..ceadb5c3a8 100644 --- a/src/file/table/table-properties/table-properties.spec.ts +++ b/src/file/table/table-properties/table-properties.spec.ts @@ -129,7 +129,7 @@ describe("TableProperties", () => { const tp = new TableProperties({ shading: { fill: "b79c2f", - val: ShadingType.REVERSE_DIAGONAL_STRIPE, + type: ShadingType.REVERSE_DIAGONAL_STRIPE, color: "auto", }, });