Skip to content

Commit

Permalink
feat(graphing): Make link and link info text color customizable separ…
Browse files Browse the repository at this point in the history
…ately
  • Loading branch information
Iku-turso committed Mar 11, 2022
1 parent 2057001 commit aa42120
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class \\"some-async-child-injectable\\" as someAsyncChildInjectable<Singleton\\\
class \\"some-parent-injectable\\" as someParentInjectable<Singleton\\\\nAsync> << (S,lightGreen) >> $some-parent-injectable #line:darkRed
class \\"some-keyed-injectable\\" as someKeyedInjectable<Keyed> << (K,pink) >> $some-keyed-injectable $some-parent-injectable #line:darkRed
someInjectionToken --[#black,dashed,thickness=1]up* someTokenInjectable #text:black : Setup
someInjectionToken --[#orange,dashed,thickness=1]up* someCustomizableSyncInjectable #text:orange : Setup\\\\nsome-custom-link-info
someInjectionToken --[#orange,dashed,thickness=1]up* someCustomizableSyncInjectable #text:green : Setup\\\\nsome-custom-link-info
someSyncChildInjectable --[#black,dashed,thickness=1]up* someInjectionToken #text:black : Setup
someSetuppable --[#black,dashed,thickness=1]up* someSyncChildInjectable #text:black : Setup
someSetuppable --[#black,dashed,thickness=1]up* someSetuppable #text:black : Setup
someInjectionToken --[#black,plain,thickness=1]up* someTokenInjectable #text:black
someInjectionToken --[#orange,plain,thickness=1]up* someCustomizableSyncInjectable #text:orange : some-custom-link-info
someInjectionToken --[#orange,plain,thickness=1]up* someCustomizableSyncInjectable #text:green : some-custom-link-info
someSyncChildInjectable --[#black,plain,thickness=1]up* someInjectionToken #text:black
someParentInjectable --[#black,plain,thickness=1]up* someSyncChildInjectable #text:black
someAsyncChildInjectable --[#orange,plain,thickness=4]up* someCustomizableAsyncInjectable #text:orange : Async\\\\nsome-custom-link-info
someAsyncChildInjectable --[#orange,plain,thickness=4]up* someCustomizableAsyncInjectable #text:green : Async\\\\nsome-custom-link-info
someParentInjectable --[#black,plain,thickness=4]up* someAsyncChildInjectable #text:black : Async
someParentInjectable --[#black,plain,thickness=1]up* someKeyedInjectable #text:black
@enduml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ describe('createContainer.dependency-graph', () => {

customizeLink: link => {
link.infos.add('some-custom-link-info');
link.color = 'orange';
link.lineColor = 'orange';
link.textColor = 'green';
},

customizeNode: node => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,15 @@ const toPlantUmlLink = ({
isRelatedToSetup,
isAsync,
infos,
color = 'black',
lineColor = 'black',
textColor = 'black',
}) => {
const lineType = isRelatedToSetup ? 'dashed' : 'plain';
const lineThickness = isAsync ? 4 : 1;
const lineStyle = `[#${color},${lineType},thickness=${lineThickness}]`;
const lineStyle = `[#${lineColor},${lineType},thickness=${lineThickness}]`;
const infosString = infos.size ? ` : ${[...infos.values()].join('\\n')}` : '';

return `${parentId} --${lineStyle}up* ${dependencyId} #text:${color} ${infosString} `;
return `${parentId} --${lineStyle}up* ${dependencyId} #text:${textColor} ${infosString} `;
};

const tokenLifecycle = {
Expand Down

0 comments on commit aa42120

Please sign in to comment.