@angular-wave/angular.ts 0.0.40 → 0.0.42

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.
Files changed (79) hide show
  1. package/README.md +28 -0
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +1 -1
  5. package/src/animations/animate-queue.js +7 -4
  6. package/src/core/compile/compile.js +5 -3
  7. package/src/core/compile/compile.md +2 -5
  8. package/src/core/compile/compile.spec.js +2 -43
  9. package/src/core/exception-handler.js +6 -6
  10. package/src/core/interpolate/interpolate.js +1 -1
  11. package/src/core/location/location.spec.js +0 -4
  12. package/src/core/q/q.js +1 -1
  13. package/src/core/scope/scope.js +1 -1
  14. package/src/core/task-tracker-factory.js +2 -2
  15. package/src/core/timeout/timeout.js +1 -1
  16. package/src/core/url-utils/url-utils.js +0 -2
  17. package/src/directive/bind/bind.js +2 -2
  18. package/src/directive/change/change.js +1 -1
  19. package/src/directive/cloak/cloak.js +1 -1
  20. package/src/directive/events/events.js +1 -1
  21. package/src/directive/form/form.js +2 -2
  22. package/src/directive/include/include.js +5 -7
  23. package/src/directive/init/init.js +1 -1
  24. package/src/directive/list/list.js +1 -1
  25. package/src/directive/model/model.js +1 -1
  26. package/src/directive/model-options/model-options.js +56 -421
  27. package/src/directive/model-options/model-options.md +407 -0
  28. package/src/directive/model-options/model-options.spec.js +1 -1
  29. package/src/directive/non-bindable/non-bindable.js +1 -2
  30. package/src/directive/options/options.js +3 -3
  31. package/src/directive/style/style.js +1 -1
  32. package/src/directive/switch/switch.js +2 -2
  33. package/src/directive/transclude/transclude.js +2 -2
  34. package/src/index.js +0 -461
  35. package/src/loader.js +1 -1
  36. package/src/public.js +1 -1
  37. package/src/router/template-factory.js +2 -2
  38. package/src/router/view-scroll.js +1 -1
  39. package/src/services/browser.js +1 -1
  40. package/src/services/document.js +2 -2
  41. package/src/services/http/http.js +11 -7
  42. package/src/services/log.js +1 -1
  43. package/src/services/template-request.js +1 -1
  44. package/src/shared/jqlite/jqlite.js +380 -351
  45. package/src/shared/jqlite/jqlite.spec.js +73 -82
  46. package/src/shared/utils.js +1 -1
  47. package/src/types.js +451 -0
  48. package/tsconfig.json +1 -1
  49. package/types/animations/shared.d.ts +7 -2
  50. package/types/core/compile/compile.d.ts +2 -1
  51. package/types/core/exception-handler.d.ts +5 -7
  52. package/types/core/interpolate/interpolate.d.ts +1 -1
  53. package/types/core/q/q.d.ts +1 -1
  54. package/types/core/task-tracker-factory.d.ts +5 -5
  55. package/types/core/timeout/timeout.d.ts +2 -2
  56. package/types/directive/bind/bind.d.ts +4 -4
  57. package/types/directive/change/change.d.ts +2 -2
  58. package/types/directive/cloak/cloak.d.ts +2 -2
  59. package/types/directive/include/include.d.ts +2 -2
  60. package/types/directive/init/init.d.ts +2 -2
  61. package/types/directive/list/list.d.ts +2 -2
  62. package/types/directive/model/model.d.ts +13 -7
  63. package/types/directive/model-options/model-options.d.ts +49 -0
  64. package/types/directive/non-bindable/non-bindable.d.ts +2 -3
  65. package/types/directive/style/style.d.ts +2 -2
  66. package/types/directive/switch/switch.d.ts +4 -4
  67. package/types/index.d.ts +1 -702
  68. package/types/public.d.ts +2 -2
  69. package/types/router/template-factory.d.ts +4 -4
  70. package/types/services/browser.d.ts +3 -3
  71. package/types/services/document.d.ts +6 -7
  72. package/types/services/log.d.ts +2 -2
  73. package/types/services/template-request.d.ts +1 -1
  74. package/types/shared/jqlite/jqlite.d.ts +91 -21
  75. package/types/shared/utils.d.ts +2 -2
  76. package/types/types.d.ts +438 -0
  77. package/types-back/index.d.ts +1 -83
  78. package/types-back/jqlite.d.ts +1 -121
  79. package/types-back/global.d.ts +0 -11
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.40",
4
+ "version": "0.0.42",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
@@ -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 = JQLite.data(node, NG_ANIMATE_PIN_DATA);
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 = JQLite.data(parentNode, NG_ANIMATE_CHILDREN_DATA);
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 = JQLite.data(parentNode, NG_ANIMATE_PIN_DATA);
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";
@@ -232,7 +234,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
232
234
  /**
233
235
  *
234
236
  * @param {*} $injector
235
- * @param {import('../exception-handler').angular.ErrorHandler} $exceptionHandler
237
+ * @param {import('../exception-handler').ErrorHandler} $exceptionHandler
236
238
  * @returns
237
239
  */
