-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from hyperifyio/miskadev
Added Flex attributes
- Loading branch information
Showing
11 changed files
with
354 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ export interface SizeDTO extends DTO { | |
* Defaults to pixels. | ||
*/ | ||
readonly unit ?: UnitType; | ||
|
||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { isUndefined } from "lodash"; | ||
import { isEnum, explainEnum, stringifyEnum, parseEnum } from "../../types/Enum"; | ||
import { explainOk, explainNot, explainOr } from "../../types/explain"; | ||
|
||
export enum AlignContent { | ||
FLEX_START = "flex-start", | ||
FLEX_END = "flex-end", | ||
CENTER = "center", | ||
SPACE_BETWEEN = "space-between", | ||
SPACE_AROUND = "space-around", | ||
SPACE_EVENLY = "space-evenly", | ||
STRETCH = "stretch", | ||
START = "start", | ||
END = "end", | ||
BASELINE = "baseline", | ||
FIRST_BASELINE = "first baseline", | ||
LAST_BASELINE = "last baseline", | ||
} | ||
|
||
export function isAlignContent (value: unknown) : value is AlignContent { | ||
return isEnum(AlignContent, value); | ||
} | ||
|
||
export function explainAlignContent (value : unknown) : string { | ||
return explainEnum("AlignContent", AlignContent, isAlignContent, value); | ||
} | ||
|
||
export function stringifyAlignContent (value : AlignContent) : string { | ||
return stringifyEnum(AlignContent, value); | ||
} | ||
|
||
export function parseAlignContent (value: any) : AlignContent | undefined { | ||
return parseEnum(AlignContent, value) as AlignContent | undefined; | ||
} | ||
|
||
export function isAlignContentOrUndefined (value: unknown): value is AlignContent | undefined { | ||
return isUndefined(value) || isAlignContent(value); | ||
} | ||
|
||
export function explainAlignContentOrUndefined (value: unknown): string { | ||
return isAlignContentOrUndefined(value) ? explainOk() : explainNot(explainOr(['AlignContent', 'undefined'])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { isUndefined } from "lodash"; | ||
import { isEnum, explainEnum, stringifyEnum, parseEnum } from "../../types/Enum"; | ||
import { explainOk, explainNot, explainOr } from "../../types/explain"; | ||
|
||
export enum AlignItems { | ||
STRETCH = "stretch", | ||
FLEX_START = "flex-start", | ||
FLEX_END = "flex-end", | ||
CENTER = "center", | ||
BASELINE = "baseline", | ||
FIRST_BASELINE = "first baseline", | ||
LAST_BASELINE = "last baseline", | ||
START = "start", | ||
END = "end", | ||
SELF_START = "self-start", | ||
SELF_END = "self-end" | ||
} | ||
|
||
export function isAlignItems (value: unknown) : value is AlignItems { | ||
return isEnum(AlignItems, value); | ||
} | ||
|
||
export function explainAlignItems (value : unknown) : string { | ||
return explainEnum("AlignItems", AlignItems, isAlignItems, value); | ||
} | ||
|
||
export function stringifyAlignItems (value : AlignItems) : string { | ||
return stringifyEnum(AlignItems, value); | ||
} | ||
|
||
export function parseAlignItems (value: any) : AlignItems | undefined { | ||
return parseEnum(AlignItems, value) as AlignItems | undefined; | ||
} | ||
|
||
export function isAlignItemsOrUndefined (value: unknown): value is AlignItems | undefined { | ||
return isUndefined(value) || isAlignItems(value); | ||
} | ||
|
||
export function explainAlignItemsOrUndefined (value: unknown): string { | ||
return isAlignItemsOrUndefined(value) ? explainOk() : explainNot(explainOr(['AlignItems', 'undefined'])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { isUndefined } from "lodash"; | ||
import { isEnum, explainEnum, stringifyEnum, parseEnum } from "../../types/Enum"; | ||
import { explainOk, explainNot, explainOr } from "../../types/explain"; | ||
|
||
export enum AlignSelf { | ||
AUTO = "auto", | ||
FLEX_START = "flex-start", | ||
FLEX_END = "flex-end", | ||
CENTER = "center", | ||
BASELINE = "baseline", | ||
STRETCH = "stretch", | ||
} | ||
|
||
export function isAlignSelf (value: unknown) : value is AlignSelf { | ||
return isEnum(AlignSelf, value); | ||
} | ||
|
||
export function explainAlignSelf (value : unknown) : string { | ||
return explainEnum("AlignSelf", AlignSelf, isAlignSelf, value); | ||
} | ||
|
||
export function stringifyAlignSelf (value : AlignSelf) : string { | ||
return stringifyEnum(AlignSelf, value); | ||
} | ||
|
||
export function parseAlignSelf (value: any) : AlignSelf | undefined { | ||
return parseEnum(AlignSelf, value) as AlignSelf | undefined; | ||
} | ||
|
||
export function isAlignSelfOrUndefined (value: unknown): value is AlignSelf | undefined { | ||
return isUndefined(value) || isAlignSelf(value); | ||
} | ||
|
||
export function explainAlignSelfOrUndefined (value: unknown): string { | ||
return isAlignSelfOrUndefined(value) ? explainOk() : explainNot(explainOr(['AlignSelf', 'undefined'])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { isUndefined } from "lodash"; | ||
import { isEnum, explainEnum, stringifyEnum, parseEnum } from "../../types/Enum"; | ||
import { explainOk, explainNot, explainOr } from "../../types/explain"; | ||
|
||
export enum Display { | ||
BLOCK = "block", | ||
INLINE_BLOCK = "inline-block", | ||
NONE = "none", | ||
FLEX = "flex", | ||
GRID = "grid", | ||
} | ||
|
||
export function isDisplay (value: unknown) : value is Display { | ||
return isEnum(Display, value); | ||
} | ||
|
||
export function explainDisplay (value : unknown) : string { | ||
return explainEnum("Display", Display, isDisplay, value); | ||
} | ||
|
||
export function stringifyDisplay (value : Display) : string { | ||
return stringifyEnum(Display, value); | ||
} | ||
|
||
export function parseDisplay (value: any) : Display | undefined { | ||
return parseEnum(Display, value) as Display | undefined; | ||
} | ||
|
||
export function isDisplayOrUndefined (value: unknown): value is Display | undefined { | ||
return isUndefined(value) || isDisplay(value); | ||
} | ||
|
||
export function explainDisplayOrUndefined (value: unknown): string { | ||
return isDisplayOrUndefined(value) ? explainOk() : explainNot(explainOr(['Display', 'undefined'])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { isUndefined } from "lodash"; | ||
import { isEnum, explainEnum, stringifyEnum, parseEnum } from "../../types/Enum"; | ||
import { explainOk, explainNot, explainOr } from "../../types/explain"; | ||
|
||
export enum FlexDirection { | ||
ROW = "row", | ||
ROW_REVERSE = "row-reverse", | ||
COLUMN = "column", | ||
COLUMN_REVERSE = "column-reverse", | ||
} | ||
|
||
export function isFlexDirection (value: unknown) : value is FlexDirection { | ||
return isEnum(FlexDirection, value); | ||
} | ||
|
||
export function explainFlexDirection (value : unknown) : string { | ||
return explainEnum("FlexDirection", FlexDirection, isFlexDirection, value); | ||
} | ||
|
||
export function stringifyFlexDirection (value : FlexDirection) : string { | ||
return stringifyEnum(FlexDirection, value); | ||
} | ||
|
||
export function parseFlexDirection (value: any) : FlexDirection | undefined { | ||
return parseEnum(FlexDirection, value) as FlexDirection | undefined; | ||
} | ||
|
||
export function isFlexDirectionOrUndefined (value: unknown): value is FlexDirection | undefined { | ||
return isUndefined(value) || isFlexDirection(value); | ||
} | ||
|
||
export function explainFlexDirectionOrUndefined (value: unknown): string { | ||
return isFlexDirectionOrUndefined(value) ? explainOk() : explainNot(explainOr(['FlexDirection', 'undefined'])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { isUndefined } from "lodash"; | ||
import { isEnum, explainEnum, stringifyEnum, parseEnum } from "../../types/Enum"; | ||
import { explainOk, explainNot, explainOr } from "../../types/explain"; | ||
|
||
export enum FlexWrap { | ||
NOWRAP = "nowrap", | ||
WRAP = "wrap", | ||
WRAP_REVERSE = "wrap-reverse", | ||
} | ||
|
||
export function isFlexWrap (value: unknown) : value is FlexWrap { | ||
return isEnum(FlexWrap, value); | ||
} | ||
|
||
export function explainFlexWrap (value : unknown) : string { | ||
return explainEnum("FlexWrap", FlexWrap, isFlexWrap, value); | ||
} | ||
|
||
export function stringifyFlexWrap (value : FlexWrap) : string { | ||
return stringifyEnum(FlexWrap, value); | ||
} | ||
|
||
export function parseFlexWrap (value: any) : FlexWrap | undefined { | ||
return parseEnum(FlexWrap, value) as FlexWrap | undefined; | ||
} | ||
|
||
export function isFlexWrapOrUndefined (value: unknown): value is FlexWrap | undefined { | ||
return isUndefined(value) || isFlexWrap(value); | ||
} | ||
|
||
export function explainFlexWrapOrUndefined (value: unknown): string { | ||
return isFlexWrapOrUndefined(value) ? explainOk() : explainNot(explainOr(['FlexWrap', 'undefined'])); | ||
} |
Oops, something went wrong.