@likec4/generators 0.33.0 → 0.34.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.
@@ -1,4 +1,4 @@
1
- import { CompositeGeneratorNode, NL, joinToNode, toString } from 'langium/lib/generator';
1
+ import { CompositeGeneratorNode, NL, joinToNode, toString } from 'langium';
2
2
  import { isNil } from 'rambdax';
3
3
  const capitalizeFirstLetter = (value) => value.charAt(0).toLocaleUpperCase() + value.slice(1);
4
4
  const fqnName = (nodeId) => nodeId.split('.').map(capitalizeFirstLetter).join('');
@@ -7,17 +7,17 @@ const nodeName = (node) => {
7
7
  };
8
8
  const d2direction = ({ autoLayout }) => {
9
9
  switch (autoLayout) {
10
- case "TB": {
11
- return "down";
10
+ case 'TB': {
11
+ return 'down';
12
12
  }
13
- case "BT": {
14
- return "up";
13
+ case 'BT': {
14
+ return 'up';
15
15
  }
16
- case "LR": {
17
- return "right";
16
+ case 'LR': {
17
+ return 'right';
18
18
  }
19
- case "RL": {
20
- return "left";
19
+ case 'RL': {
20
+ return 'left';
21
21
  }
22
22
  }
23
23
  };
@@ -1,3 +1,3 @@
1
- import type { DiagramView } from '@likec4/core/types';
1
+ import type { DiagramView } from '@likec4/core';
2
2
  export declare function generateReact(views: DiagramView[]): string;
3
3
  //# sourceMappingURL=generate-react.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import JSON5 from 'json5';
2
- import { CompositeGeneratorNode, NL, expandToNode, joinToNode, toString } from 'langium/lib/generator';
2
+ import { CompositeGeneratorNode, NL, expandToNode, joinToNode, toString } from 'langium';
3
3
  const componentName = (value) => {
4
4
  if (!value.charAt(0).match(/[a-zA-Z]/)) {
5
5
  value = 'View' + value;
@@ -37,6 +37,7 @@ export function generateReact(views) {
37
37
  export type LikeC4ViewId = ${generateViewId(views)};
38
38
  export const LikeC4Views = {
39
39
  `
40
+ .appendNewLine()
40
41
  .indent({
41
42
  indentation: 2,
42
43
  indentedChildren: indent => {
@@ -51,37 +52,37 @@ export function generateReact(views) {
51
52
 
52
53
  export const {
53
54
  isViewId,
55
+ useViewId,
54
56
  Diagram,
55
57
  Responsive,
58
+ Fullscreen,
56
59
  Embedded,
57
- Browser
58
- } = LikeC4.create(LikeC4Views)
60
+ Browser,
61
+ } = LikeC4.create<LikeC4ViewId>(LikeC4Views)
59
62
 
60
- export type DiagramProps = LikeC4.Props<LikeC4ViewId>
63
+ export type DiagramProps = LikeC4.DiagramProps<LikeC4ViewId>
61
64
  export type ResponsiveProps = LikeC4.ResponsiveProps<LikeC4ViewId>
65
+ export type FullscreenProps = LikeC4.FullscreenProps<LikeC4ViewId>
62
66
  export type EmbeddedProps = LikeC4.EmbeddedProps<LikeC4ViewId>
63
67
  export type BrowserProps = LikeC4.BrowserProps<LikeC4ViewId>
64
68
 
65
- `.append(NL, NL).appendTemplate `
66
- export type {
67
- DiagramApi
68
- } from '@likec4/diagrams'
69
-
69
+ // Re-export types
70
70
  export type {
71
+ DiagramApi,
71
72
  Fqn,
72
73
  Element,
73
74
  RelationID,
74
75
  Relation,
75
76
  NodeId,
76
77
  EdgeId,
77
- ComputedNode,
78
- ComputedEdge,
78
+ ViewID,
79
79
  ComputedView,
80
- DiagramView,
80
+ LikeC4Theme,
81
81
  DiagramNode,
82
82
  DiagramEdge,
83
- DiagramLabel
84
- } from '@likec4/core'
83
+ DiagramLabel,
84
+ DiagramView
85
+ } from '@likec4/diagrams'
85
86
  `.append(NL, NL);
86
87
  return toString(out);
87
88
  }
@@ -1,3 +1,3 @@
1
- import type { DiagramView } from '@likec4/core/types';
1
+ import type { DiagramView } from '@likec4/core';
2
2
  export declare function generateViewsDataTs(views: DiagramView[]): string;
3
3
  //# sourceMappingURL=generate-views-data.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import JSON5 from 'json5';
2
- import { CompositeGeneratorNode, NL, expandToNode, joinToNode, toString } from 'langium/lib/generator';
2
+ import { CompositeGeneratorNode, NL, expandToNode, joinToNode, toString } from 'langium';
3
3
  export function generateViewsDataTs(views) {
4
4
  const out = new CompositeGeneratorNode();
5
5
  out.appendTemplate `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likec4/generators",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "license": "MIT",
5
5
  "bugs": "https://github.com/likec4/likec4/issues",
6
6
  "homepage": "https://likec4.dev",
@@ -38,13 +38,14 @@
38
38
  "test:watch": "run -T vitest"
39
39
  },
40
40
  "dependencies": {
41
- "@likec4/core": "0.33.0",
41
+ "@likec4/core": "0.34.0",
42
42
  "json5": "^2.2.3",
43
- "langium": "^1.2.1",
43
+ "langium": "^2.0.0",
44
44
  "rambdax": "^9.1.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "^18.15.11",
48
- "typescript": "^5.1.6"
48
+ "typescript": "^5.1.6",
49
+ "vitest": "^0.34.1"
49
50
  }
50
51
  }