@likec4/diagram 1.0.0-next.0

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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/dist/EmbeddedLikeC4Diagram.css.d.ts +6 -0
  4. package/dist/EmbeddedLikeC4Diagram.d.ts +18 -0
  5. package/dist/LikeC4Diagram.css.d.ts +5 -0
  6. package/dist/LikeC4Diagram.d.ts +5 -0
  7. package/dist/LikeC4Diagram.props.d.ts +118 -0
  8. package/dist/StaticLikeC4Diagram.d.ts +5 -0
  9. package/dist/bundle.d.ts +12 -0
  10. package/dist/bundle.js +30 -0
  11. package/dist/hooks/index.d.ts +3 -0
  12. package/dist/hooks/use-set-state.d.ts +2 -0
  13. package/dist/hooks/use-update-effect.d.ts +4 -0
  14. package/dist/icons/Clipboard.d.ts +4 -0
  15. package/dist/icons/Link.d.ts +4 -0
  16. package/dist/icons/ZoomIn.d.ts +4 -0
  17. package/dist/icons/index.d.ts +4 -0
  18. package/dist/index-DClug9zV.js +23964 -0
  19. package/dist/index.css.d.ts +2 -0
  20. package/dist/index.d.ts +7 -0
  21. package/dist/index.js +1 -0
  22. package/dist/mantine/EnsureMantine.d.ts +7 -0
  23. package/dist/mantine/index.d.ts +3 -0
  24. package/dist/state/DiagramState.d.ts +162 -0
  25. package/dist/state/index.d.ts +2 -0
  26. package/dist/style.css +1 -0
  27. package/dist/theme.css.d.ts +44 -0
  28. package/dist/ui/Camera.d.ts +4 -0
  29. package/dist/ui/KeepAspectRatio.css.d.ts +2 -0
  30. package/dist/ui/KeepAspectRatio.d.ts +10 -0
  31. package/dist/ui/OptionsPanel.css.d.ts +2 -0
  32. package/dist/ui/OptionsPanel.d.ts +4 -0
  33. package/dist/ui/index.d.ts +3 -0
  34. package/dist/ui/options/NodeOptions.d.ts +21 -0
  35. package/dist/xyflow/FitviewOnDiagramChange.d.ts +6 -0
  36. package/dist/xyflow/UpdateOnDiagramChange.d.ts +10 -0
  37. package/dist/xyflow/XYFlowBackground.d.ts +11 -0
  38. package/dist/xyflow/XYFlowEvents.d.ts +25 -0
  39. package/dist/xyflow/XYFlowWrapper.d.ts +15 -0
  40. package/dist/xyflow/const.d.ts +7 -0
  41. package/dist/xyflow/diagram-to-xyflow.d.ts +5 -0
  42. package/dist/xyflow/edges/RelationshipEdge.d.ts +32 -0
  43. package/dist/xyflow/edges/edges.css.d.ts +7 -0
  44. package/dist/xyflow/edges/utils.d.ts +13 -0
  45. package/dist/xyflow/hooks/index.d.ts +37 -0
  46. package/dist/xyflow/hooks/use-layout-/321/201onstraints.d.ts +11 -0
  47. package/dist/xyflow/nodes/compound/CompoundNode.css.d.ts +6 -0
  48. package/dist/xyflow/nodes/compound/CompoundNode.d.ts +7 -0
  49. package/dist/xyflow/nodes/compound/index.d.ts +2 -0
  50. package/dist/xyflow/nodes/element/ElementIcon.d.ts +11 -0
  51. package/dist/xyflow/nodes/element/ElementLink.css.d.ts +4 -0
  52. package/dist/xyflow/nodes/element/ElementLink.d.ts +8 -0
  53. package/dist/xyflow/nodes/element/ElementNode.d.ts +7 -0
  54. package/dist/xyflow/nodes/element/ElementShapeSvg.d.ts +14 -0
  55. package/dist/xyflow/nodes/element/element.css.d.ts +15 -0
  56. package/dist/xyflow/nodes/element/index.d.ts +2 -0
  57. package/dist/xyflow/nodes/shared/NavigateToBtn.d.ts +7 -0
  58. package/dist/xyflow/types.d.ts +76 -0
  59. package/dist/xyflow/utils.d.ts +5 -0
  60. package/package.json +110 -0
