sanity-plugin-graph-view 1.0.7 → 1.0.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.
package/lib/tool/utils.js CHANGED
@@ -1,64 +1,50 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.sizeOf = sizeOf;
9
7
  exports.loadImage = loadImage;
8
+ exports.sizeOf = sizeOf;
10
9
  exports.sortBy = sortBy;
11
10
  exports.truncate = truncate;
12
-
13
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
-
15
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
16
-
17
13
  function sizeOf(value) {
18
14
  if (value == null) {
19
15
  return 0;
20
16
  }
21
-
22
17
  if ((0, _typeof2["default"])(value) === 'object') {
23
18
  return Object.entries(value).reduce(function (total, _ref) {
24
19
  var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
25
- k = _ref2[0],
26
- v = _ref2[1];
27
-
20
+ k = _ref2[0],
21
+ v = _ref2[1];
28
22
  return total + sizeOf(k) + sizeOf(v);
29
23
  }, 0);
30
24
  }
31
-
32
25
  if (Array.isArray(value)) {
33
26
  return Object.entries(value).reduce(function (total, v) {
34
27
  return total + sizeOf(v);
35
28
  }, 0);
36
29
  }
37
-
38
30
  if (typeof value === 'string') {
39
31
  return value.length;
40
32
  }
41
-
42
33
  return 1;
43
34
  }
44
-
45
35
  function loadImage(url, w, h) {
46
36
  return new Promise(function (resolve) {
47
37
  var img = new Image(w, h);
48
-
49
38
  img.onload = function () {
50
39
  resolve(img);
51
40
  };
52
-
53
41
  img.onerror = function (event) {
54
42
  console.log('Image error', event);
55
43
  resolve(null);
56
44
  };
57
-
58
45
  img.src = url;
59
46
  });
60
47
  }
61
-
62
48
  function sortBy(array, f) {
63
49
  return array.sort(function (a, b) {
64
50
  var va = f(a);
@@ -66,11 +52,9 @@ function sortBy(array, f) {
66
52
  return va < vb ? -1 : va > vb ? 1 : 0;
67
53
  });
68
54
  }
69
-
70
55
  function truncate(s, limit) {
71
56
  if (s.length > limit) {
72
57
  s = s.substring(0, limit) + '…';
73
58
  }
74
-
75
59
  return s;
76
60
  }
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "sanity-plugin-graph-view",
3
- "version": "1.0.7",
4
- "main": "package.json",
5
- "author": "Sanity.io <hello@sanity.io>",
3
+ "version": "1.0.8",
4
+ "homepage": "https://github.com/sanity-io/sanity-plugin-graph-view#readme",
5
+ "bugs": {
6
+ "url": "https://github.com/sanity-io/sanity-plugin-graph-view/issues"
7
+ },
6
8
  "license": "MIT",
9
+ "author": "Sanity.io <hello@sanity.io>",
10
+ "main": "package.json",
7
11
  "scripts": {
8
12
  "build": "babel src -d lib --copy-files",
9
13
  "lint": "eslint .",
10
14
  "prepublishOnly": "npm run build"
11
15
  },
16
+ "resolutions": {
17
+ "**/three": "0.119.1"
18
+ },
12
19
  "dependencies": {
13
20
  "@sanity/color": "^1.0.0",
14
21
  "bezier-easing": "^2.1.0",
@@ -25,7 +32,10 @@
25
32
  "@babel/preset-env": "^7.11.5",
26
33
  "@babel/preset-react": "^7.10.4",
27
34
  "@babel/runtime": "^7.11.2",
35
+ "@commitlint/cli": "^17.2.0",
36
+ "@commitlint/config-conventional": "^17.2.0",
28
37
  "@sanity/base": "1.150.9-review-changes.1024",
38
+ "@sanity/semantic-release-preset": "^2.0.2",
29
39
  "babel-eslint": "^10.1.0",
30
40
  "eslint": "^7.10.0",
31
41
  "eslint-config-prettier": "^6.12.0",
@@ -38,12 +48,5 @@
38
48
  "peerDependencies": {
39
49
  "@sanity/base": ">= 1.150.x",
40
50
  "@sanity/client": ">= 1.150.x"
41
- },
42
- "resolutions": {
43
- "**/three": "0.119.1"
44
- },
45
- "bugs": {
46
- "url": "https://github.com/sanity-io/sanity-plugin-graph-view/issues"
47
- },
48
- "homepage": "https://github.com/sanity-io/sanity-plugin-graph-view#readme"
51
+ }
49
52
  }
@@ -1,56 +0,0 @@
1
- @import 'part:@sanity/base/theme/variables-style';
2
-
3
- :root {
4
- --border-style: 1px solid rgba(0, 0, 0, 0.1);
5
- }
6
-
7
- .root {
8
- position: absolute;
9
- top: 0;
10
- left: 0;
11
- width: 100%;
12
- height: 100%;
13
- }
14
-
15
- .hoverNode {
16
- display: none;
17
- position: absolute;
18
- bottom: var(--large-padding);
19
- left: 50%;
20
- transform: translate3d(-50%, 0, 0);
21
- background: var(--component-bg);
22
- border-radius: var(--border-radius-medium);
23
- padding: var(--small-padding);
24
- z-index: 1000;
25
-
26
- @nest &:empty {
27
- display: none;
28
- }
29
- }
30
-
31
- .legend {
32
- color: var(--gray);
33
- position: absolute;
34
- top: var(--medium-padding);
35
- left: var(--medium-padding);
36
-
37
- > div {
38
- margin: 5px 0;
39
- }
40
- }
41
-
42
- .legend__row {
43
- display: flex;
44
-
45
- @nest .legend__row + & {
46
- margin-top: 0.25em;
47
- }
48
- }
49
-
50
- .legend__badge {
51
- width: 1.25em;
52
- height: 1.25em;
53
- background: currentColor;
54
- border-radius: 50%;
55
- margin-right: var(--extra-small-padding);
56
- }