Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minitel-standalone

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minitel-standalone - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

dist/abstract/linked_list.d.ts

1

dist/components/input.d.ts

@@ -15,2 +15,3 @@ import { Focusable, FocusableAttributes } from '../abstract/focusable.js';

_scrollDelta: [number, number];
oldScrollDelta: [number, number];
lastFocusCursorX: number;

@@ -17,0 +18,0 @@ constructor(children: [], attributes: Partial<InputAttributes>, minitel: Minitel);

4

dist/components/input.js

@@ -17,2 +17,3 @@ "use strict";

this._scrollDelta = [0, 0];
this.oldScrollDelta = [0, 0];
this.lastFocusCursorX = 0;

@@ -166,3 +167,2 @@ this.on('key', this.keyEventListener);

}
const oldScrollDelta = [this.scrollDelta[0], this.scrollDelta[1]];
if (attributes.height != null) {

@@ -190,3 +190,3 @@ if (this.scrollDelta[0] > this.cursorActuallyAt[0]) {

}
if (oldScrollDelta[0] !== this.scrollDelta[0] || oldScrollDelta[1] !== this.scrollDelta[1]) {
if (this.oldScrollDelta[0] !== this.scrollDelta[0] || this.oldScrollDelta[1] !== this.scrollDelta[1]) {
attributes.onScroll([...this.scrollDelta]);

@@ -193,0 +193,0 @@ }

@@ -8,2 +8,3 @@ /// <reference types="node" />

import { Focusable } from '../abstract/focusable.js';
import { LinkedList } from '../abstract/linked_list.js';
export interface MinitelSettings {

@@ -25,2 +26,3 @@ statusBar: boolean;

lastImmediate: NodeJS.Immediate | null;
rxQueue: LinkedList;
constructor(stream: Duplex, settings: Partial<MinitelSettings>);

@@ -34,2 +36,4 @@ invalidateRender(): void;

renderToStream(): void;
queueCommand(command: string, expected: string | RegExp, callback?: ((_arg0: string) => any)): void;
queueCommandAsync(command: string, expected: string | RegExp): Promise<string>;
}

@@ -10,2 +10,3 @@ "use strict";

const invalidrender_js_1 = require("../abstract/invalidrender.js");
const linked_list_js_1 = require("../abstract/linked_list.js");
class Minitel extends container_js_1.Container {

@@ -23,6 +24,5 @@ constructor(stream, settings) {

this.previousRender = richchargrid_js_1.RichCharGrid.fill(40, 24 + +this.settings.statusBar, new richchar_js_1.RichChar(' '));
// TBD.
// this.rxQueue = new FifoQueue();
this.rxQueue = new linked_list_js_1.LinkedList();
// Take care of localEcho
this.stream.write([
this.queueCommand([
'\x1b\x3b',

@@ -32,5 +32,5 @@ this.settings.localEcho ? '\x61' : '\x60',

'\x52',
].join(''));
].join(''), '\x1b\x3b\x63');
// Take care of extendedMode
this.stream.write([
this.queueCommand([
'\x1b\x3b',

@@ -40,9 +40,9 @@ this.settings.extendedMode ? '\x69' : '\x6A',

'\x41',
].join(''));
].join(''), '\x1b\x3b\x73\x59');
// Set capitalization
this.stream.write([
this.queueCommand([
'\x1b\x3a',
this.settings.defaultCase === 'upper' ? '\x69' : '\x6A',
'\x45',
].join(''));
].join(''), '\x1b\x3a\x73');
this.stream.write('\x1f\x40\x41\x18\x0c'); // Clear status; clear screen

@@ -56,4 +56,32 @@ let acc = '';

acc += char;
howManyToExpect = Math.max(0, howManyToExpect + (inputConstants_js_1.expectNextChars[acc] || 0));
if (char === '\x04') {
howManyToExpect = 0;
}
else {
howManyToExpect = Math.max(0, howManyToExpect + (inputConstants_js_1.expectNextChars[acc] || 0));
}
if (howManyToExpect === 0) {
let prev = undefined;
let current = this.rxQueue.tail;
while (current) {
if (current.expected instanceof RegExp) {
if (current.expected.test(acc)) {
break;
}
}
else {
if (acc.startsWith(current.expected)) {
break;
}
}
prev = current;
current = current.next;
debugger;
}
if (current) {
this.rxQueue.removeNodeAfter(prev);
current.callback(acc);
acc = '';
continue;
}
this.emit('key', acc);

@@ -211,2 +239,10 @@ if (acc.match(/^([a-zA-Z0-9,\.';\-\:?!"#$%&\(\)\[\]<>@+=*/ ]|\x0d|\x13\x47|\x1b\x5b[\x41\x42\x43\x44])$/g)) {

}
queueCommand(command, expected, callback = ((_arg0) => { })) {
const newNode = new linked_list_js_1.LLNode(expected, callback);
this.rxQueue.append(newNode);
this.stream.write(command);
}
queueCommandAsync(command, expected) {
return new Promise((r) => this.queueCommand(command, expected, r));
}
}

@@ -213,0 +249,0 @@ exports.Minitel = Minitel;

@@ -6,2 +6,3 @@ "use strict";

'\x13': 1,
'\x01': Infinity,
'\x1b': 1,

@@ -8,0 +9,0 @@ '\x1b\x39': 1,

@@ -9,1 +9,2 @@ import { Align, FullPadding, MinitelObjectAttributes, Padding } from './types.js';

};
export declare function toBitArray(char: string): number[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.padding = exports.inheritedProps = exports.alignInvrt = void 0;
exports.toBitArray = exports.padding = exports.inheritedProps = exports.alignInvrt = void 0;
exports.alignInvrt = {

@@ -44,1 +44,6 @@ start: 'end',

};
function toBitArray(char) {
const int = char.charCodeAt(0).toString(2);
return int.padStart(8, '0').split('').map((v) => parseInt(v));
}
exports.toBitArray = toBitArray;
{
"name": "minitel-standalone",
"version": "1.6.0",
"version": "1.7.0",
"description": "A standalone package for minitel components",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -31,2 +31,3 @@ import { Focusable, FocusableAttributes } from '../abstract/focusable.js';

_scrollDelta = [0, 0] as [number, number];
oldScrollDelta = [0, 0] as [number, number];
lastFocusCursorX = 0;

@@ -199,3 +200,2 @@ constructor(

}
const oldScrollDelta = [this.scrollDelta[0], this.scrollDelta[1]];
if (attributes.height != null) {

@@ -225,3 +225,3 @@ if (this.scrollDelta[0] > this.cursorActuallyAt[0]) {

}
if (oldScrollDelta[0] !== this.scrollDelta[0] || oldScrollDelta[1] !== this.scrollDelta[1]) {
if (this.oldScrollDelta[0] !== this.scrollDelta[0] || this.oldScrollDelta[1] !== this.scrollDelta[1]) {
attributes.onScroll([...this.scrollDelta]);

@@ -228,0 +228,0 @@ }

@@ -13,2 +13,3 @@ import { Duplex } from 'stream';

import { InvalidRender } from '../abstract/invalidrender.js';
import { LLNode, LinkedList } from '../abstract/linked_list.js';

@@ -39,2 +40,3 @@ export interface MinitelSettings {

lastImmediate: NodeJS.Immediate | null = null;
rxQueue: LinkedList;
constructor(stream: Duplex, settings: Partial<MinitelSettings>) {

@@ -54,7 +56,7 @@ const that = null as unknown as Minitel;

this.previousRender = RichCharGrid.fill(40, 24 + +this.settings.statusBar, new RichChar(' '));
// TBD.
// this.rxQueue = new FifoQueue();
this.rxQueue = new LinkedList();
// Take care of localEcho
this.stream.write([
this.queueCommand([
'\x1b\x3b',

@@ -64,6 +66,6 @@ this.settings.localEcho ? '\x61' : '\x60',

'\x52',
].join(''));
].join(''), '\x1b\x3b\x63');
// Take care of extendedMode
this.stream.write([
this.queueCommand([
'\x1b\x3b',

@@ -73,10 +75,10 @@ this.settings.extendedMode ? '\x69' : '\x6A',

'\x41',
].join(''));
].join(''), '\x1b\x3b\x73\x59');
// Set capitalization
this.stream.write([
this.queueCommand([
'\x1b\x3a',
this.settings.defaultCase === 'upper' ? '\x69' : '\x6A',
'\x45',
].join(''));
].join(''), '\x1b\x3a\x73');

@@ -92,4 +94,31 @@ this.stream.write('\x1f\x40\x41\x18\x0c'); // Clear status; clear screen

acc += char;
howManyToExpect = Math.max(0, howManyToExpect + (expectNextChars[acc] || 0));
if (char === '\x04') {
howManyToExpect = 0;
} else {
howManyToExpect = Math.max(0, howManyToExpect + (expectNextChars[acc] || 0));
}
if (howManyToExpect === 0) {
let prev: LLNode | undefined = undefined;
let current = this.rxQueue.tail;
while (current) {
if (current.expected instanceof RegExp) {
if (current.expected.test(acc)) {
break;
}
} else {
if (acc.startsWith(current.expected)) {
break;
}
}
prev = current;
current = current.next;
debugger;
}
if (current) {
this.rxQueue.removeNodeAfter(prev);
current.callback(acc);
acc = '';
continue;
}
this.emit('key', acc);

@@ -273,2 +302,12 @@ if (acc.match(/^([a-zA-Z0-9,\.';\-\:?!"#$%&\(\)\[\]<>@+=*/ ]|\x0d|\x13\x47|\x1b\x5b[\x41\x42\x43\x44])$/g)) {

}
queueCommand(command: string, expected: string | RegExp, callback: ((_arg0: string) => any) = ((_arg0: string) => {})) {
const newNode = new LLNode(expected, callback);
this.rxQueue.append(newNode);
this.stream.write(command);
}
queueCommandAsync(command: string, expected: string | RegExp) {
return new Promise<string>((r) => this.queueCommand(command, expected, r));
}
// useKeyboard(callback: (key: string) => void) {

@@ -275,0 +314,0 @@ // React.useEffect(() => {

export const expectNextChars: Record<string, number> = {
'\x13': 1,
'\x01': Infinity,
'\x1b': 1,

@@ -4,0 +5,0 @@ '\x1b\x39': 1,

@@ -42,1 +42,7 @@ import { Align, FullPadding, MinitelObjectAttributes, Padding } from './types.js';

};
export function toBitArray(char: string): number[] {
const int = char.charCodeAt(0).toString(2);
return int.padStart(8, '0').split('').map((v) => parseInt(v));
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc