phlex 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of phlex might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +4 -0
- data/Gemfile +15 -3
- data/README.md +14 -30
- data/Rakefile +4 -6
- data/bench.rb +14 -0
- data/config.ru +9 -0
- data/docs/assets/application.css +24 -0
- data/docs/assets/logo.png +0 -0
- data/docs/build.rb +22 -0
- data/docs/components/callout.rb +9 -0
- data/docs/components/code_block.rb +26 -0
- data/docs/components/example.rb +32 -0
- data/docs/components/heading.rb +9 -0
- data/docs/components/layout.rb +45 -0
- data/docs/components/markdown.rb +26 -0
- data/docs/components/tabs/tab.rb +26 -0
- data/docs/components/tabs.rb +30 -0
- data/docs/components/title.rb +9 -0
- data/docs/page_builder.rb +36 -0
- data/docs/pages/application_page.rb +7 -0
- data/docs/pages/components.rb +175 -0
- data/docs/pages/index.rb +40 -0
- data/docs/pages/templates.rb +242 -0
- data/fixtures/component_helper.rb +16 -0
- data/fixtures/dummy/app/assets/config/manifest.js +0 -0
- data/fixtures/dummy/app/controllers/articles_controller.rb +4 -0
- data/fixtures/dummy/app/views/articles/form.rb +13 -0
- data/fixtures/dummy/app/views/articles/index.html.erb +11 -0
- data/fixtures/dummy/app/views/articles/new.html.erb +1 -0
- data/fixtures/dummy/app/views/card.rb +13 -0
- data/fixtures/dummy/config/database.yml +3 -0
- data/fixtures/dummy/config/routes.rb +5 -0
- data/fixtures/dummy/config/storage.yml +3 -0
- data/fixtures/dummy/db/schema.rb +6 -0
- data/fixtures/dummy/log/.gitignore +1 -0
- data/fixtures/dummy/public/favicon.ico +0 -0
- data/fixtures/layout.rb +31 -0
- data/fixtures/page.rb +41 -0
- data/fixtures/test_helper.rb +13 -0
- data/lib/generators/phlex/component/USAGE +8 -0
- data/lib/generators/phlex/component/component_generator.rb +13 -0
- data/lib/generators/phlex/component/templates/component.rb.erb +8 -0
- data/lib/overrides/symbol/name.rb +5 -0
- data/lib/phlex/block.rb +18 -0
- data/lib/phlex/buffered.rb +19 -0
- data/lib/phlex/component.rb +169 -23
- data/lib/phlex/configuration.rb +7 -0
- data/lib/phlex/html.rb +65 -0
- data/lib/phlex/rails/tag_helpers.rb +29 -0
- data/lib/phlex/rails.rb +8 -0
- data/lib/phlex/renderable.rb +35 -0
- data/lib/phlex/version.rb +1 -1
- data/lib/phlex.rb +25 -15
- data/package-lock.json +1195 -0
- data/package.json +5 -0
- data/phlex_logo.png +0 -0
- data/tailwind.config.js +7 -0
- metadata +64 -21
- data/Gemfile.lock +0 -32
- data/lib/phlex/callable.rb +0 -11
- data/lib/phlex/context.rb +0 -39
- data/lib/phlex/node.rb +0 -13
- data/lib/phlex/page.rb +0 -3
- data/lib/phlex/tag/standard_element.rb +0 -15
- data/lib/phlex/tag/void_element.rb +0 -9
- data/lib/phlex/tag.rb +0 -43
- data/lib/phlex/tags.rb +0 -108
- data/lib/phlex/text.rb +0 -13
data/package.json
ADDED
data/phlex_logo.png
ADDED
Binary file
|
data/tailwind.config.js
ADDED
metadata
CHANGED
@@ -1,64 +1,107 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Drapper
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: zeitwerk
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
27
|
-
description:
|
26
|
+
version: '2.6'
|
27
|
+
description: A high-performance view component framework optimised for developer happiness.
|
28
28
|
email:
|
29
29
|
- joel@drapper.me
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".rspec"
|
35
|
+
- ".rubocop.yml"
|
34
36
|
- CHANGELOG.md
|
35
37
|
- CODE_OF_CONDUCT.md
|
36
38
|
- Gemfile
|
37
|
-
- Gemfile.lock
|
38
39
|
- LICENSE.txt
|
39
40
|
- README.md
|
40
41
|
- Rakefile
|
42
|
+
- bench.rb
|
43
|
+
- config.ru
|
44
|
+
- docs/assets/application.css
|
45
|
+
- docs/assets/logo.png
|
46
|
+
- docs/build.rb
|
47
|
+
- docs/components/callout.rb
|
48
|
+
- docs/components/code_block.rb
|
49
|
+
- docs/components/example.rb
|
50
|
+
- docs/components/heading.rb
|
51
|
+
- docs/components/layout.rb
|
52
|
+
- docs/components/markdown.rb
|
53
|
+
- docs/components/tabs.rb
|
54
|
+
- docs/components/tabs/tab.rb
|
55
|
+
- docs/components/title.rb
|
56
|
+
- docs/page_builder.rb
|
57
|
+
- docs/pages/application_page.rb
|
58
|
+
- docs/pages/components.rb
|
59
|
+
- docs/pages/index.rb
|
60
|
+
- docs/pages/templates.rb
|
61
|
+
- fixtures/component_helper.rb
|
62
|
+
- fixtures/dummy/app/assets/config/manifest.js
|
63
|
+
- fixtures/dummy/app/controllers/articles_controller.rb
|
64
|
+
- fixtures/dummy/app/views/articles/form.rb
|
65
|
+
- fixtures/dummy/app/views/articles/index.html.erb
|
66
|
+
- fixtures/dummy/app/views/articles/new.html.erb
|
67
|
+
- fixtures/dummy/app/views/card.rb
|
68
|
+
- fixtures/dummy/config/database.yml
|
69
|
+
- fixtures/dummy/config/routes.rb
|
70
|
+
- fixtures/dummy/config/storage.yml
|
71
|
+
- fixtures/dummy/db/schema.rb
|
72
|
+
- fixtures/dummy/log/.gitignore
|
73
|
+
- fixtures/dummy/public/favicon.ico
|
74
|
+
- fixtures/layout.rb
|
75
|
+
- fixtures/page.rb
|
76
|
+
- fixtures/test_helper.rb
|
77
|
+
- lib/generators/phlex/component/USAGE
|
78
|
+
- lib/generators/phlex/component/component_generator.rb
|
79
|
+
- lib/generators/phlex/component/templates/component.rb.erb
|
80
|
+
- lib/overrides/symbol/name.rb
|
41
81
|
- lib/phlex.rb
|
42
|
-
- lib/phlex/
|
82
|
+
- lib/phlex/block.rb
|
83
|
+
- lib/phlex/buffered.rb
|
43
84
|
- lib/phlex/component.rb
|
44
|
-
- lib/phlex/
|
45
|
-
- lib/phlex/
|
46
|
-
- lib/phlex/page.rb
|
85
|
+
- lib/phlex/configuration.rb
|
86
|
+
- lib/phlex/html.rb
|
47
87
|
- lib/phlex/rails.rb
|
48
|
-
- lib/phlex/
|
49
|
-
- lib/phlex/
|
50
|
-
- lib/phlex/tag/void_element.rb
|
51
|
-
- lib/phlex/tags.rb
|
52
|
-
- lib/phlex/text.rb
|
88
|
+
- lib/phlex/rails/tag_helpers.rb
|
89
|
+
- lib/phlex/renderable.rb
|
53
90
|
- lib/phlex/version.rb
|
91
|
+
- package-lock.json
|
92
|
+
- package.json
|
93
|
+
- phlex_logo.png
|
54
94
|
- sig/phlex.rbs
|
55
|
-
|
95
|
+
- tailwind.config.js
|
96
|
+
homepage: https://www.phlex.fun
|
56
97
|
licenses:
|
57
98
|
- MIT
|
58
99
|
metadata:
|
59
|
-
homepage_uri: https://
|
100
|
+
homepage_uri: https://www.phlex.fun
|
60
101
|
source_code_uri: https://github.com/joeldrapper/phlex
|
61
|
-
changelog_uri: https://github.com/joeldrapper/phlex
|
102
|
+
changelog_uri: https://github.com/joeldrapper/phlex/releases
|
103
|
+
funding_uri: https://github.com/sponsors/joeldrapper
|
104
|
+
rubygems_mfa_required: 'true'
|
62
105
|
post_install_message:
|
63
106
|
rdoc_options: []
|
64
107
|
require_paths:
|
@@ -67,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
110
|
requirements:
|
68
111
|
- - ">="
|
69
112
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
113
|
+
version: '2.7'
|
71
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
115
|
requirements:
|
73
116
|
- - ">="
|
@@ -77,5 +120,5 @@ requirements: []
|
|
77
120
|
rubygems_version: 3.3.7
|
78
121
|
signing_key:
|
79
122
|
specification_version: 4
|
80
|
-
summary:
|
123
|
+
summary: A framework for building view components with a Ruby DSL.
|
81
124
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
phlex (0.1.0)
|
5
|
-
activesupport (~> 7.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activesupport (7.0.3)
|
11
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
-
i18n (>= 1.6, < 2)
|
13
|
-
minitest (>= 5.1)
|
14
|
-
tzinfo (~> 2.0)
|
15
|
-
concurrent-ruby (1.1.10)
|
16
|
-
i18n (1.10.0)
|
17
|
-
concurrent-ruby (~> 1.0)
|
18
|
-
minitest (5.15.0)
|
19
|
-
rake (13.0.6)
|
20
|
-
tzinfo (2.0.4)
|
21
|
-
concurrent-ruby (~> 1.0)
|
22
|
-
|
23
|
-
PLATFORMS
|
24
|
-
arm64-darwin-21
|
25
|
-
|
26
|
-
DEPENDENCIES
|
27
|
-
minitest (~> 5.0)
|
28
|
-
phlex!
|
29
|
-
rake (~> 13.0)
|
30
|
-
|
31
|
-
BUNDLED WITH
|
32
|
-
2.3.7
|
data/lib/phlex/callable.rb
DELETED
data/lib/phlex/context.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Phlex
|
4
|
-
module Context
|
5
|
-
def text(content)
|
6
|
-
self << Text.new(content)
|
7
|
-
end
|
8
|
-
|
9
|
-
def component(component, *args, **kwargs, &block)
|
10
|
-
assigns = instance_variables
|
11
|
-
.reject { _1.start_with? "@_" }
|
12
|
-
.map { [_1, instance_variable_get(_1)] }.to_h
|
13
|
-
|
14
|
-
comp = component.new(*args, assigns:, **kwargs, &block)
|
15
|
-
self << comp
|
16
|
-
end
|
17
|
-
|
18
|
-
Tag::StandardElement.subclasses.each do |tag|
|
19
|
-
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
20
|
-
def #{tag.value}(content = nil, **kwargs, &block)
|
21
|
-
raise ArgumentError if content && block_given?
|
22
|
-
tag = #{tag.name}.new(**kwargs)
|
23
|
-
self << tag
|
24
|
-
render_tag(tag, &block) if block_given?
|
25
|
-
render_tag(tag) { text content } if content
|
26
|
-
end
|
27
|
-
RUBY
|
28
|
-
end
|
29
|
-
|
30
|
-
Tag::VoidElement.subclasses.each do |tag|
|
31
|
-
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
32
|
-
def #{tag.value}(**kwargs)
|
33
|
-
tag = #{tag.name}.new(**kwargs)
|
34
|
-
self << tag
|
35
|
-
end
|
36
|
-
RUBY
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/phlex/node.rb
DELETED
data/lib/phlex/page.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
module Phlex
|
2
|
-
class Tag
|
3
|
-
class StandardElement < Tag
|
4
|
-
include Node
|
5
|
-
|
6
|
-
def call
|
7
|
-
"<#{meta_data}>#{super}</#{self.class.value}>"
|
8
|
-
end
|
9
|
-
|
10
|
-
def method_missing(*args, **kwargs, &block)
|
11
|
-
super.tap { Context.new(self).call(&block) if block_given? }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/lib/phlex/tag.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Phlex
|
4
|
-
class Tag
|
5
|
-
SPACE = " "
|
6
|
-
NAMESPACE_DELINEATOR = "::"
|
7
|
-
|
8
|
-
class << self
|
9
|
-
attr_accessor :abstract
|
10
|
-
|
11
|
-
def value
|
12
|
-
name.split(NAMESPACE_DELINEATOR).last.downcase
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def call
|
17
|
-
raise NoMethodError
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize(**attributes)
|
21
|
-
@attributes = attributes
|
22
|
-
.transform_values { _1.split(SPACE) if _1.is_a?(String) }
|
23
|
-
end
|
24
|
-
|
25
|
-
# def method_missing(name, *args, **kwargs, &block)
|
26
|
-
# @attributes[:class] ||= []
|
27
|
-
# @attributes[:class] << name
|
28
|
-
# self
|
29
|
-
# end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def meta_data
|
34
|
-
([self.class.value] + build_attributes).join(SPACE)
|
35
|
-
end
|
36
|
-
|
37
|
-
def build_attributes
|
38
|
-
@attributes
|
39
|
-
.transform_values { _1.join(SPACE) }
|
40
|
-
.map { |k, v| "#{k}=\"#{v}\"" }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/phlex/tags.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
module Phlex
|
2
|
-
class Tag
|
3
|
-
class Area < VoidElement; end
|
4
|
-
class Embed < VoidElement; end
|
5
|
-
class Img < VoidElement; end
|
6
|
-
class Input < VoidElement; end
|
7
|
-
class Link < VoidElement; end
|
8
|
-
class Meta < VoidElement; end
|
9
|
-
class Param < VoidElement; end
|
10
|
-
class Track < VoidElement; end
|
11
|
-
class Col < VoidElement; end
|
12
|
-
|
13
|
-
class A < StandardElement; end
|
14
|
-
class Abbr < StandardElement; end
|
15
|
-
class Address < StandardElement; end
|
16
|
-
class Article < StandardElement; end
|
17
|
-
class Aside < StandardElement; end
|
18
|
-
class B < StandardElement; end
|
19
|
-
class Bdi < StandardElement; end
|
20
|
-
class Bdo < StandardElement; end
|
21
|
-
class Blockquote < StandardElement; end
|
22
|
-
class Body < StandardElement; end
|
23
|
-
class Button < StandardElement; end
|
24
|
-
class Caption < StandardElement; end
|
25
|
-
class Cite < StandardElement; end
|
26
|
-
class Code < StandardElement; end
|
27
|
-
class Colgroup < StandardElement; end
|
28
|
-
class Data < StandardElement; end
|
29
|
-
class Datalist < StandardElement; end
|
30
|
-
class Dd < StandardElement; end
|
31
|
-
class Del < StandardElement; end
|
32
|
-
class Details < StandardElement; end
|
33
|
-
class Dfn < StandardElement; end
|
34
|
-
class Dialog < StandardElement; end
|
35
|
-
class Div < StandardElement; end
|
36
|
-
class Dl < StandardElement; end
|
37
|
-
class Dt < StandardElement; end
|
38
|
-
class Em < StandardElement; end
|
39
|
-
class Fieldset < StandardElement; end
|
40
|
-
class Figcaption < StandardElement; end
|
41
|
-
class Figure < StandardElement; end
|
42
|
-
class Footer < StandardElement; end
|
43
|
-
class Form < StandardElement; end
|
44
|
-
class H1 < StandardElement; end
|
45
|
-
class H2 < StandardElement; end
|
46
|
-
class H3 < StandardElement; end
|
47
|
-
class H4 < StandardElement; end
|
48
|
-
class H5 < StandardElement; end
|
49
|
-
class H6 < StandardElement; end
|
50
|
-
class Head < StandardElement; end
|
51
|
-
class Header < StandardElement; end
|
52
|
-
class Html < StandardElement; end
|
53
|
-
class I < StandardElement; end
|
54
|
-
class Iframe < StandardElement; end
|
55
|
-
class Ins < StandardElement; end
|
56
|
-
class Kbd < StandardElement; end
|
57
|
-
class Label < StandardElement; end
|
58
|
-
class Legend < StandardElement; end
|
59
|
-
class Li < StandardElement; end
|
60
|
-
class Main < StandardElement; end
|
61
|
-
class Map < StandardElement; end
|
62
|
-
class Mark < StandardElement; end
|
63
|
-
class Menuitem < StandardElement; end
|
64
|
-
class Meter < StandardElement; end
|
65
|
-
class Nav < StandardElement; end
|
66
|
-
class Noscript < StandardElement; end
|
67
|
-
class Object < StandardElement; end
|
68
|
-
class Ol < StandardElement; end
|
69
|
-
class Optgroup < StandardElement; end
|
70
|
-
class Option < StandardElement; end
|
71
|
-
class Output < StandardElement; end
|
72
|
-
class P < StandardElement; end
|
73
|
-
class Picture < StandardElement; end
|
74
|
-
class Pre < StandardElement; end
|
75
|
-
class Progress < StandardElement; end
|
76
|
-
class Q < StandardElement; end
|
77
|
-
class Rp < StandardElement; end
|
78
|
-
class Rt < StandardElement; end
|
79
|
-
class Ruby < StandardElement; end
|
80
|
-
class S < StandardElement; end
|
81
|
-
class Samp < StandardElement; end
|
82
|
-
class Script < StandardElement; end
|
83
|
-
class Section < StandardElement; end
|
84
|
-
class Select < StandardElement; end
|
85
|
-
class Slot < StandardElement; end
|
86
|
-
class Small < StandardElement; end
|
87
|
-
class Span < StandardElement; end
|
88
|
-
class Strong < StandardElement; end
|
89
|
-
class Sub < StandardElement; end
|
90
|
-
class Summary < StandardElement; end
|
91
|
-
class Sup < StandardElement; end
|
92
|
-
class Table < StandardElement; end
|
93
|
-
class Tbody < StandardElement; end
|
94
|
-
class Td < StandardElement; end
|
95
|
-
class Template < StandardElement; end
|
96
|
-
class Textarea < StandardElement; end
|
97
|
-
class Tfoot < StandardElement; end
|
98
|
-
class Th < StandardElement; end
|
99
|
-
class Thead < StandardElement; end
|
100
|
-
class Time < StandardElement; end
|
101
|
-
class Title < StandardElement; end
|
102
|
-
class Tr < StandardElement; end
|
103
|
-
class U < StandardElement; end
|
104
|
-
class Ul < StandardElement; end
|
105
|
-
class Video < StandardElement; end
|
106
|
-
class Wbr < StandardElement; end
|
107
|
-
end
|
108
|
-
end
|