UNPKG

@bitbybit-dev/base

Version:

Bit By Bit Developers Base CAD Library to Program Geometry

477 lines (476 loc) 13.2 kB
/* eslint-disable @typescript-eslint/no-namespace */ export var Text; (function (Text) { class TextDto { constructor(text) { /** * The text * @default Hello World */ this.text = "Hello World"; if (text !== undefined) { this.text = text; } } } Text.TextDto = TextDto; class TextSplitDto { constructor(text, separator) { /** * Text to split * @default a,b,c */ this.text = "a,b,c"; /** * Text to split by * @default , */ this.separator = ","; if (text !== undefined) { this.text = text; } if (separator !== undefined) { this.separator = separator; } } } Text.TextSplitDto = TextSplitDto; class TextReplaceDto { constructor(text, search, replaceWith) { /** * Text to replace * @default a-c */ this.text = "a-c"; /** * Text to search for * @default - */ this.search = "-"; /** * Text to replace found occurences * @default b */ this.replaceWith = "b"; if (text !== undefined) { this.text = text; } if (search !== undefined) { this.search = search; } if (replaceWith !== undefined) { this.replaceWith = replaceWith; } } } Text.TextReplaceDto = TextReplaceDto; class TextJoinDto { constructor(list, separator) { /** * Text to join by * @default , */ this.separator = ","; if (list !== undefined) { this.list = list; } if (separator !== undefined) { this.separator = separator; } } } Text.TextJoinDto = TextJoinDto; class ToStringDto { constructor(item) { if (item !== undefined) { this.item = item; } } } Text.ToStringDto = ToStringDto; class ToStringEachDto { constructor(list) { if (list !== undefined) { this.list = list; } } } Text.ToStringEachDto = ToStringEachDto; class TextFormatDto { constructor(text, values) { /** * Text to format * @default Hello {0} */ this.text = "Hello {0}"; /** * Values to format * @default ["World"] */ this.values = ["World"]; if (text !== undefined) { this.text = text; } if (values !== undefined) { this.values = values; } } } Text.TextFormatDto = TextFormatDto; class TextSearchDto { constructor(text, search) { /** * Text to search in * @default hello world */ this.text = "hello world"; /** * Text to search for * @default world */ this.search = "world"; if (text !== undefined) { this.text = text; } if (search !== undefined) { this.search = search; } } } Text.TextSearchDto = TextSearchDto; class TextSubstringDto { constructor(text, start, end) { /** * Text to extract from * @default hello world */ this.text = "hello world"; /** * Start index * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.start = 0; /** * End index * @default 5 * @minimum 0 * @maximum Infinity * @step 1 */ this.end = 5; if (text !== undefined) { this.text = text; } if (start !== undefined) { this.start = start; } if (end !== undefined) { this.end = end; } } } Text.TextSubstringDto = TextSubstringDto; class TextIndexDto { constructor(text, index) { /** * Text to get character from * @default hello */ this.text = "hello"; /** * Index of character * @default 0 * @minimum 0 * @maximum Infinity * @step 1 */ this.index = 0; if (text !== undefined) { this.text = text; } if (index !== undefined) { this.index = index; } } } Text.TextIndexDto = TextIndexDto; class TextPadDto { constructor(text, length, padString) { /** * Text to pad * @default x */ this.text = "x"; /** * Target length * @default 3 * @minimum 0 * @maximum Infinity * @step 1 */ this.length = 3; /** * String to pad with * @default a */ this.padString = "a"; if (text !== undefined) { this.text = text; } if (length !== undefined) { this.length = length; } if (padString !== undefined) { this.padString = padString; } } } Text.TextPadDto = TextPadDto; class TextRepeatDto { constructor(text, count) { /** * Text to repeat * @default ha */ this.text = "ha"; /** * Number of repetitions * @default 3 * @minimum 0 * @maximum Infinity * @step 1 */ this.count = 3; if (text !== undefined) { this.text = text; } if (count !== undefined) { this.count = count; } } } Text.TextRepeatDto = TextRepeatDto; class TextConcatDto { constructor(texts) { /** * Texts to concatenate * @default ["hello", " ", "world"] */ this.texts = ["hello", " ", "world"]; if (texts !== undefined) { this.texts = texts; } } } Text.TextConcatDto = TextConcatDto; class TextRegexDto { constructor(text, pattern, flags) { /** * Text to search in * @default hello123world */ this.text = "hello123world"; /** * Regular expression pattern * @default [0-9]+ */ this.pattern = "[0-9]+"; /** * Regular expression flags (g, i, m, s, u, y) * @default g */ this.flags = "g"; if (text !== undefined) { this.text = text; } if (pattern !== undefined) { this.pattern = pattern; } if (flags !== undefined) { this.flags = flags; } } } Text.TextRegexDto = TextRegexDto; class TextRegexReplaceDto { constructor(text, pattern, flags, replaceWith) { /** * Text to search in * @default hello123world456 */ this.text = "hello123world456"; /** * Regular expression pattern * @default [0-9]+ */ this.pattern = "[0-9]+"; /** * Regular expression flags (g, i, m, s, u, y) * @default g */ this.flags = "g"; /** * Text to replace matches with * @default X */ this.replaceWith = "X"; if (text !== undefined) { this.text = text; } if (pattern !== undefined) { this.pattern = pattern; } if (flags !== undefined) { this.flags = flags; } if (replaceWith !== undefined) { this.replaceWith = replaceWith; } } } Text.TextRegexReplaceDto = TextRegexReplaceDto; class VectorCharDto { constructor(char, xOffset, yOffset, height, extrudeOffset) { /** * The text * @default A */ this.char = "A"; /** * The x offset * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.xOffset = 0; /** * The y offset * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.yOffset = 0; /** * The height of the text * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.height = 1; /** * The extrude offset * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.extrudeOffset = 0; if (char !== undefined) { this.char = char; } if (xOffset !== undefined) { this.xOffset = xOffset; } if (yOffset !== undefined) { this.yOffset = yOffset; } if (height !== undefined) { this.height = height; } if (extrudeOffset !== undefined) { this.extrudeOffset = extrudeOffset; } } } Text.VectorCharDto = VectorCharDto; class VectorTextDto { constructor(text, xOffset, yOffset, height, lineSpacing, letterSpacing, align, extrudeOffset, centerOnOrigin) { /** * The x offset * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.xOffset = 0; /** * The y offset * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.yOffset = 0; /** * The height of the text * @default 1 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.height = 1; /** * The line spacing * @default 1.4 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.lineSpacing = 1.4; /** * The letter spacing offset * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.letterSpacing = 0; /** * The extrude offset * @default 0 * @minimum -Infinity * @maximum Infinity * @step 0.1 */ this.extrudeOffset = 0; /** * Will center text on 0, 0, 0 * @default false */ this.centerOnOrigin = false; if (text !== undefined) { this.text = text; } if (xOffset !== undefined) { this.xOffset = xOffset; } if (yOffset !== undefined) { this.yOffset = yOffset; } if (height !== undefined) { this.height = height; } if (lineSpacing !== undefined) { this.lineSpacing = lineSpacing; } if (letterSpacing !== undefined) { this.letterSpacing = letterSpacing; } if (align !== undefined) { this.align = align; } if (extrudeOffset !== undefined) { this.extrudeOffset = extrudeOffset; } if (centerOnOrigin !== undefined) { this.centerOnOrigin = centerOnOrigin; } } } Text.VectorTextDto = VectorTextDto; })(Text || (Text = {}));