textmode.js 0.1.6-beta.5 → 0.1.6-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/textmode.esm.js +1871 -0
- package/dist/textmode.esm.min.js +1870 -0
- package/dist/textmode.umd.js +64 -0
- package/dist/textmode.umd.min.js +63 -0
- package/dist/types/ColorPalette.d.ts +1 -5
- package/dist/types/Textmode.d.ts +0 -10
- package/dist/types/errors/Error.d.ts +3 -5
- package/dist/types/errors/ErrorHandler.d.ts +3 -3
- package/dist/types/export/base/DataExtractor.d.ts +3 -3
- package/dist/types/export/base/FileHandler.d.ts +6 -6
- package/dist/types/export/image/ImageContentGenerator.d.ts +3 -3
- package/dist/types/export/image/ImageDataExtractor.d.ts +2 -2
- package/dist/types/export/image/ImageExporter.d.ts +9 -9
- package/dist/types/export/image/ImageFileHandler.d.ts +3 -21
- package/dist/types/export/svg/SVGContentGenerator.d.ts +12 -12
- package/dist/types/export/svg/SVGDataExtractor.d.ts +4 -4
- package/dist/types/export/svg/SVGExporter.d.ts +6 -6
- package/dist/types/export/svg/SVGFileHandler.d.ts +3 -3
- package/dist/types/export/svg/SVGPathGenerator.d.ts +5 -11
- package/dist/types/export/txt/TXTContentGenerator.d.ts +1 -1
- package/dist/types/export/txt/TXTDataExtractor.d.ts +2 -2
- package/dist/types/export/txt/TXTExporter.d.ts +6 -6
- package/dist/types/export/txt/TXTFileHandler.d.ts +2 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/rendering/webgl/Framebuffer.d.ts +8 -8
- package/dist/types/rendering/webgl/Renderer.d.ts +35 -35
- package/dist/types/rendering/webgl/Shader.d.ts +14 -14
- package/dist/types/rendering/webgl/geometries/BaseGeometry.d.ts +10 -10
- package/dist/types/rendering/webgl/geometries/Line.d.ts +1 -1
- package/dist/types/rendering/webgl/geometries/Rectangle.d.ts +2 -2
- package/dist/types/textmode/Canvas.d.ts +9 -18
- package/dist/types/textmode/ConversionPipeline.d.ts +31 -20
- package/dist/types/textmode/Grid.d.ts +7 -12
- package/dist/types/textmode/Textmodifier.d.ts +18 -40
- package/dist/types/textmode/converters/BrightnessConverter.d.ts +8 -8
- package/dist/types/textmode/converters/Converter.d.ts +5 -5
- package/dist/types/textmode/converters/FeatureConverter.d.ts +27 -3
- package/dist/types/textmode/font/TextmodeFont.d.ts +8 -8
- package/dist/types/textmode/mixins/ConversionMixin.d.ts +63 -0
- package/dist/types/textmode/mixins/ExportMixin.d.ts +112 -1
- package/dist/types/textmode/mixins/FontMixin.d.ts +1 -1
- package/dist/types/textmode/mixins/RenderingMixin.d.ts +304 -1
- package/dist/types/textmode/mixins/{MixinBase.d.ts → TextmodifierMixin.d.ts} +4 -4
- package/dist/types/textmode/mixins/index.d.ts +2 -1
- package/package.json +16 -2
- package/dist/textmode.js +0 -26
- package/dist/textmode.min.js +0 -25
- package/dist/types/types/index.d.ts +0 -4
|
@@ -46,7 +46,7 @@ export declare class TextmodeErrorHandler {
|
|
|
46
46
|
private static _instance;
|
|
47
47
|
private _options;
|
|
48
48
|
private constructor();
|
|
49
|
-
static getInstance(): TextmodeErrorHandler;
|
|
49
|
+
static $getInstance(): TextmodeErrorHandler;
|
|
50
50
|
/**
|
|
51
51
|
* Handle an error based on the configured settings
|
|
52
52
|
* @returns true if execution should continue, false if error was handled
|
|
@@ -59,11 +59,11 @@ export declare class TextmodeErrorHandler {
|
|
|
59
59
|
* @param context Additional context for debugging
|
|
60
60
|
* @returns true if validation passed, false if validation failed and was handled
|
|
61
61
|
*/
|
|
62
|
-
validate(condition: boolean, message: string, context?: any): boolean;
|
|
62
|
+
$validate(condition: boolean, message: string, context?: any): boolean;
|
|
63
63
|
/**
|
|
64
64
|
* Set global error level
|
|
65
65
|
*/
|
|
66
|
-
setGlobalLevel(level: TextmodeErrorLevel): void;
|
|
66
|
+
$setGlobalLevel(level: TextmodeErrorLevel): void;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Singleton instance of the textmode.js error handler.
|
|
@@ -9,7 +9,7 @@ export declare abstract class DataExtractor {
|
|
|
9
9
|
* @param pipeline The conversion pipeline containing framebuffers
|
|
10
10
|
* @returns Object containing all pixel data arrays
|
|
11
11
|
*/
|
|
12
|
-
extractFramebufferData(pipeline: any): FramebufferData;
|
|
12
|
+
$extractFramebufferData(pipeline: any): FramebufferData;
|
|
13
13
|
/**
|
|
14
14
|
* Gets character index from character framebuffer pixels
|
|
15
15
|
* @param characterPixels Character framebuffer pixel data
|
|
@@ -17,14 +17,14 @@ export declare abstract class DataExtractor {
|
|
|
17
17
|
* @param charactersLength Total number of available characters
|
|
18
18
|
* @returns Character index
|
|
19
19
|
*/
|
|
20
|
-
protected
|
|
20
|
+
protected _getCharacterIndex(characterPixels: Uint8Array, pixelIndex: number): number;
|
|
21
21
|
/**
|
|
22
22
|
* Converts raw pixel data to RGBA color object
|
|
23
23
|
* @param pixels Pixel data array
|
|
24
24
|
* @param index Pixel index (already multiplied by 4 for RGBA)
|
|
25
25
|
* @returns RGBA color object with r, g, b, a properties
|
|
26
26
|
*/
|
|
27
|
-
protected
|
|
27
|
+
protected _pixelsToRGBA(pixels: Uint8Array, index: number): {
|
|
28
28
|
r: number;
|
|
29
29
|
g: number;
|
|
30
30
|
b: number;
|
|
@@ -9,24 +9,24 @@ export declare abstract class FileHandler {
|
|
|
9
9
|
* @param mimeType The MIME type for the blob
|
|
10
10
|
* @returns Blob object containing the content
|
|
11
11
|
*/
|
|
12
|
-
protected
|
|
12
|
+
protected _createBlob(content: string, mimeType: string): Blob;
|
|
13
13
|
/**
|
|
14
14
|
* Downloads content as a file
|
|
15
15
|
* @param content The content to download
|
|
16
16
|
* @param filename The filename (with extension)
|
|
17
17
|
* @param mimeType The MIME type for the content
|
|
18
18
|
*/
|
|
19
|
-
protected
|
|
19
|
+
protected _downloadFile(content: string, filename: string, mimeType: string): void;
|
|
20
20
|
/**
|
|
21
21
|
* Generates a timestamp string for filenames
|
|
22
22
|
* @returns Formatted timestamp string
|
|
23
23
|
*/
|
|
24
|
-
protected
|
|
24
|
+
protected _generateTimestamp(): string;
|
|
25
25
|
/**
|
|
26
26
|
* Generates a date-time string for filenames (alternative format)
|
|
27
27
|
* @returns Formatted date and time string
|
|
28
28
|
*/
|
|
29
|
-
protected
|
|
29
|
+
protected _generateDateTimeString(): {
|
|
30
30
|
date: string;
|
|
31
31
|
time: string;
|
|
32
32
|
};
|
|
@@ -35,12 +35,12 @@ export declare abstract class FileHandler {
|
|
|
35
35
|
* @param filename The filename to validate
|
|
36
36
|
* @returns Sanitized filename
|
|
37
37
|
*/
|
|
38
|
-
protected
|
|
38
|
+
protected _sanitizeFilename(filename: string): string;
|
|
39
39
|
/**
|
|
40
40
|
* Generates a default filename with prefix and timestamp
|
|
41
41
|
* @param prefix The prefix for the filename
|
|
42
42
|
* @param extension The file extension (with dot)
|
|
43
43
|
* @returns Generated filename
|
|
44
44
|
*/
|
|
45
|
-
generateDefaultFilename(): string;
|
|
45
|
+
$generateDefaultFilename(): string;
|
|
46
46
|
}
|
|
@@ -10,18 +10,18 @@ export declare class ImageContentGenerator {
|
|
|
10
10
|
* @param options Generation options with format, quality, etc.
|
|
11
11
|
* @returns Data URL string containing the image data
|
|
12
12
|
*/
|
|
13
|
-
generateImageData(canvas: HTMLCanvasElement, options: ImageGenerationOptions): string;
|
|
13
|
+
$generateImageData(canvas: HTMLCanvasElement, options: ImageGenerationOptions): string;
|
|
14
14
|
/**
|
|
15
15
|
* Generates image blob from canvas
|
|
16
16
|
* @param canvas The canvas containing the image data
|
|
17
17
|
* @param options Generation options with format, quality, etc.
|
|
18
18
|
* @returns Promise that resolves to a Blob containing the image data
|
|
19
19
|
*/
|
|
20
|
-
generateImageBlob(canvas: HTMLCanvasElement, options: ImageGenerationOptions): Promise<Blob>;
|
|
20
|
+
$generateImageBlob(canvas: HTMLCanvasElement, options: ImageGenerationOptions): Promise<Blob>;
|
|
21
21
|
/**
|
|
22
22
|
* Gets the MIME type for a given image format
|
|
23
23
|
* @param format The image format
|
|
24
24
|
* @returns The corresponding MIME type
|
|
25
25
|
*/
|
|
26
|
-
private
|
|
26
|
+
private _getMimeType;
|
|
27
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TextmodeCanvas } from '../../
|
|
1
|
+
import type { TextmodeCanvas } from '../../index';
|
|
2
2
|
import { DataExtractor } from '../base/DataExtractor';
|
|
3
3
|
/**
|
|
4
4
|
* Data extractor for image export.
|
|
@@ -12,5 +12,5 @@ export declare class ImageDataExtractor extends DataExtractor {
|
|
|
12
12
|
* @param backgroundColor Background color for formats that don't support transparency
|
|
13
13
|
* @returns Canvas element containing the captured image data
|
|
14
14
|
*/
|
|
15
|
-
captureCanvasData(canvas: TextmodeCanvas, scale?: number, backgroundColor?: string): HTMLCanvasElement;
|
|
15
|
+
$captureCanvasData(canvas: TextmodeCanvas, scale?: number, backgroundColor?: string): HTMLCanvasElement;
|
|
16
16
|
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import type { ImageExportOptions } from './types';
|
|
2
|
-
import type { TextmodeCanvas } from '../../
|
|
2
|
+
import type { TextmodeCanvas } from '../../index';
|
|
3
3
|
/**
|
|
4
4
|
* Main image exporter for the textmode.js library.
|
|
5
5
|
* Orchestrates the image export process by coordinating canvas capture,
|
|
6
6
|
* format conversion, and file handling.
|
|
7
7
|
*/
|
|
8
8
|
export declare class ImageExporter {
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
private
|
|
9
|
+
private _dataExtractor;
|
|
10
|
+
private _contentGenerator;
|
|
11
|
+
private _fileHandler;
|
|
12
12
|
constructor();
|
|
13
13
|
/**
|
|
14
14
|
* Applies default values to image export options
|
|
15
15
|
* @param options User-provided options
|
|
16
16
|
* @returns Complete options with defaults applied
|
|
17
17
|
*/
|
|
18
|
-
private
|
|
18
|
+
private _applyDefaultOptions;
|
|
19
19
|
/**
|
|
20
20
|
* Validates export options and browser support
|
|
21
21
|
* @param options The options to validate
|
|
22
22
|
* @throws Error if options are invalid or format is not supported
|
|
23
23
|
*/
|
|
24
|
-
private
|
|
24
|
+
private _validateOptions;
|
|
25
25
|
/**
|
|
26
26
|
* Generates image data from textmode rendering without saving to file
|
|
27
27
|
* @param canvas The canvas data containing the rendered textmode graphics
|
|
28
28
|
* @param options Export options (excluding filename)
|
|
29
29
|
* @returns Data URL string containing the image data
|
|
30
30
|
*/
|
|
31
|
-
generateImage(canvas: TextmodeCanvas, options?: Omit<ImageExportOptions, 'filename'>): string;
|
|
31
|
+
$generateImage(canvas: TextmodeCanvas, options?: Omit<ImageExportOptions, 'filename'>): string;
|
|
32
32
|
/**
|
|
33
33
|
* Generates image blob from textmode rendering without saving to file
|
|
34
34
|
* @param canvasData The canvas data containing the rendered textmode graphics
|
|
35
35
|
* @param options Export options (excluding filename)
|
|
36
36
|
* @returns Promise that resolves to a Blob containing the image data
|
|
37
37
|
*/
|
|
38
|
-
generateImageBlob(canvas: TextmodeCanvas, options?: Omit<ImageExportOptions, 'filename'>): Promise<Blob>;
|
|
38
|
+
$generateImageBlob(canvas: TextmodeCanvas, options?: Omit<ImageExportOptions, 'filename'>): Promise<Blob>;
|
|
39
39
|
/**
|
|
40
40
|
* Exports image to a downloadable file
|
|
41
41
|
* @param canvas The canvas data containing the rendered textmode graphics
|
|
42
42
|
* @param options Export options including filename
|
|
43
43
|
*/
|
|
44
|
-
saveImage(canvas: TextmodeCanvas, options?: ImageExportOptions): Promise<void>;
|
|
44
|
+
$saveImage(canvas: TextmodeCanvas, options?: ImageExportOptions): Promise<void>;
|
|
45
45
|
}
|
|
@@ -11,35 +11,17 @@ export declare class ImageFileHandler extends FileHandler {
|
|
|
11
11
|
* @param filename The filename (without extension)
|
|
12
12
|
* @param format The image format
|
|
13
13
|
*/
|
|
14
|
-
saveImage(content:
|
|
15
|
-
/**
|
|
16
|
-
* Saves image from data URL
|
|
17
|
-
* @param dataURL The data URL containing image data
|
|
18
|
-
* @param filename The complete filename with extension
|
|
19
|
-
*/
|
|
20
|
-
private saveImageFromDataURL;
|
|
14
|
+
$saveImage(content: Blob, filename: string, format: ImageFormat): void;
|
|
21
15
|
/**
|
|
22
16
|
* Saves image from blob
|
|
23
17
|
* @param blob The blob containing image data
|
|
24
18
|
* @param filename The complete filename with extension
|
|
25
19
|
*/
|
|
26
|
-
private
|
|
20
|
+
private _saveImageFromBlob;
|
|
27
21
|
/**
|
|
28
22
|
* Validates if the browser supports saving files in the specified format
|
|
29
23
|
* @param format The image format to validate
|
|
30
24
|
* @returns True if the format is supported for saving
|
|
31
25
|
*/
|
|
32
|
-
validateSaveSupport(format: ImageFormat): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Gets the MIME type for the specified image format
|
|
35
|
-
* @param format The image format
|
|
36
|
-
* @returns The MIME type string
|
|
37
|
-
*/
|
|
38
|
-
getMimeType(format: ImageFormat): string;
|
|
39
|
-
/**
|
|
40
|
-
* Gets the file extension for the specified image format
|
|
41
|
-
* @param format The image format
|
|
42
|
-
* @returns The file extension (including the dot)
|
|
43
|
-
*/
|
|
44
|
-
getFileExtension(format: ImageFormat): string;
|
|
26
|
+
$validateSaveSupport(format: ImageFormat): boolean;
|
|
45
27
|
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import type { SVGCellData, SVGGenerationOptions } from './types';
|
|
2
|
-
import type { TextmodeFont, TextmodeGrid } from '../../
|
|
2
|
+
import type { TextmodeFont, TextmodeGrid } from '../../index';
|
|
3
3
|
/**
|
|
4
4
|
* Generates SVG content and markup from processed cell data.
|
|
5
5
|
* This class handles the creation of SVG elements, groups, and styling.
|
|
6
6
|
*/
|
|
7
7
|
export declare class SVGContentGenerator {
|
|
8
|
-
private
|
|
8
|
+
private _pathGenerator;
|
|
9
9
|
constructor();
|
|
10
10
|
/**
|
|
11
11
|
* Generates the SVG header with metadata
|
|
12
12
|
* @param gridInfo Grid dimensions
|
|
13
13
|
* @returns SVG header string
|
|
14
14
|
*/
|
|
15
|
-
generateSVGHeader(gridInfo: TextmodeGrid): string;
|
|
15
|
+
$generateSVGHeader(gridInfo: TextmodeGrid): string;
|
|
16
16
|
/**
|
|
17
17
|
* Generates the SVG footer
|
|
18
18
|
* @returns SVG footer string
|
|
19
19
|
*/
|
|
20
|
-
generateSVGFooter(): string;
|
|
20
|
+
$generateSVGFooter(): string;
|
|
21
21
|
/**
|
|
22
22
|
* Generates background rectangle if needed
|
|
23
23
|
* @param gridInfo Grid information
|
|
24
24
|
* @param options SVG generation options
|
|
25
25
|
* @returns Background rectangle SVG string or empty string
|
|
26
26
|
*/
|
|
27
|
-
generateBackground(gridInfo: TextmodeGrid, options: SVGGenerationOptions): string;
|
|
27
|
+
$generateBackground(gridInfo: TextmodeGrid, options: SVGGenerationOptions): string;
|
|
28
28
|
/**
|
|
29
29
|
* Converts RGBA object to CSS color string
|
|
30
30
|
* @param color RGBA color object
|
|
31
31
|
* @returns CSS color string
|
|
32
32
|
*/
|
|
33
|
-
private
|
|
33
|
+
private _rgbaToColorString;
|
|
34
34
|
/**
|
|
35
35
|
* Generates SVG transform attribute string
|
|
36
36
|
* @param cellData Cell data with transform information
|
|
37
37
|
* @param gridInfo Grid information for center calculations
|
|
38
38
|
* @returns Transform attribute string or empty string
|
|
39
39
|
*/
|
|
40
|
-
private
|
|
40
|
+
private _generateTransformAttribute;
|
|
41
41
|
/**
|
|
42
42
|
* Generates background rectangle for a cell
|
|
43
43
|
* @param cellData Cell data
|
|
@@ -45,7 +45,7 @@ export declare class SVGContentGenerator {
|
|
|
45
45
|
* @param options SVG generation options
|
|
46
46
|
* @returns Background rectangle SVG string or empty string
|
|
47
47
|
*/
|
|
48
|
-
private
|
|
48
|
+
private _generateCellBackground;
|
|
49
49
|
/**
|
|
50
50
|
* Generates character path element for a cell
|
|
51
51
|
* @param cellData Cell data
|
|
@@ -54,7 +54,7 @@ export declare class SVGContentGenerator {
|
|
|
54
54
|
* @param options SVG generation options
|
|
55
55
|
* @returns Character path SVG string
|
|
56
56
|
*/
|
|
57
|
-
private
|
|
57
|
+
private _generateCharacterPath;
|
|
58
58
|
/**
|
|
59
59
|
* Generates complete SVG content for a single cell
|
|
60
60
|
* @param cellData Cell data
|
|
@@ -63,7 +63,7 @@ export declare class SVGContentGenerator {
|
|
|
63
63
|
* @param options SVG generation options
|
|
64
64
|
* @returns Complete cell SVG content
|
|
65
65
|
*/
|
|
66
|
-
generateCellContent(cellData: SVGCellData, gridInfo: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
66
|
+
$generateCellContent(cellData: SVGCellData, gridInfo: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
67
67
|
/**
|
|
68
68
|
* Generates the complete SVG content from cell data
|
|
69
69
|
* @param cellDataArray Array of cell data
|
|
@@ -72,11 +72,11 @@ export declare class SVGContentGenerator {
|
|
|
72
72
|
* @param options SVG generation options
|
|
73
73
|
* @returns Complete SVG string
|
|
74
74
|
*/
|
|
75
|
-
generateSVGContent(cellDataArray: SVGCellData[], grid: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
75
|
+
$generateSVGContent(cellDataArray: SVGCellData[], grid: TextmodeGrid, fontInfo: TextmodeFont, options: SVGGenerationOptions): string;
|
|
76
76
|
/**
|
|
77
77
|
* Optimizes SVG content by removing empty elements and unnecessary whitespace
|
|
78
78
|
* @param svgContent Raw SVG content
|
|
79
79
|
* @returns Optimized SVG content
|
|
80
80
|
*/
|
|
81
|
-
optimizeSVGContent(svgContent: string): string;
|
|
81
|
+
$optimizeSVGContent(svgContent: string): string;
|
|
82
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FramebufferData, SVGCellData } from './types';
|
|
2
2
|
import { DataExtractor } from '../base';
|
|
3
|
-
import type { TextmodeGrid } from '../../
|
|
3
|
+
import type { TextmodeGrid } from '../../index';
|
|
4
4
|
/**
|
|
5
5
|
* Extracts and processes data from framebuffers for SVG generation.
|
|
6
6
|
* This class handles the conversion of raw pixel data into structured data objects.
|
|
@@ -13,7 +13,7 @@ export declare class SVGDataExtractor extends DataExtractor {
|
|
|
13
13
|
* @param pixelIndex Pixel index in the array
|
|
14
14
|
* @returns Transform data object
|
|
15
15
|
*/
|
|
16
|
-
private
|
|
16
|
+
private _extractTransformData;
|
|
17
17
|
/**
|
|
18
18
|
* Calculates cell position information
|
|
19
19
|
* @param x Grid X coordinate
|
|
@@ -21,7 +21,7 @@ export declare class SVGDataExtractor extends DataExtractor {
|
|
|
21
21
|
* @param gridInfo Grid information
|
|
22
22
|
* @returns Position data object
|
|
23
23
|
*/
|
|
24
|
-
private
|
|
24
|
+
private _calculateCellPosition;
|
|
25
25
|
/**
|
|
26
26
|
* Processes all grid cells and extracts SVG cell data
|
|
27
27
|
* @param framebufferData Raw pixel data from framebuffers
|
|
@@ -29,5 +29,5 @@ export declare class SVGDataExtractor extends DataExtractor {
|
|
|
29
29
|
* @param font Font information
|
|
30
30
|
* @returns Array of SVG cell data objects
|
|
31
31
|
*/
|
|
32
|
-
extractSVGCellData(framebufferData: FramebufferData, grid: TextmodeGrid): SVGCellData[];
|
|
32
|
+
$extractSVGCellData(framebufferData: FramebufferData, grid: TextmodeGrid): SVGCellData[];
|
|
33
33
|
}
|
|
@@ -5,27 +5,27 @@ import type { SVGExportOptions } from './types';
|
|
|
5
5
|
* content generation, and file handling.
|
|
6
6
|
*/
|
|
7
7
|
export declare class SVGExporter {
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
8
|
+
private _dataExtractor;
|
|
9
|
+
private _contentGenerator;
|
|
10
|
+
private _fileHandler;
|
|
11
11
|
constructor();
|
|
12
12
|
/**
|
|
13
13
|
* Applies default values to SVG export options
|
|
14
14
|
* @param options User-provided options
|
|
15
15
|
* @returns Complete options with defaults applied
|
|
16
16
|
*/
|
|
17
|
-
private
|
|
17
|
+
private _applyDefaultOptions;
|
|
18
18
|
/**
|
|
19
19
|
* Generates SVG content from textmode rendering data without saving to file
|
|
20
20
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
21
21
|
* @param options Export options (excluding filename)
|
|
22
22
|
* @returns SVG content as string
|
|
23
23
|
*/
|
|
24
|
-
generateSVG(textmodifier: any, options?: Omit<SVGExportOptions, 'filename'>): string;
|
|
24
|
+
$generateSVG(textmodifier: any, options?: Omit<SVGExportOptions, 'filename'>): string;
|
|
25
25
|
/**
|
|
26
26
|
* Exports SVG content to a downloadable file
|
|
27
27
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
28
28
|
* @param options Export options including filename
|
|
29
29
|
*/
|
|
30
|
-
saveSVG(textmodifier: any, options?: SVGExportOptions): void;
|
|
30
|
+
$saveSVG(textmodifier: any, options?: SVGExportOptions): void;
|
|
31
31
|
}
|
|
@@ -9,17 +9,17 @@ export declare class SVGFileHandler extends FileHandler {
|
|
|
9
9
|
* @param svgContent The SVG content string
|
|
10
10
|
* @returns Blob object containing the SVG data
|
|
11
11
|
*/
|
|
12
|
-
createSVGBlob(svgContent: string): Blob;
|
|
12
|
+
$createSVGBlob(svgContent: string): Blob;
|
|
13
13
|
/**
|
|
14
14
|
* Downloads SVG content as a file
|
|
15
15
|
* @param svgContent The SVG content to download
|
|
16
16
|
* @param filename The filename (without extension)
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
private _downloadSVG;
|
|
19
19
|
/**
|
|
20
20
|
* Saves SVG content with automatic filename generation if not provided
|
|
21
21
|
* @param svgContent The SVG content to save
|
|
22
22
|
* @param filename Optional filename (will generate if not provided)
|
|
23
23
|
*/
|
|
24
|
-
saveSVG(svgContent: string, filename?: string): void;
|
|
24
|
+
$saveSVG(svgContent: string, filename?: string): void;
|
|
25
25
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GlyphPath } from './types';
|
|
2
1
|
import type { TyprFont } from '../../textmode/font/types.ts';
|
|
3
2
|
/**
|
|
4
3
|
* Handles SVG path generation for character glyphs.
|
|
@@ -11,12 +10,7 @@ export declare class SVGPathGenerator {
|
|
|
11
10
|
* @param codePoint The Unicode code point to look up
|
|
12
11
|
* @returns The glyph index, or 0 if not found
|
|
13
12
|
*/
|
|
14
|
-
private
|
|
15
|
-
/**
|
|
16
|
-
* Creates an empty path object for characters with no glyph data
|
|
17
|
-
* @returns Empty path object
|
|
18
|
-
*/
|
|
19
|
-
private createEmptyPath;
|
|
13
|
+
private _getGlyphIndex;
|
|
20
14
|
/**
|
|
21
15
|
* Creates a path object for a glyph
|
|
22
16
|
* @param fontData Font data object
|
|
@@ -26,7 +20,7 @@ export declare class SVGPathGenerator {
|
|
|
26
20
|
* @param fontSize Font size
|
|
27
21
|
* @returns Path object with bounding box and SVG methods
|
|
28
22
|
*/
|
|
29
|
-
private
|
|
23
|
+
private _createGlyphPath;
|
|
30
24
|
/**
|
|
31
25
|
* Converts glyph data to SVG path string
|
|
32
26
|
* @param glyphData Glyph data from font
|
|
@@ -35,7 +29,7 @@ export declare class SVGPathGenerator {
|
|
|
35
29
|
* @param scale Scale factor
|
|
36
30
|
* @returns SVG path data string
|
|
37
31
|
*/
|
|
38
|
-
private
|
|
32
|
+
private _glyphToSVGPath;
|
|
39
33
|
/**
|
|
40
34
|
* Generates an SVG path for a character glyph
|
|
41
35
|
* @param character The character to generate a path for
|
|
@@ -45,7 +39,7 @@ export declare class SVGPathGenerator {
|
|
|
45
39
|
* @param fontSize Font size
|
|
46
40
|
* @returns Path object with SVG generation methods
|
|
47
41
|
*/
|
|
48
|
-
|
|
42
|
+
private _generateCharacterPath;
|
|
49
43
|
/**
|
|
50
44
|
* Generates SVG path data for a character with positioning calculations
|
|
51
45
|
* @param character The character to render
|
|
@@ -58,5 +52,5 @@ export declare class SVGPathGenerator {
|
|
|
58
52
|
* @param advanceWidth Character advance width
|
|
59
53
|
* @returns SVG path data string or null if generation fails
|
|
60
54
|
*/
|
|
61
|
-
generatePositionedCharacterPath(character: string, fontData: TyprFont, cellX: number, cellY: number, cellWidth: number, cellHeight: number, fontSize: number, advanceWidth: number): string | null;
|
|
55
|
+
$generatePositionedCharacterPath(character: string, fontData: TyprFont, cellX: number, cellY: number, cellWidth: number, cellHeight: number, fontSize: number, advanceWidth: number): string | null;
|
|
62
56
|
}
|
|
@@ -10,5 +10,5 @@ export declare class TXTContentGenerator {
|
|
|
10
10
|
* @param options Generation options
|
|
11
11
|
* @returns TXT content as string
|
|
12
12
|
*/
|
|
13
|
-
generateTXTContent(characterGrid: string[][], options: TXTGenerationOptions): string;
|
|
13
|
+
$generateTXTContent(characterGrid: string[][], options: TXTGenerationOptions): string;
|
|
14
14
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FramebufferData } from './types';
|
|
2
2
|
import { DataExtractor } from '../base';
|
|
3
|
-
import type { TextmodeFont, TextmodeGrid } from '../../
|
|
3
|
+
import type { TextmodeFont, TextmodeGrid } from '../../index';
|
|
4
4
|
/**
|
|
5
5
|
* Extracts and processes data from framebuffers for TXT generation.
|
|
6
6
|
* This class handles the conversion of raw pixel data into character arrays.
|
|
@@ -14,5 +14,5 @@ export declare class TXTDataExtractor extends DataExtractor {
|
|
|
14
14
|
* @param emptyCharacter Character to use for empty cells
|
|
15
15
|
* @returns 2D array of characters (rows x columns)
|
|
16
16
|
*/
|
|
17
|
-
extractCharacterGrid(framebufferData: FramebufferData, grid: TextmodeGrid, font: TextmodeFont, emptyCharacter?: string): string[][];
|
|
17
|
+
$extractCharacterGrid(framebufferData: FramebufferData, grid: TextmodeGrid, font: TextmodeFont, emptyCharacter?: string): string[][];
|
|
18
18
|
}
|
|
@@ -5,27 +5,27 @@ import type { TXTExportOptions } from './types';
|
|
|
5
5
|
* content generation, and file handling.
|
|
6
6
|
*/
|
|
7
7
|
export declare class TXTExporter {
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
8
|
+
private _dataExtractor;
|
|
9
|
+
private _contentGenerator;
|
|
10
|
+
private _fileHandler;
|
|
11
11
|
constructor();
|
|
12
12
|
/**
|
|
13
13
|
* Applies default values to TXT export options
|
|
14
14
|
* @param options User-provided options
|
|
15
15
|
* @returns Complete options with defaults applied
|
|
16
16
|
*/
|
|
17
|
-
private
|
|
17
|
+
private _applyDefaultOptions;
|
|
18
18
|
/**
|
|
19
19
|
* Generates TXT content from textmode rendering data without saving to file
|
|
20
20
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
21
21
|
* @param options Export options (excluding filename)
|
|
22
22
|
* @returns TXT content as string
|
|
23
23
|
*/
|
|
24
|
-
generateTXT(textmodifier: any, options?: Omit<TXTExportOptions, 'filename'>): string;
|
|
24
|
+
$generateTXT(textmodifier: any, options?: Omit<TXTExportOptions, 'filename'>): string;
|
|
25
25
|
/**
|
|
26
26
|
* Exports TXT content to a downloadable file
|
|
27
27
|
* @param textmodifier The textmodifier instance containing rendering data
|
|
28
28
|
* @param options Export options including filename
|
|
29
29
|
*/
|
|
30
|
-
saveTXT(textmodifier: any, options?: TXTExportOptions): void;
|
|
30
|
+
$saveTXT(textmodifier: any, options?: TXTExportOptions): void;
|
|
31
31
|
}
|
|
@@ -9,11 +9,11 @@ export declare class TXTFileHandler extends FileHandler {
|
|
|
9
9
|
* @param content The TXT content to save
|
|
10
10
|
* @param filename The filename to use for the download
|
|
11
11
|
*/
|
|
12
|
-
saveTXT(content: string, filename: string): void;
|
|
12
|
+
$saveTXT(content: string, filename: string): void;
|
|
13
13
|
/**
|
|
14
14
|
* Ensures filename has proper extension and is valid
|
|
15
15
|
* @param filename The filename to validate and fix
|
|
16
16
|
* @returns Valid filename with .txt extension
|
|
17
17
|
*/
|
|
18
|
-
private
|
|
18
|
+
private _ensureValidFilename;
|
|
19
19
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export { TextmodeErrorLevel } from './errors/ErrorHandler';
|
|
|
12
12
|
/** Contains all converters that can be added to a rendering pipeline to shape the textmode output. */
|
|
13
13
|
export * as converters from './textmode/converters';
|
|
14
14
|
export { Textmode as textmode } from './Textmode';
|
|
15
|
-
export default Textmode;
|
|
16
15
|
/**
|
|
17
16
|
* Exports the create, setErrorLevel, and version functions from the Textmode class for UMD compatibility,
|
|
18
17
|
* so calls like `textmode.create()` can be used.
|
|
@@ -13,22 +13,22 @@ export type MediaSource = HTMLCanvasElement | HTMLVideoElement;
|
|
|
13
13
|
* Can also be used as a standalone texture (without render target functionality).
|
|
14
14
|
*/
|
|
15
15
|
export declare class Framebuffer {
|
|
16
|
-
private
|
|
16
|
+
private _gl;
|
|
17
17
|
private _framebuffer;
|
|
18
18
|
private _texture;
|
|
19
19
|
private _width;
|
|
20
20
|
private _height;
|
|
21
|
-
private
|
|
22
|
-
private
|
|
21
|
+
private _options;
|
|
22
|
+
private _previousState;
|
|
23
23
|
private _pixels;
|
|
24
24
|
constructor(gl: WebGLRenderingContext, width: number, height?: number, options?: FramebufferOptions);
|
|
25
25
|
/**
|
|
26
26
|
* Execute a function with this framebuffer bound, then restore previous binding
|
|
27
27
|
*/
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
28
|
+
private _withFramebufferBound;
|
|
29
|
+
private _createTexture;
|
|
30
|
+
private _updateTextureSize;
|
|
31
|
+
private _attachTexture;
|
|
32
32
|
/**
|
|
33
33
|
* Update the framebuffer texture with canvas or video content
|
|
34
34
|
*/
|
|
@@ -75,7 +75,7 @@ export declare class Framebuffer {
|
|
|
75
75
|
* Dispose of WebGL resources used by this framebuffer.
|
|
76
76
|
* This method is idempotent and safe to call multiple times.
|
|
77
77
|
*/
|
|
78
|
-
dispose(): void;
|
|
78
|
+
$dispose(): void;
|
|
79
79
|
get framebuffer(): WebGLFramebuffer | null;
|
|
80
80
|
get texture(): WebGLTexture;
|
|
81
81
|
get width(): number;
|