textmode.export.js 1.7.0 → 1.7.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.
@@ -1,10 +1,11 @@
1
- import type { Textmodifier, TextmodePluginContext } from 'textmode.js';
1
+ import type { Textmodifier } from 'textmode.js';
2
+ import { type PostDrawSubscription } from '../video/VideoFrameDriver';
2
3
  import type { GIFExportOptions } from './types';
3
4
  /** Deterministic, bounded-memory GIF exporter. */
4
5
  export declare class GIFExporter {
5
6
  private readonly _textmodifier;
6
7
  private readonly _registerPostDrawHook;
7
- constructor(_textmodifier: Textmodifier, _registerPostDrawHook: TextmodePluginContext['registerPostDrawHook']);
8
+ constructor(_textmodifier: Textmodifier, _registerPostDrawHook: PostDrawSubscription);
8
9
  $saveGIF(options?: GIFExportOptions): Promise<void>;
9
10
  /** Generates a GIF blob without initiating a download. */
10
11
  $generateGIFBlob(options?: GIFExportOptions): Promise<Blob>;
@@ -1,4 +1,4 @@
1
- import type { TextmodePluginContext } from 'textmode.js';
1
+ import type { PostDrawSubscription } from '../video/VideoFrameDriver';
2
2
  import type { GIFExportProgress, GIFFrame, GIFGenerationOptions } from './types';
3
3
  /**
4
4
  * Records frames from a canvas for GIF generation.
@@ -19,5 +19,5 @@ export declare class GIFRecorder {
19
19
  * @returns Promise resolving to array of captured frames
20
20
  * @throws {Error} If frame capture fails
21
21
  */
22
- $record(canvas: HTMLCanvasElement, options: GIFGenerationOptions, registerPostDrawHook: TextmodePluginContext['registerPostDrawHook'], onProgress?: (progress: GIFExportProgress) => void): Promise<GIFFrame[]>;
22
+ $record(canvas: HTMLCanvasElement, options: GIFGenerationOptions, registerPostDrawHook: PostDrawSubscription, onProgress?: (progress: GIFExportProgress) => void): Promise<GIFFrame[]>;
23
23
  }
@@ -1,5 +1,5 @@
1
1
  import type { Textmodifier } from 'textmode.js';
2
- import type { TextmodePluginContext } from 'textmode.js';
2
+ import { type PostDrawSubscription } from './VideoFrameDriver';
3
3
  import type { VideoExportOptions } from './types';
4
4
  /**
5
5
  * Main video exporter for the textmode.js library.
@@ -8,7 +8,7 @@ export declare class VideoExporter {
8
8
  private readonly _recorder;
9
9
  private readonly _textmodifier;
10
10
  private readonly _registerPostDrawHook;
11
- constructor(textmodifier: Textmodifier, registerPostDrawHook: TextmodePluginContext['registerPostDrawHook']);
11
+ constructor(textmodifier: Textmodifier, registerPostDrawHook: PostDrawSubscription);
12
12
  /**
13
13
  * Captures deterministic frames and saves them as a video file.
14
14
  *
@@ -1,5 +1,6 @@
1
- import type { Textmodifier, TextmodePluginContext } from 'textmode.js';
1
+ import type { Textmodifier } from 'textmode.js';
2
2
  import type { VideoRenderFrameOptions } from './types';
3
+ export type PostDrawSubscription = (callback: () => void) => () => void;
3
4
  /**
4
5
  * Drives deterministic video export frames through public textmode APIs.
5
6
  *
@@ -15,7 +16,7 @@ export declare class VideoFrameDriver {
15
16
  private _pendingFrame;
16
17
  private _syntheticFrameCount;
17
18
  private _syntheticMillis;
18
- constructor(textmodifier: Textmodifier, registerPostDrawHook: TextmodePluginContext['registerPostDrawHook'], width: number, height: number);
19
+ constructor(textmodifier: Textmodifier, registerPostDrawHook: PostDrawSubscription, width: number, height: number);
19
20
  $render(options: VideoRenderFrameOptions): Promise<void>;
20
21
  private _renderOneFrame;
21
22
  private _capturePendingFrame;
@@ -21,8 +21,9 @@ export type VideoCodec = 'vp8' | 'vp9' | 'avc' | (string & {});
21
21
  /**
22
22
  * Subjective bitrate preset used when an exact bits-per-second value is not supplied.
23
23
  *
24
- * Higher presets produce larger files with more detail. For exact control, pass a numeric
25
- * `bitrate` value in bits per second instead.
24
+ * Higher presets produce larger files with more detail. Each preset maps to a fixed bits-per-pixel budget
25
+ * (bits per pixel per second), so a given preset resolves to the same bitrate regardless of the export
26
+ * frame rate. For exact control, pass a numeric `bitrate` value in bits per second instead.
26
27
  *
27
28
  * @category Animation export
28
29
  *
@@ -161,11 +162,12 @@ export type VideoExportOptions = {
161
162
  */
