From d18019b7df314dd3157fa284ea273c796aabc3a5 Mon Sep 17 00:00:00 2001 From: Fredrik Nicol Date: Fri, 13 Apr 2018 15:38:45 +0200 Subject: [PATCH] Add patching ability to temporarily patch until they are solved by MDN --- index.d.ts | 124 +++++++++++++++++++++++++++++++------------- index.js.flow | 124 +++++++++++++++++++++++++++++++------------- package.json | 1 + src/data-types.ts | 34 +++++++----- src/data.ts | 106 +++++++++++++++++++++++++++++++++++++ src/data/patches.ts | 76 +++++++++++++++++++++++++++ src/data/svg.ts | 3 ++ src/logger.ts | 11 ++++ src/properties.ts | 45 ++++++---------- src/typer.ts | 21 +++++--- yarn.lock | 2 +- 11 files changed, 427 insertions(+), 120 deletions(-) create mode 100644 src/data.ts create mode 100644 src/data/patches.ts create mode 100644 src/logger.ts diff --git a/index.d.ts b/index.d.ts index c80784e..5b2c5bc 100644 --- a/index.d.ts +++ b/index.d.ts @@ -25,6 +25,7 @@ export interface StandardLonghandProperties { backgroundPositionY?: BackgroundPositionYProperty; backgroundRepeat?: BackgroundRepeatProperty; backgroundSize?: BackgroundSizeProperty; + blockOverflow?: BlockOverflowProperty; blockSize?: BlockSizeProperty; borderBlockEndColor?: BorderBlockEndColorProperty; borderBlockEndStyle?: BorderBlockEndStyleProperty; @@ -177,6 +178,7 @@ export interface StandardLonghandProperties { maxBlockSize?: MaxBlockSizeProperty; maxHeight?: MaxHeightProperty; maxInlineSize?: MaxInlineSizeProperty; + maxLines?: MaxLinesProperty; maxWidth?: MaxWidthProperty; minBlockSize?: MinBlockSizeProperty; minHeight?: MinHeightProperty; @@ -206,7 +208,10 @@ export interface StandardLonghandProperties { outlineStyle?: OutlineStyleProperty; outlineWidth?: OutlineWidthProperty; overflow?: OverflowProperty; + overflowAnchor?: OverflowAnchorProperty; + overflowBlock?: OverflowBlockProperty; overflowClipBox?: OverflowClipBoxProperty; + overflowInline?: OverflowInlineProperty; overflowWrap?: OverflowWrapProperty; overflowX?: OverflowXProperty; overflowY?: OverflowYProperty; @@ -323,6 +328,7 @@ export interface StandardShorthandProperties { gridGap?: GridGapProperty; gridRow?: GridRowProperty; gridTemplate?: GridTemplateProperty; + lineClamp?: LineClampProperty; listStyle?: ListStyleProperty; margin?: MarginProperty; mask?: MaskProperty; @@ -375,10 +381,10 @@ export interface VendorLonghandProperties { MozHyphens?: HyphensProperty; MozImageRegion?: MozImageRegionProperty; MozOrient?: MozOrientProperty; - MozOutlineRadiusBottomleft?: GlobalsString; - MozOutlineRadiusBottomright?: GlobalsString; - MozOutlineRadiusTopleft?: GlobalsString; - MozOutlineRadiusTopright?: GlobalsString; + MozOutlineRadiusBottomleft?: MozOutlineRadiusBottomleftProperty; + MozOutlineRadiusBottomright?: MozOutlineRadiusBottomrightProperty; + MozOutlineRadiusTopleft?: MozOutlineRadiusTopleftProperty; + MozOutlineRadiusTopright?: MozOutlineRadiusToprightProperty; MozPaddingEnd?: PaddingInlineEndProperty; MozPaddingStart?: PaddingInlineStartProperty; MozPerspective?: PerspectiveProperty; @@ -561,7 +567,7 @@ export interface VendorShorthandProperties { MozBorderImage?: BorderImageProperty; MozColumnRule?: ColumnRuleProperty; MozColumns?: ColumnsProperty; - MozOutlineRadius?: GlobalsString; + MozOutlineRadius?: MozOutlineRadiusProperty; MozTransition?: TransitionProperty; msContentZoomLimit?: GlobalsString; msContentZoomSnap?: MsContentZoomSnapProperty; @@ -578,6 +584,7 @@ export interface VendorShorthandProperties { WebkitColumns?: ColumnsProperty; WebkitFlex?: FlexProperty; WebkitFlexFlow?: FlexFlowProperty; + WebkitLineClamp?: WebkitLineClampProperty; WebkitMask?: WebkitMaskProperty; WebkitTextEmphasis?: TextEmphasisProperty; WebkitTextStroke?: WebkitTextStrokeProperty; @@ -754,7 +761,7 @@ export interface SvgProperties { stopColor?: StopColorProperty; stopOpacity?: GlobalsNumber; stroke?: StrokeProperty; - strokeDasharray?: StrokeDasharrayProperty; + strokeDasharray?: StrokeDasharrayProperty; strokeDashoffset?: StrokeDashoffsetProperty; strokeLinecap?: StrokeLinecapProperty; strokeLinejoin?: StrokeLinejoinProperty; @@ -801,6 +808,7 @@ export interface StandardLonghandPropertiesHyphen { "background-position-y"?: BackgroundPositionYProperty; "background-repeat"?: BackgroundRepeatProperty; "background-size"?: BackgroundSizeProperty; + "block-overflow"?: BlockOverflowProperty; "block-size"?: BlockSizeProperty; "border-block-end-color"?: BorderBlockEndColorProperty; "border-block-end-style"?: BorderBlockEndStyleProperty; @@ -953,6 +961,7 @@ export interface StandardLonghandPropertiesHyphen { "max-block-size"?: MaxBlockSizeProperty; "max-height"?: MaxHeightProperty; "max-inline-size"?: MaxInlineSizeProperty; + "max-lines"?: MaxLinesProperty; "max-width"?: MaxWidthProperty; "min-block-size"?: MinBlockSizeProperty; "min-height"?: MinHeightProperty; @@ -982,7 +991,10 @@ export interface StandardLonghandPropertiesHyphen { "outline-style"?: OutlineStyleProperty; "outline-width"?: OutlineWidthProperty; overflow?: OverflowProperty; + "overflow-anchor"?: OverflowAnchorProperty; + "overflow-block"?: OverflowBlockProperty; "overflow-clip-box"?: OverflowClipBoxProperty; + "overflow-inline"?: OverflowInlineProperty; "overflow-wrap"?: OverflowWrapProperty; "overflow-x"?: OverflowXProperty; "overflow-y"?: OverflowYProperty; @@ -1099,6 +1111,7 @@ export interface StandardShorthandPropertiesHyphen { "grid-gap"?: GridGapProperty; "grid-row"?: GridRowProperty; "grid-template"?: GridTemplateProperty; + "line-clamp"?: LineClampProperty; "list-style"?: ListStyleProperty; margin?: MarginProperty; mask?: MaskProperty; @@ -1151,10 +1164,10 @@ export interface VendorLonghandPropertiesHyphen { "-moz-hyphens"?: HyphensProperty; "-moz-image-region"?: MozImageRegionProperty; "-moz-orient"?: MozOrientProperty; - "-moz-outline-radius-bottomleft"?: GlobalsString; - "-moz-outline-radius-bottomright"?: GlobalsString; - "-moz-outline-radius-topleft"?: GlobalsString; - "-moz-outline-radius-topright"?: GlobalsString; + "-moz-outline-radius-bottomleft"?: MozOutlineRadiusBottomleftProperty; + "-moz-outline-radius-bottomright"?: MozOutlineRadiusBottomrightProperty; + "-moz-outline-radius-topleft"?: MozOutlineRadiusTopleftProperty; + "-moz-outline-radius-topright"?: MozOutlineRadiusToprightProperty; "-moz-padding-end"?: PaddingInlineEndProperty; "-moz-padding-start"?: PaddingInlineStartProperty; "-moz-perspective"?: PerspectiveProperty; @@ -1337,7 +1350,7 @@ export interface VendorShorthandPropertiesHyphen { "-moz-border-image"?: BorderImageProperty; "-moz-column-rule"?: ColumnRuleProperty; "-moz-columns"?: ColumnsProperty; - "-moz-outline-radius"?: GlobalsString; + "-moz-outline-radius"?: MozOutlineRadiusProperty; "-moz-transition"?: TransitionProperty; "-ms-content-zoom-limit"?: GlobalsString; "-ms-content-zoom-snap"?: MsContentZoomSnapProperty; @@ -1354,6 +1367,7 @@ export interface VendorShorthandPropertiesHyphen { "-webkit-columns"?: ColumnsProperty; "-webkit-flex"?: FlexProperty; "-webkit-flex-flow"?: FlexFlowProperty; + "-webkit-line-clamp"?: WebkitLineClampProperty; "-webkit-mask"?: WebkitMaskProperty; "-webkit-text-emphasis"?: TextEmphasisProperty; "-webkit-text-stroke"?: WebkitTextStrokeProperty; @@ -1530,7 +1544,7 @@ export interface SvgPropertiesHyphen { "stop-color"?: StopColorProperty; "stop-opacity"?: GlobalsNumber; stroke?: StrokeProperty; - "stroke-dasharray"?: StrokeDasharrayProperty; + "stroke-dasharray"?: StrokeDasharrayProperty; "stroke-dashoffset"?: StrokeDashoffsetProperty; "stroke-linecap"?: StrokeLinecapProperty; "stroke-linejoin"?: StrokeLinejoinProperty; @@ -1581,6 +1595,7 @@ export interface StandardLonghandPropertiesFallback { backgroundPositionY?: BackgroundPositionYProperty | BackgroundPositionYProperty[]; backgroundRepeat?: BackgroundRepeatProperty | BackgroundRepeatProperty[]; backgroundSize?: BackgroundSizeProperty | BackgroundSizeProperty[]; + blockOverflow?: BlockOverflowProperty | BlockOverflowProperty[]; blockSize?: BlockSizeProperty | BlockSizeProperty[]; borderBlockEndColor?: BorderBlockEndColorProperty | BorderBlockEndColorProperty[]; borderBlockEndStyle?: BorderBlockEndStyleProperty | BorderBlockEndStyleProperty[]; @@ -1733,6 +1748,7 @@ export interface StandardLonghandPropertiesFallback { maxBlockSize?: MaxBlockSizeProperty | MaxBlockSizeProperty[]; maxHeight?: MaxHeightProperty | MaxHeightProperty[]; maxInlineSize?: MaxInlineSizeProperty | MaxInlineSizeProperty[]; + maxLines?: MaxLinesProperty | MaxLinesProperty[]; maxWidth?: MaxWidthProperty | MaxWidthProperty[]; minBlockSize?: MinBlockSizeProperty | MinBlockSizeProperty[]; minHeight?: MinHeightProperty | MinHeightProperty[]; @@ -1762,7 +1778,10 @@ export interface StandardLonghandPropertiesFallback { outlineStyle?: OutlineStyleProperty | OutlineStyleProperty[]; outlineWidth?: OutlineWidthProperty | OutlineWidthProperty[]; overflow?: OverflowProperty | OverflowProperty[]; + overflowAnchor?: OverflowAnchorProperty | OverflowAnchorProperty[]; + overflowBlock?: OverflowBlockProperty | OverflowBlockProperty[]; overflowClipBox?: OverflowClipBoxProperty | OverflowClipBoxProperty[]; + overflowInline?: OverflowInlineProperty | OverflowInlineProperty[]; overflowWrap?: OverflowWrapProperty | OverflowWrapProperty[]; overflowX?: OverflowXProperty | OverflowXProperty[]; overflowY?: OverflowYProperty | OverflowYProperty[]; @@ -1879,6 +1898,7 @@ export interface StandardShorthandPropertiesFallback { gridGap?: GridGapProperty | GridGapProperty[]; gridRow?: GridRowProperty | GridRowProperty[]; gridTemplate?: GridTemplateProperty | GridTemplateProperty[]; + lineClamp?: LineClampProperty | LineClampProperty[]; listStyle?: ListStyleProperty | ListStyleProperty[]; margin?: MarginProperty | MarginProperty[]; mask?: MaskProperty | MaskProperty[]; @@ -1931,10 +1951,10 @@ export interface VendorLonghandPropertiesFallback { MozHyphens?: HyphensProperty | HyphensProperty[]; MozImageRegion?: MozImageRegionProperty | MozImageRegionProperty[]; MozOrient?: MozOrientProperty | MozOrientProperty[]; - MozOutlineRadiusBottomleft?: GlobalsString | GlobalsString[]; - MozOutlineRadiusBottomright?: GlobalsString | GlobalsString[]; - MozOutlineRadiusTopleft?: GlobalsString | GlobalsString[]; - MozOutlineRadiusTopright?: GlobalsString | GlobalsString[]; + MozOutlineRadiusBottomleft?: MozOutlineRadiusBottomleftProperty | MozOutlineRadiusBottomleftProperty[]; + MozOutlineRadiusBottomright?: MozOutlineRadiusBottomrightProperty | MozOutlineRadiusBottomrightProperty[]; + MozOutlineRadiusTopleft?: MozOutlineRadiusTopleftProperty | MozOutlineRadiusTopleftProperty[]; + MozOutlineRadiusTopright?: MozOutlineRadiusToprightProperty | MozOutlineRadiusToprightProperty[]; MozPaddingEnd?: PaddingInlineEndProperty | PaddingInlineEndProperty[]; MozPaddingStart?: PaddingInlineStartProperty | PaddingInlineStartProperty[]; MozPerspective?: PerspectiveProperty | PerspectiveProperty[]; @@ -2117,7 +2137,7 @@ export interface VendorShorthandPropertiesFallback { MozBorderImage?: BorderImageProperty | BorderImageProperty[]; MozColumnRule?: ColumnRuleProperty | ColumnRuleProperty[]; MozColumns?: ColumnsProperty | ColumnsProperty[]; - MozOutlineRadius?: GlobalsString | GlobalsString[]; + MozOutlineRadius?: MozOutlineRadiusProperty | MozOutlineRadiusProperty[]; MozTransition?: TransitionProperty | TransitionProperty[]; msContentZoomLimit?: GlobalsString | GlobalsString[]; msContentZoomSnap?: MsContentZoomSnapProperty | MsContentZoomSnapProperty[]; @@ -2134,6 +2154,7 @@ export interface VendorShorthandPropertiesFallback { WebkitColumns?: ColumnsProperty | ColumnsProperty[]; WebkitFlex?: FlexProperty | FlexProperty[]; WebkitFlexFlow?: FlexFlowProperty | FlexFlowProperty[]; + WebkitLineClamp?: WebkitLineClampProperty | WebkitLineClampProperty[]; WebkitMask?: WebkitMaskProperty | WebkitMaskProperty[]; WebkitTextEmphasis?: TextEmphasisProperty | TextEmphasisProperty[]; WebkitTextStroke?: WebkitTextStrokeProperty | WebkitTextStrokeProperty[]; @@ -2310,7 +2331,7 @@ export interface SvgPropertiesFallback { stopColor?: StopColorProperty | StopColorProperty[]; stopOpacity?: GlobalsNumber | GlobalsNumber[]; stroke?: StrokeProperty | StrokeProperty[]; - strokeDasharray?: StrokeDasharrayProperty | StrokeDasharrayProperty[]; + strokeDasharray?: StrokeDasharrayProperty | StrokeDasharrayProperty[]; strokeDashoffset?: StrokeDashoffsetProperty | StrokeDashoffsetProperty[]; strokeLinecap?: StrokeLinecapProperty | StrokeLinecapProperty[]; strokeLinejoin?: StrokeLinejoinProperty | StrokeLinejoinProperty[]; @@ -2361,6 +2382,7 @@ export interface StandardLonghandPropertiesHyphenFallback "background-position-y"?: BackgroundPositionYProperty | BackgroundPositionYProperty[]; "background-repeat"?: BackgroundRepeatProperty | BackgroundRepeatProperty[]; "background-size"?: BackgroundSizeProperty | BackgroundSizeProperty[]; + "block-overflow"?: BlockOverflowProperty | BlockOverflowProperty[]; "block-size"?: BlockSizeProperty | BlockSizeProperty[]; "border-block-end-color"?: BorderBlockEndColorProperty | BorderBlockEndColorProperty[]; "border-block-end-style"?: BorderBlockEndStyleProperty | BorderBlockEndStyleProperty[]; @@ -2513,6 +2535,7 @@ export interface StandardLonghandPropertiesHyphenFallback "max-block-size"?: MaxBlockSizeProperty | MaxBlockSizeProperty[]; "max-height"?: MaxHeightProperty | MaxHeightProperty[]; "max-inline-size"?: MaxInlineSizeProperty | MaxInlineSizeProperty[]; + "max-lines"?: MaxLinesProperty | MaxLinesProperty[]; "max-width"?: MaxWidthProperty | MaxWidthProperty[]; "min-block-size"?: MinBlockSizeProperty | MinBlockSizeProperty[]; "min-height"?: MinHeightProperty | MinHeightProperty[]; @@ -2542,7 +2565,10 @@ export interface StandardLonghandPropertiesHyphenFallback "outline-style"?: OutlineStyleProperty | OutlineStyleProperty[]; "outline-width"?: OutlineWidthProperty | OutlineWidthProperty[]; overflow?: OverflowProperty | OverflowProperty[]; + "overflow-anchor"?: OverflowAnchorProperty | OverflowAnchorProperty[]; + "overflow-block"?: OverflowBlockProperty | OverflowBlockProperty[]; "overflow-clip-box"?: OverflowClipBoxProperty | OverflowClipBoxProperty[]; + "overflow-inline"?: OverflowInlineProperty | OverflowInlineProperty[]; "overflow-wrap"?: OverflowWrapProperty | OverflowWrapProperty[]; "overflow-x"?: OverflowXProperty | OverflowXProperty[]; "overflow-y"?: OverflowYProperty | OverflowYProperty[]; @@ -2659,6 +2685,7 @@ export interface StandardShorthandPropertiesHyphenFallback "grid-gap"?: GridGapProperty | GridGapProperty[]; "grid-row"?: GridRowProperty | GridRowProperty[]; "grid-template"?: GridTemplateProperty | GridTemplateProperty[]; + "line-clamp"?: LineClampProperty | LineClampProperty[]; "list-style"?: ListStyleProperty | ListStyleProperty[]; margin?: MarginProperty | MarginProperty[]; mask?: MaskProperty | MaskProperty[]; @@ -2713,10 +2740,10 @@ export interface VendorLonghandPropertiesHyphenFallback { "-moz-hyphens"?: HyphensProperty | HyphensProperty[]; "-moz-image-region"?: MozImageRegionProperty | MozImageRegionProperty[]; "-moz-orient"?: MozOrientProperty | MozOrientProperty[]; - "-moz-outline-radius-bottomleft"?: GlobalsString | GlobalsString[]; - "-moz-outline-radius-bottomright"?: GlobalsString | GlobalsString[]; - "-moz-outline-radius-topleft"?: GlobalsString | GlobalsString[]; - "-moz-outline-radius-topright"?: GlobalsString | GlobalsString[]; + "-moz-outline-radius-bottomleft"?: MozOutlineRadiusBottomleftProperty | MozOutlineRadiusBottomleftProperty[]; + "-moz-outline-radius-bottomright"?: MozOutlineRadiusBottomrightProperty | MozOutlineRadiusBottomrightProperty[]; + "-moz-outline-radius-topleft"?: MozOutlineRadiusTopleftProperty | MozOutlineRadiusTopleftProperty[]; + "-moz-outline-radius-topright"?: MozOutlineRadiusToprightProperty | MozOutlineRadiusToprightProperty[]; "-moz-padding-end"?: PaddingInlineEndProperty | PaddingInlineEndProperty[]; "-moz-padding-start"?: PaddingInlineStartProperty | PaddingInlineStartProperty[]; "-moz-perspective"?: PerspectiveProperty | PerspectiveProperty[]; @@ -2899,7 +2926,7 @@ export interface VendorShorthandPropertiesHyphenFallback { "-moz-border-image"?: BorderImageProperty | BorderImageProperty[]; "-moz-column-rule"?: ColumnRuleProperty | ColumnRuleProperty[]; "-moz-columns"?: ColumnsProperty | ColumnsProperty[]; - "-moz-outline-radius"?: GlobalsString | GlobalsString[]; + "-moz-outline-radius"?: MozOutlineRadiusProperty | MozOutlineRadiusProperty[]; "-moz-transition"?: TransitionProperty | TransitionProperty[]; "-ms-content-zoom-limit"?: GlobalsString | GlobalsString[]; "-ms-content-zoom-snap"?: MsContentZoomSnapProperty | MsContentZoomSnapProperty[]; @@ -2916,6 +2943,7 @@ export interface VendorShorthandPropertiesHyphenFallback { "-webkit-columns"?: ColumnsProperty | ColumnsProperty[]; "-webkit-flex"?: FlexProperty | FlexProperty[]; "-webkit-flex-flow"?: FlexFlowProperty | FlexFlowProperty[]; + "-webkit-line-clamp"?: WebkitLineClampProperty | WebkitLineClampProperty[]; "-webkit-mask"?: WebkitMaskProperty | WebkitMaskProperty[]; "-webkit-text-emphasis"?: TextEmphasisProperty | TextEmphasisProperty[]; "-webkit-text-stroke"?: WebkitTextStrokeProperty | WebkitTextStrokeProperty[]; @@ -3092,7 +3120,7 @@ export interface SvgPropertiesHyphenFallback { "stop-color"?: StopColorProperty | StopColorProperty[]; "stop-opacity"?: GlobalsNumber | GlobalsNumber[]; stroke?: StrokeProperty | StrokeProperty[]; - "stroke-dasharray"?: StrokeDasharrayProperty | StrokeDasharrayProperty[]; + "stroke-dasharray"?: StrokeDasharrayProperty | StrokeDasharrayProperty[]; "stroke-dashoffset"?: StrokeDashoffsetProperty | StrokeDashoffsetProperty[]; "stroke-linecap"?: StrokeLinecapProperty | StrokeLinecapProperty[]; "stroke-linejoin"?: StrokeLinejoinProperty | StrokeLinejoinProperty[]; @@ -3524,15 +3552,17 @@ type BackgroundRepeatProperty = Globals | RepeatStyle | string; type BackgroundSizeProperty = Globals | BgSize | string; +type BlockOverflowProperty = Globals | "clip" | "ellipsis" | string; + type BlockSizeProperty = Globals | TLength | "auto" | "available" | "fit-content" | "max-content" | "min-content" | string; -type BorderBlockEndColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockEndColorProperty = Globals | Color; type BorderBlockEndStyleProperty = Globals | BrStyle | string; type BorderBlockEndWidthProperty = Globals | BrWidth | string; -type BorderBlockStartColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockStartColorProperty = Globals | Color; type BorderBlockStartStyleProperty = Globals | BrStyle | string; @@ -3560,13 +3590,13 @@ type BorderImageSourceProperty = Globals | "none" | string; type BorderImageWidthProperty = Globals | TLength | "auto" | string | number; -type BorderInlineEndColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineEndColorProperty = Globals | Color; type BorderInlineEndStyleProperty = Globals | BrStyle | string; type BorderInlineEndWidthProperty = Globals | BrWidth | string; -type BorderInlineStartColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineStartColorProperty = Globals | Color; type BorderInlineStartStyleProperty = Globals | BrStyle | string; @@ -3924,6 +3954,8 @@ type MaxHeightProperty = Globals | TLength | "fill-available" | "fit-co type MaxInlineSizeProperty = Globals | TLength | "fill-available" | "fit-content" | "max-content" | "min-content" | "none" | string; +type MaxLinesProperty = Globals | "none" | number; + type MaxWidthProperty = Globals | TLength | "fill-available" | "fit-content" | "max-content" | "min-content" | "none" | string; type MinBlockSizeProperty = Globals | TLength | "auto" | "fill-available" | "fit-content" | "max-content" | "min-content" | string; @@ -3968,8 +4000,14 @@ type OutlineWidthProperty = Globals | BrWidth; type OverflowProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; +type OverflowAnchorProperty = Globals | "auto" | "none"; + +type OverflowBlockProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; + type OverflowClipBoxProperty = Globals | "content-box" | "padding-box"; +type OverflowInlineProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; + type OverflowWrapProperty = Globals | "break-word" | "normal"; type OverflowXProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; @@ -4176,9 +4214,9 @@ type BackgroundProperty = Globals | FinalBgLayer | string; type BorderProperty = Globals | BrWidth | BrStyle | Color | string; -type BorderBlockEndProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockEndProperty = Globals | BrWidth | BrStyle | Color | string; -type BorderBlockStartProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockStartProperty = Globals | BrWidth | BrStyle | Color | string; type BorderBottomProperty = Globals | BrWidth | BrStyle | Color | string; @@ -4186,9 +4224,9 @@ type BorderColorProperty = Globals | Color | string; type BorderImageProperty = Globals | "none" | "repeat" | "round" | "space" | "stretch" | string | number; -type BorderInlineEndProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineEndProperty = Globals | BrWidth | BrStyle | Color | string; -type BorderInlineStartProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineStartProperty = Globals | BrWidth | BrStyle | Color | string; type BorderLeftProperty = Globals | BrWidth | BrStyle | Color | string; @@ -4226,6 +4264,8 @@ type GridRowProperty = Globals | GridLine | string; type GridTemplateProperty = Globals | "none" | string; +type LineClampProperty = Globals | "none" | number; + type ListStyleProperty = Globals | "inside" | "none" | "outside" | string; type MarginProperty = Globals | TLength | "auto" | string; @@ -4377,6 +4417,14 @@ type MozImageRegionProperty = Globals | "auto" | string; type MozOrientProperty = Globals | "block" | "horizontal" | "inline" | "vertical"; +type MozOutlineRadiusBottomleftProperty = Globals | TLength | string; + +type MozOutlineRadiusBottomrightProperty = Globals | TLength | string; + +type MozOutlineRadiusTopleftProperty = Globals | TLength | string; + +type MozOutlineRadiusToprightProperty = Globals | TLength | string; + type MozStackSizingProperty = Globals | "ignore" | "stretch-to-fit"; type MozTextBlinkProperty = Globals | "blink" | "none"; @@ -4461,7 +4509,7 @@ type MsWrapMarginProperty = Globals | TLength; type MsWrapThroughProperty = Globals | "none" | "wrap"; -type WebkitBorderBeforeColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type WebkitBorderBeforeColorProperty = Globals | Color; type WebkitBorderBeforeStyleProperty = Globals | BrStyle | string; @@ -4503,9 +4551,13 @@ type WebkitTextStrokeWidthProperty = Globals | TLength; type WebkitTouchCalloutProperty = Globals | "default" | "none"; +type MozOutlineRadiusProperty = Globals | TLength | string; + type MsContentZoomSnapProperty = Globals | "mandatory" | "none" | "proximity" | string; -type WebkitBorderBeforeProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type WebkitBorderBeforeProperty = Globals | BrWidth | BrStyle | Color | string; + +type WebkitLineClampProperty = Globals | "none" | number; type WebkitMaskProperty = Globals | "none" | string; @@ -4597,7 +4649,7 @@ type StopColorProperty = Globals | Color | "currentColor"; type StrokeProperty = Globals | Paint; -type StrokeDasharrayProperty = Globals | "none" | string; +type StrokeDasharrayProperty = Globals | Dasharray | "none"; type StrokeDashoffsetProperty = Globals | TLength | string; @@ -4755,6 +4807,8 @@ type ContentPosition = "center" | "end" | "flex-end" | "flex-start" | "start"; type CubicBezierTimingFunction = "ease" | "ease-in" | "ease-in-out" | "ease-out" | string; +type Dasharray = TLength | string | number; + type DeprecatedSystemColor = | "ActiveBorder" | "ActiveCaption" diff --git a/index.js.flow b/index.js.flow index 54a11b7..15b0ec3 100644 --- a/index.js.flow +++ b/index.js.flow @@ -26,6 +26,7 @@ export type StandardLonghandProperties = { backgroundPositionY?: BackgroundPositionYProperty, backgroundRepeat?: BackgroundRepeatProperty, backgroundSize?: BackgroundSizeProperty, + blockOverflow?: BlockOverflowProperty, blockSize?: BlockSizeProperty, borderBlockEndColor?: BorderBlockEndColorProperty, borderBlockEndStyle?: BorderBlockEndStyleProperty, @@ -178,6 +179,7 @@ export type StandardLonghandProperties = { maxBlockSize?: MaxBlockSizeProperty, maxHeight?: MaxHeightProperty, maxInlineSize?: MaxInlineSizeProperty, + maxLines?: MaxLinesProperty, maxWidth?: MaxWidthProperty, minBlockSize?: MinBlockSizeProperty, minHeight?: MinHeightProperty, @@ -207,7 +209,10 @@ export type StandardLonghandProperties = { outlineStyle?: OutlineStyleProperty, outlineWidth?: OutlineWidthProperty, overflow?: OverflowProperty, + overflowAnchor?: OverflowAnchorProperty, + overflowBlock?: OverflowBlockProperty, overflowClipBox?: OverflowClipBoxProperty, + overflowInline?: OverflowInlineProperty, overflowWrap?: OverflowWrapProperty, overflowX?: OverflowXProperty, overflowY?: OverflowYProperty, @@ -324,6 +329,7 @@ export type StandardShorthandProperties = { gridGap?: GridGapProperty, gridRow?: GridRowProperty, gridTemplate?: GridTemplateProperty, + lineClamp?: LineClampProperty, listStyle?: ListStyleProperty, margin?: MarginProperty, mask?: MaskProperty, @@ -376,10 +382,10 @@ export type VendorLonghandProperties = { MozHyphens?: HyphensProperty, MozImageRegion?: MozImageRegionProperty, MozOrient?: MozOrientProperty, - MozOutlineRadiusBottomleft?: GlobalsString, - MozOutlineRadiusBottomright?: GlobalsString, - MozOutlineRadiusTopleft?: GlobalsString, - MozOutlineRadiusTopright?: GlobalsString, + MozOutlineRadiusBottomleft?: MozOutlineRadiusBottomleftProperty, + MozOutlineRadiusBottomright?: MozOutlineRadiusBottomrightProperty, + MozOutlineRadiusTopleft?: MozOutlineRadiusTopleftProperty, + MozOutlineRadiusTopright?: MozOutlineRadiusToprightProperty, MozPaddingEnd?: PaddingInlineEndProperty, MozPaddingStart?: PaddingInlineStartProperty, MozPerspective?: PerspectiveProperty, @@ -562,7 +568,7 @@ export type VendorShorthandProperties = { MozBorderImage?: BorderImageProperty, MozColumnRule?: ColumnRuleProperty, MozColumns?: ColumnsProperty, - MozOutlineRadius?: GlobalsString, + MozOutlineRadius?: MozOutlineRadiusProperty, MozTransition?: TransitionProperty, msContentZoomLimit?: GlobalsString, msContentZoomSnap?: MsContentZoomSnapProperty, @@ -579,6 +585,7 @@ export type VendorShorthandProperties = { WebkitColumns?: ColumnsProperty, WebkitFlex?: FlexProperty, WebkitFlexFlow?: FlexFlowProperty, + WebkitLineClamp?: WebkitLineClampProperty, WebkitMask?: WebkitMaskProperty, WebkitTextEmphasis?: TextEmphasisProperty, WebkitTextStroke?: WebkitTextStrokeProperty, @@ -695,7 +702,7 @@ export type SvgProperties = { stopColor?: StopColorProperty, stopOpacity?: GlobalsNumber, stroke?: StrokeProperty, - strokeDasharray?: StrokeDasharrayProperty, + strokeDasharray?: StrokeDasharrayProperty, strokeDashoffset?: StrokeDashoffsetProperty, strokeLinecap?: StrokeLinecapProperty, strokeLinejoin?: StrokeLinejoinProperty, @@ -742,6 +749,7 @@ export type StandardLonghandPropertiesHyphen = { "background-position-y"?: BackgroundPositionYProperty, "background-repeat"?: BackgroundRepeatProperty, "background-size"?: BackgroundSizeProperty, + "block-overflow"?: BlockOverflowProperty, "block-size"?: BlockSizeProperty, "border-block-end-color"?: BorderBlockEndColorProperty, "border-block-end-style"?: BorderBlockEndStyleProperty, @@ -894,6 +902,7 @@ export type StandardLonghandPropertiesHyphen = { "max-block-size"?: MaxBlockSizeProperty, "max-height"?: MaxHeightProperty, "max-inline-size"?: MaxInlineSizeProperty, + "max-lines"?: MaxLinesProperty, "max-width"?: MaxWidthProperty, "min-block-size"?: MinBlockSizeProperty, "min-height"?: MinHeightProperty, @@ -923,7 +932,10 @@ export type StandardLonghandPropertiesHyphen = { "outline-style"?: OutlineStyleProperty, "outline-width"?: OutlineWidthProperty, overflow?: OverflowProperty, + "overflow-anchor"?: OverflowAnchorProperty, + "overflow-block"?: OverflowBlockProperty, "overflow-clip-box"?: OverflowClipBoxProperty, + "overflow-inline"?: OverflowInlineProperty, "overflow-wrap"?: OverflowWrapProperty, "overflow-x"?: OverflowXProperty, "overflow-y"?: OverflowYProperty, @@ -1040,6 +1052,7 @@ export type StandardShorthandPropertiesHyphen = { "grid-gap"?: GridGapProperty, "grid-row"?: GridRowProperty, "grid-template"?: GridTemplateProperty, + "line-clamp"?: LineClampProperty, "list-style"?: ListStyleProperty, margin?: MarginProperty, mask?: MaskProperty, @@ -1092,10 +1105,10 @@ export type VendorLonghandPropertiesHyphen = { "-moz-hyphens"?: HyphensProperty, "-moz-image-region"?: MozImageRegionProperty, "-moz-orient"?: MozOrientProperty, - "-moz-outline-radius-bottomleft"?: GlobalsString, - "-moz-outline-radius-bottomright"?: GlobalsString, - "-moz-outline-radius-topleft"?: GlobalsString, - "-moz-outline-radius-topright"?: GlobalsString, + "-moz-outline-radius-bottomleft"?: MozOutlineRadiusBottomleftProperty, + "-moz-outline-radius-bottomright"?: MozOutlineRadiusBottomrightProperty, + "-moz-outline-radius-topleft"?: MozOutlineRadiusTopleftProperty, + "-moz-outline-radius-topright"?: MozOutlineRadiusToprightProperty, "-moz-padding-end"?: PaddingInlineEndProperty, "-moz-padding-start"?: PaddingInlineStartProperty, "-moz-perspective"?: PerspectiveProperty, @@ -1278,7 +1291,7 @@ export type VendorShorthandPropertiesHyphen = { "-moz-border-image"?: BorderImageProperty, "-moz-column-rule"?: ColumnRuleProperty, "-moz-columns"?: ColumnsProperty, - "-moz-outline-radius"?: GlobalsString, + "-moz-outline-radius"?: MozOutlineRadiusProperty, "-moz-transition"?: TransitionProperty, "-ms-content-zoom-limit"?: GlobalsString, "-ms-content-zoom-snap"?: MsContentZoomSnapProperty, @@ -1295,6 +1308,7 @@ export type VendorShorthandPropertiesHyphen = { "-webkit-columns"?: ColumnsProperty, "-webkit-flex"?: FlexProperty, "-webkit-flex-flow"?: FlexFlowProperty, + "-webkit-line-clamp"?: WebkitLineClampProperty, "-webkit-mask"?: WebkitMaskProperty, "-webkit-text-emphasis"?: TextEmphasisProperty, "-webkit-text-stroke"?: WebkitTextStrokeProperty, @@ -1411,7 +1425,7 @@ export type SvgPropertiesHyphen = { "stop-color"?: StopColorProperty, "stop-opacity"?: GlobalsNumber, stroke?: StrokeProperty, - "stroke-dasharray"?: StrokeDasharrayProperty, + "stroke-dasharray"?: StrokeDasharrayProperty, "stroke-dashoffset"?: StrokeDashoffsetProperty, "stroke-linecap"?: StrokeLinecapProperty, "stroke-linejoin"?: StrokeLinejoinProperty, @@ -1461,6 +1475,7 @@ export type StandardLonghandPropertiesFallback = { backgroundPositionY?: BackgroundPositionYProperty | BackgroundPositionYProperty[], backgroundRepeat?: BackgroundRepeatProperty | BackgroundRepeatProperty[], backgroundSize?: BackgroundSizeProperty | BackgroundSizeProperty[], + blockOverflow?: BlockOverflowProperty | BlockOverflowProperty[], blockSize?: BlockSizeProperty | BlockSizeProperty[], borderBlockEndColor?: BorderBlockEndColorProperty | BorderBlockEndColorProperty[], borderBlockEndStyle?: BorderBlockEndStyleProperty | BorderBlockEndStyleProperty[], @@ -1613,6 +1628,7 @@ export type StandardLonghandPropertiesFallback = { maxBlockSize?: MaxBlockSizeProperty | MaxBlockSizeProperty[], maxHeight?: MaxHeightProperty | MaxHeightProperty[], maxInlineSize?: MaxInlineSizeProperty | MaxInlineSizeProperty[], + maxLines?: MaxLinesProperty | MaxLinesProperty[], maxWidth?: MaxWidthProperty | MaxWidthProperty[], minBlockSize?: MinBlockSizeProperty | MinBlockSizeProperty[], minHeight?: MinHeightProperty | MinHeightProperty[], @@ -1642,7 +1658,10 @@ export type StandardLonghandPropertiesFallback = { outlineStyle?: OutlineStyleProperty | OutlineStyleProperty[], outlineWidth?: OutlineWidthProperty | OutlineWidthProperty[], overflow?: OverflowProperty | OverflowProperty[], + overflowAnchor?: OverflowAnchorProperty | OverflowAnchorProperty[], + overflowBlock?: OverflowBlockProperty | OverflowBlockProperty[], overflowClipBox?: OverflowClipBoxProperty | OverflowClipBoxProperty[], + overflowInline?: OverflowInlineProperty | OverflowInlineProperty[], overflowWrap?: OverflowWrapProperty | OverflowWrapProperty[], overflowX?: OverflowXProperty | OverflowXProperty[], overflowY?: OverflowYProperty | OverflowYProperty[], @@ -1759,6 +1778,7 @@ export type StandardShorthandPropertiesFallback = { gridGap?: GridGapProperty | GridGapProperty[], gridRow?: GridRowProperty | GridRowProperty[], gridTemplate?: GridTemplateProperty | GridTemplateProperty[], + lineClamp?: LineClampProperty | LineClampProperty[], listStyle?: ListStyleProperty | ListStyleProperty[], margin?: MarginProperty | MarginProperty[], mask?: MaskProperty | MaskProperty[], @@ -1811,10 +1831,10 @@ export type VendorLonghandPropertiesFallback = { MozHyphens?: HyphensProperty | HyphensProperty[], MozImageRegion?: MozImageRegionProperty | MozImageRegionProperty[], MozOrient?: MozOrientProperty | MozOrientProperty[], - MozOutlineRadiusBottomleft?: GlobalsString | GlobalsString[], - MozOutlineRadiusBottomright?: GlobalsString | GlobalsString[], - MozOutlineRadiusTopleft?: GlobalsString | GlobalsString[], - MozOutlineRadiusTopright?: GlobalsString | GlobalsString[], + MozOutlineRadiusBottomleft?: MozOutlineRadiusBottomleftProperty | MozOutlineRadiusBottomleftProperty[], + MozOutlineRadiusBottomright?: MozOutlineRadiusBottomrightProperty | MozOutlineRadiusBottomrightProperty[], + MozOutlineRadiusTopleft?: MozOutlineRadiusTopleftProperty | MozOutlineRadiusTopleftProperty[], + MozOutlineRadiusTopright?: MozOutlineRadiusToprightProperty | MozOutlineRadiusToprightProperty[], MozPaddingEnd?: PaddingInlineEndProperty | PaddingInlineEndProperty[], MozPaddingStart?: PaddingInlineStartProperty | PaddingInlineStartProperty[], MozPerspective?: PerspectiveProperty | PerspectiveProperty[], @@ -1997,7 +2017,7 @@ export type VendorShorthandPropertiesFallback = { MozBorderImage?: BorderImageProperty | BorderImageProperty[], MozColumnRule?: ColumnRuleProperty | ColumnRuleProperty[], MozColumns?: ColumnsProperty | ColumnsProperty[], - MozOutlineRadius?: GlobalsString | GlobalsString[], + MozOutlineRadius?: MozOutlineRadiusProperty | MozOutlineRadiusProperty[], MozTransition?: TransitionProperty | TransitionProperty[], msContentZoomLimit?: GlobalsString | GlobalsString[], msContentZoomSnap?: MsContentZoomSnapProperty | MsContentZoomSnapProperty[], @@ -2014,6 +2034,7 @@ export type VendorShorthandPropertiesFallback = { WebkitColumns?: ColumnsProperty | ColumnsProperty[], WebkitFlex?: FlexProperty | FlexProperty[], WebkitFlexFlow?: FlexFlowProperty | FlexFlowProperty[], + WebkitLineClamp?: WebkitLineClampProperty | WebkitLineClampProperty[], WebkitMask?: WebkitMaskProperty | WebkitMaskProperty[], WebkitTextEmphasis?: TextEmphasisProperty | TextEmphasisProperty[], WebkitTextStroke?: WebkitTextStrokeProperty | WebkitTextStrokeProperty[], @@ -2130,7 +2151,7 @@ export type SvgPropertiesFallback = { stopColor?: StopColorProperty | StopColorProperty[], stopOpacity?: GlobalsNumber | GlobalsNumber[], stroke?: StrokeProperty | StrokeProperty[], - strokeDasharray?: StrokeDasharrayProperty | StrokeDasharrayProperty[], + strokeDasharray?: StrokeDasharrayProperty | StrokeDasharrayProperty[], strokeDashoffset?: StrokeDashoffsetProperty | StrokeDashoffsetProperty[], strokeLinecap?: StrokeLinecapProperty | StrokeLinecapProperty[], strokeLinejoin?: StrokeLinejoinProperty | StrokeLinejoinProperty[], @@ -2180,6 +2201,7 @@ export type StandardLonghandPropertiesHyphenFallback = { "background-position-y"?: BackgroundPositionYProperty | BackgroundPositionYProperty[], "background-repeat"?: BackgroundRepeatProperty | BackgroundRepeatProperty[], "background-size"?: BackgroundSizeProperty | BackgroundSizeProperty[], + "block-overflow"?: BlockOverflowProperty | BlockOverflowProperty[], "block-size"?: BlockSizeProperty | BlockSizeProperty[], "border-block-end-color"?: BorderBlockEndColorProperty | BorderBlockEndColorProperty[], "border-block-end-style"?: BorderBlockEndStyleProperty | BorderBlockEndStyleProperty[], @@ -2332,6 +2354,7 @@ export type StandardLonghandPropertiesHyphenFallback = { "max-block-size"?: MaxBlockSizeProperty | MaxBlockSizeProperty[], "max-height"?: MaxHeightProperty | MaxHeightProperty[], "max-inline-size"?: MaxInlineSizeProperty | MaxInlineSizeProperty[], + "max-lines"?: MaxLinesProperty | MaxLinesProperty[], "max-width"?: MaxWidthProperty | MaxWidthProperty[], "min-block-size"?: MinBlockSizeProperty | MinBlockSizeProperty[], "min-height"?: MinHeightProperty | MinHeightProperty[], @@ -2361,7 +2384,10 @@ export type StandardLonghandPropertiesHyphenFallback = { "outline-style"?: OutlineStyleProperty | OutlineStyleProperty[], "outline-width"?: OutlineWidthProperty | OutlineWidthProperty[], overflow?: OverflowProperty | OverflowProperty[], + "overflow-anchor"?: OverflowAnchorProperty | OverflowAnchorProperty[], + "overflow-block"?: OverflowBlockProperty | OverflowBlockProperty[], "overflow-clip-box"?: OverflowClipBoxProperty | OverflowClipBoxProperty[], + "overflow-inline"?: OverflowInlineProperty | OverflowInlineProperty[], "overflow-wrap"?: OverflowWrapProperty | OverflowWrapProperty[], "overflow-x"?: OverflowXProperty | OverflowXProperty[], "overflow-y"?: OverflowYProperty | OverflowYProperty[], @@ -2478,6 +2504,7 @@ export type StandardShorthandPropertiesHyphenFallback = { "grid-gap"?: GridGapProperty | GridGapProperty[], "grid-row"?: GridRowProperty | GridRowProperty[], "grid-template"?: GridTemplateProperty | GridTemplateProperty[], + "line-clamp"?: LineClampProperty | LineClampProperty[], "list-style"?: ListStyleProperty | ListStyleProperty[], margin?: MarginProperty | MarginProperty[], mask?: MaskProperty | MaskProperty[], @@ -2530,10 +2557,10 @@ export type VendorLonghandPropertiesHyphenFallback = { "-moz-hyphens"?: HyphensProperty | HyphensProperty[], "-moz-image-region"?: MozImageRegionProperty | MozImageRegionProperty[], "-moz-orient"?: MozOrientProperty | MozOrientProperty[], - "-moz-outline-radius-bottomleft"?: GlobalsString | GlobalsString[], - "-moz-outline-radius-bottomright"?: GlobalsString | GlobalsString[], - "-moz-outline-radius-topleft"?: GlobalsString | GlobalsString[], - "-moz-outline-radius-topright"?: GlobalsString | GlobalsString[], + "-moz-outline-radius-bottomleft"?: MozOutlineRadiusBottomleftProperty | MozOutlineRadiusBottomleftProperty[], + "-moz-outline-radius-bottomright"?: MozOutlineRadiusBottomrightProperty | MozOutlineRadiusBottomrightProperty[], + "-moz-outline-radius-topleft"?: MozOutlineRadiusTopleftProperty | MozOutlineRadiusTopleftProperty[], + "-moz-outline-radius-topright"?: MozOutlineRadiusToprightProperty | MozOutlineRadiusToprightProperty[], "-moz-padding-end"?: PaddingInlineEndProperty | PaddingInlineEndProperty[], "-moz-padding-start"?: PaddingInlineStartProperty | PaddingInlineStartProperty[], "-moz-perspective"?: PerspectiveProperty | PerspectiveProperty[], @@ -2716,7 +2743,7 @@ export type VendorShorthandPropertiesHyphenFallback = { "-moz-border-image"?: BorderImageProperty | BorderImageProperty[], "-moz-column-rule"?: ColumnRuleProperty | ColumnRuleProperty[], "-moz-columns"?: ColumnsProperty | ColumnsProperty[], - "-moz-outline-radius"?: GlobalsString | GlobalsString[], + "-moz-outline-radius"?: MozOutlineRadiusProperty | MozOutlineRadiusProperty[], "-moz-transition"?: TransitionProperty | TransitionProperty[], "-ms-content-zoom-limit"?: GlobalsString | GlobalsString[], "-ms-content-zoom-snap"?: MsContentZoomSnapProperty | MsContentZoomSnapProperty[], @@ -2733,6 +2760,7 @@ export type VendorShorthandPropertiesHyphenFallback = { "-webkit-columns"?: ColumnsProperty | ColumnsProperty[], "-webkit-flex"?: FlexProperty | FlexProperty[], "-webkit-flex-flow"?: FlexFlowProperty | FlexFlowProperty[], + "-webkit-line-clamp"?: WebkitLineClampProperty | WebkitLineClampProperty[], "-webkit-mask"?: WebkitMaskProperty | WebkitMaskProperty[], "-webkit-text-emphasis"?: TextEmphasisProperty | TextEmphasisProperty[], "-webkit-text-stroke"?: WebkitTextStrokeProperty | WebkitTextStrokeProperty[], @@ -2849,7 +2877,7 @@ export type SvgPropertiesHyphenFallback = { "stop-color"?: StopColorProperty | StopColorProperty[], "stop-opacity"?: GlobalsNumber | GlobalsNumber[], stroke?: StrokeProperty | StrokeProperty[], - "stroke-dasharray"?: StrokeDasharrayProperty | StrokeDasharrayProperty[], + "stroke-dasharray"?: StrokeDasharrayProperty | StrokeDasharrayProperty[], "stroke-dashoffset"?: StrokeDashoffsetProperty | StrokeDashoffsetProperty[], "stroke-linecap"?: StrokeLinecapProperty | StrokeLinecapProperty[], "stroke-linejoin"?: StrokeLinejoinProperty | StrokeLinejoinProperty[], @@ -3280,15 +3308,17 @@ type BackgroundRepeatProperty = Globals | RepeatStyle | string; type BackgroundSizeProperty = Globals | BgSize | string; +type BlockOverflowProperty = Globals | "clip" | "ellipsis" | string; + type BlockSizeProperty = Globals | TLength | "auto" | "available" | "fit-content" | "max-content" | "min-content" | string; -type BorderBlockEndColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockEndColorProperty = Globals | Color; type BorderBlockEndStyleProperty = Globals | BrStyle | string; type BorderBlockEndWidthProperty = Globals | BrWidth | string; -type BorderBlockStartColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockStartColorProperty = Globals | Color; type BorderBlockStartStyleProperty = Globals | BrStyle | string; @@ -3316,13 +3346,13 @@ type BorderImageSourceProperty = Globals | "none" | string; type BorderImageWidthProperty = Globals | TLength | "auto" | string | number; -type BorderInlineEndColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineEndColorProperty = Globals | Color; type BorderInlineEndStyleProperty = Globals | BrStyle | string; type BorderInlineEndWidthProperty = Globals | BrWidth | string; -type BorderInlineStartColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineStartColorProperty = Globals | Color; type BorderInlineStartStyleProperty = Globals | BrStyle | string; @@ -3680,6 +3710,8 @@ type MaxHeightProperty = Globals | TLength | "fill-available" | "fit-co type MaxInlineSizeProperty = Globals | TLength | "fill-available" | "fit-content" | "max-content" | "min-content" | "none" | string; +type MaxLinesProperty = Globals | "none" | number; + type MaxWidthProperty = Globals | TLength | "fill-available" | "fit-content" | "max-content" | "min-content" | "none" | string; type MinBlockSizeProperty = Globals | TLength | "auto" | "fill-available" | "fit-content" | "max-content" | "min-content" | string; @@ -3724,8 +3756,14 @@ type OutlineWidthProperty = Globals | BrWidth; type OverflowProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; +type OverflowAnchorProperty = Globals | "auto" | "none"; + +type OverflowBlockProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; + type OverflowClipBoxProperty = Globals | "content-box" | "padding-box"; +type OverflowInlineProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; + type OverflowWrapProperty = Globals | "break-word" | "normal"; type OverflowXProperty = Globals | "auto" | "clip" | "hidden" | "scroll" | "visible"; @@ -3932,9 +3970,9 @@ type BackgroundProperty = Globals | FinalBgLayer | string; type BorderProperty = Globals | BrWidth | BrStyle | Color | string; -type BorderBlockEndProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockEndProperty = Globals | BrWidth | BrStyle | Color | string; -type BorderBlockStartProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderBlockStartProperty = Globals | BrWidth | BrStyle | Color | string; type BorderBottomProperty = Globals | BrWidth | BrStyle | Color | string; @@ -3942,9 +3980,9 @@ type BorderColorProperty = Globals | Color | string; type BorderImageProperty = Globals | "none" | "repeat" | "round" | "space" | "stretch" | string | number; -type BorderInlineEndProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineEndProperty = Globals | BrWidth | BrStyle | Color | string; -type BorderInlineStartProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type BorderInlineStartProperty = Globals | BrWidth | BrStyle | Color | string; type BorderLeftProperty = Globals | BrWidth | BrStyle | Color | string; @@ -3982,6 +4020,8 @@ type GridRowProperty = Globals | GridLine | string; type GridTemplateProperty = Globals | "none" | string; +type LineClampProperty = Globals | "none" | number; + type ListStyleProperty = Globals | "inside" | "none" | "outside" | string; type MarginProperty = Globals | TLength | "auto" | string; @@ -4133,6 +4173,14 @@ type MozImageRegionProperty = Globals | "auto" | string; type MozOrientProperty = Globals | "block" | "horizontal" | "inline" | "vertical"; +type MozOutlineRadiusBottomleftProperty = Globals | TLength | string; + +type MozOutlineRadiusBottomrightProperty = Globals | TLength | string; + +type MozOutlineRadiusTopleftProperty = Globals | TLength | string; + +type MozOutlineRadiusToprightProperty = Globals | TLength | string; + type MozStackSizingProperty = Globals | "ignore" | "stretch-to-fit"; type MozTextBlinkProperty = Globals | "blink" | "none"; @@ -4217,7 +4265,7 @@ type MsWrapMarginProperty = Globals | TLength; type MsWrapThroughProperty = Globals | "none" | "wrap"; -type WebkitBorderBeforeColorProperty = Globals | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type WebkitBorderBeforeColorProperty = Globals | Color; type WebkitBorderBeforeStyleProperty = Globals | BrStyle | string; @@ -4259,9 +4307,13 @@ type WebkitTextStrokeWidthProperty = Globals | TLength; type WebkitTouchCalloutProperty = Globals | "default" | "none"; +type MozOutlineRadiusProperty = Globals | TLength | string; + type MsContentZoomSnapProperty = Globals | "mandatory" | "none" | "proximity" | string; -type WebkitBorderBeforeProperty = Globals | BrWidth | BrStyle | NamedColor | DeprecatedSystemColor | "currentcolor" | string; +type WebkitBorderBeforeProperty = Globals | BrWidth | BrStyle | Color | string; + +type WebkitLineClampProperty = Globals | "none" | number; type WebkitMaskProperty = Globals | "none" | string; @@ -4353,7 +4405,7 @@ type StopColorProperty = Globals | Color | "currentColor"; type StrokeProperty = Globals | Paint; -type StrokeDasharrayProperty = Globals | "none" | string; +type StrokeDasharrayProperty = Globals | Dasharray | "none"; type StrokeDashoffsetProperty = Globals | TLength | string; @@ -4511,6 +4563,8 @@ type ContentPosition = "center" | "end" | "flex-end" | "flex-start" | "start"; type CubicBezierTimingFunction = "ease" | "ease-in" | "ease-in-out" | "ease-out" | string; +type Dasharray = TLength | string | number; + type DeprecatedSystemColor = | "ActiveBorder" | "ActiveCaption" diff --git a/package.json b/package.json index f4b1c49..ad293d6 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@types/jest": "^22.1.1", "@types/node": "^9.4.2", "@types/prettier": "^1.10.0", + "chalk": "^2.3.2", "chokidar": "^2.0.0", "flow-bin": "^0.69.0", "jest": "^22.2.1", diff --git a/src/data-types.ts b/src/data-types.ts index 090129e..564c4b6 100644 --- a/src/data-types.ts +++ b/src/data-types.ts @@ -1,8 +1,7 @@ -import * as syntaxes from 'mdn-data/css/syntaxes.json'; +import { compatSyntax } from './compat'; +import { getPropertySyntax, getSyntax } from './data'; import parse from './parser'; -import typing, { addType, DataType, hasType, ResolvedType, Type, TypeType } from './typer'; - -const MIN_TYPES = 3; +import typing, { addType, DataType, hasType, IDataType, ResolvedType, Type, TypeType } from './typer'; const dataTypes: { [key: string]: ResolvedType[] } = {}; @@ -10,16 +9,17 @@ export default dataTypes; export function resolveDataTypes( types: TypeType[], - resolver: (name: string) => ResolvedType[] = dataTypeResolver, + resolver: (dataType: IDataType) => ResolvedType[] = simpleDataTypeResolver, + min = 3, ): ResolvedType[] { let resolvedDataTypes: ResolvedType[] = []; for (const type of types) { switch (type.type) { case Type.DataType: { - const resolvedDataType = resolver(type.name); + const resolvedDataType = resolver(type); - if (resolvedDataType.length >= MIN_TYPES) { + if (resolvedDataType.length >= min) { // Dissolve data type if it's too small resolvedDataTypes = addType(resolvedDataTypes, addDataType(type.name, resolvedDataType)); } else { @@ -30,7 +30,7 @@ export function resolveDataTypes( break; } case Type.PropertyReference: { - const resolvedProperty = resolver(type.name); + const resolvedProperty = resolver(type); // Dissolve property references completely for (const resolvedType of resolvedProperty) { @@ -46,10 +46,20 @@ export function resolveDataTypes( return resolvedDataTypes; } -function dataTypeResolver(name: string): ResolvedType[] { - return name in syntaxes - ? resolveDataTypes(typing(parse(syntaxes[name].syntax)), dataTypeResolver) - : [{ type: Type.String }]; +function simpleDataTypeResolver(dataType: IDataType): ResolvedType[] { + const syntax = getSyntax(dataType.name); + return syntax ? resolveDataTypes(typing(parse(syntax)), simpleDataTypeResolver) : [{ type: Type.String }]; +} + +export function createPropertyDataTypeResolver(data: MDN.CompatData | null, min?: number) { + const resolver: (dataType: IDataType) => ResolvedType[] = dataType => { + const syntax = dataType.type === Type.DataType ? getSyntax(dataType.name) : getPropertySyntax(dataType.name); + return syntax + ? resolveDataTypes(data ? typing(compatSyntax(data, parse(syntax))) : typing(parse(syntax)), resolver) + : [{ type: Type.String }]; + }; + + return resolver; } function addDataType(name: string, types: ResolvedType[], index = 0): DataType { diff --git a/src/data.ts b/src/data.ts new file mode 100644 index 0000000..af099d7 --- /dev/null +++ b/src/data.ts @@ -0,0 +1,106 @@ +import * as rawProperties from 'mdn-data/css/properties.json'; +import * as rawSyntaxes from 'mdn-data/css/syntaxes.json'; +import { getPropertyData, getTypesData } from './compat'; +import { createPropertyDataTypeResolver, resolveDataTypes } from './data-types'; +import { IExtendedProperty, properties as patchedProperties, syntaxes as patchedSyntaxes } from './data/patches'; +import { error, warn } from './logger'; +import parse from './parser'; +import typing, { hasType } from './typer'; + +export const properties: { [property: string]: IExtendedProperty } = {}; + +for (const name in rawProperties) { + properties[name] = { + ...rawProperties[name], + syntax: getPropertySyntax(name), + shorthand: + name in patchedProperties && typeof patchedProperties[name].shorthand === 'boolean' + ? patchedProperties[name].shorthand + : Array.isArray(rawProperties[name].computed), + }; +} + +for (const name in patchedProperties) { + if (!(name in properties)) { + properties[name] = patchedProperties[name]; + } +} + +const validatedPropertySyntaxes: string[] = []; + +export function getPropertySyntax(name: string) { + const patch = patchedProperties[name]; + + if (patch && patch.syntax) { + if (!validatedPropertySyntaxes.includes(name) && rawProperties[name] && rawProperties[name].syntax) { + const compatibilityData = getPropertyData(name); + + if (isEqual(compatibilityData, patch.syntax, rawProperties[name].syntax)) { + error(); + } + + validatedPropertySyntaxes.push(name); + } + + return patch.syntax; + } + + if (!rawProperties[name]) { + warn('Data for property `%s` is missing', name); + } + + return rawProperties[name] && rawProperties[name].syntax; +} + +const validatedSyntaxes: string[] = []; + +export function getSyntax(name: string) { + const patch = patchedSyntaxes[name]; + + if (patch && patch.syntax) { + if (!validatedSyntaxes.includes(name) && rawSyntaxes[name] && rawSyntaxes[name].syntax) { + const compatibilityData = getTypesData(name); + + if (isEqual(compatibilityData, patch.syntax, rawSyntaxes[name].syntax)) { + error(); + } + + validatedSyntaxes.push(name); + } + + return patch.syntax; + } + + if (!rawSyntaxes[name]) { + warn('Data for syntax `%s` is missing', name); + } + + return rawSyntaxes[name] && rawSyntaxes[name].syntax; +} + +function isEqual(compat: MDN.CompatData | null, syntaxA: string, syntaxB: string): boolean { + // Dissolve all data types to check whether it already exists or not + const dissolvedTypesA = resolveDataTypes( + typing(parse(syntaxA)), + createPropertyDataTypeResolver(compat, Infinity), + Infinity, + ); + const dissolvedTypesB = resolveDataTypes( + typing(parse(syntaxA)), + createPropertyDataTypeResolver(compat, Infinity), + Infinity, + ); + + for (const type of dissolvedTypesA) { + if (!hasType(dissolvedTypesB, type)) { + return false; + } + } + for (const type of dissolvedTypesB) { + if (!hasType(dissolvedTypesA, type)) { + return false; + } + } + + return true; +} diff --git a/src/data/patches.ts b/src/data/patches.ts new file mode 100644 index 0000000..4c4f74b --- /dev/null +++ b/src/data/patches.ts @@ -0,0 +1,76 @@ +export interface IExtendedProperty extends Partial { + shorthand: boolean; +} + +export const properties: { + [property: string]: IExtendedProperty; +} = { + /** + * https://drafts.csswg.org/css-overflow-3/#max-lines + * Should be added to `mdn-browser-compat-data` when https://github.com/mdn/data/pull/207 is merged + */ + '-webkit-line-clamp': { + syntax: 'none | ', + shorthand: true, + }, + /** + * https://drafts.csswg.org/css-overflow-3/#block-ellipsis + * https://github.com/mdn/data/pull/207 + */ + 'block-overflow': { + syntax: 'clip | ellipsis | ', + shorthand: false, + }, + /** + * https://drafts.csswg.org/css-overflow-3/#line-clamp + * https://github.com/mdn/data/pull/207 + */ + 'line-clamp': { + syntax: 'none | ', + shorthand: true, + }, + /** + * https://drafts.csswg.org/css-overflow-3/#max-lines + * https://github.com/mdn/data/pull/207 + */ + 'max-lines': { + syntax: 'none | ', + shorthand: false, + }, + /** + * https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api + * https://github.com/mdn/data/pull/206 + */ + 'overflow-anchor': { + syntax: 'auto | none', + shorthand: false, + }, + /** + * https://drafts.csswg.org/css-overflow-3/#logical + * https://github.com/mdn/data/pull/207 + */ + 'overflow-block': { + syntax: "<'overflow'>", + shorthand: false, + }, + /** + * https://drafts.csswg.org/css-overflow-3/#logical + * https://github.com/mdn/data/pull/207 + */ + 'overflow-inline': { + syntax: "<'overflow'>", + shorthand: false, + }, +}; + +export const syntaxes: { + [property: string]: MDN.Syntax; +} = { + /** + * https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius + * https://github.com/mdn/data/pull/208 + */ + 'outline-radius': { + syntax: ' | ', + }, +}; diff --git a/src/data/svg.ts b/src/data/svg.ts index e2d9245..bc5f374 100644 --- a/src/data/svg.ts +++ b/src/data/svg.ts @@ -222,4 +222,7 @@ export const syntaxes: MDN.Syntaxes = { paint: { syntax: 'none | child | child() | | [ none | ]? | context-fill | context-stroke', }, + dasharray: { + syntax: '[ | | ]#', + }, }; diff --git a/src/logger.ts b/src/logger.ts new file mode 100644 index 0000000..6a072a2 --- /dev/null +++ b/src/logger.ts @@ -0,0 +1,11 @@ +import chalk from 'chalk'; + +export const error: typeof console.error = (message, ...params) => { + // Complete the build process but exit with failure when done + process.exitCode = 1; + console.error(typeof message === 'string' ? chalk.magenta('ERROR! ' + message) : message, ...params); +}; + +export const warn: typeof console.warn = (message, ...params) => { + console.info(typeof message === 'string' ? chalk.yellow(message) : message, ...params); +}; diff --git a/src/properties.ts b/src/properties.ts index 4218375..a99398f 100644 --- a/src/properties.ts +++ b/src/properties.ts @@ -1,5 +1,3 @@ -import * as properties from 'mdn-data/css/properties.json'; -import * as syntaxes from 'mdn-data/css/syntaxes.json'; import { compatNames, compatSyntax, @@ -9,16 +7,19 @@ import { isAddedBySome, isDeprecated, } from './compat'; -import { resolveDataTypes } from './data-types'; -import { properties as rawSvgProperties, syntaxes as svgSyntaxes } from './data/svg'; +import { getPropertySyntax, properties } from './data'; +import { createPropertyDataTypeResolver, resolveDataTypes } from './data-types'; +import { properties as rawSvgProperties, syntaxes as rawSvgSyntaxes } from './data/svg'; import parse from './parser'; -import typing, { ResolvedType, Type } from './typer'; +import typing, { IDataType, ResolvedType } from './typer'; + +const ALL = 'all'; const IGNORES = [ // Custom properties '--*', // We define this manually - 'all', + ALL, ]; const REGEX_VENDOR_PROPERTY = /^-/; @@ -36,7 +37,7 @@ if (!globalCompatibilityData) { // The CSS-wide keywords are identical to the `all` property // https://www.w3.org/TR/2016/CR-css-cascade-4-20160114/#all-shorthand export const globals: ResolvedType[] = resolveDataTypes( - typing(compatSyntax(globalCompatibilityData, parse(properties.all.syntax))), + typing(compatSyntax(globalCompatibilityData, parse(getPropertySyntax(ALL)))), ); export const standardLonghandProperties: { [name: string]: IProperty } = {}; @@ -58,7 +59,7 @@ for (const originalName in properties) { } // Default values - let entities = parse(properties[originalName].syntax); + let entities = parse(getPropertySyntax(originalName)); let currentNames: string[] = [originalName]; let obsoleteNames: string[] = []; @@ -85,11 +86,11 @@ for (const originalName in properties) { const property: IProperty = { name: originalName, - types: resolveDataTypes(typing(entities), createDataTypeResolver(compatibilityData)), + types: resolveDataTypes(typing(entities), createPropertyDataTypeResolver(compatibilityData)), }; for (const name of currentNames) { - const isShorthand = Array.isArray(properties[originalName].computed); + const isShorthand = properties[originalName].shorthand; if (isVendorProperty(name)) { if (isShorthand) { @@ -131,26 +132,12 @@ function filterMissingProperties(names: string[]) { return names.filter(name => !(name in properties)); } -export function createDataTypeResolver(data: MDN.CompatData | null) { - const resolver: (dataTypeName: string) => ResolvedType[] = dataTypeName => { - const syntax = syntaxes[dataTypeName] || properties[dataTypeName]; - return syntax - ? resolveDataTypes( - data ? typing(compatSyntax(data, parse(syntax.syntax))) : typing(parse(syntax.syntax)), - resolver, - ) - : [{ type: Type.String }]; - }; - - return resolver; -} - function createSvgDataTypeResolver(data: MDN.CompatData | null) { - const resolver = createDataTypeResolver(data); - const svgResolver: (dataTypeName: string) => ResolvedType[] = (dataTypeName: string) => - dataTypeName in svgSyntaxes - ? resolveDataTypes(typing(parse(svgSyntaxes[dataTypeName].syntax)), svgResolver) - : resolver(dataTypeName); + const resolver = createPropertyDataTypeResolver(data); + const svgResolver: (dataType: IDataType) => ResolvedType[] = (dataType: IDataType) => + dataType.name in rawSvgSyntaxes + ? resolveDataTypes(typing(parse(rawSvgSyntaxes[dataType.name].syntax)), svgResolver) + : resolver(dataType); return svgResolver; } diff --git a/src/typer.ts b/src/typer.ts index 914b9ee..b6394c5 100644 --- a/src/typer.ts +++ b/src/typer.ts @@ -1,5 +1,8 @@ -import * as syntaxes from 'mdn-data/css/syntaxes.json'; +import * as rawSyntaxes from 'mdn-data/css/syntaxes.json'; import * as cssTypes from 'mdn-data/css/types.json'; +import { syntaxes as patchedSyntaxes } from './data/patches'; +import { syntaxes as rawSvgSyntaxes } from './data/svg'; +import { warn } from './logger'; import { Combinator, Component, @@ -64,7 +67,7 @@ const basicDataTypes = [...Object.keys(cssTypes), 'hex-color'].reduce<{ }; break; default: - if (!(name in syntaxes)) { + if (!(name in rawSyntaxes)) { dataTypes[name] = { type: Type.String, }; @@ -124,14 +127,16 @@ export default function typing(entities: EntityType[]): TypeType[] { break; case Component.DataType: { const value = entity.value.slice(1, -1); - const property = /'([^']+)'/.exec(value); - if (property) { - const name = property[1]; - types = addPropertyReference(types, name); - } else if (value in basicDataTypes) { + if (value in basicDataTypes) { types = addType(types, basicDataTypes[value]); - } else { + } else if (value in rawSyntaxes || value in patchedSyntaxes || value in rawSvgSyntaxes) { + // Need to check if data type exists because some property references are + // not quoted. Needs to fixed some how. types = addDataType(types, value); + } else { + const property = /'([^']+)'/.exec(value); + const name = property ? property[1] : (warn('Data type `%s` was missing or is malformatted', value), value); + types = addPropertyReference(types, name); } break; } diff --git a/yarn.lock b/yarn.lock index a563677..ddb7bbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -521,7 +521,7 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0, chalk@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65" dependencies: