ts-graphviz 1.6.2-dev.4ac9642c5 → 1.6.2-dev.634dab30b

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.
@@ -4,18 +4,20 @@ import {
4
4
  GraphAttributesObject,
5
5
  SubgraphAttributesObject,
6
6
  } from '../../common/index.js';
7
- import { $keywords } from '../../utils/index.js';
7
+ import { $keywords, $keywordsValidation } from '../../utils/index.js';
8
8
 
9
9
  type Format = Format.values;
10
10
  declare namespace Format {
11
- type values = keyof $values;
11
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
12
12
  interface $values extends $keywords<'png' | 'svg' | 'json' | 'jpg' | 'pdf' | 'xdot' | 'dot' | 'plain' | 'dot_json'> {}
13
+ interface $exclude extends $keywordsValidation {}
13
14
  }
14
15
  type Layout = Layout.values;
15
16
  declare namespace Layout {
16
- type values = keyof $values;
17
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
17
18
  interface $values
18
19
  extends $keywords<'dot' | 'neato' | 'fdp' | 'sfdp' | 'circo' | 'twopi' | 'nop' | 'nop2' | 'osage' | 'patchwork'> {}
20
+ interface $exclude extends $keywordsValidation {}
19
21
  }
20
22
  /**
21
23
  * NeatoOptions interface provides options for the neato layout.
@@ -1,4 +1,4 @@
1
- import { $keywords } from '../utils/index.js';
1
+ import { $keywords, $keywordsValidation } from '../utils/index.js';
2
2
 
3
3
  /**
4
4
  * Directive indicating which direction the Edge should point.
@@ -7,8 +7,9 @@ import { $keywords } from '../utils/index.js';
7
7
  type Compass = Compass.values;
8
8
  /** @hidden */
9
9
  declare namespace Compass {
10
- type values = keyof $values;
10
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
11
11
  interface $values extends $keywords<'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw' | 'c' | '_'> {}
12
+ interface $exclude extends $keywordsValidation {}
12
13
  }
13
14
  /**
14
15
  * A value specifying an empty string for resetting some values.
@@ -71,9 +72,10 @@ type Shape = string;
71
72
  type SmoothType = SmoothType.values;
72
73
  /** @hidden */
73
74
  declare namespace SmoothType {
74
- type values = keyof $values;
75
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
75
76
  interface $values
76
77
  extends $keywords<'none' | 'avg_dist' | 'graph_dist' | 'power_dist' | 'rng' | 'spring' | 'triangle'> {}
78
+ interface $exclude extends $keywordsValidation {}
77
79
  }
78
80
  /**
79
81
  * @see {@link https://graphviz.gitlab.io/docs/attr-types/splineType/ splineType}
@@ -95,9 +97,10 @@ declare namespace SplineType {
95
97
  type StartType = `${StartType.style}${StartType.seed}`;
96
98
  /** @hidden */
97
99
  declare namespace StartType {
98
- type style = keyof $style;
100
+ type style = Exclude<keyof $style, keyof $exclude>;
99
101
  interface $style extends $keywords<'regular' | 'self' | 'random'> {}
100
102
  type seed = number;
103
+ interface $exclude extends $keywordsValidation {}
101
104
  }
102
105
  /**
103
106
  * @see {@link https://graphviz.gitlab.io/docs/attr-types/style/ style}
@@ -110,7 +113,7 @@ type Style =
110
113
  | `${Style.styleItem},${Style.styleItem},${Style.styleItem},${Style.styleItem}`;
111
114
  /** @hidden */
