vedeu 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/docs/api.md +0 -357
  3. data/docs/configuration.md +1 -1
  4. data/docs/dsl/by_method/add_command.md +5 -0
  5. data/docs/dsl/by_method/add_keypress.md +4 -0
  6. data/docs/dsl/by_method/all_commands.md +3 -0
  7. data/docs/dsl/by_method/all_keypresses.md +3 -0
  8. data/docs/dsl/by_method/background_colours.md +4 -0
  9. data/docs/dsl/by_method/bind.md +43 -0
  10. data/docs/dsl/by_method/bind_alias.md +4 -0
  11. data/docs/dsl/by_method/borders.md +6 -0
  12. data/docs/dsl/by_method/bound.md +3 -0
  13. data/docs/dsl/by_method/buffer_update.md +1 -0
  14. data/docs/dsl/by_method/buffer_write.md +1 -0
  15. data/docs/dsl/by_method/buffers.md +5 -0
  16. data/docs/dsl/by_method/clear_by_group.md +1 -0
  17. data/docs/dsl/by_method/clear_by_name.md +1 -0
  18. data/docs/dsl/by_method/clear_content_by_name.md +1 -0
  19. data/docs/dsl/by_method/clock_time.md +1 -0
  20. data/docs/dsl/by_method/cursor.md +1 -0
  21. data/docs/dsl/by_method/cursors.md +1 -0
  22. data/docs/dsl/by_method/direct_write.md +1 -0
  23. data/docs/dsl/by_method/documents.md +1 -0
  24. data/docs/dsl/by_method/drb_restart.md +1 -0
  25. data/docs/dsl/by_method/drb_start.md +1 -0
  26. data/docs/dsl/by_method/drb_status.md +1 -0
  27. data/docs/dsl/by_method/drb_stop.md +1 -0
  28. data/docs/dsl/by_method/events.md +1 -0
  29. data/docs/dsl/by_method/exit.md +1 -0
  30. data/docs/dsl/by_method/focus.md +1 -0
  31. data/docs/dsl/by_method/focus_by_name.md +1 -0
  32. data/docs/dsl/by_method/focus_next.md +1 -0
  33. data/docs/dsl/by_method/focus_previous.md +1 -0
  34. data/docs/dsl/by_method/focussed.md +1 -0
  35. data/docs/dsl/by_method/geometries.md +1 -0
  36. data/docs/dsl/by_method/geometry.md +1 -0
  37. data/docs/dsl/by_method/goto.md +5 -6
  38. data/docs/dsl/by_method/group.md +1 -0
  39. data/docs/dsl/by_method/groups.md +1 -0
  40. data/docs/dsl/by_method/hide_cursor.md +1 -0
  41. data/docs/dsl/by_method/hide_group.md +1 -0
  42. data/docs/dsl/by_method/hide_interface.md +1 -0
  43. data/docs/dsl/by_method/interface.md +1 -0
  44. data/docs/dsl/by_method/interfaces.md +1 -0
  45. data/docs/dsl/by_method/keymap.md +1 -0
  46. data/docs/dsl/by_method/keymap/interface.md +1 -0
  47. data/docs/dsl/by_method/keymap/key.md +1 -0
  48. data/docs/dsl/by_method/keymap/name.md +1 -0
  49. data/docs/dsl/by_method/keymaps.md +1 -0
  50. data/docs/dsl/by_method/last_command.md +4 -0
  51. data/docs/dsl/by_method/last_keypress.md +4 -0
  52. data/docs/dsl/by_method/log.md +1 -0
  53. data/docs/dsl/by_method/log_stderr.md +1 -0
  54. data/docs/dsl/by_method/log_stdout.md +1 -0
  55. data/docs/dsl/by_method/log_timestamp.md +1 -0
  56. data/docs/dsl/by_method/menu.md +1 -0
  57. data/docs/dsl/by_method/menus.md +1 -0
  58. data/docs/dsl/by_method/read.md +33 -0
  59. data/docs/dsl/by_method/ready.md +1 -0
  60. data/docs/dsl/by_method/render.md +1 -0
  61. data/docs/dsl/by_method/render_output.md +1 -0
  62. data/docs/dsl/by_method/renderer.md +1 -0
  63. data/docs/dsl/by_method/renderers.md +1 -0
  64. data/docs/dsl/by_method/renders.md +1 -0
  65. data/docs/dsl/by_method/show_cursor.md +1 -0
  66. data/docs/dsl/by_method/show_group.md +1 -0
  67. data/docs/dsl/by_method/show_interface.md +1 -0
  68. data/docs/dsl/by_method/toggle_cursor.md +1 -0
  69. data/docs/dsl/by_method/toggle_group.md +1 -0
  70. data/docs/dsl/by_method/toggle_interface.md +1 -0
  71. data/docs/dsl/by_method/trigger.md +1 -0
  72. data/docs/dsl/by_method/unbind.md +5 -0
  73. data/docs/dsl/by_method/unbind_alias.md +4 -0
  74. data/docs/dsl/by_method/views.md +1 -0
  75. data/docs/dsl/by_method/write.md +5 -0
  76. data/examples/views/lines_streams.rb +45 -0
  77. data/lib/vedeu/application/application_view.rb +1 -1
  78. data/lib/vedeu/borders/border.rb +2 -2
  79. data/lib/vedeu/cells/border.rb +1 -1
  80. data/lib/vedeu/cells/borders/bottom_horizontal.rb +1 -1
  81. data/lib/vedeu/cells/borders/bottom_left.rb +1 -1
  82. data/lib/vedeu/cells/borders/bottom_right.rb +1 -1
  83. data/lib/vedeu/cells/borders/horizontal.rb +1 -1
  84. data/lib/vedeu/cells/borders/left_vertical.rb +1 -1
  85. data/lib/vedeu/cells/borders/right_vertical.rb +1 -1
  86. data/lib/vedeu/cells/borders/top_horizontal.rb +1 -1
  87. data/lib/vedeu/cells/borders/top_left.rb +1 -1
  88. data/lib/vedeu/cells/borders/top_right.rb +1 -1
  89. data/lib/vedeu/cells/borders/vertical.rb +1 -1
  90. data/lib/vedeu/colours/background.rb +1 -1
  91. data/lib/vedeu/colours/foreground.rb +1 -1
  92. data/lib/vedeu/colours/translator.rb +4 -7
  93. data/lib/vedeu/colours/validator.rb +1 -1
  94. data/lib/vedeu/configuration/api.rb +1 -1
  95. data/lib/vedeu/configuration/configuration.rb +20 -11
  96. data/lib/vedeu/cursors/cursor.rb +2 -2
  97. data/lib/vedeu/distributed/server.rb +7 -7
  98. data/lib/vedeu/dsl/views.rb +1 -1
  99. data/lib/vedeu/esc/background.rb +1 -1
  100. data/lib/vedeu/esc/colours.rb +3 -0
  101. data/lib/vedeu/esc/esc.rb +11 -25
  102. data/lib/vedeu/esc/mouse.rb +14 -0
  103. data/lib/vedeu/events/aliases.rb +2 -13
  104. data/lib/vedeu/events/event.rb +2 -13
  105. data/lib/vedeu/input/read.rb +3 -3
  106. data/lib/vedeu/input/store.rb +6 -37
  107. data/lib/vedeu/interfaces/interface.rb +1 -1
  108. data/lib/vedeu/logging/debug.rb +1 -1
  109. data/lib/vedeu/logging/log.rb +6 -17
  110. data/lib/vedeu/logging/timer.rb +1 -1
  111. data/lib/vedeu/models/row.rb +1 -1
  112. data/lib/vedeu/output/write.rb +1 -3
  113. data/lib/vedeu/presentation/style.rb +1 -3
  114. data/lib/vedeu/renderers/all.rb +2 -2
  115. data/lib/vedeu/renderers/file.rb +1 -1
  116. data/lib/vedeu/renderers/options.rb +1 -1
  117. data/lib/vedeu/runtime/application.rb +10 -19
  118. data/lib/vedeu/runtime/bootstrap.rb +4 -4
  119. data/lib/vedeu/runtime/launcher.rb +3 -5
  120. data/lib/vedeu/terminal/mode.rb +1 -1
  121. data/lib/vedeu/terminal/terminal.rb +9 -10
  122. data/lib/vedeu/version.rb +1 -1
  123. data/lib/vedeu/views/char.rb +1 -1
  124. data/lib/vedeu/views/view.rb +1 -1
  125. data/test/lib/vedeu/colours/background_test.rb +1 -1
  126. data/test/lib/vedeu/configuration/api_test.rb +1 -1
  127. data/test/lib/vedeu/cursors/cursor_test.rb +2 -5
  128. data/test/lib/vedeu/distributed/server_test.rb +2 -2
  129. data/test/lib/vedeu/esc/mouse_test.rb +29 -1
  130. data/test/lib/vedeu/logging/timer_test.rb +2 -2
  131. data/test/lib/vedeu/renderers/html_test.rb +1 -1
  132. data/test/lib/vedeu/renderers/json_test.rb +1 -1
  133. data/test/lib/vedeu/renderers/options_test.rb +4 -4
  134. data/test/lib/vedeu/runtime/application_test.rb +4 -9
  135. data/test/lib/vedeu/runtime/bootstrap_test.rb +1 -1
  136. data/test/lib/vedeu/runtime/launcher_test.rb +1 -1
  137. data/test/lib/vedeu/terminal/mode_test.rb +5 -5
  138. data/test/lib/vedeu/terminal/terminal_test.rb +2 -2
  139. data/test/support/examples/material_colours_app.rb +2 -5
  140. data/test/test_helper.rb +1 -1
  141. metadata +5 -3
  142. data/examples/views/lines_streams_stream.rb +0 -48
