pkgviz 0.7.2 → 0.7.3

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 (90) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +1 -1
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/cache/webpack/client-production/7.pack +0 -0
  5. package/.next/cache/webpack/client-production/8.pack +0 -0
  6. package/.next/cache/webpack/client-production/index.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  8. package/.next/cache/webpack/server-production/11.pack +0 -0
  9. package/.next/cache/webpack/server-production/12.pack +0 -0
  10. package/.next/cache/webpack/server-production/13.pack +0 -0
  11. package/.next/cache/webpack/server-production/index.pack +0 -0
  12. package/.next/cache/webpack/server-production/index.pack.old +0 -0
  13. package/.next/server/app/_not-found.html +1 -1
  14. package/.next/server/app/_not-found.rsc +1 -1
  15. package/.next/server/app/favicon.ico/route.js +1 -1
  16. package/.next/server/app/index.html +1 -1
  17. package/.next/server/app/index.rsc +1 -1
  18. package/.next/server/app-paths-manifest.json +1 -1
  19. package/.next/server/chunks/610.js +1 -1
  20. package/.next/server/pages/404.html +1 -1
  21. package/.next/server/pages/500.html +1 -1
  22. package/.next/trace +2 -2
  23. package/package.json +2 -3
  24. package/src/app/actions/graph.actions.ts +25 -0
  25. package/src/app/favicon.ico +0 -0
  26. package/src/app/globals.css +77 -0
  27. package/src/app/layout.tsx +30 -0
  28. package/src/app/page.tsx +5 -0
  29. package/src/app/utils/buildGraph.ts +119 -0
  30. package/src/app/utils/getParsedFileStructure.ts +225 -0
  31. package/src/app/utils/markCyclicPackages.ts +275 -0
  32. package/src/app/utils/parser/cpp/extractCppPackageFromImport.ts +18 -0
  33. package/src/app/utils/parser/cpp/parseCppFile.ts +150 -0
  34. package/src/app/utils/parser/delphi/extractPackageFromImport.ts +21 -0
  35. package/src/app/utils/parser/delphi/parseFile.ts +179 -0
  36. package/src/app/utils/parser/java/extractJavaPackageFromImport.ts +39 -0
  37. package/src/app/utils/parser/java/findEntryPoint.ts +24 -0
  38. package/src/app/utils/parser/java/getIntrinsicPackagesRecursive.ts +33 -0
  39. package/src/app/utils/parser/java/parseJavaFile.ts +114 -0
  40. package/src/app/utils/parser/kotlin/extractPackageFromImport.ts +19 -0
  41. package/src/app/utils/parser/kotlin/parseFile.ts +147 -0
  42. package/src/app/utils/parser/python/extractPythonPackageFromImport.ts +18 -0
  43. package/src/app/utils/parser/python/parseFile.ts +171 -0
  44. package/src/app/utils/parser/typescript/extractTypeScriptPackageFromImport.ts +18 -0
  45. package/src/app/utils/parser/typescript/parseFile.ts +130 -0
  46. package/src/components/Breadcrumb.tsx +34 -0
  47. package/src/components/Cytoscape.tsx +23 -0
  48. package/src/components/Header.tsx +28 -0
  49. package/src/components/Loader.tsx +10 -0
  50. package/src/components/Setting.tsx +17 -0
  51. package/src/components/Settings.tsx +189 -0
  52. package/src/components/Switch.tsx +31 -0
  53. package/src/components/ThemeToggle.tsx +25 -0
  54. package/src/components/ZoomInput.tsx +94 -0
  55. package/src/components/useCytoscape.ts +343 -0
  56. package/src/contexts/SettingsContext.tsx +88 -0
  57. package/src/i18n/en.ts +27 -0
  58. package/src/i18n/i18n.ts +12 -0
  59. package/src/layouts/breadthfirst/layout.ts +30 -0
  60. package/src/layouts/breadthfirst/style.ts +8 -0
  61. package/src/layouts/circle/layout.ts +11 -0
  62. package/src/layouts/circle/style.ts +18 -0
  63. package/src/layouts/concentric/layout.ts +10 -0
  64. package/src/layouts/concentric/style.ts +16 -0
  65. package/src/layouts/constants.ts +17 -0
  66. package/src/layouts/elk/layout.ts +55 -0
  67. package/src/layouts/elk/style.ts +14 -0
  68. package/src/layouts/getLayoutStyle.ts +19 -0
  69. package/src/layouts/getWeightBuckets.ts +58 -0
  70. package/src/layouts/grid/layout.ts +11 -0
  71. package/src/layouts/grid/style.ts +20 -0
  72. package/src/layouts/index.ts +14 -0
  73. package/src/layouts/style.ts +191 -0
  74. package/src/screens/home/Home.tsx +48 -0
  75. package/src/shared/constants/index.ts +7 -0
  76. package/src/shared/types/index.ts +68 -0
  77. package/src/shared/utils/detectLanguage.ts +255 -0
  78. package/src/shared/utils/getJsonAsync.ts +13 -0
  79. package/src/shared/utils/getProjectName.ts +3 -0
  80. package/src/shared/utils/parseEnv.ts +91 -0
  81. package/src/shared/utils/parseProjectPath.ts +8 -0
  82. package/src/store/useLocalStorage.ts +29 -0
  83. package/src/utils/filter/filterByPackagePrefix.ts +23 -0
  84. package/src/utils/filter/filterEmptyPackages.ts +36 -0
  85. package/src/utils/filter/filterSubPackagesFromDepth.ts +170 -0
  86. package/src/utils/filter/filterVendorPackages.ts +17 -0
  87. package/src/utils/filter/toggleCompoundNodes.ts +40 -0
  88. package/src/utils/hasChildren.ts +7 -0
  89. /package/.next/static/{VVBfFRai9p1x3oVXujjYO → cGbLRcmdy7k8HGus5vhzm}/_buildManifest.js +0 -0
  90. /package/.next/static/{VVBfFRai9p1x3oVXujjYO → cGbLRcmdy7k8HGus5vhzm}/_ssgManifest.js +0 -0
