@3dsource/utils 1.0.4 → 1.0.5

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 (131) hide show
  1. package/fesm2022/3dsource-utils.mjs +1793 -0
  2. package/fesm2022/3dsource-utils.mjs.map +1 -0
  3. package/index.d.ts +5 -0
  4. package/{src/lib/color/CMYKtoRGB.ts → lib/color/CMYKtoRGB.d.ts} +1 -11
  5. package/lib/color/HEXtoRGB.d.ts +5 -0
  6. package/lib/color/HSVtoRGB.d.ts +21 -0
  7. package/{src/lib/color/RGBtoCMYK.ts → lib/color/RGBtoCMYK.d.ts} +1 -31
  8. package/lib/color/RGBtoHEX.d.ts +1 -0
  9. package/lib/color/RGBtoHSV.d.ts +19 -0
  10. package/lib/color/hsv.d.ts +1 -0
  11. package/lib/color/max.d.ts +1 -0
  12. package/lib/color/min.d.ts +1 -0
  13. package/lib/color/overlay.d.ts +1 -0
  14. package/{src/lib/color/rgb.ts → lib/color/rgb.d.ts} +1 -3
  15. package/lib/color/sub.d.ts +1 -0
  16. package/lib/color/subtract.d.ts +1 -0
  17. package/lib/color/sum.d.ts +1 -0
  18. package/{src/lib/color/toRGB.ts → lib/color/toRGB.d.ts} +1 -7
  19. package/lib/color/toRGBA.d.ts +1 -0
  20. package/lib/constants/color-codes.constant.d.ts +9 -0
  21. package/lib/csv/CSV2Array.d.ts +1 -0
  22. package/lib/csv/CSV2Records.d.ts +1 -0
  23. package/lib/csv/ObjectToCSV.d.ts +1 -0
  24. package/lib/dev/dev3d.d.ts +1 -0
  25. package/lib/dev/logger.d.ts +11 -0
  26. package/lib/dev/timeToString.d.ts +5 -0
  27. package/lib/filenaming/cleanupFileName.d.ts +1 -0
  28. package/lib/filenaming/makePath.d.ts +1 -0
  29. package/lib/filenaming/normalizePath.d.ts +1 -0
  30. package/lib/geom/expandOverRectangle.d.ts +2 -0
  31. package/lib/geom/fitIntoRectangle.d.ts +2 -0
  32. package/{src/lib/geom/interfaces/area.interface.ts → lib/geom/interfaces/area.interface.d.ts} +1 -2
  33. package/{src/lib/geom/interfaces/rect.interface.ts → lib/geom/interfaces/rect.interface.d.ts} +2 -2
  34. package/lib/geom/interfaces/size.interface.d.ts +4 -0
  35. package/lib/geom/interfaces//321/201oords.interface.d.ts +4 -0
  36. package/lib/helpers/BatchLoader.d.ts +47 -0
  37. package/lib/helpers/KeyboardNumericCode.d.ts +103 -0
  38. package/lib/helpers/serialize.d.ts +1 -0
  39. package/lib/helpers/sleep.d.ts +1 -0
  40. package/lib/helpers/trimLastSlashFromUrl.d.ts +1 -0
  41. package/lib/image/SaveImage.d.ts +18 -0
  42. package/lib/image/getCanvasCached.d.ts +4 -0
  43. package/lib/image/getSnapshot.d.ts +2 -0
  44. package/lib/image/loadImage.d.ts +1 -0
  45. package/lib/interfaces/image-output.d.ts +7 -0
  46. package/{src/lib/interfaces/load-args-tmp.interface.ts → lib/interfaces/load-args-tmp.interface.d.ts} +1 -2
  47. package/lib/interfaces/load-args.interface.d.ts +15 -0
  48. package/{src/lib/math/baseSortedIndex.ts → lib/math/baseSortedIndex.d.ts} +1 -19
  49. package/{src/lib/math/calculateMedian.ts → lib/math/calculateMedian.d.ts} +1 -17
  50. package/{src/lib/math/circularIndex.ts → lib/math/circularIndex.d.ts} +1 -5
  51. package/lib/math/clampf.d.ts +8 -0
  52. package/lib/math/degrees.d.ts +2 -0
  53. package/{src/lib/math/floatCompare.ts → lib/math/floatCompare.d.ts} +3 -30
  54. package/{src/lib/math/inverseLerp.ts → lib/math/inverseLerp.d.ts} +1 -22
  55. package/lib/math/lerp.d.ts +7 -0
  56. package/{src/lib/mutex/Mutex.ts → lib/mutex/Mutex.d.ts} +8 -15
  57. package/{src/lib/mutex/Semaphore.ts → lib/mutex/Semaphore.d.ts} +7 -27
  58. package/lib/mutex/TaskRunner.d.ts +5 -0
  59. package/lib/predicates/BooleanPredictors.d.ts +27 -0
  60. package/{src/lib/predicates/textForSearch.ts → lib/predicates/textForSearch.d.ts} +1 -17
  61. package/{src/lib/predicates/where.ts → lib/predicates/where.d.ts} +2 -32
  62. package/lib/rxjs/leadingTrailingDebounceTime.d.ts +15 -0
  63. package/{src/lib/rxjs/smoothTransition.ts → lib/rxjs/smoothTransition.d.ts} +1 -19
  64. package/lib/rxjs/tapLog.d.ts +2 -0
  65. package/lib/strings/pad.d.ts +8 -0
  66. package/package.json +13 -2
  67. package/eslint.config.js +0 -37
  68. package/ng-package.json +0 -7
  69. package/src/lib/color/HEXtoRGB.ts +0 -9
  70. package/src/lib/color/HSVtoRGB.ts +0 -82
  71. package/src/lib/color/RGBtoHEX.ts +0 -17
  72. package/src/lib/color/RGBtoHSV.ts +0 -53
  73. package/src/lib/color/hsv.ts +0 -14
  74. package/src/lib/color/max.ts +0 -18
  75. package/src/lib/color/min.ts +0 -18
  76. package/src/lib/color/overlay.ts +0 -25
  77. package/src/lib/color/sub.ts +0 -18
  78. package/src/lib/color/subtract.ts +0 -27
  79. package/src/lib/color/sum.ts +0 -19
  80. package/src/lib/color/toRGBA.ts +0 -8
  81. package/src/lib/constants/color-codes.constant.ts +0 -9
  82. package/src/lib/csv/CSV2Array.ts +0 -66
  83. package/src/lib/csv/CSV2Records.ts +0 -56
  84. package/src/lib/csv/ObjectToCSV.ts +0 -21
  85. package/src/lib/dev/dev3d.ts +0 -1
  86. package/src/lib/dev/logger.ts +0 -94
  87. package/src/lib/dev/timeToString.ts +0 -16
  88. package/src/lib/filenaming/cleanupFileName.ts +0 -18
  89. package/src/lib/filenaming/makePath.ts +0 -5
  90. package/src/lib/filenaming/normalizePath.ts +0 -9
  91. package/src/lib/geom/expandOverRectangle.ts +0 -17
  92. package/src/lib/geom/fitIntoRectangle.ts +0 -43
  93. package/src/lib/geom/interfaces/size.interface.ts +0 -4
  94. package/src/lib/geom/interfaces//321/201oords.interface.ts +0 -4
  95. package/src/lib/helpers/BatchLoader.ts +0 -243
  96. package/src/lib/helpers/KeyboardNumericCode.ts +0 -118
  97. package/src/lib/helpers/serialize.ts +0 -11
  98. package/src/lib/helpers/sleep.ts +0 -3
  99. package/src/lib/helpers/trimLastSlashFromUrl.ts +0 -9
  100. package/src/lib/image/SaveImage.ts +0 -65
  101. package/src/lib/image/getCanvasCached.ts +0 -16
  102. package/src/lib/image/getSnapshot.ts +0 -99
  103. package/src/lib/image/loadImage.ts +0 -13
  104. package/src/lib/interfaces/image-output.ts +0 -8
  105. package/src/lib/interfaces/load-args.interface.ts +0 -15
  106. package/src/lib/math/clampf.ts +0 -14
  107. package/src/lib/math/degrees.ts +0 -7
  108. package/src/lib/math/lerp.ts +0 -12
  109. package/src/lib/mutex/TaskRunner.ts +0 -26
  110. package/src/lib/predicates/BooleanPredictors.ts +0 -47
  111. package/src/lib/rxjs/leadingTrailingDebounceTime.ts +0 -86
  112. package/src/lib/rxjs/tapLog.ts +0 -13
  113. package/src/lib/strings/pad.ts +0 -18
  114. package/tsconfig.lib.json +0 -13
  115. package/tsconfig.lib.prod.json +0 -11
  116. /package/{src/lib/color/index.ts → lib/color/index.d.ts} +0 -0
  117. /package/{src/lib/constants/index.ts → lib/constants/index.d.ts} +0 -0
  118. /package/{src/lib/csv/index.ts → lib/csv/index.d.ts} +0 -0
  119. /package/{src/lib/dev/index.ts → lib/dev/index.d.ts} +0 -0
  120. /package/{src/lib/filenaming/index.ts → lib/filenaming/index.d.ts} +0 -0
  121. /package/{src/lib/geom/index.ts → lib/geom/index.d.ts} +0 -0
  122. /package/{src/lib/geom/interfaces/index.ts → lib/geom/interfaces/index.d.ts} +0 -0
  123. /package/{src/lib/helpers/index.ts → lib/helpers/index.d.ts} +0 -0
  124. /package/{src/lib/image/index.ts → lib/image/index.d.ts} +0 -0
  125. /package/{src/lib/interfaces/index.ts → lib/interfaces/index.d.ts} +0 -0
  126. /package/{src/lib/math/index.ts → lib/math/index.d.ts} +0 -0
  127. /package/{src/lib/mutex/index.ts → lib/mutex/index.d.ts} +0 -0
  128. /package/{src/lib/predicates/index.ts → lib/predicates/index.d.ts} +0 -0
  129. /package/{src/lib/rxjs/index.ts → lib/rxjs/index.d.ts} +0 -0
  130. /package/{src/lib/strings/index.ts → lib/strings/index.d.ts} +0 -0
  131. /package/{src/public-api.ts → public-api.d.ts} +0 -0
