@angular-wave/angular.ts 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /* Version: 0.10.0 - November 8, 2025 10:37:13 */
1
+ /* Version: 0.11.0 - November 11, 2025 21:55:55 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -1903,7 +1903,7 @@
1903
1903
  * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
1904
1904
  *
1905
1905
  * @param {Element} element - The DOM element to get data from.
1906
- * @param {string} [name] - The DOM element to get data from.
1906
+ * @param {string} [name] - Controller name.
1907
1907
  * @returns {import("../core/scope/scope.js").Scope|undefined} - The retrieved data
1908
1908
  */
1909
1909
  function getController(element, name) {
@@ -2053,7 +2053,7 @@
2053
2053
  /**
2054
2054
  * Return instance of InjectorService attached to element
2055
2055
  * @param {Element} element
2056
- * @returns {import('../core/di/internal-injector.js').InjectorService}
2056
+ * @returns {ng.InjectorService}
2057
2057
  */
2058
2058
  function getInjector(element) {
2059
2059
  return getInheritedData(element, "$injector");
@@ -2113,6 +2113,26 @@
2113
2113
  }
2114
2114
  }
2115
2115
 
2116
+ function animatedomInsert(element, parent, after) {
2117
+ const originalVisibility = element.style.visibility;
2118
+ const originalPosition = element.style.position;
2119
+ const originalPointerEvents = element.style.pointerEvents;
2120
+
2121
+ Object.assign(element.style, {
2122
+ visibility: "hidden",
2123
+ position: "absolute",
2124
+ pointerEvents: "none",
2125
+ });
2126
+
2127
+ domInsert(element, parent, after);
2128
+
2129
+ requestAnimationFrame(() => {
2130
+ element.style.visibility = originalVisibility;
2131
+ element.style.position = originalPosition;
2132
+ element.style.pointerEvents = originalPointerEvents;
2133
+ });
2134
+ }
2135
+
2116
2136
  /**
2117
2137
  * Returns the base href of the document.
2118
2138
  *
@@ -2144,8 +2164,6 @@
2144
2164
  $attrs: "$attrs",
2145
2165
  $scope: "$scope",
2146
2166
  $element: "$element",
2147
- $$AnimateRunner: "$$AnimateRunner",
2148
- $$animateAsyncRun: "$$animateAsyncRun",
2149
2167
  $$animateCache: "$$animateCache",
2150
2168
  $$animateCssDriver: "$$animateCssDriver",
2151
2169
  $$animateJs: "$$animateJs",
@@ -2648,6 +2666,8 @@
2648
2666
  const hasCache = hasOwn(this.cache, name);
2649
2667
  return hasProvider || hasCache;
2650
2668
  }
2669
+
2670
+ loadNewModules() {}
2651
2671
  }
2652
2672
 
2653
2673
  // Helpers
@@ -10874,9 +10894,9 @@
10874
10894
  inputDirective.$inject = ["$filter", "$parse"];
10875
10895
 
10876
10896
  /**
10877
- * @param {*} $filter
10878
- * @param {*} $parse
10879
- * @returns {import('../../interface.ts').Directive}
10897
+ * @param {ng.FilterService} $filter
10898
+ * @param {ng.ParseService} $parse
10899
+ * @returns {ng.Directive}
10880
10900
  */
