@angular-wave/angular.ts 0.6.2 → 0.6.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 (171) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +2 -2
  3. package/package.json +1 -1
  4. package/src/angular.spec.js +2 -2
  5. package/src/animations/animate-children-directive.js +1 -1
  6. package/src/animations/animate-css-driver.js +2 -2
  7. package/src/animations/animate-css.js +1 -1
  8. package/src/animations/animate-js.js +1 -1
  9. package/src/animations/animate-queue.js +2 -2
  10. package/src/animations/animate.js +2 -2
  11. package/src/animations/animate.spec.js +3 -3
  12. package/src/animations/animation.js +2 -2
  13. package/src/binding.spec.js +1 -1
  14. package/src/core/cache/cache.js +1 -1
  15. package/src/core/compile/attributes.js +3 -3
  16. package/src/core/compile/compile.js +13 -140
  17. package/src/core/compile/compile.md +0 -8
  18. package/src/core/compile/compile.spec.js +35 -639
  19. package/src/core/controller/controller.js +1 -1
  20. package/src/core/di/injector.js +1 -1
  21. package/src/core/di/injector.spec.js +1 -1
  22. package/src/core/di/internal-injector.js +1 -1
  23. package/src/core/di/ng-module.js +1 -1
  24. package/src/core/filter/filter.js +1 -1
  25. package/src/core/interpolate/interpolate.js +1 -1
  26. package/src/core/interval/interval-factory.js +1 -1
  27. package/src/core/interval/interval.js +1 -1
  28. package/src/core/location/location.js +3 -3
  29. package/src/core/on.spec.js +1 -1
  30. package/src/core/parse/interpreter.js +1 -1
  31. package/src/core/prop.spec.js +2 -2
  32. package/src/core/q/q.js +1 -1
  33. package/src/core/root-element.spec.js +1 -1
  34. package/src/core/sanitize/sanitize-uri.js +1 -1
  35. package/src/core/sce/sce.js +2 -2
  36. package/src/core/sce/sce.spec.js +1 -1
  37. package/src/core/scope/scope.js +1 -1
  38. package/src/core/scope/scope.spec.js +1 -1
  39. package/src/core/timeout/timeout.js +1 -1
  40. package/src/core/url-utils/url-utils.js +1 -1
  41. package/src/directive/aria/aria.js +1 -1
  42. package/src/directive/aria/aria.spec.js +1 -1
  43. package/src/directive/attrs/attrs.js +3 -3
  44. package/src/directive/attrs/attrs.spec.js +1 -1
  45. package/src/directive/attrs/boolean.spec.js +1 -1
  46. package/src/directive/attrs/element-style.spec.js +1 -1
  47. package/src/directive/attrs/src.spec.js +1 -1
  48. package/src/directive/bind/bind.js +1 -1
  49. package/src/directive/bind/bind.spec.js +1 -1
  50. package/src/directive/bind/bing-html.spec.js +1 -1
  51. package/src/directive/change/change.spec.js +1 -1
  52. package/src/directive/class/class.js +1 -1
  53. package/src/directive/class/class.spec.js +2 -2
  54. package/src/directive/cloak/cloak.spec.js +1 -1
  55. package/src/directive/controller/controller.spec.js +2 -2
  56. package/src/directive/events/click.spec.js +1 -1
  57. package/src/directive/events/event.spec.js +1 -1
  58. package/src/directive/events/events.js +2 -2
  59. package/src/directive/form/form.js +2 -2
  60. package/src/directive/form/form.spec.js +1 -1
  61. package/src/directive/if/if.js +2 -3
  62. package/src/directive/if/if.md +0 -1
  63. package/src/directive/if/if.spec.js +2 -2
  64. package/src/directive/include/include.js +3 -3
  65. package/src/directive/include/include.spec.js +2 -2
  66. package/src/directive/init/init.spec.js +1 -1
  67. package/src/directive/input/input.js +1 -1
  68. package/src/directive/input/input.spec.js +1 -1
  69. package/src/directive/messages/messages.js +1 -1
  70. package/src/directive/messages/messages.spec.js +3 -3
  71. package/src/directive/model/model.js +6 -6
  72. package/src/directive/model/model.spec.js +2 -2
  73. package/src/directive/model-options/model-options.js +1 -1
  74. package/src/directive/model-options/model-options.spec.js +2 -2
  75. package/src/directive/non-bindable/non-bindable.spec.js +1 -1
  76. package/src/directive/observe/observe.spec.js +1 -1
  77. package/src/directive/options/options.js +6 -2
  78. package/src/directive/options/options.spec.js +2 -2
  79. package/src/directive/ref/href.spec.js +2 -2
  80. package/src/directive/ref/ref.js +1 -1
  81. package/src/directive/repeat/repeat.js +263 -255
  82. package/src/directive/repeat/repeat.md +0 -22
  83. package/src/directive/repeat/repeat.spec.js +2 -115
  84. package/src/directive/script/script.spec.js +1 -1
  85. package/src/directive/select/select.js +2 -2
  86. package/src/directive/select/select.spec.js +2 -2
  87. package/src/directive/show-hide/show-hide.js +1 -3
  88. package/src/directive/show-hide/show-hide.md +0 -2
  89. package/src/directive/show-hide/show-hide.spec.js +1 -1
  90. package/src/directive/style/style.spec.js +1 -1
  91. package/src/directive/switch/switch.js +29 -16
  92. package/src/directive/switch/switch.spec.js +1 -51
  93. package/src/directive/transclude/transclude.js +2 -2
  94. package/src/directive/validators/validators.js +2 -2
  95. package/src/directive/validators/validators.spec.js +1 -1
  96. package/src/filters/filter.js +1 -1
  97. package/src/filters/filter.spec.js +2 -2
  98. package/src/filters/filters.js +1 -1
  99. package/src/filters/filters.spec.js +1 -1
  100. package/src/filters/limit-to.js +1 -1
  101. package/src/filters/limit-to.spec.js +1 -1
  102. package/src/filters/order-by.js +1 -1
  103. package/src/index.js +3 -9
  104. package/src/loader.js +10 -5
  105. package/src/router/common/trace.js +1 -1
  106. package/src/router/directives/state-directives.js +1 -1
  107. package/src/router/directives/state-directives.spec.js +1 -1
  108. package/src/router/directives/view-directive.js +2 -2
  109. package/src/router/directives/view-directive.spec.js +1 -1
  110. package/src/router/hooks/redirect-to.js +1 -1
  111. package/src/router/params/param-type.js +1 -1
  112. package/src/router/params/param-types.js +1 -1
  113. package/src/router/params/param.js +1 -1
  114. package/src/router/resolve/resolvable.js +1 -1
  115. package/src/router/resolve/resolve-context.js +1 -1
  116. package/src/router/state/state-builder.js +1 -1
  117. package/src/router/state/state-matcher.js +1 -1
  118. package/src/router/state/state-object.js +1 -1
  119. package/src/router/state/state-queue-manager.js +1 -1
  120. package/src/router/state/state-registry.js +1 -1
  121. package/src/router/state/state-service.js +1 -1
  122. package/src/router/state/state.spec.js +2 -2
  123. package/src/router/state/target-state.js +1 -1
  124. package/src/router/state/views.js +1 -1
  125. package/src/router/state-provider.js +1 -1
  126. package/src/router/template-factory.js +1 -1
  127. package/src/router/template-factory.spec.js +1 -1
  128. package/src/router/transition/hook-registry.js +1 -1
  129. package/src/router/transition/transition-service.js +1 -1
  130. package/src/router/transition/transition.js +1 -1
  131. package/src/router/url/url-config.js +1 -1
  132. package/src/router/url/url-matcher.js +1 -1
  133. package/src/router/url/url-rule.js +1 -1
  134. package/src/router/url/url-rules.js +1 -1
  135. package/src/router/url/url-service.js +6 -1
  136. package/src/router/url/url-service.spec.js +1 -1
  137. package/src/router/view/view.spec.js +1 -1
  138. package/src/router/view-hook.spec.js +1 -1
  139. package/src/router/view-scroll.spec.js +1 -1
  140. package/src/services/anchor-scroll.js +1 -1
  141. package/src/services/browser.js +2 -2
  142. package/src/services/cookie-reader.js +1 -1
  143. package/src/services/http/http.js +2 -2
  144. package/src/services/http/http.spec.js +1 -1
  145. package/src/services/http-backend/http-backend.js +1 -1
  146. package/src/services/log.js +1 -1
  147. package/src/services/template-request.js +1 -1
  148. package/src/shared/common.js +1 -1
  149. package/src/shared/jqlite/jqlite.js +9 -9
  150. package/src/shared/jqlite/jqlite.spec.js +11 -11
  151. package/src/shared/min-err.spec.js +6 -1
  152. package/src/shared/predicates.js +1 -1
  153. package/src/shared/strings.js +1 -1
  154. package/src/shared/test-utils.js +1 -1
  155. package/src/shared/utils.js +1 -1
  156. package/src/shared/utils.spec.js +1 -1
  157. package/src/types.js +0 -2
  158. package/types/animations/animate-css-driver.d.ts +1 -1
  159. package/types/animations/animate.d.ts +1 -1
  160. package/types/core/cache/cache.d.ts +1 -1
  161. package/types/core/compile/attributes.d.ts +2 -2
  162. package/types/core/compile/compile.d.ts +1 -1
  163. package/types/core/location/location.d.ts +1 -1
  164. package/types/directive/model/model.d.ts +1 -1
  165. package/types/directive/repeat/repeat.d.ts +0 -1
  166. package/types/directive/switch/switch.d.ts +11 -13
  167. package/types/loader.d.ts +2 -0
  168. package/types/services/browser.d.ts +1 -1
  169. package/types/shared/jqlite/jqlite.d.ts +1 -1
  170. package/types/shared/test-utils.d.ts +1 -1
  171. package/types/types.d.ts +1 -5
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../../loader";
2
- import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
3
- import { valueFn } from "../../shared/utils";
2
+ import { dealoc, JQLite } from "../../shared/jqlite/jqlite.js";
3
+ import { valueFn } from "../../shared/utils.js";
4
4
 
