@thesage/ui 0.0.11 → 0.0.13
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/README.md +92 -24
- package/dist/index.d.mts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +91 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +91 -51
- package/dist/index.mjs.map +1 -1
- package/dist/providers.js +44 -0
- package/dist/providers.js.map +1 -1
- package/dist/providers.mjs +44 -0
- package/dist/providers.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -25,6 +25,8 @@ var buttonVariants = cva(
|
|
|
25
25
|
variants: {
|
|
26
26
|
variant: {
|
|
27
27
|
default: "bg-primary text-primary-foreground shadow",
|
|
28
|
+
primary: "bg-primary text-primary-foreground shadow",
|
|
29
|
+
// Alias for default
|
|
28
30
|
destructive: "bg-destructive text-destructive-foreground shadow-sm",
|
|
29
31
|
outline: "border border-input bg-transparent shadow-sm hover:bg-primary hover:text-primary-foreground hover:border-primary",
|
|
30
32
|
secondary: "bg-black/5 dark:bg-white/10 backdrop-blur-md border border-black/5 dark:border-white/10 text-secondary-foreground shadow-sm hover:bg-primary hover:text-primary-foreground dark:hover:bg-primary dark:hover:text-primary-foreground",
|
|
@@ -9556,13 +9558,30 @@ var AnimatedBeam = ({
|
|
|
9556
9558
|
import { Mesh as Mesh3, Program as Program3, Renderer as Renderer3, Triangle as Triangle3, Vec3 } from "ogl";
|
|
9557
9559
|
import { useEffect as useEffect12, useRef as useRef5 } from "react";
|
|
9558
9560
|
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
9561
|
+
function hexToRgb4(hex) {
|
|
9562
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
9563
|
+
if (!result) return [0, 0, 0];
|
|
9564
|
+
return [
|
|
9565
|
+
parseInt(result[1], 16) / 255,
|
|
9566
|
+
parseInt(result[2], 16) / 255,
|
|
9567
|
+
parseInt(result[3], 16) / 255
|
|
9568
|
+
];
|
|
9569
|
+
}
|
|
9570
|
+
function getCSSVariable2(name, fallback) {
|
|
9571
|
+
if (typeof window === "undefined") return fallback;
|
|
9572
|
+
const value = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
9573
|
+
return value || fallback;
|
|
9574
|
+
}
|
|
9559
9575
|
function OrbBackground({
|
|
9560
9576
|
className,
|
|
9561
9577
|
hue = 0,
|
|
9562
9578
|
hoverIntensity = 0.2,
|
|
9563
9579
|
rotateOnHover = true,
|
|
9564
9580
|
forceHoverState = false,
|
|
9565
|
-
backgroundColor
|
|
9581
|
+
backgroundColor,
|
|
9582
|
+
orbColor1,
|
|
9583
|
+
orbColor2,
|
|
9584
|
+
orbColor3
|
|
9566
9585
|
}) {
|
|
9567
9586
|
const ctnDom = useRef5(null);
|
|
9568
9587
|
const vert = (
|
|
@@ -9590,6 +9609,10 @@ function OrbBackground({
|
|
|
9590
9609
|
uniform float rot;
|
|
9591
9610
|
uniform float hoverIntensity;
|
|
9592
9611
|
uniform vec3 backgroundColor;
|
|
9612
|
+
// THEME-AWARE: Orb colors from theme (to revert: change back to const)
|
|
9613
|
+
uniform vec3 orbColor1;
|
|
9614
|
+
uniform vec3 orbColor2;
|
|
9615
|
+
uniform vec3 orbColor3;
|
|
9593
9616
|
varying vec2 vUv;
|
|
9594
9617
|
|
|
9595
9618
|
vec3 rgb2yiq(vec3 c) {
|
|
@@ -9658,10 +9681,12 @@ function OrbBackground({
|
|
|
9658
9681
|
float a = max(max(colorIn.r, colorIn.g), colorIn.b);
|
|
9659
9682
|
return vec4(colorIn.rgb / (a + 1e-5), a);
|
|
9660
9683
|
}
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
const vec3
|
|
9684
|
+
|
|
9685
|
+
// THEME-AWARE: Colors now come from uniforms (orbColor1, orbColor2, orbColor3)
|
|
9686
|
+
// To revert to hardcoded: uncomment these and remove uniforms above
|
|
9687
|
+
// const vec3 baseColor1 = vec3(0.611765, 0.262745, 0.996078);
|
|
9688
|
+
// const vec3 baseColor2 = vec3(0.298039, 0.760784, 0.913725);
|
|
9689
|
+
// const vec3 baseColor3 = vec3(0.062745, 0.078431, 0.600000);
|
|
9665
9690
|
const float innerRadius = 0.6;
|
|
9666
9691
|
const float noiseScale = 0.65;
|
|
9667
9692
|
|
|
@@ -9674,9 +9699,10 @@ function OrbBackground({
|
|
|
9674
9699
|
}
|
|
9675
9700
|
|
|
9676
9701
|
vec4 draw(vec2 uv) {
|
|
9677
|
-
|
|
9678
|
-
vec3
|
|
9679
|
-
vec3
|
|
9702
|
+
// THEME-AWARE: Use uniform colors instead of hardcoded consts
|
|
9703
|
+
vec3 color1 = adjustHue(orbColor1, hue);
|
|
9704
|
+
vec3 color2 = adjustHue(orbColor2, hue);
|
|
9705
|
+
vec3 color3 = adjustHue(orbColor3, hue);
|
|
9680
9706
|
|
|
9681
9707
|
float ang = atan(uv.y, uv.x);
|
|
9682
9708
|
float len = length(uv);
|
|
@@ -9745,6 +9771,14 @@ function OrbBackground({
|
|
|
9745
9771
|
useEffect12(() => {
|
|
9746
9772
|
const container = ctnDom.current;
|
|
9747
9773
|
if (!container) return;
|
|
9774
|
+
const bgColor = backgroundColor || getCSSVariable2("--color-background", "#000000");
|
|
9775
|
+
const color1 = orbColor1 || "#9c43fe";
|
|
9776
|
+
const color2 = orbColor2 || "#4cc2e9";
|
|
9777
|
+
const color3 = orbColor3 || "#101499";
|
|
9778
|
+
const bgRgb = hexToRgb4(bgColor);
|
|
9779
|
+
const color1Rgb = hexToRgb4(color1);
|
|
9780
|
+
const color2Rgb = hexToRgb4(color2);
|
|
9781
|
+
const color3Rgb = hexToRgb4(color3);
|
|
9748
9782
|
const renderer = new Renderer3({ alpha: true, premultipliedAlpha: false });
|
|
9749
9783
|
const gl = renderer.gl;
|
|
9750
9784
|
gl.clearColor(0, 0, 0, 0);
|
|
@@ -9762,7 +9796,11 @@ function OrbBackground({
|
|
|
9762
9796
|
hover: { value: 0 },
|
|
9763
9797
|
rot: { value: 0 },
|
|
9764
9798
|
hoverIntensity: { value: hoverIntensity },
|
|
9765
|
-
|
|
9799
|
+
// THEME-AWARE: Pass theme colors to shader
|
|
9800
|
+
backgroundColor: { value: new Vec3(...bgRgb) },
|
|
9801
|
+
orbColor1: { value: new Vec3(...color1Rgb) },
|
|
9802
|
+
orbColor2: { value: new Vec3(...color2Rgb) },
|
|
9803
|
+
orbColor3: { value: new Vec3(...color3Rgb) }
|
|
9766
9804
|
}
|
|
9767
9805
|
});
|
|
9768
9806
|
const mesh = new Mesh3(gl, { geometry, program });
|
|
@@ -9819,7 +9857,6 @@ function OrbBackground({
|
|
|
9819
9857
|
currentRot += dt * rotationSpeed;
|
|
9820
9858
|
}
|
|
9821
9859
|
program.uniforms.rot.value = currentRot;
|
|
9822
|
-
program.uniforms.backgroundColor.value = hexToVec3(backgroundColor);
|
|
9823
9860
|
renderer.render({ scene: mesh });
|
|
9824
9861
|
};
|
|
9825
9862
|
rafId = requestAnimationFrame(update);
|
|
@@ -9836,47 +9873,6 @@ function OrbBackground({
|
|
|
9836
9873
|
}, [hue, hoverIntensity, rotateOnHover, forceHoverState, backgroundColor]);
|
|
9837
9874
|
return /* @__PURE__ */ jsx85("div", { ref: ctnDom, className: cn("w-full h-full pointer-events-auto", className) });
|
|
9838
9875
|
}
|
|
9839
|
-
function hslToRgb(h, s, l) {
|
|
9840
|
-
let r, g, b;
|
|
9841
|
-
if (s === 0) {
|
|
9842
|
-
r = g = b = l;
|
|
9843
|
-
} else {
|
|
9844
|
-
const hue2rgb = (p2, q2, t) => {
|
|
9845
|
-
if (t < 0) t += 1;
|
|
9846
|
-
if (t > 1) t -= 1;
|
|
9847
|
-
if (t < 1 / 6) return p2 + (q2 - p2) * 6 * t;
|
|
9848
|
-
if (t < 1 / 2) return q2;
|
|
9849
|
-
if (t < 2 / 3) return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
9850
|
-
return p2;
|
|
9851
|
-
};
|
|
9852
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
9853
|
-
const p = 2 * l - q;
|
|
9854
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
9855
|
-
g = hue2rgb(p, q, h);
|
|
9856
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
9857
|
-
}
|
|
9858
|
-
return new Vec3(r, g, b);
|
|
9859
|
-
}
|
|
9860
|
-
function hexToVec3(color) {
|
|
9861
|
-
if (color.startsWith("#")) {
|
|
9862
|
-
const r = parseInt(color.slice(1, 3), 16) / 255;
|
|
9863
|
-
const g = parseInt(color.slice(3, 5), 16) / 255;
|
|
9864
|
-
const b = parseInt(color.slice(5, 7), 16) / 255;
|
|
9865
|
-
return new Vec3(r, g, b);
|
|
9866
|
-
}
|
|
9867
|
-
const rgbMatch = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
9868
|
-
if (rgbMatch) {
|
|
9869
|
-
return new Vec3(parseInt(rgbMatch[1]) / 255, parseInt(rgbMatch[2]) / 255, parseInt(rgbMatch[3]) / 255);
|
|
9870
|
-
}
|
|
9871
|
-
const hslMatch = color.match(/hsla?\((\d+),\s*(\d+)%,\s*(\d+)%/);
|
|
9872
|
-
if (hslMatch) {
|
|
9873
|
-
const h = parseInt(hslMatch[1]) / 360;
|
|
9874
|
-
const s = parseInt(hslMatch[2]) / 100;
|
|
9875
|
-
const l = parseInt(hslMatch[3]) / 100;
|
|
9876
|
-
return hslToRgb(h, s, l);
|
|
9877
|
-
}
|
|
9878
|
-
return new Vec3(0, 0, 0);
|
|
9879
|
-
}
|
|
9880
9876
|
|
|
9881
9877
|
// src/components/blocks/Hero.tsx
|
|
9882
9878
|
import { ArrowRight as ArrowRight2 } from "lucide-react";
|
|
@@ -11355,6 +11351,49 @@ function mergeCustomColorTokens(baseTokens2, customPalette) {
|
|
|
11355
11351
|
...customPalette.derivedTokens
|
|
11356
11352
|
};
|
|
11357
11353
|
}
|
|
11354
|
+
function validateThemeTokens(theme, mode) {
|
|
11355
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
|
|
11356
|
+
const root = document.documentElement;
|
|
11357
|
+
const style = getComputedStyle(root);
|
|
11358
|
+
const requiredTokens = [
|
|
11359
|
+
"--color-background",
|
|
11360
|
+
"--color-foreground",
|
|
11361
|
+
"--color-primary",
|
|
11362
|
+
"--color-primary-foreground",
|
|
11363
|
+
"--color-border",
|
|
11364
|
+
"--color-ring",
|
|
11365
|
+
"--font-heading",
|
|
11366
|
+
"--font-body",
|
|
11367
|
+
"--font-mono"
|
|
11368
|
+
];
|
|
11369
|
+
const missingTokens = [];
|
|
11370
|
+
const invalidTokens = [];
|
|
11371
|
+
requiredTokens.forEach((token) => {
|
|
11372
|
+
const value = style.getPropertyValue(token).trim();
|
|
11373
|
+
if (!value) {
|
|
11374
|
+
missingTokens.push(token);
|
|
11375
|
+
} else if (token.startsWith("--color-") && !value.match(/^(#|rgb|hsl|var\()/)) {
|
|
11376
|
+
invalidTokens.push(`${token} = "${value}"`);
|
|
11377
|
+
} else if (token.startsWith("--font-") && value === "") {
|
|
11378
|
+
invalidTokens.push(`${token} = empty`);
|
|
11379
|
+
}
|
|
11380
|
+
});
|
|
11381
|
+
if (missingTokens.length > 0) {
|
|
11382
|
+
console.warn(
|
|
11383
|
+
`[ThemeProvider] Missing CSS variables for theme "${theme}" (${mode} mode):`,
|
|
11384
|
+
missingTokens
|
|
11385
|
+
);
|
|
11386
|
+
}
|
|
11387
|
+
if (invalidTokens.length > 0) {
|
|
11388
|
+
console.warn(
|
|
11389
|
+
`[ThemeProvider] Invalid CSS variable values for theme "${theme}" (${mode} mode):`,
|
|
11390
|
+
invalidTokens
|
|
11391
|
+
);
|
|
11392
|
+
}
|
|
11393
|
+
if (missingTokens.length === 0 && invalidTokens.length === 0) {
|
|
11394
|
+
console.log(`[ThemeProvider] \u2713 Theme validation passed for "${theme}" (${mode} mode)`);
|
|
11395
|
+
}
|
|
11396
|
+
}
|
|
11358
11397
|
function ThemeProvider({ children }) {
|
|
11359
11398
|
const { theme, mode } = useThemeStore();
|
|
11360
11399
|
const customPalette = useCustomizer((state) => state.customColors?.[theme]?.[mode]);
|
|
@@ -11388,6 +11427,7 @@ function ThemeProvider({ children }) {
|
|
|
11388
11427
|
} else {
|
|
11389
11428
|
root.classList.remove("dark");
|
|
11390
11429
|
}
|
|
11430
|
+
validateThemeTokens(theme, mode);
|
|
11391
11431
|
const timeout = setTimeout(() => {
|
|
11392
11432
|
root.classList.remove("theme-transitioning");
|
|
11393
11433
|
setIsTransitioning(false);
|