10881
10901
  function inputDirective($filter, $parse) {
10882
10902
  return {
@@ -10900,7 +10920,7 @@
10900
10920
  }
10901
10921
 
10902
10922
  /**
10903
- * @returns {import('../../interface.ts').Directive}
10923
+ * @returns {ng.Directive}
10904
10924
  */
10905
10925
  function hiddenInputBrowserCacheDirective() {
10906
10926
  const valueProperty = {
@@ -10946,7 +10966,7 @@
10946
10966
  const CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
10947
10967
 
10948
10968
  /**
10949
- * @returns {import('../../interface.ts').Directive}
10969
+ * @returns {ng.Directive}
10950
10970
  */
10951
10971
  function ngValueDirective() {
10952
10972
  /**
@@ -10970,15 +10990,15 @@
10970
10990
  return {
10971
10991
  restrict: "A",
10972
10992
  priority: 100,
10973
- compile(tpl, tplAttr) {
10974
- if (CONSTANT_VALUE_REGEXP.test(tplAttr["ngValue"])) {
10975
- return function ngValueConstantLink(scope, elm, attr) {
10976
- const value = scope.$eval(attr["ngValue"]);
10993
+ compile(_, tplAttr) {
10994
+ if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
10995
+ return function (scope, elm, attr) {
10996
+ const value = scope.$eval(attr.ngValue);
10977
10997
  updateElementValue(elm, attr, value);
10978
10998
  };
10979
10999
  }
10980
- return function ngValueLink(scope, elm, attr) {
10981
- scope.$watch(attr["ngValue"], (value) => {
11000
+ return function (scope, elm, attr) {
11001
+ scope.$watch(attr.ngValue, (value) => {
10982
11002
  updateElementValue(elm, attr, value);
10983
11003
  });
10984
11004
  };
@@ -11659,17 +11679,20 @@
11659
11679
  /**
11660
11680
  * @param {string} name
11661
11681
  * @param {boolean|number} selector
11662
- * @returns {() => import("../../interface.ts").Directive}
11682
+ * @returns {ng.DirectiveFactory}
11663
11683
  */
11664
11684
  function classDirective(name, selector) {
11665
11685
  name = `ngClass${name}`;
11666
11686
 
11687
+ /**
11688
+ * @returns {ng.Directive}
11689
+ */
11667
11690
  return function () {
11668
11691
  return {
11669
11692
  /**
11670
- * @param {import("../../core/scope/scope.js").Scope} scope
11671
- * @param {Element} element
11672
- * @param {import("../../core/compile/attributes").Attributes} attr
11693
+ * @param {ng.Scope} scope
11694
+ * @param {HTMLElement} element
11695
+ * @param {ng.Attributes} attr
11673
11696
  */
11674
11697
  link(scope, element, attr) {
11675
11698
  let classCounts = getCacheData(element, "$classCounts");
@@ -11843,9 +11866,8 @@
11843
11866
  */
11844
11867
  function ngCloakDirective() {
11845
11868
  return {
11846
- compile(element, attr) {
11869
+ compile(_, attr) {
11847
11870
  attr.$set("ngCloak", undefined);
11848
- element.classList.remove("ng-cloak");
11849
11871
  },
11850
11872
  };
11851
11873
  }
@@ -11949,7 +11971,7 @@
11949
11971
  /** @type {Element} */
11950
11972
  let block;
11951
11973
 
11952
- /** @type {import('../../core/scope/scope.js').Scope} */
11974
+ /** @type {ng.Scope} */
11953
11975
  let childScope;
11954
11976
 
11955
11977
  let previousElements;
@@ -13998,7 +14020,7 @@
13998
14020
 
13999
14021
  AnimateProvider.$inject = ["$provide"];
14000
14022
 
14001
- /** @param {import('../interface.ts').Provider} $provide */
14023
+ /** @param {ng.ProvideService} $provide */
14002
14024
  function AnimateProvider($provide) {
14003
14025
  const provider = this;
14004
14026
  let classNameFilter = null;
@@ -14273,7 +14295,7 @@
14273
14295
  * Note that this does not cancel the underlying operation, e.g. the setting of classes or
14274
14296
  * adding the element to the DOM.
14275
14297
  *
14276
- * @param {import('./animate-runner.js').AnimateRunner} runner An animation runner returned by an $animate function.
14298
+ * @param {import('./runner/animate-runner.js').AnimateRunner} runner An animation runner returned by an $animate function.
14277
14299
  *
14278
14300
  * @example
14279
14301
  <example module="animationExample" deps="angular-animate.js" animations="true" name="animate-cancel">
@@ -14353,11 +14375,11 @@
14353
14375
  * @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
14354
14376
  * @param {Element} [after] - after the sibling element after which the element will be appended
14355
14377
  * @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
14356
- * @returns {import('./animate-runner.js').AnimateRunner} the animation runner
14378
+ * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14357
14379
  */
14358
14380
  enter(element, parent, after, options) {
14359
14381
  parent = parent || after.parentElement;
14360
- domInsert(element, parent, after);
14382
+ animatedomInsert(element, parent, after);
14361
14383
  return $$animateQueue.push(
14362
14384
  element,
14363
14385
  "enter",
@@ -14375,11 +14397,11 @@
14375
14397
  * @param {Element} parent - the parent element which will append the element as a child (so long as the after element is not present)
14376
14398
  * @param {Element} after - after the sibling element after which the element will be appended
14377
14399
  * @param {AnimationOptions} [options] - an optional collection of options/styles that will be applied to the element.
14378
- * @returns {import('./animate-runner.js').AnimateRunner} the animation runner
14400
+ * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14379
14401
  */
14380
14402
  move(element, parent, after, options) {
14381
14403
  parent = parent || after.parentElement;
14382
- domInsert(element, parent, after);
14404
+ animatedomInsert(element, parent, after);
14383
14405
  return $$animateQueue.push(
14384
14406
  element,
14385
14407
  "move",
@@ -14394,7 +14416,7 @@
14394
14416
  *
14395
14417
  * @param {Element} element the element which will be removed from the DOM
14396
14418
  * @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
14397
- * @returns {import('./animate-runner.js').AnimateRunner} the animation runner
14419
+ * @returns {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14398
14420
  */
14399
14421
  leave(element, options) {
14400
14422
  return $$animateQueue.push(
@@ -14423,7 +14445,7 @@
14423
14445
  * @param {Element} element the element which the CSS classes will be applied to
14424
14446
  * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
14425
14447
  * @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element.
14426
- * @return {import('./animate-runner.js').AnimateRunner}} animationRunner the animation runner
14448
+ * @return {import('./runner/animate-runner.js').AnimateRunner}} animationRunner the animation runner
14427
14449
  */
14428
14450
  addClass(element, className, options) {
14429
14451
  options = prepareAnimateOptions(options);
@@ -14442,7 +14464,7 @@
14442
14464
  * @param {Element} element the element which the CSS classes will be applied to
14443
14465
  * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
14444
14466
  * @param {AnimationOptions} [options] an optional collection of options/styles that will be applied to the element. *
14445
- * @return {import('./animate-runner.js').AnimateRunner} animationRunner the animation runner
14467
+ * @return {import('./runner/animate-runner.js').AnimateRunner} animationRunner the animation runner
14446
14468
  */
14447
14469
  removeClass(element, className, options) {
14448
14470
  options = prepareAnimateOptions(options);
@@ -14463,7 +14485,7 @@
14463
14485
  * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
14464
14486
  * @param {object=} options an optional collection of options/styles that will be applied to the element.
14465
14487
  *
14466
- * @return {import('./animate-runner.js').AnimateRunner} the animation runner
14488
+ * @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14467
14489
  */
14468
14490
  setClass(element, add, remove, options) {
14469
14491
  options = prepareAnimateOptions(options);
@@ -14491,7 +14513,7 @@
14491
14513
  * }
14492
14514
  * });
14493
14515
  * ```
14494
- * @return {import('./animate-runner.js').AnimateRunner} the animation runner
14516
+ * @return {import('./runner/animate-runner.js').AnimateRunner} the animation runner
14495
14517
  */
14496
14518
  animate(element, from, to, className, options) {
14497
14519
  options = prepareAnimateOptions(options);
@@ -14507,200 +14529,6 @@
14507
14529
  ];
14508
14530
  }
14509
14531
 
14510
- function AnimateAsyncRunFactoryProvider() {
14511
- this.$get = [
14512
- function () {
14513
- let waitQueue = [];
14514
-
14515
- function waitForTick(fn) {
14516
- waitQueue.push(fn);
14517
- if (waitQueue.length > 1) return;
14518
- window.requestAnimationFrame(function () {
14519
- for (let i = 0; i < waitQueue.length; i++) {
14520
- waitQueue[i]();
14521
- }
14522
- waitQueue = [];
14523
- });
14524
- }
14525
-
14526
- return function () {
14527
- let passed = false;
14528
- waitForTick(function () {
14529
- passed = true;
14530
- });
14531
- return function (callback) {
14532
- if (passed) {
14533
- callback();
14534
- } else {
14535
- waitForTick(callback);
14536
- }
14537
- };
14538
- };
14539
- },
14540
- ];
14541
- }
14542
-
14543
- const INITIAL_STATE = 0;
14544
- const DONE_PENDING_STATE = 1;
14545
- const DONE_COMPLETE_STATE = 2;
14546
- let $$animateAsyncRun;
14547
-
14548
- function AnimateRunnerFactoryProvider() {
14549
- this.$get = [
14550
- "$$animateAsyncRun",
14551
- function (animateAsyncRun) {
14552
- $$animateAsyncRun = animateAsyncRun;
14553
- return AnimateRunner;
14554
- },
14555
- ];
14556
- }
14557
-
14558
- class AnimateRunner {
14559
- static chain(chain, callback) {
14560
- let index = 0;
14561
-
14562
- function next() {
14563
- if (index === chain.length) {
14564
- callback(true);
14565
- return;
14566
- }
14567
-
14568
- chain[index]((response) => {
14569
- if (response === false) {
14570
- callback(false);
14571
- return;
14572
- }
14573
- index++;
14574
- next();
14575
- });
14576
- }
14577
-
14578
- next();
14579
- }
14580
-
14581
- static all(runners, callback) {
14582
- let count = 0;
14583
- let status = true;
14584
-
14585
- runners.forEach((runner) => {
14586
- runner.done(onProgress);
14587
- });
14588
-
14589
- function onProgress(response) {
14590
- status = status && response;
14591
- if (++count === runners.length) {
14592
- callback(status);
14593
- }
14594
- }
14595
- }
14596
-
14597
- constructor(host) {
14598
- this.setHost(host);
14599
-
14600
- const rafTick = $$animateAsyncRun();
14601
- const timeoutTick = (fn) => {
14602
- setTimeout(fn, 0, false);
14603
- };
14604
-
14605
- this._doneCallbacks = [];
14606
- this._tick = (fn) => {
14607
- if (document.hidden) {
14608
- timeoutTick(fn);
14609
- } else {
14610
- rafTick(fn);
14611
- }
14612
- };
14613
- this._state = 0;
14614
- }
14615
-
14616
- setHost(host) {
14617
- this.host = host || {};
14618
- }
14619
-
14620
- done(fn) {
14621
- if (this._state === DONE_COMPLETE_STATE) {
14622
- fn();
14623
- } else {
14624
- this._doneCallbacks.push(fn);
14625
- }
14626
- }
14627
-
14628
- progress() {}
14629
-
14630
- getPromise() {
14631
- if (!this.promise) {
14632
- const self = this;
14633
- this.promise = new Promise((resolve, reject) => {
14634
- self.done((status) => {
14635
- if (status === false) {
14636
- reject();
14637
- } else {
14638
- resolve();
14639
- }
14640
- });
14641
- });
14642
- }
14643
- return this.promise;
14644
- }
14645
-
14646
- then(resolveHandler, rejectHandler) {
14647
- return this.getPromise().then(resolveHandler, rejectHandler);
14648
- }
14649
-
14650
- catch(handler) {
14651
- return this.getPromise().catch(handler);
14652
- }
14653
-
14654
- finally(handler) {
14655
- return this.getPromise().finally(handler);
14656
- }
14657
-
14658
- pause() {
14659
- if (this.host.pause) {
14660
- this.host.pause();
14661
- }
14662
- }
14663
-
14664
- resume() {
14665
- if (this.host.resume) {
14666
- this.host.resume();
14667
- }
14668
- }
14669
-
14670
- end() {
14671
- if (this.host.end) {
14672
- this.host.end();
14673
- }
14674
- this._resolve(true);
14675
- }
14676
-
14677
- cancel() {
14678
- if (this.host.cancel) {
14679
- this.host.cancel();
14680
- }
14681
- this._resolve(false);
14682
- }
14683
-
14684
- complete(response) {
14685
- if (this._state === INITIAL_STATE) {
14686
- this._state = DONE_PENDING_STATE;
14687
- this._tick(() => {
14688
- this._resolve(response);
14689
- });
14690
- }
14691
- }
14692
-
14693
- _resolve(response) {
14694
- if (this._state !== DONE_COMPLETE_STATE) {
14695
- this._doneCallbacks.forEach((fn) => {
14696
- fn(response);
14697
- });
14698
- this._doneCallbacks.length = 0;
14699
- this._state = DONE_COMPLETE_STATE;
14700
- }
14701
- }
14702
- }
14703
-
14704
14532
  /**
14705
14533
  * Provides an instance of a cache that can be used to store and retrieve template content.
14706
14534
  */
@@ -15280,7 +15108,7 @@
15280
15108
  /* @ignore */ static $inject = [$injectTokens.$provide];
15281
15109
 
15282
15110
  /**
15283
- * @param {import('../../interface.ts').Provider} $provide
15111
+ * @param {ng.ProvideService} $provide
15284
15112
  */
15285
15113
  constructor($provide) {
15286
15114
  this.$provide = $provide;
@@ -19525,8 +19353,6 @@
19525
19353
  * @returns {Location}
19526
19354
  */
19527
19355
  ($rootScope, $rootElement) => {
19528
- /** @type {Location} */
19529
- let $location;
19530
19356
  const baseHref = getBaseHref(); // if base[href] is undefined, it defaults to ''
19531
19357
  const initialUrl = trimEmptyHash(window.location.href);
19532
19358
  let appBase;
@@ -19544,7 +19370,7 @@
19544
19370
  }
19545
19371
  const appBaseNoFile = stripFile(appBase);
19546
19372
 
19547
- $location = new Location(
19373
+ const $location = new Location(
19548
19374
  appBase,
19549
19375
  appBaseNoFile,
19550
19376
  this.html5ModeConf.enabled,
@@ -20134,6 +19960,9 @@
20134
19960
  }
20135
19961
 
20136
19962
  if (typeof target === "object") {
19963
+ if (isUnsafeGlobal(target)) {
19964
+ return target;
19965
+ }
20137
19966
  const proxy = new Proxy(target, context || new Scope());
20138
19967
  for (const key in target) {
20139
19968
  if (hasOwn(target, key)) {
@@ -20151,7 +19980,7 @@
20151
19980
  target[key] = createScope(target[key], proxy.$handler);
20152
19981
  }
20153
19982
  } catch {
20154
- // convert only what we can
19983
+ /* empty */
20155
19984
  }
20156
19985
  }
20157
19986
  }
@@ -20162,6 +19991,45 @@
20162
19991
  }
20163
19992
  }
20164
19993
 
19994
+ /**
19995
+ * @param {any} target
19996
+ * @returns {boolean}
19997
+ */
19998
+ function isUnsafeGlobal(target) {
19999
+ if (target == null) return false;
20000
+ const t = typeof target;
20001
+ if (t !== "object" && t !== "function") return false;
20002
+
20003
+ const g = globalThis;
20004
+ if (
20005
+ target === g ||
20006
+ target === g.window ||
20007
+ target === g.document ||
20008
+ target === g.self ||
20009
+ target === g.frames
20010
+ ) {
20011
+ return true;
20012
+ }
20013
+
20014
+ // DOM / browser host object checks
20015
+ if (
20016
+ (typeof Window !== "undefined" && target instanceof Window) ||
20017
+ (typeof Document !== "undefined" && target instanceof Document) ||
20018
+ (typeof Element !== "undefined" && target instanceof Element) ||
20019
+ (typeof Node !== "undefined" && target instanceof Node) ||
20020
+ (typeof EventTarget !== "undefined" && target instanceof EventTarget)
20021
+ ) {
20022
+ return true;
20023
+ }
20024
+
20025
+ // Cross-origin or non-enumerable window objects
20026
+ try {
20027
+ return Object.prototype.toString.call(target) === "[object Window]";
20028
+ } catch {
20029
+ return true;
20030
+ }
20031
+ }
20032
+
20165
20033
  /**
20166
20034
  * Decorator for excluding objects from scope observability
20167
20035
  */
@@ -22235,6 +22103,231 @@
22235
22103
  };
22236
22104
  }
22237
22105
 
22106
+ /**
22107
+ * @fileoverview
22108
+ * Frame-synchronized animation runner and scheduler.
22109
+ * Provides async batching of animation callbacks using requestAnimationFrame.
22110
+ * In AngularJS, this user to be implemented as `$$AnimateRunner`
22111
+ */
22112
+
22113
+ /**
22114
+ * Internal runner states.
22115
+ * @readonly
22116
+ * @enum {number}
22117
+ */
22118
+ const RunnerState = {
22119
+ INITIAL: 0,
22120
+ PENDING: 1,
22121
+ DONE: 2,
22122
+ };
22123
+
22124
+ /** @type {VoidFunction[]} */
22125
+ let queue = [];
22126
+
22127
+ /** @type {boolean} */
22128
+ let scheduled = false;
22129
+
22130
+ /**
22131
+ * Flush all queued callbacks.
22132
+ * @private
22133
+ */
22134
+ function flush() {
22135
+ const tasks = queue;
22136
+ queue = [];
22137
+ scheduled = false;
22138
+ for (let i = 0; i < tasks.length; i++) {
22139
+ tasks[i]();
22140
+ }
22141
+ }
22142
+
22143
+ /**
22144
+ * Schedule a callback to run on the next animation frame.
22145
+ * Multiple calls within the same frame are batched together.
22146
+ *
22147
+ * @param {VoidFunction} fn - The callback to execute.
22148
+ */
22149
+ function schedule(fn) {
22150
+ queue.push(fn);
22151
+ if (!scheduled) {
22152
+ scheduled = true;
22153
+ (typeof requestAnimationFrame === "function"
22154
+ ? requestAnimationFrame
22155
+ : setTimeout)(flush, 0);
22156
+ }
22157
+ }
22158
+
22159
+ /**
22160
+ * Represents an asynchronous animation operation.
22161
+ * Provides both callback-based and promise-based completion APIs.
22162
+ */
22163
+ class AnimateRunner {
22164
+ /**
22165
+ * Run an array of animation runners in sequence.
22166
+ * Each runner waits for the previous one to complete.
22167
+ *
22168
+ * @param {AnimateRunner[]} runners - Runners to execute in order.
22169
+ * @param {(ok: boolean) => void} callback - Invoked when all complete or one fails.
22170
+ */
22171
+ static chain(runners, callback) {
22172
+ let i = 0;
22173
+ const next = (ok = true) => {
22174
+ if (!ok || i >= runners.length) {
22175
+ callback(ok);
22176
+ return;
22177
+ }
22178
+ runners[i++].done(next);
22179
+ };
22180
+ next();
22181
+ }
22182
+
22183
+ /**
22184
+ * Waits for all animation runners to complete before invoking the callback.
22185
+ *
22186
+ * @param {AnimateRunner[]} runners - Active runners to wait for.
22187
+ * @param {(ok: boolean) => void} callback - Called when all runners complete.
22188
+ */
22189
+ static all(runners, callback) {
22190
+ let remaining = runners.length;
22191
+ let status = true;
22192
+ for (const r of runners) {
22193
+ r.done((result) => {
22194
+ status = status && result !== false;
22195
+ if (--remaining === 0) callback(status);
22196
+ });
22197
+ }
22198
+ }
22199
+
22200
+ /**
22201
+ * @param {import("../interface.ts").AnimationHost} [host] - Optional animation host.
22202
+ */
22203
+ constructor(host) {
22204
+ /** @type {import("../interface.ts").AnimationHost} */
22205
+ this.host = host || {};
22206
+
22207
+ /** @type {Array<(ok: boolean) => void>} */
22208
+ this._doneCallbacks = [];
22209
+
22210
+ /** @type {RunnerState} */
22211
+ this._state = RunnerState.INITIAL;
22212
+
22213
+ /** @type {Promise<void>|null} */
22214
+ this._promise = null;
22215
+
22216
+ /** @type {(fn: VoidFunction) => void} */
22217
+ this._schedule = schedule;
22218
+ }
22219
+
22220
+ /**
22221
+ * Sets or updates the animation host.
22222
+ * @param {import("../interface.ts").AnimationHost} host - The host object.
22223
+ */
22224
+ setHost(host) {
22225
+ this.host = host || {};
22226
+ }
22227
+
22228
+ /**
22229
+ * Registers a callback to be called once the animation completes.
22230
+ * If the animation is already complete, it's called immediately.
22231
+ *
22232
+ * @param {(ok: boolean) => void} fn - Completion callback.
22233
+ */
22234
+ done(fn) {
22235
+ if (this._state === RunnerState.DONE) {
22236
+ fn(true);
22237
+ } else {
22238
+ this._doneCallbacks.push(fn);
22239
+ }
22240
+ }
22241
+
22242
+ /**
22243
+ * Notifies the host of animation progress.
22244
+ * @param {...any} args - Progress arguments.
22245
+ */
22246
+ progress(...args) {
22247
+ this.host.progress?.(...args);
22248
+ }
22249
+
22250
+ /** Pauses the animation, if supported by the host. */
22251
+ pause() {
22252
+ this.host.pause?.();
22253
+ }
22254
+
22255
+ /** Resumes the animation, if supported by the host. */
22256
+ resume() {
22257
+ this.host.resume?.();
22258
+ }
22259
+
22260
+ /** Ends the animation successfully. */
22261
+ end() {
22262
+ this.host.end?.();
22263
+ this._finish(true);
22264
+ }
22265
+
22266
+ /** Cancels the animation. */
22267
+ cancel() {
22268
+ this.host.cancel?.();
22269
+ this._finish(false);
22270
+ }
22271
+
22272
+ /**
22273
+ * Marks the animation as complete on the next animation frame.
22274
+ * @param {boolean} [status=true] - True if successful, false if canceled.
22275
+ */
22276
+ complete(status = true) {
22277
+ if (this._state === RunnerState.INITIAL) {
22278
+ this._state = RunnerState.PENDING;
22279
+ this._schedule(() => this._finish(status));
22280
+ }
22281
+ }
22282
+
22283
+ /**
22284
+ * Returns a promise that resolves or rejects when the animation completes.
22285
+ * @returns {Promise<void>} Promise resolved on success or rejected on cancel.
22286
+ */
22287
+ getPromise() {
22288
+ if (!this._promise) {
22289
+ this._promise = new Promise((resolve, reject) => {
22290
+ this.done((success) => {
22291
+ if (success === false) reject();
22292
+ else resolve();
22293
+ });
22294
+ });
22295
+ }
22296
+ return this._promise;
22297
+ }
22298
+
22299
+ /** @inheritdoc */
22300
+ then(onFulfilled, onRejected) {
22301
+ return this.getPromise().then(onFulfilled, onRejected);
22302
+ }
22303
+
22304
+ /** @inheritdoc */
22305
+ catch(onRejected) {
22306
+ return this.getPromise().catch(onRejected);
22307
+ }
22308
+
22309
+ /** @inheritdoc */
22310
+ finally(onFinally) {
22311
+ return this.getPromise().finally(onFinally);
22312
+ }
22313
+
22314
+ /**
22315
+ * Completes the animation and invokes all done callbacks.
22316
+ * @private
22317
+ * @param {boolean} status - True if completed successfully, false if canceled.
22318
+ */
22319
+ _finish(status) {
22320
+ if (this._state === RunnerState.DONE) return;
22321
+ this._state = RunnerState.DONE;
22322
+
22323
+ const callbacks = this._doneCallbacks;
22324
+ for (let i = 0; i < callbacks.length; i++) {
22325
+ callbacks[i](status);
22326
+ }
22327
+ callbacks.length = 0;
22328
+ }
22329
+ }
22330
+
22238
22331
  const ANIMATE_TIMER_KEY = "$$animateCss";
22239
22332
 
22240
22333
  const ONE_SECOND = 1000;
@@ -22344,18 +22437,16 @@
22344
22437
  function AnimateCssProvider() {
22345
22438
  let activeClasses;
22346
22439
  this.$get = [
22347
- "$$AnimateRunner",
22348
22440
  "$$animateCache",
22349
22441
  "$$rAFScheduler",
22350
22442
 
22351
22443
  /**
22352
22444
  *
22353
- * @param {*} $$AnimateRunner
22354
22445
  * @param {*} $$animateCache
22355
22446
  * @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
22356
22447
  * @returns
22357
22448
  */
22358
- function ($$AnimateRunner, $$animateCache, $$rAFScheduler) {
22449
+ function ($$animateCache, $$rAFScheduler) {
22359
22450
  const applyAnimationClasses = applyAnimationClassesFactory();
22360
22451
 
22361
22452
  function computeCachedCssStyles(
@@ -22753,7 +22844,7 @@
22753
22844
  pause: null,
22754
22845
  };
22755
22846
 
22756
- runner = new $$AnimateRunner(runnerHost);
22847
+ runner = new AnimateRunner(runnerHost);
22757
22848
 
22758
22849
  waitUntilQuiet(start);
22759
22850
 
@@ -22852,7 +22943,7 @@
22852
22943
  }
22853
22944
 
22854
22945
  function closeAndReturnNoopAnimator() {
22855
- runner = new $$AnimateRunner({
22946
+ runner = new AnimateRunner({
22856
22947
  end: endFn,
22857
22948
  cancel: cancelFn,
22858
22949
  });
@@ -23240,24 +23331,16 @@
23240
23331
  $injectTokens.$rootScope,
23241
23332
  $injectTokens.$injector,
23242
23333
  $injectTokens.$$animation,
23243
- $injectTokens.$$AnimateRunner,
23244
23334
  $injectTokens.$templateRequest,
23245
23335
  /**
23246
23336
  *
23247
- * @param {import('../core/scope/scope.js').Scope} $rootScope
23248
- * @param {import('../core/di/internal-injector.js').InjectorService} $injector
23337
+ * @param {ng.RootScopeService} $rootScope
23338
+ * @param {ng.InjectorService} $injector
23249
23339
  * @param {*} $$animation
23250
- * @param {*} $$AnimateRunner
23251
23340
  * @param {*} $templateRequest
23252
23341
  * @returns
23253
23342
  */
23254
- function (
23255
- $rootScope,
23256
- $injector,
23257
- $$animation,
23258
- $$AnimateRunner,
23259
- $templateRequest,
23260
- ) {
23343
+ function ($rootScope, $injector, $$animation, $templateRequest) {
23261
23344
  const activeAnimationsLookup = new Map();
23262
23345
  const disabledElementsLookup = new Map();
23263
23346
 
@@ -23465,7 +23548,7 @@
23465
23548
 
23466
23549
  // we create a fake runner with a working promise.
23467
23550
  // These methods will become available after the digest has passed
23468
- const runner = new $$AnimateRunner();
23551
+ const runner = new AnimateRunner();
23469
23552
 
23470
23553
  // this is used to trigger callbacks in postDigest mode
23471
23554
  const runInNextPostDigestOrNow = postDigestTaskFactory();
@@ -23910,14 +23993,12 @@
23910
23993
  function AnimateJsProvider($animateProvider) {
23911
23994
  this.$get = [
23912
23995
  $injectTokens.$injector,
23913
- "$$AnimateRunner",
23914
23996
  /**
23915
23997
  *
23916
23998
  * @param {ng.InjectorService} $injector
23917
- * @param {*} $$AnimateRunner
23918
23999
  * @returns
23919
24000
  */
23920
- function ($injector, $$AnimateRunner) {
24001
+ function ($injector) {
23921
24002
  const applyAnimationClasses = applyAnimationClassesFactory();
23922
24003
  // $animateJs(element, 'enter');
23923
24004
  return function (element, event, classes, options) {
@@ -24004,7 +24085,7 @@
24004
24085
  runner.end();
24005
24086
  } else {
24006
24087
  close();
24007
- runner = new $$AnimateRunner();
24088
+ runner = new AnimateRunner();
24008
24089
  runner.complete(true);
24009
24090
  }
24010
24091
  return runner;
@@ -24014,31 +24095,53 @@
24014
24095
  return runner;
24015
24096
  }
24016
24097
 
24017
- runner = new $$AnimateRunner();
24018
- let closeActiveAnimations;
24098
+ runner = new AnimateRunner();
24099
+
24019
24100
  const chain = [];
24020
24101
 
24021
24102
  if (before) {
24022
- chain.push((fn) => {
24023
- closeActiveAnimations = before(fn);
24103
+ const runnerBefore = new AnimateRunner({
24104
+ end(fn) {
24105
+ // call the before animation function, then mark runner done
24106
+ const endFn = before(fn) || (() => {});
24107
+ endFn();
24108
+ },
24109
+ cancel() {
24110
+ (before(true) || (() => {}))();
24111
+ },
24024
24112
  });
24113
+ chain.push(runnerBefore);
24025
24114
  }
24026
24115
 
24027
24116
  if (chain.length) {
24028
- chain.push((fn) => {
24029
- applyOptions();
24030
- fn(true);
24117
+ const runnerApplyOptions = new AnimateRunner({
24118
+ end(fn) {
24119
+ applyOptions();
24120
+ fn(true);
24121
+ },
24122
+ cancel() {
24123
+ applyOptions();
24124
+ },
24031
24125
  });
24126
+ chain.push(runnerApplyOptions);
24032
24127
  } else {
24033
24128
  applyOptions();
24034
24129
  }
24035
24130
 
24036
24131
  if (after) {
24037
- chain.push((fn) => {
24038
- closeActiveAnimations = after(fn);
24132
+ const runnerAfter = new AnimateRunner({
24133
+ end(fn) {
24134
+ const endFn = after(fn) || (() => {});
24135
+ endFn();
24136
+ },
24137
+ cancel() {
24138
+ (after(true) || (() => {}))();
24139
+ },
24039
24140
  });
24141
+ chain.push(runnerAfter);
24040
24142
  }
24041
24143
 
24144
+ // finally, set host for overall runner
24042
24145
  runner.setHost({
24043
24146
  end() {
24044
24147
  endAnimations();
@@ -24048,7 +24151,7 @@
24048
24151
  },
24049
24152
  });
24050
24153
 
24051
- $$AnimateRunner.chain(chain, onComplete);
24154
+ AnimateRunner.chain(chain, onComplete);
24052
24155
  return runner;
24053
24156
 
24054
24157
  function onComplete(success) {
@@ -24058,7 +24161,6 @@
24058
24161
 
24059
24162
  function endAnimations(cancelled) {
24060
24163
  if (!animationClosed) {
24061
- (closeActiveAnimations || (() => {}))(cancelled);
24062
24164
  onComplete(cancelled);
24063
24165
  }
24064
24166
  }
@@ -24097,7 +24199,7 @@
24097
24199
  value = value.start();
24098
24200
  }
24099
24201
 
24100
- if (value instanceof $$AnimateRunner) {
24202
+ if (value instanceof AnimateRunner) {
24101
24203
  value.done(onDone);
24102
24204
  } else if (isFunction(value)) {
24103
24205
  // optional onEnd / onCancel callback
@@ -24134,7 +24236,7 @@
24134
24236
  }
24135
24237
  };
24136
24238
 
24137
- runner = new $$AnimateRunner({
24239
+ runner = new AnimateRunner({
24138
24240
  end() {
24139
24241
  onAnimationComplete();
24140
24242
  },
@@ -24230,7 +24332,7 @@
24230
24332
  }
24231
24333
 
24232
24334
  if (runners.length) {
24233
- $$AnimateRunner.all(runners, callback);
24335
+ AnimateRunner.all(runners, callback);
24234
24336
  } else {
24235
24337
  callback();
24236
24338
  }
@@ -24290,25 +24392,17 @@
24290
24392
  this.$get = [
24291
24393
  $injectTokens.$rootScope,
24292
24394
  $injectTokens.$injector,
24293
- $injectTokens.$$AnimateRunner,
24294
24395
  $injectTokens.$$rAFScheduler,
24295
24396
  $injectTokens.$$animateCache,
24296
24397
  /**
24297
24398
  *
24298
24399
  * @param {ng.RootScopeService} $rootScope
24299
24400
  * @param {import("../core/di/internal-injector").InjectorService} $injector
24300
- * @param {*} $$AnimateRunner
24301
24401
  * @param {import("./raf-scheduler").RafScheduler} $$rAFScheduler
24302
24402
  * @param {*} $$animateCache
24303
24403
  * @returns
24304
24404
  */
24305
- function (
24306
- $rootScope,
24307
- $injector,
24308
- $$AnimateRunner,
24309
- $$rAFScheduler,
24310
- $$animateCache,
24311
- ) {
24405
+ function ($rootScope, $injector, $$rAFScheduler, $$animateCache) {
24312
24406
  const animationQueue = [];
24313
24407
  const applyAnimationClasses = applyAnimationClassesFactory();
24314
24408
 
@@ -24409,7 +24503,7 @@
24409
24503
  // these runner methods will get later updated with the
24410
24504
  // methods leading into the driver's end/cancel methods
24411
24505
  // for now they just stop the animation from starting
24412
- const runner = new $$AnimateRunner({
24506
+ const runner = new AnimateRunner({
24413
24507
  end() {
24414
24508
  close();
24415
24509
  },
@@ -24964,16 +25058,14 @@
24964
25058
  */
24965
25059
  this.$get = [
24966
25060
  "$animateCss",
24967
- "$$AnimateRunner",
24968
25061
  "$rootElement",
24969
25062
  /**
24970
25063
  *
24971
25064
  * @param {*} $animateCss
24972
- * @param {typeof import('./animate-runner.js').AnimateRunner} $$AnimateRunner
24973
25065
  * @param {Element} $rootElement
24974
25066
  * @returns
24975
25067
  */
24976
- function ($animateCss, $$AnimateRunner, $rootElement) {
25068
+ function ($animateCss, $rootElement) {
24977
25069
  const bodyNode = document.body;
24978
25070
  const rootNode = $rootElement;
24979
25071
 
@@ -25046,7 +25138,7 @@
25046
25138
  runner.complete();
25047
25139
  });
25048
25140
 
25049
- runner = new $$AnimateRunner({
25141
+ runner = new AnimateRunner({
25050
25142
  end: endFn,
25051
25143
  cancel: endFn,
25052
25144
  });
@@ -25157,12 +25249,12 @@
25157
25249
  animationRunners.push(animation.start());
25158
25250
  });
25159
25251
 
25160
- const runner = new $$AnimateRunner({
25252
+ const runner = new AnimateRunner({
25161
25253
  end: endFn,
25162
25254
  cancel: endFn, // CSS-driven animations cannot be cancelled, only ended
25163
25255
  });
25164
25256
 
25165
- $$AnimateRunner.all(animationRunners, (status) => {
25257
+ AnimateRunner.all(animationRunners, (status) => {
25166
25258
  runner.complete(status);
25167
25259
  });
25168
25260
 
@@ -25232,8 +25324,11 @@
25232
25324
  $$animationProvider.drivers.push("$$animateJsDriver");
25233
25325
  this.$get = [
25234
25326
  "$$animateJs",
25235
- "$$AnimateRunner",
25236
- function ($$animateJs, $$AnimateRunner) {
25327
+ /**
25328
+ *
25329
+ * @param {*} $$animateJs
25330
+ */
25331
+ function ($$animateJs) {
25237
25332
  return function initDriverFn(animationDetails) {
25238
25333
  if (animationDetails.from && animationDetails.to) {
25239
25334
  const fromAnimation = prepareAnimation(animationDetails.from);
@@ -25252,9 +25347,9 @@
25252
25347
  animationRunners.push(toAnimation.start());
25253
25348
  }
25254
25349
 
25255
- $$AnimateRunner.all(animationRunners, done);
25350
+ AnimateRunner.all(animationRunners, done);
25256
25351
 
25257
- const runner = new $$AnimateRunner({
25352
+ const runner = new AnimateRunner({
25258
25353
  end: endFnFactory(),
25259
25354
  cancel: endFnFactory(),
25260
25355
  });
@@ -35460,31 +35555,26 @@
35460
35555
  /**
35461
35556
  * @param {ng.LogService} $log
35462
35557
  * @param {ng.InjectorService} $injector
35463
- * @returns {import('interface.ts').Directive}
35558
+ * @returns {ng.Directive}
35464
35559
  */
35465
35560
  function ngInjectDirective($log, $injector) {
35466
35561
  return {
35467
35562
  restrict: "A",
35468
35563
  link(scope, _element, attrs) {
35469
- const expr = attrs["ngInject"];
35470
-
35564
+ const expr = attrs.ngInject;
35471
35565
  if (!expr) return;
35472
- // Match any identifier that starts with $, or ends with Service/Factory
35473
- // Example matches: $http, userService, authFactory
35474
- const replacedExpr = expr.replace(
35475
- /(\$[\w]+|[\w]+(?:Service|Factory))/g,
35476
- (match, name) => {
35477
- try {
35478
- const service = $injector.get(name);
35479
- scope.$target[name] = service;
35480
- return name;
35481
- } catch {
35482
- $log.warn(`Injectable ${name} not found in $injector`);
35483
- return match;
35484
- }
35485
- },
35486
- );
35487
- scope.$apply(replacedExpr);
35566
+ const tokens = expr
35567
+ .split(";")
35568
+ .map((s) => s.trim())
35569
+ .filter(Boolean);
35570
+
35571
+ for (const name of tokens) {
35572
+ if ($injector.has(name)) {
35573
+ scope[name] = $injector.get(name);
35574
+ } else {
35575
+ $log.warn(`Injectable ${name} not found in $injector`);
35576
+ }
35577
+ }
35488
35578
  },
35489
35579
  };
35490
35580
  }
@@ -35960,8 +36050,8 @@
35960
36050
 
35961
36051
  /**
35962
36052
  * Initializes core `ng` module.
35963
- * @param {import('./angular.js').Angular} angular
35964
- * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
36053
+ * @param {ng.Angular} angular
36054
+ * @returns {ng.NgModule} `ng` module
35965
36055
  */
35966
36056
  function registerNgModule(angular) {
35967
36057
  return angular
@@ -35970,14 +36060,14 @@
35970
36060
  [],
35971
36061
  [
35972
36062
  $injectTokens.$provide,
35973
- /** @param {import("./interface.ts").Provider} $provide */
36063
+ /** @param {ng.ProvideService} $provide */
35974
36064
  ($provide) => {
35975
36065
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
35976
36066
  $provide.provider({
35977
36067
  $$sanitizeUri: SanitizeUriProvider,
35978
36068
  });
35979
- $provide.value("$window", window);
35980
- $provide.value("$document", document);
36069
+ $provide.value($injectTokens.$window, window);
36070
+ $provide.value($injectTokens.$document, document);
35981
36071
  $provide
35982
36072
  .provider($injectTokens.$compile, CompileProvider)
35983
36073
  .directive({
@@ -35990,6 +36080,7 @@
35990
36080
  ngBind: ngBindDirective,
35991
36081
  ngBindHtml: ngBindHtmlDirective,
35992
36082
  ngBindTemplate: ngBindTemplateDirective,
36083
+ ngChannel: ngChannelDirective,
35993
36084
  ngClass: ngClassDirective,
35994
36085
  ngClassEven: ngClassEvenDirective,
35995
36086
  ngClassOdd: ngClassOddDirective,
@@ -36042,6 +36133,7 @@
36042
36133
  input: hiddenInputBrowserCacheDirective,
36043
36134
  ngAnimateSwap: ngAnimateSwapDirective,
36044
36135
  ngAnimateChildren: $$AnimateChildrenDirective,
36136
+ // aria directives
36045
36137
  ngChecked: ngCheckedAriaDirective,
36046
36138
  ngClick: ngClickAriaDirective,
36047
36139
  ngDblclick: ngDblclickAriaDirective,
@@ -36053,12 +36145,12 @@
36053
36145
  ngReadonly: ngReadonlyAriaDirective,
36054
36146
  ngRequired: ngRequiredAriaDirective,
36055
36147
  ngValue: ngValueAriaDirective,
36148
+ // router directives
36056
36149
  ngSref: $StateRefDirective,
36057
36150
  ngSrefActive: $StateRefActiveDirective,
36058
36151
  ngSrefActiveEq: $StateRefActiveDirective,
36059
36152
  ngState: $StateRefDynamicDirective,
36060
36153
  ngView: ngView,
36061
- ngChannel: ngChannelDirective,
36062
36154
  })
36063
36155
  .directive({
36064
36156
  ngView: $ViewDirectiveFill,
@@ -36076,8 +36168,6 @@
36076
36168
  $$animateJsDriver: AnimateJsDriverProvider,
36077
36169
  $$animateCache: AnimateCacheProvider,
36078
36170
  $$animateQueue: AnimateQueueProvider,
36079
- $$AnimateRunner: AnimateRunnerFactoryProvider,
36080
- $$animateAsyncRun: AnimateAsyncRunFactoryProvider,
36081
36171
  $controller: ControllerProvider,
36082
36172
  $exceptionHandler: ExceptionHandlerProvider,
36083
36173
  $filter: FilterProvider,
@@ -36130,20 +36220,36 @@
36130
36220
  constructor() {
36131
36221
  this.$cache = Cache;
36132
36222
 
36133
- /** @type {import('./services/pubsub/pubsub.js').PubSub} */
36223
+ /** @type {ng.PubSubService} */
36134
36224
  this.$eventBus = EventBus;
36135
36225
 
36136
36226
  /**
36137
36227
  * @type {string} `version` from `package.json`
36138
36228
  */
36139
- this.version = "0.10.0"; //inserted via rollup plugin
36229
+ this.version = "0.11.0"; //inserted via rollup plugin
36140
36230
 
36141
36231
  /** @type {!Array<string|any>} */
36142
36232
  this.bootsrappedModules = [];
36143
36233
 
36234
+ /**
36235
+ * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
36236
+ *
36237
+ * @type {(element: Element, name: string?) => ng.Scope|undefined}
36238
+ */
36144
36239
  this.getController = getController;
36240
+
36241
+ /**
36242
+ * Return instance of InjectorService attached to element
36243
+ * @type {(Element) => ng.InjectorService}
36244
+ */
36145
36245
  this.getInjector = getInjector;
36246
+
36247
+ /**
36248
+ * Gets scope for a given element.
36249
+ * @type {(Element) => *}
36250
+ */
36146
36251
  this.getScope = getScope;
36252
+
36147
36253
  this.errorHandlingConfig = errorHandlingConfig;
36148
36254
  this.$t = $injectTokens;
36149
36255
 
@@ -36236,7 +36342,8 @@
36236
36342
  */
36237
36343
  (scope, el, compile, $injector) => {
36238
36344
  // ng-route deps
36239
- this.$injector = $injector;
36345
+ this.$injector = $injector; // TODO refactor away as this as this prevents multiple apps from being used
36346
+
36240
36347
  setCacheData(el, "$injector", $injector);
36241
36348
 
36242
36349
  const compileFn = compile(el);