@angular-wave/angular.ts 0.9.8 → 0.10.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 (53) hide show
  1. package/@types/angular.d.ts +2 -2
  2. package/@types/animations/animate-js.d.ts +1 -1
  3. package/@types/animations/animate-queue.d.ts +0 -1
  4. package/@types/animations/animate-swap.d.ts +2 -4
  5. package/@types/animations/animate.d.ts +2 -2
  6. package/@types/animations/raf-scheduler.d.ts +4 -4
  7. package/@types/animations/shared.d.ts +30 -2
  8. package/@types/core/compile/attributes.d.ts +5 -8
  9. package/@types/core/compile/compile.d.ts +6 -63
  10. package/@types/core/compile/inteface.d.ts +82 -0
  11. package/@types/core/controller/controller.d.ts +1 -1
  12. package/@types/core/di/ng-module.d.ts +14 -14
  13. package/@types/core/scope/interface.d.ts +18 -0
  14. package/@types/core/scope/scope.d.ts +16 -97
  15. package/@types/directive/aria/aria.d.ts +11 -13
  16. package/@types/directive/attrs/attrs.d.ts +2 -2
  17. package/@types/directive/channel/channel.d.ts +3 -5
  18. package/@types/directive/cloak/cloak.d.ts +2 -2
  19. package/@types/directive/events/events.d.ts +16 -0
  20. package/@types/directive/http/http.d.ts +4 -22
  21. package/@types/directive/if/if.d.ts +2 -4
  22. package/@types/directive/include/include.d.ts +4 -4
  23. package/@types/directive/messages/messages.d.ts +3 -3
  24. package/@types/directive/observe/observe.d.ts +2 -5
  25. package/@types/directive/options/options.d.ts +2 -2
  26. package/@types/directive/transclude/transclude.d.ts +4 -4
  27. package/@types/directive/viewport/viewport.d.ts +4 -0
  28. package/@types/directive/worker/worker.d.ts +15 -0
  29. package/@types/interface.d.ts +6 -5
  30. package/@types/namespace.d.ts +69 -40
  31. package/@types/router/directives/view-directive.d.ts +2 -2
  32. package/@types/router/path/path-utils.d.ts +2 -2
  33. package/@types/router/state/state-object.d.ts +6 -6
  34. package/@types/router/state/state-service.d.ts +3 -3
  35. package/@types/router/template-factory.d.ts +1 -1
  36. package/@types/router/transition/hook-builder.d.ts +1 -1
  37. package/@types/router/transition/interface.d.ts +1 -12
  38. package/@types/router/transition/transition-hook.d.ts +31 -0
  39. package/@types/router/transition/transition-service.d.ts +1 -1
  40. package/@types/router/transition/transition.d.ts +2 -2
  41. package/@types/services/pubsub/pubsub.d.ts +2 -2
  42. package/@types/services/sse/interface.d.ts +27 -1
  43. package/@types/services/sse/sse.d.ts +4 -3
  44. package/@types/services/worker/interface.d.ts +12 -0
  45. package/@types/services/worker/worker.d.ts +31 -0
  46. package/@types/shared/url-utils/url-utils.d.ts +14 -14
  47. package/README.md +2 -2
  48. package/dist/angular-ts.esm.js +1462 -1147
  49. package/dist/angular-ts.umd.js +1462 -1147
  50. package/dist/angular-ts.umd.min.js +1 -1
  51. package/dist/angular.css +1 -0
  52. package/package.json +4 -3
  53. package/css/angular.css +0 -16
@@ -1,4 +1,4 @@
1
- /* Version: 0.9.8 - October 26, 2025 19:05:34 */
1
+ /* Version: 0.10.0 - November 8, 2025 10:37:13 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -912,7 +912,7 @@
912
912
  return arg;
913
913
  }
914
914
 
915
- /** @type {import("./interface.js").ErrorHandlingConfig} */
915
+ /** @type {import("./interface.ts").ErrorHandlingConfig} */
916
916
  const minErrConfig = {
917
917
  objectMaxDepth: 5,
918
918
  urlErrorParamsEnabled: true,
@@ -1204,6 +1204,382 @@
1204
1204
  */
1205
1205
  const Cache = new Map();
1206
1206
 
1207
+ /**
1208
+ * @readonly
1209
+ * @enum {number}
1210
+ */
1211
+ const ASTType = {
1212
+ Program: 1,
1213
+ ExpressionStatement: 2,
1214
+ AssignmentExpression: 3,
1215
+ ConditionalExpression: 4,
1216
+ LogicalExpression: 5,
1217
+ BinaryExpression: 6,
1218
+ UnaryExpression: 7,
1219
+ CallExpression: 8,
1220
+ MemberExpression: 9,
1221
+ Identifier: 10,
1222
+ Literal: 11,
1223
+ ArrayExpression: 12,
1224
+ Property: 13,
1225
+ ObjectExpression: 14,
1226
+ ThisExpression: 15,
1227
+ LocalsExpression: 16,
1228
+ NGValueParameter: 17,
1229
+ };
1230
+
1231
+ const ADD_CLASS_SUFFIX = "-add";
1232
+ const REMOVE_CLASS_SUFFIX = "-remove";
1233
+ const EVENT_CLASS_PREFIX = "ng-";
1234
+ const ACTIVE_CLASS_SUFFIX = "-active";
1235
+ const PREPARE_CLASS_SUFFIX = "-prepare";
1236
+
1237
+ const NG_ANIMATE_CLASSNAME = "ng-animate";
1238
+ const NG_ANIMATE_CHILDREN_DATA = "$$ngAnimateChildren";
1239
+ let TRANSITION_PROP;
1240
+ let TRANSITIONEND_EVENT;
1241
+ let ANIMATION_PROP;
1242
+ let ANIMATIONEND_EVENT;
1243
+
1244
+ // If unprefixed events are not supported but webkit-prefixed are, use the latter.
1245
+ // Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
1246
+ // Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
1247
+ // but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
1248
+ // Register both events in case `window.onanimationend` is not supported because of that,
1249
+ // do the same for `transitionend` as Safari is likely to exhibit similar behavior.
1250
+ // Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
1251
+ // therefore there is no reason to test anymore for other vendor prefixes:
1252
+ // http://caniuse.com/#search=transition
1253
+ if (
1254
+ window.ontransitionend === undefined &&
1255
+ window.onwebkittransitionend !== undefined
1256
+ ) {
1257
+ TRANSITION_PROP = "WebkitTransition";
1258
+ TRANSITIONEND_EVENT = "webkitTransitionEnd transitionend";
1259
+ } else {
1260
+ TRANSITION_PROP = "transition";
1261
+ TRANSITIONEND_EVENT = "transitionend";
1262
+ }
1263
+
1264
+ if (
1265
+ window.onanimationend === undefined &&
1266
+ window.onwebkitanimationend !== undefined
1267
+ ) {
1268
+ ANIMATION_PROP = "WebkitAnimation";
1269
+ ANIMATIONEND_EVENT = "webkitAnimationEnd animationend";
1270
+ } else {
1271
+ ANIMATION_PROP = "animation";
1272
+ ANIMATIONEND_EVENT = "animationend";
1273
+ }
1274
+
1275
+ const DURATION_KEY = "Duration";
1276
+ const PROPERTY_KEY = ASTType.Property;
1277
+ const DELAY_KEY = "Delay";
1278
+ const TIMING_KEY = "TimingFunction";
1279
+ const ANIMATION_ITERATION_COUNT_KEY = "IterationCount";
1280
+ const ANIMATION_PLAYSTATE_KEY = "PlayState";
1281
+ const SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
1282
+
1283
+ const ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
1284
+ const ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
1285
+ const TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
1286
+ const TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
1287
+
1288
+ const ngMinErr$1 = minErr("ng");
1289
+ function assertArg(arg, name, reason) {
1290
+ if (!arg) {
1291
+ throw ngMinErr$1(
1292
+ "areq",
1293
+ "Argument '{0}' is {1}",
1294
+ name || "?",
1295
+ reason,
1296
+ );
1297
+ }
1298
+ return arg;
1299
+ }
1300
+
1301
+ function packageStyles(options) {
1302
+ const styles = {};
1303
+ if (options && (options.to || options.from)) {
1304
+ styles.to = options.to;
1305
+ styles.from = options.from;
1306
+ }
1307
+ return styles;
1308
+ }
1309
+
1310
+ function pendClasses(classes, fix, isPrefix) {
1311
+ let className = "";
1312
+
1313
+ classes = Array.isArray(classes)
1314
+ ? classes
1315
+ : classes && isString(classes) && classes.length
1316
+ ? classes.split(/\s+/)
1317
+ : [];
1318
+ classes.forEach((klass, i) => {
1319
+ if (klass && klass.length > 0) {
1320
+ className += i > 0 ? " " : "";
1321
+ className += isPrefix ? fix + klass : klass + fix;
1322
+ }
1323
+ });
1324
+ return className;
1325
+ }
1326
+
1327
+ function removeFromArray(arr, val) {
1328
+ const index = arr.indexOf(val);
1329
+ if (val >= 0) {
1330
+ arr.splice(index, 1);
1331
+ }
1332
+ }
1333
+
1334
+ /**
1335
+ *
1336
+ * @param {NodeList|Node} element
1337
+ * @returns {Node[]|Node|undefined}
1338
+ */
1339
+ function stripCommentsFromElement(element) {
1340
+ if (element instanceof NodeList) {
1341
+ return Array.from(element).filter((x) => x.nodeType == Node.ELEMENT_NODE);
1342
+ } else if (element.nodeType === Node.ELEMENT_NODE) {
1343
+ return /** @type {Node} */ (element);
1344
+ } else {
1345
+ return undefined;
1346
+ }
1347
+ }
1348
+
1349
+ /**
1350
+ * @param {NodeList|Node} element
1351
+ * @returns {Node}
1352
+ */
1353
+ function extractElementNode(element) {
1354
+ if (!element || !Array.isArray(element)) return /** @type {Node} */ (element);
1355
+ for (let i = 0; i < /** @type {NodeList} */ (element).length; i++) {
1356
+ const elm = element[i];
1357
+ if (elm.nodeType === Node.ELEMENT_NODE) {
1358
+ return elm;
1359
+ }
1360
+ }
1361
+ }
1362
+
1363
+ function applyAnimationClassesFactory() {
1364
+ return function (element, options) {
1365
+ if (options.addClass) {
1366
+ element.classList.add(...options.addClass.trim().split(" "));
1367
+ options.addClass = null;
1368
+ }
1369
+ if (options.removeClass) {
1370
+ element.classList.remove(...options.removeClass.trim().split(" "));
1371
+ options.removeClass = null;
1372
+ }
1373
+ };
1374
+ }
1375
+
1376
+ function prepareAnimationOptions(options) {
1377
+ options = options || {};
1378
+ if (!options.$$prepared) {
1379
+ let domOperation = options.domOperation || (() => {});
1380
+ options.domOperation = function () {
1381
+ options.$$domOperationFired = true;
1382
+ domOperation();
1383
+ domOperation = () => {};
1384
+ };
1385
+ options.$$prepared = true;
1386
+ }
1387
+ return options;
1388
+ }
1389
+
1390
+ function applyAnimationStyles(element, options) {
1391
+ applyAnimationFromStyles(element, options);
1392
+ applyAnimationToStyles(element, options);
1393
+ }
1394
+
1395
+ /**
1396
+ * Applies initial animation styles to a DOM element.
1397
+ *
1398
+ * This function sets the element's inline styles using the properties
1399
+ * defined in `options.from`, then clears the property to prevent reuse.
1400
+ *
1401
+ * @param {HTMLElement} element - The target DOM element to apply styles to.
1402
+ * @param {{ from?: Partial<CSSStyleDeclaration> | null }} options - options containing a `from` object with CSS property–value pairs.
1403
+ */
1404
+ function applyAnimationFromStyles(element, options) {
1405
+ if (options.from) {
1406
+ Object.assign(element.style, options.from);
1407
+ options.from = null;
1408
+ }
1409
+ }
1410
+
1411
+ /**
1412
+ * Applies final animation styles to a DOM element.
1413
+ *
1414
+ * This function sets the element's inline styles using the properties
1415
+ * defined in `options.to`, then clears the property to prevent reuse.
1416
+ *
1417
+ * @param {HTMLElement} element - The target DOM element to apply styles to.
1418
+ * @param {{ to?: Partial<CSSStyleDeclaration> | null }} options - options containing a `from` object with CSS property–value pairs.
1419
+ */
1420
+ function applyAnimationToStyles(element, options) {
1421
+ if (options.to) {
1422
+ Object.assign(element.style, options.to);
1423
+ options.to = null;
1424
+ }
1425
+ }
1426
+
1427
+ function mergeAnimationDetails(element, oldAnimation, newAnimation) {
1428
+ const target = oldAnimation.options || {};
1429
+ const newOptions = newAnimation.options || {};
1430
+
1431
+ const toAdd = `${target.addClass || ""} ${newOptions.addClass || ""}`;
1432
+ const toRemove = `${target.removeClass || ""} ${newOptions.removeClass || ""}`;
1433
+ const classes = resolveElementClasses(
1434
+ element.getAttribute("class"),
1435
+ toAdd,
1436
+ toRemove,
1437
+ );
1438
+
1439
+ if (newOptions.preparationClasses) {
1440
+ target.preparationClasses = concatWithSpace(
1441
+ newOptions.preparationClasses,
1442
+ target.preparationClasses,
1443
+ );
1444
+ delete newOptions.preparationClasses;
1445
+ }
1446
+
1447
+ extend(target, newOptions);
1448
+
1449
+ if (classes.addClass) {
1450
+ target.addClass = classes.addClass;
1451
+ } else {
1452
+ target.addClass = null;
1453
+ }
1454
+
1455
+ if (classes.removeClass) {
1456
+ target.removeClass = classes.removeClass;
1457
+ } else {
1458
+ target.removeClass = null;
1459
+ }
1460
+
1461
+ oldAnimation.addClass = target.addClass;
1462
+ oldAnimation.removeClass = target.removeClass;
1463
+
1464
+ return target;
1465
+ }
1466
+
1467
+ function resolveElementClasses(existing, toAdd, toRemove) {
1468
+ const ADD_CLASS = 1;
1469
+ const REMOVE_CLASS = -1;
1470
+
1471
+ const flags = {};
1472
+ existing = splitClassesToLookup(existing);
1473
+
1474
+ toAdd = splitClassesToLookup(toAdd);
1475
+ Object.keys(toAdd).forEach((key) => {
1476
+ flags[key] = ADD_CLASS;
1477
+ });
1478
+
1479
+ toRemove = splitClassesToLookup(toRemove);
1480
+ Object.keys(toRemove).forEach((key) => {
1481
+ flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
1482
+ });
1483
+
1484
+ const classes = {
1485
+ addClass: "",
1486
+ removeClass: "",
1487
+ };
1488
+
1489
+ Object.entries(flags).forEach(([klass, val]) => {
1490
+ let prop, allow;
1491
+ if (val === ADD_CLASS) {
1492
+ prop = "addClass";
1493
+ allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
1494
+ } else if (val === REMOVE_CLASS) {
1495
+ prop = "removeClass";
1496
+ allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
1497
+ }
1498
+ if (allow) {
1499
+ if (classes[prop].length) {
1500
+ classes[prop] += " ";
1501
+ }
1502
+ classes[prop] += klass;
1503
+ }
1504
+ });
1505
+
1506
+ function splitClassesToLookup(classes) {
1507
+ if (isString(classes)) {
1508
+ classes = classes.trim().split(" ");
1509
+ }
1510
+
1511
+ const obj = {};
1512
+ if (classes) {
1513
+ classes.forEach((klass) => {
1514
+ // sometimes the split leaves empty string values
1515
+ // incase extra spaces were applied to the options
1516
+ if (klass.length) {
1517
+ obj[klass] = true;
1518
+ }
1519
+ });
1520
+ }
1521
+ return obj;
1522
+ }
1523
+
1524
+ return classes;
1525
+ }
1526
+
1527
+ function applyGeneratedPreparationClasses(element, event, options) {
1528
+ let classes = "";
1529
+ if (event) {
1530
+ classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
1531
+ }
1532
+ if (options.addClass) {
1533
+ classes = concatWithSpace(
1534
+ classes,
1535
+ pendClasses(options.addClass, ADD_CLASS_SUFFIX),
1536
+ );
1537
+ }
1538
+ if (options.removeClass) {
1539
+ classes = concatWithSpace(
1540
+ classes,
1541
+ pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX),
1542
+ );
1543
+ }
1544
+ if (classes.length) {
1545
+ options.preparationClasses = classes;
1546
+ element.className += ` ${classes}`;
1547
+ }
1548
+ }
1549
+
1550
+ function clearGeneratedClasses(element, options) {
1551
+ if (options.preparationClasses) {
1552
+ options.preparationClasses
1553
+ .split(" ")
1554
+ .forEach((cls) => element.classList.remove(cls));
1555
+ options.preparationClasses = null;
1556
+ }
1557
+ if (options.activeClasses) {
1558
+ options.activeClasses
1559
+ .split(" ")
1560
+ .forEach((cls) => element.classList.remove(cls));
1561
+ options.activeClasses = null;
1562
+ }
1563
+ }
1564
+
1565
+ function blockKeyframeAnimations(node, applyBlock) {
1566
+ const value = applyBlock ? "paused" : "";
1567
+ const key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
1568
+ applyInlineStyle(node, [key, value]);
1569
+ return [key, value];
1570
+ }
1571
+
1572
+ function applyInlineStyle(node, styleTuple) {
1573
+ const prop = styleTuple[0];
1574
+ node.style[prop] = styleTuple[1];
1575
+ }
1576
+
1577
+ function concatWithSpace(a, b) {
1578
+ if (!a) return b;
1579
+ if (!b) return a;
1580
+ return `${a} ${b}`;
1581
+ }
1582
+
1207
1583
  /** @type {number} */
1208
1584
  let jqId = 1;
1209
1585
 
@@ -1725,12 +2101,8 @@
1725
2101
  // from the dom sometime before this code runs then let's
1726
2102
  // just stick to using the parent element as the anchor
1727
2103
  if (afterElement) {
1728
- const afterNode = extractElementNode$1(afterElement);
1729
- if (
1730
- afterNode &&
1731
- !afterNode.parentNode &&
1732
- !afterNode.previousElementSibling
1733
- ) {
2104
+ const afterNode = extractElementNode(afterElement);
2105
+ if (afterNode && !afterNode.parentNode && !afterNode.previousSibling) {
1734
2106
  afterElement = null;
1735
2107
  }
1736
2108
  }
@@ -1741,16 +2113,6 @@
1741
2113
  }
