textmode.js 0.8.0 → 0.8.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.
@@ -24,6 +24,18 @@ export declare class Textmode {
24
24
  * t.rect(10, 10);
25
25
  * });
26
26
  * ```
27
+ * @exampleAuthor
28
+ * <div style="display:flex;align-items:center;gap:0.75rem;flex-wrap:wrap;">
29
+ * <img src="https://github.com/humanbydefinition.png" alt="@humanbydefinition avatar" width="72" height="72" style="border-radius:12px;box-shadow:0 2px 6px rgba(0,0,0,0.35);" />
30
+ * <div style="display:flex;flex-direction:column;gap:0.25rem;">
31
+ * <strong><a href="https://github.com/humanbydefinition">@humanbydefinition</a></strong>
32
+ * <span style="font-size:0.95em;">
33
+ * 📷 <a href="https://instagram.com/humanbydefinition">Instagram</a>
34
+ * &nbsp;•&nbsp; 🐘 <a href="https://mastodon.social/@humanbydefinition">Mastodon</a>
35
+ * &nbsp;•&nbsp; 🦋 <a href="https://bsky.app/profile/humanbydefinition.bsky.social">BlueSky</a>
36
+ * </span>
37
+ * </div>
38
+ * </div>
27
39
  */
28
40
  static create(opts?: TextmodeOptions): Textmodifier;
29
41
  /**
@@ -32,7 +44,7 @@ export declare class Textmode {
32
44
  * @param level The error handling level to set.
33
45
  *
34
46
  * @example
35
- * ```javascript
47
+ * ```js
36
48
  * // Set error level to WARNING
37
49
  * textmode.setErrorLevel(TextmodeErrorLevel.WARNING);
38
50
  * ```
