@angular-wave/angular.ts 0.0.45 → 0.0.46

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.45",
4
+ "version": "0.0.46",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
@@ -21,7 +21,7 @@ import {
21
21
  toJson,
22
22
  fromJson,
23
23
  nextUid,
24
- nodeName_,
24
+ getNodeName,
25
25
  snakeCase,
26
26
  } from "./shared/utils";
27
27
  import { dealoc, JQLite, startingTag } from "./shared/jqlite/jqlite";
@@ -1827,14 +1827,14 @@ describe("angular", () => {
1827
1827
  });
1828
1828
  });
1829
1829
 
1830
- describe("nodeName_", () => {
1830
+ describe("getNodeName", () => {
1831
1831
  it('should correctly detect node name with "namespace" when xmlns is defined', () => {
1832
1832
  const div = JQLite(
1833
1833
  '<div xmlns:ngtest="http://angularjs.org/">' +
1834
1834
  '<ngtest:foo ngtest:attr="bar"></ngtest:foo>' +
1835
1835
  "</div>",
1836
1836
  )[0];
1837
- expect(nodeName_(div.childNodes[0])).toBe("ngtest:foo");
1837
+ expect(getNodeName(div.childNodes[0])).toBe("ngtest:foo");
1838
1838
  expect(div.childNodes[0].getAttribute("ngtest:attr")).toBe("bar");
1839
1839
  });
1840
1840
 
@@ -1844,13 +1844,13 @@ describe("angular", () => {
1844
1844
  '<ngtest:foo ngtest:attr="bar"></ng-test>' +
1845
1845
  "</div>",
1846
1846
  )[0];
1847
- expect(nodeName_(div.childNodes[0])).toBe("ngtest:foo");
1847
+ expect(getNodeName(div.childNodes[0])).toBe("ngtest:foo");
1848
1848
  expect(div.childNodes[0].getAttribute("ngtest:attr")).toBe("bar");
1849
1849
  });
1850
1850
 
1851
1851
  it("should return undefined for elements without the .nodeName property", () => {
1852
1852
  // some elements, like SVGElementInstance don't have .nodeName property
1853
- expect(nodeName_({})).toBeUndefined();
1853
+ expect(getNodeName({})).toBeUndefined();
1854
1854
  });
1855
1855
  });
1856
1856
 
@@ -26,7 +26,7 @@ import {
26
26
  inherit,
27
27
  isUndefined,
28
28
  arrayRemove,
29
- nodeName_,
29
+ getNodeName,
30
30
  bind,
31
31
  trim,
32
32
  isBoolean,
@@ -1120,7 +1120,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1120
1120
  if (!node) {
1121
1121
  return "html";
1122
1122
  }
1123
- return nodeName_(node) !== "foreignobject" &&
1123
+ return getNodeName(node) !== "foreignobject" &&
1124
1124
  toString.call(node).match(/SVG/)
1125
1125
  ? "svg"
1126
1126
  : "html";
@@ -1822,7 +1822,8 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1822
1822
  // Add the matching elements into their slot
1823
1823
 
1824
1824
  forEach(JQLite($compileNode[0].childNodes), (node) => {
1825
- const slotName = slotMap[directiveNormalize(nodeName_(node))];
1825
+ const slotName =
1826
+ slotMap[directiveNormalize(getNodeName(node))];
1826
1827
  if (slotName) {
1827
1828
  filledSlots[slotName] = true;
1828
1829
  slots[slotName] =
@@ -2911,7 +2912,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
2911
2912
  );
2912
2913
  }
2913
2914
 
2914
- const nodeName = nodeName_(node);
2915
+ const nodeName = getNodeName(node);
2915
2916
  const trustedContext = getTrustedPropContext(nodeName, propName);
2916
2917
 
2917
2918
  let sanitizer = (x) => x;
@@ -2969,7 +2970,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
2969
2970
  name,
2970
2971
  isNgAttr,
2971
2972
  ) {
2972
- const nodeName = nodeName_(node);
2973
+ const nodeName = getNodeName(node);
2973
2974
  const trustedContext = getTrustedAttrContext(nodeName, name);
2974
2975
  const mustHaveExpression = !isNgAttr;
2975
2976
  const allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr;
@@ -6,7 +6,7 @@ import {
6
6
  isFunction,
7
7
  valueFn,
8
8
  isElement,
9
- nodeName_,
9
+ getNodeName,
10
10
  extend,
11
11
  } from "../../shared/utils";
12
12
  import { countChildScopes, countWatchers } from "../../core/scope/scope";
@@ -5603,7 +5603,7 @@ describe("$compile", () => {
5603
5603
  expect(() => {
5604
5604
  element = $compile("<div replace-with-tr></div>")($rootScope);
5605
5605
  }).not.toThrow();
5606
- expect(nodeName_(element)).toMatch(/tr/i);
5606
+ expect(getNodeName(element)).toMatch(/tr/i);
5607
5607
  });
5608
5608
 
5609
5609
  it("should support templates with root <td> tags", () => {
@@ -5611,7 +5611,7 @@ describe("$compile", () => {
5611
5611
  expect(() => {
5612
5612
  element = $compile("<div replace-with-td></div>")($rootScope);
5613
5613
  }).not.toThrow();
5614
- expect(nodeName_(element)).toMatch(/td/i);
5614
+ expect(getNodeName(element)).toMatch(/td/i);
5615
5615
  });
5616
5616
 
5617
5617
  it("should support templates with root <th> tags", () => {
@@ -5619,7 +5619,7 @@ describe("$compile", () => {
5619
5619
  expect(() => {
5620
5620
  element = $compile("<div replace-with-th></div>")($rootScope);
5621
5621
  }).not.toThrow();
5622
- expect(nodeName_(element)).toMatch(/th/i);
5622
+ expect(getNodeName(element)).toMatch(/th/i);
5623
5623
  });
5624
5624
 
5625
5625
  it("should support templates with root <thead> tags", () => {
@@ -5627,7 +5627,7 @@ describe("$compile", () => {
5627
5627
  expect(() => {
5628
5628
  element = $compile("<div replace-with-thead></div>")($rootScope);
5629
5629
  }).not.toThrow();
5630
- expect(nodeName_(element)).toMatch(/thead/i);
5630
+ expect(getNodeName(element)).toMatch(/thead/i);
5631
5631
  });
5632
5632
 
5633
5633
  it("should support templates with root <tbody> tags", () => {
@@ -5635,7 +5635,7 @@ describe("$compile", () => {
5635
5635
  expect(() => {
5636
5636
  element = $compile("<div replace-with-tbody></div>")($rootScope);
5637
5637
  }).not.toThrow();
5638
- expect(nodeName_(element)).toMatch(/tbody/i);
5638
+ expect(getNodeName(element)).toMatch(/tbody/i);
5639
5639
  });
5640
5640
 
5641
5641
  it("should support templates with root <tfoot> tags", () => {
@@ -5643,7 +5643,7 @@ describe("$compile", () => {
5643
5643
  expect(() => {
5644
5644
  element = $compile("<div replace-with-tfoot></div>")($rootScope);
5645
5645
  }).not.toThrow();
5646
- expect(nodeName_(element)).toMatch(/tfoot/i);
5646
+ expect(getNodeName(element)).toMatch(/tfoot/i);
5647
5647
  });
5648
5648
 
5649
5649
  it("should support templates with root <option> tags", () => {
@@ -5651,7 +5651,7 @@ describe("$compile", () => {
5651
5651
  expect(() => {
5652
5652
  element = $compile("<div replace-with-option></div>")($rootScope);
5653
5653
  }).not.toThrow();
5654
- expect(nodeName_(element)).toMatch(/option/i);
5654
+ expect(getNodeName(element)).toMatch(/option/i);
5655
5655
  });
5656
5656
 
5657
5657
  it("should support templates with root <optgroup> tags", () => {
@@ -5659,7 +5659,7 @@ describe("$compile", () => {
5659
5659
  expect(() => {
5660
5660
  element = $compile("<div replace-with-optgroup></div>")($rootScope);
5661
5661
  }).not.toThrow();
5662
- expect(nodeName_(element)).toMatch(/optgroup/i);
5662
+ expect(getNodeName(element)).toMatch(/optgroup/i);
5663
5663
  });
5664
5664
 
5665
5665
  it("should support SVG templates using directive.templateNamespace=svg", () => {
@@ -5681,7 +5681,7 @@ describe("$compile", () => {
5681
5681
  )($rootScope);
5682
5682
  const child = element.children().eq(0);
5683
5683
  $rootScope.$digest();
5684
- expect(nodeName_(child)).toMatch(/a/i);
5684
+ expect(getNodeName(child)).toMatch(/a/i);
5685
5685
  expect(isSVGElement(child[0])).toBe(true);
5686
5686
  expect(child[0].href.baseVal).toBe("/foo/bar");
5687
5687
  });
@@ -5710,7 +5710,7 @@ describe("$compile", () => {
5710
5710
  );
5711
5711
  $rootScope.$digest();
5712
5712
  const child = element.children().eq(0);
5713
- expect(nodeName_(child)).toMatch(/msup/i);
5713
+ expect(getNodeName(child)).toMatch(/msup/i);
5714
5714
  expect(isUnknownElement(child[0])).toBe(false);
5715
5715
  expect(isHTMLElement(child[0])).toBe(false);
5716
5716
  });
@@ -6566,7 +6566,7 @@ describe("$compile", () => {
6566
6566
  element = $compile("<div replace-with-tr></div>")($rootScope);
6567
6567
  }).not.toThrow();
6568
6568
  $rootScope.$digest();
6569
- expect(nodeName_(element)).toMatch(/tr/i);
6569
+ expect(getNodeName(element)).toMatch(/tr/i);
6570
6570
  });
6571
6571
 
6572
6572
  it("should support templates with root <td> tags", () => {
@@ -6575,7 +6575,7 @@ describe("$compile", () => {
6575
6575
  element = $compile("<div replace-with-td></div>")($rootScope);
6576
6576
  }).not.toThrow();
6577
6577
  $rootScope.$digest();
6578
- expect(nodeName_(element)).toMatch(/td/i);
6578
+ expect(getNodeName(element)).toMatch(/td/i);
6579
6579
  });
6580
6580
 
6581
6581
  it("should support templates with root <th> tags", () => {
@@ -6584,7 +6584,7 @@ describe("$compile", () => {
6584
6584
  element = $compile("<div replace-with-th></div>")($rootScope);
6585
6585
  }).not.toThrow();
6586
6586
  $rootScope.$digest();
6587
- expect(nodeName_(element)).toMatch(/th/i);
6587
+ expect(getNodeName(element)).toMatch(/th/i);
6588
6588
  });
6589
6589
 
6590
6590
  it("should support templates with root <thead> tags", () => {
@@ -6593,7 +6593,7 @@ describe("$compile", () => {
6593
6593
  element = $compile("<div replace-with-thead></div>")($rootScope);
6594
6594
  }).not.toThrow();
6595
6595
  $rootScope.$digest();
6596
- expect(nodeName_(element)).toMatch(/thead/i);
6596
+ expect(getNodeName(element)).toMatch(/thead/i);
6597
6597
  });
6598
6598
 
6599
6599
  it("should support templates with root <tbody> tags", () => {
@@ -6602,7 +6602,7 @@ describe("$compile", () => {
6602
6602
  element = $compile("<div replace-with-tbody></div>")($rootScope);
6603
6603
  }).not.toThrow();
6604
6604
  $rootScope.$digest();
6605
- expect(nodeName_(element)).toMatch(/tbody/i);
6605
+ expect(getNodeName(element)).toMatch(/tbody/i);
6606
6606
  });
6607
6607
 
6608
6608
  it("should support templates with root <tfoot> tags", () => {
@@ -6611,7 +6611,7 @@ describe("$compile", () => {
6611
6611
  element = $compile("<div replace-with-tfoot></div>")($rootScope);
6612
6612
  }).not.toThrow();
6613
6613
  $rootScope.$digest();
6614
- expect(nodeName_(element)).toMatch(/tfoot/i);
6614
+ expect(getNodeName(element)).toMatch(/tfoot/i);
6615
6615
  });
6616
6616
 
6617
6617
  it("should support templates with root <option> tags", () => {
@@ -6620,7 +6620,7 @@ describe("$compile", () => {
6620
6620
  element = $compile("<div replace-with-option></div>")($rootScope);
6621
6621
  }).not.toThrow();
6622
6622
  $rootScope.$digest();
6623
- expect(nodeName_(element)).toMatch(/option/i);
6623
+ expect(getNodeName(element)).toMatch(/option/i);
6624
6624
  });
6625
6625
 
6626
6626
  it("should support templates with root <optgroup> tags", () => {
@@ -6629,7 +6629,7 @@ describe("$compile", () => {
6629
6629
  element = $compile("<div replace-with-optgroup></div>")($rootScope);
6630
6630
  }).not.toThrow();
6631
6631
  $rootScope.$digest();
6632
- expect(nodeName_(element)).toMatch(/optgroup/i);
6632
+ expect(getNodeName(element)).toMatch(/optgroup/i);
6633
6633
  });
6634
6634
 
6635
6635
  it("should support SVG templates using directive.templateNamespace=svg", () => {
@@ -6656,7 +6656,7 @@ describe("$compile", () => {
6656
6656
  )($rootScope);
6657
6657
  $rootScope.$digest();
6658
6658
  const child = element.children().eq(0);
6659
- expect(nodeName_(child)).toMatch(/a/i);
6659
+ expect(getNodeName(child)).toMatch(/a/i);
6660
6660
  expect(isSVGElement(child[0])).toBe(true);
6661
6661
  expect(child[0].href.baseVal).toBe("/foo/bar");
6662
6662
  },
@@ -6692,7 +6692,7 @@ describe("$compile", () => {
6692
6692
  );
6693
6693
  $rootScope.$digest();
6694
6694
  const child = element.children().eq(0);
6695
- expect(nodeName_(child)).toMatch(/msup/i);
6695
+ expect(getNodeName(child)).toMatch(/msup/i);
6696
6696
  expect(isUnknownElement(child[0])).toBe(false);
6697
6697
  expect(isHTMLElement(child[0])).toBe(false);
6698
6698
  },
@@ -14789,10 +14789,10 @@ describe("$compile", () => {
14789
14789
  JQLite("<div>before<div transclude></div>after</div>")[0].childNodes,
14790
14790
  );
14791
14791
  expect(element.length).toEqual(3);
14792
- expect(nodeName_(element[1])).toBe("div");
14792
+ expect(getNodeName(element[1])).toBe("div");
14793
14793
  $compile(element)($rootScope);
14794
- expect(nodeName_(element[1])).toBe("#comment");
14795
- expect(nodeName_(comment)).toBe("#comment");
14794
+ expect(getNodeName(element[1])).toBe("#comment");
14795
+ expect(getNodeName(comment)).toBe("#comment");
14796
14796
  });
14797
14797
 
14798
14798
  it("should terminate compilation only for element transclusion", () => {
@@ -14973,7 +14973,7 @@ describe("$compile", () => {
14973
14973
  .directive("innerAgain", () => ({
14974
14974
  transclude: true,
14975
14975
  link(scope, element, attr, controllers, transclude) {
14976
- log.push(`innerAgain:${nodeName_(element)}`);
14976
+ log.push(`innerAgain:${getNodeName(element)}`);
14977
14977
  transclude(scope, (clone) => {
14978
14978
  element.parent().append(clone);
14979
14979
  });
@@ -14983,13 +14983,13 @@ describe("$compile", () => {
14983
14983
  replace: true,
14984
14984
  templateUrl: "inner.html",
14985
14985
  link(scope, element) {
14986
- log.push(`inner:${nodeName_(element)}`);
14986
+ log.push(`inner:${getNodeName(element)}`);
14987
14987
  },
14988
14988
  }))
14989
14989
  .directive("outer", () => ({
14990
14990
  transclude: true,
14991
14991
  link(scope, element, attrs, controllers, transclude) {
14992
- log.push(`outer:${nodeName_(element)}`);
14992
+ log.push(`outer:${getNodeName(element)}`);
14993
14993
  transclude(scope, (clone) => {
14994
14994
  element.parent().append(clone);
14995
14995
  });
@@ -1,4 +1,4 @@
1
- import { nodeName_, minErr, directiveNormalize } from "../../shared/utils";
1
+ import { getNodeName, minErr, directiveNormalize } from "../../shared/utils";
2
2
 
3
3
  /**
4
4
  * @ngdoc directive
@@ -36,7 +36,7 @@ export const ngRefDirective = [
36
36
  restrict: "A",
37
37
  compile(tElement, tAttrs) {
38
38
  // Get the expected controller name, converts <data-some-thing> into "someThing"
39
- const controllerName = directiveNormalize(nodeName_(tElement));
39
+ const controllerName = directiveNormalize(getNodeName(tElement));
40
40
 
41
41
  // Get the expression for value binding
42
42
  const getter = $parse(tAttrs.ngRef);
@@ -22,40 +22,6 @@ import { not, val } from "../../shared/hof";
22
22
  import { EventBus } from "../../core/pubsub/pubsub";
23
23
 
24
24
  const err = minErr("$stateProvider");
25
- // Right now this is a collection of all the properties we encounter in tests
26
- const validKeys = [
27
- "$$state",
28
- "__stateObjectCache",
29
- "abstract",
30
- "bindings",
31
- "controller",
32
- "controllerAs",
33
- "controllerProvider",
34
- "component",
35
- "componentProvider",
36
- "data",
37
- "includes",
38
- "lazyLoad",
39
- "name",
40
- "navigable",
41
- "onEnter",
42
- "onExit",
43
- "onRetain",
44
- "params",
45
- "parent",
46
- "path",
47
- "redirectTo",
48
- "reloadOnSearch",
49
- "resolve",
50
- "resolveAs",
51
- "resolvables",
52
- "self",
53
- "template",
54
- "templateProvider",
55
- "templateUrl",
56
- "url",
57
- "views",
58
- ];
59
25
 
60
26
  /**
61
27
  * Provides services related to ui-router states.
@@ -230,13 +196,6 @@ export class StateService {
230
196
  if (!definition.name) {
231
197
  throw err("stateinvalid", `'name' required`);
232
198
  }
233
-
234
- const hasInvalidKeys = Object.keys(definition).filter(
235
- (key) => !validKeys.includes(key),
236
- );
237
- if (hasInvalidKeys.length) {
238
- throw err("stateinvalid", `Invalid key(s): ${hasInvalidKeys.join(", ")}`);
239
- }
240
199
  try {
241
200
  this.stateRegistry.register(definition);
242
201
  } catch (e) {
@@ -128,12 +128,6 @@ describe("$state", () => {
128
128
  }).toThrowError(/stateinvalid/);
129
129
  });
130
130
 
131
- it("should should not allow states that have invalid keys", () => {
132
- expect(() => {
133
- $stateProvider.state({ name: "faulty", faulturl: "/to-string" });
134
- }).toThrowError(/stateinvalid/);
135
- });
136
-
137
131
  it("should requred `name` if state definition object is passed", () => {
138
132
  expect(() => {
139
133
  $stateProvider.state({ url: "/to-string" });
@@ -3,7 +3,7 @@ import {
3
3
  isFunction,
4
4
  isNumber,
5
5
  isString,
6
- nodeName_,
6
+ getNodeName,
7
7
  } from "../shared/utils";
8
8
 
9
9
  export function AnchorScrollProvider() {
@@ -31,7 +31,7 @@ export function AnchorScrollProvider() {
31
31
  function getFirstAnchor(list) {
32
32
  let result = null;
33
33
  Array.prototype.some.call(list, (element) => {
34
- if (nodeName_(element) === "a") {
34
+ if (getNodeName(element) === "a") {
35
35
  result = element;
36
36
  return true;
37
37
  }