heartml 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 062ef7253f124e9607e30c9b39e1d1f33cc15507c9052d93b500df12dcddc5fe
4
+ data.tar.gz: c6c82a441fbd6f8b61857522dea00ee314a89a50153f55f055616fbff19642b4
5
+ SHA512:
6
+ metadata.gz: 7137f572c71c7ee1891ce65c503809815648518f99410bcd4d2a5d63497ad04c3c29301ca996d06c3d99605158f958bdb3ff8f37f9fb261b83c89c59b75c98a3
7
+ data.tar.gz: 39bb3ea5565c9f7345b36e97df7e152b1b8ea42d52f00d866655b0bfdaf01397fac43e34a80d72d14a31f5cfde44fcaff97d38d9f53dc1f24cc55222c1a6aa82
data/.rubocop.yml ADDED
@@ -0,0 +1,36 @@
1
+ require:
2
+ - rubocop-minitest
3
+ - rubocop-rake
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.0
7
+ NewCops: enable
8
+
9
+ Metrics/MethodLength:
10
+ Max: 20
11
+
12
+ Metrics/ModuleLength:
13
+ Enabled: false
14
+
15
+ Style/Documentation:
16
+ Enabled: false
17
+
18
+ Style/LambdaCall:
19
+ Enabled: false
20
+
21
+ Style/ParallelAssignment:
22
+ Enabled: false
23
+
24
+ Style/RegexpLiteral:
25
+ Enabled: false
26
+
27
+ Style/StringLiterals:
28
+ Enabled: true
29
+ EnforcedStyle: double_quotes
30
+
31
+ Style/StringLiteralsInInterpolation:
32
+ Enabled: true
33
+ EnforcedStyle: double_quotes
34
+
35
+ Layout/LineLength:
36
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.0.0.beta1] - 2023-08-12
4
+
5
+ - Major refactor as part of the new Heartml project
6
+
7
+ ## [1.0.0.alpha10] - 2023-04-04
8
+
9
+ - Update debugging features based on Nokolexbor fixes
10
+
11
+ ## [1.0.0.alpha9] - 2023-04-02
12
+
13
+ - Add support for effects template syntax
14
+ - Let `camelcased` handle symbol arrays, so it works with `attr_reader`
15
+
16
+ ## [1.0.0.alpha8] - 2023-03-23
17
+
18
+ - Fix bug with view context
19
+
20
+ ## [1.0.0.alpha7] - 2023-03-23
21
+
22
+ - Provide original child nodes through the view context
23
+
24
+ ## [1.0.0.alpha6] - 2023-03-23
25
+
26
+ - Indicate that child content in Bridgetown is HTML safe
27
+
28
+ ## [1.0.0.alpha5] - 2023-03-23
29
+
30
+ - Add Bridgetown plugin support
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at jared@jaredwhite.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in heart.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+
14
+ gem "rubocop-minitest", "~> 0.22.1"
15
+ gem "rubocop-rake", "~> 0.6.0"
16
+
17
+ gem "solargraph", "~> 0.47.2", group: :development
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ heartml (1.0.0.beta1)
5
+ concurrent-ruby (~> 1.2)
6
+ nokolexbor (>= 0.4.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (7.0.4.3)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ ast (2.4.2)
17
+ backport (1.2.0)
18
+ benchmark (0.2.1)
19
+ concurrent-ruby (1.2.2)
20
+ diff-lcs (1.5.0)
21
+ e2mmap (0.1.0)
22
+ hash_with_dot_access (1.2.0)
23
+ activesupport (>= 5.0.0, < 8.0)
24
+ i18n (1.12.0)
25
+ concurrent-ruby (~> 1.0)
26
+ jaro_winkler (1.5.4)
27
+ json (2.6.3)
28
+ kramdown (2.4.0)
29
+ rexml
30
+ kramdown-parser-gfm (1.1.0)
31
+ kramdown (~> 2.0)
32
+ mini_portile2 (2.8.4)
33
+ minitest (5.18.0)
34
+ nokogiri (1.14.2)
35
+ mini_portile2 (~> 2.8.0)
36
+ racc (~> 1.4)
37
+ nokogiri (1.14.2-arm64-darwin)
38
+ racc (~> 1.4)
39
+ nokogiri (1.14.2-x86_64-linux)
40
+ racc (~> 1.4)
41
+ nokolexbor (0.5.0)
42
+ nokolexbor (0.5.0-arm64-darwin)
43
+ nokolexbor (0.5.0-x86_64-linux)
44
+ parallel (1.22.1)
45
+ parser (3.2.2.0)
46
+ ast (~> 2.4.1)
47
+ racc (1.6.2)
48
+ rainbow (3.1.1)
49
+ rake (13.0.6)
50
+ regexp_parser (2.7.0)
51
+ reverse_markdown (2.1.1)
52
+ nokogiri
53
+ rexml (3.2.5)
54
+ rubocop (1.49.0)
55
+ json (~> 2.3)
56
+ parallel (~> 1.10)
57
+ parser (>= 3.2.0.0)
58
+ rainbow (>= 2.2.2, < 4.0)
59
+ regexp_parser (>= 1.8, < 3.0)
60
+ rexml (>= 3.2.5, < 4.0)
61
+ rubocop-ast (>= 1.28.0, < 2.0)
62
+ ruby-progressbar (~> 1.7)
63
+ unicode-display_width (>= 2.4.0, < 3.0)
64
+ rubocop-ast (1.28.0)
65
+ parser (>= 3.2.1.0)
66
+ rubocop-minitest (0.22.2)
67
+ rubocop (>= 0.90, < 2.0)
68
+ rubocop-rake (0.6.0)
69
+ rubocop (~> 1.0)
70
+ ruby-progressbar (1.13.0)
71
+ solargraph (0.47.2)
72
+ backport (~> 1.2)
73
+ benchmark
74
+ bundler (>= 1.17.2)
75
+ diff-lcs (~> 1.4)
76
+ e2mmap
77
+ jaro_winkler (~> 1.5)
78
+ kramdown (~> 2.3)
79
+ kramdown-parser-gfm (~> 1.1)
80
+ parser (~> 3.0)
81
+ reverse_markdown (>= 1.0.5, < 3)
82
+ rubocop (>= 0.52)
83
+ thor (~> 1.0)
84
+ tilt (~> 2.0)
85
+ yard (~> 0.9, >= 0.9.24)
86
+ thor (1.2.1)
87
+ tilt (2.1.0)
88
+ tzinfo (2.0.6)
89
+ concurrent-ruby (~> 1.0)
90
+ unicode-display_width (2.4.2)
91
+ webrick (1.7.0)
92
+ yard (0.9.28)
93
+ webrick (~> 1.7.0)
94
+
95
+ PLATFORMS
96
+ arm64-darwin-21
97
+ ruby
98
+ x86_64-linux
99
+
100
+ DEPENDENCIES
101
+ hash_with_dot_access (~> 1.2)
102
+ heartml!
103
+ minitest (~> 5.0)
104
+ rake (~> 13.0)
105
+ rubocop (~> 1.21)
106
+ rubocop-minitest (~> 0.22.1)
107
+ rubocop-rake (~> 0.6.0)
108
+ solargraph (~> 0.47.2)
109
+
110
+ BUNDLED WITH
111
+ 2.3.14
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Jared White
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Heartml: Ruby (WIP)
2
+
3
+ Server-rendered web components in Ruby using a SFC (Single-File Component) format loosely based on [HTML Modules](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/html-modules-explainer.md). Logic on the server-side is analogous to client-side logic provided by the Heartml web component library written in JavaScript.
4
+
5
+ Great for pairing with [esbuild-plugin-html-modules](https://github.com/hotmodule/esbuild-plugin-html-modules) for a full-stack component rendering pipeline.
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add heartml
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install heartml
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ To install this gem onto your local machine, run `bin/rake install`. To release a new version, update the version number in `version.rb`, and then run `bin/rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/heartml/heartml-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/heartml/heartml-ruby/blob/main/CODE_OF_CONDUCT.md).
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
34
+
35
+ ## Code of Conduct
36
+
37
+ Everyone interacting in the Heartml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/heartml/heartml-ruby/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/test_*.rb"]
10
+ end
11
+
12
+ require "rubocop/rake_task"
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ task default: %i[test rubocop]
data/benchmark.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path("lib", __dir__)
4
+ require "heartml"
5
+
6
+ require_relative "test/fixtures/classes"
7
+
8
+ require "benchmark"
9
+
10
+ Benchmark.bmbm do |x|
11
+ x.report("render") do
12
+ 1000.times do |i|
13
+ Templated.new(name: i.to_s).()
14
+ end
15
+ end
16
+ end
data/heartml.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/heartml/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "heartml"
7
+ spec.version = Heartml::VERSION
8
+ spec.authors = ["Jared White"]
9
+ spec.email = ["jared@whitefusion.studio"]
10
+
11
+ spec.summary = "Server-rendered web components"
12
+ spec.homepage = "https://github.com/heartml/heartml-ruby#readme"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 3.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/heartml/heartml-ruby"
18
+ spec.metadata["changelog_uri"] = "https://github.com/heartml/heartml-ruby/blob/main/CHANGELOG.md"
19
+ spec.metadata["rubygems_mfa_required"] = "true"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
+ end
27
+ end
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_dependency "concurrent-ruby", "~> 1.2"
31
+ spec.add_dependency "nokolexbor", ">= 0.4.2"
32
+
33
+ spec.add_development_dependency "hash_with_dot_access", "~> 1.2"
34
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Heartml
4
+ class ComponentRenderer < Bridgetown::Builder
5
+ def build
6
+ render_heart_modules
7
+ end
8
+
9
+ # TODO: rework this using new server effects and component context!
10
+ def render_heart_modules
11
+ inspect_html do |doc, resource|
12
+ view_context = Bridgetown::ERBView.new(resource)
13
+
14
+ FragmentRenderComponent.new(body: doc.body, scope: resource).render_in(view_context, rendering_mode: node)
15
+
16
+ # Heartml.registered_elements.each do |component|
17
+ # tag_name = component.tag_name
18
+ # doc.xpath("//#{tag_name}").reverse.each do |node|
19
+ # if node["server-ignore"]
20
+ # node.remove_attribute("server-ignore")
21
+ # next
22
+ # end
23
+
24
+ # attrs = node.attributes.transform_values(&:value)
25
+ # attrs.reject! { |k| k.start_with?("server-") }
26
+
27
+ # new_attrs = {}
28
+ # attrs.each do |k, v|
29
+ # next unless k.start_with?("arg:")
30
+
31
+ # new_key = k.delete_prefix("arg:")
32
+ # attrs.delete(k)
33
+ # new_attrs[new_key] = resource.instance_eval(v)
34
+ # end
35
+ # attrs.merge!(new_attrs)
36
+ # attrs.transform_keys!(&:to_sym)
37
+
38
+ # new_node = node.replace(
39
+ # component.new(**attrs).render_in(view_context, rendering_mode: :node) { node.children }
40
+ # )
41
+ # new_node.remove_attribute("server-ignore")
42
+ # end
43
+ # rescue StandardError => e
44
+ # Bridgetown.logger.error "Unable to render <#{tag_name}> (#{component}) in #{resource.path}"
45
+ # raise e
46
+ # end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Heartml
4
+ class Fragment
5
+ def initialize(fragment, component)
6
+ @fragment = fragment
7
+ @component = component
8
+ @attribute_bindings = component.class.attribute_bindings.each do |attr_def|
9
+ attr_def.method = component.method(attr_def.method_name)
10
+ end
11
+ end
12
+
13
+ # NOTE: for some reason, the traverse method yields node children first, then the
14
+ # parent node. That doesn't work for our case. We want to go strictly in source order.
15
+ # So this is our own implementation of that.
16
+ def traverse(node, &block)
17
+ yield(node)
18
+ node.children.each { |child| traverse(child, &block) }
19
+ end
20
+
21
+ def process(fragment = @fragment) # rubocop:disable Metrics
22
+ traverse(fragment) do |node| # rubocop:disable Metrics/BlockLength
23
+ component = Heartml.registered_elements.find { _1.tag_name == node.name }
24
+ if component
25
+ attrs = node.attributes.dup
26
+
27
+ new_attrs = {}
28
+ attrs.each do |k, attr|
29
+ unless k == "server-args"
30
+ new_attrs[k] = attr.value
31
+ next
32
+ end
33
+ v = attr.value
34
+
35
+ params = v.split(";").map(&:strip)
36
+
37
+ params.each do |param|
38
+ new_key, v2 = param.split(":").map(&:strip)
39
+ new_attrs[new_key] = @component.evaluate_attribute_expression(attr, v2)
40
+ end
41
+ attrs.delete(k)
42
+ end
43
+ attrs.merge!(new_attrs)
44
+ attrs.reject! { |k| k.start_with?("server-") || k.start_with?("iso-") || k.start_with?("host-") }
45
+ attrs.transform_keys!(&:to_sym)
46
+
47
+ obj = component.new(**attrs)
48
+ render_output = if obj.respond_to?(:render_in)
49
+ obj.render_in(@component.view_context, rendering_mode: :node) { node.children }
50
+ else
51
+ obj.render_element(content: node.children)
52
+ end
53
+
54
+ node.replace(render_output)
55
+ end
56
+
57
+ process_attribute_bindings(node)
58
+ end
59
+ end
60
+
61
+ def process_attribute_bindings(node) # rubocop:todo Metrics
62
+ node.attributes.each do |name, attr_node|
63
+ @attribute_bindings.each do |attribute_binding|
64
+ next if attribute_binding.only_for_tag && node.name != attribute_binding.only_for_tag.to_s
65
+ next unless attribute_binding.matcher.match?(name)
66
+ next if attribute_binding.method.receiver._check_stack(node)
67
+
68
+ break unless attribute_binding.method.(attribute: attr_node, node: node)
69
+ end
70
+ rescue Exception => e # rubocop:disable Lint/RescueException
71
+ line_segments = [@component.class.heart_module, @component.class.line_number_of_node(attr_node)]
72
+ puts "here we go!"
73
+ raise e.class, e.message.lines.first, [line_segments.join(":"), *e.backtrace]
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "heartml"
4
+
5
+ module Heartml
6
+ module Petite
7
+ # @param klass [Class]
8
+ # @return [void]
9
+ def self.included(klass)
10
+ klass.attribute_binding "v-for", :_petite_for_binding, only: :template
11
+ klass.attribute_binding "v-text", :_petite_text_binding
12
+ klass.attribute_binding "v-html", :_petite_html_binding
13
+ klass.attribute_binding "v-bind", :_petite_bound_attribute
14
+ klass.attribute_binding %r{^:}, :_petite_bound_attribute
15
+ end
16
+
17
+ protected
18
+
19
+ def _petite_for_binding(attribute:, node:)
20
+ delimiter = node["v-for"].include?(" of ") ? " of " : " in "
21
+ expression = node["v-for"].split(delimiter)
22
+
23
+ process_list(
24
+ attribute: attribute,
25
+ node: node,
26
+ item_node: node.children[0].first_element_child,
27
+ for_in: expression
28
+ )
29
+ end
30
+
31
+ def _petite_text_binding(attribute:, node:)
32
+ node.content = evaluate_attribute_expression(attribute).to_s
33
+ end
34
+
35
+ def _petite_html_binding(attribute:, node:)
36
+ node.inner_html = evaluate_attribute_expression(attribute).to_s
37
+ end
38
+
39
+ def _petite_bound_attribute(attribute:, node:) # rubocop:disable Metrics
40
+ return if attribute.name == ":key"
41
+
42
+ real_attribute = if attribute.name.start_with?(":")
43
+ attribute.name.delete_prefix(":")
44
+ elsif attribute.name.start_with?("v-bind:")
45
+ attribute.name.delete_prefix("v-bind:")
46
+ end
47
+
48
+ obj = evaluate_attribute_expression(attribute)
49
+
50
+ if real_attribute == "class"
51
+ node[real_attribute] = class_list_for(obj)
52
+ elsif real_attribute != "style" # style bindings aren't SSRed
53
+ node[real_attribute] = obj if obj
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Heartml
4
+ # Add a couple familar DOM API features to Nokolexbor
5
+ module QuerySelection
6
+ # @param selector [String]
7
+ # @return [Nokolexbor::Element]
8
+ def query_selector(selector) = at_css(selector)
9
+
10
+ # @param selector [String]
11
+ # @return [Nokolexbor::Element]
12
+ def query_selector_all(selector) = css(selector)
13
+ end
14
+
15
+ Nokolexbor::Element.include QuerySelection unless Nokolexbor::Element.instance_methods.include?(:query_selector)
16
+ end
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Heartml
4
+ module ServerEffects
5
+ # rubocop:disable Naming/MethodName
6
+ module JSPropertyAliases
7
+ def textContent=(value)
8
+ self.content = value
9
+ end
10
+
11
+ def innerHTML=(value)
12
+ self.inner_html = value
13
+ end
14
+
15
+ def method_missing(meth, *args, **kwargs) # rubocop:disable Style/MissingRespondToMissing
16
+ return super unless meth.to_s.end_with?("=")
17
+
18
+ kebob_cased = meth.to_s
19
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1-\2')
20
+ .gsub(/([a-z\d])([A-Z])/, '\1-\2')
21
+ .downcase
22
+
23
+ self[kebob_cased.delete_suffix("=")] = args[0]
24
+ end
25
+ end
26
+ # rubocop:enable Naming/MethodName
27
+
28
+ Nokolexbor::Element.include JSPropertyAliases unless Nokolexbor::Element.instance_methods.include?(:textContent=)
29
+
30
+ module ClassMethods
31
+ def directive(name, &block)
32
+ @directives ||= {}
33
+ @directives[name.to_s] = block
34
+ end
35
+ end
36
+
37
+ # @param klass [Class]
38
+ # @return [void]
39
+ def self.included(klass) # rubocop:disable Metrics
40
+ klass.attribute_binding "server-effect", :_server_effect_binding
41
+ klass.attribute_binding "iso-effect", :_iso_effect_binding
42
+
43
+ klass.singleton_class.attr_reader :directives
44
+
45
+ klass.extend ClassMethods
46
+
47
+ klass.class_eval do
48
+ directive :show do |_, element, value|
49
+ element["hidden"] = "" unless value
50
+ end
51
+
52
+ directive :hide do |_, element, value|
53
+ element["hidden"] = "" if value
54
+ end
55
+
56
+ directive :classMap do |_, element, obj|
57
+ obj.each do |k, v|
58
+ element.add_class k.to_s if v
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ def _server_effect_binding(attribute:, node:)
65
+ _iso_effect_binding(attribute: attribute, node: node)
66
+ node.remove_attribute "host-effect"
67
+ end
68
+
69
+ def _iso_effect_binding(attribute:, node:) # rubocop:disable Metrics
70
+ syntax = attribute.value
71
+ statements = syntax.split(";").map(&:strip)
72
+
73
+ statements.each do |statement| # rubocop:disable Metrics
74
+ if statement.start_with?("@")
75
+ # property assignment
76
+ expression = statement.split("=").map(&:strip)
77
+ expression[0] = expression[0][1..]
78
+
79
+ value = send(expression[1][1..])
80
+
81
+ node.send("#{expression[0]}=", value_to_attribute(value))
82
+ elsif statement.start_with?("$")
83
+ # directive
84
+ directive_name, args_str = statement.strip.match(/(.*)\((.*)\)/).captures
85
+ arg_strs = args_str.split(",").map(&:strip)
86
+ arg_strs.unshift("@")
87
+
88
+ if self.class.directives[directive_name.strip[1..]]
89
+ args = arg_strs.map do |arg_str|
90
+ next node if arg_str == "@"
91
+
92
+ next arg_str[1...-1] if arg_str.start_with?("'") # string literal
93
+
94
+ send(arg_str[1..])
95
+ end
96
+
97
+ self.class.directives[directive_name.strip[1..]]&.(self, *args)
98
+ end
99
+ else
100
+ # method call
101
+ method_name, args_str = statement.strip.match(/(.*)\((.*)\)/).captures
102
+ arg_strs = args_str.split(",").map(&:strip)
103
+ arg_strs.unshift("@")
104
+
105
+ args = arg_strs.map do |arg_str|
106
+ next node if arg_str == "@"
107
+
108
+ next arg_str[1...-1] if arg_str.start_with?("'") # string literal
109
+
110
+ send(arg_str[1..])
111
+ end
112
+
113
+ send(method_name.strip, *args)
114
+ end
115
+
116
+ attribute.name = "host-effect"
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Heartml
4
+ # @return [String]
5
+ VERSION = "1.0.0.beta1"
6
+ end
data/lib/heartml.rb ADDED
@@ -0,0 +1,466 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "heartml/version"
4
+
5
+ require "nokolexbor"
6
+ require "concurrent"
7
+ require "json"
8
+
9
+ # Include this module into your own component class
10
+ module Heartml
11
+ class Error < StandardError; end
12
+
13
+ module JSTemplateLiterals
14
+ refine Kernel do
15
+ def `(str)
16
+ str
17
+ end
18
+ end
19
+ end
20
+
21
+ using JSTemplateLiterals
22
+
23
+ AttributeBinding = Struct.new(:matcher, :method_name, :method, :only_for_tag, keyword_init: true) # rubocop:disable Lint/StructNewOverride
24
+
25
+ require_relative "heartml/fragment"
26
+ require_relative "heartml/query_selection"
27
+ require "heartml/server_effects"
28
+
29
+ def self.registered_elements
30
+ @registered_elements ||= Concurrent::Set.new
31
+
32
+ @registered_elements.each do |component|
33
+ begin
34
+ next if Kernel.const_get(component.to_s) == component # thin out unloaded consts
35
+ rescue NameError; end # rubocop:disable Lint/SuppressedException
36
+
37
+ @registered_elements.delete component
38
+ end
39
+
40
+ @registered_elements
41
+ end
42
+
43
+ def self.register_element(component)
44
+ @registered_elements ||= Concurrent::Set.new
45
+ @registered_elements << component
46
+ end
47
+
48
+ # @param klass [Class]
49
+ # @return [void]
50
+ def self.included(klass)
51
+ klass.extend ClassMethods
52
+
53
+ klass.attribute_binding "server-children", :_server_children_binding, only: :template
54
+ klass.attribute_binding "server-unsafe-eval", :_server_replace_binding
55
+
56
+ # Don't stomp on a superclass's `content` method
57
+ return if klass.instance_methods.include?(:content)
58
+
59
+ klass.include ContentMethod
60
+ end
61
+
62
+ # Extends the component class
63
+ module ClassMethods
64
+ def camelcased(method_symbols)
65
+ Array(method_symbols).each do |method_symbol|
66
+ alias_method(method_symbol.to_s.gsub(/(?!^)_[a-z0-9]/) { |match| match[1].upcase }, method_symbol)
67
+ end
68
+ end
69
+
70
+ def html_file_extensions = %w[module.html mod.html heartml].freeze
71
+
72
+ def processed_css_extension = "css-local"
73
+
74
+ # @param tag_name [String]
75
+ # @param heart_module [String] if not provided, a class method called `source_location` must be
76
+ # available with the absolute path of the Ruby file
77
+ # @param shadow_root [Boolean] default is true
78
+ # @return [void]
79
+ def define(tag_name, heart_module = nil, shadow_root: true) # rubocop:disable Metrics/AbcSize
80
+ if heart_module.nil? && !respond_to?(:source_location)
81
+ raise Heartml::Error, "You must either supply a file path argument or respond to `source_location'"
82
+ end
83
+
84
+ self.tag_name tag_name
85
+
86
+ if heart_module
87
+ self.heart_module heart_module
88
+ else
89
+ basepath = File.join(File.dirname(source_location), File.basename(source_location, ".*"))
90
+
91
+ self.heart_module(html_file_extensions.lazy.filter_map do |ext|
92
+ path = "#{basepath}.#{ext}"
93
+ File.exist?(path) ? path : nil
94
+ end.first)
95
+
96
+ raise Heartml::Error, "Cannot find sidecar HTML module for `#{self}'" unless @heart_module
97
+ end
98
+
99
+ self.shadow_root shadow_root
100
+ end
101
+
102
+ # @param value [String]
103
+ # @return [String]
104
+ def tag_name(value = nil)
105
+ @tag_name ||= begin
106
+ Heartml.register_element self
107
+ value
108
+ end
109
+ end
110
+
111
+ # @param value [String]
112
+ # @return [String]
113
+ def heart_module(value = nil) = @heart_module ||= value
114
+
115
+ # @param value [Boolean]
116
+ # @return [Boolean]
117
+ def shadow_root(value = nil) = @shadow_root ||= value
118
+
119
+ # @return [Nokolexbor::Element]
120
+ def doc
121
+ @doc ||= begin
122
+ @doc_html = "<#{tag_name}>#{File.read(heart_module).strip}</#{tag_name}>"
123
+ Nokolexbor::DocumentFragment.parse(@doc_html).first_element_child
124
+ end
125
+ end
126
+
127
+ def line_number_of_node(node)
128
+ loc = node.source_location
129
+ instance_variable_get(:@doc_html)[0..loc].count("\n") + 1
130
+ end
131
+
132
+ def attribute_bindings = @attribute_bindings ||= []
133
+
134
+ def attribute_binding(matcher, method_name, only: nil)
135
+ attribute_bindings << AttributeBinding.new(
136
+ matcher: Regexp.new(matcher),
137
+ method_name: method_name,
138
+ only_for_tag: only
139
+ )
140
+ end
141
+ end
142
+
143
+ module ContentMethod
144
+ # @return [String, Nokolexbor::Element]
145
+ def content = @_content
146
+ end
147
+
148
+ def replaced_content=(new_content)
149
+ @_replaced_content = new_content
150
+ end
151
+
152
+ # Override in component
153
+ #
154
+ # @return [Hash]
155
+ def attributes = {}
156
+
157
+ def rendering_mode = @_rendering_mode || :node
158
+
159
+ def rendering_mode=(mode)
160
+ @_rendering_mode = case mode
161
+ when :node, :string
162
+ mode
163
+ end
164
+ end
165
+
166
+ # @param attributes [Hash]
167
+ # @param content [String, Nokolexbor::Element]
168
+ def render_element(attributes: self.attributes, content: self.content) # rubocop:disable Metrics
169
+ doc = self.class.doc.clone
170
+ @_content = content
171
+
172
+ tmpl_el = doc.css("> template").find do |node|
173
+ node.attributes.empty? ||
174
+ (node.attributes.count == 1 && node.attributes.any? { |k| k[0].start_with?("data-") })
175
+ end
176
+
177
+ unless tmpl_el
178
+ tmpl_el = doc.document.create_element("template")
179
+ immediate_children = doc.css("> :not(style):not(script)")
180
+ tmpl_el.children[0] << immediate_children
181
+ doc.prepend_child(tmpl_el)
182
+ end
183
+
184
+ # Process all the template bits
185
+ process_fragment(tmpl_el)
186
+
187
+ # Heartml.registered_elements.each do |component|
188
+ # tmpl_el.children[0].css(component.tag_name).reverse.each do |node|
189
+ # if node["server-ignore"]
190
+ # node.remove_attribute("server-ignore")
191
+ # next
192
+ # end
193
+
194
+ # attrs = node.attributes.transform_values(&:value)
195
+ # attrs.reject! { |k| k.start_with?("server-") }
196
+ # new_attrs = {}
197
+ # attrs.each do |k, v|
198
+ # next unless k.start_with?("arg:")
199
+
200
+ # new_key = k.delete_prefix("arg:")
201
+ # attrs.delete(k)
202
+ # new_attrs[new_key] = instance_eval(v, self.class.heart_module, self.class.line_number_of_node(node))
203
+ # end
204
+ # attrs.merge!(new_attrs)
205
+ # attrs.transform_keys!(&:to_sym)
206
+
207
+ # new_node = node.replace(
208
+ # component.new(**attrs).render_element(content: node.children)
209
+ # )
210
+ # new_node.remove_attribute("server-ignore")
211
+ # end
212
+ # end
213
+
214
+ # Set attributes on the custom element
215
+ attributes.each { |k, v| doc[k.to_s.tr("_", "-")] = value_to_attribute(v) if v }
216
+
217
+ # Look for external and internal styles
218
+ output_styles = ""
219
+ external_styles = doc.css("link[rel=stylesheet]")
220
+ external_styles.each do |external_style|
221
+ next unless external_style["server-process"]
222
+
223
+ output_styles += File.read(File.expand_path(external_style["href"], File.dirname(self.class.heart_module)))
224
+ external_style.remove
225
+ rescue StandardError => e
226
+ raise e.class, e.message.lines.first,
227
+ ["#{self.class.heart_module}:#{external_style.line}", *e.backtrace]
228
+ end
229
+ sidecar_file = "#{File.join(
230
+ File.dirname(self.class.heart_module), File.basename(self.class.heart_module, ".*")
231
+ )}.#{self.class.processed_css_extension}"
232
+ output_styles += if File.exist?(sidecar_file)
233
+ File.read(sidecar_file)
234
+ else
235
+ doc.css("> style:not([scope])").map(&:content).join
236
+ end
237
+
238
+ # Now remove all nodes *except* the template
239
+ doc.children.each do |node|
240
+ node.remove unless node == tmpl_el
241
+ end
242
+
243
+ style_tag = nil
244
+ if output_styles.length.positive?
245
+ # We'll transfer everything over to a single style element
246
+ style_tag = tmpl_el.document.create_element("style")
247
+ style_tag.content = output_styles
248
+ end
249
+
250
+ child_content = @_replaced_content || content
251
+ if self.class.shadow_root
252
+ # Guess what? We can reuse the same template tag! =)
253
+ tmpl_el["shadowrootmode"] = "open"
254
+ tmpl_el.children[0] << style_tag if style_tag
255
+ doc << child_content if child_content
256
+ else
257
+ tmpl_el.children[0] << style_tag if style_tag
258
+ tmpl_el.children[0].at_css("slot:not([name])")&.swap(child_content) if child_content
259
+ tmpl_el.children[0].children.each do |node|
260
+ doc << node
261
+ end
262
+ tmpl_el.remove
263
+ end
264
+
265
+ rendering_mode == :node ? doc : doc.to_html
266
+ end
267
+
268
+ def call(...) = render_element(...)
269
+
270
+ def inspect = "#<#{self.class.name} #{attributes}>"
271
+
272
+ def value_to_attribute(val)
273
+ case val
274
+ when String
275
+ val
276
+ when TrueClass
277
+ ""
278
+ else
279
+ val.to_json
280
+ end
281
+ end
282
+
283
+ def node_or_string(val)
284
+ val.is_a?(Nokolexbor::Node) ? val : val.to_s
285
+ end
286
+
287
+ # Override in component if need be, otherwise we'll use the node walker/binding pipeline
288
+ #
289
+ # @param fragment [Nokolexbor::Element]
290
+ # @return [void]
291
+ def process_fragment(fragment) = Fragment.new(fragment, self).process
292
+
293
+ def process_list(attribute:, node:, item_node:, for_in:) # rubocop:disable Metrics
294
+ _context_nodes.push(node)
295
+
296
+ lh = for_in[0].strip.delete_prefix("(").delete_suffix(")").split(",").map!(&:strip)
297
+ rh = for_in[1].strip
298
+
299
+ list_items = evaluate_attribute_expression(attribute, rh)
300
+
301
+ # TODO: handle object style
302
+ # https://vuejs.org/guide/essentials/list.html#v-for-with-an-object
303
+
304
+ return unless list_items
305
+
306
+ _in_context_nodes do |previous_context|
307
+ list_items.each_with_index do |list_item, index|
308
+ new_node = item_node.clone
309
+ node.parent << new_node
310
+ new_node["server-added"] = ""
311
+
312
+ @_context_locals = { **(previous_context || {}) }
313
+ _context_locals[lh[0]] = list_item
314
+ _context_locals[lh[1]] = index if lh[1]
315
+
316
+ Fragment.new(new_node, self).process
317
+ end
318
+ end
319
+ end
320
+
321
+ def evaluate_attribute_expression(attribute, eval_code = attribute.value)
322
+ eval_code = eval_code.gsub(/\${(.*)}/, "\#{\\1}")
323
+ _context_locals.keys.reverse_each do |name|
324
+ eval_code = "#{name} = _context_locals[\"#{name}\"];" + eval_code
325
+ end
326
+ instance_eval(eval_code, self.class.heart_module, self.class.line_number_of_node(attribute))
327
+ end
328
+
329
+ def class_list_for(obj)
330
+ case obj
331
+ when Hash
332
+ obj.filter { |_k, v| v }.keys
333
+ when Array
334
+ # TODO: handle objects inside of an array?
335
+ obj
336
+ else
337
+ Array[obj]
338
+ end.join(" ")
339
+ end
340
+
341
+ def _context_nodes = @_context_nodes ||= []
342
+
343
+ def _context_locals = @_context_locals ||= {}
344
+
345
+ def _check_stack(node)
346
+ node_and_ancestors = [node, *node.ancestors.to_a]
347
+ stack_misses = 0
348
+
349
+ _context_nodes.each do |stack_node|
350
+ if node_and_ancestors.none? { _1["server-added"] } && node_and_ancestors.none? { _1 == stack_node }
351
+ stack_misses += 1
352
+ end
353
+ end
354
+
355
+ stack_misses.times { _context_nodes.pop }
356
+
357
+ node_and_ancestors.any? { _context_nodes.include?(_1) }
358
+ end
359
+
360
+ def _in_context_nodes
361
+ previous_context = _context_locals
362
+ yield previous_context
363
+ @_context_locals = previous_context
364
+ end
365
+
366
+ def _server_children_binding(attribute:, node:) # rubocop:disable Lint/UnusedMethodArgument
367
+ self.replaced_content = node.children[0]
368
+ node.remove
369
+ end
370
+
371
+ def _server_replace_binding(attribute:, node:)
372
+ node_name = node.name
373
+ correct_node = node_name == "template" ? node.children[0] : node
374
+ result = node_or_string(evaluate_attribute_expression(attribute, correct_node.inner_html))
375
+
376
+ if node_name == "template"
377
+ node.swap(result)
378
+ else
379
+ node.inner_html = result
380
+ attribute.parent.delete(attribute.name)
381
+ end
382
+ end
383
+
384
+ # def _server_replace_binding(attribute:, node:)
385
+ # if node.name == "template"
386
+ # node.children[0].inner_html = node_or_string(evaluate_attribute_expression(attribute))
387
+ # node.replace(node.children[0].children)
388
+ # else
389
+ # node.inner_html = node_or_string(evaluate_attribute_expression(attribute))
390
+ # node.replace(node.children)
391
+ # end
392
+ # end
393
+
394
+ # def _server_expr_binding(attribute:, node:)
395
+ # if attribute.name.end_with?(":text")
396
+ # node.content = node_or_string(evaluate_attribute_expression(attribute))
397
+ # attribute.parent.delete(attribute.name)
398
+ # elsif attribute.name.end_with?(":html")
399
+ # node.inner_html = node_or_string(evaluate_attribute_expression(attribute))
400
+ # attribute.parent.delete(attribute.name)
401
+ # end
402
+ # end
403
+
404
+ class ServerComponent
405
+ def self.inherited(klass)
406
+ super
407
+ klass.include Heartml
408
+ klass.include Heartml::ServerEffects
409
+ end
410
+ end
411
+
412
+ class FragmentRenderComponent < ServerComponent
413
+ def self.heart_module
414
+ "eval"
415
+ end
416
+
417
+ def self.line_number_of_node(_node)
418
+ # FIXME: this should actually work!
419
+ 0
420
+ end
421
+
422
+ def initialize(body:, scope:) # rubocop:disable Lint/MissingSuper
423
+ @body = body.is_a?(String) ? Nokolexbor::DocumentFragment.parse(body) : body
424
+ @scope = scope
425
+ end
426
+
427
+ def call
428
+ Fragment.new(@body, self).process
429
+ @body
430
+ end
431
+
432
+ def respond_to_missing?(key)
433
+ @scope.respond_to?(key)
434
+ end
435
+
436
+ # TODO: delegate instead?
437
+ def method_missing(key, *args, **kwargs)
438
+ @scope.send(key, *args, **kwargs)
439
+ end
440
+ end
441
+ end
442
+
443
+ if defined?(Bridgetown)
444
+ Bridgetown.initializer :heartml do |config|
445
+ Bridgetown::Component.extend ActiveSupport::DescendantsTracker
446
+
447
+ Heartml.module_eval do
448
+ def render_in(view_context, rendering_mode = :string, &block)
449
+ @attributes&.[]=("server-ignore", "")
450
+ self.rendering_mode = rendering_mode
451
+ super(view_context, &block)
452
+ end
453
+ end
454
+
455
+ # Eager load all components
456
+ config.hook :site, :after_reset do |site|
457
+ unless site.config.eager_load_paths.find { _1.end_with?(site.config.components_dir) }
458
+ site.config.eager_load_paths << site.config.autoload_paths.find { _1.end_with?(site.config.components_dir) }
459
+ end
460
+ end
461
+
462
+ config.html_inspector_parser "nokolexbor"
463
+ require_relative "heartml/component_renderer"
464
+ config.builder Heartml::ComponentRenderer
465
+ end
466
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: heartml
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.beta1
5
+ platform: ruby
6
+ authors:
7
+ - Jared White
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-08-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: concurrent-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokolexbor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.4.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: hash_with_dot_access
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ description:
56
+ email:
57
+ - jared@whitefusion.studio
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".rubocop.yml"
63
+ - CHANGELOG.md
64
+ - CODE_OF_CONDUCT.md
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - benchmark.rb
71
+ - heartml.gemspec
72
+ - lib/heartml.rb
73
+ - lib/heartml/component_renderer.rb
74
+ - lib/heartml/fragment.rb
75
+ - lib/heartml/petite.rb
76
+ - lib/heartml/query_selection.rb
77
+ - lib/heartml/server_effects.rb
78
+ - lib/heartml/version.rb
79
+ homepage: https://github.com/heartml/heartml-ruby#readme
80
+ licenses:
81
+ - MIT
82
+ metadata:
83
+ homepage_uri: https://github.com/heartml/heartml-ruby#readme
84
+ source_code_uri: https://github.com/heartml/heartml-ruby
85
+ changelog_uri: https://github.com/heartml/heartml-ruby/blob/main/CHANGELOG.md
86
+ rubygems_mfa_required: 'true'
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '3.0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">"
99
+ - !ruby/object:Gem::Version
100
+ version: 1.3.1
101
+ requirements: []
102
+ rubygems_version: 3.3.3
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Server-rendered web components
106
+ test_files: []