@@ -42,7 +54,7 @@ export declare class Textmode {
42
54
  * Returns the version of `textmode.js` being used.
43
55
  *
44
56
  * @example
45
- * ```javascript
57
+ * ```js
46
58
  * console.log(textmode.version); // "1.0.0"
47
59
  * ```
48
60
  */
@@ -9,7 +9,7 @@
9
9
  * and most `textmode.js` functions will still throw errors if used incorrectly.
10
10
  *
11
11
  * @example
12
- * ```javascript
12
+ * ```js
13
13
  * // Set to `WARNING` level to log errors without stopping execution
14
14
  * textmode.setErrorLevel(TextmodeErrorLevel.WARNING);
15
15
  * ```
@@ -9,7 +9,7 @@ export type { TextmodeFramebufferOptions } from './rendering/webgl';
9
9
  /**
10
10
  * All media conversion related modules and types.
11
11
  *
12
- * Responsible for converting images and videos into textmode-renderable formats,
12
+ * Responsible for converting images and videos into textmode-renderable formats
13
13
  * using various conversion strategies, like brightness- or edge-detection-based conversion.
14
14
  *
15
15
  * `textmode.js` only comes with a built-in `'brightness'`-based conversion strategy,
@@ -17,7 +17,15 @@ export type { TextmodeFramebufferOptions } from './rendering/webgl';
17
17
  */
18
18
  export * as conversion from './textmode/conversion';
19
19
  export type { TextmodePlugin, TextmodePluginAPI } from './textmode/managers/PluginManager';
20
- /** All filter related modules and types. */
20
+ /**
21
+ * All filter related modules and types.
22
+ *
23
+ * Provides various image processing filters that can be applied in sequence on a layer's textmode-converted output,
24
+ * such as blur, sharpen, edge detection, and color adjustments. Filters can also be applied globally to all layers as post-processing effects.
25
+ *
26
+ * While `textmode.js` only offers a basic set of filters, additional filters can be implemented and registered via the {@link TextmodeFilterManager},
27
+ * which is accessible through {@link Textmodifier.filters}.
28
+ */
21
29
  export * as filters from './textmode/filters';
22
30
  export { TextmodeErrorLevel } from './errors/ErrorHandler';
23
31
  export { Textmode as textmode } from './Textmode';
@@ -17,7 +17,7 @@
17
17
  * @returns 32-bit integer hash
18
18
  *
19
19
  * @example
20
- * ```typescript
20
+ * ```ts
21
21
  * hashString("hello") // → 99162322
22
22
  * hashString("world") // → 113318802
23
23
  * ```
@@ -31,7 +31,7 @@ export declare function hashString(str: string): number;
31
31
  * @returns Integer hash
32
32
  *
33
33
  * @example
34
- * ```typescript
34
+ * ```ts
35
35
  * hashNumber(42) // → 42
36
36
  * hashNumber(3.14) // → 3
37
37
  * hashNumber(true) // → 1
@@ -47,7 +47,7 @@ export declare function hashNumber(value: number | boolean): number;
47
47
  * @returns Combined hash of all elements
48
48
  *
49
49
  * @example
50
- * ```typescript
50
+ * ```ts
51
51
  * hashArray([1, 2, 3]) // → computed hash
52
52
  * hashArray([[1, 2], [3, 4]]) // → computed hash (flattened)
53
53
  * ```
@@ -61,7 +61,7 @@ export declare function hashArray(arr: number[] | number[][]): number;
61
61
  * @returns Combined hash
62
62
  *
63
63
  * @example
64
- * ```typescript
64
+ * ```ts
65
65
  * const arr = new Float32Array([1.0, 2.0, 3.0]);
66
66
  * hashTypedArray(arr) // → computed hash
67
67
  * ```
@@ -77,7 +77,7 @@ export declare function hashObject(obj: any): number;
77
77
  * @returns Combined hash
78
78
  *
79
79
  * @example
80
- * ```typescript
80
+ * ```ts
81
81
  * const h1 = hashString("hello");
82
82
  * const h2 = hashString("world");
83
83
  * const combined = combineHashes(h1, h2);
@@ -93,7 +93,7 @@ export declare function combineHashes(hash1: number, hash2: number): number;
93
93
  * @returns Combined hash of all key-value pairs
94
94
  *
95
95
  * @example
96
- * ```typescript
96
+ * ```ts
97
97
  * const obj = { b: 2, a: 1, c: 3 };
98
98
  * const hash = hashRecord(obj, hashNumber);
99
99
  * // Keys are sorted: a, b, c → consistent hash
@@ -9,7 +9,7 @@ import type { TextmodeConversionMode, TextmodeConversionStrategy } from './Conve
9
9
  * Used for image-to-ASCII conversion modes.
10
10
  *
11
11
  * @example
12
- * ```typescript
12
+ * ```ts
13
13
  * // Register a custom conversion strategy
14
14
  * t.conversions.register({
15
15
  * id: 'custom',
@@ -35,7 +35,7 @@ export declare class TextmodeConversionManager {
35
35
  * @param strategy The conversion strategy to register
36
36
  *
37
37
  * @example
38
- * ```typescript
38
+ * ```ts
39
39
  * t.conversions.register({
40
40
  * id: 'custom',
41
41
  * createShader: (ctx) => shader,
@@ -9,7 +9,7 @@ export type BuiltInConversionMode = 'brightness';
9
9
  /**
10
10
  * Type representing the available textmode conversion modes
11
11
  */
12
- export type TextmodeConversionMode = BuiltInConversionMode | (string & {});
12
+ export type TextmodeConversionMode = BuiltInConversionMode | string;
13
13
  /**
14
14
  * Interface for the context provided to conversion strategies
15
15
  * @ignore
@@ -38,7 +38,7 @@ export interface TextmodeConversionStrategy {
38
38
  * conversion strategies to be scoped to a specific Textmodifier instance rather than registered globally.
39
39
  *
40
40
  * @example
41
- * ```typescript
41
+ * ```ts
42
42
  * // Register a custom conversion strategy
43
43
  * t.conversions.register(myCustomStrategy);
44
44
  *
@@ -3,15 +3,10 @@ import type { QueuedFilter, FilterName } from './types';
3
3
  /**
4
4
  * Manages filter registration, shader compilation, and filter chain application.
5
5
  *
6
- * This class provides:
7
- * - A registry for custom and built-in filter strategies
8
- * - Lazy shader compilation and caching
9
- * - Ping-pong rendering for efficient multi-filter chains
10
- *
11
6
  * Used both for layer-level filters and global post-processing filters.
12
7
  *
13
8
  * @example
14
- * ```typescript
9
+ * ```ts
15
10
  * // Register a custom filter
16
11
  * await t.filters.register('brightness', brightnessShader, {
17
12
  * u_amount: ['amount', 1.0]
@@ -45,7 +40,7 @@ export declare class TextmodeFilterManager {
45
40
  * @param uniformDefs Maps uniform names to [paramName, defaultValue] tuples
46
41
  *
47
42
  * @example
48
- * ```typescript
43
+ * ```ts
49
44
  * // Register with inline shader source
50
45
  * await t.filters.register('blur', blurFragSource, {
51
46
  * u_radius: ['radius', 5.0],
@@ -7,7 +7,7 @@ import type { TextmodeFilterStrategy, FilterName } from './types';
7
7
  * filters to be scoped to a specific context rather than registered globally.
8
8
  *
9
9
  * @example
10
- * ```typescript
10
+ * ```ts
11
11
  * // Define a simple filter with the declarative API
12
12
  * t.filters.register('blur', blurShader, { radius: 5.0 });
13
13
  *
@@ -37,7 +37,7 @@ export declare class FilterRegistry {
37
37
  * @param uniforms Default uniform values. Keys map uniform names to [paramName, defaultValue] tuples.
38
38
  *
39
39
  * @example
40
- * ```typescript
40
+ * ```ts
41
41
  * // With pre-compiled shader (recommended for add-ons)
42
42
  * const shader = await t.createShader(vertSrc, fragSrc);
43
43
  * t.filters.register('brightness', shader, { u_amount: ['amount', 1.0] });
@@ -189,7 +189,7 @@ export interface ITextmodifier extends IRenderingMixin, IAnimationMixin, IMouseM
189
189
  *
190
190
  * Calling this method is equivalent to setting the draw callback on the base layer,
191
191
  * while the direct layer callback has precedence if both are set.
192
- * ```javascript
192
+ * ```js
193
193
  * textmodifier.layers.base.draw(callback);
194
194
  * ```
195
195
  *
@@ -282,7 +282,7 @@ export interface ITextmodifier extends IRenderingMixin, IAnimationMixin, IMouseM
282
282
  * After calling this method, the instance should not be used and will be eligible for garbage collection.
283
283
  *
284
284
  * @example
285
- * ```javascript
285
+ * ```js
286
286
  * // Create a textmodifier instance
287
287
  * const textmodifier = textmode.create();
288
288
  *
@@ -306,7 +306,7 @@ export interface ITextmodifier extends IRenderingMixin, IAnimationMixin, IMouseM
306
306
  * @param params Optional parameters for the filter
307
307
  *
308
308
  * @example
309
- * ```typescript
309
+ * ```ts
310
310
  * t.draw(() => {
311
311
  * t.background(0);
312
312
  * t.charColor(255);
@@ -350,7 +350,7 @@ export interface ITextmodifier extends IRenderingMixin, IAnimationMixin, IMouseM
350
350
  * (via {@link filter}) and on individual layers (via {@link TextmodeLayer.filter}).
351
351
  *
352
352
  * @example
353
- * ```typescript
353
+ * ```ts
354
354
  * // Register a custom filter once
355
355
  * await t.filters.register('vignette', vignetteShader, {
356
356
  * u_intensity: ['intensity', 0.5]
@@ -389,7 +389,7 @@ export interface ITextmodifier extends IRenderingMixin, IAnimationMixin, IMouseM
389
389
  * allowing further configuration of the conversion parameters.
390
390
  *
391
391
  * @example
392
- * ```javascript
392
+ * ```js
393
393
  * // Create the textmode instance using the p5 canvas as input overlay
394
394
  * const t = textmode.create({ fontSize: 16, canvas: p.canvas, overlay: true });
395
395
  *
@@ -6,8 +6,8 @@ import type { ILayerManager } from './interfaces/ILayerManager';
6
6
  import type { TextmodeOptions } from '../types';
7
7
  import type { TextmodeGrid } from '../Grid';
8
8
  /**
9
- * Manages all user-defined layers within a Textmodifier in *
10
- * Th *
9
+ * Manages all user-defined layers within a Textmodifier in addition to the base layer.
10
+ *
11
11
  * This manager is responsible for:
12
12
  * - Managing the collection of user layers (add, remove, move, swap)
13
13
  * - Coordinating layer rendering and compositing
@@ -10,7 +10,7 @@ import type { ITextmodeLayer } from './interfaces/ITextmodeLayer';
10
10
  *
11
11
  * Layers are composited together using various blend modes
12
12
  * to create complex visual effects. Each layer can be independently
13
- * manipulated in terms of visibility, opacity, blend mode, and position.
13
+ * manipulated in terms of visibility, {@link opacity}, {@link blendMode}, {@link offset}, rotation, {@link TextmodeGrid}, and {@link TextmodeFont}.
14
14
  *
15
15
  * You can draw on each layer by providing a draw callback function,
16
16
  * like you would with the base layer's {@link Textmodifier.draw} method.
@@ -88,7 +88,7 @@ export declare class TextmodeLayer implements ITextmodeLayer {
88
88
  * @returns The loaded TextmodeFont instance.
89
89
  *
90
90
  * @example
91
- * ```javascript
91
+ * ```js
92
92
  * const layer = t.layers.add();
93
93
  *
94
94
  * t.setup(async () => {
@@ -51,7 +51,7 @@ export interface ITextmodeLayer {
51
51
  * @param callback The function to call when drawing this layer.
52
52
  *
53
53
  * @example
54
- * ```typescript
54
+ * ```javascript
55
55
  * const t = textmode.create();
56
56
  *
57
57
  * // Create layers with different blend modes
@@ -130,7 +130,7 @@ export interface ITextmodeLayer {
130
130
  * @returns The loaded TextmodeFont instance.
131
131
  *
132
132
  * @example
133
- * ```javascript
133
+ * ```js
134
134
  * const layer = t.layers.add();
135
135
  *
136
136
  * t.setup(async () => {
@@ -176,7 +176,7 @@ export interface ITextmodeLayer {
176
176
  * - `'exclusion'` - Softer difference effect
177
177
  *
178
178
  * @example
179
- * ```typescript
179
+ * ```javascript
180
180
  * const t = textmode.create();
181
181
  *
182
182
  * // Create 5 layers with different blend modes
@@ -219,7 +219,7 @@ export interface ITextmodeLayer {
219
219
  * @returns The current offset if no parameters are provided.
220
220
  *
221
221
  * @example
222
- * ```typescript
222
+ * ```javascript
223
223
  * const t = textmode.create();
224
224
  *
225
225
  * const LAYER_COUNT = 32;
@@ -301,9 +301,7 @@ export interface ITextmodeLayer {
301
301
  * @returns The current rotation in degrees if no parameter is provided.
302
302
  *
303
303
  * @example
304
- * ```typescript
305
- * import { textmode } from 'textmode.js';
306
- *
304
+ * ```javascript
307
305
  * const t = textmode.create();
308
306
  *
309
307
  * const rotatingLayer = t.layers.add({ blendMode: 'difference', opacity: 1.0 });
@@ -344,7 +342,7 @@ export interface ITextmodeLayer {
344
342
  * @param params Optional parameters for the filter
345
343
  *
346
344
  * @example
347
- * ```typescript
345
+ * ```javascript
348
346
  * const t = textmode.create();
349
347
  *
350
348
  * // Create a layer with filters applied
@@ -3,13 +3,13 @@ import type { GLFramebuffer } from '../../../rendering/webgl/core/Framebuffer.ts
3
3
  import type { TextmodeCharacter } from './types.ts';
4
4
  import type { TyprFont } from './typr/types.ts';
5
5
  /**
6
- * Manages the font used for rendering characters via {@link Textmodifier.loadFont}.
6
+ * Manages the font used for rendering characters via {@link TextmodeLayer.loadFont}.
7
7
  *
8
8
  * This class coordinates font loading, character extraction, texture atlas creation,
9
9
  * and provides character information.
10
10
  *
11
- * The font used by your {@link Textmodifier} instance is accessible via
12
- * the {@link Textmodifier.font} property.
11
+ * Each {@link TextmodeLayer} has its own instance of this class to allow for
12
+ * layer-specific font configurations.
13
13
  */
14
14
  export declare class TextmodeFont {
15
15
  private _font;
@@ -11,16 +11,18 @@ export declare class LoadingPhase implements ILoadingPhase {
11
11
  private readonly _phaseTracker;
12
12
  readonly id: string;
13
13
  readonly label: string;
14
+ private readonly _onError?;
14
15
  /**
15
16
  * Creates a new LoadingPhase.
16
17
  * @param _phaseTracker The LoadingPhaseTracker managing this phase
17
18
  * @param id The unique identifier for this loading phase
18
19
  * @param label The human-readable label for this loading phase
20
+ * @param _onError Callback to invoke when the phase fails
19
21
  * @ignore
20
22
  */
21
- constructor(_phaseTracker: LoadingPhaseTracker, id: string, label: string);
23
+ constructor(_phaseTracker: LoadingPhaseTracker, id: string, label: string, _onError?: ((error: Error | string) => void) | undefined);
22
24
  report(progress: number): void;
23
25
  complete(): void;
24
- fail(_error?: Error): void;
26
+ fail(error?: Error | string): void;
25
27
  track<T>(task: Promise<T> | (() => Promise<T> | T)): Promise<T>;
26
28
  }
@@ -75,7 +75,7 @@ export declare class LoadingScreenManager {
75
75
  *
76
76
  * // In setup we can start a phase and read the overall progress
77
77
  * t.setup(async () => {
78
- * const phase = t.loading.beginPhase('assets', 1);
78
+ * const phase = t.loading.addPhase('assets', 1);
79
79
  * phase.report(0.5); // half complete for the phase
80
80
  *
81
81
  * // The `progress` accessor reports the global progress across all phases
@@ -101,7 +101,7 @@ export declare class LoadingScreenManager {
101
101
  * // Update the message visible on the loading screen
102
102
  * t.loading.message('preloading video...');
103
103
  *
104
- * // Read the current message (useful in custom renderers)
104
+ * // Read the current message (useful in custom loading screen implementations)
105
105
  * const msg = t.loading.message();
106
106
  * console.log(msg);
107
107
  * });
@@ -128,7 +128,7 @@ export declare class LoadingScreenManager {
128
128
  *
129
129
  * // In setup we start a phase and then track work in that phase
130
130
  * t.setup(async () => {
131
- * const phase = t.loading.beginPhase('video preload', 2);
131
+ * const phase = t.loading.addPhase('video preload', 2);
132
132
  *
133
133
  * // Example: report progress from a loader callback
134
134
  * await phase.track(async () => {
@@ -168,7 +168,7 @@ export declare class LoadingScreenManager {
168
168
  * });
169
169
  *
170
170
  * t.setup(async () => {
171
- * const phase = t.loading.beginPhase('remote fetch', 1);
171
+ * const phase = t.loading.addPhase('remote fetch', 1);
172
172
  * try {
173
173
  * await phase.track(async () => {
174
174
  * // Failing call
@@ -164,7 +164,7 @@ export interface ILoadingPhase {
164
164
  *
165
165
  * // Create a phase and report progress as work proceeds
166
166
  * t.setup(async () => {
167
- * const phase = t.loading.beginPhase('assets', 1);
167
+ * const phase = t.loading.addPhase('assets', 1);
168
168
  * phase.report(0.25);
169
169
  * // ...load assets...
170
170
  * phase.report(0.75);
@@ -181,7 +181,7 @@ export interface ILoadingPhase {
181
181
  * const t = textmode.create({ width: 800, height: 600, loadingScreen: { message: 'prepping...' } });
182
182
  *
183
183
  * t.setup(() => {
184
- * const phase = t.loading.beginPhase('init', 1);
184
+ * const phase = t.loading.addPhase('init', 1);
185
185
  * // Finish phase when work is done
186
186
  * phase.complete();
187
187
  * });
@@ -190,14 +190,18 @@ export interface ILoadingPhase {
190
190
  complete(): void;
191
191
  /**
192
192
  * Mark the loading phase as failed.
193
- * @param error An optional error object describing the failure.
193
+ *
194
+ * This will put the loading manager into an error state, displaying the
195
+ * error on the loading screen.
196
+ *
197
+ * @param error An optional error object or message describing the failure.
194
198
  *
195
199
  * @example
196
200
  * ```ts
197
201
  * const t = textmode.create({ width: 800, height: 600 });
198
202
  *
199
203
  * t.setup(async () => {
200
- * const phase = t.loading.beginPhase('fetch', 1);
204
+ * const phase = t.loading.addPhase('fetch', 1);
201
205
  * try {
202
206
  * // simulate failure
203
207
  * throw new Error('network error');
@@ -207,7 +211,7 @@ export interface ILoadingPhase {
207
211
  * });
208
212
  * ```
209
213
  */
210
- fail(error?: Error): void;
214
+ fail(error?: Error | string): void;
211
215
  /**
212
216
  * Track a task within this loading phase.
213
217
  * @param task A promise or function representing the task to track.
@@ -218,7 +222,7 @@ export interface ILoadingPhase {
218
222
  * const t = textmode.create({ width: 800, height: 600, loadingScreen: { message: 'loading...' } });
219
223
  *
220
224
  * t.setup(async () => {
221
- * const phase = t.loading.beginPhase('video', 2);
225
+ * const phase = t.loading.addPhase('video', 2);
222
226
  * await phase.track(async () => {
223
227
  * // do async work and report updates
224
228
  * for (let i = 0; i <= 10; i++) {
@@ -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
@@ -86,8 +86,6 @@ export interface IRenderingMixin {
86
86
  * Draw a TextmodeFramebuffer, TextmodeImage, or TextmodeVideo to the current render target.
87
87
  *
88
88
  * @param source The TextmodeFramebuffer or TextmodeSource to render
89
- * @param x X position on the grid where to place the content *(top-left corner)*
90
- * @param y Y position on the grid where to place the content *(top-left corner)*
91
89
  * @param width Width to potentially scale the content
92
90
  * @param height Height to potentially scale the content
93
91
  *
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "textmode.js",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "textmode.js is a lightweight creative coding library for creating real-time ASCII art on the web.",
5
5
  "type": "module",
6
6
  "types": "./dist/types/index.d.ts",