@csszyx/compiler 0.3.0 → 0.4.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.
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/color-var.cjs +38 -0
- package/dist/color-var.d.cts +18 -0
- package/dist/color-var.d.ts +18 -0
- package/dist/color-var.js +15 -0
- package/dist/index.cjs +737 -114
- package/dist/index.d.cts +110 -26
- package/dist/index.d.ts +110 -26
- package/dist/index.js +736 -120
- package/package.json +14 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
__require
|
|
10
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/color-var.ts
|
|
21
|
+
var color_var_exports = {};
|
|
22
|
+
__export(color_var_exports, {
|
|
23
|
+
__szColorVar: () => __szColorVar
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(color_var_exports);
|
|
26
|
+
function __szColorVar(v) {
|
|
27
|
+
if (v.startsWith("#") || v.startsWith("rgb") || v.startsWith("hsl") || v.startsWith("oklch")) {
|
|
28
|
+
return v;
|
|
29
|
+
}
|
|
30
|
+
if (v.startsWith("--")) {
|
|
31
|
+
return `var(${v})`;
|
|
32
|
+
}
|
|
33
|
+
return `var(--color-${v})`;
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
__szColorVar
|
|
38
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical implementation of __szColorVar.
|
|
3
|
+
*
|
|
4
|
+
* This is the SINGLE SOURCE OF TRUTH for color variable resolution in csszyx.
|
|
5
|
+
* The compiler emits calls to __szColorVar() for dynamic COLOR-category props.
|
|
6
|
+
* The runtime/lite inlines this implementation at build time (zero runtime dep).
|
|
7
|
+
*
|
|
8
|
+
* Resolution rules (Tailwind v4 conventions):
|
|
9
|
+
* - Raw CSS values (#hex, rgb, hsl, oklch) → pass through unchanged
|
|
10
|
+
* - CSS custom properties (--*) → wrapped in var()
|
|
11
|
+
* - Tailwind color names (blue-500, etc.) → var(--color-<name>)
|
|
12
|
+
*
|
|
13
|
+
* @param v - Color value: Tailwind name, hex, rgb/hsl/oklch, or CSS variable
|
|
14
|
+
* @returns CSS-compatible color string
|
|
15
|
+
*/
|
|
16
|
+
declare function __szColorVar(v: string): string;
|
|
17
|
+
|
|
18
|
+
export { __szColorVar };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical implementation of __szColorVar.
|
|
3
|
+
*
|
|
4
|
+
* This is the SINGLE SOURCE OF TRUTH for color variable resolution in csszyx.
|
|
5
|
+
* The compiler emits calls to __szColorVar() for dynamic COLOR-category props.
|
|
6
|
+
* The runtime/lite inlines this implementation at build time (zero runtime dep).
|
|
7
|
+
*
|
|
8
|
+
* Resolution rules (Tailwind v4 conventions):
|
|
9
|
+
* - Raw CSS values (#hex, rgb, hsl, oklch) → pass through unchanged
|
|
10
|
+
* - CSS custom properties (--*) → wrapped in var()
|
|
11
|
+
* - Tailwind color names (blue-500, etc.) → var(--color-<name>)
|
|
12
|
+
*
|
|
13
|
+
* @param v - Color value: Tailwind name, hex, rgb/hsl/oklch, or CSS variable
|
|
14
|
+
* @returns CSS-compatible color string
|
|
15
|
+
*/
|
|
16
|
+
declare function __szColorVar(v: string): string;
|
|
17
|
+
|
|
18
|
+
export { __szColorVar };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./chunk-3RG5ZIWI.js";
|
|
2
|
+
|
|
3
|
+
// src/color-var.ts
|
|
4
|
+
function __szColorVar(v) {
|
|
5
|
+
if (v.startsWith("#") || v.startsWith("rgb") || v.startsWith("hsl") || v.startsWith("oklch")) {
|
|
6
|
+
return v;
|
|
7
|
+
}
|
|
8
|
+
if (v.startsWith("--")) {
|
|
9
|
+
return `var(${v})`;
|
|
10
|
+
}
|
|
11
|
+
return `var(--color-${v})`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
__szColorVar
|
|
15
|
+
};
|