@csszyx/compiler 0.10.3 → 0.10.4

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
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const core = require('@csszyx/core');
4
- const transformCore = require('./shared/compiler.DmlsP739.cjs');
4
+ const transformCore = require('./shared/compiler.BCOOXYBh.cjs');
5
5
  const oxcParser = require('oxc-parser');
6
6
  const t = require('@babel/types');
7
7
  const node_crypto = require('node:crypto');
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { init, version, transform_sz, encode } from '@csszyx/core';
2
- import { t as transform, C as COLOR_PROPERTIES, P as PROPERTY_MAP, g as getCSSVariableName, a as PropertyCategory, K as KNOWN_VARIANTS, b as getVariantPrefix, c as getPropertyCategory, s as stripInvalidColorStrings } from './shared/compiler.BUCRKtMU.mjs';
3
- export { B as BOOLEAN_SHORTHANDS, d as PROPERTY_CATEGORY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS, e as SUGGESTION_MAP, i as isValidSzProp, n as normalizeClassName } from './shared/compiler.BUCRKtMU.mjs';
2
+ import { t as transform, C as COLOR_PROPERTIES, P as PROPERTY_MAP, g as getCSSVariableName, a as PropertyCategory, K as KNOWN_VARIANTS, b as getVariantPrefix, c as getPropertyCategory, s as stripInvalidColorStrings } from './shared/compiler.DGInsDP8.mjs';
3
+ export { B as BOOLEAN_SHORTHANDS, d as PROPERTY_CATEGORY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS, e as SUGGESTION_MAP, i as isValidSzProp, n as normalizeClassName } from './shared/compiler.DGInsDP8.mjs';
4
4
  import { parseSync } from 'oxc-parser';
5
5
  import * as t from '@babel/types';
6
6
  import { createHash } from 'node:crypto';
@@ -1041,6 +1041,41 @@ const REMOVED_BOOLEAN_SUGAR = {
1041
1041
  antialiased: { key: "fontSmoothing", value: "grayscale" },
1042
1042
  subpixelAntialiased: { key: "fontSmoothing", value: "subpixel" }
1043
1043
  };
