@angular-wave/angular.ts 0.6.2 → 0.6.3

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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "description": "A modern, optimized and typesafe version of AngularJS",
4
4
  "license": "MIT",
5
- "version": "0.6.2",
5
+ "version": "0.6.3",
6
6
  "type": "module",
7
7
  "main": "dist/angular-ts.esm.js",
8
8
  "browser": "dist/angular-ts.umd.js",
@@ -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 {
@@ -100,7 +115,7 @@ export function ngSwitchWhenDirective() {
100
115
  }
101
116
 
102
117
  /**
103
- * @returns {import('../../types').Directive}
118
+ * @returns {import('../../types.js').Directive}
104
119
  */
105
120
  export function ngSwitchDefaultDirective() {
106
121
  return {
@@ -1,17 +1,15 @@
1
1
  /**
2
- * @returns {import('../../types').Directive}
2
+ * @returns {import('../../types.js').Directive}
3
3
  */
4
- export function ngSwitchWhenDirective(): import("../../types").Directive;
4
+ export function ngSwitchDirective($animate: any): import("../../types.js").Directive;
5
+ export namespace ngSwitchDirective {
6
+ let $inject: string[];
7
+ }
5
8
  /**
6
- * @returns {import('../../types').Directive}
9
+ * @returns {import('../../types.js').Directive}
7
10
  */
8
- export function ngSwitchDefaultDirective(): import("../../types").Directive;
9
- export const ngSwitchDirective: (string | (($animate: any) => {
10
- require: string;
11
- controller: (string | {
12
- new (): {
13
- cases: {};
14
- };
15
- })[];
16
- link(scope: any, _element: any, attr: any, ngSwitchController: any): void;
17
- }))[];
11
+ export function ngSwitchWhenDirective(): import("../../types.js").Directive;
12
+ /**
13
+ * @returns {import('../../types.js').Directive}
14
+ */
15
+ export function ngSwitchDefaultDirective(): import("../../types.js").Directive;