@angular-wave/angular.ts 0.9.9 → 0.11.0
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/@types/angular.d.ts +24 -11
- package/@types/animations/animate-css-driver.d.ts +0 -1
- package/@types/animations/animate-css.d.ts +0 -1
- package/@types/animations/animate-js-driver.d.ts +1 -7
- package/@types/animations/animate-js.d.ts +1 -4
- package/@types/animations/animate-queue.d.ts +2 -4
- package/@types/animations/animate-swap.d.ts +2 -4
- package/@types/animations/animate.d.ts +24 -24
- package/@types/animations/animation.d.ts +2 -2
- package/@types/animations/interface.d.ts +12 -0
- package/@types/animations/raf-scheduler.d.ts +4 -4
- package/@types/animations/runner/animate-runner.d.ts +99 -0
- package/@types/animations/shared.d.ts +30 -2
- package/@types/core/compile/attributes.d.ts +5 -8
- package/@types/core/compile/compile.d.ts +4 -4
- package/@types/core/controller/controller.d.ts +1 -1
- package/@types/core/di/ng-module.d.ts +14 -14
- package/@types/core/filter/filter.d.ts +2 -2
- package/@types/core/scope/interface.d.ts +18 -0
- package/@types/core/scope/scope.d.ts +19 -95
- package/@types/directive/aria/aria.d.ts +11 -13
- package/@types/directive/attrs/attrs.d.ts +2 -2
- package/@types/directive/class/class.d.ts +3 -3
- package/@types/directive/events/events.d.ts +0 -2
- package/@types/directive/http/http.d.ts +4 -22
- package/@types/directive/if/if.d.ts +2 -4
- package/@types/directive/include/include.d.ts +2 -2
- package/@types/directive/inject/inject.d.ts +2 -2
- package/@types/directive/input/input.d.ts +10 -10
- package/@types/directive/messages/messages.d.ts +4 -4
- package/@types/directive/observe/observe.d.ts +2 -5
- package/@types/directive/worker/worker.d.ts +15 -0
- package/@types/interface.d.ts +40 -11
- package/@types/namespace.d.ts +11 -1
- package/@types/ng.d.ts +3 -5
- package/@types/router/directives/view-directive.d.ts +2 -2
- package/@types/router/params/interface.d.ts +0 -25
- package/@types/router/path/path-utils.d.ts +2 -2
- package/@types/router/state/interface.d.ts +0 -9
- package/@types/router/state/state-object.d.ts +6 -6
- package/@types/router/state/state-service.d.ts +3 -3
- package/@types/router/template-factory.d.ts +1 -1
- package/@types/router/transition/hook-builder.d.ts +1 -1
- package/@types/router/transition/interface.d.ts +0 -44
- package/@types/router/transition/transition-hook.d.ts +31 -0
- package/@types/router/transition/transition-service.d.ts +1 -1
- package/@types/router/transition/transition.d.ts +2 -2
- package/@types/services/pubsub/pubsub.d.ts +2 -2
- package/@types/services/sse/interface.d.ts +27 -1
- package/@types/services/sse/sse.d.ts +4 -3
- package/@types/services/worker/interface.d.ts +12 -0
- package/@types/services/worker/worker.d.ts +31 -0
- package/@types/shared/dom.d.ts +4 -5
- package/@types/shared/url-utils/url-utils.d.ts +14 -14
- package/README.md +1 -1
- package/dist/angular-ts.esm.js +1517 -1125
- package/dist/angular-ts.umd.js +1517 -1125
- package/dist/angular-ts.umd.min.js +1 -1
- package/dist/angular.css +1 -1
- package/package.json +1 -2
- package/@types/animations/animate-runner.d.ts +0 -31
package/dist/angular-ts.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Version: 0.
|
|
1
|
+
/* Version: 0.11.0 - November 11, 2025 21:55:55 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
@@ -912,7 +912,7 @@
|
|
|
912
912
|
return arg;
|
|
913
913
|
}
|
|
914
914
|
|
|
915
|
-
/** @type {import("./interface.
|
|
915
|
+
/** @type {import("./interface.ts").ErrorHandlingConfig} */
|
|
916
916
|
const minErrConfig = {
|
|
917
917
|
objectMaxDepth: 5,
|
|
918
918
|
urlErrorParamsEnabled: true,
|
|
@@ -1204,6 +1204,382 @@
|
|
|
1204
1204
|
*/
|
|
1205
1205
|
const Cache = new Map();
|
|
1206
1206
|
|
|
1207
|
+
/**
|
|
1208
|
+
* @readonly
|
|
1209
|
+
* @enum {number}
|
|
1210
|
+
*/
|
|
1211
|
+
const ASTType = {
|
|
1212
|
+
Program: 1,
|
|
1213
|
+
ExpressionStatement: 2,
|
|
1214
|
+
AssignmentExpression: 3,
|
|
1215
|
+
ConditionalExpression: 4,
|
|
1216
|
+
LogicalExpression: 5,
|
|
1217
|
+
BinaryExpression: 6,
|
|
1218
|
+
UnaryExpression: 7,
|
|
1219
|
+
CallExpression: 8,
|
|
1220
|
+
MemberExpression: 9,
|
|
1221
|
+
Identifier: 10,
|
|
1222
|
+
Literal: 11,
|
|
1223
|
+
ArrayExpression: 12,
|
|
1224
|
+
Property: 13,
|
|
1225
|
+
ObjectExpression: 14,
|
|
1226
|
+
ThisExpression: 15,
|
|
1227
|
+
LocalsExpression: 16,
|
|
1228
|
+
NGValueParameter: 17,
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
const ADD_CLASS_SUFFIX = "-add";
|
|
1232
|
+
const REMOVE_CLASS_SUFFIX = "-remove";
|
|
1233
|
+
const EVENT_CLASS_PREFIX = "ng-";
|
|
1234
|
+
const ACTIVE_CLASS_SUFFIX = "-active";
|
|
1235
|
+
const PREPARE_CLASS_SUFFIX = "-prepare";
|
|
1236
|
+
|
|
1237
|
+
const NG_ANIMATE_CLASSNAME = "ng-animate";
|
|
1238
|
+
const NG_ANIMATE_CHILDREN_DATA = "$$ngAnimateChildren";
|
|
1239
|
+
let TRANSITION_PROP;
|
|
1240
|
+
let TRANSITIONEND_EVENT;
|
|
1241
|
+
let ANIMATION_PROP;
|
|
1242
|
+
let ANIMATIONEND_EVENT;
|
|
1243
|
+
|
|
1244
|
+
// If unprefixed events are not supported but webkit-prefixed are, use the latter.
|
|
1245
|
+
// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
|
|
1246
|
+
// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
|
|
1247
|
+
// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
|
|
1248
|
+
// Register both events in case `window.onanimationend` is not supported because of that,
|
|
1249
|
+
// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
|
|
1250
|
+
// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
|
|
1251
|
+
// therefore there is no reason to test anymore for other vendor prefixes:
|
|
1252
|
+
// http://caniuse.com/#search=transition
|
|
1253
|
+
if (
|
|
1254
|
+
window.ontransitionend === undefined &&
|
|
1255
|
+
window.onwebkittransitionend !== undefined
|
|
1256
|
+
) {
|
|
1257
|
+
TRANSITION_PROP = "WebkitTransition";
|
|
1258
|
+
TRANSITIONEND_EVENT = "webkitTransitionEnd transitionend";
|
|
1259
|
+
} else {
|
|
1260
|
+
TRANSITION_PROP = "transition";
|
|
1261
|
+
TRANSITIONEND_EVENT = "transitionend";
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
if (
|
|
1265
|
+
window.onanimationend === undefined &&
|
|
1266
|
+
window.onwebkitanimationend !== undefined
|
|
1267
|
+
) {
|
|
1268
|
+
ANIMATION_PROP = "WebkitAnimation";
|
|
1269
|
+
ANIMATIONEND_EVENT = "webkitAnimationEnd animationend";
|
|
1270
|
+
} else {
|
|
1271
|
+
ANIMATION_PROP = "animation";
|
|
1272
|
+
ANIMATIONEND_EVENT = "animationend";
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
const DURATION_KEY = "Duration";
|
|
1276
|
+
const PROPERTY_KEY = ASTType.Property;
|
|
1277
|
+
const DELAY_KEY = "Delay";
|
|
1278
|
+
const TIMING_KEY = "TimingFunction";
|
|
1279
|
+
const ANIMATION_ITERATION_COUNT_KEY = "IterationCount";
|
|
1280
|
+
const ANIMATION_PLAYSTATE_KEY = "PlayState";
|
|
1281
|
+
const SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
|
|
1282
|
+
|
|
1283
|
+
const ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
|
|
1284
|
+
const ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
|
|
1285
|
+
const TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
|
|
1286
|
+
const TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
|
|
1287
|
+
|
|
1288
|
+
const ngMinErr$1 = minErr("ng");
|
|
1289
|
+
function assertArg(arg, name, reason) {
|
|
1290
|
+
if (!arg) {
|
|
1291
|
+
throw ngMinErr$1(
|
|
1292
|
+
"areq",
|
|
1293
|
+
"Argument '{0}' is {1}",
|
|
1294
|
+
name || "?",
|
|
1295
|
+
reason,
|
|
1296
|
+
);
|
|
1297
|
+
}
|
|
1298
|
+
return arg;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function packageStyles(options) {
|
|
1302
|
+
const styles = {};
|
|
1303
|
+
if (options && (options.to || options.from)) {
|
|
1304
|
+
styles.to = options.to;
|
|
1305
|
+
styles.from = options.from;
|
|
1306
|
+
}
|
|
1307
|
+
return styles;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
function pendClasses(classes, fix, isPrefix) {
|
|
1311
|
+
let className = "";
|
|
1312
|
+
|
|
1313
|
+
classes = Array.isArray(classes)
|
|
1314
|
+
? classes
|
|
1315
|
+
: classes && isString(classes) && classes.length
|
|
1316
|
+
? classes.split(/\s+/)
|
|
1317
|
+
: [];
|
|
1318
|
+
classes.forEach((klass, i) => {
|
|
1319
|
+
if (klass && klass.length > 0) {
|
|
1320
|
+
className += i > 0 ? " " : "";
|
|
1321
|
+
className += isPrefix ? fix + klass : klass + fix;
|
|
1322
|
+
}
|
|
1323
|
+
});
|
|
1324
|
+
return className;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
function removeFromArray(arr, val) {
|
|
1328
|
+
const index = arr.indexOf(val);
|
|
1329
|
+
if (val >= 0) {
|
|
1330
|
+
arr.splice(index, 1);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
*
|
|
1336
|
+
* @param {NodeList|Node} element
|
|
1337
|
+
* @returns {Node[]|Node|undefined}
|
|
1338
|
+
*/
|
|
1339
|
+
function stripCommentsFromElement(element) {
|
|
1340
|
+
if (element instanceof NodeList) {
|
|
1341
|
+
return Array.from(element).filter((x) => x.nodeType == Node.ELEMENT_NODE);
|
|
1342
|
+
} else if (element.nodeType === Node.ELEMENT_NODE) {
|
|
1343
|
+
return /** @type {Node} */ (element);
|
|
1344
|
+
} else {
|
|
1345
|
+
return undefined;
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* @param {NodeList|Node} element
|
|
1351
|
+
* @returns {Node}
|
|
1352
|
+
*/
|
|
1353
|
+
function extractElementNode(element) {
|
|
1354
|
+
if (!element || !Array.isArray(element)) return /** @type {Node} */ (element);
|
|
1355
|
+
for (let i = 0; i < /** @type {NodeList} */ (element).length; i++) {
|
|
1356
|
+
const elm = element[i];
|
|
1357
|
+
if (elm.nodeType === Node.ELEMENT_NODE) {
|
|
1358
|
+
return elm;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
function applyAnimationClassesFactory() {
|
|
1364
|
+
return function (element, options) {
|
|
1365
|
+
if (options.addClass) {
|
|
1366
|
+
element.classList.add(...options.addClass.trim().split(" "));
|
|
1367
|
+
options.addClass = null;
|
|
1368
|
+
}
|
|
1369
|
+
if (options.removeClass) {
|
|
1370
|
+
element.classList.remove(...options.removeClass.trim().split(" "));
|
|
1371
|
+
options.removeClass = null;
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
function prepareAnimationOptions(options) {
|
|
1377
|
+
options = options || {};
|
|
1378
|
+
if (!options.$$prepared) {
|
|
1379
|
+
let domOperation = options.domOperation || (() => {});
|
|
1380
|
+
options.domOperation = function () {
|
|
1381
|
+
options.$$domOperationFired = true;
|
|
1382
|
+
domOperation();
|
|
1383
|
+
domOperation = () => {};
|
|
1384
|
+
};
|
|
1385
|
+
options.$$prepared = true;
|
|
1386
|
+
}
|
|
1387
|
+
return options;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
function applyAnimationStyles(element, options) {
|
|
1391
|
+
applyAnimationFromStyles(element, options);
|
|
1392
|
+
applyAnimationToStyles(element, options);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Applies initial animation styles to a DOM element.
|
|
1397
|
+
*
|
|
1398
|
+
* This function sets the element's inline styles using the properties
|
|
1399
|
+
* defined in `options.from`, then clears the property to prevent reuse.
|
|
1400
|
+
*
|
|
1401
|
+
* @param {HTMLElement} element - The target DOM element to apply styles to.
|
|
1402
|
+
* @param {{ from?: Partial<CSSStyleDeclaration> | null }} options - options containing a `from` object with CSS property–value pairs.
|
|
1403
|
+
*/
|
|
1404
|
+
function applyAnimationFromStyles(element, options) {
|
|
1405
|
+
if (options.from) {
|
|
1406
|
+
Object.assign(element.style, options.from);
|
|
1407
|
+
options.from = null;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Applies final animation styles to a DOM element.
|
|
1413
|
+
*
|
|
1414
|
+
* This function sets the element's inline styles using the properties
|
|
1415
|
+
* defined in `options.to`, then clears the property to prevent reuse.
|
|
1416
|
+
*
|
|
1417
|
+
* @param {HTMLElement} element - The target DOM element to apply styles to.
|
|
1418
|
+
* @param {{ to?: Partial<CSSStyleDeclaration> | null }} options - options containing a `from` object with CSS property–value pairs.
|
|
1419
|
+
*/
|
|
1420
|
+
function applyAnimationToStyles(element, options) {
|
|
1421
|
+
if (options.to) {
|
|
1422
|
+
Object.assign(element.style, options.to);
|
|
1423
|
+
options.to = null;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
function mergeAnimationDetails(element, oldAnimation, newAnimation) {
|
|
1428
|
+
const target = oldAnimation.options || {};
|
|
1429
|
+
const newOptions = newAnimation.options || {};
|
|
1430
|
+
|
|
1431
|
+
const toAdd = `${target.addClass || ""} ${newOptions.addClass || ""}`;
|
|
1432
|
+
const toRemove = `${target.removeClass || ""} ${newOptions.removeClass || ""}`;
|
|
1433
|
+
const classes = resolveElementClasses(
|
|
1434
|
+
element.getAttribute("class"),
|
|
1435
|
+
toAdd,
|
|
1436
|
+
toRemove,
|
|
1437
|
+
);
|
|
1438
|
+
|
|
1439
|
+
if (newOptions.preparationClasses) {
|
|
1440
|
+
target.preparationClasses = concatWithSpace(
|
|
1441
|
+
newOptions.preparationClasses,
|
|
1442
|
+
target.preparationClasses,
|
|
1443
|
+
);
|
|
1444
|
+
delete newOptions.preparationClasses;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
extend(target, newOptions);
|
|
1448
|
+
|
|
1449
|
+
if (classes.addClass) {
|
|
1450
|
+
target.addClass = classes.addClass;
|
|
1451
|
+
} else {
|
|
1452
|
+
target.addClass = null;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
if (classes.removeClass) {
|
|
1456
|
+
target.removeClass = classes.removeClass;
|
|
1457
|
+
} else {
|
|
1458
|
+
target.removeClass = null;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
oldAnimation.addClass = target.addClass;
|
|
1462
|
+
oldAnimation.removeClass = target.removeClass;
|
|
1463
|
+
|
|
1464
|
+
return target;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
function resolveElementClasses(existing, toAdd, toRemove) {
|
|
1468
|
+
const ADD_CLASS = 1;
|
|
1469
|
+
const REMOVE_CLASS = -1;
|
|
1470
|
+
|
|
1471
|
+
const flags = {};
|
|
1472
|
+
existing = splitClassesToLookup(existing);
|
|
1473
|
+
|
|
1474
|
+
toAdd = splitClassesToLookup(toAdd);
|
|
1475
|
+
Object.keys(toAdd).forEach((key) => {
|
|
1476
|
+
flags[key] = ADD_CLASS;
|
|
1477
|
+
});
|
|
1478
|
+
|
|
1479
|
+
toRemove = splitClassesToLookup(toRemove);
|
|
1480
|
+
Object.keys(toRemove).forEach((key) => {
|
|
1481
|
+
flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
|
|
1482
|
+
});
|
|
1483
|
+
|
|
1484
|
+
const classes = {
|
|
1485
|
+
addClass: "",
|
|
1486
|
+
removeClass: "",
|
|
1487
|
+
};
|
|
1488
|
+
|
|
1489
|
+
Object.entries(flags).forEach(([klass, val]) => {
|
|
1490
|
+
let prop, allow;
|
|
1491
|
+
if (val === ADD_CLASS) {
|
|
1492
|
+
prop = "addClass";
|
|
1493
|
+
allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
|
|
1494
|
+
} else if (val === REMOVE_CLASS) {
|
|
1495
|
+
prop = "removeClass";
|
|
1496
|
+
allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
|
|
1497
|
+
}
|
|
1498
|
+
if (allow) {
|
|
1499
|
+
if (classes[prop].length) {
|
|
1500
|
+
classes[prop] += " ";
|
|
1501
|
+
}
|
|
1502
|
+
classes[prop] += klass;
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
|
|
1506
|
+
function splitClassesToLookup(classes) {
|
|
1507
|
+
if (isString(classes)) {
|
|
1508
|
+
classes = classes.trim().split(" ");
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
const obj = {};
|
|
1512
|
+
if (classes) {
|
|
1513
|
+
classes.forEach((klass) => {
|
|
1514
|
+
// sometimes the split leaves empty string values
|
|
1515
|
+
// incase extra spaces were applied to the options
|
|
1516
|
+
if (klass.length) {
|
|
1517
|
+
obj[klass] = true;
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
return obj;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
return classes;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
function applyGeneratedPreparationClasses(element, event, options) {
|
|
1528
|
+
let classes = "";
|
|
1529
|
+
if (event) {
|
|
1530
|
+
classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
|
|
1531
|
+
}
|
|
1532
|
+
if (options.addClass) {
|
|
1533
|
+
classes = concatWithSpace(
|
|
1534
|
+
classes,
|
|
1535
|
+
pendClasses(options.addClass, ADD_CLASS_SUFFIX),
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
if (options.removeClass) {
|
|
1539
|
+
classes = concatWithSpace(
|
|
1540
|
+
classes,
|
|
1541
|
+
pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX),
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
if (classes.length) {
|
|
1545
|
+
options.preparationClasses = classes;
|
|
1546
|
+
element.className += ` ${classes}`;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
function clearGeneratedClasses(element, options) {
|
|
1551
|
+
if (options.preparationClasses) {
|
|
1552
|
+
options.preparationClasses
|
|
1553
|
+
.split(" ")
|
|
1554
|
+
.forEach((cls) => element.classList.remove(cls));
|
|
1555
|
+
options.preparationClasses = null;
|
|
1556
|
+
}
|
|
1557
|
+
if (options.activeClasses) {
|
|
1558
|
+
options.activeClasses
|
|
1559
|
+
.split(" ")
|
|
1560
|
+
.forEach((cls) => element.classList.remove(cls));
|
|
1561
|
+
options.activeClasses = null;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
function blockKeyframeAnimations(node, applyBlock) {
|
|
1566
|
+
const value = applyBlock ? "paused" : "";
|
|
1567
|
+
const key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
|
|
1568
|
+
applyInlineStyle(node, [key, value]);
|
|
1569
|
+
return [key, value];
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
function applyInlineStyle(node, styleTuple) {
|
|
1573
|
+
const prop = styleTuple[0];
|
|
1574
|
+
node.style[prop] = styleTuple[1];
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
function concatWithSpace(a, b) {
|
|
1578
|
+
if (!a) return b;
|
|
1579
|
+
if (!b) return a;
|
|
1580
|
+
return `${a} ${b}`;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1207
1583
|
/** @type {number} */
|
|
1208
1584
|
let jqId = 1;
|
|
1209
1585
|
|
|
@@ -1527,7 +1903,7 @@
|
|
|
1527
1903
|
* Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
|
|
1528
1904
|
*
|
|
1529
1905
|
* @param {Element} element - The DOM element to get data from.
|
|
1530
|
-
* @param {string} [name] -
|
|
1906
|
+
* @param {string} [name] - Controller name.
|
|
1531
1907
|
* @returns {import("../core/scope/scope.js").Scope|undefined} - The retrieved data
|
|
1532
1908
|
*/
|
|
1533
1909
|
function getController(element, name) {
|
|
@@ -1677,7 +2053,7 @@
|
|
|
1677
2053
|
/**
|
|
1678
2054
|
* Return instance of InjectorService attached to element
|
|
1679
2055
|
* @param {Element} element
|
|
1680
|
-
* @returns {
|
|
2056
|
+
* @returns {ng.InjectorService}
|
|
1681
2057
|
*/
|
|
1682
2058
|
function getInjector(element) {
|
|
1683
2059
|
return getInheritedData(element, "$injector");
|
|
@@ -1725,12 +2101,8 @@
|
|
|
1725
2101
|
// from the dom sometime before this code runs then let's
|
|
1726
2102
|
// just stick to using the parent element as the anchor
|
|
1727
2103
|
if (afterElement) {
|
|
1728
|
-
const afterNode = extractElementNode
|
|
1729
|
-
if (
|
|
1730
|
-
afterNode &&
|
|
1731
|
-
!afterNode.parentNode &&
|
|
1732
|
-
!afterNode.previousElementSibling
|
|
1733
|
-
) {
|
|
2104
|
+
const afterNode = extractElementNode(afterElement);
|
|
2105
|
+
if (afterNode && !afterNode.parentNode && !afterNode.previousSibling) {
|
|
1734
2106
|
afterElement = null;
|
|
1735
2107
|
}
|
|
1736
2108
|
}
|
|
@@ -1741,14 +2113,24 @@
|
|
|
1741
2113
|
}
|
|
1742
2114
|
}
|
|
1743
2115
|
|
|
1744
|
-
function
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
2116
|
+
function animatedomInsert(element, parent, after) {
|
|
2117
|
+
const originalVisibility = element.style.visibility;
|
|
2118
|
+
const originalPosition = element.style.position;
|
|
2119
|
+
const originalPointerEvents = element.style.pointerEvents;
|
|
2120
|
+
|
|
2121
|
+
Object.assign(element.style, {
|
|
2122
|
+
visibility: "hidden",
|
|
2123
|
+
position: "absolute",
|
|
2124
|
+
pointerEvents: "none",
|
|
2125
|
+
});
|
|
2126
|
+
|
|
2127
|
+
domInsert(element, parent, after);
|
|
2128
|
+
|
|
2129
|
+
requestAnimationFrame(() => {
|
|
2130
|
+
element.style.visibility = originalVisibility;
|
|
2131
|
+
element.style.position = originalPosition;
|
|
2132
|
+
element.style.pointerEvents = originalPointerEvents;
|
|
2133
|
+
});
|
|
1752
2134
|
}
|
|
1753
2135
|
|
|
1754
2136
|
/**
|
|
@@ -1782,8 +2164,6 @@
|
|
|
1782
2164
|
$attrs: "$attrs",
|
|
1783
2165
|
$scope: "$scope",
|
|
1784
2166
|
$element: "$element",
|
|
1785
|
-
$$AnimateRunner: "$$AnimateRunner",
|
|
1786
|
-
$$animateAsyncRun: "$$animateAsyncRun",
|
|
1787
2167
|
$$animateCache: "$$animateCache",
|
|
1788
2168
|
$$animateCssDriver: "$$animateCssDriver",
|
|
1789
2169
|
$$animateJs: "$$animateJs",
|
|
@@ -1869,7 +2249,7 @@
|
|
|
1869
2249
|
/**
|
|
1870
2250
|
* @param {string} name - Name of the module
|
|
1871
2251
|
* @param {Array<string>} requires - List of modules which the injector will load before the current module
|
|
1872
|
-
* @param {import("../../interface.
|
|
2252
|
+
* @param {import("../../interface.ts").Injectable<any>} [configFn]
|
|
1873
2253
|
*/
|
|
1874
2254
|
constructor(name, requires, configFn) {
|
|
1875
2255
|
assert(isString(name), "name required");
|
|
@@ -1895,7 +2275,7 @@
|
|
|
1895
2275
|
/** @type {!Array<Array<*>>} */
|
|
1896
2276
|
this.configBlocks = [];
|
|
1897
2277
|
|
|
1898
|
-
/** @type {!Array.<import("../../interface.
|
|
2278
|
+
/** @type {!Array.<import("../../interface.ts").Injectable<any>>} */
|
|
1899
2279
|
this.runBlocks = [];
|
|
1900
2280
|
|
|
1901
2281
|
if (configFn) {
|
|
@@ -1999,7 +2379,7 @@
|
|
|
1999
2379
|
|
|
2000
2380
|
/**
|
|
2001
2381
|
* @param {string} name
|
|
2002
|
-
* @param {import("../../interface.
|
|
2382
|
+
* @param {import("../../interface.ts").Injectable<any>} decorFn
|
|
2003
2383
|
* @returns {NgModule}
|
|
2004
2384
|
*/
|
|
2005
2385
|
decorator(name, decorFn) {
|
|
@@ -2012,7 +2392,7 @@
|
|
|
2012
2392
|
|
|
2013
2393
|
/**
|
|
2014
2394
|
* @param {string} name
|
|
2015
|
-
* @param {import("../../interface.
|
|
2395
|
+
* @param {import("../../interface.ts").Injectable<any>} directiveFactory
|
|
2016
2396
|
* @returns {NgModule}
|
|
2017
2397
|
*/
|
|
2018
2398
|
directive(name, directiveFactory) {
|
|
@@ -2029,7 +2409,7 @@
|
|
|
2029
2409
|
|
|
2030
2410
|
/**
|
|
2031
2411
|
* @param {string} name
|
|
2032
|
-
* @param {import("../../interface.
|
|
2412
|
+
* @param {import("../../interface.ts").Injectable<any>} animationFactory
|
|
2033
2413
|
* @returns {NgModule}
|
|
2034
2414
|
*/
|
|
2035
2415
|
animation(name, animationFactory) {
|
|
@@ -2046,7 +2426,7 @@
|
|
|
2046
2426
|
|
|
2047
2427
|
/**
|
|
2048
2428
|
* @param {string} name
|
|
2049
|
-
* @param {import("../../interface.
|
|
2429
|
+
* @param {import("../../interface.ts").Injectable<any>} filterFn
|
|
2050
2430
|
* @return {NgModule}
|
|
2051
2431
|
*/
|
|
2052
2432
|
filter(name, filterFn) {
|
|
@@ -2059,7 +2439,7 @@
|
|
|
2059
2439
|
|
|
2060
2440
|
/**
|
|
2061
2441
|
* @param {string} name
|
|
2062
|
-
* @param {import("../../interface.
|
|
2442
|
+
* @param {import("../../interface.ts").Injectable<any>} ctlFn
|
|
2063
2443
|
* @returns {NgModule}
|
|
2064
2444
|
*/
|
|
2065
2445
|
controller(name, ctlFn) {
|
|
@@ -2286,6 +2666,8 @@
|
|
|
2286
2666
|
const hasCache = hasOwn(this.cache, name);
|
|
2287
2667
|
return hasProvider || hasCache;
|
|
2288
2668
|
}
|
|
2669
|
+
|
|
2670
|
+
loadNewModules() {}
|
|
2289
2671
|
}
|
|
2290
2672
|
|
|
2291
2673
|
// Helpers
|
|
@@ -2444,7 +2826,7 @@
|
|
|
2444
2826
|
* Registers a factory.
|
|
2445
2827
|
* @param {string} name
|
|
2446
2828
|
* @param {(string|(function(*): *))[]} factoryFn
|
|
2447
|
-
* @returns {import('../../interface.
|
|
2829
|
+
* @returns {import('../../interface.ts').ServiceProvider}
|
|
2448
2830
|
*/
|
|
2449
2831
|
function factory(name, factoryFn) {
|
|
2450
2832
|
return provider(name, {
|
|
@@ -2466,7 +2848,7 @@
|
|
|
2466
2848
|
* Registers a service constructor.
|
|
2467
2849
|
* @param {string} name
|
|
2468
2850
|
* @param {Function} constructor
|
|
2469
|
-
* @returns {import('../../interface.
|
|
2851
|
+
* @returns {import('../../interface.ts').ServiceProvider}
|
|
2470
2852
|
*/
|
|
2471
2853
|
function service(name, constructor) {
|
|
2472
2854
|
return factory(name, [
|
|
@@ -2935,7 +3317,7 @@
|
|
|
2935
3317
|
|
|
2936
3318
|
/**
|
|
2937
3319
|
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
2938
|
-
* @returns {import("./interface.
|
|
3320
|
+
* @returns {import("./interface.ts").ControllerService} A service function that creates controllers.
|
|
2939
3321
|
*/
|
|
2940
3322
|
($injector) => {
|
|
2941
3323
|
return (expression, locals, later, ident) => {
|
|
@@ -3053,18 +3435,19 @@
|
|
|
3053
3435
|
);
|
|
3054
3436
|
}
|
|
3055
3437
|
locals.$scope[identifier] = instance;
|
|
3438
|
+
locals.$scope["$controllerIdentifier"] = identifier;
|
|
3056
3439
|
}
|
|
3057
3440
|
}
|
|
3058
3441
|
|
|
3059
3442
|
const originUrl = urlResolve(window.location.href);
|
|
3060
3443
|
|
|
3061
3444
|
/**
|
|
3062
|
-
* @param {import("./interface.
|
|
3063
|
-
* @return {import("./interface.
|
|
3445
|
+
* @param {import("./interface.ts").ResolvableUrl} url
|
|
3446
|
+
* @return {import("./interface.ts").ParsedUrl}
|
|
3064
3447
|
*/
|
|
3065
3448
|
function urlResolve(url) {
|
|
3066
3449
|
if (!isString(url))
|
|
3067
|
-
return /** @type {import("./interface.
|
|
3450
|
+
return /** @type {import("./interface.ts").ParsedUrl} */ (url);
|
|
3068
3451
|
|
|
3069
3452
|
const urlParsingNode = new URL(
|
|
3070
3453
|
/** @type {string} */ (url),
|
|
@@ -3096,7 +3479,7 @@
|
|
|
3096
3479
|
* Parse a request URL and determine whether this is a same-origin request as the application
|
|
3097
3480
|
* document.
|
|
3098
3481
|
*
|
|
3099
|
-
* @param {import("./interface.
|
|
3482
|
+
* @param {import("./interface.ts").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
|
|
3100
3483
|
* or a parsed URL object.
|
|
3101
3484
|
* @returns {boolean} Whether the request is for the same origin as the application document.
|
|
3102
3485
|
*/
|
|
@@ -3110,7 +3493,7 @@
|
|
|
3110
3493
|
* Note: The base URL is usually the same as the document location (`location.href`) but can
|
|
3111
3494
|
* be overriden by using the `<base>` tag.
|
|
3112
3495
|
*
|
|
3113
|
-
* @param {import("./interface.
|
|
3496
|
+
* @param {import("./interface.ts").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
|
|
3114
3497
|
* or a parsed URL object.
|
|
3115
3498
|
* @returns {boolean} Whether the URL is same-origin as the document base URL.
|
|
3116
3499
|
*/
|
|
@@ -3124,7 +3507,7 @@
|
|
|
3124
3507
|
*
|
|
3125
3508
|
* @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
|
|
3126
3509
|
*
|
|
3127
|
-
* @returns {(url: import("./interface.
|
|
3510
|
+
* @returns {(url: import("./interface.ts").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
|
|
3128
3511
|
* whether it is of an allowed origin.
|
|
3129
3512
|
*/
|
|
3130
3513
|
function urlIsAllowedOriginFactory(trustedOriginUrls) {
|
|
@@ -3137,7 +3520,7 @@
|
|
|
3137
3520
|
* based on a list of trusted-origin URLs. The current location's origin is implicitly
|
|
3138
3521
|
* trusted.
|
|
3139
3522
|
*
|
|
3140
|
-
* @param {import("./interface.
|
|
3523
|
+
* @param {import("./interface.ts").ResolvableUrl} requestUrl - The URL to be checked (provided as a string that will be
|
|
3141
3524
|
* resolved or a parsed URL object).
|
|
3142
3525
|
*
|
|
3143
3526
|
* @returns {boolean} - Whether the specified URL is of an allowed origin.
|
|
@@ -3153,9 +3536,9 @@
|
|
|
3153
3536
|
/**
|
|
3154
3537
|
* Determine if two URLs share the same origin.
|
|
3155
3538
|
*
|
|
3156
|
-
* @param {import("./interface.
|
|
3539
|
+
* @param {import("./interface.ts").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
|
|
3157
3540
|
* a dictionary object returned by `urlResolve()`.
|
|
3158
|
-
* @param {import("./interface.
|
|
3541
|
+
* @param {import("./interface.ts").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
|
|
3159
3542
|
* of a dictionary object returned by `urlResolve()`.
|
|
3160
3543
|
*
|
|
3161
3544
|
* @returns {boolean} - True if both URLs have the same origin, and false otherwise.
|
|
@@ -3789,7 +4172,7 @@
|
|
|
3789
4172
|
*
|
|
3790
4173
|
* @param {string} type The SCE context in which this result will be used.
|
|
3791
4174
|
* @param {string} expr String expression to compile.
|
|
3792
|
-
* @return {import("../../core/parse/interface.
|
|
4175
|
+
* @return {import("../../core/parse/interface.ts").CompiledExpression} A function which represents the compiled expression:
|
|
3793
4176
|
*
|
|
3794
4177
|
* * `context` – `{object}` – an object against which any expressions embedded in the
|
|
3795
4178
|
* strings are evaluated against (typically a scope object).
|
|
@@ -4021,26 +4404,23 @@
|
|
|
4021
4404
|
*/
|
|
4022
4405
|
const ngEventDirectives = {};
|
|
4023
4406
|
|
|
4024
|
-
"click copy cut dblclick focus blur keydown keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup paste submit touchstart touchend touchmove
|
|
4407
|
+
"click copy cut dblclick focus blur keydown keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup paste submit touchstart touchend touchmove"
|
|
4025
4408
|
.split(" ")
|
|
4026
4409
|
.forEach((eventName) => {
|
|
4027
4410
|
const directiveName = directiveNormalize(`ng-${eventName}`);
|
|
4028
4411
|
ngEventDirectives[directiveName] = [
|
|
4029
4412
|
$injectTokens.$parse,
|
|
4030
4413
|
$injectTokens.$exceptionHandler,
|
|
4031
|
-
$injectTokens.$window,
|
|
4032
4414
|
|
|
4033
4415
|
/**
|
|
4034
|
-
* @param {
|
|
4416
|
+
* @param {ng.ParseService} $parse
|
|
4035
4417
|
* @param {ng.ExceptionHandlerService} $exceptionHandler
|
|
4036
|
-
* @param {ng.WindowService} $window
|
|
4037
4418
|
* @returns
|
|
4038
4419
|
*/
|
|
4039
|
-
($parse, $exceptionHandler
|
|
4420
|
+
($parse, $exceptionHandler) => {
|
|
4040
4421
|
return createEventDirective(
|
|
4041
4422
|
$parse,
|
|
4042
4423
|
$exceptionHandler,
|
|
4043
|
-
$window,
|
|
4044
4424
|
directiveName,
|
|
4045
4425
|
eventName,
|
|
4046
4426
|
);
|
|
@@ -4052,7 +4432,6 @@
|
|
|
4052
4432
|
*
|
|
4053
4433
|
* @param {ng.ParseService} $parse
|
|
4054
4434
|
* @param {ng.ExceptionHandlerService} $exceptionHandler
|
|
4055
|
-
* @param {ng.WindowService} $window
|
|
4056
4435
|
* @param {string} directiveName
|
|
4057
4436
|
* @param {string} eventName
|
|
4058
4437
|
* @returns {ng.Directive}
|
|
@@ -4060,7 +4439,6 @@
|
|
|
4060
4439
|
function createEventDirective(
|
|
4061
4440
|
$parse,
|
|
4062
4441
|
$exceptionHandler,
|
|
4063
|
-
$window,
|
|
4064
4442
|
directiveName,
|
|
4065
4443
|
eventName,
|
|
4066
4444
|
) {
|
|
@@ -4129,16 +4507,13 @@
|
|
|
4129
4507
|
const SIMPLE_ATTR_NAME = /^\w/;
|
|
4130
4508
|
const specialAttrHolder = document.createElement("div");
|
|
4131
4509
|
|
|
4132
|
-
/**
|
|
4133
|
-
* @implements {Record<string, any>}
|
|
4134
|
-
*/
|
|
4135
4510
|
class Attributes {
|
|
4136
4511
|
static $nonscope = true;
|
|
4137
4512
|
|
|
4138
4513
|
/**
|
|
4139
|
-
* @param {
|
|
4514
|
+
* @param {ng.Scope} $rootScope
|
|
4140
4515
|
* @param {*} $animate
|
|
4141
|
-
* @param {
|
|
4516
|
+
* @param {ng.ExceptionHandlerService} $exceptionHandler
|
|
4142
4517
|
* @param {*} $sce
|
|
4143
4518
|
* @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
|
|
4144
4519
|
* @param {Object} [attributesToCopy]
|
|
@@ -4451,19 +4826,18 @@
|
|
|
4451
4826
|
/**
|
|
4452
4827
|
* @param {string} source - the name of the attribute to be observed
|
|
4453
4828
|
* @param {string} prop - the scope property to be updated with attribute value
|
|
4454
|
-
* @returns {
|
|
4829
|
+
* @returns {ng.Directive}
|
|
4455
4830
|
*/
|
|
4456
4831
|
function ngObserveDirective(source, prop) {
|
|
4457
4832
|
return {
|
|
4458
4833
|
restrict: "A",
|
|
4459
4834
|
compile: () => (scope, element) => {
|
|
4460
|
-
const targetElement = element;
|
|
4461
4835
|
if (prop === "") {
|
|
4462
4836
|
prop = source;
|
|
4463
4837
|
}
|
|
4464
4838
|
const normalized = kebabToCamel(prop);
|
|
4465
4839
|
if (!scope[normalized]) {
|
|
4466
|
-
scope[normalized] =
|
|
4840
|
+
scope[normalized] = element.getAttribute(source);
|
|
4467
4841
|
}
|
|
4468
4842
|
|
|
4469
4843
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -4476,7 +4850,7 @@
|
|
|
4476
4850
|
}
|
|
4477
4851
|
});
|
|
4478
4852
|
|
|
4479
|
-
observer.observe(
|
|
4853
|
+
observer.observe(element, {
|
|
4480
4854
|
attributes: true,
|
|
4481
4855
|
attributeFilter: [source],
|
|
4482
4856
|
});
|
|
@@ -4502,7 +4876,7 @@
|
|
|
4502
4876
|
/* @ignore */ static $inject = [$injectTokens.$provide, $injectTokens.$$sanitizeUriProvider];
|
|
4503
4877
|
|
|
4504
4878
|
/**
|
|
4505
|
-
* @param {import('../../interface.
|
|
4879
|
+
* @param {import('../../interface.ts').Provider} $provide
|
|
4506
4880
|
* @param {import('../sanitize/sanitize-uri.js').SanitizeUriProvider} $$sanitizeUriProvider
|
|
4507
4881
|
*/
|
|
4508
4882
|
constructor($provide, $$sanitizeUriProvider) {
|
|
@@ -4692,7 +5066,7 @@
|
|
|
4692
5066
|
/**
|
|
4693
5067
|
* @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
|
|
4694
5068
|
* or an object map of components where the keys are the names and the values are the component definition objects.
|
|
4695
|
-
* @param {import("../../interface.
|
|
5069
|
+
* @param {import("../../interface.ts").Component} options Component definition object (a simplified
|
|
4696
5070
|
* {directive definition object}),
|
|
4697
5071
|
* with the following properties (all optional):
|
|
4698
5072
|
*
|
|
@@ -5478,12 +5852,12 @@
|
|
|
5478
5852
|
createEventDirective(
|
|
5479
5853
|
$parse,
|
|
5480
5854
|
$exceptionHandler,
|
|
5481
|
-
window,
|
|
5482
5855
|
nName,
|
|
5483
5856
|
name,
|
|
5484
5857
|
),
|
|
5485
5858
|
);
|
|
5486
5859
|
} else {
|
|
5860
|
+
// isWindow
|
|
5487
5861
|
directives.push(
|
|
5488
5862
|
createWindowEventDirective(
|
|
5489
5863
|
$parse,
|
|
@@ -7473,7 +7847,7 @@
|
|
|
7473
7847
|
scope.$handler.watchers
|
|
7474
7848
|
.get(attrs[attrName])
|
|
7475
7849
|
?.forEach((watchFn) => {
|
|
7476
|
-
watchFn.listenerFn(val);
|
|
7850
|
+
watchFn.listenerFn(val, scope.$target);
|
|
7477
7851
|
});
|
|
7478
7852
|
}
|
|
7479
7853
|
}
|
|
@@ -7886,8 +8260,14 @@
|
|
|
7886
8260
|
* state (ng-dirty class). This method will also propagate to parent forms.
|
|
7887
8261
|
*/
|
|
7888
8262
|
$setDirty() {
|
|
7889
|
-
|
|
7890
|
-
|
|
8263
|
+
if (hasAnimate(this.$$element)) {
|
|
8264
|
+
this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
|
|
8265
|
+
this.$$animate.addClass(this.$$element, DIRTY_CLASS);
|
|
8266
|
+
} else {
|
|
8267
|
+
// Fallback for non-animated environments
|
|
8268
|
+
this.$$element.classList.remove(PRISTINE_CLASS);
|
|
8269
|
+
this.$$element.classList.add(DIRTY_CLASS);
|
|
8270
|
+
}
|
|
7891
8271
|
this.$dirty = true;
|
|
7892
8272
|
this.$pristine = false;
|
|
7893
8273
|
this.$$parentForm.$setDirty();
|
|
@@ -7906,11 +8286,18 @@
|
|
|
7906
8286
|
* saving or resetting it.
|
|
7907
8287
|
*/
|
|
7908
8288
|
$setPristine() {
|
|
7909
|
-
this.$$
|
|
7910
|
-
this.$$
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
8289
|
+
if (hasAnimate(this.$$element)) {
|
|
8290
|
+
this.$$animate.setClass(
|
|
8291
|
+
this.$$element,
|
|
8292
|
+
PRISTINE_CLASS,
|
|
8293
|
+
`${DIRTY_CLASS} ${SUBMITTED_CLASS}`,
|
|
8294
|
+
);
|
|
8295
|
+
} else {
|
|
8296
|
+
// Fallback for non-animated environments
|
|
8297
|
+
this.$$element.classList.remove(DIRTY_CLASS, SUBMITTED_CLASS);
|
|
8298
|
+
this.$$element.classList.add(PRISTINE_CLASS);
|
|
8299
|
+
}
|
|
8300
|
+
|
|
7914
8301
|
this.$dirty = false;
|
|
7915
8302
|
this.$pristine = true;
|
|
7916
8303
|
this.$submitted = false;
|
|
@@ -7948,7 +8335,11 @@
|
|
|
7948
8335
|
}
|
|
7949
8336
|
|
|
7950
8337
|
$$setSubmitted() {
|
|
7951
|
-
|
|
8338
|
+
if (hasAnimate(this.$$element)) {
|
|
8339
|
+
this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
|
|
8340
|
+
} else {
|
|
8341
|
+
this.$$element.classList.add(SUBMITTED_CLASS);
|
|
8342
|
+
}
|
|
7952
8343
|
this.$submitted = true;
|
|
7953
8344
|
this.$$controls.forEach((control) => {
|
|
7954
8345
|
if (control.$$setSubmitted) {
|
|
@@ -10503,9 +10894,9 @@
|
|
|
10503
10894
|
inputDirective.$inject = ["$filter", "$parse"];
|
|
10504
10895
|
|
|
10505
10896
|
/**
|
|
10506
|
-
* @param {
|
|
10507
|
-
* @param {
|
|
10508
|
-
* @returns {
|
|
10897
|
+
* @param {ng.FilterService} $filter
|
|
10898
|
+
* @param {ng.ParseService} $parse
|
|
10899
|
+
* @returns {ng.Directive}
|
|
10509
10900
|
*/
|
|
10510
10901
|
function inputDirective($filter, $parse) {
|
|
10511
10902
|
return {
|
|
@@ -10529,7 +10920,7 @@
|
|
|
10529
10920
|
}
|
|
10530
10921
|
|
|
10531
10922
|
/**
|
|
10532
|
-
* @returns {
|
|
10923
|
+
* @returns {ng.Directive}
|
|
10533
10924
|
*/
|
|
10534
10925
|
function hiddenInputBrowserCacheDirective() {
|
|
10535
10926
|
const valueProperty = {
|
|
@@ -10575,7 +10966,7 @@
|
|
|
10575
10966
|
const CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
|
|
10576
10967
|
|
|
10577
10968
|
/**
|
|
10578
|
-
* @returns {
|
|
10969
|
+
* @returns {ng.Directive}
|
|
10579
10970
|
*/
|
|
10580
10971
|
function ngValueDirective() {
|
|
10581
10972
|
/**
|
|
@@ -10599,15 +10990,15 @@
|
|
|
10599
10990
|
return {
|
|
10600
10991
|
restrict: "A",
|
|
10601
10992
|
priority: 100,
|
|
10602
|
-
compile(
|
|
10603
|
-
if (CONSTANT_VALUE_REGEXP.test(tplAttr
|
|
10604
|
-
return function
|
|
10605
|
-
const value = scope.$eval(attr
|
|
10993
|
+
compile(_, tplAttr) {
|
|
10994
|
+
if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
|
|
10995
|
+
return function (scope, elm, attr) {
|
|
10996
|
+
const value = scope.$eval(attr.ngValue);
|
|
10606
10997
|
updateElementValue(elm, attr, value);
|
|
10607
10998
|
};
|
|
10608
10999
|
}
|
|
10609
|
-
return function
|
|
10610
|
-
scope.$watch(attr
|
|
11000
|
+
return function (scope, elm, attr) {
|
|
11001
|
+
scope.$watch(attr.ngValue, (value) => {
|
|
10611
11002
|
updateElementValue(elm, attr, value);
|
|
10612
11003
|
});
|
|
10613
11004
|
};
|
|
@@ -11288,17 +11679,20 @@
|
|
|
11288
11679
|
/**
|
|
11289
11680
|
* @param {string} name
|
|
11290
11681
|
* @param {boolean|number} selector
|
|
11291
|
-
* @returns {
|
|
11682
|
+
* @returns {ng.DirectiveFactory}
|
|
11292
11683
|
*/
|
|
11293
11684
|
function classDirective(name, selector) {
|
|
11294
11685
|
name = `ngClass${name}`;
|
|
11295
11686
|
|
|
11687
|
+
/**
|
|
11688
|
+
* @returns {ng.Directive}
|
|
11689
|
+
*/
|
|
11296
11690
|
return function () {
|
|
11297
11691
|
return {
|
|
11298
11692
|
/**
|
|
11299
|
-
* @param {
|
|
11300
|
-
* @param {
|
|
11301
|
-
* @param {
|
|
11693
|
+
* @param {ng.Scope} scope
|
|
11694
|
+
* @param {HTMLElement} element
|
|
11695
|
+
* @param {ng.Attributes} attr
|
|
11302
11696
|
*/
|
|
11303
11697
|
link(scope, element, attr) {
|
|
11304
11698
|
let classCounts = getCacheData(element, "$classCounts");
|
|
@@ -11472,9 +11866,8 @@
|
|
|
11472
11866
|
*/
|
|
11473
11867
|
function ngCloakDirective() {
|
|
11474
11868
|
return {
|
|
11475
|
-
compile(
|
|
11869
|
+
compile(_, attr) {
|
|
11476
11870
|
attr.$set("ngCloak", undefined);
|
|
11477
|
-
element.classList.remove("ng-cloak");
|
|
11478
11871
|
},
|
|
11479
11872
|
};
|
|
11480
11873
|
}
|
|
@@ -11558,7 +11951,7 @@
|
|
|
11558
11951
|
ngIfDirective.$inject = ["$animate"];
|
|
11559
11952
|
/**
|
|
11560
11953
|
* @param {*} $animate
|
|
11561
|
-
* @returns {
|
|
11954
|
+
* @returns {ng.Directive}
|
|
11562
11955
|
*/
|
|
11563
11956
|
function ngIfDirective($animate) {
|
|
11564
11957
|
return {
|
|
@@ -11568,22 +11961,22 @@
|
|
|
11568
11961
|
restrict: "A",
|
|
11569
11962
|
/**
|
|
11570
11963
|
*
|
|
11571
|
-
* @param {
|
|
11964
|
+
* @param {ng.Scope} $scope
|
|
11572
11965
|
* @param {Element} $element
|
|
11573
|
-
* @param {
|
|
11574
|
-
* @param {
|
|
11966
|
+
* @param {ng.Attributes} $attr
|
|
11967
|
+
* @param {*} _ctrl
|
|
11575
11968
|
* @param {*} $transclude
|
|
11576
11969
|
*/
|
|
11577
11970
|
link($scope, $element, $attr, _ctrl, $transclude) {
|
|
11578
11971
|
/** @type {Element} */
|
|
11579
11972
|
let block;
|
|
11580
11973
|
|
|
11581
|
-
/** @type {
|
|
11974
|
+
/** @type {ng.Scope} */
|
|
11582
11975
|
let childScope;
|
|
11583
11976
|
|
|
11584
11977
|
let previousElements;
|
|
11585
11978
|
|
|
11586
|
-
$scope.$watch($attr
|
|
11979
|
+
$scope.$watch($attr.ngIf, (value) => {
|
|
11587
11980
|
if (value) {
|
|
11588
11981
|
if (!childScope) {
|
|
11589
11982
|
$transclude((clone, newScope) => {
|
|
@@ -11638,7 +12031,7 @@
|
|
|
11638
12031
|
* @param {import("../../services/anchor-scroll/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
|
|
11639
12032
|
* @param {*} $animate
|
|
11640
12033
|
* @param {import('../../services/exception/interface.ts').ErrorHandler} $exceptionHandler
|
|
11641
|
-
* @returns {import('../../interface.
|
|
12034
|
+
* @returns {import('../../interface.ts').Directive}
|
|
11642
12035
|
*/
|
|
11643
12036
|
function ngIncludeDirective(
|
|
11644
12037
|
$templateRequest,
|
|
@@ -13020,7 +13413,7 @@
|
|
|
13020
13413
|
const REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
|
|
13021
13414
|
|
|
13022
13415
|
/**
|
|
13023
|
-
* @type {Record<string, import("../../interface.
|
|
13416
|
+
* @type {Record<string, import("../../interface.ts").DirectiveFactory>}
|
|
13024
13417
|
*/
|
|
13025
13418
|
const ngAttributeAliasDirectives = {};
|
|
13026
13419
|
|
|
@@ -13593,364 +13986,6 @@
|
|
|
13593
13986
|
];
|
|
13594
13987
|
}
|
|
13595
13988
|
|
|
13596
|
-
/**
|
|
13597
|
-
* @readonly
|
|
13598
|
-
* @enum {number}
|
|
13599
|
-
*/
|
|
13600
|
-
const ASTType = {
|
|
13601
|
-
Program: 1,
|
|
13602
|
-
ExpressionStatement: 2,
|
|
13603
|
-
AssignmentExpression: 3,
|
|
13604
|
-
ConditionalExpression: 4,
|
|
13605
|
-
LogicalExpression: 5,
|
|
13606
|
-
BinaryExpression: 6,
|
|
13607
|
-
UnaryExpression: 7,
|
|
13608
|
-
CallExpression: 8,
|
|
13609
|
-
MemberExpression: 9,
|
|
13610
|
-
Identifier: 10,
|
|
13611
|
-
Literal: 11,
|
|
13612
|
-
ArrayExpression: 12,
|
|
13613
|
-
Property: 13,
|
|
13614
|
-
ObjectExpression: 14,
|
|
13615
|
-
ThisExpression: 15,
|
|
13616
|
-
LocalsExpression: 16,
|
|
13617
|
-
NGValueParameter: 17,
|
|
13618
|
-
};
|
|
13619
|
-
|
|
13620
|
-
const ADD_CLASS_SUFFIX = "-add";
|
|
13621
|
-
const REMOVE_CLASS_SUFFIX = "-remove";
|
|
13622
|
-
const EVENT_CLASS_PREFIX = "ng-";
|
|
13623
|
-
const ACTIVE_CLASS_SUFFIX = "-active";
|
|
13624
|
-
const PREPARE_CLASS_SUFFIX = "-prepare";
|
|
13625
|
-
|
|
13626
|
-
const NG_ANIMATE_CLASSNAME = "ng-animate";
|
|
13627
|
-
const NG_ANIMATE_CHILDREN_DATA = "$$ngAnimateChildren";
|
|
13628
|
-
let TRANSITION_PROP;
|
|
13629
|
-
let TRANSITIONEND_EVENT;
|
|
13630
|
-
let ANIMATION_PROP;
|
|
13631
|
-
let ANIMATIONEND_EVENT;
|
|
13632
|
-
|
|
13633
|
-
// If unprefixed events are not supported but webkit-prefixed are, use the latter.
|
|
13634
|
-
// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
|
|
13635
|
-
// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
|
|
13636
|
-
// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
|
|
13637
|
-
// Register both events in case `window.onanimationend` is not supported because of that,
|
|
13638
|
-
// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
|
|
13639
|
-
// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
|
|
13640
|
-
// therefore there is no reason to test anymore for other vendor prefixes:
|
|
13641
|
-
// http://caniuse.com/#search=transition
|
|
13642
|
-
if (
|
|
13643
|
-
window.ontransitionend === undefined &&
|
|
13644
|
-
window.onwebkittransitionend !== undefined
|
|
13645
|
-
) {
|
|
13646
|
-
TRANSITION_PROP = "WebkitTransition";
|
|
13647
|
-
TRANSITIONEND_EVENT = "webkitTransitionEnd transitionend";
|
|
13648
|
-
} else {
|
|
13649
|
-
TRANSITION_PROP = "transition";
|
|
13650
|
-
TRANSITIONEND_EVENT = "transitionend";
|
|
13651
|
-
}
|
|
13652
|
-
|
|
13653
|
-
if (
|
|
13654
|
-
window.onanimationend === undefined &&
|
|
13655
|
-
window.onwebkitanimationend !== undefined
|
|
13656
|
-
) {
|
|
13657
|
-
ANIMATION_PROP = "WebkitAnimation";
|
|
13658
|
-
ANIMATIONEND_EVENT = "webkitAnimationEnd animationend";
|
|
13659
|
-
} else {
|
|
13660
|
-
ANIMATION_PROP = "animation";
|
|
13661
|
-
ANIMATIONEND_EVENT = "animationend";
|
|
13662
|
-
}
|
|
13663
|
-
|
|
13664
|
-
const DURATION_KEY = "Duration";
|
|
13665
|
-
const PROPERTY_KEY = ASTType.Property;
|
|
13666
|
-
const DELAY_KEY = "Delay";
|
|
13667
|
-
const TIMING_KEY = "TimingFunction";
|
|
13668
|
-
const ANIMATION_ITERATION_COUNT_KEY = "IterationCount";
|
|
13669
|
-
const ANIMATION_PLAYSTATE_KEY = "PlayState";
|
|
13670
|
-
const SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
|
|
13671
|
-
|
|
13672
|
-
const ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
|
|
13673
|
-
const ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
|
|
13674
|
-
const TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
|
|
13675
|
-
const TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
|
|
13676
|
-
|
|
13677
|
-
const ngMinErr$1 = minErr("ng");
|
|
13678
|
-
function assertArg(arg, name, reason) {
|
|
13679
|
-
if (!arg) {
|
|
13680
|
-
throw ngMinErr$1(
|
|
13681
|
-
"areq",
|
|
13682
|
-
"Argument '{0}' is {1}",
|
|
13683
|
-
name || "?",
|
|
13684
|
-
reason,
|
|
13685
|
-
);
|
|
13686
|
-
}
|
|
13687
|
-
return arg;
|
|
13688
|
-
}
|
|
13689
|
-
|
|
13690
|
-
function packageStyles(options) {
|
|
13691
|
-
const styles = {};
|
|
13692
|
-
if (options && (options.to || options.from)) {
|
|
13693
|
-
styles.to = options.to;
|
|
13694
|
-
styles.from = options.from;
|
|
13695
|
-
}
|
|
13696
|
-
return styles;
|
|
13697
|
-
}
|
|
13698
|
-
|
|
13699
|
-
function pendClasses(classes, fix, isPrefix) {
|
|
13700
|
-
let className = "";
|
|
13701
|
-
|
|
13702
|
-
classes = Array.isArray(classes)
|
|
13703
|
-
? classes
|
|
13704
|
-
: classes && isString(classes) && classes.length
|
|
13705
|
-
? classes.split(/\s+/)
|
|
13706
|
-
: [];
|
|
13707
|
-
classes.forEach((klass, i) => {
|
|
13708
|
-
if (klass && klass.length > 0) {
|
|
13709
|
-
className += i > 0 ? " " : "";
|
|
13710
|
-
className += isPrefix ? fix + klass : klass + fix;
|
|
13711
|
-
}
|
|
13712
|
-
});
|
|
13713
|
-
return className;
|
|
13714
|
-
}
|
|
13715
|
-
|
|
13716
|
-
function removeFromArray(arr, val) {
|
|
13717
|
-
const index = arr.indexOf(val);
|
|
13718
|
-
if (val >= 0) {
|
|
13719
|
-
arr.splice(index, 1);
|
|
13720
|
-
}
|
|
13721
|
-
}
|
|
13722
|
-
|
|
13723
|
-
/**
|
|
13724
|
-
*
|
|
13725
|
-
* @param {NodeList|Node} element
|
|
13726
|
-
* @returns {Node[]|Node|undefined}
|
|
13727
|
-
*/
|
|
13728
|
-
function stripCommentsFromElement(element) {
|
|
13729
|
-
if (element instanceof NodeList) {
|
|
13730
|
-
return Array.from(element).filter((x) => x.nodeType == Node.ELEMENT_NODE);
|
|
13731
|
-
} else if (element.nodeType === Node.ELEMENT_NODE) {
|
|
13732
|
-
return /** @type {Node} */ (element);
|
|
13733
|
-
} else {
|
|
13734
|
-
return undefined;
|
|
13735
|
-
}
|
|
13736
|
-
}
|
|
13737
|
-
|
|
13738
|
-
/**
|
|
13739
|
-
* @param {NodeList|Node} element
|
|
13740
|
-
* @returns {Node}
|
|
13741
|
-
*/
|
|
13742
|
-
function extractElementNode(element) {
|
|
13743
|
-
if (!element) return /** @type {Node} */ (element);
|
|
13744
|
-
for (let i = 0; i < /** @type {NodeList} */ (element).length; i++) {
|
|
13745
|
-
const elm = element[i];
|
|
13746
|
-
if (elm.nodeType === Node.ELEMENT_NODE) {
|
|
13747
|
-
return elm;
|
|
13748
|
-
}
|
|
13749
|
-
}
|
|
13750
|
-
}
|
|
13751
|
-
|
|
13752
|
-
function applyAnimationClassesFactory() {
|
|
13753
|
-
return function (element, options) {
|
|
13754
|
-
if (options.addClass) {
|
|
13755
|
-
element.classList.add(...options.addClass.trim().split(" "));
|
|
13756
|
-
options.addClass = null;
|
|
13757
|
-
}
|
|
13758
|
-
if (options.removeClass) {
|
|
13759
|
-
element.classList.remove(...options.removeClass.trim().split(" "));
|
|
13760
|
-
options.removeClass = null;
|
|
13761
|
-
}
|
|
13762
|
-
};
|
|
13763
|
-
}
|
|
13764
|
-
|
|
13765
|
-
function prepareAnimationOptions(options) {
|
|
13766
|
-
options = options || {};
|
|
13767
|
-
if (!options.$$prepared) {
|
|
13768
|
-
let domOperation = options.domOperation || (() => {});
|
|
13769
|
-
options.domOperation = function () {
|
|
13770
|
-
options.$$domOperationFired = true;
|
|
13771
|
-
domOperation();
|
|
13772
|
-
domOperation = () => {};
|
|
13773
|
-
};
|
|
13774
|
-
options.$$prepared = true;
|
|
13775
|
-
}
|
|
13776
|
-
return options;
|
|
13777
|
-
}
|
|
13778
|
-
|
|
13779
|
-
function applyAnimationStyles(element, options) {
|
|
13780
|
-
applyAnimationFromStyles(element, options);
|
|
13781
|
-
applyAnimationToStyles(element, options);
|
|
13782
|
-
}
|
|
13783
|
-
|
|
13784
|
-
function applyAnimationFromStyles(element, options) {
|
|
13785
|
-
if (options.from) {
|
|
13786
|
-
//element.css(options.from);
|
|
13787
|
-
options.from = null;
|
|
13788
|
-
}
|
|
13789
|
-
}
|
|
13790
|
-
|
|
13791
|
-
function applyAnimationToStyles(element, options) {
|
|
13792
|
-
if (options.to) {
|
|
13793
|
-
//element.css(options.to);
|
|
13794
|
-
options.to = null;
|
|
13795
|
-
}
|
|
13796
|
-
}
|
|
13797
|
-
|
|
13798
|
-
function mergeAnimationDetails(element, oldAnimation, newAnimation) {
|
|
13799
|
-
const target = oldAnimation.options || {};
|
|
13800
|
-
const newOptions = newAnimation.options || {};
|
|
13801
|
-
|
|
13802
|
-
const toAdd = `${target.addClass || ""} ${newOptions.addClass || ""}`;
|
|
13803
|
-
const toRemove = `${target.removeClass || ""} ${newOptions.removeClass || ""}`;
|
|
13804
|
-
const classes = resolveElementClasses(
|
|
13805
|
-
element.getAttribute("class"),
|
|
13806
|
-
toAdd,
|
|
13807
|
-
toRemove,
|
|
13808
|
-
);
|
|
13809
|
-
|
|
13810
|
-
if (newOptions.preparationClasses) {
|
|
13811
|
-
target.preparationClasses = concatWithSpace(
|
|
13812
|
-
newOptions.preparationClasses,
|
|
13813
|
-
target.preparationClasses,
|
|
13814
|
-
);
|
|
13815
|
-
delete newOptions.preparationClasses;
|
|
13816
|
-
}
|
|
13817
|
-
|
|
13818
|
-
extend(target, newOptions);
|
|
13819
|
-
|
|
13820
|
-
if (classes.addClass) {
|
|
13821
|
-
target.addClass = classes.addClass;
|
|
13822
|
-
} else {
|
|
13823
|
-
target.addClass = null;
|
|
13824
|
-
}
|
|
13825
|
-
|
|
13826
|
-
if (classes.removeClass) {
|
|
13827
|
-
target.removeClass = classes.removeClass;
|
|
13828
|
-
} else {
|
|
13829
|
-
target.removeClass = null;
|
|
13830
|
-
}
|
|
13831
|
-
|
|
13832
|
-
oldAnimation.addClass = target.addClass;
|
|
13833
|
-
oldAnimation.removeClass = target.removeClass;
|
|
13834
|
-
|
|
13835
|
-
return target;
|
|
13836
|
-
}
|
|
13837
|
-
|
|
13838
|
-
function resolveElementClasses(existing, toAdd, toRemove) {
|
|
13839
|
-
const ADD_CLASS = 1;
|
|
13840
|
-
const REMOVE_CLASS = -1;
|
|
13841
|
-
|
|
13842
|
-
const flags = {};
|
|
13843
|
-
existing = splitClassesToLookup(existing);
|
|
13844
|
-
|
|
13845
|
-
toAdd = splitClassesToLookup(toAdd);
|
|
13846
|
-
Object.keys(toAdd).forEach((key) => {
|
|
13847
|
-
flags[key] = ADD_CLASS;
|
|
13848
|
-
});
|
|
13849
|
-
|
|
13850
|
-
toRemove = splitClassesToLookup(toRemove);
|
|
13851
|
-
Object.keys(toRemove).forEach((key) => {
|
|
13852
|
-
flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
|
|
13853
|
-
});
|
|
13854
|
-
|
|
13855
|
-
const classes = {
|
|
13856
|
-
addClass: "",
|
|
13857
|
-
removeClass: "",
|
|
13858
|
-
};
|
|
13859
|
-
|
|
13860
|
-
Object.entries(flags).forEach(([klass, val]) => {
|
|
13861
|
-
let prop, allow;
|
|
13862
|
-
if (val === ADD_CLASS) {
|
|
13863
|
-
prop = "addClass";
|
|
13864
|
-
allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
|
|
13865
|
-
} else if (val === REMOVE_CLASS) {
|
|
13866
|
-
prop = "removeClass";
|
|
13867
|
-
allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
|
|
13868
|
-
}
|
|
13869
|
-
if (allow) {
|
|
13870
|
-
if (classes[prop].length) {
|
|
13871
|
-
classes[prop] += " ";
|
|
13872
|
-
}
|
|
13873
|
-
classes[prop] += klass;
|
|
13874
|
-
}
|
|
13875
|
-
});
|
|
13876
|
-
|
|
13877
|
-
function splitClassesToLookup(classes) {
|
|
13878
|
-
if (isString(classes)) {
|
|
13879
|
-
classes = classes.trim().split(" ");
|
|
13880
|
-
}
|
|
13881
|
-
|
|
13882
|
-
const obj = {};
|
|
13883
|
-
if (classes) {
|
|
13884
|
-
classes.forEach((klass) => {
|
|
13885
|
-
// sometimes the split leaves empty string values
|
|
13886
|
-
// incase extra spaces were applied to the options
|
|
13887
|
-
if (klass.length) {
|
|
13888
|
-
obj[klass] = true;
|
|
13889
|
-
}
|
|
13890
|
-
});
|
|
13891
|
-
}
|
|
13892
|
-
return obj;
|
|
13893
|
-
}
|
|
13894
|
-
|
|
13895
|
-
return classes;
|
|
13896
|
-
}
|
|
13897
|
-
|
|
13898
|
-
function applyGeneratedPreparationClasses(element, event, options) {
|
|
13899
|
-
let classes = "";
|
|
13900
|
-
if (event) {
|
|
13901
|
-
classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
|
|
13902
|
-
}
|
|
13903
|
-
if (options.addClass) {
|
|
13904
|
-
classes = concatWithSpace(
|
|
13905
|
-
classes,
|
|
13906
|
-
pendClasses(options.addClass, ADD_CLASS_SUFFIX),
|
|
13907
|
-
);
|
|
13908
|
-
}
|
|
13909
|
-
if (options.removeClass) {
|
|
13910
|
-
classes = concatWithSpace(
|
|
13911
|
-
classes,
|
|
13912
|
-
pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX),
|
|
13913
|
-
);
|
|
13914
|
-
}
|
|
13915
|
-
if (classes.length) {
|
|
13916
|
-
options.preparationClasses = classes;
|
|
13917
|
-
element.className += ` ${classes}`;
|
|
13918
|
-
}
|
|
13919
|
-
}
|
|
13920
|
-
|
|
13921
|
-
function clearGeneratedClasses(element, options) {
|
|
13922
|
-
if (options.preparationClasses) {
|
|
13923
|
-
options.preparationClasses
|
|
13924
|
-
.split(" ")
|
|
13925
|
-
.forEach((cls) => element.classList.remove(cls));
|
|
13926
|
-
options.preparationClasses = null;
|
|
13927
|
-
}
|
|
13928
|
-
if (options.activeClasses) {
|
|
13929
|
-
options.activeClasses
|
|
13930
|
-
.split(" ")
|
|
13931
|
-
.forEach((cls) => element.classList.remove(cls));
|
|
13932
|
-
options.activeClasses = null;
|
|
13933
|
-
}
|
|
13934
|
-
}
|
|
13935
|
-
|
|
13936
|
-
function blockKeyframeAnimations(node, applyBlock) {
|
|
13937
|
-
const value = applyBlock ? "paused" : "";
|
|
13938
|
-
const key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
|
|
13939
|
-
applyInlineStyle(node, [key, value]);
|
|
13940
|
-
return [key, value];
|
|
13941
|
-
}
|
|
13942
|
-
|
|
13943
|
-
function applyInlineStyle(node, styleTuple) {
|
|
13944
|
-
const prop = styleTuple[0];
|
|
13945
|
-
node.style[prop] = styleTuple[1];
|
|
13946
|
-
}
|
|
13947
|
-
|
|
13948
|
-
function concatWithSpace(a, b) {
|
|
13949
|
-
if (!a) return b;
|
|
13950
|
-
if (!b) return a;
|
|
13951
|
-
return `${a} ${b}`;
|
|
13952
|
-
}
|
|
13953
|
-
|
|
13954
13989
|
/** @typedef {"enter"|"leave"|"move"|"addClass"|"setClass"|"removeClass"} AnimationMethod */
|
|
13955
13990
|
|
|
13956
13991
|
/**
|
|
@@ -13985,7 +14020,7 @@
|
|
|
13985
14020
|
|
|
13986
14021
|
AnimateProvider.$inject = ["$provide"];
|
|
13987
14022
|
|
|
13988
|
-
/** @param {
|
|
14023
|
+
/** @param {ng.ProvideService} $provide */
|
|
13989
14024
|
function AnimateProvider($provide) {
|
|
13990
14025
|
const provider = this;
|
|
13991
14026
|
let classNameFilter = null;
|
|
@@ -14260,7 +14295,7 @@
|
|
|
14260
14295
|
* Note that this does not cancel the underlying operation, e.g. the setting of classes or
|
|
14261
14296
|
* adding the element to the DOM.
|
|
14262
14297
|
*
|
|
14263
|
-
* @param {import('./animate-runner.js').AnimateRunner} runner An animation runner returned by an $animate function.
|
|
14298
|
+
* @param {import('./runner/animate-runner.js').AnimateRunner} runner An animation runner returned by an $animate function.
|
|
14264
14299
|
*
|
|
14265
14300
|
* @example
|
|
14266
14301
|
<example module="animationExample" deps="angular-animate.js" animations="true" name="animate-cancel">
|
|
@@ -14338,13 +14373,13 @@
|
|
|
14338
14373
|
*
|
|
14339
14374
|
* @param {Element} element - the element which will be inserted into the DOM
|
|
14340
14375
|
* @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
|
|
14341
|
-
* @param {Element} after - after the sibling element after which the element will be appended
|
|
14376
|
+
* @param {Element} [after] - after the sibling element after which the element will be appended
|
|
14342
14377
|
* @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
|
|
14343
|
-
* @returns {import('./animate-runner.js').AnimateRunner} the animation runner
|
|
14378
|
+
* @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
14344
14379
|
*/
|
|
14345
14380
|
enter(element, parent, after, options) {
|
|
14346
14381
|
parent = parent || after.parentElement;
|
|
14347
|
-
|
|
14382
|
+
animatedomInsert(element, parent, after);
|
|
14348
14383
|
return $$animateQueue.push(
|
|
14349
14384
|
element,
|
|
14350
14385
|
"enter",
|
|
@@ -14362,11 +14397,11 @@
|
|
|
14362
14397
|
* @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
|
|
14363
14398
|
* @param {Element} after - after the sibling element after which the element will be appended
|
|
14364
14399
|
* @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
|
|
14365
|
-
* @returns {import('./animate-runner.js').AnimateRunner} the animation runner
|
|
14400
|
+
* @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
14366
14401
|
*/
|
|
14367
14402
|
move(element, parent, after, options) {
|
|
14368
14403
|
parent = parent || after.parentElement;
|
|
14369
|
-
|
|
14404
|
+
animatedomInsert(element, parent, after);
|
|
14370
14405
|
return $$animateQueue.push(
|
|
14371
14406
|
element,
|
|
14372
14407
|
"move",
|
|
@@ -14381,7 +14416,7 @@
|
|
|
14381
14416
|
*
|
|
14382
14417
|
* @param {Element} element the element which will be removed from the DOM
|
|
14383
14418
|
* @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
|
|
14384
|
-
* @returns {import('./animate-runner.js').AnimateRunner} the animation runner
|
|
14419
|
+
* @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
14385
14420
|
*/
|
|
14386
14421
|
leave(element, options) {
|
|
14387
14422
|
return $$animateQueue.push(
|
|
@@ -14410,7 +14445,7 @@
|
|
|
14410
14445
|
* @param {Element} element the element which the CSS classes will be applied to
|
|
14411
14446
|
* @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
|
|
14412
14447
|
* @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
|
|
14413
|
-
* @return {import('./animate-runner.js').AnimateRunner}} animationRunner the animation runner
|
|
14448
|
+
* @return {import('./runner/animate-runner.js').AnimateRunner}} animationRunner the animation runner
|
|
14414
14449
|
*/
|
|
14415
14450
|
addClass(element, className, options) {
|
|
14416
14451
|
options = prepareAnimateOptions(options);
|
|
@@ -14429,7 +14464,7 @@
|
|
|
14429
14464
|
* @param {Element} element the element which the CSS classes will be applied to
|
|
14430
14465
|
* @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
|
|
14431
14466
|
* @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
|
|
14432
|
-
* @return {import('./animate-runner.js').AnimateRunner} animationRunner the animation runner
|
|
14467
|
+
* @return {import('./runner/animate-runner.js').AnimateRunner} animationRunner the animation runner
|
|
14433
14468
|
*/
|
|
14434
14469
|
removeClass(element, className, options) {
|
|
14435
14470
|
options = prepareAnimateOptions(options);
|
|
@@ -14450,7 +14485,7 @@
|
|
|
14450
14485
|
* @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
|
|
14451
14486
|
* @param {object=} options an optional collection of options/styles that will be applied to the element.
|
|
14452
14487
|
*
|
|
14453
|
-
* @return {import('./animate-runner.js').AnimateRunner} the animation runner
|
|
14488
|
+
* @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
14454
14489
|
*/
|
|
14455
14490
|
setClass(element, add, remove, options) {
|
|
14456
14491
|
options = prepareAnimateOptions(options);
|
|
@@ -14478,7 +14513,7 @@
|
|
|
14478
14513
|
* }
|
|
14479
14514
|
* });
|
|
14480
14515
|
* ```
|
|
14481
|
-
* @return {import('./animate-runner.js').AnimateRunner} the animation runner
|
|
14516
|
+
* @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
|
|
14482
14517
|
*/
|
|
14483
14518
|
animate(element, from, to, className, options) {
|
|
14484
14519
|
options = prepareAnimateOptions(options);
|
|
@@ -14494,200 +14529,6 @@
|
|
|
14494
14529
|
];
|
|
14495
14530
|
}
|
|
14496
14531
|
|
|
14497
|
-
function AnimateAsyncRunFactoryProvider() {
|
|
14498
|
-
this.$get = [
|
|
14499
|
-
function () {
|
|
14500
|
-
let waitQueue = [];
|
|
14501
|
-
|
|
14502
|
-
function waitForTick(fn) {
|
|
14503
|
-
waitQueue.push(fn);
|
|
14504
|
-
if (waitQueue.length > 1) return;
|
|
14505
|
-
window.requestAnimationFrame(function () {
|
|
14506
|
-
for (let i = 0; i < waitQueue.length; i++) {
|
|
14507
|
-
waitQueue[i]();
|
|
14508
|
-
}
|
|
14509
|
-
waitQueue = [];
|
|
14510
|
-
});
|
|
14511
|
-
}
|
|
14512
|
-
|
|
14513
|
-
return function () {
|
|
14514
|
-
let passed = false;
|
|
14515
|
-
waitForTick(function () {
|
|
14516
|
-
passed = true;
|
|
14517
|
-
});
|
|
14518
|
-
return function (callback) {
|
|
14519
|
-
if (passed) {
|
|
14520
|
-
callback();
|
|
14521
|
-
} else {
|
|
14522
|
-
waitForTick(callback);
|
|
14523
|
-
}
|
|
14524
|
-
};
|
|
14525
|
-
};
|
|
14526
|
-
},
|
|
14527
|
-
];
|
|
14528
|
-
}
|
|
14529
|
-
|
|
14530
|
-
const INITIAL_STATE = 0;
|
|
14531
|
-
const DONE_PENDING_STATE = 1;
|
|
14532
|
-
const DONE_COMPLETE_STATE = 2;
|
|
14533
|
-
let $$animateAsyncRun;
|
|
14534
|
-
|
|
14535
|
-
function AnimateRunnerFactoryProvider() {
|
|
14536
|
-
this.$get = [
|
|
14537
|
-
"$$animateAsyncRun",
|
|
14538
|
-
function (animateAsyncRun) {
|
|
14539
|
-
$$animateAsyncRun = animateAsyncRun;
|
|
14540
|
-
return AnimateRunner;
|
|
14541
|
-
},
|
|
14542
|
-
];
|
|
14543
|
-
}
|
|
14544
|
-
|
|
14545
|
-
class AnimateRunner {
|
|
14546
|
-
static chain(chain, callback) {
|
|
14547
|
-
let index = 0;
|
|
14548
|
-
|
|
14549
|
-
function next() {
|
|
14550
|
-
if (index === chain.length) {
|
|
14551
|
-
callback(true);
|
|
14552
|
-
return;
|
|
14553
|
-
}
|
|
14554
|
-
|
|
14555
|
-
chain[index]((response) => {
|
|
14556
|
-
if (response === false) {
|
|
14557
|
-
callback(false);
|
|
14558
|
-
return;
|
|
14559
|
-
}
|
|
14560
|
-
index++;
|
|
14561
|
-
next();
|
|
14562
|
-
});
|
|
14563
|
-
}
|
|
14564
|
-
|
|
14565
|
-
next();
|
|
14566
|
-
}
|
|
14567
|
-
|
|
14568
|
-
static all(runners, callback) {
|
|
14569
|
-
let count = 0;
|
|
14570
|
-
let status = true;
|
|
14571
|
-
|
|
14572
|
-
runners.forEach((runner) => {
|
|
14573
|
-
runner.done(onProgress);
|
|
14574
|
-
});
|
|
14575
|
-
|
|
14576
|
-
function onProgress(response) {
|
|
14577
|
-
status = status && response;
|
|
14578
|
-
if (++count === runners.length) {
|
|
14579
|
-
callback(status);
|
|
14580
|
-
}
|
|
14581
|
-
}
|
|
14582
|
-
}
|
|
14583
|
-
|
|
14584
|
-
constructor(host) {
|
|
14585
|
-
this.setHost(host);
|
|
14586
|
-
|
|
14587
|
-
const rafTick = $$animateAsyncRun();
|
|
14588
|
-
const timeoutTick = (fn) => {
|
|
14589
|
-
setTimeout(fn, 0, false);
|
|
14590
|
-
};
|
|
14591
|
-
|
|
14592
|
-
this._doneCallbacks = [];
|
|
14593
|
-
this._tick = (fn) => {
|
|
14594
|
-
if (document.hidden) {
|
|
14595
|
-
timeoutTick(fn);
|
|
14596
|
-
} else {
|
|
14597
|
-
rafTick(fn);
|
|
14598
|
-
}
|
|
14599
|
-
};
|
|
14600
|
-
this._state = 0;
|
|
14601
|
-
}
|
|
14602
|
-
|
|
14603
|
-
setHost(host) {
|
|
14604
|
-
this.host = host || {};
|
|
14605
|
-
}
|
|
14606
|
-
|
|
14607
|
-
done(fn) {
|
|
14608
|
-
if (this._state === DONE_COMPLETE_STATE) {
|
|
14609
|
-
fn();
|
|
14610
|
-
} else {
|
|
14611
|
-
this._doneCallbacks.push(fn);
|
|
14612
|
-
}
|
|
14613
|
-
}
|
|
14614
|
-
|
|
14615
|
-
progress() {}
|
|
14616
|
-
|
|
14617
|
-
getPromise() {
|
|
14618
|
-
if (!this.promise) {
|
|
14619
|
-
const self = this;
|
|
14620
|
-
this.promise = new Promise((resolve, reject) => {
|
|
14621
|
-
self.done((status) => {
|
|
14622
|
-
if (status === false) {
|
|
14623
|
-
reject();
|
|
14624
|
-
} else {
|
|
14625
|
-
resolve();
|
|
14626
|
-
}
|
|
14627
|
-
});
|
|
14628
|
-
});
|
|
14629
|
-
}
|
|
14630
|
-
return this.promise;
|
|
14631
|
-
}
|
|
14632
|
-
|
|
14633
|
-
then(resolveHandler, rejectHandler) {
|
|
14634
|
-
return this.getPromise().then(resolveHandler, rejectHandler);
|
|
14635
|
-
}
|
|
14636
|
-
|
|
14637
|
-
catch(handler) {
|
|
14638
|
-
return this.getPromise().catch(handler);
|
|
14639
|
-
}
|
|
14640
|
-
|
|
14641
|
-
finally(handler) {
|
|
14642
|
-
return this.getPromise().finally(handler);
|
|
14643
|
-
}
|
|
14644
|
-
|
|
14645
|
-
pause() {
|
|
14646
|
-
if (this.host.pause) {
|
|
14647
|
-
this.host.pause();
|
|
14648
|
-
}
|
|
14649
|
-
}
|
|
14650
|
-
|
|
14651
|
-
resume() {
|
|
14652
|
-
if (this.host.resume) {
|
|
14653
|
-
this.host.resume();
|
|
14654
|
-
}
|
|
14655
|
-
}
|
|
14656
|
-
|
|
14657
|
-
end() {
|
|
14658
|
-
if (this.host.end) {
|
|
14659
|
-
this.host.end();
|
|
14660
|
-
}
|
|
14661
|
-
this._resolve(true);
|
|
14662
|
-
}
|
|
14663
|
-
|
|
14664
|
-
cancel() {
|
|
14665
|
-
if (this.host.cancel) {
|
|
14666
|
-
this.host.cancel();
|
|
14667
|
-
}
|
|
14668
|
-
this._resolve(false);
|
|
14669
|
-
}
|
|
14670
|
-
|
|
14671
|
-
complete(response) {
|
|
14672
|
-
if (this._state === INITIAL_STATE) {
|
|
14673
|
-
this._state = DONE_PENDING_STATE;
|
|
14674
|
-
this._tick(() => {
|
|
14675
|
-
this._resolve(response);
|
|
14676
|
-
});
|
|
14677
|
-
}
|
|
14678
|
-
}
|
|
14679
|
-
|
|
14680
|
-
_resolve(response) {
|
|
14681
|
-
if (this._state !== DONE_COMPLETE_STATE) {
|
|
14682
|
-
this._doneCallbacks.forEach((fn) => {
|
|
14683
|
-
fn(response);
|
|
14684
|
-
});
|
|
14685
|
-
this._doneCallbacks.length = 0;
|
|
14686
|
-
this._state = DONE_COMPLETE_STATE;
|
|
14687
|
-
}
|
|
14688
|
-
}
|
|
14689
|
-
}
|
|
14690
|
-
|
|
14691
14532
|
/**
|
|
14692
14533
|
* Provides an instance of a cache that can be used to store and retrieve template content.
|
|
14693
14534
|
*/
|
|
@@ -15267,7 +15108,7 @@
|
|
|
15267
15108
|
/* @ignore */ static $inject = [$injectTokens.$provide];
|
|
15268
15109
|
|
|
15269
15110
|
/**
|
|
15270
|
-
* @param {
|
|
15111
|
+
* @param {ng.ProvideService} $provide
|
|
15271
15112
|
*/
|
|
15272
15113
|
constructor($provide) {
|
|
15273
15114
|
this.$provide = $provide;
|
|
@@ -17816,7 +17657,7 @@
|
|
|
17816
17657
|
return concat.join("");
|
|
17817
17658
|
};
|
|
17818
17659
|
|
|
17819
|
-
return /**@type {import("./interface.
|
|
17660
|
+
return /**@type {import("./interface.ts").InterpolationFunction} */ extend(
|
|
17820
17661
|
(context, cb) => {
|
|
17821
17662
|
let i = 0;
|
|
17822
17663
|
const ii = expressions.length;
|
|
@@ -19484,7 +19325,7 @@
|
|
|
19484
19325
|
/**
|
|
19485
19326
|
* Registers a callback to be called when the URL changes.
|
|
19486
19327
|
*
|
|
19487
|
-
* @param {import("./interface.
|
|
19328
|
+
* @param {import("./interface.ts").UrlChangeListener} callback - The callback function to register.
|
|
19488
19329
|
* @returns void
|
|
19489
19330
|
*/
|
|
19490
19331
|
#onUrlChange(callback) {
|
|
@@ -19512,8 +19353,6 @@
|
|
|
19512
19353
|
* @returns {Location}
|
|
19513
19354
|
*/
|
|
19514
19355
|
($rootScope, $rootElement) => {
|
|
19515
|
-
/** @type {Location} */
|
|
19516
|
-
let $location;
|
|
19517
19356
|
const baseHref = getBaseHref(); // if base[href] is undefined, it defaults to ''
|
|
19518
19357
|
const initialUrl = trimEmptyHash(window.location.href);
|
|
19519
19358
|
let appBase;
|
|
@@ -19531,7 +19370,7 @@
|
|
|
19531
19370
|
}
|
|
19532
19371
|
const appBaseNoFile = stripFile(appBase);
|
|
19533
19372
|
|
|
19534
|
-
$location = new Location(
|
|
19373
|
+
const $location = new Location(
|
|
19535
19374
|
appBase,
|
|
19536
19375
|
appBaseNoFile,
|
|
19537
19376
|
this.html5ModeConf.enabled,
|
|
@@ -20077,16 +19916,9 @@
|
|
|
20077
19916
|
*/
|
|
20078
19917
|
let $parse;
|
|
20079
19918
|
|
|
20080
|
-
/**@type {
|
|
19919
|
+
/**@type {ng.ExceptionHandlerService} */
|
|
20081
19920
|
let $exceptionHandler;
|
|
20082
19921
|
|
|
20083
|
-
/**
|
|
20084
|
-
* @typedef {Object} AsyncQueueTask
|
|
20085
|
-
* @property {Scope} handler
|
|
20086
|
-
* @property {Function} fn
|
|
20087
|
-
* @property {Object} locals
|
|
20088
|
-
*/
|
|
20089
|
-
|
|
20090
19922
|
const $postUpdateQueue = [];
|
|
20091
19923
|
|
|
20092
19924
|
class RootScopeProvider {
|
|
@@ -20095,11 +19927,11 @@
|
|
|
20095
19927
|
}
|
|
20096
19928
|
|
|
20097
19929
|
$get = [
|
|
20098
|
-
|
|
20099
|
-
|
|
19930
|
+
$injectTokens.$exceptionHandler,
|
|
19931
|
+
$injectTokens.$parse,
|
|
20100
19932
|
/**
|
|
20101
|
-
* @param {
|
|
20102
|
-
* @param {
|
|
19933
|
+
* @param {ng.ExceptionHandlerService} exceptionHandler
|
|
19934
|
+
* @param {ng.ParseService} parse
|
|
20103
19935
|
*/
|
|
20104
19936
|
(exceptionHandler, parse) => {
|
|
20105
19937
|
$exceptionHandler = exceptionHandler;
|
|
@@ -20128,6 +19960,9 @@
|
|
|
20128
19960
|
}
|
|
20129
19961
|
|
|
20130
19962
|
if (typeof target === "object") {
|
|
19963
|
+
if (isUnsafeGlobal(target)) {
|
|
19964
|
+
return target;
|
|
19965
|
+
}
|
|
20131
19966
|
const proxy = new Proxy(target, context || new Scope());
|
|
20132
19967
|
for (const key in target) {
|
|
20133
19968
|
if (hasOwn(target, key)) {
|
|
@@ -20145,7 +19980,7 @@
|
|
|
20145
19980
|
target[key] = createScope(target[key], proxy.$handler);
|
|
20146
19981
|
}
|
|
20147
19982
|
} catch {
|
|
20148
|
-
|
|
19983
|
+
/* empty */
|
|
20149
19984
|
}
|
|
20150
19985
|
}
|
|
20151
19986
|
}
|
|
@@ -20157,25 +19992,43 @@
|
|
|
20157
19992
|
}
|
|
20158
19993
|
|
|
20159
19994
|
/**
|
|
20160
|
-
*
|
|
20161
|
-
* @
|
|
20162
|
-
* @property {Object} originalTarget - The original target object.
|
|
20163
|
-
* @property {ListenerFunction} listenerFn - The function invoked when changes are detected.
|
|
20164
|
-
* @property {import("../parse/interface.ts").CompiledExpression} watchFn
|
|
20165
|
-
* @property {number} id - Deregistration id
|
|
20166
|
-
* @property {number} scopeId - The scope that created the Listener
|
|
20167
|
-
* @property {string[]} property
|
|
20168
|
-
* @property {string} [watchProp] - The original property to watch if different from observed key
|
|
20169
|
-
* @property {Proxy} [foreignListener]
|
|
20170
|
-
*
|
|
19995
|
+
* @param {any} target
|
|
19996
|
+
* @returns {boolean}
|
|
20171
19997
|
*/
|
|
19998
|
+
function isUnsafeGlobal(target) {
|
|
19999
|
+
if (target == null) return false;
|
|
20000
|
+
const t = typeof target;
|
|
20001
|
+
if (t !== "object" && t !== "function") return false;
|
|
20172
20002
|
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20003
|
+
const g = globalThis;
|
|
20004
|
+
if (
|
|
20005
|
+
target === g ||
|
|
20006
|
+
target === g.window ||
|
|
20007
|
+
target === g.document ||
|
|
20008
|
+
target === g.self ||
|
|
20009
|
+
target === g.frames
|
|
20010
|
+
) {
|
|
20011
|
+
return true;
|
|
20012
|
+
}
|
|
20013
|
+
|
|
20014
|
+
// DOM / browser host object checks
|
|
20015
|
+
if (
|
|
20016
|
+
(typeof Window !== "undefined" && target instanceof Window) ||
|
|
20017
|
+
(typeof Document !== "undefined" && target instanceof Document) ||
|
|
20018
|
+
(typeof Element !== "undefined" && target instanceof Element) ||
|
|
20019
|
+
(typeof Node !== "undefined" && target instanceof Node) ||
|
|
20020
|
+
(typeof EventTarget !== "undefined" && target instanceof EventTarget)
|
|
20021
|
+
) {
|
|
20022
|
+
return true;
|
|
20023
|
+
}
|
|
20024
|
+
|
|
20025
|
+
// Cross-origin or non-enumerable window objects
|
|
20026
|
+
try {
|
|
20027
|
+
return Object.prototype.toString.call(target) === "[object Window]";
|
|
20028
|
+
} catch {
|
|
20029
|
+
return true;
|
|
20030
|
+
}
|
|
20031
|
+
}
|
|
20179
20032
|
|
|
20180
20033
|
/**
|
|
20181
20034
|
* Decorator for excluding objects from scope observability
|
|
@@ -20202,13 +20055,13 @@
|
|
|
20202
20055
|
: context
|
|
20203
20056
|
: undefined;
|
|
20204
20057
|
|
|
20205
|
-
/** @type {Map<string, Array<Listener>>} Watch listeners */
|
|
20058
|
+
/** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners */
|
|
20206
20059
|
this.watchers = context ? context.watchers : new Map();
|
|
20207
20060
|
|
|
20208
20061
|
/** @type {Map<String, Function[]>} Event listeners */
|
|
20209
20062
|
this.$$listeners = new Map();
|
|
20210
20063
|
|
|
20211
|
-
/** @type {Map<string, Array<Listener>>} Watch listeners from other proxies */
|
|
20064
|
+
/** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
|
|
20212
20065
|
this.foreignListeners = context ? context.foreignListeners : new Map();
|
|
20213
20066
|
|
|
20214
20067
|
/** @type {Set<ProxyConstructor>} */
|
|
@@ -20253,7 +20106,7 @@
|
|
|
20253
20106
|
? null
|
|
20254
20107
|
: context;
|
|
20255
20108
|
|
|
20256
|
-
/** @type {AsyncQueueTask[]} */
|
|
20109
|
+
/** @type {import('./interface.ts').AsyncQueueTask[]} */
|
|
20257
20110
|
this.$$asyncQueue = [];
|
|
20258
20111
|
|
|
20259
20112
|
this.filters = [];
|
|
@@ -20262,6 +20115,31 @@
|
|
|
20262
20115
|
this.$$destroyed = false;
|
|
20263
20116
|
|
|
20264
20117
|
this.scheduled = [];
|
|
20118
|
+
|
|
20119
|
+
/** @private */
|
|
20120
|
+
this.propertyMap = {
|
|
20121
|
+
$watch: this.$watch.bind(this),
|
|
20122
|
+
$new: this.$new.bind(this),
|
|
20123
|
+
$newIsolate: this.$newIsolate.bind(this),
|
|
20124
|
+
$destroy: this.$destroy.bind(this),
|
|
20125
|
+
$flushQueue: this.$flushQueue.bind(this),
|
|
20126
|
+
$eval: this.$eval.bind(this),
|
|
20127
|
+
$apply: this.$apply.bind(this),
|
|
20128
|
+
$postUpdate: this.$postUpdate.bind(this),
|
|
20129
|
+
$isRoot: this.#isRoot.bind(this),
|
|
20130
|
+
$proxy: this.$proxy,
|
|
20131
|
+
$on: this.$on.bind(this),
|
|
20132
|
+
$emit: this.$emit.bind(this),
|
|
20133
|
+
$broadcast: this.$broadcast.bind(this),
|
|
20134
|
+
$transcluded: this.$transcluded.bind(this),
|
|
20135
|
+
$handler: /** @type {Scope} */ (this),
|
|
20136
|
+
$parent: this.$parent,
|
|
20137
|
+
$root: this.$root,
|
|
20138
|
+
$children: this.$children,
|
|
20139
|
+
$id: this.$id,
|
|
20140
|
+
$merge: this.$merge.bind(this),
|
|
20141
|
+
$getById: this.$getById.bind(this),
|
|
20142
|
+
};
|
|
20265
20143
|
}
|
|
20266
20144
|
|
|
20267
20145
|
/**
|
|
@@ -20457,8 +20335,8 @@
|
|
|
20457
20335
|
// filter for repeaters
|
|
20458
20336
|
if (this.$target.$$hashKey) {
|
|
20459
20337
|
foreignListeners = foreignListeners.filter((x) =>
|
|
20460
|
-
x.originalTarget
|
|
20461
|
-
? x.originalTarget
|
|
20338
|
+
x.originalTarget["$$hashKey"]
|
|
20339
|
+
? x.originalTarget["$$hashKey"] === this.$target.$$hashKey
|
|
20462
20340
|
: false,
|
|
20463
20341
|
);
|
|
20464
20342
|
}
|
|
@@ -20503,29 +20381,8 @@
|
|
|
20503
20381
|
this.$proxy = proxy;
|
|
20504
20382
|
}
|
|
20505
20383
|
|
|
20506
|
-
this.propertyMap =
|
|
20507
|
-
|
|
20508
|
-
$new: this.$new.bind(this),
|
|
20509
|
-
$newIsolate: this.$newIsolate.bind(this),
|
|
20510
|
-
$destroy: this.$destroy.bind(this),
|
|
20511
|
-
$eval: this.$eval.bind(this),
|
|
20512
|
-
$apply: this.$apply.bind(this),
|
|
20513
|
-
$postUpdate: this.$postUpdate.bind(this),
|
|
20514
|
-
$isRoot: this.#isRoot.bind(this),
|
|
20515
|
-
$target: target,
|
|
20516
|
-
$proxy: this.$proxy,
|
|
20517
|
-
$on: this.$on.bind(this),
|
|
20518
|
-
$emit: this.$emit.bind(this),
|
|
20519
|
-
$broadcast: this.$broadcast.bind(this),
|
|
20520
|
-
$transcluded: this.$transcluded.bind(this),
|
|
20521
|
-
$handler: /** @type {Scope} */ (this),
|
|
20522
|
-
$parent: this.$parent,
|
|
20523
|
-
$root: this.$root,
|
|
20524
|
-
$children: this.$children,
|
|
20525
|
-
$id: this.$id,
|
|
20526
|
-
$merge: this.$merge.bind(this),
|
|
20527
|
-
$getById: this.$getById.bind(this),
|
|
20528
|
-
};
|
|
20384
|
+
this.propertyMap.$target = target;
|
|
20385
|
+
this.propertyMap.$proxy = proxy;
|
|
20529
20386
|
|
|
20530
20387
|
if (
|
|
20531
20388
|
Array.isArray(target) &&
|
|
@@ -20620,7 +20477,7 @@
|
|
|
20620
20477
|
}
|
|
20621
20478
|
|
|
20622
20479
|
/**
|
|
20623
|
-
* @param {Listener[]} listeners
|
|
20480
|
+
* @param {import('./interface.ts').Listener[]} listeners
|
|
20624
20481
|
* @param {Function} filter
|
|
20625
20482
|
*/
|
|
20626
20483
|
#scheduleListener(listeners, filter = (val) => val) {
|
|
@@ -20644,7 +20501,7 @@
|
|
|
20644
20501
|
* function is invoked when changes to that property are detected.
|
|
20645
20502
|
*
|
|
20646
20503
|
* @param {string} watchProp - An expression to be watched in the context of this model.
|
|
20647
|
-
* @param {ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
|
|
20504
|
+
* @param {import('./interface.ts').ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
|
|
20648
20505
|
* @param {boolean} [lazy] - A flag to indicate if the listener should be invoked immediately. Defaults to false.
|
|
20649
20506
|
*/
|
|
20650
20507
|
$watch(watchProp, listenerFn, lazy = false) {
|
|
@@ -20666,7 +20523,7 @@
|
|
|
20666
20523
|
return () => {};
|
|
20667
20524
|
}
|
|
20668
20525
|
|
|
20669
|
-
/** @type {Listener} */
|
|
20526
|
+
/** @type {import('./interface.ts').Listener} */
|
|
20670
20527
|
const listener = {
|
|
20671
20528
|
originalTarget: this.$target,
|
|
20672
20529
|
listenerFn: listenerFn,
|
|
@@ -20778,7 +20635,7 @@
|
|
|
20778
20635
|
|
|
20779
20636
|
let potentialProxy = $parse(
|
|
20780
20637
|
watchProp.split(".").slice(0, -1).join("."),
|
|
20781
|
-
)(listener.originalTarget);
|
|
20638
|
+
)(/** @type {Scope} */ (listener.originalTarget));
|
|
20782
20639
|
if (potentialProxy && this.foreignProxies.has(potentialProxy)) {
|
|
20783
20640
|
potentialProxy.$handler.#registerForeignKey(key, listener);
|
|
20784
20641
|
potentialProxy.$handler.#scheduleListener([listener]);
|
|
@@ -20976,21 +20833,21 @@
|
|
|
20976
20833
|
return true;
|
|
20977
20834
|
}
|
|
20978
20835
|
|
|
20979
|
-
|
|
20980
|
-
|
|
20981
|
-
|
|
20836
|
+
deregisterForeignKey(key, id) {
|
|
20837
|
+
const listenerList = this.foreignListeners.get(key);
|
|
20838
|
+
if (!listenerList) return false;
|
|
20982
20839
|
|
|
20983
|
-
|
|
20984
|
-
|
|
20840
|
+
const index = listenerList.findIndex((x) => x.id === id);
|
|
20841
|
+
if (index === -1) return false;
|
|
20985
20842
|
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20843
|
+
listenerList.splice(index, 1);
|
|
20844
|
+
if (listenerList.length) {
|
|
20845
|
+
this.foreignListeners.set(key, listenerList);
|
|
20846
|
+
} else {
|
|
20847
|
+
this.foreignListeners.delete(key);
|
|
20848
|
+
}
|
|
20849
|
+
return true;
|
|
20850
|
+
}
|
|
20994
20851
|
|
|
20995
20852
|
$eval(expr, locals) {
|
|
20996
20853
|
const fn = $parse(expr);
|
|
@@ -21023,7 +20880,7 @@
|
|
|
21023
20880
|
}
|
|
21024
20881
|
|
|
21025
20882
|
/**
|
|
21026
|
-
* @param {import('../../interface.
|
|
20883
|
+
* @param {import('../../interface.ts').Expression} expr
|
|
21027
20884
|
* @returns {any}
|
|
21028
20885
|
*/
|
|
21029
20886
|
$apply(expr) {
|
|
@@ -21204,12 +21061,12 @@
|
|
|
21204
21061
|
|
|
21205
21062
|
/**
|
|
21206
21063
|
* @internal
|
|
21207
|
-
* @param {Listener} listener - The property path that was changed.
|
|
21064
|
+
* @param {import('./interface.ts').Listener} listener - The property path that was changed.
|
|
21208
21065
|
*/
|
|
21209
21066
|
#notifyListener(listener, target) {
|
|
21210
21067
|
const { originalTarget, listenerFn, watchFn } = listener;
|
|
21211
21068
|
try {
|
|
21212
|
-
let newVal = watchFn(originalTarget);
|
|
21069
|
+
let newVal = watchFn(/** @type {Scope} */ (originalTarget));
|
|
21213
21070
|
if (isUndefined(newVal)) {
|
|
21214
21071
|
newVal = watchFn(target);
|
|
21215
21072
|
}
|
|
@@ -21239,6 +21096,13 @@
|
|
|
21239
21096
|
}
|
|
21240
21097
|
}
|
|
21241
21098
|
|
|
21099
|
+
/* @ignore */
|
|
21100
|
+
$flushQueue() {
|
|
21101
|
+
while ($postUpdateQueue.length) {
|
|
21102
|
+
$postUpdateQueue.shift()();
|
|
21103
|
+
}
|
|
21104
|
+
}
|
|
21105
|
+
|
|
21242
21106
|
/**
|
|
21243
21107
|
* Searches the scope instance
|
|
21244
21108
|
*
|
|
@@ -21749,7 +21613,7 @@
|
|
|
21749
21613
|
|
|
21750
21614
|
/**
|
|
21751
21615
|
* @param {boolean} isDefault
|
|
21752
|
-
* @returns {(any) => import("../../interface.
|
|
21616
|
+
* @returns {(any) => import("../../interface.ts").Directive}
|
|
21753
21617
|
*/
|
|
21754
21618
|
function ngMessageDirectiveFactory(isDefault) {
|
|
21755
21619
|
ngMessageDirective.$inject = ["$animate"];
|
|
@@ -21956,6 +21820,9 @@
|
|
|
21956
21820
|
return $aria.$$watchExpr("ngShow", "aria-hidden", [], true);
|
|
21957
21821
|
}
|
|
21958
21822
|
|
|
21823
|
+
/**
|
|
21824
|
+
* @return {ng.Directive}
|
|
21825
|
+
*/
|
|
21959
21826
|
function ngMessagesAriaDirective() {
|
|
21960
21827
|
return {
|
|
21961
21828
|
restrict: "A",
|
|
@@ -21971,18 +21838,21 @@
|
|
|
21971
21838
|
}
|
|
21972
21839
|
|
|
21973
21840
|
ngClickAriaDirective.$inject = [$injectTokens.$aria, $injectTokens.$parse];
|
|
21841
|
+
|
|
21842
|
+
/**
|
|
21843
|
+
* @param $aria
|
|
21844
|
+
* @param {ng.ParseService} $parse
|
|
21845
|
+
* @return {ng.Directive}
|
|
21846
|
+
*/
|
|
21974
21847
|
function ngClickAriaDirective($aria, $parse) {
|
|
21975
21848
|
return {
|
|
21976
21849
|
restrict: "A",
|
|
21977
21850
|
compile(_elem, attr) {
|
|
21978
21851
|
if (hasOwn(attr, ARIA_DISABLE_ATTR)) return;
|
|
21979
21852
|
|
|
21980
|
-
const fn = $parse(attr
|
|
21853
|
+
const fn = $parse(attr["ngClick"]);
|
|
21981
21854
|
|
|
21982
|
-
|
|
21983
|
-
* @param {Element} elem
|
|
21984
|
-
*/
|
|
21985
|
-
return function (scope, elem, attr) {
|
|
21855
|
+
return (scope, elem, attr) => {
|
|
21986
21856
|
if (!isNodeOneOf(elem, nativeAriaNodeNames)) {
|
|
21987
21857
|
if ($aria.config("bindRoleForClick") && !elem.hasAttribute("role")) {
|
|
21988
21858
|
elem.setAttribute("role", "button");
|
|
@@ -22019,10 +21889,6 @@
|
|
|
22019
21889
|
// See https://github.com/angular/angular.js/issues/16664
|
|
22020
21890
|
event.preventDefault();
|
|
22021
21891
|
}
|
|
22022
|
-
scope.$apply(callback);
|
|
22023
|
-
}
|
|
22024
|
-
|
|
22025
|
-
function callback() {
|
|
22026
21892
|
fn(scope, { $event: event });
|
|
22027
21893
|
}
|
|
22028
21894
|
},
|
|
@@ -22237,6 +22103,231 @@
|
|
|
22237
22103
|
};
|
|
22238
22104
|
}
|
|
22239
22105
|
|
|
22106
|
+
/**
|
|
22107
|
+
* @fileoverview
|
|
22108
|
+
* Frame-synchronized animation runner and scheduler.
|
|
22109
|
+
* Provides async batching of animation callbacks using requestAnimationFrame.
|
|
22110
|
+
* In AngularJS, this user to be implemented as `$$AnimateRunner`
|
|
22111
|
+
*/
|
|
22112
|
+
|
|
22113
|
+
/**
|
|
22114
|
+
* Internal runner states.
|
|
22115
|
+
* @readonly
|
|
22116
|
+
* @enum {number}
|
|
22117
|
+
*/
|
|
22118
|
+
const RunnerState = {
|
|
22119
|
+
INITIAL: 0,
|
|
22120
|
+
PENDING: 1,
|
|
22121
|
+
DONE: 2,
|
|
22122
|
+
};
|
|
22123
|
+
|
|
22124
|
+
/** @type {VoidFunction[]} */
|
|
22125
|
+
let queue = [];
|
|
22126
|
+
|
|
22127
|
+
/** @type {boolean} */
|
|
22128
|
+
let scheduled = false;
|
|
22129
|
+
|
|
22130
|
+
/**
|
|
22131
|
+
* Flush all queued callbacks.
|
|
22132
|
+
* @private
|
|
22133
|
+
*/
|
|
22134
|
+
function flush() {
|
|
22135
|
+
const tasks = queue;
|
|
22136
|
+
queue = [];
|
|
22137
|
+
scheduled = false;
|
|
22138
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
22139
|
+
tasks[i]();
|
|
22140
|
+
}
|
|
22141
|
+
}
|
|
22142
|
+
|
|
22143
|
+
/**
|
|
22144
|
+
* Schedule a callback to run on the next animation frame.
|
|
22145
|
+
* Multiple calls within the same frame are batched together.
|
|
22146
|
+
*
|
|
22147
|
+
* @param {VoidFunction} fn - The callback to execute.
|
|
22148
|
+
*/
|
|
22149
|
+
function schedule(fn) {
|
|
22150
|
+
queue.push(fn);
|
|
22151
|
+
if (!scheduled) {
|
|
22152
|
+
scheduled = true;
|
|
22153
|
+
(typeof requestAnimationFrame === "function"
|
|
22154
|
+
? requestAnimationFrame
|
|
22155
|
+
: setTimeout)(flush, 0);
|
|
22156
|
+
}
|
|
22157
|
+
}
|
|
22158
|
+
|
|
22159
|
+
/**
|
|
22160
|
+
* Represents an asynchronous animation operation.
|
|
22161
|
+
* Provides both callback-based and promise-based completion APIs.
|
|
22162
|
+
*/
|
|
22163
|
+
class AnimateRunner {
|
|
22164
|
+
/**
|
|
22165
|
+
* Run an array of animation runners in sequence.
|
|
22166
|
+
* Each runner waits for the previous one to complete.
|
|
22167
|
+
*
|
|
22168
|
+
* @param {AnimateRunner[]} runners - Runners to execute in order.
|
|
22169
|
+
* @param {(ok: boolean) => void} callback - Invoked when all complete or one fails.
|
|
22170
|
+
*/
|
|
22171
|
+
static chain(runners, callback) {
|
|
22172
|
+
let i = 0;
|
|
22173
|
+
const next = (ok = true) => {
|
|
22174
|
+
if (!ok || i >= runners.length) {
|
|
22175
|
+
callback(ok);
|
|
22176
|
+
return;
|
|
22177
|
+
}
|
|
22178
|
+
runners[i++].done(next);
|
|
22179
|
+
};
|
|
22180
|
+
next();
|
|
22181
|
+
}
|
|
22182
|
+
|
|
22183
|
+
/**
|
|
22184
|
+
* Waits for all animation runners to complete before invoking the callback.
|
|
22185
|
+
*
|
|
22186
|
+
* @param {AnimateRunner[]} runners - Active runners to wait for.
|
|
22187
|
+
* @param {(ok: boolean) => void} callback - Called when all runners complete.
|
|
22188
|
+
*/
|
|
22189
|
+
static all(runners, callback) {
|
|
22190
|
+
let remaining = runners.length;
|
|
22191
|
+
let status = true;
|
|
22192
|
+
for (const r of runners) {
|
|
22193
|
+
r.done((result) => {
|
|
22194
|
+
status = status && result !== false;
|
|
22195
|
+
if (--remaining === 0) callback(status);
|
|
22196
|
+
});
|
|
22197
|
+
}
|
|
22198
|
+
}
|
|
22199
|
+
|
|
22200
|
+
/**
|
|
22201
|
+
* @param {import("../interface.ts").AnimationHost} [host] - Optional animation host.
|
|
22202
|
+
*/
|
|
22203
|
+
constructor(host) {
|
|
22204
|
+
/** @type {import("../interface.ts").AnimationHost} */
|
|
22205
|
+
this.host = host || {};
|
|
22206
|
+
|
|
22207
|
+
/** @type {Array<(ok: boolean) => void>} */
|
|
22208
|
+
this._doneCallbacks = [];
|
|
22209
|
+
|
|
22210
|
+
/** @type {RunnerState} */
|
|
22211
|
+
this._state = RunnerState.INITIAL;
|
|
22212
|
+
|
|
22213
|
+
/** @type {Promise<void>|null} */
|
|
22214
|
+
this._promise = null;
|
|
22215
|
+
|
|
22216
|
+
/** @type {(fn: VoidFunction) => void} */
|
|
22217
|
+
this._schedule = schedule;
|
|
22218
|
+
}
|
|
22219
|
+
|
|
22220
|
+
/**
|
|
22221
|
+
* Sets or updates the animation host.
|
|
22222
|
+
* @param {import("../interface.ts").AnimationHost} host - The host object.
|
|
22223
|
+
*/
|
|
22224
|
+
setHost(host) {
|
|
22225
|
+
this.host = host || {};
|
|
22226
|
+
}
|
|
22227
|
+
|
|
22228
|
+
/**
|
|
22229
|
+
* Registers a callback to be called once the animation completes.
|
|
22230
|
+
* If the animation is already complete, it's called immediately.
|
|
22231
|
+
*
|
|
22232
|
+
* @param {(ok: boolean) => void} fn - Completion callback.
|
|
22233
|
+
*/
|
|
22234
|
+
done(fn) {
|
|
22235
|
+
if (this._state === RunnerState.DONE) {
|
|
22236
|
+
fn(true);
|
|
22237
|
+
} else {
|
|
22238
|
+
this._doneCallbacks.push(fn);
|
|
22239
|
+
}
|
|
22240
|
+
}
|
|
22241
|
+
|
|
22242
|
+
/**
|
|
22243
|
+
* Notifies the host of animation progress.
|
|
22244
|
+
* @param {...any} args - Progress arguments.
|
|
22245
|
+
*/
|
|
22246
|
+
progress(...args) {
|
|
22247
|
+
this.host.progress?.(...args);
|
|
22248
|
+
}
|
|
22249
|
+
|
|
22250
|
+
/** Pauses the animation, if supported by the host. */
|
|
22251
|
+
pause() {
|
|
22252
|
+
this.host.pause?.();
|
|
22253
|
+
}
|
|
22254
|
+
|
|
22255
|
+
/** Resumes the animation, if supported by the host. */
|
|
22256
|
+
resume() {
|
|
22257
|
+
this.host.resume?.();
|
|
22258
|
+
}
|
|
22259
|
+
|
|
22260
|
+
/** Ends the animation successfully. */
|
|
22261
|
+
end() {
|
|
22262
|
+
this.host.end?.();
|
|
22263
|
+
this._finish(true);
|
|
22264
|
+
}
|
|
22265
|
+
|
|
22266
|
+
/** Cancels the animation. */
|
|
22267
|
+
cancel() {
|
|
22268
|
+
this.host.cancel?.();
|
|
22269
|
+
this._finish(false);
|
|
22270
|
+
}
|
|
22271
|
+
|
|
22272
|
+
/**
|
|
22273
|
+
* Marks the animation as complete on the next animation frame.
|
|
22274
|
+
* @param {boolean} [status=true] - True if successful, false if canceled.
|
|
22275
|
+
*/
|
|
22276
|
+
complete(status = true) {
|
|
22277
|
+
if (this._state === RunnerState.INITIAL) {
|
|
22278
|
+
this._state = RunnerState.PENDING;
|
|
22279
|
+
this._schedule(() => this._finish(status));
|
|
22280
|
+
}
|
|
22281
|
+
}
|
|
22282
|
+
|
|
22283
|
+
/**
|
|
22284
|
+
* Returns a promise that resolves or rejects when the animation completes.
|
|
22285
|
+
* @returns {Promise<void>} Promise resolved on success or rejected on cancel.
|
|
22286
|
+
*/
|
|
22287
|
+
getPromise() {
|
|
22288
|
+
if (!this._promise) {
|
|
22289
|
+
this._promise = new Promise((resolve, reject) => {
|
|
22290
|
+
this.done((success) => {
|
|
22291
|
+
if (success === false) reject();
|
|
22292
|
+
else resolve();
|
|
22293
|
+
});
|
|
22294
|
+
});
|
|
22295
|
+
}
|
|
22296
|
+
return this._promise;
|
|
22297
|
+
}
|
|
22298
|
+
|
|
22299
|
+
/** @inheritdoc */
|
|
22300
|
+
then(onFulfilled, onRejected) {
|
|
22301
|
+
return this.getPromise().then(onFulfilled, onRejected);
|
|
22302
|
+
}
|
|
22303
|
+
|
|
22304
|
+
/** @inheritdoc */
|
|
22305
|
+
catch(onRejected) {
|
|
22306
|
+
return this.getPromise().catch(onRejected);
|
|
22307
|
+
}
|
|
22308
|
+
|
|
22309
|
+
/** @inheritdoc */
|
|
22310
|
+
finally(onFinally) {
|
|
22311
|
+
return this.getPromise().finally(onFinally);
|
|
22312
|
+
}
|
|
22313
|
+
|
|
22314
|
+
/**
|
|
22315
|
+
* Completes the animation and invokes all done callbacks.
|
|
22316
|
+
* @private
|
|
22317
|
+
* @param {boolean} status - True if completed successfully, false if canceled.
|
|
22318
|
+
*/
|
|
22319
|
+
_finish(status) {
|
|
22320
|
+
if (this._state === RunnerState.DONE) return;
|
|
22321
|
+
this._state = RunnerState.DONE;
|
|
22322
|
+
|
|
22323
|
+
const callbacks = this._doneCallbacks;
|
|
22324
|
+
for (let i = 0; i < callbacks.length; i++) {
|
|
22325
|
+
callbacks[i](status);
|
|
22326
|
+
}
|
|
22327
|
+
callbacks.length = 0;
|
|
22328
|
+
}
|
|
22329
|
+
}
|
|
22330
|
+
|
|
22240
22331
|
const ANIMATE_TIMER_KEY = "$$animateCss";
|
|
22241
22332
|
|
|
22242
22333
|
const ONE_SECOND = 1000;
|
|
@@ -22344,19 +22435,18 @@
|
|
|
22344
22435
|
}
|
|
22345
22436
|
|
|
22346
22437
|
function AnimateCssProvider() {
|
|
22438
|
+
let activeClasses;
|
|
22347
22439
|
this.$get = [
|
|
22348
|
-
"$$AnimateRunner",
|
|
22349
22440
|
"$$animateCache",
|
|
22350
22441
|
"$$rAFScheduler",
|
|
22351
22442
|
|
|
22352
22443
|
/**
|
|
22353
22444
|
*
|
|
22354
|
-
* @param {*} $$AnimateRunner
|
|
22355
22445
|
* @param {*} $$animateCache
|
|
22356
22446
|
* @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
|
|
22357
22447
|
* @returns
|
|
22358
22448
|
*/
|
|
22359
|
-
function ($$
|
|
22449
|
+
function ($$animateCache, $$rAFScheduler) {
|
|
22360
22450
|
const applyAnimationClasses = applyAnimationClassesFactory();
|
|
22361
22451
|
|
|
22362
22452
|
function computeCachedCssStyles(
|
|
@@ -22687,10 +22777,7 @@
|
|
|
22687
22777
|
return closeAndReturnNoopAnimator();
|
|
22688
22778
|
}
|
|
22689
22779
|
|
|
22690
|
-
|
|
22691
|
-
preparationClasses,
|
|
22692
|
-
ACTIVE_CLASS_SUFFIX,
|
|
22693
|
-
);
|
|
22780
|
+
activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);
|
|
22694
22781
|
|
|
22695
22782
|
if (options.delay != null) {
|
|
22696
22783
|
if (typeof options.delay !== "boolean") {
|
|
@@ -22757,7 +22844,7 @@
|
|
|
22757
22844
|
pause: null,
|
|
22758
22845
|
};
|
|
22759
22846
|
|
|
22760
|
-
runner = new
|
|
22847
|
+
runner = new AnimateRunner(runnerHost);
|
|
22761
22848
|
|
|
22762
22849
|
waitUntilQuiet(start);
|
|
22763
22850
|
|
|
@@ -22827,7 +22914,9 @@
|
|
|
22827
22914
|
|
|
22828
22915
|
if (events && events.length) {
|
|
22829
22916
|
// Remove the transitionend / animationend listener(s)
|
|
22830
|
-
|
|
22917
|
+
events.forEach((i) =>
|
|
22918
|
+
element.removeEventListener(i, onAnimationProgress),
|
|
22919
|
+
);
|
|
22831
22920
|
}
|
|
22832
22921
|
|
|
22833
22922
|
// Cancel the fallback closing timeout and remove the timer data
|
|
@@ -22854,7 +22943,7 @@
|
|
|
22854
22943
|
}
|
|
22855
22944
|
|
|
22856
22945
|
function closeAndReturnNoopAnimator() {
|
|
22857
|
-
runner = new
|
|
22946
|
+
runner = new AnimateRunner({
|
|
22858
22947
|
end: endFn,
|
|
22859
22948
|
cancel: cancelFn,
|
|
22860
22949
|
});
|
|
@@ -23242,31 +23331,18 @@
|
|
|
23242
23331
|
$injectTokens.$rootScope,
|
|
23243
23332
|
$injectTokens.$injector,
|
|
23244
23333
|
$injectTokens.$$animation,
|
|
23245
|
-
$injectTokens.$$AnimateRunner,
|
|
23246
23334
|
$injectTokens.$templateRequest,
|
|
23247
23335
|
/**
|
|
23248
23336
|
*
|
|
23249
|
-
* @param {
|
|
23250
|
-
* @param {
|
|
23337
|
+
* @param {ng.RootScopeService} $rootScope
|
|
23338
|
+
* @param {ng.InjectorService} $injector
|
|
23251
23339
|
* @param {*} $$animation
|
|
23252
|
-
* @param {*} $$AnimateRunner
|
|
23253
23340
|
* @param {*} $templateRequest
|
|
23254
23341
|
* @returns
|
|
23255
23342
|
*/
|
|
23256
|
-
function (
|
|
23257
|
-
$rootScope,
|
|
23258
|
-
$injector,
|
|
23259
|
-
$$animation,
|
|
23260
|
-
$$AnimateRunner,
|
|
23261
|
-
$templateRequest,
|
|
23262
|
-
) {
|
|
23343
|
+
function ($rootScope, $injector, $$animation, $templateRequest) {
|
|
23263
23344
|
const activeAnimationsLookup = new Map();
|
|
23264
23345
|
const disabledElementsLookup = new Map();
|
|
23265
|
-
let animationsEnabled = null;
|
|
23266
|
-
|
|
23267
|
-
function removeFromDisabledElementsLookup(evt) {
|
|
23268
|
-
disabledElementsLookup.delete(evt.target);
|
|
23269
|
-
}
|
|
23270
23346
|
|
|
23271
23347
|
function postDigestTaskFactory() {
|
|
23272
23348
|
let postDigestCalled = false;
|
|
@@ -23306,11 +23382,6 @@
|
|
|
23306
23382
|
// any animations are triggered.
|
|
23307
23383
|
$rootScope.$postUpdate(() => {
|
|
23308
23384
|
$rootScope.$postUpdate(() => {
|
|
23309
|
-
// we check for null directly in the event that the application already called
|
|
23310
|
-
// .enabled() with whatever arguments that it provided it with
|
|
23311
|
-
if (animationsEnabled === null) {
|
|
23312
|
-
animationsEnabled = true;
|
|
23313
|
-
}
|
|
23314
23385
|
});
|
|
23315
23386
|
});
|
|
23316
23387
|
}
|
|
@@ -23449,47 +23520,6 @@
|
|
|
23449
23520
|
options.domOperation = domOperation;
|
|
23450
23521
|
return queueAnimation(element, event, options);
|
|
23451
23522
|
},
|
|
23452
|
-
|
|
23453
|
-
// this method has four signatures:
|
|
23454
|
-
// () - global getter
|
|
23455
|
-
// (bool) - global setter
|
|
23456
|
-
// (element) - element getter
|
|
23457
|
-
// (element, bool) - element setter<F37>
|
|
23458
|
-
enabled(element, bool) {
|
|
23459
|
-
const argCount = arguments.length;
|
|
23460
|
-
|
|
23461
|
-
if (argCount === 0) {
|
|
23462
|
-
// () - Global getter
|
|
23463
|
-
bool = !!animationsEnabled;
|
|
23464
|
-
} else {
|
|
23465
|
-
const hasElement = isElement(element);
|
|
23466
|
-
|
|
23467
|
-
if (!hasElement) {
|
|
23468
|
-
// (bool) - Global setter
|
|
23469
|
-
bool = animationsEnabled = !!element;
|
|
23470
|
-
} else {
|
|
23471
|
-
const node = element;
|
|
23472
|
-
|
|
23473
|
-
if (argCount === 1) {
|
|
23474
|
-
// (element) - Element getter
|
|
23475
|
-
bool = !disabledElementsLookup.get(node);
|
|
23476
|
-
} else {
|
|
23477
|
-
// (element, bool) - Element setter
|
|
23478
|
-
if (!disabledElementsLookup.has(node)) {
|
|
23479
|
-
// The element is added to the map for the first time.
|
|
23480
|
-
// Create a listener to remove it on `$destroy` (to avoid memory leak).
|
|
23481
|
-
element.addEventListener(
|
|
23482
|
-
"$destroy",
|
|
23483
|
-
removeFromDisabledElementsLookup,
|
|
23484
|
-
);
|
|
23485
|
-
}
|
|
23486
|
-
disabledElementsLookup.set(node, !bool);
|
|
23487
|
-
}
|
|
23488
|
-
}
|
|
23489
|
-
}
|
|
23490
|
-
|
|
23491
|
-
return bool;
|
|
23492
|
-
},
|
|
23493
23523
|
};
|
|
23494
23524
|
|
|
23495
23525
|
return $animate;
|
|
@@ -23518,7 +23548,7 @@
|
|
|
23518
23548
|
|
|
23519
23549
|
// we create a fake runner with a working promise.
|
|
23520
23550
|
// These methods will become available after the digest has passed
|
|
23521
|
-
const runner = new
|
|
23551
|
+
const runner = new AnimateRunner();
|
|
23522
23552
|
|
|
23523
23553
|
// this is used to trigger callbacks in postDigest mode
|
|
23524
23554
|
const runInNextPostDigestOrNow = postDigestTaskFactory();
|
|
@@ -23546,6 +23576,7 @@
|
|
|
23546
23576
|
if (options.to && !isObject(options.to)) {
|
|
23547
23577
|
options.to = null;
|
|
23548
23578
|
}
|
|
23579
|
+
|
|
23549
23580
|
// If animations are hard-disabled for the whole application there is no need to continue.
|
|
23550
23581
|
// There are also situations where a directive issues an animation for a JQLite wrapper that
|
|
23551
23582
|
// contains only comment nodes. In this case, there is no way we can perform an animation.
|
|
@@ -23558,7 +23589,6 @@
|
|
|
23558
23589
|
close();
|
|
23559
23590
|
return runner;
|
|
23560
23591
|
}
|
|
23561
|
-
|
|
23562
23592
|
const isStructural = ["enter", "move", "leave"].indexOf(event) >= 0;
|
|
23563
23593
|
|
|
23564
23594
|
// This is a hard disable of all animations the element itself, therefore there is no need to
|
|
@@ -23794,6 +23824,8 @@
|
|
|
23794
23824
|
});
|
|
23795
23825
|
});
|
|
23796
23826
|
|
|
23827
|
+
// Since we don't have digest any more - trigger queue here
|
|
23828
|
+
setTimeout($rootScope.$flushQueue, 0);
|
|
23797
23829
|
return runner;
|
|
23798
23830
|
|
|
23799
23831
|
function notifyProgress(runner, event, phase, data) {
|
|
@@ -23957,18 +23989,16 @@
|
|
|
23957
23989
|
// TODO: use caching here to speed things up for detection
|
|
23958
23990
|
// TODO: add documentation
|
|
23959
23991
|
|
|
23960
|
-
AnimateJsProvider.$inject = [
|
|
23992
|
+
AnimateJsProvider.$inject = [$injectTokens.$animate + "Provider"];
|
|
23961
23993
|
function AnimateJsProvider($animateProvider) {
|
|
23962
23994
|
this.$get = [
|
|
23963
23995
|
$injectTokens.$injector,
|
|
23964
|
-
"$$AnimateRunner",
|
|
23965
23996
|
/**
|
|
23966
23997
|
*
|
|
23967
|
-
* @param {
|
|
23968
|
-
* @param {*} $$AnimateRunner
|
|
23998
|
+
* @param {ng.InjectorService} $injector
|
|
23969
23999
|
* @returns
|
|
23970
24000
|
*/
|
|
23971
|
-
function ($injector
|
|
24001
|
+
function ($injector) {
|
|
23972
24002
|
const applyAnimationClasses = applyAnimationClassesFactory();
|
|
23973
24003
|
// $animateJs(element, 'enter');
|
|
23974
24004
|
return function (element, event, classes, options) {
|
|
@@ -24055,7 +24085,7 @@
|
|
|
24055
24085
|
runner.end();
|
|
24056
24086
|
} else {
|
|
24057
24087
|
close();
|
|
24058
|
-
runner = new
|
|
24088
|
+
runner = new AnimateRunner();
|
|
24059
24089
|
runner.complete(true);
|
|
24060
24090
|
}
|
|
24061
24091
|
return runner;
|
|
@@ -24065,31 +24095,53 @@
|
|
|
24065
24095
|
return runner;
|
|
24066
24096
|
}
|
|
24067
24097
|
|
|
24068
|
-
runner = new
|
|
24069
|
-
|
|
24098
|
+
runner = new AnimateRunner();
|
|
24099
|
+
|
|
24070
24100
|
const chain = [];
|
|
24071
24101
|
|
|
24072
24102
|
if (before) {
|
|
24073
|
-
|
|
24074
|
-
|
|
24103
|
+
const runnerBefore = new AnimateRunner({
|
|
24104
|
+
end(fn) {
|
|
24105
|
+
// call the before animation function, then mark runner done
|
|
24106
|
+
const endFn = before(fn) || (() => {});
|
|
24107
|
+
endFn();
|
|
24108
|
+
},
|
|
24109
|
+
cancel() {
|
|
24110
|
+
(before(true) || (() => {}))();
|
|
24111
|
+
},
|
|
24075
24112
|
});
|
|
24113
|
+
chain.push(runnerBefore);
|
|
24076
24114
|
}
|
|
24077
24115
|
|
|
24078
24116
|
if (chain.length) {
|
|
24079
|
-
|
|
24080
|
-
|
|
24081
|
-
|
|
24117
|
+
const runnerApplyOptions = new AnimateRunner({
|
|
24118
|
+
end(fn) {
|
|
24119
|
+
applyOptions();
|
|
24120
|
+
fn(true);
|
|
24121
|
+
},
|
|
24122
|
+
cancel() {
|
|
24123
|
+
applyOptions();
|
|
24124
|
+
},
|
|
24082
24125
|
});
|
|
24126
|
+
chain.push(runnerApplyOptions);
|
|
24083
24127
|
} else {
|
|
24084
24128
|
applyOptions();
|
|
24085
24129
|
}
|
|
24086
24130
|
|
|
24087
24131
|
if (after) {
|
|
24088
|
-
|
|
24089
|
-
|
|
24132
|
+
const runnerAfter = new AnimateRunner({
|
|
24133
|
+
end(fn) {
|
|
24134
|
+
const endFn = after(fn) || (() => {});
|
|
24135
|
+
endFn();
|
|
24136
|
+
},
|
|
24137
|
+
cancel() {
|
|
24138
|
+
(after(true) || (() => {}))();
|
|
24139
|
+
},
|
|
24090
24140
|
});
|
|
24141
|
+
chain.push(runnerAfter);
|
|
24091
24142
|
}
|
|
24092
24143
|
|
|
24144
|
+
// finally, set host for overall runner
|
|
24093
24145
|
runner.setHost({
|
|
24094
24146
|
end() {
|
|
24095
24147
|
endAnimations();
|
|
@@ -24099,7 +24151,7 @@
|
|
|
24099
24151
|
},
|
|
24100
24152
|
});
|
|
24101
24153
|
|
|
24102
|
-
|
|
24154
|
+
AnimateRunner.chain(chain, onComplete);
|
|
24103
24155
|
return runner;
|
|
24104
24156
|
|
|
24105
24157
|
function onComplete(success) {
|
|
@@ -24109,7 +24161,6 @@
|
|
|
24109
24161
|
|
|
24110
24162
|
function endAnimations(cancelled) {
|
|
24111
24163
|
if (!animationClosed) {
|
|
24112
|
-
(closeActiveAnimations || (() => {}))(cancelled);
|
|
24113
24164
|
onComplete(cancelled);
|
|
24114
24165
|
}
|
|
24115
24166
|
}
|
|
@@ -24148,7 +24199,7 @@
|
|
|
24148
24199
|
value = value.start();
|
|
24149
24200
|
}
|
|
24150
24201
|
|
|
24151
|
-
if (value instanceof
|
|
24202
|
+
if (value instanceof AnimateRunner) {
|
|
24152
24203
|
value.done(onDone);
|
|
24153
24204
|
} else if (isFunction(value)) {
|
|
24154
24205
|
// optional onEnd / onCancel callback
|
|
@@ -24185,7 +24236,7 @@
|
|
|
24185
24236
|
}
|
|
24186
24237
|
};
|
|
24187
24238
|
|
|
24188
|
-
runner = new
|
|
24239
|
+
runner = new AnimateRunner({
|
|
24189
24240
|
end() {
|
|
24190
24241
|
onAnimationComplete();
|
|
24191
24242
|
},
|
|
@@ -24281,7 +24332,7 @@
|
|
|
24281
24332
|
}
|
|
24282
24333
|
|
|
24283
24334
|
if (runners.length) {
|
|
24284
|
-
|
|
24335
|
+
AnimateRunner.all(runners, callback);
|
|
24285
24336
|
} else {
|
|
24286
24337
|
callback();
|
|
24287
24338
|
}
|
|
@@ -24341,25 +24392,17 @@
|
|
|
24341
24392
|
this.$get = [
|
|
24342
24393
|
$injectTokens.$rootScope,
|
|
24343
24394
|
$injectTokens.$injector,
|
|
24344
|
-
$injectTokens.$$AnimateRunner,
|
|
24345
24395
|
$injectTokens.$$rAFScheduler,
|
|
24346
24396
|
$injectTokens.$$animateCache,
|
|
24347
24397
|
/**
|
|
24348
24398
|
*
|
|
24349
24399
|
* @param {ng.RootScopeService} $rootScope
|
|
24350
24400
|
* @param {import("../core/di/internal-injector").InjectorService} $injector
|
|
24351
|
-
* @param {*} $$AnimateRunner
|
|
24352
24401
|
* @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
|
|
24353
24402
|
* @param {*} $$animateCache
|
|
24354
24403
|
* @returns
|
|
24355
24404
|
*/
|
|
24356
|
-
function (
|
|
24357
|
-
$rootScope,
|
|
24358
|
-
$injector,
|
|
24359
|
-
$$AnimateRunner,
|
|
24360
|
-
$$rAFScheduler,
|
|
24361
|
-
$$animateCache,
|
|
24362
|
-
) {
|
|
24405
|
+
function ($rootScope, $injector, $$rAFScheduler, $$animateCache) {
|
|
24363
24406
|
const animationQueue = [];
|
|
24364
24407
|
const applyAnimationClasses = applyAnimationClassesFactory();
|
|
24365
24408
|
|
|
@@ -24460,7 +24503,7 @@
|
|
|
24460
24503
|
// these runner methods will get later updated with the
|
|
24461
24504
|
// methods leading into the driver's end/cancel methods
|
|
24462
24505
|
// for now they just stop the animation from starting
|
|
24463
|
-
const runner = new
|
|
24506
|
+
const runner = new AnimateRunner({
|
|
24464
24507
|
end() {
|
|
24465
24508
|
close();
|
|
24466
24509
|
},
|
|
@@ -24823,8 +24866,8 @@
|
|
|
24823
24866
|
}
|
|
24824
24867
|
|
|
24825
24868
|
/**
|
|
24826
|
-
* @typedef {import('./interface.
|
|
24827
|
-
* @typedef {import('../interface.
|
|
24869
|
+
* @typedef {import('./interface.ts').RafScheduler} RafScheduler
|
|
24870
|
+
* @typedef {import('../interface.ts').ServiceProvider} ServiceProvider
|
|
24828
24871
|
*/
|
|
24829
24872
|
|
|
24830
24873
|
/**
|
|
@@ -25015,16 +25058,14 @@
|
|
|
25015
25058
|
*/
|
|
25016
25059
|
this.$get = [
|
|
25017
25060
|
"$animateCss",
|
|
25018
|
-
"$$AnimateRunner",
|
|
25019
25061
|
"$rootElement",
|
|
25020
25062
|
/**
|
|
25021
25063
|
*
|
|
25022
25064
|
* @param {*} $animateCss
|
|
25023
|
-
* @param {typeof import('./animate-runner.js').AnimateRunner} $$AnimateRunner
|
|
25024
25065
|
* @param {Element} $rootElement
|
|
25025
25066
|
* @returns
|
|
25026
25067
|
*/
|
|
25027
|
-
function ($animateCss,
|
|
25068
|
+
function ($animateCss, $rootElement) {
|
|
25028
25069
|
const bodyNode = document.body;
|
|
25029
25070
|
const rootNode = $rootElement;
|
|
25030
25071
|
|
|
@@ -25097,7 +25138,7 @@
|
|
|
25097
25138
|
runner.complete();
|
|
25098
25139
|
});
|
|
25099
25140
|
|
|
25100
|
-
runner = new
|
|
25141
|
+
runner = new AnimateRunner({
|
|
25101
25142
|
end: endFn,
|
|
25102
25143
|
cancel: endFn,
|
|
25103
25144
|
});
|
|
@@ -25208,12 +25249,12 @@
|
|
|
25208
25249
|
animationRunners.push(animation.start());
|
|
25209
25250
|
});
|
|
25210
25251
|
|
|
25211
|
-
const runner = new
|
|
25252
|
+
const runner = new AnimateRunner({
|
|
25212
25253
|
end: endFn,
|
|
25213
25254
|
cancel: endFn, // CSS-driven animations cannot be cancelled, only ended
|
|
25214
25255
|
});
|
|
25215
25256
|
|
|
25216
|
-
|
|
25257
|
+
AnimateRunner.all(animationRunners, (status) => {
|
|
25217
25258
|
runner.complete(status);
|
|
25218
25259
|
});
|
|
25219
25260
|
|
|
@@ -25283,8 +25324,11 @@
|
|
|
25283
25324
|
$$animationProvider.drivers.push("$$animateJsDriver");
|
|
25284
25325
|
this.$get = [
|
|
25285
25326
|
"$$animateJs",
|
|
25286
|
-
|
|
25287
|
-
|
|
25327
|
+
/**
|
|
25328
|
+
*
|
|
25329
|
+
* @param {*} $$animateJs
|
|
25330
|
+
*/
|
|
25331
|
+
function ($$animateJs) {
|
|
25288
25332
|
return function initDriverFn(animationDetails) {
|
|
25289
25333
|
if (animationDetails.from && animationDetails.to) {
|
|
25290
25334
|
const fromAnimation = prepareAnimation(animationDetails.from);
|
|
@@ -25303,9 +25347,9 @@
|
|
|
25303
25347
|
animationRunners.push(toAnimation.start());
|
|
25304
25348
|
}
|
|
25305
25349
|
|
|
25306
|
-
|
|
25350
|
+
AnimateRunner.all(animationRunners, done);
|
|
25307
25351
|
|
|
25308
|
-
const runner = new
|
|
25352
|
+
const runner = new AnimateRunner({
|
|
25309
25353
|
end: endFnFactory(),
|
|
25310
25354
|
cancel: endFnFactory(),
|
|
25311
25355
|
});
|
|
@@ -25339,9 +25383,9 @@
|
|
|
25339
25383
|
];
|
|
25340
25384
|
}
|
|
25341
25385
|
|
|
25342
|
-
ngAnimateSwapDirective.$inject = [
|
|
25386
|
+
ngAnimateSwapDirective.$inject = [$injectTokens.$animate];
|
|
25343
25387
|
/**
|
|
25344
|
-
* @returns {
|
|
25388
|
+
* @returns {ng.Directive}
|
|
25345
25389
|
*/
|
|
25346
25390
|
function ngAnimateSwapDirective($animate) {
|
|
25347
25391
|
return {
|
|
@@ -25350,10 +25394,10 @@
|
|
|
25350
25394
|
terminal: true,
|
|
25351
25395
|
priority: 550, // We use 550 here to ensure that the directive is caught before others,
|
|
25352
25396
|
// but after `ngIf` (at priority 600).
|
|
25353
|
-
link(scope, $element, attrs,
|
|
25397
|
+
link(scope, $element, attrs, _ctrl, $transclude) {
|
|
25354
25398
|
let previousElement;
|
|
25355
25399
|
let previousScope;
|
|
25356
|
-
scope.$watch(attrs
|
|
25400
|
+
scope.$watch(attrs.ngAnimateSwap || attrs.for, (value) => {
|
|
25357
25401
|
if (previousElement) {
|
|
25358
25402
|
$animate.leave(previousElement);
|
|
25359
25403
|
}
|
|
@@ -27580,7 +27624,7 @@
|
|
|
27580
27624
|
* @param {PathNode[]} fromPath
|
|
27581
27625
|
* @param {PathNode[]} toPath
|
|
27582
27626
|
* @param {boolean} [reloadState]
|
|
27583
|
-
* @returns {import("../transition/interface.
|
|
27627
|
+
* @returns {import("../transition/interface.ts").TreeChanges}
|
|
27584
27628
|
*/
|
|
27585
27629
|
static treeChanges(fromPath, toPath, reloadState) {
|
|
27586
27630
|
const max = Math.min(fromPath.length, toPath.length);
|
|
@@ -28315,25 +28359,6 @@
|
|
|
28315
28359
|
return vc.$ngViewContextAnchor === (ngViewContext && ngViewContext.name);
|
|
28316
28360
|
};
|
|
28317
28361
|
|
|
28318
|
-
/**
|
|
28319
|
-
* An object for Transition Hook Phases
|
|
28320
|
-
* @enum {number}
|
|
28321
|
-
* @readonly
|
|
28322
|
-
*/
|
|
28323
|
-
const TransitionHookPhase = {
|
|
28324
|
-
CREATE: 0,
|
|
28325
|
-
BEFORE: 1,
|
|
28326
|
-
RUN: 2,
|
|
28327
|
-
SUCCESS: 3,
|
|
28328
|
-
ERROR: 4,
|
|
28329
|
-
};
|
|
28330
|
-
|
|
28331
|
-
/** An object for Transition Hook Scopes */
|
|
28332
|
-
const TransitionHookScope = {
|
|
28333
|
-
TRANSITION: 0,
|
|
28334
|
-
STATE: 1,
|
|
28335
|
-
};
|
|
28336
|
-
|
|
28337
28362
|
/**
|
|
28338
28363
|
* An object for Transition Rejection reasons.
|
|
28339
28364
|
* @enum {number}
|
|
@@ -28453,7 +28478,7 @@
|
|
|
28453
28478
|
}
|
|
28454
28479
|
}
|
|
28455
28480
|
|
|
28456
|
-
/** @typedef {import('../../interface.
|
|
28481
|
+
/** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider
|
|
28457
28482
|
|
|
28458
28483
|
/**
|
|
28459
28484
|
* Configurable provider for an injectable event bus
|
|
@@ -28810,6 +28835,31 @@
|
|
|
28810
28835
|
bind: null,
|
|
28811
28836
|
};
|
|
28812
28837
|
|
|
28838
|
+
/**
|
|
28839
|
+
* Enum representing the different phases of a transition hook.
|
|
28840
|
+
*
|
|
28841
|
+
* @readonly
|
|
28842
|
+
* @enum {number}
|
|
28843
|
+
*/
|
|
28844
|
+
const TransitionHookPhase = Object.freeze({
|
|
28845
|
+
CREATE: 0,
|
|
28846
|
+
BEFORE: 1,
|
|
28847
|
+
RUN: 2,
|
|
28848
|
+
SUCCESS: 3,
|
|
28849
|
+
ERROR: 4,
|
|
28850
|
+
});
|
|
28851
|
+
|
|
28852
|
+
/**
|
|
28853
|
+
* Enum representing the scope in which a transition hook operates.
|
|
28854
|
+
*
|
|
28855
|
+
* @readonly
|
|
28856
|
+
* @enum {number}
|
|
28857
|
+
*/
|
|
28858
|
+
const TransitionHookScope = Object.freeze({
|
|
28859
|
+
TRANSITION: 0,
|
|
28860
|
+
STATE: 1,
|
|
28861
|
+
});
|
|
28862
|
+
|
|
28813
28863
|
class TransitionHook {
|
|
28814
28864
|
/**
|
|
28815
28865
|
* Chains together an array of TransitionHooks.
|
|
@@ -30628,7 +30678,6 @@
|
|
|
30628
30678
|
}
|
|
30629
30679
|
|
|
30630
30680
|
_defineCoreEvents() {
|
|
30631
|
-
const Phase = TransitionHookPhase;
|
|
30632
30681
|
const TH = TransitionHook;
|
|
30633
30682
|
const paths = this._criteriaPaths;
|
|
30634
30683
|
const NORMAL_SORT = false,
|
|
@@ -30636,7 +30685,7 @@
|
|
|
30636
30685
|
const SYNCHRONOUS = true;
|
|
30637
30686
|
this._defineEvent(
|
|
30638
30687
|
"onCreate",
|
|
30639
|
-
|
|
30688
|
+
TransitionHookPhase.CREATE,
|
|
30640
30689
|
0,
|
|
30641
30690
|
paths.to,
|
|
30642
30691
|
NORMAL_SORT,
|
|
@@ -30644,15 +30693,21 @@
|
|
|
30644
30693
|
TH.THROW_ERROR,
|
|
30645
30694
|
SYNCHRONOUS,
|
|
30646
30695
|
);
|
|
30647
|
-
this._defineEvent("onBefore",
|
|
30648
|
-
this._defineEvent("onStart",
|
|
30649
|
-
this._defineEvent(
|
|
30650
|
-
|
|
30651
|
-
|
|
30652
|
-
|
|
30696
|
+
this._defineEvent("onBefore", TransitionHookPhase.BEFORE, 0, paths.to);
|
|
30697
|
+
this._defineEvent("onStart", TransitionHookPhase.RUN, 0, paths.to);
|
|
30698
|
+
this._defineEvent(
|
|
30699
|
+
"onExit",
|
|
30700
|
+
TransitionHookPhase.RUN,
|
|
30701
|
+
100,
|
|
30702
|
+
paths.exiting,
|
|
30703
|
+
REVERSE_SORT,
|
|
30704
|
+
);
|
|
30705
|
+
this._defineEvent("onRetain", TransitionHookPhase.RUN, 200, paths.retained);
|
|
30706
|
+
this._defineEvent("onEnter", TransitionHookPhase.RUN, 300, paths.entering);
|
|
30707
|
+
this._defineEvent("onFinish", TransitionHookPhase.RUN, 400, paths.to);
|
|
30653
30708
|
this._defineEvent(
|
|
30654
30709
|
"onSuccess",
|
|
30655
|
-
|
|
30710
|
+
TransitionHookPhase.SUCCESS,
|
|
30656
30711
|
0,
|
|
30657
30712
|
paths.to,
|
|
30658
30713
|
NORMAL_SORT,
|
|
@@ -30662,7 +30717,7 @@
|
|
|
30662
30717
|
);
|
|
30663
30718
|
this._defineEvent(
|
|
30664
30719
|
"onError",
|
|
30665
|
-
|
|
30720
|
+
TransitionHookPhase.ERROR,
|
|
30666
30721
|
0,
|
|
30667
30722
|
paths.to,
|
|
30668
30723
|
NORMAL_SORT,
|
|
@@ -30928,7 +30983,7 @@
|
|
|
30928
30983
|
|
|
30929
30984
|
/**
|
|
30930
30985
|
*
|
|
30931
|
-
* @param {import("./interface.
|
|
30986
|
+
* @param {import("./interface.ts").StateDeclaration} definition
|
|
30932
30987
|
*/
|
|
30933
30988
|
state(definition) {
|
|
30934
30989
|
if (!definition.name) {
|
|
@@ -32228,7 +32283,7 @@
|
|
|
32228
32283
|
);
|
|
32229
32284
|
}
|
|
32230
32285
|
|
|
32231
|
-
/** @typedef {import('./interface.
|
|
32286
|
+
/** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
|
|
32232
32287
|
|
|
32233
32288
|
/**
|
|
32234
32289
|
* Internal representation of a ng-router state.
|
|
@@ -32251,7 +32306,7 @@
|
|
|
32251
32306
|
includes = undefined;
|
|
32252
32307
|
|
|
32253
32308
|
/**
|
|
32254
|
-
* @param {import('./interface.
|
|
32309
|
+
* @param {import('./interface.ts').StateDeclaration} config
|
|
32255
32310
|
*/
|
|
32256
32311
|
constructor(config) {
|
|
32257
32312
|
Object.assign(this, config);
|
|
@@ -32259,7 +32314,7 @@
|
|
|
32259
32314
|
return this;
|
|
32260
32315
|
};
|
|
32261
32316
|
/**
|
|
32262
|
-
* @type {import('./interface.
|
|
32317
|
+
* @type {import('./interface.ts').StateDeclaration}
|
|
32263
32318
|
*/
|
|
32264
32319
|
this.self = config;
|
|
32265
32320
|
/**
|
|
@@ -34648,7 +34703,7 @@
|
|
|
34648
34703
|
* ```
|
|
34649
34704
|
*/
|
|
34650
34705
|
|
|
34651
|
-
/** @type {import("../../interface.
|
|
34706
|
+
/** @type {import("../../interface.ts").AnnotatedDirectiveFactory} */
|
|
34652
34707
|
let ngView = [
|
|
34653
34708
|
"$view",
|
|
34654
34709
|
"$animate",
|
|
@@ -34659,7 +34714,7 @@
|
|
|
34659
34714
|
* @param {*} $animate
|
|
34660
34715
|
* @param {*} $viewScroll
|
|
34661
34716
|
* @param {*} $interpolate
|
|
34662
|
-
* @returns {import("../../interface.
|
|
34717
|
+
* @returns {import("../../interface.ts").Directive}
|
|
34663
34718
|
*/
|
|
34664
34719
|
function $ViewDirective($view, $animate, $viewScroll, $interpolate) {
|
|
34665
34720
|
function getRenderer() {
|
|
@@ -35085,7 +35140,8 @@
|
|
|
35085
35140
|
}
|
|
35086
35141
|
|
|
35087
35142
|
/**
|
|
35088
|
-
* @param {"get" | "delete" | "post" | "put"} method
|
|
35143
|
+
* @param {"get" | "delete" | "post" | "put"} method - HTTP method applied to request
|
|
35144
|
+
* @param {string} [attrOverride] - Custom name to use for the attribute
|
|
35089
35145
|
* @returns {ng.DirectiveFactory}
|
|
35090
35146
|
*/
|
|
35091
35147
|
function defineDirective(method, attrOverride) {
|
|
@@ -35099,6 +35155,7 @@
|
|
|
35099
35155
|
$injectTokens.$parse,
|
|
35100
35156
|
$injectTokens.$state,
|
|
35101
35157
|
$injectTokens.$sse,
|
|
35158
|
+
$injectTokens.$animate,
|
|
35102
35159
|
];
|
|
35103
35160
|
return directive;
|
|
35104
35161
|
}
|
|
@@ -35118,15 +35175,11 @@
|
|
|
35118
35175
|
/** @type {ng.DirectiveFactory} */
|
|
35119
35176
|
const ngSseDirective = defineDirective("get", "ngSse");
|
|
35120
35177
|
|
|
35121
|
-
/**
|
|
35122
|
-
* @typedef {"click" | "change" | "submit"} EventType
|
|
35123
|
-
*/
|
|
35124
|
-
|
|
35125
35178
|
/**
|
|
35126
35179
|
* Selects DOM event to listen for based on the element type.
|
|
35127
35180
|
*
|
|
35128
35181
|
* @param {Element} element - The DOM element to inspect.
|
|
35129
|
-
* @returns {
|
|
35182
|
+
* @returns {"click" | "change" | "submit"} The name of the event to listen for.
|
|
35130
35183
|
*/
|
|
35131
35184
|
function getEventNameForElement(element) {
|
|
35132
35185
|
const tag = element.tagName.toLowerCase();
|
|
@@ -35138,89 +35191,6 @@
|
|
|
35138
35191
|
return "click";
|
|
35139
35192
|
}
|
|
35140
35193
|
|
|
35141
|
-
/**
|
|
35142
|
-
* Handles DOM manipulation based on a swap strategy and server-rendered HTML.
|
|
35143
|
-
*
|
|
35144
|
-
* @param {string} html - The HTML string returned from the server.
|
|
35145
|
-
* @param {import("./interface.ts").SwapModeType} swap
|
|
35146
|
-
* @param {Element} target - The target DOM element to apply the swap to.
|
|
35147
|
-
* @param {ng.Scope} scope
|
|
35148
|
-
* @param {ng.CompileService} $compile
|
|
35149
|
-
*/
|
|
35150
|
-
function handleSwapResponse(html, swap, target, scope, $compile) {
|
|
35151
|
-
let nodes = [];
|
|
35152
|
-
if (!["textcontent", "delete", "none"].includes(swap)) {
|
|
35153
|
-
if (!html) {
|
|
35154
|
-
return;
|
|
35155
|
-
}
|
|
35156
|
-
|
|
35157
|
-
if (isObject(html)) {
|
|
35158
|
-
scope.$merge(html);
|
|
35159
|
-
return;
|
|
35160
|
-
}
|
|
35161
|
-
|
|
35162
|
-
const compiled = $compile(html)(scope);
|
|
35163
|
-
nodes =
|
|
35164
|
-
compiled instanceof DocumentFragment
|
|
35165
|
-
? Array.from(compiled.childNodes)
|
|
35166
|
-
: [compiled];
|
|
35167
|
-
}
|
|
35168
|
-
|
|
35169
|
-
switch (swap) {
|
|
35170
|
-
case "innerHTML":
|
|
35171
|
-
target.replaceChildren(...nodes);
|
|
35172
|
-
break;
|
|
35173
|
-
|
|
35174
|
-
case "outerHTML": {
|
|
35175
|
-
const parent = target.parentNode;
|
|
35176
|
-
if (!parent) return;
|
|
35177
|
-
const frag = document.createDocumentFragment();
|
|
35178
|
-
nodes.forEach((n) => frag.appendChild(n));
|
|
35179
|
-
parent.replaceChild(frag, target);
|
|
35180
|
-
break;
|
|
35181
|
-
}
|
|
35182
|
-
|
|
35183
|
-
case "textContent":
|
|
35184
|
-
target.textContent = html;
|
|
35185
|
-
break;
|
|
35186
|
-
|
|
35187
|
-
case "beforebegin":
|
|
35188
|
-
nodes.forEach((node) => target.parentNode.insertBefore(node, target));
|
|
35189
|
-
break;
|
|
35190
|
-
|
|
35191
|
-
case "afterbegin":
|
|
35192
|
-
nodes
|
|
35193
|
-
.slice()
|
|
35194
|
-
.reverse()
|
|
35195
|
-
.forEach((node) => target.insertBefore(node, target.firstChild));
|
|
35196
|
-
break;
|
|
35197
|
-
|
|
35198
|
-
case "beforeend":
|
|
35199
|
-
nodes.forEach((node) => target.appendChild(node));
|
|
35200
|
-
break;
|
|
35201
|
-
|
|
35202
|
-
case "afterend":
|
|
35203
|
-
nodes
|
|
35204
|
-
.slice()
|
|
35205
|
-
.reverse()
|
|
35206
|
-
.forEach((node) =>
|
|
35207
|
-
target.parentNode.insertBefore(node, target.nextSibling),
|
|
35208
|
-
);
|
|
35209
|
-
break;
|
|
35210
|
-
|
|
35211
|
-
case "delete":
|
|
35212
|
-
target.remove();
|
|
35213
|
-
break;
|
|
35214
|
-
|
|
35215
|
-
case "none":
|
|
35216
|
-
break;
|
|
35217
|
-
|
|
35218
|
-
default:
|
|
35219
|
-
target.replaceChildren(...nodes);
|
|
35220
|
-
break;
|
|
35221
|
-
}
|
|
35222
|
-
}
|
|
35223
|
-
|
|
35224
35194
|
/**
|
|
35225
35195
|
* Creates an HTTP directive factory that supports GET, DELETE, POST, PUT.
|
|
35226
35196
|
*
|
|
@@ -35229,6 +35199,8 @@
|
|
|
35229
35199
|
* @returns {ng.DirectiveFactory}
|
|
35230
35200
|
*/
|
|
35231
35201
|
function createHttpDirective(method, attrName) {
|
|
35202
|
+
let content = undefined;
|
|
35203
|
+
|
|
35232
35204
|
/**
|
|
35233
35205
|
* @param {ng.HttpService} $http
|
|
35234
35206
|
* @param {ng.CompileService} $compile
|
|
@@ -35238,7 +35210,125 @@
|
|
|
35238
35210
|
* @param {ng.SseService} $sse
|
|
35239
35211
|
* @returns {ng.Directive}
|
|
35240
35212
|
*/
|
|
35241
|
-
return function ($http, $compile, $log, $parse, $state, $sse) {
|
|
35213
|
+
return function ($http, $compile, $log, $parse, $state, $sse, $animate) {
|
|
35214
|
+
/**
|
|
35215
|
+
* Handles DOM manipulation based on a swap strategy and server-rendered HTML.
|
|
35216
|
+
*
|
|
35217
|
+
* @param {string | Object} html - The HTML string or object returned from the server.
|
|
35218
|
+
* @param {import("./interface.ts").SwapModeType} swap
|
|
35219
|
+
* @param {ng.Scope} scope
|
|
35220
|
+
* @param {ng.Attributes} attrs
|
|
35221
|
+
* @param {Element} element
|
|
35222
|
+
*/
|
|
35223
|
+
function handleSwapResponse(html, swap, scope, attrs, element) {
|
|
35224
|
+
let animationEnabled = false;
|
|
35225
|
+
if (attrs.animate) {
|
|
35226
|
+
animationEnabled = true;
|
|
35227
|
+
}
|
|
35228
|
+
let nodes = [];
|
|
35229
|
+
if (!["textcontent", "delete", "none"].includes(swap)) {
|
|
35230
|
+
if (!html) return;
|
|
35231
|
+
const compiled = $compile(html)(scope);
|
|
35232
|
+
nodes =
|
|
35233
|
+
compiled instanceof DocumentFragment
|
|
35234
|
+
? Array.from(compiled.childNodes)
|
|
35235
|
+
: [compiled];
|
|
35236
|
+
}
|
|
35237
|
+
|
|
35238
|
+
const targetSelector = attrs["target"];
|
|
35239
|
+
const target = targetSelector
|
|
35240
|
+
? document.querySelector(targetSelector)
|
|
35241
|
+
: element;
|
|
35242
|
+
|
|
35243
|
+
if (!target) {
|
|
35244
|
+
$log.warn(`${attrName}: target "${targetSelector}" not found`);
|
|
35245
|
+
return;
|
|
35246
|
+
}
|
|
35247
|
+
|
|
35248
|
+
switch (swap) {
|
|
35249
|
+
case "innerHTML":
|
|
35250
|
+
if (animationEnabled) {
|
|
35251
|
+
if (content) {
|
|
35252
|
+
$animate.leave(content).done(() => {
|
|
35253
|
+
content = nodes[0];
|
|
35254
|
+
$animate.enter(nodes[0], target);
|
|
35255
|
+
scope.$flushQueue();
|
|
35256
|
+
});
|
|
35257
|
+
scope.$flushQueue();
|
|
35258
|
+
} else {
|
|
35259
|
+
content = nodes[0];
|
|
35260
|
+
$animate.enter(nodes[0], target);
|
|
35261
|
+
scope.$flushQueue();
|
|
35262
|
+
}
|
|
35263
|
+
} else {
|
|
35264
|
+
target.replaceChildren(...nodes);
|
|
35265
|
+
}
|
|
35266
|
+
break;
|
|
35267
|
+
|
|
35268
|
+
case "outerHTML": {
|
|
35269
|
+
const parent = target.parentNode;
|
|
35270
|
+
if (!parent) return;
|
|
35271
|
+
const frag = document.createDocumentFragment();
|
|
35272
|
+
nodes.forEach((n) => frag.appendChild(n));
|
|
35273
|
+
if (animationEnabled) {
|
|
35274
|
+
const placeholder = document.createComment("placeholder");
|
|
35275
|
+
target.parentNode.insertBefore(placeholder, target.nextSibling);
|
|
35276
|
+
$animate.leave(target).done(() => {
|
|
35277
|
+
const insertedNodes = Array.from(frag.childNodes);
|
|
35278
|
+
insertedNodes.forEach((n) =>
|
|
35279
|
+
$animate.enter(n, parent, placeholder),
|
|
35280
|
+
);
|
|
35281
|
+
content = insertedNodes;
|
|
35282
|
+
scope.$flushQueue();
|
|
35283
|
+
});
|
|
35284
|
+
scope.$flushQueue();
|
|
35285
|
+
} else {
|
|
35286
|
+
parent.replaceChild(frag, target);
|
|
35287
|
+
}
|
|
35288
|
+
break;
|
|
35289
|
+
}
|
|
35290
|
+
|
|
35291
|
+
case "textContent":
|
|
35292
|
+
target.textContent = html;
|
|
35293
|
+
break;
|
|
35294
|
+
|
|
35295
|
+
case "beforebegin":
|
|
35296
|
+
nodes.forEach((node) => target.parentNode.insertBefore(node, target));
|
|
35297
|
+
break;
|
|
35298
|
+
|
|
35299
|
+
case "afterbegin":
|
|
35300
|
+
nodes
|
|
35301
|
+
.slice()
|
|
35302
|
+
.reverse()
|
|
35303
|
+
.forEach((node) => target.insertBefore(node, target.firstChild));
|
|
35304
|
+
break;
|
|
35305
|
+
|
|
35306
|
+
case "beforeend":
|
|
35307
|
+
nodes.forEach((node) => target.appendChild(node));
|
|
35308
|
+
break;
|
|
35309
|
+
|
|
35310
|
+
case "afterend":
|
|
35311
|
+
nodes
|
|
35312
|
+
.slice()
|
|
35313
|
+
.reverse()
|
|
35314
|
+
.forEach((node) =>
|
|
35315
|
+
target.parentNode.insertBefore(node, target.nextSibling),
|
|
35316
|
+
);
|
|
35317
|
+
break;
|
|
35318
|
+
|
|
35319
|
+
case "delete":
|
|
35320
|
+
target.remove();
|
|
35321
|
+
break;
|
|
35322
|
+
|
|
35323
|
+
case "none":
|
|
35324
|
+
break;
|
|
35325
|
+
|
|
35326
|
+
default:
|
|
35327
|
+
target.replaceChildren(...nodes);
|
|
35328
|
+
break;
|
|
35329
|
+
}
|
|
35330
|
+
}
|
|
35331
|
+
|
|
35242
35332
|
/**
|
|
35243
35333
|
* Collects form data from the element or its associated form.
|
|
35244
35334
|
*
|
|
@@ -35252,15 +35342,12 @@
|
|
|
35252
35342
|
const tag = element.tagName.toLowerCase();
|
|
35253
35343
|
|
|
35254
35344
|
if (tag === "form") {
|
|
35255
|
-
/** @type {HTMLFormElement} */
|
|
35256
35345
|
form = /** @type {HTMLFormElement} */ (element);
|
|
35257
35346
|
} else if ("form" in element && element.form) {
|
|
35258
|
-
/** @type {HTMLFormElement} */
|
|
35259
35347
|
form = /** @type {HTMLFormElement} */ (element.form);
|
|
35260
35348
|
} else if (element.hasAttribute("form")) {
|
|
35261
35349
|
const formId = element.getAttribute("form");
|
|
35262
35350
|
if (formId) {
|
|
35263
|
-
/** @type {HTMLElement | null} */
|
|
35264
35351
|
const maybeForm = document.getElementById(formId);
|
|
35265
35352
|
if (maybeForm && maybeForm.tagName.toLowerCase() === "form") {
|
|
35266
35353
|
form = /** @type {HTMLFormElement} */ (maybeForm);
|
|
@@ -35298,13 +35385,10 @@
|
|
|
35298
35385
|
return {
|
|
35299
35386
|
restrict: "A",
|
|
35300
35387
|
link(scope, element, attrs) {
|
|
35301
|
-
const eventName =
|
|
35302
|
-
attrs["trigger"] ||
|
|
35303
|
-
/** @type {EventType} */ getEventNameForElement(element);
|
|
35304
|
-
|
|
35388
|
+
const eventName = attrs.trigger || getEventNameForElement(element);
|
|
35305
35389
|
const tag = element.tagName.toLowerCase();
|
|
35306
35390
|
|
|
35307
|
-
if (isDefined(attrs
|
|
35391
|
+
if (isDefined(attrs.latch)) {
|
|
35308
35392
|
attrs.$observe(
|
|
35309
35393
|
"latch",
|
|
35310
35394
|
callBackAfterFirst(() =>
|
|
@@ -35320,24 +35404,14 @@
|
|
|
35320
35404
|
element.dispatchEvent(new Event(eventName));
|
|
35321
35405
|
intervalId = setInterval(
|
|
35322
35406
|
() => element.dispatchEvent(new Event(eventName)),
|
|
35323
|
-
parseInt(attrs
|
|
35407
|
+
parseInt(attrs.interval) || 1000,
|
|
35324
35408
|
);
|
|
35325
35409
|
}
|
|
35326
35410
|
|
|
35327
35411
|
element.addEventListener(eventName, async (event) => {
|
|
35328
35412
|
if (/** @type {HTMLButtonElement} */ (element).disabled) return;
|
|
35329
35413
|
if (tag === "form") event.preventDefault();
|
|
35330
|
-
const swap = attrs
|
|
35331
|
-
const targetSelector = attrs["target"];
|
|
35332
|
-
const target = targetSelector
|
|
35333
|
-
? document.querySelector(targetSelector)
|
|
35334
|
-
: element;
|
|
35335
|
-
|
|
35336
|
-
if (!target) {
|
|
35337
|
-
$log.warn(`${attrName}: target "${targetSelector}" not found`);
|
|
35338
|
-
return;
|
|
35339
|
-
}
|
|
35340
|
-
|
|
35414
|
+
const swap = attrs.swap || "innerHTML";
|
|
35341
35415
|
const url = attrs[attrName];
|
|
35342
35416
|
if (!url) {
|
|
35343
35417
|
$log.warn(`${attrName}: no URL specified`);
|
|
@@ -35345,56 +35419,57 @@
|
|
|
35345
35419
|
}
|
|
35346
35420
|
|
|
35347
35421
|
const handler = (res) => {
|
|
35348
|
-
if (isDefined(attrs
|
|
35422
|
+
if (isDefined(attrs.loading)) {
|
|
35349
35423
|
attrs.$set("loading", false);
|
|
35350
35424
|
}
|
|
35351
35425
|
|
|
35352
|
-
if (isDefined(attrs
|
|
35353
|
-
attrs.$removeClass(attrs
|
|
35426
|
+
if (isDefined(attrs.loadingClass)) {
|
|
35427
|
+
attrs.$removeClass(attrs.loadingClass);
|
|
35354
35428
|
}
|
|
35355
35429
|
|
|
35356
35430
|
const html = res.data;
|
|
35357
35431
|
if (200 <= res.status && res.status <= 299) {
|
|
35358
|
-
if (isDefined(attrs
|
|
35359
|
-
$parse(attrs
|
|
35432
|
+
if (isDefined(attrs.success)) {
|
|
35433
|
+
$parse(attrs.success)(scope, { $res: html });
|
|
35360
35434
|
}
|
|
35361
35435
|
|
|
35362
|
-
if (isDefined(attrs
|
|
35363
|
-
$state.go(attrs
|
|
35436
|
+
if (isDefined(attrs.stateSuccess)) {
|
|
35437
|
+
$state.go(attrs.stateSuccess);
|
|
35364
35438
|
}
|
|
35365
35439
|
} else if (400 <= res.status && res.status <= 599) {
|
|
35366
|
-
if (isDefined(attrs
|
|
35367
|
-
$parse(attrs
|
|
35440
|
+
if (isDefined(attrs.error)) {
|
|
35441
|
+
$parse(attrs.error)(scope, { $res: html });
|
|
35368
35442
|
}
|
|
35369
35443
|
|
|
35370
|
-
if (isDefined(attrs
|
|
35371
|
-
$state.go(attrs
|
|
35444
|
+
if (isDefined(attrs.stateError)) {
|
|
35445
|
+
$state.go(attrs.stateError);
|
|
35372
35446
|
}
|
|
35373
35447
|
}
|
|
35374
35448
|
|
|
35375
|
-
|
|
35376
|
-
|
|
35377
|
-
|
|
35378
|
-
|
|
35379
|
-
|
|
35380
|
-
|
|
35381
|
-
)
|
|
35449
|
+
if (isObject(html)) {
|
|
35450
|
+
if (attrs.target) {
|
|
35451
|
+
scope.$eval(`${attrs.target} = ${JSON.stringify(html)}`);
|
|
35452
|
+
} else {
|
|
35453
|
+
scope.$merge(html);
|
|
35454
|
+
}
|
|
35455
|
+
} else if (isString(html)) {
|
|
35456
|
+
handleSwapResponse(html, swap, scope, attrs, element);
|
|
35457
|
+
}
|
|
35382
35458
|
};
|
|
35383
|
-
if (isDefined(attrs["delay"])) {
|
|
35384
|
-
await wait(parseInt(attrs["delay"]) | 0);
|
|
35385
|
-
}
|
|
35386
35459
|
|
|
35387
|
-
if (
|
|
35388
|
-
|
|
35460
|
+
if (isDefined(attrs.delay)) {
|
|
35461
|
+
await wait(parseInt(attrs.delay) | 0);
|
|
35389
35462
|
}
|
|
35390
35463
|
|
|
35391
|
-
if (
|
|
35464
|
+
if (throttled) return;
|
|
35465
|
+
|
|
35466
|
+
if (isDefined(attrs.throttle)) {
|
|
35392
35467
|
throttled = true;
|
|
35393
35468
|
attrs.$set("throttled", true);
|
|
35394
35469
|
setTimeout(() => {
|
|
35395
35470
|
attrs.$set("throttled", false);
|
|
35396
35471
|
throttled = false;
|
|
35397
|
-
}, parseInt(attrs
|
|
35472
|
+
}, parseInt(attrs.throttle));
|
|
35398
35473
|
}
|
|
35399
35474
|
|
|
35400
35475
|
if (isDefined(attrs["loading"])) {
|
|
@@ -35402,13 +35477,13 @@
|
|
|
35402
35477
|
}
|
|
35403
35478
|
|
|
35404
35479
|
if (isDefined(attrs["loadingClass"])) {
|
|
35405
|
-
attrs.$addClass(attrs
|
|
35480
|
+
attrs.$addClass(attrs.loadingClass);
|
|
35406
35481
|
}
|
|
35407
35482
|
|
|
35408
35483
|
if (method === "post" || method === "put") {
|
|
35409
35484
|
let data;
|
|
35410
35485
|
const config = {};
|
|
35411
|
-
if (attrs
|
|
35486
|
+
if (attrs.enctype) {
|
|
35412
35487
|
config.headers = {
|
|
35413
35488
|
"Content-Type": attrs["enctype"],
|
|
35414
35489
|
};
|
|
@@ -35418,11 +35493,10 @@
|
|
|
35418
35493
|
}
|
|
35419
35494
|
$http[method](url, data, config).then(handler).catch(handler);
|
|
35420
35495
|
} else {
|
|
35421
|
-
|
|
35422
|
-
if (method === "get" && attrs["ngSse"]) {
|
|
35496
|
+
if (method === "get" && attrs.ngSse) {
|
|
35423
35497
|
const sseUrl = url;
|
|
35424
35498
|
const config = {
|
|
35425
|
-
withCredentials: attrs
|
|
35499
|
+
withCredentials: attrs.withCredentials === "true",
|
|
35426
35500
|
transformMessage: (data) => {
|
|
35427
35501
|
try {
|
|
35428
35502
|
return JSON.parse(data);
|
|
@@ -35432,9 +35506,9 @@
|
|
|
35432
35506
|
},
|
|
35433
35507
|
onOpen: () => {
|
|
35434
35508
|
$log.info(`${attrName}: SSE connection opened to ${sseUrl}`);
|
|
35435
|
-
if (isDefined(attrs
|
|
35436
|
-
if (isDefined(attrs
|
|
35437
|
-
attrs.$removeClass(attrs
|
|
35509
|
+
if (isDefined(attrs.loading)) attrs.$set("loading", false);
|
|
35510
|
+
if (isDefined(attrs.loadingClass))
|
|
35511
|
+
attrs.$removeClass(attrs.loadingClass);
|
|
35438
35512
|
},
|
|
35439
35513
|
onMessage: (data) => {
|
|
35440
35514
|
const res = { status: 200, data };
|
|
@@ -35445,12 +35519,15 @@
|
|
|
35445
35519
|
const res = { status: 500, data: err };
|
|
35446
35520
|
handler(res);
|
|
35447
35521
|
},
|
|
35522
|
+
onReconnect: (count) => {
|
|
35523
|
+
$log.info(`ngSse: reconnected ${count} time(s)`);
|
|
35524
|
+
if (attrs.onReconnect)
|
|
35525
|
+
$parse(attrs.onReconnect)(scope, { $count: count });
|
|
35526
|
+
},
|
|
35448
35527
|
};
|
|
35449
35528
|
|
|
35450
|
-
// Open the SSE connection using the injected service
|
|
35451
35529
|
const source = $sse(sseUrl, config);
|
|
35452
35530
|
|
|
35453
|
-
// Cleanup on scope destroy
|
|
35454
35531
|
scope.$on("$destroy", () => {
|
|
35455
35532
|
$log.info(`${attrName}: closing SSE connection`);
|
|
35456
35533
|
source.close();
|
|
@@ -35465,7 +35542,6 @@
|
|
|
35465
35542
|
scope.$on("$destroy", () => clearInterval(intervalId));
|
|
35466
35543
|
}
|
|
35467
35544
|
|
|
35468
|
-
// Eagerly execute for 'load' event
|
|
35469
35545
|
if (eventName == "load") {
|
|
35470
35546
|
element.dispatchEvent(new Event("load"));
|
|
35471
35547
|
}
|
|
@@ -35479,31 +35555,26 @@
|
|
|
35479
35555
|
/**
|
|
35480
35556
|
* @param {ng.LogService} $log
|
|
35481
35557
|
* @param {ng.InjectorService} $injector
|
|
35482
|
-
* @returns {
|
|
35558
|
+
* @returns {ng.Directive}
|
|
35483
35559
|
*/
|
|
35484
35560
|
function ngInjectDirective($log, $injector) {
|
|
35485
35561
|
return {
|
|
35486
35562
|
restrict: "A",
|
|
35487
35563
|
link(scope, _element, attrs) {
|
|
35488
|
-
const expr = attrs
|
|
35489
|
-
|
|
35564
|
+
const expr = attrs.ngInject;
|
|
35490
35565
|
if (!expr) return;
|
|
35491
|
-
|
|
35492
|
-
|
|
35493
|
-
|
|
35494
|
-
|
|
35495
|
-
|
|
35496
|
-
|
|
35497
|
-
|
|
35498
|
-
|
|
35499
|
-
|
|
35500
|
-
}
|
|
35501
|
-
|
|
35502
|
-
|
|
35503
|
-
}
|
|
35504
|
-
},
|
|
35505
|
-
);
|
|
35506
|
-
scope.$apply(replacedExpr);
|
|
35566
|
+
const tokens = expr
|
|
35567
|
+
.split(";")
|
|
35568
|
+
.map((s) => s.trim())
|
|
35569
|
+
.filter(Boolean);
|
|
35570
|
+
|
|
35571
|
+
for (const name of tokens) {
|
|
35572
|
+
if ($injector.has(name)) {
|
|
35573
|
+
scope[name] = $injector.get(name);
|
|
35574
|
+
} else {
|
|
35575
|
+
$log.warn(`Injectable ${name} not found in $injector`);
|
|
35576
|
+
}
|
|
35577
|
+
}
|
|
35507
35578
|
},
|
|
35508
35579
|
};
|
|
35509
35580
|
}
|
|
@@ -35546,38 +35617,54 @@
|
|
|
35546
35617
|
* const source = $sse('/events', {
|
|
35547
35618
|
* onMessage: (data) => console.log(data),
|
|
35548
35619
|
* onError: (err) => console.error(err),
|
|
35549
|
-
*
|
|
35620
|
+
* retryDelay: 2000,
|
|
35621
|
+
* heartbeatTimeout: 10000,
|
|
35550
35622
|
* });
|
|
35551
35623
|
*
|
|
35552
|
-
* // later:
|
|
35553
35624
|
* source.close();
|
|
35554
35625
|
*/
|
|
35555
|
-
|
|
35556
35626
|
class SseProvider {
|
|
35557
35627
|
constructor() {
|
|
35558
35628
|
/**
|
|
35559
35629
|
* Optional provider-level defaults
|
|
35560
35630
|
* @type {ng.SseConfig}
|
|
35561
35631
|
*/
|
|
35562
|
-
this.defaults = {
|
|
35632
|
+
this.defaults = {
|
|
35633
|
+
retryDelay: 1000,
|
|
35634
|
+
maxRetries: Infinity,
|
|
35635
|
+
heartbeatTimeout: 15000, // 15 seconds
|
|
35636
|
+
transformMessage(data) {
|
|
35637
|
+
try {
|
|
35638
|
+
return JSON.parse(data);
|
|
35639
|
+
} catch {
|
|
35640
|
+
return data;
|
|
35641
|
+
}
|
|
35642
|
+
},
|
|
35643
|
+
};
|
|
35563
35644
|
}
|
|
35564
35645
|
|
|
35565
35646
|
/**
|
|
35566
35647
|
* Returns the $sse service function
|
|
35567
35648
|
* @returns {ng.SseService}
|
|
35568
35649
|
*/
|
|
35569
|
-
$get =
|
|
35570
|
-
|
|
35571
|
-
|
|
35572
|
-
|
|
35573
|
-
|
|
35574
|
-
|
|
35650
|
+
$get = [
|
|
35651
|
+
$injectTokens.$log,
|
|
35652
|
+
/** @param {ng.LogService} log */
|
|
35653
|
+
(log) => {
|
|
35654
|
+
this.$log = log;
|
|
35655
|
+
return (url, config = {}) => {
|
|
35656
|
+
const mergedConfig = { ...this.defaults, ...config };
|
|
35657
|
+
const finalUrl = this.#buildUrl(url, mergedConfig.params);
|
|
35658
|
+
return this.#createConnection(finalUrl, mergedConfig);
|
|
35659
|
+
};
|
|
35660
|
+
},
|
|
35661
|
+
];
|
|
35575
35662
|
|
|
35576
35663
|
/**
|
|
35577
35664
|
* Build URL with query parameters
|
|
35578
|
-
* @param {string} url
|
|
35579
|
-
* @param {Record<string, any>=} params
|
|
35580
|
-
* @returns {string}
|
|
35665
|
+
* @param {string} url
|
|
35666
|
+
* @param {Record<string, any>=} params
|
|
35667
|
+
* @returns {string}
|
|
35581
35668
|
*/
|
|
35582
35669
|
#buildUrl(url, params) {
|
|
35583
35670
|
if (!params) return url;
|
|
@@ -35588,37 +35675,81 @@
|
|
|
35588
35675
|
}
|
|
35589
35676
|
|
|
35590
35677
|
/**
|
|
35591
|
-
*
|
|
35592
|
-
* @param {string} url
|
|
35593
|
-
* @param {ng.SseConfig} config
|
|
35594
|
-
* @returns {
|
|
35678
|
+
* Creates a managed SSE connection with reconnect and heartbeat
|
|
35679
|
+
* @param {string} url
|
|
35680
|
+
* @param {ng.SseConfig} config
|
|
35681
|
+
* @returns {import("./interface.ts").SseConnection}
|
|
35595
35682
|
*/
|
|
35596
|
-
#
|
|
35597
|
-
|
|
35598
|
-
|
|
35599
|
-
|
|
35683
|
+
#createConnection(url, config) {
|
|
35684
|
+
let es;
|
|
35685
|
+
let retryCount = 0;
|
|
35686
|
+
let closed = false;
|
|
35687
|
+
let heartbeatTimer;
|
|
35600
35688
|
|
|
35601
|
-
|
|
35602
|
-
|
|
35603
|
-
}
|
|
35689
|
+
const connect = () => {
|
|
35690
|
+
if (closed) return;
|
|
35604
35691
|
|
|
35605
|
-
|
|
35606
|
-
|
|
35607
|
-
|
|
35608
|
-
data = config.transformMessage
|
|
35609
|
-
? config.transformMessage(data)
|
|
35610
|
-
: JSON.parse(data);
|
|
35611
|
-
} catch {
|
|
35612
|
-
// leave as raw string if not JSON
|
|
35613
|
-
}
|
|
35614
|
-
config.onMessage?.(data, e);
|
|
35615
|
-
});
|
|
35692
|
+
es = new EventSource(url, {
|
|
35693
|
+
withCredentials: !!config.withCredentials,
|
|
35694
|
+
});
|
|
35616
35695
|
|
|
35617
|
-
|
|
35618
|
-
|
|
35619
|
-
|
|
35696
|
+
es.addEventListener("open", (e) => {
|
|
35697
|
+
retryCount = 0;
|
|
35698
|
+
config.onOpen?.(e);
|
|
35699
|
+
if (config.heartbeatTimeout) resetHeartbeat();
|
|
35700
|
+
});
|
|
35620
35701
|
|
|
35621
|
-
|
|
35702
|
+
es.addEventListener("message", (e) => {
|
|
35703
|
+
let data = e.data;
|
|
35704
|
+
try {
|
|
35705
|
+
data = config.transformMessage ? config.transformMessage(data) : data;
|
|
35706
|
+
} catch {
|
|
35707
|
+
/* empty */
|
|
35708
|
+
}
|
|
35709
|
+
config.onMessage?.(data, e);
|
|
35710
|
+
if (config.heartbeatTimeout) resetHeartbeat();
|
|
35711
|
+
});
|
|
35712
|
+
|
|
35713
|
+
es.addEventListener("error", (err) => {
|
|
35714
|
+
config.onError?.(err);
|
|
35715
|
+
if (closed) return;
|
|
35716
|
+
es.close();
|
|
35717
|
+
|
|
35718
|
+
if (retryCount < config.maxRetries) {
|
|
35719
|
+
retryCount++;
|
|
35720
|
+
config.onReconnect?.(retryCount);
|
|
35721
|
+
setTimeout(connect, config.retryDelay);
|
|
35722
|
+
} else {
|
|
35723
|
+
this.$log.warn("SSE: Max retries reached");
|
|
35724
|
+
}
|
|
35725
|
+
});
|
|
35726
|
+
};
|
|
35727
|
+
|
|
35728
|
+
const resetHeartbeat = () => {
|
|
35729
|
+
clearTimeout(heartbeatTimer);
|
|
35730
|
+
heartbeatTimer = setTimeout(() => {
|
|
35731
|
+
this.$log.warn("SSE: heartbeat timeout, reconnecting...");
|
|
35732
|
+
es.close();
|
|
35733
|
+
config.onReconnect?.(++retryCount);
|
|
35734
|
+
connect();
|
|
35735
|
+
}, config.heartbeatTimeout);
|
|
35736
|
+
};
|
|
35737
|
+
|
|
35738
|
+
connect();
|
|
35739
|
+
|
|
35740
|
+
return {
|
|
35741
|
+
close() {
|
|
35742
|
+
closed = true;
|
|
35743
|
+
clearTimeout(heartbeatTimer);
|
|
35744
|
+
es.close();
|
|
35745
|
+
},
|
|
35746
|
+
connect() {
|
|
35747
|
+
if (closed == false) {
|
|
35748
|
+
close();
|
|
35749
|
+
}
|
|
35750
|
+
connect();
|
|
35751
|
+
},
|
|
35752
|
+
};
|
|
35622
35753
|
}
|
|
35623
35754
|
}
|
|
35624
35755
|
|
|
@@ -35675,10 +35806,252 @@
|
|
|
35675
35806
|
};
|
|
35676
35807
|
}
|
|
35677
35808
|
|
|
35809
|
+
ngWorkerDirective.$inject = ["$worker", $injectTokens.$parse, $injectTokens.$log];
|
|
35810
|
+
/**
|
|
35811
|
+
* ngWorker directive factory
|
|
35812
|
+
* Usage: <div ng-worker="workerName" data-params="{{ expression }}" data-on-result="callback($result)"></div>
|
|
35813
|
+
*/
|
|
35814
|
+
function ngWorkerDirective($worker, $parse, $log) {
|
|
35815
|
+
return {
|
|
35816
|
+
restrict: "A",
|
|
35817
|
+
link(scope, element, attrs) {
|
|
35818
|
+
const workerName = attrs.ngWorker;
|
|
35819
|
+
if (!workerName) {
|
|
35820
|
+
$log.warn("ngWorker: missing worker name");
|
|
35821
|
+
return;
|
|
35822
|
+
}
|
|
35823
|
+
|
|
35824
|
+
const eventName = attrs.trigger || getEventNameForElement(element);
|
|
35825
|
+
|
|
35826
|
+
let throttled = false;
|
|
35827
|
+
let intervalId;
|
|
35828
|
+
|
|
35829
|
+
if (isDefined(attrs.latch)) {
|
|
35830
|
+
attrs.$observe(
|
|
35831
|
+
"latch",
|
|
35832
|
+
callBackAfterFirst(() => element.dispatchEvent(new Event(eventName))),
|
|
35833
|
+
);
|
|
35834
|
+
}
|
|
35835
|
+
|
|
35836
|
+
if (isDefined(attrs.interval)) {
|
|
35837
|
+
element.dispatchEvent(new Event(eventName));
|
|
35838
|
+
intervalId = setInterval(
|
|
35839
|
+
() => element.dispatchEvent(new Event(eventName)),
|
|
35840
|
+
parseInt(attrs.interval) || 1000,
|
|
35841
|
+
);
|
|
35842
|
+
}
|
|
35843
|
+
|
|
35844
|
+
const worker = $worker(workerName, {
|
|
35845
|
+
onMessage: (result) => {
|
|
35846
|
+
if (isDefined(attrs.dataOnResult)) {
|
|
35847
|
+
$parse(attrs.dataOnResult)(scope, { $result: result });
|
|
35848
|
+
} else {
|
|
35849
|
+
const swap = attrs.swap || "innerHTML";
|
|
35850
|
+
handleSwap(result, swap, element);
|
|
35851
|
+
}
|
|
35852
|
+
},
|
|
35853
|
+
onError: (err) => {
|
|
35854
|
+
$log.error(`[ng-worker:${workerName}]`, err);
|
|
35855
|
+
if (isDefined(attrs.dataOnError)) {
|
|
35856
|
+
$parse(attrs.dataOnError)(scope, { $error: err });
|
|
35857
|
+
} else {
|
|
35858
|
+
element.textContent = "Error";
|
|
35859
|
+
}
|
|
35860
|
+
},
|
|
35861
|
+
});
|
|
35862
|
+
|
|
35863
|
+
element.addEventListener(eventName, async () => {
|
|
35864
|
+
if (element.disabled) return;
|
|
35865
|
+
|
|
35866
|
+
if (isDefined(attrs.delay)) {
|
|
35867
|
+
await wait(parseInt(attrs.delay) || 0);
|
|
35868
|
+
}
|
|
35869
|
+
|
|
35870
|
+
if (throttled) return;
|
|
35871
|
+
|
|
35872
|
+
if (isDefined(attrs.throttle)) {
|
|
35873
|
+
throttled = true;
|
|
35874
|
+
attrs.$set("throttled", true);
|
|
35875
|
+
setTimeout(() => {
|
|
35876
|
+
attrs.$set("throttled", false);
|
|
35877
|
+
throttled = false;
|
|
35878
|
+
}, parseInt(attrs.throttle));
|
|
35879
|
+
}
|
|
35880
|
+
|
|
35881
|
+
let params;
|
|
35882
|
+
try {
|
|
35883
|
+
params = attrs.params ? scope.$eval(attrs.params) : undefined;
|
|
35884
|
+
} catch (err) {
|
|
35885
|
+
$log.error("ngWorker: failed to evaluate data-params", err);
|
|
35886
|
+
params = undefined;
|
|
35887
|
+
}
|
|
35888
|
+
|
|
35889
|
+
worker.post(params);
|
|
35890
|
+
});
|
|
35891
|
+
|
|
35892
|
+
if (intervalId) {
|
|
35893
|
+
scope.$on("$destroy", () => clearInterval(intervalId));
|
|
35894
|
+
}
|
|
35895
|
+
|
|
35896
|
+
if (eventName === "load") {
|
|
35897
|
+
element.dispatchEvent(new Event("load"));
|
|
35898
|
+
}
|
|
35899
|
+
},
|
|
35900
|
+
};
|
|
35901
|
+
}
|
|
35902
|
+
|
|
35903
|
+
/**
|
|
35904
|
+
* Swap result into DOM based on strategy
|
|
35905
|
+
*/
|
|
35906
|
+
function handleSwap(result, swap, element) {
|
|
35907
|
+
switch (swap) {
|
|
35908
|
+
case "outerHTML": {
|
|
35909
|
+
const parent = element.parentNode;
|
|
35910
|
+
if (!parent) return;
|
|
35911
|
+
const temp = document.createElement("div");
|
|
35912
|
+
temp.innerHTML = result;
|
|
35913
|
+
parent.replaceChild(temp.firstChild, element);
|
|
35914
|
+
break;
|
|
35915
|
+
}
|
|
35916
|
+
case "textContent":
|
|
35917
|
+
element.textContent = result;
|
|
35918
|
+
break;
|
|
35919
|
+
case "beforebegin":
|
|
35920
|
+
element.insertAdjacentHTML("beforebegin", result);
|
|
35921
|
+
break;
|
|
35922
|
+
case "afterbegin":
|
|
35923
|
+
element.insertAdjacentHTML("afterbegin", result);
|
|
35924
|
+
break;
|
|
35925
|
+
case "beforeend":
|
|
35926
|
+
element.insertAdjacentHTML("beforeend", result);
|
|
35927
|
+
break;
|
|
35928
|
+
case "afterend":
|
|
35929
|
+
element.insertAdjacentHTML("afterend", result);
|
|
35930
|
+
break;
|
|
35931
|
+
case "innerHTML":
|
|
35932
|
+
default:
|
|
35933
|
+
element.innerHTML = result;
|
|
35934
|
+
break;
|
|
35935
|
+
}
|
|
35936
|
+
}
|
|
35937
|
+
|
|
35938
|
+
/**
|
|
35939
|
+
* Worker Provider
|
|
35940
|
+
*
|
|
35941
|
+
* Usage:
|
|
35942
|
+
* const worker = $worker('./math.worker.js', {
|
|
35943
|
+
* onMessage: (data) => console.log('Result:', data),
|
|
35944
|
+
* onError: (err) => console.error('Worker error:', err),
|
|
35945
|
+
* autoTerminate: false,
|
|
35946
|
+
* transformMessage: (d) => d,
|
|
35947
|
+
* });
|
|
35948
|
+
*
|
|
35949
|
+
* worker.post({ action: 'fib', n: 20 });
|
|
35950
|
+
* worker.terminate();
|
|
35951
|
+
*/
|
|
35952
|
+
class WorkerProvider {
|
|
35953
|
+
/**
|
|
35954
|
+
* @type {ng.LogService}
|
|
35955
|
+
*/
|
|
35956
|
+
$log;
|
|
35957
|
+
constructor() {
|
|
35958
|
+
/**
|
|
35959
|
+
* Optional provider-level defaults
|
|
35960
|
+
* @type {ng.WorkerConfig}
|
|
35961
|
+
*/
|
|
35962
|
+
this.defaults = {
|
|
35963
|
+
autoTerminate: false,
|
|
35964
|
+
transformMessage(data) {
|
|
35965
|
+
try {
|
|
35966
|
+
return JSON.parse(data);
|
|
35967
|
+
} catch {
|
|
35968
|
+
return data;
|
|
35969
|
+
}
|
|
35970
|
+
},
|
|
35971
|
+
};
|
|
35972
|
+
}
|
|
35973
|
+
|
|
35974
|
+
/**
|
|
35975
|
+
* Returns the $worker service function
|
|
35976
|
+
* @returns {ng.WorkerService}
|
|
35977
|
+
*/
|
|
35978
|
+
$get = [
|
|
35979
|
+
$injectTokens.$log,
|
|
35980
|
+
/** @param {ng.LogService} log */
|
|
35981
|
+
(log) => {
|
|
35982
|
+
this.$log = log;
|
|
35983
|
+
return (scriptPath, config = {}) => {
|
|
35984
|
+
const merged = { ...this.defaults, ...config };
|
|
35985
|
+
return this.#createWorker(scriptPath, merged);
|
|
35986
|
+
};
|
|
35987
|
+
},
|
|
35988
|
+
];
|
|
35989
|
+
|
|
35990
|
+
/**
|
|
35991
|
+
* Creates a managed Web Worker instance
|
|
35992
|
+
* @param {string | URL} scriptPath
|
|
35993
|
+
* @param {ng.WorkerConfig} config
|
|
35994
|
+
* @returns {import("./interface.ts").WorkerConnection}
|
|
35995
|
+
*/
|
|
35996
|
+
#createWorker(scriptPath, config) {
|
|
35997
|
+
if (!scriptPath) throw new Error("Worker script path required");
|
|
35998
|
+
|
|
35999
|
+
let worker = new Worker(scriptPath, { type: "module" });
|
|
36000
|
+
let terminated = false;
|
|
36001
|
+
|
|
36002
|
+
const reconnect = () => {
|
|
36003
|
+
if (terminated) return;
|
|
36004
|
+
this.$log.info("Worker: restarting...");
|
|
36005
|
+
worker.terminate();
|
|
36006
|
+
worker = new Worker(scriptPath, { type: "module" });
|
|
36007
|
+
wire(worker);
|
|
36008
|
+
};
|
|
36009
|
+
|
|
36010
|
+
const wire = (w) => {
|
|
36011
|
+
w.onmessage = (e) => {
|
|
36012
|
+
let data = e.data;
|
|
36013
|
+
try {
|
|
36014
|
+
data = config.transformMessage ? config.transformMessage(data) : data;
|
|
36015
|
+
} catch {
|
|
36016
|
+
/* no-op */
|
|
36017
|
+
}
|
|
36018
|
+
config.onMessage?.(data, e);
|
|
36019
|
+
};
|
|
36020
|
+
|
|
36021
|
+
w.onerror = (err) => {
|
|
36022
|
+
config.onError?.(err);
|
|
36023
|
+
if (config.autoRestart) reconnect();
|
|
36024
|
+
};
|
|
36025
|
+
};
|
|
36026
|
+
|
|
36027
|
+
wire(worker);
|
|
36028
|
+
let that = this;
|
|
36029
|
+
return {
|
|
36030
|
+
post(data) {
|
|
36031
|
+
if (terminated) return that.$log.warn("Worker already terminated");
|
|
36032
|
+
try {
|
|
36033
|
+
worker.postMessage(data);
|
|
36034
|
+
} catch (err) {
|
|
36035
|
+
that.$log.error("Worker post failed", err);
|
|
36036
|
+
}
|
|
36037
|
+
},
|
|
36038
|
+
terminate() {
|
|
36039
|
+
terminated = true;
|
|
36040
|
+
worker.terminate();
|
|
36041
|
+
},
|
|
36042
|
+
restart() {
|
|
36043
|
+
if (terminated)
|
|
36044
|
+
return that.$log.warn("Worker cannot restart after terminate");
|
|
36045
|
+
reconnect();
|
|
36046
|
+
},
|
|
36047
|
+
};
|
|
36048
|
+
}
|
|
36049
|
+
}
|
|
36050
|
+
|
|
35678
36051
|
/**
|
|
35679
36052
|
* Initializes core `ng` module.
|
|
35680
|
-
* @param {
|
|
35681
|
-
* @returns {
|
|
36053
|
+
* @param {ng.Angular} angular
|
|
36054
|
+
* @returns {ng.NgModule} `ng` module
|
|
35682
36055
|
*/
|
|
35683
36056
|
function registerNgModule(angular) {
|
|
35684
36057
|
return angular
|
|
@@ -35687,14 +36060,14 @@
|
|
|
35687
36060
|
[],
|
|
35688
36061
|
[
|
|
35689
36062
|
$injectTokens.$provide,
|
|
35690
|
-
/** @param {
|
|
36063
|
+
/** @param {ng.ProvideService} $provide */
|
|
35691
36064
|
($provide) => {
|
|
35692
36065
|
// $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
|
|
35693
36066
|
$provide.provider({
|
|
35694
36067
|
$$sanitizeUri: SanitizeUriProvider,
|
|
35695
36068
|
});
|
|
35696
|
-
$provide.value(
|
|
35697
|
-
$provide.value(
|
|
36069
|
+
$provide.value($injectTokens.$window, window);
|
|
36070
|
+
$provide.value($injectTokens.$document, document);
|
|
35698
36071
|
$provide
|
|
35699
36072
|
.provider($injectTokens.$compile, CompileProvider)
|
|
35700
36073
|
.directive({
|
|
@@ -35707,6 +36080,7 @@
|
|
|
35707
36080
|
ngBind: ngBindDirective,
|
|
35708
36081
|
ngBindHtml: ngBindHtmlDirective,
|
|
35709
36082
|
ngBindTemplate: ngBindTemplateDirective,
|
|
36083
|
+
ngChannel: ngChannelDirective,
|
|
35710
36084
|
ngClass: ngClassDirective,
|
|
35711
36085
|
ngClassEven: ngClassEvenDirective,
|
|
35712
36086
|
ngClassOdd: ngClassOddDirective,
|
|
@@ -35753,11 +36127,13 @@
|
|
|
35753
36127
|
ngValue: ngValueDirective,
|
|
35754
36128
|
ngModelOptions: ngModelOptionsDirective,
|
|
35755
36129
|
ngViewport: ngViewportDirective,
|
|
36130
|
+
ngWorker: ngWorkerDirective,
|
|
35756
36131
|
})
|
|
35757
36132
|
.directive({
|
|
35758
36133
|
input: hiddenInputBrowserCacheDirective,
|
|
35759
36134
|
ngAnimateSwap: ngAnimateSwapDirective,
|
|
35760
36135
|
ngAnimateChildren: $$AnimateChildrenDirective,
|
|
36136
|
+
// aria directives
|
|
35761
36137
|
ngChecked: ngCheckedAriaDirective,
|
|
35762
36138
|
ngClick: ngClickAriaDirective,
|
|
35763
36139
|
ngDblclick: ngDblclickAriaDirective,
|
|
@@ -35769,12 +36145,12 @@
|
|
|
35769
36145
|
ngReadonly: ngReadonlyAriaDirective,
|
|
35770
36146
|
ngRequired: ngRequiredAriaDirective,
|
|
35771
36147
|
ngValue: ngValueAriaDirective,
|
|
36148
|
+
// router directives
|
|
35772
36149
|
ngSref: $StateRefDirective,
|
|
35773
36150
|
ngSrefActive: $StateRefActiveDirective,
|
|
35774
36151
|
ngSrefActiveEq: $StateRefActiveDirective,
|
|
35775
36152
|
ngState: $StateRefDynamicDirective,
|
|
35776
36153
|
ngView: ngView,
|
|
35777
|
-
ngChannel: ngChannelDirective,
|
|
35778
36154
|
})
|
|
35779
36155
|
.directive({
|
|
35780
36156
|
ngView: $ViewDirectiveFill,
|
|
@@ -35792,8 +36168,6 @@
|
|
|
35792
36168
|
$$animateJsDriver: AnimateJsDriverProvider,
|
|
35793
36169
|
$$animateCache: AnimateCacheProvider,
|
|
35794
36170
|
$$animateQueue: AnimateQueueProvider,
|
|
35795
|
-
$$AnimateRunner: AnimateRunnerFactoryProvider,
|
|
35796
|
-
$$animateAsyncRun: AnimateAsyncRunFactoryProvider,
|
|
35797
36171
|
$controller: ControllerProvider,
|
|
35798
36172
|
$exceptionHandler: ExceptionHandlerProvider,
|
|
35799
36173
|
$filter: FilterProvider,
|
|
@@ -35820,6 +36194,7 @@
|
|
|
35820
36194
|
$url: UrlService,
|
|
35821
36195
|
$stateRegistry: StateRegistryProvider,
|
|
35822
36196
|
$eventBus: PubSubProvider,
|
|
36197
|
+
$worker: WorkerProvider,
|
|
35823
36198
|
});
|
|
35824
36199
|
},
|
|
35825
36200
|
],
|
|
@@ -35845,20 +36220,36 @@
|
|
|
35845
36220
|
constructor() {
|
|
35846
36221
|
this.$cache = Cache;
|
|
35847
36222
|
|
|
35848
|
-
/** @type {
|
|
36223
|
+
/** @type {ng.PubSubService} */
|
|
35849
36224
|
this.$eventBus = EventBus;
|
|
35850
36225
|
|
|
35851
36226
|
/**
|
|
35852
36227
|
* @type {string} `version` from `package.json`
|
|
35853
36228
|
*/
|
|
35854
|
-
this.version = "0.
|
|
36229
|
+
this.version = "0.11.0"; //inserted via rollup plugin
|
|
35855
36230
|
|
|
35856
36231
|
/** @type {!Array<string|any>} */
|
|
35857
36232
|
this.bootsrappedModules = [];
|
|
35858
36233
|
|
|
36234
|
+
/**
|
|
36235
|
+
* Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
|
|
36236
|
+
*
|
|
36237
|
+
* @type {(element: Element, name: string?) => ng.Scope|undefined}
|
|
36238
|
+
*/
|
|
35859
36239
|
this.getController = getController;
|
|
36240
|
+
|
|
36241
|
+
/**
|
|
36242
|
+
* Return instance of InjectorService attached to element
|
|
36243
|
+
* @type {(Element) => ng.InjectorService}
|
|
36244
|
+
*/
|
|
35860
36245
|
this.getInjector = getInjector;
|
|
36246
|
+
|
|
36247
|
+
/**
|
|
36248
|
+
* Gets scope for a given element.
|
|
36249
|
+
* @type {(Element) => *}
|
|
36250
|
+
*/
|
|
35861
36251
|
this.getScope = getScope;
|
|
36252
|
+
|
|
35862
36253
|
this.errorHandlingConfig = errorHandlingConfig;
|
|
35863
36254
|
this.$t = $injectTokens;
|
|
35864
36255
|
|
|
@@ -35951,7 +36342,8 @@
|
|
|
35951
36342
|
*/
|
|
35952
36343
|
(scope, el, compile, $injector) => {
|
|
35953
36344
|
// ng-route deps
|
|
35954
|
-
this.$injector = $injector;
|
|
36345
|
+
this.$injector = $injector; // TODO refactor away as this as this prevents multiple apps from being used
|
|
36346
|
+
|
|
35955
36347
|
setCacheData(el, "$injector", $injector);
|
|
35956
36348
|
|
|
35957
36349
|
const compileFn = compile(el);
|
|
@@ -36074,7 +36466,7 @@
|
|
|
36074
36466
|
* @param {string} name The name of the module to create or retrieve.
|
|
36075
36467
|
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
36076
36468
|
* unspecified then the module is being retrieved for further configuration.
|
|
36077
|
-
* @param {import("./interface.
|
|
36469
|
+
* @param {import("./interface.ts").Injectable<any>} [configFn] Optional configuration function for the module that gets
|
|
36078
36470
|
* passed to {@link NgModule.config NgModule.config()}.
|
|
36079
36471
|
* @returns {NgModule} A newly registered module.
|
|
36080
36472
|
*/
|