glimmer 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +116 -95
- data/VERSION +1 -1
- data/lib/glimmer.rb +0 -20
- data/lib/glimmer/config.rb +0 -13
- data/lib/glimmer/dsl/engine.rb +25 -18
- data/lib/glimmer/dsl/expression.rb +0 -7
- data/lib/glimmer/dsl/static_expression.rb +2 -2
- metadata +47 -177
- data/RUBY_VERSION +0 -1
- data/bin/girb +0 -10
- data/bin/girb_runner.rb +0 -13
- data/bin/glimmer +0 -5
- data/icons/scaffold_app.icns +0 -0
- data/lib/glimmer/css/rule.rb +0 -25
- data/lib/glimmer/css/style_sheet.rb +0 -19
- data/lib/glimmer/data_binding/list_selection_binding.rb +0 -52
- data/lib/glimmer/data_binding/model_binding.rb +0 -248
- data/lib/glimmer/data_binding/observable.rb +0 -21
- data/lib/glimmer/data_binding/observable_array.rb +0 -107
- data/lib/glimmer/data_binding/observable_model.rb +0 -108
- data/lib/glimmer/data_binding/observable_widget.rb +0 -17
- data/lib/glimmer/data_binding/observer.rb +0 -124
- data/lib/glimmer/data_binding/shine.rb +0 -23
- data/lib/glimmer/data_binding/table_items_binding.rb +0 -56
- data/lib/glimmer/data_binding/tree_items_binding.rb +0 -71
- data/lib/glimmer/data_binding/widget_binding.rb +0 -33
- data/lib/glimmer/dsl/css/css_expression.rb +0 -21
- data/lib/glimmer/dsl/css/dsl.rb +0 -10
- data/lib/glimmer/dsl/css/dynamic_property_expression.rb +0 -12
- data/lib/glimmer/dsl/css/property_expression.rb +0 -22
- data/lib/glimmer/dsl/css/pv_expression.rb +0 -17
- data/lib/glimmer/dsl/css/rule_expression.rb +0 -25
- data/lib/glimmer/dsl/css/s_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/async_exec_expression.rb +0 -14
- data/lib/glimmer/dsl/swt/bind_expression.rb +0 -37
- data/lib/glimmer/dsl/swt/color_expression.rb +0 -19
- data/lib/glimmer/dsl/swt/column_properties_expression.rb +0 -24
- data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +0 -42
- data/lib/glimmer/dsl/swt/custom_widget_expression.rb +0 -36
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +0 -34
- data/lib/glimmer/dsl/swt/dialog_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/display_expression.rb +0 -19
- data/lib/glimmer/dsl/swt/dsl.rb +0 -28
- data/lib/glimmer/dsl/swt/exec_expression.rb +0 -28
- data/lib/glimmer/dsl/swt/layout_data_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/layout_expression.rb +0 -27
- data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +0 -44
- data/lib/glimmer/dsl/swt/menu_bar_expression.rb +0 -33
- data/lib/glimmer/dsl/swt/menu_expression.rb +0 -32
- data/lib/glimmer/dsl/swt/message_box_expression.rb +0 -29
- data/lib/glimmer/dsl/swt/observe_expression.rb +0 -32
- data/lib/glimmer/dsl/swt/property_expression.rb +0 -22
- data/lib/glimmer/dsl/swt/rgb_expression.rb +0 -12
- data/lib/glimmer/dsl/swt/rgba_expression.rb +0 -12
- data/lib/glimmer/dsl/swt/shell_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/swt_expression.rb +0 -25
- data/lib/glimmer/dsl/swt/sync_exec_expression.rb +0 -15
- data/lib/glimmer/dsl/swt/tab_item_expression.rb +0 -33
- data/lib/glimmer/dsl/swt/table_items_data_binding_expression.rb +0 -31
- data/lib/glimmer/dsl/swt/tree_items_data_binding_expression.rb +0 -31
- data/lib/glimmer/dsl/swt/tree_properties_expression.rb +0 -26
- data/lib/glimmer/dsl/swt/widget_expression.rb +0 -35
- data/lib/glimmer/dsl/swt/widget_listener_expression.rb +0 -32
- data/lib/glimmer/dsl/xml/dsl.rb +0 -11
- data/lib/glimmer/dsl/xml/html_expression.rb +0 -25
- data/lib/glimmer/dsl/xml/meta_expression.rb +0 -23
- data/lib/glimmer/dsl/xml/name_space_expression.rb +0 -37
- data/lib/glimmer/dsl/xml/node_parent_expression.rb +0 -33
- data/lib/glimmer/dsl/xml/tag_expression.rb +0 -29
- data/lib/glimmer/dsl/xml/text_expression.rb +0 -22
- data/lib/glimmer/dsl/xml/xml_expression.rb +0 -21
- data/lib/glimmer/launcher.rb +0 -199
- data/lib/glimmer/package.rb +0 -55
- data/lib/glimmer/rake_task.rb +0 -58
- data/lib/glimmer/scaffold.rb +0 -582
- data/lib/glimmer/swt/color_proxy.rb +0 -53
- data/lib/glimmer/swt/display_proxy.rb +0 -88
- data/lib/glimmer/swt/font_proxy.rb +0 -72
- data/lib/glimmer/swt/layout_data_proxy.rb +0 -84
- data/lib/glimmer/swt/layout_proxy.rb +0 -82
- data/lib/glimmer/swt/menu_proxy.rb +0 -101
- data/lib/glimmer/swt/message_box_proxy.rb +0 -48
- data/lib/glimmer/swt/packages.rb +0 -13
- data/lib/glimmer/swt/shell_proxy.rb +0 -152
- data/lib/glimmer/swt/swt_proxy.rb +0 -106
- data/lib/glimmer/swt/tab_item_proxy.rb +0 -65
- data/lib/glimmer/swt/table_proxy.rb +0 -150
- data/lib/glimmer/swt/tree_proxy.rb +0 -120
- data/lib/glimmer/swt/widget_listener_proxy.rb +0 -34
- data/lib/glimmer/swt/widget_proxy.rb +0 -489
- data/lib/glimmer/ui/custom_shell.rb +0 -45
- data/lib/glimmer/ui/custom_widget.rb +0 -244
- data/lib/glimmer/util/proc_tracker.rb +0 -16
- data/lib/glimmer/xml/depth_first_search_iterator.rb +0 -22
- data/lib/glimmer/xml/name_space_visitor.rb +0 -21
- data/lib/glimmer/xml/node.rb +0 -75
- data/lib/glimmer/xml/node_visitor.rb +0 -13
- data/lib/glimmer/xml/xml_visitor.rb +0 -65
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
@@ -1,17 +0,0 @@
|
|
1
|
-
module Glimmer
|
2
|
-
module DataBinding
|
3
|
-
module ObservableWidget
|
4
|
-
# TODO see if it is worth it to eliminate duplication of method_missing
|
5
|
-
# from WidgetProxy using a module
|
6
|
-
|
7
|
-
def method_missing(method, *args, &block)
|
8
|
-
method_name = method.to_s
|
9
|
-
if can_handle_observation_request?(method_name)
|
10
|
-
handle_observation_request(method_name, &block)
|
11
|
-
else
|
12
|
-
super
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,124 +0,0 @@
|
|
1
|
-
require 'glimmer/error'
|
2
|
-
|
3
|
-
module Glimmer
|
4
|
-
module DataBinding
|
5
|
-
# Mixin representing Observer trait from Observer Design Pattern
|
6
|
-
# Allows classes to include without interfering with their
|
7
|
-
# inheritance hierarchy.
|
8
|
-
#
|
9
|
-
# Includes a default implementation that can receive an observer block
|
10
|
-
# Example: Observer.proc {|new_value| puts new_value}
|
11
|
-
# Subclasses may override
|
12
|
-
module Observer
|
13
|
-
# Observer Proc default implementation that takes an observer block to process updates
|
14
|
-
# via call method
|
15
|
-
class Proc
|
16
|
-
include Observer
|
17
|
-
|
18
|
-
def initialize(&observer_block)
|
19
|
-
@observer_block = observer_block
|
20
|
-
end
|
21
|
-
|
22
|
-
# Called by observables once updates occur sending in the new_value if any
|
23
|
-
def call(new_value=nil)
|
24
|
-
@observer_block.call(new_value)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class Registration < Struct.new(:observer, :observable, :property, keyword_init: true)
|
29
|
-
def unregister
|
30
|
-
observer.unobserve(observable, property)
|
31
|
-
end
|
32
|
-
alias unobserve unregister
|
33
|
-
end
|
34
|
-
|
35
|
-
class << self
|
36
|
-
def proc(&observer_block)
|
37
|
-
Proc.new(&observer_block)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def registrations
|
42
|
-
@registrations ||= Set.new
|
43
|
-
end
|
44
|
-
|
45
|
-
def registration_for(observable, property = nil)
|
46
|
-
Registration.new(observer: self, observable: observable, property: property)
|
47
|
-
end
|
48
|
-
|
49
|
-
# mapping of registrations to dependents
|
50
|
-
# {[observable, property] => [[dependent, dependent_observable, dependent_property], ...]}
|
51
|
-
def dependents
|
52
|
-
@dependents ||= Hash.new
|
53
|
-
end
|
54
|
-
|
55
|
-
def dependents_for(registration)
|
56
|
-
dependents[registration] ||= Set.new
|
57
|
-
end
|
58
|
-
|
59
|
-
# registers observer in an observable on a property (optional)
|
60
|
-
# observer maintains registration list to unregister later
|
61
|
-
def register(observable, property = nil)
|
62
|
-
unless observable.is_a?(Observable)
|
63
|
-
# TODO refactor code to be more smart/polymorphic/automated and honor open/closed principle
|
64
|
-
if observable.is_a?(Array)
|
65
|
-
observable.extend(ObservableArray)
|
66
|
-
else
|
67
|
-
observable.extend(ObservableModel)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
observable.add_observer(*[self, property].compact)
|
71
|
-
registration_for(observable, property).tap do |registration|
|
72
|
-
self.registrations << registration
|
73
|
-
end
|
74
|
-
end
|
75
|
-
alias observe register
|
76
|
-
|
77
|
-
def unregister(observable, property = nil)
|
78
|
-
# TODO optimize performance in the future via indexing and/or making a registration official object/class
|
79
|
-
observable.remove_observer(*[self, property].compact)
|
80
|
-
registration = registration_for(observable, property)
|
81
|
-
dependents_for(registration).each do |dependent|
|
82
|
-
dependent.unregister
|
83
|
-
remove_dependent(registration => dependent)
|
84
|
-
end
|
85
|
-
registrations.delete(registration)
|
86
|
-
end
|
87
|
-
alias unobserve unregister
|
88
|
-
|
89
|
-
def unregister_dependents_with_observable(registration, dependent_observable)
|
90
|
-
thedependents = dependents_for(registration).select do |thedependent|
|
91
|
-
thedependent.observable == dependent_observable
|
92
|
-
end
|
93
|
-
thedependents.each do |thedependent|
|
94
|
-
thedependent.unregister
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# cleans up all registrations in observables
|
99
|
-
def unregister_all_observables
|
100
|
-
registrations.each do |registration|
|
101
|
-
registration.unregister
|
102
|
-
end
|
103
|
-
end
|
104
|
-
alias unobserve_all_observables unregister_all_observables
|
105
|
-
|
106
|
-
# add dependent observer to unregister when unregistering observer
|
107
|
-
def add_dependent(parent_to_dependent_hash)
|
108
|
-
registration = parent_to_dependent_hash.keys.first
|
109
|
-
dependent = parent_to_dependent_hash.values.first
|
110
|
-
dependents_for(registration) << dependent
|
111
|
-
end
|
112
|
-
|
113
|
-
def remove_dependent(parent_to_dependent_hash)
|
114
|
-
registration = parent_to_dependent_hash.keys.first
|
115
|
-
dependent = parent_to_dependent_hash.values.first
|
116
|
-
dependents_for(registration).delete(dependent)
|
117
|
-
end
|
118
|
-
|
119
|
-
def call(new_value)
|
120
|
-
raise Error, 'Not implemented!'
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
## NOTE: Unsupported in Ruby 2 syntax
|
2
|
-
#
|
3
|
-
# require File.dirname(__FILE__) + "/glimmer"
|
4
|
-
#
|
5
|
-
# class Array
|
6
|
-
# include Glimmer
|
7
|
-
#
|
8
|
-
# alias original_compare <=>
|
9
|
-
#
|
10
|
-
# def <=>(other)
|
11
|
-
# if (self[0].class.name == "WidgetProxy")
|
12
|
-
# content(self[0]) {
|
13
|
-
# if (other.size == 2)
|
14
|
-
# eval("#{self[1]} bind (other[0], other[1])")
|
15
|
-
# elsif (other.size == 3)
|
16
|
-
# eval("#{self[1]} bind (other[0], other[1], other[2])")
|
17
|
-
# end
|
18
|
-
# }
|
19
|
-
# else
|
20
|
-
# original_compare(other)
|
21
|
-
# end
|
22
|
-
# end
|
23
|
-
# end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'glimmer/data_binding/observable_array'
|
2
|
-
require 'glimmer/data_binding/observable_model'
|
3
|
-
require 'glimmer/data_binding/observable'
|
4
|
-
require 'glimmer/data_binding/observer'
|
5
|
-
require 'glimmer/swt/swt_proxy'
|
6
|
-
|
7
|
-
module Glimmer
|
8
|
-
module DataBinding
|
9
|
-
class TableItemsBinding
|
10
|
-
include DataBinding::Observable
|
11
|
-
include DataBinding::Observer
|
12
|
-
include_package 'org.eclipse.swt'
|
13
|
-
include_package 'org.eclipse.swt.widgets'
|
14
|
-
|
15
|
-
def initialize(parent, model_binding, column_properties)
|
16
|
-
@table = parent
|
17
|
-
@model_binding = model_binding
|
18
|
-
@column_properties = column_properties
|
19
|
-
if @table.respond_to?(:column_properties=)
|
20
|
-
@table.column_properties = @column_properties
|
21
|
-
else # assume custom widget
|
22
|
-
@table.body_root.column_properties = @column_properties
|
23
|
-
end
|
24
|
-
call(@model_binding.evaluate_property)
|
25
|
-
model = model_binding.base_model
|
26
|
-
observe(model, model_binding.property_name_expression)
|
27
|
-
@table.on_widget_disposed do |dispose_event|
|
28
|
-
unregister_all_observables
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def call(new_model_collection=nil)
|
33
|
-
if new_model_collection and new_model_collection.is_a?(Array)
|
34
|
-
observe(new_model_collection, @column_properties)
|
35
|
-
@model_collection = new_model_collection
|
36
|
-
end
|
37
|
-
populate_table(@model_collection, @table, @column_properties)
|
38
|
-
end
|
39
|
-
|
40
|
-
def populate_table(model_collection, parent, column_properties)
|
41
|
-
selected_table_item_models = parent.swt_widget.getSelection.map(&:getData)
|
42
|
-
parent.swt_widget.removeAll
|
43
|
-
model_collection.each do |model|
|
44
|
-
table_item = TableItem.new(parent.swt_widget, SWT::SWTProxy[:none])
|
45
|
-
for index in 0..(column_properties.size-1)
|
46
|
-
table_item.setText(index, model.send(column_properties[index]).to_s)
|
47
|
-
end
|
48
|
-
table_item.setData(model)
|
49
|
-
end
|
50
|
-
selected_table_items = parent.search {|item| selected_table_item_models.include?(item.getData) }
|
51
|
-
selected_table_items = [parent.swt_widget.getItems.first].to_java(TableItem) if selected_table_items.empty? && !parent.swt_widget.getItems.empty?
|
52
|
-
parent.swt_widget.setSelection(selected_table_items) unless selected_table_items.empty?
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'glimmer/data_binding/observable_array'
|
2
|
-
require 'glimmer/data_binding/observable_model'
|
3
|
-
require 'glimmer/data_binding/observable'
|
4
|
-
require 'glimmer/data_binding/observer'
|
5
|
-
require 'glimmer/swt/swt_proxy'
|
6
|
-
|
7
|
-
module Glimmer
|
8
|
-
module DataBinding
|
9
|
-
class TreeItemsBinding
|
10
|
-
include DataBinding::Observable
|
11
|
-
include DataBinding::Observer
|
12
|
-
|
13
|
-
include_package 'org.eclipse.swt'
|
14
|
-
include_package 'org.eclipse.swt.widgets'
|
15
|
-
|
16
|
-
def initialize(parent, model_binding, tree_properties)
|
17
|
-
@tree = parent
|
18
|
-
@model_binding = model_binding
|
19
|
-
@tree_properties = [tree_properties].flatten.first.to_h
|
20
|
-
if @tree.respond_to?(:tree_properties=)
|
21
|
-
@tree.tree_properties = @tree_properties
|
22
|
-
else # assume custom widget
|
23
|
-
@tree.body_root.tree_properties = @tree_properties
|
24
|
-
end
|
25
|
-
call
|
26
|
-
model = model_binding.base_model
|
27
|
-
observe(model, model_binding.property_name_expression)
|
28
|
-
@tree.on_widget_disposed do |dispose_event|
|
29
|
-
unregister_all_observables
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def call(new_value=nil)
|
34
|
-
@model_tree_root_node = @model_binding.evaluate_property
|
35
|
-
populate_tree(@model_tree_root_node, @tree, @tree_properties)
|
36
|
-
end
|
37
|
-
|
38
|
-
def populate_tree(model_tree_root_node, parent, tree_properties)
|
39
|
-
# TODO make it change things by delta instead of removing all
|
40
|
-
selected_tree_item_model = parent.swt_widget.getSelection.map(&:getData).first
|
41
|
-
old_tree_items = parent.all_tree_items
|
42
|
-
old_tree_item_expansion_by_data = old_tree_items.reduce({}) {|hash, ti| hash.merge(ti.getData => ti.getExpanded)}
|
43
|
-
old_tree_items.each do |tree_item|
|
44
|
-
tree_item.getData('observer_registrations').each do |key, observer_registration|
|
45
|
-
observer_registration.unregister
|
46
|
-
end
|
47
|
-
end
|
48
|
-
parent.swt_widget.removeAll
|
49
|
-
populate_tree_node(model_tree_root_node, parent.swt_widget, tree_properties)
|
50
|
-
parent.all_tree_items.each { |ti| ti.setExpanded(!!old_tree_item_expansion_by_data[ti.getData]) }
|
51
|
-
tree_item_to_select = parent.depth_first_search {|ti| ti.getData == selected_tree_item_model}
|
52
|
-
parent.swt_widget.setSelection(tree_item_to_select)
|
53
|
-
end
|
54
|
-
|
55
|
-
def populate_tree_node(model_tree_node, parent, tree_properties)
|
56
|
-
return if model_tree_node.nil?
|
57
|
-
# TODO anticipate default tree properties if none were passed (like literal values text and children)
|
58
|
-
tree_item = TreeItem.new(parent, SWT::SWTProxy[:none])
|
59
|
-
observer_registrations = @tree_properties.reduce({}) do |hash, key_value_pair|
|
60
|
-
hash.merge(key_value_pair.first => observe(model_tree_node, key_value_pair.last))
|
61
|
-
end
|
62
|
-
tree_item.setData('observer_registrations', observer_registrations)
|
63
|
-
tree_item.setData(model_tree_node)
|
64
|
-
tree_item.setText((model_tree_node && model_tree_node.send(tree_properties[:text])).to_s)
|
65
|
-
[model_tree_node && model_tree_node.send(tree_properties[:children])].flatten.to_a.compact.each do |child|
|
66
|
-
populate_tree_node(child, tree_item, tree_properties)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'glimmer'
|
2
|
-
require_relative 'observable'
|
3
|
-
require_relative 'observer'
|
4
|
-
|
5
|
-
module Glimmer
|
6
|
-
module DataBinding
|
7
|
-
class WidgetBinding
|
8
|
-
include Glimmer
|
9
|
-
include Observable
|
10
|
-
include Observer
|
11
|
-
|
12
|
-
attr_reader :widget, :property
|
13
|
-
def initialize(model, property, translator = nil)
|
14
|
-
@widget = model
|
15
|
-
@property = property
|
16
|
-
@translator = translator || proc {|value| value}
|
17
|
-
|
18
|
-
if @widget.respond_to?(:dispose)
|
19
|
-
@widget.on_widget_disposed do |dispose_event|
|
20
|
-
unregister_all_observables
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
def call(value)
|
25
|
-
converted_value = translated_value = @translator.call(value)
|
26
|
-
@widget.set_attribute(@property, converted_value) unless evaluate_property == converted_value
|
27
|
-
end
|
28
|
-
def evaluate_property
|
29
|
-
@widget.get_attribute(@property)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/dsl/top_level_expression'
|
3
|
-
require 'glimmer/dsl/parent_expression'
|
4
|
-
require 'glimmer/css/style_sheet'
|
5
|
-
|
6
|
-
module Glimmer
|
7
|
-
module DSL
|
8
|
-
module CSS
|
9
|
-
# This static html expression flips the DSL switch on for
|
10
|
-
# XML DSL in Glimmer
|
11
|
-
class CssExpression < StaticExpression
|
12
|
-
include TopLevelExpression
|
13
|
-
include ParentExpression
|
14
|
-
|
15
|
-
def interpret(parent, keyword, *args, &block)
|
16
|
-
Glimmer::CSS::StyleSheet.new
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/glimmer/dsl/css/dsl.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/expression'
|
2
|
-
require 'glimmer/css/rule'
|
3
|
-
|
4
|
-
module Glimmer
|
5
|
-
module DSL
|
6
|
-
module CSS
|
7
|
-
module PropertyExpression
|
8
|
-
include ParentExpression
|
9
|
-
|
10
|
-
def can_interpret?(parent, keyword, *args, &block)
|
11
|
-
parent.is_a?(Glimmer::CSS::Rule) and
|
12
|
-
!block_given? and
|
13
|
-
!args.empty?
|
14
|
-
end
|
15
|
-
|
16
|
-
def interpret(parent, keyword, *args, &block)
|
17
|
-
parent.add_property(keyword, *args)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/static_expression'
|
2
|
-
require 'glimmer/dsl/css/property_expression'
|
3
|
-
|
4
|
-
module Glimmer
|
5
|
-
module DSL
|
6
|
-
module CSS
|
7
|
-
# Static keyword 'pv' version of CSS DSL dynamic property expression
|
8
|
-
class PVExpression < StaticExpression
|
9
|
-
include PropertyExpression
|
10
|
-
|
11
|
-
def interpret(parent, keyword, *args, &block)
|
12
|
-
parent.add_property(args[0], args[1])
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'glimmer/dsl/expression'
|
2
|
-
require 'glimmer/css/style_sheet'
|
3
|
-
require 'glimmer/css/rule'
|
4
|
-
|
5
|
-
module Glimmer
|
6
|
-
module DSL
|
7
|
-
module CSS
|
8
|
-
class RuleExpression < Expression
|
9
|
-
include ParentExpression
|
10
|
-
|
11
|
-
def can_interpret?(parent, keyword, *args, &block)
|
12
|
-
parent.is_a?(Glimmer::CSS::StyleSheet) and
|
13
|
-
block_given? and
|
14
|
-
args.empty?
|
15
|
-
end
|
16
|
-
|
17
|
-
def interpret(parent, keyword, *args, &block)
|
18
|
-
Glimmer::CSS::Rule.new(keyword.to_s.downcase).tap do |rule|
|
19
|
-
parent.rules << rule
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|