@angular-wave/angular.ts 0.0.40 → 0.0.41
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/README.md +1 -0
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-queue.js +7 -4
- package/src/core/compile/compile.js +4 -2
- package/src/core/compile/compile.spec.js +2 -43
- package/src/directive/include/include.js +5 -7
- package/src/directive/options/options.js +3 -3
- package/src/services/http/http.js +11 -7
- package/src/shared/jqlite/jqlite.js +336 -315
- package/src/shared/jqlite/jqlite.spec.js +74 -82
- package/src/types.js +13 -0
- package/types/animations/shared.d.ts +6 -1
- package/types/core/compile/compile.d.ts +2 -1
- package/types/directive/include/include.d.ts +2 -2
- package/types/services/document.d.ts +2 -1
- package/types/shared/jqlite/jqlite.d.ts +83 -21
- package/types/types.d.ts +34 -0
- package/types-back/index.d.ts +0 -56
- package/types-back/jqlite.d.ts +1 -40
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JQLite } from "../shared/jqlite/jqlite";
|
|
1
|
+
import { getOrSetCacheData, JQLite } from "../shared/jqlite/jqlite";
|
|
2
2
|
import {
|
|
3
3
|
isUndefined,
|
|
4
4
|
forEach,
|
|
@@ -757,7 +757,7 @@ export const $$AnimateQueueProvider = [
|
|
|
757
757
|
let elementDisabled = disabledElementsLookup.get(node);
|
|
758
758
|
let animateChildren;
|
|
759
759
|
|
|
760
|
-
let parentHost =
|
|
760
|
+
let parentHost = getOrSetCacheData(node, NG_ANIMATE_PIN_DATA);
|
|
761
761
|
if (parentHost) {
|
|
762
762
|
parentNode = getDomNode(parentHost);
|
|
763
763
|
}
|
|
@@ -794,7 +794,10 @@ export const $$AnimateQueueProvider = [
|
|
|
794
794
|
}
|
|
795
795
|
|
|
796
796
|
if (isUndefined(animateChildren) || animateChildren === true) {
|
|
797
|
-
const value =
|
|
797
|
+
const value = getOrSetCacheData(
|
|
798
|
+
parentNode,
|
|
799
|
+
NG_ANIMATE_CHILDREN_DATA,
|
|
800
|
+
);
|
|
798
801
|
if (isDefined(value)) {
|
|
799
802
|
animateChildren = value;
|
|
800
803
|
}
|
|
@@ -817,7 +820,7 @@ export const $$AnimateQueueProvider = [
|
|
|
817
820
|
|
|
818
821
|
if (!rootNodeDetected) {
|
|
819
822
|
// If `rootNode` is not detected, check if `parentNode` is pinned to another element
|
|
820
|
-
parentHost =
|
|
823
|
+
parentHost = getOrSetCacheData(parentNode, NG_ANIMATE_PIN_DATA);
|
|
821
824
|
if (parentHost) {
|
|
822
825
|
// The pin target element becomes the next parent element
|
|
823
826
|
parentNode = getDomNode(parentHost);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JQLite,
|
|
3
|
+
cleanElementData,
|
|
3
4
|
getBooleanAttrName,
|
|
5
|
+
getOrSetCacheData,
|
|
4
6
|
isTextNode,
|
|
5
7
|
startingTag,
|
|
6
8
|
} from "../../shared/jqlite/jqlite";
|
|
@@ -3111,7 +3113,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
3111
3113
|
// Copy over user data (that includes AngularJS's $scope etc.). Don't copy private
|
|
3112
3114
|
// data here because there's no public interface in jQuery to do that and copying over
|
|
3113
3115
|
// event listeners (which is the main use of private data) wouldn't work anyway.
|
|
3114
|
-
|
|
3116
|
+
getOrSetCacheData(newNode, getOrSetCacheData(firstElementToRemove));
|
|
3115
3117
|
|
|
3116
3118
|
// Remove $destroy event listeners from `firstElementToRemove`
|
|
3117
3119
|
JQLite(firstElementToRemove).off("$destroy");
|
|
@@ -3119,7 +3121,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
3119
3121
|
|
|
3120
3122
|
// Cleanup any data/listeners on the elements and children.
|
|
3121
3123
|
// This includes invoking the $destroy event on any elements with listeners.
|
|
3122
|
-
|
|
3124
|
+
cleanElementData(fragment.querySelectorAll("*"));
|
|
3123
3125
|
|
|
3124
3126
|
// Update the JQLite collection to only contain the `newNode`
|
|
3125
3127
|
for (i = 1; i < removeCount; i++) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { publishExternalAPI } from "../../public";
|
|
2
2
|
import { createInjector } from "../../injector";
|
|
3
|
-
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
3
|
+
import { dealoc, JQLite, getOrSetCacheData } from "../../shared/jqlite/jqlite";
|
|
4
4
|
import {
|
|
5
5
|
forEach,
|
|
6
6
|
isFunction,
|
|
@@ -6416,47 +6416,6 @@ describe("$compile", () => {
|
|
|
6416
6416
|
expect(element.text()).toEqual("3==3");
|
|
6417
6417
|
});
|
|
6418
6418
|
|
|
6419
|
-
describe("when directive is in a repeater", () => {
|
|
6420
|
-
let is;
|
|
6421
|
-
beforeEach(() => {
|
|
6422
|
-
is = [1, 2];
|
|
6423
|
-
});
|
|
6424
|
-
|
|
6425
|
-
function runTest() {
|
|
6426
|
-
$templateCache.put(
|
|
6427
|
-
"/mock/hello",
|
|
6428
|
-
"<span>i=<span ng-transclude></span>;</span>",
|
|
6429
|
-
);
|
|
6430
|
-
element = JQLite(
|
|
6431
|
-
`<div><b hello ng-repeat="i in [${is}]">{{i}}</b></div>`,
|
|
6432
|
-
);
|
|
6433
|
-
$compile(element)($rootScope);
|
|
6434
|
-
$rootScope.$digest();
|
|
6435
|
-
expect(element.text()).toEqual(`i=${is.join(";i=")};`);
|
|
6436
|
-
}
|
|
6437
|
-
|
|
6438
|
-
it("should work with another library patching JQLite/jQuery.cleanData after Angular", () => {
|
|
6439
|
-
let cleanedCount = 0;
|
|
6440
|
-
const currentCleanData = JQLite.cleanData;
|
|
6441
|
-
JQLite.cleanData = function (elems) {
|
|
6442
|
-
cleanedCount += elems.length;
|
|
6443
|
-
// Don't return the output and explicitly pass only the first parameter
|
|
6444
|
-
// so that we're sure we're not relying on either of them. jQuery UI patch
|
|
6445
|
-
// behaves in this way.
|
|
6446
|
-
currentCleanData(elems);
|
|
6447
|
-
};
|
|
6448
|
-
|
|
6449
|
-
runTest();
|
|
6450
|
-
|
|
6451
|
-
// The initial ng-repeat div is dumped after parsing hence we expect cleanData
|
|
6452
|
-
// count to be one larger than size of the iterated array.
|
|
6453
|
-
expect(cleanedCount).toBe(is.length + 1);
|
|
6454
|
-
|
|
6455
|
-
// Restore the previous cleanData.
|
|
6456
|
-
JQLite.cleanData = currentCleanData;
|
|
6457
|
-
});
|
|
6458
|
-
});
|
|
6459
|
-
|
|
6460
6419
|
describe("replace and not exactly one root element", () => {
|
|
6461
6420
|
beforeEach(() => {
|
|
6462
6421
|
publishExternalAPI().decorator("$exceptionHandler", () => {
|
|
@@ -17331,7 +17290,7 @@ describe("$compile", () => {
|
|
|
17331
17290
|
|
|
17332
17291
|
const preCompiledChildren = getAll(toCompile);
|
|
17333
17292
|
forEach(preCompiledChildren, (element, i) => {
|
|
17334
|
-
|
|
17293
|
+
getOrSetCacheData(element, "foo", `template#${i}`);
|
|
17335
17294
|
});
|
|
17336
17295
|
|
|
17337
17296
|
const linkedElements = $compile(toCompile)($rootScope);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isDefined } from "../../shared/utils";
|
|
2
|
-
import {
|
|
2
|
+
import { buildFragment } from "../../shared/jqlite/jqlite";
|
|
3
3
|
|
|
4
4
|
export const ngIncludeDirective = [
|
|
5
5
|
"$templateRequest",
|
|
@@ -11,12 +11,12 @@ export const ngIncludeDirective = [
|
|
|
11
11
|
terminal: true,
|
|
12
12
|
transclude: "element",
|
|
13
13
|
controller: () => {},
|
|
14
|
-
compile(
|
|
14
|
+
compile(_element, attr) {
|
|
15
15
|
const srcExp = attr.ngInclude || attr.src;
|
|
16
16
|
const onloadExp = attr.onload || "";
|
|
17
17
|
const autoScrollExp = attr.autoscroll;
|
|
18
18
|
|
|
19
|
-
return (scope, $element, $attr, ctrl, $transclude) => {
|
|
19
|
+
return (scope, $element, _$attr, ctrl, $transclude) => {
|
|
20
20
|
let changeCounter = 0;
|
|
21
21
|
let currentScope;
|
|
22
22
|
let previousElement;
|
|
@@ -110,15 +110,13 @@ export const ngIncludeFillContentDirective = [
|
|
|
110
110
|
restrict: "ECA",
|
|
111
111
|
priority: -400,
|
|
112
112
|
require: "ngInclude",
|
|
113
|
-
link(scope, $element, $attr, ctrl) {
|
|
113
|
+
link(scope, $element, _$attr, ctrl) {
|
|
114
114
|
if (toString.call($element[0]).match(/SVG/)) {
|
|
115
115
|
// WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not
|
|
116
116
|
// support innerHTML, so detect this here and try to generate the contents
|
|
117
117
|
// specially.
|
|
118
118
|
$element.empty();
|
|
119
|
-
$compile(
|
|
120
|
-
JQLiteBuildFragment(ctrl.template, window.document).childNodes,
|
|
121
|
-
)(
|
|
119
|
+
$compile(buildFragment(ctrl.template).childNodes)(
|
|
122
120
|
scope,
|
|
123
121
|
(clone) => {
|
|
124
122
|
$element.append(clone);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JQLite,
|
|
1
|
+
import { JQLite, removeElement, startingTag } from "../../shared/jqlite/jqlite";
|
|
2
2
|
import {
|
|
3
3
|
equals,
|
|
4
4
|
forEach,
|
|
@@ -594,9 +594,9 @@ export const ngOptionsDirective = [
|
|
|
594
594
|
for (let i = options.items.length - 1; i >= 0; i--) {
|
|
595
595
|
const option = options.items[i];
|
|
596
596
|
if (isDefined(option.group)) {
|
|
597
|
-
|
|
597
|
+
removeElement(option.element.parentNode);
|
|
598
598
|
} else {
|
|
599
|
-
|
|
599
|
+
removeElement(option.element);
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
}
|
|
@@ -219,13 +219,17 @@ function parseHeaders(headers) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
if (isString(headers)) {
|
|
222
|
-
forEach(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
222
|
+
forEach(
|
|
223
|
+
headers.split("\n"),
|
|
224
|
+
/** @param {string} line */
|
|
225
|
+
(line) => {
|
|
226
|
+
i = line.indexOf(":");
|
|
227
|
+
fillInParsed(
|
|
228
|
+
line.substring(0, i).trim().toLowerCase(),
|
|
229
|
+
trim(line.substring(i + 1)),
|
|
230
|
+
);
|
|
231
|
+
},
|
|
232
|
+
);
|
|
229
233
|
} else if (isObject(headers)) {
|
|
230
234
|
forEach(headers, (headerVal, headerKey) => {
|
|
231
235
|
fillInParsed(lowercase(headerKey), trim(headerVal));
|