5
5
  describe("ngRepeat", () => {
6
6
  let element;
@@ -1066,76 +1066,6 @@ describe("ngRepeat", () => {
1066
1066
  done();
1067
1067
  }, 300);
1068
1068
  });
1069
-
1070
- it("should remove whole block even if the number of elements inside it changes", () => {
1071
- scope.values = [1, 2, 3];
1072
-
1073
- element = $compile(
1074
- "<div>" +
1075
- '<div ng-repeat-start="val in values"></div>' +
1076
- "<span>{{val}}</span>" +
1077
- "<p ng-repeat-end></p>" +
1078
- "</div>",
1079
- )(scope);
1080
-
1081
- scope.$digest();
1082
-
1083
- const ends = element.find("p");
1084
- expect(ends.length).toBe(3);
1085
-
1086
- // insert an extra element inside the second block
1087
- const extra = JQLite("<strong></strong>")[0];
1088
- element[0].insertBefore(extra, ends[1]);
1089
-
1090
- scope.values.splice(1, 1);
1091
- scope.$digest();
1092
-
1093
- // expect the strong tag to be removed too
1094
- expect(
1095
- Array.from(element[0].children).map((x) => x.tagName.toLowerCase()),
1096
- ).toEqual(["div", "span", "p", "div", "span", "p"]);
1097
- });
1098
-
1099
- it("should move whole block even if the number of elements inside it changes", () => {
1100
- scope.values = [1, 2, 3];
1101
-
1102
- element = $compile(
1103
- "<div>" +
1104
- '<div ng-repeat-start="val in values"></div>' +
1105
- "<span>{{val}}</span>" +
1106
- "<p ng-repeat-end></p>" +
1107
- "</div>",
1108
- )(scope);
1109
-
1110
- scope.$digest();
1111
-
1112
- const ends = element.find("p");
1113
- expect(ends.length).toBe(3);
1114
-
1115
- // insert an extra element inside the third block
1116
- const extra = JQLite("<strong></strong>")[0];
1117
- element[0].insertBefore(extra, ends[2]);
1118
-
1119
- // move the third block to the beginning
1120
- scope.values.unshift(scope.values.pop());
1121
- scope.$digest();
1122
-
1123
- // expect the strong tag to be moved too
1124
- expect(
1125
- Array.from(element[0].children).map((x) => x.tagName.toLowerCase()),
1126
- ).toEqual([
1127
- "div",
1128
- "span",
1129
- "strong",
1130
- "p",
1131
- "div",
1132
- "span",
1133
- "p",
1134
- "div",
1135
- "span",
1136
- "p",
1137
- ]);
1138
- });
1139
1069
  });
