@csszyx/runtime 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
@@ -1336,7 +1336,35 @@ function decodeToken(token) {
1336
1336
  }
1337
1337
  return token;
1338
1338
  }
1339
- function conflictKey(token) {
1339
+ const SHORTHAND_COVERAGE = {
1340
+ p: ["p", "px", "py", "pt", "pr", "pb", "pl", "ps", "pe"],
1341
+ px: ["px", "pl", "pr", "ps", "pe"],
1342
+ py: ["py", "pt", "pb"],
1343
+ m: ["m", "mx", "my", "mt", "mr", "mb", "ml", "ms", "me"],
1344
+ mx: ["mx", "ml", "mr", "ms", "me"],
1345
+ my: ["my", "mt", "mb"],
1346
+ // inset (position) — physical sides only.
1347
+ inset: ["inset", "inset-x", "inset-y", "top", "right", "bottom", "left"],
1348
+ "inset-x": ["inset-x", "left", "right"],
1349
+ "inset-y": ["inset-y", "top", "bottom"],
1350
+ // border-radius — physical corners only (logical rounded-s*/e* stay keep-both).
1351
+ rounded: [
1352
+ "rounded",
1353
+ "rounded-t",
1354
+ "rounded-r",
1355
+ "rounded-b",
1356
+ "rounded-l",
1357
+ "rounded-tl",
1358
+ "rounded-tr",
1359
+ "rounded-br",
1360
+ "rounded-bl"
1361
+ ],
1362
+ "rounded-t": ["rounded-t", "rounded-tl", "rounded-tr"],
1363
+ "rounded-r": ["rounded-r", "rounded-tr", "rounded-br"],
1364
+ "rounded-b": ["rounded-b", "rounded-bl", "rounded-br"],
1365
+ "rounded-l": ["rounded-l", "rounded-tl", "rounded-bl"]
1366
+ };
1367
+ function mergeClassify(token) {
1340
1368
  const base = stripVariant(token);
1341
1369
  const variant = token.slice(0, token.length - base.length);
1342
1370
  const norm = normalizeBase(base);
@@ -1351,7 +1379,11 @@ function conflictKey(token) {
1351
1379
  if (AMBIGUOUS_PREFIXES.has(prefix)) {
1352
1380
  return null;
1353
1381
  }
1354
- return `${variant}\0${prefix}`;
1382
+ const coveredPrefixes = SHORTHAND_COVERAGE[prefix] ?? [prefix];
1383
+ return {
1384
+ key: `${variant} ${prefix}`,
1385
+ covers: coveredPrefixes.map((p) => `${variant} ${p}`)
1386
+ };
1355
1387
  }
1356
1388
  }
1357
1389
  return null;
@@ -1368,11 +1400,14 @@ function szcn(...inputs) {
1368
1400
  continue;
1369
1401
  }
1370
1402
  const original = decodeToken(token);
1371
- const key = conflictKey(original) ?? `${original}`;
1372
- if (byKey.has(key)) {
1373
- const at = order.indexOf(key);
1374
- if (at !== -1) {
1375
- order.splice(at, 1);
1403
+ const info = mergeClassify(original);
1404
+ const key = info ? info.key : original;
1405
+ for (const covered of info ? info.covers : [key]) {
1406
+ if (byKey.delete(covered)) {
1407
+ const at = order.indexOf(covered);
1408
+ if (at !== -1) {
1409
+ order.splice(at, 1);
1410
+ }
1376
1411
  }
1377
1412
  }
1378
1413
  byKey.set(key, token);
@@ -1383,7 +1418,7 @@ function szcn(...inputs) {
1383
1418
  }
1384
1419
 
1385
1420
  const warned$1 = /* @__PURE__ */ new Set();
1386
- const RAW_SZ_WARNING = '[csszyx] A raw `sz` object reached the runtime and was dropped before it could leak to the DOM as sz="[object Object]".\nThis means the file was not compiled \u2014 its `sz` produces no CSS. If it lives in a workspace package, add that package to `compilePackages`; otherwise check that the bundler is not skipping the file.';
1421
+ const RAW_SZ_WARNING = '[csszyx] A raw `sz` object reached the runtime and was dropped before it could leak to the DOM as sz="[object Object]".\nThis means the file was not compiled \u2014 its `sz` produces no CSS. If it lives in a workspace package, add that package directory to `compileSources`; otherwise check that the bundler is not skipping the file.';
1387
1422
  function warnRawSz() {
1388
1423
  if (warned$1.has(RAW_SZ_WARNING)) return;
1389
1424
  warned$1.add(RAW_SZ_WARNING);
package/dist/index.d.cts CHANGED
@@ -782,7 +782,7 @@ declare function omitSz(sz: SzInput, selector: BoxSelector): SzObject;
782
782
  *
783
783
  * The compiler rewrites `sz` to `className` at build time, so a compiled
784
784
  * component never carries a leftover `sz` prop. But when a file is NOT compiled
785
- * — e.g. a workspace package missing from `compilePackages`, or any source the
785
+ * — e.g. a workspace package missing from `compileSources`, or any source the
786
786
  * bundler skipped — a hand-forwarded `sz` survives and React spreads it to the
787
787
  * DOM as `sz="[object Object]"`. `stripSzProps` removes `sz` from the forwarded
788
788
  * props so it never reaches the DOM, and in development warns once when the
package/dist/index.d.mts CHANGED
@@ -782,7 +782,7 @@ declare function omitSz(sz: SzInput, selector: BoxSelector): SzObject;
782
782
  *
783
783
  * The compiler rewrites `sz` to `className` at build time, so a compiled
784
784
  * component never carries a leftover `sz` prop. But when a file is NOT compiled
785
- * — e.g. a workspace package missing from `compilePackages`, or any source the
785
+ * — e.g. a workspace package missing from `compileSources`, or any source the
786
786
  * bundler skipped — a hand-forwarded `sz` survives and React spreads it to the
787
787
  * DOM as `sz="[object Object]"`. `stripSzProps` removes `sz` from the forwarded
788
788
  * props so it never reaches the DOM, and in development warns once when the
package/dist/index.mjs CHANGED
@@ -1334,7 +1334,35 @@ function decodeToken(token) {
1334
1334
  }
1335
1335
  return token;
1336
1336
  }
1337
- function conflictKey(token) {
1337
+ const SHORTHAND_COVERAGE = {
1338
+ p: ["p", "px", "py", "pt", "pr", "pb", "pl", "ps", "pe"],
1339
+ px: ["px", "pl", "pr", "ps", "pe"],
1340
+ py: ["py", "pt", "pb"],
1341
+ m: ["m", "mx", "my", "mt", "mr", "mb", "ml", "ms", "me"],
1342
+ mx: ["mx", "ml", "mr", "ms", "me"],
1343
+ my: ["my", "mt", "mb"],
1344
+ // inset (position) — physical sides only.
1345
+ inset: ["inset", "inset-x", "inset-y", "top", "right", "bottom", "left"],
1346
+ "inset-x": ["inset-x", "left", "right"],
1347
+ "inset-y": ["inset-y", "top", "bottom"],
1348
+ // border-radius — physical corners only (logical rounded-s*/e* stay keep-both).
1349
+ rounded: [
1350
+ "rounded",
1351
+ "rounded-t",
1352
+ "rounded-r",
1353
+ "rounded-b",
1354
+ "rounded-l",
1355
+ "rounded-tl",
1356
+ "rounded-tr",
1357
+ "rounded-br",
1358
+ "rounded-bl"
1359
+ ],
1360
+ "rounded-t": ["rounded-t", "rounded-tl", "rounded-tr"],
1361
+ "rounded-r": ["rounded-r", "rounded-tr", "rounded-br"],
1362
+ "rounded-b": ["rounded-b", "rounded-bl", "rounded-br"],
1363
+ "rounded-l": ["rounded-l", "rounded-tl", "rounded-bl"]
1364
+ };
1365
+ function mergeClassify(token) {
1338
1366
  const base = stripVariant(token);
1339
1367
  const variant = token.slice(0, token.length - base.length);
1340
1368
  const norm = normalizeBase(base);
@@ -1349,7 +1377,11 @@ function conflictKey(token) {
1349
1377
  if (AMBIGUOUS_PREFIXES.has(prefix)) {
1350
1378
  return null;
1351
1379
  }
1352
- return `${variant}\0${prefix}`;
1380
+ const coveredPrefixes = SHORTHAND_COVERAGE[prefix] ?? [prefix];
1381
+ return {
1382
+ key: `${variant} ${prefix}`,
1383
+ covers: coveredPrefixes.map((p) => `${variant} ${p}`)
1384
+ };
1353
1385
  }
1354
1386
  }
1355
1387
  return null;
@@ -1366,11 +1398,14 @@ function szcn(...inputs) {
1366
1398
  continue;
1367
1399
  }
1368
1400
  const original = decodeToken(token);
1369
- const key = conflictKey(original) ?? `${original}`;
1370
- if (byKey.has(key)) {
1371
- const at = order.indexOf(key);
1372
- if (at !== -1) {
1373
- order.splice(at, 1);
1401
+ const info = mergeClassify(original);
1402
+ const key = info ? info.key : original;
1403
+ for (const covered of info ? info.covers : [key]) {
1404
+ if (byKey.delete(covered)) {
1405
+ const at = order.indexOf(covered);
1406
+ if (at !== -1) {
1407
+ order.splice(at, 1);
1408
+ }
1374
1409
  }
1375
1410
  }
1376
1411
  byKey.set(key, token);
@@ -1381,7 +1416,7 @@ function szcn(...inputs) {
1381
1416
  }
1382
1417
 
1383
1418
  const warned$1 = /* @__PURE__ */ new Set();
1384
- const RAW_SZ_WARNING = '[csszyx] A raw `sz` object reached the runtime and was dropped before it could leak to the DOM as sz="[object Object]".\nThis means the file was not compiled \u2014 its `sz` produces no CSS. If it lives in a workspace package, add that package to `compilePackages`; otherwise check that the bundler is not skipping the file.';
1419
+ const RAW_SZ_WARNING = '[csszyx] A raw `sz` object reached the runtime and was dropped before it could leak to the DOM as sz="[object Object]".\nThis means the file was not compiled \u2014 its `sz` produces no CSS. If it lives in a workspace package, add that package directory to `compileSources`; otherwise check that the bundler is not skipping the file.';
1385
1420
  function warnRawSz() {
1386
1421
  if (warned$1.has(RAW_SZ_WARNING)) return;
1387
1422
  warned$1.add(RAW_SZ_WARNING);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/runtime",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "Runtime helpers and hydration guards for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -49,8 +49,8 @@
49
49
  "dist"
50
50
  ],
51
51
  "dependencies": {
52
- "@csszyx/compiler": "0.10.3",
53
- "@csszyx/core": "0.10.3"
52
+ "@csszyx/compiler": "0.10.4",
53
+ "@csszyx/core": "0.10.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/node": "^20.11.0",