@operato/utils 2.0.0-alpha.0 → 2.0.0-alpha.8

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 (63) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/src/adjust-list-param.d.ts +14 -0
  3. package/dist/src/adjust-list-param.js +8 -0
  4. package/dist/src/adjust-list-param.js.map +1 -1
  5. package/dist/src/async-lock.d.ts +13 -0
  6. package/dist/src/async-lock.js +13 -0
  7. package/dist/src/async-lock.js.map +1 -1
  8. package/dist/src/clipboard.d.ts +7 -0
  9. package/dist/src/clipboard.js +7 -0
  10. package/dist/src/clipboard.js.map +1 -1
  11. package/dist/src/closest-element.d.ts +7 -0
  12. package/dist/src/closest-element.js +7 -0
  13. package/dist/src/closest-element.js.map +1 -1
  14. package/dist/src/context-path.d.ts +15 -0
  15. package/dist/src/context-path.js +20 -0
  16. package/dist/src/context-path.js.map +1 -1
  17. package/dist/src/cookie.d.ts +18 -0
  18. package/dist/src/cookie.js +18 -0
  19. package/dist/src/cookie.js.map +1 -1
  20. package/dist/src/detect-overflow.d.ts +6 -0
  21. package/dist/src/detect-overflow.js +6 -0
  22. package/dist/src/detect-overflow.js.map +1 -1
  23. package/dist/src/format.d.ts +12 -0
  24. package/dist/src/format.js +12 -0
  25. package/dist/src/format.js.map +1 -1
  26. package/dist/src/logger.d.ts +15 -0
  27. package/dist/src/logger.js +15 -3
  28. package/dist/src/logger.js.map +1 -1
  29. package/dist/src/mixins/infinite-scrollable.d.ts +24 -0
  30. package/dist/src/mixins/infinite-scrollable.js +24 -0
  31. package/dist/src/mixins/infinite-scrollable.js.map +1 -1
  32. package/dist/src/os.d.ts +4 -0
  33. package/dist/src/os.js +4 -0
  34. package/dist/src/os.js.map +1 -1
  35. package/dist/src/password-pattern.d.ts +15 -0
  36. package/dist/src/password-pattern.js +15 -0
  37. package/dist/src/password-pattern.js.map +1 -1
  38. package/dist/src/stringify-bignum.d.ts +11 -0
  39. package/dist/src/stringify-bignum.js +11 -0
  40. package/dist/src/stringify-bignum.js.map +1 -1
  41. package/dist/src/timecapsule/snapshot-taker.d.ts +31 -0
  42. package/dist/src/timecapsule/snapshot-taker.js +36 -3
  43. package/dist/src/timecapsule/snapshot-taker.js.map +1 -1
  44. package/dist/src/timecapsule/timecapsule.d.ts +50 -0
  45. package/dist/src/timecapsule/timecapsule.js +50 -3
  46. package/dist/src/timecapsule/timecapsule.js.map +1 -1
  47. package/dist/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +2 -2
  49. package/src/adjust-list-param.ts +20 -0
  50. package/src/async-lock.ts +13 -0
  51. package/src/clipboard.ts +7 -0
  52. package/src/closest-element.ts +8 -0
  53. package/src/context-path.ts +20 -0
  54. package/src/cookie.ts +18 -0
  55. package/src/detect-overflow.ts +6 -0
  56. package/src/format.ts +12 -0
  57. package/src/logger.ts +15 -4
  58. package/src/mixins/infinite-scrollable.ts +24 -0
  59. package/src/os.ts +4 -0
  60. package/src/password-pattern.ts +15 -0
  61. package/src/stringify-bignum.ts +12 -0
  62. package/src/timecapsule/snapshot-taker.ts +41 -4
  63. package/src/timecapsule/timecapsule.ts +50 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.0-alpha.8](https://github.com/hatiolab/operato/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2024-01-20)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * comment for libraries ([bdf20d0](https://github.com/hatiolab/operato/commit/bdf20d057819187106b4a9e37d25c2c1f7febb39))
12
+
13
+
14
+
6
15
  ## [2.0.0-alpha.0](https://github.com/hatiolab/operato/compare/v1.13.1...v2.0.0-alpha.0) (2024-01-05)
7
16
 
8
17
  **Note:** Version bump only for package @operato/utils
@@ -1,8 +1,22 @@
1
+ /**
2
+ * Type definition for available filter operators that can be used in query filters.
3
+ */
1
4
  declare type FilterOperator = 'search' | 'eq' | 'between' | 'gte' | 'lte' | 'is_not_true' | 'in' | 'like' | 'i_like' | 'noteq' | 'is_empty_num_id' | 'is_blank' | 'is_present' | 'is_not_false' | 'is_true' | 'is_false' | 'is_not_null' | 'is_null' | 'notin_with_null' | 'notin' | 'gt' | 'lt' | 'i_nlike' | 'nlike';
5
+ /**
6
+ * Type definition for a query filter that can be applied to filter data.
7
+ */
2
8
  declare type QueryFilter = {
3
9
  name: string;
4
10
  operator: FilterOperator;
5
11
  value: any;
6
12
  };
13
+ /**
14
+ * A utility function to adjust query filters based on changes provided in `filtersChange`.
15
+ *
16
+ * @param {QueryFilter[]} filters - The current query filters.
17
+ * @param {QueryFilter[]} filtersChange - The changes to be applied to the filters.
18
+ * @param {boolean} replaceIf - A flag indicating whether to replace existing filters if a filter with the same name exists.
19
+ * @returns {QueryFilter[]} The adjusted query filters.
20
+ */
7
21
  export declare function adjustFilters(filters: QueryFilter[], filtersChange: QueryFilter[], replaceIf?: boolean): QueryFilter[];
8
22
  export {};
@@ -1,3 +1,11 @@
1
+ /**
2
+ * A utility function to adjust query filters based on changes provided in `filtersChange`.
3
+ *
4
+ * @param {QueryFilter[]} filters - The current query filters.
5
+ * @param {QueryFilter[]} filtersChange - The changes to be applied to the filters.
6
+ * @param {boolean} replaceIf - A flag indicating whether to replace existing filters if a filter with the same name exists.
7
+ * @returns {QueryFilter[]} The adjusted query filters.
8
+ */
1
9
  export function adjustFilters(filters, filtersChange, replaceIf = true) {
2
10
  var filtersNew = [...filters];
3
11
  filtersChange.forEach(change => {
@@ -1 +1 @@
1
- {"version":3,"file":"adjust-list-param.js","sourceRoot":"","sources":["../../src/adjust-list-param.ts"],"names":[],"mappings":"AA0CA,MAAM,UAAU,aAAa,CAC3B,OAAsB,EACtB,aAA4B,EAC5B,YAAqB,IAAI;IAEzB,IAAI,UAAU,GAAG,CAAC,GAAG,OAAO,CAAC,CAAA;IAE7B,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAM,GAAG,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAA;QACrE,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7B,OAAM;QACR,CAAC;QACD,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["declare type FilterOperator =\n | 'search'\n | 'eq'\n | 'between'\n | 'gte'\n | 'lte'\n | 'is_not_true'\n | 'in'\n | 'like'\n | 'i_like'\n | 'noteq'\n | 'is_empty_num_id'\n | 'is_blank'\n | 'is_present'\n | 'is_not_false'\n | 'is_true'\n | 'is_false'\n | 'is_not_null'\n | 'is_null'\n | 'notin_with_null'\n | 'notin'\n | 'gt'\n | 'lt'\n | 'i_nlike'\n | 'nlike'\n\ndeclare type QueryFilter = {\n name: string\n operator: FilterOperator\n value: any\n}\n\ndeclare type QuerySorter = {\n name: string\n desc?: boolean\n}\n\ndeclare type QueryPaginator = {\n page?: number\n limit?: number\n}\n\nexport function adjustFilters(\n filters: QueryFilter[],\n filtersChange: QueryFilter[],\n replaceIf: boolean = true\n): QueryFilter[] {\n var filtersNew = [...filters]\n\n filtersChange.forEach(change => {\n const idx = (filtersNew || []).findIndex(f => f.name === change.name)\n if (idx !== -1 && !replaceIf) {\n return\n }\n idx !== -1 ? filtersNew.splice(idx, 1, change) : filtersNew.push(change)\n })\n\n return filtersNew\n}\n"]}
1
+ {"version":3,"file":"adjust-list-param.js","sourceRoot":"","sources":["../../src/adjust-list-param.ts"],"names":[],"mappings":"AAsDA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAsB,EACtB,aAA4B,EAC5B,YAAqB,IAAI;IAEzB,IAAI,UAAU,GAAG,CAAC,GAAG,OAAO,CAAC,CAAA;IAE7B,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAM,GAAG,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAA;QACrE,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAC7B,OAAM;QACR,CAAC;QACD,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1E,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["/**\n * Type definition for available filter operators that can be used in query filters.\n */\ndeclare type FilterOperator =\n | 'search'\n | 'eq'\n | 'between'\n | 'gte'\n | 'lte'\n | 'is_not_true'\n | 'in'\n | 'like'\n | 'i_like'\n | 'noteq'\n | 'is_empty_num_id'\n | 'is_blank'\n | 'is_present'\n | 'is_not_false'\n | 'is_true'\n | 'is_false'\n | 'is_not_null'\n | 'is_null'\n | 'notin_with_null'\n | 'notin'\n | 'gt'\n | 'lt'\n | 'i_nlike'\n | 'nlike'\n\n/**\n * Type definition for a query filter that can be applied to filter data.\n */\ndeclare type QueryFilter = {\n name: string\n operator: FilterOperator\n value: any\n}\n\n/**\n * Type definition for sorting parameters that can be applied to sort data in a query.\n */\ndeclare type QuerySorter = {\n name: string\n desc?: boolean\n}\n\n/**\n * Type definition for pagination parameters that can be applied to paginate query results.\n */\ndeclare type QueryPaginator = {\n page?: number\n limit?: number\n}\n\n/**\n * A utility function to adjust query filters based on changes provided in `filtersChange`.\n *\n * @param {QueryFilter[]} filters - The current query filters.\n * @param {QueryFilter[]} filtersChange - The changes to be applied to the filters.\n * @param {boolean} replaceIf - A flag indicating whether to replace existing filters if a filter with the same name exists.\n * @returns {QueryFilter[]} The adjusted query filters.\n */\nexport function adjustFilters(\n filters: QueryFilter[],\n filtersChange: QueryFilter[],\n replaceIf: boolean = true\n): QueryFilter[] {\n var filtersNew = [...filters]\n\n filtersChange.forEach(change => {\n const idx = (filtersNew || []).findIndex(f => f.name === change.name)\n if (idx !== -1 && !replaceIf) {\n return\n }\n idx !== -1 ? filtersNew.splice(idx, 1, change) : filtersNew.push(change)\n })\n\n return filtersNew\n}\n"]}
@@ -1,6 +1,19 @@
1
+ /**
2
+ * A simple asynchronous lock utility class that allows controlling access to a critical section.
3
+ * It provides a mechanism to create a lock and wait for its release using promises.
4
+ */
1
5
  export declare class AsyncLock {
2
6
  unlock?: any;
3
7
  promise?: Promise<unknown> | undefined;
8
+ /**
9
+ * Creates an instance of the AsyncLock class.
10
+ *
11
+ * @param {boolean} [lock=false] - Optional parameter to lock the instance immediately upon creation.
12
+ */
4
13
  constructor(lock?: boolean);
14
+ /**
15
+ * Locks the instance, making it awaitable until unlocked.
16
+ * A new promise is created for the lock, and the existing unlock function is replaced with a new one.
17
+ */
5
18
  lock(): void;
6
19
  }
@@ -1,10 +1,23 @@
1
+ /**
2
+ * A simple asynchronous lock utility class that allows controlling access to a critical section.
3
+ * It provides a mechanism to create a lock and wait for its release using promises.
4
+ */
1
5
  export class AsyncLock {
6
+ /**
7
+ * Creates an instance of the AsyncLock class.
8
+ *
9
+ * @param {boolean} [lock=false] - Optional parameter to lock the instance immediately upon creation.
10
+ */
2
11
  constructor(lock = false) {
3
12
  this.promise = new Promise(resolve => (this.unlock = resolve));
4
13
  if (lock) {
5
14
  this.lock();
6
15
  }
7
16
  }
17
+ /**
18
+ * Locks the instance, making it awaitable until unlocked.
19
+ * A new promise is created for the lock, and the existing unlock function is replaced with a new one.
20
+ */
8
21
  lock() {
9
22
  this.promise = new Promise(resolve => (this.unlock = resolve));
10
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"async-lock.js","sourceRoot":"","sources":["../../src/async-lock.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAS;IAIpB,YAAY,OAAgB,KAAK;QAFjC,YAAO,GAAI,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAA;QAGxD,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,EAAE,CAAA;QACb,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAA;IAChE,CAAC;CACF","sourcesContent":["export class AsyncLock {\n unlock?: any\n promise? = new Promise(resolve => (this.unlock = resolve))\n\n constructor(lock: boolean = false) {\n if (lock) {\n this.lock()\n }\n }\n\n lock() {\n this.promise = new Promise(resolve => (this.unlock = resolve))\n }\n}\n"]}
1
+ {"version":3,"file":"async-lock.js","sourceRoot":"","sources":["../../src/async-lock.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,SAAS;IAIpB;;;;OAIG;IACH,YAAY,OAAgB,KAAK;QAPjC,YAAO,GAAI,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAA;QAQxD,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,EAAE,CAAA;QACb,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,CAAA;IAChE,CAAC;CACF","sourcesContent":["/**\n * A simple asynchronous lock utility class that allows controlling access to a critical section.\n * It provides a mechanism to create a lock and wait for its release using promises.\n */\nexport class AsyncLock {\n unlock?: any\n promise? = new Promise(resolve => (this.unlock = resolve))\n\n /**\n * Creates an instance of the AsyncLock class.\n *\n * @param {boolean} [lock=false] - Optional parameter to lock the instance immediately upon creation.\n */\n constructor(lock: boolean = false) {\n if (lock) {\n this.lock()\n }\n }\n\n /**\n * Locks the instance, making it awaitable until unlocked.\n * A new promise is created for the lock, and the existing unlock function is replaced with a new one.\n */\n lock() {\n this.promise = new Promise(resolve => (this.unlock = resolve))\n }\n}\n"]}
@@ -1 +1,8 @@
1
+ /**
2
+ * Copies the specified text to the clipboard.
3
+ *
4
+ * @param {string} textToCopy - The text to be copied to the clipboard.
5
+ * @param {string} [type] - Optional MIME type for the clipboard data (e.g., 'text/plain', 'text/html').
6
+ * @returns {Promise<void>} - A promise that resolves when the text is successfully copied to the clipboard.
7
+ */
1
8
  export declare function copyToClipboard(textToCopy: string, type?: string): Promise<void>;
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Copies the specified text to the clipboard.
3
+ *
4
+ * @param {string} textToCopy - The text to be copied to the clipboard.
5
+ * @param {string} [type] - Optional MIME type for the clipboard data (e.g., 'text/plain', 'text/html').
6
+ * @returns {Promise<void>} - A promise that resolves when the text is successfully copied to the clipboard.
7
+ */
1
8
  export async function copyToClipboard(textToCopy, type) {
2
9
  if (navigator.clipboard && window.isSecureContext) {
3
10
  if (type && type !== 'text/plain') {
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/clipboard.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB,EAAE,IAAa;IACrE,IAAI,SAAS,CAAC,SAAS,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAClD,IAAI,IAAI,IAAI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AE,CAAA;QACnB,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC","sourcesContent":["export async function copyToClipboard(textToCopy: string, type?: string): Promise<void> {\n if (navigator.clipboard && window.isSecureContext) {\n if (type && type !== 'text/plain') {\n /* According to experience, chrome seems to support text/html. */\n return navigator.clipboard.write([\n new ClipboardItem({\n [type]: new Blob([textToCopy], { type }),\n 'text/plain': new Blob([textToCopy], { type: 'text/plain' })\n })\n ])\n } else {\n return navigator.clipboard.write([\n new ClipboardItem({\n 'text/plain': new Blob([textToCopy], { type: 'text/plain' })\n })\n ])\n }\n } else {\n let textArea = document.createElement('textarea')\n\n textArea.value = textToCopy\n textArea.style.position = 'fixed'\n textArea.style.left = '-999999px'\n textArea.style.top = '-999999px'\n document.body.appendChild(textArea)\n textArea.focus()\n textArea.select()\n\n return new Promise((res, rej) => {\n document.execCommand('copy') ? res() : rej()\n textArea.remove()\n })\n }\n}\n"]}
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/clipboard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,UAAkB,EAAE,IAAa;IACrE,IAAI,SAAS,CAAC,SAAS,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAClD,IAAI,IAAI,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;YAClC,iEAAiE;YACjE,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC/B,IAAI,aAAa,CAAC;oBAChB,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;oBACxC,YAAY,EAAE,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;iBAC7D,CAAC;aACH,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC/B,IAAI,aAAa,CAAC;oBAChB,YAAY,EAAE,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;iBAC7D,CAAC;aACH,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAA;QAEjD,QAAQ,CAAC,KAAK,GAAG,UAAU,CAAA;QAC3B,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAA;QACjC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,WAAW,CAAA;QACjC,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,WAAW,CAAA;QAChC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACnC,QAAQ,CAAC,KAAK,EAAE,CAAA;QAChB,QAAQ,CAAC,MAAM,EAAE,CAAA;QAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC9B,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;YAC5C,QAAQ,CAAC,MAAM,EAAE,CAAA;QACnB,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC","sourcesContent":["/**\n * Copies the specified text to the clipboard.\n *\n * @param {string} textToCopy - The text to be copied to the clipboard.\n * @param {string} [type] - Optional MIME type for the clipboard data (e.g., 'text/plain', 'text/html').\n * @returns {Promise<void>} - A promise that resolves when the text is successfully copied to the clipboard.\n */\nexport async function copyToClipboard(textToCopy: string, type?: string): Promise<void> {\n if (navigator.clipboard && window.isSecureContext) {\n if (type && type !== 'text/plain') {\n /* According to experience, chrome seems to support text/html. */\n return navigator.clipboard.write([\n new ClipboardItem({\n [type]: new Blob([textToCopy], { type }),\n 'text/plain': new Blob([textToCopy], { type: 'text/plain' })\n })\n ])\n } else {\n return navigator.clipboard.write([\n new ClipboardItem({\n 'text/plain': new Blob([textToCopy], { type: 'text/plain' })\n })\n ])\n }\n } else {\n let textArea = document.createElement('textarea')\n\n textArea.value = textToCopy\n textArea.style.position = 'fixed'\n textArea.style.left = '-999999px'\n textArea.style.top = '-999999px'\n document.body.appendChild(textArea)\n textArea.focus()\n textArea.select()\n\n return new Promise((res, rej) => {\n document.execCommand('copy') ? res() : rej()\n textArea.remove()\n })\n }\n}\n"]}
@@ -1 +1,8 @@
1
+ /**
2
+ * Finds the closest ancestor element of the given base element that matches the provided CSS selector.
3
+ *
4
+ * @param {string} selector - The CSS selector to search for.
5
+ * @param {Element} base - The base element to start the search from.
6
+ * @returns {Element | null} - The closest ancestor element matching the selector, or null if none is found.
7
+ */
1
8
  export declare function closestElement(selector: string, base: Element): Element | null;
@@ -1,6 +1,13 @@
1
1
  /*
2
2
  * inspired by https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
3
3
  */
4
+ /**
5
+ * Finds the closest ancestor element of the given base element that matches the provided CSS selector.
6
+ *
7
+ * @param {string} selector - The CSS selector to search for.
8
+ * @param {Element} base - The base element to start the search from.
9
+ * @returns {Element | null} - The closest ancestor element matching the selector, or null if none is found.
10
+ */
4
11
  export function closestElement(selector, base) {
5
12
  function __closestFrom(el) {
6
13
  if (!el || el === document || el === window) {
@@ -1 +1 @@
1
- {"version":3,"file":"closest-element.js","sourceRoot":"","sources":["../../src/closest-element.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,IAAa;IAC5D,SAAS,aAAa,CAAC,EAAsC;QAC3D,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAK,EAAgB,CAAC,YAAY,EAAE,CAAC;YACnC,EAAE,GAAI,EAAgB,CAAC,YAAY,CAAA;QACrC,CAAC;QACD,IAAI,KAAK,GAAI,EAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC7C,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAG,EAAc,CAAC,WAAW,EAAiB,CAAC,IAAI,CAAC,CAAA;IAC1F,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["/*\n * inspired by https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd\n */\nexport function closestElement(selector: string, base: Element) {\n function __closestFrom(el: Element | Window | Document | null): Element | null {\n if (!el || el === document || el === window) {\n return null\n }\n if ((el as Slottable).assignedSlot) {\n el = (el as Slottable).assignedSlot\n }\n let found = (el as Element).closest(selector)\n return found ? found : __closestFrom(((el as Element).getRootNode() as ShadowRoot).host)\n }\n return __closestFrom(base)\n}\n"]}
1
+ {"version":3,"file":"closest-element.js","sourceRoot":"","sources":["../../src/closest-element.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,IAAa;IAC5D,SAAS,aAAa,CAAC,EAAsC;QAC3D,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAK,EAAgB,CAAC,YAAY,EAAE,CAAC;YACnC,EAAE,GAAI,EAAgB,CAAC,YAAY,CAAA;QACrC,CAAC;QACD,IAAI,KAAK,GAAI,EAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC7C,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAG,EAAc,CAAC,WAAW,EAAiB,CAAC,IAAI,CAAC,CAAA;IAC1F,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["/*\n * inspired by https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd\n */\n\n/**\n * Finds the closest ancestor element of the given base element that matches the provided CSS selector.\n *\n * @param {string} selector - The CSS selector to search for.\n * @param {Element} base - The base element to start the search from.\n * @returns {Element | null} - The closest ancestor element matching the selector, or null if none is found.\n */\nexport function closestElement(selector: string, base: Element) {\n function __closestFrom(el: Element | Window | Document | null): Element | null {\n if (!el || el === document || el === window) {\n return null\n }\n if ((el as Slottable).assignedSlot) {\n el = (el as Slottable).assignedSlot\n }\n let found = (el as Element).closest(selector)\n return found ? found : __closestFrom(((el as Element).getRootNode() as ShadowRoot).host)\n }\n return __closestFrom(base)\n}\n"]}
@@ -1,7 +1,22 @@
1
+ /**
2
+ * Parses the given pathname and extracts information about the contextPath, prefix, domain, and path.
3
+ *
4
+ * @param {string} pathname - The pathname to parse.
5
+ * @returns {object} - An object containing the parsed information:
6
+ * - contextPath: The context path portion of the pathname.
7
+ * - prefix: The prefix portion of the pathname.
8
+ * - domain: The domain portion of the pathname.
9
+ * - path: The remaining path after contextPath, prefix, and domain.
10
+ */
1
11
  export declare function getPathInfo(pathname: string): {
2
12
  contextPath: string;
3
13
  prefix: string;
4
14
  domain: string;
5
15
  path: string | undefined;
6
16
  };
17
+ /**
18
+ * Sets the context path prefix used for parsing pathnames.
19
+ *
20
+ * @param {string} contextPathPrefix - The new context path prefix to set.
21
+ */
7
22
  export declare function setContextPathPrefix(contextPathPrefix?: string): void;
@@ -1,4 +1,19 @@
1
+ /**
2
+ * A regular expression pattern used to parse the pathname into different parts.
3
+ * It captures the contextPath, prefix, domain, and path.
4
+ * Example: /contextPathPrefix/domain/path/to/resource
5
+ */
1
6
  var CONTEXT_PATH_PREFIX = 'domain|business';
7
+ /**
8
+ * Parses the given pathname and extracts information about the contextPath, prefix, domain, and path.
9
+ *
10
+ * @param {string} pathname - The pathname to parse.
11
+ * @returns {object} - An object containing the parsed information:
12
+ * - contextPath: The context path portion of the pathname.
13
+ * - prefix: The prefix portion of the pathname.
14
+ * - domain: The domain portion of the pathname.
15
+ * - path: The remaining path after contextPath, prefix, and domain.
16
+ */
2
17
  export function getPathInfo(pathname) {
3
18
  var regexp = new RegExp(`(/(${CONTEXT_PATH_PREFIX})/([^/]+))?(/?.*)`);
4
19
  var matched = pathname.match(regexp);
@@ -13,6 +28,11 @@ export function getPathInfo(pathname) {
13
28
  path
14
29
  };
15
30
  }
31
+ /**
32
+ * Sets the context path prefix used for parsing pathnames.
33
+ *
34
+ * @param {string} contextPathPrefix - The new context path prefix to set.
35
+ */
16
36
  export function setContextPathPrefix(contextPathPrefix) {
17
37
  console.log('context-path-prefix was just set to ', `'${contextPathPrefix || 'domain|business'}'`);
18
38
  CONTEXT_PATH_PREFIX = contextPathPrefix || 'domain|business';
@@ -1 +1 @@
1
- {"version":3,"file":"context-path.js","sourceRoot":"","sources":["../../src/context-path.ts"],"names":[],"mappings":"AAAA,IAAI,mBAAmB,GAAG,iBAAiB,CAAA;AAE3C,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,IAAI,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,mBAAmB,mBAAmB,CAAC,CAAA;IACrE,IAAI,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACpC,IAAI,WAAW,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,KAAI,EAAE,CAAA;IACpC,IAAI,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,KAAI,EAAE,CAAA;IAC/B,IAAI,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,KAAI,EAAE,CAAA;IAC/B,IAAI,IAAI,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAA;IAEvB,OAAO;QACL,WAAW;QACX,MAAM;QACN,MAAM;QACN,IAAI;KACL,CAAA;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,iBAA0B;IAC7D,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,IAAI,iBAAiB,IAAI,iBAAiB,GAAG,CAAC,CAAA;IAClG,mBAAmB,GAAG,iBAAiB,IAAI,iBAAiB,CAAA;AAC9D,CAAC","sourcesContent":["var CONTEXT_PATH_PREFIX = 'domain|business'\n\nexport function getPathInfo(pathname: string) {\n var regexp = new RegExp(`(/(${CONTEXT_PATH_PREFIX})/([^/]+))?(/?.*)`)\n var matched = pathname.match(regexp)\n var contextPath = matched?.[1] || ''\n var prefix = matched?.[2] || ''\n var domain = matched?.[3] || ''\n var path = matched?.[4]\n\n return {\n contextPath,\n prefix,\n domain,\n path\n }\n}\n\nexport function setContextPathPrefix(contextPathPrefix?: string) {\n console.log('context-path-prefix was just set to ', `'${contextPathPrefix || 'domain|business'}'`)\n CONTEXT_PATH_PREFIX = contextPathPrefix || 'domain|business'\n}\n"]}
1
+ {"version":3,"file":"context-path.js","sourceRoot":"","sources":["../../src/context-path.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,IAAI,mBAAmB,GAAG,iBAAiB,CAAA;AAE3C;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,IAAI,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,mBAAmB,mBAAmB,CAAC,CAAA;IACrE,IAAI,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACpC,IAAI,WAAW,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,KAAI,EAAE,CAAA;IACpC,IAAI,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,KAAI,EAAE,CAAA;IAC/B,IAAI,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,KAAI,EAAE,CAAA;IAC/B,IAAI,IAAI,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAA;IAEvB,OAAO;QACL,WAAW;QACX,MAAM;QACN,MAAM;QACN,IAAI;KACL,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,iBAA0B;IAC7D,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,IAAI,iBAAiB,IAAI,iBAAiB,GAAG,CAAC,CAAA;IAClG,mBAAmB,GAAG,iBAAiB,IAAI,iBAAiB,CAAA;AAC9D,CAAC","sourcesContent":["/**\n * A regular expression pattern used to parse the pathname into different parts.\n * It captures the contextPath, prefix, domain, and path.\n * Example: /contextPathPrefix/domain/path/to/resource\n */\nvar CONTEXT_PATH_PREFIX = 'domain|business'\n\n/**\n * Parses the given pathname and extracts information about the contextPath, prefix, domain, and path.\n *\n * @param {string} pathname - The pathname to parse.\n * @returns {object} - An object containing the parsed information:\n * - contextPath: The context path portion of the pathname.\n * - prefix: The prefix portion of the pathname.\n * - domain: The domain portion of the pathname.\n * - path: The remaining path after contextPath, prefix, and domain.\n */\nexport function getPathInfo(pathname: string) {\n var regexp = new RegExp(`(/(${CONTEXT_PATH_PREFIX})/([^/]+))?(/?.*)`)\n var matched = pathname.match(regexp)\n var contextPath = matched?.[1] || ''\n var prefix = matched?.[2] || ''\n var domain = matched?.[3] || ''\n var path = matched?.[4]\n\n return {\n contextPath,\n prefix,\n domain,\n path\n }\n}\n\n/**\n * Sets the context path prefix used for parsing pathnames.\n *\n * @param {string} contextPathPrefix - The new context path prefix to set.\n */\nexport function setContextPathPrefix(contextPathPrefix?: string) {\n console.log('context-path-prefix was just set to ', `'${contextPathPrefix || 'domain|business'}'`)\n CONTEXT_PATH_PREFIX = contextPathPrefix || 'domain|business'\n}\n"]}
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Sets a cookie with the given name, value, and expiration days.
3
+ *
4
+ * @param {string} cname - The name of the cookie.
5
+ * @param {string} cvalue - The value to be stored in the cookie.
6
+ * @param {number} exdays - The number of days until the cookie expires.
7
+ */
1
8
  export declare function setCookie(cname: string, cvalue: string, exdays: number): void;
9
+ /**
10
+ * Retrieves the value of a cookie with the given name.
11
+ *
12
+ * @param {string} cname - The name of the cookie to retrieve.
13
+ * @returns {string} - The value of the cookie, or an empty string if the cookie is not found.
14
+ */
2
15
  export declare function getCookie(cname: string): string;
16
+ /**
17
+ * Deletes a cookie with the given name.
18
+ *
19
+ * @param {string} name - The name of the cookie to delete.
20
+ */
3
21
  export declare function deleteCookie(name: string): void;
@@ -1,9 +1,22 @@
1
+ /**
2
+ * Sets a cookie with the given name, value, and expiration days.
3
+ *
4
+ * @param {string} cname - The name of the cookie.
5
+ * @param {string} cvalue - The value to be stored in the cookie.
6
+ * @param {number} exdays - The number of days until the cookie expires.
7
+ */
1
8
  export function setCookie(cname, cvalue, exdays) {
2
9
  var d = new Date();
3
10
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
4
11
  var expires = 'expires=' + d.toUTCString();
5
12
  document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
6
13
  }
14
+ /**
15
+ * Retrieves the value of a cookie with the given name.
16
+ *
17
+ * @param {string} cname - The name of the cookie to retrieve.
18
+ * @returns {string} - The value of the cookie, or an empty string if the cookie is not found.
19
+ */
7
20
  export function getCookie(cname) {
8
21
  var name = cname + '=';
9
22
  var decodedCookie = decodeURIComponent(document.cookie);
@@ -19,6 +32,11 @@ export function getCookie(cname) {
19
32
  }
20
33
  return '';
21
34
  }
35
+ /**
36
+ * Deletes a cookie with the given name.
37
+ *
38
+ * @param {string} name - The name of the cookie to delete.
39
+ */
22
40
  export function deleteCookie(name) {
23
41
  document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
24
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.js","s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;IACvC,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,2CAA2C,CAAA;AACtE,CAAC","sourcesContent":["export function setCookie(cname: string, cvalue: string, exdays: number) {\n var d = new Date()\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)\n var expires = 'expires=' + d.toUTCString()\n document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'\n}\n\nexport function getCookie(cname: string) {\n var name = cname + '='\n var decodedCookie = decodeURIComponent(document.cookie)\n var ca = decodedCookie.split(';')\n for (var i = 0; i < ca.length; i++) {\n var c = ca[i]\n while (c.charAt(0) == ' ') {\n c = c.substring(1)\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length)\n }\n }\n return ''\n}\n\nexport function deleteCookie(name: string) {\n document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'\n}\n"]}
1
+ {"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../src/cookie.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,MAAc,EAAE,MAAc;IACrE,IAAI,CAAC,GAAG,IAAI,IAAI,EAAE,CAAA;IAClB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;IACrD,IAAI,OAAO,GAAG,UAAU,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;IAC1C,QAAQ,CAAC,MAAM,GAAG,KAAK,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,OAAO,GAAG,SAAS,CAAA;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,IAAI,IAAI,GAAG,KAAK,GAAG,GAAG,CAAA;IACtB,IAAI,aAAa,GAAG,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACvD,IAAI,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;QACb,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;YAC1B,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACpB,CAAC;QACD,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,2CAA2C,CAAA;AACtE,CAAC","sourcesContent":["/**\n * Sets a cookie with the given name, value, and expiration days.\n *\n * @param {string} cname - The name of the cookie.\n * @param {string} cvalue - The value to be stored in the cookie.\n * @param {number} exdays - The number of days until the cookie expires.\n */\nexport function setCookie(cname: string, cvalue: string, exdays: number) {\n var d = new Date()\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000)\n var expires = 'expires=' + d.toUTCString()\n document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/'\n}\n\n/**\n * Retrieves the value of a cookie with the given name.\n *\n * @param {string} cname - The name of the cookie to retrieve.\n * @returns {string} - The value of the cookie, or an empty string if the cookie is not found.\n */\nexport function getCookie(cname: string) {\n var name = cname + '='\n var decodedCookie = decodeURIComponent(document.cookie)\n var ca = decodedCookie.split(';')\n for (var i = 0; i < ca.length; i++) {\n var c = ca[i]\n while (c.charAt(0) == ' ') {\n c = c.substring(1)\n }\n if (c.indexOf(name) == 0) {\n return c.substring(name.length, c.length)\n }\n }\n return ''\n}\n\n/**\n * Deletes a cookie with the given name.\n *\n * @param {string} name - The name of the cookie to delete.\n */\nexport function deleteCookie(name: string) {\n document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'\n}\n"]}
@@ -1 +1,7 @@
1
+ /**
2
+ * Detects if the content of an HTMLElement overflows its boundaries.
3
+ *
4
+ * @param {HTMLElement} el - The HTMLElement to check for overflow.
5
+ * @returns {boolean} - `true` if overflow is detected, `false` otherwise.
6
+ */
1
7
  export declare function detectOverflow(el: HTMLElement): boolean;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Detects if the content of an HTMLElement overflows its boundaries.
3
+ *
4
+ * @param {HTMLElement} el - The HTMLElement to check for overflow.
5
+ * @returns {boolean} - `true` if overflow is detected, `false` otherwise.
6
+ */
1
7
  export function detectOverflow(el) {
2
8
  var styleOverflow = el.style.overflow;
3
9
  if (!styleOverflow || styleOverflow === 'visible')
@@ -1 +1 @@
1
- {"version":3,"file":"detect-overflow.js","sourceRoot":"","sources":["../../src/detect-overflow.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,EAAe;IAC5C,IAAI,aAAa,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAA;IAErC,IAAI,CAAC,aAAa,IAAI,aAAa,KAAK,SAAS;QAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAE/E,IAAI,UAAU,GAAG,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAA;IAErF,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAA;IAEjC,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["export function detectOverflow(el: HTMLElement) {\n var styleOverflow = el.style.overflow\n\n if (!styleOverflow || styleOverflow === 'visible') el.style.overflow = 'hidden'\n\n var overflowed = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight\n\n el.style.overflow = styleOverflow\n\n return overflowed\n}\n"]}
1
+ {"version":3,"file":"detect-overflow.js","sourceRoot":"","sources":["../../src/detect-overflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAe;IAC5C,IAAI,aAAa,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAA;IAErC,IAAI,CAAC,aAAa,IAAI,aAAa,KAAK,SAAS;QAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAE/E,IAAI,UAAU,GAAG,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,CAAA;IAErF,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAA;IAEjC,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["/**\n * Detects if the content of an HTMLElement overflows its boundaries.\n *\n * @param {HTMLElement} el - The HTMLElement to check for overflow.\n * @returns {boolean} - `true` if overflow is detected, `false` otherwise.\n */\nexport function detectOverflow(el: HTMLElement) {\n var styleOverflow = el.style.overflow\n\n if (!styleOverflow || styleOverflow === 'visible') el.style.overflow = 'hidden'\n\n var overflowed = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight\n\n el.style.overflow = styleOverflow\n\n return overflowed\n}\n"]}
@@ -1 +1,13 @@
1
+ /**
2
+ * Formats a number according to the given mask.
3
+ *
4
+ * ```example
5
+ * var formattedValue = format('+$#,##0.00', 12345.67);
6
+ * console.log(formattedValue); // Output: +$12,345.67
7
+ * ```
8
+ *
9
+ * @param {any} mask - The formatting mask to apply.
10
+ * @param {any} value - The value to format.
11
+ * @returns {string} - The formatted string.
12
+ */
1
13
  export declare function format(mask: any, value: any): string;
@@ -2,6 +2,18 @@
2
2
  * Source Code from https://github.com/Mottie/javascript-number-formatter
3
3
  * 소스코드 출처 : https://github.com/Mottie/javascript-number-formatter
4
4
  */
5
+ /**
6
+ * Formats a number according to the given mask.
7
+ *
8
+ * ```example
9
+ * var formattedValue = format('+$#,##0.00', 12345.67);
10
+ * console.log(formattedValue); // Output: +$12,345.67
11
+ * ```
12
+ *
13
+ * @param {any} mask - The formatting mask to apply.
14
+ * @param {any} value - The value to format.
15
+ * @returns {string} - The formatted string.
16
+ */
5
17
  export function format(mask, value) {
6
18
  if (!mask || isNaN(+value)) {
7
19
  return value; // return as it is.
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,MAAM,CAAC,IAAS,EAAE,KAAU;IAC1C,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAA,CAAC,mBAAmB;IAClC,CAAC;IAED,IAAI,UAAU,EACZ,MAAM,EACN,OAAO,EACP,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,OAAO;IACP,qBAAqB;IACrB,GAAG,GAAG,IAAI,CAAC,MAAM,EACjB,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EACjC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;IAClD,mEAAmE;IACnE,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EACvC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,EAC9B,MAAM,GAAG,GAAG,GAAG,GAAG,EAClB,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAC3C,I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CAAC,IAAI,GAAG;QAAE,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;;QACrE,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAE1C,oFAAoF;IACpF,OAAO,MAAM,GAAG,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,MAAM,CAAA;AACnD,CAAC","sourcesContent":["/*\n * Source Code from https://github.com/Mottie/javascript-number-formatter\n * 소스코드 출처 : https://github.com/Mottie/javascript-number-formatter\n */\n\nexport function format(mask: any, value: any): string {\n if (!mask || isNaN(+value)) {\n return value // return as it is.\n }\n\n var isNegative,\n result,\n decimal,\n group,\n posLeadZero,\n posTrailZero,\n posSeparator,\n part,\n szSep,\n integer,\n // find prefix/suffix\n len = mask.length,\n start = mask.search(/[0-9\\-\\+#]/),\n prefix = start > 0 ? mask.substring(0, start) : '',\n // reverse string: not an ideal method if there are surrogate pairs\n str = mask.split('').reverse().join(''),\n end = str.search(/[0-9\\-\\+#]/),\n offset = len - end,\n substr = mask.substring(offset, offset + 1),\n indx = offset + (substr === '.' || substr === ',' ? 1 : 0),\n suffix = end > 0 ? mask.substring(indx, len) : ''\n\n // mask with prefix & suffix removed\n mask = mask.substring(start, indx)\n\n // convert any string to number according to formation sign.\n value = mask.charAt(0) === '-' ? -value : +value\n isNegative = value < 0 ? (value = -value) : 0 // process only abs(), and turn on flag.\n\n // search for separator for grp & decimal, anything not digit, not +/- sign, not #.\n result = mask.match(/[^\\d\\-\\+#]/g)\n decimal = '.' // ( result && result[ result.length - 1 ] ) || '.'; // ','는 소수점이 되지 않게 함\n group = (result && result[1] && result[0]) || ',' // treat the left most symbol as group separator\n\n // split the decimal for the format string if any.\n mask = mask.split(decimal)\n // Fix the decimal first, toFixed will auto fill trailing zero.\n value = value.toFixed(mask[1] && mask[1].length)\n value = +value + '' // convert number to string to trim off *all* trailing decimal zero(es)\n\n // fill back any trailing zero according to format\n posTrailZero = mask[1] && mask[1].lastIndexOf('0') // look for last zero in format\n part = value.split('.')\n // integer will get !part[1]\n if (!part[1] || (part[1] && part[1].length <= posTrailZero)) {\n value = (+value).toFixed(posTrailZero + 1)\n }\n szSep = mask[0].split(group) // look for separator\n mask[0] = szSep.join('') // join back without separator for counting the pos of any leading 0.\n\n posLeadZero = mask[0] && mask[0].indexOf('0')\n if (posLeadZero > -1) {\n while (part[0].length < mask[0].length - posLeadZero) {\n part[0] = '0' + part[0]\n }\n } else if (+part[0] === 0) {\n part[0] = ''\n }\n\n value = value.split('.')\n value[0] = part[0]\n\n // process the first group separator from decimal (.) only, the rest ignore.\n // get the length of the last slice of split result.\n posSeparator = szSep[1] && szSep[szSep.length - 1].length\n if (posSeparator) {\n integer = value[0]\n str = ''\n offset = integer.length % posSeparator\n len = integer.length\n for (indx = 0; indx < len; indx++) {\n str += integer.charAt(indx) // ie6 only support charAt for sz.\n // -posSeparator so that won't trail separator on full length\n /*jshint -W018 */\n if (!((indx - offset + 1) % posSeparator) && indx < len - posSeparator) {\n str += group\n }\n }\n value[0] = str\n }\n value[1] = mask[1] && value[1] ? decimal + value[1] : ''\n\n // remove negative sign if result is zero\n result = value.join('')\n if (result === '0' || result === '') {\n // remove negative sign if result is zero\n isNegative = false\n }\n\n // 앞에 +가 붙는다면 양수일 경우에도 +를 표기해줌\n var fixedPlusSign\n\n if (mask[0].substring(0, 1) == '+') fixedPlusSign = isNegative ? '-' : '+'\n else fixedPlusSign = isNegative ? '-' : ''\n\n // put back any negation, combine integer and fraction, and add back prefix & suffix\n return prefix + (fixedPlusSign + result) + suffix\n}\n"]}
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CAAC,IAAS,EAAE,KAAU;IAC1C,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE,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AAC,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,IAAI,GAAG,GAAG,GAAG,YAAY,EAAE,CAAC;gBACvE,GAAG,IAAI,KAAK,CAAA;YACd,CAAC;QACH,CAAC;QACD,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;IAChB,CAAC;IACD,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAExD,yCAAyC;IACzC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvB,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QACpC,yCAAyC;QACzC,UAAU,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,8BAA8B;IAC9B,IAAI,aAAa,CAAA;IAEjB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG;QAAE,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;;QACrE,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IAE1C,oFAAoF;IACpF,OAAO,MAAM,GAAG,CAAC,aAAa,GAAG,MAAM,CAAC,GAAG,MAAM,CAAA;AACnD,CAAC","sourcesContent":["/*\n * Source Code from https://github.com/Mottie/javascript-number-formatter\n * 소스코드 출처 : https://github.com/Mottie/javascript-number-formatter\n */\n\n/**\n * Formats a number according to the given mask.\n *\n * ```example\n * var formattedValue = format('+$#,##0.00', 12345.67);\n * console.log(formattedValue); // Output: +$12,345.67\n * ```\n *\n * @param {any} mask - The formatting mask to apply.\n * @param {any} value - The value to format.\n * @returns {string} - The formatted string.\n */\nexport function format(mask: any, value: any): string {\n if (!mask || isNaN(+value)) {\n return value // return as it is.\n }\n\n var isNegative,\n result,\n decimal,\n group,\n posLeadZero,\n posTrailZero,\n posSeparator,\n part,\n szSep,\n integer,\n // find prefix/suffix\n len = mask.length,\n start = mask.search(/[0-9\\-\\+#]/),\n prefix = start > 0 ? mask.substring(0, start) : '',\n // reverse string: not an ideal method if there are surrogate pairs\n str = mask.split('').reverse().join(''),\n end = str.search(/[0-9\\-\\+#]/),\n offset = len - end,\n substr = mask.substring(offset, offset + 1),\n indx = offset + (substr === '.' || substr === ',' ? 1 : 0),\n suffix = end > 0 ? mask.substring(indx, len) : ''\n\n // mask with prefix & suffix removed\n mask = mask.substring(start, indx)\n\n // convert any string to number according to formation sign.\n value = mask.charAt(0) === '-' ? -value : +value\n isNegative = value < 0 ? (value = -value) : 0 // process only abs(), and turn on flag.\n\n // search for separator for grp & decimal, anything not digit, not +/- sign, not #.\n result = mask.match(/[^\\d\\-\\+#]/g)\n decimal = '.' // ( result && result[ result.length - 1 ] ) || '.'; // ','는 소수점이 되지 않게 함\n group = (result && result[1] && result[0]) || ',' // treat the left most symbol as group separator\n\n // split the decimal for the format string if any.\n mask = mask.split(decimal)\n // Fix the decimal first, toFixed will auto fill trailing zero.\n value = value.toFixed(mask[1] && mask[1].length)\n value = +value + '' // convert number to string to trim off *all* trailing decimal zero(es)\n\n // fill back any trailing zero according to format\n posTrailZero = mask[1] && mask[1].lastIndexOf('0') // look for last zero in format\n part = value.split('.')\n // integer will get !part[1]\n if (!part[1] || (part[1] && part[1].length <= posTrailZero)) {\n value = (+value).toFixed(posTrailZero + 1)\n }\n szSep = mask[0].split(group) // look for separator\n mask[0] = szSep.join('') // join back without separator for counting the pos of any leading 0.\n\n posLeadZero = mask[0] && mask[0].indexOf('0')\n if (posLeadZero > -1) {\n while (part[0].length < mask[0].length - posLeadZero) {\n part[0] = '0' + part[0]\n }\n } else if (+part[0] === 0) {\n part[0] = ''\n }\n\n value = value.split('.')\n value[0] = part[0]\n\n // process the first group separator from decimal (.) only, the rest ignore.\n // get the length of the last slice of split result.\n posSeparator = szSep[1] && szSep[szSep.length - 1].length\n if (posSeparator) {\n integer = value[0]\n str = ''\n offset = integer.length % posSeparator\n len = integer.length\n for (indx = 0; indx < len; indx++) {\n str += integer.charAt(indx) // ie6 only support charAt for sz.\n // -posSeparator so that won't trail separator on full length\n /*jshint -W018 */\n if (!((indx - offset + 1) % posSeparator) && indx < len - posSeparator) {\n str += group\n }\n }\n value[0] = str\n }\n value[1] = mask[1] && value[1] ? decimal + value[1] : ''\n\n // remove negative sign if result is zero\n result = value.join('')\n if (result === '0' || result === '') {\n // remove negative sign if result is zero\n isNegative = false\n }\n\n // 앞에 +가 붙는다면 양수일 경우에도 +를 표기해줌\n var fixedPlusSign\n\n if (mask[0].substring(0, 1) == '+') fixedPlusSign = isNegative ? '-' : '+'\n else fixedPlusSign = isNegative ? '-' : ''\n\n // put back any negation, combine integer and fraction, and add back prefix & suffix\n return prefix + (fixedPlusSign + result) + suffix\n}\n"]}
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Logs an error message with optional stack trace.
3
+ *
4
+ * @param {...any} args - The error message and optional additional data.
5
+ */
1
6
  export declare var error: (...args: any[]) => void;
7
+ /**
8
+ * Logs a warning message with optional stack trace.
9
+ *
10
+ * @param {...any} args - The warning message and optional additional data.
11
+ */
2
12
  export declare var warn: (...args: any[]) => void;
13
+ /**
14
+ * Logs a debug message.
15
+ *
16
+ * @param {...any} args - The debug message and optional additional data.
17
+ */
3
18
  export declare var debug: (...args: any[]) => void;
@@ -1,18 +1,30 @@
1
- /*
2
- * Copyright © HatioLab Inc. All rights reserved.
3
- */
4
1
  const ERROR = '[ERROR]';
5
2
  const WARN = '[WARN]';
6
3
  const DEBUG = '[DEBUG]';
4
+ /**
5
+ * Logs an error message with optional stack trace.
6
+ *
7
+ * @param {...any} args - The error message and optional additional data.
8
+ */
7
9
  export var error = (...args) => {
8
10
  var trace = [];
9
11
  args.forEach(arg => arg && arg.stack && trace.push(arg.stack));
10
12
  console.error(ERROR, ...args, trace.join(' '));
11
13
  };
14
+ /**
15
+ * Logs a warning message with optional stack trace.
16
+ *
17
+ * @param {...any} args - The warning message and optional additional data.
18
+ */
12
19
  export var warn = (...args) => {
13
20
  var trace = [];
14
21
  args.forEach(arg => arg && arg.stack && trace.push(arg.stack));
15
22
  console.warn(WARN, ...args, trace.join(' '));
16
23
  };
24
+ /**
25
+ * Logs a debug message.
26
+ *
27
+ * @param {...any} args - The debug message and optional additional data.
28
+ */
17
29
  export var debug = (...args) => console.log(DEBUG, ...args);
18
30
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,KAAK,GAAG,SAAS,CAAA;AACvB,MAAM,IAAI,GAAG,QAAQ,CAAA;AACrB,MAAM,KAAK,GAAG,SAAS,CAAA;AAEvB,MAAM,CAAC,IAAI,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IACpC,IAAI,KAAK,GAAG,EAAc,CAAA;IAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9D,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAChD,CAAC,CAAA;AAED,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IACnC,IAAI,KAAK,GAAG,EAAc,CAAA;IAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9D,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAC9C,CAAC,CAAA;AAED,MAAM,CAAC,IAAI,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst ERROR = '[ERROR]'\nconst WARN = '[WARN]'\nconst DEBUG = '[DEBUG]'\n\nexport var error = (...args: any[]) => {\n var trace = [] as string[]\n args.forEach(arg => arg && arg.stack && trace.push(arg.stack))\n console.error(ERROR, ...args, trace.join(' '))\n}\n\nexport var warn = (...args: any[]) => {\n var trace = [] as string[]\n args.forEach(arg => arg && arg.stack && trace.push(arg.stack))\n console.warn(WARN, ...args, trace.join(' '))\n}\n\nexport var debug = (...args: any[]) => console.log(DEBUG, ...args)\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,SAAS,CAAA;AACvB,MAAM,IAAI,GAAG,QAAQ,CAAA;AACrB,MAAM,KAAK,GAAG,SAAS,CAAA;AAEvB;;;;GAIG;AACH,MAAM,CAAC,IAAI,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IACpC,IAAI,KAAK,GAAG,EAAc,CAAA;IAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9D,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAChD,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;IACnC,IAAI,KAAK,GAAG,EAAc,CAAA;IAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9D,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAC9C,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,IAAI,KAAK,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAA","sourcesContent":["const ERROR = '[ERROR]'\nconst WARN = '[WARN]'\nconst DEBUG = '[DEBUG]'\n\n/**\n * Logs an error message with optional stack trace.\n *\n * @param {...any} args - The error message and optional additional data.\n */\nexport var error = (...args: any[]) => {\n var trace = [] as string[]\n args.forEach(arg => arg && arg.stack && trace.push(arg.stack))\n console.error(ERROR, ...args, trace.join(' '))\n}\n\n/**\n * Logs a warning message with optional stack trace.\n *\n * @param {...any} args - The warning message and optional additional data.\n */\nexport var warn = (...args: any[]) => {\n var trace = [] as string[]\n args.forEach(arg => arg && arg.stack && trace.push(arg.stack))\n console.warn(WARN, ...args, trace.join(' '))\n}\n\n/**\n * Logs a debug message.\n *\n * @param {...any} args - The debug message and optional additional data.\n */\nexport var debug = (...args: any[]) => console.log(DEBUG, ...args)\n"]}
@@ -1,13 +1,37 @@
1
1
  type Constructor = new (...args: any[]) => {};
2
+ /**
3
+ * A higher-order function that enhances a base class with infinite scrolling functionality.
4
+ *
5
+ * @template TBase - The base class constructor type.
6
+ * @param {TBase} Base - The base class to enhance with infinite scrolling.
7
+ * @returns {TBase & InfiniteScrollable} - The extended class with infinite scrolling capabilities.
8
+ */
2
9
  export default function InfiniteScrollable<TBase extends Constructor>(Base: TBase): {
3
10
  new (...args: any[]): {
11
+ /**
12
+ * Default options for infinite scrolling.
13
+ *
14
+ * @type {object}
15
+ * @property {number} threshold - The threshold value to trigger loading more items.
16
+ * @property {number} limit - The limit of items to load per page.
17
+ * @property {string} totalProp - The property name for the total number of items.
18
+ * @property {string} pageProp - The property name for the current page number.
19
+ */
4
20
  _infiniteScrollOptions: {
5
21
  threshold: number;
6
22
  limit: number;
7
23
  totalProp: string;
8
24
  pageProp: string;
9
25
  };
26
+ /**
27
+ * Event handler for the scroll event with debouncing.
28
+ *
29
+ * @param {Event} e - The scroll event object.
30
+ */
10
31
  onScroll: import("lodash").DebouncedFunc<(e: any) => void>;
32
+ /**
33
+ * An async function to handle scroll action when the threshold is reached.
34
+ */
11
35
  scrollAction(): Promise<void>;
12
36
  };
13
37
  } & TBase;
@@ -1,14 +1,35 @@
1
1
  import debounce from 'lodash-es/debounce';
2
+ /**
3
+ * A higher-order function that enhances a base class with infinite scrolling functionality.
4
+ *
5
+ * @template TBase - The base class constructor type.
6
+ * @param {TBase} Base - The base class to enhance with infinite scrolling.
7
+ * @returns {TBase & InfiniteScrollable} - The extended class with infinite scrolling capabilities.
8
+ */
2
9
  export default function InfiniteScrollable(Base) {
3
10
  return class Scrolling extends Base {
4
11
  constructor() {
5
12
  super(...arguments);
13
+ /**
14
+ * Default options for infinite scrolling.
15
+ *
16
+ * @type {object}
17
+ * @property {number} threshold - The threshold value to trigger loading more items.
18
+ * @property {number} limit - The limit of items to load per page.
19
+ * @property {string} totalProp - The property name for the total number of items.
20
+ * @property {string} pageProp - The property name for the current page number.
21
+ */
6
22
  this._infiniteScrollOptions = {
7
23
  threshold: 20,
8
24
  limit: 30,
9
25
  totalProp: '_total',
10
26
  pageProp: '_page'
11
27
  };
28
+ /**
29
+ * Event handler for the scroll event with debouncing.
30
+ *
31
+ * @param {Event} e - The scroll event object.
32
+ */
12
33
  this.onScroll = debounce(e => {
13
34
  //@ts-ignore inheritted class should have scrollTargetEl property
14
35
  var el = this.scrollTargetEl;
@@ -28,6 +49,9 @@ export default function InfiniteScrollable(Base) {
28
49
  // console.warn('scroll target element is not defined.')
29
50
  // return null
30
51
  // }
52
+ /**
53
+ * An async function to handle scroll action when the threshold is reached.
54
+ */
31
55
  async scrollAction() {
32
56
  console.warn('scroll action not implemented.');
33
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"infinite-scrollable.js","sourceRoot":"","sources":["../../../src/mixins/infinite-scrollable.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AAIzC,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAA4B,IAAW;IAC/E,OAAO,MAAM,SAAU,SAAQ,IAAI;QAA5B;;YACL,2BAAsB,GAAG;gBACvB,SAAS,EAAE,EAAE;gBACb,KAAK,EAAE,EAAE;gBACT,SAAS,EAAE,QAAQ;gBACnB,QAAQ,EAAE,OAAO;aAClB,CAAA;YAED,aAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE;gBACtB,iEAAiE;gBACjE,IAAI,EAAE,GAAG,IAAI,CAAC,cAAc,CAAA;gBAC5B,IAAI,CAAC,EAAE,EAAE,CAAC;oBACR,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;oBACrD,OAAM;gBACR,CAAC;gBAED,IAAI,EAAE,SAAS,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAA;gBAE/E,IACG,IAAY,CAAC,QAAQ,CAAC,GAAI,IAAY,CAAC,SAAS,CAAC,GAAG,KAAK;oBAC1D,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,SAAS,GAAG,SAAS,EAC7D,CAAC;oBACD,IAAI,CAAC,YAAY,EAAE,CAAA;gBACrB,CAAC;YACH,CAAC,EAAE,GAAG,CAAC,CAAA;QAYT,CAAC;QAVC,gCAAgC;QAChC,6CAA6C;QAC7C,0DAA0D;QAE1D,gBAAgB;QAChB,IAAI;QAEJ,KAAK,CAAC,YAAY;YAChB,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;QAChD,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import debounce from 'lodash-es/debounce'\n\ntype Constructor = new (...args: any[]) => {}\n\nexport default function InfiniteScrollable<TBase extends Constructor>(Base: TBase) {\n return class Scrolling extends Base {\n _infiniteScrollOptions = {\n threshold: 20,\n limit: 30,\n totalProp: '_total',\n pageProp: '_page'\n }\n\n onScroll = debounce(e => {\n //@ts-ignore inheritted class should have scrollTargetEl property\n var el = this.scrollTargetEl\n if (!el) {\n console.warn('scroll target element is not defined.')\n return\n }\n\n var { threshold = 0, limit, totalProp, pageProp } = this._infiniteScrollOptions\n\n if (\n (this as any)[pageProp] < (this as any)[totalProp] / limit &&\n el.scrollHeight - el.clientHeight <= el.scrollTop + threshold\n ) {\n this.scrollAction()\n }\n }, 300)\n\n // commented due to TS2611 error\n // get scrollTargetEl(): HTMLElement | null {\n // console.warn('scroll target element is not defined.')\n\n // return null\n // }\n\n async scrollAction() {\n console.warn('scroll action not implemented.')\n }\n }\n}\n"]}
1
+ {"version":3,"file":"infinite-scrollable.js","sourceRoot":"","sources":["../../../src/mixins/infinite-scrollable.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AAIzC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAA4B,IAAW;IAC/E,OAAO,MAAM,SAAU,SAAQ,IAAI;QAA5B;;YACL;;;;;;;;eAQG;YACH,2BAAsB,GAAG;gBACvB,SAAS,EAAE,EAAE;gBACb,KAAK,EAAE,EAAE;gBACT,SAAS,EAAE,QAAQ;gBACnB,QAAQ,EAAE,OAAO;aAClB,CAAA;YAED;;;;eAIG;YACH,aAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE;gBACtB,iEAAiE;gBACjE,IAAI,EAAE,GAAG,IAAI,CAAC,cAAc,CAAA;gBAC5B,IAAI,CAAC,EAAE,EAAE,CAAC;oBACR,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;oBACrD,OAAM;gBACR,CAAC;gBAED,IAAI,EAAE,SAAS,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAA;gBAE/E,IACG,IAAY,CAAC,QAAQ,CAAC,GAAI,IAAY,CAAC,SAAS,CAAC,GAAG,KAAK;oBAC1D,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,SAAS,GAAG,SAAS,EAC7D,CAAC;oBACD,IAAI,CAAC,YAAY,EAAE,CAAA;gBACrB,CAAC;YACH,CAAC,EAAE,GAAG,CAAC,CAAA;QAeT,CAAC;QAbC,gCAAgC;QAChC,6CAA6C;QAC7C,0DAA0D;QAE1D,gBAAgB;QAChB,IAAI;QAEJ;;WAEG;QACH,KAAK,CAAC,YAAY;YAChB,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;QAChD,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import debounce from 'lodash-es/debounce'\n\ntype Constructor = new (...args: any[]) => {}\n\n/**\n * A higher-order function that enhances a base class with infinite scrolling functionality.\n *\n * @template TBase - The base class constructor type.\n * @param {TBase} Base - The base class to enhance with infinite scrolling.\n * @returns {TBase & InfiniteScrollable} - The extended class with infinite scrolling capabilities.\n */\nexport default function InfiniteScrollable<TBase extends Constructor>(Base: TBase) {\n return class Scrolling extends Base {\n /**\n * Default options for infinite scrolling.\n *\n * @type {object}\n * @property {number} threshold - The threshold value to trigger loading more items.\n * @property {number} limit - The limit of items to load per page.\n * @property {string} totalProp - The property name for the total number of items.\n * @property {string} pageProp - The property name for the current page number.\n */\n _infiniteScrollOptions = {\n threshold: 20,\n limit: 30,\n totalProp: '_total',\n pageProp: '_page'\n }\n\n /**\n * Event handler for the scroll event with debouncing.\n *\n * @param {Event} e - The scroll event object.\n */\n onScroll = debounce(e => {\n //@ts-ignore inheritted class should have scrollTargetEl property\n var el = this.scrollTargetEl\n if (!el) {\n console.warn('scroll target element is not defined.')\n return\n }\n\n var { threshold = 0, limit, totalProp, pageProp } = this._infiniteScrollOptions\n\n if (\n (this as any)[pageProp] < (this as any)[totalProp] / limit &&\n el.scrollHeight - el.clientHeight <= el.scrollTop + threshold\n ) {\n this.scrollAction()\n }\n }, 300)\n\n // commented due to TS2611 error\n // get scrollTargetEl(): HTMLElement | null {\n // console.warn('scroll target element is not defined.')\n\n // return null\n // }\n\n /**\n * An async function to handle scroll action when the threshold is reached.\n */\n async scrollAction() {\n console.warn('scroll action not implemented.')\n }\n }\n}\n"]}
package/dist/src/os.d.ts CHANGED
@@ -23,4 +23,8 @@ export declare function isIOS(): boolean;
23
23
  * @returns {boolean}
24
24
  */
25
25
  export declare function isMacOS(): boolean;
26
+ /**
27
+ * method to tell if platform of running browser is Safari
28
+ * @returns {boolean}
29
+ */
26
30
  export declare function isSafari(): false | RegExpMatchArray | null;