-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
88 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
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,50 @@ | ||
import { Style } from '@master/style'; | ||
import { DASH, PADDING, SCROLL } from './constants/css-property-keyword'; | ||
import { B, BOTTOM, L, LEFT, R, RIGHT, T, TOP, X, Y } from './constants/direction'; | ||
|
||
export class ScrollPaddingStyle extends Style { | ||
static override prefixes = /^scroll-(p(x|y|t|b|l|r)|p(adding)?(-(top|bottom|left|right))?):/; | ||
static override supportFullName = false; | ||
override get properties(): { [key: string]: any } { | ||
if (this.prefix.slice(-3, -2) === 'p') { | ||
const SCROLL_PADDING_PREFIX = SCROLL + DASH + PADDING + DASH, | ||
SCROLL_PADDING_LEFT = SCROLL_PADDING_PREFIX + LEFT, | ||
SCROLL_PADDING_RIGHT = SCROLL_PADDING_PREFIX + RIGHT, | ||
SCROLL_PADDING_TOP = SCROLL_PADDING_PREFIX + TOP, | ||
SCROLL_PADDING_BOTTOM = SCROLL_PADDING_PREFIX + BOTTOM; | ||
|
||
switch (this.prefix.slice(-2, -1)) { | ||
case X: | ||
return { | ||
[SCROLL_PADDING_LEFT]: this, | ||
[SCROLL_PADDING_RIGHT]: this | ||
} | ||
case Y: | ||
return { | ||
[SCROLL_PADDING_TOP]: this, | ||
[SCROLL_PADDING_BOTTOM]: this | ||
} | ||
case L: | ||
return { | ||
[SCROLL_PADDING_LEFT]: this | ||
} | ||
case R: | ||
return { | ||
[SCROLL_PADDING_RIGHT]: this | ||
} | ||
case T: | ||
return { | ||
[SCROLL_PADDING_TOP]: this | ||
} | ||
case B: | ||
return { | ||
[SCROLL_PADDING_BOTTOM]: this | ||
} | ||
} | ||
} else { | ||
return { | ||
[this.prefix.replace(/-p(?!adding)/, '-' + PADDING).slice(0, -1)]: this | ||
} | ||
} | ||
} | ||
} |
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,6 @@ | ||
import { Style } from '@master/style'; | ||
import { ALIGN, DASH, SCROLL, SNAP } from './constants/css-property-keyword'; | ||
|
||
export class ScrollSnapAlignStyle extends Style { | ||
static override properties = [SCROLL + DASH + SNAP + DASH + ALIGN]; | ||
} |
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,6 @@ | ||
import { Style } from '@master/style'; | ||
import { DASH, SCROLL, SNAP, STOP } from './constants/css-property-keyword'; | ||
|
||
export class ScrollSnapStopStyle extends Style { | ||
static override properties = [SCROLL + DASH + SNAP + DASH + STOP]; | ||
} |
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,6 @@ | ||
import { Style } from '@master/style'; | ||
import { DASH, SCROLL, SNAP, TYPE } from './constants/css-property-keyword'; | ||
|
||
export class ScrollSnapTypeStyle extends Style { | ||
static override properties = [SCROLL + DASH + SNAP + DASH + TYPE]; | ||
} |
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,5 @@ | ||
import { Style } from '@master/style'; | ||
|
||
export class WillChangeStyle extends Style { | ||
static override properties = ['will-change']; | ||
} |