esm-styles 0.1.7 → 0.1.9

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/lib/build.js CHANGED
@@ -175,7 +175,7 @@ export async function build(configPath = 'esm-styles.config.js') {
175
175
  .map((f) => f.layer)
176
176
  .join(', ');
177
177
  const layerImports = layerFiles.map((f) => `@import '${f}';`).join('\n');
178
- const mainCss = [varImports, layerNames ? `@layer ${layerNames};` : '', layerImports]
178
+ const mainCss = [layerNames ? `@layer ${layerNames};` : '', layerImports, varImports]
179
179
  .filter(Boolean)
180
180
  .join('\n') + '\n';
181
181
  await fs.writeFile(mainCssPath, mainCss, 'utf8');
@@ -178,9 +178,14 @@ export const joinSelectorPath = (path) => {
178
178
  else if (isHtmlTag(part)) {
179
179
  return acc + (acc ? ' ' : '') + part;
180
180
  }
181
- else {
182
- // Not a tag, not a special selector: treat as class
183
- return acc + (acc ? '' : '') + '.' + part;
181
+ else if (/^([a-z][a-z0-9]*)\.(.+)/.test(part)) {
182
+ // If part matches 'tag.class...' and tag is an HTML tag
183
+ const match = part.match(/^([a-z][a-z0-9]*)\.(.+)/);
184
+ if (match && isHtmlTag(match[1])) {
185
+ return acc + (acc ? ' ' : '') + match[1] + '.' + match[2];
186
+ }
184
187
  }
188
+ // Not a tag, not a special selector: treat as class
189
+ return acc + (acc ? '' : '') + '.' + part;
185
190
  }, ''));
186
191
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esm-styles",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "A library for working with ESM styles",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",