@angular-wave/angular.ts 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/angular-ts.umd.js +10 -0
  2. package/index.html +74 -3
  3. package/package.json +1 -1
  4. package/src/angular.spec.js +0 -5
  5. package/src/animations/animate-css.js +5 -13
  6. package/src/animations/animate-queue.js +22 -21
  7. package/src/animations/animate-runner.js +4 -8
  8. package/src/animations/animate.md +1 -1
  9. package/src/animations/animate.spec.js +0 -21
  10. package/src/animations/animation.js +1 -1
  11. package/src/binding.spec.js +0 -1
  12. package/src/core/cache/cache.js +2 -29
  13. package/src/core/compile/compile.js +26 -27
  14. package/src/core/compile/compile.spec.js +17 -266
  15. package/src/core/compile/compile.test.js +1 -1
  16. package/src/core/controller/controller.js +2 -0
  17. package/src/core/di/injector.md +1 -1
  18. package/src/core/di/injector.spec.js +0 -2
  19. package/src/core/di/internal-injector.js +2 -1
  20. package/src/core/interpolate/interpolate.js +16 -3
  21. package/src/core/interpolate/interpolate.spec.js +70 -16
  22. package/src/core/interval/interval.test.js +1 -1
  23. package/src/core/location/location.js +0 -2
  24. package/src/core/location/location.spec.js +27 -27
  25. package/src/core/{scope/scope.html → model/model.html} +1 -1
  26. package/src/core/model/model.js +944 -0
  27. package/src/core/model/model.spec.js +3012 -0
  28. package/src/core/on.spec.js +0 -7
  29. package/src/core/parse/interpreter.js +10 -7
  30. package/src/core/parse/parse.js +26 -5
  31. package/src/core/parse/parse.spec.js +95 -91
  32. package/src/core/prop.spec.js +4 -60
  33. package/src/core/sce/sce.spec.js +0 -8
  34. package/src/core/scope/scope.js +61 -30
  35. package/src/core/scope/scope.spec.js +25 -1960
  36. package/src/directive/aria/aria.js +3 -6
  37. package/src/directive/aria/aria.spec.js +0 -87
  38. package/src/directive/attrs/attrs.spec.js +0 -5
  39. package/src/directive/attrs/boolean.spec.js +0 -15
  40. package/src/directive/attrs/element-style.spec.js +0 -8
  41. package/src/directive/attrs/src.spec.js +0 -7
  42. package/src/directive/bind/bind.spec.js +0 -33
  43. package/src/directive/bind/bing-html.spec.js +0 -3
  44. package/src/{core/q/q.html → directive/channel/channel.html} +1 -1
  45. package/src/directive/channel/channel.js +29 -0
  46. package/src/directive/channel/channel.spec.js +52 -0
  47. package/src/directive/{list/list.test.js → channel/channel.test.js} +2 -4
  48. package/src/directive/class/class.js +3 -3
  49. package/src/directive/class/class.spec.js +9 -75
  50. package/src/directive/controller/controller.spec.js +0 -13
  51. package/src/directive/events/click.spec.js +0 -3
  52. package/src/directive/events/event.spec.js +0 -6
  53. package/src/directive/form/form.js +2 -3
  54. package/src/directive/form/form.spec.js +0 -65
  55. package/src/directive/if/if.spec.js +0 -4
  56. package/src/directive/include/include.spec.js +8 -59
  57. package/src/directive/init/init.js +6 -2
  58. package/src/directive/init/init.spec.js +0 -2
  59. package/src/directive/input/input.spec.js +0 -136
  60. package/src/directive/messages/messages.spec.js +4 -35
  61. package/src/directive/model/model.js +18 -25
  62. package/src/directive/model/model.spec.js +2 -49
  63. package/src/directive/model-options/model-options.spec.js +0 -6
  64. package/src/directive/non-bindable/non-bindable.spec.js +0 -1
  65. package/src/directive/observe/observe.js +0 -1
  66. package/src/directive/observe/observe.spec.js +0 -1
  67. package/src/directive/options/options.spec.js +0 -34
  68. package/src/directive/ref/href.spec.js +0 -15
  69. package/src/directive/repeat/repeat.spec.js +8 -135
  70. package/src/directive/script/script.spec.js +0 -2
  71. package/src/directive/select/select.js +3 -3
  72. package/src/directive/select/select.spec.js +0 -96
  73. package/src/directive/show-hide/show-hide.js +2 -2
  74. package/src/directive/show-hide/show-hide.spec.js +8 -19
  75. package/src/directive/style/style.spec.js +0 -7
  76. package/src/directive/switch/switch.spec.js +5 -5
  77. package/src/directive/validators/validators.spec.js +0 -1
  78. package/src/loader.js +0 -1
  79. package/src/public.js +75 -80
  80. package/src/router/common/coreservices.js +0 -2
  81. package/src/router/directives/state-directives.js +6 -14
  82. package/src/router/directives/state-directives.spec.js +0 -83
  83. package/src/router/directives/view-directive.js +4 -13
  84. package/src/router/directives/view-directive.spec.js +25 -71
  85. package/src/router/hooks/lazy-load.js +2 -2
  86. package/src/router/hooks/views.js +3 -5
  87. package/src/router/resolve/resolvable.js +3 -6
  88. package/src/router/resolve/resolve-context.js +2 -2
  89. package/src/router/state/state-service.js +4 -4
  90. package/src/router/state/state.spec.js +2 -5
  91. package/src/router/state/views.js +7 -10
  92. package/src/router/template-factory.js +3 -6
  93. package/src/router/template-factory.spec.js +0 -4
  94. package/src/router/transition/transition-hook.js +1 -1
  95. package/src/router/transition/transition.js +1 -1
  96. package/src/router/view-hook.spec.js +2 -2
  97. package/src/router/view-scroll.js +4 -6
  98. package/src/services/http/http.js +6 -9
  99. package/src/services/http/http.spec.js +30 -31
  100. package/src/services/http/template-request.spec.js +0 -10
  101. package/src/services/http-backend/http-backend.spec.js +3 -3
  102. package/src/services/template-request.js +2 -4
  103. package/src/shared/common.js +1 -2
  104. package/src/shared/jqlite/jqlite.js +0 -3
  105. package/types/core/cache/cache.d.ts +1 -1
  106. package/types/core/model/model.d.ts +204 -0
  107. package/types/core/parse/parse.d.ts +26 -0
  108. package/types/core/scope/scope.d.ts +22 -21
  109. package/types/directive/channel/channel.d.ts +11 -0
  110. package/src/core/interval/interval-factory.js +0 -50
  111. package/src/core/interval/interval.html +0 -18
  112. package/src/core/interval/interval.js +0 -77
  113. package/src/core/interval/interval.md +0 -123
  114. package/src/core/interval/interval.spec.js +0 -280
  115. package/src/core/q/q.js +0 -472
  116. package/src/core/q/q.md +0 -211
  117. package/src/core/q/q.spec.js +0 -2748
  118. package/src/core/q/q.test.js +0 -12
  119. package/src/core/scope/scope.test.js +0 -12
  120. package/src/core/timeout/timeout.html +0 -18
  121. package/src/core/timeout/timeout.js +0 -109
  122. package/src/core/timeout/timeout.spec.js +0 -354
  123. package/src/core/timeout/timout.test.js +0 -12
  124. package/src/directive/list/list.html +0 -18
  125. package/src/directive/list/list.js +0 -46
  126. package/src/directive/list/list.md +0 -22
  127. package/src/directive/list/list.spec.js +0 -172
  128. package/types/directive/list/list.d.ts +0 -4
