@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.
Files changed (237) hide show
  1. package/README.md +3 -0
  2. package/dist/compounds/compound-css-data.d.ts +22 -0
  3. package/dist/compounds/compound-css-data.d.ts.map +1 -0
  4. package/dist/compounds/compound-css-data.js +2 -0
  5. package/dist/compounds/compound-css-data.js.map +1 -0
  6. package/dist/compounds/compound-mapper.d.ts +4 -0
  7. package/dist/compounds/compound-mapper.d.ts.map +1 -0
  8. package/dist/compounds/compound-mapper.js +10 -0
  9. package/dist/compounds/compound-mapper.js.map +1 -0
  10. package/dist/compounds/compound-parser-utils.d.ts +3 -0
  11. package/dist/compounds/compound-parser-utils.d.ts.map +1 -0
  12. package/dist/compounds/compound-parser-utils.js +33 -0
  13. package/dist/compounds/compound-parser-utils.js.map +1 -0
  14. package/dist/compounds/compound-types.d.ts +26 -0
  15. package/dist/compounds/compound-types.d.ts.map +1 -0
  16. package/dist/compounds/compound-types.js +2 -0
  17. package/dist/compounds/compound-types.js.map +1 -0
  18. package/dist/compounds/compound-value-parsers.d.ts +6 -0
  19. package/dist/compounds/compound-value-parsers.d.ts.map +1 -0
  20. package/dist/compounds/compound-value-parsers.js +5 -0
  21. package/dist/compounds/compound-value-parsers.js.map +1 -0
  22. package/dist/compounds/index.d.ts +6 -0
  23. package/dist/compounds/index.d.ts.map +1 -0
  24. package/dist/compounds/index.js +6 -0
  25. package/dist/compounds/index.js.map +1 -0
  26. package/dist/compounds/parsers/index.d.ts +2 -0
  27. package/dist/compounds/parsers/index.d.ts.map +1 -0
  28. package/dist/compounds/parsers/index.js +2 -0
  29. package/dist/compounds/parsers/index.js.map +1 -0
  30. package/dist/compounds/parsers/shadow-compound.d.ts +5 -0
  31. package/dist/compounds/parsers/shadow-compound.d.ts.map +1 -0
  32. package/dist/compounds/parsers/shadow-compound.js +39 -0
  33. package/dist/compounds/parsers/shadow-compound.js.map +1 -0
  34. package/dist/css-data-types/data-types-consts.d.ts +212 -0
  35. package/dist/css-data-types/data-types-consts.d.ts.map +1 -0
  36. package/dist/css-data-types/data-types-consts.js +790 -0
  37. package/dist/css-data-types/data-types-consts.js.map +1 -0
  38. package/dist/css-data-types/data-types-predicates.d.ts +32 -0
  39. package/dist/css-data-types/data-types-predicates.d.ts.map +1 -0
  40. package/dist/css-data-types/data-types-predicates.js +353 -0
  41. package/dist/css-data-types/data-types-predicates.js.map +1 -0
  42. package/dist/css-data-types/data-types-state-machines.d.ts +14 -0
  43. package/dist/css-data-types/data-types-state-machines.d.ts.map +1 -0
  44. package/dist/css-data-types/data-types-state-machines.js +129 -0
  45. package/dist/css-data-types/data-types-state-machines.js.map +1 -0
  46. package/dist/css-data-types/data-types-types.d.ts +26 -0
  47. package/dist/css-data-types/data-types-types.d.ts.map +1 -0
  48. package/dist/css-data-types/data-types-types.js +2 -0
  49. package/dist/css-data-types/data-types-types.js.map +1 -0
  50. package/dist/css-data-types/data-types-utils.d.ts +31 -0
  51. package/dist/css-data-types/data-types-utils.d.ts.map +1 -0
  52. package/dist/css-data-types/data-types-utils.js +176 -0
  53. package/dist/css-data-types/data-types-utils.js.map +1 -0
  54. package/dist/css-data-types/data-types.d.ts +64 -0
  55. package/dist/css-data-types/data-types.d.ts.map +1 -0
  56. package/dist/css-data-types/data-types.js +304 -0
  57. package/dist/css-data-types/data-types.js.map +1 -0
  58. package/dist/css-data-types/index.d.ts +7 -0
  59. package/dist/css-data-types/index.d.ts.map +1 -0
  60. package/dist/css-data-types/index.js +7 -0
  61. package/dist/css-data-types/index.js.map +1 -0
  62. package/dist/index.d.ts +5 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +5 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/shorthands/index.d.ts +8 -0
  67. package/dist/shorthands/index.d.ts.map +1 -0
  68. package/dist/shorthands/index.js +8 -0
  69. package/dist/shorthands/index.js.map +1 -0
  70. package/dist/shorthands/openers/background-position-shorthand.d.ts +5 -0
  71. package/dist/shorthands/openers/background-position-shorthand.d.ts.map +1 -0
  72. package/dist/shorthands/openers/background-position-shorthand.js +173 -0
  73. package/dist/shorthands/openers/background-position-shorthand.js.map +1 -0
  74. package/dist/shorthands/openers/background-shorthand.d.ts +5 -0
  75. package/dist/shorthands/openers/background-shorthand.d.ts.map +1 -0
  76. package/dist/shorthands/openers/background-shorthand.js +88 -0
  77. package/dist/shorthands/openers/background-shorthand.js.map +1 -0
  78. package/dist/shorthands/openers/border-image-shorthand.d.ts +5 -0
  79. package/dist/shorthands/openers/border-image-shorthand.d.ts.map +1 -0
  80. package/dist/shorthands/openers/border-image-shorthand.js +16 -0
  81. package/dist/shorthands/openers/border-image-shorthand.js.map +1 -0
  82. package/dist/shorthands/openers/border-radius-shorthand.d.ts +5 -0
  83. package/dist/shorthands/openers/border-radius-shorthand.d.ts.map +1 -0
  84. package/dist/shorthands/openers/border-radius-shorthand.js +61 -0
  85. package/dist/shorthands/openers/border-radius-shorthand.js.map +1 -0
  86. package/dist/shorthands/openers/border-shorthand.d.ts +20 -0
  87. package/dist/shorthands/openers/border-shorthand.d.ts.map +1 -0
  88. package/dist/shorthands/openers/border-shorthand.js +90 -0
  89. package/dist/shorthands/openers/border-shorthand.js.map +1 -0
  90. package/dist/shorthands/openers/flex-flow-shorthand.d.ts +5 -0
  91. package/dist/shorthands/openers/flex-flow-shorthand.d.ts.map +1 -0
  92. package/dist/shorthands/openers/flex-flow-shorthand.js +13 -0
  93. package/dist/shorthands/openers/flex-flow-shorthand.js.map +1 -0
  94. package/dist/shorthands/openers/flex-shorthand.d.ts +5 -0
  95. package/dist/shorthands/openers/flex-shorthand.d.ts.map +1 -0
  96. package/dist/shorthands/openers/flex-shorthand.js +55 -0
  97. package/dist/shorthands/openers/flex-shorthand.js.map +1 -0
  98. package/dist/shorthands/openers/font-shorthand.d.ts +5 -0
  99. package/dist/shorthands/openers/font-shorthand.d.ts.map +1 -0
  100. package/dist/shorthands/openers/font-shorthand.js +60 -0
  101. package/dist/shorthands/openers/font-shorthand.js.map +1 -0
  102. package/dist/shorthands/openers/gap-shorthand.d.ts +5 -0
  103. package/dist/shorthands/openers/gap-shorthand.d.ts.map +1 -0
  104. package/dist/shorthands/openers/gap-shorthand.js +28 -0
  105. package/dist/shorthands/openers/gap-shorthand.js.map +1 -0
  106. package/dist/shorthands/openers/grid-axis-shorthand.d.ts +6 -0
  107. package/dist/shorthands/openers/grid-axis-shorthand.d.ts.map +1 -0
  108. package/dist/shorthands/openers/grid-axis-shorthand.js +36 -0
  109. package/dist/shorthands/openers/grid-axis-shorthand.js.map +1 -0
  110. package/dist/shorthands/openers/grid-gap-shorthand.d.ts +5 -0
  111. package/dist/shorthands/openers/grid-gap-shorthand.d.ts.map +1 -0
  112. package/dist/shorthands/openers/grid-gap-shorthand.js +21 -0
  113. package/dist/shorthands/openers/grid-gap-shorthand.js.map +1 -0
  114. package/dist/shorthands/openers/grid-shorthand.d.ts +8 -0
  115. package/dist/shorthands/openers/grid-shorthand.d.ts.map +1 -0
  116. package/dist/shorthands/openers/grid-shorthand.js +145 -0
  117. package/dist/shorthands/openers/grid-shorthand.js.map +1 -0
  118. package/dist/shorthands/openers/grid-template-shorthand.d.ts +10 -0
  119. package/dist/shorthands/openers/grid-template-shorthand.d.ts.map +1 -0
  120. package/dist/shorthands/openers/grid-template-shorthand.js +113 -0
  121. package/dist/shorthands/openers/grid-template-shorthand.js.map +1 -0
  122. package/dist/shorthands/openers/index.d.ts +22 -0
  123. package/dist/shorthands/openers/index.d.ts.map +1 -0
  124. package/dist/shorthands/openers/index.js +22 -0
  125. package/dist/shorthands/openers/index.js.map +1 -0
  126. package/dist/shorthands/openers/list-style-shorthand.d.ts +5 -0
  127. package/dist/shorthands/openers/list-style-shorthand.d.ts.map +1 -0
  128. package/dist/shorthands/openers/list-style-shorthand.js +15 -0
  129. package/dist/shorthands/openers/list-style-shorthand.js.map +1 -0
  130. package/dist/shorthands/openers/margin-shorthand.d.ts +5 -0
  131. package/dist/shorthands/openers/margin-shorthand.d.ts.map +1 -0
  132. package/dist/shorthands/openers/margin-shorthand.js +11 -0
  133. package/dist/shorthands/openers/margin-shorthand.js.map +1 -0
  134. package/dist/shorthands/openers/outline-shorthand.d.ts +5 -0
  135. package/dist/shorthands/openers/outline-shorthand.d.ts.map +1 -0
  136. package/dist/shorthands/openers/outline-shorthand.js +14 -0
  137. package/dist/shorthands/openers/outline-shorthand.js.map +1 -0
  138. package/dist/shorthands/openers/overflow-shorthand.d.ts +5 -0
  139. package/dist/shorthands/openers/overflow-shorthand.d.ts.map +1 -0
  140. package/dist/shorthands/openers/overflow-shorthand.js +21 -0
  141. package/dist/shorthands/openers/overflow-shorthand.js.map +1 -0
  142. package/dist/shorthands/openers/padding-shorthand.d.ts +5 -0
  143. package/dist/shorthands/openers/padding-shorthand.d.ts.map +1 -0
  144. package/dist/shorthands/openers/padding-shorthand.js +11 -0
  145. package/dist/shorthands/openers/padding-shorthand.js.map +1 -0
  146. package/dist/shorthands/openers/place-content-shorthand.d.ts +5 -0
  147. package/dist/shorthands/openers/place-content-shorthand.d.ts.map +1 -0
  148. package/dist/shorthands/openers/place-content-shorthand.js +29 -0
  149. package/dist/shorthands/openers/place-content-shorthand.js.map +1 -0
  150. package/dist/shorthands/openers/place-items-shorthand.d.ts +5 -0
  151. package/dist/shorthands/openers/place-items-shorthand.d.ts.map +1 -0
  152. package/dist/shorthands/openers/place-items-shorthand.js +23 -0
  153. package/dist/shorthands/openers/place-items-shorthand.js.map +1 -0
  154. package/dist/shorthands/openers/text-decoration-shorthand.d.ts +5 -0
  155. package/dist/shorthands/openers/text-decoration-shorthand.d.ts.map +1 -0
  156. package/dist/shorthands/openers/text-decoration-shorthand.js +14 -0
  157. package/dist/shorthands/openers/text-decoration-shorthand.js.map +1 -0
  158. package/dist/shorthands/shorthand-css-data.d.ts +120 -0
  159. package/dist/shorthands/shorthand-css-data.d.ts.map +1 -0
  160. package/dist/shorthands/shorthand-css-data.js +48 -0
  161. package/dist/shorthands/shorthand-css-data.js.map +1 -0
  162. package/dist/shorthands/shorthand-mapper.d.ts +6 -0
  163. package/dist/shorthands/shorthand-mapper.d.ts.map +1 -0
  164. package/dist/shorthands/shorthand-mapper.js +72 -0
  165. package/dist/shorthands/shorthand-mapper.js.map +1 -0
  166. package/dist/shorthands/shorthand-parser-errors.d.ts +25 -0
  167. package/dist/shorthands/shorthand-parser-errors.d.ts.map +1 -0
  168. package/dist/shorthands/shorthand-parser-errors.js +41 -0
  169. package/dist/shorthands/shorthand-parser-errors.js.map +1 -0
  170. package/dist/shorthands/shorthand-parser-utils.d.ts +24 -0
  171. package/dist/shorthands/shorthand-parser-utils.d.ts.map +1 -0
  172. package/dist/shorthands/shorthand-parser-utils.js +398 -0
  173. package/dist/shorthands/shorthand-parser-utils.js.map +1 -0
  174. package/dist/shorthands/shorthand-types.d.ts +64 -0
  175. package/dist/shorthands/shorthand-types.d.ts.map +1 -0
  176. package/dist/shorthands/shorthand-types.js +2 -0
  177. package/dist/shorthands/shorthand-types.js.map +1 -0
  178. package/dist/shorthands/shorthands-ast-evaluation.d.ts +5 -0
  179. package/dist/shorthands/shorthands-ast-evaluation.d.ts.map +1 -0
  180. package/dist/shorthands/shorthands-ast-evaluation.js +19 -0
  181. package/dist/shorthands/shorthands-ast-evaluation.js.map +1 -0
  182. package/dist/tokenizers/css-value-tokenizer.d.ts +43 -0
  183. package/dist/tokenizers/css-value-tokenizer.d.ts.map +1 -0
  184. package/dist/tokenizers/css-value-tokenizer.js +154 -0
  185. package/dist/tokenizers/css-value-tokenizer.js.map +1 -0
  186. package/dist/tokenizers/index.d.ts +2 -0
  187. package/dist/tokenizers/index.d.ts.map +1 -0
  188. package/dist/tokenizers/index.js +2 -0
  189. package/dist/tokenizers/index.js.map +1 -0
  190. package/package.json +54 -0
  191. package/src/compounds/compound-css-data.ts +24 -0
  192. package/src/compounds/compound-mapper.ts +21 -0
  193. package/src/compounds/compound-parser-utils.ts +47 -0
  194. package/src/compounds/compound-types.ts +35 -0
  195. package/src/compounds/compound-value-parsers.ts +12 -0
  196. package/src/compounds/index.ts +5 -0
  197. package/src/compounds/parsers/index.ts +1 -0
  198. package/src/compounds/parsers/shadow-compound.ts +56 -0
  199. package/src/css-data-types/data-types-consts.ts +877 -0
  200. package/src/css-data-types/data-types-predicates.ts +477 -0
  201. package/src/css-data-types/data-types-state-machines.ts +169 -0
  202. package/src/css-data-types/data-types-types.ts +43 -0
  203. package/src/css-data-types/data-types-utils.ts +258 -0
  204. package/src/css-data-types/data-types.ts +435 -0
  205. package/src/css-data-types/index.ts +6 -0
  206. package/src/index.ts +4 -0
  207. package/src/shorthands/index.ts +7 -0
  208. package/src/shorthands/openers/background-position-shorthand.ts +180 -0
  209. package/src/shorthands/openers/background-shorthand.ts +161 -0
  210. package/src/shorthands/openers/border-image-shorthand.ts +35 -0
  211. package/src/shorthands/openers/border-radius-shorthand.ts +93 -0
  212. package/src/shorthands/openers/border-shorthand.ts +198 -0
  213. package/src/shorthands/openers/flex-flow-shorthand.ts +24 -0
  214. package/src/shorthands/openers/flex-shorthand.ts +79 -0
  215. package/src/shorthands/openers/font-shorthand.ts +85 -0
  216. package/src/shorthands/openers/gap-shorthand.ts +47 -0
  217. package/src/shorthands/openers/grid-axis-shorthand.ts +61 -0
  218. package/src/shorthands/openers/grid-gap-shorthand.ts +40 -0
  219. package/src/shorthands/openers/grid-shorthand.ts +260 -0
  220. package/src/shorthands/openers/grid-template-shorthand.ts +176 -0
  221. package/src/shorthands/openers/index.ts +21 -0
  222. package/src/shorthands/openers/list-style-shorthand.ts +33 -0
  223. package/src/shorthands/openers/margin-shorthand.ts +20 -0
  224. package/src/shorthands/openers/outline-shorthand.ts +27 -0
  225. package/src/shorthands/openers/overflow-shorthand.ts +40 -0
  226. package/src/shorthands/openers/padding-shorthand.ts +21 -0
  227. package/src/shorthands/openers/place-content-shorthand.ts +49 -0
  228. package/src/shorthands/openers/place-items-shorthand.ts +43 -0
  229. package/src/shorthands/openers/text-decoration-shorthand.ts +27 -0
  230. package/src/shorthands/shorthand-css-data.ts +210 -0
  231. package/src/shorthands/shorthand-mapper.ts +157 -0
  232. package/src/shorthands/shorthand-parser-errors.ts +47 -0
  233. package/src/shorthands/shorthand-parser-utils.ts +602 -0
  234. package/src/shorthands/shorthand-types.ts +107 -0
  235. package/src/shorthands/shorthands-ast-evaluation.ts +38 -0
  236. package/src/tokenizers/css-value-tokenizer.ts +220 -0
  237. 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
+ }