@dazl/shorthands-opener 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/compounds/compound-css-data.d.ts +22 -0
- package/dist/compounds/compound-css-data.d.ts.map +1 -0
- package/dist/compounds/compound-css-data.js +2 -0
- package/dist/compounds/compound-css-data.js.map +1 -0
- package/dist/compounds/compound-mapper.d.ts +4 -0
- package/dist/compounds/compound-mapper.d.ts.map +1 -0
- package/dist/compounds/compound-mapper.js +10 -0
- package/dist/compounds/compound-mapper.js.map +1 -0
- package/dist/compounds/compound-parser-utils.d.ts +3 -0
- package/dist/compounds/compound-parser-utils.d.ts.map +1 -0
- package/dist/compounds/compound-parser-utils.js +33 -0
- package/dist/compounds/compound-parser-utils.js.map +1 -0
- package/dist/compounds/compound-types.d.ts +26 -0
- package/dist/compounds/compound-types.d.ts.map +1 -0
- package/dist/compounds/compound-types.js +2 -0
- package/dist/compounds/compound-types.js.map +1 -0
- package/dist/compounds/compound-value-parsers.d.ts +6 -0
- package/dist/compounds/compound-value-parsers.d.ts.map +1 -0
- package/dist/compounds/compound-value-parsers.js +5 -0
- package/dist/compounds/compound-value-parsers.js.map +1 -0
- package/dist/compounds/index.d.ts +6 -0
- package/dist/compounds/index.d.ts.map +1 -0
- package/dist/compounds/index.js +6 -0
- package/dist/compounds/index.js.map +1 -0
- package/dist/compounds/parsers/index.d.ts +2 -0
- package/dist/compounds/parsers/index.d.ts.map +1 -0
- package/dist/compounds/parsers/index.js +2 -0
- package/dist/compounds/parsers/index.js.map +1 -0
- package/dist/compounds/parsers/shadow-compound.d.ts +5 -0
- package/dist/compounds/parsers/shadow-compound.d.ts.map +1 -0
- package/dist/compounds/parsers/shadow-compound.js +39 -0
- package/dist/compounds/parsers/shadow-compound.js.map +1 -0
- package/dist/css-data-types/data-types-consts.d.ts +212 -0
- package/dist/css-data-types/data-types-consts.d.ts.map +1 -0
- package/dist/css-data-types/data-types-consts.js +790 -0
- package/dist/css-data-types/data-types-consts.js.map +1 -0
- package/dist/css-data-types/data-types-predicates.d.ts +32 -0
- package/dist/css-data-types/data-types-predicates.d.ts.map +1 -0
- package/dist/css-data-types/data-types-predicates.js +353 -0
- package/dist/css-data-types/data-types-predicates.js.map +1 -0
- package/dist/css-data-types/data-types-state-machines.d.ts +14 -0
- package/dist/css-data-types/data-types-state-machines.d.ts.map +1 -0
- package/dist/css-data-types/data-types-state-machines.js +129 -0
- package/dist/css-data-types/data-types-state-machines.js.map +1 -0
- package/dist/css-data-types/data-types-types.d.ts +26 -0
- package/dist/css-data-types/data-types-types.d.ts.map +1 -0
- package/dist/css-data-types/data-types-types.js +2 -0
- package/dist/css-data-types/data-types-types.js.map +1 -0
- package/dist/css-data-types/data-types-utils.d.ts +31 -0
- package/dist/css-data-types/data-types-utils.d.ts.map +1 -0
- package/dist/css-data-types/data-types-utils.js +176 -0
- package/dist/css-data-types/data-types-utils.js.map +1 -0
- package/dist/css-data-types/data-types.d.ts +64 -0
- package/dist/css-data-types/data-types.d.ts.map +1 -0
- package/dist/css-data-types/data-types.js +304 -0
- package/dist/css-data-types/data-types.js.map +1 -0
- package/dist/css-data-types/index.d.ts +7 -0
- package/dist/css-data-types/index.d.ts.map +1 -0
- package/dist/css-data-types/index.js +7 -0
- package/dist/css-data-types/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/shorthands/index.d.ts +8 -0
- package/dist/shorthands/index.d.ts.map +1 -0
- package/dist/shorthands/index.js +8 -0
- package/dist/shorthands/index.js.map +1 -0
- package/dist/shorthands/openers/background-position-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/background-position-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/background-position-shorthand.js +173 -0
- package/dist/shorthands/openers/background-position-shorthand.js.map +1 -0
- package/dist/shorthands/openers/background-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/background-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/background-shorthand.js +88 -0
- package/dist/shorthands/openers/background-shorthand.js.map +1 -0
- package/dist/shorthands/openers/border-image-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/border-image-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/border-image-shorthand.js +16 -0
- package/dist/shorthands/openers/border-image-shorthand.js.map +1 -0
- package/dist/shorthands/openers/border-radius-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/border-radius-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/border-radius-shorthand.js +61 -0
- package/dist/shorthands/openers/border-radius-shorthand.js.map +1 -0
- package/dist/shorthands/openers/border-shorthand.d.ts +20 -0
- package/dist/shorthands/openers/border-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/border-shorthand.js +90 -0
- package/dist/shorthands/openers/border-shorthand.js.map +1 -0
- package/dist/shorthands/openers/flex-flow-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/flex-flow-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/flex-flow-shorthand.js +13 -0
- package/dist/shorthands/openers/flex-flow-shorthand.js.map +1 -0
- package/dist/shorthands/openers/flex-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/flex-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/flex-shorthand.js +55 -0
- package/dist/shorthands/openers/flex-shorthand.js.map +1 -0
- package/dist/shorthands/openers/font-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/font-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/font-shorthand.js +60 -0
- package/dist/shorthands/openers/font-shorthand.js.map +1 -0
- package/dist/shorthands/openers/gap-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/gap-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/gap-shorthand.js +28 -0
- package/dist/shorthands/openers/gap-shorthand.js.map +1 -0
- package/dist/shorthands/openers/grid-axis-shorthand.d.ts +6 -0
- package/dist/shorthands/openers/grid-axis-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/grid-axis-shorthand.js +36 -0
- package/dist/shorthands/openers/grid-axis-shorthand.js.map +1 -0
- package/dist/shorthands/openers/grid-gap-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/grid-gap-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/grid-gap-shorthand.js +21 -0
- package/dist/shorthands/openers/grid-gap-shorthand.js.map +1 -0
- package/dist/shorthands/openers/grid-shorthand.d.ts +8 -0
- package/dist/shorthands/openers/grid-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/grid-shorthand.js +145 -0
- package/dist/shorthands/openers/grid-shorthand.js.map +1 -0
- package/dist/shorthands/openers/grid-template-shorthand.d.ts +10 -0
- package/dist/shorthands/openers/grid-template-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/grid-template-shorthand.js +113 -0
- package/dist/shorthands/openers/grid-template-shorthand.js.map +1 -0
- package/dist/shorthands/openers/index.d.ts +22 -0
- package/dist/shorthands/openers/index.d.ts.map +1 -0
- package/dist/shorthands/openers/index.js +22 -0
- package/dist/shorthands/openers/index.js.map +1 -0
- package/dist/shorthands/openers/list-style-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/list-style-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/list-style-shorthand.js +15 -0
- package/dist/shorthands/openers/list-style-shorthand.js.map +1 -0
- package/dist/shorthands/openers/margin-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/margin-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/margin-shorthand.js +11 -0
- package/dist/shorthands/openers/margin-shorthand.js.map +1 -0
- package/dist/shorthands/openers/outline-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/outline-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/outline-shorthand.js +14 -0
- package/dist/shorthands/openers/outline-shorthand.js.map +1 -0
- package/dist/shorthands/openers/overflow-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/overflow-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/overflow-shorthand.js +21 -0
- package/dist/shorthands/openers/overflow-shorthand.js.map +1 -0
- package/dist/shorthands/openers/padding-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/padding-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/padding-shorthand.js +11 -0
- package/dist/shorthands/openers/padding-shorthand.js.map +1 -0
- package/dist/shorthands/openers/place-content-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/place-content-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/place-content-shorthand.js +29 -0
- package/dist/shorthands/openers/place-content-shorthand.js.map +1 -0
- package/dist/shorthands/openers/place-items-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/place-items-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/place-items-shorthand.js +23 -0
- package/dist/shorthands/openers/place-items-shorthand.js.map +1 -0
- package/dist/shorthands/openers/text-decoration-shorthand.d.ts +5 -0
- package/dist/shorthands/openers/text-decoration-shorthand.d.ts.map +1 -0
- package/dist/shorthands/openers/text-decoration-shorthand.js +14 -0
- package/dist/shorthands/openers/text-decoration-shorthand.js.map +1 -0
- package/dist/shorthands/shorthand-css-data.d.ts +120 -0
- package/dist/shorthands/shorthand-css-data.d.ts.map +1 -0
- package/dist/shorthands/shorthand-css-data.js +48 -0
- package/dist/shorthands/shorthand-css-data.js.map +1 -0
- package/dist/shorthands/shorthand-mapper.d.ts +6 -0
- package/dist/shorthands/shorthand-mapper.d.ts.map +1 -0
- package/dist/shorthands/shorthand-mapper.js +72 -0
- package/dist/shorthands/shorthand-mapper.js.map +1 -0
- package/dist/shorthands/shorthand-parser-errors.d.ts +25 -0
- package/dist/shorthands/shorthand-parser-errors.d.ts.map +1 -0
- package/dist/shorthands/shorthand-parser-errors.js +41 -0
- package/dist/shorthands/shorthand-parser-errors.js.map +1 -0
- package/dist/shorthands/shorthand-parser-utils.d.ts +24 -0
- package/dist/shorthands/shorthand-parser-utils.d.ts.map +1 -0
- package/dist/shorthands/shorthand-parser-utils.js +398 -0
- package/dist/shorthands/shorthand-parser-utils.js.map +1 -0
- package/dist/shorthands/shorthand-types.d.ts +64 -0
- package/dist/shorthands/shorthand-types.d.ts.map +1 -0
- package/dist/shorthands/shorthand-types.js +2 -0
- package/dist/shorthands/shorthand-types.js.map +1 -0
- package/dist/shorthands/shorthands-ast-evaluation.d.ts +5 -0
- package/dist/shorthands/shorthands-ast-evaluation.d.ts.map +1 -0
- package/dist/shorthands/shorthands-ast-evaluation.js +19 -0
- package/dist/shorthands/shorthands-ast-evaluation.js.map +1 -0
- package/dist/tokenizers/css-value-tokenizer.d.ts +43 -0
- package/dist/tokenizers/css-value-tokenizer.d.ts.map +1 -0
- package/dist/tokenizers/css-value-tokenizer.js +154 -0
- package/dist/tokenizers/css-value-tokenizer.js.map +1 -0
- package/dist/tokenizers/index.d.ts +2 -0
- package/dist/tokenizers/index.d.ts.map +1 -0
- package/dist/tokenizers/index.js +2 -0
- package/dist/tokenizers/index.js.map +1 -0
- package/package.json +54 -0
- package/src/compounds/compound-css-data.ts +24 -0
- package/src/compounds/compound-mapper.ts +21 -0
- package/src/compounds/compound-parser-utils.ts +47 -0
- package/src/compounds/compound-types.ts +35 -0
- package/src/compounds/compound-value-parsers.ts +12 -0
- package/src/compounds/index.ts +5 -0
- package/src/compounds/parsers/index.ts +1 -0
- package/src/compounds/parsers/shadow-compound.ts +56 -0
- package/src/css-data-types/data-types-consts.ts +877 -0
- package/src/css-data-types/data-types-predicates.ts +477 -0
- package/src/css-data-types/data-types-state-machines.ts +169 -0
- package/src/css-data-types/data-types-types.ts +43 -0
- package/src/css-data-types/data-types-utils.ts +258 -0
- package/src/css-data-types/data-types.ts +435 -0
- package/src/css-data-types/index.ts +6 -0
- package/src/index.ts +4 -0
- package/src/shorthands/index.ts +7 -0
- package/src/shorthands/openers/background-position-shorthand.ts +180 -0
- package/src/shorthands/openers/background-shorthand.ts +161 -0
- package/src/shorthands/openers/border-image-shorthand.ts +35 -0
- package/src/shorthands/openers/border-radius-shorthand.ts +93 -0
- package/src/shorthands/openers/border-shorthand.ts +198 -0
- package/src/shorthands/openers/flex-flow-shorthand.ts +24 -0
- package/src/shorthands/openers/flex-shorthand.ts +79 -0
- package/src/shorthands/openers/font-shorthand.ts +85 -0
- package/src/shorthands/openers/gap-shorthand.ts +47 -0
- package/src/shorthands/openers/grid-axis-shorthand.ts +61 -0
- package/src/shorthands/openers/grid-gap-shorthand.ts +40 -0
- package/src/shorthands/openers/grid-shorthand.ts +260 -0
- package/src/shorthands/openers/grid-template-shorthand.ts +176 -0
- package/src/shorthands/openers/index.ts +21 -0
- package/src/shorthands/openers/list-style-shorthand.ts +33 -0
- package/src/shorthands/openers/margin-shorthand.ts +20 -0
- package/src/shorthands/openers/outline-shorthand.ts +27 -0
- package/src/shorthands/openers/overflow-shorthand.ts +40 -0
- package/src/shorthands/openers/padding-shorthand.ts +21 -0
- package/src/shorthands/openers/place-content-shorthand.ts +49 -0
- package/src/shorthands/openers/place-items-shorthand.ts +43 -0
- package/src/shorthands/openers/text-decoration-shorthand.ts +27 -0
- package/src/shorthands/shorthand-css-data.ts +210 -0
- package/src/shorthands/shorthand-mapper.ts +157 -0
- package/src/shorthands/shorthand-parser-errors.ts +47 -0
- package/src/shorthands/shorthand-parser-utils.ts +602 -0
- package/src/shorthands/shorthand-types.ts +107 -0
- package/src/shorthands/shorthands-ast-evaluation.ts +38 -0
- package/src/tokenizers/css-value-tokenizer.ts +220 -0
- package/src/tokenizers/index.ts +1 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ShorthandOpener,
|
|
3
|
+
SimpleShorthandOpener,
|
|
4
|
+
GetShorthandOpener,
|
|
5
|
+
ShorthandCloser,
|
|
6
|
+
GetShorthandCloser,
|
|
7
|
+
} from './shorthand-types.js';
|
|
8
|
+
import type { ShorthandsTypeMap, ShorthandsSpecialReturnTypeMap } from './shorthand-css-data.js';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
openBackgroundShorthand,
|
|
12
|
+
closeBackgroundShorthand,
|
|
13
|
+
openBackgroundPositionShorthand,
|
|
14
|
+
closeBackgroundPositionShorthand,
|
|
15
|
+
openBorderRadiusShorthand,
|
|
16
|
+
closeBorderRadiusShorthand,
|
|
17
|
+
openBorderShorthand,
|
|
18
|
+
closeBorderShorthand,
|
|
19
|
+
openBorderTopShorthand,
|
|
20
|
+
closeBorderTopShorthand,
|
|
21
|
+
openBorderRightShorthand,
|
|
22
|
+
closeBorderRightShorthand,
|
|
23
|
+
openBorderBottomShorthand,
|
|
24
|
+
closeBorderBottomShorthand,
|
|
25
|
+
openBorderLeftShorthand,
|
|
26
|
+
closeBorderLeftShorthand,
|
|
27
|
+
openBorderStyleShorthand,
|
|
28
|
+
closeBorderStyleShorthand,
|
|
29
|
+
openBorderWidthShorthand,
|
|
30
|
+
closeBorderWidthShorthand,
|
|
31
|
+
openBorderColorShorthand,
|
|
32
|
+
closeBorderColorShorthand,
|
|
33
|
+
openOutlineShorthand,
|
|
34
|
+
closeOutlineShorthand,
|
|
35
|
+
openBorderImageShorthand,
|
|
36
|
+
closeBorderImageShorthand,
|
|
37
|
+
openFontShorthand,
|
|
38
|
+
closeFontShorthand,
|
|
39
|
+
openPlaceContentShorthand,
|
|
40
|
+
closePlaceContentShorthand,
|
|
41
|
+
openPlaceItemsShorthand,
|
|
42
|
+
closePlaceItemsShorthand,
|
|
43
|
+
openFlexShorthand,
|
|
44
|
+
closeFlexShorthand,
|
|
45
|
+
openFlexFlowShorthand,
|
|
46
|
+
closeFlexFlowShorthand,
|
|
47
|
+
openGapShorthand,
|
|
48
|
+
closeGapShorthand,
|
|
49
|
+
openGridRowShorthand,
|
|
50
|
+
closeGridRowShorthand,
|
|
51
|
+
openGridColumnShorthand,
|
|
52
|
+
closeGridColumnShorthand,
|
|
53
|
+
openGridGapShorthand,
|
|
54
|
+
closeGridGapShorthand,
|
|
55
|
+
openGridTemplateShorthand,
|
|
56
|
+
closeGridTemplateShorthand,
|
|
57
|
+
openGridShorthand,
|
|
58
|
+
closeGridShorthand,
|
|
59
|
+
openMarginShorthand,
|
|
60
|
+
closeMarginShorthand,
|
|
61
|
+
openPaddingShorthand,
|
|
62
|
+
closePaddingShorthand,
|
|
63
|
+
openOverflowShorthand,
|
|
64
|
+
closeOverflowShorthand,
|
|
65
|
+
openTextDecorationShorthand,
|
|
66
|
+
closeTextDecorationShorthand,
|
|
67
|
+
openListStyleShorthand,
|
|
68
|
+
closeListStyleShorthand,
|
|
69
|
+
} from './openers/index.js';
|
|
70
|
+
|
|
71
|
+
type ShorthandMapToOpener<T extends Record<string, string>> = {
|
|
72
|
+
[K in keyof T]: GetShorthandOpener<T[K]>;
|
|
73
|
+
};
|
|
74
|
+
type ShorthandOpenersMap = ShorthandMapToOpener<ShorthandsTypeMap>;
|
|
75
|
+
|
|
76
|
+
const shorthandOpenersMap: ShorthandOpenersMap = {
|
|
77
|
+
background: openBackgroundShorthand as unknown as GetShorthandOpener<ShorthandsTypeMap['background']>,
|
|
78
|
+
'background-position': openBackgroundPositionShorthand,
|
|
79
|
+
'border-radius': openBorderRadiusShorthand as unknown as GetShorthandOpener<ShorthandsTypeMap['border-radius']>,
|
|
80
|
+
border: openBorderShorthand,
|
|
81
|
+
'border-top': openBorderTopShorthand,
|
|
82
|
+
'border-right': openBorderRightShorthand,
|
|
83
|
+
'border-bottom': openBorderBottomShorthand,
|
|
84
|
+
'border-left': openBorderLeftShorthand,
|
|
85
|
+
'border-style': openBorderStyleShorthand,
|
|
86
|
+
'border-width': openBorderWidthShorthand,
|
|
87
|
+
'border-color': openBorderColorShorthand,
|
|
88
|
+
outline: openOutlineShorthand,
|
|
89
|
+
'border-image': openBorderImageShorthand as GetShorthandOpener<ShorthandsTypeMap['border-image']>,
|
|
90
|
+
font: openFontShorthand as GetShorthandOpener<ShorthandsTypeMap['font']>,
|
|
91
|
+
'place-content': openPlaceContentShorthand,
|
|
92
|
+
'place-items': openPlaceItemsShorthand,
|
|
93
|
+
flex: openFlexShorthand,
|
|
94
|
+
'flex-flow': openFlexFlowShorthand,
|
|
95
|
+
margin: openMarginShorthand,
|
|
96
|
+
padding: openPaddingShorthand,
|
|
97
|
+
overflow: openOverflowShorthand,
|
|
98
|
+
gap: openGapShorthand,
|
|
99
|
+
'grid-gap': openGridGapShorthand,
|
|
100
|
+
'grid-row': openGridRowShorthand,
|
|
101
|
+
'grid-column': openGridColumnShorthand,
|
|
102
|
+
'grid-template': openGridTemplateShorthand,
|
|
103
|
+
grid: openGridShorthand,
|
|
104
|
+
'text-decoration': openTextDecorationShorthand,
|
|
105
|
+
'list-style': openListStyleShorthand,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const shorthandClosersMap = {
|
|
109
|
+
background: closeBackgroundShorthand,
|
|
110
|
+
'background-position': closeBackgroundPositionShorthand,
|
|
111
|
+
'border-radius': closeBorderRadiusShorthand,
|
|
112
|
+
border: closeBorderShorthand,
|
|
113
|
+
'border-top': closeBorderTopShorthand,
|
|
114
|
+
'border-right': closeBorderRightShorthand,
|
|
115
|
+
'border-bottom': closeBorderBottomShorthand,
|
|
116
|
+
'border-left': closeBorderLeftShorthand,
|
|
117
|
+
'border-style': closeBorderStyleShorthand,
|
|
118
|
+
'border-width': closeBorderWidthShorthand,
|
|
119
|
+
'border-color': closeBorderColorShorthand,
|
|
120
|
+
outline: closeOutlineShorthand,
|
|
121
|
+
'border-image': closeBorderImageShorthand,
|
|
122
|
+
font: closeFontShorthand,
|
|
123
|
+
'place-content': closePlaceContentShorthand,
|
|
124
|
+
'place-items': closePlaceItemsShorthand,
|
|
125
|
+
flex: closeFlexShorthand,
|
|
126
|
+
'flex-flow': closeFlexFlowShorthand,
|
|
127
|
+
margin: closeMarginShorthand,
|
|
128
|
+
padding: closePaddingShorthand,
|
|
129
|
+
overflow: closeOverflowShorthand,
|
|
130
|
+
gap: closeGapShorthand,
|
|
131
|
+
'grid-gap': closeGridGapShorthand,
|
|
132
|
+
'grid-row': closeGridRowShorthand,
|
|
133
|
+
'grid-column': closeGridColumnShorthand,
|
|
134
|
+
'grid-template': closeGridTemplateShorthand,
|
|
135
|
+
grid: closeGridShorthand,
|
|
136
|
+
'text-decoration': closeTextDecorationShorthand,
|
|
137
|
+
'list-style': closeListStyleShorthand,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export type MappedShorthandOpener<
|
|
141
|
+
V,
|
|
142
|
+
T extends keyof ShorthandsTypeMap,
|
|
143
|
+
> = T extends keyof ShorthandsSpecialReturnTypeMap<V>
|
|
144
|
+
? ShorthandOpener<V, ShorthandsTypeMap[T], ShorthandsSpecialReturnTypeMap<V>[T]>
|
|
145
|
+
: SimpleShorthandOpener<V, ShorthandsTypeMap[T]>;
|
|
146
|
+
|
|
147
|
+
export const getShorthandOpener = <V, T extends keyof ShorthandsTypeMap>(prop: T): MappedShorthandOpener<V, T> => {
|
|
148
|
+
const getOpener = shorthandOpenersMap[prop] as GetShorthandOpener<ShorthandsTypeMap[T]>;
|
|
149
|
+
return getOpener<V>() as MappedShorthandOpener<V, T>;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const getShorthandCloser = <V, T extends keyof ShorthandsTypeMap>(
|
|
153
|
+
prop: T,
|
|
154
|
+
): ShorthandCloser<V, ShorthandsTypeMap[T]> => {
|
|
155
|
+
const getCloser = shorthandClosersMap[prop] as GetShorthandCloser<ShorthandsTypeMap[T]>;
|
|
156
|
+
return getCloser<V>();
|
|
157
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export class ShorthandParserError extends Error {
|
|
2
|
+
constructor(message: string, prop?: string) {
|
|
3
|
+
super(`Shorthand Parser Error! ${prop ? '[' + prop + '] ' : ''}${message}`);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class NoDataTypeMatchError extends ShorthandParserError {
|
|
8
|
+
constructor(value: string) {
|
|
9
|
+
super(`No data-type match: "${value}".`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class NoMandatoryPartMatchError extends ShorthandParserError {
|
|
14
|
+
constructor(prop: string, partProp: string) {
|
|
15
|
+
super(`No mandatory match on shorthand part: "${partProp}".`, prop);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class InvalidIntersectionValueError extends ShorthandParserError {
|
|
20
|
+
constructor(prop: string, value: string) {
|
|
21
|
+
super(`Invalid value for intersection: "${value}"`, prop);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class InvalidEdgesInputLengthError extends ShorthandParserError {
|
|
26
|
+
constructor(prop: string, length: number) {
|
|
27
|
+
super(`Invalid edges input length: "${length}".`, prop);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class CannotCloseBorderError extends ShorthandParserError {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(`Cannot close border object.`, 'border');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class CannotCloseGridTemplateError extends ShorthandParserError {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(`Cannot close grid-template object.`, 'grid-template');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class CannotCloseGridError extends ShorthandParserError {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(`Cannot close grid object.`, 'grid');
|
|
46
|
+
}
|
|
47
|
+
}
|