@sanity/hierarchical-document-list 1.0.0 → 1.1.0

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 (81) hide show
  1. package/.husky/commit-msg +4 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.idea/hierarchical-document-list.iml +11 -0
  4. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  5. package/.idea/misc.xml +6 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/prettier.xml +7 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/CHANGELOG.md +15 -0
  10. package/README.md +329 -297
  11. package/commitlint.config.js +3 -0
  12. package/lib/TreeDeskStructure.d.ts +8 -8
  13. package/lib/TreeDeskStructure.js +96 -96
  14. package/lib/TreeInputComponent.d.ts +19 -19
  15. package/lib/TreeInputComponent.js +50 -52
  16. package/lib/components/DeskWarning.d.ts +6 -6
  17. package/lib/components/DeskWarning.js +46 -46
  18. package/lib/components/DocumentInNode.d.ts +11 -11
  19. package/lib/components/DocumentInNode.js +81 -82
  20. package/lib/components/DocumentPreviewStatus.d.ts +7 -7
  21. package/lib/components/DocumentPreviewStatus.js +39 -39
  22. package/lib/components/NodeActions.d.ts +10 -10
  23. package/lib/components/NodeActions.js +61 -61
  24. package/lib/components/NodeContentRenderer.d.ts +8 -8
  25. package/lib/components/NodeContentRenderer.js +105 -105
  26. package/lib/components/PlaceholderDropzone.d.ts +9 -9
  27. package/lib/components/PlaceholderDropzone.js +30 -30
  28. package/lib/components/SuppressedDnDManager.d.ts +2 -0
  29. package/lib/components/SuppressedDnDManager.js +59 -0
  30. package/lib/components/TreeEditor.d.ts +12 -12
  31. package/lib/components/TreeEditor.js +74 -59
  32. package/lib/components/TreeEditorErrorBoundary.d.ts +16 -3
  33. package/lib/components/TreeEditorErrorBoundary.js +74 -59
  34. package/lib/components/TreeNodeRenderer.d.ts +3 -3
  35. package/lib/components/TreeNodeRenderer.js +59 -59
  36. package/lib/components/TreeNodeRendererScaffold.d.ts +4 -4
  37. package/lib/components/TreeNodeRendererScaffold.js +44 -44
  38. package/lib/createDeskHierarchy.d.ts +14 -14
  39. package/lib/createDeskHierarchy.js +84 -85
  40. package/lib/createHierarchicalSchemas.d.ts +98 -78
  41. package/lib/createHierarchicalSchemas.js +138 -138
  42. package/lib/hooks/useAllItems.d.ts +7 -7
  43. package/lib/hooks/useAllItems.js +119 -119
  44. package/lib/hooks/useLocalTree.d.ts +17 -17
  45. package/lib/hooks/useLocalTree.js +59 -59
  46. package/lib/hooks/useTreeOperations.d.ts +9 -9
  47. package/lib/hooks/useTreeOperations.js +39 -39
  48. package/lib/hooks/useTreeOperationsProvider.d.ts +14 -14
  49. package/lib/hooks/useTreeOperationsProvider.js +85 -85
  50. package/lib/index.d.ts +3 -3
  51. package/lib/index.js +12 -12
  52. package/lib/schemas/hierarchy.tree.d.ts +13 -13
  53. package/lib/schemas/hierarchy.tree.js +19 -19
  54. package/lib/types.d.ts +128 -0
  55. package/lib/types.js +2 -0
  56. package/lib/utils/flatDataToTree.d.ts +6 -6
  57. package/lib/utils/flatDataToTree.js +26 -26
  58. package/lib/utils/getAdjescentNodes.d.ts +12 -12
  59. package/lib/utils/getAdjescentNodes.js +19 -19
  60. package/lib/utils/getCommonTreeProps.d.ts +7 -7
  61. package/lib/utils/getCommonTreeProps.js +33 -33
  62. package/lib/utils/getTreeHeight.d.ts +3 -3
  63. package/lib/utils/getTreeHeight.js +11 -11
  64. package/lib/utils/gradientPatchAdapter.d.ts +4 -4
  65. package/lib/utils/gradientPatchAdapter.js +40 -42
  66. package/lib/utils/idUtils.d.ts +2 -2
  67. package/lib/utils/idUtils.js +13 -13
  68. package/lib/utils/injectNodeTypeInPatches.d.ts +12 -12
  69. package/lib/utils/injectNodeTypeInPatches.js +59 -58
  70. package/lib/utils/moveItemInArray.d.ts +5 -5
  71. package/lib/utils/moveItemInArray.js +26 -26
  72. package/lib/utils/throwError.d.ts +7 -7
  73. package/lib/utils/throwError.js +12 -12
  74. package/lib/utils/treeData.d.ts +18 -18
  75. package/lib/utils/treeData.js +118 -118
  76. package/lib/utils/treePatches.d.ts +15 -15
  77. package/lib/utils/treePatches.js +171 -171
  78. package/lint-staged.config.js +4 -0
  79. package/package.json +65 -55
  80. package/sanity.json +12 -12
  81. package/tsconfig.json +20 -20
