Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/alpha' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Dec 16, 2021
2 parents ead1de0 + 1fbed39 commit a5b3a76
Show file tree
Hide file tree
Showing 38 changed files with 328 additions and 21 deletions.
6 changes: 6 additions & 0 deletions src/accent-color.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Style } from '@master/style';
import { ACCENT, COLOR, DASH } from './constants/css-property-keyword';

export class AccentColorStyle extends Style {
static override properties = [ACCENT + DASH + COLOR];
}
5 changes: 5 additions & 0 deletions src/appearance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Style } from '@master/style';

export class AppearanceStyle extends Style {
static override properties = ['appearance'];
}
4 changes: 3 additions & 1 deletion src/background-attachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Style } from '@master/style';
import { ATTACHMENT, BACKGROUND, DASH } from './constants/css-property-keyword';

export class BackgroundAttachmentStyle extends Style {
static override prefixes = /^(bg-attachment:|bg:(fixed|local|scroll))/;
static override prefixes = /^((bg|background)-attachment:|(bg|background):(fixed|local|scroll))/;
static override properties = [BACKGROUND + DASH + ATTACHMENT];
static override supportFullName = false;

}
3 changes: 2 additions & 1 deletion src/background-blend-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BACKGROUND, BLEND, DASH, MODE } from './constants/css-property-keyword';

export class BackgroundBlendModeStyle extends Style {
static override prefixes = /^bg-blend:/;
static override prefixes = /^(bg|background)-blend(-mode)?:/;
static override properties = [BACKGROUND + DASH + BLEND + DASH + MODE];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/background-clip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { WEBKIT_PREFIX } from './constants/css-browser-prefix';
const BACKGROUND_CLIP = BACKGROUND + DASH + CLIP;

export class BackgroundClipStyle extends Style {
static override prefixes = /^bg-clip:/;
static override prefixes = /^(bg|background)-clip:/;
static override properties = [
WEBKIT_PREFIX + BACKGROUND_CLIP,
BACKGROUND_CLIP
];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/background-color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BACKGROUND, COLOR, DASH } from './constants/css-property-keyword';

export class BackgroundColorStyle extends Style {
static override prefixes = /^(bg-color:|bg:transparent)/;
static override prefixes = /^((bg|background)-color:|(bg|background):transparent)/;
static override properties = [BACKGROUND + DASH + COLOR];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/background-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BACKGROUND, DASH, IMAGE } from './constants/css-property-keyword';

export class BackgroundImageStyle extends Style {
static override prefixes = /^bg-image:/;
static override prefixes = /^(bg|background)-image:/;
static override properties = [BACKGROUND + DASH + IMAGE];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/background-origin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BACKGROUND, DASH, ORIGIN } from './constants/css-property-keyword';

export class BackgroundOriginStyle extends Style {
static override prefixes = /^bg-origin:/;
static override prefixes = /^(bg|background)-origin:/;
static override properties = [BACKGROUND + DASH + ORIGIN];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/background-position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BACKGROUND, DASH, POSITION } from './constants/css-property-keyword';

export class BackgroundPositionStyle extends Style {
static override prefixes = /^(bg-position:|bg:(top|bottom|right|left|center))/;
static override prefixes = /^((bg|background)-position:|(bg|background):(top|bottom|right|left|center))/;
static override properties = [BACKGROUND + DASH + POSITION];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/background-repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BACKGROUND, DASH, REPEAT } from './constants/css-property-keyword';

export class BackgroundRepeatStyle extends Style {
static override prefixes = /^(bg-repeat:|bg:(repeat|no-repeat|repeat-x|repeat-y))/;
static override prefixes = /^((bg|background)-repeat:|(bg|background):(repeat|no-repeat|repeat-x|repeat-y))/;
static override properties = [BACKGROUND + DASH + REPEAT];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/background-size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BACKGROUND, DASH, SIZE } from './constants/css-property-keyword';

export class BackgroundSizeStyle extends Style {
static override prefixes = /^(bg-size:|bg:(cover|contain))/;
static override prefixes = /^((bg|background)-size:|(bg|background):(auto|cover|contain))/;
static override properties = [BACKGROUND + DASH + SIZE];
static override supportFullName = false;
}
8 changes: 8 additions & 0 deletions src/border-collapse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Style } from '@master/style';
import { BORDER, COLLAPSE, DASH } from './constants/css-property-keyword';

export class BorderCollapseStyle extends Style {
static override prefixes = /^b(order)?-collapse:/;
static override properties = [BORDER + DASH + COLLAPSE];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/border-color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BORDER, COLOR, DASH } from './constants/css-property-keyword';

export class BorderColorStyle extends Style {
static override prefixes = /^b-color:/;
static override prefixes = /^b(order)?-color:/;
static override properties = [BORDER + DASH + COLOR];
static override supportFullName = false;
}
16 changes: 10 additions & 6 deletions src/border-radius.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ import { Style } from '@master/style';
import { TOP, RIGHT, BOTTOM, LEFT, T, B, L, R } from './constants/direction';
import { BORDER, DASH, RADIUS, ROUND, ROUNDED } from './constants/css-property-keyword';

