Version Description
- October 28, 2021 = NEW: Pixabay! We've added support for Pixabay images. This requires a valid API key. NEW: Added button to auto-generate Photo attribution in image caption. NEW: Added uninstaller script to remove plugin settings. UPDATE: Updated styling and functionality of photo detail editor. UPDATE: Various UI/UX updates.
Download this release
Release Info
Developer | dcooney |
Plugin | Instant Images – One Click Unsplash Uploads |
Version | 4.5.0 |
Comparing to | |
See all releases |
Code changes from version 4.4.0.3 to 4.5.0
- README.txt +19 -8
- admin/admin.php +2 -2
- admin/assets/img/bolt.svg +1 -1
- admin/assets/js/admin.js +1 -2
- admin/includes/page-settings.php +72 -43
- admin/includes/settings.php +63 -5
- admin/views/{unsplash.php → app.php} +2 -2
- api/download.php +2 -2
- api/settings.php +76 -0
- api/test.php +1 -1
- dist/css/instant-images.css +838 -216
- dist/css/instant-images.min.css +1 -1
- dist/img/pixabay.png +0 -0
- dist/img/unsplash.png +0 -0
- dist/img/unsplash.svg +3 -0
- dist/js/instant-images-block.js +10295 -11647
README.txt
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
=== Instant Images - One Click Unsplash Uploads ===
|
2 |
Contributors: dcooney, connekthq
|
3 |
Donate link: https://connekthq.com/donate/
|
4 |
-
Tags: stock photo,
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.8
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
One click uploads of Unsplash photos directly to your WordPress media library.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
Instantly upload photos from Unsplash to your website without leaving WordPress!
|
16 |
|
17 |
-
**Instant Images** is the fastest and easiest way to upload high quality FREE photos from [unsplash.com](http://unsplash.com) directly to your media library.
|
18 |
|
19 |
[youtube https://www.youtube.com/watch?v=s6Q7Kfi2f1c]
|
20 |
|
@@ -34,7 +34,7 @@ The perfect tool for users who want to save time and frustration by uploading im
|
|
34 |
- **Edit Image Metadata** - Easily edit image filename, alt text and caption prior to uploading to your media library.
|
35 |
- **Accessibility** - Automatically include a relevant alt description for screen readers, visually reduced users, and SEO.
|
36 |
- **Easy to Use** - It couldn't get much more simple, just click an image and it's automatically uploaded to your media library for use on your site.
|
37 |
-
- **No Account Needed** - An Unsplash account is not required for use of this plugin. Just activate and you're ready to go.
|
38 |
|
39 |
---
|
40 |
|
@@ -60,7 +60,7 @@ Pull requests can be submitted via [GitHub](https://github.com/dcooney/instant-i
|
|
60 |
== Frequently Asked Questions ==
|
61 |
|
62 |
= Can I legally use these photos on my website? =
|
63 |
-
All photos published on Unsplash are licensed under Creative Commons Zero which means you can copy, modify, distribute and use the photos for free, including commercial purposes, without asking permission from or providing attribution to the photographer or Unsplash.
|
64 |
[Learn More](http://creativecommons.org/publicdomain/zero/1.0/)
|
65 |
|
66 |
= Can I search for individual photos by ID? =
|
@@ -84,9 +84,12 @@ Yes, this plugin is required to write temporary images into an `/instant-images`
|
|
84 |
|
85 |
Some hosts lock down their servers and you may be required to update your php.ini or .htaccess in order to use this plugin.
|
86 |
|
87 |
-
= Do I need an Unsplash
|
88 |
No, there is no need to sign up from an Unsplash account to access the photos server via Instant Images.
|
89 |
|
|
|
|
|
|
|
90 |
|
91 |
== Installation ==
|
92 |
|
@@ -125,6 +128,14 @@ How to install Instant Images.
|
|
125 |
|
126 |
== Changelog ==
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
= 4.4.0.3 - July 30, 2021 =
|
129 |
* Fix: WP 5.8 issue resolved - added fix for Instant Images causing the Widget Block Editor to fail due to JS error.
|
130 |
* Update: Code clean up.
|
1 |
+
=== Instant Images - One Click Unsplash and Pixabay Uploads ===
|
2 |
Contributors: dcooney, connekthq
|
3 |
Donate link: https://connekthq.com/donate/
|
4 |
+
Tags: unsplash, pixabay, stock photo, prototyping, photos, media library, image upload, upload, free photos
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.8
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
One click uploads of Unsplash and Pixabay photos directly to your WordPress media library.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
Instantly upload photos from Unsplash or Pixabay to your website without leaving WordPress!
|
16 |
|
17 |
+
**Instant Images** is the fastest and easiest way to upload high quality FREE photos from [unsplash.com](http://unsplash.com) and [Pixabay](http://pixabay.com) directly to your media library.
|
18 |
|
19 |
[youtube https://www.youtube.com/watch?v=s6Q7Kfi2f1c]
|
20 |
|
34 |
- **Edit Image Metadata** - Easily edit image filename, alt text and caption prior to uploading to your media library.
|
35 |
- **Accessibility** - Automatically include a relevant alt description for screen readers, visually reduced users, and SEO.
|
36 |
- **Easy to Use** - It couldn't get much more simple, just click an image and it's automatically uploaded to your media library for use on your site.
|
37 |
+
- **No Unsplash Account Needed** - An Unsplash account is not required for use of this plugin. Just activate and you're ready to go.
|
38 |
|
39 |
---
|
40 |
|
60 |
== Frequently Asked Questions ==
|
61 |
|
62 |
= Can I legally use these photos on my website? =
|
63 |
+
All photos published on Unsplash are licensed under Creative Commons Zero which means you can copy, modify, distribute and use the photos for free, including commercial purposes, without asking permission from or providing attribution to the photographer or Unsplash/Pixabay.
|
64 |
[Learn More](http://creativecommons.org/publicdomain/zero/1.0/)
|
65 |
|
66 |
= Can I search for individual photos by ID? =
|
84 |
|
85 |
Some hosts lock down their servers and you may be required to update your php.ini or .htaccess in order to use this plugin.
|
86 |
|
87 |
+
= Do I need an account at Unsplash? =
|
88 |
No, there is no need to sign up from an Unsplash account to access the photos server via Instant Images.
|
89 |
|
90 |
+
= Do I need an account at Pixabay? =
|
91 |
+
Yes, Pixabay access requires an API key. You can get this by signing up for a free account at [Pixabay](https://pixabay.com/).
|
92 |
+
|
93 |
|
94 |
== Installation ==
|
95 |
|
128 |
|
129 |
== Changelog ==
|
130 |
|
131 |
+
= 4.5.0 - October 28, 2021 =
|
132 |
+
NEW: 🎉 Pixabay! We've added support for [Pixabay](https://pixabay.com) images. This requires a valid API key.
|
133 |
+
NEW: Added button to auto-generate Photo attribution in image caption.
|
134 |
+
NEW: Added uninstaller script to remove plugin settings.
|
135 |
+
UPDATE: Updated styling and functionality of photo detail editor.
|
136 |
+
UPDATE: Various UI/UX updates.
|
137 |
+
|
138 |
+
|
139 |
= 4.4.0.3 - July 30, 2021 =
|
140 |
* Fix: WP 5.8 issue resolved - added fix for Instant Images causing the Widget Block Editor to fail due to JS error.
|
141 |
* Update: Code clean up.
|
admin/admin.php
CHANGED
@@ -37,7 +37,7 @@ add_action( 'admin_menu', 'instant_images_create_page' );
|
|
37 |
function instant_images_settings_page() {
|
38 |
$show_settings = true;
|
39 |
echo '<div class="instant-img-container" data-media-popup="false">';
|
40 |
-
include INSTANT_IMAGES_PATH . 'admin/views/
|
41 |
echo '</div>';
|
42 |
}
|
43 |
|
@@ -139,7 +139,7 @@ function instant_images_media_tab() {
|
|
139 |
$show_settings = false;
|
140 |
?>
|
141 |
<div class="instant-img-container editor" data-media-popup="true">
|
142 |
-
<?php include INSTANT_IMAGES_PATH . 'admin/views/
|
143 |
</div>
|
144 |
<?php
|
145 |
}
|
37 |
function instant_images_settings_page() {
|
38 |
$show_settings = true;
|
39 |
echo '<div class="instant-img-container" data-media-popup="false">';
|
40 |
+
include INSTANT_IMAGES_PATH . 'admin/views/app.php';
|
41 |
echo '</div>';
|
42 |
}
|
43 |
|
139 |
$show_settings = false;
|
140 |
?>
|
141 |
<div class="instant-img-container editor" data-media-popup="true">
|
142 |
+
<?php include INSTANT_IMAGES_PATH . 'admin/views/app.php'; ?>
|
143 |
</div>
|
144 |
<?php
|
145 |
}
|
admin/assets/img/bolt.svg
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 58"><title>
|
1 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 58"><title>Lightning Bolt</title><polygon points="20 0 20 23 31 23 11 58 11 34 0 34 20 0" fill="#4a7bc5"/></svg>
|
admin/assets/js/admin.js
CHANGED
@@ -3,7 +3,6 @@ var instant_images = instant_images || {};
|
|
3 |
jQuery(document).ready(function ($) {
|
4 |
"use strict";
|
5 |
|
6 |
-
var init = true;
|
7 |
var speed = 350;
|
8 |
|
9 |
// Media Uploader
|
@@ -89,7 +88,7 @@ jQuery(document).ready(function ($) {
|
|
89 |
$(this).ajaxSubmit({
|
90 |
success: function () {
|
91 |
$(".save-settings .loading").fadeOut(speed, function () {
|
92 |
-
|
93 |
});
|
94 |
},
|
95 |
error: function () {
|
3 |
jQuery(document).ready(function ($) {
|
4 |
"use strict";
|
5 |
|
|
|
6 |
var speed = 350;
|
7 |
|
8 |
// Media Uploader
|
88 |
$(this).ajaxSubmit({
|
89 |
success: function () {
|
90 |
$(".save-settings .loading").fadeOut(speed, function () {
|
91 |
+
window.location.reload();
|
92 |
});
|
93 |
},
|
94 |
error: function () {
|
admin/includes/page-settings.php
CHANGED
@@ -8,49 +8,81 @@
|
|
8 |
?>
|
9 |
<section class="instant-images-settings">
|
10 |
<div class="cnkt-sidebar">
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
<li
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
</ul>
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<?php
|
45 |
$instant_images_plugin_array = array(
|
46 |
array(
|
47 |
'slug' => 'ajax-load-more',
|
48 |
),
|
49 |
array(
|
50 |
-
'slug' => '
|
51 |
),
|
52 |
array(
|
53 |
-
'slug' => '
|
54 |
),
|
55 |
array(
|
56 |
'slug' => 'velocity',
|
@@ -59,16 +91,13 @@
|
|
59 |
?>
|
60 |
<section class="cta ii-plugins">
|
61 |
<h2><?php esc_attr_e( 'Our Plugins', 'instant-images' ); ?></h2>
|
62 |
-
<p
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
?>
|
69 |
-
</div>
|
70 |
</section>
|
71 |
|
72 |
</div>
|
73 |
-
|
74 |
</section>
|
8 |
?>
|
9 |
<section class="instant-images-settings">
|
10 |
<div class="cnkt-sidebar">
|
11 |
+
<section class="cta ii-whats-new">
|
12 |
+
<h2><?php esc_attr_e( 'What\'s New', 'instant-images' ); ?></h2>
|
13 |
+
<p><?php esc_attr_e( 'The latest Instant Images updates.', 'instant-images' ); ?></p>
|
14 |
+
<ul>
|
15 |
+
<li>
|
16 |
+
<p>
|
17 |
+
<strong>Pixabay</strong>
|
18 |
+
We've added support for the <a href="https://pixabay.com/" target="_blank">Pixabay</a> API. This requires your own API key.
|
19 |
+
</p>
|
20 |
+
</li>
|
21 |
+
<li>
|
22 |
+
<p>
|
23 |
+
<strong>Improved Download Speeds</strong>
|
24 |
+
Instant Images is now up to 4x faster than previous versions after a critical update in the initial image fetching process.
|
25 |
+
</p>
|
26 |
+
</li>
|
27 |
+
<li>
|
28 |
+
<p>
|
29 |
+
<strong>Media Modals</strong>
|
30 |
+
Instant Images tab added to all WordPress Media Modals allowing access to Instant Images for anywhere media can be insterted.
|
31 |
+
</p>
|
32 |
+
</li>
|
33 |
+
<li>
|
34 |
+
<p>
|
35 |
+
<strong>Gutenberg Support</strong>
|
36 |
+
Instant Images now integrates directly into Gutenberg as a plugin sidebar.
|
37 |
+
</p>
|
38 |
+
</li>
|
39 |
+
<li>
|
40 |
+
<p>
|
41 |
+
<strong>User Roles</strong>
|
42 |
+
Added the <code>instant_images_user_role</code> filter hook to allow for complete control over user capabilities.
|
43 |
+
</p>
|
44 |
+
</li>
|
45 |
+
<li>
|
46 |
+
<p>
|
47 |
+
<strong>Image ID Search</strong>
|
48 |
+
Added support for searching individual photos by image ID - searching <code>id:{photo_id}</code> will return a single result.<br/><br/>e.g. <code>id:YiUi00uqKk8</code>
|
49 |
+
</p>
|
50 |
+
</li>
|
51 |
</ul>
|
52 |
+
<section class="with-love">
|
53 |
+
<p><strong>Instant Images</strong> is made with <span style="color: #e25555;">♥</span> by <a target="blank" href="https://connekthq.com/?utm_source=WPAdmin&utm_medium=InstantImages&utm_campaign=OurPlugins">Connekt</a></p>
|
54 |
+
</section>
|
55 |
+
</section>
|
56 |
+
<section class="cta ii-settings">
|
57 |
+
<h2><?php esc_attr_e( 'Global Settings', 'instant-images' ); ?></h2>
|
58 |
+
<p><?php esc_attr_e( 'Manage your media upload settings.', 'instant-images' ); ?></p>
|
59 |
+
<div class="cta-wrap">
|
60 |
+
<form action="options.php" method="post" id="unsplash-form-options">
|
61 |
+
<?php
|
62 |
+
settings_fields( 'instant-img-setting-group' );
|
63 |
+
do_settings_sections( 'instant-images' );
|
64 |
+
// @codingStandardsIgnoreStart
|
65 |
+
$options = get_option( 'instant_img_settings' ); // Get the older values, wont work the first time.
|
66 |
+
// @codingStandardsIgnoreEnd
|
67 |
+
?>
|
68 |
+
<div class="save-settings">
|
69 |
+
<?php submit_button( __( 'Save Settings', 'instant-images' ) ); ?>
|
70 |
+
<div class="loading"></div>
|
71 |
+
<div class="clear"></div>
|
72 |
+
</div>
|
73 |
+
</form>
|
74 |
+
</div>
|
75 |
+
</section>
|
76 |
<?php
|
77 |
$instant_images_plugin_array = array(
|
78 |
array(
|
79 |
'slug' => 'ajax-load-more',
|
80 |
),
|
81 |
array(
|
82 |
+
'slug' => 'block-manager',
|
83 |
),
|
84 |
array(
|
85 |
+
'slug' => 'easy-query',
|
86 |
),
|
87 |
array(
|
88 |
'slug' => 'velocity',
|
91 |
?>
|
92 |
<section class="cta ii-plugins">
|
93 |
<h2><?php esc_attr_e( 'Our Plugins', 'instant-images' ); ?></h2>
|
94 |
+
<p><?php esc_attr_e( 'Check out some of our other WordPress plugins.', 'instant-images' ); ?></p>
|
95 |
+
<?php
|
96 |
+
if ( class_exists( 'Connekt_Plugin_Installer' ) ) {
|
97 |
+
Connekt_Plugin_Installer::init( $instant_images_plugin_array );
|
98 |
+
}
|
99 |
+
?>
|
|
|
|
|
100 |
</section>
|
101 |
|
102 |
</div>
|
|
|
103 |
</section>
|
admin/includes/settings.php
CHANGED
@@ -47,6 +47,24 @@ function instant_images_admin_init() {
|
|
47 |
'unsplash_general_settings'
|
48 |
);
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
// Button Display.
|
51 |
add_settings_field(
|
52 |
'media_modal_display',
|
@@ -140,16 +158,56 @@ function instant_images_tab_display_callback() {
|
|
140 |
$options['media_modal_display'] = '0';
|
141 |
}
|
142 |
|
143 |
-
$style = 'style="position: absolute; left: 0; top: 9px;"';
|
144 |
-
|
145 |
$html = '<label style="cursor: default;"><strong>' . esc_attr__( 'Media Modal:', 'instant-images' ) . '</strong></label>';
|
146 |
-
$html .= '<label for="media_modal_display"
|
147 |
$html .= '<input type="hidden" name="instant_img_settings[media_modal_display]" value="0" />';
|
148 |
-
$html .= '<input
|
149 |
-
$html .= __( 'Hide
|
150 |
$html .= '</label>';
|
151 |
|
152 |
// @codingStandardsIgnoreStart
|
153 |
echo $html;
|
154 |
// @codingStandardsIgnoreEnd
|
155 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
'unsplash_general_settings'
|
48 |
);
|
49 |
|
50 |
+
// Default Provider.
|
51 |
+
add_settings_field(
|
52 |
+
'default_provider',
|
53 |
+
__( 'Default Image Provider', 'instant-images' ),
|
54 |
+
'instant_images_default_provider',
|
55 |
+
'instant-images',
|
56 |
+
'unsplash_general_settings'
|
57 |
+
);
|
58 |
+
|
59 |
+
// Pixabay API Key.
|
60 |
+
add_settings_field(
|
61 |
+
'pixabay_api',
|
62 |
+
__( 'Pixabay API Key', 'instant-images' ),
|
63 |
+
'instant_images_pixabay_api_callback',
|
64 |
+
'instant-images',
|
65 |
+
'unsplash_general_settings'
|
66 |
+
);
|
67 |
+
|
68 |
// Button Display.
|
69 |
add_settings_field(
|
70 |
'media_modal_display',
|
158 |
$options['media_modal_display'] = '0';
|
159 |
}
|
160 |
|
|
|
|
|
161 |
$html = '<label style="cursor: default;"><strong>' . esc_attr__( 'Media Modal:', 'instant-images' ) . '</strong></label>';
|
162 |
+
$html .= '<label for="media_modal_display">';
|
163 |
$html .= '<input type="hidden" name="instant_img_settings[media_modal_display]" value="0" />';
|
164 |
+
$html .= '<input type="checkbox" name="instant_img_settings[media_modal_display]" id="media_modal_display" value="1"' . ( $options['media_modal_display'] ? ' checked="checked"' : '' ) . ' />';
|
165 |
+
$html .= __( 'Hide Instant Images tab in Media Modal windows.', 'instant-images' );
|
166 |
$html .= '</label>';
|
167 |
|
168 |
// @codingStandardsIgnoreStart
|
169 |
echo $html;
|
170 |
// @codingStandardsIgnoreEnd
|
171 |
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Set the default image provider.
|
175 |
+
*
|
176 |
+
* @author ConnektMedia <support@connekthq.com>
|
177 |
+
* @since 4.5
|
178 |
+
*/
|
179 |
+
function instant_images_default_provider() {
|
180 |
+
$options = get_option( 'instant_img_settings' );
|
181 |
+
if ( ! isset( $options['default_provider'] ) ) {
|
182 |
+
$options['default_provider'] = 'unsplash';
|
183 |
+
}
|
184 |
+
?>
|
185 |
+
<label for="default_provider" style="cursor: default; margin-bottom: 3px;">
|
186 |
+
<strong><?php esc_attr_e( 'Default Provider:', 'instant-images' ); ?></strong>
|
187 |
+
</label>
|
188 |
+
<select id="default_provider" name="instant_img_settings[default_provider]">
|
189 |
+
<option value="unsplash" <?php selected( 'unsplash', $options['default_provider'] ); ?>><?php esc_attr_e( 'Unsplash', 'instant-images' ); ?></option>
|
190 |
+
<option value="pixabay" <?php selected( 'pixabay', $options['default_provider'] ); ?>><?php esc_attr_e( 'Pixabay', 'instant-images' ); ?> (<?php esc_attr_e( 'Requires API Key', 'instant-images' ); ?>)</option>
|
191 |
+
</select>
|
192 |
+
<?php
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Set the Pizabay API key.
|
197 |
+
*
|
198 |
+
* @author ConnektMedia <support@connekthq.com>
|
199 |
+
* @since 4.5
|
200 |
+
*/
|
201 |
+
function instant_images_pixabay_api_callback() {
|
202 |
+
$options = get_option( 'instant_img_settings' );
|
203 |
+
if ( ! isset( $options['pixabay_api'] ) ) {
|
204 |
+
$options['pixabay_api'] = '';
|
205 |
+
}
|
206 |
+
?>
|
207 |
+
<label for="pixabay_api" style="cursor: default; margin-bottom: 3px;">
|
208 |
+
<strong><?php esc_attr_e( 'Pixabay API Key:', 'instant-images' ); ?></strong>
|
209 |
+
</label>
|
210 |
+
<input type="text" id="pixabay_api" name="instant_img_settings[pixabay_api]" value="<?php echo wp_kses_post( $options['pixabay_api'] ); ?>" >
|
211 |
+
<span class="desc">→ <a href="https://pixabay.com/" target="_blank"><?php esc_attr_e( 'Get API Key', 'instant-images' ); ?></a></span>
|
212 |
+
<?php
|
213 |
+
}
|
admin/views/{unsplash.php → app.php}
RENAMED
@@ -17,9 +17,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
17 |
<span>
|
18 |
<?php
|
19 |
// translators: Instant Images tagline.
|
20 |
-
$instant_images_tagline = __( 'One click photo uploads from %s', 'instant-images' );
|
21 |
// @codingStandardsIgnoreStart
|
22 |
-
echo sprintf( $instant_images_tagline, '<a href="https://unsplash.com/" target="_blank">
|
23 |
// @codingStandardsIgnoreEnd
|
24 |
?>
|
25 |
</h1>
|
17 |
<span>
|
18 |
<?php
|
19 |
// translators: Instant Images tagline.
|
20 |
+
$instant_images_tagline = __( 'One click photo uploads from %1$s and %2$s.', 'instant-images' );
|
21 |
// @codingStandardsIgnoreStart
|
22 |
+
echo sprintf( $instant_images_tagline, '<a href="https://unsplash.com/" target="_blank">Unsplash</a>', '<a href="https://pixabay.com/" target="_blank">Pixabay</a>' );
|
23 |
// @codingStandardsIgnoreEnd
|
24 |
?>
|
25 |
</h1>
|
api/download.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Custom
|
4 |
*
|
5 |
* @since 3.0
|
6 |
* @author dcooney
|
@@ -69,7 +69,7 @@ function instant_images_download( WP_REST_Request $request ) {
|
|
69 |
$filename = sanitize_text_field( $data['filename'] ); // The filename.
|
70 |
$title = sanitize_text_field( $data['title'] ); // Title.
|
71 |
$alt = sanitize_text_field( $data['alt'] ); // Alt text.
|
72 |
-
$caption =
|
73 |
$cfilename = sanitize_title( $data['custom_filename'] ); // Custom filename.
|
74 |
$parent_id = ( $data['parent_id'] ) ? sanitize_title( $data['parent_id'] ) : 0; // Parent post ID.
|
75 |
$name = ( ! empty( $cfilename ) ) ? $cfilename . '.jpg' : $filename; // Actual filename.
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Custom /ownload API route for download and adding images to media library.
|
4 |
*
|
5 |
* @since 3.0
|
6 |
* @author dcooney
|
69 |
$filename = sanitize_text_field( $data['filename'] ); // The filename.
|
70 |
$title = sanitize_text_field( $data['title'] ); // Title.
|
71 |
$alt = sanitize_text_field( $data['alt'] ); // Alt text.
|
72 |
+
$caption = wp_kses_post( $data['caption'] ); // Caption text.
|
73 |
$cfilename = sanitize_title( $data['custom_filename'] ); // Custom filename.
|
74 |
$parent_id = ( $data['parent_id'] ) ? sanitize_title( $data['parent_id'] ) : 0; // Parent post ID.
|
75 |
$name = ( ! empty( $cfilename ) ) ? $cfilename . '.jpg' : $filename; // Actual filename.
|
api/settings.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom /settings route to update plugin settings.
|
4 |
+
*
|
5 |
+
* @since 4.5
|
6 |
+
* @author dcooney
|
7 |
+
* @package InstantImages
|
8 |
+
*/
|
9 |
+
|
10 |
+
add_action(
|
11 |
+
'rest_api_init',
|
12 |
+
function () {
|
13 |
+
$my_namespace = 'instant-images';
|
14 |
+
$my_endpoint = '/settings';
|
15 |
+
register_rest_route(
|
16 |
+
$my_namespace,
|
17 |
+
$my_endpoint,
|
18 |
+
array(
|
19 |
+
'methods' => 'POST',
|
20 |
+
'callback' => 'instant_images_settings',
|
21 |
+
'permission_callback' => function () {
|
22 |
+
return InstantImages::instant_img_has_access();
|
23 |
+
},
|
24 |
+
)
|
25 |
+
);
|
26 |
+
}
|
27 |
+
);
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Save plugin settings.
|
31 |
+
*
|
32 |
+
* @param WP_REST_Request $request API request.
|
33 |
+
* @since 4.5
|
34 |
+
* @author dcooney
|
35 |
+
* @package InstantImages
|
36 |
+
*/
|
37 |
+
function instant_images_settings( WP_REST_Request $request ) {
|
38 |
+
|
39 |
+
if ( InstantImages::instant_img_has_access() ) {
|
40 |
+
|
41 |
+
// Get JSON Data.
|
42 |
+
$data = json_decode( $request->get_body(), true ); // Get contents of request body.
|
43 |
+
|
44 |
+
if ( $data ) {
|
45 |
+
|
46 |
+
$option = 'instant_img_settings';
|
47 |
+
|
48 |
+
// Global settings.
|
49 |
+
$options = get_option( $option );
|
50 |
+
$setting = sanitize_text_field( $data['setting'] ); // The setting to update.
|
51 |
+
$value = sanitize_text_field( $data['value'] ); // The value to update.
|
52 |
+
|
53 |
+
if ( $setting ) {
|
54 |
+
$options[ $setting ] = $value;
|
55 |
+
update_option( $option, $options );
|
56 |
+
|
57 |
+
// Success.
|
58 |
+
$response = array(
|
59 |
+
'success' => true,
|
60 |
+
'msg' => 'Settings saved.',
|
61 |
+
);
|
62 |
+
} else {
|
63 |
+
// Error.
|
64 |
+
$response = array(
|
65 |
+
'success' => false,
|
66 |
+
'msg' => 'Unable to save settings.',
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
// Send response as JSON.
|
71 |
+
wp_send_json( $response );
|
72 |
+
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
api/test.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Custom /
|
4 |
*
|
5 |
* @since 3.0
|
6 |
* @author dcooney
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Custom /test route to text REST API access.
|
4 |
*
|
5 |
* @since 3.0
|
6 |
* @author dcooney
|
dist/css/instant-images.css
CHANGED
@@ -38,6 +38,10 @@ body.media_page_instant-images #wpfooter p {
|
|
38 |
}
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
41 |
.instant-img-container {
|
42 |
font-size: 14px;
|
43 |
color: #666;
|
@@ -65,7 +69,7 @@ body.media_page_instant-images #wpfooter p {
|
|
65 |
}
|
66 |
|
67 |
.instant-img-container a {
|
68 |
-
color: #
|
69 |
-webkit-transition: all 0.25s ease;
|
70 |
-o-transition: all 0.25s ease;
|
71 |
transition: all 0.25s ease;
|
@@ -97,22 +101,19 @@ body.media_page_instant-images #wpfooter p {
|
|
97 |
}
|
98 |
|
99 |
.instant-img-container .error-messaging {
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
.instant-img-container .error-messaging.active {
|
104 |
-
padding: 17px 17px 17px 57px;
|
105 |
-webkit-border-radius: 3px;
|
106 |
border-radius: 3px;
|
107 |
-
background: #
|
108 |
color: #fff;
|
109 |
font-size: 13px;
|
|
|
110 |
margin-bottom: 25px;
|
111 |
display: block;
|
112 |
position: relative;
|
113 |
}
|
114 |
|
115 |
-
.instant-img-container .error-messaging
|
116 |
font-family: "FontAwesome";
|
117 |
content: "\F06A";
|
118 |
display: block;
|
@@ -122,7 +123,7 @@ body.media_page_instant-images #wpfooter p {
|
|
122 |
-ms-transform: translateY(-50%);
|
123 |
transform: translateY(-50%);
|
124 |
position: absolute;
|
125 |
-
font-size:
|
126 |
opacity: 0.75;
|
127 |
}
|
128 |
|
@@ -179,7 +180,7 @@ body.media_page_instant-images #wpfooter p {
|
|
179 |
.instant-img-container .header-wrap h1 span {
|
180 |
display: block;
|
181 |
padding: 3px 0 0;
|
182 |
-
color: #
|
183 |
font-size: 15px;
|
184 |
font-weight: 400;
|
185 |
}
|
@@ -278,9 +279,6 @@ body.media_page_instant-images #wpfooter p {
|
|
278 |
cursor: default;
|
279 |
}
|
280 |
|
281 |
-
/*
|
282 |
-
Columns
|
283 |
-
*/
|
284 |
.instant-img-container .cnkt-main {
|
285 |
width: 100%;
|
286 |
float: none;
|
@@ -294,9 +292,6 @@ body.media_page_instant-images #wpfooter p {
|
|
294 |
margin-top: 0;
|
295 |
}
|
296 |
|
297 |
-
/*
|
298 |
-
* Settings
|
299 |
-
*/
|
300 |
.instant-img-container .save-settings p.submit {
|
301 |
float: left;
|
302 |
margin: 0 2px 0 0;
|
@@ -311,9 +306,6 @@ body.media_page_instant-images #wpfooter p {
|
|
311 |
background: #fff url(../img/ajax-loader.gif) no-repeat center center;
|
312 |
}
|
313 |
|
314 |
-
/*
|
315 |
-
* Thickbox styles
|
316 |
-
*/
|
317 |
#TB_ajaxContent {
|
318 |
clear: both;
|
319 |
line-height: 1.4em;
|
@@ -325,10 +317,11 @@ body.media_page_instant-images #wpfooter p {
|
|
325 |
padding: 15px !important;
|
326 |
}
|
327 |
|
328 |
-
/* Table */
|
329 |
.cnkt-sidebar .form-table {
|
330 |
margin: 0;
|
331 |
border: none;
|
|
|
|
|
332 |
}
|
333 |
|
334 |
.cnkt-sidebar .form-table td,
|
@@ -338,6 +331,7 @@ body.media_page_instant-images #wpfooter p {
|
|
338 |
}
|
339 |
|
340 |
.cnkt-sidebar .form-table label {
|
|
|
341 |
display: block;
|
342 |
clear: both;
|
343 |
float: none;
|
@@ -355,16 +349,12 @@ body.media_page_instant-images #wpfooter p {
|
|
355 |
|
356 |
.instant-img-container .form-table td {
|
357 |
border-top: 0;
|
358 |
-
padding: 0 0
|
359 |
float: left;
|
360 |
width: 100%;
|
361 |
margin: 0;
|
362 |
}
|
363 |
|
364 |
-
.instant-img-container .form-table tr:first-of-type td {
|
365 |
-
padding: 10px 0;
|
366 |
-
}
|
367 |
-
|
368 |
.cnkt-sidebar .form-table .form-msg,
|
369 |
.cnkt-main .form-msg {
|
370 |
display: block;
|
@@ -415,8 +405,12 @@ body.media_page_instant-images #wpfooter p {
|
|
415 |
box-shadow: none;
|
416 |
}
|
417 |
|
|
|
|
|
|
|
|
|
418 |
.instant-img-container label {
|
419 |
-
padding: 5px
|
420 |
}
|
421 |
|
422 |
#unsplash-form-options h2,
|
@@ -429,7 +423,6 @@ body.media_page_instant-images #wpfooter p {
|
|
429 |
.instant-img-container textarea {
|
430 |
padding: 10px;
|
431 |
line-height: 1;
|
432 |
-
border: 1px solid #ccc;
|
433 |
background: #f7f7f7;
|
434 |
width: 100%;
|
435 |
-webkit-border-radius: 2px;
|
@@ -445,7 +438,6 @@ body.media_page_instant-images #wpfooter p {
|
|
445 |
background: #efefef;
|
446 |
}
|
447 |
|
448 |
-
/* Helpers */
|
449 |
.instant-img-container .spacer {
|
450 |
display: block;
|
451 |
height: 40px;
|
@@ -464,12 +456,28 @@ body.media_page_instant-images #wpfooter p {
|
|
464 |
}
|
465 |
|
466 |
.instant-img-container .control-nav {
|
467 |
-
display:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
margin: 0;
|
469 |
padding: 25px 0;
|
470 |
list-style: none;
|
471 |
}
|
472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
.instant-img-container .control-nav:after {
|
474 |
content: "";
|
475 |
display: table;
|
@@ -487,8 +495,8 @@ body.media_page_instant-images #wpfooter p {
|
|
487 |
|
488 |
.instant-img-container .control-nav li button {
|
489 |
padding: 0 24px 0 2px;
|
490 |
-
height:
|
491 |
-
line-height:
|
492 |
display: block;
|
493 |
color: #999;
|
494 |
text-decoration: none;
|
@@ -534,7 +542,6 @@ body.media_page_instant-images #wpfooter p {
|
|
534 |
|
535 |
@media screen and (max-width: 600px) {
|
536 |
.instant-img-container .control-nav li {
|
537 |
-
width: 33.333%;
|
538 |
text-align: center;
|
539 |
margin: 0;
|
540 |
padding-bottom: 15px;
|
@@ -542,9 +549,9 @@ body.media_page_instant-images #wpfooter p {
|
|
542 |
}
|
543 |
|
544 |
.instant-img-container .control-nav li.search-field {
|
545 |
-
|
546 |
-
width: 49%;
|
547 |
margin: 0;
|
|
|
548 |
max-width: 500px;
|
549 |
}
|
550 |
|
@@ -553,7 +560,7 @@ body.media_page_instant-images #wpfooter p {
|
|
553 |
width: 100%;
|
554 |
display: block;
|
555 |
position: static;
|
556 |
-
padding-bottom:
|
557 |
text-align: left;
|
558 |
max-width: 100%;
|
559 |
}
|
@@ -562,45 +569,60 @@ body.media_page_instant-images #wpfooter p {
|
|
562 |
.instant-img-container .control-nav li.search-field .searchResults {
|
563 |
position: absolute;
|
564 |
right: 100.5%;
|
565 |
-
top:
|
566 |
width: auto;
|
567 |
height: 34px;
|
568 |
line-height: 34px;
|
569 |
-
padding: 0
|
570 |
-
background: #
|
571 |
-
border: 1px solid #
|
572 |
-webkit-border-radius: 3px;
|
573 |
border-radius: 3px;
|
574 |
z-index: 99;
|
575 |
font-size: 13px;
|
576 |
-
font-weight:
|
577 |
-webkit-transition: all 0.25s ease;
|
578 |
-o-transition: all 0.25s ease;
|
579 |
transition: all 0.25s ease;
|
580 |
-
color: #
|
581 |
-
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
|
582 |
-webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
|
583 |
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
}
|
585 |
|
586 |
.instant-img-container .control-nav li.search-field .searchResults span {
|
587 |
cursor: help;
|
588 |
-
|
589 |
-
|
590 |
-
.instant-img-container .control-nav li.search-field .searchResults span,
|
591 |
-
.instant-img-container .control-nav li.search-field .searchResults a {
|
592 |
-
line-height: 34px;
|
593 |
}
|
594 |
|
595 |
.instant-img-container .control-nav li.search-field .searchResults button {
|
596 |
-
|
597 |
-
|
598 |
-
|
|
|
599 |
width: 30px;
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
}
|
605 |
|
606 |
.instant-img-container .control-nav li.search-field .searchResults:after, .instant-img-container .control-nav li.search-field .searchResults:before {
|
@@ -617,14 +639,14 @@ body.media_page_instant-images #wpfooter p {
|
|
617 |
|
618 |
.instant-img-container .control-nav li.search-field .searchResults:after {
|
619 |
border-color: rgba(223, 225, 173, 0);
|
620 |
-
border-left-color: #
|
621 |
border-width: 6px;
|
622 |
margin-top: -6px;
|
623 |
}
|
624 |
|
625 |
.instant-img-container .control-nav li.search-field .searchResults:before {
|
626 |
border-color: rgba(0, 0, 0, 0);
|
627 |
-
border-left-color: #
|
628 |
border-width: 7px;
|
629 |
margin-top: -7px;
|
630 |
}
|
@@ -638,11 +660,11 @@ body.media_page_instant-images #wpfooter p {
|
|
638 |
padding: 0 1px 0 0;
|
639 |
margin: 0;
|
640 |
position: relative;
|
641 |
-
height:
|
642 |
display: block;
|
643 |
}
|
644 |
|
645 |
-
.instant-img-container .control-nav li.search-field form:hover button {
|
646 |
opacity: 1;
|
647 |
}
|
648 |
|
@@ -651,20 +673,20 @@ body.media_page_instant-images #wpfooter p {
|
|
651 |
padding: 0 10px 0 42px;
|
652 |
border: 1px solid #e1e1e1;
|
653 |
background-color: #f7f7f7 !important;
|
654 |
-
height:
|
655 |
-
line-height:
|
656 |
-
-webkit-border-radius:
|
657 |
-
border-radius:
|
658 |
font-size: 16px;
|
659 |
-
-webkit-transition:
|
660 |
-
-o-transition:
|
661 |
-
transition:
|
662 |
}
|
663 |
|
664 |
.instant-img-container .control-nav li.search-field input:focus {
|
665 |
border-color: #999;
|
666 |
-
-webkit-box-shadow: 0 0
|
667 |
-
box-shadow: 0 0
|
668 |
}
|
669 |
|
670 |
.instant-img-container .control-nav li.search-field input.searching {
|
@@ -674,12 +696,20 @@ body.media_page_instant-images #wpfooter p {
|
|
674 |
background-repeat: no-repeat;
|
675 |
}
|
676 |
|
677 |
-
.instant-img-container .control-nav li.search-field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
position: absolute;
|
679 |
-
left:
|
680 |
-
top:
|
681 |
-
width:
|
682 |
-
height:
|
|
|
683 |
z-index: 1;
|
684 |
border: none !important;
|
685 |
background: transparent !important;
|
@@ -695,42 +725,38 @@ body.media_page_instant-images #wpfooter p {
|
|
695 |
padding: 0;
|
696 |
}
|
697 |
|
698 |
-
.instant-img-container .control-nav li.search-field button:hover {
|
699 |
outline: none;
|
700 |
-
color: #
|
701 |
}
|
702 |
|
703 |
-
.instant-img-container .control-nav li.search-field button:focus {
|
704 |
outline: none;
|
705 |
-
color: #
|
706 |
}
|
707 |
|
708 |
.instant-img-container .control-nav li.search-field input[type="search"]::-webkit-input-placeholder {
|
709 |
color: #ccc;
|
710 |
-
font-weight:
|
711 |
font-style: normal;
|
712 |
-
font-size: 14px;
|
713 |
}
|
714 |
|
715 |
.instant-img-container .control-nav li.search-field input[type="search"]:-moz-placeholder {
|
716 |
color: #ccc;
|
717 |
-
font-weight:
|
718 |
font-style: normal;
|
719 |
-
font-size: 14px;
|
720 |
}
|
721 |
|
722 |
.instant-img-container .control-nav li.search-field input[type="search"]::-moz-placeholder {
|
723 |
color: #ccc;
|
724 |
-
font-weight:
|
725 |
font-style: normal;
|
726 |
-
font-size: 14px;
|
727 |
}
|
728 |
|
729 |
.instant-img-container .control-nav li.search-field input[type="search"]:-ms-input-placeholder {
|
730 |
color: #ccc;
|
731 |
-
font-weight:
|
732 |
font-style: normal;
|
733 |
-
font-size: 14px;
|
734 |
}
|
735 |
|
736 |
#photos {
|
@@ -917,7 +943,7 @@ body.media_page_instant-images #wpfooter p {
|
|
917 |
#photos .photo a.upload.success .status {
|
918 |
visibility: visible;
|
919 |
opacity: 1;
|
920 |
-
background-color: #
|
921 |
}
|
922 |
|
923 |
#photos .photo a.upload.success .status:before {
|
@@ -1166,7 +1192,17 @@ body.media_page_instant-images #wpfooter p {
|
|
1166 |
white-space: nowrap;
|
1167 |
}
|
1168 |
|
1169 |
-
#photos .photo .fade.user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1170 |
width: 20px;
|
1171 |
max-width: 20px;
|
1172 |
-webkit-border-radius: 100%;
|
@@ -1176,6 +1212,10 @@ body.media_page_instant-images #wpfooter p {
|
|
1176 |
top: 8px;
|
1177 |
}
|
1178 |
|
|
|
|
|
|
|
|
|
1179 |
#photos .photo .notice-msg {
|
1180 |
position: absolute;
|
1181 |
z-index: 999;
|
@@ -1215,7 +1255,7 @@ body.media_page_instant-images #wpfooter p {
|
|
1215 |
-webkit-transition: all 0.25s ease;
|
1216 |
-o-transition: all 0.25s ease;
|
1217 |
transition: all 0.25s ease;
|
1218 |
-
padding:
|
1219 |
overflow-y: auto;
|
1220 |
-webkit-overflow-scrolling: touch;
|
1221 |
border: 1px solid #e1e1e1;
|
@@ -1236,7 +1276,7 @@ body.media_page_instant-images #wpfooter p {
|
|
1236 |
display: block;
|
1237 |
background: #f7f7f7;
|
1238 |
border: 1px solid #e1e1e1;
|
1239 |
-
padding: 15px;
|
1240 |
-webkit-border-radius: 2px 2px 0 0;
|
1241 |
border-radius: 2px 2px 0 0;
|
1242 |
}
|
@@ -1246,40 +1286,89 @@ body.media_page_instant-images #wpfooter p {
|
|
1246 |
}
|
1247 |
|
1248 |
#photos .edit-screen--controls {
|
1249 |
-
-webkit-border-radius: 0 0
|
1250 |
-
border-radius: 0 0
|
1251 |
}
|
1252 |
|
1253 |
#photos .edit-screen--title {
|
1254 |
border-bottom: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1255 |
}
|
1256 |
|
1257 |
#photos .edit-screen--title p {
|
1258 |
font-size: 12px;
|
1259 |
-
line-height: 1.
|
1260 |
margin: 0;
|
1261 |
color: #999;
|
1262 |
}
|
1263 |
|
1264 |
#photos .edit-screen--title p.heading {
|
1265 |
color: #222;
|
1266 |
-
margin: 0 0
|
1267 |
font-weight: 600;
|
1268 |
text-transform: uppercase;
|
1269 |
}
|
1270 |
|
1271 |
-
#photos .edit-screen label
|
|
|
1272 |
margin: 0;
|
1273 |
padding: 15px;
|
1274 |
display: block;
|
1275 |
background: #fff;
|
1276 |
border: 1px solid #e1e1e1;
|
1277 |
border-bottom: none;
|
1278 |
-
-webkit-border-radius: 2px;
|
1279 |
-
border-radius: 2px;
|
1280 |
position: relative;
|
1281 |
}
|
1282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1283 |
#photos .edit-screen span {
|
1284 |
display: block;
|
1285 |
font-size: 11px;
|
@@ -1292,23 +1381,25 @@ body.media_page_instant-images #wpfooter p {
|
|
1292 |
|
1293 |
#photos .edit-screen textarea {
|
1294 |
resize: none;
|
|
|
|
|
1295 |
}
|
1296 |
|
1297 |
#photos .edit-screen input {
|
1298 |
font-size: 12px;
|
1299 |
-
padding: 0
|
1300 |
margin: 0;
|
1301 |
-
height:
|
1302 |
-
line-height:
|
1303 |
}
|
1304 |
|
1305 |
#photos .edit-screen em {
|
1306 |
position: absolute;
|
1307 |
bottom: 15px;
|
1308 |
right: 15px;
|
1309 |
-
height:
|
1310 |
-
line-height:
|
1311 |
-
background: #
|
1312 |
-webkit-border-radius: 0 2px 2px 0;
|
1313 |
border-radius: 0 2px 2px 0;
|
1314 |
color: #e1e1e1;
|
@@ -1320,70 +1411,116 @@ body.media_page_instant-images #wpfooter p {
|
|
1320 |
.instant-images-settings {
|
1321 |
display: none;
|
1322 |
background-color: #efefef;
|
1323 |
-
border-top: 1px solid #
|
1324 |
-
border-bottom: 1px solid #
|
1325 |
}
|
1326 |
|
1327 |
.instant-images-settings .cnkt-sidebar {
|
1328 |
padding: 20px 25px;
|
1329 |
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1330 |
}
|
1331 |
|
1332 |
.instant-images-settings .cnkt-sidebar .cta {
|
1333 |
-
|
1334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1335 |
}
|
1336 |
|
1337 |
-
@media screen and (
|
1338 |
.instant-images-settings .cnkt-sidebar .cta {
|
1339 |
-
|
1340 |
-
width: 100% !important;
|
1341 |
}
|
1342 |
}
|
1343 |
|
1344 |
-
.instant-images-settings .cnkt-sidebar .cta.ii-
|
1345 |
-
|
|
|
|
|
|
|
1346 |
}
|
1347 |
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
|
|
|
|
1352 |
}
|
1353 |
|
1354 |
-
.instant-images-settings .cnkt-sidebar .cta
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
|
|
|
|
|
|
|
|
|
|
1358 |
}
|
1359 |
|
1360 |
-
.instant-images-settings .cnkt-sidebar .cta
|
1361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1362 |
}
|
1363 |
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
}
|
1369 |
|
1370 |
-
|
1371 |
-
.instant-images-settings .cnkt-sidebar .cta
|
1372 |
-
|
1373 |
-
|
1374 |
}
|
1375 |
|
1376 |
-
.instant-images-settings .cnkt-sidebar .cta
|
1377 |
-
|
1378 |
-
|
|
|
|
|
|
|
|
|
1379 |
}
|
1380 |
|
1381 |
-
.instant-images-settings .cnkt-sidebar .cta
|
1382 |
-
|
|
|
|
|
|
|
|
|
|
|
1383 |
}
|
1384 |
|
1385 |
-
.instant-images-settings .cnkt-sidebar .cta
|
1386 |
-
|
1387 |
margin: 0;
|
1388 |
padding: 3px;
|
1389 |
background: #f7f7f7;
|
@@ -1393,60 +1530,157 @@ body.media_page_instant-images #wpfooter p {
|
|
1393 |
box-shadow: 0 0 0 1px #efefef;
|
1394 |
}
|
1395 |
|
1396 |
-
.instant-images-settings .cnkt-sidebar .cta {
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
|
|
|
|
|
|
|
|
|
|
1403 |
}
|
1404 |
|
1405 |
-
.instant-images-settings .cnkt-sidebar .cta.
|
1406 |
-
|
1407 |
}
|
1408 |
|
1409 |
-
.instant-images-settings .cnkt-sidebar .
|
1410 |
-
|
1411 |
-
|
|
|
1412 |
}
|
1413 |
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
|
|
|
|
|
|
|
|
1417 |
}
|
1418 |
|
1419 |
-
.instant-images-settings .cnkt-sidebar .cta-
|
1420 |
-
|
1421 |
-
|
|
|
|
|
|
|
|
|
|
|
1422 |
}
|
1423 |
|
1424 |
-
.instant-images-settings .cnkt-sidebar .cta-
|
1425 |
-
|
1426 |
-
|
1427 |
-
padding: 8px 10px;
|
1428 |
-
-webkit-border-radius: 2px;
|
1429 |
-
border-radius: 2px;
|
1430 |
-
background: #ffffcc;
|
1431 |
-
color: #666;
|
1432 |
}
|
1433 |
|
1434 |
-
.instant-images-settings .cnkt-sidebar .
|
1435 |
-
|
1436 |
-
|
|
|
1437 |
}
|
1438 |
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
|
|
1444 |
}
|
1445 |
|
1446 |
-
.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1450 |
}
|
1451 |
|
1452 |
.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2 + p {
|
@@ -1477,6 +1711,10 @@ body.media_page_instant-images #wpfooter p {
|
|
1477 |
padding: 0 16px;
|
1478 |
}
|
1479 |
|
|
|
|
|
|
|
|
|
1480 |
.instant-images-sidebar-icon,
|
1481 |
.instant-images-sidebar-icon svg {
|
1482 |
display: -webkit-inline-box;
|
@@ -1494,8 +1732,8 @@ body.media_page_instant-images #wpfooter p {
|
|
1494 |
|
1495 |
.instant-images-sidebar-icon svg,
|
1496 |
.instant-images-sidebar-icon svg * {
|
1497 |
-
stroke: #
|
1498 |
-
fill: #
|
1499 |
}
|
1500 |
|
1501 |
.components-panel .instant-img-container .load-more-wrap {
|
@@ -1528,15 +1766,31 @@ body.media_page_instant-images #wpfooter p {
|
|
1528 |
padding: 0;
|
1529 |
}
|
1530 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1531 |
.components-panel .control-nav {
|
1532 |
-
padding: 0
|
1533 |
-
border-bottom: 1px solid #
|
1534 |
}
|
1535 |
|
1536 |
.components-panel .control-nav li {
|
1537 |
font-size: 13px;
|
1538 |
}
|
1539 |
|
|
|
|
|
|
|
|
|
1540 |
.components-panel .control-nav li a {
|
1541 |
padding: 16px 24px 16px 0;
|
1542 |
height: auto;
|
@@ -1552,8 +1806,6 @@ body.media_page_instant-images #wpfooter p {
|
|
1552 |
|
1553 |
.components-panel .control-nav li.search-field form {
|
1554 |
height: auto;
|
1555 |
-
width: calc(100% + 16px);
|
1556 |
-
margin-left: -8px;
|
1557 |
}
|
1558 |
|
1559 |
.components-panel .control-nav li.search-field:before {
|
@@ -1562,13 +1814,15 @@ body.media_page_instant-images #wpfooter p {
|
|
1562 |
clear: both;
|
1563 |
}
|
1564 |
|
|
|
|
|
|
|
|
|
1565 |
.components-panel .control-nav li.search-field input {
|
1566 |
-
line-height:
|
1567 |
-
height:
|
1568 |
-
padding-right:
|
1569 |
-
padding-left:
|
1570 |
-
-webkit-border-radius: 0;
|
1571 |
-
border-radius: 0;
|
1572 |
border-color: #e2e4e7;
|
1573 |
font-size: 13px;
|
1574 |
-webkit-border-radius: 3px !important;
|
@@ -1577,30 +1831,47 @@ body.media_page_instant-images #wpfooter p {
|
|
1577 |
|
1578 |
.components-panel .control-nav li.search-field input.searching {
|
1579 |
padding-left: 30px;
|
1580 |
-
background-position:
|
1581 |
}
|
1582 |
|
1583 |
-
.components-panel .control-nav li.search-field
|
1584 |
-
|
1585 |
-
|
1586 |
-
top: 0;
|
1587 |
-
width: 40px;
|
1588 |
-
height: 36px;
|
1589 |
-
line-height: 36px;
|
1590 |
-
padding: 0;
|
1591 |
-
margin: 0;
|
1592 |
}
|
1593 |
|
1594 |
.components-panel .control-nav li.search-field .searchResults {
|
1595 |
-
right:
|
1596 |
left: auto;
|
1597 |
-
top:
|
|
|
|
|
|
|
|
|
|
|
1598 |
}
|
1599 |
|
1600 |
.components-panel .control-nav li.search-field .searchResults:before, .components-panel .control-nav li.search-field .searchResults:after {
|
1601 |
display: none;
|
1602 |
}
|
1603 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1604 |
.media-frame-content .instant-img-container .load-more-wrap {
|
1605 |
display: block;
|
1606 |
}
|
@@ -1661,15 +1932,11 @@ body.media_page_instant-images #wpfooter p {
|
|
1661 |
}
|
1662 |
|
1663 |
.no-results {
|
1664 |
-
display:
|
1665 |
padding: 150px 100px;
|
1666 |
text-align: center;
|
1667 |
}
|
1668 |
|
1669 |
-
.no-results.show {
|
1670 |
-
display: block;
|
1671 |
-
}
|
1672 |
-
|
1673 |
.no-results h3 {
|
1674 |
font-size: 24px;
|
1675 |
line-height: 29px;
|
@@ -1709,6 +1976,10 @@ body.media_page_instant-images #wpfooter p {
|
|
1709 |
font-size: 13px;
|
1710 |
}
|
1711 |
|
|
|
|
|
|
|
|
|
1712 |
.orientation-list ul {
|
1713 |
-webkit-box-flex: 1;
|
1714 |
-ms-flex: 1;
|
@@ -1737,41 +2008,392 @@ body.media_page_instant-images #wpfooter p {
|
|
1737 |
}
|
1738 |
|
1739 |
.orientation-list ul li:focus {
|
1740 |
-
border-color: #
|
1741 |
color: #111;
|
1742 |
outline: none;
|
1743 |
}
|
1744 |
|
1745 |
.orientation-list ul li.active {
|
1746 |
-
background-color: #
|
1747 |
-
border-color: #
|
1748 |
color: #fff;
|
1749 |
outline: none;
|
1750 |
}
|
1751 |
|
1752 |
-
.
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1757 |
-webkit-box-pack: center;
|
1758 |
-ms-flex-pack: center;
|
1759 |
justify-content: center;
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1763 |
}
|
1764 |
|
1765 |
-
.
|
1766 |
-
|
|
|
|
|
|
|
1767 |
}
|
1768 |
|
1769 |
-
.
|
|
|
|
|
1770 |
padding: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1771 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1772 |
-webkit-box-pack: center;
|
1773 |
-ms-flex-pack: center;
|
1774 |
justify-content: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1775 |
}
|
1776 |
|
1777 |
/*# sourceMappingURL=instant-images.css.map*/
|
38 |
}
|
39 |
}
|
40 |
|
41 |
+
body.media_page_instant-images.overflow-hidden {
|
42 |
+
overflow: hidden;
|
43 |
+
}
|
44 |
+
|
45 |
.instant-img-container {
|
46 |
font-size: 14px;
|
47 |
color: #666;
|
69 |
}
|
70 |
|
71 |
.instant-img-container a {
|
72 |
+
color: #586ec6;
|
73 |
-webkit-transition: all 0.25s ease;
|
74 |
-o-transition: all 0.25s ease;
|
75 |
transition: all 0.25s ease;
|
101 |
}
|
102 |
|
103 |
.instant-img-container .error-messaging {
|
104 |
+
padding: 20px 20px 20px 60px;
|
|
|
|
|
|
|
|
|
105 |
-webkit-border-radius: 3px;
|
106 |
border-radius: 3px;
|
107 |
+
background: #da4444;
|
108 |
color: #fff;
|
109 |
font-size: 13px;
|
110 |
+
line-height: 1.5;
|
111 |
margin-bottom: 25px;
|
112 |
display: block;
|
113 |
position: relative;
|
114 |
}
|
115 |
|
116 |
+
.instant-img-container .error-messaging:before {
|
117 |
font-family: "FontAwesome";
|
118 |
content: "\F06A";
|
119 |
display: block;
|
123 |
-ms-transform: translateY(-50%);
|
124 |
transform: translateY(-50%);
|
125 |
position: absolute;
|
126 |
+
font-size: 32px;
|
127 |
opacity: 0.75;
|
128 |
}
|
129 |
|
180 |
.instant-img-container .header-wrap h1 span {
|
181 |
display: block;
|
182 |
padding: 3px 0 0;
|
183 |
+
color: #999;
|
184 |
font-size: 15px;
|
185 |
font-weight: 400;
|
186 |
}
|
279 |
cursor: default;
|
280 |
}
|
281 |
|
|
|
|
|
|
|
282 |
.instant-img-container .cnkt-main {
|
283 |
width: 100%;
|
284 |
float: none;
|
292 |
margin-top: 0;
|
293 |
}
|
294 |
|
|
|
|
|
|
|
295 |
.instant-img-container .save-settings p.submit {
|
296 |
float: left;
|
297 |
margin: 0 2px 0 0;
|
306 |
background: #fff url(../img/ajax-loader.gif) no-repeat center center;
|
307 |
}
|
308 |
|
|
|
|
|
|
|
309 |
#TB_ajaxContent {
|
310 |
clear: both;
|
311 |
line-height: 1.4em;
|
317 |
padding: 15px !important;
|
318 |
}
|
319 |
|
|
|
320 |
.cnkt-sidebar .form-table {
|
321 |
margin: 0;
|
322 |
border: none;
|
323 |
+
position: relative;
|
324 |
+
top: -5px;
|
325 |
}
|
326 |
|
327 |
.cnkt-sidebar .form-table td,
|
331 |
}
|
332 |
|
333 |
.cnkt-sidebar .form-table label {
|
334 |
+
color: #333;
|
335 |
display: block;
|
336 |
clear: both;
|
337 |
float: none;
|
349 |
|
350 |
.instant-img-container .form-table td {
|
351 |
border-top: 0;
|
352 |
+
padding: 0 0 10px;
|
353 |
float: left;
|
354 |
width: 100%;
|
355 |
margin: 0;
|
356 |
}
|
357 |
|
|
|
|
|
|
|
|
|
358 |
.cnkt-sidebar .form-table .form-msg,
|
359 |
.cnkt-main .form-msg {
|
360 |
display: block;
|
405 |
box-shadow: none;
|
406 |
}
|
407 |
|
408 |
+
.instant-img-container .save-settings {
|
409 |
+
padding-top: 5px;
|
410 |
+
}
|
411 |
+
|
412 |
.instant-img-container label {
|
413 |
+
padding: 5px 0px;
|
414 |
}
|
415 |
|
416 |
#unsplash-form-options h2,
|
423 |
.instant-img-container textarea {
|
424 |
padding: 10px;
|
425 |
line-height: 1;
|
|
|
426 |
background: #f7f7f7;
|
427 |
width: 100%;
|
428 |
-webkit-border-radius: 2px;
|
438 |
background: #efefef;
|
439 |
}
|
440 |
|
|
|
441 |
.instant-img-container .spacer {
|
442 |
display: block;
|
443 |
height: 40px;
|
456 |
}
|
457 |
|
458 |
.instant-img-container .control-nav {
|
459 |
+
display: -webkit-box;
|
460 |
+
display: -ms-flexbox;
|
461 |
+
display: flex;
|
462 |
+
-ms-flex-wrap: wrap;
|
463 |
+
flex-wrap: wrap;
|
464 |
+
-webkit-box-align: center;
|
465 |
+
-ms-flex-align: center;
|
466 |
+
align-items: center;
|
467 |
+
width: 100%;
|
468 |
margin: 0;
|
469 |
padding: 25px 0;
|
470 |
list-style: none;
|
471 |
}
|
472 |
|
473 |
+
@media screen and (max-width: 600px) {
|
474 |
+
.instant-img-container .control-nav {
|
475 |
+
-webkit-box-pack: center;
|
476 |
+
-ms-flex-pack: center;
|
477 |
+
justify-content: center;
|
478 |
+
}
|
479 |
+
}
|
480 |
+
|
481 |
.instant-img-container .control-nav:after {
|
482 |
content: "";
|
483 |
display: table;
|
495 |
|
496 |
.instant-img-container .control-nav li button {
|
497 |
padding: 0 24px 0 2px;
|
498 |
+
height: 42px;
|
499 |
+
line-height: 42px;
|
500 |
display: block;
|
501 |
color: #999;
|
502 |
text-decoration: none;
|
542 |
|
543 |
@media screen and (max-width: 600px) {
|
544 |
.instant-img-container .control-nav li {
|
|
|
545 |
text-align: center;
|
546 |
margin: 0;
|
547 |
padding-bottom: 15px;
|
549 |
}
|
550 |
|
551 |
.instant-img-container .control-nav li.search-field {
|
552 |
+
width: 40%;
|
|
|
553 |
margin: 0;
|
554 |
+
margin-left: auto;
|
555 |
max-width: 500px;
|
556 |
}
|
557 |
|
560 |
width: 100%;
|
561 |
display: block;
|
562 |
position: static;
|
563 |
+
padding-bottom: 0;
|
564 |
text-align: left;
|
565 |
max-width: 100%;
|
566 |
}
|
569 |
.instant-img-container .control-nav li.search-field .searchResults {
|
570 |
position: absolute;
|
571 |
right: 100.5%;
|
572 |
+
top: 4px;
|
573 |
width: auto;
|
574 |
height: 34px;
|
575 |
line-height: 34px;
|
576 |
+
padding: 0 0 0 10px;
|
577 |
+
background: #586ec6;
|
578 |
+
border: 1px solid #455cb6;
|
579 |
-webkit-border-radius: 3px;
|
580 |
border-radius: 3px;
|
581 |
z-index: 99;
|
582 |
font-size: 13px;
|
583 |
+
font-weight: 500;
|
584 |
-webkit-transition: all 0.25s ease;
|
585 |
-o-transition: all 0.25s ease;
|
586 |
transition: all 0.25s ease;
|
587 |
+
color: #fff;
|
|
|
588 |
-webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
|
589 |
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
|
590 |
+
display: -webkit-box;
|
591 |
+
display: -ms-flexbox;
|
592 |
+
display: flex;
|
593 |
+
-webkit-box-align: center;
|
594 |
+
-ms-flex-align: center;
|
595 |
+
align-items: center;
|
596 |
}
|
597 |
|
598 |
.instant-img-container .control-nav li.search-field .searchResults span {
|
599 |
cursor: help;
|
600 |
+
font-style: italic;
|
|
|
|
|
|
|
|
|
601 |
}
|
602 |
|
603 |
.instant-img-container .control-nav li.search-field .searchResults button {
|
604 |
+
color: #fff;
|
605 |
+
padding: 0;
|
606 |
+
height: auto;
|
607 |
+
line-height: 1;
|
608 |
width: 30px;
|
609 |
+
font-weight: 700;
|
610 |
+
opacity: 0.65;
|
611 |
+
display: -webkit-box;
|
612 |
+
display: -ms-flexbox;
|
613 |
+
display: flex;
|
614 |
+
-webkit-box-align: center;
|
615 |
+
-ms-flex-align: center;
|
616 |
+
align-items: center;
|
617 |
+
-webkit-box-pack: center;
|
618 |
+
-ms-flex-pack: center;
|
619 |
+
justify-content: center;
|
620 |
+
font-size: 14px;
|
621 |
+
height: 100%;
|
622 |
+
}
|
623 |
+
|
624 |
+
.instant-img-container .control-nav li.search-field .searchResults button:hover, .instant-img-container .control-nav li.search-field .searchResults button:focus {
|
625 |
+
opacity: 1;
|
626 |
}
|
627 |
|
628 |
.instant-img-container .control-nav li.search-field .searchResults:after, .instant-img-container .control-nav li.search-field .searchResults:before {
|
639 |
|
640 |
.instant-img-container .control-nav li.search-field .searchResults:after {
|
641 |
border-color: rgba(223, 225, 173, 0);
|
642 |
+
border-left-color: #586ec6;
|
643 |
border-width: 6px;
|
644 |
margin-top: -6px;
|
645 |
}
|
646 |
|
647 |
.instant-img-container .control-nav li.search-field .searchResults:before {
|
648 |
border-color: rgba(0, 0, 0, 0);
|
649 |
+
border-left-color: #455cb6;
|
650 |
border-width: 7px;
|
651 |
margin-top: -7px;
|
652 |
}
|
660 |
padding: 0 1px 0 0;
|
661 |
margin: 0;
|
662 |
position: relative;
|
663 |
+
height: 42px;
|
664 |
display: block;
|
665 |
}
|
666 |
|
667 |
+
.instant-img-container .control-nav li.search-field form:hover button[type="submit"] {
|
668 |
opacity: 1;
|
669 |
}
|
670 |
|
673 |
padding: 0 10px 0 42px;
|
674 |
border: 1px solid #e1e1e1;
|
675 |
background-color: #f7f7f7 !important;
|
676 |
+
height: 42px;
|
677 |
+
line-height: 42px;
|
678 |
+
-webkit-border-radius: 5px;
|
679 |
+
border-radius: 5px;
|
680 |
font-size: 16px;
|
681 |
+
-webkit-transition: all 0.2s ease;
|
682 |
+
-o-transition: all 0.2s ease;
|
683 |
+
transition: all 0.2s ease;
|
684 |
}
|
685 |
|
686 |
.instant-img-container .control-nav li.search-field input:focus {
|
687 |
border-color: #999;
|
688 |
+
-webkit-box-shadow: 0 0 1px 4px rgba(0, 0, 0, 0.065);
|
689 |
+
box-shadow: 0 0 1px 4px rgba(0, 0, 0, 0.065);
|
690 |
}
|
691 |
|
692 |
.instant-img-container .control-nav li.search-field input.searching {
|
696 |
background-repeat: no-repeat;
|
697 |
}
|
698 |
|
699 |
+
.instant-img-container .control-nav li.search-field input[type="search"]::-webkit-search-decoration,
|
700 |
+
.instant-img-container .control-nav li.search-field input[type="search"]::-webkit-search-cancel-button,
|
701 |
+
.instant-img-container .control-nav li.search-field input[type="search"]::-webkit-search-results-button,
|
702 |
+
.instant-img-container .control-nav li.search-field input[type="search"]::-webkit-search-results-decoration {
|
703 |
+
-webkit-appearance: none;
|
704 |
+
}
|
705 |
+
|
706 |
+
.instant-img-container .control-nav li.search-field button[type=submit] {
|
707 |
position: absolute;
|
708 |
+
left: 0;
|
709 |
+
top: 0;
|
710 |
+
width: 42px;
|
711 |
+
height: 42px;
|
712 |
+
line-height: 42px;
|
713 |
z-index: 1;
|
714 |
border: none !important;
|
715 |
background: transparent !important;
|
725 |
padding: 0;
|
726 |
}
|
727 |
|
728 |
+
.instant-img-container .control-nav li.search-field button[type=submit]:hover {
|
729 |
outline: none;
|
730 |
+
color: #586ec6;
|
731 |
}
|
732 |
|
733 |
+
.instant-img-container .control-nav li.search-field button[type=submit]:focus {
|
734 |
outline: none;
|
735 |
+
color: #586ec6;
|
736 |
}
|
737 |
|
738 |
.instant-img-container .control-nav li.search-field input[type="search"]::-webkit-input-placeholder {
|
739 |
color: #ccc;
|
740 |
+
font-weight: 400;
|
741 |
font-style: normal;
|
|
|
742 |
}
|
743 |
|
744 |
.instant-img-container .control-nav li.search-field input[type="search"]:-moz-placeholder {
|
745 |
color: #ccc;
|
746 |
+
font-weight: 400;
|
747 |
font-style: normal;
|
|
|
748 |
}
|
749 |
|
750 |
.instant-img-container .control-nav li.search-field input[type="search"]::-moz-placeholder {
|
751 |
color: #ccc;
|
752 |
+
font-weight: 400;
|
753 |
font-style: normal;
|
|
|
754 |
}
|
755 |
|
756 |
.instant-img-container .control-nav li.search-field input[type="search"]:-ms-input-placeholder {
|
757 |
color: #ccc;
|
758 |
+
font-weight: 400;
|
759 |
font-style: normal;
|
|
|
760 |
}
|
761 |
|
762 |
#photos {
|
943 |
#photos .photo a.upload.success .status {
|
944 |
visibility: visible;
|
945 |
opacity: 1;
|
946 |
+
background-color: #65c774;
|
947 |
}
|
948 |
|
949 |
#photos .photo a.upload.success .status:before {
|
1192 |
white-space: nowrap;
|
1193 |
}
|
1194 |
|
1195 |
+
#photos .photo .fade.user .user-wrap:before {
|
1196 |
+
content: '';
|
1197 |
+
display: block;
|
1198 |
+
z-index: 0;
|
1199 |
+
background-color: #fff;
|
1200 |
+
height: 20px;
|
1201 |
+
opacity: 0.25;
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
#photos .photo .fade.user img,
|
1205 |
+
#photos .photo .fade.user .user-wrap:before {
|
1206 |
width: 20px;
|
1207 |
max-width: 20px;
|
1208 |
-webkit-border-radius: 100%;
|
1212 |
top: 8px;
|
1213 |
}
|
1214 |
|
1215 |
+
#photos .photo .fade.user img {
|
1216 |
+
z-index: 1;
|
1217 |
+
}
|
1218 |
+
|
1219 |
#photos .photo .notice-msg {
|
1220 |
position: absolute;
|
1221 |
z-index: 999;
|
1255 |
-webkit-transition: all 0.25s ease;
|
1256 |
-o-transition: all 0.25s ease;
|
1257 |
transition: all 0.25s ease;
|
1258 |
+
padding: 5px;
|
1259 |
overflow-y: auto;
|
1260 |
-webkit-overflow-scrolling: touch;
|
1261 |
border: 1px solid #e1e1e1;
|
1276 |
display: block;
|
1277 |
background: #f7f7f7;
|
1278 |
border: 1px solid #e1e1e1;
|
1279 |
+
padding: 15px 10px;
|
1280 |
-webkit-border-radius: 2px 2px 0 0;
|
1281 |
border-radius: 2px 2px 0 0;
|
1282 |
}
|
1286 |
}
|
1287 |
|
1288 |
#photos .edit-screen--controls {
|
1289 |
+
-webkit-border-radius: 0 0 3px 3px;
|
1290 |
+
border-radius: 0 0 3px 3px;
|
1291 |
}
|
1292 |
|
1293 |
#photos .edit-screen--title {
|
1294 |
border-bottom: none;
|
1295 |
+
display: -webkit-box;
|
1296 |
+
display: -ms-flexbox;
|
1297 |
+
display: flex;
|
1298 |
+
-ms-flex-wrap: nowrap;
|
1299 |
+
flex-wrap: nowrap;
|
1300 |
+
width: 100%;
|
1301 |
+
padding: 10px;
|
1302 |
+
-webkit-border-radius: 3px 3px 0 0;
|
1303 |
+
border-radius: 3px 3px 0 0;
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
#photos .edit-screen--title > div {
|
1307 |
+
padding: 5px 15px 5px 5px;
|
1308 |
+
-webkit-box-flex: 1;
|
1309 |
+
-ms-flex: 1;
|
1310 |
+
flex: 1;
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
#photos .edit-screen--title > div.preview {
|
1314 |
+
width: 30%;
|
1315 |
+
padding: 0;
|
1316 |
+
-webkit-background-size: cover;
|
1317 |
+
background-size: cover;
|
1318 |
+
background-position: center;
|
1319 |
+
background-repeat: no-repeat;
|
1320 |
+
-webkit-border-radius: 2px;
|
1321 |
+
border-radius: 2px;
|
1322 |
+
-webkit-box-flex: 0;
|
1323 |
+
-ms-flex: none;
|
1324 |
+
flex: none;
|
1325 |
}
|
1326 |
|
1327 |
#photos .edit-screen--title p {
|
1328 |
font-size: 12px;
|
1329 |
+
line-height: 1.45;
|
1330 |
margin: 0;
|
1331 |
color: #999;
|
1332 |
}
|
1333 |
|
1334 |
#photos .edit-screen--title p.heading {
|
1335 |
color: #222;
|
1336 |
+
margin: 0 0 3px;
|
1337 |
font-weight: 600;
|
1338 |
text-transform: uppercase;
|
1339 |
}
|
1340 |
|
1341 |
+
#photos .edit-screen label,
|
1342 |
+
#photos .edit-screen .add-attribution-row {
|
1343 |
margin: 0;
|
1344 |
padding: 15px;
|
1345 |
display: block;
|
1346 |
background: #fff;
|
1347 |
border: 1px solid #e1e1e1;
|
1348 |
border-bottom: none;
|
|
|
|
|
1349 |
position: relative;
|
1350 |
}
|
1351 |
|
1352 |
+
#photos .edit-screen .add-attribution-row {
|
1353 |
+
padding-top: 0;
|
1354 |
+
margin-top: -15px;
|
1355 |
+
border-top: none;
|
1356 |
+
}
|
1357 |
+
|
1358 |
+
#photos .edit-screen .add-attribution-row button {
|
1359 |
+
cursor: pointer;
|
1360 |
+
font-size: 11px;
|
1361 |
+
outline: none;
|
1362 |
+
padding: 5px 0;
|
1363 |
+
border: none;
|
1364 |
+
background: none;
|
1365 |
+
text-decoration: underline;
|
1366 |
+
}
|
1367 |
+
|
1368 |
+
#photos .edit-screen .add-attribution-row button:hover, #photos .edit-screen .add-attribution-row button:focus {
|
1369 |
+
text-decoration: none;
|
1370 |
+
}
|
1371 |
+
|
1372 |
#photos .edit-screen span {
|
1373 |
display: block;
|
1374 |
font-size: 11px;
|
1381 |
|
1382 |
#photos .edit-screen textarea {
|
1383 |
resize: none;
|
1384 |
+
font-size: 12px;
|
1385 |
+
line-height: 1.35;
|
1386 |
}
|
1387 |
|
1388 |
#photos .edit-screen input {
|
1389 |
font-size: 12px;
|
1390 |
+
padding: 0 10px;
|
1391 |
margin: 0;
|
1392 |
+
height: 35px;
|
1393 |
+
line-height: 35px;
|
1394 |
}
|
1395 |
|
1396 |
#photos .edit-screen em {
|
1397 |
position: absolute;
|
1398 |
bottom: 15px;
|
1399 |
right: 15px;
|
1400 |
+
height: 35px;
|
1401 |
+
line-height: 35px;
|
1402 |
+
background: #858585;
|
1403 |
-webkit-border-radius: 0 2px 2px 0;
|
1404 |
border-radius: 0 2px 2px 0;
|
1405 |
color: #e1e1e1;
|
1411 |
.instant-images-settings {
|
1412 |
display: none;
|
1413 |
background-color: #efefef;
|
1414 |
+
border-top: 1px solid #e1e1e1;
|
1415 |
+
border-bottom: 1px solid #e1e1e1;
|
1416 |
}
|
1417 |
|
1418 |
.instant-images-settings .cnkt-sidebar {
|
1419 |
padding: 20px 25px;
|
1420 |
overflow: hidden;
|
1421 |
+
display: -webkit-box;
|
1422 |
+
display: -ms-flexbox;
|
1423 |
+
display: flex;
|
1424 |
+
-ms-flex-wrap: wrap;
|
1425 |
+
flex-wrap: wrap;
|
1426 |
+
-webkit-box-pack: justify;
|
1427 |
+
-ms-flex-pack: justify;
|
1428 |
+
justify-content: space-between;
|
1429 |
+
line-height: 1.45;
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
.instant-images-settings .cnkt-sidebar p {
|
1433 |
+
font-size: 13px;
|
1434 |
}
|
1435 |
|
1436 |
.instant-images-settings .cnkt-sidebar .cta {
|
1437 |
+
width: 100%;
|
1438 |
+
background: #fff;
|
1439 |
+
padding: 0;
|
1440 |
+
overflow: hidden;
|
1441 |
+
position: relative;
|
1442 |
+
border: 1px solid #e1e1e1;
|
1443 |
+
-webkit-border-radius: 3px;
|
1444 |
+
border-radius: 3px;
|
1445 |
+
overflow: hidden;
|
1446 |
}
|
1447 |
|
1448 |
+
@media screen and (min-width: 800px) {
|
1449 |
.instant-images-settings .cnkt-sidebar .cta {
|
1450 |
+
width: calc(65% - 10px);
|
|
|
1451 |
}
|
1452 |
}
|
1453 |
|
1454 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new {
|
1455 |
+
-webkit-box-ordinal-group: 3;
|
1456 |
+
-ms-flex-order: 2;
|
1457 |
+
order: 2;
|
1458 |
+
padding-bottom: 52px;
|
1459 |
}
|
1460 |
|
1461 |
+
@media screen and (min-width: 800px) {
|
1462 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new {
|
1463 |
+
-webkit-box-ordinal-group: 2;
|
1464 |
+
-ms-flex-order: 1;
|
1465 |
+
order: 1;
|
1466 |
+
}
|
1467 |
}
|
1468 |
|
1469 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul {
|
1470 |
+
display: -webkit-box;
|
1471 |
+
display: -ms-flexbox;
|
1472 |
+
display: flex;
|
1473 |
+
-ms-flex-wrap: wrap;
|
1474 |
+
flex-wrap: wrap;
|
1475 |
+
list-style: none;
|
1476 |
+
margin: 0;
|
1477 |
+
padding: 15px;
|
1478 |
}
|
1479 |
|
1480 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li {
|
1481 |
+
line-height: 1.45;
|
1482 |
+
width: 100%;
|
1483 |
+
background-color: transparent;
|
1484 |
+
padding: 5px;
|
1485 |
+
margin: 0;
|
1486 |
+
position: relative;
|
1487 |
+
display: -webkit-box;
|
1488 |
+
display: -ms-flexbox;
|
1489 |
+
display: flex;
|
1490 |
}
|
1491 |
|
1492 |
+
@media screen and (min-width: 1024px) {
|
1493 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li {
|
1494 |
+
width: 50%;
|
1495 |
+
}
|
1496 |
}
|
1497 |
|
1498 |
+
@media screen and (min-width: 1270px) {
|
1499 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li {
|
1500 |
+
width: 33.333%;
|
1501 |
+
}
|
1502 |
}
|
1503 |
|
1504 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li p {
|
1505 |
+
font-size: 13px;
|
1506 |
+
position: relative;
|
1507 |
+
z-index: 1;
|
1508 |
+
margin: 0;
|
1509 |
+
padding: 15px;
|
1510 |
+
border: 1px solid #e1e1e1;
|
1511 |
}
|
1512 |
|
1513 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li p strong {
|
1514 |
+
font-size: 14px;
|
1515 |
+
color: #333;
|
1516 |
+
display: block;
|
1517 |
+
font-weight: 700;
|
1518 |
+
margin: 0 0 5px;
|
1519 |
+
color: #333;
|
1520 |
}
|
1521 |
|
1522 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li code {
|
1523 |
+
font-size: 12px;
|
1524 |
margin: 0;
|
1525 |
padding: 3px;
|
1526 |
background: #f7f7f7;
|
1530 |
box-shadow: 0 0 0 1px #efefef;
|
1531 |
}
|
1532 |
|
1533 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new .with-love {
|
1534 |
+
position: absolute;
|
1535 |
+
left: 0;
|
1536 |
+
bottom: 0;
|
1537 |
+
width: 100%;
|
1538 |
+
-webkit-border-radius: 0 0 2px 2px;
|
1539 |
+
border-radius: 0 0 2px 2px;
|
1540 |
+
background-color: #f7f7f7;
|
1541 |
+
border-top: 1px solid #e1e1e1;
|
1542 |
+
text-align: center;
|
1543 |
+
margin: 0;
|
1544 |
+
padding: 15px;
|
1545 |
}
|
1546 |
|
1547 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-whats-new .with-love p {
|
1548 |
+
margin: 0;
|
1549 |
}
|
1550 |
|
1551 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings {
|
1552 |
+
-webkit-box-ordinal-group: 2;
|
1553 |
+
-ms-flex-order: 1;
|
1554 |
+
order: 1;
|
1555 |
}
|
1556 |
|
1557 |
+
@media screen and (min-width: 800px) {
|
1558 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings {
|
1559 |
+
-webkit-box-ordinal-group: 3;
|
1560 |
+
-ms-flex-order: 2;
|
1561 |
+
order: 2;
|
1562 |
+
width: 35%;
|
1563 |
+
}
|
1564 |
}
|
1565 |
|
1566 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings select,
|
1567 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type="text"],
|
1568 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type="number"] {
|
1569 |
+
background-color: #fff;
|
1570 |
+
width: 100%;
|
1571 |
+
padding: 5px 10px;
|
1572 |
+
border-color: #ccc;
|
1573 |
+
max-width: none;
|
1574 |
}
|
1575 |
|
1576 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type="text"],
|
1577 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type="number"] {
|
1578 |
+
padding: 10px;
|
|
|
|
|
|
|
|
|
|
|
1579 |
}
|
1580 |
|
1581 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-settings span.desc {
|
1582 |
+
font-size: 11px;
|
1583 |
+
display: block;
|
1584 |
+
padding: 5px 2px;
|
1585 |
}
|
1586 |
|
1587 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-plugins {
|
1588 |
+
width: 100%;
|
1589 |
+
margin-top: 10px;
|
1590 |
+
-webkit-box-ordinal-group: 4;
|
1591 |
+
-ms-flex-order: 3;
|
1592 |
+
order: 3;
|
1593 |
}
|
1594 |
|
1595 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer {
|
1596 |
+
width: 100%;
|
1597 |
+
position: static;
|
1598 |
+
-webkit-box-pack: justify;
|
1599 |
+
-ms-flex-pack: justify;
|
1600 |
+
justify-content: space-between;
|
1601 |
+
padding: 20px 20px 0;
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer .plugin {
|
1605 |
+
width: 100%;
|
1606 |
+
margin: 0 0 20px;
|
1607 |
+
line-height: 1.45;
|
1608 |
+
}
|
1609 |
+
|
1610 |
+
@media screen and (min-width: 800px) {
|
1611 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer .plugin {
|
1612 |
+
width: calc(50% - 10px);
|
1613 |
+
}
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer .plugin h2 {
|
1617 |
+
margin-bottom: 5px;
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer:after {
|
1621 |
+
display: none;
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
.instant-images-settings .cnkt-sidebar h2 {
|
1625 |
+
border: none;
|
1626 |
+
padding: 20px 20px 0;
|
1627 |
+
font-size: 18px;
|
1628 |
+
font-weight: 700;
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
.instant-images-settings .cnkt-sidebar h2 + p {
|
1632 |
+
padding: 0 20px 16px;
|
1633 |
+
margin: 0 !important;
|
1634 |
+
border-bottom: 1px solid #e1e1e1;
|
1635 |
+
}
|
1636 |
+
|
1637 |
+
.instant-images-settings .cnkt-sidebar h2,
|
1638 |
+
.instant-images-settings .cnkt-sidebar h2 + p {
|
1639 |
+
background: #f7f7f7;
|
1640 |
+
margin: 0;
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
.instant-images-settings .cnkt-sidebar .cnkt-sidebar h3,
|
1644 |
+
.instant-images-settings .cnkt-sidebar .cnkt-sidebar h4 {
|
1645 |
+
margin-top: 0;
|
1646 |
+
}
|
1647 |
+
|
1648 |
+
.instant-images-settings .cnkt-sidebar .cta-wrap {
|
1649 |
+
display: block;
|
1650 |
+
padding: 20px;
|
1651 |
+
}
|
1652 |
+
|
1653 |
+
.instant-images-settings .cnkt-sidebar .cta-wrap h4 {
|
1654 |
+
padding: 10px 0 7px;
|
1655 |
+
margin: 0;
|
1656 |
+
}
|
1657 |
+
|
1658 |
+
.instant-images-settings .cnkt-sidebar .cta-wrap h4 span {
|
1659 |
+
display: inline-block;
|
1660 |
+
line-height: 1;
|
1661 |
+
padding: 8px 10px;
|
1662 |
+
-webkit-border-radius: 2px;
|
1663 |
+
border-radius: 2px;
|
1664 |
+
background: #ffffcc;
|
1665 |
+
color: #666;
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin {
|
1669 |
+
width: 48%;
|
1670 |
+
margin: 2% 1% 0;
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
@media screen and (max-width: 1170px) {
|
1674 |
+
.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin {
|
1675 |
+
width: 100%;
|
1676 |
+
margin: 2% 0 0;
|
1677 |
+
}
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2 {
|
1681 |
+
border: none;
|
1682 |
+
padding: 0;
|
1683 |
+
font-size: 16px;
|
1684 |
}
|
1685 |
|
1686 |
.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2 + p {
|
1711 |
padding: 0 16px;
|
1712 |
}
|
1713 |
|
1714 |
+
body.loading .instant-img-container .loading-block {
|
1715 |
+
display: block;
|
1716 |
+
}
|
1717 |
+
|
1718 |
.instant-images-sidebar-icon,
|
1719 |
.instant-images-sidebar-icon svg {
|
1720 |
display: -webkit-inline-box;
|
1732 |
|
1733 |
.instant-images-sidebar-icon svg,
|
1734 |
.instant-images-sidebar-icon svg * {
|
1735 |
+
stroke: #586ec6 !important;
|
1736 |
+
fill: #586ec6 !important;
|
1737 |
}
|
1738 |
|
1739 |
.components-panel .instant-img-container .load-more-wrap {
|
1766 |
padding: 0;
|
1767 |
}
|
1768 |
|
1769 |
+
.components-panel .provider-nav {
|
1770 |
+
width: 100%;
|
1771 |
+
padding: 5px;
|
1772 |
+
margin: 0;
|
1773 |
+
border-bottom-color: #ddd;
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
.components-panel .provider-nav button {
|
1777 |
+
font-size: 13px;
|
1778 |
+
padding-left: 32px;
|
1779 |
+
}
|
1780 |
+
|
1781 |
.components-panel .control-nav {
|
1782 |
+
padding: 0 5px 5px;
|
1783 |
+
border-bottom: 1px solid #ddd;
|
1784 |
}
|
1785 |
|
1786 |
.components-panel .control-nav li {
|
1787 |
font-size: 13px;
|
1788 |
}
|
1789 |
|
1790 |
+
.components-panel .control-nav li button {
|
1791 |
+
padding-left: 4px;
|
1792 |
+
}
|
1793 |
+
|
1794 |
.components-panel .control-nav li a {
|
1795 |
padding: 16px 24px 16px 0;
|
1796 |
height: auto;
|
1806 |
|
1807 |
.components-panel .control-nav li.search-field form {
|
1808 |
height: auto;
|
|
|
|
|
1809 |
}
|
1810 |
|
1811 |
.components-panel .control-nav li.search-field:before {
|
1814 |
clear: both;
|
1815 |
}
|
1816 |
|
1817 |
+
.components-panel .control-nav li.search-field button[type=submit] {
|
1818 |
+
display: none;
|
1819 |
+
}
|
1820 |
+
|
1821 |
.components-panel .control-nav li.search-field input {
|
1822 |
+
line-height: 40px;
|
1823 |
+
height: 40px;
|
1824 |
+
padding-right: 10px;
|
1825 |
+
padding-left: 10px;
|
|
|
|
|
1826 |
border-color: #e2e4e7;
|
1827 |
font-size: 13px;
|
1828 |
-webkit-border-radius: 3px !important;
|
1831 |
|
1832 |
.components-panel .control-nav li.search-field input.searching {
|
1833 |
padding-left: 30px;
|
1834 |
+
background-position: 8px center;
|
1835 |
}
|
1836 |
|
1837 |
+
.components-panel .control-nav li.search-field input:focus {
|
1838 |
+
-webkit-box-shadow: none;
|
1839 |
+
box-shadow: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
1840 |
}
|
1841 |
|
1842 |
.components-panel .control-nav li.search-field .searchResults {
|
1843 |
+
right: 2px;
|
1844 |
left: auto;
|
1845 |
+
top: 2px;
|
1846 |
+
-webkit-border-radius: 2px;
|
1847 |
+
border-radius: 2px;
|
1848 |
+
font-size: 12px;
|
1849 |
+
height: 36px;
|
1850 |
+
line-height: 35px;
|
1851 |
}
|
1852 |
|
1853 |
.components-panel .control-nav li.search-field .searchResults:before, .components-panel .control-nav li.search-field .searchResults:after {
|
1854 |
display: none;
|
1855 |
}
|
1856 |
|
1857 |
+
.components-panel .orientation-list {
|
1858 |
+
position: static;
|
1859 |
+
border-top: none;
|
1860 |
+
background: #f7f7f7;
|
1861 |
+
padding: 5px 5px 5px 0;
|
1862 |
+
margin-bottom: 5px;
|
1863 |
+
border-bottom-color: #ddd;
|
1864 |
+
}
|
1865 |
+
|
1866 |
+
.components-panel .orientation-list span {
|
1867 |
+
display: none;
|
1868 |
+
}
|
1869 |
+
|
1870 |
+
.components-panel .orientation-list ul {
|
1871 |
+
padding: 0;
|
1872 |
+
width: 100%;
|
1873 |
+
}
|
1874 |
+
|
1875 |
.media-frame-content .instant-img-container .load-more-wrap {
|
1876 |
display: block;
|
1877 |
}
|
1932 |
}
|
1933 |
|
1934 |
.no-results {
|
1935 |
+
display: block;
|
1936 |
padding: 150px 100px;
|
1937 |
text-align: center;
|
1938 |
}
|
1939 |
|
|
|
|
|
|
|
|
|
1940 |
.no-results h3 {
|
1941 |
font-size: 24px;
|
1942 |
line-height: 29px;
|
1976 |
font-size: 13px;
|
1977 |
}
|
1978 |
|
1979 |
+
.orientation-list span i {
|
1980 |
+
margin-right: 2px;
|
1981 |
+
}
|
1982 |
+
|
1983 |
.orientation-list ul {
|
1984 |
-webkit-box-flex: 1;
|
1985 |
-ms-flex: 1;
|
2008 |
}
|
2009 |
|
2010 |
.orientation-list ul li:focus {
|
2011 |
+
border-color: #586ec6;
|
2012 |
color: #111;
|
2013 |
outline: none;
|
2014 |
}
|
2015 |
|
2016 |
.orientation-list ul li.active {
|
2017 |
+
background-color: #586ec6;
|
2018 |
+
border-color: #586ec6;
|
2019 |
color: #fff;
|
2020 |
outline: none;
|
2021 |
}
|
2022 |
|
2023 |
+
.media-frame-content .instant-img-container .load-more-wrap {
|
2024 |
+
display: block;
|
2025 |
+
}
|
2026 |
+
|
2027 |
+
.media-frame-content .instant-img-container .provider-nav {
|
2028 |
+
padding: 10px 25px;
|
2029 |
+
}
|
2030 |
+
|
2031 |
+
.provider-nav {
|
2032 |
+
display: -webkit-box;
|
2033 |
+
display: -ms-flexbox;
|
2034 |
+
display: flex;
|
2035 |
+
-ms-flex-wrap: nowrap;
|
2036 |
+
flex-wrap: nowrap;
|
2037 |
+
width: calc(100% + 50px);
|
2038 |
+
margin-left: -25px;
|
2039 |
+
padding: 10px 25px;
|
2040 |
+
border-bottom: 1px solid #efefef;
|
2041 |
+
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.045);
|
2042 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.045);
|
2043 |
+
background-color: #f7f7f7;
|
2044 |
+
position: relative;
|
2045 |
+
}
|
2046 |
+
|
2047 |
+
.provider-nav > div {
|
2048 |
+
position: relative;
|
2049 |
+
}
|
2050 |
+
|
2051 |
+
.provider-nav--btn {
|
2052 |
+
padding: 8px 8px 8px 35px;
|
2053 |
+
border: 1px solid transparent;
|
2054 |
+
background: transparent;
|
2055 |
+
margin-right: 5px;
|
2056 |
+
cursor: pointer;
|
2057 |
+
position: relative;
|
2058 |
+
-webkit-border-radius: 3px;
|
2059 |
+
border-radius: 3px;
|
2060 |
+
font-size: 14px;
|
2061 |
+
color: #999;
|
2062 |
+
-webkit-transition: all 0.2s ease;
|
2063 |
+
-o-transition: all 0.2s ease;
|
2064 |
+
transition: all 0.2s ease;
|
2065 |
+
background-color: #f7f7f7;
|
2066 |
+
}
|
2067 |
+
|
2068 |
+
.provider-nav--btn:hover, .provider-nav--btn:focus {
|
2069 |
+
color: #333;
|
2070 |
+
}
|
2071 |
+
|
2072 |
+
.provider-nav--btn.active {
|
2073 |
+
background-color: #fff;
|
2074 |
+
border-color: #e1e1e1;
|
2075 |
+
color: #333;
|
2076 |
+
cursor: default;
|
2077 |
+
-webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.075);
|
2078 |
+
box-shadow: 0 0 6px rgba(0, 0, 0, 0.075);
|
2079 |
+
}
|
2080 |
+
|
2081 |
+
.provider-nav--new {
|
2082 |
+
color: #333;
|
2083 |
+
background-color: #ffe732;
|
2084 |
+
font-size: 9px;
|
2085 |
+
text-transform: uppercase;
|
2086 |
+
display: inline;
|
2087 |
+
padding: 3px 4px;
|
2088 |
+
-webkit-border-radius: 3px;
|
2089 |
+
border-radius: 3px;
|
2090 |
+
margin-left: 5px;
|
2091 |
+
position: relative;
|
2092 |
+
top: -1px;
|
2093 |
+
letter-spacing: -0.05rem;
|
2094 |
+
}
|
2095 |
+
|
2096 |
+
[data-provider="unsplash"] {
|
2097 |
+
background: url(../img/unsplash.svg) no-repeat 8px center;
|
2098 |
+
-webkit-background-size: 18px 18px;
|
2099 |
+
background-size: 18px 18px;
|
2100 |
+
}
|
2101 |
+
|
2102 |
+
[data-provider="pixabay"] {
|
2103 |
+
background: url(../img/pixabay.png) no-repeat 8px center;
|
2104 |
+
-webkit-background-size: 20px 20px;
|
2105 |
+
background-size: 20px 20px;
|
2106 |
+
}
|
2107 |
+
|
2108 |
+
.media-frame-content .instant-img-container .api-lightbox {
|
2109 |
+
position: fixed;
|
2110 |
+
}
|
2111 |
+
|
2112 |
+
.components-panel .instant-img-container .api-lightbox {
|
2113 |
+
height: 100%;
|
2114 |
+
-webkit-box-align: start;
|
2115 |
+
-ms-flex-align: start;
|
2116 |
+
align-items: flex-start;
|
2117 |
+
}
|
2118 |
+
|
2119 |
+
.instant-img-container .api-lightbox {
|
2120 |
+
display: -webkit-box;
|
2121 |
+
display: -ms-flexbox;
|
2122 |
+
display: flex;
|
2123 |
+
-webkit-box-align: center;
|
2124 |
+
-ms-flex-align: center;
|
2125 |
+
align-items: center;
|
2126 |
-webkit-box-pack: center;
|
2127 |
-ms-flex-pack: center;
|
2128 |
justify-content: center;
|
2129 |
+
position: absolute;
|
2130 |
+
z-index: 99999;
|
2131 |
+
left: 0;
|
2132 |
+
top: 0;
|
2133 |
+
right: 0;
|
2134 |
+
bottom: 0;
|
2135 |
+
height: 100vh;
|
2136 |
+
padding: 5%;
|
2137 |
+
background-color: rgba(0, 0, 0, 0.75);
|
2138 |
+
font-size: 13px;
|
2139 |
}
|
2140 |
|
2141 |
+
.instant-img-container .api-lightbox.active > div {
|
2142 |
+
-webkit-transform: scale(1);
|
2143 |
+
-ms-transform: scale(1);
|
2144 |
+
transform: scale(1);
|
2145 |
+
opacity: 1;
|
2146 |
}
|
2147 |
|
2148 |
+
.instant-img-container .api-lightbox > div {
|
2149 |
+
max-width: 450px;
|
2150 |
+
width: 100%;
|
2151 |
padding: 0;
|
2152 |
+
background-color: #fff;
|
2153 |
+
border: 1px solid #e1e1e1;
|
2154 |
+
-webkit-border-radius: 5px;
|
2155 |
+
border-radius: 5px;
|
2156 |
+
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
|
2157 |
+
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
|
2158 |
+
position: relative;
|
2159 |
+
-webkit-transform: scale(0.95);
|
2160 |
+
-ms-transform: scale(0.95);
|
2161 |
+
transform: scale(0.95);
|
2162 |
+
opacity: 0;
|
2163 |
+
-webkit-transition: all 0.3s ease-in-out;
|
2164 |
+
-o-transition: all 0.3s ease-in-out;
|
2165 |
+
transition: all 0.3s ease-in-out;
|
2166 |
+
}
|
2167 |
+
|
2168 |
+
.instant-img-container .api-lightbox > div > div {
|
2169 |
+
position: relative;
|
2170 |
+
}
|
2171 |
+
|
2172 |
+
.instant-img-container .api-lightbox--details {
|
2173 |
+
border-bottom: 1px solid #e1e1e1;
|
2174 |
+
padding: 25px;
|
2175 |
+
padding-bottom: 20px;
|
2176 |
+
position: relative;
|
2177 |
+
}
|
2178 |
+
|
2179 |
+
.instant-img-container .api-lightbox--details:after, .instant-img-container .api-lightbox--details:before {
|
2180 |
+
top: 100%;
|
2181 |
+
left: 50px;
|
2182 |
+
border: solid transparent;
|
2183 |
+
content: "";
|
2184 |
+
height: 0;
|
2185 |
+
width: 0;
|
2186 |
+
position: absolute;
|
2187 |
+
pointer-events: none;
|
2188 |
+
}
|
2189 |
+
|
2190 |
+
.instant-img-container .api-lightbox--details:after {
|
2191 |
+
border-color: rgba(255, 255, 255, 0);
|
2192 |
+
border-top-color: #ffffff;
|
2193 |
+
border-width: 10px;
|
2194 |
+
margin-left: -10px;
|
2195 |
+
}
|
2196 |
+
|
2197 |
+
.instant-img-container .api-lightbox--details:before {
|
2198 |
+
border-color: rgba(194, 225, 245, 0);
|
2199 |
+
border-top-color: #e1e1e1;
|
2200 |
+
border-width: 11px;
|
2201 |
+
margin-left: -11px;
|
2202 |
+
}
|
2203 |
+
|
2204 |
+
.instant-img-container .api-lightbox--details h3 {
|
2205 |
+
font-size: 16px;
|
2206 |
+
line-height: 18px;
|
2207 |
+
padding: 0 0 0 25px;
|
2208 |
+
text-transform: uppercase;
|
2209 |
+
margin: 0 0 10px;
|
2210 |
+
background-position: left center;
|
2211 |
+
}
|
2212 |
+
|
2213 |
+
.instant-img-container .api-lightbox--details p {
|
2214 |
+
font-size: 13px;
|
2215 |
+
margin: 0 0 5px;
|
2216 |
+
}
|
2217 |
+
|
2218 |
+
.instant-img-container .api-lightbox--details p a {
|
2219 |
+
font-weight: 500;
|
2220 |
+
}
|
2221 |
+
|
2222 |
+
.instant-img-container .api-lightbox--close {
|
2223 |
+
position: absolute;
|
2224 |
+
z-index: 1;
|
2225 |
+
right: 0px;
|
2226 |
+
top: 0;
|
2227 |
+
border: none;
|
2228 |
+
background-color: transparent;
|
2229 |
+
width: 40px;
|
2230 |
+
height: 40px;
|
2231 |
+
display: -webkit-box;
|
2232 |
+
display: -ms-flexbox;
|
2233 |
+
display: flex;
|
2234 |
+
-webkit-box-align: center;
|
2235 |
+
-ms-flex-align: center;
|
2236 |
+
align-items: center;
|
2237 |
+
-webkit-box-pack: center;
|
2238 |
+
-ms-flex-pack: center;
|
2239 |
+
justify-content: center;
|
2240 |
+
font-size: 25px;
|
2241 |
+
cursor: pointer;
|
2242 |
+
opacity: 0.5;
|
2243 |
+
}
|
2244 |
+
|
2245 |
+
.instant-img-container .api-lightbox--close:hover, .instant-img-container .api-lightbox--close:focus {
|
2246 |
+
opacity: 1;
|
2247 |
+
}
|
2248 |
+
|
2249 |
+
.instant-img-container .api-lightbox form {
|
2250 |
+
display: block;
|
2251 |
+
background-color: #f7f7f7;
|
2252 |
+
padding: 25px;
|
2253 |
+
}
|
2254 |
+
|
2255 |
+
.instant-img-container .api-lightbox label,
|
2256 |
+
.instant-img-container .api-lightbox button[type=submit] {
|
2257 |
+
font-size: 12px;
|
2258 |
+
text-transform: uppercase;
|
2259 |
+
font-weight: 600;
|
2260 |
+
display: block;
|
2261 |
+
padding: 0;
|
2262 |
+
margin: 0 0 5px;
|
2263 |
+
cursor: pointer;
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
.instant-img-container .api-lightbox--input-wrap {
|
2267 |
+
display: -webkit-box;
|
2268 |
+
display: -ms-flexbox;
|
2269 |
+
display: flex;
|
2270 |
width: 100%;
|
2271 |
+
padding: 0;
|
2272 |
+
margin-bottom: 10px;
|
2273 |
+
background-color: #fff;
|
2274 |
+
border: 1px solid #e1e1e1;
|
2275 |
+
-webkit-border-radius: 3px;
|
2276 |
+
border-radius: 3px;
|
2277 |
+
-webkit-transition: all 0.2s ease;
|
2278 |
+
-o-transition: all 0.2s ease;
|
2279 |
+
transition: all 0.2s ease;
|
2280 |
+
}
|
2281 |
+
|
2282 |
+
.instant-img-container .api-lightbox--input-wrap:focus-within {
|
2283 |
+
border-color: #999;
|
2284 |
+
-webkit-box-shadow: 0 0 1px 4px rgba(0, 0, 0, 0.065);
|
2285 |
+
box-shadow: 0 0 1px 4px rgba(0, 0, 0, 0.065);
|
2286 |
+
}
|
2287 |
+
|
2288 |
+
.instant-img-container .api-lightbox--input-wrap span {
|
2289 |
+
width: 40px;
|
2290 |
+
height: 40px;
|
2291 |
+
display: -webkit-box;
|
2292 |
+
display: -ms-flexbox;
|
2293 |
+
display: flex;
|
2294 |
-webkit-box-pack: center;
|
2295 |
-ms-flex-pack: center;
|
2296 |
justify-content: center;
|
2297 |
+
-webkit-box-align: center;
|
2298 |
+
-ms-flex-align: center;
|
2299 |
+
align-items: center;
|
2300 |
+
-webkit-border-radius: 2px 0 0 2px;
|
2301 |
+
border-radius: 2px 0 0 2px;
|
2302 |
+
border-right: 1px solid #e1e1e1;
|
2303 |
+
background-color: #f7f7f7;
|
2304 |
+
}
|
2305 |
+
|
2306 |
+
.instant-img-container .api-lightbox--input-wrap span i {
|
2307 |
+
font-size: 16px;
|
2308 |
+
}
|
2309 |
+
|
2310 |
+
.instant-img-container .api-lightbox--input-wrap span.invalid {
|
2311 |
+
cursor: help;
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
.instant-img-container .api-lightbox--input-wrap span.invalid i {
|
2315 |
+
color: #d4aa4d;
|
2316 |
+
}
|
2317 |
+
|
2318 |
+
.instant-img-container .api-lightbox--input-wrap span.valid i {
|
2319 |
+
color: #65c774;
|
2320 |
+
}
|
2321 |
+
|
2322 |
+
.instant-img-container .api-lightbox--input-wrap span.loading i {
|
2323 |
+
color: #333;
|
2324 |
+
}
|
2325 |
+
|
2326 |
+
.instant-img-container .api-lightbox--input-wrap input {
|
2327 |
+
line-height: 40px;
|
2328 |
+
height: 40px;
|
2329 |
+
padding: 0 10px;
|
2330 |
+
background-color: transparent;
|
2331 |
+
border: none;
|
2332 |
+
-webkit-box-flex: 1;
|
2333 |
+
-ms-flex: 1;
|
2334 |
+
flex: 1;
|
2335 |
+
font-size: 12px;
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
.instant-img-container .api-lightbox--input-wrap input::-webkit-input-placeholder {
|
2339 |
+
color: #999;
|
2340 |
+
font-weight: 400;
|
2341 |
+
font-style: italic;
|
2342 |
+
}
|
2343 |
+
|
2344 |
+
.instant-img-container .api-lightbox--input-wrap input:-moz-placeholder {
|
2345 |
+
color: #999;
|
2346 |
+
font-weight: 400;
|
2347 |
+
font-style: italic;
|
2348 |
+
}
|
2349 |
+
|
2350 |
+
.instant-img-container .api-lightbox--input-wrap input::-moz-placeholder {
|
2351 |
+
color: #999;
|
2352 |
+
font-weight: 400;
|
2353 |
+
font-style: italic;
|
2354 |
+
}
|
2355 |
+
|
2356 |
+
.instant-img-container .api-lightbox--input-wrap input:-ms-input-placeholder {
|
2357 |
+
color: #999;
|
2358 |
+
font-weight: 400;
|
2359 |
+
font-style: italic;
|
2360 |
+
}
|
2361 |
+
|
2362 |
+
.instant-img-container .api-lightbox--input-wrap input:focus {
|
2363 |
+
background: transparent;
|
2364 |
+
outline: none;
|
2365 |
+
border: none;
|
2366 |
+
-webkit-box-shadow: none;
|
2367 |
+
box-shadow: none;
|
2368 |
+
}
|
2369 |
+
|
2370 |
+
.instant-img-container .api-lightbox button[type=submit] {
|
2371 |
+
width: 100%;
|
2372 |
+
border: none;
|
2373 |
+
background-color: #586ec6;
|
2374 |
+
color: #fff;
|
2375 |
+
-webkit-border-radius: 3px;
|
2376 |
+
border-radius: 3px;
|
2377 |
+
padding: 0 10px;
|
2378 |
+
line-height: 46px;
|
2379 |
+
height: 46px;
|
2380 |
+
margin: 0;
|
2381 |
+
}
|
2382 |
+
|
2383 |
+
.instant-img-container .api-lightbox button[type=submit]:hover, .instant-img-container .api-lightbox button[type=submit]:focus {
|
2384 |
+
background-color: #455cb6;
|
2385 |
+
}
|
2386 |
+
|
2387 |
+
.instant-img-container .api-lightbox--response {
|
2388 |
+
color: #df3333;
|
2389 |
+
margin: 0;
|
2390 |
+
font-size: 13px;
|
2391 |
+
font-weight: 500;
|
2392 |
+
padding: 0 2px 12px;
|
2393 |
+
}
|
2394 |
+
|
2395 |
+
.instant-img-container .api-lightbox--response.valid {
|
2396 |
+
color: #51a75e;
|
2397 |
}
|
2398 |
|
2399 |
/*# sourceMappingURL=instant-images.css.map*/
|
dist/css/instant-images.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@import url(//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css);body.media_page_instant-images{background:#fff}body.media_page_instant-images #wpcontent{padding-left:0;padding-bottom:40px}@media screen and (max-width:800px){body.media_page_instant-images #wpcontent{padding-bottom:0}}body.media_page_instant-images #wpbody-content{padding-bottom:0}body.media_page_instant-images #wpfooter{padding-top:0;padding-bottom:0;line-height:40px;background:#f7f7f7;border-top:1px solid #efefef;position:fixed;bottom:0;z-index:1100}body.media_page_instant-images #wpfooter p{line-height:40px}@media screen and (max-width:800px){body.media_page_instant-images #wpfooter{display:none}}.instant-img-container{font-size:14px;color:#666;position:relative}.instant-img-container .offscreen{position:absolute;overflow:hidden;clip:rect(0 0 0 0);height:1px;width:1px;margin:-1px;padding:0;border:0}.instant-img-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.instant-img-container a{color:#5d72c3;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease}.instant-img-container a:hover{color:#5568ae;text-decoration:none}.instant-img-container img{max-width:100%}.instant-img-container p{color:#666;width:100%;display:block;clear:both;text-transform:none;padding:0;margin:0 0 15px;font-size:14px}.instant-img-container.loading .loading-block{display:block}.instant-img-container .error-messaging{display:none}.instant-img-container .error-messaging.active{padding:17px 17px 17px 57px;-webkit-border-radius:3px;border-radius:3px;background:#df3333;color:#fff;font-size:13px;margin-bottom:25px;display:block;position:relative}.instant-img-container .error-messaging.active:before{font-family:FontAwesome;content:"\F06A";display:block;left:17px;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);position:absolute;font-size:30px;opacity:.75}.instant-img-container .header-wrap{background:#f7f7f7 url(../img/logo-48x48.png) no-repeat 25px 20px;padding:20px 25px 20px 83px;min-height:88px;overflow:hidden;border-bottom:1px solid #efefef;position:relative}@media screen and (max-width:800px){.instant-img-container .header-wrap{background-position:center 20px;padding:80px 25px 20px;text-align:center}}.instant-img-container .header-wrap h1{padding:0;margin:4px 0 0;font-weight:700;font-size:26px;max-width:70%}@media screen and (max-width:800px){.instant-img-container .header-wrap h1{max-width:100%;width:100%;text-align:center}}.instant-img-container .header-wrap h1 em{font-weight:400;font-size:14px;background-color:rgba(0,0,0,.055);color:rgba(0,0,0,.5);display:inline-block;-webkit-border-radius:2px;border-radius:2px;padding:3px;position:relative;top:-2px;left:2px;text-shadow:1px 1px 1px hsla(0,0%,100%,.4);font-style:normal;line-height:1}.instant-img-container .header-wrap h1 span{display:block;padding:3px 0 0;color:#888;font-size:15px;font-weight:400}.instant-img-container .header-wrap button{position:absolute;right:25px;bottom:26px}@media screen and (max-width:800px){.instant-img-container .header-wrap button{position:static;margin-top:20px;display:inline-block}}.instant-img-container .header-wrap button i{margin-right:2px}.instant-img-container .instant-images-wrapper{padding:0 25px;display:block;overflow:hidden;min-height:400px;background:url(../img/ajax-loader-lg.gif) no-repeat 50%}.instant-img-container .instant-images-wrapper.loaded{background:none}.instant-img-container .permissions-warning{padding:0 25px}.instant-img-container .permissions-warning .inner{border-bottom:1px solid #efefef;padding:32px 0}.instant-img-container .permissions-warning input{max-width:500px}.instant-img-container .permissions-warning h3{font-size:22px;margin:0 0 15px}.instant-img-container .permissions-warning h3 i{margin:0 2px 0 0;position:relative}.instant-img-container .permissions-warning p:first-of-type{font-size:18px;margin:0 0 2px}.instant-img-container .loading-block{display:none;padding:50px;background:url(../img/ajax-loader-lg.gif) no-repeat 50%}.instant-img-container .load-more-wrap{margin:1% 0 0;padding:25px 0;text-align:center;display:none;border-top:1px solid #efefef}.instant-img-container .load-more-wrap button{display:inline-block;margin:0;padding:12px 15px;font-size:15px;font-weight:600;-webkit-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease;height:auto;line-height:1;cursor:pointer;background-image:none;background-repeat:no-repeat!important;background-position:15px!important}.instant-img-container .load-more-wrap button.disabled{opacity:.3;cursor:default}.instant-img-container .cnkt-main{width:100%;float:none;background:none!important;position:relative}.instant-img-container h2,.instant-img-container h3,.instant-img-container h4{margin-top:0}.instant-img-container .save-settings p.submit{float:left;margin:0 2px 0 0;width:auto}.instant-img-container .save-settings .loading{width:46px;height:28px;display:none;float:left;background:#fff url(../img/ajax-loader.gif) no-repeat 50%}#TB_ajaxContent{clear:both;line-height:1.4em;overflow:auto;text-align:left;width:100%!important;-webkit-box-sizing:border-box;box-sizing:border-box;padding:15px!important}.cnkt-sidebar .form-table{margin:0;border:none}.cnkt-sidebar .form-table label,.cnkt-sidebar .form-table p,.cnkt-sidebar .form-table td{font-size:13px}.cnkt-sidebar .form-table label{display:block;clear:both;float:none}.cnkt-sidebar .form-table label span{opacity:.8;font-size:13px;font-style:italic}.cnkt-sidebar .form-table th{display:none}.instant-img-container .form-table td{border-top:0;padding:0 0 15px;float:left;width:100%;margin:0}.instant-img-container .form-table tr:first-of-type td{padding:10px 0}.cnkt-main .form-msg,.cnkt-sidebar .form-table .form-msg{display:block;line-height:18px;padding:12px 12px 12px 15px;margin:15px 0 0;color:#666;background-color:#fff9ea;border-left:5px solid #dfd8c2;-webkit-border-radius:2px;border-radius:2px}.cnkt-main .form-msg span,.cnkt-sidebar .form-table .form-msg span{display:block;padding:6px 0 3px}.instant-img-container h1,.instant-img-container h3,.instant-img-container h4{color:#222;margin-top:0}.instant-img-container h4+p{margin-top:-6px}.instant-img-container p.small{font-size:12px;margin-top:-10px;opacity:.7}.instant-img-container ul{padding:0;margin:0;list-style:none}.instant-img-container input,.instant-img-container label,.instant-img-container select,.instant-img-container textarea{-webkit-box-shadow:none;box-shadow:none}.instant-img-container label{padding:5px 0}#unsplash-form-options h2,#unsplash-form-options p.desc{display:none}.instant-img-container input[type=number],.instant-img-container input[type=text],.instant-img-container textarea{padding:10px;line-height:1;border:1px solid #ccc;background:#f7f7f7;width:100%;-webkit-border-radius:2px;border-radius:2px;height:auto}.instant-img-container input[type=text]:focus,.instant-img-container textarea:focus{border-color:#999;-webkit-box-shadow:0 0 3px #ccc;box-shadow:0 0 3px #ccc;background:#efefef}.instant-img-container .spacer{display:block;height:40px;overflow:hidden;clear:both;width:100%}.instant-img-container .spacer.sm{height:20px}.instant-img-container input:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px #fff inset;box-shadow:inset 0 0 0 1000px #fff}.instant-img-container .control-nav{display:block;margin:0;padding:25px 0;list-style:none}.instant-img-container .control-nav:after{content:"";display:table;clear:both}.instant-img-container .control-nav li{padding:0;margin:0 3px 0 0;float:left;background:none;font-size:18px;position:relative}.instant-img-container .control-nav li button{padding:0 24px 0 2px;height:48px;line-height:48px;display:block;color:#999;text-decoration:none;-webkit-box-shadow:none;box-shadow:none;background-color:transparent;background-position:96%;background-repeat:no-repeat;border:none;cursor:pointer}.instant-img-container .control-nav li button:focus,.instant-img-container .control-nav li button:hover{color:#111;outline:none;-webkit-box-shadow:none;box-shadow:none}.instant-img-container .control-nav li button:focus{text-decoration:underline}.instant-img-container .control-nav li button.active{color:#333;cursor:default;font-weight:600}.instant-img-container .control-nav li button.loading{background-image:url(../img/ajax-loader.gif)}@media screen and (max-width:800px){.instant-img-container .control-nav li{font-size:16px;margin:0}.instant-img-container .control-nav li button{padding-left:3px}}@media screen and (max-width:600px){.instant-img-container .control-nav li{width:33.333%;text-align:center;margin:0;padding-bottom:15px}}.instant-img-container .control-nav li.search-field{float:right;width:49%;margin:0;max-width:500px}@media screen and (max-width:600px){.instant-img-container .control-nav li.search-field{width:100%;display:block;position:static;padding-bottom:15px;text-align:left;max-width:100%}}.instant-img-container .control-nav li.search-field .searchResults{position:absolute;right:100.5%;top:7px;width:auto;height:34px;line-height:34px;padding:0 30px 0 10px;background:#ffffbf;border:1px solid #ebebae;-webkit-border-radius:3px;border-radius:3px;z-index:99;font-size:13px;font-weight:600;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;color:#444;text-shadow:0 1px 1px hsla(0,0%,100%,.3);-webkit-box-shadow:0 2px 3px rgba(0,0,0,.05);box-shadow:0 2px 3px rgba(0,0,0,.05)}.instant-img-container .control-nav li.search-field .searchResults span{cursor:help}.instant-img-container .control-nav li.search-field .searchResults a,.instant-img-container .control-nav li.search-field .searchResults span{line-height:34px}.instant-img-container .control-nav li.search-field .searchResults button{padding:0 10px;height:32px;line-height:32px;width:30px;position:absolute;left:auto;right:0;top:0}.instant-img-container .control-nav li.search-field .searchResults:after,.instant-img-container .control-nav li.search-field .searchResults:before{left:100%;top:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;z-index:100}.instant-img-container .control-nav li.search-field .searchResults:after{border-color:hsla(62,46%,78%,0);border-left-color:#ffffbf;border-width:6px;margin-top:-6px}.instant-img-container .control-nav li.search-field .searchResults:before{border-color:transparent;border-left-color:#ebebae;border-width:7px;margin-top:-7px}.instant-img-container .control-nav li.search-field .searchResults.hide{opacity:0;visibility:hidden}.instant-img-container .control-nav li.search-field form{padding:0 1px 0 0;margin:0;position:relative;height:48px;display:block}.instant-img-container .control-nav li.search-field form:hover button{opacity:1}.instant-img-container .control-nav li.search-field input{width:100%;padding:0 10px 0 42px;border:1px solid #e1e1e1;background-color:#f7f7f7!important;height:46px;line-height:46px;-webkit-border-radius:3px;border-radius:3px;font-size:16px;-webkit-transition:padding .15s ease;-o-transition:padding .15s ease;transition:padding .15s ease}.instant-img-container .control-nav li.search-field input:focus{border-color:#999;-webkit-box-shadow:0 0 0 4px rgba(0,0,0,.075);box-shadow:0 0 0 4px rgba(0,0,0,.075)}.instant-img-container .control-nav li.search-field input.searching{padding-left:62px;background-image:url(../img/ajax-loader.gif);background-position:37px;background-repeat:no-repeat}.instant-img-container .control-nav li.search-field button{position:absolute;left:-2px;top:-1px;width:48px;height:48px;z-index:1;border:none!important;background:transparent!important;cursor:pointer;color:#666;-webkit-box-shadow:none!important;box-shadow:none!important;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;opacity:.5;margin:0;padding:0}.instant-img-container .control-nav li.search-field button:focus,.instant-img-container .control-nav li.search-field button:hover{outline:none;color:#5d72c3}.instant-img-container .control-nav li.search-field input[type=search]::-webkit-input-placeholder{color:#ccc;font-weight:300;font-style:normal;font-size:14px}.instant-img-container .control-nav li.search-field input[type=search]:-moz-placeholder,.instant-img-container .control-nav li.search-field input[type=search]::-moz-placeholder{color:#ccc;font-weight:300;font-style:normal;font-size:14px}.instant-img-container .control-nav li.search-field input[type=search]:-ms-input-placeholder{color:#ccc;font-weight:300;font-style:normal;font-size:14px}#photos{width:100%;width:calc(100% + 10px);margin:0 0 0 -5px;padding:0;position:relative}#photos .photo{width:20%;margin:0;padding:0 5px 10px;opacity:0;-webkit-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease}#photos .photo--wrap{position:relative}#photos .photo.in-view{opacity:1}#photos .photo.in-progress .fade{opacity:0!important;visibility:hidden!important}#photos .photo .img-wrap{display:block;overflow:hidden;position:relative}@media screen and (min-width:2000px){#photos .photo{width:20%}}@media screen and (max-width:1570px){#photos .photo{width:25%}}@media screen and (max-width:1270px){#photos .photo{width:33.333333%}}@media screen and (max-width:800px){#photos .photo{width:50%}}@media screen and (max-width:600px){#photos .photo{width:100%;margin:0 0 2%}}#photos .photo:focus a.upload img{opacity:.6}#photos .photo:focus .fade{opacity:1;visibility:visible}#photos .photo:focus .fade.user{opacity:.7}#photos .photo:focus-within .user-controls{opacity:1}#photos .photo a.upload{display:block;position:relative;background-color:#222;background-position:50%;background-repeat:no-repeat;background-image:url(../img/ajax-loader.gif);overflow:hidden}#photos .photo a.upload.loaded{background-image:none}#photos .photo a.upload:active,#photos .photo a.upload:focus{outline:none;border:none}#photos .photo a.upload img{-webkit-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;width:100%;height:auto!important;padding:0;vertical-align:top}#photos .photo a.upload .status{visibility:hidden;opacity:0;-webkit-transition:all .25s ease-in-out;-o-transition:all .25s ease-in-out;transition:all .25s ease-in-out;width:60px;height:60px;line-height:60px;-webkit-border-radius:4px;border-radius:4px;position:absolute;left:50%;top:50%;z-index:5;-webkit-transform:translate(-50%,-50%) scale(1.2);-ms-transform:translate(-50%,-50%) scale(1.2);transform:translate(-50%,-50%) scale(1.2);-webkit-box-shadow:0 2px 3px rgba(0,0,0,.25);box-shadow:0 2px 3px rgba(0,0,0,.25);background-position:50%;background-repeat:no-repeat}#photos .photo a.upload .status:before{font-family:FontAwesome;display:block;color:#fff;font-size:24px;opacity:.8}#photos .photo a.upload .status a{color:#fff}#photos .photo a.upload.errors .status,#photos .photo a.upload.success .status,#photos .photo a.upload.uploading .status{text-align:center;left:50%;top:50%;-webkit-transform:translate(-50%,-50%) scale(1);-ms-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}#photos .photo a.upload.uploading{cursor:default!important}#photos .photo a.upload.uploading .status{visibility:visible;opacity:1;background:hsla(0,0%,100%,.95) url(../img/ajax-loader-lg.gif) no-repeat 50%;-webkit-background-size:24px 24px;background-size:24px 24px}#photos .photo a.upload.uploading .status:before{display:none}#photos .photo a.upload.success{cursor:default!important}#photos .photo a.upload.success .status{visibility:visible;opacity:1;background-color:#63d875}#photos .photo a.upload.success .status:before{content:"\F00C";color:#fff}#photos .photo a.upload.success img{-webkit-transform:scale(1)!important;-ms-transform:scale(1)!important;transform:scale(1)!important}#photos .photo a.upload.errors{cursor:help!important}#photos .photo a.upload.errors .status{visibility:visible;opacity:1;background-color:#df3333}#photos .photo a.upload.errors .status:before{content:"\F12A";color:#fff;opacity:.8}#photos .photo.uploaded a.upload img{opacity:.25!important}#photos .photo.uploaded .options,#photos .photo.uploaded .user-controls{opacity:0!important;visibility:hidden!important}#photos .photo.in-progress a.upload img,#photos .photo:hover a.upload img{opacity:.7;-webkit-transform:scale(1.075);-ms-transform:scale(1.075);transform:scale(1.075)}#photos .photo.in-progress .options,#photos .photo:hover .options{opacity:1;visibility:visible}#photos .photo.in-progress .options i.heart-like,#photos .photo:hover .options i.heart-like{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}#photos .photo.in-progress .user-controls,#photos .photo:hover .user-controls{opacity:1}#photos .photo.in-progress .notice-msg{top:0;opacity:1}#photos .photo.in-progress .options,#photos .photo.in-progress .user-controls{opacity:0!important}#photos .photo .options{position:absolute;top:5px;right:5px;z-index:6;display:inline-block;width:auto;cursor:default!important;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease;opacity:0;visibility:hidden;font-size:13px}#photos .photo .options i{font-size:14px}#photos .photo .options i.heart-like{color:#d13714;-webkit-transition:all .25s ease .05s;-o-transition:all .25s ease .05s;transition:all .25s ease .05s;-webkit-transform:scale(.55);-ms-transform:scale(.55);transform:scale(.55);margin-right:2px;position:relative;top:0;font-size:14px;opacity:.9}#photos .photo .options a,#photos .photo .options span{display:inline-block;vertical-align:top;line-height:30px;padding:0 10px;padding-top:1px;background:hsla(0,0%,100%,.5);margin:0;-webkit-border-radius:2px;border-radius:2px;color:#23282d;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease}#photos .photo .options span{cursor:default}#photos .photo .options span:focus,#photos .photo .options span:hover{background-color:#fff}#photos .photo .options a{margin-left:2px}#photos .photo .options a:focus,#photos .photo .options a:hover{background-color:#fff}#photos .photo .options a i{position:relative;top:1px;left:1px}#photos .photo .user-controls{position:absolute;z-index:6;bottom:0;left:0;width:100%;background:rgba(0,0,0,.4);padding:0;opacity:.35;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease}#photos .photo .photo-options{float:right;text-align:right;max-width:50%}#photos .photo .fade{-webkit-transition:all .35s ease;-o-transition:all .35s ease;transition:all .35s ease;color:#fff;background:hsla(0,0%,100%,.75);background:transparent;-webkit-border-radius:2px;border-radius:2px;height:34px;line-height:34px;font-size:17px;z-index:6;float:left;margin:1px 1px 1px 0;padding:0;color:hsla(0,0%,100%,.75);border:none!important;outline:none;cursor:pointer}#photos .photo .fade.edit-photo,#photos .photo .fade.edit-photo-admin,#photos .photo .fade.insert,#photos .photo .fade.set-featured{display:inline-block;width:34px;text-align:center;position:relative}#photos .photo .fade.edit-photo-admin i,#photos .photo .fade.edit-photo i,#photos .photo .fade.insert i,#photos .photo .fade.set-featured i{line-height:27px;position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}#photos .photo .fade.edit-photo-admin:focus,#photos .photo .fade.edit-photo-admin:hover,#photos .photo .fade.edit-photo:focus,#photos .photo .fade.edit-photo:hover,#photos .photo .fade.insert:focus,#photos .photo .fade.insert:hover,#photos .photo .fade.set-featured:focus,#photos .photo .fade.set-featured:hover{color:#222;background:hsla(0,0%,100%,.95)}#photos .photo .fade.edit-photo-admin{display:none}#photos .photo .fade.user{background:none;font-size:13px;max-width:48%;cursor:pointer;text-decoration:none;border:none;line-height:35px;height:36px;margin:0}#photos .photo .fade.user:focus,#photos .photo .fade.user:hover{text-decoration:underline}#photos .photo .fade.user .user-wrap{position:relative;padding-left:35px;display:block;width:100%;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap}#photos .photo .fade.user img{width:20px;max-width:20px;-webkit-border-radius:100%;border-radius:100%;position:absolute;left:8px;top:8px}#photos .photo .notice-msg{position:absolute;z-index:999;top:-40px;left:0;height:40px;line-height:40px;width:100%;background:rgba(0,0,0,.6);text-align:center;color:hsla(0,0%,100%,.9);font-size:12px;margin:0;padding:0;-webkit-transition:all .25s ease-in-out;-o-transition:all .25s ease-in-out;transition:all .25s ease-in-out;opacity:0;z-index:9999}#photos .photo .notice-msg.has-error{top:-40px;opacity:0}#photos .edit-screen{position:absolute;left:0;top:0;width:100%;height:100%;z-index:999;background:hsla(0,0%,100%,.9);opacity:0;visibility:hidden;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;padding:8px;overflow-y:auto;-webkit-overflow-scrolling:touch;border:1px solid #e1e1e1;-webkit-transform:scale(1.025);-ms-transform:scale(1.025);transform:scale(1.025)}#photos .edit-screen.editing{visibility:visible;opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}#photos .edit-screen--controls,#photos .edit-screen--title{display:block;background:#f7f7f7;border:1px solid #e1e1e1;padding:15px;-webkit-border-radius:2px 2px 0 0;border-radius:2px 2px 0 0}#photos .edit-screen--controls .button-primary,#photos .edit-screen--title .button-primary{float:right}#photos .edit-screen--controls{-webkit-border-radius:0 0 2px 2px;border-radius:0 0 2px 2px}#photos .edit-screen--title{border-bottom:none}#photos .edit-screen--title p{font-size:12px;line-height:1.25;margin:0;color:#999}#photos .edit-screen--title p.heading{color:#222;margin:0 0 5px;font-weight:600;text-transform:uppercase}#photos .edit-screen label{margin:0;padding:15px;display:block;background:#fff;border:1px solid #e1e1e1;border-bottom:none;-webkit-border-radius:2px;border-radius:2px;position:relative}#photos .edit-screen span{display:block;font-size:11px;text-transform:uppercase;font-weight:600;margin:0 0 5px;color:#222;line-height:1}#photos .edit-screen textarea{resize:none}#photos .edit-screen input{font-size:12px;padding:0 5px;margin:0;height:30px;line-height:30px}#photos .edit-screen em{position:absolute;bottom:15px;right:15px;height:30px;line-height:30px;background:#777;-webkit-border-radius:0 2px 2px 0;border-radius:0 2px 2px 0;color:#e1e1e1;font-style:normal;font-size:11px;padding:0 10px}.instant-images-settings{display:none;background-color:#efefef;border-top:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7}.instant-images-settings .cnkt-sidebar{padding:20px 25px;overflow:hidden}.instant-images-settings .cnkt-sidebar .cta{float:left;width:50%}@media screen and (max-width:800px){.instant-images-settings .cnkt-sidebar .cta{float:none!important;width:100%!important}}.instant-images-settings .cnkt-sidebar .cta.ii-settings{width:31.333%}.instant-images-settings .cnkt-sidebar .cta.ii-plugins{width:68.666%;width:calc(68.666% - 25px);float:right}.instant-images-settings .cnkt-sidebar .cta h2{border:none;padding:17px 20px 3px;font-size:16px}.instant-images-settings .cnkt-sidebar .cta h2.w-border{border-top:1px solid #e7e7e7}.instant-images-settings .cnkt-sidebar .cta h2+p{padding:0 20px 15px;margin:0!important;border-bottom:1px solid #e7e7e7}.instant-images-settings .cnkt-sidebar .cta h2,.instant-images-settings .cnkt-sidebar .cta h2+p{background:#f7f7f7;margin:0}.instant-images-settings .cnkt-sidebar .cta ul.whats-new{list-style:disc;padding:0 0 10px 20px}.instant-images-settings .cnkt-sidebar .cta ul.whats-new li{margin:10px 0 0}.instant-images-settings .cnkt-sidebar .cta ul.whats-new li pre{display:inline-block;margin:0;padding:3px;background:#f7f7f7;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 0 1px #efefef;box-shadow:0 0 0 1px #efefef}.instant-images-settings .cnkt-sidebar .cta{background:#fff;padding:0 0 20px;margin:0 0 20px;overflow:hidden;position:relative;border:1px solid #e7e7e7}.instant-images-settings .cnkt-sidebar .cta.padding-bottom{padding-bottom:66px}.instant-images-settings .cnkt-sidebar .cnkt-sidebar h3,.instant-images-settings .cnkt-sidebar .cnkt-sidebar h4{margin-top:0}.instant-images-settings .cnkt-sidebar .cta-wrap{display:block;padding:10px 20px}.instant-images-settings .cnkt-sidebar .cta-wrap h4{padding:10px 0 7px;margin:0}.instant-images-settings .cnkt-sidebar .cta-wrap h4 span{display:inline-block;line-height:1;padding:8px 10px;-webkit-border-radius:2px;border-radius:2px;background:#ffc;color:#666}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin{width:48%;margin:2% 1% 0}@media screen and (max-width:1170px){.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin{width:100%;margin:2% 0 0}}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2{border:none;padding:0;font-size:16px}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2+p{padding:0;margin:0!important;border-bottom:none}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2,.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2+p{background:none;margin:0}.instant-images-settings table{margin-top:5px}.instant-img-container[data-media-popup=true]{background:#fff}.instant-img-container[data-media-popup=true] .header-wrap{display:none}.instant-img-container[data-media-popup=true] .instant-images-wrapper{padding:0 16px}.instant-images-sidebar-icon,.instant-images-sidebar-icon svg{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto}.instant-images-sidebar-icon svg{height:20px;width:20px}.instant-images-sidebar-icon svg,.instant-images-sidebar-icon svg *{stroke:#5d72c3!important;fill:#5d72c3!important}.components-panel .instant-img-container .load-more-wrap{display:block}.components-panel .no-results{padding:40px}.components-panel .no-results h3{font-size:18px}.components-panel .no-results p{font-size:13px}.components-panel #photos{width:100%;margin:0;padding:5px}.components-panel #photos .photo{width:100%;display:block;opacity:1!important;margin:0 0 5px;padding:0}.components-panel .control-nav{padding:0 16px 8px;border-bottom:1px solid #e2e4e7}.components-panel .control-nav li{font-size:13px}.components-panel .control-nav li a{padding:16px 24px 16px 0;height:auto;line-height:1.2}.components-panel .control-nav li.search-field{float:none;width:100%;padding:0;clear:both}.components-panel .control-nav li.search-field form{height:auto;width:calc(100% + 16px);margin-left:-8px}.components-panel .control-nav li.search-field:before{content:"";display:table;clear:both}.components-panel .control-nav li.search-field input{line-height:36px;height:36px;padding-right:8px;padding-left:30px;-webkit-border-radius:0;border-radius:0;border-color:#e2e4e7;font-size:13px;-webkit-border-radius:3px!important;border-radius:3px!important}.components-panel .control-nav li.search-field input.searching{padding-left:30px;background-position:95%}.components-panel .control-nav li.search-field button{position:absolute;right:auto;top:0;width:40px;height:36px;line-height:36px;padding:0;margin:0}.components-panel .control-nav li.search-field .searchResults{right:1px;left:auto;top:1px}.components-panel .control-nav li.search-field .searchResults:after,.components-panel .control-nav li.search-field .searchResults:before{display:none}.media-frame-content .instant-img-container .load-more-wrap{display:block}.instant-img-container #tooltip{display:inline-block;padding:8px 10px;background:#fff;position:fixed;left:auto;top:auto;z-index:999;display:block;opacity:0;visibility:hidden;margin-top:-37px;font-size:12px;color:#999;text-align:center;line-height:1;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 2px 3px rgba(0,0,0,.1);box-shadow:0 2px 3px rgba(0,0,0,.1);-webkit-transition:all .15s ease;-o-transition:all .15s ease;transition:all .15s ease}.instant-img-container #tooltip:after{top:100%;right:17px;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:hsla(0,0%,100%,0);border-top-color:#fff;border-width:5px;margin-left:-5px}.instant-img-container #tooltip.over{opacity:.9;visibility:visible}.instant-img-container #tooltip.above{margin-top:37px}.instant-img-container #tooltip.above:after{top:-5px;border-top:none;border-bottom-color:#fff}.no-results{display:none;padding:150px 100px;text-align:center}.no-results.show{display:block}.no-results h3{font-size:24px;line-height:29px;margin:0 0 10px}.no-results p{font-size:16px;margin:0}@media screen and (max-width:800px){.no-results{padding:50px}}.orientation-list{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;padding:7px 0;margin:0 0 10px;border-top:1px solid #efefef;border-bottom:1px solid #efefef;position:relative;top:-7px}.orientation-list span{opacity:.5;margin:0 10px 0 0;font-size:13px}.orientation-list ul{-webkit-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-ms-flexbox;display:flex}.orientation-list ul li{margin:0 1px 0 0;-webkit-border-radius:3px;border-radius:3px;cursor:pointer;padding:4px 6px;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;border:1px solid transparent;color:#999;font-size:13px}.orientation-list ul li:hover{color:#111}.orientation-list ul li:focus{border-color:#5d72c3;color:#111;outline:none}.orientation-list ul li.active{background-color:#5d72c3;border-color:#5d72c3;color:#fff;outline:none}.components-panel .orientation-list{position:static;text-align:center;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-top:none;background:#f7f7f7;margin-bottom:10px}.components-panel .orientation-list span{display:none}.components-panel .orientation-list ul{padding:0;width:100%;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}
|
1 |
+
@import url(//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css);body.media_page_instant-images{background:#fff}body.media_page_instant-images #wpcontent{padding-left:0;padding-bottom:40px}@media screen and (max-width:800px){body.media_page_instant-images #wpcontent{padding-bottom:0}}body.media_page_instant-images #wpbody-content{padding-bottom:0}body.media_page_instant-images #wpfooter{padding-top:0;padding-bottom:0;line-height:40px;background:#f7f7f7;border-top:1px solid #efefef;position:fixed;bottom:0;z-index:1100}body.media_page_instant-images #wpfooter p{line-height:40px}@media screen and (max-width:800px){body.media_page_instant-images #wpfooter{display:none}}body.media_page_instant-images.overflow-hidden{overflow:hidden}.instant-img-container{font-size:14px;color:#666;position:relative}.instant-img-container .offscreen{position:absolute;overflow:hidden;clip:rect(0 0 0 0);height:1px;width:1px;margin:-1px;padding:0;border:0}.instant-img-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.instant-img-container a{color:#586ec6;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease}.instant-img-container a:hover{color:#5568ae;text-decoration:none}.instant-img-container img{max-width:100%}.instant-img-container p{color:#666;width:100%;display:block;clear:both;text-transform:none;padding:0;margin:0 0 15px;font-size:14px}.instant-img-container.loading .loading-block{display:block}.instant-img-container .error-messaging{padding:20px 20px 20px 60px;-webkit-border-radius:3px;border-radius:3px;background:#da4444;color:#fff;font-size:13px;line-height:1.5;margin-bottom:25px;display:block;position:relative}.instant-img-container .error-messaging:before{font-family:FontAwesome;content:"\F06A";display:block;left:17px;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);position:absolute;font-size:32px;opacity:.75}.instant-img-container .header-wrap{background:#f7f7f7 url(../img/logo-48x48.png) no-repeat 25px 20px;padding:20px 25px 20px 83px;min-height:88px;overflow:hidden;border-bottom:1px solid #efefef;position:relative}@media screen and (max-width:800px){.instant-img-container .header-wrap{background-position:center 20px;padding:80px 25px 20px;text-align:center}}.instant-img-container .header-wrap h1{padding:0;margin:4px 0 0;font-weight:700;font-size:26px;max-width:70%}@media screen and (max-width:800px){.instant-img-container .header-wrap h1{max-width:100%;width:100%;text-align:center}}.instant-img-container .header-wrap h1 em{font-weight:400;font-size:14px;background-color:rgba(0,0,0,.055);color:rgba(0,0,0,.5);display:inline-block;-webkit-border-radius:2px;border-radius:2px;padding:3px;position:relative;top:-2px;left:2px;text-shadow:1px 1px 1px hsla(0,0%,100%,.4);font-style:normal;line-height:1}.instant-img-container .header-wrap h1 span{display:block;padding:3px 0 0;color:#999;font-size:15px;font-weight:400}.instant-img-container .header-wrap button{position:absolute;right:25px;bottom:26px}@media screen and (max-width:800px){.instant-img-container .header-wrap button{position:static;margin-top:20px;display:inline-block}}.instant-img-container .header-wrap button i{margin-right:2px}.instant-img-container .instant-images-wrapper{padding:0 25px;display:block;overflow:hidden;min-height:400px;background:url(../img/ajax-loader-lg.gif) no-repeat 50%}.instant-img-container .instant-images-wrapper.loaded{background:none}.instant-img-container .permissions-warning{padding:0 25px}.instant-img-container .permissions-warning .inner{border-bottom:1px solid #efefef;padding:32px 0}.instant-img-container .permissions-warning input{max-width:500px}.instant-img-container .permissions-warning h3{font-size:22px;margin:0 0 15px}.instant-img-container .permissions-warning h3 i{margin:0 2px 0 0;position:relative}.instant-img-container .permissions-warning p:first-of-type{font-size:18px;margin:0 0 2px}.instant-img-container .loading-block{display:none;padding:50px;background:url(../img/ajax-loader-lg.gif) no-repeat 50%}.instant-img-container .load-more-wrap{margin:1% 0 0;padding:25px 0;text-align:center;display:none;border-top:1px solid #efefef}.instant-img-container .load-more-wrap button{display:inline-block;margin:0;padding:12px 15px;font-size:15px;font-weight:600;-webkit-transition:all .1s ease;-o-transition:all .1s ease;transition:all .1s ease;height:auto;line-height:1;cursor:pointer;background-image:none;background-repeat:no-repeat!important;background-position:15px!important}.instant-img-container .load-more-wrap button.disabled{opacity:.3;cursor:default}.instant-img-container .cnkt-main{width:100%;float:none;background:none!important;position:relative}.instant-img-container h2,.instant-img-container h3,.instant-img-container h4{margin-top:0}.instant-img-container .save-settings p.submit{float:left;margin:0 2px 0 0;width:auto}.instant-img-container .save-settings .loading{width:46px;height:28px;display:none;float:left;background:#fff url(../img/ajax-loader.gif) no-repeat 50%}#TB_ajaxContent{clear:both;line-height:1.4em;overflow:auto;text-align:left;width:100%!important;-webkit-box-sizing:border-box;box-sizing:border-box;padding:15px!important}.cnkt-sidebar .form-table{margin:0;border:none;position:relative;top:-5px}.cnkt-sidebar .form-table label,.cnkt-sidebar .form-table p,.cnkt-sidebar .form-table td{font-size:13px}.cnkt-sidebar .form-table label{color:#333;display:block;clear:both;float:none}.cnkt-sidebar .form-table label span{opacity:.8;font-size:13px;font-style:italic}.cnkt-sidebar .form-table th{display:none}.instant-img-container .form-table td{border-top:0;padding:0 0 10px;float:left;width:100%;margin:0}.cnkt-main .form-msg,.cnkt-sidebar .form-table .form-msg{display:block;line-height:18px;padding:12px 12px 12px 15px;margin:15px 0 0;color:#666;background-color:#fff9ea;border-left:5px solid #dfd8c2;-webkit-border-radius:2px;border-radius:2px}.cnkt-main .form-msg span,.cnkt-sidebar .form-table .form-msg span{display:block;padding:6px 0 3px}.instant-img-container h1,.instant-img-container h3,.instant-img-container h4{color:#222;margin-top:0}.instant-img-container h4+p{margin-top:-6px}.instant-img-container p.small{font-size:12px;margin-top:-10px;opacity:.7}.instant-img-container ul{padding:0;margin:0;list-style:none}.instant-img-container input,.instant-img-container label,.instant-img-container select,.instant-img-container textarea{-webkit-box-shadow:none;box-shadow:none}.instant-img-container .save-settings{padding-top:5px}.instant-img-container label{padding:5px 0}#unsplash-form-options h2,#unsplash-form-options p.desc{display:none}.instant-img-container input[type=number],.instant-img-container input[type=text],.instant-img-container textarea{padding:10px;line-height:1;background:#f7f7f7;width:100%;-webkit-border-radius:2px;border-radius:2px;height:auto}.instant-img-container input[type=text]:focus,.instant-img-container textarea:focus{border-color:#999;-webkit-box-shadow:0 0 3px #ccc;box-shadow:0 0 3px #ccc;background:#efefef}.instant-img-container .spacer{display:block;height:40px;overflow:hidden;clear:both;width:100%}.instant-img-container .spacer.sm{height:20px}.instant-img-container input:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px #fff inset;box-shadow:inset 0 0 0 1000px #fff}.instant-img-container .control-nav{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;margin:0;padding:25px 0;list-style:none}@media screen and (max-width:600px){.instant-img-container .control-nav{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}}.instant-img-container .control-nav:after{content:"";display:table;clear:both}.instant-img-container .control-nav li{padding:0;margin:0 3px 0 0;float:left;background:none;font-size:18px;position:relative}.instant-img-container .control-nav li button{padding:0 24px 0 2px;height:42px;line-height:42px;display:block;color:#999;text-decoration:none;-webkit-box-shadow:none;box-shadow:none;background-color:transparent;background-position:96%;background-repeat:no-repeat;border:none;cursor:pointer}.instant-img-container .control-nav li button:focus,.instant-img-container .control-nav li button:hover{color:#111;outline:none;-webkit-box-shadow:none;box-shadow:none}.instant-img-container .control-nav li button:focus{text-decoration:underline}.instant-img-container .control-nav li button.active{color:#333;cursor:default;font-weight:600}.instant-img-container .control-nav li button.loading{background-image:url(../img/ajax-loader.gif)}@media screen and (max-width:800px){.instant-img-container .control-nav li{font-size:16px;margin:0}.instant-img-container .control-nav li button{padding-left:3px}}@media screen and (max-width:600px){.instant-img-container .control-nav li{text-align:center;margin:0;padding-bottom:15px}}.instant-img-container .control-nav li.search-field{width:40%;margin:0;margin-left:auto;max-width:500px}@media screen and (max-width:600px){.instant-img-container .control-nav li.search-field{width:100%;display:block;position:static;padding-bottom:0;text-align:left;max-width:100%}}.instant-img-container .control-nav li.search-field .searchResults{position:absolute;right:100.5%;top:4px;width:auto;height:34px;line-height:34px;padding:0 0 0 10px;background:#586ec6;border:1px solid #455cb6;-webkit-border-radius:3px;border-radius:3px;z-index:99;font-size:13px;font-weight:500;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;color:#fff;-webkit-box-shadow:0 2px 3px rgba(0,0,0,.05);box-shadow:0 2px 3px rgba(0,0,0,.05);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.instant-img-container .control-nav li.search-field .searchResults span{cursor:help;font-style:italic}.instant-img-container .control-nav li.search-field .searchResults button{color:#fff;padding:0;height:auto;line-height:1;width:30px;font-weight:700;opacity:.65;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:14px;height:100%}.instant-img-container .control-nav li.search-field .searchResults button:focus,.instant-img-container .control-nav li.search-field .searchResults button:hover{opacity:1}.instant-img-container .control-nav li.search-field .searchResults:after,.instant-img-container .control-nav li.search-field .searchResults:before{left:100%;top:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;z-index:100}.instant-img-container .control-nav li.search-field .searchResults:after{border-color:hsla(62,46%,78%,0);border-left-color:#586ec6;border-width:6px;margin-top:-6px}.instant-img-container .control-nav li.search-field .searchResults:before{border-color:transparent;border-left-color:#455cb6;border-width:7px;margin-top:-7px}.instant-img-container .control-nav li.search-field .searchResults.hide{opacity:0;visibility:hidden}.instant-img-container .control-nav li.search-field form{padding:0 1px 0 0;margin:0;position:relative;height:42px;display:block}.instant-img-container .control-nav li.search-field form:hover button[type=submit]{opacity:1}.instant-img-container .control-nav li.search-field input{width:100%;padding:0 10px 0 42px;border:1px solid #e1e1e1;background-color:#f7f7f7!important;height:42px;line-height:42px;-webkit-border-radius:5px;border-radius:5px;font-size:16px;-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.instant-img-container .control-nav li.search-field input:focus{border-color:#999;-webkit-box-shadow:0 0 1px 4px rgba(0,0,0,.065);box-shadow:0 0 1px 4px rgba(0,0,0,.065)}.instant-img-container .control-nav li.search-field input.searching{padding-left:62px;background-image:url(../img/ajax-loader.gif);background-position:37px;background-repeat:no-repeat}.instant-img-container .control-nav li.search-field input[type=search]::-webkit-search-cancel-button,.instant-img-container .control-nav li.search-field input[type=search]::-webkit-search-decoration,.instant-img-container .control-nav li.search-field input[type=search]::-webkit-search-results-button,.instant-img-container .control-nav li.search-field input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}.instant-img-container .control-nav li.search-field button[type=submit]{position:absolute;left:0;top:0;width:42px;height:42px;line-height:42px;z-index:1;border:none!important;background:transparent!important;cursor:pointer;color:#666;-webkit-box-shadow:none!important;box-shadow:none!important;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;opacity:.5;margin:0;padding:0}.instant-img-container .control-nav li.search-field button[type=submit]:focus,.instant-img-container .control-nav li.search-field button[type=submit]:hover{outline:none;color:#586ec6}.instant-img-container .control-nav li.search-field input[type=search]::-webkit-input-placeholder{color:#ccc;font-weight:400;font-style:normal}.instant-img-container .control-nav li.search-field input[type=search]:-moz-placeholder,.instant-img-container .control-nav li.search-field input[type=search]::-moz-placeholder{color:#ccc;font-weight:400;font-style:normal}.instant-img-container .control-nav li.search-field input[type=search]:-ms-input-placeholder{color:#ccc;font-weight:400;font-style:normal}#photos{width:100%;width:calc(100% + 10px);margin:0 0 0 -5px;padding:0;position:relative}#photos .photo{width:20%;margin:0;padding:0 5px 10px;opacity:0;-webkit-transition:opacity .3s ease;-o-transition:opacity .3s ease;transition:opacity .3s ease}#photos .photo--wrap{position:relative}#photos .photo.in-view{opacity:1}#photos .photo.in-progress .fade{opacity:0!important;visibility:hidden!important}#photos .photo .img-wrap{display:block;overflow:hidden;position:relative}@media screen and (min-width:2000px){#photos .photo{width:20%}}@media screen and (max-width:1570px){#photos .photo{width:25%}}@media screen and (max-width:1270px){#photos .photo{width:33.333333%}}@media screen and (max-width:800px){#photos .photo{width:50%}}@media screen and (max-width:600px){#photos .photo{width:100%;margin:0 0 2%}}#photos .photo:focus a.upload img{opacity:.6}#photos .photo:focus .fade{opacity:1;visibility:visible}#photos .photo:focus .fade.user{opacity:.7}#photos .photo:focus-within .user-controls{opacity:1}#photos .photo a.upload{display:block;position:relative;background-color:#222;background-position:50%;background-repeat:no-repeat;background-image:url(../img/ajax-loader.gif);overflow:hidden}#photos .photo a.upload.loaded{background-image:none}#photos .photo a.upload:active,#photos .photo a.upload:focus{outline:none;border:none}#photos .photo a.upload img{-webkit-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;width:100%;height:auto!important;padding:0;vertical-align:top}#photos .photo a.upload .status{visibility:hidden;opacity:0;-webkit-transition:all .25s ease-in-out;-o-transition:all .25s ease-in-out;transition:all .25s ease-in-out;width:60px;height:60px;line-height:60px;-webkit-border-radius:4px;border-radius:4px;position:absolute;left:50%;top:50%;z-index:5;-webkit-transform:translate(-50%,-50%) scale(1.2);-ms-transform:translate(-50%,-50%) scale(1.2);transform:translate(-50%,-50%) scale(1.2);-webkit-box-shadow:0 2px 3px rgba(0,0,0,.25);box-shadow:0 2px 3px rgba(0,0,0,.25);background-position:50%;background-repeat:no-repeat}#photos .photo a.upload .status:before{font-family:FontAwesome;display:block;color:#fff;font-size:24px;opacity:.8}#photos .photo a.upload .status a{color:#fff}#photos .photo a.upload.errors .status,#photos .photo a.upload.success .status,#photos .photo a.upload.uploading .status{text-align:center;left:50%;top:50%;-webkit-transform:translate(-50%,-50%) scale(1);-ms-transform:translate(-50%,-50%) scale(1);transform:translate(-50%,-50%) scale(1)}#photos .photo a.upload.uploading{cursor:default!important}#photos .photo a.upload.uploading .status{visibility:visible;opacity:1;background:hsla(0,0%,100%,.95) url(../img/ajax-loader-lg.gif) no-repeat 50%;-webkit-background-size:24px 24px;background-size:24px 24px}#photos .photo a.upload.uploading .status:before{display:none}#photos .photo a.upload.success{cursor:default!important}#photos .photo a.upload.success .status{visibility:visible;opacity:1;background-color:#65c774}#photos .photo a.upload.success .status:before{content:"\F00C";color:#fff}#photos .photo a.upload.success img{-webkit-transform:scale(1)!important;-ms-transform:scale(1)!important;transform:scale(1)!important}#photos .photo a.upload.errors{cursor:help!important}#photos .photo a.upload.errors .status{visibility:visible;opacity:1;background-color:#df3333}#photos .photo a.upload.errors .status:before{content:"\F12A";color:#fff;opacity:.8}#photos .photo.uploaded a.upload img{opacity:.25!important}#photos .photo.uploaded .options,#photos .photo.uploaded .user-controls{opacity:0!important;visibility:hidden!important}#photos .photo.in-progress a.upload img,#photos .photo:hover a.upload img{opacity:.7;-webkit-transform:scale(1.075);-ms-transform:scale(1.075);transform:scale(1.075)}#photos .photo.in-progress .options,#photos .photo:hover .options{opacity:1;visibility:visible}#photos .photo.in-progress .options i.heart-like,#photos .photo:hover .options i.heart-like{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}#photos .photo.in-progress .user-controls,#photos .photo:hover .user-controls{opacity:1}#photos .photo.in-progress .notice-msg{top:0;opacity:1}#photos .photo.in-progress .options,#photos .photo.in-progress .user-controls{opacity:0!important}#photos .photo .options{position:absolute;top:5px;right:5px;z-index:6;display:inline-block;width:auto;cursor:default!important;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease;opacity:0;visibility:hidden;font-size:13px}#photos .photo .options i{font-size:14px}#photos .photo .options i.heart-like{color:#d13714;-webkit-transition:all .25s ease .05s;-o-transition:all .25s ease .05s;transition:all .25s ease .05s;-webkit-transform:scale(.55);-ms-transform:scale(.55);transform:scale(.55);margin-right:2px;position:relative;top:0;font-size:14px;opacity:.9}#photos .photo .options a,#photos .photo .options span{display:inline-block;vertical-align:top;line-height:30px;padding:0 10px;padding-top:1px;background:hsla(0,0%,100%,.5);margin:0;-webkit-border-radius:2px;border-radius:2px;color:#23282d;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease}#photos .photo .options span{cursor:default}#photos .photo .options span:focus,#photos .photo .options span:hover{background-color:#fff}#photos .photo .options a{margin-left:2px}#photos .photo .options a:focus,#photos .photo .options a:hover{background-color:#fff}#photos .photo .options a i{position:relative;top:1px;left:1px}#photos .photo .user-controls{position:absolute;z-index:6;bottom:0;left:0;width:100%;background:rgba(0,0,0,.4);padding:0;opacity:.35;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease}#photos .photo .photo-options{float:right;text-align:right;max-width:50%}#photos .photo .fade{-webkit-transition:all .35s ease;-o-transition:all .35s ease;transition:all .35s ease;color:#fff;background:hsla(0,0%,100%,.75);background:transparent;-webkit-border-radius:2px;border-radius:2px;height:34px;line-height:34px;font-size:17px;z-index:6;float:left;margin:1px 1px 1px 0;padding:0;color:hsla(0,0%,100%,.75);border:none!important;outline:none;cursor:pointer}#photos .photo .fade.edit-photo,#photos .photo .fade.edit-photo-admin,#photos .photo .fade.insert,#photos .photo .fade.set-featured{display:inline-block;width:34px;text-align:center;position:relative}#photos .photo .fade.edit-photo-admin i,#photos .photo .fade.edit-photo i,#photos .photo .fade.insert i,#photos .photo .fade.set-featured i{line-height:27px;position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}#photos .photo .fade.edit-photo-admin:focus,#photos .photo .fade.edit-photo-admin:hover,#photos .photo .fade.edit-photo:focus,#photos .photo .fade.edit-photo:hover,#photos .photo .fade.insert:focus,#photos .photo .fade.insert:hover,#photos .photo .fade.set-featured:focus,#photos .photo .fade.set-featured:hover{color:#222;background:hsla(0,0%,100%,.95)}#photos .photo .fade.edit-photo-admin{display:none}#photos .photo .fade.user{background:none;font-size:13px;max-width:48%;cursor:pointer;text-decoration:none;border:none;line-height:35px;height:36px;margin:0}#photos .photo .fade.user:focus,#photos .photo .fade.user:hover{text-decoration:underline}#photos .photo .fade.user .user-wrap{position:relative;padding-left:35px;display:block;width:100%;overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap}#photos .photo .fade.user .user-wrap:before{content:"";display:block;z-index:0;background-color:#fff;height:20px;opacity:.25}#photos .photo .fade.user .user-wrap:before,#photos .photo .fade.user img{width:20px;max-width:20px;-webkit-border-radius:100%;border-radius:100%;position:absolute;left:8px;top:8px}#photos .photo .fade.user img{z-index:1}#photos .photo .notice-msg{position:absolute;z-index:999;top:-40px;left:0;height:40px;line-height:40px;width:100%;background:rgba(0,0,0,.6);text-align:center;color:hsla(0,0%,100%,.9);font-size:12px;margin:0;padding:0;-webkit-transition:all .25s ease-in-out;-o-transition:all .25s ease-in-out;transition:all .25s ease-in-out;opacity:0;z-index:9999}#photos .photo .notice-msg.has-error{top:-40px;opacity:0}#photos .edit-screen{position:absolute;left:0;top:0;width:100%;height:100%;z-index:999;background:hsla(0,0%,100%,.9);opacity:0;visibility:hidden;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;padding:5px;overflow-y:auto;-webkit-overflow-scrolling:touch;border:1px solid #e1e1e1;-webkit-transform:scale(1.025);-ms-transform:scale(1.025);transform:scale(1.025)}#photos .edit-screen.editing{visibility:visible;opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}#photos .edit-screen--controls,#photos .edit-screen--title{display:block;background:#f7f7f7;border:1px solid #e1e1e1;padding:15px 10px;-webkit-border-radius:2px 2px 0 0;border-radius:2px 2px 0 0}#photos .edit-screen--controls .button-primary,#photos .edit-screen--title .button-primary{float:right}#photos .edit-screen--controls{-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px}#photos .edit-screen--title{border-bottom:none;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;width:100%;padding:10px;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}#photos .edit-screen--title>div{padding:5px 15px 5px 5px;-webkit-box-flex:1;-ms-flex:1;flex:1}#photos .edit-screen--title>div.preview{width:30%;padding:0;-webkit-background-size:cover;background-size:cover;background-position:50%;background-repeat:no-repeat;-webkit-border-radius:2px;border-radius:2px;-webkit-box-flex:0;-ms-flex:none;flex:none}#photos .edit-screen--title p{font-size:12px;line-height:1.45;margin:0;color:#999}#photos .edit-screen--title p.heading{color:#222;margin:0 0 3px;font-weight:600;text-transform:uppercase}#photos .edit-screen .add-attribution-row,#photos .edit-screen label{margin:0;padding:15px;display:block;background:#fff;border:1px solid #e1e1e1;border-bottom:none;position:relative}#photos .edit-screen .add-attribution-row{padding-top:0;margin-top:-15px;border-top:none}#photos .edit-screen .add-attribution-row button{cursor:pointer;font-size:11px;outline:none;padding:5px 0;border:none;background:none;text-decoration:underline}#photos .edit-screen .add-attribution-row button:focus,#photos .edit-screen .add-attribution-row button:hover{text-decoration:none}#photos .edit-screen span{display:block;font-size:11px;text-transform:uppercase;font-weight:600;margin:0 0 5px;color:#222;line-height:1}#photos .edit-screen textarea{resize:none;font-size:12px;line-height:1.35}#photos .edit-screen input{font-size:12px;padding:0 10px;margin:0;height:35px;line-height:35px}#photos .edit-screen em{position:absolute;bottom:15px;right:15px;height:35px;line-height:35px;background:#858585;-webkit-border-radius:0 2px 2px 0;border-radius:0 2px 2px 0;color:#e1e1e1;font-style:normal;font-size:11px;padding:0 10px}.instant-images-settings{display:none;background-color:#efefef;border-top:1px solid #e1e1e1;border-bottom:1px solid #e1e1e1}.instant-images-settings .cnkt-sidebar{padding:20px 25px;overflow:hidden;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;line-height:1.45}.instant-images-settings .cnkt-sidebar p{font-size:13px}.instant-images-settings .cnkt-sidebar .cta{width:100%;background:#fff;padding:0;position:relative;border:1px solid #e1e1e1;-webkit-border-radius:3px;border-radius:3px;overflow:hidden}@media screen and (min-width:800px){.instant-images-settings .cnkt-sidebar .cta{width:calc(65% - 10px)}}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;padding-bottom:52px}@media screen and (min-width:800px){.instant-images-settings .cnkt-sidebar .cta.ii-whats-new{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;margin:0;padding:15px}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li{line-height:1.45;width:100%;background-color:transparent;padding:5px;margin:0;position:relative;display:-webkit-box;display:-ms-flexbox;display:flex}@media screen and (min-width:1024px){.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li{width:50%}}@media screen and (min-width:1270px){.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li{width:33.333%}}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li p{font-size:13px;position:relative;z-index:1;margin:0;padding:15px;border:1px solid #e1e1e1}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li p strong{font-size:14px;display:block;font-weight:700;margin:0 0 5px;color:#333}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new ul li code{font-size:12px;margin:0;padding:3px;background:#f7f7f7;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 0 1px #efefef;box-shadow:0 0 0 1px #efefef}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new .with-love{position:absolute;left:0;bottom:0;width:100%;-webkit-border-radius:0 0 2px 2px;border-radius:0 0 2px 2px;background-color:#f7f7f7;border-top:1px solid #e1e1e1;text-align:center;margin:0;padding:15px}.instant-images-settings .cnkt-sidebar .cta.ii-whats-new .with-love p{margin:0}.instant-images-settings .cnkt-sidebar .cta.ii-settings{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}@media screen and (min-width:800px){.instant-images-settings .cnkt-sidebar .cta.ii-settings{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2;width:35%}}.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type=number],.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type=text],.instant-images-settings .cnkt-sidebar .cta.ii-settings select{background-color:#fff;width:100%;padding:5px 10px;border-color:#ccc;max-width:none}.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type=number],.instant-images-settings .cnkt-sidebar .cta.ii-settings input[type=text]{padding:10px}.instant-images-settings .cnkt-sidebar .cta.ii-settings span.desc{font-size:11px;display:block;padding:5px 2px}.instant-images-settings .cnkt-sidebar .cta.ii-plugins{width:100%;margin-top:10px;-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer{width:100%;position:static;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:20px 20px 0}.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer .plugin{width:100%;margin:0 0 20px;line-height:1.45}@media screen and (min-width:800px){.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer .plugin{width:calc(50% - 10px)}}.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer .plugin h2{margin-bottom:5px}.instant-images-settings .cnkt-sidebar .cta.ii-plugins .cnkt-plugin-installer:after{display:none}.instant-images-settings .cnkt-sidebar h2{border:none;padding:20px 20px 0;font-size:18px;font-weight:700}.instant-images-settings .cnkt-sidebar h2+p{padding:0 20px 16px;margin:0!important;border-bottom:1px solid #e1e1e1}.instant-images-settings .cnkt-sidebar h2,.instant-images-settings .cnkt-sidebar h2+p{background:#f7f7f7;margin:0}.instant-images-settings .cnkt-sidebar .cnkt-sidebar h3,.instant-images-settings .cnkt-sidebar .cnkt-sidebar h4{margin-top:0}.instant-images-settings .cnkt-sidebar .cta-wrap{display:block;padding:20px}.instant-images-settings .cnkt-sidebar .cta-wrap h4{padding:10px 0 7px;margin:0}.instant-images-settings .cnkt-sidebar .cta-wrap h4 span{display:inline-block;line-height:1;padding:8px 10px;-webkit-border-radius:2px;border-radius:2px;background:#ffc;color:#666}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin{width:48%;margin:2% 1% 0}@media screen and (max-width:1170px){.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin{width:100%;margin:2% 0 0}}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2{border:none;padding:0;font-size:16px}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2+p{padding:0;margin:0!important;border-bottom:none}.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2,.instant-images-settings .cnkt-sidebar .cnkt-plugin-installer .plugin h2+p{background:none;margin:0}.instant-images-settings table{margin-top:5px}.instant-img-container[data-media-popup=true]{background:#fff}.instant-img-container[data-media-popup=true] .header-wrap{display:none}.instant-img-container[data-media-popup=true] .instant-images-wrapper{padding:0 16px}body.loading .instant-img-container .loading-block{display:block}.instant-images-sidebar-icon,.instant-images-sidebar-icon svg{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto}.instant-images-sidebar-icon svg{height:20px;width:20px}.instant-images-sidebar-icon svg,.instant-images-sidebar-icon svg *{stroke:#586ec6!important;fill:#586ec6!important}.components-panel .instant-img-container .load-more-wrap{display:block}.components-panel .no-results{padding:40px}.components-panel .no-results h3{font-size:18px}.components-panel .no-results p{font-size:13px}.components-panel #photos{width:100%;margin:0;padding:5px}.components-panel #photos .photo{width:100%;display:block;opacity:1!important;margin:0 0 5px;padding:0}.components-panel .provider-nav{width:100%;padding:5px;margin:0;border-bottom-color:#ddd}.components-panel .provider-nav button{font-size:13px;padding-left:32px}.components-panel .control-nav{padding:0 5px 5px;border-bottom:1px solid #ddd}.components-panel .control-nav li{font-size:13px}.components-panel .control-nav li button{padding-left:4px}.components-panel .control-nav li a{padding:16px 24px 16px 0;height:auto;line-height:1.2}.components-panel .control-nav li.search-field{float:none;width:100%;padding:0;clear:both}.components-panel .control-nav li.search-field form{height:auto}.components-panel .control-nav li.search-field:before{content:"";display:table;clear:both}.components-panel .control-nav li.search-field button[type=submit]{display:none}.components-panel .control-nav li.search-field input{line-height:40px;height:40px;padding-right:10px;padding-left:10px;border-color:#e2e4e7;font-size:13px;-webkit-border-radius:3px!important;border-radius:3px!important}.components-panel .control-nav li.search-field input.searching{padding-left:30px;background-position:8px}.components-panel .control-nav li.search-field input:focus{-webkit-box-shadow:none;box-shadow:none}.components-panel .control-nav li.search-field .searchResults{right:2px;left:auto;top:2px;-webkit-border-radius:2px;border-radius:2px;font-size:12px;height:36px;line-height:35px}.components-panel .control-nav li.search-field .searchResults:after,.components-panel .control-nav li.search-field .searchResults:before{display:none}.components-panel .orientation-list{position:static;border-top:none;background:#f7f7f7;padding:5px 5px 5px 0;margin-bottom:5px;border-bottom-color:#ddd}.components-panel .orientation-list span{display:none}.components-panel .orientation-list ul{padding:0;width:100%}.instant-img-container #tooltip{display:inline-block;padding:8px 10px;background:#fff;position:fixed;left:auto;top:auto;z-index:999;display:block;opacity:0;visibility:hidden;margin-top:-37px;font-size:12px;color:#999;text-align:center;line-height:1;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 2px 3px rgba(0,0,0,.1);box-shadow:0 2px 3px rgba(0,0,0,.1);-webkit-transition:all .15s ease;-o-transition:all .15s ease;transition:all .15s ease}.instant-img-container #tooltip:after{top:100%;right:17px;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:hsla(0,0%,100%,0);border-top-color:#fff;border-width:5px;margin-left:-5px}.instant-img-container #tooltip.over{opacity:.9;visibility:visible}.instant-img-container #tooltip.above{margin-top:37px}.instant-img-container #tooltip.above:after{top:-5px;border-top:none;border-bottom-color:#fff}.no-results{display:block;padding:150px 100px;text-align:center}.no-results h3{font-size:24px;line-height:29px;margin:0 0 10px}.no-results p{font-size:16px;margin:0}@media screen and (max-width:800px){.no-results{padding:50px}}.orientation-list{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;padding:7px 0;margin:0 0 10px;border-top:1px solid #efefef;border-bottom:1px solid #efefef;position:relative;top:-7px}.orientation-list span{opacity:.5;margin:0 10px 0 0;font-size:13px}.orientation-list span i{margin-right:2px}.orientation-list ul{-webkit-box-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-ms-flexbox;display:flex}.orientation-list ul li{margin:0 1px 0 0;-webkit-border-radius:3px;border-radius:3px;cursor:pointer;padding:4px 6px;-webkit-transition:all .25s ease;-o-transition:all .25s ease;transition:all .25s ease;border:1px solid transparent;color:#999;font-size:13px}.orientation-list ul li:hover{color:#111}.orientation-list ul li:focus{border-color:#586ec6;color:#111;outline:none}.orientation-list ul li.active{background-color:#586ec6;border-color:#586ec6;color:#fff;outline:none}.media-frame-content .instant-img-container .load-more-wrap{display:block}.media-frame-content .instant-img-container .provider-nav,.provider-nav{padding:10px 25px}.provider-nav{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;width:calc(100% + 50px);margin-left:-25px;border-bottom:1px solid #efefef;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.045);box-shadow:0 2px 5px rgba(0,0,0,.045);background-color:#f7f7f7}.provider-nav,.provider-nav>div{position:relative}.provider-nav--btn{padding:8px 8px 8px 35px;border:1px solid transparent;background:transparent;margin-right:5px;cursor:pointer;position:relative;-webkit-border-radius:3px;border-radius:3px;font-size:14px;color:#999;-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;background-color:#f7f7f7}.provider-nav--btn:focus,.provider-nav--btn:hover{color:#333}.provider-nav--btn.active{background-color:#fff;border-color:#e1e1e1;color:#333;cursor:default;-webkit-box-shadow:0 0 6px rgba(0,0,0,.075);box-shadow:0 0 6px rgba(0,0,0,.075)}.provider-nav--new{color:#333;background-color:#ffe732;font-size:9px;text-transform:uppercase;display:inline;padding:3px 4px;-webkit-border-radius:3px;border-radius:3px;margin-left:5px;position:relative;top:-1px;letter-spacing:-.05rem}[data-provider=unsplash]{background:url(../img/unsplash.svg) no-repeat 8px;-webkit-background-size:18px 18px;background-size:18px 18px}[data-provider=pixabay]{background:url(../img/pixabay.png) no-repeat 8px;-webkit-background-size:20px 20px;background-size:20px 20px}.media-frame-content .instant-img-container .api-lightbox{position:fixed}.components-panel .instant-img-container .api-lightbox{height:100%;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.instant-img-container .api-lightbox{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;z-index:99999;left:0;top:0;right:0;bottom:0;height:100vh;padding:5%;background-color:rgba(0,0,0,.75);font-size:13px}.instant-img-container .api-lightbox.active>div{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:1}.instant-img-container .api-lightbox>div{max-width:450px;width:100%;padding:0;background-color:#fff;border:1px solid #e1e1e1;-webkit-border-radius:5px;border-radius:5px;-webkit-box-shadow:0 1px 5px rgba(0,0,0,.25);box-shadow:0 1px 5px rgba(0,0,0,.25);position:relative;-webkit-transform:scale(.95);-ms-transform:scale(.95);transform:scale(.95);opacity:0;-webkit-transition:all .3s ease-in-out;-o-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.instant-img-container .api-lightbox>div>div{position:relative}.instant-img-container .api-lightbox--details{border-bottom:1px solid #e1e1e1;padding:25px;padding-bottom:20px;position:relative}.instant-img-container .api-lightbox--details:after,.instant-img-container .api-lightbox--details:before{top:100%;left:50px;border:solid transparent;content:"";height:0;width:0;position:absolute;pointer-events:none}.instant-img-container .api-lightbox--details:after{border-color:hsla(0,0%,100%,0);border-top-color:#fff;border-width:10px;margin-left:-10px}.instant-img-container .api-lightbox--details:before{border-color:rgba(194,225,245,0);border-top-color:#e1e1e1;border-width:11px;margin-left:-11px}.instant-img-container .api-lightbox--details h3{font-size:16px;line-height:18px;padding:0 0 0 25px;text-transform:uppercase;margin:0 0 10px;background-position:0}.instant-img-container .api-lightbox--details p{font-size:13px;margin:0 0 5px}.instant-img-container .api-lightbox--details p a{font-weight:500}.instant-img-container .api-lightbox--close{position:absolute;z-index:1;right:0;top:0;border:none;background-color:transparent;width:40px;height:40px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:25px;cursor:pointer;opacity:.5}.instant-img-container .api-lightbox--close:focus,.instant-img-container .api-lightbox--close:hover{opacity:1}.instant-img-container .api-lightbox form{display:block;background-color:#f7f7f7;padding:25px}.instant-img-container .api-lightbox button[type=submit],.instant-img-container .api-lightbox label{font-size:12px;text-transform:uppercase;font-weight:600;display:block;padding:0;margin:0 0 5px;cursor:pointer}.instant-img-container .api-lightbox--input-wrap{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0;margin-bottom:10px;background-color:#fff;border:1px solid #e1e1e1;-webkit-border-radius:3px;border-radius:3px;-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease}.instant-img-container .api-lightbox--input-wrap:focus-within{border-color:#999;-webkit-box-shadow:0 0 1px 4px rgba(0,0,0,.065);box-shadow:0 0 1px 4px rgba(0,0,0,.065)}.instant-img-container .api-lightbox--input-wrap span{width:40px;height:40px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-border-radius:2px 0 0 2px;border-radius:2px 0 0 2px;border-right:1px solid #e1e1e1;background-color:#f7f7f7}.instant-img-container .api-lightbox--input-wrap span i{font-size:16px}.instant-img-container .api-lightbox--input-wrap span.invalid{cursor:help}.instant-img-container .api-lightbox--input-wrap span.invalid i{color:#d4aa4d}.instant-img-container .api-lightbox--input-wrap span.valid i{color:#65c774}.instant-img-container .api-lightbox--input-wrap span.loading i{color:#333}.instant-img-container .api-lightbox--input-wrap input{line-height:40px;height:40px;padding:0 10px;background-color:transparent;border:none;-webkit-box-flex:1;-ms-flex:1;flex:1;font-size:12px}.instant-img-container .api-lightbox--input-wrap input::-webkit-input-placeholder{color:#999;font-weight:400;font-style:italic}.instant-img-container .api-lightbox--input-wrap input:-moz-placeholder,.instant-img-container .api-lightbox--input-wrap input::-moz-placeholder{color:#999;font-weight:400;font-style:italic}.instant-img-container .api-lightbox--input-wrap input:-ms-input-placeholder{color:#999;font-weight:400;font-style:italic}.instant-img-container .api-lightbox--input-wrap input:focus{background:transparent;outline:none;border:none;-webkit-box-shadow:none;box-shadow:none}.instant-img-container .api-lightbox button[type=submit]{width:100%;border:none;background-color:#586ec6;color:#fff;-webkit-border-radius:3px;border-radius:3px;padding:0 10px;line-height:46px;height:46px;margin:0}.instant-img-container .api-lightbox button[type=submit]:focus,.instant-img-container .api-lightbox button[type=submit]:hover{background-color:#455cb6}.instant-img-container .api-lightbox--response{color:#df3333;margin:0;font-size:13px;font-weight:500;padding:0 2px 12px}.instant-img-container .api-lightbox--response.valid{color:#51a75e}
|
dist/img/pixabay.png
ADDED
Binary file
|
dist/img/unsplash.png
ADDED
Binary file
|
dist/img/unsplash.svg
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg">
|
2 |
+
<path d="M10 9V0h12v9H10zm12 5h10v18H0V14h10v9h12v-9z" fill="#000000" fill-rule="nonzero" />
|
3 |
+
</svg>
|
dist/js/instant-images-block.js
CHANGED
@@ -120,6 +120,7 @@ module.exports = function xhrAdapter(config) {
|
|
120 |
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
121 |
var requestData = config.data;
|
122 |
var requestHeaders = config.headers;
|
|
|
123 |
|
124 |
if (utils.isFormData(requestData)) {
|
125 |
delete requestHeaders['Content-Type']; // Let the browser set it
|
@@ -140,23 +141,14 @@ module.exports = function xhrAdapter(config) {
|
|
140 |
// Set the request timeout in MS
|
141 |
request.timeout = config.timeout;
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
if (!request || request.readyState !== 4) {
|
146 |
-
return;
|
147 |
-
}
|
148 |
-
|
149 |
-
// The request errored out and we didn't get a response, this will be
|
150 |
-
// handled by onerror instead
|
151 |
-
// With one exception: request that using file: protocol, most browsers
|
152 |
-
// will return status as 0 even though it's a successful request
|
153 |
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
154 |
return;
|
155 |
}
|
156 |
-
|
157 |
// Prepare the response
|
158 |
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
159 |
-
var responseData = !
|
|
|
160 |
var response = {
|
161 |
data: responseData,
|
162 |
status: request.status,
|
@@ -170,7 +162,30 @@ module.exports = function xhrAdapter(config) {
|
|
170 |
|
171 |
// Clean up request
|
172 |
request = null;
|
173 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
// Handle browser request cancellation (as opposed to a manual cancellation)
|
176 |
request.onabort = function handleAbort() {
|
@@ -200,7 +215,10 @@ module.exports = function xhrAdapter(config) {
|
|
200 |
if (config.timeoutErrorMessage) {
|
201 |
timeoutErrorMessage = config.timeoutErrorMessage;
|
202 |
}
|
203 |
-
reject(createError(
|
|
|
|
|
|
|
204 |
request));
|
205 |
|
206 |
// Clean up request
|
@@ -240,16 +258,8 @@ module.exports = function xhrAdapter(config) {
|
|
240 |
}
|
241 |
|
242 |
// Add responseType to request if needed
|
243 |
-
if (
|
244 |
-
|
245 |
-
request.responseType = config.responseType;
|
246 |
-
} catch (e) {
|
247 |
-
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
248 |
-
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
249 |
-
if (config.responseType !== 'json') {
|
250 |
-
throw e;
|
251 |
-
}
|
252 |
-
}
|
253 |
}
|
254 |
|
255 |
// Handle progress if needed
|
@@ -488,7 +498,9 @@ var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/ax
|
|
488 |
var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
|
489 |
var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
|
490 |
var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
|
|
|
491 |
|
|
|
492 |
/**
|
493 |
* Create a new instance of Axios
|
494 |
*
|
@@ -528,20 +540,71 @@ Axios.prototype.request = function request(config) {
|
|
528 |
config.method = 'get';
|
529 |
}
|
530 |
|
531 |
-
|
532 |
-
|
533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
|
|
|
|
|
|
|
535 |
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
537 |
});
|
538 |
|
|
|
539 |
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
540 |
-
|
541 |
});
|
542 |
|
543 |
-
|
544 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
}
|
546 |
|
547 |
return promise;
|
@@ -604,10 +667,12 @@ function InterceptorManager() {
|
|
604 |
*
|
605 |
* @return {Number} An ID used to remove interceptor later
|
606 |
*/
|
607 |
-
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
608 |
this.handlers.push({
|
609 |
fulfilled: fulfilled,
|
610 |
-
rejected: rejected
|
|
|
|
|
611 |
});
|
612 |
return this.handlers.length - 1;
|
613 |
};
|
@@ -743,7 +808,8 @@ module.exports = function dispatchRequest(config) {
|
|
743 |
config.headers = config.headers || {};
|
744 |
|
745 |
// Transform request data
|
746 |
-
config.data = transformData(
|
|
|
747 |
config.data,
|
748 |
config.headers,
|
749 |
config.transformRequest
|
@@ -769,7 +835,8 @@ module.exports = function dispatchRequest(config) {
|
|
769 |
throwIfCancellationRequested(config);
|
770 |
|
771 |
// Transform response data
|
772 |
-
response.data = transformData(
|
|
|
773 |
response.data,
|
774 |
response.headers,
|
775 |
config.transformResponse
|
@@ -782,7 +849,8 @@ module.exports = function dispatchRequest(config) {
|
|
782 |
|
783 |
// Transform response data
|
784 |
if (reason && reason.response) {
|
785 |
-
reason.response.data = transformData(
|
|
|
786 |
reason.response.data,
|
787 |
reason.response.headers,
|
788 |
config.transformResponse
|
@@ -998,6 +1066,7 @@ module.exports = function settle(resolve, reject, response) {
|
|
998 |
|
999 |
|
1000 |
var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
|
|
|
1001 |
|
1002 |
/**
|
1003 |
* Transform the data for a request or a response
|
@@ -1008,9 +1077,10 @@ var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/util
|
|
1008 |
* @returns {*} The resulting transformed data
|
1009 |
*/
|
1010 |
module.exports = function transformData(data, headers, fns) {
|
|
|
1011 |
/*eslint no-param-reassign:0*/
|
1012 |
utils.forEach(fns, function transform(fn) {
|
1013 |
-
data = fn(data, headers);
|
1014 |
});
|
1015 |
|
1016 |
return data;
|
@@ -1031,6 +1101,7 @@ module.exports = function transformData(data, headers, fns) {
|
|
1031 |
|
1032 |
var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
|
1033 |
var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
|
|
|
1034 |
|
1035 |
var DEFAULT_CONTENT_TYPE = {
|
1036 |
'Content-Type': 'application/x-www-form-urlencoded'
|
@@ -1054,12 +1125,35 @@ function getDefaultAdapter() {
|
|
1054 |
return adapter;
|
1055 |
}
|
1056 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1057 |
var defaults = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1058 |
adapter: getDefaultAdapter(),
|
1059 |
|
1060 |
transformRequest: [function transformRequest(data, headers) {
|
1061 |
normalizeHeaderName(headers, 'Accept');
|
1062 |
normalizeHeaderName(headers, 'Content-Type');
|
|
|
1063 |
if (utils.isFormData(data) ||
|
1064 |
utils.isArrayBuffer(data) ||
|
1065 |
utils.isBuffer(data) ||
|
@@ -1076,20 +1170,32 @@ var defaults = {
|
|
1076 |
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
1077 |
return data.toString();
|
1078 |
}
|
1079 |
-
if (utils.isObject(data)) {
|
1080 |
-
setContentTypeIfUnset(headers, 'application/json
|
1081 |
-
return
|
1082 |
}
|
1083 |
return data;
|
1084 |
}],
|
1085 |
|
1086 |
transformResponse: [function transformResponse(data) {
|
1087 |
-
|
1088 |
-
|
|
|
|
|
|
|
|
|
1089 |
try {
|
1090 |
-
|
1091 |
-
} catch (e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1092 |
}
|
|
|
1093 |
return data;
|
1094 |
}],
|
1095 |
|
@@ -1581,6 +1687,123 @@ module.exports = function spread(callback) {
|
|
1581 |
};
|
1582 |
|
1583 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1584 |
/***/ }),
|
1585 |
|
1586 |
/***/ "./node_modules/axios/lib/utils.js":
|
@@ -1595,8 +1818,6 @@ module.exports = function spread(callback) {
|
|
1595 |
|
1596 |
var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
|
1597 |
|
1598 |
-
/*global toString:true*/
|
1599 |
-
|
1600 |
// utils is a library of generic helper functions non-specific to axios
|
1601 |
|
1602 |
var toString = Object.prototype.toString;
|
@@ -1780,7 +2001,7 @@ function isURLSearchParams(val) {
|
|
1780 |
* @returns {String} The String freed of excess whitespace
|
1781 |
*/
|
1782 |
function trim(str) {
|
1783 |
-
return str.
|
1784 |
}
|
1785 |
|
1786 |
/**
|
@@ -1944,6 +2165,17 @@ module.exports = {
|
|
1944 |
};
|
1945 |
|
1946 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1947 |
/***/ }),
|
1948 |
|
1949 |
/***/ "./node_modules/classnames/index.js":
|
@@ -2438,8075 +2670,5508 @@ return utils;
|
|
2438 |
|
2439 |
/***/ }),
|
2440 |
|
2441 |
-
/***/ "./node_modules/
|
2442 |
-
|
2443 |
-
!*** ./node_modules/
|
2444 |
-
|
2445 |
/*! no static exports found */
|
2446 |
/***/ (function(module, exports, __webpack_require__) {
|
2447 |
|
2448 |
-
|
2449 |
-
* getSize v2.0.3
|
2450 |
-
* measure size of elements
|
2451 |
-
* MIT license
|
2452 |
-
*/
|
2453 |
|
2454 |
-
/* jshint browser: true, strict: true, undef: true, unused: true */
|
2455 |
-
/* globals console: false */
|
2456 |
|
2457 |
-
( function(
|
2458 |
-
/* jshint strict: false */ /* globals define, module */
|
2459 |
-
if ( true ) {
|
2460 |
-
// AMD
|
2461 |
-
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
2462 |
-
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
2463 |
-
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
2464 |
-
__WEBPACK_AMD_DEFINE_FACTORY__),
|
2465 |
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
2466 |
-
} else {}
|
2467 |
|
2468 |
-
|
2469 |
-
'use strict';
|
2470 |
|
2471 |
-
|
2472 |
|
2473 |
-
|
2474 |
-
function getStyleSize( value ) {
|
2475 |
-
var num = parseFloat( value );
|
2476 |
-
// not a percent like '100%', and a number
|
2477 |
-
var isValid = value.indexOf('%') == -1 && !isNaN( num );
|
2478 |
-
return isValid && num;
|
2479 |
-
}
|
2480 |
|
2481 |
-
function
|
2482 |
|
2483 |
-
|
2484 |
-
function( message ) {
|
2485 |
-
console.error( message );
|
2486 |
-
};
|
2487 |
|
2488 |
-
|
2489 |
|
2490 |
-
|
2491 |
-
'paddingLeft',
|
2492 |
-
'paddingRight',
|
2493 |
-
'paddingTop',
|
2494 |
-
'paddingBottom',
|
2495 |
-
'marginLeft',
|
2496 |
-
'marginRight',
|
2497 |
-
'marginTop',
|
2498 |
-
'marginBottom',
|
2499 |
-
'borderLeftWidth',
|
2500 |
-
'borderRightWidth',
|
2501 |
-
'borderTopWidth',
|
2502 |
-
'borderBottomWidth'
|
2503 |
-
];
|
2504 |
|
2505 |
-
|
2506 |
|
2507 |
-
function
|
2508 |
-
var size = {
|
2509 |
-
width: 0,
|
2510 |
-
height: 0,
|
2511 |
-
innerWidth: 0,
|
2512 |
-
innerHeight: 0,
|
2513 |
-
outerWidth: 0,
|
2514 |
-
outerHeight: 0
|
2515 |
-
};
|
2516 |
-
for ( var i=0; i < measurementsLength; i++ ) {
|
2517 |
-
var measurement = measurements[i];
|
2518 |
-
size[ measurement ] = 0;
|
2519 |
-
}
|
2520 |
-
return size;
|
2521 |
-
}
|
2522 |
|
2523 |
-
|
2524 |
|
2525 |
-
|
2526 |
-
* getStyle, get style of element, check for Firefox bug
|
2527 |
-
* https://bugzilla.mozilla.org/show_bug.cgi?id=548397
|
2528 |
-
*/
|
2529 |
-
function getStyle( elem ) {
|
2530 |
-
var style = getComputedStyle( elem );
|
2531 |
-
if ( !style ) {
|
2532 |
-
logError( 'Style returned ' + style +
|
2533 |
-
'. Are you running this code in a hidden iframe on Firefox? ' +
|
2534 |
-
'See https://bit.ly/getsizebug1' );
|
2535 |
-
}
|
2536 |
-
return style;
|
2537 |
-
}
|
2538 |
|
2539 |
-
|
2540 |
|
2541 |
-
var
|
2542 |
|
2543 |
-
var
|
|
|
|
|
|
|
2544 |
|
2545 |
-
|
2546 |
-
* setup
|
2547 |
-
* check isBoxSizerOuter
|
2548 |
-
* do on first getSize() rather than on page load for Firefox bug
|
2549 |
-
*/
|
2550 |
-
function setup() {
|
2551 |
-
// setup once
|
2552 |
-
if ( isSetup ) {
|
2553 |
-
return;
|
2554 |
-
}
|
2555 |
-
isSetup = true;
|
2556 |
|
2557 |
-
// -------------------------- box sizing -------------------------- //
|
2558 |
|
2559 |
-
|
2560 |
-
|
2561 |
-
* IE11 & Firefox<29 measures the inner-width
|
2562 |
-
*/
|
2563 |
-
var div = document.createElement('div');
|
2564 |
-
div.style.width = '200px';
|
2565 |
-
div.style.padding = '1px 2px 3px 4px';
|
2566 |
-
div.style.borderStyle = 'solid';
|
2567 |
-
div.style.borderWidth = '1px 2px 3px 4px';
|
2568 |
-
div.style.boxSizing = 'border-box';
|
2569 |
|
2570 |
-
var
|
2571 |
-
body.appendChild( div );
|
2572 |
-
var style = getStyle( div );
|
2573 |
-
// round value for browser zoom. desandro/masonry#928
|
2574 |
-
isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;
|
2575 |
-
getSize.isBoxSizeOuter = isBoxSizeOuter;
|
2576 |
|
2577 |
-
|
2578 |
-
|
2579 |
|
2580 |
-
|
2581 |
|
2582 |
-
|
2583 |
-
|
|
|
|
|
|
|
2584 |
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
|
2590 |
-
|
2591 |
-
|
2592 |
-
return;
|
2593 |
-
}
|
2594 |
|
2595 |
-
|
|
|
|
|
|
|
2596 |
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
|
|
2605 |
|
2606 |
-
|
|
|
|
|
|
|
2607 |
|
2608 |
-
// get all measurements
|
2609 |
-
for ( var i=0; i < measurementsLength; i++ ) {
|
2610 |
-
var measurement = measurements[i];
|
2611 |
-
var value = style[ measurement ];
|
2612 |
-
var num = parseFloat( value );
|
2613 |
-
// any 'auto', 'medium' value will be 0
|
2614 |
-
size[ measurement ] = !isNaN( num ) ? num : 0;
|
2615 |
-
}
|
2616 |
|
2617 |
-
|
2618 |
-
var paddingHeight = size.paddingTop + size.paddingBottom;
|
2619 |
-
var marginWidth = size.marginLeft + size.marginRight;
|
2620 |
-
var marginHeight = size.marginTop + size.marginBottom;
|
2621 |
-
var borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
2622 |
-
var borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
2623 |
|
2624 |
-
|
2625 |
|
2626 |
-
|
2627 |
-
|
2628 |
-
if ( styleWidth !== false ) {
|
2629 |
-
size.width = styleWidth +
|
2630 |
-
// add padding and border unless it's already including it
|
2631 |
-
( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
|
2632 |
-
}
|
2633 |
|
2634 |
-
var styleHeight = getStyleSize( style.height );
|
2635 |
-
if ( styleHeight !== false ) {
|
2636 |
-
size.height = styleHeight +
|
2637 |
-
// add padding and border unless it's already including it
|
2638 |
-
( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
|
2639 |
-
}
|
2640 |
|
2641 |
-
|
2642 |
-
|
|
|
|
|
2643 |
|
2644 |
-
|
2645 |
-
|
|
|
2646 |
|
2647 |
-
|
2648 |
-
}
|
2649 |
|
2650 |
-
|
|
|
2651 |
|
2652 |
-
|
|
|
|
|
|
|
2653 |
|
|
|
|
|
2654 |
|
2655 |
-
|
|
|
|
|
|
|
2656 |
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
|
|
|
|
|
|
2663 |
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
|
2670 |
-
|
2671 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2672 |
|
2673 |
-
|
|
|
|
|
|
|
2674 |
|
2675 |
-
|
2676 |
-
|
2677 |
-
|
2678 |
-
|
2679 |
-
|
2680 |
-
|
2681 |
-
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
2682 |
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
2683 |
-
} else {}
|
2684 |
|
2685 |
-
|
|
|
2686 |
|
2687 |
-
|
2688 |
|
2689 |
-
|
|
|
|
|
|
|
|
|
|
|
2690 |
|
2691 |
-
|
|
|
2692 |
|
2693 |
-
|
2694 |
-
|
2695 |
|
2696 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2697 |
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
a[ prop ] = b[ prop ];
|
2702 |
-
}
|
2703 |
-
return a;
|
2704 |
-
}
|
2705 |
|
2706 |
-
|
|
|
|
|
2707 |
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2714 |
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2719 |
}
|
2720 |
|
2721 |
-
|
2722 |
-
return [ obj ];
|
2723 |
}
|
2724 |
|
2725 |
-
|
|
|
|
|
2726 |
|
2727 |
-
|
2728 |
-
|
2729 |
-
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
var queryElem = elem;
|
2739 |
-
if ( typeof elem == 'string' ) {
|
2740 |
-
queryElem = document.querySelectorAll( elem );
|
2741 |
-
}
|
2742 |
-
// bail if bad element
|
2743 |
-
if ( !queryElem ) {
|
2744 |
-
console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) );
|
2745 |
-
return;
|
2746 |
}
|
2747 |
|
2748 |
-
|
2749 |
-
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2753 |
} else {
|
2754 |
-
|
2755 |
}
|
2756 |
|
2757 |
-
|
2758 |
-
|
2759 |
-
}
|
2760 |
|
2761 |
-
|
|
|
|
|
|
|
|
|
|
|
2762 |
|
2763 |
-
|
2764 |
-
|
2765 |
-
|
2766 |
-
|
2767 |
|
2768 |
-
|
2769 |
-
setTimeout( this.check.bind( this ) );
|
2770 |
-
}
|
2771 |
|
2772 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2773 |
|
2774 |
-
|
|
|
|
|
2775 |
|
2776 |
-
|
2777 |
-
|
|
|
|
|
|
|
|
|
2778 |
|
2779 |
-
|
2780 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2781 |
};
|
2782 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2783 |
/**
|
2784 |
-
*
|
|
|
|
|
|
|
|
|
2785 |
*/
|
2786 |
-
|
2787 |
-
|
2788 |
-
|
2789 |
-
|
2790 |
-
|
2791 |
-
// get background image on element
|
2792 |
-
if ( this.options.background === true ) {
|
2793 |
-
this.addElementBackgroundImages( elem );
|
2794 |
}
|
2795 |
|
2796 |
-
|
2797 |
-
// no non-element nodes, #143
|
2798 |
-
var nodeType = elem.nodeType;
|
2799 |
-
if ( !nodeType || !elementNodeTypes[ nodeType ] ) {
|
2800 |
-
return;
|
2801 |
-
}
|
2802 |
-
var childImgs = elem.querySelectorAll('img');
|
2803 |
-
// concat childElems to filterFound array
|
2804 |
-
for ( var i=0; i < childImgs.length; i++ ) {
|
2805 |
-
var img = childImgs[i];
|
2806 |
-
this.addImage( img );
|
2807 |
-
}
|
2808 |
-
|
2809 |
-
// get child background images
|
2810 |
-
if ( typeof this.options.background == 'string' ) {
|
2811 |
-
var children = elem.querySelectorAll( this.options.background );
|
2812 |
-
for ( i=0; i < children.length; i++ ) {
|
2813 |
-
var child = children[i];
|
2814 |
-
this.addElementBackgroundImages( child );
|
2815 |
-
}
|
2816 |
-
}
|
2817 |
};
|
2818 |
|
2819 |
-
var
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
|
|
|
|
|
|
|
|
|
|
2823 |
};
|
2824 |
|
2825 |
-
|
2826 |
-
var
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
|
2831 |
-
|
2832 |
-
|
2833 |
-
|
2834 |
-
|
2835 |
-
|
2836 |
-
|
2837 |
-
|
2838 |
-
|
2839 |
-
|
2840 |
-
|
2841 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2842 |
|
2843 |
-
|
2844 |
-
|
2845 |
-
|
2846 |
-
ImagesLoaded.prototype.addImage = function( img ) {
|
2847 |
-
var loadingImage = new LoadingImage( img );
|
2848 |
-
this.images.push( loadingImage );
|
2849 |
-
};
|
2850 |
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2855 |
|
2856 |
-
ImagesLoaded.prototype.check = function() {
|
2857 |
-
var _this = this;
|
2858 |
-
this.progressedCount = 0;
|
2859 |
-
this.hasAnyBroken = false;
|
2860 |
-
// complete if no images
|
2861 |
-
if ( !this.images.length ) {
|
2862 |
-
this.complete();
|
2863 |
-
return;
|
2864 |
-
}
|
2865 |
|
2866 |
-
|
2867 |
-
|
2868 |
-
setTimeout( function() {
|
2869 |
-
_this.progress( image, elem, message );
|
2870 |
-
});
|
2871 |
-
}
|
2872 |
|
2873 |
-
|
2874 |
-
|
2875 |
-
|
2876 |
-
|
2877 |
-
};
|
2878 |
|
2879 |
-
|
2880 |
-
|
2881 |
-
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
|
2882 |
-
// progress event
|
2883 |
-
this.emitEvent( 'progress', [ this, image, elem ] );
|
2884 |
-
if ( this.jqDeferred && this.jqDeferred.notify ) {
|
2885 |
-
this.jqDeferred.notify( this, image );
|
2886 |
-
}
|
2887 |
-
// check if completed
|
2888 |
-
if ( this.progressedCount == this.images.length ) {
|
2889 |
-
this.complete();
|
2890 |
-
}
|
2891 |
|
2892 |
-
|
2893 |
-
|
2894 |
-
|
2895 |
-
}
|
2896 |
|
2897 |
-
ImagesLoaded.prototype.complete = function() {
|
2898 |
-
var eventName = this.hasAnyBroken ? 'fail' : 'done';
|
2899 |
-
this.isComplete = true;
|
2900 |
-
this.emitEvent( eventName, [ this ] );
|
2901 |
-
this.emitEvent( 'always', [ this ] );
|
2902 |
-
if ( this.jqDeferred ) {
|
2903 |
-
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';
|
2904 |
-
this.jqDeferred[ jqMethod ]( this );
|
2905 |
-
}
|
2906 |
-
};
|
2907 |
|
2908 |
-
|
|
|
2909 |
|
2910 |
-
|
2911 |
-
this.img = img;
|
2912 |
-
}
|
2913 |
|
2914 |
-
|
|
|
2915 |
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
2920 |
-
if ( isComplete ) {
|
2921 |
-
// report based on naturalWidth
|
2922 |
-
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
|
2923 |
-
return;
|
2924 |
-
}
|
2925 |
|
2926 |
-
|
2927 |
-
|
2928 |
-
this.proxyImage.addEventListener( 'load', this );
|
2929 |
-
this.proxyImage.addEventListener( 'error', this );
|
2930 |
-
// bind to image as well for Firefox. #191
|
2931 |
-
this.img.addEventListener( 'load', this );
|
2932 |
-
this.img.addEventListener( 'error', this );
|
2933 |
-
this.proxyImage.src = this.img.src;
|
2934 |
-
};
|
2935 |
|
2936 |
-
|
2937 |
-
|
2938 |
-
// fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671
|
2939 |
-
return this.img.complete && this.img.naturalWidth;
|
2940 |
-
};
|
2941 |
|
2942 |
-
|
2943 |
-
|
2944 |
-
|
2945 |
-
};
|
2946 |
|
2947 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2948 |
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
if ( this[ method ] ) {
|
2953 |
-
this[ method ]( event );
|
2954 |
-
}
|
2955 |
-
};
|
2956 |
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
};
|
2961 |
|
2962 |
-
|
2963 |
-
|
2964 |
-
this.unbindEvents();
|
2965 |
-
};
|
2966 |
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
this.img.removeEventListener( 'load', this );
|
2971 |
-
this.img.removeEventListener( 'error', this );
|
2972 |
-
};
|
2973 |
|
2974 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2975 |
|
2976 |
-
|
2977 |
-
|
2978 |
-
|
2979 |
-
|
2980 |
-
|
2981 |
|
2982 |
-
//
|
2983 |
-
|
|
|
|
|
|
|
2984 |
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
-
// check if image is already complete
|
2990 |
-
var isComplete = this.getIsImageComplete();
|
2991 |
-
if ( isComplete ) {
|
2992 |
-
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
|
2993 |
-
this.unbindEvents();
|
2994 |
-
}
|
2995 |
-
};
|
2996 |
|
2997 |
-
|
2998 |
-
|
2999 |
-
|
3000 |
-
};
|
3001 |
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
}
|
3006 |
|
3007 |
-
|
|
|
|
|
|
|
3008 |
|
3009 |
-
|
3010 |
-
|
3011 |
-
|
3012 |
-
return;
|
3013 |
-
}
|
3014 |
-
// set local variable
|
3015 |
-
$ = jQuery;
|
3016 |
-
// $().imagesLoaded()
|
3017 |
-
$.fn.imagesLoaded = function( options, callback ) {
|
3018 |
-
var instance = new ImagesLoaded( this, options, callback );
|
3019 |
-
return instance.jqDeferred.promise( $(this) );
|
3020 |
};
|
3021 |
-
};
|
3022 |
-
// try making plugin
|
3023 |
-
ImagesLoaded.makeJQueryPlugin();
|
3024 |
|
3025 |
-
|
|
|
|
|
|
|
|
|
3026 |
|
3027 |
-
return ImagesLoaded;
|
3028 |
|
3029 |
-
|
|
|
3030 |
|
|
|
|
|
|
|
|
|
3031 |
|
3032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3033 |
|
3034 |
-
/***/ "./node_modules/masonry-layout/masonry.js":
|
3035 |
-
/*!************************************************!*\
|
3036 |
-
!*** ./node_modules/masonry-layout/masonry.js ***!
|
3037 |
-
\************************************************/
|
3038 |
-
/*! no static exports found */
|
3039 |
-
/***/ (function(module, exports, __webpack_require__) {
|
3040 |
|
3041 |
-
|
3042 |
-
|
3043 |
-
|
3044 |
-
|
3045 |
-
* MIT License
|
3046 |
-
* by David DeSandro
|
3047 |
-
*/
|
3048 |
|
3049 |
-
( function( window, factory ) {
|
3050 |
-
// universal module definition
|
3051 |
-
/* jshint strict: false */ /*globals define, module, require */
|
3052 |
-
if ( true ) {
|
3053 |
-
// AMD
|
3054 |
-
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
3055 |
-
__webpack_require__(/*! outlayer/outlayer */ "./node_modules/outlayer/outlayer.js"),
|
3056 |
-
__webpack_require__(/*! get-size/get-size */ "./node_modules/get-size/get-size.js")
|
3057 |
-
], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
3058 |
-
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
3059 |
-
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
3060 |
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
3061 |
-
} else {}
|
3062 |
|
3063 |
-
|
|
|
3064 |
|
3065 |
-
'use strict';
|
3066 |
|
3067 |
-
|
|
|
|
|
3068 |
|
3069 |
-
|
3070 |
-
|
3071 |
-
|
3072 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3073 |
|
3074 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3075 |
|
3076 |
-
|
3077 |
-
|
3078 |
-
|
3079 |
-
|
3080 |
-
|
|
|
3081 |
|
3082 |
-
|
3083 |
-
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3087 |
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
|
|
|
|
|
|
3091 |
|
3092 |
-
|
3093 |
-
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
var firstItemElem = firstItem && firstItem.element;
|
3098 |
-
// columnWidth fall back to item of first element
|
3099 |
-
this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth ||
|
3100 |
-
// if first elem has no width, default to size of container
|
3101 |
-
this.containerWidth;
|
3102 |
-
}
|
3103 |
|
3104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3105 |
|
3106 |
-
|
3107 |
-
|
3108 |
-
|
3109 |
-
//
|
3110 |
-
var excess = columnWidth - containerWidth % columnWidth;
|
3111 |
-
// if overshoot is less than a pixel, round up, otherwise floor it
|
3112 |
-
var mathMethod = excess && excess < 1 ? 'round' : 'floor';
|
3113 |
-
cols = Math[ mathMethod ]( cols );
|
3114 |
-
this.cols = Math.max( cols, 1 );
|
3115 |
-
};
|
3116 |
|
3117 |
-
proto.getContainerWidth = function() {
|
3118 |
-
// container is parent if fit width
|
3119 |
-
var isFitWidth = this._getOption('fitWidth');
|
3120 |
-
var container = isFitWidth ? this.element.parentNode : this.element;
|
3121 |
-
// check that this.size and size are there
|
3122 |
-
// IE8 triggers resize on body size change, so they might not be
|
3123 |
-
var size = getSize( container );
|
3124 |
-
this.containerWidth = size && size.innerWidth;
|
3125 |
};
|
3126 |
|
3127 |
-
|
3128 |
-
|
3129 |
-
|
3130 |
-
|
3131 |
-
|
3132 |
-
// round if off by 1 pixel, otherwise use ceil
|
3133 |
-
var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth );
|
3134 |
-
colSpan = Math.min( colSpan, this.cols );
|
3135 |
-
// use horizontal or top column position
|
3136 |
-
var colPosMethod = this.options.horizontalOrder ?
|
3137 |
-
'_getHorizontalColPosition' : '_getTopColPosition';
|
3138 |
-
var colPosition = this[ colPosMethod ]( colSpan, item );
|
3139 |
-
// position the brick
|
3140 |
-
var position = {
|
3141 |
-
x: this.columnWidth * colPosition.col,
|
3142 |
-
y: colPosition.y
|
3143 |
-
};
|
3144 |
-
// apply setHeight to necessary columns
|
3145 |
-
var setHeight = colPosition.y + item.size.outerHeight;
|
3146 |
-
var setMax = colSpan + colPosition.col;
|
3147 |
-
for ( var i = colPosition.col; i < setMax; i++ ) {
|
3148 |
-
this.colYs[i] = setHeight;
|
3149 |
}
|
3150 |
|
3151 |
-
|
|
|
|
|
|
|
3152 |
};
|
3153 |
|
3154 |
-
|
3155 |
-
|
3156 |
-
|
3157 |
-
|
3158 |
|
3159 |
-
|
3160 |
-
col: colGroup.indexOf( minimumY ),
|
3161 |
-
y: minimumY,
|
3162 |
-
};
|
3163 |
-
};
|
3164 |
|
3165 |
-
|
3166 |
-
|
3167 |
-
* @returns {Array} colGroup
|
3168 |
-
*/
|
3169 |
-
proto._getTopColGroup = function( colSpan ) {
|
3170 |
-
if ( colSpan < 2 ) {
|
3171 |
-
// if brick spans only one column, use all the column Ys
|
3172 |
-
return this.colYs;
|
3173 |
}
|
3174 |
|
3175 |
-
|
3176 |
-
|
3177 |
-
var groupCount = this.cols + 1 - colSpan;
|
3178 |
-
// for each group potential horizontal position
|
3179 |
-
for ( var i = 0; i < groupCount; i++ ) {
|
3180 |
-
colGroup[i] = this._getColGroupY( i, colSpan );
|
3181 |
}
|
3182 |
-
return colGroup;
|
3183 |
-
};
|
3184 |
|
3185 |
-
|
3186 |
-
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
3190 |
-
var groupColYs = this.colYs.slice( col, col + colSpan );
|
3191 |
-
// and get the max value of the array
|
3192 |
-
return Math.max.apply( Math, groupColYs );
|
3193 |
-
};
|
3194 |
|
3195 |
-
// get column position based on horizontal index. #873
|
3196 |
-
proto._getHorizontalColPosition = function( colSpan, item ) {
|
3197 |
-
var col = this.horizontalColIndex % this.cols;
|
3198 |
-
var isOver = colSpan > 1 && col + colSpan > this.cols;
|
3199 |
-
// shift to next row if item can't fit on current row
|
3200 |
-
col = isOver ? 0 : col;
|
3201 |
-
// don't let zero-size items take up space
|
3202 |
-
var hasSize = item.size.outerWidth && item.size.outerHeight;
|
3203 |
-
this.horizontalColIndex = hasSize ? col + colSpan : this.horizontalColIndex;
|
3204 |
|
3205 |
-
|
3206 |
-
|
3207 |
-
|
3208 |
-
}
|
3209 |
-
};
|
3210 |
|
3211 |
-
proto._manageStamp = function( stamp ) {
|
3212 |
-
var stampSize = getSize( stamp );
|
3213 |
-
var offset = this._getElementOffset( stamp );
|
3214 |
-
// get the columns that this stamp affects
|
3215 |
-
var isOriginLeft = this._getOption('originLeft');
|
3216 |
-
var firstX = isOriginLeft ? offset.left : offset.right;
|
3217 |
-
var lastX = firstX + stampSize.outerWidth;
|
3218 |
-
var firstCol = Math.floor( firstX / this.columnWidth );
|
3219 |
-
firstCol = Math.max( 0, firstCol );
|
3220 |
-
var lastCol = Math.floor( lastX / this.columnWidth );
|
3221 |
-
// lastCol should not go over if multiple of columnWidth #425
|
3222 |
-
lastCol -= lastX % this.columnWidth ? 0 : 1;
|
3223 |
-
lastCol = Math.min( this.cols - 1, lastCol );
|
3224 |
-
// set colYs to bottom of the stamp
|
3225 |
|
3226 |
-
|
3227 |
-
|
3228 |
-
stampSize.outerHeight;
|
3229 |
-
for ( var i = firstCol; i <= lastCol; i++ ) {
|
3230 |
-
this.colYs[i] = Math.max( stampMaxY, this.colYs[i] );
|
3231 |
-
}
|
3232 |
-
};
|
3233 |
|
3234 |
-
|
3235 |
-
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3239 |
|
3240 |
-
|
3241 |
-
|
|
|
3242 |
}
|
3243 |
|
3244 |
-
|
3245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3246 |
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
3251 |
-
|
3252 |
-
if ( this.colYs[i] !== 0 ) {
|
3253 |
-
break;
|
3254 |
}
|
3255 |
-
unusedCols++;
|
3256 |
-
}
|
3257 |
-
// fit container to columns that have been used
|
3258 |
-
return ( this.cols - unusedCols ) * this.columnWidth - this.gutter;
|
3259 |
-
};
|
3260 |
|
3261 |
-
|
3262 |
-
|
3263 |
-
|
3264 |
-
return previousWidth != this.containerWidth;
|
3265 |
-
};
|
3266 |
|
3267 |
-
|
|
|
|
|
3268 |
|
3269 |
-
|
|
|
|
|
3270 |
|
|
|
|
|
|
|
3271 |
|
3272 |
-
|
|
|
|
|
|
|
3273 |
|
3274 |
-
|
3275 |
-
/*!*********************************************!*\
|
3276 |
-
!*** ./node_modules/object-assign/index.js ***!
|
3277 |
-
\*********************************************/
|
3278 |
-
/*! no static exports found */
|
3279 |
-
/***/ (function(module, exports, __webpack_require__) {
|
3280 |
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
@license MIT
|
3286 |
-
*/
|
3287 |
|
|
|
|
|
|
|
|
|
3288 |
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
|
|
|
|
|
|
|
3293 |
|
3294 |
-
|
3295 |
-
if (val === null || val === undefined) {
|
3296 |
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
3297 |
-
}
|
3298 |
|
3299 |
-
|
3300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3301 |
|
3302 |
-
|
3303 |
-
|
3304 |
-
|
3305 |
-
return false;
|
3306 |
-
}
|
3307 |
|
3308 |
-
|
3309 |
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
3314 |
-
|
3315 |
-
}
|
3316 |
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
-
|
3322 |
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3323 |
-
return test2[n];
|
3324 |
-
});
|
3325 |
-
if (order2.join('') !== '0123456789') {
|
3326 |
-
return false;
|
3327 |
-
}
|
3328 |
|
3329 |
-
|
3330 |
-
|
3331 |
-
|
3332 |
-
|
3333 |
-
});
|
3334 |
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
3335 |
-
'abcdefghijklmnopqrst') {
|
3336 |
-
return false;
|
3337 |
-
}
|
3338 |
|
3339 |
-
|
3340 |
-
|
3341 |
-
|
3342 |
-
|
3343 |
-
|
3344 |
-
|
|
|
3345 |
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
|
|
|
|
|
|
|
|
3350 |
|
3351 |
-
|
3352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3353 |
|
3354 |
-
|
3355 |
-
|
3356 |
-
|
3357 |
-
}
|
3358 |
-
}
|
3359 |
|
3360 |
-
|
3361 |
-
|
3362 |
-
|
3363 |
-
if (propIsEnumerable.call(from, symbols[i])) {
|
3364 |
-
to[symbols[i]] = from[symbols[i]];
|
3365 |
-
}
|
3366 |
-
}
|
3367 |
-
}
|
3368 |
-
}
|
3369 |
|
3370 |
-
|
|
|
3371 |
};
|
3372 |
|
3373 |
|
|
|
|
|
|
|
3374 |
/***/ }),
|
3375 |
|
3376 |
-
/***/ "./node_modules/
|
3377 |
-
|
3378 |
-
!*** ./node_modules/
|
3379 |
-
|
3380 |
/*! no static exports found */
|
3381 |
/***/ (function(module, exports, __webpack_require__) {
|
3382 |
|
3383 |
-
var __WEBPACK_AMD_DEFINE_FACTORY__,
|
3384 |
-
*
|
|
|
|
|
3385 |
*/
|
3386 |
|
|
|
|
|
|
|
3387 |
( function( window, factory ) {
|
3388 |
-
|
3389 |
-
/* jshint strict: false */ /* globals define, module, require */
|
3390 |
if ( true ) {
|
3391 |
-
// AMD
|
3392 |
-
!(
|
3393 |
-
__webpack_require__(/*! ev-emitter/ev-emitter */ "./node_modules/ev-emitter/ev-emitter.js"),
|
3394 |
-
__webpack_require__(/*! get-size/get-size */ "./node_modules/get-size/get-size.js")
|
3395 |
-
], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
3396 |
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
3397 |
-
(__WEBPACK_AMD_DEFINE_FACTORY__.
|
|
|
3398 |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
3399 |
} else {}
|
3400 |
|
3401 |
-
}( window, function factory(
|
3402 |
'use strict';
|
3403 |
|
3404 |
-
//
|
3405 |
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
-
|
3411 |
-
return
|
3412 |
}
|
3413 |
|
3414 |
-
|
3415 |
|
|
|
|
|
|
|
|
|
3416 |
|
3417 |
-
|
3418 |
|
3419 |
-
var
|
3420 |
-
'
|
3421 |
-
|
3422 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3423 |
|
3424 |
-
var
|
3425 |
-
WebkitTransition: 'webkitTransitionEnd',
|
3426 |
-
transition: 'transitionend'
|
3427 |
-
}[ transitionProperty ];
|
3428 |
|
3429 |
-
|
3430 |
-
var
|
3431 |
-
|
3432 |
-
|
3433 |
-
|
3434 |
-
|
3435 |
-
|
3436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3437 |
|
3438 |
-
// --------------------------
|
3439 |
|
3440 |
-
|
3441 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3442 |
return;
|
3443 |
}
|
|
|
3444 |
|
3445 |
-
|
3446 |
-
// parent layout class, i.e. Masonry, Isotope, or Packery
|
3447 |
-
this.layout = layout;
|
3448 |
-
this.position = {
|
3449 |
-
x: 0,
|
3450 |
-
y: 0
|
3451 |
-
};
|
3452 |
|
3453 |
-
|
3454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3455 |
|
3456 |
-
|
3457 |
-
|
3458 |
-
|
|
|
|
|
|
|
3459 |
|
3460 |
-
|
3461 |
-
|
3462 |
-
this._transn = {
|
3463 |
-
ingProperties: {},
|
3464 |
-
clean: {},
|
3465 |
-
onEnd: {}
|
3466 |
-
};
|
3467 |
|
3468 |
-
|
3469 |
-
position: 'absolute'
|
3470 |
-
});
|
3471 |
-
};
|
3472 |
|
3473 |
-
|
3474 |
-
|
3475 |
-
|
3476 |
-
|
3477 |
-
|
|
|
3478 |
}
|
3479 |
-
};
|
3480 |
|
3481 |
-
|
3482 |
-
|
3483 |
-
|
|
|
3484 |
|
3485 |
-
|
3486 |
-
* apply CSS styles to element
|
3487 |
-
* @param {Object} style
|
3488 |
-
*/
|
3489 |
-
proto.css = function( style ) {
|
3490 |
-
var elemStyle = this.element.style;
|
3491 |
|
3492 |
-
|
3493 |
-
|
3494 |
-
|
3495 |
-
elemStyle[ supportedProp ] = style[ prop ];
|
3496 |
}
|
3497 |
-
};
|
3498 |
|
3499 |
-
|
3500 |
-
|
3501 |
-
|
3502 |
-
|
3503 |
-
var
|
3504 |
-
|
3505 |
-
|
3506 |
-
var
|
3507 |
-
|
3508 |
-
|
3509 |
-
|
3510 |
-
|
3511 |
-
|
3512 |
}
|
3513 |
-
|
3514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3515 |
}
|
3516 |
-
// clean up 'auto' or other non-integer values
|
3517 |
-
x = isNaN( x ) ? 0 : x;
|
3518 |
-
y = isNaN( y ) ? 0 : y;
|
3519 |
-
// remove padding from measurement
|
3520 |
-
x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight;
|
3521 |
-
y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom;
|
3522 |
|
3523 |
-
|
3524 |
-
|
3525 |
-
|
|
|
|
|
|
|
3526 |
|
3527 |
-
|
3528 |
-
|
3529 |
-
var layoutSize = this.layout.size;
|
3530 |
-
var style = {};
|
3531 |
-
var isOriginLeft = this.layout._getOption('originLeft');
|
3532 |
-
var isOriginTop = this.layout._getOption('originTop');
|
3533 |
|
3534 |
-
|
3535 |
-
|
3536 |
-
var xProperty = isOriginLeft ? 'left' : 'right';
|
3537 |
-
var xResetProperty = isOriginLeft ? 'right' : 'left';
|
3538 |
|
3539 |
-
|
3540 |
-
|
3541 |
-
style[ xProperty ] = this.getXValue( x );
|
3542 |
-
// reset other property
|
3543 |
-
style[ xResetProperty ] = '';
|
3544 |
|
3545 |
-
|
3546 |
-
var yPadding = isOriginTop ? 'paddingTop' : 'paddingBottom';
|
3547 |
-
var yProperty = isOriginTop ? 'top' : 'bottom';
|
3548 |
-
var yResetProperty = isOriginTop ? 'bottom' : 'top';
|
3549 |
|
3550 |
-
|
3551 |
-
// set in percentage or pixels
|
3552 |
-
style[ yProperty ] = this.getYValue( y );
|
3553 |
-
// reset other property
|
3554 |
-
style[ yResetProperty ] = '';
|
3555 |
|
3556 |
-
this.css( style );
|
3557 |
-
this.emitEvent( 'layout', [ this ] );
|
3558 |
-
};
|
3559 |
|
3560 |
-
|
3561 |
-
var isHorizontal = this.layout._getOption('horizontal');
|
3562 |
-
return this.layout.options.percentPosition && !isHorizontal ?
|
3563 |
-
( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px';
|
3564 |
-
};
|
3565 |
|
3566 |
-
|
3567 |
-
|
3568 |
-
|
3569 |
-
|
3570 |
-
|
|
|
3571 |
|
3572 |
-
|
3573 |
-
|
3574 |
-
|
3575 |
-
|
3576 |
-
|
3577 |
|
3578 |
-
|
|
|
3579 |
|
3580 |
-
|
3581 |
-
this.setPosition( x, y );
|
3582 |
|
3583 |
-
|
3584 |
-
|
3585 |
-
|
3586 |
-
|
3587 |
-
|
|
|
|
|
|
|
|
|
3588 |
|
3589 |
-
|
3590 |
-
var transY = y - curY;
|
3591 |
-
var transitionStyle = {};
|
3592 |
-
transitionStyle.transform = this.getTranslate( transX, transY );
|
3593 |
|
3594 |
-
|
3595 |
-
to: transitionStyle,
|
3596 |
-
onTransitionEnd: {
|
3597 |
-
transform: this.layoutPosition
|
3598 |
-
},
|
3599 |
-
isCleaning: true
|
3600 |
-
});
|
3601 |
-
};
|
3602 |
|
3603 |
-
|
3604 |
-
// flip cooridinates if origin on right or bottom
|
3605 |
-
var isOriginLeft = this.layout._getOption('originLeft');
|
3606 |
-
var isOriginTop = this.layout._getOption('originTop');
|
3607 |
-
x = isOriginLeft ? x : -x;
|
3608 |
-
y = isOriginTop ? y : -y;
|
3609 |
-
return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
|
3610 |
-
};
|
3611 |
|
3612 |
-
|
3613 |
-
proto.goTo = function( x, y ) {
|
3614 |
-
this.setPosition( x, y );
|
3615 |
-
this.layoutPosition();
|
3616 |
-
};
|
3617 |
|
3618 |
-
|
|
|
3619 |
|
3620 |
-
|
3621 |
-
this.position.x = parseFloat( x );
|
3622 |
-
this.position.y = parseFloat( y );
|
3623 |
-
};
|
3624 |
|
3625 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
3626 |
|
3627 |
-
|
3628 |
-
* @param {Object} style - CSS
|
3629 |
-
* @param {Function} onTransitionEnd
|
3630 |
-
*/
|
3631 |
|
3632 |
-
//
|
3633 |
-
|
3634 |
-
|
3635 |
-
|
3636 |
-
|
3637 |
}
|
3638 |
-
|
3639 |
-
|
|
|
|
|
|
|
3640 |
}
|
3641 |
-
|
|
|
|
|
|
|
|
|
|
|
3642 |
|
3643 |
/**
|
3644 |
-
*
|
3645 |
-
* @param {Object}
|
3646 |
-
*
|
3647 |
-
* @param {Object} from - style to start transition from
|
3648 |
-
* @param {Boolean} isCleaning - removes transition styles after transition
|
3649 |
-
* @param {Function} onTransitionEnd - callback
|
3650 |
*/
|
3651 |
-
|
3652 |
-
//
|
3653 |
-
if ( !
|
3654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3655 |
return;
|
3656 |
}
|
3657 |
|
3658 |
-
|
3659 |
-
|
3660 |
-
|
3661 |
-
|
3662 |
-
|
3663 |
-
|
3664 |
-
|
3665 |
-
_transition.ingProperties[ prop ] = true;
|
3666 |
-
// keep track of properties to clean up when transition is done
|
3667 |
-
if ( args.isCleaning ) {
|
3668 |
-
_transition.clean[ prop ] = true;
|
3669 |
-
}
|
3670 |
}
|
3671 |
|
3672 |
-
|
3673 |
-
|
3674 |
-
this.css( args.from );
|
3675 |
-
// force redraw. http://blog.alexmaccaw.com/css-transitions
|
3676 |
-
var h = this.element.offsetHeight;
|
3677 |
-
// hack for JSHint to hush about unused var
|
3678 |
-
h = null;
|
3679 |
}
|
3680 |
-
// enable transition
|
3681 |
-
this.enableTransition( args.to );
|
3682 |
-
// set styles that are transitioning
|
3683 |
-
this.css( args.to );
|
3684 |
|
3685 |
-
this.
|
3686 |
|
3687 |
-
|
|
|
|
|
|
|
3688 |
|
3689 |
-
//
|
3690 |
-
|
3691 |
-
function toDashedAll( str ) {
|
3692 |
-
return str.replace( /([A-Z])/g, function( $1 ) {
|
3693 |
-
return '-' + $1.toLowerCase();
|
3694 |
-
});
|
3695 |
}
|
3696 |
|
3697 |
-
|
3698 |
|
3699 |
-
|
3700 |
-
|
3701 |
-
|
3702 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3703 |
return;
|
3704 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3705 |
|
3706 |
-
//
|
3707 |
-
|
3708 |
-
|
3709 |
-
|
3710 |
-
|
3711 |
-
|
3712 |
-
|
3713 |
-
|
3714 |
-
// }
|
3715 |
-
// munge number to millisecond, to match stagger
|
3716 |
-
var duration = this.layout.options.transitionDuration;
|
3717 |
-
duration = typeof duration == 'number' ? duration + 'ms' : duration;
|
3718 |
-
// enable transition styles
|
3719 |
-
this.css({
|
3720 |
-
transitionProperty: transitionProps,
|
3721 |
-
transitionDuration: duration,
|
3722 |
-
transitionDelay: this.staggerDelay || 0
|
3723 |
-
});
|
3724 |
-
// listen for transition end event
|
3725 |
-
this.element.addEventListener( transitionEndEvent, this, false );
|
3726 |
};
|
3727 |
|
3728 |
-
|
|
|
|
|
|
|
|
|
3729 |
|
3730 |
-
|
3731 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3732 |
};
|
3733 |
|
3734 |
-
|
3735 |
-
|
|
|
|
|
|
|
|
|
3736 |
};
|
3737 |
|
3738 |
-
|
3739 |
-
var
|
3740 |
-
|
3741 |
};
|
3742 |
|
3743 |
-
|
3744 |
-
|
3745 |
-
|
|
|
|
|
|
|
|
|
3746 |
return;
|
3747 |
}
|
3748 |
-
var _transition = this._transn;
|
3749 |
-
// get property name of transitioned property, convert to prefix-free
|
3750 |
-
var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName;
|
3751 |
|
3752 |
-
|
3753 |
-
|
3754 |
-
|
3755 |
-
|
3756 |
-
|
3757 |
-
this.disableTransition();
|
3758 |
}
|
3759 |
-
|
3760 |
-
|
3761 |
-
|
3762 |
-
|
3763 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3764 |
}
|
3765 |
-
//
|
3766 |
-
if (
|
3767 |
-
|
3768 |
-
onTransitionEnd.call( this );
|
3769 |
-
delete _transition.onEnd[ propertyName ];
|
3770 |
}
|
3771 |
|
3772 |
-
this.
|
|
|
|
|
3773 |
};
|
3774 |
|
3775 |
-
|
3776 |
-
this.
|
3777 |
-
this.
|
3778 |
-
this.
|
|
|
|
|
|
|
|
|
|
|
3779 |
};
|
3780 |
|
3781 |
-
|
3782 |
-
|
3783 |
-
|
3784 |
-
|
3785 |
-
|
3786 |
-
|
3787 |
-
|
3788 |
-
|
3789 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3790 |
}
|
3791 |
-
this.css( cleanStyle );
|
3792 |
-
};
|
3793 |
|
3794 |
-
|
3795 |
-
|
3796 |
-
|
3797 |
-
|
|
|
|
|
|
|
|
|
3798 |
};
|
3799 |
|
3800 |
-
|
3801 |
-
//
|
3802 |
-
|
|
|
3803 |
};
|
3804 |
|
3805 |
-
|
3806 |
-
|
3807 |
-
|
3808 |
-
delay = isNaN( delay ) ? 0 : delay;
|
3809 |
-
this.staggerDelay = delay + 'ms';
|
3810 |
};
|
3811 |
|
3812 |
-
// -----
|
3813 |
|
3814 |
-
//
|
3815 |
-
|
3816 |
-
|
3817 |
-
|
3818 |
-
|
3819 |
-
|
3820 |
};
|
3821 |
|
3822 |
-
|
3823 |
-
|
3824 |
-
|
3825 |
-
|
3826 |
-
return;
|
3827 |
-
}
|
3828 |
|
3829 |
-
|
3830 |
-
this.
|
3831 |
-
|
3832 |
-
});
|
3833 |
-
this.hide();
|
3834 |
};
|
3835 |
|
3836 |
-
|
3837 |
-
|
3838 |
-
|
3839 |
-
this.
|
|
|
|
|
3840 |
|
3841 |
-
|
3842 |
|
3843 |
-
|
3844 |
-
|
3845 |
-
|
|
|
|
|
3846 |
|
3847 |
-
|
3848 |
-
|
3849 |
-
to: options.visibleStyle,
|
3850 |
-
isCleaning: true,
|
3851 |
-
onTransitionEnd: onTransitionEnd
|
3852 |
-
});
|
3853 |
-
};
|
3854 |
|
3855 |
-
|
3856 |
-
|
3857 |
-
|
3858 |
-
|
3859 |
-
|
|
|
|
|
|
|
|
|
3860 |
}
|
3861 |
};
|
3862 |
|
3863 |
-
|
3864 |
-
|
3865 |
-
|
3866 |
-
* @returns {String}
|
3867 |
-
*/
|
3868 |
-
proto.getHideRevealTransitionEndProperty = function( styleProperty ) {
|
3869 |
-
var optionStyle = this.layout.options[ styleProperty ];
|
3870 |
-
// use opacity
|
3871 |
-
if ( optionStyle.opacity ) {
|
3872 |
-
return 'opacity';
|
3873 |
-
}
|
3874 |
-
// get first property
|
3875 |
-
for ( var prop in optionStyle ) {
|
3876 |
-
return prop;
|
3877 |
-
}
|
3878 |
};
|
3879 |
|
3880 |
-
|
3881 |
-
|
3882 |
-
this.
|
3883 |
-
// remove display: none
|
3884 |
-
this.css({ display: '' });
|
3885 |
-
|
3886 |
-
var options = this.layout.options;
|
3887 |
-
|
3888 |
-
var onTransitionEnd = {};
|
3889 |
-
var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle');
|
3890 |
-
onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd;
|
3891 |
-
|
3892 |
-
this.transition({
|
3893 |
-
from: options.visibleStyle,
|
3894 |
-
to: options.hiddenStyle,
|
3895 |
-
// keep hidden stuff hidden
|
3896 |
-
isCleaning: true,
|
3897 |
-
onTransitionEnd: onTransitionEnd
|
3898 |
-
});
|
3899 |
};
|
3900 |
|
3901 |
-
|
3902 |
-
|
3903 |
-
|
3904 |
-
|
3905 |
-
|
3906 |
-
|
3907 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3908 |
};
|
|
|
|
|
3909 |
|
3910 |
-
|
3911 |
-
this.css({
|
3912 |
-
position: '',
|
3913 |
-
left: '',
|
3914 |
-
right: '',
|
3915 |
-
top: '',
|
3916 |
-
bottom: '',
|
3917 |
-
transition: '',
|
3918 |
-
transform: ''
|
3919 |
-
});
|
3920 |
-
};
|
3921 |
|
3922 |
-
return
|
3923 |
|
3924 |
-
})
|
3925 |
|
3926 |
|
3927 |
/***/ }),
|
3928 |
|
3929 |
-
/***/ "./node_modules/
|
3930 |
-
|
3931 |
-
!*** ./node_modules/
|
3932 |
-
|
3933 |
/*! no static exports found */
|
3934 |
/***/ (function(module, exports, __webpack_require__) {
|
3935 |
|
3936 |
-
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
3937 |
-
*
|
3938 |
-
*
|
3939 |
-
*
|
|
|
|
|
3940 |
*/
|
3941 |
|
3942 |
( function( window, factory ) {
|
3943 |
-
'use strict';
|
3944 |
// universal module definition
|
3945 |
-
/* jshint strict: false */ /*
|
3946 |
if ( true ) {
|
3947 |
-
// AMD
|
3948 |
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
3949 |
-
__webpack_require__(/*!
|
3950 |
-
__webpack_require__(/*! get-size/get-size */ "./node_modules/get-size/get-size.js")
|
3951 |
-
|
3952 |
-
|
3953 |
-
|
3954 |
-
return factory( window, EvEmitter, getSize, utils, Item);
|
3955 |
-
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
3956 |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
3957 |
} else {}
|
3958 |
|
3959 |
-
}( window, function factory(
|
3960 |
-
'use strict';
|
3961 |
|
3962 |
-
|
3963 |
|
3964 |
-
|
3965 |
-
var jQuery = window.jQuery;
|
3966 |
-
var noop = function() {};
|
3967 |
|
3968 |
-
//
|
|
|
|
|
|
|
3969 |
|
3970 |
-
|
3971 |
-
var GUID = 0;
|
3972 |
-
// internal store of all Outlayer intances
|
3973 |
-
var instances = {};
|
3974 |
|
|
|
|
|
|
|
|
|
|
|
3975 |
|
3976 |
-
|
3977 |
-
|
3978 |
-
|
3979 |
-
|
3980 |
-
*/
|
3981 |
-
function Outlayer( element, options ) {
|
3982 |
-
var queryElement = utils.getQueryElement( element );
|
3983 |
-
if ( !queryElement ) {
|
3984 |
-
if ( console ) {
|
3985 |
-
console.error( 'Bad element for ' + this.constructor.namespace +
|
3986 |
-
': ' + ( queryElement || element ) );
|
3987 |
}
|
3988 |
-
return;
|
3989 |
-
}
|
3990 |
-
this.element = queryElement;
|
3991 |
-
// add jQuery
|
3992 |
-
if ( jQuery ) {
|
3993 |
-
this.$element = jQuery( this.element );
|
3994 |
-
}
|
3995 |
|
3996 |
-
|
3997 |
-
|
3998 |
-
|
3999 |
|
4000 |
-
|
4001 |
-
|
4002 |
-
|
4003 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4004 |
|
4005 |
-
|
4006 |
-
this._create();
|
4007 |
|
4008 |
-
|
4009 |
-
|
4010 |
-
|
4011 |
-
|
4012 |
-
|
|
|
|
|
|
|
|
|
|
|
4013 |
|
4014 |
-
|
4015 |
-
|
4016 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4017 |
|
4018 |
-
|
4019 |
-
|
4020 |
-
|
4021 |
-
|
4022 |
-
|
4023 |
-
|
4024 |
-
|
4025 |
-
|
4026 |
-
|
4027 |
-
|
4028 |
-
|
4029 |
-
|
4030 |
-
|
4031 |
-
|
4032 |
-
|
4033 |
-
|
4034 |
-
|
4035 |
-
|
4036 |
-
|
4037 |
-
|
4038 |
-
|
|
|
|
|
4039 |
|
4040 |
-
|
4041 |
-
|
4042 |
-
utils.extend( proto, EvEmitter.prototype );
|
4043 |
|
4044 |
-
|
4045 |
-
|
4046 |
-
|
4047 |
-
|
4048 |
-
proto.option = function( opts ) {
|
4049 |
-
utils.extend( this.options, opts );
|
4050 |
-
};
|
4051 |
|
4052 |
-
|
4053 |
-
|
4054 |
-
|
4055 |
-
|
4056 |
-
|
4057 |
-
return oldOption && this.options[ oldOption ] !== undefined ?
|
4058 |
-
this.options[ oldOption ] : this.options[ option ];
|
4059 |
-
};
|
4060 |
|
4061 |
-
|
4062 |
-
|
4063 |
-
|
4064 |
-
|
4065 |
-
|
4066 |
-
|
4067 |
-
|
4068 |
-
|
4069 |
-
|
4070 |
-
};
|
4071 |
|
4072 |
-
|
4073 |
-
|
4074 |
-
|
4075 |
-
|
4076 |
-
|
4077 |
-
|
4078 |
-
|
4079 |
-
|
|
|
4080 |
|
4081 |
-
|
4082 |
-
|
4083 |
-
|
4084 |
-
|
4085 |
-
|
4086 |
-
|
|
|
|
|
|
|
4087 |
|
4088 |
-
//
|
4089 |
-
proto.
|
4090 |
-
|
4091 |
-
|
4092 |
-
|
|
|
|
|
|
|
|
|
4093 |
|
|
|
|
|
|
|
|
|
|
|
4094 |
|
4095 |
-
|
4096 |
-
|
4097 |
-
|
4098 |
-
|
4099 |
-
|
4100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4101 |
|
4102 |
-
|
4103 |
-
|
|
|
|
|
|
|
|
|
|
|
4104 |
|
4105 |
-
|
4106 |
-
|
4107 |
-
|
4108 |
-
|
4109 |
-
|
4110 |
-
items.push( item );
|
4111 |
-
}
|
4112 |
|
4113 |
-
|
4114 |
-
|
|
|
4115 |
|
4116 |
-
|
4117 |
-
|
4118 |
-
* @param {Array or NodeList or HTMLElement} elems
|
4119 |
-
* @returns {Array} items - item elements
|
4120 |
-
*/
|
4121 |
-
proto._filterFindItemElements = function( elems ) {
|
4122 |
-
return utils.filterFindElements( elems, this.options.itemSelector );
|
4123 |
-
};
|
4124 |
|
4125 |
-
|
4126 |
-
|
4127 |
-
|
4128 |
-
|
4129 |
-
|
4130 |
-
|
4131 |
-
|
4132 |
-
|
4133 |
-
|
|
|
|
|
|
|
|
|
4134 |
|
4135 |
-
|
|
|
|
|
|
|
|
|
4136 |
|
4137 |
-
|
4138 |
-
* lays out all items
|
4139 |
-
*/
|
4140 |
-
proto.layout = function() {
|
4141 |
-
this._resetLayout();
|
4142 |
-
this._manageStamps();
|
4143 |
|
4144 |
-
|
4145 |
-
var layoutInstant = this._getOption('layoutInstant');
|
4146 |
-
var isInstant = layoutInstant !== undefined ?
|
4147 |
-
layoutInstant : !this._isLayoutInited;
|
4148 |
-
this.layoutItems( this.items, isInstant );
|
4149 |
|
4150 |
-
// flag for initalized
|
4151 |
-
this._isLayoutInited = true;
|
4152 |
-
};
|
4153 |
|
4154 |
-
|
4155 |
-
proto._init = proto.layout;
|
4156 |
|
4157 |
-
|
4158 |
-
|
4159 |
-
|
4160 |
-
|
4161 |
-
|
4162 |
-
|
4163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4164 |
|
4165 |
-
proto.getSize = function() {
|
4166 |
-
this.size = getSize( this.element );
|
4167 |
-
};
|
4168 |
|
4169 |
-
|
4170 |
-
|
4171 |
-
|
4172 |
-
|
4173 |
-
* else use option as a number
|
4174 |
-
*
|
4175 |
-
* @param {String} measurement
|
4176 |
-
* @param {String} size - width or height
|
4177 |
-
* @private
|
4178 |
-
*/
|
4179 |
-
proto._getMeasurement = function( measurement, size ) {
|
4180 |
-
var option = this.options[ measurement ];
|
4181 |
-
var elem;
|
4182 |
-
if ( !option ) {
|
4183 |
-
// default to 0
|
4184 |
-
this[ measurement ] = 0;
|
4185 |
-
} else {
|
4186 |
-
// use option as an element
|
4187 |
-
if ( typeof option == 'string' ) {
|
4188 |
-
elem = this.element.querySelector( option );
|
4189 |
-
} else if ( option instanceof HTMLElement ) {
|
4190 |
-
elem = option;
|
4191 |
-
}
|
4192 |
-
// use size of element, if element
|
4193 |
-
this[ measurement ] = elem ? getSize( elem )[ size ] : option;
|
4194 |
-
}
|
4195 |
-
};
|
4196 |
|
4197 |
-
|
4198 |
-
|
4199 |
-
|
4200 |
-
|
4201 |
-
proto.layoutItems = function( items, isInstant ) {
|
4202 |
-
items = this._getItemsForLayout( items );
|
4203 |
|
4204 |
-
|
|
|
4205 |
|
4206 |
-
|
4207 |
-
|
|
|
|
|
|
|
4208 |
|
4209 |
-
|
4210 |
-
* get the items to be laid out
|
4211 |
-
* you may want to skip over some items
|
4212 |
-
* @param {Array} items
|
4213 |
-
* @returns {Array} items
|
4214 |
-
*/
|
4215 |
-
proto._getItemsForLayout = function( items ) {
|
4216 |
-
return items.filter( function( item ) {
|
4217 |
-
return !item.isIgnored;
|
4218 |
-
});
|
4219 |
-
};
|
4220 |
|
4221 |
-
|
4222 |
-
|
4223 |
-
|
4224 |
-
|
4225 |
-
|
4226 |
-
|
4227 |
-
this._emitCompleteOnItems( 'layout', items );
|
4228 |
|
4229 |
-
|
4230 |
-
|
4231 |
-
|
4232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4233 |
|
4234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4235 |
|
4236 |
-
|
4237 |
-
|
4238 |
-
|
4239 |
-
|
4240 |
-
|
4241 |
-
|
4242 |
-
queue.push( position );
|
4243 |
-
}, this );
|
4244 |
|
4245 |
-
|
4246 |
-
|
|
|
|
|
4247 |
|
4248 |
-
|
4249 |
-
|
4250 |
-
* @param {Outlayer.Item} item
|
4251 |
-
* @returns {Object} x and y position
|
4252 |
-
*/
|
4253 |
-
proto._getItemLayoutPosition = function( /* item */ ) {
|
4254 |
-
return {
|
4255 |
-
x: 0,
|
4256 |
-
y: 0
|
4257 |
-
};
|
4258 |
-
};
|
4259 |
|
4260 |
-
|
4261 |
-
|
4262 |
-
|
4263 |
-
|
4264 |
-
|
4265 |
-
*/
|
4266 |
-
proto._processLayoutQueue = function( queue ) {
|
4267 |
-
this.updateStagger();
|
4268 |
-
queue.forEach( function( obj, i ) {
|
4269 |
-
this._positionItem( obj.item, obj.x, obj.y, obj.isInstant, i );
|
4270 |
-
}, this );
|
4271 |
-
};
|
4272 |
|
4273 |
-
|
4274 |
-
|
4275 |
-
|
4276 |
-
|
4277 |
-
|
4278 |
-
|
4279 |
-
|
4280 |
-
|
4281 |
-
|
4282 |
-
};
|
4283 |
|
4284 |
-
|
4285 |
-
* Sets position of item in DOM
|
4286 |
-
* @param {Outlayer.Item} item
|
4287 |
-
* @param {Number} x - horizontal position
|
4288 |
-
* @param {Number} y - vertical position
|
4289 |
-
* @param {Boolean} isInstant - disables transitions
|
4290 |
-
*/
|
4291 |
-
proto._positionItem = function( item, x, y, isInstant, i ) {
|
4292 |
-
if ( isInstant ) {
|
4293 |
-
// if not transition, just set CSS
|
4294 |
-
item.goTo( x, y );
|
4295 |
-
} else {
|
4296 |
-
item.stagger( i * this.stagger );
|
4297 |
-
item.moveTo( x, y );
|
4298 |
-
}
|
4299 |
};
|
4300 |
|
4301 |
-
/**
|
4302 |
-
* Any logic you want to do after each layout,
|
4303 |
-
* i.e. size the container
|
4304 |
-
*/
|
4305 |
-
proto._postLayout = function() {
|
4306 |
-
this.resizeContainer();
|
4307 |
-
};
|
4308 |
|
4309 |
-
|
4310 |
-
var isResizingContainer = this._getOption('resizeContainer');
|
4311 |
-
if ( !isResizingContainer ) {
|
4312 |
-
return;
|
4313 |
-
}
|
4314 |
-
var size = this._getContainerSize();
|
4315 |
-
if ( size ) {
|
4316 |
-
this._setContainerMeasure( size.width, true );
|
4317 |
-
this._setContainerMeasure( size.height, false );
|
4318 |
-
}
|
4319 |
-
};
|
4320 |
|
4321 |
-
|
4322 |
-
|
4323 |
-
|
4324 |
-
|
4325 |
-
|
4326 |
-
|
4327 |
-
proto._getContainerSize = noop;
|
4328 |
|
4329 |
-
|
4330 |
-
*
|
4331 |
-
* @param {Boolean} isWidth
|
4332 |
*/
|
4333 |
-
proto._setContainerMeasure = function( measure, isWidth ) {
|
4334 |
-
if ( measure === undefined ) {
|
4335 |
-
return;
|
4336 |
-
}
|
4337 |
-
|
4338 |
-
var elemSize = this.size;
|
4339 |
-
// add padding and border width if border box
|
4340 |
-
if ( elemSize.isBorderBox ) {
|
4341 |
-
measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight +
|
4342 |
-
elemSize.borderLeftWidth + elemSize.borderRightWidth :
|
4343 |
-
elemSize.paddingBottom + elemSize.paddingTop +
|
4344 |
-
elemSize.borderTopWidth + elemSize.borderBottomWidth;
|
4345 |
-
}
|
4346 |
|
4347 |
-
|
4348 |
-
|
4349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4350 |
|
4351 |
-
|
4352 |
-
|
4353 |
-
* @param {String} eventName
|
4354 |
-
* @param {Array} items - Outlayer.Items
|
4355 |
-
*/
|
4356 |
-
proto._emitCompleteOnItems = function( eventName, items ) {
|
4357 |
-
var _this = this;
|
4358 |
-
function onComplete() {
|
4359 |
-
_this.dispatchEvent( eventName + 'Complete', null, [ items ] );
|
4360 |
-
}
|
4361 |
|
4362 |
-
|
4363 |
-
if ( !items || !count ) {
|
4364 |
-
onComplete();
|
4365 |
-
return;
|
4366 |
-
}
|
4367 |
|
4368 |
-
|
4369 |
-
|
4370 |
-
|
4371 |
-
if ( doneCount == count ) {
|
4372 |
-
onComplete();
|
4373 |
-
}
|
4374 |
}
|
|
|
|
|
|
|
4375 |
|
4376 |
-
|
4377 |
-
items.forEach( function( item ) {
|
4378 |
-
item.once( eventName, tick );
|
4379 |
-
});
|
4380 |
-
};
|
4381 |
|
4382 |
-
/**
|
4383 |
-
* emits events via EvEmitter and jQuery events
|
4384 |
-
* @param {String} type - name of event
|
4385 |
-
* @param {Event} event - original event
|
4386 |
-
* @param {Array} args - extra arguments
|
4387 |
-
*/
|
4388 |
-
proto.dispatchEvent = function( type, event, args ) {
|
4389 |
-
// add original event to arguments
|
4390 |
-
var emitArgs = event ? [ event ].concat( args ) : args;
|
4391 |
-
this.emitEvent( type, emitArgs );
|
4392 |
|
4393 |
-
|
4394 |
-
// set this.$element
|
4395 |
-
this.$element = this.$element || jQuery( this.element );
|
4396 |
-
if ( event ) {
|
4397 |
-
// create jQuery event
|
4398 |
-
var $event = jQuery.Event( event );
|
4399 |
-
$event.type = type;
|
4400 |
-
this.$element.trigger( $event, args );
|
4401 |
-
} else {
|
4402 |
-
// just trigger with type if no event available
|
4403 |
-
this.$element.trigger( type, args );
|
4404 |
-
}
|
4405 |
-
}
|
4406 |
-
};
|
4407 |
|
4408 |
-
|
|
|
|
|
|
|
4409 |
|
|
|
|
|
|
|
|
|
4410 |
|
4411 |
-
|
4412 |
-
|
4413 |
-
|
4414 |
-
|
4415 |
-
|
4416 |
-
|
4417 |
-
|
4418 |
-
if ( item ) {
|
4419 |
-
item.isIgnored = true;
|
4420 |
-
}
|
4421 |
};
|
4422 |
|
4423 |
-
|
4424 |
-
* return item to layout collection
|
4425 |
-
* @param {Element} elem
|
4426 |
-
*/
|
4427 |
-
proto.unignore = function( elem ) {
|
4428 |
-
var item = this.getItem( elem );
|
4429 |
-
if ( item ) {
|
4430 |
-
delete item.isIgnored;
|
4431 |
-
}
|
4432 |
-
};
|
4433 |
|
4434 |
-
|
4435 |
-
|
4436 |
-
* @param {NodeList, Array, Element, or String} elems
|
4437 |
-
*/
|
4438 |
-
proto.stamp = function( elems ) {
|
4439 |
-
elems = this._find( elems );
|
4440 |
-
if ( !elems ) {
|
4441 |
return;
|
4442 |
}
|
4443 |
|
4444 |
-
this.
|
4445 |
-
//
|
4446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4447 |
};
|
4448 |
|
4449 |
-
|
4450 |
-
|
4451 |
-
|
4452 |
-
|
4453 |
-
|
4454 |
-
elems = this._find( elems );
|
4455 |
-
if ( !elems ){
|
4456 |
-
return;
|
4457 |
}
|
|
|
4458 |
|
4459 |
-
|
4460 |
-
|
4461 |
-
utils.removeFrom( this.stamps, elem );
|
4462 |
-
this.unignore( elem );
|
4463 |
-
}, this );
|
4464 |
};
|
4465 |
|
4466 |
/**
|
4467 |
-
*
|
4468 |
-
* @param {
|
4469 |
-
* @returns {Array} elems
|
4470 |
*/
|
4471 |
-
proto.
|
4472 |
-
|
4473 |
-
|
4474 |
-
|
4475 |
-
|
4476 |
-
|
4477 |
-
|
4478 |
}
|
4479 |
-
elems = utils.makeArray( elems );
|
4480 |
-
return elems;
|
4481 |
};
|
4482 |
|
4483 |
-
|
4484 |
-
|
4485 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4486 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4487 |
|
4488 |
-
this.
|
4489 |
-
|
4490 |
-
this.stamps.forEach( this._manageStamp, this );
|
4491 |
};
|
4492 |
|
4493 |
-
//
|
4494 |
-
proto.
|
4495 |
-
|
4496 |
-
var
|
4497 |
-
var
|
4498 |
-
|
4499 |
-
left: boundingRect.left + size.paddingLeft + size.borderLeftWidth,
|
4500 |
-
top: boundingRect.top + size.paddingTop + size.borderTopWidth,
|
4501 |
-
right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ),
|
4502 |
-
bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth )
|
4503 |
-
};
|
4504 |
-
};
|
4505 |
|
4506 |
-
|
4507 |
-
|
4508 |
-
|
4509 |
-
|
4510 |
|
4511 |
-
|
4512 |
-
|
4513 |
-
|
4514 |
-
|
4515 |
-
|
4516 |
-
proto._getElementOffset = function( elem ) {
|
4517 |
-
var boundingRect = elem.getBoundingClientRect();
|
4518 |
-
var thisRect = this._boundingRect;
|
4519 |
-
var size = getSize( elem );
|
4520 |
-
var offset = {
|
4521 |
-
left: boundingRect.left - thisRect.left - size.marginLeft,
|
4522 |
-
top: boundingRect.top - thisRect.top - size.marginTop,
|
4523 |
-
right: thisRect.right - boundingRect.right - size.marginRight,
|
4524 |
-
bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom
|
4525 |
-
};
|
4526 |
-
return offset;
|
4527 |
-
};
|
4528 |
|
4529 |
-
//
|
|
|
|
|
|
|
4530 |
|
4531 |
-
|
4532 |
-
//
|
4533 |
-
|
|
|
|
|
4534 |
|
4535 |
-
|
4536 |
-
|
4537 |
-
*/
|
4538 |
-
proto.bindResize = function() {
|
4539 |
-
window.addEventListener( 'resize', this );
|
4540 |
-
this.isResizeBound = true;
|
4541 |
};
|
4542 |
|
4543 |
-
|
4544 |
-
|
4545 |
-
|
4546 |
-
|
4547 |
-
window.removeEventListener( 'resize', this );
|
4548 |
-
this.isResizeBound = false;
|
4549 |
};
|
4550 |
|
4551 |
-
proto.
|
4552 |
-
this.
|
|
|
|
|
4553 |
};
|
4554 |
|
4555 |
-
|
|
|
|
|
|
|
|
|
4556 |
|
4557 |
-
|
4558 |
-
|
4559 |
-
//
|
4560 |
-
|
|
|
|
|
|
|
|
|
4561 |
return;
|
4562 |
}
|
4563 |
|
4564 |
-
|
4565 |
-
|
|
|
|
|
4566 |
|
4567 |
-
|
4568 |
-
|
4569 |
-
|
4570 |
-
|
4571 |
-
|
4572 |
-
|
4573 |
-
|
4574 |
-
// IE8 triggers resize on body size change, so they might not be
|
4575 |
-
var hasSizes = this.size && size;
|
4576 |
-
return hasSizes && size.innerWidth !== this.size.innerWidth;
|
4577 |
};
|
4578 |
|
4579 |
-
|
4580 |
-
|
4581 |
-
|
4582 |
-
|
4583 |
-
|
4584 |
-
|
4585 |
-
|
4586 |
-
proto.addItems = function( elems ) {
|
4587 |
-
var items = this._itemize( elems );
|
4588 |
-
// add items to collection
|
4589 |
-
if ( items.length ) {
|
4590 |
-
this.items = this.items.concat( items );
|
4591 |
-
}
|
4592 |
-
return items;
|
4593 |
};
|
4594 |
|
4595 |
-
|
4596 |
-
|
4597 |
-
|
4598 |
-
|
4599 |
-
proto.appended = function( elems ) {
|
4600 |
-
var items = this.addItems( elems );
|
4601 |
-
if ( !items.length ) {
|
4602 |
-
return;
|
4603 |
-
}
|
4604 |
-
// layout and reveal just the new items
|
4605 |
-
this.layoutItems( items, true );
|
4606 |
-
this.reveal( items );
|
4607 |
};
|
4608 |
|
4609 |
-
|
4610 |
-
|
4611 |
-
|
4612 |
-
|
4613 |
-
|
4614 |
-
var items = this._itemize( elems );
|
4615 |
-
if ( !items.length ) {
|
4616 |
-
return;
|
4617 |
-
}
|
4618 |
-
// add items to beginning of collection
|
4619 |
-
var previousItems = this.items.slice(0);
|
4620 |
-
this.items = items.concat( previousItems );
|
4621 |
-
// start new layout
|
4622 |
-
this._resetLayout();
|
4623 |
-
this._manageStamps();
|
4624 |
-
// layout new stuff without transition
|
4625 |
-
this.layoutItems( items, true );
|
4626 |
-
this.reveal( items );
|
4627 |
-
// layout previous items
|
4628 |
-
this.layoutItems( previousItems );
|
4629 |
};
|
4630 |
|
|
|
|
|
4631 |
/**
|
4632 |
-
*
|
4633 |
-
* @param {
|
4634 |
*/
|
4635 |
-
|
4636 |
-
|
4637 |
-
|
4638 |
-
|
|
|
|
|
|
|
|
|
|
|
4639 |
}
|
4640 |
-
var stagger = this.updateStagger();
|
4641 |
-
items.forEach( function( item, i ) {
|
4642 |
-
item.stagger( i * stagger );
|
4643 |
-
item.reveal();
|
4644 |
-
});
|
4645 |
};
|
4646 |
|
4647 |
/**
|
4648 |
-
*
|
4649 |
-
* @param {
|
|
|
|
|
|
|
|
|
4650 |
*/
|
4651 |
-
proto.
|
4652 |
-
|
4653 |
-
if ( !
|
|
|
4654 |
return;
|
4655 |
}
|
4656 |
-
var stagger = this.updateStagger();
|
4657 |
-
items.forEach( function( item, i ) {
|
4658 |
-
item.stagger( i * stagger );
|
4659 |
-
item.hide();
|
4660 |
-
});
|
4661 |
-
};
|
4662 |
|
4663 |
-
|
4664 |
-
|
4665 |
-
|
4666 |
-
|
4667 |
-
|
4668 |
-
|
4669 |
-
|
4670 |
-
|
|
|
|
|
|
|
|
|
|
|
4671 |
|
4672 |
-
|
4673 |
-
|
4674 |
-
|
4675 |
-
|
4676 |
-
|
4677 |
-
|
4678 |
-
|
4679 |
-
};
|
4680 |
-
|
4681 |
-
/**
|
4682 |
-
* get Outlayer.Item, given an Element
|
4683 |
-
* @param {Element} elem
|
4684 |
-
* @param {Function} callback
|
4685 |
-
* @returns {Outlayer.Item} item
|
4686 |
-
*/
|
4687 |
-
proto.getItem = function( elem ) {
|
4688 |
-
// loop through items to get the one that matches
|
4689 |
-
for ( var i=0; i < this.items.length; i++ ) {
|
4690 |
-
var item = this.items[i];
|
4691 |
-
if ( item.element == elem ) {
|
4692 |
-
// return item
|
4693 |
-
return item;
|
4694 |
-
}
|
4695 |
}
|
4696 |
-
|
|
|
|
|
|
|
4697 |
|
4698 |
-
|
4699 |
-
* get collection of Outlayer.Items, given Elements
|
4700 |
-
* @param {Array} elems
|
4701 |
-
* @returns {Array} items - Outlayer.Items
|
4702 |
-
*/
|
4703 |
-
proto.getItems = function( elems ) {
|
4704 |
-
elems = utils.makeArray( elems );
|
4705 |
-
var items = [];
|
4706 |
-
elems.forEach( function( elem ) {
|
4707 |
-
var item = this.getItem( elem );
|
4708 |
-
if ( item ) {
|
4709 |
-
items.push( item );
|
4710 |
-
}
|
4711 |
-
}, this );
|
4712 |
|
4713 |
-
return items;
|
4714 |
};
|
4715 |
|
4716 |
-
|
4717 |
-
|
4718 |
-
|
4719 |
-
|
4720 |
-
|
4721 |
-
|
|
|
4722 |
|
4723 |
-
|
4724 |
|
4725 |
-
|
4726 |
-
|
|
|
|
|
4727 |
return;
|
4728 |
}
|
4729 |
|
4730 |
-
|
4731 |
-
|
4732 |
-
|
4733 |
-
|
4734 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4735 |
};
|
4736 |
|
4737 |
-
// -----
|
4738 |
|
4739 |
-
|
4740 |
-
|
4741 |
-
|
4742 |
-
var style = this.element.style;
|
4743 |
-
style.height = '';
|
4744 |
-
style.position = '';
|
4745 |
-
style.width = '';
|
4746 |
-
// destroy items
|
4747 |
-
this.items.forEach( function( item ) {
|
4748 |
-
item.destroy();
|
4749 |
-
});
|
4750 |
|
4751 |
-
|
|
|
|
|
4752 |
|
4753 |
-
|
4754 |
-
|
4755 |
-
|
4756 |
-
|
4757 |
-
|
4758 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4759 |
}
|
4760 |
|
|
|
4761 |
};
|
4762 |
|
4763 |
-
|
|
|
|
|
|
|
|
|
4764 |
|
4765 |
/**
|
4766 |
-
*
|
4767 |
-
* @param {
|
4768 |
-
|
4769 |
-
|
4770 |
-
|
4771 |
-
|
4772 |
-
var
|
4773 |
-
|
|
|
|
|
4774 |
};
|
4775 |
|
|
|
|
|
|
|
|
|
|
|
4776 |
|
4777 |
-
|
|
|
|
|
|
|
4778 |
|
4779 |
-
|
4780 |
-
* create a layout class
|
4781 |
-
* @param {String} namespace
|
4782 |
-
*/
|
4783 |
-
Outlayer.create = function( namespace, options ) {
|
4784 |
-
// sub-class Outlayer
|
4785 |
-
var Layout = subclass( Outlayer );
|
4786 |
-
// apply new options and compatOptions
|
4787 |
-
Layout.defaults = utils.extend( {}, Outlayer.defaults );
|
4788 |
-
utils.extend( Layout.defaults, options );
|
4789 |
-
Layout.compatOptions = utils.extend( {}, Outlayer.compatOptions );
|
4790 |
|
4791 |
-
|
|
|
|
|
|
|
4792 |
|
4793 |
-
|
4794 |
|
4795 |
-
|
4796 |
-
|
|
|
|
|
|
|
|
|
|
|
4797 |
|
4798 |
-
|
|
|
|
|
|
|
|
|
|
|
4799 |
|
4800 |
-
|
|
|
|
|
|
|
|
|
|
|
4801 |
|
4802 |
-
|
|
|
|
|
|
|
4803 |
|
4804 |
-
|
4805 |
-
if ( jQuery && jQuery.bridget ) {
|
4806 |
-
jQuery.bridget( namespace, Layout );
|
4807 |
-
}
|
4808 |
|
4809 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4810 |
};
|
4811 |
|
4812 |
-
function
|
4813 |
-
|
4814 |
-
|
|
|
|
|
4815 |
}
|
|
|
4816 |
|
4817 |
-
|
4818 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4819 |
|
4820 |
-
|
4821 |
-
|
|
|
|
|
|
|
4822 |
|
4823 |
-
|
4824 |
|
4825 |
-
|
4826 |
-
var
|
4827 |
-
|
4828 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4829 |
};
|
4830 |
|
4831 |
-
|
4832 |
-
//
|
4833 |
-
|
4834 |
-
if (
|
4835 |
-
|
4836 |
-
|
4837 |
-
var matches = time.match( /(^\d*\.?\d*)(\w*)/ );
|
4838 |
-
var num = matches && matches[1];
|
4839 |
-
var unit = matches && matches[2];
|
4840 |
-
if ( !num.length ) {
|
4841 |
-
return 0;
|
4842 |
}
|
4843 |
-
|
4844 |
-
var mult = msUnits[ unit ] || 1;
|
4845 |
-
return num * mult;
|
4846 |
-
}
|
4847 |
-
|
4848 |
-
// ----- fin ----- //
|
4849 |
|
4850 |
-
|
4851 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4852 |
|
4853 |
-
return
|
4854 |
|
4855 |
}));
|
4856 |
|
4857 |
|
4858 |
/***/ }),
|
4859 |
|
4860 |
-
/***/ "./node_modules/
|
4861 |
-
|
4862 |
-
!*** ./node_modules/
|
4863 |
-
|
4864 |
/*! no static exports found */
|
4865 |
-
/***/ (function(module, exports) {
|
4866 |
-
|
4867 |
-
// shim for using process in browser
|
4868 |
-
var process = module.exports = {};
|
4869 |
|
4870 |
-
|
4871 |
-
|
4872 |
-
|
4873 |
-
|
|
|
4874 |
|
4875 |
-
|
4876 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4877 |
|
4878 |
-
function
|
4879 |
-
|
4880 |
-
}
|
4881 |
-
function defaultClearTimeout () {
|
4882 |
-
throw new Error('clearTimeout has not been defined');
|
4883 |
-
}
|
4884 |
-
(function () {
|
4885 |
-
try {
|
4886 |
-
if (typeof setTimeout === 'function') {
|
4887 |
-
cachedSetTimeout = setTimeout;
|
4888 |
-
} else {
|
4889 |
-
cachedSetTimeout = defaultSetTimout;
|
4890 |
-
}
|
4891 |
-
} catch (e) {
|
4892 |
-
cachedSetTimeout = defaultSetTimout;
|
4893 |
-
}
|
4894 |
-
try {
|
4895 |
-
if (typeof clearTimeout === 'function') {
|
4896 |
-
cachedClearTimeout = clearTimeout;
|
4897 |
-
} else {
|
4898 |
-
cachedClearTimeout = defaultClearTimeout;
|
4899 |
-
}
|
4900 |
-
} catch (e) {
|
4901 |
-
cachedClearTimeout = defaultClearTimeout;
|
4902 |
-
}
|
4903 |
-
} ())
|
4904 |
-
function runTimeout(fun) {
|
4905 |
-
if (cachedSetTimeout === setTimeout) {
|
4906 |
-
//normal enviroments in sane situations
|
4907 |
-
return setTimeout(fun, 0);
|
4908 |
-
}
|
4909 |
-
// if setTimeout wasn't available but was latter defined
|
4910 |
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
4911 |
-
cachedSetTimeout = setTimeout;
|
4912 |
-
return setTimeout(fun, 0);
|
4913 |
-
}
|
4914 |
-
try {
|
4915 |
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
4916 |
-
return cachedSetTimeout(fun, 0);
|
4917 |
-
} catch(e){
|
4918 |
-
try {
|
4919 |
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
4920 |
-
return cachedSetTimeout.call(null, fun, 0);
|
4921 |
-
} catch(e){
|
4922 |
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
4923 |
-
return cachedSetTimeout.call(this, fun, 0);
|
4924 |
-
}
|
4925 |
-
}
|
4926 |
|
|
|
4927 |
|
4928 |
-
|
4929 |
-
|
4930 |
-
|
4931 |
-
//normal enviroments in sane situations
|
4932 |
-
return clearTimeout(marker);
|
4933 |
-
}
|
4934 |
-
// if clearTimeout wasn't available but was latter defined
|
4935 |
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
4936 |
-
cachedClearTimeout = clearTimeout;
|
4937 |
-
return clearTimeout(marker);
|
4938 |
-
}
|
4939 |
-
try {
|
4940 |
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
4941 |
-
return cachedClearTimeout(marker);
|
4942 |
-
} catch (e){
|
4943 |
-
try {
|
4944 |
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
4945 |
-
return cachedClearTimeout.call(null, marker);
|
4946 |
-
} catch (e){
|
4947 |
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
4948 |
-
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
4949 |
-
return cachedClearTimeout.call(this, marker);
|
4950 |
-
}
|
4951 |
-
}
|
4952 |
|
|
|
4953 |
|
|
|
|
|
|
|
|
|
4954 |
|
4955 |
-
}
|
4956 |
-
var queue = [];
|
4957 |
-
var draining = false;
|
4958 |
-
var currentQueue;
|
4959 |
-
var queueIndex = -1;
|
4960 |
|
4961 |
-
|
4962 |
-
|
4963 |
-
|
4964 |
-
|
4965 |
-
|
4966 |
-
|
4967 |
-
|
4968 |
-
|
4969 |
-
|
4970 |
-
|
4971 |
-
|
4972 |
-
drainQueue();
|
4973 |
}
|
4974 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4975 |
|
4976 |
-
|
4977 |
-
|
4978 |
-
|
4979 |
-
}
|
4980 |
-
var timeout = runTimeout(cleanUpNextTick);
|
4981 |
-
draining = true;
|
4982 |
|
4983 |
-
|
4984 |
-
|
4985 |
-
|
4986 |
-
|
4987 |
-
|
4988 |
-
|
4989 |
-
|
4990 |
-
|
4991 |
-
|
4992 |
-
|
4993 |
-
|
4994 |
-
|
4995 |
-
currentQueue = null;
|
4996 |
-
draining = false;
|
4997 |
-
runClearTimeout(timeout);
|
4998 |
}
|
4999 |
|
5000 |
-
|
5001 |
-
|
5002 |
-
|
5003 |
-
|
5004 |
-
|
5005 |
-
|
5006 |
-
|
5007 |
-
|
5008 |
-
|
5009 |
-
|
5010 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5011 |
};
|
5012 |
|
5013 |
-
|
5014 |
-
|
5015 |
-
|
5016 |
-
|
5017 |
-
|
5018 |
-
|
5019 |
-
|
|
|
|
|
|
|
5020 |
};
|
5021 |
-
process.title = 'browser';
|
5022 |
-
process.browser = true;
|
5023 |
-
process.env = {};
|
5024 |
-
process.argv = [];
|
5025 |
-
process.version = ''; // empty string to avoid regexp issues
|
5026 |
-
process.versions = {};
|
5027 |
|
5028 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5029 |
|
5030 |
-
|
5031 |
-
|
5032 |
-
|
5033 |
-
|
5034 |
-
|
5035 |
-
|
5036 |
-
|
5037 |
-
|
5038 |
-
|
|
|
5039 |
|
5040 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5041 |
|
5042 |
-
|
5043 |
-
|
|
|
|
|
|
|
5044 |
};
|
5045 |
|
5046 |
-
|
5047 |
-
|
5048 |
-
|
|
|
5049 |
};
|
5050 |
-
process.umask = function() { return 0; };
|
5051 |
|
5052 |
|
5053 |
-
|
|
|
|
|
|
|
|
|
|
|
5054 |
|
5055 |
-
|
5056 |
-
|
5057 |
-
!*** ./node_modules/react-dom/cjs/react-dom-server.browser.development.js ***!
|
5058 |
-
\****************************************************************************/
|
5059 |
-
/*! no static exports found */
|
5060 |
-
/***/ (function(module, exports, __webpack_require__) {
|
5061 |
|
5062 |
-
|
5063 |
-
|
5064 |
-
|
5065 |
-
|
5066 |
-
|
5067 |
-
|
5068 |
-
|
5069 |
-
* LICENSE file in the root directory of this source tree.
|
5070 |
-
*/
|
5071 |
|
|
|
|
|
5072 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5073 |
|
5074 |
-
|
5075 |
-
|
5076 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5077 |
|
5078 |
-
|
5079 |
-
var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
|
5080 |
|
5081 |
-
|
5082 |
-
|
5083 |
-
|
5084 |
-
function
|
5085 |
-
|
|
|
5086 |
|
5087 |
-
|
5088 |
-
|
5089 |
-
|
|
|
|
|
5090 |
|
5091 |
-
|
5092 |
-
|
|
|
5093 |
|
5094 |
-
//
|
5095 |
-
|
5096 |
|
5097 |
-
|
|
|
|
|
|
|
|
|
|
|
5098 |
|
5099 |
-
// by calls to these methods by a Babel plugin.
|
5100 |
-
//
|
5101 |
-
// In PROD (or in packages without access to React internals),
|
5102 |
-
// they are left as they are instead.
|
5103 |
|
5104 |
-
function
|
5105 |
-
|
5106 |
-
|
5107 |
-
args[_key - 1] = arguments[_key];
|
5108 |
-
}
|
5109 |
|
5110 |
-
|
5111 |
-
|
5112 |
-
|
5113 |
-
|
5114 |
-
|
5115 |
-
|
5116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5117 |
}
|
5118 |
-
|
5119 |
-
|
5120 |
}
|
5121 |
-
}
|
5122 |
|
5123 |
-
|
5124 |
-
|
5125 |
-
|
5126 |
-
|
5127 |
-
|
5128 |
-
|
5129 |
|
5130 |
-
|
5131 |
-
format += '%s';
|
5132 |
-
args = args.concat([stack]);
|
5133 |
-
}
|
5134 |
|
5135 |
-
|
5136 |
-
|
5137 |
-
}); // Careful: RN currently depends on this prefix
|
5138 |
|
5139 |
-
|
5140 |
-
|
5141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5142 |
|
5143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5144 |
}
|
5145 |
-
}
|
5146 |
|
5147 |
-
|
5148 |
-
// When adding new symbols to this file,
|
5149 |
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
5150 |
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
5151 |
-
// nor polyfill, then a plain number is used for performance.
|
5152 |
-
var REACT_ELEMENT_TYPE = 0xeac7;
|
5153 |
-
var REACT_PORTAL_TYPE = 0xeaca;
|
5154 |
-
var REACT_FRAGMENT_TYPE = 0xeacb;
|
5155 |
-
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
5156 |
-
var REACT_PROFILER_TYPE = 0xead2;
|
5157 |
-
var REACT_PROVIDER_TYPE = 0xeacd;
|
5158 |
-
var REACT_CONTEXT_TYPE = 0xeace;
|
5159 |
-
var REACT_FORWARD_REF_TYPE = 0xead0;
|
5160 |
-
var REACT_SUSPENSE_TYPE = 0xead1;
|
5161 |
-
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
5162 |
-
var REACT_MEMO_TYPE = 0xead3;
|
5163 |
-
var REACT_LAZY_TYPE = 0xead4;
|
5164 |
-
var REACT_BLOCK_TYPE = 0xead9;
|
5165 |
-
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
5166 |
-
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
5167 |
-
var REACT_SCOPE_TYPE = 0xead7;
|
5168 |
-
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
5169 |
-
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
5170 |
-
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
5171 |
-
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
5172 |
|
5173 |
-
|
5174 |
-
|
5175 |
-
|
5176 |
-
|
5177 |
-
|
5178 |
-
|
5179 |
-
|
5180 |
-
|
5181 |
-
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
5182 |
-
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
5183 |
-
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
5184 |
-
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
5185 |
-
REACT_MEMO_TYPE = symbolFor('react.memo');
|
5186 |
-
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
5187 |
-
REACT_BLOCK_TYPE = symbolFor('react.block');
|
5188 |
-
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
5189 |
-
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
5190 |
-
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
5191 |
-
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
5192 |
-
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
5193 |
-
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
5194 |
-
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
5195 |
-
}
|
5196 |
|
5197 |
-
|
5198 |
-
|
5199 |
-
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
5200 |
-
}
|
5201 |
|
5202 |
-
|
5203 |
-
|
5204 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5205 |
|
5206 |
-
|
5207 |
-
|
5208 |
-
|
5209 |
-
|
5210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5211 |
|
5212 |
-
|
5213 |
-
|
5214 |
-
|
5215 |
-
|
|
|
|
|
5216 |
}
|
|
|
|
|
|
|
5217 |
|
5218 |
-
|
5219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5220 |
}
|
|
|
5221 |
|
5222 |
-
|
5223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5224 |
}
|
|
|
5225 |
|
5226 |
-
|
5227 |
-
|
5228 |
-
|
|
|
|
|
|
|
|
|
5229 |
|
5230 |
-
|
5231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5232 |
|
5233 |
-
|
5234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5235 |
|
5236 |
-
|
5237 |
-
|
|
|
5238 |
|
5239 |
-
|
5240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5241 |
|
5242 |
-
|
5243 |
-
|
|
|
|
|
5244 |
}
|
5245 |
|
5246 |
-
|
5247 |
-
|
5248 |
-
|
5249 |
-
|
5250 |
-
|
5251 |
-
|
5252 |
-
case REACT_PROVIDER_TYPE:
|
5253 |
-
var provider = type;
|
5254 |
-
return getContextName(provider._context) + '.Provider';
|
5255 |
-
|
5256 |
-
case REACT_FORWARD_REF_TYPE:
|
5257 |
-
return getWrappedName(type, type.render, 'ForwardRef');
|
5258 |
-
|
5259 |
-
case REACT_MEMO_TYPE:
|
5260 |
-
return getComponentName(type.type);
|
5261 |
-
|
5262 |
-
case REACT_BLOCK_TYPE:
|
5263 |
-
return getComponentName(type._render);
|
5264 |
-
|
5265 |
-
case REACT_LAZY_TYPE:
|
5266 |
-
{
|
5267 |
-
var lazyComponent = type;
|
5268 |
-
var payload = lazyComponent._payload;
|
5269 |
-
var init = lazyComponent._init;
|
5270 |
-
|
5271 |
-
try {
|
5272 |
-
return getComponentName(init(payload));
|
5273 |
-
} catch (x) {
|
5274 |
-
return null;
|
5275 |
-
}
|
5276 |
-
}
|
5277 |
}
|
5278 |
}
|
5279 |
|
5280 |
-
|
5281 |
-
|
5282 |
-
|
5283 |
-
|
5284 |
-
|
5285 |
-
var enableSuspenseServerRenderer = false;
|
5286 |
-
|
5287 |
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
5288 |
-
// replaying on render function. This currently only patches the object
|
5289 |
-
// lazily which won't cover if the log function was extracted eagerly.
|
5290 |
-
// We could also eagerly patch the method.
|
5291 |
-
var disabledDepth = 0;
|
5292 |
-
var prevLog;
|
5293 |
-
var prevInfo;
|
5294 |
-
var prevWarn;
|
5295 |
-
var prevError;
|
5296 |
-
var prevGroup;
|
5297 |
-
var prevGroupCollapsed;
|
5298 |
-
var prevGroupEnd;
|
5299 |
-
|
5300 |
-
function disabledLog() {}
|
5301 |
-
|
5302 |
-
disabledLog.__reactDisabledLog = true;
|
5303 |
-
function disableLogs() {
|
5304 |
-
{
|
5305 |
-
if (disabledDepth === 0) {
|
5306 |
-
/* eslint-disable react-internal/no-production-logging */
|
5307 |
-
prevLog = console.log;
|
5308 |
-
prevInfo = console.info;
|
5309 |
-
prevWarn = console.warn;
|
5310 |
-
prevError = console.error;
|
5311 |
-
prevGroup = console.group;
|
5312 |
-
prevGroupCollapsed = console.groupCollapsed;
|
5313 |
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
5314 |
|
5315 |
-
|
5316 |
-
|
5317 |
-
|
5318 |
-
|
5319 |
-
|
5320 |
-
|
|
|
|
|
|
|
|
|
5321 |
|
5322 |
-
|
5323 |
-
|
5324 |
-
|
5325 |
-
|
5326 |
-
|
5327 |
-
|
5328 |
-
|
5329 |
-
|
5330 |
-
|
5331 |
-
|
|
|
5332 |
}
|
5333 |
-
|
5334 |
-
disabledDepth++;
|
5335 |
}
|
5336 |
-
}
|
5337 |
-
function reenableLogs() {
|
5338 |
-
{
|
5339 |
-
disabledDepth--;
|
5340 |
|
5341 |
-
|
5342 |
-
/* eslint-disable react-internal/no-production-logging */
|
5343 |
-
var props = {
|
5344 |
-
configurable: true,
|
5345 |
-
enumerable: true,
|
5346 |
-
writable: true
|
5347 |
-
}; // $FlowFixMe Flow thinks console is immutable.
|
5348 |
|
5349 |
-
Object.defineProperties(console, {
|
5350 |
-
log: _assign({}, props, {
|
5351 |
-
value: prevLog
|
5352 |
-
}),
|
5353 |
-
info: _assign({}, props, {
|
5354 |
-
value: prevInfo
|
5355 |
-
}),
|
5356 |
-
warn: _assign({}, props, {
|
5357 |
-
value: prevWarn
|
5358 |
-
}),
|
5359 |
-
error: _assign({}, props, {
|
5360 |
-
value: prevError
|
5361 |
-
}),
|
5362 |
-
group: _assign({}, props, {
|
5363 |
-
value: prevGroup
|
5364 |
-
}),
|
5365 |
-
groupCollapsed: _assign({}, props, {
|
5366 |
-
value: prevGroupCollapsed
|
5367 |
-
}),
|
5368 |
-
groupEnd: _assign({}, props, {
|
5369 |
-
value: prevGroupEnd
|
5370 |
-
})
|
5371 |
-
});
|
5372 |
-
/* eslint-enable react-internal/no-production-logging */
|
5373 |
-
}
|
5374 |
|
5375 |
-
|
5376 |
-
|
5377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5378 |
}
|
5379 |
-
}
|
5380 |
-
|
5381 |
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
5382 |
-
var prefix;
|
5383 |
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
5384 |
-
{
|
5385 |
-
if (prefix === undefined) {
|
5386 |
-
// Extract the VM specific prefix used by each line.
|
5387 |
-
try {
|
5388 |
-
throw Error();
|
5389 |
-
} catch (x) {
|
5390 |
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
5391 |
-
prefix = match && match[1] || '';
|
5392 |
-
}
|
5393 |
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
5394 |
-
|
5395 |
|
5396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5397 |
}
|
5398 |
-
}
|
5399 |
-
var reentry = false;
|
5400 |
-
var componentFrameCache;
|
5401 |
-
|
5402 |
-
{
|
5403 |
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
5404 |
-
componentFrameCache = new PossiblyWeakMap();
|
5405 |
-
}
|
5406 |
|
5407 |
-
|
5408 |
-
|
5409 |
-
|
5410 |
-
|
|
|
|
|
|
|
|
|
5411 |
}
|
5412 |
|
5413 |
-
|
5414 |
-
|
|
|
|
|
5415 |
|
5416 |
-
|
5417 |
-
|
5418 |
-
|
|
|
|
|
|
|
|
|
|
|
5419 |
}
|
5420 |
|
5421 |
-
|
5422 |
-
|
5423 |
-
|
5424 |
-
|
5425 |
-
|
5426 |
-
|
5427 |
-
|
5428 |
-
{
|
5429 |
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
5430 |
-
// for warnings.
|
5431 |
|
5432 |
-
|
5433 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5435 |
|
5436 |
-
|
5437 |
-
|
5438 |
-
|
5439 |
-
|
5440 |
-
var Fake = function () {
|
5441 |
-
throw Error();
|
5442 |
-
}; // $FlowFixMe
|
5443 |
-
|
5444 |
-
|
5445 |
-
Object.defineProperty(Fake.prototype, 'props', {
|
5446 |
-
set: function () {
|
5447 |
-
// We use a throwing setter instead of frozen or non-writable props
|
5448 |
-
// because that won't throw in a non-strict mode function.
|
5449 |
-
throw Error();
|
5450 |
-
}
|
5451 |
-
});
|
5452 |
-
|
5453 |
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
5454 |
-
// We construct a different control for this case to include any extra
|
5455 |
-
// frames added by the construct call.
|
5456 |
-
try {
|
5457 |
-
Reflect.construct(Fake, []);
|
5458 |
-
} catch (x) {
|
5459 |
-
control = x;
|
5460 |
-
}
|
5461 |
-
|
5462 |
-
Reflect.construct(fn, [], Fake);
|
5463 |
-
} else {
|
5464 |
-
try {
|
5465 |
-
Fake.call();
|
5466 |
-
} catch (x) {
|
5467 |
-
control = x;
|
5468 |
-
}
|
5469 |
-
|
5470 |
-
fn.call(Fake.prototype);
|
5471 |
-
}
|
5472 |
-
} else {
|
5473 |
-
try {
|
5474 |
-
throw Error();
|
5475 |
-
} catch (x) {
|
5476 |
-
control = x;
|
5477 |
-
}
|
5478 |
-
|
5479 |
-
fn();
|
5480 |
-
}
|
5481 |
-
} catch (sample) {
|
5482 |
-
// This is inlined manually because closure doesn't do it for us.
|
5483 |
-
if (sample && control && typeof sample.stack === 'string') {
|
5484 |
-
// This extracts the first frame from the sample that isn't also in the control.
|
5485 |
-
// Skipping one frame that we assume is the frame that calls the two.
|
5486 |
-
var sampleLines = sample.stack.split('\n');
|
5487 |
-
var controlLines = control.stack.split('\n');
|
5488 |
-
var s = sampleLines.length - 1;
|
5489 |
-
var c = controlLines.length - 1;
|
5490 |
|
5491 |
-
|
5492 |
-
// We expect at least one stack frame to be shared.
|
5493 |
-
// Typically this will be the root most one. However, stack frames may be
|
5494 |
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
5495 |
-
// earlier than the other. We assume that the sample is longer or the same
|
5496 |
-
// and there for cut off earlier. So we should find the root most frame in
|
5497 |
-
// the sample somewhere in the control.
|
5498 |
-
c--;
|
5499 |
-
}
|
5500 |
|
5501 |
-
|
5502 |
-
|
5503 |
-
// frame that called our sample function and the control.
|
5504 |
-
if (sampleLines[s] !== controlLines[c]) {
|
5505 |
-
// In V8, the first line is describing the message but other VMs don't.
|
5506 |
-
// If we're about to return the first line, and the control is also on the same
|
5507 |
-
// line, that's a pretty good indicator that our sample threw at same line as
|
5508 |
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
5509 |
-
// This can happen if you passed a class to function component, or non-function.
|
5510 |
-
if (s !== 1 || c !== 1) {
|
5511 |
-
do {
|
5512 |
-
s--;
|
5513 |
-
c--; // We may still have similar intermediate frames from the construct call.
|
5514 |
-
// The next one that isn't the same should be our match though.
|
5515 |
|
5516 |
-
|
5517 |
-
|
5518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5519 |
|
5520 |
-
|
5521 |
-
|
5522 |
-
|
5523 |
-
|
5524 |
-
} // Return the line we found.
|
5525 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5526 |
|
5527 |
-
|
5528 |
-
}
|
5529 |
-
} while (s >= 1 && c >= 0);
|
5530 |
-
}
|
5531 |
|
5532 |
-
|
5533 |
-
|
5534 |
-
|
5535 |
-
}
|
5536 |
-
} finally {
|
5537 |
-
reentry = false;
|
5538 |
|
5539 |
-
|
5540 |
-
|
5541 |
-
|
5542 |
-
|
|
|
|
|
|
|
5543 |
|
5544 |
-
|
5545 |
-
|
|
|
|
|
|
|
|
|
|
|
5546 |
|
|
|
|
|
|
|
5547 |
|
5548 |
-
|
5549 |
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
5550 |
|
5551 |
-
|
5552 |
-
|
5553 |
-
|
5554 |
-
|
|
|
5555 |
}
|
5556 |
|
5557 |
-
|
5558 |
-
}
|
5559 |
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
5560 |
-
{
|
5561 |
-
return describeNativeComponentFrame(fn, false);
|
5562 |
-
}
|
5563 |
-
}
|
5564 |
|
5565 |
-
|
5566 |
-
|
5567 |
-
|
5568 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5569 |
|
5570 |
-
|
5571 |
|
5572 |
-
|
5573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5574 |
}
|
|
|
|
|
5575 |
|
5576 |
-
|
5577 |
-
|
5578 |
-
|
5579 |
-
|
|
|
|
|
|
|
|
|
5580 |
}
|
|
|
|
|
|
|
|
|
5581 |
|
5582 |
-
|
5583 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5584 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5585 |
|
5586 |
-
|
5587 |
-
|
5588 |
-
|
5589 |
-
|
5590 |
-
|
5591 |
-
|
|
|
|
|
5592 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
5593 |
|
5594 |
-
|
5595 |
-
|
5596 |
-
|
5597 |
-
|
5598 |
-
|
5599 |
-
|
5600 |
-
|
5601 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5602 |
|
5603 |
-
|
5604 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5605 |
|
5606 |
-
|
5607 |
-
|
5608 |
-
|
5609 |
-
|
5610 |
-
|
|
|
|
|
|
|
5611 |
|
5612 |
-
|
5613 |
-
|
5614 |
-
|
5615 |
-
|
5616 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5617 |
}
|
5618 |
}
|
|
|
5619 |
|
5620 |
-
|
5621 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5622 |
|
5623 |
-
|
5624 |
-
|
5625 |
|
5626 |
-
|
5627 |
-
|
5628 |
-
|
5629 |
-
|
5630 |
-
|
5631 |
-
|
5632 |
-
|
5633 |
-
|
5634 |
-
|
|
|
|
|
|
|
5635 |
}
|
5636 |
-
}
|
5637 |
|
5638 |
-
function
|
5639 |
-
|
5640 |
-
//
|
5641 |
-
|
|
|
|
|
5642 |
|
5643 |
-
|
5644 |
-
if (has(typeSpecs, typeSpecName)) {
|
5645 |
-
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
5646 |
-
// fail the render phase where it didn't fail before. So we log it.
|
5647 |
-
// After these have been cleaned up, we'll let them throw.
|
5648 |
|
5649 |
-
|
5650 |
-
|
5651 |
-
|
5652 |
-
|
5653 |
-
|
5654 |
-
|
5655 |
-
|
5656 |
-
|
|
|
|
|
|
|
5657 |
|
5658 |
-
|
5659 |
-
} catch (ex) {
|
5660 |
-
error$1 = ex;
|
5661 |
-
}
|
5662 |
|
5663 |
-
|
5664 |
-
|
|
|
|
|
|
|
|
|
|
|
5665 |
|
5666 |
-
|
5667 |
|
5668 |
-
|
5669 |
-
}
|
5670 |
|
5671 |
-
|
5672 |
-
|
5673 |
-
|
5674 |
-
|
5675 |
-
|
|
|
|
|
|
|
|
|
|
|
5676 |
|
5677 |
-
error('Failed %s type: %s', location, error$1.message);
|
5678 |
|
5679 |
-
|
5680 |
-
}
|
5681 |
-
}
|
5682 |
-
}
|
5683 |
-
}
|
5684 |
-
}
|
5685 |
|
5686 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5687 |
|
5688 |
-
|
5689 |
-
didWarnAboutInvalidateContextType = new Set();
|
5690 |
-
}
|
5691 |
|
5692 |
-
|
5693 |
|
5694 |
-
|
5695 |
-
|
5696 |
-
}
|
5697 |
|
5698 |
-
|
5699 |
-
var contextTypes = type.contextTypes;
|
5700 |
|
5701 |
-
|
5702 |
-
return emptyObject;
|
5703 |
-
}
|
5704 |
|
5705 |
-
|
5706 |
|
5707 |
-
|
5708 |
-
|
|
|
5709 |
}
|
5710 |
|
5711 |
-
return
|
5712 |
-
}
|
5713 |
|
5714 |
-
function
|
5715 |
-
{
|
5716 |
-
|
5717 |
}
|
|
|
|
|
|
|
|
|
|
|
5718 |
}
|
5719 |
|
5720 |
-
|
5721 |
-
|
5722 |
-
|
5723 |
-
|
5724 |
-
|
5725 |
-
|
5726 |
-
|
5727 |
-
|
5728 |
-
|
5729 |
-
|
5730 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5731 |
}
|
|
|
|
|
|
|
5732 |
}
|
5733 |
-
function processContext(type, context, threadID, isClass) {
|
5734 |
-
if (isClass) {
|
5735 |
-
var contextType = type.contextType;
|
5736 |
|
5737 |
-
|
5738 |
-
if ('contextType' in type) {
|
5739 |
-
var isValid = // Allow null for conditional declaration
|
5740 |
-
contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
|
5741 |
-
|
5742 |
-
if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
|
5743 |
-
didWarnAboutInvalidateContextType.add(type);
|
5744 |
-
var addendum = '';
|
5745 |
-
|
5746 |
-
if (contextType === undefined) {
|
5747 |
-
addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
|
5748 |
-
} else if (typeof contextType !== 'object') {
|
5749 |
-
addendum = ' However, it is set to a ' + typeof contextType + '.';
|
5750 |
-
} else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
5751 |
-
addendum = ' Did you accidentally pass the Context.Provider instead?';
|
5752 |
-
} else if (contextType._context !== undefined) {
|
5753 |
-
// <Context.Consumer>
|
5754 |
-
addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
5755 |
-
} else {
|
5756 |
-
addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
5757 |
-
}
|
5758 |
|
5759 |
-
|
5760 |
-
|
5761 |
-
}
|
5762 |
-
}
|
5763 |
|
5764 |
-
|
5765 |
-
validateContextBounds(contextType, threadID);
|
5766 |
-
return contextType[threadID];
|
5767 |
-
}
|
5768 |
|
5769 |
-
|
5770 |
-
var maskedContext = maskContext(type, context);
|
5771 |
|
5772 |
-
{
|
5773 |
-
if (type.contextTypes) {
|
5774 |
-
checkContextTypes(type.contextTypes, maskedContext, 'context');
|
5775 |
-
}
|
5776 |
-
}
|
5777 |
|
5778 |
-
|
5779 |
-
}
|
5780 |
-
} else {
|
5781 |
-
{
|
5782 |
-
var _maskedContext = maskContext(type, context);
|
5783 |
|
5784 |
-
|
5785 |
-
|
5786 |
-
|
5787 |
-
|
5788 |
-
|
|
|
5789 |
|
5790 |
-
|
5791 |
-
|
5792 |
-
}
|
5793 |
-
}
|
5794 |
|
5795 |
-
|
|
|
|
|
|
|
5796 |
|
5797 |
-
|
5798 |
-
|
5799 |
-
}
|
5800 |
|
5801 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5802 |
|
5803 |
-
function growThreadCountAndReturnNextAvailable() {
|
5804 |
-
var oldArray = nextAvailableThreadIDs;
|
5805 |
-
var oldSize = oldArray.length;
|
5806 |
-
var newSize = oldSize * 2;
|
5807 |
|
5808 |
-
|
5809 |
-
|
5810 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5811 |
}
|
5812 |
-
}
|
5813 |
|
5814 |
-
var newArray = new Uint16Array(newSize);
|
5815 |
-
newArray.set(oldArray);
|
5816 |
-
nextAvailableThreadIDs = newArray;
|
5817 |
-
nextAvailableThreadIDs[0] = oldSize + 1;
|
5818 |
|
5819 |
-
for (var _i = oldSize; _i < newSize - 1; _i++) {
|
5820 |
-
nextAvailableThreadIDs[_i] = _i + 1;
|
5821 |
-
}
|
5822 |
|
5823 |
-
nextAvailableThreadIDs[newSize - 1] = 0;
|
5824 |
-
return oldSize;
|
5825 |
}
|
|
|
|
|
|
|
|
|
5826 |
|
5827 |
-
function
|
5828 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5829 |
|
5830 |
-
|
5831 |
-
|
5832 |
-
|
|
|
|
|
|
|
5833 |
|
5834 |
-
|
5835 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5836 |
}
|
5837 |
-
|
5838 |
-
|
5839 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5840 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5841 |
|
5842 |
-
|
5843 |
-
// It is handled by React separately and shouldn't be written to the DOM.
|
5844 |
-
var RESERVED = 0; // A simple string attribute.
|
5845 |
-
// Attributes that aren't in the filter are presumed to have this type.
|
5846 |
|
5847 |
-
|
5848 |
-
|
5849 |
-
|
5850 |
-
|
|
|
|
|
|
|
|
|
|
|
5851 |
|
5852 |
-
|
5853 |
-
// When true, it should be present (set either to an empty string or its name).
|
5854 |
-
// When false, it should be omitted.
|
5855 |
|
5856 |
-
|
5857 |
-
|
5858 |
-
|
5859 |
-
// For any other value, should be present with that value.
|
5860 |
|
5861 |
-
|
5862 |
-
|
|
|
|
|
|
|
5863 |
|
5864 |
-
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
|
5865 |
-
// When falsy, it should be removed.
|
5866 |
|
5867 |
-
|
5868 |
|
5869 |
-
|
5870 |
-
|
5871 |
-
|
|
|
|
|
|
|
5872 |
|
5873 |
-
|
5874 |
-
|
5875 |
-
|
5876 |
-
|
5877 |
-
|
5878 |
-
|
5879 |
-
|
5880 |
-
if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
|
5881 |
-
return true;
|
5882 |
-
}
|
5883 |
|
5884 |
-
if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
|
5885 |
-
return false;
|
5886 |
-
}
|
5887 |
|
5888 |
-
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
5889 |
-
validatedAttributeNameCache[attributeName] = true;
|
5890 |
-
return true;
|
5891 |
-
}
|
5892 |
|
5893 |
-
|
5894 |
|
5895 |
-
|
5896 |
-
|
5897 |
-
}
|
|
|
5898 |
|
5899 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5900 |
}
|
5901 |
-
function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
|
5902 |
-
if (propertyInfo !== null) {
|
5903 |
-
return propertyInfo.type === RESERVED;
|
5904 |
-
}
|
5905 |
|
5906 |
-
|
5907 |
-
|
5908 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5909 |
|
5910 |
-
|
5911 |
-
return true;
|
5912 |
-
}
|
5913 |
|
5914 |
-
|
5915 |
-
|
5916 |
-
|
5917 |
-
|
5918 |
-
|
|
|
5919 |
}
|
|
|
5920 |
|
5921 |
-
|
5922 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5923 |
|
5924 |
-
|
5925 |
-
// eslint-disable-line
|
5926 |
-
return true;
|
5927 |
|
5928 |
-
case 'boolean':
|
5929 |
-
{
|
5930 |
-
if (isCustomComponentTag) {
|
5931 |
-
return false;
|
5932 |
-
}
|
5933 |
|
5934 |
-
|
5935 |
-
return !propertyInfo.acceptsBooleans;
|
5936 |
-
} else {
|
5937 |
-
var prefix = name.toLowerCase().slice(0, 5);
|
5938 |
-
return prefix !== 'data-' && prefix !== 'aria-';
|
5939 |
-
}
|
5940 |
-
}
|
5941 |
|
5942 |
-
|
5943 |
-
|
5944 |
-
|
5945 |
-
|
5946 |
-
|
5947 |
-
|
5948 |
-
return true;
|
5949 |
-
}
|
5950 |
|
5951 |
-
|
5952 |
-
|
5953 |
-
|
|
|
|
|
|
|
|
|
5954 |
|
5955 |
-
if (isCustomComponentTag) {
|
5956 |
-
return false;
|
5957 |
-
}
|
5958 |
|
5959 |
-
if (propertyInfo !== null) {
|
5960 |
|
5961 |
-
|
5962 |
-
|
5963 |
-
return !value;
|
5964 |
|
5965 |
-
|
5966 |
-
|
5967 |
|
5968 |
-
|
5969 |
-
|
5970 |
|
5971 |
-
|
5972 |
-
|
|
|
|
|
|
|
5973 |
}
|
5974 |
-
|
5975 |
-
|
5976 |
-
|
|
|
|
|
|
|
|
|
5977 |
}
|
5978 |
-
|
5979 |
-
|
|
|
5980 |
}
|
5981 |
|
5982 |
-
function
|
5983 |
-
|
5984 |
-
|
5985 |
-
|
5986 |
-
this.mustUseProperty = mustUseProperty;
|
5987 |
-
this.propertyName = name;
|
5988 |
-
this.type = type;
|
5989 |
-
this.sanitizeURL = sanitizeURL;
|
5990 |
-
this.removeEmptyString = removeEmptyString;
|
5991 |
-
} // When adding attributes to this list, be sure to also add them to
|
5992 |
-
// the `possibleStandardNames` module to ensure casing and incorrect
|
5993 |
-
// name warnings.
|
5994 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5995 |
|
5996 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5997 |
|
5998 |
-
var
|
5999 |
-
|
6000 |
-
//
|
6001 |
-
|
6002 |
-
|
6003 |
-
|
6004 |
-
|
6005 |
-
|
6006 |
-
|
6007 |
-
|
6008 |
-
|
6009 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6010 |
|
6011 |
-
|
6012 |
-
|
6013 |
-
|
6014 |
-
|
6015 |
-
|
6016 |
-
|
6017 |
-
|
6018 |
-
|
6019 |
-
|
6020 |
-
//
|
6021 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6022 |
|
6023 |
-
|
6024 |
-
|
6025 |
-
|
6026 |
-
|
6027 |
-
|
6028 |
-
|
6029 |
-
|
6030 |
-
|
6031 |
-
|
6032 |
-
|
|
|
|
|
|
|
6033 |
|
6034 |
-
|
6035 |
-
|
6036 |
-
|
6037 |
-
|
6038 |
-
|
6039 |
-
|
6040 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6041 |
|
6042 |
-
|
6043 |
-
|
6044 |
-
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
|
6045 |
-
'itemScope'].forEach(function (name) {
|
6046 |
-
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
6047 |
-
name.toLowerCase(), // attributeName
|
6048 |
-
null, // attributeNamespace
|
6049 |
-
false, // sanitizeURL
|
6050 |
-
false);
|
6051 |
-
}); // These are the few React props that we set as DOM properties
|
6052 |
-
// rather than attributes. These are all booleans.
|
6053 |
|
6054 |
-
|
6055 |
-
|
6056 |
-
'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
|
6057 |
-
// you'll need to set attributeName to name.toLowerCase()
|
6058 |
-
// instead in the assignment below.
|
6059 |
-
].forEach(function (name) {
|
6060 |
-
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
6061 |
-
name, // attributeName
|
6062 |
-
null, // attributeNamespace
|
6063 |
-
false, // sanitizeURL
|
6064 |
-
false);
|
6065 |
-
}); // These are HTML attributes that are "overloaded booleans": they behave like
|
6066 |
-
// booleans, but can also accept a string value.
|
6067 |
|
6068 |
-
|
6069 |
-
|
6070 |
-
|
6071 |
-
|
6072 |
-
|
6073 |
-
|
6074 |
-
|
6075 |
-
|
6076 |
-
|
6077 |
-
}); // These are HTML attributes that must be positive numbers.
|
6078 |
|
6079 |
-
|
6080 |
-
|
6081 |
-
|
6082 |
-
|
6083 |
-
|
6084 |
-
|
6085 |
-
null, // attributeNamespace
|
6086 |
-
false, // sanitizeURL
|
6087 |
-
false);
|
6088 |
-
}); // These are HTML attributes that must be numbers.
|
6089 |
|
6090 |
-
|
6091 |
-
|
6092 |
-
|
6093 |
-
null, // attributeNamespace
|
6094 |
-
false, // sanitizeURL
|
6095 |
-
false);
|
6096 |
-
});
|
6097 |
-
var CAMELIZE = /[\-\:]([a-z])/g;
|
6098 |
|
6099 |
-
|
6100 |
-
|
6101 |
-
|
6102 |
-
|
6103 |
-
|
6104 |
-
|
6105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6107 |
|
6108 |
-
|
6109 |
-
|
6110 |
-
|
6111 |
-
|
6112 |
-
|
6113 |
-
|
6114 |
-
|
6115 |
-
|
6116 |
-
|
6117 |
-
|
|
|
6118 |
|
6119 |
-
|
6120 |
-
|
6121 |
-
|
6122 |
-
|
6123 |
-
|
6124 |
-
|
6125 |
-
|
6126 |
-
|
6127 |
-
}
|
|
|
|
|
6128 |
|
6129 |
-
|
6130 |
-
|
6131 |
-
|
6132 |
-
|
6133 |
-
|
6134 |
-
|
6135 |
-
|
6136 |
-
|
6137 |
-
}
|
6138 |
-
|
6139 |
-
|
|
|
|
|
|
|
6140 |
|
6141 |
-
|
6142 |
-
|
6143 |
-
|
6144 |
-
|
6145 |
-
|
6146 |
-
|
6147 |
-
}
|
6148 |
-
// These will also need to accept Trusted Types object in the future.
|
6149 |
|
6150 |
-
var
|
6151 |
-
|
6152 |
-
|
6153 |
-
|
6154 |
-
|
6155 |
-
|
6156 |
-
|
6157 |
-
|
6158 |
-
|
6159 |
-
|
6160 |
-
}
|
6161 |
|
6162 |
-
|
6163 |
-
|
6164 |
-
|
6165 |
-
|
6166 |
-
|
6167 |
-
|
6168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6169 |
|
6170 |
-
|
|
|
|
|
|
|
|
|
6171 |
|
6172 |
-
var
|
6173 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6174 |
|
6175 |
-
function
|
6176 |
-
|
6177 |
-
|
6178 |
-
|
|
|
|
|
|
|
6179 |
|
6180 |
-
|
6181 |
}
|
|
|
6182 |
}
|
6183 |
-
}
|
6184 |
-
|
6185 |
-
// code copied and modified from escape-html
|
6186 |
|
6187 |
-
|
6188 |
-
|
6189 |
-
|
6190 |
-
|
6191 |
-
|
6192 |
-
|
6193 |
-
|
6194 |
-
|
6195 |
-
|
6196 |
-
* @return {string}
|
6197 |
-
* @public
|
6198 |
-
*/
|
6199 |
-
|
6200 |
-
function escapeHtml(string) {
|
6201 |
-
var str = '' + string;
|
6202 |
-
var match = matchHtmlRegExp.exec(str);
|
6203 |
|
6204 |
-
|
6205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6206 |
}
|
6207 |
|
6208 |
-
|
6209 |
-
|
6210 |
-
|
6211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6212 |
|
6213 |
-
|
6214 |
-
|
6215 |
-
case 34:
|
6216 |
-
// "
|
6217 |
-
escape = '"';
|
6218 |
-
break;
|
6219 |
|
6220 |
-
|
6221 |
-
|
6222 |
-
|
6223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6224 |
|
6225 |
-
|
6226 |
-
|
6227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6228 |
|
6229 |
-
|
|
|
|
|
|
|
|
|
6230 |
|
6231 |
-
|
6232 |
-
|
6233 |
-
|
6234 |
-
|
|
|
6235 |
|
6236 |
-
|
6237 |
-
|
6238 |
-
|
6239 |
-
|
6240 |
|
6241 |
-
|
6242 |
-
|
|
|
6243 |
}
|
6244 |
|
6245 |
-
|
6246 |
-
|
|
|
6247 |
}
|
6248 |
|
6249 |
-
|
6250 |
-
html += escape;
|
6251 |
}
|
6252 |
|
6253 |
-
|
6254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6255 |
|
6256 |
-
|
6257 |
-
|
6258 |
-
|
6259 |
-
|
6260 |
-
|
6261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6263 |
|
6264 |
-
|
6265 |
-
|
6266 |
-
|
6267 |
-
|
6268 |
-
|
6269 |
-
return
|
6270 |
}
|
6271 |
|
6272 |
-
|
6273 |
-
|
|
|
6274 |
|
6275 |
-
|
6276 |
-
|
6277 |
-
*
|
6278 |
-
* @param {*} value Value to escape.
|
6279 |
-
* @return {string} An escaped string.
|
6280 |
-
*/
|
6281 |
|
6282 |
-
function quoteAttributeValueForBrowser(value) {
|
6283 |
-
return '"' + escapeTextForBrowser(value) + '"';
|
6284 |
-
}
|
6285 |
|
6286 |
-
|
6287 |
-
|
6288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6289 |
/**
|
6290 |
-
*
|
6291 |
*
|
6292 |
-
*
|
6293 |
-
*
|
6294 |
-
* @return {?string} Markup string, or null if the property was invalid.
|
6295 |
*/
|
6296 |
|
6297 |
-
|
6298 |
-
var
|
6299 |
-
|
6300 |
-
if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
|
6301 |
-
return '';
|
6302 |
-
}
|
6303 |
|
6304 |
-
|
6305 |
-
|
6306 |
-
|
|
|
|
|
6307 |
|
6308 |
-
if (propertyInfo !== null) {
|
6309 |
-
var attributeName = propertyInfo.attributeName;
|
6310 |
-
var type = propertyInfo.type;
|
6311 |
|
6312 |
-
|
6313 |
-
return attributeName + '=""';
|
6314 |
-
} else {
|
6315 |
-
if (propertyInfo.sanitizeURL) {
|
6316 |
-
value = '' + value;
|
6317 |
-
sanitizeURL(value);
|
6318 |
-
}
|
6319 |
|
6320 |
-
|
6321 |
-
|
6322 |
-
|
6323 |
-
|
6324 |
-
|
|
|
6325 |
|
6326 |
-
|
6327 |
-
}
|
6328 |
/**
|
6329 |
-
*
|
6330 |
*
|
6331 |
-
*
|
6332 |
-
*
|
6333 |
-
* @return {string} Markup string, or empty string if the property was invalid.
|
6334 |
*/
|
6335 |
|
6336 |
-
function createMarkupForCustomAttribute(name, value) {
|
6337 |
-
if (!isAttributeNameSafe(name) || value == null) {
|
6338 |
-
return '';
|
6339 |
-
}
|
6340 |
|
6341 |
-
return name + '=' + quoteAttributeValueForBrowser(value);
|
6342 |
-
}
|
6343 |
|
6344 |
-
|
6345 |
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
6346 |
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
6347 |
-
*/
|
6348 |
-
function is(x, y) {
|
6349 |
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
6350 |
-
;
|
6351 |
-
}
|
6352 |
-
|
6353 |
-
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
6354 |
|
6355 |
-
|
6356 |
-
var firstWorkInProgressHook = null;
|
6357 |
-
var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook
|
6358 |
|
6359 |
-
var isReRender = false; // Whether an update was scheduled during the currently executing render pass.
|
6360 |
|
6361 |
-
|
6362 |
|
6363 |
-
|
|
|
|
|
|
|
|
|
|
|
6364 |
|
6365 |
-
|
6366 |
-
|
6367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6368 |
|
6369 |
-
var currentHookNameInDev;
|
6370 |
|
6371 |
-
function resolveCurrentlyRenderingComponent() {
|
6372 |
-
if (!(currentlyRenderingComponent !== null)) {
|
6373 |
-
{
|
6374 |
-
throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
|
6375 |
-
}
|
6376 |
-
}
|
6377 |
|
6378 |
-
|
6379 |
-
|
6380 |
-
|
6381 |
-
}
|
6382 |
-
}
|
6383 |
|
6384 |
-
|
6385 |
-
|
|
|
|
|
6386 |
|
6387 |
-
|
6388 |
-
if (prevDeps === null) {
|
6389 |
-
{
|
6390 |
-
error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
|
6391 |
-
}
|
6392 |
|
6393 |
-
|
6394 |
-
|
|
|
|
|
6395 |
|
|
|
6396 |
{
|
6397 |
-
|
6398 |
-
|
6399 |
-
if (nextDeps.length !== prevDeps.length) {
|
6400 |
-
error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
|
6401 |
}
|
6402 |
-
}
|
6403 |
|
6404 |
-
|
6405 |
-
|
6406 |
-
|
|
|
|
|
|
|
|
|
6407 |
}
|
6408 |
|
6409 |
-
|
6410 |
}
|
6411 |
-
|
6412 |
-
return true;
|
6413 |
}
|
6414 |
|
6415 |
-
function
|
6416 |
-
|
6417 |
-
|
6418 |
-
|
6419 |
-
|
6420 |
-
|
|
|
|
|
|
|
|
|
6421 |
}
|
6422 |
-
}
|
6423 |
|
6424 |
-
|
6425 |
-
|
6426 |
-
|
6427 |
-
next: null
|
6428 |
-
};
|
6429 |
-
}
|
6430 |
|
6431 |
-
|
6432 |
-
|
6433 |
-
//
|
6434 |
-
if (firstWorkInProgressHook === null) {
|
6435 |
-
isReRender = false;
|
6436 |
-
firstWorkInProgressHook = workInProgressHook = createHook();
|
6437 |
-
} else {
|
6438 |
-
// There's already a work-in-progress. Reuse it.
|
6439 |
-
isReRender = true;
|
6440 |
-
workInProgressHook = firstWorkInProgressHook;
|
6441 |
-
}
|
6442 |
-
} else {
|
6443 |
-
if (workInProgressHook.next === null) {
|
6444 |
-
isReRender = false; // Append to the end of the list
|
6445 |
|
6446 |
-
|
6447 |
-
} else {
|
6448 |
-
// There's already a work-in-progress. Reuse it.
|
6449 |
-
isReRender = true;
|
6450 |
-
workInProgressHook = workInProgressHook.next;
|
6451 |
-
}
|
6452 |
}
|
6453 |
-
|
6454 |
-
return workInProgressHook;
|
6455 |
}
|
6456 |
|
6457 |
-
|
6458 |
-
currentlyRenderingComponent = componentIdentity;
|
6459 |
-
|
6460 |
{
|
6461 |
-
|
6462 |
-
}
|
6463 |
-
// didScheduleRenderPhaseUpdate = false;
|
6464 |
-
// firstWorkInProgressHook = null;
|
6465 |
-
// numberOfReRenders = 0;
|
6466 |
-
// renderPhaseUpdates = null;
|
6467 |
-
// workInProgressHook = null;
|
6468 |
-
|
6469 |
}
|
6470 |
-
function finishHooks(Component, props, children, refOrContext) {
|
6471 |
-
// This must be called after every function component to prevent hooks from
|
6472 |
-
// being used in classes.
|
6473 |
-
while (didScheduleRenderPhaseUpdate) {
|
6474 |
-
// Updates were scheduled during the render phase. They are stored in
|
6475 |
-
// the `renderPhaseUpdates` map. Call the component again, reusing the
|
6476 |
-
// work-in-progress hooks and applying the additional updates on top. Keep
|
6477 |
-
// restarting until no more updates are scheduled.
|
6478 |
-
didScheduleRenderPhaseUpdate = false;
|
6479 |
-
numberOfReRenders += 1; // Start over from the beginning of the list
|
6480 |
|
6481 |
-
|
6482 |
-
|
6483 |
-
|
6484 |
|
6485 |
-
|
6486 |
-
return children;
|
6487 |
-
} // Reset the internal hooks state if an error occurs while rendering a component
|
6488 |
|
6489 |
-
|
6490 |
-
{
|
6491 |
-
isInHookUserCodeInDev = false;
|
6492 |
-
}
|
6493 |
|
6494 |
-
|
6495 |
-
|
6496 |
-
|
6497 |
-
|
6498 |
-
|
6499 |
-
|
6500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6501 |
|
6502 |
-
|
6503 |
-
var threadID = currentPartialRenderer.threadID;
|
6504 |
-
validateContextBounds(context, threadID);
|
6505 |
|
6506 |
-
|
6507 |
-
if (isInHookUserCodeInDev) {
|
6508 |
-
error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
|
6509 |
-
}
|
6510 |
-
}
|
6511 |
|
6512 |
-
|
6513 |
-
|
|
|
6514 |
|
6515 |
-
|
6516 |
-
|
6517 |
-
|
6518 |
-
|
6519 |
|
6520 |
-
resolveCurrentlyRenderingComponent();
|
6521 |
-
var threadID = currentPartialRenderer.threadID;
|
6522 |
-
validateContextBounds(context, threadID);
|
6523 |
-
return context[threadID];
|
6524 |
-
}
|
6525 |
|
6526 |
-
|
6527 |
-
|
6528 |
-
|
6529 |
-
|
|
|
|
|
|
|
6530 |
|
6531 |
-
|
6532 |
-
{
|
6533 |
-
currentHookNameInDev = 'useState';
|
6534 |
-
}
|
6535 |
|
6536 |
-
|
6537 |
-
|
|
|
6538 |
}
|
6539 |
-
function
|
6540 |
{
|
6541 |
-
if (
|
6542 |
-
|
6543 |
}
|
6544 |
}
|
6545 |
|
6546 |
-
|
6547 |
-
workInProgressHook = createWorkInProgressHook();
|
6548 |
-
|
6549 |
-
if (isReRender) {
|
6550 |
-
// This is a re-render. Apply the new render phase updates to the previous
|
6551 |
-
// current hook.
|
6552 |
-
var queue = workInProgressHook.queue;
|
6553 |
-
var dispatch = queue.dispatch;
|
6554 |
-
|
6555 |
-
if (renderPhaseUpdates !== null) {
|
6556 |
-
// Render phase updates are stored in a map of queue -> linked list
|
6557 |
-
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
6558 |
-
|
6559 |
-
if (firstRenderPhaseUpdate !== undefined) {
|
6560 |
-
renderPhaseUpdates.delete(queue);
|
6561 |
-
var newState = workInProgressHook.memoizedState;
|
6562 |
-
var update = firstRenderPhaseUpdate;
|
6563 |
-
|
6564 |
-
do {
|
6565 |
-
// Process this render phase update. We don't have to check the
|
6566 |
-
// priority because it will always be the same as the current
|
6567 |
-
// render's.
|
6568 |
-
var action = update.action;
|
6569 |
|
6570 |
-
|
6571 |
-
|
6572 |
-
|
6573 |
|
6574 |
-
|
|
|
|
|
|
|
6575 |
|
6576 |
-
|
6577 |
-
|
6578 |
-
|
|
|
6579 |
|
6580 |
-
|
6581 |
-
} while (update !== null);
|
6582 |
|
6583 |
-
|
6584 |
-
|
6585 |
-
|
6586 |
-
|
6587 |
|
6588 |
-
|
6589 |
-
|
6590 |
-
|
6591 |
-
|
6592 |
-
}
|
6593 |
|
6594 |
-
|
|
|
|
|
6595 |
|
6596 |
-
|
6597 |
-
|
6598 |
-
|
6599 |
-
|
6600 |
-
initialState = init !== undefined ? init(initialArg) : initialArg;
|
6601 |
-
}
|
6602 |
|
6603 |
-
|
6604 |
-
|
6605 |
-
}
|
6606 |
|
6607 |
-
|
|
|
6608 |
|
6609 |
-
|
6610 |
-
last: null,
|
6611 |
-
dispatch: null
|
6612 |
-
};
|
6613 |
|
6614 |
-
|
|
|
|
|
6615 |
|
6616 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6617 |
}
|
6618 |
-
}
|
6619 |
|
6620 |
-
|
6621 |
-
|
6622 |
-
|
6623 |
-
var nextDeps = deps === undefined ? null : deps;
|
6624 |
|
6625 |
-
if (
|
6626 |
-
|
|
|
|
|
6627 |
|
6628 |
-
|
6629 |
-
if (nextDeps !== null) {
|
6630 |
-
var prevDeps = prevState[1];
|
6631 |
|
6632 |
-
|
6633 |
-
|
6634 |
-
}
|
6635 |
-
}
|
6636 |
-
}
|
6637 |
}
|
6638 |
|
6639 |
-
|
6640 |
-
|
|
|
|
|
|
|
6641 |
}
|
6642 |
|
6643 |
-
|
|
|
|
|
6644 |
|
6645 |
-
{
|
6646 |
-
|
6647 |
}
|
6648 |
|
6649 |
-
|
6650 |
-
return nextValue;
|
6651 |
}
|
|
|
|
|
|
|
|
|
6652 |
|
6653 |
-
|
6654 |
-
|
6655 |
-
workInProgressHook = createWorkInProgressHook();
|
6656 |
-
var previousRef = workInProgressHook.memoizedState;
|
6657 |
-
|
6658 |
-
if (previousRef === null) {
|
6659 |
-
var ref = {
|
6660 |
-
current: initialValue
|
6661 |
-
};
|
6662 |
|
6663 |
-
|
6664 |
-
|
6665 |
-
|
6666 |
|
6667 |
-
|
6668 |
-
|
6669 |
-
|
6670 |
-
|
6671 |
-
|
6672 |
-
}
|
6673 |
|
6674 |
-
|
6675 |
-
|
6676 |
-
|
|
|
|
|
|
|
|
|
6677 |
|
6678 |
-
|
|
|
6679 |
}
|
6680 |
}
|
|
|
|
|
|
|
|
|
6681 |
|
6682 |
-
|
6683 |
-
|
6684 |
-
{
|
6685 |
-
throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." );
|
6686 |
-
}
|
6687 |
}
|
6688 |
|
6689 |
-
if (
|
6690 |
-
|
6691 |
-
|
6692 |
-
// and apply the stashed updates on top of the work-in-progress hook.
|
6693 |
-
didScheduleRenderPhaseUpdate = true;
|
6694 |
-
var update = {
|
6695 |
-
action: action,
|
6696 |
-
next: null
|
6697 |
-
};
|
6698 |
|
6699 |
-
|
6700 |
-
renderPhaseUpdates = new Map();
|
6701 |
-
}
|
6702 |
|
6703 |
-
|
|
|
|
|
6704 |
|
6705 |
-
|
6706 |
-
|
6707 |
-
} else {
|
6708 |
-
// Append the update to the end of the list.
|
6709 |
-
var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
|
6710 |
|
6711 |
-
|
6712 |
-
|
6713 |
-
}
|
6714 |
|
6715 |
-
|
|
|
6716 |
}
|
6717 |
}
|
6718 |
-
}
|
6719 |
-
|
6720 |
-
function useCallback(callback, deps) {
|
6721 |
-
return useMemo(function () {
|
6722 |
-
return callback;
|
6723 |
-
}, deps);
|
6724 |
-
} // TODO Decide on how to implement this hook for server rendering.
|
6725 |
-
// If a mutation occurs during render, consider triggering a Suspense boundary
|
6726 |
-
// and falling back to client rendering.
|
6727 |
|
6728 |
-
|
6729 |
-
resolveCurrentlyRenderingComponent();
|
6730 |
-
return getSnapshot(source._source);
|
6731 |
}
|
6732 |
-
|
6733 |
-
|
6734 |
-
resolveCurrentlyRenderingComponent();
|
6735 |
-
return value;
|
6736 |
}
|
6737 |
|
6738 |
-
function
|
6739 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6740 |
|
6741 |
-
var startTransition = function (callback) {
|
6742 |
-
callback();
|
6743 |
-
};
|
6744 |
|
6745 |
-
|
6746 |
-
}
|
6747 |
|
6748 |
-
|
6749 |
-
|
6750 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6751 |
|
6752 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6753 |
|
6754 |
-
|
6755 |
-
|
6756 |
-
|
6757 |
-
|
6758 |
-
|
6759 |
-
|
6760 |
-
|
6761 |
-
|
6762 |
-
|
6763 |
-
|
6764 |
-
useState: useState,
|
6765 |
-
useLayoutEffect: useLayoutEffect,
|
6766 |
-
useCallback: useCallback,
|
6767 |
-
// useImperativeHandle is not run in the server environment
|
6768 |
-
useImperativeHandle: noop,
|
6769 |
-
// Effects are not run in the server environment.
|
6770 |
-
useEffect: noop,
|
6771 |
-
// Debugging effect
|
6772 |
-
useDebugValue: noop,
|
6773 |
-
useDeferredValue: useDeferredValue,
|
6774 |
-
useTransition: useTransition,
|
6775 |
-
useOpaqueIdentifier: useOpaqueIdentifier,
|
6776 |
-
// Subscriptions are not setup in a server environment.
|
6777 |
-
useMutableSource: useMutableSource
|
6778 |
-
};
|
6779 |
|
6780 |
-
|
6781 |
-
|
6782 |
-
|
6783 |
-
|
6784 |
-
|
6785 |
-
|
6786 |
-
|
6787 |
-
}; // Assumes there is no parent namespace.
|
6788 |
|
6789 |
-
|
6790 |
-
|
6791 |
-
|
6792 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6793 |
|
6794 |
-
|
6795 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6796 |
|
6797 |
-
|
6798 |
-
|
6799 |
-
|
6800 |
-
|
6801 |
-
|
6802 |
-
|
6803 |
-
|
6804 |
-
|
6805 |
-
|
|
|
6806 |
|
6807 |
-
|
6808 |
-
|
6809 |
-
|
6810 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6811 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6812 |
|
6813 |
-
|
6814 |
-
|
|
|
|
|
|
|
|
|
|
|
6815 |
|
6816 |
-
var hasReadOnlyValue = {
|
6817 |
-
button: true,
|
6818 |
-
checkbox: true,
|
6819 |
-
image: true,
|
6820 |
-
hidden: true,
|
6821 |
-
radio: true,
|
6822 |
-
reset: true,
|
6823 |
-
submit: true
|
6824 |
-
};
|
6825 |
-
function checkControlledValueProps(tagName, props) {
|
6826 |
-
{
|
6827 |
-
if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) {
|
6828 |
-
error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
6829 |
-
}
|
6830 |
-
|
6831 |
-
if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) {
|
6832 |
-
error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
6833 |
-
}
|
6834 |
-
}
|
6835 |
-
}
|
6836 |
-
|
6837 |
-
// For HTML, certain tags should omit their close tag. We keep a list for
|
6838 |
-
// those special-case tags.
|
6839 |
-
var omittedCloseTags = {
|
6840 |
-
area: true,
|
6841 |
-
base: true,
|
6842 |
-
br: true,
|
6843 |
-
col: true,
|
6844 |
-
embed: true,
|
6845 |
-
hr: true,
|
6846 |
-
img: true,
|
6847 |
-
input: true,
|
6848 |
-
keygen: true,
|
6849 |
-
link: true,
|
6850 |
-
meta: true,
|
6851 |
-
param: true,
|
6852 |
-
source: true,
|
6853 |
-
track: true,
|
6854 |
-
wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
|
6855 |
-
|
6856 |
-
};
|
6857 |
|
6858 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6859 |
|
6860 |
-
|
6861 |
-
|
6862 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6863 |
|
6864 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6865 |
|
6866 |
-
function
|
6867 |
-
|
6868 |
-
|
6869 |
-
|
|
|
|
|
|
|
|
|
6870 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6871 |
|
6872 |
-
|
6873 |
-
|
6874 |
-
|
6875 |
-
|
6876 |
-
|
6877 |
-
|
6878 |
-
|
6879 |
|
6880 |
-
|
6881 |
-
if (!(props.children == null)) {
|
6882 |
-
{
|
6883 |
-
throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." );
|
6884 |
-
}
|
6885 |
-
}
|
6886 |
|
6887 |
-
|
6888 |
-
|
6889 |
-
throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information." );
|
6890 |
-
}
|
6891 |
-
}
|
6892 |
-
}
|
6893 |
|
|
|
6894 |
{
|
6895 |
-
if (!
|
6896 |
-
|
6897 |
-
}
|
6898 |
-
}
|
6899 |
|
6900 |
-
|
6901 |
-
{
|
6902 |
-
throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." );
|
6903 |
}
|
6904 |
}
|
6905 |
}
|
6906 |
|
6907 |
/**
|
6908 |
-
*
|
6909 |
-
|
6910 |
-
|
6911 |
-
animationIterationCount: true,
|
6912 |
-
borderImageOutset: true,
|
6913 |
-
borderImageSlice: true,
|
6914 |
-
borderImageWidth: true,
|
6915 |
-
boxFlex: true,
|
6916 |
-
boxFlexGroup: true,
|
6917 |
-
boxOrdinalGroup: true,
|
6918 |
-
columnCount: true,
|
6919 |
-
columns: true,
|
6920 |
-
flex: true,
|
6921 |
-
flexGrow: true,
|
6922 |
-
flexPositive: true,
|
6923 |
-
flexShrink: true,
|
6924 |
-
flexNegative: true,
|
6925 |
-
flexOrder: true,
|
6926 |
-
gridArea: true,
|
6927 |
-
gridRow: true,
|
6928 |
-
gridRowEnd: true,
|
6929 |
-
gridRowSpan: true,
|
6930 |
-
gridRowStart: true,
|
6931 |
-
gridColumn: true,
|
6932 |
-
gridColumnEnd: true,
|
6933 |
-
gridColumnSpan: true,
|
6934 |
-
gridColumnStart: true,
|
6935 |
-
fontWeight: true,
|
6936 |
-
lineClamp: true,
|
6937 |
-
lineHeight: true,
|
6938 |
-
opacity: true,
|
6939 |
-
order: true,
|
6940 |
-
orphans: true,
|
6941 |
-
tabSize: true,
|
6942 |
-
widows: true,
|
6943 |
-
zIndex: true,
|
6944 |
-
zoom: true,
|
6945 |
-
// SVG-related properties
|
6946 |
-
fillOpacity: true,
|
6947 |
-
floodOpacity: true,
|
6948 |
-
stopOpacity: true,
|
6949 |
-
strokeDasharray: true,
|
6950 |
-
strokeDashoffset: true,
|
6951 |
-
strokeMiterlimit: true,
|
6952 |
-
strokeOpacity: true,
|
6953 |
-
strokeWidth: true
|
6954 |
-
};
|
6955 |
-
/**
|
6956 |
-
* @param {string} prefix vendor-specific prefix, eg: Webkit
|
6957 |
-
* @param {string} key style name, eg: transitionDuration
|
6958 |
-
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
|
6959 |
-
* WebkitTransitionDuration
|
6960 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6961 |
|
6962 |
-
|
6963 |
-
|
6964 |
-
}
|
6965 |
-
/**
|
6966 |
-
* Support style names that may come passed in prefixed by adding permutations
|
6967 |
-
* of vendor prefixes.
|
6968 |
-
*/
|
6969 |
|
|
|
|
|
|
|
6970 |
|
6971 |
-
|
6972 |
-
|
|
|
6973 |
|
6974 |
-
|
6975 |
-
|
6976 |
-
|
6977 |
-
});
|
6978 |
-
});
|
6979 |
|
6980 |
-
|
6981 |
-
|
6982 |
-
|
6983 |
-
* in `CSSProperty.isUnitlessNumber`.
|
6984 |
-
*
|
6985 |
-
* @param {string} name CSS property name such as `topMargin`.
|
6986 |
-
* @param {*} value CSS property value such as `10px`.
|
6987 |
-
* @return {string} Normalized style value with dimensions applied.
|
6988 |
-
*/
|
6989 |
|
6990 |
-
|
6991 |
-
|
6992 |
-
|
6993 |
-
|
6994 |
-
|
6995 |
-
|
6996 |
-
|
6997 |
-
|
6998 |
-
// which has lead to a greater discussion about how we're going to
|
6999 |
-
// trust URLs moving forward. See #2115901
|
7000 |
-
var isEmpty = value == null || typeof value === 'boolean' || value === '';
|
7001 |
|
7002 |
-
|
7003 |
-
|
7004 |
-
|
|
|
|
|
|
|
|
|
|
|
7005 |
|
7006 |
-
if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
|
7007 |
-
return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
|
7008 |
-
}
|
7009 |
|
7010 |
-
|
7011 |
-
}
|
7012 |
|
7013 |
-
|
7014 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7015 |
/**
|
7016 |
-
*
|
7017 |
-
*
|
7018 |
-
*
|
7019 |
-
* < "background-color"
|
7020 |
-
* > hyphenateStyleName('MozTransition')
|
7021 |
-
* < "-moz-transition"
|
7022 |
-
* > hyphenateStyleName('msTransition')
|
7023 |
-
* < "-ms-transition"
|
7024 |
-
*
|
7025 |
-
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
|
7026 |
-
* is converted to `-ms-`.
|
7027 |
*/
|
7028 |
|
7029 |
-
function
|
7030 |
-
|
7031 |
-
|
7032 |
-
|
7033 |
-
|
7034 |
-
|
7035 |
-
|
7036 |
-
}
|
7037 |
-
|
7038 |
-
switch (tagName) {
|
7039 |
-
// These are reserved SVG and MathML elements.
|
7040 |
-
// We don't mind this list too much because we expect it to never grow.
|
7041 |
-
// The alternative is to track the namespace in a few places which is convoluted.
|
7042 |
-
// https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
|
7043 |
-
case 'annotation-xml':
|
7044 |
-
case 'color-profile':
|
7045 |
-
case 'font-face':
|
7046 |
-
case 'font-face-src':
|
7047 |
-
case 'font-face-uri':
|
7048 |
-
case 'font-face-format':
|
7049 |
-
case 'font-face-name':
|
7050 |
-
case 'missing-glyph':
|
7051 |
-
return false;
|
7052 |
-
|
7053 |
-
default:
|
7054 |
-
return true;
|
7055 |
-
}
|
7056 |
-
}
|
7057 |
|
7058 |
-
var warnValidStyle = function () {};
|
7059 |
|
7060 |
-
{
|
7061 |
-
|
7062 |
-
|
7063 |
-
var msPattern$1 = /^-ms-/;
|
7064 |
-
var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
|
7065 |
|
7066 |
-
|
7067 |
-
|
7068 |
-
|
7069 |
-
var warnedForNaNValue = false;
|
7070 |
-
var warnedForInfinityValue = false;
|
7071 |
|
7072 |
-
|
7073 |
-
return string.replace(hyphenPattern, function (_, character) {
|
7074 |
-
return character.toUpperCase();
|
7075 |
-
});
|
7076 |
-
};
|
7077 |
|
7078 |
-
|
7079 |
-
|
7080 |
-
return;
|
7081 |
}
|
7082 |
|
7083 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7084 |
|
7085 |
-
|
7086 |
-
|
7087 |
-
// is converted to lowercase `ms`.
|
7088 |
-
camelize(name.replace(msPattern$1, 'ms-')));
|
7089 |
-
};
|
7090 |
|
7091 |
-
|
7092 |
-
|
7093 |
-
|
7094 |
-
}
|
7095 |
|
7096 |
-
|
|
|
|
|
7097 |
|
7098 |
-
error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
|
7099 |
-
};
|
7100 |
|
7101 |
-
|
7102 |
-
if (
|
7103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
7104 |
}
|
7105 |
|
7106 |
-
|
|
|
7107 |
|
7108 |
-
|
7109 |
-
};
|
7110 |
|
7111 |
-
|
7112 |
-
|
7113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7114 |
}
|
7115 |
|
7116 |
-
|
|
|
7117 |
|
7118 |
-
error('`NaN` is an invalid value for the `%s` css style property.', name);
|
7119 |
-
};
|
7120 |
|
7121 |
-
var
|
7122 |
-
|
7123 |
-
return;
|
7124 |
-
}
|
7125 |
|
7126 |
-
|
|
|
|
|
|
|
|
|
7127 |
|
7128 |
-
|
7129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7130 |
|
7131 |
-
|
7132 |
-
|
7133 |
-
|
7134 |
-
} else if (badVendoredStyleNamePattern.test(name)) {
|
7135 |
-
warnBadVendoredStyleName(name);
|
7136 |
-
} else if (badStyleValueWithSemicolonPattern.test(value)) {
|
7137 |
-
warnStyleValueWithSemicolon(name, value);
|
7138 |
}
|
7139 |
|
7140 |
-
if (
|
7141 |
-
|
7142 |
-
|
7143 |
-
|
7144 |
-
warnStyleValueIsInfinity(name, value);
|
7145 |
-
}
|
7146 |
}
|
7147 |
-
}
|
7148 |
}
|
7149 |
|
7150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7151 |
|
7152 |
-
|
7153 |
-
|
7154 |
-
|
7155 |
-
'
|
7156 |
-
'
|
7157 |
-
|
7158 |
-
'
|
7159 |
-
|
7160 |
-
'
|
7161 |
-
|
7162 |
-
'
|
7163 |
-
'
|
7164 |
-
'
|
7165 |
-
|
7166 |
-
'
|
7167 |
-
'
|
7168 |
-
'
|
7169 |
-
'
|
7170 |
-
'
|
7171 |
-
'
|
7172 |
-
'
|
7173 |
-
'
|
7174 |
-
|
7175 |
-
'aria-placeholder': 0,
|
7176 |
-
'aria-pressed': 0,
|
7177 |
-
'aria-readonly': 0,
|
7178 |
-
'aria-required': 0,
|
7179 |
-
'aria-selected': 0,
|
7180 |
-
'aria-sort': 0,
|
7181 |
-
'aria-valuemax': 0,
|
7182 |
-
'aria-valuemin': 0,
|
7183 |
-
'aria-valuenow': 0,
|
7184 |
-
'aria-valuetext': 0,
|
7185 |
-
// Live Region Attributes
|
7186 |
-
'aria-atomic': 0,
|
7187 |
-
'aria-busy': 0,
|
7188 |
-
'aria-live': 0,
|
7189 |
-
'aria-relevant': 0,
|
7190 |
-
// Drag-and-Drop Attributes
|
7191 |
-
'aria-dropeffect': 0,
|
7192 |
-
'aria-grabbed': 0,
|
7193 |
-
// Relationship Attributes
|
7194 |
-
'aria-activedescendant': 0,
|
7195 |
-
'aria-colcount': 0,
|
7196 |
-
'aria-colindex': 0,
|
7197 |
-
'aria-colspan': 0,
|
7198 |
-
'aria-controls': 0,
|
7199 |
-
'aria-describedby': 0,
|
7200 |
-
'aria-errormessage': 0,
|
7201 |
-
'aria-flowto': 0,
|
7202 |
-
'aria-labelledby': 0,
|
7203 |
-
'aria-owns': 0,
|
7204 |
-
'aria-posinset': 0,
|
7205 |
-
'aria-rowcount': 0,
|
7206 |
-
'aria-rowindex': 0,
|
7207 |
-
'aria-rowspan': 0,
|
7208 |
-
'aria-setsize': 0
|
7209 |
-
};
|
7210 |
|
7211 |
-
var
|
7212 |
-
var
|
7213 |
-
|
7214 |
-
|
|
|
|
|
7215 |
|
7216 |
-
|
7217 |
-
{
|
7218 |
-
if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
|
7219 |
-
return true;
|
7220 |
-
}
|
7221 |
|
7222 |
-
|
7223 |
-
|
7224 |
-
|
7225 |
-
// DOM properties, then it is an invalid aria-* attribute.
|
7226 |
|
7227 |
-
|
7228 |
-
|
7229 |
|
7230 |
-
|
7231 |
-
|
7232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7233 |
|
|
|
7234 |
|
7235 |
-
|
7236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7237 |
|
7238 |
-
|
7239 |
-
|
7240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7241 |
}
|
7242 |
|
7243 |
-
|
7244 |
-
|
7245 |
-
|
7246 |
-
|
|
|
|
|
7247 |
|
7248 |
-
|
7249 |
-
|
7250 |
-
|
7251 |
-
|
|
|
|
|
|
|
7252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7253 |
|
7254 |
-
|
7255 |
-
|
|
|
|
|
|
|
7256 |
|
7257 |
-
|
7258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7259 |
}
|
7260 |
-
}
|
|
|
|
|
|
|
7261 |
}
|
|
|
|
|
|
|
7262 |
|
7263 |
-
|
|
|
|
|
7264 |
}
|
7265 |
|
7266 |
-
function
|
|
|
|
|
|
|
|
|
|
|
7267 |
{
|
7268 |
-
var
|
7269 |
|
7270 |
-
|
7271 |
-
|
|
|
|
|
7272 |
|
7273 |
-
|
7274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7275 |
}
|
|
|
|
|
7276 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7277 |
|
7278 |
-
|
7279 |
-
|
7280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
7281 |
|
7282 |
-
|
7283 |
-
|
7284 |
-
|
7285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7286 |
}
|
7287 |
}
|
|
|
|
|
7288 |
}
|
7289 |
|
7290 |
-
function
|
7291 |
-
|
7292 |
-
return;
|
|
|
|
|
|
|
|
|
|
|
7293 |
}
|
|
|
7294 |
|
7295 |
-
|
|
|
|
|
7296 |
}
|
7297 |
|
7298 |
-
|
7299 |
-
|
7300 |
-
{
|
7301 |
-
|
7302 |
-
|
|
|
|
|
|
|
|
|
7303 |
}
|
|
|
7304 |
|
7305 |
-
|
7306 |
-
|
|
|
7307 |
|
7308 |
-
|
7309 |
-
|
7310 |
-
|
7311 |
-
|
7312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7313 |
}
|
7314 |
}
|
7315 |
-
|
7316 |
-
|
7317 |
-
// When adding attributes to the HTML or SVG allowed attribute list, be sure to
|
7318 |
-
// also add them to this module to ensure casing and incorrect name
|
7319 |
-
// warnings.
|
7320 |
-
var possibleStandardNames = {
|
7321 |
-
// HTML
|
7322 |
-
accept: 'accept',
|
7323 |
-
acceptcharset: 'acceptCharset',
|
7324 |
-
'accept-charset': 'acceptCharset',
|
7325 |
-
accesskey: 'accessKey',
|
7326 |
-
action: 'action',
|
7327 |
-
allowfullscreen: 'allowFullScreen',
|
7328 |
-
alt: 'alt',
|
7329 |
-
as: 'as',
|
7330 |
-
async: 'async',
|
7331 |
-
autocapitalize: 'autoCapitalize',
|
7332 |
-
autocomplete: 'autoComplete',
|
7333 |
-
autocorrect: 'autoCorrect',
|
7334 |
-
autofocus: 'autoFocus',
|
7335 |
-
autoplay: 'autoPlay',
|
7336 |
-
autosave: 'autoSave',
|
7337 |
-
capture: 'capture',
|
7338 |
-
cellpadding: 'cellPadding',
|
7339 |
-
cellspacing: 'cellSpacing',
|
7340 |
-
challenge: 'challenge',
|
7341 |
-
charset: 'charSet',
|
7342 |
-
checked: 'checked',
|
7343 |
-
children: 'children',
|
7344 |
-
cite: 'cite',
|
7345 |
-
class: 'className',
|
7346 |
-
classid: 'classID',
|
7347 |
-
classname: 'className',
|
7348 |
-
cols: 'cols',
|
7349 |
-
colspan: 'colSpan',
|
7350 |
-
content: 'content',
|
7351 |
-
contenteditable: 'contentEditable',
|
7352 |
-
contextmenu: 'contextMenu',
|
7353 |
-
controls: 'controls',
|
7354 |
-
controlslist: 'controlsList',
|
7355 |
-
coords: 'coords',
|
7356 |
-
crossorigin: 'crossOrigin',
|
7357 |
-
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
7358 |
-
data: 'data',
|
7359 |
-
datetime: 'dateTime',
|
7360 |
-
default: 'default',
|
7361 |
-
defaultchecked: 'defaultChecked',
|
7362 |
-
defaultvalue: 'defaultValue',
|
7363 |
-
defer: 'defer',
|
7364 |
-
dir: 'dir',
|
7365 |
-
disabled: 'disabled',
|
7366 |
-
disablepictureinpicture: 'disablePictureInPicture',
|
7367 |
-
disableremoteplayback: 'disableRemotePlayback',
|
7368 |
-
download: 'download',
|
7369 |
-
draggable: 'draggable',
|
7370 |
-
enctype: 'encType',
|
7371 |
-
enterkeyhint: 'enterKeyHint',
|
7372 |
-
for: 'htmlFor',
|
7373 |
-
form: 'form',
|
7374 |
-
formmethod: 'formMethod',
|
7375 |
-
formaction: 'formAction',
|
7376 |
-
formenctype: 'formEncType',
|
7377 |
-
formnovalidate: 'formNoValidate',
|
7378 |
-
formtarget: 'formTarget',
|
7379 |
-
frameborder: 'frameBorder',
|
7380 |
-
headers: 'headers',
|
7381 |
-
height: 'height',
|
7382 |
-
hidden: 'hidden',
|
7383 |
-
high: 'high',
|
7384 |
-
href: 'href',
|
7385 |
-
hreflang: 'hrefLang',
|
7386 |
-
htmlfor: 'htmlFor',
|
7387 |
-
httpequiv: 'httpEquiv',
|
7388 |
-
'http-equiv': 'httpEquiv',
|
7389 |
-
icon: 'icon',
|
7390 |
-
id: 'id',
|
7391 |
-
innerhtml: 'innerHTML',
|
7392 |
-
inputmode: 'inputMode',
|
7393 |
-
integrity: 'integrity',
|
7394 |
-
is: 'is',
|
7395 |
-
itemid: 'itemID',
|
7396 |
-
itemprop: 'itemProp',
|
7397 |
-
itemref: 'itemRef',
|
7398 |
-
itemscope: 'itemScope',
|
7399 |
-
itemtype: 'itemType',
|
7400 |
-
keyparams: 'keyParams',
|
7401 |
-
keytype: 'keyType',
|
7402 |
-
kind: 'kind',
|
7403 |
-
label: 'label',
|
7404 |
-
lang: 'lang',
|
7405 |
-
list: 'list',
|
7406 |
-
loop: 'loop',
|
7407 |
-
low: 'low',
|
7408 |
-
manifest: 'manifest',
|
7409 |
-
marginwidth: 'marginWidth',
|
7410 |
-
marginheight: 'marginHeight',
|
7411 |
-
max: 'max',
|
7412 |
-
maxlength: 'maxLength',
|
7413 |
-
media: 'media',
|
7414 |
-
mediagroup: 'mediaGroup',
|
7415 |
-
method: 'method',
|
7416 |
-
min: 'min',
|
7417 |
-
minlength: 'minLength',
|
7418 |
-
multiple: 'multiple',
|
7419 |
-
muted: 'muted',
|
7420 |
-
name: 'name',
|
7421 |
-
nomodule: 'noModule',
|
7422 |
-
nonce: 'nonce',
|
7423 |
-
novalidate: 'noValidate',
|
7424 |
-
open: 'open',
|
7425 |
-
optimum: 'optimum',
|
7426 |
-
pattern: 'pattern',
|
7427 |
-
placeholder: 'placeholder',
|
7428 |
-
playsinline: 'playsInline',
|
7429 |
-
poster: 'poster',
|
7430 |
-
preload: 'preload',
|
7431 |
-
profile: 'profile',
|
7432 |
-
radiogroup: 'radioGroup',
|
7433 |
-
readonly: 'readOnly',
|
7434 |
-
referrerpolicy: 'referrerPolicy',
|
7435 |
-
rel: 'rel',
|
7436 |
-
required: 'required',
|
7437 |
-
reversed: 'reversed',
|
7438 |
-
role: 'role',
|
7439 |
-
rows: 'rows',
|
7440 |
-
rowspan: 'rowSpan',
|
7441 |
-
sandbox: 'sandbox',
|
7442 |
-
scope: 'scope',
|
7443 |
-
scoped: 'scoped',
|
7444 |
-
scrolling: 'scrolling',
|
7445 |
-
seamless: 'seamless',
|
7446 |
-
selected: 'selected',
|
7447 |
-
shape: 'shape',
|
7448 |
-
size: 'size',
|
7449 |
-
sizes: 'sizes',
|
7450 |
-
span: 'span',
|
7451 |
-
spellcheck: 'spellCheck',
|
7452 |
-
src: 'src',
|
7453 |
-
srcdoc: 'srcDoc',
|
7454 |
-
srclang: 'srcLang',
|
7455 |
-
srcset: 'srcSet',
|
7456 |
-
start: 'start',
|
7457 |
-
step: 'step',
|
7458 |
-
style: 'style',
|
7459 |
-
summary: 'summary',
|
7460 |
-
tabindex: 'tabIndex',
|
7461 |
-
target: 'target',
|
7462 |
-
title: 'title',
|
7463 |
-
type: 'type',
|
7464 |
-
usemap: 'useMap',
|
7465 |
-
value: 'value',
|
7466 |
-
width: 'width',
|
7467 |
-
wmode: 'wmode',
|
7468 |
-
wrap: 'wrap',
|
7469 |
-
// SVG
|
7470 |
-
about: 'about',
|
7471 |
-
accentheight: 'accentHeight',
|
7472 |
-
'accent-height': 'accentHeight',
|
7473 |
-
accumulate: 'accumulate',
|
7474 |
-
additive: 'additive',
|
7475 |
-
alignmentbaseline: 'alignmentBaseline',
|
7476 |
-
'alignment-baseline': 'alignmentBaseline',
|
7477 |
-
allowreorder: 'allowReorder',
|
7478 |
-
alphabetic: 'alphabetic',
|
7479 |
-
amplitude: 'amplitude',
|
7480 |
-
arabicform: 'arabicForm',
|
7481 |
-
'arabic-form': 'arabicForm',
|
7482 |
-
ascent: 'ascent',
|
7483 |
-
attributename: 'attributeName',
|
7484 |
-
attributetype: 'attributeType',
|
7485 |
-
autoreverse: 'autoReverse',
|
7486 |
-
azimuth: 'azimuth',
|
7487 |
-
basefrequency: 'baseFrequency',
|
7488 |
-
baselineshift: 'baselineShift',
|
7489 |
-
'baseline-shift': 'baselineShift',
|
7490 |
-
baseprofile: 'baseProfile',
|
7491 |
-
bbox: 'bbox',
|
7492 |
-
begin: 'begin',
|
7493 |
-
bias: 'bias',
|
7494 |
-
by: 'by',
|
7495 |
-
calcmode: 'calcMode',
|
7496 |
-
capheight: 'capHeight',
|
7497 |
-
'cap-height': 'capHeight',
|
7498 |
-
clip: 'clip',
|
7499 |
-
clippath: 'clipPath',
|
7500 |
-
'clip-path': 'clipPath',
|
7501 |
-
clippathunits: 'clipPathUnits',
|
7502 |
-
cliprule: 'clipRule',
|
7503 |
-
'clip-rule': 'clipRule',
|
7504 |
-
color: 'color',
|
7505 |
-
colorinterpolation: 'colorInterpolation',
|
7506 |
-
'color-interpolation': 'colorInterpolation',
|
7507 |
-
colorinterpolationfilters: 'colorInterpolationFilters',
|
7508 |
-
'color-interpolation-filters': 'colorInterpolationFilters',
|
7509 |
-
colorprofile: 'colorProfile',
|
7510 |
-
'color-profile': 'colorProfile',
|
7511 |
-
colorrendering: 'colorRendering',
|
7512 |
-
'color-rendering': 'colorRendering',
|
7513 |
-
contentscripttype: 'contentScriptType',
|
7514 |
-
contentstyletype: 'contentStyleType',
|
7515 |
-
cursor: 'cursor',
|
7516 |
-
cx: 'cx',
|
7517 |
-
cy: 'cy',
|
7518 |
-
d: 'd',
|
7519 |
-
datatype: 'datatype',
|
7520 |
-
decelerate: 'decelerate',
|
7521 |
-
descent: 'descent',
|
7522 |
-
diffuseconstant: 'diffuseConstant',
|
7523 |
-
direction: 'direction',
|
7524 |
-
display: 'display',
|
7525 |
-
divisor: 'divisor',
|
7526 |
-
dominantbaseline: 'dominantBaseline',
|
7527 |
-
'dominant-baseline': 'dominantBaseline',
|
7528 |
-
dur: 'dur',
|
7529 |
-
dx: 'dx',
|
7530 |
-
dy: 'dy',
|
7531 |
-
edgemode: 'edgeMode',
|
7532 |
-
elevation: 'elevation',
|
7533 |
-
enablebackground: 'enableBackground',
|
7534 |
-
'enable-background': 'enableBackground',
|
7535 |
-
end: 'end',
|
7536 |
-
exponent: 'exponent',
|
7537 |
-
externalresourcesrequired: 'externalResourcesRequired',
|
7538 |
-
fill: 'fill',
|
7539 |
-
fillopacity: 'fillOpacity',
|
7540 |
-
'fill-opacity': 'fillOpacity',
|
7541 |
-
fillrule: 'fillRule',
|
7542 |
-
'fill-rule': 'fillRule',
|
7543 |
-
filter: 'filter',
|
7544 |
-
filterres: 'filterRes',
|
7545 |
-
filterunits: 'filterUnits',
|
7546 |
-
floodopacity: 'floodOpacity',
|
7547 |
-
'flood-opacity': 'floodOpacity',
|
7548 |
-
floodcolor: 'floodColor',
|
7549 |
-
'flood-color': 'floodColor',
|
7550 |
-
focusable: 'focusable',
|
7551 |
-
fontfamily: 'fontFamily',
|
7552 |
-
'font-family': 'fontFamily',
|
7553 |
-
fontsize: 'fontSize',
|
7554 |
-
'font-size': 'fontSize',
|
7555 |
-
fontsizeadjust: 'fontSizeAdjust',
|
7556 |
-
'font-size-adjust': 'fontSizeAdjust',
|
7557 |
-
fontstretch: 'fontStretch',
|
7558 |
-
'font-stretch': 'fontStretch',
|
7559 |
-
fontstyle: 'fontStyle',
|
7560 |
-
'font-style': 'fontStyle',
|
7561 |
-
fontvariant: 'fontVariant',
|
7562 |
-
'font-variant': 'fontVariant',
|
7563 |
-
fontweight: 'fontWeight',
|
7564 |
-
'font-weight': 'fontWeight',
|
7565 |
-
format: 'format',
|
7566 |
-
from: 'from',
|
7567 |
-
fx: 'fx',
|
7568 |
-
fy: 'fy',
|
7569 |
-
g1: 'g1',
|
7570 |
-
g2: 'g2',
|
7571 |
-
glyphname: 'glyphName',
|
7572 |
-
'glyph-name': 'glyphName',
|
7573 |
-
glyphorientationhorizontal: 'glyphOrientationHorizontal',
|
7574 |
-
'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
|
7575 |
-
glyphorientationvertical: 'glyphOrientationVertical',
|
7576 |
-
'glyph-orientation-vertical': 'glyphOrientationVertical',
|
7577 |
-
glyphref: 'glyphRef',
|
7578 |
-
gradienttransform: 'gradientTransform',
|
7579 |
-
gradientunits: 'gradientUnits',
|
7580 |
-
hanging: 'hanging',
|
7581 |
-
horizadvx: 'horizAdvX',
|
7582 |
-
'horiz-adv-x': 'horizAdvX',
|
7583 |
-
horizoriginx: 'horizOriginX',
|
7584 |
-
'horiz-origin-x': 'horizOriginX',
|
7585 |
-
ideographic: 'ideographic',
|
7586 |
-
imagerendering: 'imageRendering',
|
7587 |
-
'image-rendering': 'imageRendering',
|
7588 |
-
in2: 'in2',
|
7589 |
-
in: 'in',
|
7590 |
-
inlist: 'inlist',
|
7591 |
-
intercept: 'intercept',
|
7592 |
-
k1: 'k1',
|
7593 |
-
k2: 'k2',
|
7594 |
-
k3: 'k3',
|
7595 |
-
k4: 'k4',
|
7596 |
-
k: 'k',
|
7597 |
-
kernelmatrix: 'kernelMatrix',
|
7598 |
-
kernelunitlength: 'kernelUnitLength',
|
7599 |
-
kerning: 'kerning',
|
7600 |
-
keypoints: 'keyPoints',
|
7601 |
-
keysplines: 'keySplines',
|
7602 |
-
keytimes: 'keyTimes',
|
7603 |
-
lengthadjust: 'lengthAdjust',
|
7604 |
-
letterspacing: 'letterSpacing',
|
7605 |
-
'letter-spacing': 'letterSpacing',
|
7606 |
-
lightingcolor: 'lightingColor',
|
7607 |
-
'lighting-color': 'lightingColor',
|
7608 |
-
limitingconeangle: 'limitingConeAngle',
|
7609 |
-
local: 'local',
|
7610 |
-
markerend: 'markerEnd',
|
7611 |
-
'marker-end': 'markerEnd',
|
7612 |
-
markerheight: 'markerHeight',
|
7613 |
-
markermid: 'markerMid',
|
7614 |
-
'marker-mid': 'markerMid',
|
7615 |
-
markerstart: 'markerStart',
|
7616 |
-
'marker-start': 'markerStart',
|
7617 |
-
markerunits: 'markerUnits',
|
7618 |
-
markerwidth: 'markerWidth',
|
7619 |
-
mask: 'mask',
|
7620 |
-
maskcontentunits: 'maskContentUnits',
|
7621 |
-
maskunits: 'maskUnits',
|
7622 |
-
mathematical: 'mathematical',
|
7623 |
-
mode: 'mode',
|
7624 |
-
numoctaves: 'numOctaves',
|
7625 |
-
offset: 'offset',
|
7626 |
-
opacity: 'opacity',
|
7627 |
-
operator: 'operator',
|
7628 |
-
order: 'order',
|
7629 |
-
orient: 'orient',
|
7630 |
-
orientation: 'orientation',
|
7631 |
-
origin: 'origin',
|
7632 |
-
overflow: 'overflow',
|
7633 |
-
overlineposition: 'overlinePosition',
|
7634 |
-
'overline-position': 'overlinePosition',
|
7635 |
-
overlinethickness: 'overlineThickness',
|
7636 |
-
'overline-thickness': 'overlineThickness',
|
7637 |
-
paintorder: 'paintOrder',
|
7638 |
-
'paint-order': 'paintOrder',
|
7639 |
-
panose1: 'panose1',
|
7640 |
-
'panose-1': 'panose1',
|
7641 |
-
pathlength: 'pathLength',
|
7642 |
-
patterncontentunits: 'patternContentUnits',
|
7643 |
-
patterntransform: 'patternTransform',
|
7644 |
-
patternunits: 'patternUnits',
|
7645 |
-
pointerevents: 'pointerEvents',
|
7646 |
-
'pointer-events': 'pointerEvents',
|
7647 |
-
points: 'points',
|
7648 |
-
pointsatx: 'pointsAtX',
|
7649 |
-
pointsaty: 'pointsAtY',
|
7650 |
-
pointsatz: 'pointsAtZ',
|
7651 |
-
prefix: 'prefix',
|
7652 |
-
preservealpha: 'preserveAlpha',
|
7653 |
-
preserveaspectratio: 'preserveAspectRatio',
|
7654 |
-
primitiveunits: 'primitiveUnits',
|
7655 |
-
property: 'property',
|
7656 |
-
r: 'r',
|
7657 |
-
radius: 'radius',
|
7658 |
-
refx: 'refX',
|
7659 |
-
refy: 'refY',
|
7660 |
-
renderingintent: 'renderingIntent',
|
7661 |
-
'rendering-intent': 'renderingIntent',
|
7662 |
-
repeatcount: 'repeatCount',
|
7663 |
-
repeatdur: 'repeatDur',
|
7664 |
-
requiredextensions: 'requiredExtensions',
|
7665 |
-
requiredfeatures: 'requiredFeatures',
|
7666 |
-
resource: 'resource',
|
7667 |
-
restart: 'restart',
|
7668 |
-
result: 'result',
|
7669 |
-
results: 'results',
|
7670 |
-
rotate: 'rotate',
|
7671 |
-
rx: 'rx',
|
7672 |
-
ry: 'ry',
|
7673 |
-
scale: 'scale',
|
7674 |
-
security: 'security',
|
7675 |
-
seed: 'seed',
|
7676 |
-
shaperendering: 'shapeRendering',
|
7677 |
-
'shape-rendering': 'shapeRendering',
|
7678 |
-
slope: 'slope',
|
7679 |
-
spacing: 'spacing',
|
7680 |
-
specularconstant: 'specularConstant',
|
7681 |
-
specularexponent: 'specularExponent',
|
7682 |
-
speed: 'speed',
|
7683 |
-
spreadmethod: 'spreadMethod',
|
7684 |
-
startoffset: 'startOffset',
|
7685 |
-
stddeviation: 'stdDeviation',
|
7686 |
-
stemh: 'stemh',
|
7687 |
-
stemv: 'stemv',
|
7688 |
-
stitchtiles: 'stitchTiles',
|
7689 |
-
stopcolor: 'stopColor',
|
7690 |
-
'stop-color': 'stopColor',
|
7691 |
-
stopopacity: 'stopOpacity',
|
7692 |
-
'stop-opacity': 'stopOpacity',
|
7693 |
-
strikethroughposition: 'strikethroughPosition',
|
7694 |
-
'strikethrough-position': 'strikethroughPosition',
|
7695 |
-
strikethroughthickness: 'strikethroughThickness',
|
7696 |
-
'strikethrough-thickness': 'strikethroughThickness',
|
7697 |
-
string: 'string',
|
7698 |
-
stroke: 'stroke',
|
7699 |
-
strokedasharray: 'strokeDasharray',
|
7700 |
-
'stroke-dasharray': 'strokeDasharray',
|
7701 |
-
strokedashoffset: 'strokeDashoffset',
|
7702 |
-
'stroke-dashoffset': 'strokeDashoffset',
|
7703 |
-
strokelinecap: 'strokeLinecap',
|
7704 |
-
'stroke-linecap': 'strokeLinecap',
|
7705 |
-
strokelinejoin: 'strokeLinejoin',
|
7706 |
-
'stroke-linejoin': 'strokeLinejoin',
|
7707 |
-
strokemiterlimit: 'strokeMiterlimit',
|
7708 |
-
'stroke-miterlimit': 'strokeMiterlimit',
|
7709 |
-
strokewidth: 'strokeWidth',
|
7710 |
-
'stroke-width': 'strokeWidth',
|
7711 |
-
strokeopacity: 'strokeOpacity',
|
7712 |
-
'stroke-opacity': 'strokeOpacity',
|
7713 |
-
suppresscontenteditablewarning: 'suppressContentEditableWarning',
|
7714 |
-
suppresshydrationwarning: 'suppressHydrationWarning',
|
7715 |
-
surfacescale: 'surfaceScale',
|
7716 |
-
systemlanguage: 'systemLanguage',
|
7717 |
-
tablevalues: 'tableValues',
|
7718 |
-
targetx: 'targetX',
|
7719 |
-
targety: 'targetY',
|
7720 |
-
textanchor: 'textAnchor',
|
7721 |
-
'text-anchor': 'textAnchor',
|
7722 |
-
textdecoration: 'textDecoration',
|
7723 |
-
'text-decoration': 'textDecoration',
|
7724 |
-
textlength: 'textLength',
|
7725 |
-
textrendering: 'textRendering',
|
7726 |
-
'text-rendering': 'textRendering',
|
7727 |
-
to: 'to',
|
7728 |
-
transform: 'transform',
|
7729 |
-
typeof: 'typeof',
|
7730 |
-
u1: 'u1',
|
7731 |
-
u2: 'u2',
|
7732 |
-
underlineposition: 'underlinePosition',
|
7733 |
-
'underline-position': 'underlinePosition',
|
7734 |
-
underlinethickness: 'underlineThickness',
|
7735 |
-
'underline-thickness': 'underlineThickness',
|
7736 |
-
unicode: 'unicode',
|
7737 |
-
unicodebidi: 'unicodeBidi',
|
7738 |
-
'unicode-bidi': 'unicodeBidi',
|
7739 |
-
unicoderange: 'unicodeRange',
|
7740 |
-
'unicode-range': 'unicodeRange',
|
7741 |
-
unitsperem: 'unitsPerEm',
|
7742 |
-
'units-per-em': 'unitsPerEm',
|
7743 |
-
unselectable: 'unselectable',
|
7744 |
-
valphabetic: 'vAlphabetic',
|
7745 |
-
'v-alphabetic': 'vAlphabetic',
|
7746 |
-
values: 'values',
|
7747 |
-
vectoreffect: 'vectorEffect',
|
7748 |
-
'vector-effect': 'vectorEffect',
|
7749 |
-
version: 'version',
|
7750 |
-
vertadvy: 'vertAdvY',
|
7751 |
-
'vert-adv-y': 'vertAdvY',
|
7752 |
-
vertoriginx: 'vertOriginX',
|
7753 |
-
'vert-origin-x': 'vertOriginX',
|
7754 |
-
vertoriginy: 'vertOriginY',
|
7755 |
-
'vert-origin-y': 'vertOriginY',
|
7756 |
-
vhanging: 'vHanging',
|
7757 |
-
'v-hanging': 'vHanging',
|
7758 |
-
videographic: 'vIdeographic',
|
7759 |
-
'v-ideographic': 'vIdeographic',
|
7760 |
-
viewbox: 'viewBox',
|
7761 |
-
viewtarget: 'viewTarget',
|
7762 |
-
visibility: 'visibility',
|
7763 |
-
vmathematical: 'vMathematical',
|
7764 |
-
'v-mathematical': 'vMathematical',
|
7765 |
-
vocab: 'vocab',
|
7766 |
-
widths: 'widths',
|
7767 |
-
wordspacing: 'wordSpacing',
|
7768 |
-
'word-spacing': 'wordSpacing',
|
7769 |
-
writingmode: 'writingMode',
|
7770 |
-
'writing-mode': 'writingMode',
|
7771 |
-
x1: 'x1',
|
7772 |
-
x2: 'x2',
|
7773 |
-
x: 'x',
|
7774 |
-
xchannelselector: 'xChannelSelector',
|
7775 |
-
xheight: 'xHeight',
|
7776 |
-
'x-height': 'xHeight',
|
7777 |
-
xlinkactuate: 'xlinkActuate',
|
7778 |
-
'xlink:actuate': 'xlinkActuate',
|
7779 |
-
xlinkarcrole: 'xlinkArcrole',
|
7780 |
-
'xlink:arcrole': 'xlinkArcrole',
|
7781 |
-
xlinkhref: 'xlinkHref',
|
7782 |
-
'xlink:href': 'xlinkHref',
|
7783 |
-
xlinkrole: 'xlinkRole',
|
7784 |
-
'xlink:role': 'xlinkRole',
|
7785 |
-
xlinkshow: 'xlinkShow',
|
7786 |
-
'xlink:show': 'xlinkShow',
|
7787 |
-
xlinktitle: 'xlinkTitle',
|
7788 |
-
'xlink:title': 'xlinkTitle',
|
7789 |
-
xlinktype: 'xlinkType',
|
7790 |
-
'xlink:type': 'xlinkType',
|
7791 |
-
xmlbase: 'xmlBase',
|
7792 |
-
'xml:base': 'xmlBase',
|
7793 |
-
xmllang: 'xmlLang',
|
7794 |
-
'xml:lang': 'xmlLang',
|
7795 |
-
xmlns: 'xmlns',
|
7796 |
-
'xml:space': 'xmlSpace',
|
7797 |
-
xmlnsxlink: 'xmlnsXlink',
|
7798 |
-
'xmlns:xlink': 'xmlnsXlink',
|
7799 |
-
xmlspace: 'xmlSpace',
|
7800 |
-
y1: 'y1',
|
7801 |
-
y2: 'y2',
|
7802 |
-
y: 'y',
|
7803 |
-
ychannelselector: 'yChannelSelector',
|
7804 |
-
z: 'z',
|
7805 |
-
zoomandpan: 'zoomAndPan'
|
7806 |
-
};
|
7807 |
-
|
7808 |
-
var validateProperty$1 = function () {};
|
7809 |
-
|
7810 |
-
{
|
7811 |
-
var warnedProperties$1 = {};
|
7812 |
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
7813 |
-
var EVENT_NAME_REGEX = /^on./;
|
7814 |
-
var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
|
7815 |
-
var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
7816 |
-
var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
7817 |
-
|
7818 |
-
validateProperty$1 = function (tagName, name, value, eventRegistry) {
|
7819 |
-
if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
|
7820 |
-
return true;
|
7821 |
-
}
|
7822 |
-
|
7823 |
-
var lowerCasedName = name.toLowerCase();
|
7824 |
-
|
7825 |
-
if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
|
7826 |
-
error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
|
7827 |
-
|
7828 |
-
warnedProperties$1[name] = true;
|
7829 |
-
return true;
|
7830 |
-
} // We can't rely on the event system being injected on the server.
|
7831 |
-
|
7832 |
-
|
7833 |
-
if (eventRegistry != null) {
|
7834 |
-
var registrationNameDependencies = eventRegistry.registrationNameDependencies,
|
7835 |
-
possibleRegistrationNames = eventRegistry.possibleRegistrationNames;
|
7836 |
-
|
7837 |
-
if (registrationNameDependencies.hasOwnProperty(name)) {
|
7838 |
-
return true;
|
7839 |
-
}
|
7840 |
-
|
7841 |
-
var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
|
7842 |
-
|
7843 |
-
if (registrationName != null) {
|
7844 |
-
error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
|
7845 |
-
|
7846 |
-
warnedProperties$1[name] = true;
|
7847 |
-
return true;
|
7848 |
-
}
|
7849 |
-
|
7850 |
-
if (EVENT_NAME_REGEX.test(name)) {
|
7851 |
-
error('Unknown event handler property `%s`. It will be ignored.', name);
|
7852 |
-
|
7853 |
-
warnedProperties$1[name] = true;
|
7854 |
-
return true;
|
7855 |
-
}
|
7856 |
-
} else if (EVENT_NAME_REGEX.test(name)) {
|
7857 |
-
// If no event plugins have been injected, we are in a server environment.
|
7858 |
-
// So we can't tell if the event name is correct for sure, but we can filter
|
7859 |
-
// out known bad ones like `onclick`. We can't suggest a specific replacement though.
|
7860 |
-
if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
7861 |
-
error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
|
7862 |
-
}
|
7863 |
-
|
7864 |
-
warnedProperties$1[name] = true;
|
7865 |
-
return true;
|
7866 |
-
} // Let the ARIA attribute hook validate ARIA attributes
|
7867 |
-
|
7868 |
-
|
7869 |
-
if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
|
7870 |
-
return true;
|
7871 |
-
}
|
7872 |
-
|
7873 |
-
if (lowerCasedName === 'innerhtml') {
|
7874 |
-
error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
|
7875 |
-
|
7876 |
-
warnedProperties$1[name] = true;
|
7877 |
-
return true;
|
7878 |
-
}
|
7879 |
-
|
7880 |
-
if (lowerCasedName === 'aria') {
|
7881 |
-
error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
|
7882 |
-
|
7883 |
-
warnedProperties$1[name] = true;
|
7884 |
-
return true;
|
7885 |
-
}
|
7886 |
-
|
7887 |
-
if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
|
7888 |
-
error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
|
7889 |
-
|
7890 |
-
warnedProperties$1[name] = true;
|
7891 |
-
return true;
|
7892 |
-
}
|
7893 |
-
|
7894 |
-
if (typeof value === 'number' && isNaN(value)) {
|
7895 |
-
error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
|
7896 |
-
|
7897 |
-
warnedProperties$1[name] = true;
|
7898 |
-
return true;
|
7899 |
-
}
|
7900 |
-
|
7901 |
-
var propertyInfo = getPropertyInfo(name);
|
7902 |
-
var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
|
7903 |
-
|
7904 |
-
if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
7905 |
-
var standardName = possibleStandardNames[lowerCasedName];
|
7906 |
-
|
7907 |
-
if (standardName !== name) {
|
7908 |
-
error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
|
7909 |
-
|
7910 |
-
warnedProperties$1[name] = true;
|
7911 |
-
return true;
|
7912 |
-
}
|
7913 |
-
} else if (!isReserved && name !== lowerCasedName) {
|
7914 |
-
// Unknown attributes should have lowercase casing since that's how they
|
7915 |
-
// will be cased anyway with server rendering.
|
7916 |
-
error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
|
7917 |
-
|
7918 |
-
warnedProperties$1[name] = true;
|
7919 |
-
return true;
|
7920 |
-
}
|
7921 |
-
|
7922 |
-
if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
7923 |
-
if (value) {
|
7924 |
-
error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
|
7925 |
-
} else {
|
7926 |
-
error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
|
7927 |
-
}
|
7928 |
-
|
7929 |
-
warnedProperties$1[name] = true;
|
7930 |
-
return true;
|
7931 |
-
} // Now that we've validated casing, do not validate
|
7932 |
-
// data types for reserved props
|
7933 |
-
|
7934 |
-
|
7935 |
-
if (isReserved) {
|
7936 |
-
return true;
|
7937 |
-
} // Warn when a known attribute is a bad type
|
7938 |
-
|
7939 |
-
|
7940 |
-
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
7941 |
-
warnedProperties$1[name] = true;
|
7942 |
-
return false;
|
7943 |
-
} // Warn when passing the strings 'false' or 'true' into a boolean prop
|
7944 |
-
|
7945 |
-
|
7946 |
-
if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
|
7947 |
-
error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
|
7948 |
-
|
7949 |
-
warnedProperties$1[name] = true;
|
7950 |
-
return true;
|
7951 |
-
}
|
7952 |
-
|
7953 |
-
return true;
|
7954 |
-
};
|
7955 |
-
}
|
7956 |
-
|
7957 |
-
var warnUnknownProperties = function (type, props, eventRegistry) {
|
7958 |
-
{
|
7959 |
-
var unknownProps = [];
|
7960 |
-
|
7961 |
-
for (var key in props) {
|
7962 |
-
var isValid = validateProperty$1(type, key, props[key], eventRegistry);
|
7963 |
-
|
7964 |
-
if (!isValid) {
|
7965 |
-
unknownProps.push(key);
|
7966 |
-
}
|
7967 |
-
}
|
7968 |
-
|
7969 |
-
var unknownPropString = unknownProps.map(function (prop) {
|
7970 |
-
return '`' + prop + '`';
|
7971 |
-
}).join(', ');
|
7972 |
-
|
7973 |
-
if (unknownProps.length === 1) {
|
7974 |
-
error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
|
7975 |
-
} else if (unknownProps.length > 1) {
|
7976 |
-
error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
|
7977 |
-
}
|
7978 |
-
}
|
7979 |
-
};
|
7980 |
-
|
7981 |
-
function validateProperties$2(type, props, eventRegistry) {
|
7982 |
-
if (isCustomComponent(type, props)) {
|
7983 |
-
return;
|
7984 |
-
}
|
7985 |
-
|
7986 |
-
warnUnknownProperties(type, props, eventRegistry);
|
7987 |
-
}
|
7988 |
-
|
7989 |
-
var toArray = React.Children.toArray; // This is only used in DEV.
|
7990 |
-
// Each entry is `this.stack` from a currently executing renderer instance.
|
7991 |
-
// (There may be more than one because ReactDOMServer is reentrant).
|
7992 |
-
// Each stack is an array of frames which may contain nested stacks of elements.
|
7993 |
-
|
7994 |
-
var currentDebugStacks = [];
|
7995 |
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
7996 |
-
var ReactDebugCurrentFrame$1;
|
7997 |
-
var prevGetCurrentStackImpl = null;
|
7998 |
-
|
7999 |
-
var getCurrentServerStackImpl = function () {
|
8000 |
-
return '';
|
8001 |
-
};
|
8002 |
-
|
8003 |
-
var describeStackFrame = function (element) {
|
8004 |
-
return '';
|
8005 |
-
};
|
8006 |
-
|
8007 |
-
var validatePropertiesInDevelopment = function (type, props) {};
|
8008 |
-
|
8009 |
-
var pushCurrentDebugStack = function (stack) {};
|
8010 |
-
|
8011 |
-
var pushElementToDebugStack = function (element) {};
|
8012 |
-
|
8013 |
-
var popCurrentDebugStack = function () {};
|
8014 |
-
|
8015 |
-
var hasWarnedAboutUsingContextAsConsumer = false;
|
8016 |
-
|
8017 |
-
{
|
8018 |
-
ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
8019 |
-
|
8020 |
-
validatePropertiesInDevelopment = function (type, props) {
|
8021 |
-
validateProperties(type, props);
|
8022 |
-
validateProperties$1(type, props);
|
8023 |
-
validateProperties$2(type, props, null);
|
8024 |
-
};
|
8025 |
-
|
8026 |
-
describeStackFrame = function (element) {
|
8027 |
-
return describeUnknownElementTypeFrameInDEV(element.type, element._source, null);
|
8028 |
-
};
|
8029 |
-
|
8030 |
-
pushCurrentDebugStack = function (stack) {
|
8031 |
-
currentDebugStacks.push(stack);
|
8032 |
-
|
8033 |
-
if (currentDebugStacks.length === 1) {
|
8034 |
-
// We are entering a server renderer.
|
8035 |
-
// Remember the previous (e.g. client) global stack implementation.
|
8036 |
-
prevGetCurrentStackImpl = ReactDebugCurrentFrame$1.getCurrentStack;
|
8037 |
-
ReactDebugCurrentFrame$1.getCurrentStack = getCurrentServerStackImpl;
|
8038 |
-
}
|
8039 |
-
};
|
8040 |
-
|
8041 |
-
pushElementToDebugStack = function (element) {
|
8042 |
-
// For the innermost executing ReactDOMServer call,
|
8043 |
-
var stack = currentDebugStacks[currentDebugStacks.length - 1]; // Take the innermost executing frame (e.g. <Foo>),
|
8044 |
-
|
8045 |
-
var frame = stack[stack.length - 1]; // and record that it has one more element associated with it.
|
8046 |
-
|
8047 |
-
frame.debugElementStack.push(element); // We only need this because we tail-optimize single-element
|
8048 |
-
// children and directly handle them in an inner loop instead of
|
8049 |
-
// creating separate frames for them.
|
8050 |
-
};
|
8051 |
-
|
8052 |
-
popCurrentDebugStack = function () {
|
8053 |
-
currentDebugStacks.pop();
|
8054 |
-
|
8055 |
-
if (currentDebugStacks.length === 0) {
|
8056 |
-
// We are exiting the server renderer.
|
8057 |
-
// Restore the previous (e.g. client) global stack implementation.
|
8058 |
-
ReactDebugCurrentFrame$1.getCurrentStack = prevGetCurrentStackImpl;
|
8059 |
-
prevGetCurrentStackImpl = null;
|
8060 |
-
}
|
8061 |
-
};
|
8062 |
-
|
8063 |
-
getCurrentServerStackImpl = function () {
|
8064 |
-
if (currentDebugStacks.length === 0) {
|
8065 |
-
// Nothing is currently rendering.
|
8066 |
-
return '';
|
8067 |
-
} // ReactDOMServer is reentrant so there may be multiple calls at the same time.
|
8068 |
-
// Take the frames from the innermost call which is the last in the array.
|
8069 |
-
|
8070 |
-
|
8071 |
-
var frames = currentDebugStacks[currentDebugStacks.length - 1];
|
8072 |
-
var stack = ''; // Go through every frame in the stack from the innermost one.
|
8073 |
-
|
8074 |
-
for (var i = frames.length - 1; i >= 0; i--) {
|
8075 |
-
var frame = frames[i]; // Every frame might have more than one debug element stack entry associated with it.
|
8076 |
-
// This is because single-child nesting doesn't create materialized frames.
|
8077 |
-
// Instead it would push them through `pushElementToDebugStack()`.
|
8078 |
-
|
8079 |
-
var debugElementStack = frame.debugElementStack;
|
8080 |
-
|
8081 |
-
for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
|
8082 |
-
stack += describeStackFrame(debugElementStack[ii]);
|
8083 |
-
}
|
8084 |
-
}
|
8085 |
-
|
8086 |
-
return stack;
|
8087 |
-
};
|
8088 |
-
}
|
8089 |
-
|
8090 |
-
var didWarnDefaultInputValue = false;
|
8091 |
-
var didWarnDefaultChecked = false;
|
8092 |
-
var didWarnDefaultSelectValue = false;
|
8093 |
-
var didWarnDefaultTextareaValue = false;
|
8094 |
-
var didWarnInvalidOptionChildren = false;
|
8095 |
-
var didWarnAboutNoopUpdateForComponent = {};
|
8096 |
-
var didWarnAboutBadClass = {};
|
8097 |
-
var didWarnAboutModulePatternComponent = {};
|
8098 |
-
var didWarnAboutDeprecatedWillMount = {};
|
8099 |
-
var didWarnAboutUndefinedDerivedState = {};
|
8100 |
-
var didWarnAboutUninitializedState = {};
|
8101 |
-
var valuePropNames = ['value', 'defaultValue'];
|
8102 |
-
var newlineEatingTags = {
|
8103 |
-
listing: true,
|
8104 |
-
pre: true,
|
8105 |
-
textarea: true
|
8106 |
-
}; // We accept any tag to be rendered but since this gets injected into arbitrary
|
8107 |
-
// HTML, we want to make sure that it's a safe tag.
|
8108 |
-
// http://www.w3.org/TR/REC-xml/#NT-Name
|
8109 |
-
|
8110 |
-
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
|
8111 |
-
|
8112 |
-
var validatedTagCache = {};
|
8113 |
-
|
8114 |
-
function validateDangerousTag(tag) {
|
8115 |
-
if (!validatedTagCache.hasOwnProperty(tag)) {
|
8116 |
-
if (!VALID_TAG_REGEX.test(tag)) {
|
8117 |
-
{
|
8118 |
-
throw Error( "Invalid tag: " + tag );
|
8119 |
-
}
|
8120 |
-
}
|
8121 |
-
|
8122 |
-
validatedTagCache[tag] = true;
|
8123 |
-
}
|
8124 |
-
}
|
8125 |
-
|
8126 |
-
var styleNameCache = {};
|
8127 |
-
|
8128 |
-
var processStyleName = function (styleName) {
|
8129 |
-
if (styleNameCache.hasOwnProperty(styleName)) {
|
8130 |
-
return styleNameCache[styleName];
|
8131 |
-
}
|
8132 |
-
|
8133 |
-
var result = hyphenateStyleName(styleName);
|
8134 |
-
styleNameCache[styleName] = result;
|
8135 |
-
return result;
|
8136 |
-
};
|
8137 |
-
|
8138 |
-
function createMarkupForStyles(styles) {
|
8139 |
-
var serialized = '';
|
8140 |
-
var delimiter = '';
|
8141 |
-
|
8142 |
-
for (var styleName in styles) {
|
8143 |
-
if (!styles.hasOwnProperty(styleName)) {
|
8144 |
-
continue;
|
8145 |
-
}
|
8146 |
-
|
8147 |
-
var isCustomProperty = styleName.indexOf('--') === 0;
|
8148 |
-
var styleValue = styles[styleName];
|
8149 |
-
|
8150 |
-
{
|
8151 |
-
if (!isCustomProperty) {
|
8152 |
-
warnValidStyle$1(styleName, styleValue);
|
8153 |
-
}
|
8154 |
-
}
|
8155 |
-
|
8156 |
-
if (styleValue != null) {
|
8157 |
-
serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
|
8158 |
-
serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
|
8159 |
-
delimiter = ';';
|
8160 |
-
}
|
8161 |
-
}
|
8162 |
-
|
8163 |
-
return serialized || null;
|
8164 |
-
}
|
8165 |
-
|
8166 |
-
function warnNoop(publicInstance, callerName) {
|
8167 |
-
{
|
8168 |
-
var _constructor = publicInstance.constructor;
|
8169 |
-
var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
|
8170 |
-
var warningKey = componentName + '.' + callerName;
|
8171 |
-
|
8172 |
-
if (didWarnAboutNoopUpdateForComponent[warningKey]) {
|
8173 |
-
return;
|
8174 |
-
}
|
8175 |
-
|
8176 |
-
error('%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
|
8177 |
-
|
8178 |
-
didWarnAboutNoopUpdateForComponent[warningKey] = true;
|
8179 |
-
}
|
8180 |
-
}
|
8181 |
-
|
8182 |
-
function shouldConstruct$1(Component) {
|
8183 |
-
return Component.prototype && Component.prototype.isReactComponent;
|
8184 |
-
}
|
8185 |
-
|
8186 |
-
function getNonChildrenInnerMarkup(props) {
|
8187 |
-
var innerHTML = props.dangerouslySetInnerHTML;
|
8188 |
-
|
8189 |
-
if (innerHTML != null) {
|
8190 |
-
if (innerHTML.__html != null) {
|
8191 |
-
return innerHTML.__html;
|
8192 |
-
}
|
8193 |
-
} else {
|
8194 |
-
var content = props.children;
|
8195 |
-
|
8196 |
-
if (typeof content === 'string' || typeof content === 'number') {
|
8197 |
-
return escapeTextForBrowser(content);
|
8198 |
-
}
|
8199 |
-
}
|
8200 |
-
|
8201 |
-
return null;
|
8202 |
-
}
|
8203 |
-
|
8204 |
-
function flattenTopLevelChildren(children) {
|
8205 |
-
if (!React.isValidElement(children)) {
|
8206 |
-
return toArray(children);
|
8207 |
-
}
|
8208 |
-
|
8209 |
-
var element = children;
|
8210 |
-
|
8211 |
-
if (element.type !== REACT_FRAGMENT_TYPE) {
|
8212 |
-
return [element];
|
8213 |
-
}
|
8214 |
-
|
8215 |
-
var fragmentChildren = element.props.children;
|
8216 |
-
|
8217 |
-
if (!React.isValidElement(fragmentChildren)) {
|
8218 |
-
return toArray(fragmentChildren);
|
8219 |
-
}
|
8220 |
-
|
8221 |
-
var fragmentChildElement = fragmentChildren;
|
8222 |
-
return [fragmentChildElement];
|
8223 |
-
}
|
8224 |
-
|
8225 |
-
function flattenOptionChildren(children) {
|
8226 |
-
if (children === undefined || children === null) {
|
8227 |
-
return children;
|
8228 |
-
}
|
8229 |
-
|
8230 |
-
var content = ''; // Flatten children and warn if they aren't strings or numbers;
|
8231 |
-
// invalid types are ignored.
|
8232 |
-
|
8233 |
-
React.Children.forEach(children, function (child) {
|
8234 |
-
if (child == null) {
|
8235 |
-
return;
|
8236 |
-
}
|
8237 |
-
|
8238 |
-
content += child;
|
8239 |
-
|
8240 |
-
{
|
8241 |
-
if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
|
8242 |
-
didWarnInvalidOptionChildren = true;
|
8243 |
-
|
8244 |
-
error('Only strings and numbers are supported as <option> children.');
|
8245 |
-
}
|
8246 |
-
}
|
8247 |
-
});
|
8248 |
-
return content;
|
8249 |
-
}
|
8250 |
-
|
8251 |
-
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
8252 |
-
var STYLE = 'style';
|
8253 |
-
var RESERVED_PROPS = {
|
8254 |
-
children: null,
|
8255 |
-
dangerouslySetInnerHTML: null,
|
8256 |
-
suppressContentEditableWarning: null,
|
8257 |
-
suppressHydrationWarning: null
|
8258 |
-
};
|
8259 |
-
|
8260 |
-
function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
|
8261 |
-
var ret = '<' + tagVerbatim;
|
8262 |
-
var isCustomComponent$1 = isCustomComponent(tagLowercase, props);
|
8263 |
-
|
8264 |
-
for (var propKey in props) {
|
8265 |
-
if (!hasOwnProperty$2.call(props, propKey)) {
|
8266 |
-
continue;
|
8267 |
-
}
|
8268 |
-
|
8269 |
-
var propValue = props[propKey];
|
8270 |
-
|
8271 |
-
if (propValue == null) {
|
8272 |
-
continue;
|
8273 |
-
}
|
8274 |
-
|
8275 |
-
if (propKey === STYLE) {
|
8276 |
-
propValue = createMarkupForStyles(propValue);
|
8277 |
-
}
|
8278 |
-
|
8279 |
-
var markup = null;
|
8280 |
-
|
8281 |
-
if (isCustomComponent$1) {
|
8282 |
-
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
|
8283 |
-
markup = createMarkupForCustomAttribute(propKey, propValue);
|
8284 |
-
}
|
8285 |
-
} else {
|
8286 |
-
markup = createMarkupForProperty(propKey, propValue);
|
8287 |
-
}
|
8288 |
-
|
8289 |
-
if (markup) {
|
8290 |
-
ret += ' ' + markup;
|
8291 |
-
}
|
8292 |
-
} // For static pages, no need to put React ID and checksum. Saves lots of
|
8293 |
-
// bytes.
|
8294 |
-
|
8295 |
-
|
8296 |
-
if (makeStaticMarkup) {
|
8297 |
-
return ret;
|
8298 |
-
}
|
8299 |
-
|
8300 |
-
if (isRootElement) {
|
8301 |
-
ret += ' ' + createMarkupForRoot();
|
8302 |
-
}
|
8303 |
-
|
8304 |
-
return ret;
|
8305 |
-
}
|
8306 |
-
|
8307 |
-
function validateRenderResult(child, type) {
|
8308 |
-
if (child === undefined) {
|
8309 |
-
{
|
8310 |
-
{
|
8311 |
-
throw Error( (getComponentName(type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." );
|
8312 |
-
}
|
8313 |
-
}
|
8314 |
-
}
|
8315 |
-
}
|
8316 |
-
|
8317 |
-
function resolve(child, context, threadID) {
|
8318 |
-
while (React.isValidElement(child)) {
|
8319 |
-
// Safe because we just checked it's an element.
|
8320 |
-
var element = child;
|
8321 |
-
var Component = element.type;
|
8322 |
-
|
8323 |
-
{
|
8324 |
-
pushElementToDebugStack(element);
|
8325 |
-
}
|
8326 |
-
|
8327 |
-
if (typeof Component !== 'function') {
|
8328 |
-
break;
|
8329 |
-
}
|
8330 |
-
|
8331 |
-
processChild(element, Component);
|
8332 |
-
} // Extra closure so queue and replace can be captured properly
|
8333 |
-
|
8334 |
-
|
8335 |
-
function processChild(element, Component) {
|
8336 |
-
var isClass = shouldConstruct$1(Component);
|
8337 |
-
var publicContext = processContext(Component, context, threadID, isClass);
|
8338 |
-
var queue = [];
|
8339 |
-
var replace = false;
|
8340 |
-
var updater = {
|
8341 |
-
isMounted: function (publicInstance) {
|
8342 |
-
return false;
|
8343 |
-
},
|
8344 |
-
enqueueForceUpdate: function (publicInstance) {
|
8345 |
-
if (queue === null) {
|
8346 |
-
warnNoop(publicInstance, 'forceUpdate');
|
8347 |
-
return null;
|
8348 |
-
}
|
8349 |
-
},
|
8350 |
-
enqueueReplaceState: function (publicInstance, completeState) {
|
8351 |
-
replace = true;
|
8352 |
-
queue = [completeState];
|
8353 |
-
},
|
8354 |
-
enqueueSetState: function (publicInstance, currentPartialState) {
|
8355 |
-
if (queue === null) {
|
8356 |
-
warnNoop(publicInstance, 'setState');
|
8357 |
-
return null;
|
8358 |
-
}
|
8359 |
-
|
8360 |
-
queue.push(currentPartialState);
|
8361 |
-
}
|
8362 |
-
};
|
8363 |
-
var inst;
|
8364 |
-
|
8365 |
-
if (isClass) {
|
8366 |
-
inst = new Component(element.props, publicContext, updater);
|
8367 |
-
|
8368 |
-
if (typeof Component.getDerivedStateFromProps === 'function') {
|
8369 |
-
{
|
8370 |
-
if (inst.state === null || inst.state === undefined) {
|
8371 |
-
var componentName = getComponentName(Component) || 'Unknown';
|
8372 |
-
|
8373 |
-
if (!didWarnAboutUninitializedState[componentName]) {
|
8374 |
-
error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, inst.state === null ? 'null' : 'undefined', componentName);
|
8375 |
-
|
8376 |
-
didWarnAboutUninitializedState[componentName] = true;
|
8377 |
-
}
|
8378 |
-
}
|
8379 |
-
}
|
8380 |
-
|
8381 |
-
var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
8382 |
-
|
8383 |
-
{
|
8384 |
-
if (partialState === undefined) {
|
8385 |
-
var _componentName = getComponentName(Component) || 'Unknown';
|
8386 |
-
|
8387 |
-
if (!didWarnAboutUndefinedDerivedState[_componentName]) {
|
8388 |
-
error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
|
8389 |
-
|
8390 |
-
didWarnAboutUndefinedDerivedState[_componentName] = true;
|
8391 |
-
}
|
8392 |
-
}
|
8393 |
-
}
|
8394 |
-
|
8395 |
-
if (partialState != null) {
|
8396 |
-
inst.state = _assign({}, inst.state, partialState);
|
8397 |
-
}
|
8398 |
-
}
|
8399 |
-
} else {
|
8400 |
-
{
|
8401 |
-
if (Component.prototype && typeof Component.prototype.render === 'function') {
|
8402 |
-
var _componentName2 = getComponentName(Component) || 'Unknown';
|
8403 |
-
|
8404 |
-
if (!didWarnAboutBadClass[_componentName2]) {
|
8405 |
-
error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
|
8406 |
-
|
8407 |
-
didWarnAboutBadClass[_componentName2] = true;
|
8408 |
-
}
|
8409 |
-
}
|
8410 |
-
}
|
8411 |
-
|
8412 |
-
var componentIdentity = {};
|
8413 |
-
prepareToUseHooks(componentIdentity);
|
8414 |
-
inst = Component(element.props, publicContext, updater);
|
8415 |
-
inst = finishHooks(Component, element.props, inst, publicContext);
|
8416 |
-
|
8417 |
-
{
|
8418 |
-
// Support for module components is deprecated and is removed behind a flag.
|
8419 |
-
// Whether or not it would crash later, we want to show a good message in DEV first.
|
8420 |
-
if (inst != null && inst.render != null) {
|
8421 |
-
var _componentName3 = getComponentName(Component) || 'Unknown';
|
8422 |
-
|
8423 |
-
if (!didWarnAboutModulePatternComponent[_componentName3]) {
|
8424 |
-
error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3);
|
8425 |
-
|
8426 |
-
didWarnAboutModulePatternComponent[_componentName3] = true;
|
8427 |
-
}
|
8428 |
-
}
|
8429 |
-
} // If the flag is on, everything is assumed to be a function component.
|
8430 |
-
// Otherwise, we also do the unfortunate dynamic checks.
|
8431 |
-
|
8432 |
-
|
8433 |
-
if ( inst == null || inst.render == null) {
|
8434 |
-
child = inst;
|
8435 |
-
validateRenderResult(child, Component);
|
8436 |
-
return;
|
8437 |
-
}
|
8438 |
-
}
|
8439 |
-
|
8440 |
-
inst.props = element.props;
|
8441 |
-
inst.context = publicContext;
|
8442 |
-
inst.updater = updater;
|
8443 |
-
var initialState = inst.state;
|
8444 |
-
|
8445 |
-
if (initialState === undefined) {
|
8446 |
-
inst.state = initialState = null;
|
8447 |
-
}
|
8448 |
-
|
8449 |
-
if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
|
8450 |
-
if (typeof inst.componentWillMount === 'function') {
|
8451 |
-
{
|
8452 |
-
if ( inst.componentWillMount.__suppressDeprecationWarning !== true) {
|
8453 |
-
var _componentName4 = getComponentName(Component) || 'Unknown';
|
8454 |
-
|
8455 |
-
if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
|
8456 |
-
warn( // keep this warning in sync with ReactStrictModeWarning.js
|
8457 |
-
'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4);
|
8458 |
-
|
8459 |
-
didWarnAboutDeprecatedWillMount[_componentName4] = true;
|
8460 |
-
}
|
8461 |
-
}
|
8462 |
-
} // In order to support react-lifecycles-compat polyfilled components,
|
8463 |
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
8464 |
-
|
8465 |
-
|
8466 |
-
if (typeof Component.getDerivedStateFromProps !== 'function') {
|
8467 |
-
inst.componentWillMount();
|
8468 |
-
}
|
8469 |
-
}
|
8470 |
-
|
8471 |
-
if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
|
8472 |
-
// In order to support react-lifecycles-compat polyfilled components,
|
8473 |
-
// Unsafe lifecycles should not be invoked for any component with the new gDSFP.
|
8474 |
-
inst.UNSAFE_componentWillMount();
|
8475 |
-
}
|
8476 |
-
|
8477 |
-
if (queue.length) {
|
8478 |
-
var oldQueue = queue;
|
8479 |
-
var oldReplace = replace;
|
8480 |
-
queue = null;
|
8481 |
-
replace = false;
|
8482 |
-
|
8483 |
-
if (oldReplace && oldQueue.length === 1) {
|
8484 |
-
inst.state = oldQueue[0];
|
8485 |
-
} else {
|
8486 |
-
var nextState = oldReplace ? oldQueue[0] : inst.state;
|
8487 |
-
var dontMutate = true;
|
8488 |
-
|
8489 |
-
for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
8490 |
-
var partial = oldQueue[i];
|
8491 |
-
|
8492 |
-
var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
8493 |
-
|
8494 |
-
if (_partialState != null) {
|
8495 |
-
if (dontMutate) {
|
8496 |
-
dontMutate = false;
|
8497 |
-
nextState = _assign({}, nextState, _partialState);
|
8498 |
-
} else {
|
8499 |
-
_assign(nextState, _partialState);
|
8500 |
-
}
|
8501 |
-
}
|
8502 |
-
}
|
8503 |
-
|
8504 |
-
inst.state = nextState;
|
8505 |
-
}
|
8506 |
-
} else {
|
8507 |
-
queue = null;
|
8508 |
-
}
|
8509 |
-
}
|
8510 |
-
|
8511 |
-
child = inst.render();
|
8512 |
-
|
8513 |
-
{
|
8514 |
-
if (child === undefined && inst.render._isMockFunction) {
|
8515 |
-
// This is probably bad practice. Consider warning here and
|
8516 |
-
// deprecating this convenience.
|
8517 |
-
child = null;
|
8518 |
-
}
|
8519 |
-
}
|
8520 |
-
|
8521 |
-
validateRenderResult(child, Component);
|
8522 |
-
var childContext;
|
8523 |
-
|
8524 |
-
{
|
8525 |
-
if (typeof inst.getChildContext === 'function') {
|
8526 |
-
var _childContextTypes = Component.childContextTypes;
|
8527 |
-
|
8528 |
-
if (typeof _childContextTypes === 'object') {
|
8529 |
-
childContext = inst.getChildContext();
|
8530 |
-
|
8531 |
-
for (var contextKey in childContext) {
|
8532 |
-
if (!(contextKey in _childContextTypes)) {
|
8533 |
-
{
|
8534 |
-
throw Error( (getComponentName(Component) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." );
|
8535 |
-
}
|
8536 |
-
}
|
8537 |
-
}
|
8538 |
-
} else {
|
8539 |
-
{
|
8540 |
-
error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
|
8541 |
-
}
|
8542 |
-
}
|
8543 |
-
}
|
8544 |
-
|
8545 |
-
if (childContext) {
|
8546 |
-
context = _assign({}, context, childContext);
|
8547 |
-
}
|
8548 |
-
}
|
8549 |
-
}
|
8550 |
-
|
8551 |
-
return {
|
8552 |
-
child: child,
|
8553 |
-
context: context
|
8554 |
-
};
|
8555 |
-
}
|
8556 |
-
|
8557 |
-
var ReactDOMServerRenderer = /*#__PURE__*/function () {
|
8558 |
-
// TODO: type this more strictly:
|
8559 |
-
// DEV-only
|
8560 |
-
function ReactDOMServerRenderer(children, makeStaticMarkup, options) {
|
8561 |
-
var flatChildren = flattenTopLevelChildren(children);
|
8562 |
-
var topFrame = {
|
8563 |
-
type: null,
|
8564 |
-
// Assume all trees start in the HTML namespace (not totally true, but
|
8565 |
-
// this is what we did historically)
|
8566 |
-
domNamespace: Namespaces.html,
|
8567 |
-
children: flatChildren,
|
8568 |
-
childIndex: 0,
|
8569 |
-
context: emptyObject,
|
8570 |
-
footer: ''
|
8571 |
-
};
|
8572 |
-
|
8573 |
-
{
|
8574 |
-
topFrame.debugElementStack = [];
|
8575 |
-
}
|
8576 |
-
|
8577 |
-
this.threadID = allocThreadID();
|
8578 |
-
this.stack = [topFrame];
|
8579 |
-
this.exhausted = false;
|
8580 |
-
this.currentSelectValue = null;
|
8581 |
-
this.previousWasTextNode = false;
|
8582 |
-
this.makeStaticMarkup = makeStaticMarkup;
|
8583 |
-
this.suspenseDepth = 0; // Context (new API)
|
8584 |
-
|
8585 |
-
this.contextIndex = -1;
|
8586 |
-
this.contextStack = [];
|
8587 |
-
this.contextValueStack = []; // useOpaqueIdentifier ID
|
8588 |
-
|
8589 |
-
this.uniqueID = 0;
|
8590 |
-
this.identifierPrefix = options && options.identifierPrefix || '';
|
8591 |
-
|
8592 |
-
{
|
8593 |
-
this.contextProviderStack = [];
|
8594 |
-
}
|
8595 |
-
}
|
8596 |
-
|
8597 |
-
var _proto = ReactDOMServerRenderer.prototype;
|
8598 |
-
|
8599 |
-
_proto.destroy = function destroy() {
|
8600 |
-
if (!this.exhausted) {
|
8601 |
-
this.exhausted = true;
|
8602 |
-
this.clearProviders();
|
8603 |
-
freeThreadID(this.threadID);
|
8604 |
-
}
|
8605 |
-
}
|
8606 |
-
/**
|
8607 |
-
* Note: We use just two stacks regardless of how many context providers you have.
|
8608 |
-
* Providers are always popped in the reverse order to how they were pushed
|
8609 |
-
* so we always know on the way down which provider you'll encounter next on the way up.
|
8610 |
-
* On the way down, we push the current provider, and its context value *before*
|
8611 |
-
* we mutated it, onto the stacks. Therefore, on the way up, we always know which
|
8612 |
-
* provider needs to be "restored" to which value.
|
8613 |
-
* https://github.com/facebook/react/pull/12985#issuecomment-396301248
|
8614 |
-
*/
|
8615 |
-
;
|
8616 |
-
|
8617 |
-
_proto.pushProvider = function pushProvider(provider) {
|
8618 |
-
var index = ++this.contextIndex;
|
8619 |
-
var context = provider.type._context;
|
8620 |
-
var threadID = this.threadID;
|
8621 |
-
validateContextBounds(context, threadID);
|
8622 |
-
var previousValue = context[threadID]; // Remember which value to restore this context to on our way up.
|
8623 |
-
|
8624 |
-
this.contextStack[index] = context;
|
8625 |
-
this.contextValueStack[index] = previousValue;
|
8626 |
-
|
8627 |
-
{
|
8628 |
-
// Only used for push/pop mismatch warnings.
|
8629 |
-
this.contextProviderStack[index] = provider;
|
8630 |
-
} // Mutate the current value.
|
8631 |
-
|
8632 |
-
|
8633 |
-
context[threadID] = provider.props.value;
|
8634 |
-
};
|
8635 |
-
|
8636 |
-
_proto.popProvider = function popProvider(provider) {
|
8637 |
-
var index = this.contextIndex;
|
8638 |
-
|
8639 |
-
{
|
8640 |
-
if (index < 0 || provider !== this.contextProviderStack[index]) {
|
8641 |
-
error('Unexpected pop.');
|
8642 |
-
}
|
8643 |
-
}
|
8644 |
-
|
8645 |
-
var context = this.contextStack[index];
|
8646 |
-
var previousValue = this.contextValueStack[index]; // "Hide" these null assignments from Flow by using `any`
|
8647 |
-
// because conceptually they are deletions--as long as we
|
8648 |
-
// promise to never access values beyond `this.contextIndex`.
|
8649 |
-
|
8650 |
-
this.contextStack[index] = null;
|
8651 |
-
this.contextValueStack[index] = null;
|
8652 |
-
|
8653 |
-
{
|
8654 |
-
this.contextProviderStack[index] = null;
|
8655 |
-
}
|
8656 |
-
|
8657 |
-
this.contextIndex--; // Restore to the previous value we stored as we were walking down.
|
8658 |
-
// We've already verified that this context has been expanded to accommodate
|
8659 |
-
// this thread id, so we don't need to do it again.
|
8660 |
-
|
8661 |
-
context[this.threadID] = previousValue;
|
8662 |
-
};
|
8663 |
-
|
8664 |
-
_proto.clearProviders = function clearProviders() {
|
8665 |
-
// Restore any remaining providers on the stack to previous values
|
8666 |
-
for (var index = this.contextIndex; index >= 0; index--) {
|
8667 |
-
var context = this.contextStack[index];
|
8668 |
-
var previousValue = this.contextValueStack[index];
|
8669 |
-
context[this.threadID] = previousValue;
|
8670 |
-
}
|
8671 |
-
};
|
8672 |
-
|
8673 |
-
_proto.read = function read(bytes) {
|
8674 |
-
if (this.exhausted) {
|
8675 |
-
return null;
|
8676 |
-
}
|
8677 |
-
|
8678 |
-
var prevPartialRenderer = currentPartialRenderer;
|
8679 |
-
setCurrentPartialRenderer(this);
|
8680 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
8681 |
-
ReactCurrentDispatcher$1.current = Dispatcher;
|
8682 |
-
|
8683 |
-
try {
|
8684 |
-
// Markup generated within <Suspense> ends up buffered until we know
|
8685 |
-
// nothing in that boundary suspended
|
8686 |
-
var out = [''];
|
8687 |
-
var suspended = false;
|
8688 |
-
|
8689 |
-
while (out[0].length < bytes) {
|
8690 |
-
if (this.stack.length === 0) {
|
8691 |
-
this.exhausted = true;
|
8692 |
-
freeThreadID(this.threadID);
|
8693 |
-
break;
|
8694 |
-
}
|
8695 |
-
|
8696 |
-
var frame = this.stack[this.stack.length - 1];
|
8697 |
-
|
8698 |
-
if (suspended || frame.childIndex >= frame.children.length) {
|
8699 |
-
var footer = frame.footer;
|
8700 |
-
|
8701 |
-
if (footer !== '') {
|
8702 |
-
this.previousWasTextNode = false;
|
8703 |
-
}
|
8704 |
-
|
8705 |
-
this.stack.pop();
|
8706 |
-
|
8707 |
-
if (frame.type === 'select') {
|
8708 |
-
this.currentSelectValue = null;
|
8709 |
-
} else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
|
8710 |
-
var provider = frame.type;
|
8711 |
-
this.popProvider(provider);
|
8712 |
-
} else if (frame.type === REACT_SUSPENSE_TYPE) {
|
8713 |
-
this.suspenseDepth--;
|
8714 |
-
var buffered = out.pop();
|
8715 |
-
|
8716 |
-
if (suspended) {
|
8717 |
-
suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame
|
8718 |
-
|
8719 |
-
var fallbackFrame = frame.fallbackFrame;
|
8720 |
-
|
8721 |
-
if (!fallbackFrame) {
|
8722 |
-
{
|
8723 |
-
throw Error(true ? "ReactDOMServer did not find an internal fallback frame for Suspense. This is a bug in React. Please file an issue." : undefined);
|
8724 |
-
}
|
8725 |
-
}
|
8726 |
-
|
8727 |
-
this.stack.push(fallbackFrame);
|
8728 |
-
out[this.suspenseDepth] += '<!--$!-->'; // Skip flushing output since we're switching to the fallback
|
8729 |
-
|
8730 |
-
continue;
|
8731 |
-
} else {
|
8732 |
-
out[this.suspenseDepth] += buffered;
|
8733 |
-
}
|
8734 |
-
} // Flush output
|
8735 |
-
|
8736 |
-
|
8737 |
-
out[this.suspenseDepth] += footer;
|
8738 |
-
continue;
|
8739 |
-
}
|
8740 |
-
|
8741 |
-
var child = frame.children[frame.childIndex++];
|
8742 |
-
var outBuffer = '';
|
8743 |
-
|
8744 |
-
if (true) {
|
8745 |
-
pushCurrentDebugStack(this.stack); // We're starting work on this frame, so reset its inner stack.
|
8746 |
-
|
8747 |
-
frame.debugElementStack.length = 0;
|
8748 |
-
}
|
8749 |
-
|
8750 |
-
try {
|
8751 |
-
outBuffer += this.render(child, frame.context, frame.domNamespace);
|
8752 |
-
} catch (err) {
|
8753 |
-
if (err != null && typeof err.then === 'function') {
|
8754 |
-
if (enableSuspenseServerRenderer) {
|
8755 |
-
if (!(this.suspenseDepth > 0)) {
|
8756 |
-
{
|
8757 |
-
throw Error(true ? "A React component suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display." : undefined);
|
8758 |
-
}
|
8759 |
-
}
|
8760 |
-
|
8761 |
-
suspended = true;
|
8762 |
-
} else {
|
8763 |
-
if (true) {
|
8764 |
-
{
|
8765 |
-
throw Error(true ? "ReactDOMServer does not yet support Suspense." : undefined);
|
8766 |
-
}
|
8767 |
-
}
|
8768 |
-
}
|
8769 |
-
} else {
|
8770 |
-
throw err;
|
8771 |
-
}
|
8772 |
-
} finally {
|
8773 |
-
if (true) {
|
8774 |
-
popCurrentDebugStack();
|
8775 |
-
}
|
8776 |
-
}
|
8777 |
-
|
8778 |
-
if (out.length <= this.suspenseDepth) {
|
8779 |
-
out.push('');
|
8780 |
-
}
|
8781 |
-
|
8782 |
-
out[this.suspenseDepth] += outBuffer;
|
8783 |
-
}
|
8784 |
-
|
8785 |
-
return out[0];
|
8786 |
-
} finally {
|
8787 |
-
ReactCurrentDispatcher$1.current = prevDispatcher;
|
8788 |
-
setCurrentPartialRenderer(prevPartialRenderer);
|
8789 |
-
resetHooksState();
|
8790 |
-
}
|
8791 |
-
};
|
8792 |
-
|
8793 |
-
_proto.render = function render(child, context, parentNamespace) {
|
8794 |
-
if (typeof child === 'string' || typeof child === 'number') {
|
8795 |
-
var text = '' + child;
|
8796 |
-
|
8797 |
-
if (text === '') {
|
8798 |
-
return '';
|
8799 |
-
}
|
8800 |
-
|
8801 |
-
if (this.makeStaticMarkup) {
|
8802 |
-
return escapeTextForBrowser(text);
|
8803 |
-
}
|
8804 |
-
|
8805 |
-
if (this.previousWasTextNode) {
|
8806 |
-
return '<!-- -->' + escapeTextForBrowser(text);
|
8807 |
-
}
|
8808 |
-
|
8809 |
-
this.previousWasTextNode = true;
|
8810 |
-
return escapeTextForBrowser(text);
|
8811 |
-
} else {
|
8812 |
-
var nextChild;
|
8813 |
-
|
8814 |
-
var _resolve = resolve(child, context, this.threadID);
|
8815 |
-
|
8816 |
-
nextChild = _resolve.child;
|
8817 |
-
context = _resolve.context;
|
8818 |
-
|
8819 |
-
if (nextChild === null || nextChild === false) {
|
8820 |
-
return '';
|
8821 |
-
} else if (!React.isValidElement(nextChild)) {
|
8822 |
-
if (nextChild != null && nextChild.$$typeof != null) {
|
8823 |
-
// Catch unexpected special types early.
|
8824 |
-
var $$typeof = nextChild.$$typeof;
|
8825 |
-
|
8826 |
-
if (!($$typeof !== REACT_PORTAL_TYPE)) {
|
8827 |
-
{
|
8828 |
-
throw Error( "Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render." );
|
8829 |
-
}
|
8830 |
-
} // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
|
8831 |
-
|
8832 |
-
|
8833 |
-
{
|
8834 |
-
{
|
8835 |
-
throw Error( "Unknown element-like object type: " + $$typeof.toString() + ". This is likely a bug in React. Please file an issue." );
|
8836 |
-
}
|
8837 |
-
}
|
8838 |
-
}
|
8839 |
-
|
8840 |
-
var nextChildren = toArray(nextChild);
|
8841 |
-
var frame = {
|
8842 |
-
type: null,
|
8843 |
-
domNamespace: parentNamespace,
|
8844 |
-
children: nextChildren,
|
8845 |
-
childIndex: 0,
|
8846 |
-
context: context,
|
8847 |
-
footer: ''
|
8848 |
-
};
|
8849 |
-
|
8850 |
-
{
|
8851 |
-
frame.debugElementStack = [];
|
8852 |
-
}
|
8853 |
-
|
8854 |
-
this.stack.push(frame);
|
8855 |
-
return '';
|
8856 |
-
} // Safe because we just checked it's an element.
|
8857 |
-
|
8858 |
-
|
8859 |
-
var nextElement = nextChild;
|
8860 |
-
var elementType = nextElement.type;
|
8861 |
-
|
8862 |
-
if (typeof elementType === 'string') {
|
8863 |
-
return this.renderDOM(nextElement, context, parentNamespace);
|
8864 |
-
}
|
8865 |
-
|
8866 |
-
switch (elementType) {
|
8867 |
-
// TODO: LegacyHidden acts the same as a fragment. This only works
|
8868 |
-
// because we currently assume that every instance of LegacyHidden is
|
8869 |
-
// accompanied by a host component wrapper. In the hidden mode, the host
|
8870 |
-
// component is given a `hidden` attribute, which ensures that the
|
8871 |
-
// initial HTML is not visible. To support the use of LegacyHidden as a
|
8872 |
-
// true fragment, without an extra DOM node, we would have to hide the
|
8873 |
-
// initial HTML in some other way.
|
8874 |
-
case REACT_LEGACY_HIDDEN_TYPE:
|
8875 |
-
case REACT_DEBUG_TRACING_MODE_TYPE:
|
8876 |
-
case REACT_STRICT_MODE_TYPE:
|
8877 |
-
case REACT_PROFILER_TYPE:
|
8878 |
-
case REACT_SUSPENSE_LIST_TYPE:
|
8879 |
-
case REACT_FRAGMENT_TYPE:
|
8880 |
-
{
|
8881 |
-
var _nextChildren = toArray(nextChild.props.children);
|
8882 |
-
|
8883 |
-
var _frame = {
|
8884 |
-
type: null,
|
8885 |
-
domNamespace: parentNamespace,
|
8886 |
-
children: _nextChildren,
|
8887 |
-
childIndex: 0,
|
8888 |
-
context: context,
|
8889 |
-
footer: ''
|
8890 |
-
};
|
8891 |
-
|
8892 |
-
{
|
8893 |
-
_frame.debugElementStack = [];
|
8894 |
-
}
|
8895 |
-
|
8896 |
-
this.stack.push(_frame);
|
8897 |
-
return '';
|
8898 |
-
}
|
8899 |
-
|
8900 |
-
case REACT_SUSPENSE_TYPE:
|
8901 |
-
{
|
8902 |
-
{
|
8903 |
-
{
|
8904 |
-
{
|
8905 |
-
throw Error( "ReactDOMServer does not yet support Suspense." );
|
8906 |
-
}
|
8907 |
-
}
|
8908 |
-
}
|
8909 |
-
}
|
8910 |
-
// eslint-disable-next-line-no-fallthrough
|
8911 |
-
|
8912 |
-
case REACT_SCOPE_TYPE:
|
8913 |
-
{
|
8914 |
-
|
8915 |
-
{
|
8916 |
-
{
|
8917 |
-
throw Error( "ReactDOMServer does not yet support scope components." );
|
8918 |
-
}
|
8919 |
-
}
|
8920 |
-
}
|
8921 |
-
}
|
8922 |
-
|
8923 |
-
if (typeof elementType === 'object' && elementType !== null) {
|
8924 |
-
switch (elementType.$$typeof) {
|
8925 |
-
case REACT_FORWARD_REF_TYPE:
|
8926 |
-
{
|
8927 |
-
var element = nextChild;
|
8928 |
-
|
8929 |
-
var _nextChildren5;
|
8930 |
-
|
8931 |
-
var componentIdentity = {};
|
8932 |
-
prepareToUseHooks(componentIdentity);
|
8933 |
-
_nextChildren5 = elementType.render(element.props, element.ref);
|
8934 |
-
_nextChildren5 = finishHooks(elementType.render, element.props, _nextChildren5, element.ref);
|
8935 |
-
_nextChildren5 = toArray(_nextChildren5);
|
8936 |
-
var _frame5 = {
|
8937 |
-
type: null,
|
8938 |
-
domNamespace: parentNamespace,
|
8939 |
-
children: _nextChildren5,
|
8940 |
-
childIndex: 0,
|
8941 |
-
context: context,
|
8942 |
-
footer: ''
|
8943 |
-
};
|
8944 |
-
|
8945 |
-
{
|
8946 |
-
_frame5.debugElementStack = [];
|
8947 |
-
}
|
8948 |
-
|
8949 |
-
this.stack.push(_frame5);
|
8950 |
-
return '';
|
8951 |
-
}
|
8952 |
-
|
8953 |
-
case REACT_MEMO_TYPE:
|
8954 |
-
{
|
8955 |
-
var _element = nextChild;
|
8956 |
-
var _nextChildren6 = [React.createElement(elementType.type, _assign({
|
8957 |
-
ref: _element.ref
|
8958 |
-
}, _element.props))];
|
8959 |
-
var _frame6 = {
|
8960 |
-
type: null,
|
8961 |
-
domNamespace: parentNamespace,
|
8962 |
-
children: _nextChildren6,
|
8963 |
-
childIndex: 0,
|
8964 |
-
context: context,
|
8965 |
-
footer: ''
|
8966 |
-
};
|
8967 |
-
|
8968 |
-
{
|
8969 |
-
_frame6.debugElementStack = [];
|
8970 |
-
}
|
8971 |
-
|
8972 |
-
this.stack.push(_frame6);
|
8973 |
-
return '';
|
8974 |
-
}
|
8975 |
-
|
8976 |
-
case REACT_PROVIDER_TYPE:
|
8977 |
-
{
|
8978 |
-
var provider = nextChild;
|
8979 |
-
var nextProps = provider.props;
|
8980 |
-
|
8981 |
-
var _nextChildren7 = toArray(nextProps.children);
|
8982 |
-
|
8983 |
-
var _frame7 = {
|
8984 |
-
type: provider,
|
8985 |
-
domNamespace: parentNamespace,
|
8986 |
-
children: _nextChildren7,
|
8987 |
-
childIndex: 0,
|
8988 |
-
context: context,
|
8989 |
-
footer: ''
|
8990 |
-
};
|
8991 |
-
|
8992 |
-
{
|
8993 |
-
_frame7.debugElementStack = [];
|
8994 |
-
}
|
8995 |
-
|
8996 |
-
this.pushProvider(provider);
|
8997 |
-
this.stack.push(_frame7);
|
8998 |
-
return '';
|
8999 |
-
}
|
9000 |
-
|
9001 |
-
case REACT_CONTEXT_TYPE:
|
9002 |
-
{
|
9003 |
-
var reactContext = nextChild.type; // The logic below for Context differs depending on PROD or DEV mode. In
|
9004 |
-
// DEV mode, we create a separate object for Context.Consumer that acts
|
9005 |
-
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
9006 |
-
// so we use the old behaviour (Context.Consumer references Context) to
|
9007 |
-
// reduce size and overhead. The separate object references context via
|
9008 |
-
// a property called "_context", which also gives us the ability to check
|
9009 |
-
// in DEV mode if this property exists or not and warn if it does not.
|
9010 |
-
|
9011 |
-
{
|
9012 |
-
if (reactContext._context === undefined) {
|
9013 |
-
// This may be because it's a Context (rather than a Consumer).
|
9014 |
-
// Or it may be because it's older React where they're the same thing.
|
9015 |
-
// We only want to warn if we're sure it's a new React.
|
9016 |
-
if (reactContext !== reactContext.Consumer) {
|
9017 |
-
if (!hasWarnedAboutUsingContextAsConsumer) {
|
9018 |
-
hasWarnedAboutUsingContextAsConsumer = true;
|
9019 |
-
|
9020 |
-
error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
9021 |
-
}
|
9022 |
-
}
|
9023 |
-
} else {
|
9024 |
-
reactContext = reactContext._context;
|
9025 |
-
}
|
9026 |
-
}
|
9027 |
-
|
9028 |
-
var _nextProps = nextChild.props;
|
9029 |
-
var threadID = this.threadID;
|
9030 |
-
validateContextBounds(reactContext, threadID);
|
9031 |
-
var nextValue = reactContext[threadID];
|
9032 |
-
|
9033 |
-
var _nextChildren8 = toArray(_nextProps.children(nextValue));
|
9034 |
-
|
9035 |
-
var _frame8 = {
|
9036 |
-
type: nextChild,
|
9037 |
-
domNamespace: parentNamespace,
|
9038 |
-
children: _nextChildren8,
|
9039 |
-
childIndex: 0,
|
9040 |
-
context: context,
|
9041 |
-
footer: ''
|
9042 |
-
};
|
9043 |
-
|
9044 |
-
{
|
9045 |
-
_frame8.debugElementStack = [];
|
9046 |
-
}
|
9047 |
-
|
9048 |
-
this.stack.push(_frame8);
|
9049 |
-
return '';
|
9050 |
-
}
|
9051 |
-
// eslint-disable-next-line-no-fallthrough
|
9052 |
-
|
9053 |
-
case REACT_FUNDAMENTAL_TYPE:
|
9054 |
-
{
|
9055 |
-
|
9056 |
-
{
|
9057 |
-
{
|
9058 |
-
throw Error( "ReactDOMServer does not yet support the fundamental API." );
|
9059 |
-
}
|
9060 |
-
}
|
9061 |
-
}
|
9062 |
-
// eslint-disable-next-line-no-fallthrough
|
9063 |
-
|
9064 |
-
case REACT_LAZY_TYPE:
|
9065 |
-
{
|
9066 |
-
var _element2 = nextChild;
|
9067 |
-
var lazyComponent = nextChild.type; // Attempt to initialize lazy component regardless of whether the
|
9068 |
-
// suspense server-side renderer is enabled so synchronously
|
9069 |
-
// resolved constructors are supported.
|
9070 |
-
|
9071 |
-
var payload = lazyComponent._payload;
|
9072 |
-
var init = lazyComponent._init;
|
9073 |
-
var result = init(payload);
|
9074 |
-
var _nextChildren10 = [React.createElement(result, _assign({
|
9075 |
-
ref: _element2.ref
|
9076 |
-
}, _element2.props))];
|
9077 |
-
var _frame10 = {
|
9078 |
-
type: null,
|
9079 |
-
domNamespace: parentNamespace,
|
9080 |
-
children: _nextChildren10,
|
9081 |
-
childIndex: 0,
|
9082 |
-
context: context,
|
9083 |
-
footer: ''
|
9084 |
-
};
|
9085 |
-
|
9086 |
-
{
|
9087 |
-
_frame10.debugElementStack = [];
|
9088 |
-
}
|
9089 |
-
|
9090 |
-
this.stack.push(_frame10);
|
9091 |
-
return '';
|
9092 |
-
}
|
9093 |
-
}
|
9094 |
-
}
|
9095 |
-
|
9096 |
-
var info = '';
|
9097 |
-
|
9098 |
-
{
|
9099 |
-
var owner = nextElement._owner;
|
9100 |
-
|
9101 |
-
if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
|
9102 |
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.';
|
9103 |
-
}
|
9104 |
-
|
9105 |
-
var ownerName = owner ? getComponentName(owner) : null;
|
9106 |
-
|
9107 |
-
if (ownerName) {
|
9108 |
-
info += '\n\nCheck the render method of `' + ownerName + '`.';
|
9109 |
-
}
|
9110 |
-
}
|
9111 |
-
|
9112 |
-
{
|
9113 |
-
{
|
9114 |
-
throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (elementType == null ? elementType : typeof elementType) + "." + info );
|
9115 |
-
}
|
9116 |
-
}
|
9117 |
-
}
|
9118 |
-
};
|
9119 |
-
|
9120 |
-
_proto.renderDOM = function renderDOM(element, context, parentNamespace) {
|
9121 |
-
var tag = element.type.toLowerCase();
|
9122 |
-
var namespace = parentNamespace;
|
9123 |
-
|
9124 |
-
if (parentNamespace === Namespaces.html) {
|
9125 |
-
namespace = getIntrinsicNamespace(tag);
|
9126 |
-
}
|
9127 |
-
|
9128 |
-
{
|
9129 |
-
if (namespace === Namespaces.html) {
|
9130 |
-
// Should this check be gated by parent namespace? Not sure we want to
|
9131 |
-
// allow <SVG> or <mATH>.
|
9132 |
-
if (tag !== element.type) {
|
9133 |
-
error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type);
|
9134 |
-
}
|
9135 |
-
}
|
9136 |
-
}
|
9137 |
-
|
9138 |
-
validateDangerousTag(tag);
|
9139 |
-
var props = element.props;
|
9140 |
-
|
9141 |
-
if (tag === 'input') {
|
9142 |
-
{
|
9143 |
-
checkControlledValueProps('input', props);
|
9144 |
-
|
9145 |
-
if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
|
9146 |
-
error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
|
9147 |
-
|
9148 |
-
didWarnDefaultChecked = true;
|
9149 |
-
}
|
9150 |
-
|
9151 |
-
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
|
9152 |
-
error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
|
9153 |
-
|
9154 |
-
didWarnDefaultInputValue = true;
|
9155 |
-
}
|
9156 |
-
}
|
9157 |
-
|
9158 |
-
props = _assign({
|
9159 |
-
type: undefined
|
9160 |
-
}, props, {
|
9161 |
-
defaultChecked: undefined,
|
9162 |
-
defaultValue: undefined,
|
9163 |
-
value: props.value != null ? props.value : props.defaultValue,
|
9164 |
-
checked: props.checked != null ? props.checked : props.defaultChecked
|
9165 |
-
});
|
9166 |
-
} else if (tag === 'textarea') {
|
9167 |
-
{
|
9168 |
-
checkControlledValueProps('textarea', props);
|
9169 |
-
|
9170 |
-
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
|
9171 |
-
error('Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
|
9172 |
-
|
9173 |
-
didWarnDefaultTextareaValue = true;
|
9174 |
-
}
|
9175 |
-
}
|
9176 |
-
|
9177 |
-
var initialValue = props.value;
|
9178 |
-
|
9179 |
-
if (initialValue == null) {
|
9180 |
-
var defaultValue = props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>.
|
9181 |
-
|
9182 |
-
var textareaChildren = props.children;
|
9183 |
-
|
9184 |
-
if (textareaChildren != null) {
|
9185 |
-
{
|
9186 |
-
error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
9187 |
-
}
|
9188 |
-
|
9189 |
-
if (!(defaultValue == null)) {
|
9190 |
-
{
|
9191 |
-
throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." );
|
9192 |
-
}
|
9193 |
-
}
|
9194 |
-
|
9195 |
-
if (Array.isArray(textareaChildren)) {
|
9196 |
-
if (!(textareaChildren.length <= 1)) {
|
9197 |
-
{
|
9198 |
-
throw Error( "<textarea> can only have at most one child." );
|
9199 |
-
}
|
9200 |
-
}
|
9201 |
-
|
9202 |
-
textareaChildren = textareaChildren[0];
|
9203 |
-
}
|
9204 |
-
|
9205 |
-
defaultValue = '' + textareaChildren;
|
9206 |
-
}
|
9207 |
-
|
9208 |
-
if (defaultValue == null) {
|
9209 |
-
defaultValue = '';
|
9210 |
-
}
|
9211 |
-
|
9212 |
-
initialValue = defaultValue;
|
9213 |
-
}
|
9214 |
-
|
9215 |
-
props = _assign({}, props, {
|
9216 |
-
value: undefined,
|
9217 |
-
children: '' + initialValue
|
9218 |
-
});
|
9219 |
-
} else if (tag === 'select') {
|
9220 |
-
{
|
9221 |
-
checkControlledValueProps('select', props);
|
9222 |
-
|
9223 |
-
for (var i = 0; i < valuePropNames.length; i++) {
|
9224 |
-
var propName = valuePropNames[i];
|
9225 |
-
|
9226 |
-
if (props[propName] == null) {
|
9227 |
-
continue;
|
9228 |
-
}
|
9229 |
-
|
9230 |
-
var isArray = Array.isArray(props[propName]);
|
9231 |
-
|
9232 |
-
if (props.multiple && !isArray) {
|
9233 |
-
error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
|
9234 |
-
} else if (!props.multiple && isArray) {
|
9235 |
-
error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
|
9236 |
-
}
|
9237 |
-
}
|
9238 |
-
|
9239 |
-
if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
|
9240 |
-
error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
|
9241 |
-
|
9242 |
-
didWarnDefaultSelectValue = true;
|
9243 |
-
}
|
9244 |
-
}
|
9245 |
-
|
9246 |
-
this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
|
9247 |
-
props = _assign({}, props, {
|
9248 |
-
value: undefined
|
9249 |
-
});
|
9250 |
-
} else if (tag === 'option') {
|
9251 |
-
var selected = null;
|
9252 |
-
var selectValue = this.currentSelectValue;
|
9253 |
-
var optionChildren = flattenOptionChildren(props.children);
|
9254 |
-
|
9255 |
-
if (selectValue != null) {
|
9256 |
-
var value;
|
9257 |
-
|
9258 |
-
if (props.value != null) {
|
9259 |
-
value = props.value + '';
|
9260 |
-
} else {
|
9261 |
-
value = optionChildren;
|
9262 |
-
}
|
9263 |
-
|
9264 |
-
selected = false;
|
9265 |
-
|
9266 |
-
if (Array.isArray(selectValue)) {
|
9267 |
-
// multiple
|
9268 |
-
for (var j = 0; j < selectValue.length; j++) {
|
9269 |
-
if ('' + selectValue[j] === value) {
|
9270 |
-
selected = true;
|
9271 |
-
break;
|
9272 |
-
}
|
9273 |
-
}
|
9274 |
-
} else {
|
9275 |
-
selected = '' + selectValue === value;
|
9276 |
-
}
|
9277 |
-
|
9278 |
-
props = _assign({
|
9279 |
-
selected: undefined,
|
9280 |
-
children: undefined
|
9281 |
-
}, props, {
|
9282 |
-
selected: selected,
|
9283 |
-
children: optionChildren
|
9284 |
-
});
|
9285 |
-
}
|
9286 |
-
}
|
9287 |
-
|
9288 |
-
{
|
9289 |
-
validatePropertiesInDevelopment(tag, props);
|
9290 |
-
}
|
9291 |
-
|
9292 |
-
assertValidProps(tag, props);
|
9293 |
-
var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
|
9294 |
-
var footer = '';
|
9295 |
-
|
9296 |
-
if (omittedCloseTags.hasOwnProperty(tag)) {
|
9297 |
-
out += '/>';
|
9298 |
-
} else {
|
9299 |
-
out += '>';
|
9300 |
-
footer = '</' + element.type + '>';
|
9301 |
-
}
|
9302 |
-
|
9303 |
-
var children;
|
9304 |
-
var innerMarkup = getNonChildrenInnerMarkup(props);
|
9305 |
-
|
9306 |
-
if (innerMarkup != null) {
|
9307 |
-
children = [];
|
9308 |
-
|
9309 |
-
if (newlineEatingTags.hasOwnProperty(tag) && innerMarkup.charAt(0) === '\n') {
|
9310 |
-
// text/html ignores the first character in these tags if it's a newline
|
9311 |
-
// Prefer to break application/xml over text/html (for now) by adding
|
9312 |
-
// a newline specifically to get eaten by the parser. (Alternately for
|
9313 |
-
// textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
|
9314 |
-
// \r is normalized out by HTMLTextAreaElement#value.)
|
9315 |
-
// See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
|
9316 |
-
// See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
|
9317 |
-
// See: <http://www.w3.org/TR/html5/syntax.html#newlines>
|
9318 |
-
// See: Parsing of "textarea" "listing" and "pre" elements
|
9319 |
-
// from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
|
9320 |
-
out += '\n';
|
9321 |
-
}
|
9322 |
-
|
9323 |
-
out += innerMarkup;
|
9324 |
-
} else {
|
9325 |
-
children = toArray(props.children);
|
9326 |
-
}
|
9327 |
-
|
9328 |
-
var frame = {
|
9329 |
-
domNamespace: getChildNamespace(parentNamespace, element.type),
|
9330 |
-
type: tag,
|
9331 |
-
children: children,
|
9332 |
-
childIndex: 0,
|
9333 |
-
context: context,
|
9334 |
-
footer: footer
|
9335 |
-
};
|
9336 |
-
|
9337 |
-
{
|
9338 |
-
frame.debugElementStack = [];
|
9339 |
-
}
|
9340 |
-
|
9341 |
-
this.stack.push(frame);
|
9342 |
-
this.previousWasTextNode = false;
|
9343 |
-
return out;
|
9344 |
-
};
|
9345 |
-
|
9346 |
-
return ReactDOMServerRenderer;
|
9347 |
-
}();
|
9348 |
-
|
9349 |
-
/**
|
9350 |
-
* Render a ReactElement to its initial HTML. This should only be used on the
|
9351 |
-
* server.
|
9352 |
-
* See https://reactjs.org/docs/react-dom-server.html#rendertostring
|
9353 |
-
*/
|
9354 |
-
|
9355 |
-
function renderToString(element, options) {
|
9356 |
-
var renderer = new ReactDOMServerRenderer(element, false, options);
|
9357 |
-
|
9358 |
-
try {
|
9359 |
-
var markup = renderer.read(Infinity);
|
9360 |
-
return markup;
|
9361 |
-
} finally {
|
9362 |
-
renderer.destroy();
|
9363 |
-
}
|
9364 |
-
}
|
9365 |
-
/**
|
9366 |
-
* Similar to renderToString, except this doesn't create extra DOM attributes
|
9367 |
-
* such as data-react-id that React uses internally.
|
9368 |
-
* See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
|
9369 |
-
*/
|
9370 |
-
|
9371 |
-
function renderToStaticMarkup(element, options) {
|
9372 |
-
var renderer = new ReactDOMServerRenderer(element, true, options);
|
9373 |
-
|
9374 |
-
try {
|
9375 |
-
var markup = renderer.read(Infinity);
|
9376 |
-
return markup;
|
9377 |
-
} finally {
|
9378 |
-
renderer.destroy();
|
9379 |
-
}
|
9380 |
-
}
|
9381 |
-
|
9382 |
-
function renderToNodeStream() {
|
9383 |
-
{
|
9384 |
-
{
|
9385 |
-
throw Error( "ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead." );
|
9386 |
-
}
|
9387 |
-
}
|
9388 |
-
}
|
9389 |
-
|
9390 |
-
function renderToStaticNodeStream() {
|
9391 |
-
{
|
9392 |
-
{
|
9393 |
-
throw Error( "ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead." );
|
9394 |
-
}
|
9395 |
-
}
|
9396 |
-
}
|
9397 |
-
|
9398 |
-
exports.renderToNodeStream = renderToNodeStream;
|
9399 |
-
exports.renderToStaticMarkup = renderToStaticMarkup;
|
9400 |
-
exports.renderToStaticNodeStream = renderToStaticNodeStream;
|
9401 |
-
exports.renderToString = renderToString;
|
9402 |
-
exports.version = ReactVersion;
|
9403 |
-
})();
|
9404 |
-
}
|
9405 |
-
|
9406 |
-
|
9407 |
-
/***/ }),
|
9408 |
-
|
9409 |
-
/***/ "./node_modules/react-dom/cjs/react-dom.development.js":
|
9410 |
-
/*!*************************************************************!*\
|
9411 |
-
!*** ./node_modules/react-dom/cjs/react-dom.development.js ***!
|
9412 |
-
\*************************************************************/
|
9413 |
-
/*! no static exports found */
|
9414 |
-
/***/ (function(module, exports, __webpack_require__) {
|
9415 |
-
|
9416 |
-
"use strict";
|
9417 |
-
/** @license React v17.0.2
|
9418 |
-
* react-dom.development.js
|
9419 |
-
*
|
9420 |
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
9421 |
-
*
|
9422 |
-
* This source code is licensed under the MIT license found in the
|
9423 |
-
* LICENSE file in the root directory of this source tree.
|
9424 |
-
*/
|
9425 |
-
|
9426 |
-
|
9427 |
-
|
9428 |
-
if (true) {
|
9429 |
-
(function() {
|
9430 |
-
'use strict';
|
9431 |
-
|
9432 |
-
var React = __webpack_require__(/*! react */ "./node_modules/react/index.js");
|
9433 |
-
var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
|
9434 |
-
var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js");
|
9435 |
-
var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js");
|
9436 |
-
|
9437 |
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
9438 |
-
|
9439 |
-
// by calls to these methods by a Babel plugin.
|
9440 |
-
//
|
9441 |
-
// In PROD (or in packages without access to React internals),
|
9442 |
-
// they are left as they are instead.
|
9443 |
-
|
9444 |
-
function warn(format) {
|
9445 |
-
{
|
9446 |
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
9447 |
-
args[_key - 1] = arguments[_key];
|
9448 |
-
}
|
9449 |
-
|
9450 |
-
printWarning('warn', format, args);
|
9451 |
-
}
|
9452 |
-
}
|
9453 |
-
function error(format) {
|
9454 |
-
{
|
9455 |
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
9456 |
-
args[_key2 - 1] = arguments[_key2];
|
9457 |
-
}
|
9458 |
-
|
9459 |
-
printWarning('error', format, args);
|
9460 |
-
}
|
9461 |
-
}
|
9462 |
-
|
9463 |
-
function printWarning(level, format, args) {
|
9464 |
-
// When changing this logic, you might want to also
|
9465 |
-
// update consoleWithStackDev.www.js as well.
|
9466 |
-
{
|
9467 |
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
9468 |
-
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
9469 |
-
|
9470 |
-
if (stack !== '') {
|
9471 |
-
format += '%s';
|
9472 |
-
args = args.concat([stack]);
|
9473 |
-
}
|
9474 |
-
|
9475 |
-
var argsWithFormat = args.map(function (item) {
|
9476 |
-
return '' + item;
|
9477 |
-
}); // Careful: RN currently depends on this prefix
|
9478 |
-
|
9479 |
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
9480 |
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
9481 |
-
// eslint-disable-next-line react-internal/no-production-logging
|
9482 |
-
|
9483 |
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
9484 |
-
}
|
9485 |
-
}
|
9486 |
-
|
9487 |
-
if (!React) {
|
9488 |
-
{
|
9489 |
-
throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." );
|
9490 |
-
}
|
9491 |
-
}
|
9492 |
-
|
9493 |
-
var FunctionComponent = 0;
|
9494 |
-
var ClassComponent = 1;
|
9495 |
-
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
9496 |
-
|
9497 |
-
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
|
9498 |
-
|
9499 |
-
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
|
9500 |
-
|
9501 |
-
var HostComponent = 5;
|
9502 |
-
var HostText = 6;
|
9503 |
-
var Fragment = 7;
|
9504 |
-
var Mode = 8;
|
9505 |
-
var ContextConsumer = 9;
|
9506 |
-
var ContextProvider = 10;
|
9507 |
-
var ForwardRef = 11;
|
9508 |
-
var Profiler = 12;
|
9509 |
-
var SuspenseComponent = 13;
|
9510 |
-
var MemoComponent = 14;
|
9511 |
-
var SimpleMemoComponent = 15;
|
9512 |
-
var LazyComponent = 16;
|
9513 |
-
var IncompleteClassComponent = 17;
|
9514 |
-
var DehydratedFragment = 18;
|
9515 |
-
var SuspenseListComponent = 19;
|
9516 |
-
var FundamentalComponent = 20;
|
9517 |
-
var ScopeComponent = 21;
|
9518 |
-
var Block = 22;
|
9519 |
-
var OffscreenComponent = 23;
|
9520 |
-
var LegacyHiddenComponent = 24;
|
9521 |
-
|
9522 |
-
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
9523 |
-
|
9524 |
-
var enableProfilerTimer = true; // Record durations for commit and passive effects phases.
|
9525 |
-
|
9526 |
-
var enableFundamentalAPI = false; // Experimental Scope support.
|
9527 |
-
var enableNewReconciler = false; // Errors that are thrown while unmounting (or after in the case of passive effects)
|
9528 |
-
var warnAboutStringRefs = false;
|
9529 |
-
|
9530 |
-
var allNativeEvents = new Set();
|
9531 |
-
/**
|
9532 |
-
* Mapping from registration name to event name
|
9533 |
-
*/
|
9534 |
-
|
9535 |
-
|
9536 |
-
var registrationNameDependencies = {};
|
9537 |
-
/**
|
9538 |
-
* Mapping from lowercase registration names to the properly cased version,
|
9539 |
-
* used to warn in the case of missing event handlers. Available
|
9540 |
-
* only in true.
|
9541 |
-
* @type {Object}
|
9542 |
-
*/
|
9543 |
-
|
9544 |
-
var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true
|
9545 |
-
|
9546 |
-
function registerTwoPhaseEvent(registrationName, dependencies) {
|
9547 |
-
registerDirectEvent(registrationName, dependencies);
|
9548 |
-
registerDirectEvent(registrationName + 'Capture', dependencies);
|
9549 |
-
}
|
9550 |
-
function registerDirectEvent(registrationName, dependencies) {
|
9551 |
-
{
|
9552 |
-
if (registrationNameDependencies[registrationName]) {
|
9553 |
-
error('EventRegistry: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName);
|
9554 |
-
}
|
9555 |
-
}
|
9556 |
-
|
9557 |
-
registrationNameDependencies[registrationName] = dependencies;
|
9558 |
-
|
9559 |
-
{
|
9560 |
-
var lowerCasedName = registrationName.toLowerCase();
|
9561 |
-
possibleRegistrationNames[lowerCasedName] = registrationName;
|
9562 |
-
|
9563 |
-
if (registrationName === 'onDoubleClick') {
|
9564 |
-
possibleRegistrationNames.ondblclick = registrationName;
|
9565 |
-
}
|
9566 |
-
}
|
9567 |
-
|
9568 |
-
for (var i = 0; i < dependencies.length; i++) {
|
9569 |
-
allNativeEvents.add(dependencies[i]);
|
9570 |
-
}
|
9571 |
-
}
|
9572 |
-
|
9573 |
-
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
9574 |
-
|
9575 |
-
// A reserved attribute.
|
9576 |
-
// It is handled by React separately and shouldn't be written to the DOM.
|
9577 |
-
var RESERVED = 0; // A simple string attribute.
|
9578 |
-
// Attributes that aren't in the filter are presumed to have this type.
|
9579 |
-
|
9580 |
-
var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
|
9581 |
-
// "enumerated" attributes with "true" and "false" as possible values.
|
9582 |
-
// When true, it should be set to a "true" string.
|
9583 |
-
// When false, it should be set to a "false" string.
|
9584 |
-
|
9585 |
-
var BOOLEANISH_STRING = 2; // A real boolean attribute.
|
9586 |
-
// When true, it should be present (set either to an empty string or its name).
|
9587 |
-
// When false, it should be omitted.
|
9588 |
-
|
9589 |
-
var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
|
9590 |
-
// When true, it should be present (set either to an empty string or its name).
|
9591 |
-
// When false, it should be omitted.
|
9592 |
-
// For any other value, should be present with that value.
|
9593 |
-
|
9594 |
-
var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
|
9595 |
-
// When falsy, it should be removed.
|
9596 |
-
|
9597 |
-
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
|
9598 |
-
// When falsy, it should be removed.
|
9599 |
-
|
9600 |
-
var POSITIVE_NUMERIC = 6;
|
9601 |
-
|
9602 |
-
/* eslint-disable max-len */
|
9603 |
-
var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
9604 |
-
/* eslint-enable max-len */
|
9605 |
-
|
9606 |
-
var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
9607 |
-
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
9608 |
-
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
9609 |
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
9610 |
-
var illegalAttributeNameCache = {};
|
9611 |
-
var validatedAttributeNameCache = {};
|
9612 |
-
function isAttributeNameSafe(attributeName) {
|
9613 |
-
if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
|
9614 |
-
return true;
|
9615 |
-
}
|
9616 |
-
|
9617 |
-
if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
|
9618 |
-
return false;
|
9619 |
-
}
|
9620 |
-
|
9621 |
-
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
9622 |
-
validatedAttributeNameCache[attributeName] = true;
|
9623 |
-
return true;
|
9624 |
-
}
|
9625 |
-
|
9626 |
-
illegalAttributeNameCache[attributeName] = true;
|
9627 |
-
|
9628 |
-
{
|
9629 |
-
error('Invalid attribute name: `%s`', attributeName);
|
9630 |
-
}
|
9631 |
-
|
9632 |
-
return false;
|
9633 |
-
}
|
9634 |
-
function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
|
9635 |
-
if (propertyInfo !== null) {
|
9636 |
-
return propertyInfo.type === RESERVED;
|
9637 |
-
}
|
9638 |
-
|
9639 |
-
if (isCustomComponentTag) {
|
9640 |
-
return false;
|
9641 |
-
}
|
9642 |
-
|
9643 |
-
if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
|
9644 |
-
return true;
|
9645 |
-
}
|
9646 |
-
|
9647 |
-
return false;
|
9648 |
-
}
|
9649 |
-
function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
9650 |
-
if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
9651 |
-
return false;
|
9652 |
-
}
|
9653 |
-
|
9654 |
-
switch (typeof value) {
|
9655 |
-
case 'function': // $FlowIssue symbol is perfectly valid here
|
9656 |
-
|
9657 |
-
case 'symbol':
|
9658 |
-
// eslint-disable-line
|
9659 |
-
return true;
|
9660 |
-
|
9661 |
-
case 'boolean':
|
9662 |
-
{
|
9663 |
-
if (isCustomComponentTag) {
|
9664 |
-
return false;
|
9665 |
-
}
|
9666 |
-
|
9667 |
-
if (propertyInfo !== null) {
|
9668 |
-
return !propertyInfo.acceptsBooleans;
|
9669 |
-
} else {
|
9670 |
-
var prefix = name.toLowerCase().slice(0, 5);
|
9671 |
-
return prefix !== 'data-' && prefix !== 'aria-';
|
9672 |
-
}
|
9673 |
-
}
|
9674 |
-
|
9675 |
-
default:
|
9676 |
-
return false;
|
9677 |
-
}
|
9678 |
-
}
|
9679 |
-
function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
|
9680 |
-
if (value === null || typeof value === 'undefined') {
|
9681 |
-
return true;
|
9682 |
-
}
|
9683 |
-
|
9684 |
-
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
9685 |
-
return true;
|
9686 |
-
}
|
9687 |
-
|
9688 |
-
if (isCustomComponentTag) {
|
9689 |
-
return false;
|
9690 |
-
}
|
9691 |
-
|
9692 |
-
if (propertyInfo !== null) {
|
9693 |
-
|
9694 |
-
switch (propertyInfo.type) {
|
9695 |
-
case BOOLEAN:
|
9696 |
-
return !value;
|
9697 |
-
|
9698 |
-
case OVERLOADED_BOOLEAN:
|
9699 |
-
return value === false;
|
9700 |
-
|
9701 |
-
case NUMERIC:
|
9702 |
-
return isNaN(value);
|
9703 |
-
|
9704 |
-
case POSITIVE_NUMERIC:
|
9705 |
-
return isNaN(value) || value < 1;
|
9706 |
-
}
|
9707 |
-
}
|
9708 |
-
|
9709 |
-
return false;
|
9710 |
-
}
|
9711 |
-
function getPropertyInfo(name) {
|
9712 |
-
return properties.hasOwnProperty(name) ? properties[name] : null;
|
9713 |
-
}
|
9714 |
-
|
9715 |
-
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
|
9716 |
-
this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
9717 |
-
this.attributeName = attributeName;
|
9718 |
-
this.attributeNamespace = attributeNamespace;
|
9719 |
-
this.mustUseProperty = mustUseProperty;
|
9720 |
-
this.propertyName = name;
|
9721 |
-
this.type = type;
|
9722 |
-
this.sanitizeURL = sanitizeURL;
|
9723 |
-
this.removeEmptyString = removeEmptyString;
|
9724 |
-
} // When adding attributes to this list, be sure to also add them to
|
9725 |
-
// the `possibleStandardNames` module to ensure casing and incorrect
|
9726 |
-
// name warnings.
|
9727 |
-
|
9728 |
-
|
9729 |
-
var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
|
9730 |
-
|
9731 |
-
var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
|
9732 |
-
// elements (not just inputs). Now that ReactDOMInput assigns to the
|
9733 |
-
// defaultValue property -- do we need this?
|
9734 |
-
'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
|
9735 |
-
reservedProps.forEach(function (name) {
|
9736 |
-
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
9737 |
-
name, // attributeName
|
9738 |
-
null, // attributeNamespace
|
9739 |
-
false, // sanitizeURL
|
9740 |
-
false);
|
9741 |
-
}); // A few React string attributes have a different name.
|
9742 |
-
// This is a mapping from React prop names to the attribute names.
|
9743 |
-
|
9744 |
-
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
9745 |
-
var name = _ref[0],
|
9746 |
-
attributeName = _ref[1];
|
9747 |
-
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
9748 |
-
attributeName, // attributeName
|
9749 |
-
null, // attributeNamespace
|
9750 |
-
false, // sanitizeURL
|
9751 |
-
false);
|
9752 |
-
}); // These are "enumerated" HTML attributes that accept "true" and "false".
|
9753 |
-
// In React, we let users pass `true` and `false` even though technically
|
9754 |
-
// these aren't boolean attributes (they are coerced to strings).
|
9755 |
-
|
9756 |
-
['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
9757 |
-
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
9758 |
-
name.toLowerCase(), // attributeName
|
9759 |
-
null, // attributeNamespace
|
9760 |
-
false, // sanitizeURL
|
9761 |
-
false);
|
9762 |
-
}); // These are "enumerated" SVG attributes that accept "true" and "false".
|
9763 |
-
// In React, we let users pass `true` and `false` even though technically
|
9764 |
-
// these aren't boolean attributes (they are coerced to strings).
|
9765 |
-
// Since these are SVG attributes, their attribute names are case-sensitive.
|
9766 |
-
|
9767 |
-
['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
9768 |
-
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
9769 |
-
name, // attributeName
|
9770 |
-
null, // attributeNamespace
|
9771 |
-
false, // sanitizeURL
|
9772 |
-
false);
|
9773 |
-
}); // These are HTML boolean attributes.
|
9774 |
-
|
9775 |
-
['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
|
9776 |
-
// on the client side because the browsers are inconsistent. Instead we call focus().
|
9777 |
-
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
|
9778 |
-
'itemScope'].forEach(function (name) {
|
9779 |
-
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
9780 |
-
name.toLowerCase(), // attributeName
|
9781 |
-
null, // attributeNamespace
|
9782 |
-
false, // sanitizeURL
|
9783 |
-
false);
|
9784 |
-
}); // These are the few React props that we set as DOM properties
|
9785 |
-
// rather than attributes. These are all booleans.
|
9786 |
-
|
9787 |
-
['checked', // Note: `option.selected` is not updated if `select.multiple` is
|
9788 |
-
// disabled with `removeAttribute`. We have special logic for handling this.
|
9789 |
-
'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
|
9790 |
-
// you'll need to set attributeName to name.toLowerCase()
|
9791 |
-
// instead in the assignment below.
|
9792 |
-
].forEach(function (name) {
|
9793 |
-
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
9794 |
-
name, // attributeName
|
9795 |
-
null, // attributeNamespace
|
9796 |
-
false, // sanitizeURL
|
9797 |
-
false);
|
9798 |
-
}); // These are HTML attributes that are "overloaded booleans": they behave like
|
9799 |
-
// booleans, but can also accept a string value.
|
9800 |
-
|
9801 |
-
['capture', 'download' // NOTE: if you add a camelCased prop to this list,
|
9802 |
-
// you'll need to set attributeName to name.toLowerCase()
|
9803 |
-
// instead in the assignment below.
|
9804 |
-
].forEach(function (name) {
|
9805 |
-
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
9806 |
-
name, // attributeName
|
9807 |
-
null, // attributeNamespace
|
9808 |
-
false, // sanitizeURL
|
9809 |
-
false);
|
9810 |
-
}); // These are HTML attributes that must be positive numbers.
|
9811 |
-
|
9812 |
-
['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
|
9813 |
-
// you'll need to set attributeName to name.toLowerCase()
|
9814 |
-
// instead in the assignment below.
|
9815 |
-
].forEach(function (name) {
|
9816 |
-
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
9817 |
-
name, // attributeName
|
9818 |
-
null, // attributeNamespace
|
9819 |
-
false, // sanitizeURL
|
9820 |
-
false);
|
9821 |
-
}); // These are HTML attributes that must be numbers.
|
9822 |
-
|
9823 |
-
['rowSpan', 'start'].forEach(function (name) {
|
9824 |
-
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
9825 |
-
name.toLowerCase(), // attributeName
|
9826 |
-
null, // attributeNamespace
|
9827 |
-
false, // sanitizeURL
|
9828 |
-
false);
|
9829 |
-
});
|
9830 |
-
var CAMELIZE = /[\-\:]([a-z])/g;
|
9831 |
-
|
9832 |
-
var capitalize = function (token) {
|
9833 |
-
return token[1].toUpperCase();
|
9834 |
-
}; // This is a list of all SVG attributes that need special casing, namespacing,
|
9835 |
-
// or boolean value assignment. Regular attributes that just accept strings
|
9836 |
-
// and have the same names are omitted, just like in the HTML attribute filter.
|
9837 |
-
// Some of these attributes can be hard to find. This list was created by
|
9838 |
-
// scraping the MDN documentation.
|
9839 |
-
|
9840 |
-
|
9841 |
-
['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
|
9842 |
-
// you'll need to set attributeName to name.toLowerCase()
|
9843 |
-
// instead in the assignment below.
|
9844 |
-
].forEach(function (attributeName) {
|
9845 |
-
var name = attributeName.replace(CAMELIZE, capitalize);
|
9846 |
-
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
9847 |
-
attributeName, null, // attributeNamespace
|
9848 |
-
false, // sanitizeURL
|
9849 |
-
false);
|
9850 |
-
}); // String SVG attributes with the xlink namespace.
|
9851 |
-
|
9852 |
-
['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
|
9853 |
-
// you'll need to set attributeName to name.toLowerCase()
|
9854 |
-
// instead in the assignment below.
|
9855 |
-
].forEach(function (attributeName) {
|
9856 |
-
var name = attributeName.replace(CAMELIZE, capitalize);
|
9857 |
-
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
9858 |
-
attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL
|
9859 |
-
false);
|
9860 |
-
}); // String SVG attributes with the xml namespace.
|
9861 |
-
|
9862 |
-
['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
|
9863 |
-
// you'll need to set attributeName to name.toLowerCase()
|
9864 |
-
// instead in the assignment below.
|
9865 |
-
].forEach(function (attributeName) {
|
9866 |
-
var name = attributeName.replace(CAMELIZE, capitalize);
|
9867 |
-
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
9868 |
-
attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL
|
9869 |
-
false);
|
9870 |
-
}); // These attribute exists both in HTML and SVG.
|
9871 |
-
// The attribute name is case-sensitive in SVG so we can't just use
|
9872 |
-
// the React name like we do for attributes that exist only in HTML.
|
9873 |
-
|
9874 |
-
['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
9875 |
-
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
9876 |
-
attributeName.toLowerCase(), // attributeName
|
9877 |
-
null, // attributeNamespace
|
9878 |
-
false, // sanitizeURL
|
9879 |
-
false);
|
9880 |
-
}); // These attributes accept URLs. These must not allow javascript: URLS.
|
9881 |
-
// These will also need to accept Trusted Types object in the future.
|
9882 |
-
|
9883 |
-
var xlinkHref = 'xlinkHref';
|
9884 |
-
properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
|
9885 |
-
'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL
|
9886 |
-
false);
|
9887 |
-
['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
|
9888 |
-
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
9889 |
-
attributeName.toLowerCase(), // attributeName
|
9890 |
-
null, // attributeNamespace
|
9891 |
-
true, // sanitizeURL
|
9892 |
-
true);
|
9893 |
-
});
|
9894 |
-
|
9895 |
-
// and any newline or tab are filtered out as if they're not part of the URL.
|
9896 |
-
// https://url.spec.whatwg.org/#url-parsing
|
9897 |
-
// Tab or newline are defined as \r\n\t:
|
9898 |
-
// https://infra.spec.whatwg.org/#ascii-tab-or-newline
|
9899 |
-
// A C0 control is a code point in the range \u0000 NULL to \u001F
|
9900 |
-
// INFORMATION SEPARATOR ONE, inclusive:
|
9901 |
-
// https://infra.spec.whatwg.org/#c0-control-or-space
|
9902 |
-
|
9903 |
-
/* eslint-disable max-len */
|
9904 |
-
|
9905 |
-
var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
9906 |
-
var didWarn = false;
|
9907 |
-
|
9908 |
-
function sanitizeURL(url) {
|
9909 |
-
{
|
9910 |
-
if (!didWarn && isJavaScriptProtocol.test(url)) {
|
9911 |
-
didWarn = true;
|
9912 |
-
|
9913 |
-
error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
|
9914 |
-
}
|
9915 |
-
}
|
9916 |
-
}
|
9917 |
-
|
9918 |
-
/**
|
9919 |
-
* Get the value for a property on a node. Only used in DEV for SSR validation.
|
9920 |
-
* The "expected" argument is used as a hint of what the expected value is.
|
9921 |
-
* Some properties have multiple equivalent values.
|
9922 |
-
*/
|
9923 |
-
function getValueForProperty(node, name, expected, propertyInfo) {
|
9924 |
-
{
|
9925 |
-
if (propertyInfo.mustUseProperty) {
|
9926 |
-
var propertyName = propertyInfo.propertyName;
|
9927 |
-
return node[propertyName];
|
9928 |
-
} else {
|
9929 |
-
if ( propertyInfo.sanitizeURL) {
|
9930 |
-
// If we haven't fully disabled javascript: URLs, and if
|
9931 |
-
// the hydration is successful of a javascript: URL, we
|
9932 |
-
// still want to warn on the client.
|
9933 |
-
sanitizeURL('' + expected);
|
9934 |
-
}
|
9935 |
-
|
9936 |
-
var attributeName = propertyInfo.attributeName;
|
9937 |
-
var stringValue = null;
|
9938 |
-
|
9939 |
-
if (propertyInfo.type === OVERLOADED_BOOLEAN) {
|
9940 |
-
if (node.hasAttribute(attributeName)) {
|
9941 |
-
var value = node.getAttribute(attributeName);
|
9942 |
-
|
9943 |
-
if (value === '') {
|
9944 |
-
return true;
|
9945 |
-
}
|
9946 |
-
|
9947 |
-
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
9948 |
-
return value;
|
9949 |
-
}
|
9950 |
-
|
9951 |
-
if (value === '' + expected) {
|
9952 |
-
return expected;
|
9953 |
-
}
|
9954 |
-
|
9955 |
-
return value;
|
9956 |
-
}
|
9957 |
-
} else if (node.hasAttribute(attributeName)) {
|
9958 |
-
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
9959 |
-
// We had an attribute but shouldn't have had one, so read it
|
9960 |
-
// for the error message.
|
9961 |
-
return node.getAttribute(attributeName);
|
9962 |
-
}
|
9963 |
-
|
9964 |
-
if (propertyInfo.type === BOOLEAN) {
|
9965 |
-
// If this was a boolean, it doesn't matter what the value is
|
9966 |
-
// the fact that we have it is the same as the expected.
|
9967 |
-
return expected;
|
9968 |
-
} // Even if this property uses a namespace we use getAttribute
|
9969 |
-
// because we assume its namespaced name is the same as our config.
|
9970 |
-
// To use getAttributeNS we need the local name which we don't have
|
9971 |
-
// in our config atm.
|
9972 |
-
|
9973 |
-
|
9974 |
-
stringValue = node.getAttribute(attributeName);
|
9975 |
-
}
|
9976 |
-
|
9977 |
-
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
9978 |
-
return stringValue === null ? expected : stringValue;
|
9979 |
-
} else if (stringValue === '' + expected) {
|
9980 |
-
return expected;
|
9981 |
-
} else {
|
9982 |
-
return stringValue;
|
9983 |
-
}
|
9984 |
-
}
|
9985 |
-
}
|
9986 |
-
}
|
9987 |
-
/**
|
9988 |
-
* Get the value for a attribute on a node. Only used in DEV for SSR validation.
|
9989 |
-
* The third argument is used as a hint of what the expected value is. Some
|
9990 |
-
* attributes have multiple equivalent values.
|
9991 |
-
*/
|
9992 |
-
|
9993 |
-
function getValueForAttribute(node, name, expected) {
|
9994 |
-
{
|
9995 |
-
if (!isAttributeNameSafe(name)) {
|
9996 |
-
return;
|
9997 |
-
} // If the object is an opaque reference ID, it's expected that
|
9998 |
-
// the next prop is different than the server value, so just return
|
9999 |
-
// expected
|
10000 |
-
|
10001 |
-
|
10002 |
-
if (isOpaqueHydratingObject(expected)) {
|
10003 |
-
return expected;
|
10004 |
-
}
|
10005 |
-
|
10006 |
-
if (!node.hasAttribute(name)) {
|
10007 |
-
return expected === undefined ? undefined : null;
|
10008 |
-
}
|
10009 |
-
|
10010 |
-
var value = node.getAttribute(name);
|
10011 |
-
|
10012 |
-
if (value === '' + expected) {
|
10013 |
-
return expected;
|
10014 |
-
}
|
10015 |
-
|
10016 |
-
return value;
|
10017 |
-
}
|
10018 |
-
}
|
10019 |
-
/**
|
10020 |
-
* Sets the value for a property on a node.
|
10021 |
-
*
|
10022 |
-
* @param {DOMElement} node
|
10023 |
-
* @param {string} name
|
10024 |
-
* @param {*} value
|
10025 |
-
*/
|
10026 |
-
|
10027 |
-
function setValueForProperty(node, name, value, isCustomComponentTag) {
|
10028 |
-
var propertyInfo = getPropertyInfo(name);
|
10029 |
-
|
10030 |
-
if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
|
10031 |
-
return;
|
10032 |
-
}
|
10033 |
-
|
10034 |
-
if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
|
10035 |
-
value = null;
|
10036 |
-
} // If the prop isn't in the special list, treat it as a simple attribute.
|
10037 |
-
|
10038 |
-
|
10039 |
-
if (isCustomComponentTag || propertyInfo === null) {
|
10040 |
-
if (isAttributeNameSafe(name)) {
|
10041 |
-
var _attributeName = name;
|
10042 |
-
|
10043 |
-
if (value === null) {
|
10044 |
-
node.removeAttribute(_attributeName);
|
10045 |
-
} else {
|
10046 |
-
node.setAttribute(_attributeName, '' + value);
|
10047 |
-
}
|
10048 |
-
}
|
10049 |
-
|
10050 |
-
return;
|
10051 |
-
}
|
10052 |
-
|
10053 |
-
var mustUseProperty = propertyInfo.mustUseProperty;
|
10054 |
-
|
10055 |
-
if (mustUseProperty) {
|
10056 |
-
var propertyName = propertyInfo.propertyName;
|
10057 |
-
|
10058 |
-
if (value === null) {
|
10059 |
-
var type = propertyInfo.type;
|
10060 |
-
node[propertyName] = type === BOOLEAN ? false : '';
|
10061 |
-
} else {
|
10062 |
-
// Contrary to `setAttribute`, object properties are properly
|
10063 |
-
// `toString`ed by IE8/9.
|
10064 |
-
node[propertyName] = value;
|
10065 |
-
}
|
10066 |
-
|
10067 |
-
return;
|
10068 |
-
} // The rest are treated as attributes with special cases.
|
10069 |
-
|
10070 |
-
|
10071 |
-
var attributeName = propertyInfo.attributeName,
|
10072 |
-
attributeNamespace = propertyInfo.attributeNamespace;
|
10073 |
-
|
10074 |
-
if (value === null) {
|
10075 |
-
node.removeAttribute(attributeName);
|
10076 |
-
} else {
|
10077 |
-
var _type = propertyInfo.type;
|
10078 |
-
var attributeValue;
|
10079 |
-
|
10080 |
-
if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
|
10081 |
-
// If attribute type is boolean, we know for sure it won't be an execution sink
|
10082 |
-
// and we won't require Trusted Type here.
|
10083 |
-
attributeValue = '';
|
10084 |
-
} else {
|
10085 |
-
// `setAttribute` with objects becomes only `[object]` in IE8/9,
|
10086 |
-
// ('' + value) makes it output the correct toString()-value.
|
10087 |
-
{
|
10088 |
-
attributeValue = '' + value;
|
10089 |
-
}
|
10090 |
-
|
10091 |
-
if (propertyInfo.sanitizeURL) {
|
10092 |
-
sanitizeURL(attributeValue.toString());
|
10093 |
-
}
|
10094 |
-
}
|
10095 |
-
|
10096 |
-
if (attributeNamespace) {
|
10097 |
-
node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
|
10098 |
-
} else {
|
10099 |
-
node.setAttribute(attributeName, attributeValue);
|
10100 |
-
}
|
10101 |
-
}
|
10102 |
-
}
|
10103 |
-
|
10104 |
-
// ATTENTION
|
10105 |
-
// When adding new symbols to this file,
|
10106 |
-
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
10107 |
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
10108 |
-
// nor polyfill, then a plain number is used for performance.
|
10109 |
-
var REACT_ELEMENT_TYPE = 0xeac7;
|
10110 |
-
var REACT_PORTAL_TYPE = 0xeaca;
|
10111 |
-
var REACT_FRAGMENT_TYPE = 0xeacb;
|
10112 |
-
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
10113 |
-
var REACT_PROFILER_TYPE = 0xead2;
|
10114 |
-
var REACT_PROVIDER_TYPE = 0xeacd;
|
10115 |
-
var REACT_CONTEXT_TYPE = 0xeace;
|
10116 |
-
var REACT_FORWARD_REF_TYPE = 0xead0;
|
10117 |
-
var REACT_SUSPENSE_TYPE = 0xead1;
|
10118 |
-
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
10119 |
-
var REACT_MEMO_TYPE = 0xead3;
|
10120 |
-
var REACT_LAZY_TYPE = 0xead4;
|
10121 |
-
var REACT_BLOCK_TYPE = 0xead9;
|
10122 |
-
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
10123 |
-
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
10124 |
-
var REACT_SCOPE_TYPE = 0xead7;
|
10125 |
-
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
10126 |
-
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
10127 |
-
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
10128 |
-
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
10129 |
-
|
10130 |
-
if (typeof Symbol === 'function' && Symbol.for) {
|
10131 |
-
var symbolFor = Symbol.for;
|
10132 |
-
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
10133 |
-
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
10134 |
-
REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
|
10135 |
-
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
10136 |
-
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
10137 |
-
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
10138 |
-
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
10139 |
-
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
10140 |
-
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
10141 |
-
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
10142 |
-
REACT_MEMO_TYPE = symbolFor('react.memo');
|
10143 |
-
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
10144 |
-
REACT_BLOCK_TYPE = symbolFor('react.block');
|
10145 |
-
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
10146 |
-
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
10147 |
-
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
10148 |
-
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
10149 |
-
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
10150 |
-
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
10151 |
-
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
10152 |
-
}
|
10153 |
-
|
10154 |
-
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
10155 |
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
10156 |
-
function getIteratorFn(maybeIterable) {
|
10157 |
-
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
10158 |
-
return null;
|
10159 |
-
}
|
10160 |
-
|
10161 |
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
10162 |
-
|
10163 |
-
if (typeof maybeIterator === 'function') {
|
10164 |
-
return maybeIterator;
|
10165 |
-
}
|
10166 |
-
|
10167 |
-
return null;
|
10168 |
-
}
|
10169 |
-
|
10170 |
-
// Helpers to patch console.logs to avoid logging during side-effect free
|
10171 |
-
// replaying on render function. This currently only patches the object
|
10172 |
-
// lazily which won't cover if the log function was extracted eagerly.
|
10173 |
-
// We could also eagerly patch the method.
|
10174 |
-
var disabledDepth = 0;
|
10175 |
-
var prevLog;
|
10176 |
-
var prevInfo;
|
10177 |
-
var prevWarn;
|
10178 |
-
var prevError;
|
10179 |
-
var prevGroup;
|
10180 |
-
var prevGroupCollapsed;
|
10181 |
-
var prevGroupEnd;
|
10182 |
-
|
10183 |
-
function disabledLog() {}
|
10184 |
-
|
10185 |
-
disabledLog.__reactDisabledLog = true;
|
10186 |
-
function disableLogs() {
|
10187 |
-
{
|
10188 |
-
if (disabledDepth === 0) {
|
10189 |
-
/* eslint-disable react-internal/no-production-logging */
|
10190 |
-
prevLog = console.log;
|
10191 |
-
prevInfo = console.info;
|
10192 |
-
prevWarn = console.warn;
|
10193 |
-
prevError = console.error;
|
10194 |
-
prevGroup = console.group;
|
10195 |
-
prevGroupCollapsed = console.groupCollapsed;
|
10196 |
-
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
10197 |
-
|
10198 |
-
var props = {
|
10199 |
-
configurable: true,
|
10200 |
-
enumerable: true,
|
10201 |
-
value: disabledLog,
|
10202 |
-
writable: true
|
10203 |
-
}; // $FlowFixMe Flow thinks console is immutable.
|
10204 |
-
|
10205 |
-
Object.defineProperties(console, {
|
10206 |
-
info: props,
|
10207 |
-
log: props,
|
10208 |
-
warn: props,
|
10209 |
-
error: props,
|
10210 |
-
group: props,
|
10211 |
-
groupCollapsed: props,
|
10212 |
-
groupEnd: props
|
10213 |
-
});
|
10214 |
-
/* eslint-enable react-internal/no-production-logging */
|
10215 |
-
}
|
10216 |
-
|
10217 |
-
disabledDepth++;
|
10218 |
-
}
|
10219 |
-
}
|
10220 |
-
function reenableLogs() {
|
10221 |
-
{
|
10222 |
-
disabledDepth--;
|
10223 |
-
|
10224 |
-
if (disabledDepth === 0) {
|
10225 |
-
/* eslint-disable react-internal/no-production-logging */
|
10226 |
-
var props = {
|
10227 |
-
configurable: true,
|
10228 |
-
enumerable: true,
|
10229 |
-
writable: true
|
10230 |
-
}; // $FlowFixMe Flow thinks console is immutable.
|
10231 |
-
|
10232 |
-
Object.defineProperties(console, {
|
10233 |
-
log: _assign({}, props, {
|
10234 |
-
value: prevLog
|
10235 |
-
}),
|
10236 |
-
info: _assign({}, props, {
|
10237 |
-
value: prevInfo
|
10238 |
-
}),
|
10239 |
-
warn: _assign({}, props, {
|
10240 |
-
value: prevWarn
|
10241 |
-
}),
|
10242 |
-
error: _assign({}, props, {
|
10243 |
-
value: prevError
|
10244 |
-
}),
|
10245 |
-
group: _assign({}, props, {
|
10246 |
-
value: prevGroup
|
10247 |
-
}),
|
10248 |
-
groupCollapsed: _assign({}, props, {
|
10249 |
-
value: prevGroupCollapsed
|
10250 |
-
}),
|
10251 |
-
groupEnd: _assign({}, props, {
|
10252 |
-
value: prevGroupEnd
|
10253 |
-
})
|
10254 |
-
});
|
10255 |
-
/* eslint-enable react-internal/no-production-logging */
|
10256 |
-
}
|
10257 |
-
|
10258 |
-
if (disabledDepth < 0) {
|
10259 |
-
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
10260 |
-
}
|
10261 |
-
}
|
10262 |
-
}
|
10263 |
-
|
10264 |
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
10265 |
-
var prefix;
|
10266 |
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
10267 |
-
{
|
10268 |
-
if (prefix === undefined) {
|
10269 |
-
// Extract the VM specific prefix used by each line.
|
10270 |
-
try {
|
10271 |
-
throw Error();
|
10272 |
-
} catch (x) {
|
10273 |
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
10274 |
-
prefix = match && match[1] || '';
|
10275 |
-
}
|
10276 |
-
} // We use the prefix to ensure our stacks line up with native stack frames.
|
10277 |
-
|
10278 |
-
|
10279 |
-
return '\n' + prefix + name;
|
10280 |
-
}
|
10281 |
-
}
|
10282 |
-
var reentry = false;
|
10283 |
-
var componentFrameCache;
|
10284 |
-
|
10285 |
-
{
|
10286 |
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
10287 |
-
componentFrameCache = new PossiblyWeakMap();
|
10288 |
-
}
|
10289 |
-
|
10290 |
-
function describeNativeComponentFrame(fn, construct) {
|
10291 |
-
// If something asked for a stack inside a fake render, it should get ignored.
|
10292 |
-
if (!fn || reentry) {
|
10293 |
-
return '';
|
10294 |
-
}
|
10295 |
-
|
10296 |
-
{
|
10297 |
-
var frame = componentFrameCache.get(fn);
|
10298 |
-
|
10299 |
-
if (frame !== undefined) {
|
10300 |
-
return frame;
|
10301 |
-
}
|
10302 |
-
}
|
10303 |
-
|
10304 |
-
var control;
|
10305 |
-
reentry = true;
|
10306 |
-
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
10307 |
-
|
10308 |
-
Error.prepareStackTrace = undefined;
|
10309 |
-
var previousDispatcher;
|
10310 |
-
|
10311 |
-
{
|
10312 |
-
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
10313 |
-
// for warnings.
|
10314 |
-
|
10315 |
-
ReactCurrentDispatcher.current = null;
|
10316 |
-
disableLogs();
|
10317 |
-
}
|
10318 |
-
|
10319 |
-
try {
|
10320 |
-
// This should throw.
|
10321 |
-
if (construct) {
|
10322 |
-
// Something should be setting the props in the constructor.
|
10323 |
-
var Fake = function () {
|
10324 |
-
throw Error();
|
10325 |
-
}; // $FlowFixMe
|
10326 |
-
|
10327 |
-
|
10328 |
-
Object.defineProperty(Fake.prototype, 'props', {
|
10329 |
-
set: function () {
|
10330 |
-
// We use a throwing setter instead of frozen or non-writable props
|
10331 |
-
// because that won't throw in a non-strict mode function.
|
10332 |
-
throw Error();
|
10333 |
-
}
|
10334 |
-
});
|
10335 |
-
|
10336 |
-
if (typeof Reflect === 'object' && Reflect.construct) {
|
10337 |
-
// We construct a different control for this case to include any extra
|
10338 |
-
// frames added by the construct call.
|
10339 |
-
try {
|
10340 |
-
Reflect.construct(Fake, []);
|
10341 |
-
} catch (x) {
|
10342 |
-
control = x;
|
10343 |
-
}
|
10344 |
-
|
10345 |
-
Reflect.construct(fn, [], Fake);
|
10346 |
-
} else {
|
10347 |
-
try {
|
10348 |
-
Fake.call();
|
10349 |
-
} catch (x) {
|
10350 |
-
control = x;
|
10351 |
-
}
|
10352 |
-
|
10353 |
-
fn.call(Fake.prototype);
|
10354 |
-
}
|
10355 |
-
} else {
|
10356 |
-
try {
|
10357 |
-
throw Error();
|
10358 |
-
} catch (x) {
|
10359 |
-
control = x;
|
10360 |
-
}
|
10361 |
-
|
10362 |
-
fn();
|
10363 |
-
}
|
10364 |
-
} catch (sample) {
|
10365 |
-
// This is inlined manually because closure doesn't do it for us.
|
10366 |
-
if (sample && control && typeof sample.stack === 'string') {
|
10367 |
-
// This extracts the first frame from the sample that isn't also in the control.
|
10368 |
-
// Skipping one frame that we assume is the frame that calls the two.
|
10369 |
-
var sampleLines = sample.stack.split('\n');
|
10370 |
-
var controlLines = control.stack.split('\n');
|
10371 |
-
var s = sampleLines.length - 1;
|
10372 |
-
var c = controlLines.length - 1;
|
10373 |
-
|
10374 |
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
10375 |
-
// We expect at least one stack frame to be shared.
|
10376 |
-
// Typically this will be the root most one. However, stack frames may be
|
10377 |
-
// cut off due to maximum stack limits. In this case, one maybe cut off
|
10378 |
-
// earlier than the other. We assume that the sample is longer or the same
|
10379 |
-
// and there for cut off earlier. So we should find the root most frame in
|
10380 |
-
// the sample somewhere in the control.
|
10381 |
-
c--;
|
10382 |
-
}
|
10383 |
-
|
10384 |
-
for (; s >= 1 && c >= 0; s--, c--) {
|
10385 |
-
// Next we find the first one that isn't the same which should be the
|
10386 |
-
// frame that called our sample function and the control.
|
10387 |
-
if (sampleLines[s] !== controlLines[c]) {
|
10388 |
-
// In V8, the first line is describing the message but other VMs don't.
|
10389 |
-
// If we're about to return the first line, and the control is also on the same
|
10390 |
-
// line, that's a pretty good indicator that our sample threw at same line as
|
10391 |
-
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
10392 |
-
// This can happen if you passed a class to function component, or non-function.
|
10393 |
-
if (s !== 1 || c !== 1) {
|
10394 |
-
do {
|
10395 |
-
s--;
|
10396 |
-
c--; // We may still have similar intermediate frames from the construct call.
|
10397 |
-
// The next one that isn't the same should be our match though.
|
10398 |
-
|
10399 |
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
10400 |
-
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
10401 |
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
10402 |
-
|
10403 |
-
{
|
10404 |
-
if (typeof fn === 'function') {
|
10405 |
-
componentFrameCache.set(fn, _frame);
|
10406 |
-
}
|
10407 |
-
} // Return the line we found.
|
10408 |
-
|
10409 |
-
|
10410 |
-
return _frame;
|
10411 |
-
}
|
10412 |
-
} while (s >= 1 && c >= 0);
|
10413 |
-
}
|
10414 |
-
|
10415 |
-
break;
|
10416 |
-
}
|
10417 |
-
}
|
10418 |
-
}
|
10419 |
-
} finally {
|
10420 |
-
reentry = false;
|
10421 |
-
|
10422 |
-
{
|
10423 |
-
ReactCurrentDispatcher.current = previousDispatcher;
|
10424 |
-
reenableLogs();
|
10425 |
-
}
|
10426 |
-
|
10427 |
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
10428 |
-
} // Fallback to just using the name if we couldn't make it throw.
|
10429 |
-
|
10430 |
-
|
10431 |
-
var name = fn ? fn.displayName || fn.name : '';
|
10432 |
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
10433 |
-
|
10434 |
-
{
|
10435 |
-
if (typeof fn === 'function') {
|
10436 |
-
componentFrameCache.set(fn, syntheticFrame);
|
10437 |
-
}
|
10438 |
-
}
|
10439 |
-
|
10440 |
-
return syntheticFrame;
|
10441 |
-
}
|
10442 |
-
|
10443 |
-
function describeClassComponentFrame(ctor, source, ownerFn) {
|
10444 |
-
{
|
10445 |
-
return describeNativeComponentFrame(ctor, true);
|
10446 |
-
}
|
10447 |
-
}
|
10448 |
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
10449 |
-
{
|
10450 |
-
return describeNativeComponentFrame(fn, false);
|
10451 |
-
}
|
10452 |
-
}
|
10453 |
-
|
10454 |
-
function shouldConstruct(Component) {
|
10455 |
-
var prototype = Component.prototype;
|
10456 |
-
return !!(prototype && prototype.isReactComponent);
|
10457 |
-
}
|
10458 |
-
|
10459 |
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
10460 |
-
|
10461 |
-
if (type == null) {
|
10462 |
-
return '';
|
10463 |
-
}
|
10464 |
-
|
10465 |
-
if (typeof type === 'function') {
|
10466 |
-
{
|
10467 |
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
10468 |
-
}
|
10469 |
-
}
|
10470 |
-
|
10471 |
-
if (typeof type === 'string') {
|
10472 |
-
return describeBuiltInComponentFrame(type);
|
10473 |
-
}
|
10474 |
-
|
10475 |
-
switch (type) {
|
10476 |
-
case REACT_SUSPENSE_TYPE:
|
10477 |
-
return describeBuiltInComponentFrame('Suspense');
|
10478 |
-
|
10479 |
-
case REACT_SUSPENSE_LIST_TYPE:
|
10480 |
-
return describeBuiltInComponentFrame('SuspenseList');
|
10481 |
-
}
|
10482 |
-
|
10483 |
-
if (typeof type === 'object') {
|
10484 |
-
switch (type.$$typeof) {
|
10485 |
-
case REACT_FORWARD_REF_TYPE:
|
10486 |
-
return describeFunctionComponentFrame(type.render);
|
10487 |
-
|
10488 |
-
case REACT_MEMO_TYPE:
|
10489 |
-
// Memo may contain any component type so we recursively resolve it.
|
10490 |
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
10491 |
-
|
10492 |
-
case REACT_BLOCK_TYPE:
|
10493 |
-
return describeFunctionComponentFrame(type._render);
|
10494 |
-
|
10495 |
-
case REACT_LAZY_TYPE:
|
10496 |
-
{
|
10497 |
-
var lazyComponent = type;
|
10498 |
-
var payload = lazyComponent._payload;
|
10499 |
-
var init = lazyComponent._init;
|
10500 |
-
|
10501 |
-
try {
|
10502 |
-
// Lazy may contain any component type so we recursively resolve it.
|
10503 |
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
10504 |
-
} catch (x) {}
|
10505 |
-
}
|
10506 |
-
}
|
10507 |
-
}
|
10508 |
-
|
10509 |
-
return '';
|
10510 |
}
|
10511 |
|
10512 |
function describeFiber(fiber) {
|
@@ -25753,7 +23418,308 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25753 |
},
|
25754 |
useState: function (initialState) {
|
25755 |
currentHookNameInDev = 'useState';
|
25756 |
-
updateHookTypesDev();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25757 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
25758 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
25759 |
|
@@ -25765,62 +23731,74 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25765 |
},
|
25766 |
useDebugValue: function (value, formatterFn) {
|
25767 |
currentHookNameInDev = 'useDebugValue';
|
25768 |
-
|
|
|
25769 |
return mountDebugValue();
|
25770 |
},
|
25771 |
useDeferredValue: function (value) {
|
25772 |
currentHookNameInDev = 'useDeferredValue';
|
25773 |
-
|
|
|
25774 |
return mountDeferredValue(value);
|
25775 |
},
|
25776 |
useTransition: function () {
|
25777 |
currentHookNameInDev = 'useTransition';
|
25778 |
-
|
|
|
25779 |
return mountTransition();
|
25780 |
},
|
25781 |
useMutableSource: function (source, getSnapshot, subscribe) {
|
25782 |
currentHookNameInDev = 'useMutableSource';
|
25783 |
-
|
|
|
25784 |
return mountMutableSource(source, getSnapshot, subscribe);
|
25785 |
},
|
25786 |
useOpaqueIdentifier: function () {
|
25787 |
currentHookNameInDev = 'useOpaqueIdentifier';
|
25788 |
-
|
|
|
25789 |
return mountOpaqueIdentifier();
|
25790 |
},
|
25791 |
unstable_isNewReconciler: enableNewReconciler
|
25792 |
};
|
25793 |
-
|
25794 |
readContext: function (context, observedBits) {
|
|
|
25795 |
return readContext(context, observedBits);
|
25796 |
},
|
25797 |
useCallback: function (callback, deps) {
|
25798 |
currentHookNameInDev = 'useCallback';
|
|
|
25799 |
updateHookTypesDev();
|
25800 |
return updateCallback(callback, deps);
|
25801 |
},
|
25802 |
useContext: function (context, observedBits) {
|
25803 |
currentHookNameInDev = 'useContext';
|
|
|
25804 |
updateHookTypesDev();
|
25805 |
return readContext(context, observedBits);
|
25806 |
},
|
25807 |
useEffect: function (create, deps) {
|
25808 |
currentHookNameInDev = 'useEffect';
|
|
|
25809 |
updateHookTypesDev();
|
25810 |
return updateEffect(create, deps);
|
25811 |
},
|
25812 |
useImperativeHandle: function (ref, create, deps) {
|
25813 |
currentHookNameInDev = 'useImperativeHandle';
|
|
|
25814 |
updateHookTypesDev();
|
25815 |
return updateImperativeHandle(ref, create, deps);
|
25816 |
},
|
25817 |
useLayoutEffect: function (create, deps) {
|
25818 |
currentHookNameInDev = 'useLayoutEffect';
|
|
|
25819 |
updateHookTypesDev();
|
25820 |
return updateLayoutEffect(create, deps);
|
25821 |
},
|
25822 |
useMemo: function (create, deps) {
|
25823 |
currentHookNameInDev = 'useMemo';
|
|
|
25824 |
updateHookTypesDev();
|
25825 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
25826 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
@@ -25833,6 +23811,7 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25833 |
},
|
25834 |
useReducer: function (reducer, initialArg, init) {
|
25835 |
currentHookNameInDev = 'useReducer';
|
|
|
25836 |
updateHookTypesDev();
|
25837 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
25838 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
@@ -25845,11 +23824,13 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25845 |
},
|
25846 |
useRef: function (initialValue) {
|
25847 |
currentHookNameInDev = 'useRef';
|
|
|
25848 |
updateHookTypesDev();
|
25849 |
return updateRef();
|
25850 |
},
|
25851 |
useState: function (initialState) {
|
25852 |
currentHookNameInDev = 'useState';
|
|
|
25853 |
updateHookTypesDev();
|
25854 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
25855 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
@@ -25862,65 +23843,77 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25862 |
},
|
25863 |
useDebugValue: function (value, formatterFn) {
|
25864 |
currentHookNameInDev = 'useDebugValue';
|
|
|
25865 |
updateHookTypesDev();
|
25866 |
return updateDebugValue();
|
25867 |
},
|
25868 |
useDeferredValue: function (value) {
|
25869 |
currentHookNameInDev = 'useDeferredValue';
|
|
|
25870 |
updateHookTypesDev();
|
25871 |
return updateDeferredValue(value);
|
25872 |
},
|
25873 |
useTransition: function () {
|
25874 |
currentHookNameInDev = 'useTransition';
|
|
|
25875 |
updateHookTypesDev();
|
25876 |
return updateTransition();
|
25877 |
},
|
25878 |
useMutableSource: function (source, getSnapshot, subscribe) {
|
25879 |
currentHookNameInDev = 'useMutableSource';
|
|
|
25880 |
updateHookTypesDev();
|
25881 |
return updateMutableSource(source, getSnapshot, subscribe);
|
25882 |
},
|
25883 |
useOpaqueIdentifier: function () {
|
25884 |
currentHookNameInDev = 'useOpaqueIdentifier';
|
|
|
25885 |
updateHookTypesDev();
|
25886 |
return updateOpaqueIdentifier();
|
25887 |
},
|
25888 |
unstable_isNewReconciler: enableNewReconciler
|
25889 |
};
|
25890 |
-
|
25891 |
readContext: function (context, observedBits) {
|
|
|
25892 |
return readContext(context, observedBits);
|
25893 |
},
|
25894 |
useCallback: function (callback, deps) {
|
25895 |
currentHookNameInDev = 'useCallback';
|
|
|
25896 |
updateHookTypesDev();
|
25897 |
return updateCallback(callback, deps);
|
25898 |
},
|
25899 |
useContext: function (context, observedBits) {
|
25900 |
currentHookNameInDev = 'useContext';
|
|
|
25901 |
updateHookTypesDev();
|
25902 |
return readContext(context, observedBits);
|
25903 |
},
|
25904 |
useEffect: function (create, deps) {
|
25905 |
currentHookNameInDev = 'useEffect';
|
|
|
25906 |
updateHookTypesDev();
|
25907 |
return updateEffect(create, deps);
|
25908 |
},
|
25909 |
useImperativeHandle: function (ref, create, deps) {
|
25910 |
currentHookNameInDev = 'useImperativeHandle';
|
|
|
25911 |
updateHookTypesDev();
|
25912 |
return updateImperativeHandle(ref, create, deps);
|
25913 |
},
|
25914 |
useLayoutEffect: function (create, deps) {
|
25915 |
currentHookNameInDev = 'useLayoutEffect';
|
|
|
25916 |
updateHookTypesDev();
|
25917 |
return updateLayoutEffect(create, deps);
|
25918 |
},
|
25919 |
useMemo: function (create, deps) {
|
25920 |
currentHookNameInDev = 'useMemo';
|
|
|
25921 |
updateHookTypesDev();
|
25922 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
25923 |
-
ReactCurrentDispatcher$1.current =
|
25924 |
|
25925 |
try {
|
25926 |
return updateMemo(create, deps);
|
@@ -25930,9 +23923,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25930 |
},
|
25931 |
useReducer: function (reducer, initialArg, init) {
|
25932 |
currentHookNameInDev = 'useReducer';
|
|
|
25933 |
updateHookTypesDev();
|
25934 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
25935 |
-
ReactCurrentDispatcher$1.current =
|
25936 |
|
25937 |
try {
|
25938 |
return rerenderReducer(reducer, initialArg, init);
|
@@ -25942,14 +23936,16 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25942 |
},
|
25943 |
useRef: function (initialValue) {
|
25944 |
currentHookNameInDev = 'useRef';
|
|
|
25945 |
updateHookTypesDev();
|
25946 |
return updateRef();
|
25947 |
},
|
25948 |
useState: function (initialState) {
|
25949 |
currentHookNameInDev = 'useState';
|
|
|
25950 |
updateHookTypesDev();
|
25951 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
25952 |
-
ReactCurrentDispatcher$1.current =
|
25953 |
|
25954 |
try {
|
25955 |
return rerenderState(initialState);
|
@@ -25959,4257 +23955,4608 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
25959 |
},
|
25960 |
useDebugValue: function (value, formatterFn) {
|
25961 |
currentHookNameInDev = 'useDebugValue';
|
|
|
25962 |
updateHookTypesDev();
|
25963 |
return updateDebugValue();
|
25964 |
},
|
25965 |
useDeferredValue: function (value) {
|
25966 |
currentHookNameInDev = 'useDeferredValue';
|
|
|
25967 |
updateHookTypesDev();
|
25968 |
return rerenderDeferredValue(value);
|
25969 |
},
|
25970 |
useTransition: function () {
|
25971 |
currentHookNameInDev = 'useTransition';
|
|
|
25972 |
updateHookTypesDev();
|
25973 |
return rerenderTransition();
|
25974 |
},
|
25975 |
useMutableSource: function (source, getSnapshot, subscribe) {
|
25976 |
currentHookNameInDev = 'useMutableSource';
|
|
|
25977 |
updateHookTypesDev();
|
25978 |
return updateMutableSource(source, getSnapshot, subscribe);
|
25979 |
},
|
25980 |
useOpaqueIdentifier: function () {
|
25981 |
currentHookNameInDev = 'useOpaqueIdentifier';
|
|
|
25982 |
updateHookTypesDev();
|
25983 |
return rerenderOpaqueIdentifier();
|
25984 |
},
|
25985 |
unstable_isNewReconciler: enableNewReconciler
|
25986 |
};
|
25987 |
-
|
25988 |
-
|
25989 |
-
|
25990 |
-
|
25991 |
-
|
25992 |
-
|
25993 |
-
|
25994 |
-
|
25995 |
-
|
25996 |
-
|
25997 |
-
|
25998 |
-
|
25999 |
-
|
26000 |
-
|
26001 |
-
|
26002 |
-
|
26003 |
-
|
26004 |
-
|
26005 |
-
|
26006 |
-
|
26007 |
-
|
26008 |
-
|
26009 |
-
|
26010 |
-
|
26011 |
-
|
26012 |
-
|
26013 |
-
|
26014 |
-
|
26015 |
-
|
26016 |
-
|
26017 |
-
|
26018 |
-
|
26019 |
-
|
26020 |
-
|
26021 |
-
|
26022 |
-
|
26023 |
-
|
26024 |
-
|
26025 |
-
|
26026 |
-
|
26027 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26028 |
|
26029 |
-
|
26030 |
-
|
26031 |
-
} finally {
|
26032 |
-
ReactCurrentDispatcher$1.current = prevDispatcher;
|
26033 |
-
}
|
26034 |
-
},
|
26035 |
-
useReducer: function (reducer, initialArg, init) {
|
26036 |
-
currentHookNameInDev = 'useReducer';
|
26037 |
-
warnInvalidHookAccess();
|
26038 |
-
mountHookTypesDev();
|
26039 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
26040 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
26041 |
|
26042 |
-
|
26043 |
-
|
26044 |
-
|
26045 |
-
|
26046 |
-
|
26047 |
-
},
|
26048 |
-
useRef: function (initialValue) {
|
26049 |
-
currentHookNameInDev = 'useRef';
|
26050 |
-
warnInvalidHookAccess();
|
26051 |
-
mountHookTypesDev();
|
26052 |
-
return mountRef(initialValue);
|
26053 |
-
},
|
26054 |
-
useState: function (initialState) {
|
26055 |
-
currentHookNameInDev = 'useState';
|
26056 |
-
warnInvalidHookAccess();
|
26057 |
-
mountHookTypesDev();
|
26058 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
26059 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
26060 |
|
26061 |
-
|
26062 |
-
|
26063 |
-
|
26064 |
-
|
26065 |
-
|
26066 |
-
|
26067 |
-
useDebugValue: function (value, formatterFn) {
|
26068 |
-
currentHookNameInDev = 'useDebugValue';
|
26069 |
-
warnInvalidHookAccess();
|
26070 |
-
mountHookTypesDev();
|
26071 |
-
return mountDebugValue();
|
26072 |
-
},
|
26073 |
-
useDeferredValue: function (value) {
|
26074 |
-
currentHookNameInDev = 'useDeferredValue';
|
26075 |
-
warnInvalidHookAccess();
|
26076 |
-
mountHookTypesDev();
|
26077 |
-
return mountDeferredValue(value);
|
26078 |
-
},
|
26079 |
-
useTransition: function () {
|
26080 |
-
currentHookNameInDev = 'useTransition';
|
26081 |
-
warnInvalidHookAccess();
|
26082 |
-
mountHookTypesDev();
|
26083 |
-
return mountTransition();
|
26084 |
-
},
|
26085 |
-
useMutableSource: function (source, getSnapshot, subscribe) {
|
26086 |
-
currentHookNameInDev = 'useMutableSource';
|
26087 |
-
warnInvalidHookAccess();
|
26088 |
-
mountHookTypesDev();
|
26089 |
-
return mountMutableSource(source, getSnapshot, subscribe);
|
26090 |
-
},
|
26091 |
-
useOpaqueIdentifier: function () {
|
26092 |
-
currentHookNameInDev = 'useOpaqueIdentifier';
|
26093 |
-
warnInvalidHookAccess();
|
26094 |
-
mountHookTypesDev();
|
26095 |
-
return mountOpaqueIdentifier();
|
26096 |
-
},
|
26097 |
-
unstable_isNewReconciler: enableNewReconciler
|
26098 |
-
};
|
26099 |
-
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
26100 |
-
readContext: function (context, observedBits) {
|
26101 |
-
warnInvalidContextAccess();
|
26102 |
-
return readContext(context, observedBits);
|
26103 |
-
},
|
26104 |
-
useCallback: function (callback, deps) {
|
26105 |
-
currentHookNameInDev = 'useCallback';
|
26106 |
-
warnInvalidHookAccess();
|
26107 |
-
updateHookTypesDev();
|
26108 |
-
return updateCallback(callback, deps);
|
26109 |
-
},
|
26110 |
-
useContext: function (context, observedBits) {
|
26111 |
-
currentHookNameInDev = 'useContext';
|
26112 |
-
warnInvalidHookAccess();
|
26113 |
-
updateHookTypesDev();
|
26114 |
-
return readContext(context, observedBits);
|
26115 |
-
},
|
26116 |
-
useEffect: function (create, deps) {
|
26117 |
-
currentHookNameInDev = 'useEffect';
|
26118 |
-
warnInvalidHookAccess();
|
26119 |
-
updateHookTypesDev();
|
26120 |
-
return updateEffect(create, deps);
|
26121 |
-
},
|
26122 |
-
useImperativeHandle: function (ref, create, deps) {
|
26123 |
-
currentHookNameInDev = 'useImperativeHandle';
|
26124 |
-
warnInvalidHookAccess();
|
26125 |
-
updateHookTypesDev();
|
26126 |
-
return updateImperativeHandle(ref, create, deps);
|
26127 |
-
},
|
26128 |
-
useLayoutEffect: function (create, deps) {
|
26129 |
-
currentHookNameInDev = 'useLayoutEffect';
|
26130 |
-
warnInvalidHookAccess();
|
26131 |
-
updateHookTypesDev();
|
26132 |
-
return updateLayoutEffect(create, deps);
|
26133 |
-
},
|
26134 |
-
useMemo: function (create, deps) {
|
26135 |
-
currentHookNameInDev = 'useMemo';
|
26136 |
-
warnInvalidHookAccess();
|
26137 |
-
updateHookTypesDev();
|
26138 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
26139 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
26140 |
|
26141 |
-
|
26142 |
-
|
26143 |
-
|
26144 |
-
ReactCurrentDispatcher$1.current = prevDispatcher;
|
26145 |
}
|
26146 |
-
}
|
26147 |
-
|
26148 |
-
currentHookNameInDev = 'useReducer';
|
26149 |
-
warnInvalidHookAccess();
|
26150 |
-
updateHookTypesDev();
|
26151 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
26152 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
26153 |
|
26154 |
-
|
26155 |
-
|
26156 |
-
|
26157 |
-
|
26158 |
-
|
26159 |
-
|
26160 |
-
|
26161 |
-
|
26162 |
-
|
26163 |
-
|
26164 |
-
|
26165 |
-
|
26166 |
-
|
26167 |
-
|
26168 |
-
|
26169 |
-
|
26170 |
-
|
26171 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
26172 |
|
26173 |
try {
|
26174 |
-
|
26175 |
} finally {
|
26176 |
-
|
26177 |
}
|
26178 |
-
}
|
26179 |
-
useDebugValue: function (value, formatterFn) {
|
26180 |
-
currentHookNameInDev = 'useDebugValue';
|
26181 |
-
warnInvalidHookAccess();
|
26182 |
-
updateHookTypesDev();
|
26183 |
-
return updateDebugValue();
|
26184 |
-
},
|
26185 |
-
useDeferredValue: function (value) {
|
26186 |
-
currentHookNameInDev = 'useDeferredValue';
|
26187 |
-
warnInvalidHookAccess();
|
26188 |
-
updateHookTypesDev();
|
26189 |
-
return updateDeferredValue(value);
|
26190 |
-
},
|
26191 |
-
useTransition: function () {
|
26192 |
-
currentHookNameInDev = 'useTransition';
|
26193 |
-
warnInvalidHookAccess();
|
26194 |
-
updateHookTypesDev();
|
26195 |
-
return updateTransition();
|
26196 |
-
},
|
26197 |
-
useMutableSource: function (source, getSnapshot, subscribe) {
|
26198 |
-
currentHookNameInDev = 'useMutableSource';
|
26199 |
-
warnInvalidHookAccess();
|
26200 |
-
updateHookTypesDev();
|
26201 |
-
return updateMutableSource(source, getSnapshot, subscribe);
|
26202 |
-
},
|
26203 |
-
useOpaqueIdentifier: function () {
|
26204 |
-
currentHookNameInDev = 'useOpaqueIdentifier';
|
26205 |
-
warnInvalidHookAccess();
|
26206 |
-
updateHookTypesDev();
|
26207 |
-
return updateOpaqueIdentifier();
|
26208 |
-
},
|
26209 |
-
unstable_isNewReconciler: enableNewReconciler
|
26210 |
-
};
|
26211 |
-
InvalidNestedHooksDispatcherOnRerenderInDEV = {
|
26212 |
-
readContext: function (context, observedBits) {
|
26213 |
-
warnInvalidContextAccess();
|
26214 |
-
return readContext(context, observedBits);
|
26215 |
-
},
|
26216 |
-
useCallback: function (callback, deps) {
|
26217 |
-
currentHookNameInDev = 'useCallback';
|
26218 |
-
warnInvalidHookAccess();
|
26219 |
-
updateHookTypesDev();
|
26220 |
-
return updateCallback(callback, deps);
|
26221 |
-
},
|
26222 |
-
useContext: function (context, observedBits) {
|
26223 |
-
currentHookNameInDev = 'useContext';
|
26224 |
-
warnInvalidHookAccess();
|
26225 |
-
updateHookTypesDev();
|
26226 |
-
return readContext(context, observedBits);
|
26227 |
-
},
|
26228 |
-
useEffect: function (create, deps) {
|
26229 |
-
currentHookNameInDev = 'useEffect';
|
26230 |
-
warnInvalidHookAccess();
|
26231 |
-
updateHookTypesDev();
|
26232 |
-
return updateEffect(create, deps);
|
26233 |
-
},
|
26234 |
-
useImperativeHandle: function (ref, create, deps) {
|
26235 |
-
currentHookNameInDev = 'useImperativeHandle';
|
26236 |
-
warnInvalidHookAccess();
|
26237 |
-
updateHookTypesDev();
|
26238 |
-
return updateImperativeHandle(ref, create, deps);
|
26239 |
-
},
|
26240 |
-
useLayoutEffect: function (create, deps) {
|
26241 |
-
currentHookNameInDev = 'useLayoutEffect';
|
26242 |
-
warnInvalidHookAccess();
|
26243 |
-
updateHookTypesDev();
|
26244 |
-
return updateLayoutEffect(create, deps);
|
26245 |
-
},
|
26246 |
-
useMemo: function (create, deps) {
|
26247 |
-
currentHookNameInDev = 'useMemo';
|
26248 |
-
warnInvalidHookAccess();
|
26249 |
-
updateHookTypesDev();
|
26250 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
26251 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
26252 |
|
26253 |
-
|
26254 |
-
|
26255 |
-
|
26256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26257 |
}
|
26258 |
-
}
|
26259 |
-
|
26260 |
-
|
26261 |
-
|
26262 |
-
updateHookTypesDev();
|
26263 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
26264 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
26265 |
|
26266 |
-
|
26267 |
-
|
26268 |
-
|
26269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26270 |
}
|
26271 |
-
},
|
26272 |
-
useRef: function (initialValue) {
|
26273 |
-
currentHookNameInDev = 'useRef';
|
26274 |
-
warnInvalidHookAccess();
|
26275 |
-
updateHookTypesDev();
|
26276 |
-
return updateRef();
|
26277 |
-
},
|
26278 |
-
useState: function (initialState) {
|
26279 |
-
currentHookNameInDev = 'useState';
|
26280 |
-
warnInvalidHookAccess();
|
26281 |
-
updateHookTypesDev();
|
26282 |
-
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
26283 |
-
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
26284 |
|
26285 |
-
|
26286 |
-
|
26287 |
-
|
26288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26289 |
}
|
26290 |
-
|
26291 |
-
|
26292 |
-
|
26293 |
-
|
26294 |
-
|
26295 |
-
|
26296 |
-
|
26297 |
-
|
26298 |
-
|
26299 |
-
|
26300 |
-
|
26301 |
-
|
26302 |
-
|
26303 |
-
|
26304 |
-
|
26305 |
-
|
26306 |
-
|
26307 |
-
|
26308 |
-
|
26309 |
-
|
26310 |
-
|
26311 |
-
|
26312 |
-
|
26313 |
-
|
26314 |
-
|
26315 |
-
|
26316 |
-
|
26317 |
-
|
26318 |
-
|
26319 |
-
|
26320 |
-
|
26321 |
-
|
26322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26323 |
}
|
26324 |
|
26325 |
-
|
26326 |
-
|
26327 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26328 |
|
26329 |
-
|
26330 |
-
|
26331 |
-
|
26332 |
|
26333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26334 |
|
26335 |
-
|
26336 |
}
|
26337 |
|
26338 |
-
function
|
|
|
26339 |
|
26340 |
-
|
|
|
|
|
26341 |
|
26342 |
-
|
26343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26344 |
}
|
|
|
|
|
|
|
|
|
26345 |
}
|
26346 |
|
26347 |
-
function
|
|
|
|
|
|
|
|
|
26348 |
|
26349 |
-
|
|
|
26350 |
}
|
26351 |
|
26352 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26353 |
|
26354 |
-
|
26355 |
-
|
26356 |
-
fiber.actualDuration += elapsedTime;
|
26357 |
|
26358 |
-
|
26359 |
-
|
26360 |
-
|
|
|
|
|
26361 |
|
26362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26363 |
}
|
26364 |
-
}
|
26365 |
|
26366 |
-
|
26367 |
-
// Transfer time spent rendering these children so we don't lose it
|
26368 |
-
// after we rerender. This is used as a helper in special cases
|
26369 |
-
// where we should count the work of multiple passes.
|
26370 |
-
var child = fiber.child;
|
26371 |
|
26372 |
-
|
26373 |
-
|
26374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26375 |
}
|
26376 |
}
|
26377 |
|
26378 |
-
|
26379 |
-
|
26380 |
-
|
26381 |
-
|
26382 |
-
|
26383 |
-
|
26384 |
-
|
26385 |
-
|
26386 |
-
var didWarnAboutRevealOrder;
|
26387 |
-
var didWarnAboutTailOptions;
|
26388 |
|
26389 |
-
|
26390 |
-
|
26391 |
-
didWarnAboutModulePatternComponent = {};
|
26392 |
-
didWarnAboutContextTypeOnFunctionComponent = {};
|
26393 |
-
didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
26394 |
-
didWarnAboutFunctionRefs = {};
|
26395 |
-
didWarnAboutReassigningProps = false;
|
26396 |
-
didWarnAboutRevealOrder = {};
|
26397 |
-
didWarnAboutTailOptions = {};
|
26398 |
-
}
|
26399 |
|
26400 |
-
|
26401 |
-
|
26402 |
-
|
26403 |
-
|
26404 |
-
|
26405 |
-
|
26406 |
-
|
|
|
|
|
|
|
|
|
26407 |
} else {
|
26408 |
-
|
26409 |
-
// we haven't yet started any work on these children. Therefore, we use
|
26410 |
-
// the clone algorithm to create a copy of all the current children.
|
26411 |
-
// If we had any progressed work already, that is invalid at this point so
|
26412 |
-
// let's throw it out.
|
26413 |
-
workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes);
|
26414 |
}
|
26415 |
-
}
|
26416 |
-
|
26417 |
-
function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes) {
|
26418 |
-
// This function is fork of reconcileChildren. It's used in cases where we
|
26419 |
-
// want to reconcile without matching against the existing set. This has the
|
26420 |
-
// effect of all current children being unmounted; even if the type and key
|
26421 |
-
// are the same, the old child is unmounted and a new child is created.
|
26422 |
-
//
|
26423 |
-
// To do this, we're going to go through the reconcile algorithm twice. In
|
26424 |
-
// the first pass, we schedule a deletion for all the current children by
|
26425 |
-
// passing null.
|
26426 |
-
workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes); // In the second pass, we mount the new children. The trick here is that we
|
26427 |
-
// pass null in place of where we usually pass the current child set. This has
|
26428 |
-
// the effect of remounting all children regardless of whether their
|
26429 |
-
// identities match.
|
26430 |
|
26431 |
-
|
|
|
|
|
|
|
26432 |
}
|
26433 |
|
26434 |
-
function
|
26435 |
-
|
26436 |
-
|
26437 |
-
|
26438 |
-
|
26439 |
-
|
26440 |
-
|
26441 |
-
|
26442 |
-
var innerPropTypes = Component.propTypes;
|
26443 |
|
26444 |
-
|
26445 |
-
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
26446 |
-
'prop', getComponentName(Component));
|
26447 |
-
}
|
26448 |
-
}
|
26449 |
}
|
26450 |
|
26451 |
-
var
|
26452 |
-
var
|
|
|
|
|
|
|
|
|
|
|
26453 |
|
26454 |
-
var nextChildren;
|
26455 |
prepareToReadContext(workInProgress, renderLanes);
|
|
|
26456 |
|
26457 |
{
|
26458 |
-
|
26459 |
-
|
26460 |
-
nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes);
|
26461 |
|
26462 |
-
|
26463 |
-
|
26464 |
|
26465 |
-
|
26466 |
-
nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes);
|
26467 |
-
} finally {
|
26468 |
-
reenableLogs();
|
26469 |
}
|
26470 |
}
|
26471 |
|
26472 |
-
|
26473 |
-
|
|
|
26474 |
|
26475 |
-
|
26476 |
-
|
26477 |
-
|
|
|
26478 |
} // React DevTools reads this flag.
|
26479 |
|
26480 |
|
26481 |
workInProgress.flags |= PerformedWork;
|
26482 |
-
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
26483 |
-
return workInProgress.child;
|
26484 |
-
}
|
26485 |
|
26486 |
-
|
26487 |
-
|
26488 |
-
|
|
|
|
|
26489 |
|
26490 |
-
|
26491 |
-
|
26492 |
-
var resolvedType = type;
|
26493 |
|
26494 |
-
|
26495 |
-
|
26496 |
-
|
26497 |
-
|
26498 |
-
// to a SimpleMemoComponent to allow fast path updates.
|
26499 |
|
|
|
|
|
|
|
|
|
|
|
26500 |
|
26501 |
-
|
26502 |
-
|
26503 |
|
26504 |
-
|
26505 |
-
validateFunctionComponentInDev(workInProgress, type);
|
26506 |
}
|
|
|
26507 |
|
26508 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26509 |
}
|
26510 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26511 |
{
|
26512 |
-
var innerPropTypes = type.propTypes;
|
26513 |
|
26514 |
-
if (
|
26515 |
-
|
26516 |
-
|
26517 |
-
|
26518 |
-
|
|
|
|
|
|
|
26519 |
}
|
26520 |
}
|
26521 |
|
26522 |
-
|
26523 |
-
|
26524 |
-
|
26525 |
-
|
26526 |
-
|
|
|
|
|
26527 |
}
|
|
|
26528 |
|
|
|
26529 |
{
|
26530 |
-
|
26531 |
-
|
|
|
|
|
|
|
26532 |
|
26533 |
-
if (
|
26534 |
-
|
26535 |
-
|
26536 |
-
|
26537 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26538 |
}
|
26539 |
-
}
|
26540 |
|
26541 |
-
|
|
|
26542 |
|
26543 |
-
|
26544 |
-
|
26545 |
-
// unlike current.memoizedProps which will be the unresolved ones.
|
26546 |
-
var prevProps = currentChild.memoizedProps; // Default to shallow comparison
|
26547 |
|
26548 |
-
|
26549 |
-
|
|
|
26550 |
|
26551 |
-
if (
|
26552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
26553 |
}
|
26554 |
-
}
|
|
|
26555 |
|
|
|
|
|
|
|
|
|
26556 |
|
26557 |
-
|
26558 |
-
|
26559 |
-
|
26560 |
-
|
26561 |
-
workInProgress.child = newChild;
|
26562 |
-
return newChild;
|
26563 |
}
|
26564 |
|
26565 |
-
function
|
26566 |
-
|
26567 |
-
|
26568 |
-
|
26569 |
-
|
26570 |
-
|
26571 |
-
|
26572 |
-
|
26573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26574 |
|
26575 |
-
if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
|
26576 |
-
// We warn when you define propTypes on lazy()
|
26577 |
-
// so let's just skip over it to find memo() outer wrapper.
|
26578 |
-
// Inner props for memo are validated later.
|
26579 |
-
var lazyComponent = outerMemoType;
|
26580 |
-
var payload = lazyComponent._payload;
|
26581 |
-
var init = lazyComponent._init;
|
26582 |
|
26583 |
-
|
26584 |
-
|
26585 |
-
} catch (x) {
|
26586 |
-
outerMemoType = null;
|
26587 |
-
} // Inner propTypes will be validated in the function component path.
|
26588 |
|
|
|
|
|
|
|
|
|
26589 |
|
26590 |
-
|
|
|
26591 |
|
26592 |
-
|
26593 |
-
|
26594 |
-
|
26595 |
-
}
|
26596 |
-
}
|
26597 |
}
|
26598 |
}
|
26599 |
|
26600 |
-
|
26601 |
-
|
26602 |
-
|
26603 |
-
if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload.
|
26604 |
-
workInProgress.type === current.type )) {
|
26605 |
-
didReceiveUpdate = false;
|
26606 |
|
26607 |
-
|
26608 |
-
|
26609 |
-
|
26610 |
-
|
26611 |
-
|
26612 |
-
|
26613 |
-
|
26614 |
-
|
26615 |
-
|
26616 |
-
|
26617 |
-
|
26618 |
-
|
26619 |
-
|
26620 |
-
|
26621 |
-
|
26622 |
-
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
26623 |
-
} else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
26624 |
-
// This is a special case that only exists for legacy mode.
|
26625 |
-
// See https://github.com/facebook/react/pull/19216.
|
26626 |
-
didReceiveUpdate = true;
|
26627 |
}
|
26628 |
}
|
26629 |
}
|
26630 |
|
26631 |
-
|
26632 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26633 |
|
26634 |
-
|
26635 |
-
|
26636 |
-
|
26637 |
-
|
|
|
|
|
|
|
26638 |
|
26639 |
-
|
26640 |
-
|
26641 |
-
// In legacy sync mode, don't defer the subtree. Render it now.
|
26642 |
-
// TODO: Figure out what we should do in Blocking mode.
|
26643 |
-
var nextState = {
|
26644 |
-
baseLanes: NoLanes
|
26645 |
-
};
|
26646 |
-
workInProgress.memoizedState = nextState;
|
26647 |
-
pushRenderLanes(workInProgress, renderLanes);
|
26648 |
-
} else if (!includesSomeLane(renderLanes, OffscreenLane)) {
|
26649 |
-
var nextBaseLanes;
|
26650 |
|
26651 |
-
|
26652 |
-
|
26653 |
-
|
26654 |
-
|
26655 |
-
|
26656 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26657 |
|
|
|
26658 |
|
26659 |
{
|
26660 |
-
markSpawnedWork(
|
26661 |
}
|
26662 |
|
26663 |
-
|
26664 |
-
var _nextState = {
|
26665 |
-
baseLanes: nextBaseLanes
|
26666 |
-
};
|
26667 |
-
workInProgress.memoizedState = _nextState; // We're about to bail out, but we need to push this to the stack anyway
|
26668 |
-
// to avoid a push/pop misalignment.
|
26669 |
-
|
26670 |
-
pushRenderLanes(workInProgress, nextBaseLanes);
|
26671 |
-
return null;
|
26672 |
} else {
|
26673 |
-
|
26674 |
-
var _nextState2 = {
|
26675 |
-
baseLanes: NoLanes
|
26676 |
-
};
|
26677 |
-
workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out.
|
26678 |
-
|
26679 |
-
var subtreeRenderLanes = prevState !== null ? prevState.baseLanes : renderLanes;
|
26680 |
-
pushRenderLanes(workInProgress, subtreeRenderLanes);
|
26681 |
}
|
26682 |
} else {
|
26683 |
-
|
|
|
|
|
|
|
26684 |
|
26685 |
if (prevState !== null) {
|
26686 |
-
_subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes); // Since we're not hidden anymore, reset the state
|
26687 |
|
26688 |
-
|
26689 |
-
|
26690 |
-
|
26691 |
-
// special to do. Need to push to the stack regardless, though, to avoid
|
26692 |
-
// a push/pop misalignment.
|
26693 |
-
_subtreeRenderLanes = renderLanes;
|
26694 |
-
}
|
26695 |
|
26696 |
-
|
26697 |
-
}
|
26698 |
|
26699 |
-
|
26700 |
-
|
26701 |
-
|
26702 |
-
|
26703 |
-
|
|
|
|
|
|
|
26704 |
|
|
|
26705 |
|
26706 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26707 |
|
26708 |
-
|
26709 |
-
var nextChildren = workInProgress.pendingProps;
|
26710 |
-
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
26711 |
-
return workInProgress.child;
|
26712 |
-
}
|
26713 |
|
26714 |
-
|
26715 |
-
|
26716 |
-
|
26717 |
-
|
26718 |
-
|
26719 |
|
26720 |
-
|
26721 |
-
|
26722 |
-
|
26723 |
-
|
|
|
|
|
26724 |
|
26725 |
-
|
26726 |
-
stateNode.effectDuration = 0;
|
26727 |
-
stateNode.passiveEffectDuration = 0;
|
26728 |
-
}
|
26729 |
|
26730 |
-
|
26731 |
-
|
26732 |
-
|
26733 |
-
|
|
|
26734 |
}
|
26735 |
|
26736 |
-
function
|
26737 |
-
var
|
26738 |
-
|
26739 |
-
|
26740 |
-
|
26741 |
-
|
26742 |
-
|
|
|
|
|
|
|
26743 |
}
|
26744 |
|
26745 |
-
function
|
26746 |
-
|
26747 |
-
|
26748 |
-
|
26749 |
-
|
26750 |
-
|
|
|
|
|
|
|
26751 |
|
26752 |
-
|
26753 |
-
|
26754 |
-
|
26755 |
-
|
26756 |
-
|
26757 |
-
|
26758 |
|
26759 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26760 |
|
26761 |
-
|
26762 |
-
|
26763 |
-
|
|
|
26764 |
}
|
26765 |
|
26766 |
-
|
26767 |
-
|
26768 |
-
|
26769 |
-
|
26770 |
-
|
26771 |
-
|
26772 |
-
nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes);
|
26773 |
|
26774 |
-
|
26775 |
-
|
|
|
|
|
|
|
26776 |
|
26777 |
-
|
26778 |
-
|
26779 |
-
|
26780 |
-
|
26781 |
-
|
26782 |
-
|
|
|
26783 |
|
26784 |
-
|
|
|
26785 |
}
|
26786 |
|
26787 |
-
|
26788 |
-
|
26789 |
-
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
26790 |
-
} // React DevTools reads this flag.
|
26791 |
|
|
|
|
|
|
|
|
|
|
|
|
|
26792 |
|
26793 |
-
workInProgress.
|
26794 |
-
|
26795 |
-
return workInProgress.child;
|
26796 |
}
|
26797 |
|
26798 |
-
function
|
26799 |
-
|
26800 |
-
|
26801 |
-
|
26802 |
-
|
26803 |
-
|
|
|
|
|
|
|
26804 |
|
26805 |
-
|
26806 |
-
|
26807 |
-
|
26808 |
-
|
26809 |
-
|
26810 |
-
|
26811 |
-
//
|
26812 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26813 |
|
26814 |
|
26815 |
-
|
26816 |
|
26817 |
-
|
26818 |
-
|
26819 |
-
|
|
|
|
|
|
|
|
|
|
|
26820 |
} else {
|
26821 |
-
|
26822 |
}
|
26823 |
|
26824 |
-
|
26825 |
-
var instance = workInProgress.stateNode;
|
26826 |
-
var shouldUpdate;
|
26827 |
|
26828 |
-
if (
|
26829 |
-
|
26830 |
-
|
26831 |
-
|
26832 |
-
|
26833 |
-
// committed. Disconnect the alternate pointers.
|
26834 |
-
current.alternate = null;
|
26835 |
-
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
26836 |
|
26837 |
-
|
26838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26839 |
|
|
|
|
|
|
|
26840 |
|
26841 |
-
|
26842 |
-
|
26843 |
-
shouldUpdate = true;
|
26844 |
-
} else if (current === null) {
|
26845 |
-
// In a resume, we'll already have an instance we can reuse.
|
26846 |
-
shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderLanes);
|
26847 |
-
} else {
|
26848 |
-
shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderLanes);
|
26849 |
}
|
26850 |
|
26851 |
-
|
|
|
26852 |
|
26853 |
-
|
26854 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26855 |
|
26856 |
-
|
26857 |
-
if (
|
26858 |
-
|
26859 |
}
|
26860 |
|
26861 |
-
|
26862 |
}
|
26863 |
-
}
|
26864 |
|
26865 |
-
|
|
|
|
|
26866 |
}
|
26867 |
|
26868 |
-
function
|
26869 |
-
//
|
26870 |
-
|
26871 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
26872 |
|
26873 |
-
|
26874 |
-
|
26875 |
-
|
26876 |
-
|
|
|
26877 |
}
|
26878 |
|
26879 |
-
|
26880 |
}
|
26881 |
|
26882 |
-
|
|
|
26883 |
|
26884 |
-
|
26885 |
-
|
|
|
|
|
26886 |
|
26887 |
-
|
26888 |
-
|
26889 |
-
|
26890 |
-
|
26891 |
-
|
26892 |
-
|
26893 |
-
|
26894 |
|
26895 |
-
|
26896 |
-
|
26897 |
-
}
|
26898 |
-
} else {
|
26899 |
-
{
|
26900 |
-
setIsRendering(true);
|
26901 |
-
nextChildren = instance.render();
|
26902 |
|
26903 |
-
|
26904 |
-
|
|
|
|
|
26905 |
|
26906 |
-
|
26907 |
-
|
26908 |
-
|
26909 |
-
|
|
|
|
|
|
|
26910 |
}
|
|
|
|
|
26911 |
}
|
26912 |
-
|
26913 |
-
setIsRendering(false);
|
26914 |
}
|
26915 |
-
}
|
26916 |
-
|
26917 |
-
|
26918 |
-
workInProgress.flags |= PerformedWork;
|
26919 |
-
|
26920 |
-
if (current !== null && didCaptureError) {
|
26921 |
-
// If we're recovering from an error, reconcile without reusing any of
|
26922 |
-
// the existing children. Conceptually, the normal children and the children
|
26923 |
-
// that are shown on error are two different sets, so we shouldn't reuse
|
26924 |
-
// normal children even if their identities match.
|
26925 |
-
forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes);
|
26926 |
-
} else {
|
26927 |
-
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
26928 |
-
} // Memoize state using the values we just used to render.
|
26929 |
-
// TODO: Restructure so we never read values from the instance.
|
26930 |
|
|
|
|
|
|
|
|
|
|
|
26931 |
|
26932 |
-
|
|
|
|
|
26933 |
|
26934 |
-
|
26935 |
-
|
|
|
26936 |
}
|
26937 |
-
|
26938 |
-
return workInProgress.child;
|
26939 |
}
|
26940 |
|
26941 |
-
function
|
26942 |
-
|
26943 |
-
|
26944 |
-
|
26945 |
-
pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
|
26946 |
-
} else if (root.context) {
|
26947 |
-
// Should always be set
|
26948 |
-
pushTopLevelContextObject(workInProgress, root.context, false);
|
26949 |
-
}
|
26950 |
|
26951 |
-
|
26952 |
-
|
26953 |
|
26954 |
-
|
26955 |
-
pushHostRootContext(workInProgress);
|
26956 |
-
var updateQueue = workInProgress.updateQueue;
|
26957 |
|
26958 |
-
|
26959 |
-
{
|
26960 |
-
throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." );
|
26961 |
}
|
26962 |
}
|
26963 |
|
26964 |
-
|
26965 |
-
|
26966 |
-
var prevChildren = prevState !== null ? prevState.element : null;
|
26967 |
-
cloneUpdateQueue(current, workInProgress);
|
26968 |
-
processUpdateQueue(workInProgress, nextProps, null, renderLanes);
|
26969 |
-
var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property
|
26970 |
-
// being called "element".
|
26971 |
|
26972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26973 |
|
26974 |
-
|
26975 |
-
|
26976 |
-
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
26977 |
-
}
|
26978 |
|
26979 |
-
|
|
|
|
|
26980 |
|
26981 |
-
|
26982 |
-
|
26983 |
-
|
26984 |
-
|
26985 |
-
// not hydrating.
|
26986 |
-
{
|
26987 |
-
var mutableSourceEagerHydrationData = root.mutableSourceEagerHydrationData;
|
26988 |
|
26989 |
-
|
26990 |
-
|
26991 |
-
|
26992 |
-
|
26993 |
-
|
26994 |
}
|
26995 |
}
|
26996 |
}
|
|
|
|
|
26997 |
|
26998 |
-
|
26999 |
-
|
27000 |
-
var node = child;
|
27001 |
|
27002 |
-
|
27003 |
-
|
27004 |
-
|
27005 |
-
|
27006 |
-
|
27007 |
-
|
27008 |
-
|
27009 |
-
|
27010 |
-
|
27011 |
-
}
|
27012 |
} else {
|
27013 |
-
//
|
27014 |
-
|
27015 |
-
|
27016 |
-
|
|
|
|
|
|
|
|
|
27017 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27018 |
|
27019 |
-
return workInProgress.child;
|
27020 |
-
}
|
27021 |
|
27022 |
-
function
|
27023 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27024 |
|
27025 |
-
if (
|
27026 |
-
|
27027 |
-
|
|
|
|
|
27028 |
|
27029 |
-
|
27030 |
-
|
27031 |
-
|
27032 |
-
|
27033 |
-
|
|
|
27034 |
|
27035 |
-
|
27036 |
-
// We special case a direct text child of a host node. This is a common
|
27037 |
-
// case. We won't handle it as a reified child. We will instead handle
|
27038 |
-
// this in the host environment that also has access to this prop. That
|
27039 |
-
// avoids allocating another HostText fiber and traversing it.
|
27040 |
-
nextChildren = null;
|
27041 |
-
} else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
|
27042 |
-
// If we're switching from a direct text child to a normal child, or to
|
27043 |
-
// empty, we need to schedule the text content to be reset.
|
27044 |
-
workInProgress.flags |= ContentReset;
|
27045 |
}
|
27046 |
|
27047 |
-
|
27048 |
-
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
27049 |
-
return workInProgress.child;
|
27050 |
-
}
|
27051 |
-
|
27052 |
-
function updateHostText(current, workInProgress) {
|
27053 |
-
if (current === null) {
|
27054 |
-
tryToClaimNextHydratableInstance(workInProgress);
|
27055 |
-
} // Nothing to do here. This is terminal. We'll do the completion step
|
27056 |
-
// immediately after.
|
27057 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27058 |
|
27059 |
-
|
27060 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27061 |
|
27062 |
-
|
27063 |
-
|
27064 |
-
|
27065 |
-
|
27066 |
-
// a new mount, even though an empty version of it already committed.
|
27067 |
-
// Disconnect the alternate pointers.
|
27068 |
-
_current.alternate = null;
|
27069 |
-
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
27070 |
|
27071 |
-
|
27072 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27073 |
|
27074 |
-
|
27075 |
-
|
27076 |
-
var payload = lazyComponent._payload;
|
27077 |
-
var init = lazyComponent._init;
|
27078 |
-
var Component = init(payload); // Store the unwrapped component in the type.
|
27079 |
|
27080 |
-
|
27081 |
-
|
27082 |
-
|
27083 |
-
|
|
|
27084 |
|
27085 |
-
|
27086 |
-
|
27087 |
-
|
27088 |
-
|
27089 |
-
|
27090 |
-
workInProgress.type = Component = resolveFunctionForHotReloading(Component);
|
27091 |
-
}
|
27092 |
|
27093 |
-
child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderLanes);
|
27094 |
-
return child;
|
27095 |
-
}
|
27096 |
|
27097 |
-
|
27098 |
-
|
27099 |
-
|
27100 |
-
|
27101 |
}
|
27102 |
|
27103 |
-
|
27104 |
-
return child;
|
27105 |
-
}
|
27106 |
-
|
27107 |
-
case ForwardRef:
|
27108 |
-
{
|
27109 |
{
|
27110 |
-
workInProgress
|
|
|
|
|
|
|
|
|
27111 |
}
|
27112 |
|
27113 |
-
|
27114 |
-
return child;
|
27115 |
-
}
|
27116 |
-
|
27117 |
-
case MemoComponent:
|
27118 |
-
{
|
27119 |
{
|
27120 |
-
|
27121 |
-
|
27122 |
-
|
27123 |
-
if (outerPropTypes) {
|
27124 |
-
checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only
|
27125 |
-
'prop', getComponentName(Component));
|
27126 |
-
}
|
27127 |
-
}
|
27128 |
}
|
27129 |
-
|
27130 |
-
child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
|
27131 |
-
updateLanes, renderLanes);
|
27132 |
-
return child;
|
27133 |
-
}
|
27134 |
}
|
27135 |
|
27136 |
-
|
27137 |
-
|
27138 |
-
{
|
27139 |
-
if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
|
27140 |
-
hint = ' Did you wrap a component in React.lazy() more than once?';
|
27141 |
-
}
|
27142 |
-
} // This message intentionally doesn't mention ForwardRef or MemoComponent
|
27143 |
-
// because the fact that it's a separate type of work is an
|
27144 |
-
// implementation detail.
|
27145 |
|
|
|
|
|
|
|
27146 |
|
27147 |
-
{
|
27148 |
-
|
27149 |
-
|
27150 |
-
|
|
|
|
|
|
|
|
|
|
|
27151 |
}
|
|
|
|
|
27152 |
}
|
27153 |
|
27154 |
-
|
27155 |
-
if (_current !== null) {
|
27156 |
-
// An incomplete component only mounts if it suspended inside a non-
|
27157 |
-
// concurrent tree, in an inconsistent state. We want to treat it like
|
27158 |
-
// a new mount, even though an empty version of it already committed.
|
27159 |
-
// Disconnect the alternate pointers.
|
27160 |
-
_current.alternate = null;
|
27161 |
-
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
27162 |
|
27163 |
-
|
27164 |
-
|
|
|
|
|
|
|
|
|
27165 |
|
|
|
|
|
|
|
|
|
27166 |
|
27167 |
-
|
27168 |
-
|
27169 |
-
|
27170 |
-
// We will invalidate the child context in finishClassComponent() right after rendering.
|
27171 |
|
27172 |
-
|
27173 |
|
27174 |
-
|
27175 |
-
|
27176 |
-
|
27177 |
-
} else {
|
27178 |
-
hasContext = false;
|
27179 |
}
|
27180 |
|
27181 |
-
|
27182 |
-
constructClassInstance(workInProgress, Component, nextProps);
|
27183 |
-
mountClassInstance(workInProgress, Component, nextProps, renderLanes);
|
27184 |
-
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes);
|
27185 |
-
}
|
27186 |
|
27187 |
-
|
27188 |
-
|
27189 |
-
|
27190 |
-
// concurrent tree, in an inconsistent state. We want to treat it like
|
27191 |
-
// a new mount, even though an empty version of it already committed.
|
27192 |
-
// Disconnect the alternate pointers.
|
27193 |
-
_current.alternate = null;
|
27194 |
-
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
27195 |
|
27196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27197 |
}
|
27198 |
|
27199 |
-
var
|
27200 |
-
|
|
|
|
|
27201 |
|
27202 |
-
|
27203 |
-
var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
27204 |
-
context = getMaskedContext(workInProgress, unmaskedContext);
|
27205 |
-
}
|
27206 |
|
27207 |
-
|
27208 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
27209 |
|
27210 |
{
|
27211 |
-
if (
|
27212 |
-
|
27213 |
-
|
27214 |
-
if
|
27215 |
-
|
|
|
|
|
27216 |
|
27217 |
-
|
|
|
27218 |
}
|
|
|
|
|
27219 |
}
|
|
|
27220 |
|
27221 |
-
|
27222 |
-
|
|
|
|
|
|
|
|
|
27223 |
}
|
|
|
27224 |
|
27225 |
-
|
|
|
|
|
|
|
|
|
27226 |
ReactCurrentOwner$1.current = workInProgress;
|
27227 |
-
|
|
|
27228 |
setIsRendering(false);
|
27229 |
} // React DevTools reads this flag.
|
27230 |
|
27231 |
|
27232 |
workInProgress.flags |= PerformedWork;
|
|
|
|
|
|
|
27233 |
|
27234 |
-
|
27235 |
-
|
27236 |
-
|
27237 |
-
if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
27238 |
-
var _componentName = getComponentName(Component) || 'Unknown';
|
27239 |
|
27240 |
-
|
27241 |
-
|
|
|
|
|
|
|
27242 |
|
27243 |
-
|
27244 |
-
|
27245 |
-
|
27246 |
}
|
27247 |
|
27248 |
-
|
27249 |
-
// Eventually we'll delete this branch altogether.
|
27250 |
-
typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
27251 |
-
{
|
27252 |
-
var _componentName2 = getComponentName(Component) || 'Unknown';
|
27253 |
|
27254 |
-
|
27255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27256 |
|
27257 |
-
|
27258 |
-
|
27259 |
-
|
27260 |
|
|
|
|
|
|
|
|
|
27261 |
|
27262 |
-
workInProgress.tag = ClassComponent; // Throw out any hooks that were used.
|
27263 |
|
27264 |
-
|
27265 |
-
|
27266 |
-
// During mounting we don't know the child context yet as the instance doesn't exist.
|
27267 |
-
// We will invalidate the child context in finishClassComponent() right after rendering.
|
27268 |
|
27269 |
-
|
|
|
|
|
|
|
27270 |
|
27271 |
-
if (
|
27272 |
-
|
27273 |
-
pushContextProvider(workInProgress);
|
27274 |
} else {
|
27275 |
-
|
27276 |
-
}
|
27277 |
-
|
27278 |
-
workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
|
27279 |
-
initializeUpdateQueue(workInProgress);
|
27280 |
-
var getDerivedStateFromProps = Component.getDerivedStateFromProps;
|
27281 |
-
|
27282 |
-
if (typeof getDerivedStateFromProps === 'function') {
|
27283 |
-
applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
|
27284 |
-
}
|
27285 |
-
|
27286 |
-
adoptClassInstance(workInProgress, value);
|
27287 |
-
mountClassInstance(workInProgress, Component, props, renderLanes);
|
27288 |
-
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes);
|
27289 |
-
} else {
|
27290 |
-
// Proceed under the assumption that this is a function component
|
27291 |
-
workInProgress.tag = FunctionComponent;
|
27292 |
|
27293 |
-
|
|
|
|
|
27294 |
|
27295 |
-
|
27296 |
-
|
27297 |
|
27298 |
-
|
27299 |
-
|
27300 |
-
} finally {
|
27301 |
-
reenableLogs();
|
27302 |
}
|
27303 |
}
|
27304 |
-
}
|
27305 |
|
27306 |
-
|
|
|
|
|
27307 |
|
27308 |
-
|
27309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27310 |
}
|
27311 |
|
27312 |
-
|
|
|
|
|
|
|
|
|
27313 |
}
|
27314 |
}
|
27315 |
|
27316 |
-
function
|
|
|
|
|
27317 |
{
|
27318 |
-
if (
|
27319 |
-
|
27320 |
-
|
27321 |
-
}
|
27322 |
}
|
|
|
27323 |
|
27324 |
-
|
27325 |
-
|
27326 |
-
|
27327 |
|
27328 |
-
|
27329 |
-
|
27330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27331 |
|
27332 |
-
|
27333 |
-
|
|
|
|
|
|
|
27334 |
|
27335 |
-
|
27336 |
-
|
27337 |
-
|
27338 |
|
27339 |
-
|
27340 |
-
|
|
|
27341 |
|
27342 |
-
|
27343 |
-
|
27344 |
-
|
27345 |
|
27346 |
-
|
27347 |
-
|
27348 |
|
27349 |
-
|
27350 |
-
|
|
|
27351 |
|
27352 |
-
|
27353 |
-
|
27354 |
-
|
|
|
|
|
|
|
27355 |
|
27356 |
-
|
27357 |
-
|
|
|
|
|
27358 |
|
27359 |
-
|
27360 |
-
|
|
|
|
|
27361 |
|
27362 |
-
didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
|
27363 |
-
}
|
27364 |
-
}
|
27365 |
-
}
|
27366 |
-
}
|
27367 |
|
27368 |
-
var
|
27369 |
-
|
27370 |
-
|
27371 |
-
}
|
27372 |
|
27373 |
-
|
27374 |
-
return {
|
27375 |
-
baseLanes: renderLanes
|
27376 |
-
};
|
27377 |
-
}
|
27378 |
|
27379 |
-
|
27380 |
-
|
27381 |
-
|
27382 |
-
};
|
27383 |
-
} // TODO: Probably should inline this back
|
27384 |
|
|
|
|
|
|
|
|
|
27385 |
|
27386 |
-
function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) {
|
27387 |
-
// If we're already showing a fallback, there are cases where we need to
|
27388 |
-
// remain on that fallback regardless of whether the content has resolved.
|
27389 |
-
// For example, SuspenseList coordinates when nested content appears.
|
27390 |
-
if (current !== null) {
|
27391 |
-
var suspenseState = current.memoizedState;
|
27392 |
|
27393 |
-
|
27394 |
-
|
27395 |
-
// is true. More precise name might be "ForceRemainSuspenseFallback".
|
27396 |
-
// Note: This is a factoring smell. Can't remain on a fallback if there's
|
27397 |
-
// no fallback to remain on.
|
27398 |
-
return false;
|
27399 |
-
}
|
27400 |
-
} // Not currently showing content. Consult the Suspense context.
|
27401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27402 |
|
27403 |
-
|
27404 |
-
}
|
27405 |
|
27406 |
-
|
27407 |
-
|
27408 |
-
|
27409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27410 |
|
27411 |
-
|
27412 |
-
|
27413 |
|
27414 |
-
|
27415 |
-
|
27416 |
-
|
27417 |
-
}
|
27418 |
-
}
|
27419 |
|
27420 |
-
|
27421 |
-
var showFallback = false;
|
27422 |
-
var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
|
27423 |
|
27424 |
-
|
27425 |
-
|
27426 |
-
|
27427 |
-
|
27428 |
-
|
27429 |
-
|
27430 |
-
|
27431 |
-
|
27432 |
-
|
27433 |
-
|
27434 |
-
|
27435 |
-
// Boundaries without fallbacks or should be avoided are not considered since
|
27436 |
-
// they cannot handle preferred fallback states.
|
27437 |
-
if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
|
27438 |
-
suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
|
27439 |
-
}
|
27440 |
-
}
|
27441 |
-
}
|
27442 |
|
27443 |
-
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
27444 |
-
pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense
|
27445 |
-
// boundary's children. This involves some custom reconcilation logic. Two
|
27446 |
-
// main reasons this is so complicated.
|
27447 |
-
//
|
27448 |
-
// First, Legacy Mode has different semantics for backwards compatibility. The
|
27449 |
-
// primary tree will commit in an inconsistent state, so when we do the
|
27450 |
-
// second pass to render the fallback, we do some exceedingly, uh, clever
|
27451 |
-
// hacks to make that not totally break. Like transferring effects and
|
27452 |
-
// deletions from hidden tree. In Concurrent Mode, it's much simpler,
|
27453 |
-
// because we bailout on the primary tree completely and leave it in its old
|
27454 |
-
// state, no effects. Same as what we do for Offscreen (except that
|
27455 |
-
// Offscreen doesn't have the first render pass).
|
27456 |
-
//
|
27457 |
-
// Second is hydration. During hydration, the Suspense fiber has a slightly
|
27458 |
-
// different layout, where the child points to a dehydrated fragment, which
|
27459 |
-
// contains the DOM rendered by the server.
|
27460 |
-
//
|
27461 |
-
// Third, even if you set all that aside, Suspense is like error boundaries in
|
27462 |
-
// that we first we try to render one tree, and if that fails, we render again
|
27463 |
-
// and switch to a different tree. Like a try/catch block. So we have to track
|
27464 |
-
// which branch we're currently rendering. Ideally we would model this using
|
27465 |
-
// a stack.
|
27466 |
|
27467 |
-
|
27468 |
-
|
27469 |
-
|
27470 |
-
|
27471 |
-
if (nextProps.fallback !== undefined) {
|
27472 |
-
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
27473 |
-
}
|
27474 |
|
27475 |
-
var nextPrimaryChildren = nextProps.children;
|
27476 |
-
var nextFallbackChildren = nextProps.fallback;
|
27477 |
|
27478 |
-
|
27479 |
-
var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
27480 |
-
var primaryChildFragment = workInProgress.child;
|
27481 |
-
primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
27482 |
-
workInProgress.memoizedState = SUSPENDED_MARKER;
|
27483 |
-
return fallbackFragment;
|
27484 |
-
} else if (typeof nextProps.unstable_expectedLoadTime === 'number') {
|
27485 |
-
// This is a CPU-bound tree. Skip this tree and show a placeholder to
|
27486 |
-
// unblock the surrounding content. Then immediately retry after the
|
27487 |
-
// initial commit.
|
27488 |
-
var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
27489 |
|
27490 |
-
|
27491 |
-
|
27492 |
-
|
27493 |
-
|
27494 |
-
|
27495 |
-
|
27496 |
-
|
27497 |
-
|
27498 |
-
|
27499 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27500 |
|
27501 |
-
|
|
|
|
|
|
|
|
|
27502 |
|
|
|
27503 |
{
|
27504 |
-
|
|
|
27505 |
}
|
27506 |
|
27507 |
-
|
27508 |
-
|
27509 |
-
|
27510 |
-
|
27511 |
-
|
27512 |
-
|
27513 |
-
|
27514 |
-
// a fallback.
|
27515 |
-
var prevState = current.memoizedState;
|
27516 |
|
27517 |
-
|
|
|
|
|
|
|
27518 |
|
27519 |
-
|
27520 |
-
var _nextFallbackChildren2 = nextProps.fallback;
|
27521 |
-
var _nextPrimaryChildren2 = nextProps.children;
|
27522 |
|
27523 |
-
|
|
|
27524 |
|
27525 |
-
|
27526 |
-
|
27527 |
-
_primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes);
|
27528 |
-
_primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes);
|
27529 |
-
workInProgress.memoizedState = SUSPENDED_MARKER;
|
27530 |
-
return _fallbackChildFragment;
|
27531 |
-
} else {
|
27532 |
-
var _nextPrimaryChildren3 = nextProps.children;
|
27533 |
|
27534 |
-
|
|
|
27535 |
|
27536 |
-
|
27537 |
-
|
27538 |
-
}
|
27539 |
-
} else {
|
27540 |
-
// The current tree is not already showing a fallback.
|
27541 |
-
if (showFallback) {
|
27542 |
-
// Timed out.
|
27543 |
-
var _nextFallbackChildren3 = nextProps.fallback;
|
27544 |
-
var _nextPrimaryChildren4 = nextProps.children;
|
27545 |
|
27546 |
-
|
|
|
27547 |
|
27548 |
-
|
27549 |
-
|
27550 |
-
_primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes);
|
27551 |
-
_primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the
|
27552 |
-
// fallback children.
|
27553 |
|
27554 |
-
|
27555 |
-
|
27556 |
-
|
27557 |
-
|
27558 |
-
// normally do.
|
27559 |
-
var _nextPrimaryChildren5 = nextProps.children;
|
27560 |
|
27561 |
-
var
|
27562 |
|
27563 |
-
workInProgress
|
27564 |
-
return _primaryChildFragment6;
|
27565 |
}
|
27566 |
-
}
|
27567 |
-
}
|
27568 |
-
}
|
27569 |
|
27570 |
-
|
27571 |
-
|
27572 |
-
var primaryChildProps = {
|
27573 |
-
mode: 'visible',
|
27574 |
-
children: primaryChildren
|
27575 |
-
};
|
27576 |
-
var primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, renderLanes, null);
|
27577 |
-
primaryChildFragment.return = workInProgress;
|
27578 |
-
workInProgress.child = primaryChildFragment;
|
27579 |
-
return primaryChildFragment;
|
27580 |
-
}
|
27581 |
|
27582 |
-
|
27583 |
-
|
27584 |
-
var progressedPrimaryFragment = workInProgress.child;
|
27585 |
-
var primaryChildProps = {
|
27586 |
-
mode: 'hidden',
|
27587 |
-
children: primaryChildren
|
27588 |
-
};
|
27589 |
-
var primaryChildFragment;
|
27590 |
-
var fallbackChildFragment;
|
27591 |
|
27592 |
-
|
27593 |
-
|
27594 |
-
// completed, even though it's in an inconsistent state.
|
27595 |
-
primaryChildFragment = progressedPrimaryFragment;
|
27596 |
-
primaryChildFragment.childLanes = NoLanes;
|
27597 |
-
primaryChildFragment.pendingProps = primaryChildProps;
|
27598 |
|
27599 |
-
|
27600 |
-
|
27601 |
-
// final amounts. This seems counterintuitive, since we're intentionally
|
27602 |
-
// not measuring part of the render phase, but this makes it match what we
|
27603 |
-
// do in Concurrent Mode.
|
27604 |
-
primaryChildFragment.actualDuration = 0;
|
27605 |
-
primaryChildFragment.actualStartTime = -1;
|
27606 |
-
primaryChildFragment.selfBaseDuration = 0;
|
27607 |
-
primaryChildFragment.treeBaseDuration = 0;
|
27608 |
-
}
|
27609 |
|
27610 |
-
|
27611 |
-
|
27612 |
-
primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, NoLanes, null);
|
27613 |
-
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null);
|
27614 |
-
}
|
27615 |
|
27616 |
-
|
27617 |
-
|
27618 |
-
|
27619 |
-
|
27620 |
-
return fallbackChildFragment;
|
27621 |
-
}
|
27622 |
|
27623 |
-
|
27624 |
-
// The props argument to `createWorkInProgress` is `any` typed, so we use this
|
27625 |
-
// wrapper function to constrain it.
|
27626 |
-
return createWorkInProgress(current, offscreenProps);
|
27627 |
-
}
|
27628 |
|
27629 |
-
|
27630 |
-
|
27631 |
-
|
27632 |
-
var primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, {
|
27633 |
-
mode: 'visible',
|
27634 |
-
children: primaryChildren
|
27635 |
-
});
|
27636 |
|
27637 |
-
|
27638 |
-
|
27639 |
-
|
|
|
|
|
|
|
27640 |
|
27641 |
-
|
27642 |
-
|
|
|
27643 |
|
27644 |
-
|
27645 |
-
|
27646 |
-
|
27647 |
-
|
27648 |
-
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
|
27649 |
-
}
|
27650 |
|
27651 |
-
|
27652 |
-
|
27653 |
-
|
|
|
27654 |
|
27655 |
-
|
27656 |
-
var mode = workInProgress.mode;
|
27657 |
-
var currentPrimaryChildFragment = current.child;
|
27658 |
-
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
27659 |
-
var primaryChildProps = {
|
27660 |
-
mode: 'hidden',
|
27661 |
-
children: primaryChildren
|
27662 |
-
};
|
27663 |
-
var primaryChildFragment;
|
27664 |
|
27665 |
-
|
27666 |
-
|
27667 |
-
(mode & BlockingMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was
|
27668 |
-
// already cloned. In legacy mode, the only case where this isn't true is
|
27669 |
-
// when DevTools forces us to display a fallback; we skip the first render
|
27670 |
-
// pass entirely and go straight to rendering the fallback. (In Concurrent
|
27671 |
-
// Mode, SuspenseList can also trigger this scenario, but this is a legacy-
|
27672 |
-
// only codepath.)
|
27673 |
-
workInProgress.child !== currentPrimaryChildFragment) {
|
27674 |
-
var progressedPrimaryFragment = workInProgress.child;
|
27675 |
-
primaryChildFragment = progressedPrimaryFragment;
|
27676 |
-
primaryChildFragment.childLanes = NoLanes;
|
27677 |
-
primaryChildFragment.pendingProps = primaryChildProps;
|
27678 |
|
27679 |
-
|
27680 |
-
|
27681 |
-
|
27682 |
-
|
27683 |
-
// do in Concurrent Mode.
|
27684 |
-
primaryChildFragment.actualDuration = 0;
|
27685 |
-
primaryChildFragment.actualStartTime = -1;
|
27686 |
-
primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration;
|
27687 |
-
primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration;
|
27688 |
-
} // The fallback fiber was added as a deletion effect during the first pass.
|
27689 |
-
// However, since we're going to remain on the fallback, we no longer want
|
27690 |
-
// to delete it. So we need to remove it from the list. Deletions are stored
|
27691 |
-
// on the same list as effects. We want to keep the effects from the primary
|
27692 |
-
// tree. So we copy the primary child fragment's effect list, which does not
|
27693 |
-
// include the fallback deletion effect.
|
27694 |
|
|
|
|
|
27695 |
|
27696 |
-
|
|
|
27697 |
|
27698 |
-
|
27699 |
-
|
27700 |
-
workInProgress.lastEffect = progressedLastEffect;
|
27701 |
-
progressedLastEffect.nextEffect = null;
|
27702 |
-
} else {
|
27703 |
-
// TODO: Reset this somewhere else? Lol legacy mode is so weird.
|
27704 |
-
workInProgress.firstEffect = workInProgress.lastEffect = null;
|
27705 |
-
}
|
27706 |
-
} else {
|
27707 |
-
primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps);
|
27708 |
-
}
|
27709 |
|
27710 |
-
|
|
|
27711 |
|
27712 |
-
|
27713 |
-
|
27714 |
-
} else {
|
27715 |
-
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already
|
27716 |
-
// mounted but this is a new fiber.
|
27717 |
|
27718 |
-
|
27719 |
-
|
27720 |
|
27721 |
-
|
27722 |
-
|
27723 |
-
|
27724 |
-
|
27725 |
-
return fallbackChildFragment;
|
27726 |
-
}
|
27727 |
|
27728 |
-
|
27729 |
-
|
27730 |
-
|
|
|
|
|
27731 |
|
27732 |
-
|
27733 |
-
|
|
|
|
|
27734 |
}
|
|
|
27735 |
|
27736 |
-
|
|
|
|
|
|
|
27737 |
}
|
27738 |
|
27739 |
-
function
|
27740 |
-
|
27741 |
-
|
27742 |
-
// to unblock.
|
27743 |
-
var node = firstChild;
|
27744 |
|
27745 |
-
|
27746 |
-
|
27747 |
-
|
|
|
27748 |
|
27749 |
-
|
27750 |
-
|
27751 |
-
|
27752 |
-
|
27753 |
-
|
27754 |
-
|
27755 |
-
// list itself.
|
27756 |
-
// We don't have to traverse to the children of the list since
|
27757 |
-
// the list will propagate the change when it rerenders.
|
27758 |
-
scheduleWorkOnFiber(node, renderLanes);
|
27759 |
-
} else if (node.child !== null) {
|
27760 |
-
node.child.return = node;
|
27761 |
-
node = node.child;
|
27762 |
-
continue;
|
27763 |
-
}
|
27764 |
|
27765 |
-
|
27766 |
-
|
27767 |
-
|
|
|
|
|
|
|
|
|
|
|
27768 |
|
27769 |
-
|
27770 |
-
if (node.return === null || node.return === workInProgress) {
|
27771 |
return;
|
27772 |
}
|
27773 |
|
27774 |
-
node
|
27775 |
-
|
27776 |
-
|
27777 |
-
|
27778 |
-
node = node.sibling;
|
27779 |
-
}
|
27780 |
-
}
|
27781 |
-
|
27782 |
-
function findLastContentRow(firstChild) {
|
27783 |
-
// This is going to find the last row among these children that is already
|
27784 |
-
// showing content on the screen, as opposed to being in fallback state or
|
27785 |
-
// new. If a row has multiple Suspense boundaries, any of them being in the
|
27786 |
-
// fallback state, counts as the whole row being in a fallback state.
|
27787 |
-
// Note that the "rows" will be workInProgress, but any nested children
|
27788 |
-
// will still be current since we haven't rendered them yet. The mounted
|
27789 |
-
// order may not be the same as the new order. We use the new order.
|
27790 |
-
var row = firstChild;
|
27791 |
-
var lastContentRow = null;
|
27792 |
|
27793 |
-
|
27794 |
-
|
27795 |
|
27796 |
-
|
27797 |
-
|
27798 |
}
|
|
|
27799 |
|
27800 |
-
|
27801 |
-
}
|
27802 |
|
27803 |
-
|
27804 |
-
|
|
|
|
|
27805 |
|
27806 |
-
|
27807 |
-
|
27808 |
-
|
27809 |
-
|
|
|
|
|
|
|
|
|
27810 |
|
27811 |
-
if (typeof revealOrder === 'string') {
|
27812 |
-
switch (revealOrder.toLowerCase()) {
|
27813 |
-
case 'together':
|
27814 |
-
case 'forwards':
|
27815 |
-
case 'backwards':
|
27816 |
-
{
|
27817 |
-
error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
|
27818 |
|
27819 |
-
|
27820 |
-
|
|
|
|
|
27821 |
|
27822 |
-
|
27823 |
-
case 'backward':
|
27824 |
-
{
|
27825 |
-
error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
|
27826 |
|
27827 |
-
|
27828 |
-
|
27829 |
|
27830 |
-
|
27831 |
-
|
|
|
|
|
27832 |
|
27833 |
-
|
27834 |
-
|
27835 |
-
|
27836 |
-
|
27837 |
-
}
|
27838 |
}
|
27839 |
-
}
|
27840 |
}
|
27841 |
|
27842 |
-
function
|
27843 |
-
{
|
27844 |
-
|
27845 |
-
|
27846 |
-
|
|
|
27847 |
|
27848 |
-
|
27849 |
-
|
27850 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27851 |
|
27852 |
-
|
27853 |
-
|
27854 |
-
|
27855 |
-
|
27856 |
-
}
|
27857 |
|
27858 |
-
|
27859 |
-
|
27860 |
-
|
27861 |
-
var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
|
27862 |
|
27863 |
-
if (isArray || isIterable) {
|
27864 |
-
var type = isArray ? 'array' : 'iterable';
|
27865 |
|
27866 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27867 |
|
27868 |
-
|
27869 |
-
|
27870 |
-
}
|
27871 |
|
27872 |
-
|
27873 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27874 |
|
27875 |
-
|
27876 |
-
|
27877 |
-
|
27878 |
-
if (Array.isArray(children)) {
|
27879 |
-
for (var i = 0; i < children.length; i++) {
|
27880 |
-
if (!validateSuspenseListNestedChild(children[i], i)) {
|
27881 |
-
return;
|
27882 |
}
|
27883 |
-
}
|
27884 |
-
} else {
|
27885 |
-
var iteratorFn = getIteratorFn(children);
|
27886 |
-
|
27887 |
-
if (typeof iteratorFn === 'function') {
|
27888 |
-
var childrenIterator = iteratorFn.call(children);
|
27889 |
|
27890 |
-
|
27891 |
-
|
27892 |
-
|
27893 |
|
27894 |
-
for (; !step.done; step = childrenIterator.next()) {
|
27895 |
-
if (!validateSuspenseListNestedChild(step.value, _i)) {
|
27896 |
-
return;
|
27897 |
-
}
|
27898 |
|
27899 |
-
|
27900 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27901 |
}
|
27902 |
} else {
|
27903 |
-
|
|
|
|
|
27904 |
}
|
|
|
|
|
27905 |
}
|
27906 |
-
}
|
27907 |
}
|
27908 |
}
|
27909 |
|
27910 |
-
function
|
27911 |
-
var
|
27912 |
-
|
27913 |
-
if (renderState === null) {
|
27914 |
-
workInProgress.memoizedState = {
|
27915 |
-
isBackwards: isBackwards,
|
27916 |
-
rendering: null,
|
27917 |
-
renderingStartTime: 0,
|
27918 |
-
last: lastContentRow,
|
27919 |
-
tail: tail,
|
27920 |
-
tailMode: tailMode,
|
27921 |
-
lastEffect: lastEffectBeforeRendering
|
27922 |
-
};
|
27923 |
-
} else {
|
27924 |
-
// We can reuse the existing object from previous renders.
|
27925 |
-
renderState.isBackwards = isBackwards;
|
27926 |
-
renderState.rendering = null;
|
27927 |
-
renderState.renderingStartTime = 0;
|
27928 |
-
renderState.last = lastContentRow;
|
27929 |
-
renderState.tail = tail;
|
27930 |
-
renderState.tailMode = tailMode;
|
27931 |
-
renderState.lastEffect = lastEffectBeforeRendering;
|
27932 |
-
}
|
27933 |
-
} // This can end up rendering this component multiple passes.
|
27934 |
-
// The first pass splits the children fibers into two sets. A head and tail.
|
27935 |
-
// We first render the head. If anything is in fallback state, we do another
|
27936 |
-
// pass through beginWork to rerender all children (including the tail) with
|
27937 |
-
// the force suspend context. If the first render didn't have anything in
|
27938 |
-
// in fallback state. Then we render each row in the tail one-by-one.
|
27939 |
-
// That happens in the completeWork phase without going back to beginWork.
|
27940 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27941 |
|
27942 |
-
|
27943 |
-
|
27944 |
-
|
27945 |
-
var tailMode = nextProps.tail;
|
27946 |
-
var newChildren = nextProps.children;
|
27947 |
-
validateRevealOrder(revealOrder);
|
27948 |
-
validateTailOptions(tailMode, revealOrder);
|
27949 |
-
validateSuspenseListChildren(newChildren, revealOrder);
|
27950 |
-
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
27951 |
-
var suspenseContext = suspenseStackCursor.current;
|
27952 |
-
var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
27953 |
|
27954 |
-
|
27955 |
-
|
27956 |
-
|
27957 |
-
} else {
|
27958 |
-
var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags;
|
27959 |
|
27960 |
-
|
27961 |
-
|
27962 |
-
// on any nested boundaries to let them know to try to render
|
27963 |
-
// again. This is the same as context updating.
|
27964 |
-
propagateSuspenseContextChange(workInProgress, workInProgress.child, renderLanes);
|
27965 |
-
}
|
27966 |
|
27967 |
-
|
27968 |
-
|
|
|
|
|
|
|
|
|
27969 |
|
27970 |
-
|
|
|
|
|
|
|
27971 |
|
27972 |
-
|
27973 |
-
|
27974 |
-
|
27975 |
-
|
27976 |
-
} else {
|
27977 |
-
switch (revealOrder) {
|
27978 |
-
case 'forwards':
|
27979 |
-
{
|
27980 |
-
var lastContentRow = findLastContentRow(workInProgress.child);
|
27981 |
-
var tail;
|
27982 |
|
27983 |
-
if (
|
27984 |
-
//
|
27985 |
-
//
|
27986 |
-
|
27987 |
-
|
27988 |
-
|
27989 |
-
//
|
27990 |
-
//
|
27991 |
-
|
27992 |
-
|
27993 |
}
|
27994 |
-
|
27995 |
-
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
27996 |
-
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
27997 |
-
break;
|
27998 |
}
|
27999 |
|
28000 |
-
|
28001 |
-
|
28002 |
-
|
28003 |
-
// At the same time we're going to reverse the list of everything
|
28004 |
-
// we pass in the meantime. That's going to be our tail in reverse
|
28005 |
-
// order.
|
28006 |
-
var _tail = null;
|
28007 |
-
var row = workInProgress.child;
|
28008 |
-
workInProgress.child = null;
|
28009 |
-
|
28010 |
-
while (row !== null) {
|
28011 |
-
var currentRow = row.alternate; // New rows can't be content rows.
|
28012 |
-
|
28013 |
-
if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
28014 |
-
// This is the beginning of the main content.
|
28015 |
-
workInProgress.child = row;
|
28016 |
-
break;
|
28017 |
-
}
|
28018 |
-
|
28019 |
-
var nextRow = row.sibling;
|
28020 |
-
row.sibling = _tail;
|
28021 |
-
_tail = row;
|
28022 |
-
row = nextRow;
|
28023 |
-
} // TODO: If workInProgress.child is null, we can continue on the tail immediately.
|
28024 |
-
|
28025 |
|
28026 |
-
|
28027 |
-
|
28028 |
-
|
28029 |
-
|
28030 |
-
|
28031 |
|
28032 |
-
|
28033 |
-
|
28034 |
-
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
28035 |
-
null, // tail
|
28036 |
-
null, // last
|
28037 |
-
undefined, workInProgress.lastEffect);
|
28038 |
-
break;
|
28039 |
-
}
|
28040 |
|
28041 |
-
|
28042 |
-
|
28043 |
-
|
28044 |
-
|
28045 |
-
|
28046 |
-
|
28047 |
-
|
28048 |
-
|
|
|
|
|
28049 |
|
28050 |
-
return workInProgress.child;
|
28051 |
-
}
|
28052 |
|
28053 |
-
|
28054 |
-
|
28055 |
-
var nextChildren = workInProgress.pendingProps;
|
28056 |
|
28057 |
-
|
28058 |
-
|
28059 |
-
|
28060 |
-
|
28061 |
-
// the root always starts with a "current" with a null child.
|
28062 |
-
// TODO: Consider unifying this with how the root works.
|
28063 |
-
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes);
|
28064 |
-
} else {
|
28065 |
-
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
28066 |
-
}
|
28067 |
|
28068 |
-
|
28069 |
-
}
|
28070 |
|
28071 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28072 |
|
28073 |
-
|
28074 |
-
|
28075 |
-
|
28076 |
-
|
28077 |
-
var oldProps = workInProgress.memoizedProps;
|
28078 |
-
var newValue = newProps.value;
|
28079 |
|
28080 |
-
|
28081 |
-
|
28082 |
-
|
28083 |
-
|
|
|
28084 |
|
28085 |
-
|
28086 |
}
|
28087 |
-
}
|
28088 |
-
|
28089 |
-
var providerPropTypes = workInProgress.type.propTypes;
|
28090 |
-
|
28091 |
-
if (providerPropTypes) {
|
28092 |
-
checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider');
|
28093 |
-
}
|
28094 |
-
}
|
28095 |
|
28096 |
-
|
|
|
|
|
28097 |
|
28098 |
-
|
28099 |
-
|
28100 |
-
|
28101 |
|
28102 |
-
|
28103 |
-
|
28104 |
-
|
28105 |
-
|
28106 |
-
|
28107 |
-
|
28108 |
-
|
28109 |
-
|
28110 |
-
propagateContextChange(workInProgress, context, changedBits, renderLanes);
|
28111 |
-
}
|
28112 |
-
}
|
28113 |
|
28114 |
-
|
28115 |
-
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
28116 |
-
return workInProgress.child;
|
28117 |
-
}
|
28118 |
|
28119 |
-
var
|
28120 |
|
28121 |
-
|
28122 |
-
var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In
|
28123 |
-
// DEV mode, we create a separate object for Context.Consumer that acts
|
28124 |
-
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
28125 |
-
// so we use the old behaviour (Context.Consumer references Context) to
|
28126 |
-
// reduce size and overhead. The separate object references context via
|
28127 |
-
// a property called "_context", which also gives us the ability to check
|
28128 |
-
// in DEV mode if this property exists or not and warn if it does not.
|
28129 |
|
28130 |
-
|
28131 |
-
if (context._context === undefined) {
|
28132 |
-
// This may be because it's a Context (rather than a Consumer).
|
28133 |
-
// Or it may be because it's older React where they're the same thing.
|
28134 |
-
// We only want to warn if we're sure it's a new React.
|
28135 |
-
if (context !== context.Consumer) {
|
28136 |
-
if (!hasWarnedAboutUsingContextAsConsumer) {
|
28137 |
-
hasWarnedAboutUsingContextAsConsumer = true;
|
28138 |
|
28139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
28140 |
}
|
28141 |
-
}
|
28142 |
-
} else {
|
28143 |
-
context = context._context;
|
28144 |
-
}
|
28145 |
-
}
|
28146 |
|
28147 |
-
|
28148 |
-
|
28149 |
|
28150 |
-
|
28151 |
-
|
28152 |
-
|
28153 |
-
|
28154 |
-
}
|
28155 |
|
28156 |
-
|
28157 |
-
|
28158 |
-
|
28159 |
|
28160 |
-
|
28161 |
-
|
28162 |
-
|
28163 |
-
newChildren = render(newValue);
|
28164 |
-
setIsRendering(false);
|
28165 |
-
} // React DevTools reads this flag.
|
28166 |
|
|
|
|
|
28167 |
|
28168 |
-
|
28169 |
-
|
28170 |
-
return workInProgress.child;
|
28171 |
-
}
|
28172 |
|
28173 |
-
|
28174 |
-
|
28175 |
-
|
|
|
|
|
|
|
|
|
|
|
28176 |
|
28177 |
-
|
28178 |
-
|
28179 |
-
|
28180 |
-
|
28181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28182 |
|
28183 |
-
|
28184 |
-
|
28185 |
-
|
28186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28187 |
|
28188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28189 |
|
28190 |
-
|
28191 |
-
|
28192 |
-
// TODO: Once we add back resuming, we should check if the children are
|
28193 |
-
// a work-in-progress set. If so, we need to transfer their effects.
|
28194 |
-
return null;
|
28195 |
-
} else {
|
28196 |
-
// This fiber doesn't have work, but its subtree does. Clone the child
|
28197 |
-
// fibers and continue.
|
28198 |
-
cloneChildFibers(current, workInProgress);
|
28199 |
-
return workInProgress.child;
|
28200 |
-
}
|
28201 |
-
}
|
28202 |
|
28203 |
-
|
28204 |
-
|
28205 |
-
|
28206 |
|
28207 |
-
|
28208 |
-
|
28209 |
-
|
28210 |
-
// It will get deleted.
|
28211 |
|
|
|
28212 |
|
28213 |
-
|
28214 |
-
|
|
|
|
|
28215 |
|
28216 |
-
|
28217 |
-
|
28218 |
-
|
28219 |
-
|
|
|
28220 |
|
28221 |
-
|
28222 |
-
|
28223 |
-
|
28224 |
-
var prevSibling = returnFiber.child;
|
28225 |
|
28226 |
-
|
28227 |
-
throw new Error('Expected parent to have a child.');
|
28228 |
}
|
28229 |
|
28230 |
-
|
28231 |
-
|
|
|
|
|
28232 |
|
28233 |
-
if (
|
28234 |
-
|
|
|
|
|
28235 |
}
|
28236 |
-
}
|
28237 |
-
|
28238 |
-
prevSibling.sibling = newWorkInProgress;
|
28239 |
-
} // Delete the old fiber and place the new one.
|
28240 |
-
// Since the old fiber is disconnected, we have to schedule it manually.
|
28241 |
|
|
|
|
|
28242 |
|
28243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28244 |
|
28245 |
-
|
28246 |
-
|
28247 |
-
returnFiber.lastEffect = current;
|
28248 |
-
} else {
|
28249 |
-
returnFiber.firstEffect = returnFiber.lastEffect = current;
|
28250 |
-
}
|
28251 |
|
28252 |
-
|
28253 |
-
|
28254 |
-
newWorkInProgress.flags |= Placement; // Restart work from the new fiber.
|
28255 |
|
28256 |
-
|
28257 |
-
|
28258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28259 |
|
28260 |
-
|
28261 |
-
var updateLanes = workInProgress.lanes;
|
28262 |
|
28263 |
-
|
28264 |
-
|
28265 |
-
|
28266 |
-
|
28267 |
-
|
28268 |
-
|
28269 |
|
28270 |
-
if (current !== null) {
|
28271 |
-
var oldProps = current.memoizedProps;
|
28272 |
-
var newProps = workInProgress.pendingProps;
|
28273 |
|
28274 |
-
|
28275 |
-
|
28276 |
-
|
28277 |
-
// This may be unset if the props are determined to be equal later (memo).
|
28278 |
-
didReceiveUpdate = true;
|
28279 |
-
} else if (!includesSomeLane(renderLanes, updateLanes)) {
|
28280 |
-
didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering
|
28281 |
-
// the begin phase. There's still some bookkeeping we that needs to be done
|
28282 |
-
// in this optimized path, mostly pushing stuff onto the stack.
|
28283 |
|
28284 |
-
|
28285 |
-
case HostRoot:
|
28286 |
-
pushHostRootContext(workInProgress);
|
28287 |
-
resetHydrationState();
|
28288 |
-
break;
|
28289 |
|
28290 |
-
|
28291 |
-
|
28292 |
-
break;
|
28293 |
|
28294 |
-
|
28295 |
-
|
28296 |
-
|
28297 |
|
28298 |
-
|
28299 |
-
|
28300 |
}
|
28301 |
|
28302 |
-
|
28303 |
-
|
28304 |
-
|
28305 |
-
|
28306 |
-
|
28307 |
-
|
28308 |
-
|
28309 |
-
|
28310 |
-
|
28311 |
-
|
28312 |
-
|
28313 |
-
|
28314 |
-
|
28315 |
-
|
28316 |
-
case Profiler:
|
28317 |
-
{
|
28318 |
-
// Profiler should only call onRender when one of its descendants actually rendered.
|
28319 |
-
var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
28320 |
|
28321 |
-
|
28322 |
-
workInProgress.flags |= Update;
|
28323 |
-
} // Reset effect durations for the next eventual effect phase.
|
28324 |
-
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
28325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28326 |
|
28327 |
-
|
28328 |
-
|
28329 |
-
|
28330 |
-
|
28331 |
|
28332 |
-
|
|
|
|
|
|
|
28333 |
|
28334 |
-
|
28335 |
-
{
|
28336 |
-
var state = workInProgress.memoizedState;
|
28337 |
|
28338 |
-
|
28339 |
-
|
28340 |
-
|
28341 |
-
|
28342 |
|
|
|
28343 |
|
28344 |
-
|
28345 |
-
|
|
|
|
|
|
|
|
|
28346 |
|
28347 |
-
|
28348 |
-
|
28349 |
-
|
28350 |
-
return updateSuspenseComponent(current, workInProgress, renderLanes);
|
28351 |
-
} else {
|
28352 |
-
// The primary child fragment does not have pending work marked
|
28353 |
-
// on it
|
28354 |
-
pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient
|
28355 |
-
// priority. Bailout.
|
28356 |
|
28357 |
-
var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
28358 |
|
28359 |
-
if (child !== null) {
|
28360 |
-
// The fallback children have pending work. Skip over the
|
28361 |
-
// primary children and work on the fallback.
|
28362 |
-
return child.sibling;
|
28363 |
-
} else {
|
28364 |
return null;
|
28365 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28366 |
}
|
28367 |
-
} else {
|
28368 |
-
pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
28369 |
}
|
28370 |
-
|
28371 |
-
break;
|
28372 |
}
|
28373 |
|
28374 |
-
|
28375 |
-
|
28376 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28377 |
|
28378 |
-
|
|
|
|
|
|
|
|
|
28379 |
|
28380 |
-
|
28381 |
-
|
28382 |
-
|
28383 |
-
// same children then we're still in progressive loading state.
|
28384 |
-
// Something might get unblocked by state updates or retries in the
|
28385 |
-
// tree which will affect the tail. So we need to use the normal
|
28386 |
-
// path to compute the correct tail.
|
28387 |
-
return updateSuspenseListComponent(current, workInProgress, renderLanes);
|
28388 |
-
} // If none of the children had any work, that means that none of
|
28389 |
-
// them got retried so they'll still be blocked in the same way
|
28390 |
-
// as before. We can fast bail out.
|
28391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28392 |
|
28393 |
-
|
28394 |
-
} // If nothing suspended before and we're rendering the same children,
|
28395 |
-
// then the tail doesn't matter. Anything new that suspends will work
|
28396 |
-
// in the "together" mode, so we can continue from the state we had.
|
28397 |
|
|
|
|
|
|
|
|
|
|
|
28398 |
|
28399 |
-
|
28400 |
|
28401 |
-
|
28402 |
-
|
28403 |
-
// update in the past but didn't complete it.
|
28404 |
-
renderState.rendering = null;
|
28405 |
-
renderState.tail = null;
|
28406 |
-
renderState.lastEffect = null;
|
28407 |
-
}
|
28408 |
|
28409 |
-
|
|
|
28410 |
|
28411 |
-
|
28412 |
-
|
28413 |
-
} else {
|
28414 |
-
// If none of the children had any work, that means that none of
|
28415 |
-
// them got retried so they'll still be blocked in the same way
|
28416 |
-
// as before. We can fast bail out.
|
28417 |
-
return null;
|
28418 |
-
}
|
28419 |
-
}
|
28420 |
|
28421 |
-
|
28422 |
-
case LegacyHiddenComponent:
|
28423 |
-
{
|
28424 |
-
// Need to check if the tree still needs to be deferred. This is
|
28425 |
-
// almost identical to the logic used in the normal update path,
|
28426 |
-
// so we'll just enter that. The only difference is we'll bail out
|
28427 |
-
// at the next level instead of this one, because the child props
|
28428 |
-
// have not changed. Which is fine.
|
28429 |
-
// TODO: Probably should refactor `beginWork` to split the bailout
|
28430 |
-
// path from the normal path. I'm tempted to do a labeled break here
|
28431 |
-
// but I won't :)
|
28432 |
-
workInProgress.lanes = NoLanes;
|
28433 |
-
return updateOffscreenComponent(current, workInProgress, renderLanes);
|
28434 |
-
}
|
28435 |
}
|
28436 |
|
28437 |
-
|
28438 |
-
|
28439 |
-
|
28440 |
-
|
28441 |
-
// See https://github.com/facebook/react/pull/19216.
|
28442 |
-
didReceiveUpdate = true;
|
28443 |
-
} else {
|
28444 |
-
// An update was scheduled on this fiber, but there are no new props
|
28445 |
-
// nor legacy context. Set this to false. If an update queue or context
|
28446 |
-
// consumer produces a changed value, it will set this to true. Otherwise,
|
28447 |
-
// the component will assume the children have not changed and bail out.
|
28448 |
-
didReceiveUpdate = false;
|
28449 |
}
|
28450 |
-
}
|
28451 |
-
} else {
|
28452 |
-
didReceiveUpdate = false;
|
28453 |
-
} // Before entering the begin phase, clear pending update priority.
|
28454 |
-
// TODO: This assumes that we're about to evaluate the component and process
|
28455 |
-
// the update queue. However, there's an exception: SimpleMemoComponent
|
28456 |
-
// sometimes bails out later in the begin phase. This indicates that we should
|
28457 |
-
// move this assignment out of the common path and into each branch.
|
28458 |
|
|
|
28459 |
|
28460 |
-
|
28461 |
|
28462 |
-
|
28463 |
-
case
|
28464 |
{
|
28465 |
-
|
28466 |
-
}
|
28467 |
|
28468 |
-
|
28469 |
-
|
28470 |
-
|
28471 |
-
|
28472 |
-
|
28473 |
|
28474 |
-
|
28475 |
-
|
28476 |
-
|
28477 |
-
|
28478 |
-
|
28479 |
-
return
|
28480 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28481 |
|
|
|
|
|
28482 |
case ClassComponent:
|
28483 |
{
|
28484 |
-
var
|
28485 |
-
var _unresolvedProps = workInProgress.pendingProps;
|
28486 |
-
|
28487 |
-
var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
28488 |
|
28489 |
-
|
28490 |
-
|
|
|
28491 |
|
28492 |
-
|
28493 |
-
return updateHostRoot(current, workInProgress, renderLanes);
|
28494 |
|
28495 |
-
|
28496 |
-
|
28497 |
|
28498 |
-
|
28499 |
-
|
|
|
28500 |
|
28501 |
-
|
28502 |
-
|
28503 |
|
28504 |
-
|
28505 |
-
|
28506 |
|
28507 |
-
case
|
28508 |
{
|
28509 |
-
|
28510 |
-
|
|
|
|
|
28511 |
|
28512 |
-
|
|
|
|
|
|
|
|
|
28513 |
|
28514 |
-
|
|
|
28515 |
}
|
28516 |
|
28517 |
-
case
|
28518 |
-
|
|
|
|
|
|
|
|
|
28519 |
|
28520 |
-
case
|
28521 |
-
|
|
|
28522 |
|
28523 |
-
|
28524 |
-
return updateProfiler(current, workInProgress, renderLanes);
|
28525 |
|
28526 |
-
|
28527 |
-
|
28528 |
|
28529 |
-
|
28530 |
-
|
|
|
28531 |
|
28532 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
28533 |
{
|
28534 |
-
|
28535 |
-
|
28536 |
|
28537 |
-
|
|
|
28538 |
|
28539 |
-
|
28540 |
-
|
28541 |
-
|
28542 |
|
28543 |
-
|
28544 |
-
|
28545 |
-
|
28546 |
-
}
|
28547 |
-
}
|
28548 |
-
}
|
28549 |
|
28550 |
-
|
28551 |
-
|
28552 |
-
|
|
|
28553 |
|
28554 |
-
|
28555 |
-
|
28556 |
-
|
28557 |
-
|
28558 |
|
28559 |
-
|
|
|
|
|
28560 |
{
|
28561 |
-
var
|
28562 |
-
var _unresolvedProps4 = workInProgress.pendingProps;
|
28563 |
|
28564 |
-
|
|
|
|
|
28565 |
|
28566 |
-
|
28567 |
}
|
28568 |
|
28569 |
-
case
|
28570 |
{
|
28571 |
-
|
|
|
|
|
|
|
28572 |
}
|
28573 |
|
28574 |
-
case
|
28575 |
{
|
28576 |
-
|
28577 |
break;
|
28578 |
}
|
28579 |
|
28580 |
-
case
|
28581 |
-
|
|
|
28582 |
|
28583 |
-
|
28584 |
-
|
|
|
28585 |
|
28586 |
-
case
|
28587 |
-
|
|
|
28588 |
|
28589 |
-
|
28590 |
-
|
|
|
28591 |
|
28592 |
case OffscreenComponent:
|
28593 |
-
{
|
28594 |
-
return updateOffscreenComponent(current, workInProgress, renderLanes);
|
28595 |
-
}
|
28596 |
-
|
28597 |
case LegacyHiddenComponent:
|
28598 |
-
|
28599 |
-
|
28600 |
-
}
|
28601 |
-
}
|
28602 |
-
|
28603 |
-
{
|
28604 |
-
{
|
28605 |
-
throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
|
28606 |
-
}
|
28607 |
}
|
28608 |
}
|
28609 |
|
28610 |
-
function
|
28611 |
-
//
|
28612 |
-
//
|
28613 |
-
|
|
|
|
|
|
|
|
|
28614 |
}
|
28615 |
|
28616 |
-
|
28617 |
-
|
|
|
|
|
|
|
28618 |
}
|
28619 |
|
28620 |
-
|
28621 |
-
|
28622 |
-
var
|
28623 |
-
|
28624 |
|
28625 |
-
{
|
28626 |
-
|
28627 |
-
|
28628 |
-
// We only have the top Fiber that was created but we need recurse down its
|
28629 |
-
// children to find all the terminal nodes.
|
28630 |
-
var node = workInProgress.child;
|
28631 |
|
28632 |
-
|
28633 |
-
if (node.tag === HostComponent || node.tag === HostText) {
|
28634 |
-
appendInitialChild(parent, node.stateNode);
|
28635 |
-
} else if (node.tag === HostPortal) ; else if (node.child !== null) {
|
28636 |
-
node.child.return = node;
|
28637 |
-
node = node.child;
|
28638 |
-
continue;
|
28639 |
-
}
|
28640 |
|
28641 |
-
|
28642 |
-
|
28643 |
-
|
|
|
|
|
|
|
28644 |
|
28645 |
-
|
28646 |
-
if (
|
|
|
|
|
|
|
28647 |
return;
|
28648 |
-
}
|
|
|
|
|
|
|
28649 |
|
28650 |
-
node = node.return;
|
28651 |
-
}
|
28652 |
|
28653 |
-
|
28654 |
-
|
28655 |
-
|
28656 |
-
|
28657 |
|
28658 |
-
|
28659 |
-
|
|
|
|
|
28660 |
|
28661 |
-
|
28662 |
-
|
28663 |
-
|
28664 |
-
|
|
|
28665 |
|
28666 |
-
|
28667 |
-
//
|
28668 |
-
//
|
28669 |
-
|
28670 |
-
} // If we get updated because one of our children updated, we don't
|
28671 |
-
// have newProps so we'll have to reuse them.
|
28672 |
-
// TODO: Split the update API as separate for the props vs. children.
|
28673 |
-
// Even better would be if children weren't special cased at all tho.
|
28674 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28675 |
|
28676 |
-
|
28677 |
-
var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host
|
28678 |
-
// component is hitting the resume path. Figure out why. Possibly
|
28679 |
-
// related to `hidden`.
|
28680 |
|
28681 |
-
|
|
|
28682 |
|
28683 |
-
|
28684 |
-
|
28685 |
|
28686 |
-
|
28687 |
-
|
28688 |
-
}
|
28689 |
};
|
|
|
28690 |
|
28691 |
-
|
28692 |
-
|
28693 |
-
|
28694 |
-
markUpdate(workInProgress);
|
28695 |
-
}
|
28696 |
};
|
28697 |
-
}
|
28698 |
-
|
28699 |
-
function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
28700 |
-
if (getIsHydrating()) {
|
28701 |
-
// If we're hydrating, we should consume as many items as we can
|
28702 |
-
// so we don't leave any behind.
|
28703 |
-
return;
|
28704 |
-
}
|
28705 |
-
|
28706 |
-
switch (renderState.tailMode) {
|
28707 |
-
case 'hidden':
|
28708 |
-
{
|
28709 |
-
// Any insertions at the end of the tail list after this point
|
28710 |
-
// should be invisible. If there are already mounted boundaries
|
28711 |
-
// anything before them are not considered for collapsing.
|
28712 |
-
// Therefore we need to go through the whole tail to find if
|
28713 |
-
// there are any.
|
28714 |
-
var tailNode = renderState.tail;
|
28715 |
-
var lastTailNode = null;
|
28716 |
|
28717 |
-
|
28718 |
-
|
28719 |
-
lastTailNode = tailNode;
|
28720 |
-
}
|
28721 |
|
28722 |
-
|
28723 |
-
|
28724 |
-
|
|
|
28725 |
|
|
|
|
|
28726 |
|
28727 |
-
|
28728 |
-
|
28729 |
-
|
28730 |
-
|
28731 |
-
|
28732 |
-
// inserted.
|
28733 |
-
lastTailNode.sibling = null;
|
28734 |
-
}
|
28735 |
|
28736 |
-
|
28737 |
-
}
|
28738 |
|
28739 |
-
|
|
|
28740 |
{
|
28741 |
-
|
28742 |
-
|
28743 |
-
// anything before them are not considered for collapsing.
|
28744 |
-
// Therefore we need to go through the whole tail to find if
|
28745 |
-
// there are any.
|
28746 |
-
var _tailNode = renderState.tail;
|
28747 |
-
var _lastTailNode = null;
|
28748 |
|
28749 |
-
|
28750 |
-
|
28751 |
-
|
28752 |
-
|
|
|
|
|
|
|
28753 |
|
28754 |
-
|
28755 |
-
|
28756 |
-
// last rendered item.
|
28757 |
|
|
|
|
|
|
|
|
|
|
|
28758 |
|
28759 |
-
|
28760 |
-
|
28761 |
-
|
28762 |
-
|
28763 |
-
|
28764 |
-
|
28765 |
-
|
28766 |
-
renderState.tail = null;
|
28767 |
}
|
28768 |
-
} else {
|
28769 |
-
// Detach the insertion after the last node that was already
|
28770 |
-
// inserted.
|
28771 |
-
_lastTailNode.sibling = null;
|
28772 |
}
|
28773 |
-
|
28774 |
-
break;
|
28775 |
}
|
|
|
|
|
|
|
|
|
|
|
28776 |
}
|
28777 |
-
}
|
28778 |
|
28779 |
-
|
28780 |
-
|
28781 |
|
28782 |
-
|
28783 |
-
|
28784 |
-
|
28785 |
-
|
28786 |
-
|
28787 |
-
|
28788 |
-
case Fragment:
|
28789 |
-
case Mode:
|
28790 |
-
case Profiler:
|
28791 |
-
case ContextConsumer:
|
28792 |
-
case MemoComponent:
|
28793 |
-
return null;
|
28794 |
|
28795 |
-
|
28796 |
-
|
28797 |
-
|
|
|
|
|
|
|
28798 |
|
28799 |
-
|
28800 |
-
|
28801 |
-
|
|
|
|
|
28802 |
|
28803 |
-
|
28804 |
-
|
|
|
|
|
|
|
|
|
|
|
28805 |
|
28806 |
-
|
28807 |
-
|
28808 |
-
|
28809 |
-
popTopLevelContextObject(workInProgress);
|
28810 |
-
resetWorkInProgressVersions();
|
28811 |
-
var fiberRoot = workInProgress.stateNode;
|
28812 |
|
28813 |
-
|
28814 |
-
fiberRoot.context = fiberRoot.pendingContext;
|
28815 |
-
fiberRoot.pendingContext = null;
|
28816 |
-
}
|
28817 |
|
28818 |
-
|
28819 |
-
|
28820 |
-
|
28821 |
-
var wasHydrated = popHydrationState(workInProgress);
|
28822 |
|
28823 |
-
|
28824 |
-
|
28825 |
-
|
28826 |
-
|
28827 |
-
} else if (!fiberRoot.hydrate) {
|
28828 |
-
// Schedule an effect to clear this container at the start of the next commit.
|
28829 |
-
// This handles the case of React rendering into a container with previous children.
|
28830 |
-
// It's also safe to do for updates too, because current.child would only be null
|
28831 |
-
// if the previous render was null (so the the container would already be empty).
|
28832 |
-
workInProgress.flags |= Snapshot;
|
28833 |
-
}
|
28834 |
-
}
|
28835 |
|
28836 |
-
|
28837 |
-
|
|
|
|
|
|
|
|
|
|
|
28838 |
}
|
|
|
28839 |
|
28840 |
-
|
28841 |
-
{
|
28842 |
-
popHostContext(workInProgress);
|
28843 |
-
var rootContainerInstance = getRootHostContainer();
|
28844 |
-
var type = workInProgress.type;
|
28845 |
|
28846 |
-
|
28847 |
-
updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
|
28848 |
|
28849 |
-
|
28850 |
-
|
28851 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28852 |
} else {
|
28853 |
-
|
28854 |
-
|
28855 |
-
|
28856 |
-
|
28857 |
-
|
28858 |
-
|
|
|
|
|
|
|
28859 |
|
28860 |
|
28861 |
-
|
28862 |
-
|
|
|
|
|
|
|
28863 |
|
28864 |
-
|
28865 |
-
// "stack" as the parent. Then append children as we go in beginWork
|
28866 |
-
// or completeWork depending on whether we want to add them top->down or
|
28867 |
-
// bottom->up. Top->down is faster in IE11.
|
28868 |
|
28869 |
-
|
|
|
28870 |
|
28871 |
-
|
28872 |
-
|
28873 |
-
|
28874 |
-
|
28875 |
-
|
28876 |
-
|
28877 |
-
|
|
|
|
|
|
|
|
|
|
|
28878 |
}
|
28879 |
-
}
|
28880 |
-
|
28881 |
-
|
28882 |
-
|
28883 |
-
|
28884 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28885 |
|
28886 |
-
if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) {
|
28887 |
-
markUpdate(workInProgress);
|
28888 |
-
}
|
28889 |
-
}
|
28890 |
|
28891 |
-
|
28892 |
-
|
28893 |
-
|
28894 |
-
|
28895 |
-
|
|
|
28896 |
|
28897 |
-
return null;
|
28898 |
-
}
|
28899 |
|
28900 |
-
|
28901 |
-
|
28902 |
-
|
28903 |
|
28904 |
-
if (current && workInProgress.stateNode != null) {
|
28905 |
-
var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need
|
28906 |
-
// to schedule a side-effect to do the updates.
|
28907 |
|
28908 |
-
|
28909 |
-
|
28910 |
-
|
28911 |
-
|
28912 |
-
{
|
28913 |
-
throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." );
|
28914 |
-
}
|
28915 |
-
} // This can happen when we abort work.
|
28916 |
|
28917 |
-
}
|
28918 |
|
28919 |
-
|
|
|
|
|
28920 |
|
28921 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28922 |
|
28923 |
-
var
|
28924 |
|
28925 |
-
|
28926 |
-
|
28927 |
-
markUpdate(workInProgress);
|
28928 |
-
}
|
28929 |
-
} else {
|
28930 |
-
workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
|
28931 |
-
}
|
28932 |
}
|
28933 |
|
28934 |
-
|
28935 |
-
|
28936 |
-
|
28937 |
-
|
28938 |
-
|
28939 |
-
popSuspenseContext(workInProgress);
|
28940 |
-
var nextState = workInProgress.memoizedState;
|
28941 |
|
28942 |
-
if ((workInProgress.flags & DidCapture) !==
|
28943 |
-
|
28944 |
-
workInProgress.lanes = renderLanes; // Do not reset the effect list.
|
28945 |
|
28946 |
-
|
28947 |
-
transferActualDuration(workInProgress);
|
28948 |
-
}
|
28949 |
|
28950 |
-
|
28951 |
-
}
|
28952 |
|
28953 |
-
|
28954 |
-
var prevDidTimeout = false;
|
28955 |
|
28956 |
-
|
28957 |
-
|
28958 |
-
popHydrationState(workInProgress);
|
28959 |
-
}
|
28960 |
-
} else {
|
28961 |
-
var prevState = current.memoizedState;
|
28962 |
-
prevDidTimeout = prevState !== null;
|
28963 |
}
|
28964 |
|
28965 |
-
|
28966 |
-
|
28967 |
-
// otherwise we won't suspend.
|
28968 |
-
// TODO: This will still suspend a synchronous tree if anything
|
28969 |
-
// in the concurrent tree already suspended during this render.
|
28970 |
-
// This is a known bug.
|
28971 |
-
if ((workInProgress.mode & BlockingMode) !== NoMode) {
|
28972 |
-
// TODO: Move this back to throwException because this is too late
|
28973 |
-
// if this is a large tree which is common for initial loads. We
|
28974 |
-
// don't know if we should restart a render or not until we get
|
28975 |
-
// this marker, and this is too late.
|
28976 |
-
// If this render already had a ping or lower pri updates,
|
28977 |
-
// and this is the first time we know we're going to suspend we
|
28978 |
-
// should be able to immediately restart from within throwException.
|
28979 |
-
var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
|
28980 |
|
28981 |
-
|
28982 |
-
|
28983 |
-
|
28984 |
-
renderDidSuspend();
|
28985 |
-
} else {
|
28986 |
-
// Otherwise, we're going to have to hide content so we should
|
28987 |
-
// suspend for longer if possible.
|
28988 |
-
renderDidSuspendDelayIfPossible();
|
28989 |
-
}
|
28990 |
-
}
|
28991 |
-
}
|
28992 |
|
28993 |
-
|
28994 |
-
// TODO: Only schedule updates if these values are non equal, i.e. it changed.
|
28995 |
-
if (nextDidTimeout || prevDidTimeout) {
|
28996 |
-
// If this boundary just timed out, schedule an effect to attach a
|
28997 |
-
// retry listener to the promise. This flag is also used to hide the
|
28998 |
-
// primary children. In mutation mode, we also need the flag to
|
28999 |
-
// *unhide* children that were previously hidden, so check if this
|
29000 |
-
// is currently timed out, too.
|
29001 |
-
workInProgress.flags |= Update;
|
29002 |
-
}
|
29003 |
-
}
|
29004 |
|
29005 |
-
|
29006 |
-
|
|
|
29007 |
|
29008 |
-
|
29009 |
-
popHostContainer(workInProgress);
|
29010 |
-
updateHostContainer(workInProgress);
|
29011 |
|
29012 |
-
|
29013 |
-
|
29014 |
-
|
29015 |
|
29016 |
-
|
|
|
|
|
|
|
29017 |
|
29018 |
-
case ContextProvider:
|
29019 |
-
// Pop provider fiber
|
29020 |
-
popProvider(workInProgress);
|
29021 |
-
return null;
|
29022 |
|
29023 |
-
|
29024 |
-
|
29025 |
-
|
29026 |
-
// sequential to ensure this switch is compiled to a jump table.
|
29027 |
-
var _Component = workInProgress.type;
|
29028 |
|
29029 |
-
|
29030 |
-
|
29031 |
-
|
|
|
|
|
|
|
29032 |
|
29033 |
-
|
29034 |
-
|
29035 |
|
29036 |
-
|
|
|
29037 |
{
|
29038 |
-
|
29039 |
-
var renderState = workInProgress.memoizedState;
|
29040 |
|
29041 |
-
if (
|
29042 |
-
|
29043 |
-
|
29044 |
-
return null;
|
29045 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
29046 |
|
29047 |
-
|
29048 |
-
|
29049 |
-
|
29050 |
-
if (renderedTail === null) {
|
29051 |
-
// We just rendered the head.
|
29052 |
-
if (!didSuspendAlready) {
|
29053 |
-
// This is the first pass. We need to figure out if anything is still
|
29054 |
-
// suspended in the rendered set.
|
29055 |
-
// If new content unsuspended, but there's still some content that
|
29056 |
-
// didn't. Then we need to do a second pass that forces everything
|
29057 |
-
// to keep showing their fallbacks.
|
29058 |
-
// We might be suspended if something in this render pass suspended, or
|
29059 |
-
// something in the previous committed pass suspended. Otherwise,
|
29060 |
-
// there's no chance so we can skip the expensive call to
|
29061 |
-
// findFirstSuspended.
|
29062 |
-
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags);
|
29063 |
-
|
29064 |
-
if (!cannotBeSuspended) {
|
29065 |
-
var row = workInProgress.child;
|
29066 |
-
|
29067 |
-
while (row !== null) {
|
29068 |
-
var suspended = findFirstSuspended(row);
|
29069 |
|
29070 |
-
|
29071 |
-
|
29072 |
-
|
29073 |
-
|
29074 |
-
|
29075 |
-
|
29076 |
-
// SuspenseList so that it can retry if they resolve.
|
29077 |
-
// There might be multiple of these in the list but since we're
|
29078 |
-
// going to wait for all of them anyway, it doesn't really matter
|
29079 |
-
// which ones gets to ping. In theory we could get clever and keep
|
29080 |
-
// track of how many dependencies remain but it gets tricky because
|
29081 |
-
// in the meantime, we can add/remove/change items and dependencies.
|
29082 |
-
// We might bail out of the loop before finding any but that
|
29083 |
-
// doesn't matter since that means that the other boundaries that
|
29084 |
-
// we did find already has their listeners attached.
|
29085 |
|
29086 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29087 |
|
29088 |
-
|
29089 |
-
|
29090 |
-
|
29091 |
-
|
29092 |
-
|
29093 |
-
|
|
|
|
|
|
|
29094 |
|
|
|
|
|
|
|
|
|
|
|
29095 |
|
29096 |
-
|
29097 |
-
|
29098 |
-
|
|
|
|
|
29099 |
|
29100 |
-
|
29101 |
|
29102 |
-
|
29103 |
-
|
29104 |
|
29105 |
-
|
29106 |
-
|
29107 |
-
}
|
29108 |
|
29109 |
-
|
29110 |
}
|
29111 |
}
|
29112 |
|
29113 |
-
|
29114 |
-
|
29115 |
-
|
29116 |
-
// the main content and only render fallbacks.
|
29117 |
-
workInProgress.flags |= DidCapture;
|
29118 |
-
didSuspendAlready = true;
|
29119 |
-
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
29120 |
-
// to get it started back up to attempt the next item. While in terms
|
29121 |
-
// of priority this work has the same priority as this current render,
|
29122 |
-
// it's not part of the same transition once the transition has
|
29123 |
-
// committed. If it's sync, we still want to yield so that it can be
|
29124 |
-
// painted. Conceptually, this is really the same as pinging.
|
29125 |
-
// We can use any RetryLane even if it's the one currently rendering
|
29126 |
-
// since we're leaving it behind on this node.
|
29127 |
|
29128 |
-
|
|
|
29129 |
|
29130 |
-
|
29131 |
-
|
29132 |
-
|
29133 |
-
|
29134 |
-
|
29135 |
-
|
29136 |
-
}
|
|
|
29137 |
|
29138 |
-
|
29139 |
-
|
29140 |
-
if (!didSuspendAlready) {
|
29141 |
-
var _suspended = findFirstSuspended(renderedTail);
|
29142 |
|
29143 |
-
|
29144 |
-
|
29145 |
-
|
29146 |
-
|
|
|
|
|
|
|
29147 |
|
29148 |
-
|
|
|
|
|
|
|
|
|
|
|
29149 |
|
29150 |
-
|
29151 |
-
|
29152 |
-
|
29153 |
-
}
|
29154 |
|
29155 |
-
|
|
|
|
|
29156 |
|
29157 |
-
|
29158 |
-
|
29159 |
-
|
29160 |
-
|
29161 |
-
|
29162 |
-
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
29163 |
|
29164 |
-
|
29165 |
-
|
29166 |
-
|
|
|
29167 |
|
|
|
|
|
|
|
|
|
29168 |
|
29169 |
-
|
29170 |
-
|
29171 |
-
|
29172 |
-
// time we have to render. So rendering one more row would likely
|
29173 |
-
// exceed it.
|
29174 |
-
now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes !== OffscreenLane) {
|
29175 |
-
// We have now passed our CPU deadline and we'll just give up further
|
29176 |
-
// attempts to render the main content and only render fallbacks.
|
29177 |
-
// The assumption is that this is usually faster.
|
29178 |
-
workInProgress.flags |= DidCapture;
|
29179 |
-
didSuspendAlready = true;
|
29180 |
-
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
29181 |
-
// to get it started back up to attempt the next item. While in terms
|
29182 |
-
// of priority this work has the same priority as this current render,
|
29183 |
-
// it's not part of the same transition once the transition has
|
29184 |
-
// committed. If it's sync, we still want to yield so that it can be
|
29185 |
-
// painted. Conceptually, this is really the same as pinging.
|
29186 |
-
// We can use any RetryLane even if it's the one currently rendering
|
29187 |
-
// since we're leaving it behind on this node.
|
29188 |
|
29189 |
-
|
|
|
|
|
29190 |
|
29191 |
-
|
29192 |
-
|
29193 |
-
|
29194 |
-
|
29195 |
-
|
29196 |
|
29197 |
-
|
29198 |
-
|
29199 |
-
// to the end. This breaks the guarantee that life-cycles fire in
|
29200 |
-
// sibling order but that isn't a strong guarantee promised by React.
|
29201 |
-
// Especially since these might also just pop in during future commits.
|
29202 |
-
// Append to the beginning of the list.
|
29203 |
-
renderedTail.sibling = workInProgress.child;
|
29204 |
-
workInProgress.child = renderedTail;
|
29205 |
-
} else {
|
29206 |
-
var previousSibling = renderState.last;
|
29207 |
|
29208 |
-
|
29209 |
-
|
|
|
|
|
|
|
|
|
|
|
29210 |
} else {
|
29211 |
-
|
29212 |
}
|
29213 |
|
29214 |
-
|
29215 |
}
|
29216 |
}
|
|
|
29217 |
|
29218 |
-
|
29219 |
-
|
29220 |
-
|
29221 |
-
|
29222 |
-
renderState.rendering = next;
|
29223 |
-
renderState.tail = next.sibling;
|
29224 |
-
renderState.lastEffect = workInProgress.lastEffect;
|
29225 |
-
renderState.renderingStartTime = now();
|
29226 |
-
next.sibling = null; // Restore the context.
|
29227 |
-
// TODO: We can probably just avoid popping it instead and only
|
29228 |
-
// setting it the first time we go from not suspended to suspended.
|
29229 |
-
|
29230 |
-
var suspenseContext = suspenseStackCursor.current;
|
29231 |
|
29232 |
-
|
29233 |
-
|
29234 |
-
|
29235 |
-
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
29236 |
-
}
|
29237 |
|
29238 |
-
|
|
|
|
|
29239 |
|
29240 |
-
|
29241 |
-
|
|
|
|
|
29242 |
|
29243 |
-
|
|
|
|
|
29244 |
}
|
29245 |
|
29246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29247 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29248 |
|
29249 |
-
|
|
|
29250 |
}
|
29251 |
|
29252 |
-
case
|
29253 |
{
|
|
|
29254 |
|
29255 |
-
|
29256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29257 |
|
29258 |
-
|
|
|
|
|
|
|
|
|
29259 |
|
29260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29261 |
|
29262 |
-
|
29263 |
-
|
29264 |
-
|
29265 |
-
|
|
|
29266 |
|
29267 |
-
|
29268 |
-
|
29269 |
-
|
29270 |
-
|
29271 |
-
|
29272 |
|
29273 |
-
|
29274 |
-
|
|
|
29275 |
}
|
29276 |
-
}
|
29277 |
-
|
29278 |
-
return null;
|
29279 |
-
}
|
29280 |
-
}
|
29281 |
-
|
29282 |
-
{
|
29283 |
-
{
|
29284 |
-
throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
|
29285 |
-
}
|
29286 |
-
}
|
29287 |
-
}
|
29288 |
|
29289 |
-
function unwindWork(workInProgress, renderLanes) {
|
29290 |
-
switch (workInProgress.tag) {
|
29291 |
-
case ClassComponent:
|
29292 |
-
{
|
29293 |
-
var Component = workInProgress.type;
|
29294 |
|
29295 |
-
|
29296 |
-
popContext(workInProgress);
|
29297 |
-
}
|
29298 |
|
29299 |
-
|
|
|
|
|
|
|
|
|
|
|
29300 |
|
29301 |
-
|
29302 |
-
|
|
|
|
|
|
|
|
|
|
|
29303 |
|
29304 |
-
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
29305 |
-
transferActualDuration(workInProgress);
|
29306 |
-
}
|
29307 |
|
29308 |
-
|
29309 |
}
|
29310 |
|
29311 |
-
return
|
29312 |
}
|
29313 |
|
29314 |
case HostRoot:
|
29315 |
{
|
29316 |
-
|
29317 |
-
|
29318 |
-
|
29319 |
-
var _flags = workInProgress.flags;
|
29320 |
|
29321 |
-
if (
|
29322 |
-
|
29323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29324 |
}
|
|
|
|
|
29325 |
}
|
29326 |
|
29327 |
-
|
29328 |
-
return workInProgress;
|
29329 |
}
|
29330 |
|
29331 |
case HostComponent:
|
29332 |
{
|
29333 |
-
//
|
29334 |
-
|
29335 |
-
|
29336 |
-
|
29337 |
-
|
29338 |
-
case SuspenseComponent:
|
29339 |
-
{
|
29340 |
-
popSuspenseContext(workInProgress);
|
29341 |
-
|
29342 |
-
var _flags2 = workInProgress.flags;
|
29343 |
-
|
29344 |
-
if (_flags2 & ShouldCapture) {
|
29345 |
-
workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary.
|
29346 |
-
|
29347 |
-
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
29348 |
-
transferActualDuration(workInProgress);
|
29349 |
-
}
|
29350 |
|
29351 |
-
|
|
|
|
|
|
|
29352 |
}
|
29353 |
|
29354 |
-
return
|
29355 |
}
|
29356 |
|
29357 |
-
case
|
29358 |
{
|
29359 |
-
|
29360 |
-
|
29361 |
-
|
29362 |
-
return null;
|
29363 |
}
|
29364 |
|
29365 |
case HostPortal:
|
29366 |
-
|
29367 |
-
|
29368 |
-
|
29369 |
-
|
29370 |
-
popProvider(workInProgress);
|
29371 |
-
return null;
|
29372 |
-
|
29373 |
-
case OffscreenComponent:
|
29374 |
-
case LegacyHiddenComponent:
|
29375 |
-
popRenderLanes(workInProgress);
|
29376 |
-
return null;
|
29377 |
-
|
29378 |
-
default:
|
29379 |
-
return null;
|
29380 |
-
}
|
29381 |
-
}
|
29382 |
|
29383 |
-
|
29384 |
-
switch (interruptedWork.tag) {
|
29385 |
-
case ClassComponent:
|
29386 |
{
|
29387 |
-
|
|
|
|
|
|
|
|
|
|
|
29388 |
|
29389 |
-
|
29390 |
-
|
|
|
|
|
|
|
29391 |
}
|
29392 |
|
29393 |
-
|
29394 |
-
}
|
29395 |
-
|
29396 |
-
case HostRoot:
|
29397 |
-
{
|
29398 |
-
popHostContainer(interruptedWork);
|
29399 |
-
popTopLevelContextObject(interruptedWork);
|
29400 |
-
resetWorkInProgressVersions();
|
29401 |
-
break;
|
29402 |
}
|
29403 |
|
29404 |
-
case
|
29405 |
{
|
29406 |
-
|
29407 |
-
|
29408 |
}
|
29409 |
|
29410 |
-
case HostPortal:
|
29411 |
-
popHostContainer(interruptedWork);
|
29412 |
-
break;
|
29413 |
-
|
29414 |
-
case SuspenseComponent:
|
29415 |
-
popSuspenseContext(interruptedWork);
|
29416 |
-
break;
|
29417 |
-
|
29418 |
case SuspenseListComponent:
|
29419 |
-
|
29420 |
-
|
29421 |
-
|
29422 |
-
case ContextProvider:
|
29423 |
-
popProvider(interruptedWork);
|
29424 |
-
break;
|
29425 |
-
|
29426 |
case OffscreenComponent:
|
29427 |
case LegacyHiddenComponent:
|
29428 |
-
|
29429 |
-
break;
|
29430 |
}
|
29431 |
-
}
|
29432 |
|
29433 |
-
|
29434 |
-
|
29435 |
-
|
29436 |
-
|
29437 |
-
|
29438 |
-
source: source,
|
29439 |
-
stack: getStackByFiberInDevAndProd(source)
|
29440 |
-
};
|
29441 |
}
|
29442 |
|
29443 |
-
|
29444 |
-
|
29445 |
-
//
|
29446 |
-
|
29447 |
-
|
29448 |
-
}
|
29449 |
|
29450 |
-
|
29451 |
-
|
29452 |
-
|
29453 |
-
// This enables renderers like ReactNative to better manage redbox behavior.
|
29454 |
|
29455 |
-
|
29456 |
-
|
29457 |
-
|
|
|
|
|
|
|
|
|
29458 |
|
29459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29460 |
|
29461 |
-
|
29462 |
-
|
29463 |
-
|
29464 |
-
var componentStack = stack !== null ? stack : ''; // Browsers support silencing uncaught errors by calling
|
29465 |
-
// `preventDefault()` in window `error` handler.
|
29466 |
-
// We record this information as an expando on the error.
|
29467 |
|
29468 |
-
|
29469 |
-
if (
|
29470 |
-
// The error is recoverable and was silenced.
|
29471 |
-
// Ignore it and don't print the stack addendum.
|
29472 |
-
// This is handy for testing error boundaries without noise.
|
29473 |
return;
|
29474 |
-
}
|
29475 |
-
// been accidental, we'll surface it anyway.
|
29476 |
-
// However, the browser would have silenced the original error
|
29477 |
-
// so we'll print it first, and then print the stack addendum.
|
29478 |
-
|
29479 |
|
29480 |
-
|
29481 |
-
// For a more detailed description of this block, see:
|
29482 |
-
// https://github.com/facebook/react/pull/13384
|
29483 |
}
|
29484 |
|
29485 |
-
|
29486 |
-
|
29487 |
-
|
29488 |
-
|
|
|
29489 |
|
29490 |
-
|
29491 |
-
|
29492 |
-
} else {
|
29493 |
-
errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.';
|
29494 |
-
}
|
29495 |
|
29496 |
-
|
29497 |
-
|
29498 |
-
|
29499 |
-
// displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
|
29500 |
|
29501 |
-
|
29502 |
-
|
29503 |
-
|
29504 |
-
|
29505 |
-
|
29506 |
-
|
29507 |
-
|
29508 |
-
|
29509 |
-
|
29510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29511 |
}
|
29512 |
}
|
29513 |
|
29514 |
-
|
|
|
29515 |
|
29516 |
-
|
29517 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29518 |
|
29519 |
-
update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property
|
29520 |
-
// being called "element".
|
29521 |
|
29522 |
-
|
29523 |
-
|
29524 |
-
};
|
29525 |
-
var error = errorInfo.value;
|
29526 |
|
29527 |
-
|
29528 |
-
|
29529 |
-
|
29530 |
-
|
|
|
|
|
|
|
|
|
29531 |
|
29532 |
-
|
29533 |
-
|
29534 |
|
29535 |
-
|
29536 |
-
|
29537 |
-
|
29538 |
-
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
29539 |
|
29540 |
-
|
29541 |
-
|
|
|
|
|
29542 |
|
29543 |
-
|
29544 |
-
|
29545 |
-
|
29546 |
-
|
29547 |
-
|
|
|
|
|
|
|
|
|
29548 |
|
29549 |
-
|
|
|
|
|
|
|
29550 |
|
29551 |
-
|
29552 |
-
update.callback = function callback() {
|
29553 |
-
{
|
29554 |
-
markFailedErrorBoundaryForHotReloading(fiber);
|
29555 |
}
|
29556 |
|
29557 |
-
|
29558 |
-
|
29559 |
-
|
29560 |
-
|
29561 |
-
// TODO: Warn in strict mode if getDerivedStateFromError is
|
29562 |
-
// not defined.
|
29563 |
-
markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined
|
29564 |
|
29565 |
-
|
29566 |
-
|
|
|
29567 |
|
29568 |
-
|
29569 |
-
|
29570 |
-
this.componentDidCatch(error$1, {
|
29571 |
-
componentStack: stack !== null ? stack : ''
|
29572 |
-
});
|
29573 |
|
|
|
29574 |
{
|
29575 |
-
|
29576 |
-
|
29577 |
-
|
29578 |
-
|
29579 |
-
|
29580 |
-
|
29581 |
-
|
|
|
|
|
|
|
|
|
29582 |
}
|
|
|
|
|
29583 |
}
|
29584 |
-
};
|
29585 |
-
} else {
|
29586 |
-
update.callback = function () {
|
29587 |
-
markFailedErrorBoundaryForHotReloading(fiber);
|
29588 |
-
};
|
29589 |
-
}
|
29590 |
|
29591 |
-
|
29592 |
-
|
29593 |
|
29594 |
-
|
29595 |
-
|
29596 |
-
// one does not already exist for the lanes we're currently rendering (which
|
29597 |
-
// acts like a "thread ID" here).
|
29598 |
-
var pingCache = root.pingCache;
|
29599 |
-
var threadIDs;
|
29600 |
|
29601 |
-
|
29602 |
-
|
29603 |
-
threadIDs = new Set();
|
29604 |
-
pingCache.set(wakeable, threadIDs);
|
29605 |
-
} else {
|
29606 |
-
threadIDs = pingCache.get(wakeable);
|
29607 |
|
29608 |
-
|
29609 |
-
|
29610 |
-
pingCache.set(wakeable, threadIDs);
|
29611 |
-
}
|
29612 |
-
}
|
29613 |
|
29614 |
-
|
29615 |
-
|
29616 |
-
|
29617 |
-
|
29618 |
-
|
29619 |
}
|
29620 |
}
|
29621 |
|
29622 |
-
function
|
29623 |
-
//
|
29624 |
-
|
29625 |
-
|
29626 |
-
|
|
|
|
|
29627 |
|
29628 |
-
|
29629 |
-
//
|
29630 |
-
|
29631 |
|
29632 |
-
if (
|
29633 |
-
|
29634 |
-
|
29635 |
-
|
|
|
|
|
|
|
29636 |
|
29637 |
-
|
29638 |
-
|
29639 |
-
sourceFiber.memoizedState = currentSource.memoizedState;
|
29640 |
-
sourceFiber.lanes = currentSource.lanes;
|
29641 |
-
} else {
|
29642 |
-
sourceFiber.updateQueue = null;
|
29643 |
-
sourceFiber.memoizedState = null;
|
29644 |
-
}
|
29645 |
}
|
29646 |
|
29647 |
-
|
|
|
|
|
|
|
29648 |
|
29649 |
-
|
|
|
29650 |
|
29651 |
-
|
29652 |
-
|
29653 |
-
|
29654 |
-
|
29655 |
-
// attach another listener to flip the boundary back to its normal state.
|
29656 |
-
var wakeables = _workInProgress.updateQueue;
|
29657 |
|
29658 |
-
|
29659 |
-
|
29660 |
-
|
29661 |
-
|
29662 |
-
|
29663 |
-
|
29664 |
-
|
29665 |
-
|
29666 |
-
|
29667 |
-
|
29668 |
-
|
29669 |
-
|
29670 |
-
|
29671 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29672 |
|
|
|
|
|
|
|
|
|
29673 |
|
29674 |
-
|
29675 |
-
|
29676 |
-
sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete.
|
29677 |
-
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
29678 |
-
// all lifecycle effect tags.
|
29679 |
|
29680 |
-
|
|
|
|
|
|
|
29681 |
|
29682 |
-
|
29683 |
-
|
29684 |
|
29685 |
-
|
29686 |
-
|
29687 |
-
|
29688 |
-
|
29689 |
-
|
29690 |
-
|
29691 |
-
// When we try rendering again, we should not reuse the current fiber,
|
29692 |
-
// since it's known to be in an inconsistent state. Use a force update to
|
29693 |
-
// prevent a bail out.
|
29694 |
-
var update = createUpdate(NoTimestamp, SyncLane);
|
29695 |
-
update.tag = ForceUpdate;
|
29696 |
-
enqueueUpdate(sourceFiber, update);
|
29697 |
-
}
|
29698 |
-
} // The source fiber did not complete. Mark it with Sync priority to
|
29699 |
-
// indicate that it still has pending work.
|
29700 |
|
|
|
|
|
|
|
29701 |
|
29702 |
-
|
|
|
|
|
|
|
|
|
|
|
29703 |
|
29704 |
-
|
29705 |
-
|
29706 |
-
|
29707 |
-
|
29708 |
-
//
|
29709 |
-
//
|
29710 |
-
|
29711 |
-
|
29712 |
-
// This first principle is that if we're going to suspend when we complete
|
29713 |
-
// a root, then we should also restart if we get an update or ping that
|
29714 |
-
// might unsuspend it, and vice versa. The only reason to suspend is
|
29715 |
-
// because you think you might want to restart before committing. However,
|
29716 |
-
// it doesn't make sense to restart only while in the period we're suspended.
|
29717 |
-
//
|
29718 |
-
// Restarting too aggressively is also not good because it starves out any
|
29719 |
-
// intermediate loading state. So we use heuristics to determine when.
|
29720 |
-
// Suspense Heuristics
|
29721 |
-
//
|
29722 |
-
// If nothing threw a Promise or all the same fallbacks are already showing,
|
29723 |
-
// then don't suspend/restart.
|
29724 |
-
//
|
29725 |
-
// If this is an initial render of a new tree of Suspense boundaries and
|
29726 |
-
// those trigger a fallback, then don't suspend/restart. We want to ensure
|
29727 |
-
// that we can show the initial loading state as quickly as possible.
|
29728 |
-
//
|
29729 |
-
// If we hit a "Delayed" case, such as when we'd switch from content back into
|
29730 |
-
// a fallback, then we should always suspend/restart. Transitions apply
|
29731 |
-
// to this case. If none is defined, JND is used instead.
|
29732 |
-
//
|
29733 |
-
// If we're already showing a fallback and it gets "retried", allowing us to show
|
29734 |
-
// another level, but there's still an inner boundary that would show a fallback,
|
29735 |
-
// then we suspend/restart for 500ms since the last time we showed a fallback
|
29736 |
-
// anywhere in the tree. This effectively throttles progressive loading into a
|
29737 |
-
// consistent train of commits. This also gives us an opportunity to restart to
|
29738 |
-
// get to the completed state slightly earlier.
|
29739 |
-
//
|
29740 |
-
// If there's ambiguity due to batching it's resolved in preference of:
|
29741 |
-
// 1) "delayed", 2) "initial render", 3) "retry".
|
29742 |
-
//
|
29743 |
-
// We want to ensure that a "busy" state doesn't get force committed. We want to
|
29744 |
-
// ensure that new initial loading states can commit as soon as possible.
|
29745 |
|
|
|
|
|
29746 |
|
29747 |
-
|
29748 |
-
|
29749 |
-
_workInProgress.lanes = rootRenderLanes;
|
29750 |
-
return;
|
29751 |
-
} // This boundary already captured during this render. Continue to the next
|
29752 |
-
// boundary.
|
29753 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29754 |
|
29755 |
-
_workInProgress = _workInProgress.return;
|
29756 |
-
} while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode.
|
29757 |
-
// TODO: Use invariant so the message is stripped in prod?
|
29758 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29759 |
|
29760 |
-
value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.');
|
29761 |
-
} // We didn't find a boundary that could handle this type of exception. Start
|
29762 |
-
// over and traverse parent path again, this time treating the exception
|
29763 |
-
// as an error.
|
29764 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29765 |
|
29766 |
-
|
29767 |
-
value = createCapturedValue(value, sourceFiber);
|
29768 |
-
var workInProgress = returnFiber;
|
29769 |
|
29770 |
-
do {
|
29771 |
-
switch (workInProgress.tag) {
|
29772 |
-
case HostRoot:
|
29773 |
-
{
|
29774 |
-
var _errorInfo = value;
|
29775 |
-
workInProgress.flags |= ShouldCapture;
|
29776 |
-
var lane = pickArbitraryLane(rootRenderLanes);
|
29777 |
-
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
|
29778 |
|
29779 |
-
|
29780 |
|
29781 |
-
|
29782 |
-
|
29783 |
-
|
29784 |
|
29785 |
-
|
29786 |
-
|
29787 |
-
|
29788 |
-
|
29789 |
-
|
29790 |
|
29791 |
-
|
29792 |
-
|
|
|
|
|
29793 |
|
29794 |
-
|
|
|
|
|
|
|
29795 |
|
29796 |
-
|
29797 |
|
29798 |
-
|
29799 |
|
29800 |
-
|
29801 |
-
|
|
|
|
|
29802 |
}
|
|
|
29803 |
|
29804 |
-
|
29805 |
-
}
|
29806 |
|
29807 |
-
|
29808 |
-
|
29809 |
-
|
29810 |
|
29811 |
-
|
|
|
29812 |
|
29813 |
-
|
29814 |
-
|
29815 |
-
}
|
29816 |
|
29817 |
-
|
|
|
|
|
|
|
|
|
|
|
29818 |
|
29819 |
-
|
29820 |
-
|
29821 |
-
|
29822 |
|
29823 |
-
{
|
29824 |
-
instance
|
29825 |
-
}
|
29826 |
-
}; // Capture errors so they don't interrupt unmounting.
|
29827 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29828 |
|
29829 |
-
|
29830 |
-
|
29831 |
-
|
29832 |
|
29833 |
-
|
29834 |
-
|
29835 |
-
|
|
|
29836 |
}
|
29837 |
}
|
29838 |
}
|
29839 |
|
29840 |
-
function
|
29841 |
-
var
|
|
|
29842 |
|
29843 |
-
if (
|
29844 |
-
|
29845 |
-
{
|
29846 |
-
invokeGuardedCallback(null, ref, null, null);
|
29847 |
|
29848 |
-
|
29849 |
-
|
29850 |
-
captureCommitPhaseError(current, refError);
|
29851 |
-
}
|
29852 |
-
}
|
29853 |
} else {
|
29854 |
-
|
29855 |
}
|
29856 |
-
}
|
29857 |
-
|
29858 |
|
29859 |
-
|
29860 |
-
|
29861 |
-
|
29862 |
|
29863 |
-
|
29864 |
-
|
29865 |
-
|
|
|
29866 |
}
|
29867 |
}
|
29868 |
}
|
29869 |
|
29870 |
-
function
|
29871 |
-
|
29872 |
-
|
29873 |
-
|
29874 |
-
|
29875 |
-
case Block:
|
29876 |
-
{
|
29877 |
-
return;
|
29878 |
-
}
|
29879 |
-
|
29880 |
-
case ClassComponent:
|
29881 |
-
{
|
29882 |
-
if (finishedWork.flags & Snapshot) {
|
29883 |
-
if (current !== null) {
|
29884 |
-
var prevProps = current.memoizedProps;
|
29885 |
-
var prevState = current.memoizedState;
|
29886 |
-
var instance = finishedWork.stateNode; // We could update instance props and state here,
|
29887 |
-
// but instead we rely on them being set during last render.
|
29888 |
-
// TODO: revisit this when we implement resuming.
|
29889 |
|
29890 |
-
|
29891 |
-
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
29892 |
-
if (instance.props !== finishedWork.memoizedProps) {
|
29893 |
-
error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
29894 |
-
}
|
29895 |
|
29896 |
-
|
29897 |
-
|
29898 |
-
}
|
29899 |
-
}
|
29900 |
-
}
|
29901 |
|
29902 |
-
|
|
|
|
|
29903 |
|
29904 |
-
|
29905 |
-
|
|
|
|
|
|
|
|
|
29906 |
|
29907 |
-
|
29908 |
-
didWarnSet.add(finishedWork.type);
|
29909 |
|
29910 |
-
|
29911 |
-
|
29912 |
-
|
|
|
|
|
29913 |
|
29914 |
-
|
29915 |
-
|
29916 |
-
|
|
|
29917 |
|
29918 |
-
|
29919 |
-
|
|
|
|
|
29920 |
|
29921 |
-
case HostRoot:
|
29922 |
-
{
|
29923 |
-
{
|
29924 |
-
if (finishedWork.flags & Snapshot) {
|
29925 |
-
var root = finishedWork.stateNode;
|
29926 |
-
clearContainer(root.containerInfo);
|
29927 |
-
}
|
29928 |
}
|
29929 |
|
29930 |
-
return;
|
29931 |
}
|
29932 |
|
29933 |
-
|
29934 |
-
case HostText:
|
29935 |
-
case HostPortal:
|
29936 |
-
case IncompleteClassComponent:
|
29937 |
-
// Nothing to do for these component types
|
29938 |
-
return;
|
29939 |
-
}
|
29940 |
-
|
29941 |
-
{
|
29942 |
-
{
|
29943 |
-
throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
|
29944 |
}
|
29945 |
-
}
|
29946 |
-
}
|
29947 |
|
29948 |
-
|
29949 |
-
|
29950 |
-
|
29951 |
|
29952 |
-
|
29953 |
-
|
29954 |
-
|
|
|
|
|
29955 |
|
29956 |
-
|
29957 |
-
if (
|
29958 |
-
//
|
29959 |
-
|
29960 |
-
|
|
|
29961 |
|
29962 |
-
|
29963 |
-
|
29964 |
-
|
29965 |
}
|
|
|
|
|
29966 |
|
29967 |
-
|
29968 |
-
|
29969 |
-
|
29970 |
-
|
29971 |
-
|
29972 |
-
|
29973 |
-
var updateQueue = finishedWork.updateQueue;
|
29974 |
-
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
29975 |
-
|
29976 |
-
if (lastEffect !== null) {
|
29977 |
-
var firstEffect = lastEffect.next;
|
29978 |
-
var effect = firstEffect;
|
29979 |
-
|
29980 |
-
do {
|
29981 |
-
if ((effect.tag & tag) === tag) {
|
29982 |
-
// Mount
|
29983 |
-
var create = effect.create;
|
29984 |
-
effect.destroy = create();
|
29985 |
|
29986 |
-
|
29987 |
-
|
|
|
29988 |
|
29989 |
-
|
29990 |
-
|
|
|
|
|
29991 |
|
29992 |
-
|
29993 |
-
addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
|
29994 |
-
} else if (typeof destroy.then === 'function') {
|
29995 |
-
addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching';
|
29996 |
-
} else {
|
29997 |
-
addendum = ' You returned: ' + destroy;
|
29998 |
-
}
|
29999 |
|
30000 |
-
|
30001 |
-
|
30002 |
-
|
|
|
30003 |
}
|
|
|
30004 |
|
30005 |
-
|
30006 |
-
|
30007 |
}
|
30008 |
}
|
30009 |
|
30010 |
-
function
|
30011 |
-
|
30012 |
-
|
30013 |
-
|
30014 |
-
|
30015 |
-
|
30016 |
-
var effect = firstEffect;
|
30017 |
-
|
30018 |
-
do {
|
30019 |
-
var _effect = effect,
|
30020 |
-
next = _effect.next,
|
30021 |
-
tag = _effect.tag;
|
30022 |
|
30023 |
-
|
30024 |
-
|
30025 |
-
enqueuePendingPassiveHookEffectMount(finishedWork, effect);
|
30026 |
-
}
|
30027 |
|
30028 |
-
|
30029 |
-
|
30030 |
}
|
30031 |
}
|
30032 |
|
30033 |
-
function
|
|
|
30034 |
switch (finishedWork.tag) {
|
30035 |
case FunctionComponent:
|
30036 |
case ForwardRef:
|
|
|
30037 |
case SimpleMemoComponent:
|
30038 |
case Block:
|
30039 |
{
|
30040 |
-
//
|
30041 |
-
//
|
|
|
30042 |
// e.g. a destroy function in one component should never override a ref set
|
30043 |
// by a create function in another component during the same commit.
|
30044 |
{
|
30045 |
-
|
30046 |
}
|
30047 |
|
30048 |
-
schedulePassiveEffects(finishedWork);
|
30049 |
return;
|
30050 |
}
|
30051 |
|
30052 |
case ClassComponent:
|
30053 |
{
|
30054 |
-
|
30055 |
-
|
30056 |
-
if (finishedWork.flags & Update) {
|
30057 |
-
if (current === null) {
|
30058 |
-
// We could update instance props and state here,
|
30059 |
-
// but instead we rely on them being set during last render.
|
30060 |
-
// TODO: revisit this when we implement resuming.
|
30061 |
-
{
|
30062 |
-
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
30063 |
-
if (instance.props !== finishedWork.memoizedProps) {
|
30064 |
-
error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
30065 |
-
}
|
30066 |
|
30067 |
-
|
30068 |
-
|
30069 |
-
|
30070 |
-
}
|
30071 |
-
}
|
30072 |
|
30073 |
-
|
30074 |
-
|
30075 |
-
|
30076 |
-
|
30077 |
-
|
30078 |
-
var prevState = current.memoizedState; // We could update instance props and state here,
|
30079 |
-
// but instead we rely on them being set during last render.
|
30080 |
-
// TODO: revisit this when we implement resuming.
|
30081 |
|
30082 |
-
|
30083 |
-
|
30084 |
-
if (instance.props !== finishedWork.memoizedProps) {
|
30085 |
-
error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
30086 |
-
}
|
30087 |
|
30088 |
-
|
30089 |
-
|
30090 |
-
}
|
30091 |
-
}
|
30092 |
-
}
|
30093 |
|
30094 |
-
|
30095 |
-
|
30096 |
-
}
|
30097 |
}
|
30098 |
-
} // TODO: I think this is now always non-null by the time it reaches the
|
30099 |
-
// commit phase. Consider removing the type check.
|
30100 |
-
|
30101 |
-
|
30102 |
-
var updateQueue = finishedWork.updateQueue;
|
30103 |
-
|
30104 |
-
if (updateQueue !== null) {
|
30105 |
-
{
|
30106 |
-
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
30107 |
-
if (instance.props !== finishedWork.memoizedProps) {
|
30108 |
-
error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
30109 |
-
}
|
30110 |
-
|
30111 |
-
if (instance.state !== finishedWork.memoizedState) {
|
30112 |
-
error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
30113 |
-
}
|
30114 |
-
}
|
30115 |
-
} // We could update instance props and state here,
|
30116 |
-
// but instead we rely on them being set during last render.
|
30117 |
-
// TODO: revisit this when we implement resuming.
|
30118 |
-
|
30119 |
-
|
30120 |
-
commitUpdateQueue(finishedWork, updateQueue, instance);
|
30121 |
}
|
30122 |
|
30123 |
return;
|
30124 |
}
|
30125 |
|
30126 |
-
case
|
30127 |
{
|
30128 |
-
|
30129 |
-
|
30130 |
-
|
30131 |
-
|
30132 |
-
if (_updateQueue !== null) {
|
30133 |
-
var _instance = null;
|
30134 |
-
|
30135 |
-
if (finishedWork.child !== null) {
|
30136 |
-
switch (finishedWork.child.tag) {
|
30137 |
-
case HostComponent:
|
30138 |
-
_instance = getPublicInstance(finishedWork.child.stateNode);
|
30139 |
-
break;
|
30140 |
-
|
30141 |
-
case ClassComponent:
|
30142 |
-
_instance = finishedWork.child.stateNode;
|
30143 |
-
break;
|
30144 |
-
}
|
30145 |
}
|
30146 |
-
|
30147 |
-
commitUpdateQueue(finishedWork, _updateQueue, _instance);
|
30148 |
}
|
30149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30150 |
return;
|
30151 |
}
|
30152 |
|
30153 |
-
case
|
30154 |
{
|
30155 |
-
|
30156 |
-
|
30157 |
-
// These effects should only be committed when components are first mounted,
|
30158 |
-
// aka when there is no current/alternate.
|
30159 |
|
30160 |
-
|
30161 |
-
|
30162 |
-
|
30163 |
-
|
|
|
30164 |
}
|
30165 |
|
30166 |
return;
|
30167 |
}
|
30168 |
|
30169 |
-
case
|
30170 |
{
|
30171 |
-
// We have no life-cycles associated with text.
|
30172 |
return;
|
30173 |
}
|
30174 |
|
30175 |
-
case
|
30176 |
{
|
30177 |
-
|
|
|
30178 |
return;
|
30179 |
}
|
30180 |
|
30181 |
-
case
|
30182 |
{
|
30183 |
-
|
30184 |
-
var _finishedWork$memoize2 = finishedWork.memoizedProps,
|
30185 |
-
onCommit = _finishedWork$memoize2.onCommit,
|
30186 |
-
onRender = _finishedWork$memoize2.onRender;
|
30187 |
-
var effectDuration = finishedWork.stateNode.effectDuration;
|
30188 |
-
var commitTime = getCommitTime();
|
30189 |
-
|
30190 |
-
if (typeof onRender === 'function') {
|
30191 |
-
{
|
30192 |
-
onRender(finishedWork.memoizedProps.id, current === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime, finishedRoot.memoizedInteractions);
|
30193 |
-
}
|
30194 |
-
}
|
30195 |
-
}
|
30196 |
-
|
30197 |
return;
|
30198 |
}
|
30199 |
|
30200 |
-
case
|
30201 |
{
|
30202 |
-
commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
|
30203 |
return;
|
30204 |
}
|
30205 |
|
30206 |
-
case SuspenseListComponent:
|
30207 |
-
case IncompleteClassComponent:
|
30208 |
case FundamentalComponent:
|
|
|
|
|
|
|
|
|
|
|
30209 |
case ScopeComponent:
|
|
|
|
|
|
|
|
|
|
|
30210 |
case OffscreenComponent:
|
30211 |
case LegacyHiddenComponent:
|
30212 |
-
|
|
|
|
|
|
|
|
|
|
|
30213 |
}
|
30214 |
|
30215 |
{
|
@@ -30219,6049 +28566,6905 @@ function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) {
|
|
30219 |
}
|
30220 |
}
|
30221 |
|
30222 |
-
function
|
30223 |
-
|
30224 |
-
// We only have the top Fiber that was inserted but we need to recurse down its
|
30225 |
-
// children to find all the terminal nodes.
|
30226 |
-
var node = finishedWork;
|
30227 |
|
30228 |
-
|
30229 |
-
|
30230 |
-
var instance = node.stateNode;
|
30231 |
|
30232 |
-
|
30233 |
-
|
30234 |
-
|
30235 |
-
|
30236 |
-
|
30237 |
-
|
30238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30239 |
|
30240 |
-
|
30241 |
-
hideTextInstance(_instance3);
|
30242 |
-
} else {
|
30243 |
-
unhideTextInstance(_instance3, node.memoizedProps);
|
30244 |
-
}
|
30245 |
-
} else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork) ; else if (node.child !== null) {
|
30246 |
-
node.child.return = node;
|
30247 |
-
node = node.child;
|
30248 |
-
continue;
|
30249 |
-
}
|
30250 |
|
30251 |
-
|
30252 |
-
return;
|
30253 |
-
}
|
30254 |
|
30255 |
-
|
30256 |
-
|
30257 |
-
return;
|
30258 |
-
}
|
30259 |
|
30260 |
-
|
30261 |
-
|
30262 |
|
30263 |
-
|
30264 |
-
|
|
|
|
|
|
|
|
|
|
|
30265 |
}
|
30266 |
}
|
30267 |
}
|
30268 |
|
30269 |
-
function
|
30270 |
-
|
|
|
|
|
|
|
30271 |
|
30272 |
-
if (
|
30273 |
-
|
30274 |
-
var
|
30275 |
|
30276 |
-
|
30277 |
-
|
30278 |
-
|
30279 |
-
break;
|
30280 |
|
30281 |
-
|
30282 |
-
|
30283 |
-
|
30284 |
|
30285 |
-
|
30286 |
-
|
30287 |
-
|
30288 |
-
|
30289 |
-
|
30290 |
-
error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().', getComponentName(finishedWork.type));
|
30291 |
}
|
|
|
|
|
|
|
30292 |
}
|
|
|
|
|
|
|
|
|
|
|
30293 |
|
30294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30295 |
}
|
30296 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30297 |
}
|
30298 |
|
30299 |
-
|
30300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30301 |
|
30302 |
-
|
30303 |
-
if (typeof currentRef === 'function') {
|
30304 |
-
currentRef(null);
|
30305 |
-
} else {
|
30306 |
-
currentRef.current = null;
|
30307 |
-
}
|
30308 |
-
}
|
30309 |
-
} // User-originating errors (lifecycles and refs) should not interrupt
|
30310 |
-
// deletion, so don't let them throw. Host-originating errors should
|
30311 |
-
// interrupt deletion, so it's okay
|
30312 |
|
|
|
|
|
|
|
|
|
30313 |
|
30314 |
-
|
30315 |
-
|
30316 |
|
30317 |
-
|
30318 |
-
case FunctionComponent:
|
30319 |
-
case ForwardRef:
|
30320 |
-
case MemoComponent:
|
30321 |
-
case SimpleMemoComponent:
|
30322 |
-
case Block:
|
30323 |
-
{
|
30324 |
-
var updateQueue = current.updateQueue;
|
30325 |
|
30326 |
-
|
30327 |
-
var lastEffect = updateQueue.lastEffect;
|
30328 |
|
30329 |
-
|
30330 |
-
|
30331 |
-
|
30332 |
|
30333 |
-
|
30334 |
-
|
30335 |
-
|
30336 |
-
tag = _effect2.tag;
|
30337 |
|
30338 |
-
|
30339 |
-
|
30340 |
-
enqueuePendingPassiveHookEffectUnmount(current, effect);
|
30341 |
-
} else {
|
30342 |
-
{
|
30343 |
-
safelyCallDestroy(current, destroy);
|
30344 |
-
}
|
30345 |
-
}
|
30346 |
-
}
|
30347 |
|
30348 |
-
|
30349 |
-
} while (effect !== firstEffect);
|
30350 |
-
}
|
30351 |
-
}
|
30352 |
|
30353 |
-
|
30354 |
-
|
|
|
30355 |
|
30356 |
-
|
30357 |
-
|
30358 |
-
|
30359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30360 |
|
30361 |
-
|
30362 |
-
|
30363 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30364 |
|
30365 |
-
|
30366 |
-
|
|
|
30367 |
|
30368 |
-
|
30369 |
-
|
30370 |
-
|
30371 |
-
|
30372 |
-
}
|
30373 |
|
30374 |
-
|
30375 |
-
|
30376 |
-
|
30377 |
-
|
30378 |
-
|
30379 |
-
|
30380 |
-
|
30381 |
-
|
|
|
|
|
|
|
30382 |
|
30383 |
-
return;
|
30384 |
-
}
|
30385 |
|
30386 |
-
|
30387 |
-
|
|
|
|
|
30388 |
|
30389 |
-
return;
|
30390 |
-
}
|
30391 |
|
30392 |
-
|
30393 |
-
|
|
|
|
|
|
|
|
|
30394 |
|
30395 |
-
|
30396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30397 |
|
30398 |
-
case ScopeComponent:
|
30399 |
-
{
|
30400 |
|
30401 |
-
|
30402 |
-
|
30403 |
}
|
30404 |
-
}
|
30405 |
-
|
30406 |
-
function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
|
30407 |
-
// While we're inside a removed host node we don't want to call
|
30408 |
-
// removeChild on the inner nodes because they're removed by the top
|
30409 |
-
// call anyway. We also want to call componentWillUnmount on all
|
30410 |
-
// composites before this host node is removed from the tree. Therefore
|
30411 |
-
// we do an inner loop while we're still inside the host node.
|
30412 |
-
var node = root;
|
30413 |
|
30414 |
-
|
30415 |
-
commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes.
|
30416 |
-
// Skip portals because commitUnmount() currently visits them recursively.
|
30417 |
|
30418 |
-
|
30419 |
-
|
30420 |
-
|
30421 |
-
node.child.return = node;
|
30422 |
-
node = node.child;
|
30423 |
-
continue;
|
30424 |
}
|
30425 |
|
30426 |
-
|
30427 |
-
|
30428 |
-
|
30429 |
|
30430 |
-
while (node.sibling === null) {
|
30431 |
-
if (node.return === null || node.return === root) {
|
30432 |
-
return;
|
30433 |
-
}
|
30434 |
|
30435 |
-
|
30436 |
-
|
|
|
|
|
|
|
|
|
30437 |
|
30438 |
-
|
30439 |
-
node = node.sibling;
|
30440 |
-
}
|
30441 |
-
}
|
30442 |
|
30443 |
-
|
30444 |
-
|
30445 |
-
|
30446 |
-
|
30447 |
-
|
30448 |
-
// itself will be GC:ed when the parent updates the next time.
|
30449 |
-
// Note: we cannot null out sibling here, otherwise it can cause issues
|
30450 |
-
// with findDOMNode and how it requires the sibling field to carry out
|
30451 |
-
// traversal in a later effect. See PR #16820. We now clear the sibling
|
30452 |
-
// field after effects, see: detachFiberAfterEffects.
|
30453 |
-
//
|
30454 |
-
// Don't disconnect stateNode now; it will be detached in detachFiberAfterEffects.
|
30455 |
-
// It may be required if the current component is an error boundary,
|
30456 |
-
// and one of its descendants throws while unmounting a passive effect.
|
30457 |
-
fiber.alternate = null;
|
30458 |
-
fiber.child = null;
|
30459 |
-
fiber.dependencies = null;
|
30460 |
-
fiber.firstEffect = null;
|
30461 |
-
fiber.lastEffect = null;
|
30462 |
-
fiber.memoizedProps = null;
|
30463 |
-
fiber.memoizedState = null;
|
30464 |
-
fiber.pendingProps = null;
|
30465 |
-
fiber.return = null;
|
30466 |
-
fiber.updateQueue = null;
|
30467 |
|
30468 |
-
|
30469 |
-
fiber._debugOwner = null;
|
30470 |
}
|
|
|
|
|
30471 |
}
|
30472 |
|
30473 |
-
function
|
30474 |
-
|
|
|
|
|
|
|
|
|
30475 |
|
30476 |
-
|
30477 |
-
|
30478 |
-
|
30479 |
-
|
|
|
30480 |
|
30481 |
-
parent = parent.return;
|
30482 |
-
}
|
30483 |
|
30484 |
-
{
|
30485 |
-
|
30486 |
-
throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." );
|
30487 |
-
}
|
30488 |
}
|
30489 |
-
}
|
30490 |
|
30491 |
-
|
30492 |
-
return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
|
30493 |
}
|
30494 |
|
30495 |
-
function
|
30496 |
-
|
30497 |
-
|
30498 |
-
|
30499 |
-
// TODO: Find a more efficient way to do this.
|
30500 |
-
var node = fiber;
|
30501 |
|
30502 |
-
|
30503 |
-
|
30504 |
-
|
30505 |
-
|
30506 |
-
// If we pop out of the root or hit the parent the fiber we are the
|
30507 |
-
// last sibling.
|
30508 |
-
return null;
|
30509 |
-
}
|
30510 |
|
30511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30512 |
}
|
30513 |
|
30514 |
-
|
30515 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30516 |
|
30517 |
-
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
|
30518 |
-
// If it is not host node and, we might have a host node inside it.
|
30519 |
-
// Try to search down until we find one.
|
30520 |
-
if (node.flags & Placement) {
|
30521 |
-
// If we don't have a child, try the siblings instead.
|
30522 |
-
continue siblings;
|
30523 |
-
} // If we don't have a child, try the siblings instead.
|
30524 |
-
// We also skip portals because they are not part of this host tree.
|
30525 |
|
|
|
30526 |
|
30527 |
-
|
30528 |
-
|
30529 |
-
|
30530 |
-
|
30531 |
-
|
30532 |
-
|
30533 |
-
|
|
|
30534 |
|
|
|
|
|
|
|
|
|
30535 |
|
30536 |
-
|
30537 |
-
|
30538 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30539 |
}
|
30540 |
-
}
|
30541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30542 |
|
30543 |
-
function commitPlacement(finishedWork) {
|
30544 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30545 |
|
30546 |
-
var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together.
|
30547 |
|
30548 |
-
|
30549 |
-
|
30550 |
-
|
|
|
|
|
30551 |
|
30552 |
-
|
30553 |
-
|
30554 |
-
|
30555 |
-
|
30556 |
-
break;
|
30557 |
|
30558 |
-
|
30559 |
-
|
30560 |
-
|
30561 |
-
break;
|
30562 |
|
30563 |
-
|
30564 |
-
|
30565 |
-
|
30566 |
-
|
|
|
30567 |
|
30568 |
-
case FundamentalComponent:
|
30569 |
|
30570 |
-
|
|
|
30571 |
|
30572 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30573 |
{
|
30574 |
-
{
|
30575 |
-
|
30576 |
}
|
30577 |
}
|
|
|
30578 |
|
|
|
|
|
30579 |
}
|
30580 |
|
30581 |
-
if (
|
30582 |
-
|
30583 |
-
|
30584 |
-
|
30585 |
-
parentFiber.flags &= ~ContentReset;
|
30586 |
-
}
|
30587 |
-
|
30588 |
-
var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
|
30589 |
-
// children to find all the terminal nodes.
|
30590 |
-
|
30591 |
-
if (isContainer) {
|
30592 |
-
insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
|
30593 |
} else {
|
30594 |
-
|
30595 |
}
|
30596 |
-
}
|
|
|
|
|
|
|
|
|
30597 |
|
30598 |
-
function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
|
30599 |
-
var tag = node.tag;
|
30600 |
-
var isHost = tag === HostComponent || tag === HostText;
|
30601 |
|
30602 |
-
|
30603 |
-
|
|
|
30604 |
|
30605 |
-
|
30606 |
-
insertInContainerBefore(parent, stateNode, before);
|
30607 |
-
} else {
|
30608 |
-
appendChildToContainer(parent, stateNode);
|
30609 |
-
}
|
30610 |
-
} else if (tag === HostPortal) ; else {
|
30611 |
-
var child = node.child;
|
30612 |
|
30613 |
-
|
30614 |
-
insertOrAppendPlacementNodeIntoContainer(child, before, parent);
|
30615 |
-
var sibling = child.sibling;
|
30616 |
|
30617 |
-
|
30618 |
-
insertOrAppendPlacementNodeIntoContainer(sibling, before, parent);
|
30619 |
-
sibling = sibling.sibling;
|
30620 |
-
}
|
30621 |
-
}
|
30622 |
-
}
|
30623 |
-
}
|
30624 |
|
30625 |
-
|
30626 |
-
|
30627 |
-
|
|
|
|
|
|
|
|
|
30628 |
|
30629 |
-
|
30630 |
-
|
30631 |
|
30632 |
-
if (before) {
|
30633 |
-
insertBefore(parent, stateNode, before);
|
30634 |
-
} else {
|
30635 |
-
appendChild(parent, stateNode);
|
30636 |
-
}
|
30637 |
-
} else if (tag === HostPortal) ; else {
|
30638 |
-
var child = node.child;
|
30639 |
|
30640 |
-
|
30641 |
-
|
30642 |
-
var sibling = child.sibling;
|
30643 |
|
30644 |
-
|
30645 |
-
|
30646 |
-
|
30647 |
-
|
30648 |
-
|
30649 |
-
}
|
30650 |
-
}
|
30651 |
|
30652 |
-
function unmountHostComponents(finishedRoot, current, renderPriorityLevel) {
|
30653 |
-
// We only have the top Fiber that was deleted but we need to recurse down its
|
30654 |
-
// children to find all the terminal nodes.
|
30655 |
-
var node = current; // Each iteration, currentParent is populated with node's host parent if not
|
30656 |
-
// currentParentIsValid.
|
30657 |
|
30658 |
-
|
|
|
30659 |
|
30660 |
-
var currentParent;
|
30661 |
-
var currentParentIsContainer;
|
30662 |
|
30663 |
-
|
30664 |
-
if (!currentParentIsValid) {
|
30665 |
-
var parent = node.return;
|
30666 |
|
30667 |
-
|
30668 |
-
|
30669 |
-
|
30670 |
-
|
30671 |
-
|
30672 |
-
|
|
|
|
|
|
|
|
|
30673 |
|
30674 |
-
|
|
|
|
|
|
|
30675 |
|
30676 |
-
switch (parent.tag) {
|
30677 |
-
case HostComponent:
|
30678 |
-
currentParent = parentStateNode;
|
30679 |
-
currentParentIsContainer = false;
|
30680 |
-
break findParent;
|
30681 |
|
30682 |
-
|
30683 |
-
|
30684 |
-
|
30685 |
-
|
|
|
|
|
30686 |
|
30687 |
-
|
30688 |
-
|
30689 |
-
|
30690 |
-
|
|
|
|
|
30691 |
|
30692 |
-
}
|
30693 |
|
30694 |
-
|
30695 |
-
|
30696 |
|
30697 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30698 |
}
|
|
|
|
|
30699 |
|
30700 |
-
if (node.tag === HostComponent || node.tag === HostText) {
|
30701 |
-
commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the
|
30702 |
-
// node from the tree.
|
30703 |
|
30704 |
-
|
30705 |
-
removeChildFromContainer(currentParent, node.stateNode);
|
30706 |
-
} else {
|
30707 |
-
removeChild(currentParent, node.stateNode);
|
30708 |
-
} // Don't visit children because we already visited them.
|
30709 |
|
30710 |
-
|
30711 |
-
|
30712 |
-
|
30713 |
-
|
30714 |
-
currentParent = node.stateNode.containerInfo;
|
30715 |
-
currentParentIsContainer = true; // Visit children because portals might contain host components.
|
30716 |
|
30717 |
-
|
30718 |
-
node = node.child;
|
30719 |
-
continue;
|
30720 |
-
}
|
30721 |
-
} else {
|
30722 |
-
commitUnmount(finishedRoot, node); // Visit children because we may find more host components below.
|
30723 |
|
30724 |
-
|
30725 |
-
|
30726 |
-
|
30727 |
-
|
30728 |
-
|
30729 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30730 |
|
30731 |
-
|
30732 |
-
|
30733 |
-
|
|
|
|
|
|
|
|
|
30734 |
|
30735 |
-
while (node.sibling === null) {
|
30736 |
-
if (node.return === null || node.return === current) {
|
30737 |
-
return;
|
30738 |
-
}
|
30739 |
|
30740 |
-
|
30741 |
|
30742 |
-
if (
|
30743 |
-
|
30744 |
-
// Since we don't keep a stack of them, we will search for it.
|
30745 |
-
currentParentIsValid = false;
|
30746 |
}
|
30747 |
}
|
30748 |
|
30749 |
-
|
30750 |
-
|
30751 |
-
|
30752 |
-
|
|
|
|
|
|
|
|
|
30753 |
|
30754 |
-
|
30755 |
-
|
30756 |
-
|
30757 |
-
|
30758 |
-
|
30759 |
}
|
30760 |
|
30761 |
-
|
30762 |
-
detachFiberMutation(current);
|
30763 |
|
30764 |
-
if (
|
30765 |
-
|
|
|
|
|
30766 |
}
|
30767 |
-
}
|
30768 |
|
30769 |
-
|
|
|
30770 |
|
30771 |
-
|
30772 |
-
|
30773 |
-
case
|
30774 |
-
case
|
30775 |
-
case SimpleMemoComponent:
|
30776 |
-
case Block:
|
30777 |
{
|
30778 |
-
// Layout effects are destroyed during the mutation phase so that all
|
30779 |
-
// destroy functions for all fibers are called before any create functions.
|
30780 |
-
// This prevents sibling component effects from interfering with each other,
|
30781 |
-
// e.g. a destroy function in one component should never override a ref set
|
30782 |
-
// by a create function in another component during the same commit.
|
30783 |
{
|
30784 |
-
|
|
|
|
|
30785 |
}
|
30786 |
-
|
30787 |
-
return;
|
30788 |
}
|
|
|
|
|
|
|
30789 |
|
30790 |
-
case
|
30791 |
{
|
30792 |
-
|
|
|
|
|
|
|
30793 |
}
|
30794 |
|
30795 |
-
case
|
30796 |
{
|
30797 |
-
|
|
|
30798 |
|
30799 |
-
if (
|
30800 |
-
|
30801 |
-
|
30802 |
-
//
|
30803 |
-
//
|
30804 |
|
30805 |
-
|
30806 |
-
|
30807 |
|
30808 |
-
|
30809 |
-
|
|
|
|
|
30810 |
|
30811 |
-
|
30812 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30813 |
}
|
30814 |
-
}
|
30815 |
|
30816 |
-
|
|
|
|
|
30817 |
}
|
30818 |
|
30819 |
-
case
|
30820 |
{
|
30821 |
-
|
30822 |
-
|
30823 |
-
|
30824 |
-
|
|
|
|
|
|
|
30825 |
}
|
30826 |
|
30827 |
-
|
30828 |
-
|
30829 |
-
|
30830 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30831 |
|
30832 |
-
|
30833 |
-
commitTextUpdate(textInstance, oldText, newText);
|
30834 |
-
return;
|
30835 |
-
}
|
30836 |
|
30837 |
-
case HostRoot:
|
30838 |
-
{
|
30839 |
-
{
|
30840 |
-
var _root = finishedWork.stateNode;
|
30841 |
|
30842 |
-
if (
|
30843 |
-
//
|
30844 |
-
|
30845 |
-
|
|
|
30846 |
}
|
30847 |
-
}
|
30848 |
|
30849 |
-
return;
|
30850 |
-
}
|
30851 |
|
30852 |
-
|
30853 |
-
|
30854 |
-
return;
|
30855 |
}
|
30856 |
|
30857 |
-
case
|
30858 |
{
|
30859 |
-
|
30860 |
-
|
30861 |
-
|
30862 |
}
|
30863 |
|
30864 |
-
|
30865 |
{
|
30866 |
-
|
30867 |
-
|
|
|
|
|
|
|
30868 |
}
|
|
|
|
|
30869 |
|
30870 |
-
|
30871 |
-
|
30872 |
-
|
30873 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30874 |
|
30875 |
-
case FundamentalComponent:
|
30876 |
-
{
|
30877 |
|
30878 |
-
|
30879 |
-
|
|
|
|
|
|
|
|
|
30880 |
|
30881 |
-
|
30882 |
-
|
|
|
30883 |
|
30884 |
-
|
30885 |
-
|
|
|
|
|
|
|
30886 |
|
30887 |
-
|
30888 |
-
|
30889 |
-
|
30890 |
-
|
30891 |
-
|
30892 |
-
|
30893 |
-
|
30894 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30895 |
}
|
30896 |
|
30897 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30898 |
{
|
30899 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30900 |
}
|
30901 |
}
|
30902 |
}
|
|
|
|
|
|
|
30903 |
|
30904 |
-
|
30905 |
-
|
30906 |
-
|
30907 |
-
|
30908 |
-
markCommitTimeOfFallback();
|
30909 |
|
30910 |
-
{
|
30911 |
-
//
|
30912 |
-
|
30913 |
-
|
30914 |
-
// effect on itself. However, in this case, the component didn't complete,
|
30915 |
-
// so the fiber was never added to the effect list in the normal path. We
|
30916 |
-
// could have appended it to the effect list in the Suspense component's
|
30917 |
-
// second pass, but doing it this way is less complicated. This would be
|
30918 |
-
// simpler if we got rid of the effect list and traversed the tree, like
|
30919 |
-
// we're planning to do.
|
30920 |
-
var primaryChildParent = finishedWork.child;
|
30921 |
-
hideOrUnhideAllChildren(primaryChildParent, true);
|
30922 |
}
|
30923 |
}
|
30924 |
}
|
|
|
|
|
|
|
30925 |
|
30926 |
-
|
30927 |
-
|
30928 |
-
|
30929 |
-
|
30930 |
-
|
30931 |
-
var current = finishedWork.alternate;
|
30932 |
-
|
30933 |
-
if (current !== null) {
|
30934 |
-
var prevState = current.memoizedState;
|
30935 |
-
|
30936 |
-
if (prevState !== null) {
|
30937 |
-
var suspenseInstance = prevState.dehydrated;
|
30938 |
|
30939 |
-
|
30940 |
-
|
30941 |
-
|
|
|
30942 |
}
|
30943 |
}
|
30944 |
}
|
30945 |
}
|
|
|
|
|
|
|
|
|
30946 |
|
30947 |
-
|
30948 |
-
|
30949 |
-
|
30950 |
-
|
30951 |
-
var wakeables = finishedWork.updateQueue;
|
30952 |
|
30953 |
-
|
30954 |
-
|
30955 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30956 |
|
30957 |
-
|
30958 |
-
|
|
|
30959 |
}
|
30960 |
|
30961 |
-
|
30962 |
-
|
30963 |
-
var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable);
|
30964 |
|
30965 |
-
|
30966 |
-
{
|
30967 |
-
if (wakeable.__reactDoNotTraceInteractions !== true) {
|
30968 |
-
retry = tracing.unstable_wrap(retry);
|
30969 |
-
}
|
30970 |
-
}
|
30971 |
|
30972 |
-
|
30973 |
-
|
|
|
|
|
|
|
|
|
30974 |
}
|
30975 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
30976 |
}
|
30977 |
-
}
|
30978 |
-
|
30979 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30980 |
|
|
|
|
|
|
|
|
|
30981 |
|
30982 |
-
|
30983 |
-
|
30984 |
-
|
|
|
30985 |
|
30986 |
-
|
30987 |
-
var newState = finishedWork.memoizedState;
|
30988 |
-
return newState !== null && newState.dehydrated === null;
|
30989 |
-
}
|
30990 |
}
|
30991 |
|
30992 |
-
|
30993 |
-
|
30994 |
|
30995 |
-
|
|
|
|
|
|
|
|
|
30996 |
|
30997 |
-
|
30998 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30999 |
|
31000 |
-
|
31001 |
-
|
31002 |
-
|
31003 |
-
var TEST_NAME_TYPE = 3;
|
31004 |
-
var TEXT_TYPE = 4;
|
31005 |
|
31006 |
-
if (typeof Symbol === 'function' && Symbol.for) {
|
31007 |
-
var symbolFor$1 = Symbol.for;
|
31008 |
-
COMPONENT_TYPE = symbolFor$1('selector.component');
|
31009 |
-
HAS_PSEUDO_CLASS_TYPE = symbolFor$1('selector.has_pseudo_class');
|
31010 |
-
ROLE_TYPE = symbolFor$1('selector.role');
|
31011 |
-
TEST_NAME_TYPE = symbolFor$1('selector.test_id');
|
31012 |
-
TEXT_TYPE = symbolFor$1('selector.text');
|
31013 |
-
}
|
31014 |
-
var commitHooks = [];
|
31015 |
-
function onCommitRoot$1() {
|
31016 |
{
|
31017 |
-
|
31018 |
-
return commitHook();
|
31019 |
-
});
|
31020 |
}
|
31021 |
}
|
31022 |
|
31023 |
-
|
31024 |
-
|
31025 |
-
|
31026 |
-
IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
|
31027 |
-
var NoContext =
|
31028 |
-
/* */
|
31029 |
-
0;
|
31030 |
-
var BatchedContext =
|
31031 |
-
/* */
|
31032 |
-
1;
|
31033 |
-
var EventContext =
|
31034 |
-
/* */
|
31035 |
-
2;
|
31036 |
-
var DiscreteEventContext =
|
31037 |
-
/* */
|
31038 |
-
4;
|
31039 |
-
var LegacyUnbatchedContext =
|
31040 |
-
/* */
|
31041 |
-
8;
|
31042 |
-
var RenderContext =
|
31043 |
-
/* */
|
31044 |
-
16;
|
31045 |
-
var CommitContext =
|
31046 |
-
/* */
|
31047 |
-
32;
|
31048 |
-
var RetryAfterError =
|
31049 |
-
/* */
|
31050 |
-
64;
|
31051 |
-
var RootIncomplete = 0;
|
31052 |
-
var RootFatalErrored = 1;
|
31053 |
-
var RootErrored = 2;
|
31054 |
-
var RootSuspended = 3;
|
31055 |
-
var RootSuspendedWithDelay = 4;
|
31056 |
-
var RootCompleted = 5; // Describes where we are in the React execution stack
|
31057 |
-
|
31058 |
-
var executionContext = NoContext; // The root we're working on
|
31059 |
|
31060 |
-
|
|
|
|
|
|
|
|
|
|
|
31061 |
|
31062 |
-
|
31063 |
|
31064 |
-
|
31065 |
-
//
|
31066 |
-
//
|
31067 |
-
//
|
31068 |
-
//
|
31069 |
-
|
31070 |
-
//
|
31071 |
-
//
|
|
|
|
|
|
|
|
|
31072 |
|
31073 |
-
|
31074 |
-
|
|
|
31075 |
|
31076 |
-
|
|
|
|
|
|
|
|
|
|
|
31077 |
|
31078 |
-
|
31079 |
-
|
31080 |
-
|
31081 |
-
//
|
|
|
31082 |
|
31083 |
-
|
31084 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
31085 |
|
31086 |
-
|
|
|
31087 |
|
31088 |
-
var workInProgressRootUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render.
|
31089 |
|
31090 |
-
|
31091 |
-
|
31092 |
-
|
31093 |
|
31094 |
-
|
31095 |
-
var
|
31096 |
-
|
31097 |
|
31098 |
-
|
31099 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31100 |
|
31101 |
-
|
|
|
|
|
31102 |
|
31103 |
-
function
|
31104 |
-
|
|
|
|
|
|
|
|
|
31105 |
}
|
31106 |
|
31107 |
-
function
|
31108 |
-
|
|
|
|
|
31109 |
}
|
31110 |
-
var nextEffect = null;
|
31111 |
-
var hasUncaughtError = false;
|
31112 |
-
var firstUncaughtError = null;
|
31113 |
-
var legacyErrorBoundariesThatAlreadyFailed = null;
|
31114 |
-
var rootDoesHavePassiveEffects = false;
|
31115 |
-
var rootWithPendingPassiveEffects = null;
|
31116 |
-
var pendingPassiveEffectsRenderPriority = NoPriority$1;
|
31117 |
-
var pendingPassiveEffectsLanes = NoLanes;
|
31118 |
-
var pendingPassiveHookEffectsMount = [];
|
31119 |
-
var pendingPassiveHookEffectsUnmount = [];
|
31120 |
-
var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates
|
31121 |
|
31122 |
-
|
31123 |
-
|
31124 |
-
|
31125 |
-
|
31126 |
-
|
31127 |
-
|
31128 |
-
|
31129 |
-
|
31130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31131 |
|
31132 |
-
var spawnedWorkDuringRender = null; // If two updates are scheduled within the same event, we should treat their
|
31133 |
-
// event times as simultaneous, even if the actual clock time has advanced
|
31134 |
-
// between the first and second call.
|
31135 |
|
31136 |
-
|
31137 |
-
|
31138 |
-
|
31139 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31140 |
|
31141 |
-
|
31142 |
-
|
31143 |
-
|
31144 |
-
|
31145 |
-
return workInProgressRoot;
|
31146 |
}
|
31147 |
-
function requestEventTime() {
|
31148 |
-
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
31149 |
-
// We're inside React, so it's fine to read the actual time.
|
31150 |
-
return now();
|
31151 |
-
} // We're not inside React, so we may be in the middle of a browser event.
|
31152 |
|
|
|
|
|
|
|
|
|
|
|
31153 |
|
31154 |
-
if (
|
31155 |
-
|
31156 |
-
|
31157 |
-
}
|
31158 |
|
|
|
31159 |
|
31160 |
-
|
31161 |
-
|
31162 |
-
|
31163 |
-
|
31164 |
-
|
31165 |
-
|
|
|
|
|
31166 |
|
31167 |
-
|
31168 |
-
return SyncLane;
|
31169 |
-
} else if ((mode & ConcurrentMode) === NoMode) {
|
31170 |
-
return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane;
|
31171 |
-
} // The algorithm for assigning an update to a lane should be stable for all
|
31172 |
-
// updates at the same priority within the same event. To do this, the inputs
|
31173 |
-
// to the algorithm must be the same. For example, we use the `renderLanes`
|
31174 |
-
// to avoid choosing a lane that is already in the middle of rendering.
|
31175 |
-
//
|
31176 |
-
// However, the "included" lanes could be mutated in between updates in the
|
31177 |
-
// same event, like if you perform an update inside `flushSync`. Or any other
|
31178 |
-
// code path that might call `prepareFreshStack`.
|
31179 |
-
//
|
31180 |
-
// The trick we use is to cache the first of each of these inputs within an
|
31181 |
-
// event. Then reset the cached values once we can be sure the event is over.
|
31182 |
-
// Our heuristic for that is whenever we enter a concurrent work loop.
|
31183 |
-
//
|
31184 |
-
// We'll do the same for `currentEventPendingLanes` below.
|
31185 |
|
|
|
|
|
|
|
31186 |
|
31187 |
-
|
31188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31189 |
}
|
31190 |
|
31191 |
-
var isTransition = requestCurrentTransition() !== NoTransition;
|
31192 |
|
31193 |
-
|
31194 |
-
|
31195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31196 |
}
|
|
|
31197 |
|
31198 |
-
|
31199 |
-
|
31200 |
-
|
|
|
|
|
31201 |
|
|
|
|
|
31202 |
|
31203 |
-
var schedulerPriority = getCurrentPriorityLevel(); // The old behavior was using the priority level of the Scheduler.
|
31204 |
-
// This couples React to the Scheduler internals, so we're replacing it
|
31205 |
-
// with the currentUpdateLanePriority above. As an example of how this
|
31206 |
-
// could be problematic, if we're not inside `Scheduler.runWithPriority`,
|
31207 |
-
// then we'll get the priority of the current running Scheduler task,
|
31208 |
-
// which is probably not what we want.
|
31209 |
|
31210 |
-
|
31211 |
|
31212 |
-
|
31213 |
-
(executionContext & DiscreteEventContext) !== NoContext && schedulerPriority === UserBlockingPriority$2) {
|
31214 |
-
lane = findUpdateLane(InputDiscreteLanePriority, currentEventWipLanes);
|
31215 |
} else {
|
31216 |
-
var schedulerLanePriority = schedulerPriorityToLanePriority(schedulerPriority);
|
31217 |
|
31218 |
-
|
|
|
|
|
|
|
|
|
31219 |
}
|
|
|
|
|
31220 |
|
31221 |
-
|
|
|
|
|
|
|
|
|
|
|
31222 |
}
|
31223 |
|
31224 |
-
function
|
31225 |
-
//
|
31226 |
-
//
|
31227 |
-
//
|
31228 |
-
|
31229 |
-
|
|
|
31230 |
|
31231 |
-
if ((mode &
|
31232 |
-
|
31233 |
-
|
31234 |
-
|
31235 |
-
}
|
|
|
|
|
31236 |
|
|
|
|
|
31237 |
|
31238 |
-
if (
|
31239 |
-
|
|
|
|
|
|
|
31240 |
}
|
31241 |
|
31242 |
-
|
31243 |
}
|
31244 |
|
31245 |
-
function
|
31246 |
-
|
31247 |
-
|
31248 |
-
var
|
31249 |
|
31250 |
-
|
31251 |
-
|
31252 |
-
|
31253 |
-
|
|
|
|
|
31254 |
|
|
|
|
|
|
|
31255 |
|
31256 |
-
|
|
|
|
|
|
|
|
|
31257 |
|
31258 |
-
|
31259 |
-
|
31260 |
-
// that there was an interleaved update work on this root. Unless the
|
31261 |
-
// `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render
|
31262 |
-
// phase update. In that case, we don't treat render phase updates as if
|
31263 |
-
// they were interleaved, for backwards compat reasons.
|
31264 |
-
{
|
31265 |
-
workInProgressRootUpdatedLanes = mergeLanes(workInProgressRootUpdatedLanes, lane);
|
31266 |
-
}
|
31267 |
|
31268 |
-
|
31269 |
-
// The root already suspended with a delay, which means this render
|
31270 |
-
// definitely won't finish. Since we have a new update, let's mark it as
|
31271 |
-
// suspended now, right before marking the incoming update. This has the
|
31272 |
-
// effect of interrupting the current render and switching to the update.
|
31273 |
-
// TODO: Make sure this doesn't override pings that happen while we've
|
31274 |
-
// already started rendering.
|
31275 |
-
markRootSuspended$1(root, workInProgressRootRenderLanes);
|
31276 |
-
}
|
31277 |
-
} // TODO: requestUpdateLanePriority also reads the priority. Pass the
|
31278 |
-
// priority as an argument to that function and this one.
|
31279 |
|
|
|
|
|
|
|
|
|
|
|
31280 |
|
31281 |
-
|
31282 |
|
31283 |
-
|
31284 |
-
|
31285 |
-
|
31286 |
-
|
31287 |
-
|
31288 |
-
|
31289 |
-
|
31290 |
-
|
31291 |
|
31292 |
-
|
31293 |
-
|
31294 |
-
|
31295 |
-
|
31296 |
|
31297 |
-
|
31298 |
-
//
|
31299 |
-
//
|
31300 |
-
//
|
31301 |
-
//
|
31302 |
-
//
|
31303 |
-
|
31304 |
-
flushSyncCallbackQueue();
|
31305 |
-
}
|
31306 |
-
}
|
31307 |
-
} else {
|
31308 |
-
// Schedule a discrete update but only if it's not Sync.
|
31309 |
-
if ((executionContext & DiscreteEventContext) !== NoContext && ( // Only updates at user-blocking priority or greater are considered
|
31310 |
-
// discrete, even inside a discrete event.
|
31311 |
-
priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority$1)) {
|
31312 |
-
// This is the result of a discrete event. Track the lowest priority
|
31313 |
-
// discrete update per root so we can flush them early, if needed.
|
31314 |
-
if (rootsWithPendingDiscreteUpdates === null) {
|
31315 |
-
rootsWithPendingDiscreteUpdates = new Set([root]);
|
31316 |
-
} else {
|
31317 |
-
rootsWithPendingDiscreteUpdates.add(root);
|
31318 |
-
}
|
31319 |
-
} // Schedule other updates after in case the callback is sync.
|
31320 |
|
31321 |
|
31322 |
-
|
31323 |
-
|
31324 |
-
|
31325 |
-
// `requestUpdateLane`. We assume it's the same as the root being updated,
|
31326 |
-
// since in the common case of a single root app it probably is. If it's not
|
31327 |
-
// the same root, then it's not a huge deal, we just might batch more stuff
|
31328 |
-
// together more than necessary.
|
31329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31330 |
|
31331 |
-
|
31332 |
-
}
|
31333 |
-
|
31334 |
-
|
31335 |
-
//
|
|
|
|
|
|
|
31336 |
|
31337 |
-
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
31338 |
-
// Update the source fiber's lanes
|
31339 |
-
sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane);
|
31340 |
-
var alternate = sourceFiber.alternate;
|
31341 |
|
31342 |
-
|
31343 |
-
|
31344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
31345 |
|
31346 |
-
|
31347 |
-
|
31348 |
-
|
31349 |
-
}
|
31350 |
-
} // Walk the parent path to the root and update the child expiration time.
|
31351 |
|
|
|
|
|
31352 |
|
31353 |
-
|
31354 |
-
|
|
|
|
|
31355 |
|
31356 |
-
|
31357 |
-
|
31358 |
-
alternate = parent.alternate;
|
31359 |
|
31360 |
-
|
31361 |
-
|
31362 |
-
|
31363 |
-
|
31364 |
-
if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
|
31365 |
-
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
31366 |
-
}
|
31367 |
}
|
31368 |
}
|
31369 |
|
31370 |
-
|
31371 |
-
parent = parent.return;
|
31372 |
-
}
|
31373 |
-
|
31374 |
-
if (node.tag === HostRoot) {
|
31375 |
-
var root = node.stateNode;
|
31376 |
-
return root;
|
31377 |
-
} else {
|
31378 |
-
return null;
|
31379 |
-
}
|
31380 |
-
} // Use this function to schedule a task for a root. There's only one task per
|
31381 |
-
// root; if a task was already scheduled, we'll check to make sure the priority
|
31382 |
-
// of the existing task is the same as the priority of the next level that the
|
31383 |
-
// root has work on. This function is called on every update, and right before
|
31384 |
-
// exiting a task.
|
31385 |
|
|
|
|
|
|
|
|
|
|
|
31386 |
|
31387 |
-
function ensureRootIsScheduled(root, currentTime) {
|
31388 |
-
var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as
|
31389 |
-
// expired so we know to work on those next.
|
31390 |
|
31391 |
-
|
31392 |
|
31393 |
-
|
|
|
31394 |
|
31395 |
-
var newCallbackPriority = returnNextLanesPriority();
|
31396 |
|
31397 |
-
if (
|
31398 |
-
|
31399 |
-
|
31400 |
-
|
31401 |
-
root.callbackNode = null;
|
31402 |
-
root.callbackPriority = NoLanePriority;
|
31403 |
-
}
|
31404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31405 |
return;
|
31406 |
-
}
|
31407 |
|
|
|
31408 |
|
31409 |
-
if (
|
31410 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31411 |
|
31412 |
-
|
31413 |
-
|
31414 |
-
return;
|
31415 |
-
} // The priority changed. Cancel the existing callback. We'll schedule a new
|
31416 |
-
// one below.
|
31417 |
|
|
|
|
|
31418 |
|
31419 |
-
|
31420 |
-
|
|
|
31421 |
|
|
|
|
|
|
|
31422 |
|
31423 |
-
|
31424 |
|
31425 |
-
|
31426 |
-
|
31427 |
-
|
31428 |
-
|
31429 |
-
|
31430 |
-
|
|
|
|
|
|
|
|
|
|
|
31431 |
} else {
|
31432 |
-
var
|
31433 |
-
|
|
|
|
|
|
|
|
|
31434 |
}
|
31435 |
|
31436 |
-
|
31437 |
-
|
31438 |
-
} // This is the entry point for every concurrent task, i.e. anything that
|
31439 |
-
// goes through Scheduler.
|
31440 |
|
|
|
|
|
|
|
|
|
|
|
31441 |
|
31442 |
-
function
|
31443 |
-
|
31444 |
-
|
31445 |
-
|
31446 |
-
|
31447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
31448 |
|
31449 |
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
31450 |
{
|
31451 |
throw Error( "Should not already be working." );
|
31452 |
}
|
31453 |
-
}
|
31454 |
-
// in case they schedule additional work.
|
31455 |
-
|
31456 |
-
|
31457 |
-
var originalCallbackNode = root.callbackNode;
|
31458 |
-
var didFlushPassiveEffects = flushPassiveEffects();
|
31459 |
-
|
31460 |
-
if (didFlushPassiveEffects) {
|
31461 |
-
// Something in the passive effect phase may have canceled the current task.
|
31462 |
-
// Check if the task node for this root was changed.
|
31463 |
-
if (root.callbackNode !== originalCallbackNode) {
|
31464 |
-
// The current task was canceled. Exit. We don't need to call
|
31465 |
-
// `ensureRootIsScheduled` because the check above implies either that
|
31466 |
-
// there's a new task, or that there's no remaining work on this root.
|
31467 |
-
return null;
|
31468 |
-
}
|
31469 |
-
} // Determine the next expiration time to work on, using the fields stored
|
31470 |
-
// on the root.
|
31471 |
|
|
|
|
|
31472 |
|
31473 |
-
|
31474 |
|
31475 |
-
if (lanes === NoLanes) {
|
31476 |
-
// Defensive coding. This is never expected to happen.
|
31477 |
return null;
|
31478 |
}
|
31479 |
|
31480 |
-
|
|
|
31481 |
|
31482 |
-
if (
|
31483 |
-
|
31484 |
-
|
31485 |
-
|
31486 |
-
|
31487 |
-
|
31488 |
-
// So we'll throw out the current work and restart.
|
31489 |
-
prepareFreshStack(root, NoLanes);
|
31490 |
-
} else if (exitStatus !== RootIncomplete) {
|
31491 |
-
if (exitStatus === RootErrored) {
|
31492 |
-
executionContext |= RetryAfterError; // If an error occurred during hydration,
|
31493 |
-
// discard server response and fall back to client side render.
|
31494 |
|
31495 |
-
if (root.hydrate) {
|
31496 |
-
root.hydrate = false;
|
31497 |
-
clearContainer(root.containerInfo);
|
31498 |
-
} // If something threw an error, try rendering one more time. We'll render
|
31499 |
-
// synchronously to block concurrent data mutations, and we'll includes
|
31500 |
-
// all pending updates are included. If it still fails after the second
|
31501 |
-
// attempt, we'll give up and commit the resulting tree.
|
31502 |
|
|
|
|
|
31503 |
|
31504 |
-
|
|
|
|
|
|
|
31505 |
|
31506 |
-
|
31507 |
-
|
31508 |
-
|
31509 |
}
|
|
|
31510 |
|
31511 |
-
|
31512 |
-
|
31513 |
-
|
31514 |
-
|
31515 |
-
|
31516 |
-
|
31517 |
-
} // We now have a consistent tree. The next step is either to commit it,
|
31518 |
-
// or, if something suspended, wait to commit it after a timeout.
|
31519 |
|
31520 |
|
31521 |
-
|
31522 |
-
|
31523 |
-
|
31524 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31525 |
}
|
31526 |
|
31527 |
-
|
31528 |
|
31529 |
-
|
31530 |
-
|
31531 |
-
//
|
31532 |
-
return performConcurrentWorkOnRoot.bind(null, root);
|
31533 |
-
}
|
31534 |
|
31535 |
-
|
31536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31537 |
|
31538 |
-
|
31539 |
-
switch (exitStatus) {
|
31540 |
-
case RootIncomplete:
|
31541 |
-
case RootFatalErrored:
|
31542 |
{
|
31543 |
-
|
31544 |
-
|
31545 |
-
|
|
|
|
|
|
|
|
|
31546 |
}
|
31547 |
-
}
|
31548 |
-
}
|
31549 |
-
// Flow knows about invariant, so it complains if I add a break
|
31550 |
-
// statement, but eslint doesn't know about invariant, so it complains
|
31551 |
-
// if I do. eslint-disable-next-line no-fallthrough
|
31552 |
|
31553 |
-
|
31554 |
-
|
31555 |
-
|
31556 |
-
|
31557 |
-
commitRoot(root);
|
31558 |
-
break;
|
31559 |
}
|
|
|
31560 |
|
31561 |
-
case RootSuspended:
|
31562 |
-
{
|
31563 |
-
markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we
|
31564 |
-
// should immediately commit it or wait a bit.
|
31565 |
-
|
31566 |
-
if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope
|
31567 |
-
!shouldForceFlushFallbacksInDEV()) {
|
31568 |
-
// This render only included retries, no updates. Throttle committing
|
31569 |
-
// retries so that we don't show too many loading states too quickly.
|
31570 |
-
var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time.
|
31571 |
|
31572 |
-
|
31573 |
-
var nextLanes = getNextLanes(root, NoLanes);
|
31574 |
|
31575 |
-
|
31576 |
-
|
31577 |
-
|
31578 |
-
|
|
|
31579 |
|
31580 |
-
var suspendedLanes = root.suspendedLanes;
|
31581 |
|
31582 |
-
|
31583 |
-
// We should prefer to render the fallback of at the last
|
31584 |
-
// suspended level. Ping the last suspended level to try
|
31585 |
-
// rendering it again.
|
31586 |
-
// FIXME: What if the suspended lanes are Idle? Should not restart.
|
31587 |
-
var eventTime = requestEventTime();
|
31588 |
-
markRootPinged(root, suspendedLanes);
|
31589 |
-
break;
|
31590 |
-
} // The render is suspended, it hasn't timed out, and there's no
|
31591 |
-
// lower priority work to do. Instead of committing the fallback
|
31592 |
-
// immediately, wait for more data to arrive.
|
31593 |
|
|
|
|
|
|
|
31594 |
|
31595 |
-
|
31596 |
-
|
|
|
|
|
|
|
31597 |
}
|
31598 |
-
} // The work expired. Commit immediately.
|
31599 |
|
|
|
31600 |
|
31601 |
-
|
31602 |
-
|
|
|
31603 |
}
|
|
|
31604 |
|
31605 |
-
|
31606 |
-
|
31607 |
-
|
31608 |
-
|
31609 |
-
if (includesOnlyTransitions(lanes)) {
|
31610 |
-
// This is a transition, so we should exit without committing a
|
31611 |
-
// placeholder and without scheduling a timeout. Delay indefinitely
|
31612 |
-
// until we receive more data.
|
31613 |
-
break;
|
31614 |
-
}
|
31615 |
|
31616 |
-
|
31617 |
-
|
31618 |
-
|
31619 |
-
// Noticeable Difference.
|
31620 |
-
// TODO: Is the JND optimization worth the added complexity? If this is
|
31621 |
-
// the only reason we track the event time, then probably not.
|
31622 |
-
// Consider removing.
|
31623 |
-
var mostRecentEventTime = getMostRecentEventTime(root, lanes);
|
31624 |
-
var eventTimeMs = mostRecentEventTime;
|
31625 |
-
var timeElapsedMs = now() - eventTimeMs;
|
31626 |
|
31627 |
-
|
31628 |
|
|
|
|
|
|
|
31629 |
|
31630 |
-
|
31631 |
-
|
31632 |
-
|
31633 |
-
|
31634 |
-
|
31635 |
}
|
31636 |
-
} // Commit the placeholder.
|
31637 |
|
|
|
31638 |
|
31639 |
-
|
31640 |
-
|
|
|
31641 |
}
|
|
|
31642 |
|
31643 |
-
|
31644 |
-
|
31645 |
-
// The work completed. Ready to commit.
|
31646 |
-
commitRoot(root);
|
31647 |
-
break;
|
31648 |
-
}
|
31649 |
|
31650 |
-
|
31651 |
-
{
|
31652 |
-
{
|
31653 |
-
{
|
31654 |
-
throw Error( "Unknown root exit status." );
|
31655 |
-
}
|
31656 |
-
}
|
31657 |
-
}
|
31658 |
-
}
|
31659 |
-
}
|
31660 |
|
31661 |
-
|
31662 |
-
|
31663 |
-
|
31664 |
-
// TODO: Lol maybe there's a better way to factor this besides this
|
31665 |
-
// obnoxiously named function :)
|
31666 |
-
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes);
|
31667 |
-
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes);
|
31668 |
-
markRootSuspended(root, suspendedLanes);
|
31669 |
-
} // This is the entry point for synchronous tasks that don't go
|
31670 |
-
// through Scheduler
|
31671 |
|
|
|
|
|
|
|
|
|
|
|
|
|
31672 |
|
31673 |
-
function performSyncWorkOnRoot(root) {
|
31674 |
-
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
31675 |
{
|
31676 |
-
|
31677 |
}
|
31678 |
}
|
31679 |
|
31680 |
-
|
31681 |
-
var lanes;
|
31682 |
-
var exitStatus;
|
31683 |
|
31684 |
-
if (
|
31685 |
-
//
|
31686 |
-
//
|
31687 |
-
|
31688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31689 |
|
31690 |
-
|
31691 |
-
|
31692 |
-
|
31693 |
-
|
31694 |
-
|
31695 |
-
|
31696 |
-
|
31697 |
-
|
31698 |
-
|
31699 |
-
lanes = getNextLanes(root, lanes);
|
31700 |
-
exitStatus = renderRootSync(root, lanes);
|
31701 |
}
|
31702 |
-
}
|
31703 |
-
lanes = getNextLanes(root, NoLanes);
|
31704 |
-
exitStatus = renderRootSync(root, lanes);
|
31705 |
-
}
|
31706 |
|
31707 |
-
if (root.tag !== LegacyRoot && exitStatus === RootErrored) {
|
31708 |
-
executionContext |= RetryAfterError; // If an error occurred during hydration,
|
31709 |
-
// discard server response and fall back to client side render.
|
31710 |
|
31711 |
-
|
31712 |
-
root.hydrate = false;
|
31713 |
-
clearContainer(root.containerInfo);
|
31714 |
-
} // If something threw an error, try rendering one more time. We'll render
|
31715 |
-
// synchronously to block concurrent data mutations, and we'll includes
|
31716 |
-
// all pending updates are included. If it still fails after the second
|
31717 |
-
// attempt, we'll give up and commit the resulting tree.
|
31718 |
|
|
|
|
|
|
|
|
|
|
|
31719 |
|
31720 |
-
|
|
|
|
|
|
|
31721 |
|
31722 |
-
|
31723 |
-
exitStatus = renderRootSync(root, lanes);
|
31724 |
}
|
|
|
|
|
|
|
|
|
31725 |
}
|
31726 |
|
31727 |
-
|
31728 |
-
|
31729 |
-
|
31730 |
-
|
31731 |
-
|
31732 |
-
|
31733 |
-
|
31734 |
-
|
|
|
31735 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31736 |
|
31737 |
-
|
31738 |
-
root.finishedWork = finishedWork;
|
31739 |
-
root.finishedLanes = lanes;
|
31740 |
-
commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next
|
31741 |
-
// pending level.
|
31742 |
|
31743 |
-
|
31744 |
-
|
31745 |
-
}
|
31746 |
-
|
31747 |
-
// TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
|
31748 |
-
// However, `act` uses `batchedUpdates`, so there's no way to distinguish
|
31749 |
-
// those two cases. Need to fix this before exposing flushDiscreteUpdates
|
31750 |
-
// as a public API.
|
31751 |
-
if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
|
31752 |
-
{
|
31753 |
-
if ((executionContext & RenderContext) !== NoContext) {
|
31754 |
-
error('unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
|
31755 |
-
}
|
31756 |
-
} // We're already rendering, so we can't synchronously flush pending work.
|
31757 |
-
// This is probably a nested event dispatch triggered by a lifecycle/effect,
|
31758 |
-
// like `el.focus()`. Exit.
|
31759 |
|
31760 |
|
31761 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
31762 |
}
|
31763 |
|
31764 |
-
|
31765 |
-
|
|
|
|
|
31766 |
|
31767 |
-
flushPassiveEffects();
|
31768 |
-
}
|
31769 |
|
31770 |
-
|
31771 |
-
|
31772 |
-
// For each root with pending discrete updates, schedule a callback to
|
31773 |
-
// immediately flush them.
|
31774 |
-
var roots = rootsWithPendingDiscreteUpdates;
|
31775 |
-
rootsWithPendingDiscreteUpdates = null;
|
31776 |
-
roots.forEach(function (root) {
|
31777 |
-
markDiscreteUpdatesExpired(root);
|
31778 |
-
ensureRootIsScheduled(root, now());
|
31779 |
-
});
|
31780 |
-
} // Now flush the immediate queue.
|
31781 |
|
31782 |
|
31783 |
flushSyncCallbackQueue();
|
|
|
|
|
31784 |
}
|
31785 |
|
31786 |
-
function
|
31787 |
-
|
31788 |
-
|
31789 |
|
31790 |
-
|
31791 |
-
|
31792 |
-
|
31793 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31794 |
|
31795 |
-
|
31796 |
-
|
31797 |
-
|
31798 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31799 |
}
|
|
|
|
|
31800 |
}
|
31801 |
}
|
31802 |
-
function batchedEventUpdates$1(fn, a) {
|
31803 |
-
var prevExecutionContext = executionContext;
|
31804 |
-
executionContext |= EventContext;
|
31805 |
|
31806 |
-
|
31807 |
-
|
31808 |
-
|
31809 |
-
|
|
|
31810 |
|
31811 |
-
if (
|
31812 |
-
|
31813 |
-
resetRenderTimer();
|
31814 |
-
flushSyncCallbackQueue();
|
31815 |
}
|
31816 |
-
}
|
31817 |
-
}
|
31818 |
-
function discreteUpdates$1(fn, a, b, c, d) {
|
31819 |
-
var prevExecutionContext = executionContext;
|
31820 |
-
executionContext |= DiscreteEventContext;
|
31821 |
|
31822 |
-
|
31823 |
-
|
31824 |
-
return runWithPriority$1(UserBlockingPriority$2, fn.bind(null, a, b, c, d));
|
31825 |
-
} finally {
|
31826 |
-
executionContext = prevExecutionContext;
|
31827 |
|
31828 |
-
if (
|
31829 |
-
|
31830 |
-
resetRenderTimer();
|
31831 |
-
flushSyncCallbackQueue();
|
31832 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31833 |
}
|
|
|
|
|
|
|
31834 |
}
|
31835 |
}
|
31836 |
-
function unbatchedUpdates(fn, a) {
|
31837 |
-
var prevExecutionContext = executionContext;
|
31838 |
-
executionContext &= ~BatchedContext;
|
31839 |
-
executionContext |= LegacyUnbatchedContext;
|
31840 |
|
31841 |
-
try {
|
31842 |
-
return fn(a);
|
31843 |
-
} finally {
|
31844 |
-
exec
|
120 |
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
121 |
var requestData = config.data;
|
122 |
var requestHeaders = config.headers;
|
123 |
+
var responseType = config.responseType;
|
124 |
|
125 |
if (utils.isFormData(requestData)) {
|
126 |
delete requestHeaders['Content-Type']; // Let the browser set it
|
141 |
// Set the request timeout in MS
|
142 |
request.timeout = config.timeout;
|
143 |
|
144 |
+
function onloadend() {
|
145 |
+
if (!request) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
return;
|
147 |
}
|
|
|
148 |
// Prepare the response
|
149 |
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
150 |
+
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
151 |
+
request.responseText : request.response;
|
152 |
var response = {
|
153 |
data: responseData,
|
154 |
status: request.status,
|
162 |
|
163 |
// Clean up request
|
164 |
request = null;
|
165 |
+
}
|
166 |
+
|
167 |
+
if ('onloadend' in request) {
|
168 |
+
// Use onloadend if available
|
169 |
+
request.onloadend = onloadend;
|
170 |
+
} else {
|
171 |
+
// Listen for ready state to emulate onloadend
|
172 |
+
request.onreadystatechange = function handleLoad() {
|
173 |
+
if (!request || request.readyState !== 4) {
|
174 |
+
return;
|
175 |
+
}
|
176 |
+
|
177 |
+
// The request errored out and we didn't get a response, this will be
|
178 |
+
// handled by onerror instead
|
179 |
+
// With one exception: request that using file: protocol, most browsers
|
180 |
+
// will return status as 0 even though it's a successful request
|
181 |
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
182 |
+
return;
|
183 |
+
}
|
184 |
+
// readystate handler is calling before onerror or ontimeout handlers,
|
185 |
+
// so we should call onloadend on the next 'tick'
|
186 |
+
setTimeout(onloadend);
|
187 |
+
};
|
188 |
+
}
|
189 |
|
190 |
// Handle browser request cancellation (as opposed to a manual cancellation)
|
191 |
request.onabort = function handleAbort() {
|
215 |
if (config.timeoutErrorMessage) {
|
216 |
timeoutErrorMessage = config.timeoutErrorMessage;
|
217 |
}
|
218 |
+
reject(createError(
|
219 |
+
timeoutErrorMessage,
|
220 |
+
config,
|
221 |
+
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
222 |
request));
|
223 |
|
224 |
// Clean up request
|
258 |
}
|
259 |
|
260 |
// Add responseType to request if needed
|
261 |
+
if (responseType && responseType !== 'json') {
|
262 |
+
request.responseType = config.responseType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
}
|
264 |
|
265 |
// Handle progress if needed
|
498 |
var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
|
499 |
var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
|
500 |
var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
|
501 |
+
var validator = __webpack_require__(/*! ../helpers/validator */ "./node_modules/axios/lib/helpers/validator.js");
|
502 |
|
503 |
+
var validators = validator.validators;
|
504 |
/**
|
505 |
* Create a new instance of Axios
|
506 |
*
|
540 |
config.method = 'get';
|
541 |
}
|
542 |
|
543 |
+
var transitional = config.transitional;
|
544 |
+
|
545 |
+
if (transitional !== undefined) {
|
546 |
+
validator.assertOptions(transitional, {
|
547 |
+
silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
548 |
+
forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
549 |
+
clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')
|
550 |
+
}, false);
|
551 |
+
}
|
552 |
|
553 |
+
// filter out skipped interceptors
|
554 |
+
var requestInterceptorChain = [];
|
555 |
+
var synchronousRequestInterceptors = true;
|
556 |
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
557 |
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
558 |
+
return;
|
559 |
+
}
|
560 |
+
|
561 |
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
562 |
+
|
563 |
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
564 |
});
|
565 |
|
566 |
+
var responseInterceptorChain = [];
|
567 |
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
568 |
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
569 |
});
|
570 |
|
571 |
+
var promise;
|
572 |
+
|
573 |
+
if (!synchronousRequestInterceptors) {
|
574 |
+
var chain = [dispatchRequest, undefined];
|
575 |
+
|
576 |
+
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
577 |
+
chain = chain.concat(responseInterceptorChain);
|
578 |
+
|
579 |
+
promise = Promise.resolve(config);
|
580 |
+
while (chain.length) {
|
581 |
+
promise = promise.then(chain.shift(), chain.shift());
|
582 |
+
}
|
583 |
+
|
584 |
+
return promise;
|
585 |
+
}
|
586 |
+
|
587 |
+
|
588 |
+
var newConfig = config;
|
589 |
+
while (requestInterceptorChain.length) {
|
590 |
+
var onFulfilled = requestInterceptorChain.shift();
|
591 |
+
var onRejected = requestInterceptorChain.shift();
|
592 |
+
try {
|
593 |
+
newConfig = onFulfilled(newConfig);
|
594 |
+
} catch (error) {
|
595 |
+
onRejected(error);
|
596 |
+
break;
|
597 |
+
}
|
598 |
+
}
|
599 |
+
|
600 |
+
try {
|
601 |
+
promise = dispatchRequest(newConfig);
|
602 |
+
} catch (error) {
|
603 |
+
return Promise.reject(error);
|
604 |
+
}
|
605 |
+
|
606 |
+
while (responseInterceptorChain.length) {
|
607 |
+
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
608 |
}
|
609 |
|
610 |
return promise;
|
667 |
*
|
668 |
* @return {Number} An ID used to remove interceptor later
|
669 |
*/
|
670 |
+
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
671 |
this.handlers.push({
|
672 |
fulfilled: fulfilled,
|
673 |
+
rejected: rejected,
|
674 |
+
synchronous: options ? options.synchronous : false,
|
675 |
+
runWhen: options ? options.runWhen : null
|
676 |
});
|
677 |
return this.handlers.length - 1;
|
678 |
};
|
808 |
config.headers = config.headers || {};
|
809 |
|
810 |
// Transform request data
|
811 |
+
config.data = transformData.call(
|
812 |
+
config,
|
813 |
config.data,
|
814 |
config.headers,
|
815 |
config.transformRequest
|
835 |
throwIfCancellationRequested(config);
|
836 |
|
837 |
// Transform response data
|
838 |
+
response.data = transformData.call(
|
839 |
+
config,
|
840 |
response.data,
|
841 |
response.headers,
|
842 |
config.transformResponse
|
849 |
|
850 |
// Transform response data
|
851 |
if (reason && reason.response) {
|
852 |
+
reason.response.data = transformData.call(
|
853 |
+
config,
|
854 |
reason.response.data,
|
855 |
reason.response.headers,
|
856 |
config.transformResponse
|
1066 |
|
1067 |
|
1068 |
var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
|
1069 |
+
var defaults = __webpack_require__(/*! ./../defaults */ "./node_modules/axios/lib/defaults.js");
|
1070 |
|
1071 |
/**
|
1072 |
* Transform the data for a request or a response
|
1077 |
* @returns {*} The resulting transformed data
|
1078 |
*/
|
1079 |
module.exports = function transformData(data, headers, fns) {
|
1080 |
+
var context = this || defaults;
|
1081 |
/*eslint no-param-reassign:0*/
|
1082 |
utils.forEach(fns, function transform(fn) {
|
1083 |
+
data = fn.call(context, data, headers);
|
1084 |
});
|
1085 |
|
1086 |
return data;
|
1101 |
|
1102 |
var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
|
1103 |
var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
|
1104 |
+
var enhanceError = __webpack_require__(/*! ./core/enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
|
1105 |
|
1106 |
var DEFAULT_CONTENT_TYPE = {
|
1107 |
'Content-Type': 'application/x-www-form-urlencoded'
|
1125 |
return adapter;
|
1126 |
}
|
1127 |
|
1128 |
+
function stringifySafely(rawValue, parser, encoder) {
|
1129 |
+
if (utils.isString(rawValue)) {
|
1130 |
+
try {
|
1131 |
+
(parser || JSON.parse)(rawValue);
|
1132 |
+
return utils.trim(rawValue);
|
1133 |
+
} catch (e) {
|
1134 |
+
if (e.name !== 'SyntaxError') {
|
1135 |
+
throw e;
|
1136 |
+
}
|
1137 |
+
}
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
return (encoder || JSON.stringify)(rawValue);
|
1141 |
+
}
|
1142 |
+
|
1143 |
var defaults = {
|
1144 |
+
|
1145 |
+
transitional: {
|
1146 |
+
silentJSONParsing: true,
|
1147 |
+
forcedJSONParsing: true,
|
1148 |
+
clarifyTimeoutError: false
|
1149 |
+
},
|
1150 |
+
|
1151 |
adapter: getDefaultAdapter(),
|
1152 |
|
1153 |
transformRequest: [function transformRequest(data, headers) {
|
1154 |
normalizeHeaderName(headers, 'Accept');
|
1155 |
normalizeHeaderName(headers, 'Content-Type');
|
1156 |
+
|
1157 |
if (utils.isFormData(data) ||
|
1158 |
utils.isArrayBuffer(data) ||
|
1159 |
utils.isBuffer(data) ||
|
1170 |
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
1171 |
return data.toString();
|
1172 |
}
|
1173 |
+
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
1174 |
+
setContentTypeIfUnset(headers, 'application/json');
|
1175 |
+
return stringifySafely(data);
|
1176 |
}
|
1177 |
return data;
|
1178 |
}],
|
1179 |
|
1180 |
transformResponse: [function transformResponse(data) {
|
1181 |
+
var transitional = this.transitional;
|
1182 |
+
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
1183 |
+
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
1184 |
+
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
1185 |
+
|
1186 |
+
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
1187 |
try {
|
1188 |
+
return JSON.parse(data);
|
1189 |
+
} catch (e) {
|
1190 |
+
if (strictJSONParsing) {
|
1191 |
+
if (e.name === 'SyntaxError') {
|
1192 |
+
throw enhanceError(e, this, 'E_JSON_PARSE');
|
1193 |
+
}
|
1194 |
+
throw e;
|
1195 |
+
}
|
1196 |
+
}
|
1197 |
}
|
1198 |
+
|
1199 |
return data;
|
1200 |
}],
|
1201 |
|
1687 |
};
|
1688 |
|
1689 |
|
1690 |
+
/***/ }),
|
1691 |
+
|
1692 |
+
/***/ "./node_modules/axios/lib/helpers/validator.js":
|
1693 |
+
/*!*****************************************************!*\
|
1694 |
+
!*** ./node_modules/axios/lib/helpers/validator.js ***!
|
1695 |
+
\*****************************************************/
|
1696 |
+
/*! no static exports found */
|
1697 |
+
/***/ (function(module, exports, __webpack_require__) {
|
1698 |
+
|
1699 |
+
"use strict";
|
1700 |
+
|
1701 |
+
|
1702 |
+
var pkg = __webpack_require__(/*! ./../../package.json */ "./node_modules/axios/package.json");
|
1703 |
+
|
1704 |
+
var validators = {};
|
1705 |
+
|
1706 |
+
// eslint-disable-next-line func-names
|
1707 |
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
1708 |
+
validators[type] = function validator(thing) {
|
1709 |
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
1710 |
+
};
|
1711 |
+
});
|
1712 |
+
|
1713 |
+
var deprecatedWarnings = {};
|
1714 |
+
var currentVerArr = pkg.version.split('.');
|
1715 |
+
|
1716 |
+
/**
|
1717 |
+
* Compare package versions
|
1718 |
+
* @param {string} version
|
1719 |
+
* @param {string?} thanVersion
|
1720 |
+
* @returns {boolean}
|
1721 |
+
*/
|
1722 |
+
function isOlderVersion(version, thanVersion) {
|
1723 |
+
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
1724 |
+
var destVer = version.split('.');
|
1725 |
+
for (var i = 0; i < 3; i++) {
|
1726 |
+
if (pkgVersionArr[i] > destVer[i]) {
|
1727 |
+
return true;
|
1728 |
+
} else if (pkgVersionArr[i] < destVer[i]) {
|
1729 |
+
return false;
|
1730 |
+
}
|
1731 |
+
}
|
1732 |
+
return false;
|
1733 |
+
}
|
1734 |
+
|
1735 |
+
/**
|
1736 |
+
* Transitional option validator
|
1737 |
+
* @param {function|boolean?} validator
|
1738 |
+
* @param {string?} version
|
1739 |
+
* @param {string} message
|
1740 |
+
* @returns {function}
|
1741 |
+
*/
|
1742 |
+
validators.transitional = function transitional(validator, version, message) {
|
1743 |
+
var isDeprecated = version && isOlderVersion(version);
|
1744 |
+
|
1745 |
+
function formatMessage(opt, desc) {
|
1746 |
+
return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
// eslint-disable-next-line func-names
|
1750 |
+
return function(value, opt, opts) {
|
1751 |
+
if (validator === false) {
|
1752 |
+
throw new Error(formatMessage(opt, ' has been removed in ' + version));
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
if (isDeprecated && !deprecatedWarnings[opt]) {
|
1756 |
+
deprecatedWarnings[opt] = true;
|
1757 |
+
// eslint-disable-next-line no-console
|
1758 |
+
console.warn(
|
1759 |
+
formatMessage(
|
1760 |
+
opt,
|
1761 |
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
1762 |
+
)
|
1763 |
+
);
|
1764 |
+
}
|
1765 |
+
|
1766 |
+
return validator ? validator(value, opt, opts) : true;
|
1767 |
+
};
|
1768 |
+
};
|
1769 |
+
|
1770 |
+
/**
|
1771 |
+
* Assert object's properties type
|
1772 |
+
* @param {object} options
|
1773 |
+
* @param {object} schema
|
1774 |
+
* @param {boolean?} allowUnknown
|
1775 |
+
*/
|
1776 |
+
|
1777 |
+
function assertOptions(options, schema, allowUnknown) {
|
1778 |
+
if (typeof options !== 'object') {
|
1779 |
+
throw new TypeError('options must be an object');
|
1780 |
+
}
|
1781 |
+
var keys = Object.keys(options);
|
1782 |
+
var i = keys.length;
|
1783 |
+
while (i-- > 0) {
|
1784 |
+
var opt = keys[i];
|
1785 |
+
var validator = schema[opt];
|
1786 |
+
if (validator) {
|
1787 |
+
var value = options[opt];
|
1788 |
+
var result = value === undefined || validator(value, opt, options);
|
1789 |
+
if (result !== true) {
|
1790 |
+
throw new TypeError('option ' + opt + ' must be ' + result);
|
1791 |
+
}
|
1792 |
+
continue;
|
1793 |
+
}
|
1794 |
+
if (allowUnknown !== true) {
|
1795 |
+
throw Error('Unknown option ' + opt);
|
1796 |
+
}
|
1797 |
+
}
|
1798 |
+
}
|
1799 |
+
|
1800 |
+
module.exports = {
|
1801 |
+
isOlderVersion: isOlderVersion,
|
1802 |
+
assertOptions: assertOptions,
|
1803 |
+
validators: validators
|
1804 |
+
};
|
1805 |
+
|
1806 |
+
|
1807 |
/***/ }),
|
1808 |
|
1809 |
/***/ "./node_modules/axios/lib/utils.js":
|
1818 |
|
1819 |
var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
|
1820 |
|
|
|
|
|
1821 |
// utils is a library of generic helper functions non-specific to axios
|
1822 |
|
1823 |
var toString = Object.prototype.toString;
|
2001 |
* @returns {String} The String freed of excess whitespace
|
2002 |
*/
|
2003 |
function trim(str) {
|
2004 |
+
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
2005 |
}
|
2006 |
|
2007 |
/**
|
2165 |
};
|
2166 |
|
2167 |
|
2168 |
+
/***/ }),
|
2169 |
+
|
2170 |
+
/***/ "./node_modules/axios/package.json":
|
2171 |
+
/*!*****************************************!*\
|
2172 |
+
!*** ./node_modules/axios/package.json ***!
|
2173 |
+
\*****************************************/
|
2174 |
+
/*! exports provided: _from, _id, _inBundle, _integrity, _location, _phantomChildren, _requested, _requiredBy, _resolved, _shasum, _spec, _where, author, browser, bugs, bundleDependencies, bundlesize, dependencies, deprecated, description, devDependencies, homepage, jsdelivr, keywords, license, main, name, repository, scripts, typings, unpkg, version, default */
|
2175 |
+
/***/ (function(module) {
|
2176 |
+
|
2177 |
+
module.exports = JSON.parse("{\"_from\":\"axios@^0.21.2\",\"_id\":\"axios@0.21.4\",\"_inBundle\":false,\"_integrity\":\"sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==\",\"_location\":\"/axios\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"axios@^0.21.2\",\"name\":\"axios\",\"escapedName\":\"axios\",\"rawSpec\":\"^0.21.2\",\"saveSpec\":null,\"fetchSpec\":\"^0.21.2\"},\"_requiredBy\":[\"/\"],\"_resolved\":\"https://registry.npmjs.org/axios/-/axios-0.21.4.tgz\",\"_shasum\":\"c67b90dc0568e5c1cf2b0b858c43ba28e2eda575\",\"_spec\":\"axios@^0.21.2\",\"_where\":\"/Users/darrencooney/Local Sites/instant-images/app/public/wp-content/plugins/instant-images\",\"author\":{\"name\":\"Matt Zabriskie\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"bundleDependencies\":false,\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}],\"dependencies\":{\"follow-redirects\":\"^1.14.0\"},\"deprecated\":false,\"description\":\"Promise based HTTP client for the browser and node.js\",\"devDependencies\":{\"coveralls\":\"^3.0.0\",\"es6-promise\":\"^4.2.4\",\"grunt\":\"^1.3.0\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.1.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^23.0.0\",\"grunt-karma\":\"^4.0.0\",\"grunt-mocha-test\":\"^0.13.3\",\"grunt-ts\":\"^6.0.0-beta.19\",\"grunt-webpack\":\"^4.0.2\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^6.3.2\",\"karma-chrome-launcher\":\"^3.1.0\",\"karma-firefox-launcher\":\"^2.1.0\",\"karma-jasmine\":\"^1.1.1\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^4.3.6\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.8\",\"karma-webpack\":\"^4.0.2\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"mocha\":\"^8.2.1\",\"sinon\":\"^4.5.0\",\"terser-webpack-plugin\":\"^4.2.3\",\"typescript\":\"^4.0.5\",\"url-search-params\":\"^0.10.0\",\"webpack\":\"^4.44.2\",\"webpack-dev-server\":\"^3.11.0\"},\"homepage\":\"https://axios-http.com\",\"jsdelivr\":\"dist/axios.min.js\",\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"license\":\"MIT\",\"main\":\"index.js\",\"name\":\"axios\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/axios/axios.git\"},\"scripts\":{\"build\":\"NODE_ENV=production grunt build\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\"examples\":\"node ./examples/server.js\",\"fix\":\"eslint --fix lib/**/*.js\",\"postversion\":\"git push && git push --tags\",\"preversion\":\"npm test\",\"start\":\"node ./sandbox/server.js\",\"test\":\"grunt test\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\"},\"typings\":\"./index.d.ts\",\"unpkg\":\"dist/axios.min.js\",\"version\":\"0.21.4\"}");
|
2178 |
+
|
2179 |
/***/ }),
|
2180 |
|
2181 |
/***/ "./node_modules/classnames/index.js":
|
2670 |
|
2671 |
/***/ }),
|
2672 |
|
2673 |
+
/***/ "./node_modules/focus-trap-react/dist/focus-trap-react.js":
|
2674 |
+
/*!****************************************************************!*\
|
2675 |
+
!*** ./node_modules/focus-trap-react/dist/focus-trap-react.js ***!
|
2676 |
+
\****************************************************************/
|
2677 |
/*! no static exports found */
|
2678 |
/***/ (function(module, exports, __webpack_require__) {
|
2679 |
|
2680 |
+
"use strict";
|
|
|
|
|
|
|
|
|
2681 |
|
|
|
|
|
2682 |
|
2683 |
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2684 |
|
2685 |
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
2686 |
|
2687 |
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
2688 |
|
2689 |
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
|
|
|
|
|
|
|
|
|
|
|
2690 |
|
2691 |
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
2692 |
|
2693 |
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
|
|
|
|
|
2694 |
|
2695 |
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
2696 |
|
2697 |
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2698 |
|
2699 |
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
2700 |
|
2701 |
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2702 |
|
2703 |
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
2704 |
|
2705 |
+
var React = __webpack_require__(/*! react */ "./node_modules/react/index.js");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2706 |
|
2707 |
+
var ReactDOM = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js");
|
2708 |
|
2709 |
+
var PropTypes = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js");
|
2710 |
|
2711 |
+
var _require = __webpack_require__(/*! focus-trap */ "./node_modules/focus-trap/dist/focus-trap.esm.js"),
|
2712 |
+
createFocusTrap = _require.createFocusTrap; // TODO: These issues are related to older React features which we'll likely need
|
2713 |
+
// to fix in order to move the code forward to the next major version of React.
|
2714 |
+
// @see https://github.com/davidtheclark/focus-trap-react/issues/77
|
2715 |
|
2716 |
+
/* eslint-disable react/no-find-dom-node */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2717 |
|
|
|
2718 |
|
2719 |
+
var FocusTrap = /*#__PURE__*/function (_React$Component) {
|
2720 |
+
_inherits(FocusTrap, _React$Component);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2721 |
|
2722 |
+
var _super = _createSuper(FocusTrap);
|
|
|
|
|
|
|
|
|
|
|
2723 |
|
2724 |
+
function FocusTrap(props) {
|
2725 |
+
var _this;
|
2726 |
|
2727 |
+
_classCallCheck(this, FocusTrap);
|
2728 |
|
2729 |
+
_this = _super.call(this, props); // We need to hijack the returnFocusOnDeactivate option,
|
2730 |
+
// because React can move focus into the element before we arrived at
|
2731 |
+
// this lifecycle hook (e.g. with autoFocus inputs). So the component
|
2732 |
+
// captures the previouslyFocusedElement in componentWillMount,
|
2733 |
+
// then (optionally) returns focus to it in componentWillUnmount.
|
2734 |
|
2735 |
+
_this.tailoredFocusTrapOptions = {
|
2736 |
+
returnFocusOnDeactivate: false
|
2737 |
+
}; // because of the above, we maintain our own flag for this option, and
|
2738 |
+
// default it to `true` because that's focus-trap's default
|
2739 |
|
2740 |
+
_this.returnFocusOnDeactivate = true;
|
2741 |
+
var focusTrapOptions = props.focusTrapOptions;
|
|
|
|
|
2742 |
|
2743 |
+
for (var optionName in focusTrapOptions) {
|
2744 |
+
if (!Object.prototype.hasOwnProperty.call(focusTrapOptions, optionName)) {
|
2745 |
+
continue;
|
2746 |
+
}
|
2747 |
|
2748 |
+
if (optionName === 'returnFocusOnDeactivate') {
|
2749 |
+
_this.returnFocusOnDeactivate = !!focusTrapOptions[optionName];
|
2750 |
+
continue;
|
2751 |
+
}
|
2752 |
|
2753 |
+
if (optionName === 'onPostDeactivate') {
|
2754 |
+
_this.onPostDeactivate = focusTrapOptions[optionName];
|
2755 |
+
continue;
|
2756 |
+
}
|
2757 |
|
2758 |
+
_this.tailoredFocusTrapOptions[optionName] = focusTrapOptions[optionName];
|
2759 |
+
} // elements from which to create the focus trap on mount; if a child is used
|
2760 |
+
// instead of the `containerElements` prop, we'll get the child's related
|
2761 |
+
// element when the trap renders and then is declared 'mounted'
|
2762 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2763 |
|
2764 |
+
_this.focusTrapElements = props.containerElements || []; // now we remember what the currently focused element is, not relying on focus-trap
|
|
|
|
|
|
|
|
|
|
|
2765 |
|
2766 |
+
_this.updatePreviousElement();
|
2767 |
|
2768 |
+
return _this;
|
2769 |
+
} // TODO: Need more test coverage for this function
|
|
|
|
|
|
|
|
|
|
|
2770 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2771 |
|
2772 |
+
_createClass(FocusTrap, [{
|
2773 |
+
key: "getNodeForOption",
|
2774 |
+
value: function getNodeForOption(optionName) {
|
2775 |
+
var optionValue = this.tailoredFocusTrapOptions[optionName];
|
2776 |
|
2777 |
+
if (!optionValue) {
|
2778 |
+
return null;
|
2779 |
+
}
|
2780 |
|
2781 |
+
var node = optionValue;
|
|
|
2782 |
|
2783 |
+
if (typeof optionValue === 'string') {
|
2784 |
+
node = document.querySelector(optionValue);
|
2785 |
|
2786 |
+
if (!node) {
|
2787 |
+
throw new Error("`".concat(optionName, "` refers to no known node"));
|
2788 |
+
}
|
2789 |
+
}
|
2790 |
|
2791 |
+
if (typeof optionValue === 'function') {
|
2792 |
+
node = optionValue();
|
2793 |
|
2794 |
+
if (!node) {
|
2795 |
+
throw new Error("`".concat(optionName, "` did not return a node"));
|
2796 |
+
}
|
2797 |
+
}
|
2798 |
|
2799 |
+
return node;
|
2800 |
+
}
|
2801 |
+
}, {
|
2802 |
+
key: "getReturnFocusNode",
|
2803 |
+
value: function getReturnFocusNode() {
|
2804 |
+
var node = this.getNodeForOption('setReturnFocus');
|
2805 |
+
return node ? node : this.previouslyFocusedElement;
|
2806 |
+
}
|
2807 |
+
/** Update the previously focused element with the currently focused element. */
|
2808 |
|
2809 |
+
}, {
|
2810 |
+
key: "updatePreviousElement",
|
2811 |
+
value: function updatePreviousElement() {
|
2812 |
+
// SSR: careful to check if `document` exists before accessing it as a variable
|
2813 |
+
var currentDocument = this.props.focusTrapOptions.document || (typeof document !== 'undefined' ? document : undefined);
|
2814 |
|
2815 |
+
if (currentDocument) {
|
2816 |
+
this.previouslyFocusedElement = currentDocument.activeElement;
|
2817 |
+
}
|
2818 |
+
}
|
2819 |
+
}, {
|
2820 |
+
key: "deactivateTrap",
|
2821 |
+
value: function deactivateTrap() {
|
2822 |
+
var _this2 = this;
|
2823 |
|
2824 |
+
var _this$tailoredFocusTr = this.tailoredFocusTrapOptions,
|
2825 |
+
checkCanReturnFocus = _this$tailoredFocusTr.checkCanReturnFocus,
|
2826 |
+
_this$tailoredFocusTr2 = _this$tailoredFocusTr.preventScroll,
|
2827 |
+
preventScroll = _this$tailoredFocusTr2 === void 0 ? false : _this$tailoredFocusTr2;
|
2828 |
|
2829 |
+
if (this.focusTrap) {
|
2830 |
+
// NOTE: we never let the trap return the focus since we do that ourselves
|
2831 |
+
this.focusTrap.deactivate({
|
2832 |
+
returnFocus: false
|
2833 |
+
});
|
2834 |
+
}
|
|
|
|
|
|
|
2835 |
|
2836 |
+
var finishDeactivation = function finishDeactivation() {
|
2837 |
+
var returnFocusNode = _this2.getReturnFocusNode();
|
2838 |
|
2839 |
+
var canReturnFocus = (returnFocusNode === null || returnFocusNode === void 0 ? void 0 : returnFocusNode.focus) && _this2.returnFocusOnDeactivate;
|
2840 |
|
2841 |
+
if (canReturnFocus) {
|
2842 |
+
/** Returns focus to the element that had focus when the trap was activated. */
|
2843 |
+
returnFocusNode.focus({
|
2844 |
+
preventScroll: preventScroll
|
2845 |
+
});
|
2846 |
+
}
|
2847 |
|
2848 |
+
if (_this2.onPostDeactivate) {
|
2849 |
+
_this2.onPostDeactivate.call(null); // don't call it in context of "this"
|
2850 |
|
2851 |
+
}
|
2852 |
+
};
|
2853 |
|
2854 |
+
if (checkCanReturnFocus) {
|
2855 |
+
checkCanReturnFocus(this.getReturnFocusNode()).then(finishDeactivation, finishDeactivation);
|
2856 |
+
} else {
|
2857 |
+
finishDeactivation();
|
2858 |
+
}
|
2859 |
+
}
|
2860 |
+
}, {
|
2861 |
+
key: "setupFocusTrap",
|
2862 |
+
value: function setupFocusTrap() {
|
2863 |
+
if (!this.focusTrap) {
|
2864 |
+
var focusTrapElementDOMNodes = this.focusTrapElements.map( // NOTE: `findDOMNode()` does not support CSS selectors; it'll just return
|
2865 |
+
// a new text node with the text wrapped in it instead of treating the
|
2866 |
+
// string as a selector and resolving it to a node in the DOM
|
2867 |
+
ReactDOM.findDOMNode);
|
2868 |
+
var nodesExist = focusTrapElementDOMNodes.some(Boolean);
|
2869 |
|
2870 |
+
if (nodesExist) {
|
2871 |
+
// eslint-disable-next-line react/prop-types -- _createFocusTrap is an internal prop
|
2872 |
+
this.focusTrap = this.props._createFocusTrap(focusTrapElementDOMNodes, this.tailoredFocusTrapOptions);
|
|
|
|
|
|
|
|
|
2873 |
|
2874 |
+
if (this.props.active) {
|
2875 |
+
this.focusTrap.activate();
|
2876 |
+
}
|
2877 |
|
2878 |
+
if (this.props.paused) {
|
2879 |
+
this.focusTrap.pause();
|
2880 |
+
}
|
2881 |
+
}
|
2882 |
+
}
|
2883 |
+
}
|
2884 |
+
}, {
|
2885 |
+
key: "componentDidMount",
|
2886 |
+
value: function componentDidMount() {
|
2887 |
+
this.setupFocusTrap();
|
2888 |
+
}
|
2889 |
+
}, {
|
2890 |
+
key: "componentDidUpdate",
|
2891 |
+
value: function componentDidUpdate(prevProps) {
|
2892 |
+
if (this.focusTrap) {
|
2893 |
+
if (prevProps.containerElements !== this.props.containerElements) {
|
2894 |
+
this.focusTrap.updateContainerElements(this.props.containerElements);
|
2895 |
+
}
|
2896 |
|
2897 |
+
var hasActivated = !prevProps.active && this.props.active;
|
2898 |
+
var hasDeactivated = prevProps.active && !this.props.active;
|
2899 |
+
var hasPaused = !prevProps.paused && this.props.paused;
|
2900 |
+
var hasUnpaused = prevProps.paused && !this.props.paused;
|
2901 |
+
|
2902 |
+
if (hasActivated) {
|
2903 |
+
this.updatePreviousElement();
|
2904 |
+
this.focusTrap.activate();
|
2905 |
+
}
|
2906 |
+
|
2907 |
+
if (hasDeactivated) {
|
2908 |
+
this.deactivateTrap();
|
2909 |
+
return; // un/pause does nothing on an inactive trap
|
2910 |
+
}
|
2911 |
+
|
2912 |
+
if (hasPaused) {
|
2913 |
+
this.focusTrap.pause();
|
2914 |
+
}
|
2915 |
+
|
2916 |
+
if (hasUnpaused) {
|
2917 |
+
this.focusTrap.unpause();
|
2918 |
+
}
|
2919 |
+
} else if (prevProps.containerElements !== this.props.containerElements) {
|
2920 |
+
this.focusTrapElements = this.props.containerElements;
|
2921 |
+
this.setupFocusTrap();
|
2922 |
+
}
|
2923 |
+
}
|
2924 |
+
}, {
|
2925 |
+
key: "componentWillUnmount",
|
2926 |
+
value: function componentWillUnmount() {
|
2927 |
+
this.deactivateTrap();
|
2928 |
+
}
|
2929 |
+
}, {
|
2930 |
+
key: "render",
|
2931 |
+
value: function render() {
|
2932 |
+
var _this3 = this;
|
2933 |
+
|
2934 |
+
var child = this.props.children ? React.Children.only(this.props.children) : undefined;
|
2935 |
+
|
2936 |
+
if (child) {
|
2937 |
+
if (child.type && child.type === React.Fragment) {
|
2938 |
+
throw new Error('A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.');
|
2939 |
+
}
|
2940 |
+
|
2941 |
+
var composedRefCallback = function composedRefCallback(element) {
|
2942 |
+
var containerElements = _this3.props.containerElements;
|
2943 |
+
|
2944 |
+
if (child) {
|
2945 |
+
if (typeof child.ref === 'function') {
|
2946 |
+
child.ref(element);
|
2947 |
+
} else if (child.ref) {
|
2948 |
+
child.ref.current = element;
|
2949 |
+
}
|
2950 |
+
}
|
2951 |
+
|
2952 |
+
_this3.focusTrapElements = containerElements ? containerElements : [element];
|
2953 |
+
};
|
2954 |
+
|
2955 |
+
var childWithRef = React.cloneElement(child, {
|
2956 |
+
ref: composedRefCallback
|
2957 |
+
});
|
2958 |
+
return childWithRef;
|
2959 |
+
}
|
2960 |
+
|
2961 |
+
return null;
|
2962 |
+
}
|
2963 |
+
}]);
|
2964 |
+
|
2965 |
+
return FocusTrap;
|
2966 |
+
}(React.Component); // support server-side rendering where `Element` will not be defined
|
2967 |
+
|
2968 |
+
|
2969 |
+
var ElementType = typeof Element === 'undefined' ? Function : Element;
|
2970 |
+
FocusTrap.propTypes = {
|
2971 |
+
active: PropTypes.bool,
|
2972 |
+
paused: PropTypes.bool,
|
2973 |
+
focusTrapOptions: PropTypes.shape({
|
2974 |
+
document: PropTypes.object,
|
2975 |
+
onActivate: PropTypes.func,
|
2976 |
+
onPostActivate: PropTypes.func,
|
2977 |
+
checkCanFocusTrap: PropTypes.func,
|
2978 |
+
onDeactivate: PropTypes.func,
|
2979 |
+
onPostDeactivate: PropTypes.func,
|
2980 |
+
checkCanReturnFocus: PropTypes.func,
|
2981 |
+
initialFocus: PropTypes.oneOfType([PropTypes.instanceOf(ElementType), PropTypes.string, PropTypes.func, PropTypes.bool]),
|
2982 |
+
fallbackFocus: PropTypes.oneOfType([PropTypes.instanceOf(ElementType), PropTypes.string, PropTypes.func]),
|
2983 |
+
escapeDeactivates: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
|
2984 |
+
clickOutsideDeactivates: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
|
2985 |
+
returnFocusOnDeactivate: PropTypes.bool,
|
2986 |
+
setReturnFocus: PropTypes.oneOfType([PropTypes.instanceOf(ElementType), PropTypes.string, PropTypes.func]),
|
2987 |
+
allowOutsideClick: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
|
2988 |
+
preventScroll: PropTypes.bool
|
2989 |
+
}),
|
2990 |
+
containerElements: PropTypes.arrayOf(PropTypes.instanceOf(ElementType)),
|
2991 |
+
children: PropTypes.oneOfType([PropTypes.element, // React element
|
2992 |
+
PropTypes.instanceOf(ElementType) // DOM element
|
2993 |
+
]) // NOTE: _createFocusTrap is internal, for testing purposes only, so we don't
|
2994 |
+
// specify it here. It's expected to be set to the function returned from
|
2995 |
+
// require('focus-trap'), or one with a compatible interface.
|
2996 |
+
|
2997 |
+
};
|
2998 |
+
FocusTrap.defaultProps = {
|
2999 |
+
active: true,
|
3000 |
+
paused: false,
|
3001 |
+
focusTrapOptions: {},
|
3002 |
+
_createFocusTrap: createFocusTrap
|
3003 |
+
};
|
3004 |
+
module.exports = FocusTrap;
|
3005 |
+
|
3006 |
+
/***/ }),
|
3007 |
+
|
3008 |
+
/***/ "./node_modules/focus-trap/dist/focus-trap.esm.js":
|
3009 |
+
/*!********************************************************!*\
|
3010 |
+
!*** ./node_modules/focus-trap/dist/focus-trap.esm.js ***!
|
3011 |
+
\********************************************************/
|
3012 |
+
/*! exports provided: createFocusTrap */
|
3013 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3014 |
+
|
3015 |
+
"use strict";
|
3016 |
+
__webpack_require__.r(__webpack_exports__);
|
3017 |
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFocusTrap", function() { return createFocusTrap; });
|
3018 |
+
/* harmony import */ var tabbable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tabbable */ "./node_modules/tabbable/dist/index.esm.js");
|
3019 |
+
/*!
|
3020 |
+
* focus-trap 6.7.1
|
3021 |
+
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
3022 |
+
*/
|
3023 |
+
|
3024 |
+
|
3025 |
+
function ownKeys(object, enumerableOnly) {
|
3026 |
+
var keys = Object.keys(object);
|
3027 |
+
|
3028 |
+
if (Object.getOwnPropertySymbols) {
|
3029 |
+
var symbols = Object.getOwnPropertySymbols(object);
|
3030 |
+
|
3031 |
+
if (enumerableOnly) {
|
3032 |
+
symbols = symbols.filter(function (sym) {
|
3033 |
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
3034 |
+
});
|
3035 |
+
}
|
3036 |
+
|
3037 |
+
keys.push.apply(keys, symbols);
|
3038 |
}
|
3039 |
|
3040 |
+
return keys;
|
|
|
3041 |
}
|
3042 |
|
3043 |
+
function _objectSpread2(target) {
|
3044 |
+
for (var i = 1; i < arguments.length; i++) {
|
3045 |
+
var source = arguments[i] != null ? arguments[i] : {};
|
3046 |
|
3047 |
+
if (i % 2) {
|
3048 |
+
ownKeys(Object(source), true).forEach(function (key) {
|
3049 |
+
_defineProperty(target, key, source[key]);
|
3050 |
+
});
|
3051 |
+
} else if (Object.getOwnPropertyDescriptors) {
|
3052 |
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
3053 |
+
} else {
|
3054 |
+
ownKeys(Object(source)).forEach(function (key) {
|
3055 |
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
3056 |
+
});
|
3057 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3058 |
}
|
3059 |
|
3060 |
+
return target;
|
3061 |
+
}
|
3062 |
+
|
3063 |
+
function _defineProperty(obj, key, value) {
|
3064 |
+
if (key in obj) {
|
3065 |
+
Object.defineProperty(obj, key, {
|
3066 |
+
value: value,
|
3067 |
+
enumerable: true,
|
3068 |
+
configurable: true,
|
3069 |
+
writable: true
|
3070 |
+
});
|
3071 |
} else {
|
3072 |
+
obj[key] = value;
|
3073 |
}
|
3074 |
|
3075 |
+
return obj;
|
3076 |
+
}
|
|
|
3077 |
|
3078 |
+
var activeFocusTraps = function () {
|
3079 |
+
var trapQueue = [];
|
3080 |
+
return {
|
3081 |
+
activateTrap: function activateTrap(trap) {
|
3082 |
+
if (trapQueue.length > 0) {
|
3083 |
+
var activeTrap = trapQueue[trapQueue.length - 1];
|
3084 |
|
3085 |
+
if (activeTrap !== trap) {
|
3086 |
+
activeTrap.pause();
|
3087 |
+
}
|
3088 |
+
}
|
3089 |
|
3090 |
+
var trapIndex = trapQueue.indexOf(trap);
|
|
|
|
|
3091 |
|
3092 |
+
if (trapIndex === -1) {
|
3093 |
+
trapQueue.push(trap);
|
3094 |
+
} else {
|
3095 |
+
// move this existing trap to the front of the queue
|
3096 |
+
trapQueue.splice(trapIndex, 1);
|
3097 |
+
trapQueue.push(trap);
|
3098 |
+
}
|
3099 |
+
},
|
3100 |
+
deactivateTrap: function deactivateTrap(trap) {
|
3101 |
+
var trapIndex = trapQueue.indexOf(trap);
|
3102 |
|
3103 |
+
if (trapIndex !== -1) {
|
3104 |
+
trapQueue.splice(trapIndex, 1);
|
3105 |
+
}
|
3106 |
|
3107 |
+
if (trapQueue.length > 0) {
|
3108 |
+
trapQueue[trapQueue.length - 1].unpause();
|
3109 |
+
}
|
3110 |
+
}
|
3111 |
+
};
|
3112 |
+
}();
|
3113 |
|
3114 |
+
var isSelectableInput = function isSelectableInput(node) {
|
3115 |
+
return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
|
3116 |
+
};
|
3117 |
+
|
3118 |
+
var isEscapeEvent = function isEscapeEvent(e) {
|
3119 |
+
return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
|
3120 |
+
};
|
3121 |
+
|
3122 |
+
var isTabEvent = function isTabEvent(e) {
|
3123 |
+
return e.key === 'Tab' || e.keyCode === 9;
|
3124 |
};
|
3125 |
|
3126 |
+
var delay = function delay(fn) {
|
3127 |
+
return setTimeout(fn, 0);
|
3128 |
+
}; // Array.find/findIndex() are not supported on IE; this replicates enough
|
3129 |
+
// of Array.findIndex() for our needs
|
3130 |
+
|
3131 |
+
|
3132 |
+
var findIndex = function findIndex(arr, fn) {
|
3133 |
+
var idx = -1;
|
3134 |
+
arr.every(function (value, i) {
|
3135 |
+
if (fn(value)) {
|
3136 |
+
idx = i;
|
3137 |
+
return false; // break
|
3138 |
+
}
|
3139 |
+
|
3140 |
+
return true; // next
|
3141 |
+
});
|
3142 |
+
return idx;
|
3143 |
+
};
|
3144 |
/**
|
3145 |
+
* Get an option's value when it could be a plain value, or a handler that provides
|
3146 |
+
* the value.
|
3147 |
+
* @param {*} value Option's value to check.
|
3148 |
+
* @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
|
3149 |
+
* @returns {*} The `value`, or the handler's returned value.
|
3150 |
*/
|
3151 |
+
|
3152 |
+
|
3153 |
+
var valueOrHandler = function valueOrHandler(value) {
|
3154 |
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
3155 |
+
params[_key - 1] = arguments[_key];
|
|
|
|
|
|
|
3156 |
}
|
3157 |
|
3158 |
+
return typeof value === 'function' ? value.apply(void 0, params) : value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3159 |
};
|
3160 |
|
3161 |
+
var getActualTarget = function getActualTarget(event) {
|
3162 |
+
// NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
|
3163 |
+
// shadow host. However, event.target.composedPath() will be an array of
|
3164 |
+
// nodes "clicked" from inner-most (the actual element inside the shadow) to
|
3165 |
+
// outer-most (the host HTML document). If we have access to composedPath(),
|
3166 |
+
// then use its first element; otherwise, fall back to event.target (and
|
3167 |
+
// this only works for an _open_ shadow DOM; otherwise,
|
3168 |
+
// composedPath()[0] === event.target always).
|
3169 |
+
return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
|
3170 |
};
|
3171 |
|
3172 |
+
var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
3173 |
+
var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
|
3174 |
+
|
3175 |
+
var config = _objectSpread2({
|
3176 |
+
returnFocusOnDeactivate: true,
|
3177 |
+
escapeDeactivates: true,
|
3178 |
+
delayInitialFocus: true
|
3179 |
+
}, userOptions);
|
3180 |
+
|
3181 |
+
var state = {
|
3182 |
+
// @type {Array<HTMLElement>}
|
3183 |
+
containers: [],
|
3184 |
+
// list of objects identifying the first and last tabbable nodes in all containers/groups in
|
3185 |
+
// the trap
|
3186 |
+
// NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
|
3187 |
+
// is active, but the trap should never get to a state where there isn't at least one group
|
3188 |
+
// with at least one tabbable node in it (that would lead to an error condition that would
|
3189 |
+
// result in an error being thrown)
|
3190 |
+
// @type {Array<{ container: HTMLElement, firstTabbableNode: HTMLElement|null, lastTabbableNode: HTMLElement|null }>}
|
3191 |
+
tabbableGroups: [],
|
3192 |
+
nodeFocusedBeforeActivation: null,
|
3193 |
+
mostRecentlyFocusedNode: null,
|
3194 |
+
active: false,
|
3195 |
+
paused: false,
|
3196 |
+
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
3197 |
+
// has been delayed during activation
|
3198 |
+
delayInitialFocusTimer: undefined
|
3199 |
+
};
|
3200 |
+
var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
|
3201 |
|
3202 |
+
var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
|
3203 |
+
return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
|
3204 |
+
};
|
|
|
|
|
|
|
|
|
3205 |
|
3206 |
+
var containersContain = function containersContain(element) {
|
3207 |
+
return !!(element && state.containers.some(function (container) {
|
3208 |
+
return container.contains(element);
|
3209 |
+
}));
|
3210 |
+
};
|
3211 |
+
/**
|
3212 |
+
* Gets the node for the given option, which is expected to be an option that
|
3213 |
+
* can be either a DOM node, a string that is a selector to get a node, `false`
|
3214 |
+
* (if a node is explicitly NOT given), or a function that returns any of these
|
3215 |
+
* values.
|
3216 |
+
* @param {string} optionName
|
3217 |
+
* @returns {undefined | false | HTMLElement | SVGElement} Returns
|
3218 |
+
* `undefined` if the option is not specified; `false` if the option
|
3219 |
+
* resolved to `false` (node explicitly not given); otherwise, the resolved
|
3220 |
+
* DOM node.
|
3221 |
+
* @throws {Error} If the option is set, not `false`, and is not, or does not
|
3222 |
+
* resolve to a node.
|
3223 |
+
*/
|
3224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3225 |
|
3226 |
+
var getNodeForOption = function getNodeForOption(optionName) {
|
3227 |
+
var optionValue = config[optionName];
|
|
|
|
|
|
|
|
|
3228 |
|
3229 |
+
if (typeof optionValue === 'function') {
|
3230 |
+
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
3231 |
+
params[_key2 - 1] = arguments[_key2];
|
3232 |
+
}
|
|
|
3233 |
|
3234 |
+
optionValue = optionValue.apply(void 0, params);
|
3235 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3236 |
|
3237 |
+
if (!optionValue) {
|
3238 |
+
if (optionValue === undefined || optionValue === false) {
|
3239 |
+
return optionValue;
|
3240 |
+
} // else, empty string (invalid), null (invalid), 0 (invalid)
|
3241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3242 |
|
3243 |
+
throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
|
3244 |
+
}
|
3245 |
|
3246 |
+
var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
|
|
|
|
|
3247 |
|
3248 |
+
if (typeof optionValue === 'string') {
|
3249 |
+
node = doc.querySelector(optionValue); // resolve to node, or null if fails
|
3250 |
|
3251 |
+
if (!node) {
|
3252 |
+
throw new Error("`".concat(optionName, "` as selector refers to no known node"));
|
3253 |
+
}
|
3254 |
+
}
|
|
|
|
|
|
|
|
|
|
|
3255 |
|
3256 |
+
return node;
|
3257 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3258 |
|
3259 |
+
var getInitialFocusNode = function getInitialFocusNode() {
|
3260 |
+
var node = getNodeForOption('initialFocus'); // false explicitly indicates we want no initialFocus at all
|
|
|
|
|
|
|
3261 |
|
3262 |
+
if (node === false) {
|
3263 |
+
return false;
|
3264 |
+
}
|
|
|
3265 |
|
3266 |
+
if (node === undefined) {
|
3267 |
+
// option not specified: use fallback options
|
3268 |
+
if (containersContain(doc.activeElement)) {
|
3269 |
+
node = doc.activeElement;
|
3270 |
+
} else {
|
3271 |
+
var firstTabbableGroup = state.tabbableGroups[0];
|
3272 |
+
var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
|
3273 |
|
3274 |
+
node = firstTabbableNode || getNodeForOption('fallbackFocus');
|
3275 |
+
}
|
3276 |
+
}
|
|
|
|
|
|
|
|
|
3277 |
|
3278 |
+
if (!node) {
|
3279 |
+
throw new Error('Your focus-trap needs to have at least one focusable element');
|
3280 |
+
}
|
|
|
3281 |
|
3282 |
+
return node;
|
3283 |
+
};
|
|
|
|
|
3284 |
|
3285 |
+
var updateTabbableNodes = function updateTabbableNodes() {
|
3286 |
+
state.tabbableGroups = state.containers.map(function (container) {
|
3287 |
+
var tabbableNodes = Object(tabbable__WEBPACK_IMPORTED_MODULE_0__["tabbable"])(container);
|
|
|
|
|
|
|
3288 |
|
3289 |
+
if (tabbableNodes.length > 0) {
|
3290 |
+
return {
|
3291 |
+
container: container,
|
3292 |
+
firstTabbableNode: tabbableNodes[0],
|
3293 |
+
lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
|
3294 |
+
};
|
3295 |
+
}
|
3296 |
|
3297 |
+
return undefined;
|
3298 |
+
}).filter(function (group) {
|
3299 |
+
return !!group;
|
3300 |
+
}); // remove groups with no tabbable nodes
|
3301 |
+
// throw if no groups have tabbable nodes and we don't have a fallback focus node either
|
3302 |
|
3303 |
+
if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
|
3304 |
+
) {
|
3305 |
+
throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
|
3306 |
+
}
|
3307 |
+
};
|
3308 |
|
3309 |
+
var tryFocus = function tryFocus(node) {
|
3310 |
+
if (node === false) {
|
3311 |
+
return;
|
3312 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3313 |
|
3314 |
+
if (node === doc.activeElement) {
|
3315 |
+
return;
|
3316 |
+
}
|
|
|
3317 |
|
3318 |
+
if (!node || !node.focus) {
|
3319 |
+
tryFocus(getInitialFocusNode());
|
3320 |
+
return;
|
3321 |
+
}
|
3322 |
|
3323 |
+
node.focus({
|
3324 |
+
preventScroll: !!config.preventScroll
|
3325 |
+
});
|
3326 |
+
state.mostRecentlyFocusedNode = node;
|
3327 |
|
3328 |
+
if (isSelectableInput(node)) {
|
3329 |
+
node.select();
|
3330 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3331 |
};
|
|
|
|
|
|
|
3332 |
|
3333 |
+
var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
|
3334 |
+
var node = getNodeForOption('setReturnFocus', previousActiveElement);
|
3335 |
+
return node ? node : node === false ? false : previousActiveElement;
|
3336 |
+
}; // This needs to be done on mousedown and touchstart instead of click
|
3337 |
+
// so that it precedes the focus event.
|
3338 |
|
|
|
3339 |
|
3340 |
+
var checkPointerDown = function checkPointerDown(e) {
|
3341 |
+
var target = getActualTarget(e);
|
3342 |
|
3343 |
+
if (containersContain(target)) {
|
3344 |
+
// allow the click since it ocurred inside the trap
|
3345 |
+
return;
|
3346 |
+
}
|
3347 |
|
3348 |
+
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
3349 |
+
// immediately deactivate the trap
|
3350 |
+
trap.deactivate({
|
3351 |
+
// if, on deactivation, we should return focus to the node originally-focused
|
3352 |
+
// when the trap was activated (or the configured `setReturnFocus` node),
|
3353 |
+
// then assume it's also OK to return focus to the outside node that was
|
3354 |
+
// just clicked, causing deactivation, as long as that node is focusable;
|
3355 |
+
// if it isn't focusable, then return focus to the original node focused
|
3356 |
+
// on activation (or the configured `setReturnFocus` node)
|
3357 |
+
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
3358 |
+
// which will result in the outside click setting focus to the node
|
3359 |
+
// that was clicked, whether it's focusable or not; by setting
|
3360 |
+
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
3361 |
+
// on activation (or the configured `setReturnFocus` node)
|
3362 |
+
returnFocus: config.returnFocusOnDeactivate && !Object(tabbable__WEBPACK_IMPORTED_MODULE_0__["isFocusable"])(target)
|
3363 |
+
});
|
3364 |
+
return;
|
3365 |
+
} // This is needed for mobile devices.
|
3366 |
+
// (If we'll only let `click` events through,
|
3367 |
+
// then on mobile they will be blocked anyways if `touchstart` is blocked.)
|
3368 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3369 |
|
3370 |
+
if (valueOrHandler(config.allowOutsideClick, e)) {
|
3371 |
+
// allow the click outside the trap to take place
|
3372 |
+
return;
|
3373 |
+
} // otherwise, prevent the click
|
|
|
|
|
|
|
3374 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3375 |
|
3376 |
+
e.preventDefault();
|
3377 |
+
}; // In case focus escapes the trap for some strange reason, pull it back in.
|
3378 |
|
|
|
3379 |
|
3380 |
+
var checkFocusIn = function checkFocusIn(e) {
|
3381 |
+
var target = getActualTarget(e);
|
3382 |
+
var targetContained = containersContain(target); // In Firefox when you Tab out of an iframe the Document is briefly focused.
|
3383 |
|
3384 |
+
if (targetContained || target instanceof Document) {
|
3385 |
+
if (targetContained) {
|
3386 |
+
state.mostRecentlyFocusedNode = target;
|
3387 |
+
}
|
3388 |
+
} else {
|
3389 |
+
// escaped! pull it back in to where it just left
|
3390 |
+
e.stopImmediatePropagation();
|
3391 |
+
tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
|
3392 |
+
}
|
3393 |
+
}; // Hijack Tab events on the first and last focusable nodes of the trap,
|
3394 |
+
// in order to prevent focus from escaping. If it escapes for even a
|
3395 |
+
// moment it can end up scrolling the page and causing confusion so we
|
3396 |
+
// kind of need to capture the action at the keydown phase.
|
3397 |
+
|
3398 |
+
|
3399 |
+
var checkTab = function checkTab(e) {
|
3400 |
+
var target = getActualTarget(e);
|
3401 |
+
updateTabbableNodes();
|
3402 |
+
var destinationNode = null;
|
3403 |
+
|
3404 |
+
if (state.tabbableGroups.length > 0) {
|
3405 |
+
// make sure the target is actually contained in a group
|
3406 |
+
// NOTE: the target may also be the container itself if it's tabbable
|
3407 |
+
// with tabIndex='-1' and was given initial focus
|
3408 |
+
var containerIndex = findIndex(state.tabbableGroups, function (_ref) {
|
3409 |
+
var container = _ref.container;
|
3410 |
+
return container.contains(target);
|
3411 |
+
});
|
3412 |
|
3413 |
+
if (containerIndex < 0) {
|
3414 |
+
// target not found in any group: quite possible focus has escaped the trap,
|
3415 |
+
// so bring it back in to...
|
3416 |
+
if (e.shiftKey) {
|
3417 |
+
// ...the last node in the last group
|
3418 |
+
destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
|
3419 |
+
} else {
|
3420 |
+
// ...the first node in the first group
|
3421 |
+
destinationNode = state.tabbableGroups[0].firstTabbableNode;
|
3422 |
+
}
|
3423 |
+
} else if (e.shiftKey) {
|
3424 |
+
// REVERSE
|
3425 |
+
// is the target the first tabbable node in a group?
|
3426 |
+
var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
|
3427 |
+
var firstTabbableNode = _ref2.firstTabbableNode;
|
3428 |
+
return target === firstTabbableNode;
|
3429 |
+
});
|
3430 |
|
3431 |
+
if (startOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === target) {
|
3432 |
+
// an exception case where the target is the container itself, in which
|
3433 |
+
// case, we should handle shift+tab as if focus were on the container's
|
3434 |
+
// first tabbable node, and go to the last tabbable node of the LAST group
|
3435 |
+
startOfGroupIndex = containerIndex;
|
3436 |
+
}
|
3437 |
|
3438 |
+
if (startOfGroupIndex >= 0) {
|
3439 |
+
// YES: then shift+tab should go to the last tabbable node in the
|
3440 |
+
// previous group (and wrap around to the last tabbable node of
|
3441 |
+
// the LAST group if it's the first tabbable node of the FIRST group)
|
3442 |
+
var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
|
3443 |
+
var destinationGroup = state.tabbableGroups[destinationGroupIndex];
|
3444 |
+
destinationNode = destinationGroup.lastTabbableNode;
|
3445 |
+
}
|
3446 |
+
} else {
|
3447 |
+
// FORWARD
|
3448 |
+
// is the target the last tabbable node in a group?
|
3449 |
+
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
|
3450 |
+
var lastTabbableNode = _ref3.lastTabbableNode;
|
3451 |
+
return target === lastTabbableNode;
|
3452 |
+
});
|
3453 |
|
3454 |
+
if (lastOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === target) {
|
3455 |
+
// an exception case where the target is the container itself, in which
|
3456 |
+
// case, we should handle tab as if focus were on the container's
|
3457 |
+
// last tabbable node, and go to the first tabbable node of the FIRST group
|
3458 |
+
lastOfGroupIndex = containerIndex;
|
3459 |
+
}
|
3460 |
|
3461 |
+
if (lastOfGroupIndex >= 0) {
|
3462 |
+
// YES: then tab should go to the first tabbable node in the next
|
3463 |
+
// group (and wrap around to the first tabbable node of the FIRST
|
3464 |
+
// group if it's the last tabbable node of the LAST group)
|
3465 |
+
var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
3466 |
|
3467 |
+
var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
|
3468 |
+
destinationNode = _destinationGroup.firstTabbableNode;
|
3469 |
+
}
|
3470 |
+
}
|
3471 |
+
} else {
|
3472 |
+
// NOTE: the fallbackFocus option does not support returning false to opt-out
|
3473 |
+
destinationNode = getNodeForOption('fallbackFocus');
|
3474 |
+
}
|
3475 |
|
3476 |
+
if (destinationNode) {
|
3477 |
+
e.preventDefault();
|
3478 |
+
tryFocus(destinationNode);
|
3479 |
+
} // else, let the browser take care of [shift+]tab and move the focus
|
|
|
|
|
|
|
|
|
|
|
|
|
3480 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3481 |
};
|
3482 |
|
3483 |
+
var checkKey = function checkKey(e) {
|
3484 |
+
if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates, e) !== false) {
|
3485 |
+
e.preventDefault();
|
3486 |
+
trap.deactivate();
|
3487 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3488 |
}
|
3489 |
|
3490 |
+
if (isTabEvent(e)) {
|
3491 |
+
checkTab(e);
|
3492 |
+
return;
|
3493 |
+
}
|
3494 |
};
|
3495 |
|
3496 |
+
var checkClick = function checkClick(e) {
|
3497 |
+
if (valueOrHandler(config.clickOutsideDeactivates, e)) {
|
3498 |
+
return;
|
3499 |
+
}
|
3500 |
|
3501 |
+
var target = getActualTarget(e);
|
|
|
|
|
|
|
|
|
3502 |
|
3503 |
+
if (containersContain(target)) {
|
3504 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
3505 |
}
|
3506 |
|
3507 |
+
if (valueOrHandler(config.allowOutsideClick, e)) {
|
3508 |
+
return;
|
|
|
|
|
|
|
|
|
3509 |
}
|
|
|
|
|
3510 |
|
3511 |
+
e.preventDefault();
|
3512 |
+
e.stopImmediatePropagation();
|
3513 |
+
}; //
|
3514 |
+
// EVENT LISTENERS
|
3515 |
+
//
|
|
|
|
|
|
|
|
|
3516 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3517 |
|
3518 |
+
var addListeners = function addListeners() {
|
3519 |
+
if (!state.active) {
|
3520 |
+
return;
|
3521 |
+
} // There can be only one listening focus trap at a time
|
|
|
3522 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3523 |
|
3524 |
+
activeFocusTraps.activateTrap(trap); // Delay ensures that the focused element doesn't capture the event
|
3525 |
+
// that caused the focus trap activation.
|
|
|
|
|
|
|
|
|
|
|
3526 |
|
3527 |
+
state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
|
3528 |
+
tryFocus(getInitialFocusNode());
|
3529 |
+
}) : tryFocus(getInitialFocusNode());
|
3530 |
+
doc.addEventListener('focusin', checkFocusIn, true);
|
3531 |
+
doc.addEventListener('mousedown', checkPointerDown, {
|
3532 |
+
capture: true,
|
3533 |
+
passive: false
|
3534 |
+
});
|
3535 |
+
doc.addEventListener('touchstart', checkPointerDown, {
|
3536 |
+
capture: true,
|
3537 |
+
passive: false
|
3538 |
+
});
|
3539 |
+
doc.addEventListener('click', checkClick, {
|
3540 |
+
capture: true,
|
3541 |
+
passive: false
|
3542 |
+
});
|
3543 |
+
doc.addEventListener('keydown', checkKey, {
|
3544 |
+
capture: true,
|
3545 |
+
passive: false
|
3546 |
+
});
|
3547 |
+
return trap;
|
3548 |
+
};
|
3549 |
|
3550 |
+
var removeListeners = function removeListeners() {
|
3551 |
+
if (!state.active) {
|
3552 |
+
return;
|
3553 |
}
|
3554 |
|
3555 |
+
doc.removeEventListener('focusin', checkFocusIn, true);
|
3556 |
+
doc.removeEventListener('mousedown', checkPointerDown, true);
|
3557 |
+
doc.removeEventListener('touchstart', checkPointerDown, true);
|
3558 |
+
doc.removeEventListener('click', checkClick, true);
|
3559 |
+
doc.removeEventListener('keydown', checkKey, true);
|
3560 |
+
return trap;
|
3561 |
+
}; //
|
3562 |
+
// TRAP DEFINITION
|
3563 |
+
//
|
3564 |
|
3565 |
+
|
3566 |
+
trap = {
|
3567 |
+
activate: function activate(activateOptions) {
|
3568 |
+
if (state.active) {
|
3569 |
+
return this;
|
|
|
|
|
3570 |
}
|
|
|
|
|
|
|
|
|
|
|
3571 |
|
3572 |
+
var onActivate = getOption(activateOptions, 'onActivate');
|
3573 |
+
var onPostActivate = getOption(activateOptions, 'onPostActivate');
|
3574 |
+
var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
|
|
|
|
|
3575 |
|
3576 |
+
if (!checkCanFocusTrap) {
|
3577 |
+
updateTabbableNodes();
|
3578 |
+
}
|
3579 |
|
3580 |
+
state.active = true;
|
3581 |
+
state.paused = false;
|
3582 |
+
state.nodeFocusedBeforeActivation = doc.activeElement;
|
3583 |
|
3584 |
+
if (onActivate) {
|
3585 |
+
onActivate();
|
3586 |
+
}
|
3587 |
|
3588 |
+
var finishActivation = function finishActivation() {
|
3589 |
+
if (checkCanFocusTrap) {
|
3590 |
+
updateTabbableNodes();
|
3591 |
+
}
|
3592 |
|
3593 |
+
addListeners();
|
|
|
|
|
|
|
|
|
|
|
3594 |
|
3595 |
+
if (onPostActivate) {
|
3596 |
+
onPostActivate();
|
3597 |
+
}
|
3598 |
+
};
|
|
|
|
|
3599 |
|
3600 |
+
if (checkCanFocusTrap) {
|
3601 |
+
checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
|
3602 |
+
return this;
|
3603 |
+
}
|
3604 |
|
3605 |
+
finishActivation();
|
3606 |
+
return this;
|
3607 |
+
},
|
3608 |
+
deactivate: function deactivate(deactivateOptions) {
|
3609 |
+
if (!state.active) {
|
3610 |
+
return this;
|
3611 |
+
}
|
3612 |
|
3613 |
+
clearTimeout(state.delayInitialFocusTimer); // noop if undefined
|
|
|
|
|
|
|
3614 |
|
3615 |
+
state.delayInitialFocusTimer = undefined;
|
3616 |
+
removeListeners();
|
3617 |
+
state.active = false;
|
3618 |
+
state.paused = false;
|
3619 |
+
activeFocusTraps.deactivateTrap(trap);
|
3620 |
+
var onDeactivate = getOption(deactivateOptions, 'onDeactivate');
|
3621 |
+
var onPostDeactivate = getOption(deactivateOptions, 'onPostDeactivate');
|
3622 |
+
var checkCanReturnFocus = getOption(deactivateOptions, 'checkCanReturnFocus');
|
3623 |
|
3624 |
+
if (onDeactivate) {
|
3625 |
+
onDeactivate();
|
3626 |
+
}
|
|
|
|
|
3627 |
|
3628 |
+
var returnFocus = getOption(deactivateOptions, 'returnFocus', 'returnFocusOnDeactivate');
|
3629 |
|
3630 |
+
var finishDeactivation = function finishDeactivation() {
|
3631 |
+
delay(function () {
|
3632 |
+
if (returnFocus) {
|
3633 |
+
tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
3634 |
+
}
|
|
|
3635 |
|
3636 |
+
if (onPostDeactivate) {
|
3637 |
+
onPostDeactivate();
|
3638 |
+
}
|
3639 |
+
});
|
3640 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
3641 |
|
3642 |
+
if (returnFocus && checkCanReturnFocus) {
|
3643 |
+
checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
|
3644 |
+
return this;
|
3645 |
+
}
|
|
|
|
|
|
|
|
|
|
|
3646 |
|
3647 |
+
finishDeactivation();
|
3648 |
+
return this;
|
3649 |
+
},
|
3650 |
+
pause: function pause() {
|
3651 |
+
if (state.paused || !state.active) {
|
3652 |
+
return this;
|
3653 |
+
}
|
3654 |
|
3655 |
+
state.paused = true;
|
3656 |
+
removeListeners();
|
3657 |
+
return this;
|
3658 |
+
},
|
3659 |
+
unpause: function unpause() {
|
3660 |
+
if (!state.paused || !state.active) {
|
3661 |
+
return this;
|
3662 |
+
}
|
3663 |
|
3664 |
+
state.paused = false;
|
3665 |
+
updateTabbableNodes();
|
3666 |
+
addListeners();
|
3667 |
+
return this;
|
3668 |
+
},
|
3669 |
+
updateContainerElements: function updateContainerElements(containerElements) {
|
3670 |
+
var elementsAsArray = [].concat(containerElements).filter(Boolean);
|
3671 |
+
state.containers = elementsAsArray.map(function (element) {
|
3672 |
+
return typeof element === 'string' ? doc.querySelector(element) : element;
|
3673 |
+
});
|
3674 |
|
3675 |
+
if (state.active) {
|
3676 |
+
updateTabbableNodes();
|
3677 |
+
}
|
|
|
|
|
3678 |
|
3679 |
+
return this;
|
3680 |
+
}
|
3681 |
+
}; // initialize container elements
|
|
|
|
|
|
|
|
|
|
|
|
|
3682 |
|
3683 |
+
trap.updateContainerElements(elements);
|
3684 |
+
return trap;
|
3685 |
};
|
3686 |
|
3687 |
|
3688 |
+
//# sourceMappingURL=focus-trap.esm.js.map
|
3689 |
+
|
3690 |
+
|
3691 |
/***/ }),
|
3692 |
|
3693 |
+
/***/ "./node_modules/get-size/get-size.js":
|
3694 |
+
/*!*******************************************!*\
|
3695 |
+
!*** ./node_modules/get-size/get-size.js ***!
|
3696 |
+
\*******************************************/
|
3697 |
/*! no static exports found */
|
3698 |
/***/ (function(module, exports, __webpack_require__) {
|
3699 |
|
3700 |
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
3701 |
+
* getSize v2.0.3
|
3702 |
+
* measure size of elements
|
3703 |
+
* MIT license
|
3704 |
*/
|
3705 |
|
3706 |
+
/* jshint browser: true, strict: true, undef: true, unused: true */
|
3707 |
+
/* globals console: false */
|
3708 |
+
|
3709 |
( function( window, factory ) {
|
3710 |
+
/* jshint strict: false */ /* globals define, module */
|
|
|
3711 |
if ( true ) {
|
3712 |
+
// AMD
|
3713 |
+
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
|
|
|
|
|
3714 |
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
3715 |
+
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
3716 |
+
__WEBPACK_AMD_DEFINE_FACTORY__),
|
3717 |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
3718 |
} else {}
|
3719 |
|
3720 |
+
})( window, function factory() {
|
3721 |
'use strict';
|
3722 |
|
3723 |
+
// -------------------------- helpers -------------------------- //
|
3724 |
|
3725 |
+
// get a number from a string, not a percentage
|
3726 |
+
function getStyleSize( value ) {
|
3727 |
+
var num = parseFloat( value );
|
3728 |
+
// not a percent like '100%', and a number
|
3729 |
+
var isValid = value.indexOf('%') == -1 && !isNaN( num );
|
3730 |
+
return isValid && num;
|
3731 |
}
|
3732 |
|
3733 |
+
function noop() {}
|
3734 |
|
3735 |
+
var logError = typeof console == 'undefined' ? noop :
|
3736 |
+
function( message ) {
|
3737 |
+
console.error( message );
|
3738 |
+
};
|
3739 |
|
3740 |
+
// -------------------------- measurements -------------------------- //
|
3741 |
|
3742 |
+
var measurements = [
|
3743 |
+
'paddingLeft',
|
3744 |
+
'paddingRight',
|
3745 |
+
'paddingTop',
|
3746 |
+
'paddingBottom',
|
3747 |
+
'marginLeft',
|
3748 |
+
'marginRight',
|
3749 |
+
'marginTop',
|
3750 |
+
'marginBottom',
|
3751 |
+
'borderLeftWidth',
|
3752 |
+
'borderRightWidth',
|
3753 |
+
'borderTopWidth',
|
3754 |
+
'borderBottomWidth'
|
3755 |
+
];
|
3756 |
|
3757 |
+
var measurementsLength = measurements.length;
|
|
|
|
|
|
|
3758 |
|
3759 |
+
function getZeroSize() {
|
3760 |
+
var size = {
|
3761 |
+
width: 0,
|
3762 |
+
height: 0,
|
3763 |
+
innerWidth: 0,
|
3764 |
+
innerHeight: 0,
|
3765 |
+
outerWidth: 0,
|
3766 |
+
outerHeight: 0
|
3767 |
+
};
|
3768 |
+
for ( var i=0; i < measurementsLength; i++ ) {
|
3769 |
+
var measurement = measurements[i];
|
3770 |
+
size[ measurement ] = 0;
|
3771 |
+
}
|
3772 |
+
return size;
|
3773 |
+
}
|
3774 |
|
3775 |
+
// -------------------------- getStyle -------------------------- //
|
3776 |
|
3777 |
+
/**
|
3778 |
+
* getStyle, get style of element, check for Firefox bug
|
3779 |
+
* https://bugzilla.mozilla.org/show_bug.cgi?id=548397
|
3780 |
+
*/
|
3781 |
+
function getStyle( elem ) {
|
3782 |
+
var style = getComputedStyle( elem );
|
3783 |
+
if ( !style ) {
|
3784 |
+
logError( 'Style returned ' + style +
|
3785 |
+
'. Are you running this code in a hidden iframe on Firefox? ' +
|
3786 |
+
'See https://bit.ly/getsizebug1' );
|
3787 |
+
}
|
3788 |
+
return style;
|
3789 |
+
}
|
3790 |
+
|
3791 |
+
// -------------------------- setup -------------------------- //
|
3792 |
+
|
3793 |
+
var isSetup = false;
|
3794 |
+
|
3795 |
+
var isBoxSizeOuter;
|
3796 |
+
|
3797 |
+
/**
|
3798 |
+
* setup
|
3799 |
+
* check isBoxSizerOuter
|
3800 |
+
* do on first getSize() rather than on page load for Firefox bug
|
3801 |
+
*/
|
3802 |
+
function setup() {
|
3803 |
+
// setup once
|
3804 |
+
if ( isSetup ) {
|
3805 |
return;
|
3806 |
}
|
3807 |
+
isSetup = true;
|
3808 |
|
3809 |
+
// -------------------------- box sizing -------------------------- //
|
|
|
|
|
|
|
|
|
|
|
|
|
3810 |
|
3811 |
+
/**
|
3812 |
+
* Chrome & Safari measure the outer-width on style.width on border-box elems
|
3813 |
+
* IE11 & Firefox<29 measures the inner-width
|
3814 |
+
*/
|
3815 |
+
var div = document.createElement('div');
|
3816 |
+
div.style.width = '200px';
|
3817 |
+
div.style.padding = '1px 2px 3px 4px';
|
3818 |
+
div.style.borderStyle = 'solid';
|
3819 |
+
div.style.borderWidth = '1px 2px 3px 4px';
|
3820 |
+
div.style.boxSizing = 'border-box';
|
3821 |
|
3822 |
+
var body = document.body || document.documentElement;
|
3823 |
+
body.appendChild( div );
|
3824 |
+
var style = getStyle( div );
|
3825 |
+
// round value for browser zoom. desandro/masonry#928
|
3826 |
+
isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;
|
3827 |
+
getSize.isBoxSizeOuter = isBoxSizeOuter;
|
3828 |
|
3829 |
+
body.removeChild( div );
|
3830 |
+
}
|
|
|
|
|
|
|
|
|
|
|
3831 |
|
3832 |
+
// -------------------------- getSize -------------------------- //
|
|
|
|
|
|
|
3833 |
|
3834 |
+
function getSize( elem ) {
|
3835 |
+
setup();
|
3836 |
+
|
3837 |
+
// use querySeletor if elem is string
|
3838 |
+
if ( typeof elem == 'string' ) {
|
3839 |
+
elem = document.querySelector( elem );
|
3840 |
}
|
|
|
3841 |
|
3842 |
+
// do not proceed on non-objects
|
3843 |
+
if ( !elem || typeof elem != 'object' || !elem.nodeType ) {
|
3844 |
+
return;
|
3845 |
+
}
|
3846 |
|
3847 |
+
var style = getStyle( elem );
|
|
|
|
|
|
|
|
|
|
|
3848 |
|
3849 |
+
// if hidden, everything is 0
|
3850 |
+
if ( style.display == 'none' ) {
|
3851 |
+
return getZeroSize();
|
|
|
3852 |
}
|
|
|
3853 |
|
3854 |
+
var size = {};
|
3855 |
+
size.width = elem.offsetWidth;
|
3856 |
+
size.height = elem.offsetHeight;
|
3857 |
+
|
3858 |
+
var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';
|
3859 |
+
|
3860 |
+
// get all measurements
|
3861 |
+
for ( var i=0; i < measurementsLength; i++ ) {
|
3862 |
+
var measurement = measurements[i];
|
3863 |
+
var value = style[ measurement ];
|
3864 |
+
var num = parseFloat( value );
|
3865 |
+
// any 'auto', 'medium' value will be 0
|
3866 |
+
size[ measurement ] = !isNaN( num ) ? num : 0;
|
3867 |
}
|
3868 |
+
|
3869 |
+
var paddingWidth = size.paddingLeft + size.paddingRight;
|
3870 |
+
var paddingHeight = size.paddingTop + size.paddingBottom;
|
3871 |
+
var marginWidth = size.marginLeft + size.marginRight;
|
3872 |
+
var marginHeight = size.marginTop + size.marginBottom;
|
3873 |
+
var borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
3874 |
+
var borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
3875 |
+
|
3876 |
+
var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
|
3877 |
+
|
3878 |
+
// overwrite width and height if we can get it from style
|
3879 |
+
var styleWidth = getStyleSize( style.width );
|
3880 |
+
if ( styleWidth !== false ) {
|
3881 |
+
size.width = styleWidth +
|
3882 |
+
// add padding and border unless it's already including it
|
3883 |
+
( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
|
3884 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3885 |
|
3886 |
+
var styleHeight = getStyleSize( style.height );
|
3887 |
+
if ( styleHeight !== false ) {
|
3888 |
+
size.height = styleHeight +
|
3889 |
+
// add padding and border unless it's already including it
|
3890 |
+
( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
|
3891 |
+
}
|
3892 |
|
3893 |
+
size.innerWidth = size.width - ( paddingWidth + borderWidth );
|
3894 |
+
size.innerHeight = size.height - ( paddingHeight + borderHeight );
|
|
|
|
|
|
|
|
|
3895 |
|
3896 |
+
size.outerWidth = size.width + marginWidth;
|
3897 |
+
size.outerHeight = size.height + marginHeight;
|
|
|
|
|
3898 |
|
3899 |
+
return size;
|
3900 |
+
}
|
|
|
|
|
|
|
3901 |
|
3902 |
+
return getSize;
|
|
|
|
|
|
|
3903 |
|
3904 |
+
});
|
|
|
|
|
|
|
|
|
3905 |
|
|
|
|
|
|
|
3906 |
|
3907 |
+
/***/ }),
|
|
|
|
|
|
|
|
|
3908 |
|
3909 |
+
/***/ "./node_modules/imagesloaded/imagesloaded.js":
|
3910 |
+
/*!***************************************************!*\
|
3911 |
+
!*** ./node_modules/imagesloaded/imagesloaded.js ***!
|
3912 |
+
\***************************************************/
|
3913 |
+
/*! no static exports found */
|
3914 |
+
/***/ (function(module, exports, __webpack_require__) {
|
3915 |
|
3916 |
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
3917 |
+
* imagesLoaded v4.1.4
|
3918 |
+
* JavaScript is all like "You images are done yet or what?"
|
3919 |
+
* MIT License
|
3920 |
+
*/
|
3921 |
|
3922 |
+
( function( window, factory ) { 'use strict';
|
3923 |
+
// universal module definition
|
3924 |
|
3925 |
+
/*global define: false, module: false, require: false */
|
|
|
3926 |
|
3927 |
+
if ( true ) {
|
3928 |
+
// AMD
|
3929 |
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
3930 |
+
__webpack_require__(/*! ev-emitter/ev-emitter */ "./node_modules/ev-emitter/ev-emitter.js")
|
3931 |
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function( EvEmitter ) {
|
3932 |
+
return factory( window, EvEmitter );
|
3933 |
+
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
3934 |
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
3935 |
+
} else {}
|
3936 |
|
3937 |
+
})( typeof window !== 'undefined' ? window : this,
|
|
|
|
|
|
|
3938 |
|
3939 |
+
// -------------------------- factory -------------------------- //
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3940 |
|
3941 |
+
function factory( window, EvEmitter ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3942 |
|
3943 |
+
'use strict';
|
|
|
|
|
|
|
|
|
3944 |
|
3945 |
+
var $ = window.jQuery;
|
3946 |
+
var console = window.console;
|
3947 |
|
3948 |
+
// -------------------------- helpers -------------------------- //
|
|
|
|
|
|
|
3949 |
|
3950 |
+
// extend objects
|
3951 |
+
function extend( a, b ) {
|
3952 |
+
for ( var prop in b ) {
|
3953 |
+
a[ prop ] = b[ prop ];
|
3954 |
+
}
|
3955 |
+
return a;
|
3956 |
+
}
|
3957 |
|
3958 |
+
var arraySlice = Array.prototype.slice;
|
|
|
|
|
|
|
3959 |
|
3960 |
+
// turn element or nodeList into an array
|
3961 |
+
function makeArray( obj ) {
|
3962 |
+
if ( Array.isArray( obj ) ) {
|
3963 |
+
// use object if already an array
|
3964 |
+
return obj;
|
3965 |
}
|
3966 |
+
|
3967 |
+
var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
|
3968 |
+
if ( isArrayLike ) {
|
3969 |
+
// convert nodeList to array
|
3970 |
+
return arraySlice.call( obj );
|
3971 |
}
|
3972 |
+
|
3973 |
+
// array of single index
|
3974 |
+
return [ obj ];
|
3975 |
+
}
|
3976 |
+
|
3977 |
+
// -------------------------- imagesLoaded -------------------------- //
|
3978 |
|
3979 |
/**
|
3980 |
+
* @param {Array, Element, NodeList, String} elem
|
3981 |
+
* @param {Object or Function} options - if function, use as callback
|
3982 |
+
* @param {Function} onAlways - callback function
|
|
|
|
|
|
|
3983 |
*/
|
3984 |
+
function ImagesLoaded( elem, options, onAlways ) {
|
3985 |
+
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
|
3986 |
+
if ( !( this instanceof ImagesLoaded ) ) {
|
3987 |
+
return new ImagesLoaded( elem, options, onAlways );
|
3988 |
+
}
|
3989 |
+
// use elem as selector string
|
3990 |
+
var queryElem = elem;
|
3991 |
+
if ( typeof elem == 'string' ) {
|
3992 |
+
queryElem = document.querySelectorAll( elem );
|
3993 |
+
}
|
3994 |
+
// bail if bad element
|
3995 |
+
if ( !queryElem ) {
|
3996 |
+
console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) );
|
3997 |
return;
|
3998 |
}
|
3999 |
|
4000 |
+
this.elements = makeArray( queryElem );
|
4001 |
+
this.options = extend( {}, this.options );
|
4002 |
+
// shift arguments if no options set
|
4003 |
+
if ( typeof options == 'function' ) {
|
4004 |
+
onAlways = options;
|
4005 |
+
} else {
|
4006 |
+
extend( this.options, options );
|
|
|
|
|
|
|
|
|
|
|
4007 |
}
|
4008 |
|
4009 |
+
if ( onAlways ) {
|
4010 |
+
this.on( 'always', onAlways );
|
|
|
|
|
|
|
|
|
|
|
4011 |
}
|
|
|
|
|
|
|
|
|
4012 |
|
4013 |
+
this.getImages();
|
4014 |
|
4015 |
+
if ( $ ) {
|
4016 |
+
// add jQuery Deferred object
|
4017 |
+
this.jqDeferred = new $.Deferred();
|
4018 |
+
}
|
4019 |
|
4020 |
+
// HACK check async to allow time to bind listeners
|
4021 |
+
setTimeout( this.check.bind( this ) );
|
|
|
|
|
|
|
|
|
4022 |
}
|
4023 |
|
4024 |
+
ImagesLoaded.prototype = Object.create( EvEmitter.prototype );
|
4025 |
|
4026 |
+
ImagesLoaded.prototype.options = {};
|
4027 |
+
|
4028 |
+
ImagesLoaded.prototype.getImages = function() {
|
4029 |
+
this.images = [];
|
4030 |
+
|
4031 |
+
// filter & find items if we have an item selector
|
4032 |
+
this.elements.forEach( this.addElementImages, this );
|
4033 |
+
};
|
4034 |
+
|
4035 |
+
/**
|
4036 |
+
* @param {Node} element
|
4037 |
+
*/
|
4038 |
+
ImagesLoaded.prototype.addElementImages = function( elem ) {
|
4039 |
+
// filter siblings
|
4040 |
+
if ( elem.nodeName == 'IMG' ) {
|
4041 |
+
this.addImage( elem );
|
4042 |
+
}
|
4043 |
+
// get background image on element
|
4044 |
+
if ( this.options.background === true ) {
|
4045 |
+
this.addElementBackgroundImages( elem );
|
4046 |
+
}
|
4047 |
+
|
4048 |
+
// find children
|
4049 |
+
// no non-element nodes, #143
|
4050 |
+
var nodeType = elem.nodeType;
|
4051 |
+
if ( !nodeType || !elementNodeTypes[ nodeType ] ) {
|
4052 |
return;
|
4053 |
}
|
4054 |
+
var childImgs = elem.querySelectorAll('img');
|
4055 |
+
// concat childElems to filterFound array
|
4056 |
+
for ( var i=0; i < childImgs.length; i++ ) {
|
4057 |
+
var img = childImgs[i];
|
4058 |
+
this.addImage( img );
|
4059 |
+
}
|
4060 |
|
4061 |
+
// get child background images
|
4062 |
+
if ( typeof this.options.background == 'string' ) {
|
4063 |
+
var children = elem.querySelectorAll( this.options.background );
|
4064 |
+
for ( i=0; i < children.length; i++ ) {
|
4065 |
+
var child = children[i];
|
4066 |
+
this.addElementBackgroundImages( child );
|
4067 |
+
}
|
4068 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4069 |
};
|
4070 |
|
4071 |
+
var elementNodeTypes = {
|
4072 |
+
1: true,
|
4073 |
+
9: true,
|
4074 |
+
11: true
|
4075 |
+
};
|
4076 |
|
4077 |
+
ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) {
|
4078 |
+
var style = getComputedStyle( elem );
|
4079 |
+
if ( !style ) {
|
4080 |
+
// Firefox returns null if in a hidden iframe https://bugzil.la/548397
|
4081 |
+
return;
|
4082 |
+
}
|
4083 |
+
// get url inside url("...")
|
4084 |
+
var reURL = /url\((['"])?(.*?)\1\)/gi;
|
4085 |
+
var matches = reURL.exec( style.backgroundImage );
|
4086 |
+
while ( matches !== null ) {
|
4087 |
+
var url = matches && matches[2];
|
4088 |
+
if ( url ) {
|
4089 |
+
this.addBackground( url, elem );
|
4090 |
+
}
|
4091 |
+
matches = reURL.exec( style.backgroundImage );
|
4092 |
+
}
|
4093 |
};
|
4094 |
|
4095 |
+
/**
|
4096 |
+
* @param {Image} img
|
4097 |
+
*/
|
4098 |
+
ImagesLoaded.prototype.addImage = function( img ) {
|
4099 |
+
var loadingImage = new LoadingImage( img );
|
4100 |
+
this.images.push( loadingImage );
|
4101 |
};
|
4102 |
|
4103 |
+
ImagesLoaded.prototype.addBackground = function( url, elem ) {
|
4104 |
+
var background = new Background( url, elem );
|
4105 |
+
this.images.push( background );
|
4106 |
};
|
4107 |
|
4108 |
+
ImagesLoaded.prototype.check = function() {
|
4109 |
+
var _this = this;
|
4110 |
+
this.progressedCount = 0;
|
4111 |
+
this.hasAnyBroken = false;
|
4112 |
+
// complete if no images
|
4113 |
+
if ( !this.images.length ) {
|
4114 |
+
this.complete();
|
4115 |
return;
|
4116 |
}
|
|
|
|
|
|
|
4117 |
|
4118 |
+
function onProgress( image, elem, message ) {
|
4119 |
+
// HACK - Chrome triggers event before object properties have changed. #83
|
4120 |
+
setTimeout( function() {
|
4121 |
+
_this.progress( image, elem, message );
|
4122 |
+
});
|
|
|
4123 |
}
|
4124 |
+
|
4125 |
+
this.images.forEach( function( loadingImage ) {
|
4126 |
+
loadingImage.once( 'progress', onProgress );
|
4127 |
+
loadingImage.check();
|
4128 |
+
});
|
4129 |
+
};
|
4130 |
+
|
4131 |
+
ImagesLoaded.prototype.progress = function( image, elem, message ) {
|
4132 |
+
this.progressedCount++;
|
4133 |
+
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;
|
4134 |
+
// progress event
|
4135 |
+
this.emitEvent( 'progress', [ this, image, elem ] );
|
4136 |
+
if ( this.jqDeferred && this.jqDeferred.notify ) {
|
4137 |
+
this.jqDeferred.notify( this, image );
|
4138 |
}
|
4139 |
+
// check if completed
|
4140 |
+
if ( this.progressedCount == this.images.length ) {
|
4141 |
+
this.complete();
|
|
|
|
|
4142 |
}
|
4143 |
|
4144 |
+
if ( this.options.debug && console ) {
|
4145 |
+
console.log( 'progress: ' + message, image, elem );
|
4146 |
+
}
|
4147 |
};
|
4148 |
|
4149 |
+
ImagesLoaded.prototype.complete = function() {
|
4150 |
+
var eventName = this.hasAnyBroken ? 'fail' : 'done';
|
4151 |
+
this.isComplete = true;
|
4152 |
+
this.emitEvent( eventName, [ this ] );
|
4153 |
+
this.emitEvent( 'always', [ this ] );
|
4154 |
+
if ( this.jqDeferred ) {
|
4155 |
+
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';
|
4156 |
+
this.jqDeferred[ jqMethod ]( this );
|
4157 |
+
}
|
4158 |
};
|
4159 |
|
4160 |
+
// -------------------------- -------------------------- //
|
4161 |
+
|
4162 |
+
function LoadingImage( img ) {
|
4163 |
+
this.img = img;
|
4164 |
+
}
|
4165 |
+
|
4166 |
+
LoadingImage.prototype = Object.create( EvEmitter.prototype );
|
4167 |
+
|
4168 |
+
LoadingImage.prototype.check = function() {
|
4169 |
+
// If complete is true and browser supports natural sizes,
|
4170 |
+
// try to check for image status manually.
|
4171 |
+
var isComplete = this.getIsImageComplete();
|
4172 |
+
if ( isComplete ) {
|
4173 |
+
// report based on naturalWidth
|
4174 |
+
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
|
4175 |
+
return;
|
4176 |
}
|
|
|
|
|
4177 |
|
4178 |
+
// If none of the checks above matched, simulate loading on detached element.
|
4179 |
+
this.proxyImage = new Image();
|
4180 |
+
this.proxyImage.addEventListener( 'load', this );
|
4181 |
+
this.proxyImage.addEventListener( 'error', this );
|
4182 |
+
// bind to image as well for Firefox. #191
|
4183 |
+
this.img.addEventListener( 'load', this );
|
4184 |
+
this.img.addEventListener( 'error', this );
|
4185 |
+
this.proxyImage.src = this.img.src;
|
4186 |
};
|
4187 |
|
4188 |
+
LoadingImage.prototype.getIsImageComplete = function() {
|
4189 |
+
// check for non-zero, non-undefined naturalWidth
|
4190 |
+
// fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671
|
4191 |
+
return this.img.complete && this.img.naturalWidth;
|
4192 |
};
|
4193 |
|
4194 |
+
LoadingImage.prototype.confirm = function( isLoaded, message ) {
|
4195 |
+
this.isLoaded = isLoaded;
|
4196 |
+
this.emitEvent( 'progress', [ this, this.img, message ] );
|
|
|
|
|
4197 |
};
|
4198 |
|
4199 |
+
// ----- events ----- //
|
4200 |
|
4201 |
+
// trigger specified handler for event type
|
4202 |
+
LoadingImage.prototype.handleEvent = function( event ) {
|
4203 |
+
var method = 'on' + event.type;
|
4204 |
+
if ( this[ method ] ) {
|
4205 |
+
this[ method ]( event );
|
4206 |
+
}
|
4207 |
};
|
4208 |
|
4209 |
+
LoadingImage.prototype.onload = function() {
|
4210 |
+
this.confirm( true, 'onload' );
|
4211 |
+
this.unbindEvents();
|
4212 |
+
};
|
|
|
|
|
4213 |
|
4214 |
+
LoadingImage.prototype.onerror = function() {
|
4215 |
+
this.confirm( false, 'onerror' );
|
4216 |
+
this.unbindEvents();
|
|
|
|
|
4217 |
};
|
4218 |
|
4219 |
+
LoadingImage.prototype.unbindEvents = function() {
|
4220 |
+
this.proxyImage.removeEventListener( 'load', this );
|
4221 |
+
this.proxyImage.removeEventListener( 'error', this );
|
4222 |
+
this.img.removeEventListener( 'load', this );
|
4223 |
+
this.img.removeEventListener( 'error', this );
|
4224 |
+
};
|
4225 |
|
4226 |
+
// -------------------------- Background -------------------------- //
|
4227 |
|
4228 |
+
function Background( url, element ) {
|
4229 |
+
this.url = url;
|
4230 |
+
this.element = element;
|
4231 |
+
this.img = new Image();
|
4232 |
+
}
|
4233 |
|
4234 |
+
// inherit LoadingImage prototype
|
4235 |
+
Background.prototype = Object.create( LoadingImage.prototype );
|
|
|
|
|
|
|
|
|
|
|
4236 |
|
4237 |
+
Background.prototype.check = function() {
|
4238 |
+
this.img.addEventListener( 'load', this );
|
4239 |
+
this.img.addEventListener( 'error', this );
|
4240 |
+
this.img.src = this.url;
|
4241 |
+
// check if image is already complete
|
4242 |
+
var isComplete = this.getIsImageComplete();
|
4243 |
+
if ( isComplete ) {
|
4244 |
+
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' );
|
4245 |
+
this.unbindEvents();
|
4246 |
}
|
4247 |
};
|
4248 |
|
4249 |
+
Background.prototype.unbindEvents = function() {
|
4250 |
+
this.img.removeEventListener( 'load', this );
|
4251 |
+
this.img.removeEventListener( 'error', this );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4252 |
};
|
4253 |
|
4254 |
+
Background.prototype.confirm = function( isLoaded, message ) {
|
4255 |
+
this.isLoaded = isLoaded;
|
4256 |
+
this.emitEvent( 'progress', [ this, this.element, message ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4257 |
};
|
4258 |
|
4259 |
+
// -------------------------- jQuery -------------------------- //
|
4260 |
+
|
4261 |
+
ImagesLoaded.makeJQueryPlugin = function( jQuery ) {
|
4262 |
+
jQuery = jQuery || window.jQuery;
|
4263 |
+
if ( !jQuery ) {
|
4264 |
+
return;
|
4265 |
}
|
4266 |
+
// set local variable
|
4267 |
+
$ = jQuery;
|
4268 |
+
// $().imagesLoaded()
|
4269 |
+
$.fn.imagesLoaded = function( options, callback ) {
|
4270 |
+
var instance = new ImagesLoaded( this, options, callback );
|
4271 |
+
return instance.jqDeferred.promise( $(this) );
|
4272 |
+
};
|
4273 |
};
|
4274 |
+
// try making plugin
|
4275 |
+
ImagesLoaded.makeJQueryPlugin();
|
4276 |
|
4277 |
+
// -------------------------- -------------------------- //
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4278 |
|
4279 |
+
return ImagesLoaded;
|
4280 |
|
4281 |
+
});
|
4282 |
|
4283 |
|
4284 |
/***/ }),
|
4285 |
|
4286 |
+
/***/ "./node_modules/masonry-layout/masonry.js":
|
4287 |
+
/*!************************************************!*\
|
4288 |
+
!*** ./node_modules/masonry-layout/masonry.js ***!
|
4289 |
+
\************************************************/
|
4290 |
/*! no static exports found */
|
4291 |
/***/ (function(module, exports, __webpack_require__) {
|
4292 |
|
4293 |
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
4294 |
+
* Masonry v4.2.2
|
4295 |
+
* Cascading grid layout library
|
4296 |
+
* https://masonry.desandro.com
|
4297 |
+
* MIT License
|
4298 |
+
* by David DeSandro
|
4299 |
*/
|
4300 |
|
4301 |
( function( window, factory ) {
|
|
|
4302 |
// universal module definition
|
4303 |
+
/* jshint strict: false */ /*globals define, module, require */
|
4304 |
if ( true ) {
|
4305 |
+
// AMD
|
4306 |
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
4307 |
+
__webpack_require__(/*! outlayer/outlayer */ "./node_modules/outlayer/outlayer.js"),
|
4308 |
+
__webpack_require__(/*! get-size/get-size */ "./node_modules/get-size/get-size.js")
|
4309 |
+
], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
4310 |
+
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
4311 |
+
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
|
|
|
|
4312 |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
4313 |
} else {}
|
4314 |
|
4315 |
+
}( window, function factory( Outlayer, getSize ) {
|
|
|
4316 |
|
4317 |
+
'use strict';
|
4318 |
|
4319 |
+
// -------------------------- masonryDefinition -------------------------- //
|
|
|
|
|
4320 |
|
4321 |
+
// create an Outlayer layout class
|
4322 |
+
var Masonry = Outlayer.create('masonry');
|
4323 |
+
// isFitWidth -> fitWidth
|
4324 |
+
Masonry.compatOptions.fitWidth = 'isFitWidth';
|
4325 |
|
4326 |
+
var proto = Masonry.prototype;
|
|
|
|
|
|
|
4327 |
|
4328 |
+
proto._resetLayout = function() {
|
4329 |
+
this.getSize();
|
4330 |
+
this._getMeasurement( 'columnWidth', 'outerWidth' );
|
4331 |
+
this._getMeasurement( 'gutter', 'outerWidth' );
|
4332 |
+
this.measureColumns();
|
4333 |
|
4334 |
+
// reset column Y
|
4335 |
+
this.colYs = [];
|
4336 |
+
for ( var i=0; i < this.cols; i++ ) {
|
4337 |
+
this.colYs.push( 0 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4338 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4339 |
|
4340 |
+
this.maxY = 0;
|
4341 |
+
this.horizontalColIndex = 0;
|
4342 |
+
};
|
4343 |
|
4344 |
+
proto.measureColumns = function() {
|
4345 |
+
this.getContainerWidth();
|
4346 |
+
// if columnWidth is 0, default to outerWidth of first item
|
4347 |
+
if ( !this.columnWidth ) {
|
4348 |
+
var firstItem = this.items[0];
|
4349 |
+
var firstItemElem = firstItem && firstItem.element;
|
4350 |
+
// columnWidth fall back to item of first element
|
4351 |
+
this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth ||
|
4352 |
+
// if first elem has no width, default to size of container
|
4353 |
+
this.containerWidth;
|
4354 |
+
}
|
4355 |
|
4356 |
+
var columnWidth = this.columnWidth += this.gutter;
|
|
|
4357 |
|
4358 |
+
// calculate columns
|
4359 |
+
var containerWidth = this.containerWidth + this.gutter;
|
4360 |
+
var cols = containerWidth / columnWidth;
|
4361 |
+
// fix rounding errors, typically with gutters
|
4362 |
+
var excess = columnWidth - containerWidth % columnWidth;
|
4363 |
+
// if overshoot is less than a pixel, round up, otherwise floor it
|
4364 |
+
var mathMethod = excess && excess < 1 ? 'round' : 'floor';
|
4365 |
+
cols = Math[ mathMethod ]( cols );
|
4366 |
+
this.cols = Math.max( cols, 1 );
|
4367 |
+
};
|
4368 |
|
4369 |
+
proto.getContainerWidth = function() {
|
4370 |
+
// container is parent if fit width
|
4371 |
+
var isFitWidth = this._getOption('fitWidth');
|
4372 |
+
var container = isFitWidth ? this.element.parentNode : this.element;
|
4373 |
+
// check that this.size and size are there
|
4374 |
+
// IE8 triggers resize on body size change, so they might not be
|
4375 |
+
var size = getSize( container );
|
4376 |
+
this.containerWidth = size && size.innerWidth;
|
4377 |
+
};
|
4378 |
|
4379 |
+
proto._getItemLayoutPosition = function( item ) {
|
4380 |
+
item.getSize();
|
4381 |
+
// how many columns does this brick span
|
4382 |
+
var remainder = item.size.outerWidth % this.columnWidth;
|
4383 |
+
var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil';
|
4384 |
+
// round if off by 1 pixel, otherwise use ceil
|
4385 |
+
var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth );
|
4386 |
+
colSpan = Math.min( colSpan, this.cols );
|
4387 |
+
// use horizontal or top column position
|
4388 |
+
var colPosMethod = this.options.horizontalOrder ?
|
4389 |
+
'_getHorizontalColPosition' : '_getTopColPosition';
|
4390 |
+
var colPosition = this[ colPosMethod ]( colSpan, item );
|
4391 |
+
// position the brick
|
4392 |
+
var position = {
|
4393 |
+
x: this.columnWidth * colPosition.col,
|
4394 |
+
y: colPosition.y
|
4395 |
+
};
|
4396 |
+
// apply setHeight to necessary columns
|
4397 |
+
var setHeight = colPosition.y + item.size.outerHeight;
|
4398 |
+
var setMax = colSpan + colPosition.col;
|
4399 |
+
for ( var i = colPosition.col; i < setMax; i++ ) {
|
4400 |
+
this.colYs[i] = setHeight;
|
4401 |
+
}
|
4402 |
|
4403 |
+
return position;
|
4404 |
+
};
|
|
|
4405 |
|
4406 |
+
proto._getTopColPosition = function( colSpan ) {
|
4407 |
+
var colGroup = this._getTopColGroup( colSpan );
|
4408 |
+
// get the minimum Y value from the columns
|
4409 |
+
var minimumY = Math.min.apply( Math, colGroup );
|
|
|
|
|
|
|
4410 |
|
4411 |
+
return {
|
4412 |
+
col: colGroup.indexOf( minimumY ),
|
4413 |
+
y: minimumY,
|
4414 |
+
};
|
4415 |
+
};
|
|
|
|
|
|
|
4416 |
|
4417 |
+
/**
|
4418 |
+
* @param {Number} colSpan - number of columns the element spans
|
4419 |
+
* @returns {Array} colGroup
|
4420 |
+
*/
|
4421 |
+
proto._getTopColGroup = function( colSpan ) {
|
4422 |
+
if ( colSpan < 2 ) {
|
4423 |
+
// if brick spans only one column, use all the column Ys
|
4424 |
+
return this.colYs;
|
4425 |
+
}
|
|
|
4426 |
|
4427 |
+
var colGroup = [];
|
4428 |
+
// how many different places could this brick fit horizontally
|
4429 |
+
var groupCount = this.cols + 1 - colSpan;
|
4430 |
+
// for each group potential horizontal position
|
4431 |
+
for ( var i = 0; i < groupCount; i++ ) {
|
4432 |
+
colGroup[i] = this._getColGroupY( i, colSpan );
|
4433 |
+
}
|
4434 |
+
return colGroup;
|
4435 |
+
};
|
4436 |
|
4437 |
+
proto._getColGroupY = function( col, colSpan ) {
|
4438 |
+
if ( colSpan < 2 ) {
|
4439 |
+
return this.colYs[ col ];
|
4440 |
+
}
|
4441 |
+
// make an array of colY values for that one group
|
4442 |
+
var groupColYs = this.colYs.slice( col, col + colSpan );
|
4443 |
+
// and get the max value of the array
|
4444 |
+
return Math.max.apply( Math, groupColYs );
|
4445 |
+
};
|
4446 |
|
4447 |
+
// get column position based on horizontal index. #873
|
4448 |
+
proto._getHorizontalColPosition = function( colSpan, item ) {
|
4449 |
+
var col = this.horizontalColIndex % this.cols;
|
4450 |
+
var isOver = colSpan > 1 && col + colSpan > this.cols;
|
4451 |
+
// shift to next row if item can't fit on current row
|
4452 |
+
col = isOver ? 0 : col;
|
4453 |
+
// don't let zero-size items take up space
|
4454 |
+
var hasSize = item.size.outerWidth && item.size.outerHeight;
|
4455 |
+
this.horizontalColIndex = hasSize ? col + colSpan : this.horizontalColIndex;
|
4456 |
|
4457 |
+
return {
|
4458 |
+
col: col,
|
4459 |
+
y: this._getColGroupY( col, colSpan ),
|
4460 |
+
};
|
4461 |
+
};
|
4462 |
|
4463 |
+
proto._manageStamp = function( stamp ) {
|
4464 |
+
var stampSize = getSize( stamp );
|
4465 |
+
var offset = this._getElementOffset( stamp );
|
4466 |
+
// get the columns that this stamp affects
|
4467 |
+
var isOriginLeft = this._getOption('originLeft');
|
4468 |
+
var firstX = isOriginLeft ? offset.left : offset.right;
|
4469 |
+
var lastX = firstX + stampSize.outerWidth;
|
4470 |
+
var firstCol = Math.floor( firstX / this.columnWidth );
|
4471 |
+
firstCol = Math.max( 0, firstCol );
|
4472 |
+
var lastCol = Math.floor( lastX / this.columnWidth );
|
4473 |
+
// lastCol should not go over if multiple of columnWidth #425
|
4474 |
+
lastCol -= lastX % this.columnWidth ? 0 : 1;
|
4475 |
+
lastCol = Math.min( this.cols - 1, lastCol );
|
4476 |
+
// set colYs to bottom of the stamp
|
4477 |
|
4478 |
+
var isOriginTop = this._getOption('originTop');
|
4479 |
+
var stampMaxY = ( isOriginTop ? offset.top : offset.bottom ) +
|
4480 |
+
stampSize.outerHeight;
|
4481 |
+
for ( var i = firstCol; i <= lastCol; i++ ) {
|
4482 |
+
this.colYs[i] = Math.max( stampMaxY, this.colYs[i] );
|
4483 |
+
}
|
4484 |
+
};
|
4485 |
|
4486 |
+
proto._getContainerSize = function() {
|
4487 |
+
this.maxY = Math.max.apply( Math, this.colYs );
|
4488 |
+
var size = {
|
4489 |
+
height: this.maxY
|
4490 |
+
};
|
|
|
|
|
4491 |
|
4492 |
+
if ( this._getOption('fitWidth') ) {
|
4493 |
+
size.width = this._getContainerFitWidth();
|
4494 |
+
}
|
4495 |
|
4496 |
+
return size;
|
4497 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
4498 |
|
4499 |
+
proto._getContainerFitWidth = function() {
|
4500 |
+
var unusedCols = 0;
|
4501 |
+
// count unused columns
|
4502 |
+
var i = this.cols;
|
4503 |
+
while ( --i ) {
|
4504 |
+
if ( this.colYs[i] !== 0 ) {
|
4505 |
+
break;
|
4506 |
+
}
|
4507 |
+
unusedCols++;
|
4508 |
+
}
|
4509 |
+
// fit container to columns that have been used
|
4510 |
+
return ( this.cols - unusedCols ) * this.columnWidth - this.gutter;
|
4511 |
+
};
|
4512 |
|
4513 |
+
proto.needsResizeLayout = function() {
|
4514 |
+
var previousWidth = this.containerWidth;
|
4515 |
+
this.getContainerWidth();
|
4516 |
+
return previousWidth != this.containerWidth;
|
4517 |
+
};
|
4518 |
|
4519 |
+
return Masonry;
|
|
|
|
|
|
|
|
|
|
|
4520 |
|
4521 |
+
}));
|
|
|
|
|
|
|
|
|
4522 |
|
|
|
|
|
|
|
4523 |
|
4524 |
+
/***/ }),
|
|
|
4525 |
|
4526 |
+
/***/ "./node_modules/object-assign/index.js":
|
4527 |
+
/*!*********************************************!*\
|
4528 |
+
!*** ./node_modules/object-assign/index.js ***!
|
4529 |
+
\*********************************************/
|
4530 |
+
/*! no static exports found */
|
4531 |
+
/***/ (function(module, exports, __webpack_require__) {
|
4532 |
|
4533 |
+
"use strict";
|
4534 |
+
/*
|
4535 |
+
object-assign
|
4536 |
+
(c) Sindre Sorhus
|
4537 |
+
@license MIT
|
4538 |
+
*/
|
4539 |
|
|
|
|
|
|
|
4540 |
|
4541 |
+
/* eslint-disable no-unused-vars */
|
4542 |
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
4543 |
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
4544 |
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4545 |
|
4546 |
+
function toObject(val) {
|
4547 |
+
if (val === null || val === undefined) {
|
4548 |
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
4549 |
+
}
|
|
|
|
|
4550 |
|
4551 |
+
return Object(val);
|
4552 |
+
}
|
4553 |
|
4554 |
+
function shouldUseNative() {
|
4555 |
+
try {
|
4556 |
+
if (!Object.assign) {
|
4557 |
+
return false;
|
4558 |
+
}
|
4559 |
|
4560 |
+
// Detect buggy property enumeration order in older V8 versions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4561 |
|
4562 |
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
4563 |
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
4564 |
+
test1[5] = 'de';
|
4565 |
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
4566 |
+
return false;
|
4567 |
+
}
|
|
|
4568 |
|
4569 |
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
4570 |
+
var test2 = {};
|
4571 |
+
for (var i = 0; i < 10; i++) {
|
4572 |
+
test2['_' + String.fromCharCode(i)] = i;
|
4573 |
+
}
|
4574 |
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
4575 |
+
return test2[n];
|
4576 |
+
});
|
4577 |
+
if (order2.join('') !== '0123456789') {
|
4578 |
+
return false;
|
4579 |
+
}
|
4580 |
|
4581 |
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
4582 |
+
var test3 = {};
|
4583 |
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
4584 |
+
test3[letter] = letter;
|
4585 |
+
});
|
4586 |
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
4587 |
+
'abcdefghijklmnopqrst') {
|
4588 |
+
return false;
|
4589 |
+
}
|
4590 |
|
4591 |
+
return true;
|
4592 |
+
} catch (err) {
|
4593 |
+
// We don't expect any of the above to throw, but better to be safe.
|
4594 |
+
return false;
|
4595 |
+
}
|
4596 |
+
}
|
|
|
|
|
4597 |
|
4598 |
+
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
4599 |
+
var from;
|
4600 |
+
var to = toObject(target);
|
4601 |
+
var symbols;
|
4602 |
|
4603 |
+
for (var s = 1; s < arguments.length; s++) {
|
4604 |
+
from = Object(arguments[s]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4605 |
|
4606 |
+
for (var key in from) {
|
4607 |
+
if (hasOwnProperty.call(from, key)) {
|
4608 |
+
to[key] = from[key];
|
4609 |
+
}
|
4610 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4611 |
|
4612 |
+
if (getOwnPropertySymbols) {
|
4613 |
+
symbols = getOwnPropertySymbols(from);
|
4614 |
+
for (var i = 0; i < symbols.length; i++) {
|
4615 |
+
if (propIsEnumerable.call(from, symbols[i])) {
|
4616 |
+
to[symbols[i]] = from[symbols[i]];
|
4617 |
+
}
|
4618 |
+
}
|
4619 |
+
}
|
4620 |
+
}
|
|
|
4621 |
|
4622 |
+
return to;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4623 |
};
|
4624 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4625 |
|
4626 |
+
/***/ }),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4627 |
|
4628 |
+
/***/ "./node_modules/outlayer/item.js":
|
4629 |
+
/*!***************************************!*\
|
4630 |
+
!*** ./node_modules/outlayer/item.js ***!
|
4631 |
+
\***************************************/
|
4632 |
+
/*! no static exports found */
|
4633 |
+
/***/ (function(module, exports, __webpack_require__) {
|
|
|
4634 |
|
4635 |
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
4636 |
+
* Outlayer Item
|
|
|
4637 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4638 |
|
4639 |
+
( function( window, factory ) {
|
4640 |
+
// universal module definition
|
4641 |
+
/* jshint strict: false */ /* globals define, module, require */
|
4642 |
+
if ( true ) {
|
4643 |
+
// AMD - RequireJS
|
4644 |
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
4645 |
+
__webpack_require__(/*! ev-emitter/ev-emitter */ "./node_modules/ev-emitter/ev-emitter.js"),
|
4646 |
+
__webpack_require__(/*! get-size/get-size */ "./node_modules/get-size/get-size.js")
|
4647 |
+
], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
4648 |
+
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
4649 |
+
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
4650 |
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
4651 |
+
} else {}
|
4652 |
|
4653 |
+
}( window, function factory( EvEmitter, getSize ) {
|
4654 |
+
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4655 |
|
4656 |
+
// ----- helpers ----- //
|
|
|
|
|
|
|
|
|
4657 |
|
4658 |
+
function isEmptyObj( obj ) {
|
4659 |
+
for ( var prop in obj ) {
|
4660 |
+
return false;
|
|
|
|
|
|
|
4661 |
}
|
4662 |
+
prop = null;
|
4663 |
+
return true;
|
4664 |
+
}
|
4665 |
|
4666 |
+
// -------------------------- CSS3 support -------------------------- //
|
|
|
|
|
|
|
|
|
4667 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4668 |
|
4669 |
+
var docElemStyle = document.documentElement.style;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4670 |
|
4671 |
+
var transitionProperty = typeof docElemStyle.transition == 'string' ?
|
4672 |
+
'transition' : 'WebkitTransition';
|
4673 |
+
var transformProperty = typeof docElemStyle.transform == 'string' ?
|
4674 |
+
'transform' : 'WebkitTransform';
|
4675 |
|
4676 |
+
var transitionEndEvent = {
|
4677 |
+
WebkitTransition: 'webkitTransitionEnd',
|
4678 |
+
transition: 'transitionend'
|
4679 |
+
}[ transitionProperty ];
|
4680 |
|
4681 |
+
// cache all vendor properties that could have vendor prefix
|
4682 |
+
var vendorProperties = {
|
4683 |
+
transform: transformProperty,
|
4684 |
+
transition: transitionProperty,
|
4685 |
+
transitionDuration: transitionProperty + 'Duration',
|
4686 |
+
transitionProperty: transitionProperty + 'Property',
|
4687 |
+
transitionDelay: transitionProperty + 'Delay'
|
|
|
|
|
|
|
4688 |
};
|
4689 |
|
4690 |
+
// -------------------------- Item -------------------------- //
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4691 |
|
4692 |
+
function Item( element, layout ) {
|
4693 |
+
if ( !element ) {
|
|
|
|
|
|
|
|
|
|
|
4694 |
return;
|
4695 |
}
|
4696 |
|
4697 |
+
this.element = element;
|
4698 |
+
// parent layout class, i.e. Masonry, Isotope, or Packery
|
4699 |
+
this.layout = layout;
|
4700 |
+
this.position = {
|
4701 |
+
x: 0,
|
4702 |
+
y: 0
|
4703 |
+
};
|
4704 |
+
|
4705 |
+
this._create();
|
4706 |
+
}
|
4707 |
+
|
4708 |
+
// inherit EvEmitter
|
4709 |
+
var proto = Item.prototype = Object.create( EvEmitter.prototype );
|
4710 |
+
proto.constructor = Item;
|
4711 |
+
|
4712 |
+
proto._create = function() {
|
4713 |
+
// transition objects
|
4714 |
+
this._transn = {
|
4715 |
+
ingProperties: {},
|
4716 |
+
clean: {},
|
4717 |
+
onEnd: {}
|
4718 |
+
};
|
4719 |
+
|
4720 |
+
this.css({
|
4721 |
+
position: 'absolute'
|
4722 |
+
});
|
4723 |
};
|
4724 |
|
4725 |
+
// trigger specified handler for event type
|
4726 |
+
proto.handleEvent = function( event ) {
|
4727 |
+
var method = 'on' + event.type;
|
4728 |
+
if ( this[ method ] ) {
|
4729 |
+
this[ method ]( event );
|
|
|
|
|
|
|
4730 |
}
|
4731 |
+
};
|
4732 |
|
4733 |
+
proto.getSize = function() {
|
4734 |
+
this.size = getSize( this.element );
|
|
|
|
|
|
|
4735 |
};
|
4736 |
|
4737 |
/**
|
4738 |
+
* apply CSS styles to element
|
4739 |
+
* @param {Object} style
|
|
|
4740 |
*/
|
4741 |
+
proto.css = function( style ) {
|
4742 |
+
var elemStyle = this.element.style;
|
4743 |
+
|
4744 |
+
for ( var prop in style ) {
|
4745 |
+
// use vendor property if available
|
4746 |
+
var supportedProp = vendorProperties[ prop ] || prop;
|
4747 |
+
elemStyle[ supportedProp ] = style[ prop ];
|
4748 |
}
|
|
|
|
|
4749 |
};
|
4750 |
|
4751 |
+
// measure position, and sets it
|
4752 |
+
proto.getPosition = function() {
|
4753 |
+
var style = getComputedStyle( this.element );
|
4754 |
+
var isOriginLeft = this.layout._getOption('originLeft');
|
4755 |
+
var isOriginTop = this.layout._getOption('originTop');
|
4756 |
+
var xValue = style[ isOriginLeft ? 'left' : 'right' ];
|
4757 |
+
var yValue = style[ isOriginTop ? 'top' : 'bottom' ];
|
4758 |
+
var x = parseFloat( xValue );
|
4759 |
+
var y = parseFloat( yValue );
|
4760 |
+
// convert percent to pixels
|
4761 |
+
var layoutSize = this.layout.size;
|
4762 |
+
if ( xValue.indexOf('%') != -1 ) {
|
4763 |
+
x = ( x / 100 ) * layoutSize.width;
|
4764 |
}
|
4765 |
+
if ( yValue.indexOf('%') != -1 ) {
|
4766 |
+
y = ( y / 100 ) * layoutSize.height;
|
4767 |
+
}
|
4768 |
+
// clean up 'auto' or other non-integer values
|
4769 |
+
x = isNaN( x ) ? 0 : x;
|
4770 |
+
y = isNaN( y ) ? 0 : y;
|
4771 |
+
// remove padding from measurement
|
4772 |
+
x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight;
|
4773 |
+
y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom;
|
4774 |
|
4775 |
+
this.position.x = x;
|
4776 |
+
this.position.y = y;
|
|
|
4777 |
};
|
4778 |
|
4779 |
+
// set settled position, apply padding
|
4780 |
+
proto.layoutPosition = function() {
|
4781 |
+
var layoutSize = this.layout.size;
|
4782 |
+
var style = {};
|
4783 |
+
var isOriginLeft = this.layout._getOption('originLeft');
|
4784 |
+
var isOriginTop = this.layout._getOption('originTop');
|
|
|
|
|
|
|
|
|
|
|
|
|
4785 |
|
4786 |
+
// x
|
4787 |
+
var xPadding = isOriginLeft ? 'paddingLeft' : 'paddingRight';
|
4788 |
+
var xProperty = isOriginLeft ? 'left' : 'right';
|
4789 |
+
var xResetProperty = isOriginLeft ? 'right' : 'left';
|
4790 |
|
4791 |
+
var x = this.position.x + layoutSize[ xPadding ];
|
4792 |
+
// set in percentage or pixels
|
4793 |
+
style[ xProperty ] = this.getXValue( x );
|
4794 |
+
// reset other property
|
4795 |
+
style[ xResetProperty ] = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4796 |
|
4797 |
+
// y
|
4798 |
+
var yPadding = isOriginTop ? 'paddingTop' : 'paddingBottom';
|
4799 |
+
var yProperty = isOriginTop ? 'top' : 'bottom';
|
4800 |
+
var yResetProperty = isOriginTop ? 'bottom' : 'top';
|
4801 |
|
4802 |
+
var y = this.position.y + layoutSize[ yPadding ];
|
4803 |
+
// set in percentage or pixels
|
4804 |
+
style[ yProperty ] = this.getYValue( y );
|
4805 |
+
// reset other property
|
4806 |
+
style[ yResetProperty ] = '';
|
4807 |
|
4808 |
+
this.css( style );
|
4809 |
+
this.emitEvent( 'layout', [ this ] );
|
|
|
|
|
|
|
|
|
4810 |
};
|
4811 |
|
4812 |
+
proto.getXValue = function( x ) {
|
4813 |
+
var isHorizontal = this.layout._getOption('horizontal');
|
4814 |
+
return this.layout.options.percentPosition && !isHorizontal ?
|
4815 |
+
( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px';
|
|
|
|
|
4816 |
};
|
4817 |
|
4818 |
+
proto.getYValue = function( y ) {
|
4819 |
+
var isHorizontal = this.layout._getOption('horizontal');
|
4820 |
+
return this.layout.options.percentPosition && isHorizontal ?
|
4821 |
+
( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px';
|
4822 |
};
|
4823 |
|
4824 |
+
proto._transitionTo = function( x, y ) {
|
4825 |
+
this.getPosition();
|
4826 |
+
// get current x & y from top/left
|
4827 |
+
var curX = this.position.x;
|
4828 |
+
var curY = this.position.y;
|
4829 |
|
4830 |
+
var didNotMove = x == this.position.x && y == this.position.y;
|
4831 |
+
|
4832 |
+
// save end position
|
4833 |
+
this.setPosition( x, y );
|
4834 |
+
|
4835 |
+
// if did not move and not transitioning, just go to layout
|
4836 |
+
if ( didNotMove && !this.isTransitioning ) {
|
4837 |
+
this.layoutPosition();
|
4838 |
return;
|
4839 |
}
|
4840 |
|
4841 |
+
var transX = x - curX;
|
4842 |
+
var transY = y - curY;
|
4843 |
+
var transitionStyle = {};
|
4844 |
+
transitionStyle.transform = this.getTranslate( transX, transY );
|
4845 |
|
4846 |
+
this.transition({
|
4847 |
+
to: transitionStyle,
|
4848 |
+
onTransitionEnd: {
|
4849 |
+
transform: this.layoutPosition
|
4850 |
+
},
|
4851 |
+
isCleaning: true
|
4852 |
+
});
|
|
|
|
|
|
|
4853 |
};
|
4854 |
|
4855 |
+
proto.getTranslate = function( x, y ) {
|
4856 |
+
// flip cooridinates if origin on right or bottom
|
4857 |
+
var isOriginLeft = this.layout._getOption('originLeft');
|
4858 |
+
var isOriginTop = this.layout._getOption('originTop');
|
4859 |
+
x = isOriginLeft ? x : -x;
|
4860 |
+
y = isOriginTop ? y : -y;
|
4861 |
+
return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4862 |
};
|
4863 |
|
4864 |
+
// non transition + transform support
|
4865 |
+
proto.goTo = function( x, y ) {
|
4866 |
+
this.setPosition( x, y );
|
4867 |
+
this.layoutPosition();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4868 |
};
|
4869 |
|
4870 |
+
proto.moveTo = proto._transitionTo;
|
4871 |
+
|
4872 |
+
proto.setPosition = function( x, y ) {
|
4873 |
+
this.position.x = parseFloat( x );
|
4874 |
+
this.position.y = parseFloat( y );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4875 |
};
|
4876 |
|
4877 |
+
// ----- transition ----- //
|
4878 |
+
|
4879 |
/**
|
4880 |
+
* @param {Object} style - CSS
|
4881 |
+
* @param {Function} onTransitionEnd
|
4882 |
*/
|
4883 |
+
|
4884 |
+
// non transition, just trigger callback
|
4885 |
+
proto._nonTransition = function( args ) {
|
4886 |
+
this.css( args.to );
|
4887 |
+
if ( args.isCleaning ) {
|
4888 |
+
this._removeStyles( args.to );
|
4889 |
+
}
|
4890 |
+
for ( var prop in args.onTransitionEnd ) {
|
4891 |
+
args.onTransitionEnd[ prop ].call( this );
|
4892 |
}
|
|
|
|
|
|
|
|
|
|
|
4893 |
};
|
4894 |
|
4895 |
/**
|
4896 |
+
* proper transition
|
4897 |
+
* @param {Object} args - arguments
|
4898 |
+
* @param {Object} to - style to transition to
|
4899 |
+
* @param {Object} from - style to start transition from
|
4900 |
+
* @param {Boolean} isCleaning - removes transition styles after transition
|
4901 |
+
* @param {Function} onTransitionEnd - callback
|
4902 |
*/
|
4903 |
+
proto.transition = function( args ) {
|
4904 |
+
// redirect to nonTransition if no transition duration
|
4905 |
+
if ( !parseFloat( this.layout.options.transitionDuration ) ) {
|
4906 |
+
this._nonTransition( args );
|
4907 |
return;
|
4908 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
4909 |
|
4910 |
+
var _transition = this._transn;
|
4911 |
+
// keep track of onTransitionEnd callback by css property
|
4912 |
+
for ( var prop in args.onTransitionEnd ) {
|
4913 |
+
_transition.onEnd[ prop ] = args.onTransitionEnd[ prop ];
|
4914 |
+
}
|
4915 |
+
// keep track of properties that are transitioning
|
4916 |
+
for ( prop in args.to ) {
|
4917 |
+
_transition.ingProperties[ prop ] = true;
|
4918 |
+
// keep track of properties to clean up when transition is done
|
4919 |
+
if ( args.isCleaning ) {
|
4920 |
+
_transition.clean[ prop ] = true;
|
4921 |
+
}
|
4922 |
+
}
|
4923 |
|
4924 |
+
// set from styles
|
4925 |
+
if ( args.from ) {
|
4926 |
+
this.css( args.from );
|
4927 |
+
// force redraw. http://blog.alexmaccaw.com/css-transitions
|
4928 |
+
var h = this.element.offsetHeight;
|
4929 |
+
// hack for JSHint to hush about unused var
|
4930 |
+
h = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4931 |
}
|
4932 |
+
// enable transition
|
4933 |
+
this.enableTransition( args.to );
|
4934 |
+
// set styles that are transitioning
|
4935 |
+
this.css( args.to );
|
4936 |
|
4937 |
+
this.isTransitioning = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4938 |
|
|
|
4939 |
};
|
4940 |
|
4941 |
+
// dash before all cap letters, including first for
|
4942 |
+
// WebkitTransform => -webkit-transform
|
4943 |
+
function toDashedAll( str ) {
|
4944 |
+
return str.replace( /([A-Z])/g, function( $1 ) {
|
4945 |
+
return '-' + $1.toLowerCase();
|
4946 |
+
});
|
4947 |
+
}
|
4948 |
|
4949 |
+
var transitionProps = 'opacity,' + toDashedAll( transformProperty );
|
4950 |
|
4951 |
+
proto.enableTransition = function(/* style */) {
|
4952 |
+
// HACK changing transitionProperty during a transition
|
4953 |
+
// will cause transition to jump
|
4954 |
+
if ( this.isTransitioning ) {
|
4955 |
return;
|
4956 |
}
|
4957 |
|
4958 |
+
// make `transition: foo, bar, baz` from style object
|
4959 |
+
// HACK un-comment this when enableTransition can work
|
4960 |
+
// while a transition is happening
|
4961 |
+
// var transitionValues = [];
|
4962 |
+
// for ( var prop in style ) {
|
4963 |
+
// // dash-ify camelCased properties like WebkitTransition
|
4964 |
+
// prop = vendorProperties[ prop ] || prop;
|
4965 |
+
// transitionValues.push( toDashedAll( prop ) );
|
4966 |
+
// }
|
4967 |
+
// munge number to millisecond, to match stagger
|
4968 |
+
var duration = this.layout.options.transitionDuration;
|
4969 |
+
duration = typeof duration == 'number' ? duration + 'ms' : duration;
|
4970 |
+
// enable transition styles
|
4971 |
+
this.css({
|
4972 |
+
transitionProperty: transitionProps,
|
4973 |
+
transitionDuration: duration,
|
4974 |
+
transitionDelay: this.staggerDelay || 0
|
4975 |
+
});
|
4976 |
+
// listen for transition end event
|
4977 |
+
this.element.addEventListener( transitionEndEvent, this, false );
|
4978 |
};
|
4979 |
|
4980 |
+
// ----- events ----- //
|
4981 |
|
4982 |
+
proto.onwebkitTransitionEnd = function( event ) {
|
4983 |
+
this.ontransitionend( event );
|
4984 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4985 |
|
4986 |
+
proto.onotransitionend = function( event ) {
|
4987 |
+
this.ontransitionend( event );
|
4988 |
+
};
|
4989 |
|
4990 |
+
// properties that I munge to make my life easier
|
4991 |
+
var dashedVendorProperties = {
|
4992 |
+
'-webkit-transform': 'transform'
|
4993 |
+
};
|
4994 |
+
|
4995 |
+
proto.ontransitionend = function( event ) {
|
4996 |
+
// disregard bubbled events from children
|
4997 |
+
if ( event.target !== this.element ) {
|
4998 |
+
return;
|
4999 |
+
}
|
5000 |
+
var _transition = this._transn;
|
5001 |
+
// get property name of transitioned property, convert to prefix-free
|
5002 |
+
var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName;
|
5003 |
+
|
5004 |
+
// remove property that has completed transitioning
|
5005 |
+
delete _transition.ingProperties[ propertyName ];
|
5006 |
+
// check if any properties are still transitioning
|
5007 |
+
if ( isEmptyObj( _transition.ingProperties ) ) {
|
5008 |
+
// all properties have completed transitioning
|
5009 |
+
this.disableTransition();
|
5010 |
+
}
|
5011 |
+
// clean style
|
5012 |
+
if ( propertyName in _transition.clean ) {
|
5013 |
+
// clean up style
|
5014 |
+
this.element.style[ event.propertyName ] = '';
|
5015 |
+
delete _transition.clean[ propertyName ];
|
5016 |
+
}
|
5017 |
+
// trigger onTransitionEnd callback
|
5018 |
+
if ( propertyName in _transition.onEnd ) {
|
5019 |
+
var onTransitionEnd = _transition.onEnd[ propertyName ];
|
5020 |
+
onTransitionEnd.call( this );
|
5021 |
+
delete _transition.onEnd[ propertyName ];
|
5022 |
}
|
5023 |
|
5024 |
+
this.emitEvent( 'transitionEnd', [ this ] );
|
5025 |
};
|
5026 |
|
5027 |
+
proto.disableTransition = function() {
|
5028 |
+
this.removeTransitionStyles();
|
5029 |
+
this.element.removeEventListener( transitionEndEvent, this, false );
|
5030 |
+
this.isTransitioning = false;
|
5031 |
+
};
|
5032 |
|
5033 |
/**
|
5034 |
+
* removes style property from element
|
5035 |
+
* @param {Object} style
|
5036 |
+
**/
|
5037 |
+
proto._removeStyles = function( style ) {
|
5038 |
+
// clean up transition styles
|
5039 |
+
var cleanStyle = {};
|
5040 |
+
for ( var prop in style ) {
|
5041 |
+
cleanStyle[ prop ] = '';
|
5042 |
+
}
|
5043 |
+
this.css( cleanStyle );
|
5044 |
};
|
5045 |
|
5046 |
+
var cleanTransitionStyle = {
|
5047 |
+
transitionProperty: '',
|
5048 |
+
transitionDuration: '',
|
5049 |
+
transitionDelay: ''
|
5050 |
+
};
|
5051 |
|
5052 |
+
proto.removeTransitionStyles = function() {
|
5053 |
+
// remove transition
|
5054 |
+
this.css( cleanTransitionStyle );
|
5055 |
+
};
|
5056 |
|
5057 |
+
// ----- stagger ----- //
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5058 |
|
5059 |
+
proto.stagger = function( delay ) {
|
5060 |
+
delay = isNaN( delay ) ? 0 : delay;
|
5061 |
+
this.staggerDelay = delay + 'ms';
|
5062 |
+
};
|
5063 |
|
5064 |
+
// ----- show/hide/remove ----- //
|
5065 |
|
5066 |
+
// remove element from DOM
|
5067 |
+
proto.removeElem = function() {
|
5068 |
+
this.element.parentNode.removeChild( this.element );
|
5069 |
+
// remove display: none
|
5070 |
+
this.css({ display: '' });
|
5071 |
+
this.emitEvent( 'remove', [ this ] );
|
5072 |
+
};
|
5073 |
|
5074 |
+
proto.remove = function() {
|
5075 |
+
// just remove element if no transition support or no transition
|
5076 |
+
if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) {
|
5077 |
+
this.removeElem();
|
5078 |
+
return;
|
5079 |
+
}
|
5080 |
|
5081 |
+
// start transition
|
5082 |
+
this.once( 'transitionEnd', function() {
|
5083 |
+
this.removeElem();
|
5084 |
+
});
|
5085 |
+
this.hide();
|
5086 |
+
};
|
5087 |
|
5088 |
+
proto.reveal = function() {
|
5089 |
+
delete this.isHidden;
|
5090 |
+
// remove display: none
|
5091 |
+
this.css({ display: '' });
|
5092 |
|
5093 |
+
var options = this.layout.options;
|
|
|
|
|
|
|
5094 |
|
5095 |
+
var onTransitionEnd = {};
|
5096 |
+
var transitionEndProperty = this.getHideRevealTransitionEndProperty('visibleStyle');
|
5097 |
+
onTransitionEnd[ transitionEndProperty ] = this.onRevealTransitionEnd;
|
5098 |
+
|
5099 |
+
this.transition({
|
5100 |
+
from: options.hiddenStyle,
|
5101 |
+
to: options.visibleStyle,
|
5102 |
+
isCleaning: true,
|
5103 |
+
onTransitionEnd: onTransitionEnd
|
5104 |
+
});
|
5105 |
};
|
5106 |
|
5107 |
+
proto.onRevealTransitionEnd = function() {
|
5108 |
+
// check if still visible
|
5109 |
+
// during transition, item may have been hidden
|
5110 |
+
if ( !this.isHidden ) {
|
5111 |
+
this.emitEvent('reveal');
|
5112 |
}
|
5113 |
+
};
|
5114 |
|
5115 |
+
/**
|
5116 |
+
* get style property use for hide/reveal transition end
|
5117 |
+
* @param {String} styleProperty - hiddenStyle/visibleStyle
|
5118 |
+
* @returns {String}
|
5119 |
+
*/
|
5120 |
+
proto.getHideRevealTransitionEndProperty = function( styleProperty ) {
|
5121 |
+
var optionStyle = this.layout.options[ styleProperty ];
|
5122 |
+
// use opacity
|
5123 |
+
if ( optionStyle.opacity ) {
|
5124 |
+
return 'opacity';
|
5125 |
+
}
|
5126 |
+
// get first property
|
5127 |
+
for ( var prop in optionStyle ) {
|
5128 |
+
return prop;
|
5129 |
+
}
|
5130 |
+
};
|
5131 |
|
5132 |
+
proto.hide = function() {
|
5133 |
+
// set flag
|
5134 |
+
this.isHidden = true;
|
5135 |
+
// remove display: none
|
5136 |
+
this.css({ display: '' });
|
5137 |
|
5138 |
+
var options = this.layout.options;
|
5139 |
|
5140 |
+
var onTransitionEnd = {};
|
5141 |
+
var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle');
|
5142 |
+
onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd;
|
5143 |
+
|
5144 |
+
this.transition({
|
5145 |
+
from: options.visibleStyle,
|
5146 |
+
to: options.hiddenStyle,
|
5147 |
+
// keep hidden stuff hidden
|
5148 |
+
isCleaning: true,
|
5149 |
+
onTransitionEnd: onTransitionEnd
|
5150 |
+
});
|
5151 |
};
|
5152 |
|
5153 |
+
proto.onHideTransitionEnd = function() {
|
5154 |
+
// check if still hidden
|
5155 |
+
// during transition, item may have been un-hidden
|
5156 |
+
if ( this.isHidden ) {
|
5157 |
+
this.css({ display: 'none' });
|
5158 |
+
this.emitEvent('hide');
|
|
|
|
|
|
|
|
|
|
|
5159 |
}
|
5160 |
+
};
|
|
|
|
|
|
|
|
|
|
|
5161 |
|
5162 |
+
proto.destroy = function() {
|
5163 |
+
this.css({
|
5164 |
+
position: '',
|
5165 |
+
left: '',
|
5166 |
+
right: '',
|
5167 |
+
top: '',
|
5168 |
+
bottom: '',
|
5169 |
+
transition: '',
|
5170 |
+
transform: ''
|
5171 |
+
});
|
5172 |
+
};
|
5173 |
|
5174 |
+
return Item;
|
5175 |
|
5176 |
}));
|
5177 |
|
5178 |
|
5179 |
/***/ }),
|
5180 |
|
5181 |
+
/***/ "./node_modules/outlayer/outlayer.js":
|
5182 |
+
/*!*******************************************!*\
|
5183 |
+
!*** ./node_modules/outlayer/outlayer.js ***!
|
5184 |
+
\*******************************************/
|
5185 |
/*! no static exports found */
|
5186 |
+
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
5187 |
|
5188 |
+
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
5189 |
+
* Outlayer v2.1.1
|
5190 |
+
* the brains and guts of a layout library
|
5191 |
+
* MIT license
|
5192 |
+
*/
|
5193 |
|
5194 |
+
( function( window, factory ) {
|
5195 |
+
'use strict';
|
5196 |
+
// universal module definition
|
5197 |
+
/* jshint strict: false */ /* globals define, module, require */
|
5198 |
+
if ( true ) {
|
5199 |
+
// AMD - RequireJS
|
5200 |
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
|
5201 |
+
__webpack_require__(/*! ev-emitter/ev-emitter */ "./node_modules/ev-emitter/ev-emitter.js"),
|
5202 |
+
__webpack_require__(/*! get-size/get-size */ "./node_modules/get-size/get-size.js"),
|
5203 |
+
__webpack_require__(/*! fizzy-ui-utils/utils */ "./node_modules/fizzy-ui-utils/utils.js"),
|
5204 |
+
__webpack_require__(/*! ./item */ "./node_modules/outlayer/item.js")
|
5205 |
+
], __WEBPACK_AMD_DEFINE_RESULT__ = (function( EvEmitter, getSize, utils, Item ) {
|
5206 |
+
return factory( window, EvEmitter, getSize, utils, Item);
|
5207 |
+
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
5208 |
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
5209 |
+
} else {}
|
5210 |
|
5211 |
+
}( window, function factory( window, EvEmitter, getSize, utils, Item ) {
|
5212 |
+
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5213 |
|
5214 |
+
// ----- vars ----- //
|
5215 |
|
5216 |
+
var console = window.console;
|
5217 |
+
var jQuery = window.jQuery;
|
5218 |
+
var noop = function() {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5219 |
|
5220 |
+
// -------------------------- Outlayer -------------------------- //
|
5221 |
|
5222 |
+
// globally unique identifiers
|
5223 |
+
var GUID = 0;
|
5224 |
+
// internal store of all Outlayer intances
|
5225 |
+
var instances = {};
|
5226 |
|
|
|
|
|
|
|
|
|
|
|
5227 |
|
5228 |
+
/**
|
5229 |
+
* @param {Element, String} element
|
5230 |
+
* @param {Object} options
|
5231 |
+
* @constructor
|
5232 |
+
*/
|
5233 |
+
function Outlayer( element, options ) {
|
5234 |
+
var queryElement = utils.getQueryElement( element );
|
5235 |
+
if ( !queryElement ) {
|
5236 |
+
if ( console ) {
|
5237 |
+
console.error( 'Bad element for ' + this.constructor.namespace +
|
5238 |
+
': ' + ( queryElement || element ) );
|
|
|
5239 |
}
|
5240 |
+
return;
|
5241 |
+
}
|
5242 |
+
this.element = queryElement;
|
5243 |
+
// add jQuery
|
5244 |
+
if ( jQuery ) {
|
5245 |
+
this.$element = jQuery( this.element );
|
5246 |
+
}
|
5247 |
|
5248 |
+
// options
|
5249 |
+
this.options = utils.extend( {}, this.constructor.defaults );
|
5250 |
+
this.option( options );
|
|
|
|
|
|
|
5251 |
|
5252 |
+
// add id for Outlayer.getFromElement
|
5253 |
+
var id = ++GUID;
|
5254 |
+
this.element.outlayerGUID = id; // expando
|
5255 |
+
instances[ id ] = this; // associate via id
|
5256 |
+
|
5257 |
+
// kick it off
|
5258 |
+
this._create();
|
5259 |
+
|
5260 |
+
var isInitLayout = this._getOption('initLayout');
|
5261 |
+
if ( isInitLayout ) {
|
5262 |
+
this.layout();
|
5263 |
+
}
|
|
|
|
|
|
|
5264 |
}
|
5265 |
|
5266 |
+
// settings are for internal use only
|
5267 |
+
Outlayer.namespace = 'outlayer';
|
5268 |
+
Outlayer.Item = Item;
|
5269 |
+
|
5270 |
+
// default options
|
5271 |
+
Outlayer.defaults = {
|
5272 |
+
containerStyle: {
|
5273 |
+
position: 'relative'
|
5274 |
+
},
|
5275 |
+
initLayout: true,
|
5276 |
+
originLeft: true,
|
5277 |
+
originTop: true,
|
5278 |
+
resize: true,
|
5279 |
+
resizeContainer: true,
|
5280 |
+
// item options
|
5281 |
+
transitionDuration: '0.4s',
|
5282 |
+
hiddenStyle: {
|
5283 |
+
opacity: 0,
|
5284 |
+
transform: 'scale(0.001)'
|
5285 |
+
},
|
5286 |
+
visibleStyle: {
|
5287 |
+
opacity: 1,
|
5288 |
+
transform: 'scale(1)'
|
5289 |
+
}
|
5290 |
};
|
5291 |
|
5292 |
+
var proto = Outlayer.prototype;
|
5293 |
+
// inherit EvEmitter
|
5294 |
+
utils.extend( proto, EvEmitter.prototype );
|
5295 |
+
|
5296 |
+
/**
|
5297 |
+
* set options
|
5298 |
+
* @param {Object} opts
|
5299 |
+
*/
|
5300 |
+
proto.option = function( opts ) {
|
5301 |
+
utils.extend( this.options, opts );
|
5302 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
5303 |
|
5304 |
+
/**
|
5305 |
+
* get backwards compatible option value, check old name
|
5306 |
+
*/
|
5307 |
+
proto._getOption = function( option ) {
|
5308 |
+
var oldOption = this.constructor.compatOptions[ option ];
|
5309 |
+
return oldOption && this.options[ oldOption ] !== undefined ?
|
5310 |
+
this.options[ oldOption ] : this.options[ option ];
|
5311 |
+
};
|
5312 |
|
5313 |
+
Outlayer.compatOptions = {
|
5314 |
+
// currentName: oldName
|
5315 |
+
initLayout: 'isInitLayout',
|
5316 |
+
horizontal: 'isHorizontal',
|
5317 |
+
layoutInstant: 'isLayoutInstant',
|
5318 |
+
originLeft: 'isOriginLeft',
|
5319 |
+
originTop: 'isOriginTop',
|
5320 |
+
resize: 'isResizeBound',
|
5321 |
+
resizeContainer: 'isResizingContainer'
|
5322 |
+
};
|
5323 |
|
5324 |
+
proto._create = function() {
|
5325 |
+
// get items from children
|
5326 |
+
this.reloadItems();
|
5327 |
+
// elements that affect layout, but are not laid out
|
5328 |
+
this.stamps = [];
|
5329 |
+
this.stamp( this.options.stamp );
|
5330 |
+
// set container style
|
5331 |
+
utils.extend( this.element.style, this.options.containerStyle );
|
5332 |
|
5333 |
+
// bind resize method
|
5334 |
+
var canBindResize = this._getOption('resize');
|
5335 |
+
if ( canBindResize ) {
|
5336 |
+
this.bindResize();
|
5337 |
+
}
|
5338 |
};
|
5339 |
|
5340 |
+
// goes through all children again and gets bricks in proper order
|
5341 |
+
proto.reloadItems = function() {
|
5342 |
+
// collection of item elements
|
5343 |
+
this.items = this._itemize( this.element.children );
|
5344 |
};
|
|
|
5345 |
|
5346 |
|
5347 |
+
/**
|
5348 |
+
* turn elements into Outlayer.Items to be used in layout
|
5349 |
+
* @param {Array or NodeList or HTMLElement} elems
|
5350 |
+
* @returns {Array} items - collection of new Outlayer Items
|
5351 |
+
*/
|
5352 |
+
proto._itemize = function( elems ) {
|
5353 |
|
5354 |
+
var itemElems = this._filterFindItemElements( elems );
|
5355 |
+
var Item = this.constructor.Item;
|
|
|
|
|
|
|
|
|
5356 |
|
5357 |
+
// create new Outlayer Items for collection
|
5358 |
+
var items = [];
|
5359 |
+
for ( var i=0; i < itemElems.length; i++ ) {
|
5360 |
+
var elem = itemElems[i];
|
5361 |
+
var item = new Item( elem, this );
|
5362 |
+
items.push( item );
|
5363 |
+
}
|
|
|
|
|
5364 |
|
5365 |
+
return items;
|
5366 |
+
};
|
5367 |
|
5368 |
+
/**
|
5369 |
+
* get item elements to be used in layout
|
5370 |
+
* @param {Array or NodeList or HTMLElement} elems
|
5371 |
+
* @returns {Array} items - item elements
|
5372 |
+
*/
|
5373 |
+
proto._filterFindItemElements = function( elems ) {
|
5374 |
+
return utils.filterFindElements( elems, this.options.itemSelector );
|
5375 |
+
};
|
5376 |
|
5377 |
+
/**
|
5378 |
+
* getter method for getting item elements
|
5379 |
+
* @returns {Array} elems - collection of item elements
|
5380 |
+
*/
|
5381 |
+
proto.getItemElements = function() {
|
5382 |
+
return this.items.map( function( item ) {
|
5383 |
+
return item.element;
|
5384 |
+
});
|
5385 |
+
};
|
5386 |
|
5387 |
+
// ----- init & layout ----- //
|
|
|
5388 |
|
5389 |
+
/**
|
5390 |
+
* lays out all items
|
5391 |
+
*/
|
5392 |
+
proto.layout = function() {
|
5393 |
+
this._resetLayout();
|
5394 |
+
this._manageStamps();
|
5395 |
|
5396 |
+
// don't animate first layout
|
5397 |
+
var layoutInstant = this._getOption('layoutInstant');
|
5398 |
+
var isInstant = layoutInstant !== undefined ?
|
5399 |
+
layoutInstant : !this._isLayoutInited;
|
5400 |
+
this.layoutItems( this.items, isInstant );
|
5401 |
|
5402 |
+
// flag for initalized
|
5403 |
+
this._isLayoutInited = true;
|
5404 |
+
};
|
5405 |
|
5406 |
+
// _init is alias for layout
|
5407 |
+
proto._init = proto.layout;
|
5408 |
|
5409 |
+
/**
|
5410 |
+
* logic before any new layout
|
5411 |
+
*/
|
5412 |
+
proto._resetLayout = function() {
|
5413 |
+
this.getSize();
|
5414 |
+
};
|
5415 |
|
|
|
|
|
|
|
|
|
5416 |
|
5417 |
+
proto.getSize = function() {
|
5418 |
+
this.size = getSize( this.element );
|
5419 |
+
};
|
|
|
|
|
5420 |
|
5421 |
+
/**
|
5422 |
+
* get measurement from option, for columnWidth, rowHeight, gutter
|
5423 |
+
* if option is String -> get element from selector string, & get size of element
|
5424 |
+
* if option is Element -> get size of element
|
5425 |
+
* else use option as a number
|
5426 |
+
*
|
5427 |
+
* @param {String} measurement
|
5428 |
+
* @param {String} size - width or height
|
5429 |
+
* @private
|
5430 |
+
*/
|
5431 |
+
proto._getMeasurement = function( measurement, size ) {
|
5432 |
+
var option = this.options[ measurement ];
|
5433 |
+
var elem;
|
5434 |
+
if ( !option ) {
|
5435 |
+
// default to 0
|
5436 |
+
this[ measurement ] = 0;
|
5437 |
+
} else {
|
5438 |
+
// use option as an element
|
5439 |
+
if ( typeof option == 'string' ) {
|
5440 |
+
elem = this.element.querySelector( option );
|
5441 |
+
} else if ( option instanceof HTMLElement ) {
|
5442 |
+
elem = option;
|
5443 |
}
|
5444 |
+
// use size of element, if element
|
5445 |
+
this[ measurement ] = elem ? getSize( elem )[ size ] : option;
|
5446 |
}
|
5447 |
+
};
|
5448 |
|
5449 |
+
/**
|
5450 |
+
* layout a collection of item elements
|
5451 |
+
* @api public
|
5452 |
+
*/
|
5453 |
+
proto.layoutItems = function( items, isInstant ) {
|
5454 |
+
items = this._getItemsForLayout( items );
|
5455 |
|
5456 |
+
this._layoutItems( items, isInstant );
|
|
|
|
|
|
|
5457 |
|
5458 |
+
this._postLayout();
|
5459 |
+
};
|
|
|
5460 |
|
5461 |
+
/**
|
5462 |
+
* get the items to be laid out
|
5463 |
+
* you may want to skip over some items
|
5464 |
+
* @param {Array} items
|
5465 |
+
* @returns {Array} items
|
5466 |
+
*/
|
5467 |
+
proto._getItemsForLayout = function( items ) {
|
5468 |
+
return items.filter( function( item ) {
|
5469 |
+
return !item.isIgnored;
|
5470 |
+
});
|
5471 |
+
};
|
5472 |
|
5473 |
+
/**
|
5474 |
+
* layout items
|
5475 |
+
* @param {Array} items
|
5476 |
+
* @param {Boolean} isInstant
|
5477 |
+
*/
|
5478 |
+
proto._layoutItems = function( items, isInstant ) {
|
5479 |
+
this._emitCompleteOnItems( 'layout', items );
|
5480 |
+
|
5481 |
+
if ( !items || !items.length ) {
|
5482 |
+
// no items, emit event with empty array
|
5483 |
+
return;
|
5484 |
}
|
|
|
5485 |
|
5486 |
+
var queue = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5487 |
|
5488 |
+
items.forEach( function( item ) {
|
5489 |
+
// get x/y object from method
|
5490 |
+
var position = this._getItemLayoutPosition( item );
|
5491 |
+
// enqueue
|
5492 |
+
position.item = item;
|
5493 |
+
position.isInstant = isInstant || item.isLayoutInstant;
|
5494 |
+
queue.push( position );
|
5495 |
+
}, this );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5496 |
|
5497 |
+
this._processLayoutQueue( queue );
|
5498 |
+
};
|
|
|
|
|
5499 |
|
5500 |
+
/**
|
5501 |
+
* get item layout position
|
5502 |
+
* @param {Outlayer.Item} item
|
5503 |
+
* @returns {Object} x and y position
|
5504 |
+
*/
|
5505 |
+
proto._getItemLayoutPosition = function( /* item */ ) {
|
5506 |
+
return {
|
5507 |
+
x: 0,
|
5508 |
+
y: 0
|
5509 |
+
};
|
5510 |
+
};
|
5511 |
|
5512 |
+
/**
|
5513 |
+
* iterate over array and position each item
|
5514 |
+
* Reason being - separating this logic prevents 'layout invalidation'
|
5515 |
+
* thx @paul_irish
|
5516 |
+
* @param {Array} queue
|
5517 |
+
*/
|
5518 |
+
proto._processLayoutQueue = function( queue ) {
|
5519 |
+
this.updateStagger();
|
5520 |
+
queue.forEach( function( obj, i ) {
|
5521 |
+
this._positionItem( obj.item, obj.x, obj.y, obj.isInstant, i );
|
5522 |
+
}, this );
|
5523 |
+
};
|
5524 |
|
5525 |
+
// set stagger from option in milliseconds number
|
5526 |
+
proto.updateStagger = function() {
|
5527 |
+
var stagger = this.options.stagger;
|
5528 |
+
if ( stagger === null || stagger === undefined ) {
|
5529 |
+
this.stagger = 0;
|
5530 |
+
return;
|
5531 |
}
|
5532 |
+
this.stagger = getMilliseconds( stagger );
|
5533 |
+
return this.stagger;
|
5534 |
+
};
|
5535 |
|
5536 |
+
/**
|
5537 |
+
* Sets position of item in DOM
|
5538 |
+
* @param {Outlayer.Item} item
|
5539 |
+
* @param {Number} x - horizontal position
|
5540 |
+
* @param {Number} y - vertical position
|
5541 |
+
* @param {Boolean} isInstant - disables transitions
|
5542 |
+
*/
|
5543 |
+
proto._positionItem = function( item, x, y, isInstant, i ) {
|
5544 |
+
if ( isInstant ) {
|
5545 |
+
// if not transition, just set CSS
|
5546 |
+
item.goTo( x, y );
|
5547 |
+
} else {
|
5548 |
+
item.stagger( i * this.stagger );
|
5549 |
+
item.moveTo( x, y );
|
5550 |
}
|
5551 |
+
};
|
5552 |
|
5553 |
+
/**
|
5554 |
+
* Any logic you want to do after each layout,
|
5555 |
+
* i.e. size the container
|
5556 |
+
*/
|
5557 |
+
proto._postLayout = function() {
|
5558 |
+
this.resizeContainer();
|
5559 |
+
};
|
5560 |
+
|
5561 |
+
proto.resizeContainer = function() {
|
5562 |
+
var isResizingContainer = this._getOption('resizeContainer');
|
5563 |
+
if ( !isResizingContainer ) {
|
5564 |
+
return;
|
5565 |
+
}
|
5566 |
+
var size = this._getContainerSize();
|
5567 |
+
if ( size ) {
|
5568 |
+
this._setContainerMeasure( size.width, true );
|
5569 |
+
this._setContainerMeasure( size.height, false );
|
5570 |
}
|
5571 |
+
};
|
5572 |
|
5573 |
+
/**
|
5574 |
+
* Sets width or height of container if returned
|
5575 |
+
* @returns {Object} size
|
5576 |
+
* @param {Number} width
|
5577 |
+
* @param {Number} height
|
5578 |
+
*/
|
5579 |
+
proto._getContainerSize = noop;
|
5580 |
|
5581 |
+
/**
|
5582 |
+
* @param {Number} measure - size of width or height
|
5583 |
+
* @param {Boolean} isWidth
|
5584 |
+
*/
|
5585 |
+
proto._setContainerMeasure = function( measure, isWidth ) {
|
5586 |
+
if ( measure === undefined ) {
|
5587 |
+
return;
|
5588 |
+
}
|
5589 |
|
5590 |
+
var elemSize = this.size;
|
5591 |
+
// add padding and border width if border box
|
5592 |
+
if ( elemSize.isBorderBox ) {
|
5593 |
+
measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight +
|
5594 |
+
elemSize.borderLeftWidth + elemSize.borderRightWidth :
|
5595 |
+
elemSize.paddingBottom + elemSize.paddingTop +
|
5596 |
+
elemSize.borderTopWidth + elemSize.borderBottomWidth;
|
5597 |
+
}
|
5598 |
|
5599 |
+
measure = Math.max( measure, 0 );
|
5600 |
+
this.element.style[ isWidth ? 'width' : 'height' ] = measure + 'px';
|
5601 |
+
};
|
5602 |
|
5603 |
+
/**
|
5604 |
+
* emit eventComplete on a collection of items events
|
5605 |
+
* @param {String} eventName
|
5606 |
+
* @param {Array} items - Outlayer.Items
|
5607 |
+
*/
|
5608 |
+
proto._emitCompleteOnItems = function( eventName, items ) {
|
5609 |
+
var _this = this;
|
5610 |
+
function onComplete() {
|
5611 |
+
_this.dispatchEvent( eventName + 'Complete', null, [ items ] );
|
5612 |
+
}
|
5613 |
|
5614 |
+
var count = items.length;
|
5615 |
+
if ( !items || !count ) {
|
5616 |
+
onComplete();
|
5617 |
+
return;
|
5618 |
}
|
5619 |
|
5620 |
+
var doneCount = 0;
|
5621 |
+
function tick() {
|
5622 |
+
doneCount++;
|
5623 |
+
if ( doneCount == count ) {
|
5624 |
+
onComplete();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5625 |
}
|
5626 |
}
|
5627 |
|
5628 |
+
// bind callback
|
5629 |
+
items.forEach( function( item ) {
|
5630 |
+
item.once( eventName, tick );
|
5631 |
+
});
|
5632 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5633 |
|
5634 |
+
/**
|
5635 |
+
* emits events via EvEmitter and jQuery events
|
5636 |
+
* @param {String} type - name of event
|
5637 |
+
* @param {Event} event - original event
|
5638 |
+
* @param {Array} args - extra arguments
|
5639 |
+
*/
|
5640 |
+
proto.dispatchEvent = function( type, event, args ) {
|
5641 |
+
// add original event to arguments
|
5642 |
+
var emitArgs = event ? [ event ].concat( args ) : args;
|
5643 |
+
this.emitEvent( type, emitArgs );
|
5644 |
|
5645 |
+
if ( jQuery ) {
|
5646 |
+
// set this.$element
|
5647 |
+
this.$element = this.$element || jQuery( this.element );
|
5648 |
+
if ( event ) {
|
5649 |
+
// create jQuery event
|
5650 |
+
var $event = jQuery.Event( event );
|
5651 |
+
$event.type = type;
|
5652 |
+
this.$element.trigger( $event, args );
|
5653 |
+
} else {
|
5654 |
+
// just trigger with type if no event available
|
5655 |
+
this.$element.trigger( type, args );
|
5656 |
}
|
|
|
|
|
5657 |
}
|
5658 |
+
};
|
|
|
|
|
|
|
5659 |
|
5660 |
+
// -------------------------- ignore & stamps -------------------------- //
|
|
|
|
|
|
|
|
|
|
|
|
|
5661 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5662 |
|
5663 |
+
/**
|
5664 |
+
* keep item in collection, but do not lay it out
|
5665 |
+
* ignored items do not get skipped in layout
|
5666 |
+
* @param {Element} elem
|
5667 |
+
*/
|
5668 |
+
proto.ignore = function( elem ) {
|
5669 |
+
var item = this.getItem( elem );
|
5670 |
+
if ( item ) {
|
5671 |
+
item.isIgnored = true;
|
5672 |
}
|
5673 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5674 |
|
5675 |
+
/**
|
5676 |
+
* return item to layout collection
|
5677 |
+
* @param {Element} elem
|
5678 |
+
*/
|
5679 |
+
proto.unignore = function( elem ) {
|
5680 |
+
var item = this.getItem( elem );
|
5681 |
+
if ( item ) {
|
5682 |
+
delete item.isIgnored;
|
5683 |
}
|
5684 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5685 |
|
5686 |
+
/**
|
5687 |
+
* adds elements to stamps
|
5688 |
+
* @param {NodeList, Array, Element, or String} elems
|
5689 |
+
*/
|
5690 |
+
proto.stamp = function( elems ) {
|
5691 |
+
elems = this._find( elems );
|
5692 |
+
if ( !elems ) {
|
5693 |
+
return;
|
5694 |
}
|
5695 |
|
5696 |
+
this.stamps = this.stamps.concat( elems );
|
5697 |
+
// ignore
|
5698 |
+
elems.forEach( this.ignore, this );
|
5699 |
+
};
|
5700 |
|
5701 |
+
/**
|
5702 |
+
* removes elements to stamps
|
5703 |
+
* @param {NodeList, Array, or Element} elems
|
5704 |
+
*/
|
5705 |
+
proto.unstamp = function( elems ) {
|
5706 |
+
elems = this._find( elems );
|
5707 |
+
if ( !elems ){
|
5708 |
+
return;
|
5709 |
}
|
5710 |
|
5711 |
+
elems.forEach( function( elem ) {
|
5712 |
+
// filter out removed stamp elements
|
5713 |
+
utils.removeFrom( this.stamps, elem );
|
5714 |
+
this.unignore( elem );
|
5715 |
+
}, this );
|
5716 |
+
};
|
|
|
|
|
|
|
|
|
5717 |
|
5718 |
+
/**
|
5719 |
+
* finds child elements
|
5720 |
+
* @param {NodeList, Array, Element, or String} elems
|
5721 |
+
* @returns {Array} elems
|
5722 |
+
*/
|
5723 |
+
proto._find = function( elems ) {
|
5724 |
+
if ( !elems ) {
|
5725 |
+
return;
|
5726 |
}
|
5727 |
+
// if string, use argument as selector string
|
5728 |
+
if ( typeof elems == 'string' ) {
|
5729 |
+
elems = this.element.querySelectorAll( elems );
|
5730 |
+
}
|
5731 |
+
elems = utils.makeArray( elems );
|
5732 |
+
return elems;
|
5733 |
+
};
|
5734 |
|
5735 |
+
proto._manageStamps = function() {
|
5736 |
+
if ( !this.stamps || !this.stamps.length ) {
|
5737 |
+
return;
|
5738 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5739 |
|
5740 |
+
this._getBoundingRect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5741 |
|
5742 |
+
this.stamps.forEach( this._manageStamp, this );
|
5743 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5744 |
|
5745 |
+
// update boundingLeft / Top
|
5746 |
+
proto._getBoundingRect = function() {
|
5747 |
+
// get bounding rect for container element
|
5748 |
+
var boundingRect = this.element.getBoundingClientRect();
|
5749 |
+
var size = this.size;
|
5750 |
+
this._boundingRect = {
|
5751 |
+
left: boundingRect.left + size.paddingLeft + size.borderLeftWidth,
|
5752 |
+
top: boundingRect.top + size.paddingTop + size.borderTopWidth,
|
5753 |
+
right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ),
|
5754 |
+
bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth )
|
5755 |
+
};
|
5756 |
+
};
|
5757 |
|
5758 |
+
/**
|
5759 |
+
* @param {Element} stamp
|
5760 |
+
**/
|
5761 |
+
proto._manageStamp = noop;
|
|
|
5762 |
|
5763 |
+
/**
|
5764 |
+
* get x/y position of element relative to container element
|
5765 |
+
* @param {Element} elem
|
5766 |
+
* @returns {Object} offset - has left, top, right, bottom
|
5767 |
+
*/
|
5768 |
+
proto._getElementOffset = function( elem ) {
|
5769 |
+
var boundingRect = elem.getBoundingClientRect();
|
5770 |
+
var thisRect = this._boundingRect;
|
5771 |
+
var size = getSize( elem );
|
5772 |
+
var offset = {
|
5773 |
+
left: boundingRect.left - thisRect.left - size.marginLeft,
|
5774 |
+
top: boundingRect.top - thisRect.top - size.marginTop,
|
5775 |
+
right: thisRect.right - boundingRect.right - size.marginRight,
|
5776 |
+
bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom
|
5777 |
+
};
|
5778 |
+
return offset;
|
5779 |
+
};
|
5780 |
|
5781 |
+
// -------------------------- resize -------------------------- //
|
|
|
|
|
|
|
5782 |
|
5783 |
+
// enable event handlers for listeners
|
5784 |
+
// i.e. resize -> onresize
|
5785 |
+
proto.handleEvent = utils.handleEvent;
|
|
|
|
|
|
|
5786 |
|
5787 |
+
/**
|
5788 |
+
* Bind layout to window resizing
|
5789 |
+
*/
|
5790 |
+
proto.bindResize = function() {
|
5791 |
+
window.addEventListener( 'resize', this );
|
5792 |
+
this.isResizeBound = true;
|
5793 |
+
};
|
5794 |
|
5795 |
+
/**
|
5796 |
+
* Unbind layout to window resizing
|
5797 |
+
*/
|
5798 |
+
proto.unbindResize = function() {
|
5799 |
+
window.removeEventListener( 'resize', this );
|
5800 |
+
this.isResizeBound = false;
|
5801 |
+
};
|
5802 |
|
5803 |
+
proto.onresize = function() {
|
5804 |
+
this.resize();
|
5805 |
+
};
|
5806 |
|
5807 |
+
utils.debounceMethod( Outlayer, 'onresize', 100 );
|
|
|
5808 |
|
5809 |
+
proto.resize = function() {
|
5810 |
+
// don't trigger if size did not change
|
5811 |
+
// or if resize was unbound. See #9
|
5812 |
+
if ( !this.isResizeBound || !this.needsResizeLayout() ) {
|
5813 |
+
return;
|
5814 |
}
|
5815 |
|
5816 |
+
this.layout();
|
5817 |
+
};
|
|
|
|
|
|
|
|
|
|
|
5818 |
|
5819 |
+
/**
|
5820 |
+
* check if layout is needed post layout
|
5821 |
+
* @returns Boolean
|
5822 |
+
*/
|
5823 |
+
proto.needsResizeLayout = function() {
|
5824 |
+
var size = getSize( this.element );
|
5825 |
+
// check that this.size and size are there
|
5826 |
+
// IE8 triggers resize on body size change, so they might not be
|
5827 |
+
var hasSizes = this.size && size;
|
5828 |
+
return hasSizes && size.innerWidth !== this.size.innerWidth;
|
5829 |
+
};
|
5830 |
|
5831 |
+
// -------------------------- methods -------------------------- //
|
5832 |
|
5833 |
+
/**
|
5834 |
+
* add items to Outlayer instance
|
5835 |
+
* @param {Array or NodeList or Element} elems
|
5836 |
+
* @returns {Array} items - Outlayer.Items
|
5837 |
+
**/
|
5838 |
+
proto.addItems = function( elems ) {
|
5839 |
+
var items = this._itemize( elems );
|
5840 |
+
// add items to collection
|
5841 |
+
if ( items.length ) {
|
5842 |
+
this.items = this.items.concat( items );
|
5843 |
}
|
5844 |
+
return items;
|
5845 |
+
};
|
5846 |
|
5847 |
+
/**
|
5848 |
+
* Layout newly-appended item elements
|
5849 |
+
* @param {Array or NodeList or Element} elems
|
5850 |
+
*/
|
5851 |
+
proto.appended = function( elems ) {
|
5852 |
+
var items = this.addItems( elems );
|
5853 |
+
if ( !items.length ) {
|
5854 |
+
return;
|
5855 |
}
|
5856 |
+
// layout and reveal just the new items
|
5857 |
+
this.layoutItems( items, true );
|
5858 |
+
this.reveal( items );
|
5859 |
+
};
|
5860 |
|
5861 |
+
/**
|
5862 |
+
* Layout prepended elements
|
5863 |
+
* @param {Array or NodeList or Element} elems
|
5864 |
+
*/
|
5865 |
+
proto.prepended = function( elems ) {
|
5866 |
+
var items = this._itemize( elems );
|
5867 |
+
if ( !items.length ) {
|
5868 |
+
return;
|
5869 |
}
|
5870 |
+
// add items to beginning of collection
|
5871 |
+
var previousItems = this.items.slice(0);
|
5872 |
+
this.items = items.concat( previousItems );
|
5873 |
+
// start new layout
|
5874 |
+
this._resetLayout();
|
5875 |
+
this._manageStamps();
|
5876 |
+
// layout new stuff without transition
|
5877 |
+
this.layoutItems( items, true );
|
5878 |
+
this.reveal( items );
|
5879 |
+
// layout previous items
|
5880 |
+
this.layoutItems( previousItems );
|
5881 |
+
};
|
5882 |
|
5883 |
+
/**
|
5884 |
+
* reveal a collection of items
|
5885 |
+
* @param {Array of Outlayer.Items} items
|
5886 |
+
*/
|
5887 |
+
proto.reveal = function( items ) {
|
5888 |
+
this._emitCompleteOnItems( 'reveal', items );
|
5889 |
+
if ( !items || !items.length ) {
|
5890 |
+
return;
|
5891 |
}
|
5892 |
+
var stagger = this.updateStagger();
|
5893 |
+
items.forEach( function( item, i ) {
|
5894 |
+
item.stagger( i * stagger );
|
5895 |
+
item.reveal();
|
5896 |
+
});
|
5897 |
+
};
|
5898 |
|
5899 |
+
/**
|
5900 |
+
* hide a collection of items
|
5901 |
+
* @param {Array of Outlayer.Items} items
|
5902 |
+
*/
|
5903 |
+
proto.hide = function( items ) {
|
5904 |
+
this._emitCompleteOnItems( 'hide', items );
|
5905 |
+
if ( !items || !items.length ) {
|
5906 |
+
return;
|
5907 |
+
}
|
5908 |
+
var stagger = this.updateStagger();
|
5909 |
+
items.forEach( function( item, i ) {
|
5910 |
+
item.stagger( i * stagger );
|
5911 |
+
item.hide();
|
5912 |
+
});
|
5913 |
+
};
|
5914 |
|
5915 |
+
/**
|
5916 |
+
* reveal item elements
|
5917 |
+
* @param {Array}, {Element}, {NodeList} items
|
5918 |
+
*/
|
5919 |
+
proto.revealItemElements = function( elems ) {
|
5920 |
+
var items = this.getItems( elems );
|
5921 |
+
this.reveal( items );
|
5922 |
+
};
|
5923 |
|
5924 |
+
/**
|
5925 |
+
* hide item elements
|
5926 |
+
* @param {Array}, {Element}, {NodeList} items
|
5927 |
+
*/
|
5928 |
+
proto.hideItemElements = function( elems ) {
|
5929 |
+
var items = this.getItems( elems );
|
5930 |
+
this.hide( items );
|
5931 |
+
};
|
5932 |
|
5933 |
+
/**
|
5934 |
+
* get Outlayer.Item, given an Element
|
5935 |
+
* @param {Element} elem
|
5936 |
+
* @param {Function} callback
|
5937 |
+
* @returns {Outlayer.Item} item
|
5938 |
+
*/
|
5939 |
+
proto.getItem = function( elem ) {
|
5940 |
+
// loop through items to get the one that matches
|
5941 |
+
for ( var i=0; i < this.items.length; i++ ) {
|
5942 |
+
var item = this.items[i];
|
5943 |
+
if ( item.element == elem ) {
|
5944 |
+
// return item
|
5945 |
+
return item;
|
5946 |
}
|
5947 |
}
|
5948 |
+
};
|
5949 |
|
5950 |
+
/**
|
5951 |
+
* get collection of Outlayer.Items, given Elements
|
5952 |
+
* @param {Array} elems
|
5953 |
+
* @returns {Array} items - Outlayer.Items
|
5954 |
+
*/
|
5955 |
+
proto.getItems = function( elems ) {
|
5956 |
+
elems = utils.makeArray( elems );
|
5957 |
+
var items = [];
|
5958 |
+
elems.forEach( function( elem ) {
|
5959 |
+
var item = this.getItem( elem );
|
5960 |
+
if ( item ) {
|
5961 |
+
items.push( item );
|
5962 |
+
}
|
5963 |
+
}, this );
|
5964 |
|
5965 |
+
return items;
|
5966 |
+
};
|
5967 |
|
5968 |
+
/**
|
5969 |
+
* remove element(s) from instance and DOM
|
5970 |
+
* @param {Array or NodeList or Element} elems
|
5971 |
+
*/
|
5972 |
+
proto.remove = function( elems ) {
|
5973 |
+
var removeItems = this.getItems( elems );
|
5974 |
+
|
5975 |
+
this._emitCompleteOnItems( 'remove', removeItems );
|
5976 |
+
|
5977 |
+
// bail if no items to remove
|
5978 |
+
if ( !removeItems || !removeItems.length ) {
|
5979 |
+
return;
|
5980 |
}
|
|
|
5981 |
|
5982 |
+
removeItems.forEach( function( item ) {
|
5983 |
+
item.remove();
|
5984 |
+
// remove item from collection
|
5985 |
+
utils.removeFrom( this.items, item );
|
5986 |
+
}, this );
|
5987 |
+
};
|
5988 |
|
5989 |
+
// ----- destroy ----- //
|
|
|
|
|
|
|
|
|
5990 |
|
5991 |
+
// remove and disable Outlayer instance
|
5992 |
+
proto.destroy = function() {
|
5993 |
+
// clean up dynamic styles
|
5994 |
+
var style = this.element.style;
|
5995 |
+
style.height = '';
|
5996 |
+
style.position = '';
|
5997 |
+
style.width = '';
|
5998 |
+
// destroy items
|
5999 |
+
this.items.forEach( function( item ) {
|
6000 |
+
item.destroy();
|
6001 |
+
});
|
6002 |
|
6003 |
+
this.unbindResize();
|
|
|
|
|
|
|
6004 |
|
6005 |
+
var id = this.element.outlayerGUID;
|
6006 |
+
delete instances[ id ]; // remove reference to instance by id
|
6007 |
+
delete this.element.outlayerGUID;
|
6008 |
+
// remove data for jQuery
|
6009 |
+
if ( jQuery ) {
|
6010 |
+
jQuery.removeData( this.element, this.constructor.namespace );
|
6011 |
+
}
|
6012 |
|
6013 |
+
};
|
6014 |
|
6015 |
+
// -------------------------- data -------------------------- //
|
|
|
6016 |
|
6017 |
+
/**
|
6018 |
+
* get Outlayer instance from element
|
6019 |
+
* @param {Element} elem
|
6020 |
+
* @returns {Outlayer}
|
6021 |
+
*/
|
6022 |
+
Outlayer.data = function( elem ) {
|
6023 |
+
elem = utils.getQueryElement( elem );
|
6024 |
+
var id = elem && elem.outlayerGUID;
|
6025 |
+
return id && instances[ id ];
|
6026 |
+
};
|
6027 |
|
|
|
6028 |
|
6029 |
+
// -------------------------- create Outlayer class -------------------------- //
|
|
|
|
|
|
|
|
|
|
|
6030 |
|
6031 |
+
/**
|
6032 |
+
* create a layout class
|
6033 |
+
* @param {String} namespace
|
6034 |
+
*/
|
6035 |
+
Outlayer.create = function( namespace, options ) {
|
6036 |
+
// sub-class Outlayer
|
6037 |
+
var Layout = subclass( Outlayer );
|
6038 |
+
// apply new options and compatOptions
|
6039 |
+
Layout.defaults = utils.extend( {}, Outlayer.defaults );
|
6040 |
+
utils.extend( Layout.defaults, options );
|
6041 |
+
Layout.compatOptions = utils.extend( {}, Outlayer.compatOptions );
|
6042 |
|
6043 |
+
Layout.namespace = namespace;
|
|
|
|
|
6044 |
|
6045 |
+
Layout.data = Outlayer.data;
|
6046 |
|
6047 |
+
// sub-class Item
|
6048 |
+
Layout.Item = subclass( Item );
|
|
|
6049 |
|
6050 |
+
// -------------------------- declarative -------------------------- //
|
|
|
6051 |
|
6052 |
+
utils.htmlInit( Layout, namespace );
|
|
|
|
|
6053 |
|
6054 |
+
// -------------------------- jQuery bridge -------------------------- //
|
6055 |
|
6056 |
+
// make into jQuery plugin
|
6057 |
+
if ( jQuery && jQuery.bridget ) {
|
6058 |
+
jQuery.bridget( namespace, Layout );
|
6059 |
}
|
6060 |
|
6061 |
+
return Layout;
|
6062 |
+
};
|
6063 |
|
6064 |
+
function subclass( Parent ) {
|
6065 |
+
function SubClass() {
|
6066 |
+
Parent.apply( this, arguments );
|
6067 |
}
|
6068 |
+
|
6069 |
+
SubClass.prototype = Object.create( Parent.prototype );
|
6070 |
+
SubClass.prototype.constructor = SubClass;
|
6071 |
+
|
6072 |
+
return SubClass;
|
6073 |
}
|
6074 |
|
6075 |
+
// ----- helpers ----- //
|
6076 |
+
|
6077 |
+
// how many milliseconds are in each unit
|
6078 |
+
var msUnits = {
|
6079 |
+
ms: 1,
|
6080 |
+
s: 1000
|
6081 |
+
};
|
6082 |
+
|
6083 |
+
// munge time-like parameter into millisecond number
|
6084 |
+
// '0.4s' -> 40
|
6085 |
+
function getMilliseconds( time ) {
|
6086 |
+
if ( typeof time == 'number' ) {
|
6087 |
+
return time;
|
6088 |
+
}
|
6089 |
+
var matches = time.match( /(^\d*\.?\d*)(\w*)/ );
|
6090 |
+
var num = matches && matches[1];
|
6091 |
+
var unit = matches && matches[2];
|
6092 |
+
if ( !num.length ) {
|
6093 |
+
return 0;
|
6094 |
}
|
6095 |
+
num = parseFloat( num );
|
6096 |
+
var mult = msUnits[ unit ] || 1;
|
6097 |
+
return num * mult;
|
6098 |
}
|
|
|
|
|
|
|
6099 |
|
6100 |
+
// ----- fin ----- //
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6101 |
|
6102 |
+
// back in global
|
6103 |
+
Outlayer.Item = Item;
|
|
|
|
|
6104 |
|
6105 |
+
return Outlayer;
|
|
|
|
|
|
|
6106 |
|
6107 |
+
}));
|
|
|
6108 |
|
|
|
|
|
|
|
|
|
|
|
6109 |
|
6110 |
+
/***/ }),
|
|
|
|
|
|
|
|
|
6111 |
|
6112 |
+
/***/ "./node_modules/process/browser.js":
|
6113 |
+
/*!*****************************************!*\
|
6114 |
+
!*** ./node_modules/process/browser.js ***!
|
6115 |
+
\*****************************************/
|
6116 |
+
/*! no static exports found */
|
6117 |
+
/***/ (function(module, exports) {
|
6118 |
|
6119 |
+
// shim for using process in browser
|
6120 |
+
var process = module.exports = {};
|
|
|
|
|
6121 |
|
6122 |
+
// cached from whatever global is present so that test runners that stub it
|
6123 |
+
// don't break things. But we need to wrap it in a try catch in case it is
|
6124 |
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
6125 |
+
// function because try/catches deoptimize in certain engines.
|
6126 |
|
6127 |
+
var cachedSetTimeout;
|
6128 |
+
var cachedClearTimeout;
|
|
|
6129 |
|
6130 |
+
function defaultSetTimout() {
|
6131 |
+
throw new Error('setTimeout has not been defined');
|
6132 |
+
}
|
6133 |
+
function defaultClearTimeout () {
|
6134 |
+
throw new Error('clearTimeout has not been defined');
|
6135 |
+
}
|
6136 |
+
(function () {
|
6137 |
+
try {
|
6138 |
+
if (typeof setTimeout === 'function') {
|
6139 |
+
cachedSetTimeout = setTimeout;
|
6140 |
+
} else {
|
6141 |
+
cachedSetTimeout = defaultSetTimout;
|
6142 |
+
}
|
6143 |
+
} catch (e) {
|
6144 |
+
cachedSetTimeout = defaultSetTimout;
|
6145 |
+
}
|
6146 |
+
try {
|
6147 |
+
if (typeof clearTimeout === 'function') {
|
6148 |
+
cachedClearTimeout = clearTimeout;
|
6149 |
+
} else {
|
6150 |
+
cachedClearTimeout = defaultClearTimeout;
|
6151 |
+
}
|
6152 |
+
} catch (e) {
|
6153 |
+
cachedClearTimeout = defaultClearTimeout;
|
6154 |
+
}
|
6155 |
+
} ())
|
6156 |
+
function runTimeout(fun) {
|
6157 |
+
if (cachedSetTimeout === setTimeout) {
|
6158 |
+
//normal enviroments in sane situations
|
6159 |
+
return setTimeout(fun, 0);
|
6160 |
+
}
|
6161 |
+
// if setTimeout wasn't available but was latter defined
|
6162 |
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
6163 |
+
cachedSetTimeout = setTimeout;
|
6164 |
+
return setTimeout(fun, 0);
|
6165 |
+
}
|
6166 |
+
try {
|
6167 |
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
6168 |
+
return cachedSetTimeout(fun, 0);
|
6169 |
+
} catch(e){
|
6170 |
+
try {
|
6171 |
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
6172 |
+
return cachedSetTimeout.call(null, fun, 0);
|
6173 |
+
} catch(e){
|
6174 |
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
6175 |
+
return cachedSetTimeout.call(this, fun, 0);
|
6176 |
+
}
|
6177 |
+
}
|
6178 |
|
|
|
|
|
|
|
|
|
6179 |
|
6180 |
+
}
|
6181 |
+
function runClearTimeout(marker) {
|
6182 |
+
if (cachedClearTimeout === clearTimeout) {
|
6183 |
+
//normal enviroments in sane situations
|
6184 |
+
return clearTimeout(marker);
|
6185 |
+
}
|
6186 |
+
// if clearTimeout wasn't available but was latter defined
|
6187 |
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
6188 |
+
cachedClearTimeout = clearTimeout;
|
6189 |
+
return clearTimeout(marker);
|
6190 |
+
}
|
6191 |
+
try {
|
6192 |
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
6193 |
+
return cachedClearTimeout(marker);
|
6194 |
+
} catch (e){
|
6195 |
+
try {
|
6196 |
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
6197 |
+
return cachedClearTimeout.call(null, marker);
|
6198 |
+
} catch (e){
|
6199 |
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
6200 |
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
6201 |
+
return cachedClearTimeout.call(this, marker);
|
6202 |
+
}
|
6203 |
}
|
|
|
6204 |
|
|
|
|
|
|
|
|
|
6205 |
|
|
|
|
|
|
|
6206 |
|
|
|
|
|
6207 |
}
|
6208 |
+
var queue = [];
|
6209 |
+
var draining = false;
|
6210 |
+
var currentQueue;
|
6211 |
+
var queueIndex = -1;
|
6212 |
|
6213 |
+
function cleanUpNextTick() {
|
6214 |
+
if (!draining || !currentQueue) {
|
6215 |
+
return;
|
6216 |
+
}
|
6217 |
+
draining = false;
|
6218 |
+
if (currentQueue.length) {
|
6219 |
+
queue = currentQueue.concat(queue);
|
6220 |
+
} else {
|
6221 |
+
queueIndex = -1;
|
6222 |
+
}
|
6223 |
+
if (queue.length) {
|
6224 |
+
drainQueue();
|
6225 |
+
}
|
6226 |
+
}
|
6227 |
|
6228 |
+
function drainQueue() {
|
6229 |
+
if (draining) {
|
6230 |
+
return;
|
6231 |
+
}
|
6232 |
+
var timeout = runTimeout(cleanUpNextTick);
|
6233 |
+
draining = true;
|
6234 |
|
6235 |
+
var len = queue.length;
|
6236 |
+
while(len) {
|
6237 |
+
currentQueue = queue;
|
6238 |
+
queue = [];
|
6239 |
+
while (++queueIndex < len) {
|
6240 |
+
if (currentQueue) {
|
6241 |
+
currentQueue[queueIndex].run();
|
6242 |
+
}
|
6243 |
+
}
|
6244 |
+
queueIndex = -1;
|
6245 |
+
len = queue.length;
|
6246 |
+
}
|
6247 |
+
currentQueue = null;
|
6248 |
+
draining = false;
|
6249 |
+
runClearTimeout(timeout);
|
6250 |
}
|
6251 |
+
|
6252 |
+
process.nextTick = function (fun) {
|
6253 |
+
var args = new Array(arguments.length - 1);
|
6254 |
+
if (arguments.length > 1) {
|
6255 |
+
for (var i = 1; i < arguments.length; i++) {
|
6256 |
+
args[i - 1] = arguments[i];
|
6257 |
+
}
|
6258 |
+
}
|
6259 |
+
queue.push(new Item(fun, args));
|
6260 |
+
if (queue.length === 1 && !draining) {
|
6261 |
+
runTimeout(drainQueue);
|
6262 |
+
}
|
6263 |
+
};
|
6264 |
+
|
6265 |
+
// v8 likes predictible objects
|
6266 |
+
function Item(fun, array) {
|
6267 |
+
this.fun = fun;
|
6268 |
+
this.array = array;
|
6269 |
}
|
6270 |
+
Item.prototype.run = function () {
|
6271 |
+
this.fun.apply(null, this.array);
|
6272 |
+
};
|
6273 |
+
process.title = 'browser';
|
6274 |
+
process.browser = true;
|
6275 |
+
process.env = {};
|
6276 |
+
process.argv = [];
|
6277 |
+
process.version = ''; // empty string to avoid regexp issues
|
6278 |
+
process.versions = {};
|
6279 |
|
6280 |
+
function noop() {}
|
|
|
|
|
|
|
6281 |
|
6282 |
+
process.on = noop;
|
6283 |
+
process.addListener = noop;
|
6284 |
+
process.once = noop;
|
6285 |
+
process.off = noop;
|
6286 |
+
process.removeListener = noop;
|
6287 |
+
process.removeAllListeners = noop;
|
6288 |
+
process.emit = noop;
|
6289 |
+
process.prependListener = noop;
|
6290 |
+
process.prependOnceListener = noop;
|
6291 |
|
6292 |
+
process.listeners = function (name) { return [] }
|
|
|
|
|
6293 |
|
6294 |
+
process.binding = function (name) {
|
6295 |
+
throw new Error('process.binding is not supported');
|
6296 |
+
};
|
|
|
6297 |
|
6298 |
+
process.cwd = function () { return '/' };
|
6299 |
+
process.chdir = function (dir) {
|
6300 |
+
throw new Error('process.chdir is not supported');
|
6301 |
+
};
|
6302 |
+
process.umask = function() { return 0; };
|
6303 |
|
|
|
|
|
6304 |
|
6305 |
+
/***/ }),
|
6306 |
|
6307 |
+
/***/ "./node_modules/prop-types/checkPropTypes.js":
|
6308 |
+
/*!***************************************************!*\
|
6309 |
+
!*** ./node_modules/prop-types/checkPropTypes.js ***!
|
6310 |
+
\***************************************************/
|
6311 |
+
/*! no static exports found */
|
6312 |
+
/***/ (function(module, exports, __webpack_require__) {
|
6313 |
|
6314 |
+
"use strict";
|
6315 |
+
/**
|
6316 |
+
* Copyright (c) 2013-present, Facebook, Inc.
|
6317 |
+
*
|
6318 |
+
* This source code is licensed under the MIT license found in the
|
6319 |
+
* LICENSE file in the root directory of this source tree.
|
6320 |
+
*/
|
|
|
|
|
|
|
6321 |
|
|
|
|
|
|
|
6322 |
|
|
|
|
|
|
|
|
|
6323 |
|
6324 |
+
var printWarning = function() {};
|
6325 |
|
6326 |
+
if (true) {
|
6327 |
+
var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
|
6328 |
+
var loggedTypeFailures = {};
|
6329 |
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
6330 |
|
6331 |
+
printWarning = function(text) {
|
6332 |
+
var message = 'Warning: ' + text;
|
6333 |
+
if (typeof console !== 'undefined') {
|
6334 |
+
console.error(message);
|
6335 |
+
}
|
6336 |
+
try {
|
6337 |
+
// --- Welcome to debugging React ---
|
6338 |
+
// This error was thrown as a convenience so that you can use this stack
|
6339 |
+
// to find the callsite that caused this warning to fire.
|
6340 |
+
throw new Error(message);
|
6341 |
+
} catch (x) {}
|
6342 |
+
};
|
6343 |
}
|
|
|
|
|
|
|
|
|
6344 |
|
6345 |
+
/**
|
6346 |
+
* Assert that the values match with the type specs.
|
6347 |
+
* Error messages are memorized and will only be shown once.
|
6348 |
+
*
|
6349 |
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
6350 |
+
* @param {object} values Runtime values that need to be type-checked
|
6351 |
+
* @param {string} location e.g. "prop", "context", "child context"
|
6352 |
+
* @param {string} componentName Name of the component for error messages.
|
6353 |
+
* @param {?Function} getStack Returns the component stack.
|
6354 |
+
* @private
|
6355 |
+
*/
|
6356 |
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
6357 |
+
if (true) {
|
6358 |
+
for (var typeSpecName in typeSpecs) {
|
6359 |
+
if (has(typeSpecs, typeSpecName)) {
|
6360 |
+
var error;
|
6361 |
+
// Prop type validation may throw. In case they do, we don't want to
|
6362 |
+
// fail the render phase where it didn't fail before. So we log it.
|
6363 |
+
// After these have been cleaned up, we'll let them throw.
|
6364 |
+
try {
|
6365 |
+
// This is intentionally an invariant that gets caught. It's the same
|
6366 |
+
// behavior as without this statement except with a better message.
|
6367 |
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
6368 |
+
var err = Error(
|
6369 |
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
6370 |
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
6371 |
+
);
|
6372 |
+
err.name = 'Invariant Violation';
|
6373 |
+
throw err;
|
6374 |
+
}
|
6375 |
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
6376 |
+
} catch (ex) {
|
6377 |
+
error = ex;
|
6378 |
+
}
|
6379 |
+
if (error && !(error instanceof Error)) {
|
6380 |
+
printWarning(
|
6381 |
+
(componentName || 'React class') + ': type specification of ' +
|
6382 |
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
6383 |
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
6384 |
+
'You may have forgotten to pass an argument to the type checker ' +
|
6385 |
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
6386 |
+
'shape all require an argument).'
|
6387 |
+
);
|
6388 |
+
}
|
6389 |
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
6390 |
+
// Only monitor this failure once because there tends to be a lot of the
|
6391 |
+
// same error.
|
6392 |
+
loggedTypeFailures[error.message] = true;
|
6393 |
|
6394 |
+
var stack = getStack ? getStack() : '';
|
|
|
|
|
6395 |
|
6396 |
+
printWarning(
|
6397 |
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
6398 |
+
);
|
6399 |
+
}
|
6400 |
+
}
|
6401 |
+
}
|
6402 |
}
|
6403 |
+
}
|
6404 |
|
6405 |
+
/**
|
6406 |
+
* Resets warning cache when testing.
|
6407 |
+
*
|
6408 |
+
* @private
|
6409 |
+
*/
|
6410 |
+
checkPropTypes.resetWarningCache = function() {
|
6411 |
+
if (true) {
|
6412 |
+
loggedTypeFailures = {};
|
6413 |
+
}
|
6414 |
+
}
|
6415 |
|
6416 |
+
module.exports = checkPropTypes;
|
|
|
|
|
6417 |
|
|
|
|
|
|
|
|
|
|
|
6418 |
|
6419 |
+
/***/ }),
|
|
|
|
|
|
|
|
|
|
|
|
|
6420 |
|
6421 |
+
/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js":
|
6422 |
+
/*!************************************************************!*\
|
6423 |
+
!*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***!
|
6424 |
+
\************************************************************/
|
6425 |
+
/*! no static exports found */
|
6426 |
+
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
6427 |
|
6428 |
+
"use strict";
|
6429 |
+
/**
|
6430 |
+
* Copyright (c) 2013-present, Facebook, Inc.
|
6431 |
+
*
|
6432 |
+
* This source code is licensed under the MIT license found in the
|
6433 |
+
* LICENSE file in the root directory of this source tree.
|
6434 |
+
*/
|
6435 |
|
|
|
|
|
|
|
6436 |
|
|
|
6437 |
|
6438 |
+
var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js");
|
6439 |
+
var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
|
|
|
6440 |
|
6441 |
+
var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
|
6442 |
+
var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js");
|
6443 |
|
6444 |
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
6445 |
+
var printWarning = function() {};
|
6446 |
|
6447 |
+
if (true) {
|
6448 |
+
printWarning = function(text) {
|
6449 |
+
var message = 'Warning: ' + text;
|
6450 |
+
if (typeof console !== 'undefined') {
|
6451 |
+
console.error(message);
|
6452 |
}
|
6453 |
+
try {
|
6454 |
+
// --- Welcome to debugging React ---
|
6455 |
+
// This error was thrown as a convenience so that you can use this stack
|
6456 |
+
// to find the callsite that caused this warning to fire.
|
6457 |
+
throw new Error(message);
|
6458 |
+
} catch (x) {}
|
6459 |
+
};
|
6460 |
}
|
6461 |
+
|
6462 |
+
function emptyFunctionThatReturnsNull() {
|
6463 |
+
return null;
|
6464 |
}
|
6465 |
|
6466 |
+
module.exports = function(isValidElement, throwOnDirectAccess) {
|
6467 |
+
/* global Symbol */
|
6468 |
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
6469 |
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6470 |
|
6471 |
+
/**
|
6472 |
+
* Returns the iterator method function contained on the iterable object.
|
6473 |
+
*
|
6474 |
+
* Be sure to invoke the function with the iterable as context:
|
6475 |
+
*
|
6476 |
+
* var iteratorFn = getIteratorFn(myIterable);
|
6477 |
+
* if (iteratorFn) {
|
6478 |
+
* var iterator = iteratorFn.call(myIterable);
|
6479 |
+
* ...
|
6480 |
+
* }
|
6481 |
+
*
|
6482 |
+
* @param {?object} maybeIterable
|
6483 |
+
* @return {?function}
|
6484 |
+
*/
|
6485 |
+
function getIteratorFn(maybeIterable) {
|
6486 |
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
6487 |
+
if (typeof iteratorFn === 'function') {
|
6488 |
+
return iteratorFn;
|
6489 |
+
}
|
6490 |
+
}
|
6491 |
|
6492 |
+
/**
|
6493 |
+
* Collection of methods that allow declaration and validation of props that are
|
6494 |
+
* supplied to React components. Example usage:
|
6495 |
+
*
|
6496 |
+
* var Props = require('ReactPropTypes');
|
6497 |
+
* var MyArticle = React.createClass({
|
6498 |
+
* propTypes: {
|
6499 |
+
* // An optional string prop named "description".
|
6500 |
+
* description: Props.string,
|
6501 |
+
*
|
6502 |
+
* // A required enum prop named "category".
|
6503 |
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
6504 |
+
*
|
6505 |
+
* // A prop named "dialog" that requires an instance of Dialog.
|
6506 |
+
* dialog: Props.instanceOf(Dialog).isRequired
|
6507 |
+
* },
|
6508 |
+
* render: function() { ... }
|
6509 |
+
* });
|
6510 |
+
*
|
6511 |
+
* A more formal specification of how these methods are used:
|
6512 |
+
*
|
6513 |
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
6514 |
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
6515 |
+
*
|
6516 |
+
* Each and every declaration produces a function with the same signature. This
|
6517 |
+
* allows the creation of custom validation functions. For example:
|
6518 |
+
*
|
6519 |
+
* var MyLink = React.createClass({
|
6520 |
+
* propTypes: {
|
6521 |
+
* // An optional string or URI prop named "href".
|
6522 |
+
* href: function(props, propName, componentName) {
|
6523 |
+
* var propValue = props[propName];
|
6524 |
+
* if (propValue != null && typeof propValue !== 'string' &&
|
6525 |
+
* !(propValue instanceof URI)) {
|
6526 |
+
* return new Error(
|
6527 |
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
6528 |
+
* componentName
|
6529 |
+
* );
|
6530 |
+
* }
|
6531 |
+
* }
|
6532 |
+
* },
|
6533 |
+
* render: function() {...}
|
6534 |
+
* });
|
6535 |
+
*
|
6536 |
+
* @internal
|
6537 |
+
*/
|
6538 |
|
6539 |
+
var ANONYMOUS = '<<anonymous>>';
|
6540 |
+
|
6541 |
+
// Important!
|
6542 |
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
6543 |
+
var ReactPropTypes = {
|
6544 |
+
array: createPrimitiveTypeChecker('array'),
|
6545 |
+
bool: createPrimitiveTypeChecker('boolean'),
|
6546 |
+
func: createPrimitiveTypeChecker('function'),
|
6547 |
+
number: createPrimitiveTypeChecker('number'),
|
6548 |
+
object: createPrimitiveTypeChecker('object'),
|
6549 |
+
string: createPrimitiveTypeChecker('string'),
|
6550 |
+
symbol: createPrimitiveTypeChecker('symbol'),
|
6551 |
+
|
6552 |
+
any: createAnyTypeChecker(),
|
6553 |
+
arrayOf: createArrayOfTypeChecker,
|
6554 |
+
element: createElementTypeChecker(),
|
6555 |
+
elementType: createElementTypeTypeChecker(),
|
6556 |
+
instanceOf: createInstanceTypeChecker,
|
6557 |
+
node: createNodeChecker(),
|
6558 |
+
objectOf: createObjectOfTypeChecker,
|
6559 |
+
oneOf: createEnumTypeChecker,
|
6560 |
+
oneOfType: createUnionTypeChecker,
|
6561 |
+
shape: createShapeTypeChecker,
|
6562 |
+
exact: createStrictShapeTypeChecker,
|
6563 |
+
};
|
6564 |
|
6565 |
+
/**
|
6566 |
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
6567 |
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
6568 |
+
*/
|
6569 |
+
/*eslint-disable no-self-compare*/
|
6570 |
+
function is(x, y) {
|
6571 |
+
// SameValue algorithm
|
6572 |
+
if (x === y) {
|
6573 |
+
// Steps 1-5, 7-10
|
6574 |
+
// Steps 6.b-6.e: +0 != -0
|
6575 |
+
return x !== 0 || 1 / x === 1 / y;
|
6576 |
+
} else {
|
6577 |
+
// Step 6.a: NaN == NaN
|
6578 |
+
return x !== x && y !== y;
|
6579 |
+
}
|
6580 |
+
}
|
6581 |
+
/*eslint-enable no-self-compare*/
|
6582 |
|
6583 |
+
/**
|
6584 |
+
* We use an Error-like object for backward compatibility as people may call
|
6585 |
+
* PropTypes directly and inspect their output. However, we don't use real
|
6586 |
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
6587 |
+
* is prohibitively expensive if they are created too often, such as what
|
6588 |
+
* happens in oneOfType() for any type before the one that matched.
|
6589 |
+
*/
|
6590 |
+
function PropTypeError(message) {
|
6591 |
+
this.message = message;
|
6592 |
+
this.stack = '';
|
6593 |
+
}
|
6594 |
+
// Make `instanceof Error` still work for returned errors.
|
6595 |
+
PropTypeError.prototype = Error.prototype;
|
6596 |
|
6597 |
+
function createChainableTypeChecker(validate) {
|
6598 |
+
if (true) {
|
6599 |
+
var manualPropTypeCallCache = {};
|
6600 |
+
var manualPropTypeWarningCount = 0;
|
6601 |
+
}
|
6602 |
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
6603 |
+
componentName = componentName || ANONYMOUS;
|
6604 |
+
propFullName = propFullName || propName;
|
6605 |
+
|
6606 |
+
if (secret !== ReactPropTypesSecret) {
|
6607 |
+
if (throwOnDirectAccess) {
|
6608 |
+
// New behavior only for users of `prop-types` package
|
6609 |
+
var err = new Error(
|
6610 |
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
6611 |
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
6612 |
+
'Read more at http://fb.me/use-check-prop-types'
|
6613 |
+
);
|
6614 |
+
err.name = 'Invariant Violation';
|
6615 |
+
throw err;
|
6616 |
+
} else if ( true && typeof console !== 'undefined') {
|
6617 |
+
// Old behavior for people using React.PropTypes
|
6618 |
+
var cacheKey = componentName + ':' + propName;
|
6619 |
+
if (
|
6620 |
+
!manualPropTypeCallCache[cacheKey] &&
|
6621 |
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
6622 |
+
manualPropTypeWarningCount < 3
|
6623 |
+
) {
|
6624 |
+
printWarning(
|
6625 |
+
'You are manually calling a React.PropTypes validation ' +
|
6626 |
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
6627 |
+
'and will throw in the standalone `prop-types` package. ' +
|
6628 |
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
6629 |
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
6630 |
+
);
|
6631 |
+
manualPropTypeCallCache[cacheKey] = true;
|
6632 |
+
manualPropTypeWarningCount++;
|
6633 |
+
}
|
6634 |
+
}
|
6635 |
+
}
|
6636 |
+
if (props[propName] == null) {
|
6637 |
+
if (isRequired) {
|
6638 |
+
if (props[propName] === null) {
|
6639 |
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
6640 |
+
}
|
6641 |
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
6642 |
+
}
|
6643 |
+
return null;
|
6644 |
+
} else {
|
6645 |
+
return validate(props, propName, componentName, location, propFullName);
|
6646 |
+
}
|
6647 |
+
}
|
6648 |
|
6649 |
+
var chainedCheckType = checkType.bind(null, false);
|
6650 |
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6651 |
|
6652 |
+
return chainedCheckType;
|
6653 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6654 |
|
6655 |
+
function createPrimitiveTypeChecker(expectedType) {
|
6656 |
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
6657 |
+
var propValue = props[propName];
|
6658 |
+
var propType = getPropType(propValue);
|
6659 |
+
if (propType !== expectedType) {
|
6660 |
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
6661 |
+
// check, but we can offer a more precise error message here rather than
|
6662 |
+
// 'of type `object`'.
|
6663 |
+
var preciseType = getPreciseType(propValue);
|
|
|
6664 |
|
6665 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
6666 |
+
}
|
6667 |
+
return null;
|
6668 |
+
}
|
6669 |
+
return createChainableTypeChecker(validate);
|
6670 |
+
}
|
|
|
|
|
|
|
|
|
6671 |
|
6672 |
+
function createAnyTypeChecker() {
|
6673 |
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
6674 |
+
}
|
|
|
|
|
|
|
|
|
|
|
6675 |
|
6676 |
+
function createArrayOfTypeChecker(typeChecker) {
|
6677 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6678 |
+
if (typeof typeChecker !== 'function') {
|
6679 |
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
6680 |
+
}
|
6681 |
+
var propValue = props[propName];
|
6682 |
+
if (!Array.isArray(propValue)) {
|
6683 |
+
var propType = getPropType(propValue);
|
6684 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
6685 |
+
}
|
6686 |
+
for (var i = 0; i < propValue.length; i++) {
|
6687 |
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
6688 |
+
if (error instanceof Error) {
|
6689 |
+
return error;
|
6690 |
+
}
|
6691 |
+
}
|
6692 |
+
return null;
|
6693 |
+
}
|
6694 |
+
return createChainableTypeChecker(validate);
|
6695 |
+
}
|
6696 |
|
6697 |
+
function createElementTypeChecker() {
|
6698 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6699 |
+
var propValue = props[propName];
|
6700 |
+
if (!isValidElement(propValue)) {
|
6701 |
+
var propType = getPropType(propValue);
|
6702 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
6703 |
+
}
|
6704 |
+
return null;
|
6705 |
+
}
|
6706 |
+
return createChainableTypeChecker(validate);
|
6707 |
+
}
|
6708 |
|
6709 |
+
function createElementTypeTypeChecker() {
|
6710 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6711 |
+
var propValue = props[propName];
|
6712 |
+
if (!ReactIs.isValidElementType(propValue)) {
|
6713 |
+
var propType = getPropType(propValue);
|
6714 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
6715 |
+
}
|
6716 |
+
return null;
|
6717 |
+
}
|
6718 |
+
return createChainableTypeChecker(validate);
|
6719 |
+
}
|
6720 |
|
6721 |
+
function createInstanceTypeChecker(expectedClass) {
|
6722 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6723 |
+
if (!(props[propName] instanceof expectedClass)) {
|
6724 |
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
6725 |
+
var actualClassName = getClassName(props[propName]);
|
6726 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
6727 |
+
}
|
6728 |
+
return null;
|
6729 |
+
}
|
6730 |
+
return createChainableTypeChecker(validate);
|
6731 |
+
}
|
6732 |
|
6733 |
+
function createEnumTypeChecker(expectedValues) {
|
6734 |
+
if (!Array.isArray(expectedValues)) {
|
6735 |
+
if (true) {
|
6736 |
+
if (arguments.length > 1) {
|
6737 |
+
printWarning(
|
6738 |
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
6739 |
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
6740 |
+
);
|
6741 |
+
} else {
|
6742 |
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
6743 |
+
}
|
6744 |
+
}
|
6745 |
+
return emptyFunctionThatReturnsNull;
|
6746 |
+
}
|
6747 |
|
6748 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6749 |
+
var propValue = props[propName];
|
6750 |
+
for (var i = 0; i < expectedValues.length; i++) {
|
6751 |
+
if (is(propValue, expectedValues[i])) {
|
6752 |
+
return null;
|
6753 |
+
}
|
6754 |
+
}
|
|
|
6755 |
|
6756 |
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
6757 |
+
var type = getPreciseType(value);
|
6758 |
+
if (type === 'symbol') {
|
6759 |
+
return String(value);
|
6760 |
+
}
|
6761 |
+
return value;
|
6762 |
+
});
|
6763 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
6764 |
+
}
|
6765 |
+
return createChainableTypeChecker(validate);
|
6766 |
+
}
|
6767 |
|
6768 |
+
function createObjectOfTypeChecker(typeChecker) {
|
6769 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6770 |
+
if (typeof typeChecker !== 'function') {
|
6771 |
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
6772 |
+
}
|
6773 |
+
var propValue = props[propName];
|
6774 |
+
var propType = getPropType(propValue);
|
6775 |
+
if (propType !== 'object') {
|
6776 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
6777 |
+
}
|
6778 |
+
for (var key in propValue) {
|
6779 |
+
if (has(propValue, key)) {
|
6780 |
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
6781 |
+
if (error instanceof Error) {
|
6782 |
+
return error;
|
6783 |
+
}
|
6784 |
+
}
|
6785 |
+
}
|
6786 |
+
return null;
|
6787 |
+
}
|
6788 |
+
return createChainableTypeChecker(validate);
|
6789 |
+
}
|
6790 |
|
6791 |
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
6792 |
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
6793 |
+
true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : undefined;
|
6794 |
+
return emptyFunctionThatReturnsNull;
|
6795 |
+
}
|
6796 |
|
6797 |
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
6798 |
+
var checker = arrayOfTypeCheckers[i];
|
6799 |
+
if (typeof checker !== 'function') {
|
6800 |
+
printWarning(
|
6801 |
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
6802 |
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
6803 |
+
);
|
6804 |
+
return emptyFunctionThatReturnsNull;
|
6805 |
+
}
|
6806 |
+
}
|
6807 |
|
6808 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6809 |
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
6810 |
+
var checker = arrayOfTypeCheckers[i];
|
6811 |
+
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
6812 |
+
return null;
|
6813 |
+
}
|
6814 |
+
}
|
6815 |
|
6816 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
6817 |
}
|
6818 |
+
return createChainableTypeChecker(validate);
|
6819 |
}
|
|
|
|
|
|
|
6820 |
|
6821 |
+
function createNodeChecker() {
|
6822 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6823 |
+
if (!isNode(props[propName])) {
|
6824 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
6825 |
+
}
|
6826 |
+
return null;
|
6827 |
+
}
|
6828 |
+
return createChainableTypeChecker(validate);
|
6829 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6830 |
|
6831 |
+
function createShapeTypeChecker(shapeTypes) {
|
6832 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6833 |
+
var propValue = props[propName];
|
6834 |
+
var propType = getPropType(propValue);
|
6835 |
+
if (propType !== 'object') {
|
6836 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
6837 |
+
}
|
6838 |
+
for (var key in shapeTypes) {
|
6839 |
+
var checker = shapeTypes[key];
|
6840 |
+
if (!checker) {
|
6841 |
+
continue;
|
6842 |
+
}
|
6843 |
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
6844 |
+
if (error) {
|
6845 |
+
return error;
|
6846 |
+
}
|
6847 |
+
}
|
6848 |
+
return null;
|
6849 |
+
}
|
6850 |
+
return createChainableTypeChecker(validate);
|
6851 |
}
|
6852 |
|
6853 |
+
function createStrictShapeTypeChecker(shapeTypes) {
|
6854 |
+
function validate(props, propName, componentName, location, propFullName) {
|
6855 |
+
var propValue = props[propName];
|
6856 |
+
var propType = getPropType(propValue);
|
6857 |
+
if (propType !== 'object') {
|
6858 |
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
6859 |
+
}
|
6860 |
+
// We need to check all keys in case some are required but missing from
|
6861 |
+
// props.
|
6862 |
+
var allKeys = assign({}, props[propName], shapeTypes);
|
6863 |
+
for (var key in allKeys) {
|
6864 |
+
var checker = shapeTypes[key];
|
6865 |
+
if (!checker) {
|
6866 |
+
return new PropTypeError(
|
6867 |
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
6868 |
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
6869 |
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
6870 |
+
);
|
6871 |
+
}
|
6872 |
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
6873 |
+
if (error) {
|
6874 |
+
return error;
|
6875 |
+
}
|
6876 |
+
}
|
6877 |
+
return null;
|
6878 |
+
}
|
6879 |
|
6880 |
+
return createChainableTypeChecker(validate);
|
6881 |
+
}
|
|
|
|
|
|
|
|
|
6882 |
|
6883 |
+
function isNode(propValue) {
|
6884 |
+
switch (typeof propValue) {
|
6885 |
+
case 'number':
|
6886 |
+
case 'string':
|
6887 |
+
case 'undefined':
|
6888 |
+
return true;
|
6889 |
+
case 'boolean':
|
6890 |
+
return !propValue;
|
6891 |
+
case 'object':
|
6892 |
+
if (Array.isArray(propValue)) {
|
6893 |
+
return propValue.every(isNode);
|
6894 |
+
}
|
6895 |
+
if (propValue === null || isValidElement(propValue)) {
|
6896 |
+
return true;
|
6897 |
+
}
|
6898 |
|
6899 |
+
var iteratorFn = getIteratorFn(propValue);
|
6900 |
+
if (iteratorFn) {
|
6901 |
+
var iterator = iteratorFn.call(propValue);
|
6902 |
+
var step;
|
6903 |
+
if (iteratorFn !== propValue.entries) {
|
6904 |
+
while (!(step = iterator.next()).done) {
|
6905 |
+
if (!isNode(step.value)) {
|
6906 |
+
return false;
|
6907 |
+
}
|
6908 |
+
}
|
6909 |
+
} else {
|
6910 |
+
// Iterator will provide entry [k,v] tuples rather than values.
|
6911 |
+
while (!(step = iterator.next()).done) {
|
6912 |
+
var entry = step.value;
|
6913 |
+
if (entry) {
|
6914 |
+
if (!isNode(entry[1])) {
|
6915 |
+
return false;
|
6916 |
+
}
|
6917 |
+
}
|
6918 |
+
}
|
6919 |
+
}
|
6920 |
+
} else {
|
6921 |
+
return false;
|
6922 |
+
}
|
6923 |
|
6924 |
+
return true;
|
6925 |
+
default:
|
6926 |
+
return false;
|
6927 |
+
}
|
6928 |
+
}
|
6929 |
|
6930 |
+
function isSymbol(propType, propValue) {
|
6931 |
+
// Native Symbol.
|
6932 |
+
if (propType === 'symbol') {
|
6933 |
+
return true;
|
6934 |
+
}
|
6935 |
|
6936 |
+
// falsy value can't be a Symbol
|
6937 |
+
if (!propValue) {
|
6938 |
+
return false;
|
6939 |
+
}
|
6940 |
|
6941 |
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
6942 |
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
6943 |
+
return true;
|
6944 |
}
|
6945 |
|
6946 |
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
6947 |
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
6948 |
+
return true;
|
6949 |
}
|
6950 |
|
6951 |
+
return false;
|
|
|
6952 |
}
|
6953 |
|
6954 |
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
6955 |
+
function getPropType(propValue) {
|
6956 |
+
var propType = typeof propValue;
|
6957 |
+
if (Array.isArray(propValue)) {
|
6958 |
+
return 'array';
|
6959 |
+
}
|
6960 |
+
if (propValue instanceof RegExp) {
|
6961 |
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
6962 |
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
6963 |
+
// passes PropTypes.object.
|
6964 |
+
return 'object';
|
6965 |
+
}
|
6966 |
+
if (isSymbol(propType, propValue)) {
|
6967 |
+
return 'symbol';
|
6968 |
+
}
|
6969 |
+
return propType;
|
6970 |
+
}
|
6971 |
|
6972 |
+
// This handles more types than `getPropType`. Only used for error messages.
|
6973 |
+
// See `createPrimitiveTypeChecker`.
|
6974 |
+
function getPreciseType(propValue) {
|
6975 |
+
if (typeof propValue === 'undefined' || propValue === null) {
|
6976 |
+
return '' + propValue;
|
6977 |
+
}
|
6978 |
+
var propType = getPropType(propValue);
|
6979 |
+
if (propType === 'object') {
|
6980 |
+
if (propValue instanceof Date) {
|
6981 |
+
return 'date';
|
6982 |
+
} else if (propValue instanceof RegExp) {
|
6983 |
+
return 'regexp';
|
6984 |
+
}
|
6985 |
+
}
|
6986 |
+
return propType;
|
6987 |
+
}
|
6988 |
|
6989 |
+
// Returns a string that is postfixed to a warning about an invalid type.
|
6990 |
+
// For example, "undefined" or "of type array"
|
6991 |
+
function getPostfixForTypeWarning(value) {
|
6992 |
+
var type = getPreciseType(value);
|
6993 |
+
switch (type) {
|
6994 |
+
case 'array':
|
6995 |
+
case 'object':
|
6996 |
+
return 'an ' + type;
|
6997 |
+
case 'boolean':
|
6998 |
+
case 'date':
|
6999 |
+
case 'regexp':
|
7000 |
+
return 'a ' + type;
|
7001 |
+
default:
|
7002 |
+
return type;
|
7003 |
+
}
|
7004 |
+
}
|
7005 |
|
7006 |
+
// Returns class name of the object, if any.
|
7007 |
+
function getClassName(propValue) {
|
7008 |
+
if (!propValue.constructor || !propValue.constructor.name) {
|
7009 |
+
return ANONYMOUS;
|
7010 |
+
}
|
7011 |
+
return propValue.constructor.name;
|
7012 |
}
|
7013 |
|
7014 |
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
7015 |
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
7016 |
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
7017 |
|
7018 |
+
return ReactPropTypes;
|
7019 |
+
};
|
|
|
|
|
|
|
|
|
7020 |
|
|
|
|
|
|
|
7021 |
|
7022 |
+
/***/ }),
|
7023 |
+
|
7024 |
+
/***/ "./node_modules/prop-types/index.js":
|
7025 |
+
/*!******************************************!*\
|
7026 |
+
!*** ./node_modules/prop-types/index.js ***!
|
7027 |
+
\******************************************/
|
7028 |
+
/*! no static exports found */
|
7029 |
+
/***/ (function(module, exports, __webpack_require__) {
|
7030 |
+
|
7031 |
/**
|
7032 |
+
* Copyright (c) 2013-present, Facebook, Inc.
|
7033 |
*
|
7034 |
+
* This source code is licensed under the MIT license found in the
|
7035 |
+
* LICENSE file in the root directory of this source tree.
|
|
|
7036 |
*/
|
7037 |
|
7038 |
+
if (true) {
|
7039 |
+
var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js");
|
|
|
|
|
|
|
|
|
7040 |
|
7041 |
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
7042 |
+
// http://fb.me/prop-types-in-prod
|
7043 |
+
var throwOnDirectAccess = true;
|
7044 |
+
module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess);
|
7045 |
+
} else {}
|
7046 |
|
|
|
|
|
|
|
7047 |
|
7048 |
+
/***/ }),
|
|
|
|
|
|
|
|
|
|
|
|
|
7049 |
|
7050 |
+
/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js":
|
7051 |
+
/*!*************************************************************!*\
|
7052 |
+
!*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
|
7053 |
+
\*************************************************************/
|
7054 |
+
/*! no static exports found */
|
7055 |
+
/***/ (function(module, exports, __webpack_require__) {
|
7056 |
|
7057 |
+
"use strict";
|
|
|
7058 |
/**
|
7059 |
+
* Copyright (c) 2013-present, Facebook, Inc.
|
7060 |
*
|
7061 |
+
* This source code is licensed under the MIT license found in the
|
7062 |
+
* LICENSE file in the root directory of this source tree.
|
|
|
7063 |
*/
|
7064 |
|
|
|
|
|
|
|
|
|
7065 |
|
|
|
|
|
7066 |
|
7067 |
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7068 |
|
7069 |
+
module.exports = ReactPropTypesSecret;
|
|
|
|
|
7070 |
|
|
|
7071 |
|
7072 |
+
/***/ }),
|
7073 |
|
7074 |
+
/***/ "./node_modules/react-dom/cjs/react-dom.development.js":
|
7075 |
+
/*!*************************************************************!*\
|
7076 |
+
!*** ./node_modules/react-dom/cjs/react-dom.development.js ***!
|
7077 |
+
\*************************************************************/
|
7078 |
+
/*! no static exports found */
|
7079 |
+
/***/ (function(module, exports, __webpack_require__) {
|
7080 |
|
7081 |
+
"use strict";
|
7082 |
+
/** @license React v17.0.2
|
7083 |
+
* react-dom.development.js
|
7084 |
+
*
|
7085 |
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
7086 |
+
*
|
7087 |
+
* This source code is licensed under the MIT license found in the
|
7088 |
+
* LICENSE file in the root directory of this source tree.
|
7089 |
+
*/
|
7090 |
|
|
|
7091 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7092 |
|
7093 |
+
if (true) {
|
7094 |
+
(function() {
|
7095 |
+
'use strict';
|
|
|
|
|
7096 |
|
7097 |
+
var React = __webpack_require__(/*! react */ "./node_modules/react/index.js");
|
7098 |
+
var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
|
7099 |
+
var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js");
|
7100 |
+
var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js");
|
7101 |
|
7102 |
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
|
|
|
|
|
|
|
7103 |
|
7104 |
+
// by calls to these methods by a Babel plugin.
|
7105 |
+
//
|
7106 |
+
// In PROD (or in packages without access to React internals),
|
7107 |
+
// they are left as they are instead.
|
7108 |
|
7109 |
+
function warn(format) {
|
7110 |
{
|
7111 |
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
7112 |
+
args[_key - 1] = arguments[_key];
|
|
|
|
|
7113 |
}
|
|
|
7114 |
|
7115 |
+
printWarning('warn', format, args);
|
7116 |
+
}
|
7117 |
+
}
|
7118 |
+
function error(format) {
|
7119 |
+
{
|
7120 |
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
7121 |
+
args[_key2 - 1] = arguments[_key2];
|
7122 |
}
|
7123 |
|
7124 |
+
printWarning('error', format, args);
|
7125 |
}
|
|
|
|
|
7126 |
}
|
7127 |
|
7128 |
+
function printWarning(level, format, args) {
|
7129 |
+
// When changing this logic, you might want to also
|
7130 |
+
// update consoleWithStackDev.www.js as well.
|
7131 |
+
{
|
7132 |
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
7133 |
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
7134 |
+
|
7135 |
+
if (stack !== '') {
|
7136 |
+
format += '%s';
|
7137 |
+
args = args.concat([stack]);
|
7138 |
}
|
|
|
7139 |
|
7140 |
+
var argsWithFormat = args.map(function (item) {
|
7141 |
+
return '' + item;
|
7142 |
+
}); // Careful: RN currently depends on this prefix
|
|
|
|
|
|
|
7143 |
|
7144 |
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
7145 |
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
7146 |
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7147 |
|
7148 |
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
|
|
|
|
|
|
|
|
|
7149 |
}
|
|
|
|
|
7150 |
}
|
7151 |
|
7152 |
+
if (!React) {
|
|
|
|
|
7153 |
{
|
7154 |
+
throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." );
|
7155 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
7156 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7157 |
|
7158 |
+
var FunctionComponent = 0;
|
7159 |
+
var ClassComponent = 1;
|
7160 |
+
var IndeterminateComponent = 2; // Before we know whether it is function or class
|
7161 |
|
7162 |
+
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
|
|
|
|
|
7163 |
|
7164 |
+
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
|
|
|
|
|
|
|
7165 |
|
7166 |
+
var HostComponent = 5;
|
7167 |
+
var HostText = 6;
|
7168 |
+
var Fragment = 7;
|
7169 |
+
var Mode = 8;
|
7170 |
+
var ContextConsumer = 9;
|
7171 |
+
var ContextProvider = 10;
|
7172 |
+
var ForwardRef = 11;
|
7173 |
+
var Profiler = 12;
|
7174 |
+
var SuspenseComponent = 13;
|
7175 |
+
var MemoComponent = 14;
|
7176 |
+
var SimpleMemoComponent = 15;
|
7177 |
+
var LazyComponent = 16;
|
7178 |
+
var IncompleteClassComponent = 17;
|
7179 |
+
var DehydratedFragment = 18;
|
7180 |
+
var SuspenseListComponent = 19;
|
7181 |
+
var FundamentalComponent = 20;
|
7182 |
+
var ScopeComponent = 21;
|
7183 |
+
var Block = 22;
|
7184 |
+
var OffscreenComponent = 23;
|
7185 |
+
var LegacyHiddenComponent = 24;
|
7186 |
|
7187 |
+
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
|
|
|
7188 |
|
7189 |
+
var enableProfilerTimer = true; // Record durations for commit and passive effects phases.
|
|
|
|
|
|
|
|
|
7190 |
|
7191 |
+
var enableFundamentalAPI = false; // Experimental Scope support.
|
7192 |
+
var enableNewReconciler = false; // Errors that are thrown while unmounting (or after in the case of passive effects)
|
7193 |
+
var warnAboutStringRefs = false;
|
7194 |
|
7195 |
+
var allNativeEvents = new Set();
|
7196 |
+
/**
|
7197 |
+
* Mapping from registration name to event name
|
7198 |
+
*/
|
7199 |
|
|
|
|
|
|
|
|
|
|
|
7200 |
|
7201 |
+
var registrationNameDependencies = {};
|
7202 |
+
/**
|
7203 |
+
* Mapping from lowercase registration names to the properly cased version,
|
7204 |
+
* used to warn in the case of missing event handlers. Available
|
7205 |
+
* only in true.
|
7206 |
+
* @type {Object}
|
7207 |
+
*/
|
7208 |
|
7209 |
+
var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true
|
|
|
|
|
|
|
7210 |
|
7211 |
+
function registerTwoPhaseEvent(registrationName, dependencies) {
|
7212 |
+
registerDirectEvent(registrationName, dependencies);
|
7213 |
+
registerDirectEvent(registrationName + 'Capture', dependencies);
|
7214 |
}
|
7215 |
+
function registerDirectEvent(registrationName, dependencies) {
|
7216 |
{
|
7217 |
+
if (registrationNameDependencies[registrationName]) {
|
7218 |
+
error('EventRegistry: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName);
|
7219 |
}
|
7220 |
}
|
7221 |
|
7222 |
+
registrationNameDependencies[registrationName] = dependencies;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7223 |
|
7224 |
+
{
|
7225 |
+
var lowerCasedName = registrationName.toLowerCase();
|
7226 |
+
possibleRegistrationNames[lowerCasedName] = registrationName;
|
7227 |
|
7228 |
+
if (registrationName === 'onDoubleClick') {
|
7229 |
+
possibleRegistrationNames.ondblclick = registrationName;
|
7230 |
+
}
|
7231 |
+
}
|
7232 |
|
7233 |
+
for (var i = 0; i < dependencies.length; i++) {
|
7234 |
+
allNativeEvents.add(dependencies[i]);
|
7235 |
+
}
|
7236 |
+
}
|
7237 |
|
7238 |
+
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
|
7239 |
|
7240 |
+
// A reserved attribute.
|
7241 |
+
// It is handled by React separately and shouldn't be written to the DOM.
|
7242 |
+
var RESERVED = 0; // A simple string attribute.
|
7243 |
+
// Attributes that aren't in the filter are presumed to have this type.
|
7244 |
|
7245 |
+
var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
|
7246 |
+
// "enumerated" attributes with "true" and "false" as possible values.
|
7247 |
+
// When true, it should be set to a "true" string.
|
7248 |
+
// When false, it should be set to a "false" string.
|
|
|
7249 |
|
7250 |
+
var BOOLEANISH_STRING = 2; // A real boolean attribute.
|
7251 |
+
// When true, it should be present (set either to an empty string or its name).
|
7252 |
+
// When false, it should be omitted.
|
7253 |
|
7254 |
+
var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
|
7255 |
+
// When true, it should be present (set either to an empty string or its name).
|
7256 |
+
// When false, it should be omitted.
|
7257 |
+
// For any other value, should be present with that value.
|
|
|
|
|
7258 |
|
7259 |
+
var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
|
7260 |
+
// When falsy, it should be removed.
|
|
|
7261 |
|
7262 |
+
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
|
7263 |
+
// When falsy, it should be removed.
|
7264 |
|
7265 |
+
var POSITIVE_NUMERIC = 6;
|
|
|
|
|
|
|
7266 |
|
7267 |
+
/* eslint-disable max-len */
|
7268 |
+
var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
7269 |
+
/* eslint-enable max-len */
|
7270 |
|
7271 |
+
var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
7272 |
+
var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
7273 |
+
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
7274 |
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
7275 |
+
var illegalAttributeNameCache = {};
|
7276 |
+
var validatedAttributeNameCache = {};
|
7277 |
+
function isAttributeNameSafe(attributeName) {
|
7278 |
+
if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
|
7279 |
+
return true;
|
7280 |
}
|
|
|
7281 |
|
7282 |
+
if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
|
7283 |
+
return false;
|
7284 |
+
}
|
|
|
7285 |
|
7286 |
+
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
7287 |
+
validatedAttributeNameCache[attributeName] = true;
|
7288 |
+
return true;
|
7289 |
+
}
|
7290 |
|
7291 |
+
illegalAttributeNameCache[attributeName] = true;
|
|
|
|
|
7292 |
|
7293 |
+
{
|
7294 |
+
error('Invalid attribute name: `%s`', attributeName);
|
|
|
|
|
|
|
7295 |
}
|
7296 |
|
7297 |
+
return false;
|
7298 |
+
}
|
7299 |
+
function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
|
7300 |
+
if (propertyInfo !== null) {
|
7301 |
+
return propertyInfo.type === RESERVED;
|
7302 |
}
|
7303 |
|
7304 |
+
if (isCustomComponentTag) {
|
7305 |
+
return false;
|
7306 |
+
}
|
7307 |
|
7308 |
+
if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
|
7309 |
+
return true;
|
7310 |
}
|
7311 |
|
7312 |
+
return false;
|
|
|
7313 |
}
|
7314 |
+
function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
7315 |
+
if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
7316 |
+
return false;
|
7317 |
+
}
|
7318 |
|
7319 |
+
switch (typeof value) {
|
7320 |
+
case 'function': // $FlowIssue symbol is perfectly valid here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7321 |
|
7322 |
+
case 'symbol':
|
7323 |
+
// eslint-disable-line
|
7324 |
+
return true;
|
7325 |
|
7326 |
+
case 'boolean':
|
7327 |
+
{
|
7328 |
+
if (isCustomComponentTag) {
|
7329 |
+
return false;
|
7330 |
+
}
|
|
|
7331 |
|
7332 |
+
if (propertyInfo !== null) {
|
7333 |
+
return !propertyInfo.acceptsBooleans;
|
7334 |
+
} else {
|
7335 |
+
var prefix = name.toLowerCase().slice(0, 5);
|
7336 |
+
return prefix !== 'data-' && prefix !== 'aria-';
|
7337 |
+
}
|
7338 |
+
}
|
7339 |
|
7340 |
+
default:
|
7341 |
+
return false;
|
7342 |
}
|
7343 |
}
|
7344 |
+
function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
|
7345 |
+
if (value === null || typeof value === 'undefined') {
|
7346 |
+
return true;
|
7347 |
+
}
|
7348 |
|
7349 |
+
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
7350 |
+
return true;
|
|
|
|
|
|
|
7351 |
}
|
7352 |
|
7353 |
+
if (isCustomComponentTag) {
|
7354 |
+
return false;
|
7355 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
7356 |
|
7357 |
+
if (propertyInfo !== null) {
|
|
|
|
|
7358 |
|
7359 |
+
switch (propertyInfo.type) {
|
7360 |
+
case BOOLEAN:
|
7361 |
+
return !value;
|
7362 |
|
7363 |
+
case OVERLOADED_BOOLEAN:
|
7364 |
+
return value === false;
|
|
|
|
|
|
|
7365 |
|
7366 |
+
case NUMERIC:
|
7367 |
+
return isNaN(value);
|
|
|
7368 |
|
7369 |
+
case POSITIVE_NUMERIC:
|
7370 |
+
return isNaN(value) || value < 1;
|
7371 |
}
|
7372 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7373 |
|
7374 |
+
return false;
|
|
|
|
|
7375 |
}
|
7376 |
+
function getPropertyInfo(name) {
|
7377 |
+
return properties.hasOwnProperty(name) ? properties[name] : null;
|
|
|
|
|
7378 |
}
|
7379 |
|
7380 |
+
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
|
7381 |
+
this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
7382 |
+
this.attributeName = attributeName;
|
7383 |
+
this.attributeNamespace = attributeNamespace;
|
7384 |
+
this.mustUseProperty = mustUseProperty;
|
7385 |
+
this.propertyName = name;
|
7386 |
+
this.type = type;
|
7387 |
+
this.sanitizeURL = sanitizeURL;
|
7388 |
+
this.removeEmptyString = removeEmptyString;
|
7389 |
+
} // When adding attributes to this list, be sure to also add them to
|
7390 |
+
// the `possibleStandardNames` module to ensure casing and incorrect
|
7391 |
+
// name warnings.
|
7392 |
|
|
|
|
|
|
|
7393 |
|
7394 |
+
var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
|
|
|
7395 |
|
7396 |
+
var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
|
7397 |
+
// elements (not just inputs). Now that ReactDOMInput assigns to the
|
7398 |
+
// defaultValue property -- do we need this?
|
7399 |
+
'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
|
7400 |
+
reservedProps.forEach(function (name) {
|
7401 |
+
properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
|
7402 |
+
name, // attributeName
|
7403 |
+
null, // attributeNamespace
|
7404 |
+
false, // sanitizeURL
|
7405 |
+
false);
|
7406 |
+
}); // A few React string attributes have a different name.
|
7407 |
+
// This is a mapping from React prop names to the attribute names.
|
7408 |
|
7409 |
+
[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
7410 |
+
var name = _ref[0],
|
7411 |
+
attributeName = _ref[1];
|
7412 |
+
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
7413 |
+
attributeName, // attributeName
|
7414 |
+
null, // attributeNamespace
|
7415 |
+
false, // sanitizeURL
|
7416 |
+
false);
|
7417 |
+
}); // These are "enumerated" HTML attributes that accept "true" and "false".
|
7418 |
+
// In React, we let users pass `true` and `false` even though technically
|
7419 |
+
// these aren't boolean attributes (they are coerced to strings).
|
7420 |
|
7421 |
+
['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
7422 |
+
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
7423 |
+
name.toLowerCase(), // attributeName
|
7424 |
+
null, // attributeNamespace
|
7425 |
+
false, // sanitizeURL
|
7426 |
+
false);
|
7427 |
+
}); // These are "enumerated" SVG attributes that accept "true" and "false".
|
7428 |
+
// In React, we let users pass `true` and `false` even though technically
|
7429 |
+
// these aren't boolean attributes (they are coerced to strings).
|
7430 |
+
// Since these are SVG attributes, their attribute names are case-sensitive.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7431 |
|
7432 |
+
['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
7433 |
+
properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
|
7434 |
+
name, // attributeName
|
7435 |
+
null, // attributeNamespace
|
7436 |
+
false, // sanitizeURL
|
7437 |
+
false);
|
7438 |
+
}); // These are HTML boolean attributes.
|
|
|
7439 |
|
7440 |
+
['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
|
7441 |
+
// on the client side because the browsers are inconsistent. Instead we call focus().
|
7442 |
+
'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
|
7443 |
+
'itemScope'].forEach(function (name) {
|
7444 |
+
properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
|
7445 |
+
name.toLowerCase(), // attributeName
|
7446 |
+
null, // attributeNamespace
|
7447 |
+
false, // sanitizeURL
|
7448 |
+
false);
|
7449 |
+
}); // These are the few React props that we set as DOM properties
|
7450 |
+
// rather than attributes. These are all booleans.
|
7451 |
|
7452 |
+
['checked', // Note: `option.selected` is not updated if `select.multiple` is
|
7453 |
+
// disabled with `removeAttribute`. We have special logic for handling this.
|
7454 |
+
'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
|
7455 |
+
// you'll need to set attributeName to name.toLowerCase()
|
7456 |
+
// instead in the assignment below.
|
7457 |
+
].forEach(function (name) {
|
7458 |
+
properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
|
7459 |
+
name, // attributeName
|
7460 |
+
null, // attributeNamespace
|
7461 |
+
false, // sanitizeURL
|
7462 |
+
false);
|
7463 |
+
}); // These are HTML attributes that are "overloaded booleans": they behave like
|
7464 |
+
// booleans, but can also accept a string value.
|
7465 |
|
7466 |
+
['capture', 'download' // NOTE: if you add a camelCased prop to this list,
|
7467 |
+
// you'll need to set attributeName to name.toLowerCase()
|
7468 |
+
// instead in the assignment below.
|
7469 |
+
].forEach(function (name) {
|
7470 |
+
properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
|
7471 |
+
name, // attributeName
|
7472 |
+
null, // attributeNamespace
|
7473 |
+
false, // sanitizeURL
|
7474 |
+
false);
|
7475 |
+
}); // These are HTML attributes that must be positive numbers.
|
7476 |
|
7477 |
+
['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
|
7478 |
+
// you'll need to set attributeName to name.toLowerCase()
|
7479 |
+
// instead in the assignment below.
|
7480 |
+
].forEach(function (name) {
|
7481 |
+
properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
|
7482 |
+
name, // attributeName
|
7483 |
+
null, // attributeNamespace
|
7484 |
+
false, // sanitizeURL
|
7485 |
+
false);
|
7486 |
+
}); // These are HTML attributes that must be numbers.
|
7487 |
|
7488 |
+
['rowSpan', 'start'].forEach(function (name) {
|
7489 |
+
properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
|
7490 |
+
name.toLowerCase(), // attributeName
|
7491 |
+
null, // attributeNamespace
|
7492 |
+
false, // sanitizeURL
|
7493 |
+
false);
|
7494 |
+
});
|
7495 |
+
var CAMELIZE = /[\-\:]([a-z])/g;
|
7496 |
|
7497 |
+
var capitalize = function (token) {
|
7498 |
+
return token[1].toUpperCase();
|
7499 |
+
}; // This is a list of all SVG attributes that need special casing, namespacing,
|
7500 |
+
// or boolean value assignment. Regular attributes that just accept strings
|
7501 |
+
// and have the same names are omitted, just like in the HTML attribute filter.
|
7502 |
+
// Some of these attributes can be hard to find. This list was created by
|
7503 |
+
// scraping the MDN documentation.
|
7504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7505 |
|
7506 |
+
['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
|
7507 |
+
// you'll need to set attributeName to name.toLowerCase()
|
7508 |
+
// instead in the assignment below.
|
7509 |
+
].forEach(function (attributeName) {
|
7510 |
+
var name = attributeName.replace(CAMELIZE, capitalize);
|
7511 |
+
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
7512 |
+
attributeName, null, // attributeNamespace
|
7513 |
+
false, // sanitizeURL
|
7514 |
+
false);
|
7515 |
+
}); // String SVG attributes with the xlink namespace.
|
7516 |
|
7517 |
+
['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
|
7518 |
+
// you'll need to set attributeName to name.toLowerCase()
|
7519 |
+
// instead in the assignment below.
|
7520 |
+
].forEach(function (attributeName) {
|
7521 |
+
var name = attributeName.replace(CAMELIZE, capitalize);
|
7522 |
+
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
7523 |
+
attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL
|
7524 |
+
false);
|
7525 |
+
}); // String SVG attributes with the xml namespace.
|
7526 |
|
7527 |
+
['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
|
7528 |
+
// you'll need to set attributeName to name.toLowerCase()
|
7529 |
+
// instead in the assignment below.
|
7530 |
+
].forEach(function (attributeName) {
|
7531 |
+
var name = attributeName.replace(CAMELIZE, capitalize);
|
7532 |
+
properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
|
7533 |
+
attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL
|
7534 |
+
false);
|
7535 |
+
}); // These attribute exists both in HTML and SVG.
|
7536 |
+
// The attribute name is case-sensitive in SVG so we can't just use
|
7537 |
+
// the React name like we do for attributes that exist only in HTML.
|
7538 |
|
7539 |
+
['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
7540 |
+
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
7541 |
+
attributeName.toLowerCase(), // attributeName
|
7542 |
+
null, // attributeNamespace
|
7543 |
+
false, // sanitizeURL
|
7544 |
+
false);
|
7545 |
+
}); // These attributes accept URLs. These must not allow javascript: URLS.
|
7546 |
+
// These will also need to accept Trusted Types object in the future.
|
7547 |
|
7548 |
+
var xlinkHref = 'xlinkHref';
|
7549 |
+
properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
|
7550 |
+
'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL
|
7551 |
+
false);
|
7552 |
+
['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
|
7553 |
+
properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
|
7554 |
+
attributeName.toLowerCase(), // attributeName
|
7555 |
+
null, // attributeNamespace
|
7556 |
+
true, // sanitizeURL
|
7557 |
+
true);
|
7558 |
+
});
|
7559 |
|
7560 |
+
// and any newline or tab are filtered out as if they're not part of the URL.
|
7561 |
+
// https://url.spec.whatwg.org/#url-parsing
|
7562 |
+
// Tab or newline are defined as \r\n\t:
|
7563 |
+
// https://infra.spec.whatwg.org/#ascii-tab-or-newline
|
7564 |
+
// A C0 control is a code point in the range \u0000 NULL to \u001F
|
7565 |
+
// INFORMATION SEPARATOR ONE, inclusive:
|
7566 |
+
// https://infra.spec.whatwg.org/#c0-control-or-space
|
7567 |
|
7568 |
+
/* eslint-disable max-len */
|
|
|
|
|
|
|
|
|
|
|
7569 |
|
7570 |
+
var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
7571 |
+
var didWarn = false;
|
|
|
|
|
|
|
|
|
7572 |
|
7573 |
+
function sanitizeURL(url) {
|
7574 |
{
|
7575 |
+
if (!didWarn && isJavaScriptProtocol.test(url)) {
|
7576 |
+
didWarn = true;
|
|
|
|
|
7577 |
|
7578 |
+
error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
|
|
|
|
|
7579 |
}
|
7580 |
}
|
7581 |
}
|
7582 |
|
7583 |
/**
|
7584 |
+
* Get the value for a property on a node. Only used in DEV for SSR validation.
|
7585 |
+
* The "expected" argument is used as a hint of what the expected value is.
|
7586 |
+
* Some properties have multiple equivalent values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7587 |
*/
|
7588 |
+
function getValueForProperty(node, name, expected, propertyInfo) {
|
7589 |
+
{
|
7590 |
+
if (propertyInfo.mustUseProperty) {
|
7591 |
+
var propertyName = propertyInfo.propertyName;
|
7592 |
+
return node[propertyName];
|
7593 |
+
} else {
|
7594 |
+
if ( propertyInfo.sanitizeURL) {
|
7595 |
+
// If we haven't fully disabled javascript: URLs, and if
|
7596 |
+
// the hydration is successful of a javascript: URL, we
|
7597 |
+
// still want to warn on the client.
|
7598 |
+
sanitizeURL('' + expected);
|
7599 |
+
}
|
7600 |
|
7601 |
+
var attributeName = propertyInfo.attributeName;
|
7602 |
+
var stringValue = null;
|
|
|
|
|
|
|
|
|
|
|
7603 |
|
7604 |
+
if (propertyInfo.type === OVERLOADED_BOOLEAN) {
|
7605 |
+
if (node.hasAttribute(attributeName)) {
|
7606 |
+
var value = node.getAttribute(attributeName);
|
7607 |
|
7608 |
+
if (value === '') {
|
7609 |
+
return true;
|
7610 |
+
}
|
7611 |
|
7612 |
+
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
7613 |
+
return value;
|
7614 |
+
}
|
|
|
|
|
7615 |
|
7616 |
+
if (value === '' + expected) {
|
7617 |
+
return expected;
|
7618 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
7619 |
|
7620 |
+
return value;
|
7621 |
+
}
|
7622 |
+
} else if (node.hasAttribute(attributeName)) {
|
7623 |
+
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
7624 |
+
// We had an attribute but shouldn't have had one, so read it
|
7625 |
+
// for the error message.
|
7626 |
+
return node.getAttribute(attributeName);
|
7627 |
+
}
|
|
|
|
|
|
|
7628 |
|
7629 |
+
if (propertyInfo.type === BOOLEAN) {
|
7630 |
+
// If this was a boolean, it doesn't matter what the value is
|
7631 |
+
// the fact that we have it is the same as the expected.
|
7632 |
+
return expected;
|
7633 |
+
} // Even if this property uses a namespace we use getAttribute
|
7634 |
+
// because we assume its namespaced name is the same as our config.
|
7635 |
+
// To use getAttributeNS we need the local name which we don't have
|
7636 |
+
// in our config atm.
|
7637 |
|
|
|
|
|
|
|
7638 |
|
7639 |
+
stringValue = node.getAttribute(attributeName);
|
7640 |
+
}
|
7641 |
|
7642 |
+
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
7643 |
+
return stringValue === null ? expected : stringValue;
|
7644 |
+
} else if (stringValue === '' + expected) {
|
7645 |
+
return expected;
|
7646 |
+
} else {
|
7647 |
+
return stringValue;
|
7648 |
+
}
|
7649 |
+
}
|
7650 |
+
}
|
7651 |
+
}
|
7652 |
/**
|
7653 |
+
* Get the value for a attribute on a node. Only used in DEV for SSR validation.
|
7654 |
+
* The third argument is used as a hint of what the expected value is. Some
|
7655 |
+
* attributes have multiple equivalent values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7656 |
*/
|
7657 |
|
7658 |
+
function getValueForAttribute(node, name, expected) {
|
7659 |
+
{
|
7660 |
+
if (!isAttributeNameSafe(name)) {
|
7661 |
+
return;
|
7662 |
+
} // If the object is an opaque reference ID, it's expected that
|
7663 |
+
// the next prop is different than the server value, so just return
|
7664 |
+
// expected
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7665 |
|
|
|
7666 |
|
7667 |
+
if (isOpaqueHydratingObject(expected)) {
|
7668 |
+
return expected;
|
7669 |
+
}
|
|
|
|
|
7670 |
|
7671 |
+
if (!node.hasAttribute(name)) {
|
7672 |
+
return expected === undefined ? undefined : null;
|
7673 |
+
}
|
|
|
|
|
7674 |
|
7675 |
+
var value = node.getAttribute(name);
|
|
|
|
|
|
|
|
|
7676 |
|
7677 |
+
if (value === '' + expected) {
|
7678 |
+
return expected;
|
|
|
7679 |
}
|
7680 |
|
7681 |
+
return value;
|
7682 |
+
}
|
7683 |
+
}
|
7684 |
+
/**
|
7685 |
+
* Sets the value for a property on a node.
|
7686 |
+
*
|
7687 |
+
* @param {DOMElement} node
|
7688 |
+
* @param {string} name
|
7689 |
+
* @param {*} value
|
7690 |
+
*/
|
7691 |
|
7692 |
+
function setValueForProperty(node, name, value, isCustomComponentTag) {
|
7693 |
+
var propertyInfo = getPropertyInfo(name);
|
|
|
|
|
|
|
7694 |
|
7695 |
+
if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
|
7696 |
+
return;
|
7697 |
+
}
|
|
|
7698 |
|
7699 |
+
if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
|
7700 |
+
value = null;
|
7701 |
+
} // If the prop isn't in the special list, treat it as a simple attribute.
|
7702 |
|
|
|
|
|
7703 |
|
7704 |
+
if (isCustomComponentTag || propertyInfo === null) {
|
7705 |
+
if (isAttributeNameSafe(name)) {
|
7706 |
+
var _attributeName = name;
|
7707 |
+
|
7708 |
+
if (value === null) {
|
7709 |
+
node.removeAttribute(_attributeName);
|
7710 |
+
} else {
|
7711 |
+
node.setAttribute(_attributeName, '' + value);
|
7712 |
+
}
|
7713 |
}
|
7714 |
|
7715 |
+
return;
|
7716 |
+
}
|
7717 |
|
7718 |
+
var mustUseProperty = propertyInfo.mustUseProperty;
|
|
|
7719 |
|
7720 |
+
if (mustUseProperty) {
|
7721 |
+
var propertyName = propertyInfo.propertyName;
|
7722 |
+
|
7723 |
+
if (value === null) {
|
7724 |
+
var type = propertyInfo.type;
|
7725 |
+
node[propertyName] = type === BOOLEAN ? false : '';
|
7726 |
+
} else {
|
7727 |
+
// Contrary to `setAttribute`, object properties are properly
|
7728 |
+
// `toString`ed by IE8/9.
|
7729 |
+
node[propertyName] = value;
|
7730 |
}
|
7731 |
|
7732 |
+
return;
|
7733 |
+
} // The rest are treated as attributes with special cases.
|
7734 |
|
|
|
|
|
7735 |
|
7736 |
+
var attributeName = propertyInfo.attributeName,
|
7737 |
+
attributeNamespace = propertyInfo.attributeNamespace;
|
|
|
|
|
7738 |
|
7739 |
+
if (value === null) {
|
7740 |
+
node.removeAttribute(attributeName);
|
7741 |
+
} else {
|
7742 |
+
var _type = propertyInfo.type;
|
7743 |
+
var attributeValue;
|
7744 |
|
7745 |
+
if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
|
7746 |
+
// If attribute type is boolean, we know for sure it won't be an execution sink
|
7747 |
+
// and we won't require Trusted Type here.
|
7748 |
+
attributeValue = '';
|
7749 |
+
} else {
|
7750 |
+
// `setAttribute` with objects becomes only `[object]` in IE8/9,
|
7751 |
+
// ('' + value) makes it output the correct toString()-value.
|
7752 |
+
{
|
7753 |
+
attributeValue = '' + value;
|
7754 |
+
}
|
7755 |
|
7756 |
+
if (propertyInfo.sanitizeURL) {
|
7757 |
+
sanitizeURL(attributeValue.toString());
|
7758 |
+
}
|
|
|
|
|
|
|
|
|
7759 |
}
|
7760 |
|
7761 |
+
if (attributeNamespace) {
|
7762 |
+
node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
|
7763 |
+
} else {
|
7764 |
+
node.setAttribute(attributeName, attributeValue);
|
|
|
|
|
7765 |
}
|
7766 |
+
}
|
7767 |
}
|
7768 |
|
7769 |
+
// ATTENTION
|
7770 |
+
// When adding new symbols to this file,
|
7771 |
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
7772 |
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
7773 |
+
// nor polyfill, then a plain number is used for performance.
|
7774 |
+
var REACT_ELEMENT_TYPE = 0xeac7;
|
7775 |
+
var REACT_PORTAL_TYPE = 0xeaca;
|
7776 |
+
var REACT_FRAGMENT_TYPE = 0xeacb;
|
7777 |
+
var REACT_STRICT_MODE_TYPE = 0xeacc;
|
7778 |
+
var REACT_PROFILER_TYPE = 0xead2;
|
7779 |
+
var REACT_PROVIDER_TYPE = 0xeacd;
|
7780 |
+
var REACT_CONTEXT_TYPE = 0xeace;
|
7781 |
+
var REACT_FORWARD_REF_TYPE = 0xead0;
|
7782 |
+
var REACT_SUSPENSE_TYPE = 0xead1;
|
7783 |
+
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
7784 |
+
var REACT_MEMO_TYPE = 0xead3;
|
7785 |
+
var REACT_LAZY_TYPE = 0xead4;
|
7786 |
+
var REACT_BLOCK_TYPE = 0xead9;
|
7787 |
+
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
7788 |
+
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
7789 |
+
var REACT_SCOPE_TYPE = 0xead7;
|
7790 |
+
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
7791 |
+
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
7792 |
+
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
7793 |
+
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
7794 |
|
7795 |
+
if (typeof Symbol === 'function' && Symbol.for) {
|
7796 |
+
var symbolFor = Symbol.for;
|
7797 |
+
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
7798 |
+
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
7799 |
+
REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
|
7800 |
+
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
|
7801 |
+
REACT_PROFILER_TYPE = symbolFor('react.profiler');
|
7802 |
+
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
7803 |
+
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
7804 |
+
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
7805 |
+
REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
|
7806 |
+
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
7807 |
+
REACT_MEMO_TYPE = symbolFor('react.memo');
|
7808 |
+
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
7809 |
+
REACT_BLOCK_TYPE = symbolFor('react.block');
|
7810 |
+
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
7811 |
+
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
7812 |
+
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
7813 |
+
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
7814 |
+
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
7815 |
+
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
7816 |
+
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
7817 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7818 |
|
7819 |
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
7820 |
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
7821 |
+
function getIteratorFn(maybeIterable) {
|
7822 |
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
7823 |
+
return null;
|
7824 |
+
}
|
7825 |
|
7826 |
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
|
|
|
|
|
|
|
7827 |
|
7828 |
+
if (typeof maybeIterator === 'function') {
|
7829 |
+
return maybeIterator;
|
7830 |
+
}
|
|
|
7831 |
|
7832 |
+
return null;
|
7833 |
+
}
|
7834 |
|
7835 |
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
7836 |
+
// replaying on render function. This currently only patches the object
|
7837 |
+
// lazily which won't cover if the log function was extracted eagerly.
|
7838 |
+
// We could also eagerly patch the method.
|
7839 |
+
var disabledDepth = 0;
|
7840 |
+
var prevLog;
|
7841 |
+
var prevInfo;
|
7842 |
+
var prevWarn;
|
7843 |
+
var prevError;
|
7844 |
+
var prevGroup;
|
7845 |
+
var prevGroupCollapsed;
|
7846 |
+
var prevGroupEnd;
|
7847 |
|
7848 |
+
function disabledLog() {}
|
7849 |
|
7850 |
+
disabledLog.__reactDisabledLog = true;
|
7851 |
+
function disableLogs() {
|
7852 |
+
{
|
7853 |
+
if (disabledDepth === 0) {
|
7854 |
+
/* eslint-disable react-internal/no-production-logging */
|
7855 |
+
prevLog = console.log;
|
7856 |
+
prevInfo = console.info;
|
7857 |
+
prevWarn = console.warn;
|
7858 |
+
prevError = console.error;
|
7859 |
+
prevGroup = console.group;
|
7860 |
+
prevGroupCollapsed = console.groupCollapsed;
|
7861 |
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
7862 |
|
7863 |
+
var props = {
|
7864 |
+
configurable: true,
|
7865 |
+
enumerable: true,
|
7866 |
+
value: disabledLog,
|
7867 |
+
writable: true
|
7868 |
+
}; // $FlowFixMe Flow thinks console is immutable.
|
7869 |
+
|
7870 |
+
Object.defineProperties(console, {
|
7871 |
+
info: props,
|
7872 |
+
log: props,
|
7873 |
+
warn: props,
|
7874 |
+
error: props,
|
7875 |
+
group: props,
|
7876 |
+
groupCollapsed: props,
|
7877 |
+
groupEnd: props
|
7878 |
+
});
|
7879 |
+
/* eslint-enable react-internal/no-production-logging */
|
7880 |
}
|
7881 |
|
7882 |
+
disabledDepth++;
|
7883 |
+
}
|
7884 |
+
}
|
7885 |
+
function reenableLogs() {
|
7886 |
+
{
|
7887 |
+
disabledDepth--;
|
7888 |
|
7889 |
+
if (disabledDepth === 0) {
|
7890 |
+
/* eslint-disable react-internal/no-production-logging */
|
7891 |
+
var props = {
|
7892 |
+
configurable: true,
|
7893 |
+
enumerable: true,
|
7894 |
+
writable: true
|
7895 |
+
}; // $FlowFixMe Flow thinks console is immutable.
|
7896 |
|
7897 |
+
Object.defineProperties(console, {
|
7898 |
+
log: _assign({}, props, {
|
7899 |
+
value: prevLog
|
7900 |
+
}),
|
7901 |
+
info: _assign({}, props, {
|
7902 |
+
value: prevInfo
|
7903 |
+
}),
|
7904 |
+
warn: _assign({}, props, {
|
7905 |
+
value: prevWarn
|
7906 |
+
}),
|
7907 |
+
error: _assign({}, props, {
|
7908 |
+
value: prevError
|
7909 |
+
}),
|
7910 |
+
group: _assign({}, props, {
|
7911 |
+
value: prevGroup
|
7912 |
+
}),
|
7913 |
+
groupCollapsed: _assign({}, props, {
|
7914 |
+
value: prevGroupCollapsed
|
7915 |
+
}),
|
7916 |
+
groupEnd: _assign({}, props, {
|
7917 |
+
value: prevGroupEnd
|
7918 |
+
})
|
7919 |
+
});
|
7920 |
+
/* eslint-enable react-internal/no-production-logging */
|
7921 |
+
}
|
7922 |
|
7923 |
+
if (disabledDepth < 0) {
|
7924 |
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
7925 |
+
}
|
7926 |
+
}
|
7927 |
+
}
|
7928 |
|
7929 |
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
7930 |
+
var prefix;
|
7931 |
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
7932 |
+
{
|
7933 |
+
if (prefix === undefined) {
|
7934 |
+
// Extract the VM specific prefix used by each line.
|
7935 |
+
try {
|
7936 |
+
throw Error();
|
7937 |
+
} catch (x) {
|
7938 |
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
7939 |
+
prefix = match && match[1] || '';
|
7940 |
}
|
7941 |
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
7942 |
+
|
7943 |
+
|
7944 |
+
return '\n' + prefix + name;
|
7945 |
}
|
7946 |
+
}
|
7947 |
+
var reentry = false;
|
7948 |
+
var componentFrameCache;
|
7949 |
|
7950 |
+
{
|
7951 |
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
7952 |
+
componentFrameCache = new PossiblyWeakMap();
|
7953 |
}
|
7954 |
|
7955 |
+
function describeNativeComponentFrame(fn, construct) {
|
7956 |
+
// If something asked for a stack inside a fake render, it should get ignored.
|
7957 |
+
if (!fn || reentry) {
|
7958 |
+
return '';
|
7959 |
+
}
|
7960 |
+
|
7961 |
{
|
7962 |
+
var frame = componentFrameCache.get(fn);
|
7963 |
|
7964 |
+
if (frame !== undefined) {
|
7965 |
+
return frame;
|
7966 |
+
}
|
7967 |
+
}
|
7968 |
|
7969 |
+
var control;
|
7970 |
+
reentry = true;
|
7971 |
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
7972 |
+
|
7973 |
+
Error.prepareStackTrace = undefined;
|
7974 |
+
var previousDispatcher;
|
7975 |
+
|
7976 |
+
{
|
7977 |
+
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
7978 |
+
// for warnings.
|
7979 |
+
|
7980 |
+
ReactCurrentDispatcher.current = null;
|
7981 |
+
disableLogs();
|
7982 |
+
}
|
7983 |
+
|
7984 |
+
try {
|
7985 |
+
// This should throw.
|
7986 |
+
if (construct) {
|
7987 |
+
// Something should be setting the props in the constructor.
|
7988 |
+
var Fake = function () {
|
7989 |
+
throw Error();
|
7990 |
+
}; // $FlowFixMe
|
7991 |
+
|
7992 |
+
|
7993 |
+
Object.defineProperty(Fake.prototype, 'props', {
|
7994 |
+
set: function () {
|
7995 |
+
// We use a throwing setter instead of frozen or non-writable props
|
7996 |
+
// because that won't throw in a non-strict mode function.
|
7997 |
+
throw Error();
|
7998 |
+
}
|
7999 |
+
});
|
8000 |
+
|
8001 |
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
8002 |
+
// We construct a different control for this case to include any extra
|
8003 |
+
// frames added by the construct call.
|
8004 |
+
try {
|
8005 |
+
Reflect.construct(Fake, []);
|
8006 |
+
} catch (x) {
|
8007 |
+
control = x;
|
8008 |
+
}
|
8009 |
+
|
8010 |
+
Reflect.construct(fn, [], Fake);
|
8011 |
+
} else {
|
8012 |
+
try {
|
8013 |
+
Fake.call();
|
8014 |
+
} catch (x) {
|
8015 |
+
control = x;
|
8016 |
+
}
|
8017 |
+
|
8018 |
+
fn.call(Fake.prototype);
|
8019 |
+
}
|
8020 |
+
} else {
|
8021 |
+
try {
|
8022 |
+
throw Error();
|
8023 |
+
} catch (x) {
|
8024 |
+
control = x;
|
8025 |
}
|
8026 |
+
|
8027 |
+
fn();
|
8028 |
}
|
8029 |
+
} catch (sample) {
|
8030 |
+
// This is inlined manually because closure doesn't do it for us.
|
8031 |
+
if (sample && control && typeof sample.stack === 'string') {
|
8032 |
+
// This extracts the first frame from the sample that isn't also in the control.
|
8033 |
+
// Skipping one frame that we assume is the frame that calls the two.
|
8034 |
+
var sampleLines = sample.stack.split('\n');
|
8035 |
+
var controlLines = control.stack.split('\n');
|
8036 |
+
var s = sampleLines.length - 1;
|
8037 |
+
var c = controlLines.length - 1;
|
8038 |
|
8039 |
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
8040 |
+
// We expect at least one stack frame to be shared.
|
8041 |
+
// Typically this will be the root most one. However, stack frames may be
|
8042 |
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
8043 |
+
// earlier than the other. We assume that the sample is longer or the same
|
8044 |
+
// and there for cut off earlier. So we should find the root most frame in
|
8045 |
+
// the sample somewhere in the control.
|
8046 |
+
c--;
|
8047 |
+
}
|
8048 |
|
8049 |
+
for (; s >= 1 && c >= 0; s--, c--) {
|
8050 |
+
// Next we find the first one that isn't the same which should be the
|
8051 |
+
// frame that called our sample function and the control.
|
8052 |
+
if (sampleLines[s] !== controlLines[c]) {
|
8053 |
+
// In V8, the first line is describing the message but other VMs don't.
|
8054 |
+
// If we're about to return the first line, and the control is also on the same
|
8055 |
+
// line, that's a pretty good indicator that our sample threw at same line as
|
8056 |
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
8057 |
+
// This can happen if you passed a class to function component, or non-function.
|
8058 |
+
if (s !== 1 || c !== 1) {
|
8059 |
+
do {
|
8060 |
+
s--;
|
8061 |
+
c--; // We may still have similar intermediate frames from the construct call.
|
8062 |
+
// The next one that isn't the same should be our match though.
|
8063 |
+
|
8064 |
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
8065 |
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
8066 |
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
8067 |
+
|
8068 |
+
{
|
8069 |
+
if (typeof fn === 'function') {
|
8070 |
+
componentFrameCache.set(fn, _frame);
|
8071 |
+
}
|
8072 |
+
} // Return the line we found.
|
8073 |
+
|
8074 |
+
|
8075 |
+
return _frame;
|
8076 |
+
}
|
8077 |
+
} while (s >= 1 && c >= 0);
|
8078 |
+
}
|
8079 |
+
|
8080 |
+
break;
|
8081 |
+
}
|
8082 |
+
}
|
8083 |
+
}
|
8084 |
+
} finally {
|
8085 |
+
reentry = false;
|
8086 |
+
|
8087 |
+
{
|
8088 |
+
ReactCurrentDispatcher.current = previousDispatcher;
|
8089 |
+
reenableLogs();
|
8090 |
+
}
|
8091 |
+
|
8092 |
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
8093 |
+
} // Fallback to just using the name if we couldn't make it throw.
|
8094 |
+
|
8095 |
+
|
8096 |
+
var name = fn ? fn.displayName || fn.name : '';
|
8097 |
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
8098 |
+
|
8099 |
+
{
|
8100 |
+
if (typeof fn === 'function') {
|
8101 |
+
componentFrameCache.set(fn, syntheticFrame);
|
8102 |
}
|
8103 |
}
|
8104 |
+
|
8105 |
+
return syntheticFrame;
|
8106 |
}
|
8107 |
|
8108 |
+
function describeClassComponentFrame(ctor, source, ownerFn) {
|
8109 |
+
{
|
8110 |
+
return describeNativeComponentFrame(ctor, true);
|
8111 |
+
}
|
8112 |
+
}
|
8113 |
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
8114 |
+
{
|
8115 |
+
return describeNativeComponentFrame(fn, false);
|
8116 |
}
|
8117 |
+
}
|
8118 |
|
8119 |
+
function shouldConstruct(Component) {
|
8120 |
+
var prototype = Component.prototype;
|
8121 |
+
return !!(prototype && prototype.isReactComponent);
|
8122 |
}
|
8123 |
|
8124 |
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
8125 |
+
|
8126 |
+
if (type == null) {
|
8127 |
+
return '';
|
8128 |
+
}
|
8129 |
+
|
8130 |
+
if (typeof type === 'function') {
|
8131 |
+
{
|
8132 |
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
8133 |
}
|
8134 |
+
}
|
8135 |
|
8136 |
+
if (typeof type === 'string') {
|
8137 |
+
return describeBuiltInComponentFrame(type);
|
8138 |
+
}
|
8139 |
|
8140 |
+
switch (type) {
|
8141 |
+
case REACT_SUSPENSE_TYPE:
|
8142 |
+
return describeBuiltInComponentFrame('Suspense');
|
8143 |
+
|
8144 |
+
case REACT_SUSPENSE_LIST_TYPE:
|
8145 |
+
return describeBuiltInComponentFrame('SuspenseList');
|
8146 |
+
}
|
8147 |
+
|
8148 |
+
if (typeof type === 'object') {
|
8149 |
+
switch (type.$$typeof) {
|
8150 |
+
case REACT_FORWARD_REF_TYPE:
|
8151 |
+
return describeFunctionComponentFrame(type.render);
|
8152 |
+
|
8153 |
+
case REACT_MEMO_TYPE:
|
8154 |
+
// Memo may contain any component type so we recursively resolve it.
|
8155 |
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
8156 |
+
|
8157 |
+
case REACT_BLOCK_TYPE:
|
8158 |
+
return describeFunctionComponentFrame(type._render);
|
8159 |
+
|
8160 |
+
case REACT_LAZY_TYPE:
|
8161 |
+
{
|
8162 |
+
var lazyComponent = type;
|
8163 |
+
var payload = lazyComponent._payload;
|
8164 |
+
var init = lazyComponent._init;
|
8165 |
+
|
8166 |
+
try {
|
8167 |
+
// Lazy may contain any component type so we recursively resolve it.
|
8168 |
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
8169 |
+
} catch (x) {}
|
8170 |
+
}
|
8171 |
}
|
8172 |
}
|
8173 |
+
|
8174 |
+
return '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8175 |
}
|
8176 |
|
8177 |
function describeFiber(fiber) {
|
23418 |
},
|
23419 |
useState: function (initialState) {
|
23420 |
currentHookNameInDev = 'useState';
|
23421 |
+
updateHookTypesDev();
|
23422 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23423 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
23424 |
+
|
23425 |
+
try {
|
23426 |
+
return mountState(initialState);
|
23427 |
+
} finally {
|
23428 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23429 |
+
}
|
23430 |
+
},
|
23431 |
+
useDebugValue: function (value, formatterFn) {
|
23432 |
+
currentHookNameInDev = 'useDebugValue';
|
23433 |
+
updateHookTypesDev();
|
23434 |
+
return mountDebugValue();
|
23435 |
+
},
|
23436 |
+
useDeferredValue: function (value) {
|
23437 |
+
currentHookNameInDev = 'useDeferredValue';
|
23438 |
+
updateHookTypesDev();
|
23439 |
+
return mountDeferredValue(value);
|
23440 |
+
},
|
23441 |
+
useTransition: function () {
|
23442 |
+
currentHookNameInDev = 'useTransition';
|
23443 |
+
updateHookTypesDev();
|
23444 |
+
return mountTransition();
|
23445 |
+
},
|
23446 |
+
useMutableSource: function (source, getSnapshot, subscribe) {
|
23447 |
+
currentHookNameInDev = 'useMutableSource';
|
23448 |
+
updateHookTypesDev();
|
23449 |
+
return mountMutableSource(source, getSnapshot, subscribe);
|
23450 |
+
},
|
23451 |
+
useOpaqueIdentifier: function () {
|
23452 |
+
currentHookNameInDev = 'useOpaqueIdentifier';
|
23453 |
+
updateHookTypesDev();
|
23454 |
+
return mountOpaqueIdentifier();
|
23455 |
+
},
|
23456 |
+
unstable_isNewReconciler: enableNewReconciler
|
23457 |
+
};
|
23458 |
+
HooksDispatcherOnUpdateInDEV = {
|
23459 |
+
readContext: function (context, observedBits) {
|
23460 |
+
return readContext(context, observedBits);
|
23461 |
+
},
|
23462 |
+
useCallback: function (callback, deps) {
|
23463 |
+
currentHookNameInDev = 'useCallback';
|
23464 |
+
updateHookTypesDev();
|
23465 |
+
return updateCallback(callback, deps);
|
23466 |
+
},
|
23467 |
+
useContext: function (context, observedBits) {
|
23468 |
+
currentHookNameInDev = 'useContext';
|
23469 |
+
updateHookTypesDev();
|
23470 |
+
return readContext(context, observedBits);
|
23471 |
+
},
|
23472 |
+
useEffect: function (create, deps) {
|
23473 |
+
currentHookNameInDev = 'useEffect';
|
23474 |
+
updateHookTypesDev();
|
23475 |
+
return updateEffect(create, deps);
|
23476 |
+
},
|
23477 |
+
useImperativeHandle: function (ref, create, deps) {
|
23478 |
+
currentHookNameInDev = 'useImperativeHandle';
|
23479 |
+
updateHookTypesDev();
|
23480 |
+
return updateImperativeHandle(ref, create, deps);
|
23481 |
+
},
|
23482 |
+
useLayoutEffect: function (create, deps) {
|
23483 |
+
currentHookNameInDev = 'useLayoutEffect';
|
23484 |
+
updateHookTypesDev();
|
23485 |
+
return updateLayoutEffect(create, deps);
|
23486 |
+
},
|
23487 |
+
useMemo: function (create, deps) {
|
23488 |
+
currentHookNameInDev = 'useMemo';
|
23489 |
+
updateHookTypesDev();
|
23490 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23491 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23492 |
+
|
23493 |
+
try {
|
23494 |
+
return updateMemo(create, deps);
|
23495 |
+
} finally {
|
23496 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23497 |
+
}
|
23498 |
+
},
|
23499 |
+
useReducer: function (reducer, initialArg, init) {
|
23500 |
+
currentHookNameInDev = 'useReducer';
|
23501 |
+
updateHookTypesDev();
|
23502 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23503 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23504 |
+
|
23505 |
+
try {
|
23506 |
+
return updateReducer(reducer, initialArg, init);
|
23507 |
+
} finally {
|
23508 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23509 |
+
}
|
23510 |
+
},
|
23511 |
+
useRef: function (initialValue) {
|
23512 |
+
currentHookNameInDev = 'useRef';
|
23513 |
+
updateHookTypesDev();
|
23514 |
+
return updateRef();
|
23515 |
+
},
|
23516 |
+
useState: function (initialState) {
|
23517 |
+
currentHookNameInDev = 'useState';
|
23518 |
+
updateHookTypesDev();
|
23519 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23520 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23521 |
+
|
23522 |
+
try {
|
23523 |
+
return updateState(initialState);
|
23524 |
+
} finally {
|
23525 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23526 |
+
}
|
23527 |
+
},
|
23528 |
+
useDebugValue: function (value, formatterFn) {
|
23529 |
+
currentHookNameInDev = 'useDebugValue';
|
23530 |
+
updateHookTypesDev();
|
23531 |
+
return updateDebugValue();
|
23532 |
+
},
|
23533 |
+
useDeferredValue: function (value) {
|
23534 |
+
currentHookNameInDev = 'useDeferredValue';
|
23535 |
+
updateHookTypesDev();
|
23536 |
+
return updateDeferredValue(value);
|
23537 |
+
},
|
23538 |
+
useTransition: function () {
|
23539 |
+
currentHookNameInDev = 'useTransition';
|
23540 |
+
updateHookTypesDev();
|
23541 |
+
return updateTransition();
|
23542 |
+
},
|
23543 |
+
useMutableSource: function (source, getSnapshot, subscribe) {
|
23544 |
+
currentHookNameInDev = 'useMutableSource';
|
23545 |
+
updateHookTypesDev();
|
23546 |
+
return updateMutableSource(source, getSnapshot, subscribe);
|
23547 |
+
},
|
23548 |
+
useOpaqueIdentifier: function () {
|
23549 |
+
currentHookNameInDev = 'useOpaqueIdentifier';
|
23550 |
+
updateHookTypesDev();
|
23551 |
+
return updateOpaqueIdentifier();
|
23552 |
+
},
|
23553 |
+
unstable_isNewReconciler: enableNewReconciler
|
23554 |
+
};
|
23555 |
+
HooksDispatcherOnRerenderInDEV = {
|
23556 |
+
readContext: function (context, observedBits) {
|
23557 |
+
return readContext(context, observedBits);
|
23558 |
+
},
|
23559 |
+
useCallback: function (callback, deps) {
|
23560 |
+
currentHookNameInDev = 'useCallback';
|
23561 |
+
updateHookTypesDev();
|
23562 |
+
return updateCallback(callback, deps);
|
23563 |
+
},
|
23564 |
+
useContext: function (context, observedBits) {
|
23565 |
+
currentHookNameInDev = 'useContext';
|
23566 |
+
updateHookTypesDev();
|
23567 |
+
return readContext(context, observedBits);
|
23568 |
+
},
|
23569 |
+
useEffect: function (create, deps) {
|
23570 |
+
currentHookNameInDev = 'useEffect';
|
23571 |
+
updateHookTypesDev();
|
23572 |
+
return updateEffect(create, deps);
|
23573 |
+
},
|
23574 |
+
useImperativeHandle: function (ref, create, deps) {
|
23575 |
+
currentHookNameInDev = 'useImperativeHandle';
|
23576 |
+
updateHookTypesDev();
|
23577 |
+
return updateImperativeHandle(ref, create, deps);
|
23578 |
+
},
|
23579 |
+
useLayoutEffect: function (create, deps) {
|
23580 |
+
currentHookNameInDev = 'useLayoutEffect';
|
23581 |
+
updateHookTypesDev();
|
23582 |
+
return updateLayoutEffect(create, deps);
|
23583 |
+
},
|
23584 |
+
useMemo: function (create, deps) {
|
23585 |
+
currentHookNameInDev = 'useMemo';
|
23586 |
+
updateHookTypesDev();
|
23587 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23588 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
|
23589 |
+
|
23590 |
+
try {
|
23591 |
+
return updateMemo(create, deps);
|
23592 |
+
} finally {
|
23593 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23594 |
+
}
|
23595 |
+
},
|
23596 |
+
useReducer: function (reducer, initialArg, init) {
|
23597 |
+
currentHookNameInDev = 'useReducer';
|
23598 |
+
updateHookTypesDev();
|
23599 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23600 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
|
23601 |
+
|
23602 |
+
try {
|
23603 |
+
return rerenderReducer(reducer, initialArg, init);
|
23604 |
+
} finally {
|
23605 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23606 |
+
}
|
23607 |
+
},
|
23608 |
+
useRef: function (initialValue) {
|
23609 |
+
currentHookNameInDev = 'useRef';
|
23610 |
+
updateHookTypesDev();
|
23611 |
+
return updateRef();
|
23612 |
+
},
|
23613 |
+
useState: function (initialState) {
|
23614 |
+
currentHookNameInDev = 'useState';
|
23615 |
+
updateHookTypesDev();
|
23616 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23617 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
|
23618 |
+
|
23619 |
+
try {
|
23620 |
+
return rerenderState(initialState);
|
23621 |
+
} finally {
|
23622 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23623 |
+
}
|
23624 |
+
},
|
23625 |
+
useDebugValue: function (value, formatterFn) {
|
23626 |
+
currentHookNameInDev = 'useDebugValue';
|
23627 |
+
updateHookTypesDev();
|
23628 |
+
return updateDebugValue();
|
23629 |
+
},
|
23630 |
+
useDeferredValue: function (value) {
|
23631 |
+
currentHookNameInDev = 'useDeferredValue';
|
23632 |
+
updateHookTypesDev();
|
23633 |
+
return rerenderDeferredValue(value);
|
23634 |
+
},
|
23635 |
+
useTransition: function () {
|
23636 |
+
currentHookNameInDev = 'useTransition';
|
23637 |
+
updateHookTypesDev();
|
23638 |
+
return rerenderTransition();
|
23639 |
+
},
|
23640 |
+
useMutableSource: function (source, getSnapshot, subscribe) {
|
23641 |
+
currentHookNameInDev = 'useMutableSource';
|
23642 |
+
updateHookTypesDev();
|
23643 |
+
return updateMutableSource(source, getSnapshot, subscribe);
|
23644 |
+
},
|
23645 |
+
useOpaqueIdentifier: function () {
|
23646 |
+
currentHookNameInDev = 'useOpaqueIdentifier';
|
23647 |
+
updateHookTypesDev();
|
23648 |
+
return rerenderOpaqueIdentifier();
|
23649 |
+
},
|
23650 |
+
unstable_isNewReconciler: enableNewReconciler
|
23651 |
+
};
|
23652 |
+
InvalidNestedHooksDispatcherOnMountInDEV = {
|
23653 |
+
readContext: function (context, observedBits) {
|
23654 |
+
warnInvalidContextAccess();
|
23655 |
+
return readContext(context, observedBits);
|
23656 |
+
},
|
23657 |
+
useCallback: function (callback, deps) {
|
23658 |
+
currentHookNameInDev = 'useCallback';
|
23659 |
+
warnInvalidHookAccess();
|
23660 |
+
mountHookTypesDev();
|
23661 |
+
return mountCallback(callback, deps);
|
23662 |
+
},
|
23663 |
+
useContext: function (context, observedBits) {
|
23664 |
+
currentHookNameInDev = 'useContext';
|
23665 |
+
warnInvalidHookAccess();
|
23666 |
+
mountHookTypesDev();
|
23667 |
+
return readContext(context, observedBits);
|
23668 |
+
},
|
23669 |
+
useEffect: function (create, deps) {
|
23670 |
+
currentHookNameInDev = 'useEffect';
|
23671 |
+
warnInvalidHookAccess();
|
23672 |
+
mountHookTypesDev();
|
23673 |
+
return mountEffect(create, deps);
|
23674 |
+
},
|
23675 |
+
useImperativeHandle: function (ref, create, deps) {
|
23676 |
+
currentHookNameInDev = 'useImperativeHandle';
|
23677 |
+
warnInvalidHookAccess();
|
23678 |
+
mountHookTypesDev();
|
23679 |
+
return mountImperativeHandle(ref, create, deps);
|
23680 |
+
},
|
23681 |
+
useLayoutEffect: function (create, deps) {
|
23682 |
+
currentHookNameInDev = 'useLayoutEffect';
|
23683 |
+
warnInvalidHookAccess();
|
23684 |
+
mountHookTypesDev();
|
23685 |
+
return mountLayoutEffect(create, deps);
|
23686 |
+
},
|
23687 |
+
useMemo: function (create, deps) {
|
23688 |
+
currentHookNameInDev = 'useMemo';
|
23689 |
+
warnInvalidHookAccess();
|
23690 |
+
mountHookTypesDev();
|
23691 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23692 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
23693 |
+
|
23694 |
+
try {
|
23695 |
+
return mountMemo(create, deps);
|
23696 |
+
} finally {
|
23697 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23698 |
+
}
|
23699 |
+
},
|
23700 |
+
useReducer: function (reducer, initialArg, init) {
|
23701 |
+
currentHookNameInDev = 'useReducer';
|
23702 |
+
warnInvalidHookAccess();
|
23703 |
+
mountHookTypesDev();
|
23704 |
+
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23705 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
23706 |
+
|
23707 |
+
try {
|
23708 |
+
return mountReducer(reducer, initialArg, init);
|
23709 |
+
} finally {
|
23710 |
+
ReactCurrentDispatcher$1.current = prevDispatcher;
|
23711 |
+
}
|
23712 |
+
},
|
23713 |
+
useRef: function (initialValue) {
|
23714 |
+
currentHookNameInDev = 'useRef';
|
23715 |
+
warnInvalidHookAccess();
|
23716 |
+
mountHookTypesDev();
|
23717 |
+
return mountRef(initialValue);
|
23718 |
+
},
|
23719 |
+
useState: function (initialState) {
|
23720 |
+
currentHookNameInDev = 'useState';
|
23721 |
+
warnInvalidHookAccess();
|
23722 |
+
mountHookTypesDev();
|
23723 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23724 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
23725 |
|
23731 |
},
|
23732 |
useDebugValue: function (value, formatterFn) {
|
23733 |
currentHookNameInDev = 'useDebugValue';
|
23734 |
+
warnInvalidHookAccess();
|
23735 |
+
mountHookTypesDev();
|
23736 |
return mountDebugValue();
|
23737 |
},
|
23738 |
useDeferredValue: function (value) {
|
23739 |
currentHookNameInDev = 'useDeferredValue';
|
23740 |
+
warnInvalidHookAccess();
|
23741 |
+
mountHookTypesDev();
|
23742 |
return mountDeferredValue(value);
|
23743 |
},
|
23744 |
useTransition: function () {
|
23745 |
currentHookNameInDev = 'useTransition';
|
23746 |
+
warnInvalidHookAccess();
|
23747 |
+
mountHookTypesDev();
|
23748 |
return mountTransition();
|
23749 |
},
|
23750 |
useMutableSource: function (source, getSnapshot, subscribe) {
|
23751 |
currentHookNameInDev = 'useMutableSource';
|
23752 |
+
warnInvalidHookAccess();
|
23753 |
+
mountHookTypesDev();
|
23754 |
return mountMutableSource(source, getSnapshot, subscribe);
|
23755 |
},
|
23756 |
useOpaqueIdentifier: function () {
|
23757 |
currentHookNameInDev = 'useOpaqueIdentifier';
|
23758 |
+
warnInvalidHookAccess();
|
23759 |
+
mountHookTypesDev();
|
23760 |
return mountOpaqueIdentifier();
|
23761 |
},
|
23762 |
unstable_isNewReconciler: enableNewReconciler
|
23763 |
};
|
23764 |
+
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
23765 |
readContext: function (context, observedBits) {
|
23766 |
+
warnInvalidContextAccess();
|
23767 |
return readContext(context, observedBits);
|
23768 |
},
|
23769 |
useCallback: function (callback, deps) {
|
23770 |
currentHookNameInDev = 'useCallback';
|
23771 |
+
warnInvalidHookAccess();
|
23772 |
updateHookTypesDev();
|
23773 |
return updateCallback(callback, deps);
|
23774 |
},
|
23775 |
useContext: function (context, observedBits) {
|
23776 |
currentHookNameInDev = 'useContext';
|
23777 |
+
warnInvalidHookAccess();
|
23778 |
updateHookTypesDev();
|
23779 |
return readContext(context, observedBits);
|
23780 |
},
|
23781 |
useEffect: function (create, deps) {
|
23782 |
currentHookNameInDev = 'useEffect';
|
23783 |
+
warnInvalidHookAccess();
|
23784 |
updateHookTypesDev();
|
23785 |
return updateEffect(create, deps);
|
23786 |
},
|
23787 |
useImperativeHandle: function (ref, create, deps) {
|
23788 |
currentHookNameInDev = 'useImperativeHandle';
|
23789 |
+
warnInvalidHookAccess();
|
23790 |
updateHookTypesDev();
|
23791 |
return updateImperativeHandle(ref, create, deps);
|
23792 |
},
|
23793 |
useLayoutEffect: function (create, deps) {
|
23794 |
currentHookNameInDev = 'useLayoutEffect';
|
23795 |
+
warnInvalidHookAccess();
|
23796 |
updateHookTypesDev();
|
23797 |
return updateLayoutEffect(create, deps);
|
23798 |
},
|
23799 |
useMemo: function (create, deps) {
|
23800 |
currentHookNameInDev = 'useMemo';
|
23801 |
+
warnInvalidHookAccess();
|
23802 |
updateHookTypesDev();
|
23803 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23804 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23811 |
},
|
23812 |
useReducer: function (reducer, initialArg, init) {
|
23813 |
currentHookNameInDev = 'useReducer';
|
23814 |
+
warnInvalidHookAccess();
|
23815 |
updateHookTypesDev();
|
23816 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23817 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23824 |
},
|
23825 |
useRef: function (initialValue) {
|
23826 |
currentHookNameInDev = 'useRef';
|
23827 |
+
warnInvalidHookAccess();
|
23828 |
updateHookTypesDev();
|
23829 |
return updateRef();
|
23830 |
},
|
23831 |
useState: function (initialState) {
|
23832 |
currentHookNameInDev = 'useState';
|
23833 |
+
warnInvalidHookAccess();
|
23834 |
updateHookTypesDev();
|
23835 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23836 |
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23843 |
},
|
23844 |
useDebugValue: function (value, formatterFn) {
|
23845 |
currentHookNameInDev = 'useDebugValue';
|
23846 |
+
warnInvalidHookAccess();
|
23847 |
updateHookTypesDev();
|
23848 |
return updateDebugValue();
|
23849 |
},
|
23850 |
useDeferredValue: function (value) {
|
23851 |
currentHookNameInDev = 'useDeferredValue';
|
23852 |
+
warnInvalidHookAccess();
|
23853 |
updateHookTypesDev();
|
23854 |
return updateDeferredValue(value);
|
23855 |
},
|
23856 |
useTransition: function () {
|
23857 |
currentHookNameInDev = 'useTransition';
|
23858 |
+
warnInvalidHookAccess();
|
23859 |
updateHookTypesDev();
|
23860 |
return updateTransition();
|
23861 |
},
|
23862 |
useMutableSource: function (source, getSnapshot, subscribe) {
|
23863 |
currentHookNameInDev = 'useMutableSource';
|
23864 |
+
warnInvalidHookAccess();
|
23865 |
updateHookTypesDev();
|
23866 |
return updateMutableSource(source, getSnapshot, subscribe);
|
23867 |
},
|
23868 |
useOpaqueIdentifier: function () {
|
23869 |
currentHookNameInDev = 'useOpaqueIdentifier';
|
23870 |
+
warnInvalidHookAccess();
|
23871 |
updateHookTypesDev();
|
23872 |
return updateOpaqueIdentifier();
|
23873 |
},
|
23874 |
unstable_isNewReconciler: enableNewReconciler
|
23875 |
};
|
23876 |
+
InvalidNestedHooksDispatcherOnRerenderInDEV = {
|
23877 |
readContext: function (context, observedBits) {
|
23878 |
+
warnInvalidContextAccess();
|
23879 |
return readContext(context, observedBits);
|
23880 |
},
|
23881 |
useCallback: function (callback, deps) {
|
23882 |
currentHookNameInDev = 'useCallback';
|
23883 |
+
warnInvalidHookAccess();
|
23884 |
updateHookTypesDev();
|
23885 |
return updateCallback(callback, deps);
|
23886 |
},
|
23887 |
useContext: function (context, observedBits) {
|
23888 |
currentHookNameInDev = 'useContext';
|
23889 |
+
warnInvalidHookAccess();
|
23890 |
updateHookTypesDev();
|
23891 |
return readContext(context, observedBits);
|
23892 |
},
|
23893 |
useEffect: function (create, deps) {
|
23894 |
currentHookNameInDev = 'useEffect';
|
23895 |
+
warnInvalidHookAccess();
|
23896 |
updateHookTypesDev();
|
23897 |
return updateEffect(create, deps);
|
23898 |
},
|
23899 |
useImperativeHandle: function (ref, create, deps) {
|
23900 |
currentHookNameInDev = 'useImperativeHandle';
|
23901 |
+
warnInvalidHookAccess();
|
23902 |
updateHookTypesDev();
|
23903 |
return updateImperativeHandle(ref, create, deps);
|
23904 |
},
|
23905 |
useLayoutEffect: function (create, deps) {
|
23906 |
currentHookNameInDev = 'useLayoutEffect';
|
23907 |
+
warnInvalidHookAccess();
|
23908 |
updateHookTypesDev();
|
23909 |
return updateLayoutEffect(create, deps);
|
23910 |
},
|
23911 |
useMemo: function (create, deps) {
|
23912 |
currentHookNameInDev = 'useMemo';
|
23913 |
+
warnInvalidHookAccess();
|
23914 |
updateHookTypesDev();
|
23915 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23916 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23917 |
|
23918 |
try {
|
23919 |
return updateMemo(create, deps);
|
23923 |
},
|
23924 |
useReducer: function (reducer, initialArg, init) {
|
23925 |
currentHookNameInDev = 'useReducer';
|
23926 |
+
warnInvalidHookAccess();
|
23927 |
updateHookTypesDev();
|
23928 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23929 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23930 |
|
23931 |
try {
|
23932 |
return rerenderReducer(reducer, initialArg, init);
|
23936 |
},
|
23937 |
useRef: function (initialValue) {
|
23938 |
currentHookNameInDev = 'useRef';
|
23939 |
+
warnInvalidHookAccess();
|
23940 |
updateHookTypesDev();
|
23941 |
return updateRef();
|
23942 |
},
|
23943 |
useState: function (initialState) {
|
23944 |
currentHookNameInDev = 'useState';
|
23945 |
+
warnInvalidHookAccess();
|
23946 |
updateHookTypesDev();
|
23947 |
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
23948 |
+
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
23949 |
|
23950 |
try {
|
23951 |
return rerenderState(initialState);
|
23955 |
},
|
23956 |
useDebugValue: function (value, formatterFn) {
|
23957 |
currentHookNameInDev = 'useDebugValue';
|
23958 |
+
warnInvalidHookAccess();
|
23959 |
updateHookTypesDev();
|
23960 |
return updateDebugValue();
|
23961 |
},
|
23962 |
useDeferredValue: function (value) {
|
23963 |
currentHookNameInDev = 'useDeferredValue';
|
23964 |
+
warnInvalidHookAccess();
|
23965 |
updateHookTypesDev();
|
23966 |
return rerenderDeferredValue(value);
|
23967 |
},
|
23968 |
useTransition: function () {
|
23969 |
currentHookNameInDev = 'useTransition';
|
23970 |
+
warnInvalidHookAccess();
|
23971 |
updateHookTypesDev();
|
23972 |
return rerenderTransition();
|
23973 |
},
|
23974 |
useMutableSource: function (source, getSnapshot, subscribe) {
|
23975 |
currentHookNameInDev = 'useMutableSource';
|
23976 |
+
warnInvalidHookAccess();
|
23977 |
updateHookTypesDev();
|
23978 |
return updateMutableSource(source, getSnapshot, subscribe);
|
23979 |
},
|
23980 |
useOpaqueIdentifier: function () {
|
23981 |
currentHookNameInDev = 'useOpaqueIdentifier';
|
23982 |
+
warnInvalidHookAccess();
|
23983 |
updateHookTypesDev();
|
23984 |
return rerenderOpaqueIdentifier();
|
23985 |
},
|
23986 |
unstable_isNewReconciler: enableNewReconciler
|
23987 |
};
|
23988 |
+
}
|
23989 |
+
|
23990 |
+
var now$1 = Scheduler.unstable_now;
|
23991 |
+
var commitTime = 0;
|
23992 |
+
var profilerStartTime = -1;
|
23993 |
+
|
23994 |
+
function getCommitTime() {
|
23995 |
+
return commitTime;
|
23996 |
+
}
|
23997 |
+
|
23998 |
+
function recordCommitTime() {
|
23999 |
+
|
24000 |
+
commitTime = now$1();
|
24001 |
+
}
|
24002 |
+
|
24003 |
+
function startProfilerTimer(fiber) {
|
24004 |
+
|
24005 |
+
profilerStartTime = now$1();
|
24006 |
+
|
24007 |
+
if (fiber.actualStartTime < 0) {
|
24008 |
+
fiber.actualStartTime = now$1();
|
24009 |
+
}
|
24010 |
+
}
|
24011 |
+
|
24012 |
+
function stopProfilerTimerIfRunning(fiber) {
|
24013 |
+
|
24014 |
+
profilerStartTime = -1;
|
24015 |
+
}
|
24016 |
+
|
24017 |
+
function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
24018 |
+
|
24019 |
+
if (profilerStartTime >= 0) {
|
24020 |
+
var elapsedTime = now$1() - profilerStartTime;
|
24021 |
+
fiber.actualDuration += elapsedTime;
|
24022 |
+
|
24023 |
+
if (overrideBaseTime) {
|
24024 |
+
fiber.selfBaseDuration = elapsedTime;
|
24025 |
+
}
|
24026 |
+
|
24027 |
+
profilerStartTime = -1;
|
24028 |
+
}
|
24029 |
+
}
|
24030 |
+
|
24031 |
+
function transferActualDuration(fiber) {
|
24032 |
+
// Transfer time spent rendering these children so we don't lose it
|
24033 |
+
// after we rerender. This is used as a helper in special cases
|
24034 |
+
// where we should count the work of multiple passes.
|
24035 |
+
var child = fiber.child;
|
24036 |
+
|
24037 |
+
while (child) {
|
24038 |
+
fiber.actualDuration += child.actualDuration;
|
24039 |
+
child = child.sibling;
|
24040 |
+
}
|
24041 |
+
}
|
24042 |
+
|
24043 |
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
24044 |
+
var didReceiveUpdate = false;
|
24045 |
+
var didWarnAboutBadClass;
|
24046 |
+
var didWarnAboutModulePatternComponent;
|
24047 |
+
var didWarnAboutContextTypeOnFunctionComponent;
|
24048 |
+
var didWarnAboutGetDerivedStateOnFunctionComponent;
|
24049 |
+
var didWarnAboutFunctionRefs;
|
24050 |
+
var didWarnAboutReassigningProps;
|
24051 |
+
var didWarnAboutRevealOrder;
|
24052 |
+
var didWarnAboutTailOptions;
|
24053 |
+
|
24054 |
+
{
|
24055 |
+
didWarnAboutBadClass = {};
|
24056 |
+
didWarnAboutModulePatternComponent = {};
|
24057 |
+
didWarnAboutContextTypeOnFunctionComponent = {};
|
24058 |
+
didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
24059 |
+
didWarnAboutFunctionRefs = {};
|
24060 |
+
didWarnAboutReassigningProps = false;
|
24061 |
+
didWarnAboutRevealOrder = {};
|
24062 |
+
didWarnAboutTailOptions = {};
|
24063 |
+
}
|
24064 |
+
|
24065 |
+
function reconcileChildren(current, workInProgress, nextChildren, renderLanes) {
|
24066 |
+
if (current === null) {
|
24067 |
+
// If this is a fresh new component that hasn't been rendered yet, we
|
24068 |
+
// won't update its child set by applying minimal side-effects. Instead,
|
24069 |
+
// we will add them all to the child before it gets rendered. That means
|
24070 |
+
// we can optimize this reconciliation pass by not tracking side-effects.
|
24071 |
+
workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderLanes);
|
24072 |
+
} else {
|
24073 |
+
// If the current child is the same as the work in progress, it means that
|
24074 |
+
// we haven't yet started any work on these children. Therefore, we use
|
24075 |
+
// the clone algorithm to create a copy of all the current children.
|
24076 |
+
// If we had any progressed work already, that is invalid at this point so
|
24077 |
+
// let's throw it out.
|
24078 |
+
workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes);
|
24079 |
+
}
|
24080 |
+
}
|
24081 |
+
|
24082 |
+
function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes) {
|
24083 |
+
// This function is fork of reconcileChildren. It's used in cases where we
|
24084 |
+
// want to reconcile without matching against the existing set. This has the
|
24085 |
+
// effect of all current children being unmounted; even if the type and key
|
24086 |
+
// are the same, the old child is unmounted and a new child is created.
|
24087 |
+
//
|
24088 |
+
// To do this, we're going to go through the reconcile algorithm twice. In
|
24089 |
+
// the first pass, we schedule a deletion for all the current children by
|
24090 |
+
// passing null.
|
24091 |
+
workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes); // In the second pass, we mount the new children. The trick here is that we
|
24092 |
+
// pass null in place of where we usually pass the current child set. This has
|
24093 |
+
// the effect of remounting all children regardless of whether their
|
24094 |
+
// identities match.
|
24095 |
+
|
24096 |
+
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes);
|
24097 |
+
}
|
24098 |
+
|
24099 |
+
function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) {
|
24100 |
+
// TODO: current can be non-null here even if the component
|
24101 |
+
// hasn't yet mounted. This happens after the first render suspends.
|
24102 |
+
// We'll need to figure out if this is fine or can cause issues.
|
24103 |
+
{
|
24104 |
+
if (workInProgress.type !== workInProgress.elementType) {
|
24105 |
+
// Lazy component props can't be validated in createElement
|
24106 |
+
// because they're only guaranteed to be resolved here.
|
24107 |
+
var innerPropTypes = Component.propTypes;
|
24108 |
+
|
24109 |
+
if (innerPropTypes) {
|
24110 |
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
24111 |
+
'prop', getComponentName(Component));
|
24112 |
+
}
|
24113 |
+
}
|
24114 |
+
}
|
24115 |
+
|
24116 |
+
var render = Component.render;
|
24117 |
+
var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent
|
24118 |
+
|
24119 |
+
var nextChildren;
|
24120 |
+
prepareToReadContext(workInProgress, renderLanes);
|
24121 |
+
|
24122 |
+
{
|
24123 |
+
ReactCurrentOwner$1.current = workInProgress;
|
24124 |
+
setIsRendering(true);
|
24125 |
+
nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes);
|
24126 |
+
|
24127 |
+
if ( workInProgress.mode & StrictMode) {
|
24128 |
+
disableLogs();
|
24129 |
+
|
24130 |
+
try {
|
24131 |
+
nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes);
|
24132 |
+
} finally {
|
24133 |
+
reenableLogs();
|
24134 |
+
}
|
24135 |
+
}
|
24136 |
+
|
24137 |
+
setIsRendering(false);
|
24138 |
+
}
|
24139 |
+
|
24140 |
+
if (current !== null && !didReceiveUpdate) {
|
24141 |
+
bailoutHooks(current, workInProgress, renderLanes);
|
24142 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
24143 |
+
} // React DevTools reads this flag.
|
24144 |
+
|
24145 |
+
|
24146 |
+
workInProgress.flags |= PerformedWork;
|
24147 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24148 |
+
return workInProgress.child;
|
24149 |
+
}
|
24150 |
+
|
24151 |
+
function updateMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) {
|
24152 |
+
if (current === null) {
|
24153 |
+
var type = Component.type;
|
24154 |
+
|
24155 |
+
if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either.
|
24156 |
+
Component.defaultProps === undefined) {
|
24157 |
+
var resolvedType = type;
|
24158 |
+
|
24159 |
+
{
|
24160 |
+
resolvedType = resolveFunctionForHotReloading(type);
|
24161 |
+
} // If this is a plain function component without default props,
|
24162 |
+
// and with only the default shallow comparison, we upgrade it
|
24163 |
+
// to a SimpleMemoComponent to allow fast path updates.
|
24164 |
+
|
24165 |
+
|
24166 |
+
workInProgress.tag = SimpleMemoComponent;
|
24167 |
+
workInProgress.type = resolvedType;
|
24168 |
+
|
24169 |
+
{
|
24170 |
+
validateFunctionComponentInDev(workInProgress, type);
|
24171 |
+
}
|
24172 |
+
|
24173 |
+
return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateLanes, renderLanes);
|
24174 |
+
}
|
24175 |
+
|
24176 |
+
{
|
24177 |
+
var innerPropTypes = type.propTypes;
|
24178 |
+
|
24179 |
+
if (innerPropTypes) {
|
24180 |
+
// Inner memo component props aren't currently validated in createElement.
|
24181 |
+
// We could move it there, but we'd still need this for lazy code path.
|
24182 |
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
24183 |
+
'prop', getComponentName(type));
|
24184 |
+
}
|
24185 |
+
}
|
24186 |
+
|
24187 |
+
var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes);
|
24188 |
+
child.ref = workInProgress.ref;
|
24189 |
+
child.return = workInProgress;
|
24190 |
+
workInProgress.child = child;
|
24191 |
+
return child;
|
24192 |
+
}
|
24193 |
+
|
24194 |
+
{
|
24195 |
+
var _type = Component.type;
|
24196 |
+
var _innerPropTypes = _type.propTypes;
|
24197 |
+
|
24198 |
+
if (_innerPropTypes) {
|
24199 |
+
// Inner memo component props aren't currently validated in createElement.
|
24200 |
+
// We could move it there, but we'd still need this for lazy code path.
|
24201 |
+
checkPropTypes(_innerPropTypes, nextProps, // Resolved props
|
24202 |
+
'prop', getComponentName(_type));
|
24203 |
+
}
|
24204 |
+
}
|
24205 |
+
|
24206 |
+
var currentChild = current.child; // This is always exactly one child
|
24207 |
+
|
24208 |
+
if (!includesSomeLane(updateLanes, renderLanes)) {
|
24209 |
+
// This will be the props with resolved defaultProps,
|
24210 |
+
// unlike current.memoizedProps which will be the unresolved ones.
|
24211 |
+
var prevProps = currentChild.memoizedProps; // Default to shallow comparison
|
24212 |
+
|
24213 |
+
var compare = Component.compare;
|
24214 |
+
compare = compare !== null ? compare : shallowEqual;
|
24215 |
+
|
24216 |
+
if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) {
|
24217 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
24218 |
+
}
|
24219 |
+
} // React DevTools reads this flag.
|
24220 |
+
|
24221 |
+
|
24222 |
+
workInProgress.flags |= PerformedWork;
|
24223 |
+
var newChild = createWorkInProgress(currentChild, nextProps);
|
24224 |
+
newChild.ref = workInProgress.ref;
|
24225 |
+
newChild.return = workInProgress;
|
24226 |
+
workInProgress.child = newChild;
|
24227 |
+
return newChild;
|
24228 |
+
}
|
24229 |
+
|
24230 |
+
function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) {
|
24231 |
+
// TODO: current can be non-null here even if the component
|
24232 |
+
// hasn't yet mounted. This happens when the inner render suspends.
|
24233 |
+
// We'll need to figure out if this is fine or can cause issues.
|
24234 |
+
{
|
24235 |
+
if (workInProgress.type !== workInProgress.elementType) {
|
24236 |
+
// Lazy component props can't be validated in createElement
|
24237 |
+
// because they're only guaranteed to be resolved here.
|
24238 |
+
var outerMemoType = workInProgress.elementType;
|
24239 |
+
|
24240 |
+
if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
|
24241 |
+
// We warn when you define propTypes on lazy()
|
24242 |
+
// so let's just skip over it to find memo() outer wrapper.
|
24243 |
+
// Inner props for memo are validated later.
|
24244 |
+
var lazyComponent = outerMemoType;
|
24245 |
+
var payload = lazyComponent._payload;
|
24246 |
+
var init = lazyComponent._init;
|
24247 |
+
|
24248 |
+
try {
|
24249 |
+
outerMemoType = init(payload);
|
24250 |
+
} catch (x) {
|
24251 |
+
outerMemoType = null;
|
24252 |
+
} // Inner propTypes will be validated in the function component path.
|
24253 |
+
|
24254 |
+
|
24255 |
+
var outerPropTypes = outerMemoType && outerMemoType.propTypes;
|
24256 |
+
|
24257 |
+
if (outerPropTypes) {
|
24258 |
+
checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
|
24259 |
+
'prop', getComponentName(outerMemoType));
|
24260 |
+
}
|
24261 |
+
}
|
24262 |
+
}
|
24263 |
+
}
|
24264 |
+
|
24265 |
+
if (current !== null) {
|
24266 |
+
var prevProps = current.memoizedProps;
|
24267 |
+
|
24268 |
+
if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload.
|
24269 |
+
workInProgress.type === current.type )) {
|
24270 |
+
didReceiveUpdate = false;
|
24271 |
+
|
24272 |
+
if (!includesSomeLane(renderLanes, updateLanes)) {
|
24273 |
+
// The pending lanes were cleared at the beginning of beginWork. We're
|
24274 |
+
// about to bail out, but there might be other lanes that weren't
|
24275 |
+
// included in the current render. Usually, the priority level of the
|
24276 |
+
// remaining updates is accumlated during the evaluation of the
|
24277 |
+
// component (i.e. when processing the update queue). But since since
|
24278 |
+
// we're bailing out early *without* evaluating the component, we need
|
24279 |
+
// to account for it here, too. Reset to the value of the current fiber.
|
24280 |
+
// NOTE: This only applies to SimpleMemoComponent, not MemoComponent,
|
24281 |
+
// because a MemoComponent fiber does not have hooks or an update queue;
|
24282 |
+
// rather, it wraps around an inner component, which may or may not
|
24283 |
+
// contains hooks.
|
24284 |
+
// TODO: Move the reset at in beginWork out of the common path so that
|
24285 |
+
// this is no longer necessary.
|
24286 |
+
workInProgress.lanes = current.lanes;
|
24287 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
24288 |
+
} else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
24289 |
+
// This is a special case that only exists for legacy mode.
|
24290 |
+
// See https://github.com/facebook/react/pull/19216.
|
24291 |
+
didReceiveUpdate = true;
|
24292 |
+
}
|
24293 |
+
}
|
24294 |
+
}
|
24295 |
+
|
24296 |
+
return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes);
|
24297 |
+
}
|
24298 |
+
|
24299 |
+
function updateOffscreenComponent(current, workInProgress, renderLanes) {
|
24300 |
+
var nextProps = workInProgress.pendingProps;
|
24301 |
+
var nextChildren = nextProps.children;
|
24302 |
+
var prevState = current !== null ? current.memoizedState : null;
|
24303 |
+
|
24304 |
+
if (nextProps.mode === 'hidden' || nextProps.mode === 'unstable-defer-without-hiding') {
|
24305 |
+
if ((workInProgress.mode & ConcurrentMode) === NoMode) {
|
24306 |
+
// In legacy sync mode, don't defer the subtree. Render it now.
|
24307 |
+
// TODO: Figure out what we should do in Blocking mode.
|
24308 |
+
var nextState = {
|
24309 |
+
baseLanes: NoLanes
|
24310 |
+
};
|
24311 |
+
workInProgress.memoizedState = nextState;
|
24312 |
+
pushRenderLanes(workInProgress, renderLanes);
|
24313 |
+
} else if (!includesSomeLane(renderLanes, OffscreenLane)) {
|
24314 |
+
var nextBaseLanes;
|
24315 |
+
|
24316 |
+
if (prevState !== null) {
|
24317 |
+
var prevBaseLanes = prevState.baseLanes;
|
24318 |
+
nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes);
|
24319 |
+
} else {
|
24320 |
+
nextBaseLanes = renderLanes;
|
24321 |
+
} // Schedule this fiber to re-render at offscreen priority. Then bailout.
|
24322 |
+
|
24323 |
+
|
24324 |
+
{
|
24325 |
+
markSpawnedWork(OffscreenLane);
|
24326 |
+
}
|
24327 |
+
|
24328 |
+
workInProgress.lanes = workInProgress.childLanes = laneToLanes(OffscreenLane);
|
24329 |
+
var _nextState = {
|
24330 |
+
baseLanes: nextBaseLanes
|
24331 |
+
};
|
24332 |
+
workInProgress.memoizedState = _nextState; // We're about to bail out, but we need to push this to the stack anyway
|
24333 |
+
// to avoid a push/pop misalignment.
|
24334 |
+
|
24335 |
+
pushRenderLanes(workInProgress, nextBaseLanes);
|
24336 |
+
return null;
|
24337 |
+
} else {
|
24338 |
+
// Rendering at offscreen, so we can clear the base lanes.
|
24339 |
+
var _nextState2 = {
|
24340 |
+
baseLanes: NoLanes
|
24341 |
+
};
|
24342 |
+
workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out.
|
24343 |
+
|
24344 |
+
var subtreeRenderLanes = prevState !== null ? prevState.baseLanes : renderLanes;
|
24345 |
+
pushRenderLanes(workInProgress, subtreeRenderLanes);
|
24346 |
+
}
|
24347 |
+
} else {
|
24348 |
+
var _subtreeRenderLanes;
|
24349 |
+
|
24350 |
+
if (prevState !== null) {
|
24351 |
+
_subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes); // Since we're not hidden anymore, reset the state
|
24352 |
+
|
24353 |
+
workInProgress.memoizedState = null;
|
24354 |
+
} else {
|
24355 |
+
// We weren't previously hidden, and we still aren't, so there's nothing
|
24356 |
+
// special to do. Need to push to the stack regardless, though, to avoid
|
24357 |
+
// a push/pop misalignment.
|
24358 |
+
_subtreeRenderLanes = renderLanes;
|
24359 |
+
}
|
24360 |
+
|
24361 |
+
pushRenderLanes(workInProgress, _subtreeRenderLanes);
|
24362 |
+
}
|
24363 |
+
|
24364 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24365 |
+
return workInProgress.child;
|
24366 |
+
} // Note: These happen to have identical begin phases, for now. We shouldn't hold
|
24367 |
+
// ourselves to this constraint, though. If the behavior diverges, we should
|
24368 |
+
// fork the function.
|
24369 |
+
|
24370 |
+
|
24371 |
+
var updateLegacyHiddenComponent = updateOffscreenComponent;
|
24372 |
+
|
24373 |
+
function updateFragment(current, workInProgress, renderLanes) {
|
24374 |
+
var nextChildren = workInProgress.pendingProps;
|
24375 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24376 |
+
return workInProgress.child;
|
24377 |
+
}
|
24378 |
+
|
24379 |
+
function updateMode(current, workInProgress, renderLanes) {
|
24380 |
+
var nextChildren = workInProgress.pendingProps.children;
|
24381 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24382 |
+
return workInProgress.child;
|
24383 |
+
}
|
24384 |
+
|
24385 |
+
function updateProfiler(current, workInProgress, renderLanes) {
|
24386 |
+
{
|
24387 |
+
workInProgress.flags |= Update; // Reset effect durations for the next eventual effect phase.
|
24388 |
+
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
24389 |
+
|
24390 |
+
var stateNode = workInProgress.stateNode;
|
24391 |
+
stateNode.effectDuration = 0;
|
24392 |
+
stateNode.passiveEffectDuration = 0;
|
24393 |
+
}
|
24394 |
+
|
24395 |
+
var nextProps = workInProgress.pendingProps;
|
24396 |
+
var nextChildren = nextProps.children;
|
24397 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24398 |
+
return workInProgress.child;
|
24399 |
+
}
|
24400 |
|
24401 |
+
function markRef(current, workInProgress) {
|
24402 |
+
var ref = workInProgress.ref;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24403 |
|
24404 |
+
if (current === null && ref !== null || current !== null && current.ref !== ref) {
|
24405 |
+
// Schedule a Ref effect
|
24406 |
+
workInProgress.flags |= Ref;
|
24407 |
+
}
|
24408 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24409 |
|
24410 |
+
function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) {
|
24411 |
+
{
|
24412 |
+
if (workInProgress.type !== workInProgress.elementType) {
|
24413 |
+
// Lazy component props can't be validated in createElement
|
24414 |
+
// because they're only guaranteed to be resolved here.
|
24415 |
+
var innerPropTypes = Component.propTypes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24416 |
|
24417 |
+
if (innerPropTypes) {
|
24418 |
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
24419 |
+
'prop', getComponentName(Component));
|
|
|
24420 |
}
|
24421 |
+
}
|
24422 |
+
}
|
|
|
|
|
|
|
|
|
|
|
24423 |
|
24424 |
+
var context;
|
24425 |
+
|
24426 |
+
{
|
24427 |
+
var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
|
24428 |
+
context = getMaskedContext(workInProgress, unmaskedContext);
|
24429 |
+
}
|
24430 |
+
|
24431 |
+
var nextChildren;
|
24432 |
+
prepareToReadContext(workInProgress, renderLanes);
|
24433 |
+
|
24434 |
+
{
|
24435 |
+
ReactCurrentOwner$1.current = workInProgress;
|
24436 |
+
setIsRendering(true);
|
24437 |
+
nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes);
|
24438 |
+
|
24439 |
+
if ( workInProgress.mode & StrictMode) {
|
24440 |
+
disableLogs();
|
|
|
24441 |
|
24442 |
try {
|
24443 |
+
nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes);
|
24444 |
} finally {
|
24445 |
+
reenableLogs();
|
24446 |
}
|
24447 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24448 |
|
24449 |
+
setIsRendering(false);
|
24450 |
+
}
|
24451 |
+
|
24452 |
+
if (current !== null && !didReceiveUpdate) {
|
24453 |
+
bailoutHooks(current, workInProgress, renderLanes);
|
24454 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
24455 |
+
} // React DevTools reads this flag.
|
24456 |
+
|
24457 |
+
|
24458 |
+
workInProgress.flags |= PerformedWork;
|
24459 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24460 |
+
return workInProgress.child;
|
24461 |
+
}
|
24462 |
+
|
24463 |
+
function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) {
|
24464 |
+
{
|
24465 |
+
if (workInProgress.type !== workInProgress.elementType) {
|
24466 |
+
// Lazy component props can't be validated in createElement
|
24467 |
+
// because they're only guaranteed to be resolved here.
|
24468 |
+
var innerPropTypes = Component.propTypes;
|
24469 |
+
|
24470 |
+
if (innerPropTypes) {
|
24471 |
+
checkPropTypes(innerPropTypes, nextProps, // Resolved props
|
24472 |
+
'prop', getComponentName(Component));
|
24473 |
}
|
24474 |
+
}
|
24475 |
+
} // Push context providers early to prevent context stack mismatches.
|
24476 |
+
// During mounting we don't know the child context yet as the instance doesn't exist.
|
24477 |
+
// We will invalidate the child context in finishClassComponent() right after rendering.
|
|
|
|
|
|
|
24478 |
|
24479 |
+
|
24480 |
+
var hasContext;
|
24481 |
+
|
24482 |
+
if (isContextProvider(Component)) {
|
24483 |
+
hasContext = true;
|
24484 |
+
pushContextProvider(workInProgress);
|
24485 |
+
} else {
|
24486 |
+
hasContext = false;
|
24487 |
+
}
|
24488 |
+
|
24489 |
+
prepareToReadContext(workInProgress, renderLanes);
|
24490 |
+
var instance = workInProgress.stateNode;
|
24491 |
+
var shouldUpdate;
|
24492 |
+
|
24493 |
+
if (instance === null) {
|
24494 |
+
if (current !== null) {
|
24495 |
+
// A class component without an instance only mounts if it suspended
|
24496 |
+
// inside a non-concurrent tree, in an inconsistent state. We want to
|
24497 |
+
// treat it like a new mount, even though an empty version of it already
|
24498 |
+
// committed. Disconnect the alternate pointers.
|
24499 |
+
current.alternate = null;
|
24500 |
+
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
24501 |
+
|
24502 |
+
workInProgress.flags |= Placement;
|
24503 |
+
} // In the initial pass we might need to construct the instance.
|
24504 |
+
|
24505 |
+
|
24506 |
+
constructClassInstance(workInProgress, Component, nextProps);
|
24507 |
+
mountClassInstance(workInProgress, Component, nextProps, renderLanes);
|
24508 |
+
shouldUpdate = true;
|
24509 |
+
} else if (current === null) {
|
24510 |
+
// In a resume, we'll already have an instance we can reuse.
|
24511 |
+
shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderLanes);
|
24512 |
+
} else {
|
24513 |
+
shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderLanes);
|
24514 |
+
}
|
24515 |
+
|
24516 |
+
var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes);
|
24517 |
+
|
24518 |
+
{
|
24519 |
+
var inst = workInProgress.stateNode;
|
24520 |
+
|
24521 |
+
if (shouldUpdate && inst.props !== nextProps) {
|
24522 |
+
if (!didWarnAboutReassigningProps) {
|
24523 |
+
error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component');
|
24524 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24525 |
|
24526 |
+
didWarnAboutReassigningProps = true;
|
24527 |
+
}
|
24528 |
+
}
|
24529 |
+
|
24530 |
+
return nextUnitOfWork;
|
24531 |
+
}
|
24532 |
+
|
24533 |
+
function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) {
|
24534 |
+
// Refs should update even if shouldComponentUpdate returns false
|
24535 |
+
markRef(current, workInProgress);
|
24536 |
+
var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags;
|
24537 |
+
|
24538 |
+
if (!shouldUpdate && !didCaptureError) {
|
24539 |
+
// Context providers should defer to sCU for rendering
|
24540 |
+
if (hasContext) {
|
24541 |
+
invalidateContextProvider(workInProgress, Component, false);
|
24542 |
+
}
|
24543 |
+
|
24544 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
24545 |
+
}
|
24546 |
+
|
24547 |
+
var instance = workInProgress.stateNode; // Rerender
|
24548 |
+
|
24549 |
+
ReactCurrentOwner$1.current = workInProgress;
|
24550 |
+
var nextChildren;
|
24551 |
+
|
24552 |
+
if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
|
24553 |
+
// If we captured an error, but getDerivedStateFromError is not defined,
|
24554 |
+
// unmount all the children. componentDidCatch will schedule an update to
|
24555 |
+
// re-render a fallback. This is temporary until we migrate everyone to
|
24556 |
+
// the new API.
|
24557 |
+
// TODO: Warn in a future release.
|
24558 |
+
nextChildren = null;
|
24559 |
+
|
24560 |
+
{
|
24561 |
+
stopProfilerTimerIfRunning();
|
24562 |
+
}
|
24563 |
+
} else {
|
24564 |
+
{
|
24565 |
+
setIsRendering(true);
|
24566 |
+
nextChildren = instance.render();
|
24567 |
+
|
24568 |
+
if ( workInProgress.mode & StrictMode) {
|
24569 |
+
disableLogs();
|
24570 |
+
|
24571 |
+
try {
|
24572 |
+
instance.render();
|
24573 |
+
} finally {
|
24574 |
+
reenableLogs();
|
24575 |
+
}
|
24576 |
}
|
24577 |
+
|
24578 |
+
setIsRendering(false);
|
24579 |
+
}
|
24580 |
+
} // React DevTools reads this flag.
|
24581 |
+
|
24582 |
+
|
24583 |
+
workInProgress.flags |= PerformedWork;
|
24584 |
+
|
24585 |
+
if (current !== null && didCaptureError) {
|
24586 |
+
// If we're recovering from an error, reconcile without reusing any of
|
24587 |
+
// the existing children. Conceptually, the normal children and the children
|
24588 |
+
// that are shown on error are two different sets, so we shouldn't reuse
|
24589 |
+
// normal children even if their identities match.
|
24590 |
+
forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes);
|
24591 |
+
} else {
|
24592 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24593 |
+
} // Memoize state using the values we just used to render.
|
24594 |
+
// TODO: Restructure so we never read values from the instance.
|
24595 |
+
|
24596 |
+
|
24597 |
+
workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it.
|
24598 |
+
|
24599 |
+
if (hasContext) {
|
24600 |
+
invalidateContextProvider(workInProgress, Component, true);
|
24601 |
+
}
|
24602 |
+
|
24603 |
+
return workInProgress.child;
|
24604 |
+
}
|
24605 |
+
|
24606 |
+
function pushHostRootContext(workInProgress) {
|
24607 |
+
var root = workInProgress.stateNode;
|
24608 |
+
|
24609 |
+
if (root.pendingContext) {
|
24610 |
+
pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
|
24611 |
+
} else if (root.context) {
|
24612 |
+
// Should always be set
|
24613 |
+
pushTopLevelContextObject(workInProgress, root.context, false);
|
24614 |
+
}
|
24615 |
+
|
24616 |
+
pushHostContainer(workInProgress, root.containerInfo);
|
24617 |
}
|
24618 |
|
24619 |
+
function updateHostRoot(current, workInProgress, renderLanes) {
|
24620 |
+
pushHostRootContext(workInProgress);
|
24621 |
+
var updateQueue = workInProgress.updateQueue;
|
24622 |
+
|
24623 |
+
if (!(current !== null && updateQueue !== null)) {
|
24624 |
+
{
|
24625 |
+
throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." );
|
24626 |
+
}
|
24627 |
+
}
|
24628 |
+
|
24629 |
+
var nextProps = workInProgress.pendingProps;
|
24630 |
+
var prevState = workInProgress.memoizedState;
|
24631 |
+
var prevChildren = prevState !== null ? prevState.element : null;
|
24632 |
+
cloneUpdateQueue(current, workInProgress);
|
24633 |
+
processUpdateQueue(workInProgress, nextProps, null, renderLanes);
|
24634 |
+
var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property
|
24635 |
+
// being called "element".
|
24636 |
+
|
24637 |
+
var nextChildren = nextState.element;
|
24638 |
+
|
24639 |
+
if (nextChildren === prevChildren) {
|
24640 |
+
resetHydrationState();
|
24641 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
24642 |
+
}
|
24643 |
+
|
24644 |
+
var root = workInProgress.stateNode;
|
24645 |
+
|
24646 |
+
if (root.hydrate && enterHydrationState(workInProgress)) {
|
24647 |
+
// If we don't have any current children this might be the first pass.
|
24648 |
+
// We always try to hydrate. If this isn't a hydration pass there won't
|
24649 |
+
// be any children to hydrate which is effectively the same thing as
|
24650 |
+
// not hydrating.
|
24651 |
+
{
|
24652 |
+
var mutableSourceEagerHydrationData = root.mutableSourceEagerHydrationData;
|
24653 |
+
|
24654 |
+
if (mutableSourceEagerHydrationData != null) {
|
24655 |
+
for (var i = 0; i < mutableSourceEagerHydrationData.length; i += 2) {
|
24656 |
+
var mutableSource = mutableSourceEagerHydrationData[i];
|
24657 |
+
var version = mutableSourceEagerHydrationData[i + 1];
|
24658 |
+
setWorkInProgressVersion(mutableSource, version);
|
24659 |
+
}
|
24660 |
+
}
|
24661 |
+
}
|
24662 |
|
24663 |
+
var child = mountChildFibers(workInProgress, null, nextChildren, renderLanes);
|
24664 |
+
workInProgress.child = child;
|
24665 |
+
var node = child;
|
24666 |
|
24667 |
+
while (node) {
|
24668 |
+
// Mark each child as hydrating. This is a fast path to know whether this
|
24669 |
+
// tree is part of a hydrating tree. This is used to determine if a child
|
24670 |
+
// node has fully mounted yet, and for scheduling event replaying.
|
24671 |
+
// Conceptually this is similar to Placement in that a new subtree is
|
24672 |
+
// inserted into the React tree here. It just happens to not need DOM
|
24673 |
+
// mutations because it already exists.
|
24674 |
+
node.flags = node.flags & ~Placement | Hydrating;
|
24675 |
+
node = node.sibling;
|
24676 |
+
}
|
24677 |
+
} else {
|
24678 |
+
// Otherwise reset hydration state in case we aborted and resumed another
|
24679 |
+
// root.
|
24680 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24681 |
+
resetHydrationState();
|
24682 |
+
}
|
24683 |
|
24684 |
+
return workInProgress.child;
|
24685 |
}
|
24686 |
|
24687 |
+
function updateHostComponent(current, workInProgress, renderLanes) {
|
24688 |
+
pushHostContext(workInProgress);
|
24689 |
|
24690 |
+
if (current === null) {
|
24691 |
+
tryToClaimNextHydratableInstance(workInProgress);
|
24692 |
+
}
|
24693 |
|
24694 |
+
var type = workInProgress.type;
|
24695 |
+
var nextProps = workInProgress.pendingProps;
|
24696 |
+
var prevProps = current !== null ? current.memoizedProps : null;
|
24697 |
+
var nextChildren = nextProps.children;
|
24698 |
+
var isDirectTextChild = shouldSetTextContent(type, nextProps);
|
24699 |
+
|
24700 |
+
if (isDirectTextChild) {
|
24701 |
+
// We special case a direct text child of a host node. This is a common
|
24702 |
+
// case. We won't handle it as a reified child. We will instead handle
|
24703 |
+
// this in the host environment that also has access to this prop. That
|
24704 |
+
// avoids allocating another HostText fiber and traversing it.
|
24705 |
+
nextChildren = null;
|
24706 |
+
} else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
|
24707 |
+
// If we're switching from a direct text child to a normal child, or to
|
24708 |
+
// empty, we need to schedule the text content to be reset.
|
24709 |
+
workInProgress.flags |= ContentReset;
|
24710 |
}
|
24711 |
+
|
24712 |
+
markRef(current, workInProgress);
|
24713 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
24714 |
+
return workInProgress.child;
|
24715 |
}
|
24716 |
|
24717 |
+
function updateHostText(current, workInProgress) {
|
24718 |
+
if (current === null) {
|
24719 |
+
tryToClaimNextHydratableInstance(workInProgress);
|
24720 |
+
} // Nothing to do here. This is terminal. We'll do the completion step
|
24721 |
+
// immediately after.
|
24722 |
|
24723 |
+
|
24724 |
+
return null;
|
24725 |
}
|
24726 |
|
24727 |
+
function mountLazyComponent(_current, workInProgress, elementType, updateLanes, renderLanes) {
|
24728 |
+
if (_current !== null) {
|
24729 |
+
// A lazy component only mounts if it suspended inside a non-
|
24730 |
+
// concurrent tree, in an inconsistent state. We want to treat it like
|
24731 |
+
// a new mount, even though an empty version of it already committed.
|
24732 |
+
// Disconnect the alternate pointers.
|
24733 |
+
_current.alternate = null;
|
24734 |
+
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
24735 |
|
24736 |
+
workInProgress.flags |= Placement;
|
24737 |
+
}
|
|
|
24738 |
|
24739 |
+
var props = workInProgress.pendingProps;
|
24740 |
+
var lazyComponent = elementType;
|
24741 |
+
var payload = lazyComponent._payload;
|
24742 |
+
var init = lazyComponent._init;
|
24743 |
+
var Component = init(payload); // Store the unwrapped component in the type.
|
24744 |
|
24745 |
+
workInProgress.type = Component;
|
24746 |
+
var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
|
24747 |
+
var resolvedProps = resolveDefaultProps(Component, props);
|
24748 |
+
var child;
|
24749 |
+
|
24750 |
+
switch (resolvedTag) {
|
24751 |
+
case FunctionComponent:
|
24752 |
+
{
|
24753 |
+
{
|
24754 |
+
validateFunctionComponentInDev(workInProgress, Component);
|
24755 |
+
workInProgress.type = Component = resolveFunctionForHotReloading(Component);
|
24756 |
+
}
|
24757 |
+
|
24758 |
+
child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderLanes);
|
24759 |
+
return child;
|
24760 |
+
}
|
24761 |
+
|
24762 |
+
case ClassComponent:
|
24763 |
+
{
|
24764 |
+
{
|
24765 |
+
workInProgress.type = Component = resolveClassForHotReloading(Component);
|
24766 |
+
}
|
24767 |
+
|
24768 |
+
child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderLanes);
|
24769 |
+
return child;
|
24770 |
+
}
|
24771 |
+
|
24772 |
+
case ForwardRef:
|
24773 |
+
{
|
24774 |
+
{
|
24775 |
+
workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
|
24776 |
+
}
|
24777 |
+
|
24778 |
+
child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderLanes);
|
24779 |
+
return child;
|
24780 |
+
}
|
24781 |
+
|
24782 |
+
case MemoComponent:
|
24783 |
+
{
|
24784 |
+
{
|
24785 |
+
if (workInProgress.type !== workInProgress.elementType) {
|
24786 |
+
var outerPropTypes = Component.propTypes;
|
24787 |
+
|
24788 |
+
if (outerPropTypes) {
|
24789 |
+
checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only
|
24790 |
+
'prop', getComponentName(Component));
|
24791 |
+
}
|
24792 |
+
}
|
24793 |
+
}
|
24794 |
+
|
24795 |
+
child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
|
24796 |
+
updateLanes, renderLanes);
|
24797 |
+
return child;
|
24798 |
+
}
|
24799 |
}
|
|
|
24800 |
|
24801 |
+
var hint = '';
|
|
|
|
|
|
|
|
|
24802 |
|
24803 |
+
{
|
24804 |
+
if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
|
24805 |
+
hint = ' Did you wrap a component in React.lazy() more than once?';
|
24806 |
+
}
|
24807 |
+
} // This message intentionally doesn't mention ForwardRef or MemoComponent
|
24808 |
+
// because the fact that it's a separate type of work is an
|
24809 |
+
// implementation detail.
|
24810 |
+
|
24811 |
+
|
24812 |
+
{
|
24813 |
+
{
|
24814 |
+
throw Error( "Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint );
|
24815 |
+
}
|
24816 |
}
|
24817 |
}
|
24818 |
|
24819 |
+
function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderLanes) {
|
24820 |
+
if (_current !== null) {
|
24821 |
+
// An incomplete component only mounts if it suspended inside a non-
|
24822 |
+
// concurrent tree, in an inconsistent state. We want to treat it like
|
24823 |
+
// a new mount, even though an empty version of it already committed.
|
24824 |
+
// Disconnect the alternate pointers.
|
24825 |
+
_current.alternate = null;
|
24826 |
+
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
|
|
|
24827 |
|
24828 |
+
workInProgress.flags |= Placement;
|
24829 |
+
} // Promote the fiber to a class and try rendering again.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24830 |
|
24831 |
+
|
24832 |
+
workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent`
|
24833 |
+
// Push context providers early to prevent context stack mismatches.
|
24834 |
+
// During mounting we don't know the child context yet as the instance doesn't exist.
|
24835 |
+
// We will invalidate the child context in finishClassComponent() right after rendering.
|
24836 |
+
|
24837 |
+
var hasContext;
|
24838 |
+
|
24839 |
+
if (isContextProvider(Component)) {
|
24840 |
+
hasContext = true;
|
24841 |
+
pushContextProvider(workInProgress);
|
24842 |
} else {
|
24843 |
+
hasContext = false;
|
|
|
|
|
|
|
|
|
|
|
24844 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24845 |
|
24846 |
+
prepareToReadContext(workInProgress, renderLanes);
|
24847 |
+
constructClassInstance(workInProgress, Component, nextProps);
|
24848 |
+
mountClassInstance(workInProgress, Component, nextProps, renderLanes);
|
24849 |
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes);
|
24850 |
}
|
24851 |
|
24852 |
+
function mountIndeterminateComponent(_current, workInProgress, Component, renderLanes) {
|
24853 |
+
if (_current !== null) {
|
24854 |
+
// An indeterminate component only mounts if it suspended inside a non-
|
24855 |
+
// concurrent tree, in an inconsistent state. We want to treat it like
|
24856 |
+
// a new mount, even though an empty version of it already committed.
|
24857 |
+
// Disconnect the alternate pointers.
|
24858 |
+
_current.alternate = null;
|
24859 |
+
workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
|
|
|
24860 |
|
24861 |
+
workInProgress.flags |= Placement;
|
|
|
|
|
|
|
|
|
24862 |
}
|
24863 |
|
24864 |
+
var props = workInProgress.pendingProps;
|
24865 |
+
var context;
|
24866 |
+
|
24867 |
+
{
|
24868 |
+
var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
|
24869 |
+
context = getMaskedContext(workInProgress, unmaskedContext);
|
24870 |
+
}
|
24871 |
|
|
|
24872 |
prepareToReadContext(workInProgress, renderLanes);
|
24873 |
+
var value;
|
24874 |
|
24875 |
{
|
24876 |
+
if (Component.prototype && typeof Component.prototype.render === 'function') {
|
24877 |
+
var componentName = getComponentName(Component) || 'Unknown';
|
|
|
24878 |
|
24879 |
+
if (!didWarnAboutBadClass[componentName]) {
|
24880 |
+
error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
|
24881 |
|
24882 |
+
didWarnAboutBadClass[componentName] = true;
|
|
|
|
|
|
|
24883 |
}
|
24884 |
}
|
24885 |
|
24886 |
+
if (workInProgress.mode & StrictMode) {
|
24887 |
+
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
|
24888 |
+
}
|
24889 |
|
24890 |
+
setIsRendering(true);
|
24891 |
+
ReactCurrentOwner$1.current = workInProgress;
|
24892 |
+
value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes);
|
24893 |
+
setIsRendering(false);
|
24894 |
} // React DevTools reads this flag.
|
24895 |
|
24896 |
|
24897 |
workInProgress.flags |= PerformedWork;
|
|
|
|
|
|
|
24898 |
|
24899 |
+
{
|
24900 |
+
// Support for module components is deprecated and is removed behind a flag.
|
24901 |
+
// Whether or not it would crash later, we want to show a good message in DEV first.
|
24902 |
+
if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
24903 |
+
var _componentName = getComponentName(Component) || 'Unknown';
|
24904 |
|
24905 |
+
if (!didWarnAboutModulePatternComponent[_componentName]) {
|
24906 |
+
error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
|
|
|
24907 |
|
24908 |
+
didWarnAboutModulePatternComponent[_componentName] = true;
|
24909 |
+
}
|
24910 |
+
}
|
24911 |
+
}
|
|
|
24912 |
|
24913 |
+
if ( // Run these checks in production only if the flag is off.
|
24914 |
+
// Eventually we'll delete this branch altogether.
|
24915 |
+
typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
24916 |
+
{
|
24917 |
+
var _componentName2 = getComponentName(Component) || 'Unknown';
|
24918 |
|
24919 |
+
if (!didWarnAboutModulePatternComponent[_componentName2]) {
|
24920 |
+
error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName2, _componentName2, _componentName2);
|
24921 |
|
24922 |
+
didWarnAboutModulePatternComponent[_componentName2] = true;
|
|
|
24923 |
}
|
24924 |
+
} // Proceed under the assumption that this is a class instance
|
24925 |
|
24926 |
+
|
24927 |
+
workInProgress.tag = ClassComponent; // Throw out any hooks that were used.
|
24928 |
+
|
24929 |
+
workInProgress.memoizedState = null;
|
24930 |
+
workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches.
|
24931 |
+
// During mounting we don't know the child context yet as the instance doesn't exist.
|
24932 |
+
// We will invalidate the child context in finishClassComponent() right after rendering.
|
24933 |
+
|
24934 |
+
var hasContext = false;
|
24935 |
+
|
24936 |
+
if (isContextProvider(Component)) {
|
24937 |
+
hasContext = true;
|
24938 |
+
pushContextProvider(workInProgress);
|
24939 |
+
} else {
|
24940 |
+
hasContext = false;
|
24941 |
+
}
|
24942 |
+
|
24943 |
+
workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
|
24944 |
+
initializeUpdateQueue(workInProgress);
|
24945 |
+
var getDerivedStateFromProps = Component.getDerivedStateFromProps;
|
24946 |
+
|
24947 |
+
if (typeof getDerivedStateFromProps === 'function') {
|
24948 |
+
applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
|
24949 |
}
|
24950 |
|
24951 |
+
adoptClassInstance(workInProgress, value);
|
24952 |
+
mountClassInstance(workInProgress, Component, props, renderLanes);
|
24953 |
+
return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes);
|
24954 |
+
} else {
|
24955 |
+
// Proceed under the assumption that this is a function component
|
24956 |
+
workInProgress.tag = FunctionComponent;
|
24957 |
+
|
24958 |
{
|
|
|
24959 |
|
24960 |
+
if ( workInProgress.mode & StrictMode) {
|
24961 |
+
disableLogs();
|
24962 |
+
|
24963 |
+
try {
|
24964 |
+
value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes);
|
24965 |
+
} finally {
|
24966 |
+
reenableLogs();
|
24967 |
+
}
|
24968 |
}
|
24969 |
}
|
24970 |
|
24971 |
+
reconcileChildren(null, workInProgress, value, renderLanes);
|
24972 |
+
|
24973 |
+
{
|
24974 |
+
validateFunctionComponentInDev(workInProgress, Component);
|
24975 |
+
}
|
24976 |
+
|
24977 |
+
return workInProgress.child;
|
24978 |
}
|
24979 |
+
}
|
24980 |
|
24981 |
+
function validateFunctionComponentInDev(workInProgress, Component) {
|
24982 |
{
|
24983 |
+
if (Component) {
|
24984 |
+
if (Component.childContextTypes) {
|
24985 |
+
error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component');
|
24986 |
+
}
|
24987 |
+
}
|
24988 |
|
24989 |
+
if (workInProgress.ref !== null) {
|
24990 |
+
var info = '';
|
24991 |
+
var ownerName = getCurrentFiberOwnerNameInDevOrNull();
|
24992 |
+
|
24993 |
+
if (ownerName) {
|
24994 |
+
info += '\n\nCheck the render method of `' + ownerName + '`.';
|
24995 |
+
}
|
24996 |
+
|
24997 |
+
var warningKey = ownerName || workInProgress._debugID || '';
|
24998 |
+
var debugSource = workInProgress._debugSource;
|
24999 |
+
|
25000 |
+
if (debugSource) {
|
25001 |
+
warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
|
25002 |
+
}
|
25003 |
+
|
25004 |
+
if (!didWarnAboutFunctionRefs[warningKey]) {
|
25005 |
+
didWarnAboutFunctionRefs[warningKey] = true;
|
25006 |
+
|
25007 |
+
error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
|
25008 |
+
}
|
25009 |
}
|
|
|
25010 |
|
25011 |
+
if (typeof Component.getDerivedStateFromProps === 'function') {
|
25012 |
+
var _componentName3 = getComponentName(Component) || 'Unknown';
|
25013 |
|
25014 |
+
if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) {
|
25015 |
+
error('%s: Function components do not support getDerivedStateFromProps.', _componentName3);
|
|
|
|
|
25016 |
|
25017 |
+
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true;
|
25018 |
+
}
|
25019 |
+
}
|
25020 |
|
25021 |
+
if (typeof Component.contextType === 'object' && Component.contextType !== null) {
|
25022 |
+
var _componentName4 = getComponentName(Component) || 'Unknown';
|
25023 |
+
|
25024 |
+
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
|
25025 |
+
error('%s: Function components do not support contextType.', _componentName4);
|
25026 |
+
|
25027 |
+
didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
|
25028 |
+
}
|
25029 |
}
|
25030 |
+
}
|
25031 |
+
}
|
25032 |
|
25033 |
+
var SUSPENDED_MARKER = {
|
25034 |
+
dehydrated: null,
|
25035 |
+
retryLane: NoLane
|
25036 |
+
};
|
25037 |
|
25038 |
+
function mountSuspenseOffscreenState(renderLanes) {
|
25039 |
+
return {
|
25040 |
+
baseLanes: renderLanes
|
25041 |
+
};
|
|
|
|
|
25042 |
}
|
25043 |
|
25044 |
+
function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) {
|
25045 |
+
return {
|
25046 |
+
baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes)
|
25047 |
+
};
|
25048 |
+
} // TODO: Probably should inline this back
|
25049 |
+
|
25050 |
+
|
25051 |
+
function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) {
|
25052 |
+
// If we're already showing a fallback, there are cases where we need to
|
25053 |
+
// remain on that fallback regardless of whether the content has resolved.
|
25054 |
+
// For example, SuspenseList coordinates when nested content appears.
|
25055 |
+
if (current !== null) {
|
25056 |
+
var suspenseState = current.memoizedState;
|
25057 |
+
|
25058 |
+
if (suspenseState === null) {
|
25059 |
+
// Currently showing content. Don't hide it, even if ForceSuspenseFallack
|
25060 |
+
// is true. More precise name might be "ForceRemainSuspenseFallback".
|
25061 |
+
// Note: This is a factoring smell. Can't remain on a fallback if there's
|
25062 |
+
// no fallback to remain on.
|
25063 |
+
return false;
|
25064 |
+
}
|
25065 |
+
} // Not currently showing content. Consult the Suspense context.
|
25066 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25067 |
|
25068 |
+
return hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
25069 |
+
}
|
|
|
|
|
|
|
25070 |
|
25071 |
+
function getRemainingWorkInPrimaryTree(current, renderLanes) {
|
25072 |
+
// TODO: Should not remove render lanes that were pinged during this render
|
25073 |
+
return removeLanes(current.childLanes, renderLanes);
|
25074 |
+
}
|
25075 |
|
25076 |
+
function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
25077 |
+
var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend.
|
25078 |
|
25079 |
+
{
|
25080 |
+
if (shouldSuspend(workInProgress)) {
|
25081 |
+
workInProgress.flags |= DidCapture;
|
|
|
|
|
25082 |
}
|
25083 |
}
|
25084 |
|
25085 |
+
var suspenseContext = suspenseStackCursor.current;
|
25086 |
+
var showFallback = false;
|
25087 |
+
var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
|
|
|
|
|
|
|
25088 |
|
25089 |
+
if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) {
|
25090 |
+
// Something in this boundary's subtree already suspended. Switch to
|
25091 |
+
// rendering the fallback children.
|
25092 |
+
showFallback = true;
|
25093 |
+
workInProgress.flags &= ~DidCapture;
|
25094 |
+
} else {
|
25095 |
+
// Attempting the main content
|
25096 |
+
if (current === null || current.memoizedState !== null) {
|
25097 |
+
// This is a new mount or this boundary is already showing a fallback state.
|
25098 |
+
// Mark this subtree context as having at least one invisible parent that could
|
25099 |
+
// handle the fallback state.
|
25100 |
+
// Boundaries without fallbacks or should be avoided are not considered since
|
25101 |
+
// they cannot handle preferred fallback states.
|
25102 |
+
if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
|
25103 |
+
suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
|
|
|
|
|
|
|
|
|
|
|
25104 |
}
|
25105 |
}
|
25106 |
}
|
25107 |
|
25108 |
+
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
25109 |
+
pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense
|
25110 |
+
// boundary's children. This involves some custom reconcilation logic. Two
|
25111 |
+
// main reasons this is so complicated.
|
25112 |
+
//
|
25113 |
+
// First, Legacy Mode has different semantics for backwards compatibility. The
|
25114 |
+
// primary tree will commit in an inconsistent state, so when we do the
|
25115 |
+
// second pass to render the fallback, we do some exceedingly, uh, clever
|
25116 |
+
// hacks to make that not totally break. Like transferring effects and
|
25117 |
+
// deletions from hidden tree. In Concurrent Mode, it's much simpler,
|
25118 |
+
// because we bailout on the primary tree completely and leave it in its old
|
25119 |
+
// state, no effects. Same as what we do for Offscreen (except that
|
25120 |
+
// Offscreen doesn't have the first render pass).
|
25121 |
+
//
|
25122 |
+
// Second is hydration. During hydration, the Suspense fiber has a slightly
|
25123 |
+
// different layout, where the child points to a dehydrated fragment, which
|
25124 |
+
// contains the DOM rendered by the server.
|
25125 |
+
//
|
25126 |
+
// Third, even if you set all that aside, Suspense is like error boundaries in
|
25127 |
+
// that we first we try to render one tree, and if that fails, we render again
|
25128 |
+
// and switch to a different tree. Like a try/catch block. So we have to track
|
25129 |
+
// which branch we're currently rendering. Ideally we would model this using
|
25130 |
+
// a stack.
|
25131 |
|
25132 |
+
if (current === null) {
|
25133 |
+
// Initial mount
|
25134 |
+
// If we're currently hydrating, try to hydrate this boundary.
|
25135 |
+
// But only if this has a fallback.
|
25136 |
+
if (nextProps.fallback !== undefined) {
|
25137 |
+
tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
|
25138 |
+
}
|
25139 |
|
25140 |
+
var nextPrimaryChildren = nextProps.children;
|
25141 |
+
var nextFallbackChildren = nextProps.fallback;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25142 |
|
25143 |
+
if (showFallback) {
|
25144 |
+
var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
25145 |
+
var primaryChildFragment = workInProgress.child;
|
25146 |
+
primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
25147 |
+
workInProgress.memoizedState = SUSPENDED_MARKER;
|
25148 |
+
return fallbackFragment;
|
25149 |
+
} else if (typeof nextProps.unstable_expectedLoadTime === 'number') {
|
25150 |
+
// This is a CPU-bound tree. Skip this tree and show a placeholder to
|
25151 |
+
// unblock the surrounding content. Then immediately retry after the
|
25152 |
+
// initial commit.
|
25153 |
+
var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes);
|
25154 |
+
|
25155 |
+
var _primaryChildFragment = workInProgress.child;
|
25156 |
+
_primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
25157 |
+
workInProgress.memoizedState = SUSPENDED_MARKER; // Since nothing actually suspended, there will nothing to ping this to
|
25158 |
+
// get it started back up to attempt the next item. While in terms of
|
25159 |
+
// priority this work has the same priority as this current render, it's
|
25160 |
+
// not part of the same transition once the transition has committed. If
|
25161 |
+
// it's sync, we still want to yield so that it can be painted.
|
25162 |
+
// Conceptually, this is really the same as pinging. We can use any
|
25163 |
+
// RetryLane even if it's the one currently rendering since we're leaving
|
25164 |
+
// it behind on this node.
|
25165 |
|
25166 |
+
workInProgress.lanes = SomeRetryLane;
|
25167 |
|
25168 |
{
|
25169 |
+
markSpawnedWork(SomeRetryLane);
|
25170 |
}
|
25171 |
|
25172 |
+
return _fallbackFragment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25173 |
} else {
|
25174 |
+
return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren, renderLanes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25175 |
}
|
25176 |
} else {
|
25177 |
+
// This is an update.
|
25178 |
+
// If the current fiber has a SuspenseState, that means it's already showing
|
25179 |
+
// a fallback.
|
25180 |
+
var prevState = current.memoizedState;
|
25181 |
|
25182 |
if (prevState !== null) {
|
|
|
25183 |
|
25184 |
+
if (showFallback) {
|
25185 |
+
var _nextFallbackChildren2 = nextProps.fallback;
|
25186 |
+
var _nextPrimaryChildren2 = nextProps.children;
|
|
|
|
|
|
|
|
|
25187 |
|
25188 |
+
var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes);
|
|
|
25189 |
|
25190 |
+
var _primaryChildFragment3 = workInProgress.child;
|
25191 |
+
var prevOffscreenState = current.child.memoizedState;
|
25192 |
+
_primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes);
|
25193 |
+
_primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes);
|
25194 |
+
workInProgress.memoizedState = SUSPENDED_MARKER;
|
25195 |
+
return _fallbackChildFragment;
|
25196 |
+
} else {
|
25197 |
+
var _nextPrimaryChildren3 = nextProps.children;
|
25198 |
|
25199 |
+
var _primaryChildFragment4 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren3, renderLanes);
|
25200 |
|
25201 |
+
workInProgress.memoizedState = null;
|
25202 |
+
return _primaryChildFragment4;
|
25203 |
+
}
|
25204 |
+
} else {
|
25205 |
+
// The current tree is not already showing a fallback.
|
25206 |
+
if (showFallback) {
|
25207 |
+
// Timed out.
|
25208 |
+
var _nextFallbackChildren3 = nextProps.fallback;
|
25209 |
+
var _nextPrimaryChildren4 = nextProps.children;
|
25210 |
|
25211 |
+
var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes);
|
|
|
|
|
|
|
|
|
25212 |
|
25213 |
+
var _primaryChildFragment5 = workInProgress.child;
|
25214 |
+
var _prevOffscreenState = current.child.memoizedState;
|
25215 |
+
_primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes);
|
25216 |
+
_primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the
|
25217 |
+
// fallback children.
|
25218 |
|
25219 |
+
workInProgress.memoizedState = SUSPENDED_MARKER;
|
25220 |
+
return _fallbackChildFragment2;
|
25221 |
+
} else {
|
25222 |
+
// Still haven't timed out. Continue rendering the children, like we
|
25223 |
+
// normally do.
|
25224 |
+
var _nextPrimaryChildren5 = nextProps.children;
|
25225 |
|
25226 |
+
var _primaryChildFragment6 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren5, renderLanes);
|
|
|
|
|
|
|
25227 |
|
25228 |
+
workInProgress.memoizedState = null;
|
25229 |
+
return _primaryChildFragment6;
|
25230 |
+
}
|
25231 |
+
}
|
25232 |
+
}
|
25233 |
}
|
25234 |
|
25235 |
+
function mountSuspensePrimaryChildren(workInProgress, primaryChildren, renderLanes) {
|
25236 |
+
var mode = workInProgress.mode;
|
25237 |
+
var primaryChildProps = {
|
25238 |
+
mode: 'visible',
|
25239 |
+
children: primaryChildren
|
25240 |
+
};
|
25241 |
+
var primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, renderLanes, null);
|
25242 |
+
primaryChildFragment.return = workInProgress;
|
25243 |
+
workInProgress.child = primaryChildFragment;
|
25244 |
+
return primaryChildFragment;
|
25245 |
}
|
25246 |
|
25247 |
+
function mountSuspenseFallbackChildren(workInProgress, primaryChildren, fallbackChildren, renderLanes) {
|
25248 |
+
var mode = workInProgress.mode;
|
25249 |
+
var progressedPrimaryFragment = workInProgress.child;
|
25250 |
+
var primaryChildProps = {
|
25251 |
+
mode: 'hidden',
|
25252 |
+
children: primaryChildren
|
25253 |
+
};
|
25254 |
+
var primaryChildFragment;
|
25255 |
+
var fallbackChildFragment;
|
25256 |
|
25257 |
+
if ((mode & BlockingMode) === NoMode && progressedPrimaryFragment !== null) {
|
25258 |
+
// In legacy mode, we commit the primary tree as if it successfully
|
25259 |
+
// completed, even though it's in an inconsistent state.
|
25260 |
+
primaryChildFragment = progressedPrimaryFragment;
|
25261 |
+
primaryChildFragment.childLanes = NoLanes;
|
25262 |
+
primaryChildFragment.pendingProps = primaryChildProps;
|
25263 |
|
25264 |
+
if ( workInProgress.mode & ProfileMode) {
|
25265 |
+
// Reset the durations from the first pass so they aren't included in the
|
25266 |
+
// final amounts. This seems counterintuitive, since we're intentionally
|
25267 |
+
// not measuring part of the render phase, but this makes it match what we
|
25268 |
+
// do in Concurrent Mode.
|
25269 |
+
primaryChildFragment.actualDuration = 0;
|
25270 |
+
primaryChildFragment.actualStartTime = -1;
|
25271 |
+
primaryChildFragment.selfBaseDuration = 0;
|
25272 |
+
primaryChildFragment.treeBaseDuration = 0;
|
25273 |
+
}
|
25274 |
|
25275 |
+
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null);
|
25276 |
+
} else {
|
25277 |
+
primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, NoLanes, null);
|
25278 |
+
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null);
|
25279 |
}
|
25280 |
|
25281 |
+
primaryChildFragment.return = workInProgress;
|
25282 |
+
fallbackChildFragment.return = workInProgress;
|
25283 |
+
primaryChildFragment.sibling = fallbackChildFragment;
|
25284 |
+
workInProgress.child = primaryChildFragment;
|
25285 |
+
return fallbackChildFragment;
|
25286 |
+
}
|
|
|
25287 |
|
25288 |
+
function createWorkInProgressOffscreenFiber(current, offscreenProps) {
|
25289 |
+
// The props argument to `createWorkInProgress` is `any` typed, so we use this
|
25290 |
+
// wrapper function to constrain it.
|
25291 |
+
return createWorkInProgress(current, offscreenProps);
|
25292 |
+
}
|
25293 |
|
25294 |
+
function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren, renderLanes) {
|
25295 |
+
var currentPrimaryChildFragment = current.child;
|
25296 |
+
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
25297 |
+
var primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, {
|
25298 |
+
mode: 'visible',
|
25299 |
+
children: primaryChildren
|
25300 |
+
});
|
25301 |
|
25302 |
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
25303 |
+
primaryChildFragment.lanes = renderLanes;
|
25304 |
}
|
25305 |
|
25306 |
+
primaryChildFragment.return = workInProgress;
|
25307 |
+
primaryChildFragment.sibling = null;
|
|
|
|
|
25308 |
|
25309 |
+
if (currentFallbackChildFragment !== null) {
|
25310 |
+
// Delete the fallback child fragment
|
25311 |
+
currentFallbackChildFragment.nextEffect = null;
|
25312 |
+
currentFallbackChildFragment.flags = Deletion;
|
25313 |
+
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
|
25314 |
+
}
|
25315 |
|
25316 |
+
workInProgress.child = primaryChildFragment;
|
25317 |
+
return primaryChildFragment;
|
|
|
25318 |
}
|
25319 |
|
25320 |
+
function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) {
|
25321 |
+
var mode = workInProgress.mode;
|
25322 |
+
var currentPrimaryChildFragment = current.child;
|
25323 |
+
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
25324 |
+
var primaryChildProps = {
|
25325 |
+
mode: 'hidden',
|
25326 |
+
children: primaryChildren
|
25327 |
+
};
|
25328 |
+
var primaryChildFragment;
|
25329 |
|
25330 |
+
if ( // In legacy mode, we commit the primary tree as if it successfully
|
25331 |
+
// completed, even though it's in an inconsistent state.
|
25332 |
+
(mode & BlockingMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was
|
25333 |
+
// already cloned. In legacy mode, the only case where this isn't true is
|
25334 |
+
// when DevTools forces us to display a fallback; we skip the first render
|
25335 |
+
// pass entirely and go straight to rendering the fallback. (In Concurrent
|
25336 |
+
// Mode, SuspenseList can also trigger this scenario, but this is a legacy-
|
25337 |
+
// only codepath.)
|
25338 |
+
workInProgress.child !== currentPrimaryChildFragment) {
|
25339 |
+
var progressedPrimaryFragment = workInProgress.child;
|
25340 |
+
primaryChildFragment = progressedPrimaryFragment;
|
25341 |
+
primaryChildFragment.childLanes = NoLanes;
|
25342 |
+
primaryChildFragment.pendingProps = primaryChildProps;
|
25343 |
+
|
25344 |
+
if ( workInProgress.mode & ProfileMode) {
|
25345 |
+
// Reset the durations from the first pass so they aren't included in the
|
25346 |
+
// final amounts. This seems counterintuitive, since we're intentionally
|
25347 |
+
// not measuring part of the render phase, but this makes it match what we
|
25348 |
+
// do in Concurrent Mode.
|
25349 |
+
primaryChildFragment.actualDuration = 0;
|
25350 |
+
primaryChildFragment.actualStartTime = -1;
|
25351 |
+
primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration;
|
25352 |
+
primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration;
|
25353 |
+
} // The fallback fiber was added as a deletion effect during the first pass.
|
25354 |
+
// However, since we're going to remain on the fallback, we no longer want
|
25355 |
+
// to delete it. So we need to remove it from the list. Deletions are stored
|
25356 |
+
// on the same list as effects. We want to keep the effects from the primary
|
25357 |
+
// tree. So we copy the primary child fragment's effect list, which does not
|
25358 |
+
// include the fallback deletion effect.
|
25359 |
|
25360 |
|
25361 |
+
var progressedLastEffect = primaryChildFragment.lastEffect;
|
25362 |
|
25363 |
+
if (progressedLastEffect !== null) {
|
25364 |
+
workInProgress.firstEffect = primaryChildFragment.firstEffect;
|
25365 |
+
workInProgress.lastEffect = progressedLastEffect;
|
25366 |
+
progressedLastEffect.nextEffect = null;
|
25367 |
+
} else {
|
25368 |
+
// TODO: Reset this somewhere else? Lol legacy mode is so weird.
|
25369 |
+
workInProgress.firstEffect = workInProgress.lastEffect = null;
|
25370 |
+
}
|
25371 |
} else {
|
25372 |
+
primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps);
|
25373 |
}
|
25374 |
|
25375 |
+
var fallbackChildFragment;
|
|
|
|
|
25376 |
|
25377 |
+
if (currentFallbackChildFragment !== null) {
|
25378 |
+
fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren);
|
25379 |
+
} else {
|
25380 |
+
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already
|
25381 |
+
// mounted but this is a new fiber.
|
|
|
|
|
|
|
25382 |
|
25383 |
+
fallbackChildFragment.flags |= Placement;
|
25384 |
+
}
|
25385 |
+
|
25386 |
+
fallbackChildFragment.return = workInProgress;
|
25387 |
+
primaryChildFragment.return = workInProgress;
|
25388 |
+
primaryChildFragment.sibling = fallbackChildFragment;
|
25389 |
+
workInProgress.child = primaryChildFragment;
|
25390 |
+
return fallbackChildFragment;
|
25391 |
+
}
|
25392 |
|
25393 |
+
function scheduleWorkOnFiber(fiber, renderLanes) {
|
25394 |
+
fiber.lanes = mergeLanes(fiber.lanes, renderLanes);
|
25395 |
+
var alternate = fiber.alternate;
|
25396 |
|
25397 |
+
if (alternate !== null) {
|
25398 |
+
alternate.lanes = mergeLanes(alternate.lanes, renderLanes);
|
|
|
|
|
|
|
|
|
|
|
|
|
25399 |
}
|
25400 |
|
25401 |
+
scheduleWorkOnParentPath(fiber.return, renderLanes);
|
25402 |
+
}
|
25403 |
|
25404 |
+
function propagateSuspenseContextChange(workInProgress, firstChild, renderLanes) {
|
25405 |
+
// Mark any Suspense boundaries with fallbacks as having work to do.
|
25406 |
+
// If they were previously forced into fallbacks, they may now be able
|
25407 |
+
// to unblock.
|
25408 |
+
var node = firstChild;
|
25409 |
+
|
25410 |
+
while (node !== null) {
|
25411 |
+
if (node.tag === SuspenseComponent) {
|
25412 |
+
var state = node.memoizedState;
|
25413 |
+
|
25414 |
+
if (state !== null) {
|
25415 |
+
scheduleWorkOnFiber(node, renderLanes);
|
25416 |
+
}
|
25417 |
+
} else if (node.tag === SuspenseListComponent) {
|
25418 |
+
// If the tail is hidden there might not be an Suspense boundaries
|
25419 |
+
// to schedule work on. In this case we have to schedule it on the
|
25420 |
+
// list itself.
|
25421 |
+
// We don't have to traverse to the children of the list since
|
25422 |
+
// the list will propagate the change when it rerenders.
|
25423 |
+
scheduleWorkOnFiber(node, renderLanes);
|
25424 |
+
} else if (node.child !== null) {
|
25425 |
+
node.child.return = node;
|
25426 |
+
node = node.child;
|
25427 |
+
continue;
|
25428 |
+
}
|
25429 |
+
|
25430 |
+
if (node === workInProgress) {
|
25431 |
+
return;
|
25432 |
+
}
|
25433 |
|
25434 |
+
while (node.sibling === null) {
|
25435 |
+
if (node.return === null || node.return === workInProgress) {
|
25436 |
+
return;
|
25437 |
}
|
25438 |
|
25439 |
+
node = node.return;
|
25440 |
}
|
|
|
25441 |
|
25442 |
+
node.sibling.return = node.return;
|
25443 |
+
node = node.sibling;
|
25444 |
+
}
|
25445 |
}
|
25446 |
|
25447 |
+
function findLastContentRow(firstChild) {
|
25448 |
+
// This is going to find the last row among these children that is already
|
25449 |
+
// showing content on the screen, as opposed to being in fallback state or
|
25450 |
+
// new. If a row has multiple Suspense boundaries, any of them being in the
|
25451 |
+
// fallback state, counts as the whole row being in a fallback state.
|
25452 |
+
// Note that the "rows" will be workInProgress, but any nested children
|
25453 |
+
// will still be current since we haven't rendered them yet. The mounted
|
25454 |
+
// order may not be the same as the new order. We use the new order.
|
25455 |
+
var row = firstChild;
|
25456 |
+
var lastContentRow = null;
|
25457 |
|
25458 |
+
while (row !== null) {
|
25459 |
+
var currentRow = row.alternate; // New rows can't be content rows.
|
25460 |
+
|
25461 |
+
if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
25462 |
+
lastContentRow = row;
|
25463 |
}
|
25464 |
|
25465 |
+
row = row.sibling;
|
25466 |
}
|
25467 |
|
25468 |
+
return lastContentRow;
|
25469 |
+
}
|
25470 |
|
25471 |
+
function validateRevealOrder(revealOrder) {
|
25472 |
+
{
|
25473 |
+
if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) {
|
25474 |
+
didWarnAboutRevealOrder[revealOrder] = true;
|
25475 |
|
25476 |
+
if (typeof revealOrder === 'string') {
|
25477 |
+
switch (revealOrder.toLowerCase()) {
|
25478 |
+
case 'together':
|
25479 |
+
case 'forwards':
|
25480 |
+
case 'backwards':
|
25481 |
+
{
|
25482 |
+
error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
|
25483 |
|
25484 |
+
break;
|
25485 |
+
}
|
|
|
|
|
|
|
|
|
|
|
25486 |
|
25487 |
+
case 'forward':
|
25488 |
+
case 'backward':
|
25489 |
+
{
|
25490 |
+
error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
|
25491 |
|
25492 |
+
break;
|
25493 |
+
}
|
25494 |
+
|
25495 |
+
default:
|
25496 |
+
error('"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
25497 |
+
|
25498 |
+
break;
|
25499 |
}
|
25500 |
+
} else {
|
25501 |
+
error('%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
25502 |
}
|
|
|
|
|
25503 |
}
|
25504 |
+
}
|
25505 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25506 |
|
25507 |
+
function validateTailOptions(tailMode, revealOrder) {
|
25508 |
+
{
|
25509 |
+
if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) {
|
25510 |
+
if (tailMode !== 'collapsed' && tailMode !== 'hidden') {
|
25511 |
+
didWarnAboutTailOptions[tailMode] = true;
|
25512 |
|
25513 |
+
error('"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode);
|
25514 |
+
} else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') {
|
25515 |
+
didWarnAboutTailOptions[tailMode] = true;
|
25516 |
|
25517 |
+
error('<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode);
|
25518 |
+
}
|
25519 |
+
}
|
25520 |
}
|
|
|
|
|
25521 |
}
|
25522 |
|
25523 |
+
function validateSuspenseListNestedChild(childSlot, index) {
|
25524 |
+
{
|
25525 |
+
var isArray = Array.isArray(childSlot);
|
25526 |
+
var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
|
|
|
|
|
|
|
|
|
|
|
25527 |
|
25528 |
+
if (isArray || isIterable) {
|
25529 |
+
var type = isArray ? 'array' : 'iterable';
|
25530 |
|
25531 |
+
error('A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type);
|
|
|
|
|
25532 |
|
25533 |
+
return false;
|
|
|
|
|
25534 |
}
|
25535 |
}
|
25536 |
|
25537 |
+
return true;
|
25538 |
+
}
|
|
|
|
|
|
|
|
|
|
|
25539 |
|
25540 |
+
function validateSuspenseListChildren(children, revealOrder) {
|
25541 |
+
{
|
25542 |
+
if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) {
|
25543 |
+
if (Array.isArray(children)) {
|
25544 |
+
for (var i = 0; i < children.length; i++) {
|
25545 |
+
if (!validateSuspenseListNestedChild(children[i], i)) {
|
25546 |
+
return;
|
25547 |
+
}
|
25548 |
+
}
|
25549 |
+
} else {
|
25550 |
+
var iteratorFn = getIteratorFn(children);
|
25551 |
|
25552 |
+
if (typeof iteratorFn === 'function') {
|
25553 |
+
var childrenIterator = iteratorFn.call(children);
|
|
|
|
|
25554 |
|
25555 |
+
if (childrenIterator) {
|
25556 |
+
var step = childrenIterator.next();
|
25557 |
+
var _i = 0;
|
25558 |
|
25559 |
+
for (; !step.done; step = childrenIterator.next()) {
|
25560 |
+
if (!validateSuspenseListNestedChild(step.value, _i)) {
|
25561 |
+
return;
|
25562 |
+
}
|
|
|
|
|
|
|
25563 |
|
25564 |
+
_i++;
|
25565 |
+
}
|
25566 |
+
}
|
25567 |
+
} else {
|
25568 |
+
error('A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder);
|
25569 |
}
|
25570 |
}
|
25571 |
}
|
25572 |
+
}
|
25573 |
+
}
|
25574 |
|
25575 |
+
function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
|
25576 |
+
var renderState = workInProgress.memoizedState;
|
|
|
25577 |
|
25578 |
+
if (renderState === null) {
|
25579 |
+
workInProgress.memoizedState = {
|
25580 |
+
isBackwards: isBackwards,
|
25581 |
+
rendering: null,
|
25582 |
+
renderingStartTime: 0,
|
25583 |
+
last: lastContentRow,
|
25584 |
+
tail: tail,
|
25585 |
+
tailMode: tailMode,
|
25586 |
+
lastEffect: lastEffectBeforeRendering
|
25587 |
+
};
|
25588 |
} else {
|
25589 |
+
// We can reuse the existing object from previous renders.
|
25590 |
+
renderState.isBackwards = isBackwards;
|
25591 |
+
renderState.rendering = null;
|
25592 |
+
renderState.renderingStartTime = 0;
|
25593 |
+
renderState.last = lastContentRow;
|
25594 |
+
renderState.tail = tail;
|
25595 |
+
renderState.tailMode = tailMode;
|
25596 |
+
renderState.lastEffect = lastEffectBeforeRendering;
|
25597 |
}
|
25598 |
+
} // This can end up rendering this component multiple passes.
|
25599 |
+
// The first pass splits the children fibers into two sets. A head and tail.
|
25600 |
+
// We first render the head. If anything is in fallback state, we do another
|
25601 |
+
// pass through beginWork to rerender all children (including the tail) with
|
25602 |
+
// the force suspend context. If the first render didn't have anything in
|
25603 |
+
// in fallback state. Then we render each row in the tail one-by-one.
|
25604 |
+
// That happens in the completeWork phase without going back to beginWork.
|
25605 |
|
|
|
|
|
25606 |
|
25607 |
+
function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
25608 |
+
var nextProps = workInProgress.pendingProps;
|
25609 |
+
var revealOrder = nextProps.revealOrder;
|
25610 |
+
var tailMode = nextProps.tail;
|
25611 |
+
var newChildren = nextProps.children;
|
25612 |
+
validateRevealOrder(revealOrder);
|
25613 |
+
validateTailOptions(tailMode, revealOrder);
|
25614 |
+
validateSuspenseListChildren(newChildren, revealOrder);
|
25615 |
+
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
25616 |
+
var suspenseContext = suspenseStackCursor.current;
|
25617 |
+
var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
25618 |
|
25619 |
+
if (shouldForceFallback) {
|
25620 |
+
suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
25621 |
+
workInProgress.flags |= DidCapture;
|
25622 |
+
} else {
|
25623 |
+
var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags;
|
25624 |
|
25625 |
+
if (didSuspendBefore) {
|
25626 |
+
// If we previously forced a fallback, we need to schedule work
|
25627 |
+
// on any nested boundaries to let them know to try to render
|
25628 |
+
// again. This is the same as context updating.
|
25629 |
+
propagateSuspenseContextChange(workInProgress, workInProgress.child, renderLanes);
|
25630 |
+
}
|
25631 |
|
25632 |
+
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25633 |
}
|
25634 |
|
25635 |
+
pushSuspenseContext(workInProgress, suspenseContext);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25636 |
|
25637 |
+
if ((workInProgress.mode & BlockingMode) === NoMode) {
|
25638 |
+
// In legacy mode, SuspenseList doesn't work so we just
|
25639 |
+
// use make it a noop by treating it as the default revealOrder.
|
25640 |
+
workInProgress.memoizedState = null;
|
25641 |
+
} else {
|
25642 |
+
switch (revealOrder) {
|
25643 |
+
case 'forwards':
|
25644 |
+
{
|
25645 |
+
var lastContentRow = findLastContentRow(workInProgress.child);
|
25646 |
+
var tail;
|
25647 |
|
25648 |
+
if (lastContentRow === null) {
|
25649 |
+
// The whole list is part of the tail.
|
25650 |
+
// TODO: We could fast path by just rendering the tail now.
|
25651 |
+
tail = workInProgress.child;
|
25652 |
+
workInProgress.child = null;
|
25653 |
+
} else {
|
25654 |
+
// Disconnect the tail rows after the content row.
|
25655 |
+
// We're going to render them separately later.
|
25656 |
+
tail = lastContentRow.sibling;
|
25657 |
+
lastContentRow.sibling = null;
|
25658 |
+
}
|
25659 |
|
25660 |
+
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
25661 |
+
tail, lastContentRow, tailMode, workInProgress.lastEffect);
|
25662 |
+
break;
|
25663 |
+
}
|
|
|
|
|
|
|
|
|
25664 |
|
25665 |
+
case 'backwards':
|
25666 |
+
{
|
25667 |
+
// We're going to find the first row that has existing content.
|
25668 |
+
// At the same time we're going to reverse the list of everything
|
25669 |
+
// we pass in the meantime. That's going to be our tail in reverse
|
25670 |
+
// order.
|
25671 |
+
var _tail = null;
|
25672 |
+
var row = workInProgress.child;
|
25673 |
+
workInProgress.child = null;
|
25674 |
|
25675 |
+
while (row !== null) {
|
25676 |
+
var currentRow = row.alternate; // New rows can't be content rows.
|
|
|
|
|
|
|
25677 |
|
25678 |
+
if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
25679 |
+
// This is the beginning of the main content.
|
25680 |
+
workInProgress.child = row;
|
25681 |
+
break;
|
25682 |
+
}
|
25683 |
|
25684 |
+
var nextRow = row.sibling;
|
25685 |
+
row.sibling = _tail;
|
25686 |
+
_tail = row;
|
25687 |
+
row = nextRow;
|
25688 |
+
} // TODO: If workInProgress.child is null, we can continue on the tail immediately.
|
|
|
|
|
25689 |
|
|
|
|
|
|
|
25690 |
|
25691 |
+
initSuspenseListRenderState(workInProgress, true, // isBackwards
|
25692 |
+
_tail, null, // last
|
25693 |
+
tailMode, workInProgress.lastEffect);
|
25694 |
+
break;
|
25695 |
}
|
25696 |
|
25697 |
+
case 'together':
|
|
|
|
|
|
|
|
|
|
|
25698 |
{
|
25699 |
+
initSuspenseListRenderState(workInProgress, false, // isBackwards
|
25700 |
+
null, // tail
|
25701 |
+
null, // last
|
25702 |
+
undefined, workInProgress.lastEffect);
|
25703 |
+
break;
|
25704 |
}
|
25705 |
|
25706 |
+
default:
|
|
|
|
|
|
|
|
|
|
|
25707 |
{
|
25708 |
+
// The default reveal order is the same as not having
|
25709 |
+
// a boundary.
|
25710 |
+
workInProgress.memoizedState = null;
|
|
|
|
|
|
|
|
|
|
|
25711 |
}
|
25712 |
+
}
|
|
|
|
|
|
|
|
|
25713 |
}
|
25714 |
|
25715 |
+
return workInProgress.child;
|
25716 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25717 |
|
25718 |
+
function updatePortalComponent(current, workInProgress, renderLanes) {
|
25719 |
+
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
25720 |
+
var nextChildren = workInProgress.pendingProps;
|
25721 |
|
25722 |
+
if (current === null) {
|
25723 |
+
// Portals are special because we don't append the children during mount
|
25724 |
+
// but at commit. Therefore we need to track insertions which the normal
|
25725 |
+
// flow doesn't do during mount. This doesn't happen at the root because
|
25726 |
+
// the root always starts with a "current" with a null child.
|
25727 |
+
// TODO: Consider unifying this with how the root works.
|
25728 |
+
workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes);
|
25729 |
+
} else {
|
25730 |
+
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
25731 |
}
|
25732 |
+
|
25733 |
+
return workInProgress.child;
|
25734 |
}
|
25735 |
|
25736 |
+
var hasWarnedAboutUsingNoValuePropOnContextProvider = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25737 |
|
25738 |
+
function updateContextProvider(current, workInProgress, renderLanes) {
|
25739 |
+
var providerType = workInProgress.type;
|
25740 |
+
var context = providerType._context;
|
25741 |
+
var newProps = workInProgress.pendingProps;
|
25742 |
+
var oldProps = workInProgress.memoizedProps;
|
25743 |
+
var newValue = newProps.value;
|
25744 |
|
25745 |
+
{
|
25746 |
+
if (!('value' in newProps)) {
|
25747 |
+
if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
|
25748 |
+
hasWarnedAboutUsingNoValuePropOnContextProvider = true;
|
25749 |
|
25750 |
+
error('The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?');
|
25751 |
+
}
|
25752 |
+
}
|
|
|
25753 |
|
25754 |
+
var providerPropTypes = workInProgress.type.propTypes;
|
25755 |
|
25756 |
+
if (providerPropTypes) {
|
25757 |
+
checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider');
|
25758 |
+
}
|
|
|
|
|
25759 |
}
|
25760 |
|
25761 |
+
pushProvider(workInProgress, newValue);
|
|
|
|
|
|
|
|
|
25762 |
|
25763 |
+
if (oldProps !== null) {
|
25764 |
+
var oldValue = oldProps.value;
|
25765 |
+
var changedBits = calculateChangedBits(context, newValue, oldValue);
|
|
|
|
|
|
|
|
|
|
|
25766 |
|
25767 |
+
if (changedBits === 0) {
|
25768 |
+
// No change. Bailout early if children are the same.
|
25769 |
+
if (oldProps.children === newProps.children && !hasContextChanged()) {
|
25770 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
25771 |
+
}
|
25772 |
+
} else {
|
25773 |
+
// The context value changed. Search for matching consumers and schedule
|
25774 |
+
// them to update.
|
25775 |
+
propagateContextChange(workInProgress, context, changedBits, renderLanes);
|
25776 |
+
}
|
25777 |
}
|
25778 |
|
25779 |
+
var newChildren = newProps.children;
|
25780 |
+
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
25781 |
+
return workInProgress.child;
|
25782 |
+
}
|
25783 |
|
25784 |
+
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
|
|
|
|
|
25785 |
|
25786 |
+
function updateContextConsumer(current, workInProgress, renderLanes) {
|
25787 |
+
var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In
|
25788 |
+
// DEV mode, we create a separate object for Context.Consumer that acts
|
25789 |
+
// like a proxy to Context. This proxy object adds unnecessary code in PROD
|
25790 |
+
// so we use the old behaviour (Context.Consumer references Context) to
|
25791 |
+
// reduce size and overhead. The separate object references context via
|
25792 |
+
// a property called "_context", which also gives us the ability to check
|
25793 |
+
// in DEV mode if this property exists or not and warn if it does not.
|
25794 |
|
25795 |
{
|
25796 |
+
if (context._context === undefined) {
|
25797 |
+
// This may be because it's a Context (rather than a Consumer).
|
25798 |
+
// Or it may be because it's older React where they're the same thing.
|
25799 |
+
// We only want to warn if we're sure it's a new React.
|
25800 |
+
if (context !== context.Consumer) {
|
25801 |
+
if (!hasWarnedAboutUsingContextAsConsumer) {
|
25802 |
+
hasWarnedAboutUsingContextAsConsumer = true;
|
25803 |
|
25804 |
+
error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
25805 |
+
}
|
25806 |
}
|
25807 |
+
} else {
|
25808 |
+
context = context._context;
|
25809 |
}
|
25810 |
+
}
|
25811 |
|
25812 |
+
var newProps = workInProgress.pendingProps;
|
25813 |
+
var render = newProps.children;
|
25814 |
+
|
25815 |
+
{
|
25816 |
+
if (typeof render !== 'function') {
|
25817 |
+
error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.');
|
25818 |
}
|
25819 |
+
}
|
25820 |
|
25821 |
+
prepareToReadContext(workInProgress, renderLanes);
|
25822 |
+
var newValue = readContext(context, newProps.unstable_observedBits);
|
25823 |
+
var newChildren;
|
25824 |
+
|
25825 |
+
{
|
25826 |
ReactCurrentOwner$1.current = workInProgress;
|
25827 |
+
setIsRendering(true);
|
25828 |
+
newChildren = render(newValue);
|
25829 |
setIsRendering(false);
|
25830 |
} // React DevTools reads this flag.
|
25831 |
|
25832 |
|
25833 |
workInProgress.flags |= PerformedWork;
|
25834 |
+
reconcileChildren(current, workInProgress, newChildren, renderLanes);
|
25835 |
+
return workInProgress.child;
|
25836 |
+
}
|
25837 |
|
25838 |
+
function markWorkInProgressReceivedUpdate() {
|
25839 |
+
didReceiveUpdate = true;
|
25840 |
+
}
|
|
|
|
|
25841 |
|
25842 |
+
function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) {
|
25843 |
+
if (current !== null) {
|
25844 |
+
// Reuse previous dependencies
|
25845 |
+
workInProgress.dependencies = current.dependencies;
|
25846 |
+
}
|
25847 |
|
25848 |
+
{
|
25849 |
+
// Don't update "base" render times for bailouts.
|
25850 |
+
stopProfilerTimerIfRunning();
|
25851 |
}
|
25852 |
|
25853 |
+
markSkippedUpdateLanes(workInProgress.lanes); // Check if the children have any pending work.
|
|
|
|
|
|
|
|
|
25854 |
|
25855 |
+
if (!includesSomeLane(renderLanes, workInProgress.childLanes)) {
|
25856 |
+
// The children don't have any work either. We can skip them.
|
25857 |
+
// TODO: Once we add back resuming, we should check if the children are
|
25858 |
+
// a work-in-progress set. If so, we need to transfer their effects.
|
25859 |
+
return null;
|
25860 |
+
} else {
|
25861 |
+
// This fiber doesn't have work, but its subtree does. Clone the child
|
25862 |
+
// fibers and continue.
|
25863 |
+
cloneChildFibers(current, workInProgress);
|
25864 |
+
return workInProgress.child;
|
25865 |
+
}
|
25866 |
+
}
|
25867 |
|
25868 |
+
function remountFiber(current, oldWorkInProgress, newWorkInProgress) {
|
25869 |
+
{
|
25870 |
+
var returnFiber = oldWorkInProgress.return;
|
25871 |
|
25872 |
+
if (returnFiber === null) {
|
25873 |
+
throw new Error('Cannot swap the root fiber.');
|
25874 |
+
} // Disconnect from the old current.
|
25875 |
+
// It will get deleted.
|
25876 |
|
|
|
25877 |
|
25878 |
+
current.alternate = null;
|
25879 |
+
oldWorkInProgress.alternate = null; // Connect to the new tree.
|
|
|
|
|
25880 |
|
25881 |
+
newWorkInProgress.index = oldWorkInProgress.index;
|
25882 |
+
newWorkInProgress.sibling = oldWorkInProgress.sibling;
|
25883 |
+
newWorkInProgress.return = oldWorkInProgress.return;
|
25884 |
+
newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it.
|
25885 |
|
25886 |
+
if (oldWorkInProgress === returnFiber.child) {
|
25887 |
+
returnFiber.child = newWorkInProgress;
|
|
|
25888 |
} else {
|
25889 |
+
var prevSibling = returnFiber.child;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25890 |
|
25891 |
+
if (prevSibling === null) {
|
25892 |
+
throw new Error('Expected parent to have a child.');
|
25893 |
+
}
|
25894 |
|
25895 |
+
while (prevSibling.sibling !== oldWorkInProgress) {
|
25896 |
+
prevSibling = prevSibling.sibling;
|
25897 |
|
25898 |
+
if (prevSibling === null) {
|
25899 |
+
throw new Error('Expected to find the previous sibling.');
|
|
|
|
|
25900 |
}
|
25901 |
}
|
|
|
25902 |
|
25903 |
+
prevSibling.sibling = newWorkInProgress;
|
25904 |
+
} // Delete the old fiber and place the new one.
|
25905 |
+
// Since the old fiber is disconnected, we have to schedule it manually.
|
25906 |
|
25907 |
+
|
25908 |
+
var last = returnFiber.lastEffect;
|
25909 |
+
|
25910 |
+
if (last !== null) {
|
25911 |
+
last.nextEffect = current;
|
25912 |
+
returnFiber.lastEffect = current;
|
25913 |
+
} else {
|
25914 |
+
returnFiber.firstEffect = returnFiber.lastEffect = current;
|
25915 |
}
|
25916 |
|
25917 |
+
current.nextEffect = null;
|
25918 |
+
current.flags = Deletion;
|
25919 |
+
newWorkInProgress.flags |= Placement; // Restart work from the new fiber.
|
25920 |
+
|
25921 |
+
return newWorkInProgress;
|
25922 |
}
|
25923 |
}
|
25924 |
|
25925 |
+
function beginWork(current, workInProgress, renderLanes) {
|
25926 |
+
var updateLanes = workInProgress.lanes;
|
25927 |
+
|
25928 |
{
|
25929 |
+
if (workInProgress._debugNeedsRemount && current !== null) {
|
25930 |
+
// This will restart the begin phase with a new fiber.
|
25931 |
+
return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes));
|
|
|
25932 |
}
|
25933 |
+
}
|
25934 |
|
25935 |
+
if (current !== null) {
|
25936 |
+
var oldProps = current.memoizedProps;
|
25937 |
+
var newProps = workInProgress.pendingProps;
|
25938 |
|
25939 |
+
if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload:
|
25940 |
+
workInProgress.type !== current.type )) {
|
25941 |
+
// If props or context changed, mark the fiber as having performed work.
|
25942 |
+
// This may be unset if the props are determined to be equal later (memo).
|
25943 |
+
didReceiveUpdate = true;
|
25944 |
+
} else if (!includesSomeLane(renderLanes, updateLanes)) {
|
25945 |
+
didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering
|
25946 |
+
// the begin phase. There's still some bookkeeping we that needs to be done
|
25947 |
+
// in this optimized path, mostly pushing stuff onto the stack.
|
25948 |
|
25949 |
+
switch (workInProgress.tag) {
|
25950 |
+
case HostRoot:
|
25951 |
+
pushHostRootContext(workInProgress);
|
25952 |
+
resetHydrationState();
|
25953 |
+
break;
|
25954 |
|
25955 |
+
case HostComponent:
|
25956 |
+
pushHostContext(workInProgress);
|
25957 |
+
break;
|
25958 |
|
25959 |
+
case ClassComponent:
|
25960 |
+
{
|
25961 |
+
var Component = workInProgress.type;
|
25962 |
|
25963 |
+
if (isContextProvider(Component)) {
|
25964 |
+
pushContextProvider(workInProgress);
|
25965 |
+
}
|
25966 |
|
25967 |
+
break;
|
25968 |
+
}
|
25969 |
|
25970 |
+
case HostPortal:
|
25971 |
+
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
25972 |
+
break;
|
25973 |
|
25974 |
+
case ContextProvider:
|
25975 |
+
{
|
25976 |
+
var newValue = workInProgress.memoizedProps.value;
|
25977 |
+
pushProvider(workInProgress, newValue);
|
25978 |
+
break;
|
25979 |
+
}
|
25980 |
|
25981 |
+
case Profiler:
|
25982 |
+
{
|
25983 |
+
// Profiler should only call onRender when one of its descendants actually rendered.
|
25984 |
+
var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
25985 |
|
25986 |
+
if (hasChildWork) {
|
25987 |
+
workInProgress.flags |= Update;
|
25988 |
+
} // Reset effect durations for the next eventual effect phase.
|
25989 |
+
// These are reset during render to allow the DevTools commit hook a chance to read them,
|
25990 |
|
|
|
|
|
|
|
|
|
|
|
25991 |
|
25992 |
+
var stateNode = workInProgress.stateNode;
|
25993 |
+
stateNode.effectDuration = 0;
|
25994 |
+
stateNode.passiveEffectDuration = 0;
|
25995 |
+
}
|
25996 |
|
25997 |
+
break;
|
|
|
|
|
|
|
|
|
25998 |
|
25999 |
+
case SuspenseComponent:
|
26000 |
+
{
|
26001 |
+
var state = workInProgress.memoizedState;
|
|
|
|
|
26002 |
|
26003 |
+
if (state !== null) {
|
26004 |
+
// whether to retry the primary children, or to skip over it and
|
26005 |
+
// go straight to the fallback. Check the priority of the primary
|
26006 |
+
// child fragment.
|
26007 |
|
|
|
|
|
|
|
|
|
|
|
|
|
26008 |
|
26009 |
+
var primaryChildFragment = workInProgress.child;
|
26010 |
+
var primaryChildLanes = primaryChildFragment.childLanes;
|
|
|
|
|
|
|
|
|
|
|
|
|
26011 |
|
26012 |
+
if (includesSomeLane(renderLanes, primaryChildLanes)) {
|
26013 |
+
// The primary children have pending work. Use the normal path
|
26014 |
+
// to attempt to render the primary children again.
|
26015 |
+
return updateSuspenseComponent(current, workInProgress, renderLanes);
|
26016 |
+
} else {
|
26017 |
+
// The primary child fragment does not have pending work marked
|
26018 |
+
// on it
|
26019 |
+
pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient
|
26020 |
+
// priority. Bailout.
|
26021 |
|
26022 |
+
var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
|
26023 |
|
26024 |
+
if (child !== null) {
|
26025 |
+
// The fallback children have pending work. Skip over the
|
26026 |
+
// primary children and work on the fallback.
|
26027 |
+
return child.sibling;
|
26028 |
+
} else {
|
26029 |
+
return null;
|
26030 |
+
}
|
26031 |
+
}
|
26032 |
+
} else {
|
26033 |
+
pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
26034 |
+
}
|
26035 |
|
26036 |
+
break;
|
26037 |
+
}
|
26038 |
|
26039 |
+
case SuspenseListComponent:
|
26040 |
+
{
|
26041 |
+
var didSuspendBefore = (current.flags & DidCapture) !== NoFlags;
|
|
|
|
|
26042 |
|
26043 |
+
var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes);
|
|
|
|
|
26044 |
|
26045 |
+
if (didSuspendBefore) {
|
26046 |
+
if (_hasChildWork) {
|
26047 |
+
// If something was in fallback state last time, and we have all the
|
26048 |
+
// same children then we're still in progressive loading state.
|
26049 |
+
// Something might get unblocked by state updates or retries in the
|
26050 |
+
// tree which will affect the tail. So we need to use the normal
|
26051 |
+
// path to compute the correct tail.
|
26052 |
+
return updateSuspenseListComponent(current, workInProgress, renderLanes);
|
26053 |
+
} // If none of the children had any work, that means that none of
|
26054 |
+
// them got retried so they'll still be blocked in the same way
|
26055 |
+
// as before. We can fast bail out.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26056 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26057 |
|
26058 |
+
workInProgress.flags |= DidCapture;
|
26059 |
+
} // If nothing suspended before and we're rendering the same children,
|
26060 |
+
// then the tail doesn't matter. Anything new that suspends will work
|
26061 |
+
// in the "together" mode, so we can continue from the state we had.
|
|
|
|
|
|
|
26062 |
|
|
|
|
|
26063 |
|
26064 |
+
var renderState = workInProgress.memoizedState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26065 |
|
26066 |
+
if (renderState !== null) {
|
26067 |
+
// Reset to the "together" mode in case we've started a different
|
26068 |
+
// update in the past but didn't complete it.
|
26069 |
+
renderState.rendering = null;
|
26070 |
+
renderState.tail = null;
|
26071 |
+
renderState.lastEffect = null;
|
26072 |
+
}
|
26073 |
+
|
26074 |
+
pushSuspenseContext(workInProgress, suspenseStackCursor.current);
|
26075 |
+
|
26076 |
+
if (_hasChildWork) {
|
26077 |
+
break;
|
26078 |
+
} else {
|
26079 |
+
// If none of the children had any work, that means that none of
|
26080 |
+
// them got retried so they'll still be blocked in the same way
|
26081 |
+
// as before. We can fast bail out.
|
26082 |
+
return null;
|
26083 |
+
}
|
26084 |
+
}
|
26085 |
+
|
26086 |
+
case OffscreenComponent:
|
26087 |
+
case LegacyHiddenComponent:
|
26088 |
+
{
|
26089 |
+
// Need to check if the tree still needs to be deferred. This is
|
26090 |
+
// almost identical to the logic used in the normal update path,
|
26091 |
+
// so we'll just enter that. The only difference is we'll bail out
|
26092 |
+
// at the next level instead of this one, because the child props
|
26093 |
+
// have not changed. Which is fine.
|
26094 |
+
// TODO: Probably should refactor `beginWork` to split the bailout
|
26095 |
+
// path from the normal path. I'm tempted to do a labeled break here
|
26096 |
+
// but I won't :)
|
26097 |
+
workInProgress.lanes = NoLanes;
|
26098 |
+
return updateOffscreenComponent(current, workInProgress, renderLanes);
|
26099 |
+
}
|
26100 |
+
}
|
26101 |
+
|
26102 |
+
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
26103 |
+
} else {
|
26104 |
+
if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
26105 |
+
// This is a special case that only exists for legacy mode.
|
26106 |
+
// See https://github.com/facebook/react/pull/19216.
|
26107 |
+
didReceiveUpdate = true;
|
26108 |
+
} else {
|
26109 |
+
// An update was scheduled on this fiber, but there are no new props
|
26110 |
+
// nor legacy context. Set this to false. If an update queue or context
|
26111 |
+
// consumer produces a changed value, it will set this to true. Otherwise,
|
26112 |
+
// the component will assume the children have not changed and bail out.
|
26113 |
+
didReceiveUpdate = false;
|
26114 |
+
}
|
26115 |
+
}
|
26116 |
+
} else {
|
26117 |
+
didReceiveUpdate = false;
|
26118 |
+
} // Before entering the begin phase, clear pending update priority.
|
26119 |
+
// TODO: This assumes that we're about to evaluate the component and process
|
26120 |
+
// the update queue. However, there's an exception: SimpleMemoComponent
|
26121 |
+
// sometimes bails out later in the begin phase. This indicates that we should
|
26122 |
+
// move this assignment out of the common path and into each branch.
|
26123 |
+
|
26124 |
+
|
26125 |
+
workInProgress.lanes = NoLanes;
|
26126 |
|
26127 |
+
switch (workInProgress.tag) {
|
26128 |
+
case IndeterminateComponent:
|
26129 |
+
{
|
26130 |
+
return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderLanes);
|
26131 |
+
}
|
26132 |
|
26133 |
+
case LazyComponent:
|
26134 |
{
|
26135 |
+
var elementType = workInProgress.elementType;
|
26136 |
+
return mountLazyComponent(current, workInProgress, elementType, updateLanes, renderLanes);
|
26137 |
}
|
26138 |
|
26139 |
+
case FunctionComponent:
|
26140 |
+
{
|
26141 |
+
var _Component = workInProgress.type;
|
26142 |
+
var unresolvedProps = workInProgress.pendingProps;
|
26143 |
+
var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
|
26144 |
+
return updateFunctionComponent(current, workInProgress, _Component, resolvedProps, renderLanes);
|
26145 |
+
}
|
|
|
|
|
26146 |
|
26147 |
+
case ClassComponent:
|
26148 |
+
{
|
26149 |
+
var _Component2 = workInProgress.type;
|
26150 |
+
var _unresolvedProps = workInProgress.pendingProps;
|
26151 |
|
26152 |
+
var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
|
|
|
|
|
26153 |
|
26154 |
+
return updateClassComponent(current, workInProgress, _Component2, _resolvedProps, renderLanes);
|
26155 |
+
}
|
26156 |
|
26157 |
+
case HostRoot:
|
26158 |
+
return updateHostRoot(current, workInProgress, renderLanes);
|
|
|
|
|
|
|
|
|
|
|
|
|
26159 |
|
26160 |
+
case HostComponent:
|
26161 |
+
return updateHostComponent(current, workInProgress, renderLanes);
|
26162 |
|
26163 |
+
case HostText:
|
26164 |
+
return updateHostText(current, workInProgress);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26165 |
|
26166 |
+
case SuspenseComponent:
|
26167 |
+
return updateSuspenseComponent(current, workInProgress, renderLanes);
|
26168 |
|
26169 |
+
case HostPortal:
|
26170 |
+
return updatePortalComponent(current, workInProgress, renderLanes);
|
|
|
|
|
|
|
26171 |
|
26172 |
+
case ForwardRef:
|
26173 |
+
{
|
26174 |
+
var type = workInProgress.type;
|
26175 |
+
var _unresolvedProps2 = workInProgress.pendingProps;
|
|
|
|
|
26176 |
|
26177 |
+
var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
26178 |
|
26179 |
+
return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderLanes);
|
|
|
26180 |
}
|
|
|
|
|
|
|
26181 |
|
26182 |
+
case Fragment:
|
26183 |
+
return updateFragment(current, workInProgress, renderLanes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26184 |
|
26185 |
+
case Mode:
|
26186 |
+
return updateMode(current, workInProgress, renderLanes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26187 |
|
26188 |
+
case Profiler:
|
26189 |
+
return updateProfiler(current, workInProgress, renderLanes);
|
|
|
|
|
|
|
|
|
26190 |
|
26191 |
+
case ContextProvider:
|
26192 |
+
return updateContextProvider(current, workInProgress, renderLanes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26193 |
|
26194 |
+
case ContextConsumer:
|
26195 |
+
return updateContextConsumer(current, workInProgress, renderLanes);
|
|
|
|
|
|
|
26196 |
|
26197 |
+
case MemoComponent:
|
26198 |
+
{
|
26199 |
+
var _type2 = workInProgress.type;
|
26200 |
+
var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props.
|
|
|
|
|
26201 |
|
26202 |
+
var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
|
|
|
|
|
|
|
|
|
26203 |
|
26204 |
+
{
|
26205 |
+
if (workInProgress.type !== workInProgress.elementType) {
|
26206 |
+
var outerPropTypes = _type2.propTypes;
|
|
|
|
|
|
|
|
|
26207 |
|
26208 |
+
if (outerPropTypes) {
|
26209 |
+
checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only
|
26210 |
+
'prop', getComponentName(_type2));
|
26211 |
+
}
|
26212 |
+
}
|
26213 |
+
}
|
26214 |
|
26215 |
+
_resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
|
26216 |
+
return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, updateLanes, renderLanes);
|
26217 |
+
}
|
26218 |
|
26219 |
+
case SimpleMemoComponent:
|
26220 |
+
{
|
26221 |
+
return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, updateLanes, renderLanes);
|
26222 |
+
}
|
|
|
|
|
26223 |
|
26224 |
+
case IncompleteClassComponent:
|
26225 |
+
{
|
26226 |
+
var _Component3 = workInProgress.type;
|
26227 |
+
var _unresolvedProps4 = workInProgress.pendingProps;
|
26228 |
|
26229 |
+
var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26230 |
|
26231 |
+
return mountIncompleteClassComponent(current, workInProgress, _Component3, _resolvedProps4, renderLanes);
|
26232 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26233 |
|
26234 |
+
case SuspenseListComponent:
|
26235 |
+
{
|
26236 |
+
return updateSuspenseListComponent(current, workInProgress, renderLanes);
|
26237 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26238 |
|
26239 |
+
case FundamentalComponent:
|
26240 |
+
{
|
26241 |
|
26242 |
+
break;
|
26243 |
+
}
|
26244 |
|
26245 |
+
case ScopeComponent:
|
26246 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26247 |
|
26248 |
+
break;
|
26249 |
+
}
|
26250 |
|
26251 |
+
case Block:
|
26252 |
+
{
|
|
|
|
|
|
|
26253 |
|
26254 |
+
break;
|
26255 |
+
}
|
26256 |
|
26257 |
+
case OffscreenComponent:
|
26258 |
+
{
|
26259 |
+
return updateOffscreenComponent(current, workInProgress, renderLanes);
|
26260 |
+
}
|
|
|
|
|
26261 |
|
26262 |
+
case LegacyHiddenComponent:
|
26263 |
+
{
|
26264 |
+
return updateLegacyHiddenComponent(current, workInProgress, renderLanes);
|
26265 |
+
}
|
26266 |
+
}
|
26267 |
|
26268 |
+
{
|
26269 |
+
{
|
26270 |
+
throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
|
26271 |
+
}
|
26272 |
}
|
26273 |
+
}
|
26274 |
|
26275 |
+
function markUpdate(workInProgress) {
|
26276 |
+
// Tag the fiber with an update effect. This turns a Placement into
|
26277 |
+
// a PlacementAndUpdate.
|
26278 |
+
workInProgress.flags |= Update;
|
26279 |
}
|
26280 |
|
26281 |
+
function markRef$1(workInProgress) {
|
26282 |
+
workInProgress.flags |= Ref;
|
26283 |
+
}
|
|
|
|
|
26284 |
|
26285 |
+
var appendAllChildren;
|
26286 |
+
var updateHostContainer;
|
26287 |
+
var updateHostComponent$1;
|
26288 |
+
var updateHostText$1;
|
26289 |
|
26290 |
+
{
|
26291 |
+
// Mutation mode
|
26292 |
+
appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
|
26293 |
+
// We only have the top Fiber that was created but we need recurse down its
|
26294 |
+
// children to find all the terminal nodes.
|
26295 |
+
var node = workInProgress.child;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26296 |
|
26297 |
+
while (node !== null) {
|
26298 |
+
if (node.tag === HostComponent || node.tag === HostText) {
|
26299 |
+
appendInitialChild(parent, node.stateNode);
|
26300 |
+
} else if (node.tag === HostPortal) ; else if (node.child !== null) {
|
26301 |
+
node.child.return = node;
|
26302 |
+
node = node.child;
|
26303 |
+
continue;
|
26304 |
+
}
|
26305 |
|
26306 |
+
if (node === workInProgress) {
|
|
|
26307 |
return;
|
26308 |
}
|
26309 |
|
26310 |
+
while (node.sibling === null) {
|
26311 |
+
if (node.return === null || node.return === workInProgress) {
|
26312 |
+
return;
|
26313 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26314 |
|
26315 |
+
node = node.return;
|
26316 |
+
}
|
26317 |
|
26318 |
+
node.sibling.return = node.return;
|
26319 |
+
node = node.sibling;
|
26320 |
}
|
26321 |
+
};
|
26322 |
|
26323 |
+
updateHostContainer = function (workInProgress) {// Noop
|
26324 |
+
};
|
26325 |
|
26326 |
+
updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
|
26327 |
+
// If we have an alternate, that means this is an update and we need to
|
26328 |
+
// schedule a side-effect to do the updates.
|
26329 |
+
var oldProps = current.memoizedProps;
|
26330 |
|
26331 |
+
if (oldProps === newProps) {
|
26332 |
+
// In mutation mode, this is sufficient for a bailout because
|
26333 |
+
// we won't touch this node even if children changed.
|
26334 |
+
return;
|
26335 |
+
} // If we get updated because one of our children updated, we don't
|
26336 |
+
// have newProps so we'll have to reuse them.
|
26337 |
+
// TODO: Split the update API as separate for the props vs. children.
|
26338 |
+
// Even better would be if children weren't special cased at all tho.
|
26339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26340 |
|
26341 |
+
var instance = workInProgress.stateNode;
|
26342 |
+
var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host
|
26343 |
+
// component is hitting the resume path. Figure out why. Possibly
|
26344 |
+
// related to `hidden`.
|
26345 |
|
26346 |
+
var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); // TODO: Type this specific to this type of component.
|
|
|
|
|
|
|
26347 |
|
26348 |
+
workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there
|
26349 |
+
// is a new ref we mark this as an update. All the work is done in commitWork.
|
26350 |
|
26351 |
+
if (updatePayload) {
|
26352 |
+
markUpdate(workInProgress);
|
26353 |
+
}
|
26354 |
+
};
|
26355 |
|
26356 |
+
updateHostText$1 = function (current, workInProgress, oldText, newText) {
|
26357 |
+
// If the text differs, mark it as an update. All the work in done in commitWork.
|
26358 |
+
if (oldText !== newText) {
|
26359 |
+
markUpdate(workInProgress);
|
|
|
26360 |
}
|
26361 |
+
};
|
26362 |
}
|
26363 |
|
26364 |
+
function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
26365 |
+
if (getIsHydrating()) {
|
26366 |
+
// If we're hydrating, we should consume as many items as we can
|
26367 |
+
// so we don't leave any behind.
|
26368 |
+
return;
|
26369 |
+
}
|
26370 |
|
26371 |
+
switch (renderState.tailMode) {
|
26372 |
+
case 'hidden':
|
26373 |
+
{
|
26374 |
+
// Any insertions at the end of the tail list after this point
|
26375 |
+
// should be invisible. If there are already mounted boundaries
|
26376 |
+
// anything before them are not considered for collapsing.
|
26377 |
+
// Therefore we need to go through the whole tail to find if
|
26378 |
+
// there are any.
|
26379 |
+
var tailNode = renderState.tail;
|
26380 |
+
var lastTailNode = null;
|
26381 |
|
26382 |
+
while (tailNode !== null) {
|
26383 |
+
if (tailNode.alternate !== null) {
|
26384 |
+
lastTailNode = tailNode;
|
26385 |
+
}
|
|
|
26386 |
|
26387 |
+
tailNode = tailNode.sibling;
|
26388 |
+
} // Next we're simply going to delete all insertions after the
|
26389 |
+
// last rendered item.
|
|
|
26390 |
|
|
|
|
|
26391 |
|
26392 |
+
if (lastTailNode === null) {
|
26393 |
+
// All remaining items in the tail are insertions.
|
26394 |
+
renderState.tail = null;
|
26395 |
+
} else {
|
26396 |
+
// Detach the insertion after the last node that was already
|
26397 |
+
// inserted.
|
26398 |
+
lastTailNode.sibling = null;
|
26399 |
+
}
|
26400 |
|
26401 |
+
break;
|
26402 |
+
}
|
|
|
26403 |
|
26404 |
+
case 'collapsed':
|
26405 |
+
{
|
26406 |
+
// Any insertions at the end of the tail list after this point
|
26407 |
+
// should be invisible. If there are already mounted boundaries
|
26408 |
+
// anything before them are not considered for collapsing.
|
26409 |
+
// Therefore we need to go through the whole tail to find if
|
26410 |
+
// there are any.
|
26411 |
+
var _tailNode = renderState.tail;
|
26412 |
+
var _lastTailNode = null;
|
26413 |
|
26414 |
+
while (_tailNode !== null) {
|
26415 |
+
if (_tailNode.alternate !== null) {
|
26416 |
+
_lastTailNode = _tailNode;
|
|
|
|
|
|
|
|
|
26417 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
26418 |
|
26419 |
+
_tailNode = _tailNode.sibling;
|
26420 |
+
} // Next we're simply going to delete all insertions after the
|
26421 |
+
// last rendered item.
|
26422 |
|
|
|
|
|
|
|
|
|
26423 |
|
26424 |
+
if (_lastTailNode === null) {
|
26425 |
+
// All remaining items in the tail are insertions.
|
26426 |
+
if (!hasRenderedATailFallback && renderState.tail !== null) {
|
26427 |
+
// We suspended during the head. We want to show at least one
|
26428 |
+
// row at the tail. So we'll keep on and cut off the rest.
|
26429 |
+
renderState.tail.sibling = null;
|
26430 |
+
} else {
|
26431 |
+
renderState.tail = null;
|
26432 |
}
|
26433 |
} else {
|
26434 |
+
// Detach the insertion after the last node that was already
|
26435 |
+
// inserted.
|
26436 |
+
_lastTailNode.sibling = null;
|
26437 |
}
|
26438 |
+
|
26439 |
+
break;
|
26440 |
}
|
|
|
26441 |
}
|
26442 |
}
|
26443 |
|
26444 |
+
function completeWork(current, workInProgress, renderLanes) {
|
26445 |
+
var newProps = workInProgress.pendingProps;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26446 |
|
26447 |
+
switch (workInProgress.tag) {
|
26448 |
+
case IndeterminateComponent:
|
26449 |
+
case LazyComponent:
|
26450 |
+
case SimpleMemoComponent:
|
26451 |
+
case FunctionComponent:
|
26452 |
+
case ForwardRef:
|
26453 |
+
case Fragment:
|
26454 |
+
case Mode:
|
26455 |
+
case Profiler:
|
26456 |
+
case ContextConsumer:
|
26457 |
+
case MemoComponent:
|
26458 |
+
return null;
|
26459 |
|
26460 |
+
case ClassComponent:
|
26461 |
+
{
|
26462 |
+
var Component = workInProgress.type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26463 |
|
26464 |
+
if (isContextProvider(Component)) {
|
26465 |
+
popContext(workInProgress);
|
26466 |
+
}
|
|
|
|
|
26467 |
|
26468 |
+
return null;
|
26469 |
+
}
|
|
|
|
|
|
|
|
|
26470 |
|
26471 |
+
case HostRoot:
|
26472 |
+
{
|
26473 |
+
popHostContainer(workInProgress);
|
26474 |
+
popTopLevelContextObject(workInProgress);
|
26475 |
+
resetWorkInProgressVersions();
|
26476 |
+
var fiberRoot = workInProgress.stateNode;
|
26477 |
|
26478 |
+
if (fiberRoot.pendingContext) {
|
26479 |
+
fiberRoot.context = fiberRoot.pendingContext;
|
26480 |
+
fiberRoot.pendingContext = null;
|
26481 |
+
}
|
26482 |
|
26483 |
+
if (current === null || current.child === null) {
|
26484 |
+
// If we hydrated, pop so that we can delete any remaining children
|
26485 |
+
// that weren't hydrated.
|
26486 |
+
var wasHydrated = popHydrationState(workInProgress);
|
|
|
|
|
|
|
|
|
|
|
|
|
26487 |
|
26488 |
+
if (wasHydrated) {
|
26489 |
+
// If we hydrated, then we'll need to schedule an update for
|
26490 |
+
// the commit side-effects on the root.
|
26491 |
+
markUpdate(workInProgress);
|
26492 |
+
} else if (!fiberRoot.hydrate) {
|
26493 |
+
// Schedule an effect to clear this container at the start of the next commit.
|
26494 |
+
// This handles the case of React rendering into a container with previous children.
|
26495 |
+
// It's also safe to do for updates too, because current.child would only be null
|
26496 |
+
// if the previous render was null (so the the container would already be empty).
|
26497 |
+
workInProgress.flags |= Snapshot;
|
26498 |
}
|
|
|
|
|
|
|
|
|
26499 |
}
|
26500 |
|
26501 |
+
updateHostContainer(workInProgress);
|
26502 |
+
return null;
|
26503 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26504 |
|
26505 |
+
case HostComponent:
|
26506 |
+
{
|
26507 |
+
popHostContext(workInProgress);
|
26508 |
+
var rootContainerInstance = getRootHostContainer();
|
26509 |
+
var type = workInProgress.type;
|
26510 |
|
26511 |
+
if (current !== null && workInProgress.stateNode != null) {
|
26512 |
+
updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
|
|
|
|
|
|
|
|
|
|
|
|
|
26513 |
|
26514 |
+
if (current.ref !== workInProgress.ref) {
|
26515 |
+
markRef$1(workInProgress);
|
26516 |
+
}
|
26517 |
+
} else {
|
26518 |
+
if (!newProps) {
|
26519 |
+
if (!(workInProgress.stateNode !== null)) {
|
26520 |
+
{
|
26521 |
+
throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." );
|
26522 |
+
}
|
26523 |
+
} // This can happen when we abort work.
|
26524 |
|
|
|
|
|
26525 |
|
26526 |
+
return null;
|
26527 |
+
}
|
|
|
26528 |
|
26529 |
+
var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context
|
26530 |
+
// "stack" as the parent. Then append children as we go in beginWork
|
26531 |
+
// or completeWork depending on whether we want to add them top->down or
|
26532 |
+
// bottom->up. Top->down is faster in IE11.
|
|
|
|
|
|
|
|
|
|
|
|
|
26533 |
|
26534 |
+
var _wasHydrated = popHydrationState(workInProgress);
|
|
|
26535 |
|
26536 |
+
if (_wasHydrated) {
|
26537 |
+
// TODO: Move this and createInstance step into the beginPhase
|
26538 |
+
// to consolidate.
|
26539 |
+
if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
|
26540 |
+
// If changes to the hydrated node need to be applied at the
|
26541 |
+
// commit-phase we mark this as such.
|
26542 |
+
markUpdate(workInProgress);
|
26543 |
+
}
|
26544 |
+
} else {
|
26545 |
+
var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
|
26546 |
+
appendAllChildren(instance, workInProgress, false, false);
|
26547 |
+
workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount.
|
26548 |
+
// (eg DOM renderer supports auto-focus for certain elements).
|
26549 |
+
// Make sure such renderers get scheduled for later work.
|
26550 |
|
26551 |
+
if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) {
|
26552 |
+
markUpdate(workInProgress);
|
26553 |
+
}
|
26554 |
+
}
|
|
|
|
|
26555 |
|
26556 |
+
if (workInProgress.ref !== null) {
|
26557 |
+
// If there is a ref on a host node we need to schedule a callback
|
26558 |
+
markRef$1(workInProgress);
|
26559 |
+
}
|
26560 |
+
}
|
26561 |
|
26562 |
+
return null;
|
26563 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26564 |
|
26565 |
+
case HostText:
|
26566 |
+
{
|
26567 |
+
var newText = newProps;
|
26568 |
|
26569 |
+
if (current && workInProgress.stateNode != null) {
|
26570 |
+
var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need
|
26571 |
+
// to schedule a side-effect to do the updates.
|
26572 |
|
26573 |
+
updateHostText$1(current, workInProgress, oldText, newText);
|
26574 |
+
} else {
|
26575 |
+
if (typeof newText !== 'string') {
|
26576 |
+
if (!(workInProgress.stateNode !== null)) {
|
26577 |
+
{
|
26578 |
+
throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." );
|
26579 |
+
}
|
26580 |
+
} // This can happen when we abort work.
|
|
|
|
|
|
|
26581 |
|
26582 |
+
}
|
|
|
|
|
|
|
26583 |
|
26584 |
+
var _rootContainerInstance = getRootHostContainer();
|
26585 |
|
26586 |
+
var _currentHostContext = getHostContext();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26587 |
|
26588 |
+
var _wasHydrated2 = popHydrationState(workInProgress);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26589 |
|
26590 |
+
if (_wasHydrated2) {
|
26591 |
+
if (prepareToHydrateHostTextInstance(workInProgress)) {
|
26592 |
+
markUpdate(workInProgress);
|
26593 |
+
}
|
26594 |
+
} else {
|
26595 |
+
workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
|
26596 |
+
}
|
26597 |
}
|
|
|
|
|
|
|
|
|
|
|
26598 |
|
26599 |
+
return null;
|
26600 |
+
}
|
26601 |
|
26602 |
+
case SuspenseComponent:
|
26603 |
+
{
|
26604 |
+
popSuspenseContext(workInProgress);
|
26605 |
+
var nextState = workInProgress.memoizedState;
|
|
|
26606 |
|
26607 |
+
if ((workInProgress.flags & DidCapture) !== NoFlags) {
|
26608 |
+
// Something suspended. Re-render with the fallback children.
|
26609 |
+
workInProgress.lanes = renderLanes; // Do not reset the effect list.
|
26610 |
|
26611 |
+
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
26612 |
+
transferActualDuration(workInProgress);
|
26613 |
+
}
|
|
|
|
|
|
|
26614 |
|
26615 |
+
return workInProgress;
|
26616 |
+
}
|
26617 |
|
26618 |
+
var nextDidTimeout = nextState !== null;
|
26619 |
+
var prevDidTimeout = false;
|
|
|
|
|
26620 |
|
26621 |
+
if (current === null) {
|
26622 |
+
if (workInProgress.memoizedProps.fallback !== undefined) {
|
26623 |
+
popHydrationState(workInProgress);
|
26624 |
+
}
|
26625 |
+
} else {
|
26626 |
+
var prevState = current.memoizedState;
|
26627 |
+
prevDidTimeout = prevState !== null;
|
26628 |
+
}
|
26629 |
|
26630 |
+
if (nextDidTimeout && !prevDidTimeout) {
|
26631 |
+
// If this subtreee is running in blocking mode we can suspend,
|
26632 |
+
// otherwise we won't suspend.
|
26633 |
+
// TODO: This will still suspend a synchronous tree if anything
|
26634 |
+
// in the concurrent tree already suspended during this render.
|
26635 |
+
// This is a known bug.
|
26636 |
+
if ((workInProgress.mode & BlockingMode) !== NoMode) {
|
26637 |
+
// TODO: Move this back to throwException because this is too late
|
26638 |
+
// if this is a large tree which is common for initial loads. We
|
26639 |
+
// don't know if we should restart a render or not until we get
|
26640 |
+
// this marker, and this is too late.
|
26641 |
+
// If this render already had a ping or lower pri updates,
|
26642 |
+
// and this is the first time we know we're going to suspend we
|
26643 |
+
// should be able to immediately restart from within throwException.
|
26644 |
+
var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
|
26645 |
|
26646 |
+
if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
|
26647 |
+
// If this was in an invisible tree or a new render, then showing
|
26648 |
+
// this boundary is ok.
|
26649 |
+
renderDidSuspend();
|
26650 |
+
} else {
|
26651 |
+
// Otherwise, we're going to have to hide content so we should
|
26652 |
+
// suspend for longer if possible.
|
26653 |
+
renderDidSuspendDelayIfPossible();
|
26654 |
+
}
|
26655 |
+
}
|
26656 |
+
}
|
26657 |
|
26658 |
+
{
|
26659 |
+
// TODO: Only schedule updates if these values are non equal, i.e. it changed.
|
26660 |
+
if (nextDidTimeout || prevDidTimeout) {
|
26661 |
+
// If this boundary just timed out, schedule an effect to attach a
|
26662 |
+
// retry listener to the promise. This flag is also used to hide the
|
26663 |
+
// primary children. In mutation mode, we also need the flag to
|
26664 |
+
// *unhide* children that were previously hidden, so check if this
|
26665 |
+
// is currently timed out, too.
|
26666 |
+
workInProgress.flags |= Update;
|
26667 |
+
}
|
26668 |
+
}
|
26669 |
|
26670 |
+
return null;
|
26671 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26672 |
|
26673 |
+
case HostPortal:
|
26674 |
+
popHostContainer(workInProgress);
|
26675 |
+
updateHostContainer(workInProgress);
|
26676 |
|
26677 |
+
if (current === null) {
|
26678 |
+
preparePortalMount(workInProgress.stateNode.containerInfo);
|
26679 |
+
}
|
|
|
26680 |
|
26681 |
+
return null;
|
26682 |
|
26683 |
+
case ContextProvider:
|
26684 |
+
// Pop provider fiber
|
26685 |
+
popProvider(workInProgress);
|
26686 |
+
return null;
|
26687 |
|
26688 |
+
case IncompleteClassComponent:
|
26689 |
+
{
|
26690 |
+
// Same as class component case. I put it down here so that the tags are
|
26691 |
+
// sequential to ensure this switch is compiled to a jump table.
|
26692 |
+
var _Component = workInProgress.type;
|
26693 |
|
26694 |
+
if (isContextProvider(_Component)) {
|
26695 |
+
popContext(workInProgress);
|
26696 |
+
}
|
|
|
26697 |
|
26698 |
+
return null;
|
|
|
26699 |
}
|
26700 |
|
26701 |
+
case SuspenseListComponent:
|
26702 |
+
{
|
26703 |
+
popSuspenseContext(workInProgress);
|
26704 |
+
var renderState = workInProgress.memoizedState;
|
26705 |
|
26706 |
+
if (renderState === null) {
|
26707 |
+
// We're running in the default, "independent" mode.
|
26708 |
+
// We don't do anything in this mode.
|
26709 |
+
return null;
|
26710 |
}
|
|
|
|
|
|
|
|
|
|
|
26711 |
|
26712 |
+
var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags;
|
26713 |
+
var renderedTail = renderState.rendering;
|
26714 |
|
26715 |
+
if (renderedTail === null) {
|
26716 |
+
// We just rendered the head.
|
26717 |
+
if (!didSuspendAlready) {
|
26718 |
+
// This is the first pass. We need to figure out if anything is still
|
26719 |
+
// suspended in the rendered set.
|
26720 |
+
// If new content unsuspended, but there's still some content that
|
26721 |
+
// didn't. Then we need to do a second pass that forces everything
|
26722 |
+
// to keep showing their fallbacks.
|
26723 |
+
// We might be suspended if something in this render pass suspended, or
|
26724 |
+
// something in the previous committed pass suspended. Otherwise,
|
26725 |
+
// there's no chance so we can skip the expensive call to
|
26726 |
+
// findFirstSuspended.
|
26727 |
+
var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags);
|
26728 |
|
26729 |
+
if (!cannotBeSuspended) {
|
26730 |
+
var row = workInProgress.child;
|
|
|
|
|
|
|
|
|
26731 |
|
26732 |
+
while (row !== null) {
|
26733 |
+
var suspended = findFirstSuspended(row);
|
|
|
26734 |
|
26735 |
+
if (suspended !== null) {
|
26736 |
+
didSuspendAlready = true;
|
26737 |
+
workInProgress.flags |= DidCapture;
|
26738 |
+
cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as
|
26739 |
+
// part of the second pass. In that case nothing will subscribe to
|
26740 |
+
// its thennables. Instead, we'll transfer its thennables to the
|
26741 |
+
// SuspenseList so that it can retry if they resolve.
|
26742 |
+
// There might be multiple of these in the list but since we're
|
26743 |
+
// going to wait for all of them anyway, it doesn't really matter
|
26744 |
+
// which ones gets to ping. In theory we could get clever and keep
|
26745 |
+
// track of how many dependencies remain but it gets tricky because
|
26746 |
+
// in the meantime, we can add/remove/change items and dependencies.
|
26747 |
+
// We might bail out of the loop before finding any but that
|
26748 |
+
// doesn't matter since that means that the other boundaries that
|
26749 |
+
// we did find already has their listeners attached.
|
26750 |
|
26751 |
+
var newThennables = suspended.updateQueue;
|
|
|
26752 |
|
26753 |
+
if (newThennables !== null) {
|
26754 |
+
workInProgress.updateQueue = newThennables;
|
26755 |
+
workInProgress.flags |= Update;
|
26756 |
+
} // Rerender the whole list, but this time, we'll force fallbacks
|
26757 |
+
// to stay in place.
|
26758 |
+
// Reset the effect list before doing the second pass since that's now invalid.
|
26759 |
|
|
|
|
|
|
|
26760 |
|
26761 |
+
if (renderState.lastEffect === null) {
|
26762 |
+
workInProgress.firstEffect = null;
|
26763 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
26764 |
|
26765 |
+
workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
|
|
|
|
|
|
|
|
|
26766 |
|
26767 |
+
resetChildFibers(workInProgress, renderLanes); // Set up the Suspense Context to force suspense and immediately
|
26768 |
+
// rerender the children.
|
|
|
26769 |
|
26770 |
+
pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
|
26771 |
+
return workInProgress.child;
|
26772 |
+
}
|
26773 |
|
26774 |
+
row = row.sibling;
|
26775 |
+
}
|
26776 |
}
|
26777 |
|
26778 |
+
if (renderState.tail !== null && now() > getRenderTargetTime()) {
|
26779 |
+
// We have already passed our CPU deadline but we still have rows
|
26780 |
+
// left in the tail. We'll just give up further attempts to render
|
26781 |
+
// the main content and only render fallbacks.
|
26782 |
+
workInProgress.flags |= DidCapture;
|
26783 |
+
didSuspendAlready = true;
|
26784 |
+
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
26785 |
+
// to get it started back up to attempt the next item. While in terms
|
26786 |
+
// of priority this work has the same priority as this current render,
|
26787 |
+
// it's not part of the same transition once the transition has
|
26788 |
+
// committed. If it's sync, we still want to yield so that it can be
|
26789 |
+
// painted. Conceptually, this is really the same as pinging.
|
26790 |
+
// We can use any RetryLane even if it's the one currently rendering
|
26791 |
+
// since we're leaving it behind on this node.
|
|
|
|
|
|
|
|
|
26792 |
|
26793 |
+
workInProgress.lanes = SomeRetryLane;
|
|
|
|
|
|
|
26794 |
|
26795 |
+
{
|
26796 |
+
markSpawnedWork(SomeRetryLane);
|
26797 |
+
}
|
26798 |
+
}
|
26799 |
+
} else {
|
26800 |
+
cutOffTailIfNeeded(renderState, false);
|
26801 |
+
} // Next we're going to render the tail.
|
26802 |
|
26803 |
+
} else {
|
26804 |
+
// Append the rendered row to the child list.
|
26805 |
+
if (!didSuspendAlready) {
|
26806 |
+
var _suspended = findFirstSuspended(renderedTail);
|
26807 |
|
26808 |
+
if (_suspended !== null) {
|
26809 |
+
workInProgress.flags |= DidCapture;
|
26810 |
+
didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
|
26811 |
+
// get lost if this row ends up dropped during a second pass.
|
26812 |
|
26813 |
+
var _newThennables = _suspended.updateQueue;
|
|
|
|
|
26814 |
|
26815 |
+
if (_newThennables !== null) {
|
26816 |
+
workInProgress.updateQueue = _newThennables;
|
26817 |
+
workInProgress.flags |= Update;
|
26818 |
+
}
|
26819 |
|
26820 |
+
cutOffTailIfNeeded(renderState, true); // This might have been modified.
|
26821 |
|
26822 |
+
if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate && !getIsHydrating() // We don't cut it if we're hydrating.
|
26823 |
+
) {
|
26824 |
+
// We need to delete the row we just rendered.
|
26825 |
+
// Reset the effect list to what it was before we rendered this
|
26826 |
+
// child. The nested children have already appended themselves.
|
26827 |
+
var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
|
26828 |
|
26829 |
+
if (lastEffect !== null) {
|
26830 |
+
lastEffect.nextEffect = null;
|
26831 |
+
} // We're done.
|
|
|
|
|
|
|
|
|
|
|
|
|
26832 |
|
|
|
26833 |
|
|
|
|
|
|
|
|
|
|
|
26834 |
return null;
|
26835 |
}
|
26836 |
+
} else if ( // The time it took to render last row is greater than the remaining
|
26837 |
+
// time we have to render. So rendering one more row would likely
|
26838 |
+
// exceed it.
|
26839 |
+
now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes !== OffscreenLane) {
|
26840 |
+
// We have now passed our CPU deadline and we'll just give up further
|
26841 |
+
// attempts to render the main content and only render fallbacks.
|
26842 |
+
// The assumption is that this is usually faster.
|
26843 |
+
workInProgress.flags |= DidCapture;
|
26844 |
+
didSuspendAlready = true;
|
26845 |
+
cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
|
26846 |
+
// to get it started back up to attempt the next item. While in terms
|
26847 |
+
// of priority this work has the same priority as this current render,
|
26848 |
+
// it's not part of the same transition once the transition has
|
26849 |
+
// committed. If it's sync, we still want to yield so that it can be
|
26850 |
+
// painted. Conceptually, this is really the same as pinging.
|
26851 |
+
// We can use any RetryLane even if it's the one currently rendering
|
26852 |
+
// since we're leaving it behind on this node.
|
26853 |
+
|
26854 |
+
workInProgress.lanes = SomeRetryLane;
|
26855 |
+
|
26856 |
+
{
|
26857 |
+
markSpawnedWork(SomeRetryLane);
|
26858 |
}
|
|
|
|
|
26859 |
}
|
|
|
|
|
26860 |
}
|
26861 |
|
26862 |
+
if (renderState.isBackwards) {
|
26863 |
+
// The effect list of the backwards tail will have been added
|
26864 |
+
// to the end. This breaks the guarantee that life-cycles fire in
|
26865 |
+
// sibling order but that isn't a strong guarantee promised by React.
|
26866 |
+
// Especially since these might also just pop in during future commits.
|
26867 |
+
// Append to the beginning of the list.
|
26868 |
+
renderedTail.sibling = workInProgress.child;
|
26869 |
+
workInProgress.child = renderedTail;
|
26870 |
+
} else {
|
26871 |
+
var previousSibling = renderState.last;
|
26872 |
|
26873 |
+
if (previousSibling !== null) {
|
26874 |
+
previousSibling.sibling = renderedTail;
|
26875 |
+
} else {
|
26876 |
+
workInProgress.child = renderedTail;
|
26877 |
+
}
|
26878 |
|
26879 |
+
renderState.last = renderedTail;
|
26880 |
+
}
|
26881 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26882 |
|
26883 |
+
if (renderState.tail !== null) {
|
26884 |
+
// We still have tail rows to render.
|
26885 |
+
// Pop a row.
|
26886 |
+
var next = renderState.tail;
|
26887 |
+
renderState.rendering = next;
|
26888 |
+
renderState.tail = next.sibling;
|
26889 |
+
renderState.lastEffect = workInProgress.lastEffect;
|
26890 |
+
renderState.renderingStartTime = now();
|
26891 |
+
next.sibling = null; // Restore the context.
|
26892 |
+
// TODO: We can probably just avoid popping it instead and only
|
26893 |
+
// setting it the first time we go from not suspended to suspended.
|
26894 |
|
26895 |
+
var suspenseContext = suspenseStackCursor.current;
|
|
|
|
|
|
|
26896 |
|
26897 |
+
if (didSuspendAlready) {
|
26898 |
+
suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
26899 |
+
} else {
|
26900 |
+
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
26901 |
+
}
|
26902 |
|
26903 |
+
pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row.
|
26904 |
|
26905 |
+
return next;
|
26906 |
+
}
|
|
|
|
|
|
|
|
|
|
|
26907 |
|
26908 |
+
return null;
|
26909 |
+
}
|
26910 |
|
26911 |
+
case FundamentalComponent:
|
26912 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26913 |
|
26914 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26915 |
}
|
26916 |
|
26917 |
+
case ScopeComponent:
|
26918 |
+
{
|
26919 |
+
|
26920 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26921 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26922 |
|
26923 |
+
case Block:
|
26924 |
|
26925 |
+
break;
|
26926 |
|
26927 |
+
case OffscreenComponent:
|
26928 |
+
case LegacyHiddenComponent:
|
26929 |
{
|
26930 |
+
popRenderLanes(workInProgress);
|
|
|
26931 |
|
26932 |
+
if (current !== null) {
|
26933 |
+
var _nextState = workInProgress.memoizedState;
|
26934 |
+
var _prevState = current.memoizedState;
|
26935 |
+
var prevIsHidden = _prevState !== null;
|
26936 |
+
var nextIsHidden = _nextState !== null;
|
26937 |
|
26938 |
+
if (prevIsHidden !== nextIsHidden && newProps.mode !== 'unstable-defer-without-hiding') {
|
26939 |
+
workInProgress.flags |= Update;
|
26940 |
+
}
|
26941 |
+
}
|
26942 |
+
|
26943 |
+
return null;
|
26944 |
}
|
26945 |
+
}
|
26946 |
+
|
26947 |
+
{
|
26948 |
+
{
|
26949 |
+
throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
|
26950 |
+
}
|
26951 |
+
}
|
26952 |
+
}
|
26953 |
|
26954 |
+
function unwindWork(workInProgress, renderLanes) {
|
26955 |
+
switch (workInProgress.tag) {
|
26956 |
case ClassComponent:
|
26957 |
{
|
26958 |
+
var Component = workInProgress.type;
|
|
|
|
|
|
|
26959 |
|
26960 |
+
if (isContextProvider(Component)) {
|
26961 |
+
popContext(workInProgress);
|
26962 |
+
}
|
26963 |
|
26964 |
+
var flags = workInProgress.flags;
|
|
|
26965 |
|
26966 |
+
if (flags & ShouldCapture) {
|
26967 |
+
workInProgress.flags = flags & ~ShouldCapture | DidCapture;
|
26968 |
|
26969 |
+
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
26970 |
+
transferActualDuration(workInProgress);
|
26971 |
+
}
|
26972 |
|
26973 |
+
return workInProgress;
|
26974 |
+
}
|
26975 |
|
26976 |
+
return null;
|
26977 |
+
}
|
26978 |
|
26979 |
+
case HostRoot:
|
26980 |
{
|
26981 |
+
popHostContainer(workInProgress);
|
26982 |
+
popTopLevelContextObject(workInProgress);
|
26983 |
+
resetWorkInProgressVersions();
|
26984 |
+
var _flags = workInProgress.flags;
|
26985 |
|
26986 |
+
if (!((_flags & DidCapture) === NoFlags)) {
|
26987 |
+
{
|
26988 |
+
throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." );
|
26989 |
+
}
|
26990 |
+
}
|
26991 |
|
26992 |
+
workInProgress.flags = _flags & ~ShouldCapture | DidCapture;
|
26993 |
+
return workInProgress;
|
26994 |
}
|
26995 |
|
26996 |
+
case HostComponent:
|
26997 |
+
{
|
26998 |
+
// TODO: popHydrationState
|
26999 |
+
popHostContext(workInProgress);
|
27000 |
+
return null;
|
27001 |
+
}
|
27002 |
|
27003 |
+
case SuspenseComponent:
|
27004 |
+
{
|
27005 |
+
popSuspenseContext(workInProgress);
|
27006 |
|
27007 |
+
var _flags2 = workInProgress.flags;
|
|
|
27008 |
|
27009 |
+
if (_flags2 & ShouldCapture) {
|
27010 |
+
workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary.
|
27011 |
|
27012 |
+
if ( (workInProgress.mode & ProfileMode) !== NoMode) {
|
27013 |
+
transferActualDuration(workInProgress);
|
27014 |
+
}
|
27015 |
|
27016 |
+
return workInProgress;
|
27017 |
+
}
|
27018 |
+
|
27019 |
+
return null;
|
27020 |
+
}
|
27021 |
+
|
27022 |
+
case SuspenseListComponent:
|
27023 |
{
|
27024 |
+
popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been
|
27025 |
+
// caught by a nested boundary. If not, it should bubble through.
|
27026 |
|
27027 |
+
return null;
|
27028 |
+
}
|
27029 |
|
27030 |
+
case HostPortal:
|
27031 |
+
popHostContainer(workInProgress);
|
27032 |
+
return null;
|
27033 |
|
27034 |
+
case ContextProvider:
|
27035 |
+
popProvider(workInProgress);
|
27036 |
+
return null;
|
|
|
|
|
|
|
27037 |
|
27038 |
+
case OffscreenComponent:
|
27039 |
+
case LegacyHiddenComponent:
|
27040 |
+
popRenderLanes(workInProgress);
|
27041 |
+
return null;
|
27042 |
|
27043 |
+
default:
|
27044 |
+
return null;
|
27045 |
+
}
|
27046 |
+
}
|
27047 |
|
27048 |
+
function unwindInterruptedWork(interruptedWork) {
|
27049 |
+
switch (interruptedWork.tag) {
|
27050 |
+
case ClassComponent:
|
27051 |
{
|
27052 |
+
var childContextTypes = interruptedWork.type.childContextTypes;
|
|
|
27053 |
|
27054 |
+
if (childContextTypes !== null && childContextTypes !== undefined) {
|
27055 |
+
popContext(interruptedWork);
|
27056 |
+
}
|
27057 |
|
27058 |
+
break;
|
27059 |
}
|
27060 |
|
27061 |
+
case HostRoot:
|
27062 |
{
|
27063 |
+
popHostContainer(interruptedWork);
|
27064 |
+
popTopLevelContextObject(interruptedWork);
|
27065 |
+
resetWorkInProgressVersions();
|
27066 |
+
break;
|
27067 |
}
|
27068 |
|
27069 |
+
case HostComponent:
|
27070 |
{
|
27071 |
+
popHostContext(interruptedWork);
|
27072 |
break;
|
27073 |
}
|
27074 |
|
27075 |
+
case HostPortal:
|
27076 |
+
popHostContainer(interruptedWork);
|
27077 |
+
break;
|
27078 |
|
27079 |
+
case SuspenseComponent:
|
27080 |
+
popSuspenseContext(interruptedWork);
|
27081 |
+
break;
|
27082 |
|
27083 |
+
case SuspenseListComponent:
|
27084 |
+
popSuspenseContext(interruptedWork);
|
27085 |
+
break;
|
27086 |
|
27087 |
+
case ContextProvider:
|
27088 |
+
popProvider(interruptedWork);
|
27089 |
+
break;
|
27090 |
|
27091 |
case OffscreenComponent:
|
|
|
|
|
|
|
|
|
27092 |
case LegacyHiddenComponent:
|
27093 |
+
popRenderLanes(interruptedWork);
|
27094 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27095 |
}
|
27096 |
}
|
27097 |
|
27098 |
+
function createCapturedValue(value, source) {
|
27099 |
+
// If the value is an error, call this function immediately after it is thrown
|
27100 |
+
// so the stack is accurate.
|
27101 |
+
return {
|
27102 |
+
value: value,
|
27103 |
+
source: source,
|
27104 |
+
stack: getStackByFiberInDevAndProd(source)
|
27105 |
+
};
|
27106 |
}
|
27107 |
|
27108 |
+
// This module is forked in different environments.
|
27109 |
+
// By default, return `true` to log errors to the console.
|
27110 |
+
// Forks can return `false` if this isn't desirable.
|
27111 |
+
function showErrorDialog(boundary, errorInfo) {
|
27112 |
+
return true;
|
27113 |
}
|
27114 |
|
27115 |
+
function logCapturedError(boundary, errorInfo) {
|
27116 |
+
try {
|
27117 |
+
var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging.
|
27118 |
+
// This enables renderers like ReactNative to better manage redbox behavior.
|
27119 |
|
27120 |
+
if (logError === false) {
|
27121 |
+
return;
|
27122 |
+
}
|
|
|
|
|
|
|
27123 |
|
27124 |
+
var error = errorInfo.value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27125 |
|
27126 |
+
if (true) {
|
27127 |
+
var source = errorInfo.source;
|
27128 |
+
var stack = errorInfo.stack;
|
27129 |
+
var componentStack = stack !== null ? stack : ''; // Browsers support silencing uncaught errors by calling
|
27130 |
+
// `preventDefault()` in window `error` handler.
|
27131 |
+
// We record this information as an expando on the error.
|
27132 |
|
27133 |
+
if (error != null && error._suppressLogging) {
|
27134 |
+
if (boundary.tag === ClassComponent) {
|
27135 |
+
// The error is recoverable and was silenced.
|
27136 |
+
// Ignore it and don't print the stack addendum.
|
27137 |
+
// This is handy for testing error boundaries without noise.
|
27138 |
return;
|
27139 |
+
} // The error is fatal. Since the silencing might have
|
27140 |
+
// been accidental, we'll surface it anyway.
|
27141 |
+
// However, the browser would have silenced the original error
|
27142 |
+
// so we'll print it first, and then print the stack addendum.
|
27143 |
|
|
|
|
|
27144 |
|
27145 |
+
console['error'](error); // Don't transform to our wrapper
|
27146 |
+
// For a more detailed description of this block, see:
|
27147 |
+
// https://github.com/facebook/react/pull/13384
|
27148 |
+
}
|
27149 |
|
27150 |
+
var componentName = source ? getComponentName(source.type) : null;
|
27151 |
+
var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:';
|
27152 |
+
var errorBoundaryMessage;
|
27153 |
+
var errorBoundaryName = getComponentName(boundary.type);
|
27154 |
|
27155 |
+
if (errorBoundaryName) {
|
27156 |
+
errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
|
27157 |
+
} else {
|
27158 |
+
errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.';
|
27159 |
+
}
|
27160 |
|
27161 |
+
var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack.
|
27162 |
+
// We don't include the original error message and JS stack because the browser
|
27163 |
+
// has already printed it. Even if the application swallows the error, it is still
|
27164 |
+
// displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
|
|
|
|
|
|
|
|
|
27165 |
|
27166 |
+
console['error'](combinedMessage); // Don't transform to our wrapper
|
27167 |
+
} else {}
|
27168 |
+
} catch (e) {
|
27169 |
+
// This method must not throw, or React internal state will get messed up.
|
27170 |
+
// If console.error is overridden, or logCapturedError() shows a dialog that throws,
|
27171 |
+
// we want to report this error outside of the normal stack as a last resort.
|
27172 |
+
// https://github.com/facebook/react/issues/13188
|
27173 |
+
setTimeout(function () {
|
27174 |
+
throw e;
|
27175 |
+
});
|
27176 |
+
}
|
27177 |
+
}
|
27178 |
|
27179 |
+
var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
|
|
|
|
|
27180 |
|
27181 |
+
function createRootErrorUpdate(fiber, errorInfo, lane) {
|
27182 |
+
var update = createUpdate(NoTimestamp, lane); // Unmount the root by rendering null.
|
27183 |
|
27184 |
+
update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property
|
27185 |
+
// being called "element".
|
27186 |
|
27187 |
+
update.payload = {
|
27188 |
+
element: null
|
|
|
27189 |
};
|
27190 |
+
var error = errorInfo.value;
|
27191 |
|
27192 |
+
update.callback = function () {
|
27193 |
+
onUncaughtError(error);
|
27194 |
+
logCapturedError(fiber, errorInfo);
|
|
|
|
|
27195 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27196 |
|
27197 |
+
return update;
|
27198 |
+
}
|
|
|
|
|
27199 |
|
27200 |
+
function createClassErrorUpdate(fiber, errorInfo, lane) {
|
27201 |
+
var update = createUpdate(NoTimestamp, lane);
|
27202 |
+
update.tag = CaptureUpdate;
|
27203 |
+
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
27204 |
|
27205 |
+
if (typeof getDerivedStateFromError === 'function') {
|
27206 |
+
var error$1 = errorInfo.value;
|
27207 |
|
27208 |
+
update.payload = function () {
|
27209 |
+
logCapturedError(fiber, errorInfo);
|
27210 |
+
return getDerivedStateFromError(error$1);
|
27211 |
+
};
|
27212 |
+
}
|
|
|
|
|
|
|
27213 |
|
27214 |
+
var inst = fiber.stateNode;
|
|
|
27215 |
|
27216 |
+
if (inst !== null && typeof inst.componentDidCatch === 'function') {
|
27217 |
+
update.callback = function callback() {
|
27218 |
{
|
27219 |
+
markFailedErrorBoundaryForHotReloading(fiber);
|
27220 |
+
}
|
|
|
|
|
|
|
|
|
|
|
27221 |
|
27222 |
+
if (typeof getDerivedStateFromError !== 'function') {
|
27223 |
+
// To preserve the preexisting retry behavior of error boundaries,
|
27224 |
+
// we keep track of which ones already failed during this batch.
|
27225 |
+
// This gets reset before we yield back to the browser.
|
27226 |
+
// TODO: Warn in strict mode if getDerivedStateFromError is
|
27227 |
+
// not defined.
|
27228 |
+
markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined
|
27229 |
|
27230 |
+
logCapturedError(fiber, errorInfo);
|
27231 |
+
}
|
|
|
27232 |
|
27233 |
+
var error$1 = errorInfo.value;
|
27234 |
+
var stack = errorInfo.stack;
|
27235 |
+
this.componentDidCatch(error$1, {
|
27236 |
+
componentStack: stack !== null ? stack : ''
|
27237 |
+
});
|
27238 |
|
27239 |
+
{
|
27240 |
+
if (typeof getDerivedStateFromError !== 'function') {
|
27241 |
+
// If componentDidCatch is the only error boundary method defined,
|
27242 |
+
// then it needs to call setState to recover from errors.
|
27243 |
+
// If no state update is scheduled then the boundary will swallow the error.
|
27244 |
+
if (!includesSomeLane(fiber.lanes, SyncLane)) {
|
27245 |
+
error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown');
|
|
|
27246 |
}
|
|
|
|
|
|
|
|
|
27247 |
}
|
|
|
|
|
27248 |
}
|
27249 |
+
};
|
27250 |
+
} else {
|
27251 |
+
update.callback = function () {
|
27252 |
+
markFailedErrorBoundaryForHotReloading(fiber);
|
27253 |
+
};
|
27254 |
}
|
|
|
27255 |
|
27256 |
+
return update;
|
27257 |
+
}
|
27258 |
|
27259 |
+
function attachPingListener(root, wakeable, lanes) {
|
27260 |
+
// Attach a listener to the promise to "ping" the root and retry. But only if
|
27261 |
+
// one does not already exist for the lanes we're currently rendering (which
|
27262 |
+
// acts like a "thread ID" here).
|
27263 |
+
var pingCache = root.pingCache;
|
27264 |
+
var threadIDs;
|
|
|
|
|
|
|
|
|
|
|
|
|
27265 |
|
27266 |
+
if (pingCache === null) {
|
27267 |
+
pingCache = root.pingCache = new PossiblyWeakMap$1();
|
27268 |
+
threadIDs = new Set();
|
27269 |
+
pingCache.set(wakeable, threadIDs);
|
27270 |
+
} else {
|
27271 |
+
threadIDs = pingCache.get(wakeable);
|
27272 |
|
27273 |
+
if (threadIDs === undefined) {
|
27274 |
+
threadIDs = new Set();
|
27275 |
+
pingCache.set(wakeable, threadIDs);
|
27276 |
+
}
|
27277 |
+
}
|
27278 |
|
27279 |
+
if (!threadIDs.has(lanes)) {
|
27280 |
+
// Memoize using the thread ID to prevent redundant listeners.
|
27281 |
+
threadIDs.add(lanes);
|
27282 |
+
var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes);
|
27283 |
+
wakeable.then(ping, ping);
|
27284 |
+
}
|
27285 |
+
}
|
27286 |
|
27287 |
+
function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) {
|
27288 |
+
// The source fiber did not complete.
|
27289 |
+
sourceFiber.flags |= Incomplete; // Its effect list is no longer valid.
|
|
|
|
|
|
|
27290 |
|
27291 |
+
sourceFiber.firstEffect = sourceFiber.lastEffect = null;
|
|
|
|
|
|
|
27292 |
|
27293 |
+
if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
|
27294 |
+
// This is a wakeable.
|
27295 |
+
var wakeable = value;
|
|
|
27296 |
|
27297 |
+
if ((sourceFiber.mode & BlockingMode) === NoMode) {
|
27298 |
+
// Reset the memoizedState to what it was before we attempted
|
27299 |
+
// to render it.
|
27300 |
+
var currentSource = sourceFiber.alternate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27301 |
|
27302 |
+
if (currentSource) {
|
27303 |
+
sourceFiber.updateQueue = currentSource.updateQueue;
|
27304 |
+
sourceFiber.memoizedState = currentSource.memoizedState;
|
27305 |
+
sourceFiber.lanes = currentSource.lanes;
|
27306 |
+
} else {
|
27307 |
+
sourceFiber.updateQueue = null;
|
27308 |
+
sourceFiber.memoizedState = null;
|
27309 |
}
|
27310 |
+
}
|
27311 |
|
27312 |
+
var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext); // Schedule the nearest Suspense to re-render the timed out view.
|
|
|
|
|
|
|
|
|
27313 |
|
27314 |
+
var _workInProgress = returnFiber;
|
|
|
27315 |
|
27316 |
+
do {
|
27317 |
+
if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
|
27318 |
+
// Found the nearest boundary.
|
27319 |
+
// Stash the promise on the boundary fiber. If the boundary times out, we'll
|
27320 |
+
// attach another listener to flip the boundary back to its normal state.
|
27321 |
+
var wakeables = _workInProgress.updateQueue;
|
27322 |
+
|
27323 |
+
if (wakeables === null) {
|
27324 |
+
var updateQueue = new Set();
|
27325 |
+
updateQueue.add(wakeable);
|
27326 |
+
_workInProgress.updateQueue = updateQueue;
|
27327 |
} else {
|
27328 |
+
wakeables.add(wakeable);
|
27329 |
+
} // If the boundary is outside of blocking mode, we should *not*
|
27330 |
+
// suspend the commit. Pretend as if the suspended component rendered
|
27331 |
+
// null and keep rendering. In the commit phase, we'll schedule a
|
27332 |
+
// subsequent synchronous update to re-render the Suspense.
|
27333 |
+
//
|
27334 |
+
// Note: It doesn't matter whether the component that suspended was
|
27335 |
+
// inside a blocking mode tree. If the Suspense is outside of it, we
|
27336 |
+
// should *not* suspend the commit.
|
27337 |
|
27338 |
|
27339 |
+
if ((_workInProgress.mode & BlockingMode) === NoMode) {
|
27340 |
+
_workInProgress.flags |= DidCapture;
|
27341 |
+
sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete.
|
27342 |
+
// But we shouldn't call any lifecycle methods or callbacks. Remove
|
27343 |
+
// all lifecycle effect tags.
|
27344 |
|
27345 |
+
sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
|
|
|
|
|
|
|
27346 |
|
27347 |
+
if (sourceFiber.tag === ClassComponent) {
|
27348 |
+
var currentSourceFiber = sourceFiber.alternate;
|
27349 |
|
27350 |
+
if (currentSourceFiber === null) {
|
27351 |
+
// This is a new mount. Change the tag so it's not mistaken for a
|
27352 |
+
// completed class component. For example, we should not call
|
27353 |
+
// componentWillUnmount if it is deleted.
|
27354 |
+
sourceFiber.tag = IncompleteClassComponent;
|
27355 |
+
} else {
|
27356 |
+
// When we try rendering again, we should not reuse the current fiber,
|
27357 |
+
// since it's known to be in an inconsistent state. Use a force update to
|
27358 |
+
// prevent a bail out.
|
27359 |
+
var update = createUpdate(NoTimestamp, SyncLane);
|
27360 |
+
update.tag = ForceUpdate;
|
27361 |
+
enqueueUpdate(sourceFiber, update);
|
27362 |
}
|
27363 |
+
} // The source fiber did not complete. Mark it with Sync priority to
|
27364 |
+
// indicate that it still has pending work.
|
27365 |
+
|
27366 |
+
|
27367 |
+
sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); // Exit without suspending.
|
27368 |
+
|
27369 |
+
return;
|
27370 |
+
} // Confirmed that the boundary is in a concurrent mode tree. Continue
|
27371 |
+
// with the normal suspend path.
|
27372 |
+
//
|
27373 |
+
// After this we'll use a set of heuristics to determine whether this
|
27374 |
+
// render pass will run to completion or restart or "suspend" the commit.
|
27375 |
+
// The actual logic for this is spread out in different places.
|
27376 |
+
//
|
27377 |
+
// This first principle is that if we're going to suspend when we complete
|
27378 |
+
// a root, then we should also restart if we get an update or ping that
|
27379 |
+
// might unsuspend it, and vice versa. The only reason to suspend is
|
27380 |
+
// because you think you might want to restart before committing. However,
|
27381 |
+
// it doesn't make sense to restart only while in the period we're suspended.
|
27382 |
+
//
|
27383 |
+
// Restarting too aggressively is also not good because it starves out any
|
27384 |
+
// intermediate loading state. So we use heuristics to determine when.
|
27385 |
+
// Suspense Heuristics
|
27386 |
+
//
|
27387 |
+
// If nothing threw a Promise or all the same fallbacks are already showing,
|
27388 |
+
// then don't suspend/restart.
|
27389 |
+
//
|
27390 |
+
// If this is an initial render of a new tree of Suspense boundaries and
|
27391 |
+
// those trigger a fallback, then don't suspend/restart. We want to ensure
|
27392 |
+
// that we can show the initial loading state as quickly as possible.
|
27393 |
+
//
|
27394 |
+
// If we hit a "Delayed" case, such as when we'd switch from content back into
|
27395 |
+
// a fallback, then we should always suspend/restart. Transitions apply
|
27396 |
+
// to this case. If none is defined, JND is used instead.
|
27397 |
+
//
|
27398 |
+
// If we're already showing a fallback and it gets "retried", allowing us to show
|
27399 |
+
// another level, but there's still an inner boundary that would show a fallback,
|
27400 |
+
// then we suspend/restart for 500ms since the last time we showed a fallback
|
27401 |
+
// anywhere in the tree. This effectively throttles progressive loading into a
|
27402 |
+
// consistent train of commits. This also gives us an opportunity to restart to
|
27403 |
+
// get to the completed state slightly earlier.
|
27404 |
+
//
|
27405 |
+
// If there's ambiguity due to batching it's resolved in preference of:
|
27406 |
+
// 1) "delayed", 2) "initial render", 3) "retry".
|
27407 |
+
//
|
27408 |
+
// We want to ensure that a "busy" state doesn't get force committed. We want to
|
27409 |
+
// ensure that new initial loading states can commit as soon as possible.
|
27410 |
|
|
|
|
|
|
|
|
|
27411 |
|
27412 |
+
attachPingListener(root, wakeable, rootRenderLanes);
|
27413 |
+
_workInProgress.flags |= ShouldCapture;
|
27414 |
+
_workInProgress.lanes = rootRenderLanes;
|
27415 |
+
return;
|
27416 |
+
} // This boundary already captured during this render. Continue to the next
|
27417 |
+
// boundary.
|
27418 |
|
|
|
|
|
27419 |
|
27420 |
+
_workInProgress = _workInProgress.return;
|
27421 |
+
} while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode.
|
27422 |
+
// TODO: Use invariant so the message is stripped in prod?
|
27423 |
|
|
|
|
|
|
|
27424 |
|
27425 |
+
value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.');
|
27426 |
+
} // We didn't find a boundary that could handle this type of exception. Start
|
27427 |
+
// over and traverse parent path again, this time treating the exception
|
27428 |
+
// as an error.
|
|
|
|
|
|
|
|
|
27429 |
|
|
|
27430 |
|
27431 |
+
renderDidError();
|
27432 |
+
value = createCapturedValue(value, sourceFiber);
|
27433 |
+
var workInProgress = returnFiber;
|
27434 |
|
27435 |
+
do {
|
27436 |
+
switch (workInProgress.tag) {
|
27437 |
+
case HostRoot:
|
27438 |
+
{
|
27439 |
+
var _errorInfo = value;
|
27440 |
+
workInProgress.flags |= ShouldCapture;
|
27441 |
+
var lane = pickArbitraryLane(rootRenderLanes);
|
27442 |
+
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
|
27443 |
|
27444 |
+
var _update = createRootErrorUpdate(workInProgress, _errorInfo, lane);
|
27445 |
|
27446 |
+
enqueueCapturedUpdate(workInProgress, _update);
|
27447 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
27448 |
}
|
27449 |
|
27450 |
+
case ClassComponent:
|
27451 |
+
// Capture and retry
|
27452 |
+
var errorInfo = value;
|
27453 |
+
var ctor = workInProgress.type;
|
27454 |
+
var instance = workInProgress.stateNode;
|
|
|
|
|
27455 |
|
27456 |
+
if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
27457 |
+
workInProgress.flags |= ShouldCapture;
|
|
|
27458 |
|
27459 |
+
var _lane = pickArbitraryLane(rootRenderLanes);
|
|
|
|
|
27460 |
|
27461 |
+
workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state
|
|
|
27462 |
|
27463 |
+
var _update2 = createClassErrorUpdate(workInProgress, errorInfo, _lane);
|
|
|
27464 |
|
27465 |
+
enqueueCapturedUpdate(workInProgress, _update2);
|
27466 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
27467 |
}
|
27468 |
|
27469 |
+
break;
|
27470 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27471 |
|
27472 |
+
workInProgress = workInProgress.return;
|
27473 |
+
} while (workInProgress !== null);
|
27474 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27475 |
|
27476 |
+
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27477 |
|
27478 |
+
{
|
27479 |
+
didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
|
27480 |
+
}
|
27481 |
|
27482 |
+
var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
|
|
|
|
|
27483 |
|
27484 |
+
var callComponentWillUnmountWithTimer = function (current, instance) {
|
27485 |
+
instance.props = current.memoizedProps;
|
27486 |
+
instance.state = current.memoizedState;
|
27487 |
|
27488 |
+
{
|
27489 |
+
instance.componentWillUnmount();
|
27490 |
+
}
|
27491 |
+
}; // Capture errors so they don't interrupt unmounting.
|
27492 |
|
|
|
|
|
|
|
|
|
27493 |
|
27494 |
+
function safelyCallComponentWillUnmount(current, instance) {
|
27495 |
+
{
|
27496 |
+
invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance);
|
|
|
|
|
27497 |
|
27498 |
+
if (hasCaughtError()) {
|
27499 |
+
var unmountError = clearCaughtError();
|
27500 |
+
captureCommitPhaseError(current, unmountError);
|
27501 |
+
}
|
27502 |
+
}
|
27503 |
+
}
|
27504 |
|
27505 |
+
function safelyDetachRef(current) {
|
27506 |
+
var ref = current.ref;
|
27507 |
|
27508 |
+
if (ref !== null) {
|
27509 |
+
if (typeof ref === 'function') {
|
27510 |
{
|
27511 |
+
invokeGuardedCallback(null, ref, null, null);
|
|
|
27512 |
|
27513 |
+
if (hasCaughtError()) {
|
27514 |
+
var refError = clearCaughtError();
|
27515 |
+
captureCommitPhaseError(current, refError);
|
|
|
27516 |
}
|
27517 |
+
}
|
27518 |
+
} else {
|
27519 |
+
ref.current = null;
|
27520 |
+
}
|
27521 |
+
}
|
27522 |
+
}
|
27523 |
|
27524 |
+
function safelyCallDestroy(current, destroy) {
|
27525 |
+
{
|
27526 |
+
invokeGuardedCallback(null, destroy, null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27527 |
|
27528 |
+
if (hasCaughtError()) {
|
27529 |
+
var error = clearCaughtError();
|
27530 |
+
captureCommitPhaseError(current, error);
|
27531 |
+
}
|
27532 |
+
}
|
27533 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27534 |
|
27535 |
+
function commitBeforeMutationLifeCycles(current, finishedWork) {
|
27536 |
+
switch (finishedWork.tag) {
|
27537 |
+
case FunctionComponent:
|
27538 |
+
case ForwardRef:
|
27539 |
+
case SimpleMemoComponent:
|
27540 |
+
case Block:
|
27541 |
+
{
|
27542 |
+
return;
|
27543 |
+
}
|
27544 |
|
27545 |
+
case ClassComponent:
|
27546 |
+
{
|
27547 |
+
if (finishedWork.flags & Snapshot) {
|
27548 |
+
if (current !== null) {
|
27549 |
+
var prevProps = current.memoizedProps;
|
27550 |
+
var prevState = current.memoizedState;
|
27551 |
+
var instance = finishedWork.stateNode; // We could update instance props and state here,
|
27552 |
+
// but instead we rely on them being set during last render.
|
27553 |
+
// TODO: revisit this when we implement resuming.
|
27554 |
|
27555 |
+
{
|
27556 |
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
27557 |
+
if (instance.props !== finishedWork.memoizedProps) {
|
27558 |
+
error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27559 |
+
}
|
27560 |
|
27561 |
+
if (instance.state !== finishedWork.memoizedState) {
|
27562 |
+
error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27563 |
+
}
|
27564 |
+
}
|
27565 |
+
}
|
27566 |
|
27567 |
+
var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
|
27568 |
|
27569 |
+
{
|
27570 |
+
var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
|
27571 |
|
27572 |
+
if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
|
27573 |
+
didWarnSet.add(finishedWork.type);
|
|
|
27574 |
|
27575 |
+
error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
|
27576 |
}
|
27577 |
}
|
27578 |
|
27579 |
+
instance.__reactInternalSnapshotBeforeUpdate = snapshot;
|
27580 |
+
}
|
27581 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27582 |
|
27583 |
+
return;
|
27584 |
+
}
|
27585 |
|
27586 |
+
case HostRoot:
|
27587 |
+
{
|
27588 |
+
{
|
27589 |
+
if (finishedWork.flags & Snapshot) {
|
27590 |
+
var root = finishedWork.stateNode;
|
27591 |
+
clearContainer(root.containerInfo);
|
27592 |
+
}
|
27593 |
+
}
|
27594 |
|
27595 |
+
return;
|
27596 |
+
}
|
|
|
|
|
27597 |
|
27598 |
+
case HostComponent:
|
27599 |
+
case HostText:
|
27600 |
+
case HostPortal:
|
27601 |
+
case IncompleteClassComponent:
|
27602 |
+
// Nothing to do for these component types
|
27603 |
+
return;
|
27604 |
+
}
|
27605 |
|
27606 |
+
{
|
27607 |
+
{
|
27608 |
+
throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
|
27609 |
+
}
|
27610 |
+
}
|
27611 |
+
}
|
27612 |
|
27613 |
+
function commitHookEffectListUnmount(tag, finishedWork) {
|
27614 |
+
var updateQueue = finishedWork.updateQueue;
|
27615 |
+
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
|
|
27616 |
|
27617 |
+
if (lastEffect !== null) {
|
27618 |
+
var firstEffect = lastEffect.next;
|
27619 |
+
var effect = firstEffect;
|
27620 |
|
27621 |
+
do {
|
27622 |
+
if ((effect.tag & tag) === tag) {
|
27623 |
+
// Unmount
|
27624 |
+
var destroy = effect.destroy;
|
27625 |
+
effect.destroy = undefined;
|
|
|
27626 |
|
27627 |
+
if (destroy !== undefined) {
|
27628 |
+
destroy();
|
27629 |
+
}
|
27630 |
+
}
|
27631 |
|
27632 |
+
effect = effect.next;
|
27633 |
+
} while (effect !== firstEffect);
|
27634 |
+
}
|
27635 |
+
}
|
27636 |
|
27637 |
+
function commitHookEffectListMount(tag, finishedWork) {
|
27638 |
+
var updateQueue = finishedWork.updateQueue;
|
27639 |
+
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27640 |
|
27641 |
+
if (lastEffect !== null) {
|
27642 |
+
var firstEffect = lastEffect.next;
|
27643 |
+
var effect = firstEffect;
|
27644 |
|
27645 |
+
do {
|
27646 |
+
if ((effect.tag & tag) === tag) {
|
27647 |
+
// Mount
|
27648 |
+
var create = effect.create;
|
27649 |
+
effect.destroy = create();
|
27650 |
|
27651 |
+
{
|
27652 |
+
var destroy = effect.destroy;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27653 |
|
27654 |
+
if (destroy !== undefined && typeof destroy !== 'function') {
|
27655 |
+
var addendum = void 0;
|
27656 |
+
|
27657 |
+
if (destroy === null) {
|
27658 |
+
addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
|
27659 |
+
} else if (typeof destroy.then === 'function') {
|
27660 |
+
addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching';
|
27661 |
} else {
|
27662 |
+
addendum = ' You returned: ' + destroy;
|
27663 |
}
|
27664 |
|
27665 |
+
error('An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s', addendum);
|
27666 |
}
|
27667 |
}
|
27668 |
+
}
|
27669 |
|
27670 |
+
effect = effect.next;
|
27671 |
+
} while (effect !== firstEffect);
|
27672 |
+
}
|
27673 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27674 |
|
27675 |
+
function schedulePassiveEffects(finishedWork) {
|
27676 |
+
var updateQueue = finishedWork.updateQueue;
|
27677 |
+
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
|
|
|
|
27678 |
|
27679 |
+
if (lastEffect !== null) {
|
27680 |
+
var firstEffect = lastEffect.next;
|
27681 |
+
var effect = firstEffect;
|
27682 |
|
27683 |
+
do {
|
27684 |
+
var _effect = effect,
|
27685 |
+
next = _effect.next,
|
27686 |
+
tag = _effect.tag;
|
27687 |
|
27688 |
+
if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) {
|
27689 |
+
enqueuePendingPassiveHookEffectUnmount(finishedWork, effect);
|
27690 |
+
enqueuePendingPassiveHookEffectMount(finishedWork, effect);
|
27691 |
}
|
27692 |
|
27693 |
+
effect = next;
|
27694 |
+
} while (effect !== firstEffect);
|
27695 |
+
}
|
27696 |
+
}
|
27697 |
+
|
27698 |
+
function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) {
|
27699 |
+
switch (finishedWork.tag) {
|
27700 |
+
case FunctionComponent:
|
27701 |
+
case ForwardRef:
|
27702 |
+
case SimpleMemoComponent:
|
27703 |
+
case Block:
|
27704 |
{
|
27705 |
+
// At this point layout effects have already been destroyed (during mutation phase).
|
27706 |
+
// This is done to prevent sibling component effects from interfering with each other,
|
27707 |
+
// e.g. a destroy function in one component should never override a ref set
|
27708 |
+
// by a create function in another component during the same commit.
|
27709 |
+
{
|
27710 |
+
commitHookEffectListMount(Layout | HasEffect, finishedWork);
|
27711 |
+
}
|
27712 |
|
27713 |
+
schedulePassiveEffects(finishedWork);
|
27714 |
+
return;
|
27715 |
}
|
27716 |
|
27717 |
+
case ClassComponent:
|
27718 |
{
|
27719 |
+
var instance = finishedWork.stateNode;
|
27720 |
|
27721 |
+
if (finishedWork.flags & Update) {
|
27722 |
+
if (current === null) {
|
27723 |
+
// We could update instance props and state here,
|
27724 |
+
// but instead we rely on them being set during last render.
|
27725 |
+
// TODO: revisit this when we implement resuming.
|
27726 |
+
{
|
27727 |
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
27728 |
+
if (instance.props !== finishedWork.memoizedProps) {
|
27729 |
+
error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27730 |
+
}
|
27731 |
|
27732 |
+
if (instance.state !== finishedWork.memoizedState) {
|
27733 |
+
error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27734 |
+
}
|
27735 |
+
}
|
27736 |
+
}
|
27737 |
|
27738 |
+
{
|
27739 |
+
instance.componentDidMount();
|
27740 |
+
}
|
27741 |
+
} else {
|
27742 |
+
var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps);
|
27743 |
+
var prevState = current.memoizedState; // We could update instance props and state here,
|
27744 |
+
// but instead we rely on them being set during last render.
|
27745 |
+
// TODO: revisit this when we implement resuming.
|
27746 |
|
27747 |
+
{
|
27748 |
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
27749 |
+
if (instance.props !== finishedWork.memoizedProps) {
|
27750 |
+
error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27751 |
+
}
|
27752 |
|
27753 |
+
if (instance.state !== finishedWork.memoizedState) {
|
27754 |
+
error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27755 |
+
}
|
27756 |
+
}
|
27757 |
+
}
|
27758 |
|
27759 |
+
{
|
27760 |
+
instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
|
27761 |
+
}
|
27762 |
}
|
27763 |
+
} // TODO: I think this is now always non-null by the time it reaches the
|
27764 |
+
// commit phase. Consider removing the type check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27765 |
|
|
|
|
|
|
|
|
|
|
|
27766 |
|
27767 |
+
var updateQueue = finishedWork.updateQueue;
|
|
|
|
|
27768 |
|
27769 |
+
if (updateQueue !== null) {
|
27770 |
+
{
|
27771 |
+
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
27772 |
+
if (instance.props !== finishedWork.memoizedProps) {
|
27773 |
+
error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27774 |
+
}
|
27775 |
|
27776 |
+
if (instance.state !== finishedWork.memoizedState) {
|
27777 |
+
error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
|
27778 |
+
}
|
27779 |
+
}
|
27780 |
+
} // We could update instance props and state here,
|
27781 |
+
// but instead we rely on them being set during last render.
|
27782 |
+
// TODO: revisit this when we implement resuming.
|
27783 |
|
|
|
|
|
|
|
27784 |
|
27785 |
+
commitUpdateQueue(finishedWork, updateQueue, instance);
|
27786 |
}
|
27787 |
|
27788 |
+
return;
|
27789 |
}
|
27790 |
|
27791 |
case HostRoot:
|
27792 |
{
|
27793 |
+
// TODO: I think this is now always non-null by the time it reaches the
|
27794 |
+
// commit phase. Consider removing the type check.
|
27795 |
+
var _updateQueue = finishedWork.updateQueue;
|
|
|
27796 |
|
27797 |
+
if (_updateQueue !== null) {
|
27798 |
+
var _instance = null;
|
27799 |
+
|
27800 |
+
if (finishedWork.child !== null) {
|
27801 |
+
switch (finishedWork.child.tag) {
|
27802 |
+
case HostComponent:
|
27803 |
+
_instance = getPublicInstance(finishedWork.child.stateNode);
|
27804 |
+
break;
|
27805 |
+
|
27806 |
+
case ClassComponent:
|
27807 |
+
_instance = finishedWork.child.stateNode;
|
27808 |
+
break;
|
27809 |
+
}
|
27810 |
}
|
27811 |
+
|
27812 |
+
commitUpdateQueue(finishedWork, _updateQueue, _instance);
|
27813 |
}
|
27814 |
|
27815 |
+
return;
|
|
|
27816 |
}
|
27817 |
|
27818 |
case HostComponent:
|
27819 |
{
|
27820 |
+
var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted
|
27821 |
+
// (eg DOM renderer may schedule auto-focus for inputs and form controls).
|
27822 |
+
// These effects should only be committed when components are first mounted,
|
27823 |
+
// aka when there is no current/alternate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27824 |
|
27825 |
+
if (current === null && finishedWork.flags & Update) {
|
27826 |
+
var type = finishedWork.type;
|
27827 |
+
var props = finishedWork.memoizedProps;
|
27828 |
+
commitMount(_instance2, type, props);
|
27829 |
}
|
27830 |
|
27831 |
+
return;
|
27832 |
}
|
27833 |
|
27834 |
+
case HostText:
|
27835 |
{
|
27836 |
+
// We have no life-cycles associated with text.
|
27837 |
+
return;
|
|
|
|
|
27838 |
}
|
27839 |
|
27840 |
case HostPortal:
|
27841 |
+
{
|
27842 |
+
// We have no life-cycles associated with portals.
|
27843 |
+
return;
|
27844 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27845 |
|
27846 |
+
case Profiler:
|
|
|
|
|
27847 |
{
|
27848 |
+
{
|
27849 |
+
var _finishedWork$memoize2 = finishedWork.memoizedProps,
|
27850 |
+
onCommit = _finishedWork$memoize2.onCommit,
|
27851 |
+
onRender = _finishedWork$memoize2.onRender;
|
27852 |
+
var effectDuration = finishedWork.stateNode.effectDuration;
|
27853 |
+
var commitTime = getCommitTime();
|
27854 |
|
27855 |
+
if (typeof onRender === 'function') {
|
27856 |
+
{
|
27857 |
+
onRender(finishedWork.memoizedProps.id, current === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime, finishedRoot.memoizedInteractions);
|
27858 |
+
}
|
27859 |
+
}
|
27860 |
}
|
27861 |
|
27862 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27863 |
}
|
27864 |
|
27865 |
+
case SuspenseComponent:
|
27866 |
{
|
27867 |
+
commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
|
27868 |
+
return;
|
27869 |
}
|
27870 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27871 |
case SuspenseListComponent:
|
27872 |
+
case IncompleteClassComponent:
|
27873 |
+
case FundamentalComponent:
|
27874 |
+
case ScopeComponent:
|
|
|
|
|
|
|
|
|
27875 |
case OffscreenComponent:
|
27876 |
case LegacyHiddenComponent:
|
27877 |
+
return;
|
|
|
27878 |
}
|
|
|
27879 |
|
27880 |
+
{
|
27881 |
+
{
|
27882 |
+
throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
|
27883 |
+
}
|
27884 |
+
}
|
|
|
|
|
|
|
27885 |
}
|
27886 |
|
27887 |
+
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
27888 |
+
{
|
27889 |
+
// We only have the top Fiber that was inserted but we need to recurse down its
|
27890 |
+
// children to find all the terminal nodes.
|
27891 |
+
var node = finishedWork;
|
|
|
27892 |
|
27893 |
+
while (true) {
|
27894 |
+
if (node.tag === HostComponent) {
|
27895 |
+
var instance = node.stateNode;
|
|
|
27896 |
|
27897 |
+
if (isHidden) {
|
27898 |
+
hideInstance(instance);
|
27899 |
+
} else {
|
27900 |
+
unhideInstance(node.stateNode, node.memoizedProps);
|
27901 |
+
}
|
27902 |
+
} else if (node.tag === HostText) {
|
27903 |
+
var _instance3 = node.stateNode;
|
27904 |
|
27905 |
+
if (isHidden) {
|
27906 |
+
hideTextInstance(_instance3);
|
27907 |
+
} else {
|
27908 |
+
unhideTextInstance(_instance3, node.memoizedProps);
|
27909 |
+
}
|
27910 |
+
} else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork) ; else if (node.child !== null) {
|
27911 |
+
node.child.return = node;
|
27912 |
+
node = node.child;
|
27913 |
+
continue;
|
27914 |
+
}
|
27915 |
|
27916 |
+
if (node === finishedWork) {
|
27917 |
+
return;
|
27918 |
+
}
|
|
|
|
|
|
|
27919 |
|
27920 |
+
while (node.sibling === null) {
|
27921 |
+
if (node.return === null || node.return === finishedWork) {
|
|
|
|
|
|
|
27922 |
return;
|
27923 |
+
}
|
|
|
|
|
|
|
|
|
27924 |
|
27925 |
+
node = node.return;
|
|
|
|
|
27926 |
}
|
27927 |
|
27928 |
+
node.sibling.return = node.return;
|
27929 |
+
node = node.sibling;
|
27930 |
+
}
|
27931 |
+
}
|
27932 |
+
}
|
27933 |
|
27934 |
+
function commitAttachRef(finishedWork) {
|
27935 |
+
var ref = finishedWork.ref;
|
|
|
|
|
|
|
27936 |
|
27937 |
+
if (ref !== null) {
|
27938 |
+
var instance = finishedWork.stateNode;
|
27939 |
+
var instanceToUse;
|
|
|
27940 |
|
27941 |
+
switch (finishedWork.tag) {
|
27942 |
+
case HostComponent:
|
27943 |
+
instanceToUse = getPublicInstance(instance);
|
27944 |
+
break;
|
27945 |
+
|
27946 |
+
default:
|
27947 |
+
instanceToUse = instance;
|
27948 |
+
} // Moved outside to ensure DCE works with this flag
|
27949 |
+
|
27950 |
+
if (typeof ref === 'function') {
|
27951 |
+
ref(instanceToUse);
|
27952 |
+
} else {
|
27953 |
+
{
|
27954 |
+
if (!ref.hasOwnProperty('current')) {
|
27955 |
+
error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().', getComponentName(finishedWork.type));
|
27956 |
+
}
|
27957 |
+
}
|
27958 |
+
|
27959 |
+
ref.current = instanceToUse;
|
27960 |
+
}
|
27961 |
}
|
27962 |
}
|
27963 |
|
27964 |
+
function commitDetachRef(current) {
|
27965 |
+
var currentRef = current.ref;
|
27966 |
|
27967 |
+
if (currentRef !== null) {
|
27968 |
+
if (typeof currentRef === 'function') {
|
27969 |
+
currentRef(null);
|
27970 |
+
} else {
|
27971 |
+
currentRef.current = null;
|
27972 |
+
}
|
27973 |
+
}
|
27974 |
+
} // User-originating errors (lifecycles and refs) should not interrupt
|
27975 |
+
// deletion, so don't let them throw. Host-originating errors should
|
27976 |
+
// interrupt deletion, so it's okay
|
27977 |
|
|
|
|
|
27978 |
|
27979 |
+
function commitUnmount(finishedRoot, current, renderPriorityLevel) {
|
27980 |
+
onCommitUnmount(current);
|
|
|
|
|
27981 |
|
27982 |
+
switch (current.tag) {
|
27983 |
+
case FunctionComponent:
|
27984 |
+
case ForwardRef:
|
27985 |
+
case MemoComponent:
|
27986 |
+
case SimpleMemoComponent:
|
27987 |
+
case Block:
|
27988 |
+
{
|
27989 |
+
var updateQueue = current.updateQueue;
|
27990 |
|
27991 |
+
if (updateQueue !== null) {
|
27992 |
+
var lastEffect = updateQueue.lastEffect;
|
27993 |
|
27994 |
+
if (lastEffect !== null) {
|
27995 |
+
var firstEffect = lastEffect.next;
|
27996 |
+
var effect = firstEffect;
|
|
|
27997 |
|
27998 |
+
do {
|
27999 |
+
var _effect2 = effect,
|
28000 |
+
destroy = _effect2.destroy,
|
28001 |
+
tag = _effect2.tag;
|
28002 |
|
28003 |
+
if (destroy !== undefined) {
|
28004 |
+
if ((tag & Passive$1) !== NoFlags$1) {
|
28005 |
+
enqueuePendingPassiveHookEffectUnmount(current, effect);
|
28006 |
+
} else {
|
28007 |
+
{
|
28008 |
+
safelyCallDestroy(current, destroy);
|
28009 |
+
}
|
28010 |
+
}
|
28011 |
+
}
|
28012 |
|
28013 |
+
effect = effect.next;
|
28014 |
+
} while (effect !== firstEffect);
|
28015 |
+
}
|
28016 |
+
}
|
28017 |
|
28018 |
+
return;
|
|
|
|
|
|
|
28019 |
}
|
28020 |
|
28021 |
+
case ClassComponent:
|
28022 |
+
{
|
28023 |
+
safelyDetachRef(current);
|
28024 |
+
var instance = current.stateNode;
|
|
|
|
|
|
|
28025 |
|
28026 |
+
if (typeof instance.componentWillUnmount === 'function') {
|
28027 |
+
safelyCallComponentWillUnmount(current, instance);
|
28028 |
+
}
|
28029 |
|
28030 |
+
return;
|
28031 |
+
}
|
|
|
|
|
|
|
28032 |
|
28033 |
+
case HostComponent:
|
28034 |
{
|
28035 |
+
safelyDetachRef(current);
|
28036 |
+
return;
|
28037 |
+
}
|
28038 |
+
|
28039 |
+
case HostPortal:
|
28040 |
+
{
|
28041 |
+
// TODO: this is recursive.
|
28042 |
+
// We are also not using this parent because
|
28043 |
+
// the portal will get pushed immediately.
|
28044 |
+
{
|
28045 |
+
unmountHostComponents(finishedRoot, current);
|
28046 |
}
|
28047 |
+
|
28048 |
+
return;
|
28049 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
28050 |
|
28051 |
+
case FundamentalComponent:
|
28052 |
+
{
|
28053 |
|
28054 |
+
return;
|
28055 |
+
}
|
|
|
|
|
|
|
|
|
28056 |
|
28057 |
+
case DehydratedFragment:
|
28058 |
+
{
|
|
|
|
|
|
|
|
|
28059 |
|
28060 |
+
return;
|
28061 |
+
}
|
|
|
|
|
|
|
28062 |
|
28063 |
+
case ScopeComponent:
|
28064 |
+
{
|
28065 |
+
|
28066 |
+
return;
|
28067 |
+
}
|
28068 |
}
|
28069 |
}
|
28070 |
|
28071 |
+
function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
|
28072 |
+
// While we're inside a removed host node we don't want to call
|
28073 |
+
// removeChild on the inner nodes because they're removed by the top
|
28074 |
+
// call anyway. We also want to call componentWillUnmount on all
|
28075 |
+
// composites before this host node is removed from the tree. Therefore
|
28076 |
+
// we do an inner loop while we're still inside the host node.
|
28077 |
+
var node = root;
|
28078 |
|
28079 |
+
while (true) {
|
28080 |
+
commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes.
|
28081 |
+
// Skip portals because commitUnmount() currently visits them recursively.
|
28082 |
|
28083 |
+
if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
|
28084 |
+
// If we don't use mutation we drill down into portals here instead.
|
28085 |
+
node.tag !== HostPortal)) {
|
28086 |
+
node.child.return = node;
|
28087 |
+
node = node.child;
|
28088 |
+
continue;
|
28089 |
+
}
|
28090 |
|
28091 |
+
if (node === root) {
|
28092 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
28093 |
}
|
28094 |
|
28095 |
+
while (node.sibling === null) {
|
28096 |
+
if (node.return === null || node.return === root) {
|
28097 |
+
return;
|
28098 |
+
}
|
28099 |
|
28100 |
+
node = node.return;
|
28101 |
+
}
|
28102 |
|
28103 |
+
node.sibling.return = node.return;
|
28104 |
+
node = node.sibling;
|
28105 |
+
}
|
28106 |
+
}
|
|
|
|
|
28107 |
|
28108 |
+
function detachFiberMutation(fiber) {
|
28109 |
+
// Cut off the return pointers to disconnect it from the tree. Ideally, we
|
28110 |
+
// should clear the child pointer of the parent alternate to let this
|
28111 |
+
// get GC:ed but we don't know which for sure which parent is the current
|
28112 |
+
// one so we'll settle for GC:ing the subtree of this child. This child
|
28113 |
+
// itself will be GC:ed when the parent updates the next time.
|
28114 |
+
// Note: we cannot null out sibling here, otherwise it can cause issues
|
28115 |
+
// with findDOMNode and how it requires the sibling field to carry out
|
28116 |
+
// traversal in a later effect. See PR #16820. We now clear the sibling
|
28117 |
+
// field after effects, see: detachFiberAfterEffects.
|
28118 |
+
//
|
28119 |
+
// Don't disconnect stateNode now; it will be detached in detachFiberAfterEffects.
|
28120 |
+
// It may be required if the current component is an error boundary,
|
28121 |
+
// and one of its descendants throws while unmounting a passive effect.
|
28122 |
+
fiber.alternate = null;
|
28123 |
+
fiber.child = null;
|
28124 |
+
fiber.dependencies = null;
|
28125 |
+
fiber.firstEffect = null;
|
28126 |
+
fiber.lastEffect = null;
|
28127 |
+
fiber.memoizedProps = null;
|
28128 |
+
fiber.memoizedState = null;
|
28129 |
+
fiber.pendingProps = null;
|
28130 |
+
fiber.return = null;
|
28131 |
+
fiber.updateQueue = null;
|
28132 |
|
28133 |
+
{
|
28134 |
+
fiber._debugOwner = null;
|
28135 |
+
}
|
28136 |
+
}
|
28137 |
|
28138 |
+
function getHostParentFiber(fiber) {
|
28139 |
+
var parent = fiber.return;
|
|
|
|
|
|
|
28140 |
|
28141 |
+
while (parent !== null) {
|
28142 |
+
if (isHostParent(parent)) {
|
28143 |
+
return parent;
|
28144 |
+
}
|
28145 |
|
28146 |
+
parent = parent.return;
|
28147 |
+
}
|
28148 |
|
28149 |
+
{
|
28150 |
+
{
|
28151 |
+
throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." );
|
28152 |
+
}
|
28153 |
+
}
|
28154 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28155 |
|
28156 |
+
function isHostParent(fiber) {
|
28157 |
+
return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
|
28158 |
+
}
|
28159 |
|
28160 |
+
function getHostSibling(fiber) {
|
28161 |
+
// We're going to search forward into the tree until we find a sibling host
|
28162 |
+
// node. Unfortunately, if multiple insertions are done in a row we have to
|
28163 |
+
// search past them. This leads to exponential search for the next sibling.
|
28164 |
+
// TODO: Find a more efficient way to do this.
|
28165 |
+
var node = fiber;
|
28166 |
|
28167 |
+
siblings: while (true) {
|
28168 |
+
// If we didn't find anything, let's try the next sibling.
|
28169 |
+
while (node.sibling === null) {
|
28170 |
+
if (node.return === null || isHostParent(node.return)) {
|
28171 |
+
// If we pop out of the root or hit the parent the fiber we are the
|
28172 |
+
// last sibling.
|
28173 |
+
return null;
|
28174 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28175 |
|
28176 |
+
node = node.return;
|
28177 |
+
}
|
28178 |
|
28179 |
+
node.sibling.return = node.return;
|
28180 |
+
node = node.sibling;
|
|
|
|
|
|
|
|
|
28181 |
|
28182 |
+
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
|
28183 |
+
// If it is not host node and, we might have a host node inside it.
|
28184 |
+
// Try to search down until we find one.
|
28185 |
+
if (node.flags & Placement) {
|
28186 |
+
// If we don't have a child, try the siblings instead.
|
28187 |
+
continue siblings;
|
28188 |
+
} // If we don't have a child, try the siblings instead.
|
28189 |
+
// We also skip portals because they are not part of this host tree.
|
28190 |
|
|
|
|
|
|
|
28191 |
|
28192 |
+
if (node.child === null || node.tag === HostPortal) {
|
28193 |
+
continue siblings;
|
28194 |
+
} else {
|
28195 |
+
node.child.return = node;
|
28196 |
+
node = node.child;
|
28197 |
+
}
|
28198 |
+
} // Check if this host node is stable or about to be placed.
|
28199 |
|
|
|
|
|
|
|
|
|
28200 |
|
28201 |
+
if (!(node.flags & Placement)) {
|
28202 |
+
// Found it!
|
28203 |
+
return node.stateNode;
|
28204 |
+
}
|
28205 |
+
}
|
28206 |
+
}
|
28207 |
|
28208 |
+
function commitPlacement(finishedWork) {
|
|
|
|
|
28209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28210 |
|
28211 |
+
var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together.
|
28212 |
|
28213 |
+
var parent;
|
28214 |
+
var isContainer;
|
28215 |
+
var parentStateNode = parentFiber.stateNode;
|
28216 |
|
28217 |
+
switch (parentFiber.tag) {
|
28218 |
+
case HostComponent:
|
28219 |
+
parent = parentStateNode;
|
28220 |
+
isContainer = false;
|
28221 |
+
break;
|
28222 |
|
28223 |
+
case HostRoot:
|
28224 |
+
parent = parentStateNode.containerInfo;
|
28225 |
+
isContainer = true;
|
28226 |
+
break;
|
28227 |
|
28228 |
+
case HostPortal:
|
28229 |
+
parent = parentStateNode.containerInfo;
|
28230 |
+
isContainer = true;
|
28231 |
+
break;
|
28232 |
|
28233 |
+
case FundamentalComponent:
|
28234 |
|
28235 |
+
// eslint-disable-next-line-no-fallthrough
|
28236 |
|
28237 |
+
default:
|
28238 |
+
{
|
28239 |
+
{
|
28240 |
+
throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." );
|
28241 |
}
|
28242 |
+
}
|
28243 |
|
28244 |
+
}
|
|
|
28245 |
|
28246 |
+
if (parentFiber.flags & ContentReset) {
|
28247 |
+
// Reset the text content of the parent before doing any insertions
|
28248 |
+
resetTextContent(parent); // Clear ContentReset from the effect tag
|
28249 |
|
28250 |
+
parentFiber.flags &= ~ContentReset;
|
28251 |
+
}
|
28252 |
|
28253 |
+
var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
|
28254 |
+
// children to find all the terminal nodes.
|
|
|
28255 |
|
28256 |
+
if (isContainer) {
|
28257 |
+
insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
|
28258 |
+
} else {
|
28259 |
+
insertOrAppendPlacementNode(finishedWork, before, parent);
|
28260 |
+
}
|
28261 |
+
}
|
28262 |
|
28263 |
+
function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
|
28264 |
+
var tag = node.tag;
|
28265 |
+
var isHost = tag === HostComponent || tag === HostText;
|
28266 |
|
28267 |
+
if (isHost || enableFundamentalAPI ) {
|
28268 |
+
var stateNode = isHost ? node.stateNode : node.stateNode.instance;
|
|
|
|
|
28269 |
|
28270 |
+
if (before) {
|
28271 |
+
insertInContainerBefore(parent, stateNode, before);
|
28272 |
+
} else {
|
28273 |
+
appendChildToContainer(parent, stateNode);
|
28274 |
+
}
|
28275 |
+
} else if (tag === HostPortal) ; else {
|
28276 |
+
var child = node.child;
|
28277 |
|
28278 |
+
if (child !== null) {
|
28279 |
+
insertOrAppendPlacementNodeIntoContainer(child, before, parent);
|
28280 |
+
var sibling = child.sibling;
|
28281 |
|
28282 |
+
while (sibling !== null) {
|
28283 |
+
insertOrAppendPlacementNodeIntoContainer(sibling, before, parent);
|
28284 |
+
sibling = sibling.sibling;
|
28285 |
+
}
|
28286 |
}
|
28287 |
}
|
28288 |
}
|
28289 |
|
28290 |
+
function insertOrAppendPlacementNode(node, before, parent) {
|
28291 |
+
var tag = node.tag;
|
28292 |
+
var isHost = tag === HostComponent || tag === HostText;
|
28293 |
|
28294 |
+
if (isHost || enableFundamentalAPI ) {
|
28295 |
+
var stateNode = isHost ? node.stateNode : node.stateNode.instance;
|
|
|
|
|
28296 |
|
28297 |
+
if (before) {
|
28298 |
+
insertBefore(parent, stateNode, before);
|
|
|
|
|
|
|
28299 |
} else {
|
28300 |
+
appendChild(parent, stateNode);
|
28301 |
}
|
28302 |
+
} else if (tag === HostPortal) ; else {
|
28303 |
+
var child = node.child;
|
28304 |
|
28305 |
+
if (child !== null) {
|
28306 |
+
insertOrAppendPlacementNode(child, before, parent);
|
28307 |
+
var sibling = child.sibling;
|
28308 |
|
28309 |
+
while (sibling !== null) {
|
28310 |
+
insertOrAppendPlacementNode(sibling, before, parent);
|
28311 |
+
sibling = sibling.sibling;
|
28312 |
+
}
|
28313 |
}
|
28314 |
}
|
28315 |
}
|
28316 |
|
28317 |
+
function unmountHostComponents(finishedRoot, current, renderPriorityLevel) {
|
28318 |
+
// We only have the top Fiber that was deleted but we need to recurse down its
|
28319 |
+
// children to find all the terminal nodes.
|
28320 |
+
var node = current; // Each iteration, currentParent is populated with node's host parent if not
|
28321 |
+
// currentParentIsValid.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28322 |
|
28323 |
+
var currentParentIsValid = false; // Note: these two variables *must* always be updated together.
|
|
|
|
|
|
|
|
|
28324 |
|
28325 |
+
var currentParent;
|
28326 |
+
var currentParentIsContainer;
|
|
|
|
|
|
|
28327 |
|
28328 |
+
while (true) {
|
28329 |
+
if (!currentParentIsValid) {
|
28330 |
+
var parent = node.return;
|
28331 |
|
28332 |
+
findParent: while (true) {
|
28333 |
+
if (!(parent !== null)) {
|
28334 |
+
{
|
28335 |
+
throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." );
|
28336 |
+
}
|
28337 |
+
}
|
28338 |
|
28339 |
+
var parentStateNode = parent.stateNode;
|
|
|
28340 |
|
28341 |
+
switch (parent.tag) {
|
28342 |
+
case HostComponent:
|
28343 |
+
currentParent = parentStateNode;
|
28344 |
+
currentParentIsContainer = false;
|
28345 |
+
break findParent;
|
28346 |
|
28347 |
+
case HostRoot:
|
28348 |
+
currentParent = parentStateNode.containerInfo;
|
28349 |
+
currentParentIsContainer = true;
|
28350 |
+
break findParent;
|
28351 |
|
28352 |
+
case HostPortal:
|
28353 |
+
currentParent = parentStateNode.containerInfo;
|
28354 |
+
currentParentIsContainer = true;
|
28355 |
+
break findParent;
|
28356 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28357 |
}
|
28358 |
|
28359 |
+
parent = parent.return;
|
28360 |
}
|
28361 |
|
28362 |
+
currentParentIsValid = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28363 |
}
|
|
|
|
|
28364 |
|
28365 |
+
if (node.tag === HostComponent || node.tag === HostText) {
|
28366 |
+
commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the
|
28367 |
+
// node from the tree.
|
28368 |
|
28369 |
+
if (currentParentIsContainer) {
|
28370 |
+
removeChildFromContainer(currentParent, node.stateNode);
|
28371 |
+
} else {
|
28372 |
+
removeChild(currentParent, node.stateNode);
|
28373 |
+
} // Don't visit children because we already visited them.
|
28374 |
|
28375 |
+
} else if (node.tag === HostPortal) {
|
28376 |
+
if (node.child !== null) {
|
28377 |
+
// When we go into a portal, it becomes the parent to remove from.
|
28378 |
+
// We will reassign it back when we pop the portal on the way up.
|
28379 |
+
currentParent = node.stateNode.containerInfo;
|
28380 |
+
currentParentIsContainer = true; // Visit children because portals might contain host components.
|
28381 |
|
28382 |
+
node.child.return = node;
|
28383 |
+
node = node.child;
|
28384 |
+
continue;
|
28385 |
}
|
28386 |
+
} else {
|
28387 |
+
commitUnmount(finishedRoot, node); // Visit children because we may find more host components below.
|
28388 |
|
28389 |
+
if (node.child !== null) {
|
28390 |
+
node.child.return = node;
|
28391 |
+
node = node.child;
|
28392 |
+
continue;
|
28393 |
+
}
|
28394 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28395 |
|
28396 |
+
if (node === current) {
|
28397 |
+
return;
|
28398 |
+
}
|
28399 |
|
28400 |
+
while (node.sibling === null) {
|
28401 |
+
if (node.return === null || node.return === current) {
|
28402 |
+
return;
|
28403 |
+
}
|
28404 |
|
28405 |
+
node = node.return;
|
|
|
|
|
|
|
|
|
|
|
|
|
28406 |
|
28407 |
+
if (node.tag === HostPortal) {
|
28408 |
+
// When we go out of the portal, we need to restore the parent.
|
28409 |
+
// Since we don't keep a stack of them, we will search for it.
|
28410 |
+
currentParentIsValid = false;
|
28411 |
}
|
28412 |
+
}
|
28413 |
|
28414 |
+
node.sibling.return = node.return;
|
28415 |
+
node = node.sibling;
|
28416 |
}
|
28417 |
}
|
28418 |
|
28419 |
+
function commitDeletion(finishedRoot, current, renderPriorityLevel) {
|
28420 |
+
{
|
28421 |
+
// Recursively delete all host nodes from the parent.
|
28422 |
+
// Detach refs and call componentWillUnmount() on the whole subtree.
|
28423 |
+
unmountHostComponents(finishedRoot, current);
|
28424 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
28425 |
|
28426 |
+
var alternate = current.alternate;
|
28427 |
+
detachFiberMutation(current);
|
|
|
|
|
28428 |
|
28429 |
+
if (alternate !== null) {
|
28430 |
+
detachFiberMutation(alternate);
|
28431 |
}
|
28432 |
}
|
28433 |
|
28434 |
+
function commitWork(current, finishedWork) {
|
28435 |
+
|
28436 |
switch (finishedWork.tag) {
|
28437 |
case FunctionComponent:
|
28438 |
case ForwardRef:
|
28439 |
+
case MemoComponent:
|
28440 |
case SimpleMemoComponent:
|
28441 |
case Block:
|
28442 |
{
|
28443 |
+
// Layout effects are destroyed during the mutation phase so that all
|
28444 |
+
// destroy functions for all fibers are called before any create functions.
|
28445 |
+
// This prevents sibling component effects from interfering with each other,
|
28446 |
// e.g. a destroy function in one component should never override a ref set
|
28447 |
// by a create function in another component during the same commit.
|
28448 |
{
|
28449 |
+
commitHookEffectListUnmount(Layout | HasEffect, finishedWork);
|
28450 |
}
|
28451 |
|
|
|
28452 |
return;
|
28453 |
}
|
28454 |
|
28455 |
case ClassComponent:
|
28456 |
{
|
28457 |
+
return;
|
28458 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28459 |
|
28460 |
+
case HostComponent:
|
28461 |
+
{
|
28462 |
+
var instance = finishedWork.stateNode;
|
|
|
|
|
28463 |
|
28464 |
+
if (instance != null) {
|
28465 |
+
// Commit the work prepared earlier.
|
28466 |
+
var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
28467 |
+
// as the newProps. The updatePayload will contain the real change in
|
28468 |
+
// this case.
|
|
|
|
|
|
|
28469 |
|
28470 |
+
var oldProps = current !== null ? current.memoizedProps : newProps;
|
28471 |
+
var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components.
|
|
|
|
|
|
|
28472 |
|
28473 |
+
var updatePayload = finishedWork.updateQueue;
|
28474 |
+
finishedWork.updateQueue = null;
|
|
|
|
|
|
|
28475 |
|
28476 |
+
if (updatePayload !== null) {
|
28477 |
+
commitUpdate(instance, updatePayload, type, oldProps, newProps);
|
|
|
28478 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28479 |
}
|
28480 |
|
28481 |
return;
|
28482 |
}
|
28483 |
|
28484 |
+
case HostText:
|
28485 |
{
|
28486 |
+
if (!(finishedWork.stateNode !== null)) {
|
28487 |
+
{
|
28488 |
+
throw Error( "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28489 |
}
|
|
|
|
|
28490 |
}
|
28491 |
|
28492 |
+
var textInstance = finishedWork.stateNode;
|
28493 |
+
var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
|
28494 |
+
// as the newProps. The updatePayload will contain the real change in
|
28495 |
+
// this case.
|
28496 |
+
|
28497 |
+
var oldText = current !== null ? current.memoizedProps : newText;
|
28498 |
+
commitTextUpdate(textInstance, oldText, newText);
|
28499 |
return;
|
28500 |
}
|
28501 |
|
28502 |
+
case HostRoot:
|
28503 |
{
|
28504 |
+
{
|
28505 |
+
var _root = finishedWork.stateNode;
|
|
|
|
|
28506 |
|
28507 |
+
if (_root.hydrate) {
|
28508 |
+
// We've just hydrated. No need to hydrate again.
|
28509 |
+
_root.hydrate = false;
|
28510 |
+
commitHydratedContainer(_root.containerInfo);
|
28511 |
+
}
|
28512 |
}
|
28513 |
|
28514 |
return;
|
28515 |
}
|
28516 |
|
28517 |
+
case Profiler:
|
28518 |
{
|
|
|
28519 |
return;
|
28520 |
}
|
28521 |
|
28522 |
+
case SuspenseComponent:
|
28523 |
{
|
28524 |
+
commitSuspenseComponent(finishedWork);
|
28525 |
+
attachSuspenseRetryListeners(finishedWork);
|
28526 |
return;
|
28527 |
}
|
28528 |
|
28529 |
+
case SuspenseListComponent:
|
28530 |
{
|
28531 |
+
attachSuspenseRetryListeners(finishedWork);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28532 |
return;
|
28533 |
}
|
28534 |
|
28535 |
+
case IncompleteClassComponent:
|
28536 |
{
|
|
|
28537 |
return;
|
28538 |
}
|
28539 |
|
|
|
|
|
28540 |
case FundamentalComponent:
|
28541 |
+
{
|
28542 |
+
|
28543 |
+
break;
|
28544 |
+
}
|
28545 |
+
|
28546 |
case ScopeComponent:
|
28547 |
+
{
|
28548 |
+
|
28549 |
+
break;
|
28550 |
+
}
|
28551 |
+
|
28552 |
case OffscreenComponent:
|
28553 |
case LegacyHiddenComponent:
|
28554 |
+
{
|
28555 |
+
var newState = finishedWork.memoizedState;
|
28556 |
+
var isHidden = newState !== null;
|
28557 |
+
hideOrUnhideAllChildren(finishedWork, isHidden);
|
28558 |
+
return;
|
28559 |
+
}
|
28560 |
}
|
28561 |
|
28562 |
{
|
28566 |
}
|
28567 |
}
|
28568 |
|
28569 |
+
function commitSuspenseComponent(finishedWork) {
|
28570 |
+
var newState = finishedWork.memoizedState;
|
|
|
|
|
|
|
28571 |
|
28572 |
+
if (newState !== null) {
|
28573 |
+
markCommitTimeOfFallback();
|
|
|
28574 |
|
28575 |
+
{
|
28576 |
+
// Hide the Offscreen component that contains the primary children. TODO:
|
28577 |
+
// Ideally, this effect would have been scheduled on the Offscreen fiber
|
28578 |
+
// itself. That's how unhiding works: the Offscreen component schedules an
|
28579 |
+
// effect on itself. However, in this case, the component didn't complete,
|
28580 |
+
// so the fiber was never added to the effect list in the normal path. We
|
28581 |
+
// could have appended it to the effect list in the Suspense component's
|
28582 |
+
// second pass, but doing it this way is less complicated. This would be
|
28583 |
+
// simpler if we got rid of the effect list and traversed the tree, like
|
28584 |
+
// we're planning to do.
|
28585 |
+
var primaryChildParent = finishedWork.child;
|
28586 |
+
hideOrUnhideAllChildren(primaryChildParent, true);
|
28587 |
+
}
|
28588 |
+
}
|
28589 |
+
}
|
28590 |
|
28591 |
+
function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28592 |
|
28593 |
+
var newState = finishedWork.memoizedState;
|
|
|
|
|
28594 |
|
28595 |
+
if (newState === null) {
|
28596 |
+
var current = finishedWork.alternate;
|
|
|
|
|
28597 |
|
28598 |
+
if (current !== null) {
|
28599 |
+
var prevState = current.memoizedState;
|
28600 |
|
28601 |
+
if (prevState !== null) {
|
28602 |
+
var suspenseInstance = prevState.dehydrated;
|
28603 |
+
|
28604 |
+
if (suspenseInstance !== null) {
|
28605 |
+
commitHydratedSuspenseInstance(suspenseInstance);
|
28606 |
+
}
|
28607 |
+
}
|
28608 |
}
|
28609 |
}
|
28610 |
}
|
28611 |
|
28612 |
+
function attachSuspenseRetryListeners(finishedWork) {
|
28613 |
+
// If this boundary just timed out, then it will have a set of wakeables.
|
28614 |
+
// For each wakeable, attach a listener so that when it resolves, React
|
28615 |
+
// attempts to re-render the boundary in the primary (pre-timeout) state.
|
28616 |
+
var wakeables = finishedWork.updateQueue;
|
28617 |
|
28618 |
+
if (wakeables !== null) {
|
28619 |
+
finishedWork.updateQueue = null;
|
28620 |
+
var retryCache = finishedWork.stateNode;
|
28621 |
|
28622 |
+
if (retryCache === null) {
|
28623 |
+
retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
28624 |
+
}
|
|
|
28625 |
|
28626 |
+
wakeables.forEach(function (wakeable) {
|
28627 |
+
// Memoize using the boundary fiber to prevent redundant listeners.
|
28628 |
+
var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable);
|
28629 |
|
28630 |
+
if (!retryCache.has(wakeable)) {
|
28631 |
+
{
|
28632 |
+
if (wakeable.__reactDoNotTraceInteractions !== true) {
|
28633 |
+
retry = tracing.unstable_wrap(retry);
|
28634 |
+
}
|
|
|
28635 |
}
|
28636 |
+
|
28637 |
+
retryCache.add(wakeable);
|
28638 |
+
wakeable.then(retry, retry);
|
28639 |
}
|
28640 |
+
});
|
28641 |
+
}
|
28642 |
+
} // This function detects when a Suspense boundary goes from visible to hidden.
|
28643 |
+
// It returns false if the boundary is already hidden.
|
28644 |
+
// TODO: Use an effect tag.
|
28645 |
|
28646 |
+
|
28647 |
+
function isSuspenseBoundaryBeingHidden(current, finishedWork) {
|
28648 |
+
if (current !== null) {
|
28649 |
+
var oldState = current.memoizedState;
|
28650 |
+
|
28651 |
+
if (oldState === null || oldState.dehydrated !== null) {
|
28652 |
+
var newState = finishedWork.memoizedState;
|
28653 |
+
return newState !== null && newState.dehydrated === null;
|
28654 |
}
|
28655 |
}
|
28656 |
+
|
28657 |
+
return false;
|
28658 |
+
}
|
28659 |
+
|
28660 |
+
function commitResetTextContent(current) {
|
28661 |
+
|
28662 |
+
resetTextContent(current.stateNode);
|
28663 |
+
}
|
28664 |
+
|
28665 |
+
var COMPONENT_TYPE = 0;
|
28666 |
+
var HAS_PSEUDO_CLASS_TYPE = 1;
|
28667 |
+
var ROLE_TYPE = 2;
|
28668 |
+
var TEST_NAME_TYPE = 3;
|
28669 |
+
var TEXT_TYPE = 4;
|
28670 |
+
|
28671 |
+
if (typeof Symbol === 'function' && Symbol.for) {
|
28672 |
+
var symbolFor$1 = Symbol.for;
|
28673 |
+
COMPONENT_TYPE = symbolFor$1('selector.component');
|
28674 |
+
HAS_PSEUDO_CLASS_TYPE = symbolFor$1('selector.has_pseudo_class');
|
28675 |
+
ROLE_TYPE = symbolFor$1('selector.role');
|
28676 |
+
TEST_NAME_TYPE = symbolFor$1('selector.test_id');
|
28677 |
+
TEXT_TYPE = symbolFor$1('selector.text');
|
28678 |
+
}
|
28679 |
+
var commitHooks = [];
|
28680 |
+
function onCommitRoot$1() {
|
28681 |
+
{
|
28682 |
+
commitHooks.forEach(function (commitHook) {
|
28683 |
+
return commitHook();
|
28684 |
+
});
|
28685 |
+
}
|
28686 |
}
|
28687 |
|
28688 |
+
var ceil = Math.ceil;
|
28689 |
+
var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher,
|
28690 |
+
ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner,
|
28691 |
+
IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
|
28692 |
+
var NoContext =
|
28693 |
+
/* */
|
28694 |
+
0;
|
28695 |
+
var BatchedContext =
|
28696 |
+
/* */
|
28697 |
+
1;
|
28698 |
+
var EventContext =
|
28699 |
+
/* */
|
28700 |
+
2;
|
28701 |
+
var DiscreteEventContext =
|
28702 |
+
/* */
|
28703 |
+
4;
|
28704 |
+
var LegacyUnbatchedContext =
|
28705 |
+
/* */
|
28706 |
+
8;
|
28707 |
+
var RenderContext =
|
28708 |
+
/* */
|
28709 |
+
16;
|
28710 |
+
var CommitContext =
|
28711 |
+
/* */
|
28712 |
+
32;
|
28713 |
+
var RetryAfterError =
|
28714 |
+
/* */
|
28715 |
+
64;
|
28716 |
+
var RootIncomplete = 0;
|
28717 |
+
var RootFatalErrored = 1;
|
28718 |
+
var RootErrored = 2;
|
28719 |
+
var RootSuspended = 3;
|
28720 |
+
var RootSuspendedWithDelay = 4;
|
28721 |
+
var RootCompleted = 5; // Describes where we are in the React execution stack
|
28722 |
+
|
28723 |
+
var executionContext = NoContext; // The root we're working on
|
28724 |
+
|
28725 |
+
var workInProgressRoot = null; // The fiber we're working on
|
28726 |
+
|
28727 |
+
var workInProgress = null; // The lanes we're rendering
|
28728 |
+
|
28729 |
+
var workInProgressRootRenderLanes = NoLanes; // Stack that allows components to change the render lanes for its subtree
|
28730 |
+
// This is a superset of the lanes we started working on at the root. The only
|
28731 |
+
// case where it's different from `workInProgressRootRenderLanes` is when we
|
28732 |
+
// enter a subtree that is hidden and needs to be unhidden: Suspense and
|
28733 |
+
// Offscreen component.
|
28734 |
+
//
|
28735 |
+
// Most things in the work loop should deal with workInProgressRootRenderLanes.
|
28736 |
+
// Most things in begin/complete phases should deal with subtreeRenderLanes.
|
28737 |
+
|
28738 |
+
var subtreeRenderLanes = NoLanes;
|
28739 |
+
var subtreeRenderLanesCursor = createCursor(NoLanes); // Whether to root completed, errored, suspended, etc.
|
28740 |
|
28741 |
+
var workInProgressRootExitStatus = RootIncomplete; // A fatal error, if one is thrown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28742 |
|
28743 |
+
var workInProgressRootFatalError = null; // "Included" lanes refer to lanes that were worked on during this render. It's
|
28744 |
+
// slightly different than `renderLanes` because `renderLanes` can change as you
|
28745 |
+
// enter and exit an Offscreen tree. This value is the combination of all render
|
28746 |
+
// lanes for the entire render phase.
|
28747 |
|
28748 |
+
var workInProgressRootIncludedLanes = NoLanes; // The work left over by components that were visited during this render. Only
|
28749 |
+
// includes unprocessed updates, not work in bailed out children.
|
28750 |
|
28751 |
+
var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28752 |
|
28753 |
+
var workInProgressRootUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render.
|
|
|
28754 |
|
28755 |
+
var workInProgressRootPingedLanes = NoLanes;
|
28756 |
+
var mostRecentlyUpdatedRoot = null; // The most recent time we committed a fallback. This lets us ensure a train
|
28757 |
+
// model where we don't commit new loading states in too quick succession.
|
28758 |
|
28759 |
+
var globalMostRecentFallbackTime = 0;
|
28760 |
+
var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering
|
28761 |
+
// more and prefer CPU suspense heuristics instead.
|
|
|
28762 |
|
28763 |
+
var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU
|
28764 |
+
// suspense heuristics and opt out of rendering more content.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28765 |
|
28766 |
+
var RENDER_TIMEOUT_MS = 500;
|
|
|
|
|
|
|
28767 |
|
28768 |
+
function resetRenderTimer() {
|
28769 |
+
workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS;
|
28770 |
+
}
|
28771 |
|
28772 |
+
function getRenderTargetTime() {
|
28773 |
+
return workInProgressRootRenderTargetTime;
|
28774 |
+
}
|
28775 |
+
var nextEffect = null;
|
28776 |
+
var hasUncaughtError = false;
|
28777 |
+
var firstUncaughtError = null;
|
28778 |
+
var legacyErrorBoundariesThatAlreadyFailed = null;
|
28779 |
+
var rootDoesHavePassiveEffects = false;
|
28780 |
+
var rootWithPendingPassiveEffects = null;
|
28781 |
+
var pendingPassiveEffectsRenderPriority = NoPriority$1;
|
28782 |
+
var pendingPassiveEffectsLanes = NoLanes;
|
28783 |
+
var pendingPassiveHookEffectsMount = [];
|
28784 |
+
var pendingPassiveHookEffectsUnmount = [];
|
28785 |
+
var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates
|
28786 |
|
28787 |
+
var NESTED_UPDATE_LIMIT = 50;
|
28788 |
+
var nestedUpdateCount = 0;
|
28789 |
+
var rootWithNestedUpdates = null;
|
28790 |
+
var NESTED_PASSIVE_UPDATE_LIMIT = 50;
|
28791 |
+
var nestedPassiveUpdateCount = 0; // Marks the need to reschedule pending interactions at these lanes
|
28792 |
+
// during the commit phase. This enables them to be traced across components
|
28793 |
+
// that spawn new work during render. E.g. hidden boundaries, suspended SSR
|
28794 |
+
// hydration or SuspenseList.
|
28795 |
+
// TODO: Can use a bitmask instead of an array
|
28796 |
|
28797 |
+
var spawnedWorkDuringRender = null; // If two updates are scheduled within the same event, we should treat their
|
28798 |
+
// event times as simultaneous, even if the actual clock time has advanced
|
28799 |
+
// between the first and second call.
|
28800 |
|
28801 |
+
var currentEventTime = NoTimestamp;
|
28802 |
+
var currentEventWipLanes = NoLanes;
|
28803 |
+
var currentEventPendingLanes = NoLanes; // Dev only flag that tracks if passive effects are currently being flushed.
|
28804 |
+
// We warn about state updates for unmounted components differently in this case.
|
|
|
28805 |
|
28806 |
+
var isFlushingPassiveEffects = false;
|
28807 |
+
var focusedInstanceHandle = null;
|
28808 |
+
var shouldFireAfterActiveInstanceBlur = false;
|
28809 |
+
function getWorkInProgressRoot() {
|
28810 |
+
return workInProgressRoot;
|
28811 |
+
}
|
28812 |
+
function requestEventTime() {
|
28813 |
+
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
28814 |
+
// We're inside React, so it's fine to read the actual time.
|
28815 |
+
return now();
|
28816 |
+
} // We're not inside React, so we may be in the middle of a browser event.
|
28817 |
|
|
|
|
|
28818 |
|
28819 |
+
if (currentEventTime !== NoTimestamp) {
|
28820 |
+
// Use the same start time for all updates until we enter React again.
|
28821 |
+
return currentEventTime;
|
28822 |
+
} // This is the first update since React yielded. Compute a new start time.
|
28823 |
|
|
|
|
|
28824 |
|
28825 |
+
currentEventTime = now();
|
28826 |
+
return currentEventTime;
|
28827 |
+
}
|
28828 |
+
function requestUpdateLane(fiber) {
|
28829 |
+
// Special cases
|
28830 |
+
var mode = fiber.mode;
|
28831 |
|
28832 |
+
if ((mode & BlockingMode) === NoMode) {
|
28833 |
+
return SyncLane;
|
28834 |
+
} else if ((mode & ConcurrentMode) === NoMode) {
|
28835 |
+
return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane;
|
28836 |
+
} // The algorithm for assigning an update to a lane should be stable for all
|
28837 |
+
// updates at the same priority within the same event. To do this, the inputs
|
28838 |
+
// to the algorithm must be the same. For example, we use the `renderLanes`
|
28839 |
+
// to avoid choosing a lane that is already in the middle of rendering.
|
28840 |
+
//
|
28841 |
+
// However, the "included" lanes could be mutated in between updates in the
|
28842 |
+
// same event, like if you perform an update inside `flushSync`. Or any other
|
28843 |
+
// code path that might call `prepareFreshStack`.
|
28844 |
+
//
|
28845 |
+
// The trick we use is to cache the first of each of these inputs within an
|
28846 |
+
// event. Then reset the cached values once we can be sure the event is over.
|
28847 |
+
// Our heuristic for that is whenever we enter a concurrent work loop.
|
28848 |
+
//
|
28849 |
+
// We'll do the same for `currentEventPendingLanes` below.
|
28850 |
|
|
|
|
|
28851 |
|
28852 |
+
if (currentEventWipLanes === NoLanes) {
|
28853 |
+
currentEventWipLanes = workInProgressRootIncludedLanes;
|
28854 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28855 |
|
28856 |
+
var isTransition = requestCurrentTransition() !== NoTransition;
|
|
|
|
|
28857 |
|
28858 |
+
if (isTransition) {
|
28859 |
+
if (currentEventPendingLanes !== NoLanes) {
|
28860 |
+
currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes;
|
|
|
|
|
|
|
28861 |
}
|
28862 |
|
28863 |
+
return findTransitionLane(currentEventWipLanes, currentEventPendingLanes);
|
28864 |
+
} // TODO: Remove this dependency on the Scheduler priority.
|
28865 |
+
// To do that, we're replacing it with an update lane priority.
|
28866 |
|
|
|
|
|
|
|
|
|
28867 |
|
28868 |
+
var schedulerPriority = getCurrentPriorityLevel(); // The old behavior was using the priority level of the Scheduler.
|
28869 |
+
// This couples React to the Scheduler internals, so we're replacing it
|
28870 |
+
// with the currentUpdateLanePriority above. As an example of how this
|
28871 |
+
// could be problematic, if we're not inside `Scheduler.runWithPriority`,
|
28872 |
+
// then we'll get the priority of the current running Scheduler task,
|
28873 |
+
// which is probably not what we want.
|
28874 |
|
28875 |
+
var lane;
|
|
|
|
|
|
|
28876 |
|
28877 |
+
if ( // TODO: Temporary. We're removing the concept of discrete updates.
|
28878 |
+
(executionContext & DiscreteEventContext) !== NoContext && schedulerPriority === UserBlockingPriority$2) {
|
28879 |
+
lane = findUpdateLane(InputDiscreteLanePriority, currentEventWipLanes);
|
28880 |
+
} else {
|
28881 |
+
var schedulerLanePriority = schedulerPriorityToLanePriority(schedulerPriority);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28882 |
|
28883 |
+
lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes);
|
|
|
28884 |
}
|
28885 |
+
|
28886 |
+
return lane;
|
28887 |
}
|
28888 |
|
28889 |
+
function requestRetryLane(fiber) {
|
28890 |
+
// This is a fork of `requestUpdateLane` designed specifically for Suspense
|
28891 |
+
// "retries" — a special update that attempts to flip a Suspense boundary
|
28892 |
+
// from its placeholder state to its primary/resolved state.
|
28893 |
+
// Special cases
|
28894 |
+
var mode = fiber.mode;
|
28895 |
|
28896 |
+
if ((mode & BlockingMode) === NoMode) {
|
28897 |
+
return SyncLane;
|
28898 |
+
} else if ((mode & ConcurrentMode) === NoMode) {
|
28899 |
+
return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane;
|
28900 |
+
} // See `requestUpdateLane` for explanation of `currentEventWipLanes`
|
28901 |
|
|
|
|
|
28902 |
|
28903 |
+
if (currentEventWipLanes === NoLanes) {
|
28904 |
+
currentEventWipLanes = workInProgressRootIncludedLanes;
|
|
|
|
|
28905 |
}
|
|
|
28906 |
|
28907 |
+
return findRetryLane(currentEventWipLanes);
|
|
|
28908 |
}
|
28909 |
|
28910 |
+
function scheduleUpdateOnFiber(fiber, lane, eventTime) {
|
28911 |
+
checkForNestedUpdates();
|
28912 |
+
warnAboutRenderPhaseUpdatesInDEV(fiber);
|
28913 |
+
var root = markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
|
|
|
28914 |
|
28915 |
+
if (root === null) {
|
28916 |
+
warnAboutUpdateOnUnmountedFiberInDEV(fiber);
|
28917 |
+
return null;
|
28918 |
+
} // Mark that the root has a pending update.
|
|
|
|
|
|
|
|
|
28919 |
|
28920 |
+
|
28921 |
+
markRootUpdated(root, lane, eventTime);
|
28922 |
+
|
28923 |
+
if (root === workInProgressRoot) {
|
28924 |
+
// Received an update to a tree that's in the middle of rendering. Mark
|
28925 |
+
// that there was an interleaved update work on this root. Unless the
|
28926 |
+
// `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render
|
28927 |
+
// phase update. In that case, we don't treat render phase updates as if
|
28928 |
+
// they were interleaved, for backwards compat reasons.
|
28929 |
+
{
|
28930 |
+
workInProgressRootUpdatedLanes = mergeLanes(workInProgressRootUpdatedLanes, lane);
|
28931 |
}
|
28932 |
|
28933 |
+
if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
|
28934 |
+
// The root already suspended with a delay, which means this render
|
28935 |
+
// definitely won't finish. Since we have a new update, let's mark it as
|
28936 |
+
// suspended now, right before marking the incoming update. This has the
|
28937 |
+
// effect of interrupting the current render and switching to the update.
|
28938 |
+
// TODO: Make sure this doesn't override pings that happen while we've
|
28939 |
+
// already started rendering.
|
28940 |
+
markRootSuspended$1(root, workInProgressRootRenderLanes);
|
28941 |
+
}
|
28942 |
+
} // TODO: requestUpdateLanePriority also reads the priority. Pass the
|
28943 |
+
// priority as an argument to that function and this one.
|
28944 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28945 |
|
28946 |
+
var priorityLevel = getCurrentPriorityLevel();
|
28947 |
|
28948 |
+
if (lane === SyncLane) {
|
28949 |
+
if ( // Check if we're inside unbatchedUpdates
|
28950 |
+
(executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering
|
28951 |
+
(executionContext & (RenderContext | CommitContext)) === NoContext) {
|
28952 |
+
// Register pending interactions on the root to avoid losing traced interaction data.
|
28953 |
+
schedulePendingInteractions(root, lane); // This is a legacy edge case. The initial mount of a ReactDOM.render-ed
|
28954 |
+
// root inside of batchedUpdates should be synchronous, but layout updates
|
28955 |
+
// should be deferred until the end of the batch.
|
28956 |
|
28957 |
+
performSyncWorkOnRoot(root);
|
28958 |
+
} else {
|
28959 |
+
ensureRootIsScheduled(root, eventTime);
|
28960 |
+
schedulePendingInteractions(root, lane);
|
28961 |
|
28962 |
+
if (executionContext === NoContext) {
|
28963 |
+
// Flush the synchronous work now, unless we're already working or inside
|
28964 |
+
// a batch. This is intentionally inside scheduleUpdateOnFiber instead of
|
28965 |
+
// scheduleCallbackForFiber to preserve the ability to schedule a callback
|
28966 |
+
// without immediately flushing it. We only do this for user-initiated
|
28967 |
+
// updates, to preserve historical behavior of legacy mode.
|
28968 |
+
resetRenderTimer();
|
28969 |
+
flushSyncCallbackQueue();
|
28970 |
+
}
|
28971 |
}
|
28972 |
+
} else {
|
28973 |
+
// Schedule a discrete update but only if it's not Sync.
|
28974 |
+
if ((executionContext & DiscreteEventContext) !== NoContext && ( // Only updates at user-blocking priority or greater are considered
|
28975 |
+
// discrete, even inside a discrete event.
|
28976 |
+
priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority$1)) {
|
28977 |
+
// This is the result of a discrete event. Track the lowest priority
|
28978 |
+
// discrete update per root so we can flush them early, if needed.
|
28979 |
+
if (rootsWithPendingDiscreteUpdates === null) {
|
28980 |
+
rootsWithPendingDiscreteUpdates = new Set([root]);
|
28981 |
+
} else {
|
28982 |
+
rootsWithPendingDiscreteUpdates.add(root);
|
28983 |
+
}
|
28984 |
+
} // Schedule other updates after in case the callback is sync.
|
28985 |
|
|
|
28986 |
|
28987 |
+
ensureRootIsScheduled(root, eventTime);
|
28988 |
+
schedulePendingInteractions(root, lane);
|
28989 |
+
} // We use this when assigning a lane for a transition inside
|
28990 |
+
// `requestUpdateLane`. We assume it's the same as the root being updated,
|
28991 |
+
// since in the common case of a single root app it probably is. If it's not
|
28992 |
+
// the same root, then it's not a huge deal, we just might batch more stuff
|
28993 |
+
// together more than necessary.
|
28994 |
|
|
|
28995 |
|
28996 |
+
mostRecentlyUpdatedRoot = root;
|
28997 |
+
} // This is split into a separate function so we can mark a fiber with pending
|
28998 |
+
// work without treating it as a typical update that originates from an event;
|
28999 |
+
// e.g. retrying a Suspense boundary isn't an update, but it does schedule work
|
29000 |
+
// on a fiber.
|
29001 |
|
29002 |
+
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
29003 |
+
// Update the source fiber's lanes
|
29004 |
+
sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane);
|
29005 |
+
var alternate = sourceFiber.alternate;
|
|
|
29006 |
|
29007 |
+
if (alternate !== null) {
|
29008 |
+
alternate.lanes = mergeLanes(alternate.lanes, lane);
|
29009 |
+
}
|
|
|
29010 |
|
29011 |
+
{
|
29012 |
+
if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
|
29013 |
+
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
29014 |
+
}
|
29015 |
+
} // Walk the parent path to the root and update the child expiration time.
|
29016 |
|
|
|
29017 |
|
29018 |
+
var node = sourceFiber;
|
29019 |
+
var parent = sourceFiber.return;
|
29020 |
|
29021 |
+
while (parent !== null) {
|
29022 |
+
parent.childLanes = mergeLanes(parent.childLanes, lane);
|
29023 |
+
alternate = parent.alternate;
|
29024 |
+
|
29025 |
+
if (alternate !== null) {
|
29026 |
+
alternate.childLanes = mergeLanes(alternate.childLanes, lane);
|
29027 |
+
} else {
|
29028 |
{
|
29029 |
+
if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
|
29030 |
+
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
29031 |
}
|
29032 |
}
|
29033 |
+
}
|
29034 |
|
29035 |
+
node = parent;
|
29036 |
+
parent = parent.return;
|
29037 |
}
|
29038 |
|
29039 |
+
if (node.tag === HostRoot) {
|
29040 |
+
var root = node.stateNode;
|
29041 |
+
return root;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29042 |
} else {
|
29043 |
+
return null;
|
29044 |
}
|
29045 |
+
} // Use this function to schedule a task for a root. There's only one task per
|
29046 |
+
// root; if a task was already scheduled, we'll check to make sure the priority
|
29047 |
+
// of the existing task is the same as the priority of the next level that the
|
29048 |
+
// root has work on. This function is called on every update, and right before
|
29049 |
+
// exiting a task.
|
29050 |
|
|
|
|
|
|
|
29051 |
|
29052 |
+
function ensureRootIsScheduled(root, currentTime) {
|
29053 |
+
var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as
|
29054 |
+
// expired so we know to work on those next.
|
29055 |
|
29056 |
+
markStarvedLanesAsExpired(root, currentTime); // Determine the next lanes to work on, and their priority.
|
|
|
|
|
|
|
|
|
|
|
|
|
29057 |
|
29058 |
+
var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); // This returns the priority level computed during the `getNextLanes` call.
|
|
|
|
|
29059 |
|
29060 |
+
var newCallbackPriority = returnNextLanesPriority();
|
|
|
|
|
|
|
|
|
|
|
|
|
29061 |
|
29062 |
+
if (nextLanes === NoLanes) {
|
29063 |
+
// Special case: There's nothing to work on.
|
29064 |
+
if (existingCallbackNode !== null) {
|
29065 |
+
cancelCallback(existingCallbackNode);
|
29066 |
+
root.callbackNode = null;
|
29067 |
+
root.callbackPriority = NoLanePriority;
|
29068 |
+
}
|
29069 |
|
29070 |
+
return;
|
29071 |
+
} // Check if there's an existing task. We may be able to reuse it.
|
29072 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29073 |
|
29074 |
+
if (existingCallbackNode !== null) {
|
29075 |
+
var existingCallbackPriority = root.callbackPriority;
|
|
|
29076 |
|
29077 |
+
if (existingCallbackPriority === newCallbackPriority) {
|
29078 |
+
// The priority hasn't changed. We can reuse the existing task. Exit.
|
29079 |
+
return;
|
29080 |
+
} // The priority changed. Cancel the existing callback. We'll schedule a new
|
29081 |
+
// one below.
|
|
|
|
|
29082 |
|
|
|
|
|
|
|
|
|
|
|
29083 |
|
29084 |
+
cancelCallback(existingCallbackNode);
|
29085 |
+
} // Schedule a new callback.
|
29086 |
|
|
|
|
|
29087 |
|
29088 |
+
var newCallbackNode;
|
|
|
|
|
29089 |
|
29090 |
+
if (newCallbackPriority === SyncLanePriority) {
|
29091 |
+
// Special case: Sync React callbacks are scheduled on a special
|
29092 |
+
// internal queue
|
29093 |
+
newCallbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
|
29094 |
+
} else if (newCallbackPriority === SyncBatchedLanePriority) {
|
29095 |
+
newCallbackNode = scheduleCallback(ImmediatePriority$1, performSyncWorkOnRoot.bind(null, root));
|
29096 |
+
} else {
|
29097 |
+
var schedulerPriorityLevel = lanePriorityToSchedulerPriority(newCallbackPriority);
|
29098 |
+
newCallbackNode = scheduleCallback(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root));
|
29099 |
+
}
|
29100 |
|
29101 |
+
root.callbackPriority = newCallbackPriority;
|
29102 |
+
root.callbackNode = newCallbackNode;
|
29103 |
+
} // This is the entry point for every concurrent task, i.e. anything that
|
29104 |
+
// goes through Scheduler.
|
29105 |
|
|
|
|
|
|
|
|
|
|
|
29106 |
|
29107 |
+
function performConcurrentWorkOnRoot(root) {
|
29108 |
+
// Since we know we're in a React event, we can clear the current
|
29109 |
+
// event time. The next update will compute a new event time.
|
29110 |
+
currentEventTime = NoTimestamp;
|
29111 |
+
currentEventWipLanes = NoLanes;
|
29112 |
+
currentEventPendingLanes = NoLanes;
|
29113 |
|
29114 |
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
29115 |
+
{
|
29116 |
+
throw Error( "Should not already be working." );
|
29117 |
+
}
|
29118 |
+
} // Flush any pending passive effects before deciding which lanes to work on,
|
29119 |
+
// in case they schedule additional work.
|
29120 |
|
|
|
29121 |
|
29122 |
+
var originalCallbackNode = root.callbackNode;
|
29123 |
+
var didFlushPassiveEffects = flushPassiveEffects();
|
29124 |
|
29125 |
+
if (didFlushPassiveEffects) {
|
29126 |
+
// Something in the passive effect phase may have canceled the current task.
|
29127 |
+
// Check if the task node for this root was changed.
|
29128 |
+
if (root.callbackNode !== originalCallbackNode) {
|
29129 |
+
// The current task was canceled. Exit. We don't need to call
|
29130 |
+
// `ensureRootIsScheduled` because the check above implies either that
|
29131 |
+
// there's a new task, or that there's no remaining work on this root.
|
29132 |
+
return null;
|
29133 |
}
|
29134 |
+
} // Determine the next expiration time to work on, using the fields stored
|
29135 |
+
// on the root.
|
29136 |
|
|
|
|
|
|
|
29137 |
|
29138 |
+
var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes);
|
|
|
|
|
|
|
|
|
29139 |
|
29140 |
+
if (lanes === NoLanes) {
|
29141 |
+
// Defensive coding. This is never expected to happen.
|
29142 |
+
return null;
|
29143 |
+
}
|
|
|
|
|
29144 |
|
29145 |
+
var exitStatus = renderRootConcurrent(root, lanes);
|
|
|
|
|
|
|
|
|
|
|
29146 |
|
29147 |
+
if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) {
|
29148 |
+
// The render included lanes that were updated during the render phase.
|
29149 |
+
// For example, when unhiding a hidden tree, we include all the lanes
|
29150 |
+
// that were previously skipped when the tree was hidden. That set of
|
29151 |
+
// lanes is a superset of the lanes we started rendering with.
|
29152 |
+
//
|
29153 |
+
// So we'll throw out the current work and restart.
|
29154 |
+
prepareFreshStack(root, NoLanes);
|
29155 |
+
} else if (exitStatus !== RootIncomplete) {
|
29156 |
+
if (exitStatus === RootErrored) {
|
29157 |
+
executionContext |= RetryAfterError; // If an error occurred during hydration,
|
29158 |
+
// discard server response and fall back to client side render.
|
29159 |
|
29160 |
+
if (root.hydrate) {
|
29161 |
+
root.hydrate = false;
|
29162 |
+
clearContainer(root.containerInfo);
|
29163 |
+
} // If something threw an error, try rendering one more time. We'll render
|
29164 |
+
// synchronously to block concurrent data mutations, and we'll includes
|
29165 |
+
// all pending updates are included. If it still fails after the second
|
29166 |
+
// attempt, we'll give up and commit the resulting tree.
|
29167 |
|
|
|
|
|
|
|
|
|
29168 |
|
29169 |
+
lanes = getLanesToRetrySynchronouslyOnError(root);
|
29170 |
|
29171 |
+
if (lanes !== NoLanes) {
|
29172 |
+
exitStatus = renderRootSync(root, lanes);
|
|
|
|
|
29173 |
}
|
29174 |
}
|
29175 |
|
29176 |
+
if (exitStatus === RootFatalErrored) {
|
29177 |
+
var fatalError = workInProgressRootFatalError;
|
29178 |
+
prepareFreshStack(root, NoLanes);
|
29179 |
+
markRootSuspended$1(root, lanes);
|
29180 |
+
ensureRootIsScheduled(root, now());
|
29181 |
+
throw fatalError;
|
29182 |
+
} // We now have a consistent tree. The next step is either to commit it,
|
29183 |
+
// or, if something suspended, wait to commit it after a timeout.
|
29184 |
|
29185 |
+
|
29186 |
+
var finishedWork = root.current.alternate;
|
29187 |
+
root.finishedWork = finishedWork;
|
29188 |
+
root.finishedLanes = lanes;
|
29189 |
+
finishConcurrentRender(root, exitStatus, lanes);
|
29190 |
}
|
29191 |
|
29192 |
+
ensureRootIsScheduled(root, now());
|
|
|
29193 |
|
29194 |
+
if (root.callbackNode === originalCallbackNode) {
|
29195 |
+
// The task node scheduled for this root is the same one that's
|
29196 |
+
// currently executed. Need to return a continuation.
|
29197 |
+
return performConcurrentWorkOnRoot.bind(null, root);
|
29198 |
}
|
|
|
29199 |
|
29200 |
+
return null;
|
29201 |
+
}
|
29202 |
|
29203 |
+
function finishConcurrentRender(root, exitStatus, lanes) {
|
29204 |
+
switch (exitStatus) {
|
29205 |
+
case RootIncomplete:
|
29206 |
+
case RootFatalErrored:
|
|
|
|
|
29207 |
{
|
|
|
|
|
|
|
|
|
|
|
29208 |
{
|
29209 |
+
{
|
29210 |
+
throw Error( "Root did not complete. This is a bug in React." );
|
29211 |
+
}
|
29212 |
}
|
|
|
|
|
29213 |
}
|
29214 |
+
// Flow knows about invariant, so it complains if I add a break
|
29215 |
+
// statement, but eslint doesn't know about invariant, so it complains
|
29216 |
+
// if I do. eslint-disable-next-line no-fallthrough
|
29217 |
|
29218 |
+
case RootErrored:
|
29219 |
{
|
29220 |
+
// We should have already attempted to retry this tree. If we reached
|
29221 |
+
// this point, it errored again. Commit it.
|
29222 |
+
commitRoot(root);
|
29223 |
+
break;
|
29224 |
}
|
29225 |
|
29226 |
+
case RootSuspended:
|
29227 |
{
|
29228 |
+
markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we
|
29229 |
+
// should immediately commit it or wait a bit.
|
29230 |
|
29231 |
+
if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope
|
29232 |
+
!shouldForceFlushFallbacksInDEV()) {
|
29233 |
+
// This render only included retries, no updates. Throttle committing
|
29234 |
+
// retries so that we don't show too many loading states too quickly.
|
29235 |
+
var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time.
|
29236 |
|
29237 |
+
if (msUntilTimeout > 10) {
|
29238 |
+
var nextLanes = getNextLanes(root, NoLanes);
|
29239 |
|
29240 |
+
if (nextLanes !== NoLanes) {
|
29241 |
+
// There's additional work on this root.
|
29242 |
+
break;
|
29243 |
+
}
|
29244 |
|
29245 |
+
var suspendedLanes = root.suspendedLanes;
|
29246 |
+
|
29247 |
+
if (!isSubsetOfLanes(suspendedLanes, lanes)) {
|
29248 |
+
// We should prefer to render the fallback of at the last
|
29249 |
+
// suspended level. Ping the last suspended level to try
|
29250 |
+
// rendering it again.
|
29251 |
+
// FIXME: What if the suspended lanes are Idle? Should not restart.
|
29252 |
+
var eventTime = requestEventTime();
|
29253 |
+
markRootPinged(root, suspendedLanes);
|
29254 |
+
break;
|
29255 |
+
} // The render is suspended, it hasn't timed out, and there's no
|
29256 |
+
// lower priority work to do. Instead of committing the fallback
|
29257 |
+
// immediately, wait for more data to arrive.
|
29258 |
+
|
29259 |
+
|
29260 |
+
root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout);
|
29261 |
+
break;
|
29262 |
}
|
29263 |
+
} // The work expired. Commit immediately.
|
29264 |
|
29265 |
+
|
29266 |
+
commitRoot(root);
|
29267 |
+
break;
|
29268 |
}
|
29269 |
|
29270 |
+
case RootSuspendedWithDelay:
|
29271 |
{
|
29272 |
+
markRootSuspended$1(root, lanes);
|
29273 |
+
|
29274 |
+
if (includesOnlyTransitions(lanes)) {
|
29275 |
+
// This is a transition, so we should exit without committing a
|
29276 |
+
// placeholder and without scheduling a timeout. Delay indefinitely
|
29277 |
+
// until we receive more data.
|
29278 |
+
break;
|
29279 |
}
|
29280 |
|
29281 |
+
if (!shouldForceFlushFallbacksInDEV()) {
|
29282 |
+
// This is not a transition, but we did trigger an avoided state.
|
29283 |
+
// Schedule a placeholder to display after a short delay, using the Just
|
29284 |
+
// Noticeable Difference.
|
29285 |
+
// TODO: Is the JND optimization worth the added complexity? If this is
|
29286 |
+
// the only reason we track the event time, then probably not.
|
29287 |
+
// Consider removing.
|
29288 |
+
var mostRecentEventTime = getMostRecentEventTime(root, lanes);
|
29289 |
+
var eventTimeMs = mostRecentEventTime;
|
29290 |
+
var timeElapsedMs = now() - eventTimeMs;
|
29291 |
|
29292 |
+
var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs; // Don't bother with a very short suspense time.
|
|
|
|
|
|
|
29293 |
|
|
|
|
|
|
|
|
|
29294 |
|
29295 |
+
if (_msUntilTimeout > 10) {
|
29296 |
+
// Instead of committing the fallback immediately, wait for more data
|
29297 |
+
// to arrive.
|
29298 |
+
root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout);
|
29299 |
+
break;
|
29300 |
}
|
29301 |
+
} // Commit the placeholder.
|
29302 |
|
|
|
|
|
29303 |
|
29304 |
+
commitRoot(root);
|
29305 |
+
break;
|
|
|
29306 |
}
|
29307 |
|
29308 |
+
case RootCompleted:
|
29309 |
{
|
29310 |
+
// The work completed. Ready to commit.
|
29311 |
+
commitRoot(root);
|
29312 |
+
break;
|
29313 |
}
|
29314 |
|
29315 |
+
default:
|
29316 |
{
|
29317 |
+
{
|
29318 |
+
{
|
29319 |
+
throw Error( "Unknown root exit status." );
|
29320 |
+
}
|
29321 |
+
}
|
29322 |
}
|
29323 |
+
}
|
29324 |
+
}
|
29325 |
|
29326 |
+
function markRootSuspended$1(root, suspendedLanes) {
|
29327 |
+
// When suspending, we should always exclude lanes that were pinged or (more
|
29328 |
+
// rarely, since we try to avoid it) updated during the render phase.
|
29329 |
+
// TODO: Lol maybe there's a better way to factor this besides this
|
29330 |
+
// obnoxiously named function :)
|
29331 |
+
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes);
|
29332 |
+
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes);
|
29333 |
+
markRootSuspended(root, suspendedLanes);
|
29334 |
+
} // This is the entry point for synchronous tasks that don't go
|
29335 |
+
// through Scheduler
|
29336 |
|
|
|
|
|
29337 |
|
29338 |
+
function performSyncWorkOnRoot(root) {
|
29339 |
+
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
29340 |
+
{
|
29341 |
+
throw Error( "Should not already be working." );
|
29342 |
+
}
|
29343 |
+
}
|
29344 |
|
29345 |
+
flushPassiveEffects();
|
29346 |
+
var lanes;
|
29347 |
+
var exitStatus;
|
29348 |
|
29349 |
+
if (root === workInProgressRoot && includesSomeLane(root.expiredLanes, workInProgressRootRenderLanes)) {
|
29350 |
+
// There's a partial tree, and at least one of its lanes has expired. Finish
|
29351 |
+
// rendering it before rendering the rest of the expired work.
|
29352 |
+
lanes = workInProgressRootRenderLanes;
|
29353 |
+
exitStatus = renderRootSync(root, lanes);
|
29354 |
|
29355 |
+
if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) {
|
29356 |
+
// The render included lanes that were updated during the render phase.
|
29357 |
+
// For example, when unhiding a hidden tree, we include all the lanes
|
29358 |
+
// that were previously skipped when the tree was hidden. That set of
|
29359 |
+
// lanes is a superset of the lanes we started rendering with.
|
29360 |
+
//
|
29361 |
+
// Note that this only happens when part of the tree is rendered
|
29362 |
+
// concurrently. If the whole tree is rendered synchronously, then there
|
29363 |
+
// are no interleaved events.
|
29364 |
+
lanes = getNextLanes(root, lanes);
|
29365 |
+
exitStatus = renderRootSync(root, lanes);
|
29366 |
+
}
|
29367 |
+
} else {
|
29368 |
+
lanes = getNextLanes(root, NoLanes);
|
29369 |
+
exitStatus = renderRootSync(root, lanes);
|
29370 |
}
|
29371 |
|
29372 |
+
if (root.tag !== LegacyRoot && exitStatus === RootErrored) {
|
29373 |
+
executionContext |= RetryAfterError; // If an error occurred during hydration,
|
29374 |
+
// discard server response and fall back to client side render.
|
29375 |
+
|
29376 |
+
if (root.hydrate) {
|
29377 |
+
root.hydrate = false;
|
29378 |
+
clearContainer(root.containerInfo);
|
29379 |
+
} // If something threw an error, try rendering one more time. We'll render
|
29380 |
+
// synchronously to block concurrent data mutations, and we'll includes
|
29381 |
+
// all pending updates are included. If it still fails after the second
|
29382 |
+
// attempt, we'll give up and commit the resulting tree.
|
29383 |
+
|
29384 |
+
|
29385 |
+
lanes = getLanesToRetrySynchronouslyOnError(root);
|
29386 |
+
|
29387 |
+
if (lanes !== NoLanes) {
|
29388 |
+
exitStatus = renderRootSync(root, lanes);
|
29389 |
+
}
|
29390 |
+
}
|
29391 |
+
|
29392 |
+
if (exitStatus === RootFatalErrored) {
|
29393 |
+
var fatalError = workInProgressRootFatalError;
|
29394 |
+
prepareFreshStack(root, NoLanes);
|
29395 |
+
markRootSuspended$1(root, lanes);
|
29396 |
+
ensureRootIsScheduled(root, now());
|
29397 |
+
throw fatalError;
|
29398 |
+
} // We now have a consistent tree. Because this is a sync render, we
|
29399 |
+
// will commit it even if something suspended.
|
29400 |
+
|
29401 |
+
|
29402 |
+
var finishedWork = root.current.alternate;
|
29403 |
+
root.finishedWork = finishedWork;
|
29404 |
+
root.finishedLanes = lanes;
|
29405 |
+
commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next
|
29406 |
+
// pending level.
|
29407 |
+
|
29408 |
+
ensureRootIsScheduled(root, now());
|
29409 |
+
return null;
|
29410 |
+
}
|
29411 |
+
function flushDiscreteUpdates() {
|
29412 |
+
// TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
|
29413 |
+
// However, `act` uses `batchedUpdates`, so there's no way to distinguish
|
29414 |
+
// those two cases. Need to fix this before exposing flushDiscreteUpdates
|
29415 |
+
// as a public API.
|
29416 |
+
if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
|
29417 |
{
|
29418 |
+
if ((executionContext & RenderContext) !== NoContext) {
|
29419 |
+
error('unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
|
29420 |
+
}
|
29421 |
+
} // We're already rendering, so we can't synchronously flush pending work.
|
29422 |
+
// This is probably a nested event dispatch triggered by a lifecycle/effect,
|
29423 |
+
// like `el.focus()`. Exit.
|
29424 |
+
|
29425 |
+
|
29426 |
+
return;
|
29427 |
+
}
|
29428 |
+
|
29429 |
+
flushPendingDiscreteUpdates(); // If the discrete updates scheduled passive effects, flush them now so that
|
29430 |
+
// they fire before the next serial event.
|
29431 |
+
|
29432 |
+
flushPassiveEffects();
|
29433 |
+
}
|
29434 |
+
|
29435 |
+
function flushPendingDiscreteUpdates() {
|
29436 |
+
if (rootsWithPendingDiscreteUpdates !== null) {
|
29437 |
+
// For each root with pending discrete updates, schedule a callback to
|
29438 |
+
// immediately flush them.
|
29439 |
+
var roots = rootsWithPendingDiscreteUpdates;
|
29440 |
+
rootsWithPendingDiscreteUpdates = null;
|
29441 |
+
roots.forEach(function (root) {
|
29442 |
+
markDiscreteUpdatesExpired(root);
|
29443 |
+
ensureRootIsScheduled(root, now());
|
29444 |
+
});
|
29445 |
+
} // Now flush the immediate queue.
|
29446 |
+
|
29447 |
+
|
29448 |
+
flushSyncCallbackQueue();
|
29449 |
+
}
|
29450 |
+
|
29451 |
+
function batchedUpdates$1(fn, a) {
|
29452 |
+
var prevExecutionContext = executionContext;
|
29453 |
+
executionContext |= BatchedContext;
|
29454 |
+
|
29455 |
+
try {
|
29456 |
+
return fn(a);
|
29457 |
+
} finally {
|
29458 |
+
executionContext = prevExecutionContext;
|
29459 |
+
|
29460 |
+
if (executionContext === NoContext) {
|
29461 |
+
// Flush the immediate callbacks that were scheduled during this batch
|
29462 |
+
resetRenderTimer();
|
29463 |
+
flushSyncCallbackQueue();
|
29464 |
}
|
29465 |
}
|
29466 |
}
|
29467 |
+
function batchedEventUpdates$1(fn, a) {
|
29468 |
+
var prevExecutionContext = executionContext;
|
29469 |
+
executionContext |= EventContext;
|
29470 |
|
29471 |
+
try {
|
29472 |
+
return fn(a);
|
29473 |
+
} finally {
|
29474 |
+
executionContext = prevExecutionContext;
|
|
|
29475 |
|
29476 |
+
if (executionContext === NoContext) {
|
29477 |
+
// Flush the immediate callbacks that were scheduled during this batch
|
29478 |
+
resetRenderTimer();
|
29479 |
+
flushSyncCallbackQueue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29480 |
}
|
29481 |
}
|
29482 |
}
|
29483 |
+
function discreteUpdates$1(fn, a, b, c, d) {
|
29484 |
+
var prevExecutionContext = executionContext;
|
29485 |
+
executionContext |= DiscreteEventContext;
|
29486 |
|
29487 |
+
{
|
29488 |
+
try {
|
29489 |
+
return runWithPriority$1(UserBlockingPriority$2, fn.bind(null, a, b, c, d));
|
29490 |
+
} finally {
|
29491 |
+
executionContext = prevExecutionContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29492 |
|
29493 |
+
if (executionContext === NoContext) {
|
29494 |
+
// Flush the immediate callbacks that were scheduled during this batch
|
29495 |
+
resetRenderTimer();
|
29496 |
+
flushSyncCallbackQueue();
|
29497 |
}
|
29498 |
}
|
29499 |
}
|
29500 |
}
|
29501 |
+
function unbatchedUpdates(fn, a) {
|
29502 |
+
var prevExecutionContext = executionContext;
|
29503 |
+
executionContext &= ~BatchedContext;
|
29504 |
+
executionContext |= LegacyUnbatchedContext;
|
29505 |
|
29506 |
+
try {
|
29507 |
+
return fn(a);
|
29508 |
+
} finally {
|
29509 |
+
executionContext = prevExecutionContext;
|
|
|
29510 |
|
29511 |
+
if (executionContext === NoContext) {
|
29512 |
+
// Flush the immediate callbacks that were scheduled during this batch
|
29513 |
+
resetRenderTimer();
|
29514 |
+
flushSyncCallbackQueue();
|
29515 |
+
}
|
29516 |
+
}
|
29517 |
+
}
|
29518 |
+
function flushSync(fn, a) {
|
29519 |
+
var prevExecutionContext = executionContext;
|
29520 |
|
29521 |
+
if ((prevExecutionContext & (RenderContext | CommitContext)) !== NoContext) {
|
29522 |
+
{
|
29523 |
+
error('flushSync was called from inside a lifecycle method. React cannot ' + 'flush when React is already rendering. Consider moving this call to ' + 'a scheduler task or micro task.');
|
29524 |
}
|
29525 |
|
29526 |
+
return fn(a);
|
29527 |
+
}
|
|
|
29528 |
|
29529 |
+
executionContext |= BatchedContext;
|
|
|
|
|
|
|
|
|
|
|
29530 |
|
29531 |
+
{
|
29532 |
+
try {
|
29533 |
+
if (fn) {
|
29534 |
+
return runWithPriority$1(ImmediatePriority$1, fn.bind(null, a));
|
29535 |
+
} else {
|
29536 |
+
return undefined;
|
29537 |
}
|
29538 |
+
} finally {
|
29539 |
+
executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch.
|
29540 |
+
// Note that this will happen even if batchedUpdates is higher up
|
29541 |
+
// the stack.
|
29542 |
+
|
29543 |
+
flushSyncCallbackQueue();
|
29544 |
+
}
|
29545 |
}
|
29546 |
+
}
|
29547 |
+
function pushRenderLanes(fiber, lanes) {
|
29548 |
+
push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber);
|
29549 |
+
subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes);
|
29550 |
+
workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes);
|
29551 |
+
}
|
29552 |
+
function popRenderLanes(fiber) {
|
29553 |
+
subtreeRenderLanes = subtreeRenderLanesCursor.current;
|
29554 |
+
pop(subtreeRenderLanesCursor, fiber);
|
29555 |
+
}
|
29556 |
|
29557 |
+
function prepareFreshStack(root, lanes) {
|
29558 |
+
root.finishedWork = null;
|
29559 |
+
root.finishedLanes = NoLanes;
|
29560 |
+
var timeoutHandle = root.timeoutHandle;
|
29561 |
|
29562 |
+
if (timeoutHandle !== noTimeout) {
|
29563 |
+
// The root previous suspended and scheduled a timeout to commit a fallback
|
29564 |
+
// state. Now that we have additional work, cancel the timeout.
|
29565 |
+
root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
|
29566 |
|
29567 |
+
cancelTimeout(timeoutHandle);
|
|
|
|
|
|
|
29568 |
}
|
29569 |
|
29570 |
+
if (workInProgress !== null) {
|
29571 |
+
var interruptedWork = workInProgress.return;
|
29572 |
|
29573 |
+
while (interruptedWork !== null) {
|
29574 |
+
unwindInterruptedWork(interruptedWork);
|
29575 |
+
interruptedWork = interruptedWork.return;
|
29576 |
+
}
|
29577 |
+
}
|
29578 |
|
29579 |
+
workInProgressRoot = root;
|
29580 |
+
workInProgress = createWorkInProgress(root.current, null);
|
29581 |
+
workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes;
|
29582 |
+
workInProgressRootExitStatus = RootIncomplete;
|
29583 |
+
workInProgressRootFatalError = null;
|
29584 |
+
workInProgressRootSkippedLanes = NoLanes;
|
29585 |
+
workInProgressRootUpdatedLanes = NoLanes;
|
29586 |
+
workInProgressRootPingedLanes = NoLanes;
|
29587 |
|
29588 |
+
{
|
29589 |
+
spawnedWorkDuringRender = null;
|
29590 |
+
}
|
|
|
|
|
29591 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29592 |
{
|
29593 |
+
ReactStrictModeWarnings.discardPendingWarnings();
|
|
|
|
|
29594 |
}
|
29595 |
}
|
29596 |
|
29597 |
+
function handleError(root, thrownValue) {
|
29598 |
+
do {
|
29599 |
+
var erroredWork = workInProgress;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29600 |
|
29601 |
+
try {
|
29602 |
+
// Reset module-level state that was set during the render phase.
|
29603 |
+
resetContextDependencies();
|
29604 |
+
resetHooksAfterThrow();
|
29605 |
+
resetCurrentFiber(); // TODO: I found and added this missing line while investigating a
|
29606 |
+
// separate issue. Write a regression test using string refs.
|
29607 |
|
29608 |
+
ReactCurrentOwner$2.current = null;
|
29609 |
|
29610 |
+
if (erroredWork === null || erroredWork.return === null) {
|
29611 |
+
// Expected to be working on a non-root fiber. This is a fatal error
|
29612 |
+
// because there's no ancestor that can handle it; the root is
|
29613 |
+
// supposed to capture all errors that weren't caught by an error
|
29614 |
+
// boundary.
|
29615 |
+
workInProgressRootExitStatus = RootFatalErrored;
|
29616 |
+
workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next
|
29617 |
+
// sibling, or the parent if there are no siblings. But since the root
|
29618 |
+
// has no siblings nor a parent, we set it to null. Usually this is
|
29619 |
+
// handled by `completeUnitOfWork` or `unwindWork`, but since we're
|
29620 |
+
// intentionally not calling those, we need set it here.
|
29621 |
+
// TODO: Consider calling `unwindWork` to pop the contexts.
|
29622 |
|
29623 |
+
workInProgress = null;
|
29624 |
+
return;
|
29625 |
+
}
|
29626 |
|
29627 |
+
if (enableProfilerTimer && erroredWork.mode & ProfileMode) {
|
29628 |
+
// Record the time spent rendering before an error was thrown. This
|
29629 |
+
// avoids inaccurate Profiler durations in the case of a
|
29630 |
+
// suspended render.
|
29631 |
+
stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true);
|
29632 |
+
}
|
29633 |
|
29634 |
+
throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes);
|
29635 |
+
completeUnitOfWork(erroredWork);
|
29636 |
+
} catch (yetAnotherThrownValue) {
|
29637 |
+
// Something in the return path also threw.
|
29638 |
+
thrownValue = yetAnotherThrownValue;
|
29639 |
|
29640 |
+
if (workInProgress === erroredWork && erroredWork !== null) {
|
29641 |
+
// If this boundary has already errored, then we had trouble processing
|
29642 |
+
// the error. Bubble it to the next boundary.
|
29643 |
+
erroredWork = erroredWork.return;
|
29644 |
+
workInProgress = erroredWork;
|
29645 |
+
} else {
|
29646 |
+
erroredWork = workInProgress;
|
29647 |
+
}
|
29648 |
|
29649 |
+
continue;
|
29650 |
+
} // Return to the normal work loop.
|
29651 |
|
|
|
29652 |
|
29653 |
+
return;
|
29654 |
+
} while (true);
|
29655 |
+
}
|
29656 |
|
29657 |
+
function pushDispatcher() {
|
29658 |
+
var prevDispatcher = ReactCurrentDispatcher$2.current;
|
29659 |
+
ReactCurrentDispatcher$2.current = ContextOnlyDispatcher;
|
29660 |
|
29661 |
+
if (prevDispatcher === null) {
|
29662 |
+
// The React isomorphic package does not include a default dispatcher.
|
29663 |
+
// Instead the first renderer will lazily attach one, in order to give
|
29664 |
+
// nicer error messages.
|
29665 |
+
return ContextOnlyDispatcher;
|
29666 |
+
} else {
|
29667 |
+
return prevDispatcher;
|
29668 |
+
}
|
29669 |
+
}
|
29670 |
|
29671 |
+
function popDispatcher(prevDispatcher) {
|
29672 |
+
ReactCurrentDispatcher$2.current = prevDispatcher;
|
29673 |
+
}
|
29674 |
|
29675 |
+
function pushInteractions(root) {
|
29676 |
+
{
|
29677 |
+
var prevInteractions = tracing.__interactionsRef.current;
|
29678 |
+
tracing.__interactionsRef.current = root.memoizedInteractions;
|
29679 |
+
return prevInteractions;
|
29680 |
+
}
|
29681 |
}
|
29682 |
|
29683 |
+
function popInteractions(prevInteractions) {
|
29684 |
+
{
|
29685 |
+
tracing.__interactionsRef.current = prevInteractions;
|
29686 |
+
}
|
29687 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29688 |
|
29689 |
+
function markCommitTimeOfFallback() {
|
29690 |
+
globalMostRecentFallbackTime = now();
|
29691 |
+
}
|
29692 |
+
function markSkippedUpdateLanes(lane) {
|
29693 |
+
workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes);
|
29694 |
+
}
|
29695 |
+
function renderDidSuspend() {
|
29696 |
+
if (workInProgressRootExitStatus === RootIncomplete) {
|
29697 |
+
workInProgressRootExitStatus = RootSuspended;
|
29698 |
+
}
|
29699 |
+
}
|
29700 |
+
function renderDidSuspendDelayIfPossible() {
|
29701 |
+
if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
|
29702 |
+
workInProgressRootExitStatus = RootSuspendedWithDelay;
|
29703 |
+
} // Check if there are updates that we skipped tree that might have unblocked
|
29704 |
+
// this render.
|
29705 |
|
|
|
|
|
|
|
29706 |
|
29707 |
+
if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootUpdatedLanes))) {
|
29708 |
+
// Mark the current render as suspended so that we switch to working on
|
29709 |
+
// the updates that were skipped. Usually we only suspend at the end of
|
29710 |
+
// the render phase.
|
29711 |
+
// TODO: We should probably always mark the root as suspended immediately
|
29712 |
+
// (inside this function), since by suspending at the end of the render
|
29713 |
+
// phase introduces a potential mistake where we suspend lanes that were
|
29714 |
+
// pinged or updated while we were rendering.
|
29715 |
+
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
|
29716 |
+
}
|
29717 |
+
}
|
29718 |
+
function renderDidError() {
|
29719 |
+
if (workInProgressRootExitStatus !== RootCompleted) {
|
29720 |
+
workInProgressRootExitStatus = RootErrored;
|
29721 |
+
}
|
29722 |
+
} // Called during render to determine if anything has suspended.
|
29723 |
+
// Returns false if we're not sure.
|
29724 |
|
29725 |
+
function renderHasNotSuspendedYet() {
|
29726 |
+
// If something errored or completed, we can't really be sure,
|
29727 |
+
// so those are false.
|
29728 |
+
return workInProgressRootExitStatus === RootIncomplete;
|
|
|
29729 |
}
|
|
|
|
|
|
|
|
|
|
|
29730 |
|
29731 |
+
function renderRootSync(root, lanes) {
|
29732 |
+
var prevExecutionContext = executionContext;
|
29733 |
+
executionContext |= RenderContext;
|
29734 |
+
var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack
|
29735 |
+
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
29736 |
|
29737 |
+
if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) {
|
29738 |
+
prepareFreshStack(root, lanes);
|
29739 |
+
startWorkOnPendingInteractions(root, lanes);
|
29740 |
+
}
|
29741 |
|
29742 |
+
var prevInteractions = pushInteractions(root);
|
29743 |
|
29744 |
+
do {
|
29745 |
+
try {
|
29746 |
+
workLoopSync();
|
29747 |
+
break;
|
29748 |
+
} catch (thrownValue) {
|
29749 |
+
handleError(root, thrownValue);
|
29750 |
+
}
|
29751 |
+
} while (true);
|
29752 |
|
29753 |
+
resetContextDependencies();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29754 |
|
29755 |
+
{
|
29756 |
+
popInteractions(prevInteractions);
|
29757 |
+
}
|
29758 |
|
29759 |
+
executionContext = prevExecutionContext;
|
29760 |
+
popDispatcher(prevDispatcher);
|
29761 |
+
|
29762 |
+
if (workInProgress !== null) {
|
29763 |
+
// This is a sync render, so we should have finished the whole tree.
|
29764 |
+
{
|
29765 |
+
{
|
29766 |
+
throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." );
|
29767 |
+
}
|
29768 |
+
}
|
29769 |
}
|
29770 |
|
|
|
29771 |
|
29772 |
+
workInProgressRoot = null;
|
29773 |
+
workInProgressRootRenderLanes = NoLanes;
|
29774 |
+
return workInProgressRootExitStatus;
|
29775 |
+
} // The work loop is an extremely hot path. Tell Closure not to inline it.
|
29776 |
+
|
29777 |
+
/** @noinline */
|
29778 |
+
|
29779 |
+
|
29780 |
+
function workLoopSync() {
|
29781 |
+
// Already timed out, so perform work without checking if we need to yield.
|
29782 |
+
while (workInProgress !== null) {
|
29783 |
+
performUnitOfWork(workInProgress);
|
29784 |
+
}
|
29785 |
+
}
|
29786 |
+
|
29787 |
+
function renderRootConcurrent(root, lanes) {
|
29788 |
+
var prevExecutionContext = executionContext;
|
29789 |
+
executionContext |= RenderContext;
|
29790 |
+
var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack
|
29791 |
+
// and prepare a fresh one. Otherwise we'll continue where we left off.
|
29792 |
+
|
29793 |
+
if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) {
|
29794 |
+
resetRenderTimer();
|
29795 |
+
prepareFreshStack(root, lanes);
|
29796 |
+
startWorkOnPendingInteractions(root, lanes);
|
29797 |
+
}
|
29798 |
+
|
29799 |
+
var prevInteractions = pushInteractions(root);
|
29800 |
+
|
29801 |
+
do {
|
29802 |
+
try {
|
29803 |
+
workLoopConcurrent();
|
29804 |
+
break;
|
29805 |
+
} catch (thrownValue) {
|
29806 |
+
handleError(root, thrownValue);
|
29807 |
}
|
29808 |
+
} while (true);
|
29809 |
|
29810 |
+
resetContextDependencies();
|
29811 |
+
|
29812 |
+
{
|
29813 |
+
popInteractions(prevInteractions);
|
29814 |
+
}
|
29815 |
|
29816 |
+
popDispatcher(prevDispatcher);
|
29817 |
+
executionContext = prevExecutionContext;
|
29818 |
|
|
|
|
|
|
|
|
|
|
|
|
|
29819 |
|
29820 |
+
if (workInProgress !== null) {
|
29821 |
|
29822 |
+
return RootIncomplete;
|
|
|
|
|
29823 |
} else {
|
|
|
29824 |
|
29825 |
+
|
29826 |
+
workInProgressRoot = null;
|
29827 |
+
workInProgressRootRenderLanes = NoLanes; // Return the final exit status.
|
29828 |
+
|
29829 |
+
return workInProgressRootExitStatus;
|
29830 |
}
|
29831 |
+
}
|
29832 |
+
/** @noinline */
|
29833 |
|
29834 |
+
|
29835 |
+
function workLoopConcurrent() {
|
29836 |
+
// Perform work until Scheduler asks us to yield
|
29837 |
+
while (workInProgress !== null && !shouldYield()) {
|
29838 |
+
performUnitOfWork(workInProgress);
|
29839 |
+
}
|
29840 |
}
|
29841 |
|
29842 |
+
function performUnitOfWork(unitOfWork) {
|
29843 |
+
// The current, flushed, state of this fiber is the alternate. Ideally
|
29844 |
+
// nothing should rely on this, but relying on it here means that we don't
|
29845 |
+
// need an additional field on the work in progress.
|
29846 |
+
var current = unitOfWork.alternate;
|
29847 |
+
setCurrentFiber(unitOfWork);
|
29848 |
+
var next;
|
29849 |
|
29850 |
+
if ( (unitOfWork.mode & ProfileMode) !== NoMode) {
|
29851 |
+
startProfilerTimer(unitOfWork);
|
29852 |
+
next = beginWork$1(current, unitOfWork, subtreeRenderLanes);
|
29853 |
+
stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
|
29854 |
+
} else {
|
29855 |
+
next = beginWork$1(current, unitOfWork, subtreeRenderLanes);
|
29856 |
+
}
|
29857 |
|
29858 |
+
resetCurrentFiber();
|
29859 |
+
unitOfWork.memoizedProps = unitOfWork.pendingProps;
|
29860 |
|
29861 |
+
if (next === null) {
|
29862 |
+
// If this doesn't spawn new work, complete the current work.
|
29863 |
+
completeUnitOfWork(unitOfWork);
|
29864 |
+
} else {
|
29865 |
+
workInProgress = next;
|
29866 |
}
|
29867 |
|
29868 |
+
ReactCurrentOwner$2.current = null;
|
29869 |
}
|
29870 |
|
29871 |
+
function completeUnitOfWork(unitOfWork) {
|
29872 |
+
// Attempt to complete the current unit of work, then move to the next
|
29873 |
+
// sibling. If there are no more siblings, return to the parent fiber.
|
29874 |
+
var completedWork = unitOfWork;
|
29875 |
|
29876 |
+
do {
|
29877 |
+
// The current, flushed, state of this fiber is the alternate. Ideally
|
29878 |
+
// nothing should rely on this, but relying on it here means that we don't
|
29879 |
+
// need an additional field on the work in progress.
|
29880 |
+
var current = completedWork.alternate;
|
29881 |
+
var returnFiber = completedWork.return; // Check if the work completed or if something threw.
|
29882 |
|
29883 |
+
if ((completedWork.flags & Incomplete) === NoFlags) {
|
29884 |
+
setCurrentFiber(completedWork);
|
29885 |
+
var next = void 0;
|
29886 |
|
29887 |
+
if ( (completedWork.mode & ProfileMode) === NoMode) {
|
29888 |
+
next = completeWork(current, completedWork, subtreeRenderLanes);
|
29889 |
+
} else {
|
29890 |
+
startProfilerTimer(completedWork);
|
29891 |
+
next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error.
|
29892 |
|
29893 |
+
stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
|
29894 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29895 |
|
29896 |
+
resetCurrentFiber();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29897 |
|
29898 |
+
if (next !== null) {
|
29899 |
+
// Completing this fiber spawned new work. Work on that next.
|
29900 |
+
workInProgress = next;
|
29901 |
+
return;
|
29902 |
+
}
|
29903 |
|
29904 |
+
resetChildLanes(completedWork);
|
29905 |
|
29906 |
+
if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete
|
29907 |
+
(returnFiber.flags & Incomplete) === NoFlags) {
|
29908 |
+
// Append all the effects of the subtree and this fiber onto the effect
|
29909 |
+
// list of the parent. The completion order of the children affects the
|
29910 |
+
// side-effect order.
|
29911 |
+
if (returnFiber.firstEffect === null) {
|
29912 |
+
returnFiber.firstEffect = completedWork.firstEffect;
|
29913 |
+
}
|
29914 |
|
29915 |
+
if (completedWork.lastEffect !== null) {
|
29916 |
+
if (returnFiber.lastEffect !== null) {
|
29917 |
+
returnFiber.lastEffect.nextEffect = completedWork.firstEffect;
|
29918 |
+
}
|
29919 |
|
29920 |
+
returnFiber.lastEffect = completedWork.lastEffect;
|
29921 |
+
} // If this fiber had side-effects, we append it AFTER the children's
|
29922 |
+
// side-effects. We can perform certain side-effects earlier if needed,
|
29923 |
+
// by doing multiple passes over the effect list. We don't want to
|
29924 |
+
// schedule our own side-effect on our own list because if end up
|
29925 |
+
// reusing children we'll schedule this effect onto itself since we're
|
29926 |
+
// at the end.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29927 |
|
29928 |
|
29929 |
+
var flags = completedWork.flags; // Skip both NoWork and PerformedWork tags when creating the effect
|
29930 |
+
// list. PerformedWork effect is read by React DevTools but shouldn't be
|
29931 |
+
// committed.
|
|
|
|
|
|
|
|
|
29932 |
|
29933 |
+
if (flags > PerformedWork) {
|
29934 |
+
if (returnFiber.lastEffect !== null) {
|
29935 |
+
returnFiber.lastEffect.nextEffect = completedWork;
|
29936 |
+
} else {
|
29937 |
+
returnFiber.firstEffect = completedWork;
|
29938 |
+
}
|
29939 |
|
29940 |
+
returnFiber.lastEffect = completedWork;
|
29941 |
+
}
|
29942 |
+
}
|
29943 |
+
} else {
|
29944 |
+
// This fiber did not complete because something threw. Pop values off
|
29945 |
+
// the stack without entering the complete phase. If this is a boundary,
|
29946 |
+
// capture values if possible.
|
29947 |
+
var _next = unwindWork(completedWork); // Because this fiber did not complete, don't reset its expiration time.
|
29948 |
|
|
|
|
|
|
|
|
|
29949 |
|
29950 |
+
if (_next !== null) {
|
29951 |
+
// If completing this work spawned new work, do that next. We'll come
|
29952 |
+
// back here again.
|
29953 |
+
// Since we're restarting, remove anything that is not a host effect
|
29954 |
+
// from the effect tag.
|
29955 |
+
_next.flags &= HostEffectMask;
|
29956 |
+
workInProgress = _next;
|
29957 |
+
return;
|
29958 |
+
}
|
29959 |
|
29960 |
+
if ( (completedWork.mode & ProfileMode) !== NoMode) {
|
29961 |
+
// Record the render duration for the fiber that errored.
|
29962 |
+
stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing.
|
|
|
|
|
29963 |
|
29964 |
+
var actualDuration = completedWork.actualDuration;
|
29965 |
+
var child = completedWork.child;
|
29966 |
|
29967 |
+
while (child !== null) {
|
29968 |
+
actualDuration += child.actualDuration;
|
29969 |
+
child = child.sibling;
|
29970 |
+
}
|
29971 |
|
29972 |
+
completedWork.actualDuration = actualDuration;
|
29973 |
+
}
|
|
|
29974 |
|
29975 |
+
if (returnFiber !== null) {
|
29976 |
+
// Mark the parent fiber as incomplete and clear its effect list.
|
29977 |
+
returnFiber.firstEffect = returnFiber.lastEffect = null;
|
29978 |
+
returnFiber.flags |= Incomplete;
|
|
|
|
|
|
|
29979 |
}
|
29980 |
}
|
29981 |
|
29982 |
+
var siblingFiber = completedWork.sibling;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29983 |
|
29984 |
+
if (siblingFiber !== null) {
|
29985 |
+
// If there is more work to do in this returnFiber, do that next.
|
29986 |
+
workInProgress = siblingFiber;
|
29987 |
+
return;
|
29988 |
+
} // Otherwise, return to the parent
|
29989 |
|
|
|
|
|
|
|
29990 |
|
29991 |
+
completedWork = returnFiber; // Update the next thing we're working on in case something throws.
|
29992 |
|
29993 |
+
workInProgress = completedWork;
|
29994 |
+
} while (completedWork !== null); // We've reached the root.
|
29995 |
|
|
|
29996 |
|
29997 |
+
if (workInProgressRootExitStatus === RootIncomplete) {
|
29998 |
+
workInProgressRootExitStatus = RootCompleted;
|
29999 |
+
}
|
30000 |
+
}
|
|
|
|
|
|
|
30001 |
|
30002 |
+
function resetChildLanes(completedWork) {
|
30003 |
+
if ( // TODO: Move this check out of the hot path by moving `resetChildLanes`
|
30004 |
+
// to switch statement in `completeWork`.
|
30005 |
+
(completedWork.tag === LegacyHiddenComponent || completedWork.tag === OffscreenComponent) && completedWork.memoizedState !== null && !includesSomeLane(subtreeRenderLanes, OffscreenLane) && (completedWork.mode & ConcurrentMode) !== NoLanes) {
|
30006 |
+
// The children of this component are hidden. Don't bubble their
|
30007 |
+
// expiration times.
|
30008 |
return;
|
30009 |
+
}
|
30010 |
|
30011 |
+
var newChildLanes = NoLanes; // Bubble up the earliest expiration time.
|
30012 |
|
30013 |
+
if ( (completedWork.mode & ProfileMode) !== NoMode) {
|
30014 |
+
// In profiling mode, resetChildExpirationTime is also used to reset
|
30015 |
+
// profiler durations.
|
30016 |
+
var actualDuration = completedWork.actualDuration;
|
30017 |
+
var treeBaseDuration = completedWork.selfBaseDuration; // When a fiber is cloned, its actualDuration is reset to 0. This value will
|
30018 |
+
// only be updated if work is done on the fiber (i.e. it doesn't bailout).
|
30019 |
+
// When work is done, it should bubble to the parent's actualDuration. If
|
30020 |
+
// the fiber has not been cloned though, (meaning no work was done), then
|
30021 |
+
// this value will reflect the amount of time spent working on a previous
|
30022 |
+
// render. In that case it should not bubble. We determine whether it was
|
30023 |
+
// cloned by comparing the child pointer.
|
30024 |
|
30025 |
+
var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
|
30026 |
+
var child = completedWork.child;
|
|
|
|
|
|
|
30027 |
|
30028 |
+
while (child !== null) {
|
30029 |
+
newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes));
|
30030 |
|
30031 |
+
if (shouldBubbleActualDurations) {
|
30032 |
+
actualDuration += child.actualDuration;
|
30033 |
+
}
|
30034 |
|
30035 |
+
treeBaseDuration += child.treeBaseDuration;
|
30036 |
+
child = child.sibling;
|
30037 |
+
}
|
30038 |
|
30039 |
+
var isTimedOutSuspense = completedWork.tag === SuspenseComponent && completedWork.memoizedState !== null;
|
30040 |
|
30041 |
+
if (isTimedOutSuspense) {
|
30042 |
+
// Don't count time spent in a timed out Suspense subtree as part of the base duration.
|
30043 |
+
var primaryChildFragment = completedWork.child;
|
30044 |
+
|
30045 |
+
if (primaryChildFragment !== null) {
|
30046 |
+
treeBaseDuration -= primaryChildFragment.treeBaseDuration;
|
30047 |
+
}
|
30048 |
+
}
|
30049 |
+
|
30050 |
+
completedWork.actualDuration = actualDuration;
|
30051 |
+
completedWork.treeBaseDuration = treeBaseDuration;
|
30052 |
} else {
|
30053 |
+
var _child = completedWork.child;
|
30054 |
+
|
30055 |
+
while (_child !== null) {
|
30056 |
+
newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes));
|
30057 |
+
_child = _child.sibling;
|
30058 |
+
}
|
30059 |
}
|
30060 |
|
30061 |
+
completedWork.childLanes = newChildLanes;
|
30062 |
+
}
|
|
|
|
|
30063 |
|
30064 |
+
function commitRoot(root) {
|
30065 |
+
var renderPriorityLevel = getCurrentPriorityLevel();
|
30066 |
+
runWithPriority$1(ImmediatePriority$1, commitRootImpl.bind(null, root, renderPriorityLevel));
|
30067 |
+
return null;
|
30068 |
+
}
|
30069 |
|
30070 |
+
function commitRootImpl(root, renderPriorityLevel) {
|
30071 |
+
do {
|
30072 |
+
// `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
|
30073 |
+
// means `flushPassiveEffects` will sometimes result in additional
|
30074 |
+
// passive effects. So we need to keep flushing in a loop until there are
|
30075 |
+
// no more pending effects.
|
30076 |
+
// TODO: Might be better if `flushPassiveEffects` did not automatically
|
30077 |
+
// flush synchronous work at the end, to avoid factoring hazards like this.
|
30078 |
+
flushPassiveEffects();
|
30079 |
+
} while (rootWithPendingPassiveEffects !== null);
|
30080 |
+
|
30081 |
+
flushRenderPhaseStrictModeWarningsInDEV();
|
30082 |
|
30083 |
if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
|
30084 |
{
|
30085 |
throw Error( "Should not already be working." );
|
30086 |
}
|
30087 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30088 |
|
30089 |
+
var finishedWork = root.finishedWork;
|
30090 |
+
var lanes = root.finishedLanes;
|
30091 |
|
30092 |
+
if (finishedWork === null) {
|
30093 |
|
|
|
|
|
30094 |
return null;
|
30095 |
}
|
30096 |
|
30097 |
+
root.finishedWork = null;
|
30098 |
+
root.finishedLanes = NoLanes;
|
30099 |
|
30100 |
+
if (!(finishedWork !== root.current)) {
|
30101 |
+
{
|
30102 |
+
throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." );
|
30103 |
+
}
|
30104 |
+
} // commitRoot never returns a continuation; it always finishes synchronously.
|
30105 |
+
// So we can clear these now to allow a new callback to be scheduled.
|
|
|
|
|
|
|
|
|
|
|
|
|
30106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30107 |
|
30108 |
+
root.callbackNode = null; // Update the first and last pending times on this root. The new first
|
30109 |
+
// pending time is whatever is left on the root fiber.
|
30110 |
|
30111 |
+
var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes);
|
30112 |
+
markRootFinished(root, remainingLanes); // Clear already finished discrete updates in case that a later call of
|
30113 |
+
// `flushDiscreteUpdates` starts a useless render pass which may cancels
|
30114 |
+
// a scheduled timeout.
|
30115 |
|
30116 |
+
if (rootsWithPendingDiscreteUpdates !== null) {
|
30117 |
+
if (!hasDiscreteLanes(remainingLanes) && rootsWithPendingDiscreteUpdates.has(root)) {
|
30118 |
+
rootsWithPendingDiscreteUpdates.delete(root);
|
30119 |
}
|
30120 |
+
}
|
30121 |
|
30122 |
+
if (root === workInProgressRoot) {
|
30123 |
+
// We can reset these now that they are finished.
|
30124 |
+
workInProgressRoot = null;
|
30125 |
+
workInProgress = null;
|
30126 |
+
workInProgressRootRenderLanes = NoLanes;
|
30127 |
+
} // Get the list of effects.
|
|
|
|
|
30128 |
|
30129 |
|
30130 |
+
var firstEffect;
|
30131 |
+
|
30132 |
+
if (finishedWork.flags > PerformedWork) {
|
30133 |
+
// A fiber's effect list consists only of its children, not itself. So if
|
30134 |
+
// the root has an effect, we need to add it to the end of the list. The
|
30135 |
+
// resulting list is the set that would belong to the root's parent, if it
|
30136 |
+
// had one; that is, all the effects in the tree including the root.
|
30137 |
+
if (finishedWork.lastEffect !== null) {
|
30138 |
+
finishedWork.lastEffect.nextEffect = finishedWork;
|
30139 |
+
firstEffect = finishedWork.firstEffect;
|
30140 |
+
} else {
|
30141 |
+
firstEffect = finishedWork;
|
30142 |
+
}
|
30143 |
+
} else {
|
30144 |
+
// There is no effect on the root.
|
30145 |
+
firstEffect = finishedWork.firstEffect;
|
30146 |
}
|
30147 |
|
30148 |
+
if (firstEffect !== null) {
|
30149 |
|
30150 |
+
var prevExecutionContext = executionContext;
|
30151 |
+
executionContext |= CommitContext;
|
30152 |
+
var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles
|
|
|
|
|
30153 |
|
30154 |
+
ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass
|
30155 |
+
// of the effect list for each phase: all mutation effects come before all
|
30156 |
+
// layout effects, and so on.
|
30157 |
+
// The first phase a "before mutation" phase. We use this phase to read the
|
30158 |
+
// state of the host tree right before we mutate it. This is where
|
30159 |
+
// getSnapshotBeforeUpdate is called.
|
30160 |
+
|
30161 |
+
focusedInstanceHandle = prepareForCommit(root.containerInfo);
|
30162 |
+
shouldFireAfterActiveInstanceBlur = false;
|
30163 |
+
nextEffect = firstEffect;
|
30164 |
|
30165 |
+
do {
|
|
|
|
|
|
|
30166 |
{
|
30167 |
+
invokeGuardedCallback(null, commitBeforeMutationEffects, null);
|
30168 |
+
|
30169 |
+
if (hasCaughtError()) {
|
30170 |
+
if (!(nextEffect !== null)) {
|
30171 |
+
{
|
30172 |
+
throw Error( "Should be working on an effect." );
|
30173 |
+
}
|
30174 |
}
|
|
|
|
|
|
|
|
|
|
|
30175 |
|
30176 |
+
var error = clearCaughtError();
|
30177 |
+
captureCommitPhaseError(nextEffect, error);
|
30178 |
+
nextEffect = nextEffect.nextEffect;
|
30179 |
+
}
|
|
|
|
|
30180 |
}
|
30181 |
+
} while (nextEffect !== null); // We no longer need to track the active instance fiber
|
30182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30183 |
|
30184 |
+
focusedInstanceHandle = null;
|
|
|
30185 |
|
30186 |
+
{
|
30187 |
+
// Mark the current commit time to be shared by all Profilers in this
|
30188 |
+
// batch. This enables them to be grouped later.
|
30189 |
+
recordCommitTime();
|
30190 |
+
} // The next phase is the mutation phase, where we mutate the host tree.
|
30191 |
|
|
|
30192 |
|
30193 |
+
nextEffect = firstEffect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30194 |
|
30195 |
+
do {
|
30196 |
+
{
|
30197 |
+
invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
|
30198 |
|
30199 |
+
if (hasCaughtError()) {
|
30200 |
+
if (!(nextEffect !== null)) {
|
30201 |
+
{
|
30202 |
+
throw Error( "Should be working on an effect." );
|
30203 |
+
}
|
30204 |
}
|
|
|
30205 |
|
30206 |
+
var _error = clearCaughtError();
|
30207 |
|
30208 |
+
captureCommitPhaseError(nextEffect, _error);
|
30209 |
+
nextEffect = nextEffect.nextEffect;
|
30210 |
+
}
|
30211 |
}
|
30212 |
+
} while (nextEffect !== null);
|
30213 |
|
30214 |
+
resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after
|
30215 |
+
// the mutation phase, so that the previous tree is still current during
|
30216 |
+
// componentWillUnmount, but before the layout phase, so that the finished
|
30217 |
+
// work is current during componentDidMount/Update.
|
|
|
|
|
|
|
|
|
|
|
|
|
30218 |
|
30219 |
+
root.current = finishedWork; // The next phase is the layout phase, where we call effects that read
|
30220 |
+
// the host tree after it's been mutated. The idiomatic use case for this is
|
30221 |
+
// layout, but class component lifecycles also fire here for legacy reasons.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30222 |
|
30223 |
+
nextEffect = firstEffect;
|
30224 |
|
30225 |
+
do {
|
30226 |
+
{
|
30227 |
+
invokeGuardedCallback(null, commitLayoutEffects, null, root, lanes);
|
30228 |
|
30229 |
+
if (hasCaughtError()) {
|
30230 |
+
if (!(nextEffect !== null)) {
|
30231 |
+
{
|
30232 |
+
throw Error( "Should be working on an effect." );
|
30233 |
+
}
|
30234 |
}
|
|
|
30235 |
|
30236 |
+
var _error2 = clearCaughtError();
|
30237 |
|
30238 |
+
captureCommitPhaseError(nextEffect, _error2);
|
30239 |
+
nextEffect = nextEffect.nextEffect;
|
30240 |
+
}
|
30241 |
}
|
30242 |
+
} while (nextEffect !== null);
|
30243 |
|
30244 |
+
nextEffect = null; // Tell Scheduler to yield at the end of the frame, so the browser has an
|
30245 |
+
// opportunity to paint.
|
|
|
|
|
|
|
|
|
30246 |
|
30247 |
+
requestPaint();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30248 |
|
30249 |
+
{
|
30250 |
+
popInteractions(prevInteractions);
|
30251 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30252 |
|
30253 |
+
executionContext = prevExecutionContext;
|
30254 |
+
} else {
|
30255 |
+
// No effects.
|
30256 |
+
root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were
|
30257 |
+
// no effects.
|
30258 |
+
// TODO: Maybe there's a better way to report this.
|
30259 |
|
|
|
|
|
30260 |
{
|
30261 |
+
recordCommitTime();
|
30262 |
}
|
30263 |
}
|
30264 |
|
30265 |
+
var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
|
|
|
|
|
30266 |
|
30267 |
+
if (rootDoesHavePassiveEffects) {
|
30268 |
+
// This commit has passive effects. Stash a reference to them. But don't
|
30269 |
+
// schedule a callback until after flushing layout work.
|
30270 |
+
rootDoesHavePassiveEffects = false;
|
30271 |
+
rootWithPendingPassiveEffects = root;
|
30272 |
+
pendingPassiveEffectsLanes = lanes;
|
30273 |
+
pendingPassiveEffectsRenderPriority = renderPriorityLevel;
|
30274 |
+
} else {
|
30275 |
+
// We are done with the effect chain at this point so let's clear the
|
30276 |
+
// nextEffect pointers to assist with GC. If we have passive effects, we'll
|
30277 |
+
// clear this in flushPassiveEffects.
|
30278 |
+
nextEffect = firstEffect;
|
30279 |
|
30280 |
+
while (nextEffect !== null) {
|
30281 |
+
var nextNextEffect = nextEffect.nextEffect;
|
30282 |
+
nextEffect.nextEffect = null;
|
30283 |
+
|
30284 |
+
if (nextEffect.flags & Deletion) {
|
30285 |
+
detachFiberAfterEffects(nextEffect);
|
30286 |
+
}
|
30287 |
+
|
30288 |
+
nextEffect = nextNextEffect;
|
|
|
|
|
30289 |
}
|
30290 |
+
} // Read this again, since an effect might have updated it
|
|
|
|
|
|
|
30291 |
|
|
|
|
|
|
|
30292 |
|
30293 |
+
remainingLanes = root.pendingLanes; // Check if there's remaining work on this root
|
|
|
|
|
|
|
|
|
|
|
|
|
30294 |
|
30295 |
+
if (remainingLanes !== NoLanes) {
|
30296 |
+
{
|
30297 |
+
if (spawnedWorkDuringRender !== null) {
|
30298 |
+
var expirationTimes = spawnedWorkDuringRender;
|
30299 |
+
spawnedWorkDuringRender = null;
|
30300 |
|
30301 |
+
for (var i = 0; i < expirationTimes.length; i++) {
|
30302 |
+
scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions);
|
30303 |
+
}
|
30304 |
+
}
|
30305 |
|
30306 |
+
schedulePendingInteractions(root, remainingLanes);
|
|
|
30307 |
}
|
30308 |
+
} else {
|
30309 |
+
// If there's no remaining work, we can clear the set of already failed
|
30310 |
+
// error boundaries.
|
30311 |
+
legacyErrorBoundariesThatAlreadyFailed = null;
|
30312 |
}
|
30313 |
|
30314 |
+
{
|
30315 |
+
if (!rootDidHavePassiveEffects) {
|
30316 |
+
// If there are no passive effects, then we can complete the pending interactions.
|
30317 |
+
// Otherwise, we'll wait until after the passive effects are flushed.
|
30318 |
+
// Wait to do this until after remaining work has been scheduled,
|
30319 |
+
// so that we don't prematurely signal complete for interactions when there's e.g. hidden work.
|
30320 |
+
finishPendingInteractions(root, lanes);
|
30321 |
+
}
|
30322 |
+
}
|
30323 |
|
30324 |
+
if (remainingLanes === SyncLane) {
|
30325 |
+
// Count the number of times the root synchronously re-renders without
|
30326 |
+
// finishing. If there are too many, it indicates an infinite update loop.
|
30327 |
+
if (root === rootWithNestedUpdates) {
|
30328 |
+
nestedUpdateCount++;
|
30329 |
+
} else {
|
30330 |
+
nestedUpdateCount = 0;
|
30331 |
+
rootWithNestedUpdates = root;
|
30332 |
+
}
|
30333 |
+
} else {
|
30334 |
+
nestedUpdateCount = 0;
|
30335 |
+
}
|
30336 |
|
30337 |
+
onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
|
|
|
|
|
|
|
|
|
30338 |
|
30339 |
+
{
|
30340 |
+
onCommitRoot$1();
|
30341 |
+
} // Always call this before exiting `commitRoot`, to ensure that any
|
30342 |
+
// additional work on this root is scheduled.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30343 |
|
30344 |
|
30345 |
+
ensureRootIsScheduled(root, now());
|
30346 |
+
|
30347 |
+
if (hasUncaughtError) {
|
30348 |
+
hasUncaughtError = false;
|
30349 |
+
var _error3 = firstUncaughtError;
|
30350 |
+
firstUncaughtError = null;
|
30351 |
+
throw _error3;
|
30352 |
}
|
30353 |
|
30354 |
+
if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
|
30355 |
+
// a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
|
30356 |
+
// synchronously, but layout updates should be deferred until the end
|
30357 |
+
// of the batch.
|
30358 |
|
|
|
|
|
30359 |
|
30360 |
+
return null;
|
30361 |
+
} // If layout work was scheduled, flush it now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30362 |
|
30363 |
|
30364 |
flushSyncCallbackQueue();
|
30365 |
+
|
30366 |
+
return null;
|
30367 |
}
|
30368 |
|
30369 |
+
function commitBeforeMutationEffects() {
|
30370 |
+
while (nextEffect !== null) {
|
30371 |
+
var current = nextEffect.alternate;
|
30372 |
|
30373 |
+
if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {
|
30374 |
+
if ((nextEffect.flags & Deletion) !== NoFlags) {
|
30375 |
+
if (doesFiberContain(nextEffect, focusedInstanceHandle)) {
|
30376 |
+
shouldFireAfterActiveInstanceBlur = true;
|
30377 |
+
}
|
30378 |
+
} else {
|
30379 |
+
// TODO: Move this out of the hot path using a dedicated effect tag.
|
30380 |
+
if (nextEffect.tag === SuspenseComponent && isSuspenseBoundaryBeingHidden(current, nextEffect) && doesFiberContain(nextEffect, focusedInstanceHandle)) {
|
30381 |
+
shouldFireAfterActiveInstanceBlur = true;
|
30382 |
+
}
|
30383 |
+
}
|
30384 |
+
}
|
30385 |
|
30386 |
+
var flags = nextEffect.flags;
|
30387 |
+
|
30388 |
+
if ((flags & Snapshot) !== NoFlags) {
|
30389 |
+
setCurrentFiber(nextEffect);
|
30390 |
+
commitBeforeMutationLifeCycles(current, nextEffect);
|
30391 |
+
resetCurrentFiber();
|
30392 |
+
}
|
30393 |
+
|
30394 |
+
if ((flags & Passive) !== NoFlags) {
|
30395 |
+
// If there are passive effects, schedule a callback to flush at
|
30396 |
+
// the earliest opportunity.
|
30397 |
+
if (!rootDoesHavePassiveEffects) {
|
30398 |
+
rootDoesHavePassiveEffects = true;
|
30399 |
+
scheduleCallback(NormalPriority$1, function () {
|
30400 |
+
flushPassiveEffects();
|
30401 |
+
return null;
|
30402 |
+
});
|
30403 |
+
}
|
30404 |
}
|
30405 |
+
|
30406 |
+
nextEffect = nextEffect.nextEffect;
|
30407 |
}
|
30408 |
}
|
|
|
|
|
|
|
30409 |
|
30410 |
+
function commitMutationEffects(root, renderPriorityLevel) {
|
30411 |
+
// TODO: Should probably move the bulk of this function to commitWork.
|
30412 |
+
while (nextEffect !== null) {
|
30413 |
+
setCurrentFiber(nextEffect);
|
30414 |
+
var flags = nextEffect.flags;
|
30415 |
|
30416 |
+
if (flags & ContentReset) {
|
30417 |
+
commitResetTextContent(nextEffect);
|
|
|
|
|
30418 |
}
|
|
|
|
|
|
|
|
|
|
|
30419 |
|
30420 |
+
if (flags & Ref) {
|
30421 |
+
var current = nextEffect.alternate;
|
|
|
|
|
|
|
30422 |
|
30423 |
+
if (current !== null) {
|
30424 |
+
commitDetachRef(current);
|
|
|
|
|
30425 |
}
|
30426 |
+
} // The following switch statement is only concerned about placement,
|
30427 |
+
// updates, and deletions. To avoid needing to add a case for every possible
|
30428 |
+
// bitmap value, we remove the secondary effects from the effect tag and
|
30429 |
+
// switch on that value.
|
30430 |
+
|
30431 |
+
|
30432 |
+
var primaryFlags = flags & (Placement | Update | Deletion | Hydrating);
|
30433 |
+
|
30434 |
+
switch (primaryFlags) {
|
30435 |
+
case Placement:
|
30436 |
+
{
|
30437 |
+
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
30438 |
+
// inserted, before any life-cycles like componentDidMount gets called.
|
30439 |
+
// TODO: findDOMNode doesn't rely on this any more but isMounted does
|
30440 |
+
// and isMounted is deprecated anyway so we should be able to kill this.
|
30441 |
+
|
30442 |
+
nextEffect.flags &= ~Placement;
|
30443 |
+
break;
|
30444 |
+
}
|
30445 |
+
|
30446 |
+
case PlacementAndUpdate:
|
30447 |
+
{
|
30448 |
+
// Placement
|
30449 |
+
commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
|
30450 |
+
// inserted, before any life-cycles like componentDidMount gets called.
|
30451 |
+
|
30452 |
+
nextEffect.flags &= ~Placement; // Update
|
30453 |
+
|
30454 |
+
var _current = nextEffect.alternate;
|
30455 |
+
commitWork(_current, nextEffect);
|
30456 |
+
break;
|
30457 |
+
}
|
30458 |
+
|
30459 |
+
case Hydrating:
|
30460 |
+
{
|
30461 |
+
nextEffect.flags &= ~Hydrating;
|
30462 |
+
break;
|
30463 |
+
}
|
30464 |
+
|
30465 |
+
case HydratingAndUpdate:
|
30466 |
+
{
|
30467 |
+
nextEffect.flags &= ~Hydrating; // Update
|
30468 |
+
|
30469 |
+
var _current2 = nextEffect.alternate;
|
30470 |
+
commitWork(_current2, nextEffect);
|
30471 |
+
break;
|
30472 |
+
}
|
30473 |
+
|
30474 |
+
case Update:
|
30475 |
+
{
|
30476 |
+
var _current3 = nextEffect.alternate;
|
30477 |
+
commitWork(_current3, nextEffect);
|
30478 |
+
break;
|
30479 |
+
}
|
30480 |
+
|
30481 |
+
case Deletion:
|
30482 |
+
{
|
30483 |
+
commitDeletion(root, nextEffect);
|
30484 |
+
break;
|
30485 |
+
}
|
30486 |
}
|
30487 |
+
|
30488 |
+
resetCurrentFiber();
|
30489 |
+
nextEffect = nextEffect.nextEffect;
|
30490 |
}
|
30491 |
}
|
|
|
|
|
|
|
|
|
30492 |
|
|
|
|
|
|
|
|