stimulus_reflex 3.5.0.pre9 → 3.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of stimulus_reflex might be problematic. Click here for more details.

Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/Gemfile.lock +122 -127
  4. data/README.md +13 -19
  5. data/app/assets/javascripts/stimulus_reflex.js +1017 -523
  6. data/app/assets/javascripts/stimulus_reflex.umd.js +940 -496
  7. data/app/channels/stimulus_reflex/channel.rb +9 -24
  8. data/bin/console +0 -2
  9. data/bin/standardize +2 -1
  10. data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +68 -9
  11. data/lib/generators/stimulus_reflex/templates/app/controllers/examples_controller.rb.tt +9 -0
  12. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/consumer.js.tt +6 -0
  13. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.esbuild.tt +4 -0
  14. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.importmap.tt +2 -0
  15. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.shakapacker.tt +5 -0
  16. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.vite.tt +1 -0
  17. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.webpacker.tt +5 -0
  18. data/lib/generators/stimulus_reflex/templates/app/javascript/config/cable_ready.js.tt +4 -0
  19. data/lib/generators/stimulus_reflex/templates/app/javascript/config/index.js.tt +2 -0
  20. data/lib/generators/stimulus_reflex/templates/app/javascript/config/mrujs.js.tt +9 -0
  21. data/lib/generators/stimulus_reflex/templates/app/javascript/config/stimulus_reflex.js.tt +5 -0
  22. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +141 -0
  23. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application.js.tt +11 -0
  24. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application_controller.js.tt +74 -0
  25. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.esbuild.tt +7 -0
  26. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.importmap.tt +5 -0
  27. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.shakapacker.tt +5 -0
  28. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.vite.tt +5 -0
  29. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.webpacker.tt +5 -0
  30. data/{test/tmp/app/reflexes/user_reflex.rb → lib/generators/stimulus_reflex/templates/app/reflexes/%file_name%_reflex.rb.tt} +38 -9
  31. data/lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt +27 -0
  32. data/lib/generators/stimulus_reflex/templates/app/views/examples/show.html.erb.tt +207 -0
  33. data/lib/generators/stimulus_reflex/templates/config/initializers/cable_ready.rb +27 -0
  34. data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +18 -13
  35. data/lib/generators/stimulus_reflex/templates/esbuild.config.mjs.tt +94 -0
  36. data/lib/install/action_cable.rb +155 -0
  37. data/lib/install/broadcaster.rb +90 -0
  38. data/lib/install/bundle.rb +56 -0
  39. data/lib/install/compression.rb +41 -0
  40. data/lib/install/config.rb +87 -0
  41. data/lib/install/development.rb +110 -0
  42. data/lib/install/esbuild.rb +114 -0
  43. data/lib/install/example.rb +22 -0
  44. data/lib/install/importmap.rb +133 -0
  45. data/lib/install/initializers.rb +25 -0
  46. data/lib/install/mrujs.rb +133 -0
  47. data/lib/install/npm_packages.rb +25 -0
  48. data/lib/install/reflexes.rb +25 -0
  49. data/lib/install/shakapacker.rb +64 -0
  50. data/lib/install/spring.rb +54 -0
  51. data/lib/install/updatable.rb +34 -0
  52. data/lib/install/vite.rb +64 -0
  53. data/lib/install/webpacker.rb +90 -0
  54. data/lib/install/yarn.rb +55 -0
  55. data/lib/stimulus_reflex/broadcasters/broadcaster.rb +15 -8
  56. data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +7 -8
  57. data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +10 -10
  58. data/lib/stimulus_reflex/broadcasters/update.rb +3 -0
  59. data/lib/stimulus_reflex/cable_readiness.rb +29 -0
  60. data/lib/stimulus_reflex/cable_ready_channels.rb +6 -5
  61. data/lib/stimulus_reflex/callbacks.rb +17 -1
  62. data/lib/stimulus_reflex/concern_enhancer.rb +6 -4
  63. data/lib/stimulus_reflex/configuration.rb +12 -2
  64. data/lib/stimulus_reflex/dataset.rb +11 -1
  65. data/lib/stimulus_reflex/engine.rb +16 -9
  66. data/lib/stimulus_reflex/html/document.rb +59 -0
  67. data/lib/stimulus_reflex/html/document_fragment.rb +13 -0
  68. data/lib/stimulus_reflex/importmap.rb +6 -3
  69. data/lib/stimulus_reflex/installer.rb +274 -0
  70. data/lib/stimulus_reflex/open_struct_fix.rb +2 -0
  71. data/lib/stimulus_reflex/reflex.rb +40 -31
  72. data/lib/stimulus_reflex/reflex_data.rb +19 -3
  73. data/lib/stimulus_reflex/reflex_factory.rb +6 -3
  74. data/lib/stimulus_reflex/request_parameters.rb +2 -0
  75. data/lib/stimulus_reflex/utils/logger.rb +10 -0
  76. data/lib/stimulus_reflex/utils/sanity_checker.rb +8 -48
  77. data/lib/stimulus_reflex/version.rb +1 -1
  78. data/lib/stimulus_reflex/version_checker.rb +54 -0
  79. data/lib/stimulus_reflex.rb +2 -0
  80. data/lib/tasks/stimulus_reflex/stimulus_reflex.rake +250 -0
  81. data/package.json +36 -28
  82. data/{rollup.config.js → rollup.config.mjs} +6 -24
  83. data/stimulus_reflex.gemspec +16 -19
  84. data/yarn.lock +1331 -748
  85. metadata +129 -79
  86. data/LATEST +0 -1
  87. data/app/assets/javascripts/stimulus_reflex.min.js +0 -2
  88. data/app/assets/javascripts/stimulus_reflex.min.js.map +0 -1
  89. data/app/assets/javascripts/stimulus_reflex.umd.min.js +0 -905
  90. data/app/assets/javascripts/stimulus_reflex.umd.min.js.map +0 -1
  91. data/lib/generators/stimulus_reflex/initializer_generator.rb +0 -14
  92. data/test/broadcasters/broadcaster_test.rb +0 -11
  93. data/test/broadcasters/broadcaster_test_case.rb +0 -39
  94. data/test/broadcasters/nothing_broadcaster_test.rb +0 -31
  95. data/test/broadcasters/page_broadcaster_test.rb +0 -79
  96. data/test/broadcasters/selector_broadcaster_test.rb +0 -173
  97. data/test/callbacks_test.rb +0 -652
  98. data/test/concern_enhancer_test.rb +0 -54
  99. data/test/element_test.rb +0 -254
  100. data/test/generators/stimulus_reflex_generator_test.rb +0 -58
  101. data/test/reflex_test.rb +0 -43
  102. data/test/test_helper.rb +0 -71
  103. data/test/tmp/app/reflexes/application_reflex.rb +0 -12
  104. data/yarn-error.log +0 -4964
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stimulus_reflex",
3
- "version": "3.5.0-pre9",
3
+ "version": "3.5.0-rc1",
4
4
  "description": "Build reactive applications with the Rails tooling you already know and love.",
