htmx 0.0.0 → 0.1.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 +2 -2
- data/lib/htmx/headers/request.rb +1 -1
- data/lib/htmx/headers/response.rb +1 -1
- data/lib/htmx/prefixer.rb +3 -3
- data/lib/htmx.rb +4 -1
- data.tar.gz.sig +0 -0
- metadata +3 -3
- 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: fb2c05b5dcd14da24f6c60ac5626baf58714883c464afb5cece8a914b3ca6175
|
4
|
+
data.tar.gz: 4244ba157e4815c7dffe1354de9b44cbc913b8b2fe36a311223fefcef735f665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7410d084aa382eac7900c0810b68835d830d0809819e0ac9938294e7d8965a065cb5fb3740713fc348668903fe2074e8f1b10f8dc4a81dfa966990f16f4abed8
|
7
|
+
data.tar.gz: 0ff932d4bc6b51a349f0f2043656dad227f72f4342314dd995830b781f923b59699843357924ce3adb8660849b4a069fdb2a5df807550d48b78ec8840f6662f5
|
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.1.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 = {
|
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
|
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.1.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-05-
|
38
|
+
date: 2023-05-24 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: refinements
|
@@ -111,5 +111,5 @@ requirements: []
|
|
111
111
|
rubygems_version: 3.4.13
|
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
|