react-rails 2.7.0 → 3.0.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -18
- data/README.md +97 -49
- data/lib/assets/javascripts/react_ujs.js +1 -1
- data/lib/assets/react-source/development/react-server.js +333 -10
- data/lib/assets/react-source/development/react.js +19 -28
- data/lib/assets/react-source/production/react-server.js +1 -1
- data/lib/assets/react-source/production/react.js +1 -1
- data/lib/generators/react/component_generator.rb +126 -121
- data/lib/generators/react/install_generator.rb +50 -72
- data/lib/generators/templates/component.es6.jsx +8 -8
- data/lib/generators/templates/component.js.jsx +14 -14
- data/lib/generators/templates/react_server_rendering.rb +3 -1
- data/lib/react/jsx/babel_transformer.rb +12 -6
- data/lib/react/jsx/jsx_transformer.rb +7 -5
- data/lib/react/jsx/processor.rb +3 -1
- data/lib/react/jsx/sprockets_strategy.rb +17 -11
- data/lib/react/jsx/template.rb +7 -6
- data/lib/react/jsx.rb +9 -7
- data/lib/react/rails/asset_variant.rb +7 -6
- data/lib/react/rails/component_mount.rb +37 -29
- data/lib/react/rails/controller_lifecycle.rb +2 -0
- data/lib/react/rails/controller_renderer.rb +3 -1
- data/lib/react/rails/railtie.rb +19 -22
- data/lib/react/rails/test_helper.rb +3 -1
- data/lib/react/rails/version.rb +3 -1
- data/lib/react/rails/view_helper.rb +3 -1
- data/lib/react/rails.rb +9 -7
- data/lib/react/server_rendering/bundle_renderer.rb +34 -39
- data/lib/react/server_rendering/environment_container.rb +2 -0
- data/lib/react/server_rendering/exec_js_renderer.rb +15 -6
- data/lib/react/server_rendering/manifest_container.rb +6 -2
- data/lib/react/server_rendering/separate_server_bundle_container.rb +19 -0
- data/lib/react/server_rendering/yaml_manifest_container.rb +4 -2
- data/lib/react/server_rendering.rb +11 -9
- data/lib/react-rails.rb +8 -6
- data/lib/react.rb +2 -0
- metadata +11 -53
- data/lib/react/server_rendering/webpacker_manifest_container.rb +0 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d2a4cb3734964b0395e076976f0f518467d0ece8559e6fe46c50db07dbbef0
|
4
|
+
data.tar.gz: 5219597584239f5624dadd79049d295346017102bf2d28663ba533adc1c7481f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbb05294e9838ba2044a47c7171e115d8ad27252cc38488f44009ce7e1518bf1cd03138a18f40d6dfb52b2d05f5a2a08e45a891ef27a3eeb2ab539091ddf63f
|
7
|
+
data.tar.gz: 42dadcb99c93a42584af25c9ab4dcfa09d30c236bec22a59f48be8d78079daf1c12711cbc5e75e7b1e2313ce1b39e3ddf556ea4bc65045d0f7a7bc4f3541c491
|
data/CHANGELOG.md
CHANGED
@@ -9,29 +9,28 @@ Changes since last non-beta release.
|
|
9
9
|
|
10
10
|
_Please add entries here for your pull requests that are not yet released._
|
11
11
|
|
12
|
-
|
12
|
+
### Breaking Changes
|
13
|
+
- Requires separate compilations for server & client bundles if using Shakapacker (see [Webpack config](https://github.com/reactjs/react-rails/tree/master/test/dummy/config/webpack)) #1274
|
14
|
+
- Replaces WebpackManifestContainer, which searched for assets in the webpack manifest, with SeparateServerBundleContainer, which expects a single server bundle file & does not use the webpack manifest at all. #1274
|
15
|
+
- Upgrades React-Rails' embedded react to v18.2.0. Uses node polyfill plugin & fast-text-encoder for SSR text encoding. #1290
|
16
|
+
- If using Webpacker/Shakapacker, requires upgrading to Shakapacker v7 #1274 and #1285
|
17
|
+
|
18
|
+
#### Changed
|
19
|
+
- The `react:component` generator now generates a function component by default #1271
|
20
|
+
|
21
|
+
## [2.7.1] - 2023-05-19
|
22
|
+
|
23
|
+
#### Bug Fixes
|
24
|
+
- Fix ReactDomClient initialization error during SSR. #1278
|
25
|
+
|
26
|
+
## [2.7.0] - 2023-05-06
|
13
27
|
|
14
28
|
#### New Features
|
15
29
|
- Camelizes keys with primitive values, in addition to hashes #946
|
16
30
|
- Expose alternative implementations for `ReactUJS.getConstructor` #1050
|
17
31
|
- Include turbolinks in dev and update webdrivers #1174
|
18
32
|
- Add support for multiple `require.context` with addition of `useContexts` #1144
|
19
|
-
- Update dependencies
|
20
|
-
|
21
|
-
#### Update dependencies
|
22
|
-
- react to 17.0.2 #1218
|
23
|
-
- webpack to 5.74.0
|
24
|
-
- webpack-dev-server to 2.11.5 #1150
|
25
|
-
- Node-sass to 7.0.0 #1158
|
26
|
-
- url-parse to 1.5.10 #1167
|
27
|
-
- minimist to 1.2.6 #1169
|
28
|
-
- async to 2.6.4 #1178
|
29
|
-
- rack to 2.2.3.1 #1182
|
30
|
-
- eventsource to 1.1.1 #1183
|
31
|
-
- rails-html-sanitizer to 1.4.3 #1188
|
32
|
-
- tzinfo to 1.2.10 #1190
|
33
|
-
|
34
|
-
#### Deprecation
|
33
|
+
- Update many dependencies
|
35
34
|
|
36
35
|
#### Bug Fixes
|
37
36
|
- Fix installation crash caused by absolute path for `source_entry_path` in default `config/webpacker.yml` coming from `shakapacker` version 6.x - #1216
|
@@ -556,5 +555,6 @@ _Please add entries here for your pull requests that are not yet released._
|
|
556
555
|
- Server rendering with `prerender: true`
|
557
556
|
- Transform `.jsx` in the asset pipeline
|
558
557
|
|
559
|
-
[Unreleased]: https://github.com/reactjs/react-rails/compare/v2.7.
|
558
|
+
[Unreleased]: https://github.com/reactjs/react-rails/compare/v2.7.1...master
|
559
|
+
[2.7.1]: https://github.com/shakacode/shakapacker/compare/v2.7.0...v2.7.1
|
560
560
|
[2.7.0]: https://github.com/shakacode/shakapacker/compare/v2.6.2...v2.7.0
|
data/README.md
CHANGED
@@ -1,22 +1,39 @@
|
|
1
|
-
# React-Rails
|
1
|
+
# React-Rails v3
|
2
2
|
|
3
3
|
[![Gem](https://img.shields.io/gem/v/react-rails.svg?style=flat-square)](http://rubygems.org/gems/react-rails)
|
4
4
|
[![npm](https://img.shields.io/npm/v/react_ujs.svg?style=flat-square)](https://www.npmjs.com/package/react_ujs)
|
5
5
|
[![Ruby](https://github.com/reactjs/react-rails/actions/workflows/ruby.yml/badge.svg)](https://github.com/reactjs/react-rails/actions/workflows/ruby.yml)
|
6
6
|
|
7
7
|
## News
|
8
|
-
|
8
|
+
V3.0.0 is released with Shakapacker v6 support, including SSR. Please try it out and report any issues. We'll try to address any critical issues ASAP.
|
9
|
+
|
10
|
+
For version 2.7 documentation checkout [2.7-stable](https://github.com/reactjs/react-rails/tree/2.7-stable) branch.
|
9
11
|
|
10
12
|
## Summary
|
11
13
|
React-Rails is a flexible tool to use [React](http://facebook.github.io/react/) with Rails. The benefits:
|
12
14
|
* Automatically renders React server-side and client-side
|
13
|
-
* Supports
|
14
|
-
* Supports Sprockets 4.x, 3.x
|
15
|
+
* Supports [Shakapacker](https://github.com/shakacode/shakapacker) v7
|
16
|
+
* Supports Sprockets 4.x, 3.x
|
15
17
|
* Lets you use [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html), [ES6](http://es6-features.org/), [TypeScript](https://www.typescriptlang.org/), [CoffeeScript](http://coffeescript.org/)
|
16
18
|
|
19
|
+
---
|
20
|
+
## ShakaCode Support
|
21
|
+
|
22
|
+
[ShakaCode](https://www.shakacode.com) offers support for upgrading this gem, and related gems such as Webpacker and using Shakapacker. If interested, contact Justin Gordon, [justin@shakacode.com](mailto:justin@shakacode.com). We're also [hiring](https://jobs.lever.co/shakacode/3bdbfdb3-4495-4611-a279-01dddb351abe)!
|
23
|
+
|
24
|
+
Here's a testimonial of how ShakaCode can help, from [Florian Gößler](https://github.com/FGoessler) of [Blinkist](https://www.blinkist.com/), January 2, 2023:
|
25
|
+
> Hey Justin 👋
|
26
|
+
>
|
27
|
+
> I just wanted to let you know that we today shipped the webpacker to shakapacker upgrades and it all seems to be running smoothly! Thanks again for all your support and your teams work! 😍
|
28
|
+
>
|
29
|
+
> On top of your work, it was now also very easy for me to upgrade Tailwind and include our external node_module based web component library which we were using for our other (more modern) apps already. That work is going to be shipped later this week though as we are polishing the last bits of it. 😉
|
30
|
+
>
|
31
|
+
> Have a great 2023 and maybe we get to work together again later in the year! 🙌
|
32
|
+
|
33
|
+
Read the [full review here](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2118154). Here's [another review of a Shakapacker migration that led to more work](https://clutch.co/profile/shakacode#reviews?sort_by=date_DESC#review-2096078).
|
34
|
+
|
17
35
|
## Resouces
|
18
36
|
* [Click to join **React + Rails Slack**](https://reactrails.slack.com/join/shared_invite/enQtNjY3NTczMjczNzYxLTlmYjdiZmY3MTVlMzU2YWE0OWM0MzNiZDI0MzdkZGFiZTFkYTFkOGVjODBmOWEyYWQ3MzA2NGE1YWJjNmVlMGE). Then join the channel `#react-rails`.
|
19
|
-
* If you need help upgrading `react-rails`, `webpacker`, or JS packages, contact [justin@shakacode.com](mailto:justin@shakacode.com). The [ShakaCode.com](https://www.shakacode.com) team is helping to maintain this Ruby gem. Check out [this discussion](https://github.com/reactjs/react-rails/discussions/1200).
|
20
37
|
* If you are upgrading, you might consider migrating to the [react_on_rails](https://github.com/shakacode/react_on_rails) gem.
|
21
38
|
* Source code example utilizing React-Rails: https://github.com/BookOfGreg/react-rails-example-app
|
22
39
|
|
@@ -25,10 +42,13 @@ React-Rails is a flexible tool to use [React](http://facebook.github.io/react/)
|
|
25
42
|
## Contents
|
26
43
|
|
27
44
|
- [Get started with Shakapacker](#get-started-with-shakapacker)
|
45
|
+
- [Component name](#component-name)
|
28
46
|
- [File naming](#file-naming)
|
29
47
|
- [Typescript support](#typescript-support)
|
48
|
+
- [Test component](#test-component)
|
30
49
|
- [Use with Asset Pipeline](#use-with-asset-pipeline)
|
31
50
|
- [Custom JSX Transformer](#custom-jsx-transformer)
|
51
|
+
- [Transform Plugin Options](#transform-plugin-options)
|
32
52
|
- [React.js versions](#reactjs-versions)
|
33
53
|
- [View Helper](#view-helper)
|
34
54
|
- [Custom View Helper](#custom-view-helper)
|
@@ -44,10 +64,12 @@ React-Rails is a flexible tool to use [React](http://facebook.github.io/react/)
|
|
44
64
|
- [Component Generator](#component-generator)
|
45
65
|
- [Use with JBuilder](#use-with-jbuilder)
|
46
66
|
- [Camelize Props](#camelize-props)
|
67
|
+
- [Changing Component Templates](#changing-component-templates)
|
47
68
|
- [Upgrading](#upgrading)
|
69
|
+
- [2.7 to 3.0](#27-to-30)
|
48
70
|
- [2.3 to 2.4](#23-to-24)
|
49
71
|
- [Common Errors](#common-errors)
|
50
|
-
- [
|
72
|
+
- [Getting warning for `Can't resolve 'react-dom/client'` in React < 18](#getting-warning-for-cant-resolve-react-domclient-in-react--18)
|
51
73
|
- [Undefined Set](#undefined-set)
|
52
74
|
- [Using TheRubyRacer](#using-therubyracer)
|
53
75
|
- [HMR](#hmr)
|
@@ -66,24 +88,24 @@ The Wiki page features a significant amount of additional information about Reac
|
|
66
88
|
|
67
89
|
_Alternatively, get started with [Sprockets](#use-with-asset-pipeline)_
|
68
90
|
|
69
|
-
|
91
|
+
1. Create a new Rails app:
|
70
92
|
Prevent installing default javascript dependencies by using `--skip-javascript` option:
|
71
93
|
|
72
94
|
```bash
|
73
|
-
|
74
|
-
|
95
|
+
rails new my-app --skip-javascript
|
96
|
+
cd my-app
|
75
97
|
```
|
76
98
|
|
77
|
-
|
99
|
+
2. Install `shakapacker`:
|
78
100
|
```bash
|
79
|
-
|
80
|
-
|
101
|
+
bundle add shakapacker --strict
|
102
|
+
rails shakapacker:install
|
81
103
|
```
|
82
104
|
|
83
|
-
|
105
|
+
3. Install `react` and some other required npm packages:
|
84
106
|
```bash
|
85
|
-
|
86
|
-
|
107
|
+
yarn add react react-dom @babel/preset-react prop-types \
|
108
|
+
css-loader style-loader mini-css-extract-plugin css-minimizer-webpack-plugin
|
87
109
|
```
|
88
110
|
|
89
111
|
Also update the Babel configuration in the `package.json` file:
|
@@ -98,7 +120,7 @@ Also update the Babel configuration in the `package.json` file:
|
|
98
120
|
},
|
99
121
|
```
|
100
122
|
|
101
|
-
|
123
|
+
4. Install `react-rails`:
|
102
124
|
```bash
|
103
125
|
$ bundle add 'react-rails' --strict
|
104
126
|
$ rails generate react:install
|
@@ -110,7 +132,7 @@ This gives you:
|
|
110
132
|
- [`ReactRailsUJS`](#ujs) setup in `app/javascript/packs/application.js`
|
111
133
|
- `app/javascript/packs/server_rendering.js` for [server-side rendering](#server-side-rendering)
|
112
134
|
|
113
|
-
|
135
|
+
5. Generate your first component:
|
114
136
|
```bash
|
115
137
|
$ rails g react:component HelloWorld greeting:string
|
116
138
|
```
|
@@ -130,24 +152,24 @@ Example:
|
|
130
152
|
<%= react_component("my_subdirectory/HelloWorld", { greeting: "Hello from react-rails." }) %>
|
131
153
|
```
|
132
154
|
|
133
|
-
|
155
|
+
6. [Render it in a Rails view](#view-helper):
|
134
156
|
|
135
157
|
```erb
|
136
158
|
<!-- erb: paste this in view -->
|
137
159
|
<%= react_component("HelloWorld", { greeting: "Hello from react-rails." }) %>
|
138
160
|
```
|
139
161
|
|
140
|
-
|
162
|
+
7. Lets Start the app:
|
141
163
|
```bash
|
142
164
|
$ rails s
|
143
165
|
```
|
144
166
|
Output: greeting: Hello from react-rails", inspect webpage in your browser to see the change in tag props.
|
145
167
|
|
146
|
-
|
168
|
+
8. Run dev server (optional)
|
147
169
|
In order to run dev server with HMR feature you need to parallely run:
|
148
170
|
|
149
171
|
```bash
|
150
|
-
$ ./bin/
|
172
|
+
$ ./bin/shakapacker-dev-server
|
151
173
|
```
|
152
174
|
|
153
175
|
Note: On Rails 6 you need to specify `webpack-dev-server` host. To this end, update `config/initializers/content_security_policy.rb` and uncomment relevant lines.
|
@@ -471,7 +493,7 @@ ReactRailsUJS.detectEvents()
|
|
471
493
|
|
472
494
|
For example, if `Turbolinks` is loaded _after_ `ReactRailsUJS`, you'll need to call this again. This function removes previous handlers before adding new ones, so it's safe to call as often as needed.
|
473
495
|
|
474
|
-
If `Turbolinks` is `import`ed via
|
496
|
+
If `Turbolinks` is `import`ed via Shakapacker (and thus not available globally), `ReactRailsUJS` will be unable to locate it. To fix this, you can temporarily add it to the global namespace:
|
475
497
|
|
476
498
|
```js
|
477
499
|
// Order is particular. First start Turbolinks:
|
@@ -525,6 +547,7 @@ Server rendering is powered by [`ExecJS`](https://github.com/rails/execjs) and s
|
|
525
547
|
|
526
548
|
- `react-rails` must load your code. By convention, it uses `server_rendering.js`, which was created
|
527
549
|
by the install task. This file must include your components _and_ their dependencies (eg, Underscore.js).
|
550
|
+
- Requires separate compilations for server & client bundles (see [Webpack config](https://github.com/reactjs/react-rails/tree/master/test/dummy/config/webpack))
|
528
551
|
- Your code can't reference `document` or `window`. Prerender processes don't have access to `document` or `window`,
|
529
552
|
so jQuery and some other libs won't work in this environment :(
|
530
553
|
|
@@ -629,7 +652,7 @@ Prerendering is set to `true` by default, but can be turned off with `prerender:
|
|
629
652
|
You can generate a new component file with:
|
630
653
|
|
631
654
|
```sh
|
632
|
-
rails g react:component ComponentName prop1:type prop2:type ...
|
655
|
+
rails g react:component ComponentName prop1:type prop2:type ... [options]
|
633
656
|
```
|
634
657
|
|
635
658
|
For example,
|
@@ -662,9 +685,38 @@ var Post = createReactClass({
|
|
662
685
|
|
663
686
|
The generator also accepts options:
|
664
687
|
|
665
|
-
- `--es6`:
|
688
|
+
- `--es6`: generates a function component
|
666
689
|
- `--coffee`: use CoffeeScript
|
667
690
|
|
691
|
+
For example,
|
692
|
+
|
693
|
+
```sh
|
694
|
+
rails g react:component ButtonComponent title:string --es6
|
695
|
+
```
|
696
|
+
|
697
|
+
would generate:
|
698
|
+
|
699
|
+
```jsx
|
700
|
+
import React from "react"
|
701
|
+
import PropTypes from "prop-types"
|
702
|
+
|
703
|
+
function ButtonComponent(props) {
|
704
|
+
return (
|
705
|
+
<React.Fragment>
|
706
|
+
Title: {this.props.title}
|
707
|
+
</React.Fragment>
|
708
|
+
);
|
709
|
+
}
|
710
|
+
|
711
|
+
ButtonComponent.propTypes = {
|
712
|
+
title: PropTypes.string
|
713
|
+
};
|
714
|
+
|
715
|
+
export default ButtonComponent
|
716
|
+
```
|
717
|
+
|
718
|
+
**Note:** In a Shakapacker project, es6 template is the default template in the generator.
|
719
|
+
|
668
720
|
Accepted PropTypes are:
|
669
721
|
|
670
722
|
- Plain types: `any`, `array`, `bool`, `element`, `func`, `number`, `object`, `node`, `shape`, `string`
|
@@ -726,6 +778,11 @@ For example, to change the [ES6 Component template](https://github.com/reactjs/r
|
|
726
778
|
|
727
779
|
## Upgrading
|
728
780
|
|
781
|
+
### 2.7 to 3.0
|
782
|
+
- Keep your `react_ujs` up to date: `yarn upgrade`
|
783
|
+
- **Drop support for Webpacker:** Before any ReactRails upgrade, make sure upgrading from Webpacker to Shakapacker 7. For more information check out Shakapacker
|
784
|
+
- **SSR:** ReactRails 3.x requires separate compilations for server & client bundles. See [Webpack config](https://github.com/reactjs/react-rails/tree/master/test/dummy/config/webpack) directory in the dummy app to addapt the new implementation.
|
785
|
+
|
729
786
|
### 2.3 to 2.4
|
730
787
|
|
731
788
|
Keep your `react_ujs` up to date, `yarn upgrade`
|
@@ -745,30 +802,22 @@ For the vast majority of cases this will get you most of the migration:
|
|
745
802
|
- re-run `bundle exec rails webpacker:install:react` to update npm packages (Webpacker only)
|
746
803
|
|
747
804
|
## Common Errors
|
748
|
-
###
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
Fix: Try updating yarn package.
|
763
|
-
```
|
764
|
-
sudo apt remove cmdtest
|
765
|
-
sudo apt remove yarn
|
766
|
-
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
767
|
-
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
768
|
-
sudo apt-get update && sudo apt-get install yarn
|
769
|
-
|
770
|
-
yarn install
|
805
|
+
### Getting warning for `Can't resolve 'react-dom/client'` in React < 18
|
806
|
+
|
807
|
+
You may see a warning like this when building a Webpack bundle using any version of React below 18. This warning can be safely [suppressed](https://webpack.js.org/configuration/other-options/#ignorewarnings) in your Webpack configuration. The following is an example of this suppression in `config/webpack/webpack.config.js`:
|
808
|
+
|
809
|
+
```diff
|
810
|
+
- const { webpackConfig } = require('shakapacker')
|
811
|
+
+ const { webpackConfig, merge } = require('shakapacker')
|
812
|
+
|
813
|
+
+const ignoreWarningsConfig = {
|
814
|
+
+ ignoreWarnings: [/Module not found: Error: Can't resolve 'react-dom\/client'/],
|
815
|
+
+};
|
816
|
+
|
817
|
+
- module.exports = webpackConfig
|
818
|
+
+ module.exports = merge({}, webpackConfig, ignoreWarningsConfig)
|
771
819
|
```
|
820
|
+
|
772
821
|
### Undefined Set
|
773
822
|
```
|
774
823
|
ExecJS::ProgramError (identifier 'Set' undefined):
|
@@ -784,9 +833,8 @@ TheRubyRacer [hasn't updated LibV8](https://github.com/cowboyd/therubyracer/blob
|
|
784
833
|
LibV8 itself is already [beyond version 7](https://github.com/cowboyd/libv8/releases/tag/v7.3.492.27.1) therefore many serverside issues are caused by old JS engines and fixed by using an up to date one such as [MiniRacer](https://github.com/discourse/mini_racer) or [TheRubyRhino](https://github.com/cowboyd/therubyrhino) on JRuby.
|
785
834
|
|
786
835
|
### HMR
|
787
|
-
Hot Module Replacement is [possible with this gem](https://stackoverflow.com/a/54846330/193785) as it does just pass through to Webpacker. Please open an issue to let us know tips and tricks for it to add to the wiki.
|
788
836
|
|
789
|
-
|
837
|
+
Check out [Enabling Hot Module Replacement (HMR)](https://github.com/shakacode/shakapacker/blob/master/docs/react.md#enabling-hot-module-replacement-hmr) in Shakapacker documentation.
|
790
838
|
|
791
839
|
One caveat is that currently you [cannot Server-Side Render along with HMR](https://github.com/reactjs/react-rails/issues/925#issuecomment-415469572).
|
792
840
|
|
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom"),require("react-dom/server")):"function"==typeof define&&define.amd?define(["react","react-dom","react-dom/server"],t):"object"==typeof exports?exports.ReactRailsUJS=t(require("react"),require("react-dom"),require("react-dom/server")):e.ReactRailsUJS=t(e.React,e.ReactDOM,e.ReactDOMServer)}(self,((__WEBPACK_EXTERNAL_MODULE__787__,__WEBPACK_EXTERNAL_MODULE__156__,__WEBPACK_EXTERNAL_MODULE__997__)=>(()=>{var __webpack_modules__={10:(e,t,n)=>{var o=n(787),r=n(156),a=n(997),u=n(230),c=n(121),d=n(831),i=n(37),
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom"),require("react-dom/server")):"function"==typeof define&&define.amd?define(["react","react-dom","react-dom/server"],t):"object"==typeof exports?exports.ReactRailsUJS=t(require("react"),require("react-dom"),require("react-dom/server")):e.ReactRailsUJS=t(e.React,e.ReactDOM,e.ReactDOMServer)}(self,((__WEBPACK_EXTERNAL_MODULE__787__,__WEBPACK_EXTERNAL_MODULE__156__,__WEBPACK_EXTERNAL_MODULE__997__)=>(()=>{var __webpack_modules__={634:(e,t,n)=>{"use strict";var o=n(156);t.createRoot=o.createRoot,t.hydrateRoot=o.hydrateRoot},10:(e,t,n)=>{var o=n(787),r=n(156),a=n(997),u=n(230),c=n(121),d=n(831),i=n(37),s=n(39),{supportsHydration:_,reactHydrate:l,createReactRootLike:p}=n(198),f=n(613),v={CLASS_NAME_ATTR:"data-react-class",PROPS_ATTR:"data-react-props",RENDER_ATTR:"data-hydrate",CACHE_ID_ATTR:"data-react-cache-id",TURBOLINKS_PERMANENT_ATTR:"data-turbolinks-permanent",jQuery:"undefined"!=typeof window&&void 0!==window.jQuery&&window.jQuery,components:{},roots:[],findDOMNodes:function(e){var t,n,o=v.CLASS_NAME_ATTR;switch(typeof e){case"undefined":t="["+o+"]",n=document;break;case"object":t="["+o+"]",n=e;break;case"string":t=e+"["+o+"], "+e+" ["+o+"]",n=document}return v.jQuery?v.jQuery(t,n):n.querySelectorAll(t)},getConstructor:c,constructorFromGlobal:c,constructorFromRequireContext:d,constructorFromRequireContextWithGlobalFallback:i,useContext:function(e){this.getConstructor=i(e)},useContexts:function(e){this.getConstructor=s(e)},serverRender:function(e,t,n){var r=this.getConstructor(t),u=o.createElement(r,n);return a[e](u)},mountComponents:function(e){for(var t=v,n=t.findDOMNodes(e),r=0;r<n.length;++r){var a=n[r],u=a.getAttribute(t.CLASS_NAME_ATTR),c=t.getConstructor(u),d=a.getAttribute(t.PROPS_ATTR),i=d&&JSON.parse(d),s=a.getAttribute(t.RENDER_ATTR),E=a.getAttribute(t.CACHE_ID_ATTR),h=a.hasAttribute(t.TURBOLINKS_PERMANENT_ATTR);if(!c){var m="Cannot find component: '"+u+"'";throw console&&console.log&&console.log("%c[react-rails] %c"+m+" for element","font-weight: bold","",a),new Error(m+". Make sure your component is available to render.")}var b=this.components[E];if(void 0===b&&(b=o.createElement(c,i),h&&(this.components[E]=b)),s&&_())b=l(a,b);else{const e=p(a);b=e.render(b),f&&this.roots.push({node:a,root:e})}}},unmountComponents:function(e){for(var t=v.findDOMNodes(e),n=0;n<t.length;++n){var o=t[n];f?this.unmountRoot(o):r.unmountComponentAtNode(o)}},detectEvents:function(){u(this)},unmountRoot:function(e){this.roots.filter((function(t){return t.node&&t.node===e})).forEach((function(e){e.root.unmount(),e.root=null,e.node=null}))},handleMount:function(e){var t=void 0;e&&e.target&&(t=e.target),v.mountComponents(t)},handleUnmount:function(e){e&&e.target&&e.target}};"undefined"!=typeof window&&v.detectEvents(),self.ReactRailsUJS=v,e.exports=v},230:(e,t,n)=>{var o=n(528),r=n(921),a=n(228),u=n(724),c=n(968);e.exports=function(e){e.handleEvent&&("undefined"!=typeof Turbolinks&&void 0!==Turbolinks.EVENTS&&c.teardown(e),a.teardown(e),u.teardown(e),r.teardown(e),o.teardown(e)),"addEventListener"in window?(e.handleEvent=function(e,t){document.addEventListener(e,t)},e.removeEvent=function(e,t){document.removeEventListener(e,t)}):(e.handleEvent=function(e,t){window.attachEvent(e,t)},e.removeEvent=function(e,t){window.detachEvent(e,t)}),"undefined"!=typeof Turbolinks&&Turbolinks.supported?void 0!==Turbolinks.EVENTS?c.setup(e):void 0!==Turbolinks.controller?a.setup(e):u.setup(e):"undefined"!=typeof $&&"function"==typeof $.pjax?r.setup(e):o.setup(e)}},528:e=>{e.exports={setup:function(e){"addEventListener"in window?e.handleEvent("DOMContentLoaded",e.handleMount):e.handleEvent("onload",e.handleMount)},teardown:function(e){e.removeEvent("DOMContentLoaded",e.handleMount),e.removeEvent("onload",e.handleMount)}}},921:e=>{e.exports={setup:function(e){e.handleEvent("ready",e.handleMount),e.handleEvent("pjax:end",e.handleMount),e.handleEvent("pjax:beforeReplace",e.handleUnmount)},teardown:function(e){e.removeEvent("ready",e.handleMount),e.removeEvent("pjax:end",e.handleMount),e.removeEvent("pjax:beforeReplace",e.handleUnmount)}}},228:e=>{e.exports={setup:function(e){e.handleEvent("turbolinks:load",e.handleMount)},teardown:function(e){e.removeEvent("turbolinks:load",e.handleMount)}}},968:e=>{e.exports={setup:function(e){e.handleEvent(Turbolinks.EVENTS.CHANGE,e.handleMount),e.handleEvent(Turbolinks.EVENTS.BEFORE_UNLOAD,e.handleUnmount)},teardown:function(e){e.removeEvent(Turbolinks.EVENTS.CHANGE,e.handleMount),e.removeEvent(Turbolinks.EVENTS.BEFORE_UNLOAD,e.handleUnmount)}}},724:e=>{e.exports={setup:function(e){Turbolinks.pagesCached(0),e.handleEvent("page:change",e.handleMount),e.handleEvent("page:receive",e.handleUnmount)},teardown:function(e){e.removeEvent("page:change",e.handleMount),e.removeEvent("page:receive",e.handleUnmount)}}},121:function(module){var topLevel="undefined"==typeof window?this:window;module.exports=function(className){var constructor;return constructor=topLevel[className],constructor||(constructor=eval(className)),constructor&&constructor.default&&(constructor=constructor.default),constructor}},831:e=>{e.exports=function(e){return function(t){var n=t.split("."),o=n.shift(),r=n,a=e("./"+o);return r.forEach((function(e){a=a[e]})),a.__esModule&&(a=a.default),a}}},37:(e,t,n)=>{var o=n(121),r=n(831);e.exports=function(e){var t=r(e);return function(e){var n;try{n=t(e)}catch(t){try{n=o(e)}catch(e){console.error(t),console.error(e)}}return n}}},39:(e,t,n)=>{var o=n(121),r=n(831);e.exports=function(e){var t=e.map((e=>r(e)));return function(e){var n;try{var r,a,u=0;do{r=t[u];try{n=r(e)}catch(e){a||(a=e)}u+=1}while(u<t.length);if(!n)throw a}catch(a){try{n=o(e)}catch(e){console.error(a),console.error(e)}}return n}}},198:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createReactRootLike:()=>_,reactHydrate:()=>s,supportsHydration:()=>i});var o=n(156),r=n.n(o),a=n(613),u=n.n(a);let c=r();if(u())try{c=n(634)}catch(e){c=r()}const d=c;function i(){return"function"==typeof d.hydrate||"function"==typeof d.hydrateRoot}function s(e,t){return"function"==typeof d.hydrateRoot?d.hydrateRoot(e,t):d.hydrate(t,e)}function _(e){return u()?d.createRoot(e):function(e){return{render:t=>d.render(t,e)}}(e)}},613:(e,t,n)=>{var o,r=n(156);o=void 0!==r&&(r.version.split(".")[0]||16)>=18,e.exports=o},787:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__787__},156:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__156__},997:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__997__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(10);return __webpack_exports__})()));
|