238
240
  function ($injector, $exceptionHandler) {
@@ -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
- JQLite.data(newNode, JQLite.data(firstElementToRemove));
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
- JQLite.cleanData(fragment.querySelectorAll("*"));
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++) {
@@ -471,14 +471,11 @@
471
471
  -
472
472
  -
473
473
  - #### `restrict`
474
- - String of subset of `EACM` which restricts the directive to a specific directive
474
+ - String of subset of `EA` which restricts the directive to a specific directive
475
475
  - declaration style. If omitted, the defaults (elements and attributes) are used.
476
476
  -
477
477
  - - `E` - Element name (default): `<my-directive></my-directive>`
478
- - - `A` - Attribute (default): `<div my-directive="exp"></div>`
479
- - - `C` - Class: `<div class="my-directive: exp;"></div>`
480
- - - `M` - Comment: `<!-- directive: my-directive exp -->`
481
- -
478
+ - - `A` - Attribute (default): `<div my-directive="exp"></div>`-
482
479
  -
483
480
  - #### `templateNamespace`
484
481
  - String representing the document type used by the markup in the template.
@@ -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
- JQLite.data(element, "foo", `template#${i}`);
17293
+ getOrSetCacheData(element, "foo", `template#${i}`);
17335
17294
  });
17336
17295
 
17337
17296
  const linkedElements = $compile(toCompile)($rootScope);
@@ -35,14 +35,14 @@
35
35
  */
36
36
 
37
37
  /**
38
- * @typedef {import('../index').angular.ServiceProvider} angular.ExceptionHandlerProvider
38
+ * @typedef {import('../types').ServiceProvider} ExceptionHandlerProvider
39
39
  */
40
40
 
41
- /** @type {import('../services/log').angular.LogService} */
41
+ /** @type {import('../services/log').LogService} */
42
42
  let log;
43
43
 
44
44
  /**
45
- * @callback angular.ErrorHandler
45
+ * @callback ErrorHandler
46
46
  * @param {Error} exception - Exception associated with the error.
47
47
  * @param {string} [cause] - Optional information about the context in which the error was thrown.
48
48
  * @returns {void}
@@ -53,14 +53,14 @@ export const errorHandler = (exception, cause) => {
53
53
 
54
54
  /**
55
55
  * @constructor
56
- * @this {angular.ExceptionHandlerProvider}
56
+ * @this {ExceptionHandlerProvider}
57
57
  */