1044
+ const ALIGNMENT_KEYS = /* @__PURE__ */ new Set([
1045
+ "justify",
1046
+ "items",
1047
+ "self",
1048
+ "alignContent",
1049
+ "placeItems",
1050
+ "placeContent",
1051
+ "justifyItems",
1052
+ "justifySelf"
1053
+ ]);
1054
+ const ALIGNMENT_CSS_VALUE_HINT = {
1055
+ "flex-start": "start",
1056
+ "flex-end": "end",
1057
+ "space-between": "between",
1058
+ "space-around": "around",
1059
+ "space-evenly": "evenly"
1060
+ };
1061
+ const warnedAlignmentValues = /* @__PURE__ */ new Set();
1062
+ function warnAlignmentValue(rawKey, value) {
1063
+ if (process.env.NODE_ENV === "production" || typeof value !== "string") {
1064
+ return;
1065
+ }
1066
+ const hint = ALIGNMENT_CSS_VALUE_HINT[value];
1067
+ if (!hint || !ALIGNMENT_KEYS.has(rawKey)) {
1068
+ return;
1069
+ }
1070
+ const sig = `${rawKey}:${value}`;
1071
+ if (warnedAlignmentValues.has(sig)) {
1072
+ return;
1073
+ }
1074
+ warnedAlignmentValues.add(sig);
1075
+ console.warn(
1076
+ `[csszyx] ${rawKey}: '${value}' is a CSS value \u2014 use the short form '${hint}' (e.g. { ${rawKey}: '${hint}' }). '${rawKey}-${value}' has no Tailwind utility and renders nothing.`
1077
+ );
1078
+ }
1044
1079
  const BOOLEAN_TO_CLASS = {
1045
1080
  backdropBlur: "backdrop-blur",
1046
1081
  backdropGrayscale: "backdrop-grayscale",
@@ -1483,6 +1518,7 @@ function transformImpl(szProp, prefix, mangleMap) {
1483
1518
  if (value === false || value === null || value === void 0) {
1484
1519
  continue;
1485
1520
  }
1521
+ warnAlignmentValue(rawKey, value);
1486
1522
  if (value === true) {
1487
1523
  const removed = REMOVED_BOOLEAN_SUGAR[rawKey];
1488
1524
  if (removed) {
@@ -1039,6 +1039,41 @@ const REMOVED_BOOLEAN_SUGAR = {
1039
1039
  antialiased: { key: "fontSmoothing", value: "grayscale" },
1040
1040
  subpixelAntialiased: { key: "fontSmoothing", value: "subpixel" }
1041
1041
  };
1042
+ const ALIGNMENT_KEYS = /* @__PURE__ */ new Set([
1043
+ "justify",
1044
+ "items",
1045
+ "self",
1046
+ "alignContent",
1047
+ "placeItems",
1048
+ "placeContent",
1049
+ "justifyItems",
1050
+ "justifySelf"
1051
+ ]);
1052
+ const ALIGNMENT_CSS_VALUE_HINT = {
1053
+ "flex-start": "start",
1054
+ "flex-end": "end",
1055
+ "space-between": "between",
1056
+ "space-around": "around",
1057
+ "space-evenly": "evenly"
1058
+ };
1059
+ const warnedAlignmentValues = /* @__PURE__ */ new Set();
1060
+ function warnAlignmentValue(rawKey, value) {
1061
+ if (process.env.NODE_ENV === "production" || typeof value !== "string") {
1062
+ return;
1063
+ }
1064
+ const hint = ALIGNMENT_CSS_VALUE_HINT[value];
1065
+ if (!hint || !ALIGNMENT_KEYS.has(rawKey)) {
1066
+ return;
1067
+ }
1068
+ const sig = `${rawKey}:${value}`;
1069
+ if (warnedAlignmentValues.has(sig)) {
1070
+ return;
1071
+ }
1072
+ warnedAlignmentValues.add(sig);
1073
+ console.warn(
1074
+ `[csszyx] ${rawKey}: '${value}' is a CSS value \u2014 use the short form '${hint}' (e.g. { ${rawKey}: '${hint}' }). '${rawKey}-${value}' has no Tailwind utility and renders nothing.`
1075
+ );
1076
+ }
1042
1077
  const BOOLEAN_TO_CLASS = {
1043
1078
  backdropBlur: "backdrop-blur",
1044
1079
  backdropGrayscale: "backdrop-grayscale",
@@ -1481,6 +1516,7 @@ function transformImpl(szProp, prefix, mangleMap) {
1481
1516
  if (value === false || value === null || value === void 0) {
1482
1517
  continue;
1483
1518
  }
1519
+ warnAlignmentValue(rawKey, value);
1484
1520
  if (value === true) {
1485
1521
  const removed = REMOVED_BOOLEAN_SUGAR[rawKey];
1486
1522
  if (removed) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const transformCore = require('./shared/compiler.DmlsP739.cjs');
3
+ const transformCore = require('./shared/compiler.BCOOXYBh.cjs');
4
4
 
5
5
 
6
6
 
@@ -1 +1 @@
1
- export { B as BOOLEAN_SHORTHANDS, K as KNOWN_VARIANTS, M as MAX_SZ_DEPTH, P as PROPERTY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS, e as SUGGESTION_MAP, f as SzDepthError, V as VARIANT_MAP, b as getVariantPrefix, h as isForbiddenSzKey, i as isValidSzProp, j as normalizeArbitraryValue, k as normalizeArbitraryVariant, n as normalizeClassName, t as transform } from './shared/compiler.BUCRKtMU.mjs';
1
+ export { B as BOOLEAN_SHORTHANDS, K as KNOWN_VARIANTS, M as MAX_SZ_DEPTH, P as PROPERTY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS, e as SUGGESTION_MAP, f as SzDepthError, V as VARIANT_MAP, b as getVariantPrefix, h as isForbiddenSzKey, i as isValidSzProp, j as normalizeArbitraryValue, k as normalizeArbitraryVariant, n as normalizeClassName, t as transform } from './shared/compiler.DGInsDP8.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/compiler",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "Core compiler and transformation logic for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -65,7 +65,7 @@
65
65
  "@babel/types": "^7.23.6",
66
66
  "magic-string": "0.30.21",
67
67
  "oxc-parser": "0.131.0",
68
- "@csszyx/core": "0.10.3"
68
+ "@csszyx/core": "0.10.4"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/babel__core": "^7.20.5",