const BORDER_TOP_LEFT_RADIUS = BORDER + DASH + TOP + DASH + LEFT + DASH + RADIUS;
const BORDER_TOP_RIGHT_RADIUS = BORDER + DASH + TOP + DASH + RIGHT + DASH + RADIUS;
const BORDER_BOTTOM_LEFT_RADIUS = BORDER + DASH + BOTTOM + DASH + LEFT + DASH + RADIUS;
const BORDER_BOTTOM_RIGHT_RADIUS = BORDER + DASH + BOTTOM + DASH + RIGHT + DASH + RADIUS;
const BORDER_TOP_LEFT_RADIUS = BORDER + DASH + TOP + DASH + LEFT + DASH + RADIUS,
BORDER_TOP_RIGHT_RADIUS = BORDER + DASH + TOP + DASH + RIGHT + DASH + RADIUS,
BORDER_BOTTOM_LEFT_RADIUS = BORDER + DASH + BOTTOM + DASH + LEFT + DASH + RADIUS,
BORDER_BOTTOM_RIGHT_RADIUS = BORDER + DASH + BOTTOM + DASH + RIGHT + DASH + RADIUS,
BORDER_RADIUS_S = [BORDER_TOP_LEFT_RADIUS, BORDER_TOP_RIGHT_RADIUS, BORDER_BOTTOM_LEFT_RADIUS, BORDER_BOTTOM_RIGHT_RADIUS];

export class BorderRadiusStyle extends Style {
static override prefixes = /^(r(t|b|l|r)?(t|b|l|r)?:)/;
static override prefixes = /^((r(t|b|l|r)?(t|b|l|r)?|border(-(top|bottom)-(left|right))?-radius):)/;
static override semantics = {
[ROUNDED]: '1e9em',
[ROUND]: '50%'
}
static override supportFullName = false;
override get properties(): { [key: string]: any } {
if (this.prefix) {
const suffix = this.prefix.slice(1, -1);
Expand Down Expand Up @@ -59,8 +61,10 @@ export class BorderRadiusStyle extends Style {
}
}
}

const prefix = this.prefix.slice(0, -1);
return {
[BORDER + DASH + RADIUS]: this
[BORDER_RADIUS_S.includes(prefix) ? prefix : BORDER + DASH + RADIUS]: this
}
}
}
3 changes: 2 additions & 1 deletion src/border-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BORDER, DASH, STYLE } from './constants/css-property-keyword';

export class BorderStyleStyle extends Style {
static override prefixes = /^b-style:/;
static override prefixes = /^b(order)?-style:/;
static override properties = [BORDER + DASH + STYLE];
static override supportFullName = false;
}
3 changes: 2 additions & 1 deletion src/border-width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Style } from '@master/style';
import { BORDER, DASH, WIDTH } from './constants/css-property-keyword';

export class BorderWidthStyle extends Style {
static override prefixes = /^b-width:/;
static override prefixes = /^b(order)?-width:/;
static override properties = [BORDER + DASH + WIDTH];
static override supportFullName = false;
}
6 changes: 6 additions & 0 deletions src/caret-color.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Style } from '@master/style';
import { CARET, COLOR, DASH } from './constants/css-property-keyword';

export class CaretColorStyle extends Style {
static override properties = [CARET + DASH + COLOR];
}
16 changes: 14 additions & 2 deletions src/constants/css-property-keyword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export const INVISIBLE = 'invisible';
export const VISIBLE = 'visible';
export const Z_INDEX = 'z-index';
export const CLEAR = 'clear';
export const OVERSCROLL_BEHAVIOR = 'overscroll-behavior';
export const BEHAVIOR = 'behavior';
export const OVERSCROLL_BEHAVIOR = 'overscroll' + DASH + BEHAVIOR;
export const Y = 'y';
export const X = 'x';
export const WEIGHT = 'weight';
Expand Down Expand Up @@ -196,4 +197,15 @@ export const TYPE = 'type';
export const ABS = 'abs';
export const ABSOLUTE = 'absolute';
export const REL = 'rel';
export const RELATIVE = 'relative';
export const RELATIVE = 'relative';
export const THICKNESS = 'thickness';
export const OFFSET = 'offset';
export const UNDERLINE = 'underline';
export const INDENT = 'indent';
export const OUTLINE = 'outline';
export const COLLAPSE = 'collapse';
export const LAYOUT = 'layout';
export const ACCENT = 'accent';
export const CARET = 'caret';
export const SNAP = 'snap';
export const STOP = 'stop';
6 changes: 6 additions & 0 deletions src/content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Style } from '@master/style';
import { CONTENT } from './constants/css-property-keyword';