5
5
  "keywords": [
6
6
  "ruby",
@@ -18,50 +18,58 @@
18
18
  "dom",
19
19
  "morphdom"
20
20
  ],
21
- "homepage": "https://docs.stimulusreflex.com/",
22
- "bugs": {
23
- "url": "https://github.com/stimulusreflex/stimulus_reflex/issues"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com:stimulusreflex/stimulus_reflex.git"
28
- },
21
+ "homepage": "https://docs.stimulusreflex.com",
22
+ "bugs": "https://github.com/stimulusreflex/stimulus_reflex/issues",
23
+ "repository": "https://github.com/stimulusreflex/stimulus_reflex",
29
24
  "license": "MIT",
30
25
  "author": "Nathan Hopkins <natehop@gmail.com>",
31
- "main": "./dist/stimulus_reflex.umd.min.js",
32
- "module": "./dist/stimulus_reflex.min.js",
26
+ "contributors": [
27
+ "Andrew Mason <andrewmcodes@protonmail.com>",
28
+ "Julian Rubisch <julian@julianrubisch.at>",
29
+ "Marco Roth <marco.roth@intergga.ch>",
30
+ "Nathan Hopkins <natehop@gmail.com>"
31
+ ],
32
+ "main": "./dist/stimulus_reflex.js",
33
+ "module": "./dist/stimulus_reflex.js",
34
+ "browser": "./dist/stimulus_reflex.js",
35
+ "import": "./dist/stimulus_reflex.js",
36
+ "unpkg": "./dist/stimulus_reflex.umd.js",
37
+ "umd": "./dist/stimulus_reflex.umd.js",
33
38
  "files": [
34
39
  "dist/*",
35
40
  "javascript/*"
36
41
  ],
