textmode.js 0.8.0-beta.3 → 0.8.1-beta.1

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.
Files changed (28) hide show
  1. package/README.md +179 -179
  2. package/dist/textmode.esm.js +457 -450
  3. package/dist/textmode.umd.js +15 -15
  4. package/dist/types/Textmode.d.ts +14 -2
  5. package/dist/types/errors/ErrorHandler.d.ts +1 -1
  6. package/dist/types/index.d.ts +10 -2
  7. package/dist/types/rendering/webgl/utils/hash.d.ts +6 -6
  8. package/dist/types/textmode/Textmodifier.d.ts +8 -0
  9. package/dist/types/textmode/conversion/ConversionManager.d.ts +2 -2
  10. package/dist/types/textmode/conversion/ConversionRegistry.d.ts +2 -2
  11. package/dist/types/textmode/filters/FilterManager.d.ts +2 -7
  12. package/dist/types/textmode/filters/FilterRegistry.d.ts +2 -2
  13. package/dist/types/textmode/interfaces/ITextmodifier.d.ts +57 -9
  14. package/dist/types/textmode/layers/LayerManager.d.ts +4 -3
  15. package/dist/types/textmode/layers/TextmodeLayer.d.ts +2 -2
  16. package/dist/types/textmode/layers/interfaces/ILayerManager.d.ts +1 -1
  17. package/dist/types/textmode/layers/interfaces/ITextmodeLayer.d.ts +7 -9
  18. package/dist/types/textmode/layers/types.d.ts +2 -2
  19. package/dist/types/textmode/loadables/TextmodeImage.d.ts +2 -4
  20. package/dist/types/textmode/loadables/font/TextmodeFont.d.ts +3 -3
  21. package/dist/types/textmode/loadables/video/TextmodeVideo.d.ts +2 -4
  22. package/dist/types/textmode/loading/LoadingPhase.d.ts +6 -4
  23. package/dist/types/textmode/loading/LoadingScreenManager.d.ts +4 -4
  24. package/dist/types/textmode/loading/types.d.ts +10 -6
  25. package/dist/types/textmode/mixins/interfaces/IAnimationMixin.d.ts +1 -1
  26. package/dist/types/textmode/mixins/interfaces/IRenderingMixin.d.ts +15 -15
  27. package/dist/types/textmode/mixins/interfaces/ITouchMixin.d.ts +11 -11
  28. package/package.json +72 -72
