Skip to content

Commit

Permalink
feat: base enums
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Jan 6, 2020
1 parent 6aae444 commit dba5f43
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/x6/src/enum/direction.ts
@@ -0,0 +1,8 @@
export enum DirectionMask {
none = 0,
west = 1,
north = 2,
south = 4,
east = 8,
all = 15,
}
24 changes: 24 additions & 0 deletions packages/x6/src/enum/font-style.ts
@@ -0,0 +1,24 @@
export enum FontStyle {
bold = 1,
italic = 2,
underlined = 4,
}

export namespace FontStyle {
export function isBold(fontStyle?: FontStyle | null) {
return fontStyle != null && (fontStyle & FontStyle.bold) === FontStyle.bold
}

export function isItalic(fontStyle?: FontStyle | null) {
return (
fontStyle != null && (fontStyle & FontStyle.italic) === FontStyle.italic
)
}

export function isUnderlined(fontStyle?: FontStyle | null) {
return (
fontStyle != null &&
(fontStyle & FontStyle.underlined) === FontStyle.underlined
)
}
}
4 changes: 4 additions & 0 deletions packages/x6/src/enum/index.ts
@@ -0,0 +1,4 @@
export * from './direction'
export * from './font-style'
export * from './node-type'
export * from './page-size'
14 changes: 14 additions & 0 deletions packages/x6/src/enum/node-type.ts
@@ -0,0 +1,14 @@
export enum NodeType {
element = 1,
attribute = 2,
text = 3,
cdata = 4,
entityReference = 5,
entity = 6,
processingInstruction = 7,
comment = 8,
document = 9,
documentType = 10,
documentFragment = 11,
notation = 12,
}
63 changes: 63 additions & 0 deletions packages/x6/src/enum/page-size.ts
@@ -0,0 +1,63 @@
export namespace PageSize {
/**
* A4 (210 mm x 297 mm)
*/
export const A4_PORTRAIT = { width: 827, height: 1169 }
export const A4_LANDSCAPE = { width: 1169, height: 827 }

/**
* US-Letter (8,5" x 11")
*/
export const LETTER_PORTRAIT = { width: 850, height: 1100 }
export const LETTER_LANDSCAPE = { width: 1100, height: 850 }

/**
* US-Legal (8,5" x 14")
*/
export const LEGAL = { width: 850, height: 1400 }

/**
* US-Tabloid (279 mm x 432 mm)
*/
export const TABLOID = { width: 850, height: 1400 }

/**
* A0 (841 mm x 1189 mm)
*/
export const A0 = { width: 3300, height: 4681 }

/**
* A1 (594 mm x 841 mm)
*/
export const A1 = { width: 2339, height: 3300 }

/**
* A2 (420 mm x 594 mm)
*/
export const A2 = { width: 1654, height: 2336 }

/**
* A3 (297 mm x 420 mm)
*/
export const A3 = { width: 1169, height: 1654 }

/**
* A4 (210 mm x 297 mm)
*/
export const A4 = A4_PORTRAIT

/**
* A5 (148 mm x 210 mm)
*/
export const A5 = { width: 583, height: 827 }

/**
* A6 (105 mm x 148 mm)
*/
export const A6 = { width: 413, height: 583 }

/**
* A7 (74 mm x 105 mm)
*/
export const A7 = { width: 291, height: 413 }
}

0 comments on commit dba5f43

Please sign in to comment.