zss-engine 2.1.2 → 2.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.
@@ -4,7 +4,7 @@ exports.transpileAtomic = transpileAtomic;
4
4
  const helper_js_1 = require("./helper.js");
5
5
  const shorthand_js_1 = require("./shorthand.js");
6
6
  const ALL_LONGHANDS = new Set(Object.values(shorthand_js_1.SHORTHAND_PROPERTIES).flat());
7
- function transpileAtomic(property, value, hash) {
7
+ function transpileAtomic(property, value, hash, pseudo) {
8
8
  if (typeof value === 'string' || typeof value === 'number') {
9
9
  const CSSProp = (0, helper_js_1.camelToKebabCase)(property);
10
10
  const applyValue = (0, helper_js_1.applyCssValue)(value, CSSProp);
@@ -12,6 +12,9 @@ function transpileAtomic(property, value, hash) {
12
12
  if (ALL_LONGHANDS.has(CSSProp)) {
13
13
  selector += ':not(#\\#)';
14
14
  }
15
+ if (pseudo) {
16
+ selector += pseudo;
17
+ }
15
18
  const atomicRule = `${selector} { ${CSSProp}: ${applyValue}; }`;
16
19
  if (property.startsWith('@media') || property.startsWith('@container')) {
17
20
  return `${property} { ${atomicRule} }`;
@@ -1,7 +1,7 @@
1
1
  import { applyCssValue, camelToKebabCase } from './helper.js';
2
2
  import { SHORTHAND_PROPERTIES } from './shorthand.js';
3
3
  const ALL_LONGHANDS = new Set(Object.values(SHORTHAND_PROPERTIES).flat());
4
- function transpileAtomic(property, value, hash) {
4
+ function transpileAtomic(property, value, hash, pseudo) {
5
5
  if (typeof value === 'string' || typeof value === 'number') {
6
6
  const CSSProp = camelToKebabCase(property);
7
7
  const applyValue = applyCssValue(value, CSSProp);
@@ -9,6 +9,9 @@ function transpileAtomic(property, value, hash) {
9
9
  if (ALL_LONGHANDS.has(CSSProp)) {
10
10
  selector += ':not(#\\#)';
11
11
  }
12
+ if (pseudo) {
13
+ selector += pseudo;
14
+ }
12
15
  const atomicRule = `${selector} { ${CSSProp}: ${applyValue}; }`;
13
16
  if (property.startsWith('@media') || property.startsWith('@container')) {
14
17
  return `${property} { ${atomicRule} }`;
@@ -1,2 +1,2 @@
1
- declare function transpileAtomic(property: string, value: string | number, hash: string): string;
1
+ declare function transpileAtomic(property: string, value: string | number, hash: string, pseudo?: string): string;
2
2
  export { transpileAtomic };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zss-engine",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "Zero-runtime StyleSheet Engine",
5
5
  "funding": "https://github.com/sponsors/refirst11",
6
6
  "author": "Refirst 11",