@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.
Files changed (61) hide show
  1. package/@types/angular.d.ts +24 -11
  2. package/@types/animations/animate-css-driver.d.ts +0 -1
  3. package/@types/animations/animate-css.d.ts +0 -1
  4. package/@types/animations/animate-js-driver.d.ts +1 -7
  5. package/@types/animations/animate-js.d.ts +1 -4
  6. package/@types/animations/animate-queue.d.ts +2 -4
  7. package/@types/animations/animate-swap.d.ts +2 -4
  8. package/@types/animations/animate.d.ts +24 -24
  9. package/@types/animations/animation.d.ts +2 -2
  10. package/@types/animations/interface.d.ts +12 -0
  11. package/@types/animations/raf-scheduler.d.ts +4 -4
  12. package/@types/animations/runner/animate-runner.d.ts +99 -0
  13. package/@types/animations/shared.d.ts +30 -2
  14. package/@types/core/compile/attributes.d.ts +5 -8
  15. package/@types/core/compile/compile.d.ts +4 -4
  16. package/@types/core/controller/controller.d.ts +1 -1
  17. package/@types/core/di/ng-module.d.ts +14 -14
  18. package/@types/core/filter/filter.d.ts +2 -2
  19. package/@types/core/scope/interface.d.ts +18 -0
  20. package/@types/core/scope/scope.d.ts +19 -95
  21. package/@types/directive/aria/aria.d.ts +11 -13
  22. package/@types/directive/attrs/attrs.d.ts +2 -2
  23. package/@types/directive/class/class.d.ts +3 -3
  24. package/@types/directive/events/events.d.ts +0 -2
  25. package/@types/directive/http/http.d.ts +4 -22
  26. package/@types/directive/if/if.d.ts +2 -4
  27. package/@types/directive/include/include.d.ts +2 -2
  28. package/@types/directive/inject/inject.d.ts +2 -2
  29. package/@types/directive/input/input.d.ts +10 -10
  30. package/@types/directive/messages/messages.d.ts +4 -4
  31. package/@types/directive/observe/observe.d.ts +2 -5
  32. package/@types/directive/worker/worker.d.ts +15 -0
  33. package/@types/interface.d.ts +40 -11
  34. package/@types/namespace.d.ts +11 -1
  35. package/@types/ng.d.ts +3 -5
  36. package/@types/router/directives/view-directive.d.ts +2 -2
  37. package/@types/router/params/interface.d.ts +0 -25
  38. package/@types/router/path/path-utils.d.ts +2 -2
  39. package/@types/router/state/interface.d.ts +0 -9
  40. package/@types/router/state/state-object.d.ts +6 -6
  41. package/@types/router/state/state-service.d.ts +3 -3
  42. package/@types/router/template-factory.d.ts +1 -1
  43. package/@types/router/transition/hook-builder.d.ts +1 -1
  44. package/@types/router/transition/interface.d.ts +0 -44
  45. package/@types/router/transition/transition-hook.d.ts +31 -0
  46. package/@types/router/transition/transition-service.d.ts +1 -1
  47. package/@types/router/transition/transition.d.ts +2 -2
  48. package/@types/services/pubsub/pubsub.d.ts +2 -2
  49. package/@types/services/sse/interface.d.ts +27 -1
  50. package/@types/services/sse/sse.d.ts +4 -3
  51. package/@types/services/worker/interface.d.ts +12 -0
  52. package/@types/services/worker/worker.d.ts +31 -0
  53. package/@types/shared/dom.d.ts +4 -5
  54. package/@types/shared/url-utils/url-utils.d.ts +14 -14
  55. package/README.md +1 -1
  56. package/dist/angular-ts.esm.js +1517 -1125
  57. package/dist/angular-ts.umd.js +1517 -1125
  58. package/dist/angular-ts.umd.min.js +1 -1
  59. package/dist/angular.css +1 -1
  60. package/package.json +1 -2
  61. package/@types/animations/animate-runner.d.ts +0 -31
@@ -1,4 +1,4 @@
1
- /* Version: 0.9.9 - October 28, 2025 22:08:29 */
1
+ /* Version: 0.11.0 - November 11, 2025 21:55:57 */
2
2
  const VALID_CLASS = "ng-valid";
3
3
  const INVALID_CLASS = "ng-invalid";
4
4
  const PRISTINE_CLASS = "ng-pristine";
@@ -906,7 +906,7 @@ function assertArgFn(arg, name, acceptArrayAnnotation) {
906
906
  return arg;
907
907
  }
908
908
 
