hyalite 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +7 -0
- data/client/hyalite.rb +98 -0
- data/client/hyalite/adler32.rb +33 -0
- data/client/hyalite/browser_event.rb +201 -0
- data/client/hyalite/callback_queue.rb +22 -0
- data/client/hyalite/component.rb +77 -0
- data/client/hyalite/composite_component.rb +237 -0
- data/client/hyalite/dom_component.rb +329 -0
- data/client/hyalite/dom_operations.rb +17 -0
- data/client/hyalite/dom_property.rb +218 -0
- data/client/hyalite/dom_property_operations.rb +117 -0
- data/client/hyalite/element.rb +17 -0
- data/client/hyalite/event_dispatcher.rb +99 -0
- data/client/hyalite/event_plugin/change_event_plugin.rb +83 -0
- data/client/hyalite/event_plugin/event_plugin_registry.rb +49 -0
- data/client/hyalite/event_plugin/simple_event_plugin.rb +276 -0
- data/client/hyalite/input_wrapper.rb +94 -0
- data/client/hyalite/instance_handles.rb +78 -0
- data/client/hyalite/internal_component.rb +11 -0
- data/client/hyalite/linked_value_utils.rb +27 -0
- data/client/hyalite/mount.rb +285 -0
- data/client/hyalite/multi_children.rb +272 -0
- data/client/hyalite/reconcile_transaction.rb +41 -0
- data/client/hyalite/reconciler.rb +122 -0
- data/client/hyalite/short_hand.rb +23 -0
- data/client/hyalite/synthetic_event.rb +18 -0
- data/client/hyalite/text_component.rb +42 -0
- data/client/hyalite/transaction.rb +47 -0
- data/client/hyalite/try.rb +7 -0
- data/client/hyalite/update_queue.rb +52 -0
- data/client/hyalite/updates.rb +129 -0
- data/client/hyalite/utils.rb +19 -0
- data/example/Gemfile +5 -0
- data/example/Gemfile.lock +46 -0
- data/example/app/application.rb +27 -0
- data/example/config.ru +12 -0
- data/example/index.html.haml +8 -0
- data/hyalite.gemspec +27 -0
- data/lib/hyalite.rb +6 -0
- data/lib/hyalite/main.rb +5 -0
- data/lib/hyalite/version.rb +3 -0
- metadata +145 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hyalite
|
2
|
+
ESCAPE_LOOKUP = {
|
3
|
+
'&' => '&',
|
4
|
+
'>' => '>',
|
5
|
+
'<' => '<',
|
6
|
+
'"' => '"',
|
7
|
+
'\'' => ''',
|
8
|
+
}
|
9
|
+
|
10
|
+
ESCAPE_REGEX = /[&><"']/
|
11
|
+
|
12
|
+
def self.quote_attribute_value_for_browser(text)
|
13
|
+
"\"#{escape_text_content_for_browser(text)}\""
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.escape_text_content_for_browser(text)
|
17
|
+
text.gsub(ESCAPE_REGEX) {|s| ESCAPE_LOOKUP[s] }
|
18
|
+
end
|
19
|
+
end
|
data/example/Gemfile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/opal/opal-browser.git
|
3
|
+
revision: d53cd7212853079ca81a108e402cd8722f4b4df4
|
4
|
+
specs:
|
5
|
+
opal-browser (0.2.0)
|
6
|
+
opal
|
7
|
+
paggio
|
8
|
+
|
9
|
+
GIT
|
10
|
+
remote: git://github.com/opal/opal-haml.git
|
11
|
+
revision: 3996e34c67bbf7832f005ea7325465a8d482c18a
|
12
|
+
specs:
|
13
|
+
opal-haml (0.3.0)
|
14
|
+
haml
|
15
|
+
opal (>= 0.5.0, < 1.0.0)
|
16
|
+
|
17
|
+
GIT
|
18
|
+
remote: git://github.com/opal/opal.git
|
19
|
+
revision: 6861dbd9b3954f3bc8d9d59d540f1ba3bf595ba1
|
20
|
+
specs:
|
21
|
+
opal (0.9.0.dev)
|
22
|
+
hike (~> 1.2)
|
23
|
+
sourcemap (~> 0.1.0)
|
24
|
+
sprockets (~> 3.1)
|
25
|
+
tilt (>= 1.4)
|
26
|
+
|
27
|
+
GEM
|
28
|
+
remote: https://rubygems.org/
|
29
|
+
specs:
|
30
|
+
haml (4.0.6)
|
31
|
+
tilt
|
32
|
+
hike (1.2.3)
|
33
|
+
paggio (0.2.4)
|
34
|
+
rack (1.6.4)
|
35
|
+
sourcemap (0.1.1)
|
36
|
+
sprockets (3.2.0)
|
37
|
+
rack (~> 1.0)
|
38
|
+
tilt (2.0.1)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
opal!
|
45
|
+
opal-browser!
|
46
|
+
opal-haml!
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'hyalite'
|
2
|
+
require 'browser/interval'
|
3
|
+
|
4
|
+
class ExampleView
|
5
|
+
include Hyalite::Component
|
6
|
+
|
7
|
+
def initial_state
|
8
|
+
@count = 0
|
9
|
+
{ now: @count }
|
10
|
+
end
|
11
|
+
|
12
|
+
def component_did_mount
|
13
|
+
every(5) do
|
14
|
+
set_state({ now: @count += 1 })
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def render
|
19
|
+
Hyalite.create_element("div", {class: 'example'},
|
20
|
+
Hyalite.create_element("h2", nil, @props[:title]),
|
21
|
+
Hyalite.create_element("h3", nil, "count = #{@state[:now]}"))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
$document.ready do
|
26
|
+
Hyalite.render(Hyalite.create_element(ExampleView, {title: "Hyalite counter example"}), $document['.container'])
|
27
|
+
end
|
data/example/config.ru
ADDED
data/hyalite.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hyalite/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "hyalite"
|
8
|
+
spec.version = Hyalite::VERSION
|
9
|
+
spec.authors = ["youchan"]
|
10
|
+
spec.email = ["youchan01@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Virtual DOM implimentation in Ruby}
|
13
|
+
spec.description = %q{Virtual DOM implimentation in Ruby using Opal}
|
14
|
+
spec.homepage = 'https://github.com/youchan/hyalite'
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'opal'
|
23
|
+
spec.add_dependency 'opal-browser'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
data/lib/hyalite.rb
ADDED
data/lib/hyalite/main.rb
ADDED
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hyalite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- youchan
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: opal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opal-browser
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
description: Virtual DOM implimentation in Ruby using Opal
|
70
|
+
email:
|
71
|
+
- youchan01@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- Gemfile
|
77
|
+
- LICENSE.txt
|
78
|
+
- README.md
|
79
|
+
- Rakefile
|
80
|
+
- client/hyalite.rb
|
81
|
+
- client/hyalite/adler32.rb
|
82
|
+
- client/hyalite/browser_event.rb
|
83
|
+
- client/hyalite/callback_queue.rb
|
84
|
+
- client/hyalite/component.rb
|
85
|
+
- client/hyalite/composite_component.rb
|
86
|
+
- client/hyalite/dom_component.rb
|
87
|
+
- client/hyalite/dom_operations.rb
|
88
|
+
- client/hyalite/dom_property.rb
|
89
|
+
- client/hyalite/dom_property_operations.rb
|
90
|
+
- client/hyalite/element.rb
|
91
|
+
- client/hyalite/event_dispatcher.rb
|
92
|
+
- client/hyalite/event_plugin/change_event_plugin.rb
|
93
|
+
- client/hyalite/event_plugin/event_plugin_registry.rb
|
94
|
+
- client/hyalite/event_plugin/simple_event_plugin.rb
|
95
|
+
- client/hyalite/input_wrapper.rb
|
96
|
+
- client/hyalite/instance_handles.rb
|
97
|
+
- client/hyalite/internal_component.rb
|
98
|
+
- client/hyalite/linked_value_utils.rb
|
99
|
+
- client/hyalite/mount.rb
|
100
|
+
- client/hyalite/multi_children.rb
|
101
|
+
- client/hyalite/reconcile_transaction.rb
|
102
|
+
- client/hyalite/reconciler.rb
|
103
|
+
- client/hyalite/short_hand.rb
|
104
|
+
- client/hyalite/synthetic_event.rb
|
105
|
+
- client/hyalite/text_component.rb
|
106
|
+
- client/hyalite/transaction.rb
|
107
|
+
- client/hyalite/try.rb
|
108
|
+
- client/hyalite/update_queue.rb
|
109
|
+
- client/hyalite/updates.rb
|
110
|
+
- client/hyalite/utils.rb
|
111
|
+
- example/Gemfile
|
112
|
+
- example/Gemfile.lock
|
113
|
+
- example/app/application.rb
|
114
|
+
- example/config.ru
|
115
|
+
- example/index.html.haml
|
116
|
+
- hyalite.gemspec
|
117
|
+
- lib/hyalite.rb
|
118
|
+
- lib/hyalite/main.rb
|
119
|
+
- lib/hyalite/version.rb
|
120
|
+
homepage: https://github.com/youchan/hyalite
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.4.5.1
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Virtual DOM implimentation in Ruby
|
144
|
+
test_files: []
|
145
|
+
has_rdoc:
|