textmode.export.js 1.9.0-beta.2 → 1.9.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.
- package/README.md +1 -5
- package/dist/textmode.export.esm.js +1 -1
- package/dist/textmode.export.umd.js +1 -1
- package/dist/types/exporters/base/LayerTarget.d.ts +1 -1
- package/dist/types/exporters/json/JSONExporter.d.ts +2 -1
- package/dist/types/exporters/json/index.d.ts +1 -2
- package/dist/types/exporters/json/types.d.ts +10 -5
- package/dist/types/index.d.ts +1 -3
- package/dist/types/types.d.ts +7 -4
- package/package.json +5 -38
- package/dist/textmode.document.esm.js +0 -1
- package/dist/types/document/constants.d.ts +0 -32
- package/dist/types/document/decode-shapes.d.ts +0 -4
- package/dist/types/document/decode.d.ts +0 -5
- package/dist/types/document/index.d.ts +0 -13
- package/dist/types/document/parse.d.ts +0 -3
- package/dist/types/document/types.d.ts +0 -209
- package/dist/types/document/validation.d.ts +0 -37
- package/protocol/textmode-document/2.0/SPECIFICATION.md +0 -233
- package/protocol/textmode-document/2.0/fixture.d.ts +0 -3
- package/protocol/textmode-document/2.0/fixtures/textmode-document-all-v2.json +0 -94
- package/protocol/textmode-document/2.0/fixtures/textmode-document-create-integration-v2.json +0 -112
- package/protocol/textmode-document/2.0/fixtures/textmode-document-selected-v2.json +0 -86
- package/protocol/textmode-document/2.0/fixtures/textmode-layer-all-v1.1.json +0 -46
- package/protocol/textmode-document/2.0/fixtures/textmode-layer-selected-v1.json +0 -38
- package/protocol/textmode-document/2.0/textmode-document-2.0.schema.d.ts +0 -3
- package/protocol/textmode-document/2.0/textmode-document-2.0.schema.json +0 -171
|
@@ -46,4 +46,4 @@ export declare function getLayerTargetOptions(textmodifier: Textmodifier): Layer
|
|
|
46
46
|
export declare function createLayerTargetProvider(textmodifier: Textmodifier): LayerTargetProvider;
|
|
47
47
|
export declare function getLayerTargetId(textmodifier: Textmodifier, layer: TextmodeLayer): string;
|
|
48
48
|
export declare function resolveLayerExportTarget(textmodifier: Textmodifier, layer?: TextmodeLayer): ResolvedLayerExportTarget;
|
|
49
|
-
export declare function resolveLayerStackExportTargets(textmodifier: Textmodifier): ResolvedLayerStackExportTarget[];
|
|
49
|
+
export declare function resolveLayerStackExportTargets(textmodifier: Textmodifier, selectedLayers?: readonly TextmodeLayer[]): ResolvedLayerStackExportTarget[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Textmodifier } from 'textmode.js';
|
|
2
|
-
import type { JSONExportOptions
|
|
2
|
+
import type { JSONExportOptions } from './types';
|
|
3
|
+
import type { TextmodeDocumentJSON } from '@textmode/document';
|
|
3
4
|
/**
|
|
4
5
|
* Main JSON exporter for the textmode.js library.
|
|
5
6
|
* Orchestrates structured selected-layer or layer-stack export and file download.
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export { JSONExporter } from './JSONExporter';
|
|
2
|
-
export {
|
|
3
|
-
export type { JSONDocumentFormat, JSONDocumentVersion, JSONCellCollection, JSONCellData, JSONCellTransform, JSONColorValue, JSONExportColorMode, JSONExportMetadata, JSONExportOptions, JSONExportTarget, JSONGenerationOptions, JSONLayerGrid, JSONObjectRowCell, JSONObjectRowsCellCollection, JSONRGBAColor, TextmodeAllDocumentJSON, TextmodeDocumentJSON, TextmodeDocumentLayer, TextmodeSelectedDocumentJSON, TextmodeSelectedDocumentLayer, } from './types';
|
|
2
|
+
export type { JSONExportTarget, JSONExportColorMode, JSONExportOptions } from './types';
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { LayerExportOptions } from '../base';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextmodeDocumentCellTransform, TextmodeDocumentRGBAColor } from '@textmode/document';
|
|
3
|
+
/**
|
|
4
|
+
* Layer selection for export; never serialized into the document.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://code.textmode.art/api/textmode.export.js/type-aliases/JSONExportTarget | JSONExportTarget API reference}
|
|
7
|
+
*/
|
|
8
|
+
export type JSONExportTarget = 'selected' | 'all';
|
|
3
9
|
/**
|
|
4
10
|
* Color representation written by the JSON exporter: hexadecimal strings or
|
|
5
11
|
* RGBA channel objects.
|
|
@@ -7,7 +13,6 @@ import type { JSONCellTransform, JSONExportTarget, JSONRGBAColor } from '../../d
|
|
|
7
13
|
* @see {@link https://code.textmode.art/api/textmode.export.js/type-aliases/JSONExportColorMode | JSONExportColorMode API reference}
|
|
8
14
|
*/
|
|
9
15
|
export type JSONExportColorMode = 'hex' | 'rgba';
|
|
10
|
-
export type { JSONCellCollection, JSONCellTransform, JSONColorValue, JSONDocumentFormat, JSONDocumentVersion, JSONExportMetadata, JSONExportTarget, JSONLayerGrid, JSONObjectRowCell, JSONObjectRowsCellCollection, JSONRGBAColor, TextmodeAllDocumentJSON, TextmodeDocumentJSON, TextmodeDocumentLayer, TextmodeSelectedDocumentJSON, TextmodeSelectedDocumentLayer, } from '../../document';
|
|
11
16
|
/**
|
|
12
17
|
* Options for exporting textmode content to JSON.
|
|
13
18
|
*
|
|
@@ -45,7 +50,7 @@ export interface JSONCellData {
|
|
|
45
50
|
x: number;
|
|
46
51
|
y: number;
|
|
47
52
|
character: string;
|
|
48
|
-
foreground:
|
|
49
|
-
background:
|
|
50
|
-
transform:
|
|
53
|
+
foreground: TextmodeDocumentRGBAColor;
|
|
54
|
+
background: TextmodeDocumentRGBAColor;
|
|
55
|
+
transform: TextmodeDocumentCellTransform;
|
|
51
56
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -24,9 +24,7 @@ export type { TextmodeExportAPI, ExportOverlayController } from './types';
|
|
|
24
24
|
export type { ImageExportOptions } from './exporters/image';
|
|
25
25
|
export type { SVGExportOptions } from './exporters/svg';
|
|
26
26
|
export type { TXTExportOptions } from './exporters/txt';
|
|
27
|
-
export {
|
|
28
|
-
export type { JSONExportTarget, TextmodeDocumentJSON, TextmodeDocumentTarget } from './document';
|
|
29
|
-
export type { JSONExportColorMode, JSONExportOptions } from './exporters/json';
|
|
27
|
+
export type { JSONExportTarget, JSONExportColorMode, JSONExportOptions } from './exporters/json';
|
|
30
28
|
export type { GIFExportOptions, GIFExportProgress } from './exporters/gif';
|
|
31
29
|
export { ZIPExportError } from './exporters/zip';
|
|
32
30
|
export type { ZIPCaptureOptions, ZIPExportErrorCode, ZIPExportOptions, ZIPExportProgress, ZIPExportState, ZIPFrameFormat, ZIPFrameOptionsMap, } from './exporters/zip';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ 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
|
|
6
|
+
import type { JSONExportOptions } from './exporters/json';
|
|
7
|
+
import type { TextmodeDocumentJSON } from '@textmode/document';
|
|
7
8
|
import type { ZIPExportOptions } from './exporters/zip';
|
|
8
9
|
/**
|
|
9
10
|
* Default TXT export fields controlled by the export overlay.
|
|
@@ -364,7 +365,8 @@ export interface TextmodeExportAPI {
|
|
|
364
365
|
*/
|
|
365
366
|
toString(options?: TXTExportOptions): string;
|
|
366
367
|
/**
|
|
367
|
-
* Produces
|
|
368
|
+
* Produces a v3 document with a nonempty layers array.
|
|
369
|
+
* Selected layers retain their visibility, opacity, blending, and transforms.
|
|
368
370
|
*
|
|
369
371
|
* @param options Export options.
|
|
370
372
|
* @returns The JSON document representing the selected layer or layer stack.
|
|
@@ -373,13 +375,14 @@ export interface TextmodeExportAPI {
|
|
|
373
375
|
* ```ts
|
|
374
376
|
* const layer = t.toJSON({ layer: t.layers.base, colorMode: 'hex', includeMetadata: true });
|
|
375
377
|
* const stack = t.toJSON({ target: 'all' });
|
|
378
|
+
* console.log(layer.layers[0].grid, stack.formatVersion); // 3.0.0
|
|
376
379
|
* ```
|
|
377
380
|
*
|
|
378
381
|
* @see {@link https://code.textmode.art/api/textmode.export.js/interfaces/TextmodeExportAPI#tojson | TextmodeExportAPI.toJSON API reference}
|
|
379
382
|
*/
|
|
380
383
|
toJSON(options?: JSONExportOptions): TextmodeDocumentJSON;
|
|
381
384
|
/**
|
|
382
|
-
* Produces the selected layer or layer stack as a JSON string.
|
|
385
|
+
* Produces the selected layer or layer stack as a v3 JSON document string.
|
|
383
386
|
*
|
|
384
387
|
* @param options Export options.
|
|
385
388
|
* @returns Serialized JSON string for the selected layer or layer stack.
|
|
@@ -394,7 +397,7 @@ export interface TextmodeExportAPI {
|
|
|
394
397
|
*/
|
|
395
398
|
toJSONString(options?: JSONExportOptions): string;
|
|
396
399
|
/**
|
|
397
|
-
* Downloads the selected layer or layer stack as a JSON file.
|
|
400
|
+
* Downloads the selected layer or layer stack as a v3 JSON document file.
|
|
398
401
|
*
|
|
399
402
|
* @param options Export options.
|
|
400
403
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textmode.export.js",
|
|
3
|
-
"version": "1.9.0
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Export plugin for textmode.js - Save images, GIFs, videos, SVG, JSON, text, and ZIP frame sequences.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"devEngines": {
|
|
@@ -23,38 +23,6 @@
|
|
|
23
23
|
"types": "./dist/types/index.d.ts",
|
|
24
24
|
"import": "./dist/textmode.export.esm.js",
|
|
25
25
|
"require": "./dist/textmode.export.umd.js"
|
|
26
|
-
},
|
|
27
|
-
"./document": {
|
|
28
|
-
"types": "./dist/types/document/index.d.ts",
|
|
29
|
-
"import": "./dist/textmode.document.esm.js"
|
|
30
|
-
},
|
|
31
|
-
"./schema": {
|
|
32
|
-
"types": "./protocol/textmode-document/2.0/textmode-document-2.0.schema.d.ts",
|
|
33
|
-
"default": "./protocol/textmode-document/2.0/textmode-document-2.0.schema.json"
|
|
34
|
-
},
|
|
35
|
-
"./document/schema/2.0": {
|
|
36
|
-
"types": "./protocol/textmode-document/2.0/textmode-document-2.0.schema.d.ts",
|
|
37
|
-
"default": "./protocol/textmode-document/2.0/textmode-document-2.0.schema.json"
|
|
38
|
-
},
|
|
39
|
-
"./document/fixtures/2.0/textmode-document-selected-v2.json": {
|
|
40
|
-
"types": "./protocol/textmode-document/2.0/fixture.d.ts",
|
|
41
|
-
"default": "./protocol/textmode-document/2.0/fixtures/textmode-document-selected-v2.json"
|
|
42
|
-
},
|
|
43
|
-
"./document/fixtures/2.0/textmode-document-all-v2.json": {
|
|
44
|
-
"types": "./protocol/textmode-document/2.0/fixture.d.ts",
|
|
45
|
-
"default": "./protocol/textmode-document/2.0/fixtures/textmode-document-all-v2.json"
|
|
46
|
-
},
|
|
47
|
-
"./document/fixtures/2.0/textmode-document-create-integration-v2.json": {
|
|
48
|
-
"types": "./protocol/textmode-document/2.0/fixture.d.ts",
|
|
49
|
-
"default": "./protocol/textmode-document/2.0/fixtures/textmode-document-create-integration-v2.json"
|
|
50
|
-
},
|
|
51
|
-
"./document/fixtures/2.0/textmode-layer-selected-v1.json": {
|
|
52
|
-
"types": "./protocol/textmode-document/2.0/fixture.d.ts",
|
|
53
|
-
"default": "./protocol/textmode-document/2.0/fixtures/textmode-layer-selected-v1.json"
|
|
54
|
-
},
|
|
55
|
-
"./document/fixtures/2.0/textmode-layer-all-v1.1.json": {
|
|
56
|
-
"types": "./protocol/textmode-document/2.0/fixture.d.ts",
|
|
57
|
-
"default": "./protocol/textmode-document/2.0/fixtures/textmode-layer-all-v1.1.json"
|
|
58
26
|
}
|
|
59
27
|
},
|
|
60
28
|
"sideEffects": [
|
|
@@ -62,17 +30,15 @@
|
|
|
62
30
|
"./dist/textmode.export.umd.js"
|
|
63
31
|
],
|
|
64
32
|
"files": [
|
|
65
|
-
"dist"
|
|
66
|
-
"protocol/textmode-document/2.0"
|
|
33
|
+
"dist"
|
|
67
34
|
],
|
|
68
35
|
"scripts": {
|
|
69
36
|
"prebuild": "npm run clean",
|
|
70
37
|
"clean": "rm -rf dist",
|
|
71
38
|
"dev": "textmode-build dev --port 5174 --host",
|
|
72
39
|
"build:bundle": "textmode-build build",
|
|
73
|
-
"build:document": "vite build --config vite.document.config.ts",
|
|
74
40
|
"build:types": "textmode-types build",
|
|
75
|
-
"build": "npm run build:bundle && npm run build:
|
|
41
|
+
"build": "npm run build:bundle && npm run build:types",
|
|
76
42
|
"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",
|
|
77
43
|
"docs:links:add": "textmode-docs links add",
|
|
78
44
|
"docs:api:check": "textmode-docs api-check",
|
|
@@ -97,9 +63,10 @@
|
|
|
97
63
|
"textmode.js": "^0.18.0"
|
|
98
64
|
},
|
|
99
65
|
"dependencies": {
|
|
66
|
+
"@textmode/document": "1.1.0",
|
|
100
67
|
"fflate": "0.8.3",
|
|
101
68
|
"gifenc": "^1.0.1",
|
|
102
|
-
"mediabunny": "1.
|
|
69
|
+
"mediabunny": "1.62.1"
|
|
103
70
|
},
|
|
104
71
|
"devDependencies": {
|
|
105
72
|
"@textmode/build": "^0.1.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e="textmode.document",t="2.0.0",r="textmode.layer",n="1.0.0",a="1.1.0",o="object-rows-v1",i={maxCells:16777216,maxLayers:4096,maxLayerIdLength:1024,maxCharacterLength:64,maxMetadataStringLength:4096},s=class extends Error{detail;constructor(e){super(e.message),this.detail=e}};function c(e,t){if("string"==typeof e){const r=/^#([0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e);r||b("INVALID_DOCUMENT","Expected #RRGGBB or #RRGGBBAA color notation.",t);const n=r[1];return{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16),a:8===n.length?Number.parseInt(n.slice(6,8),16):255}}const r=I(e,t);return{r:T(r.r,`${t}.r`),g:T(r.g,`${t}.g`),b:T(r.b,`${t}.b`),a:T(r.a,`${t}.a`)}}function l(e,t){const r=I(e,t);return{width:A(r.width,`${t}.width`),height:A(r.height,`${t}.height`)}}function m(e,t){const r=I(e,t);return{cols:A(r.cols,`${t}.cols`),rows:A(r.rows,`${t}.rows`),cellWidth:A(r.cellWidth,`${t}.cellWidth`),cellHeight:A(r.cellHeight,`${t}.cellHeight`)}}function d(e,t,r){const n=I(e,t),a=I(n.generator,`${t}.generator`),o=N(a.name,`${t}.generator.name`,r.maxMetadataStringLength),i=N(n.createdAt,`${t}.createdAt`,r.maxMetadataStringLength);return function(e,t){const r=u.exec(e);r||b("INVALID_DOCUMENT","Expected an uppercase RFC 3339 timestamp with seconds and a timezone.",t);const n=Number(r[1]),a=Number(r[2]);Number(r[3])>[31,n%4!=0||n%100==0&&n%400!=0?28:29,31,30,31,30,31,31,30,31,30,31][a-1]&&b("INVALID_DOCUMENT","Timestamp contains an invalid calendar date.",t)}(i,`${t}.createdAt`),{createdAt:i,generator:{name:o,version:N(a.version,`${t}.generator.version`,r.maxMetadataStringLength)}}}var u=/^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])$/;function g(e,t,r){return N(e,t,r.maxLayerIdLength)}function f(e,t,r){const n=$(t.cols,t.cellWidth,`${r}.width`),a=$(t.rows,t.cellHeight,`${r}.height`);e.width===n&&e.height===a||b("INVALID_DOCUMENT",`Canvas must equal the grid pixel extent ${n}x${a}.`,r)}function h(e,t,r){if(void 0===e)return t;if(!Number.isSafeInteger(e)||e<=0)throw new TypeError(`${r} must be a positive safe integer.`);return e}function $(e,t,r){const n=e*t;return Number.isSafeInteger(n)||b("LIMIT_EXCEEDED","Numeric dimensions exceed the safe integer range.",r),n}function x(e){const t=(e%360+360)%360;return Object.is(t,-0)?0:t}function I(e,t){return("object"!=typeof e||null===e||Array.isArray(e))&&b("INVALID_DOCUMENT","Expected an object.",t),e}function E(e,t){return Array.isArray(e)||b("INVALID_DOCUMENT","Expected an array.",t),e}function p(e,t){return"string"!=typeof e&&b("INVALID_DOCUMENT","Expected a string.",t),e}function N(e,t,r){const n=p(e,t);return 0===n.length&&b("INVALID_DOCUMENT","Expected a non-empty string.",t),n.length>r&&b("LIMIT_EXCEEDED",`String length exceeds the configured limit ${r}.`,t),n}function L(e,t,r){const n=p(e,t);return 0===n.length&&b("INVALID_DOCUMENT","Expected a non-empty glyph string.",t),function(e,t){for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(n>=55296&&n<=56319){const n=e.charCodeAt(r+1);(!Number.isInteger(n)||n<56320||n>57343)&&b("INVALID_DOCUMENT","Glyph strings must not contain unpaired surrogates.",t),r++;continue}n>=56320&&n<=57343&&b("INVALID_DOCUMENT","Glyph strings must not contain unpaired surrogates.",t)}}(n,t),Array.from(n).length>r.maxCharacterLength&&b("LIMIT_EXCEEDED",`Glyph string scalar count exceeds the configured limit ${r.maxCharacterLength}.`,t),n}function D(e,t){return"boolean"!=typeof e&&b("INVALID_DOCUMENT","Expected a boolean.",t),e}function y(e,t){return"number"==typeof e&&Number.isFinite(e)||b("INVALID_DOCUMENT","Expected a finite number.",t),e}function C(e,t,r,n){const a=y(e,t);return(a<r||a>n)&&b("INVALID_DOCUMENT",`Expected a number from ${r} through ${n}.`,t),a}function M(e,t){return"number"==typeof e&&Number.isSafeInteger(e)||b("INVALID_DOCUMENT","Expected a safe integer.",t),e}function A(e,t){const r=M(e,t);return r<=0&&b("INVALID_DOCUMENT","Expected a positive safe integer.",t),r}function T(e,t){const r=M(e,t);return(r<0||r>255)&&b("INVALID_DOCUMENT","Expected an integer from 0 through 255.",t),r}function b(e,t,r){throw new s({code:e,message:t,...r?{path:r}:{}})}function v(r,n){const a=l(r.canvas,"$.canvas"),o=m(r.grid,"$.grid");f(a,o,"$.canvas");const i=I(r.layer,"$.layer");return{format:e,formatVersion:t,target:"selected",...void 0===r.metadata?{}:{metadata:d(r.metadata,"$.metadata",n.limits)},canvas:a,grid:o,layer:{id:g(i.id,"$.layer.id",n.limits),cells:O(i.cells,o,"$.layer.cells",n)}}}function U(r,n){const a=l(r.canvas,"$.canvas"),o=E(r.layers,"$.layers");0===o.length&&b("INVALID_DOCUMENT","A layer-stack document must contain at least one layer.","$.layers"),o.length>n.limits.maxLayers&&b("LIMIT_EXCEEDED",`Layer count ${o.length} exceeds the configured limit ${n.limits.maxLayers}.`,"$.layers");const i=o.map((e,t)=>function(e,t,r){const n=I(e,t),a=m(n.grid,`${t}.grid`);return{id:g(n.id,`${t}.id`,r.limits),visible:D(n.visible,`${t}.visible`),opacity:C(n.opacity,`${t}.opacity`,0,1),blendMode:N(n.blendMode,`${t}.blendMode`,r.limits.maxMetadataStringLength),offsetX:y(n.offsetX,`${t}.offsetX`),offsetY:y(n.offsetY,`${t}.offsetY`),rotationZ:y(n.rotationZ,`${t}.rotationZ`),grid:a,cells:O(n.cells,a,`${t}.cells`,r)}}(e,`$.layers[${t}]`,n));return f(a,i[0].grid,"$.canvas"),{format:e,formatVersion:t,target:"all",...void 0===r.metadata?{}:{metadata:d(r.metadata,"$.metadata",n.limits)},canvas:a,layers:i}}function O(e,t,r,n){const a=I(e,r),i=p(a.encoding,`${r}.encoding`);"object-rows-v1"!==i&&b("UNSUPPORTED_ENCODING",`Unsupported cell encoding: ${i}.`,`${r}.encoding`);const s=$(t.cols,t.rows,`${r}.rows`);s>n.remainingCells&&b("LIMIT_EXCEEDED",`Document cell count exceeds the configured limit ${n.limits.maxCells}.`,`${r}.rows`),n.remainingCells-=s;const l=E(a.rows,`${r}.rows`);return l.length!==t.rows&&b("INVALID_DOCUMENT",`Expected ${t.rows} cell rows, received ${l.length}.`,`${r}.rows`),{encoding:o,rows:l.map((e,a)=>{const o=`${r}.rows[${a}]`,i=E(e,o);return i.length!==t.cols&&b("INVALID_DOCUMENT",`Expected ${t.cols} cells, received ${i.length}.`,o),i.map((e,t)=>function(e,t,r,n,a){const o=I(e,n),i=M(o.x,`${n}.x`),s=M(o.y,`${n}.y`);i===t&&s===r||b("INVALID_DOCUMENT",`Cell coordinates must match their row position (${t}, ${r}).`,n);const l=I(o.transform,`${n}.transform`);return{x:i,y:s,character:L(o.character,`${n}.character`,a.limits),foreground:c(o.foreground,`${n}.foreground`),background:c(o.background,`${n}.background`),transform:{invert:D(l.invert,`${n}.transform.invert`),flipX:D(l.flipX,`${n}.transform.flipX`),flipY:D(l.flipY,`${n}.transform.flipY`),rotation:x(y(l.rotation,`${n}.transform.rotation`))}}}(e,t,a,`${o}[${t}]`,n))})}}function _(e){try{return{ok:!0,value:JSON.parse(e)}}catch(t){return{ok:!1,error:{code:"INVALID_JSON",message:t instanceof Error?t.message:"The file is not valid JSON."}}}}function V(e,t={}){try{const r=function(e){return{maxCells:h(e?.maxCells,i.maxCells,"maxCells"),maxLayers:h(e?.maxLayers,i.maxLayers,"maxLayers"),maxLayerIdLength:h(e?.maxLayerIdLength,i.maxLayerIdLength,"maxLayerIdLength"),maxCharacterLength:h(e?.maxCharacterLength,i.maxCharacterLength,"maxCharacterLength"),maxMetadataStringLength:h(e?.maxMetadataStringLength,i.maxMetadataStringLength,"maxMetadataStringLength")}}(t.limits),n={limits:r,remainingCells:r.maxCells},a=I(e,"$"),o=p(a.format,"$.format");return"textmode.document"===o?{ok:!0,document:S(a,n),warnings:[]}:"textmode.layer"===o&&(t.acceptLegacy??!0)?{ok:!0,document:R(a,n),warnings:[{code:"LEGACY_DOCUMENT_MIGRATED",message:"Migrated a legacy textmode.layer document to textmode.document 2.0.0."}]}:{ok:!1,error:{code:"UNSUPPORTED_FORMAT",message:`Unsupported textmode document format: ${o}.`,..."$.format"?{path:"$.format"}:{}}}}catch(r){if(r instanceof s)return{ok:!1,error:r.detail};throw r}}function w(e,t={}){const r=_(e);return r.ok?V(r.value,t):r}function S(e,t){const r=p(e.formatVersion,"$.formatVersion");"2.0.0"!==r&&b("UNSUPPORTED_VERSION",`Unsupported textmode.document version: ${r}.`,"$.formatVersion");const n=p(e.target,"$.target");return"selected"===n?v(e,t):"all"===n?U(e,t):void b("UNSUPPORTED_TARGET",`Unsupported textmode document target: ${n}.`,"$.target")}function R(e,t){const r=p(e.formatVersion,"$.formatVersion");return"1.0.0"===r?v(e,t):"1.1.0"===r?U(e,t):void b("UNSUPPORTED_VERSION",`Unsupported legacy textmode.layer version: ${r}.`,"$.formatVersion")}export{i as DEFAULT_TEXTMODE_DOCUMENT_LIMITS,a as LEGACY_TEXTMODE_ALL_VERSION,r as LEGACY_TEXTMODE_LAYER_FORMAT,n as LEGACY_TEXTMODE_SELECTED_VERSION,e as TEXTMODE_DOCUMENT_FORMAT,t as TEXTMODE_DOCUMENT_FORMAT_VERSION,o as TEXTMODE_OBJECT_ROWS_ENCODING,V as decodeTextmodeDocument,_ as parseJSON,w as parseTextmodeDocumentJSON};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canonical format discriminator for textmode document files.
|
|
3
|
-
*
|
|
4
|
-
* @see {@link https://code.textmode.art/api/textmode.export.js/variables/TEXTMODE_DOCUMENT_FORMAT | TEXTMODE_DOCUMENT_FORMAT API reference}
|
|
5
|
-
*/
|
|
6
|
-
export declare const TEXTMODE_DOCUMENT_FORMAT: "textmode.document";
|
|
7
|
-
/**
|
|
8
|
-
* Current textmode document schema revision.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link https://code.textmode.art/api/textmode.export.js/variables/TEXTMODE_DOCUMENT_FORMAT_VERSION | TEXTMODE_DOCUMENT_FORMAT_VERSION API reference}
|
|
11
|
-
*/
|
|
12
|
-
export declare const TEXTMODE_DOCUMENT_FORMAT_VERSION: "2.0.0";
|
|
13
|
-
/** Legacy format discriminator accepted by the compatibility decoder. */
|
|
14
|
-
export declare const LEGACY_TEXTMODE_LAYER_FORMAT: "textmode.layer";
|
|
15
|
-
/** Legacy selected-layer schema revision. */
|
|
16
|
-
export declare const LEGACY_TEXTMODE_SELECTED_VERSION: "1.0.0";
|
|
17
|
-
/** Legacy layer-stack schema revision. */
|
|
18
|
-
export declare const LEGACY_TEXTMODE_ALL_VERSION: "1.1.0";
|
|
19
|
-
/**
|
|
20
|
-
* Canonical dense row encoding used by textmode document v2.
|
|
21
|
-
*
|
|
22
|
-
* @see {@link https://code.textmode.art/api/textmode.export.js/variables/TEXTMODE_OBJECT_ROWS_ENCODING | TEXTMODE_OBJECT_ROWS_ENCODING API reference}
|
|
23
|
-
*/
|
|
24
|
-
export declare const TEXTMODE_OBJECT_ROWS_ENCODING: "object-rows-v1";
|
|
25
|
-
/** Default protocol safety limits. Product-specific limits belong to callers. */
|
|
26
|
-
export declare const DEFAULT_TEXTMODE_DOCUMENT_LIMITS: {
|
|
27
|
-
readonly maxCells: 16777216;
|
|
28
|
-
readonly maxLayers: 4096;
|
|
29
|
-
readonly maxLayerIdLength: 1024;
|
|
30
|
-
readonly maxCharacterLength: 64;
|
|
31
|
-
readonly maxMetadataStringLength: 4096;
|
|
32
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DecodeContext, UnknownRecord } from './validation';
|
|
2
|
-
import type { CanonicalTextmodeAllDocument, CanonicalTextmodeSelectedDocument } from './types';
|
|
3
|
-
export declare function decodeSelectedDocument(root: UnknownRecord, context: DecodeContext): CanonicalTextmodeSelectedDocument;
|
|
4
|
-
export declare function decodeAllDocument(root: UnknownRecord, context: DecodeContext): CanonicalTextmodeAllDocument;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { TextmodeDocumentDecodeOptions, TextmodeDocumentDecodeResult, TextmodeDocumentParseResult } from './types';
|
|
2
|
-
/** Decode a parsed JSON value into the canonical textmode document union. */
|
|
3
|
-
export declare function decodeTextmodeDocument(value: unknown, options?: TextmodeDocumentDecodeOptions): TextmodeDocumentDecodeResult;
|
|
4
|
-
/** Parse JSON syntax and decode its value in one convenience call. */
|
|
5
|
-
export declare function parseTextmodeDocumentJSON(json: string, options?: TextmodeDocumentDecodeOptions): TextmodeDocumentParseResult;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dependency-free textmode document protocol codec.
|
|
3
|
-
*
|
|
4
|
-
* This entry point contains no DOM, renderer, textmode.js, or media encoder
|
|
5
|
-
* dependencies. It decodes every valid v2 document variant; product-specific
|
|
6
|
-
* import policy belongs to callers.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
export { DEFAULT_TEXTMODE_DOCUMENT_LIMITS, LEGACY_TEXTMODE_ALL_VERSION, LEGACY_TEXTMODE_LAYER_FORMAT, LEGACY_TEXTMODE_SELECTED_VERSION, TEXTMODE_DOCUMENT_FORMAT, TEXTMODE_DOCUMENT_FORMAT_VERSION, TEXTMODE_OBJECT_ROWS_ENCODING, } from './constants';
|
|
11
|
-
export { decodeTextmodeDocument, parseTextmodeDocumentJSON } from './decode';
|
|
12
|
-
export { parseJSON } from './parse';
|
|
13
|
-
export type { CanonicalTextmodeAllDocument, CanonicalTextmodeCell, CanonicalTextmodeCellCollection, CanonicalTextmodeDocument, CanonicalTextmodeDocumentLayer, CanonicalTextmodeSelectedDocument, JSONCellCollection, JSONCellTransform, JSONColorValue, JSONDocumentFormat, JSONDocumentVersion, JSONExportMetadata, JSONExportTarget, JSONLayerGrid, JSONObjectRowCell, JSONObjectRowsCellCollection, JSONParseResult, JSONRGBAColor, LegacyTextmodeAllDocumentJSON, LegacyTextmodeSelectedDocumentJSON, TextmodeAllDocumentJSON, TextmodeDocumentDecodeOptions, TextmodeDocumentDecodeResult, TextmodeDocumentCell, TextmodeDocumentCellCollection, TextmodeDocumentCellTransform, TextmodeDocumentColor, TextmodeDocumentError, TextmodeDocumentErrorCode, TextmodeDocumentFormat, TextmodeDocumentGrid, TextmodeDocumentJSON, TextmodeDocumentLayer, TextmodeDocumentLimits, TextmodeDocumentMetadata, TextmodeDocumentParseResult, TextmodeDocumentRGBAColor, TextmodeDocumentTarget, TextmodeDocumentVersion, TextmodeDocumentWarning, TextmodeSelectedDocumentJSON, TextmodeSelectedDocumentLayer, } from './types';
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import type { LEGACY_TEXTMODE_ALL_VERSION, LEGACY_TEXTMODE_LAYER_FORMAT, LEGACY_TEXTMODE_SELECTED_VERSION, TEXTMODE_DOCUMENT_FORMAT, TEXTMODE_DOCUMENT_FORMAT_VERSION, TEXTMODE_OBJECT_ROWS_ENCODING } from './constants';
|
|
2
|
-
/**
|
|
3
|
-
* Scope encoded by a textmode document.
|
|
4
|
-
*
|
|
5
|
-
* @see {@link https://code.textmode.art/api/textmode.export.js/type-aliases/TextmodeDocumentTarget | TextmodeDocumentTarget API reference}
|
|
6
|
-
*/
|
|
7
|
-
export type TextmodeDocumentTarget = 'selected' | 'all';
|
|
8
|
-
/** Format discriminator encoded in a document. */
|
|
9
|
-
export type TextmodeDocumentFormat = typeof TEXTMODE_DOCUMENT_FORMAT;
|
|
10
|
-
/** Current on-disk format version, independent of the npm package version. */
|
|
11
|
-
export type TextmodeDocumentVersion = typeof TEXTMODE_DOCUMENT_FORMAT_VERSION;
|
|
12
|
-
/** RGBA color channels, each an integer from 0 through 255. */
|
|
13
|
-
export interface TextmodeDocumentRGBAColor {
|
|
14
|
-
r: number;
|
|
15
|
-
g: number;
|
|
16
|
-
b: number;
|
|
17
|
-
a: number;
|
|
18
|
-
}
|
|
19
|
-
/** On-disk color notation; decoded colors use RGBA channels. */
|
|
20
|
-
export type TextmodeDocumentColor = string | TextmodeDocumentRGBAColor;
|
|
21
|
-
/** Per-cell transform in degrees. */
|
|
22
|
-
export interface TextmodeDocumentCellTransform {
|
|
23
|
-
invert: boolean;
|
|
24
|
-
flipX: boolean;
|
|
25
|
-
flipY: boolean;
|
|
26
|
-
rotation: number;
|
|
27
|
-
}
|
|
28
|
-
/** Cell at its redundant row-major x/y coordinates. */
|
|
29
|
-
export interface TextmodeDocumentCell {
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
32
|
-
character: string;
|
|
33
|
-
foreground: TextmodeDocumentColor;
|
|
34
|
-
background: TextmodeDocumentColor;
|
|
35
|
-
transform: TextmodeDocumentCellTransform;
|
|
36
|
-
}
|
|
37
|
-
/** Dense row-major cell collection. */
|
|
38
|
-
export interface TextmodeDocumentCellCollection {
|
|
39
|
-
encoding: typeof TEXTMODE_OBJECT_ROWS_ENCODING;
|
|
40
|
-
rows: TextmodeDocumentCell[][];
|
|
41
|
-
}
|
|
42
|
-
/** Logical grid dimensions and pixel extent of each cell. */
|
|
43
|
-
export interface TextmodeDocumentGrid {
|
|
44
|
-
cols: number;
|
|
45
|
-
rows: number;
|
|
46
|
-
cellWidth: number;
|
|
47
|
-
cellHeight: number;
|
|
48
|
-
}
|
|
49
|
-
/** Optional producer information; it does not control decoding behavior. */
|
|
50
|
-
export interface TextmodeDocumentMetadata {
|
|
51
|
-
createdAt: string;
|
|
52
|
-
generator: {
|
|
53
|
-
name: string;
|
|
54
|
-
version: string;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Scope selected by the JSON exporter.
|
|
59
|
-
*
|
|
60
|
-
* @deprecated Use TextmodeDocumentTarget.
|
|
61
|
-
* @see {@link https://code.textmode.art/api/textmode.export.js/type-aliases/JSONExportTarget | JSONExportTarget API reference}
|
|
62
|
-
*/
|
|
63
|
-
export type JSONExportTarget = TextmodeDocumentTarget;
|
|
64
|
-
/** @deprecated Use TextmodeDocumentFormat. */
|
|
65
|
-
export type JSONDocumentFormat = TextmodeDocumentFormat;
|
|
66
|
-
/** @deprecated Use TextmodeDocumentVersion. */
|
|
67
|
-
export type JSONDocumentVersion = TextmodeDocumentVersion;
|
|
68
|
-
/** @deprecated Use TextmodeDocumentRGBAColor. */
|
|
69
|
-
export type JSONRGBAColor = TextmodeDocumentRGBAColor;
|
|
70
|
-
/** @deprecated Use TextmodeDocumentColor. */
|
|
71
|
-
export type JSONColorValue = TextmodeDocumentColor;
|
|
72
|
-
/** @deprecated Use TextmodeDocumentCellTransform. */
|
|
73
|
-
export type JSONCellTransform = TextmodeDocumentCellTransform;
|
|
74
|
-
/** @deprecated Use TextmodeDocumentCell. */
|
|
75
|
-
export type JSONObjectRowCell = TextmodeDocumentCell;
|
|
76
|
-
/** @deprecated Use TextmodeDocumentCellCollection. */
|
|
77
|
-
export type JSONObjectRowsCellCollection = TextmodeDocumentCellCollection;
|
|
78
|
-
/** @deprecated Use TextmodeDocumentCellCollection. */
|
|
79
|
-
export type JSONCellCollection = TextmodeDocumentCellCollection;
|
|
80
|
-
/** @deprecated Use TextmodeDocumentGrid. */
|
|
81
|
-
export type JSONLayerGrid = TextmodeDocumentGrid;
|
|
82
|
-
/** @deprecated Use TextmodeDocumentMetadata. */
|
|
83
|
-
export type JSONExportMetadata = TextmodeDocumentMetadata;
|
|
84
|
-
export interface TextmodeSelectedDocumentLayer {
|
|
85
|
-
id: string;
|
|
86
|
-
cells: JSONCellCollection;
|
|
87
|
-
}
|
|
88
|
-
export interface TextmodeSelectedDocumentJSON {
|
|
89
|
-
format: JSONDocumentFormat;
|
|
90
|
-
formatVersion: JSONDocumentVersion;
|
|
91
|
-
target: 'selected';
|
|
92
|
-
metadata?: JSONExportMetadata;
|
|
93
|
-
canvas: {
|
|
94
|
-
width: number;
|
|
95
|
-
height: number;
|
|
96
|
-
};
|
|
97
|
-
grid: JSONLayerGrid;
|
|
98
|
-
layer: TextmodeSelectedDocumentLayer;
|
|
99
|
-
}
|
|
100
|
-
export interface TextmodeDocumentLayer {
|
|
101
|
-
id: string;
|
|
102
|
-
visible: boolean;
|
|
103
|
-
opacity: number;
|
|
104
|
-
blendMode: string;
|
|
105
|
-
offsetX: number;
|
|
106
|
-
offsetY: number;
|
|
107
|
-
rotationZ: number;
|
|
108
|
-
grid: JSONLayerGrid;
|
|
109
|
-
cells: JSONCellCollection;
|
|
110
|
-
}
|
|
111
|
-
export interface TextmodeAllDocumentJSON {
|
|
112
|
-
format: JSONDocumentFormat;
|
|
113
|
-
formatVersion: JSONDocumentVersion;
|
|
114
|
-
target: 'all';
|
|
115
|
-
metadata?: JSONExportMetadata;
|
|
116
|
-
canvas: {
|
|
117
|
-
width: number;
|
|
118
|
-
height: number;
|
|
119
|
-
};
|
|
120
|
-
layers: TextmodeDocumentLayer[];
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* JSON document produced by the selected-layer or layer-stack exporter.
|
|
124
|
-
*
|
|
125
|
-
* @see {@link https://code.textmode.art/api/textmode.export.js/type-aliases/TextmodeDocumentJSON | TextmodeDocumentJSON API reference}
|
|
126
|
-
*/
|
|
127
|
-
export type TextmodeDocumentJSON = TextmodeSelectedDocumentJSON | TextmodeAllDocumentJSON;
|
|
128
|
-
export interface CanonicalTextmodeCell extends Omit<JSONObjectRowCell, 'foreground' | 'background' | 'transform'> {
|
|
129
|
-
foreground: JSONRGBAColor;
|
|
130
|
-
background: JSONRGBAColor;
|
|
131
|
-
transform: JSONCellTransform;
|
|
132
|
-
}
|
|
133
|
-
export interface CanonicalTextmodeCellCollection {
|
|
134
|
-
encoding: typeof TEXTMODE_OBJECT_ROWS_ENCODING;
|
|
135
|
-
rows: CanonicalTextmodeCell[][];
|
|
136
|
-
}
|
|
137
|
-
export interface CanonicalTextmodeSelectedDocument extends Omit<TextmodeSelectedDocumentJSON, 'layer'> {
|
|
138
|
-
layer: {
|
|
139
|
-
id: string;
|
|
140
|
-
cells: CanonicalTextmodeCellCollection;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
export interface CanonicalTextmodeDocumentLayer extends Omit<TextmodeDocumentLayer, 'cells'> {
|
|
144
|
-
cells: CanonicalTextmodeCellCollection;
|
|
145
|
-
}
|
|
146
|
-
export interface CanonicalTextmodeAllDocument extends Omit<TextmodeAllDocumentJSON, 'layers'> {
|
|
147
|
-
layers: CanonicalTextmodeDocumentLayer[];
|
|
148
|
-
}
|
|
149
|
-
export type CanonicalTextmodeDocument = CanonicalTextmodeSelectedDocument | CanonicalTextmodeAllDocument;
|
|
150
|
-
export interface TextmodeDocumentLimits {
|
|
151
|
-
maxCells?: number;
|
|
152
|
-
maxLayers?: number;
|
|
153
|
-
maxLayerIdLength?: number;
|
|
154
|
-
maxCharacterLength?: number;
|
|
155
|
-
maxMetadataStringLength?: number;
|
|
156
|
-
}
|
|
157
|
-
export interface TextmodeDocumentDecodeOptions {
|
|
158
|
-
limits?: TextmodeDocumentLimits;
|
|
159
|
-
acceptLegacy?: boolean;
|
|
160
|
-
}
|
|
161
|
-
export type TextmodeDocumentErrorCode = 'INVALID_JSON' | 'INVALID_DOCUMENT' | 'UNSUPPORTED_FORMAT' | 'UNSUPPORTED_VERSION' | 'UNSUPPORTED_TARGET' | 'UNSUPPORTED_ENCODING' | 'LIMIT_EXCEEDED';
|
|
162
|
-
export interface TextmodeDocumentError {
|
|
163
|
-
code: TextmodeDocumentErrorCode;
|
|
164
|
-
message: string;
|
|
165
|
-
path?: string;
|
|
166
|
-
}
|
|
167
|
-
export interface TextmodeDocumentWarning {
|
|
168
|
-
code: 'LEGACY_DOCUMENT_MIGRATED';
|
|
169
|
-
message: string;
|
|
170
|
-
}
|
|
171
|
-
export type JSONParseResult = {
|
|
172
|
-
ok: true;
|
|
173
|
-
value: unknown;
|
|
174
|
-
} | {
|
|
175
|
-
ok: false;
|
|
176
|
-
error: TextmodeDocumentError;
|
|
177
|
-
};
|
|
178
|
-
export type TextmodeDocumentDecodeResult = {
|
|
179
|
-
ok: true;
|
|
180
|
-
document: CanonicalTextmodeDocument;
|
|
181
|
-
warnings: TextmodeDocumentWarning[];
|
|
182
|
-
} | {
|
|
183
|
-
ok: false;
|
|
184
|
-
error: TextmodeDocumentError;
|
|
185
|
-
};
|
|
186
|
-
export type TextmodeDocumentParseResult = TextmodeDocumentDecodeResult;
|
|
187
|
-
export interface LegacyTextmodeSelectedDocumentJSON {
|
|
188
|
-
$schema?: string;
|
|
189
|
-
format: typeof LEGACY_TEXTMODE_LAYER_FORMAT;
|
|
190
|
-
formatVersion: typeof LEGACY_TEXTMODE_SELECTED_VERSION;
|
|
191
|
-
metadata?: JSONExportMetadata;
|
|
192
|
-
canvas: {
|
|
193
|
-
width: number;
|
|
194
|
-
height: number;
|
|
195
|
-
};
|
|
196
|
-
grid: JSONLayerGrid;
|
|
197
|
-
layer: TextmodeSelectedDocumentLayer;
|
|
198
|
-
}
|
|
199
|
-
export interface LegacyTextmodeAllDocumentJSON {
|
|
200
|
-
$schema?: string;
|
|
201
|
-
format: typeof LEGACY_TEXTMODE_LAYER_FORMAT;
|
|
202
|
-
formatVersion: typeof LEGACY_TEXTMODE_ALL_VERSION;
|
|
203
|
-
metadata?: JSONExportMetadata;
|
|
204
|
-
canvas: {
|
|
205
|
-
width: number;
|
|
206
|
-
height: number;
|
|
207
|
-
};
|
|
208
|
-
layers: TextmodeDocumentLayer[];
|
|
209
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { JSONExportMetadata, JSONLayerGrid, JSONRGBAColor, TextmodeDocumentDecodeResult, TextmodeDocumentError, TextmodeDocumentErrorCode, TextmodeDocumentLimits } from './types';
|
|
2
|
-
export type UnknownRecord = Record<string, unknown>;
|
|
3
|
-
export type ResolvedLimits = Required<TextmodeDocumentLimits>;
|
|
4
|
-
export type DecodeContext = {
|
|
5
|
-
limits: ResolvedLimits;
|
|
6
|
-
remainingCells: number;
|
|
7
|
-
};
|
|
8
|
-
export declare class DocumentDecodeFailure extends Error {
|
|
9
|
-
readonly detail: TextmodeDocumentError;
|
|
10
|
-
constructor(detail: TextmodeDocumentError);
|
|
11
|
-
}
|
|
12
|
-
export declare function decodeColor(value: unknown, path: string): JSONRGBAColor;
|
|
13
|
-
export declare function decodeCanvas(value: unknown, path: string): {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
};
|
|
17
|
-
export declare function decodeGrid(value: unknown, path: string): JSONLayerGrid;
|
|
18
|
-
export declare function decodeMetadata(value: unknown, path: string, limits: ResolvedLimits): JSONExportMetadata;
|
|
19
|
-
export declare function decodeLayerId(value: unknown, path: string, limits: ResolvedLimits): string;
|
|
20
|
-
export declare function assertCanvasMatchesGrid(canvas: {
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
}, grid: JSONLayerGrid, path: string): void;
|
|
24
|
-
export declare function resolveLimits(limits: TextmodeDocumentLimits | undefined): ResolvedLimits;
|
|
25
|
-
export declare function checkedProduct(left: number, right: number, path: string): number;
|
|
26
|
-
export declare function normalizeRotation(rotation: number): number;
|
|
27
|
-
export declare function requireRecord(value: unknown, path: string): UnknownRecord;
|
|
28
|
-
export declare function requireArray(value: unknown, path: string): unknown[];
|
|
29
|
-
export declare function requireString(value: unknown, path: string): string;
|
|
30
|
-
export declare function requireBoundedString(value: unknown, path: string, maxLength: number): string;
|
|
31
|
-
export declare function requireCharacter(value: unknown, path: string, limits: ResolvedLimits): string;
|
|
32
|
-
export declare function requireBoolean(value: unknown, path: string): boolean;
|
|
33
|
-
export declare function requireFiniteNumber(value: unknown, path: string): number;
|
|
34
|
-
export declare function requireNumberInRange(value: unknown, path: string, minimum: number, maximum: number): number;
|
|
35
|
-
export declare function requireSafeInteger(value: unknown, path: string): number;
|
|
36
|
-
export declare function failure(code: TextmodeDocumentErrorCode, message: string, path?: string): TextmodeDocumentDecodeResult;
|
|
37
|
-
export declare function fail(code: TextmodeDocumentErrorCode, message: string, path?: string): never;
|