@@ -0,0 +1,3 @@
1
+ Returns an array of all keypresses received by Vedeu.
2
+
3
+ Vedeu.all_keypresses
@@ -1,3 +1,7 @@
1
1
  Manipulate the repository of background colours.
2
2
 
3
3
  Vedeu.background_colours
4
+
5
+ Vedeu.background_colours # => [Vedeu::Colours::Backgrounds]
6
+
7
+ Vedeu.background_colours.all # => [Hash<String => String>]
@@ -0,0 +1,43 @@
1
+ Register an event by name with optional delay (throttling)
2
+ which when triggered will execute the code contained within
3
+ the passed block.
4
+
5
+ @param name [Symbol] The name of the event to be triggered
6
+ later.
7
+ @param options [Hash<Symbol => void>] The options to
8
+ register the event with.
9
+ @option options :delay [Fixnum|Float] Limits the execution
10
+ of the triggered event to only execute when first
11
+ triggered, with subsequent triggering being ignored until
12
+ the delay has expired.
13
+ @option options :debounce [Fixnum|Float] Limits the
14
+ execution of the triggered event to only execute once the
15
+ debounce has expired. Subsequent triggers before debounce
16
+ expiry are ignored.
17
+ @param block [Proc] The event to be executed when triggered.
18
+ This block could be a method call, or the triggering of
19
+ another event, or sequence of either/both.
20
+
21
+ Vedeu.bind :my_event do |some, args|
22
+ # ... some code here ...
23
+ Vedeu.trigger(:my_other_event)
24
+ end
25
+
26
+ T = Triggered, X = Executed, i = Ignored.
27
+ 0.0.....0.2.....0.4.....0.6.....0.8.....1.0.....1.2.....1.4.....1.6.
28
+ .T...T...T...T...T...T...T...T...T...T...T...T...T...T...T...T...T..
29
+ .X...i...i...i...i...X...i...i...i...i...X...i...i...i...i...i...i..
30
+
31
+ Vedeu.bind(:my_delayed_event, { delay: 0.5 })
32
+ # ... some code here ...
33
+ end
34
+
35
+ T = Triggered, X = Executed, i = Ignored.
36
+ 0.0.....0.2.....0.4.....0.6.....0.8.....1.0.....1.2.....1.4.....1.6.
37
+ .T...T...T...T...T...T...T...T...T...T...T...T...T...T...T...T...T..
38
+ .i...i...i...i...i...i...i...X...i...i...i...i...i...i...X...i...i..
39
+
40
+ Vedeu.bind(:my_debounced_event, { debounce: 0.7 })
41
+ # ... some code here ...
42
+ end
43
+
@@ -0,0 +1,4 @@
1
+ Add events by name to the alias name group. When an alias is
2
+ triggered, all the events stored in the group are also triggered.
3
+
4
+ Vedeu.bind_alias(alias_name, event_name)
@@ -0,0 +1,6 @@
1
+ Repository method. Access registered borders.
2
+
3
+ Vedeu.borders # [Vedeu::Borders::Repository]
4
+
5
+ Vedeu.borders.all # [Array<Vedeu::Borders::Border>]
6
+
@@ -0,0 +1,3 @@
1
+ Check if an event by name has been registered.
2
+
3
+ Vedeu.bound?(:some_event)
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1,5 @@
1
+ Repository method. Access registered borders.
2
+
3
+ Vedeu.buffers # [Vedeu::Buffers::Repository]
4
+
5
+ Vedeu.buffers.all # [Array<Vedeu::Buffers::Buffer>]
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -1,6 +1,5 @@
1
- # Instruct Vedeu to load the client application controller
2
- # action with parameters.
3
- #
4
- # @example
5
- # Vedeu.goto(controller, action, args)
6
- #
1
+ Instruct Vedeu to load the client application controller action with
2
+ parameters.
3
+
4
+ Vedeu.goto(controller, action, args)
5
+
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1,4 @@
1
+ Access the last command stored. If no commands have been entered since
2
+ the client application started, then this will return nil.
3
+
4
+ Vedeu.last_command
@@ -0,0 +1,4 @@
1
+ Access the last keypress stored. If no keys have been pressed since
2
+ the client application started, then this will return nil.
3
+
4
+ Vedeu.last_keypress
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1,33 @@
1
+ ### Vedeu.read
2
+
3
+ This allows the direct reading from the terminal, unencumbered by the
4
+ framework.
5
+
6
+ Vedeu.read("some input here") # => programmatic cooked mode
7
+ # (default)
8
+
9
+ Vedeu.read("\e[24;2~", mode: :raw) # => programmatic raw mode
10
+ # (provides :shift_f12 in
11
+ # this example)
12
+
13
+ Vedeu.read(nil, mode: :raw) # => for a single keypress
14
+
15
+ Vedeu.read(nil, mode: :cooked) # => (default mode) for a 'line at
16
+ # a time' (pressing 'return'
17
+ # ends the line)
18
+
19
+ The way that these are used will depend on the mode your terminal is currently set to. Vedeu by default sets this to `:raw` (single character, hidden cursor). `Vedeu.read` by default expects the terminal to be in `:cooked` mode unless you provide the `mode: :raw` option.
20
+
21
+ - In `:cooked` mode (default), it will trigger a `:_command_` event
22
+ with the input provided, meaning you should bind to :command to
23
+ receive the input.
24
+ - In `:raw` mode, it will trigger a `:_keypress_` event with the input
25
+ provided, meaning you should bind to `:key` to receive the input.
26
+
27
+ You can also access the input given using the API methods:
28
+
29
+ Vedeu.all_commands
30
+ Vedeu.all_keypresses
31
+ Vedeu.last_command
32
+ Vedeu.last_keypress
33
+
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1,5 @@
1
+ Unbind events from a named handler.
2
+
3
+ Removes all events associated with the given name.
4
+
5
+ Vedeu.unbind(:some_event)
@@ -0,0 +1,4 @@
1
+ Remove an alias by name. The alias name group is destroyed, but events
2
+ stored within this alias are not.
3
+
4
+ Vedeu.unbind_alias(alias_name)
@@ -0,0 +1 @@
1
+ @todo Add more documentation.
@@ -0,0 +1,5 @@
1
+ This allows the direct writing to the terminal, unencumbered by the
2
+ framework.
3
+
4
+ @todo Add more documentation.
5
+
@@ -28,6 +28,36 @@ class DSLApp
28
28
  end
