@adaptabletools/adaptable 22.0.0-canary.11 → 22.0.0-canary.12

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 (106) hide show
  1. package/index.css +0 -12
  2. package/index.css.map +1 -1
  3. package/package.json +1 -4
  4. package/src/AdaptableState/Common/AdaptableForm.d.ts +1 -1
  5. package/src/AdaptableState/UserInterfaceState.d.ts +1 -1
  6. package/src/Api/Implementation/LayoutHelpers.js +1 -1
  7. package/src/Api/Internal/ColumnInternalApi.js +1 -1
  8. package/src/Api/Internal/EventInternalApi.js +1 -1
  9. package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +1 -1
  10. package/src/Redux/Store/AdaptableReduxMerger.js +5 -6
  11. package/src/Strategy/LayoutModule.js +1 -1
  12. package/src/Strategy/TeamSharingModule.js +2 -2
  13. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +1 -1
  14. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +1 -1
  15. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +1 -1
  16. package/src/Utilities/Extensions/StringExtensions.js +1 -1
  17. package/src/Utilities/Helpers/AdaptableHelper.js +2 -2
  18. package/src/Utilities/Helpers/FormatHelper.js +1 -1
  19. package/src/Utilities/Services/LicenseService/index.js +1 -1
  20. package/src/Utilities/Services/RowSummaryService.d.ts +1 -1
  21. package/src/Utilities/Services/RowSummaryService.js +2 -2
  22. package/src/Utilities/utils/chunk.d.ts +6 -0
  23. package/src/Utilities/utils/chunk.js +17 -0
  24. package/src/Utilities/utils/clamp.d.ts +5 -0
  25. package/src/Utilities/utils/clamp.js +7 -0
  26. package/src/Utilities/utils/cloneDeepWith.d.ts +9 -0
  27. package/src/Utilities/utils/cloneDeepWith.js +67 -0
  28. package/src/Utilities/utils/debounce.d.ts +20 -0
  29. package/src/Utilities/utils/debounce.js +121 -0
  30. package/src/Utilities/utils/flatten.d.ts +5 -0
  31. package/src/Utilities/utils/flatten.js +7 -0
  32. package/src/Utilities/utils/flattenDeep.d.ts +5 -0
  33. package/src/Utilities/utils/flattenDeep.js +7 -0
  34. package/src/Utilities/utils/get.d.ts +6 -0
  35. package/src/Utilities/utils/get.js +35 -0
  36. package/src/Utilities/utils/index.d.ts +22 -0
  37. package/src/Utilities/utils/index.js +22 -0
  38. package/src/Utilities/utils/isArray.d.ts +6 -0
  39. package/src/Utilities/utils/isArray.js +6 -0
  40. package/src/Utilities/utils/isEqual.d.ts +5 -0
  41. package/src/Utilities/utils/isEqual.js +124 -0
  42. package/src/Utilities/utils/isObject.d.ts +6 -0
  43. package/src/Utilities/utils/isObject.js +9 -0
  44. package/src/Utilities/utils/isPlainObject.d.ts +6 -0
  45. package/src/Utilities/utils/isPlainObject.js +17 -0
  46. package/src/Utilities/utils/kebabCase.d.ts +5 -0
  47. package/src/Utilities/utils/kebabCase.js +8 -0
  48. package/src/Utilities/utils/merge.d.ts +11 -0
  49. package/src/Utilities/utils/merge.js +40 -0
  50. package/src/Utilities/utils/mergeWith.d.ts +7 -0
  51. package/src/Utilities/utils/mergeWith.js +46 -0
  52. package/src/Utilities/utils/orderBy.d.ts +8 -0
  53. package/src/Utilities/utils/orderBy.js +30 -0
  54. package/src/Utilities/utils/parseInt.d.ts +6 -0
  55. package/src/Utilities/utils/parseInt.js +9 -0
  56. package/src/Utilities/utils/sentenceCase.d.ts +6 -0
  57. package/src/Utilities/utils/sentenceCase.js +15 -0
  58. package/src/Utilities/utils/startCase.d.ts +5 -0
  59. package/src/Utilities/utils/startCase.js +11 -0
  60. package/src/Utilities/utils/throttle.d.ts +17 -0
  61. package/src/Utilities/utils/throttle.js +19 -0
  62. package/src/Utilities/utils/toNumber.d.ts +5 -0
  63. package/src/Utilities/utils/toNumber.js +39 -0
  64. package/src/Utilities/utils/uniq.d.ts +7 -0
  65. package/src/Utilities/utils/uniq.js +9 -0
  66. package/src/Utilities/utils/uniqBy.d.ts +8 -0
  67. package/src/Utilities/utils/uniqBy.js +22 -0
  68. package/src/Utilities/utils/words.d.ts +7 -0
  69. package/src/Utilities/utils/words.js +10 -0
  70. package/src/Utilities/weightedAverage.js +1 -1
  71. package/src/View/AdaptableComputedCSSVarsContext.js +1 -1
  72. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +1 -1
  73. package/src/View/Alert/Wizard/AlertButtonsEditor.js +1 -1
  74. package/src/View/Charting/ChartingWizard/AgChargingWizard/PreviewChartSection.js +1 -1
  75. package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +1 -1
  76. package/src/View/Components/ColumnFilter/components/ColumnFilterInputList.js +1 -1
  77. package/src/View/Components/ColumnFilter/components/FloatingFilterInputList.js +1 -1
  78. package/src/View/Components/RangesComponent.js +1 -1
  79. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -1
  80. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
  81. package/src/View/Dashboard/CustomDashboardButton.js +1 -1
  82. package/src/View/Dashboard/Dashboard.js +1 -1
  83. package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +1 -1
  84. package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
  85. package/src/View/Filter/FilterViewPanel.d.ts +1 -1
  86. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +2 -2
  87. package/src/View/GridFilter/GridFilterViewPanel.js +3 -3
  88. package/src/View/Layout/LayoutViewPanel.js +1 -1
  89. package/src/View/Note/NoteEditor.js +1 -1
  90. package/src/View/QuickSearch/useQuickSearchDebounced.js +1 -1
  91. package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
  92. package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
  93. package/src/View/Theme/ThemeEditor.js +1 -1
  94. package/src/View/Theme/ThemeField.js +1 -1
  95. package/src/View/Wizard/OnePageAdaptableWizard.js +1 -1
  96. package/src/agGrid/AdaptableAgGrid.js +2 -2
  97. package/src/agGrid/AgGridColumnAdapter.js +2 -2
  98. package/src/agGrid/cellRenderers/PercentBarRenderer.js +1 -1
  99. package/src/components/ColorPicker/ColorPicker.js +1 -1
  100. package/src/components/DropdownButton/renderItem.js +1 -1
  101. package/src/components/FormLayout/index.js +1 -1
  102. package/src/components/OverlayTrigger/index.js +1 -1
  103. package/src/env.js +2 -2
  104. package/src/layout-manager/src/isLayoutEqual.js +1 -1
  105. package/src/migration/VersionUpgrade22.js +1 -0
  106. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -19,7 +19,7 @@ export declare class RowSummaryService {
19
19
  *
20
20
  * @param colId optional to evaluate only one column
21
21
  */
22
- _throttledEvaluateRowSummary: import("lodash").DebouncedFuncLeading<(reason?: {
22
+ _throttledEvaluateRowSummary: import("../utils/debounce").DebouncedFunction<(reason?: {
23
23
  columnIds: string[];
24
24
  }) => void>;
25
25
  private evaluateRowSummary;
@@ -4,8 +4,8 @@ import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
4
4
  import Helper from '../Helpers/Helper';
5
5
  import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
6
6
  import { isObjectEmpty } from '../Extensions/ObjectExtensions';
7
- import throttle from 'lodash/throttle';
8
- import isEqual from 'lodash/isEqual';
7
+ import throttle from '../utils/throttle';
8
+ import isEqual from '../utils/isEqual';
9
9
  /**
10
10
  * The logic is extracted here to make it easier to follow
11
11
  */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Creates an array of elements split into groups the length of size.
3
+ * If array can't be split evenly, the final chunk will be the remaining elements.
4
+ * Drop-in replacement for lodash/chunk.
5
+ */
6
+ export default function chunk<T>(array: T[], size?: number): T[][];
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Creates an array of elements split into groups the length of size.
3
+ * If array can't be split evenly, the final chunk will be the remaining elements.
4
+ * Drop-in replacement for lodash/chunk.
5
+ */
6
+ export default function chunk(array, size = 1) {
7
+ const length = array.length;
8
+ if (!length || !(size >= 1)) {
9
+ return [];
10
+ }
11
+ const chunkSize = Math.floor(size);
12
+ const result = [];
13
+ for (let i = 0; i < length; i += chunkSize) {
14
+ result.push(array.slice(i, i + chunkSize));
15
+ }
16
+ return result;
17
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Clamps number within the inclusive lower and upper bounds.
3
+ * Drop-in replacement for lodash/clamp.
4
+ */
5
+ export default function clamp(number: number, lower: number, upper: number): number;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Clamps number within the inclusive lower and upper bounds.
3
+ * Drop-in replacement for lodash/clamp.
4
+ */
5
+ export default function clamp(number, lower, upper) {
6
+ return Math.min(Math.max(number, lower), upper);
7
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This method is like `cloneDeep` except that it accepts customizer which
3
+ * is invoked to produce the cloned value. If customizer returns undefined,
4
+ * cloning is handled by the method instead.
5
+ * Drop-in replacement for lodash/cloneDeepWith.
6
+ */
7
+ type CloneCustomizer = (value: any) => any;
8
+ export default function cloneDeepWith<T>(value: T, customizer: CloneCustomizer): T;
9
+ export {};
@@ -0,0 +1,67 @@
1
+ /**
2
+ * This method is like `cloneDeep` except that it accepts customizer which
3
+ * is invoked to produce the cloned value. If customizer returns undefined,
4
+ * cloning is handled by the method instead.
5
+ * Drop-in replacement for lodash/cloneDeepWith.
6
+ */
7
+ function baseCloneDeep(value, customizer, seen) {
8
+ // Invoke customizer first
9
+ const customResult = customizer(value);
10
+ if (customResult !== undefined) {
11
+ return customResult;
12
+ }
13
+ // Primitives
14
+ if (value === null || typeof value !== 'object') {
15
+ return value;
16
+ }
17
+ // Circular reference detection
18
+ if (seen.has(value)) {
19
+ return seen.get(value);
20
+ }
21
+ // Date
22
+ if (value instanceof Date) {
23
+ return new Date(value.getTime());
24
+ }
25
+ // RegExp
26
+ if (value instanceof RegExp) {
27
+ return new RegExp(value.source, value.flags);
28
+ }
29
+ // Map
30
+ if (value instanceof Map) {
31
+ const cloned = new Map();
32
+ seen.set(value, cloned);
33
+ value.forEach((v, k) => {
34
+ cloned.set(baseCloneDeep(k, customizer, seen), baseCloneDeep(v, customizer, seen));
35
+ });
36
+ return cloned;
37
+ }
38
+ // Set
39
+ if (value instanceof Set) {
40
+ const cloned = new Set();
41
+ seen.set(value, cloned);
42
+ value.forEach((v) => {
43
+ cloned.add(baseCloneDeep(v, customizer, seen));
44
+ });
45
+ return cloned;
46
+ }
47
+ // Arrays
48
+ if (Array.isArray(value)) {
49
+ const cloned = [];
50
+ seen.set(value, cloned);
51
+ for (let i = 0; i < value.length; i++) {
52
+ cloned[i] = baseCloneDeep(value[i], customizer, seen);
53
+ }
54
+ return cloned;
55
+ }
56
+ // Plain objects and others
57
+ const cloned = Object.create(Object.getPrototypeOf(value));
58
+ seen.set(value, cloned);
59
+ const keys = Object.keys(value);
60
+ for (const key of keys) {
61
+ cloned[key] = baseCloneDeep(value[key], customizer, seen);
62
+ }
63
+ return cloned;
64
+ }
65
+ export default function cloneDeepWith(value, customizer) {
66
+ return baseCloneDeep(value, customizer, new Map());
67
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Creates a debounced function that delays invoking func until after wait
3
+ * milliseconds have elapsed since the last time the debounced function was
4
+ * invoked. The debounced function comes with a cancel method to cancel
5
+ * delayed func invocations and a flush method to immediately invoke them.
6
+ *
7
+ * Supports options: { leading, trailing, maxWait }
8
+ * Drop-in replacement for lodash/debounce.
9
+ */
10
+ export interface DebounceOptions {
11
+ leading?: boolean;
12
+ trailing?: boolean;
13
+ maxWait?: number;
14
+ }
15
+ export interface DebouncedFunction<T extends (...args: any[]) => any> {
16
+ (...args: Parameters<T>): ReturnType<T> | undefined;
17
+ cancel(): void;
18
+ flush(): ReturnType<T> | undefined;
19
+ }
20
+ export default function debounce<T extends (...args: any[]) => any>(func: T, wait?: number, options?: DebounceOptions): DebouncedFunction<T>;
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Creates a debounced function that delays invoking func until after wait
3
+ * milliseconds have elapsed since the last time the debounced function was
4
+ * invoked. The debounced function comes with a cancel method to cancel
5
+ * delayed func invocations and a flush method to immediately invoke them.
6
+ *
7
+ * Supports options: { leading, trailing, maxWait }
8
+ * Drop-in replacement for lodash/debounce.
9
+ */
10
+ export default function debounce(func, wait = 0, options) {
11
+ let lastArgs;
12
+ let lastThis;
13
+ let result;
14
+ let timerId;
15
+ let lastCallTime;
16
+ let lastInvokeTime = 0;
17
+ const leading = options?.leading ?? false;
18
+ const trailing = options?.trailing ?? true;
19
+ const maxWait = options?.maxWait;
20
+ const hasMaxWait = maxWait !== undefined;
21
+ const maxing = hasMaxWait;
22
+ function invokeFunc(time) {
23
+ const args = lastArgs;
24
+ const thisArg = lastThis;
25
+ lastArgs = undefined;
26
+ lastThis = undefined;
27
+ lastInvokeTime = time;
28
+ result = func.apply(thisArg, args);
29
+ return result;
30
+ }
31
+ function startTimer(pendingFunc, waitMs) {
32
+ timerId = setTimeout(pendingFunc, waitMs);
33
+ }
34
+ function cancelTimer() {
35
+ if (timerId !== undefined) {
36
+ clearTimeout(timerId);
37
+ }
38
+ timerId = undefined;
39
+ }
40
+ function remainingWait(time) {
41
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
42
+ const timeSinceLastInvoke = time - lastInvokeTime;
43
+ const timeWaiting = wait - timeSinceLastCall;
44
+ return maxing
45
+ ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke)
46
+ : timeWaiting;
47
+ }
48
+ function shouldInvoke(time) {
49
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
50
+ const timeSinceLastInvoke = time - lastInvokeTime;
51
+ return (lastCallTime === undefined ||
52
+ timeSinceLastCall >= wait ||
53
+ timeSinceLastCall < 0 ||
54
+ (maxing && timeSinceLastInvoke >= maxWait));
55
+ }
56
+ function timerExpired() {
57
+ const time = Date.now();
58
+ if (shouldInvoke(time)) {
59
+ trailingEdge(time);
60
+ return;
61
+ }
62
+ // Restart the timer
63
+ startTimer(timerExpired, remainingWait(time));
64
+ }
65
+ function trailingEdge(time) {
66
+ timerId = undefined;
67
+ if (trailing && lastArgs) {
68
+ invokeFunc(time);
69
+ }
70
+ else {
71
+ lastArgs = undefined;
72
+ lastThis = undefined;
73
+ }
74
+ }
75
+ function leadingEdge(time) {
76
+ lastInvokeTime = time;
77
+ startTimer(timerExpired, wait);
78
+ if (leading) {
79
+ invokeFunc(time);
80
+ }
81
+ }
82
+ function debounced(...args) {
83
+ const time = Date.now();
84
+ const isInvoking = shouldInvoke(time);
85
+ lastArgs = args;
86
+ lastThis = this;
87
+ lastCallTime = time;
88
+ if (isInvoking) {
89
+ if (timerId === undefined) {
90
+ leadingEdge(time);
91
+ return result;
92
+ }
93
+ if (maxing) {
94
+ // Handle invocations in a tight loop with maxWait
95
+ cancelTimer();
96
+ startTimer(timerExpired, wait);
97
+ invokeFunc(time);
98
+ return result;
99
+ }
100
+ }
101
+ if (timerId === undefined) {
102
+ startTimer(timerExpired, wait);
103
+ }
104
+ return result;
105
+ }
106
+ debounced.cancel = function cancel() {
107
+ cancelTimer();
108
+ lastInvokeTime = 0;
109
+ lastArgs = undefined;
110
+ lastCallTime = undefined;
111
+ lastThis = undefined;
112
+ };
113
+ debounced.flush = function flush() {
114
+ if (timerId === undefined) {
115
+ return result;
116
+ }
117
+ trailingEdge(Date.now());
118
+ return result;
119
+ };
120
+ return debounced;
121
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Flattens array a single level deep.
3
+ * Drop-in replacement for lodash/flatten.
4
+ */
5
+ export default function flatten<T>(array: (T | T[])[]): T[];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Flattens array a single level deep.
3
+ * Drop-in replacement for lodash/flatten.
4
+ */
5
+ export default function flatten(array) {
6
+ return array.flat();
7
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Recursively flattens array.
3
+ * Drop-in replacement for lodash/flattenDeep.
4
+ */
5
+ export default function flattenDeep<T>(array: any[]): T[];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Recursively flattens array.
3
+ * Drop-in replacement for lodash/flattenDeep.
4
+ */
5
+ export default function flattenDeep(array) {
6
+ return array.flat(Infinity);
7
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Gets the value at path of object. If the resolved value is undefined,
3
+ * the defaultValue is returned in its place.
4
+ * Drop-in replacement for lodash/get.
5
+ */
6
+ export default function get(object: any, path: string | string[], defaultValue?: any): any;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Gets the value at path of object. If the resolved value is undefined,
3
+ * the defaultValue is returned in its place.
4
+ * Drop-in replacement for lodash/get.
5
+ */
6
+ const rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
7
+ function toPath(path) {
8
+ if (Array.isArray(path)) {
9
+ return path;
10
+ }
11
+ const result = [];
12
+ const str = String(path);
13
+ str.replace(rePropName, (match, number, quote, subString) => {
14
+ result.push(quote ? subString.replace(/\\(\\)?/g, '$1') : number || match);
15
+ return match;
16
+ });
17
+ return result;
18
+ }
19
+ export default function get(object, path, defaultValue) {
20
+ if (typeof path === 'string' && path === '') {
21
+ return defaultValue;
22
+ }
23
+ const keys = toPath(path);
24
+ if (keys.length === 0) {
25
+ return defaultValue;
26
+ }
27
+ let result = object;
28
+ for (const key of keys) {
29
+ if (result == null) {
30
+ return defaultValue;
31
+ }
32
+ result = result[key];
33
+ }
34
+ return result === undefined ? defaultValue : result;
35
+ }
@@ -0,0 +1,22 @@
1
+ export { default as chunk } from './chunk';
2
+ export { default as clamp } from './clamp';
3
+ export { default as cloneDeepWith } from './cloneDeepWith';
4
+ export { default as debounce } from './debounce';
5
+ export { default as flatten } from './flatten';
6
+ export { default as flattenDeep } from './flattenDeep';
7
+ export { default as get } from './get';
8
+ export { default as isArray } from './isArray';
9
+ export { default as isEqual } from './isEqual';
10
+ export { default as isObject } from './isObject';
11
+ export { default as isPlainObject } from './isPlainObject';
12
+ export { default as kebabCase } from './kebabCase';
13
+ export { default as merge } from './merge';
14
+ export { default as mergeWith } from './mergeWith';
15
+ export { default as orderBy } from './orderBy';
16
+ export { default as parseInt } from './parseInt';
17
+ export { default as sentenceCase } from './sentenceCase';
18
+ export { default as startCase } from './startCase';
19
+ export { default as throttle } from './throttle';
20
+ export { default as toNumber } from './toNumber';
21
+ export { default as uniq } from './uniq';
22
+ export { default as uniqBy } from './uniqBy';
@@ -0,0 +1,22 @@
1
+ export { default as chunk } from './chunk';
2
+ export { default as clamp } from './clamp';
3
+ export { default as cloneDeepWith } from './cloneDeepWith';
4
+ export { default as debounce } from './debounce';
5
+ export { default as flatten } from './flatten';
6
+ export { default as flattenDeep } from './flattenDeep';
7
+ export { default as get } from './get';
8
+ export { default as isArray } from './isArray';
9
+ export { default as isEqual } from './isEqual';
10
+ export { default as isObject } from './isObject';
11
+ export { default as isPlainObject } from './isPlainObject';
12
+ export { default as kebabCase } from './kebabCase';
13
+ export { default as merge } from './merge';
14
+ export { default as mergeWith } from './mergeWith';
15
+ export { default as orderBy } from './orderBy';
16
+ export { default as parseInt } from './parseInt';
17
+ export { default as sentenceCase } from './sentenceCase';
18
+ export { default as startCase } from './startCase';
19
+ export { default as throttle } from './throttle';
20
+ export { default as toNumber } from './toNumber';
21
+ export { default as uniq } from './uniq';
22
+ export { default as uniqBy } from './uniqBy';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if value is classified as an Array object.
3
+ * Drop-in replacement for lodash/isArray.
4
+ */
5
+ declare const isArray: (value: any) => value is any[];
6
+ export default isArray;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if value is classified as an Array object.
3
+ * Drop-in replacement for lodash/isArray.
4
+ */
5
+ const isArray = Array.isArray;
6
+ export default isArray;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Performs a deep comparison between two values to determine if they are equivalent.
3
+ * Drop-in replacement for lodash/isEqual.
4
+ */
5
+ export default function isEqual(value: any, other: any): boolean;
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Performs a deep comparison between two values to determine if they are equivalent.
3
+ * Drop-in replacement for lodash/isEqual.
4
+ */
5
+ function baseIsEqual(a, b, seen) {
6
+ // Identical references or primitives
7
+ if (a === b) {
8
+ return true;
9
+ }
10
+ // NaN check
11
+ if (a !== a && b !== b) {
12
+ return true;
13
+ }
14
+ // Null/undefined/primitive mismatch
15
+ if (a == null || b == null) {
16
+ return false;
17
+ }
18
+ const typeA = typeof a;
19
+ const typeB = typeof b;
20
+ if (typeA !== typeB) {
21
+ return false;
22
+ }
23
+ if (typeA !== 'object') {
24
+ return false;
25
+ }
26
+ // Date
27
+ if (a instanceof Date && b instanceof Date) {
28
+ return a.getTime() === b.getTime();
29
+ }
30
+ // RegExp
31
+ if (a instanceof RegExp && b instanceof RegExp) {
32
+ return a.source === b.source && a.flags === b.flags;
33
+ }
34
+ // One is Date/RegExp but the other is not
35
+ if (a instanceof Date !== b instanceof Date) {
36
+ return false;
37
+ }
38
+ if (a instanceof RegExp !== b instanceof RegExp) {
39
+ return false;
40
+ }
41
+ // Circular reference detection
42
+ if (seen.has(a)) {
43
+ return seen.get(a) === b;
44
+ }
45
+ seen.set(a, b);
46
+ // Arrays
47
+ if (Array.isArray(a)) {
48
+ if (!Array.isArray(b) || a.length !== b.length) {
49
+ return false;
50
+ }
51
+ for (let i = 0; i < a.length; i++) {
52
+ if (!baseIsEqual(a[i], b[i], seen)) {
53
+ return false;
54
+ }
55
+ }
56
+ return true;
57
+ }
58
+ if (Array.isArray(b)) {
59
+ return false;
60
+ }
61
+ // Map
62
+ if (a instanceof Map && b instanceof Map) {
63
+ if (a.size !== b.size) {
64
+ return false;
65
+ }
66
+ for (const [key, val] of a) {
67
+ if (!b.has(key) || !baseIsEqual(val, b.get(key), seen)) {
68
+ return false;
69
+ }
70
+ }
71
+ return true;
72
+ }
73
+ // Set (unordered deep comparison, matching lodash behavior)
74
+ if (a instanceof Set && b instanceof Set) {
75
+ if (a.size !== b.size) {
76
+ return false;
77
+ }
78
+ for (const valA of a) {
79
+ let found = false;
80
+ for (const valB of b) {
81
+ if (baseIsEqual(valA, valB, new Map(seen))) {
82
+ found = true;
83
+ break;
84
+ }
85
+ }
86
+ if (!found) {
87
+ return false;
88
+ }
89
+ }
90
+ return true;
91
+ }
92
+ // ArrayBuffer / TypedArray
93
+ if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
94
+ const viewA = a;
95
+ const viewB = b;
96
+ if (viewA.length !== viewB.length) {
97
+ return false;
98
+ }
99
+ for (let i = 0; i < viewA.length; i++) {
100
+ if (viewA[i] !== viewB[i]) {
101
+ return false;
102
+ }
103
+ }
104
+ return true;
105
+ }
106
+ // Plain objects
107
+ const keysA = Object.keys(a);
108
+ const keysB = Object.keys(b);
109
+ if (keysA.length !== keysB.length) {
110
+ return false;
111
+ }
112
+ for (const key of keysA) {
113
+ if (!Object.prototype.hasOwnProperty.call(b, key)) {
114
+ return false;
115
+ }
116
+ if (!baseIsEqual(a[key], b[key], seen)) {
117
+ return false;
118
+ }
119
+ }
120
+ return true;
121
+ }
122
+ export default function isEqual(value, other) {
123
+ return baseIsEqual(value, other, new Map());
124
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if value is the language type of Object.
3
+ * (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
4
+ * Drop-in replacement for lodash/isObject.
5
+ */
6
+ export default function isObject(value: any): value is object;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Checks if value is the language type of Object.
3
+ * (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
4
+ * Drop-in replacement for lodash/isObject.
5
+ */
6
+ export default function isObject(value) {
7
+ const type = typeof value;
8
+ return value != null && (type === 'object' || type === 'function');
9
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if value is a plain object, that is, an object created by the
3
+ * Object constructor or one with a [[Prototype]] of null.
4
+ * Drop-in replacement for lodash/isPlainObject.
5
+ */
6
+ export default function isPlainObject(value: any): value is Record<string, any>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Checks if value is a plain object, that is, an object created by the
3
+ * Object constructor or one with a [[Prototype]] of null.
4
+ * Drop-in replacement for lodash/isPlainObject.
5
+ */
6
+ export default function isPlainObject(value) {
7
+ if (value === null || value === undefined || typeof value !== 'object') {
8
+ return false;
9
+ }
10
+ const proto = Object.getPrototypeOf(value);
11
+ // Object.create(null)
12
+ if (proto === null) {
13
+ return true;
14
+ }
15
+ // Normal plain objects
16
+ return proto === Object.prototype;
17
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Converts string to kebab-case.
3
+ * Drop-in replacement for lodash/kebabCase.
4
+ */
5
+ export default function kebabCase(string: string): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts string to kebab-case.
3
+ * Drop-in replacement for lodash/kebabCase.
4
+ */
5
+ import words from './words';
6
+ export default function kebabCase(string) {
7
+ return words(string).map((w) => w.toLowerCase()).join('-');
8
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Recursively merges own enumerable string keyed properties of source objects into
3
+ * the destination object. Source properties that resolve to undefined are skipped if
4
+ * a destination value exists. Array and plain object properties are merged recursively.
5
+ * Other objects and value types are overridden by assignment.
6
+ * Drop-in replacement for lodash/merge.
7
+ */
8
+ export default function merge<TObject, TSource1>(object: TObject, source1: TSource1): TObject & TSource1;
9
+ export default function merge<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): TObject & TSource1 & TSource2;
10
+ export default function merge<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TObject & TSource1 & TSource2 & TSource3;
11
+ export default function merge(target: any, ...sources: any[]): any;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Recursively merges own enumerable string keyed properties of source objects into
3
+ * the destination object. Source properties that resolve to undefined are skipped if
4
+ * a destination value exists. Array and plain object properties are merged recursively.
5
+ * Other objects and value types are overridden by assignment.
6
+ * Drop-in replacement for lodash/merge.
7
+ */
8
+ import isPlainObject from './isPlainObject';
9
+ function baseMerge(target, source) {
10
+ if (source == null) {
11
+ return target;
12
+ }
13
+ const keys = Object.keys(source);
14
+ for (const key of keys) {
15
+ const srcValue = source[key];
16
+ const tgtValue = target[key];
17
+ if (Array.isArray(srcValue)) {
18
+ if (!Array.isArray(tgtValue)) {
19
+ target[key] = [];
20
+ }
21
+ baseMerge(target[key], srcValue);
22
+ }
23
+ else if (isPlainObject(srcValue)) {
24
+ if (!isPlainObject(tgtValue)) {
25
+ target[key] = {};
26
+ }
27
+ baseMerge(target[key], srcValue);
28
+ }
29
+ else if (srcValue !== undefined) {
30
+ target[key] = srcValue;
31
+ }
32
+ }
33
+ return target;
34
+ }
35
+ export default function merge(target, ...sources) {
36
+ for (const source of sources) {
37
+ baseMerge(target, source);
38
+ }
39
+ return target;
40
+ }