rafters 0.0.42 → 0.0.45
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.js +40 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53876,6 +53876,9 @@ Color.extend(interpolation);
|
|
|
53876
53876
|
Color.extend(contrastMethods);
|
|
53877
53877
|
|
|
53878
53878
|
// ../color-utils/src/conversion.ts
|
|
53879
|
+
function oklchToCSS(oklch2) {
|
|
53880
|
+
return `oklch(${oklch2.l} ${oklch2.c} ${oklch2.h})`;
|
|
53881
|
+
}
|
|
53879
53882
|
function hexToOKLCH(hex3) {
|
|
53880
53883
|
try {
|
|
53881
53884
|
const color = new Color(hex3);
|
|
@@ -62627,6 +62630,43 @@ var RaftersToolHandler = class _RaftersToolHandler {
|
|
|
62627
62630
|
enriched = true;
|
|
62628
62631
|
}
|
|
62629
62632
|
}
|
|
62633
|
+
const SCALE_POSITIONS2 = [
|
|
62634
|
+
"50",
|
|
62635
|
+
"100",
|
|
62636
|
+
"200",
|
|
62637
|
+
"300",
|
|
62638
|
+
"400",
|
|
62639
|
+
"500",
|
|
62640
|
+
"600",
|
|
62641
|
+
"700",
|
|
62642
|
+
"800",
|
|
62643
|
+
"900",
|
|
62644
|
+
"950"
|
|
62645
|
+
];
|
|
62646
|
+
if (enriched && tokenValue && typeof tokenValue === "object" && "scale" in tokenValue) {
|
|
62647
|
+
const cv = tokenValue;
|
|
62648
|
+
for (let i = 0; i < cv.scale.length && i < SCALE_POSITIONS2.length; i++) {
|
|
62649
|
+
const pos = SCALE_POSITIONS2[i];
|
|
62650
|
+
const oklchValue = cv.scale[i];
|
|
62651
|
+
if (!oklchValue) continue;
|
|
62652
|
+
const posName = `${target}-${pos}`;
|
|
62653
|
+
const cssValue = oklchToCSS(oklchValue);
|
|
62654
|
+
const posToken = {
|
|
62655
|
+
name: posName,
|
|
62656
|
+
value: cssValue,
|
|
62657
|
+
category: "color",
|
|
62658
|
+
namespace: "color",
|
|
62659
|
+
scalePosition: i,
|
|
62660
|
+
description: `${target} color at ${pos} position`,
|
|
62661
|
+
containerQueryAware: true
|
|
62662
|
+
};
|
|
62663
|
+
if (registry2.has(posName)) {
|
|
62664
|
+
await registry2.set(posName, cssValue);
|
|
62665
|
+
} else {
|
|
62666
|
+
registry2.add(posToken);
|
|
62667
|
+
}
|
|
62668
|
+
}
|
|
62669
|
+
}
|
|
62630
62670
|
const exists = registry2.has(target);
|
|
62631
62671
|
if (exists) {
|
|
62632
62672
|
const existing = registry2.get(target);
|