pulse-js-framework 1.7.21 → 1.7.22
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/compiler/parser.js +10 -3
- package/package.json +1 -1
package/compiler/parser.js
CHANGED
|
@@ -1575,17 +1575,24 @@ export class Parser {
|
|
|
1575
1575
|
const lastPart = selectorParts[selectorParts.length - 1];
|
|
1576
1576
|
|
|
1577
1577
|
// Don't add space after these (they attach to what follows)
|
|
1578
|
-
const noSpaceAfter = ['.', '#', ':', '[', '(', '>', '+', '~'];
|
|
1578
|
+
const noSpaceAfter = ['.', '#', ':', '[', '(', '>', '+', '~', '-'];
|
|
1579
1579
|
// Don't add space before these (they attach to what precedes)
|
|
1580
|
-
const noSpaceBefore = [':', ']', ')', ',', '.', '#'];
|
|
1580
|
+
const noSpaceBefore = [':', ']', ')', ',', '.', '#', '-'];
|
|
1581
1581
|
|
|
1582
1582
|
// Special case: . or # after an identifier needs space (descendant selector)
|
|
1583
1583
|
// e.g., ".school .date" - need space between "school" and "."
|
|
1584
1584
|
const isDescendantSelector = (tokenValue === '.' || tokenValue === '#') &&
|
|
1585
1585
|
lastToken?.type === TokenType.IDENT;
|
|
1586
1586
|
|
|
1587
|
+
// Special case: hyphenated class names like .job-title
|
|
1588
|
+
// Don't add space if current token is '-' and last token was IDENT
|
|
1589
|
+
// Or if last token was '-' (the next token should attach to it)
|
|
1590
|
+
const isHyphenatedIdent = (tokenValue === '-' && lastToken?.type === TokenType.IDENT) ||
|
|
1591
|
+
(lastToken?.type === TokenType.MINUS);
|
|
1592
|
+
|
|
1587
1593
|
const needsSpace = !noSpaceAfter.includes(lastPart) &&
|
|
1588
|
-
!noSpaceBefore.includes(tokenValue)
|
|
1594
|
+
!noSpaceBefore.includes(tokenValue) &&
|
|
1595
|
+
!isHyphenatedIdent ||
|
|
1589
1596
|
isDescendantSelector;
|
|
1590
1597
|
|
|
1591
1598
|
if (needsSpace) {
|