58
58
  export function $ExceptionHandlerProvider() {
59
59
  this.$get = [
60
60
  "$log",
61
61
  /**
62
- * @param {import('../services/log').angular.LogService} $log
63
- * @returns {angular.ErrorHandler}
62
+ * @param {import('../services/log').LogService} $log
63
+ * @returns {ErrorHandler}
64
64
  */
65
65
  function ($log) {
66
66
  log = $log;
@@ -89,7 +89,7 @@ export function $InterpolateProvider() {
89
89
  /**
90
90
  *
91
91
  * @param {*} $parse
92
- * @param {import('../exception-handler').angular.ErrorHandler} $exceptionHandler
92
+ * @param {import('../exception-handler').ErrorHandler} $exceptionHandler
93
93
  * @param {*} $sce
94
94
  * @returns
95
95
  */
@@ -3297,10 +3297,6 @@ describe("$location", () => {
3297
3297
  );
3298
3298
  });
3299
3299
 
3300
- it("should throw on url(urlString, stateObject)", () => {
3301
- expectThrowOnStateChange(locationUrl);
3302
- });
3303
-
3304
3300
  it("should allow navigating outside the original base URL", () => {
3305
3301
  locationUrl = new LocationHashbangUrl(
3306
3302
  "http://server/pre/index.html",
package/src/core/q/q.js CHANGED
@@ -271,7 +271,7 @@ export function $QProvider() {
271
271
  /**
272
272
  *
273
273
  * @param {*} $rootScope
274
- * @param {import('../exception-handler').angular.ErrorHandler} $exceptionHandler
274
+ * @param {import('../exception-handler').ErrorHandler} $exceptionHandler
275
275
  * @returns
276
276
  */
277
277
  function ($rootScope, $exceptionHandler) {
@@ -55,7 +55,7 @@ let applyAsyncId = null;
55
55
  let $parse;
56
56
  /** @type {import('../../services/browser').Browser} */
57
57
  let $browser;
58
- /**@type {import('../exception-handler').angular.ErrorHandler} */
58
+ /**@type {import('../exception-handler').ErrorHandler} */
59
59
  let $exceptionHandler;
60
60
 
61
61
  /**
@@ -2,7 +2,7 @@ export function $$TaskTrackerFactoryProvider() {
2
2
  // eslint-disable-next-line no-use-before-define
3
3
  this.$get = [
4
4
  "$log",
5
- /** @param {import('../services/log').angular.LogService} log */
5
+ /** @param {import('../services/log').LogService} log */
6
6
  (log) => new TaskTracker(log),
7
7
  ];
8
8
  }
@@ -16,7 +16,7 @@ export function $$TaskTrackerFactoryProvider() {
16
16
  *
17
17
  * A `TaskTracker` can keep track of pending tasks (grouped by type) and can notify interested
18
18
  * parties when all pending tasks (or tasks of a specific type) have been completed.
19
- * @param {import('../services/log').angular.LogService} log
19
+ * @param {import('../services/log').LogService} log
20
20
  */
21
21
  export function TaskTracker(log) {
22
22
  const self = this;
@@ -9,7 +9,7 @@ const $timeoutMinErr = minErr("$timeout");
9
9
  * @param {*} $browser
10
10
  * @param {*} $q
11
11
  * @param {*} $$q
12
- * @param {import('../exception-handler').angular.ErrorHandler} $exceptionHandler
12
+ * @param {import('../exception-handler').ErrorHandler} $exceptionHandler
13
13
  * @returns
14
14
  */
15
15
  export function $timeout($rootScope, $browser, $q, $$q, $exceptionHandler) {
@@ -1,5 +1,3 @@
1
- /* eslint-disable no-use-before-define */
2
-
3
1
  import { isString } from "../../shared/utils";
4
2
 
5
3
  // service.
@@ -1,7 +1,7 @@
1
1
  import { isUndefined, stringify } from "../../shared/utils";
2
2
 
3
3
  /**
4
- * @returns {angular.IDirective}
4
+ * @returns {import('../../types').Directive}
5
5
  */
6
6
  export function ngBindDirective() {
7
7
  return {
@@ -15,7 +15,7 @@ export function ngBindDirective() {
15
15
  }
16
16
 
17
17
  /**
18
- * @returns {angular.IDirective}
18
+ * @returns {import('../../types').Directive}
19
19
  */
20
20
  export function ngBindTemplateDirective() {
21
21
  return {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @returns {angular.IDirective}
2
+ * @returns {import('../../types').Directive}
3
3
  */
4
4
  export function ngChangeDirective() {
5
5
  return {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @returns {angular.IDirective}
2
+ * @returns {import('../../types').Directive}
3
3
  */
4
4
  export function ngCloakDirective() {
5
5
  return {
@@ -27,7 +27,7 @@ const forceAsyncEvents = {
27
27
  *
28
28
  * @param {*} $parse
29
29
  * @param {*} $rootScope
30
- * @param {import('../../core/exception-handler').angular.ErrorHandler} $exceptionHandler
30
+ * @param {import('../../core/exception-handler').ErrorHandler} $exceptionHandler
31
31
  * @returns
32
32
  */
33
33
  ($parse, $rootScope, $exceptionHandler) => {
@@ -416,7 +416,7 @@ addSetValidityMethod({
416
416
  /**
417
417
  * @ngdoc directive
418
418
  * @name ngForm
419
- * @restrict EAC
419
+ * @restrict EA
420
420
  *
421
421
  * @description
422
422
  * Helper directive that makes it possible to create control groups inside a
@@ -518,7 +518,7 @@ const formDirectiveFactory = function (isNgForm) {
518
518
  function ($timeout, $parse) {
519
519
  const formDirective = {
520
520
  name: "form",
521
- restrict: isNgForm ? "EAC" : "E",
521
+ restrict: isNgForm ? "EA" : "E",
522
522
  require: ["form", "^^?form"], // first is the form's own ctrl, second is an optional parent form
523
523
  controller: FormController,
524
524
  compile: function ngFormCompile(formElement, attr) {
@@ -1,5 +1,5 @@
1
1
  import { isDefined } from "../../shared/utils";
2
- import { JQLiteBuildFragment } from "../../shared/jqlite/jqlite";
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(element, attr) {
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,5 +1,5 @@
1
1
  /**
2
- * @returns {angular.IDirective}
2
+ * @returns {import('../../types').Directive}
3
3
  */
4
4
  export function ngInitDirective() {
5
5
  return {
@@ -1,7 +1,7 @@
1
1
  import { forEach, isUndefined, trim } from "../../shared/utils";
2
2
 
3
3
  /**
4
- * @returns {angular.IDirective}
4
+ * @returns {import('../../types').Directive}
5
5
  */
6
6
  export function ngListDirective() {
7
7
  return {
@@ -189,7 +189,7 @@ NgModelController.$inject = [
189
189
  /**
190
190
  *
191
191
  * @param {*} $scope
192
- * @param {import('../../core/exception-handler').angular.ErrorHandler} $exceptionHandler
192
+ * @param {import('../../core/exception-handler').ErrorHandler} $exceptionHandler
193
193
  * @param {*} $attr
194
194
  * @param {*} $element
195
195
  * @param {*} $parse