@effect-tui/react 0.10.1 → 0.10.2

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 (37) hide show
  1. package/dist/src/hooks/use-timer.d.ts +2 -2
  2. package/dist/src/hooks/use-timer.d.ts.map +1 -1
  3. package/dist/src/hooks/use-timer.js +2 -2
  4. package/dist/src/hooks/use-timer.js.map +1 -1
  5. package/dist/src/hosts/box.js.map +1 -1
  6. package/dist/src/hosts/canvas.js.map +1 -1
  7. package/dist/src/hosts/codeblock.js.map +1 -1
  8. package/dist/src/hosts/flex-container.js.map +1 -1
  9. package/dist/src/hosts/hstack.d.ts +3 -5
  10. package/dist/src/hosts/hstack.d.ts.map +1 -1
  11. package/dist/src/hosts/hstack.js.map +1 -1
  12. package/dist/src/hosts/overlay-item.js.map +1 -1
  13. package/dist/src/hosts/scroll.js.map +1 -1
  14. package/dist/src/hosts/spacer.js.map +1 -1
  15. package/dist/src/hosts/text.js.map +1 -1
  16. package/dist/src/hosts/vstack.d.ts +3 -5
  17. package/dist/src/hosts/vstack.d.ts.map +1 -1
  18. package/dist/src/hosts/vstack.js.map +1 -1
  19. package/dist/src/hosts/zstack.js.map +1 -1
  20. package/dist/src/test-grow.d.ts +3 -0
  21. package/dist/src/test-grow.d.ts.map +1 -0
  22. package/dist/src/test-grow.js +8 -0
  23. package/dist/src/test-grow.js.map +1 -0
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +2 -2
  26. package/src/hooks/use-timer.ts +9 -6
  27. package/src/hosts/box.ts +1 -1
  28. package/src/hosts/canvas.ts +1 -1
  29. package/src/hosts/codeblock.ts +1 -1
  30. package/src/hosts/flex-container.ts +1 -1
  31. package/src/hosts/hstack.ts +2 -5
  32. package/src/hosts/overlay-item.ts +1 -1
  33. package/src/hosts/scroll.ts +1 -1
  34. package/src/hosts/spacer.ts +1 -1
  35. package/src/hosts/text.ts +3 -3
  36. package/src/hosts/vstack.ts +2 -5
  37. package/src/hosts/zstack.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-tui/react",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
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.10.1",
86
+ "@effect-tui/core": "^0.10.2",
87
87
  "@effect/platform": "^0.94.0",
88
88
  "@effect/platform-bun": "^0.87.0",
89
89
  "@effect/rpc": "^0.73.0",
@@ -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
- setTime(initialTime)
106
- setStatus("STOPPED")
107
- }, [initialTime])
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 Record<string, unknown>)
44
44
  }
45
45
 
46
46
  private get borderThickness(): number {
@@ -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 Record<string, unknown>)
79
79
  }
80
80
 
81
81
  measure(maxW: number, maxH: number): Size {
@@ -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 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 Record<string, unknown>)
50
50
  }
51
51
 
52
52
  /** Get children excluding __static nodes (which are rendered separately) */
@@ -1,10 +1,7 @@
1
- import type { CommonProps, HostContext } from "../reconciler/types.js"
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 CommonProps {
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 Record<string, unknown>)
27
27
  }
28
28
 
29
29
  override measure(maxW: number, maxH: number): Size {
@@ -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 Record<string, unknown>)
68
68
  }
69
69
 
70
70
  measure(maxW: number, maxH: number): Size {
@@ -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 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 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 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 Record<string, unknown>)
527
527
  }
528
528
 
529
529
  measure(maxW: number, maxH: number): Size {
@@ -1,10 +1,7 @@
1
- import type { CommonProps, HostContext } from "../reconciler/types.js"
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 CommonProps {
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.
@@ -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 Record<string, unknown>)
19
19
  }
20
20
 
21
21
  measure(maxW: number, maxH: number): Size {