@ts-graphviz/react 0.11.7-next-0bbfc4b9b75a148a7befa38de56e708c6b50e534 → 0.12.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.
- package/CHANGELOG.md +13 -3
- package/README.md +24 -0
- package/lib/react.d.ts +50 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
# @ts-graphviz/react
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1567](https://github.com/ts-graphviz/ts-graphviz/pull/1567) [`8edec59`](https://github.com/ts-graphviz/ts-graphviz/commit/8edec5962ac368d759a4903f69e8db2cd0496c97) Thanks [@kamiazya](https://github.com/kamiazya)! - Auto-augment JSX type definitions for dot:\* elements
|
|
8
|
+
|
|
9
|
+
TypeScript type definitions for HTML-like JSX elements (dot:table, dot:tr, dot:td, dot:br, etc.) are now automatically available when importing `@ts-graphviz/react`. No additional setup such as creating a `jsx.d.ts` file or importing `@ts-graphviz/react/jsx` is required.
|
|
10
|
+
|
|
11
|
+
This follows the auto-augmentation pattern (similar to react-three-fiber) where importing the package automatically extends React's JSX namespace with the `dot:*` intrinsic elements.
|
|
12
|
+
|
|
13
|
+
BREAKING CHANGE: The `@ts-graphviz/react/jsx` export has been removed. Users who previously imported from `@ts-graphviz/react/jsx` should remove those imports — the types are now available automatically.
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
6
16
|
|
|
7
17
|
- [#1539](https://github.com/ts-graphviz/ts-graphviz/pull/1539) [`6d9cfc8`](https://github.com/ts-graphviz/ts-graphviz/commit/6d9cfc8b78a4fab6d8bffff79802c144084e75c8) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps-dev): bump vite from 7.0.8 to 7.1.12
|
|
8
18
|
|
|
9
19
|
- Updated dependencies [[`6d9cfc8`](https://github.com/ts-graphviz/ts-graphviz/commit/6d9cfc8b78a4fab6d8bffff79802c144084e75c8), [`0bbfc4b`](https://github.com/ts-graphviz/ts-graphviz/commit/0bbfc4b9b75a148a7befa38de56e708c6b50e534)]:
|
|
10
|
-
- @ts-graphviz/common@3.0.5
|
|
11
|
-
- ts-graphviz@3.0.7
|
|
20
|
+
- @ts-graphviz/common@3.0.5
|
|
21
|
+
- ts-graphviz@3.0.7
|
|
12
22
|
|
|
13
23
|
## 0.11.6
|
|
14
24
|
|
package/README.md
CHANGED
|
@@ -256,6 +256,30 @@ const MyNode: React.FC<NodeProps> = (props) => (
|
|
|
256
256
|
/>
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
+
#### JSX Type Definitions for HTML-Like Elements
|
|
260
|
+
|
|
261
|
+
TypeScript type definitions for all `dot:*` HTML-like elements are **automatically available** when you import `@ts-graphviz/react`. No additional configuration or setup is required.
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
import { Digraph, Node, Edge } from '@ts-graphviz/react';
|
|
265
|
+
|
|
266
|
+
// Full IntelliSense and type checking for dot:* elements works out of the box
|
|
267
|
+
<Node
|
|
268
|
+
id="user"
|
|
269
|
+
label={
|
|
270
|
+
<dot:table border={1}>
|
|
271
|
+
<dot:tr>
|
|
272
|
+
<dot:td>Name</dot:td>
|
|
273
|
+
<dot:td>John Doe</dot:td>
|
|
274
|
+
</dot:tr>
|
|
275
|
+
</dot:table>
|
|
276
|
+
}
|
|
277
|
+
shape="box"
|
|
278
|
+
/>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The `DotJSXElements` type is also exported for advanced use cases where you need to reference the type definitions directly.
|
|
282
|
+
|
|
259
283
|
#### Enhanced Type Safety
|
|
260
284
|
|
|
261
285
|
The package provides sophisticated TypeScript support with automatic type inference and runtime type filtering:
|
package/lib/react.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { GraphAttributesObject } from '@ts-graphviz/common';
|
|
|
11
11
|
import { GraphBaseModel } from '@ts-graphviz/common';
|
|
12
12
|
import { GraphBaseModel as GraphBaseModel_2 } from 'ts-graphviz';
|
|
13
13
|
import { HasComment } from '@ts-graphviz/common';
|
|
14
|
+
import { HTMLLikeLabel } from '@ts-graphviz/common';
|
|
14
15
|
import { isAttributeListModel } from 'ts-graphviz';
|
|
15
16
|
import { isEdgeModel } from 'ts-graphviz';
|
|
16
17
|
import { isNodeModel } from 'ts-graphviz';
|
|
@@ -86,6 +87,53 @@ export declare interface CreateRootOptions<Container extends AnyGraphContainer =
|
|
|
86
87
|
*/
|
|
87
88
|
export declare const Digraph: FC<RootGraphProps>;
|
|
88
89
|
|
|
90
|
+
/**
|
|
91
|
+
* JSX intrinsic elements for dot:* HTML-like elements.
|
|
92
|
+
* These type definitions are automatically available when importing @ts-graphviz/react.
|
|
93
|
+
*/
|
|
94
|
+
export declare interface DotJSXElements {
|
|
95
|
+
'dot:port': {
|
|
96
|
+
children: string;
|
|
97
|
+
};
|
|
98
|
+
'dot:table': HTMLLikeLabel.TableAttributes & {
|
|
99
|
+
children?: ReactNode;
|
|
100
|
+
};
|
|
101
|
+
'dot:tr': HTMLLikeLabel.TrAttributes & {
|
|
102
|
+
children?: ReactNode;
|
|
103
|
+
};
|
|
104
|
+
'dot:td': HTMLLikeLabel.TdAttributes & {
|
|
105
|
+
children?: ReactNode;
|
|
106
|
+
};
|
|
107
|
+
'dot:font': HTMLLikeLabel.FontAttributes & {
|
|
108
|
+
children?: ReactNode;
|
|
109
|
+
};
|
|
110
|
+
'dot:br': HTMLLikeLabel.BrAttributes;
|
|
111
|
+
'dot:img': HTMLLikeLabel.ImgAttributes;
|
|
112
|
+
'dot:i': HTMLLikeLabel.IAttributes & {
|
|
113
|
+
children?: ReactNode;
|
|
114
|
+
};
|
|
115
|
+
'dot:b': HTMLLikeLabel.BAttributes & {
|
|
116
|
+
children?: ReactNode;
|
|
117
|
+
};
|
|
118
|
+
'dot:u': HTMLLikeLabel.UAttributes & {
|
|
119
|
+
children?: ReactNode;
|
|
120
|
+
};
|
|
121
|
+
'dot:o': HTMLLikeLabel.OAttributes & {
|
|
122
|
+
children?: ReactNode;
|
|
123
|
+
};
|
|
124
|
+
'dot:sub': HTMLLikeLabel.SubAttributes & {
|
|
125
|
+
children?: ReactNode;
|
|
126
|
+
};
|
|
127
|
+
'dot:sup': HTMLLikeLabel.SupAttributes & {
|
|
128
|
+
children?: ReactNode;
|
|
129
|
+
};
|
|
130
|
+
'dot:s': HTMLLikeLabel.SAttributes & {
|
|
131
|
+
children?: ReactNode;
|
|
132
|
+
};
|
|
133
|
+
'dot:hr': HTMLLikeLabel.HrAttributes;
|
|
134
|
+
'dot:vr': HTMLLikeLabel.VrAttributes;
|
|
135
|
+
}
|
|
136
|
+
|
|
89
137
|
/**
|
|
90
138
|
* `Edge` component.
|
|
91
139
|
*/
|
|
@@ -390,7 +438,7 @@ export { }
|
|
|
390
438
|
|
|
391
439
|
declare module 'react' {
|
|
392
440
|
namespace JSX {
|
|
393
|
-
interface IntrinsicElements extends
|
|
441
|
+
interface IntrinsicElements extends DotJSXElements {
|
|
394
442
|
}
|
|
395
443
|
}
|
|
396
444
|
}
|
|
@@ -398,7 +446,7 @@ declare module 'react' {
|
|
|
398
446
|
|
|
399
447
|
declare module 'react/jsx-runtime' {
|
|
400
448
|
namespace JSX {
|
|
401
|
-
interface IntrinsicElements extends
|
|
449
|
+
interface IntrinsicElements extends DotJSXElements {
|
|
402
450
|
}
|
|
403
451
|
}
|
|
404
452
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-graphviz/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Graphviz-dot Renderer for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphviz",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"react-reconciler": "^0.32.0",
|
|
41
|
-
"@ts-graphviz/common": "^3.0.5
|
|
42
|
-
"ts-graphviz": "^3.0.7
|
|
41
|
+
"@ts-graphviz/common": "^3.0.5",
|
|
42
|
+
"ts-graphviz": "^3.0.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@testing-library/react": "^16.3.0",
|