@@ -381,7 +381,6 @@ export function HttpProvider() {
381
381
  "$browser",
382
382
  "$httpBackend",
383
383
  "$rootScope",
384
- "$q",
385
384
  "$injector",
386
385
  "$sce",
387
386
  /**
@@ -389,12 +388,11 @@ export function HttpProvider() {
389
388
  * @param {*} $browser
390
389
  * @param {*} $httpBackend
391
390
  * @param {*} $rootScope
392
- * @param {*} $q
393
391
  * @param {import("../../core/di/internal-injector").InjectorService} $injector
394
392
  * @param {*} $sce
395
393
  * @returns
396
394
  */
397
- function ($browser, $httpBackend, $rootScope, $q, $injector, $sce) {
395
+ function ($browser, $httpBackend, $rootScope, $injector, $sce) {
398
396
  /**
399
397
  * @type {Map<string, string>}
400
398
  */
@@ -468,7 +466,7 @@ export function HttpProvider() {
468
466
 
469
467
  const requestInterceptors = [];
470
468
  const responseInterceptors = [];
471
- let promise = $q.resolve(config);
469
+ let promise = Promise.resolve(config);
472
470
 
473
471
  // apply interceptors
474
472
  reversedInterceptors.forEach((interceptor) => {
@@ -589,7 +587,7 @@ export function HttpProvider() {
589
587
  response.status,
590
588
  config.transformResponse,
591
589
  );
592
- return isSuccess(response.status) ? resp : $q.reject(resp);
590
+ return isSuccess(response.status) ? resp : Promise.reject(resp);
593
591
  }
594
592
  }
595
593
 
@@ -732,8 +730,7 @@ export function HttpProvider() {
732
730
  * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
733
731
  */
734
732
  function sendReq(config, reqData) {
735
- const deferred = $q.defer();
736
- const { promise } = deferred;
733
+ const { promise, resolve, reject } = Promise.withResolvers();
737
734
  let cache;
738
735
  let cachedResp;
739
736
  const reqHeaders = config.headers;
@@ -823,7 +820,7 @@ export function HttpProvider() {
823
820
  Object.entries(eventHandlers).forEach(([key, eventHandler]) => {
824
821
  applyHandlers[key] = function (event) {
825
822
  if (useApplyAsync) {
826
- $rootScope.$applyAsync(callEventHandler);
823
+ setTimeout(() => $rootScope.$apply(callEventHandler));
827
824
  } else if ($rootScope.$$phase !== ScopePhase.NONE) {
828
825
  callEventHandler();
829
826
  } else {
@@ -892,7 +889,7 @@ export function HttpProvider() {
892
889
  // status: HTTP response status code, 0, -1 (aborted by timeout / promise)
893
890
  status = status >= -1 ? status : 0;
894
891
 
895
- (isSuccess(status) ? deferred.resolve : deferred.reject)({
892
+ (isSuccess(status) ? resolve : reject)({
896
893
  data: response,
897
894
  status,
898
895
  headers: headersGetter(headers),
@@ -19,7 +19,6 @@ describe("$http", function () {
19
19
  $http = $injector.get("$http");
20
20
  $httpBackend = $injector.get("$httpBackend");
21
21
  $rootScope = $injector.get("$rootScope");
22
- $q = $injector.get("$q");
23
22
  });
24
23
 
25
24
  it("is a function", function () {
@@ -2766,7 +2765,7 @@ describe("$http", function () {
2766
2765
  // doFirstCacheRequest();
2767
2766
 
2768
2767
  // await $http({ method: "get", url: "/url", cache }).then(callback);
2769
- // $rootScope.$digest();
2768
+ // ;
2770
2769
 
2771
2770
  // expect(callback).toHaveBeenCalled();
2772
2771
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -2786,7 +2785,7 @@ describe("$http", function () {
2786
2785
  // url: $sce.trustAsResourceUrl("/url"),
2787
2786
  // cache,
2788
2787
  // }).then(callback);
2789
- // $rootScope.$digest();
2788
+ // ;
2790
2789
 
2791
2790
  // expect(callback).toHaveBeenCalled();
2792
2791
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -2796,7 +2795,7 @@ describe("$http", function () {
2796
2795
  // doFirstCacheRequest();
2797
2796
 
2798
2797
  // await $http({ url: "/url", cache }).then(callback);
2799
- // $rootScope.$digest();
2798
+ // ;
2800
2799
 
2801
2800
  // expect(callback).toHaveBeenCalled();
2802
2801
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -2883,7 +2882,7 @@ describe("$http", function () {
2883
2882
  // });
2884
2883
 
2885
2884
  // await $http({ method: "GET", url: "/url", cache }).then(callback);
2886
- // $rootScope.$digest();
2885
+ // ;
2887
2886
  // expect(callback).toHaveBeenCalled();
2888
2887
  // }));
2889
2888
 
@@ -2900,7 +2899,7 @@ describe("$http", function () {
2900
2899
  // });
2901
2900
 
2902
2901
  // await $http({ method: "GET", url: "/url", cache }).then(callback);
2903
- // $rootScope.$digest();
2902
+ // ;
2904
2903
  // expect(callback).toHaveBeenCalled();
2905
2904
  // }));
2906
2905
 
@@ -2933,7 +2932,7 @@ describe("$http", function () {
2933
2932
  // });
2934
2933
 
2935
2934
  // await $http({ method: "get", url: "/url", cache }).then(callback);
2936
- // $rootScope.$digest();
2935
+ // ;
2937
2936
  // expect(callback).toHaveBeenCalled();
2938
2937
  // }));
2939
2938
 
@@ -2944,7 +2943,7 @@ describe("$http", function () {
2944
2943
  // });
2945
2944
 
2946
2945
  // await $http({ method: "get", url: "/url", cache }).then(callback);
2947
- // $rootScope.$digest();
2946
+ // ;
2948
2947
  // expect(callback).toHaveBeenCalled();
2949
2948
  // }));
2950
2949
 
@@ -2975,7 +2974,7 @@ describe("$http", function () {
2975
2974
  // cache,
2976
2975
  // headers: { foo: "baz" },
2977
2976
  // }).then(callback);
2978
- // $rootScope.$digest();
2977
+ // ;
2979
2978
 
2980
2979
  // expect(callback.calls.mostRecent().args[0].config.headers.foo).toBe(
2981
2980
  // "baz",
@@ -3030,7 +3029,7 @@ describe("$http", function () {
3030
3029
  // });
3031
3030
 
3032
3031
  // await $http({ method: "GET", url: "/abc", cache }).then(callback);
3033
- // $rootScope.$digest();
3032
+ // ;
3034
3033
  // expect(callback).toHaveBeenCalled();
3035
3034
  // });
3036
3035
 
@@ -3045,7 +3044,7 @@ describe("$http", function () {
3045
3044
  // callback();
3046
3045
  // });
3047
3046
 
3048
- // $rootScope.$digest();
3047
+ // ;
3049
3048
  // expect(callback).toHaveBeenCalled();
3050
3049
  // }));
3051
3050
 
@@ -3064,7 +3063,7 @@ describe("$http", function () {
3064
3063
 
3065
3064
  // // Second should be served from cache, without sending request to server.
3066
3065
  // await $http({ method: "get", url: "/url" }).then(callback);
3067
- // $rootScope.$digest();
3066
+ // ;
3068
3067
 
3069
3068
  // expect(callback).toHaveBeenCalled();
3070
3069
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -3100,7 +3099,7 @@ describe("$http", function () {
3100
3099
 
3101
3100
  // // Serve request from default cache when no local given.
3102
3101
  // await $http({ method: "get", url: "/url" }).then(callback);
3103
- // $rootScope.$digest();
3102
+ // ;
3104
3103
  // expect(callback).toHaveBeenCalled();
3105
3104
  // expect(callback.calls.mostRecent().args[0].data).toBe(
3106
3105
  // "content-default-cache",
@@ -3111,7 +3110,7 @@ describe("$http", function () {
3111
3110
  // await $http({ method: "get", url: "/url", cache: localCache }).then(
3112
3111
  // callback,
3113
3112
  // );
3114
- // $rootScope.$digest();
3113
+ // ;
3115
3114
  // expect(callback).toHaveBeenCalled();
3116
3115
  // expect(callback.calls.mostRecent().args[0].data).toBe(
3117
3116
  // "content-local-cache",
@@ -3197,7 +3196,7 @@ describe("$http", function () {
3197
3196
  // await $http({
3198
3197
  // method: "GET",
3199
3198
  // url: "/some",
3200
- // timeout: $timeout(() => {}, 10),
3199
+ // timeout: setTimeout(() => {}, 10),
3201
3200
  // }).then(onFulfilled, onRejected);
3202
3201
 
3203
3202
  // $timeout.flush(100);
@@ -3213,7 +3212,7 @@ describe("$http", function () {
3213
3212
  // expect($http.pendingRequests.length).toBe(0);
3214
3213
 
3215
3214
  // await $http({ method: "get", url: "/some" });
3216
- // $rootScope.$digest();
3215
+ // ;
3217
3216
  // expect($http.pendingRequests.length).toBe(1);
3218
3217
 
3219
3218
  // $httpBackend.flush();
@@ -3227,7 +3226,7 @@ describe("$http", function () {
3227
3226
 
3228
3227
  // await $http({ method: "get", url: "/cached", cache: true });
3229
3228
  // await $http({ method: "get", url: "/cached", cache: true });
3230
- // $rootScope.$digest();
3229
+ // ;
3231
3230
  // expect($http.pendingRequests.length).toBe(2);
3232
3231
 
3233
3232
  // $httpBackend.flush();
@@ -3235,7 +3234,7 @@ describe("$http", function () {
3235
3234
 
3236
3235
  // await $http({ method: "get", url: "/cached", cache: true });
3237
3236
  // spyOn($http.pendingRequests, "push").and.callThrough();
3238
- // $rootScope.$digest();
3237
+ // ;
3239
3238
  // expect($http.pendingRequests.push).toHaveBeenCalled();
3240
3239
 
3241
3240
  // $rootScope.$apply();
@@ -3248,7 +3247,7 @@ describe("$http", function () {
3248
3247
  // expect($http.pendingRequests.length).toBe(0);
3249
3248
  // });
3250
3249
 
3251
- // $rootScope.$digest();
3250
+ // ;
3252
3251
  // expect($http.pendingRequests.length).toBe(1);
3253
3252
  // $httpBackend.flush();
3254
3253
  // });
@@ -3343,7 +3342,7 @@ describe("$http", function () {
3343
3342
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
3344
3343
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3345
3344
 
3346
- // $rootScope.$digest();
3345
+ // ;
3347
3346
 
3348
3347
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
3349
3348
  // expect(completeOutstandingRequestSpy).toHaveBeenCalledOnceWith(
@@ -3423,7 +3422,7 @@ describe("$http", function () {
3423
3422
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3424
3423
 
3425
3424
  // $http.get("");
3426
- // $rootScope.$digest();
3425
+ // ;
3427
3426
 
3428
3427
  // expect(reqInterceptorFulfilled).toBe(false);
3429
3428
  // expect(resInterceptorFulfilled).toBe(false);
@@ -3439,7 +3438,7 @@ describe("$http", function () {
3439
3438
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3440
3439
 
3441
3440
  // resInterceptorDeferred.resolve();
3442
- // $rootScope.$digest();
3441
+ // ;
3443
3442
 
3444
3443
  // expect(reqInterceptorFulfilled).toBe(true);
3445
3444
  // expect(resInterceptorFulfilled).toBe(true);
@@ -3456,14 +3455,14 @@ describe("$http", function () {
3456
3455
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3457
3456
 
3458
3457
  // $http.get("").catch(() => {});
3459
- // $rootScope.$digest();
3458
+ // ;
3460
3459
 
3461
3460
  // expect(reqInterceptorFulfilled).toBe(false);
3462
3461
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
3463
3462
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3464
3463
 
3465
3464
  // reqInterceptorDeferred.reject();
3466
- // $rootScope.$digest();
3465
+ // ;
3467
3466
 
3468
3467
  // expect(reqInterceptorFulfilled).toBe(true);
3469
3468
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
@@ -3480,7 +3479,7 @@ describe("$http", function () {
3480
3479
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3481
3480
 
3482
3481
  // $http.get("").catch(() => {});
3483
- // $rootScope.$digest();
3482
+ // ;
3484
3483
 
3485
3484
  // expect(reqInterceptorFulfilled).toBe(false);
3486
3485
  // expect(resInterceptorFulfilled).toBe(false);
@@ -3496,7 +3495,7 @@ describe("$http", function () {
3496
3495
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3497
3496
 
3498
3497
  // resInterceptorDeferred.reject();
3499
- // $rootScope.$digest();
3498
+ // ;
3500
3499
 
3501
3500
  // expect(reqInterceptorFulfilled).toBe(true);
3502
3501
  // expect(resInterceptorFulfilled).toBe(true);
@@ -3702,7 +3701,7 @@ describe("$http", function () {
3702
3701
  // withCredentials: true,
3703
3702
  // responseType: "json",
3704
3703
  // });
3705
- // $rootScope.$digest();
3704
+ // ;
3706
3705
  // expect($httpBackend).toHaveBeenCalled();
3707
3706
  // });
3708
3707
 
@@ -3730,7 +3729,7 @@ describe("$http", function () {
3730
3729
  // timeout: 12345,
3731
3730
  // responseType: "json",
3732
3731
  // });
3733
- // $rootScope.$digest();
3732
+ // ;
3734
3733
  // expect($httpBackend).toHaveBeenCalled();
3735
3734
  // });
3736
3735
 
@@ -3771,7 +3770,7 @@ describe("$http", function () {
3771
3770
  // .respond(200, "<h1>Header!</h1>", {});
3772
3771
  // $http.get("/template1.html").then(handler);
3773
3772
  // // Ensure requests are sent
3774
- // $rootScope.$digest();
3773
+ // ;
3775
3774
 
3776
3775
  // $httpBackend.flush(null, null, false);
3777
3776
  // expect($rootScope.$applyAsync).toHaveBeenCalled();
@@ -3792,7 +3791,7 @@ describe("$http", function () {
3792
3791
  // $http.get("/template1.html").then(log.fn("response 1"));
3793
3792
  // $http.get("/template2.html").then(log.fn("response 2"));
3794
3793
  // // Ensure requests are sent
3795
- // $rootScope.$digest();
3794
+ // ;
3796
3795
 
3797
3796
  // $httpBackend.flush(null, null, false);
3798
3797
  // expect(log).toEqual([]);
@@ -3816,7 +3815,7 @@ describe("$http", function () {
3816
3815
  // $http.get("/template2.html").then(log.fn("response 2"));
3817
3816
  // $http.get("/template3.html").then(log.fn("response 3"));
3818
3817
  // // Ensure requests are sent
3819
- // $rootScope.$digest();
3818
+ // ;
3820
3819
 
3821
3820
  // // Intermediate $digest occurs before 3rd response is received, assert that pending responses
3822
3821
  // /// are handled
@@ -102,7 +102,6 @@ describe("$templateRequest", () => {
102
102
  content = html;
103
103
  });
104
104
 
105
- $rootScope.$digest();
106
105
  expect(content).toBe("<div>Hello</div>");
107
106
  });
108
107
 
@@ -115,8 +114,6 @@ describe("$templateRequest", () => {
115
114
  await $templateRequest("/mock/div").then(tplRequestCb);
116
115
 
117
116
  $templateRequest("/mock/div").then(tplRequestCb);
118
- $rootScope.$digest();
119
-
120
117
  expect(content[0]).toBe("<div>Hello</div>");
121
118
  expect(content[1]).toBe("<div>Hello</div>");
122
119
  expect($templateCache.get("/mock/div")).toBe("<div>Hello</div>");
@@ -130,8 +127,6 @@ describe("$templateRequest", () => {
130
127
  }
131
128
 
132
129
  await $templateRequest("tpl.html").then(tplRequestCb);
133
- $rootScope.$digest();
134
-
135
130
  expect(content[0]).toBe("_matias");
136
131
  });
137
132
 
@@ -147,8 +142,6 @@ describe("$templateRequest", () => {
147
142
  it("should not call `$exceptionHandler` when the template is empty", async () => {
148
143
  const onError = jasmine.createSpy("onError");
149
144
  await $templateRequest("/mock/empty").catch(onError);
150
- $rootScope.$digest();
151
-
152
145
  expect(onError).not.toHaveBeenCalled();
153
146
  });
154
147
 
@@ -158,13 +151,11 @@ describe("$templateRequest", () => {
158
151
 
159
152
  expect(() => {
160
153
  $templateRequest("tpl.html"); // should go through $sce
161
- $rootScope.$digest();
162
154
  }).toThrow();
163
155
 
164
156
  $templateCache.set("tpl.html", ""); // should work (empty template)
165
157
  expect(() => {
166
158
  $templateRequest("tpl.html");
167
- $rootScope.$digest();
168
159
  }).not.toThrow();
169
160
  $templateCache = new Map();
170
161
  });
@@ -175,7 +166,6 @@ describe("$templateRequest", () => {
175
166
 
176
167
  expect($templateRequest.totalPendingRequests).toBe(2);
177
168
 
178
- $rootScope.$digest();
179
169
  await res;
180
170
  expect($templateRequest.totalPendingRequests).toBe(0);
181
171
  });
@@ -159,7 +159,7 @@ describe("$httpBackend", () => {
159
159
  // null,
160
160
  // callback,
161
161
  // {},
162
- // $timeout(() => {}, 2000),
162
+ // setTimeout(() => {}, 2000),
163
163
  // );
164
164
  // spyOn(xhr, "abort");
165
165
  // expect(xhr.abort).toHaveBeenCalled();
@@ -179,7 +179,7 @@ describe("$httpBackend", () => {
179
179
  // null,
180
180
  // callback,
181
181
  // {},
182
- // $timeout(() => {}, 2000),
182
+ // setTimeout(() => {}, 2000),
183
183
  // );
184
184
  // xhr = MockXhr.$$lastInstance;
185
185
  // spyOn(xhr, "abort");
@@ -244,7 +244,7 @@ describe("$httpBackend", () => {
244
244
  // null,
245
245
  // callback,
246
246
  // {},
247
- // $timeout(() => {}, 2000),
247
+ // setTimeout(() => {}, 2000),
248
248
  // );
249
249
  // spyOn(xhr, "abort").and.callThrough();
250
250
 
@@ -57,18 +57,16 @@ export function TemplateRequestProvider() {
57
57
  "$exceptionHandler",
58
58
  "$templateCache",
59
59
  "$http",
60
- "$q",
61
60
  "$sce",
62
61
  /**
63
62
  *
64
63
  * @param {import('../core/exception-handler').ErrorHandler} $exceptionHandler
65
64
  * @param {import('../core/cache/cache-factory').TemplateCache} $templateCache
66
65
  * @param {*} $http
67
- * @param {*} $q
68
66
  * @param {*} $sce
69
67
  * @returns
70
68
  */
71
- function ($exceptionHandler, $templateCache, $http, $q, $sce) {
69
+ function ($exceptionHandler, $templateCache, $http, $sce) {
72
70
  function handleRequestFn(tpl, ignoreRequestError) {
73
71
  handleRequestFn.totalPendingRequests++;
74
72
 
@@ -124,7 +122,7 @@ export function TemplateRequestProvider() {
124
122
  $exceptionHandler(resp);
125
123
  }
126
124
 
127
- return $q.reject(resp);
125
+ return Promise.reject(resp);
128
126
  }
129
127
  }
130
128
 
@@ -1,6 +1,5 @@
1
1
  import { isDate, isFunction, isRegExp, isString } from "./utils";
2
2
  import { all, curry } from "./hof";
3
- import { services } from "../router/common/coreservices";
4
3
 
5
4
  export function equals(o1, o2) {
6
5
  if (o1 === o2) return true;
@@ -466,4 +465,4 @@ function _arraysEq(a1, a2) {
466
465
  export const silenceUncaughtInPromise = (promise) =>
467
466
  promise.catch(() => 0) && promise;
468
467
  export const silentRejection = (error) =>
469
- silenceUncaughtInPromise(services.$q.reject(error));
468
+ silenceUncaughtInPromise(Promise.reject(error));
@@ -1095,9 +1095,6 @@ function createEventHandler(element, events) {
1095
1095
  }
1096
1096
  };
1097
1097
 
1098
- // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all
1099
- // events on `element`
1100
- eventHandler.elem = element;
1101
1098
  return eventHandler;
1102
1099
  }
1103
1100
 
@@ -6,7 +6,7 @@
6
6
  * @property {?Function} handle
7
7
  *
8
8
  */
9
- export const EXPANDO: "ngId";
9
+ export const EXPANDO: "ng";
10
10
  /**
11
11
  * Expando cache for adding properties to DOM nodes with JavaScript.
12
12
  * This used to be an Object in JQLite decorator, but swapped out for a Map
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Creates a deep proxy for the target object, intercepting property changes
3
+ * and recursively applying proxies to nested objects.
4
+ *
5
+ * @param {Object} target - The object to be wrapped in a proxy.
6
+ * @param {Model} [context] - The context for the handler, used to track listeners.
7
+ * @returns {ProxyHandler<Object>} - A proxy that intercepts operations on the target object,
8
+ * or the original value if the target is not an object.
9
+ */
10
+ export function createModel(target?: any, context?: Model): ProxyHandler<any>;
11
+ /**
12
+ * @typedef {Object} AsyncQueueTask
13
+ * @property {Model} handler
14
+ * @property {Function} fn
15
+ * @property {Object} locals
16
+ */
17
+ export const $postUpdateQueue: any[];
18
+ /**
19
+ * @type {Function[]}
20
+ */
21
+ export const $$applyAsyncQueue: Function[];
22
+ export class RootModelProvider {
23
+ rootModel: ProxyHandler<any>;
24
+ $get: (string | ((exceptionHandler: import("../exception-handler").ErrorHandler, parse: import("../parse/parse.js").ParseService) => ProxyHandler<any>))[];
25
+ }
26
+ export type ModelPhase = number;
27
+ export namespace ModelPhase {
28
+ let NONE: number;
29
+ let WATCH: number;
30
+ let DIGEST: number;
31
+ }
32
+ export type AsyncQueueTask = {
33
+ handler: Model;
34
+ fn: Function;
35
+ locals: any;
36
+ };
37
+ /**
38
+ * Listener function definition.
39
+ */
40
+ export type Listener = {
41
+ /**
42
+ * - The original target object.
43
+ */
44
+ originalTarget: any;
45
+ /**
46
+ * - The function invoked when changes are detected.
47
+ */
48
+ listenerFn: ListenerFunction;
49
+ watchFn: import("../parse/parse.js").CompiledExpression;
50
+ id: number;
51
+ oneTime: boolean;
52
+ property: string;
53
+ /**
54
+ * - The optional context in which a property exists
55
+ */
56
+ context?: any;
57
+ foreignListener?: ProxyConstructor;
58
+ };
59
+ /**
60
+ * Listener function type.
61
+ */
62
+ export type ListenerFunction = (newValue: any, oldValue: any, originalTarget: any) => any;
63
+ /**
64
+ * Model class for the Proxy. It intercepts operations like property access (get)
65
+ * and property setting (set), and adds support for deep change tracking and
66
+ * observer-like behavior.
67
+ */
68
+ declare class Model {
69
+ /**
70
+ * Initializes the handler with the target object and a context.
71
+ *
72
+ * @param {Object} target - The target object being proxied.
73
+ * @param {Model} [context] - The context containing listeners.
74
+ */
75
+ constructor(target: any, context?: Model);
76
+ /** @type {Object} */
77
+ $target: any;
78
+ context: Model;
79
+ /** @type {Map<string, Array<Listener>>} Watch listeners */
80
+ listeners: Map<string, Array<Listener>>;
81
+ /** @type {Map<string, Array<Listener>>} Watch listeners from other proxies */
82
+ foreignListeners: Map<string, Array<Listener>>;
83
+ /** @type {WeakMap<Object, Array<string>>} */
84
+ objectListeners: WeakMap<any, Array<string>>;
85
+ /** @type {Map<Function, {oldValue: any, fn: Function}>} */
86
+ functionListeners: Map<Function, {
87
+ oldValue: any;
88
+ fn: Function;
89
+ }>;
90
+ /** @type {?number} */
91
+ listenerCache: number | null;
92
+ /** @type {Proxy} */
93
+ proxy: ProxyConstructor;
94
+ /**
95
+ * @type {Proxy[]}
96
+ */
97
+ children: ProxyConstructor[];
98
+ /**
99
+ * @type {number} Unique model ID (monotonically increasing) useful for debugging.
100
+ */
101
+ id: number;
102
+ /**
103
+ * @type {Model}
104
+ */
105
+ $root: Model;
106
+ $parent: Model;
107
+ /** @type {number} */
108
+ $$watchersCount: number;
109
+ /** @type {AsyncQueueTask[]} */
110
+ $$asyncQueue: AsyncQueueTask[];
111
+ /** @type {Map<String, Function[]>} Event listeners */
112
+ $$listeners: Map<string, Function[]>;
113
+ filters: any[];
114
+ /** @type {ModelPhase} */
115
+ state: ModelPhase;
116
+ /**
117
+ * Intercepts and handles property assignments on the target object. If a new value is
118
+ * an object, it will be recursively proxied.
119
+ *
120
+ * @param {Object} target - The target object.
121
+ * @param {string} property - The name of the property being set.
122
+ * @param {*} value - The new value being assigned to the property.
123
+ * @returns {boolean} - Returns true to indicate success of the operation.
124
+ */
125
+ set(target: any, property: string, value: any, proxy: any): boolean;
126
+ /**
127
+ * Intercepts property access on the target object. It checks for specific
128
+ * properties (`watch` and `sync`) and binds their methods. For other properties,
129
+ * it returns the value directly.
130
+ *
131
+ * @param {Object} target - The target object.
132
+ * @param {string|number|symbol} property - The name of the property being accessed.
133
+ * @param {Proxy} proxy - The proxy object being invoked
134
+ * @returns {*} - The value of the property or a method if accessing `watch` or `sync`.
135
+ */
136
+ get(target: any, property: string | number | symbol, proxy: ProxyConstructor): any;
137
+ /**
138
+ * @private
139
+ * @param {Listener[]} listeners
140
+ * @param {*} oldValue
141
+ */
142
+ private scheduleListener;
143
+ deleteProperty(target: any, property: any): boolean;
144
+ /**
145
+ * Registers a watcher for a property along with a listener function. The listener
146
+ * function is invoked when changes to that property are detected.
147
+ *
148
+ * @param {string} watchProp - An expression to be watched in the context of this model.
149
+ * @param {ListenerFunction} [listenerFn] - A function to execute when changes are detected on watched context.
150
+ */
151
+ $watch(watchProp: string, listenerFn?: ListenerFunction): () => void;
152
+ $watchGroup(watchArray: any, listenerFn: any): void;
153
+ $watchCollection(watchProp: any, listenerFn: any): () => void;
154
+ $new(isIsolated: boolean, parent: any): any;
155
+ registerKey(key: any, listener: any): void;
156
+ registerForeignKey(key: any, listener: any): void;
157
+ deregisterKey(key: any, id: any): boolean;
158
+ deregisterForeignKey(key: any, id: any): boolean;
159
+ /**
160
+ * @deprecated
161
+ */
162
+ $digest(): void;
163
+ $eval(expr: any, locals: any): any;
164
+ $evalAsync(expr: any, locals: any): Promise<any>;
165
+ $apply(expr: any): any;
166
+ $on(name: any, listener: any): () => void;
167
+ /**
168
+ * @param {string} name
169
+ * @param {...any} args
170
+ * @returns
171
+ */
172
+ $emit(name: string, ...args: any[]): any;
173
+ /**
174
+ * @param {string} name
175
+ * @param {...any} args
176
+ * @returns
177
+ */
178
+ $broadcast(name: string, ...args: any[]): any;
179
+ eventHelper({ name, event, broadcast }: {
180
+ name: any;
181
+ event: any;
182
+ broadcast: any;
183
+ }, ...args: any[]): any;
184
+ /**
185
+ * @private
186
+ * @returns {boolean}
187
+ */
188
+ private isRoot;
189
+ $applyAsync(expr: any): Promise<any>;
190
+ $postUpdate(fn: any): void;
191
+ $destroy(): void;
192
+ /**
193
+ * @param {number} count
194
+ */
195
+ incrementWatchersCount(count: number): void;
196
+ /**
197
+ * Invokes the registered listener function with watched property changes.
198
+ *
199
+ * @param {Listener} listener - The property path that was changed.
200
+ * @param {*} oldValue - The old value of the property.
201
+ */
202
+ notifyListener(listener: Listener, oldValue: any): void;
203
+ }
204
+ export {};