29
29
  end
30
30
 
31
+ Vedeu.interface :help1_interface do
32
+ geometry do
33
+ x use(:test1_interface).x
34
+ y use(:test1_interface).south
35
+ xn use(:test1_interface).xn
36
+ yn use(:test1_interface).south(3)
37
+ end
38
+ end
39
+
40
+ Vedeu.interface :test2_interface do
41
+ border do
42
+ title 'Test 2'
43
+ end
44
+ geometry do
45
+ x use(:test1_interface).east(6)
46
+ y use(:test1_interface).y
47
+ width use(:test1_interface).width
48
+ height use(:test1_interface).height
49
+ end
50
+ end
51
+
52
+ Vedeu.interface :help2_interface do
53
+ geometry do
54
+ x use(:test2_interface).x
55
+ y use(:test2_interface).south
56
+ xn use(:test2_interface).xn
57
+ yn use(:test2_interface).south(3)
58
+ end
59
+ end
60
+
31
61
  Vedeu.render do
32
62
  view(:test1_interface) do
33
63
  lines do
@@ -37,6 +67,21 @@ class DSLApp
37
67
  end
38
68
  end
39
69
  end
70
+
71
+ view(:help1_interface) do
72
+ end
73
+
74
+ view(:test2_interface) do
75
+ lines do
76
+ streams do
77
+ stream 'v->ls->ss->stream 1', { foreground: '#00ff00' }
78
+ stream 'v->ls->ss->stream 2', { foreground: '#ff0000' }
79
+ end
80
+ end
81
+ end
82
+
83
+ view(:help2_interface) do
84
+ end
40
85
  end
