fron 0.2.0rc1 → 1.0.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +20 -0
- data/.reek +2 -0
- data/.rubocop.yml +14 -11
- data/Gemfile +6 -3
- data/Gemfile.lock +73 -86
- data/Rakefile +11 -15
- data/Readme.md +1 -1
- data/fron.gemspec +2 -2
- data/lib/fron/version.rb +1 -1
- data/opal/fron.rb +2 -0
- data/opal/fron/core.rb +1 -0
- data/opal/fron/core/behaviors/components.rb +18 -10
- data/opal/fron/core/behaviors/events.rb +9 -10
- data/opal/fron/core/behaviors/routes.rb +6 -10
- data/opal/fron/core/behaviors/style.rb +30 -0
- data/opal/fron/core/component.rb +44 -23
- data/opal/fron/core/eventable.rb +3 -3
- data/opal/fron/core/logger.rb +1 -1
- data/opal/fron/core/sheet.rb +140 -0
- data/opal/fron/core_ext.rb +1 -0
- data/opal/fron/core_ext/array.rb +23 -0
- data/opal/fron/core_ext/hash.rb +6 -6
- data/opal/fron/core_ext/kernel.rb +10 -1
- data/opal/fron/core_ext/numeric.rb +7 -0
- data/opal/fron/core_ext/time.rb +6 -0
- data/opal/fron/dom/document.rb +6 -3
- data/opal/fron/dom/element.rb +79 -19
- data/opal/fron/dom/event.rb +5 -1
- data/opal/fron/dom/modules/dimensions.rb +0 -14
- data/opal/fron/dom/modules/element_accessor.rb +25 -0
- data/opal/fron/dom/modules/events.rb +1 -1
- data/opal/fron/dom/node.rb +7 -5
- data/opal/fron/dom/style.rb +0 -2
- data/opal/fron/dom/window.rb +14 -0
- data/opal/fron/event_mock.rb +24 -6
- data/opal/fron/js/scroll_into_view_if_needed.js +27 -0
- data/opal/fron/js/syntetic_event.js +20 -13
- data/opal/fron/request/request.rb +21 -19
- data/opal/fron/request/response.rb +1 -1
- data/opal/fron/storage.rb +2 -0
- data/opal/fron/storage/local_storage.rb +3 -45
- data/opal/fron/storage/session_storage.rb +12 -0
- data/opal/fron/storage/store.rb +54 -0
- data/opal/fron/utils/drag.rb +21 -18
- data/opal/fron/utils/keyboard.rb +14 -12
- data/opal/fron/utils/point.rb +12 -4
- data/opal/fron/utils/render_proc.rb +6 -2
- data/spec/core-ext/array_spec.rb +10 -2
- data/spec/core-ext/numeric_spec.rb +6 -0
- data/spec/core/behaviors/style_spec.rb +51 -0
- data/spec/core/component_inheritance_spec.rb +10 -15
- data/spec/core/component_spec.rb +10 -15
- data/spec/dom/element_spec.rb +12 -1
- data/spec/dom/modules/classlist_spec.rb +8 -9
- data/spec/dom/modules/dimensions_spec.rb +2 -1
- data/spec/dom/modules/events_spec.rb +42 -31
- data/spec/dom/style_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/utils/drag_spec.rb +2 -2
- data/spec/utils/keyboard_spec.rb +4 -1
- data/website/application.rb +4 -0
- data/website/config.ru +30 -0
- data/website/examples/content_editable.rb +29 -0
- data/website/examples/converter.rb +49 -0
- data/website/examples/icon_button.rb +20 -0
- data/website/examples/image_paragraph.rb +33 -0
- data/website/examples/my_blue_box.rb +9 -0
- data/website/examples/my_box.rb +9 -0
- data/website/examples/my_button.rb +27 -0
- data/website/examples/my_green_box.rb +14 -0
- data/website/examples/source_reader.rb +32 -0
- data/website/examples/text_area.rb +42 -0
- data/website/pages/components.md.erb +16 -0
- data/website/pages/components/composition.md.erb +9 -0
- data/website/pages/components/events.md.erb +20 -0
- data/website/pages/components/inheritance.md.erb +19 -0
- data/website/pages/components/routes.md.erb +49 -0
- data/website/pages/components/styles.md.erb +38 -0
- data/website/pages/getting-started.md +8 -0
- data/website/pages/home.md +4 -0
- data/website/pages/intro.md +30 -0
- data/website/pages/utilities.md +10 -0
- data/website/pages/utilities/local-storage.md.erb +16 -0
- data/website/pages/utilities/request.md.erb +12 -0
- data/website/setup.rb +162 -0
- data/website/vendor/highlight.js +2 -0
- data/website/vendor/highlight.ruby.js +1 -0
- data/website/vendor/marked.min.js +6 -0
- metadata +43 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fea15f954eea89cbb3a7de95982f0c56d3ce08cb
|
4
|
+
data.tar.gz: 5982c400ad8af29790fc5e959220f58e76bb5716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dda415778e26d1496e7e2536abe5b44bfee8a14f7a592bfc3079f60f420ed0533a76f1d0af84e8518d9a8dcfa8c21cd61493702650d90b0aa16841c3b855cc2
|
7
|
+
data.tar.gz: 2976245603309abc5b25ac6dc0af3d41f2f1eac9c9bc1c8335a97e59883142d0d86a5ad0c5eed8c636c1db6df27ba4da07be642bad0f402a6b8ebad369aa3316
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
engines:
|
3
|
+
bundler-audit:
|
4
|
+
enabled: true
|
5
|
+
duplication:
|
6
|
+
enabled: true
|
7
|
+
config:
|
8
|
+
languages:
|
9
|
+
- ruby
|
10
|
+
fixme:
|
11
|
+
enabled: true
|
12
|
+
rubocop:
|
13
|
+
enabled: true
|
14
|
+
ratings:
|
15
|
+
paths:
|
16
|
+
- Gemfile.lock
|
17
|
+
- "**.rb"
|
18
|
+
exclude_paths:
|
19
|
+
- website/
|
20
|
+
- spec/
|
data/.reek
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
AllCops:
|
2
2
|
Exclude:
|
3
|
-
-
|
3
|
+
- website/**/*
|
4
4
|
|
5
5
|
VariableName:
|
6
6
|
EnforcedStyle: snake_case
|
@@ -11,10 +11,7 @@ MethodName:
|
|
11
11
|
HandleExceptions:
|
12
12
|
Enabled: false
|
13
13
|
|
14
|
-
|
15
|
-
Enabled: true
|
16
|
-
|
17
|
-
SingleSpaceBeforeFirstArg:
|
14
|
+
SpaceBeforeFirstArg:
|
18
15
|
Enabled: false
|
19
16
|
|
20
17
|
LineLength:
|
@@ -23,18 +20,12 @@ LineLength:
|
|
23
20
|
MethodLength:
|
24
21
|
Enabled: false
|
25
22
|
|
26
|
-
Blocks:
|
27
|
-
Enabled: false
|
28
|
-
|
29
23
|
TrivialAccessors:
|
30
24
|
Enabled: false
|
31
25
|
|
32
26
|
ClassLength:
|
33
27
|
Enabled: false
|
34
28
|
|
35
|
-
UnneededPercentX:
|
36
|
-
Enabled: false
|
37
|
-
|
38
29
|
CyclomaticComplexity:
|
39
30
|
Enabled: false
|
40
31
|
|
@@ -52,3 +43,15 @@ EmptyElse:
|
|
52
43
|
|
53
44
|
PredicateName:
|
54
45
|
Enabled: false
|
46
|
+
|
47
|
+
BlockDelimiters:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
CommandLiteral:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
LiteralInCondition:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
MutableConstant:
|
57
|
+
Enabled: false
|
data/Gemfile
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
gem 'rake'
|
5
|
-
gem '
|
6
|
-
gem '
|
4
|
+
gem 'rake', '~> 11.1'
|
5
|
+
gem 'execjs', '~> 2.6'
|
6
|
+
gem 'rubocop', '~> 0.39.0'
|
7
|
+
gem 'rubycritic', '~> 2.8'
|
8
|
+
gem 'yard', '~> 0.8.7.6'
|
9
|
+
gem 'activesupport', '~> 4.2'
|
data/Gemfile.lock
CHANGED
@@ -1,113 +1,94 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/gdotdesign/quality-control.git
|
3
|
-
revision: 1035bd82c6df8882d831060a2c7a4f89416b18ed
|
4
|
-
ref: next
|
5
|
-
specs:
|
6
|
-
quality_control (0.1.2)
|
7
|
-
colorize (~> 0.7.3)
|
8
|
-
opal-rspec
|
9
|
-
rake
|
10
|
-
rubocop
|
11
|
-
rubycritic
|
12
|
-
scss-lint
|
13
|
-
yard
|
14
|
-
|
15
1
|
PATH
|
16
2
|
remote: .
|
17
3
|
specs:
|
18
|
-
fron (0.
|
19
|
-
opal (~> 0.
|
4
|
+
fron (1.0.0rc1)
|
5
|
+
opal (~> 0.9.2)
|
20
6
|
|
21
7
|
GEM
|
22
8
|
remote: https://rubygems.org/
|
23
9
|
specs:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
10
|
+
activesupport (4.2.6)
|
11
|
+
i18n (~> 0.7)
|
12
|
+
json (~> 1.7, >= 1.7.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
addressable (2.4.0)
|
17
|
+
ast (2.2.0)
|
31
18
|
axiom-types (0.1.1)
|
32
19
|
descendants_tracker (~> 0.0.4)
|
33
20
|
ice_nine (~> 0.11.0)
|
34
21
|
thread_safe (~> 0.3, >= 0.3.1)
|
22
|
+
codeclimate-engine-rb (0.3.1)
|
23
|
+
virtus (~> 1.0)
|
35
24
|
coercible (1.0.0)
|
36
25
|
descendants_tracker (~> 0.0.1)
|
37
|
-
colorize (0.7.
|
38
|
-
|
39
|
-
adamantium (~> 0.2.0)
|
40
|
-
equalizer (~> 0.0.9)
|
26
|
+
colorize (0.7.7)
|
27
|
+
concurrent-ruby (1.0.1)
|
41
28
|
descendants_tracker (0.0.4)
|
42
29
|
thread_safe (~> 0.3, >= 0.3.1)
|
43
|
-
|
44
|
-
|
45
|
-
execjs (2.
|
46
|
-
flay (2.
|
30
|
+
equalizer (0.0.11)
|
31
|
+
erubis (2.7.0)
|
32
|
+
execjs (2.6.0)
|
33
|
+
flay (2.7.0)
|
34
|
+
erubis (~> 2.7.0)
|
47
35
|
ruby_parser (~> 3.0)
|
48
36
|
sexp_processor (~> 4.0)
|
49
|
-
flog (4.2
|
37
|
+
flog (4.3.2)
|
50
38
|
ruby_parser (~> 3.1, > 3.1.0)
|
51
39
|
sexp_processor (~> 4.4)
|
52
40
|
hike (1.2.3)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
41
|
+
i18n (0.7.0)
|
42
|
+
ice_nine (0.11.2)
|
43
|
+
json (1.8.3)
|
44
|
+
launchy (2.4.3)
|
45
|
+
addressable (~> 2.3)
|
46
|
+
minitest (5.8.4)
|
47
|
+
opal (0.9.2)
|
58
48
|
hike (~> 1.2)
|
59
49
|
sourcemap (~> 0.1.0)
|
60
|
-
sprockets (
|
61
|
-
tilt (
|
62
|
-
opal-rspec (0.
|
63
|
-
opal (
|
64
|
-
parser (2.
|
65
|
-
ast (
|
66
|
-
powerpack (0.1.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
parser (~> 2.2.0.
|
73
|
-
rainbow (
|
74
|
-
|
75
|
-
|
76
|
-
astrolabe (~> 1.3)
|
77
|
-
parser (>= 2.2.0.1, < 3.0)
|
50
|
+
sprockets (~> 3.1)
|
51
|
+
tilt (>= 1.4)
|
52
|
+
opal-rspec (0.5.0)
|
53
|
+
opal (>= 0.8.0, < 0.10)
|
54
|
+
parser (2.3.0.7)
|
55
|
+
ast (~> 2.2)
|
56
|
+
powerpack (0.1.1)
|
57
|
+
rack (1.6.4)
|
58
|
+
rainbow (2.1.0)
|
59
|
+
rake (11.1.2)
|
60
|
+
reek (3.11)
|
61
|
+
codeclimate-engine-rb (~> 0.3.1)
|
62
|
+
parser (~> 2.3, >= 2.3.0.6)
|
63
|
+
rainbow (~> 2.0)
|
64
|
+
rubocop (0.39.0)
|
65
|
+
parser (>= 2.3.0.7, < 3.0)
|
78
66
|
powerpack (~> 0.1)
|
79
67
|
rainbow (>= 1.99.1, < 3.0)
|
80
|
-
ruby-progressbar (~> 1.
|
81
|
-
|
82
|
-
|
68
|
+
ruby-progressbar (~> 1.7)
|
69
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
70
|
+
ruby-progressbar (1.7.5)
|
71
|
+
ruby_parser (3.8.1)
|
83
72
|
sexp_processor (~> 4.1)
|
84
|
-
rubycritic (
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
73
|
+
rubycritic (2.8.0)
|
74
|
+
colorize
|
75
|
+
flay (= 2.7.0)
|
76
|
+
flog (= 4.3.2)
|
77
|
+
launchy (= 2.4.3)
|
78
|
+
parser (~> 2.3)
|
79
|
+
reek (= 3.11)
|
80
|
+
ruby_parser (~> 3.8)
|
89
81
|
virtus (~> 1.0)
|
90
|
-
|
91
|
-
scss-lint (0.35.0)
|
92
|
-
rainbow (~> 2.0)
|
93
|
-
sass (~> 3.4.1)
|
94
|
-
sexp_processor (4.5.0)
|
82
|
+
sexp_processor (4.7.0)
|
95
83
|
sourcemap (0.1.1)
|
96
|
-
sprockets (
|
97
|
-
|
98
|
-
|
99
|
-
rack (~> 1.0)
|
100
|
-
tilt (~> 1.1, != 1.3.0)
|
84
|
+
sprockets (3.5.2)
|
85
|
+
concurrent-ruby (~> 1.0)
|
86
|
+
rack (> 1, < 3)
|
101
87
|
thread_safe (0.3.5)
|
102
|
-
tilt (
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
concord (~> 0.1.5)
|
107
|
-
diff-lcs (~> 1.2.5)
|
108
|
-
equalizer (~> 0.0.9)
|
109
|
-
parser (~> 2.2.0.2)
|
110
|
-
procto (~> 0.0.2)
|
88
|
+
tilt (2.0.2)
|
89
|
+
tzinfo (1.2.2)
|
90
|
+
thread_safe (~> 0.1)
|
91
|
+
unicode-display_width (1.0.3)
|
111
92
|
virtus (1.0.5)
|
112
93
|
axiom-types (~> 0.1)
|
113
94
|
coercible (~> 1.0)
|
@@ -119,8 +100,14 @@ PLATFORMS
|
|
119
100
|
ruby
|
120
101
|
|
121
102
|
DEPENDENCIES
|
122
|
-
|
103
|
+
activesupport (~> 4.2)
|
104
|
+
execjs (~> 2.6)
|
123
105
|
fron!
|
124
|
-
opal-rspec (~> 0.
|
125
|
-
|
126
|
-
|
106
|
+
opal-rspec (~> 0.5.0)
|
107
|
+
rake (~> 11.1)
|
108
|
+
rubocop (~> 0.39.0)
|
109
|
+
rubycritic (~> 2.8)
|
110
|
+
yard (~> 0.8.7.6)
|
111
|
+
|
112
|
+
BUNDLED WITH
|
113
|
+
1.11.2
|
data/Rakefile
CHANGED
@@ -1,22 +1,18 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'opal/rspec/rake_task'
|
2
3
|
require 'bundler/setup'
|
3
|
-
require 'quality_control'
|
4
|
-
require 'quality_control/rubycritic'
|
5
|
-
require 'quality_control/rubocop'
|
6
|
-
require 'quality_control/yard'
|
7
|
-
require 'quality_control/opal_rspec'
|
8
4
|
require 'fron'
|
9
5
|
|
10
6
|
Bundler::GemHelper.install_tasks
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
Opal::RSpec::RakeTask.new(:spec) do |_, task|
|
9
|
+
task.files = FileList[ARGV[1] || 'spec/**/*_spec.rb']
|
10
|
+
task.timeout = 120_000
|
11
|
+
end
|
16
12
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
rubycritic
|
22
|
-
|
13
|
+
desc 'Run CI Tasks'
|
14
|
+
task :ci do
|
15
|
+
sh 'SPEC_OPTS="--color" rake spec'
|
16
|
+
sh 'rubocop lib opal spec'
|
17
|
+
sh 'rubycritic lib opal --mode-ci -s 94 --no-browser'
|
18
|
+
end
|
data/Readme.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Fron
|
2
2
|
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/digitalnatives/fron?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://codeship.com/projects/c2463aa0-bf15-0132-a675-621d0583fd1f/status?branch=master)](https://codeship.com/projects/72882)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/digitalnatives/fron/badges/gpa.svg)](https://codeclimate.com/github/digitalnatives/fron)
|
5
5
|
[![Inline docs](http://inch-ci.org/github/digitalnatives/fron.svg?branch=master)](http://inch-ci.org/github/digitalnatives/fron)
|
6
6
|
|
data/fron.gemspec
CHANGED
@@ -15,6 +15,6 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
s.require_paths = ['lib']
|
17
17
|
|
18
|
-
s.add_runtime_dependency 'opal',
|
19
|
-
s.add_development_dependency 'opal-rspec', '~> 0.
|
18
|
+
s.add_runtime_dependency 'opal', '~> 0.9.2'
|
19
|
+
s.add_development_dependency 'opal-rspec', '~> 0.5.0'
|
20
20
|
end
|
data/lib/fron/version.rb
CHANGED
data/opal/fron.rb
CHANGED
data/opal/fron/core.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Fron
|
2
|
-
# Bevahviors
|
3
2
|
module Behaviors
|
4
|
-
#
|
3
|
+
# Behavior for composing and creating child components.
|
5
4
|
module Components
|
6
5
|
# Runs for included classes
|
7
6
|
#
|
@@ -12,13 +11,11 @@ module Fron
|
|
12
11
|
|
13
12
|
# Creates components from the registry
|
14
13
|
#
|
15
|
-
# @param
|
16
|
-
def self.component(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
component(*arguments, &block)
|
21
|
-
end
|
14
|
+
# @param item [Array] Component directive
|
15
|
+
def self.component(item)
|
16
|
+
arguments = item[:args].dup
|
17
|
+
block = item[:block]
|
18
|
+
component(*arguments, &block)
|
22
19
|
end
|
23
20
|
|
24
21
|
# Creates a child component
|
@@ -26,9 +23,20 @@ module Fron
|
|
26
23
|
# @param name [String] The name of the component
|
27
24
|
# @param comp [Class] The component
|
28
25
|
# @param block [Proc] The block to eval on the new component
|
29
|
-
|
26
|
+
#
|
27
|
+
# :reek:TooManyStatements
|
28
|
+
def component(name, comp, options = {}, &block)
|
30
29
|
component = comp.is_a?(Class) ? comp.new(nil) : Component.new(comp)
|
31
30
|
component.instance_eval(&block) if block
|
31
|
+
|
32
|
+
options.each do |key, value|
|
33
|
+
if component.respond_to?("#{key}=")
|
34
|
+
component.send("#{key}=", value)
|
35
|
+
else
|
36
|
+
component[key] = value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
self << component
|
33
41
|
instance_variable_set "@#{name}", component
|
34
42
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fron
|
2
|
-
#
|
2
|
+
# Behaviors
|
3
3
|
module Behaviors
|
4
|
-
#
|
4
|
+
# Behavior for handling events on components.
|
5
5
|
module Events
|
6
6
|
# Runs for included classes
|
7
7
|
#
|
@@ -12,14 +12,13 @@ module Fron
|
|
12
12
|
|
13
13
|
# Applies events from the registry
|
14
14
|
#
|
15
|
-
# @param
|
16
|
-
def self.on(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
15
|
+
# @param item [Array] Registry of an event
|
16
|
+
def self.on(item)
|
17
|
+
args = item[:args]
|
18
|
+
if args.length == 3
|
19
|
+
delegate(args[0], args[1]) { |event| send args[2], event }
|
20
|
+
else
|
21
|
+
on(args[0]) { |event| send args[1], event }
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|