@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:39 */
1
+ /* Version: 0.16.1 - January 5, 2026 22:44:26 */
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) :
@@ -1454,11 +1454,11 @@
1454
1454
  _attrs: "$attrs",
1455
1455
  _scope: "$scope",
1456
1456
  _element: "$element",
1457
- _animateCache: "_animateCache",
1458
- _animateCssDriver: "_animateCssDriver",
1459
- _animateJs: "_animateJs",
1460
- _animateJsDriver: "_animateJsDriver",
1461
- _animateQueue: "_animateQueue",
1457
+ _animateCache: "$$animateCache",
1458
+ _animateCssDriver: "$$animateCssDriver",
1459
+ _animateJs: "$$animateJs",
1460
+ _animateJsDriver: "$$animateJsDriver",
1461
+ _animateQueue: "$$animateQueue",
1462
1462
  _animation: "$$animation",
1463
1463
  _rAFScheduler: "$$rAFScheduler",
1464
1464
  _taskTrackerFactory: "$$taskTrackerFactory",
@@ -15796,7 +15796,11 @@
15796
15796
  // scope.$watch(i, updateOptions);
15797
15797
  // });
15798
15798
  scope.$watch(
15799
- ngOptions.getWatchables._decoratedNode.body[0].expression.name,
15799
+ /** @type {import('../../core/parse/ast/ast-node.ts').LiteralNode} */ (
15800
+ /** @type {import('../../core/parse/ast/ast-node.ts').ExpressionNode} */ (
15801
+ ngOptions.getWatchables._decoratedNode.body[0]
15802
+ ).expression
15803
+ ).name,
15800
15804
  updateOptions,
15801
15805
  );
15802
15806
 
@@ -19989,6 +19993,16 @@
19989
19993
  _NGValueParameter: 17,
19990
19994
  };
19991
19995
 
19996
+ /** @typedef {import("./ast/ast-node.ts").ASTNode} ASTNode */
19997
+ /** @typedef {import("./ast/ast-node.ts").BodyNode} BodyNode */
19998
+ /** @typedef {import("./ast/ast-node.ts").ExpressionNode} ExpressionNode */
19999
+ /** @typedef {import("./ast/ast-node.ts").ArrayNode} ArrayNode */
20000
+ /** @typedef {import("./ast/ast-node.ts").LiteralNode} LiteralNode */
20001
+ /** @typedef {import("./ast/ast-node.ts").ObjectNode} ObjectNode */
20002
+ /** @typedef {import("./ast/ast-node.ts").ObjectPropertyNode} ObjectPropertyNode */
20003
+ /** @typedef {import("./interface.ts").CompiledExpression} CompiledExpression */
20004
+ /** @typedef {import("./interface.ts").CompiledExpressionFunction} CompiledExpressionFunction */
20005
+
19992
20006
  const PURITY_ABSOLUTE = 1;
19993
20007
  const PURITY_RELATIVE = 2;
19994
20008
 
@@ -20003,14 +20017,16 @@
20003
20017
 
20004
20018
  /**
20005
20019
  * Compiles the AST into a function.
20006
- * @param {import("./ast/ast.js").ASTNode} ast - The AST to compile.
20007
- * @returns {import("./interface.ts").CompiledExpression}
20020
+ * @param {ASTNode} ast - The AST to compile.
20021
+ * @returns {CompiledExpression}
20008
20022
  */
20009
20023
  compile(ast) {
20010
20024
  const decoratedNode = findConstantAndWatchExpressions(ast, this._$filter);
20011
20025
 
20012
- /** @type {import("./ast/ast.js").ASTNode} */
20013
- const assignable = assignableAST(decoratedNode);
20026
+ const { body } = /** @type {BodyNode} */ (decoratedNode);
20027
+
20028
+ /** @type {ASTNode} */
20029
+ const assignable = assignableAST(/** @type {BodyNode} */ (decoratedNode));
20014
20030
 
20015
20031
  /** @type {import("./interface.ts").CompiledExpression} */
20016
20032
  let assign;
@@ -20020,7 +20036,8 @@
20020
20036
  this.#recurse(assignable)
20021
20037
  );
20022
20038
  }
20023
- const toWatch = getInputs(decoratedNode.body);
20039
+
20040
+ const toWatch = getInputs(body);
20024
20041
 
20025
20042
  let inputs;
20026
20043
 
@@ -20038,20 +20055,28 @@
20038
20055
  watch.watchId = key;
20039
20056
  }
20040
20057
  }
20058
+ /**
20059
+ * @type {import("./interface.ts").CompiledExpressionFunction[]}
20060
+ */
20041
20061
  const expressions = [];
20042
20062
 
