whirled_peas 0.8.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -2
- data/CHANGELOG.md +23 -0
- data/README.md +9 -777
- data/doc/application.md +92 -0
- data/doc/cli.md +115 -0
- data/doc/components.md +55 -0
- data/doc/easing.md +257 -0
- data/doc/elements.md +69 -0
- data/doc/screen_test.md +23 -0
- data/doc/settings.md +466 -0
- data/doc/template_factory.md +53 -0
- data/doc/themes.md +15 -0
- data/examples/components.rb +35 -0
- data/examples/graph.rb +54 -0
- data/examples/scrolling.rb +9 -20
- data/lib/data/themes.yaml +17 -0
- data/lib/whirled_peas.rb +31 -9
- data/lib/whirled_peas/animator/frameset.rb +1 -1
- data/lib/whirled_peas/animator/producer.rb +1 -1
- data/lib/whirled_peas/command/config_command.rb +3 -3
- data/lib/whirled_peas/command/play.rb +4 -0
- data/lib/whirled_peas/command/themes.rb +77 -0
- data/lib/whirled_peas/command_line.rb +3 -1
- data/lib/whirled_peas/component.rb +35 -0
- data/lib/whirled_peas/component/list_with_active.rb +88 -0
- data/lib/whirled_peas/graphics/box_painter.rb +4 -4
- data/lib/whirled_peas/graphics/composer.rb +27 -2
- data/lib/whirled_peas/graphics/container_coords.rb +23 -25
- data/lib/whirled_peas/graphics/container_dimensions.rb +24 -0
- data/lib/whirled_peas/graphics/container_painter.rb +27 -139
- data/lib/whirled_peas/graphics/content_dimensions.rb +19 -0
- data/lib/whirled_peas/graphics/content_painter.rb +20 -0
- data/lib/whirled_peas/graphics/debugger.rb +2 -7
- data/lib/whirled_peas/graphics/graph_dimensions.rb +12 -0
- data/lib/whirled_peas/graphics/graph_painter.rb +104 -0
- data/lib/whirled_peas/graphics/grid_painter.rb +0 -3
- data/lib/whirled_peas/graphics/scrollbar_helper.rb +126 -0
- data/lib/whirled_peas/graphics/text_painter.rb +7 -11
- data/lib/whirled_peas/null_logger.rb +0 -1
- data/lib/whirled_peas/settings/bg_color.rb +5 -1
- data/lib/whirled_peas/settings/border.rb +25 -4
- data/lib/whirled_peas/settings/color.rb +8 -4
- data/lib/whirled_peas/settings/container_settings.rb +14 -9
- data/lib/whirled_peas/settings/debugger.rb +3 -1
- data/lib/whirled_peas/settings/element_settings.rb +22 -5
- data/lib/whirled_peas/settings/graph_settings.rb +21 -0
- data/lib/whirled_peas/settings/grid_settings.rb +7 -0
- data/lib/whirled_peas/settings/position.rb +17 -5
- data/lib/whirled_peas/settings/text_color.rb +5 -0
- data/lib/whirled_peas/settings/text_settings.rb +1 -0
- data/lib/whirled_peas/settings/theme.rb +61 -0
- data/lib/whirled_peas/settings/theme_library.rb +69 -0
- data/lib/whirled_peas/utils/ansi.rb +1 -1
- data/lib/whirled_peas/version.rb +1 -1
- data/screen_test/components/list_with_active/l2r_active_color.frame +1 -0
- data/screen_test/components/list_with_active/l2r_active_color.rb +18 -0
- data/screen_test/components/list_with_active/l2r_position_end.frame +1 -0
- data/screen_test/components/list_with_active/l2r_position_end.rb +16 -0
- data/screen_test/components/list_with_active/l2r_position_middle.frame +1 -0
- data/screen_test/components/list_with_active/l2r_position_middle.rb +16 -0
- data/screen_test/components/list_with_active/l2r_position_start.frame +1 -0
- data/screen_test/components/list_with_active/l2r_position_start.rb +16 -0
- data/screen_test/components/list_with_active/l2r_separator.frame +1 -0
- data/screen_test/components/list_with_active/l2r_separator.rb +17 -0
- data/screen_test/components/list_with_active/t2b_active_color.frame +1 -0
- data/screen_test/components/list_with_active/t2b_active_color.rb +19 -0
- data/screen_test/components/list_with_active/t2b_position_end.frame +1 -0
- data/screen_test/components/list_with_active/t2b_position_end.rb +17 -0
- data/screen_test/components/list_with_active/t2b_position_middle.frame +1 -0
- data/screen_test/components/list_with_active/t2b_position_middle.rb +17 -0
- data/screen_test/components/list_with_active/t2b_position_start.frame +1 -0
- data/screen_test/components/list_with_active/t2b_position_start.rb +17 -0
- data/screen_test/components/list_with_active/t2b_separator.frame +1 -0
- data/screen_test/components/list_with_active/t2b_separator.rb +18 -0
- data/screen_test/elements/box.frame +1 -1
- data/screen_test/elements/box.rb +1 -1
- data/screen_test/elements/graph_asc.frame +1 -0
- data/screen_test/elements/graph_asc.rb +12 -0
- data/screen_test/elements/graph_desc.frame +1 -0
- data/screen_test/elements/graph_desc.rb +12 -0
- data/screen_test/elements/graph_horiz.frame +1 -0
- data/screen_test/elements/graph_horiz.rb +12 -0
- data/screen_test/elements/graph_sin.frame +1 -0
- data/screen_test/elements/graph_sin.rb +12 -0
- data/screen_test/elements/grid.frame +1 -1
- data/screen_test/elements/grid.rb +1 -1
- data/screen_test/elements/screen_overflow_x.frame +1 -1
- data/screen_test/elements/screen_overflow_x.rb +1 -1
- data/screen_test/elements/screen_overflow_y.frame +1 -1
- data/screen_test/elements/screen_overflow_y.rb +1 -1
- data/screen_test/elements/text.frame +1 -1
- data/screen_test/elements/text.rb +1 -1
- data/screen_test/elements/text_multiline.frame +1 -1
- data/screen_test/elements/text_multiline.rb +1 -1
- data/screen_test/elements/theme.frame +1 -0
- data/screen_test/elements/theme.rb +26 -0
- data/screen_test/settings/align/box_around.frame +1 -1
- data/screen_test/settings/align/box_around.rb +1 -1
- data/screen_test/settings/align/box_between.frame +1 -1
- data/screen_test/settings/align/box_between.rb +1 -1
- data/screen_test/settings/align/box_center.frame +1 -1
- data/screen_test/settings/align/box_center.rb +1 -1
- data/screen_test/settings/align/box_default.frame +1 -1
- data/screen_test/settings/align/box_default.rb +1 -1
- data/screen_test/settings/align/box_evenly.frame +1 -1
- data/screen_test/settings/align/box_evenly.rb +1 -1
- data/screen_test/settings/align/box_left.frame +1 -1
- data/screen_test/settings/align/box_left.rb +1 -1
- data/screen_test/settings/align/box_right.frame +1 -1
- data/screen_test/settings/align/box_right.rb +1 -1
- data/screen_test/settings/align/children_center.frame +1 -1
- data/screen_test/settings/align/children_center.rb +1 -1
- data/screen_test/settings/align/children_left.frame +1 -1
- data/screen_test/settings/align/children_left.rb +1 -1
- data/screen_test/settings/align/children_right.frame +1 -1
- data/screen_test/settings/align/children_right.rb +1 -1
- data/screen_test/settings/align/grid_center.frame +1 -1
- data/screen_test/settings/align/grid_center.rb +1 -1
- data/screen_test/settings/align/grid_default.frame +1 -1
- data/screen_test/settings/align/grid_default.rb +1 -1
- data/screen_test/settings/align/grid_left.frame +1 -1
- data/screen_test/settings/align/grid_left.rb +1 -1
- data/screen_test/settings/align/grid_right.frame +1 -1
- data/screen_test/settings/align/grid_right.rb +1 -1
- data/screen_test/settings/ansi/bold.frame +1 -1
- data/screen_test/settings/ansi/bold.rb +1 -1
- data/screen_test/settings/ansi/color.frame +1 -1
- data/screen_test/settings/ansi/color.rb +1 -1
- data/screen_test/settings/ansi/underline.frame +1 -1
- data/screen_test/settings/ansi/underline.rb +1 -1
- data/screen_test/settings/border.frame +1 -1
- data/screen_test/settings/border.rb +1 -1
- data/screen_test/settings/content_start/box_bottom.frame +1 -0
- data/screen_test/settings/content_start/box_bottom.rb +17 -0
- data/screen_test/settings/content_start/box_left.frame +1 -0
- data/screen_test/settings/{position → content_start}/box_left.rb +2 -2
- data/screen_test/settings/content_start/box_left_negative.frame +1 -0
- data/screen_test/settings/{position → content_start}/box_left_negative.rb +2 -2
- data/screen_test/settings/content_start/box_right.frame +1 -0
- data/screen_test/settings/content_start/box_right.rb +17 -0
- data/screen_test/settings/content_start/box_top.frame +1 -0
- data/screen_test/settings/{position → content_start}/box_top.rb +2 -2
- data/screen_test/settings/content_start/box_top_negative.frame +1 -0
- data/screen_test/settings/{position → content_start}/box_top_negative.rb +2 -2
- data/screen_test/settings/content_start/grid_left.frame +1 -0
- data/screen_test/settings/{position → content_start}/grid_left.rb +2 -2
- data/screen_test/settings/content_start/grid_left_negative.frame +1 -0
- data/screen_test/settings/{position → content_start}/grid_left_negative.rb +2 -2
- data/screen_test/settings/content_start/grid_top.frame +1 -0
- data/screen_test/settings/{position → content_start}/grid_top.rb +2 -2
- data/screen_test/settings/content_start/grid_top_negative.frame +1 -0
- data/screen_test/settings/{position → content_start}/grid_top_negative.rb +2 -2
- data/screen_test/settings/flow/box_b2t.frame +1 -1
- data/screen_test/settings/flow/box_b2t.rb +1 -1
- data/screen_test/settings/flow/box_l2r.frame +1 -1
- data/screen_test/settings/flow/box_l2r.rb +1 -1
- data/screen_test/settings/flow/box_r2l.frame +1 -1
- data/screen_test/settings/flow/box_r2l.rb +1 -1
- data/screen_test/settings/flow/box_t2b.frame +1 -1
- data/screen_test/settings/flow/box_t2b.rb +1 -1
- data/screen_test/settings/flow/grid_b2t.frame +1 -1
- data/screen_test/settings/flow/grid_b2t.rb +1 -1
- data/screen_test/settings/flow/grid_l2r.frame +1 -1
- data/screen_test/settings/flow/grid_l2r.rb +1 -1
- data/screen_test/settings/flow/grid_r2l.frame +1 -1
- data/screen_test/settings/flow/grid_r2l.rb +1 -1
- data/screen_test/settings/flow/grid_t2b.frame +1 -1
- data/screen_test/settings/flow/grid_t2b.rb +1 -1
- data/screen_test/settings/height/box.frame +1 -1
- data/screen_test/settings/height/box.rb +1 -1
- data/screen_test/settings/height/box_border_sizing.frame +1 -1
- data/screen_test/settings/height/box_border_sizing.rb +1 -1
- data/screen_test/settings/height/grid.frame +1 -1
- data/screen_test/settings/height/grid.rb +1 -1
- data/screen_test/settings/height/overflow_box.frame +1 -1
- data/screen_test/settings/height/overflow_box.rb +1 -1
- data/screen_test/settings/height/overflow_box_l2r.frame +1 -1
- data/screen_test/settings/height/overflow_box_l2r.rb +1 -1
- data/screen_test/settings/height/overflow_box_t2b.frame +1 -1
- data/screen_test/settings/height/overflow_box_t2b.rb +1 -1
- data/screen_test/settings/height/overflow_grid.frame +1 -1
- data/screen_test/settings/height/overflow_grid.rb +1 -1
- data/screen_test/settings/margin.frame +1 -1
- data/screen_test/settings/margin.rb +1 -1
- data/screen_test/settings/padding.frame +1 -1
- data/screen_test/settings/padding.rb +1 -1
- data/screen_test/settings/scroll/horiz_box.frame +1 -1
- data/screen_test/settings/scroll/horiz_box.rb +3 -5
- data/screen_test/settings/scroll/horiz_box_align_center.rb +3 -5
- data/screen_test/settings/scroll/horiz_box_align_right.rb +3 -5
- data/screen_test/settings/scroll/vert_box.frame +1 -1
- data/screen_test/settings/scroll/vert_box.rb +6 -8
- data/screen_test/settings/title_font.frame +1 -1
- data/screen_test/settings/title_font.rb +1 -1
- data/screen_test/settings/valign/box_around.frame +1 -1
- data/screen_test/settings/valign/box_around.rb +1 -1
- data/screen_test/settings/valign/box_between.frame +1 -1
- data/screen_test/settings/valign/box_between.rb +1 -1
- data/screen_test/settings/valign/box_bottom.frame +1 -1
- data/screen_test/settings/valign/box_bottom.rb +1 -1
- data/screen_test/settings/valign/box_default.frame +1 -1
- data/screen_test/settings/valign/box_default.rb +1 -1
- data/screen_test/settings/valign/box_evenly.frame +1 -1
- data/screen_test/settings/valign/box_evenly.rb +1 -1
- data/screen_test/settings/valign/box_middle.frame +1 -1
- data/screen_test/settings/valign/box_middle.rb +1 -1
- data/screen_test/settings/valign/box_top.frame +1 -1
- data/screen_test/settings/valign/box_top.rb +1 -1
- data/screen_test/settings/valign/grid_bottom.frame +1 -1
- data/screen_test/settings/valign/grid_bottom.rb +1 -1
- data/screen_test/settings/valign/grid_default.frame +1 -1
- data/screen_test/settings/valign/grid_default.rb +1 -1
- data/screen_test/settings/valign/grid_middle.frame +1 -1
- data/screen_test/settings/valign/grid_middle.rb +1 -1
- data/screen_test/settings/valign/grid_top.frame +1 -1
- data/screen_test/settings/valign/grid_top.rb +1 -1
- data/screen_test/settings/width/box_border_sizing.frame +1 -1
- data/screen_test/settings/width/box_border_sizing.rb +1 -1
- data/screen_test/settings/width/box_content.frame +1 -1
- data/screen_test/settings/width/box_content.rb +1 -1
- data/screen_test/settings/width/box_default.frame +1 -1
- data/screen_test/settings/width/box_default.rb +1 -1
- data/screen_test/settings/width/grid.frame +1 -1
- data/screen_test/settings/width/grid.rb +1 -1
- data/screen_test/settings/width/overflow_align_center.frame +1 -1
- data/screen_test/settings/width/overflow_align_center.rb +1 -1
- data/screen_test/settings/width/overflow_align_right.frame +1 -1
- data/screen_test/settings/width/overflow_align_right.rb +1 -1
- data/screen_test/settings/width/overflow_box.frame +1 -1
- data/screen_test/settings/width/overflow_box.rb +1 -1
- data/screen_test/settings/width/overflow_box_l2r.frame +1 -1
- data/screen_test/settings/width/overflow_box_l2r.rb +1 -1
- data/screen_test/settings/width/overflow_box_t2b.frame +1 -1
- data/screen_test/settings/width/overflow_box_t2b.rb +1 -1
- data/screen_test/settings/width/overflow_grid.frame +1 -1
- data/screen_test/settings/width/overflow_grid.rb +1 -1
- data/tools/whirled_peas/tools/screen_tester.rb +15 -1
- metadata +75 -20
- data/lib/whirled_peas/graphics/mock_screen.rb +0 -26
- data/lib/whirled_peas/graphics/text_dimensions.rb +0 -15
- data/screen_test/settings/position/box_left.frame +0 -1
- data/screen_test/settings/position/box_left_negative.frame +0 -1
- data/screen_test/settings/position/box_top.frame +0 -1
- data/screen_test/settings/position/box_top_negative.frame +0 -1
- data/screen_test/settings/position/grid_left.frame +0 -1
- data/screen_test/settings/position/grid_left_negative.frame +0 -1
- data/screen_test/settings/position/grid_top.frame +0 -1
- data/screen_test/settings/position/grid_top_negative.frame +0 -1
data/doc/application.md
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
## Application
|
2
|
+
|
3
|
+
The application is code to be visualized that integrates with Whirled Peas by providing the signature below
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
# Start the application and pass frame events to the producer to be rendered
|
7
|
+
# by the UI
|
8
|
+
#
|
9
|
+
# @param producer [Producer] frame producer that sends events to the UI
|
10
|
+
def start(producer)
|
11
|
+
# application code here
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
The producer provides the following methods
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
# Add a frame to be displayed
|
19
|
+
#
|
20
|
+
# @param name [String] (required) application defined name for the frame. The
|
21
|
+
# template factory will be provided this name
|
22
|
+
# @param duration [Number] (optional) time in seconds this frame should be
|
23
|
+
# displayed for (defaults to 1 frame)
|
24
|
+
# @param args [Hash<Symbol, Object>] (optional) key/value pairs to send as
|
25
|
+
# arguments to the template factory
|
26
|
+
def add_frame(name, duration:, args:)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Create and yield a frameset instance that allows applications to add multiple
|
30
|
+
# frames to play over the given duration. Adding frames to the yielded frameset
|
31
|
+
# will result in playback that is eased by the given `easing` and `effect`
|
32
|
+
# arguments (default is `:linear` easing)
|
33
|
+
#
|
34
|
+
# @param duration [Number] (required) total duration for which all frames in
|
35
|
+
# frameset will be displayed
|
36
|
+
# @param easing [Symbol] (optional) easing function to be used to transition
|
37
|
+
# through all frames (defaults to `:linear`)
|
38
|
+
# @param effect [Symbol] (optional) how to apply the easing function (defaults
|
39
|
+
# to `:in_out`, also available are `:in` and `:out`)
|
40
|
+
# @yield [Frameset] instance that provides `#add_frame(name, args:)`
|
41
|
+
def frameset(duration, easing:, effect:, &block)
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
See the [easing documentation](easing.md) for more details on the various easing functions.
|
46
|
+
|
47
|
+
A frameset instance provides one method
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
# Add a frame to be displayed, the duration will be determine by the number of
|
51
|
+
# frames in the frameset along with the duration and easing of the frameset
|
52
|
+
#
|
53
|
+
# @param name [String] (required) application defined name for the frame. The
|
54
|
+
# template factory will be provided this name
|
55
|
+
# @param args [Hash<Symbol, Object>] (optional) key/value pairs to send as
|
56
|
+
# arguments to the template factory
|
57
|
+
def add_frame(name, args:)
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
**IMPORTANT**: the keys in the `args` hash must be symbols!
|
62
|
+
|
63
|
+
### Example
|
64
|
+
|
65
|
+
Simple application that loads a set of numbers and looks for a pair that adds up to 1,000
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
class Application
|
69
|
+
def start(producer)
|
70
|
+
numbers = File.readlines('/path/to/numbers.txt').map(&:to_i)
|
71
|
+
producer.add_frame('load-numbers', duration: 3, args: { numbers: numbers })
|
72
|
+
numbers.sort!
|
73
|
+
producer.add_frame('sort-numbers', duration: 3, args: { numbers: numbers })
|
74
|
+
low = 0
|
75
|
+
high = numbers.length - 1
|
76
|
+
while low < high
|
77
|
+
sum = numbers[low] + numbers[high]
|
78
|
+
if sum == 1000
|
79
|
+
producer.add_frame('found-pair', duration: 5, args: { low: low, high: high, sum: sum })
|
80
|
+
return
|
81
|
+
elsif sum < 1000
|
82
|
+
producer.add_frame('too-low', args: { low: low, high: high, sum: sum })
|
83
|
+
low += 1
|
84
|
+
else
|
85
|
+
producer.add_frame('too-high', args: { low: low, high: high, sum: sum })
|
86
|
+
high -= 1
|
87
|
+
end
|
88
|
+
end
|
89
|
+
producer.add_frame('no-solution', duration: 5)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
```
|
data/doc/cli.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
## Full usage
|
2
|
+
|
3
|
+
```
|
4
|
+
Usage: whirled_peas <command> [command options]
|
5
|
+
|
6
|
+
Available commands:
|
7
|
+
|
8
|
+
debug Print template tree for specified frame
|
9
|
+
fonts List installed title fonts with sample text
|
10
|
+
frames Print out list of frames generated by application
|
11
|
+
help Show detailed help for a command
|
12
|
+
play Play an animation from an application or prerecorded file
|
13
|
+
record Record animation to a file
|
14
|
+
still Show the specified still frame
|
15
|
+
themes List all themes with sample template rendered in the theme
|
16
|
+
```
|
17
|
+
|
18
|
+
### `debug`
|
19
|
+
|
20
|
+
Print the template tree for specified frame.
|
21
|
+
|
22
|
+
```
|
23
|
+
# Usage: whirled_peas debug <config file> <frame> [args as a JSON string]
|
24
|
+
% whirled_peas debug my_app.rb greeting '{"name":"World"}'
|
25
|
+
* WhirledPeas::Graphics::BoxPainter(TEMPLATE)
|
26
|
+
- Dimensions(outer=140x27, content=120x15, grid=1x1)
|
27
|
+
- Settings
|
28
|
+
WhirledPeas::Settings::BoxSettings
|
29
|
+
padding: Padding(left: 10, top: 6, right: 10, bottom: 6)
|
30
|
+
align: :center
|
31
|
+
width: 120
|
32
|
+
flow: :t2b
|
33
|
+
bold: true
|
34
|
+
bg_color: BgColor(code=107, bright=true)
|
35
|
+
- Children
|
36
|
+
* WhirledPeas::Graphics::BoxPainter(Element-1)
|
37
|
+
- Dimensions(outer=64x6, content=64x6, grid=1x1)
|
38
|
+
```
|
39
|
+
|
40
|
+
### `fonts`
|
41
|
+
|
42
|
+
List all installed title fonts with sample text.
|
43
|
+
|
44
|
+
```
|
45
|
+
# Usage: whirled_peas fonts
|
46
|
+
```
|
47
|
+
|
48
|
+
### `frames`
|
49
|
+
|
50
|
+
Print out list of frames generated by application.
|
51
|
+
|
52
|
+
```
|
53
|
+
# Usage: whirled_peas frames <config file>
|
54
|
+
% whirled_peas frames my_app.rb
|
55
|
+
Frame 'intro' displayed for 3 second(s) '{"title":"Foo"}'
|
56
|
+
Frame 'greet' displayed for 0.3 second(s)
|
57
|
+
...
|
58
|
+
```
|
59
|
+
|
60
|
+
### `help`
|
61
|
+
|
62
|
+
Print out command-specific help message
|
63
|
+
|
64
|
+
```
|
65
|
+
Usage: whirled_peas help <command>
|
66
|
+
```
|
67
|
+
|
68
|
+
### `play`
|
69
|
+
|
70
|
+
Play an animation from an application or prerecorded file
|
71
|
+
|
72
|
+
```
|
73
|
+
# Usage: whirled_peas play <config/wpz file>
|
74
|
+
|
75
|
+
# Play animation directly from app
|
76
|
+
% whirled_peas play my_app.rb
|
77
|
+
# Animation plays
|
78
|
+
|
79
|
+
# Play animation from previously recorded file
|
80
|
+
% whirled_peas play my_animation.wpz
|
81
|
+
# Animation plays
|
82
|
+
```
|
83
|
+
|
84
|
+
### `record`
|
85
|
+
|
86
|
+
Record animation to a file
|
87
|
+
|
88
|
+
```
|
89
|
+
# Usage: whirled_peas record <config file> <output file>
|
90
|
+
% whirled_peas record my_app.rb my_animation.wpz
|
91
|
+
# Record animation to my_animation.wpz
|
92
|
+
```
|
93
|
+
|
94
|
+
### `still`
|
95
|
+
|
96
|
+
Show the specified still frame
|
97
|
+
|
98
|
+
```
|
99
|
+
# Usage: whirled_peas still <config file> <frame> [args as a JSON string]
|
100
|
+
% whirled_peas still my_app.rb greeting '{"name":"World"}'
|
101
|
+
# Still frame is displayed
|
102
|
+
```
|
103
|
+
|
104
|
+
### `themes`
|
105
|
+
|
106
|
+
List all themes and display a small sample screen in each. Running this with no extra command line arguments will display all the built-in themes. Adding the path to a Whirled Peas configuration file will inlcude any themes defined in that configuration.
|
107
|
+
|
108
|
+
```
|
109
|
+
# Usage: whirled_peas themes [config file]
|
110
|
+
% whirled_peas themes
|
111
|
+
# Display all system themes
|
112
|
+
|
113
|
+
% whirled_peas themes my_app.rb
|
114
|
+
# Display app-defined themes and all system themes
|
115
|
+
```
|
data/doc/components.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
## Components
|
2
|
+
|
3
|
+
A component is a composition of the core building blocks. This gem includes a handful of components and third parties can also add components using `WhirledPeas.register_component(name, component_class)` (the convention for `name` is a snake cased symbol). A component class must be constructed with no arguments, though can supply basic setters to allow for customizations. A component must also implement `#compose(composer, settings)`, which should attach elements to the composer. Thus a template can integrate with the component like
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
WhirledPeas.template do |composer, settings|
|
7
|
+
# Attach the component registered with the name `:my_component` to the template
|
8
|
+
WhirledPeas.component(composer, settings, :my_component) do |component|
|
9
|
+
# Configure the component
|
10
|
+
end
|
11
|
+
end
|
12
|
+
```
|
13
|
+
|
14
|
+
### `:list_with_active`
|
15
|
+
|
16
|
+
This component presents a list of content (either horizontally of vertically) and places the item specified by `active_index` in the preferred position.
|
17
|
+
|
18
|
+
```
|
19
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
20
|
+
┃ green, blue, *indigo*, viole┃
|
21
|
+
┃ ▗▄▄▄▄▄▄▄▄▄▄▄▄▄▄▖ ┃
|
22
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
23
|
+
```
|
24
|
+
|
25
|
+
Note: in the diagram above, the item specified by the active index is highlighted with `*`s, these are for illustration onlhy. The component can highlight the item with a color and/or background color, but will _not_ add the `*`s.
|
26
|
+
|
27
|
+
This component takes the following options
|
28
|
+
|
29
|
+
#### Required
|
30
|
+
|
31
|
+
- `active_index` - the index of the active item
|
32
|
+
- `items` - the array of items to be displayed in the box
|
33
|
+
|
34
|
+
#### Optional
|
35
|
+
|
36
|
+
- `active_bg_color` - background color of the active item
|
37
|
+
- `active_color` - text color of the active item
|
38
|
+
- `flow` - `:l2r` or `:t2b`
|
39
|
+
- `separator` - string used to separate items in the list, e.g. `", "` for a horizontal list or `"----"` for a vertical list
|
40
|
+
- `viewport_size` - number of characters of the viewport in the flow direction
|
41
|
+
|
42
|
+
### Example
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
WhirledPeas.template do |composer, settings|
|
46
|
+
WhirledPeas.component(composer, settings, :list_with_active) do |component|
|
47
|
+
component.items = %w[red orange yellow green blue indigo violet]
|
48
|
+
component.separator = ', '
|
49
|
+
component.active_index = active
|
50
|
+
component.viewport_size = 27
|
51
|
+
component.active_color = :blue
|
52
|
+
component.active_bg_color = :bright_yellow
|
53
|
+
end
|
54
|
+
end
|
55
|
+
```
|
data/doc/easing.md
ADDED
@@ -0,0 +1,257 @@
|
|
1
|
+
## Easing
|
2
|
+
|
3
|
+
The duration that a frame within a frameset is displayed is determined by the easing function and effect along with the frames relative position within the frameset. The three effects are
|
4
|
+
|
5
|
+
- `:in` - apply easing only to the start of the frameset
|
6
|
+
- `:out` - apply easing only to the end of the frameset
|
7
|
+
- `:in_out` - apply easing to the start and end of the frameset
|
8
|
+
|
9
|
+
The available easing functions are
|
10
|
+
|
11
|
+
- `:bezier`
|
12
|
+
|
13
|
+
```
|
14
|
+
# bezier (in)
|
15
|
+
┃ ▄▀
|
16
|
+
┃ ▄▄▀
|
17
|
+
┃ ▄▀
|
18
|
+
┃ ▄▀▀
|
19
|
+
┃ ▄▄▀
|
20
|
+
┃ ▄▄▀
|
21
|
+
┃ ▄▄▀
|
22
|
+
┃ ▄▀
|
23
|
+
┃ ▄▄▀▀
|
24
|
+
┃ ▄▄▀
|
25
|
+
┃ ▄▀▀
|
26
|
+
┃ ▄▄▀▀
|
27
|
+
┃ ▄▄▀▀▀
|
28
|
+
┃ ▄▄▄▀▀▀
|
29
|
+
┃▄▄▄▄▄▄▄▄▄▄▀▀▀
|
30
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
31
|
+
```
|
32
|
+
|
33
|
+
```
|
34
|
+
# bezier (out)
|
35
|
+
┃ ▄▄▄▀▀▀▀▀▀▀▀▀
|
36
|
+
┃ ▄▄▄▀▀▀
|
37
|
+
┃ ▄▄▄▀▀
|
38
|
+
┃ ▄▄▀▀
|
39
|
+
┃ ▄▄▀
|
40
|
+
┃ ▄▀▀
|
41
|
+
┃ ▄▄▀▀
|
42
|
+
┃ ▄▀
|
43
|
+
┃ ▄▀▀
|
44
|
+
┃ ▄▀▀
|
45
|
+
┃ ▄▀▀
|
46
|
+
┃ ▄▄▀
|
47
|
+
┃ ▄▀
|
48
|
+
┃ ▄▀▀
|
49
|
+
┃▄▄▀
|
50
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
51
|
+
```
|
52
|
+
|
53
|
+
```
|
54
|
+
# bezier (in_out)
|
55
|
+
┃ ▄▄▄▀▀▀▀▀▀
|
56
|
+
┃ ▄▄▀▀
|
57
|
+
┃ ▄▀▀
|
58
|
+
┃ ▄▀▀
|
59
|
+
┃ ▄▀▀
|
60
|
+
┃ ▄▀▀
|
61
|
+
┃ ▄▄▀
|
62
|
+
┃ ▄▀
|
63
|
+
┃ ▄▀▀
|
64
|
+
┃ ▄▄▀
|
65
|
+
┃ ▄▄▀
|
66
|
+
┃ ▄▄▀
|
67
|
+
┃ ▄▄▀
|
68
|
+
┃ ▄▄▀▀
|
69
|
+
┃▄▄▄▄▄▄▄▀▀▀
|
70
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
71
|
+
```
|
72
|
+
|
73
|
+
`:linear`
|
74
|
+
|
75
|
+
```
|
76
|
+
# linear (in)
|
77
|
+
┃ ▄▄▀
|
78
|
+
┃ ▄▄▀▀
|
79
|
+
┃ ▄▄▀▀
|
80
|
+
┃ ▄▄▀▀
|
81
|
+
┃ ▄▄▀▀
|
82
|
+
┃ ▄▄▀▀
|
83
|
+
┃ ▄▄▀▀
|
84
|
+
┃ ▄▄▀▀
|
85
|
+
┃ ▄▄▀▀
|
86
|
+
┃ ▄▄▀▀
|
87
|
+
┃ ▄▄▀▀
|
88
|
+
┃ ▄▄▀▀
|
89
|
+
┃ ▄▄▀▀
|
90
|
+
┃ ▄▄▀▀
|
91
|
+
┃▄▄▀▀
|
92
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
93
|
+
```
|
94
|
+
|
95
|
+
```
|
96
|
+
# linear (out)
|
97
|
+
┃ ▄▄▀
|
98
|
+
┃ ▄▄▀▀
|
99
|
+
┃ ▄▄▀▀
|
100
|
+
┃ ▄▄▀▀
|
101
|
+
┃ ▄▄▀▀
|
102
|
+
┃ ▄▄▀▀
|
103
|
+
┃ ▄▄▀▀
|
104
|
+
┃ ▄▄▀▀
|
105
|
+
┃ ▄▄▀▀
|
106
|
+
┃ ▄▄▀▀
|
107
|
+
┃ ▄▄▀▀
|
108
|
+
┃ ▄▄▀▀
|
109
|
+
┃ ▄▄▀▀
|
110
|
+
┃ ▄▄▀▀
|
111
|
+
┃▄▄▀▀
|
112
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
113
|
+
```
|
114
|
+
|
115
|
+
```
|
116
|
+
# linear (in_out)
|
117
|
+
┃ ▄▄▀
|
118
|
+
┃ ▄▄▀▀
|
119
|
+
┃ ▄▄▀▀
|
120
|
+
┃ ▄▄▀▀
|
121
|
+
┃ ▄▄▀▀
|
122
|
+
┃ ▄▄▀▀
|
123
|
+
┃ ▄▄▀▀
|
124
|
+
┃ ▄▄▀▀
|
125
|
+
┃ ▄▄▀▀
|
126
|
+
┃ ▄▄▀▀
|
127
|
+
┃ ▄▄▀▀
|
128
|
+
┃ ▄▄▀▀
|
129
|
+
┃ ▄▄▀▀
|
130
|
+
┃ ▄▄▀▀
|
131
|
+
┃▄▄▀▀
|
132
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
133
|
+
```
|
134
|
+
|
135
|
+
`:parametric`
|
136
|
+
|
137
|
+
```
|
138
|
+
# parametric (in)
|
139
|
+
┃ ▄
|
140
|
+
┃ ▄▀
|
141
|
+
┃ ▄▀
|
142
|
+
┃ ▄▄▀
|
143
|
+
┃ ▄▀
|
144
|
+
┃ ▄▀
|
145
|
+
┃ ▄▀
|
146
|
+
┃ ▄▄▀
|
147
|
+
┃ ▄▀
|
148
|
+
┃ ▄▀▀
|
149
|
+
┃ ▄▀▀
|
150
|
+
┃ ▄▄▀▀
|
151
|
+
┃ ▄▄▄▀▀
|
152
|
+
┃ ▄▄▄▄▀▀
|
153
|
+
┃▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
|
154
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
155
|
+
```
|
156
|
+
|
157
|
+
```
|
158
|
+
# parametric (out)
|
159
|
+
┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀
|
160
|
+
┃ ▄▄▀▀▀▀
|
161
|
+
┃ ▄▄▀▀▀
|
162
|
+
┃ ▄▄▀▀
|
163
|
+
┃ ▄▄▀
|
164
|
+
┃ ▄▄▀
|
165
|
+
┃ ▄▀
|
166
|
+
┃ ▄▀▀
|
167
|
+
┃ ▄▀
|
168
|
+
┃ ▄▀
|
169
|
+
┃ ▄▀
|
170
|
+
┃ ▄▀▀
|
171
|
+
┃ ▄▀
|
172
|
+
┃ ▄▀
|
173
|
+
┃▄▀
|
174
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
175
|
+
```
|
176
|
+
|
177
|
+
```
|
178
|
+
# parametric (in_out)
|
179
|
+
┃ ▄▄▄▀▀▀▀▀▀▀▀▀
|
180
|
+
┃ ▄▄▀▀
|
181
|
+
┃ ▄▀▀
|
182
|
+
┃ ▄▄▀
|
183
|
+
┃ ▄▀
|
184
|
+
┃ ▄▀
|
185
|
+
┃ ▄▀
|
186
|
+
┃ ▄▀
|
187
|
+
┃ ▄▀
|
188
|
+
┃ ▄▀
|
189
|
+
┃ ▄▀
|
190
|
+
┃ ▄▀▀
|
191
|
+
┃ ▄▄▀
|
192
|
+
┃ ▄▄▀▀
|
193
|
+
┃▄▄▄▄▄▄▄▄▄▄▀▀▀
|
194
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
195
|
+
```
|
196
|
+
|
197
|
+
`:quadratic`
|
198
|
+
|
199
|
+
```
|
200
|
+
# quadratic (in)
|
201
|
+
┃ ▄▄
|
202
|
+
┃ ▄▀
|
203
|
+
┃ ▄▀
|
204
|
+
┃ ▄▀
|
205
|
+
┃ ▄▀
|
206
|
+
┃ ▄▀▀
|
207
|
+
┃ ▄▀
|
208
|
+
┃ ▄▀▀
|
209
|
+
┃ ▄▀▀
|
210
|
+
┃ ▄▀▀
|
211
|
+
┃ ▄▄▀▀
|
212
|
+
┃ ▄▄▀▀
|
213
|
+
┃ ▄▄▄▀▀
|
214
|
+
┃ ▄▄▄▀▀▀
|
215
|
+
┃▄▄▄▄▄▄▄▄▄▄▄▀▀▀▀▀
|
216
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
217
|
+
```
|
218
|
+
|
219
|
+
```
|
220
|
+
# quadratic (out)
|
221
|
+
┃ ▄▄▄▄▄▀▀▀▀▀▀▀▀▀▀
|
222
|
+
┃ ▄▄▄▀▀▀
|
223
|
+
┃ ▄▄▀▀▀
|
224
|
+
┃ ▄▄▀▀
|
225
|
+
┃ ▄▄▀▀
|
226
|
+
┃ ▄▄▀
|
227
|
+
┃ ▄▄▀
|
228
|
+
┃ ▄▄▀
|
229
|
+
┃ ▄▀
|
230
|
+
┃ ▄▄▀
|
231
|
+
┃ ▄▀
|
232
|
+
┃ ▄▀
|
233
|
+
┃ ▄▀
|
234
|
+
┃ ▄▀
|
235
|
+
┃▄▀▀
|
236
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
237
|
+
```
|
238
|
+
|
239
|
+
```
|
240
|
+
# quadratic (in_out)
|
241
|
+
┃ ▄▄▄▀▀▀▀▀▀▀
|
242
|
+
┃ ▄▄▀▀▀
|
243
|
+
┃ ▄▀▀
|
244
|
+
┃ ▄▀▀
|
245
|
+
┃ ▄▄▀
|
246
|
+
┃ ▄▀
|
247
|
+
┃ ▄▀
|
248
|
+
┃ ▄▀
|
249
|
+
┃ ▄▀
|
250
|
+
┃ ▄▀
|
251
|
+
┃ ▄▀▀
|
252
|
+
┃ ▄▄▀
|
253
|
+
┃ ▄▄▀
|
254
|
+
┃ ▄▄▄▀▀
|
255
|
+
┃▄▄▄▄▄▄▄▄▀▀▀
|
256
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
257
|
+
```
|