@moxa/graph 3.0.0-beta.8 → 3.0.0-beta.9

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 (67) hide show
  1. package/README.md +27 -14
  2. package/assets/icon-sprite.svg +1 -1
  3. package/behaviors/drill-down/drill-down-manager.d.ts +55 -0
  4. package/behaviors/drill-down/drill-down-manager.d.ts.map +1 -0
  5. package/behaviors/drill-down/index.d.ts +71 -0
  6. package/behaviors/drill-down/index.d.ts.map +1 -0
  7. package/behaviors/drill-down/models/index.d.ts +7 -0
  8. package/behaviors/drill-down/models/index.d.ts.map +1 -0
  9. package/components/edge-arrow/transforms/index.d.ts.map +1 -1
  10. package/components/edge-line/index.d.ts.map +1 -1
  11. package/components/edge-polyline/index.d.ts.map +1 -1
  12. package/components/edge-quadratic/index.d.ts.map +1 -1
  13. package/components/group-device/index.d.ts +34 -0
  14. package/components/group-device/index.d.ts.map +1 -1
  15. package/components/group-device/models/index.d.ts +10 -1
  16. package/components/group-device/models/index.d.ts.map +1 -1
  17. package/components/group-device/transforms/index.d.ts.map +1 -1
  18. package/components/group-device/utils/style.d.ts.map +1 -1
  19. package/components/node-device/models/index.d.ts +1 -0
  20. package/components/node-device/models/index.d.ts.map +1 -1
  21. package/components/node-device/utils/style.d.ts.map +1 -1
  22. package/components/shared/transforms/edge-transform.d.ts.map +1 -1
  23. package/components/shared/transforms/group-transform.d.ts.map +1 -1
  24. package/components/shared/transforms/node-transform.d.ts.map +1 -1
  25. package/components/shared/utils/edge-utils/index.d.ts +1 -0
  26. package/components/shared/utils/edge-utils/index.d.ts.map +1 -1
  27. package/components/shared/utils/edge-utils/state-style.d.ts +24 -0
  28. package/components/shared/utils/edge-utils/state-style.d.ts.map +1 -0
  29. package/components/shared/utils/edge-utils/style.d.ts +19 -1
  30. package/components/shared/utils/edge-utils/style.d.ts.map +1 -1
  31. package/components/shared/utils/group-utils/drill-icon.d.ts +10 -0
  32. package/components/shared/utils/group-utils/drill-icon.d.ts.map +1 -0
  33. package/components/shared/utils/group-utils/index.d.ts +3 -0
  34. package/components/shared/utils/group-utils/index.d.ts.map +1 -0
  35. package/components/shared/utils/group-utils/label-background.d.ts +10 -0
  36. package/components/shared/utils/group-utils/label-background.d.ts.map +1 -0
  37. package/components/shared/utils/index.d.ts +1 -0
  38. package/components/shared/utils/index.d.ts.map +1 -1
  39. package/components/shared/utils/node-utils/index.d.ts +1 -0
  40. package/components/shared/utils/node-utils/index.d.ts.map +1 -1
  41. package/components/shared/utils/node-utils/label-background.d.ts.map +1 -1
  42. package/components/shared/utils/node-utils/state-styles.d.ts +63 -0
  43. package/components/shared/utils/node-utils/state-styles.d.ts.map +1 -0
  44. package/components/shared/utils/node-utils/theme.d.ts +1 -1
  45. package/components/shared/utils/node-utils/theme.d.ts.map +1 -1
  46. package/core/graph/graph.d.ts +27 -3
  47. package/core/graph/graph.d.ts.map +1 -1
  48. package/core/model/behavior.model.d.ts +6 -2
  49. package/core/model/behavior.model.d.ts.map +1 -1
  50. package/core/model/edge.model.d.ts +221 -0
  51. package/core/model/edge.model.d.ts.map +1 -1
  52. package/core/model/event.model.d.ts +7 -1
  53. package/core/model/event.model.d.ts.map +1 -1
  54. package/core/model/group.model.d.ts +1 -0
  55. package/core/model/group.model.d.ts.map +1 -1
  56. package/core/model/node.model.d.ts +98 -0
  57. package/core/model/node.model.d.ts.map +1 -1
  58. package/index.cjs +77 -77
  59. package/index.d.ts +1 -0
  60. package/index.d.ts.map +1 -1
  61. package/index.js +18732 -17997
  62. package/package.json +1 -1
  63. package/plugins/index.d.ts +9 -0
  64. package/plugins/index.d.ts.map +1 -0
  65. package/shared/transforms/behavior-transform.d.ts +1 -0
  66. package/shared/transforms/behavior-transform.d.ts.map +1 -1
  67. package/shared/transforms/plugin-transform.d.ts.map +1 -1
package/README.md CHANGED
@@ -104,11 +104,13 @@ graph.render();
104
104
  ## Components
105
105
 
106
106
  ### Node Components
107
+
107
108
  - **node-device**: Device node with icon and label support
108
109
  - **node-icon**: Icon-only node component
109
110
  - **node-label**: Label-only node component
110
111
 
111
112
  ### Edge Components
113
+
112
114
  - **edge-line**: Straight line edges
113
115
  - **edge-polyline**: Multi-segment polyline edges
114
116
  - **edge-quadratic**: Curved quadratic edges