909
- /** @type {import("./interface.js").ErrorHandlingConfig} */
909
+ /** @type {import("./interface.ts").ErrorHandlingConfig} */
910
910
  const minErrConfig = {
911
911
  objectMaxDepth: 5,
912
912
  urlErrorParamsEnabled: true,
@@ -1198,6 +1198,382 @@ function startsWith(str, search) {
1198
1198
  */
1199
1199
  const Cache = new Map();
1200
1200
 
1201
+ /**
1202
+ * @readonly
1203
+ * @enum {number}
1204
+ */
1205
+ const ASTType = {
1206
+ Program: 1,
1207
+ ExpressionStatement: 2,
1208
+ AssignmentExpression: 3,
1209
+ ConditionalExpression: 4,
1210
+ LogicalExpression: 5,
1211
+ BinaryExpression: 6,
1212
+ UnaryExpression: 7,
1213
+ CallExpression: 8,
1214
+ MemberExpression: 9,
1215
+ Identifier: 10,
1216
+ Literal: 11,
1217
+ ArrayExpression: 12,
1218
+ Property: 13,
1219
+ ObjectExpression: 14,
1220
+ ThisExpression: 15,
1221
+ LocalsExpression: 16,
1222
+ NGValueParameter: 17,
1223
+ };
1224
+
1225
+ const ADD_CLASS_SUFFIX = "-add";
1226
+ const REMOVE_CLASS_SUFFIX = "-remove";
1227
+ const EVENT_CLASS_PREFIX = "ng-";
1228
+ const ACTIVE_CLASS_SUFFIX = "-active";
1229
+ const PREPARE_CLASS_SUFFIX = "-prepare";
1230
+
1231
+ const NG_ANIMATE_CLASSNAME = "ng-animate";
1232
+ const NG_ANIMATE_CHILDREN_DATA = "$$ngAnimateChildren";
1233
+ let TRANSITION_PROP;
1234
+ let TRANSITIONEND_EVENT;
1235
+ let ANIMATION_PROP;
1236
+ let ANIMATIONEND_EVENT;
1237
+
1238
+ // If unprefixed events are not supported but webkit-prefixed are, use the latter.
1239
+ // Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
1240
+ // Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
1241
+ // but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
1242
+ // Register both events in case `window.onanimationend` is not supported because of that,
1243
+ // do the same for `transitionend` as Safari is likely to exhibit similar behavior.
1244
+ // Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
1245
+ // therefore there is no reason to test anymore for other vendor prefixes:
1246
+ // http://caniuse.com/#search=transition
1247
+ if (
1248
+ window.ontransitionend === undefined &&
1249
+ window.onwebkittransitionend !== undefined
1250
+ ) {
1251
+ TRANSITION_PROP = "WebkitTransition";
1252
+ TRANSITIONEND_EVENT = "webkitTransitionEnd transitionend";
1253
+ } else {
1254
+ TRANSITION_PROP = "transition";
1255
+ TRANSITIONEND_EVENT = "transitionend";
1256
+ }
1257
+
1258
+ if (
1259
+ window.onanimationend === undefined &&
1260
+ window.onwebkitanimationend !== undefined
1261
+ ) {
1262
+ ANIMATION_PROP = "WebkitAnimation";
1263
+ ANIMATIONEND_EVENT = "webkitAnimationEnd animationend";
1264
+ } else {
1265
+ ANIMATION_PROP = "animation";
1266
+ ANIMATIONEND_EVENT = "animationend";
1267
+ }
1268
+
1269
+ const DURATION_KEY = "Duration";
1270
+ const PROPERTY_KEY = ASTType.Property;
1271
+ const DELAY_KEY = "Delay";
1272
+ const TIMING_KEY = "TimingFunction";
1273
+ const ANIMATION_ITERATION_COUNT_KEY = "IterationCount";
1274
+ const ANIMATION_PLAYSTATE_KEY = "PlayState";
1275
+ const SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
1276
+
1277
+ const ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
1278
+ const ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
1279
+ const TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
1280
+ const TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
1281
+
1282
+ const ngMinErr$1 = minErr("ng");
1283
+ function assertArg(arg, name, reason) {
1284
+ if (!arg) {
1285
+ throw ngMinErr$1(
1286
+ "areq",
1287
+ "Argument '{0}' is {1}",
1288
+ name || "?",
1289
+ reason,
1290
+ );
1291
+ }
1292
+ return arg;
1293
+ }
1294
+
1295
+ function packageStyles(options) {
1296
+ const styles = {};
1297
+ if (options && (options.to || options.from)) {
1298
+ styles.to = options.to;
1299
+ styles.from = options.from;
1300
+ }
1301
+ return styles;
1302
+ }
1303
+
1304
+ function pendClasses(classes, fix, isPrefix) {
1305
+ let className = "";
1306
+
1307
+ classes = Array.isArray(classes)
1308
+ ? classes
1309
+ : classes && isString(classes) && classes.length
1310
+ ? classes.split(/\s+/)
1311
+ : [];
1312
+ classes.forEach((klass, i) => {
1313
+ if (klass && klass.length > 0) {
1314
+ className += i > 0 ? " " : "";
1315
+ className += isPrefix ? fix + klass : klass + fix;
1316
+ }
1317
+ });
1318
+ return className;
1319
+ }
1320
+
1321
+ function removeFromArray(arr, val) {
1322
+ const index = arr.indexOf(val);
1323
+ if (val >= 0) {
1324
+ arr.splice(index, 1);
1325
+ }
1326
+ }
1327
+
1328
+ /**
1329
+ *
1330
+ * @param {NodeList|Node} element
1331
+ * @returns {Node[]|Node|undefined}
1332
+ */
1333
+ function stripCommentsFromElement(element) {
1334
+ if (element instanceof NodeList) {
1335
+ return Array.from(element).filter((x) => x.nodeType == Node.ELEMENT_NODE);
1336
+ } else if (element.nodeType === Node.ELEMENT_NODE) {
1337
+ return /** @type {Node} */ (element);
1338
+ } else {
1339
+ return undefined;
1340
+ }
1341
+ }
1342
+
1343
+ /**
1344
+ * @param {NodeList|Node} element
1345
+ * @returns {Node}
1346
+ */
1347
+ function extractElementNode(element) {
1348
+ if (!element || !Array.isArray(element)) return /** @type {Node} */ (element);
1349
+ for (let i = 0; i < /** @type {NodeList} */ (element).length; i++) {
1350
+ const elm = element[i];
1351
+ if (elm.nodeType === Node.ELEMENT_NODE) {
1352
+ return elm;
1353
+ }
1354
+ }
1355
+ }
1356
+
1357
+ function applyAnimationClassesFactory() {
1358
+ return function (element, options) {
1359
+ if (options.addClass) {
1360
+ element.classList.add(...options.addClass.trim().split(" "));
1361
+ options.addClass = null;
1362
+ }
1363
+ if (options.removeClass) {
1364
+ element.classList.remove(...options.removeClass.trim().split(" "));
1365
+ options.removeClass = null;
1366
+ }
1367
+ };
1368
+ }
1369
+
1370
+ function prepareAnimationOptions(options) {
1371
+ options = options || {};
1372
+ if (!options.$$prepared) {
1373
+ let domOperation = options.domOperation || (() => {});
1374
+ options.domOperation = function () {
1375
+ options.$$domOperationFired = true;
1376
+ domOperation();
1377
+ domOperation = () => {};
1378
+ };
1379
+ options.$$prepared = true;
1380
+ }
1381
+ return options;
1382
+ }
1383
+
1384
+ function applyAnimationStyles(element, options) {
1385
+ applyAnimationFromStyles(element, options);
1386
+ applyAnimationToStyles(element, options);
1387
+ }
1388
+
1389
+ /**
1390
+ * Applies initial animation styles to a DOM element.
1391
+ *
1392
+ * This function sets the element's inline styles using the properties
1393
+ * defined in `options.from`, then clears the property to prevent reuse.
1394
+ *
1395
+ * @param {HTMLElement} element - The target DOM element to apply styles to.
1396
+ * @param {{ from?: Partial<CSSStyleDeclaration> | null }} options - options containing a `from` object with CSS property–value pairs.
1397
+ */
1398
+ function applyAnimationFromStyles(element, options) {
1399
+ if (options.from) {
1400
+ Object.assign(element.style, options.from);
1401
+ options.from = null;
1402
+ }
1403
+ }
1404
+
1405
+ /**
1406
+ * Applies final animation styles to a DOM element.
1407
+ *
1408
+ * This function sets the element's inline styles using the properties
1409
+ * defined in `options.to`, then clears the property to prevent reuse.
1410
+ *
1411
+ * @param {HTMLElement} element - The target DOM element to apply styles to.
1412
+ * @param {{ to?: Partial<CSSStyleDeclaration> | null }} options - options containing a `from` object with CSS property–value pairs.
1413
+ */
1414
+ function applyAnimationToStyles(element, options) {
1415
+ if (options.to) {
1416
+ Object.assign(element.style, options.to);
1417
+ options.to = null;
1418
+ }
1419
+ }
1420
+
1421
+ function mergeAnimationDetails(element, oldAnimation, newAnimation) {
1422
+ const target = oldAnimation.options || {};
1423
+ const newOptions = newAnimation.options || {};
1424
+
1425
+ const toAdd = `${target.addClass || ""} ${newOptions.addClass || ""}`;
1426
+ const toRemove = `${target.removeClass || ""} ${newOptions.removeClass || ""}`;
1427
+ const classes = resolveElementClasses(
1428
+ element.getAttribute("class"),
1429
+ toAdd,
1430
+ toRemove,
1431
+ );
1432
+
1433
+ if (newOptions.preparationClasses) {
1434
+ target.preparationClasses = concatWithSpace(
1435
+ newOptions.preparationClasses,
1436
+ target.preparationClasses,
1437
+ );
1438
+ delete newOptions.preparationClasses;
1439
+ }
1440
+
1441
+ extend(target, newOptions);
1442
+
1443
+ if (classes.addClass) {
1444
+ target.addClass = classes.addClass;
1445
+ } else {
1446
+ target.addClass = null;
1447
+ }
1448
+
1449
+ if (classes.removeClass) {
1450
+ target.removeClass = classes.removeClass;
1451
+ } else {
1452
+ target.removeClass = null;
1453
+ }
1454
+
1455
+ oldAnimation.addClass = target.addClass;
1456
+ oldAnimation.removeClass = target.removeClass;
1457
+
1458
+ return target;
1459
+ }
1460
+
1461
+ function resolveElementClasses(existing, toAdd, toRemove) {
1462
+ const ADD_CLASS = 1;
1463
+ const REMOVE_CLASS = -1;
1464
+
1465
+ const flags = {};
1466
+ existing = splitClassesToLookup(existing);
1467
+
1468
+ toAdd = splitClassesToLookup(toAdd);
1469
+ Object.keys(toAdd).forEach((key) => {
1470
+ flags[key] = ADD_CLASS;
1471
+ });
1472
+
1473
+ toRemove = splitClassesToLookup(toRemove);
1474
+ Object.keys(toRemove).forEach((key) => {
1475
+ flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
1476
+ });
1477
+
1478
+ const classes = {
1479
+ addClass: "",
1480
+ removeClass: "",
1481
+ };
1482
+
1483
+ Object.entries(flags).forEach(([klass, val]) => {
1484
+ let prop, allow;
1485
+ if (val === ADD_CLASS) {
1486
+ prop = "addClass";
1487
+ allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
1488
+ } else if (val === REMOVE_CLASS) {
1489
+ prop = "removeClass";
1490
+ allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
1491
+ }
1492
+ if (allow) {
1493
+ if (classes[prop].length) {
1494
+ classes[prop] += " ";
1495
+ }
1496
+ classes[prop] += klass;
1497
+ }
1498
+ });
1499
+
1500
+ function splitClassesToLookup(classes) {
1501
+ if (isString(classes)) {
1502
+ classes = classes.trim().split(" ");
1503
+ }
1504
+
1505
+ const obj = {};
1506
+ if (classes) {
1507
+ classes.forEach((klass) => {
1508
+ // sometimes the split leaves empty string values
1509
+ // incase extra spaces were applied to the options
1510
+ if (klass.length) {
1511
+ obj[klass] = true;
1512
+ }
1513
+ });
1514
+ }
1515
+ return obj;
1516
+ }
1517
+
1518
+ return classes;
1519
+ }
1520
+
1521
+ function applyGeneratedPreparationClasses(element, event, options) {
1522
+ let classes = "";
1523
+ if (event) {
1524
+ classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
1525
+ }
1526
+ if (options.addClass) {
1527
+ classes = concatWithSpace(
1528
+ classes,
1529
+ pendClasses(options.addClass, ADD_CLASS_SUFFIX),
1530
+ );
1531
+ }
1532
+ if (options.removeClass) {
1533
+ classes = concatWithSpace(
1534
+ classes,
1535
+ pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX),
1536
+ );
1537
+ }
1538
+ if (classes.length) {
1539
+ options.preparationClasses = classes;
1540
+ element.className += ` ${classes}`;
1541
+ }
1542
+ }
1543
+
1544
+ function clearGeneratedClasses(element, options) {
1545
+ if (options.preparationClasses) {
1546
+ options.preparationClasses
1547
+ .split(" ")
1548
+ .forEach((cls) => element.classList.remove(cls));
1549
+ options.preparationClasses = null;
1550
+ }
1551
+ if (options.activeClasses) {
1552
+ options.activeClasses
1553
+ .split(" ")
1554
+ .forEach((cls) => element.classList.remove(cls));
1555
+ options.activeClasses = null;
1556
+ }
1557
+ }
1558
+
1559
+ function blockKeyframeAnimations(node, applyBlock) {
1560
+ const value = applyBlock ? "paused" : "";
1561
+ const key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
1562
+ applyInlineStyle(node, [key, value]);
1563
+ return [key, value];
1564
+ }
1565
+
1566
+ function applyInlineStyle(node, styleTuple) {
1567
+ const prop = styleTuple[0];
1568
+ node.style[prop] = styleTuple[1];
1569
+ }
1570
+
1571
+ function concatWithSpace(a, b) {
1572
+ if (!a) return b;
1573
+ if (!b) return a;
1574
+ return `${a} ${b}`;
1575
+ }
1576
+
1201
1577
  /** @type {number} */
1202
1578
  let jqId = 1;
1203
1579
 
@@ -1521,7 +1897,7 @@ function setIsolateScope(element, scope) {
1521
1897
  * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
1522
1898
  *
1523
1899
  * @param {Element} element - The DOM element to get data from.
1524
- * @param {string} [name] - The DOM element to get data from.
1900
+ * @param {string} [name] - Controller name.
1525
1901
  * @returns {import("../core/scope/scope.js").Scope|undefined} - The retrieved data
1526
1902
  */
1527
1903
  function getController(element, name) {
@@ -1671,7 +2047,7 @@ function cleanElementData(nodes) {
1671
2047
  /**
1672
2048
  * Return instance of InjectorService attached to element
1673
2049
  * @param {Element} element
1674
- * @returns {import('../core/di/internal-injector.js').InjectorService}
2050
+ * @returns {ng.InjectorService}
1675
2051
  */
1676
2052
  function getInjector(element) {
1677
2053
  return getInheritedData(element, "$injector");
@@ -1719,12 +2095,8 @@ function domInsert(element, parentElement, afterElement) {
1719
2095
  // from the dom sometime before this code runs then let's
1720
2096
  // just stick to using the parent element as the anchor
1721
2097
  if (afterElement) {
1722
- const afterNode = extractElementNode$1(afterElement);
1723
- if (
1724
- afterNode &&
1725
- !afterNode.parentNode &&
1726
- !afterNode.previousElementSibling
1727
- ) {
2098
+ const afterNode = extractElementNode(afterElement);
2099
+ if (afterNode && !afterNode.parentNode && !afterNode.previousSibling) {
1728
2100
  afterElement = null;
1729
2101
  }
1730
2102
  }
@@ -1735,14 +2107,24 @@ function domInsert(element, parentElement, afterElement) {
1735
2107
  }
1736
2108
  }
1737
2109
 
1738
- function extractElementNode$1(element) {
1739
- const { length } = element;
1740
- for (let i = 0; i < length; i++) {
1741
- const elm = element[i];
1742
- if (elm.nodeType === Node.ELEMENT_NODE) {
1743
- return elm;
1744
- }
1745
- }
2110
+ function animatedomInsert(element, parent, after) {
2111
+ const originalVisibility = element.style.visibility;
2112
+ const originalPosition = element.style.position;
2113
+ const originalPointerEvents = element.style.pointerEvents;
2114
+
2115
+ Object.assign(element.style, {
2116
+ visibility: "hidden",
2117
+ position: "absolute",
2118
+ pointerEvents: "none",
2119
+ });
2120
+
2121
+ domInsert(element, parent, after);
2122
+
2123
+ requestAnimationFrame(() => {
2124
+ element.style.visibility = originalVisibility;
2125
+ element.style.position = originalPosition;
2126
+ element.style.pointerEvents = originalPointerEvents;
2127
+ });
1746
2128
  }
1747
2129
 
1748
2130
  /**
@@ -1776,8 +2158,6 @@ const $injectTokens = Object.freeze({
1776
2158
  $attrs: "$attrs",
1777
2159
  $scope: "$scope",
1778
2160
  $element: "$element",
1779
- $$AnimateRunner: "$$AnimateRunner",
1780
- $$animateAsyncRun: "$$animateAsyncRun",
1781
2161
  $$animateCache: "$$animateCache",
1782
2162
  $$animateCssDriver: "$$animateCssDriver",
1783
2163
  $$animateJs: "$$animateJs",
@@ -1863,7 +2243,7 @@ class NgModule {
1863
2243
  /**
1864
2244
  * @param {string} name - Name of the module
1865
2245
  * @param {Array<string>} requires - List of modules which the injector will load before the current module
1866
- * @param {import("../../interface.js").Injectable<any>} [configFn]
2246
+ * @param {import("../../interface.ts").Injectable<any>} [configFn]
1867
2247
  */
1868
2248
  constructor(name, requires, configFn) {
1869
2249
  assert(isString(name), "name required");
@@ -1889,7 +2269,7 @@ class NgModule {
1889
2269
  /** @type {!Array<Array<*>>} */
1890
2270
  this.configBlocks = [];
1891
2271
 
1892
- /** @type {!Array.<import("../../interface.js").Injectable<any>>} */
2272
+ /** @type {!Array.<import("../../interface.ts").Injectable<any>>} */
1893
2273
  this.runBlocks = [];
1894
2274
 
1895
2275
  if (configFn) {
@@ -1993,7 +2373,7 @@ class NgModule {
1993
2373
 
1994
2374
  /**
1995
2375
  * @param {string} name
1996
- * @param {import("../../interface.js").Injectable<any>} decorFn
2376
+ * @param {import("../../interface.ts").Injectable<any>} decorFn
1997
2377
  * @returns {NgModule}
1998
2378
  */
1999
2379
  decorator(name, decorFn) {
@@ -2006,7 +2386,7 @@ class NgModule {
2006
2386
 
2007
2387
  /**
2008
2388
  * @param {string} name
2009
- * @param {import("../../interface.js").Injectable<any>} directiveFactory
2389
+ * @param {import("../../interface.ts").Injectable<any>} directiveFactory
2010
2390
  * @returns {NgModule}
2011
2391
  */
2012
2392
  directive(name, directiveFactory) {
@@ -2023,7 +2403,7 @@ class NgModule {
2023
2403
 
2024
2404
  /**
2025
2405
  * @param {string} name
2026
- * @param {import("../../interface.js").Injectable<any>} animationFactory
2406
+ * @param {import("../../interface.ts").Injectable<any>} animationFactory
2027
2407
  * @returns {NgModule}
2028
2408
  */
2029
2409
  animation(name, animationFactory) {
@@ -2040,7 +2420,7 @@ class NgModule {
2040
2420
 
2041
2421
  /**
2042
2422
  * @param {string} name
2043
- * @param {import("../../interface.js").Injectable<any>} filterFn
2423
+ * @param {import("../../interface.ts").Injectable<any>} filterFn
2044
2424
  * @return {NgModule}
2045
2425
  */
2046
2426
  filter(name, filterFn) {
@@ -2053,7 +2433,7 @@ class NgModule {
2053
2433
 
2054
2434
  /**
2055
2435
  * @param {string} name
2056
- * @param {import("../../interface.js").Injectable<any>} ctlFn
2436
+ * @param {import("../../interface.ts").Injectable<any>} ctlFn
2057
2437
  * @returns {NgModule}
2058
2438
  */
2059
2439
  controller(name, ctlFn) {
@@ -2280,6 +2660,8 @@ class InjectorService extends AbstractInjector {
2280
2660
  const hasCache = hasOwn(this.cache, name);
2281
2661
  return hasProvider || hasCache;
2282
2662
  }
2663
+
2664
+ loadNewModules() {}
2283
2665
  }
2284
2666
 
2285
2667
  // Helpers
@@ -2438,7 +2820,7 @@ function createInjector(modulesToLoad, strictDi = false) {
2438
2820
  * Registers a factory.
2439
2821
  * @param {string} name
2440
2822
  * @param {(string|(function(*): *))[]} factoryFn
2441
- * @returns {import('../../interface.js').ServiceProvider}
2823
+ * @returns {import('../../interface.ts').ServiceProvider}
2442
2824
  */
2443
2825
  function factory(name, factoryFn) {
2444
2826
  return provider(name, {
@@ -2460,7 +2842,7 @@ function createInjector(modulesToLoad, strictDi = false) {
2460
2842
  * Registers a service constructor.
2461
2843
  * @param {string} name
2462
2844
  * @param {Function} constructor
2463
- * @returns {import('../../interface.js').ServiceProvider}
2845
+ * @returns {import('../../interface.ts').ServiceProvider}
2464
2846
  */
2465
2847
  function service(name, constructor) {
2466
2848
  return factory(name, [
@@ -2929,7 +3311,7 @@ class ControllerProvider {
2929
3311
 
2930
3312
  /**
2931
3313
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
2932
- * @returns {import("./interface.js").ControllerService} A service function that creates controllers.
3314
+ * @returns {import("./interface.ts").ControllerService} A service function that creates controllers.
2933
3315
  */
2934
3316
  ($injector) => {
2935
3317
  return (expression, locals, later, ident) => {
@@ -3047,18 +3429,19 @@ class ControllerProvider {
3047
3429
  );
3048
3430
  }
3049
3431
  locals.$scope[identifier] = instance;
3432
+ locals.$scope["$controllerIdentifier"] = identifier;
3050
3433
  }
3051
3434
  }
3052
3435
 
3053
3436
  const originUrl = urlResolve(window.location.href);
3054
3437
 
3055
3438
  /**
3056
- * @param {import("./interface.js").ResolvableUrl} url
3057
- * @return {import("./interface.js").ParsedUrl}
3439
+ * @param {import("./interface.ts").ResolvableUrl} url
3440
+ * @return {import("./interface.ts").ParsedUrl}
3058
3441
  */
3059
3442
  function urlResolve(url) {
3060
3443
  if (!isString(url))
3061
- return /** @type {import("./interface.js").ParsedUrl} */ (url);
3444
+ return /** @type {import("./interface.ts").ParsedUrl} */ (url);
3062
3445
 
3063
3446
  const urlParsingNode = new URL(
3064
3447
  /** @type {string} */ (url),
@@ -3090,7 +3473,7 @@ function urlResolve(url) {
3090
3473
  * Parse a request URL and determine whether this is a same-origin request as the application
3091
3474
  * document.
3092
3475
  *
3093
- * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3476
+ * @param {import("./interface.ts").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3094
3477
  * or a parsed URL object.
3095
3478
  * @returns {boolean} Whether the request is for the same origin as the application document.
3096
3479
  */
@@ -3104,7 +3487,7 @@ function urlIsSameOrigin(requestUrl) {
3104
3487
  * Note: The base URL is usually the same as the document location (`location.href`) but can
3105
3488
  * be overriden by using the `<base>` tag.
3106
3489
  *
3107
- * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3490
+ * @param {import("./interface.ts").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3108
3491
  * or a parsed URL object.
3109
3492
  * @returns {boolean} Whether the URL is same-origin as the document base URL.
3110
3493
  */
@@ -3118,7 +3501,7 @@ function urlIsSameOriginAsBaseUrl(requestUrl) {
3118
3501
  *
3119
3502
  * @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
3120
3503
  *
3121
- * @returns {(url: import("./interface.js").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
3504
+ * @returns {(url: import("./interface.ts").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
3122
3505
  * whether it is of an allowed origin.
3123
3506
  */
3124
3507
  function urlIsAllowedOriginFactory(trustedOriginUrls) {
@@ -3131,7 +3514,7 @@ function urlIsAllowedOriginFactory(trustedOriginUrls) {
3131
3514
  * based on a list of trusted-origin URLs. The current location's origin is implicitly
3132
3515
  * trusted.
3133
3516
  *
3134
- * @param {import("./interface.js").ResolvableUrl} requestUrl - The URL to be checked (provided as a string that will be
3517
+ * @param {import("./interface.ts").ResolvableUrl} requestUrl - The URL to be checked (provided as a string that will be
3135
3518
  * resolved or a parsed URL object).
3136
3519
  *
3137
3520
  * @returns {boolean} - Whether the specified URL is of an allowed origin.
@@ -3147,9 +3530,9 @@ function urlIsAllowedOriginFactory(trustedOriginUrls) {
3147
3530
  /**
3148
3531
  * Determine if two URLs share the same origin.
3149
3532
  *
3150
- * @param {import("./interface.js").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
3533
+ * @param {import("./interface.ts").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
3151
3534
  * a dictionary object returned by `urlResolve()`.
3152
- * @param {import("./interface.js").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
3535
+ * @param {import("./interface.ts").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
3153
3536
  * of a dictionary object returned by `urlResolve()`.
3154
3537
  *
3155
3538
  * @returns {boolean} - True if both URLs have the same origin, and false otherwise.
@@ -3783,7 +4166,7 @@ function SceProvider() {
3783
4166
  *
3784
4167
  * @param {string} type The SCE context in which this result will be used.
3785
4168
  * @param {string} expr String expression to compile.
3786
- * @return {import("../../core/parse/interface.js").CompiledExpression} A function which represents the compiled expression:
4169
+ * @return {import("../../core/parse/interface.ts").CompiledExpression} A function which represents the compiled expression:
3787
4170
  *
3788
4171
  * * `context` – `{object}` – an object against which any expressions embedded in the
3789
4172
  * strings are evaluated against (typically a scope object).
@@ -4015,26 +4398,23 @@ function SceProvider() {
4015
4398
  */
4016
4399
  const ngEventDirectives = {};
4017
4400
 
4018
- "click copy cut dblclick focus blur keydown keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup paste submit touchstart touchend touchmove offline online"
4401
+ "click copy cut dblclick focus blur keydown keyup load mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup paste submit touchstart touchend touchmove"
4019
4402
  .split(" ")
4020
4403
  .forEach((eventName) => {
4021
4404
  const directiveName = directiveNormalize(`ng-${eventName}`);
4022
4405
  ngEventDirectives[directiveName] = [
4023
4406
  $injectTokens.$parse,
4024
4407
  $injectTokens.$exceptionHandler,
4025
- $injectTokens.$window,
4026
4408
 
4027
4409
  /**
4028
- * @param {import("../../core/parse/interface.ts").ParseService} $parse
4410
+ * @param {ng.ParseService} $parse
4029
4411
  * @param {ng.ExceptionHandlerService} $exceptionHandler
4030
- * @param {ng.WindowService} $window
4031
4412
  * @returns
4032
4413
  */
4033
- ($parse, $exceptionHandler, $window) => {
4414
+ ($parse, $exceptionHandler) => {
4034
4415
  return createEventDirective(
4035
4416
  $parse,
4036
4417
  $exceptionHandler,
4037
- $window,
4038
4418
  directiveName,
4039
4419
  eventName,
4040
4420
  );
@@ -4046,7 +4426,6 @@ const ngEventDirectives = {};
4046
4426
  *
4047
4427
  * @param {ng.ParseService} $parse
4048
4428
  * @param {ng.ExceptionHandlerService} $exceptionHandler
4049
- * @param {ng.WindowService} $window
4050
4429
  * @param {string} directiveName
4051
4430
  * @param {string} eventName
4052
4431
  * @returns {ng.Directive}
@@ -4054,7 +4433,6 @@ const ngEventDirectives = {};
4054
4433
  function createEventDirective(
4055
4434
  $parse,
4056
4435
  $exceptionHandler,
4057
- $window,
4058
4436
  directiveName,
4059
4437
  eventName,
4060
4438
  ) {
@@ -4123,16 +4501,13 @@ const $compileMinErr$1 = minErr("$compile");
4123
4501
  const SIMPLE_ATTR_NAME = /^\w/;
4124
4502
  const specialAttrHolder = document.createElement("div");
4125
4503
 
4126
- /**
4127
- * @implements {Record<string, any>}
4128
- */
4129
4504
  class Attributes {
4130
4505
  static $nonscope = true;
4131
4506
 
4132
4507
  /**
4133
- * @param {import('../scope/scope.js').Scope} $rootScope
4508
+ * @param {ng.Scope} $rootScope
4134
4509
  * @param {*} $animate
4135
- * @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
4510
+ * @param {ng.ExceptionHandlerService} $exceptionHandler
4136
4511
  * @param {*} $sce
4137
4512
  * @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
4138
4513
  * @param {Object} [attributesToCopy]
@@ -4445,19 +4820,18 @@ function tokenDifference(str1, str2) {
4445
4820
  /**
4446
4821
  * @param {string} source - the name of the attribute to be observed
4447
4822
  * @param {string} prop - the scope property to be updated with attribute value
4448
- * @returns {import("../../interface.ts").Directive}
4823
+ * @returns {ng.Directive}
4449
4824
  */
4450
4825
  function ngObserveDirective(source, prop) {
4451
4826
  return {
4452
4827
  restrict: "A",
4453
4828
  compile: () => (scope, element) => {
4454
- const targetElement = element;
4455
4829
  if (prop === "") {
4456
4830
  prop = source;
4457
4831
  }
4458
4832
  const normalized = kebabToCamel(prop);
4459
4833
  if (!scope[normalized]) {
4460
- scope[normalized] = targetElement.getAttribute(source);
4834
+ scope[normalized] = element.getAttribute(source);
4461
4835
  }
4462
4836
 
4463
4837
  const observer = new MutationObserver((mutations) => {
@@ -4470,7 +4844,7 @@ function ngObserveDirective(source, prop) {
4470
4844
  }
4471
4845
  });
4472
4846
 
4473
- observer.observe(targetElement, {
4847
+ observer.observe(element, {
4474
4848
  attributes: true,
4475
4849
  attributeFilter: [source],
4476
4850
  });
@@ -4496,7 +4870,7 @@ class CompileProvider {
4496
4870
  /* @ignore */ static $inject = [$injectTokens.$provide, $injectTokens.$$sanitizeUriProvider];
4497
4871
 
4498
4872
  /**
4499
- * @param {import('../../interface.js').Provider} $provide
4873
+ * @param {import('../../interface.ts').Provider} $provide
4500
4874
  * @param {import('../sanitize/sanitize-uri.js').SanitizeUriProvider} $$sanitizeUriProvider
4501
4875
  */
4502
4876
  constructor($provide, $$sanitizeUriProvider) {
@@ -4686,7 +5060,7 @@ class CompileProvider {
4686
5060
  /**
4687
5061
  * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
4688
5062
  * or an object map of components where the keys are the names and the values are the component definition objects.
4689
- * @param {import("../../interface.js").Component} options Component definition object (a simplified
5063
+ * @param {import("../../interface.ts").Component} options Component definition object (a simplified
4690
5064
  * {directive definition object}),
4691
5065
  * with the following properties (all optional):
4692
5066
  *
@@ -5472,12 +5846,12 @@ class CompileProvider {
5472
5846
  createEventDirective(
5473
5847
  $parse,
5474
5848
  $exceptionHandler,
5475
- window,
5476
5849
  nName,
5477
5850
  name,
5478
5851
  ),
5479
5852
  );
5480
5853
  } else {
5854
+ // isWindow
5481
5855
  directives.push(
5482
5856
  createWindowEventDirective(
5483
5857
  $parse,
@@ -7467,7 +7841,7 @@ class CompileProvider {
7467
7841
  scope.$handler.watchers
7468
7842
  .get(attrs[attrName])
7469
7843
  ?.forEach((watchFn) => {
7470
- watchFn.listenerFn(val);
7844
+ watchFn.listenerFn(val, scope.$target);
7471
7845
  });
7472
7846
  }
7473
7847
  }
@@ -7880,8 +8254,14 @@ class FormController {
7880
8254
  * state (ng-dirty class). This method will also propagate to parent forms.
7881
8255
  */
7882
8256
  $setDirty() {
7883
- this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
7884
- this.$$animate.addClass(this.$$element, DIRTY_CLASS);
8257
+ if (hasAnimate(this.$$element)) {
8258
+ this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
8259
+ this.$$animate.addClass(this.$$element, DIRTY_CLASS);
8260
+ } else {
8261
+ // Fallback for non-animated environments
8262
+ this.$$element.classList.remove(PRISTINE_CLASS);
8263
+ this.$$element.classList.add(DIRTY_CLASS);
8264
+ }
7885
8265
  this.$dirty = true;
7886
8266
  this.$pristine = false;
7887
8267
  this.$$parentForm.$setDirty();
@@ -7900,11 +8280,18 @@ class FormController {
7900
8280
  * saving or resetting it.
7901
8281
  */
7902
8282
  $setPristine() {
7903
- this.$$animate.setClass(
7904
- this.$$element,
7905
- PRISTINE_CLASS,
7906
- `${DIRTY_CLASS} ${SUBMITTED_CLASS}`,
7907
- );
8283
+ if (hasAnimate(this.$$element)) {
8284
+ this.$$animate.setClass(
8285
+ this.$$element,
8286
+ PRISTINE_CLASS,
8287
+ `${DIRTY_CLASS} ${SUBMITTED_CLASS}`,
8288
+ );
8289
+ } else {
8290
+ // Fallback for non-animated environments
8291
+ this.$$element.classList.remove(DIRTY_CLASS, SUBMITTED_CLASS);
8292
+ this.$$element.classList.add(PRISTINE_CLASS);
8293
+ }
8294
+
7908
8295
  this.$dirty = false;
7909
8296
  this.$pristine = true;
7910
8297
  this.$submitted = false;
@@ -7942,7 +8329,11 @@ class FormController {
7942
8329
  }
7943
8330
 
7944
8331
  $$setSubmitted() {
7945
- this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
8332
+ if (hasAnimate(this.$$element)) {
8333
+ this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
8334
+ } else {
8335
+ this.$$element.classList.add(SUBMITTED_CLASS);
8336
+ }
7946
8337
  this.$submitted = true;
7947
8338
  this.$$controls.forEach((control) => {
7948
8339
  if (control.$$setSubmitted) {
@@ -10497,9 +10888,9 @@ function checkboxInputType(scope, element, attr, ctrl, $filter, $parse) {
10497
10888
  inputDirective.$inject = ["$filter", "$parse"];
10498
10889
 
10499
10890
  /**
10500
- * @param {*} $filter
10501
- * @param {*} $parse
10502
- * @returns {import('../../interface.ts').Directive}
10891
+ * @param {ng.FilterService} $filter
10892
+ * @param {ng.ParseService} $parse
10893
+ * @returns {ng.Directive}
10503
10894
  */
10504
10895
  function inputDirective($filter, $parse) {
10505
10896
  return {
@@ -10523,7 +10914,7 @@ function inputDirective($filter, $parse) {
10523
10914
  }
10524
10915
 
10525
10916
  /**
10526
- * @returns {import('../../interface.ts').Directive}
10917
+ * @returns {ng.Directive}
10527
10918
  */
10528
10919
  function hiddenInputBrowserCacheDirective() {
10529
10920
  const valueProperty = {
@@ -10569,7 +10960,7 @@ function hiddenInputBrowserCacheDirective() {
10569
10960
  const CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
10570
10961
 
10571
10962
  /**
10572
- * @returns {import('../../interface.ts').Directive}
10963
+ * @returns {ng.Directive}
10573
10964
  */
10574
10965
  function ngValueDirective() {
10575
10966
  /**
@@ -10593,15 +10984,15 @@ function ngValueDirective() {
10593
10984
  return {
10594
10985
  restrict: "A",
10595
10986
  priority: 100,
10596
- compile(tpl, tplAttr) {
10597
- if (CONSTANT_VALUE_REGEXP.test(tplAttr["ngValue"])) {
10598
- return function ngValueConstantLink(scope, elm, attr) {
10599
- const value = scope.$eval(attr["ngValue"]);
10987
+ compile(_, tplAttr) {
10988
+ if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
10989
+ return function (scope, elm, attr) {
10990
+ const value = scope.$eval(attr.ngValue);
10600
10991
  updateElementValue(elm, attr, value);
10601
10992
  };
10602
10993
  }
10603
- return function ngValueLink(scope, elm, attr) {
10604
- scope.$watch(attr["ngValue"], (value) => {
10994
+ return function (scope, elm, attr) {
10995
+ scope.$watch(attr.ngValue, (value) => {
10605
10996
  updateElementValue(elm, attr, value);
10606
10997
  });
10607
10998
  };
@@ -11282,17 +11673,20 @@ function ngBindHtmlDirective($parse) {
11282
11673
  /**
11283
11674
  * @param {string} name
11284
11675
  * @param {boolean|number} selector
11285
- * @returns {() => import("../../interface.ts").Directive}
11676
+ * @returns {ng.DirectiveFactory}
11286
11677
  */
11287
11678
  function classDirective(name, selector) {
11288
11679
  name = `ngClass${name}`;
11289
11680
 
11681
+ /**
11682
+ * @returns {ng.Directive}
11683
+ */
11290
11684
  return function () {
11291
11685
  return {
11292
11686
  /**
11293
- * @param {import("../../core/scope/scope.js").Scope} scope
11294
- * @param {Element} element
11295
- * @param {import("../../core/compile/attributes").Attributes} attr
11687
+ * @param {ng.Scope} scope
11688
+ * @param {HTMLElement} element
11689
+ * @param {ng.Attributes} attr
11296
11690
  */
11297
11691
  link(scope, element, attr) {
11298
11692
  let classCounts = getCacheData(element, "$classCounts");
@@ -11466,9 +11860,8 @@ const ngClassEvenDirective = classDirective("Even", 1);
11466
11860
  */
11467
11861
  function ngCloakDirective() {
11468
11862
  return {
11469
- compile(element, attr) {
11863
+ compile(_, attr) {
11470
11864
  attr.$set("ngCloak", undefined);
11471
- element.classList.remove("ng-cloak");
11472
11865
  },
11473
11866
  };
11474
11867
  }
@@ -11552,7 +11945,7 @@ function ngHideDirective($animate) {
11552
11945
  ngIfDirective.$inject = ["$animate"];
11553
11946
  /**
11554
11947
  * @param {*} $animate
11555
- * @returns {import("../../interface.ts").Directive}
11948
+ * @returns {ng.Directive}
11556
11949
  */
11557
11950
  function ngIfDirective($animate) {
11558
11951
  return {
@@ -11562,22 +11955,22 @@ function ngIfDirective($animate) {
11562
11955
  restrict: "A",
11563
11956
  /**
11564
11957
  *
11565
- * @param {import("../../core/scope/scope.js").Scope} $scope
11958
+ * @param {ng.Scope} $scope
11566
11959
  * @param {Element} $element
11567
- * @param {import("../../core/compile/attributes.js").Attributes} $attr
11568
- * @param {Object} _ctrl
11960
+ * @param {ng.Attributes} $attr
11961
+ * @param {*} _ctrl
11569
11962
  * @param {*} $transclude
11570
11963
  */
11571
11964
  link($scope, $element, $attr, _ctrl, $transclude) {
11572
11965
  /** @type {Element} */
11573
11966
  let block;
11574
11967
 
11575
- /** @type {import('../../core/scope/scope.js').Scope} */
11968
+ /** @type {ng.Scope} */
11576
11969
  let childScope;
11577
11970
 
11578
11971
  let previousElements;
11579
11972
 
11580
- $scope.$watch($attr["ngIf"], (value) => {
11973
+ $scope.$watch($attr.ngIf, (value) => {
11581
11974
  if (value) {
11582
11975
  if (!childScope) {
11583
11976
  $transclude((clone, newScope) => {
@@ -11632,7 +12025,7 @@ ngIncludeDirective.$inject = [
11632
12025
  * @param {import("../../services/anchor-scroll/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
11633
12026
  * @param {*} $animate
11634
12027
  * @param {import('../../services/exception/interface.ts').ErrorHandler} $exceptionHandler
11635
- * @returns {import('../../interface.js').Directive}
12028
+ * @returns {import('../../interface.ts').Directive}
11636
12029
  */
11637
12030
  function ngIncludeDirective(
11638
12031
  $templateRequest,
@@ -13014,7 +13407,7 @@ function ngTranscludeDirective($compile) {
13014
13407
  const REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
13015
13408
 
13016
13409
  /**
13017
- * @type {Record<string, import("../../interface.js").DirectiveFactory>}
13410
+ * @type {Record<string, import("../../interface.ts").DirectiveFactory>}
13018
13411
  */
13019
13412
  const ngAttributeAliasDirectives = {};
13020
13413
 
@@ -13587,364 +13980,6 @@ class AnchorScrollProvider {
13587
13980
  ];
13588
13981
  }
13589
13982
 
13590
- /**
13591
- * @readonly
13592
- * @enum {number}
13593
- */
13594
- const ASTType = {
13595
- Program: 1,
13596
- ExpressionStatement: 2,
13597
- AssignmentExpression: 3,
13598
- ConditionalExpression: 4,
13599
- LogicalExpression: 5,
13600
- BinaryExpression: 6,
13601
- UnaryExpression: 7,
13602
- CallExpression: 8,
13603
- MemberExpression: 9,
13604
- Identifier: 10,
13605
- Literal: 11,
13606
- ArrayExpression: 12,
13607
- Property: 13,
13608
- ObjectExpression: 14,
13609
- ThisExpression: 15,
13610
- LocalsExpression: 16,
13611
- NGValueParameter: 17,
13612
- };
13613
-
13614
- const ADD_CLASS_SUFFIX = "-add";
13615
- const REMOVE_CLASS_SUFFIX = "-remove";
13616
- const EVENT_CLASS_PREFIX = "ng-";
13617
- const ACTIVE_CLASS_SUFFIX = "-active";
13618
- const PREPARE_CLASS_SUFFIX = "-prepare";
13619
-
13620
- const NG_ANIMATE_CLASSNAME = "ng-animate";
13621
- const NG_ANIMATE_CHILDREN_DATA = "$$ngAnimateChildren";
13622
- let TRANSITION_PROP;
13623
- let TRANSITIONEND_EVENT;
13624
- let ANIMATION_PROP;
13625
- let ANIMATIONEND_EVENT;
13626
-
13627
- // If unprefixed events are not supported but webkit-prefixed are, use the latter.
13628
- // Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
13629
- // Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
13630
- // but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
13631
- // Register both events in case `window.onanimationend` is not supported because of that,
13632
- // do the same for `transitionend` as Safari is likely to exhibit similar behavior.
13633
- // Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
13634
- // therefore there is no reason to test anymore for other vendor prefixes:
13635
- // http://caniuse.com/#search=transition
13636
- if (
13637
- window.ontransitionend === undefined &&
13638
- window.onwebkittransitionend !== undefined
13639
- ) {
13640
- TRANSITION_PROP = "WebkitTransition";
13641
- TRANSITIONEND_EVENT = "webkitTransitionEnd transitionend";
13642
- } else {
13643
- TRANSITION_PROP = "transition";
13644
- TRANSITIONEND_EVENT = "transitionend";
13645
- }
13646
-
13647
- if (
13648
- window.onanimationend === undefined &&
13649
- window.onwebkitanimationend !== undefined
13650
- ) {
13651
- ANIMATION_PROP = "WebkitAnimation";
13652
- ANIMATIONEND_EVENT = "webkitAnimationEnd animationend";
13653
- } else {
13654
- ANIMATION_PROP = "animation";
13655
- ANIMATIONEND_EVENT = "animationend";
13656
- }
13657
-
13658
- const DURATION_KEY = "Duration";
13659
- const PROPERTY_KEY = ASTType.Property;
13660
- const DELAY_KEY = "Delay";
13661
- const TIMING_KEY = "TimingFunction";
13662
- const ANIMATION_ITERATION_COUNT_KEY = "IterationCount";
13663
- const ANIMATION_PLAYSTATE_KEY = "PlayState";
13664
- const SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
13665
-
13666
- const ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
13667
- const ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
13668
- const TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
13669
- const TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
13670
-
13671
- const ngMinErr$1 = minErr("ng");
13672
- function assertArg(arg, name, reason) {
13673
- if (!arg) {
13674
- throw ngMinErr$1(
13675
- "areq",
13676
- "Argument '{0}' is {1}",
13677
- name || "?",
13678
- reason,
13679
- );
13680
- }
13681
- return arg;
13682
- }
13683
-
13684
- function packageStyles(options) {
13685
- const styles = {};
13686
- if (options && (options.to || options.from)) {
13687
- styles.to = options.to;
13688
- styles.from = options.from;
13689
- }
13690
- return styles;
13691
- }
13692
-
13693
- function pendClasses(classes, fix, isPrefix) {
13694
- let className = "";
13695
-
13696
- classes = Array.isArray(classes)
13697
- ? classes
13698
- : classes && isString(classes) && classes.length
13699
- ? classes.split(/\s+/)
13700
- : [];
13701
- classes.forEach((klass, i) => {
13702
- if (klass && klass.length > 0) {
13703
- className += i > 0 ? " " : "";
13704
- className += isPrefix ? fix + klass : klass + fix;
13705
- }
13706
- });
13707
- return className;
13708
- }
13709
-
13710
- function removeFromArray(arr, val) {
13711
- const index = arr.indexOf(val);
13712
- if (val >= 0) {
13713
- arr.splice(index, 1);
13714
- }
13715
- }
13716
-
13717
- /**
13718
- *
13719
- * @param {NodeList|Node} element
13720
- * @returns {Node[]|Node|undefined}
13721
- */
13722
- function stripCommentsFromElement(element) {
13723
- if (element instanceof NodeList) {
13724
- return Array.from(element).filter((x) => x.nodeType == Node.ELEMENT_NODE);
13725
- } else if (element.nodeType === Node.ELEMENT_NODE) {
13726
- return /** @type {Node} */ (element);
13727
- } else {
13728
- return undefined;
13729
- }
13730
- }
13731
-
13732
- /**
13733
- * @param {NodeList|Node} element
13734
- * @returns {Node}
13735
- */
13736
- function extractElementNode(element) {
13737
- if (!element) return /** @type {Node} */ (element);
13738
- for (let i = 0; i < /** @type {NodeList} */ (element).length; i++) {
13739
- const elm = element[i];
13740
- if (elm.nodeType === Node.ELEMENT_NODE) {
13741
- return elm;
13742
- }
13743
- }
13744
- }
13745
-
13746
- function applyAnimationClassesFactory() {
13747
- return function (element, options) {
13748
- if (options.addClass) {
13749
- element.classList.add(...options.addClass.trim().split(" "));
13750
- options.addClass = null;
13751
- }
13752
- if (options.removeClass) {
13753
- element.classList.remove(...options.removeClass.trim().split(" "));
13754
- options.removeClass = null;
13755
- }
13756
- };
13757
- }
13758
-
13759
- function prepareAnimationOptions(options) {
13760
- options = options || {};
13761
- if (!options.$$prepared) {
13762
- let domOperation = options.domOperation || (() => {});
13763
- options.domOperation = function () {
13764
- options.$$domOperationFired = true;
13765
- domOperation();
13766
- domOperation = () => {};
13767
- };
13768
- options.$$prepared = true;
13769
- }
13770
- return options;
13771
- }
13772
-
13773
- function applyAnimationStyles(element, options) {
13774
- applyAnimationFromStyles(element, options);
13775
- applyAnimationToStyles(element, options);
13776
- }
13777
-
13778
- function applyAnimationFromStyles(element, options) {
13779
- if (options.from) {
13780
- //element.css(options.from);
13781
- options.from = null;
13782
- }
13783
- }
13784
-
13785
- function applyAnimationToStyles(element, options) {
13786
- if (options.to) {
13787
- //element.css(options.to);
13788
- options.to = null;
13789
- }
13790
- }
13791
-
13792
- function mergeAnimationDetails(element, oldAnimation, newAnimation) {
13793
- const target = oldAnimation.options || {};
13794
- const newOptions = newAnimation.options || {};
13795
-
13796
- const toAdd = `${target.addClass || ""} ${newOptions.addClass || ""}`;
13797
- const toRemove = `${target.removeClass || ""} ${newOptions.removeClass || ""}`;
13798
- const classes = resolveElementClasses(
13799
- element.getAttribute("class"),
13800
- toAdd,
13801
- toRemove,
13802
- );
13803
-
13804
- if (newOptions.preparationClasses) {
13805
- target.preparationClasses = concatWithSpace(
13806
- newOptions.preparationClasses,
13807
- target.preparationClasses,
13808
- );
13809
- delete newOptions.preparationClasses;
13810
- }
13811
-
13812
- extend(target, newOptions);
13813
-
13814
- if (classes.addClass) {
13815
- target.addClass = classes.addClass;
13816
- } else {
13817
- target.addClass = null;
13818
- }
13819
-
13820
- if (classes.removeClass) {
13821
- target.removeClass = classes.removeClass;
13822
- } else {
13823
- target.removeClass = null;
13824
- }
13825
-
13826
- oldAnimation.addClass = target.addClass;
13827
- oldAnimation.removeClass = target.removeClass;
13828
-
13829
- return target;
13830
- }
13831
-
13832
- function resolveElementClasses(existing, toAdd, toRemove) {
13833
- const ADD_CLASS = 1;
13834
- const REMOVE_CLASS = -1;
13835
-
13836
- const flags = {};
13837
- existing = splitClassesToLookup(existing);
13838
-
13839
- toAdd = splitClassesToLookup(toAdd);
13840
- Object.keys(toAdd).forEach((key) => {
13841
- flags[key] = ADD_CLASS;
13842
- });
13843
-
13844
- toRemove = splitClassesToLookup(toRemove);
13845
- Object.keys(toRemove).forEach((key) => {
13846
- flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
13847
- });
13848
-
13849
- const classes = {
13850
- addClass: "",
13851
- removeClass: "",
13852
- };
13853
-
13854
- Object.entries(flags).forEach(([klass, val]) => {
13855
- let prop, allow;
13856
- if (val === ADD_CLASS) {
13857
- prop = "addClass";
13858
- allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
13859
- } else if (val === REMOVE_CLASS) {
13860
- prop = "removeClass";
13861
- allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
13862
- }
13863
- if (allow) {
13864
- if (classes[prop].length) {
13865
- classes[prop] += " ";
13866
- }
13867
- classes[prop] += klass;
13868
- }
13869
- });
13870
-
13871
- function splitClassesToLookup(classes) {
13872
- if (isString(classes)) {
13873
- classes = classes.trim().split(" ");
13874
- }
13875
-
13876
- const obj = {};
13877
- if (classes) {
13878
- classes.forEach((klass) => {
13879
- // sometimes the split leaves empty string values
13880
- // incase extra spaces were applied to the options
13881
- if (klass.length) {
13882
- obj[klass] = true;
13883
- }
13884
- });
13885
- }
13886
- return obj;
13887
- }
13888
-
13889
- return classes;
13890
- }
13891
-
13892
- function applyGeneratedPreparationClasses(element, event, options) {
13893
- let classes = "";
13894
- if (event) {
13895
- classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
13896
- }
13897
- if (options.addClass) {
13898
- classes = concatWithSpace(
13899
- classes,
13900
- pendClasses(options.addClass, ADD_CLASS_SUFFIX),
13901
- );
13902
- }
13903
- if (options.removeClass) {
13904
- classes = concatWithSpace(
13905
- classes,
13906
- pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX),
13907
- );
13908
- }
13909
- if (classes.length) {
13910
- options.preparationClasses = classes;
13911
- element.className += ` ${classes}`;
13912
- }
13913
- }
13914
-
13915
- function clearGeneratedClasses(element, options) {
13916
- if (options.preparationClasses) {
13917
- options.preparationClasses
13918
- .split(" ")
13919
- .forEach((cls) => element.classList.remove(cls));
13920
- options.preparationClasses = null;
13921
- }
13922
- if (options.activeClasses) {
13923
- options.activeClasses
13924
- .split(" ")
13925
- .forEach((cls) => element.classList.remove(cls));
13926
- options.activeClasses = null;
13927
- }
13928
- }
13929
-
13930
- function blockKeyframeAnimations(node, applyBlock) {
13931
- const value = applyBlock ? "paused" : "";
13932
- const key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
13933
- applyInlineStyle(node, [key, value]);
13934
- return [key, value];
13935
- }
13936
-
13937
- function applyInlineStyle(node, styleTuple) {
13938
- const prop = styleTuple[0];
13939
- node.style[prop] = styleTuple[1];
13940
- }
13941
-
13942
- function concatWithSpace(a, b) {
13943
- if (!a) return b;
13944
- if (!b) return a;
13945
- return `${a} ${b}`;
13946
- }
13947
-
13948
13983
  /** @typedef {"enter"|"leave"|"move"|"addClass"|"setClass"|"removeClass"} AnimationMethod */
13949
13984
 
13950
13985
  /**
@@ -13979,7 +14014,7 @@ function prepareAnimateOptions(options) {
13979
14014
 
13980
14015
  AnimateProvider.$inject = ["$provide"];
13981
14016
 
13982
- /** @param {import('../interface.ts').Provider} $provide */
14017
+ /** @param {ng.ProvideService} $provide */
13983
14018
  function AnimateProvider($provide) {
13984
14019
  const provider = this;
13985
14020
  let classNameFilter = null;
@@ -14254,7 +14289,7 @@ function AnimateProvider($provide) {
14254
14289
  * Note that this does not cancel the underlying operation, e.g. the setting of classes or
14255
14290
  * adding the element to the DOM.
14256
14291
  *
14257
- * @param {import('./animate-runner.js').AnimateRunner} runner An animation runner returned by an $animate function.
14292
+ * @param {import('./runner/animate-runner.js').AnimateRunner} runner An animation runner returned by an $animate function.
14258
14293
  *
14259
14294
  * @example
14260
14295
  <example module="animationExample" deps="angular-animate.js" animations="true" name="animate-cancel">
@@ -14332,13 +14367,13 @@ function AnimateProvider($provide) {
14332
14367
  *
14333
14368
  * @param {Element} element - the element which will be inserted into the DOM
14334
14369
  * @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
14335
- * @param {Element} after - after the sibling element after which the element will be appended
14370
+ * @param {Element} [after] - after the sibling element after which the element will be appended
14336
14371
  * @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
14337
- * @returns {import('./animate-runner.js').AnimateRunner} the animation runner
14372
+ * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14338
14373
  */
14339
14374
  enter(element, parent, after, options) {
14340
14375
  parent = parent || after.parentElement;
14341
- domInsert(element, parent, after);
14376
+ animatedomInsert(element, parent, after);
14342
14377
  return $$animateQueue.push(
14343
14378
  element,
14344
14379
  "enter",
@@ -14356,11 +14391,11 @@ function AnimateProvider($provide) {
14356
14391
  * @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
14357
14392
  * @param {Element} after - after the sibling element after which the element will be appended
14358
14393
  * @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
14359
- * @returns {import('./animate-runner.js').AnimateRunner} the animation runner
14394
+ * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14360
14395
  */
14361
14396
  move(element, parent, after, options) {
14362
14397
  parent = parent || after.parentElement;
14363
- domInsert(element, parent, after);
14398
+ animatedomInsert(element, parent, after);
14364
14399
  return $$animateQueue.push(
14365
14400
  element,
14366
14401
  "move",
@@ -14375,7 +14410,7 @@ function AnimateProvider($provide) {
14375
14410
  *
14376
14411
  * @param {Element} element the element which will be removed from the DOM
14377
14412
  * @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
14378
- * @returns {import('./animate-runner.js').AnimateRunner} the animation runner
14413
+ * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14379
14414
  */
14380
14415
  leave(element, options) {
14381
14416
  return $$animateQueue.push(
@@ -14404,7 +14439,7 @@ function AnimateProvider($provide) {
14404
14439
  * @param {Element} element the element which the CSS classes will be applied to
14405
14440
  * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
14406
14441
  * @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
14407
- * @return {import('./animate-runner.js').AnimateRunner}} animationRunner the animation runner
14442
+ * @return {import('./runner/animate-runner.js').AnimateRunner}} animationRunner the animation runner
14408
14443
  */
14409
14444
  addClass(element, className, options) {
14410
14445
  options = prepareAnimateOptions(options);
@@ -14423,7 +14458,7 @@ function AnimateProvider($provide) {
14423
14458
  * @param {Element} element the element which the CSS classes will be applied to
14424
14459
  * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
14425
14460
  * @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
14426
- * @return {import('./animate-runner.js').AnimateRunner} animationRunner the animation runner
14461
+ * @return {import('./runner/animate-runner.js').AnimateRunner} animationRunner the animation runner
14427
14462
  */
14428
14463
  removeClass(element, className, options) {
14429
14464
  options = prepareAnimateOptions(options);
@@ -14444,7 +14479,7 @@ function AnimateProvider($provide) {
14444
14479
  * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
14445
14480
  * @param {object=} options an optional collection of options/styles that will be applied to the element.
14446
14481
  *
14447
- * @return {import('./animate-runner.js').AnimateRunner} the animation runner
14482
+ * @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14448
14483
  */
14449
14484
  setClass(element, add, remove, options) {
14450
14485
  options = prepareAnimateOptions(options);
@@ -14472,7 +14507,7 @@ function AnimateProvider($provide) {
14472
14507
  * }
14473
14508
  * });
14474
14509
  * ```
14475
- * @return {import('./animate-runner.js').AnimateRunner} the animation runner
14510
+ * @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14476
14511
  */
14477
14512
  animate(element, from, to, className, options) {
14478
14513
  options = prepareAnimateOptions(options);
@@ -14488,200 +14523,6 @@ function AnimateProvider($provide) {
14488
14523
  ];
14489
14524
  }
14490
14525
 
14491
- function AnimateAsyncRunFactoryProvider() {
14492
- this.$get = [
14493
- function () {
14494
- let waitQueue = [];
14495
-
14496
- function waitForTick(fn) {
14497
- waitQueue.push(fn);
14498
- if (waitQueue.length > 1) return;
14499
- window.requestAnimationFrame(function () {
14500
- for (let i = 0; i < waitQueue.length; i++) {
14501
- waitQueue[i]();
14502
- }
14503
- waitQueue = [];
14504
- });
14505
- }
14506
-
14507
- return function () {
14508
- let passed = false;
14509
- waitForTick(function () {
14510
- passed = true;
14511
- });
14512
- return function (callback) {
14513
- if (passed) {
14514
- callback();
14515
- } else {
14516
- waitForTick(callback);
14517
- }
14518
- };
14519
- };
14520
- },
14521
- ];
14522
- }
14523
-
14524
- const INITIAL_STATE = 0;
14525
- const DONE_PENDING_STATE = 1;
14526
- const DONE_COMPLETE_STATE = 2;
14527
- let $$animateAsyncRun;
14528
-
14529
- function AnimateRunnerFactoryProvider() {
14530
- this.$get = [
14531
- "$$animateAsyncRun",
14532
- function (animateAsyncRun) {
14533
- $$animateAsyncRun = animateAsyncRun;
14534
- return AnimateRunner;
14535
- },
14536
- ];
14537
- }
14538
-
14539
- class AnimateRunner {
14540
- static chain(chain, callback) {
14541
- let index = 0;
14542
-
14543
- function next() {
14544
- if (index === chain.length) {
14545
- callback(true);
14546
- return;
14547
- }
14548
-
14549
- chain[index]((response) => {
14550
- if (response === false) {
14551
- callback(false);
14552
- return;
14553
- }
14554
- index++;
14555
- next();
14556
- });
14557
- }
14558
-
14559
- next();
14560
- }
14561
-
14562
- static all(runners, callback) {
14563
- let count = 0;
14564
- let status = true;
14565
-
14566
- runners.forEach((runner) => {
14567
- runner.done(onProgress);
14568
- });
14569
-
14570
- function onProgress(response) {
14571
- status = status && response;
14572
- if (++count === runners.length) {
14573
- callback(status);
14574
- }
14575
- }
14576
- }
14577
-
14578
- constructor(host) {
14579
- this.setHost(host);
14580
-
14581
- const rafTick = $$animateAsyncRun();
14582
- const timeoutTick = (fn) => {
14583
- setTimeout(fn, 0, false);
14584
- };
14585
-
14586
- this._doneCallbacks = [];
14587
- this._tick = (fn) => {
14588
- if (document.hidden) {
14589
- timeoutTick(fn);
14590
- } else {
14591
- rafTick(fn);
14592
- }
14593
- };
14594
- this._state = 0;
14595
- }
14596
-
14597
- setHost(host) {
14598
- this.host = host || {};
14599
- }
14600
-
14601
- done(fn) {
14602
- if (this._state === DONE_COMPLETE_STATE) {
14603
- fn();
14604
- } else {
14605
- this._doneCallbacks.push(fn);
14606
- }
14607
- }
14608
-
14609
- progress() {}
14610
-
14611
- getPromise() {
14612
- if (!this.promise) {
14613
- const self = this;
14614
- this.promise = new Promise((resolve, reject) => {
14615
- self.done((status) => {
14616
- if (status === false) {
14617
- reject();
14618
- } else {
14619
- resolve();
14620
- }
14621
- });
14622
- });
14623
- }
14624
- return this.promise;
14625
- }
14626
-
14627
- then(resolveHandler, rejectHandler) {
14628
- return this.getPromise().then(resolveHandler, rejectHandler);
14629
- }
14630
-
14631
- catch(handler) {
14632
- return this.getPromise().catch(handler);
14633
- }
14634
-
14635
- finally(handler) {
14636
- return this.getPromise().finally(handler);
14637
- }
14638
-
14639
- pause() {
14640
- if (this.host.pause) {
14641
- this.host.pause();
14642
- }
14643
- }
14644
-
14645
- resume() {
14646
- if (this.host.resume) {
14647
- this.host.resume();
14648
- }
14649
- }
14650
-
14651
- end() {
14652
- if (this.host.end) {
14653
- this.host.end();
14654
- }
14655
- this._resolve(true);
14656
- }
14657
-
14658
- cancel() {
14659
- if (this.host.cancel) {
14660
- this.host.cancel();
14661
- }
14662
- this._resolve(false);
14663
- }
14664
-
14665
- complete(response) {
14666
- if (this._state === INITIAL_STATE) {
14667
- this._state = DONE_PENDING_STATE;
14668
- this._tick(() => {
14669
- this._resolve(response);
14670
- });
14671
- }
14672
- }
14673
-
14674
- _resolve(response) {
14675
- if (this._state !== DONE_COMPLETE_STATE) {
14676
- this._doneCallbacks.forEach((fn) => {
14677
- fn(response);
14678
- });
14679
- this._doneCallbacks.length = 0;
14680
- this._state = DONE_COMPLETE_STATE;
14681
- }
14682
- }
14683
- }
14684
-
14685
14526
  /**
14686
14527
  * Provides an instance of a cache that can be used to store and retrieve template content.
14687
14528
  */
@@ -15261,7 +15102,7 @@ class FilterProvider {
15261
15102
  /* @ignore */ static $inject = [$injectTokens.$provide];
15262
15103
 
15263
15104
  /**
15264
- * @param {import('../../interface.ts').Provider} $provide
15105
+ * @param {ng.ProvideService} $provide
15265
15106
  */
15266
15107
  constructor($provide) {
15267
15108
  this.$provide = $provide;
@@ -17810,7 +17651,7 @@ class InterpolateProvider {
17810
17651
  return concat.join("");
17811
17652
  };
17812
17653
 
17813
- return /**@type {import("./interface.js").InterpolationFunction} */ extend(
17654
+ return /**@type {import("./interface.ts").InterpolationFunction} */ extend(
17814
17655
  (context, cb) => {
17815
17656
  let i = 0;
17816
17657
  const ii = expressions.length;
@@ -19478,7 +19319,7 @@ class LocationProvider {
19478
19319
  /**
19479
19320
  * Registers a callback to be called when the URL changes.
19480
19321
  *
19481
- * @param {import("./interface.js").UrlChangeListener} callback - The callback function to register.
19322
+ * @param {import("./interface.ts").UrlChangeListener} callback - The callback function to register.
19482
19323
  * @returns void
19483
19324
  */
19484
19325
  #onUrlChange(callback) {
@@ -19506,8 +19347,6 @@ class LocationProvider {
19506
19347
  * @returns {Location}
19507
19348
  */
19508
19349
  ($rootScope, $rootElement) => {
19509
- /** @type {Location} */
19510
- let $location;
19511
19350
  const baseHref = getBaseHref(); // if base[href] is undefined, it defaults to ''
19512
19351
  const initialUrl = trimEmptyHash(window.location.href);
19513
19352
  let appBase;
@@ -19525,7 +19364,7 @@ class LocationProvider {
19525
19364
  }
19526
19365
  const appBaseNoFile = stripFile(appBase);
19527
19366
 
19528
- $location = new Location(
19367
+ const $location = new Location(
19529
19368
  appBase,
19530
19369
  appBaseNoFile,
19531
19370
  this.html5ModeConf.enabled,
@@ -20071,16 +19910,9 @@ function nextId() {
20071
19910
  */
20072
19911
  let $parse;
20073
19912
 
20074
- /**@type {import('../../services/exception/exception-handler.js').ErrorHandler} */
19913
+ /**@type {ng.ExceptionHandlerService} */
20075
19914
  let $exceptionHandler;
20076
19915
 
20077
- /**
20078
- * @typedef {Object} AsyncQueueTask
20079
- * @property {Scope} handler
20080
- * @property {Function} fn
20081
- * @property {Object} locals
20082
- */
20083
-
20084
19916
  const $postUpdateQueue = [];
20085
19917
 
20086
19918
  class RootScopeProvider {
@@ -20089,11 +19921,11 @@ class RootScopeProvider {
20089
19921
  }
20090
19922
 
20091
19923
  $get = [
20092
- "$exceptionHandler",
20093
- "$parse",
19924
+ $injectTokens.$exceptionHandler,
19925
+ $injectTokens.$parse,
20094
19926
  /**
20095
- * @param {import('../../services/exception/exception-handler.js').ErrorHandler} exceptionHandler
20096
- * @param {import('../parse/interface.ts').ParseService} parse
19927
+ * @param {ng.ExceptionHandlerService} exceptionHandler
19928
+ * @param {ng.ParseService} parse
20097
19929
  */
20098
19930
  (exceptionHandler, parse) => {
20099
19931
  $exceptionHandler = exceptionHandler;
@@ -20122,6 +19954,9 @@ function createScope(target = {}, context) {
20122
19954
  }
20123
19955
 
20124
19956
  if (typeof target === "object") {
19957
+ if (isUnsafeGlobal(target)) {
19958
+ return target;
19959
+ }
20125
19960
  const proxy = new Proxy(target, context || new Scope());
20126
19961
  for (const key in target) {
20127
19962
  if (hasOwn(target, key)) {
@@ -20139,7 +19974,7 @@ function createScope(target = {}, context) {
20139
19974
  target[key] = createScope(target[key], proxy.$handler);
20140
19975
  }
20141
19976
  } catch {
20142
- // convert only what we can
19977
+ /* empty */
20143
19978
  }
20144
19979
  }
20145
19980
  }
@@ -20151,25 +19986,43 @@ function createScope(target = {}, context) {
20151
19986
  }
20152
19987
 
20153
19988
  /**
20154
- * Listener function definition.
20155
- * @typedef {Object} Listener
20156
- * @property {Object} originalTarget - The original target object.
20157
- * @property {ListenerFunction} listenerFn - The function invoked when changes are detected.
20158
- * @property {import("../parse/interface.ts").CompiledExpression} watchFn
20159
- * @property {number} id - Deregistration id
20160
- * @property {number} scopeId - The scope that created the Listener
20161
- * @property {string[]} property
20162
- * @property {string} [watchProp] - The original property to watch if different from observed key
20163
- * @property {Proxy} [foreignListener]
20164
- *
19989
+ * @param {any} target
19990
+ * @returns {boolean}
20165
19991
  */
19992
+ function isUnsafeGlobal(target) {
19993
+ if (target == null) return false;
19994
+ const t = typeof target;
19995
+ if (t !== "object" && t !== "function") return false;
20166
19996
 
20167
- /**
20168
- * Listener function type.
20169
- * @callback ListenerFunction
20170
- * @param {*} newValue - The new value of the changed property.
20171
- * @param {Object} originalTarget - The original target object.
20172
- */
19997
+ const g = globalThis;
19998
+ if (
19999
+ target === g ||
20000
+ target === g.window ||
20001
+ target === g.document ||
20002
+ target === g.self ||
20003
+ target === g.frames
20004
+ ) {
20005
+ return true;
20006
+ }
20007
+
20008
+ // DOM / browser host object checks
20009
+ if (
20010
+ (typeof Window !== "undefined" && target instanceof Window) ||
20011
+ (typeof Document !== "undefined" && target instanceof Document) ||
20012
+ (typeof Element !== "undefined" && target instanceof Element) ||
20013
+ (typeof Node !== "undefined" && target instanceof Node) ||
20014
+ (typeof EventTarget !== "undefined" && target instanceof EventTarget)
20015
+ ) {
20016
+ return true;
20017
+ }
20018
+
20019
+ // Cross-origin or non-enumerable window objects
20020
+ try {
20021
+ return Object.prototype.toString.call(target) === "[object Window]";
20022
+ } catch {
20023
+ return true;
20024
+ }
20025
+ }
20173
20026
 
20174
20027
  /**
20175
20028
  * Decorator for excluding objects from scope observability
@@ -20196,13 +20049,13 @@ class Scope {
20196
20049
  : context
20197
20050
  : undefined;
20198
20051
 
20199
- /** @type {Map<string, Array<Listener>>} Watch listeners */
20052
+ /** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners */
20200
20053
  this.watchers = context ? context.watchers : new Map();
20201
20054
 
20202
20055
  /** @type {Map<String, Function[]>} Event listeners */
20203
20056
  this.$$listeners = new Map();
20204
20057
 
20205
- /** @type {Map<string, Array<Listener>>} Watch listeners from other proxies */
20058
+ /** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
20206
20059
  this.foreignListeners = context ? context.foreignListeners : new Map();
20207
20060
 
20208
20061
  /** @type {Set<ProxyConstructor>} */
@@ -20247,7 +20100,7 @@ class Scope {
20247
20100
  ? null
20248
20101
  : context;
20249
20102
 
20250
- /** @type {AsyncQueueTask[]} */
20103
+ /** @type {import('./interface.ts').AsyncQueueTask[]} */
20251
20104
  this.$$asyncQueue = [];
20252
20105
 
20253
20106
  this.filters = [];
@@ -20256,6 +20109,31 @@ class Scope {
20256
20109
  this.$$destroyed = false;
20257
20110
 
20258
20111
  this.scheduled = [];
20112
+
20113
+ /** @private */
20114
+ this.propertyMap = {
20115
+ $watch: this.$watch.bind(this),
20116
+ $new: this.$new.bind(this),
20117
+ $newIsolate: this.$newIsolate.bind(this),
20118
+ $destroy: this.$destroy.bind(this),
20119
+ $flushQueue: this.$flushQueue.bind(this),
20120
+ $eval: this.$eval.bind(this),
20121
+ $apply: this.$apply.bind(this),
20122
+ $postUpdate: this.$postUpdate.bind(this),
20123
+ $isRoot: this.#isRoot.bind(this),
20124
+ $proxy: this.$proxy,
20125
+ $on: this.$on.bind(this),
20126
+ $emit: this.$emit.bind(this),
20127
+ $broadcast: this.$broadcast.bind(this),
20128
+ $transcluded: this.$transcluded.bind(this),
20129
+ $handler: /** @type {Scope} */ (this),
20130
+ $parent: this.$parent,
20131
+ $root: this.$root,
20132
+ $children: this.$children,
20133
+ $id: this.$id,
20134
+ $merge: this.$merge.bind(this),
20135
+ $getById: this.$getById.bind(this),
20136
+ };
20259
20137
  }
20260
20138
 
20261
20139
  /**
@@ -20451,8 +20329,8 @@ class Scope {
20451
20329
  // filter for repeaters
20452
20330
  if (this.$target.$$hashKey) {
20453
20331
  foreignListeners = foreignListeners.filter((x) =>
20454
- x.originalTarget.$$hashKey
20455
- ? x.originalTarget.$$hashKey == this.$target.$$hashKey
20332
+ x.originalTarget["$$hashKey"]
20333
+ ? x.originalTarget["$$hashKey"] === this.$target.$$hashKey
20456
20334
  : false,
20457
20335
  );
20458
20336
  }
@@ -20497,29 +20375,8 @@ class Scope {
20497
20375
  this.$proxy = proxy;
20498
20376
  }
20499
20377
 
20500
- this.propertyMap = {
20501
- $watch: this.$watch.bind(this),
20502
- $new: this.$new.bind(this),
20503
- $newIsolate: this.$newIsolate.bind(this),
20504
- $destroy: this.$destroy.bind(this),
20505
- $eval: this.$eval.bind(this),
20506
- $apply: this.$apply.bind(this),
20507
- $postUpdate: this.$postUpdate.bind(this),
20508
- $isRoot: this.#isRoot.bind(this),
20509
- $target: target,
20510
- $proxy: this.$proxy,
20511
- $on: this.$on.bind(this),
20512
- $emit: this.$emit.bind(this),
20513
- $broadcast: this.$broadcast.bind(this),
20514
- $transcluded: this.$transcluded.bind(this),
20515
- $handler: /** @type {Scope} */ (this),
20516
- $parent: this.$parent,
20517
- $root: this.$root,
20518
- $children: this.$children,
20519
- $id: this.$id,
20520
- $merge: this.$merge.bind(this),
20521
- $getById: this.$getById.bind(this),
20522
- };
20378
+ this.propertyMap.$target = target;
20379
+ this.propertyMap.$proxy = proxy;
20523
20380
 
20524
20381
  if (
20525
20382
  Array.isArray(target) &&
@@ -20614,7 +20471,7 @@ class Scope {
20614
20471
  }
20615
20472
 
20616
20473
  /**
20617
- * @param {Listener[]} listeners
20474
+ * @param {import('./interface.ts').Listener[]} listeners
20618
20475
  * @param {Function} filter
20619
20476
  */
20620
20477
  #scheduleListener(listeners, filter = (val) => val) {
@@ -20638,7 +20495,7 @@ class Scope {
20638
20495
  * function is invoked when changes to that property are detected.
20639
20496
  *
20640
20497
  * @param {string} watchProp - An expression to be watched in the context of this model.
20641
- * @param {ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
20498
+ * @param {import('./interface.ts').ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
20642
20499
  * @param {boolean} [lazy] - A flag to indicate if the listener should be invoked immediately. Defaults to false.
20643
20500
  */
20644
20501
  $watch(watchProp, listenerFn, lazy = false) {
@@ -20660,7 +20517,7 @@ class Scope {
20660
20517
  return () => {};
20661
20518
  }
20662
20519
 
20663
- /** @type {Listener} */
20520
+ /** @type {import('./interface.ts').Listener} */
20664
20521
  const listener = {
20665
20522
  originalTarget: this.$target,
20666
20523
  listenerFn: listenerFn,
@@ -20772,7 +20629,7 @@ class Scope {
20772
20629
 
20773
20630
  let potentialProxy = $parse(
20774
20631
  watchProp.split(".").slice(0, -1).join("."),
20775
- )(listener.originalTarget);
20632
+ )(/** @type {Scope} */ (listener.originalTarget));
20776
20633
  if (potentialProxy && this.foreignProxies.has(potentialProxy)) {
20777
20634
  potentialProxy.$handler.#registerForeignKey(key, listener);
20778
20635
  potentialProxy.$handler.#scheduleListener([listener]);
@@ -20970,21 +20827,21 @@ class Scope {
20970
20827
  return true;
20971
20828
  }
20972
20829
 
20973
- // deregisterForeignKey(key, id) {
20974
- // const listenerList = this.foreignListeners.get(key);
20975
- // if (!listenerList) return false;
20830
+ deregisterForeignKey(key, id) {
20831
+ const listenerList = this.foreignListeners.get(key);
20832
+ if (!listenerList) return false;
20976
20833
 
20977
- // const index = listenerList.findIndex((x) => x.id === id);
20978
- // if (index === -1) return false;
20834
+ const index = listenerList.findIndex((x) => x.id === id);
20835
+ if (index === -1) return false;
20979
20836
 
20980
- // listenerList.splice(index, 1);
20981
- // if (listenerList.length) {
20982
- // this.foreignListeners.set(key, listenerList);
20983
- // } else {
20984
- // this.foreignListeners.delete(key);
20985
- // }
20986
- // return true;
20987
- // }
20837
+ listenerList.splice(index, 1);
20838
+ if (listenerList.length) {
20839
+ this.foreignListeners.set(key, listenerList);
20840
+ } else {
20841
+ this.foreignListeners.delete(key);
20842
+ }
20843
+ return true;
20844
+ }
20988
20845
 
20989
20846
  $eval(expr, locals) {
20990
20847
  const fn = $parse(expr);
@@ -21017,7 +20874,7 @@ class Scope {
21017
20874
  }
21018
20875
 
21019
20876
  /**
21020
- * @param {import('../../interface.js').Expression} expr
20877
+ * @param {import('../../interface.ts').Expression} expr
21021
20878
  * @returns {any}
21022
20879
  */
21023
20880
  $apply(expr) {
@@ -21198,12 +21055,12 @@ class Scope {
21198
21055
 
21199
21056
  /**
21200
21057
  * @internal
21201
- * @param {Listener} listener - The property path that was changed.
21058
+ * @param {import('./interface.ts').Listener} listener - The property path that was changed.
21202
21059
  */
21203
21060
  #notifyListener(listener, target) {
21204
21061
  const { originalTarget, listenerFn, watchFn } = listener;
21205
21062
  try {
21206
- let newVal = watchFn(originalTarget);
21063
+ let newVal = watchFn(/** @type {Scope} */ (originalTarget));
21207
21064
  if (isUndefined(newVal)) {
21208
21065
  newVal = watchFn(target);
21209
21066
  }
@@ -21233,6 +21090,13 @@ class Scope {
21233
21090
  }
21234
21091
  }
21235
21092
 
21093
+ /* @ignore */
21094
+ $flushQueue() {
21095
+ while ($postUpdateQueue.length) {
21096
+ $postUpdateQueue.shift()();
21097
+ }
21098
+ }
21099
+
21236
21100
  /**
21237
21101
  * Searches the scope instance
21238
21102
  *
@@ -21743,7 +21607,7 @@ const ngMessageDefaultDirective = ngMessageDirectiveFactory(true);
21743
21607
 
21744
21608
  /**
21745
21609
  * @param {boolean} isDefault
21746
- * @returns {(any) => import("../../interface.js").Directive}
21610
+ * @returns {(any) => import("../../interface.ts").Directive}
21747
21611
  */
21748
21612
  function ngMessageDirectiveFactory(isDefault) {
21749
21613
  ngMessageDirective.$inject = ["$animate"];
@@ -21950,6 +21814,9 @@ function ngShowAriaDirective($aria) {
21950
21814
  return $aria.$$watchExpr("ngShow", "aria-hidden", [], true);
21951
21815
  }
21952
21816
 
21817
+ /**
21818
+ * @return {ng.Directive}
21819
+ */
21953
21820
  function ngMessagesAriaDirective() {
21954
21821
  return {
21955
21822
  restrict: "A",
@@ -21965,18 +21832,21 @@ function ngMessagesAriaDirective() {
21965
21832
  }
21966
21833
 
21967
21834
  ngClickAriaDirective.$inject = [$injectTokens.$aria, $injectTokens.$parse];
21835
+
21836
+ /**
21837
+ * @param $aria
21838
+ * @param {ng.ParseService} $parse
21839
+ * @return {ng.Directive}
21840
+ */
21968
21841
  function ngClickAriaDirective($aria, $parse) {
21969
21842
  return {
21970
21843
  restrict: "A",
21971
21844
  compile(_elem, attr) {
21972
21845
  if (hasOwn(attr, ARIA_DISABLE_ATTR)) return;
21973
21846
 
21974
- const fn = $parse(attr.ngClick);
21847
+ const fn = $parse(attr["ngClick"]);
21975
21848
 
21976
- /**
21977
- * @param {Element} elem
21978
- */
21979
- return function (scope, elem, attr) {
21849
+ return (scope, elem, attr) => {
21980
21850
  if (!isNodeOneOf(elem, nativeAriaNodeNames)) {
21981
21851
  if ($aria.config("bindRoleForClick") && !elem.hasAttribute("role")) {
21982
21852
  elem.setAttribute("role", "button");
@@ -22013,10 +21883,6 @@ function ngClickAriaDirective($aria, $parse) {
22013
21883
  // See https://github.com/angular/angular.js/issues/16664
22014
21884
  event.preventDefault();
22015
21885
  }
22016
- scope.$apply(callback);
22017
- }
22018
-
22019
- function callback() {
22020
21886
  fn(scope, { $event: event });
22021
21887
  }
22022
21888
  },
@@ -22231,6 +22097,231 @@ function ngDblclickAriaDirective($aria) {
22231
22097
  };
22232
22098
  }
22233
22099
 
22100
+ /**
22101
+ * @fileoverview
22102
+ * Frame-synchronized animation runner and scheduler.
22103
+ * Provides async batching of animation callbacks using requestAnimationFrame.
22104
+ * In AngularJS, this user to be implemented as `$$AnimateRunner`
22105
+ */
22106
+
22107
+ /**
22108
+ * Internal runner states.
22109
+ * @readonly
22110
+ * @enum {number}
22111
+ */
22112
+ const RunnerState = {
22113
+ INITIAL: 0,
22114
+ PENDING: 1,
22115
+ DONE: 2,
22116
+ };
22117
+
22118
+ /** @type {VoidFunction[]} */
22119
+ let queue = [];
22120
+
22121
+ /** @type {boolean} */
22122
+ let scheduled = false;
22123
+
22124
+ /**
22125
+ * Flush all queued callbacks.
22126
+ * @private
22127
+ */
22128
+ function flush() {
22129
+ const tasks = queue;
22130
+ queue = [];
22131
+ scheduled = false;
22132
+ for (let i = 0; i < tasks.length; i++) {
22133
+ tasks[i]();
22134
+ }
22135
+ }
22136
+
22137
+ /**
22138
+ * Schedule a callback to run on the next animation frame.
22139
+ * Multiple calls within the same frame are batched together.
22140
+ *
22141
+ * @param {VoidFunction} fn - The callback to execute.
22142
+ */
22143
+ function schedule(fn) {
22144
+ queue.push(fn);
22145
+ if (!scheduled) {
22146
+ scheduled = true;
22147
+ (typeof requestAnimationFrame === "function"
22148
+ ? requestAnimationFrame
22149
+ : setTimeout)(flush, 0);
22150
+ }
22151
+ }
22152
+
22153
+ /**
22154
+ * Represents an asynchronous animation operation.
22155
+ * Provides both callback-based and promise-based completion APIs.
22156
+ */
22157
+ class AnimateRunner {
22158
+ /**
22159
+ * Run an array of animation runners in sequence.
22160
+ * Each runner waits for the previous one to complete.
22161
+ *
22162
+ * @param {AnimateRunner[]} runners - Runners to execute in order.
22163
+ * @param {(ok: boolean) => void} callback - Invoked when all complete or one fails.
22164
+ */
22165
+ static chain(runners, callback) {
22166
+ let i = 0;
22167
+ const next = (ok = true) => {
22168
+ if (!ok || i >= runners.length) {
22169
+ callback(ok);
22170
+ return;
22171
+ }
22172
+ runners[i++].done(next);
22173
+ };
22174
+ next();
22175
+ }
22176
+
22177
+ /**
22178
+ * Waits for all animation runners to complete before invoking the callback.
22179
+ *
22180
+ * @param {AnimateRunner[]} runners - Active runners to wait for.
22181
+ * @param {(ok: boolean) => void} callback - Called when all runners complete.
22182
+ */
22183
+ static all(runners, callback) {
22184
+ let remaining = runners.length;
22185
+ let status = true;
22186
+ for (const r of runners) {
22187
+ r.done((result) => {
22188
+ status = status && result !== false;
22189
+ if (--remaining === 0) callback(status);
22190
+ });
22191
+ }
22192
+ }
22193
+
22194
+ /**
22195
+ * @param {import("../interface.ts").AnimationHost} [host] - Optional animation host.
22196
+ */
22197
+ constructor(host) {
22198
+ /** @type {import("../interface.ts").AnimationHost} */
22199
+ this.host = host || {};
22200
+
22201
+ /** @type {Array<(ok: boolean) => void>} */
22202
+ this._doneCallbacks = [];
22203
+
22204
+ /** @type {RunnerState} */
22205
+ this._state = RunnerState.INITIAL;
22206
+
22207
+ /** @type {Promise<void>|null} */
22208
+ this._promise = null;
22209
+
22210
+ /** @type {(fn: VoidFunction) => void} */
22211
+ this._schedule = schedule;
22212
+ }
22213
+
22214
+ /**
22215
+ * Sets or updates the animation host.
22216
+ * @param {import("../interface.ts").AnimationHost} host - The host object.
22217
+ */
22218
+ setHost(host) {
22219
+ this.host = host || {};
22220
+ }
22221
+
22222
+ /**
22223
+ * Registers a callback to be called once the animation completes.
22224
+ * If the animation is already complete, it's called immediately.
22225
+ *
22226
+ * @param {(ok: boolean) => void} fn - Completion callback.
22227
+ */
22228
+ done(fn) {
22229
+ if (this._state === RunnerState.DONE) {
22230
+ fn(true);
22231
+ } else {
22232
+ this._doneCallbacks.push(fn);
22233
+ }
22234
+ }
22235
+
22236
+ /**
22237
+ * Notifies the host of animation progress.
22238
+ * @param {...any} args - Progress arguments.
22239
+ */
22240
+ progress(...args) {
22241
+ this.host.progress?.(...args);
22242
+ }
22243
+
22244
+ /** Pauses the animation, if supported by the host. */
22245
+ pause() {
22246
+ this.host.pause?.();
22247
+ }
22248
+
22249
+ /** Resumes the animation, if supported by the host. */
22250
+ resume() {
22251
+ this.host.resume?.();
22252
+ }
22253
+
22254
+ /** Ends the animation successfully. */
22255
+ end() {
22256
+ this.host.end?.();
22257
+ this._finish(true);
22258
+ }
22259
+
22260
+ /** Cancels the animation. */
22261
+ cancel() {
22262
+ this.host.cancel?.();
22263
+ this._finish(false);
22264
+ }
22265
+
22266
+ /**
22267
+ * Marks the animation as complete on the next animation frame.
22268
+ * @param {boolean} [status=true] - True if successful, false if canceled.
22269
+ */
22270
+ complete(status = true) {
22271
+ if (this._state === RunnerState.INITIAL) {
22272
+ this._state = RunnerState.PENDING;
22273
+ this._schedule(() => this._finish(status));
22274
+ }
22275
+ }
22276
+
22277
+ /**
22278
+ * Returns a promise that resolves or rejects when the animation completes.
22279
+ * @returns {Promise<void>} Promise resolved on success or rejected on cancel.
22280
+ */
22281
+ getPromise() {
22282
+ if (!this._promise) {
22283
+ this._promise = new Promise((resolve, reject) => {
22284
+ this.done((success) => {
22285
+ if (success === false) reject();
22286
+ else resolve();
22287
+ });
22288
+ });
22289
+ }
22290
+ return this._promise;
22291
+ }
22292
+
22293
+ /** @inheritdoc */
22294
+ then(onFulfilled, onRejected) {
22295
+ return this.getPromise().then(onFulfilled, onRejected);
22296
+ }
22297
+
22298
+ /** @inheritdoc */
22299
+ catch(onRejected) {
22300
+ return this.getPromise().catch(onRejected);
22301
+ }
22302
+
22303
+ /** @inheritdoc */
22304
+ finally(onFinally) {
22305
+ return this.getPromise().finally(onFinally);
22306
+ }
22307
+
22308
+ /**
22309
+ * Completes the animation and invokes all done callbacks.
22310
+ * @private
22311
+ * @param {boolean} status - True if completed successfully, false if canceled.
22312
+ */
22313
+ _finish(status) {
22314
+ if (this._state === RunnerState.DONE) return;
22315
+ this._state = RunnerState.DONE;
22316
+
22317
+ const callbacks = this._doneCallbacks;
22318
+ for (let i = 0; i < callbacks.length; i++) {
22319
+ callbacks[i](status);
22320
+ }
22321
+ callbacks.length = 0;
22322
+ }
22323
+ }
22324
+
22234
22325
  const ANIMATE_TIMER_KEY = "$$animateCss";
22235
22326
 
22236
22327
  const ONE_SECOND = 1000;
@@ -22338,19 +22429,18 @@ function registerRestorableStyles(backup, node, properties) {
22338
22429
  }
22339
22430
 
22340
22431
  function AnimateCssProvider() {
22432
+ let activeClasses;
22341
22433
  this.$get = [
22342
- "$$AnimateRunner",
22343
22434
  "$$animateCache",
22344
22435
  "$$rAFScheduler",
22345
22436
 
22346
22437
  /**
22347
22438
  *
22348
- * @param {*} $$AnimateRunner
22349
22439
  * @param {*} $$animateCache
22350
22440
  * @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
22351
22441
  * @returns
22352
22442
  */
22353
- function ($$AnimateRunner, $$animateCache, $$rAFScheduler) {
22443
+ function ($$animateCache, $$rAFScheduler) {
22354
22444
  const applyAnimationClasses = applyAnimationClassesFactory();
22355
22445
 
22356
22446
  function computeCachedCssStyles(
@@ -22681,10 +22771,7 @@ function AnimateCssProvider() {
22681
22771
  return closeAndReturnNoopAnimator();
22682
22772
  }
22683
22773
 
22684
- let activeClasses = pendClasses(
22685
- preparationClasses,
22686
- ACTIVE_CLASS_SUFFIX,
22687
- );
22774
+ activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);
22688
22775
 
22689
22776
  if (options.delay != null) {
22690
22777
  if (typeof options.delay !== "boolean") {
@@ -22751,7 +22838,7 @@ function AnimateCssProvider() {
22751
22838
  pause: null,
22752
22839
  };
22753
22840
 
22754
- runner = new $$AnimateRunner(runnerHost);
22841
+ runner = new AnimateRunner(runnerHost);
22755
22842
 
22756
22843
  waitUntilQuiet(start);
22757
22844
 
@@ -22821,7 +22908,9 @@ function AnimateCssProvider() {
22821
22908
 
22822
22909
  if (events && events.length) {
22823
22910
  // Remove the transitionend / animationend listener(s)
22824
- element.off(events.join(" "), onAnimationProgress);
22911
+ events.forEach((i) =>
22912
+ element.removeEventListener(i, onAnimationProgress),
22913
+ );
22825
22914
  }
22826
22915
 
22827
22916
  // Cancel the fallback closing timeout and remove the timer data
@@ -22848,7 +22937,7 @@ function AnimateCssProvider() {
22848
22937
  }
22849
22938
 
22850
22939
  function closeAndReturnNoopAnimator() {
22851
- runner = new $$AnimateRunner({
22940
+ runner = new AnimateRunner({
22852
22941
  end: endFn,
22853
22942
  cancel: cancelFn,
22854
22943
  });
@@ -23236,31 +23325,18 @@ function AnimateQueueProvider($animateProvider) {
23236
23325
  $injectTokens.$rootScope,
23237
23326
  $injectTokens.$injector,
23238
23327
  $injectTokens.$$animation,
23239
- $injectTokens.$$AnimateRunner,
23240
23328
  $injectTokens.$templateRequest,
23241
23329
  /**
23242
23330
  *
23243
- * @param {import('../core/scope/scope.js').Scope} $rootScope
23244
- * @param {import('../core/di/internal-injector.js').InjectorService} $injector
23331
+ * @param {ng.RootScopeService} $rootScope
23332
+ * @param {ng.InjectorService} $injector
23245
23333
  * @param {*} $$animation
23246
- * @param {*} $$AnimateRunner
23247
23334
  * @param {*} $templateRequest
23248
23335
  * @returns
23249
23336
  */
23250
- function (
23251
- $rootScope,
23252
- $injector,
23253
- $$animation,
23254
- $$AnimateRunner,
23255
- $templateRequest,
23256
- ) {
23337
+ function ($rootScope, $injector, $$animation, $templateRequest) {
23257
23338
  const activeAnimationsLookup = new Map();
23258
23339
  const disabledElementsLookup = new Map();
23259
- let animationsEnabled = null;
23260
-
23261
- function removeFromDisabledElementsLookup(evt) {
23262
- disabledElementsLookup.delete(evt.target);
23263
- }
23264
23340
 
23265
23341
  function postDigestTaskFactory() {
23266
23342
  let postDigestCalled = false;
@@ -23300,11 +23376,6 @@ function AnimateQueueProvider($animateProvider) {
23300
23376
  // any animations are triggered.
23301
23377
  $rootScope.$postUpdate(() => {
23302
23378
  $rootScope.$postUpdate(() => {
23303
- // we check for null directly in the event that the application already called
23304
- // .enabled() with whatever arguments that it provided it with
23305
- if (animationsEnabled === null) {
23306
- animationsEnabled = true;
23307
- }
23308
23379
  });
23309
23380
  });
23310
23381
  }
@@ -23443,47 +23514,6 @@ function AnimateQueueProvider($animateProvider) {
23443
23514
  options.domOperation = domOperation;
23444
23515
  return queueAnimation(element, event, options);
23445
23516
  },
23446
-
23447
- // this method has four signatures:
23448
- // () - global getter
23449
- // (bool) - global setter
23450
- // (element) - element getter
23451
- // (element, bool) - element setter<F37>
23452
- enabled(element, bool) {
23453
- const argCount = arguments.length;
23454
-
23455
- if (argCount === 0) {
23456
- // () - Global getter
23457
- bool = !!animationsEnabled;
23458
- } else {
23459
- const hasElement = isElement(element);
23460
-
23461
- if (!hasElement) {
23462
- // (bool) - Global setter
23463
- bool = animationsEnabled = !!element;
23464
- } else {
23465
- const node = element;
23466
-
23467
- if (argCount === 1) {
23468
- // (element) - Element getter
23469
- bool = !disabledElementsLookup.get(node);
23470
- } else {
23471
- // (element, bool) - Element setter
23472
- if (!disabledElementsLookup.has(node)) {
23473
- // The element is added to the map for the first time.
23474
- // Create a listener to remove it on `$destroy` (to avoid memory leak).
23475
- element.addEventListener(
23476
- "$destroy",
23477
- removeFromDisabledElementsLookup,
23478
- );
23479
- }
23480
- disabledElementsLookup.set(node, !bool);
23481
- }
23482
- }
23483
- }
23484
-
23485
- return bool;
23486
- },
23487
23517
  };
23488
23518
 
23489
23519
  return $animate;
@@ -23512,7 +23542,7 @@ function AnimateQueueProvider($animateProvider) {
23512
23542
 
23513
23543
  // we create a fake runner with a working promise.
23514
23544
  // These methods will become available after the digest has passed
23515
- const runner = new $$AnimateRunner();
23545
+ const runner = new AnimateRunner();
23516
23546
 
23517
23547
  // this is used to trigger callbacks in postDigest mode
23518
23548
  const runInNextPostDigestOrNow = postDigestTaskFactory();
@@ -23540,6 +23570,7 @@ function AnimateQueueProvider($animateProvider) {
23540
23570
  if (options.to && !isObject(options.to)) {
23541
23571
  options.to = null;
23542
23572
  }
23573
+
23543
23574
  // If animations are hard-disabled for the whole application there is no need to continue.
23544
23575
  // There are also situations where a directive issues an animation for a JQLite wrapper that
23545
23576
  // contains only comment nodes. In this case, there is no way we can perform an animation.
@@ -23552,7 +23583,6 @@ function AnimateQueueProvider($animateProvider) {
23552
23583
  close();
23553
23584
  return runner;
23554
23585
  }
23555
-
23556
23586
  const isStructural = ["enter", "move", "leave"].indexOf(event) >= 0;
23557
23587
 
23558
23588
  // This is a hard disable of all animations the element itself, therefore there is no need to
@@ -23788,6 +23818,8 @@ function AnimateQueueProvider($animateProvider) {
23788
23818
  });
23789
23819
  });
23790
23820
 
23821
+ // Since we don't have digest any more - trigger queue here
23822
+ setTimeout($rootScope.$flushQueue, 0);
23791
23823
  return runner;
23792
23824
 
23793
23825
  function notifyProgress(runner, event, phase, data) {
@@ -23951,18 +23983,16 @@ function AnimateQueueProvider($animateProvider) {
23951
23983
  // TODO: use caching here to speed things up for detection
23952
23984
  // TODO: add documentation
23953
23985
 
23954
- AnimateJsProvider.$inject = ["$animateProvider"];
23986
+ AnimateJsProvider.$inject = [$injectTokens.$animate + "Provider"];
23955
23987
  function AnimateJsProvider($animateProvider) {
23956
23988
  this.$get = [
23957
23989
  $injectTokens.$injector,
23958
- "$$AnimateRunner",
23959
23990
  /**
23960
23991
  *
23961
- * @param {import("../core/di/internal-injector").InjectorService} $injector
23962
- * @param {*} $$AnimateRunner
23992
+ * @param {ng.InjectorService} $injector
23963
23993
  * @returns
23964
23994
  */
23965
- function ($injector, $$AnimateRunner) {
23995
+ function ($injector) {
23966
23996
  const applyAnimationClasses = applyAnimationClassesFactory();
23967
23997
  // $animateJs(element, 'enter');
23968
23998
  return function (element, event, classes, options) {
@@ -24049,7 +24079,7 @@ function AnimateJsProvider($animateProvider) {
24049
24079
  runner.end();
24050
24080
  } else {
24051
24081
  close();
24052
- runner = new $$AnimateRunner();
24082
+ runner = new AnimateRunner();
24053
24083
  runner.complete(true);
24054
24084
  }
24055
24085
  return runner;
@@ -24059,31 +24089,53 @@ function AnimateJsProvider($animateProvider) {
24059
24089
  return runner;
24060
24090
  }
24061
24091
 
24062
- runner = new $$AnimateRunner();
24063
- let closeActiveAnimations;
24092
+ runner = new AnimateRunner();
24093
+
24064
24094
  const chain = [];
24065
24095
 
24066
24096
  if (before) {
24067
- chain.push((fn) => {
24068
- closeActiveAnimations = before(fn);
24097
+ const runnerBefore = new AnimateRunner({
24098
+ end(fn) {
24099
+ // call the before animation function, then mark runner done
24100
+ const endFn = before(fn) || (() => {});
24101
+ endFn();
24102
+ },
24103
+ cancel() {
24104
+ (before(true) || (() => {}))();
24105
+ },
24069
24106
  });
24107
+ chain.push(runnerBefore);
24070
24108
  }
24071
24109
 
24072
24110
  if (chain.length) {
24073
- chain.push((fn) => {
24074
- applyOptions();
24075
- fn(true);
24111
+ const runnerApplyOptions = new AnimateRunner({
24112
+ end(fn) {
24113
+ applyOptions();
24114
+ fn(true);
24115
+ },
24116
+ cancel() {
24117
+ applyOptions();
24118
+ },
24076
24119
  });
24120
+ chain.push(runnerApplyOptions);
24077
24121
  } else {
24078
24122
  applyOptions();
24079
24123
  }
24080
24124
 
24081
24125
  if (after) {
24082
- chain.push((fn) => {
24083
- closeActiveAnimations = after(fn);
24126
+ const runnerAfter = new AnimateRunner({
24127
+ end(fn) {
24128
+ const endFn = after(fn) || (() => {});
24129
+ endFn();
24130
+ },
24131
+ cancel() {
24132
+ (after(true) || (() => {}))();
24133
+ },
24084
24134
  });
24135
+ chain.push(runnerAfter);
24085
24136
  }
24086
24137
 
24138
+ // finally, set host for overall runner
24087
24139
  runner.setHost({
24088
24140
  end() {
24089
24141
  endAnimations();
@@ -24093,7 +24145,7 @@ function AnimateJsProvider($animateProvider) {
24093
24145
  },
24094
24146
  });
24095
24147
 
24096
- $$AnimateRunner.chain(chain, onComplete);
24148
+ AnimateRunner.chain(chain, onComplete);
24097
24149
  return runner;
24098
24150
 
24099
24151
  function onComplete(success) {
@@ -24103,7 +24155,6 @@ function AnimateJsProvider($animateProvider) {
24103
24155
 
24104
24156
  function endAnimations(cancelled) {
24105
24157
  if (!animationClosed) {
24106
- (closeActiveAnimations || (() => {}))(cancelled);
24107
24158
  onComplete(cancelled);
24108
24159
  }
24109
24160
  }
@@ -24142,7 +24193,7 @@ function AnimateJsProvider($animateProvider) {
24142
24193
  value = value.start();
24143
24194
  }
24144
24195
 
24145
- if (value instanceof $$AnimateRunner) {
24196
+ if (value instanceof AnimateRunner) {
24146
24197
  value.done(onDone);
24147
24198
  } else if (isFunction(value)) {
24148
24199
  // optional onEnd / onCancel callback
@@ -24179,7 +24230,7 @@ function AnimateJsProvider($animateProvider) {
24179
24230
  }
24180
24231
  };
24181
24232
 
24182
- runner = new $$AnimateRunner({
24233
+ runner = new AnimateRunner({
24183
24234
  end() {
24184
24235
  onAnimationComplete();
24185
24236
  },
@@ -24275,7 +24326,7 @@ function AnimateJsProvider($animateProvider) {
24275
24326
  }
24276
24327
 
24277
24328
  if (runners.length) {
24278
- $$AnimateRunner.all(runners, callback);
24329
+ AnimateRunner.all(runners, callback);
24279
24330
  } else {
24280
24331
  callback();
24281
24332
  }
@@ -24335,25 +24386,17 @@ function AnimationProvider() {
24335
24386
  this.$get = [
24336
24387
  $injectTokens.$rootScope,
24337
24388
  $injectTokens.$injector,
24338
- $injectTokens.$$AnimateRunner,
24339
24389
  $injectTokens.$$rAFScheduler,
24340
24390
  $injectTokens.$$animateCache,
24341
24391
  /**
24342
24392
  *
24343
24393
  * @param {ng.RootScopeService} $rootScope
24344
24394
  * @param {import("../core/di/internal-injector").InjectorService} $injector
24345
- * @param {*} $$AnimateRunner
24346
24395
  * @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
24347
24396
  * @param {*} $$animateCache
24348
24397
  * @returns
24349
24398
  */
24350
- function (
24351
- $rootScope,
24352
- $injector,
24353
- $$AnimateRunner,
24354
- $$rAFScheduler,
24355
- $$animateCache,
24356
- ) {
24399
+ function ($rootScope, $injector, $$rAFScheduler, $$animateCache) {
24357
24400
  const animationQueue = [];
24358
24401
  const applyAnimationClasses = applyAnimationClassesFactory();
24359
24402
 
@@ -24454,7 +24497,7 @@ function AnimationProvider() {
24454
24497
  // these runner methods will get later updated with the
24455
24498
  // methods leading into the driver's end/cancel methods
24456
24499
  // for now they just stop the animation from starting
24457
- const runner = new $$AnimateRunner({
24500
+ const runner = new AnimateRunner({
24458
24501
  end() {
24459
24502
  close();
24460
24503
  },
@@ -24817,8 +24860,8 @@ function AnimationProvider() {
24817
24860
  }
24818
24861
 
24819
24862
  /**
24820
- * @typedef {import('./interface.js').RafScheduler} RafScheduler
24821
- * @typedef {import('../interface.js').ServiceProvider} ServiceProvider
24863
+ * @typedef {import('./interface.ts').RafScheduler} RafScheduler
24864
+ * @typedef {import('../interface.ts').ServiceProvider} ServiceProvider
24822
24865
  */
24823
24866
 
24824
24867
  /**
@@ -25009,16 +25052,14 @@ function AnimateCssDriverProvider($$animationProvider) {
25009
25052
  */
25010
25053
  this.$get = [
25011
25054
  "$animateCss",
25012
- "$$AnimateRunner",
25013
25055
  "$rootElement",
25014
25056
  /**
25015
25057
  *
25016
25058
  * @param {*} $animateCss
25017
- * @param {typeof import('./animate-runner.js').AnimateRunner} $$AnimateRunner
25018
25059
  * @param {Element} $rootElement
25019
25060
  * @returns
25020
25061
  */
25021
- function ($animateCss, $$AnimateRunner, $rootElement) {
25062
+ function ($animateCss, $rootElement) {
25022
25063
  const bodyNode = document.body;
25023
25064
  const rootNode = $rootElement;
25024
25065
 
@@ -25091,7 +25132,7 @@ function AnimateCssDriverProvider($$animationProvider) {
25091
25132
  runner.complete();
25092
25133
  });
25093
25134
 
25094
- runner = new $$AnimateRunner({
25135
+ runner = new AnimateRunner({
25095
25136
  end: endFn,
25096
25137
  cancel: endFn,
25097
25138
  });
@@ -25202,12 +25243,12 @@ function AnimateCssDriverProvider($$animationProvider) {
25202
25243
  animationRunners.push(animation.start());
25203
25244
  });
25204
25245
 
25205
- const runner = new $$AnimateRunner({
25246
+ const runner = new AnimateRunner({
25206
25247
  end: endFn,
25207
25248
  cancel: endFn, // CSS-driven animations cannot be cancelled, only ended
25208
25249
  });
25209
25250
 
25210
- $$AnimateRunner.all(animationRunners, (status) => {
25251
+ AnimateRunner.all(animationRunners, (status) => {
25211
25252
  runner.complete(status);
25212
25253
  });
25213
25254
 
@@ -25277,8 +25318,11 @@ function AnimateJsDriverProvider($$animationProvider) {
25277
25318
  $$animationProvider.drivers.push("$$animateJsDriver");
25278
25319
  this.$get = [
25279
25320
  "$$animateJs",
25280
- "$$AnimateRunner",
25281
- function ($$animateJs, $$AnimateRunner) {
25321
+ /**
25322
+ *
25323
+ * @param {*} $$animateJs
25324
+ */
25325
+ function ($$animateJs) {
25282
25326
  return function initDriverFn(animationDetails) {
25283
25327
  if (animationDetails.from && animationDetails.to) {
25284
25328
  const fromAnimation = prepareAnimation(animationDetails.from);
@@ -25297,9 +25341,9 @@ function AnimateJsDriverProvider($$animationProvider) {
25297
25341
  animationRunners.push(toAnimation.start());
25298
25342
  }
25299
25343
 
25300
- $$AnimateRunner.all(animationRunners, done);
25344
+ AnimateRunner.all(animationRunners, done);
25301
25345
 
25302
- const runner = new $$AnimateRunner({
25346
+ const runner = new AnimateRunner({
25303
25347
  end: endFnFactory(),
25304
25348
  cancel: endFnFactory(),
25305
25349
  });
@@ -25333,9 +25377,9 @@ function AnimateJsDriverProvider($$animationProvider) {
25333
25377
  ];
25334
25378
  }
25335
25379
 
25336
- ngAnimateSwapDirective.$inject = ["$animate"];
25380
+ ngAnimateSwapDirective.$inject = [$injectTokens.$animate];
25337
25381
  /**
25338
- * @returns {import('../interface.ts').Directive}
25382
+ * @returns {ng.Directive}
25339
25383
  */
25340
25384
  function ngAnimateSwapDirective($animate) {
25341
25385
  return {
@@ -25344,10 +25388,10 @@ function ngAnimateSwapDirective($animate) {
25344
25388
  terminal: true,
25345
25389
  priority: 550, // We use 550 here to ensure that the directive is caught before others,
25346
25390
  // but after `ngIf` (at priority 600).
25347
- link(scope, $element, attrs, ctrl, $transclude) {
25391
+ link(scope, $element, attrs, _ctrl, $transclude) {
25348
25392
  let previousElement;
25349
25393
  let previousScope;
25350
- scope.$watch(attrs["ngAnimateSwap"] || attrs["for"], (value) => {
25394
+ scope.$watch(attrs.ngAnimateSwap || attrs.for, (value) => {
25351
25395
  if (previousElement) {
25352
25396
  $animate.leave(previousElement);
25353
25397
  }
@@ -27574,7 +27618,7 @@ class PathUtils {
27574
27618
  * @param {PathNode[]} fromPath
27575
27619
  * @param {PathNode[]} toPath
27576
27620
  * @param {boolean} [reloadState]
27577
- * @returns {import("../transition/interface.js").TreeChanges}
27621
+ * @returns {import("../transition/interface.ts").TreeChanges}
27578
27622
  */
27579
27623
  static treeChanges(fromPath, toPath, reloadState) {
27580
27624
  const max = Math.min(fromPath.length, toPath.length);
@@ -28309,25 +28353,6 @@ ViewService.matches = (ngViewsByFqn, ngView) => (viewConfig) => {
28309
28353
  return vc.$ngViewContextAnchor === (ngViewContext && ngViewContext.name);
28310
28354
  };
28311
28355
 
28312
- /**
28313
- * An object for Transition Hook Phases
28314
- * @enum {number}
28315
- * @readonly
28316
- */
28317
- const TransitionHookPhase = {
28318
- CREATE: 0,
28319
- BEFORE: 1,
28320
- RUN: 2,
28321
- SUCCESS: 3,
28322
- ERROR: 4,
28323
- };
28324
-
28325
- /** An object for Transition Hook Scopes */
28326
- const TransitionHookScope = {
28327
- TRANSITION: 0,
28328
- STATE: 1,
28329
- };
28330
-
28331
28356
  /**
28332
28357
  * An object for Transition Rejection reasons.
28333
28358
  * @enum {number}
@@ -28447,7 +28472,7 @@ class Rejection {
28447
28472
  }
28448
28473
  }
28449
28474
 
28450
- /** @typedef {import('../../interface.js').ServiceProvider} ServiceProvider
28475
+ /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider
28451
28476
 
28452
28477
  /**
28453
28478
  * Configurable provider for an injectable event bus
@@ -28804,6 +28829,31 @@ const defaultOptions = {
28804
28829
  bind: null,
28805
28830
  };
28806
28831
 
28832
+ /**
28833
+ * Enum representing the different phases of a transition hook.
28834
+ *
28835
+ * @readonly
28836
+ * @enum {number}
28837
+ */
28838
+ const TransitionHookPhase = Object.freeze({
28839
+ CREATE: 0,
28840
+ BEFORE: 1,
28841
+ RUN: 2,
28842
+ SUCCESS: 3,
28843
+ ERROR: 4,
28844
+ });
28845
+
28846
+ /**
28847
+ * Enum representing the scope in which a transition hook operates.
28848
+ *
28849
+ * @readonly
28850
+ * @enum {number}
28851
+ */
28852
+ const TransitionHookScope = Object.freeze({
28853
+ TRANSITION: 0,
28854
+ STATE: 1,
28855
+ });
28856
+
28807
28857
  class TransitionHook {
28808
28858
  /**
28809
28859
  * Chains together an array of TransitionHooks.
@@ -30622,7 +30672,6 @@ class TransitionProvider {
30622
30672
  }
30623
30673
 
30624
30674
  _defineCoreEvents() {
30625
- const Phase = TransitionHookPhase;
30626
30675
  const TH = TransitionHook;
30627
30676
  const paths = this._criteriaPaths;
30628
30677
  const NORMAL_SORT = false,
@@ -30630,7 +30679,7 @@ class TransitionProvider {
30630
30679
  const SYNCHRONOUS = true;
30631
30680
  this._defineEvent(
30632
30681
  "onCreate",
30633
- Phase.CREATE,
30682
+ TransitionHookPhase.CREATE,
30634
30683
  0,
30635
30684
  paths.to,
30636
30685
  NORMAL_SORT,
@@ -30638,15 +30687,21 @@ class TransitionProvider {
30638
30687
  TH.THROW_ERROR,
30639
30688
  SYNCHRONOUS,
30640
30689
  );
30641
- this._defineEvent("onBefore", Phase.BEFORE, 0, paths.to);
30642
- this._defineEvent("onStart", Phase.RUN, 0, paths.to);
30643
- this._defineEvent("onExit", Phase.RUN, 100, paths.exiting, REVERSE_SORT);
30644
- this._defineEvent("onRetain", Phase.RUN, 200, paths.retained);
30645
- this._defineEvent("onEnter", Phase.RUN, 300, paths.entering);
30646
- this._defineEvent("onFinish", Phase.RUN, 400, paths.to);
30690
+ this._defineEvent("onBefore", TransitionHookPhase.BEFORE, 0, paths.to);
30691
+ this._defineEvent("onStart", TransitionHookPhase.RUN, 0, paths.to);
30692
+ this._defineEvent(
30693
+ "onExit",
30694
+ TransitionHookPhase.RUN,
30695
+ 100,
30696
+ paths.exiting,
30697
+ REVERSE_SORT,
30698
+ );
30699
+ this._defineEvent("onRetain", TransitionHookPhase.RUN, 200, paths.retained);
30700
+ this._defineEvent("onEnter", TransitionHookPhase.RUN, 300, paths.entering);
30701
+ this._defineEvent("onFinish", TransitionHookPhase.RUN, 400, paths.to);
30647
30702
  this._defineEvent(
30648
30703
  "onSuccess",
30649
- Phase.SUCCESS,
30704
+ TransitionHookPhase.SUCCESS,
30650
30705
  0,
30651
30706
  paths.to,
30652
30707
  NORMAL_SORT,
@@ -30656,7 +30711,7 @@ class TransitionProvider {
30656
30711
  );
30657
30712
  this._defineEvent(
30658
30713
  "onError",
30659
- Phase.ERROR,
30714
+ TransitionHookPhase.ERROR,
30660
30715
  0,
30661
30716
  paths.to,
30662
30717
  NORMAL_SORT,
@@ -30922,7 +30977,7 @@ class StateProvider {
30922
30977
 
30923
30978
  /**
30924
30979
  *
30925
- * @param {import("./interface.js").StateDeclaration} definition
30980
+ * @param {import("./interface.ts").StateDeclaration} definition
30926
30981
  */
30927
30982
  state(definition) {
30928
30983
  if (!definition.name) {
@@ -32222,7 +32277,7 @@ function encodeDashes(str) {
32222
32277
  );
32223
32278
  }
32224
32279
 
32225
- /** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
32280
+ /** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
32226
32281
 
32227
32282
  /**
32228
32283
  * Internal representation of a ng-router state.
@@ -32245,7 +32300,7 @@ class StateObject {
32245
32300
  includes = undefined;
32246
32301
 
32247
32302
  /**
32248
- * @param {import('./interface.js').StateDeclaration} config
32303
+ * @param {import('./interface.ts').StateDeclaration} config
32249
32304
  */
32250
32305
  constructor(config) {
32251
32306
  Object.assign(this, config);
@@ -32253,7 +32308,7 @@ class StateObject {
32253
32308
  return this;
32254
32309
  };
32255
32310
  /**
32256
- * @type {import('./interface.js').StateDeclaration}
32311
+ * @type {import('./interface.ts').StateDeclaration}
32257
32312
  */
32258
32313
  this.self = config;
32259
32314
  /**
@@ -34642,7 +34697,7 @@ function $StateRefActiveDirective(
34642
34697
  * ```
34643
34698
  */
34644
34699
 
34645
- /** @type {import("../../interface.js").AnnotatedDirectiveFactory} */
34700
+ /** @type {import("../../interface.ts").AnnotatedDirectiveFactory} */
34646
34701
  let ngView = [
34647
34702
  "$view",
34648
34703
  "$animate",
@@ -34653,7 +34708,7 @@ let ngView = [
34653
34708
  * @param {*} $animate
34654
34709
  * @param {*} $viewScroll
34655
34710
  * @param {*} $interpolate
34656
- * @returns {import("../../interface.js").Directive}
34711
+ * @returns {import("../../interface.ts").Directive}
34657
34712
  */
34658
34713
  function $ViewDirective($view, $animate, $viewScroll, $interpolate) {
34659
34714
  function getRenderer() {
@@ -35079,7 +35134,8 @@ function ngSetterDirective($parse, $log) {
35079
35134
  }
35080
35135
 
35081
35136
  /**
35082
- * @param {"get" | "delete" | "post" | "put"} method
35137
+ * @param {"get" | "delete" | "post" | "put"} method - HTTP method applied to request
35138
+ * @param {string} [attrOverride] - Custom name to use for the attribute
35083
35139
  * @returns {ng.DirectiveFactory}
35084
35140
  */
35085
35141
  function defineDirective(method, attrOverride) {
@@ -35093,6 +35149,7 @@ function defineDirective(method, attrOverride) {
35093
35149
  $injectTokens.$parse,
35094
35150
  $injectTokens.$state,
35095
35151
  $injectTokens.$sse,
35152
+ $injectTokens.$animate,
35096
35153
  ];
35097
35154
  return directive;
35098
35155
  }
@@ -35112,15 +35169,11 @@ const ngPutDirective = defineDirective("put");
35112
35169
  /** @type {ng.DirectiveFactory} */
35113
35170
  const ngSseDirective = defineDirective("get", "ngSse");
35114
35171
 
35115
- /**
35116
- * @typedef {"click" | "change" | "submit"} EventType
35117
- */
35118
-
35119
35172
  /**
35120
35173
  * Selects DOM event to listen for based on the element type.
35121
35174
  *
35122
35175
  * @param {Element} element - The DOM element to inspect.
35123
- * @returns {EventType} The name of the event to listen for.
35176
+ * @returns {"click" | "change" | "submit"} The name of the event to listen for.
35124
35177
  */
35125
35178
  function getEventNameForElement(element) {
35126
35179
  const tag = element.tagName.toLowerCase();
@@ -35132,89 +35185,6 @@ function getEventNameForElement(element) {
35132
35185
  return "click";
35133
35186
  }
35134
35187
 
35135
- /**
35136
- * Handles DOM manipulation based on a swap strategy and server-rendered HTML.
35137
- *
35138
- * @param {string} html - The HTML string returned from the server.
35139
- * @param {import("./interface.ts").SwapModeType} swap
35140
- * @param {Element} target - The target DOM element to apply the swap to.
35141
- * @param {ng.Scope} scope
35142
- * @param {ng.CompileService} $compile
35143
- */
35144
- function handleSwapResponse(html, swap, target, scope, $compile) {
35145
- let nodes = [];
35146
- if (!["textcontent", "delete", "none"].includes(swap)) {
35147
- if (!html) {
35148
- return;
35149
- }
35150
-
35151
- if (isObject(html)) {
35152
- scope.$merge(html);
35153
- return;
35154
- }
35155
-
35156
- const compiled = $compile(html)(scope);
35157
- nodes =
35158
- compiled instanceof DocumentFragment
35159
- ? Array.from(compiled.childNodes)
35160
- : [compiled];
35161
- }
35162
-
35163
- switch (swap) {
35164
- case "innerHTML":
35165
- target.replaceChildren(...nodes);
35166
- break;
35167
-
35168
- case "outerHTML": {
35169
- const parent = target.parentNode;
35170
- if (!parent) return;
35171
- const frag = document.createDocumentFragment();
35172
- nodes.forEach((n) => frag.appendChild(n));
35173
- parent.replaceChild(frag, target);
35174
- break;
35175
- }
35176
-
35177
- case "textContent":
35178
- target.textContent = html;
35179
- break;
35180
-
35181
- case "beforebegin":
35182
- nodes.forEach((node) => target.parentNode.insertBefore(node, target));
35183
- break;
35184
-
35185
- case "afterbegin":
35186
- nodes
35187
- .slice()
35188
- .reverse()
35189
- .forEach((node) => target.insertBefore(node, target.firstChild));
35190
- break;
35191
-
35192
- case "beforeend":
35193
- nodes.forEach((node) => target.appendChild(node));
35194
- break;
35195
-
35196
- case "afterend":
35197
- nodes
35198
- .slice()
35199
- .reverse()
35200
- .forEach((node) =>
35201
- target.parentNode.insertBefore(node, target.nextSibling),
35202
- );
35203
- break;
35204
-
35205
- case "delete":
35206
- target.remove();
35207
- break;
35208
-
35209
- case "none":
35210
- break;
35211
-
35212
- default:
35213
- target.replaceChildren(...nodes);
35214
- break;
35215
- }
35216
- }
35217
-
35218
35188
  /**
35219
35189
  * Creates an HTTP directive factory that supports GET, DELETE, POST, PUT.
35220
35190
  *
@@ -35223,6 +35193,8 @@ function handleSwapResponse(html, swap, target, scope, $compile) {
35223
35193
  * @returns {ng.DirectiveFactory}
35224
35194
  */
35225
35195
  function createHttpDirective(method, attrName) {
35196
+ let content = undefined;
35197
+
35226
35198
  /**
35227
35199
  * @param {ng.HttpService} $http
35228
35200
  * @param {ng.CompileService} $compile
@@ -35232,7 +35204,125 @@ function createHttpDirective(method, attrName) {
35232
35204
  * @param {ng.SseService} $sse
35233
35205
  * @returns {ng.Directive}
35234
35206
  */
35235
- return function ($http, $compile, $log, $parse, $state, $sse) {
35207
+ return function ($http, $compile, $log, $parse, $state, $sse, $animate) {
35208
+ /**
35209
+ * Handles DOM manipulation based on a swap strategy and server-rendered HTML.
35210
+ *
35211
+ * @param {string | Object} html - The HTML string or object returned from the server.
35212
+ * @param {import("./interface.ts").SwapModeType} swap
35213
+ * @param {ng.Scope} scope
35214
+ * @param {ng.Attributes} attrs
35215
+ * @param {Element} element
35216
+ */
35217
+ function handleSwapResponse(html, swap, scope, attrs, element) {
35218
+ let animationEnabled = false;
35219
+ if (attrs.animate) {
35220
+ animationEnabled = true;
35221
+ }
35222
+ let nodes = [];
35223
+ if (!["textcontent", "delete", "none"].includes(swap)) {
35224
+ if (!html) return;
35225
+ const compiled = $compile(html)(scope);
35226
+ nodes =
35227
+ compiled instanceof DocumentFragment
35228
+ ? Array.from(compiled.childNodes)
35229
+ : [compiled];
35230
+ }
35231
+
35232
+ const targetSelector = attrs["target"];
35233
+ const target = targetSelector
35234
+ ? document.querySelector(targetSelector)
35235
+ : element;
35236
+
35237
+ if (!target) {
35238
+ $log.warn(`${attrName}: target "${targetSelector}" not found`);
35239
+ return;
35240
+ }
35241
+
35242
+ switch (swap) {
35243
+ case "innerHTML":
35244
+ if (animationEnabled) {
35245
+ if (content) {
35246
+ $animate.leave(content).done(() => {
35247
+ content = nodes[0];
35248
+ $animate.enter(nodes[0], target);
35249
+ scope.$flushQueue();
35250
+ });
35251
+ scope.$flushQueue();
35252
+ } else {
35253
+ content = nodes[0];
35254
+ $animate.enter(nodes[0], target);
35255
+ scope.$flushQueue();
35256
+ }
35257
+ } else {
35258
+ target.replaceChildren(...nodes);
35259
+ }
35260
+ break;
35261
+
35262
+ case "outerHTML": {
35263
+ const parent = target.parentNode;
35264
+ if (!parent) return;
35265
+ const frag = document.createDocumentFragment();
35266
+ nodes.forEach((n) => frag.appendChild(n));
35267
+ if (animationEnabled) {
35268
+ const placeholder = document.createComment("placeholder");
35269
+ target.parentNode.insertBefore(placeholder, target.nextSibling);
35270
+ $animate.leave(target).done(() => {
35271
+ const insertedNodes = Array.from(frag.childNodes);
35272
+ insertedNodes.forEach((n) =>
35273
+ $animate.enter(n, parent, placeholder),
35274
+ );
35275
+ content = insertedNodes;
35276
+ scope.$flushQueue();
35277
+ });
35278
+ scope.$flushQueue();
35279
+ } else {
35280
+ parent.replaceChild(frag, target);
35281
+ }
35282
+ break;
35283
+ }
35284
+
35285
+ case "textContent":
35286
+ target.textContent = html;
35287
+ break;
35288
+
35289
+ case "beforebegin":
35290
+ nodes.forEach((node) => target.parentNode.insertBefore(node, target));
35291
+ break;
35292
+
35293
+ case "afterbegin":
35294
+ nodes
35295
+ .slice()
35296
+ .reverse()
35297
+ .forEach((node) => target.insertBefore(node, target.firstChild));
35298
+ break;
35299
+
35300
+ case "beforeend":
35301
+ nodes.forEach((node) => target.appendChild(node));
35302
+ break;
35303
+
35304
+ case "afterend":
35305
+ nodes
35306
+ .slice()
35307
+ .reverse()
35308
+ .forEach((node) =>
35309
+ target.parentNode.insertBefore(node, target.nextSibling),
35310
+ );
35311
+ break;
35312
+
35313
+ case "delete":
35314
+ target.remove();
35315
+ break;
35316
+
35317
+ case "none":
35318
+ break;
35319
+
35320
+ default:
35321
+ target.replaceChildren(...nodes);
35322
+ break;
35323
+ }
35324
+ }
35325
+
35236
35326
  /**
35237
35327
  * Collects form data from the element or its associated form.
35238
35328
  *
@@ -35246,15 +35336,12 @@ function createHttpDirective(method, attrName) {
35246
35336
  const tag = element.tagName.toLowerCase();
35247
35337
 
35248
35338
  if (tag === "form") {
35249
- /** @type {HTMLFormElement} */
35250
35339
  form = /** @type {HTMLFormElement} */ (element);
35251
35340
  } else if ("form" in element && element.form) {
35252
- /** @type {HTMLFormElement} */
35253
35341
  form = /** @type {HTMLFormElement} */ (element.form);
35254
35342
  } else if (element.hasAttribute("form")) {
35255
35343
  const formId = element.getAttribute("form");
35256
35344
  if (formId) {
35257
- /** @type {HTMLElement | null} */
35258
35345
  const maybeForm = document.getElementById(formId);
35259
35346
  if (maybeForm && maybeForm.tagName.toLowerCase() === "form") {
35260
35347
  form = /** @type {HTMLFormElement} */ (maybeForm);
@@ -35292,13 +35379,10 @@ function createHttpDirective(method, attrName) {
35292
35379
  return {
35293
35380
  restrict: "A",
35294
35381
  link(scope, element, attrs) {
35295
- const eventName =
35296
- attrs["trigger"] ||
35297
- /** @type {EventType} */ getEventNameForElement(element);
35298
-
35382
+ const eventName = attrs.trigger || getEventNameForElement(element);
35299
35383
  const tag = element.tagName.toLowerCase();
35300
35384
 
35301
- if (isDefined(attrs["latch"])) {
35385
+ if (isDefined(attrs.latch)) {
35302
35386
  attrs.$observe(
35303
35387
  "latch",
35304
35388
  callBackAfterFirst(() =>
@@ -35314,24 +35398,14 @@ function createHttpDirective(method, attrName) {
35314
35398
  element.dispatchEvent(new Event(eventName));
35315
35399
  intervalId = setInterval(
35316
35400
  () => element.dispatchEvent(new Event(eventName)),
35317
- parseInt(attrs["interval"]) || 1000,
35401
+ parseInt(attrs.interval) || 1000,
35318
35402
  );
35319
35403
  }
35320
35404
 
35321
35405
  element.addEventListener(eventName, async (event) => {
35322
35406
  if (/** @type {HTMLButtonElement} */ (element).disabled) return;
35323
35407
  if (tag === "form") event.preventDefault();
35324
- const swap = attrs["swap"] || "innerHTML";
35325
- const targetSelector = attrs["target"];
35326
- const target = targetSelector
35327
- ? document.querySelector(targetSelector)
35328
- : element;
35329
-
35330
- if (!target) {
35331
- $log.warn(`${attrName}: target "${targetSelector}" not found`);
35332
- return;
35333
- }
35334
-
35408
+ const swap = attrs.swap || "innerHTML";
35335
35409
  const url = attrs[attrName];
35336
35410
  if (!url) {
35337
35411
  $log.warn(`${attrName}: no URL specified`);
@@ -35339,56 +35413,57 @@ function createHttpDirective(method, attrName) {
35339
35413
  }
35340
35414
 
35341
35415
  const handler = (res) => {
35342
- if (isDefined(attrs["loading"])) {
35416
+ if (isDefined(attrs.loading)) {
35343
35417
  attrs.$set("loading", false);
35344
35418
  }
35345
35419
 
35346
- if (isDefined(attrs["loadingClass"])) {
35347
- attrs.$removeClass(attrs["loadingClass"]);
35420
+ if (isDefined(attrs.loadingClass)) {
35421
+ attrs.$removeClass(attrs.loadingClass);
35348
35422
  }
35349
35423
 
35350
35424
  const html = res.data;
35351
35425
  if (200 <= res.status && res.status <= 299) {
35352
- if (isDefined(attrs["success"])) {
35353
- $parse(attrs["success"])(scope, { $res: html });
35426
+ if (isDefined(attrs.success)) {
35427
+ $parse(attrs.success)(scope, { $res: html });
35354
35428
  }
35355
35429
 
35356
- if (isDefined(attrs["stateSuccess"])) {
35357
- $state.go(attrs["stateSuccess"]);
35430
+ if (isDefined(attrs.stateSuccess)) {
35431
+ $state.go(attrs.stateSuccess);
35358
35432
  }
35359
35433
  } else if (400 <= res.status && res.status <= 599) {
35360
- if (isDefined(attrs["error"])) {
35361
- $parse(attrs["error"])(scope, { $res: html });
35434
+ if (isDefined(attrs.error)) {
35435
+ $parse(attrs.error)(scope, { $res: html });
35362
35436
  }
35363
35437
 
35364
- if (isDefined(attrs["stateError"])) {
35365
- $state.go(attrs["stateError"]);
35438
+ if (isDefined(attrs.stateError)) {
35439
+ $state.go(attrs.stateError);
35366
35440
  }
35367
35441
  }
35368
35442
 
35369
- handleSwapResponse(
35370
- html,
35371
- /** @type {import("./interface.ts").SwapModeType} */ (swap),
35372
- target,
35373
- scope,
35374
- $compile,
35375
- );
35443
+ if (isObject(html)) {
35444
+ if (attrs.target) {
35445
+ scope.$eval(`${attrs.target} = ${JSON.stringify(html)}`);
35446
+ } else {
35447
+ scope.$merge(html);
35448
+ }
35449
+ } else if (isString(html)) {
35450
+ handleSwapResponse(html, swap, scope, attrs, element);
35451
+ }
35376
35452
  };
35377
- if (isDefined(attrs["delay"])) {
35378
- await wait(parseInt(attrs["delay"]) | 0);
35379
- }
35380
35453
 
35381
- if (throttled) {
35382
- return;
35454
+ if (isDefined(attrs.delay)) {
35455
+ await wait(parseInt(attrs.delay) | 0);
35383
35456
  }
35384
35457
 
35385
- if (isDefined(attrs["throttle"])) {
35458
+ if (throttled) return;
35459
+
35460
+ if (isDefined(attrs.throttle)) {
35386
35461
  throttled = true;
35387
35462
  attrs.$set("throttled", true);
35388
35463
  setTimeout(() => {
35389
35464
  attrs.$set("throttled", false);
35390
35465
  throttled = false;
35391
- }, parseInt(attrs["throttle"]));
35466
+ }, parseInt(attrs.throttle));
35392
35467
  }
35393
35468
 
35394
35469
  if (isDefined(attrs["loading"])) {
@@ -35396,13 +35471,13 @@ function createHttpDirective(method, attrName) {
35396
35471
  }
35397
35472
 
35398
35473
  if (isDefined(attrs["loadingClass"])) {
35399
- attrs.$addClass(attrs["loadingClass"]);
35474
+ attrs.$addClass(attrs.loadingClass);
35400
35475
  }
35401
35476
 
35402
35477
  if (method === "post" || method === "put") {
35403
35478
  let data;
35404
35479
  const config = {};
35405
- if (attrs["enctype"]) {
35480
+ if (attrs.enctype) {
35406
35481
  config.headers = {
35407
35482
  "Content-Type": attrs["enctype"],
35408
35483
  };
@@ -35412,11 +35487,10 @@ function createHttpDirective(method, attrName) {
35412
35487
  }
35413
35488
  $http[method](url, data, config).then(handler).catch(handler);
35414
35489
  } else {
35415
- // If SSE mode is enabled
35416
- if (method === "get" && attrs["ngSse"]) {
35490
+ if (method === "get" && attrs.ngSse) {
35417
35491
  const sseUrl = url;
35418
35492
  const config = {
35419
- withCredentials: attrs["withCredentials"] === "true",
35493
+ withCredentials: attrs.withCredentials === "true",
35420
35494
  transformMessage: (data) => {
35421
35495
  try {
35422
35496
  return JSON.parse(data);
@@ -35426,9 +35500,9 @@ function createHttpDirective(method, attrName) {
35426
35500
  },
35427
35501
  onOpen: () => {
35428
35502
  $log.info(`${attrName}: SSE connection opened to ${sseUrl}`);
35429
- if (isDefined(attrs["loading"])) attrs.$set("loading", false);
35430
- if (isDefined(attrs["loadingClass"]))
35431
- attrs.$removeClass(attrs["loadingClass"]);
35503
+ if (isDefined(attrs.loading)) attrs.$set("loading", false);
35504
+ if (isDefined(attrs.loadingClass))
35505
+ attrs.$removeClass(attrs.loadingClass);
35432
35506
  },
35433
35507
  onMessage: (data) => {
35434
35508
  const res = { status: 200, data };
@@ -35439,12 +35513,15 @@ function createHttpDirective(method, attrName) {
35439
35513
  const res = { status: 500, data: err };
35440
35514
  handler(res);
35441
35515
  },
35516
+ onReconnect: (count) => {
35517
+ $log.info(`ngSse: reconnected ${count} time(s)`);
35518
+ if (attrs.onReconnect)
35519
+ $parse(attrs.onReconnect)(scope, { $count: count });
35520
+ },
35442
35521
  };
35443
35522
 
35444
- // Open the SSE connection using the injected service
35445
35523
  const source = $sse(sseUrl, config);
35446
35524
 
35447
- // Cleanup on scope destroy
35448
35525
  scope.$on("$destroy", () => {
35449
35526
  $log.info(`${attrName}: closing SSE connection`);
35450
35527
  source.close();
@@ -35459,7 +35536,6 @@ function createHttpDirective(method, attrName) {
35459
35536
  scope.$on("$destroy", () => clearInterval(intervalId));
35460
35537
  }
35461
35538
 
35462
- // Eagerly execute for 'load' event
35463
35539
  if (eventName == "load") {
35464
35540
  element.dispatchEvent(new Event("load"));
35465
35541
  }
@@ -35473,31 +35549,26 @@ ngInjectDirective.$inject = [$injectTokens.$log, $injectTokens.$injector];
35473
35549
  /**
35474
35550
  * @param {ng.LogService} $log
35475
35551
  * @param {ng.InjectorService} $injector
35476
- * @returns {import('interface.ts').Directive}
35552
+ * @returns {ng.Directive}
35477
35553
  */
35478
35554
  function ngInjectDirective($log, $injector) {
35479
35555
  return {
35480
35556
  restrict: "A",
35481
35557
  link(scope, _element, attrs) {
35482
- const expr = attrs["ngInject"];
35483
-
35558
+ const expr = attrs.ngInject;
35484
35559
  if (!expr) return;
35485
- // Match any identifier that starts with $, or ends with Service/Factory
35486
- // Example matches: $http, userService, authFactory
35487
- const replacedExpr = expr.replace(
35488
- /(\$[\w]+|[\w]+(?:Service|Factory))/g,
35489
- (match, name) => {
35490
- try {
35491
- const service = $injector.get(name);
35492
- scope.$target[name] = service;
35493
- return name;
35494
- } catch {
35495
- $log.warn(`Injectable ${name} not found in $injector`);
35496
- return match;
35497
- }
35498
- },
35499
- );
35500
- scope.$apply(replacedExpr);
35560
+ const tokens = expr
35561
+ .split(";")
35562
+ .map((s) => s.trim())
35563
+ .filter(Boolean);
35564
+
35565
+ for (const name of tokens) {
35566
+ if ($injector.has(name)) {
35567
+ scope[name] = $injector.get(name);
35568
+ } else {
35569
+ $log.warn(`Injectable ${name} not found in $injector`);
35570
+ }
35571
+ }
35501
35572
  },
35502
35573
  };
35503
35574
  }
@@ -35540,38 +35611,54 @@ function ngElDirective() {
35540
35611
  * const source = $sse('/events', {
35541
35612
  * onMessage: (data) => console.log(data),
35542
35613
  * onError: (err) => console.error(err),
35543
- * withCredentials: true
35614
+ * retryDelay: 2000,
35615
+ * heartbeatTimeout: 10000,
35544
35616
  * });
35545
35617
  *
35546
- * // later:
35547
35618
  * source.close();
35548
35619
  */
35549
-
35550
35620
  class SseProvider {
35551
35621
  constructor() {
35552
35622
  /**
35553
35623
  * Optional provider-level defaults
35554
35624
  * @type {ng.SseConfig}
35555
35625
  */
35556
- this.defaults = {};
35626
+ this.defaults = {
35627
+ retryDelay: 1000,
35628
+ maxRetries: Infinity,
35629
+ heartbeatTimeout: 15000, // 15 seconds
35630
+ transformMessage(data) {
35631
+ try {
35632
+ return JSON.parse(data);
35633
+ } catch {
35634
+ return data;
35635
+ }
35636
+ },
35637
+ };
35557
35638
  }
35558
35639
 
35559
35640
  /**
35560
35641
  * Returns the $sse service function
35561
35642
  * @returns {ng.SseService}
35562
35643
  */
35563
- $get =
35564
- () =>
35565
- (url, config = {}) => {
35566
- const finalUrl = this.#buildUrl(url, config.params);
35567
- return this.#createEventSource(finalUrl, config);
35568
- };
35644
+ $get = [
35645
+ $injectTokens.$log,
35646
+ /** @param {ng.LogService} log */
35647
+ (log) => {
35648
+ this.$log = log;
35649
+ return (url, config = {}) => {
35650
+ const mergedConfig = { ...this.defaults, ...config };
35651
+ const finalUrl = this.#buildUrl(url, mergedConfig.params);
35652
+ return this.#createConnection(finalUrl, mergedConfig);
35653
+ };
35654
+ },
35655
+ ];
35569
35656
 
35570
35657
  /**
35571
35658
  * Build URL with query parameters
35572
- * @param {string} url - Base URL
35573
- * @param {Record<string, any>=} params - Query parameters
35574
- * @returns {string} URL with serialized query string
35659
+ * @param {string} url
35660
+ * @param {Record<string, any>=} params
35661
+ * @returns {string}
35575
35662
  */
35576
35663
  #buildUrl(url, params) {
35577
35664
  if (!params) return url;
@@ -35582,37 +35669,81 @@ class SseProvider {
35582
35669
  }
35583
35670
 
35584
35671
  /**
35585
- * Create and manage an EventSource
35586
- * @param {string} url - URL for SSE connection
35587
- * @param {ng.SseConfig} config - Configuration object
35588
- * @returns {EventSource} The EventSource instance wrapped as SseService
35672
+ * Creates a managed SSE connection with reconnect and heartbeat
35673
+ * @param {string} url
35674
+ * @param {ng.SseConfig} config
35675
+ * @returns {import("./interface.ts").SseConnection}
35589
35676
  */
35590
- #createEventSource(url, config) {
35591
- const es = new EventSource(url, {
35592
- withCredentials: !!config.withCredentials,
35593
- });
35677
+ #createConnection(url, config) {
35678
+ let es;
35679
+ let retryCount = 0;
35680
+ let closed = false;
35681
+ let heartbeatTimer;
35594
35682
 
35595
- if (config.onOpen) {
35596
- es.addEventListener("open", (e) => config.onOpen(e));
35597
- }
35683
+ const connect = () => {
35684
+ if (closed) return;
35598
35685
 
35599
- es.addEventListener("message", (e) => {
35600
- let data = e.data;
35601
- try {
35602
- data = config.transformMessage
35603
- ? config.transformMessage(data)
35604
- : JSON.parse(data);
35605
- } catch {
35606
- // leave as raw string if not JSON
35607
- }
35608
- config.onMessage?.(data, e);
35609
- });
35686
+ es = new EventSource(url, {
35687
+ withCredentials: !!config.withCredentials,
35688
+ });
35610
35689
 
35611
- if (config.onError) {
35612
- es.addEventListener("error", (e) => config.onError(e));
35613
- }
35690
+ es.addEventListener("open", (e) => {
35691
+ retryCount = 0;
35692
+ config.onOpen?.(e);
35693
+ if (config.heartbeatTimeout) resetHeartbeat();
35694
+ });
35614
35695
 
35615
- return es;
35696
+ es.addEventListener("message", (e) => {
35697
+ let data = e.data;
35698
+ try {
35699
+ data = config.transformMessage ? config.transformMessage(data) : data;
35700
+ } catch {
35701
+ /* empty */
35702
+ }
35703
+ config.onMessage?.(data, e);
35704
+ if (config.heartbeatTimeout) resetHeartbeat();
35705
+ });
35706
+
35707
+ es.addEventListener("error", (err) => {
35708
+ config.onError?.(err);
35709
+ if (closed) return;
35710
+ es.close();
35711
+
35712
+ if (retryCount < config.maxRetries) {
35713
+ retryCount++;
35714
+ config.onReconnect?.(retryCount);
35715
+ setTimeout(connect, config.retryDelay);
35716
+ } else {
35717
+ this.$log.warn("SSE: Max retries reached");
35718
+ }
35719
+ });
35720
+ };
35721
+
35722
+ const resetHeartbeat = () => {
35723
+ clearTimeout(heartbeatTimer);
35724
+ heartbeatTimer = setTimeout(() => {
35725
+ this.$log.warn("SSE: heartbeat timeout, reconnecting...");
35726
+ es.close();
35727
+ config.onReconnect?.(++retryCount);
35728
+ connect();
35729
+ }, config.heartbeatTimeout);
35730
+ };
35731
+
35732
+ connect();
35733
+
35734
+ return {
35735
+ close() {
35736
+ closed = true;
35737
+ clearTimeout(heartbeatTimer);
35738
+ es.close();
35739
+ },
35740
+ connect() {
35741
+ if (closed == false) {
35742
+ close();
35743
+ }
35744
+ connect();
35745
+ },
35746
+ };
35616
35747
  }
35617
35748
  }
35618
35749
 
@@ -35669,10 +35800,252 @@ function ngViewportDirective() {
35669
35800
  };
35670
35801
  }
35671
35802
 
35803
+ ngWorkerDirective.$inject = ["$worker", $injectTokens.$parse, $injectTokens.$log];
35804
+ /**
35805
+ * ngWorker directive factory
35806
+ * Usage: <div ng-worker="workerName" data-params="{{ expression }}" data-on-result="callback($result)"></div>
35807
+ */
35808
+ function ngWorkerDirective($worker, $parse, $log) {
35809
+ return {
35810
+ restrict: "A",
35811
+ link(scope, element, attrs) {
35812
+ const workerName = attrs.ngWorker;
35813
+ if (!workerName) {
35814
+ $log.warn("ngWorker: missing worker name");
35815
+ return;
35816
+ }
35817
+
35818
+ const eventName = attrs.trigger || getEventNameForElement(element);
35819
+
35820
+ let throttled = false;
35821
+ let intervalId;
35822
+
35823
+ if (isDefined(attrs.latch)) {
35824
+ attrs.$observe(
35825
+ "latch",
35826
+ callBackAfterFirst(() => element.dispatchEvent(new Event(eventName))),
35827
+ );
35828
+ }
35829
+
35830
+ if (isDefined(attrs.interval)) {
35831
+ element.dispatchEvent(new Event(eventName));
35832
+ intervalId = setInterval(
35833
+ () => element.dispatchEvent(new Event(eventName)),
35834
+ parseInt(attrs.interval) || 1000,
35835
+ );
35836
+ }
35837
+
35838
+ const worker = $worker(workerName, {
35839
+ onMessage: (result) => {
35840
+ if (isDefined(attrs.dataOnResult)) {
35841
+ $parse(attrs.dataOnResult)(scope, { $result: result });
35842
+ } else {
35843
+ const swap = attrs.swap || "innerHTML";
35844
+ handleSwap(result, swap, element);
35845
+ }
35846
+ },
35847
+ onError: (err) => {
35848
+ $log.error(`[ng-worker:${workerName}]`, err);
35849
+ if (isDefined(attrs.dataOnError)) {
35850
+ $parse(attrs.dataOnError)(scope, { $error: err });
35851
+ } else {
35852
+ element.textContent = "Error";
35853
+ }
35854
+ },
35855
+ });
35856
+
35857
+ element.addEventListener(eventName, async () => {
35858
+ if (element.disabled) return;
35859
+
35860
+ if (isDefined(attrs.delay)) {
35861
+ await wait(parseInt(attrs.delay) || 0);
35862
+ }
35863
+
35864
+ if (throttled) return;
35865
+
35866
+ if (isDefined(attrs.throttle)) {
35867
+ throttled = true;
35868
+ attrs.$set("throttled", true);
35869
+ setTimeout(() => {
35870
+ attrs.$set("throttled", false);
35871
+ throttled = false;
35872
+ }, parseInt(attrs.throttle));
35873
+ }
35874
+
35875
+ let params;
35876
+ try {
35877
+ params = attrs.params ? scope.$eval(attrs.params) : undefined;
35878
+ } catch (err) {
35879
+ $log.error("ngWorker: failed to evaluate data-params", err);
35880
+ params = undefined;
35881
+ }
35882
+
35883
+ worker.post(params);
35884
+ });
35885
+
35886
+ if (intervalId) {
35887
+ scope.$on("$destroy", () => clearInterval(intervalId));
35888
+ }
35889
+
35890
+ if (eventName === "load") {
35891
+ element.dispatchEvent(new Event("load"));
35892
+ }
35893
+ },
35894
+ };
35895
+ }
35896
+
35897
+ /**
35898
+ * Swap result into DOM based on strategy
35899
+ */
35900
+ function handleSwap(result, swap, element) {
35901
+ switch (swap) {
35902
+ case "outerHTML": {
35903
+ const parent = element.parentNode;
35904
+ if (!parent) return;
35905
+ const temp = document.createElement("div");
35906
+ temp.innerHTML = result;
35907
+ parent.replaceChild(temp.firstChild, element);
35908
+ break;
35909
+ }
35910
+ case "textContent":
35911
+ element.textContent = result;
35912
+ break;
35913
+ case "beforebegin":
35914
+ element.insertAdjacentHTML("beforebegin", result);
35915
+ break;
35916
+ case "afterbegin":
35917
+ element.insertAdjacentHTML("afterbegin", result);
35918
+ break;
35919
+ case "beforeend":
35920
+ element.insertAdjacentHTML("beforeend", result);
35921
+ break;
35922
+ case "afterend":
35923
+ element.insertAdjacentHTML("afterend", result);
35924
+ break;
35925
+ case "innerHTML":
35926
+ default:
35927
+ element.innerHTML = result;
35928
+ break;
35929
+ }
35930
+ }
35931
+
35932
+ /**
35933
+ * Worker Provider
35934
+ *
35935
+ * Usage:
35936
+ * const worker = $worker('./math.worker.js', {
35937
+ * onMessage: (data) => console.log('Result:', data),
35938
+ * onError: (err) => console.error('Worker error:', err),
35939
+ * autoTerminate: false,
35940
+ * transformMessage: (d) => d,
35941
+ * });
35942
+ *
35943
+ * worker.post({ action: 'fib', n: 20 });
35944
+ * worker.terminate();
35945
+ */
35946
+ class WorkerProvider {
35947
+ /**
35948
+ * @type {ng.LogService}
35949
+ */
35950
+ $log;
35951
+ constructor() {
35952
+ /**
35953
+ * Optional provider-level defaults
35954
+ * @type {ng.WorkerConfig}
35955
+ */
35956
+ this.defaults = {
35957
+ autoTerminate: false,
35958
+ transformMessage(data) {
35959
+ try {
35960
+ return JSON.parse(data);
35961
+ } catch {
35962
+ return data;
35963
+ }
35964
+ },
35965
+ };
35966
+ }
35967
+
35968
+ /**
35969
+ * Returns the $worker service function
35970
+ * @returns {ng.WorkerService}
35971
+ */
35972
+ $get = [
35973
+ $injectTokens.$log,
35974
+ /** @param {ng.LogService} log */
35975
+ (log) => {
35976
+ this.$log = log;
35977
+ return (scriptPath, config = {}) => {
35978
+ const merged = { ...this.defaults, ...config };
35979
+ return this.#createWorker(scriptPath, merged);
35980
+ };
35981
+ },
35982
+ ];
35983
+
35984
+ /**
35985
+ * Creates a managed Web Worker instance
35986
+ * @param {string | URL} scriptPath
35987
+ * @param {ng.WorkerConfig} config
35988
+ * @returns {import("./interface.ts").WorkerConnection}
35989
+ */
35990
+ #createWorker(scriptPath, config) {
35991
+ if (!scriptPath) throw new Error("Worker script path required");
35992
+
35993
+ let worker = new Worker(scriptPath, { type: "module" });
35994
+ let terminated = false;
35995
+
35996
+ const reconnect = () => {
35997
+ if (terminated) return;
35998
+ this.$log.info("Worker: restarting...");
35999
+ worker.terminate();
36000
+ worker = new Worker(scriptPath, { type: "module" });
36001
+ wire(worker);
36002
+ };
36003
+
36004
+ const wire = (w) => {
36005
+ w.onmessage = (e) => {
36006
+ let data = e.data;
36007
+ try {
36008
+ data = config.transformMessage ? config.transformMessage(data) : data;
36009
+ } catch {
36010
+ /* no-op */
36011
+ }
36012
+ config.onMessage?.(data, e);
36013
+ };
36014
+
36015
+ w.onerror = (err) => {
36016
+ config.onError?.(err);
36017
+ if (config.autoRestart) reconnect();
36018
+ };
36019
+ };
36020
+
36021
+ wire(worker);
36022
+ let that = this;
36023
+ return {
36024
+ post(data) {
36025
+ if (terminated) return that.$log.warn("Worker already terminated");
36026
+ try {
36027
+ worker.postMessage(data);
36028
+ } catch (err) {
36029
+ that.$log.error("Worker post failed", err);
36030
+ }
36031
+ },
36032
+ terminate() {
36033
+ terminated = true;
36034
+ worker.terminate();
36035
+ },
36036
+ restart() {
36037
+ if (terminated)
36038
+ return that.$log.warn("Worker cannot restart after terminate");
36039
+ reconnect();
36040
+ },
36041
+ };
36042
+ }
36043
+ }
36044
+
35672
36045
  /**
35673
36046
  * Initializes core `ng` module.
35674
- * @param {import('./angular.js').Angular} angular
35675
- * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
36047
+ * @param {ng.Angular} angular
36048
+ * @returns {ng.NgModule} `ng` module
35676
36049
  */
35677
36050
  function registerNgModule(angular) {
35678
36051
  return angular
@@ -35681,14 +36054,14 @@ function registerNgModule(angular) {
35681
36054
  [],
35682
36055
  [
35683
36056
  $injectTokens.$provide,
35684
- /** @param {import("./interface.js").Provider} $provide */
36057
+ /** @param {ng.ProvideService} $provide */
35685
36058
  ($provide) => {
35686
36059
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
35687
36060
  $provide.provider({
35688
36061
  $$sanitizeUri: SanitizeUriProvider,
35689
36062
  });
35690
- $provide.value("$window", window);
35691
- $provide.value("$document", document);
36063
+ $provide.value($injectTokens.$window, window);
36064
+ $provide.value($injectTokens.$document, document);
35692
36065
  $provide
35693
36066
  .provider($injectTokens.$compile, CompileProvider)
35694
36067
  .directive({
@@ -35701,6 +36074,7 @@ function registerNgModule(angular) {
35701
36074
  ngBind: ngBindDirective,
35702
36075
  ngBindHtml: ngBindHtmlDirective,
35703
36076
  ngBindTemplate: ngBindTemplateDirective,
36077
+ ngChannel: ngChannelDirective,
35704
36078
  ngClass: ngClassDirective,
35705
36079
  ngClassEven: ngClassEvenDirective,
35706
36080
  ngClassOdd: ngClassOddDirective,
@@ -35747,11 +36121,13 @@ function registerNgModule(angular) {
35747
36121
  ngValue: ngValueDirective,
35748
36122
  ngModelOptions: ngModelOptionsDirective,
35749
36123
  ngViewport: ngViewportDirective,
36124
+ ngWorker: ngWorkerDirective,
35750
36125
  })
35751
36126
  .directive({
35752
36127
  input: hiddenInputBrowserCacheDirective,
35753
36128
  ngAnimateSwap: ngAnimateSwapDirective,
35754
36129
  ngAnimateChildren: $$AnimateChildrenDirective,
36130
+ // aria directives
35755
36131
  ngChecked: ngCheckedAriaDirective,
35756
36132
  ngClick: ngClickAriaDirective,
35757
36133
  ngDblclick: ngDblclickAriaDirective,
@@ -35763,12 +36139,12 @@ function registerNgModule(angular) {
35763
36139
  ngReadonly: ngReadonlyAriaDirective,
35764
36140
  ngRequired: ngRequiredAriaDirective,
35765
36141
  ngValue: ngValueAriaDirective,
36142
+ // router directives
35766
36143
  ngSref: $StateRefDirective,
35767
36144
  ngSrefActive: $StateRefActiveDirective,
35768
36145
  ngSrefActiveEq: $StateRefActiveDirective,
35769
36146
  ngState: $StateRefDynamicDirective,
35770
36147
  ngView: ngView,
35771
- ngChannel: ngChannelDirective,
35772
36148
  })
35773
36149
  .directive({
35774
36150
  ngView: $ViewDirectiveFill,
@@ -35786,8 +36162,6 @@ function registerNgModule(angular) {
35786
36162
  $$animateJsDriver: AnimateJsDriverProvider,
35787
36163
  $$animateCache: AnimateCacheProvider,
35788
36164
  $$animateQueue: AnimateQueueProvider,
35789
- $$AnimateRunner: AnimateRunnerFactoryProvider,
35790
- $$animateAsyncRun: AnimateAsyncRunFactoryProvider,
35791
36165
  $controller: ControllerProvider,
35792
36166
  $exceptionHandler: ExceptionHandlerProvider,
35793
36167
  $filter: FilterProvider,
@@ -35814,6 +36188,7 @@ function registerNgModule(angular) {
35814
36188
  $url: UrlService,
35815
36189
  $stateRegistry: StateRegistryProvider,
35816
36190
  $eventBus: PubSubProvider,
36191
+ $worker: WorkerProvider,
35817
36192
  });
35818
36193
  },
35819
36194
  ],
@@ -35839,20 +36214,36 @@ class Angular {
35839
36214
  constructor() {
35840
36215
  this.$cache = Cache;
35841
36216
 
35842
- /** @type {import('./services/pubsub/pubsub.js').PubSub} */
36217
+ /** @type {ng.PubSubService} */
35843
36218
  this.$eventBus = EventBus;
35844
36219
 
35845
36220
  /**
35846
36221
  * @type {string} `version` from `package.json`
35847
36222
  */
35848
- this.version = "0.9.9"; //inserted via rollup plugin
36223
+ this.version = "0.11.0"; //inserted via rollup plugin
35849
36224
 
35850
36225
  /** @type {!Array<string|any>} */
35851
36226
  this.bootsrappedModules = [];
35852
36227
 
36228
+ /**
36229
+ * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
36230
+ *
36231
+ * @type {(element: Element, name: string?) => ng.Scope|undefined}
36232
+ */
35853
36233
  this.getController = getController;
36234
+
36235
+ /**
36236
+ * Return instance of InjectorService attached to element
36237
+ * @type {(Element) => ng.InjectorService}
36238
+ */
35854
36239
  this.getInjector = getInjector;
36240
+
36241
+ /**
36242
+ * Gets scope for a given element.
36243
+ * @type {(Element) => *}
36244
+ */
35855
36245
  this.getScope = getScope;
36246
+
35856
36247
  this.errorHandlingConfig = errorHandlingConfig;
35857
36248
  this.$t = $injectTokens;
35858
36249
 
@@ -35945,7 +36336,8 @@ class Angular {
35945
36336
  */
35946
36337
  (scope, el, compile, $injector) => {
35947
36338
  // ng-route deps
35948
- this.$injector = $injector;
36339
+ this.$injector = $injector; // TODO refactor away as this as this prevents multiple apps from being used
36340
+
35949
36341
  setCacheData(el, "$injector", $injector);
35950
36342
 
35951
36343
  const compileFn = compile(el);
@@ -36068,7 +36460,7 @@ class Angular {
36068
36460
  * @param {string} name The name of the module to create or retrieve.
36069
36461
  * @param {Array.<string>} [requires] If specified then new module is being created. If
36070
36462
  * unspecified then the module is being retrieved for further configuration.
36071
- * @param {import("./interface.js").Injectable<any>} [configFn] Optional configuration function for the module that gets
36463
+ * @param {import("./interface.ts").Injectable<any>} [configFn] Optional configuration function for the module that gets
36072
36464
  * passed to {@link NgModule.config NgModule.config()}.
36073
36465
  * @returns {NgModule} A newly registered module.
36074
36466
  */