xmlui 0.4.2-beta.1 → 0.4.3
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/dist/{Pdf-DY3dYAig.mjs → Pdf-DTuZ_aBK.mjs} +1 -1
- package/dist/{Pdf-DYj6pOR4.mjs → Pdf-GNhynVZK.mjs} +1 -1
- package/dist/{apiInterceptorWorker-CSMfMHnG.mjs → apiInterceptorWorker-BsYA33M3.mjs} +1 -1
- package/dist/{apiInterceptorWorker-B_8SyVm7.mjs → apiInterceptorWorker-jZ0ZDQqP.mjs} +1 -1
- package/dist/{grammar.tmLanguage-Bgs-wS_O.mjs → grammar.tmLanguage-7HXwRarI.mjs} +39 -55
- package/dist/{index-DFmApFOY.mjs → index-CsOjUQnK.mjs} +8384 -7979
- package/dist/{index-standalone-UVkKZMvh.mjs → index-standalone-Cn89JdlG.mjs} +26315 -25887
- package/dist/index-standalone.css +1 -1
- package/dist/index.css +1 -1
- package/dist/{nivo-bar.es-tnCyX0Yr.mjs → nivo-bar.es-Bxk3Dn8A.mjs} +2 -2
- package/dist/{nivo-geo.es-BQ3VnkfD.mjs → nivo-geo.es-CpGxXa45.mjs} +2 -2
- package/dist/{nivo-legends.es-D-P_F-6G.mjs → nivo-legends.es-Dx4X21-T.mjs} +1 -1
- package/dist/{nivo-pie.es-Z4Ty7kQd.mjs → nivo-pie.es-BQqtQwEz.mjs} +2 -2
- package/dist/{react-apexcharts.min-DgtmaDk9.mjs → react-apexcharts.min-CDn4NFvp.mjs} +1 -1
- package/dist/scripts/docs/syntax/grammar.tmLanguage.json +29 -76
- package/dist/scripts/docs/syntax/textMate/xmlui.json +8 -0
- package/dist/scripts/xmlui/src/components/Accordion/Accordion.js +57 -0
- package/dist/scripts/xmlui/src/components/Alert/Alert.js +31 -0
- package/dist/scripts/xmlui/src/components/App/App.js +24 -19
- package/dist/scripts/xmlui/src/components/AppHeader/AppHeader.js +1 -3
- package/dist/scripts/xmlui/src/components/Badge/Badge.js +1 -1
- package/dist/scripts/xmlui/src/components/Bookmark/Bookmark.js +22 -2
- package/dist/scripts/xmlui/src/components/Button/Button.js +1 -1
- package/dist/scripts/xmlui/src/components/Card/Card.js +1 -1
- package/dist/scripts/xmlui/src/components/ComponentProvider.js +11 -2
- package/dist/scripts/xmlui/src/components/DatePicker/DatePicker.js +1 -1
- package/dist/scripts/xmlui/src/components/Footer/Footer.js +2 -2
- package/dist/scripts/xmlui/src/components/FormItem/FormItem.js +1 -1
- package/dist/scripts/xmlui/src/components/FormSection/FormSection.js +1 -1
- package/dist/scripts/xmlui/src/components/Heading/Heading.js +27 -2
- package/dist/scripts/xmlui/src/components/IconInfoCard/IconInfoCard.js +1 -1
- package/dist/scripts/xmlui/src/components/ModalDialog/ModalDialog.js +8 -5
- package/dist/scripts/xmlui/src/components/MultiSelect/MultiSelect.js +3 -3
- package/dist/scripts/xmlui/src/components/NavPanel/NavPanel.js +4 -0
- package/dist/scripts/xmlui/src/components/OffCanvas/OffCanvas.js +34 -0
- package/dist/scripts/xmlui/src/components/PageHeader/PageHeader.js +1 -1
- package/dist/scripts/xmlui/src/components/Pages/Pages.js +2 -1
- package/dist/scripts/xmlui/src/components/RadioGroup/RadioGroup.js +2 -1
- package/dist/scripts/xmlui/src/components/Select/Select.js +6 -3
- package/dist/scripts/xmlui/src/components/Spinner/Spinner.js +5 -1
- package/dist/scripts/xmlui/src/components/StickyBox/StickyBox.js +1 -1
- package/dist/scripts/xmlui/src/components/Table/Table.js +29 -10
- package/dist/scripts/xmlui/src/components/TableOfContents/TableOfContents.js +93 -0
- package/dist/scripts/xmlui/src/components/Toolbar/Toolbar.js +1 -1
- package/dist/scripts/xmlui/src/components/ToolbarButton/ToolbarButton.js +2 -2
- package/dist/scripts/xmlui/src/components-core/Component.js +13 -9
- package/dist/scripts/xmlui/src/components-core/CompoundComponent.js +19 -21
- package/dist/scripts/xmlui/src/components-core/RootComponent.js +74 -11
- package/dist/scripts/xmlui/src/components-core/{ChildrenSlot.js → Slot.js} +3 -3
- package/dist/scripts/xmlui/src/components-core/TableOfContentsContext.js +77 -0
- package/dist/scripts/xmlui/src/components-core/container/Container.js +16 -16
- package/dist/scripts/xmlui/src/components-core/theming/themes/root.js +5 -2
- package/dist/scripts/xmlui/src/components-core/theming/themes/theme-colors.js +336 -336
- package/dist/scripts/xmlui/src/components-core/theming/themes/xmlui.js +20 -2
- package/dist/scripts/xmlui/src/components-core/utils/misc.js +7 -28
- package/dist/scripts/xmlui/src/parsers/style-parser/style-compiler.js +169 -142
- package/dist/scripts/xmlui/src/parsers/xmlui-parser/ParserError.js +1 -0
- package/dist/scripts/xmlui/src/parsers/xmlui-parser/diagnostics.js +1 -1
- package/dist/scripts/xmlui/src/parsers/xmlui-parser/parser.js +24 -27
- package/dist/scripts/xmlui/src/parsers/xmlui-parser/transform.js +56 -41
- package/dist/{xmlui-C8fXVsN3.mjs → xmlui-BYWyXi2x.mjs} +8 -0
- package/dist/xmlui-standalone.es.js +1 -1
- package/dist/xmlui-standalone.umd.js +105 -106
- package/dist/xmlui.es.d.ts +25 -10
- package/dist/xmlui.es.js +1 -1
- package/dist/xmlui.umd.js +99 -100
- package/package.json +7 -2
|
@@ -10,22 +10,22 @@ const defaultCompResult = {
|
|
|
10
10
|
};
|
|
11
11
|
// Compile style properties into an object that can be directly used as the "style" attribute of elements
|
|
12
12
|
function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layoutContext) {
|
|
13
|
-
var _a, _b, _c, _d, _e
|
|
13
|
+
var _a, _b, _c, _d, _e;
|
|
14
14
|
const result = {
|
|
15
15
|
cssProps: {},
|
|
16
16
|
nonCssProps: {},
|
|
17
17
|
};
|
|
18
18
|
const css = result.cssProps;
|
|
19
19
|
// --- Compile alignment
|
|
20
|
-
const horizontalAlignment = compileAlignment("horizontalAlignment",
|
|
20
|
+
const horizontalAlignment = compileAlignment("horizontalAlignment", layoutProps);
|
|
21
21
|
if (horizontalAlignment) {
|
|
22
22
|
result.nonCssProps.horizontalAlignment = horizontalAlignment;
|
|
23
23
|
}
|
|
24
|
-
const verticalAlignment = compileAlignment("verticalAlignment",
|
|
24
|
+
const verticalAlignment = compileAlignment("verticalAlignment", layoutProps);
|
|
25
25
|
if (verticalAlignment) {
|
|
26
26
|
result.nonCssProps.verticalAlignment = verticalAlignment;
|
|
27
27
|
}
|
|
28
|
-
const orientation = compileOrientation("orientation",
|
|
28
|
+
const orientation = compileOrientation("orientation", layoutProps);
|
|
29
29
|
if (orientation) {
|
|
30
30
|
result.nonCssProps.orientation = orientation;
|
|
31
31
|
}
|
|
@@ -34,7 +34,7 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
34
34
|
// --- In a container, we always use "flex-shrink: 0"
|
|
35
35
|
css.flexShrink = 0;
|
|
36
36
|
}
|
|
37
|
-
const widthResult = compileSize("width",
|
|
37
|
+
const widthResult = compileSize("width", layoutProps);
|
|
38
38
|
if (widthResult.value)
|
|
39
39
|
css.width = widthResult.value;
|
|
40
40
|
if (isHorizontalAndStartSize(widthResult, layoutContext)) {
|
|
@@ -42,13 +42,13 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
42
42
|
css.flex = widthResult.ratio;
|
|
43
43
|
css.flexShrink = 1; //if it's star sizing, we allow shrinking
|
|
44
44
|
}
|
|
45
|
-
const minWidthResult = compileSize("minWidth",
|
|
45
|
+
const minWidthResult = compileSize("minWidth", layoutProps);
|
|
46
46
|
if (minWidthResult.value)
|
|
47
47
|
css.minWidth = minWidthResult.value;
|
|
48
|
-
const maxWidthResult = compileSize("maxWidth",
|
|
48
|
+
const maxWidthResult = compileSize("maxWidth", layoutProps);
|
|
49
49
|
if (maxWidthResult.value)
|
|
50
50
|
css.maxWidth = maxWidthResult.value;
|
|
51
|
-
const heightResult = compileSize("height",
|
|
51
|
+
const heightResult = compileSize("height", layoutProps);
|
|
52
52
|
if (heightResult.value)
|
|
53
53
|
css.height = heightResult.value;
|
|
54
54
|
if (isVerticalAndStarSize(heightResult, layoutContext)) {
|
|
@@ -56,173 +56,172 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
56
56
|
css.flex = heightResult.ratio;
|
|
57
57
|
css.flexShrink = 1;
|
|
58
58
|
}
|
|
59
|
-
const minHeightResult = compileSize("minHeight",
|
|
59
|
+
const minHeightResult = compileSize("minHeight", layoutProps);
|
|
60
60
|
if (minHeightResult.value)
|
|
61
61
|
css.minHeight = minHeightResult.value;
|
|
62
|
-
const maxHeightResult = compileSize("maxHeight",
|
|
62
|
+
const maxHeightResult = compileSize("maxHeight", layoutProps);
|
|
63
63
|
if (maxHeightResult.value)
|
|
64
64
|
css.maxHeight = maxHeightResult.value;
|
|
65
65
|
// --- Compile positions
|
|
66
|
-
const top = compileSize("top",
|
|
66
|
+
const top = compileSize("top", layoutProps);
|
|
67
67
|
if (top.value)
|
|
68
68
|
css.top = top.value;
|
|
69
|
-
const right = compileSize("right",
|
|
69
|
+
const right = compileSize("right", layoutProps);
|
|
70
70
|
if (right.value)
|
|
71
71
|
css.right = right.value;
|
|
72
|
-
const bottom = compileSize("bottom",
|
|
72
|
+
const bottom = compileSize("bottom", layoutProps);
|
|
73
73
|
if (bottom.value)
|
|
74
74
|
css.bottom = bottom.value;
|
|
75
|
-
const left = compileSize("left",
|
|
75
|
+
const left = compileSize("left", layoutProps);
|
|
76
76
|
if (left.value)
|
|
77
77
|
css.left = left.value;
|
|
78
78
|
// --- Compile gap
|
|
79
|
-
const gap = compileSize("gap",
|
|
79
|
+
const gap = compileSize("gap", layoutProps);
|
|
80
80
|
if (gap.value)
|
|
81
81
|
css.gap = gap.value;
|
|
82
82
|
// --- Compile border
|
|
83
|
-
const border = compileBorder("border",
|
|
83
|
+
const border = compileBorder("border", layoutProps);
|
|
84
84
|
if (border)
|
|
85
85
|
css.border = border;
|
|
86
|
-
const borderTop = compileBorder("borderTop",
|
|
86
|
+
const borderTop = compileBorder("borderTop", layoutProps);
|
|
87
87
|
if (borderTop)
|
|
88
88
|
css.borderTop = borderTop;
|
|
89
|
-
const borderRight = compileBorder("borderRight",
|
|
89
|
+
const borderRight = compileBorder("borderRight", layoutProps);
|
|
90
90
|
if (borderRight)
|
|
91
91
|
css.borderRight = borderRight;
|
|
92
|
-
const borderBottom = compileBorder("borderBottom",
|
|
92
|
+
const borderBottom = compileBorder("borderBottom", layoutProps);
|
|
93
93
|
if (borderBottom)
|
|
94
94
|
css.borderBottom = borderBottom;
|
|
95
|
-
const borderLeft = compileBorder("borderLeft",
|
|
95
|
+
const borderLeft = compileBorder("borderLeft", layoutProps);
|
|
96
96
|
if (borderLeft)
|
|
97
97
|
css.borderLeft = borderLeft;
|
|
98
98
|
// --- Compile radius
|
|
99
|
-
const radius = compileRadius("radius",
|
|
99
|
+
const radius = compileRadius("radius", layoutProps);
|
|
100
100
|
if (radius)
|
|
101
101
|
css.borderRadius = radius;
|
|
102
|
-
const radiusTopLeft = compileRadius("radiusTopLeft",
|
|
102
|
+
const radiusTopLeft = compileRadius("radiusTopLeft", layoutProps);
|
|
103
103
|
if (radiusTopLeft)
|
|
104
104
|
css.borderTopLeftRadius = radiusTopLeft;
|
|
105
|
-
const radiusTopRight = compileRadius("radiusTopRight",
|
|
105
|
+
const radiusTopRight = compileRadius("radiusTopRight", layoutProps);
|
|
106
106
|
if (radiusTopRight)
|
|
107
107
|
css.borderTopRightRadius = radiusTopRight;
|
|
108
|
-
const radiusBottomLeft = compileRadius("radiusBottomLeft",
|
|
108
|
+
const radiusBottomLeft = compileRadius("radiusBottomLeft", layoutProps);
|
|
109
109
|
if (radiusBottomLeft)
|
|
110
110
|
css.borderBottomLeftRadius = radiusBottomLeft;
|
|
111
|
-
const radiusBottomRight = compileRadius("radiusBottomRight",
|
|
111
|
+
const radiusBottomRight = compileRadius("radiusBottomRight", layoutProps);
|
|
112
112
|
if (radiusBottomRight)
|
|
113
113
|
css.borderBottomRightRadius = radiusBottomRight;
|
|
114
114
|
// --- Compile padding
|
|
115
|
-
const padding = compileSize("padding",
|
|
115
|
+
const padding = compileSize("padding", layoutProps);
|
|
116
116
|
if (padding.value)
|
|
117
117
|
css.padding = padding.value;
|
|
118
|
-
const horizontalPadding = compileSize("horizontalPadding",
|
|
119
|
-
const verticalPadding = compileSize("verticalPadding",
|
|
120
|
-
const paddingLeft = mergeSizes(compileSize("
|
|
118
|
+
const horizontalPadding = compileSize("horizontalPadding", layoutProps);
|
|
119
|
+
const verticalPadding = compileSize("verticalPadding", layoutProps);
|
|
120
|
+
const paddingLeft = mergeSizes(compileSize("paddingLeft", layoutProps), horizontalPadding);
|
|
121
121
|
if (paddingLeft.value)
|
|
122
122
|
css.paddingLeft = paddingLeft.value;
|
|
123
|
-
const paddingRight = mergeSizes(compileSize("
|
|
123
|
+
const paddingRight = mergeSizes(compileSize("paddingRight", layoutProps), horizontalPadding);
|
|
124
124
|
if (paddingRight.value)
|
|
125
125
|
css.paddingRight = paddingRight.value;
|
|
126
|
-
const paddingTop = mergeSizes(compileSize("
|
|
126
|
+
const paddingTop = mergeSizes(compileSize("paddingTop", layoutProps), verticalPadding);
|
|
127
127
|
if (paddingTop.value)
|
|
128
128
|
css.paddingTop = paddingTop.value;
|
|
129
|
-
const paddingBottom = mergeSizes(compileSize("
|
|
129
|
+
const paddingBottom = mergeSizes(compileSize("paddingBottom", layoutProps), verticalPadding);
|
|
130
130
|
if (paddingBottom.value)
|
|
131
131
|
css.paddingBottom = paddingBottom.value;
|
|
132
132
|
// --- Compile margin
|
|
133
|
-
const margin = compileMargin("margin",
|
|
133
|
+
const margin = compileMargin("margin", layoutProps);
|
|
134
134
|
if (margin)
|
|
135
135
|
css.margin = margin;
|
|
136
|
-
const horizontalMargin = compileMargin("horizontalMargin",
|
|
137
|
-
const verticalMargin = compileMargin("verticalMargin",
|
|
138
|
-
const marginLeft = (
|
|
136
|
+
const horizontalMargin = compileMargin("horizontalMargin", layoutProps);
|
|
137
|
+
const verticalMargin = compileMargin("verticalMargin", layoutProps);
|
|
138
|
+
const marginLeft = (_a = compileMargin("marginLeft", layoutProps)) !== null && _a !== void 0 ? _a : horizontalMargin;
|
|
139
139
|
if (marginLeft)
|
|
140
140
|
css.marginLeft = marginLeft;
|
|
141
|
-
const marginRight = (
|
|
141
|
+
const marginRight = (_b = compileMargin("marginRight", layoutProps)) !== null && _b !== void 0 ? _b : horizontalMargin;
|
|
142
142
|
if (marginRight)
|
|
143
143
|
css.marginRight = marginRight;
|
|
144
|
-
const marginTop = (
|
|
144
|
+
const marginTop = (_c = compileMargin("marginTop", layoutProps)) !== null && _c !== void 0 ? _c : verticalMargin;
|
|
145
145
|
if (marginTop)
|
|
146
146
|
css.marginTop = marginTop;
|
|
147
|
-
const marginBottom = (
|
|
147
|
+
const marginBottom = (_d = compileMargin("marginBottom", layoutProps)) !== null && _d !== void 0 ? _d : verticalMargin;
|
|
148
148
|
if (marginBottom)
|
|
149
149
|
css.marginBottom = marginBottom;
|
|
150
150
|
// --- Compile other
|
|
151
|
-
const backgroundColor = compileColor("backgroundColor",
|
|
151
|
+
const backgroundColor = compileColor("backgroundColor", layoutProps);
|
|
152
152
|
if (backgroundColor)
|
|
153
153
|
css.backgroundColor = backgroundColor;
|
|
154
154
|
//TODO illesg
|
|
155
|
-
const background = compileBackground("background",
|
|
155
|
+
const background = compileBackground("background", layoutProps);
|
|
156
156
|
if (background)
|
|
157
157
|
css.background = background;
|
|
158
|
-
const boxShadow = compileShadow("shadow",
|
|
158
|
+
const boxShadow = compileShadow("shadow", layoutProps);
|
|
159
159
|
if (boxShadow)
|
|
160
160
|
css.boxShadow = boxShadow;
|
|
161
|
-
const direction = compileDirection("direction",
|
|
161
|
+
const direction = compileDirection("direction", layoutProps);
|
|
162
162
|
if (direction)
|
|
163
163
|
css.direction = direction;
|
|
164
|
-
const overflowX = compileScrolling("horizontalOverflow",
|
|
164
|
+
const overflowX = compileScrolling("horizontalOverflow", layoutProps);
|
|
165
165
|
if (overflowX)
|
|
166
166
|
css.overflowX = overflowX;
|
|
167
|
-
const overflowY = compileScrolling("verticalOverflow",
|
|
167
|
+
const overflowY = compileScrolling("verticalOverflow", layoutProps);
|
|
168
168
|
if (overflowY)
|
|
169
169
|
css.overflowY = overflowY;
|
|
170
|
-
const zIndex = compileZIndex("zIndex",
|
|
170
|
+
const zIndex = compileZIndex("zIndex", layoutProps);
|
|
171
171
|
if (zIndex)
|
|
172
172
|
css.zIndex = zIndex;
|
|
173
|
-
const opacity = compileOpacity("
|
|
173
|
+
const opacity = compileOpacity("opacity", layoutProps);
|
|
174
174
|
if (opacity)
|
|
175
175
|
css.opacity = opacity;
|
|
176
176
|
// --- Compile typography
|
|
177
|
-
const color = compileColor("color",
|
|
177
|
+
const color = compileColor("color", layoutProps);
|
|
178
178
|
if (color)
|
|
179
179
|
css.color = color;
|
|
180
|
-
const fontFamily = compileFontFamily("fontFamily",
|
|
180
|
+
const fontFamily = compileFontFamily("fontFamily", layoutProps);
|
|
181
181
|
if (fontFamily)
|
|
182
182
|
css.fontFamily = fontFamily;
|
|
183
|
-
const fontSize = compileSize("fontSize",
|
|
183
|
+
const fontSize = compileSize("fontSize", layoutProps);
|
|
184
184
|
if (fontSize.value)
|
|
185
185
|
css.fontSize = fontSize.value;
|
|
186
|
-
const fontWeight = compileFontWeight("fontWeight",
|
|
186
|
+
const fontWeight = compileFontWeight("fontWeight", layoutProps);
|
|
187
187
|
if (fontWeight)
|
|
188
188
|
css.fontWeight = fontWeight;
|
|
189
|
-
const fontStyle = compileItalic("italic",
|
|
189
|
+
const fontStyle = compileItalic("italic", layoutProps);
|
|
190
190
|
if (fontStyle)
|
|
191
191
|
css.fontStyle = fontStyle;
|
|
192
|
-
const textDecoration = compileTextDecoration("textDecoration",
|
|
192
|
+
const textDecoration = compileTextDecoration("textDecoration", layoutProps);
|
|
193
193
|
if (textDecoration)
|
|
194
194
|
css.textDecoration = textDecoration;
|
|
195
|
-
const userSelect = compileUserSelect("userSelect",
|
|
195
|
+
const userSelect = compileUserSelect("userSelect", layoutProps);
|
|
196
196
|
if (userSelect)
|
|
197
197
|
css.userSelect = userSelect;
|
|
198
|
-
const letterSpacing = compileSize("letterSpacing",
|
|
198
|
+
const letterSpacing = compileSize("letterSpacing", layoutProps);
|
|
199
199
|
if (letterSpacing.value)
|
|
200
200
|
css.letterSpacing = letterSpacing.value;
|
|
201
|
-
const textTransform = compileTextTransform("textTransform",
|
|
201
|
+
const textTransform = compileTextTransform("textTransform", layoutProps);
|
|
202
202
|
if (textTransform)
|
|
203
203
|
css.textTransform = textTransform;
|
|
204
|
-
const lineHeight = compileLineHeight("lineHeight",
|
|
204
|
+
const lineHeight = compileLineHeight("lineHeight", layoutProps);
|
|
205
205
|
if (lineHeight)
|
|
206
206
|
css.lineHeight = lineHeight;
|
|
207
|
-
const textAlign = compileTextAlign("textAlign",
|
|
207
|
+
const textAlign = compileTextAlign("textAlign", layoutProps);
|
|
208
208
|
if (textAlign)
|
|
209
209
|
css.textAlign = textAlign;
|
|
210
|
-
const textAlignLast = compileTextAlign("textAlignLast",
|
|
210
|
+
const textAlignLast = compileTextAlign("textAlignLast", layoutProps);
|
|
211
211
|
if (textAlignLast)
|
|
212
212
|
css.textAlignLast = textAlignLast;
|
|
213
|
-
|
|
214
|
-
const textWrap = (_38 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.textWrap) === null || _38 === void 0 ? void 0 : _38.toString();
|
|
213
|
+
const textWrap = (_e = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.textWrap) === null || _e === void 0 ? void 0 : _e.toString();
|
|
215
214
|
if (textWrap)
|
|
216
215
|
css.textWrap = textWrap;
|
|
217
216
|
// --- Compile content rendering
|
|
218
|
-
const wrapContent = compileWrapContent("wrapContent",
|
|
217
|
+
const wrapContent = compileWrapContent("wrapContent", layoutProps);
|
|
219
218
|
if (wrapContent)
|
|
220
219
|
css.flexWrap = wrapContent;
|
|
221
|
-
const canShrink = compileCanShrink("canShrink",
|
|
220
|
+
const canShrink = compileCanShrink("canShrink", layoutProps);
|
|
222
221
|
if (canShrink)
|
|
223
222
|
css.flexShrink = canShrink;
|
|
224
223
|
// --- Other
|
|
225
|
-
const cursor = compileCursor("cursor",
|
|
224
|
+
const cursor = compileCursor("cursor", layoutProps);
|
|
226
225
|
if (cursor)
|
|
227
226
|
css.cursor = cursor;
|
|
228
227
|
// --- Done
|
|
@@ -244,68 +243,100 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
244
243
|
}
|
|
245
244
|
return true;
|
|
246
245
|
}
|
|
247
|
-
function compile(propName,
|
|
248
|
-
var _a, _b;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
246
|
+
function compile(propName, layoutProps, parseFn, convertFn) {
|
|
247
|
+
var _a, _b, _c, _d;
|
|
248
|
+
const defValue = compileSingleProperty();
|
|
249
|
+
if (((_a = layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.mediaSize) === null || _a === void 0 ? void 0 : _a.sizeIndex) !== undefined) {
|
|
250
|
+
const sizeIndex = (_b = layoutContext.mediaSize) === null || _b === void 0 ? void 0 : _b.sizeIndex;
|
|
251
|
+
const xsValue = compileSingleProperty("xs");
|
|
252
|
+
const smValue = compileSingleProperty("sm");
|
|
253
|
+
const mdValue = compileSingleProperty("md");
|
|
254
|
+
const lgValue = compileSingleProperty("lg");
|
|
255
|
+
const xlValue = compileSingleProperty("xl");
|
|
256
|
+
const xxlValue = compileSingleProperty("xxl");
|
|
257
|
+
let mergedValue;
|
|
258
|
+
switch (sizeIndex) {
|
|
259
|
+
case 0: // xs
|
|
260
|
+
mergedValue = (_c = xsValue !== null && xsValue !== void 0 ? xsValue : smValue) !== null && _c !== void 0 ? _c : mdValue;
|
|
261
|
+
break;
|
|
262
|
+
case 1: // sm
|
|
263
|
+
mergedValue = smValue !== null && smValue !== void 0 ? smValue : mdValue;
|
|
264
|
+
break;
|
|
265
|
+
case 2: // md
|
|
266
|
+
mergedValue = mdValue;
|
|
267
|
+
break;
|
|
268
|
+
case 3: // lg
|
|
269
|
+
mergedValue = lgValue;
|
|
270
|
+
break;
|
|
271
|
+
case 4: // xl
|
|
272
|
+
mergedValue = xlValue !== null && xlValue !== void 0 ? xlValue : lgValue;
|
|
273
|
+
break;
|
|
274
|
+
case 5: // xxl
|
|
275
|
+
mergedValue = (_d = xxlValue !== null && xxlValue !== void 0 ? xxlValue : xlValue) !== null && _d !== void 0 ? _d : lgValue;
|
|
276
|
+
break;
|
|
260
277
|
}
|
|
261
|
-
|
|
262
|
-
// if (hasOnlyUnresolvedVars(node.themeId)) {
|
|
263
|
-
// return undefined;
|
|
264
|
-
// }
|
|
265
|
-
if (node.themeId) {
|
|
266
|
-
return (0, StyleParser_1.toCssVar)(node.themeId);
|
|
267
|
-
}
|
|
268
|
-
return convertFn(node);
|
|
278
|
+
return mergedValue !== null && mergedValue !== void 0 ? mergedValue : defValue;
|
|
269
279
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
280
|
+
return defValue;
|
|
281
|
+
function compileSingleProperty(sizeSpec) {
|
|
282
|
+
var _a, _b, _c;
|
|
283
|
+
const source = (_a = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps[propName + (sizeSpec ? `-${sizeSpec}` : "")]) === null || _a === void 0 ? void 0 : _a.toString();
|
|
284
|
+
if (!source)
|
|
285
|
+
return undefined;
|
|
286
|
+
const parser = new StyleParser_1.StyleParser(source);
|
|
287
|
+
try {
|
|
288
|
+
const node = parseFn(parser);
|
|
289
|
+
if (!node)
|
|
290
|
+
return source;
|
|
291
|
+
if (!parser.testCompleted()) {
|
|
292
|
+
(_b = result.issues) !== null && _b !== void 0 ? _b : (result.issues = {});
|
|
293
|
+
result.issues[propName] = `Unexpected tail after the ${propName}`;
|
|
294
|
+
return source;
|
|
295
|
+
}
|
|
296
|
+
if (node.themeId) {
|
|
297
|
+
return (0, StyleParser_1.toCssVar)(node.themeId);
|
|
298
|
+
}
|
|
299
|
+
return convertFn(node);
|
|
300
|
+
}
|
|
301
|
+
catch (err) {
|
|
302
|
+
(_c = result.issues) !== null && _c !== void 0 ? _c : (result.issues = {});
|
|
303
|
+
result.issues[propName] = err === null || err === void 0 ? void 0 : err.toString();
|
|
304
|
+
return source;
|
|
305
|
+
}
|
|
275
306
|
}
|
|
276
307
|
}
|
|
277
308
|
// --- Compiles an alignment definition into a CSS size property
|
|
278
|
-
function compileAlignment(propName,
|
|
279
|
-
return compile(propName,
|
|
309
|
+
function compileAlignment(propName, layoutProps) {
|
|
310
|
+
return compile(propName, layoutProps, (p) => p.parseAlignment(), (n) => n.value);
|
|
280
311
|
}
|
|
281
312
|
// --- Compiles an alignment definition into a CSS size property
|
|
282
|
-
function compileTextAlign(propName,
|
|
283
|
-
return compile(propName,
|
|
313
|
+
function compileTextAlign(propName, layoutProps) {
|
|
314
|
+
return compile(propName, layoutProps, (p) => p.parseTextAlign(), (n) => n.value);
|
|
284
315
|
}
|
|
285
316
|
// --- Compiles a user select definition into a CSS size property
|
|
286
|
-
function compileUserSelect(propName,
|
|
287
|
-
return compile(propName,
|
|
317
|
+
function compileUserSelect(propName, layoutProps) {
|
|
318
|
+
return compile(propName, layoutProps, (p) => p.parseUserSelect(), (n) => n.value);
|
|
288
319
|
}
|
|
289
320
|
// --- Compiles a text transform definition into a CSS size property
|
|
290
|
-
function compileTextTransform(propName,
|
|
291
|
-
return compile(propName,
|
|
321
|
+
function compileTextTransform(propName, layoutProps) {
|
|
322
|
+
return compile(propName, layoutProps, (p) => p.parseTextTransform(), (n) => n.value);
|
|
292
323
|
}
|
|
293
|
-
function compileOrientation(propName,
|
|
294
|
-
return compile(propName,
|
|
324
|
+
function compileOrientation(propName, layoutProps) {
|
|
325
|
+
return compile(propName, layoutProps, (p) => p.parseOrientation(), (n) => n.value);
|
|
295
326
|
}
|
|
296
327
|
// --- Compiles a size definition into a CSS size property
|
|
297
|
-
function compileLineHeight(propName,
|
|
298
|
-
return compile(propName,
|
|
328
|
+
function compileLineHeight(propName, layoutProps) {
|
|
329
|
+
return compile(propName, layoutProps, (p) => p.parseLineHeight(), (n) => `${n.value}${n.unit}`);
|
|
299
330
|
}
|
|
300
331
|
// --- Compiles a size definition into a CSS size property
|
|
301
|
-
function compileOpacity(propName,
|
|
302
|
-
return compile(propName,
|
|
332
|
+
function compileOpacity(propName, layoutProps) {
|
|
333
|
+
return compile(propName, layoutProps, (p) => p.parseOpacity(), (n) => `${n.value}${n.unit}`);
|
|
303
334
|
}
|
|
304
335
|
// --- Compiles a size definition into a CSS size property
|
|
305
|
-
function compileSize(propName,
|
|
336
|
+
function compileSize(propName, layoutProps) {
|
|
306
337
|
let isStarSize = false;
|
|
307
338
|
let ratio;
|
|
308
|
-
let value = compile(propName,
|
|
339
|
+
let value = compile(propName, layoutProps, (p) => {
|
|
309
340
|
var _a;
|
|
310
341
|
const sizeNode = p.parseSize();
|
|
311
342
|
isStarSize = (sizeNode === null || sizeNode === void 0 ? void 0 : sizeNode.unit) === "*";
|
|
@@ -321,37 +352,37 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
321
352
|
};
|
|
322
353
|
}
|
|
323
354
|
// --- Compiles a size definition into a CSS size property
|
|
324
|
-
function compileMargin(propName,
|
|
325
|
-
return compile(propName,
|
|
355
|
+
function compileMargin(propName, layoutProps) {
|
|
356
|
+
return compile(propName, layoutProps, (p) => p.parseMargin(), (n) => { var _a; return (_a = n.extSize) !== null && _a !== void 0 ? _a : `${n.value}${n.unit}`; });
|
|
326
357
|
}
|
|
327
358
|
// --- Compiles a zIndex definition into a CSS zIndex property
|
|
328
|
-
function compileZIndex(propName,
|
|
329
|
-
return compile(propName,
|
|
359
|
+
function compileZIndex(propName, layoutProps) {
|
|
360
|
+
return compile(propName, layoutProps, (p) => p.parseZIndex(), (n) => n.value.toString());
|
|
330
361
|
}
|
|
331
|
-
function compileScrolling(propName,
|
|
332
|
-
return compile(propName,
|
|
362
|
+
function compileScrolling(propName, layoutProps) {
|
|
363
|
+
return compile(propName, layoutProps, (p) => p.parseScrolling(), (n) => n.value);
|
|
333
364
|
}
|
|
334
|
-
function compileDirection(propName,
|
|
335
|
-
return compile(propName,
|
|
365
|
+
function compileDirection(propName, layoutProps) {
|
|
366
|
+
return compile(propName, layoutProps, (p) => p.parseDirection(), (n) => n.value);
|
|
336
367
|
}
|
|
337
|
-
function compileCursor(propName,
|
|
338
|
-
return compile(propName,
|
|
368
|
+
function compileCursor(propName, layoutProps) {
|
|
369
|
+
return compile(propName, layoutProps, (p) => p.parseCursor(), (n) => n.value);
|
|
339
370
|
}
|
|
340
|
-
function compileFontWeight(propName,
|
|
341
|
-
return compile(propName,
|
|
371
|
+
function compileFontWeight(propName, layoutProps) {
|
|
372
|
+
return compile(propName, layoutProps, (p) => p.parseFontWeight(), (n) => { var _a; return (_a = n.value) === null || _a === void 0 ? void 0 : _a.toString(); });
|
|
342
373
|
}
|
|
343
|
-
function compileFontFamily(propName,
|
|
344
|
-
return compile(propName,
|
|
374
|
+
function compileFontFamily(propName, layoutProps) {
|
|
375
|
+
return compile(propName, layoutProps, (p) => p.parseFontFamily(), (n) => n.value);
|
|
345
376
|
}
|
|
346
|
-
function compileColor(propName,
|
|
347
|
-
return compile(propName,
|
|
377
|
+
function compileColor(propName, layoutProps) {
|
|
378
|
+
return compile(propName, layoutProps, (p) => p.parseColor(), (n) => n.value !== undefined
|
|
348
379
|
? typeof n.value === "number"
|
|
349
380
|
? `#${n.value.toString(16).padStart(8, "0")}`
|
|
350
381
|
: n.value
|
|
351
382
|
: undefined);
|
|
352
383
|
}
|
|
353
|
-
function compileBackground(propName,
|
|
354
|
-
return compile(propName,
|
|
384
|
+
function compileBackground(propName, layoutProps) {
|
|
385
|
+
return compile(propName, layoutProps, (p) => p.parseColor(), (n) => n.value !== undefined
|
|
355
386
|
? typeof n.value === "number"
|
|
356
387
|
? `#${n.value.toString(16).padStart(8, "0")}`
|
|
357
388
|
: n.value
|
|
@@ -380,8 +411,8 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
380
411
|
}
|
|
381
412
|
return true;
|
|
382
413
|
}
|
|
383
|
-
function compileBorder(propName,
|
|
384
|
-
return compile(propName,
|
|
414
|
+
function compileBorder(propName, layoutProps) {
|
|
415
|
+
return compile(propName, layoutProps, (p) => p.parseBorder(), (n) => {
|
|
385
416
|
var _a, _b, _c;
|
|
386
417
|
if (hasOnlyUnresolvedVars(n.themeId1, n.themeId2, n.themeId3)) {
|
|
387
418
|
return undefined;
|
|
@@ -401,8 +432,8 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
401
432
|
: ""}`).trim();
|
|
402
433
|
});
|
|
403
434
|
}
|
|
404
|
-
function compileTextDecoration(propName,
|
|
405
|
-
return compile(propName,
|
|
435
|
+
function compileTextDecoration(propName, layoutProps) {
|
|
436
|
+
return compile(propName, layoutProps, (p) => p.parseTextDecoration(), (n) => {
|
|
406
437
|
var _a, _b, _c;
|
|
407
438
|
if (n.none) {
|
|
408
439
|
return "none";
|
|
@@ -421,8 +452,8 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
421
452
|
`${(_c = n.color) !== null && _c !== void 0 ? _c : ""}`).trim();
|
|
422
453
|
});
|
|
423
454
|
}
|
|
424
|
-
function compileRadius(propName,
|
|
425
|
-
return compile(propName,
|
|
455
|
+
function compileRadius(propName, layoutProps) {
|
|
456
|
+
return compile(propName, layoutProps, (p) => p.parseRadius(), (n) => {
|
|
426
457
|
var _a, _b, _c, _d;
|
|
427
458
|
if (hasOnlyUnresolvedVars(n.themeId1, n.themeId2)) {
|
|
428
459
|
return undefined;
|
|
@@ -437,8 +468,8 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
437
468
|
return part.trim();
|
|
438
469
|
});
|
|
439
470
|
}
|
|
440
|
-
function compileShadow(propName,
|
|
441
|
-
return compile(propName,
|
|
471
|
+
function compileShadow(propName, layoutProps) {
|
|
472
|
+
return compile(propName, layoutProps, (p) => p.parseShadow(), (n) => {
|
|
442
473
|
var _a;
|
|
443
474
|
let css = "";
|
|
444
475
|
for (const sg of (_a = n.segments) !== null && _a !== void 0 ? _a : []) {
|
|
@@ -461,20 +492,16 @@ function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layout
|
|
|
461
492
|
});
|
|
462
493
|
}
|
|
463
494
|
// --- Compiles a Boolean definition into a CSS font-style size property
|
|
464
|
-
function compileItalic(propName,
|
|
465
|
-
return compile(propName,
|
|
495
|
+
function compileItalic(propName, layoutProps) {
|
|
496
|
+
return compile(propName, layoutProps, (p) => p.parseBoolean(), (n) => (n.value ? "italic" : "normal"));
|
|
466
497
|
}
|
|
467
498
|
// --- Compiles a Boolean definition into a CSS flex-wrap property
|
|
468
|
-
function compileWrapContent(propName,
|
|
469
|
-
return compile(propName,
|
|
499
|
+
function compileWrapContent(propName, layoutProps) {
|
|
500
|
+
return compile(propName, layoutProps, (p) => p.parseBoolean(), (n) => (n.value ? "wrap" : "nowrap"));
|
|
470
501
|
}
|
|
471
502
|
// --- Compiles a Boolean definition into a CSS flex-shrink property
|
|
472
|
-
function compileCanShrink(propName,
|
|
473
|
-
return compile(propName,
|
|
474
|
-
}
|
|
475
|
-
function compileBoolean(propName, defValue, source) {
|
|
476
|
-
const compiledValue = compile(propName, source, (p) => (source ? p.parseBoolean() : null), (n) => (n.value ? "true" : "false"));
|
|
477
|
-
return compiledValue === undefined ? defValue : (compiledValue === null || compiledValue === void 0 ? void 0 : compiledValue.toString()) === "true";
|
|
503
|
+
function compileCanShrink(propName, layoutProps) {
|
|
504
|
+
return compile(propName, layoutProps, (p) => p.parseBoolean(), (n) => (n.value ? "1" : "0"));
|
|
478
505
|
}
|
|
479
506
|
function isHorizontalAndStartSize(size, layoutContext) {
|
|
480
507
|
if (!size.value)
|
|
@@ -51,4 +51,5 @@ exports.errorMessages = {
|
|
|
51
51
|
T021: "Invalid reusable component attribute '{0}'",
|
|
52
52
|
T022: "The 'script' tag must not have any attribute",
|
|
53
53
|
T023: "A 'script' tag cannot nest other child nodes, only text",
|
|
54
|
+
T024: "Cannot put a reusable component definitions into a slot",
|
|
54
55
|
};
|
|
@@ -76,7 +76,7 @@ exports.Diag_Tag_Identifier_Expected = {
|
|
|
76
76
|
exports.Diag_Attr_Value_Expected = {
|
|
77
77
|
category: DiagnosticCategory.Error,
|
|
78
78
|
code: ErrCodes.expAttrValue,
|
|
79
|
-
message: "An attribute value expected
|
|
79
|
+
message: "An attribute value expected.",
|
|
80
80
|
};
|
|
81
81
|
exports.Diag_Eq_Token_Expected = {
|
|
82
82
|
category: DiagnosticCategory.Error,
|