cn-font-split
Version:
划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.
1,238 lines • 93.1 kB
text/typescript
/**
* Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 5.28.3
* source: index.proto
* git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf";
export namespace api_interface {
export enum EventName {
UNSPECIFIED = 0,
OUTPUT_DATA = 1,
END = 2
}
export class InputTemplate extends pb_1.Message {
#one_of_decls: number[][] = [[2], [5], [6], [9], [10], [11], [13], [14], [15], [18], [20], [8], [21], [22], [23], [24], [25]];
constructor(data?: any[] | ({
input?: Uint8Array;
subsets?: Uint8Array[];
} & (({
outDir?: string;
}) | ({
css?: InputTemplate.CssProperties;
}) | ({
targetType?: string;
}) | ({
chunkSize?: number;
}) | ({
chunkSizeTolerance?: number;
}) | ({
maxAllowSubsetsCount?: number;
}) | ({
testHtml?: boolean;
}) | ({
reporter?: boolean;
}) | ({
previewImage?: InputTemplate.PreviewImage;
}) | ({
renameOutputFont?: string;
}) | ({
buildMode?: string;
}) | ({
languageAreas?: boolean;
}) | ({
multiThreads?: boolean;
}) | ({
fontFeature?: boolean;
}) | ({
reduceMins?: boolean;
}) | ({
autoSubset?: boolean;
}) | ({
subsetRemainChars?: boolean;
})))) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [7], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("input" in data && data.input != undefined) {
this.input = data.input;
}
if ("outDir" in data && data.outDir != undefined) {
this.outDir = data.outDir;
}
if ("css" in data && data.css != undefined) {
this.css = data.css;
}
if ("targetType" in data && data.targetType != undefined) {
this.targetType = data.targetType;
}
if ("subsets" in data && data.subsets != undefined) {
this.subsets = data.subsets;
}
if ("chunkSize" in data && data.chunkSize != undefined) {
this.chunkSize = data.chunkSize;
}
if ("chunkSizeTolerance" in data && data.chunkSizeTolerance != undefined) {
this.chunkSizeTolerance = data.chunkSizeTolerance;
}
if ("maxAllowSubsetsCount" in data && data.maxAllowSubsetsCount != undefined) {
this.maxAllowSubsetsCount = data.maxAllowSubsetsCount;
}
if ("testHtml" in data && data.testHtml != undefined) {
this.testHtml = data.testHtml;
}
if ("reporter" in data && data.reporter != undefined) {
this.reporter = data.reporter;
}
if ("previewImage" in data && data.previewImage != undefined) {
this.previewImage = data.previewImage;
}
if ("renameOutputFont" in data && data.renameOutputFont != undefined) {
this.renameOutputFont = data.renameOutputFont;
}
if ("buildMode" in data && data.buildMode != undefined) {
this.buildMode = data.buildMode;
}
if ("languageAreas" in data && data.languageAreas != undefined) {
this.languageAreas = data.languageAreas;
}
if ("multiThreads" in data && data.multiThreads != undefined) {
this.multiThreads = data.multiThreads;
}
if ("fontFeature" in data && data.fontFeature != undefined) {
this.fontFeature = data.fontFeature;
}
if ("reduceMins" in data && data.reduceMins != undefined) {
this.reduceMins = data.reduceMins;
}
if ("autoSubset" in data && data.autoSubset != undefined) {
this.autoSubset = data.autoSubset;
}
if ("subsetRemainChars" in data && data.subsetRemainChars != undefined) {
this.subsetRemainChars = data.subsetRemainChars;
}
}
}
get input() {
return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0)) as Uint8Array;
}
set input(value: Uint8Array) {
pb_1.Message.setField(this, 1, value);
}
get outDir() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set outDir(value: string) {
pb_1.Message.setOneofField(this, 2, this.#one_of_decls[0], value);
}
get hasOutDir() {
return pb_1.Message.getField(this, 2) != null;
}
get css() {
return pb_1.Message.getWrapperField(this, InputTemplate.CssProperties, 5) as InputTemplate.CssProperties;
}
set css(value: InputTemplate.CssProperties) {
pb_1.Message.setOneofWrapperField(this, 5, this.#one_of_decls[1], value);
}
get hasCss() {
return pb_1.Message.getField(this, 5) != null;
}
get targetType() {
return pb_1.Message.getFieldWithDefault(this, 6, "") as string;
}
set targetType(value: string) {
pb_1.Message.setOneofField(this, 6, this.#one_of_decls[2], value);
}
get hasTargetType() {
return pb_1.Message.getField(this, 6) != null;
}
get subsets() {
return pb_1.Message.getFieldWithDefault(this, 7, []) as Uint8Array[];
}
set subsets(value: Uint8Array[]) {
pb_1.Message.setField(this, 7, value);
}
get chunkSize() {
return pb_1.Message.getFieldWithDefault(this, 9, 0) as number;
}
set chunkSize(value: number) {
pb_1.Message.setOneofField(this, 9, this.#one_of_decls[3], value);
}
get hasChunkSize() {
return pb_1.Message.getField(this, 9) != null;
}
get chunkSizeTolerance() {
return pb_1.Message.getFieldWithDefault(this, 10, 0) as number;
}
set chunkSizeTolerance(value: number) {
pb_1.Message.setOneofField(this, 10, this.#one_of_decls[4], value);
}
get hasChunkSizeTolerance() {
return pb_1.Message.getField(this, 10) != null;
}
get maxAllowSubsetsCount() {
return pb_1.Message.getFieldWithDefault(this, 11, 0) as number;
}
set maxAllowSubsetsCount(value: number) {
pb_1.Message.setOneofField(this, 11, this.#one_of_decls[5], value);
}
get hasMaxAllowSubsetsCount() {
return pb_1.Message.getField(this, 11) != null;
}
get testHtml() {
return pb_1.Message.getFieldWithDefault(this, 13, false) as boolean;
}
set testHtml(value: boolean) {
pb_1.Message.setOneofField(this, 13, this.#one_of_decls[6], value);
}
get hasTestHtml() {
return pb_1.Message.getField(this, 13) != null;
}
get reporter() {
return pb_1.Message.getFieldWithDefault(this, 14, false) as boolean;
}
set reporter(value: boolean) {
pb_1.Message.setOneofField(this, 14, this.#one_of_decls[7], value);
}
get hasReporter() {
return pb_1.Message.getField(this, 14) != null;
}
get previewImage() {
return pb_1.Message.getWrapperField(this, InputTemplate.PreviewImage, 15) as InputTemplate.PreviewImage;
}
set previewImage(value: InputTemplate.PreviewImage) {
pb_1.Message.setOneofWrapperField(this, 15, this.#one_of_decls[8], value);
}
get hasPreviewImage() {
return pb_1.Message.getField(this, 15) != null;
}
get renameOutputFont() {
return pb_1.Message.getFieldWithDefault(this, 18, "") as string;
}
set renameOutputFont(value: string) {
pb_1.Message.setOneofField(this, 18, this.#one_of_decls[9], value);
}
get hasRenameOutputFont() {
return pb_1.Message.getField(this, 18) != null;
}
get buildMode() {
return pb_1.Message.getFieldWithDefault(this, 20, "") as string;
}
set buildMode(value: string) {
pb_1.Message.setOneofField(this, 20, this.#one_of_decls[10], value);
}
get hasBuildMode() {
return pb_1.Message.getField(this, 20) != null;
}
get languageAreas() {
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set languageAreas(value: boolean) {
pb_1.Message.setOneofField(this, 8, this.#one_of_decls[11], value);
}
get hasLanguageAreas() {
return pb_1.Message.getField(this, 8) != null;
}
get multiThreads() {
return pb_1.Message.getFieldWithDefault(this, 21, false) as boolean;
}
set multiThreads(value: boolean) {
pb_1.Message.setOneofField(this, 21, this.#one_of_decls[12], value);
}
get hasMultiThreads() {
return pb_1.Message.getField(this, 21) != null;
}
get fontFeature() {
return pb_1.Message.getFieldWithDefault(this, 22, false) as boolean;
}
set fontFeature(value: boolean) {
pb_1.Message.setOneofField(this, 22, this.#one_of_decls[13], value);
}
get hasFontFeature() {
return pb_1.Message.getField(this, 22) != null;
}
get reduceMins() {
return pb_1.Message.getFieldWithDefault(this, 23, false) as boolean;
}
set reduceMins(value: boolean) {
pb_1.Message.setOneofField(this, 23, this.#one_of_decls[14], value);
}
get hasReduceMins() {
return pb_1.Message.getField(this, 23) != null;
}
get autoSubset() {
return pb_1.Message.getFieldWithDefault(this, 24, false) as boolean;
}
set autoSubset(value: boolean) {
pb_1.Message.setOneofField(this, 24, this.#one_of_decls[15], value);
}
get hasAutoSubset() {
return pb_1.Message.getField(this, 24) != null;
}
get subsetRemainChars() {
return pb_1.Message.getFieldWithDefault(this, 25, false) as boolean;
}
set subsetRemainChars(value: boolean) {
pb_1.Message.setOneofField(this, 25, this.#one_of_decls[16], value);
}
get hasSubsetRemainChars() {
return pb_1.Message.getField(this, 25) != null;
}
get _out_dir() {
const cases: {
[index: number]: "none" | "outDir";
} = {
0: "none",
2: "outDir"
};
return cases[pb_1.Message.computeOneofCase(this, [2])];
}
get _css() {
const cases: {
[index: number]: "none" | "css";
} = {
0: "none",
5: "css"
};
return cases[pb_1.Message.computeOneofCase(this, [5])];
}
get _target_type() {
const cases: {
[index: number]: "none" | "targetType";
} = {
0: "none",
6: "targetType"
};
return cases[pb_1.Message.computeOneofCase(this, [6])];
}
get _chunk_size() {
const cases: {
[index: number]: "none" | "chunkSize";
} = {
0: "none",
9: "chunkSize"
};
return cases[pb_1.Message.computeOneofCase(this, [9])];
}
get _chunk_size_tolerance() {
const cases: {
[index: number]: "none" | "chunkSizeTolerance";
} = {
0: "none",
10: "chunkSizeTolerance"
};
return cases[pb_1.Message.computeOneofCase(this, [10])];
}
get _max_allow_subsets_count() {
const cases: {
[index: number]: "none" | "maxAllowSubsetsCount";
} = {
0: "none",
11: "maxAllowSubsetsCount"
};
return cases[pb_1.Message.computeOneofCase(this, [11])];
}
get _test_html() {
const cases: {
[index: number]: "none" | "testHtml";
} = {
0: "none",
13: "testHtml"
};
return cases[pb_1.Message.computeOneofCase(this, [13])];
}
get _reporter() {
const cases: {
[index: number]: "none" | "reporter";
} = {
0: "none",
14: "reporter"
};
return cases[pb_1.Message.computeOneofCase(this, [14])];
}
get _preview_image() {
const cases: {
[index: number]: "none" | "previewImage";
} = {
0: "none",
15: "previewImage"
};
return cases[pb_1.Message.computeOneofCase(this, [15])];
}
get _rename_output_font() {
const cases: {
[index: number]: "none" | "renameOutputFont";
} = {
0: "none",
18: "renameOutputFont"
};
return cases[pb_1.Message.computeOneofCase(this, [18])];
}
get _build_mode() {
const cases: {
[index: number]: "none" | "buildMode";
} = {
0: "none",
20: "buildMode"
};
return cases[pb_1.Message.computeOneofCase(this, [20])];
}
get _language_areas() {
const cases: {
[index: number]: "none" | "languageAreas";
} = {
0: "none",
8: "languageAreas"
};
return cases[pb_1.Message.computeOneofCase(this, [8])];
}
get _multi_threads() {
const cases: {
[index: number]: "none" | "multiThreads";
} = {
0: "none",
21: "multiThreads"
};
return cases[pb_1.Message.computeOneofCase(this, [21])];
}
get _font_feature() {
const cases: {
[index: number]: "none" | "fontFeature";
} = {
0: "none",
22: "fontFeature"
};
return cases[pb_1.Message.computeOneofCase(this, [22])];
}
get _reduce_mins() {
const cases: {
[index: number]: "none" | "reduceMins";
} = {
0: "none",
23: "reduceMins"
};
return cases[pb_1.Message.computeOneofCase(this, [23])];
}
get _auto_subset() {
const cases: {
[index: number]: "none" | "autoSubset";
} = {
0: "none",
24: "autoSubset"
};
return cases[pb_1.Message.computeOneofCase(this, [24])];
}
get _subset_remain_chars() {
const cases: {
[index: number]: "none" | "subsetRemainChars";
} = {
0: "none",
25: "subsetRemainChars"
};
return cases[pb_1.Message.computeOneofCase(this, [25])];
}
static fromObject(data: {
input?: Uint8Array;
outDir?: string;
css?: ReturnType<typeof InputTemplate.CssProperties.prototype.toObject>;
targetType?: string;
subsets?: Uint8Array[];
chunkSize?: number;
chunkSizeTolerance?: number;
maxAllowSubsetsCount?: number;
testHtml?: boolean;
reporter?: boolean;
previewImage?: ReturnType<typeof InputTemplate.PreviewImage.prototype.toObject>;
renameOutputFont?: string;
buildMode?: string;
languageAreas?: boolean;
multiThreads?: boolean;
fontFeature?: boolean;
reduceMins?: boolean;
autoSubset?: boolean;
subsetRemainChars?: boolean;
}): InputTemplate {
const message = new InputTemplate({});
if (data.input != null) {
message.input = data.input;
}
if (data.outDir != null) {
message.outDir = data.outDir;
}
if (data.css != null) {
message.css = InputTemplate.CssProperties.fromObject(data.css);
}
if (data.targetType != null) {
message.targetType = data.targetType;
}
if (data.subsets != null) {
message.subsets = data.subsets;
}
if (data.chunkSize != null) {
message.chunkSize = data.chunkSize;
}
if (data.chunkSizeTolerance != null) {
message.chunkSizeTolerance = data.chunkSizeTolerance;
}
if (data.maxAllowSubsetsCount != null) {
message.maxAllowSubsetsCount = data.maxAllowSubsetsCount;
}
if (data.testHtml != null) {
message.testHtml = data.testHtml;
}
if (data.reporter != null) {
message.reporter = data.reporter;
}
if (data.previewImage != null) {
message.previewImage = InputTemplate.PreviewImage.fromObject(data.previewImage);
}
if (data.renameOutputFont != null) {
message.renameOutputFont = data.renameOutputFont;
}
if (data.buildMode != null) {
message.buildMode = data.buildMode;
}
if (data.languageAreas != null) {
message.languageAreas = data.languageAreas;
}
if (data.multiThreads != null) {
message.multiThreads = data.multiThreads;
}
if (data.fontFeature != null) {
message.fontFeature = data.fontFeature;
}
if (data.reduceMins != null) {
message.reduceMins = data.reduceMins;
}
if (data.autoSubset != null) {
message.autoSubset = data.autoSubset;
}
if (data.subsetRemainChars != null) {
message.subsetRemainChars = data.subsetRemainChars;
}
return message;
}
toObject() {
const data: {
input?: Uint8Array;
outDir?: string;
css?: ReturnType<typeof InputTemplate.CssProperties.prototype.toObject>;
targetType?: string;
subsets?: Uint8Array[];
chunkSize?: number;
chunkSizeTolerance?: number;
maxAllowSubsetsCount?: number;
testHtml?: boolean;
reporter?: boolean;
previewImage?: ReturnType<typeof InputTemplate.PreviewImage.prototype.toObject>;
renameOutputFont?: string;
buildMode?: string;
languageAreas?: boolean;
multiThreads?: boolean;
fontFeature?: boolean;
reduceMins?: boolean;
autoSubset?: boolean;
subsetRemainChars?: boolean;
} = {};
if (this.input != null) {
data.input = this.input;
}
if (this.outDir != null) {
data.outDir = this.outDir;
}
if (this.css != null) {
data.css = this.css.toObject();
}
if (this.targetType != null) {
data.targetType = this.targetType;
}
if (this.subsets != null) {
data.subsets = this.subsets;
}
if (this.chunkSize != null) {
data.chunkSize = this.chunkSize;
}
if (this.chunkSizeTolerance != null) {
data.chunkSizeTolerance = this.chunkSizeTolerance;
}
if (this.maxAllowSubsetsCount != null) {
data.maxAllowSubsetsCount = this.maxAllowSubsetsCount;
}
if (this.testHtml != null) {
data.testHtml = this.testHtml;
}
if (this.reporter != null) {
data.reporter = this.reporter;
}
if (this.previewImage != null) {
data.previewImage = this.previewImage.toObject();
}
if (this.renameOutputFont != null) {
data.renameOutputFont = this.renameOutputFont;
}
if (this.buildMode != null) {
data.buildMode = this.buildMode;
}
if (this.languageAreas != null) {
data.languageAreas = this.languageAreas;
}
if (this.multiThreads != null) {
data.multiThreads = this.multiThreads;
}
if (this.fontFeature != null) {
data.fontFeature = this.fontFeature;
}
if (this.reduceMins != null) {
data.reduceMins = this.reduceMins;
}
if (this.autoSubset != null) {
data.autoSubset = this.autoSubset;
}
if (this.subsetRemainChars != null) {
data.subsetRemainChars = this.subsetRemainChars;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.input.length)
writer.writeBytes(1, this.input);
if (this.hasOutDir)
writer.writeString(2, this.outDir);
if (this.hasCss)
writer.writeMessage(5, this.css, () => this.css.serialize(writer));
if (this.hasTargetType)
writer.writeString(6, this.targetType);
if (this.subsets.length)
writer.writeRepeatedBytes(7, this.subsets);
if (this.hasChunkSize)
writer.writeInt32(9, this.chunkSize);
if (this.hasChunkSizeTolerance)
writer.writeFloat(10, this.chunkSizeTolerance);
if (this.hasMaxAllowSubsetsCount)
writer.writeInt32(11, this.maxAllowSubsetsCount);
if (this.hasTestHtml)
writer.writeBool(13, this.testHtml);
if (this.hasReporter)
writer.writeBool(14, this.reporter);
if (this.hasPreviewImage)
writer.writeMessage(15, this.previewImage, () => this.previewImage.serialize(writer));
if (this.hasRenameOutputFont)
writer.writeString(18, this.renameOutputFont);
if (this.hasBuildMode)
writer.writeString(20, this.buildMode);
if (this.hasLanguageAreas)
writer.writeBool(8, this.languageAreas);
if (this.hasMultiThreads)
writer.writeBool(21, this.multiThreads);
if (this.hasFontFeature)
writer.writeBool(22, this.fontFeature);
if (this.hasReduceMins)
writer.writeBool(23, this.reduceMins);
if (this.hasAutoSubset)
writer.writeBool(24, this.autoSubset);
if (this.hasSubsetRemainChars)
writer.writeBool(25, this.subsetRemainChars);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): InputTemplate {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new InputTemplate();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.input = reader.readBytes();
break;
case 2:
message.outDir = reader.readString();
break;
case 5:
reader.readMessage(message.css, () => message.css = InputTemplate.CssProperties.deserialize(reader));
break;
case 6:
message.targetType = reader.readString();
break;
case 7:
pb_1.Message.addToRepeatedField(message, 7, reader.readBytes());
break;
case 9:
message.chunkSize = reader.readInt32();
break;
case 10:
message.chunkSizeTolerance = reader.readFloat();
break;
case 11:
message.maxAllowSubsetsCount = reader.readInt32();
break;
case 13:
message.testHtml = reader.readBool();
break;
case 14:
message.reporter = reader.readBool();
break;
case 15:
reader.readMessage(message.previewImage, () => message.previewImage = InputTemplate.PreviewImage.deserialize(reader));
break;
case 18:
message.renameOutputFont = reader.readString();
break;
case 20:
message.buildMode = reader.readString();
break;
case 8:
message.languageAreas = reader.readBool();
break;
case 21:
message.multiThreads = reader.readBool();
break;
case 22:
message.fontFeature = reader.readBool();
break;
case 23:
message.reduceMins = reader.readBool();
break;
case 24:
message.autoSubset = reader.readBool();
break;
case 25:
message.subsetRemainChars = reader.readBool();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): InputTemplate {
return InputTemplate.deserialize(bytes);
}
}
export namespace InputTemplate {
export class CssProperties extends pb_1.Message {
#one_of_decls: number[][] = [[1], [2], [3], [4], [11], [12], [13], [8], [9]];
constructor(data?: any[] | ({
localFamily?: string[];
polyfill?: InputTemplate.PolyfillType[];
} & (({
fontFamily?: string;
}) | ({
fontWeight?: string;
}) | ({
fontStyle?: string;
}) | ({
fontDisplay?: string;
}) | ({
commentBase?: boolean;
}) | ({
commentNameTable?: boolean;
}) | ({
commentUnicodes?: boolean;
}) | ({
compress?: boolean;
}) | ({
fileName?: string;
})))) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [5, 6], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("fontFamily" in data && data.fontFamily != undefined) {
this.fontFamily = data.fontFamily;
}
if ("fontWeight" in data && data.fontWeight != undefined) {
this.fontWeight = data.fontWeight;
}
if ("fontStyle" in data && data.fontStyle != undefined) {
this.fontStyle = data.fontStyle;
}
if ("fontDisplay" in data && data.fontDisplay != undefined) {
this.fontDisplay = data.fontDisplay;
}
if ("localFamily" in data && data.localFamily != undefined) {
this.localFamily = data.localFamily;
}
if ("polyfill" in data && data.polyfill != undefined) {
this.polyfill = data.polyfill;
}
if ("commentBase" in data && data.commentBase != undefined) {
this.commentBase = data.commentBase;
}
if ("commentNameTable" in data && data.commentNameTable != undefined) {
this.commentNameTable = data.commentNameTable;
}
if ("commentUnicodes" in data && data.commentUnicodes != undefined) {
this.commentUnicodes = data.commentUnicodes;
}
if ("compress" in data && data.compress != undefined) {
this.compress = data.compress;
}
if ("fileName" in data && data.fileName != undefined) {
this.fileName = data.fileName;
}
}
}
get fontFamily() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set fontFamily(value: string) {
pb_1.Message.setOneofField(this, 1, this.#one_of_decls[0], value);
}
get hasFontFamily() {
return pb_1.Message.getField(this, 1) != null;
}
get fontWeight() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set fontWeight(value: string) {
pb_1.Message.setOneofField(this, 2, this.#one_of_decls[1], value);
}
get hasFontWeight() {
return pb_1.Message.getField(this, 2) != null;
}
get fontStyle() {
return pb_1.Message.getFieldWithDefault(this, 3, "") as string;
}
set fontStyle(value: string) {
pb_1.Message.setOneofField(this, 3, this.#one_of_decls[2], value);
}
get hasFontStyle() {
return pb_1.Message.getField(this, 3) != null;
}
get fontDisplay() {
return pb_1.Message.getFieldWithDefault(this, 4, "") as string;
}
set fontDisplay(value: string) {
pb_1.Message.setOneofField(this, 4, this.#one_of_decls[3], value);
}
get hasFontDisplay() {
return pb_1.Message.getField(this, 4) != null;
}
get localFamily() {
return pb_1.Message.getFieldWithDefault(this, 5, []) as string[];
}
set localFamily(value: string[]) {
pb_1.Message.setField(this, 5, value);
}
get polyfill() {
return pb_1.Message.getRepeatedWrapperField(this, InputTemplate.PolyfillType, 6) as InputTemplate.PolyfillType[];
}
set polyfill(value: InputTemplate.PolyfillType[]) {
pb_1.Message.setRepeatedWrapperField(this, 6, value);
}
get commentBase() {
return pb_1.Message.getFieldWithDefault(this, 11, false) as boolean;
}
set commentBase(value: boolean) {
pb_1.Message.setOneofField(this, 11, this.#one_of_decls[4], value);
}
get hasCommentBase() {
return pb_1.Message.getField(this, 11) != null;
}
get commentNameTable() {
return pb_1.Message.getFieldWithDefault(this, 12, false) as boolean;
}
set commentNameTable(value: boolean) {
pb_1.Message.setOneofField(this, 12, this.#one_of_decls[5], value);
}
get hasCommentNameTable() {
return pb_1.Message.getField(this, 12) != null;
}
get commentUnicodes() {
return pb_1.Message.getFieldWithDefault(this, 13, false) as boolean;
}
set commentUnicodes(value: boolean) {
pb_1.Message.setOneofField(this, 13, this.#one_of_decls[6], value);
}
get hasCommentUnicodes() {
return pb_1.Message.getField(this, 13) != null;
}
get compress() {
return pb_1.Message.getFieldWithDefault(this, 8, false) as boolean;
}
set compress(value: boolean) {
pb_1.Message.setOneofField(this, 8, this.#one_of_decls[7], value);
}
get hasCompress() {
return pb_1.Message.getField(this, 8) != null;
}
get fileName() {
return pb_1.Message.getFieldWithDefault(this, 9, "") as string;
}
set fileName(value: string) {
pb_1.Message.setOneofField(this, 9, this.#one_of_decls[8], value);
}
get hasFileName() {
return pb_1.Message.getField(this, 9) != null;
}
get _font_family() {
const cases: {
[index: number]: "none" | "fontFamily";
} = {
0: "none",
1: "fontFamily"
};
return cases[pb_1.Message.computeOneofCase(this, [1])];
}
get _font_weight() {
const cases: {
[index: number]: "none" | "fontWeight";
} = {
0: "none",
2: "fontWeight"
};
return cases[pb_1.Message.computeOneofCase(this, [2])];
}
get _font_style() {
const cases: {
[index: number]: "none" | "fontStyle";
} = {
0: "none",
3: "fontStyle"
};
return cases[pb_1.Message.computeOneofCase(this, [3])];
}
get _font_display() {
const cases: {
[index: number]: "none" | "fontDisplay";
} = {
0: "none",
4: "fontDisplay"
};
return cases[pb_1.Message.computeOneofCase(this, [4])];
}
get _comment_base() {
const cases: {
[index: number]: "none" | "commentBase";
} = {
0: "none",
11: "commentBase"
};
return cases[pb_1.Message.computeOneofCase(this, [11])];
}
get _comment_name_table() {
const cases: {
[index: number]: "none" | "commentNameTable";
} = {
0: "none",
12: "commentNameTable"
};
return cases[pb_1.Message.computeOneofCase(this, [12])];
}
get _comment_unicodes() {
const cases: {
[index: number]: "none" | "commentUnicodes";
} = {
0: "none",
13: "commentUnicodes"
};
return cases[pb_1.Message.computeOneofCase(this, [13])];
}
get _compress() {
const cases: {
[index: number]: "none" | "compress";
} = {
0: "none",
8: "compress"
};
return cases[pb_1.Message.computeOneofCase(this, [8])];
}
get _file_name() {
const cases: {
[index: number]: "none" | "fileName";
} = {
0: "none",
9: "fileName"
};
return cases[pb_1.Message.computeOneofCase(this, [9])];
}
static fromObject(data: {
fontFamily?: string;
fontWeight?: string;
fontStyle?: string;
fontDisplay?: string;
localFamily?: string[];
polyfill?: ReturnType<typeof InputTemplate.PolyfillType.prototype.toObject>[];
commentBase?: boolean;
commentNameTable?: boolean;
commentUnicodes?: boolean;
compress?: boolean;
fileName?: string;
}): CssProperties {
const message = new CssProperties({});
if (data.fontFamily != null) {
message.fontFamily = data.fontFamily;
}
if (data.fontWeight != null) {
message.fontWeight = data.fontWeight;
}
if (data.fontStyle != null) {
message.fontStyle = data.fontStyle;
}
if (data.fontDisplay != null) {
message.fontDisplay = data.fontDisplay;
}
if (data.localFamily != null) {
message.localFamily = data.localFamily;
}
if (data.polyfill != null) {
message.polyfill = data.polyfill.map(item => InputTemplate.PolyfillType.fromObject(item));
}
if (data.commentBase != null) {
message.commentBase = data.commentBase;
}
if (data.commentNameTable != null) {
message.commentNameTable = data.commentNameTable;
}
if (data.commentUnicodes != null) {
message.commentUnicodes = data.commentUnicodes;
}
if (data.compress != null) {
message.compress = data.compress;
}
if (data.fileName != null) {
message.fileName = data.fileName;
}
return message;
}
toObject() {
const data: {
fontFamily?: string;
fontWeight?: string;
fontStyle?: string;
fontDisplay?: string;
localFamily?: string[];
polyfill?: ReturnType<typeof InputTemplate.PolyfillType.prototype.toObject>[];
commentBase?: boolean;
commentNameTable?: boolean;
commentUnicodes?: boolean;
compress?: boolean;
fileName?: string;
} = {};
if (this.fontFamily != null) {
data.fontFamily = this.fontFamily;
}
if (this.fontWeight != null) {
data.fontWeight = this.fontWeight;
}
if (this.fontStyle != null) {
data.fontStyle = this.fontStyle;
}
if (this.fontDisplay != null) {
data.fontDisplay = this.fontDisplay;
}
if (this.localFamily != null) {
data.localFamily = this.localFamily;
}
if (this.polyfill != null) {
data.polyfill = this.polyfill.map((item: InputTemplate.PolyfillType) => item.toObject());
}
if (this.commentBase != null) {
data.commentBase = this.commentBase;
}
if (this.commentNameTable != null) {
data.commentNameTable = this.commentNameTable;
}
if (this.commentUnicodes != null) {
data.commentUnicodes = this.commentUnicodes;
}
if (this.compress != null) {
data.compress = this.compress;
}
if (this.fileName != null) {
data.fileName = this.fileName;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.hasFontFamily)
writer.writeString(1, this.fontFamily);
if (this.hasFontWeight)
writer.writeString(2, this.fontWeight);
if (this.hasFontStyle)
writer.writeString(3, this.fontStyle);
if (this.hasFontDisplay)
writer.writeString(4, this.fontDisplay);
if (this.localFamily.length)
writer.writeRepeatedString(5, this.localFamily);
if (this.polyfill.length)
writer.writeRepeatedMessage(6, this.polyfill, (item: InputTemplate.PolyfillType) => item.serialize(writer));
if (this.hasCommentBase)
writer.writeBool(11, this.commentBase);
if (this.hasCommentNameTable)
writer.writeBool(12, this.commentNameTable);
if (this.hasCommentUnicodes)
writer.writeBool(13, this.commentUnicodes);
if (this.hasCompress)
writer.writeBool(8, this.compress);
if (this.hasFileName)
writer.writeString(9, this.fileName);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CssProperties {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new CssProperties();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.fontFamily = reader.readString();
break;
case 2:
message.fontWeight = reader.readString();
break;
case 3:
message.fontStyle = reader.readString();
break;
case 4:
message.fontDisplay = reader.readString();
break;
case 5:
pb_1.Message.addToRepeatedField(message, 5, reader.readString());
break;
case 6:
reader.readMessage(message.polyfill, () => pb_1.Message.addToRepeatedWrapperField(message, 6, InputTemplate.PolyfillType.deserialize(reader), InputTemplate.PolyfillType));
break;
case 11:
message.commentBase = reader.readBool();
break;
case 12:
message.commentNameTable = reader.readBool();
break;
case 13:
message.commentUnicodes = reader.readBool();
break;
case 8:
message.compress = reader.readBool();
break;
case 9:
message.fileName = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CssProperties {
return CssProperties.deserialize(bytes);
}
}
export class PolyfillType extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
name?: string;
format?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("name" in data && data.name != undefined) {
this.name = data.name;
}
if ("format" in data && data.format != undefined) {
this.format = data.format;
}
}
}
get name() {
return pb_1.Message.getFieldWithDefault(this, 1, "") as string;
}
set name(value: string) {
pb_1.Message.setField(this, 1, value);
}
get format() {
return pb_1.Message.getFieldWithDefault(this, 2, "") as string;
}
set format(value: string) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
name?: string;
format?: string;
}): PolyfillType {
const message = new PolyfillType({});
if (data.name != null) {
message.name = data.name;
}
if (data.format != null) {
message.format = data.format;
}
return message;
}
toObject() {
const data: {
name?: string;
format?: string;
} = {};
if (this.name != null) {
data.name = this.name;
}
if (this.format != null) {
data.format = this.format;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.name.length)
writer.writeString(1, this.name);
if (this.format.length)
writer.writeString(2, this.format);
if (!w)
return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): PolyfillType {
const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new PolyfillType();
while (reader.nextField()) {
if (reader.isEndGroup())
break;
switch (reader.getFieldNumber()) {
case 1:
message.name = reader.readString();
break;
case 2:
message.format = reader.readString();
break;
default: reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): PolyfillType {
return PolyfillType.deserialize(bytes);
}
}
export class PreviewImage extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {
text?: string;
name?: string;
}) {
super();
pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls);
if (!Array.isArray(data) && typeof data == "object") {
if ("text" in data && data.text != undefined) {
this.text = data.text;
}
if ("name" in data && data.name != undefined) {
this.name = data.name;
}
}
}
get text() {
return pb_1.Message.get