37
42
  "scripts": {
38
- "lint": "yarn prettier-standard:check",
39
- "format": "yarn prettier-standard:format",
43
+ "lint": "yarn run format --check",
44
+ "format": "yarn run prettier-standard ./javascript/**/*.js rollup.config.mjs",
40
45
  "build": "yarn rollup -c",
41
46
  "build:watch": "yarn rollup -wc",
42
47
  "watch": "yarn build:watch",
43
- "prettier-standard:check": "yarn run prettier-standard --check ./javascript/**/*.js rollup.config.js",
44
- "prettier-standard:format": "yarn run prettier-standard ./javascript/**/*.js rollup.config.js",
45
- "test": "web-test-runner javascript/test/**/*.test.js"
48
+ "test": "web-test-runner javascript/test/**/*.test.js",
49
+ "test:watch": "yarn test --watch",
50
+ "docs:dev": "vitepress dev docs",
51
+ "docs:build": "vitepress build docs && cp docs/_redirects docs/.vitepress/dist",
52
+ "docs:preview": "vitepress preview docs"
46
53
  },
47
54
  "peerDependencies": {
48
55
  "@hotwired/stimulus": ">= 3.0"
49
56
  },
50
57
  "dependencies": {
51
- "@hotwired/stimulus": ">= 3.0",
52
- "@rails/actioncable": ">= 6.0",
53
- "cable_ready": ">= 5.0.0-pre9"
58
+ "@hotwired/stimulus": "^3",
59
+ "@rails/actioncable": "^6 || ^7",
60
+ "cable_ready": "5.0.0-rc1"
54
61
  },
55
62
  "devDependencies": {
56
- "@open-wc/testing": "^3.1.2",
57
- "@rollup/plugin-commonjs": "^21.0.3",
58
- "@rollup/plugin-json": "^4.1.0",
59
- "@rollup/plugin-node-resolve": "^13.1.3",
60
- "@web/dev-server-esbuild": "^0.3.0",
61
- "@web/dev-server-rollup": "^0.3.15",
62
- "@web/test-runner": "^0.13.27",
63
+ "@open-wc/testing": "^3.1.7",
64
+ "@rollup/plugin-json": "^6.0.0",
65
+ "@rollup/plugin-node-resolve": "^15.0.1",
66
+ "@rollup/plugin-terser": "^0.4.0",
67
+ "@web/dev-server-esbuild": "^0.3.3",
68
+ "@web/dev-server-rollup": "^0.3.21",
69
+ "@web/test-runner": "^0.15.1",
63
70
  "prettier-standard": "^16.4.1",
64
- "rollup": "^2.70.1",
65
- "rollup-plugin-terser": "^7.0.2"
71
+ "rollup": "^3.19.1",
72
+ "toastify-js": "^1.12.0",
73
+ "vitepress": "^1.0.0-alpha.56"
66
74
  }
67
75
  }
@@ -1,7 +1,6 @@
1
1
  import resolve from '@rollup/plugin-node-resolve'
2
- import commonjs from '@rollup/plugin-commonjs'
3
2
  import json from '@rollup/plugin-json'
4
- import { terser } from 'rollup-plugin-terser'
3
+ import terser from '@rollup/plugin-terser'
5
4
 
