@xterm/addon-image 0.9.0-beta.98 → 0.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.
@@ -1,140 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2020, 2023 The xterm.js authors. All rights reserved.
4
- * @license MIT
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SixelHandler = void 0;
8
- const Colors_1 = require("sixel/lib/Colors");
9
- const ImageRenderer_1 = require("./ImageRenderer");
10
- const Decoder_1 = require("sixel/lib/Decoder");
11
- // always free decoder ressources after decoding if it exceeds this limit
12
- const MEM_PERMA_LIMIT = 4194304; // 1024 pixels * 1024 pixels * 4 channels = 4MB
13
- // custom default palette: VT340 (lower 16 colors) + ANSI256 (up to 256) + zeroed (up to 4096)
14
- const DEFAULT_PALETTE = Colors_1.PALETTE_ANSI_256;
15
- DEFAULT_PALETTE.set(Colors_1.PALETTE_VT340_COLOR);
16
- class SixelHandler {
17
- constructor(_opts, _storage, _coreTerminal) {
18
- this._opts = _opts;
19
- this._storage = _storage;
20
- this._coreTerminal = _coreTerminal;
21
- this._size = 0;
22
- this._aborted = false;
23
- (0, Decoder_1.DecoderAsync)({
24
- memoryLimit: this._opts.pixelLimit * 4,
25
- palette: DEFAULT_PALETTE,
26
- paletteLimit: this._opts.sixelPaletteLimit
27
- }).then(d => this._dec = d);
28
- }
29
- reset() {
30
- /**
31
- * reset sixel decoder to defaults:
32
- * - release all memory
33
- * - nullify palette (4096)
34
- * - apply default palette (256)
35
- */
36
- if (this._dec) {
37
- this._dec.release();
38
- // FIXME: missing interface on decoder to nullify full palette
39
- this._dec._palette.fill(0);
40
- this._dec.init(0, DEFAULT_PALETTE, this._opts.sixelPaletteLimit);
41
- }
42
- }
43
- hook(params) {
44
- var _a;
45
- this._size = 0;
46
- this._aborted = false;
47
- if (this._dec) {
48
- const fillColor = params.params[1] === 1 ? 0 : extractActiveBg(this._coreTerminal._core._inputHandler._curAttrData, (_a = this._coreTerminal._core._themeService) === null || _a === void 0 ? void 0 : _a.colors);
49
- this._dec.init(fillColor, null, this._opts.sixelPaletteLimit);
50
- }
51
- }
52
- put(data, start, end) {
53
- if (this._aborted || !this._dec) {
54
- return;
55
- }
56
- this._size += end - start;
57
- if (this._size > this._opts.sixelSizeLimit) {
58
- console.warn(`SIXEL: too much data, aborting`);
59
- this._aborted = true;
60
- this._dec.release();
61
- return;
62
- }
63
- try {
64
- this._dec.decode(data, start, end);
65
- }
66
- catch (e) {
67
- console.warn(`SIXEL: error while decoding image - ${e}`);
68
- this._aborted = true;
69
- this._dec.release();
70
- }
71
- }
72
- unhook(success) {
73
- var _a;
74
- if (this._aborted || !success || !this._dec) {
75
- return true;
76
- }
77
- const width = this._dec.width;
78
- const height = this._dec.height;
79
- // partial fix for https://github.com/jerch/xterm-addon-image/issues/37
80
- if (!width || !height) {
81
- if (height) {
82
- this._storage.advanceCursor(height);
83
- }
84
- return true;
85
- }
86
- const canvas = ImageRenderer_1.ImageRenderer.createCanvas(undefined, width, height);
87
- (_a = canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.putImageData(new ImageData(this._dec.data8, width, height), 0, 0);
88
- if (this._dec.memoryUsage > MEM_PERMA_LIMIT) {
89
- this._dec.release();
90
- }
91
- this._storage.addImage(canvas);
92
- return true;
93
- }
94
- }
95
- exports.SixelHandler = SixelHandler;
96
- /**
97
- * Some helpers to extract current terminal colors.
98
- */
99
- // get currently active background color from terminal
100
- // also respect INVERSE setting
101
- function extractActiveBg(attr, colors) {
102
- let bg = 0;
103
- if (!colors) {
104
- // FIXME: theme service is prolly not available yet,
105
- // happens if .open() was not called yet (bug in core?)
106
- return bg;
107
- }
108
- if (attr.isInverse()) {
109
- if (attr.isFgDefault()) {
110
- bg = convertLe(colors.foreground.rgba);
111
- }
112
- else if (attr.isFgRGB()) {
113
- const t = attr.constructor.toColorRGB(attr.getFgColor());
114
- bg = (0, Colors_1.toRGBA8888)(...t);
115
- }
116
- else {
117
- bg = convertLe(colors.ansi[attr.getFgColor()].rgba);
118
- }
119
- }
120
- else {
121
- if (attr.isBgDefault()) {
122
- bg = convertLe(colors.background.rgba);
123
- }
124
- else if (attr.isBgRGB()) {
125
- const t = attr.constructor.toColorRGB(attr.getBgColor());
126
- bg = (0, Colors_1.toRGBA8888)(...t);
127
- }
128
- else {
129
- bg = convertLe(colors.ansi[attr.getBgColor()].rgba);
130
- }
131
- }
132
- return bg;
133
- }
134
- // rgba values on the color managers are always in BE, thus convert to LE
135
- function convertLe(color) {
136
- if (Colors_1.BIG_ENDIAN)
137
- return color;
138
- return (color & 0xFF) << 24 | (color >>> 8 & 0xFF) << 16 | (color >>> 16 & 0xFF) << 8 | color >>> 24 & 0xFF;
139
- }
140
- //# sourceMappingURL=SixelHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SixelHandler.js","sourceRoot":"","sources":["../src/SixelHandler.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,6CAAiG;AAEjG,mDAAgD;AAEhD,+CAA0D;AAE1D,yEAAyE;AACzE,MAAM,eAAe,GAAG,OAAO,CAAC,CAAC,+CAA+C;AAEhF,8FAA8F;AAC9F,MAAM,eAAe,GAAG,yBAAgB,CAAC;AACzC,eAAe,CAAC,GAAG,CAAC,4BAAmB,CAAC,CAAC;AAGzC,MAAa,YAAY;IAKvB,YACmB,KAAyB,EACzB,QAAsB,EACtB,aAA2B;QAF3B,UAAK,GAAL,KAAK,CAAoB;QACzB,aAAQ,GAAR,QAAQ,CAAc;QACtB,kBAAa,GAAb,aAAa,CAAc;QAPtC,UAAK,GAAG,CAAC,CAAC;QACV,aAAQ,GAAG,KAAK,CAAC;QAQvB,IAAA,sBAAY,EAAC;YACX,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC;YACtC,OAAO,EAAE,eAAe;YACxB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB;SAC3C,CAAC,CAAC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YAC1B,MAAM,CAAC,GAAI,IAAI,CAAC,WAAoC,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;YACnF,EAAE,GAAG,IAAA,mBAAU,EAAC,GAAG,CAAC,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,yEAAyE;AACzE,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,mBAAU;QAAE,OAAO,KAAK,CAAC;IAC7B,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,EAAE,GAAG,IAAI,CAAC;AAC9G,CAAC"}
package/out/Types.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2020 The xterm.js authors. All rights reserved.
4
- * @license MIT
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=Types.js.map
package/out/Types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Types.js","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -1,138 +0,0 @@
1
- /**
2
- * Copyright (c) 2023 The xterm.js authors. All rights reserved.
3
- * @license MIT
4
- */
5
-
6
- import { assert } from 'chai';
7
- import { HeaderParser, HeaderState, IHeaderFields } from './IIPHeaderParser';
8
-
9
-
10
- const CASES: [string, IHeaderFields][] = [
11
- ['File=size=123456;name=dGVzdA==:', {name: 'test', size: 123456}],
12
- ['File=size=123456;name=dGVzdA:', {name: 'test', size: 123456}],
13
- // utf-8 encoding in name
14
- ['File=size=123456;name=w7xtbMOkdXTDnw==:', {name: 'ümläutß', size: 123456}],
15
- ['File=size=123456;name=w7xtbMOkdXTDnw:', {name: 'ümläutß', size: 123456}],
16
- // full header spec
17
- [
18
- 'File=inline=1;width=10px;height=20%;preserveAspectRatio=1;size=123456;name=w7xtbMOkdXTDnw:',
19
- {
20
- inline: 1,
21
- width: '10px',
22
- height: '20%',
23
- preserveAspectRatio: 1,
24
- size: 123456,
25
- name: 'ümläutß'
26
- }
27
- ],
28
- [
29
- 'File=inline=1;width=auto;height=20;preserveAspectRatio=1;size=123456;name=w7xtbMOkdXTDnw:',
30
- {
31
- inline: 1,
32
- width: 'auto',
33
- height: '20',
34
- preserveAspectRatio: 1,
35
- size: 123456,
36
- name: 'ümläutß'
37
- }
38
- ]
39
- ];
40
-
41
- function fromBs(bs: string): Uint32Array {
42
- const r = new Uint32Array(bs.length);
43
- for (let i = 0; i < r.length; ++i) r[i] = bs.charCodeAt(i);
44
- return r;
45
- }
46
-
47
- describe('IIPHeaderParser', () => {
48
- it('at once', () => {
49
- const hp = new HeaderParser();
50
- for (const example of CASES) {
51
- hp.reset();
52
- const inp = fromBs(example[0]);
53
- const res = hp.parse(inp, 0, inp.length);
54
- assert.strictEqual(res, inp.length);
55
- assert.strictEqual(hp.state, HeaderState.END);
56
- assert.deepEqual(hp.fields, example[1]);
57
- }
58
- });
59
- it('bytewise', () => {
60
- const hp = new HeaderParser();
61
- for (const example of CASES) {
62
- hp.reset();
63
- const inp = fromBs(example[0]);
64
- let pos = 0;
65
- let res = -2;
66
- while (res === -2 && pos < inp.length) {
67
- res = hp.parse(new Uint32Array([inp[pos++]]), 0, 1);
68
- }
69
- assert.strictEqual(res, 1);
70
- assert.strictEqual(hp.state, HeaderState.END);
71
- assert.deepEqual(hp.fields, example[1]);
72
- }
73
- });
74
- it('no File= starter', () => {
75
- const hp = new HeaderParser();
76
- let inp = fromBs('size=123456;name=dGVzdA==:');
77
- let res = hp.parse(inp, 0, inp.length);
78
- assert.strictEqual(res, -1);
79
- hp.reset();
80
- inp = fromBs(CASES[0][0]);
81
- res = hp.parse(inp, 0, inp.length);
82
- assert.strictEqual(res, inp.length);
83
- assert.strictEqual(hp.state, HeaderState.END);
84
- assert.deepEqual(hp.fields, CASES[0][1]);
85
- });
86
- it('empty key - error', () => {
87
- const hp = new HeaderParser();
88
- let inp = fromBs('File=size=123456;=dGVzdA==:');
89
- let res = hp.parse(inp, 0, inp.length);
90
- assert.strictEqual(res, -1);
91
- hp.reset();
92
- inp = fromBs(CASES[0][0]);
93
- res = hp.parse(inp, 0, inp.length);
94
- assert.strictEqual(res, inp.length);
95
- assert.strictEqual(hp.state, HeaderState.END);
96
- assert.deepEqual(hp.fields, CASES[0][1]);
97
- });
98
- it('empty size value - set to 0', () => {
99
- const hp = new HeaderParser();
100
- let inp = fromBs('File=size=;name=dGVzdA==:');
101
- let res = hp.parse(inp, 0, inp.length);
102
- assert.strictEqual(res, inp.length);
103
- assert.strictEqual(hp.state, HeaderState.END);
104
- assert.deepEqual(hp.fields, {name: 'test', size: 0});
105
- hp.reset();
106
- inp = fromBs(CASES[0][0]);
107
- res = hp.parse(inp, 0, inp.length);
108
- assert.strictEqual(res, inp.length);
109
- assert.strictEqual(hp.state, HeaderState.END);
110
- assert.deepEqual(hp.fields, CASES[0][1]);
111
- });
112
- it('empty name value - set to empty string', () => {
113
- const hp = new HeaderParser();
114
- let inp = fromBs('File=size=123456;name=:');
115
- let res = hp.parse(inp, 0, inp.length);
116
- assert.strictEqual(res, inp.length);
117
- assert.strictEqual(hp.state, HeaderState.END);
118
- assert.deepEqual(hp.fields, {name: '', size: 123456});
119
- hp.reset();
120
- inp = fromBs(CASES[0][0]);
121
- res = hp.parse(inp, 0, inp.length);
122
- assert.strictEqual(res, inp.length);
123
- assert.strictEqual(hp.state, HeaderState.END);
124
- assert.deepEqual(hp.fields, CASES[0][1]);
125
- });
126
- it('empty size value - error', () => {
127
- const hp = new HeaderParser();
128
- let inp = fromBs('File=inline=1;width=;height=20%;preserveAspectRatio=1;size=123456;name=w7xtbMOkdXTDnw:');
129
- let res = hp.parse(inp, 0, inp.length);
130
- assert.strictEqual(res, -1);
131
- hp.reset();
132
- inp = fromBs(CASES[0][0]);
133
- res = hp.parse(inp, 0, inp.length);
134
- assert.strictEqual(res, inp.length);
135
- assert.strictEqual(hp.state, HeaderState.END);
136
- assert.deepEqual(hp.fields, CASES[0][1]);
137
- });
138
- });
@@ -1,44 +0,0 @@
1
- /**
2
- * Copyright (c) 2023 The xterm.js authors. All rights reserved.
3
- * @license MIT
4
- */
5
-
6
- import { assert } from 'chai';
7
- import { imageType, IMetrics } from './IIPMetrics';
8
-
9
- // fix missing nodejs decl
10
- declare const require: (s: string) => any;
11
- const fs = require('fs');
12
-
13
-
14
- const TEST_IMAGES: [string, IMetrics][] = [
15
- ['w3c_home_256.gif', { mime: 'image/gif', width: 72, height: 48 }],
16
- ['w3c_home_256.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
17
- ['w3c_home_256.png', { mime: 'image/png', width: 72, height: 48 }],
18
- ['w3c_home_2.gif', { mime: 'image/gif', width: 72, height: 48 }],
19
- ['w3c_home_2.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
20
- ['w3c_home_2.png', { mime: 'image/png', width: 72, height: 48 }],
21
- ['w3c_home_animation.gif', { mime: 'image/gif', width: 72, height: 48 }],
22
- ['w3c_home.gif', { mime: 'image/gif', width: 72, height: 48 }],
23
- ['w3c_home_gray.gif', { mime: 'image/gif', width: 72, height: 48 }],
24
- ['w3c_home_gray.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
25
- ['w3c_home_gray.png', { mime: 'image/png', width: 72, height: 48 }],
26
- ['w3c_home.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
27
- ['w3c_home.png', { mime: 'image/png', width: 72, height: 48 }],
28
- ['w3c_home_noexif.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
29
- ['spinfox.png', { mime: 'image/png', width: 148, height: 148 }],
30
- ['iphone_hdr_YES.jpg', { mime: 'image/jpeg', width: 3264, height: 2448 }],
31
- ['nikon-e950.jpg', { mime: 'image/jpeg', width: 800, height: 600 }],
32
- ['agfa-makernotes.jpg', { mime: 'image/jpeg', width: 8, height: 8 }],
33
- ['sony-alpha-6000.jpg', { mime: 'image/jpeg', width: 6000, height: 4000 }]
34
- ];
35
-
36
-
37
- describe('IIPMetrics', () => {
38
- it('bunch of testimages', () => {
39
- for (let i = 0; i < TEST_IMAGES.length; ++i) {
40
- const imageData = fs.readFileSync('./addons/addon-image/fixture/testimages/' + TEST_IMAGES[i][0]);
41
- assert.deepStrictEqual(imageType(imageData), TEST_IMAGES[i][1]);
42
- }
43
- });
44
- });