voidable-hotwire 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.md +25 -0
- data/README.md +60 -0
- data/lib/voidable/hotwire/engine.rb +19 -0
- data/lib/voidable/hotwire/helpers.rb +25 -0
- data/lib/voidable/hotwire/version.rb +5 -0
- data/lib/voidable/hotwire.rb +3 -0
- metadata +67 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: '09176d0f946e22413a10e60cc115f7fc5d92ee30aa8477343a4c2c9d9043f2da'
|
|
4
|
+
data.tar.gz: b790ad2b9537a6de90980f60e5b48df4af1f29e6227cdd414c6c5babfc1a5f3d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1ed8c258a20e8ba4edbd5ee3ecc944b97cc52dfabb0edf17e8e525d47ce013b1530b74a2726de3ecbe15952c8d93b7ff698ea44c8870c16f13afeb35ff67d923
|
|
7
|
+
data.tar.gz: f83d44be362c8d8398e9ad102ac3bcf55fb4830d999503ed85f32d0ef96620673d3586efa46a0dc0e71f5d6b2a089183b6ee4224aea6851f83f0e0b6aa0d67ea
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
Copyright © `2026` `Kaz Walker`
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
|
7
|
+
obtaining a copy of this software and associated documentation
|
|
8
|
+
files (the “Software”), to deal in the Software without
|
|
9
|
+
restriction, including without limitation the rights to use,
|
|
10
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the
|
|
12
|
+
Software is furnished to do so, subject to the following
|
|
13
|
+
conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# voidable-hotwire
|
|
2
|
+
|
|
3
|
+
Rails integration for [Voidable UI](https://voidable.dev) web components with Hotwire (Stimulus + Turbo).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add to your Gemfile:
|
|
8
|
+
|
|
9
|
+
gem "voidable-hotwire"
|
|
10
|
+
|
|
11
|
+
Run:
|
|
12
|
+
|
|
13
|
+
bundle install
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### With importmap-rails
|
|
18
|
+
|
|
19
|
+
The gem automatically pins `@voidable/ui` and `@voidable/ui-hotwire` to your importmap.
|
|
20
|
+
|
|
21
|
+
Register the Stimulus controller and start Turbo integration in your `application.js`:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { VoidEventController } from "@voidable/ui-hotwire"
|
|
25
|
+
import { VoidTurbo } from "@voidable/ui-hotwire"
|
|
26
|
+
import "@voidable/ui"
|
|
27
|
+
|
|
28
|
+
application.register("void-event", VoidEventController)
|
|
29
|
+
VoidTurbo.start()
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### With jsbundling-rails
|
|
33
|
+
|
|
34
|
+
Install the npm packages:
|
|
35
|
+
|
|
36
|
+
yarn add @voidable/ui @voidable/ui-hotwire
|
|
37
|
+
|
|
38
|
+
### Theming
|
|
39
|
+
|
|
40
|
+
Voidable components are devoid of style by design. You must provide a theme. The default theme is available via `@voidable/theme`:
|
|
41
|
+
|
|
42
|
+
@import "@voidable/theme";
|
|
43
|
+
|
|
44
|
+
Or use a custom theme — any CSS that sets the `--void-*` custom properties will work. See [Theming](https://voidable.dev/getting-started/theming/) for details.
|
|
45
|
+
|
|
46
|
+
## View helpers
|
|
47
|
+
|
|
48
|
+
Use `void_attrs` to generate Stimulus data attributes:
|
|
49
|
+
|
|
50
|
+
```erb
|
|
51
|
+
<%= tag.void_button "Save", variant: "filled",
|
|
52
|
+
**void_attrs("void-click", "form#submit") %>
|
|
53
|
+
|
|
54
|
+
<%= tag.void_input placeholder: "Search...",
|
|
55
|
+
**void_attrs("void-change", "search#filter") %>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Voidable
|
|
2
|
+
module Hotwire
|
|
3
|
+
class Engine < ::Rails::Engine
|
|
4
|
+
isolate_namespace Voidable::Hotwire
|
|
5
|
+
|
|
6
|
+
initializer "voidable-hotwire.importmap", before: "importmap" do |app|
|
|
7
|
+
if app.config.respond_to?(:importmap)
|
|
8
|
+
app.config.importmap.paths << Engine.root.join("config/importmap.rb")
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
initializer "voidable-hotwire.helpers" do
|
|
13
|
+
ActiveSupport.on_load(:action_view) do
|
|
14
|
+
include Voidable::Hotwire::Helpers
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Voidable
|
|
2
|
+
module Hotwire
|
|
3
|
+
module Helpers
|
|
4
|
+
# Generates data attributes for wiring a Voidable component to Stimulus.
|
|
5
|
+
#
|
|
6
|
+
# void_attrs("void-click", "form#submit")
|
|
7
|
+
# # => { controller: "void-event", "void-event-events-value": "void-click",
|
|
8
|
+
# # action: "void-click->form#submit" }
|
|
9
|
+
#
|
|
10
|
+
def void_attrs(events, action = nil)
|
|
11
|
+
attrs = {
|
|
12
|
+
data: {
|
|
13
|
+
controller: "void-event",
|
|
14
|
+
"void-event-events-value": Array(events).join(",")
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if action
|
|
18
|
+
event_list = Array(events)
|
|
19
|
+
attrs[:data][:action] = event_list.map { |e| "#{e}->#{action}" }.join(" ")
|
|
20
|
+
end
|
|
21
|
+
attrs
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: voidable-hotwire
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kaz Walker
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-05-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: railties
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '7.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '7.0'
|
|
27
|
+
description: Provides a Rails engine, importmap pins, and view helpers for using Voidable
|
|
28
|
+
UI web components with Stimulus and Turbo.
|
|
29
|
+
email:
|
|
30
|
+
- the.kaz.walker@gmail.com
|
|
31
|
+
executables: []
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- LICENSE.md
|
|
36
|
+
- README.md
|
|
37
|
+
- lib/voidable/hotwire.rb
|
|
38
|
+
- lib/voidable/hotwire/engine.rb
|
|
39
|
+
- lib/voidable/hotwire/helpers.rb
|
|
40
|
+
- lib/voidable/hotwire/version.rb
|
|
41
|
+
homepage: https://voidable.dev
|
|
42
|
+
licenses:
|
|
43
|
+
- MIT
|
|
44
|
+
metadata:
|
|
45
|
+
homepage_uri: https://voidable.dev
|
|
46
|
+
source_code_uri: https://github.com/VoidableUI/Voidable
|
|
47
|
+
changelog_uri: https://github.com/VoidableUI/Voidable/releases
|
|
48
|
+
post_install_message:
|
|
49
|
+
rdoc_options: []
|
|
50
|
+
require_paths:
|
|
51
|
+
- lib
|
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 3.1.0
|
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
requirements: []
|
|
63
|
+
rubygems_version: 3.5.22
|
|
64
|
+
signing_key:
|
|
65
|
+
specification_version: 4
|
|
66
|
+
summary: Rails integration for Voidable UI web components with Hotwire
|
|
67
|
+
test_files: []
|