6
5
  const pretty = () => {
7
6
  return terser({
@@ -14,13 +13,6 @@ const pretty = () => {
14
13
  })
15
14
  }
16
15
 
17
- const minify = () => {
18
- return terser({
19
- mangle: true,
20
- compress: true
21
- })
22
- }
23
-
24
16
  const esConfig = {
25
17
  format: 'es',
26
18
  inlineDynamicImports: true
@@ -31,38 +23,28 @@ const umdConfig = {
31
23
  format: 'umd',
32
24
  exports: 'named',
33
25
  globals: {
26
+ '@rails/actioncable': 'ActionCable',
34
27
  morphdom: 'morphdom',
35
28
  cable_ready: 'CableReady',
36
29
  '@hotwired/stimulus': 'Stimulus'
37
30
  }
38
31
  }
39
32
 
33
+ const baseName = 'stimulus_reflex'
40
34
  const distFolders = ['dist', 'app/assets/javascripts']
41
35
 
42
36
  const output = distFolders
43
37
  .map(distFolder => [
44
38
  {
45
39
  ...umdConfig,
46
- file: `${distFolder}/stimulus_reflex.umd.js`,
47
- plugins: [pretty()]
48
- },
49
- {
50
- ...umdConfig,
51
- file: `${distFolder}/stimulus_reflex.umd.min.js`,
52
- sourcemap: true,
40
+ file: `${distFolder}/${baseName}.umd.js`,
53
41
  plugins: [pretty()]
54
42
  },
55
43
  {
56
44
  ...esConfig,
57
- file: `${distFolder}/stimulus_reflex.js`,
45
+ file: `${distFolder}/${baseName}.js`,
58
46
  format: 'es',
59
47
  plugins: [pretty()]
60
- },
61
- {
62
- ...esConfig,
63
- file: `${distFolder}/stimulus_reflex.min.js`,
64
- sourcemap: true,
65
- plugins: [minify()]
66
48
  }
67
49
  ])
68
50
  .flat()
@@ -77,7 +59,7 @@ export default [
77
59
  ],
78
60
  input: 'javascript/index.js',
79
61
  output,
80
- plugins: [commonjs(), resolve(), json()],
62
+ plugins: [resolve(), json()],
81
63
  watch: {
82
64
  include: 'javascript/**'
83
65
  }
@@ -30,34 +30,31 @@ Gem::Specification.new do |gem|
30
30
  }
31
31
 
32
32
  gem.files = Dir[
33
- "lib/**/*.rb",
33
+ "lib/**/*.{rb,rake,tt}",
34
34
  "app/**/*.rb",
35
35
  "app/assets/javascripts/*",
36
36
  "bin/*",
37
37
  "[A-Z]*"
38
38
  ]
39
39
 
40
- gem.test_files = Dir["test/**/*.rb"]
41
-
42
40
  gem.required_ruby_version = ">= 2.7.0"
43
41
 
44
- rails_version = ">= 5.2"
45
- gem.add_dependency "actioncable", rails_version
46
- gem.add_dependency "actionpack", rails_version
47
- gem.add_dependency "actionview", rails_version
48
- gem.add_dependency "activesupport", rails_version
49
- gem.add_dependency "railties", rails_version
42
+ rails_version = [">= 5.2", "< 8"]
43
+ gem.add_dependency "actioncable", *rails_version
44
+ gem.add_dependency "actionpack", *rails_version
45
+ gem.add_dependency "actionview", *rails_version
46
+ gem.add_dependency "activesupport", *rails_version
47
+ gem.add_dependency "railties", *rails_version
50
48
 
51
- gem.add_dependency "cable_ready", ">= 5.0.0.pre9"
52
- gem.add_dependency "nokogiri"
53
- gem.add_dependency "rack"
54
- gem.add_dependency "redis"
49
+ gem.add_dependency "cable_ready", ">= 5.0.0.rc1"
50
+ gem.add_dependency "nokogiri", "~> 1.0"
51
+ gem.add_dependency "rack", ">= 2", "< 4"
52
+ gem.add_dependency "redis", ">= 4.0", "< 6.0"
55
53
 
56
54
  gem.add_development_dependency "bundler", "~> 2.0"
57
- gem.add_development_dependency "mocha"
58
- gem.add_development_dependency "pry"
59
- gem.add_development_dependency "pry-nav"
60
- gem.add_development_dependency "rails", rails_version
61
- gem.add_development_dependency "rake"
62
- gem.add_development_dependency "standardrb", "~> 1.0"
55
+ gem.add_development_dependency "magic_frozen_string_literal", "~> 1.2"
56
+ gem.add_development_dependency "mocha", "~> 1.13"
57
+ gem.add_development_dependency "rails", *rails_version
58
+ gem.add_development_dependency "rake", "~> 13.0"
59
+ gem.add_development_dependency "standard", "~> 1.24"
63
60
  end