@@ -116,6 +118,7 @@ graph.render();
116
118
  - **edge-label**: Labels for edges
117
119
 
118
120
  ### Group Components
121
+
119
122
  - **group-device**: Device group with expand/collapse functionality
120
123
 
121
124
  ## Behaviors
@@ -254,26 +257,34 @@ libs/graph/
254
257
  #### Detailed Folder Responsibilities
255
258
 
256
259
  ##### Core (`src/core/`)
260
+
257
261
  **Purpose**: Essential graph functionality and APIs
262
+
258
263
  - **`graph/`**: Main Graph class implementing the public API, lifecycle management, and core operations
259
264
  - **`model/`**: TypeScript type definitions, interfaces, and data structures used throughout the library
260
265
  - **`utils/`**: Core utility functions for graph manipulation, theme management, and element operations
261
266
 
262
267
  ##### Components (`src/components/`)
268
+
263
269
  **Purpose**: Visual rendering components for graph elements
270
+
264
271
  - **Node Components**: Different node types (device, icon, label) with specialized rendering logic
265
272
  - **Edge Components**: Various edge types (line, polyline, quadratic) with arrow and label support
266
273
  - **Group Components**: Container components for grouping and organizing elements
267
274
  - **Shared**: Common utilities and transformations used across components
268
275
 
269
276
  ##### Behaviors (`src/behaviors/`)
277
+
270
278
  **Purpose**: User interaction handling and graph manipulation
279
+
271
280
  - Each behavior handles specific user interactions (clicking, dragging, selecting)
272
281
  - Behaviors are modular and can be enabled/disabled independently
273
282
  - Includes both mouse and keyboard interaction handling
274
283
 
275
284
  ##### Layouts (`src/layouts/`)
285
+
276
286
  **Purpose**: Automatic positioning algorithms for graph elements
287
+
277
288
  - **Force**: Physics-based layout for natural node arrangements
278
289
  - **Tree**: Hierarchical layouts for tree-structured data
279
290
  - **Grid**: Regular grid arrangements for systematic positioning
@@ -281,27 +292,33 @@ libs/graph/
281
292
  - **Align**: Tools for manual element alignment
282
293
 
283
294
  ##### Plugins (`src/plugins/`)
295
+
284
296
  **Purpose**: Extensible features that enhance graph functionality
297
+
285
298
  - Each plugin is self-contained and optional
286
299
  - Plugins can add UI elements (toolbars, tooltips, minimap)
287
300
  - Includes data management features (history, context menus)
288
301
 
289
302
  ##### Shared (`src/shared/`)
303
+
290
304
  **Purpose**: Common utilities and infrastructure
305
+
291
306
  - **Types**: Shared TypeScript definitions used across modules
292
307
  - **Utils**: Generic utility functions and shared components
293
308
  - **Transforms**: Data transformation pipeline for processing graph configurations
294
309
  - **Constants**: Application-wide constants and configuration values
295
310
 
296
311
  ##### Testing Infrastructure
312
+
297
313
  - **`tests/`**: Reusable test utilities and helper functions
298
314
  - **`e2e/`**: End-to-end visual regression testing with Playwright
299
- - **Each component includes its own test suite with visual snapshots
315
+ - \*\*Each component includes its own test suite with visual snapshots
300
316
 
301
317
  ##### Documentation & Development
318
+
302
319
  - **`.storybook/`**: Interactive documentation and component playground
303
320
  - **`stories/`**: Written documentation and API guides
304
- - **Each component includes comprehensive Storybook stories for demonstration and testing
321
+ - \*\*Each component includes comprehensive Storybook stories for demonstration and testing
305
322
 
306
323
  ### Development Workflow
307
324
 
@@ -433,9 +450,12 @@ class CustomPlugin extends BasePlugin {
433
450
  }
434
451
 
435
452
  // Add plugin to graph
436
- graph.setPlugin('custom-plugin', new CustomPlugin({
437
- // plugin options
438
- }));
453
+ graph.setPlugin(
454
+ 'custom-plugin',
455
+ new CustomPlugin({
456
+ // plugin options
457
+ }),
458
+ );
439
459
  ```
440
460
 
441
461
  ## Development Workflow
@@ -651,11 +671,7 @@ Implement Playwright visual regression tests:
651
671
  ```typescript
652
672
  // components/my-component/stories/tests/my-component-basic.spec.ts
653
673
  import { test } from '@playwright/test';
654
- import {
655
- getGraphContainer,
656
- getStorybookUrl,
657
- verifySnapshot,
658
- } from '@tests/helpers';
674
+ import { getGraphContainer, getStorybookUrl, verifySnapshot } from '@tests/helpers';
659
675
 
660
676
  const STORY_ID = 'components-my-component--basic';
661
677
  const SNAPSHOT_NAME = 'my-component-basic.png';
@@ -665,10 +681,7 @@ test.describe('My Component Visual Tests', () => {
665
681
  await page.setViewportSize({ width: 600, height: 500 });
666
682
  });
667
683
 
668
- test('should display basic component correctly', async ({
669
- page,
670
- baseURL,
671
- }) => {
684
+ test('should display basic component correctly', async ({ page, baseURL }) => {
672
685
  await page.goto(getStorybookUrl(baseURL, STORY_ID));
673
686
  await page.waitForSelector('div.container', { timeout: 10000 });
674
687