textmode.export.js 1.3.0 → 1.5.0

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 (74) hide show
  1. package/README.md +1 -1
  2. package/dist/textmode.export.esm.js +5102 -1513
  3. package/dist/textmode.export.umd.js +68 -2
  4. package/dist/types/exporters/base/LayerTarget.d.ts +46 -0
  5. package/dist/types/exporters/base/LayerTarget.d.ts.map +1 -0
  6. package/dist/types/exporters/base/index.d.ts +2 -0
  7. package/dist/types/exporters/base/index.d.ts.map +1 -1
  8. package/dist/types/exporters/gif/GIFExporter.d.ts +1 -1
  9. package/dist/types/exporters/gif/GIFExporter.d.ts.map +1 -1
  10. package/dist/types/exporters/gif/GIFRecorder.d.ts +1 -1
  11. package/dist/types/exporters/gif/GIFRecorder.d.ts.map +1 -1
  12. package/dist/types/exporters/json/JSONDataExtractor.d.ts +3 -4
  13. package/dist/types/exporters/json/JSONDataExtractor.d.ts.map +1 -1
  14. package/dist/types/exporters/json/JSONExporter.d.ts +12 -7
  15. package/dist/types/exporters/json/JSONExporter.d.ts.map +1 -1
  16. package/dist/types/exporters/json/index.d.ts +1 -1
  17. package/dist/types/exporters/json/index.d.ts.map +1 -1
  18. package/dist/types/exporters/json/types.d.ts +78 -15
  19. package/dist/types/exporters/json/types.d.ts.map +1 -1
  20. package/dist/types/exporters/svg/SVGContentGenerator.d.ts +1 -1
  21. package/dist/types/exporters/svg/SVGContentGenerator.d.ts.map +1 -1
  22. package/dist/types/exporters/svg/SVGExporter.d.ts.map +1 -1
  23. package/dist/types/exporters/svg/SVGPathGenerator.d.ts +1 -1
  24. package/dist/types/exporters/svg/SVGPathGenerator.d.ts.map +1 -1
  25. package/dist/types/exporters/svg/types.d.ts +3 -1
  26. package/dist/types/exporters/svg/types.d.ts.map +1 -1
  27. package/dist/types/exporters/txt/TXTExporter.d.ts.map +1 -1
  28. package/dist/types/exporters/txt/TXTExporter.test.d.ts +2 -0
  29. package/dist/types/exporters/txt/TXTExporter.test.d.ts.map +1 -0
  30. package/dist/types/exporters/txt/types.d.ts +3 -1
  31. package/dist/types/exporters/txt/types.d.ts.map +1 -1
  32. package/dist/types/exporters/video/VideoExporter.d.ts +13 -17
  33. package/dist/types/exporters/video/VideoExporter.d.ts.map +1 -1
  34. package/dist/types/exporters/video/VideoExporter.test.d.ts +2 -0
  35. package/dist/types/exporters/video/VideoExporter.test.d.ts.map +1 -0
  36. package/dist/types/exporters/video/VideoFrameDriver.d.ts +32 -0
  37. package/dist/types/exporters/video/VideoFrameDriver.d.ts.map +1 -0
  38. package/dist/types/exporters/video/VideoFrameDriver.test.d.ts +2 -0
  39. package/dist/types/exporters/video/VideoFrameDriver.test.d.ts.map +1 -0
  40. package/dist/types/exporters/video/VideoRecorder.d.ts +10 -23
  41. package/dist/types/exporters/video/VideoRecorder.d.ts.map +1 -1
  42. package/dist/types/exporters/video/VideoRecorder.test.d.ts +2 -0
  43. package/dist/types/exporters/video/VideoRecorder.test.d.ts.map +1 -0
  44. package/dist/types/exporters/video/errors.d.ts +9 -0
  45. package/dist/types/exporters/video/errors.d.ts.map +1 -0
  46. package/dist/types/exporters/video/index.d.ts +3 -1
  47. package/dist/types/exporters/video/index.d.ts.map +1 -1
  48. package/dist/types/exporters/video/types.d.ts +147 -5
  49. package/dist/types/exporters/video/types.d.ts.map +1 -1
  50. package/dist/types/index.d.ts +7 -30
  51. package/dist/types/index.d.ts.map +1 -1
  52. package/dist/types/overlay/blades/Blade.d.ts +2 -0
  53. package/dist/types/overlay/blades/Blade.d.ts.map +1 -1
  54. package/dist/types/overlay/blades/JSONBlade.d.ts +5 -0
  55. package/dist/types/overlay/blades/JSONBlade.d.ts.map +1 -1
  56. package/dist/types/overlay/blades/SVGBlade.d.ts +2 -0
  57. package/dist/types/overlay/blades/SVGBlade.d.ts.map +1 -1
  58. package/dist/types/overlay/blades/TextBlade.d.ts +2 -0
  59. package/dist/types/overlay/blades/TextBlade.d.ts.map +1 -1
  60. package/dist/types/overlay/blades/VideoBlade.d.ts +10 -1
  61. package/dist/types/overlay/blades/VideoBlade.d.ts.map +1 -1
  62. package/dist/types/overlay/components/inputs/LayerTargetSelect.d.ts +20 -0
  63. package/dist/types/overlay/components/inputs/LayerTargetSelect.d.ts.map +1 -0
  64. package/dist/types/overlay/core/OverlayController.d.ts +1 -0
  65. package/dist/types/overlay/core/OverlayController.d.ts.map +1 -1
  66. package/dist/types/overlay/formatRegistry.d.ts +2 -1
  67. package/dist/types/overlay/formatRegistry.d.ts.map +1 -1
  68. package/dist/types/overlay/formatRegistry.test.d.ts +2 -0
  69. package/dist/types/overlay/formatRegistry.test.d.ts.map +1 -0
  70. package/dist/types/overlay/index.d.ts +3 -1
  71. package/dist/types/overlay/index.d.ts.map +1 -1
  72. package/dist/types/types.d.ts +36 -21
  73. package/dist/types/types.d.ts.map +1 -1
  74. package/package.json +5 -4
