likec4 0.40.0-build.3 → 0.40.0-build.7
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/dist/@likec4/core/__test__/data.d.ts +20 -0
- package/dist/@likec4/core/__test__/index.d.ts +2 -0
- package/dist/@likec4/core/colors.d.ts +148 -0
- package/dist/@likec4/core/colors.js +104 -0
- package/dist/@likec4/core/compute-view/EdgeBuilder.d.ts +6 -0
- package/dist/@likec4/core/compute-view/EdgeBuilder.js +30 -0
- package/dist/@likec4/core/compute-view/compute-ctx.d.ts +20 -0
- package/dist/@likec4/core/compute-view/compute-ctx.js +100 -0
- package/dist/@likec4/core/compute-view/compute-ctx.spec.d.ts +2 -0
- package/dist/@likec4/core/compute-view/compute-element-view.d.ts +3 -0
- package/dist/@likec4/core/compute-view/compute-element-view.js +98 -0
- package/dist/@likec4/core/compute-view/compute-element-view.spec.d.ts +2 -0
- package/dist/@likec4/core/compute-view/compute-predicates.d.ts +16 -0
- package/dist/@likec4/core/compute-view/compute-predicates.js +324 -0
- package/dist/@likec4/core/compute-view/compute.d.ts +14 -0
- package/dist/@likec4/core/compute-view/compute.js +36 -0
- package/dist/@likec4/core/compute-view/index.d.ts +4 -0
- package/dist/@likec4/core/compute-view/index.js +4 -0
- package/dist/@likec4/core/compute-view/resolve-extended-views.d.ts +6 -0
- package/dist/@likec4/core/compute-view/resolve-extended-views.js +41 -0
- package/dist/@likec4/core/compute-view/resolve-extended-views.spec.d.ts +2 -0
- package/dist/@likec4/core/compute-view/resolve-relative-paths.d.ts +2 -0
- package/dist/@likec4/core/compute-view/resolve-relative-paths.js +76 -0
- package/dist/@likec4/core/compute-view/resolve-relative-paths.spec.d.ts +2 -0
- package/dist/@likec4/core/compute-view/utils/anyPossibleRelations.d.ts +2 -0
- package/dist/@likec4/core/compute-view/utils/anyPossibleRelations.js +12 -0
- package/dist/@likec4/core/compute-view/utils/applyViewRuleStyles.d.ts +2 -0
- package/dist/@likec4/core/compute-view/utils/applyViewRuleStyles.js +50 -0
- package/dist/@likec4/core/compute-view/utils/sortNodes.d.ts +19 -0
- package/dist/@likec4/core/compute-view/utils/sortNodes.js +37 -0
- package/dist/@likec4/core/compute-view/utils/sortNodes.spec.d.ts +2 -0
- package/dist/@likec4/core/errors/errors.spec.d.ts +2 -0
- package/dist/@likec4/core/errors/index.d.ts +45 -0
- package/dist/@likec4/core/errors/index.js +97 -0
- package/dist/@likec4/core/index.d.ts +8 -0
- package/dist/@likec4/core/index.js +6 -0
- package/dist/@likec4/core/model-index/ModelIndex.d.ts +27 -0
- package/dist/@likec4/core/model-index/ModelIndex.js +127 -0
- package/dist/@likec4/core/model-index/index.d.ts +1 -0
- package/dist/@likec4/core/model-index/index.js +1 -0
- package/dist/@likec4/core/types/_common.d.ts +3 -0
- package/dist/@likec4/core/types/_common.js +0 -0
- package/dist/@likec4/core/types/computed-view.d.ts +41 -0
- package/dist/@likec4/core/types/computed-view.js +0 -0
- package/dist/@likec4/core/types/diagram.d.ts +32 -0
- package/dist/@likec4/core/types/diagram.js +0 -0
- package/dist/@likec4/core/types/element.d.ts +29 -0
- package/dist/@likec4/core/types/element.js +5 -0
- package/dist/@likec4/core/types/expression.d.ts +56 -0
- package/dist/@likec4/core/types/expression.js +30 -0
- package/dist/@likec4/core/types/index.d.ts +11 -0
- package/dist/@likec4/core/types/index.js +11 -0
- package/dist/@likec4/core/types/model.d.ts +14 -0
- package/dist/@likec4/core/types/model.js +0 -0
- package/dist/@likec4/core/types/opaque.d.ts +102 -0
- package/dist/@likec4/core/types/opaque.js +0 -0
- package/dist/@likec4/core/types/relation.d.ts +10 -0
- package/dist/@likec4/core/types/relation.js +0 -0
- package/dist/@likec4/core/types/theme.d.ts +28 -0
- package/dist/@likec4/core/types/theme.js +0 -0
- package/dist/@likec4/core/types/view.d.ts +58 -0
- package/dist/@likec4/core/types/view.js +15 -0
- package/dist/@likec4/core/utils/compute-node-levels.d.ts +7 -0
- package/dist/@likec4/core/utils/compute-node-levels.js +31 -0
- package/dist/@likec4/core/utils/compute-node-levels.spec.d.ts +2 -0
- package/dist/@likec4/core/utils/fqn.d.ts +28 -0
- package/dist/@likec4/core/utils/fqn.js +66 -0
- package/dist/@likec4/core/utils/fqn.spec.d.ts +2 -0
- package/dist/@likec4/core/utils/guards.d.ts +3 -0
- package/dist/@likec4/core/utils/guards.js +6 -0
- package/dist/@likec4/core/utils/index.d.ts +4 -0
- package/dist/@likec4/core/utils/index.js +4 -0
- package/dist/@likec4/core/utils/relations.d.ts +25 -0
- package/dist/@likec4/core/utils/relations.js +50 -0
- package/dist/@likec4/core/utils/relations.spec.d.ts +2 -0
- package/dist/@likec4/diagrams/components/EmbeddedDiagram.d.ts +30 -0
- package/dist/@likec4/diagrams/components/EmbeddedDiagram.js +77 -0
- package/dist/@likec4/diagrams/components/FullscreenDiagramBrowser.d.ts +31 -0
- package/dist/@likec4/diagrams/components/FullscreenDiagramBrowser.js +52 -0
- package/dist/@likec4/diagrams/components/index.d.ts +5 -0
- package/dist/@likec4/diagrams/components/index.js +4 -0
- package/dist/@likec4/diagrams/components/primitives/fullscreen/CloseButton.d.ts +3 -0
- package/dist/@likec4/diagrams/components/primitives/fullscreen/CloseButton.js +43 -0
- package/dist/@likec4/diagrams/components/primitives/fullscreen/FullscreenDiagram.d.ts +39 -0
- package/dist/@likec4/diagrams/components/primitives/fullscreen/FullscreenDiagram.js +116 -0
- package/dist/@likec4/diagrams/components/primitives/fullscreen/FullscreenDiagramTitle.d.ts +8 -0
- package/dist/@likec4/diagrams/components/primitives/fullscreen/FullscreenDiagramTitle.js +32 -0
- package/dist/@likec4/diagrams/components/primitives/index.d.ts +4 -0
- package/dist/@likec4/diagrams/components/primitives/index.js +3 -0
- package/dist/@likec4/diagrams/components/primitives/responsive/ResponsiveDiagram.d.ts +13 -0
- package/dist/@likec4/diagrams/components/primitives/responsive/ResponsiveDiagram.js +42 -0
- package/dist/@likec4/diagrams/components/types.d.ts +19 -0
- package/dist/@likec4/diagrams/components/types.js +0 -0
- package/dist/@likec4/diagrams/diagram/Diagram.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/Diagram.js +298 -0
- package/dist/@likec4/diagrams/diagram/Edges.d.ts +11 -0
- package/dist/@likec4/diagrams/diagram/Edges.js +115 -0
- package/dist/@likec4/diagrams/diagram/Nodes.d.ts +11 -0
- package/dist/@likec4/diagrams/diagram/Nodes.js +176 -0
- package/dist/@likec4/diagrams/diagram/icons/BrainIcon.d.ts +3 -0
- package/dist/@likec4/diagrams/diagram/icons/BrainIcon.js +20 -0
- package/dist/@likec4/diagrams/diagram/icons/ExternalLink.d.ts +14 -0
- package/dist/@likec4/diagrams/diagram/icons/ExternalLink.js +91 -0
- package/dist/@likec4/diagrams/diagram/icons/index.d.ts +3 -0
- package/dist/@likec4/diagrams/diagram/icons/index.js +2 -0
- package/dist/@likec4/diagrams/diagram/index.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/index.js +2 -0
- package/dist/@likec4/diagrams/diagram/shapes/Browser.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/shapes/Browser.js +49 -0
- package/dist/@likec4/diagrams/diagram/shapes/Compound.d.ts +11 -0
- package/dist/@likec4/diagrams/diagram/shapes/Compound.js +48 -0
- package/dist/@likec4/diagrams/diagram/shapes/Cylinder.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/shapes/Cylinder.js +57 -0
- package/dist/@likec4/diagrams/diagram/shapes/Edge.d.ts +17 -0
- package/dist/@likec4/diagrams/diagram/shapes/Edge.js +63 -0
- package/dist/@likec4/diagrams/diagram/shapes/Mobile.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/shapes/Mobile.js +33 -0
- package/dist/@likec4/diagrams/diagram/shapes/NodeIcon.d.ts +10 -0
- package/dist/@likec4/diagrams/diagram/shapes/NodeIcon.js +28 -0
- package/dist/@likec4/diagrams/diagram/shapes/NodeLabel.d.ts +15 -0
- package/dist/@likec4/diagrams/diagram/shapes/NodeLabel.js +59 -0
- package/dist/@likec4/diagrams/diagram/shapes/Person.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/shapes/Person.js +42 -0
- package/dist/@likec4/diagrams/diagram/shapes/Queue.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/shapes/Queue.js +58 -0
- package/dist/@likec4/diagrams/diagram/shapes/Rectangle.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/shapes/Rectangle.js +20 -0
- package/dist/@likec4/diagrams/diagram/shapes/index.d.ts +9 -0
- package/dist/@likec4/diagrams/diagram/shapes/index.js +7 -0
- package/dist/@likec4/diagrams/diagram/shapes/types.d.ts +13 -0
- package/dist/@likec4/diagrams/diagram/shapes/types.js +0 -0
- package/dist/@likec4/diagrams/diagram/shapes/utils.d.ts +3 -0
- package/dist/@likec4/diagrams/diagram/shapes/utils.js +12 -0
- package/dist/@likec4/diagrams/diagram/springs.d.ts +43 -0
- package/dist/@likec4/diagrams/diagram/springs.js +57 -0
- package/dist/@likec4/diagrams/diagram/state/atoms.d.ts +10 -0
- package/dist/@likec4/diagrams/diagram/state/atoms.js +71 -0
- package/dist/@likec4/diagrams/diagram/state/gestures.d.ts +7 -0
- package/dist/@likec4/diagrams/diagram/state/gestures.js +19 -0
- package/dist/@likec4/diagrams/diagram/state/hooks.d.ts +10 -0
- package/dist/@likec4/diagrams/diagram/state/hooks.js +28 -0
- package/dist/@likec4/diagrams/diagram/state/index.d.ts +4 -0
- package/dist/@likec4/diagrams/diagram/state/index.js +3 -0
- package/dist/@likec4/diagrams/diagram/state/provider.d.ts +3 -0
- package/dist/@likec4/diagrams/diagram/state/provider.js +7 -0
- package/dist/@likec4/diagrams/diagram/types.d.ts +63 -0
- package/dist/@likec4/diagrams/diagram/types.js +0 -0
- package/dist/@likec4/diagrams/hooks/index.d.ts +5 -0
- package/dist/@likec4/diagrams/hooks/index.js +4 -0
- package/dist/@likec4/diagrams/hooks/useDarkMode.d.ts +2 -0
- package/dist/@likec4/diagrams/hooks/useDarkMode.js +5 -0
- package/dist/@likec4/diagrams/hooks/useDiagramRef.d.ts +12 -0
- package/dist/@likec4/diagrams/hooks/useDiagramRef.js +21 -0
- package/dist/@likec4/diagrams/hooks/useImageLoader.d.ts +6 -0
- package/dist/@likec4/diagrams/hooks/useImageLoader.js +64 -0
- package/dist/@likec4/diagrams/hooks/useViewIdFromHash.d.ts +7 -0
- package/dist/@likec4/diagrams/hooks/useViewIdFromHash.js +87 -0
- package/dist/@likec4/diagrams/index.d.ts +6 -0
- package/dist/@likec4/diagrams/index.js +4 -0
- package/dist/@likec4/diagrams/konva-html.d.ts +26 -0
- package/dist/@likec4/diagrams/konva-html.js +74 -0
- package/dist/@likec4/diagrams/konva-portal.d.ts +14 -0
- package/dist/@likec4/diagrams/konva-portal.js +34 -0
- package/dist/@likec4/diagrams/konva.d.ts +41 -0
- package/dist/@likec4/diagrams/konva.js +22 -0
- package/dist/@likec4/diagrams/likec4.d.ts +54 -0
- package/dist/@likec4/diagrams/likec4.js +54 -0
- package/{app → dist/__app__}/index.html +3 -3
- package/{app → dist/__app__}/src/App.tsx +6 -9
- package/{app → dist/__app__}/src/main.tsx +1 -1
- package/{app → dist/__app__}/tsconfig.json +5 -18
- package/dist/cli/index.js +57665 -274
- package/package.json +7 -9
- /package/{app → dist/__app__}/favicon.svg +0 -0
- /package/{app → dist/__app__}/likec4.css +0 -0
- /package/{app → dist/__app__}/postcss.config.cjs +0 -0
- /package/{app → dist/__app__}/robots.txt +0 -0
- /package/{app → dist/__app__}/src/components/DiagramNotFound.tsx +0 -0
- /package/{app → dist/__app__}/src/components/ThemePanelToggle.tsx +0 -0
- /package/{app → dist/__app__}/src/components/index.ts +0 -0
- /package/{app → dist/__app__}/src/components/sidebar/DiagramsTree.module.css +0 -0
- /package/{app → dist/__app__}/src/components/sidebar/DiagramsTree.tsx +0 -0
- /package/{app → dist/__app__}/src/components/sidebar/Sidebar.tsx +0 -0
- /package/{app → dist/__app__}/src/components/sidebar/styles.module.css +0 -0
- /package/{app → dist/__app__}/src/components/view-page/ShareDialog.tsx +0 -0
- /package/{app → dist/__app__}/src/components/view-page/ViewActionsToolbar.tsx +0 -0
- /package/{app → dist/__app__}/src/data/atoms.ts +0 -0
- /package/{app → dist/__app__}/src/data/hooks.ts +0 -0
- /package/{app → dist/__app__}/src/data/index.ts +0 -0
- /package/{app → dist/__app__}/src/data/likec4.d.ts +0 -0
- /package/{app → dist/__app__}/src/data/sidebar-diagram-tree.ts +0 -0
- /package/{app → dist/__app__}/src/pages/export.module.css +0 -0
- /package/{app → dist/__app__}/src/pages/export.page.tsx +0 -0
- /package/{app → dist/__app__}/src/pages/index.module.css +0 -0
- /package/{app → dist/__app__}/src/pages/index.page.tsx +0 -0
- /package/{app → dist/__app__}/src/pages/index.ts +0 -0
- /package/{app → dist/__app__}/src/pages/view.page.tsx +0 -0
- /package/{app → dist/__app__}/src/router.ts +0 -0
- /package/{app → dist/__app__}/src/utils/index.ts +0 -0
- /package/{app → dist/__app__}/src/utils/utils.ts +0 -0
- /package/{app → dist/__app__}/tailwind.config.cjs +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ModelIndex } from '../model-index';
|
|
2
|
+
import type { Element, Relation } from '../types';
|
|
3
|
+
export declare const fakeElements: {
|
|
4
|
+
cloud: Element;
|
|
5
|
+
customer: Element;
|
|
6
|
+
support: Element;
|
|
7
|
+
amazon: Element;
|
|
8
|
+
'amazon.s3': Element;
|
|
9
|
+
'cloud.backend': Element;
|
|
10
|
+
'cloud.frontend': Element;
|
|
11
|
+
'cloud.backend.graphql': Element;
|
|
12
|
+
'cloud.backend.storage': Element;
|
|
13
|
+
'cloud.frontend.adminPanel': Element;
|
|
14
|
+
'cloud.frontend.dashboard': Element;
|
|
15
|
+
};
|
|
16
|
+
export type FakeElementIds = keyof typeof fakeElements;
|
|
17
|
+
export declare const fakeRelations: Relation[];
|
|
18
|
+
export type FakeRelationIds = keyof typeof fakeRelations;
|
|
19
|
+
export declare const fakeModel: () => ModelIndex;
|
|
20
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export declare const RelationColors: {
|
|
2
|
+
readonly lineColor: "#b1b1b1";
|
|
3
|
+
readonly labelColor: "#b1b1b1";
|
|
4
|
+
};
|
|
5
|
+
export declare const Colors: {
|
|
6
|
+
readonly primary: {
|
|
7
|
+
fill: "#3b82f6";
|
|
8
|
+
stroke: "#2563eb";
|
|
9
|
+
hiContrast: "#eff6ff";
|
|
10
|
+
loContrast: "#bfdbfe";
|
|
11
|
+
};
|
|
12
|
+
readonly blue: {
|
|
13
|
+
fill: "#3b82f6";
|
|
14
|
+
stroke: "#2563eb";
|
|
15
|
+
hiContrast: "#eff6ff";
|
|
16
|
+
loContrast: "#bfdbfe";
|
|
17
|
+
};
|
|
18
|
+
readonly secondary: {
|
|
19
|
+
fill: "#0284c7";
|
|
20
|
+
stroke: "#0369a1";
|
|
21
|
+
hiContrast: "#f0f9ff";
|
|
22
|
+
loContrast: "#e0f2fe";
|
|
23
|
+
};
|
|
24
|
+
readonly sky: {
|
|
25
|
+
fill: "#0284c7";
|
|
26
|
+
stroke: "#0369a1";
|
|
27
|
+
hiContrast: "#f0f9ff";
|
|
28
|
+
loContrast: "#e0f2fe";
|
|
29
|
+
};
|
|
30
|
+
readonly muted: {
|
|
31
|
+
fill: "#64748b";
|
|
32
|
+
stroke: "#475569";
|
|
33
|
+
hiContrast: "#f8fafc";
|
|
34
|
+
loContrast: "#e2e8f0";
|
|
35
|
+
};
|
|
36
|
+
readonly slate: {
|
|
37
|
+
fill: "#64748b";
|
|
38
|
+
stroke: "#475569";
|
|
39
|
+
hiContrast: "#f8fafc";
|
|
40
|
+
loContrast: "#e2e8f0";
|
|
41
|
+
};
|
|
42
|
+
readonly gray: {
|
|
43
|
+
readonly fill: "#737373";
|
|
44
|
+
readonly stroke: "#525252";
|
|
45
|
+
readonly hiContrast: "#fafafa";
|
|
46
|
+
readonly loContrast: "#e5e5e5";
|
|
47
|
+
};
|
|
48
|
+
readonly red: {
|
|
49
|
+
readonly fill: "#b54548";
|
|
50
|
+
readonly stroke: "#8c333a";
|
|
51
|
+
readonly hiContrast: "#f8fafc";
|
|
52
|
+
readonly loContrast: "#F9C6C6";
|
|
53
|
+
};
|
|
54
|
+
readonly green: {
|
|
55
|
+
readonly fill: "#428a4f";
|
|
56
|
+
readonly stroke: "#2d5d39";
|
|
57
|
+
readonly hiContrast: "#f8fafc";
|
|
58
|
+
readonly loContrast: "#c2f0c2";
|
|
59
|
+
};
|
|
60
|
+
readonly amber: {
|
|
61
|
+
readonly fill: "#d97706";
|
|
62
|
+
readonly stroke: "#b45309";
|
|
63
|
+
readonly hiContrast: "#f8fafc";
|
|
64
|
+
readonly loContrast: "#ffe0c2";
|
|
65
|
+
};
|
|
66
|
+
readonly indigo: {
|
|
67
|
+
readonly fill: "#6366f1";
|
|
68
|
+
readonly stroke: "#4f46e5";
|
|
69
|
+
readonly hiContrast: "#eef2ff";
|
|
70
|
+
readonly loContrast: "#c7d2fe";
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare const defaultTheme: {
|
|
74
|
+
readonly font: "Helvetica";
|
|
75
|
+
readonly shadow: "#0a0a0a";
|
|
76
|
+
readonly relation: {
|
|
77
|
+
readonly lineColor: "#b1b1b1";
|
|
78
|
+
readonly labelColor: "#b1b1b1";
|
|
79
|
+
};
|
|
80
|
+
readonly colors: {
|
|
81
|
+
readonly primary: {
|
|
82
|
+
fill: "#3b82f6";
|
|
83
|
+
stroke: "#2563eb";
|
|
84
|
+
hiContrast: "#eff6ff";
|
|
85
|
+
loContrast: "#bfdbfe";
|
|
86
|
+
};
|
|
87
|
+
readonly blue: {
|
|
88
|
+
fill: "#3b82f6";
|
|
89
|
+
stroke: "#2563eb";
|
|
90
|
+
hiContrast: "#eff6ff";
|
|
91
|
+
loContrast: "#bfdbfe";
|
|
92
|
+
};
|
|
93
|
+
readonly secondary: {
|
|
94
|
+
fill: "#0284c7";
|
|
95
|
+
stroke: "#0369a1";
|
|
96
|
+
hiContrast: "#f0f9ff";
|
|
97
|
+
loContrast: "#e0f2fe";
|
|
98
|
+
};
|
|
99
|
+
readonly sky: {
|
|
100
|
+
fill: "#0284c7";
|
|
101
|
+
stroke: "#0369a1";
|
|
102
|
+
hiContrast: "#f0f9ff";
|
|
103
|
+
loContrast: "#e0f2fe";
|
|
104
|
+
};
|
|
105
|
+
readonly muted: {
|
|
106
|
+
fill: "#64748b";
|
|
107
|
+
stroke: "#475569";
|
|
108
|
+
hiContrast: "#f8fafc";
|
|
109
|
+
loContrast: "#e2e8f0";
|
|
110
|
+
};
|
|
111
|
+
readonly slate: {
|
|
112
|
+
fill: "#64748b";
|
|
113
|
+
stroke: "#475569";
|
|
114
|
+
hiContrast: "#f8fafc";
|
|
115
|
+
loContrast: "#e2e8f0";
|
|
116
|
+
};
|
|
117
|
+
readonly gray: {
|
|
118
|
+
readonly fill: "#737373";
|
|
119
|
+
readonly stroke: "#525252";
|
|
120
|
+
readonly hiContrast: "#fafafa";
|
|
121
|
+
readonly loContrast: "#e5e5e5";
|
|
122
|
+
};
|
|
123
|
+
readonly red: {
|
|
124
|
+
readonly fill: "#b54548";
|
|
125
|
+
readonly stroke: "#8c333a";
|
|
126
|
+
readonly hiContrast: "#f8fafc";
|
|
127
|
+
readonly loContrast: "#F9C6C6";
|
|
128
|
+
};
|
|
129
|
+
readonly green: {
|
|
130
|
+
readonly fill: "#428a4f";
|
|
131
|
+
readonly stroke: "#2d5d39";
|
|
132
|
+
readonly hiContrast: "#f8fafc";
|
|
133
|
+
readonly loContrast: "#c2f0c2";
|
|
134
|
+
};
|
|
135
|
+
readonly amber: {
|
|
136
|
+
readonly fill: "#d97706";
|
|
137
|
+
readonly stroke: "#b45309";
|
|
138
|
+
readonly hiContrast: "#f8fafc";
|
|
139
|
+
readonly loContrast: "#ffe0c2";
|
|
140
|
+
};
|
|
141
|
+
readonly indigo: {
|
|
142
|
+
readonly fill: "#6366f1";
|
|
143
|
+
readonly stroke: "#4f46e5";
|
|
144
|
+
readonly hiContrast: "#eef2ff";
|
|
145
|
+
readonly loContrast: "#c7d2fe";
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const blue = {
|
|
2
|
+
// fill: colors.blue[500],
|
|
3
|
+
// stroke: colors.blue[600],
|
|
4
|
+
// hiContrast: colors.blue[50],
|
|
5
|
+
// loContrast: colors.blue[200],
|
|
6
|
+
fill: "#3b82f6",
|
|
7
|
+
stroke: "#2563eb",
|
|
8
|
+
hiContrast: "#eff6ff",
|
|
9
|
+
loContrast: "#bfdbfe"
|
|
10
|
+
};
|
|
11
|
+
const sky = {
|
|
12
|
+
// fill: colors.sky[600],
|
|
13
|
+
// stroke: colors.sky[700],
|
|
14
|
+
// hiContrast: colors.sky[50],
|
|
15
|
+
// loContrast: colors.sky[100],
|
|
16
|
+
fill: "#0284c7",
|
|
17
|
+
stroke: "#0369a1",
|
|
18
|
+
hiContrast: "#f0f9ff",
|
|
19
|
+
loContrast: "#e0f2fe"
|
|
20
|
+
};
|
|
21
|
+
const slate = {
|
|
22
|
+
// fill: colors.slate[500],
|
|
23
|
+
// stroke: colors.slate[600],
|
|
24
|
+
// hiContrast: colors.slate[50],
|
|
25
|
+
// loContrast: colors.slate[200],
|
|
26
|
+
fill: "#64748b",
|
|
27
|
+
stroke: "#475569",
|
|
28
|
+
hiContrast: "#f8fafc",
|
|
29
|
+
loContrast: "#e2e8f0"
|
|
30
|
+
};
|
|
31
|
+
export const RelationColors = {
|
|
32
|
+
lineColor: "#b1b1b1",
|
|
33
|
+
labelColor: "#b1b1b1"
|
|
34
|
+
};
|
|
35
|
+
export const Colors = {
|
|
36
|
+
primary: blue,
|
|
37
|
+
blue,
|
|
38
|
+
secondary: sky,
|
|
39
|
+
sky,
|
|
40
|
+
muted: slate,
|
|
41
|
+
slate,
|
|
42
|
+
gray: {
|
|
43
|
+
// fill: colors.neutral[500],
|
|
44
|
+
// stroke: colors.neutral[600],
|
|
45
|
+
// hiContrast: colors.neutral[50],
|
|
46
|
+
// loContrast: colors.neutral[200],
|
|
47
|
+
fill: "#737373",
|
|
48
|
+
stroke: "#525252",
|
|
49
|
+
hiContrast: "#fafafa",
|
|
50
|
+
loContrast: "#e5e5e5"
|
|
51
|
+
},
|
|
52
|
+
red: {
|
|
53
|
+
// fill: colors.red[500],
|
|
54
|
+
// stroke: colors.red[600],
|
|
55
|
+
// hiContrast: colors.red[50],
|
|
56
|
+
// loContrast: colors.red[200],
|
|
57
|
+
fill: "#b54548",
|
|
58
|
+
stroke: "#8c333a",
|
|
59
|
+
// hiContrast: '#fef2f2',
|
|
60
|
+
// loContrast: '#fecaca',
|
|
61
|
+
// hiContrast: '#191111', // colors.gray[900],
|
|
62
|
+
// loContrast: '#3b1219' // colors.gray[800],
|
|
63
|
+
hiContrast: "#f8fafc",
|
|
64
|
+
// hiContrast: '#f8fafc',
|
|
65
|
+
// loContrast: '#fdd8d8' // radix black red 12
|
|
66
|
+
loContrast: "#F9C6C6"
|
|
67
|
+
},
|
|
68
|
+
green: {
|
|
69
|
+
fill: "#428a4f",
|
|
70
|
+
stroke: "#2d5d39",
|
|
71
|
+
hiContrast: "#f8fafc",
|
|
72
|
+
loContrast: "#c2f0c2"
|
|
73
|
+
},
|
|
74
|
+
amber: {
|
|
75
|
+
// fill: colors.amber[600],
|
|
76
|
+
// stroke: colors.amber[700],
|
|
77
|
+
// hiContrast: colors.amber[50],
|
|
78
|
+
// loContrast: colors.amber[200],
|
|
79
|
+
fill: "#d97706",
|
|
80
|
+
stroke: "#b45309",
|
|
81
|
+
// hiContrast: '#fffbeb',
|
|
82
|
+
// loContrast: '#fde68a',
|
|
83
|
+
hiContrast: "#f8fafc",
|
|
84
|
+
// colors.gray[900],
|
|
85
|
+
loContrast: "#ffe0c2"
|
|
86
|
+
// colors.gray[800],
|
|
87
|
+
},
|
|
88
|
+
indigo: {
|
|
89
|
+
// fill: colors.indigo[500],
|
|
90
|
+
// stroke: colors.indigo[600],
|
|
91
|
+
// hiContrast: colors.indigo[50],
|
|
92
|
+
// loContrast: colors.indigo[200],
|
|
93
|
+
fill: "#6366f1",
|
|
94
|
+
stroke: "#4f46e5",
|
|
95
|
+
hiContrast: "#eef2ff",
|
|
96
|
+
loContrast: "#c7d2fe"
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
export const defaultTheme = {
|
|
100
|
+
font: "Helvetica",
|
|
101
|
+
shadow: "#0a0a0a",
|
|
102
|
+
relation: RelationColors,
|
|
103
|
+
colors: Colors
|
|
104
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { keys, pluck } from "rambdax";
|
|
2
|
+
import { commonAncestor, compareRelations } from "../utils/index.js";
|
|
3
|
+
export class EdgeBuilder {
|
|
4
|
+
_relationsObj = {};
|
|
5
|
+
add(source, target, relation) {
|
|
6
|
+
const bySource = this._relationsObj[source] ?? {};
|
|
7
|
+
const relations = bySource[target] ?? [];
|
|
8
|
+
relations.push(relation);
|
|
9
|
+
bySource[target] = relations;
|
|
10
|
+
this._relationsObj[source] = bySource;
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
build() {
|
|
14
|
+
return keys(this._relationsObj).flatMap((source) => {
|
|
15
|
+
const targets = this._relationsObj[source] ?? {};
|
|
16
|
+
return keys(targets).map((target) => {
|
|
17
|
+
const relations = (targets[target] ?? []).sort(compareRelations);
|
|
18
|
+
const label = relations.find((r) => r.title !== "")?.title ?? null;
|
|
19
|
+
return {
|
|
20
|
+
id: `${source}:${target}`,
|
|
21
|
+
parent: commonAncestor(source, target),
|
|
22
|
+
source,
|
|
23
|
+
target,
|
|
24
|
+
label,
|
|
25
|
+
relations: pluck("id", relations)
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}).sort(compareRelations).reverse();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ModelIndex } from '../model-index';
|
|
2
|
+
import type { Fqn, Element, Relation, ViewRuleExpression, ElementView } from '../types';
|
|
3
|
+
export type ComputeCtxPatch = {
|
|
4
|
+
elements?: Element[];
|
|
5
|
+
relations?: Relation[];
|
|
6
|
+
implicits?: Element[];
|
|
7
|
+
};
|
|
8
|
+
export declare class ComputeCtx {
|
|
9
|
+
index: ModelIndex;
|
|
10
|
+
root: Fqn | null;
|
|
11
|
+
elements: ReadonlySet<Element>;
|
|
12
|
+
relations: ReadonlySet<Relation>;
|
|
13
|
+
implicits: ReadonlySet<Element>;
|
|
14
|
+
readonly allElements: ReadonlySet<Element>;
|
|
15
|
+
constructor(index: ModelIndex, root: Fqn | null, elements?: ReadonlySet<Element>, relations?: ReadonlySet<Relation>, implicits?: ReadonlySet<Element>);
|
|
16
|
+
include({ elements, relations, implicits }: ComputeCtxPatch): ComputeCtx;
|
|
17
|
+
exclude({ elements, relations, implicits }: ComputeCtxPatch): ComputeCtx;
|
|
18
|
+
processViewRules(viewRules: ViewRuleExpression[]): ComputeCtx;
|
|
19
|
+
static create(view: ElementView, index: ModelIndex): ComputeCtx;
|
|
20
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { difference } from "rambdax";
|
|
2
|
+
import { Expr, isStrictElementView, isViewRuleExpression } from "../types/index.js";
|
|
3
|
+
import {
|
|
4
|
+
excludeElementKindOrTag,
|
|
5
|
+
excludeElementRef,
|
|
6
|
+
excludeInOutExpr,
|
|
7
|
+
excludeIncomingExpr,
|
|
8
|
+
excludeOutgoingExpr,
|
|
9
|
+
excludeRelationExpr,
|
|
10
|
+
excludeWildcardRef,
|
|
11
|
+
includeElementKindOrTag,
|
|
12
|
+
includeElementRef,
|
|
13
|
+
includeInOutExpr,
|
|
14
|
+
includeIncomingExpr,
|
|
15
|
+
includeOutgoingExpr,
|
|
16
|
+
includeRelationExpr,
|
|
17
|
+
includeWildcardRef
|
|
18
|
+
} from "./compute-predicates.js";
|
|
19
|
+
import { nonexhaustive } from "../errors/index.js";
|
|
20
|
+
export class ComputeCtx {
|
|
21
|
+
constructor(index, root, elements = /* @__PURE__ */ new Set(), relations = /* @__PURE__ */ new Set(), implicits = /* @__PURE__ */ new Set()) {
|
|
22
|
+
this.index = index;
|
|
23
|
+
this.root = root;
|
|
24
|
+
this.elements = elements;
|
|
25
|
+
this.relations = relations;
|
|
26
|
+
this.implicits = implicits;
|
|
27
|
+
this.allElements = /* @__PURE__ */ new Set([...this.elements, ...this.implicits]);
|
|
28
|
+
}
|
|
29
|
+
allElements;
|
|
30
|
+
include({ elements, relations, implicits }) {
|
|
31
|
+
return new ComputeCtx(
|
|
32
|
+
this.index,
|
|
33
|
+
this.root,
|
|
34
|
+
elements ? /* @__PURE__ */ new Set([...this.elements, ...elements]) : this.elements,
|
|
35
|
+
relations ? /* @__PURE__ */ new Set([...this.relations, ...relations]) : this.relations,
|
|
36
|
+
implicits ? /* @__PURE__ */ new Set([...this.implicits, ...implicits]) : this.implicits
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
exclude({ elements, relations, implicits }) {
|
|
40
|
+
let newImplicits = implicits ? new Set(difference([...this.implicits], implicits)) : this.implicits;
|
|
41
|
+
if (elements) {
|
|
42
|
+
newImplicits = new Set(difference([...newImplicits], elements));
|
|
43
|
+
}
|
|
44
|
+
return new ComputeCtx(
|
|
45
|
+
this.index,
|
|
46
|
+
this.root,
|
|
47
|
+
elements ? new Set(difference([...this.elements], elements)) : this.elements,
|
|
48
|
+
relations ? new Set(difference([...this.relations], relations)) : this.relations,
|
|
49
|
+
newImplicits
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
processViewRules(viewRules) {
|
|
53
|
+
let ctx = this;
|
|
54
|
+
for (const { isInclude, exprs } of viewRules) {
|
|
55
|
+
for (const expr of exprs) {
|
|
56
|
+
if (Expr.isElementKindExpr(expr) || Expr.isElementTagExpr(expr)) {
|
|
57
|
+
ctx = isInclude ? includeElementKindOrTag(ctx, expr) : excludeElementKindOrTag(ctx, expr);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (Expr.isElementRef(expr)) {
|
|
61
|
+
ctx = isInclude ? includeElementRef(ctx, expr) : excludeElementRef(ctx, expr);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (Expr.isWildcard(expr)) {
|
|
65
|
+
ctx = isInclude ? includeWildcardRef(ctx, expr) : excludeWildcardRef(ctx, expr);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (Expr.isIncoming(expr)) {
|
|
69
|
+
ctx = isInclude ? includeIncomingExpr(ctx, expr) : excludeIncomingExpr(ctx, expr);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (Expr.isOutgoing(expr)) {
|
|
73
|
+
ctx = isInclude ? includeOutgoingExpr(ctx, expr) : excludeOutgoingExpr(ctx, expr);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (Expr.isInOut(expr)) {
|
|
77
|
+
ctx = isInclude ? includeInOutExpr(ctx, expr) : excludeInOutExpr(ctx, expr);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (Expr.isRelation(expr)) {
|
|
81
|
+
ctx = isInclude ? includeRelationExpr(ctx, expr) : excludeRelationExpr(ctx, expr);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
nonexhaustive(expr);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return ctx;
|
|
88
|
+
}
|
|
89
|
+
static create(view, index) {
|
|
90
|
+
const rootElement = isStrictElementView(view) ? view.viewOf : null;
|
|
91
|
+
let ctx = new ComputeCtx(index, rootElement);
|
|
92
|
+
const rulesInclude = view.rules.filter(isViewRuleExpression);
|
|
93
|
+
if (rootElement && rulesInclude.length == 0) {
|
|
94
|
+
ctx = ctx.include({
|
|
95
|
+
elements: [index.find(rootElement)]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return ctx.processViewRules(rulesInclude);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { allPass, find } from "remeda";
|
|
2
|
+
import { nonNullable } from "../errors/index.js";
|
|
3
|
+
import {
|
|
4
|
+
DefaultElementShape,
|
|
5
|
+
DefaultThemeColor,
|
|
6
|
+
isViewRuleAutoLayout,
|
|
7
|
+
isViewRuleStyle
|
|
8
|
+
} from "../types/index.js";
|
|
9
|
+
import { compareByFqnHierarchically, isAncestor, isSameHierarchy, parentFqn } from "../utils/index.js";
|
|
10
|
+
import { EdgeBuilder } from "./EdgeBuilder.js";
|
|
11
|
+
import { ComputeCtx } from "./compute-ctx.js";
|
|
12
|
+
import { applyViewRuleStyles } from "./utils/applyViewRuleStyles.js";
|
|
13
|
+
import { sortNodes } from "./utils/sortNodes.js";
|
|
14
|
+
function reduceToMap(elementsIterator) {
|
|
15
|
+
return Array.from(elementsIterator).sort(compareByFqnHierarchically).reduce((map, { id, color, shape, ...el }) => {
|
|
16
|
+
let parent = parentFqn(id);
|
|
17
|
+
let level = 0;
|
|
18
|
+
while (parent) {
|
|
19
|
+
if (map.has(parent)) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
parent = parentFqn(parent);
|
|
23
|
+
}
|
|
24
|
+
if (parent) {
|
|
25
|
+
const parentNd = nonNullable(map.get(parent));
|
|
26
|
+
parentNd.children.push(id);
|
|
27
|
+
level = parentNd.level + 1;
|
|
28
|
+
}
|
|
29
|
+
const node = {
|
|
30
|
+
...el,
|
|
31
|
+
id,
|
|
32
|
+
parent,
|
|
33
|
+
level,
|
|
34
|
+
color: color ?? DefaultThemeColor,
|
|
35
|
+
shape: shape ?? DefaultElementShape,
|
|
36
|
+
children: [],
|
|
37
|
+
inEdges: [],
|
|
38
|
+
outEdges: []
|
|
39
|
+
};
|
|
40
|
+
map.set(id, node);
|
|
41
|
+
return map;
|
|
42
|
+
}, /* @__PURE__ */ new Map());
|
|
43
|
+
}
|
|
44
|
+
const keepOriginalSortFromView = (_nodes, ctx) => {
|
|
45
|
+
const nodes = [...ctx.allElements].flatMap((e) => _nodes.get(e.id) || []);
|
|
46
|
+
for (const node of nodes) {
|
|
47
|
+
node.children = nodes.flatMap((n) => n.parent === node.id ? n.id : []);
|
|
48
|
+
}
|
|
49
|
+
return nodes;
|
|
50
|
+
};
|
|
51
|
+
export function computeElementView(view, index) {
|
|
52
|
+
const ctx = ComputeCtx.create(view, index);
|
|
53
|
+
const leafsFirst = [...ctx.allElements].sort((a, b) => -1 * compareByFqnHierarchically(a, b));
|
|
54
|
+
const elementsWithRelations = /* @__PURE__ */ new Set();
|
|
55
|
+
const edgeBuilder = new EdgeBuilder();
|
|
56
|
+
const anscestorOf = (id) => (e) => e.id === id || isAncestor(e.id, id);
|
|
57
|
+
const sortedRelations = [...ctx.relations];
|
|
58
|
+
for (const rel of sortedRelations) {
|
|
59
|
+
const source = find(leafsFirst, anscestorOf(rel.source));
|
|
60
|
+
if (!source) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const target = find(
|
|
64
|
+
leafsFirst,
|
|
65
|
+
allPass([anscestorOf(rel.target), (e) => !isSameHierarchy(e, source)])
|
|
66
|
+
);
|
|
67
|
+
if (!target) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
elementsWithRelations.add(source);
|
|
71
|
+
elementsWithRelations.add(target);
|
|
72
|
+
edgeBuilder.add(source.id, target.id, rel);
|
|
73
|
+
}
|
|
74
|
+
const nodesMap = reduceToMap(/* @__PURE__ */ new Set([...ctx.elements, ...elementsWithRelations]));
|
|
75
|
+
const edges = edgeBuilder.build().map((edge) => {
|
|
76
|
+
while (edge.parent) {
|
|
77
|
+
if (nodesMap.has(edge.parent)) {
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
edge.parent = parentFqn(edge.parent);
|
|
81
|
+
}
|
|
82
|
+
nonNullable(nodesMap.get(edge.source)).outEdges.push(edge.id);
|
|
83
|
+
nonNullable(nodesMap.get(edge.target)).inEdges.push(edge.id);
|
|
84
|
+
return edge;
|
|
85
|
+
});
|
|
86
|
+
const nodes = applyViewRuleStyles(
|
|
87
|
+
view.rules.filter(isViewRuleStyle),
|
|
88
|
+
sortNodes(keepOriginalSortFromView(nodesMap, ctx), edges)
|
|
89
|
+
// map(e => nodesMap.get(e.id)!, Array.from(elements))
|
|
90
|
+
);
|
|
91
|
+
const autoLayoutRule = view.rules.find(isViewRuleAutoLayout);
|
|
92
|
+
return {
|
|
93
|
+
...view,
|
|
94
|
+
autoLayout: autoLayoutRule?.autoLayout ?? "TB",
|
|
95
|
+
nodes,
|
|
96
|
+
edges
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Expr } from '../types';
|
|
2
|
+
import { ComputeCtx } from './compute-ctx';
|
|
3
|
+
export declare const includeElementRef: (ctx: ComputeCtx, expr: Expr.ElementRefExpr) => ComputeCtx;
|
|
4
|
+
export declare const excludeElementRef: (ctx: ComputeCtx, expr: Expr.ElementRefExpr) => ComputeCtx;
|
|
5
|
+
export declare const includeElementKindOrTag: (ctx: ComputeCtx, expr: Expr.ElementKindExpr | Expr.ElementTagExpr) => ComputeCtx;
|
|
6
|
+
export declare const excludeElementKindOrTag: (ctx: ComputeCtx, expr: Expr.ElementKindExpr | Expr.ElementTagExpr) => ComputeCtx;
|
|
7
|
+
export declare const includeWildcardRef: (ctx: ComputeCtx, _expr: Expr.WildcardExpr) => ComputeCtx;
|
|
8
|
+
export declare const excludeWildcardRef: (ctx: ComputeCtx, _expr: Expr.WildcardExpr) => ComputeCtx;
|
|
9
|
+
export declare const includeIncomingExpr: (ctx: ComputeCtx, expr: Expr.IncomingExpr) => ComputeCtx;
|
|
10
|
+
export declare const excludeIncomingExpr: (ctx: ComputeCtx, expr: Expr.IncomingExpr) => ComputeCtx;
|
|
11
|
+
export declare const includeOutgoingExpr: (ctx: ComputeCtx, expr: Expr.OutgoingExpr) => ComputeCtx;
|
|
12
|
+
export declare const excludeOutgoingExpr: (ctx: ComputeCtx, expr: Expr.OutgoingExpr) => ComputeCtx;
|
|
13
|
+
export declare const includeInOutExpr: (ctx: ComputeCtx, expr: Expr.InOutExpr) => ComputeCtx;
|
|
14
|
+
export declare const excludeInOutExpr: (ctx: ComputeCtx, expr: Expr.InOutExpr) => ComputeCtx;
|
|
15
|
+
export declare const includeRelationExpr: (ctx: ComputeCtx, expr: Expr.RelationExpr) => ComputeCtx;
|
|
16
|
+
export declare const excludeRelationExpr: (ctx: ComputeCtx, expr: Expr.RelationExpr) => ComputeCtx;
|