20043
- decoratedNode.body.forEach((expression) => {
20044
- expressions.push(this.#recurse(expression.expression));
20045
- });
20063
+ body.forEach(
20064
+ /** @param {ExpressionNode} expression */ (expression) => {
20065
+ expressions.push(this.#recurse(expression.expression));
20066
+ },
20067
+ );
20046
20068
 
20047
20069
  /** @type {import("./interface.ts").CompiledExpression} */
20070
+ // @ts-ignore
20048
20071
  const fn =
20049
- decoratedNode.body.length === 0
20072
+ body.length === 0
20050
20073
  ? () => {
20051
20074
  /* empty */
20052
20075
  }
20053
- : decoratedNode.body.length === 1
20054
- ? expressions[0]
20076
+ : body.length === 1
20077
+ ? /** @type {import("./interface.ts").CompiledExpression} */ (
20078
+ expressions[0]
20079
+ )
20055
20080
  : function (scope, locals) {
20056
20081
  let lastValue;
20057
20082
 
@@ -20069,14 +20094,14 @@
20069
20094
  if (inputs) {
20070
20095
  fn._inputs = inputs;
20071
20096
  }
20072
- fn._decoratedNode = decoratedNode;
20097
+ fn._decoratedNode = /** @type {BodyNode} */ (decoratedNode);
20073
20098
 
20074
20099
  return fn;
20075
20100
  }
20076
20101
 
20077
20102
  /**
20078
20103
  * Recurses the AST nodes.
20079
- * @param {import("./ast/ast").ASTNode} ast - The AST node.
20104
+ * @param {ExpressionNode & LiteralNode} ast - The AST node.
20080
20105
  * @param {Object} [context] - The context.
20081
20106
  * @param {boolean|1} [create] - The create flag.
20082
20107
  * @returns {import("./interface.ts").CompiledExpressionFunction} The recursive function.
@@ -20122,7 +20147,7 @@
20122
20147
  left = this.#recurse(ast.object, false, !!create);
20123
20148
 
20124
20149
  if (!ast.computed) {
20125
- right = ast.property.name;
20150
+ right = /** @type {LiteralNode} */ (ast.property).name;
20126
20151
  }
20127
20152
 
20128
20153
  if (ast.computed) right = this.#recurse(ast.property);
@@ -20144,13 +20169,22 @@
20144
20169
  );
20145
20170
  case ASTType._CallExpression:
20146
20171
  args = [];
