funicular 0.0.1 → 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 +4 -4
- data/CHANGELOG.md +56 -1
- data/README.md +58 -20
- data/Rakefile +74 -2
- data/demo/keymap_editor.html +582 -0
- data/demo/test_cable.html +179 -0
- data/demo/test_chartjs.html +235 -0
- data/demo/test_component.html +201 -0
- data/demo/test_diff_patch.html +146 -0
- data/demo/test_error_boundary.html +284 -0
- data/demo/test_router.html +257 -0
- data/demo/test_vdom.html +100 -0
- data/demo/tic-tac-toe.html +201 -0
- data/docs/README.md +419 -0
- data/docs/advanced-features.md +632 -0
- data/docs/architecture.md +409 -0
- data/docs/components-and-state.md +539 -0
- data/docs/data-fetching.md +528 -0
- data/docs/forms.md +446 -0
- data/docs/rails-integration.md +426 -0
- data/docs/realtime.md +543 -0
- data/docs/routing-and-navigation.md +427 -0
- data/docs/styling.md +285 -0
- data/exe/funicular +32 -0
- data/lib/funicular/assets/funicular.rb +21 -0
- data/lib/funicular/assets/funicular_debug.css +73 -0
- data/lib/funicular/assets/funicular_debug.js +183 -0
- data/lib/funicular/commands/routes.rb +69 -0
- data/lib/funicular/compiler.rb +135 -0
- data/lib/funicular/configuration.rb +76 -0
- data/lib/funicular/helpers/picoruby_helper.rb +50 -0
- data/lib/funicular/middleware.rb +98 -0
- data/lib/funicular/railtie.rb +26 -0
- data/lib/funicular/route_parser.rb +137 -0
- data/lib/funicular/vendor/picorbc/VERSION +1 -0
- data/lib/funicular/vendor/picorbc/picorbc.js +5283 -0
- data/lib/funicular/vendor/picorbc/picorbc.wasm +0 -0
- data/lib/funicular/vendor/picoruby/VERSION +1 -0
- data/lib/funicular/vendor/picoruby/debug/init.iife.js +130 -0
- data/lib/funicular/vendor/picoruby/debug/picoruby.js +6404 -0
- data/lib/funicular/vendor/picoruby/debug/picoruby.wasm +0 -0
- data/lib/funicular/vendor/picoruby/dist/init.iife.js +130 -0
- data/lib/funicular/vendor/picoruby/dist/picoruby.js +2 -0
- data/lib/funicular/vendor/picoruby/dist/picoruby.wasm +0 -0
- data/lib/funicular/version.rb +1 -1
- data/lib/funicular.rb +29 -1
- data/lib/tasks/funicular.rake +135 -0
- data/minitest/funicular_test.rb +13 -0
- data/minitest/test_helper.rb +7 -0
- data/mrbgem.rake +15 -0
- data/mrblib/cable.rb +417 -0
- data/mrblib/component.rb +911 -0
- data/mrblib/debug.rb +205 -0
- data/mrblib/differ.rb +244 -0
- data/mrblib/environment_inquirer.rb +34 -0
- data/mrblib/error_boundary.rb +125 -0
- data/mrblib/file_upload.rb +184 -0
- data/mrblib/form_builder.rb +284 -0
- data/mrblib/funicular.rb +156 -0
- data/mrblib/http.rb +89 -0
- data/mrblib/model.rb +146 -0
- data/mrblib/patcher.rb +203 -0
- data/mrblib/router.rb +229 -0
- data/mrblib/styles.rb +83 -0
- data/mrblib/vdom.rb +273 -0
- data/sig/cable.rbs +65 -0
- data/sig/component.rbs +141 -0
- data/sig/debug.rbs +28 -0
- data/sig/differ.rbs +18 -0
- data/sig/environment_iquirer.rbs +10 -0
- data/sig/error_boundary.rbs +14 -0
- data/sig/file_upload.rbs +18 -0
- data/sig/form_builder.rbs +29 -0
- data/sig/funicular.rbs +11 -1
- data/sig/http.rbs +22 -0
- data/sig/model.rbs +23 -0
- data/sig/patcher.rbs +15 -0
- data/sig/router.rbs +43 -0
- data/sig/styles.rbs +25 -0
- data/sig/vdom.rbs +59 -0
- metadata +119 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c20fca7e6590276dff1b8d10dcec31cc33a7c89070f2d515b28a39123358a7bb
|
|
4
|
+
data.tar.gz: f96247a21b413702c3e999a0588b4366e7cb356535eca53d472ca36abd331c62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f592cbc26f7266a421846e0cb7f9445dcbc34458025d33d3da0ba140a5c3a3b5ee1c7b646ae56d7d5097162ed587ec92bcb402cc5da113d905deaae8bdb18a6c
|
|
7
|
+
data.tar.gz: 9967e115be234ee8c29e3a605192a398cef6f6de7413d833beaf08b23829752f049e9ced1590761a8b7b1f1cbaccc515efdc9ec5ff0fa431879c83e06c37c88f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,59 @@
|
|
|
1
|
-
## [
|
|
1
|
+
## [0.1.0] - 2026-04-20
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- Consolidated with picoruby-funicular: merged the full PicoRuby frontend
|
|
6
|
+
framework into this gem, including Component, Cable, VDOM, Router,
|
|
7
|
+
FormBuilder, Model, HTTP, FileUpload, ErrorBoundary, Styles, Differ,
|
|
8
|
+
Patcher, Debug, and EnvironmentInquirer, along with RBS signatures and
|
|
9
|
+
comprehensive test suite
|
|
10
|
+
- Bundle PicoRuby.wasm and picorbc WASM artifacts into the gem via a
|
|
11
|
+
`rake copy_wasm` task; artifacts are vendored at build time so no
|
|
12
|
+
runtime npm lookup is required
|
|
13
|
+
- `Funicular::Configuration` with per-environment PicoRuby.wasm source
|
|
14
|
+
selection (`:local_debug`, `:local_dist`, `:cdn`) and optional
|
|
15
|
+
`cdn_version` override
|
|
16
|
+
- `picoruby_include_tag` view helper (auto-registered via Railtie) that
|
|
17
|
+
serves the appropriate PicoRuby.wasm build per environment
|
|
18
|
+
- `funicular:install:wasm` rake sub-task to copy dist/debug WASM builds
|
|
19
|
+
into `public/picoruby/`
|
|
20
|
+
- Rails Asset Pipeline integration: Rack middleware, compiler, and
|
|
21
|
+
`funicular:compile` / `funicular:install` rake tasks
|
|
22
|
+
- `funicular routes` CLI command and `Funicular::RouteParser` to inspect
|
|
23
|
+
Rails routes from the command line
|
|
24
|
+
- Component Debug Highlighter: CSS/JS assets (`funicular_debug.css`,
|
|
25
|
+
`funicular_debug.js`) that highlight the selected component in the
|
|
26
|
+
browser
|
|
27
|
+
- `ENV['FUNICULAR_ENV']` is now set from `Rails.env` in generated
|
|
28
|
+
`application.rb`
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- picorbc is now resolved from a vendored WASM artifact; removed
|
|
33
|
+
npm-based picorbc lookup and all `PICORBC_VERSION` environment variable
|
|
34
|
+
logic
|
|
35
|
+
- Upgraded picorbc to the latest version
|
|
36
|
+
- Switched test framework from test/unit to minitest
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- Asset pipeline: middleware now detects whether `app.mrb` has actually
|
|
41
|
+
changed before recompiling, preventing unnecessary rebuilds
|
|
42
|
+
- XSS vulnerabilities in VDOM attribute handling: expanded
|
|
43
|
+
`URL_ATTRIBUTES` constant, applied case-insensitive `javascript:` URI
|
|
44
|
+
blocking, and added the same URL validation to `Patcher#update_props`
|
|
45
|
+
and `Patcher#create_element`
|
|
46
|
+
- XSS vulnerability in Debug module: replaced manual JSON string
|
|
47
|
+
concatenation with `JSON.generate` to eliminate escaping gaps
|
|
48
|
+
- `funicular:compile` rake task
|
|
49
|
+
- `funicular:install` rake task
|
|
50
|
+
- Rack middleware
|
|
51
|
+
- RBS type signatures
|
|
52
|
+
|
|
53
|
+
### Removed
|
|
54
|
+
|
|
55
|
+
- Debugger Chrome extension (`debugger/` directory)
|
|
56
|
+
- `.ruby-version` file
|
|
2
57
|
|
|
3
58
|
## [0.0.1] - 2025-11-27
|
|
4
59
|
|
data/README.md
CHANGED
|
@@ -1,43 +1,81 @@
|
|
|
1
1
|
# Funicular
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 🎵Funicu-lì, Funicu-là!🚊🚊🚊
|
|
4
|
+
>
|
|
5
|
+
> 🎵Funicu-lì, Funicu-là!🚞🚞🚞
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
**Funicular** is a single-page application (SPA) framework powered by PicoRuby.wasm.
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## Features
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- Write client-side code in Ruby instead of JavaScript
|
|
12
|
+
- Seamless Rails integration
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
## Combined Gem
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
This repository consists of three relevant projects:
|
|
17
|
+
|
|
18
|
+
- PicoGem "picoruby-funicular" ... Core implementation
|
|
19
|
+
- CRubyGem "funicular" ... Rails integration
|
|
20
|
+
- Chrome extension "PicoRuby Debugger"
|
|
21
|
+
|
|
22
|
+
### PicoGem "picoruby-funicular"
|
|
23
|
+
|
|
24
|
+
```console
|
|
25
|
+
.
|
|
26
|
+
├── mrbgem.rake
|
|
27
|
+
├── mrblib/
|
|
28
|
+
└── test/
|
|
15
29
|
```
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
### CRubyGem "funicular"
|
|
32
|
+
|
|
33
|
+
```console
|
|
34
|
+
.
|
|
35
|
+
├── bin/
|
|
36
|
+
├── exe/
|
|
37
|
+
├── funicular.gemspec
|
|
38
|
+
├── Gemfile
|
|
39
|
+
├── Gemfile.lock
|
|
40
|
+
├── lib/
|
|
41
|
+
├── minitest/
|
|
42
|
+
└── Rakefile
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Chrome extention "PicoRuby.wasm debugger"
|
|
18
46
|
|
|
19
|
-
```
|
|
20
|
-
|
|
47
|
+
```console
|
|
48
|
+
.
|
|
49
|
+
└── debugger/
|
|
21
50
|
```
|
|
22
51
|
|
|
23
|
-
|
|
52
|
+
----
|
|
53
|
+
|
|
54
|
+
The others are common resources.
|
|
24
55
|
|
|
25
|
-
|
|
56
|
+
## Documentation
|
|
57
|
+
|
|
58
|
+
You may want to see Tic-Tac-Toe tutorial first: [https://picoruby.org/funicular](https://picoruby.org/funicular)
|
|
59
|
+
|
|
60
|
+
Then, dig [docs/](docs/).
|
|
26
61
|
|
|
27
62
|
## Development
|
|
28
63
|
|
|
29
|
-
|
|
64
|
+
This repository is a submodule of [picoruby/picoruby](https://github.com/picoruby/picoruby).
|
|
65
|
+
Do not check it out standalone. Instead, clone the parent repository and work from there:
|
|
66
|
+
|
|
67
|
+
```console
|
|
68
|
+
git clone --recurse-submodules https://github.com/picoruby/picoruby.git
|
|
69
|
+
cd picoruby/mrbgems/picoruby-funicular
|
|
70
|
+
```
|
|
30
71
|
|
|
31
|
-
|
|
72
|
+
The CRubyGem side (`lib/`, `funicular.gemspec`, etc.) can be developed and tested independently inside that directory, but `rake copy_wasm` — which vendorsthe PicoRuby.wasm and picorbc wasm artifacts into the gem — relies on sibling directories within the picoruby repository (`mrbgems/picoruby-wasm/npm/`).
|
|
73
|
+
Running it from a standalone checkout will fail.
|
|
32
74
|
|
|
33
75
|
## Contributing
|
|
34
76
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
77
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/picoruby/funicular.
|
|
36
78
|
|
|
37
79
|
## License
|
|
38
80
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Code of Conduct
|
|
42
|
-
|
|
43
|
-
Everyone interacting in the Funicular project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/funicular/blob/master/CODE_OF_CONDUCT.md).
|
|
81
|
+
Copyright © 2025- HASUMI Hitoshi. See MIT-LICENSE for further details.
|
data/Rakefile
CHANGED
|
@@ -4,9 +4,81 @@ require "bundler/gem_tasks"
|
|
|
4
4
|
require "rake/testtask"
|
|
5
5
|
|
|
6
6
|
Rake::TestTask.new(:test) do |t|
|
|
7
|
-
t.libs << "
|
|
7
|
+
t.libs << "minitest"
|
|
8
8
|
t.libs << "lib"
|
|
9
|
-
t.test_files = FileList["
|
|
9
|
+
t.test_files = FileList["minitest/**/*_test.rb"]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
task default: :test
|
|
13
|
+
|
|
14
|
+
desc "Copy picoruby and picorbc wasm artifacts from picoruby-wasm into the gem"
|
|
15
|
+
task :copy_wasm do
|
|
16
|
+
require "fileutils"
|
|
17
|
+
require "json"
|
|
18
|
+
|
|
19
|
+
vendor_root = File.expand_path("lib/funicular/vendor", __dir__)
|
|
20
|
+
|
|
21
|
+
# PICORUBY_WASM_NPM_DIR overrides the default search path.
|
|
22
|
+
# Default: picoruby-wasm is a sibling of picoruby-funicular under mrbgems/.
|
|
23
|
+
npm_root = ENV["PICORUBY_WASM_NPM_DIR"] ||
|
|
24
|
+
File.expand_path("../picoruby-wasm/npm", __dir__)
|
|
25
|
+
|
|
26
|
+
unless Dir.exist?(npm_root)
|
|
27
|
+
abort "picoruby-wasm npm directory not found: #{npm_root}\n" \
|
|
28
|
+
"Set PICORUBY_WASM_NPM_DIR to override, and ensure picoruby-wasm has been built."
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# ------------------------------------------------------------------
|
|
32
|
+
# 1) PicoRuby runtime (browser): dist + debug
|
|
33
|
+
# ------------------------------------------------------------------
|
|
34
|
+
picoruby_src = File.join(npm_root, "picoruby")
|
|
35
|
+
picoruby_dest = File.join(vendor_root, "picoruby")
|
|
36
|
+
abort "Missing #{picoruby_src}" unless Dir.exist?(picoruby_src)
|
|
37
|
+
|
|
38
|
+
picoruby_version = JSON.parse(File.read(File.join(picoruby_src, "package.json"))).fetch("version")
|
|
39
|
+
picoruby_files = %w[picoruby.wasm picoruby.js init.iife.js]
|
|
40
|
+
|
|
41
|
+
%w[dist debug].each do |variant|
|
|
42
|
+
src = File.join(picoruby_src, variant)
|
|
43
|
+
dst = File.join(picoruby_dest, variant)
|
|
44
|
+
abort "Missing source variant: #{src}" unless Dir.exist?(src)
|
|
45
|
+
|
|
46
|
+
FileUtils.rm_rf(dst)
|
|
47
|
+
FileUtils.mkdir_p(dst)
|
|
48
|
+
picoruby_files.each do |fname|
|
|
49
|
+
src_file = File.join(src, fname)
|
|
50
|
+
abort "Missing file: #{src_file}" unless File.exist?(src_file)
|
|
51
|
+
# FileUtils.copy_file follows symlinks, so debug/init.iife.js
|
|
52
|
+
# (a symlink to ../dist/init.iife.js) is materialized.
|
|
53
|
+
FileUtils.copy_file(src_file, File.join(dst, fname))
|
|
54
|
+
end
|
|
55
|
+
puts " copied picoruby/#{variant}"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
File.write(File.join(picoruby_dest, "VERSION"), "#{picoruby_version}\n")
|
|
59
|
+
puts " wrote picoruby/VERSION (#{picoruby_version})"
|
|
60
|
+
|
|
61
|
+
# ------------------------------------------------------------------
|
|
62
|
+
# 2) picorbc compiler (node CLI, run by Funicular::Compiler)
|
|
63
|
+
# ------------------------------------------------------------------
|
|
64
|
+
picorbc_src = File.join(npm_root, "picorbc", "debug")
|
|
65
|
+
picorbc_dest = File.join(vendor_root, "picorbc")
|
|
66
|
+
abort "Missing #{picorbc_src}" unless Dir.exist?(picorbc_src)
|
|
67
|
+
|
|
68
|
+
picorbc_version = JSON.parse(File.read(File.join(npm_root, "picorbc", "package.json"))).fetch("version")
|
|
69
|
+
picorbc_files = %w[picorbc.js picorbc.wasm]
|
|
70
|
+
|
|
71
|
+
FileUtils.rm_rf(picorbc_dest)
|
|
72
|
+
FileUtils.mkdir_p(picorbc_dest)
|
|
73
|
+
picorbc_files.each do |fname|
|
|
74
|
+
src_file = File.join(picorbc_src, fname)
|
|
75
|
+
abort "Missing file: #{src_file}" unless File.exist?(src_file)
|
|
76
|
+
FileUtils.copy_file(src_file, File.join(picorbc_dest, fname))
|
|
77
|
+
end
|
|
78
|
+
File.chmod(0755, File.join(picorbc_dest, "picorbc.js"))
|
|
79
|
+
File.write(File.join(picorbc_dest, "VERSION"), "#{picorbc_version}\n")
|
|
80
|
+
puts " copied picorbc (#{picorbc_version})"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Make sure the wasm artifacts are refreshed before the gem is packaged for release.
|
|
84
|
+
Rake::Task["build"].enhance([:copy_wasm])
|