zss-engine 2.2.1 → 2.2.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.
@@ -6,7 +6,7 @@ const index_js_1 = require("../index.js");
6
6
  const shorthand_js_1 = require("./shorthand.js");
7
7
  function splitAtomicAndNested(obj, flat, nonFlat) {
8
8
  Object.entries(obj).forEach(([property, value]) => {
9
- if (property.startsWith(':') || property.startsWith('&')) {
9
+ if (property.startsWith(':') || property.startsWith('[')) {
10
10
  nonFlat[property] = value;
11
11
  }
12
12
  else if (property.startsWith('@media') || property.startsWith('@container')) {
@@ -49,8 +49,8 @@ function transpile(object, base36Hash, core) {
49
49
  cssRule += ` ${CSSProp}: ${applyValue};\n`;
50
50
  }
51
51
  else if (!property.startsWith('@')) {
52
- const kebabPseudoSelector = (0, helper_js_1.camelToKebabCase)(property.replace('&', ''));
53
- const isPseudo = property.startsWith(':') || property.startsWith('&');
52
+ const kebabPseudoSelector = (0, helper_js_1.camelToKebabCase)(property);
53
+ const isPseudo = property.startsWith(':') || property.startsWith('[');
54
54
  const selector = isPseudo ? className + ':not(#\\#)' + kebabPseudoSelector : className + kebabPseudoSelector;
55
55
  const styles = stringConverter(selector, value, indentLevel);
56
56
  Object.assign(classSelector, styles);
@@ -63,9 +63,9 @@ function transpile(object, base36Hash, core) {
63
63
  if (Object.prototype.hasOwnProperty.call(value, mediaProp)) {
64
64
  const mediaValue = value[mediaProp];
65
65
  const isColon = mediaProp.startsWith(':');
66
- const isAnd = mediaProp.startsWith('&');
67
- if (isColon || isAnd) {
68
- const kebabMediaProp = (0, helper_js_1.camelToKebabCase)(mediaProp.replace('&', ''));
66
+ const isArray = mediaProp.startsWith('[');
67
+ if (isColon || isArray) {
68
+ const kebabMediaProp = (0, helper_js_1.camelToKebabCase)(mediaProp);
69
69
  const increaseKebabMediaProp = ':not(#\\#)' + kebabMediaProp;
70
70
  let pseudoClassRule = '';
71
71
  if (typeof mediaValue === 'object' && mediaValue !== null) {
@@ -2,7 +2,7 @@ import { camelToKebabCase, genBase36Hash, applyCssValue, transpileAtomic } from
2
2
  import { SHORTHAND_PROPERTIES } from './shorthand.js';
3
3
  function splitAtomicAndNested(obj, flat, nonFlat) {
4
4
  Object.entries(obj).forEach(([property, value]) => {
5
- if (property.startsWith(':') || property.startsWith('&')) {
5
+ if (property.startsWith(':') || property.startsWith('[')) {
6
6
  nonFlat[property] = value;
7
7
  }
8
8
  else if (property.startsWith('@media') || property.startsWith('@container')) {
@@ -46,8 +46,8 @@ export function transpile(object, base36Hash, core) {
46
46
  cssRule += ` ${CSSProp}: ${applyValue};\n`;
47
47
  }
48
48
  else if (!property.startsWith('@')) {
49
- const kebabPseudoSelector = camelToKebabCase(property.replace('&', ''));
50
- const isPseudo = property.startsWith(':') || property.startsWith('&');
49
+ const kebabPseudoSelector = camelToKebabCase(property);
50
+ const isPseudo = property.startsWith(':') || property.startsWith('[');
51
51
  const selector = isPseudo ? className + ':not(#\\#)' + kebabPseudoSelector : className + kebabPseudoSelector;
52
52
  const styles = stringConverter(selector, value, indentLevel);
53
53
  Object.assign(classSelector, styles);
@@ -60,9 +60,9 @@ export function transpile(object, base36Hash, core) {
60
60
  if (Object.prototype.hasOwnProperty.call(value, mediaProp)) {
61
61
  const mediaValue = value[mediaProp];
62
62
  const isColon = mediaProp.startsWith(':');
63
- const isAnd = mediaProp.startsWith('&');
64
- if (isColon || isAnd) {
65
- const kebabMediaProp = camelToKebabCase(mediaProp.replace('&', ''));
63
+ const isArray = mediaProp.startsWith('[');
64
+ if (isColon || isArray) {
65
+ const kebabMediaProp = camelToKebabCase(mediaProp);
66
66
  const increaseKebabMediaProp = ':not(#\\#)' + kebabMediaProp;
67
67
  let pseudoClassRule = '';
68
68
  if (typeof mediaValue === 'object' && mediaValue !== null) {
@@ -30,17 +30,17 @@ interface CommonProperties extends BaseCSSProperties {
30
30
  caretColor?: CSSColorProperty;
31
31
  columnRuleColor?: CSSColorProperty;
32
32
  }
33
- type AndString = `&${string}`;
34
- type AndSelector = {
35
- [key in AndString]: CommonProperties;
33
+ type ArrayString = `[${string}`;
34
+ type ArraySelector = {
35
+ [key in ArrayString]: CommonProperties | CSSVariableProperty;
36
36
  };
37
37
  type ColonString = `:${string}`;
38
38
  type ColonSelector = {
39
- [key in ColonString]: CommonProperties;
39
+ [key in ColonString]: CommonProperties | CSSVariableProperty;
40
40
  };
41
41
  export type Query = `@media ${string}` | `@container ${string}`;
42
42
  type QuerySelector = {
43
- [K in Query]: CommonProperties | ColonSelector | AndSelector | CSSVariableProperty;
43
+ [K in Query]: CommonProperties | ColonSelector | ArraySelector | CSSVariableProperty;
44
44
  };
45
- export type CSSProperties = CommonProperties | AndSelector | ColonSelector | QuerySelector | CSSVariableProperty;
45
+ export type CSSProperties = CommonProperties | ArraySelector | ColonSelector | QuerySelector | CSSVariableProperty;
46
46
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zss-engine",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Zero-runtime StyleSheet Engine",
5
5
  "funding": "https://github.com/sponsors/refirst11",
6
6
  "author": "Refirst 11",