minitel-standalone
Advanced tools
Comparing version 1.3.3 to 1.4.0
@@ -8,3 +8,3 @@ import { MinitelObjectAttributes } from '../types.js'; | ||
disabled: boolean; | ||
cursorActuallyAt?: [number, number]; | ||
focusCursorAt?: [number, number]; | ||
keepElmDesc: true; | ||
@@ -11,0 +11,0 @@ } |
@@ -22,3 +22,3 @@ import { Focusable, FocusableAttributes } from '../abstract/focusable.js'; | ||
render(attributes: InputAttributes, inheritMe: Partial<InputAttributes>): RichCharGrid; | ||
get focusCursorAt(): number[]; | ||
get focusCursorAt(): [number, number]; | ||
} | ||
@@ -25,0 +25,0 @@ export interface InputAttributes extends FocusableAttributes { |
@@ -72,3 +72,3 @@ "use strict"; | ||
default: | ||
if (/^[a-zA-Z0-9,\.';\-\:?!"#$%&\(\)\[\]<>@+=*/ ]$/g.test(key) || (key === '\x0d' && !this.attributes.multiline)) { | ||
if (/^[a-zA-Z0-9,\.';\-\:?!"#$%&\(\)\[\]<>@+=*/ ]$/g.test(key) || (key === '\x0d' && this.attributes.multiline)) { | ||
const lines = this.value.split('\n'); | ||
@@ -135,4 +135,4 @@ let cumulPosition = lines.filter((_, i) => i < this.cursorActuallyAt[0]).reduce((p, v) => p + v.length + 1, 0); | ||
} | ||
if (this.scrollDelta[0] + attributes.height < this.cursorActuallyAt[0]) { | ||
this.scrollDelta[0] = this.cursorActuallyAt[0] - attributes.height; | ||
if (this.scrollDelta[0] < this.cursorActuallyAt[0] - attributes.height + 1) { | ||
this.scrollDelta[0] = this.cursorActuallyAt[0] - attributes.height + 1; | ||
} | ||
@@ -144,9 +144,9 @@ this.scrollDelta[0] = Math.min(Math.max(this.scrollDelta[0], 0), lines.length); | ||
if (attributes.width != null) { | ||
if (this.scrollDelta[1] > this.cursorActuallyAt[1] - 4) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1] - 4; | ||
if (this.cursorActuallyAt[1] < this.scrollDelta[1]) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1]; | ||
} | ||
if (this.scrollDelta[1] + attributes.width < this.cursorActuallyAt[1]) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1] - attributes.width; | ||
if (this.scrollDelta[1] < this.cursorActuallyAt[1] - attributes.width + 4) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1] - attributes.width + 4; | ||
} | ||
this.scrollDelta[1] = Math.min(Math.max(this.scrollDelta[1], 0), lines[this.cursorActuallyAt[0]].length); | ||
this.scrollDelta[1] = Math.max(Math.min(this.scrollDelta[1], lines[this.cursorActuallyAt[0]].length), 0); | ||
result.setWidth(this.scrollDelta[1] + attributes.width, 'end', fillChar); | ||
@@ -153,0 +153,0 @@ result.setWidth(attributes.width, 'start', fillChar); |
@@ -124,5 +124,5 @@ "use strict"; | ||
const locationDescriptor = renderGrid.locationDescriptors.get(this.focusedObj); | ||
if (locationDescriptor && 'focusCursorAt' in this.focusedObj && this.focusedObj.cursorActuallyAt != null) { | ||
if (locationDescriptor && 'focusCursorAt' in this.focusedObj && this.focusedObj.focusCursorAt != null) { | ||
const { x, y, w, h } = locationDescriptor; | ||
const [cursorDeltaY, cursorDeltaX] = this.focusedObj.cursorActuallyAt; | ||
const [cursorDeltaY, cursorDeltaX] = this.focusedObj.focusCursorAt; | ||
outputString.push(this.toCursorMove(Math.min(y + cursorDeltaY, y + h - 1), Math.min(x + cursorDeltaX, x + w))); | ||
@@ -129,0 +129,0 @@ outputString.push('\x11'); |
{ | ||
"name": "minitel-standalone", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "A standalone package for minitel components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,3 +7,3 @@ import { MinitelObjectAttributes } from '../types.js'; | ||
disabled: boolean; | ||
cursorActuallyAt?: [number, number]; | ||
focusCursorAt?: [number, number]; | ||
keepElmDesc: true; | ||
@@ -10,0 +10,0 @@ } |
@@ -103,3 +103,3 @@ import { Focusable, FocusableAttributes } from '../abstract/focusable.js'; | ||
default: | ||
if (/^[a-zA-Z0-9,\.';\-\:?!"#$%&\(\)\[\]<>@+=*/ ]$/g.test(key) || (key === '\x0d' && !this.attributes.multiline)) { | ||
if (/^[a-zA-Z0-9,\.';\-\:?!"#$%&\(\)\[\]<>@+=*/ ]$/g.test(key) || (key === '\x0d' && this.attributes.multiline)) { | ||
const lines = this.value.split('\n'); | ||
@@ -167,4 +167,4 @@ | ||
} | ||
if (this.scrollDelta[0] + attributes.height < this.cursorActuallyAt[0]) { | ||
this.scrollDelta[0] = this.cursorActuallyAt[0] - attributes.height; | ||
if (this.scrollDelta[0] < this.cursorActuallyAt[0] - attributes.height + 1) { | ||
this.scrollDelta[0] = this.cursorActuallyAt[0] - attributes.height + 1; | ||
} | ||
@@ -177,9 +177,9 @@ this.scrollDelta[0] = Math.min(Math.max(this.scrollDelta[0], 0), lines.length); | ||
if (attributes.width != null) { | ||
if (this.scrollDelta[1] > this.cursorActuallyAt[1] - 4) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1] - 4; | ||
if (this.cursorActuallyAt[1] < this.scrollDelta[1]) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1]; | ||
} | ||
if (this.scrollDelta[1] + attributes.width < this.cursorActuallyAt[1]) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1] - attributes.width; | ||
if (this.scrollDelta[1] < this.cursorActuallyAt[1] - attributes.width + 4) { | ||
this.scrollDelta[1] = this.cursorActuallyAt[1] - attributes.width + 4; | ||
} | ||
this.scrollDelta[1] = Math.min(Math.max(this.scrollDelta[1], 0), lines[this.cursorActuallyAt[0]].length); | ||
this.scrollDelta[1] = Math.max(Math.min(this.scrollDelta[1], lines[this.cursorActuallyAt[0]].length), 0); | ||
@@ -192,3 +192,3 @@ result.setWidth(this.scrollDelta[1] + attributes.width, 'end', fillChar); | ||
get focusCursorAt() { | ||
return [this.cursorActuallyAt[0] - this.scrollDelta[0], this.cursorActuallyAt[1] - this.scrollDelta[1]]; | ||
return [this.cursorActuallyAt[0] - this.scrollDelta[0], this.cursorActuallyAt[1] - this.scrollDelta[1]] as [number, number]; | ||
} | ||
@@ -195,0 +195,0 @@ } |
@@ -180,5 +180,5 @@ import { Duplex } from 'stream'; | ||
const locationDescriptor = renderGrid.locationDescriptors.get(this.focusedObj); | ||
if (locationDescriptor && 'focusCursorAt' in this.focusedObj && this.focusedObj.cursorActuallyAt != null) { | ||
if (locationDescriptor && 'focusCursorAt' in this.focusedObj && this.focusedObj.focusCursorAt != null) { | ||
const { x, y, w, h } = locationDescriptor; | ||
const [cursorDeltaY, cursorDeltaX] = this.focusedObj.cursorActuallyAt; | ||
const [cursorDeltaY, cursorDeltaX] = this.focusedObj.focusCursorAt; | ||
@@ -185,0 +185,0 @@ outputString.push(this.toCursorMove( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180073