1140
1070
 
1141
1071
  describe("stability", () => {
@@ -1302,49 +1232,6 @@ describe("ngRepeat", () => {
1302
1232
  });
1303
1233
  });
1304
1234
 
1305
- describe("ngRepeatStart", () => {
1306
- it("should grow multi-node repeater", () => {
1307
- scope.show = false;
1308
- scope.books = [
1309
- { title: "T1", description: "D1" },
1310
- { title: "T2", description: "D2" },
1311
- ];
1312
- element = $compile(
1313
- "<div>" +
1314
- '<dt ng-repeat-start="book in books">{{book.title}}:</dt>' +
1315
- "<dd ng-repeat-end>{{book.description}};</dd>" +
1316
- "</div>",
1317
- )(scope);
1318
-
1319
- scope.$digest();
1320
- expect(element.text()).toEqual("T1:D1;T2:D2;");
1321
- scope.books.push({ title: "T3", description: "D3" });
1322
- scope.$digest();
1323
- expect(element.text()).toEqual("T1:D1;T2:D2;T3:D3;");
1324
- });
1325
-
1326
- it("should not clobber ng-if when updating collection", () => {
1327
- scope.values = [1, 2, 3];
1328
- scope.showMe = true;
1329
-
1330
- element = $compile(
1331
- "<div>" +
1332
- '<div ng-repeat-start="val in values">val:{{val}};</div>' +
1333
- '<div ng-if="showMe" ng-repeat-end>if:{{val}};</div>' +
1334
- "</div>",
1335
- )(scope);
1336
-
1337
- scope.$digest();
1338
- expect(element.find("div").length).toBe(6);
1339
- scope.values.shift();
1340
- scope.values.push(4);
1341
-
1342
- scope.$digest();
1343
- expect(element.find("div").length).toBe(6);
1344
- expect(element.text()).not.toContain("if:1;");
1345
- });
1346
- });
1347
-
1348
1235
  describe("ngRepeat and transcludes", () => {
1349
1236
  it("should allow access to directive controller from children when used in a replace template", () => {
1350
1237
  let controller;
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../core/di/injector";
3
- import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
3
+ import { dealoc, JQLite } from "../../shared/jqlite/jqlite.js";
4
4
 
5
5
  describe("scriptDirective", () => {
6
6
  let $rootScope;
@@ -1,4 +1,4 @@
1
- import { JQLite } from "../../shared/jqlite/jqlite";
1
+ import { JQLite } from "../../shared/jqlite/jqlite.js";
2
2
  import {
3
3
  assertNotHasOwnProperty,
4
4
  equals,
@@ -6,7 +6,7 @@ import {
6
6
  includes,
7
7
  isDefined,
8
8
  shallowCopy,
9
- } from "../../shared/utils";
9
+ } from "../../shared/utils.js";
10
10
 
11
11
  function setOptionSelectedStatus(optionEl, value) {
12
12
  optionEl[0].selected = value;
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../../loader";
2
- import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
3
- import { hashKey, equals, isNumberNaN } from "../../shared/utils";
2
+ import { dealoc, JQLite } from "../../shared/jqlite/jqlite.js";
3
+ import { hashKey, equals, isNumberNaN } from "../../shared/utils.js";
4
4
  import { browserTrigger } from "../../shared/test-utils";
5
5
 
6
6
  describe("select", () => {
@@ -1,4 +1,4 @@
1
- import { hasAnimate } from "../../shared/utils";
1
+ import { hasAnimate } from "../../shared/utils.js";
2
2
 
3
3
  const NG_HIDE_CLASS = "ng-hide";
4
4
  const NG_HIDE_IN_PROGRESS_CLASS = "ng-hide-animate";
@@ -10,7 +10,6 @@ ngShowDirective.$inject = ["$animate"];
10
10
  export function ngShowDirective($animate) {
11
11
  return {
12
12
  restrict: "A",
13
- multiElement: true,
14
13
  link(scope, element, attr) {
15
14
  scope.$watch(attr.ngShow, (value) => {
16
15
  // we're adding a temporary, animation-specific class for ng-hide since this way
@@ -46,7 +45,6 @@ ngHideDirective.$inject = ["$animate"];
46
45
  export function ngHideDirective($animate) {
47
46
  return {
48
47
  restrict: "A",
49
- multiElement: true,
50
48
  link(scope, element, attr) {
51
49
  scope.$watch(attr.ngHide, (value) => {
52
50
  // The comment inside of the ngShowDirective explains why we add and
@@ -2,7 +2,6 @@
2
2
 
3
3
  - @ngdoc directive
4
4
  - @name ngShow
5
- - @multiElement
6
5
  -
7
6
  - @description
8
7
  - The `ngShow` directive shows or hides the given HTML element based on the expression provided to
@@ -133,7 +132,6 @@
133
132
 
134
133
  - @ngdoc directive
135
134
  - @name ngHide
136
- - @multiElement
137
135
  -
138
136
  - @description
139
137
  - The `ngHide` directive shows or hides the given HTML element based on the expression provided to
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../core/di/injector";
3
- import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
3
+ import { dealoc, JQLite } from "../../shared/jqlite/jqlite.js";
4
4
 
5
5
  describe("ngShow / ngHide", () => {
6
6
  let $scope;
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../core/di/injector";
3
- import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
3
+ import { dealoc, JQLite } from "../../shared/jqlite/jqlite.js";
4
4
 
5
5
  describe("ng-style", () => {
6
6
  let $scope;
@@ -1,8 +1,14 @@
1
- import { getBlockNodes } from "../../shared/jqlite/jqlite";
1
+ import { getBlockNodes } from "../../shared/jqlite/jqlite.js";
2
+ import { hasAnimate } from "../../shared/utils.js";
3
+ import { domInsert } from "../../animations/animate.js";
2
4
 
3
- export const ngSwitchDirective = [
4
- "$animate",
5
- ($animate) => ({
5
+ ngSwitchDirective.$inject = ["$animate"];
6
+
7
+ /**
8
+ * @returns {import('../../types.js').Directive}
9
+ */
10
+ export function ngSwitchDirective($animate) {
11
+ return {
6
12
  require: "ngSwitch",
7
13
 
8
14
  // asks for $scope to fool the BC controller module
@@ -39,9 +45,14 @@ export const ngSwitchDirective = [
39
45
  for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
40
46
  const selected = getBlockNodes(selectedElements[i].clone);
41
47
  selectedScopes[i].$destroy();
42
- const runner = (previousLeaveAnimations[i] =
43
- $animate.leave(selected));
44
- runner.done(spliceFactory(previousLeaveAnimations, i));
48
+
49
+ if (hasAnimate(selected[0])) {
50
+ const runner = (previousLeaveAnimations[i] =
51
+ $animate.leave(selected));
52
+ runner.done(spliceFactory(previousLeaveAnimations, i));
53
+ } else {
54
+ selected.remove();
55
+ }
45
56
  }
46
57
 
47
58
  selectedElements.length = 0;
@@ -49,8 +60,8 @@ export const ngSwitchDirective = [
49
60
 
50
61
  if (
51
62
  (selectedTranscludes =
52
- ngSwitchController.cases[`!${value}`] ||
53
- ngSwitchController.cases["?"])
63
+ ngSwitchController["cases"][`!${value}`] ||
64
+ ngSwitchController["cases"]["?"])
54
65
  ) {
55
66
  Object.values(selectedTranscludes).forEach((selectedTransclude) => {
56
67
  selectedTransclude.transclude((caseElement, selectedScope) => {
@@ -60,17 +71,21 @@ export const ngSwitchDirective = [
60
71
  caseElement[caseElement.length++] = document.createComment("");
61
72
  const block = { clone: caseElement };
62
73
  selectedElements.push(block);
63
- $animate.enter(caseElement, anchor.parent(), anchor);
74
+ if (hasAnimate(caseElement[0])) {
75
+ $animate.enter(caseElement, anchor.parent(), anchor);
76
+ } else {
77
+ domInsert(caseElement, anchor.parent(), anchor);
78
+ }
64
79
  });
65
80
  });
66
81
  }
67
82
  });
68
83
  },
69
- }),
70
- ];
84
+ };
85
+ }
71
86
 
72
87
  /**
73
- * @returns {import('../../types').Directive}
88
+ * @returns {import('../../types.js').Directive}
74
89
  */
75
90
  export function ngSwitchWhenDirective() {
76
91
  return {
@@ -78,7 +93,6 @@ export function ngSwitchWhenDirective() {
78
93
  priority: 1200,
79
94
  restrict: "EA",
80
95
  require: "^ngSwitch",
81
- multiElement: true,
82
96
  link(scope, element, attrs, ctrl, $transclude) {
83
97
  const cases = attrs.ngSwitchWhen
84
98
  .split(attrs.ngSwitchWhenSeparator)
@@ -100,7 +114,7 @@ export function ngSwitchWhenDirective() {
100
114
  }
101
115
 
102
116
  /**
103
- * @returns {import('../../types').Directive}
117
+ * @returns {import('../../types.js').Directive}
104
118
  */
105
119
  export function ngSwitchDefaultDirective() {
106
120
  return {
@@ -108,7 +122,6 @@ export function ngSwitchDefaultDirective() {
108
122
  transclude: "element",
109
123
  priority: 1200,
110
124
  require: "^ngSwitch",
111
- multiElement: true,
112
125
  link(_scope, element, _attr, ctrl, $transclude) {
113
126
  ctrl["cases"]["?"] = ctrl["cases"]["?"] || [];
114
127
  ctrl["cases"]["?"].push({ transclude: $transclude, element });
@@ -1,5 +1,5 @@
1
1
  import { Angular } from "../../loader";
2
- import { dealoc } from "../../shared/jqlite/jqlite";
2
+ import { dealoc } from "../../shared/jqlite/jqlite.js";
3
3
 
4
4
  describe("ngSwitch", () => {
5
5
  let $scope;
@@ -79,31 +79,6 @@ describe("ngSwitch", () => {
79
79
  expect(element.text()).toEqual("true:misko");
80
80
  });
81
81
 
82
- it("should show all elements between start and end markers that match the current value", () => {
83
- element = $compile(
84
- '<ul ng-switch="select">' +
85
- '<li ng-switch-when-start="1">A</li>' +
86
- "<li>B</li>" +
87
- "<li ng-switch-when-end>C</li>" +
88
- '<li ng-switch-when-start="2">D</li>' +
89
- "<li>E</li>" +
90
- "<li ng-switch-when-end>F</li>" +
91
- "</ul>",
92
- )($scope);
93
-
94
- $scope.$apply('select = "1"');
95
- expect(element.find("li").length).toBe(3);
96
- expect(element.find("li").eq(0).text()).toBe("A");
97
- expect(element.find("li").eq(1).text()).toBe("B");
98
- expect(element.find("li").eq(2).text()).toBe("C");
99
-
100
- $scope.$apply('select = "2"');
101
- expect(element.find("li").length).toBe(3);
102
- expect(element.find("li").eq(0).text()).toBe("D");
103
- expect(element.find("li").eq(1).text()).toBe("E");
104
- expect(element.find("li").eq(2).text()).toBe("F");
105
- });
106
-
107
82
  it("should switch on switch-when-default", () => {
108
83
  element = $compile(
109
84
  '<ng-switch on="select">' +
@@ -118,31 +93,6 @@ describe("ngSwitch", () => {
118
93
  expect(element.text()).toEqual("one");
119
94
  });
120
95
 
121
- it("should show all default elements between start and end markers when no match", () => {
122
- element = $compile(
123
- '<ul ng-switch="select">' +
124
- '<li ng-switch-when-start="1">A</li>' +
125
- "<li>B</li>" +
126
- "<li ng-switch-when-end>C</li>" +
127
- "<li ng-switch-default-start>D</li>" +
128
- "<li>E</li>" +
129
- "<li ng-switch-default-end>F</li>" +
130
- "</ul>",
131
- )($scope);
132
-
133
- $scope.$apply('select = "1"');
134
- expect(element.find("li").length).toBe(3);
135
- expect(element.find("li").eq(0).text()).toBe("A");
136
- expect(element.find("li").eq(1).text()).toBe("B");
137
- expect(element.find("li").eq(2).text()).toBe("C");
138
-
139
- $scope.$apply('select = "2"');
140
- expect(element.find("li").length).toBe(3);
141
- expect(element.find("li").eq(0).text()).toBe("D");
142
- expect(element.find("li").eq(1).text()).toBe("E");
143
- expect(element.find("li").eq(2).text()).toBe("F");
144
- });
145
-
146
96
  it("should show all switch-when-default", () => {
147
97
  element = $compile(
148
98
  '<ul ng-switch="select">' +
@@ -1,5 +1,5 @@
1
- import { minErr } from "../../shared/utils";
2
- import { startingTag } from "../../shared/jqlite/jqlite";
1
+ import { minErr } from "../../shared/utils.js";
2
+ import { startingTag } from "../../shared/jqlite/jqlite.js";
3
3
 
4
4
  /**
5
5
  * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
@@ -4,9 +4,9 @@ import {
4
4
  toInt,
5
5
  minErr,
6
6
  isUndefined,
7
- } from "../../shared/utils";
7
+ } from "../../shared/utils.js";
8
8
  import { REGEX_STRING_REGEXP } from "./../attrs/attrs";
9
- import { startingTag } from "../../shared/jqlite/jqlite";
9
+ import { startingTag } from "../../shared/jqlite/jqlite.js";
10
10
 
11
11
  /**
12
12
  *
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../../loader";
2
2
  import { createInjector } from "../../core/di/injector";
3
- import { dealoc } from "../../shared/jqlite/jqlite";
3
+ import { dealoc } from "../../shared/jqlite/jqlite.js";
4
4
 
5
5
  describe("validators", () => {
6
6
  let $rootScope;
@@ -6,7 +6,7 @@ import {
6
6
  isObject,
7
7
  hasCustomToString,
8
8
  equals,
9
- } from "../shared/utils";
9
+ } from "../shared/utils.js";
10
10
 
11
11
  /**
12
12
  * @returns {function(Array, string|Object|function(any, number, []):[], function(any, any):boolean|boolean, string?): Array}
@@ -1,7 +1,7 @@
1
1
  import { Angular } from "../loader";
2
2
  import { createInjector } from "../core/di/injector";
3
- import { isString, includes } from "../shared/utils";
4
- import { JQLite } from "../shared/jqlite/jqlite";
3
+ import { isString, includes } from "../shared/utils.js";
4
+ import { JQLite } from "../shared/jqlite/jqlite.js";
5
5
 
6
6
  describe("Filter: filter", () => {
7
7
  let filter;
@@ -1,4 +1,4 @@
1
- import { isNumber, isString, isUndefined, toJson } from "../shared/utils";
1
+ import { isNumber, isString, isUndefined, toJson } from "../shared/utils.js";
2
2
 
3
3
  const MAX_DIGITS = 22;
4
4
  const DECIMAL_SEP = ".";
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../loader";
2
2
  import { createInjector } from "../core/di/injector";
3
- import { toJson } from "../shared/utils";
3
+ import { toJson } from "../shared/utils.js";
4
4
 
5
5
  describe("filters", () => {
6
6
  let filter;
@@ -4,7 +4,7 @@ import {
4
4
  isNumberNaN,
5
5
  isString,
6
6
  toInt,
7
- } from "../shared/utils";
7
+ } from "../shared/utils.js";
8
8
 
9
9
  /**
10
10
  * @returns {function(Array|ArrayLike|string|number, string|number, (string|number)?):Array|ArrayLike|string|number}
@@ -1,6 +1,6 @@
1
1
  import { Angular } from "../loader";
2
2
  import { createInjector } from "../core/di/injector";
3
- import { JQLite } from "../shared/jqlite/jqlite";
3
+ import { JQLite } from "../shared/jqlite/jqlite.js";
4
4
 
5
5
  describe("Filter: limitTo", () => {
6
6
  let items;
@@ -5,7 +5,7 @@ import {
5
5
  isArrayLike,
6
6
  isString,
7
7
  minErr,
8
- } from "../shared/utils";
8
+ } from "../shared/utils.js";
9
9
 
10
10
  orderByFilter.$inject = ["$parse"];
11
11
 
package/src/index.js CHANGED
@@ -1,12 +1,6 @@
1
1
  import { Angular } from "./loader";
2
2
 
3
3
  export const angular = new Angular();
4
- window["angular"] = angular;
5
-
6
- if (document.readyState === "complete") {
7
- angular.init(document);
8
- } else {
9
- document.addEventListener("DOMContentLoaded", () => {
10
- angular.init(document);
11
- });
12
- }
4
+ document.addEventListener("DOMContentLoaded", () => angular.init(document), {
5
+ once: true,
6
+ });
package/src/loader.js CHANGED
@@ -4,15 +4,16 @@ import {
4
4
  ngAttrPrefixes,
5
5
  assertNotHasOwnProperty,
6
6
  errorHandlingConfig,
7
- } from "./shared/utils";
8
- import { JQLite } from "./shared/jqlite/jqlite";
7
+ } from "./shared/utils.js";
8
+ import { JQLite } from "./shared/jqlite/jqlite.js";
9
9
  import { annotate, createInjector } from "./core/di/injector";
10
10
  import { NgModule } from "./core/di/ng-module";
11
- import { CACHE } from "./core/cache/cache";
11
+ import { Cache } from "./core/cache/cache.js";
12
12
  import { publishExternalAPI } from "./public";
13
13
  import { VERSION } from "./public";
14
14
  import { services } from "./router/common/coreservices";
15
15
  import { unnestR } from "./shared/common";
16
+ import { EventBus } from "./core/pubsub/pubsub.js";
16
17
 
17
18
  const ngMinErr = minErr("ng");
18
19
  const $injectorMinErr = minErr("$injector");
@@ -29,10 +30,13 @@ const modules = {};
29
30
 
30
31
  export class Angular {
31
32
  constructor() {
32
- CACHE.clear(); // a ensure new instance of angular gets a clean cache
33
+ Cache.clear(); // a ensure new instance of angular gets a clean Cache
33
34
 
34
35
  /** @type {Map<number, import("./core/cache/cache").ExpandoStore>} */
35
- this.cache = CACHE;
36
+ this.cache = Cache;
37
+
38
+ /** @type {import('./core/pubsub/pubsub.js').PubSub} */
39
+ this.eventBus = EventBus;
36
40
 
37
41
  /** @type {string} */
38
42
  this.version = VERSION;
@@ -45,6 +49,7 @@ export class Angular {
45
49
 
46
50
  /** @type {Function} */
47
51
  this.doBootstrap;
52
+ window["angular"] = this;
48
53
  publishExternalAPI(this);
49
54
  }
50
55
 
@@ -33,7 +33,7 @@
33
33
  * @packageDocumentation
34
34
  */
35
35
  import { parse } from "../../shared/hof";
36
- import { isNumber } from "../../shared/utils";
36
+ import { isNumber } from "../../shared/utils.js";
37
37
  import {
38
38
  stringify,
39
39
  functionToString,
@@ -1,5 +1,5 @@
1
1
  import { tail, unnestR, uniqR, removeFrom } from "../../shared/common";
2
- import { isString, isObject } from "../../shared/utils";
2
+ import { isString, isObject } from "../../shared/utils.js";
3
3
 
4
4
  import { parse } from "../../shared/hof";
5
5
  /** @ignore */
@@ -1,4 +1,4 @@
1
- import { JQLite } from "../../shared/jqlite/jqlite";
1
+ import { JQLite } from "../../shared/jqlite/jqlite.js";
2
2
  import { Angular } from "../../loader";
3
3
  import { browserTrigger, wait } from "../../shared/test-utils";
4
4
 
@@ -1,11 +1,11 @@
1
1
  import { filter, tail, unnestR } from "../../shared/common";
2
- import { isDefined, isFunction, isString } from "../../shared/utils";
2
+ import { isDefined, isFunction, isString } from "../../shared/utils.js";
3
3
  import { kebobString } from "../../shared/strings";
4
4
  import { parse } from "../../shared/hof";
5
5
  import { ResolveContext } from "../resolve/resolve-context";
6
6
  import { trace } from "../common/trace";
7
7
  import { Ng1ViewConfig } from "../state/views";
8
- import { JQLite } from "../../shared/jqlite/jqlite";
8
+ import { JQLite } from "../../shared/jqlite/jqlite.js";
9
9
  import { getLocals } from "../state/state-registry";
10
10
  /**
11
11
  * `ui-view`: A viewport directive which is filled in by a view from the active state.
@@ -6,7 +6,7 @@
6
6
  // }
7
7
  // }
8
8
 
9
- import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
9
+ import { dealoc, JQLite } from "../../shared/jqlite/jqlite.js";
10
10
  import { Angular } from "../../loader";
11
11
  import { wait } from "../../shared/test-utils";
12
12
 
@@ -1,4 +1,4 @@
1
- import { isString, isFunction } from "../../shared/utils";
1
+ import { isString, isFunction } from "../../shared/utils.js";
2
2
  import { services } from "../common/coreservices";
3
3
  import { TargetState } from "../state/target-state";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { filter, map } from "../../shared/common";
2
- import { isDefined } from "../../shared/utils";
2
+ import { isDefined } from "../../shared/utils.js";
3
3
  /**
4
4
  * An internal class which implements [[ParamTypeDefinition]].
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { equals, inherit, map, pick } from "../../shared/common";
2
2
  import { isNullOrUndefined } from "../../shared/predicates";
3
- import { isDefined } from "../../shared/utils";
3
+ import { isDefined } from "../../shared/utils.js";
4
4
  import { is } from "../../shared/hof";
5
5
  import { services } from "../common/coreservices";
6
6
  import { ParamType } from "./param-type";
@@ -1,6 +1,6 @@
1
1
  import { filter, map, allTrueR, find } from "../../shared/common";
2
2
  import { isInjectable } from "../../shared/predicates";
3
- import { isDefined, isUndefined, isString } from "../../shared/utils";
3
+ import { isDefined, isUndefined, isString } from "../../shared/utils.js";
4
4
  import { services } from "../common/coreservices";
5
5
  import { ParamType } from "./param-type";
6
6
 
@@ -1,4 +1,4 @@
1
- import { assert, isFunction, isObject } from "../../shared/utils";
1
+ import { assert, isFunction, isObject } from "../../shared/utils.js";
2
2
  import { services } from "../common/coreservices";
3
3
  import { trace } from "../common/trace";
4
4
  import { stringify } from "../../shared/strings";
@@ -5,7 +5,7 @@ import { services } from "../common/coreservices";
5
5
  import { Resolvable } from "./resolvable";
6
6
  import { PathUtils } from "../path/path-utils";
7
7
  import { stringify } from "../../shared/strings";
8
- import { isUndefined } from "../../shared/utils";
8
+ import { isUndefined } from "../../shared/utils.js";
9
9
 
10
10
  export const resolvePolicies = {
11
11
  when: {