package/package.json CHANGED
@@ -1,55 +1,65 @@
1
- {
2
- "name": "@sanity/hierarchical-document-list",
3
- "version": "1.0.0",
4
- "author": "Sanity <hello@sanity.io>",
5
- "license": "MIT",
6
- "main": "lib/index.js",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/sanity-io/hierarchical-document-list.git"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/sanity-io/hierarchical-document-list/issues"
13
- },
14
- "homepage": "https://github.com/sanity-io/hierarchical-document-list#readme",
15
- "scripts": {
16
- "dev": "tsc -w -d",
17
- "build": "tsc -d",
18
- "format": "prettier src -w",
19
- "lint": "eslint src"
20
- },
21
- "devDependencies": {
22
- "@sanity/base": ">= 2.25.0",
23
- "@sanity/color": "^2.1.6",
24
- "@sanity/desk-tool": ">= 2.25.0",
25
- "@sanity/form-builder": "^2.25.0",
26
- "@sanity/icons": ">= 1.2.0",
27
- "@sanity/ui": ">= 0.37.0",
28
- "@types/assert": "^1.5.6",
29
- "@types/react": "^17.0.38",
30
- "@types/react-dom": "^17.0.11",
31
- "@types/react-sortable-tree": "^0.3.14",
32
- "@types/styled-components": "^5.1.21",
33
- "@typescript-eslint/eslint-plugin": "^5.10.1",
34
- "@typescript-eslint/parser": "^5.10.1",
35
- "eslint": "^8.7.0",
36
- "eslint-config-prettier": "^8.3.0",
37
- "eslint-config-sanity": "^5.1.0",
38
- "prettier": "^2.5.1",
39
- "react": "^17.0.2",
40
- "react-dom": "^17.0.2",
41
- "styled-components": "^5.3.3",
42
- "typescript": "^4.5.5"
43
- },
44
- "dependencies": {
45
- "assert": "^2.0.0",
46
- "react-sortable-tree": "^2.8.0"
47
- },
48
- "peerDependencies": {
49
- "@sanity/base": ">= 2.25.0",
50
- "@sanity/desk-tool": ">= 2.25.0",
51
- "react": "^17.0.2",
52
- "react-dom": "^17.0.2",
53
- "styled-components": ">= 5.2.0"
54
- }
55
- }
1
+ {
2
+ "name": "@sanity/hierarchical-document-list",
3
+ "version": "1.1.0",
4
+ "author": "Sanity <hello@sanity.io>",
5
+ "license": "MIT",
6
+ "main": "lib/index.js",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/sanity-io/hierarchical-document-list.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/sanity-io/hierarchical-document-list/issues"
13
+ },
14
+ "homepage": "https://github.com/sanity-io/hierarchical-document-list#readme",
15
+ "scripts": {
16
+ "dev": "tsc -w -d",
17
+ "build": "tsc -d",
18
+ "format": "prettier src -w",
19
+ "lint": "eslint src",
20
+ "prepare": "npm run build && husky install",
21
+ "clean": "rimraf lib",
22
+ "release": "standard-version",
23
+ "prepublishOnly": "npm run clean && npm run lint && npm run build"
24
+ },
25
+ "devDependencies": {
26
+ "@commitlint/cli": "^16.2.3",
27
+ "@commitlint/config-conventional": "^16.2.1",
28
+ "@sanity/base": ">= 2.25.0",
29
+ "@sanity/color": "^2.1.6",
30
+ "@sanity/desk-tool": ">= 2.25.0",
31
+ "@sanity/form-builder": "^2.25.0",
32
+ "@sanity/icons": ">= 1.2.0",
33
+ "@sanity/ui": ">= 0.37.0",
34
+ "@types/assert": "^1.5.6",
35
+ "@types/react": "^17.0.38",
36
+ "@types/react-dom": "^17.0.11",
37
+ "@types/react-sortable-tree": "^0.3.14",
38
+ "@types/styled-components": "^5.1.21",
39
+ "@typescript-eslint/eslint-plugin": "^5.10.1",
40
+ "@typescript-eslint/parser": "^5.10.1",
41
+ "eslint": "^8.7.0",
42
+ "eslint-config-prettier": "^8.3.0",
43
+ "eslint-config-sanity": "^5.1.0",
44
+ "husky": "^7.0.4",
45
+ "lint-staged": "^12.3.7",
46
+ "prettier": "^2.5.1",
47
+ "react": "^17.0.2",
48
+ "react-dom": "^17.0.2",
49
+ "rimraf": "^3.0.2",
50
+ "standard-version": "^9.3.2",
51
+ "styled-components": "^5.3.3",
52
+ "typescript": "^4.5.5"
53
+ },
54
+ "dependencies": {
55
+ "assert": "^2.0.0",
56
+ "react-sortable-tree": "^2.8.0"
57
+ },
58
+ "peerDependencies": {
59
+ "@sanity/base": ">= 2.25.0",
60
+ "@sanity/desk-tool": ">= 2.25.0",
61
+ "react": "^17.0.2",
62
+ "react-dom": "^17.0.2",
63
+ "styled-components": ">= 5.2.0"
64
+ }
65
+ }
package/sanity.json CHANGED
@@ -1,12 +1,12 @@
1
- {
2
- "paths": {
3
- "source": "./src",
4
- "compiled": "./lib"
5
- },
6
- "parts": [
7
- {
8
- "implements": "part:@sanity/base/schema-type",
9
- "path": "schemas/hierarchy.tree.js"
10
- }
11
- ]
12
- }
1
+ {
2
+ "paths": {
3
+ "source": "./src",
4
+ "compiled": "./lib"
5
+ },
6
+ "parts": [
7
+ {
8
+ "implements": "part:@sanity/base/schema-type",
9
+ "path": "schemas/hierarchy.tree.js"
10
+ }
11
+ ]
12
+ }
package/tsconfig.json CHANGED
@@ -1,20 +1,20 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "useDefineForClassFields": true,
5
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
6
- "allowJs": false,
7
- "skipLibCheck": true,
8
- "esModuleInterop": true,
9
- "allowSyntheticDefaultImports": false,
10
- "strict": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "module": "CommonJS",
13
- "moduleResolution": "Node",
14
- "resolveJsonModule": true,
15
- "isolatedModules": true,
16
- "jsx": "react-jsx",
17
- "outDir": "lib"
18
- },
19
- "include": ["./src"]
20
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
6
+ "allowJs": false,
7
+ "skipLibCheck": true,
8
+ "esModuleInterop": true,
9
+ "allowSyntheticDefaultImports": false,
10
+ "strict": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "module": "CommonJS",
13
+ "moduleResolution": "Node",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "jsx": "react-jsx",
17
+ "outDir": "lib"
18
+ },
19
+ "include": ["./src"]
20
+ }