ruby_wasm_ui 0.8.1

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.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.cursor/rules/ruby_comments.mdc +29 -0
  3. data/.github/workflows/playwright.yml +74 -0
  4. data/.github/workflows/rspec.yml +33 -0
  5. data/.node-version +1 -0
  6. data/CODE_OF_CONDUCT.md +132 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +218 -0
  9. data/Rakefile +4 -0
  10. data/docs/conditional-rendering.md +119 -0
  11. data/docs/lifecycle-hooks.md +75 -0
  12. data/docs/list-rendering.md +51 -0
  13. data/examples/Gemfile +5 -0
  14. data/examples/Gemfile.lock +41 -0
  15. data/examples/Makefile +15 -0
  16. data/examples/npm-packages/runtime/counter/index.html +28 -0
  17. data/examples/npm-packages/runtime/counter/index.rb +62 -0
  18. data/examples/npm-packages/runtime/counter/index.spec.js +42 -0
  19. data/examples/npm-packages/runtime/hello/index.html +28 -0
  20. data/examples/npm-packages/runtime/hello/index.rb +29 -0
  21. data/examples/npm-packages/runtime/hello/index.spec.js +53 -0
  22. data/examples/npm-packages/runtime/input/index.html +28 -0
  23. data/examples/npm-packages/runtime/input/index.rb +46 -0
  24. data/examples/npm-packages/runtime/input/index.spec.js +58 -0
  25. data/examples/npm-packages/runtime/list/index.html +27 -0
  26. data/examples/npm-packages/runtime/list/index.rb +33 -0
  27. data/examples/npm-packages/runtime/list/index.spec.js +46 -0
  28. data/examples/npm-packages/runtime/on_mounted_demo/index.html +40 -0
  29. data/examples/npm-packages/runtime/on_mounted_demo/index.rb +59 -0
  30. data/examples/npm-packages/runtime/on_mounted_demo/index.spec.js +50 -0
  31. data/examples/npm-packages/runtime/r_if_attribute_demo/index.html +34 -0
  32. data/examples/npm-packages/runtime/r_if_attribute_demo/index.rb +113 -0
  33. data/examples/npm-packages/runtime/r_if_attribute_demo/index.spec.js +140 -0
  34. data/examples/npm-packages/runtime/random_cocktail/index.html +27 -0
  35. data/examples/npm-packages/runtime/random_cocktail/index.rb +69 -0
  36. data/examples/npm-packages/runtime/random_cocktail/index.spec.js +101 -0
  37. data/examples/npm-packages/runtime/search_field/index.html +27 -0
  38. data/examples/npm-packages/runtime/search_field/index.rb +39 -0
  39. data/examples/npm-packages/runtime/search_field/index.spec.js +59 -0
  40. data/examples/npm-packages/runtime/todos/index.html +28 -0
  41. data/examples/npm-packages/runtime/todos/index.rb +239 -0
  42. data/examples/npm-packages/runtime/todos/index.spec.js +161 -0
  43. data/examples/npm-packages/runtime/todos/todos_repository.rb +23 -0
  44. data/examples/package.json +12 -0
  45. data/examples/src/counter/index.html +23 -0
  46. data/examples/src/counter/index.rb +60 -0
  47. data/lib/ruby_wasm_ui +1 -0
  48. data/lib/ruby_wasm_ui.rb +1 -0
  49. data/package-lock.json +100 -0
  50. data/package.json +32 -0
  51. data/packages/npm-packages/runtime/Gemfile +3 -0
  52. data/packages/npm-packages/runtime/Gemfile.lock +26 -0
  53. data/packages/npm-packages/runtime/README.md +5 -0
  54. data/packages/npm-packages/runtime/eslint.config.mjs +16 -0
  55. data/packages/npm-packages/runtime/package-lock.json +6668 -0
  56. data/packages/npm-packages/runtime/package.json +38 -0
  57. data/packages/npm-packages/runtime/rollup.config.mjs +89 -0
  58. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/component_spec.rb +416 -0
  59. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/dom/scheduler_spec.rb +98 -0
  60. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/nodes_equal_spec.rb +190 -0
  61. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/template/build_conditional_group_spec.rb +505 -0
  62. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/template/build_for_group_spec.rb +377 -0
  63. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/template/build_vdom_spec.rb +573 -0
  64. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/template/parser_spec.rb +627 -0
  65. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/utils/arrays_spec.rb +228 -0
  66. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/utils/objects_spec.rb +127 -0
  67. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/utils/props_spec.rb +205 -0
  68. data/packages/npm-packages/runtime/spec/ruby_wasm_ui/utils/strings_spec.rb +107 -0
  69. data/packages/npm-packages/runtime/spec/spec_helper.rb +16 -0
  70. data/packages/npm-packages/runtime/src/__tests__/sample.test.js +5 -0
  71. data/packages/npm-packages/runtime/src/index.js +37 -0
  72. data/packages/npm-packages/runtime/src/ruby_wasm_ui/app.rb +53 -0
  73. data/packages/npm-packages/runtime/src/ruby_wasm_ui/component.rb +215 -0
  74. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dispatcher.rb +46 -0
  75. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dom/attributes.rb +105 -0
  76. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dom/destroy_dom.rb +63 -0
  77. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dom/events.rb +40 -0
  78. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dom/mount_dom.rb +108 -0
  79. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dom/patch_dom.rb +237 -0
  80. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dom/scheduler.rb +51 -0
  81. data/packages/npm-packages/runtime/src/ruby_wasm_ui/dom.rb +13 -0
  82. data/packages/npm-packages/runtime/src/ruby_wasm_ui/nodes_equal.rb +45 -0
  83. data/packages/npm-packages/runtime/src/ruby_wasm_ui/template/build_conditional_group.rb +150 -0
  84. data/packages/npm-packages/runtime/src/ruby_wasm_ui/template/build_for_group.rb +125 -0
  85. data/packages/npm-packages/runtime/src/ruby_wasm_ui/template/build_vdom.rb +220 -0
  86. data/packages/npm-packages/runtime/src/ruby_wasm_ui/template/parser.rb +134 -0
  87. data/packages/npm-packages/runtime/src/ruby_wasm_ui/template.rb +11 -0
  88. data/packages/npm-packages/runtime/src/ruby_wasm_ui/utils/arrays.rb +185 -0
  89. data/packages/npm-packages/runtime/src/ruby_wasm_ui/utils/objects.rb +37 -0
  90. data/packages/npm-packages/runtime/src/ruby_wasm_ui/utils/props.rb +25 -0
  91. data/packages/npm-packages/runtime/src/ruby_wasm_ui/utils/strings.rb +19 -0
  92. data/packages/npm-packages/runtime/src/ruby_wasm_ui/utils.rb +11 -0
  93. data/packages/npm-packages/runtime/src/ruby_wasm_ui/vdom.rb +84 -0
  94. data/packages/npm-packages/runtime/src/ruby_wasm_ui/version.rb +5 -0
  95. data/packages/npm-packages/runtime/src/ruby_wasm_ui.rb +14 -0
  96. data/packages/npm-packages/runtime/vitest.config.js +8 -0
  97. data/playwright.config.js +78 -0
  98. data/sig/ruby_wasm_ui.rbs +4 -0
  99. metadata +168 -0
