@khanacademy/wonder-blocks-modal 2.2.3 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dist/es/index.js +92 -351
- package/dist/index.js +1395 -26
- package/package.json +9 -9
- package/src/components/__tests__/modal-backdrop.test.js +0 -4
- package/src/components/__tests__/modal-launcher.test.js +134 -38
- package/src/components/modal-launcher.js +56 -6
- package/src/components/one-pane-dialog.stories.js +48 -2
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 26);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ([
|
|
@@ -477,7 +477,7 @@ const styleSheets = {
|
|
|
477
477
|
/* harmony import */ var _modal_content_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(14);
|
|
478
478
|
/* harmony import */ var _modal_header_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7);
|
|
479
479
|
/* harmony import */ var _modal_footer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8);
|
|
480
|
-
/* harmony import */ var _close_button_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(
|
|
480
|
+
/* harmony import */ var _close_button_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(23);
|
|
481
481
|
|
|
482
482
|
|
|
483
483
|
|
|
@@ -702,17 +702,19 @@ const styleSheets = {
|
|
|
702
702
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
703
703
|
|
|
704
704
|
"use strict";
|
|
705
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModalLauncher; });
|
|
706
705
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
707
706
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
708
707
|
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
|
709
708
|
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
|
|
710
709
|
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
|
711
710
|
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_2__);
|
|
712
|
-
/* harmony import */ var
|
|
713
|
-
/* harmony import */ var
|
|
714
|
-
/* harmony import */ var
|
|
715
|
-
/* harmony import */ var
|
|
711
|
+
/* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18);
|
|
712
|
+
/* harmony import */ var _khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3__);
|
|
713
|
+
/* harmony import */ var _focus_trap_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(19);
|
|
714
|
+
/* harmony import */ var _modal_backdrop_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(20);
|
|
715
|
+
/* harmony import */ var _scroll_disabler_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(22);
|
|
716
|
+
/* harmony import */ var _modal_context_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(12);
|
|
717
|
+
|
|
716
718
|
|
|
717
719
|
|
|
718
720
|
|
|
@@ -757,16 +759,45 @@ class ModalLauncher extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
757
759
|
});
|
|
758
760
|
};
|
|
759
761
|
|
|
762
|
+
this._returnFocus = () => {
|
|
763
|
+
const {
|
|
764
|
+
closedFocusId,
|
|
765
|
+
schedule
|
|
766
|
+
} = this.props;
|
|
767
|
+
const lastElement = this.lastElementFocusedOutsideModal; // Focus on the specified element after closing the modal.
|
|
768
|
+
|
|
769
|
+
if (closedFocusId) {
|
|
770
|
+
const focusElement = react_dom__WEBPACK_IMPORTED_MODULE_1__["findDOMNode"](document.getElementById(closedFocusId));
|
|
771
|
+
|
|
772
|
+
if (focusElement) {
|
|
773
|
+
// Wait for the modal to leave the DOM before trying
|
|
774
|
+
// to focus on the specified element.
|
|
775
|
+
schedule.animationFrame(() => {
|
|
776
|
+
focusElement.focus();
|
|
777
|
+
});
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
if (lastElement != null) {
|
|
783
|
+
// Wait for the modal to leave the DOM before trying to
|
|
784
|
+
// return focus to the element that triggered the modal.
|
|
785
|
+
schedule.animationFrame(() => {
|
|
786
|
+
lastElement.focus();
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
|
|
760
791
|
this.handleCloseModal = () => {
|
|
761
792
|
this.setState({
|
|
762
793
|
opened: false
|
|
763
794
|
}, () => {
|
|
764
|
-
|
|
795
|
+
const {
|
|
796
|
+
onClose
|
|
797
|
+
} = this.props;
|
|
798
|
+
onClose && onClose();
|
|
765
799
|
|
|
766
|
-
|
|
767
|
-
// return focus to the element that triggered the modal
|
|
768
|
-
this.lastElementFocusedOutsideModal.focus();
|
|
769
|
-
}
|
|
800
|
+
this._returnFocus();
|
|
770
801
|
});
|
|
771
802
|
};
|
|
772
803
|
}
|
|
@@ -826,7 +857,7 @@ class ModalLauncher extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
826
857
|
// This flow check is valid, it's the babel plugin which is broken,
|
|
827
858
|
// see modal-context.js for details.
|
|
828
859
|
// $FlowFixMe
|
|
829
|
-
react__WEBPACK_IMPORTED_MODULE_0__["createElement"](
|
|
860
|
+
react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_modal_context_js__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"].Provider, {
|
|
830
861
|
value: {
|
|
831
862
|
closeModal: this.handleCloseModal
|
|
832
863
|
}
|
|
@@ -835,21 +866,22 @@ class ModalLauncher extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
835
866
|
|
|
836
867
|
/* We need the container View that FocusTrap creates to be at the
|
|
837
868
|
correct z-index so that it'll be above the global nav in webapp. */
|
|
838
|
-
react__WEBPACK_IMPORTED_MODULE_0__["createElement"](
|
|
869
|
+
react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_focus_trap_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"], {
|
|
839
870
|
style: styles.container
|
|
840
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](
|
|
871
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_modal_backdrop_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], {
|
|
841
872
|
initialFocusId: this.props.initialFocusId,
|
|
842
873
|
testId: this.props.testId,
|
|
843
874
|
onCloseModal: this.props.backdropDismissEnabled ? this.handleCloseModal : () => {}
|
|
844
875
|
}, this._renderModal())), body), this.state.opened && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](ModalLauncherKeypressListener, {
|
|
845
876
|
onClose: this.handleCloseModal
|
|
846
|
-
}), this.state.opened && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](
|
|
877
|
+
}), this.state.opened && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_scroll_disabler_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], null))
|
|
847
878
|
);
|
|
848
879
|
}
|
|
849
880
|
|
|
850
881
|
}
|
|
851
882
|
/** A component that, when mounted, calls `onClose` when Escape is pressed. */
|
|
852
883
|
|
|
884
|
+
|
|
853
885
|
ModalLauncher.defaultProps = {
|
|
854
886
|
backdropDismissEnabled: true
|
|
855
887
|
};
|
|
@@ -900,6 +932,7 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
|
|
|
900
932
|
zIndex: 1080
|
|
901
933
|
}
|
|
902
934
|
});
|
|
935
|
+
/* harmony default export */ __webpack_exports__["a"] = (Object(_khanacademy_wonder_blocks_timing__WEBPACK_IMPORTED_MODULE_3__["withActionScheduler"])(ModalLauncher));
|
|
903
936
|
|
|
904
937
|
/***/ }),
|
|
905
938
|
/* 16 */
|
|
@@ -1064,6 +1097,1342 @@ function maybeGetPortalMountedModalHostElement(element) {
|
|
|
1064
1097
|
|
|
1065
1098
|
/***/ }),
|
|
1066
1099
|
/* 18 */
|
|
1100
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1101
|
+
|
|
1102
|
+
module.exports =
|
|
1103
|
+
/******/
|
|
1104
|
+
function (modules) {
|
|
1105
|
+
// webpackBootstrap
|
|
1106
|
+
|
|
1107
|
+
/******/
|
|
1108
|
+
// The module cache
|
|
1109
|
+
|
|
1110
|
+
/******/
|
|
1111
|
+
var installedModules = {};
|
|
1112
|
+
/******/
|
|
1113
|
+
|
|
1114
|
+
/******/
|
|
1115
|
+
// The require function
|
|
1116
|
+
|
|
1117
|
+
/******/
|
|
1118
|
+
|
|
1119
|
+
function __webpack_require__(moduleId) {
|
|
1120
|
+
/******/
|
|
1121
|
+
|
|
1122
|
+
/******/
|
|
1123
|
+
// Check if module is in cache
|
|
1124
|
+
|
|
1125
|
+
/******/
|
|
1126
|
+
if (installedModules[moduleId]) {
|
|
1127
|
+
/******/
|
|
1128
|
+
return installedModules[moduleId].exports;
|
|
1129
|
+
/******/
|
|
1130
|
+
}
|
|
1131
|
+
/******/
|
|
1132
|
+
// Create a new module (and put it into the cache)
|
|
1133
|
+
|
|
1134
|
+
/******/
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
var module = installedModules[moduleId] = {
|
|
1138
|
+
/******/
|
|
1139
|
+
i: moduleId,
|
|
1140
|
+
|
|
1141
|
+
/******/
|
|
1142
|
+
l: false,
|
|
1143
|
+
|
|
1144
|
+
/******/
|
|
1145
|
+
exports: {}
|
|
1146
|
+
/******/
|
|
1147
|
+
|
|
1148
|
+
};
|
|
1149
|
+
/******/
|
|
1150
|
+
|
|
1151
|
+
/******/
|
|
1152
|
+
// Execute the module function
|
|
1153
|
+
|
|
1154
|
+
/******/
|
|
1155
|
+
|
|
1156
|
+
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
1157
|
+
/******/
|
|
1158
|
+
|
|
1159
|
+
/******/
|
|
1160
|
+
// Flag the module as loaded
|
|
1161
|
+
|
|
1162
|
+
/******/
|
|
1163
|
+
|
|
1164
|
+
module.l = true;
|
|
1165
|
+
/******/
|
|
1166
|
+
|
|
1167
|
+
/******/
|
|
1168
|
+
// Return the exports of the module
|
|
1169
|
+
|
|
1170
|
+
/******/
|
|
1171
|
+
|
|
1172
|
+
return module.exports;
|
|
1173
|
+
/******/
|
|
1174
|
+
}
|
|
1175
|
+
/******/
|
|
1176
|
+
|
|
1177
|
+
/******/
|
|
1178
|
+
|
|
1179
|
+
/******/
|
|
1180
|
+
// expose the modules object (__webpack_modules__)
|
|
1181
|
+
|
|
1182
|
+
/******/
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
__webpack_require__.m = modules;
|
|
1186
|
+
/******/
|
|
1187
|
+
|
|
1188
|
+
/******/
|
|
1189
|
+
// expose the module cache
|
|
1190
|
+
|
|
1191
|
+
/******/
|
|
1192
|
+
|
|
1193
|
+
__webpack_require__.c = installedModules;
|
|
1194
|
+
/******/
|
|
1195
|
+
|
|
1196
|
+
/******/
|
|
1197
|
+
// define getter function for harmony exports
|
|
1198
|
+
|
|
1199
|
+
/******/
|
|
1200
|
+
|
|
1201
|
+
__webpack_require__.d = function (exports, name, getter) {
|
|
1202
|
+
/******/
|
|
1203
|
+
if (!__webpack_require__.o(exports, name)) {
|
|
1204
|
+
/******/
|
|
1205
|
+
Object.defineProperty(exports, name, {
|
|
1206
|
+
enumerable: true,
|
|
1207
|
+
get: getter
|
|
1208
|
+
});
|
|
1209
|
+
/******/
|
|
1210
|
+
}
|
|
1211
|
+
/******/
|
|
1212
|
+
|
|
1213
|
+
};
|
|
1214
|
+
/******/
|
|
1215
|
+
|
|
1216
|
+
/******/
|
|
1217
|
+
// define __esModule on exports
|
|
1218
|
+
|
|
1219
|
+
/******/
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
__webpack_require__.r = function (exports) {
|
|
1223
|
+
/******/
|
|
1224
|
+
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
1225
|
+
/******/
|
|
1226
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
1227
|
+
value: 'Module'
|
|
1228
|
+
});
|
|
1229
|
+
/******/
|
|
1230
|
+
}
|
|
1231
|
+
/******/
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
Object.defineProperty(exports, '__esModule', {
|
|
1235
|
+
value: true
|
|
1236
|
+
});
|
|
1237
|
+
/******/
|
|
1238
|
+
};
|
|
1239
|
+
/******/
|
|
1240
|
+
|
|
1241
|
+
/******/
|
|
1242
|
+
// create a fake namespace object
|
|
1243
|
+
|
|
1244
|
+
/******/
|
|
1245
|
+
// mode & 1: value is a module id, require it
|
|
1246
|
+
|
|
1247
|
+
/******/
|
|
1248
|
+
// mode & 2: merge all properties of value into the ns
|
|
1249
|
+
|
|
1250
|
+
/******/
|
|
1251
|
+
// mode & 4: return value when already ns object
|
|
1252
|
+
|
|
1253
|
+
/******/
|
|
1254
|
+
// mode & 8|1: behave like require
|
|
1255
|
+
|
|
1256
|
+
/******/
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
__webpack_require__.t = function (value, mode) {
|
|
1260
|
+
/******/
|
|
1261
|
+
if (mode & 1) value = __webpack_require__(value);
|
|
1262
|
+
/******/
|
|
1263
|
+
|
|
1264
|
+
if (mode & 8) return value;
|
|
1265
|
+
/******/
|
|
1266
|
+
|
|
1267
|
+
if (mode & 4 && typeof value === 'object' && value && value.__esModule) return value;
|
|
1268
|
+
/******/
|
|
1269
|
+
|
|
1270
|
+
var ns = Object.create(null);
|
|
1271
|
+
/******/
|
|
1272
|
+
|
|
1273
|
+
__webpack_require__.r(ns);
|
|
1274
|
+
/******/
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
Object.defineProperty(ns, 'default', {
|
|
1278
|
+
enumerable: true,
|
|
1279
|
+
value: value
|
|
1280
|
+
});
|
|
1281
|
+
/******/
|
|
1282
|
+
|
|
1283
|
+
if (mode & 2 && typeof value != 'string') for (var key in value) __webpack_require__.d(ns, key, function (key) {
|
|
1284
|
+
return value[key];
|
|
1285
|
+
}.bind(null, key));
|
|
1286
|
+
/******/
|
|
1287
|
+
|
|
1288
|
+
return ns;
|
|
1289
|
+
/******/
|
|
1290
|
+
};
|
|
1291
|
+
/******/
|
|
1292
|
+
|
|
1293
|
+
/******/
|
|
1294
|
+
// getDefaultExport function for compatibility with non-harmony modules
|
|
1295
|
+
|
|
1296
|
+
/******/
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
__webpack_require__.n = function (module) {
|
|
1300
|
+
/******/
|
|
1301
|
+
var getter = module && module.__esModule ?
|
|
1302
|
+
/******/
|
|
1303
|
+
function getDefault() {
|
|
1304
|
+
return module['default'];
|
|
1305
|
+
} :
|
|
1306
|
+
/******/
|
|
1307
|
+
function getModuleExports() {
|
|
1308
|
+
return module;
|
|
1309
|
+
};
|
|
1310
|
+
/******/
|
|
1311
|
+
|
|
1312
|
+
__webpack_require__.d(getter, 'a', getter);
|
|
1313
|
+
/******/
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
return getter;
|
|
1317
|
+
/******/
|
|
1318
|
+
};
|
|
1319
|
+
/******/
|
|
1320
|
+
|
|
1321
|
+
/******/
|
|
1322
|
+
// Object.prototype.hasOwnProperty.call
|
|
1323
|
+
|
|
1324
|
+
/******/
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
__webpack_require__.o = function (object, property) {
|
|
1328
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
|
1329
|
+
};
|
|
1330
|
+
/******/
|
|
1331
|
+
|
|
1332
|
+
/******/
|
|
1333
|
+
// __webpack_public_path__
|
|
1334
|
+
|
|
1335
|
+
/******/
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
__webpack_require__.p = "";
|
|
1339
|
+
/******/
|
|
1340
|
+
|
|
1341
|
+
/******/
|
|
1342
|
+
|
|
1343
|
+
/******/
|
|
1344
|
+
// Load entry module and return exports
|
|
1345
|
+
|
|
1346
|
+
/******/
|
|
1347
|
+
|
|
1348
|
+
return __webpack_require__(__webpack_require__.s = 13);
|
|
1349
|
+
/******/
|
|
1350
|
+
}
|
|
1351
|
+
/************************************************************************/
|
|
1352
|
+
|
|
1353
|
+
/******/
|
|
1354
|
+
([
|
|
1355
|
+
/* 0 */
|
|
1356
|
+
|
|
1357
|
+
/***/
|
|
1358
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1359
|
+
"use strict";
|
|
1360
|
+
/* harmony export (binding) */
|
|
1361
|
+
|
|
1362
|
+
__webpack_require__.d(__webpack_exports__, "b", function () {
|
|
1363
|
+
return SchedulePolicy;
|
|
1364
|
+
});
|
|
1365
|
+
/* harmony export (binding) */
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1369
|
+
return ClearPolicy;
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
const SchedulePolicy = {
|
|
1373
|
+
Immediately: "schedule-immediately",
|
|
1374
|
+
OnDemand: "schedule-on-demand"
|
|
1375
|
+
};
|
|
1376
|
+
const ClearPolicy = {
|
|
1377
|
+
Resolve: "resolve-on-clear",
|
|
1378
|
+
Cancel: "cancel-on-clear"
|
|
1379
|
+
};
|
|
1380
|
+
/***/
|
|
1381
|
+
},
|
|
1382
|
+
/* 1 */
|
|
1383
|
+
|
|
1384
|
+
/***/
|
|
1385
|
+
function (module, exports) {
|
|
1386
|
+
module.exports = __webpack_require__(0);
|
|
1387
|
+
/***/
|
|
1388
|
+
},
|
|
1389
|
+
/* 2 */
|
|
1390
|
+
|
|
1391
|
+
/***/
|
|
1392
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1393
|
+
"use strict";
|
|
1394
|
+
/* harmony export (binding) */
|
|
1395
|
+
|
|
1396
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1397
|
+
return useUpdatingRef;
|
|
1398
|
+
});
|
|
1399
|
+
/* harmony import */
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
1403
|
+
/* harmony import */
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1407
|
+
/**
|
|
1408
|
+
* Returns a ref whose .current value is updated whenever
|
|
1409
|
+
* the `value` passed to this hook changes.
|
|
1410
|
+
*
|
|
1411
|
+
* this is great for values that you want to reference from
|
|
1412
|
+
* within a useCallback or useEffect event listener, without
|
|
1413
|
+
* re-triggering the effect when the value changes
|
|
1414
|
+
*
|
|
1415
|
+
* @returns {{current: T}}
|
|
1416
|
+
*/
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
const useUpdatingRef = value => {
|
|
1420
|
+
const ref = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(value);
|
|
1421
|
+
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
|
|
1422
|
+
ref.current = value;
|
|
1423
|
+
}, [value]);
|
|
1424
|
+
return ref;
|
|
1425
|
+
};
|
|
1426
|
+
/***/
|
|
1427
|
+
|
|
1428
|
+
},
|
|
1429
|
+
/* 3 */
|
|
1430
|
+
|
|
1431
|
+
/***/
|
|
1432
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1433
|
+
"use strict";
|
|
1434
|
+
/* harmony export (binding) */
|
|
1435
|
+
|
|
1436
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1437
|
+
return useInterval;
|
|
1438
|
+
});
|
|
1439
|
+
/* harmony import */
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
1443
|
+
/* harmony import */
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1447
|
+
/* harmony import */
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
var _internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
1451
|
+
/**
|
|
1452
|
+
* A simple hook for using `setInterval`.
|
|
1453
|
+
*
|
|
1454
|
+
* @param action called every `intervalMs` when `active` is true
|
|
1455
|
+
* @param intervalMs the duration between calls to `action`
|
|
1456
|
+
* @param active whether or not the interval is active
|
|
1457
|
+
*/
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
function useInterval(action, intervalMs, active) {
|
|
1461
|
+
// We using a ref instead of a callback for `action` to avoid resetting
|
|
1462
|
+
// the interval whenever the `action` changes.
|
|
1463
|
+
const actionRef = Object(_internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1464
|
+
/* useUpdatingRef */
|
|
1465
|
+
"a"])(action);
|
|
1466
|
+
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
|
|
1467
|
+
if (active) {
|
|
1468
|
+
const intervalId = setInterval(() => {
|
|
1469
|
+
actionRef.current();
|
|
1470
|
+
}, intervalMs);
|
|
1471
|
+
return () => {
|
|
1472
|
+
clearInterval(intervalId);
|
|
1473
|
+
};
|
|
1474
|
+
} // actionRef isn't actually required, but react-hooks/exhaustive-deps
|
|
1475
|
+
// doesn't recognize it as a ref and thus complains if it isn't in the
|
|
1476
|
+
// deps list. It isn't a big deal though since the value ofactionRef
|
|
1477
|
+
// never changes (only its contents do).
|
|
1478
|
+
|
|
1479
|
+
}, [intervalMs, active, actionRef]);
|
|
1480
|
+
}
|
|
1481
|
+
/***/
|
|
1482
|
+
|
|
1483
|
+
},
|
|
1484
|
+
/* 4 */
|
|
1485
|
+
|
|
1486
|
+
/***/
|
|
1487
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1488
|
+
"use strict";
|
|
1489
|
+
/* harmony export (binding) */
|
|
1490
|
+
|
|
1491
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1492
|
+
return useTimeout;
|
|
1493
|
+
});
|
|
1494
|
+
/* harmony import */
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
1498
|
+
/* harmony import */
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1502
|
+
/* harmony import */
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
var _internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
1506
|
+
/**
|
|
1507
|
+
* A simple hook for using `setTimeout`.
|
|
1508
|
+
*
|
|
1509
|
+
* @param action called after `timeoutMs` when `active` is true
|
|
1510
|
+
* @param timeoutMs the duration after which `action` is called
|
|
1511
|
+
* @param active whether or not the interval is active
|
|
1512
|
+
*/
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
function useTimeout(action, timeoutMs, active) {
|
|
1516
|
+
// We using a ref instead of a callback for `action` to avoid resetting
|
|
1517
|
+
// the interval whenever the `action` changes.
|
|
1518
|
+
const actionRef = Object(_internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1519
|
+
/* useUpdatingRef */
|
|
1520
|
+
"a"])(action);
|
|
1521
|
+
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
|
|
1522
|
+
if (active) {
|
|
1523
|
+
const timeoutId = setTimeout(() => {
|
|
1524
|
+
actionRef.current();
|
|
1525
|
+
}, timeoutMs);
|
|
1526
|
+
return () => {
|
|
1527
|
+
clearTimeout(timeoutId);
|
|
1528
|
+
};
|
|
1529
|
+
} // actionRef isn't actually required, but react-hooks/exhaustive-deps
|
|
1530
|
+
// doesn't recognize it as a ref and thus complains if it isn't in the
|
|
1531
|
+
// deps list. It isn't a big deal though since the value ofactionRef
|
|
1532
|
+
// never changes (only its contents do).
|
|
1533
|
+
|
|
1534
|
+
}, [timeoutMs, active, actionRef]);
|
|
1535
|
+
}
|
|
1536
|
+
/***/
|
|
1537
|
+
|
|
1538
|
+
},
|
|
1539
|
+
/* 5 */
|
|
1540
|
+
|
|
1541
|
+
/***/
|
|
1542
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1543
|
+
"use strict";
|
|
1544
|
+
/* harmony export (binding) */
|
|
1545
|
+
|
|
1546
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1547
|
+
return withActionScheduler;
|
|
1548
|
+
});
|
|
1549
|
+
/* harmony import */
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
1553
|
+
/* harmony import */
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1557
|
+
/* harmony import */
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
var _action_scheduler_provider_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
|
|
1561
|
+
|
|
1562
|
+
function _extends() {
|
|
1563
|
+
_extends = Object.assign || function (target) {
|
|
1564
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1565
|
+
var source = arguments[i];
|
|
1566
|
+
|
|
1567
|
+
for (var key in source) {
|
|
1568
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1569
|
+
target[key] = source[key];
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
return target;
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
return _extends.apply(this, arguments);
|
|
1578
|
+
}
|
|
1579
|
+
/**
|
|
1580
|
+
* A higher order component that attaches the given component to an
|
|
1581
|
+
* `IScheduleActions` instance. Any actions scheduled will automatically be
|
|
1582
|
+
* cleared on unmount.
|
|
1583
|
+
*
|
|
1584
|
+
* @template TOwnProps The own props of the component being rendered, without
|
|
1585
|
+
* the additional action scheduler prop. To attach the additional prop to
|
|
1586
|
+
* these props use the `WithActionScheduler` type.
|
|
1587
|
+
*/
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
function withActionScheduler(WrappedComponent) {
|
|
1591
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["forwardRef"]((props, ref) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_action_scheduler_provider_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1592
|
+
/* default */
|
|
1593
|
+
"a"], null, schedule => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](WrappedComponent, _extends({}, props, {
|
|
1594
|
+
ref: ref,
|
|
1595
|
+
schedule: schedule
|
|
1596
|
+
}))));
|
|
1597
|
+
}
|
|
1598
|
+
/***/
|
|
1599
|
+
|
|
1600
|
+
},
|
|
1601
|
+
/* 6 */
|
|
1602
|
+
|
|
1603
|
+
/***/
|
|
1604
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1605
|
+
"use strict";
|
|
1606
|
+
/* harmony export (binding) */
|
|
1607
|
+
|
|
1608
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1609
|
+
return useScheduledInterval;
|
|
1610
|
+
});
|
|
1611
|
+
/* harmony import */
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
1615
|
+
/* harmony import */
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1619
|
+
/* harmony import */
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
var _util_policies_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
|
1623
|
+
/* harmony import */
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
var _internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
1627
|
+
/* harmony import */
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
var _use_interval_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
|
|
1631
|
+
|
|
1632
|
+
function useScheduledInterval(action, intervalMs, options) {
|
|
1633
|
+
var _options$schedulePoli;
|
|
1634
|
+
|
|
1635
|
+
if (typeof action !== "function") {
|
|
1636
|
+
throw new Error("Action must be a function");
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
if (intervalMs < 1) {
|
|
1640
|
+
throw new Error("Interval period must be >= 1");
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
const schedulePolicy = (_options$schedulePoli = options == null ? void 0 : options.schedulePolicy) != null ? _options$schedulePoli : _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1644
|
+
/* SchedulePolicy */
|
|
1645
|
+
"b"].Immediately;
|
|
1646
|
+
const [isSet, setIsSet] = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(schedulePolicy === _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1647
|
+
/* SchedulePolicy */
|
|
1648
|
+
"b"].Immediately);
|
|
1649
|
+
const set = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(() => setIsSet(true), []);
|
|
1650
|
+
const actionRef = Object(_internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
1651
|
+
/* useUpdatingRef */
|
|
1652
|
+
"a"])(action);
|
|
1653
|
+
const clear = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(policy => {
|
|
1654
|
+
var _policy;
|
|
1655
|
+
|
|
1656
|
+
policy = (_policy = policy) != null ? _policy : options == null ? void 0 : options.clearPolicy;
|
|
1657
|
+
|
|
1658
|
+
if (isSet && policy === _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1659
|
+
/* ClearPolicy */
|
|
1660
|
+
"a"].Resolve) {
|
|
1661
|
+
actionRef.current();
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
setIsSet(false);
|
|
1665
|
+
}, // react-hooks/exhaustive-deps doesn't require refs to be
|
|
1666
|
+
// listed in the deps array. Unfortunately, in this situation
|
|
1667
|
+
// it doesn't recognized actionRef as a ref.
|
|
1668
|
+
[actionRef, isSet, options == null ? void 0 : options.clearPolicy]);
|
|
1669
|
+
const runOnUnmountRef = Object(_internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
1670
|
+
/* useUpdatingRef */
|
|
1671
|
+
"a"])(isSet && (options == null ? void 0 : options.clearPolicy) === _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1672
|
+
/* ClearPolicy */
|
|
1673
|
+
"a"].Resolve);
|
|
1674
|
+
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
|
|
1675
|
+
return () => {
|
|
1676
|
+
// This code will only run with the component using this
|
|
1677
|
+
// hook is unmounted.
|
|
1678
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1679
|
+
if (runOnUnmountRef.current) {
|
|
1680
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1681
|
+
actionRef.current();
|
|
1682
|
+
}
|
|
1683
|
+
}; // This eslint rule doesn't realize actionRef and runOnUnmountRef
|
|
1684
|
+
// a both refs and thus do not have to be listed as deps.
|
|
1685
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1686
|
+
}, []);
|
|
1687
|
+
Object(_use_interval_js__WEBPACK_IMPORTED_MODULE_3__[
|
|
1688
|
+
/* useInterval */
|
|
1689
|
+
"a"])(action, intervalMs, isSet);
|
|
1690
|
+
return {
|
|
1691
|
+
isSet,
|
|
1692
|
+
set,
|
|
1693
|
+
clear
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
/***/
|
|
1697
|
+
|
|
1698
|
+
},
|
|
1699
|
+
/* 7 */
|
|
1700
|
+
|
|
1701
|
+
/***/
|
|
1702
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1703
|
+
"use strict";
|
|
1704
|
+
/* harmony export (binding) */
|
|
1705
|
+
|
|
1706
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1707
|
+
return useScheduledTimeout;
|
|
1708
|
+
});
|
|
1709
|
+
/* harmony import */
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
1713
|
+
/* harmony import */
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1717
|
+
/* harmony import */
|
|
1718
|
+
|
|
1719
|
+
|
|
1720
|
+
var _util_policies_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0);
|
|
1721
|
+
/* harmony import */
|
|
1722
|
+
|
|
1723
|
+
|
|
1724
|
+
var _internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
1725
|
+
/* harmony import */
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
var _use_timeout_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
|
|
1729
|
+
|
|
1730
|
+
function useScheduledTimeout(action, timeoutMs, options) {
|
|
1731
|
+
var _options$schedulePoli;
|
|
1732
|
+
|
|
1733
|
+
if (typeof action !== "function") {
|
|
1734
|
+
throw new Error("Action must be a function");
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
if (timeoutMs < 0) {
|
|
1738
|
+
throw new Error("Timeout period must be >= 0");
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
const schedulePolicy = (_options$schedulePoli = options == null ? void 0 : options.schedulePolicy) != null ? _options$schedulePoli : _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1742
|
+
/* SchedulePolicy */
|
|
1743
|
+
"b"].Immediately;
|
|
1744
|
+
const [isSet, setIsSet] = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(schedulePolicy === _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1745
|
+
/* SchedulePolicy */
|
|
1746
|
+
"b"].Immediately);
|
|
1747
|
+
const set = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(() => setIsSet(true), []); // This wrapper isn't present in useScheduledInterval because we
|
|
1748
|
+
// don't need to update `isSet` in that situations.
|
|
1749
|
+
|
|
1750
|
+
const wrappedAction = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(() => {
|
|
1751
|
+
setIsSet(false);
|
|
1752
|
+
action();
|
|
1753
|
+
}, [action]);
|
|
1754
|
+
const actionRef = Object(_internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
1755
|
+
/* useUpdatingRef */
|
|
1756
|
+
"a"])(wrappedAction);
|
|
1757
|
+
const clear = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(policy => {
|
|
1758
|
+
var _policy;
|
|
1759
|
+
|
|
1760
|
+
policy = (_policy = policy) != null ? _policy : options == null ? void 0 : options.clearPolicy;
|
|
1761
|
+
|
|
1762
|
+
if (isSet && policy === _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1763
|
+
/* ClearPolicy */
|
|
1764
|
+
"a"].Resolve) {
|
|
1765
|
+
actionRef.current();
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
setIsSet(false);
|
|
1769
|
+
}, // react-hooks/exhaustive-deps doesn't require refs to be
|
|
1770
|
+
// listed in the deps array. Unfortunately, in this situation
|
|
1771
|
+
// it doesn't recognized actionRef as a ref.
|
|
1772
|
+
[actionRef, isSet, options == null ? void 0 : options.clearPolicy]);
|
|
1773
|
+
const runOnUnmountRef = Object(_internal_use_updating_ref_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
1774
|
+
/* useUpdatingRef */
|
|
1775
|
+
"a"])(isSet && (options == null ? void 0 : options.clearPolicy) === _util_policies_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1776
|
+
/* ClearPolicy */
|
|
1777
|
+
"a"].Resolve);
|
|
1778
|
+
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
|
|
1779
|
+
return () => {
|
|
1780
|
+
// This code will only run with the component using this
|
|
1781
|
+
// hook is unmounted.
|
|
1782
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1783
|
+
if (runOnUnmountRef.current) {
|
|
1784
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1785
|
+
actionRef.current();
|
|
1786
|
+
}
|
|
1787
|
+
}; // This eslint rule doesn't realize actionRef and runOnUnmountRef
|
|
1788
|
+
// a both refs and thus do not have to be listed as deps.
|
|
1789
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1790
|
+
}, []);
|
|
1791
|
+
Object(_use_timeout_js__WEBPACK_IMPORTED_MODULE_3__[
|
|
1792
|
+
/* useTimeout */
|
|
1793
|
+
"a"])(wrappedAction, timeoutMs, isSet);
|
|
1794
|
+
return {
|
|
1795
|
+
isSet,
|
|
1796
|
+
set,
|
|
1797
|
+
clear
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
/***/
|
|
1801
|
+
|
|
1802
|
+
},
|
|
1803
|
+
/* 8 */
|
|
1804
|
+
|
|
1805
|
+
/***/
|
|
1806
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1807
|
+
"use strict";
|
|
1808
|
+
/* harmony export (binding) */
|
|
1809
|
+
|
|
1810
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1811
|
+
return ActionSchedulerProvider;
|
|
1812
|
+
});
|
|
1813
|
+
/* harmony import */
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
1817
|
+
/* harmony import */
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1821
|
+
/* harmony import */
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
var _util_action_scheduler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
|
1825
|
+
/**
|
|
1826
|
+
* A provider component that passes our action scheduling API to its children
|
|
1827
|
+
* and ensures that all scheduled actions are cleared on unmount.
|
|
1828
|
+
*
|
|
1829
|
+
* ```jsx
|
|
1830
|
+
* <ActionSchedulerProvider>
|
|
1831
|
+
* {schedule => this.renderThingThatNeedsTimers(schedule)}
|
|
1832
|
+
* </ActionSchedulerProvider>
|
|
1833
|
+
* ```
|
|
1834
|
+
*/
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
class ActionSchedulerProvider extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
1838
|
+
constructor(...args) {
|
|
1839
|
+
super(...args);
|
|
1840
|
+
this._actionScheduler = new _util_action_scheduler_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1841
|
+
/* default */
|
|
1842
|
+
"a"]();
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
componentWillUnmount() {
|
|
1846
|
+
this._actionScheduler.disable();
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
render() {
|
|
1850
|
+
const {
|
|
1851
|
+
children
|
|
1852
|
+
} = this.props;
|
|
1853
|
+
return children(this._actionScheduler);
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
}
|
|
1857
|
+
/***/
|
|
1858
|
+
|
|
1859
|
+
},
|
|
1860
|
+
/* 9 */
|
|
1861
|
+
|
|
1862
|
+
/***/
|
|
1863
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1864
|
+
"use strict";
|
|
1865
|
+
/* harmony export (binding) */
|
|
1866
|
+
|
|
1867
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1868
|
+
return ActionScheduler;
|
|
1869
|
+
});
|
|
1870
|
+
/* harmony import */
|
|
1871
|
+
|
|
1872
|
+
|
|
1873
|
+
var _timeout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
|
1874
|
+
/* harmony import */
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
var _interval_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
|
|
1878
|
+
/* harmony import */
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
var _animation_frame_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12);
|
|
1882
|
+
/**
|
|
1883
|
+
* Implements the `IScheduleActions` API to provide timeout, interval, and
|
|
1884
|
+
* animation frame support. This is not intended for direct use, but instead
|
|
1885
|
+
* is to be used solely by the `ActionSchedulerProvider` to provide an
|
|
1886
|
+
* `IScheduleActions` instance.
|
|
1887
|
+
*/
|
|
1888
|
+
|
|
1889
|
+
|
|
1890
|
+
class ActionScheduler {
|
|
1891
|
+
constructor() {
|
|
1892
|
+
this._disabled = false;
|
|
1893
|
+
this._registeredActions = [];
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
timeout(action, period, options) {
|
|
1897
|
+
if (this._disabled) {
|
|
1898
|
+
return ActionScheduler.NoopAction;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
const timeout = new _timeout_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
1902
|
+
/* default */
|
|
1903
|
+
"a"](action, period, options == null ? void 0 : options.schedulePolicy);
|
|
1904
|
+
|
|
1905
|
+
this._registeredActions.push(() => timeout.clear(options == null ? void 0 : options.clearPolicy));
|
|
1906
|
+
|
|
1907
|
+
return timeout;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
interval(action, period, options) {
|
|
1911
|
+
if (this._disabled) {
|
|
1912
|
+
return ActionScheduler.NoopAction;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
const interval = new _interval_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
1916
|
+
/* default */
|
|
1917
|
+
"a"](action, period, options == null ? void 0 : options.schedulePolicy);
|
|
1918
|
+
|
|
1919
|
+
this._registeredActions.push(() => interval.clear(options == null ? void 0 : options.clearPolicy));
|
|
1920
|
+
|
|
1921
|
+
return interval;
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
animationFrame(action, options) {
|
|
1925
|
+
if (this._disabled) {
|
|
1926
|
+
return ActionScheduler.NoopAction;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
const animationFrame = new _animation_frame_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
1930
|
+
/* default */
|
|
1931
|
+
"a"](action, options == null ? void 0 : options.schedulePolicy);
|
|
1932
|
+
|
|
1933
|
+
this._registeredActions.push(() => animationFrame.clear(options == null ? void 0 : options.clearPolicy));
|
|
1934
|
+
|
|
1935
|
+
return animationFrame;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
clearAll() {
|
|
1939
|
+
const registered = [].concat(this._registeredActions);
|
|
1940
|
+
this._registeredActions = [];
|
|
1941
|
+
registered.forEach(clearFn => clearFn());
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Prevents this scheduler from creating any additional actions.
|
|
1945
|
+
* This also clears any pending actions.
|
|
1946
|
+
*/
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
disable() {
|
|
1950
|
+
this._disabled = true;
|
|
1951
|
+
this.clearAll();
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
ActionScheduler.NoopAction = {
|
|
1957
|
+
set: () => {},
|
|
1958
|
+
|
|
1959
|
+
get isSet() {
|
|
1960
|
+
return false;
|
|
1961
|
+
},
|
|
1962
|
+
|
|
1963
|
+
clear: () => {}
|
|
1964
|
+
};
|
|
1965
|
+
/***/
|
|
1966
|
+
},
|
|
1967
|
+
/* 10 */
|
|
1968
|
+
|
|
1969
|
+
/***/
|
|
1970
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
1971
|
+
"use strict";
|
|
1972
|
+
/* harmony export (binding) */
|
|
1973
|
+
|
|
1974
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
1975
|
+
return Timeout;
|
|
1976
|
+
});
|
|
1977
|
+
/* harmony import */
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
var _policies_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
1981
|
+
/**
|
|
1982
|
+
* Encapsulates everything associated with calling setTimeout/clearTimeout, and
|
|
1983
|
+
* managing the lifecycle of that timer, including the ability to resolve or
|
|
1984
|
+
* cancel a pending timeout action.
|
|
1985
|
+
*
|
|
1986
|
+
* @export
|
|
1987
|
+
* @class Timeout
|
|
1988
|
+
* @implements {ITimeout}
|
|
1989
|
+
*/
|
|
1990
|
+
|
|
1991
|
+
|
|
1992
|
+
class Timeout {
|
|
1993
|
+
/**
|
|
1994
|
+
* Creates a timeout that will invoke the given action after
|
|
1995
|
+
* the given period. The timeout does not start until set is called.
|
|
1996
|
+
*
|
|
1997
|
+
* @param {() => mixed} action The action to be invoked when the timeout
|
|
1998
|
+
* period has passed.
|
|
1999
|
+
* @param {number} timeoutMs The timeout period.
|
|
2000
|
+
* @param {SchedulePolicy} [schedulePolicy] When SchedulePolicy.Immediately,
|
|
2001
|
+
* the timer is set immediately on instantiation; otherwise, `set` must be
|
|
2002
|
+
* called to set the timeout.
|
|
2003
|
+
* Defaults to `SchedulePolicy.Immediately`.
|
|
2004
|
+
* @memberof Timeout
|
|
2005
|
+
*/
|
|
2006
|
+
constructor(action, timeoutMs, schedulePolicy = _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2007
|
+
/* SchedulePolicy */
|
|
2008
|
+
"b"].Immediately) {
|
|
2009
|
+
if (typeof action !== "function") {
|
|
2010
|
+
throw new Error("Action must be a function");
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
if (timeoutMs < 0) {
|
|
2014
|
+
throw new Error("Timeout period must be >= 0");
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
this._action = action;
|
|
2018
|
+
this._timeoutMs = timeoutMs;
|
|
2019
|
+
|
|
2020
|
+
if (schedulePolicy === _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2021
|
+
/* SchedulePolicy */
|
|
2022
|
+
"b"].Immediately) {
|
|
2023
|
+
this.set();
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Determine if the timeout is set or not.
|
|
2028
|
+
*
|
|
2029
|
+
* @returns {boolean} true if the timeout is set (aka pending), otherwise
|
|
2030
|
+
* false.
|
|
2031
|
+
* @memberof Timeout
|
|
2032
|
+
*/
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
get isSet() {
|
|
2036
|
+
return this._timeoutId != null;
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Set the timeout.
|
|
2040
|
+
*
|
|
2041
|
+
* If the timeout is pending, this cancels that pending timeout and
|
|
2042
|
+
* sets the timeout afresh. If the timeout is not pending, this
|
|
2043
|
+
* sets a new timeout.
|
|
2044
|
+
*
|
|
2045
|
+
* @memberof Timeout
|
|
2046
|
+
*/
|
|
2047
|
+
|
|
2048
|
+
|
|
2049
|
+
set() {
|
|
2050
|
+
if (this.isSet) {
|
|
2051
|
+
this.clear(_policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2052
|
+
/* ClearPolicy */
|
|
2053
|
+
"a"].Cancel);
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
this._timeoutId = setTimeout(() => this.clear(_policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2057
|
+
/* ClearPolicy */
|
|
2058
|
+
"a"].Resolve), this._timeoutMs);
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Clear the set timeout.
|
|
2062
|
+
*
|
|
2063
|
+
* If the timeout is pending, this cancels that pending timeout without
|
|
2064
|
+
* invoking the action. If no timeout is pending, this does nothing.
|
|
2065
|
+
*
|
|
2066
|
+
* @param {ClearPolicy} [policy] When ClearPolicy.Resolve, if the request
|
|
2067
|
+
* was set when called, the request action is invoked after cancelling
|
|
2068
|
+
* the request; otherwise, the pending action is cancelled.
|
|
2069
|
+
* Defaults to `ClearPolicy.Cancel`.
|
|
2070
|
+
*
|
|
2071
|
+
* @returns {void}
|
|
2072
|
+
* @memberof Timeout
|
|
2073
|
+
*/
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
clear(policy = _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2077
|
+
/* ClearPolicy */
|
|
2078
|
+
"a"].Cancel) {
|
|
2079
|
+
const timeoutId = this._timeoutId;
|
|
2080
|
+
this._timeoutId = null;
|
|
2081
|
+
|
|
2082
|
+
if (timeoutId == null) {
|
|
2083
|
+
return;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
clearTimeout(timeoutId);
|
|
2087
|
+
|
|
2088
|
+
if (policy === _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2089
|
+
/* ClearPolicy */
|
|
2090
|
+
"a"].Resolve) {
|
|
2091
|
+
this._action();
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
}
|
|
2096
|
+
/***/
|
|
2097
|
+
|
|
2098
|
+
},
|
|
2099
|
+
/* 11 */
|
|
2100
|
+
|
|
2101
|
+
/***/
|
|
2102
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
2103
|
+
"use strict";
|
|
2104
|
+
/* harmony export (binding) */
|
|
2105
|
+
|
|
2106
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
2107
|
+
return Interval;
|
|
2108
|
+
});
|
|
2109
|
+
/* harmony import */
|
|
2110
|
+
|
|
2111
|
+
|
|
2112
|
+
var _policies_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
2113
|
+
/**
|
|
2114
|
+
* Encapsulates everything associated with calling setInterval/clearInterval,
|
|
2115
|
+
* and managing the lifecycle of that interval. This includes the ability to
|
|
2116
|
+
* cancel the interval, and knowing if the interval is active.
|
|
2117
|
+
*
|
|
2118
|
+
* @export
|
|
2119
|
+
* @class Interval
|
|
2120
|
+
* @implements {IInterval}
|
|
2121
|
+
*/
|
|
2122
|
+
|
|
2123
|
+
|
|
2124
|
+
class Interval {
|
|
2125
|
+
/**
|
|
2126
|
+
* Creates an interval that will invoke the given action after
|
|
2127
|
+
* the given period. The interval does not start until set is called.
|
|
2128
|
+
*
|
|
2129
|
+
* @param {() => mixed} action The action to be invoked each time the
|
|
2130
|
+
* interval period has passed.
|
|
2131
|
+
* @param {number} intervalMs The interval period.
|
|
2132
|
+
* @param {SchedulePolicy} [schedulePolicy] When SchedulePolicy.Immediately,
|
|
2133
|
+
* the interval is set immediately on instantiation; otherwise, `set` must be
|
|
2134
|
+
* called to set the interval.
|
|
2135
|
+
* Defaults to `SchedulePolicy.Immediately`.
|
|
2136
|
+
* @memberof Interval
|
|
2137
|
+
*/
|
|
2138
|
+
constructor(action, intervalMs, schedulePolicy = _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2139
|
+
/* SchedulePolicy */
|
|
2140
|
+
"b"].Immediately) {
|
|
2141
|
+
if (typeof action !== "function") {
|
|
2142
|
+
throw new Error("Action must be a function");
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
if (intervalMs < 1) {
|
|
2146
|
+
throw new Error("Interval period must be >= 1");
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
this._action = action;
|
|
2150
|
+
this._intervalMs = intervalMs;
|
|
2151
|
+
|
|
2152
|
+
if (schedulePolicy === _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2153
|
+
/* SchedulePolicy */
|
|
2154
|
+
"b"].Immediately) {
|
|
2155
|
+
this.set();
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
/**
|
|
2159
|
+
* Determine if the interval is active or not.
|
|
2160
|
+
*
|
|
2161
|
+
* @returns {boolean} true if the interval is active, otherwise false.
|
|
2162
|
+
* @memberof Interval
|
|
2163
|
+
*/
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
get isSet() {
|
|
2167
|
+
return this._intervalId != null;
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
2170
|
+
* Activate the interval.
|
|
2171
|
+
*
|
|
2172
|
+
* If the interval is active, this cancels that interval and starts the
|
|
2173
|
+
* interval afresh. If the interval is not active, this starts it.
|
|
2174
|
+
*
|
|
2175
|
+
* @memberof Interval
|
|
2176
|
+
*/
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
set() {
|
|
2180
|
+
if (this.isSet) {
|
|
2181
|
+
this.clear(_policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2182
|
+
/* ClearPolicy */
|
|
2183
|
+
"a"].Cancel);
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
this._intervalId = setInterval(() => this._action(), this._intervalMs);
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Clear the active interval.
|
|
2190
|
+
*
|
|
2191
|
+
* If the interval is active, this cancels that interval. If no interval is
|
|
2192
|
+
* pending, this does nothing.
|
|
2193
|
+
*
|
|
2194
|
+
* @param {ClearPolicy} [policy] When ClearPolicy.Resolve, if the request
|
|
2195
|
+
* was set when called, the request action is invoked after cancelling
|
|
2196
|
+
* the request; otherwise, the pending action is cancelled.
|
|
2197
|
+
* Defaults to `ClearPolicy.Cancel`.
|
|
2198
|
+
*
|
|
2199
|
+
* @returns {void}
|
|
2200
|
+
* @memberof Interval
|
|
2201
|
+
*/
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
clear(policy = _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2205
|
+
/* ClearPolicy */
|
|
2206
|
+
"a"].Cancel) {
|
|
2207
|
+
const intervalId = this._intervalId;
|
|
2208
|
+
this._intervalId = null;
|
|
2209
|
+
|
|
2210
|
+
if (intervalId == null) {
|
|
2211
|
+
return;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
clearInterval(intervalId);
|
|
2215
|
+
|
|
2216
|
+
if (policy === _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2217
|
+
/* ClearPolicy */
|
|
2218
|
+
"a"].Resolve) {
|
|
2219
|
+
this._action();
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
}
|
|
2224
|
+
/***/
|
|
2225
|
+
|
|
2226
|
+
},
|
|
2227
|
+
/* 12 */
|
|
2228
|
+
|
|
2229
|
+
/***/
|
|
2230
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
2231
|
+
"use strict";
|
|
2232
|
+
/* harmony export (binding) */
|
|
2233
|
+
|
|
2234
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
2235
|
+
return AnimationFrame;
|
|
2236
|
+
});
|
|
2237
|
+
/* harmony import */
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
var _policies_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
2241
|
+
/**
|
|
2242
|
+
* Encapsulates everything associated with calling requestAnimationFrame/
|
|
2243
|
+
* cancelAnimationFrame, and managing the lifecycle of that request, including
|
|
2244
|
+
* the ability to resolve or cancel a pending request action.
|
|
2245
|
+
*
|
|
2246
|
+
* @export
|
|
2247
|
+
* @class AnimationFrame
|
|
2248
|
+
* @implements {IAnimationFrame}
|
|
2249
|
+
*/
|
|
2250
|
+
|
|
2251
|
+
|
|
2252
|
+
class AnimationFrame {
|
|
2253
|
+
/**
|
|
2254
|
+
* Creates an animation frame request that will invoke the given action.
|
|
2255
|
+
* The request is not made until set is called.
|
|
2256
|
+
*
|
|
2257
|
+
* @param {DOMHighResTimeStamp => mixed} action The action to be invoked.
|
|
2258
|
+
* @param {SchedulePolicy} [schedulePolicy] When SchedulePolicy.Immediately,
|
|
2259
|
+
* the interval is set immediately on instantiation; otherwise, `set` must be
|
|
2260
|
+
* called to set the interval.
|
|
2261
|
+
* Defaults to `SchedulePolicy.Immediately`.
|
|
2262
|
+
* @memberof AnimationFrame
|
|
2263
|
+
*/
|
|
2264
|
+
constructor(action, schedulePolicy = _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2265
|
+
/* SchedulePolicy */
|
|
2266
|
+
"b"].Immediately) {
|
|
2267
|
+
if (typeof action !== "function") {
|
|
2268
|
+
throw new Error("Action must be a function");
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
this._action = action;
|
|
2272
|
+
|
|
2273
|
+
if (schedulePolicy === _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2274
|
+
/* SchedulePolicy */
|
|
2275
|
+
"b"].Immediately) {
|
|
2276
|
+
this.set();
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Determine if the request is pending or not.
|
|
2281
|
+
*
|
|
2282
|
+
* @returns {boolean} true if the request is pending, otherwise
|
|
2283
|
+
* false.
|
|
2284
|
+
* @memberof AnimationFrame
|
|
2285
|
+
*/
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
get isSet() {
|
|
2289
|
+
return this._animationFrameId != null;
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Make the animation frame request.
|
|
2293
|
+
*
|
|
2294
|
+
* If the request is pending, this cancels that pending request and
|
|
2295
|
+
* makes the request afresh. If the request is not pending, this
|
|
2296
|
+
* makes a new request.
|
|
2297
|
+
*
|
|
2298
|
+
* @memberof AnimationFrame
|
|
2299
|
+
*/
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
set() {
|
|
2303
|
+
if (this.isSet) {
|
|
2304
|
+
this.clear(_policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2305
|
+
/* ClearPolicy */
|
|
2306
|
+
"a"].Cancel);
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
this._animationFrameId = requestAnimationFrame(time => this.clear(_policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2310
|
+
/* ClearPolicy */
|
|
2311
|
+
"a"].Resolve, time));
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Clear the pending request.
|
|
2315
|
+
*
|
|
2316
|
+
* If the request is pending, this cancels that pending request without
|
|
2317
|
+
* invoking the action. If no request is pending, this does nothing.
|
|
2318
|
+
*
|
|
2319
|
+
* @param {ClearPolicy} [policy] When ClearPolicy.Resolve, if the request
|
|
2320
|
+
* was set when called, the request action is invoked after cancelling
|
|
2321
|
+
* the request; otherwise, the pending action is cancelled.
|
|
2322
|
+
* Defaults to `ClearPolicy.Cancel`.
|
|
2323
|
+
* @param {DOMHighResTimeStamp} [time] Timestamp to pass to the action when
|
|
2324
|
+
* ClearPolicy.Resolve is specified. Ignored when ClearPolicy.Cancel is
|
|
2325
|
+
* specified.
|
|
2326
|
+
*
|
|
2327
|
+
* @returns {void}
|
|
2328
|
+
* @memberof AnimationFrame
|
|
2329
|
+
*/
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
clear(policy = _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2333
|
+
/* ClearPolicy */
|
|
2334
|
+
"a"].Cancel, time) {
|
|
2335
|
+
const animationFrameId = this._animationFrameId;
|
|
2336
|
+
this._animationFrameId = null;
|
|
2337
|
+
|
|
2338
|
+
if (animationFrameId == null) {
|
|
2339
|
+
return;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
cancelAnimationFrame(animationFrameId);
|
|
2343
|
+
|
|
2344
|
+
if (policy === _policies_js__WEBPACK_IMPORTED_MODULE_0__[
|
|
2345
|
+
/* ClearPolicy */
|
|
2346
|
+
"a"].Resolve) {
|
|
2347
|
+
this._action(time || performance.now());
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
}
|
|
2352
|
+
/***/
|
|
2353
|
+
|
|
2354
|
+
},
|
|
2355
|
+
/* 13 */
|
|
2356
|
+
|
|
2357
|
+
/***/
|
|
2358
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
2359
|
+
"use strict";
|
|
2360
|
+
|
|
2361
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2362
|
+
/* harmony import */
|
|
2363
|
+
|
|
2364
|
+
|
|
2365
|
+
var _util_policies_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
2366
|
+
/* harmony reexport (safe) */
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
__webpack_require__.d(__webpack_exports__, "SchedulePolicy", function () {
|
|
2370
|
+
return _util_policies_js__WEBPACK_IMPORTED_MODULE_0__["b"];
|
|
2371
|
+
});
|
|
2372
|
+
/* harmony reexport (safe) */
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
__webpack_require__.d(__webpack_exports__, "ClearPolicy", function () {
|
|
2376
|
+
return _util_policies_js__WEBPACK_IMPORTED_MODULE_0__["a"];
|
|
2377
|
+
});
|
|
2378
|
+
/* harmony import */
|
|
2379
|
+
|
|
2380
|
+
|
|
2381
|
+
var _components_with_action_scheduler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
|
2382
|
+
/* harmony reexport (safe) */
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
__webpack_require__.d(__webpack_exports__, "withActionScheduler", function () {
|
|
2386
|
+
return _components_with_action_scheduler_js__WEBPACK_IMPORTED_MODULE_1__["a"];
|
|
2387
|
+
});
|
|
2388
|
+
/* harmony import */
|
|
2389
|
+
|
|
2390
|
+
|
|
2391
|
+
var _hooks_use_interval_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
|
2392
|
+
/* harmony reexport (safe) */
|
|
2393
|
+
|
|
2394
|
+
|
|
2395
|
+
__webpack_require__.d(__webpack_exports__, "useInterval", function () {
|
|
2396
|
+
return _hooks_use_interval_js__WEBPACK_IMPORTED_MODULE_2__["a"];
|
|
2397
|
+
});
|
|
2398
|
+
/* harmony import */
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
var _hooks_use_timeout_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
|
|
2402
|
+
/* harmony reexport (safe) */
|
|
2403
|
+
|
|
2404
|
+
|
|
2405
|
+
__webpack_require__.d(__webpack_exports__, "useTimeout", function () {
|
|
2406
|
+
return _hooks_use_timeout_js__WEBPACK_IMPORTED_MODULE_3__["a"];
|
|
2407
|
+
});
|
|
2408
|
+
/* harmony import */
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
var _hooks_use_scheduled_interval_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6);
|
|
2412
|
+
/* harmony reexport (safe) */
|
|
2413
|
+
|
|
2414
|
+
|
|
2415
|
+
__webpack_require__.d(__webpack_exports__, "useScheduledInterval", function () {
|
|
2416
|
+
return _hooks_use_scheduled_interval_js__WEBPACK_IMPORTED_MODULE_4__["a"];
|
|
2417
|
+
});
|
|
2418
|
+
/* harmony import */
|
|
2419
|
+
|
|
2420
|
+
|
|
2421
|
+
var _hooks_use_scheduled_timeout_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7);
|
|
2422
|
+
/* harmony reexport (safe) */
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
__webpack_require__.d(__webpack_exports__, "useScheduledTimeout", function () {
|
|
2426
|
+
return _hooks_use_scheduled_timeout_js__WEBPACK_IMPORTED_MODULE_5__["a"];
|
|
2427
|
+
});
|
|
2428
|
+
/***/
|
|
2429
|
+
|
|
2430
|
+
}
|
|
2431
|
+
/******/
|
|
2432
|
+
]);
|
|
2433
|
+
|
|
2434
|
+
/***/ }),
|
|
2435
|
+
/* 19 */
|
|
1067
2436
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1068
2437
|
|
|
1069
2438
|
"use strict";
|
|
@@ -1245,7 +2614,7 @@ class FocusTrap extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
1245
2614
|
}
|
|
1246
2615
|
|
|
1247
2616
|
/***/ }),
|
|
1248
|
-
/*
|
|
2617
|
+
/* 20 */
|
|
1249
2618
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1250
2619
|
|
|
1251
2620
|
"use strict";
|
|
@@ -1261,7 +2630,7 @@ class FocusTrap extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
1261
2630
|
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2);
|
|
1262
2631
|
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_4__);
|
|
1263
2632
|
/* harmony import */ var _util_constants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11);
|
|
1264
|
-
/* harmony import */ var _util_find_focusable_nodes_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(
|
|
2633
|
+
/* harmony import */ var _util_find_focusable_nodes_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(21);
|
|
1265
2634
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1266
2635
|
|
|
1267
2636
|
|
|
@@ -1411,7 +2780,7 @@ const styles = aphrodite__WEBPACK_IMPORTED_MODULE_2__["StyleSheet"].create({
|
|
|
1411
2780
|
});
|
|
1412
2781
|
|
|
1413
2782
|
/***/ }),
|
|
1414
|
-
/*
|
|
2783
|
+
/* 21 */
|
|
1415
2784
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1416
2785
|
|
|
1417
2786
|
"use strict";
|
|
@@ -1426,7 +2795,7 @@ function findFocusableNodes(root) {
|
|
|
1426
2795
|
}
|
|
1427
2796
|
|
|
1428
2797
|
/***/ }),
|
|
1429
|
-
/*
|
|
2798
|
+
/* 22 */
|
|
1430
2799
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1431
2800
|
|
|
1432
2801
|
"use strict";
|
|
@@ -1523,16 +2892,16 @@ ScrollDisabler.numModalsOpened = 0;
|
|
|
1523
2892
|
/* harmony default export */ __webpack_exports__["a"] = (ScrollDisabler);
|
|
1524
2893
|
|
|
1525
2894
|
/***/ }),
|
|
1526
|
-
/*
|
|
2895
|
+
/* 23 */
|
|
1527
2896
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1528
2897
|
|
|
1529
2898
|
"use strict";
|
|
1530
2899
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CloseButton; });
|
|
1531
2900
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
1532
2901
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1533
|
-
/* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
2902
|
+
/* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(24);
|
|
1534
2903
|
/* harmony import */ var _khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_icon__WEBPACK_IMPORTED_MODULE_1__);
|
|
1535
|
-
/* harmony import */ var _khanacademy_wonder_blocks_icon_button__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
2904
|
+
/* harmony import */ var _khanacademy_wonder_blocks_icon_button__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25);
|
|
1536
2905
|
/* harmony import */ var _khanacademy_wonder_blocks_icon_button__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_icon_button__WEBPACK_IMPORTED_MODULE_2__);
|
|
1537
2906
|
/* harmony import */ var _modal_context_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12);
|
|
1538
2907
|
|
|
@@ -1571,19 +2940,19 @@ class CloseButton extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
1571
2940
|
}
|
|
1572
2941
|
|
|
1573
2942
|
/***/ }),
|
|
1574
|
-
/*
|
|
2943
|
+
/* 24 */
|
|
1575
2944
|
/***/ (function(module, exports) {
|
|
1576
2945
|
|
|
1577
2946
|
module.exports = require("@khanacademy/wonder-blocks-icon");
|
|
1578
2947
|
|
|
1579
2948
|
/***/ }),
|
|
1580
|
-
/*
|
|
2949
|
+
/* 25 */
|
|
1581
2950
|
/***/ (function(module, exports) {
|
|
1582
2951
|
|
|
1583
2952
|
module.exports = require("@khanacademy/wonder-blocks-icon-button");
|
|
1584
2953
|
|
|
1585
2954
|
/***/ }),
|
|
1586
|
-
/*
|
|
2955
|
+
/* 26 */
|
|
1587
2956
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1588
2957
|
|
|
1589
2958
|
"use strict";
|