vedeu 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO.md +4 -0
- data/docs/dsl.md +1 -11
- data/docs/dsl/by_method/geometry/align.md +1 -0
- data/docs/dsl/by_method/geometry/align_bottom.md +40 -0
- data/docs/dsl/by_method/geometry/align_centre.md +40 -0
- data/docs/dsl/by_method/geometry/align_left.md +40 -0
- data/docs/dsl/by_method/geometry/align_middle.md +40 -0
- data/docs/dsl/by_method/geometry/align_right.md +40 -0
- data/docs/dsl/by_method/geometry/align_top.md +40 -0
- data/docs/dsl/by_method/geometry/columns.md +1 -0
- data/docs/dsl/by_method/geometry/height.md +0 -0
- data/docs/dsl/by_method/geometry/horizontal_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/rows.md +1 -0
- data/docs/dsl/by_method/geometry/vertical_alignment.md +1 -0
- data/docs/dsl/by_method/geometry/width.md +0 -0
- data/docs/dsl/by_method/geometry/x.md +1 -0
- data/docs/dsl/by_method/geometry/xn.md +1 -0
- data/docs/dsl/by_method/geometry/y.md +1 -0
- data/docs/dsl/by_method/geometry/yn.md +1 -0
- data/docs/dsl/by_method/render.md +5 -1
- data/docs/dsl/by_method/renders.md +31 -1
- data/docs/dsl/by_method/view.md +26 -0
- data/docs/dsl/by_method/view/stream.md +18 -0
- data/docs/dsl/by_method/views.md +32 -1
- data/docs/events/by_name/set_border_caption.md +2 -4
- data/docs/events/by_name/set_border_title.md +2 -4
- data/examples/views/empty_template.rb +0 -4
- data/examples/views/full_screen.rb +30 -5
- data/examples/views/misc_view.rb +464 -0
- data/examples/views/wordwrap.rb +72 -0
- data/examples/views/wordwrap.txt +8 -0
- data/integrations/dsl_app_021.rb +127 -0
- data/integrations/dsl_app_022.rb +133 -0
- data/integrations/expected/342_streams.out +1 -1
- data/integrations/expected/dsl_app_001.out +1 -1
- data/integrations/expected/dsl_app_002.out +1 -1
- data/integrations/expected/dsl_app_003.out +1 -1
- data/integrations/expected/dsl_app_004.out +1 -1
- data/integrations/expected/dsl_app_005.out +1 -1
- data/integrations/expected/dsl_app_006.out +1 -1
- data/integrations/expected/dsl_app_007.out +1 -1
- data/integrations/expected/dsl_app_008.out +1 -1
- data/integrations/expected/dsl_app_009.out +1 -1
- data/integrations/expected/dsl_app_010.out +1 -1
- data/integrations/expected/dsl_app_011.out +1 -1
- data/integrations/expected/dsl_app_012.out +1 -1
- data/integrations/expected/dsl_app_013.out +1 -1
- data/integrations/expected/dsl_app_014.out +1 -1
- data/integrations/expected/dsl_app_015.out +1 -1
- data/integrations/expected/dsl_app_016.out +1 -1
- data/integrations/expected/dsl_app_021.out +1 -0
- data/integrations/expected/dsl_app_022.out +1 -0
- data/integrations/support/test_interface_021.rb +7 -0
- data/integrations/support/test_interface_022.rb +15 -0
- data/lib/vedeu/all.rb +4 -2
- data/lib/vedeu/borders/border.rb +22 -6
- data/lib/vedeu/borders/repository.rb +4 -8
- data/lib/vedeu/buffers/buffer.rb +9 -6
- data/lib/vedeu/buffers/empty.rb +26 -23
- data/lib/vedeu/buffers/view.rb +44 -41
- data/lib/vedeu/cells/cursor.rb +0 -2
- data/lib/vedeu/cells/empty.rb +0 -1
- data/lib/vedeu/cells/escape.rb +0 -2
- data/lib/vedeu/coercers/alignment.rb +58 -8
- data/lib/vedeu/coercers/horizontal_alignment.rb +13 -9
- data/lib/vedeu/coercers/vertical_alignment.rb +13 -8
- data/lib/vedeu/common.rb +1 -1
- data/lib/vedeu/configuration/configuration.rb +41 -3
- data/lib/vedeu/cursors/coordinate.rb +1 -3
- data/lib/vedeu/cursors/cursor.rb +2 -6
- data/lib/vedeu/dsl/all.rb +1 -2
- data/lib/vedeu/dsl/border.rb +6 -6
- data/lib/vedeu/dsl/elements.rb +2 -2
- data/lib/vedeu/dsl/geometry.rb +7 -7
- data/lib/vedeu/dsl/{string → helpers}/align.rb +0 -0
- data/lib/vedeu/dsl/helpers/all.rb +17 -0
- data/lib/vedeu/dsl/{attributes.rb → helpers/attributes.rb} +0 -0
- data/lib/vedeu/dsl/{string → helpers}/text.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/truncate.rb +0 -0
- data/lib/vedeu/dsl/{string → helpers}/wordwrap.rb +0 -0
- data/lib/vedeu/dsl/view.rb +11 -19
- data/lib/vedeu/dsl/views.rb +16 -106
- data/lib/vedeu/geometries/all.rb +0 -1
- data/lib/vedeu/geometries/area/area.rb +6 -12
- data/lib/vedeu/geometries/area/dimension.rb +21 -44
- data/lib/vedeu/geometries/dsl/all.rb +0 -1
- data/lib/vedeu/geometries/dsl/dsl.rb +22 -31
- data/lib/vedeu/geometries/geometry.rb +6 -0
- data/lib/vedeu/geometries/position.rb +6 -3
- data/lib/vedeu/geometries/repository.rb +1 -1
- data/lib/vedeu/input/mouse.rb +1 -0
- data/lib/vedeu/logging/log.rb +3 -6
- data/lib/vedeu/menus/dsl.rb +4 -5
- data/lib/vedeu/output/compressor.rb +11 -1
- data/lib/vedeu/output/viewport.rb +59 -59
- data/lib/vedeu/presentation/all.rb +1 -2
- data/lib/vedeu/presentation/colour.rb +75 -3
- data/lib/vedeu/{geometries/positionable.rb → presentation/position.rb} +4 -4
- data/lib/vedeu/presentation/presentation.rb +1 -3
- data/lib/vedeu/presentation/styles.rb +16 -1
- data/lib/vedeu/repositories/all.rb +0 -1
- data/lib/vedeu/sentence.rb +91 -0
- data/lib/vedeu/support/point.rb +72 -0
- data/lib/vedeu/terminal/terminal.rb +11 -53
- data/lib/vedeu/version.rb +1 -1
- data/lib/vedeu/views/composition.rb +11 -1
- data/lib/vedeu/views/default_attributes.rb +2 -0
- data/lib/vedeu/views/line.rb +16 -1
- data/lib/vedeu/views/stream.rb +16 -1
- data/lib/vedeu/views/view.rb +25 -17
- data/test/lib/vedeu/borders/border_test.rb +20 -2
- data/test/lib/vedeu/buffers/buffer_test.rb +15 -2
- data/test/lib/vedeu/buffers/empty_test.rb +51 -18
- data/test/lib/vedeu/buffers/view_test.rb +2 -2
- data/test/lib/vedeu/coercers/alignment_test.rb +32 -0
- data/test/lib/vedeu/coercers/horizontal_alignment_test.rb +16 -0
- data/test/lib/vedeu/coercers/vertical_alignment_test.rb +16 -0
- data/test/lib/vedeu/cursors/cursor_test.rb +4 -4
- data/test/lib/vedeu/cursors/dsl_test.rb +35 -21
- data/test/lib/vedeu/dsl/elements_test.rb +94 -2
- data/test/lib/vedeu/dsl/{string → helpers}/align_test.rb +0 -0
- data/test/lib/vedeu/dsl/{attributes_test.rb → helpers/attributes_test.rb} +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/text_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/truncate_test.rb +0 -0
- data/test/lib/vedeu/dsl/{string → helpers}/wordwrap_test.rb +0 -0
- data/test/lib/vedeu/dsl/view_test.rb +22 -4
- data/test/lib/vedeu/dsl/views_test.rb +8 -5
- data/test/lib/vedeu/geometries/dsl/dsl_test.rb +2 -159
- data/test/lib/vedeu/geometries/position_test.rb +118 -60
- data/test/lib/vedeu/input/mouse_test.rb +1 -6
- data/test/lib/vedeu/logging/log_test.rb +14 -3
- data/test/lib/vedeu/presentation/colour_test.rb +77 -0
- data/test/lib/vedeu/{geometries/positionable_test.rb → presentation/position_test.rb} +4 -4
- data/test/lib/vedeu/sentence_test.rb +49 -0
- data/test/lib/vedeu/support/point_test.rb +139 -0
- data/test/lib/vedeu/terminal/terminal_test.rb +3 -44
- data/test/lib/vedeu/views/composition_test.rb +24 -4
- data/test/lib/vedeu/views/default_attributes_test.rb +10 -2
- data/test/lib/vedeu/views/view_test.rb +8 -15
- data/test/support/examples/material_colours_app.rb +0 -6
- data/vedeu.gemspec +1 -1
- metadata +58 -38
- data/examples/views/lines_line_stream.rb +0 -95
- data/examples/views/lines_line_streams.rb +0 -75
- data/examples/views/lines_line_streams_stream.rb +0 -78
- data/examples/views/lines_line_streams_stream_stream.rb +0 -50
- data/examples/views/lines_streams.rb +0 -93
- data/lib/vedeu/dsl/string/all.rb +0 -16
- data/lib/vedeu/geometries/dsl/validator.rb +0 -62
- data/lib/vedeu/presentation/background.rb +0 -54
- data/lib/vedeu/presentation/foreground.rb +0 -54
- data/lib/vedeu/repositories/parent.rb +0 -34
- data/test/lib/vedeu/geometries/dsl/validator_test.rb +0 -85
- data/test/lib/vedeu/presentation/background_test.rb +0 -74
- data/test/lib/vedeu/presentation/foreground_test.rb +0 -75
@@ -1,75 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require 'bundler/setup'
|
6
|
-
require 'vedeu'
|
7
|
-
|
8
|
-
class DSLApp
|
9
|
-
|
10
|
-
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
11
|
-
|
12
|
-
Vedeu.configure do
|
13
|
-
debug!
|
14
|
-
log '/tmp/vedeu_views_dsl.log'
|
15
|
-
run_once!
|
16
|
-
standalone!
|
17
|
-
end
|
18
|
-
|
19
|
-
Vedeu.interface :test1_interface do
|
20
|
-
border do
|
21
|
-
title 'Test 1'
|
22
|
-
end
|
23
|
-
geometry do
|
24
|
-
x 4
|
25
|
-
y 3
|
26
|
-
xn 34
|
27
|
-
yn 8
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Vedeu.interface :test2_interface do
|
32
|
-
border do
|
33
|
-
title 'Test 2'
|
34
|
-
end
|
35
|
-
geometry do
|
36
|
-
x 36
|
37
|
-
y 3
|
38
|
-
xn 66
|
39
|
-
yn 8
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Vedeu.keymap '_global_' do
|
44
|
-
key('q') { Vedeu.exit }
|
45
|
-
end
|
46
|
-
|
47
|
-
Vedeu.render do
|
48
|
-
view(:test1_interface) do
|
49
|
-
lines do
|
50
|
-
line do
|
51
|
-
streams do
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
view(:test2_interface) do
|
58
|
-
lines do
|
59
|
-
line do
|
60
|
-
streams do
|
61
|
-
text 'v->ls->l->ss->text 1', { foreground: '#00ffff' }
|
62
|
-
text 'v->ls->l->ss->text 2', { foreground: '#ffff00' }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def self.start(argv = ARGV)
|
70
|
-
Vedeu::Launcher.execute!(argv)
|
71
|
-
end
|
72
|
-
|
73
|
-
end # DSLApp
|
74
|
-
|
75
|
-
DSLApp.start
|
@@ -1,78 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require 'bundler/setup'
|
6
|
-
require 'vedeu'
|
7
|
-
|
8
|
-
class DSLApp
|
9
|
-
|
10
|
-
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
11
|
-
|
12
|
-
Vedeu.configure do
|
13
|
-
debug!
|
14
|
-
log '/tmp/vedeu_views_dsl.log'
|
15
|
-
run_once!
|
16
|
-
standalone!
|
17
|
-
end
|
18
|
-
|
19
|
-
Vedeu.interface :test1_interface do
|
20
|
-
border do
|
21
|
-
title 'Test 1'
|
22
|
-
end
|
23
|
-
geometry do
|
24
|
-
x 4
|
25
|
-
y 3
|
26
|
-
xn 34
|
27
|
-
yn 8
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Vedeu.interface :test2_interface do
|
32
|
-
border do
|
33
|
-
title 'Test 2'
|
34
|
-
end
|
35
|
-
geometry do
|
36
|
-
x 36
|
37
|
-
y 3
|
38
|
-
xn 66
|
39
|
-
yn 8
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
Vedeu.render do
|
44
|
-
view(:test1_interface) do
|
45
|
-
lines do
|
46
|
-
line do
|
47
|
-
streams do
|
48
|
-
stream 'test 1', { foreground: '#00ff00' }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
view(:test2_interface) do
|
55
|
-
lines do
|
56
|
-
line do
|
57
|
-
streams do
|
58
|
-
stream do
|
59
|
-
text 'text 1', { foreground: '#00ffff' }
|
60
|
-
text 'text 2', { foreground: '#ffff00' }
|
61
|
-
end
|
62
|
-
stream do
|
63
|
-
text 'text 3', { foreground: '#ff0000' }
|
64
|
-
text 'text 4', { foreground: '#ff00ff' }
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.start(argv = ARGV)
|
73
|
-
Vedeu::Launcher.execute!(argv)
|
74
|
-
end
|
75
|
-
|
76
|
-
end # DSLApp
|
77
|
-
|
78
|
-
DSLApp.start
|
@@ -1,50 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require 'bundler/setup'
|
6
|
-
require 'vedeu'
|
7
|
-
|
8
|
-
class DSLApp
|
9
|
-
|
10
|
-
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
11
|
-
|
12
|
-
Vedeu.configure do
|
13
|
-
debug!
|
14
|
-
log '/tmp/vedeu_views_dsl.log'
|
15
|
-
run_once!
|
16
|
-
standalone!
|
17
|
-
end
|
18
|
-
|
19
|
-
Vedeu.interface :main_interface do
|
20
|
-
border do
|
21
|
-
title 'Test 1'
|
22
|
-
end
|
23
|
-
geometry do
|
24
|
-
x 4
|
25
|
-
y 3
|
26
|
-
xn 34
|
27
|
-
yn 8
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
Vedeu.render do
|
32
|
-
view(:main_interface) do
|
33
|
-
lines do
|
34
|
-
line do
|
35
|
-
streams do
|
36
|
-
stream 'v->ls->l->ss->stream 1', { foreground: '#ffff00' }
|
37
|
-
stream 'v->ls->l->ss->stream 2', { foreground: '#00ffff' }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.start(argv = ARGV)
|
45
|
-
Vedeu::Launcher.execute!(argv)
|
46
|
-
end
|
47
|
-
|
48
|
-
end # DSLApp
|
49
|
-
|
50
|
-
DSLApp.start
|
@@ -1,93 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require 'bundler/setup'
|
6
|
-
require 'vedeu'
|
7
|
-
|
8
|
-
class DSLApp
|
9
|
-
|
10
|
-
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
|
11
|
-
|
12
|
-
Vedeu.configure do
|
13
|
-
debug!
|
14
|
-
log '/tmp/vedeu_views_dsl.log'
|
15
|
-
run_once!
|
16
|
-
standalone!
|
17
|
-
end
|
18
|
-
|
19
|
-
Vedeu.interface :test1_interface do
|
20
|
-
border do
|
21
|
-
title 'Test 1'
|
22
|
-
end
|
23
|
-
geometry do
|
24
|
-
x 4
|
25
|
-
y 3
|
26
|
-
xn 34
|
27
|
-
yn 8
|
28
|
-
end
|
29
|
-
end
|
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
|
-
|
61
|
-
Vedeu.render do
|
62
|
-
view(:test1_interface) do
|
63
|
-
lines do
|
64
|
-
streams do
|
65
|
-
text 'v->ls->ss->text 1', { foreground: '#00ff00' }
|
66
|
-
text 'v->ls->ss->text 2', { foreground: '#0000ff' }
|
67
|
-
end
|
68
|
-
end
|
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
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.start(argv = ARGV)
|
88
|
-
Vedeu::Launcher.execute!(argv)
|
89
|
-
end
|
90
|
-
|
91
|
-
end # DSLApp
|
92
|
-
|
93
|
-
DSLApp.start
|
data/lib/vedeu/dsl/string/all.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
# Provides a mechanism to help configure and use Vedeu.
|
6
|
-
#
|
7
|
-
module DSL
|
8
|
-
|
9
|
-
end # DSL
|
10
|
-
|
11
|
-
end # Vedeu
|
12
|
-
|
13
|
-
require 'vedeu/dsl/string/align'
|
14
|
-
require 'vedeu/dsl/string/truncate'
|
15
|
-
require 'vedeu/dsl/string/wordwrap'
|
16
|
-
require 'vedeu/dsl/string/text'
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Geometries
|
6
|
-
|
7
|
-
# Validate values given to {Vedeu::Geometries::DSL}.
|
8
|
-
#
|
9
|
-
# @api private
|
10
|
-
#
|
11
|
-
module Validator
|
12
|
-
|
13
|
-
include Vedeu::Common
|
14
|
-
|
15
|
-
# @param value [Fixnum] The number of lines/rows.
|
16
|
-
# @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
|
17
|
-
# @return [Boolean]
|
18
|
-
def validate_height!(value)
|
19
|
-
fail Vedeu::Error::InvalidSyntax,
|
20
|
-
'No height given.' if absent?(value)
|
21
|
-
|
22
|
-
true
|
23
|
-
end
|
24
|
-
|
25
|
-
# @param value [Symbol] One of :center, :centre, :left,
|
26
|
-
# :none, :right.
|
27
|
-
# @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
|
28
|
-
# @return [Boolean]
|
29
|
-
def validate_horizontal_alignment!(value)
|
30
|
-
fail Vedeu::Error::InvalidSyntax,
|
31
|
-
'No horizontal alignment given. Valid values are :center, ' \
|
32
|
-
':centre, :left, :none, :right.' unless present?(value)
|
33
|
-
|
34
|
-
true
|
35
|
-
end
|
36
|
-
|
37
|
-
# @param value [Symbol] One of :bottom, :middle, :none, :top.
|
38
|
-
# @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
|
39
|
-
# @return [Boolean]
|
40
|
-
def validate_vertical_alignment!(value)
|
41
|
-
fail Vedeu::Error::InvalidSyntax,
|
42
|
-
'No vertical alignment given. Valid values are :bottom, ' \
|
43
|
-
':middle, :none, :top.' unless present?(value)
|
44
|
-
|
45
|
-
true
|
46
|
-
end
|
47
|
-
|
48
|
-
# @param value [Fixnum] The number of characters/columns.
|
49
|
-
# @raise [Vedeu::Error::InvalidSyntax] When the value is nil.
|
50
|
-
# @return [Boolean]
|
51
|
-
def validate_width!(value)
|
52
|
-
fail Vedeu::Error::InvalidSyntax,
|
53
|
-
'No width given.' if absent?(value)
|
54
|
-
|
55
|
-
true
|
56
|
-
end
|
57
|
-
|
58
|
-
end # Validator
|
59
|
-
|
60
|
-
end # Geometries
|
61
|
-
|
62
|
-
end # Vedeu
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Presentation
|
6
|
-
|
7
|
-
module Colour
|
8
|
-
|
9
|
-
# Provides the background colour when included in a class with
|
10
|
-
# a colour attribute.
|
11
|
-
#
|
12
|
-
# @api private
|
13
|
-
#
|
14
|
-
module Background
|
15
|
-
|
16
|
-
include Vedeu::Repositories::Parent
|
17
|
-
|
18
|
-
# When the background colour for the model exists, return it,
|
19
|
-
# otherwise returns the parent background colour, or an empty
|
20
|
-
# Vedeu::Colours::Background.
|
21
|
-
#
|
22
|
-
# @return [Vedeu::Colours::Background]
|
23
|
-
def background
|
24
|
-
@background ||= if colour && present?(colour.background)
|
25
|
-
colour.background
|
26
|
-
|
27
|
-
elsif named_colour?
|
28
|
-
named_colour.background
|
29
|
-
|
30
|
-
elsif parent && present?(parent.background)
|
31
|
-
parent.background
|
32
|
-
|
33
|
-
else
|
34
|
-
Vedeu::Colours::Background.new
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Allows the setting of the background colour by coercing the
|
40
|
-
# given value into a Vedeu::Colours::Background colour.
|
41
|
-
#
|
42
|
-
# @return [Vedeu::Colours::Background]
|
43
|
-
def background=(value)
|
44
|
-
@background = colour.background = value
|
45
|
-
@_colour = @colour = colour
|
46
|
-
end
|
47
|
-
|
48
|
-
end # Background
|
49
|
-
|
50
|
-
end # Colour
|
51
|
-
|
52
|
-
end # Presentation
|
53
|
-
|
54
|
-
end # Vedeu
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Presentation
|
6
|
-
|
7
|
-
module Colour
|
8
|
-
|
9
|
-
# Provides the foreground colour when included in a class with
|
10
|
-
# a colour attribute.
|
11
|
-
#
|
12
|
-
# @api private
|
13
|
-
#
|
14
|
-
module Foreground
|
15
|
-
|
16
|
-
include Vedeu::Repositories::Parent
|
17
|
-
|
18
|
-
# When the foreground colour for the model exists, return it,
|
19
|
-
# otherwise returns the parent foreground colour, or an empty
|
20
|
-
# Vedeu::Colours::Foreground.
|
21
|
-
#
|
22
|
-
# @return [Vedeu::Colours::Foreground]
|
23
|
-
def foreground
|
24
|
-
@foreground ||= if colour && present?(colour.foreground)
|
25
|
-
colour.foreground
|
26
|
-
|
27
|
-
elsif named_colour?
|
28
|
-
named_colour.foreground
|
29
|
-
|
30
|
-
elsif parent && present?(parent.foreground)
|
31
|
-
parent.foreground
|
32
|
-
|
33
|
-
else
|
34
|
-
Vedeu::Colours::Foreground.new
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Allows the setting of the foreground colour by coercing the
|
40
|
-
# given value into a Vedeu::Colours::Foreground colour.
|
41
|
-
#
|
42
|
-
# @return [Vedeu::Colours::Foreground]
|
43
|
-
def foreground=(value)
|
44
|
-
@foreground = colour.foreground = value
|
45
|
-
@_colour = @colour = colour
|
46
|
-
end
|
47
|
-
|
48
|
-
end # Foreground
|
49
|
-
|
50
|
-
end # Colour
|
51
|
-
|
52
|
-
end # Presentation
|
53
|
-
|
54
|
-
end # Vedeu
|