@tb-dev/prototype-dom 6.3.1 → 7.0.0

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare interface ScrollAsyncOptions extends ScrollIntoViewOptions {
1
+ export declare interface WaitScrollOptions extends ScrollIntoViewOptions {
2
2
  timeout?: number;
3
3
  /** @default true */
4
4
  throwOnTimeout?: boolean;
@@ -45,17 +45,17 @@ declare global {
45
45
  queryAsMap: <T extends Element, K, V = T>(selector: string, keyFn: (element: T) => K, valueFn?: (element: T) => V) => Map<K, V>;
46
46
  /**
47
47
  * Wait for the first descendant element that matches the given selector to exist.
48
- * Once found, scroll the element into view.
49
48
  * @param selector CSS selector to match.
50
- * @param options Options to customize the scrolling behavior.
49
+ * @param timeout Maximum time to wait for the element, in milliseconds.
51
50
  */
52
- scrollAsync: (selector: string, options?: ScrollAsyncOptions) => Promise<void>;
51
+ waitChild: (selector: string, timeout?: number) => Promise<Element>;
53
52
  /**
54
53
  * Wait for the first descendant element that matches the given selector to exist.
54
+ * Once found, scroll the element into view.
55
55
  * @param selector CSS selector to match.
56
- * @param timeout Maximum time to wait for the element, in milliseconds.
56
+ * @param options Options to customize the scrolling behavior.
57
57
  */
58
- waitChild: (selector: string, timeout?: number) => Promise<Element>;
58
+ waitScroll: (selector: string, options?: WaitScrollOptions) => Promise<void>;
59
59
  }
60
60
  interface Element {
61
61
  /**
@@ -141,17 +141,17 @@ declare global {
141
141
  queryAsMap: <T extends Element, K, V = T>(selector: string, keyFn: (element: T) => K, valueFn?: (element: T) => V) => Map<K, V>;
142
142
  /**
143
143
  * Wait for the first descendant element that matches the given selector to exist.
144
- * Once found, scroll the element into view.
145
144
  * @param selector CSS selector to match.
146
- * @param options Options to customize the scrolling behavior.
145
+ * @param timeout Maximum time to wait for the element, in milliseconds.
147
146
  */
148
- scrollAsync: (selector: string, options?: ScrollAsyncOptions) => Promise<void>;
147
+ waitChild: (selector: string, timeout?: number) => Promise<Element>;
149
148
  /**
150
149
  * Wait for the first descendant element that matches the given selector to exist.
150
+ * Once found, scroll the element into view.
151
151
  * @param selector CSS selector to match.
152
- * @param timeout Maximum time to wait for the element, in milliseconds.
152
+ * @param options Options to customize the scrolling behavior.
153
153
  */
154
- waitChild: (selector: string, timeout?: number) => Promise<Element>;
154
+ waitScroll: (selector: string, options?: WaitScrollOptions) => Promise<void>;
155
155
  }
156
156
  interface URLSearchParams {
157
157
  /**
@@ -113,7 +113,7 @@
113
113
  return promise;
114
114
  };
115
115
  }
116
- function scrollAsync() {
116
+ function waitScroll() {
117
117
  return async function(selector, options = {}) {
118
118
  const { timeout, throwOnTimeout = true, ...scrollOptions } = options;
119
119
  try {
@@ -140,8 +140,8 @@
140
140
  queryAsArray,
141
141
  queryAsSet,
142
142
  queryAsMap,
143
- scrollAsync,
144
- waitChild
143
+ waitChild,
144
+ waitScroll
145
145
  };
146
146
 
147
147
  function getStrict() {
@@ -181,7 +181,7 @@
181
181
  Document.prototype.queryAsArray = element.queryAsArray();
182
182
  Document.prototype.queryAsSet = element.queryAsSet();
183
183
  Document.prototype.queryAsMap = element.queryAsMap();
184
- Document.prototype.scrollAsync = element.scrollAsync();
184
+ Document.prototype.waitScroll = element.waitScroll();
185
185
  Document.prototype.waitChild = element.waitChild();
186
186
  Element.prototype.getAttributeStrict = element.getAttributeStrict();
187
187
  Element.prototype.getAttributeAsFloatStrict = element.getAttributeAsFloatStrict();
@@ -193,7 +193,7 @@
193
193
  Element.prototype.queryAsArray = element.queryAsArray();
194
194
  Element.prototype.queryAsSet = element.queryAsSet();
195
195
  Element.prototype.queryAsMap = element.queryAsMap();
196
- Element.prototype.scrollAsync = element.scrollAsync();
196
+ Element.prototype.waitScroll = element.waitScroll();
197
197
  Element.prototype.waitChild = element.waitChild();
198
198
  URLSearchParams.prototype.getStrict = urlSearchParams.getStrict();
199
199
  URLSearchParams.prototype.getAsInteger = urlSearchParams.getAsInteger();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/prototype-dom",
3
- "version": "6.3.1",
3
+ "version": "7.0.0",
4
4
  "description": "Prototype methods for DOM objects",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,21 +18,16 @@
18
18
  "url": "https://github.com/ferreira-tb/prototype-dom/issues",
19
19
  "email": "andrew.shien2@gmail.com"
20
20
  },
21
- "lint-staged": {
22
- "*.{?(c|m)@(j|t)s,css,vue,md,json}": "prettier --write"
23
- },
24
21
  "devDependencies": {
25
- "@tb-dev/eslint-config": "^5.3.3",
26
- "eslint": "^9.11.1",
27
- "husky": "^9.1.6",
28
- "lint-staged": "^15.2.10",
22
+ "@tb-dev/eslint-config": "^5.4.9",
23
+ "eslint": "^9.13.0",
29
24
  "prettier": "^3.3.3",
30
- "tslib": "^2.7.0",
31
- "typedoc": "^0.26.7",
32
- "typedoc-plugin-mdn-links": "^3.3.2",
33
- "typescript": "^5.6.2",
34
- "vite": "^5.4.8",
35
- "vite-plugin-dts": "^4.2.3"
25
+ "tslib": "^2.8.0",
26
+ "typedoc": "^0.26.10",
27
+ "typedoc-plugin-mdn-links": "^3.3.4",
28
+ "typescript": "^5.6.3",
29
+ "vite": "^5.4.10",
30
+ "vite-plugin-dts": "^4.3.0"
36
31
  },
37
32
  "files": [
38
33
  "dist/**/*"