@csszyx/compiler 0.3.0 → 0.3.1

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/index.cjs CHANGED
@@ -1990,16 +1990,18 @@ function transform(szProp, prefix = "", mangleMap) {
1990
1990
  classes.push(className);
1991
1991
  continue;
1992
1992
  }
1993
- if (rawKey === "content" || rawKey === "alignContent") {
1994
- const ALIGN_CONTENT_KEYWORDS = /* @__PURE__ */ new Set(["normal", "center", "start", "end", "between", "around", "evenly", "baseline", "stretch"]);
1995
- if (ALIGN_CONTENT_KEYWORDS.has(value)) {
1996
- className += `content-${value}`;
1993
+ if (rawKey === "alignContent") {
1994
+ className += `content-${value}`;
1995
+ classes.push(className);
1996
+ continue;
1997
+ }
1998
+ if (rawKey === "content") {
1999
+ if (value === "none") {
2000
+ className += "content-none";
1997
2001
  } else if (value.startsWith("--")) {
1998
2002
  className += `content-(${value})`;
1999
- } else if (!["none", "empty"].includes(value)) {
2000
- className += `content-[${value}]`;
2001
2003
  } else {
2002
- className += `content-${value}`;
2004
+ className += `content-[${value}]`;
2003
2005
  }
2004
2006
  classes.push(className);
2005
2007
  continue;
@@ -2177,7 +2179,7 @@ function transform(szProp, prefix = "", mangleMap) {
2177
2179
  }
2178
2180
  }
2179
2181
  let mergedClasses = classes;
2180
- const textSizePattern = /^((?:[a-z0-9\-[\]@/:]*:)*)text-(.+)$/;
2182
+ const textSizePattern = /^((?:[a-z0-9\-[\]@/:]*:)*)text-(xs|sm|base|lg|[2-9]?xl|\[.+\]|\(.+\))$/;
2181
2183
  const leadingPattern = /^((?:[a-z0-9\-[\]@/:]*:)*)leading-(.+)$/;
2182
2184
  const textEntries = [];
2183
2185
  const leadingEntries = [];
@@ -2194,11 +2196,15 @@ function transform(szProp, prefix = "", mangleMap) {
2194
2196
  }
2195
2197
  if (textEntries.length > 0 && leadingEntries.length > 0) {
2196
2198
  const removeIndices = /* @__PURE__ */ new Set();
2199
+ const consumedLeading = /* @__PURE__ */ new Set();
2197
2200
  for (const te of textEntries) {
2198
- const matchingLeading = leadingEntries.find((le) => le.prefix === te.prefix);
2201
+ const matchingLeading = leadingEntries.find(
2202
+ (le) => le.prefix === te.prefix && !consumedLeading.has(le.index)
2203
+ );
2199
2204
  if (matchingLeading) {
2200
2205
  mergedClasses[te.index] = `${te.prefix}text-${te.size}/${matchingLeading.value}`;
2201
2206
  removeIndices.add(matchingLeading.index);
2207
+ consumedLeading.add(matchingLeading.index);
2202
2208
  }
2203
2209
  }
2204
2210
  if (removeIndices.size > 0) {
package/dist/index.d.cts CHANGED
@@ -707,6 +707,8 @@ interface FlexboxGridProps {
707
707
  justifyItems?: 'start' | 'end' | 'center' | 'stretch' | 'normal' | 'safe-center' | 'safe-end';
708
708
  /** @see https://tailwindcss.com/docs/justify-self */
709
709
  justifySelf?: 'auto' | 'start' | 'end' | 'center' | 'stretch' | 'safe-center' | 'safe-end';
710
+ /** @see https://tailwindcss.com/docs/align-content */
711
+ alignContent?: 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch';
710
712
  /** @see https://tailwindcss.com/docs/align-items */
711
713
  items?: 'start' | 'end' | 'center' | 'baseline' | 'stretch' | 'safe-center' | 'safe-end' | (string & {});
712
714
  /** @see https://tailwindcss.com/docs/align-self */
@@ -887,8 +889,8 @@ interface TypographyProps {
887
889
  break?: 'normal' | 'all' | 'keep';
888
890
  /** @see https://tailwindcss.com/docs/hyphens */
889
891
  hyphens?: 'none' | 'manual' | 'auto';
890
- /** @see https://tailwindcss.com/docs/content — also handles align-content */
891
- content?: 'none' | 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch' | (string & {});
892
+ /** @see https://tailwindcss.com/docs/content */
893
+ content?: 'none' | (string & {});
892
894
  /** @see https://tailwindcss.com/docs/font-feature-settings */
893
895
  fontFeatures?: string & {};
894
896
  /** @see https://tailwindcss.com/docs/forced-color-adjust */
package/dist/index.d.ts CHANGED
@@ -707,6 +707,8 @@ interface FlexboxGridProps {
707
707
  justifyItems?: 'start' | 'end' | 'center' | 'stretch' | 'normal' | 'safe-center' | 'safe-end';
708
708
  /** @see https://tailwindcss.com/docs/justify-self */
709
709
  justifySelf?: 'auto' | 'start' | 'end' | 'center' | 'stretch' | 'safe-center' | 'safe-end';
710
+ /** @see https://tailwindcss.com/docs/align-content */
711
+ alignContent?: 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch';
710
712
  /** @see https://tailwindcss.com/docs/align-items */
711
713
  items?: 'start' | 'end' | 'center' | 'baseline' | 'stretch' | 'safe-center' | 'safe-end' | (string & {});
712
714
  /** @see https://tailwindcss.com/docs/align-self */
@@ -887,8 +889,8 @@ interface TypographyProps {
887
889
  break?: 'normal' | 'all' | 'keep';
888
890
  /** @see https://tailwindcss.com/docs/hyphens */
889
891
  hyphens?: 'none' | 'manual' | 'auto';
890
- /** @see https://tailwindcss.com/docs/content — also handles align-content */
891
- content?: 'none' | 'normal' | 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'baseline' | 'stretch' | (string & {});
892
+ /** @see https://tailwindcss.com/docs/content */
893
+ content?: 'none' | (string & {});
892
894
  /** @see https://tailwindcss.com/docs/font-feature-settings */
893
895
  fontFeatures?: string & {};
894
896
  /** @see https://tailwindcss.com/docs/forced-color-adjust */
package/dist/index.js CHANGED
@@ -1938,16 +1938,18 @@ function transform(szProp, prefix = "", mangleMap) {
1938
1938
  classes.push(className);
1939
1939
  continue;
1940
1940
  }
1941
- if (rawKey === "content" || rawKey === "alignContent") {
1942
- const ALIGN_CONTENT_KEYWORDS = /* @__PURE__ */ new Set(["normal", "center", "start", "end", "between", "around", "evenly", "baseline", "stretch"]);
1943
- if (ALIGN_CONTENT_KEYWORDS.has(value)) {
1944
- className += `content-${value}`;
1941
+ if (rawKey === "alignContent") {
1942
+ className += `content-${value}`;
1943
+ classes.push(className);
1944
+ continue;
1945
+ }
1946
+ if (rawKey === "content") {
1947
+ if (value === "none") {
1948
+ className += "content-none";
1945
1949
  } else if (value.startsWith("--")) {
1946
1950
  className += `content-(${value})`;
1947
- } else if (!["none", "empty"].includes(value)) {
1948
- className += `content-[${value}]`;
1949
1951
  } else {
1950
- className += `content-${value}`;
1952
+ className += `content-[${value}]`;
1951
1953
  }
1952
1954
  classes.push(className);
1953
1955
  continue;
@@ -2125,7 +2127,7 @@ function transform(szProp, prefix = "", mangleMap) {
2125
2127
  }
2126
2128
  }
2127
2129
  let mergedClasses = classes;
2128
- const textSizePattern = /^((?:[a-z0-9\-[\]@/:]*:)*)text-(.+)$/;
2130
+ const textSizePattern = /^((?:[a-z0-9\-[\]@/:]*:)*)text-(xs|sm|base|lg|[2-9]?xl|\[.+\]|\(.+\))$/;
2129
2131
  const leadingPattern = /^((?:[a-z0-9\-[\]@/:]*:)*)leading-(.+)$/;
2130
2132
  const textEntries = [];
2131
2133
  const leadingEntries = [];
@@ -2142,11 +2144,15 @@ function transform(szProp, prefix = "", mangleMap) {
2142
2144
  }
2143
2145
  if (textEntries.length > 0 && leadingEntries.length > 0) {
2144
2146
  const removeIndices = /* @__PURE__ */ new Set();
2147
+ const consumedLeading = /* @__PURE__ */ new Set();
2145
2148
  for (const te of textEntries) {
2146
- const matchingLeading = leadingEntries.find((le) => le.prefix === te.prefix);
2149
+ const matchingLeading = leadingEntries.find(
2150
+ (le) => le.prefix === te.prefix && !consumedLeading.has(le.index)
2151
+ );
2147
2152
  if (matchingLeading) {
2148
2153
  mergedClasses[te.index] = `${te.prefix}text-${te.size}/${matchingLeading.value}`;
2149
2154
  removeIndices.add(matchingLeading.index);
2155
+ consumedLeading.add(matchingLeading.index);
2150
2156
  }
2151
2157
  }
2152
2158
  if (removeIndices.size > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/compiler",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Core compiler and transformation logic for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -38,7 +38,7 @@
38
38
  "@babel/core": "^7.23.7",
39
39
  "@babel/types": "^7.23.6",
40
40
  "@babel/traverse": "^7.23.7",
41
- "@csszyx/core": "0.3.0"
41
+ "@csszyx/core": "0.3.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/babel__core": "^7.20.5",