@angular-wave/angular.ts 0.0.44 → 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.
@@ -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");
@@ -1661,14 +1660,6 @@ describe("jqLite", () => {
1661
1660
  },
1662
1661
  );
1663
1662
  });
1664
-
1665
- it("should throw an error if a selector is passed", () => {
1666
- const aElem = JQLite(a);
1667
- aElem.on("click", () => {});
1668
- expect(() => {
1669
- aElem.off("click", () => {}, ".test");
1670
- }).toThrow();
1671
- });
1672
1663
  });
1673
1664
 
1674
1665
  describe("replaceWith", () => {
@@ -511,8 +511,8 @@ export function extend(dst) {
511
511
  * @param {...Object} src Source object(s).
512
512
  * @returns {Object} Reference to `dst`.
513
513
  */
514
- export function merge(dst) {
515
- return baseExtend(dst, Array.prototype.slice.call(arguments, 1), true);
514
+ export function merge(dst, ...src) {
515
+ return baseExtend(dst, src, true);
516
516
  }
517
517
 
518
518
  export function toInt(str) {
@@ -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
- export function nodeName_(element) {
598
- return lowercase(element.nodeName || (element[0] && element[0].nodeName));
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) {
@@ -1026,7 +1037,7 @@ export function parseKeyValue(keyValue) {
1026
1037
  }
1027
1038
  }
1028
1039
  });
1029
- return obj;
1040
+ return /** @type {Object.<string,boolean|Array>} */ (obj);
1030
1041
  }
1031
1042
 
1032
1043
  export function toKeyValue(obj) {
package/src/src.test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { test, expect } from "@playwright/test";
2
2
 
3
- test("unitstate-directives tests contain no errors", async ({ page }) => {
3
+ test("src tests contain no errors", async ({ page }) => {
4
4
  await page.goto("src/src.html");
5
5
  await page.content();
6
6
  await page.waitForTimeout(6000);
package/src/types.js CHANGED
@@ -193,7 +193,7 @@
193
193
  /**
194
194
  * @callback CloneAttachFunction
195
195
  * @param {import('./shared/jqlite/jqlite').JQLite} [clonedElement]
196
- * @param {Scope} [scope] // Let's hint but not force cloneAttachFn's signature
196
+ * @param {import('./core/scope/scope').Scope} [scope] // Let's hint but not force cloneAttachFn's signature
197
197
  * @returns {any}
198
198
  */
199
199
 
@@ -213,7 +213,7 @@
213
213
  */
214
214
 
215
215
  /**
216
- * @typedef {function(CloneAttachFunction=, JQLite=, string=): import('./shared/jqlite/jqlite').JQLite} transcludeWithoutScope
216
+ * @typedef {function(CloneAttachFunction=, import('./shared/jqlite/jqlite').JQLite=, string=): import('./shared/jqlite/jqlite').JQLite} transcludeWithoutScope
217
217
  */
218
218
 
219
219
  /**
@@ -1,15 +1,3 @@
1
- /**
2
- * Converts kebab-case to camelCase.
3
- * @param {string} name Name to normalize
4
- * @returns {string}
5
- */
6
- export function kebabToCamel(name: string): string;
7
- /**
8
- * Converts sname to camelCase.
9
- * @param {string} name
10
- * @returns {string}
11
- */
12
- export function snakeToCamel(name: string): string;
13
1
  /**
14
2
  * JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
15
3
  * and execution of chain functions.
@@ -61,10 +49,74 @@ export class JQLite {
61
49
  * @returns {JQLite} The JQLite collection for chaining.
62
50
  */
63
51
  on(type: string, fn: Function): JQLite;
52
+ /**
53
+ * Removes an event listener to each element in JQLite collection.
54
+ *
55
+ * @param {string} type - The event type(s) to remove listener from
56
+ * @param {Function} fn - The function to remove from event type.
57
+ * @returns {JQLite}
58
+ */
59
+ off(type: string, fn: Function): JQLite;
60
+ /**
61
+ * Remove data by name from cache associated with each element in JQLite collection.
62
+ * @param {string} name - The key of the data associated with element
63
+ * @returns {JQLite}
64
+ */
65
+ removeData(name: string): JQLite;
66
+ /**
67
+ * Gets or sets data on a parent element
68
+ * @param {string} name
69
+ * @param {any} value
70
+ * @returns {JQLite|any}
71
+ */
72
+ inheritedData(name: string, value: any): JQLite | any;
73
+ /**
74
+ * Gets or sets innerHTML on the first element in JQLite collection
75
+ * @param {string} value
76
+ * @returns {JQLite|any|undefined}
77
+ */
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;
64
104
  toString(): string;
65
105
  eq(index: any): JQLite;
66
106
  length: number;
67
107
  }
108
+ /**
109
+ * Converts kebab-case to camelCase.
110
+ * @param {string} name Name to normalize
111
+ * @returns {string}
112
+ */
113
+ export function kebabToCamel(name: string): string;
114
+ /**
115
+ * Converts sname to camelCase.
116
+ * @param {string} name
117
+ * @returns {string}
118
+ */
119
+ export function snakeToCamel(name: string): string;
68
120
  /**
69
121
  * Removes expando data from this element. If key is provided, only
70
122
  * its field is removed. If data is empty, also removes `ExpandoStore`
@@ -105,13 +157,6 @@ export function getOrSetCacheData(element: Element, key: string | any, value?: a
105
157
  * @param {boolean} keepData
106
158
  */
107
159
  export function removeElement(element: Element, keepData?: boolean): void;
108
- export function getBooleanAttrName(element: any, name: any): any;
109
- /**
110
- * Takes an array of elements, calls any `$destroy` event handlers, removes any data in cache, and finally removes any
111
- * listeners.
112
- * @param {NodeListOf<Element>} nodes
113
- */
114
- export function cleanElementData(nodes: NodeListOf<Element>): void;
115
160
  /**
116
161
  * @param {string} elementStr
117
162
  * @returns {string} Returns the string representation of the element.
@@ -123,4 +168,11 @@ export function startingTag(elementStr: string): string;
123
168
  * @returns {JQLite} the inputted object or a JQLite collection containing the nodes
124
169
  */
125
170
  export function getBlockNodes(nodes: any[]): JQLite;
171
+ export function getBooleanAttrName(element: any, name: any): any;
172
+ /**
173
+ * Takes an array of elements, calls any `$destroy` event handlers, removes any data in cache, and finally removes any
174
+ * listeners.
175
+ * @param {NodeListOf<Element>|Element[]} nodes
176
+ */
177
+ export function cleanElementData(nodes: NodeListOf<Element> | Element[]): void;
126
178
  export const BOOLEAN_ATTR: {};
@@ -292,7 +292,7 @@ export function extend(dst: any, ...args: any[]): any;
292
292
  * @param {...Object} src Source object(s).
293
293
  * @returns {Object} Reference to `dst`.
294
294
  */
295
- export function merge(dst: any, ...args: any[]): any;
295
+ export function merge(dst: any, ...src: any[]): any;
296
296
  export function toInt(str: any): number;
297
297
  export function isNumberNaN(num: any): boolean;
298
298
  export function inherit(parent: any, extra: any): any;
@@ -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
- export function nodeName_(element: any): string;
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.
package/types/types.d.ts CHANGED
@@ -23,7 +23,7 @@ export type DirectiveCompileFn = (templateElement: TElement, templateAttributes:
23
23
  * Link function for an AngularJS directive.
24
24
  */
25
25
  export type DirectiveLinkFn = (scope: TScope, instanceElement: TElement, instanceAttributes: TAttributes, controller?: TController, transclude?: TranscludeFunction) => void;
26
- export type CloneAttachFunction = (clonedElement?: import("./shared/jqlite/jqlite").JQLite, scope?: Scope) => any;
26
+ export type CloneAttachFunction = (clonedElement?: import("./shared/jqlite/jqlite").JQLite, scope?: import("./core/scope/scope").Scope) => any;
27
27
  /**
28
28
  * This corresponds to $transclude passed to controllers and to the transclude function passed to link functions.
29
29
  * https://docs.angularjs.org/api/ng/service/$compile#-controller-
@@ -38,7 +38,7 @@ export type TranscludeFunction = {
38
38
  isSlotFilled: (arg0: string) => boolean;
39
39
  };
40
40
  export type transcludeWithScope = (arg0: TScope, arg1: CloneAttachFunction, arg2: import("./shared/jqlite/jqlite").JQLite | undefined, arg3: string | undefined) => import("./shared/jqlite/jqlite").JQLite;
41
- export type transcludeWithoutScope = (arg0: CloneAttachFunction | undefined, arg1: JQLite | undefined, arg2: string | undefined) => import("./shared/jqlite/jqlite").JQLite;
41
+ export type transcludeWithoutScope = (arg0: CloneAttachFunction | undefined, arg1: import("./shared/jqlite/jqlite").JQLite | undefined, arg2: string | undefined) => import("./shared/jqlite/jqlite").JQLite;
42
42
  /**
43
43
  * Represents the pre and post linking functions of a directive.
44
44
  */