@flowuent-org/diagramming-core 1.0.8 → 1.1.1
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/apps/diagramming/src/AutomationDiagramData.ts +22 -0
- package/apps/diagramming/src/components/AddNodeView.tsx +252 -252
- package/apps/diagramming/src/main.tsx +463 -463
- package/apps/diagramming/src/node-data.ts +664 -664
- package/apps/diagramming/src/stencil-items.ts +31 -31
- package/apps/diagramming/src/vite-env.d.ts +1 -1
- package/package.json +1 -1
- package/packages/diagrams/NODE_DATA_UPDATE_API.md +430 -430
- package/packages/diagrams/README.md +7 -463
- package/packages/diagrams/UNDO_REDO_API.md +306 -306
- package/packages/diagrams/package.json +27 -27
- package/packages/diagrams/project.json +42 -42
- package/packages/diagrams/rollup.config.js +26 -26
- package/packages/diagrams/src/DiagramFlow.tsx +7 -7
- package/packages/diagrams/src/index.ts +116 -116
- package/packages/diagrams/src/index.ts.bak +99 -99
- package/packages/diagrams/src/lib/atoms/CardEditableTitle.tsx +76 -76
- package/packages/diagrams/src/lib/atoms/ExpressionInput.tsx +437 -437
- package/packages/diagrams/src/lib/components/DiagramPanel.tsx +331 -331
- package/packages/diagrams/src/lib/components/automation/AISuggestionsModal.tsx +269 -0
- package/packages/diagrams/src/lib/components/automation/AISuggestionsPanel.tsx +227 -0
- package/packages/diagrams/src/lib/components/automation/AutomationAISuggestionNode.tsx +178 -115
- package/packages/diagrams/src/lib/components/automation/AutomationApiNode.tsx +133 -27
- package/packages/diagrams/src/lib/components/automation/AutomationEndNode.tsx +134 -28
- package/packages/diagrams/src/lib/components/automation/AutomationFormattingNode.tsx +132 -27
- package/packages/diagrams/src/lib/components/automation/AutomationNoteNode.tsx +124 -17
- package/packages/diagrams/src/lib/components/automation/AutomationSheetsNode.tsx +122 -15
- package/packages/diagrams/src/lib/components/automation/index.ts +3 -0
- package/packages/diagrams/src/lib/contexts/onWorkflowNodeDelete.ts +65 -65
- package/packages/diagrams/src/lib/organisms/CustomEdge/useCreateBendPoint.tsx +121 -121
- package/packages/diagrams/src/lib/organisms/WorkFlowNode/NodeActionButtons.tsx +45 -45
- package/packages/diagrams/src/lib/templates/node-forms/CallForm.tsx +370 -370
- package/packages/diagrams/src/lib/templates/systemFlow/components/FloatingEdge.tsx +219 -219
- package/packages/diagrams/src/lib/types/card-node.ts +68 -68
- package/packages/diagrams/src/lib/types/node-types.ts +29 -29
- package/packages/diagrams/src/lib/utils/AutomationExecutionEngine.ts +1179 -1179
- package/packages/diagrams/tsconfig.lib.json +25 -25
- package/tsconfig.base.json +29 -30
- package/TRANSLATION_FIX_SUMMARY.md +0 -118
- package/packages/diagrams/I18N_SETUP.md +0 -126
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../dist/out-tsc",
|
|
5
|
-
"types": [
|
|
6
|
-
"node",
|
|
7
|
-
|
|
8
|
-
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
-
"@nx/react/typings/image.d.ts"
|
|
10
|
-
],
|
|
11
|
-
"noEmitOnError": false
|
|
12
|
-
},
|
|
13
|
-
"exclude": [
|
|
14
|
-
"jest.config.ts",
|
|
15
|
-
"src/**/*.spec.ts",
|
|
16
|
-
"src/**/*.test.ts",
|
|
17
|
-
"src/**/*.spec.tsx",
|
|
18
|
-
"src/**/*.test.tsx",
|
|
19
|
-
"src/**/*.spec.js",
|
|
20
|
-
"src/**/*.test.js",
|
|
21
|
-
"src/**/*.spec.jsx",
|
|
22
|
-
"src/**/*.test.jsx"
|
|
23
|
-
],
|
|
24
|
-
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
],
|
|
11
|
+
"noEmitOnError": false
|
|
12
|
+
},
|
|
13
|
+
"exclude": [
|
|
14
|
+
"jest.config.ts",
|
|
15
|
+
"src/**/*.spec.ts",
|
|
16
|
+
"src/**/*.test.ts",
|
|
17
|
+
"src/**/*.spec.tsx",
|
|
18
|
+
"src/**/*.test.tsx",
|
|
19
|
+
"src/**/*.spec.js",
|
|
20
|
+
"src/**/*.test.js",
|
|
21
|
+
"src/**/*.spec.jsx",
|
|
22
|
+
"src/**/*.test.jsx"
|
|
23
|
+
],
|
|
24
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
25
|
+
}
|
package/tsconfig.base.json
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compileOnSave": false,
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
"@flowuent-labs/
|
|
19
|
-
"@flowuent-labs/
|
|
20
|
-
"@flowuent-labs/
|
|
21
|
-
"@flowuent-labs/
|
|
22
|
-
"@flowuent-labs/
|
|
23
|
-
"@flowuent-labs/
|
|
24
|
-
"@flowuent-labs/
|
|
25
|
-
"@flowuent-labs/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"sourceMap": true,
|
|
5
|
+
"declaration": false,
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"emitDecoratorMetadata": true,
|
|
8
|
+
"experimentalDecorators": true,
|
|
9
|
+
"importHelpers": true,
|
|
10
|
+
"target": "es2015",
|
|
11
|
+
"module": "esnext",
|
|
12
|
+
"lib": ["es2020", "dom"],
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"skipDefaultLibCheck": true,
|
|
15
|
+
"baseUrl": ".",
|
|
16
|
+
"paths": {
|
|
17
|
+
"@flowuent-labs/api": ["packages/api/src/index.ts"],
|
|
18
|
+
"@flowuent-labs/atoms": ["packages/atoms/src/index.ts"],
|
|
19
|
+
"@flowuent-labs/common": ["packages/common/src/index.ts"],
|
|
20
|
+
"@flowuent-labs/contexts": ["packages/contexts/src/index.ts"],
|
|
21
|
+
"@flowuent-labs/diagrams": ["packages/diagrams/src/index.ts"],
|
|
22
|
+
"@flowuent-labs/interfaces": ["packages/interfaces/src/index.ts"],
|
|
23
|
+
"@flowuent-labs/molecules": ["packages/molecules/src/index.ts"],
|
|
24
|
+
"@flowuent-labs/organisms": ["packages/organisms/src/index.ts"],
|
|
25
|
+
"@flowuent-labs/zustand": ["packages/zustand/src/index.ts"]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"exclude": ["node_modules", "tmp"]
|
|
29
|
+
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# Translation Fix Summary
|
|
2
|
-
|
|
3
|
-
## Problem
|
|
4
|
-
Translation keys (like `tooltip.clear`, `button.save`) were showing instead of actual text when using the published npm library in another app.
|
|
5
|
-
|
|
6
|
-
## Root Cause
|
|
7
|
-
The translation files were in the `apps/workflow/locales` folder (not part of the library) and were not being bundled with the published npm package. The library code was using `useTranslation()` hooks but had no way to access the translation resources.
|
|
8
|
-
|
|
9
|
-
## Solution Implemented
|
|
10
|
-
|
|
11
|
-
### 1. Moved Translation Files to Library
|
|
12
|
-
- ✅ Created `packages/diagrams/locales/en/translation.json`
|
|
13
|
-
- ✅ Copied translation files from apps to library
|
|
14
|
-
|
|
15
|
-
### 2. Updated Build Configuration
|
|
16
|
-
- ✅ Modified `packages/diagrams/project.json` to include locales folder in build assets
|
|
17
|
-
- ✅ This ensures translations are bundled with the npm package
|
|
18
|
-
|
|
19
|
-
### 3. Created i18n Configuration
|
|
20
|
-
- ✅ Created `packages/diagrams/src/lib/i18n.ts` with:
|
|
21
|
-
- `initDiagramsI18n()` - Function to initialize translations
|
|
22
|
-
- `translationEN` - Export of translation resources
|
|
23
|
-
- Auto-initialization if i18n not already configured
|
|
24
|
-
|
|
25
|
-
### 4. Updated Package Dependencies
|
|
26
|
-
- ✅ Added `i18next` and `react-i18next` to package.json dependencies
|
|
27
|
-
|
|
28
|
-
### 5. Updated Exports
|
|
29
|
-
- ✅ Modified `packages/diagrams/src/index.ts` to export i18n functionality
|
|
30
|
-
|
|
31
|
-
### 6. Created Documentation
|
|
32
|
-
- ✅ Created `I18N_SETUP.md` with detailed setup instructions
|
|
33
|
-
- ✅ Updated `README.md` with quick start guide
|
|
34
|
-
|
|
35
|
-
## How Consumers Should Use the Library
|
|
36
|
-
|
|
37
|
-
### In their main.tsx or index.tsx (BEFORE rendering components):
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
import { initDiagramsI18n } from '@flowuent-labs/diagrams';
|
|
41
|
-
|
|
42
|
-
// Initialize i18n
|
|
43
|
-
initDiagramsI18n();
|
|
44
|
-
|
|
45
|
-
// Then render your app
|
|
46
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Next Steps
|
|
50
|
-
|
|
51
|
-
1. **Fix Build Issue** (Separate from i18n):
|
|
52
|
-
The build is failing due to TypeScript path configuration issues (mixing Unix `/Users` and Windows `C:` paths). This is a pre-existing issue unrelated to the i18n changes. You may need to:
|
|
53
|
-
- Check your `tsconfig.json` and `tsconfig.lib.json`
|
|
54
|
-
- Ensure consistent path separators
|
|
55
|
-
- Or build on a single platform (all Unix or all Windows paths)
|
|
56
|
-
|
|
57
|
-
2. **Test the Build**:
|
|
58
|
-
Once the path issue is resolved, rebuild:
|
|
59
|
-
```bash
|
|
60
|
-
nx build diagrams
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
3. **Verify Translation Files Are Included**:
|
|
64
|
-
After successful build, check `dist/packages/diagrams/locales/` exists
|
|
65
|
-
|
|
66
|
-
4. **Publish Updated Package**:
|
|
67
|
-
```bash
|
|
68
|
-
cd packages/diagrams
|
|
69
|
-
npm version patch # or minor/major
|
|
70
|
-
npm publish
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
5. **Update Consumer Apps**:
|
|
74
|
-
In apps using the library:
|
|
75
|
-
```bash
|
|
76
|
-
npm update @flowuent-labs/diagrams
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Then add initialization:
|
|
80
|
-
```typescript
|
|
81
|
-
import { initDiagramsI18n } from '@flowuent-labs/diagrams';
|
|
82
|
-
initDiagramsI18n(); // Add this before rendering
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Alternative: Quick Fix Without Rebuilding
|
|
86
|
-
|
|
87
|
-
If you need an immediate fix before resolving the build issues, consumers can manually add translations:
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
import i18n from 'i18next';
|
|
91
|
-
import { initReactI18next } from 'react-i18next';
|
|
92
|
-
|
|
93
|
-
// Manually import/copy the translation.json content
|
|
94
|
-
const translations = { /* paste translation.json content */ };
|
|
95
|
-
|
|
96
|
-
i18n.use(initReactI18next).init({
|
|
97
|
-
resources: {
|
|
98
|
-
en: {
|
|
99
|
-
translation: translations
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
fallbackLng: 'en',
|
|
103
|
-
interpolation: {
|
|
104
|
-
escapeValue: false
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Files Modified/Created
|
|
110
|
-
|
|
111
|
-
1. ✅ `packages/diagrams/locales/en/translation.json` (new)
|
|
112
|
-
2. ✅ `packages/diagrams/src/lib/i18n.ts` (new)
|
|
113
|
-
3. ✅ `packages/diagrams/src/index.ts` (modified)
|
|
114
|
-
4. ✅ `packages/diagrams/project.json` (modified - assets config)
|
|
115
|
-
5. ✅ `packages/diagrams/package.json` (modified - added i18n deps)
|
|
116
|
-
6. ✅ `packages/diagrams/README.md` (updated)
|
|
117
|
-
7. ✅ `packages/diagrams/I18N_SETUP.md` (new)
|
|
118
|
-
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# Internationalization (i18n) Setup
|
|
2
|
-
|
|
3
|
-
The `@flowuent-labs/diagrams` library includes built-in translation support using i18next. To ensure translations work correctly in your application, you need to initialize i18n before using the library components.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
### Option 1: Use Built-in Initialization (Recommended)
|
|
8
|
-
|
|
9
|
-
Import and call the `initDiagramsI18n` function before rendering any diagram components:
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
import { initDiagramsI18n } from '@flowuent-labs/diagrams';
|
|
13
|
-
|
|
14
|
-
// Initialize i18n with default translations
|
|
15
|
-
initDiagramsI18n();
|
|
16
|
-
|
|
17
|
-
// Now you can use any diagram components
|
|
18
|
-
function App() {
|
|
19
|
-
return <YourDiagramComponent />;
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Option 2: Manual Initialization with Custom Translations
|
|
24
|
-
|
|
25
|
-
If you want to customize or extend the translations:
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
import { initDiagramsI18n, translationEN } from '@flowuent-labs/diagrams';
|
|
29
|
-
|
|
30
|
-
// Initialize with custom translations
|
|
31
|
-
initDiagramsI18n({
|
|
32
|
-
en: {
|
|
33
|
-
translation: {
|
|
34
|
-
...translationEN,
|
|
35
|
-
// Add your custom translations or overrides here
|
|
36
|
-
customKey: 'Custom value',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
// Add other languages
|
|
40
|
-
es: {
|
|
41
|
-
translation: {
|
|
42
|
-
// Spanish translations
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Option 3: Use Existing i18next Instance
|
|
49
|
-
|
|
50
|
-
If your app already uses i18next, you can add the library's translations to your existing configuration:
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import i18n from 'i18next';
|
|
54
|
-
import { initReactI18next } from 'react-i18next';
|
|
55
|
-
import { translationEN } from '@flowuent-labs/diagrams';
|
|
56
|
-
|
|
57
|
-
i18n
|
|
58
|
-
.use(initReactI18next)
|
|
59
|
-
.init({
|
|
60
|
-
resources: {
|
|
61
|
-
en: {
|
|
62
|
-
translation: {
|
|
63
|
-
// Your app translations
|
|
64
|
-
...yourAppTranslations,
|
|
65
|
-
// Library translations
|
|
66
|
-
...translationEN,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
fallbackLng: 'en',
|
|
71
|
-
interpolation: {
|
|
72
|
-
escapeValue: false,
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Available Translations
|
|
78
|
-
|
|
79
|
-
The library currently includes:
|
|
80
|
-
- English (en) - `translationEN`
|
|
81
|
-
|
|
82
|
-
## Common Issues
|
|
83
|
-
|
|
84
|
-
### Translation Keys Showing Instead of Text
|
|
85
|
-
|
|
86
|
-
If you see translation keys (e.g., `tooltip.clear`, `button.save`) instead of actual text, it means i18n is not initialized. Make sure to call `initDiagramsI18n()` before rendering any components.
|
|
87
|
-
|
|
88
|
-
### Translations Not Working in Production
|
|
89
|
-
|
|
90
|
-
Ensure your build process includes the `locales` folder from the library. The translation files are automatically included in the npm package.
|
|
91
|
-
|
|
92
|
-
## API Reference
|
|
93
|
-
|
|
94
|
-
### `initDiagramsI18n(customResources?: any): i18n`
|
|
95
|
-
|
|
96
|
-
Initializes or updates the i18next instance with diagram translations.
|
|
97
|
-
|
|
98
|
-
**Parameters:**
|
|
99
|
-
- `customResources` (optional): Custom translation resources object
|
|
100
|
-
|
|
101
|
-
**Returns:**
|
|
102
|
-
- The i18next instance
|
|
103
|
-
|
|
104
|
-
### `translationEN`
|
|
105
|
-
|
|
106
|
-
The default English translation resource object. Can be imported for customization or extension.
|
|
107
|
-
|
|
108
|
-
## Example: Complete Setup
|
|
109
|
-
|
|
110
|
-
```typescript
|
|
111
|
-
// main.tsx or index.tsx
|
|
112
|
-
import React from 'react';
|
|
113
|
-
import ReactDOM from 'react-dom/client';
|
|
114
|
-
import { initDiagramsI18n } from '@flowuent-labs/diagrams';
|
|
115
|
-
import App from './App';
|
|
116
|
-
|
|
117
|
-
// Initialize i18n before rendering
|
|
118
|
-
initDiagramsI18n();
|
|
119
|
-
|
|
120
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
121
|
-
<React.StrictMode>
|
|
122
|
-
<App />
|
|
123
|
-
</React.StrictMode>
|
|
124
|
-
);
|
|
125
|
-
```
|
|
126
|
-
|