@trendr/core 0.4.3 → 0.4.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trendr/core",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
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/renderer.js CHANGED
@@ -948,6 +948,7 @@ export function mount(rootComponent, { stream, stdin, title, theme, onExit: onEx
948
948
  let lastInlineBuf = null
949
949
 
950
950
  function frame() {
951
+ const frameStart = performance.now()
951
952
  const prevCtx = activeContext
952
953
  activeContext = ctx
953
954
  overlays = []
@@ -1076,7 +1077,7 @@ export function mount(rootComponent, { stream, stdin, title, theme, onExit: onEx
1076
1077
  }
1077
1078
  lastFrameTimestamp = now
1078
1079
  const avgMs = frameTimeWindow.length > 0 ? frameTimeWindow.reduce((a, b) => a + b, 0) / frameTimeWindow.length : 16.67
1079
- lastFrameStats = { changed, total: width * height, bytes: output ? Buffer.byteLength(output) : 0, fps: Math.round(1000 / avgMs) }
1080
+ lastFrameStats = { changed, total: width * height, bytes: output ? Buffer.byteLength(output) : 0, fps: Math.round(1000 / avgMs), renderMs: performance.now() - frameStart }
1080
1081
 
1081
1082
  const tmp = prev
1082
1083
  prev = curr
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
  })