41
86
 
42
87
  def self.start(argv = ARGV)
@@ -52,7 +52,7 @@ module Vedeu
52
52
  # @param value [String]
53
53
  # @return [String]
54
54
  def template(value)
55
- @template = Vedeu::Configuration.base_path +
55
+ @template = Vedeu.config.base_path +
56
56
  "/app/views/templates/#{value}.erb"
57
57
  end
58
58
 
@@ -302,7 +302,7 @@ module Vedeu
302
302
  client: nil,
303
303
  colour: nil,
304
304
  enabled: false,
305
- horizontal: Vedeu::EscapeSequences::Borders.horizontal,
305
+ horizontal: Vedeu.esc.horizontal,
306
306
  left_vertical: nil,
307
307
  name: '',
308
308
  parent: nil,
@@ -317,7 +317,7 @@ module Vedeu
317
317
  top_horizontal: nil,
318
318
  top_left: nil,
319
319
  top_right: nil,
320
- vertical: Vedeu::EscapeSequences::Borders.vertical,
320
+ vertical: Vedeu.esc.vertical,
321
321
  }
322
322
  end
323
323
 
@@ -46,7 +46,7 @@ module Vedeu
46
46
  def value
47
47
  return '' unless present?(@value)
48
48
 
49
- Vedeu::EscapeSequences::Esc.border { @value }
49
+ Vedeu.esc.border { @value }
50
50
  end
51
51
 
52
52
  private
@@ -20,7 +20,7 @@ module Vedeu
20
20
 
21
21
  # @return [Hash<Symbol => String>]
22
22
  def defaults
23
- super.merge!(value: Vedeu::EscapeSequences::Borders.horizontal)
23
+ super.merge!(value: Vedeu.esc.horizontal)
24
24
  end
25
25
 
26
26
  end # BottomHorizontal
@@ -21,7 +21,7 @@ module Vedeu
21
21
  # @return [Hash<Symbol => String>]
22
22
  def defaults
23
23
  super.merge!(position: Vedeu::Geometries::Position.coerce([yn, x]),
24
- value: Vedeu::EscapeSequences::Borders.bottom_left)
24
+ value: Vedeu.esc.bottom_left)
25
25
  end
26
26
 
27
27
  end # BottomLeft