-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5b592b9
Showing
30 changed files
with
865 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Ruby | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Ruby ${{ matrix.ruby }} | ||
strategy: | ||
matrix: | ||
ruby: | ||
- '3.2.3' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true | ||
- name: Run the default task | ||
run: bundle exec rake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/.bundle/ | ||
/.yardoc | ||
/_yardoc/ | ||
/coverage/ | ||
/doc/ | ||
/pkg/ | ||
/spec/reports/ | ||
/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# For available configuration options, see: | ||
# https://github.com/standardrb/standard | ||
ruby_version: 3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## [Unreleased] | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
# Specify your gem's dependencies in turbo-mount.gemspec | ||
gemspec | ||
|
||
gem "rake", "~> 13.0" | ||
|
||
gem "standard", "~> 1.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
turbo-mount (0.1.0) | ||
railties (>= 6.0.0) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
actionpack (7.1.3.2) | ||
actionview (= 7.1.3.2) | ||
activesupport (= 7.1.3.2) | ||
nokogiri (>= 1.8.5) | ||
racc | ||
rack (>= 2.2.4) | ||
rack-session (>= 1.0.1) | ||
rack-test (>= 0.6.3) | ||
rails-dom-testing (~> 2.2) | ||
rails-html-sanitizer (~> 1.6) | ||
actionview (7.1.3.2) | ||
activesupport (= 7.1.3.2) | ||
builder (~> 3.1) | ||
erubi (~> 1.11) | ||
rails-dom-testing (~> 2.2) | ||
rails-html-sanitizer (~> 1.6) | ||
activesupport (7.1.3.2) | ||
base64 | ||
bigdecimal | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
connection_pool (>= 2.2.5) | ||
drb | ||
i18n (>= 1.6, < 2) | ||
minitest (>= 5.1) | ||
mutex_m | ||
tzinfo (~> 2.0) | ||
ast (2.4.2) | ||
base64 (0.2.0) | ||
bigdecimal (3.1.7) | ||
builder (3.2.4) | ||
concurrent-ruby (1.2.3) | ||
connection_pool (2.4.1) | ||
crass (1.0.6) | ||
drb (2.2.1) | ||
erubi (1.12.0) | ||
i18n (1.14.4) | ||
concurrent-ruby (~> 1.0) | ||
io-console (0.7.2) | ||
irb (1.13.1) | ||
rdoc (>= 4.0.0) | ||
reline (>= 0.4.2) | ||
json (2.7.2) | ||
language_server-protocol (3.17.0.3) | ||
lint_roller (1.1.0) | ||
loofah (2.22.0) | ||
crass (~> 1.0.2) | ||
nokogiri (>= 1.12.0) | ||
minitest (5.22.3) | ||
mutex_m (0.2.0) | ||
nokogiri (1.16.4-arm64-darwin) | ||
racc (~> 1.4) | ||
parallel (1.24.0) | ||
parser (3.3.0.5) | ||
ast (~> 2.4.1) | ||
racc | ||
psych (5.1.2) | ||
stringio | ||
racc (1.7.3) | ||
rack (3.0.10) | ||
rack-session (2.0.0) | ||
rack (>= 3.0.0) | ||
rack-test (2.1.0) | ||
rack (>= 1.3) | ||
rackup (2.1.0) | ||
rack (>= 3) | ||
webrick (~> 1.8) | ||
rails-dom-testing (2.2.0) | ||
activesupport (>= 5.0.0) | ||
minitest | ||
nokogiri (>= 1.6) | ||
rails-html-sanitizer (1.6.0) | ||
loofah (~> 2.21) | ||
nokogiri (~> 1.14) | ||
railties (7.1.3.2) | ||
actionpack (= 7.1.3.2) | ||
activesupport (= 7.1.3.2) | ||
irb | ||
rackup (>= 1.0.0) | ||
rake (>= 12.2) | ||
thor (~> 1.0, >= 1.2.2) | ||
zeitwerk (~> 2.6) | ||
rainbow (3.1.1) | ||
rake (13.2.1) | ||
rdoc (6.6.3.1) | ||
psych (>= 4.0.0) | ||
regexp_parser (2.9.0) | ||
reline (0.5.5) | ||
io-console (~> 0.5) | ||
rexml (3.2.6) | ||
rubocop (1.62.1) | ||
json (~> 2.3) | ||
language_server-protocol (>= 3.17.0) | ||
parallel (~> 1.10) | ||
parser (>= 3.3.0.2) | ||
rainbow (>= 2.2.2, < 4.0) | ||
regexp_parser (>= 1.8, < 3.0) | ||
rexml (>= 3.2.5, < 4.0) | ||
rubocop-ast (>= 1.31.1, < 2.0) | ||
ruby-progressbar (~> 1.7) | ||
unicode-display_width (>= 2.4.0, < 3.0) | ||
rubocop-ast (1.31.2) | ||
parser (>= 3.3.0.4) | ||
rubocop-performance (1.20.2) | ||
rubocop (>= 1.48.1, < 2.0) | ||
rubocop-ast (>= 1.30.0, < 2.0) | ||
ruby-progressbar (1.13.0) | ||
standard (1.35.1) | ||
language_server-protocol (~> 3.17.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.62.0) | ||
standard-custom (~> 1.0.0) | ||
standard-performance (~> 1.3) | ||
standard-custom (1.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.50) | ||
standard-performance (1.3.1) | ||
lint_roller (~> 1.1) | ||
rubocop-performance (~> 1.20.2) | ||
stringio (3.1.0) | ||
thor (1.3.1) | ||
tzinfo (2.0.6) | ||
concurrent-ruby (~> 1.0) | ||
unicode-display_width (2.5.0) | ||
webrick (1.8.1) | ||
zeitwerk (2.6.13) | ||
|
||
PLATFORMS | ||
arm64-darwin-23 | ||
ruby | ||
|
||
DEPENDENCIES | ||
rake (~> 13.0) | ||
standard (~> 1.3) | ||
turbo-mount! | ||
|
||
BUNDLED WITH | ||
2.5.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2024 Svyatoslav Kryukov | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Turbo::Mount | ||
|
||
[![Gem Version](https://badge.fury.io/rb/turbo-mount.svg)](https://rubygems.org/gems/turbo-mount) | ||
|
||
`Turbo::Mount` is a simple gem that allows you to add highly interactive components from React, Vue, Svelte, and other frameworks to your Hotwire application. | ||
|
||
## Installation | ||
|
||
Install the gem and add to the application's Gemfile by executing: | ||
|
||
$ bundle add turbo-mount | ||
|
||
If bundler is not being used to manage dependencies, install the gem by executing: | ||
|
||
$ gem install turbo-mount | ||
|
||
## Usage | ||
|
||
First, you need to initialize `TurboMount` and register the components you want to use: | ||
|
||
```js | ||
import { Application } from "@hotwired/stimulus" | ||
import { TurboMount } from "turbo-mount" | ||
|
||
const application = Application.start() | ||
|
||
// Initialize TurboMount and register the react stimulus controller | ||
const turboMount = new TurboMount({application, framework: "react"}); | ||
|
||
// Register the components you want to use | ||
import { SketchPicker } from 'react-color' | ||
turboMount.register('SketchPicker', SketchPicker); | ||
``` | ||
|
||
Now you can use view helpers to mount the components: | ||
|
||
```erb | ||
<%= turbo_mount_component("SketchPicker", framework: "react", props: {color: "#034"}) %> | ||
<%# or using alias %> | ||
<%= turbo_mount_react_component("SketchPicker", props: {color: "#430"}) %> | ||
``` | ||
|
||
In case you need to customize the component's behavior, or pass functions as props, you can create a custom controller: | ||
|
||
```js | ||
// javascript/controllers/turbo_mount_react_sketch_picker_controller.js | ||
|
||
import { TurboMountReactController } from "turbo-mount" | ||
|
||
export default class extends TurboMountReactController { | ||
get componentProps() { | ||
return { | ||
...this.propsValue, | ||
onChange: this.onChange, | ||
}; | ||
} | ||
|
||
onChange = (color) => { | ||
this.propsValue = { ...this.propsValue, color: color.hex }; | ||
}; | ||
} | ||
``` | ||
|
||
## Development | ||
|
||
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. | ||
|
||
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec 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). | ||
|
||
## Contributing | ||
|
||
Bug reports and pull requests are welcome on GitHub at https://github.com/skryukov/turbo-mount. | ||
|
||
## License | ||
|
||
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/gem_tasks" | ||
require "standard/rake" | ||
|
||
task default: :standard |
Oops, something went wrong.