@@ -142,7 +142,7 @@ export interface IAnimationMixin {
142
142
  * @returns True if the render loop is currently active, false otherwise.
143
143
  *
144
144
  * @example
145
- * ```javascript
145
+ * ```js
146
146
  * const textmodifier = textmode.create(canvas);
147
147
  *
148
148
  * // Check loop status in different states
@@ -1,5 +1,4 @@
1
1
  import type { GLFramebuffer, GLShader, TextmodeFramebufferOptions, UniformValue } from '../../../rendering/webgl';
2
- import type { TextmodeSource } from '../../loadables/TextmodeSource';
3
2
  import type { TextmodeImage } from '../../loadables/TextmodeImage';
4
3
  import type { TextmodeColor } from '../../TextmodeColor';
5
4
  import type { TextmodeVideo } from '../../loadables';
@@ -84,11 +83,9 @@ export interface IRenderingMixin {
84
83
  */
85
84
  createFramebuffer(options: TextmodeFramebufferOptions): GLFramebuffer;
86
85
  /**
87
- * Draw a TextmodeFramebuffer or TextmodeSource (TextmodeImage/TextmodeVideo) to the current render target.
86
+ * Draw a TextmodeFramebuffer, TextmodeImage, or TextmodeVideo to the current render target.
88
87
  *
89
88
  * @param source The TextmodeFramebuffer or TextmodeSource to render
90
- * @param x X position on the grid where to place the content *(top-left corner)*
91
- * @param y Y position on the grid where to place the content *(top-left corner)*
92
89
  * @param width Width to potentially scale the content
93
90
  * @param height Height to potentially scale the content
94
91
  *
@@ -121,7 +118,7 @@ export interface IRenderingMixin {
121
118
  * });
122
119
  * ```
123
120
  */
124
- image(source: GLFramebuffer | TextmodeSource, width?: number, height?: number): void;
121
+ image(source: GLFramebuffer | TextmodeImage | TextmodeVideo, width?: number, height?: number): void;
125
122
  /**
126
123
  * Load an image and return a TextmodeImage that can be drawn with image().
127
124
  *
@@ -148,10 +145,8 @@ export interface IRenderingMixin {
148
145
  * t.draw(() => {
149
146
  * t.background(0);
150
147
  *
151
- * if (img) {
152
- * // Draw the loaded image
153
- * t.image(img);
154
- * }
148
+ * // Draw the loaded image
149
+ * t.image(img);
155
150
  * });
156
151
  * ```
157
152
  */
@@ -182,10 +177,8 @@ export interface IRenderingMixin {
182
177
  * t.draw(() => {
183
178
  * t.background(0);
184
179
  *
185
- * if (video) {
186
- * // Draw the loaded video
187
- * t.image(video);
188
- * }
180
+ * // Draw the loaded video
181
+ * t.image(video);
189
182
  * });
190
183
  * ```
191
184
  */
@@ -706,7 +699,10 @@ export interface IRenderingMixin {
706
699
  */
707
700
  line(x1: number, y1: number, x2: number, y2: number): void;
708
701
  /**
709
- * Set the background color for the canvas.
702
+ * Set the background color of the layer currently drawing to.
703
+ *
704
+ * Used to clear the layer to a specific color at the start of its drawing cycle.
705
+ *
710
706
  * @param value A {@link TextmodeColor}, hex string, grayscale value, or single RGB channel
711
707
  * @param g Optional green component when providing RGB channels or alpha when used with grayscale
712
708
  * @param b Optional blue component when providing RGB channels
@@ -739,7 +735,9 @@ export interface IRenderingMixin {
739
735
  */
740
736
  background(value: number | string | TextmodeColor, g?: number, b?: number, a?: number): void;
741
737
  /**
742
- * Clear the canvas.
738
+ * Clear the layer currently drawing to.
739
+ *
740
+ * Used to clear the layer at the start of its drawing cycle.
743
741
  *
744
742
  * @example
745
743
  * ```javascript
@@ -839,6 +837,8 @@ export interface IRenderingMixin {
839
837
  * Set the character to be used for subsequent rendering operations.
840
838
  * Accepts a single character string.
841
839
  *
840
+ * @param character The character to set for rendering
841
+ *
842
842
  * @example
843
843
  * ```javascript
844
844
  * const t = textmode.create({
@@ -13,7 +13,7 @@ export interface ITouchMixin {
13
13
  * @param callback The function to call when a touch starts.
14
14
  *
15
15
  * @example
16
- * ```javascript
16
+ * ```js
17
17
  * t.touchStarted((data) => {
18
18
  * console.log(`Touch ${data.touch.id} began at ${data.touch.x}, ${data.touch.y}`);
19
19
  * });
@@ -29,7 +29,7 @@ export interface ITouchMixin {
29
29
  * @param callback The function to call when a touch moves.
30
30
  *
31
31
  * @example
32
- * ```javascript
32
+ * ```js
33
33
  * t.touchMoved((data) => {
34
34
  * const { touch, previousTouch } = data;
35
35
  * if (previousTouch) {
@@ -48,7 +48,7 @@ export interface ITouchMixin {
48
48
  * @param callback The function to call when a touch ends.
49
49
  *
50
50
  * @example
51
- * ```javascript
51
+ * ```js
52
52
  * t.touchEnded((data) => {
53
53
  * console.log(`Touch ${data.touch.id} finished at ${data.touch.x}, ${data.touch.y}`);
54
54
  * });
@@ -64,7 +64,7 @@ export interface ITouchMixin {
64
64
  * @param callback The function to call when a touch is cancelled.
65
65
  *
66
66
  * @example
67
- * ```javascript
67
+ * ```js
68
68
  * t.touchCancelled((data) => {
69
69
  * console.warn(`Touch ${data.touch.id} cancelled by the browser`);
70
70
  * });
@@ -80,7 +80,7 @@ export interface ITouchMixin {
80
80
  * @param callback The function to call when a tap gesture is detected.
81
81
  *
82
82
  * @example
83
- * ```javascript
83
+ * ```js
84
84
  * t.tap((data) => {
85
85
  * console.log(`Tapped at ${data.touch.x}, ${data.touch.y}`);
86
86
  * });
@@ -96,7 +96,7 @@ export interface ITouchMixin {
96
96
  * @param callback The function to call when a double tap is detected.
97
97
  *
98
98
  * @example
99
- * ```javascript
99
+ * ```js
100
100
  * t.doubleTap((data) => {
101
101
  * console.log('Double tap detected', data.touch);
102
102
  * });
@@ -112,7 +112,7 @@ export interface ITouchMixin {
112
112
  * @param callback The function to call when a long press gesture is detected.
113
113
  *
114
114
  * @example
115
- * ```javascript
115
+ * ```js
116
116
  * t.longPress((data) => {
117
117
  * console.log(`Long press for ${Math.round(data.duration)}ms`);
118
118
  * });
@@ -128,7 +128,7 @@ export interface ITouchMixin {
128
128
  * @param callback The function to call when a swipe gesture is detected.
129
129
  *
130
130
  * @example
131
- * ```javascript
131
+ * ```js
132
132
  * t.swipe((data) => {
133
133
  * console.log(`Swipe ${data.direction} with distance ${data.distance}`);
134
134
  * });
@@ -144,7 +144,7 @@ export interface ITouchMixin {
144
144
  * @param callback The function to call when a pinch gesture is detected.
145
145
  *
146
146
  * @example
147
- * ```javascript
147
+ * ```js
148
148
  * t.pinch((data) => {
149
149
  * console.log(`Pinch scale: ${data.scale.toFixed(2)}`);
150
150
  * });
@@ -160,7 +160,7 @@ export interface ITouchMixin {
160
160
  * @param callback The function to call when a rotation gesture is detected.
161
161
  *
162
162
  * @example
163
- * ```javascript
163
+ * ```js
164
164
  * t.rotateGesture((data) => {
165
165
  * console.log(`Rotated ${data.deltaRotation.toFixed(1)}°`);
166
166
  * });
@@ -174,7 +174,7 @@ export interface ITouchMixin {
174
174
  * available. Use this inside a draw loop to react to active multi-touch scenarios.
175
175
  *
176
176
  * @example
177
- * ```javascript
177
+ * ```js
178
178
  * t.draw(() => {
179
179
  * for (const touch of t.touches) {
180
180
  * t.point();
package/package.json CHANGED
@@ -1,72 +1,72 @@
1
- {
2
- "name": "textmode.js",
3
- "version": "0.8.0-beta.3",
4
- "description": "textmode.js is a lightweight creative coding library for creating real-time ASCII art on the web.",
5
- "type": "module",
6
- "types": "./dist/types/index.d.ts",
7
- "main": "./dist/textmode.umd.js",
8
- "module": "./dist/textmode.esm.js",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/types/index.d.ts",
12
- "import": "./dist/textmode.esm.js",
13
- "require": "./dist/textmode.umd.js"
14
- }
15
- },
16
- "scripts": {
17
- "dev": "vite --port 5177 --host",
18
- "build": "vite build && tsc",
19
- "build:full": "vite build && tsc",
20
- "build:docs": "typedoc",
21
- "dev:docs": "typedoc --watch",
22
- "preview": "vite preview",
23
- "test": "vitest",
24
- "test:ui": "vitest --ui",
25
- "test:run": "vitest run",
26
- "test:coverage": "vitest --coverage",
27
- "format": "prettier --write \"src/**/*.{ts,js}\"",
28
- "format:check": "prettier --check \"src/**/*.{ts,js}\""
29
- },
30
- "devDependencies": {
31
- "@mapwhit/glsl-minify": "^1.0.0",
32
- "@rollup/plugin-terser": "^0.4.4",
33
- "@types/jsdom": "^21.1.7",
34
- "@types/node": "^24.0.13",
35
- "@vitest/ui": "^3.1.2",
36
- "jsdom": "^26.1.0",
37
- "prettier": "^3.7.4",
38
- "terser": "^5.43.1",
39
- "tslib": "^2.8.1",
40
- "typedoc": "^0.28.13",
41
- "typedoc-plugin-markdown": "^4.7.0",
42
- "typedoc-vitepress-theme": "^1.1.2",
43
- "typescript": "^5.9.2",
44
- "vite": "^6.3.4",
45
- "vite-plugin-glsl": "^1.5.1",
46
- "vitest": "^3.1.2"
47
- },
48
- "repository": {
49
- "type": "git",
50
- "url": "git+https://github.com/humanbydefinition/textmode.js.git"
51
- },
52
- "keywords": [
53
- "ascii",
54
- "petscii",
55
- "textmode",
56
- "canvas",
57
- "webgl",
58
- "creative-coding",
59
- "art",
60
- "design",
61
- "graphics"
62
- ],
63
- "author": "humanbydefinition",
64
- "license": "MIT",
65
- "bugs": {
66
- "url": "https://github.com/humanbydefinition/textmode.js/issues"
67
- },
68
- "homepage": "https://code.textmode.art",
69
- "files": [
70
- "dist"
71
- ]
72
- }
1
+ {
2
+ "name": "textmode.js",
3
+ "version": "0.8.1-beta.1",
4
+ "description": "textmode.js is a lightweight creative coding library for creating real-time ASCII art on the web.",
5
+ "type": "module",
6
+ "types": "./dist/types/index.d.ts",
7
+ "main": "./dist/textmode.umd.js",
8
+ "module": "./dist/textmode.esm.js",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/textmode.esm.js",
13
+ "require": "./dist/textmode.umd.js"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "dev": "vite --port 5177 --host",
18
+ "build": "vite build && tsc",
19
+ "build:full": "vite build && tsc",
20
+ "build:docs": "typedoc",
21
+ "dev:docs": "typedoc --watch",
22
+ "preview": "vite preview",
23
+ "test": "vitest",
24
+ "test:ui": "vitest --ui",
25
+ "test:run": "vitest run",
26
+ "test:coverage": "vitest --coverage",
27
+ "format": "prettier --write \"src/**/*.{ts,js}\"",
28
+ "format:check": "prettier --check \"src/**/*.{ts,js}\""
29
+ },
30
+ "devDependencies": {
31
+ "@mapwhit/glsl-minify": "^1.0.0",
32
+ "@rollup/plugin-terser": "^0.4.4",
33
+ "@types/jsdom": "^21.1.7",
34
+ "@types/node": "^24.0.13",
35
+ "@vitest/ui": "^3.1.2",
36
+ "jsdom": "^26.1.0",
37
+ "prettier": "^3.7.4",
38
+ "terser": "^5.43.1",
39
+ "tslib": "^2.8.1",
40
+ "typedoc": "^0.28.13",
41
+ "typedoc-plugin-markdown": "^4.7.0",
42
+ "typedoc-vitepress-theme": "^1.1.2",
43
+ "typescript": "^5.9.2",
44
+ "vite": "^6.3.4",
45
+ "vite-plugin-glsl": "^1.5.1",
46
+ "vitest": "^3.1.2"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/humanbydefinition/textmode.js.git"
51
+ },
52
+ "keywords": [
53
+ "ascii",
54
+ "petscii",
55
+ "textmode",
56
+ "canvas",
57
+ "webgl",
58
+ "creative-coding",
59
+ "art",
60
+ "design",
61
+ "graphics"
62
+ ],
63
+ "author": "humanbydefinition",
64
+ "license": "MIT",
65
+ "bugs": {
66
+ "url": "https://github.com/humanbydefinition/textmode.js/issues"
67
+ },
68
+ "homepage": "https://code.textmode.art",
69
+ "files": [
70
+ "dist"
71
+ ]
72
+ }