htmx 0.0.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +12 -8
- data/htmx.gemspec +3 -3
- data/lib/htmx/headers/request.rb +1 -1
- data/lib/htmx/headers/response.rb +1 -1
- data/lib/htmx/prefixer.rb +4 -6
- data/lib/htmx.rb +4 -1
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43e9bb667215224c821dacc90e470dc7d7cff8763db175976e8f50a4914d9ff0
|
4
|
+
data.tar.gz: 87bcf2eda837ccde944a18824f2f8268f2d1688999ae2b50136daec486fb72a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96f0e5a903c20d736a57a001351e020277ad988bd7fe08277994f1d0708a2765accd3a6e642e74bcd63905f36f1bfc01e12a90072151f67544ae8aa2c78a5407
|
7
|
+
data.tar.gz: 110d7c8385ab152d67f2639d51c27f5c9e5bd3bbd72384e35cc191771c5574ebf195d5135852b6e0ff79048e9d35ccf35b04326e31ca7c19249f1bc1e7f40839
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -13,11 +13,11 @@
|
|
13
13
|
|
14
14
|
A haiku from the {htmx_link} team:
|
15
15
|
|
16
|
-
|
16
|
+
....
|
17
17
|
javascript fatigue:
|
18
18
|
longing for a hypertext
|
19
19
|
already in hand
|
20
|
-
|
20
|
+
....
|
21
21
|
|
22
22
|
...and from {hypermedia_systems_link}:
|
23
23
|
|
@@ -26,7 +26,7 @@ The goal of [HTMX] is not less JavaScript, but less code, more readable and hype
|
|
26
26
|
____
|
27
27
|
|
28
28
|
|
29
|
-
This gem provides native Ruby support for the {htmx_link} JavaScript library so you can build sophisticated web applications using pure Hypermedia REST APIs while avoiding
|
29
|
+
This gem provides native Ruby support for the {htmx_link} JavaScript library so you can build sophisticated web applications using pure Hypermedia REST APIs while avoiding unnecessary bloat and complexity common with the JavaScript ecosystem. By building upon the original foundations of Hypermedia REST APIs, you can build rich web applications with no additional JavaScript!
|
30
30
|
|
31
31
|
At the moment, the functionality of this gem is still in the early stages of development but the goal of this gem is to aid with the development of {htmx_link} applications.
|
32
32
|
|
@@ -42,8 +42,8 @@ toc::[]
|
|
42
42
|
|
43
43
|
== Requirements
|
44
44
|
|
45
|
+
. A strong understanding of {hypermedia_systems_link}.
|
45
46
|
. {htmx_link}.
|
46
|
-
. A strong understanding of {hypermedia_systems_link} and Hypermedia REST APIs in general.
|
47
47
|
. link:https://www.ruby-lang.org[Ruby].
|
48
48
|
|
49
49
|
== Setup
|
@@ -161,7 +161,7 @@ The request object allows you to obtain an immutable {data_link} object to inter
|
|
161
161
|
|
162
162
|
[source,ruby]
|
163
163
|
----
|
164
|
-
|
164
|
+
HTMX::Headers::Request.new
|
165
165
|
|
166
166
|
# <data HTMX::Headers::Request boosted=nil,
|
167
167
|
# current_url=nil,
|
@@ -178,7 +178,7 @@ Notice you get a {data_link} instance where all members have the `HX-` prefix re
|
|
178
178
|
|
179
179
|
[source,ruby]
|
180
180
|
----
|
181
|
-
|
181
|
+
HTMX::Headers::Request.for request.env
|
182
182
|
|
183
183
|
# <data HTMX::Headers::Request boosted="true",
|
184
184
|
# current_url="/demo",
|
@@ -199,7 +199,7 @@ The response object allows you to obtain an immutable {data_link} object to inte
|
|
199
199
|
|
200
200
|
[source,ruby]
|
201
201
|
----
|
202
|
-
|
202
|
+
HTMX::Headers::Response.new
|
203
203
|
|
204
204
|
# <data HTMX::Headers::Response location=nil,
|
205
205
|
# push_url=nil,
|
@@ -218,7 +218,7 @@ Notice you get a {data_link} instance where all members have the `HX-` prefix re
|
|
218
218
|
|
219
219
|
[source,ruby]
|
220
220
|
----
|
221
|
-
|
221
|
+
HTMX::Headers::Response.for response.headers
|
222
222
|
|
223
223
|
# <data HTMX::Headers::Response location="/",
|
224
224
|
# push_url="/demo",
|
@@ -235,6 +235,10 @@ response = HTMX::Headers::Response.for response.headers
|
|
235
235
|
|
236
236
|
With the above, the `.for` method plucks out only the HTMX specific headers which may or may not have values. Extra header keys, which are not specific to {htmx_link}, are ignored.
|
237
237
|
|
238
|
+
=== Errors
|
239
|
+
|
240
|
+
As you've probably picked up by now, any/all errors issued by this gem will be an instance of the `HTMX::Error` class which inherits from `StandardError`. you can use this classification to catch and deal with these errors in your own implementation as desired.
|
241
|
+
|
238
242
|
== Development
|
239
243
|
|
240
244
|
To contribute, run:
|
data/htmx.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "htmx"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.2.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/htmx"
|
9
|
-
spec.summary = "
|
9
|
+
spec.summary = "An augmenter and companion to the HTMX JavaScript library."
|
10
10
|
spec.license = "Hippocratic-2.1"
|
11
11
|
|
12
12
|
spec.metadata = {
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
25
|
spec.required_ruby_version = "~> 3.2"
|
26
|
-
spec.add_dependency "refinements", "~>
|
26
|
+
spec.add_dependency "refinements", "~> 11.0"
|
27
27
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
28
28
|
|
29
29
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
data/lib/htmx/headers/request.rb
CHANGED
@@ -25,7 +25,7 @@ module HTMX
|
|
25
25
|
:trigger
|
26
26
|
) do
|
27
27
|
def self.for(key_map: REQUEST_KEY_MAP, **attributes)
|
28
|
-
new(**attributes.slice(*key_map.keys).transform_keys(key_map))
|
28
|
+
new(**attributes.slice(*key_map.keys).transform_keys!(key_map))
|
29
29
|
end
|
30
30
|
|
31
31
|
def initialize boosted: nil,
|
@@ -29,7 +29,7 @@ module HTMX
|
|
29
29
|
:trigger_after_swap
|
30
30
|
) do
|
31
31
|
def self.for(key_map: RESPONSE_KEY_MAP, **attributes)
|
32
|
-
new(**attributes.slice(*key_map.keys).transform_keys(key_map))
|
32
|
+
new(**attributes.slice(*key_map.keys).transform_keys!(key_map))
|
33
33
|
end
|
34
34
|
|
35
35
|
def initialize location: nil,
|
data/lib/htmx/prefixer.rb
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
require "refinements/arrays"
|
4
4
|
|
5
5
|
module HTMX
|
6
|
-
# Prefixes HTML element attributes for proper consumption by HTMX JavaScript library.
|
6
|
+
# Prefixes HTML element attributes for proper consumption by the HTMX JavaScript library.
|
7
7
|
class Prefixer
|
8
8
|
using Refinements::Arrays
|
9
9
|
|
10
|
-
|
10
|
+
ALLOWED = %w[hx data-hx].freeze
|
11
11
|
|
12
|
-
def initialize default = "hx", allowed:
|
12
|
+
def initialize default = "hx", allowed: ALLOWED
|
13
13
|
@default = default
|
14
14
|
@allowed = allowed
|
15
15
|
validate
|
@@ -24,9 +24,7 @@ module HTMX
|
|
24
24
|
def validate
|
25
25
|
return true if allowed.include? default
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
fail Error, "Invalid prefix: #{default.inspect}. Use: #{usage}."
|
27
|
+
fail Error, %(Invalid prefix: #{default.inspect}. Use: #{allowed.to_usage "or"}.)
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
data/lib/htmx.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
|
36
36
|
gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2023-
|
38
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: refinements
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '11.0'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '11.0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: zeitwerk
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.4.
|
111
|
+
rubygems_version: 3.4.14
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
|
-
summary:
|
114
|
+
summary: An augmenter and companion to the HTMX JavaScript library.
|
115
115
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|