data/package-lock.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "ruby-wasm-ui-project",
3
+ "version": "0.8.1",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "ruby-wasm-ui-project",
9
+ "version": "0.8.1",
10
+ "license": "MIT",
11
+ "workspaces": [
12
+ "packages/*"
13
+ ],
14
+ "devDependencies": {
15
+ "@playwright/test": "^1.40.0"
16
+ }
17
+ },
18
+ "node_modules/@playwright/test": {
19
+ "version": "1.55.0",
20
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.55.0.tgz",
21
+ "integrity": "sha512-04IXzPwHrW69XusN/SIdDdKZBzMfOT9UNT/YiJit/xpy2VuAoB8NHc8Aplb96zsWDddLnbkPL3TsmrS04ZU2xQ==",
22
+ "dev": true,
23
+ "license": "Apache-2.0",
24
+ "dependencies": {
25
+ "playwright": "1.55.0"
26
+ },
27
+ "bin": {
28
+ "playwright": "cli.js"
29
+ },
30
+ "engines": {
31
+ "node": ">=18"
32
+ }
33
+ },
34
+ "node_modules/fsevents": {
35
+ "version": "2.3.2",
36
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
37
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
38
+ "dev": true,
39
+ "hasInstallScript": true,
40
+ "license": "MIT",
41
+ "optional": true,
42
+ "os": [
43
+ "darwin"
44
+ ],
45
+ "engines": {
46
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
47
+ }
48
+ },
49
+ "node_modules/playwright": {
50
+ "version": "1.55.0",
51
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.0.tgz",
52
+ "integrity": "sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==",
53
+ "dev": true,
54
+ "license": "Apache-2.0",
55
+ "dependencies": {
56
+ "playwright-core": "1.55.0"
57
+ },
58
+ "bin": {
59
+ "playwright": "cli.js"
60
+ },
61
+ "engines": {
62
+ "node": ">=18"
63
+ },
64
+ "optionalDependencies": {
65
+ "fsevents": "2.3.2"
66
+ }
67
+ },
68
+ "node_modules/playwright-core": {
69
+ "version": "1.55.0",
70
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.0.tgz",
71
+ "integrity": "sha512-GvZs4vU3U5ro2nZpeiwyb0zuFaqb9sUiAJuyrWpcGouD8y9/HLgGbNRjIph7zU9D3hnPaisMl9zG9CgFi/biIg==",
72
+ "dev": true,
73
+ "license": "Apache-2.0",
74
+ "bin": {
75
+ "playwright-core": "cli.js"
76
+ },
77
+ "engines": {
78
+ "node": ">=18"
79
+ }
80
+ },
81
+ "packages/npm-packages/runtime": {
82
+ "name": "ruby-wasm-ui",
83
+ "version": "0.0.1",
84
+ "extraneous": true,
85
+ "license": "MIT",
86
+ "dependencies": {
87
+ "@ruby/3.4-wasm-wasi": "^2.7.1",
88
+ "@ruby/wasm-wasi": "^2.7.1"
89
+ },
90
+ "devDependencies": {
91
+ "eslint": "^9.25.1",
92
+ "jsdom": "^26.1.0",
93
+ "rollup": "^4.40.0",
94
+ "rollup-plugin-cleanup": "^3.2.1",
95
+ "rollup-plugin-filesize": "^10.0.0",
96
+ "vitest": "^3.1.2"
97
+ }
98
+ }
99
+ }
100
+ }
data/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "ruby-wasm-ui-project",
3
+ "version": "0.8.1",
4
+ "private": true,
5
+ "description": "A project to ruby.wasm ui framework",
6
+ "scripts": {
7
+ "serve:examples": "npx http-server . -o './examples/npm-packages/runtime/?env=PRD' --cors -P 'http://localhost:8080?' -c-1",
8
+ "serve:examples:dev": "cd packages/npm-packages/runtime && npm run build:dev && cd ../../.. && npx http-server . -o './examples/npm-packages/runtime/?env=DEV' --cors -P 'http://localhost:8080?' -c-1",
9
+ "serve:examples:test": "cd packages/npm-packages/runtime && npm run build:dev && cd ../../.. && npx http-server . --cors -P 'http://localhost:8080?' -c-1",
10
+ "test": "npx playwright test",
11
+ "test:ui": "npx playwright test --ui",
12
+ "test:report": "npx playwright show-report"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/t0yohei/ruby-wasm-ui.git"
17
+ },
18
+ "keywords": [
19
+ "ruby",
20
+ "wasm",
21
+ "ui"
22
+ ],
23
+ "author": "t0yohei <k.t0yohei@gmail.com>",
24
+ "license": "MIT",
25
+ "type": "module",
26
+ "workspaces": [
27
+ "packages/*"
28
+ ],
29
+ "devDependencies": {
30
+ "@playwright/test": "^1.40.0"
31
+ }
32
+ }
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rspec'
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.6.2)
5
+ rspec (3.13.1)
6
+ rspec-core (~> 3.13.0)
7
+ rspec-expectations (~> 3.13.0)
8
+ rspec-mocks (~> 3.13.0)
9
+ rspec-core (3.13.4)
10
+ rspec-support (~> 3.13.0)
11
+ rspec-expectations (3.13.5)
12
+ diff-lcs (>= 1.2.0, < 2.0)
13
+ rspec-support (~> 3.13.0)
14
+ rspec-mocks (3.13.5)
15
+ diff-lcs (>= 1.2.0, < 2.0)
16
+ rspec-support (~> 3.13.0)
17
+ rspec-support (3.13.4)
18
+
19
+ PLATFORMS
20
+ arm64-darwin-21
21
+
22
+ DEPENDENCIES
23
+ rspec
24
+
25
+ BUNDLED WITH
26
+ 2.4.22
@@ -0,0 +1,5 @@
1
+ # ruby-wasm-ui
2
+
3
+ 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.
4
+
5
+ Please refer to the [GitHub README](https://github.com/t0yohei/ruby-wasm-ui#readme) for full documentation.
@@ -0,0 +1,16 @@
1
+ import js from "@eslint/js";
2
+ import globals from "globals";
3
+
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ ecmaVersion: "latest",
9
+ sourceType: "module",
10
+ globals: {
11
+ ...globals.browser,
12
+ },
13
+ },
14
+ rules: {},
15
+ },
16
+ ];