@@ -1,47 +0,0 @@
1
- type TruthyTypesOf<T> = T extends false | '' | 0 | null | undefined ? never : T;
2
- type FalsyTypesOf<T> = T extends false | '' | 0 | null | undefined ? T : never;
3
- type EmptyTypesOf<T> = T extends undefined | null | object | '' ? T : never;
4
- type NonEmptyTypesOf<T> = T extends undefined | null | object | '' ? never : T;
5
- /**
6
- * The Boolean object represents a truth value: true or false.
7
- * @param value
8
- * @constructor
9
- * Returns:boolean
10
- */
11
- export const Truthy: <T>(value: T) => value is TruthyTypesOf<T> = <T>(
12
- value?: T,
13
- ): value is TruthyTypesOf<T> =>
14
- !!value && value !== 'false' && value !== 'undefined' && value !== 'null';
15
-
16
- /**
17
- * The Boolean object represents a INVERSE truth value: true or false.
18
- * @param value
19
- * @constructor
20
- * Returns:boolean
21
- */
22
- export const Falsy: <T>(value: T) => value is FalsyTypesOf<T> = <T>(
23
- value?: T,
24
- ): value is FalsyTypesOf<T> => !Truthy(value);
25
-
26
- /**
27
- * Checks if a value is empty.
28
- *
29
- * @param {any} value - The value to check.
30
- * @return {boolean} Returns true if the value is empty, otherwise false.
31
- */
32
- export const IsEmpty: <T>(value: T) => value is EmptyTypesOf<T> = <T>(
33
- value: T,
34
- ): value is EmptyTypesOf<T> => {
35
- return (
36
- value === undefined ||
37
- value === null ||
38
- (typeof value === 'object' && Object.keys(value).length === 0) ||
39
- (typeof value === 'string' && value.trim().length === 0)
40
- );
41
- };
42
-
43
- export const NotEmpty: <T>(value: T) => value is NonEmptyTypesOf<T> = <T>(
44
- value: T,
45
- ): value is NonEmptyTypesOf<T> => {
46
- return !IsEmpty(value);
47
- };
@@ -1,86 +0,0 @@
1
- import type { SchedulerLike, Subscriber, Subscription } from 'rxjs';
2
- import { asyncScheduler, Observable, timer } from 'rxjs';
3
-
4
- /**
5
- * Emits the most recent value emitted by the source Observable after a
6
- * specified time span has passed without another source emission.
7
- *
8
- * This is a combination of `debounceTime` and `auditTime` operators.
9
- *
10
- * The leading value is emitted immediately, and trailing values are debounced.
11
- *
12
- * @param dueTime The time to wait before emitting the last value.
13
- * @param scheduler The scheduler to use for the timeout.
14
- * @returns A function that returns an Observable that mirrors the source Observable, but applies the specified debouncing.
15
- */
16
- export function leadingTrailingDebounceTime<T>(
17
- dueTime: number,
18
- scheduler: SchedulerLike = asyncScheduler,
19
- ): (source: Observable<T>) => Observable<T> {
20
- return (source: Observable<T>) =>
21
- new Observable<T>((subscriber: Subscriber<T>) => {
22
- let hasValue = false;
23
- let lastValue: T | null = null;
24
- let timerSubscription: Subscription | null = null;
25
- let leading = true; // Controls whether we emit immediately.
26
-
27
- const clearTimer = () => {
28
- if (timerSubscription) {
29
- timerSubscription.unsubscribe();
30
- timerSubscription = null;
31
- }
32
- };
33
-
34
- const resetValues = () => {
35
- hasValue = false;
36
- lastValue = null;
37
- leading = true; // Reset so the next new value is immediate.
38
- };
39
-
40
- const emitLastValue = () => {
41
- if (hasValue && lastValue !== null) {
42
- subscriber.next(lastValue);
43
- resetValues();
44
- }
45
- };
46
-
47
- const sourceSubscription = source.subscribe({
48
- next: (value) => {
49
- // If we are "leading", emit immediately and switch leading off
50
- if (leading) {
51
- subscriber.next(value);
52
- leading = false;
53
- timerSubscription = timer(dueTime, scheduler).subscribe(() => {
54
- resetValues();
55
- clearTimer();
56
- });
57
- return;
58
- }
59
-
60
- // Otherwise, save the value and start (or restart) timer
61
- hasValue = true;
62
- lastValue = value;
63
- clearTimer();
64
- timerSubscription = timer(dueTime, scheduler).subscribe(() => {
65
- emitLastValue();
66
- });
67
- },
68
- error: (err: unknown) => {
69
- clearTimer();
70
- subscriber.error(err);
71
- },
72
- complete: () => {
73
- // If there is a pending emission, emit it before completing
74
- clearTimer();
75
- emitLastValue();
76
- subscriber.complete();
77
- },
78
- });
79
-
80
- // Cleanup logic
81
- return () => {
82
- clearTimer();
83
- sourceSubscription.unsubscribe();
84
- };
85
- });
86
- }
@@ -1,13 +0,0 @@
1
- import { tap } from 'rxjs/operators';
2
- import type { Observable } from 'rxjs';
3
- import { Logger } from '../dev';
4
- import { COLOR_CODES } from '../constants';
5
-
6
- export const tapLog =
7
- <T>(text: string, ...args: any): ((source: Observable<T>) => Observable<T>) =>
8
- (source: Observable<T>) =>
9
- source.pipe(
10
- tap((data) => {
11
- Logger.colored(...COLOR_CODES.TAP_LOG, text, data, ...args);
12
- }),
13
- );
@@ -1,18 +0,0 @@
1
- /**
2
- * Adds required number of symbols before input
3
- * @param input input string
4
- * @param size amount of total symbols
5
- * @param symbol filler
6
- * @returns string
7
- */
8
- export function pad(
9
- input: number | string,
10
- size: number,
11
- symbol = '0',
12
- ): string {
13
- let s = input + '';
14
- while (s.length < size) {
15
- s = symbol + s;
16
- }
17
- return s.slice(-size);
18
- }
package/tsconfig.lib.json DELETED
@@ -1,13 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "../../../tsconfig.json",
5
- "compilerOptions": {
6
- "outDir": "../../../out-tsc/lib",
7
- "declaration": true,
8
- "declarationMap": true,
9
- "inlineSources": true,
10
- "types": []
11
- },
12
- "exclude": ["**/*.spec.ts"]
13
- }
@@ -1,11 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "./tsconfig.lib.json",
5
- "compilerOptions": {
6
- "declarationMap": false
7
- },
8
- "angularCompilerOptions": {
9
- "compilationMode": "partial"
10
- }
11
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes