textmode.js 0.1.6-beta.4 → 0.1.6-beta.6
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 +1487 -4016
- package/dist/textmode.esm.min.js +1486 -4014
- package/dist/textmode.umd.js +19 -19
- package/dist/textmode.umd.min.js +18 -18
- package/dist/types/ColorPalette.d.ts +1 -5
- package/dist/types/Textmode.d.ts +0 -10
- package/dist/types/export/image/ImageDataExtractor.d.ts +1 -1
- package/dist/types/export/image/ImageExporter.d.ts +1 -1
- package/dist/types/export/image/ImageFileHandler.d.ts +1 -7
- package/dist/types/export/svg/SVGContentGenerator.d.ts +1 -1
- package/dist/types/export/svg/SVGDataExtractor.d.ts +1 -1
- package/dist/types/export/svg/SVGPathGenerator.d.ts +0 -5
- package/dist/types/export/txt/TXTDataExtractor.d.ts +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/rendering/index.d.ts +0 -5
- package/dist/types/rendering/webgl/Framebuffer.d.ts +2 -9
- package/dist/types/rendering/webgl/Renderer.d.ts +2 -12
- package/dist/types/rendering/webgl/Shader.d.ts +5 -12
- package/dist/types/rendering/webgl/StateCache.d.ts +0 -2
- package/dist/types/rendering/webgl/geometries/BaseGeometry.d.ts +40 -0
- package/dist/types/rendering/webgl/geometries/Line.d.ts +6 -26
- package/dist/types/rendering/webgl/geometries/Rectangle.d.ts +8 -18
- package/dist/types/rendering/webgl/geometries/index.d.ts +3 -0
- package/dist/types/textmode/Canvas.d.ts +0 -11
- package/dist/types/textmode/ConversionPipeline.d.ts +12 -9
- package/dist/types/textmode/Grid.d.ts +1 -6
- package/dist/types/textmode/Textmodifier.d.ts +28 -610
- package/dist/types/textmode/converters/FeatureConverter.d.ts +24 -0
- package/dist/types/textmode/mixins/ConversionMixin.d.ts +63 -0
- package/dist/types/textmode/mixins/ExportMixin.d.ts +155 -0
- package/dist/types/textmode/mixins/FontMixin.d.ts +49 -0
- package/dist/types/textmode/mixins/RenderingMixin.d.ts +409 -0
- package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +39 -0
- package/dist/types/textmode/mixins/index.d.ts +5 -0
- package/package.json +3 -1
- package/dist/types/rendering/webgl/shapes/LineShape.d.ts +0 -20
- package/dist/types/rendering/webgl/shapes/RectangleShape.d.ts +0 -20
- package/dist/types/rendering/webgl/shapes/Shape.d.ts +0 -21
- package/dist/types/types/index.d.ts +0 -4
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base types and utilities for the mixin system
|
|
3
|
+
*/
|
|
4
|
+
import type { GLRenderer } from '../../rendering/webgl/Renderer';
|
|
5
|
+
import type { TextmodeFont } from '../font';
|
|
6
|
+
import type { TextmodeConversionPipeline } from '../ConversionPipeline';
|
|
7
|
+
import type { TextmodeCanvas } from '../Canvas';
|
|
8
|
+
import type { TextmodeGrid } from '../Grid';
|
|
9
|
+
/**
|
|
10
|
+
* Constructor type for mixin pattern
|
|
11
|
+
*/
|
|
12
|
+
export type Constructor<T = {}> = new (...args: any[]) => T;
|
|
13
|
+
/**
|
|
14
|
+
* Mixin function type that takes a base class and returns an extended class
|
|
15
|
+
*/
|
|
16
|
+
export type Mixin<T> = <TBase extends Constructor<TextmodifierContext>>(Base: TBase) => TBase & Constructor<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Essential properties that all mixins can access.
|
|
19
|
+
* This defines the contract for what mixins can expect to be available.
|
|
20
|
+
*/
|
|
21
|
+
export interface TextmodifierContext {
|
|
22
|
+
/** Core WebGL renderer @ignore */
|
|
23
|
+
readonly _renderer: GLRenderer;
|
|
24
|
+
/** Font management @ignore */
|
|
25
|
+
readonly _font: TextmodeFont;
|
|
26
|
+
/** Conversion pipeline @ignore */
|
|
27
|
+
readonly _pipeline: TextmodeConversionPipeline;
|
|
28
|
+
/** Canvas management @ignore */
|
|
29
|
+
readonly textmodeCanvas: TextmodeCanvas;
|
|
30
|
+
/** Grid management @ignore */
|
|
31
|
+
readonly _grid: TextmodeGrid;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Simple utility function to apply multiple mixins to a base class
|
|
35
|
+
* @param Base The base class to extend
|
|
36
|
+
* @param mixins Array of mixin functions to apply
|
|
37
|
+
* @returns The composed class with all mixins applied
|
|
38
|
+
*/
|
|
39
|
+
export declare function applyMixins<T extends Constructor>(Base: T, ...mixins: any[]): T;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { type Constructor, type Mixin, type TextmodifierContext, applyMixins } from './TextmodifierMixin';
|
|
2
|
+
export { RenderingMixin, type RenderingCapabilities } from './RenderingMixin';
|
|
3
|
+
export { ExportMixin, type ExportCapabilities } from './ExportMixin';
|
|
4
|
+
export { FontMixin, type FontCapabilities } from './FontMixin';
|
|
5
|
+
export { ConversionMixin, type ConversionCapabilities } from './ConversionMixin';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textmode.js",
|
|
3
|
-
"version": "0.1.6-beta.
|
|
3
|
+
"version": "0.1.6-beta.6",
|
|
4
4
|
"description": "Apply real-time ASCII conversion to any HTML canvas.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -32,10 +32,12 @@
|
|
|
32
32
|
"test:coverage": "vitest --coverage"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
35
36
|
"@types/jsdom": "^21.1.7",
|
|
36
37
|
"@types/node": "^24.0.13",
|
|
37
38
|
"@vitest/ui": "^3.1.2",
|
|
38
39
|
"jsdom": "^26.1.0",
|
|
40
|
+
"terser": "^5.43.1",
|
|
39
41
|
"tslib": "^2.8.1",
|
|
40
42
|
"typedoc": "^0.28.7",
|
|
41
43
|
"typedoc-plugin-markdown": "^4.7.0",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Shape } from "./Shape";
|
|
2
|
-
/**
|
|
3
|
-
* Line shape implementation that supports stroke rendering only (lines don't have fill).
|
|
4
|
-
* Uses the Line geometry class for efficient WebGL rendering.
|
|
5
|
-
*/
|
|
6
|
-
export declare class LineShape extends Shape {
|
|
7
|
-
private x2;
|
|
8
|
-
private y2;
|
|
9
|
-
constructor(gl: WebGLRenderingContext, x1: number, y1: number, x2: number, y2: number);
|
|
10
|
-
/**
|
|
11
|
-
* Lines don't support fill rendering - this method does nothing.
|
|
12
|
-
* Lines are rendered only with stroke properties.
|
|
13
|
-
*/
|
|
14
|
-
renderFill(): void;
|
|
15
|
-
/**
|
|
16
|
-
* Render the line with the specified stroke weight.
|
|
17
|
-
* @param weight The stroke thickness in pixels
|
|
18
|
-
*/
|
|
19
|
-
renderStroke(weight: number): void;
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Shape } from "./Shape";
|
|
2
|
-
/**
|
|
3
|
-
* Rectangle shape implementation that supports both fill and stroke rendering.
|
|
4
|
-
* Uses the existing Rectangle geometry class for efficient WebGL rendering.
|
|
5
|
-
*/
|
|
6
|
-
export declare class RectangleShape extends Shape {
|
|
7
|
-
private width;
|
|
8
|
-
private height;
|
|
9
|
-
constructor(gl: WebGLRenderingContext, x: number, y: number, width: number, height: number);
|
|
10
|
-
/**
|
|
11
|
-
* Render the filled rectangle using the existing Rectangle geometry.
|
|
12
|
-
*/
|
|
13
|
-
renderFill(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Render the stroke rectangle as four separate Rectangle instances for each edge.
|
|
16
|
-
* This approach ensures clean corners with proper overlap and leverages existing geometry.
|
|
17
|
-
* @param weight The stroke thickness in pixels
|
|
18
|
-
*/
|
|
19
|
-
renderStroke(weight: number): void;
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Abstract base class for all renderable shapes in the WebGL renderer.
|
|
3
|
-
* Provides a consistent interface for fill and stroke rendering across different shape types.
|
|
4
|
-
*/
|
|
5
|
-
export declare abstract class Shape {
|
|
6
|
-
protected gl: WebGLRenderingContext;
|
|
7
|
-
protected x: number;
|
|
8
|
-
protected y: number;
|
|
9
|
-
constructor(gl: WebGLRenderingContext, x: number, y: number);
|
|
10
|
-
/**
|
|
11
|
-
* Render the filled version of this shape.
|
|
12
|
-
* Should be implemented by each shape to provide optimal fill rendering.
|
|
13
|
-
*/
|
|
14
|
-
abstract renderFill(): void;
|
|
15
|
-
/**
|
|
16
|
-
* Render the stroke (outline) version of this shape.
|
|
17
|
-
* Should be implemented by each shape to provide optimal stroke rendering.
|
|
18
|
-
* @param weight The stroke thickness in pixels
|
|
19
|
-
*/
|
|
20
|
-
abstract renderStroke(weight: number): void;
|
|
21
|
-
}
|