Skip to content

Commit

Permalink
fix: height
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Dec 14, 2021
1 parent b1aa66f commit 72a8e23
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/constants/css-property-keyword.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const DASH = '-';
export const BORDER = 'border';
export const RADIUS = 'radius';
export const MARGIN = 'margin';
Expand Down Expand Up @@ -124,7 +125,6 @@ export const POSITION = 'position';
export const REM = 'rem';
export const EM = 'em';
export const PX = 'px';
export const DASH = '-';
export const STYLE = 'style';
export const GRAYSCALE = 'grayscale';
export const SMOOTHING = 'smoothing';
Expand All @@ -142,7 +142,8 @@ export const MAX_HEIGHT = MAX + DASH + HEIGHT;
export const MIN_HEIGHT = MIN + DASH + HEIGHT;
export const F_PREFIX = 'f:';
export const T_PREFIX = 't:';
export const D_PREFIX = 'd:';
export const H_PREFIX = 'h:';
export const W_PREFIX = 'w:';
export const BG_PREFIX = 'bg:';
export const OBJECT_PREFIX = OBJECT + ':';
export const SQUARE = 'square';
Expand Down Expand Up @@ -175,4 +176,8 @@ export const ORDER = 'order';
export const ORDER_PREFIX = 'o:';
export const LAST = 'last';
export const COL = 'col';
export const SPAN = 'span';
export const SPAN = 'span';
export const MAX_CONTENT = MAX + DASH + CONTENT;
export const MIN_CONTENT = MIN + DASH + CONTENT;
export const FIT_CONTENT = FIT + DASH + CONTENT;
export const PERCENT100 = '100%';
9 changes: 6 additions & 3 deletions src/height.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { HEIGHT } from './constants/css-property-keyword';
import { FIT, FIT_CONTENT, FULL, HEIGHT, H_PREFIX, MAX, MAX_CONTENT, MIN, MIN_CONTENT, PERCENT100 } from './constants/css-property-keyword';
import { MasterStyle } from '@master/style';

export class HeightStyle extends MasterStyle {
static override prefixes = /^h:/;
static override prefixes = /^h:/;
static override properties = [HEIGHT];
static override semantics = {
'h:full': '100%'
[H_PREFIX + FULL]: PERCENT100,
[H_PREFIX + FIT]: FIT_CONTENT,
[H_PREFIX + MAX]: MAX_CONTENT,
[H_PREFIX + MIN]: MIN_CONTENT
}
}
1 change: 1 addition & 0 deletions src/variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { MasterStyle } from '@master/style';

export class VariableStyle extends MasterStyle {
static override prefixes = /^\$.*:/;
static override defaultUnit = ''; // don't use 'rem' as default, because css variable is common API
override get properties(): { [key: string]: any } {
return {
['--' + this.prefix.slice(1, -1)]: this
Expand Down

0 comments on commit 72a8e23

Please sign in to comment.