Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Exclude enum types #287

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion example/example.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { FC } from 'react';
import { Digraph, Node, Subgraph, renderToDot, Edge, DOT } from '../src';
import { ClusterPortal } from '../src/components/ClusterPortal';

const Example: FC = () => (
<Digraph
Expand Down
39 changes: 21 additions & 18 deletions src/components/HtmlLike.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-undef */
import { AttributesValue } from 'ts-graphviz';
import { ValueOf } from '../utils/value-of';

export type TableProps = {
ALIGN?: 'CENTER' | 'LEFT' | 'RIGHT'; // "CENTER|LEFT|RIGHT"
Expand Down Expand Up @@ -84,24 +85,26 @@ export type SProps = NoAttributes;
export type HrProps = NoAttributes;
export type VrProps = NoAttributes;

export enum DOT {
PORT = 'dot-port',
TABLE = 'dot-table',
TR = 'dot-tr',
TD = 'dot-td',
FONT = 'dot-font',
BR = 'dot-br',
IMG = 'dot-img',
I = 'dot-i',
B = 'dot-b',
U = 'dot-u',
O = 'dot-o',
SUB = 'dot-sub',
SUP = 'dot-sup',
S = 'dot-s',
HR = 'dot-hr',
VR = 'dot-vr',
}
export const DOT = Object.freeze({
PORT: 'dot-port',
TABLE: 'dot-table',
TR: 'dot-tr',
TD: 'dot-td',
FONT: 'dot-font',
BR: 'dot-br',
IMG: 'dot-img',
I: 'dot-i',
B: 'dot-b',
U: 'dot-u',
O: 'dot-o',
SUB: 'dot-sub',
SUP: 'dot-sup',
S: 'dot-s',
HR: 'dot-hr',
VR: 'dot-vr',
} as const);

export type DOT = ValueOf<typeof DOT>;

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
Expand Down
1 change: 1 addition & 0 deletions src/utils/value-of.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type ValueOf<T> = T[keyof T];