112
115
  declare namespace Style {
113
- type styleItem = keyof $styleItem;
116
+ type styleItem = Exclude<keyof $styleItem, keyof $exclude>;
114
117
  interface $styleItem
115
118
  extends $keywords<
116
119
  | 'dashed'
@@ -129,6 +132,7 @@ declare namespace Style {
129
132
  | 'rounded'
130
133
  | 'radial'
131
134
  > {}
135
+ interface $exclude extends $keywordsValidation {}
132
136
  }
133
137
  /**
134
138
  * @see {@link https://graphviz.gitlab.io/docs/attr-types/viewPort/ viewPort}
@@ -230,8 +234,9 @@ type PointList = Point | `${Point} ${Point}` | `${Point} ${Point} ${Point}` | `$
230
234
  type OutputMode = OutputMode.values;
231
235
  /** @hidden */
232
236
  declare namespace OutputMode {
233
- type values = keyof $values;
237
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
234
238
  interface $values extends $keywords<'breadthfirst' | 'nodesfirst' | 'edgesfirst'> {}
239
+ interface $exclude extends $keywordsValidation {}
235
240
  }
236
241
  /**
237
242
  * @see {@link https://graphviz.org/docs/attr-types/packMode/ packMode}
@@ -240,8 +245,9 @@ declare namespace OutputMode {
240
245
  type PackMode = keyof PickMode.$values | `array${string}`;
241
246
  /** @hidden */
242
247
  declare namespace PickMode {
243
- type values = keyof $values;
248
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
244
249
  interface $values extends $keywords<'node' | 'clust' | 'graph'> {}
250
+ interface $exclude extends $keywordsValidation {}
245
251
  }
246
252
  /**
247
253
  * Using `"fast"` gives about a 2-4 times overall speedup compared with `"normal"`,
@@ -253,8 +259,9 @@ declare namespace PickMode {
253
259
  type QuadType = QuadType.values;
254
260
  /** @hidden */
255
261
  declare namespace QuadType {
256
- type values = keyof $values;
262
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
257
263
  interface $values extends $keywords<'normal' | 'fast' | 'none'> {}
264
+ interface $exclude extends $keywordsValidation {}
258
265
  }
259
266
  /**
260
267
  * Rank Direction
@@ -265,11 +272,11 @@ declare namespace QuadType {
265
272
  * @see {@link https://graphviz.gitlab.io/docs/attr-types/rankdir/ rankdir}
266
273
  * @group Attribute Types
267
274
  */
268
- type Rankdir = Rankdir.values;
275
+ type Rankdir = `${Rankdir.TB}${Rankdir.RL}`;
269
276
  /** @hidden */
270
277
  declare namespace Rankdir {
271
- type values = keyof $values;
272
- interface $values extends $keywords<'TB' | 'LR' | 'BT' | 'RL'> {}
278
+ type TB = 'T' | 'B';
279
+ type RL = 'R' | 'L';
273
280
  }
274
281
  /**
275
282
  * @see {@link https://graphviz.gitlab.io/docs/attr-types/rankType/ rankType}
@@ -278,8 +285,9 @@ declare namespace Rankdir {
278
285
  type RankType = RankType.values;
279
286
  /** @hidden */
280
287
  declare namespace RankType {
281
- type values = keyof $values;
288
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
282
289
  interface $values extends $keywords<'same' | 'min' | 'source' | 'max' | 'sink'> {}
290
+ interface $exclude extends $keywordsValidation {}
283
291
  }
284
292
  /**
285
293
  * `"%f,%f,%f,%f"`
@@ -318,8 +326,9 @@ declare namespace ArrowType {
318
326
  */
319
327
  type ClusterMode = ClusterMode.values;
320
328
  declare namespace ClusterMode {
321
- type values = keyof $values;
329
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
322
330
  interface $values extends $keywords<'local' | 'global' | 'none'> {}
331
+ interface $exclude extends $keywordsValidation {}
323
332
  }
324
333
  /**
325
334
  * @see {@link https://graphviz.gitlab.io/docs/attr-types/color/ color}
@@ -345,7 +354,7 @@ declare namespace Color {
345
354
  * Graphviz currently supports the X11 scheme, the SVG scheme, and the Brewer schemes, with X11 being the default.
346
355
  * @see {@link https://graphviz.org/doc/info/colors.html Color Names}
347
356
  */
348
- type ColorName = keyof $colors;
357
+ type ColorName = Exclude<keyof $colors, keyof $exclude>;
349
358
  interface $colors
350
359
  extends $keywords<
351
360
  | 'aliceblue'
@@ -1175,6 +1184,7 @@ declare namespace Color {
1175
1184
  | 'yellow'
1176
1185
  | 'yellowgreen'
1177
1186
  > {}
1187
+ interface $exclude extends $keywordsValidation {}
1178
1188
  }
1179
1189
  /**
1180
1190
  * A colon-separated list of weighted color values: WC(:WC)* where each WC has the form C(;F)? with C a color value and the optional F a floating-point number, 0 ≤ F ≤ 1.
@@ -1196,8 +1206,9 @@ type ColorList = string;
1196
1206
  type DirType = DirType.values;
1197
1207
  /** @hidden */
1198
1208
  declare namespace DirType {
1199
- type values = keyof $values;
1209
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
1200
1210
  interface $values extends $keywords<'forward' | 'back' | 'both' | 'none'> {}
1211
+ interface $exclude extends $keywordsValidation {}
1201
1212
  }
1202
1213
  /**
1203
1214
  * Page Direction
@@ -1219,7 +1230,7 @@ declare namespace Pagedir {
1219
1230
  type EdgeAttributeKey = EdgeAttributeKey.values;
1220
1231
  /** @hidden */
1221
1232
  declare namespace EdgeAttributeKey {
1222
- type values = keyof $values;
1233
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
1223
1234
  interface $values
1224
1235
  extends $keywords<
1225
1236
  | 'URL'
@@ -1289,6 +1300,7 @@ declare namespace EdgeAttributeKey {
1289
1300
  | 'xlp'
1290
1301
  | 'class'
1291
1302
  > {}
1303
+ interface $exclude extends $keywordsValidation {}
1292
1304
  }
1293
1305
  /**
1294
1306
  * Attribute types available for nodes.
@@ -1297,7 +1309,7 @@ declare namespace EdgeAttributeKey {
1297
1309
  type NodeAttributeKey = NodeAttributeKey.values;
1298
1310
  /** @hidden */
1299
1311
  declare namespace NodeAttributeKey {
1300
- type values = keyof $values;
1312
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
1301
1313
  interface $values
1302
1314
  extends $keywords<
1303
1315
  | 'URL'
@@ -1350,6 +1362,7 @@ declare namespace NodeAttributeKey {
1350
1362
  | 'z'
1351
1363
  | 'class'
1352
1364
  > {}
1365
+ interface $exclude extends $keywordsValidation {}
1353
1366
  }
1354
1367
  /**
1355
1368
  * Attribute types available for graph.
@@ -1358,7 +1371,7 @@ declare namespace NodeAttributeKey {
1358
1371
  type GraphAttributeKey = GraphAttributeKey.values;
1359
1372
  /** @hidden */
1360
1373
  declare namespace GraphAttributeKey {
1361
- type values = keyof $values;
1374
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
1362
1375
  interface $values
1363
1376
  extends $keywords<
1364
1377
  | 'Damping'
@@ -1461,6 +1474,7 @@ declare namespace GraphAttributeKey {
1461
1474
  | 'xdotversion'
1462
1475
  | 'class'
1463
1476
  > {}
1477
+ interface $exclude extends $keywordsValidation {}
1464
1478
  }
1465
1479
  /**
1466
1480
  * Attribute types available for subgraph.
@@ -1469,8 +1483,9 @@ declare namespace GraphAttributeKey {
1469
1483
  type SubgraphAttributeKey = SubgraphAttributeKey.values;
1470
1484
  /** @hidden */
1471
1485
  declare namespace SubgraphAttributeKey {
1472
- type values = keyof $values;
1486
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
1473
1487
  interface $values extends $keywords<'rank'> {}
1488
+ interface $exclude extends $keywordsValidation {}
1474
1489
  }
1475
1490
  /**
1476
1491
  * Attribute types available for cluster subgraph.
@@ -1479,7 +1494,7 @@ declare namespace SubgraphAttributeKey {
1479
1494
  type ClusterSubgraphAttributeKey = ClusterSubgraphAttributeKey.values;
1480
1495
  /** @hidden */
1481
1496
  declare namespace ClusterSubgraphAttributeKey {
1482
- type values = keyof $values;
1497
+ type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
1483
1498
  interface $values
1484
1499
  extends $keywords<
1485
1500
  | 'K'
@@ -1513,6 +1528,7 @@ declare namespace ClusterSubgraphAttributeKey {
1513
1528
  | 'tooltip'
1514
1529
  | 'class'
1515
1530
  > {}
1531
+ interface $exclude extends $keywordsValidation {}
1516
1532
  }
1517
1533
  /**
1518
1534
  * Attribute types.
@@ -1531,11 +1547,13 @@ type AttributeKey =
1531
1547
  * @param T The {@link AttributeKey} to be mapped to a value.
1532
1548
  * @group Attribute
1533
1549
  */
1534
- type Attribute<T extends AttributeKey> = Attribute.$types[T];
1550
+ type Attribute<T extends AttributeKey> = Attribute.types[T];
1535
1551
  declare namespace Attribute {
1536
- type keys = $keys;
1552
+ type keys = Omit<$keys, keyof $exclude | symbol | number>;
1553
+ type types = Omit<$types, keyof $exclude | symbol | number>;
1537
1554
  /** @hidden */
1538
1555
  interface $keys extends $keywords<AttributeKey> {}
1556
+ interface $exclude extends $keywordsValidation {}
1539
1557
  /**
1540
1558
  * @group Attribute
1541
1559
  */
@@ -4,6 +4,11 @@
4
4
  type $keywords<T extends string> = {
5
5
  [key in T]: key;
6
6
  };
7
+ /**
8
+ * @hidden
9
+ */
10
+ interface $keywordsValidation
11
+ extends $keywords<`${string} ${string}` | `${string}\n${string}` | `${string}\t${string}`> {}
7
12
 
8
13
  type F<A extends any[], O> = (...args: A) => O;
9
14
  type IO<I, O> = F<[I], O>;
@@ -26,4 +31,4 @@ declare function pipe<I extends any[], T1, T2, T3, T4, O>(
26
31
  declare const map: <T, O>(selector: (item: T) => O) => (src: Iterable<T>) => O[];
27
32
  declare const filter: <T>(pred: (item: T) => boolean) => (src: Iterable<T>) => T[];
28
33
 
29
- export { $keywords, F, IO, filter, map, pipe };
34
+ export { $keywords, $keywordsValidation, F, IO, filter, map, pipe };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-graphviz",
3
- "version": "1.6.2-dev.4ac9642c5",
3
+ "version": "1.6.2-dev.634dab30b",
4
4
  "author": "kamiazya <yuki@kamiazya.tech>",
5
5
  "description": "Graphviz library for TypeScript.",
6
6
  "homepage": "https://ts-graphviz.github.io/ts-graphviz/",