1742
2114
  }
1743
2115
 
1744
- function extractElementNode$1(element) {
1745
- const { length } = element;
1746
- for (let i = 0; i < length; i++) {
1747
- const elm = element[i];
1748
- if (elm.nodeType === Node.ELEMENT_NODE) {
1749
- return elm;
1750
- }
1751
- }
1752
- }
1753
-
1754
2116
  /**
1755
2117
  * Returns the base href of the document.
1756
2118
  *
@@ -1869,7 +2231,7 @@
1869
2231
  /**
1870
2232
  * @param {string} name - Name of the module
1871
2233
  * @param {Array<string>} requires - List of modules which the injector will load before the current module
1872
- * @param {import("../../interface.js").Injectable<any>} [configFn]
2234
+ * @param {import("../../interface.ts").Injectable<any>} [configFn]
1873
2235
  */
1874
2236
  constructor(name, requires, configFn) {
1875
2237
  assert(isString(name), "name required");
@@ -1895,7 +2257,7 @@
1895
2257
  /** @type {!Array<Array<*>>} */
1896
2258
  this.configBlocks = [];
1897
2259
 
1898
- /** @type {!Array.<import("../../interface.js").Injectable<any>>} */
2260
+ /** @type {!Array.<import("../../interface.ts").Injectable<any>>} */
1899
2261
  this.runBlocks = [];
1900
2262
 
1901
2263
  if (configFn) {
@@ -1999,7 +2361,7 @@
1999
2361
 
2000
2362
  /**
2001
2363
  * @param {string} name
2002
- * @param {import("../../interface.js").Injectable<any>} decorFn
2364
+ * @param {import("../../interface.ts").Injectable<any>} decorFn
2003
2365
  * @returns {NgModule}
2004
2366
  */
2005
2367
  decorator(name, decorFn) {
@@ -2012,7 +2374,7 @@
2012
2374
 
2013
2375
  /**
2014
2376
  * @param {string} name
2015
- * @param {import("../../interface.js").Injectable<any>} directiveFactory
2377
+ * @param {import("../../interface.ts").Injectable<any>} directiveFactory
2016
2378
  * @returns {NgModule}
2017
2379
  */
2018
2380
  directive(name, directiveFactory) {
@@ -2029,7 +2391,7 @@
2029
2391
 
2030
2392
  /**
2031
2393
  * @param {string} name
2032
- * @param {import("../../interface.js").Injectable<any>} animationFactory
2394
+ * @param {import("../../interface.ts").Injectable<any>} animationFactory
2033
2395
  * @returns {NgModule}
2034
2396
  */
2035
2397
  animation(name, animationFactory) {
@@ -2046,7 +2408,7 @@
2046
2408
 
2047
2409
  /**
2048
2410
  * @param {string} name
2049
- * @param {import("../../interface.js").Injectable<any>} filterFn
2411
+ * @param {import("../../interface.ts").Injectable<any>} filterFn
2050
2412
  * @return {NgModule}
2051
2413
  */
2052
2414
  filter(name, filterFn) {
@@ -2059,7 +2421,7 @@
2059
2421
 
2060
2422
  /**
2061
2423
  * @param {string} name
2062
- * @param {import("../../interface.js").Injectable<any>} ctlFn
2424
+ * @param {import("../../interface.ts").Injectable<any>} ctlFn
2063
2425
  * @returns {NgModule}
2064
2426
  */
2065
2427
  controller(name, ctlFn) {
@@ -2444,7 +2806,7 @@
2444
2806
  * Registers a factory.
2445
2807
  * @param {string} name
2446
2808
  * @param {(string|(function(*): *))[]} factoryFn
2447
- * @returns {import('../../interface.js').ServiceProvider}
2809
+ * @returns {import('../../interface.ts').ServiceProvider}
2448
2810
  */
2449
2811
  function factory(name, factoryFn) {
2450
2812
  return provider(name, {
@@ -2466,7 +2828,7 @@
2466
2828
  * Registers a service constructor.
2467
2829
  * @param {string} name
2468
2830
  * @param {Function} constructor
2469
- * @returns {import('../../interface.js').ServiceProvider}
2831
+ * @returns {import('../../interface.ts').ServiceProvider}
2470
2832
  */
2471
2833
  function service(name, constructor) {
2472
2834
  return factory(name, [
@@ -2935,7 +3297,7 @@
2935
3297
 
2936
3298
  /**
2937
3299
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
2938
- * @returns {import("./interface.js").ControllerService} A service function that creates controllers.
3300
+ * @returns {import("./interface.ts").ControllerService} A service function that creates controllers.
2939
3301
  */
2940
3302
  ($injector) => {
2941
3303
  return (expression, locals, later, ident) => {
@@ -3053,18 +3415,19 @@
3053
3415
  );
3054
3416
  }
3055
3417
  locals.$scope[identifier] = instance;
3418
+ locals.$scope["$controllerIdentifier"] = identifier;
3056
3419
  }
3057
3420
  }
3058
3421
 
3059
3422
  const originUrl = urlResolve(window.location.href);
3060
3423
 
3061
3424
  /**
3062
- * @param {import("./interface.js").ResolvableUrl} url
3063
- * @return {import("./interface.js").ParsedUrl}
3425
+ * @param {import("./interface.ts").ResolvableUrl} url
3426
+ * @return {import("./interface.ts").ParsedUrl}
3064
3427
  */
3065
3428
  function urlResolve(url) {
3066
3429
  if (!isString(url))
3067
- return /** @type {import("./interface.js").ParsedUrl} */ (url);
3430
+ return /** @type {import("./interface.ts").ParsedUrl} */ (url);
3068
3431
 
3069
3432
  const urlParsingNode = new URL(
3070
3433
  /** @type {string} */ (url),
@@ -3096,7 +3459,7 @@
3096
3459
  * Parse a request URL and determine whether this is a same-origin request as the application
3097
3460
  * document.
3098
3461
  *
3099
- * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3462
+ * @param {import("./interface.ts").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
3100
3463
  * or a parsed URL object.
3101
3464
  * @returns {boolean} Whether the request is for the same origin as the application document.
3102
3465
  */
@@ -3110,7 +3473,7 @@
3110
3473
  * Note: The base URL is usually the same as the document location (`location.href`) but can
3111
3474
  * be overriden by using the `<base>` tag.
3112
3475
  *
3113
- * @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
3114
3477
  * or a parsed URL object.
3115
3478
  * @returns {boolean} Whether the URL is same-origin as the document base URL.
3116
3479
  */
@@ -3124,7 +3487,7 @@
3124
3487
  *
3125
3488
  * @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
3126
3489
  *
3127
- * @returns {(url: import("./interface.js").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
3490
+ * @returns {(url: import("./interface.ts").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
3128
3491
  * whether it is of an allowed origin.
3129
3492
  */
3130
3493
  function urlIsAllowedOriginFactory(trustedOriginUrls) {
@@ -3137,7 +3500,7 @@
3137
3500
  * based on a list of trusted-origin URLs. The current location's origin is implicitly
3138
3501
  * trusted.
3139
3502
  *
3140
- * @param {import("./interface.js").ResolvableUrl} requestUrl - The URL to be checked (provided as a string that will be
3503
+ * @param {import("./interface.ts").ResolvableUrl} requestUrl - The URL to be checked (provided as a string that will be
3141
3504
  * resolved or a parsed URL object).
3142
3505
  *
3143
3506
  * @returns {boolean} - Whether the specified URL is of an allowed origin.
@@ -3153,9 +3516,9 @@
3153
3516
  /**
3154
3517
  * Determine if two URLs share the same origin.
3155
3518
  *
3156
- * @param {import("./interface.js").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
3519
+ * @param {import("./interface.ts").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
3157
3520
  * a dictionary object returned by `urlResolve()`.
3158
- * @param {import("./interface.js").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
3521
+ * @param {import("./interface.ts").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
3159
3522
  * of a dictionary object returned by `urlResolve()`.
3160
3523
  *
3161
3524
  * @returns {boolean} - True if both URLs have the same origin, and false otherwise.
@@ -3789,7 +4152,7 @@
3789
4152
  *
3790
4153
  * @param {string} type The SCE context in which this result will be used.
3791
4154
  * @param {string} expr String expression to compile.
3792
- * @return {import("../../core/parse/interface.js").CompiledExpression} A function which represents the compiled expression:
4155
+ * @return {import("../../core/parse/interface.ts").CompiledExpression} A function which represents the compiled expression:
3793
4156
  *
3794
4157
  * * `context` – `{object}` – an object against which any expressions embedded in the
3795
4158
  * strings are evaluated against (typically a scope object).
@@ -4026,10 +4389,11 @@
4026
4389
  .forEach((eventName) => {
4027
4390
  const directiveName = directiveNormalize(`ng-${eventName}`);
4028
4391
  ngEventDirectives[directiveName] = [
4029
- "$parse",
4030
- "$exceptionHandler",
4392
+ $injectTokens.$parse,
4393
+ $injectTokens.$exceptionHandler,
4394
+
4031
4395
  /**
4032
- * @param {import("../../core/parse/interface.ts").ParseService} $parse
4396
+ * @param {ng.ParseService} $parse
4033
4397
  * @param {ng.ExceptionHandlerService} $exceptionHandler
4034
4398
  * @returns
4035
4399
  */
@@ -4062,14 +4426,58 @@
4062
4426
  restrict: "A",
4063
4427
  compile(_element, attr) {
4064
4428
  const fn = $parse(attr[directiveName]);
4065
- return function ngEventHandler(scope, element) {
4066
- element.addEventListener(eventName, (event) => {
4429
+ return (scope, element) => {
4430
+ const handler = (event) => {
4067
4431
  try {
4068
4432
  fn(scope, { $event: event });
4069
4433
  } catch (error) {
4070
4434
  $exceptionHandler(error);
4071
4435
  }
4072
- });
4436
+ };
4437
+ element.addEventListener(eventName, handler);
4438
+
4439
+ scope.$on("$destroy", () =>
4440
+ element.removeEventListener(eventName, handler),
4441
+ );
4442
+ };
4443
+ },
4444
+ };
4445
+ }
4446
+
4447
+ /**
4448
+ *
4449
+ * @param {ng.ParseService} $parse
4450
+ * @param {ng.ExceptionHandlerService} $exceptionHandler
4451
+ * @param {ng.WindowService} $window
4452
+ * @param {string} directiveName
4453
+ * @param {string} eventName
4454
+ * @returns {ng.Directive}
4455
+ */
4456
+ function createWindowEventDirective(
4457
+ $parse,
4458
+ $exceptionHandler,
4459
+ $window,
4460
+ directiveName,
4461
+ eventName,
4462
+ ) {
4463
+ return {
4464
+ restrict: "A",
4465
+ compile(_element, attr) {
4466
+ const fn = $parse(attr[directiveName]);
4467
+ return (scope) => {
4468
+ const handler = (event) => {
4469
+ try {
4470
+ fn(scope, { $event: event });
4471
+ } catch (error) {
4472
+ $exceptionHandler(error);
4473
+ }
4474
+ };
4475
+
4476
+ $window.addEventListener(eventName, handler);
4477
+
4478
+ scope.$on("$destroy", () =>
4479
+ $window.removeEventListener(eventName, handler),
4480
+ );
4073
4481
  };
4074
4482
  },
4075
4483
  };
@@ -4079,16 +4487,13 @@
4079
4487
  const SIMPLE_ATTR_NAME = /^\w/;
4080
4488
  const specialAttrHolder = document.createElement("div");
4081
4489
 
4082
- /**
4083
- * @implements {Record<string, any>}
4084
- */
4085
4490
  class Attributes {
4086
4491
  static $nonscope = true;
4087
4492
 
4088
4493
  /**
4089
- * @param {import('../scope/scope.js').Scope} $rootScope
4494
+ * @param {ng.Scope} $rootScope
4090
4495
  * @param {*} $animate
4091
- * @param {import("../../services/exception/exception-handler.js").ErrorHandler} $exceptionHandler
4496
+ * @param {ng.ExceptionHandlerService} $exceptionHandler
4092
4497
  * @param {*} $sce
4093
4498
  * @param {import("../../shared/noderef.js").NodeRef} [nodeRef]
4094
4499
  * @param {Object} [attributesToCopy]
@@ -4401,19 +4806,18 @@
4401
4806
  /**
4402
4807
  * @param {string} source - the name of the attribute to be observed
4403
4808
  * @param {string} prop - the scope property to be updated with attribute value
4404
- * @returns {import("../../interface.ts").Directive}
4809
+ * @returns {ng.Directive}
4405
4810
  */
4406
4811
  function ngObserveDirective(source, prop) {
4407
4812
  return {
4408
4813
  restrict: "A",
4409
4814
  compile: () => (scope, element) => {
4410
- const targetElement = element;
4411
4815
  if (prop === "") {
4412
4816
  prop = source;
4413
4817
  }
4414
4818
  const normalized = kebabToCamel(prop);
4415
4819
  if (!scope[normalized]) {
4416
- scope[normalized] = targetElement.getAttribute(source);
4820
+ scope[normalized] = element.getAttribute(source);
4417
4821
  }
4418
4822
 
4419
4823
  const observer = new MutationObserver((mutations) => {
@@ -4426,7 +4830,7 @@
4426
4830
  }
4427
4831
  });
4428
4832
 
4429
- observer.observe(targetElement, {
4833
+ observer.observe(element, {
4430
4834
  attributes: true,
4431
4835
  attributeFilter: [source],
4432
4836
  });
@@ -4438,91 +4842,6 @@
4438
4842
  };
4439
4843
  }
4440
4844
 
4441
- /**
4442
- * A function passed as the fifth argument to a {@type PublicLinkFn} link function.
4443
- * It behaves like a linking function, with the `scope` argument automatically created
4444
- * as a new child of the transcluded parent scope.
4445
- *
4446
- * The function returns the DOM content to be injected (transcluded) into the directive.
4447
- *
4448
- * @callback TranscludeFn
4449
- * @param {Element | Node | ChildNode | NodeList | Node[]} [clone] - The DOM node to be inserted into the transcluded directive.
4450
- * @param {import("../scope/scope.js").Scope} [scope] - The new child scope created from the transcluded parent.
4451
- * @returns void
4452
-
4453
- /**
4454
- * A specialized version of {@link TranscludeFn} with the scope argument already bound.
4455
- * This function requires no parameters and returns the same result as {@link TranscludeFn}.
4456
- *
4457
- * @typedef {() => Element|Node} BoundTranscludeFn
4458
- */
4459
-
4460
- /**
4461
- * @typedef {Object} SimpleChange
4462
- * @property {any} currentValue
4463
- * @property {boolean} firstChange
4464
- */
4465
-
4466
- /**
4467
- * @description A function returned by the '$compile' service that links a compiled template to a scope.
4468
- *
4469
- * @callback PublicLinkFn
4470
- * @param {import('../scope/scope.js').Scope} scope - Scope to link with element
4471
- * @param {TranscludeFn} [cloneConnectFn]
4472
- * @param {*} [options]
4473
- * @return {Element|Node|ChildNode|Node[]} The nodes to be linked.
4474
- */
4475
-
4476
- /**
4477
- * @description Entry point for the '$compile' service.
4478
- *
4479
- * @callback CompileFn
4480
- * @param {string|Element|Node|ChildNode|NodeList} compileNode - The node to be compiled.
4481
- * @param {TranscludeFn} [transcludeFn] - An optional transclusion function to be used during compilation.
4482
- * @param {number} [maxPriority] - An optional maximum priority for directives.
4483
- * @param {string} [ignoreDirective] - An optional directive to ignore during compilation.
4484
- * @param {*} [previousCompileContext] - An optional context from a previous compilation. TODO
4485
- * @returns {PublicLinkFn} A public link function.
4486
- */
4487
-
4488
- /**
4489
- * @typedef {Object} LinkFnMapping
4490
- * @property {number} index
4491
- * @property {NodeLinkFnCtx} [nodeLinkFnCtx]
4492
- * @property {CompositeLinkFn} [childLinkFn]
4493
- */
4494
-
4495
- /**
4496
- * @typedef {function(): CompositeLinkFn} CompileNodesFn
4497
- */
4498
-
4499
- /**
4500
- * @callback NodeLinkFn
4501
- * @returns {Node|Element|NodeList}
4502
- */
4503
-
4504
- /**
4505
- * @typedef {Object} NodeLinkFnCtx
4506
- * @property {NodeLinkFn} nodeLinkFn
4507
- * @property {boolean} terminal
4508
- * @property {TranscludeFn} transclude
4509
- * @property {boolean} transcludeOnThisElement
4510
- * @property {boolean} templateOnThisElement
4511
- * @property {boolean} newScope
4512
- */
4513
-
4514
- /**
4515
- * @typedef {function(): NodeLinkFn} ApplyDirectivesToNodeFn
4516
- */
4517
-
4518
- /**
4519
- * @description Function that aggregates all linking fns for a compilation root (nodeList)
4520
- * @callback CompositeLinkFn
4521
- * @param {import('../scope/scope.js').Scope} scope - The scope to be linked to the template
4522
- * @param {NodeRef} $linkNode - wrapper around a nodeList
4523
- * @param {Function} [parentBoundTranscludeFn]
4524
- */
4525
-
4526
4845
  const $compileMinErr = minErr("$compile");
4527
4846
  const EXCLUDED_DIRECTIVES = ["ngIf", "ngRepeat"];
4528
4847
  const ALL_OR_NOTHING_ATTRS = ["ngSrc", "ngSrcset", "src", "srcset"];
@@ -4537,7 +4856,7 @@
4537
4856
  /* @ignore */ static $inject = [$injectTokens.$provide, $injectTokens.$$sanitizeUriProvider];
4538
4857
 
4539
4858
  /**
4540
- * @param {import('../../interface.js').Provider} $provide
4859
+ * @param {import('../../interface.ts').Provider} $provide
4541
4860
  * @param {import('../sanitize/sanitize-uri.js').SanitizeUriProvider} $$sanitizeUriProvider
4542
4861
  */
4543
4862
  constructor($provide, $$sanitizeUriProvider) {
@@ -4546,7 +4865,6 @@
4546
4865
  const bindingCache = Object.create(null);
4547
4866
 
4548
4867
  /**
4549
- *
4550
4868
  * @param {import("../scope/scope.js").Scope} scope
4551
4869
  * @param {string} directiveName
4552
4870
  * @param {boolean} isController
@@ -4728,7 +5046,7 @@
4728
5046
  /**
4729
5047
  * @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
4730
5048
  * or an object map of components where the keys are the names and the values are the component definition objects.
4731
- * @param {import("../../interface.js").Component} options Component definition object (a simplified
5049
+ * @param {import("../../interface.ts").Component} options Component definition object (a simplified
4732
5050
  * {directive definition object}),
4733
5051
  * with the following properties (all optional):
4734
5052
  *
@@ -5059,12 +5377,11 @@
5059
5377
  ? (x) => x
5060
5378
  : (x) => x.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
5061
5379
 
5062
- const NG_PREFIX_BINDING = /^ng(Attr|Prop|On|Observe)([A-Z].*)$/;
5380
+ const NG_PREFIX_BINDING = /^ng(Attr|Prop|On|Observe|Window)([A-Z].*)$/;
5063
5381
  return compile;
5064
5382
 
5065
- //= ===============================
5066
5383
  /**
5067
- * @type {CompileFn}
5384
+ * @type {ng.CompileService}
5068
5385
  */
5069
5386
  function compile(
5070
5387
  element,
@@ -5078,7 +5395,7 @@
5078
5395
  /**
5079
5396
  * The composite link function is a composite of individual node linking functions.
5080
5397
  * It will be invoke by the public link function below.
5081
- * @type {CompositeLinkFn}
5398
+ * @type {ng.CompositeLinkFn}
5082
5399
  */
5083
5400
  let compositeLinkFn = compileNodes(
5084
5401
  nodeRef,
@@ -5091,7 +5408,7 @@
5091
5408
  let namespace = null;
5092
5409
  return publicLinkFn;
5093
5410
 
5094
- /** @type {PublicLinkFn} */
5411
+ /** @type {ng.PublicLinkFn} */
5095
5412
  function publicLinkFn(scope, cloneConnectFn, options) {
5096
5413
  if (!nodeRef) {
5097
5414
  throw $compileMinErr(
@@ -5213,7 +5530,7 @@
5213
5530
  * @param {number=} [maxPriority] Max directive priority.
5214
5531
  * @param {*} [ignoreDirective]
5215
5532
  * @param {*} [previousCompileContext]
5216
- * @returns {CompositeLinkFn} A composite linking function of all of the matched directives or null.
5533
+ * @returns {ng.CompositeLinkFn} A composite linking function of all of the matched directives or null.
5217
5534
  */
5218
5535
  function compileNodes(
5219
5536
  nodeRefList,
@@ -5226,7 +5543,7 @@
5226
5543
  * Aggregates for the composite linking function, where a node in a node list is mapped
5227
5544
  * to a corresponding link function. For single elements, the node should be mapped to
5228
5545
  * a single node link function.
5229
- * @type {LinkFnMapping[]}
5546
+ * @type {ng.LinkFnMapping[]}
5230
5547
  */
5231
5548
  const linkFnsList = []; // An array to hold node indices and their linkFns
5232
5549
  let nodeLinkFnFound;
@@ -5246,7 +5563,7 @@
5246
5563
  ignoreDirective,
5247
5564
  );
5248
5565
 
5249
- /** @type {NodeLinkFnCtx} */
5566
+ /** @type {ng.NodeLinkFnCtx} */
5250
5567
  let nodeLinkFnCtx;
5251
5568
 
5252
5569
  if (directives.length) {
@@ -5393,10 +5710,10 @@
5393
5710
 
5394
5711
  /**
5395
5712
  * Prebinds the transclusion function to a scope
5396
- * @param {import("../scope/scope.js").Scope} scope
5713
+ * @param {ng.Scope} scope
5397
5714
  * @param {*} transcludeFn
5398
5715
  * @param {*} previousBoundTranscludeFn
5399
- * @returns {BoundTranscludeFn}
5716
+ * @returns {ng.BoundTranscludeFn}
5400
5717
  */
5401
5718
  function createBoundTranscludeFn(
5402
5719
  scope,
@@ -5454,7 +5771,7 @@
5454
5771
  */
5455
5772
  function collectDirectives(node, attrs, maxPriority, ignoreDirective) {
5456
5773
  /**
5457
- * @type {import('../../interface.ts').Directive[]}
5774
+ * @type {ng.Directive[]}
5458
5775
  */
5459
5776
  const directives = [];
5460
5777
  const { nodeType } = node;
@@ -5480,6 +5797,7 @@
5480
5797
  let isNgProp = false;
5481
5798
  let isNgEvent = false;
5482
5799
  let isNgObserve = false;
5800
+ let isWindow = false;
5483
5801
 
5484
5802
  let attr = node.attributes[j];
5485
5803
  let name = attr.name;
@@ -5493,6 +5811,7 @@
5493
5811
  isNgProp = ngPrefixMatch[1] === "Prop";
5494
5812
  isNgEvent = ngPrefixMatch[1] === "On";
5495
5813
  isNgObserve = ngPrefixMatch[1] === "Observe";
5814
+ isWindow = ngPrefixMatch[1] === "Window";
5496
5815
 
5497
5816
  // Normalize the non-prefixed name
5498
5817
  name = name
@@ -5502,13 +5821,13 @@
5502
5821
  .replace(/_(.)/g, (match, letter) => letter.toUpperCase());
5503
5822
  }
5504
5823
 
5505
- if (isNgProp || isNgEvent) {
5824
+ if (isNgProp || isNgEvent || isWindow) {
5506
5825
  attrs[nName] = value;
5507
5826
  attrsMap[nName] = attr.name;
5508
5827
 
5509
5828
  if (isNgProp) {
5510
5829
  addPropertyDirective(node, directives, nName, name);
5511
- } else {
5830
+ } else if (isNgEvent) {
5512
5831
  directives.push(
5513
5832
  createEventDirective(
5514
5833
  $parse,
@@ -5517,6 +5836,17 @@
5517
5836
  name,
5518
5837
  ),
5519
5838
  );
5839
+ } else {
5840
+ // isWindow
5841
+ directives.push(
5842
+ createWindowEventDirective(
5843
+ $parse,
5844
+ $exceptionHandler,
5845
+ window,
5846
+ nName,
5847
+ name,
5848
+ ),
5849
+ );
5520
5850
  }
5521
5851
  } else if (isNgObserve) {
5522
5852
  directives.push(ngObserveDirective(name, value));
@@ -5575,7 +5905,7 @@
5575
5905
  * @param maxPriority
5576
5906
  * @param ignoreDirective
5577
5907
  * @param previousCompileContext
5578
- * @returns {PublicLinkFn|TranscludeFn}
5908
+ * @returns {ng.PublicLinkFn|ng.TranscludeFn}
5579
5909
  */
5580
5910
  function compilationGenerator(
5581
5911
  eager,
@@ -5622,14 +5952,14 @@
5622
5952
  * this needs to be pre-sorted by priority order.
5623
5953
  * @param {Node | Element} compileNode DOM node to apply the compile functions to
5624
5954
  * @param {Attributes} templateAttrs The shared attribute function
5625
- * @param {TranscludeFn} transcludeFn
5955
+ * @param {ng.TranscludeFn} transcludeFn
5626
5956
  * @param {Object=} originalReplaceDirective An optional directive that will be ignored when
5627
5957
  * compiling the transclusion.
5628
5958
  * @param {Array.<Function>} [preLinkFns]
5629
5959
  * @param {Array.<Function>} [postLinkFns]
5630
5960
  * @param {Object} [previousCompileContext] Context used for previous compilation of the current
5631
5961
  * node
5632
- * @returns {NodeLinkFnCtx} node link function
5962
+ * @returns {ng.NodeLinkFnCtx} node link function
5633
5963
  */
5634
5964
  function applyDirectivesToNode(
5635
5965
  directives,
@@ -5664,7 +5994,7 @@
5664
5994
  let directiveName;
5665
5995
  let $template;
5666
5996
  let replaceDirective = originalReplaceDirective;
5667
- /** @type {TranscludeFn} */
5997
+ /** @type {ng.TranscludeFn} */
5668
5998
  let childTranscludeFn = transcludeFn;
5669
5999
 
5670
6000
  let didScanForMultipleTransclusion = false;
@@ -5673,7 +6003,7 @@
5673
6003
 
5674
6004
  /**
5675
6005
  * Links all the directives of a single node.
5676
- * @type {NodeLinkFn}
6006
+ * @type {ng.NodeLinkFn}
5677
6007
  */
5678
6008
  // @ts-ignore
5679
6009
  let nodeLinkFn = function (
@@ -6355,7 +6685,7 @@
6355
6685
  ii = directives.length;
6356
6686
  } else if (directive.compile) {
6357
6687
  try {
6358
- /** @type {PublicLinkFn} */
6688
+ /** @type {ng.PublicLinkFn} */
6359
6689
  const linkFn = directive.compile(
6360
6690
  compileNodeRef.getAny(),
6361
6691
  templateAttrs,
@@ -7371,7 +7701,7 @@
7371
7701
  }
7372
7702
 
7373
7703
  /**
7374
- * @type {SimpleChange}
7704
+ * @type {import("./inteface.ts").SimpleChange}
7375
7705
  */
7376
7706
  initialChanges[scopeName] = {
7377
7707
  currentValue: destination[scopeName],
@@ -7497,7 +7827,7 @@
7497
7827
  scope.$handler.watchers
7498
7828
  .get(attrs[attrName])
7499
7829
  ?.forEach((watchFn) => {
7500
- watchFn.listenerFn(val);
7830
+ watchFn.listenerFn(val, scope.$target);
7501
7831
  });
7502
7832
  }
7503
7833
  }
@@ -7524,7 +7854,7 @@
7524
7854
  parentGet = $parse(attrs[attrName]);
7525
7855
 
7526
7856
  destination.$target[scopeName] = parentGet(scope.$target);
7527
- /** @type {SimpleChange} */
7857
+ /** @type {import("./inteface.ts").SimpleChange} */
7528
7858
  initialChanges[scopeName] = {
7529
7859
  currentValue: destination.$target[scopeName],
7530
7860
  firstChange: firstChange,
@@ -7910,8 +8240,14 @@
7910
8240
  * state (ng-dirty class). This method will also propagate to parent forms.
7911
8241
  */
7912
8242
  $setDirty() {
7913
- this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
7914
- this.$$animate.addClass(this.$$element, DIRTY_CLASS);
8243
+ if (hasAnimate(this.$$element)) {
8244
+ this.$$animate.removeClass(this.$$element, PRISTINE_CLASS);
8245
+ this.$$animate.addClass(this.$$element, DIRTY_CLASS);
8246
+ } else {
8247
+ // Fallback for non-animated environments
8248
+ this.$$element.classList.remove(PRISTINE_CLASS);
8249
+ this.$$element.classList.add(DIRTY_CLASS);
8250
+ }
7915
8251
  this.$dirty = true;
7916
8252
  this.$pristine = false;
7917
8253
  this.$$parentForm.$setDirty();
@@ -7930,11 +8266,18 @@
7930
8266
  * saving or resetting it.
7931
8267
  */
7932
8268
  $setPristine() {
7933
- this.$$animate.setClass(
7934
- this.$$element,
7935
- PRISTINE_CLASS,
7936
- `${DIRTY_CLASS} ${SUBMITTED_CLASS}`,
7937
- );
8269
+ if (hasAnimate(this.$$element)) {
8270
+ this.$$animate.setClass(
8271
+ this.$$element,
8272
+ PRISTINE_CLASS,
8273
+ `${DIRTY_CLASS} ${SUBMITTED_CLASS}`,
8274
+ );
8275
+ } else {
8276
+ // Fallback for non-animated environments
8277
+ this.$$element.classList.remove(DIRTY_CLASS, SUBMITTED_CLASS);
8278
+ this.$$element.classList.add(PRISTINE_CLASS);
8279
+ }
8280
+
7938
8281
  this.$dirty = false;
7939
8282
  this.$pristine = true;
7940
8283
  this.$submitted = false;
@@ -7972,7 +8315,11 @@
7972
8315
  }
7973
8316
 
7974
8317
  $$setSubmitted() {
7975
- this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
8318
+ if (hasAnimate(this.$$element)) {
8319
+ this.$$animate.addClass(this.$$element, SUBMITTED_CLASS);
8320
+ } else {
8321
+ this.$$element.classList.add(SUBMITTED_CLASS);
8322
+ }
7976
8323
  this.$submitted = true;
7977
8324
  this.$$controls.forEach((control) => {
7978
8325
  if (control.$$setSubmitted) {
@@ -11492,7 +11839,7 @@
11492
11839
  const ngClassEvenDirective = classDirective("Even", 1);
11493
11840
 
11494
11841
  /**
11495
- * @returns {import('../../interface.ts').Directive}
11842
+ * @returns {ng.Directive}
11496
11843
  */
11497
11844
  function ngCloakDirective() {
11498
11845
  return {
@@ -11582,7 +11929,7 @@
11582
11929
  ngIfDirective.$inject = ["$animate"];
11583
11930
  /**
11584
11931
  * @param {*} $animate
11585
- * @returns {import("../../interface.ts").Directive}
11932
+ * @returns {ng.Directive}
11586
11933
  */
11587
11934
  function ngIfDirective($animate) {
11588
11935
  return {
@@ -11592,10 +11939,10 @@
11592
11939
  restrict: "A",
11593
11940
  /**
11594
11941
  *
11595
- * @param {import("../../core/scope/scope.js").Scope} $scope
11942
+ * @param {ng.Scope} $scope
11596
11943
  * @param {Element} $element
11597
- * @param {import("../../core/compile/attributes.js").Attributes} $attr
11598
- * @param {Object} _ctrl
11944
+ * @param {ng.Attributes} $attr
11945
+ * @param {*} _ctrl
11599
11946
  * @param {*} $transclude
11600
11947
  */
11601
11948
  link($scope, $element, $attr, _ctrl, $transclude) {
@@ -11607,7 +11954,7 @@
11607
11954
 
11608
11955
  let previousElements;
11609
11956
 
11610
- $scope.$watch($attr["ngIf"], (value) => {
11957
+ $scope.$watch($attr.ngIf, (value) => {
11611
11958
  if (value) {
11612
11959
  if (!childScope) {
11613
11960
  $transclude((clone, newScope) => {
@@ -11662,7 +12009,7 @@
11662
12009
  * @param {import("../../services/anchor-scroll/anchor-scroll.js").AnchorScrollFunction} $anchorScroll
11663
12010
  * @param {*} $animate
11664
12011
  * @param {import('../../services/exception/interface.ts').ErrorHandler} $exceptionHandler
11665
- * @returns {import('../../interface.js').Directive}
12012
+ * @returns {import('../../interface.ts').Directive}
11666
12013
  */
11667
12014
  function ngIncludeDirective(
11668
12015
  $templateRequest,
@@ -11783,7 +12130,7 @@
11783
12130
  ngIncludeFillContentDirective.$inject = [$injectTokens.$compile];
11784
12131
 
11785
12132
  /**
11786
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
12133
+ * @param {ng.CompileService} $compile
11787
12134
  * @returns {import("../../interface.ts").Directive}
11788
12135
  */
11789
12136
  function ngIncludeFillContentDirective($compile) {
@@ -12414,7 +12761,7 @@
12414
12761
  ngOptionsDirective.$inject = ["$compile", "$parse"];
12415
12762
  /**
12416
12763
  *
12417
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
12764
+ * @param {ng.CompileService} $compile
12418
12765
  * @param {import("../../core/parse/interface.ts").ParseService} $parse
12419
12766
  * @returns {import("../../interface.ts").Directive}
12420
12767
  */
@@ -12941,8 +13288,8 @@
12941
13288
 
12942
13289
  ngTranscludeDirective.$inject = ["$compile"];
12943
13290
  /**
12944
- * @param {import("../../core/compile/compile.js").CompileFn} $compile
12945
- * @returns {import("../../interface.ts").Directive}
13291
+ * @param {ng.CompileService} $compile
13292
+ * @returns {ng.Directive}
12946
13293
  */
12947
13294
  function ngTranscludeDirective($compile) {
12948
13295
  return {
@@ -12953,9 +13300,9 @@
12953
13300
 
12954
13301
  /**
12955
13302
  *
12956
- * @param {import("../../core/scope/scope.js").Scope} $scope
13303
+ * @param {ng.Scope} $scope
12957
13304
  * @param {Element} $element
12958
- * @param {import("../../core/compile/attributes.js").Attributes} $attrs
13305
+ * @param {ng.Attributes} $attrs
12959
13306
  * @param {*} _controller
12960
13307
  * @param {*} $transclude
12961
13308
  */
@@ -13044,7 +13391,7 @@
13044
13391
  const REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
13045
13392
 
13046
13393
  /**
13047
- * @type {Record<string, import("../../interface.js").DirectiveFactory>}
13394
+ * @type {Record<string, import("../../interface.ts").DirectiveFactory>}
13048
13395
  */
13049
13396
  const ngAttributeAliasDirectives = {};
13050
13397
 
@@ -13617,364 +13964,6 @@
13617
13964
  ];
13618
13965
  }
13619
13966
 
13620
- /**
13621
- * @readonly
13622
- * @enum {number}
13623
- */
13624
- const ASTType = {
13625
- Program: 1,
13626
- ExpressionStatement: 2,
13627
- AssignmentExpression: 3,
13628
- ConditionalExpression: 4,
13629
- LogicalExpression: 5,
13630
- BinaryExpression: 6,
13631
- UnaryExpression: 7,
13632
- CallExpression: 8,
13633
- MemberExpression: 9,
13634
- Identifier: 10,
13635
- Literal: 11,
13636
- ArrayExpression: 12,
13637
- Property: 13,
13638
- ObjectExpression: 14,
13639
- ThisExpression: 15,
13640
- LocalsExpression: 16,
13641
- NGValueParameter: 17,
13642
- };
13643
-
13644
- const ADD_CLASS_SUFFIX = "-add";
13645
- const REMOVE_CLASS_SUFFIX = "-remove";
13646
- const EVENT_CLASS_PREFIX = "ng-";
13647
- const ACTIVE_CLASS_SUFFIX = "-active";
13648
- const PREPARE_CLASS_SUFFIX = "-prepare";
13649
-
13650
- const NG_ANIMATE_CLASSNAME = "ng-animate";
13651
- const NG_ANIMATE_CHILDREN_DATA = "$$ngAnimateChildren";
13652
- let TRANSITION_PROP;
13653
- let TRANSITIONEND_EVENT;
13654
- let ANIMATION_PROP;
13655
- let ANIMATIONEND_EVENT;
13656
-
13657
- // If unprefixed events are not supported but webkit-prefixed are, use the latter.
13658
- // Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
13659
- // Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
13660
- // but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
13661
- // Register both events in case `window.onanimationend` is not supported because of that,
13662
- // do the same for `transitionend` as Safari is likely to exhibit similar behavior.
13663
- // Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
13664
- // therefore there is no reason to test anymore for other vendor prefixes:
13665
- // http://caniuse.com/#search=transition
13666
- if (
13667
- window.ontransitionend === undefined &&
13668
- window.onwebkittransitionend !== undefined
13669
- ) {
13670
- TRANSITION_PROP = "WebkitTransition";
13671
- TRANSITIONEND_EVENT = "webkitTransitionEnd transitionend";
13672
- } else {
13673
- TRANSITION_PROP = "transition";
13674
- TRANSITIONEND_EVENT = "transitionend";
13675
- }
13676
-
13677
- if (
13678
- window.onanimationend === undefined &&
13679
- window.onwebkitanimationend !== undefined
13680
- ) {
13681
- ANIMATION_PROP = "WebkitAnimation";
13682
- ANIMATIONEND_EVENT = "webkitAnimationEnd animationend";
13683
- } else {
13684
- ANIMATION_PROP = "animation";
13685
- ANIMATIONEND_EVENT = "animationend";
13686
- }
13687
-
13688
- const DURATION_KEY = "Duration";
13689
- const PROPERTY_KEY = ASTType.Property;
13690
- const DELAY_KEY = "Delay";
13691
- const TIMING_KEY = "TimingFunction";
13692
- const ANIMATION_ITERATION_COUNT_KEY = "IterationCount";
13693
- const ANIMATION_PLAYSTATE_KEY = "PlayState";
13694
- const SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
13695
-
13696
- const ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
13697
- const ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
13698
- const TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
13699
- const TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
13700
-
13701
- const ngMinErr$1 = minErr("ng");
13702
- function assertArg(arg, name, reason) {
13703
- if (!arg) {
13704
- throw ngMinErr$1(
13705
- "areq",
13706
- "Argument '{0}' is {1}",
13707
- name || "?",
13708
- reason,
13709
- );
13710
- }
13711
- return arg;
13712
- }
13713
-
13714
- function packageStyles(options) {
13715
- const styles = {};
13716
- if (options && (options.to || options.from)) {
13717
- styles.to = options.to;
13718
- styles.from = options.from;
13719
- }
13720
- return styles;
13721
- }
13722
-
13723
- function pendClasses(classes, fix, isPrefix) {
13724
- let className = "";
13725
-
13726
- classes = Array.isArray(classes)
13727
- ? classes
13728
- : classes && isString(classes) && classes.length
13729
- ? classes.split(/\s+/)
13730
- : [];
13731
- classes.forEach((klass, i) => {
13732
- if (klass && klass.length > 0) {
13733
- className += i > 0 ? " " : "";
13734
- className += isPrefix ? fix + klass : klass + fix;
13735
- }
13736
- });
13737
- return className;
13738
- }
13739
-
13740
- function removeFromArray(arr, val) {
13741
- const index = arr.indexOf(val);
13742
- if (val >= 0) {
13743
- arr.splice(index, 1);
13744
- }
13745
- }
13746
-
13747
- /**
13748
- *
13749
- * @param {NodeList|Node} element
13750
- * @returns {Node[]|Node|undefined}
13751
- */
13752
- function stripCommentsFromElement(element) {
13753
- if (element instanceof NodeList) {
13754
- return Array.from(element).filter((x) => x.nodeType == Node.ELEMENT_NODE);
13755
- } else if (element.nodeType === Node.ELEMENT_NODE) {
13756
- return /** @type {Node} */ (element);
13757
- } else {
13758
- return undefined;
13759
- }
13760
- }
13761
-
13762
- /**
13763
- * @param {NodeList|Node} element
13764
- * @returns {Node}
13765
- */
13766
- function extractElementNode(element) {
13767
- if (!element) return /** @type {Node} */ (element);
13768
- for (let i = 0; i < /** @type {NodeList} */ (element).length; i++) {
13769
- const elm = element[i];
13770
- if (elm.nodeType === Node.ELEMENT_NODE) {
13771
- return elm;
13772
- }
13773
- }
13774
- }
13775
-
13776
- function applyAnimationClassesFactory() {
13777
- return function (element, options) {
13778
- if (options.addClass) {
13779
- element.classList.add(...options.addClass.trim().split(" "));
13780
- options.addClass = null;
13781
- }
13782
- if (options.removeClass) {
13783
- element.classList.remove(...options.removeClass.trim().split(" "));
13784
- options.removeClass = null;
13785
- }
13786
- };
13787
- }
13788
-
13789
- function prepareAnimationOptions(options) {
13790
- options = options || {};
13791
- if (!options.$$prepared) {
13792
- let domOperation = options.domOperation || (() => {});
13793
- options.domOperation = function () {
13794
- options.$$domOperationFired = true;
13795
- domOperation();
13796
- domOperation = () => {};
13797
- };
13798
- options.$$prepared = true;
13799
- }
13800
- return options;
13801
- }
13802
-
13803
- function applyAnimationStyles(element, options) {
13804
- applyAnimationFromStyles(element, options);
13805
- applyAnimationToStyles(element, options);
13806
- }
13807
-
13808
- function applyAnimationFromStyles(element, options) {
13809
- if (options.from) {
13810
- //element.css(options.from);
13811
- options.from = null;
13812
- }
13813
- }
13814
-
13815
- function applyAnimationToStyles(element, options) {
13816
- if (options.to) {
13817
- //element.css(options.to);
13818
- options.to = null;
13819
- }
13820
- }
13821
-
13822
- function mergeAnimationDetails(element, oldAnimation, newAnimation) {
13823
- const target = oldAnimation.options || {};
13824
- const newOptions = newAnimation.options || {};
13825
-
13826
- const toAdd = `${target.addClass || ""} ${newOptions.addClass || ""}`;
13827
- const toRemove = `${target.removeClass || ""} ${newOptions.removeClass || ""}`;
13828
- const classes = resolveElementClasses(
13829
- element.getAttribute("class"),
13830
- toAdd,
13831
- toRemove,
13832
- );
13833
-
13834
- if (newOptions.preparationClasses) {
13835
- target.preparationClasses = concatWithSpace(
13836
- newOptions.preparationClasses,
13837
- target.preparationClasses,
13838
- );
13839
- delete newOptions.preparationClasses;
13840
- }
13841
-
13842
- extend(target, newOptions);
13843
-
13844
- if (classes.addClass) {
13845
- target.addClass = classes.addClass;
13846
- } else {
13847
- target.addClass = null;
13848
- }
13849
-
13850
- if (classes.removeClass) {
13851
- target.removeClass = classes.removeClass;
13852
- } else {
13853
- target.removeClass = null;
13854
- }
13855
-
13856
- oldAnimation.addClass = target.addClass;
13857
- oldAnimation.removeClass = target.removeClass;
13858
-
13859
- return target;
13860
- }
13861
-
13862
- function resolveElementClasses(existing, toAdd, toRemove) {
13863
- const ADD_CLASS = 1;
13864
- const REMOVE_CLASS = -1;
13865
-
13866
- const flags = {};
13867
- existing = splitClassesToLookup(existing);
13868
-
13869
- toAdd = splitClassesToLookup(toAdd);
13870
- Object.keys(toAdd).forEach((key) => {
13871
- flags[key] = ADD_CLASS;
13872
- });
13873
-
13874
- toRemove = splitClassesToLookup(toRemove);
13875
- Object.keys(toRemove).forEach((key) => {
13876
- flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
13877
- });
13878
-
13879
- const classes = {
13880
- addClass: "",
13881
- removeClass: "",
13882
- };
13883
-
13884
- Object.entries(flags).forEach(([klass, val]) => {
13885
- let prop, allow;
13886
- if (val === ADD_CLASS) {
13887
- prop = "addClass";
13888
- allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
13889
- } else if (val === REMOVE_CLASS) {
13890
- prop = "removeClass";
13891
- allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
13892
- }
13893
- if (allow) {
13894
- if (classes[prop].length) {
13895
- classes[prop] += " ";
13896
- }
13897
- classes[prop] += klass;
13898
- }
13899
- });
13900
-
13901
- function splitClassesToLookup(classes) {
13902
- if (isString(classes)) {
13903
- classes = classes.trim().split(" ");
13904
- }
13905
-
13906
- const obj = {};
13907
- if (classes) {
13908
- classes.forEach((klass) => {
13909
- // sometimes the split leaves empty string values
13910
- // incase extra spaces were applied to the options
13911
- if (klass.length) {
13912
- obj[klass] = true;
13913
- }
13914
- });
13915
- }
13916
- return obj;
13917
- }
13918
-
13919
- return classes;
13920
- }
13921
-
13922
- function applyGeneratedPreparationClasses(element, event, options) {
13923
- let classes = "";
13924
- if (event) {
13925
- classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
13926
- }
13927
- if (options.addClass) {
13928
- classes = concatWithSpace(
13929
- classes,
13930
- pendClasses(options.addClass, ADD_CLASS_SUFFIX),
13931
- );
13932
- }
13933
- if (options.removeClass) {
13934
- classes = concatWithSpace(
13935
- classes,
13936
- pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX),
13937
- );
13938
- }
13939
- if (classes.length) {
13940
- options.preparationClasses = classes;
13941
- element.className += ` ${classes}`;
13942
- }
13943
- }
13944
-
13945
- function clearGeneratedClasses(element, options) {
13946
- if (options.preparationClasses) {
13947
- options.preparationClasses
13948
- .split(" ")
13949
- .forEach((cls) => element.classList.remove(cls));
13950
- options.preparationClasses = null;
13951
- }
13952
- if (options.activeClasses) {
13953
- options.activeClasses
13954
- .split(" ")
13955
- .forEach((cls) => element.classList.remove(cls));
13956
- options.activeClasses = null;
13957
- }
13958
- }
13959
-
13960
- function blockKeyframeAnimations(node, applyBlock) {
13961
- const value = applyBlock ? "paused" : "";
13962
- const key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
13963
- applyInlineStyle(node, [key, value]);
13964
- return [key, value];
13965
- }
13966
-
13967
- function applyInlineStyle(node, styleTuple) {
13968
- const prop = styleTuple[0];
13969
- node.style[prop] = styleTuple[1];
13970
- }
13971
-
13972
- function concatWithSpace(a, b) {
13973
- if (!a) return b;
13974
- if (!b) return a;
13975
- return `${a} ${b}`;
13976
- }
13977
-
13978
13967
  /** @typedef {"enter"|"leave"|"move"|"addClass"|"setClass"|"removeClass"} AnimationMethod */
13979
13968
 
13980
13969
  /**
@@ -14362,7 +14351,7 @@
14362
14351
  *
14363
14352
  * @param {Element} element - the element which will be inserted into the DOM
14364
14353
  * @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
14365
- * @param {Element} after - after the sibling element after which the element will be appended
14354
+ * @param {Element} [after] - after the sibling element after which the element will be appended
14366
14355
  * @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
14367
14356
  * @returns {import('./animate-runner.js').AnimateRunner} the animation runner
14368
14357
  */
@@ -17840,7 +17829,7 @@
17840
17829
  return concat.join("");
17841
17830
  };
17842
17831
 
17843
- return /**@type {import("./interface.js").InterpolationFunction} */ extend(
17832
+ return /**@type {import("./interface.ts").InterpolationFunction} */ extend(
17844
17833
  (context, cb) => {
17845
17834
  let i = 0;
17846
17835
  const ii = expressions.length;
@@ -19508,7 +19497,7 @@
19508
19497
  /**
19509
19498
  * Registers a callback to be called when the URL changes.
19510
19499
  *
19511
- * @param {import("./interface.js").UrlChangeListener} callback - The callback function to register.
19500
+ * @param {import("./interface.ts").UrlChangeListener} callback - The callback function to register.
19512
19501
  * @returns void
19513
19502
  */
19514
19503
  #onUrlChange(callback) {
@@ -20101,16 +20090,9 @@
20101
20090
  */
20102
20091
  let $parse;
20103
20092
 
20104
- /**@type {import('../../services/exception/exception-handler.js').ErrorHandler} */
20093
+ /**@type {ng.ExceptionHandlerService} */
20105
20094
  let $exceptionHandler;
20106
20095
 
20107
- /**
20108
- * @typedef {Object} AsyncQueueTask
20109
- * @property {Scope} handler
20110
- * @property {Function} fn
20111
- * @property {Object} locals
20112
- */
20113
-
20114
20096
  const $postUpdateQueue = [];
20115
20097
 
20116
20098
  class RootScopeProvider {
@@ -20119,11 +20101,11 @@
20119
20101
  }
20120
20102
 
20121
20103
  $get = [
20122
- "$exceptionHandler",
20123
- "$parse",
20104
+ $injectTokens.$exceptionHandler,
20105
+ $injectTokens.$parse,
20124
20106
  /**
20125
- * @param {import('../../services/exception/exception-handler.js').ErrorHandler} exceptionHandler
20126
- * @param {import('../parse/interface.ts').ParseService} parse
20107
+ * @param {ng.ExceptionHandlerService} exceptionHandler
20108
+ * @param {ng.ParseService} parse
20127
20109
  */
20128
20110
  (exceptionHandler, parse) => {
20129
20111
  $exceptionHandler = exceptionHandler;
@@ -20180,27 +20162,6 @@
20180
20162
  }
20181
20163
  }
20182
20164
 
20183
- /**
20184
- * Listener function definition.
20185
- * @typedef {Object} Listener
20186
- * @property {Object} originalTarget - The original target object.
20187
- * @property {ListenerFunction} listenerFn - The function invoked when changes are detected.
20188
- * @property {import("../parse/interface.ts").CompiledExpression} watchFn
20189
- * @property {number} id - Deregistration id
20190
- * @property {number} scopeId - The scope that created the Listener
20191
- * @property {string[]} property
20192
- * @property {string} [watchProp] - The original property to watch if different from observed key
20193
- * @property {Proxy} [foreignListener]
20194
- *
20195
- */
20196
-
20197
- /**
20198
- * Listener function type.
20199
- * @callback ListenerFunction
20200
- * @param {*} newValue - The new value of the changed property.
20201
- * @param {Object} originalTarget - The original target object.
20202
- */
20203
-
20204
20165
  /**
20205
20166
  * Decorator for excluding objects from scope observability
20206
20167
  */
@@ -20226,13 +20187,13 @@
20226
20187
  : context
20227
20188
  : undefined;
20228
20189
 
20229
- /** @type {Map<string, Array<Listener>>} Watch listeners */
20190
+ /** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners */
20230
20191
  this.watchers = context ? context.watchers : new Map();
20231
20192
 
20232
20193
  /** @type {Map<String, Function[]>} Event listeners */
20233
20194
  this.$$listeners = new Map();
20234
20195
 
20235
- /** @type {Map<string, Array<Listener>>} Watch listeners from other proxies */
20196
+ /** @type {Map<string, Array<import('./interface.ts').Listener>>} Watch listeners from other proxies */
20236
20197
  this.foreignListeners = context ? context.foreignListeners : new Map();
20237
20198
 
20238
20199
  /** @type {Set<ProxyConstructor>} */
@@ -20277,7 +20238,7 @@
20277
20238
  ? null
20278
20239
  : context;
20279
20240
 
20280
- /** @type {AsyncQueueTask[]} */
20241
+ /** @type {import('./interface.ts').AsyncQueueTask[]} */
20281
20242
  this.$$asyncQueue = [];
20282
20243
 
20283
20244
  this.filters = [];
@@ -20286,257 +20247,18 @@
20286
20247
  this.$$destroyed = false;
20287
20248
 
20288
20249
  this.scheduled = [];
20289
- }
20290
-
20291
- /**
20292
- * Intercepts and handles property assignments on the target object. If a new value is
20293
- * an object, it will be recursively proxied.
20294
- *
20295
- * @param {Object} target - The target object.
20296
- * @param {string} property - The name of the property being set.
20297
- * @param {*} value - The new value being assigned to the property.
20298
- * @param {Proxy} proxy - The proxy intercepting property access
20299
- * @returns {boolean} - Returns true to indicate success of the operation.
20300
- */
20301
- set(target, property, value, proxy) {
20302
- if (property === "undefined") {
20303
- throw new Error("Attempting to set undefined property");
20304
- }
20305
- if (
20306
- (target.constructor?.$nonscope &&
20307
- Array.isArray(target.constructor.$nonscope) &&
20308
- target.constructor.$nonscope.includes(property)) ||
20309
- (target.$nonscope &&
20310
- Array.isArray(target.$nonscope) &&
20311
- target.$nonscope.includes(property))
20312
- ) {
20313
- target[property] = value;
20314
- return true;
20315
- }
20316
-
20317
- this.$proxy = proxy;
20318
- this.$target = target;
20319
- const oldValue = target[property];
20320
-
20321
- // Handle NaNs
20322
- if (
20323
- oldValue !== undefined &&
20324
- Number.isNaN(oldValue) &&
20325
- Number.isNaN(value)
20326
- ) {
20327
- return true;
20328
- }
20329
- if (oldValue && oldValue[isProxySymbol]) {
20330
- if (Array.isArray(value)) {
20331
- if (oldValue !== value) {
20332
- const listeners = this.watchers.get(property);
20333
-
20334
- if (listeners) {
20335
- this.#scheduleListener(listeners);
20336
- }
20337
-
20338
- const foreignListeners = this.foreignListeners.get(property);
20339
-
20340
- if (foreignListeners) {
20341
- this.#scheduleListener(foreignListeners);
20342
- }
20343
- }
20344
-
20345
- if (this.objectListeners.get(target[property])) {
20346
- this.objectListeners.delete(target[property]);
20347
- }
20348
- target[property] = createScope(value, this);
20349
- this.objectListeners.set(target[property], [property]);
20350
- return true;
20351
- }
20352
-
20353
- if (isObject(value)) {
20354
- if (hasOwn(target, property)) {
20355
- Object.keys(oldValue)
20356
- .filter((x) => !value[x])
20357
- .forEach((k) => {
20358
- delete oldValue[k];
20359
- });
20360
- }
20361
-
20362
- if (oldValue !== value) {
20363
- const listeners = this.watchers.get(property);
20364
-
20365
- if (listeners) {
20366
- this.#scheduleListener(listeners);
20367
- }
20368
-
20369
- const foreignListeners = this.foreignListeners.get(property);
20370
-
20371
- if (foreignListeners) {
20372
- this.#scheduleListener(foreignListeners);
20373
- }
20374
-
20375
- this.#checkeListenersForAllKeys(value);
20376
- }
20377
- target[property] = createScope(value, this);
20378
- //setDeepValue(target[property], value);
20379
- return true;
20380
- }
20381
-
20382
- if (isUndefined(value)) {
20383
- let called = false;
20384
- Object.keys(oldValue.$target).forEach((k) => {
20385
- if (oldValue.$target[k]?.[isProxySymbol]) {
20386
- called = true;
20387
- }
20388
- delete oldValue[k];
20389
- });
20390
-
20391
- target[property] = undefined;
20392
- if (!called) {
20393
- let listeners = this.watchers.get(property);
20394
-
20395
- if (listeners) {
20396
- this.#scheduleListener(listeners);
20397
- }
20398
- }
20399
-
20400
- return true;
20401
- }
20402
-
20403
- if (isDefined(value)) {
20404
- target[property] = value;
20405
- let listeners = this.watchers.get(property);
20406
-
20407
- if (listeners) {
20408
- this.#scheduleListener(listeners);
20409
- }
20410
-
20411
- if (Array.isArray(target)) {
20412
- if (this.objectListeners.has(proxy) && property !== "length") {
20413
- let keys = this.objectListeners.get(proxy);
20414
- keys.forEach((key) => {
20415
- const listeners = this.watchers.get(key);
20416
- if (listeners) {
20417
- this.#scheduleListener(listeners);
20418
- }
20419
- });
20420
- }
20421
- }
20422
-
20423
- return true;
20424
- }
20425
- return true;
20426
- } else {
20427
- if (isUndefined(target[property]) && isProxy(value)) {
20428
- this.foreignProxies.add(value);
20429
- target[property] = value;
20430
- if (!this.watchers.has(property)) {
20431
- return true;
20432
- }
20433
- }
20434
- if (isUndefined(value)) {
20435
- target[property] = value;
20436
- } else {
20437
- target[property] = createScope(value, this);
20438
- }
20439
-
20440
- if (oldValue !== value) {
20441
- let expectedTarget = this.$target;
20442
- let listeners = [];
20443
- // Handle the case where we need to start observing object after a watcher has been set
20444
- if (isUndefined(oldValue) && isObject(target[property])) {
20445
- if (!this.objectListeners.has(target[property])) {
20446
- this.objectListeners.set(target[property], [property]);
20447
- }
20448
- for (const k of Object.keys(value)) {
20449
- this.watchers.get(k)?.forEach((l) => listeners.push(l));
20450
- // overwhrite the context so we pass the owneship test in filter
20451
- expectedTarget = value;
20452
- }
20453
- }
20454
-
20455
- if (Array.isArray(target)) {
20456
- this.watchers.get("length")?.forEach((l) => listeners.push(l));
20457
- }
20458
-
20459
- this.watchers.get(property)?.forEach((l) => listeners.push(l));
20460
- if (listeners.length > 0) {
20461
- // check if the listener actually appllies to this target
20462
- this.#scheduleListener(listeners, (x) => {
20463
- return x.filter((x) => {
20464
- if (!x.watchProp) return true;
20465
- // Compute the expected target based on `watchProp`
20466
- const wrapperExpr = x.watchProp.split(".").slice(0, -1).join(".");
20467
- const expectedHandler = $parse(wrapperExpr)(
20468
- x.originalTarget,
20469
- )?.$handler;
20470
- return expectedTarget === expectedHandler?.$target;
20471
- });
20472
- });
20473
- }
20474
-
20475
- let foreignListeners = this.foreignListeners.get(property);
20476
-
20477
- if (!foreignListeners && this.$parent?.foreignListeners) {
20478
- foreignListeners = this.$parent.foreignListeners.get(property);
20479
- }
20480
- if (foreignListeners) {
20481
- // filter for repeaters
20482
- if (this.$target.$$hashKey) {
20483
- foreignListeners = foreignListeners.filter((x) =>
20484
- x.originalTarget.$$hashKey
20485
- ? x.originalTarget.$$hashKey == this.$target.$$hashKey
20486
- : false,
20487
- );
20488
- }
20489
-
20490
- this.#scheduleListener(foreignListeners);
20491
- }
20492
- }
20493
-
20494
- if (this.objectListeners.has(proxy) && property !== "length") {
20495
- let keys = this.objectListeners.get(proxy);
20496
- keys.forEach((key) => {
20497
- const listeners = this.watchers.get(key);
20498
- if (listeners) {
20499
- if (this.scheduled !== listeners) {
20500
- this.#scheduleListener(listeners);
20501
- }
20502
- }
20503
- });
20504
- }
20505
-
20506
- return true;
20507
- }
20508
- }
20509
-
20510
- /**
20511
- * Intercepts property access on the target object. It checks for specific
20512
- * properties (`watch` and `sync`) and binds their methods. For other properties,
20513
- * it returns the value directly.
20514
- *
20515
- * @param {Object} target - The target object.
20516
- * @param {string|number|symbol} property - The name of the property being accessed.
20517
- * @param {Proxy} proxy - The proxy object being invoked
20518
- * @returns {*} - The value of the property or a method if accessing `watch` or `sync`.
20519
- */
20520
- get(target, property, proxy) {
20521
- if (property === "$$watchersCount") return calculateWatcherCount(this);
20522
- if (property === isProxySymbol) return true;
20523
-
20524
- if (target[property] && isProxy(target[property])) {
20525
- this.$proxy = target[property];
20526
- } else {
20527
- this.$proxy = proxy;
20528
- }
20529
20250
 
20251
+ /** @private */
20530
20252
  this.propertyMap = {
20531
20253
  $watch: this.$watch.bind(this),
20532
20254
  $new: this.$new.bind(this),
20533
20255
  $newIsolate: this.$newIsolate.bind(this),
20534
20256
  $destroy: this.$destroy.bind(this),
20257
+ $flushQueue: this.$flushQueue.bind(this),
20535
20258
  $eval: this.$eval.bind(this),
20536
20259
  $apply: this.$apply.bind(this),
20537
20260
  $postUpdate: this.$postUpdate.bind(this),
20538
20261
  $isRoot: this.#isRoot.bind(this),
20539
- $target: target,
20540
20262
  $proxy: this.$proxy,
20541
20263
  $on: this.$on.bind(this),
20542
20264
  $emit: this.$emit.bind(this),
@@ -20550,6 +20272,249 @@
20550
20272
  $merge: this.$merge.bind(this),
20551
20273
  $getById: this.$getById.bind(this),
20552
20274
  };
20275
+ }
20276
+
20277
+ /**
20278
+ * Intercepts and handles property assignments on the target object. If a new value is
20279
+ * an object, it will be recursively proxied.
20280
+ *
20281
+ * @param {Object} target - The target object.
20282
+ * @param {string} property - The name of the property being set.
20283
+ * @param {*} value - The new value being assigned to the property.
20284
+ * @param {Proxy} proxy - The proxy intercepting property access
20285
+ * @returns {boolean} - Returns true to indicate success of the operation.
20286
+ */
20287
+ set(target, property, value, proxy) {
20288
+ if (property === "undefined") {
20289
+ throw new Error("Attempting to set undefined property");
20290
+ }
20291
+ if (
20292
+ (target.constructor?.$nonscope &&
20293
+ Array.isArray(target.constructor.$nonscope) &&
20294
+ target.constructor.$nonscope.includes(property)) ||
20295
+ (target.$nonscope &&
20296
+ Array.isArray(target.$nonscope) &&
20297
+ target.$nonscope.includes(property))
20298
+ ) {
20299
+ target[property] = value;
20300
+ return true;
20301
+ }
20302
+
20303
+ this.$proxy = proxy;
20304
+ this.$target = target;
20305
+ const oldValue = target[property];
20306
+
20307
+ // Handle NaNs
20308
+ if (
20309
+ oldValue !== undefined &&
20310
+ Number.isNaN(oldValue) &&
20311
+ Number.isNaN(value)
20312
+ ) {
20313
+ return true;
20314
+ }
20315
+ if (oldValue && oldValue[isProxySymbol]) {
20316
+ if (Array.isArray(value)) {
20317
+ if (oldValue !== value) {
20318
+ const listeners = this.watchers.get(property);
20319
+
20320
+ if (listeners) {
20321
+ this.#scheduleListener(listeners);
20322
+ }
20323
+
20324
+ const foreignListeners = this.foreignListeners.get(property);
20325
+
20326
+ if (foreignListeners) {
20327
+ this.#scheduleListener(foreignListeners);
20328
+ }
20329
+ }
20330
+
20331
+ if (this.objectListeners.get(target[property])) {
20332
+ this.objectListeners.delete(target[property]);
20333
+ }
20334
+ target[property] = createScope(value, this);
20335
+ this.objectListeners.set(target[property], [property]);
20336
+ return true;
20337
+ }
20338
+
20339
+ if (isObject(value)) {
20340
+ if (hasOwn(target, property)) {
20341
+ Object.keys(oldValue)
20342
+ .filter((x) => !value[x])
20343
+ .forEach((k) => {
20344
+ delete oldValue[k];
20345
+ });
20346
+ }
20347
+
20348
+ if (oldValue !== value) {
20349
+ const listeners = this.watchers.get(property);
20350
+
20351
+ if (listeners) {
20352
+ this.#scheduleListener(listeners);
20353
+ }
20354
+
20355
+ const foreignListeners = this.foreignListeners.get(property);
20356
+
20357
+ if (foreignListeners) {
20358
+ this.#scheduleListener(foreignListeners);
20359
+ }
20360
+
20361
+ this.#checkeListenersForAllKeys(value);
20362
+ }
20363
+ target[property] = createScope(value, this);
20364
+ //setDeepValue(target[property], value);
20365
+ return true;
20366
+ }
20367
+
20368
+ if (isUndefined(value)) {
20369
+ let called = false;
20370
+ Object.keys(oldValue.$target).forEach((k) => {
20371
+ if (oldValue.$target[k]?.[isProxySymbol]) {
20372
+ called = true;
20373
+ }
20374
+ delete oldValue[k];
20375
+ });
20376
+
20377
+ target[property] = undefined;
20378
+ if (!called) {
20379
+ let listeners = this.watchers.get(property);
20380
+
20381
+ if (listeners) {
20382
+ this.#scheduleListener(listeners);
20383
+ }
20384
+ }
20385
+
20386
+ return true;
20387
+ }
20388
+
20389
+ if (isDefined(value)) {
20390
+ target[property] = value;
20391
+ let listeners = this.watchers.get(property);
20392
+
20393
+ if (listeners) {
20394
+ this.#scheduleListener(listeners);
20395
+ }
20396
+
20397
+ if (Array.isArray(target)) {
20398
+ if (this.objectListeners.has(proxy) && property !== "length") {
20399
+ let keys = this.objectListeners.get(proxy);
20400
+ keys.forEach((key) => {
20401
+ const listeners = this.watchers.get(key);
20402
+ if (listeners) {
20403
+ this.#scheduleListener(listeners);
20404
+ }
20405
+ });
20406
+ }
20407
+ }
20408
+
20409
+ return true;
20410
+ }
20411
+ return true;
20412
+ } else {
20413
+ if (isUndefined(target[property]) && isProxy(value)) {
20414
+ this.foreignProxies.add(value);
20415
+ target[property] = value;
20416
+ if (!this.watchers.has(property)) {
20417
+ return true;
20418
+ }
20419
+ }
20420
+ if (isUndefined(value)) {
20421
+ target[property] = value;
20422
+ } else {
20423
+ target[property] = createScope(value, this);
20424
+ }
20425
+
20426
+ if (oldValue !== value) {
20427
+ let expectedTarget = this.$target;
20428
+ let listeners = [];
20429
+ // Handle the case where we need to start observing object after a watcher has been set
20430
+ if (isUndefined(oldValue) && isObject(target[property])) {
20431
+ if (!this.objectListeners.has(target[property])) {
20432
+ this.objectListeners.set(target[property], [property]);
20433
+ }
20434
+ for (const k of Object.keys(value)) {
20435
+ this.watchers.get(k)?.forEach((l) => listeners.push(l));
20436
+ // overwhrite the context so we pass the owneship test in filter
20437
+ expectedTarget = value;
20438
+ }
20439
+ }
20440
+
20441
+ if (Array.isArray(target)) {
20442
+ this.watchers.get("length")?.forEach((l) => listeners.push(l));
20443
+ }
20444
+
20445
+ this.watchers.get(property)?.forEach((l) => listeners.push(l));
20446
+ if (listeners.length > 0) {
20447
+ // check if the listener actually appllies to this target
20448
+ this.#scheduleListener(listeners, (x) => {
20449
+ return x.filter((x) => {
20450
+ if (!x.watchProp) return true;
20451
+ // Compute the expected target based on `watchProp`
20452
+ const wrapperExpr = x.watchProp.split(".").slice(0, -1).join(".");
20453
+ const expectedHandler = $parse(wrapperExpr)(
20454
+ x.originalTarget,
20455
+ )?.$handler;
20456
+ return expectedTarget === expectedHandler?.$target;
20457
+ });
20458
+ });
20459
+ }
20460
+
20461
+ let foreignListeners = this.foreignListeners.get(property);
20462
+
20463
+ if (!foreignListeners && this.$parent?.foreignListeners) {
20464
+ foreignListeners = this.$parent.foreignListeners.get(property);
20465
+ }
20466
+ if (foreignListeners) {
20467
+ // filter for repeaters
20468
+ if (this.$target.$$hashKey) {
20469
+ foreignListeners = foreignListeners.filter((x) =>
20470
+ x.originalTarget["$$hashKey"]
20471
+ ? x.originalTarget["$$hashKey"] === this.$target.$$hashKey
20472
+ : false,
20473
+ );
20474
+ }
20475
+
20476
+ this.#scheduleListener(foreignListeners);
20477
+ }
20478
+ }
20479
+
20480
+ if (this.objectListeners.has(proxy) && property !== "length") {
20481
+ let keys = this.objectListeners.get(proxy);
20482
+ keys.forEach((key) => {
20483
+ const listeners = this.watchers.get(key);
20484
+ if (listeners) {
20485
+ if (this.scheduled !== listeners) {
20486
+ this.#scheduleListener(listeners);
20487
+ }
20488
+ }
20489
+ });
20490
+ }
20491
+
20492
+ return true;
20493
+ }
20494
+ }
20495
+
20496
+ /**
20497
+ * Intercepts property access on the target object. It checks for specific
20498
+ * properties (`watch` and `sync`) and binds their methods. For other properties,
20499
+ * it returns the value directly.
20500
+ *
20501
+ * @param {Object} target - The target object.
20502
+ * @param {string|number|symbol} property - The name of the property being accessed.
20503
+ * @param {Proxy} proxy - The proxy object being invoked
20504
+ * @returns {*} - The value of the property or a method if accessing `watch` or `sync`.
20505
+ */
20506
+ get(target, property, proxy) {
20507
+ if (property === "$$watchersCount") return calculateWatcherCount(this);
20508
+ if (property === isProxySymbol) return true;
20509
+
20510
+ if (target[property] && isProxy(target[property])) {
20511
+ this.$proxy = target[property];
20512
+ } else {
20513
+ this.$proxy = proxy;
20514
+ }
20515
+
20516
+ this.propertyMap.$target = target;
20517
+ this.propertyMap.$proxy = proxy;
20553
20518
 
20554
20519
  if (
20555
20520
  Array.isArray(target) &&
@@ -20644,7 +20609,7 @@
20644
20609
  }
20645
20610
 
20646
20611
  /**
20647
- * @param {Listener[]} listeners
20612
+ * @param {import('./interface.ts').Listener[]} listeners
20648
20613
  * @param {Function} filter
20649
20614
  */
20650
20615
  #scheduleListener(listeners, filter = (val) => val) {
@@ -20668,7 +20633,7 @@
20668
20633
  * function is invoked when changes to that property are detected.
20669
20634
  *
20670
20635
  * @param {string} watchProp - An expression to be watched in the context of this model.
20671
- * @param {ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
20636
+ * @param {import('./interface.ts').ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
20672
20637
  * @param {boolean} [lazy] - A flag to indicate if the listener should be invoked immediately. Defaults to false.
20673
20638
  */
20674
20639
  $watch(watchProp, listenerFn, lazy = false) {
@@ -20690,7 +20655,7 @@
20690
20655
  return () => {};
20691
20656
  }
20692
20657
 
20693
- /** @type {Listener} */
20658
+ /** @type {import('./interface.ts').Listener} */
20694
20659
  const listener = {
20695
20660
  originalTarget: this.$target,
20696
20661
  listenerFn: listenerFn,
@@ -20802,7 +20767,7 @@
20802
20767
 
20803
20768
  let potentialProxy = $parse(
20804
20769
  watchProp.split(".").slice(0, -1).join("."),
20805
- )(listener.originalTarget);
20770
+ )(/** @type {Scope} */ (listener.originalTarget));
20806
20771
  if (potentialProxy && this.foreignProxies.has(potentialProxy)) {
20807
20772
  potentialProxy.$handler.#registerForeignKey(key, listener);
20808
20773
  potentialProxy.$handler.#scheduleListener([listener]);
@@ -21000,21 +20965,21 @@
21000
20965
  return true;
21001
20966
  }
21002
20967
 
21003
- // deregisterForeignKey(key, id) {
21004
- // const listenerList = this.foreignListeners.get(key);
21005
- // if (!listenerList) return false;
20968
+ deregisterForeignKey(key, id) {
20969
+ const listenerList = this.foreignListeners.get(key);
20970
+ if (!listenerList) return false;
21006
20971
 
21007
- // const index = listenerList.findIndex((x) => x.id === id);
21008
- // if (index === -1) return false;
20972
+ const index = listenerList.findIndex((x) => x.id === id);
20973
+ if (index === -1) return false;
21009
20974
 
21010
- // listenerList.splice(index, 1);
21011
- // if (listenerList.length) {
21012
- // this.foreignListeners.set(key, listenerList);
21013
- // } else {
21014
- // this.foreignListeners.delete(key);
21015
- // }
21016
- // return true;
21017
- // }
20975
+ listenerList.splice(index, 1);
20976
+ if (listenerList.length) {
20977
+ this.foreignListeners.set(key, listenerList);
20978
+ } else {
20979
+ this.foreignListeners.delete(key);
20980
+ }
20981
+ return true;
20982
+ }
21018
20983
 
21019
20984
  $eval(expr, locals) {
21020
20985
  const fn = $parse(expr);
@@ -21047,7 +21012,7 @@
21047
21012
  }
21048
21013
 
21049
21014
  /**
21050
- * @param {import('../../interface.js').Expression} expr
21015
+ * @param {import('../../interface.ts').Expression} expr
21051
21016
  * @returns {any}
21052
21017
  */
21053
21018
  $apply(expr) {
@@ -21228,12 +21193,12 @@
21228
21193
 
21229
21194
  /**
21230
21195
  * @internal
21231
- * @param {Listener} listener - The property path that was changed.
21196
+ * @param {import('./interface.ts').Listener} listener - The property path that was changed.
21232
21197
  */
21233
21198
  #notifyListener(listener, target) {
21234
21199
  const { originalTarget, listenerFn, watchFn } = listener;
21235
21200
  try {
21236
- let newVal = watchFn(originalTarget);
21201
+ let newVal = watchFn(/** @type {Scope} */ (originalTarget));
21237
21202
  if (isUndefined(newVal)) {
21238
21203
  newVal = watchFn(target);
21239
21204
  }
@@ -21263,6 +21228,13 @@
21263
21228
  }
21264
21229
  }
21265
21230
 
21231
+ /* @ignore */
21232
+ $flushQueue() {
21233
+ while ($postUpdateQueue.length) {
21234
+ $postUpdateQueue.shift()();
21235
+ }
21236
+ }
21237
+
21266
21238
  /**
21267
21239
  * Searches the scope instance
21268
21240
  *
@@ -21773,7 +21745,7 @@
21773
21745
 
21774
21746
  /**
21775
21747
  * @param {boolean} isDefault
21776
- * @returns {(any) => import("../../interface.js").Directive}
21748
+ * @returns {(any) => import("../../interface.ts").Directive}
21777
21749
  */
21778
21750
  function ngMessageDirectiveFactory(isDefault) {
21779
21751
  ngMessageDirective.$inject = ["$animate"];
@@ -21980,6 +21952,9 @@
21980
21952
  return $aria.$$watchExpr("ngShow", "aria-hidden", [], true);
21981
21953
  }
21982
21954
 
21955
+ /**
21956
+ * @return {ng.Directive}
21957
+ */
21983
21958
  function ngMessagesAriaDirective() {
21984
21959
  return {
21985
21960
  restrict: "A",
@@ -21995,18 +21970,21 @@
21995
21970
  }
21996
21971
 
21997
21972
  ngClickAriaDirective.$inject = [$injectTokens.$aria, $injectTokens.$parse];
21973
+
21974
+ /**
21975
+ * @param $aria
21976
+ * @param {ng.ParseService} $parse
21977
+ * @return {ng.Directive}
21978
+ */
21998
21979
  function ngClickAriaDirective($aria, $parse) {
21999
21980
  return {
22000
21981
  restrict: "A",
22001
21982
  compile(_elem, attr) {
22002
21983
  if (hasOwn(attr, ARIA_DISABLE_ATTR)) return;
22003
21984
 
22004
- const fn = $parse(attr.ngClick);
21985
+ const fn = $parse(attr["ngClick"]);
22005
21986
 
22006
- /**
22007
- * @param {Element} elem
22008
- */
22009
- return function (scope, elem, attr) {
21987
+ return (scope, elem, attr) => {
22010
21988
  if (!isNodeOneOf(elem, nativeAriaNodeNames)) {
22011
21989
  if ($aria.config("bindRoleForClick") && !elem.hasAttribute("role")) {
22012
21990
  elem.setAttribute("role", "button");
@@ -22043,10 +22021,6 @@
22043
22021
  // See https://github.com/angular/angular.js/issues/16664
22044
22022
  event.preventDefault();
22045
22023
  }
22046
- scope.$apply(callback);
22047
- }
22048
-
22049
- function callback() {
22050
22024
  fn(scope, { $event: event });
22051
22025
  }
22052
22026
  },
@@ -22368,6 +22342,7 @@
22368
22342
  }
22369
22343
 
22370
22344
  function AnimateCssProvider() {
22345
+ let activeClasses;
22371
22346
  this.$get = [
22372
22347
  "$$AnimateRunner",
22373
22348
  "$$animateCache",
@@ -22711,10 +22686,7 @@
22711
22686
  return closeAndReturnNoopAnimator();
22712
22687
  }
22713
22688
 
22714
- let activeClasses = pendClasses(
22715
- preparationClasses,
22716
- ACTIVE_CLASS_SUFFIX,
22717
- );
22689
+ activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);
22718
22690
 
22719
22691
  if (options.delay != null) {
22720
22692
  if (typeof options.delay !== "boolean") {
@@ -22851,7 +22823,9 @@
22851
22823
 
22852
22824
  if (events && events.length) {
22853
22825
  // Remove the transitionend / animationend listener(s)
22854
- element.off(events.join(" "), onAnimationProgress);
22826
+ events.forEach((i) =>
22827
+ element.removeEventListener(i, onAnimationProgress),
22828
+ );
22855
22829
  }
22856
22830
 
22857
22831
  // Cancel the fallback closing timeout and remove the timer data
@@ -23286,11 +23260,6 @@
23286
23260
  ) {
23287
23261
  const activeAnimationsLookup = new Map();
23288
23262
  const disabledElementsLookup = new Map();
23289
- let animationsEnabled = null;
23290
-
23291
- function removeFromDisabledElementsLookup(evt) {
23292
- disabledElementsLookup.delete(evt.target);
23293
- }
23294
23263
 
23295
23264
  function postDigestTaskFactory() {
23296
23265
  let postDigestCalled = false;
@@ -23330,11 +23299,6 @@
23330
23299
  // any animations are triggered.
23331
23300
  $rootScope.$postUpdate(() => {
23332
23301
  $rootScope.$postUpdate(() => {
23333
- // we check for null directly in the event that the application already called
23334
- // .enabled() with whatever arguments that it provided it with
23335
- if (animationsEnabled === null) {
23336
- animationsEnabled = true;
23337
- }
23338
23302
  });
23339
23303
  });
23340
23304
  }
@@ -23473,47 +23437,6 @@
23473
23437
  options.domOperation = domOperation;
23474
23438
  return queueAnimation(element, event, options);
23475
23439
  },
23476
-
23477
- // this method has four signatures:
23478
- // () - global getter
23479
- // (bool) - global setter
23480
- // (element) - element getter
23481
- // (element, bool) - element setter<F37>
23482
- enabled(element, bool) {
23483
- const argCount = arguments.length;
23484
-
23485
- if (argCount === 0) {
23486
- // () - Global getter
23487
- bool = !!animationsEnabled;
23488
- } else {
23489
- const hasElement = isElement(element);
23490
-
23491
- if (!hasElement) {
23492
- // (bool) - Global setter
23493
- bool = animationsEnabled = !!element;
23494
- } else {
23495
- const node = element;
23496
-
23497
- if (argCount === 1) {
23498
- // (element) - Element getter
23499
- bool = !disabledElementsLookup.get(node);
23500
- } else {
23501
- // (element, bool) - Element setter
23502
- if (!disabledElementsLookup.has(node)) {
23503
- // The element is added to the map for the first time.
23504
- // Create a listener to remove it on `$destroy` (to avoid memory leak).
23505
- element.addEventListener(
23506
- "$destroy",
23507
- removeFromDisabledElementsLookup,
23508
- );
23509
- }
23510
- disabledElementsLookup.set(node, !bool);
23511
- }
23512
- }
23513
- }
23514
-
23515
- return bool;
23516
- },
23517
23440
  };
23518
23441
 
23519
23442
  return $animate;
@@ -23570,6 +23493,7 @@
23570
23493
  if (options.to && !isObject(options.to)) {
23571
23494
  options.to = null;
23572
23495
  }
23496
+
23573
23497
  // If animations are hard-disabled for the whole application there is no need to continue.
23574
23498
  // There are also situations where a directive issues an animation for a JQLite wrapper that
23575
23499
  // contains only comment nodes. In this case, there is no way we can perform an animation.
@@ -23582,7 +23506,6 @@
23582
23506
  close();
23583
23507
  return runner;
23584
23508
  }
23585
-
23586
23509
  const isStructural = ["enter", "move", "leave"].indexOf(event) >= 0;
23587
23510
 
23588
23511
  // This is a hard disable of all animations the element itself, therefore there is no need to
@@ -23818,6 +23741,8 @@
23818
23741
  });
23819
23742
  });
23820
23743
 
23744
+ // Since we don't have digest any more - trigger queue here
23745
+ setTimeout($rootScope.$flushQueue, 0);
23821
23746
  return runner;
23822
23747
 
23823
23748
  function notifyProgress(runner, event, phase, data) {
@@ -23981,14 +23906,14 @@
23981
23906
  // TODO: use caching here to speed things up for detection
23982
23907
  // TODO: add documentation
23983
23908
 
23984
- AnimateJsProvider.$inject = ["$animateProvider"];
23909
+ AnimateJsProvider.$inject = [$injectTokens.$animate + "Provider"];
23985
23910
  function AnimateJsProvider($animateProvider) {
23986
23911
  this.$get = [
23987
23912
  $injectTokens.$injector,
23988
23913
  "$$AnimateRunner",
23989
23914
  /**
23990
23915
  *
23991
- * @param {import("../core/di/internal-injector").InjectorService} $injector
23916
+ * @param {ng.InjectorService} $injector
23992
23917
  * @param {*} $$AnimateRunner
23993
23918
  * @returns
23994
23919
  */
@@ -24847,8 +24772,8 @@
24847
24772
  }
24848
24773
 
24849
24774
  /**
24850
- * @typedef {import('./interface.js').RafScheduler} RafScheduler
24851
- * @typedef {import('../interface.js').ServiceProvider} ServiceProvider
24775
+ * @typedef {import('./interface.ts').RafScheduler} RafScheduler
24776
+ * @typedef {import('../interface.ts').ServiceProvider} ServiceProvider
24852
24777
  */
24853
24778
 
24854
24779
  /**
@@ -25363,9 +25288,9 @@
25363
25288
  ];
25364
25289
  }
25365
25290
 
25366
- ngAnimateSwapDirective.$inject = ["$animate"];
25291
+ ngAnimateSwapDirective.$inject = [$injectTokens.$animate];
25367
25292
  /**
25368
- * @returns {import('../interface.ts').Directive}
25293
+ * @returns {ng.Directive}
25369
25294
  */
25370
25295
  function ngAnimateSwapDirective($animate) {
25371
25296
  return {
@@ -25374,10 +25299,10 @@
25374
25299
  terminal: true,
25375
25300
  priority: 550, // We use 550 here to ensure that the directive is caught before others,
25376
25301
  // but after `ngIf` (at priority 600).
25377
- link(scope, $element, attrs, ctrl, $transclude) {
25302
+ link(scope, $element, attrs, _ctrl, $transclude) {
25378
25303
  let previousElement;
25379
25304
  let previousScope;
25380
- scope.$watch(attrs["ngAnimateSwap"] || attrs["for"], (value) => {
25305
+ scope.$watch(attrs.ngAnimateSwap || attrs.for, (value) => {
25381
25306
  if (previousElement) {
25382
25307
  $animate.leave(previousElement);
25383
25308
  }
@@ -27604,7 +27529,7 @@
27604
27529
  * @param {PathNode[]} fromPath
27605
27530
  * @param {PathNode[]} toPath
27606
27531
  * @param {boolean} [reloadState]
27607
- * @returns {import("../transition/interface.js").TreeChanges}
27532
+ * @returns {import("../transition/interface.ts").TreeChanges}
27608
27533
  */
27609
27534
  static treeChanges(fromPath, toPath, reloadState) {
27610
27535
  const max = Math.min(fromPath.length, toPath.length);
@@ -28339,25 +28264,6 @@
28339
28264
  return vc.$ngViewContextAnchor === (ngViewContext && ngViewContext.name);
28340
28265
  };
28341
28266
 
28342
- /**
28343
- * An object for Transition Hook Phases
28344
- * @enum {number}
28345
- * @readonly
28346
- */
28347
- const TransitionHookPhase = {
28348
- CREATE: 0,
28349
- BEFORE: 1,
28350
- RUN: 2,
28351
- SUCCESS: 3,
28352
- ERROR: 4,
28353
- };
28354
-
28355
- /** An object for Transition Hook Scopes */
28356
- const TransitionHookScope = {
28357
- TRANSITION: 0,
28358
- STATE: 1,
28359
- };
28360
-
28361
28267
  /**
28362
28268
  * An object for Transition Rejection reasons.
28363
28269
  * @enum {number}
@@ -28477,7 +28383,7 @@
28477
28383
  }
28478
28384
  }
28479
28385
 
28480
- /** @typedef {import('../../interface.js').ServiceProvider} ServiceProvider
28386
+ /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider
28481
28387
 
28482
28388
  /**
28483
28389
  * Configurable provider for an injectable event bus
@@ -28834,6 +28740,31 @@
28834
28740
  bind: null,
28835
28741
  };
28836
28742
 
28743
+ /**
28744
+ * Enum representing the different phases of a transition hook.
28745
+ *
28746
+ * @readonly
28747
+ * @enum {number}
28748
+ */
28749
+ const TransitionHookPhase = Object.freeze({
28750
+ CREATE: 0,
28751
+ BEFORE: 1,
28752
+ RUN: 2,
28753
+ SUCCESS: 3,
28754
+ ERROR: 4,
28755
+ });
28756
+
28757
+ /**
28758
+ * Enum representing the scope in which a transition hook operates.
28759
+ *
28760
+ * @readonly
28761
+ * @enum {number}
28762
+ */
28763
+ const TransitionHookScope = Object.freeze({
28764
+ TRANSITION: 0,
28765
+ STATE: 1,
28766
+ });
28767
+
28837
28768
  class TransitionHook {
28838
28769
  /**
28839
28770
  * Chains together an array of TransitionHooks.
@@ -30652,7 +30583,6 @@
30652
30583
  }
30653
30584
 
30654
30585
  _defineCoreEvents() {
30655
- const Phase = TransitionHookPhase;
30656
30586
  const TH = TransitionHook;
30657
30587
  const paths = this._criteriaPaths;
30658
30588
  const NORMAL_SORT = false,
@@ -30660,7 +30590,7 @@
30660
30590
  const SYNCHRONOUS = true;
30661
30591
  this._defineEvent(
30662
30592
  "onCreate",
30663
- Phase.CREATE,
30593
+ TransitionHookPhase.CREATE,
30664
30594
  0,
30665
30595
  paths.to,
30666
30596
  NORMAL_SORT,
@@ -30668,15 +30598,21 @@
30668
30598
  TH.THROW_ERROR,
30669
30599
  SYNCHRONOUS,
30670
30600
  );
30671
- this._defineEvent("onBefore", Phase.BEFORE, 0, paths.to);
30672
- this._defineEvent("onStart", Phase.RUN, 0, paths.to);
30673
- this._defineEvent("onExit", Phase.RUN, 100, paths.exiting, REVERSE_SORT);
30674
- this._defineEvent("onRetain", Phase.RUN, 200, paths.retained);
30675
- this._defineEvent("onEnter", Phase.RUN, 300, paths.entering);
30676
- this._defineEvent("onFinish", Phase.RUN, 400, paths.to);
30601
+ this._defineEvent("onBefore", TransitionHookPhase.BEFORE, 0, paths.to);
30602
+ this._defineEvent("onStart", TransitionHookPhase.RUN, 0, paths.to);
30603
+ this._defineEvent(
30604
+ "onExit",
30605
+ TransitionHookPhase.RUN,
30606
+ 100,
30607
+ paths.exiting,
30608
+ REVERSE_SORT,
30609
+ );
30610
+ this._defineEvent("onRetain", TransitionHookPhase.RUN, 200, paths.retained);
30611
+ this._defineEvent("onEnter", TransitionHookPhase.RUN, 300, paths.entering);
30612
+ this._defineEvent("onFinish", TransitionHookPhase.RUN, 400, paths.to);
30677
30613
  this._defineEvent(
30678
30614
  "onSuccess",
30679
- Phase.SUCCESS,
30615
+ TransitionHookPhase.SUCCESS,
30680
30616
  0,
30681
30617
  paths.to,
30682
30618
  NORMAL_SORT,
@@ -30686,7 +30622,7 @@
30686
30622
  );
30687
30623
  this._defineEvent(
30688
30624
  "onError",
30689
- Phase.ERROR,
30625
+ TransitionHookPhase.ERROR,
30690
30626
  0,
30691
30627
  paths.to,
30692
30628
  NORMAL_SORT,
@@ -30952,7 +30888,7 @@
30952
30888
 
30953
30889
  /**
30954
30890
  *
30955
- * @param {import("./interface.js").StateDeclaration} definition
30891
+ * @param {import("./interface.ts").StateDeclaration} definition
30956
30892
  */
30957
30893
  state(definition) {
30958
30894
  if (!definition.name) {
@@ -32252,7 +32188,7 @@
32252
32188
  );
32253
32189
  }
32254
32190
 
32255
- /** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
32191
+ /** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
32256
32192
 
32257
32193
  /**
32258
32194
  * Internal representation of a ng-router state.
@@ -32275,7 +32211,7 @@
32275
32211
  includes = undefined;
32276
32212
 
32277
32213
  /**
32278
- * @param {import('./interface.js').StateDeclaration} config
32214
+ * @param {import('./interface.ts').StateDeclaration} config
32279
32215
  */
32280
32216
  constructor(config) {
32281
32217
  Object.assign(this, config);
@@ -32283,7 +32219,7 @@
32283
32219
  return this;
32284
32220
  };
32285
32221
  /**
32286
- * @type {import('./interface.js').StateDeclaration}
32222
+ * @type {import('./interface.ts').StateDeclaration}
32287
32223
  */
32288
32224
  this.self = config;
32289
32225
  /**
@@ -34672,7 +34608,7 @@
34672
34608
  * ```
34673
34609
  */
34674
34610
 
34675
- /** @type {import("../../interface.js").AnnotatedDirectiveFactory} */
34611
+ /** @type {import("../../interface.ts").AnnotatedDirectiveFactory} */
34676
34612
  let ngView = [
34677
34613
  "$view",
34678
34614
  "$animate",
@@ -34683,7 +34619,7 @@
34683
34619
  * @param {*} $animate
34684
34620
  * @param {*} $viewScroll
34685
34621
  * @param {*} $interpolate
34686
- * @returns {import("../../interface.js").Directive}
34622
+ * @returns {import("../../interface.ts").Directive}
34687
34623
  */
34688
34624
  function $ViewDirective($view, $animate, $viewScroll, $interpolate) {
34689
34625
  function getRenderer() {
@@ -35024,8 +34960,8 @@
35024
34960
 
35025
34961
  ngChannelDirective.$inject = [$injectTokens.$eventBus];
35026
34962
  /**
35027
- * @param {import("../../services/pubsub/pubsub.js").PubSub} $eventBus
35028
- * @returns {import("../../interface.ts").Directive}
34963
+ * @param {ng.PubSubService} $eventBus
34964
+ * @returns {ng.Directive}
35029
34965
  */
35030
34966
  function ngChannelDirective($eventBus) {
35031
34967
  return {
@@ -35109,7 +35045,8 @@
35109
35045
  }
35110
35046
 
35111
35047
  /**
35112
- * @param {"get" | "delete" | "post" | "put"} method
35048
+ * @param {"get" | "delete" | "post" | "put"} method - HTTP method applied to request
35049
+ * @param {string} [attrOverride] - Custom name to use for the attribute
35113
35050
  * @returns {ng.DirectiveFactory}
35114
35051
  */
35115
35052
  function defineDirective(method, attrOverride) {
@@ -35123,6 +35060,7 @@
35123
35060
  $injectTokens.$parse,
35124
35061
  $injectTokens.$state,
35125
35062
  $injectTokens.$sse,
35063
+ $injectTokens.$animate,
35126
35064
  ];
35127
35065
  return directive;
35128
35066
  }
@@ -35142,15 +35080,11 @@
35142
35080
  /** @type {ng.DirectiveFactory} */
35143
35081
  const ngSseDirective = defineDirective("get", "ngSse");
35144
35082
 
35145
- /**
35146
- * @typedef {"click" | "change" | "submit"} EventType
35147
- */
35148
-
35149
35083
  /**
35150
35084
  * Selects DOM event to listen for based on the element type.
35151
35085
  *
35152
35086
  * @param {Element} element - The DOM element to inspect.
35153
- * @returns {EventType} The name of the event to listen for.
35087
+ * @returns {"click" | "change" | "submit"} The name of the event to listen for.
35154
35088
  */
35155
35089
  function getEventNameForElement(element) {
35156
35090
  const tag = element.tagName.toLowerCase();
@@ -35162,89 +35096,6 @@
35162
35096
  return "click";
35163
35097
  }
35164
35098
 
35165
- /**
35166
- * Handles DOM manipulation based on a swap strategy and server-rendered HTML.
35167
- *
35168
- * @param {string} html - The HTML string returned from the server.
35169
- * @param {import("./interface.ts").SwapModeType} swap
35170
- * @param {Element} target - The target DOM element to apply the swap to.
35171
- * @param {ng.Scope} scope
35172
- * @param {ng.CompileService} $compile
35173
- */
35174
- function handleSwapResponse(html, swap, target, scope, $compile) {
35175
- let nodes = [];
35176
- if (!["textcontent", "delete", "none"].includes(swap)) {
35177
- if (!html) {
35178
- return;
35179
- }
35180
-
35181
- if (isObject(html)) {
35182
- scope.$merge(html);
35183
- return;
35184
- }
35185
-
35186
- const compiled = $compile(html)(scope);
35187
- nodes =
35188
- compiled instanceof DocumentFragment
35189
- ? Array.from(compiled.childNodes)
35190
- : [compiled];
35191
- }
35192
-
35193
- switch (swap) {
35194
- case "innerHTML":
35195
- target.replaceChildren(...nodes);
35196
- break;
35197
-
35198
- case "outerHTML": {
35199
- const parent = target.parentNode;
35200
- if (!parent) return;
35201
- const frag = document.createDocumentFragment();
35202
- nodes.forEach((n) => frag.appendChild(n));
35203
- parent.replaceChild(frag, target);
35204
- break;
35205
- }
35206
-
35207
- case "textContent":
35208
- target.textContent = html;
35209
- break;
35210
-
35211
- case "beforebegin":
35212
- nodes.forEach((node) => target.parentNode.insertBefore(node, target));
35213
- break;
35214
-
35215
- case "afterbegin":
35216
- nodes
35217
- .slice()
35218
- .reverse()
35219
- .forEach((node) => target.insertBefore(node, target.firstChild));
35220
- break;
35221
-
35222
- case "beforeend":
35223
- nodes.forEach((node) => target.appendChild(node));
35224
- break;
35225
-
35226
- case "afterend":
35227
- nodes
35228
- .slice()
35229
- .reverse()
35230
- .forEach((node) =>
35231
- target.parentNode.insertBefore(node, target.nextSibling),
35232
- );
35233
- break;
35234
-
35235
- case "delete":
35236
- target.remove();
35237
- break;
35238
-
35239
- case "none":
35240
- break;
35241
-
35242
- default:
35243
- target.replaceChildren(...nodes);
35244
- break;
35245
- }
35246
- }
35247
-
35248
35099
  /**
35249
35100
  * Creates an HTTP directive factory that supports GET, DELETE, POST, PUT.
35250
35101
  *
@@ -35253,16 +35104,136 @@
35253
35104
  * @returns {ng.DirectiveFactory}
35254
35105
  */
35255
35106
  function createHttpDirective(method, attrName) {
35107
+ let content = undefined;
35108
+
35256
35109
  /**
35257
35110
  * @param {ng.HttpService} $http
35258
35111
  * @param {ng.CompileService} $compile
35259
35112
  * @param {ng.LogService} $log
35260
35113
  * @param {ng.ParseService} $parse
35261
35114
  * @param {ng.StateService} $state
35262
- * @param {Function} $sse
35115
+ * @param {ng.SseService} $sse
35263
35116
  * @returns {ng.Directive}
35264
35117
  */
35265
- return function ($http, $compile, $log, $parse, $state, $sse) {
35118
+ return function ($http, $compile, $log, $parse, $state, $sse, $animate) {
35119
+ /**
35120
+ * Handles DOM manipulation based on a swap strategy and server-rendered HTML.
35121
+ *
35122
+ * @param {string | Object} html - The HTML string or object returned from the server.
35123
+ * @param {import("./interface.ts").SwapModeType} swap
35124
+ * @param {ng.Scope} scope
35125
+ * @param {ng.Attributes} attrs
35126
+ * @param {Element} element
35127
+ */
35128
+ function handleSwapResponse(html, swap, scope, attrs, element) {
35129
+ let animationEnabled = false;
35130
+ if (attrs.animate) {
35131
+ animationEnabled = true;
35132
+ }
35133
+ let nodes = [];
35134
+ if (!["textcontent", "delete", "none"].includes(swap)) {
35135
+ if (!html) return;
35136
+ const compiled = $compile(html)(scope);
35137
+ nodes =
35138
+ compiled instanceof DocumentFragment
35139
+ ? Array.from(compiled.childNodes)
35140
+ : [compiled];
35141
+ }
35142
+
35143
+ const targetSelector = attrs["target"];
35144
+ const target = targetSelector
35145
+ ? document.querySelector(targetSelector)
35146
+ : element;
35147
+
35148
+ if (!target) {
35149
+ $log.warn(`${attrName}: target "${targetSelector}" not found`);
35150
+ return;
35151
+ }
35152
+
35153
+ switch (swap) {
35154
+ case "innerHTML":
35155
+ if (animationEnabled) {
35156
+ if (content) {
35157
+ $animate.leave(content).done(() => {
35158
+ content = nodes[0];
35159
+ $animate.enter(nodes[0], target);
35160
+ scope.$flushQueue();
35161
+ });
35162
+ scope.$flushQueue();
35163
+ } else {
35164
+ content = nodes[0];
35165
+ $animate.enter(nodes[0], target);
35166
+ scope.$flushQueue();
35167
+ }
35168
+ } else {
35169
+ target.replaceChildren(...nodes);
35170
+ }
35171
+ break;
35172
+
35173
+ case "outerHTML": {
35174
+ const parent = target.parentNode;
35175
+ if (!parent) return;
35176
+ const frag = document.createDocumentFragment();
35177
+ nodes.forEach((n) => frag.appendChild(n));
35178
+ if (animationEnabled) {
35179
+ const placeholder = document.createComment("placeholder");
35180
+ target.parentNode.insertBefore(placeholder, target.nextSibling);
35181
+ $animate.leave(target).done(() => {
35182
+ const insertedNodes = Array.from(frag.childNodes);
35183
+ insertedNodes.forEach((n) =>
35184
+ $animate.enter(n, parent, placeholder),
35185
+ );
35186
+ content = insertedNodes;
35187
+ scope.$flushQueue();
35188
+ });
35189
+ scope.$flushQueue();
35190
+ } else {
35191
+ parent.replaceChild(frag, target);
35192
+ }
35193
+ break;
35194
+ }
35195
+
35196
+ case "textContent":
35197
+ target.textContent = html;
35198
+ break;
35199
+
35200
+ case "beforebegin":
35201
+ nodes.forEach((node) => target.parentNode.insertBefore(node, target));
35202
+ break;
35203
+
35204
+ case "afterbegin":
35205
+ nodes
35206
+ .slice()
35207
+ .reverse()
35208
+ .forEach((node) => target.insertBefore(node, target.firstChild));
35209
+ break;
35210
+
35211
+ case "beforeend":
35212
+ nodes.forEach((node) => target.appendChild(node));
35213
+ break;
35214
+
35215
+ case "afterend":
35216
+ nodes
35217
+ .slice()
35218
+ .reverse()
35219
+ .forEach((node) =>
35220
+ target.parentNode.insertBefore(node, target.nextSibling),
35221
+ );
35222
+ break;
35223
+
35224
+ case "delete":
35225
+ target.remove();
35226
+ break;
35227
+
35228
+ case "none":
35229
+ break;
35230
+
35231
+ default:
35232
+ target.replaceChildren(...nodes);
35233
+ break;
35234
+ }
35235
+ }
35236
+
35266
35237
  /**
35267
35238
  * Collects form data from the element or its associated form.
35268
35239
  *
@@ -35276,15 +35247,12 @@
35276
35247
  const tag = element.tagName.toLowerCase();
35277
35248
 
35278
35249
  if (tag === "form") {
35279
- /** @type {HTMLFormElement} */
35280
35250
  form = /** @type {HTMLFormElement} */ (element);
35281
35251
  } else if ("form" in element && element.form) {
35282
- /** @type {HTMLFormElement} */
35283
35252
  form = /** @type {HTMLFormElement} */ (element.form);
35284
35253
  } else if (element.hasAttribute("form")) {
35285
35254
  const formId = element.getAttribute("form");
35286
35255
  if (formId) {
35287
- /** @type {HTMLElement | null} */
35288
35256
  const maybeForm = document.getElementById(formId);
35289
35257
  if (maybeForm && maybeForm.tagName.toLowerCase() === "form") {
35290
35258
  form = /** @type {HTMLFormElement} */ (maybeForm);
@@ -35322,13 +35290,10 @@
35322
35290
  return {
35323
35291
  restrict: "A",
35324
35292
  link(scope, element, attrs) {
35325
- const eventName =
35326
- attrs["trigger"] ||
35327
- /** @type {EventType} */ getEventNameForElement(element);
35328
-
35293
+ const eventName = attrs.trigger || getEventNameForElement(element);
35329
35294
  const tag = element.tagName.toLowerCase();
35330
35295
 
35331
- if (isDefined(attrs["latch"])) {
35296
+ if (isDefined(attrs.latch)) {
35332
35297
  attrs.$observe(
35333
35298
  "latch",
35334
35299
  callBackAfterFirst(() =>
@@ -35344,24 +35309,14 @@
35344
35309
  element.dispatchEvent(new Event(eventName));
35345
35310
  intervalId = setInterval(
35346
35311
  () => element.dispatchEvent(new Event(eventName)),
35347
- parseInt(attrs["interval"]) || 1000,
35312
+ parseInt(attrs.interval) || 1000,
35348
35313
  );
35349
35314
  }
35350
35315
 
35351
35316
  element.addEventListener(eventName, async (event) => {
35352
35317
  if (/** @type {HTMLButtonElement} */ (element).disabled) return;
35353
35318
  if (tag === "form") event.preventDefault();
35354
- const swap = attrs["swap"] || "innerHTML";
35355
- const targetSelector = attrs["target"];
35356
- const target = targetSelector
35357
- ? document.querySelector(targetSelector)
35358
- : element;
35359
-
35360
- if (!target) {
35361
- $log.warn(`${attrName}: target "${targetSelector}" not found`);
35362
- return;
35363
- }
35364
-
35319
+ const swap = attrs.swap || "innerHTML";
35365
35320
  const url = attrs[attrName];
35366
35321
  if (!url) {
35367
35322
  $log.warn(`${attrName}: no URL specified`);
@@ -35369,56 +35324,57 @@
35369
35324
  }
35370
35325
 
35371
35326
  const handler = (res) => {
35372
- if (isDefined(attrs["loading"])) {
35327
+ if (isDefined(attrs.loading)) {
35373
35328
  attrs.$set("loading", false);
35374
35329
  }
35375
35330
 
35376
- if (isDefined(attrs["loadingClass"])) {
35377
- attrs.$removeClass(attrs["loadingClass"]);
35331
+ if (isDefined(attrs.loadingClass)) {
35332
+ attrs.$removeClass(attrs.loadingClass);
35378
35333
  }
35379
35334
 
35380
35335
  const html = res.data;
35381
35336
  if (200 <= res.status && res.status <= 299) {
35382
- if (isDefined(attrs["success"])) {
35383
- $parse(attrs["success"])(scope, { $res: html });
35337
+ if (isDefined(attrs.success)) {
35338
+ $parse(attrs.success)(scope, { $res: html });
35384
35339
  }
35385
35340
 
35386
- if (isDefined(attrs["stateSuccess"])) {
35387
- $state.go(attrs["stateSuccess"]);
35341
+ if (isDefined(attrs.stateSuccess)) {
35342
+ $state.go(attrs.stateSuccess);
35388
35343
  }
35389
35344
  } else if (400 <= res.status && res.status <= 599) {
35390
- if (isDefined(attrs["error"])) {
35391
- $parse(attrs["error"])(scope, { $res: html });
35345
+ if (isDefined(attrs.error)) {
35346
+ $parse(attrs.error)(scope, { $res: html });
35392
35347
  }
35393
35348
 
35394
- if (isDefined(attrs["stateError"])) {
35395
- $state.go(attrs["stateError"]);
35349
+ if (isDefined(attrs.stateError)) {
35350
+ $state.go(attrs.stateError);
35396
35351
  }
35397
35352
  }
35398
35353
 
35399
- handleSwapResponse(
35400
- html,
35401
- /** @type {import("./interface.ts").SwapModeType} */ (swap),
35402
- target,
35403
- scope,
35404
- $compile,
35405
- );
35354
+ if (isObject(html)) {
35355
+ if (attrs.target) {
35356
+ scope.$eval(`${attrs.target} = ${JSON.stringify(html)}`);
35357
+ } else {
35358
+ scope.$merge(html);
35359
+ }
35360
+ } else if (isString(html)) {
35361
+ handleSwapResponse(html, swap, scope, attrs, element);
35362
+ }
35406
35363
  };
35407
- if (isDefined(attrs["delay"])) {
35408
- await wait(parseInt(attrs["delay"]) | 0);
35409
- }
35410
35364
 
35411
- if (throttled) {
35412
- return;
35365
+ if (isDefined(attrs.delay)) {
35366
+ await wait(parseInt(attrs.delay) | 0);
35413
35367
  }
35414
35368
 
35415
- if (isDefined(attrs["throttle"])) {
35369
+ if (throttled) return;
35370
+
35371
+ if (isDefined(attrs.throttle)) {
35416
35372
  throttled = true;
35417
35373
  attrs.$set("throttled", true);
35418
35374
  setTimeout(() => {
35419
35375
  attrs.$set("throttled", false);
35420
35376
  throttled = false;
35421
- }, parseInt(attrs["throttle"]));
35377
+ }, parseInt(attrs.throttle));
35422
35378
  }
35423
35379
 
35424
35380
  if (isDefined(attrs["loading"])) {
@@ -35426,13 +35382,13 @@
35426
35382
  }
35427
35383
 
35428
35384
  if (isDefined(attrs["loadingClass"])) {
35429
- attrs.$addClass(attrs["loadingClass"]);
35385
+ attrs.$addClass(attrs.loadingClass);
35430
35386
  }
35431
35387
 
35432
35388
  if (method === "post" || method === "put") {
35433
35389
  let data;
35434
35390
  const config = {};
35435
- if (attrs["enctype"]) {
35391
+ if (attrs.enctype) {
35436
35392
  config.headers = {
35437
35393
  "Content-Type": attrs["enctype"],
35438
35394
  };
@@ -35442,11 +35398,10 @@
35442
35398
  }
35443
35399
  $http[method](url, data, config).then(handler).catch(handler);
35444
35400
  } else {
35445
- // If SSE mode is enabled
35446
- if (method === "get" && attrs["ngSse"]) {
35401
+ if (method === "get" && attrs.ngSse) {
35447
35402
  const sseUrl = url;
35448
35403
  const config = {
35449
- withCredentials: attrs["withCredentials"] === "true",
35404
+ withCredentials: attrs.withCredentials === "true",
35450
35405
  transformMessage: (data) => {
35451
35406
  try {
35452
35407
  return JSON.parse(data);
@@ -35456,9 +35411,9 @@
35456
35411
  },
35457
35412
  onOpen: () => {
35458
35413
  $log.info(`${attrName}: SSE connection opened to ${sseUrl}`);
35459
- if (isDefined(attrs["loading"])) attrs.$set("loading", false);
35460
- if (isDefined(attrs["loadingClass"]))
35461
- attrs.$removeClass(attrs["loadingClass"]);
35414
+ if (isDefined(attrs.loading)) attrs.$set("loading", false);
35415
+ if (isDefined(attrs.loadingClass))
35416
+ attrs.$removeClass(attrs.loadingClass);
35462
35417
  },
35463
35418
  onMessage: (data) => {
35464
35419
  const res = { status: 200, data };
@@ -35469,12 +35424,15 @@
35469
35424
  const res = { status: 500, data: err };
35470
35425
  handler(res);
35471
35426
  },
35427
+ onReconnect: (count) => {
35428
+ $log.info(`ngSse: reconnected ${count} time(s)`);
35429
+ if (attrs.onReconnect)
35430
+ $parse(attrs.onReconnect)(scope, { $count: count });
35431
+ },
35472
35432
  };
35473
35433
 
35474
- // Open the SSE connection using the injected service
35475
35434
  const source = $sse(sseUrl, config);
35476
35435
 
35477
- // Cleanup on scope destroy
35478
35436
  scope.$on("$destroy", () => {
35479
35437
  $log.info(`${attrName}: closing SSE connection`);
35480
35438
  source.close();
@@ -35489,7 +35447,6 @@
35489
35447
  scope.$on("$destroy", () => clearInterval(intervalId));
35490
35448
  }
35491
35449
 
35492
- // Eagerly execute for 'load' event
35493
35450
  if (eventName == "load") {
35494
35451
  element.dispatchEvent(new Event("load"));
35495
35452
  }
@@ -35570,38 +35527,54 @@
35570
35527
  * const source = $sse('/events', {
35571
35528
  * onMessage: (data) => console.log(data),
35572
35529
  * onError: (err) => console.error(err),
35573
- * withCredentials: true
35530
+ * retryDelay: 2000,
35531
+ * heartbeatTimeout: 10000,
35574
35532
  * });
35575
35533
  *
35576
- * // later:
35577
35534
  * source.close();
35578
35535
  */
35579
-
35580
35536
  class SseProvider {
35581
35537
  constructor() {
35582
35538
  /**
35583
35539
  * Optional provider-level defaults
35584
35540
  * @type {ng.SseConfig}
35585
35541
  */
35586
- this.defaults = {};
35542
+ this.defaults = {
35543
+ retryDelay: 1000,
35544
+ maxRetries: Infinity,
35545
+ heartbeatTimeout: 15000, // 15 seconds
35546
+ transformMessage(data) {
35547
+ try {
35548
+ return JSON.parse(data);
35549
+ } catch {
35550
+ return data;
35551
+ }
35552
+ },
35553
+ };
35587
35554
  }
35588
35555
 
35589
35556
  /**
35590
35557
  * Returns the $sse service function
35591
35558
  * @returns {ng.SseService}
35592
35559
  */
35593
- $get =
35594
- () =>
35595
- (url, config = {}) => {
35596
- const finalUrl = this.#buildUrl(url, config.params);
35597
- return this.#createEventSource(finalUrl, config);
35598
- };
35560
+ $get = [
35561
+ $injectTokens.$log,
35562
+ /** @param {ng.LogService} log */
35563
+ (log) => {
35564
+ this.$log = log;
35565
+ return (url, config = {}) => {
35566
+ const mergedConfig = { ...this.defaults, ...config };
35567
+ const finalUrl = this.#buildUrl(url, mergedConfig.params);
35568
+ return this.#createConnection(finalUrl, mergedConfig);
35569
+ };
35570
+ },
35571
+ ];
35599
35572
 
35600
35573
  /**
35601
35574
  * Build URL with query parameters
35602
- * @param {string} url - Base URL
35603
- * @param {Record<string, any>=} params - Query parameters
35604
- * @returns {string} URL with serialized query string
35575
+ * @param {string} url
35576
+ * @param {Record<string, any>=} params
35577
+ * @returns {string}
35605
35578
  */
35606
35579
  #buildUrl(url, params) {
35607
35580
  if (!params) return url;
@@ -35612,37 +35585,376 @@
35612
35585
  }
35613
35586
 
35614
35587
  /**
35615
- * Create and manage an EventSource
35616
- * @param {string} url - URL for SSE connection
35617
- * @param {ng.SseConfig} config - Configuration object
35618
- * @returns {EventSource} The EventSource instance wrapped as SseService
35588
+ * Creates a managed SSE connection with reconnect and heartbeat
35589
+ * @param {string} url
35590
+ * @param {ng.SseConfig} config
35591
+ * @returns {import("./interface.ts").SseConnection}
35619
35592
  */
35620
- #createEventSource(url, config) {
35621
- const es = new EventSource(url, {
35622
- withCredentials: !!config.withCredentials,
35623
- });
35593
+ #createConnection(url, config) {
35594
+ let es;
35595
+ let retryCount = 0;
35596
+ let closed = false;
35597
+ let heartbeatTimer;
35624
35598
 
35625
- if (config.onOpen) {
35626
- es.addEventListener("open", (e) => config.onOpen(e));
35627
- }
35599
+ const connect = () => {
35600
+ if (closed) return;
35628
35601
 
35629
- es.addEventListener("message", (e) => {
35630
- let data = e.data;
35631
- try {
35632
- data = config.transformMessage
35633
- ? config.transformMessage(data)
35634
- : JSON.parse(data);
35635
- } catch {
35636
- // leave as raw string if not JSON
35602
+ es = new EventSource(url, {
35603
+ withCredentials: !!config.withCredentials,
35604
+ });
35605
+
35606
+ es.addEventListener("open", (e) => {
35607
+ retryCount = 0;
35608
+ config.onOpen?.(e);
35609
+ if (config.heartbeatTimeout) resetHeartbeat();
35610
+ });
35611
+
35612
+ es.addEventListener("message", (e) => {
35613
+ let data = e.data;
35614
+ try {
35615
+ data = config.transformMessage ? config.transformMessage(data) : data;
35616
+ } catch {
35617
+ /* empty */
35618
+ }
35619
+ config.onMessage?.(data, e);
35620
+ if (config.heartbeatTimeout) resetHeartbeat();
35621
+ });
35622
+
35623
+ es.addEventListener("error", (err) => {
35624
+ config.onError?.(err);
35625
+ if (closed) return;
35626
+ es.close();
35627
+
35628
+ if (retryCount < config.maxRetries) {
35629
+ retryCount++;
35630
+ config.onReconnect?.(retryCount);
35631
+ setTimeout(connect, config.retryDelay);
35632
+ } else {
35633
+ this.$log.warn("SSE: Max retries reached");
35634
+ }
35635
+ });
35636
+ };
35637
+
35638
+ const resetHeartbeat = () => {
35639
+ clearTimeout(heartbeatTimer);
35640
+ heartbeatTimer = setTimeout(() => {
35641
+ this.$log.warn("SSE: heartbeat timeout, reconnecting...");
35642
+ es.close();
35643
+ config.onReconnect?.(++retryCount);
35644
+ connect();
35645
+ }, config.heartbeatTimeout);
35646
+ };
35647
+
35648
+ connect();
35649
+
35650
+ return {
35651
+ close() {
35652
+ closed = true;
35653
+ clearTimeout(heartbeatTimer);
35654
+ es.close();
35655
+ },
35656
+ connect() {
35657
+ if (closed == false) {
35658
+ close();
35659
+ }
35660
+ connect();
35661
+ },
35662
+ };
35663
+ }
35664
+ }
35665
+
35666
+ /**
35667
+ * @returns {ng.Directive}
35668
+ */
35669
+ function ngViewportDirective() {
35670
+ return {
35671
+ restrict: "A",
35672
+ link(scope, element, attrs) {
35673
+ const enterExpr = attrs["onEnter"];
35674
+ const leaveExpr = attrs["onLeave"];
35675
+
35676
+ const observer = new IntersectionObserver(
35677
+ (entries) => {
35678
+ entries.forEach((entry) => {
35679
+ if (entry.isIntersecting) {
35680
+ if (enterExpr) scope.$eval(enterExpr);
35681
+ } else {
35682
+ if (leaveExpr) scope.$eval(leaveExpr);
35683
+ }
35684
+ });
35685
+ },
35686
+ {
35687
+ root: null, // viewport
35688
+ threshold: 0.1, // consider "in view" if 10% visible
35689
+ },
35690
+ );
35691
+
35692
+ observer.observe(element);
35693
+
35694
+ // Clean up when the element is removed from DOM
35695
+ const parent = element.parentNode;
35696
+ let mutationObserver;
35697
+ if (parent) {
35698
+ mutationObserver = new MutationObserver((mutations) => {
35699
+ for (const mutation of mutations) {
35700
+ Array.from(mutation.removedNodes).forEach((removedNode) => {
35701
+ if (removedNode === element) {
35702
+ observer.disconnect();
35703
+ mutationObserver.disconnect();
35704
+ }
35705
+ });
35706
+ }
35707
+ });
35708
+ mutationObserver.observe(parent, { childList: true });
35637
35709
  }
35638
- config.onMessage?.(data, e);
35639
- });
35640
35710
 
35641
- if (config.onError) {
35642
- es.addEventListener("error", (e) => config.onError(e));
35711
+ scope.$on("$destroy", () => {
35712
+ observer.disconnect();
35713
+ if (mutationObserver) mutationObserver.disconnect();
35714
+ });
35715
+ },
35716
+ };
35717
+ }
35718
+
35719
+ ngWorkerDirective.$inject = ["$worker", $injectTokens.$parse, $injectTokens.$log];
35720
+ /**
35721
+ * ngWorker directive factory
35722
+ * Usage: <div ng-worker="workerName" data-params="{{ expression }}" data-on-result="callback($result)"></div>
35723
+ */
35724
+ function ngWorkerDirective($worker, $parse, $log) {
35725
+ return {
35726
+ restrict: "A",
35727
+ link(scope, element, attrs) {
35728
+ const workerName = attrs.ngWorker;
35729
+ if (!workerName) {
35730
+ $log.warn("ngWorker: missing worker name");
35731
+ return;
35732
+ }
35733
+
35734
+ const eventName = attrs.trigger || getEventNameForElement(element);
35735
+
35736
+ let throttled = false;
35737
+ let intervalId;
35738
+
35739
+ if (isDefined(attrs.latch)) {
35740
+ attrs.$observe(
35741
+ "latch",
35742
+ callBackAfterFirst(() => element.dispatchEvent(new Event(eventName))),
35743
+ );
35744
+ }
35745
+
35746
+ if (isDefined(attrs.interval)) {
35747
+ element.dispatchEvent(new Event(eventName));
35748
+ intervalId = setInterval(
35749
+ () => element.dispatchEvent(new Event(eventName)),
35750
+ parseInt(attrs.interval) || 1000,
35751
+ );
35752
+ }
35753
+
35754
+ const worker = $worker(workerName, {
35755
+ onMessage: (result) => {
35756
+ if (isDefined(attrs.dataOnResult)) {
35757
+ $parse(attrs.dataOnResult)(scope, { $result: result });
35758
+ } else {
35759
+ const swap = attrs.swap || "innerHTML";
35760
+ handleSwap(result, swap, element);
35761
+ }
35762
+ },
35763
+ onError: (err) => {
35764
+ $log.error(`[ng-worker:${workerName}]`, err);
35765
+ if (isDefined(attrs.dataOnError)) {
35766
+ $parse(attrs.dataOnError)(scope, { $error: err });
35767
+ } else {
35768
+ element.textContent = "Error";
35769
+ }
35770
+ },
35771
+ });
35772
+
35773
+ element.addEventListener(eventName, async () => {
35774
+ if (element.disabled) return;
35775
+
35776
+ if (isDefined(attrs.delay)) {
35777
+ await wait(parseInt(attrs.delay) || 0);
35778
+ }
35779
+
35780
+ if (throttled) return;
35781
+
35782
+ if (isDefined(attrs.throttle)) {
35783
+ throttled = true;
35784
+ attrs.$set("throttled", true);
35785
+ setTimeout(() => {
35786
+ attrs.$set("throttled", false);
35787
+ throttled = false;
35788
+ }, parseInt(attrs.throttle));
35789
+ }
35790
+
35791
+ let params;
35792
+ try {
35793
+ params = attrs.params ? scope.$eval(attrs.params) : undefined;
35794
+ } catch (err) {
35795
+ $log.error("ngWorker: failed to evaluate data-params", err);
35796
+ params = undefined;
35797
+ }
35798
+
35799
+ worker.post(params);
35800
+ });
35801
+
35802
+ if (intervalId) {
35803
+ scope.$on("$destroy", () => clearInterval(intervalId));
35804
+ }
35805
+
35806
+ if (eventName === "load") {
35807
+ element.dispatchEvent(new Event("load"));
35808
+ }
35809
+ },
35810
+ };
35811
+ }
35812
+
35813
+ /**
35814
+ * Swap result into DOM based on strategy
35815
+ */
35816
+ function handleSwap(result, swap, element) {
35817
+ switch (swap) {
35818
+ case "outerHTML": {
35819
+ const parent = element.parentNode;
35820
+ if (!parent) return;
35821
+ const temp = document.createElement("div");
35822
+ temp.innerHTML = result;
35823
+ parent.replaceChild(temp.firstChild, element);
35824
+ break;
35643
35825
  }
35826
+ case "textContent":
35827
+ element.textContent = result;
35828
+ break;
35829
+ case "beforebegin":
35830
+ element.insertAdjacentHTML("beforebegin", result);
35831
+ break;
35832
+ case "afterbegin":
35833
+ element.insertAdjacentHTML("afterbegin", result);
35834
+ break;
35835
+ case "beforeend":
35836
+ element.insertAdjacentHTML("beforeend", result);
35837
+ break;
35838
+ case "afterend":
35839
+ element.insertAdjacentHTML("afterend", result);
35840
+ break;
35841
+ case "innerHTML":
35842
+ default:
35843
+ element.innerHTML = result;
35844
+ break;
35845
+ }
35846
+ }
35644
35847
 
35645
- return es;
35848
+ /**
35849
+ * Worker Provider
35850
+ *
35851
+ * Usage:
35852
+ * const worker = $worker('./math.worker.js', {
35853
+ * onMessage: (data) => console.log('Result:', data),
35854
+ * onError: (err) => console.error('Worker error:', err),
35855
+ * autoTerminate: false,
35856
+ * transformMessage: (d) => d,
35857
+ * });
35858
+ *
35859
+ * worker.post({ action: 'fib', n: 20 });
35860
+ * worker.terminate();
35861
+ */
35862
+ class WorkerProvider {
35863
+ /**
35864
+ * @type {ng.LogService}
35865
+ */
35866
+ $log;
35867
+ constructor() {
35868
+ /**
35869
+ * Optional provider-level defaults
35870
+ * @type {ng.WorkerConfig}
35871
+ */
35872
+ this.defaults = {
35873
+ autoTerminate: false,
35874
+ transformMessage(data) {
35875
+ try {
35876
+ return JSON.parse(data);
35877
+ } catch {
35878
+ return data;
35879
+ }
35880
+ },
35881
+ };
35882
+ }
35883
+
35884
+ /**
35885
+ * Returns the $worker service function
35886
+ * @returns {ng.WorkerService}
35887
+ */
35888
+ $get = [
35889
+ $injectTokens.$log,
35890
+ /** @param {ng.LogService} log */
35891
+ (log) => {
35892
+ this.$log = log;
35893
+ return (scriptPath, config = {}) => {
35894
+ const merged = { ...this.defaults, ...config };
35895
+ return this.#createWorker(scriptPath, merged);
35896
+ };
35897
+ },
35898
+ ];
35899
+
35900
+ /**
35901
+ * Creates a managed Web Worker instance
35902
+ * @param {string | URL} scriptPath
35903
+ * @param {ng.WorkerConfig} config
35904
+ * @returns {import("./interface.ts").WorkerConnection}
35905
+ */
35906
+ #createWorker(scriptPath, config) {
35907
+ if (!scriptPath) throw new Error("Worker script path required");
35908
+
35909
+ let worker = new Worker(scriptPath, { type: "module" });
35910
+ let terminated = false;
35911
+
35912
+ const reconnect = () => {
35913
+ if (terminated) return;
35914
+ this.$log.info("Worker: restarting...");
35915
+ worker.terminate();
35916
+ worker = new Worker(scriptPath, { type: "module" });
35917
+ wire(worker);
35918
+ };
35919
+
35920
+ const wire = (w) => {
35921
+ w.onmessage = (e) => {
35922
+ let data = e.data;
35923
+ try {
35924
+ data = config.transformMessage ? config.transformMessage(data) : data;
35925
+ } catch {
35926
+ /* no-op */
35927
+ }
35928
+ config.onMessage?.(data, e);
35929
+ };
35930
+
35931
+ w.onerror = (err) => {
35932
+ config.onError?.(err);
35933
+ if (config.autoRestart) reconnect();
35934
+ };
35935
+ };
35936
+
35937
+ wire(worker);
35938
+ let that = this;
35939
+ return {
35940
+ post(data) {
35941
+ if (terminated) return that.$log.warn("Worker already terminated");
35942
+ try {
35943
+ worker.postMessage(data);
35944
+ } catch (err) {
35945
+ that.$log.error("Worker post failed", err);
35946
+ }
35947
+ },
35948
+ terminate() {
35949
+ terminated = true;
35950
+ worker.terminate();
35951
+ },
35952
+ restart() {
35953
+ if (terminated)
35954
+ return that.$log.warn("Worker cannot restart after terminate");
35955
+ reconnect();
35956
+ },
35957
+ };
35646
35958
  }
35647
35959
  }
35648
35960
 
@@ -35658,7 +35970,7 @@
35658
35970
  [],
35659
35971
  [
35660
35972
  $injectTokens.$provide,
35661
- /** @param {import("./interface.js").Provider} $provide */
35973
+ /** @param {import("./interface.ts").Provider} $provide */
35662
35974
  ($provide) => {
35663
35975
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
35664
35976
  $provide.provider({
@@ -35723,6 +36035,8 @@
35723
36035
  maxlength: maxlengthDirective,
35724
36036
  ngValue: ngValueDirective,
35725
36037
  ngModelOptions: ngModelOptionsDirective,
36038
+ ngViewport: ngViewportDirective,
36039
+ ngWorker: ngWorkerDirective,
35726
36040
  })
35727
36041
  .directive({
35728
36042
  input: hiddenInputBrowserCacheDirective,
@@ -35790,6 +36104,7 @@
35790
36104
  $url: UrlService,
35791
36105
  $stateRegistry: StateRegistryProvider,
35792
36106
  $eventBus: PubSubProvider,
36107
+ $worker: WorkerProvider,
35793
36108
  });
35794
36109
  },
35795
36110
  ],
@@ -35821,7 +36136,7 @@
35821
36136
  /**
35822
36137
  * @type {string} `version` from `package.json`
35823
36138
  */
35824
- this.version = "0.9.8"; //inserted via rollup plugin
36139
+ this.version = "0.10.0"; //inserted via rollup plugin
35825
36140
 
35826
36141
  /** @type {!Array<string|any>} */
35827
36142
  this.bootsrappedModules = [];
@@ -35914,10 +36229,10 @@
35914
36229
  $injectTokens.$compile,
35915
36230
  $injectTokens.$injector,
35916
36231
  /**
35917
- * @param {import('./core/scope/scope.js').Scope} scope
36232
+ * @param {ng.Scope} scope
35918
36233
  * @param {Element} el
35919
- * @param {import("./core/compile/compile.js").CompileFn} compile
35920
- * @param {import("./core/di/internal-injector.js").InjectorService} $injector
36234
+ * @param {ng.CompileService} compile
36235
+ * @param {ng.InjectorService} $injector
35921
36236
  */
35922
36237
  (scope, el, compile, $injector) => {
35923
36238
  // ng-route deps
@@ -36044,7 +36359,7 @@
36044
36359
  * @param {string} name The name of the module to create or retrieve.
36045
36360
  * @param {Array.<string>} [requires] If specified then new module is being created. If
36046
36361
  * unspecified then the module is being retrieved for further configuration.
36047
- * @param {import("./interface.js").Injectable<any>} [configFn] Optional configuration function for the module that gets
36362
+ * @param {import("./interface.ts").Injectable<any>} [configFn] Optional configuration function for the module that gets
36048
36363
  * passed to {@link NgModule.config NgModule.config()}.
36049
36364
  * @returns {NgModule} A newly registered module.
36050
36365
  */