@angular-wave/angular.ts 0.0.46 → 0.0.47

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.46",
4
+ "version": "0.0.47",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
@@ -137,7 +137,7 @@ export const $$AnimateCssDriverProvider = [
137
137
 
138
138
  // we iterate directly since safari messes up and doesn't return
139
139
  // all the keys for the coords object when iterated
140
- forEach(["width", "height", "top", "left"], (key) => {
140
+ ["width", "height", "top", "left"].forEach((key) => {
141
141
  let value = coords[key];
142
142
  switch (key) {
143
143
  case "top":
@@ -54,7 +54,7 @@ export const $$AnimateQueueProvider = [
54
54
  const keys = classString.split(ONE_SPACE);
55
55
  const map = Object.create(null);
56
56
 
57
- forEach(keys, (key) => {
57
+ keys.forEach((key) => {
58
58
  map[key] = true;
59
59
  });
60
60
  return map;
@@ -256,7 +256,7 @@ export const $$AnimateQueueProvider = [
256
256
  const matches = [];
257
257
  const entries = callbackRegistry[event];
258
258
  if (entries) {
259
- forEach(entries, (entry) => {
259
+ entries.forEach((entry) => {
260
260
  if (contains.call(entry.node, targetNode)) {
261
261
  matches.push(entry.callback);
262
262
  } else if (
@@ -694,7 +694,7 @@ export const $$AnimateQueueProvider = [
694
694
  runInNextPostDigestOrNow(() => {
695
695
  const callbacks = findCallbacks(parentNode, node, event);
696
696
  if (callbacks.length) {
697
- forEach(callbacks, (callback) => {
697
+ callbacks.forEach((callback) => {
698
698
  callback(element, phase, data);
699
699
  });
700
700
  cleanupEventListeners(phase, node);
@@ -1,4 +1,4 @@
1
- import { forEach, isObject } from "../../shared/utils";
1
+ import { isObject } from "../../shared/utils";
2
2
  import { filterFilter } from "../../filters/filter";
3
3
  import { jsonFilter } from "../../filters/filters";
4
4
  import { limitToFilter } from "../../filters/limit-to";
@@ -11,7 +11,7 @@ export function $FilterProvider($provide) {
11
11
  function register(name, factory) {
12
12
  if (isObject(name)) {
13
13
  const filters = {};
14
- forEach(name, (filter, key) => {
14
+ Object.entries(name).forEach(([key, filter]) => {
15
15
  filters[key] = register(key, filter);
16
16
  });
17
17
  return filters;
@@ -583,7 +583,7 @@ const locationPrototype = {
583
583
  } else if (isObject(search)) {
584
584
  search = structuredClone(search, {});
585
585
  // remove object undefined or null properties
586
- forEach(search, (value, key) => {
586
+ Object.entries(search).forEach(([key, value]) => {
587
587
  if (value == null) delete search[key];
588
588
  });
589
589
 
@@ -778,7 +778,7 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
778
778
  switch (ast.type) {
779
779
  case ASTType.Program:
780
780
  allConstants = true;
781
- forEach(ast.body, (expr) => {
781
+ /** @type {[any]} */ (ast.body).forEach((expr) => {
782
782
  findConstantAndWatchExpressions(expr.expression, $filter, astIsPure);
783
783
  allConstants = allConstants && expr.expression.constant;
784
784
  });
@@ -1,194 +1,13 @@
1
1
  import { BOOLEAN_ATTR } from "../../shared/jqlite/jqlite";
2
- import { forEach, directiveNormalize } from "../../shared/utils";
2
+ import { directiveNormalize } from "../../shared/utils";
3
3
  import { ALIASED_ATTR } from "../../shared/constants";
4
4
 
5
- /**
6
- * @ngdoc directive
7
- * @name ngHref
8
- * @restrict A
9
- * @priority 99
10
- *
11
- * @description
12
- * Using AngularJS markup like `{{hash}}` in an href attribute will
13
- * make the link go to the wrong URL if the user clicks it before
14
- * AngularJS has a chance to replace the `{{hash}}` markup with its
15
- * value. Until AngularJS replaces the markup the link will be broken
16
- * and will most likely return a 404 error. The `ngHref` directive
17
- * solves this problem.
18
- *
19
- * The wrong way to write it:
20
- * ```html
21
- * <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
22
- * ```
23
- *
24
- * The correct way to write it:
25
- * ```html
26
- * <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
27
- * ```
28
- *
29
- * @element A
30
- * @param {template} ngHref any string which can contain `{{}}` markup.
31
- *
32
- */
33
-
34
5
  export const REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
35
- /**
36
- * @ngdoc directive
37
- * @name ngSrc
38
- * @restrict A
39
- * @priority 99
40
- *
41
- * @description
42
- * Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't
43
- * work right: The browser will fetch from the URL with the literal
44
- * text `{{hash}}` until AngularJS replaces the expression inside
45
- * `{{hash}}`. The `ngSrc` directive solves this problem.
46
- *
47
- * The buggy way to write it:
48
- * ```html
49
- * <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
50
- * ```
51
- *
52
- * The correct way to write it:
53
- * ```html
54
- * <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
55
- * ```
56
- *
57
- * @element IMG
58
- * @param {template} ngSrc any string which can contain `{{}}` markup.
59
- */
60
-
61
- /**
62
- * @ngdoc directive
63
- * @name ngSrcset
64
- * @restrict A
65
- * @priority 99
66
- *
67
- * @description
68
- * Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't
69
- * work right: The browser will fetch from the URL with the literal
70
- * text `{{hash}}` until AngularJS replaces the expression inside
71
- * `{{hash}}`. The `ngSrcset` directive solves this problem.
72
- *
73
- * The buggy way to write it:
74
- * ```html
75
- * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
76
- * ```
77
- *
78
- * The correct way to write it:
79
- * ```html
80
- * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
81
- * ```
82
- *
83
- * @element IMG
84
- * @param {template} ngSrcset any string which can contain `{{}}` markup.
85
- */
86
-
87
- /**
88
- * @ngdoc directive
89
- * @name ngDisabled
90
- * @restrict A
91
- * @priority 100
92
- *
93
- * @description
94
- *
95
- * This directive sets the `disabled` attribute on the element (typically a form control,
96
- * e.g. `input`, `button`, `select` etc.) if the
97
- * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
98
- *
99
- * A special directive is necessary because we cannot use interpolation inside the `disabled`
100
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
101
- *
102
- * @param {string} ngDisabled If the {@link guide/expression expression} is truthy,
103
- * then the `disabled` attribute will be set on the element
104
- */
105
-
106
- /**
107
- * @ngdoc directive
108
- * @name ngChecked
109
- * @restrict A
110
- * @priority 100
111
- *
112
- * @description
113
- * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
114
- *
115
- * Note that this directive should not be used together with {@link ngModel `ngModel`},
116
- * as this can lead to unexpected behavior.
117
- *
118
- * A special directive is necessary because we cannot use interpolation inside the `checked`
119
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
120
- *
121
- * @element INPUT
122
- * @param {string} ngChecked If the {@link guide/expression expression} is truthy,
123
- * then the `checked` attribute will be set on the element
124
- */
125
-
126
- /**
127
- *
128
- * @description
129
- *
130
- * Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
131
- * Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
132
- * MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
133
- *
134
- * A special directive is necessary because we cannot use interpolation inside the `readonly`
135
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
136
- * @element INPUT
137
- * @param {string} ngReadonly If the {@link guide/expression expression} is truthy,
138
- * then special attribute "readonly" will be set on the element
139
- */
140
-
141
- /**
142
- * @ngdoc directive
143
- * @name ngSelected
144
- * @restrict A
145
- * @priority 100
146
- *
147
- * @description
148
- *
149
- * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
150
- *
151
- * A special directive is necessary because we cannot use interpolation inside the `selected`
152
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
153
- *
154
- * <div class="alert alert-warning">
155
- * **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
156
- * sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
157
- * should not use `ngSelected` on the options, as `ngModel` will set the select value and
158
- * selected options.
159
- * </div>
160
- * @element OPTION
161
- * @param {string} ngSelected If the {@link guide/expression expression} is truthy,
162
- * then special attribute "selected" will be set on the element
163
- */
164
-
165
- /**
166
- * @ngdoc directive
167
- * @name ngOpen
168
- * @restrict A
169
- * @priority 100
170
- *
171
- * @description
172
- *
173
- * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
174
- *
175
- * A special directive is necessary because we cannot use interpolation inside the `open`
176
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
177
- *
178
- * ## A note about browser compatibility
179
- *
180
- * Internet Explorer and Edge do not support the `details` element, it is
181
- * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
182
- *
183
- * @element DETAILS
184
- * @param {string} ngOpen If the {@link guide/expression expression} is truthy,
185
- * then special attribute "open" will be set on the element
186
- */
187
6
 
188
7
  export const ngAttributeAliasDirectives = {};
189
8
 
190
9
  // boolean attrs are evaluated
191
- forEach(BOOLEAN_ATTR, (propName, attrName) => {
10
+ Object.entries(BOOLEAN_ATTR).forEach(([attrName, propName]) => {
192
11
  // binding to multiple is not supported
193
12
  if (propName === "multiple") return;
194
13
 
@@ -220,7 +39,7 @@ forEach(BOOLEAN_ATTR, (propName, attrName) => {
220
39
  });
221
40
 
222
41
  // aliased input attrs are evaluated
223
- forEach(ALIASED_ATTR, (htmlAttr, ngAttr) => {
42
+ Object.entries(ALIASED_ATTR).forEach(([ngAttr]) => {
224
43
  ngAttributeAliasDirectives[ngAttr] = function () {
225
44
  return {
226
45
  priority: 100,
@@ -244,7 +63,7 @@ forEach(ALIASED_ATTR, (htmlAttr, ngAttr) => {
244
63
  });
245
64
 
246
65
  // ng-src, ng-srcset, ng-href are interpolated
247
- forEach(["src", "srcset", "href"], (attrName) => {
66
+ ["src", "srcset", "href"].forEach((attrName) => {
248
67
  const normalized = directiveNormalize(`ng-${attrName}`);
249
68
  ngAttributeAliasDirectives[normalized] = [
250
69
  "$sce",
@@ -0,0 +1,224 @@
1
+ /\*\*
2
+
3
+ - @ngdoc directive
4
+ - @name ngHref
5
+ - @restrict A
6
+ - @priority 99
7
+ -
8
+ - @description
9
+ - Using AngularJS markup like `{{hash}}` in an href attribute will
10
+ - make the link go to the wrong URL if the user clicks it before
11
+ - AngularJS has a chance to replace the `{{hash}}` markup with its
12
+ - value. Until AngularJS replaces the markup the link will be broken
13
+ - and will most likely return a 404 error. The `ngHref` directive
14
+ - solves this problem.
15
+ -
16
+ - The wrong way to write it:
17
+ - ```html
18
+
19
+ ```
20
+
21
+ - <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
22
+ - ```
23
+
24
+ ```
25
+
26
+ -
27
+ - The correct way to write it:
28
+ - ```html
29
+
30
+ ```
31
+
32
+ - <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
33
+ - ```
34
+
35
+ ```
36
+
37
+ -
38
+ - @element A
39
+ - @param {template} ngHref any string which can contain `{{}}` markup.
40
+ - \*/
41
+
42
+ /\*\*
43
+
44
+ - @ngdoc directive
45
+ - @name ngSrc
46
+ - @restrict A
47
+ - @priority 99
48
+ -
49
+ - @description
50
+ - Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't
51
+ - work right: The browser will fetch from the URL with the literal
52
+ - text `{{hash}}` until AngularJS replaces the expression inside
53
+ - `{{hash}}`. The `ngSrc` directive solves this problem.
54
+ -
55
+ - The buggy way to write it:
56
+ - ```html
57
+
58
+ ```
59
+
60
+ - <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
61
+ - ```
62
+
63
+ ```
64
+
65
+ -
66
+ - The correct way to write it:
67
+ - ```html
68
+
69
+ ```
70
+
71
+ - <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
72
+ - ```
73
+
74
+ ```
75
+
76
+ -
77
+ - @element IMG
78
+ - @param {template} ngSrc any string which can contain `{{}}` markup.
79
+ \*/
80
+
81
+ /\*\*
82
+
83
+ - @ngdoc directive
84
+ - @name ngSrcset
85
+ - @restrict A
86
+ - @priority 99
87
+ -
88
+ - @description
89
+ - Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't
90
+ - work right: The browser will fetch from the URL with the literal
91
+ - text `{{hash}}` until AngularJS replaces the expression inside
92
+ - `{{hash}}`. The `ngSrcset` directive solves this problem.
93
+ -
94
+ - The buggy way to write it:
95
+ - ```html
96
+
97
+ ```
98
+
99
+ - <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
100
+ - ```
101
+
102
+ ```
103
+
104
+ -
105
+ - The correct way to write it:
106
+ - ```html
107
+
108
+ ```
109
+
110
+ - <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
111
+ - ```
112
+
113
+ ```
114
+
115
+ -
116
+ - @element IMG
117
+ - @param {template} ngSrcset any string which can contain `{{}}` markup.
118
+ \*/
119
+
120
+ /\*\*
121
+
122
+ - @ngdoc directive
123
+ - @name ngDisabled
124
+ - @restrict A
125
+ - @priority 100
126
+ -
127
+ - @description
128
+ -
129
+ - This directive sets the `disabled` attribute on the element (typically a form control,
130
+ - e.g. `input`, `button`, `select` etc.) if the
131
+ - {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
132
+ -
133
+ - A special directive is necessary because we cannot use interpolation inside the `disabled`
134
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
135
+ -
136
+ - @param {string} ngDisabled If the {@link guide/expression expression} is truthy,
137
+ - then the `disabled` attribute will be set on the element
138
+ \*/
139
+
140
+ /\*\*
141
+
142
+ - @ngdoc directive
143
+ - @name ngChecked
144
+ - @restrict A
145
+ - @priority 100
146
+ -
147
+ - @description
148
+ - Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
149
+ -
150
+ - Note that this directive should not be used together with {@link ngModel `ngModel`},
151
+ - as this can lead to unexpected behavior.
152
+ -
153
+ - A special directive is necessary because we cannot use interpolation inside the `checked`
154
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
155
+ -
156
+ - @element INPUT
157
+ - @param {string} ngChecked If the {@link guide/expression expression} is truthy,
158
+ - then the `checked` attribute will be set on the element
159
+ \*/
160
+
161
+ /\*\*
162
+
163
+ -
164
+ - @description
165
+ -
166
+ - Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
167
+ - Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
168
+ - MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
169
+ -
170
+ - A special directive is necessary because we cannot use interpolation inside the `readonly`
171
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
172
+ - @element INPUT
173
+ - @param {string} ngReadonly If the {@link guide/expression expression} is truthy,
174
+ - then special attribute "readonly" will be set on the element
175
+ \*/
176
+
177
+ /\*\*
178
+
179
+ - @ngdoc directive
180
+ - @name ngSelected
181
+ - @restrict A
182
+ - @priority 100
183
+ -
184
+ - @description
185
+ -
186
+ - Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
187
+ -
188
+ - A special directive is necessary because we cannot use interpolation inside the `selected`
189
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
190
+ -
191
+ - <div class="alert alert-warning">
192
+ - **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
193
+ - sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
194
+ - should not use `ngSelected` on the options, as `ngModel` will set the select value and
195
+ - selected options.
196
+ - </div>
197
+ - @element OPTION
198
+ - @param {string} ngSelected If the {@link guide/expression expression} is truthy,
199
+ - then special attribute "selected" will be set on the element
200
+ \*/
201
+
202
+ /\*\*
203
+
204
+ - @ngdoc directive
205
+ - @name ngOpen
206
+ - @restrict A
207
+ - @priority 100
208
+ -
209
+ - @description
210
+ -
211
+ - Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
212
+ -
213
+ - A special directive is necessary because we cannot use interpolation inside the `open`
214
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
215
+ -
216
+ - ## A note about browser compatibility
217
+ -
218
+ - Internet Explorer and Edge do not support the `details` element, it is
219
+ - recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
220
+ -
221
+ - @element DETAILS
222
+ - @param {string} ngOpen If the {@link guide/expression expression} is truthy,
223
+ - then special attribute "open" will be set on the element
224
+ \*/