@plumeria/compiler 0.20.1 → 0.20.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.
Files changed (2) hide show
  1. package/dist/extract.js +25 -4
  2. package/package.json +1 -1
package/dist/extract.js CHANGED
@@ -135,10 +135,31 @@ function extractCssProps(code) {
135
135
  currentIndex++;
136
136
  }
137
137
  if (parenCount === 0) {
138
- const normalizedArgs = args.replace(/\s+/g, ' ').trim();
139
- const cleanArgs = parseCssPropsArguments(normalizedArgs);
140
- if (cleanArgs.length > 0) {
141
- propsMatches.push(`css.props(${cleanArgs.join(', ')})`);
138
+ const originalArgs = args.split(/\s*,\s*(?![^(]*\))/);
139
+ const staticArgs = [];
140
+ const conditionalStyleObjects = [];
141
+ for (const arg of originalArgs) {
142
+ const trimmedArg = arg.trim();
143
+ if (trimmedArg) {
144
+ if (trimmedArg.includes('&&') || trimmedArg.includes('?')) {
145
+ const styles = parseCssPropsArguments(trimmedArg);
146
+ conditionalStyleObjects.push(...styles);
147
+ }
148
+ else {
149
+ staticArgs.push(trimmedArg);
150
+ }
151
+ }
152
+ }
153
+ if (staticArgs.length > 0) {
154
+ propsMatches.push(`css.props(${staticArgs.join(', ')})`);
155
+ }
156
+ for (const styleObj of conditionalStyleObjects) {
157
+ if (styleObj &&
158
+ styleObj !== 'false' &&
159
+ styleObj !== 'null' &&
160
+ styleObj !== 'undefined') {
161
+ propsMatches.push(`css.props(${styleObj})`);
162
+ }
142
163
  }
143
164
  }
144
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/compiler",
3
- "version": "0.20.1",
3
+ "version": "0.20.3",
4
4
  "description": "Plumeria Rust-based compiler",
5
5
  "repository": {
6
6
  "type": "git",