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

minitel-standalone

Package Overview
Dependencies
Maintainers
0
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.9.4 to 1.9.5

3

dist/abstract/focusable.js

@@ -1,2 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};

@@ -1,7 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidRender = void 0;
class InvalidRender extends Error {
export class InvalidRender extends Error {
}
exports.InvalidRender = InvalidRender;
;

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LLNode = exports.LinkedList = void 0;
class LinkedList {
export class LinkedList {
constructor() { }

@@ -41,4 +38,3 @@ isEmpty() {

}
exports.LinkedList = LinkedList;
class LLNode {
export class LLNode {
constructor(expected, callback) {

@@ -52,2 +48,1 @@ this.expected = expected;

}
exports.LLNode = LLNode;

@@ -1,2 +0,2 @@

/// <reference types="node" />
/// <reference types="node" resolution-mode="require"/>
import { EventEmitter } from 'node:events';

@@ -3,0 +3,0 @@ import type { Minitel } from '../components/minitel.js';

@@ -1,11 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MinitelObject = void 0;
const node_events_1 = require("node:events");
const richchar_js_1 = require("../richchar.js");
const richchargrid_js_1 = require("../richchargrid.js");
const utils_js_1 = require("../utils.js");
const locationdescriptor_js_1 = require("../locationdescriptor.js");
const invalidrender_js_1 = require("./invalidrender.js");
class MinitelObject extends node_events_1.EventEmitter {
import { EventEmitter } from 'node:events';
import { RichChar } from '../richchar.js';
import { RichCharGrid } from '../richchargrid.js';
import { inheritedProps, padding } from '../utils.js';
import { LocationDescriptor } from '../locationdescriptor.js';
import { InvalidRender } from './invalidrender.js';
export class MinitelObject extends EventEmitter {
getDimensions(attributes, inheritMe) {

@@ -17,8 +14,8 @@ const tempRender = this.render(attributes, inheritMe);

const attributes = Object.assign(Object.assign(Object.assign(Object.assign({}, this.defaultAttributes), inheritedAttributes), this.attributes), forcedAttributes);
const pad = utils_js_1.padding.normalise(attributes.pad);
attributes.width = attributes.width != null ? utils_js_1.padding.exludeX(attributes.width, pad) : null;
attributes.height = attributes.height != null ? utils_js_1.padding.exludeY(attributes.height, pad) : null;
const pad = padding.normalise(attributes.pad);
attributes.width = attributes.width != null ? padding.exludeX(attributes.width, pad) : null;
attributes.height = attributes.height != null ? padding.exludeY(attributes.height, pad) : null;
let result = { width: -1, height: -1 };
if (!attributes.height || !attributes.width) {
result = this.getDimensions(attributes, (0, utils_js_1.inheritedProps)(Object.assign(Object.assign(Object.assign({}, inheritedAttributes), this.attributes), forcedAttributes)));
result = this.getDimensions(attributes, inheritedProps(Object.assign(Object.assign(Object.assign({}, inheritedAttributes), this.attributes), forcedAttributes)));
}

@@ -71,12 +68,12 @@ if (attributes.width)

const attributes = Object.assign(Object.assign(Object.assign(Object.assign({}, this.defaultAttributes), inheritedAttributes), this.attributes), forcedAttributes);
const pad = utils_js_1.padding.normalise(attributes.pad);
attributes.width = attributes.width != null ? utils_js_1.padding.exludeX(attributes.width, pad) : null;
attributes.height = attributes.height != null ? utils_js_1.padding.exludeY(attributes.height, pad) : null;
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
let result = this.render(attributes, (0, utils_js_1.inheritedProps)(Object.assign(Object.assign(Object.assign({}, inheritedAttributes), this.attributes), forcedAttributes)));
const pad = padding.normalise(attributes.pad);
attributes.width = attributes.width != null ? padding.exludeX(attributes.width, pad) : null;
attributes.height = attributes.height != null ? padding.exludeY(attributes.height, pad) : null;
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
let result = this.render(attributes, inheritedProps(Object.assign(Object.assign(Object.assign({}, inheritedAttributes), this.attributes), forcedAttributes)));
if (this.minitel.renderInvalidated) {
throw new invalidrender_js_1.InvalidRender();
throw new InvalidRender();
}
if (!attributes.visible) {
result = richchargrid_js_1.RichCharGrid.fill(attributes.width || 0, attributes.height || 0, fillChar);
result = RichCharGrid.fill(attributes.width || 0, attributes.height || 0, fillChar);
}

@@ -89,3 +86,3 @@ if (attributes.width != null)

if (this.keepElmDesc)
result.locationDescriptors.add(this, new locationdescriptor_js_1.LocationDescriptor(0, 0, result.width, result.height));
result.locationDescriptors.add(this, new LocationDescriptor(0, 0, result.width, result.height));
result.pad(pad, fillChar);

@@ -113,3 +110,2 @@ return result;

}
exports.MinitelObject = MinitelObject;
MinitelObject.defaultAttributes = {

@@ -116,0 +112,0 @@ width: null,

@@ -1,12 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextNode = void 0;
const minitelobject_js_1 = require("./minitelobject.js");
const richchargrid_js_1 = require("../richchargrid.js");
const word_wrap_1 = __importDefault(require("word-wrap"));
const richchar_js_1 = require("../richchar.js");
class TextNode extends minitelobject_js_1.MinitelObject {
import { MinitelObject } from './minitelobject.js';
import { RichCharGrid } from '../richchargrid.js';
import wrap from 'word-wrap';
import { RichChar } from '../richchar.js';
export class TextNode extends MinitelObject {
constructor(text, attributes, minitel) {

@@ -25,6 +19,6 @@ super([], attributes, minitel);

case 'word-break':
text = (0, word_wrap_1.default)(text, { indent: '', width: actualWidth, cut: true });
text = wrap(text, { indent: '', width: actualWidth, cut: true });
break;
case 'word-wrap':
text = (0, word_wrap_1.default)(text, { indent: '', width: actualWidth });
text = wrap(text, { indent: '', width: actualWidth });
break;

@@ -48,6 +42,6 @@ case 'clip':

case 'word-break':
text = (0, word_wrap_1.default)(text, { indent: '', width: actualWidth, cut: true });
text = wrap(text, { indent: '', width: actualWidth, cut: true });
break;
case 'word-wrap':
text = (0, word_wrap_1.default)(text, { indent: '', width: actualWidth });
text = wrap(text, { indent: '', width: actualWidth });
break;

@@ -59,8 +53,8 @@ case 'clip':

}
const result = new richchargrid_js_1.RichCharGrid();
const result = new RichCharGrid();
const lines = text.split(/\r?\n/g);
const concreteWidth = Math.max(...lines.map((v) => v.length * xScalingFactor));
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
for (let line of lines) {
result.mergeY(richchargrid_js_1.RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, attributes.textAlign, fillChar));
result.mergeY(RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, attributes.textAlign, fillChar));
}

@@ -78,6 +72,6 @@ return result;

case 'word-break':
text = (0, word_wrap_1.default)(text, { indent: '', width: actualWidth, cut: true });
text = wrap(text, { indent: '', width: actualWidth, cut: true });
break;
case 'word-wrap':
text = (0, word_wrap_1.default)(text, { indent: '', width: actualWidth });
text = wrap(text, { indent: '', width: actualWidth });
break;

@@ -93,3 +87,3 @@ case 'clip':

for (let line of lines) {
result.push(richchargrid_js_1.RichCharGrid.fromLine(line, attributes));
result.push(RichCharGrid.fromLine(line, attributes));
}

@@ -99,2 +93,1 @@ return result;

}
exports.TextNode = TextNode;

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Container = void 0;
const minitelobject_js_1 = require("../abstract/minitelobject.js");
const richchar_js_1 = require("../richchar.js");
const singleton_js_1 = require("../singleton.js");
const utils_js_1 = require("../utils.js");
class Container extends minitelobject_js_1.MinitelObject {
import { MinitelObject } from '../abstract/minitelobject.js';
import { RichChar } from '../richchar.js';
import { SingletonArray } from '../singleton.js';
import { alignInvrt } from '../utils.js';
export class Container extends MinitelObject {
constructor(children = [], attributes, minitel) {

@@ -14,3 +11,3 @@ if (children.length > 1)

this.defaultAttributes = Container.defaultAttributes;
this.children = new singleton_js_1.SingletonArray();
this.children = new SingletonArray();
if (children[0])

@@ -23,8 +20,8 @@ this.appendChild(children[0]);

render(attributes, inheritMe) {
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
const render = this.children[0].renderWrapper(inheritMe, Object.assign(Object.assign({}, (attributes.width != null ? { width: attributes.width } : {})), (attributes.height != null ? { height: attributes.height } : {})));
if (attributes.height)
render.setHeight(attributes.height, utils_js_1.alignInvrt[attributes.heightAlign], fillChar);
render.setHeight(attributes.height, alignInvrt[attributes.heightAlign], fillChar);
if (attributes.width)
render.setWidth(attributes.width, utils_js_1.alignInvrt[attributes.widthAlign], fillChar);
render.setWidth(attributes.width, alignInvrt[attributes.widthAlign], fillChar);
// console.log({ width: attributes.width, height: attributes.height, render: render.toString() })

@@ -34,3 +31,2 @@ return render;

}
exports.Container = Container;
Container.defaultAttributes = Object.assign(Object.assign({}, minitelobject_js_1.MinitelObject.defaultAttributes), { widthAlign: 'start', heightAlign: 'start' });
Container.defaultAttributes = Object.assign(Object.assign({}, MinitelObject.defaultAttributes), { widthAlign: 'start', heightAlign: 'start' });

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Input = void 0;
const minitelobject_js_1 = require("../abstract/minitelobject.js");
const richchar_js_1 = require("../richchar.js");
const richchargrid_js_1 = require("../richchargrid.js");
const utils_js_1 = require("../utils.js");
class Input extends minitelobject_js_1.MinitelObject {
import { MinitelObject } from '../abstract/minitelobject.js';
import { RichChar } from '../richchar.js';
import { RichCharGrid } from '../richchargrid.js';
import { alignInvrt } from '../utils.js';
export class Input extends MinitelObject {
constructor(children, attributes, minitel) {

@@ -164,3 +161,3 @@ super(children, attributes, minitel);

render(attributes, inheritMe) {
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
// TODO: fix types

@@ -171,6 +168,6 @@ const lines = {

}[attributes.type];
const result = new richchargrid_js_1.RichCharGrid([]);
const result = new RichCharGrid([]);
const concreteWidth = Math.max(...lines.map((v) => v.length));
for (let line of lines) {
result.mergeY(richchargrid_js_1.RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, utils_js_1.alignInvrt[attributes.textAlign], fillChar));
result.mergeY(RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, alignInvrt[attributes.textAlign], fillChar));
}

@@ -212,3 +209,2 @@ if (attributes.height != null) {

}
exports.Input = Input;
Input.defaultAttributes = Object.assign(Object.assign({}, minitelobject_js_1.MinitelObject.defaultAttributes), { fillChar: '.', width: 8, height: 1, type: 'text', autofocus: false, disabled: false, multiline: false, onChange: () => { }, onScroll: () => { } });
Input.defaultAttributes = Object.assign(Object.assign({}, MinitelObject.defaultAttributes), { fillChar: '.', width: 8, height: 1, type: 'text', autofocus: false, disabled: false, multiline: false, onChange: () => { }, onScroll: () => { } });

@@ -1,3 +0,3 @@

/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { Duplex } from 'stream';

@@ -4,0 +4,0 @@ import { Container, ContainerAttributes } from './container.js';

@@ -1,2 +0,1 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -11,12 +10,10 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Minitel = void 0;
const container_js_1 = require("./container.js");
const richchargrid_js_1 = require("../richchargrid.js");
const singleton_js_1 = require("../singleton.js");
const richchar_js_1 = require("../richchar.js");
const inputConstants_js_1 = require("../inputConstants.js");
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 {
import { Container } from './container.js';
import { RichCharGrid } from '../richchargrid.js';
import { SingletonArray } from '../singleton.js';
import { RichChar } from '../richchar.js';
import { expectNextChars } from '../inputConstants.js';
import { InvalidRender } from '../abstract/invalidrender.js';
import { LLNode, LinkedList } from '../abstract/linked_list.js';
export class Minitel extends Container {
constructor(stream, settings) {

@@ -30,7 +27,7 @@ const that = null;

this.minitel = this;
this.children = new singleton_js_1.SingletonArray();
this.children = new SingletonArray();
this.settings = Object.assign({ statusBar: false, localEcho: false, extendedMode: true, defaultCase: 'upper' }, settings);
this.stream = stream;
this.previousRender = richchargrid_js_1.RichCharGrid.fill(40, 24 + +this.settings.statusBar, new richchar_js_1.RichChar(' '));
this.rxQueue = new linked_list_js_1.LinkedList();
this.previousRender = RichCharGrid.fill(40, 24 + +this.settings.statusBar, new RichChar(' '));
this.rxQueue = new LinkedList();
// Take care of localEcho

@@ -76,3 +73,3 @@ this.queueCommand([

else {
howManyToExpect = Math.max(0, howManyToExpect + (inputConstants_js_1.expectNextChars[acc] || 0));
howManyToExpect = Math.max(0, howManyToExpect + (expectNextChars[acc] || 0));
}

@@ -143,3 +140,3 @@ if (howManyToExpect === 0) {

catch (err) {
if (err instanceof invalidrender_js_1.InvalidRender) {
if (err instanceof InvalidRender) {
return this.renderString();

@@ -151,4 +148,4 @@ }

}
renderGrid.setHeight(height, 'start', new richchar_js_1.RichChar(' '));
renderGrid.setWidth(width, 'start', new richchar_js_1.RichChar(' '));
renderGrid.setHeight(height, 'start', new RichChar(' '));
renderGrid.setWidth(width, 'start', new RichChar(' '));
this.handleFocus();

@@ -173,3 +170,3 @@ const outputString = ['\x14\x1e'];

skippedACharCounter += 1;
lastAttributes = Object.assign({ fg: 7, bg: 0, doubleWidth: false, doubleHeight: false, noBlink: true, invert: false }, richchar_js_1.RichChar.getDelimited(prevChar.attributes, lastAttributes.charset));
lastAttributes = Object.assign({ fg: 7, bg: 0, doubleWidth: false, doubleHeight: false, noBlink: true, invert: false }, RichChar.getDelimited(prevChar.attributes, lastAttributes.charset));
}

@@ -183,3 +180,3 @@ else {

const diff = char.attributesDiff(lastAttributes);
const applier = richchar_js_1.RichChar.getAttributesApplier(diff, lastAttributes);
const applier = RichChar.getAttributesApplier(diff, lastAttributes);
outputString.push(applier);

@@ -196,3 +193,3 @@ lastAttributes = char.attributes;

outputString.push('\x1f\x41\x41');
lastAttributes = Object.assign(Object.assign({}, lastAttributes), richchar_js_1.RichChar.getDelimited(Minitel.defaultScreenAttributes, lastAttributes.charset));
lastAttributes = Object.assign(Object.assign({}, lastAttributes), RichChar.getDelimited(Minitel.defaultScreenAttributes, lastAttributes.charset));
}

@@ -268,3 +265,3 @@ this.previousRender = renderGrid.copy();

queueCommand(command, expected, callback = ((_arg0) => { })) {
const newNode = new linked_list_js_1.LLNode(expected, callback);
const newNode = new LLNode(expected, callback);
this.rxQueue.append(newNode);

@@ -301,3 +298,2 @@ this.stream.write(command);

}
exports.Minitel = Minitel;
Minitel.defaultScreenAttributes = {

@@ -304,0 +300,0 @@ fg: 7,

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Paragraph = void 0;
const minitelobject_js_1 = require("../abstract/minitelobject.js");
const richchar_js_1 = require("../richchar.js");
const richchargrid_js_1 = require("../richchargrid.js");
const utils_js_1 = require("../utils.js");
class Paragraph extends minitelobject_js_1.MinitelObject {
import { MinitelObject } from '../abstract/minitelobject.js';
import { RichChar } from '../richchar.js';
import { RichCharGrid } from '../richchargrid.js';
import { alignInvrt } from '../utils.js';
export class Paragraph extends MinitelObject {
constructor(children, attributes, minitel) {

@@ -17,3 +14,3 @@ super([], attributes, minitel);

getDimensions(attributes, inheritMe) {
const lines = [new richchargrid_js_1.RichCharGrid([[]])]; // Again, if someone smarter than me can figure out an elegant way, suit urself
const lines = [new RichCharGrid([[]])]; // Again, if someone smarter than me can figure out an elegant way, suit urself
for (let child of this.children) {

@@ -27,3 +24,3 @@ const render = child.renderLines(inheritMe, {

if (+lineIdx !== 0) {
lines[newMaxIdx + +lineIdx] = new richchargrid_js_1.RichCharGrid([[]]);
lines[newMaxIdx + +lineIdx] = new RichCharGrid([[]]);
}

@@ -37,4 +34,4 @@ lines[newMaxIdx + +lineIdx].mergeX(render[+lineIdx], 'end');

render(attributes, inheritMe) {
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
const lines = [new richchargrid_js_1.RichCharGrid([[]])];
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
const lines = [new RichCharGrid([[]])];
for (let child of this.children) {

@@ -48,3 +45,3 @@ const render = child.renderLines(inheritMe, {

if (+lineIdx !== 0) {
lines[newMaxIdx + +lineIdx] = new richchargrid_js_1.RichCharGrid([[]]);
lines[newMaxIdx + +lineIdx] = new RichCharGrid([[]]);
}

@@ -55,5 +52,5 @@ lines[newMaxIdx + +lineIdx].mergeX(render[+lineIdx], 'end');

const width = attributes.width || Math.max(...lines.map((v) => v.width));
const result = new richchargrid_js_1.RichCharGrid([]);
const result = new RichCharGrid([]);
for (let line of lines) {
line.setWidth(width, utils_js_1.alignInvrt[attributes.textAlign], fillChar);
line.setWidth(width, alignInvrt[attributes.textAlign], fillChar);
result.mergeY(line);

@@ -67,2 +64,1 @@ }

}
exports.Paragraph = Paragraph;

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Scrollable = void 0;
const richchar_js_1 = require("../richchar.js");
const richchargrid_js_1 = require("../richchargrid.js");
const container_js_1 = require("./container.js");
class Scrollable extends container_js_1.Container {
import { RichChar } from '../richchar.js';
import { RichCharGrid } from '../richchargrid.js';
import { Container } from './container.js';
export class Scrollable extends Container {
blink() {

@@ -142,3 +139,3 @@ if (this.artificialBlink)

// this code it's such a mess
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes);
const fillChar = new RichChar(attributes.fillChar, attributes);
let renderAttributes = attributes;

@@ -199,4 +196,4 @@ let autoedX = false;

}
const scrollChar = new richchar_js_1.RichChar('\x7f', Object.assign(Object.assign({}, attributes), { fg: this.blinkShown ? attributes.scrollbarColor : attributes.scrollbarBackColor }));
const scrollBackChar = new richchar_js_1.RichChar('\x7f', Object.assign(Object.assign({}, attributes), { fg: attributes.scrollbarBackColor }));
const scrollChar = new RichChar('\x7f', Object.assign(Object.assign({}, attributes), { fg: this.blinkShown ? attributes.scrollbarColor : attributes.scrollbarBackColor }));
const scrollBackChar = new RichChar('\x7f', Object.assign(Object.assign({}, attributes), { fg: attributes.scrollbarBackColor }));
if (attributes.overflowY !== 'hidden' && attributes.overflowY !== 'noscrollbar' && !autoedY && attributes.height != null) {

@@ -207,6 +204,6 @@ const percentageScrolled = this.scrollDelta[0] / (originalHeight - maxScrollSizeY);

if (originalHeight - maxScrollSizeY === 0 && attributes.overflowY === 'pad') {
rightScrollbar = richchargrid_js_1.RichCharGrid.fill(1, finalRender.height, fillChar);
rightScrollbar = RichCharGrid.fill(1, finalRender.height, fillChar);
}
else {
rightScrollbar = richchargrid_js_1.RichCharGrid.fill(1, scrollbarSizeY, scrollChar);
rightScrollbar = RichCharGrid.fill(1, scrollbarSizeY, scrollChar);
rightScrollbar.setHeight(scrollbarSizeY + scrollbarOffset, 'start', scrollBackChar);

@@ -222,6 +219,6 @@ rightScrollbar.setHeight(finalRender.height, 'end', scrollBackChar);

if (originalWidth - maxScrollSizeX === 0 && attributes.overflowX === 'pad') {
bottomScrollbar = richchargrid_js_1.RichCharGrid.fill(finalRender.width, 1, fillChar);
bottomScrollbar = RichCharGrid.fill(finalRender.width, 1, fillChar);
}
else {
bottomScrollbar = richchargrid_js_1.RichCharGrid.fill(scrollbarSizeX, 1, scrollChar);
bottomScrollbar = RichCharGrid.fill(scrollbarSizeX, 1, scrollChar);
bottomScrollbar.setWidth(scrollbarSizeX + scrollbarOffset, 'start', scrollBackChar);

@@ -240,3 +237,2 @@ bottomScrollbar.setWidth(finalRender.height, 'end', scrollBackChar);

}
exports.Scrollable = Scrollable;
Scrollable.defaultAttributes = Object.assign(Object.assign({}, container_js_1.Container.defaultAttributes), { overflowX: 'hidden', overflowY: 'auto', autofocus: false, disabled: false, scrollbarBackColor: 5, scrollbarColor: 7, blinkPeriod: 500, onScroll: () => { } });
Scrollable.defaultAttributes = Object.assign(Object.assign({}, Container.defaultAttributes), { overflowX: 'hidden', overflowY: 'auto', autofocus: false, disabled: false, scrollbarBackColor: 5, scrollbarColor: 7, blinkPeriod: 500, onScroll: () => { } });

@@ -1,6 +0,6 @@

import { MinitelObject } from "../abstract/minitelobject";
import { TextNode } from "../abstract/textnode";
import { RichCharGrid } from "../richchargrid";
import { MinitelObjectAttributes, RenderLinesAttributes } from "../types";
import { Minitel } from "./minitel";
import { MinitelObject } from "../abstract/minitelobject.js";
import { TextNode } from "../abstract/textnode.js";
import { RichCharGrid } from "../richchargrid.js";
import { MinitelObjectAttributes, RenderLinesAttributes } from "../types.js";
import { Minitel } from "./minitel.js";
export declare class Span extends MinitelObject {

@@ -7,0 +7,0 @@ children: (TextNode | Span)[];

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Span = void 0;
const minitelobject_1 = require("../abstract/minitelobject");
const richchar_1 = require("../richchar");
const richchargrid_1 = require("../richchargrid");
const utils_1 = require("../utils");
class Span extends minitelobject_1.MinitelObject {
import { MinitelObject } from "../abstract/minitelobject.js";
import { RichChar } from "../richchar.js";
import { RichCharGrid } from "../richchargrid.js";
import { alignInvrt, inheritedProps } from "../utils.js";
export class Span extends MinitelObject {
constructor(children, attributes, minitel) {

@@ -17,3 +14,3 @@ super([], attributes, minitel);

getDimensions(attributes, inheritMe) {
const lines = [new richchargrid_1.RichCharGrid([[]])];
const lines = [new RichCharGrid([[]])];
for (let child of this.children) {

@@ -27,3 +24,3 @@ const render = child.renderLines(inheritMe, {

if (+lineIdx !== 0) {
lines[newMaxIdx + +lineIdx] = new richchargrid_1.RichCharGrid([[]]);
lines[newMaxIdx + +lineIdx] = new RichCharGrid([[]]);
}

@@ -37,4 +34,4 @@ lines[newMaxIdx + +lineIdx].mergeX(render[+lineIdx], 'end');

render(attributes, inheritMe) {
const fillChar = new richchar_1.RichChar(attributes.fillChar, attributes).noSize();
const lines = [new richchargrid_1.RichCharGrid([[]])];
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
const lines = [new RichCharGrid([[]])];
for (let child of this.children) {

@@ -48,3 +45,3 @@ const render = child.renderLines(inheritMe, {

if (+lineIdx !== 0) {
lines[newMaxIdx + +lineIdx] = new richchargrid_1.RichCharGrid([[]]);
lines[newMaxIdx + +lineIdx] = new RichCharGrid([[]]);
}

@@ -55,5 +52,5 @@ lines[newMaxIdx + +lineIdx].mergeX(render[+lineIdx], 'end');

const width = attributes.width || Math.max(...lines.map((v) => v.width));
const result = new richchargrid_1.RichCharGrid([]);
const result = new RichCharGrid([]);
for (let line of lines) {
line.setWidth(width, utils_1.alignInvrt[attributes.textAlign], fillChar);
line.setWidth(width, alignInvrt[attributes.textAlign], fillChar);
result.mergeY(line);

@@ -68,5 +65,5 @@ }

const attributes = Object.assign(Object.assign(Object.assign(Object.assign({}, this.defaultAttributes), inheritedAttributes), this.attributes), forcedAttributes);
const inheritMe = (0, utils_1.inheritedProps)(Object.assign(Object.assign(Object.assign({}, inheritedAttributes), this.attributes), forcedAttributes));
const inheritMe = inheritedProps(Object.assign(Object.assign(Object.assign({}, inheritedAttributes), this.attributes), forcedAttributes));
// const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
const lines = [new richchargrid_1.RichCharGrid([[]])];
const lines = [new RichCharGrid([[]])];
let isFirstChild = true;

@@ -81,3 +78,3 @@ for (let child of this.children) {

if (+lineIdx !== 0) {
lines[newMaxIdx + +lineIdx] = new richchargrid_1.RichCharGrid([[]]);
lines[newMaxIdx + +lineIdx] = new RichCharGrid([[]]);
}

@@ -91,2 +88,1 @@ lines[newMaxIdx + +lineIdx].mergeX(render[+lineIdx], 'end');

}
exports.Span = Span;

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XJoin = void 0;
const minitelobject_js_1 = require("../abstract/minitelobject.js");
const richchar_js_1 = require("../richchar.js");
const richchargrid_js_1 = require("../richchargrid.js");
const utils_js_1 = require("../utils.js");
class XJoin extends minitelobject_js_1.MinitelObject {
import { MinitelObject } from '../abstract/minitelobject.js';
import { RichChar } from '../richchar.js';
import { RichCharGrid } from '../richchargrid.js';
import { alignInvrt } from '../utils.js';
export class XJoin extends MinitelObject {
constructor(children, attributes, minitel) {

@@ -52,3 +49,3 @@ super(children, attributes, minitel);

render(attributes, inheritMe) {
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
const heightIfStretch = attributes.height || this.children.reduce((p, c) => {

@@ -83,3 +80,3 @@ const h = c.getDimensionsWrapper(inheritMe).height;

const renders = rendersNoFlexGrow.map((v, i) => v != null ? v : rendersYesFlexGrow[i]);
const result = new richchargrid_js_1.RichCharGrid();
const result = new RichCharGrid();
const height = attributes.heightAlign === 'stretch'

@@ -89,3 +86,3 @@ ? heightIfStretch

if (renders.length === 0)
return richchargrid_js_1.RichCharGrid.fill(attributes.width || 0, attributes.height || 0, fillChar);
return RichCharGrid.fill(attributes.width || 0, attributes.height || 0, fillChar);
const contentsWidth = renders.reduce((c, v) => c + v.width, 0);

@@ -113,3 +110,3 @@ // space-between: w / (n - 1)

if (render !== renders[0]) {
const gapConstituent = new richchargrid_js_1.RichCharGrid([]);
const gapConstituent = new RichCharGrid([]);
const lastCumul = gapCumul;

@@ -122,11 +119,10 @@ gapCumul += gapWidth;

if (attributes.heightAlign !== 'stretch')
render.setHeight(height, utils_js_1.alignInvrt[attributes.heightAlign], fillChar);
render.setHeight(height, alignInvrt[attributes.heightAlign], fillChar);
result.mergeX(render);
}
if (attributes.width != null)
result.setWidth(attributes.width, utils_js_1.alignInvrt[attributes.widthAlign], fillChar);
result.setWidth(attributes.width, alignInvrt[attributes.widthAlign], fillChar);
return result;
}
}
exports.XJoin = XJoin;
XJoin.defaultAttributes = Object.assign(Object.assign({}, minitelobject_js_1.MinitelObject.defaultAttributes), { gap: 0, widthAlign: 'start', heightAlign: 'stretch' });
XJoin.defaultAttributes = Object.assign(Object.assign({}, MinitelObject.defaultAttributes), { gap: 0, widthAlign: 'start', heightAlign: 'stretch' });

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.YJoin = void 0;
const minitelobject_js_1 = require("../abstract/minitelobject.js");
const richchar_js_1 = require("../richchar.js");
const richchargrid_js_1 = require("../richchargrid.js");
const utils_js_1 = require("../utils.js");
class YJoin extends minitelobject_js_1.MinitelObject {
import { MinitelObject } from '../abstract/minitelobject.js';
import { RichChar } from '../richchar.js';
import { RichCharGrid } from '../richchargrid.js';
import { alignInvrt } from '../utils.js';
export class YJoin extends MinitelObject {
constructor(children, attributes, minitel) {

@@ -52,3 +49,3 @@ super(children, attributes, minitel);

render(attributes, inheritMe) {
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
const widthIfStretch = attributes.width || this.children.reduce((p, c) => {

@@ -83,3 +80,3 @@ const w = c.getDimensionsWrapper(inheritMe).width;

const renders = rendersNoFlexGrow.map((v, i) => v != null ? v : rendersYesFlexGrow[i]);
const result = new richchargrid_js_1.RichCharGrid();
const result = new RichCharGrid();
const width = attributes.widthAlign === 'stretch'

@@ -89,3 +86,3 @@ ? widthIfStretch

if (renders.length === 0)
return richchargrid_js_1.RichCharGrid.fill(attributes.width || 0, attributes.height || 0, fillChar);
return RichCharGrid.fill(attributes.width || 0, attributes.height || 0, fillChar);
const contentsHeight = renders.reduce((c, v) => c + v.height, 0);

@@ -113,3 +110,3 @@ // space-between: w / (n - 1)

if (render !== renders[0]) {
const gapConstituent = new richchargrid_js_1.RichCharGrid([[]]);
const gapConstituent = new RichCharGrid([[]]);
const lastCumul = gapCumul;

@@ -122,11 +119,10 @@ gapCumul += gapHeight;

if (attributes.widthAlign !== 'stretch')
render.setWidth(width, utils_js_1.alignInvrt[attributes.widthAlign], fillChar);
render.setWidth(width, alignInvrt[attributes.widthAlign], fillChar);
result.mergeY(render);
}
if (attributes.height != null)
result.setHeight(attributes.height, utils_js_1.alignInvrt[attributes.heightAlign], fillChar);
result.setHeight(attributes.height, alignInvrt[attributes.heightAlign], fillChar);
return result;
}
}
exports.YJoin = YJoin;
YJoin.defaultAttributes = Object.assign(Object.assign({}, minitelobject_js_1.MinitelObject.defaultAttributes), { gap: 0, widthAlign: 'stretch', heightAlign: 'start' });
YJoin.defaultAttributes = Object.assign(Object.assign({}, MinitelObject.defaultAttributes), { gap: 0, widthAlign: 'stretch', heightAlign: 'start' });

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZJoin = void 0;
const minitelobject_js_1 = require("../abstract/minitelobject.js");
const richchar_js_1 = require("../richchar.js");
const richchargrid_js_1 = require("../richchargrid.js");
class ZJoin extends minitelobject_js_1.MinitelObject {
import { MinitelObject } from '../abstract/minitelobject.js';
import { RichChar } from '../richchar.js';
import { RichCharGrid } from '../richchargrid.js';
export class ZJoin extends MinitelObject {
constructor(children, attributes, minitel) {

@@ -19,10 +16,10 @@ super(children, attributes, minitel);

render(attributes, inheritMe) {
const fillChar = new richchar_js_1.RichChar(attributes.fillChar, attributes).noSize();
const transparentFillChar = new richchar_js_1.RichChar('\x09', attributes).noSize();
const fillChar = new RichChar(attributes.fillChar, attributes).noSize();
const transparentFillChar = new RichChar('\x09', attributes).noSize();
if (this.children.length === 0)
return new richchargrid_js_1.RichCharGrid();
return new RichCharGrid();
const renders = this.children.map((v) => v.renderWrapper(inheritMe, Object.assign({ width: attributes.width, height: attributes.height }, (attributes.inheritTransparency ? { fillChar: '\x09' } : {}))));
const maxWidth = Math.max(...renders.map((v) => v.width));
const maxHeight = Math.max(...renders.map((v) => v.height));
const result = richchargrid_js_1.RichCharGrid.fill(maxWidth, maxHeight, fillChar);
const result = RichCharGrid.fill(maxWidth, maxHeight, fillChar);
for (const render of renders) {

@@ -44,3 +41,2 @@ render.setWidth(maxWidth, attributes.widthAlign, transparentFillChar);

}
exports.ZJoin = ZJoin;
ZJoin.defaultAttributes = Object.assign(Object.assign({}, minitelobject_js_1.MinitelObject.defaultAttributes), { widthAlign: 'start', heightAlign: 'start', inheritTransparency: false });
ZJoin.defaultAttributes = Object.assign(Object.assign({}, MinitelObject.defaultAttributes), { widthAlign: 'start', heightAlign: 'start', inheritTransparency: false });

@@ -1,26 +0,10 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./abstract/textnode.js"), exports);
__exportStar(require("./components/container.js"), exports);
__exportStar(require("./components/input.js"), exports);
__exportStar(require("./components/minitel.js"), exports);
__exportStar(require("./components/paragraph.js"), exports);
__exportStar(require("./components/scrollable.js"), exports);
__exportStar(require("./components/xjoin.js"), exports);
__exportStar(require("./components/yjoin.js"), exports);
__exportStar(require("./components/zjoin.js"), exports);
__exportStar(require("./components/span.js"), exports);
export * from './abstract/textnode.js';
export * from './components/container.js';
export * from './components/input.js';
export * from './components/minitel.js';
export * from './components/paragraph.js';
export * from './components/scrollable.js';
export * from './components/xjoin.js';
export * from './components/yjoin.js';
export * from './components/zjoin.js';
export * from './components/span.js';

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.expectNextChars = void 0;
exports.expectNextChars = {
export const expectNextChars = {
'\x13': 1,

@@ -6,0 +3,0 @@ '\x01': Infinity,

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocationDescriptors = exports.LocationDescriptor = void 0;
class LocationDescriptor {
export class LocationDescriptor {
constructor(y, x, w, h) {

@@ -23,4 +20,3 @@ this.y = y;

}
exports.LocationDescriptor = LocationDescriptor;
class LocationDescriptors {
export class LocationDescriptors {
constructor(...extended) {

@@ -62,2 +58,1 @@ this.locs = new Map();

}
exports.LocationDescriptors = LocationDescriptors;

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RichChar = void 0;
class RichChar {
export class RichChar {
// skip: boolean;

@@ -88,2 +85,1 @@ static getDelimited(attributes, charset) {

}
exports.RichChar = RichChar;

@@ -1,11 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RichCharGrid = void 0;
const locationdescriptor_js_1 = require("./locationdescriptor.js");
const richchar_js_1 = require("./richchar.js");
class RichCharGrid {
import { LocationDescriptors } from './locationdescriptor.js';
import { RichChar } from './richchar.js';
export class RichCharGrid {
constructor(grid = []) {
this._width = 0;
this.grid = grid;
this.locationDescriptors = new locationdescriptor_js_1.LocationDescriptors();
this.locationDescriptors = new LocationDescriptors();
this.width; // run check on getter

@@ -35,5 +32,5 @@ }

for (let char of line) {
const newChar = new richchar_js_1.RichChar(char, attributes);
const newChar = new RichChar(char, attributes);
allNewChars.push(newChar);
const emptyCodepdChar = new richchar_js_1.RichChar(null, attributes, [0, -1], newChar).noSize();
const emptyCodepdChar = new RichChar(null, attributes, [0, -1], newChar).noSize();
result.mergeX(new RichCharGrid(attributes.doubleWidth

@@ -47,7 +44,7 @@ ? [[newChar, emptyCodepdChar]]

newLine.mergeX(new RichCharGrid([
[new richchar_js_1.RichChar(null, Object.assign({}, attributes), [1, 0], newChar).noSize()]
[new RichChar(null, Object.assign({}, attributes), [1, 0], newChar).noSize()]
]));
if (attributes.doubleWidth) {
newLine.mergeX(new RichCharGrid([
[new richchar_js_1.RichChar(null, Object.assign({}, attributes), [1, -1], newChar).noSize()]
[new RichChar(null, Object.assign({}, attributes), [1, -1], newChar).noSize()]
]));

@@ -136,3 +133,3 @@ }

}
setHeight(height, heightAlign, char = new richchar_js_1.RichChar(' ')) {
setHeight(height, heightAlign, char = new RichChar(' ')) {
if (this.height === height)

@@ -157,3 +154,3 @@ return this;

}
setWidth(width, widthAlign, char = new richchar_js_1.RichChar(' ')) {
setWidth(width, widthAlign, char = new RichChar(' ')) {
if (this.width === width)

@@ -245,2 +242,1 @@ return this;

}
exports.RichCharGrid = RichCharGrid;

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SingletonArray = void 0;
class SingletonArray extends Array {
export class SingletonArray extends Array {
checkIsSingleton(addedElms) {

@@ -23,2 +20,1 @@ if (this.length + addedElms > 1)

}
exports.SingletonArray = SingletonArray;

@@ -1,2 +0,1 @@

"use strict";
// import { InputAttributes } fr``om './components/input.js';

@@ -7,2 +6,2 @@ // import { ScrollableAttributes } from './components/scrollable.js';

// import { ZJoinAttributes } fr``om './components/zjoin.js';
Object.defineProperty(exports, "__esModule", { value: true });
export {};

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toBitArray = exports.padding = exports.inheritedProps = exports.alignInvrt = void 0;
exports.alignInvrt = {
export const alignInvrt = {
start: 'end',

@@ -9,3 +6,3 @@ middle: 'middle',

};
function inheritedProps(props) {
export function inheritedProps(props) {
const inheritedProps = ['fillChar', 'fg', 'textAlign', 'bg', 'underline', 'noBlink', 'invert', 'doubleWidth', 'doubleHeight', 'wrap'];

@@ -21,4 +18,3 @@ const result = {};

}
exports.inheritedProps = inheritedProps;
exports.padding = {
export const padding = {
normalise(pad) {

@@ -46,6 +42,5 @@ var _a, _b;

};
function toBitArray(char) {
export 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.9.4",
"version": "1.9.5",
"description": "A standalone package for minitel components",
"main": "dist/index.js",
"type": "module",
"scripts": {

@@ -7,0 +8,0 @@ "test": "echo \"Error: no test specified\" && exit 1",

@@ -1,8 +0,8 @@

import { MinitelObject } from "../abstract/minitelobject";
import { TextNode } from "../abstract/textnode";
import { RichChar } from "../richchar";
import { RichCharGrid } from "../richchargrid";
import { MinitelObjectAttributes, RenderLinesAttributes } from "../types";
import { alignInvrt, inheritedProps } from "../utils";
import { Minitel } from "./minitel";
import { MinitelObject } from "../abstract/minitelobject.js";
import { TextNode } from "../abstract/textnode.js";
import { RichChar } from "../richchar.js";
import { RichCharGrid } from "../richchargrid.js";
import { MinitelObjectAttributes, RenderLinesAttributes } from "../types.js";
import { alignInvrt, inheritedProps } from "../utils.js";
import { Minitel } from "./minitel.js";

@@ -9,0 +9,0 @@ export class Span extends MinitelObject {

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