162
163
  frameRate?: number;
163
164
  /**
164
- * Target bitrate in bits per second or a bitrate preset. Defaults to `'medium'`.
165
+ * Target bitrate in bits per second or a quality preset. Defaults to `'medium'`.
165
166
  *
166
167
  * Bitrate controls how much encoded data is available per second of video. Higher values can preserve more detail
167
- * in noisy or fast-changing sketches, but create larger files. Presets are resolved from the export dimensions and
168
- * frame rate; numeric values are passed directly to the encoder.
168
+ * in noisy or fast-changing sketches, but create larger files. Presets resolve to a fixed bits-per-pixel budget
169
+ * from the export dimensions only, so a given preset targets the same bitrate regardless of the frame rate.
170
+ * Numeric values are passed directly to the encoder.
169
171
  *
170
172
  * @see {@link https://code.textmode.art/api/textmode.export.js/type-aliases/VideoExportOptions#bitrate | VideoExportOptions.bitrate API reference}
171
173
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "textmode.export.js",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Export plugin for textmode.js - Save your creations as images, GIFs, videos, SVG, JSON, and plain text.",
5
5
  "type": "module",
6
6
  "devEngines": {
@@ -33,60 +33,46 @@
33
33
  "dist"
34
34
  ],
35
35
  "scripts": {
36
- "dev": "vite --port 5174 --host",
37
- "build:bundle": "vite build",
36
+ "dev": "textmode-build dev --port 5174 --host",
37
+ "build:bundle": "textmode-build build",
38
38
  "build:types": "textmode-types build",
39
39
  "build": "npm run build:bundle && npm run build:types",
40
- "check": "textmode-project check",
40
+ "check": "npm run format:check && npm run lint && npm run lint:markdown && npm run typecheck && npm run docs:check && npm run test && npm run build && npm run types:verify",
41
41
  "docs:links:add": "textmode-docs links add",
42
42
  "docs:api:check": "textmode-docs api-check",
43
43
  "docs:dev": "textmode-docs watch",
44
44
  "docs:build": "textmode-docs build",
45
45
  "docs:check": "textmode-docs check",
46
- "preview": "vite preview",
47
- "test": "vitest run",
48
- "test:watch": "vitest",
49
- "format": "prettier --write . --ignore-unknown",
50
- "format:check": "prettier --check . --ignore-unknown",
46
+ "preview": "textmode-build preview",
47
+ "test": "textmode-build test",
48
+ "test:watch": "textmode-build test:watch",
49
+ "format": "textmode-lint format",
50
+ "format:check": "textmode-lint format:check",
51
51
  "typecheck": "textmode-types check",
52
52
  "types:verify": "textmode-types verify",
53
- "lint:markdown": "markdownlint-cli2 --config package.json --configPointer /markdownlint-cli2",
54
- "lint:markdown:fix": "markdownlint-cli2 --config package.json --configPointer /markdownlint-cli2 --fix",
55
- "lint": "eslint src",
56
- "prepare": "install-git-hooks",
57
- "prepack": "textmode-project prepack",
58
- "release": "semantic-release"
53
+ "lint:markdown": "textmode-lint lint:markdown",
54
+ "lint:markdown:fix": "textmode-lint lint:markdown --fix",
55
+ "lint": "textmode-lint lint src",
56
+ "prepare": "textmode-release hooks",
57
+ "prepack": "npm run build && npm run types:verify",
58
+ "release": "textmode-release release"
59
59
  },
60
60
  "peerDependencies": {
61
- "textmode.js": ">=0.16.0"
61
+ "textmode.js": ">=0.17.2-beta.1 <0.20.0"
62
62
  },
63
63
  "dependencies": {
64
64
  "gifenc": "^1.0.1",
65
65
  "mediabunny": "^1.45.4"
66
66
  },
67
67
  "devDependencies": {
68
- "@commitlint/cli": "^21.2.1",
69
- "@textmode/commitlint-config": "^0.1.1",
68
+ "@textmode/build": "^0.1.0",
70
69
  "@textmode/docs": "^0.3.0",
71
- "@textmode/eslint-config": "^0.2.0",
72
- "@textmode/markdownlint-config": "^0.1.1",
73
- "@textmode/prettier-config": "^0.1.0",
74
- "@textmode/release-config": "^0.1.2",
75
- "@textmode/tooling-scripts": "^0.5.0",
70
+ "@textmode/lint": "^0.1.0",
71
+ "@textmode/release": "^0.2.0",
76
72
  "@textmode/tsconfig": "^0.2.0",
77
- "@textmode/vite-config": "^0.1.0",
78
73
  "@types/node": "^24.0.0",
79
- "@vitest/ui": "^4.1.10",
80
- "eslint": "^10.6.0",
81
- "jsdom": "^30.0.0",
82
- "lint-staged": "^17.0.8",
83
- "markdownlint-cli2": "^0.23.2",
84
- "prettier": "^3.9.4",
85
- "semantic-release": "^25.0.5",
86
- "terser": "^5.46.1",
87
- "textmode.js": "^0.17.0",
74
+ "textmode.js": "^0.17.2-beta.1",
88
75
  "typescript": "^6.0.3",
89
- "vite": "^8.1.3",
90
76
  "vite-plugin-css-injected-by-js": "^5.0.2",
91
77
  "vitest": "^4.1.10"
92
78
  },
@@ -112,44 +98,12 @@
112
98
  "author": "humanbydefinition <hello@textmode.art> (https://code.textmode.art)",
113
99
  "license": "MIT",
114
100
  "homepage": "https://code.textmode.art",
115
- "lint-staged": {
116
- "*": "prettier --ignore-unknown --write"
117
- },
118
- "prettier": "@textmode/prettier-config",
119
- "commitlint": {
120
- "extends": [
121
- "@textmode/commitlint-config"
122
- ]
123
- },
101
+ "prettier": "@textmode/lint/prettier",
124
102
  "repository": {
125
103
  "type": "git",
126
104
  "url": "git+https://github.com/humanbydefinition/textmode.export.js.git"
127
105
  },
128
106
  "bugs": {
129
107
  "url": "https://github.com/humanbydefinition/textmode.export.js/issues"
130
- },
131
- "markdownlint-cli2": {
132
- "globs": [
133
- "**/*.md"
134
- ],
135
- "ignores": [
136
- "api/**",
137
- "node_modules/**",
138
- "dist/**",
139
- "examples/**/*.md",
140
- "**/CHANGELOG.md"
141
- ],
142
- "fix": false,
143
- "outputFormatters": [
144
- [
145
- "markdownlint-cli2-formatter-default"
146
- ]
147
- ],
148
- "config": {
149
- "extends": "@textmode/markdownlint-config"
150
- }
151
- },
152
- "release": {
153
- "extends": "@textmode/release-config"
154
108
  }
155
109
  }
@@ -1,34 +0,0 @@
1
- import { Component } from '../base/Component';
2
- export interface RangeInputProps {
3
- defaultValue: string;
4
- attributes?: Partial<HTMLInputElement>;
5
- formatValue?: (value: number, input: HTMLInputElement) => string;
6
- }
7
- export declare class RangeInput extends Component<RangeInputProps> {
8
- private props;
9
- private input;
10
- private tooltip;
11
- private hoverActive;
12
- private focusActive;
13
- private pointerActive;
14
- private suppressFocusFromPointer;
15
- private activePointerId;
16
- private disabledObserver?;
17
- private resizeObserver?;
18
- constructor(props: RangeInputProps);
19
- render(): HTMLElement;
20
- get inputElement(): HTMLInputElement;
21
- get value(): string;
22
- set value(next: string);
23
- protected _onDestroy(): void;
24
- private bindEvents;
25
- private refreshTooltipVisibility;
26
- private syncDisabledState;
27
- private releasePointerCapture;
28
- private updateTooltip;
29
- private updateTooltipContent;
30
- private updateTooltipPosition;
31
- private getMin;
32
- private getMax;
33
- private getCurrentValue;
34
- }
@@ -1 +0,0 @@
1
- export declare const TEXTMODE_EXPORT_VERSION = "1.2.1";