20147
- ast.arguments.forEach((expr) => {
20172
+ /** @type {ExpressionNode} */ (ast).arguments.forEach((expr) => {
20148
20173
  args.push(self.#recurse(expr));
20149
20174
  });
20150
20175
 
20151
- if (ast.filter) right = this._$filter(ast.callee.name);
20176
+ if (/** @type {ExpressionNode} */ (ast).filter)
20177
+ right = this._$filter(
20178
+ /** @type {LiteralNode} */ (
20179
+ /** @type {ExpressionNode} */ (ast).callee
20180
+ ).name,
20181
+ );
20152
20182
 
20153
- if (!ast.filter) right = this.#recurse(ast.callee, true);
20183
+ if (!(/** @type {ExpressionNode} */ (ast).filter))
20184
+ right = this.#recurse(
20185
+ /** @type {ExpressionNode} */ (ast).callee,
20186
+ true,
20187
+ );
20154
20188
 
20155
20189
  return ast.filter
20156
20190
  ? (scope, locals, assign) => {
@@ -20213,7 +20247,7 @@
20213
20247
  };
20214
20248
  case ASTType._ArrayExpression:
20215
20249
  args = [];
20216
- ast.elements.forEach((expr) => {
20250
+ /** @type {ArrayNode} */ (ast).elements.forEach((expr) => {
20217
20251
  args.push(self.#recurse(expr));
20218
20252
  });
20219
20253
 
@@ -20228,24 +20262,26 @@
20228
20262
  };
20229
20263
  case ASTType._ObjectExpression:
20230
20264
  args = [];
20231
- ast.properties.forEach((property) => {
20232
- if (property.computed) {
20233
- args.push({
20234
- key: self.#recurse(property.key),
20235
- computed: true,
20236
- value: self.#recurse(property.value),
20237
- });
20238
- } else {
20239
- args.push({
20240
- key:
20241
- property.key.type === ASTType._Identifier
20242
- ? property.key.name
20243
- : `${property.key.value}`,
20244
- computed: false,
20245
- value: self.#recurse(property.value),
20246
- });
20247
- }
20248
- });
20265
+ /** @type {ObjectNode} */ (ast).properties.forEach(
20266
+ /** @param {ObjectPropertyNode} property */ (property) => {
20267
+ if (property.computed) {
20268
+ args.push({
20269
+ key: self.#recurse(property.key),
20270
+ computed: true,
20271
+ value: self.#recurse(property.value),
20272
+ });
20273
+ } else {
20274
+ args.push({
20275
+ key:
20276
+ property.key.type === ASTType._Identifier
20277
+ ? /** @type {LiteralNode} */ (property.key).name
20278
+ : `${/** @type {LiteralNode} */ (property.key).value}`,
20279
+ computed: false,
20280
+ value: self.#recurse(property.value),
20281
+ });
20282
+ }
20283
+ },
20284
+ );
20249
20285
 
20250
20286
  return (scope, locals, assign) => {
20251
20287
  const value = {};
@@ -20685,19 +20721,18 @@
20685
20721
  }
20686
20722
 
20687
20723
  /**
20688
- * @typedef {import("./ast/ast").ASTNode & {
20689
- * isPure: boolean|number,
20690
- * constant: boolean,
20691
- * toWatch: Array,
20692
- * }} DecoratedASTNode
20693
- */
20694
-
20695
- /**
20696
- * Decorates AST with constant, toWatch, and isPure properties
20697
- * @param {import("./ast/ast").ASTNode} ast
20698
- * @param {ng.FilterService} $filter
20699
- * @param {boolean|1|2} [parentIsPure]
20700
- * @returns {DecoratedASTNode}
20724
+ * Decorates an AST node with constant, toWatch, and isPure metadata.
20725
+ *
20726
+ * This function recursively traverses the AST and sets:
20727
+ * - `constant` → whether the node is a constant expression
20728
+ * - `toWatch` → list of expressions to observe for changes
20729
+ * - `isPure` → whether the expression is pure (Angular-specific)
20730
+ *
20731
+ * @param {ASTNode} ast - The AST node to decorate
20732
+ * @param {ng.FilterService} $filter - Angular filter service
20733
+ * @param {boolean|1|2} [parentIsPure] - Optional flag indicating purity of the parent node
20734
+ * @returns {ASTNode} The same node, now decorated
20735
+ * @throws {Error} If the AST type is unknown
20701
20736
  */
20702
20737
  function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
20703
20738
  let allConstants;
@@ -20706,7 +20741,7 @@
20706
20741
 
20707
20742
  let isFilter;
20708
20743
 
20709
- const decoratedNode = /** @type {DecoratedASTNode} */ (ast);
20744
+ const decoratedNode = /** @type {BodyNode & ExpressionNode} */ (ast);
20710
20745
 
20711
20746
  let decoratedLeft,
20712
20747
  decoratedRight,
@@ -20722,9 +20757,13 @@
20722
20757
  switch (ast.type) {
20723
20758
  case ASTType._Program:
20724
20759
  allConstants = true;
20725
- decoratedNode.body.forEach((expr) => {
20760
+ /** @type {import("./ast/ast-node.ts").BodyNode} */ (
20761
+ decoratedNode
20762
+ ).body.forEach((expr) => {
20726
20763
  const decorated = findConstantAndWatchExpressions(
20727
- expr.expression,
20764
+ /** @type {import("./ast/ast-node.ts").ExpressionStatementNode} */ (
20765
+ expr
20766
+ ).expression,
20728
20767
  $filter,
20729
20768
  astIsPure,
20730
20769
  );
@@ -20739,21 +20778,24 @@
20739
20778
  decoratedNode.toWatch = [];
20740
20779
 
20741
20780
  return decoratedNode;
20742
- case ASTType._UnaryExpression:
20743
- // eslint-disable-next-line no-var
20744
- var decorated = findConstantAndWatchExpressions(
20745
- decoratedNode.argument,
20746
- $filter,
20747
- astIsPure,
20781
+ case ASTType._UnaryExpression: {
20782
+ /** @type {BodyNode} */
20783
+ const decorated = /** @type {BodyNode} */ (
20784
+ findConstantAndWatchExpressions(
20785
+ decoratedNode.argument,
20786
+ $filter,
20787
+ astIsPure,
20788
+ )
20748
20789
  );
20749
20790
 
20750
20791
  decoratedNode.constant = decorated.constant;
20751
- decoratedNode.toWatch = decorated.toWatch;
20792
+ decoratedNode.toWatch = decorated.toWatch || [];
20752
20793
 
20753
20794
  return decoratedNode;
20795
+ }
20754
20796
  case ASTType._BinaryExpression:
20755
20797
  decoratedLeft = findConstantAndWatchExpressions(
20756
- decoratedNode.left,
20798
+ /** @type {ASTNode} */ (decoratedNode.left),
20757
20799
  $filter,
20758
20800
  astIsPure,
20759
20801
  );
@@ -20764,14 +20806,16 @@
20764
20806
  );
20765
20807
  decoratedNode.constant =
20766
20808
  decoratedLeft.constant && decoratedRight.constant;
20767
- decoratedNode.toWatch = decoratedLeft.toWatch.concat(
20768
- decoratedRight.toWatch,
20809
+ decoratedNode.toWatch = /** @type {ASTNode[]} */ (
20810
+ /** @type {BodyNode} */ (decoratedLeft).toWatch.concat(
20811
+ /** @type {BodyNode} */ (decoratedRight).toWatch,
20812
+ )
20769
20813
  );
20770
20814
 
20771
20815
  return decoratedNode;
20772
20816
  case ASTType._LogicalExpression:
20773
20817
  decoratedLeft = findConstantAndWatchExpressions(
20774
- decoratedNode.left,
20818
+ /** @type {ASTNode} */ (decoratedNode.left),
20775
20819
  $filter,
20776
20820
  astIsPure,
20777
20821
  );
@@ -20787,17 +20831,17 @@
20787
20831
  return decoratedNode;
20788
20832
  case ASTType._ConditionalExpression:
20789
20833
  decoratedTest = findConstantAndWatchExpressions(
20790
- ast.test,
20834
+ /** @type {ExpressionNode} */ (ast).test,
20791
20835
  $filter,
20792
20836
  astIsPure,
20793
20837
  );
20794
20838
  decoratedAlternate = findConstantAndWatchExpressions(
20795
- ast.alternate,
20839
+ /** @type {ExpressionNode} */ (ast).alternate,
20796
20840
  $filter,
20797
20841
  astIsPure,
20798
20842
  );
20799
20843
  decoratedConsequent = findConstantAndWatchExpressions(
20800
- ast.consequent,
20844
+ /** @type {ExpressionNode} */ (ast).consequent,
20801
20845
  $filter,
20802
20846
  astIsPure,
20803
20847
  );
@@ -20815,14 +20859,14 @@
20815
20859
  return decoratedNode;
20816
20860
  case ASTType._MemberExpression:
20817
20861
  decoratedObject = findConstantAndWatchExpressions(
20818
- ast.object,
20862
+ /** @type {ExpressionNode} */ (ast).object,
20819
20863
  $filter,
20820
20864
  astIsPure,
20821
20865
  );
20822
20866
 
20823
- if (ast.computed) {
20867
+ if (/** @type {ExpressionNode} */ (ast).computed) {
20824
20868
  decoratedProperty = findConstantAndWatchExpressions(
20825
- ast.property,
20869
+ /** @type {ExpressionNode} */ (ast).property,
20826
20870
  $filter,
20827
20871
  astIsPure,
20828
20872
  );
@@ -20834,13 +20878,21 @@
20834
20878
 
20835
20879
  return decoratedNode;
20836
20880
  case ASTType._CallExpression:
20837
- isFilter = ast.filter;
20881
+ isFilter = /** @type {ExpressionNode} */ (ast).filter;
20838
20882
  allConstants = isFilter;
20839
20883
  argsToWatch = [];
20840
- ast.arguments.forEach((expr) => {
20841
- decorated = findConstantAndWatchExpressions(expr, $filter, astIsPure);
20884
+ /** @type {ExpressionNode} */ (ast).arguments.forEach((expr) => {
20885
+ const decorated = findConstantAndWatchExpressions(
20886
+ expr,
20887
+ $filter,
20888
+ astIsPure,
20889
+ );
20890
+
20842
20891
  allConstants = allConstants && decorated.constant;
20843
- argsToWatch.push.apply(argsToWatch, decorated.toWatch);
20892
+ argsToWatch.push.apply(
20893
+ argsToWatch,
20894
+ /** @type {BodyNode} */ (decorated).toWatch,
20895
+ );
20844
20896
  });
20845
20897
  decoratedNode.constant = allConstants;
20846
20898
  decoratedNode.toWatch = isFilter ? argsToWatch : [decoratedNode];
@@ -20848,12 +20900,12 @@
20848
20900
  return decoratedNode;
20849
20901
  case ASTType._AssignmentExpression:
20850
20902
  decoratedLeft = findConstantAndWatchExpressions(
20851
- ast.left,
20903
+ /** @type {ASTNode} */ (/** @type {ExpressionNode} */ (ast).left),
20852
20904
  $filter,
20853
20905
  astIsPure,
20854
20906
  );
20855
20907
  decoratedRight = findConstantAndWatchExpressions(
20856
- ast.right,
20908
+ /** @type {ASTNode} */ (/** @type {ExpressionNode} */ (ast).right),
20857
20909
  $filter,
20858
20910
  astIsPure,
20859
20911
  );
@@ -20865,10 +20917,18 @@
20865
20917
  case ASTType._ArrayExpression:
20866
20918
  allConstants = true;
20867
20919
  argsToWatch = [];
20868
- ast.elements.forEach((expr) => {
20869
- decorated = findConstantAndWatchExpressions(expr, $filter, astIsPure);
20920
+ /** @type {ArrayNode} */ (ast).elements.forEach((expr) => {
20921
+ const decorated = findConstantAndWatchExpressions(
20922
+ expr,
20923
+ $filter,
20924
+ astIsPure,
20925
+ );
20926
+
20870
20927
  allConstants = allConstants && decorated.constant;
20871
- argsToWatch.push.apply(argsToWatch, decorated.toWatch);
20928
+ argsToWatch.push.apply(
20929
+ argsToWatch,
20930
+ /** @type {BodyNode} */ (decorated).toWatch,
20931
+ );
20872
20932
  });
20873
20933
  decoratedNode.constant = allConstants;
20874
20934
  decoratedNode.toWatch = argsToWatch;
@@ -20877,24 +20937,31 @@
20877
20937
  case ASTType._ObjectExpression:
20878
20938
  allConstants = true;
20879
20939
  argsToWatch = [];
20880
- ast.properties.forEach((property) => {
20881
- decorated = findConstantAndWatchExpressions(
20882
- property.value,
20940
+ /** @type {ObjectNode} */ (ast).properties.forEach((property) => {
20941
+ const decorated = findConstantAndWatchExpressions(
20942
+ /** @type {LiteralNode} */ (property).value,
20883
20943
  $filter,
20884
20944
  astIsPure,
20885
20945
  );
20946
+
20886
20947
  allConstants = allConstants && decorated.constant;
20887
- argsToWatch.push.apply(argsToWatch, decorated.toWatch);
20948
+ argsToWatch.push.apply(
20949
+ argsToWatch,
20950
+ /** @type {BodyNode} */ (decorated).toWatch,
20951
+ );
20888
20952
 
20889
- if (property.computed) {
20953
+ if (/** @type {ExpressionNode} */ (property).computed) {
20890
20954
  // `{[key]: value}` implicitly does `key.toString()` which may be non-pure
20891
20955
  decoratedKey = findConstantAndWatchExpressions(
20892
- property.key,
20956
+ /** @type {ObjectPropertyNode} */ (property).key,
20893
20957
  $filter,
20894
20958
  false,
20895
20959
  );
20896
20960
  allConstants = allConstants && decoratedKey.constant;
20897
- argsToWatch.push.apply(argsToWatch, decoratedKey.toWatch);
20961
+ argsToWatch.push.apply(
20962
+ argsToWatch,
20963
+ /** @type {BodyNode} */ (decorated).toWatch,
20964
+ );
20898
20965
  }
20899
20966
  });
20900
20967
  decoratedNode.constant = allConstants;
@@ -20911,23 +20978,31 @@
20911
20978
  decoratedNode.toWatch = [];
20912
20979
 
20913
20980
  return decoratedNode;
20981
+ default:
20982
+ throw new Error(`Unknown AST node type: ${ast.type}`);
20914
20983
  }
20915
-
20916
- return undefined;
20917
20984
  }
20918
20985
 
20919
20986
  /**
20920
20987
  * Converts a single expression AST node into an assignment expression if the expression is assignable.
20921
20988
  *
20922
- * @param {import("./ast/ast").ASTNode} ast
20923
- * @returns {import("./ast/ast").ASTNode}
20989
+ * @param {import("./ast/ast-node.ts").BodyNode} ast
20990
+ * @returns {import("./ast/ast-node.ts").ExpressionNode | undefined}
20924
20991
  */
20925
20992
  function assignableAST(ast) {
20926
- if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
20993
+ const stmt = /** @type {import("./ast/ast-node.ts").ExpressionNode} */ (
20994
+ ast.body[0]
20995
+ );
20996
+
20997
+ if (
20998
+ ast.body.length === 1 &&
20999
+ stmt?.expression &&
21000
+ isAssignable(stmt.expression)
21001
+ ) {
20927
21002
  return {
20928
21003
  type: ASTType._AssignmentExpression,
20929
- left: ast.body[0].expression,
20930
- right: { type: ASTType._NGValueParameter },
21004
+ left: stmt.expression, // left-hand side is an expression
21005
+ right: { type: ASTType._NGValueParameter }, // right-hand side leaf expression
20931
21006
  operator: "=",
20932
21007
  };
20933
21008
  }
@@ -20945,14 +21020,14 @@
20945
21020
 
20946
21021
  /**
20947
21022
  *
20948
- * @param {import("./ast/ast").ASTNode[]} body
21023
+ * @param {ASTNode[]} body
20949
21024
  * @returns {any}
20950
21025
  */
20951
21026
  function getInputs(body) {
20952
21027
  if (body.length !== 1) return undefined;
20953
- const lastExpression = /** @type {DecoratedASTNode} */ (body[0].expression);
21028
+ const lastExpression = /** @type {ExpressionNode} */ (body[0]).expression;
20954
21029
 
20955
- const candidate = lastExpression.toWatch;
21030
+ const candidate = /** @type {BodyNode} */ (lastExpression).toWatch;
20956
21031
 
20957
21032
  if (candidate.length !== 1) return candidate;
20958
21033
 
@@ -20961,15 +21036,15 @@
20961
21036
 
20962
21037
  /**
20963
21038
  * Detect nodes which could depend on non-shallow state of objects
20964
- * @param {import("./ast/ast").ASTNode} node
21039
+ * @param {ASTNode} node
20965
21040
  * @param {boolean|PURITY_ABSOLUTE|PURITY_RELATIVE} parentIsPure
20966
- * @returns {boolean|PURITY_ABSOLUTE|PURITY_RELATIVE}
21041
+ * @returns {number|boolean}
20967
21042
  */
20968
21043
  function isPure(node, parentIsPure) {
20969
21044
  switch (node.type) {
20970
21045
  // Computed members might invoke a stateful toString()
20971
21046
  case ASTType._MemberExpression:
20972
- if (node.computed) {
21047
+ if (/** @type {ExpressionNode} */ (node).computed) {
20973
21048
  return false;
20974
21049
  }
20975
21050
  break;
@@ -20980,7 +21055,9 @@
20980
21055
 
20981
21056
  // The binary + operator can invoke a stateful toString().
20982
21057
  case ASTType._BinaryExpression:
20983
- return node.operator !== "+" ? PURITY_ABSOLUTE : false;
21058
+ return /** @type {ExpressionNode} */ (node).operator !== "+"
21059
+ ? PURITY_ABSOLUTE
21060
+ : false;
20984
21061
 
20985
21062
  // Functions / filters probably read state from within objects
20986
21063
  case ASTType._CallExpression:
@@ -21027,9 +21104,6 @@
21027
21104
  undefined,
21028
21105
  };
21029
21106
 
21030
- /**
21031
- * @class
21032
- */
21033
21107
  class AST {
21034
21108
  /**
21035
21109
  * @param {import('../lexer/lexer.js').Lexer} lexer - The lexer instance for tokenizing input
@@ -21480,7 +21554,7 @@
21480
21554
  /** @type {ASTNode[]} */
21481
21555
  const properties = [];
21482
21556
 
21483
- /** @type {ASTNode} */
21557
+ /** @type {import("./ast-node.ts").ObjectPropertyNode} */
21484
21558
  let property;
21485
21559
 
21486
21560
  if (this._peekToken().text !== "}") {
@@ -21489,7 +21563,10 @@
21489
21563
  // Support trailing commas per ES5.1.
21490
21564
  break;
21491
21565
  }
21492
- property = { type: ASTType._Property, kind: "init" };
21566
+ property = /** @type {import("./ast-node.ts").ObjectPropertyNode} */ ({
21567
+ type: ASTType._Property,
21568
+ kind: "init",
21569
+ });
21493
21570
 
21494
21571
  if (/** @type {Token} */ (this._peek()).constant) {
21495
21572
  property.key = this._constant();
@@ -21661,7 +21738,9 @@
21661
21738
 
21662
21739
  const fn = this._astCompiler.compile(ast);
21663
21740
 
21664
- fn._literal = isLiteral(ast);
21741
+ fn._literal = isLiteral(
21742
+ /** @type {import("../ast/ast-node.ts").BodyNode} */ (ast),
21743
+ );
21665
21744
  fn.constant = !!ast.constant;
21666
21745
 
21667
21746
  return fn;
@@ -21669,7 +21748,7 @@
21669
21748
  }
21670
21749
 
21671
21750
  /**
21672
- * @param {import("../ast/ast-node.ts").ASTNode} ast
21751
+ * @param {import("../ast/ast-node.ts").BodyNode} ast
21673
21752
  * @returns {boolean}
21674
21753
  */
21675
21754
  function isLiteral(ast) {
@@ -21681,7 +21760,10 @@
21681
21760
  }
21682
21761
 
21683
21762
  if (body && body.length === 1) {
21684
- switch (body[0].expression?.type) {
21763
+ switch (
21764
+ /** @type {import("../ast/ast-node.ts").ExpressionNode} */ (body[0])
21765
+ .expression?.type
21766
+ ) {
21685
21767
  case ASTType._Literal:
21686
21768
  case ASTType._ArrayExpression:
21687
21769
  case ASTType._ObjectExpression:
@@ -21694,6 +21776,8 @@
21694
21776
  }
21695
21777
  }
21696
21778
 
21779
+ const lexer = new Lexer();
21780
+
21697
21781
  class ParseProvider {
21698
21782
  constructor() {
21699
21783
  const cache = Object.create(null);
@@ -21720,8 +21804,6 @@
21720
21804
  parsedExpression = cache[cacheKey];
21721
21805
 
21722
21806
  if (!parsedExpression) {
21723
- const lexer = new Lexer();
21724
-
21725
21807
  const parser = new Parser(lexer, $filter);
21726
21808
 
21727
21809
  parsedExpression = parser._parse(exp);
@@ -21774,6 +21856,13 @@
21774
21856
  }
21775
21857
  }
21776
21858
 
21859
+ /** @typedef {import("../parse/ast/ast-node.ts").ExpressionNode} ExpressionNode */
21860
+ /** @typedef {import("../parse/ast/ast-node.ts").LiteralNode} LiteralNode */
21861
+ /** @typedef {import("../parse/ast/ast-node.ts").BodyNode} BodyNode */
21862
+ /** @typedef {import("../parse/ast/ast-node.ts").ArrayNode} ArrayNode */
21863
+ /** @typedef {import("../parse/ast/ast-node.ts").ObjectNode} ObjectNode */
21864
+ /** @typedef {import("../parse/ast/ast-node.ts").ObjectPropertyNode} ObjectPropertyNode */
21865
+
21777
21866
  /**
21778
21867
  * @type {number}
21779
21868
  */
@@ -22523,6 +22612,10 @@
22523
22612
  };
22524
22613
  }
22525
22614
 
22615
+ const expr = /** @type {ExpressionNode & BodyNode} */ (
22616
+ get._decoratedNode.body[0]
22617
+ ).expression;
22618
+
22526
22619
  /** @type {ng.Listener} */
22527
22620
  const listener = {
22528
22621
  originalTarget: this.$target,
@@ -22534,11 +22627,11 @@
22534
22627
  };
22535
22628
 
22536
22629
  // simplest case
22537
- let key = get._decoratedNode.body[0].expression.name;
22630
+ let key = /** @type {LiteralNode} */ (expr).name;
22538
22631
 
22539
22632
  const keySet = [];
22540
22633
 
22541
- const { type } = get._decoratedNode.body[0].expression;
22634
+ const { type } = expr;
22542
22635
 
22543
22636
  switch (type) {
22544
22637
  // 3
@@ -22553,19 +22646,31 @@
22553
22646
 
22554
22647
  return undefined;
22555
22648
  }
22556
- key = get._decoratedNode.body[0].expression.left.name;
22649
+ key = /** @type {LiteralNode} */ (
22650
+ /** @type {ExpressionNode} */ (expr).left
22651
+ )?.name;
22557
22652
  break;
22558
22653
  // 4
22559
22654
  case ASTType._ConditionalExpression: {
22560
- key = get._decoratedNode.body[0].expression.toWatch[0]?.test?.name;
22655
+ key = /** @type {LiteralNode} */ (
22656
+ /** @type {ExpressionNode} */ (
22657
+ /** @type {BodyNode} */ (expr).toWatch[0]
22658
+ )?.test
22659
+ )?.name;
22561
22660
  listener.property.push(key);
22562
22661
  break;
22563
22662
  }
22564
22663
  // 5
22565
22664
  case ASTType._LogicalExpression: {
22566
22665
  const keyList = [
22567
- get._decoratedNode.body[0].expression.left.toWatch[0]?.name,
22568
- get._decoratedNode.body[0].expression.right.toWatch[0]?.name,
22666
+ /** @type {LiteralNode} */ (
22667
+ /** @type {BodyNode} */ (/** @type {ExpressionNode} */ (expr).left)
22668
+ .toWatch[0]
22669
+ )?.name,
22670
+ /** @type {LiteralNode} */ (
22671
+ /** @type {BodyNode} */ (/** @type {ExpressionNode} */ (expr).right)
22672
+ .toWatch[0]
22673
+ )?.name,
22569
22674
  ];
22570
22675
 
22571
22676
  for (let i = 0, l = keyList.length; i < l; i++) {
@@ -22584,10 +22689,14 @@
22584
22689
  }
22585
22690
  // 6
22586
22691
  case ASTType._BinaryExpression: {
22587
- if (get._decoratedNode.body[0].expression.isPure) {
22588
- const expr = get._decoratedNode.body[0].expression.toWatch[0];
22692
+ if (/** @type {ExpressionNode} */ (expr).isPure) {
22693
+ const watch = /** @type {BodyNode} */ (expr).toWatch[0];
22589
22694
 
22590
- key = expr.property ? expr.property.name : expr.name;
22695
+ key = /** @type {ExpressionNode} */ (watch).property
22696
+ ? /** @type {LiteralNode} */ (
22697
+ /** @type {ExpressionNode} */ (watch).property
22698
+ ).name
22699
+ : /** @type {LiteralNode} */ (watch).name;
22591
22700
 
22592
22701
  if (!key) {
22593
22702
  throw new Error("Unable to determine key");
@@ -22595,12 +22704,16 @@
22595
22704
  listener.property.push(key);
22596
22705
  break;
22597
22706
  } else {
22598
- const { toWatch } = get._decoratedNode.body[0].expression;
22707
+ const { toWatch } = /** @type {BodyNode} */ (expr);
22599
22708
 
22600
22709
  for (let i = 0, l = toWatch.length; i < l; i++) {
22601
22710
  const x = toWatch[i];
22602
22711
 
22603
- const registerKey = x.property ? x.property.name : x.name;
22712
+ const registerKey = /** @type {ExpressionNode} */ (x).property
22713
+ ? /** @type {LiteralNode} */ (
22714
+ /** @type {ExpressionNode} */ (x).property
22715
+ ).name
22716
+ : /** @type {LiteralNode} */ (x).name;
22604
22717
 
22605
22718
  if (!registerKey) throw new Error("Unable to determine key");
22606
22719
 
@@ -22613,7 +22726,11 @@
22613
22726
  for (let i = 0, l = toWatch.length; i < l; i++) {
22614
22727
  const x = toWatch[i];
22615
22728
 
22616
- const deregisterKey = x.property ? x.property.name : x.name;
22729
+ const deregisterKey = /** @type {ExpressionNode} */ (x).property
22730
+ ? /** @type {LiteralNode} */ (
22731
+ /** @type {ExpressionNode} */ (x).property
22732
+ ).name
22733
+ : /** @type {LiteralNode} */ (x).name;
22617
22734
 
22618
22735
  this.#deregisterKey(deregisterKey, listener.id);
22619
22736
  }
@@ -22622,9 +22739,13 @@
22622
22739
  }
22623
22740
  // 7
22624
22741
  case ASTType._UnaryExpression: {
22625
- const expr = get._decoratedNode.body[0].expression.toWatch[0];
22742
+ const x = /** @type {BodyNode} */ (expr).toWatch[0];
22626
22743
 
22627
- key = expr.property ? expr.property.name : expr.name;
22744
+ key = /** @type {ExpressionNode} */ (x).property
22745
+ ? /** @type {LiteralNode} */ (
22746
+ /** @type {ExpressionNode} */ (x).property
22747
+ ).name
22748
+ : /** @type {LiteralNode} */ (x).name;
22628
22749
 
22629
22750
  if (!key) {
22630
22751
  throw new Error("Unable to determine key");
@@ -22634,13 +22755,15 @@
22634
22755
  }
22635
22756
  // 8 function
22636
22757
  case ASTType._CallExpression: {
22637
- const { toWatch } = get._decoratedNode.body[0].expression;
22758
+ const { toWatch } = /** @type {BodyNode} */ (
22759
+ /** @type {ExpressionNode} */ (expr)
22760
+ );
22638
22761
 
22639
22762
  for (let i = 0, l = toWatch.length; i < l; i++) {
22640
22763
  const x = toWatch[i];
22641
22764
 
22642
22765
  if (!isDefined(x)) continue;
22643
- this.#registerKey(x.name, listener);
22766
+ this.#registerKey(/** @type {LiteralNode} */ (x).name, listener);
22644
22767
  this.#scheduleListener([listener]);
22645
22768
  }
22646
22769
 
@@ -22649,18 +22772,25 @@
22649
22772
  const x = toWatch[i];
22650
22773
 
22651
22774
  if (!isDefined(x)) continue;
22652
- this.#deregisterKey(x.name, listener.id);
22775
+ this.#deregisterKey(
22776
+ /** @type {LiteralNode} */ (x).name,
22777
+ listener.id,
22778
+ );
22653
22779
  }
22654
22780
  };
22655
22781
  }
22656
22782
 
22657
22783
  // 9
22658
22784
  case ASTType._MemberExpression: {
22659
- key = get._decoratedNode.body[0].expression.property.name;
22785
+ key = /** @type {LiteralNode} */ (
22786
+ /** @type {ExpressionNode} */ (expr).property
22787
+ ).name;
22660
22788
 
22661
22789
  // array watcher
22662
22790
  if (!key) {
22663
- key = get._decoratedNode.body[0].expression.object.name;
22791
+ key = /** @type {LiteralNode} */ (
22792
+ /** @type {ExpressionNode} */ (expr).object
22793
+ ).name;
22664
22794
  }
22665
22795
 
22666
22796
  listener.property.push(key);
@@ -22687,19 +22817,23 @@
22687
22817
 
22688
22818
  // 10
22689
22819
  case ASTType._Identifier: {
22690
- listener.property.push(get._decoratedNode.body[0].expression.name);
22820
+ listener.property.push(/** @type {LiteralNode} */ (expr).name);
22691
22821
  break;
22692
22822
  }
22693
22823
 
22694
22824
  // 12
22695
22825
  case ASTType._ArrayExpression: {
22696
- const { elements } = get._decoratedNode.body[0].expression;
22826
+ const { elements } = /** @type {ArrayNode} */ (expr);
22697
22827
 
22698
22828
  for (let i = 0, l = elements.length; i < l; i++) {
22699
22829
  const x = elements[i];
22700
22830
 
22701
22831
  const registerKey =
22702
- x.type === ASTType._Literal ? x.value : x.toWatch[0]?.name;
22832
+ x.type === ASTType._Literal
22833
+ ? /** @type {LiteralNode} */ (x).value
22834
+ : /** @type {LiteralNode} */ (
22835
+ /** @type {BodyNode} */ (x).toWatch[0]
22836
+ )?.name;
22703
22837
 
22704
22838
  if (!registerKey) continue;
22705
22839
 
@@ -22712,7 +22846,11 @@
22712
22846
  const x = elements[i];
22713
22847
 
22714
22848
  const deregisterKey =
22715
- x.type === ASTType._Literal ? x.value : x.toWatch[0]?.name;
22849
+ x.type === ASTType._Literal
22850
+ ? /** @type {LiteralNode} */ (x).value
22851
+ : /** @type {LiteralNode} */ (
22852
+ /** @type {BodyNode} */ (x).toWatch[0]
22853
+ ).name;
22716
22854
 
22717
22855
  if (!deregisterKey) continue;
22718
22856
 
@@ -22723,21 +22861,25 @@
22723
22861
 
22724
22862
  // 14
22725
22863
  case ASTType._ObjectExpression: {
22726
- const { properties } = get._decoratedNode.body[0].expression;
22864
+ const { properties } = /** @type {ObjectNode} */ (expr);
22727
22865
 
22728
22866
  for (let i = 0, l = properties.length; i < l; i++) {
22729
- const prop = properties[i];
22867
+ const prop = /** @type {ObjectPropertyNode} */ (properties[i]);
22730
22868
 
22731
22869
  let currentKey;
22732
22870
 
22733
22871
  if (prop.key.isPure === false) {
22734
- currentKey = prop.key.name;
22735
- } else if (prop.value?.name) {
22736
- currentKey = prop.value.name;
22872
+ currentKey = /** @type {LiteralNode} */ (prop.key).name;
22873
+ } else if (/** @type {LiteralNode} */ (prop.value)?.name) {
22874
+ currentKey = /** @type {LiteralNode} */ (prop.value).name;
22737
22875
  } else {
22738
- const target = get._decoratedNode.body[0].expression.toWatch[0];
22876
+ const target = /** @type {BodyNode} */ (expr).toWatch[0];
22739
22877
 
22740
- currentKey = target.property ? target.property.name : target.name;
22878
+ currentKey = /** @type {ExpressionNode} */ (target).property
22879
+ ? /** @type {LiteralNode} */ (
22880
+ /** @type {ExpressionNode} */ (target).property
22881
+ ).name
22882
+ : /** @type {LiteralNode} */ (target).name;
22741
22883
  }
22742
22884
 
22743
22885
  if (currentKey) {
@@ -39880,11 +40022,11 @@
39880
40022
  $animate: AnimateProvider,
39881
40023
  $$animation: AnimationProvider,
39882
40024
  $animateCss: AnimateCssProvider,
39883
- _animateCssDriver: AnimateCssDriverProvider,
39884
- _animateJs: AnimateJsProvider,
39885
- _animateJsDriver: AnimateJsDriverProvider,
39886
- _animateCache: AnimateCacheProvider,
39887
- _animateQueue: AnimateQueueProvider,
40025
+ $$animateCssDriver: AnimateCssDriverProvider,
40026
+ $$animateJs: AnimateJsProvider,
40027
+ $$animateJsDriver: AnimateJsDriverProvider,
40028
+ $$animateCache: AnimateCacheProvider,
40029
+ $$animateQueue: AnimateQueueProvider,
39888
40030
  $controller: ControllerProvider,
39889
40031
  $cookie: CookieProvider,
39890
40032
  $exceptionHandler: ExceptionHandlerProvider,
@@ -39960,7 +40102,7 @@
39960
40102
  * @public
39961
40103
  * @type {string} `version` from `package.json`
39962
40104
  */
39963
- this.version = "0.16.0"; //inserted via rollup plugin
40105
+ this.version = "0.16.1"; //inserted via rollup plugin
39964
40106
 
39965
40107
  /**
39966
40108
  * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"