diff --git a/Gemfile b/Gemfile index 2d82517..0d8e8a3 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -# Specify your gem's dependencies in ruby_wasm_ui.gemspec +# Specify your gem's dependencies in ruwi.gemspec gemspec gem "irb" diff --git a/Gemfile.lock b/Gemfile.lock index 1e730c9..01620a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ruby_wasm_ui (0.9.1) + ruwi (0.9.1) js (~> 2.7) listen (~> 3.8) puma (~> 6.0) @@ -94,7 +94,7 @@ DEPENDENCIES irb rake (~> 13.0) rspec - ruby_wasm_ui! + ruwi! BUNDLED WITH 2.7.2 diff --git a/Makefile b/Makefile index 5129df2..72aad07 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ help: @echo "Example: make bump 0.9.0" @echo "" @echo "This command updates the version number in the following files:" - @echo " - lib/ruby_wasm_ui/version.rb" + @echo " - lib/ruwi/version.rb" @echo " - package.json" @echo " - packages/npm-packages/runtime/package.json" @echo " - README.md" @@ -27,9 +27,9 @@ bump: exit 1; \ fi @echo "Bumping version to $(VERSION)..." - @# Update lib/ruby_wasm_ui/version.rb - @sed -i '' 's/VERSION = ".*"/VERSION = "$(VERSION)"/' lib/ruby_wasm_ui/version.rb - @echo "✓ Updated lib/ruby_wasm_ui/version.rb" + @# Update lib/ruwi/version.rb + @sed -i '' 's/VERSION = ".*"/VERSION = "$(VERSION)"/' lib/ruwi/version.rb + @echo "✓ Updated lib/ruwi/version.rb" @# Update Gemfile.lock @bundle install @echo "✓ Updated Gemfile.lock" @@ -40,7 +40,7 @@ bump: @sed -i '' 's/"version": ".*"/"version": "$(VERSION)"/' packages/npm-packages/runtime/package.json @echo "✓ Updated packages/npm-packages/runtime/package.json" @# Update README.md (unpkg.com URL) - @sed -i '' 's|unpkg.com/ruby-wasm-ui@[0-9.]*|unpkg.com/ruby-wasm-ui@$(VERSION)|' README.md + @sed -i '' 's|unpkg.com/ruwi@[0-9.]*|unpkg.com/ruwi@$(VERSION)|' README.md @echo "✓ Updated README.md" @echo "" @echo "Updating package-lock.json files..." diff --git a/README.md b/README.md index 2bb7ee8..40b9dcf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ruby-wasm-ui +# ruwi A modern web frontend framework for Ruby using [ruby.wasm](https://github.com/ruby/ruby.wasm). Write reactive web applications using familiar Ruby syntax and patterns. @@ -21,7 +21,7 @@ Create an HTML file:
- + @@ -36,7 +36,7 @@ Create `app.rb`: require "js" # Define a Counter component -CounterComponent = RubyWasmUi.define_component( +CounterComponent = Ruwi.define_component( # Initialize component state state: ->(props) { { count: props[:count] || 0 } @@ -44,7 +44,7 @@ CounterComponent = RubyWasmUi.define_component( # Render the counter component template: ->() { - RubyWasmUi::Template::Parser.parse_and_eval(<<~HTML, binding) + Ruwi::Template::Parser.parse_and_eval(<<~HTML, binding)Loading...
diff --git a/docs/lifecycle-hooks.md b/docs/lifecycle-hooks.md index 0afcff3..d2dc828 100644 --- a/docs/lifecycle-hooks.md +++ b/docs/lifecycle-hooks.md @@ -3,7 +3,7 @@ Components support lifecycle hooks to execute code at specific points in a component's lifecycle: ```ruby -RandomCocktailComponent = RubyWasmUi.define_component( +RandomCocktailComponent = Ruwi.define_component( state: ->() { { is_loading: false, @@ -54,7 +54,7 @@ RandomCocktailComponent = RubyWasmUi.define_component({state[:message]}
@@ -21,7 +21,7 @@ ) # Component with on_mounted that takes component argument (existing behavior) -AdvancedComponent = RubyWasmUi.define_component( +AdvancedComponent = Ruwi.define_component( state: -> { { message: "Not mounted yet" } }, # on_mounted with component argument - existing behavior still works @@ -31,7 +31,7 @@ }, template: ->() { - RubyWasmUi::Template::Parser.parse_and_eval(<<~HTML, binding) + Ruwi::Template::Parser.parse_and_eval(<<~HTML, binding){state[:message]}
@@ -41,9 +41,9 @@ ) # Main App component -AppComponent = RubyWasmUi.define_component( +AppComponent = Ruwi.define_component( template: -> { - RubyWasmUi::Template::Parser.parse_and_eval(<<~HTML, binding) + Ruwi::Template::Parser.parse_and_eval(<<~HTML, binding)Using r-if as an attribute (like Vue.js r-if)
@@ -108,6 +108,6 @@ ) # Create and mount the app -app = RubyWasmUi::App.create(RIfAttributeDemo) +app = Ruwi::App.create(RIfAttributeDemo) app_element = JS.global[:document].getElementById("app") app.mount(app_element) diff --git a/examples/npm-packages/runtime/random_cocktail/index.html b/examples/npm-packages/runtime/random_cocktail/index.html index a0e4456..a67af5e 100644 --- a/examples/npm-packages/runtime/random_cocktail/index.html +++ b/examples/npm-packages/runtime/random_cocktail/index.html @@ -11,8 +11,8 @@ const script = document.createElement("script"); script.defer = true; script.src = isDev - ? "../../../../packages/npm-packages/runtime/dist/ruby-wasm-ui.js" - : "https://unpkg.com/ruby-wasm-ui@latest"; + ? "../../../../packages/npm-packages/runtime/dist/ruwi.js" + : "https://unpkg.com/ruwi@latest"; document.head.appendChild(script); diff --git a/examples/npm-packages/runtime/random_cocktail/index.rb b/examples/npm-packages/runtime/random_cocktail/index.rb index 7250444..c0e9d02 100644 --- a/examples/npm-packages/runtime/random_cocktail/index.rb +++ b/examples/npm-packages/runtime/random_cocktail/index.rb @@ -1,6 +1,6 @@ require "js" -random_cocktail = RubyWasmUi.define_component( +random_cocktail = Ruwi.define_component( state: ->() { { is_loading: false, @@ -25,7 +25,7 @@ HTML - RubyWasmUi::Template::Parser.parse_and_eval(template, binding) + Ruwi::Template::Parser.parse_and_eval(template, binding) }, methods: { @@ -49,13 +49,13 @@ } ) -ButtonComponent = RubyWasmUi.define_component( +ButtonComponent = Ruwi.define_component( state: ->(props) { { label: props[:label] } }, template: ->() { - RubyWasmUi::Template::Parser.parse_and_eval(<<~HTML, binding) + Ruwi::Template::Parser.parse_and_eval(<<~HTML, binding) @@ -64,6 +64,6 @@ ) # Create and mount the app -app = RubyWasmUi::App.create(random_cocktail) +app = Ruwi::App.create(random_cocktail) app_element = JS.global[:document].getElementById("app") app.mount(app_element) diff --git a/examples/npm-packages/runtime/search_field/index.html b/examples/npm-packages/runtime/search_field/index.html index 354a708..a3109cb 100644 --- a/examples/npm-packages/runtime/search_field/index.html +++ b/examples/npm-packages/runtime/search_field/index.html @@ -11,8 +11,8 @@ const script = document.createElement("script"); script.defer = true; script.src = isDev - ? "../../../../packages/npm-packages/runtime/dist/ruby-wasm-ui.js" - : "https://unpkg.com/ruby-wasm-ui@latest"; + ? "../../../../packages/npm-packages/runtime/dist/ruwi.js" + : "https://unpkg.com/ruwi@latest"; document.head.appendChild(script); diff --git a/examples/npm-packages/runtime/search_field/index.rb b/examples/npm-packages/runtime/search_field/index.rb index c58b1c8..2858921 100644 --- a/examples/npm-packages/runtime/search_field/index.rb +++ b/examples/npm-packages/runtime/search_field/index.rb @@ -1,9 +1,9 @@ require "js" # search-field component definition -SearchField = RubyWasmUi.define_component( +SearchField = Ruwi.define_component( template: ->() { - RubyWasmUi::Template::Parser.parse_and_eval(<<~HTML, binding) + Ruwi::Template::Parser.parse_and_eval(<<~HTML, binding) () { { search_term: '' } }, template: ->() { - RubyWasmUi::Template::Parser.parse_and_eval(<<~HTML, binding) + Ruwi::Template::Parser.parse_and_eval(<<~HTML, binding)