voom-presenters 2.0.0 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.github/workflows/semantic-release.yml +5 -1
- data/.releaserc +17 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +32 -15
- data/Gemfile +2 -1
- data/Gemfile.lock +15 -6
- data/README.md +14 -9
- data/app/demo/components/date_fields.pom +10 -0
- data/app/demo/components/multi_selects.pom +29 -0
- data/app/demo/components/nav/menu.pom +1 -0
- data/app/demo/components/selects.pom +2 -1
- data/app/demo/events/halted.pom +23 -0
- data/app/demo/events/nav/drawer.pom +1 -1
- data/app/demo/index.pom +5 -5
- data/app/demo/nav/top_nav.pom +3 -9
- data/{bin → exe}/presenters +0 -0
- data/lib/voom.rb +2 -2
- data/lib/voom/presenters/dsl/components/date_field.rb +13 -0
- data/lib/voom/presenters/dsl/components/datetime_base.rb +2 -1
- data/lib/voom/presenters/dsl/components/mixins/selects.rb +6 -0
- data/lib/voom/presenters/dsl/components/multi_select.rb +56 -0
- data/lib/voom/presenters/dsl/components/select.rb +0 -3
- data/lib/voom/presenters/version.rb +3 -1
- data/presenters.gemspec +2 -2
- data/public/bundle.css +85 -50
- data/public/bundle.js +1593 -1341
- data/public/wc.js +1186 -934
- data/views/mdc/assets/js/components/datetime.js +101 -18
- data/views/mdc/assets/js/components/events/posts.js +12 -11
- data/views/mdc/assets/js/components/initialize.js +2 -0
- data/views/mdc/assets/js/components/multi-select.js +75 -0
- data/views/mdc/assets/js/utils/form-data.js +12 -0
- data/views/mdc/assets/scss/app.scss +1 -0
- data/views/mdc/assets/scss/components/multi-select.scss +44 -0
- data/views/mdc/components/datetime.erb +7 -4
- data/views/mdc/components/multi_select.erb +33 -0
- data/views/mdc/package-lock.json +47 -33
- data/views/mdc/package.json +1 -1
- metadata +16 -10
- data/app/demo/component_status.pom +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d962ca9bae3f72f580876a97f077e2fe423366c3b60730eb15cf094f6ae4a1e
|
4
|
+
data.tar.gz: a82a320fe2aafbc3d72830755c7073f9f884d583ba434f894ca371c91fb0a6df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7da1eb176fdcced60b3b1126257c44a73968be7ab73da3a0df7f8e4bef7e15ffd7a46f2bdb5309ed274bf00453d671a35f87abcdf2714eab5093d7d2e9dd0cc4
|
7
|
+
data.tar.gz: 7fc9f46d3b6096f3cddd8ac6c0329211d433d4557c51d5466fe92379ff9128db7b0d908f099598f270d4e296b028326d55d540e7ba08276508e2f945d36af790
|
data/.circleci/config.yml
CHANGED
@@ -7,7 +7,7 @@ jobs:
|
|
7
7
|
build:
|
8
8
|
docker:
|
9
9
|
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.
|
10
|
+
- image: circleci/ruby:2.7.2-node-browsers
|
11
11
|
|
12
12
|
# Specify service dependencies here if necessary
|
13
13
|
# CircleCI maintains a library of pre-built images
|
@@ -31,7 +31,11 @@ jobs:
|
|
31
31
|
- name: Semantic Release
|
32
32
|
uses: cycjimmy/semantic-release-action@v2
|
33
33
|
with:
|
34
|
-
extra_plugins:
|
34
|
+
extra_plugins: |
|
35
|
+
@semantic-release/git
|
36
|
+
@semantic-release/changelog
|
37
|
+
@semantic-release/github
|
38
|
+
semantic-release-rubygem
|
35
39
|
dry_run: false
|
36
40
|
env:
|
37
41
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.releaserc
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
{
|
2
|
-
"branches": [
|
2
|
+
"branches": ['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}],
|
3
3
|
"plugins": [
|
4
4
|
"@semantic-release/commit-analyzer",
|
5
5
|
"@semantic-release/release-notes-generator",
|
6
|
-
"semantic-release-
|
6
|
+
"@semantic-release/release-notes-generator",
|
7
|
+
[
|
8
|
+
"@semantic-release/changelog",
|
9
|
+
{
|
10
|
+
"changelogFile": "CHANGELOG.md"
|
11
|
+
}
|
12
|
+
],
|
13
|
+
[
|
14
|
+
"@semantic-release/git",
|
15
|
+
{
|
16
|
+
"assets": ["CHANGELOG.md"]
|
17
|
+
}
|
18
|
+
],
|
19
|
+
"@semantic-release/github",
|
20
|
+
"semantic-release-rubygem"
|
7
21
|
]
|
8
|
-
}
|
22
|
+
}
|
data/.ruby-version
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
2
2
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## [2.1.2](https://github.com/rx/presenters/compare/v2.1.1...v2.1.2) (2021-06-18)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add Rack > 2.2.2 support ([6e23287](https://github.com/rx/presenters/commit/6e232875d1ea3c4250f9e19e841215a750082ffc))
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
## [2.1.2](https://github.com/rx/presenters/compare/v2.1.1...v2.1.2) (2021-06-18)
|
13
|
+
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
* add Rack > 2.2.2 support ([6e23287](https://github.com/rx/presenters/commit/6e232875d1ea3c4250f9e19e841215a750082ffc))
|
18
|
+
|
1
19
|
# Changelog
|
2
20
|
|
3
21
|
## [1.0.0](https://github.com/rx/presenters/tree/1.0.0) (2020-12-20)
|
@@ -117,20 +135,19 @@ This is the manual changelog, managed before switching to github_changelog_gener
|
|
117
135
|
|
118
136
|
[Unreleased]: https://github.com/rx/presenters/compare/v0.1.14...HEAD
|
119
137
|
[0.1.14]: https://github.com/rx/presenters/compare/v0.1.14...v0.1.13
|
120
|
-
[Namespaces]: https://
|
121
|
-
[Stepper]: https://
|
122
|
-
[Rich text component]: https://
|
123
|
-
[Slider component]: https://
|
124
|
-
[Tagged Input]: https://
|
125
|
-
[Overline Text Style]: https://
|
126
|
-
[Page separator]: https://
|
127
|
-
[Blank lines]: https://
|
128
|
-
[Grid Padding]: https://
|
129
|
-
[Map component]: https://
|
130
|
-
[Clear action]: https://
|
131
|
-
[Chip as input]: https://
|
132
|
-
[Floating content blocks]:https://
|
133
|
-
[Grid Wide/Table scrolling]:https://
|
134
|
-
|
138
|
+
[Namespaces]: https://coprl-ruby.herokuapp.com/namespaces
|
139
|
+
[Stepper]: https://coprl-ruby.herokuapp.com/steppers
|
140
|
+
[Rich text component]: https://coprl-ruby.herokuapp.com/text_areas
|
141
|
+
[Slider component]: https://coprl-ruby.herokuapp.com/sliders
|
142
|
+
[Tagged Input]: https://coprl-ruby.herokuapp.com/tagged_input
|
143
|
+
[Overline Text Style]: https://coprl-ruby.herokuapp.com/styles
|
144
|
+
[Page separator]: https://coprl-ruby.herokuapp.com/separator
|
145
|
+
[Blank lines]: https://coprl-ruby.herokuapp.com/styles
|
146
|
+
[Grid Padding]: https://coprl-ruby.herokuapp.com/layouts
|
147
|
+
[Map component]: https://coprl-ruby.herokuapp.com/maps
|
148
|
+
[Clear action]: https://coprl-ruby.herokuapp.com/clear_action
|
149
|
+
[Chip as input]: https://coprl-ruby.herokuapp.com/chips#input_chips
|
150
|
+
[Floating content blocks]:https://coprl-ruby.herokuapp.com/content#floating
|
151
|
+
[Grid Wide/Table scrolling]:https://coprl-ruby.herokuapp.com/tables
|
135
152
|
|
136
153
|
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
3
|
|
4
|
-
ruby `cat .ruby-version`
|
4
|
+
ruby `[ -z "$RBENV_VERSION" ] && cat .ruby-version || echo $RBENV_VERSION`
|
5
5
|
# Specify your gem's dependencies in voom-console.gemspec
|
6
6
|
gemspec
|
7
7
|
|
@@ -22,3 +22,4 @@ gem 'image_crop_presenter_plugin', github:'rx/image_crop_presenter_plugin'
|
|
22
22
|
gem 'chart_presenter_plugin', github:'rx/chart_presenter_plugin'
|
23
23
|
gem 'rack-cors'
|
24
24
|
gem 'honeybadger' if ENV.fetch('HONEYBADGER_API_KEY'){false}
|
25
|
+
gem 'puma'
|
data/Gemfile.lock
CHANGED
@@ -56,15 +56,22 @@ GEM
|
|
56
56
|
ice_nine (0.11.2)
|
57
57
|
json (2.3.1)
|
58
58
|
method_source (0.9.0)
|
59
|
-
mini_portile2 (2.
|
59
|
+
mini_portile2 (2.5.1)
|
60
60
|
mustermann (1.1.1)
|
61
61
|
ruby2_keywords (~> 0.0.1)
|
62
|
-
|
63
|
-
|
62
|
+
nio4r (2.5.7)
|
63
|
+
nokogiri (1.11.4)
|
64
|
+
mini_portile2 (~> 2.5.0)
|
65
|
+
racc (~> 1.4)
|
66
|
+
nokogiri (1.11.4-x86_64-darwin)
|
67
|
+
racc (~> 1.4)
|
64
68
|
optimist (3.0.1)
|
65
69
|
pry (0.11.3)
|
66
70
|
coderay (~> 1.1.0)
|
67
71
|
method_source (~> 0.9.0)
|
72
|
+
puma (5.3.1)
|
73
|
+
nio4r (~> 2.0)
|
74
|
+
racc (1.5.2)
|
68
75
|
rack (2.2.3)
|
69
76
|
rack-cors (1.1.0)
|
70
77
|
rack (>= 2.0.0)
|
@@ -130,14 +137,16 @@ GEM
|
|
130
137
|
|
131
138
|
PLATFORMS
|
132
139
|
ruby
|
140
|
+
x86_64-darwin-19
|
133
141
|
|
134
142
|
DEPENDENCIES
|
135
|
-
bundler (
|
143
|
+
bundler (>= 1.13)
|
136
144
|
chart_presenter_plugin!
|
137
145
|
foo_presenter_plugin!
|
138
146
|
gem-release (~> 2.0)
|
139
147
|
image_crop_presenter_plugin!
|
140
148
|
pry
|
149
|
+
puma
|
141
150
|
rack (>= 2.0.6)
|
142
151
|
rack-cors
|
143
152
|
rack-test (~> 0.8)
|
@@ -154,7 +163,7 @@ DEPENDENCIES
|
|
154
163
|
webdrivers (~> 4.1)
|
155
164
|
|
156
165
|
RUBY VERSION
|
157
|
-
ruby 2.
|
166
|
+
ruby 2.7.2p137
|
158
167
|
|
159
168
|
BUNDLED WITH
|
160
|
-
|
169
|
+
2.2.20
|
data/README.md
CHANGED
@@ -1,21 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# COmmon PResenter Language (COPRL)
|
2
|
+
|
3
|
+
![alt text](https://media.giphy.com/media/13LEyaRbQbiWdi/giphy.gif "Power Washer for Building User Interfaces")
|
2
4
|
|
3
5
|
## TLDR;
|
4
|
-
Do you wish you could write a modern user interface in
|
6
|
+
Do you wish you could write a modern user interface in Ruby?
|
5
7
|
|
6
8
|
Now you can. Presenters are a Ruby DSL for rendering user interfaces.
|
7
|
-
The semantics are adopted from [Material Design](https://material.io/).
|
8
9
|
|
10
|
+
* Presenters are a power washer for building user interfaces
|
9
11
|
* Presenters are to HTML/User Interfaces what C is to assembly
|
10
12
|
* A presenter generates a Presenter Object Model (POM)
|
11
13
|
* A POM fully describes a user interface
|
12
14
|
* A POM client can fully render user interface from POM
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
* A Ruby user interface abstraction
|
17
|
-
* A Ruby DSL to build a user interface
|
18
|
-
* A power washer for building user interfaces
|
16
|
+
The semantics are adopted from [Material Design](https://material.io/).
|
19
17
|
|
20
18
|
## Why?
|
21
19
|
|
@@ -39,7 +37,7 @@ This concept was initially inspired by the Presenters concepts of Ivar Jacobson
|
|
39
37
|
|
40
38
|
## Demo
|
41
39
|
|
42
|
-
[Demo]
|
40
|
+
[Demo](https://coprl-ruby.herokuapp.com/)
|
43
41
|
|
44
42
|
Or to run locally:
|
45
43
|
|
@@ -49,6 +47,13 @@ Or to run locally:
|
|
49
47
|
bundle exec rackup
|
50
48
|
|
51
49
|
open http://localhost:9292
|
50
|
+
|
51
|
+
> Note: Demo defaults to Ruby version 2.7.3 in the .ruby-version file. If you want to run a different version
|
52
|
+
> -- set RBENV_VERSION to your desired version.
|
53
|
+
> For example:
|
54
|
+
> ```
|
55
|
+
> RBENV_VERSION=2.5.5 bundle insatall
|
56
|
+
> RBENV_VERSION=2.5.5 bundle exec rackup```
|
52
57
|
|
53
58
|
To see the POM:
|
54
59
|
|
@@ -91,6 +91,16 @@ Voom::Presenters.define(:date_fields) do
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
grid do
|
95
|
+
column 6 do
|
96
|
+
title 'As a simple text field'
|
97
|
+
text 'You can use the date field without a picker and get a simple auto-formatting text input.'
|
98
|
+
date_field picker: false do
|
99
|
+
label 'Birthdate'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
94
104
|
end
|
95
105
|
attach :code, file: __FILE__
|
96
106
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative '../helpers/indented_grid'
|
2
|
+
|
3
|
+
Voom::Presenters.define(:multi_selects) do
|
4
|
+
helpers Demo::Helpers::IndentedGrid
|
5
|
+
attach :top_nav
|
6
|
+
attach :component_drawer
|
7
|
+
page_title 'Multi Select Fields'
|
8
|
+
|
9
|
+
indented_grid do
|
10
|
+
content do
|
11
|
+
multi_select do
|
12
|
+
label 'Multi Select Field'
|
13
|
+
check_option value: 'value1', text: 'First value', selected: true
|
14
|
+
check_option value: 'value2', text: 'Second value', selected: true
|
15
|
+
check_option value: 'value3', text: 'Third value', selected: true
|
16
|
+
end
|
17
|
+
|
18
|
+
multi_select do
|
19
|
+
label 'One Selection'
|
20
|
+
check_option value: 'value1', text: 'First value', selected: true
|
21
|
+
check_option value: 'value2', text: 'Second value', selected: false
|
22
|
+
check_option value: 'value3', text: 'Third value', selected: false
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
attach :code, file: __FILE__
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Voom::Presenters.define(:halted) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
display 'Halted Events'
|
8
|
+
body 'This demonstrates how to respond to failed, or halted events'
|
9
|
+
|
10
|
+
content do
|
11
|
+
button :failed_post do
|
12
|
+
event :click do
|
13
|
+
posts '_echo_', status: 500
|
14
|
+
end
|
15
|
+
event 'V:eventsHalted' do
|
16
|
+
snackbar 'That did not work! Please try again later.'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
attach :code, file: __FILE__
|
23
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Voom::Presenters.define(:events_drawer) do
|
2
2
|
helpers Voom::Presenters::Helpers::Inflector
|
3
3
|
|
4
|
-
events = %i[field_level_events form_level_events tagged_input parallel_events].sort
|
4
|
+
events = %i[field_level_events form_level_events tagged_input parallel_events halted].sort
|
5
5
|
actions = %i[dialog replaces loads toggle_visibility snackbar updates deletes posts clear last_response prompt_if_dirty].sort
|
6
6
|
|
7
7
|
drawer 'Events' do
|
data/app/demo/index.pom
CHANGED
@@ -5,16 +5,16 @@ Voom::Presenters.define(:index) do
|
|
5
5
|
attach :top_nav
|
6
6
|
|
7
7
|
indented_grid do
|
8
|
-
headline 'Presenters', id: :headline
|
9
|
-
subheading '
|
8
|
+
headline 'COmmon PResenter Language (COPRL) Ruby Demo - AKA Presenters', id: :headline
|
9
|
+
subheading 'COPRL is to HTML what C is to assembly'
|
10
10
|
|
11
|
-
body ['A presenter describes a user interface using
|
12
|
-
'The presenter is evaluated and a presenter object model (POM) is generated.',
|
11
|
+
body ['A presenter describes a user interface using DSL.',
|
12
|
+
'The presenter is evaluated and a presenter object model (POM) is generated. The POM can be serialized as JSON.',
|
13
13
|
'A client that renders POM can display the given user interface.']
|
14
14
|
|
15
15
|
body 'To get started checkout the components and events.'
|
16
16
|
|
17
|
-
subheading 'For example this is the presenter
|
17
|
+
subheading 'For example this is the complete presenter DSL for this page:', level: 2
|
18
18
|
|
19
19
|
source = File.read(__FILE__)
|
20
20
|
body <<~HEREDOC
|
data/app/demo/nav/top_nav.pom
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
Voom::Presenters.define('top_nav') do
|
2
|
+
TITLE = 'COmmon PResenters Language (COPRL) Ruby Demo'
|
2
3
|
page do
|
3
|
-
title
|
4
|
+
title TITLE
|
4
5
|
end
|
5
6
|
|
6
|
-
header
|
7
|
+
header TITLE do
|
7
8
|
nav do
|
8
9
|
item 'About' do
|
9
10
|
event :click do
|
@@ -52,13 +53,6 @@ Voom::Presenters.define('top_nav') do
|
|
52
53
|
loads :plugins
|
53
54
|
end
|
54
55
|
end
|
55
|
-
|
56
|
-
item 'Status' do
|
57
|
-
event :click do
|
58
|
-
loads :component_status
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
56
|
end
|
63
57
|
end
|
64
58
|
end
|
data/{bin → exe}/presenters
RENAMED
File without changes
|
data/lib/voom.rb
CHANGED
@@ -5,14 +5,27 @@ module Voom
|
|
5
5
|
module DSL
|
6
6
|
module Components
|
7
7
|
class DateField < DatetimeBase
|
8
|
+
DEFAULT_HINT = 'Enter date as MM/DD/YYYY'
|
9
|
+
DEFAULT_ERROR = "Invalid date. #{DEFAULT_HINT}"
|
10
|
+
|
8
11
|
attr_reader :config
|
9
12
|
|
10
13
|
def initialize(**attribs_, &block)
|
11
14
|
super(type: :date, **attribs_, &block)
|
12
15
|
merge_config(:min_date)
|
13
16
|
merge_config(:max_date)
|
17
|
+
unless @picker
|
18
|
+
@hint ||= DEFAULT_HINT
|
19
|
+
@validation_error ||= DEFAULT_ERROR
|
20
|
+
end
|
14
21
|
expand!
|
15
22
|
end
|
23
|
+
|
24
|
+
def validation_error(error=nil)
|
25
|
+
return @validation_error if locked?
|
26
|
+
@validation_error ||= error
|
27
|
+
end
|
28
|
+
|
16
29
|
end
|
17
30
|
end
|
18
31
|
end
|
@@ -3,7 +3,7 @@ module Voom
|
|
3
3
|
module DSL
|
4
4
|
module Components
|
5
5
|
class DatetimeBase < TextField
|
6
|
-
attr_reader :config
|
6
|
+
attr_reader :config, :picker
|
7
7
|
|
8
8
|
def initialize(**attribs_, &block)
|
9
9
|
super(**attribs_, &block)
|
@@ -12,6 +12,7 @@ module Voom
|
|
12
12
|
merge_config(:disable)
|
13
13
|
merge_config(:enable)
|
14
14
|
merge_config(:mode)
|
15
|
+
@picker = attribs_.delete(:picker){ true }
|
15
16
|
|
16
17
|
my_id = self.id
|
17
18
|
clear_icon(:clear) do
|