1
1
( function webpackUniversalModuleDefinition ( root , factory ) {
2
2
if ( typeof exports === 'object' && typeof module === 'object' )
3
- module . exports = factory ( require ( "react" ) , require ( "react-dom " ) , require ( "react-dom/server" ) ) ;
3
+ module . exports = factory ( require ( "react-dom " ) , require ( "react" ) , require ( "react-dom/server" ) ) ;
4
4
else if ( typeof define === 'function' && define . amd )
5
- define ( [ "react" , "react-dom " , "react-dom/server" ] , factory ) ;
5
+ define ( [ "react-dom " , "react" , "react-dom/server" ] , factory ) ;
6
6
else if ( typeof exports === 'object' )
7
- exports [ "ReactRailsUJS" ] = factory ( require ( "react" ) , require ( "react-dom " ) , require ( "react-dom/server" ) ) ;
7
+ exports [ "ReactRailsUJS" ] = factory ( require ( "react-dom " ) , require ( "react" ) , require ( "react-dom/server" ) ) ;
8
8
else
9
- root [ "ReactRailsUJS" ] = factory ( root [ "React " ] , root [ "ReactDOM " ] , root [ "ReactDOMServer" ] ) ;
10
- } ) ( this , function ( __WEBPACK_EXTERNAL_MODULE_3__ , __WEBPACK_EXTERNAL_MODULE_4__ , __WEBPACK_EXTERNAL_MODULE_5__ ) {
9
+ root [ "ReactRailsUJS" ] = factory ( root [ "ReactDOM " ] , root [ "React " ] , root [ "ReactDOMServer" ] ) ;
10
+ } ) ( this , function ( __WEBPACK_EXTERNAL_MODULE_1__ , __WEBPACK_EXTERNAL_MODULE_5__ , __WEBPACK_EXTERNAL_MODULE_6__ ) {
11
11
return /******/ ( function ( modules ) { // webpackBootstrap
12
12
/******/ // The module cache
13
13
/******/ var installedModules = { } ;
@@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap
73
73
/******/ __webpack_require__ . p = "" ;
74
74
/******/
75
75
/******/ // Load entry module and return exports
76
- /******/ return __webpack_require__ ( __webpack_require__ . s = 6 ) ;
76
+ /******/ return __webpack_require__ ( __webpack_require__ . s = 7 ) ;
77
77
/******/ } )
78
78
/************************************************************************/
79
79
/******/ ( [
@@ -106,13 +106,19 @@ module.exports = function(className) {
106
106
107
107
/***/ } ) ,
108
108
/* 1 */
109
+ /***/ ( function ( module , exports ) {
110
+
111
+ module . exports = __WEBPACK_EXTERNAL_MODULE_1__ ;
112
+
113
+ /***/ } ) ,
114
+ /* 2 */
109
115
/***/ ( function ( module , exports , __webpack_require__ ) {
110
116
111
- var nativeEvents = __webpack_require__ ( 7 )
112
- var pjaxEvents = __webpack_require__ ( 8 )
113
- var turbolinksEvents = __webpack_require__ ( 9 )
114
- var turbolinksClassicDeprecatedEvents = __webpack_require__ ( 11 )
115
- var turbolinksClassicEvents = __webpack_require__ ( 10 )
117
+ var nativeEvents = __webpack_require__ ( 8 )
118
+ var pjaxEvents = __webpack_require__ ( 9 )
119
+ var turbolinksEvents = __webpack_require__ ( 10 )
120
+ var turbolinksClassicDeprecatedEvents = __webpack_require__ ( 12 )
121
+ var turbolinksClassicEvents = __webpack_require__ ( 11 )
116
122
117
123
// see what things are globally available
118
124
// and setup event handlers to those things
@@ -164,14 +170,14 @@ module.exports = function(ujs) {
164
170
165
171
166
172
/***/ } ) ,
167
- /* 2 */
173
+ /* 3 */
168
174
/***/ ( function ( module , exports , __webpack_require__ ) {
169
175
170
176
// Make a function which:
171
177
// - First tries to require the name
172
178
// - Then falls back to global lookup
173
179
var fromGlobal = __webpack_require__ ( 0 )
174
- var fromRequireContext = __webpack_require__ ( 12 )
180
+ var fromRequireContext = __webpack_require__ ( 13 )
175
181
176
182
module . exports = function ( reqctx ) {
177
183
var fromCtx = fromRequireContext ( reqctx )
@@ -195,16 +201,41 @@ module.exports = function(reqctx) {
195
201
196
202
197
203
/***/ } ) ,
198
- /* 3 */
199
- /***/ ( function ( module , exports ) {
204
+ /* 4 */
205
+ /***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
200
206
201
- module . exports = __WEBPACK_EXTERNAL_MODULE_3__ ;
207
+ "use strict" ;
208
+ Object . defineProperty ( __webpack_exports__ , "__esModule" , { value : true } ) ;
209
+ /* harmony export (immutable) */ __webpack_exports__ [ "supportsHydration" ] = supportsHydration ;
210
+ /* harmony export (immutable) */ __webpack_exports__ [ "reactHydrate" ] = reactHydrate ;
211
+ /* harmony export (immutable) */ __webpack_exports__ [ "createReactRootLike" ] = createReactRootLike ;
212
+ const ReactDOM = __webpack_require__ ( 1 )
202
213
203
- /***/ } ) ,
204
- /* 4 */
205
- /***/ ( function ( module , exports ) {
214
+ function supportsHydration ( ) {
215
+ return typeof ReactDOM . hydrate === "function" || typeof ReactDOM . hydrateRoot === "function"
216
+ }
217
+
218
+ function reactHydrate ( node , component ) {
219
+ if ( typeof ReactDOM . hydrateRoot === "function" ) {
220
+ return ReactDOM . hydrateRoot ( node , component )
221
+ } else {
222
+ return ReactDOM . hydrate ( component , node )
223
+ }
224
+ }
225
+
226
+ function createReactRootLike ( node ) {
227
+ return ReactDOM . createRoot ? ReactDOM . createRoot ( node ) : legacyReactRootLike ( node )
228
+ }
229
+
230
+ function legacyReactRootLike ( node ) {
231
+ const root = {
232
+ render ( component ) {
233
+ return ReactDOM . render ( component , node )
234
+ }
235
+ }
236
+ return root
237
+ }
206
238
207
- module . exports = __WEBPACK_EXTERNAL_MODULE_4__ ;
208
239
209
240
/***/ } ) ,
210
241
/* 5 */
@@ -214,15 +245,22 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_5__;
214
245
215
246
/***/ } ) ,
216
247
/* 6 */
248
+ /***/ ( function ( module , exports ) {
249
+
250
+ module . exports = __WEBPACK_EXTERNAL_MODULE_6__ ;
251
+
252
+ /***/ } ) ,
253
+ /* 7 */
217
254
/***/ ( function ( module , exports , __webpack_require__ ) {
218
255
219
- var React = __webpack_require__ ( 3 )
220
- var ReactDOM = __webpack_require__ ( 4 )
221
- var ReactDOMServer = __webpack_require__ ( 5 )
256
+ var React = __webpack_require__ ( 5 )
257
+ var ReactDOM = __webpack_require__ ( 1 )
258
+ var ReactDOMServer = __webpack_require__ ( 6 )
222
259
223
- var detectEvents = __webpack_require__ ( 1 )
260
+ var detectEvents = __webpack_require__ ( 2 )
224
261
var constructorFromGlobal = __webpack_require__ ( 0 )
225
- var constructorFromRequireContextWithGlobalFallback = __webpack_require__ ( 2 )
262
+ var constructorFromRequireContextWithGlobalFallback = __webpack_require__ ( 3 )
263
+ const { supportsHydration, reactHydrate, createReactRootLike } = __webpack_require__ ( 4 )
226
264
227
265
var ReactRailsUJS = {
228
266
// This attribute holds the name of component which should be mounted
@@ -329,13 +367,14 @@ var ReactRailsUJS = {
329
367
}
330
368
}
331
369
332
- if ( hydrate && typeof ReactDOM . hydrate === "function" ) {
333
- component = ReactDOM . hydrate ( component , node ) ;
370
+ if ( hydrate && supportsHydration ( ) ) {
371
+ component = reactHydrate ( node , component ) ;
334
372
} else {
335
- component = ReactDOM . render ( component , node ) ;
373
+ const root = createReactRootLike ( node )
374
+ component = root . render ( component ) ;
336
375
}
337
376
}
338
- }
377
+ }
339
378
} ,
340
379
341
380
// Within `searchSelector`, find nodes which have React components
@@ -390,7 +429,7 @@ module.exports = ReactRailsUJS
390
429
391
430
392
431
/***/ } ) ,
393
- /* 7 */
432
+ /* 8 */
394
433
/***/ ( function ( module , exports ) {
395
434
396
435
module . exports = {
@@ -413,7 +452,7 @@ module.exports = {
413
452
414
453
415
454
/***/ } ) ,
416
- /* 8 */
455
+ /* 9 */
417
456
/***/ ( function ( module , exports ) {
418
457
419
458
module . exports = {
@@ -433,25 +472,23 @@ module.exports = {
433
472
434
473
435
474
/***/ } ) ,
436
- /* 9 */
475
+ /* 10 */
437
476
/***/ ( function ( module , exports ) {
438
477
439
478
module . exports = {
440
479
// Turbolinks 5+ got rid of named events (?!)
441
480
setup : function ( ujs ) {
442
481
ujs . handleEvent ( 'turbolinks:load' , ujs . handleMount ) ;
443
- ujs . handleEvent ( 'turbolinks:before-render' , ujs . handleUnmount ) ;
444
482
} ,
445
483
446
484
teardown : function ( ujs ) {
447
485
ujs . removeEvent ( 'turbolinks:load' , ujs . handleMount ) ;
448
- ujs . removeEvent ( 'turbolinks:before-render' , ujs . handleUnmount ) ;
449
486
} ,
450
487
}
451
488
452
489
453
490
/***/ } ) ,
454
- /* 10 */
491
+ /* 11 */
455
492
/***/ ( function ( module , exports ) {
456
493
457
494
module . exports = {
@@ -469,7 +506,7 @@ module.exports = {
469
506
470
507
471
508
/***/ } ) ,
472
- /* 11 */
509
+ /* 12 */
473
510
/***/ ( function ( module , exports ) {
474
511
475
512
module . exports = {
@@ -490,7 +527,7 @@ module.exports = {
490
527
491
528
492
529
/***/ } ) ,
493
- /* 12 */
530
+ /* 13 */
494
531
/***/ ( function ( module , exports ) {
495
532
496
533
// Load React components by requiring them from "components/", for example:
0 commit comments