@sigx/runtime-terminal 0.1.4 → 0.1.6
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 +7 -7
- package/dist/components/Checkbox.d.ts +5 -2
- package/dist/components/Input.d.ts +5 -2
- package/dist/components/Select.d.ts +7 -2
- package/dist/index.d.ts +1 -3
- package/dist/index.js +69 -1268
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/dist/keyboard.d.ts +0 -4
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@ Terminal UI components for the Sigx runtime (demo/experimental).
|
|
|
5
5
|
## Components
|
|
6
6
|
|
|
7
7
|
- `Button` - a focusable, clickable control.
|
|
8
|
-
- `Input` - a focusable text input with two-way `
|
|
8
|
+
- `Input` - a focusable text input with two-way `model` binding.
|
|
9
9
|
- `ProgressBar` - a read-only progress indicator.
|
|
10
|
-
- `Checkbox` - a focusable checkbox with two-way `
|
|
10
|
+
- `Checkbox` - a focusable checkbox with two-way `model` binding.
|
|
11
11
|
|
|
12
12
|
## `Checkbox` Usage
|
|
13
13
|
|
|
14
|
-
The `Checkbox` component uses two-way `
|
|
14
|
+
The `Checkbox` component uses two-way `model` binding. That means you can write:
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
17
|
/** @jsxImportSource @sigx/terminal */
|
|
@@ -20,21 +20,21 @@ import { signal, renderTerminal, Checkbox } from '@sigx/terminal';
|
|
|
20
20
|
const state = signal({ enabled: true });
|
|
21
21
|
|
|
22
22
|
renderTerminal(
|
|
23
|
-
<Checkbox
|
|
23
|
+
<Checkbox model={() => state.enabled} label="Enabled" />,
|
|
24
24
|
{ clearConsole: true }
|
|
25
25
|
);
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
When the user presses Space or Enter while the `Checkbox` is focused, it will emit `update:
|
|
28
|
+
When the user presses Space or Enter while the `Checkbox` is focused, it will emit `update:modelValue` and `change` events in addition to toggling the visual state.
|
|
29
29
|
|
|
30
30
|
Props:
|
|
31
31
|
|
|
32
|
-
- `
|
|
32
|
+
- `modelValue` (model) - boolean - current value (two-way binding via `model`).
|
|
33
33
|
- `label` - string - optional label to display.
|
|
34
34
|
- `autofocus` - boolean - focus on mount.
|
|
35
35
|
- `disabled` - boolean - disable interaction.
|
|
36
36
|
|
|
37
37
|
Events:
|
|
38
38
|
|
|
39
|
-
- `update:
|
|
39
|
+
- `update:modelValue` - emitted when the value changes (used by `model`).
|
|
40
40
|
- `change` - emitted with the new value when toggled.
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/** @jsxImportSource @sigx/runtime-core */
|
|
2
2
|
import { type DefineEvent } from '@sigx/runtime-core';
|
|
3
3
|
export declare const Checkbox: import("@sigx/runtime-core").ComponentFactory<{
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
model?: import("@sigx/runtime-core").Model<boolean> | undefined;
|
|
5
|
+
__modelBindings?: {
|
|
6
|
+
model: boolean;
|
|
7
|
+
} | undefined;
|
|
8
|
+
} & DefineEvent<"update:modelValue", boolean> & {
|
|
6
9
|
label?: string | undefined;
|
|
7
10
|
} & {
|
|
8
11
|
autofocus?: boolean | undefined;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/** @jsxImportSource @sigx/runtime-core */
|
|
2
2
|
import { type DefineEvent } from '@sigx/runtime-core';
|
|
3
3
|
export declare const Input: import("@sigx/runtime-core").ComponentFactory<{
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
model?: import("@sigx/runtime-core").Model<string> | undefined;
|
|
5
|
+
__modelBindings?: {
|
|
6
|
+
model: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
} & DefineEvent<"update:modelValue", string> & {
|
|
6
9
|
placeholder?: string | undefined;
|
|
7
10
|
} & {
|
|
8
11
|
autofocus?: boolean | undefined;
|
|
@@ -6,12 +6,17 @@ export interface SelectOption<T = string> {
|
|
|
6
6
|
description?: string;
|
|
7
7
|
}
|
|
8
8
|
export declare const Select: import("@sigx/runtime-core").ComponentFactory<{
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
model?: import("@sigx/runtime-core").Model<string> | undefined;
|
|
10
|
+
__modelBindings?: {
|
|
11
|
+
model: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
} & DefineEvent<"update:modelValue", string> & {
|
|
11
14
|
options: SelectOption<string>[];
|
|
12
15
|
} & {
|
|
13
16
|
label?: string | undefined;
|
|
14
17
|
} & {
|
|
15
18
|
autofocus?: boolean | undefined;
|
|
19
|
+
} & {
|
|
20
|
+
showDescription?: boolean | undefined;
|
|
16
21
|
} & DefineEvent<"change", string> & DefineEvent<"submit", string>, void, {}>;
|
|
17
22
|
export default Select;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,7 @@ export interface TerminalNode {
|
|
|
13
13
|
children: TerminalNode[];
|
|
14
14
|
parentNode?: TerminalNode | null;
|
|
15
15
|
}
|
|
16
|
-
export declare const render:
|
|
17
|
-
mount(selectorOrContainer: string | TerminalNode): void;
|
|
18
|
-
};
|
|
16
|
+
export declare const render: import("@sigx/runtime-core").RootRenderFunction<TerminalNode, TerminalNode>;
|
|
19
17
|
export declare function renderNodeToLines(node: TerminalNode): string[];
|
|
20
18
|
type KeyHandler = (key: string) => void;
|
|
21
19
|
export declare function onKey(handler: KeyHandler): () => boolean;
|