@trendr/core 0.4.3 → 0.4.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/text-area.js +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trendr/core",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "direct-mode TUI renderer with JSX, signals, and per-cell diffing",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Pyers",
package/src/text-area.js CHANGED
@@ -124,7 +124,7 @@ function ensureVisible(cursorRow, scroll, height, totalLines) {
124
124
  return scroll
125
125
  }
126
126
 
127
- export function TextArea({ onSubmit, onCancel, onChange, onKeyDown, placeholder, focused = true, maxHeight = 10, clearOnSubmit = true, cursor: cursorProp, value: valueProp, submitOnEnter = false }) {
127
+ export function TextArea({ onSubmit, onCancel, onChange, onKeyDown, placeholder, focused = true, maxHeight = 10, clearOnSubmit = true, cursor: cursorProp, value: valueProp, submitOnEnter = false, color }) {
128
128
  const [value, setValue] = createSignal('')
129
129
  const [cursor, setCursor] = createSignal(0)
130
130
  if (valueProp !== undefined && valueProp !== value()) {
@@ -345,7 +345,7 @@ export function TextArea({ onSubmit, onCancel, onChange, onKeyDown, placeholder,
345
345
  const hasCursor = focused && row === displayPos.row
346
346
 
347
347
  if (!hasCursor) {
348
- return jsx('text', { key: row, children: content || ' ' })
348
+ return jsx('text', { key: row, style: color ? { color } : {}, children: content || ' ' })
349
349
  }
350
350
 
351
351
  const cursorIdx = Math.max(line.start, Math.min(c, line.end))
@@ -358,9 +358,9 @@ export function TextArea({ onSubmit, onCancel, onChange, onKeyDown, placeholder,
358
358
  key: row,
359
359
  style: { flexDirection: 'row', height: 1 },
360
360
  children: [
361
- before && jsx('text', { children: before }),
361
+ before && jsx('text', { style: color ? { color } : {}, children: before }),
362
362
  jsx('text', { style: cs ?? {}, children: cursorChar }),
363
- after && jsx('text', { children: after }),
363
+ after && jsx('text', { style: color ? { color } : {}, children: after }),
364
364
  ],
365
365
  })
366
366
  })