@effect-tui/react 0.10.1 → 0.11.0
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/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/src/hooks/use-timer.d.ts +2 -2
- package/dist/src/hooks/use-timer.d.ts.map +1 -1
- package/dist/src/hooks/use-timer.js +2 -2
- package/dist/src/hooks/use-timer.js.map +1 -1
- package/dist/src/hosts/box.js.map +1 -1
- package/dist/src/hosts/canvas.js.map +1 -1
- package/dist/src/hosts/codeblock.js.map +1 -1
- package/dist/src/hosts/flex-container.js.map +1 -1
- package/dist/src/hosts/hstack.d.ts +3 -5
- package/dist/src/hosts/hstack.d.ts.map +1 -1
- package/dist/src/hosts/hstack.js.map +1 -1
- package/dist/src/hosts/overlay-item.js.map +1 -1
- package/dist/src/hosts/scroll.js.map +1 -1
- package/dist/src/hosts/spacer.js.map +1 -1
- package/dist/src/hosts/text.js.map +1 -1
- package/dist/src/hosts/vstack.d.ts +3 -5
- package/dist/src/hosts/vstack.d.ts.map +1 -1
- package/dist/src/hosts/vstack.js.map +1 -1
- package/dist/src/hosts/zstack.js.map +1 -1
- package/dist/src/reconciler/types.d.ts +0 -5
- package/dist/src/reconciler/types.d.ts.map +1 -1
- package/dist/src/test-grow.d.ts +3 -0
- package/dist/src/test-grow.d.ts.map +1 -0
- package/dist/src/test-grow.js +6 -0
- package/dist/src/test-grow.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jsx-runtime.ts +2 -3
- package/package.json +2 -2
- package/src/hooks/use-timer.ts +9 -6
- package/src/hosts/box.ts +1 -1
- package/src/hosts/canvas.ts +1 -1
- package/src/hosts/codeblock.ts +1 -1
- package/src/hosts/flex-container.ts +1 -1
- package/src/hosts/hstack.ts +2 -5
- package/src/hosts/overlay-item.ts +1 -1
- package/src/hosts/scroll.ts +1 -1
- package/src/hosts/spacer.ts +1 -1
- package/src/hosts/text.ts +3 -3
- package/src/hosts/vstack.ts +2 -5
- package/src/hosts/zstack.ts +1 -1
- package/src/reconciler/types.ts +0 -6
package/jsx-runtime.ts
CHANGED
|
@@ -36,9 +36,8 @@ export declare namespace JSX {
|
|
|
36
36
|
|
|
37
37
|
export interface IntrinsicAttributes extends React.Attributes {}
|
|
38
38
|
|
|
39
|
-
//
|
|
40
|
-
export interface IntrinsicElements
|
|
41
|
-
// Our custom TUI elements (override any React conflicts)
|
|
39
|
+
// Custom TUI elements only - no React DOM elements
|
|
40
|
+
export interface IntrinsicElements {
|
|
42
41
|
text: TextProps & { children?: React.ReactNode }
|
|
43
42
|
span: SpanProps & { children?: React.ReactNode }
|
|
44
43
|
styledtext: StyledTextProps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-tui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "React bindings for @effect-tui/core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"prepublishOnly": "bun run typecheck && bun run build"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@effect-tui/core": "^0.
|
|
86
|
+
"@effect-tui/core": "^0.11.0",
|
|
87
87
|
"@effect/platform": "^0.94.0",
|
|
88
88
|
"@effect/platform-bun": "^0.87.0",
|
|
89
89
|
"@effect/rpc": "^0.73.0",
|
package/src/hooks/use-timer.ts
CHANGED
|
@@ -33,8 +33,8 @@ export interface UseTimerReturn {
|
|
|
33
33
|
start: () => void
|
|
34
34
|
/** Pause the timer */
|
|
35
35
|
pause: () => void
|
|
36
|
-
/** Reset timer to initialTime and stop */
|
|
37
|
-
reset: () => void
|
|
36
|
+
/** Reset timer to initialTime (or provided time) and stop */
|
|
37
|
+
reset: (newTime?: number) => void
|
|
38
38
|
/** Current timer status */
|
|
39
39
|
status: TimerStatus
|
|
40
40
|
}
|
|
@@ -101,10 +101,13 @@ export function useTimer(config: UseTimerConfig): UseTimerReturn {
|
|
|
101
101
|
setStatus((prev) => (prev === "RUNNING" ? "PAUSED" : prev))
|
|
102
102
|
}, [])
|
|
103
103
|
|
|
104
|
-
const reset = useCallback(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const reset = useCallback(
|
|
105
|
+
(newTime?: number) => {
|
|
106
|
+
setTime(newTime ?? initialTime)
|
|
107
|
+
setStatus("STOPPED")
|
|
108
|
+
},
|
|
109
|
+
[initialTime],
|
|
110
|
+
)
|
|
108
111
|
|
|
109
112
|
// Timer effect
|
|
110
113
|
useEffect(() => {
|
package/src/hosts/box.ts
CHANGED
|
@@ -40,7 +40,7 @@ export class BoxHost extends SingleChildHost {
|
|
|
40
40
|
|
|
41
41
|
constructor(props: BoxProps, ctx: HostContext) {
|
|
42
42
|
super("box", props, ctx)
|
|
43
|
-
this.updateProps(props)
|
|
43
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
private get borderThickness(): number {
|
package/src/hosts/canvas.ts
CHANGED
|
@@ -75,7 +75,7 @@ export class CanvasHost extends BaseHost {
|
|
|
75
75
|
|
|
76
76
|
constructor(props: CanvasProps, ctx: HostContext) {
|
|
77
77
|
super("canvas", props, ctx)
|
|
78
|
-
this.updateProps(props)
|
|
78
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
measure(maxW: number, maxH: number): Size {
|
package/src/hosts/codeblock.ts
CHANGED
|
@@ -30,7 +30,7 @@ export class CodeBlockHost extends BaseHost {
|
|
|
30
30
|
|
|
31
31
|
constructor(props: CodeBlockProps, ctx: HostContext) {
|
|
32
32
|
super("codeblock", props, ctx)
|
|
33
|
-
this.updateProps(props)
|
|
33
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
private computeGutterWidth(): number {
|
|
@@ -46,7 +46,7 @@ export class FlexContainerHost<A extends FlexAxis> extends BaseHost {
|
|
|
46
46
|
) {
|
|
47
47
|
super(elementType, props, ctx)
|
|
48
48
|
this.alignment = defaultAlignment
|
|
49
|
-
this.updateProps(props)
|
|
49
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/** Get children excluding __static nodes (which are rendered separately) */
|
package/src/hosts/hstack.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostContext } from "../reconciler/types.js"
|
|
2
2
|
import { FlexContainerHost, type FlexContainerProps } from "./flex-container.js"
|
|
3
3
|
|
|
4
|
-
export interface HStackProps extends
|
|
5
|
-
spacing?: number
|
|
6
|
-
alignment?: "top" | "center" | "bottom"
|
|
7
|
-
}
|
|
4
|
+
export interface HStackProps extends FlexContainerProps<"horizontal"> {}
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* HStackHost lays out children horizontally with optional spacing and cross-axis alignment.
|
|
@@ -23,7 +23,7 @@ export class OverlayItemHost extends SingleChildHost {
|
|
|
23
23
|
|
|
24
24
|
constructor(props: OverlayItemProps, ctx: HostContext) {
|
|
25
25
|
super("overlayItem", props, ctx)
|
|
26
|
-
this.updateProps(props)
|
|
26
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
override measure(maxW: number, maxH: number): Size {
|
package/src/hosts/scroll.ts
CHANGED
|
@@ -64,7 +64,7 @@ export class ScrollHost extends SingleChildHost {
|
|
|
64
64
|
|
|
65
65
|
constructor(props: ScrollProps, ctx: HostContext) {
|
|
66
66
|
super("scroll", props, ctx)
|
|
67
|
-
this.updateProps(props)
|
|
67
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
measure(maxW: number, maxH: number): Size {
|
package/src/hosts/spacer.ts
CHANGED
|
@@ -18,7 +18,7 @@ export class SpacerHost extends BaseHost {
|
|
|
18
18
|
|
|
19
19
|
constructor(props: SpacerProps, ctx: HostContext) {
|
|
20
20
|
super("spacer", props, ctx)
|
|
21
|
-
this.updateProps(props)
|
|
21
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
measure(_maxW: number, _maxH: number): Size {
|
package/src/hosts/text.ts
CHANGED
|
@@ -38,7 +38,7 @@ export class TextHost extends BaseHost {
|
|
|
38
38
|
|
|
39
39
|
constructor(props: TextProps, ctx: HostContext) {
|
|
40
40
|
super("text", props, ctx)
|
|
41
|
-
this.updateProps(props)
|
|
41
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/** Check if we have SpanHost children (requires styled rendering) */
|
|
@@ -447,7 +447,7 @@ export class SpanHost extends BaseHost {
|
|
|
447
447
|
|
|
448
448
|
constructor(props: SpanProps, ctx: HostContext) {
|
|
449
449
|
super("span", props, ctx)
|
|
450
|
-
this.updateProps(props)
|
|
450
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
/** Get text content from RawTextHost children */
|
|
@@ -523,7 +523,7 @@ export class StyledTextHost extends BaseHost {
|
|
|
523
523
|
|
|
524
524
|
constructor(props: StyledTextProps, ctx: HostContext) {
|
|
525
525
|
super("styledtext", props, ctx)
|
|
526
|
-
this.updateProps(props)
|
|
526
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
measure(maxW: number, maxH: number): Size {
|
package/src/hosts/vstack.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HostContext } from "../reconciler/types.js"
|
|
2
2
|
import { FlexContainerHost, type FlexContainerProps } from "./flex-container.js"
|
|
3
3
|
|
|
4
|
-
export interface VStackProps extends
|
|
5
|
-
spacing?: number
|
|
6
|
-
alignment?: "leading" | "center" | "trailing"
|
|
7
|
-
}
|
|
4
|
+
export interface VStackProps extends FlexContainerProps<"vertical"> {}
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* VStackHost lays out children vertically with optional spacing and cross-axis alignment.
|
package/src/hosts/zstack.ts
CHANGED
|
@@ -15,7 +15,7 @@ export class ZStackHost extends BaseHost {
|
|
|
15
15
|
|
|
16
16
|
constructor(props: ZStackProps, ctx: HostContext) {
|
|
17
17
|
super("zstack", props, ctx)
|
|
18
|
-
this.updateProps(props)
|
|
18
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
measure(maxW: number, maxH: number): Size {
|
package/src/reconciler/types.ts
CHANGED
|
@@ -148,10 +148,4 @@ export interface CommonProps {
|
|
|
148
148
|
|
|
149
149
|
/** React key prop for list reconciliation */
|
|
150
150
|
key?: string | number
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Index signature for Record<string, unknown> compatibility.
|
|
154
|
-
* TODO: Remove this and properly type all props to catch typos like "grow" instead of "greedy"
|
|
155
|
-
*/
|
|
156
|
-
[key: string]: unknown
|
|
157
151
|
}
|