@@ -3,7 +3,7 @@ import type { TXTExportOptions } from './exporters/txt';
3
3
  import type { SVGExportOptions } from './exporters/svg';
4
4
  import type { GIFExportOptions } from './exporters/gif';
5
5
  import type { VideoExportOptions } from './exporters/video';
6
- import type { JSONExportOptions, TextmodeLayerJSON } from './exporters/json';
6
+ import type { JSONExportOptions, TextmodeDocumentJSON } from './exporters/json';
7
7
  /**
8
8
  * Controller for managing the export overlay UI visibility at runtime.
9
9
  */
@@ -47,6 +47,9 @@ export interface ExportOverlayController {
47
47
  }
48
48
  /**
49
49
  * Runtime export helpers that `createExportPlugin` attaches to the `Textmodifier` instance.
50
+ *
51
+ * @example
52
+ * {@includeCode ../examples/ExportPlugin/layerTargets/sketch.js}
50
53
  */
51
54
  export interface TextmodeExportAPI {
52
55
  /**
@@ -76,83 +79,86 @@ export interface TextmodeExportAPI {
76
79
  */
77
80
  copyCanvas(options?: ImageExportOptions): Promise<void>;
78
81
  /**
79
- * Downloads the current frame as an SVG file.
82
+ * Downloads the selected layer as an SVG file.
80
83
  *
81
84
  * @param options Export options.
82
85
  *
83
86
  * @example
84
87
  * ```ts
85
- * t.saveSVG({ filename: 'poster', includeBackgroundRectangles: true });
88
+ * t.saveSVG({ filename: 'poster', layer: t.layers.base, includeBackgroundRectangles: true });
86
89
  * ```
87
90
  */
88
91
  saveSVG(options?: SVGExportOptions): void;
89
92
  /**
90
- * Downloads the current text content as a plain-text file.
93
+ * Downloads the selected layer's text content as a plain-text file.
91
94
  *
92
95
  * @param options Export options.
93
96
  *
94
97
  * @example
95
98
  * ```ts
96
- * t.saveStrings({ filename: 'frame', preserveTrailingSpaces: true });
99
+ * t.saveStrings({ filename: 'frame', layer: t.layers.base, preserveTrailingSpaces: true });
97
100
  * ```
98
101
  */
99
102
  saveStrings(options?: TXTExportOptions): void;
100
103
  /**
101
- * Generates the SVG markup for the current frame.
104
+ * Generates SVG markup for the selected layer.
102
105
  *
103
106
  * @param options Export options.
104
107
  * @returns The SVG content representing the artwork.
105
108
  *
106
109
  * @example
107
110
  * ```ts
108
- * const svg = t.toSVG({ drawMode: 'stroke', strokeWidth: 1.5 });
111
+ * const svg = t.toSVG({ layer: t.layers.base, drawMode: 'stroke', strokeWidth: 1.5 });
109
112
  * ```
110
113
  */
111
114
  toSVG(options?: SVGExportOptions): string;
112
115
  /**
113
- * Produces the current text content as a string.
116
+ * Produces the selected layer's text content as a string.
114
117
  *
115
118
  * @param options Export options.
116
119
  * @returns The textual representation of the artwork.
117
120
  *
118
121
  * @example
119
122
  * ```ts
120
- * const text = t.toString({ preserveTrailingSpaces: false });
123
+ * const text = t.toString({ layer: t.layers.base, preserveTrailingSpaces: false });
121
124
  * ```
122
125
  */
123
126
  toString(options?: TXTExportOptions): string;
124
127
  /**
125
- * Produces the current base layer as structured JSON data.
128
+ * Produces the selected layer or layer stack as structured JSON data.
126
129
  *
127
130
  * @param options Export options.
128
- * @returns The JSON document representing the current base layer.
131
+ * @returns The JSON document representing the selected layer or layer stack.
129
132
  *
130
133
  * @example
131
134
  * ```ts
132
- * const layer = t.toJSON({ colorMode: 'hex', includeMetadata: true });
135
+ * const layer = t.toJSON({ layer: t.layers.base, colorMode: 'hex', includeMetadata: true });
136
+ * const stack = t.toJSON({ target: 'all' });
133
137
  * ```
134
138
  */
135
- toJSON(options?: JSONExportOptions): TextmodeLayerJSON;
139
+ toJSON(options?: JSONExportOptions): TextmodeDocumentJSON;
136
140
  /**
137
- * Produces the current base layer as a JSON string.
141
+ * Produces the selected layer or layer stack as a JSON string.
138
142
  *
139
143
  * @param options Export options.
140
- * @returns Serialized JSON string for the current base layer.
144
+ * @returns Serialized JSON string for the selected layer or layer stack.
141
145
  *
142
146
  * @example
143
147
  * ```ts
144
- * const json = t.toJSONString({ pretty: false, colorMode: 'hex' });
148
+ * const json = t.toJSONString({ layer: t.layers.base, pretty: false, colorMode: 'hex' });
149
+ * const stackJson = t.toJSONString({ target: 'all' });
145
150
  * ```
146
151
  */
147
152
  toJSONString(options?: JSONExportOptions): string;
148
153
  /**
149
- * Downloads the current base layer as a JSON file.
154
+ * Downloads the selected layer or layer stack as a JSON file.
150
155
  *
151
156
  * @param options Export options.
152
157
  *
153
158
  * @example
154
159
  * ```ts
155
- * t.saveJSON({ filename: 'frame', pretty: true });
160
+ * t.saveJSON({ filename: 'frame', layer: t.layers.base, pretty: true });
161
+ * t.saveJSON({ filename: 'stack', target: 'all' });
156
162
  * ```
157
163
  */
158
164
  saveJSON(options?: JSONExportOptions): void;
@@ -168,16 +174,25 @@ export interface TextmodeExportAPI {
168
174
  */
169
175
  saveGIF(options?: GIFExportOptions): Promise<void>;
170
176
  /**
171
- * Captures a WEBM video and saves it to disk.
177
+ * Captures a video and saves it to disk *(`'mp4'` by default)*.
172
178
  *
173
179
  * @param options Export options.
174
180
  *
175
181
  * @example
176
182
  * ```ts
177
- * await t.saveWEBM({ frameCount: 240, frameRate: 60, filename: 'capture' });
183
+ * await t.saveVideo({ frameCount: 240, frameRate: 60, filename: 'capture' });
184
+ * await t.saveVideo({
185
+ * format: 'webm',
186
+ * bitrate: 'high',
187
+ * bitrateMode: 'variable',
188
+ * latencyMode: 'quality',
189
+ * keyFrameInterval: 2,
190
+ * frameCount: 240,
191
+ * filename: 'capture',
192
+ * });
178
193
  * ```
179
194
  */
180
- saveWEBM(options?: VideoExportOptions): Promise<void>;
195
+ saveVideo(options?: VideoExportOptions): Promise<void>;
181
196
  }
182
197
  /**
183
198
  * Options for configuring the export plugin.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;;OAOG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;;;;;;OAOG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;;;;;;OAOG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;;;;;OAOG;IACH,SAAS,IAAI,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,aAAa,EAAE,uBAAuB,CAAC;IAEvC;;;;;;;;;OASG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;;;;;;;OASG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;;;;;;;;OASG;IACH,OAAO,CAAC,OAAO,CAAC,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C,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "textmode.export.js",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
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
  "main": "./dist/textmode.export.umd.js",
@@ -43,11 +43,11 @@
43
43
  "prepare": "husky"
44
44
  },
45
45
  "peerDependencies": {
46
- "textmode.js": ">=0.10.0"
46
+ "textmode.js": ">=0.13.0"
47
47
  },
48
48
  "dependencies": {
49
49
  "gifenc": "^1.0.1",
50
- "webm-writer": "^1.0.0"
50
+ "mediabunny": "^1.45.4"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@commitlint/cli": "^20.5.0",
@@ -56,6 +56,7 @@
56
56
  "@rollup/plugin-terser": "^0.4.4",
57
57
  "@semantic-release/commit-analyzer": "^13.0.1",
58
58
  "@semantic-release/exec": "^7.1.0",
59
+ "@semantic-release/git": "^10.0.1",
59
60
  "@semantic-release/github": "^12.0.6",
60
61
  "@semantic-release/npm": "^13.1.5",
61
62
  "@semantic-release/release-notes-generator": "^14.1.0",
@@ -72,7 +73,7 @@
72
73
  "prettier": "^3.8.3",
73
74
  "semantic-release": "^25.0.3",
74
75
  "terser": "^5.44.0",
75
- "textmode.js": "^0.12.0",
76
+ "textmode.js": "^0.16.0",
76
77
  "typedoc": "^0.28.19",
77
78
  "typedoc-plugin-frontmatter": "^1.3.1",
78
79
  "typedoc-plugin-markdown": "^4.11.0",