textmode.js 0.2.1-beta.3 → 0.2.1-beta.5
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 +2145 -1808
- package/dist/textmode.esm.min.js +1715 -1377
- package/dist/textmode.umd.js +9 -9
- package/dist/textmode.umd.min.js +8 -7
- package/dist/types/assets/shaders-minified/frag/image-to-mrt.d.ts +14 -0
- package/dist/types/assets/shaders-minified/frag/present.d.ts +14 -0
- package/dist/types/assets/shaders-minified/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/rendering/index.d.ts +0 -2
- package/dist/types/rendering/webgl/DrawQueue.d.ts +9 -7
- package/dist/types/rendering/webgl/InstanceData.d.ts +15 -15
- package/dist/types/rendering/webgl/RenderPipeline.d.ts +1 -0
- package/dist/types/rendering/webgl/RenderState.d.ts +13 -19
- package/dist/types/rendering/webgl/Renderer.d.ts +13 -2
- package/dist/types/rendering/webgl/Shader.d.ts +20 -5
- package/dist/types/rendering/webgl/ShaderManager.d.ts +12 -11
- package/dist/types/rendering/webgl/geometries/BaseGeometry.d.ts +2 -1
- package/dist/types/rendering/webgl/types/DrawCommand.d.ts +2 -2
- package/dist/types/textmode/Canvas.d.ts +6 -0
- package/dist/types/textmode/TextmodeImage.d.ts +92 -0
- package/dist/types/textmode/Textmodifier.d.ts +17 -2
- package/dist/types/textmode/font/CharacterExtractor.d.ts +14 -14
- package/dist/types/textmode/font/MetricsCalculator.d.ts +1 -21
- package/dist/types/textmode/font/typr/Typr.d.ts +2 -0
- package/dist/types/textmode/font/typr/types.d.ts +6 -0
- package/dist/types/textmode/font/utils/index.d.ts +0 -1
- package/dist/types/textmode/mixins/AnimationMixin.d.ts +8 -0
- package/dist/types/textmode/mixins/FontMixin.d.ts +43 -3
- package/dist/types/textmode/mixins/KeyboardMixin.d.ts +2 -3
- package/dist/types/textmode/mixins/MouseMixin.d.ts +6 -6
- package/dist/types/textmode/mixins/RenderingMixin.d.ts +23 -5
- package/package.json +1 -1
- package/dist/types/rendering/webgl/types/ShaderTypes.d.ts +0 -35
- package/dist/types/textmode/font/utils/CmapParser.d.ts +0 -47
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Mixin } from './TextmodifierMixin';
|
|
2
|
-
import type { MousePosition
|
|
2
|
+
import type { MousePosition } from '../managers';
|
|
3
3
|
/**
|
|
4
4
|
* Capabilities provided by the MouseMixin
|
|
5
5
|
*/
|
|
@@ -19,7 +19,7 @@ export interface MouseCapabilities {
|
|
|
19
19
|
* });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
mouseClicked(callback:
|
|
22
|
+
mouseClicked(callback: () => void): void;
|
|
23
23
|
/**
|
|
24
24
|
* Set a callback function that will be called when the mouse is pressed down.
|
|
25
25
|
*
|
|
@@ -34,7 +34,7 @@ export interface MouseCapabilities {
|
|
|
34
34
|
* });
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
mousePressed(callback:
|
|
37
|
+
mousePressed(callback: () => void): void;
|
|
38
38
|
/**
|
|
39
39
|
* Set a callback function that will be called when the mouse is released.
|
|
40
40
|
*
|
|
@@ -49,7 +49,7 @@ export interface MouseCapabilities {
|
|
|
49
49
|
* });
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
mouseReleased(callback:
|
|
52
|
+
mouseReleased(callback: () => void): void;
|
|
53
53
|
/**
|
|
54
54
|
* Set a callback function that will be called when the mouse moves.
|
|
55
55
|
*
|
|
@@ -67,7 +67,7 @@ export interface MouseCapabilities {
|
|
|
67
67
|
* });
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
|
-
mouseMoved(callback:
|
|
70
|
+
mouseMoved(callback: () => void): void;
|
|
71
71
|
/**
|
|
72
72
|
* Set a callback function that will be called when the mouse wheel is scrolled.
|
|
73
73
|
*
|
|
@@ -83,7 +83,7 @@ export interface MouseCapabilities {
|
|
|
83
83
|
* });
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
mouseScrolled(callback:
|
|
86
|
+
mouseScrolled(callback: () => void): void;
|
|
87
87
|
/**
|
|
88
88
|
* Get the current mouse position in grid coordinates.
|
|
89
89
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Mixin } from './TextmodifierMixin';
|
|
2
2
|
import type { GLShader } from '../../rendering/webgl/Shader';
|
|
3
3
|
import type { GLFramebuffer } from '../../rendering';
|
|
4
|
+
import { TextmodeImage } from '../TextmodeImage';
|
|
4
5
|
/**
|
|
5
6
|
* Options for creating a framebuffer.
|
|
6
7
|
*/
|
|
@@ -128,7 +129,12 @@ export interface RenderingCapabilities {
|
|
|
128
129
|
* });
|
|
129
130
|
* ```
|
|
130
131
|
*/
|
|
131
|
-
image(
|
|
132
|
+
image(source: GLFramebuffer | TextmodeImage, x: number, y: number, width?: number, height?: number): void;
|
|
133
|
+
/**
|
|
134
|
+
* Load an image and return a TextmodeImage that can be drawn with image().
|
|
135
|
+
* @param src URL or existing HTMLImageElement
|
|
136
|
+
*/
|
|
137
|
+
loadImage(src: string | HTMLImageElement): Promise<TextmodeImage>;
|
|
132
138
|
/**
|
|
133
139
|
* Set a uniform value for the current custom shader.
|
|
134
140
|
* @param name The name of the uniform variable
|
|
@@ -240,7 +246,10 @@ export interface RenderingCapabilities {
|
|
|
240
246
|
*/
|
|
241
247
|
createFilterShader(fragmentSource: string): GLShader;
|
|
242
248
|
/**
|
|
243
|
-
* Sets the rotation angles for subsequent shape rendering operations
|
|
249
|
+
* Sets the rotation angles for subsequent shape rendering operations.
|
|
250
|
+
*
|
|
251
|
+
* All geometries rotate around the center of the shape.
|
|
252
|
+
*
|
|
244
253
|
* @param degreesX The rotation angle in degrees around the X-axis (optional, defaults to 0)
|
|
245
254
|
* @param degreesY The rotation angle in degrees around the Y-axis (optional, defaults to 0)
|
|
246
255
|
* @param degreesZ The rotation angle in degrees around the Z-axis (optional, defaults to 0)
|
|
@@ -267,7 +276,10 @@ export interface RenderingCapabilities {
|
|
|
267
276
|
*/
|
|
268
277
|
rotate(degreesX?: number, degreesY?: number, degreesZ?: number): void;
|
|
269
278
|
/**
|
|
270
|
-
* Sets the X-axis rotation angle for subsequent shape rendering operations
|
|
279
|
+
* Sets the X-axis rotation angle for subsequent shape rendering operations.
|
|
280
|
+
*
|
|
281
|
+
* All geometries rotate around the center of the shape.
|
|
282
|
+
*
|
|
271
283
|
* @param degrees The rotation angle in degrees around the X-axis
|
|
272
284
|
*
|
|
273
285
|
* @example
|
|
@@ -286,7 +298,10 @@ export interface RenderingCapabilities {
|
|
|
286
298
|
*/
|
|
287
299
|
rotateX(degrees: number): void;
|
|
288
300
|
/**
|
|
289
|
-
* Sets the Y-axis rotation angle for subsequent shape rendering operations
|
|
301
|
+
* Sets the Y-axis rotation angle for subsequent shape rendering operations.
|
|
302
|
+
*
|
|
303
|
+
* All geometries rotate around the center of the shape.
|
|
304
|
+
*
|
|
290
305
|
* @param degrees The rotation angle in degrees around the Y-axis
|
|
291
306
|
*
|
|
292
307
|
* @example
|
|
@@ -305,7 +320,10 @@ export interface RenderingCapabilities {
|
|
|
305
320
|
*/
|
|
306
321
|
rotateY(degrees: number): void;
|
|
307
322
|
/**
|
|
308
|
-
* Sets the Z-axis rotation angle for subsequent shape rendering operations
|
|
323
|
+
* Sets the Z-axis rotation angle for subsequent shape rendering operations.
|
|
324
|
+
*
|
|
325
|
+
* All geometries rotate around the center of the shape.
|
|
326
|
+
*
|
|
309
327
|
* @param degrees The rotation angle in degrees around the Z-axis
|
|
310
328
|
*
|
|
311
329
|
* @example
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interface for shader data with minification support
|
|
3
|
-
*/
|
|
4
|
-
export interface ShaderData {
|
|
5
|
-
/** The shader source code (minified in production, original in development) */
|
|
6
|
-
sourceCode: string;
|
|
7
|
-
/** Original unminified source code (available in development builds) */
|
|
8
|
-
originalCode?: string;
|
|
9
|
-
/** Mapping of original uniform names to minified names and types */
|
|
10
|
-
uniforms: Record<string, {
|
|
11
|
-
/** Minified uniform name used in the shader */
|
|
12
|
-
variableName: string;
|
|
13
|
-
/** GLSL type of the uniform (vec2, sampler2D, etc.) */
|
|
14
|
-
variableType: string;
|
|
15
|
-
}>;
|
|
16
|
-
/** Mapping of const variables (if any) */
|
|
17
|
-
consts: Record<string, {
|
|
18
|
-
/** Substitution value for the const */
|
|
19
|
-
variableName: string;
|
|
20
|
-
/** GLSL type of the const */
|
|
21
|
-
variableType: string;
|
|
22
|
-
}>;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Union type for shader imports - either ShaderData or plain string (for backward compatibility)
|
|
26
|
-
*/
|
|
27
|
-
export type ShaderSource = ShaderData | string;
|
|
28
|
-
/**
|
|
29
|
-
* Helper to normalize shader source to ShaderData format
|
|
30
|
-
*/
|
|
31
|
-
export declare function normalizeShaderData(source: ShaderSource): ShaderData;
|
|
32
|
-
/**
|
|
33
|
-
* Extract just the source code from ShaderSource
|
|
34
|
-
*/
|
|
35
|
-
export declare function getShaderCode(source: ShaderSource): string;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { TyprFont } from '../typr/types.ts';
|
|
2
|
-
import { FontTableReader } from './FontTableReader.ts';
|
|
3
|
-
/**
|
|
4
|
-
* Specialized utility for character mapping operations.
|
|
5
|
-
* Provides high-level character extraction and validation functions.
|
|
6
|
-
*/
|
|
7
|
-
export declare class CmapParser {
|
|
8
|
-
private _tableReader;
|
|
9
|
-
constructor(tableReader: FontTableReader);
|
|
10
|
-
/**
|
|
11
|
-
* Extracts all available characters from a font's cmap tables.
|
|
12
|
-
* Returns an array of unique character strings.
|
|
13
|
-
*/
|
|
14
|
-
$extractAllCharacters(font: TyprFont): string[];
|
|
15
|
-
/**
|
|
16
|
-
* Validates whether a character exists in the font.
|
|
17
|
-
*/
|
|
18
|
-
$characterExists(font: TyprFont, character: string): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Validates whether all characters in a string exist in the font.
|
|
21
|
-
*/
|
|
22
|
-
$allCharactersExist(font: TyprFont, text: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Filters out characters that don't exist in the font.
|
|
25
|
-
*/
|
|
26
|
-
$filterExistingCharacters(font: TyprFont, characters: string[]): string[];
|
|
27
|
-
/**
|
|
28
|
-
* Filters out problematic characters that might cause rendering issues.
|
|
29
|
-
*/
|
|
30
|
-
$filterProblematicCharacters(characters: string[]): string[];
|
|
31
|
-
/**
|
|
32
|
-
* Extracts characters from a Format 4 cmap table (Basic Multilingual Plane).
|
|
33
|
-
*/
|
|
34
|
-
private _extractCharactersFromFormat4;
|
|
35
|
-
/**
|
|
36
|
-
* Extracts characters from a Format 12 cmap table (Extended Unicode ranges).
|
|
37
|
-
*/
|
|
38
|
-
private _extractCharactersFromFormat12;
|
|
39
|
-
/**
|
|
40
|
-
* Calculates the glyph index for a character in a Format 4 cmap table.
|
|
41
|
-
*/
|
|
42
|
-
private _calculateGlyphIndexFormat4;
|
|
43
|
-
/**
|
|
44
|
-
* Checks if a character is valid for rendering.
|
|
45
|
-
*/
|
|
46
|
-
private _isValidCharacter;
|
|
47
|
-
}
|