@angular-wave/angular.ts 0.16.0 → 0.16.1

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.
@@ -1,4 +1,4 @@
1
- /* Version: 0.16.0 - January 5, 2026 02:03:42 */
1
+ /* Version: 0.16.1 - January 5, 2026 22:44:28 */
2
2
  const VALID_CLASS = "ng-valid";
3
3
  const INVALID_CLASS = "ng-invalid";
4
4
  const PRISTINE_CLASS = "ng-pristine";
@@ -1448,11 +1448,11 @@ const $injectTokens = {
1448
1448
  _attrs: "$attrs",
1449
1449
  _scope: "$scope",
1450
1450
  _element: "$element",
1451
- _animateCache: "_animateCache",
1452
- _animateCssDriver: "_animateCssDriver",
1453
- _animateJs: "_animateJs",
1454
- _animateJsDriver: "_animateJsDriver",
1455
- _animateQueue: "_animateQueue",
1451
+ _animateCache: "$$animateCache",
1452
+ _animateCssDriver: "$$animateCssDriver",
1453
+ _animateJs: "$$animateJs",
1454
+ _animateJsDriver: "$$animateJsDriver",
1455
+ _animateQueue: "$$animateQueue",
1456
1456
  _animation: "$$animation",
1457
1457
  _rAFScheduler: "$$rAFScheduler",
1458
1458
  _taskTrackerFactory: "$$taskTrackerFactory",
@@ -15790,7 +15790,11 @@ function ngOptionsDirective($compile, $parse) {
15790
15790
  // scope.$watch(i, updateOptions);
15791
15791
  // });
15792
15792
  scope.$watch(
15793
- ngOptions.getWatchables._decoratedNode.body[0].expression.name,
15793
+ /** @type {import('../../core/parse/ast/ast-node.ts').LiteralNode} */ (
15794
+ /** @type {import('../../core/parse/ast/ast-node.ts').ExpressionNode} */ (
15795
+ ngOptions.getWatchables._decoratedNode.body[0]
15796
+ ).expression
15797
+ ).name,
15794
15798
  updateOptions,
15795
15799
  );
15796
15800
 
@@ -19983,6 +19987,16 @@ const ASTType = {
19983
19987
  _NGValueParameter: 17,
19984
19988
  };
19985
19989
 
19990
+ /** @typedef {import("./ast/ast-node.ts").ASTNode} ASTNode */
19991
+ /** @typedef {import("./ast/ast-node.ts").BodyNode} BodyNode */
19992
+ /** @typedef {import("./ast/ast-node.ts").ExpressionNode} ExpressionNode */
19993
+ /** @typedef {import("./ast/ast-node.ts").ArrayNode} ArrayNode */
19994
+ /** @typedef {import("./ast/ast-node.ts").LiteralNode} LiteralNode */
19995
+ /** @typedef {import("./ast/ast-node.ts").ObjectNode} ObjectNode */
19996
+ /** @typedef {import("./ast/ast-node.ts").ObjectPropertyNode} ObjectPropertyNode */
19997
+ /** @typedef {import("./interface.ts").CompiledExpression} CompiledExpression */
19998
+ /** @typedef {import("./interface.ts").CompiledExpressionFunction} CompiledExpressionFunction */
19999
+
19986
20000
  const PURITY_ABSOLUTE = 1;
19987
20001
  const PURITY_RELATIVE = 2;
19988
20002
 
@@ -19997,14 +20011,16 @@ class ASTInterpreter {
19997
20011
 
19998
20012
  /**
19999
20013
  * Compiles the AST into a function.
20000
- * @param {import("./ast/ast.js").ASTNode} ast - The AST to compile.
20001
- * @returns {import("./interface.ts").CompiledExpression}
20014
+ * @param {ASTNode} ast - The AST to compile.
20015
+ * @returns {CompiledExpression}
20002
20016
  */
20003
20017
  compile(ast) {
20004
20018
  const decoratedNode = findConstantAndWatchExpressions(ast, this._$filter);
20005
20019
 
20006
- /** @type {import("./ast/ast.js").ASTNode} */
20007
- const assignable = assignableAST(decoratedNode);
20020
+ const { body } = /** @type {BodyNode} */ (decoratedNode);
20021
+
20022
+ /** @type {ASTNode} */
20023
+ const assignable = assignableAST(/** @type {BodyNode} */ (decoratedNode));
20008
20024
 
20009
20025
  /** @type {import("./interface.ts").CompiledExpression} */
20010
20026
  let assign;
@@ -20014,7 +20030,8 @@ class ASTInterpreter {
20014
20030
  this.#recurse(assignable)
20015
20031
  );
20016
20032
  }
20017
- const toWatch = getInputs(decoratedNode.body);
20033
+
20034
+ const toWatch = getInputs(body);
20018
20035
 
20019
20036
  let inputs;
20020
20037
 
@@ -20032,20 +20049,28 @@ class ASTInterpreter {
20032
20049
  watch.watchId = key;
20033
20050
  }
20034
20051
  }
20052
+ /**
20053
+ * @type {import("./interface.ts").CompiledExpressionFunction[]}
20054
+ */
20035
20055
  const expressions = [];
20036
20056
 
20037
- decoratedNode.body.forEach((expression) => {
20038
- expressions.push(this.#recurse(expression.expression));
20039
- });
20057
+ body.forEach(
20058
+ /** @param {ExpressionNode} expression */ (expression) => {
20059
+ expressions.push(this.#recurse(expression.expression));
20060
+ },
20061
+ );
20040
20062
 
20041
20063
  /** @type {import("./interface.ts").CompiledExpression} */
20064
+ // @ts-ignore
20042
20065
  const fn =
20043
- decoratedNode.body.length === 0
20066
+ body.length === 0
20044
20067
  ? () => {
20045
20068
  /* empty */
20046
20069
  }
20047
- : decoratedNode.body.length === 1
20048
- ? expressions[0]
20070
+ : body.length === 1
20071
+ ? /** @type {import("./interface.ts").CompiledExpression} */ (
20072
+ expressions[0]
20073
+ )
20049
20074
  : function (scope, locals) {
20050
20075
  let lastValue;
20051
20076
 
@@ -20063,14 +20088,14 @@ class ASTInterpreter {
20063
20088
  if (inputs) {
20064
20089
  fn._inputs = inputs;
20065
20090
  }
20066
- fn._decoratedNode = decoratedNode;
20091
+ fn._decoratedNode = /** @type {BodyNode} */ (decoratedNode);
20067
20092
 
20068
20093
  return fn;
20069
20094
  }
20070
20095
 
20071
20096
  /**
20072
20097
  * Recurses the AST nodes.
20073
- * @param {import("./ast/ast").ASTNode} ast - The AST node.
20098
+ * @param {ExpressionNode & LiteralNode} ast - The AST node.
20074
20099
  * @param {Object} [context] - The context.
20075
20100
  * @param {boolean|1} [create] - The create flag.
20076
20101
  * @returns {import("./interface.ts").CompiledExpressionFunction} The recursive function.
@@ -20116,7 +20141,7 @@ class ASTInterpreter {
20116
20141
  left = this.#recurse(ast.object, false, !!create);
20117
20142
 
20118
20143
  if (!ast.computed) {
20119
- right = ast.property.name;
20144
+ right = /** @type {LiteralNode} */ (ast.property).name;
20120
20145
  }
20121
20146
 
20122
20147
  if (ast.computed) right = this.#recurse(ast.property);
@@ -20138,13 +20163,22 @@ class ASTInterpreter {
20138
20163
  );
20139
20164
  case ASTType._CallExpression:
20140
20165
  args = [];
20141
- ast.arguments.forEach((expr) => {
20166
+ /** @type {ExpressionNode} */ (ast).arguments.forEach((expr) => {
20142
20167
  args.push(self.#recurse(expr));
20143
20168
  });
20144
20169
 
20145
- if (ast.filter) right = this._$filter(ast.callee.name);
20170
+ if (/** @type {ExpressionNode} */ (ast).filter)
20171
+ right = this._$filter(
20172
+ /** @type {LiteralNode} */ (
20173
+ /** @type {ExpressionNode} */ (ast).callee
20174
+ ).name,
20175
+ );
20146
20176
 
20147
- if (!ast.filter) right = this.#recurse(ast.callee, true);
20177
+ if (!(/** @type {ExpressionNode} */ (ast).filter))
20178
+ right = this.#recurse(
20179
+ /** @type {ExpressionNode} */ (ast).callee,
20180
+ true,
20181
+ );
20148
20182
 
20149
20183
  return ast.filter
20150
20184
  ? (scope, locals, assign) => {
@@ -20207,7 +20241,7 @@ class ASTInterpreter {
20207
20241
  };
20208
20242
  case ASTType._ArrayExpression:
20209
20243
  args = [];
20210
- ast.elements.forEach((expr) => {
20244
+ /** @type {ArrayNode} */ (ast).elements.forEach((expr) => {
20211
20245
  args.push(self.#recurse(expr));
20212
20246
  });
20213
20247
 
@@ -20222,24 +20256,26 @@ class ASTInterpreter {
20222
20256
  };
20223
20257
  case ASTType._ObjectExpression:
20224
20258
  args = [];
20225
- ast.properties.forEach((property) => {
20226
- if (property.computed) {
20227
- args.push({
20228
- key: self.#recurse(property.key),
20229
- computed: true,
20230
- value: self.#recurse(property.value),
20231
- });
20232
- } else {
20233
- args.push({
20234
- key:
20235
- property.key.type === ASTType._Identifier
20236
- ? property.key.name
20237
- : `${property.key.value}`,
20238
- computed: false,
20239
- value: self.#recurse(property.value),
20240
- });
20241
- }
20242
- });
20259
+ /** @type {ObjectNode} */ (ast).properties.forEach(
20260
+ /** @param {ObjectPropertyNode} property */ (property) => {
20261
+ if (property.computed) {
20262
+ args.push({
20263
+ key: self.#recurse(property.key),
20264
+ computed: true,
20265
+ value: self.#recurse(property.value),
20266
+ });
20267
+ } else {
20268
+ args.push({
20269
+ key:
20270
+ property.key.type === ASTType._Identifier
20271
+ ? /** @type {LiteralNode} */ (property.key).name
20272
+ : `${/** @type {LiteralNode} */ (property.key).value}`,
20273
+ computed: false,
20274
+ value: self.#recurse(property.value),
20275
+ });
20276
+ }
20277
+ },
20278
+ );
20243
20279
 
20244
20280
  return (scope, locals, assign) => {
20245
20281
  const value = {};
@@ -20679,19 +20715,18 @@ class ASTInterpreter {
20679
20715
  }
20680
20716
 
20681
20717
  /**
20682
- * @typedef {import("./ast/ast").ASTNode & {
20683
- * isPure: boolean|number,
20684
- * constant: boolean,
20685
- * toWatch: Array,
20686
- * }} DecoratedASTNode
20687
- */
20688
-
20689
- /**
20690
- * Decorates AST with constant, toWatch, and isPure properties
20691
- * @param {import("./ast/ast").ASTNode} ast
20692
- * @param {ng.FilterService} $filter
20693
- * @param {boolean|1|2} [parentIsPure]
20694
- * @returns {DecoratedASTNode}
20718
+ * Decorates an AST node with constant, toWatch, and isPure metadata.
20719
+ *
20720
+ * This function recursively traverses the AST and sets:
20721
+ * - `constant` → whether the node is a constant expression
20722
+ * - `toWatch` → list of expressions to observe for changes
20723
+ * - `isPure` → whether the expression is pure (Angular-specific)
20724
+ *
20725
+ * @param {ASTNode} ast - The AST node to decorate
20726
+ * @param {ng.FilterService} $filter - Angular filter service
20727
+ * @param {boolean|1|2} [parentIsPure] - Optional flag indicating purity of the parent node
20728
+ * @returns {ASTNode} The same node, now decorated
20729
+ * @throws {Error} If the AST type is unknown
20695
20730
  */
20696
20731
  function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20697
20732
  let allConstants;
@@ -20700,7 +20735,7 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20700
20735
 
20701
20736
  let isFilter;
20702
20737
 
20703
- const decoratedNode = /** @type {DecoratedASTNode} */ (ast);
20738
+ const decoratedNode = /** @type {BodyNode & ExpressionNode} */ (ast);
20704
20739
 
20705
20740
  let decoratedLeft,
20706
20741
  decoratedRight,
@@ -20716,9 +20751,13 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20716
20751
  switch (ast.type) {
20717
20752
  case ASTType._Program:
20718
20753
  allConstants = true;
20719
- decoratedNode.body.forEach((expr) => {
20754
+ /** @type {import("./ast/ast-node.ts").BodyNode} */ (
20755
+ decoratedNode
20756
+ ).body.forEach((expr) => {
20720
20757
  const decorated = findConstantAndWatchExpressions(
20721
- expr.expression,
20758
+ /** @type {import("./ast/ast-node.ts").ExpressionStatementNode} */ (
20759
+ expr
20760
+ ).expression,
20722
20761
  $filter,
20723
20762
  astIsPure,
20724
20763
  );
@@ -20733,21 +20772,24 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20733
20772
  decoratedNode.toWatch = [];
20734
20773
 
20735
20774
  return decoratedNode;
20736
- case ASTType._UnaryExpression:
20737
- // eslint-disable-next-line no-var
20738
- var decorated = findConstantAndWatchExpressions(
20739
- decoratedNode.argument,
20740
- $filter,
20741
- astIsPure,
20775
+ case ASTType._UnaryExpression: {
20776
+ /** @type {BodyNode} */
20777
+ const decorated = /** @type {BodyNode} */ (
20778
+ findConstantAndWatchExpressions(
20779
+ decoratedNode.argument,
20780
+ $filter,
20781
+ astIsPure,
20782
+ )
20742
20783
  );
20743
20784
 
20744
20785
  decoratedNode.constant = decorated.constant;
20745
- decoratedNode.toWatch = decorated.toWatch;
20786
+ decoratedNode.toWatch = decorated.toWatch || [];
20746
20787
 
20747
20788
  return decoratedNode;
20789
+ }
20748
20790
  case ASTType._BinaryExpression:
20749
20791
  decoratedLeft = findConstantAndWatchExpressions(
20750
- decoratedNode.left,
20792
+ /** @type {ASTNode} */ (decoratedNode.left),
20751
20793
  $filter,
20752
20794
  astIsPure,
20753
20795
  );
@@ -20758,14 +20800,16 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20758
20800
  );
20759
20801
  decoratedNode.constant =
20760
20802
  decoratedLeft.constant && decoratedRight.constant;
20761
- decoratedNode.toWatch = decoratedLeft.toWatch.concat(
20762
- decoratedRight.toWatch,
20803
+ decoratedNode.toWatch = /** @type {ASTNode[]} */ (
20804
+ /** @type {BodyNode} */ (decoratedLeft).toWatch.concat(
20805
+ /** @type {BodyNode} */ (decoratedRight).toWatch,
20806
+ )
20763
20807
  );
20764
20808
 
20765
20809
  return decoratedNode;
20766
20810
  case ASTType._LogicalExpression:
20767
20811
  decoratedLeft = findConstantAndWatchExpressions(
20768
- decoratedNode.left,
20812
+ /** @type {ASTNode} */ (decoratedNode.left),
20769
20813
  $filter,
20770
20814
  astIsPure,
20771
20815
  );
@@ -20781,17 +20825,17 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20781
20825
  return decoratedNode;
20782
20826
  case ASTType._ConditionalExpression:
20783
20827
  decoratedTest = findConstantAndWatchExpressions(
20784
- ast.test,
20828
+ /** @type {ExpressionNode} */ (ast).test,
20785
20829
  $filter,
20786
20830
  astIsPure,
20787
20831
  );
20788
20832
  decoratedAlternate = findConstantAndWatchExpressions(
20789
- ast.alternate,
20833
+ /** @type {ExpressionNode} */ (ast).alternate,
20790
20834
  $filter,
20791
20835
  astIsPure,
20792
20836
  );
20793
20837
  decoratedConsequent = findConstantAndWatchExpressions(
20794
- ast.consequent,
20838
+ /** @type {ExpressionNode} */ (ast).consequent,
20795
20839
  $filter,
20796
20840
  astIsPure,
20797
20841
  );
@@ -20809,14 +20853,14 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20809
20853
  return decoratedNode;
20810
20854
  case ASTType._MemberExpression:
20811
20855
  decoratedObject = findConstantAndWatchExpressions(
20812
- ast.object,
20856
+ /** @type {ExpressionNode} */ (ast).object,
20813
20857
  $filter,
20814
20858
  astIsPure,
20815
20859
  );
20816
20860
 
20817
- if (ast.computed) {
20861
+ if (/** @type {ExpressionNode} */ (ast).computed) {
20818
20862
  decoratedProperty = findConstantAndWatchExpressions(
20819
- ast.property,
20863
+ /** @type {ExpressionNode} */ (ast).property,
20820
20864
  $filter,
20821
20865
  astIsPure,
20822
20866
  );
@@ -20828,13 +20872,21 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20828
20872
 
20829
20873
  return decoratedNode;
20830
20874
  case ASTType._CallExpression:
20831
- isFilter = ast.filter;
20875
+ isFilter = /** @type {ExpressionNode} */ (ast).filter;
20832
20876
  allConstants = isFilter;
20833
20877
  argsToWatch = [];
20834
- ast.arguments.forEach((expr) => {
20835
- decorated = findConstantAndWatchExpressions(expr, $filter, astIsPure);
20878
+ /** @type {ExpressionNode} */ (ast).arguments.forEach((expr) => {
20879
+ const decorated = findConstantAndWatchExpressions(
20880
+ expr,
20881
+ $filter,
20882
+ astIsPure,
20883
+ );
20884
+
20836
20885
  allConstants = allConstants && decorated.constant;
20837
- argsToWatch.push.apply(argsToWatch, decorated.toWatch);
20886
+ argsToWatch.push.apply(
20887
+ argsToWatch,
20888
+ /** @type {BodyNode} */ (decorated).toWatch,
20889
+ );
20838
20890
  });
20839
20891
  decoratedNode.constant = allConstants;
20840
20892
  decoratedNode.toWatch = isFilter ? argsToWatch : [decoratedNode];
@@ -20842,12 +20894,12 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20842
20894
  return decoratedNode;
20843
20895
  case ASTType._AssignmentExpression:
20844
20896
  decoratedLeft = findConstantAndWatchExpressions(
20845
- ast.left,
20897
+ /** @type {ASTNode} */ (/** @type {ExpressionNode} */ (ast).left),
20846
20898
  $filter,
20847
20899
  astIsPure,
20848
20900
  );
20849
20901
  decoratedRight = findConstantAndWatchExpressions(
20850
- ast.right,
20902
+ /** @type {ASTNode} */ (/** @type {ExpressionNode} */ (ast).right),
20851
20903
  $filter,
20852
20904
  astIsPure,
20853
20905
  );
@@ -20859,10 +20911,18 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20859
20911
  case ASTType._ArrayExpression:
20860
20912
  allConstants = true;
20861
20913
  argsToWatch = [];
20862
- ast.elements.forEach((expr) => {
20863
- decorated = findConstantAndWatchExpressions(expr, $filter, astIsPure);
20914
+ /** @type {ArrayNode} */ (ast).elements.forEach((expr) => {
20915
+ const decorated = findConstantAndWatchExpressions(
20916
+ expr,
20917
+ $filter,
20918
+ astIsPure,
20919
+ );
20920
+
20864
20921
  allConstants = allConstants && decorated.constant;
20865
- argsToWatch.push.apply(argsToWatch, decorated.toWatch);
20922
+ argsToWatch.push.apply(
20923
+ argsToWatch,
20924
+ /** @type {BodyNode} */ (decorated).toWatch,
20925
+ );
20866
20926
  });
20867
20927
  decoratedNode.constant = allConstants;
20868
20928
  decoratedNode.toWatch = argsToWatch;
@@ -20871,24 +20931,31 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20871
20931
  case ASTType._ObjectExpression:
20872
20932
  allConstants = true;
20873
20933
  argsToWatch = [];
20874
- ast.properties.forEach((property) => {
20875
- decorated = findConstantAndWatchExpressions(
20876
- property.value,
20934
+ /** @type {ObjectNode} */ (ast).properties.forEach((property) => {
20935
+ const decorated = findConstantAndWatchExpressions(
20936
+ /** @type {LiteralNode} */ (property).value,
20877
20937
  $filter,
20878
20938
  astIsPure,
20879
20939
  );
20940
+
20880
20941
  allConstants = allConstants && decorated.constant;
20881
- argsToWatch.push.apply(argsToWatch, decorated.toWatch);
20942
+ argsToWatch.push.apply(
20943
+ argsToWatch,
20944
+ /** @type {BodyNode} */ (decorated).toWatch,
20945
+ );
20882
20946
 
20883
- if (property.computed) {
20947
+ if (/** @type {ExpressionNode} */ (property).computed) {
20884
20948
  // `{[key]: value}` implicitly does `key.toString()` which may be non-pure
20885
20949
  decoratedKey = findConstantAndWatchExpressions(
20886
- property.key,
20950
+ /** @type {ObjectPropertyNode} */ (property).key,
20887
20951
  $filter,
20888
20952
  false,
20889
20953
  );
20890
20954
  allConstants = allConstants && decoratedKey.constant;
20891
- argsToWatch.push.apply(argsToWatch, decoratedKey.toWatch);
20955
+ argsToWatch.push.apply(
20956
+ argsToWatch,
20957
+ /** @type {BodyNode} */ (decorated).toWatch,
20958
+ );
20892
20959
  }
20893
20960
  });
20894
20961
  decoratedNode.constant = allConstants;
@@ -20905,23 +20972,31 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20905
20972
  decoratedNode.toWatch = [];
20906
20973
 
20907
20974
  return decoratedNode;
20975
+ default:
20976
+ throw new Error(`Unknown AST node type: ${ast.type}`);
20908
20977
  }
20909
-
20910
- return undefined;
20911
20978
  }
20912
20979
 
20913
20980
  /**
20914
20981
  * Converts a single expression AST node into an assignment expression if the expression is assignable.
20915
20982
  *
20916
- * @param {import("./ast/ast").ASTNode} ast
20917
- * @returns {import("./ast/ast").ASTNode}
20983
+ * @param {import("./ast/ast-node.ts").BodyNode} ast
20984
+ * @returns {import("./ast/ast-node.ts").ExpressionNode | undefined}
20918
20985
  */
20919
20986
  function assignableAST(ast) {
20920
- if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
20987
+ const stmt = /** @type {import("./ast/ast-node.ts").ExpressionNode} */ (
20988
+ ast.body[0]
20989
+ );
20990
+
20991
+ if (
20992
+ ast.body.length === 1 &&
20993
+ stmt?.expression &&
20994
+ isAssignable(stmt.expression)
20995
+ ) {
20921
20996
  return {
20922
20997
  type: ASTType._AssignmentExpression,
20923
- left: ast.body[0].expression,
20924
- right: { type: ASTType._NGValueParameter },
20998
+ left: stmt.expression, // left-hand side is an expression
20999
+ right: { type: ASTType._NGValueParameter }, // right-hand side leaf expression
20925
21000
  operator: "=",
20926
21001
  };
20927
21002
  }
@@ -20939,14 +21014,14 @@ function plusFn(left, right) {
20939
21014
 
20940
21015
  /**
20941
21016
  *
20942
- * @param {import("./ast/ast").ASTNode[]} body
21017
+ * @param {ASTNode[]} body
20943
21018
  * @returns {any}
20944
21019
  */
20945
21020
  function getInputs(body) {
20946
21021
  if (body.length !== 1) return undefined;
20947
- const lastExpression = /** @type {DecoratedASTNode} */ (body[0].expression);
21022
+ const lastExpression = /** @type {ExpressionNode} */ (body[0]).expression;
20948
21023
 
20949
- const candidate = lastExpression.toWatch;
21024
+ const candidate = /** @type {BodyNode} */ (lastExpression).toWatch;
20950
21025
 
20951
21026
  if (candidate.length !== 1) return candidate;
20952
21027
 
@@ -20955,15 +21030,15 @@ function getInputs(body) {
20955
21030
 
20956
21031
  /**
20957
21032
  * Detect nodes which could depend on non-shallow state of objects
20958
- * @param {import("./ast/ast").ASTNode} node
21033
+ * @param {ASTNode} node
20959
21034
  * @param {boolean|PURITY_ABSOLUTE|PURITY_RELATIVE} parentIsPure
20960
- * @returns {boolean|PURITY_ABSOLUTE|PURITY_RELATIVE}
21035
+ * @returns {number|boolean}
20961
21036
  */
20962
21037
  function isPure(node, parentIsPure) {
20963
21038
  switch (node.type) {
20964
21039
  // Computed members might invoke a stateful toString()
20965
21040
  case ASTType._MemberExpression:
20966
- if (node.computed) {
21041
+ if (/** @type {ExpressionNode} */ (node).computed) {
20967
21042
  return false;
20968
21043
  }
20969
21044
  break;
@@ -20974,7 +21049,9 @@ function isPure(node, parentIsPure) {
20974
21049
 
20975
21050
  // The binary + operator can invoke a stateful toString().
20976
21051
  case ASTType._BinaryExpression:
20977
- return node.operator !== "+" ? PURITY_ABSOLUTE : false;
21052
+ return /** @type {ExpressionNode} */ (node).operator !== "+"
21053
+ ? PURITY_ABSOLUTE
21054
+ : false;
20978
21055
 
20979
21056
  // Functions / filters probably read state from within objects
20980
21057
  case ASTType._CallExpression:
@@ -21021,9 +21098,6 @@ const literals = {
21021
21098
  undefined,
21022
21099
  };
21023
21100
 
21024
- /**
21025
- * @class
21026
- */
21027
21101
  class AST {
21028
21102
  /**
21029
21103
  * @param {import('../lexer/lexer.js').Lexer} lexer - The lexer instance for tokenizing input
@@ -21474,7 +21548,7 @@ class AST {
21474
21548
  /** @type {ASTNode[]} */
21475
21549
  const properties = [];
21476
21550
 
21477
- /** @type {ASTNode} */
21551
+ /** @type {import("./ast-node.ts").ObjectPropertyNode} */
21478
21552
  let property;
21479
21553
 
21480
21554
  if (this._peekToken().text !== "}") {
@@ -21483,7 +21557,10 @@ class AST {
21483
21557
  // Support trailing commas per ES5.1.
21484
21558
  break;
21485
21559
  }
21486
- property = { type: ASTType._Property, kind: "init" };
21560
+ property = /** @type {import("./ast-node.ts").ObjectPropertyNode} */ ({
21561
+ type: ASTType._Property,
21562
+ kind: "init",
21563
+ });
21487
21564
 
21488
21565
  if (/** @type {Token} */ (this._peek()).constant) {
21489
21566
  property.key = this._constant();
@@ -21655,7 +21732,9 @@ class Parser {
21655
21732
 
21656
21733
  const fn = this._astCompiler.compile(ast);
21657
21734
 
21658
- fn._literal = isLiteral(ast);
21735
+ fn._literal = isLiteral(
21736
+ /** @type {import("../ast/ast-node.ts").BodyNode} */ (ast),
21737
+ );
21659
21738
  fn.constant = !!ast.constant;
21660
21739
 
21661
21740
  return fn;
@@ -21663,7 +21742,7 @@ class Parser {
21663
21742
  }
21664
21743
 
21665
21744
  /**
21666
- * @param {import("../ast/ast-node.ts").ASTNode} ast
21745
+ * @param {import("../ast/ast-node.ts").BodyNode} ast
21667
21746
  * @returns {boolean}
21668
21747
  */
21669
21748
  function isLiteral(ast) {
@@ -21675,7 +21754,10 @@ function isLiteral(ast) {
21675
21754
  }
21676
21755
 
21677
21756
  if (body && body.length === 1) {
21678
- switch (body[0].expression?.type) {
21757
+ switch (
21758
+ /** @type {import("../ast/ast-node.ts").ExpressionNode} */ (body[0])
21759
+ .expression?.type
21760
+ ) {
21679
21761
  case ASTType._Literal:
21680
21762
  case ASTType._ArrayExpression:
21681
21763
  case ASTType._ObjectExpression:
@@ -21688,6 +21770,8 @@ function isLiteral(ast) {
21688
21770
  }
21689
21771
  }
21690
21772
 
21773
+ const lexer = new Lexer();
21774
+
21691
21775
  class ParseProvider {
21692
21776
  constructor() {
21693
21777
  const cache = Object.create(null);
@@ -21714,8 +21798,6 @@ class ParseProvider {
21714
21798
  parsedExpression = cache[cacheKey];
21715
21799
 
21716
21800
  if (!parsedExpression) {
21717
- const lexer = new Lexer();
21718
-
21719
21801
  const parser = new Parser(lexer, $filter);
21720
21802
 
21721
21803
  parsedExpression = parser._parse(exp);
@@ -21768,6 +21850,13 @@ class ParseProvider {
21768
21850
  }
21769
21851
  }
21770
21852
 
21853
+ /** @typedef {import("../parse/ast/ast-node.ts").ExpressionNode} ExpressionNode */
21854
+ /** @typedef {import("../parse/ast/ast-node.ts").LiteralNode} LiteralNode */
21855
+ /** @typedef {import("../parse/ast/ast-node.ts").BodyNode} BodyNode */
21856
+ /** @typedef {import("../parse/ast/ast-node.ts").ArrayNode} ArrayNode */
21857
+ /** @typedef {import("../parse/ast/ast-node.ts").ObjectNode} ObjectNode */
21858
+ /** @typedef {import("../parse/ast/ast-node.ts").ObjectPropertyNode} ObjectPropertyNode */
21859
+
21771
21860
  /**
21772
21861
  * @type {number}
21773
21862
  */
@@ -22517,6 +22606,10 @@ class Scope {
22517
22606
  };
22518
22607
  }
22519
22608
 
22609
+ const expr = /** @type {ExpressionNode & BodyNode} */ (
22610
+ get._decoratedNode.body[0]
22611
+ ).expression;
22612
+
22520
22613
  /** @type {ng.Listener} */
22521
22614
  const listener = {
22522
22615
  originalTarget: this.$target,
@@ -22528,11 +22621,11 @@ class Scope {
22528
22621
  };
22529
22622
 
22530
22623
  // simplest case
22531
- let key = get._decoratedNode.body[0].expression.name;
22624
+ let key = /** @type {LiteralNode} */ (expr).name;
22532
22625
 
22533
22626
  const keySet = [];
22534
22627
 
22535
- const { type } = get._decoratedNode.body[0].expression;
22628
+ const { type } = expr;
22536
22629
 
22537
22630
  switch (type) {
22538
22631
  // 3
@@ -22547,19 +22640,31 @@ class Scope {
22547
22640
 
22548
22641
  return undefined;
22549
22642
  }
22550
- key = get._decoratedNode.body[0].expression.left.name;
22643
+ key = /** @type {LiteralNode} */ (
22644
+ /** @type {ExpressionNode} */ (expr).left
22645
+ )?.name;
22551
22646
  break;
22552
22647
  // 4
22553
22648
  case ASTType._ConditionalExpression: {
22554
- key = get._decoratedNode.body[0].expression.toWatch[0]?.test?.name;
22649
+ key = /** @type {LiteralNode} */ (
22650
+ /** @type {ExpressionNode} */ (
22651
+ /** @type {BodyNode} */ (expr).toWatch[0]
22652
+ )?.test
22653
+ )?.name;
22555
22654
  listener.property.push(key);
22556
22655
  break;
22557
22656
  }
22558
22657
  // 5
22559
22658
  case ASTType._LogicalExpression: {
22560
22659
  const keyList = [
22561
- get._decoratedNode.body[0].expression.left.toWatch[0]?.name,
22562
- get._decoratedNode.body[0].expression.right.toWatch[0]?.name,
22660
+ /** @type {LiteralNode} */ (
22661
+ /** @type {BodyNode} */ (/** @type {ExpressionNode} */ (expr).left)
22662
+ .toWatch[0]
22663
+ )?.name,
22664
+ /** @type {LiteralNode} */ (
22665
+ /** @type {BodyNode} */ (/** @type {ExpressionNode} */ (expr).right)
22666
+ .toWatch[0]
22667
+ )?.name,
22563
22668
  ];
22564
22669
 
22565
22670
  for (let i = 0, l = keyList.length; i < l; i++) {
@@ -22578,10 +22683,14 @@ class Scope {
22578
22683
  }
22579
22684
  // 6
22580
22685
  case ASTType._BinaryExpression: {
22581
- if (get._decoratedNode.body[0].expression.isPure) {
22582
- const expr = get._decoratedNode.body[0].expression.toWatch[0];
22686
+ if (/** @type {ExpressionNode} */ (expr).isPure) {
22687
+ const watch = /** @type {BodyNode} */ (expr).toWatch[0];
22583
22688
 
22584
- key = expr.property ? expr.property.name : expr.name;
22689
+ key = /** @type {ExpressionNode} */ (watch).property
22690
+ ? /** @type {LiteralNode} */ (
22691
+ /** @type {ExpressionNode} */ (watch).property
22692
+ ).name
22693
+ : /** @type {LiteralNode} */ (watch).name;
22585
22694
 
22586
22695
  if (!key) {
22587
22696
  throw new Error("Unable to determine key");
@@ -22589,12 +22698,16 @@ class Scope {
22589
22698
  listener.property.push(key);
22590
22699
  break;
22591
22700
  } else {
22592
- const { toWatch } = get._decoratedNode.body[0].expression;
22701
+ const { toWatch } = /** @type {BodyNode} */ (expr);
22593
22702
 
22594
22703
  for (let i = 0, l = toWatch.length; i < l; i++) {
22595
22704
  const x = toWatch[i];
22596
22705
 
22597
- const registerKey = x.property ? x.property.name : x.name;
22706
+ const registerKey = /** @type {ExpressionNode} */ (x).property
22707
+ ? /** @type {LiteralNode} */ (
22708
+ /** @type {ExpressionNode} */ (x).property
22709
+ ).name
22710
+ : /** @type {LiteralNode} */ (x).name;
22598
22711
 
22599
22712
  if (!registerKey) throw new Error("Unable to determine key");
22600
22713
 
@@ -22607,7 +22720,11 @@ class Scope {
22607
22720
  for (let i = 0, l = toWatch.length; i < l; i++) {
22608
22721
  const x = toWatch[i];
22609
22722
 
22610
- const deregisterKey = x.property ? x.property.name : x.name;
22723
+ const deregisterKey = /** @type {ExpressionNode} */ (x).property
22724
+ ? /** @type {LiteralNode} */ (
22725
+ /** @type {ExpressionNode} */ (x).property
22726
+ ).name
22727
+ : /** @type {LiteralNode} */ (x).name;
22611
22728
 
22612
22729
  this.#deregisterKey(deregisterKey, listener.id);
22613
22730
  }
@@ -22616,9 +22733,13 @@ class Scope {
22616
22733
  }
22617
22734
  // 7
22618
22735
  case ASTType._UnaryExpression: {
22619
- const expr = get._decoratedNode.body[0].expression.toWatch[0];
22736
+ const x = /** @type {BodyNode} */ (expr).toWatch[0];
22620
22737
 
22621
- key = expr.property ? expr.property.name : expr.name;
22738
+ key = /** @type {ExpressionNode} */ (x).property
22739
+ ? /** @type {LiteralNode} */ (
22740
+ /** @type {ExpressionNode} */ (x).property
22741
+ ).name
22742
+ : /** @type {LiteralNode} */ (x).name;
22622
22743
 
22623
22744
  if (!key) {
22624
22745
  throw new Error("Unable to determine key");
@@ -22628,13 +22749,15 @@ class Scope {
22628
22749
  }
22629
22750
  // 8 function
22630
22751
  case ASTType._CallExpression: {
22631
- const { toWatch } = get._decoratedNode.body[0].expression;
22752
+ const { toWatch } = /** @type {BodyNode} */ (
22753
+ /** @type {ExpressionNode} */ (expr)
22754
+ );
22632
22755
 
22633
22756
  for (let i = 0, l = toWatch.length; i < l; i++) {
22634
22757
  const x = toWatch[i];
22635
22758
 
22636
22759
  if (!isDefined(x)) continue;
22637
- this.#registerKey(x.name, listener);
22760
+ this.#registerKey(/** @type {LiteralNode} */ (x).name, listener);
22638
22761
  this.#scheduleListener([listener]);
22639
22762
  }
22640
22763
 
@@ -22643,18 +22766,25 @@ class Scope {
22643
22766
  const x = toWatch[i];
22644
22767
 
22645
22768
  if (!isDefined(x)) continue;
22646
- this.#deregisterKey(x.name, listener.id);
22769
+ this.#deregisterKey(
22770
+ /** @type {LiteralNode} */ (x).name,
22771
+ listener.id,
22772
+ );
22647
22773
  }
22648
22774
  };
22649
22775
  }
22650
22776
 
22651
22777
  // 9
22652
22778
  case ASTType._MemberExpression: {
22653
- key = get._decoratedNode.body[0].expression.property.name;
22779
+ key = /** @type {LiteralNode} */ (
22780
+ /** @type {ExpressionNode} */ (expr).property
22781
+ ).name;
22654
22782
 
22655
22783
  // array watcher
22656
22784
  if (!key) {
22657
- key = get._decoratedNode.body[0].expression.object.name;
22785
+ key = /** @type {LiteralNode} */ (
22786
+ /** @type {ExpressionNode} */ (expr).object
22787
+ ).name;
22658
22788
  }
22659
22789
 
22660
22790
  listener.property.push(key);
@@ -22681,19 +22811,23 @@ class Scope {
22681
22811
 
22682
22812
  // 10
22683
22813
  case ASTType._Identifier: {
22684
- listener.property.push(get._decoratedNode.body[0].expression.name);
22814
+ listener.property.push(/** @type {LiteralNode} */ (expr).name);
22685
22815
  break;
22686
22816
  }
22687
22817
 
22688
22818
  // 12
22689
22819
  case ASTType._ArrayExpression: {
22690
- const { elements } = get._decoratedNode.body[0].expression;
22820
+ const { elements } = /** @type {ArrayNode} */ (expr);
22691
22821
 
22692
22822
  for (let i = 0, l = elements.length; i < l; i++) {
22693
22823
  const x = elements[i];
22694
22824
 
22695
22825
  const registerKey =
22696
- x.type === ASTType._Literal ? x.value : x.toWatch[0]?.name;
22826
+ x.type === ASTType._Literal
22827
+ ? /** @type {LiteralNode} */ (x).value
22828
+ : /** @type {LiteralNode} */ (
22829
+ /** @type {BodyNode} */ (x).toWatch[0]
22830
+ )?.name;
22697
22831
 
22698
22832
  if (!registerKey) continue;
22699
22833
 
@@ -22706,7 +22840,11 @@ class Scope {
22706
22840
  const x = elements[i];
22707
22841
 
22708
22842
  const deregisterKey =
22709
- x.type === ASTType._Literal ? x.value : x.toWatch[0]?.name;
22843
+ x.type === ASTType._Literal
22844
+ ? /** @type {LiteralNode} */ (x).value
22845
+ : /** @type {LiteralNode} */ (
22846
+ /** @type {BodyNode} */ (x).toWatch[0]
22847
+ ).name;
22710
22848
 
22711
22849
  if (!deregisterKey) continue;
22712
22850
 
@@ -22717,21 +22855,25 @@ class Scope {
22717
22855
 
22718
22856
  // 14
22719
22857
  case ASTType._ObjectExpression: {
22720
- const { properties } = get._decoratedNode.body[0].expression;
22858
+ const { properties } = /** @type {ObjectNode} */ (expr);
22721
22859
 
22722
22860
  for (let i = 0, l = properties.length; i < l; i++) {
22723
- const prop = properties[i];
22861
+ const prop = /** @type {ObjectPropertyNode} */ (properties[i]);
22724
22862
 
22725
22863
  let currentKey;
22726
22864
 
22727
22865
  if (prop.key.isPure === false) {
22728
- currentKey = prop.key.name;
22729
- } else if (prop.value?.name) {
22730
- currentKey = prop.value.name;
22866
+ currentKey = /** @type {LiteralNode} */ (prop.key).name;
22867
+ } else if (/** @type {LiteralNode} */ (prop.value)?.name) {
22868
+ currentKey = /** @type {LiteralNode} */ (prop.value).name;
22731
22869
  } else {
22732
- const target = get._decoratedNode.body[0].expression.toWatch[0];
22870
+ const target = /** @type {BodyNode} */ (expr).toWatch[0];
22733
22871
 
22734
- currentKey = target.property ? target.property.name : target.name;
22872
+ currentKey = /** @type {ExpressionNode} */ (target).property
22873
+ ? /** @type {LiteralNode} */ (
22874
+ /** @type {ExpressionNode} */ (target).property
22875
+ ).name
22876
+ : /** @type {LiteralNode} */ (target).name;
22735
22877
  }
22736
22878
 
22737
22879
  if (currentKey) {
@@ -39874,11 +40016,11 @@ function registerNgModule(angular) {
39874
40016
  $animate: AnimateProvider,
39875
40017
  $$animation: AnimationProvider,
39876
40018
  $animateCss: AnimateCssProvider,
39877
- _animateCssDriver: AnimateCssDriverProvider,
39878
- _animateJs: AnimateJsProvider,
39879
- _animateJsDriver: AnimateJsDriverProvider,
39880
- _animateCache: AnimateCacheProvider,
39881
- _animateQueue: AnimateQueueProvider,
40019
+ $$animateCssDriver: AnimateCssDriverProvider,
40020
+ $$animateJs: AnimateJsProvider,
40021
+ $$animateJsDriver: AnimateJsDriverProvider,
40022
+ $$animateCache: AnimateCacheProvider,
40023
+ $$animateQueue: AnimateQueueProvider,
39882
40024
  $controller: ControllerProvider,
39883
40025
  $cookie: CookieProvider,
39884
40026
  $exceptionHandler: ExceptionHandlerProvider,
@@ -39954,7 +40096,7 @@ class Angular extends EventTarget {
39954
40096
  * @public
39955
40097
  * @type {string} `version` from `package.json`
39956
40098
  */
39957
- this.version = "0.16.0"; //inserted via rollup plugin
40099
+ this.version = "0.16.1"; //inserted via rollup plugin
39958
40100
 
39959
40101
  /**
39960
40102
  * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"