@effect-tui/react 0.10.2 → 0.12.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/components/ListView.js +6 -7
- package/dist/src/components/ListView.js.map +1 -1
- package/dist/src/hooks/use-scroll.d.ts +3 -0
- package/dist/src/hooks/use-scroll.d.ts.map +1 -1
- package/dist/src/hooks/use-scroll.js +113 -74
- package/dist/src/hooks/use-scroll.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.d.ts +3 -1
- package/dist/src/hosts/flex-container.d.ts.map +1 -1
- package/dist/src/hosts/flex-container.js +22 -4
- package/dist/src/hosts/flex-container.js.map +1 -1
- package/dist/src/hosts/overlay-item.js.map +1 -1
- package/dist/src/hosts/scroll.d.ts.map +1 -1
- package/dist/src/hosts/scroll.js +4 -6
- package/dist/src/hosts/scroll.js.map +1 -1
- package/dist/src/hosts/spacer.js.map +1 -1
- package/dist/src/hosts/text.d.ts +13 -0
- package/dist/src/hosts/text.d.ts.map +1 -1
- package/dist/src/hosts/text.js +23 -0
- package/dist/src/hosts/text.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.map +1 -1
- package/dist/src/test-grow.js +0 -2
- package/dist/src/test-grow.js.map +1 -1
- package/dist/src/utils/styles.d.ts +4 -0
- package/dist/src/utils/styles.d.ts.map +1 -1
- package/dist/src/utils/styles.js +4 -0
- package/dist/src/utils/styles.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jsx-runtime.ts +2 -3
- package/package.json +2 -2
- package/src/components/ListView.tsx +7 -7
- package/src/hooks/use-scroll.ts +132 -84
- 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 +34 -5
- package/src/hosts/overlay-item.ts +1 -1
- package/src/hosts/scroll.ts +5 -7
- package/src/hosts/spacer.ts +1 -1
- package/src/hosts/text.ts +35 -3
- package/src/hosts/zstack.ts +1 -1
- package/src/reconciler/types.ts +0 -6
- package/src/utils/styles.ts +6 -0
package/src/hosts/text.ts
CHANGED
|
@@ -11,8 +11,10 @@ export interface TextProps extends CommonProps {
|
|
|
11
11
|
fg?: ColorProp
|
|
12
12
|
bg?: ColorProp
|
|
13
13
|
bold?: boolean
|
|
14
|
+
dimmed?: boolean
|
|
14
15
|
italic?: boolean
|
|
15
16
|
underline?: boolean
|
|
17
|
+
strikethrough?: boolean
|
|
16
18
|
inverse?: boolean
|
|
17
19
|
/** If true, wrap text to multiple lines (default: false, text is truncated) */
|
|
18
20
|
wrap?: boolean
|
|
@@ -22,8 +24,10 @@ export class TextHost extends BaseHost {
|
|
|
22
24
|
fg?: Color
|
|
23
25
|
bg?: Color
|
|
24
26
|
bold = false
|
|
27
|
+
dimmed = false
|
|
25
28
|
italic = false
|
|
26
29
|
underline = false
|
|
30
|
+
strikethrough = false
|
|
27
31
|
inverse = false
|
|
28
32
|
wrap = false // Default: truncate (no wrap)
|
|
29
33
|
|
|
@@ -38,7 +42,7 @@ export class TextHost extends BaseHost {
|
|
|
38
42
|
|
|
39
43
|
constructor(props: TextProps, ctx: HostContext) {
|
|
40
44
|
super("text", props, ctx)
|
|
41
|
-
this.updateProps(props as Record<string, unknown>)
|
|
45
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
/** Check if we have SpanHost children (requires styled rendering) */
|
|
@@ -76,8 +80,11 @@ export class TextHost extends BaseHost {
|
|
|
76
80
|
fg: this.fg,
|
|
77
81
|
bg: this.bg,
|
|
78
82
|
bold: this.bold,
|
|
83
|
+
dimmed: this.dimmed,
|
|
79
84
|
italic: this.italic,
|
|
80
85
|
underline: this.underline,
|
|
86
|
+
strikethrough: this.strikethrough,
|
|
87
|
+
inverse: this.inverse,
|
|
81
88
|
})
|
|
82
89
|
}
|
|
83
90
|
} else if (child instanceof SpanHost) {
|
|
@@ -89,8 +96,11 @@ export class TextHost extends BaseHost {
|
|
|
89
96
|
fg: child.fg ?? this.fg,
|
|
90
97
|
bg: child.bg ?? this.bg,
|
|
91
98
|
bold: child.bold || this.bold,
|
|
99
|
+
dimmed: child.dimmed || this.dimmed,
|
|
92
100
|
italic: child.italic || this.italic,
|
|
93
101
|
underline: child.underline || this.underline,
|
|
102
|
+
strikethrough: child.strikethrough || this.strikethrough,
|
|
103
|
+
inverse: child.inverse || this.inverse,
|
|
94
104
|
})
|
|
95
105
|
}
|
|
96
106
|
}
|
|
@@ -297,8 +307,11 @@ export class TextHost extends BaseHost {
|
|
|
297
307
|
fg: span.fg ?? this.fg,
|
|
298
308
|
bg: span.bg ?? inheritedBg,
|
|
299
309
|
bold: span.bold,
|
|
310
|
+
dimmed: span.dimmed,
|
|
300
311
|
italic: span.italic,
|
|
301
312
|
underline: span.underline,
|
|
313
|
+
strikethrough: span.strikethrough,
|
|
314
|
+
inverse: span.inverse,
|
|
302
315
|
})
|
|
303
316
|
const availableWidth = this.rect.w - (x - this.rect.x)
|
|
304
317
|
if (availableWidth <= 0) break
|
|
@@ -315,8 +328,10 @@ export class TextHost extends BaseHost {
|
|
|
315
328
|
fg: this.fg,
|
|
316
329
|
bg: inheritedBg,
|
|
317
330
|
bold: this.bold,
|
|
331
|
+
dimmed: this.dimmed,
|
|
318
332
|
italic: this.italic,
|
|
319
333
|
underline: this.underline,
|
|
334
|
+
strikethrough: this.strikethrough,
|
|
320
335
|
inverse: this.inverse,
|
|
321
336
|
})
|
|
322
337
|
const content = this.getContent()
|
|
@@ -366,8 +381,10 @@ export class TextHost extends BaseHost {
|
|
|
366
381
|
this.bg = v as Color
|
|
367
382
|
}) as Color | undefined
|
|
368
383
|
this.bold = Boolean(props.bold)
|
|
384
|
+
this.dimmed = Boolean(props.dimmed)
|
|
369
385
|
this.italic = Boolean(props.italic)
|
|
370
386
|
this.underline = Boolean(props.underline)
|
|
387
|
+
this.strikethrough = Boolean(props.strikethrough)
|
|
371
388
|
this.inverse = Boolean(props.inverse)
|
|
372
389
|
this.wrap = Boolean(props.wrap)
|
|
373
390
|
}
|
|
@@ -415,8 +432,10 @@ export interface SpanStyle {
|
|
|
415
432
|
fg?: Color
|
|
416
433
|
bg?: Color
|
|
417
434
|
bold?: boolean
|
|
435
|
+
dimmed?: boolean
|
|
418
436
|
italic?: boolean
|
|
419
437
|
underline?: boolean
|
|
438
|
+
strikethrough?: boolean
|
|
420
439
|
inverse?: boolean
|
|
421
440
|
}
|
|
422
441
|
|
|
@@ -424,8 +443,10 @@ export interface SpanProps extends CommonProps {
|
|
|
424
443
|
fg?: Color
|
|
425
444
|
bg?: Color
|
|
426
445
|
bold?: boolean
|
|
446
|
+
dimmed?: boolean
|
|
427
447
|
italic?: boolean
|
|
428
448
|
underline?: boolean
|
|
449
|
+
strikethrough?: boolean
|
|
429
450
|
inverse?: boolean
|
|
430
451
|
/** Reusable style object. Individual props override textStyle values. */
|
|
431
452
|
textStyle?: SpanStyle
|
|
@@ -441,13 +462,15 @@ export class SpanHost extends BaseHost {
|
|
|
441
462
|
fg?: Color
|
|
442
463
|
bg?: Color
|
|
443
464
|
bold = false
|
|
465
|
+
dimmed = false
|
|
444
466
|
italic = false
|
|
445
467
|
underline = false
|
|
468
|
+
strikethrough = false
|
|
446
469
|
inverse = false
|
|
447
470
|
|
|
448
471
|
constructor(props: SpanProps, ctx: HostContext) {
|
|
449
472
|
super("span", props, ctx)
|
|
450
|
-
this.updateProps(props as Record<string, unknown>)
|
|
473
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
451
474
|
}
|
|
452
475
|
|
|
453
476
|
/** Get text content from RawTextHost children */
|
|
@@ -475,8 +498,11 @@ export class SpanHost extends BaseHost {
|
|
|
475
498
|
this.fg = props.fg !== undefined ? (props.fg as Color) : textStyle?.fg
|
|
476
499
|
this.bg = props.bg !== undefined ? (props.bg as Color) : textStyle?.bg
|
|
477
500
|
this.bold = props.bold !== undefined ? Boolean(props.bold) : Boolean(textStyle?.bold)
|
|
501
|
+
this.dimmed = props.dimmed !== undefined ? Boolean(props.dimmed) : Boolean(textStyle?.dimmed)
|
|
478
502
|
this.italic = props.italic !== undefined ? Boolean(props.italic) : Boolean(textStyle?.italic)
|
|
479
503
|
this.underline = props.underline !== undefined ? Boolean(props.underline) : Boolean(textStyle?.underline)
|
|
504
|
+
this.strikethrough =
|
|
505
|
+
props.strikethrough !== undefined ? Boolean(props.strikethrough) : Boolean(textStyle?.strikethrough)
|
|
480
506
|
this.inverse = props.inverse !== undefined ? Boolean(props.inverse) : Boolean(textStyle?.inverse)
|
|
481
507
|
}
|
|
482
508
|
}
|
|
@@ -491,8 +517,11 @@ export interface StyledSpan {
|
|
|
491
517
|
fg?: Color
|
|
492
518
|
bg?: Color
|
|
493
519
|
bold?: boolean
|
|
520
|
+
dimmed?: boolean
|
|
494
521
|
italic?: boolean
|
|
495
522
|
underline?: boolean
|
|
523
|
+
strikethrough?: boolean
|
|
524
|
+
inverse?: boolean
|
|
496
525
|
}
|
|
497
526
|
|
|
498
527
|
export interface StyledTextProps extends CommonProps {
|
|
@@ -523,7 +552,7 @@ export class StyledTextHost extends BaseHost {
|
|
|
523
552
|
|
|
524
553
|
constructor(props: StyledTextProps, ctx: HostContext) {
|
|
525
554
|
super("styledtext", props, ctx)
|
|
526
|
-
this.updateProps(props as Record<string, unknown>)
|
|
555
|
+
this.updateProps(props as unknown as Record<string, unknown>)
|
|
527
556
|
}
|
|
528
557
|
|
|
529
558
|
measure(maxW: number, maxH: number): Size {
|
|
@@ -627,8 +656,11 @@ export class StyledTextHost extends BaseHost {
|
|
|
627
656
|
fg: span.fg ?? this.fg,
|
|
628
657
|
bg: span.bg ?? inheritedBg,
|
|
629
658
|
bold: span.bold,
|
|
659
|
+
dimmed: span.dimmed,
|
|
630
660
|
italic: span.italic,
|
|
631
661
|
underline: span.underline,
|
|
662
|
+
strikethrough: span.strikethrough,
|
|
663
|
+
inverse: span.inverse,
|
|
632
664
|
})
|
|
633
665
|
const availableWidth = this.rect.w - (x - this.rect.x)
|
|
634
666
|
if (availableWidth <= 0) break
|
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 as Record<string, unknown>)
|
|
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
|
}
|
package/src/utils/styles.ts
CHANGED
|
@@ -8,8 +8,10 @@ export interface StyleOptions {
|
|
|
8
8
|
fg?: ColorValue
|
|
9
9
|
bg?: ColorValue
|
|
10
10
|
bold?: boolean
|
|
11
|
+
dimmed?: boolean
|
|
11
12
|
italic?: boolean
|
|
12
13
|
underline?: boolean
|
|
14
|
+
strikethrough?: boolean
|
|
13
15
|
inverse?: boolean
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -17,8 +19,10 @@ export interface StyleInput {
|
|
|
17
19
|
fg?: Color
|
|
18
20
|
bg?: Color
|
|
19
21
|
bold?: boolean
|
|
22
|
+
dimmed?: boolean
|
|
20
23
|
italic?: boolean
|
|
21
24
|
underline?: boolean
|
|
25
|
+
strikethrough?: boolean
|
|
22
26
|
inverse?: boolean
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -37,8 +41,10 @@ export function styleSpecFromProps(props: StyleInput): StyleSpec | undefined {
|
|
|
37
41
|
if (fg !== undefined) spec.fg = fg
|
|
38
42
|
if (bg !== undefined) spec.bg = bg
|
|
39
43
|
if (props.bold) spec.bold = true
|
|
44
|
+
if (props.dimmed) spec.dimmed = true
|
|
40
45
|
if (props.italic) spec.italic = true
|
|
41
46
|
if (props.underline) spec.underline = true
|
|
47
|
+
if (props.strikethrough) spec.strikethrough = true
|
|
42
48
|
if (props.inverse) spec.inverse = true
|
|
43
49
|
|
|
44
50
|
return Object.keys(spec).length > 0 ? spec : undefined
|