@@ -0,0 +1,15 @@
1
+ export declare const stokeFillMix: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
2
+ export declare const container: string;
3
+ export declare const indicator: string;
4
+ export declare const fillElementFill: string;
5
+ export declare const fillElementStroke: string;
6
+ export declare const fillMixStroke: string;
7
+ export declare const title: string;
8
+ export declare const description: string;
9
+ export declare const technology: string;
10
+ export declare const cssElement: string;
11
+ export declare const iconMaxH: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
12
+ export declare const elementIcon: string;
13
+ export declare const cssShapeSvg: string;
14
+ export declare const cssNavigateBtn: string;
15
+ //# sourceMappingURL=element.css.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { ElementNodeMemo as ElementNode } from './ElementNode';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export type NavigateToBtnProps = {
3
+ xynodeId: string;
4
+ className?: string;
5
+ };
6
+ export declare function NavigateToBtn({ xynodeId, className }: NavigateToBtnProps): JSX.Element;
7
+ //# sourceMappingURL=NavigateToBtn.d.ts.map
@@ -0,0 +1,76 @@
1
+ import { SetReadonly, SetRequired, Simplify } from 'type-fest';
2
+ import { Edge, Node, ReactFlowInstance } from '@xyflow/react';
3
+ import { BBox, DiagramEdge, DiagramNode, Point } from '@likec4/core';
4
+
5
+ export type ElementNodeData = {
6
+ id: string;
7
+ element: DiagramNode;
8
+ };
9
+ type TypedXYFlowNode<D extends Record<string, unknown>, T extends string> = SetReadonly<SetRequired<Node<D, T>, 'type'>, 'id' | 'type'>;
10
+ export type ElementXYFlowNode = TypedXYFlowNode<ElementNodeData, 'element'>;
11
+ export type CompoundNodeData = {
12
+ id: string;
13
+ element: DiagramNode;
14
+ };
15
+ export type CompoundXYFlowNode = TypedXYFlowNode<CompoundNodeData, 'compound'>;
16
+ export type XYFlowNode = ElementXYFlowNode | CompoundXYFlowNode;
17
+ export declare namespace XYFlowNode {
18
+ type Data = ElementNodeData | CompoundNodeData;
19
+ function isCompound(node: unknown): node is CompoundXYFlowNode;
20
+ function isElement(node: Node): node is ElementXYFlowNode;
21
+ const is: (node: Node) => node is XYFlowNode;
22
+ }
23
+ export type RelationshipData = {
24
+ edge: DiagramEdge;
25
+ controlPoints: Point[];
26
+ headPoint: Point | null;
27
+ tailPoint: Point | null;
28
+ type: 'bezier' | 'poly';
29
+ label: null | {
30
+ bbox: BBox;
31
+ text: string;
32
+ };
33
+ };
34
+ export type RelationshipEdge = Simplify<SetRequired<Omit<Edge<RelationshipData>, 'type'>, 'data'> & {
35
+ type: 'relationship';
36
+ }>;
37
+ export type XYFlowEdge = RelationshipEdge;
38
+ export declare namespace XYFlowEdge {
39
+ type Data = RelationshipData;
40
+ const isRelationship: (e: Edge) => e is {
41
+ source: string;
42
+ target: string;
43
+ style?: import('react').CSSProperties;
44
+ id: string;
45
+ hidden?: boolean;
46
+ selected?: boolean;
47
+ selectable?: boolean;
48
+ deletable?: boolean;
49
+ zIndex?: number;
50
+ ariaLabel?: string;
51
+ className?: string;
52
+ focusable?: boolean;
53
+ label?: import('react').ReactNode;
54
+ sourceHandle?: string | null;
55
+ targetHandle?: string | null;
56
+ animated?: boolean;
57
+ markerStart?: import('@xyflow/react').EdgeMarkerType;
58
+ markerEnd?: import('@xyflow/react').EdgeMarkerType;
59
+ interactionWidth?: number;
60
+ labelStyle?: import('react').CSSProperties;
61
+ labelShowBg?: boolean;
62
+ labelBgStyle?: import('react').CSSProperties;
63
+ labelBgPadding?: [number, number];
64
+ labelBgBorderRadius?: number;
65
+ updatable?: import('@xyflow/react').EdgeUpdatable;
66
+ data: RelationshipData;
67
+ type: "relationship";
68
+ };
69
+ }
70
+ export type XYFlowInstance = ReactFlowInstance<XYFlowNode, XYFlowEdge>;
71
+ export type XYFlowData = {
72
+ nodes: XYFlowNode[];
73
+ edges: XYFlowEdge[];
74
+ };
75
+ export {};
76
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { XYPosition } from '@xyflow/react';
2
+
3
+ export declare function toDomPrecision(v: number | null): number;
4
+ export declare function distance(a: XYPosition, b: XYPosition): number;
5
+ //# sourceMappingURL=utils.d.ts.map
package/package.json ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "@likec4/diagram",
3
+ "version": "1.0.0-next.0",
4
+ "license": "MIT",
5
+ "bugs": "https://github.com/likec4/likec4/issues",
6
+ "homepage": "https://likec4.dev",
7
+ "author": "Denis Davydkov <denis@davydkov.com>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/likec4/likec4.git",
11
+ "directory": "packages/diagram"
12
+ },
13
+ "files": [
14
+ "package.json",
15
+ "LICENSE",
16
+ "README.md",
17
+ "dist",
18
+ "!**/*.spec.*",
19
+ "!**/*.map"
20
+ ],
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./style.css": "./dist/style.css",
28
+ "./bundle": {
29
+ "types": "./dist/bundle.d.ts",
30
+ "default": "./dist/bundle.js"
31
+ }
32
+ },
33
+ "publishConfig": {
34
+ "registry": "https://registry.npmjs.org",
35
+ "access": "public",
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "default": "./dist/index.js"
40
+ },
41
+ "./style.css": "./dist/style.css",
42
+ "./bundle": {
43
+ "types": "./dist/bundle.d.ts",
44
+ "default": "./dist/bundle.js"
45
+ }
46
+ }
47
+ },
48
+ "packageManager": "yarn@4.0.2",
49
+ "scripts": {
50
+ "typecheck": "tsc --emitDeclarationOnly --declaration --declarationMap",
51
+ "build:turbo": "run -T turbo build --filter='diagram'",
52
+ "build": "vite build && run typecheck",
53
+ "lint": "run -T eslint src/ --fix",
54
+ "clean": "run -T rimraf dist bundle"
55
+ },
56
+ "peerDependencies": {
57
+ "@mantine/core": "^7.7.0",
58
+ "@mantine/hooks": "^7.7.0",
59
+ "react": "^18.2.0",
60
+ "react-dom": "^18.2.0",
61
+ "scheduler": "^0.23.0"
62
+ },
63
+ "peerDependenciesMeta": {
64
+ "@mantine/core": {
65
+ "optional": true
66
+ },
67
+ "@mantine/hooks": {
68
+ "optional": true
69
+ },
70
+ "scheduler": {
71
+ "optional": true
72
+ }
73
+ },
74
+ "devDependencies": {
75
+ "@likec4/core": "1.0.0-next.0",
76
+ "@lume/kiwi": "^0.4.3",
77
+ "@mantine/core": "^7.7.0",
78
+ "@mantine/hooks": "^7.7.0",
79
+ "@mantine/vanilla-extract": "^7.7.0",
80
+ "@react-hookz/deep-equal": "^2.0.2",
81
+ "@react-hookz/web": "^24.0.4",
82
+ "@total-typescript/ts-reset": "^0.5.1",
83
+ "@types/react": "^18.2.0",
84
+ "@types/react-dom": "^18.2.0",
85
+ "@vanilla-extract/css": "^1.14.1",
86
+ "@vanilla-extract/dynamic": "^2.1.0",
87
+ "@vanilla-extract/esbuild-plugin": "^2.3.5",
88
+ "@vanilla-extract/recipes": "^0.5.2",
89
+ "@vitejs/plugin-react": "^4.2.1",
90
+ "@xyflow/react": "^12.0.0-next.12",
91
+ "clsx": "^2.1.0",
92
+ "execa": "^8.0.1",
93
+ "fast-equals": "^5.0.1",
94
+ "framer-motion": "^11.0.22",
95
+ "khroma": "^2.1.0",
96
+ "react": "^18.2.0",
97
+ "react-dom": "^18.2.0",
98
+ "react-tracked": "^1.7.11",
99
+ "remeda": "^1.56.0",
100
+ "scheduler": "^0.23.0",
101
+ "terser": "^5.30.0",
102
+ "tilg": "^0.1.1",
103
+ "type-fest": "^4.13.1",
104
+ "typescript": "^5.4.3",
105
+ "unbuild": "^2.0.0",
106
+ "vite": "^5.2.6",
107
+ "vite-plugin-dts": "^3.8.1",
108
+ "vite-plugin-shadow-style": "^1.1.0"
109
+ }
110
+ }