export class ContentStyle extends Style {
static override properties = [CONTENT];
}
46 changes: 45 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,27 @@ import { MarginStyle } from './margin';
import { TextOverflowStyle } from './text-overflow';
import { ListStylePositionStyle } from './list-style-position';
import { ListStyleTypeStyle } from './list-style-type';
import { TextDecorationColorStyle } from './text-decoration-color';
import { TextDecorationStyleStyle } from './text-decoration-style';
import { TextDecorationThicknessStyle } from './text-decoration-thickness';
import { TextIndentStyle } from './text-indent';
import { ContentStyle } from './content';
import { OutlineColorStyle } from './outline-color';
import { OutlineOffsetStyle } from './outline-offset';
import { OutlineStyleStyle } from './outline-style';
import { OutlineWidthStyle } from './outline-width';
import { BorderCollapseStyle } from './border-collapse';
import { TableLayoutStyle } from './table-layout';
import { AccentColorStyle } from './accent-color';
import { AppearanceStyle } from './appearance';
import { CaretColorStyle } from './caret-color';
import { ScrollBehaviorStyle } from './scroll-behavior';
import { ScrollMarginStyle } from './scroll-margin';
import { ScrollPaddingStyle } from './scroll-padding';
import { ScrollSnapAlignStyle } from './scroll-snap-align';
import { ScrollSnapStopStyle } from './scroll-snap-stop';
import { ScrollSnapTypeStyle } from './scroll-snap-type';
import { WillChangeStyle } from './will-change';

window.addEventListener('DOMContentLoaded', (event) => {
/**
Expand All @@ -140,6 +161,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
HeightStyle,
MinWidthStyle,
MinHeightStyle,
ContentStyle,
LetterSpacingStyle,
FontSmoothingStyle,
FontStyleStyle,
Expand All @@ -148,10 +170,14 @@ window.addEventListener('DOMContentLoaded', (event) => {
ObjectFitStyle,
ObjectPositionStyle,
TextAlignStyle,
TextDecorationColorStyle,
TextDecorationStyleStyle,
TextDecorationStyle,
TextDecorationThicknessStyle,
TextLeadingStyle,
TextOverflowStyle,
TextTransformStyle,
TextIndentStyle,
VerticalAlignStyle,
LinesStyle,
MaxHeightStyle,
Expand All @@ -178,6 +204,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
TextShadowStyle,
TextSizeStyle,
BoxShadowStyle,
TableLayoutStyle,
// transform
TransformBoxStyle,
TransformStyleStyle,
Expand All @@ -203,6 +230,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
BorderRadiusStyle,
BorderStyleStyle,
BorderWidthStyle,
BorderCollapseStyle,
BorderStyle,
// background
BackgroundAttachmentStyle,
Expand Down Expand Up @@ -260,7 +288,23 @@ window.addEventListener('DOMContentLoaded', (event) => {
PlaceItemsStyle,
PlaceSelfStyle,
ListStylePositionStyle,
ListStyleTypeStyle
ListStyleTypeStyle,
// outline
OutlineColorStyle,
OutlineOffsetStyle,
OutlineStyleStyle,
OutlineWidthStyle,
AccentColorStyle,
AppearanceStyle,
CaretColorStyle,
// scroll
ScrollBehaviorStyle,
ScrollMarginStyle,
ScrollPaddingStyle,
ScrollSnapAlignStyle,
ScrollSnapStopStyle,
ScrollSnapTypeStyle,
WillChangeStyle
)
const sheet = new StyleSheet(document.head);
StyleSheet.root = sheet;
Expand Down
1 change: 1 addition & 0 deletions src/opacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import { Style } from '@master/style';

export class OpacityStyle extends Style {
static override properties = [OPACITY];
static override defaultUnit = '';
}
6 changes: 6 additions & 0 deletions src/outline-color.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { COLOR, DASH, OUTLINE } from './constants/css-property-keyword';
import { Style } from '@master/style';

export class OutlineColorStyle extends Style {
static override properties = [OUTLINE + DASH + COLOR];
}
7 changes: 7 additions & 0 deletions src/outline-offset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { DASH, OFFSET, OUTLINE } from './constants/css-property-keyword';
import { Style } from '@master/style';

export class OutlineOffsetStyle extends Style {
static override properties = [OUTLINE + DASH + OFFSET];
static override defaultUnit = 'px';
}
6 changes: 6 additions & 0 deletions src/outline-style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { DASH, OUTLINE, STYLE } from './constants/css-property-keyword';
import { Style } from '@master/style';

export class OutlineStyleStyle extends Style {
static override properties = [OUTLINE + DASH + STYLE];
}
7 changes: 7 additions & 0 deletions src/outline-width.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { DASH, OUTLINE, WIDTH } from './constants/css-property-keyword';
import { Style } from '@master/style';

export class OutlineWidthStyle extends Style {
static override properties = [OUTLINE + DASH + WIDTH];
static override defaultUnit = 'px';
}
6 changes: 6 additions & 0 deletions src/scroll-behavior.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { BEHAVIOR, DASH, SCROLL } from './constants/css-property-keyword';
import { Style } from '@master/style';

export class ScrollBehaviorStyle extends Style {
static override properties = [SCROLL + DASH + BEHAVIOR];
}
Loading

0 comments on commit a5b3a76

Please sign in to comment.