@opentui/solid 0.1.50 → 0.1.52

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/README.md CHANGED
@@ -40,7 +40,7 @@ render(() => <text>Hello, World!</text>)
40
40
  5. To build use [Bun.build](https://bun.com/docs/bundler) ([source](https://github.com/sst/opentui/issues/122)):
41
41
 
42
42
  ```ts
43
- import solidPlugin from "./node_modules/@opentui/solid/scripts/solid-plugin"
43
+ import solidPlugin from "@opentui/solid/bun-plugin"
44
44
 
45
45
  await Bun.build({
46
46
  entrypoints: ["./index.tsx"],
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ export function useTerminalDimensions(): import("solid-js").Accessor<{
6
6
  export function useSelectionHandler(callback: any): void;
7
7
  export function useRenderer(): any;
8
8
  export function usePaste(callback: any): void;
9
- export function useKeyboard(callback: any): void;
10
- export function useKeyHandler(callback: any): void;
9
+ export function useKeyboard(callback: any, options: any): void;
10
+ export function useKeyHandler(callback: any, options: any): void;
11
11
  export function use(fn: any, element: any, arg: any): any;
12
12
  export var textNodeKeys: string[];
13
13
  export function testRender(node: any, renderConfig?: {}): Promise<{
@@ -36,6 +36,8 @@ export function getComponentCatalogue(): {
36
36
  tab_select: typeof TabSelectRenderable2;
37
37
  scrollbox: typeof ScrollBoxRenderable;
38
38
  code: typeof CodeRenderable;
39
+ diff: typeof DiffRenderable;
40
+ line_number: typeof LineNumberRenderable;
39
41
  span: typeof SpanRenderable;
40
42
  strong: typeof BoldSpanRenderable;
41
43
  b: typeof BoldSpanRenderable;
@@ -61,6 +63,8 @@ export namespace componentCatalogue {
61
63
  export { TabSelectRenderable2 as tab_select };
62
64
  export { ScrollBoxRenderable as scrollbox };
63
65
  export { CodeRenderable as code };
66
+ export { DiffRenderable as diff };
67
+ export { LineNumberRenderable as line_number };
64
68
  export { SpanRenderable as span };
65
69
  export { BoldSpanRenderable as strong };
66
70
  export { BoldSpanRenderable as b };
@@ -118,6 +122,8 @@ import { ASCIIFontRenderable } from "@opentui/core";
118
122
  import { TabSelectRenderable as TabSelectRenderable2 } from "@opentui/core";
119
123
  import { ScrollBoxRenderable } from "@opentui/core";
120
124
  import { CodeRenderable } from "@opentui/core";
125
+ import { DiffRenderable } from "@opentui/core";
126
+ import { LineNumberRenderable } from "@opentui/core";
121
127
  declare class SpanRenderable extends TextNodeRenderable3 {
122
128
  constructor(_ctx: any, options: any);
123
129
  _ctx: any;
package/index.js CHANGED
@@ -8,7 +8,9 @@ import {
8
8
  ASCIIFontRenderable,
9
9
  BoxRenderable,
10
10
  CodeRenderable,
11
+ DiffRenderable,
11
12
  InputRenderable as InputRenderable2,
13
+ LineNumberRenderable,
12
14
  ScrollBoxRenderable,
13
15
  SelectRenderable as SelectRenderable2,
14
16
  TabSelectRenderable as TabSelectRenderable2,
@@ -50,14 +52,20 @@ var useTerminalDimensions = () => {
50
52
  onResize(callback);
51
53
  return terminalDimensions;
52
54
  };
53
- var useKeyboard = (callback) => {
55
+ var useKeyboard = (callback, options) => {
54
56
  const renderer = useRenderer();
55
57
  const keyHandler = renderer.keyInput;
56
58
  onMount(() => {
57
59
  keyHandler.on("keypress", callback);
60
+ if (options?.release) {
61
+ keyHandler.on("keyrelease", callback);
62
+ }
58
63
  });
59
64
  onCleanup(() => {
60
65
  keyHandler.off("keypress", callback);
66
+ if (options?.release) {
67
+ keyHandler.off("keyrelease", callback);
68
+ }
61
69
  });
62
70
  };
63
71
  var usePaste = (callback) => {
@@ -883,6 +891,8 @@ var baseComponents = {
883
891
  tab_select: TabSelectRenderable2,
884
892
  scrollbox: ScrollBoxRenderable,
885
893
  code: CodeRenderable,
894
+ diff: DiffRenderable,
895
+ line_number: LineNumberRenderable,
886
896
  span: SpanRenderable,
887
897
  strong: BoldSpanRenderable,
888
898
  b: BoldSpanRenderable,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
7
- "version": "0.1.50",
7
+ "version": "0.1.52",
8
8
  "description": "SolidJS renderer for OpenTUI",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@babel/core": "7.28.0",
29
29
  "@babel/preset-typescript": "7.27.1",
30
- "@opentui/core": "0.1.50",
30
+ "@opentui/core": "0.1.52",
31
31
  "babel-plugin-module-resolver": "5.0.2",
32
32
  "babel-preset-solid": "1.9.9",
33
33
  "s-js": "^0.4.9"
@@ -6,11 +6,31 @@ export declare const useTerminalDimensions: () => import("solid-js").Accessor<{
6
6
  width: number;
7
7
  height: number;
8
8
  }>;
9
- export declare const useKeyboard: (callback: (key: KeyEvent) => void) => void;
9
+ export interface UseKeyboardOptions {
10
+ /** Include release events - callback receives events with eventType: "release" */
11
+ release?: boolean;
12
+ }
13
+ /**
14
+ * Subscribe to keyboard events.
15
+ *
16
+ * By default, only receives press events (including key repeats with `repeated: true`).
17
+ * Use `options.release` to also receive release events.
18
+ *
19
+ * @example
20
+ * // Basic press handling (includes repeats)
21
+ * useKeyboard((e) => console.log(e.name, e.repeated ? "(repeat)" : ""))
22
+ *
23
+ * // With release events
24
+ * useKeyboard((e) => {
25
+ * if (e.eventType === "release") keys.delete(e.name)
26
+ * else keys.add(e.name)
27
+ * }, { release: true })
28
+ */
29
+ export declare const useKeyboard: (callback: (key: KeyEvent) => void, options?: UseKeyboardOptions) => void;
10
30
  export declare const usePaste: (callback: (event: PasteEvent) => void) => void;
11
31
  /**
12
32
  * @deprecated renamed to useKeyboard
13
33
  */
14
- export declare const useKeyHandler: (callback: (key: KeyEvent) => void) => void;
34
+ export declare const useKeyHandler: (callback: (key: KeyEvent) => void, options?: UseKeyboardOptions) => void;
15
35
  export declare const useSelectionHandler: (callback: (selection: Selection) => void) => void;
16
36
  export declare const useTimeline: (options?: TimelineOptions) => Timeline;
@@ -1,4 +1,4 @@
1
- import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, InputRenderable, ScrollBoxRenderable, SelectRenderable, TabSelectRenderable, TextareaRenderable, TextNodeRenderable, TextRenderable, type RenderContext, type TextNodeOptions } from "@opentui/core";
1
+ import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, DiffRenderable, InputRenderable, LineNumberRenderable, ScrollBoxRenderable, SelectRenderable, TabSelectRenderable, TextareaRenderable, TextNodeRenderable, TextRenderable, type RenderContext, type TextNodeOptions } from "@opentui/core";
2
2
  import type { RenderableConstructor } from "../types/elements";
3
3
  export * from "./hooks";
4
4
  export * from "./extras";
@@ -35,6 +35,8 @@ export declare const baseComponents: {
35
35
  tab_select: typeof TabSelectRenderable;
36
36
  scrollbox: typeof ScrollBoxRenderable;
37
37
  code: typeof CodeRenderable;
38
+ diff: typeof DiffRenderable;
39
+ line_number: typeof LineNumberRenderable;
38
40
  span: typeof SpanRenderable;
39
41
  strong: typeof BoldSpanRenderable;
40
42
  b: typeof BoldSpanRenderable;