@mapomodule/utils 1.0.0-alpha.30 → 1.0.0-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
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
+ # [1.0.0-alpha.40](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-12-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * rewritten and more precise diffObjs function ([3e79775](https://github.com/lotrekagency/mapo/commit/3e797756d0dc48142febcdb806390552ea522b30))
12
+
13
+
14
+ ### Features
15
+
16
+ * style scrollbars ([48e4c7b](https://github.com/lotrekagency/mapo/commit/48e4c7b047a1062464d823ddeebdc60b96ea11a8))
17
+
18
+
19
+
20
+
21
+
22
+ # [1.0.0-alpha.34](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-11-11)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * fix draggable dialogues ([aeaa009](https://github.com/lotrekagency/mapo/commit/aeaa009cb30e4d13df1288d3996742d529713ffc))
28
+
29
+
30
+
31
+
32
+
6
33
  # [1.0.0-alpha.30](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-09-13)
7
34
 
8
35
 
@@ -0,0 +1,12 @@
1
+ function setScrollbarTrackColor(dark) {
2
+ document
3
+ ?.querySelector(":root")
4
+ .style.setProperty(
5
+ "--v-scrollbar-track-color",
6
+ dark ? "#1E1E1E" : "#f5f5f5"
7
+ );
8
+ }
9
+
10
+ module.exports = {
11
+ setScrollbarTrackColor,
12
+ };
@@ -57,7 +57,7 @@ function findPropPaths(obj, predicate) {
57
57
  const path = [];
58
58
  const results = [];
59
59
  if (!obj && (typeof obj !== "object" || Array.isArray(obj))) {
60
- throw new TypeError("First argument of finPropPath is not the correct type Object");
60
+ throw new TypeError("First argument of findPropPaths is not the correct type Object");
61
61
  }
62
62
  if (typeof predicate !== "function") {
63
63
  throw new TypeError("Predicate is not a function");
@@ -83,17 +83,22 @@ function findPropPaths(obj, predicate) {
83
83
  return results;
84
84
  }
85
85
 
86
- function diffObjs(obj1, obj2) {
87
- const a = deepClone(obj1)
88
- const b = deepClone(obj2)
86
+ function diffObjs(obj1, obj2, clone=deepClone) {
87
+ const a = obj1 && clone(obj1) || obj2 && obj2.__proto__.constructor();
88
+ const b = obj2 && clone(obj2) || obj1 && obj1.__proto__.constructor();
89
89
  for (const i in b) {
90
90
  if (JSON.stringify(a[i]) === JSON.stringify(b[i])) {
91
- delete b[i]
92
- } else if (!Array.isArray(b[i]) && typeof b[i] == 'object') {
93
- b[i] = diffObjs(a[i], b[i])
94
- }
91
+ delete b[i];
92
+ } else if (b[i] && !Array.isArray(b[i]) && typeof b[i] == 'object') {
93
+ const diff = diffObjs(a[i], b[i], (v) => v);
94
+ if (diff !== undefined){
95
+ b[i] = diff;
96
+ } else {
97
+ delete b[i];
98
+ };
99
+ };
95
100
  }
96
- return b;
101
+ return b && Object.keys(b).length ? b : undefined;
97
102
  }
98
103
 
99
104
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/utils",
3
- "version": "1.0.0-alpha.30",
3
+ "version": "1.0.0-alpha.40",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Provides a set of utils for the project.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
@@ -9,5 +9,5 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "gitHead": "f648aac2fc02b28e687f4631cfbaf4cde6999a8b"
12
+ "gitHead": "918d8d3ed9a6edc9be25e082f9917866e8c73c57"
13
13
  }
@@ -2,7 +2,7 @@ module.exports = function () {
2
2
  const d = {};
3
3
  document.addEventListener("mousedown", e => {
4
4
  const closestDialog = e.target.closest(".v-dialog.v-dialog--active");
5
- if (e.button === 0 && closestDialog != null && e.target.classList.contains("v-card__title")) {
5
+ if (e.button === 0 && closestDialog != null && closestDialog.querySelector(".v-card__title")?.contains(e.target)) {
6
6
  d.el = closestDialog;
7
7
  d.mouseStartX = e.clientX;
8
8
  d.mouseStartY = e.clientY;