@angular-wave/angular.ts 0.0.45 → 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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/angular.spec.js +5 -5
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-queue.js +3 -3
- package/src/core/compile/compile.js +6 -5
- package/src/core/compile/compile.spec.js +27 -27
- package/src/core/filter/filter.js +2 -2
- package/src/core/location/location.js +1 -1
- package/src/core/parser/parse.js +1 -1
- package/src/directive/attrs/attrs.js +4 -185
- package/src/directive/attrs/attrs.md +224 -0
- package/src/directive/ref/ref.js +2 -2
- package/src/router/state/state-service.js +0 -41
- package/src/router/state/state.spec.js +0 -6
- package/src/services/anchor-scroll.js +2 -2
- package/src/shared/jqlite/jqlite.js +354 -254
- package/src/shared/jqlite/jqlite.spec.js +0 -1
- package/src/shared/utils.js +13 -2
- package/types/directive/attrs/attrs.d.ts +0 -174
- package/types/shared/jqlite/jqlite.d.ts +60 -6
- package/types/shared/utils.d.ts +9 -1
|
@@ -757,7 +757,6 @@ describe("jqLite", () => {
|
|
|
757
757
|
expect(selector.attr("prop", "value")).toEqual(selector);
|
|
758
758
|
expect(JQLite(a).attr("prop")).toEqual("value");
|
|
759
759
|
expect(JQLite(b).attr("prop")).toEqual("value");
|
|
760
|
-
|
|
761
760
|
expect(selector.attr({ prop: "new value" })).toEqual(selector);
|
|
762
761
|
expect(JQLite(a).attr("prop")).toEqual("new value");
|
|
763
762
|
expect(JQLite(b).attr("prop")).toEqual("new value");
|
package/src/shared/utils.js
CHANGED
|
@@ -594,8 +594,19 @@ export function isElement(node) {
|
|
|
594
594
|
); // We have an on and find method part of jQuery API.
|
|
595
595
|
}
|
|
596
596
|
|
|
597
|
-
|
|
598
|
-
|
|
597
|
+
/**
|
|
598
|
+
* Returns a string appropriate for the type of node.
|
|
599
|
+
*
|
|
600
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
|
|
601
|
+
*
|
|
602
|
+
* @param {JQLite|Element} element
|
|
603
|
+
* @returns
|
|
604
|
+
*/
|
|
605
|
+
export function getNodeName(element) {
|
|
606
|
+
return lowercase(
|
|
607
|
+
/** @type {Element} */ (element).nodeName ||
|
|
608
|
+
(element[0] && element[0].nodeName),
|
|
609
|
+
);
|
|
599
610
|
}
|
|
600
611
|
|
|
601
612
|
export function includes(array, obj) {
|
|
@@ -1,176 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ngdoc directive
|
|
3
|
-
* @name ngHref
|
|
4
|
-
* @restrict A
|
|
5
|
-
* @priority 99
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* Using AngularJS markup like `{{hash}}` in an href attribute will
|
|
9
|
-
* make the link go to the wrong URL if the user clicks it before
|
|
10
|
-
* AngularJS has a chance to replace the `{{hash}}` markup with its
|
|
11
|
-
* value. Until AngularJS replaces the markup the link will be broken
|
|
12
|
-
* and will most likely return a 404 error. The `ngHref` directive
|
|
13
|
-
* solves this problem.
|
|
14
|
-
*
|
|
15
|
-
* The wrong way to write it:
|
|
16
|
-
* ```html
|
|
17
|
-
* <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* The correct way to write it:
|
|
21
|
-
* ```html
|
|
22
|
-
* <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @element A
|
|
26
|
-
* @param {template} ngHref any string which can contain `{{}}` markup.
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
1
|
export const REGEX_STRING_REGEXP: RegExp;
|
|
30
|
-
/**
|
|
31
|
-
* @ngdoc directive
|
|
32
|
-
* @name ngSrc
|
|
33
|
-
* @restrict A
|
|
34
|
-
* @priority 99
|
|
35
|
-
*
|
|
36
|
-
* @description
|
|
37
|
-
* Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't
|
|
38
|
-
* work right: The browser will fetch from the URL with the literal
|
|
39
|
-
* text `{{hash}}` until AngularJS replaces the expression inside
|
|
40
|
-
* `{{hash}}`. The `ngSrc` directive solves this problem.
|
|
41
|
-
*
|
|
42
|
-
* The buggy way to write it:
|
|
43
|
-
* ```html
|
|
44
|
-
* <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* The correct way to write it:
|
|
48
|
-
* ```html
|
|
49
|
-
* <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @element IMG
|
|
53
|
-
* @param {template} ngSrc any string which can contain `{{}}` markup.
|
|
54
|
-
*/
|
|
55
|
-
/**
|
|
56
|
-
* @ngdoc directive
|
|
57
|
-
* @name ngSrcset
|
|
58
|
-
* @restrict A
|
|
59
|
-
* @priority 99
|
|
60
|
-
*
|
|
61
|
-
* @description
|
|
62
|
-
* Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't
|
|
63
|
-
* work right: The browser will fetch from the URL with the literal
|
|
64
|
-
* text `{{hash}}` until AngularJS replaces the expression inside
|
|
65
|
-
* `{{hash}}`. The `ngSrcset` directive solves this problem.
|
|
66
|
-
*
|
|
67
|
-
* The buggy way to write it:
|
|
68
|
-
* ```html
|
|
69
|
-
* <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* The correct way to write it:
|
|
73
|
-
* ```html
|
|
74
|
-
* <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
|
|
75
|
-
* ```
|
|
76
|
-
*
|
|
77
|
-
* @element IMG
|
|
78
|
-
* @param {template} ngSrcset any string which can contain `{{}}` markup.
|
|
79
|
-
*/
|
|
80
|
-
/**
|
|
81
|
-
* @ngdoc directive
|
|
82
|
-
* @name ngDisabled
|
|
83
|
-
* @restrict A
|
|
84
|
-
* @priority 100
|
|
85
|
-
*
|
|
86
|
-
* @description
|
|
87
|
-
*
|
|
88
|
-
* This directive sets the `disabled` attribute on the element (typically a form control,
|
|
89
|
-
* e.g. `input`, `button`, `select` etc.) if the
|
|
90
|
-
* {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
|
|
91
|
-
*
|
|
92
|
-
* A special directive is necessary because we cannot use interpolation inside the `disabled`
|
|
93
|
-
* attribute. See the {@link guide/interpolation interpolation guide} for more info.
|
|
94
|
-
*
|
|
95
|
-
* @param {string} ngDisabled If the {@link guide/expression expression} is truthy,
|
|
96
|
-
* then the `disabled` attribute will be set on the element
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* @ngdoc directive
|
|
100
|
-
* @name ngChecked
|
|
101
|
-
* @restrict A
|
|
102
|
-
* @priority 100
|
|
103
|
-
*
|
|
104
|
-
* @description
|
|
105
|
-
* Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
|
|
106
|
-
*
|
|
107
|
-
* Note that this directive should not be used together with {@link ngModel `ngModel`},
|
|
108
|
-
* as this can lead to unexpected behavior.
|
|
109
|
-
*
|
|
110
|
-
* A special directive is necessary because we cannot use interpolation inside the `checked`
|
|
111
|
-
* attribute. See the {@link guide/interpolation interpolation guide} for more info.
|
|
112
|
-
*
|
|
113
|
-
* @element INPUT
|
|
114
|
-
* @param {string} ngChecked If the {@link guide/expression expression} is truthy,
|
|
115
|
-
* then the `checked` attribute will be set on the element
|
|
116
|
-
*/
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
* @description
|
|
120
|
-
*
|
|
121
|
-
* Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
|
|
122
|
-
* Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
|
|
123
|
-
* MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
|
|
124
|
-
*
|
|
125
|
-
* A special directive is necessary because we cannot use interpolation inside the `readonly`
|
|
126
|
-
* attribute. See the {@link guide/interpolation interpolation guide} for more info.
|
|
127
|
-
* @element INPUT
|
|
128
|
-
* @param {string} ngReadonly If the {@link guide/expression expression} is truthy,
|
|
129
|
-
* then special attribute "readonly" will be set on the element
|
|
130
|
-
*/
|
|
131
|
-
/**
|
|
132
|
-
* @ngdoc directive
|
|
133
|
-
* @name ngSelected
|
|
134
|
-
* @restrict A
|
|
135
|
-
* @priority 100
|
|
136
|
-
*
|
|
137
|
-
* @description
|
|
138
|
-
*
|
|
139
|
-
* Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
|
|
140
|
-
*
|
|
141
|
-
* A special directive is necessary because we cannot use interpolation inside the `selected`
|
|
142
|
-
* attribute. See the {@link guide/interpolation interpolation guide} for more info.
|
|
143
|
-
*
|
|
144
|
-
* <div class="alert alert-warning">
|
|
145
|
-
* **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
|
|
146
|
-
* sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
|
|
147
|
-
* should not use `ngSelected` on the options, as `ngModel` will set the select value and
|
|
148
|
-
* selected options.
|
|
149
|
-
* </div>
|
|
150
|
-
* @element OPTION
|
|
151
|
-
* @param {string} ngSelected If the {@link guide/expression expression} is truthy,
|
|
152
|
-
* then special attribute "selected" will be set on the element
|
|
153
|
-
*/
|
|
154
|
-
/**
|
|
155
|
-
* @ngdoc directive
|
|
156
|
-
* @name ngOpen
|
|
157
|
-
* @restrict A
|
|
158
|
-
* @priority 100
|
|
159
|
-
*
|
|
160
|
-
* @description
|
|
161
|
-
*
|
|
162
|
-
* Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
|
|
163
|
-
*
|
|
164
|
-
* A special directive is necessary because we cannot use interpolation inside the `open`
|
|
165
|
-
* attribute. See the {@link guide/interpolation interpolation guide} for more info.
|
|
166
|
-
*
|
|
167
|
-
* ## A note about browser compatibility
|
|
168
|
-
*
|
|
169
|
-
* Internet Explorer and Edge do not support the `details` element, it is
|
|
170
|
-
* recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
|
|
171
|
-
*
|
|
172
|
-
* @element DETAILS
|
|
173
|
-
* @param {string} ngOpen If the {@link guide/expression expression} is truthy,
|
|
174
|
-
* then special attribute "open" will be set on the element
|
|
175
|
-
*/
|
|
176
2
|
export const ngAttributeAliasDirectives: {};
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
|
|
3
3
|
* and execution of chain functions.
|
|
4
4
|
*
|
|
5
|
-
* @param {string|Element|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
|
|
5
|
+
* @param {string|Element|Comment|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
|
|
6
6
|
* @returns {JQLite}
|
|
7
7
|
*/
|
|
8
|
-
export function JQLite(element: string | Element | Document | Window | JQLite | ArrayLike<Element> | (() => void)): JQLite;
|
|
8
|
+
export function JQLite(element: string | Element | Comment | Document | Window | JQLite | ArrayLike<Element> | (() => void)): JQLite;
|
|
9
9
|
export class JQLite {
|
|
10
10
|
/**
|
|
11
11
|
* JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
|
|
12
12
|
* and execution of chain functions.
|
|
13
13
|
*
|
|
14
|
-
* @param {string|Element|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
|
|
14
|
+
* @param {string|Element|Comment|Document|Window|JQLite|ArrayLike<Element>|(() => void)} element
|
|
15
15
|
* @returns {JQLite}
|
|
16
16
|
*/
|
|
17
|
-
constructor(element: string | Element | Document | Window | JQLite | ArrayLike<Element> | (() => void));
|
|
17
|
+
constructor(element: string | Element | Comment | Document | Window | JQLite | ArrayLike<Element> | (() => void));
|
|
18
18
|
/**
|
|
19
19
|
* Remove all child nodes of the set of matched elements from the DOM and clears CACHE data, associated with the node.
|
|
20
20
|
* @returns {JQLite} The current instance of JQLite.
|
|
@@ -76,6 +76,60 @@ export class JQLite {
|
|
|
76
76
|
* @returns {JQLite|any|undefined}
|
|
77
77
|
*/
|
|
78
78
|
html(value: string): JQLite | any | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get the combined text contents of each element in the JQLite collection
|
|
81
|
+
* or set the text contents of all elements.
|
|
82
|
+
* @param {string} [value]
|
|
83
|
+
* @returns {JQLite|string}
|
|
84
|
+
*/
|
|
85
|
+
text(value?: string): JQLite | string;
|
|
86
|
+
/**
|
|
87
|
+
* Gets or sets the values of form elements such as input, select and textarea in a JQLite collection.
|
|
88
|
+
* @param {any} value
|
|
89
|
+
* @returns {JQLite|any}
|
|
90
|
+
*/
|
|
91
|
+
val(value: any): JQLite | any;
|
|
92
|
+
/**
|
|
93
|
+
* @param {string|Object} name
|
|
94
|
+
* @param {any} value
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
attr(name: string | any, value: any): any;
|
|
98
|
+
/**
|
|
99
|
+
* @param {string|any} key - The key (as a string) to get/set or an object for mass-setting.
|
|
100
|
+
* @param {any} [value] - The value to set. If not provided, the function acts as a getter.
|
|
101
|
+
* @returns {JQLite|any} - The retrieved data if acting as a getter. Otherwise, returns undefined.
|
|
102
|
+
*/
|
|
103
|
+
data(key: string | any, value?: any): JQLite | any;
|
|
104
|
+
replaceWith(arg1: any): void | JQLite;
|
|
105
|
+
children(): JQLite;
|
|
106
|
+
/**
|
|
107
|
+
* @param {string} node
|
|
108
|
+
* @returns {JQLite}
|
|
109
|
+
*/
|
|
110
|
+
append(node: string): JQLite;
|
|
111
|
+
/**
|
|
112
|
+
* @param {string} node
|
|
113
|
+
* @returns {JQLite}
|
|
114
|
+
*/
|
|
115
|
+
prepend(node: string): JQLite;
|
|
116
|
+
/**
|
|
117
|
+
* @param {string} newElement
|
|
118
|
+
* @returns {JQLite}
|
|
119
|
+
*/
|
|
120
|
+
after(newElement: string): JQLite;
|
|
121
|
+
/**
|
|
122
|
+
* @param {boolean} [keepData]
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
remove(keepData?: boolean): this;
|
|
126
|
+
detach(): this;
|
|
127
|
+
parent(): any;
|
|
128
|
+
find(selector: any): any;
|
|
129
|
+
/**
|
|
130
|
+
* TODO: REMOVE! This function being used ONLY in tests!
|
|
131
|
+
*/
|
|
132
|
+
triggerHandler(event: any, extraParameters: any): void | JQLite;
|
|
79
133
|
toString(): string;
|
|
80
134
|
eq(index: any): JQLite;
|
|
81
135
|
length: number;
|
|
@@ -147,7 +201,7 @@ export function getBooleanAttrName(element: any, name: any): any;
|
|
|
147
201
|
/**
|
|
148
202
|
* Takes an array of elements, calls any `$destroy` event handlers, removes any data in cache, and finally removes any
|
|
149
203
|
* listeners.
|
|
150
|
-
* @param {NodeListOf<Element
|
|
204
|
+
* @param {NodeListOf<Element>|Element[]} nodes
|
|
151
205
|
*/
|
|
152
|
-
export function cleanElementData(nodes: NodeListOf<Element>): void;
|
|
206
|
+
export function cleanElementData(nodes: NodeListOf<Element> | Element[]): void;
|
|
153
207
|
export const BOOLEAN_ATTR: {};
|
package/types/shared/utils.d.ts
CHANGED
|
@@ -344,7 +344,15 @@ export function hasCustomToString(obj: any): boolean;
|
|
|
344
344
|
* @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
|
|
345
345
|
*/
|
|
346
346
|
export function isElement(node: any): boolean;
|
|
347
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Returns a string appropriate for the type of node.
|
|
349
|
+
*
|
|
350
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
|
|
351
|
+
*
|
|
352
|
+
* @param {JQLite|Element} element
|
|
353
|
+
* @returns
|
|
354
|
+
*/
|
|
355
|
+
export function getNodeName(element: JQLite | Element): string;
|
|
348
356
|
export function includes(array: any, obj: any): boolean;
|
|
349
357
|
/**
|
|
350
358
|
* Removes the first occurrence of a specified value from an array.
|