@@ -0,0 +1,40 @@
1
+ import { ElementsDefinition } from 'cytoscape';
2
+
3
+ /**
4
+ * Toggles display of compound nodes ('parent' attribute) in the node
5
+ * @param elements - Cytoscape elements (nodes and edges)
6
+ * @param show - Whether to show compound nodes
7
+ * @param currentPackage - Current package path to adjust node names when showing compound nodes
8
+ * @returns Updated Cytoscape elements with compound nodes toggled
9
+ */
10
+ export function toggleCompoundNodes(
11
+ { nodes, edges }: ElementsDefinition,
12
+ show: boolean,
13
+ currentPackage: string
14
+ ): ElementsDefinition {
15
+ const updatedNodes = nodes.map(node => {
16
+ if (!node.data.idInactive) node.data.idInactive = node.data.id;
17
+ // ACTIVE Compound Nodes
18
+ if (show && node.data.parentInactive) {
19
+ node.data.parent = node.data.parentInactive;
20
+ node.data.parentInactive = undefined;
21
+ } else if (!show && node.data.parent) {
22
+ node.data.parentInactive = node.data.parent;
23
+ node.data.parent = undefined;
24
+ }
25
+ return node;
26
+ });
27
+
28
+ const labelledNodes = updatedNodes.map(node => {
29
+ if (show) {
30
+ node.data.name = node.data.idInactive.split('.').pop();
31
+ } else {
32
+ node.data.name = node.data.idInactive.slice(
33
+ currentPackage.length ? currentPackage.length + 1 : 0
34
+ );
35
+ }
36
+ return node;
37
+ });
38
+
39
+ return { nodes: labelledNodes, edges };
40
+ }
@@ -0,0 +1,7 @@
1
+ import type { NodeDataDefinition, NodeDefinition } from 'cytoscape';
2
+
3
+ /**
4
+ * Checks if a node (package) has children based on id prefix.
5
+ */
6
+ export const hasChildren = (node: NodeDefinition, nodes: NodeDataDefinition[]) =>
7
+ nodes.some(n => n.data.id?.startsWith(`${node.data.id}.`));