nuxt-ui-elements 0.1.8 → 0.1.10

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.
Files changed (28) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +5 -13
  3. package/dist/runtime/components/DialogConfirm.d.vue.ts +25 -0
  4. package/dist/runtime/components/DialogConfirm.vue +119 -0
  5. package/dist/runtime/components/DialogConfirm.vue.d.ts +25 -0
  6. package/dist/runtime/composables/useDialog.d.ts +12 -0
  7. package/dist/runtime/composables/useDialog.js +51 -0
  8. package/package.json +1 -1
  9. package/dist/runtime/components/backgrounds/BackgroundAurora.d.vue.ts +0 -137
  10. package/dist/runtime/components/backgrounds/BackgroundAurora.vue +0 -145
  11. package/dist/runtime/components/backgrounds/BackgroundAurora.vue.d.ts +0 -137
  12. package/dist/runtime/components/backgrounds/BackgroundFlickeringGrid.d.vue.ts +0 -120
  13. package/dist/runtime/components/backgrounds/BackgroundFlickeringGrid.vue +0 -246
  14. package/dist/runtime/components/backgrounds/BackgroundFlickeringGrid.vue.d.ts +0 -120
  15. package/dist/runtime/composables/useColorResolver.d.ts +0 -40
  16. package/dist/runtime/composables/useColorResolver.js +0 -68
  17. package/dist/runtime/composables/useGradient.d.ts +0 -23
  18. package/dist/runtime/composables/useGradient.js +0 -37
  19. package/dist/runtime/composables/useThemeColors.d.ts +0 -69
  20. package/dist/runtime/composables/useThemeColors.js +0 -94
  21. package/dist/runtime/plugin.d.ts +0 -2
  22. package/dist/runtime/plugin.js +0 -4
  23. package/dist/runtime/themes/background-flickering-grid.d.ts +0 -7
  24. package/dist/runtime/themes/background-flickering-grid.js +0 -6
  25. package/dist/runtime/types/tv.d.ts +0 -14
  26. package/dist/runtime/types/tv.js +0 -0
  27. package/dist/runtime/utils/tv.d.ts +0 -1
  28. package/dist/runtime/utils/tv.js +0 -2
@@ -1,68 +0,0 @@
1
- import { parse } from "culori";
2
- import { getThemeColor } from "./useThemeColors.js";
3
- import colors from "tailwindcss/colors";
4
- const SEMANTIC_COLORS = [
5
- "primary",
6
- "secondary",
7
- "success",
8
- "info",
9
- "warning",
10
- "error",
11
- "neutral"
12
- ];
13
- function getTailwindDefaultColor(colorName, shade) {
14
- const colorObj = colors[colorName];
15
- if (colorObj && typeof colorObj === "object" && !Array.isArray(colorObj)) {
16
- return colorObj[shade.toString()] || null;
17
- }
18
- return null;
19
- }
20
- function isSemanticColor(color) {
21
- return SEMANTIC_COLORS.includes(color);
22
- }
23
- function isDirectColor(color) {
24
- return color.startsWith("#") || color.startsWith("rgb") || color.startsWith("hsl") || color.startsWith("oklch") || color.startsWith("lab") || color.startsWith("lch");
25
- }
26
- export function resolveColor(colorInput, fallback = "neutral") {
27
- if (!colorInput || colorInput.trim() === "") {
28
- return getThemeColor(fallback, 500);
29
- }
30
- const color = colorInput.trim();
31
- if (isDirectColor(color)) {
32
- const parsed = parse(color);
33
- if (parsed) {
34
- return color;
35
- }
36
- console.warn(`[resolveColor] Invalid color format: "${color}"`);
37
- }
38
- if (isSemanticColor(color)) {
39
- return getThemeColor(color, 500);
40
- }
41
- const tailwindColorMatch = color.match(/^([a-z]+)-(\d{2,3})$/);
42
- if (tailwindColorMatch) {
43
- const [, colorName, shade] = tailwindColorMatch;
44
- if (colorName && shade) {
45
- if (typeof document !== "undefined") {
46
- const resolvedColor = getThemeColor(colorName, parseInt(shade));
47
- if (resolvedColor !== "oklch(50% 0 0)") {
48
- return resolvedColor;
49
- }
50
- }
51
- const defaultColor = getTailwindDefaultColor(colorName, parseInt(shade));
52
- if (defaultColor) {
53
- return defaultColor;
54
- }
55
- }
56
- }
57
- console.warn(
58
- `[resolveColor] Could not resolve color: "${colorInput}". Supported formats: Nuxt UI semantic colors ('primary', 'secondary', etc.), Tailwind colors ('blue-500', 'red-600', etc.), or direct color values ('#3b82f6', 'oklch(...)', 'rgb(...)'). Falling back to "${fallback}".`
59
- );
60
- return getThemeColor(fallback, 500);
61
- }
62
- export function resolveColorAsOklch(colorInput, fallback = "neutral") {
63
- const resolved = resolveColor(colorInput, fallback);
64
- if (isSemanticColor(colorInput || "")) {
65
- return resolved;
66
- }
67
- return resolved;
68
- }
@@ -1,23 +0,0 @@
1
- export type GradientDirection = "left-right" | "right-left" | "top-bottom" | "bottom-top" | "in-out" | "out-in";
2
- /**
3
- * Calculate gradient intensity for a position based on direction
4
- * @param x - X coordinate (0-1)
5
- * @param y - Y coordinate (0-1)
6
- * @param direction - Gradient direction
7
- * @returns Intensity value (0-1)
8
- */
9
- export declare function calculateGradientIntensity(x: number, y: number, direction: GradientDirection): number;
10
- /**
11
- * Generate CSS repeating linear gradient from colors
12
- * @param colors - Array of RGB color strings
13
- * @param angle - Gradient angle in degrees
14
- * @returns CSS repeating-linear-gradient string
15
- */
16
- export declare function createRepeatingGradient(colors: string[], angle?: number): string;
17
- /**
18
- * Composable for gradient utilities
19
- */
20
- export declare function useGradient(): {
21
- calculateGradientIntensity: typeof calculateGradientIntensity;
22
- createRepeatingGradient: typeof createRepeatingGradient;
23
- };
@@ -1,37 +0,0 @@
1
- export function calculateGradientIntensity(x, y, direction) {
2
- switch (direction) {
3
- case "left-right":
4
- return x;
5
- case "right-left":
6
- return 1 - x;
7
- case "top-bottom":
8
- return y;
9
- case "bottom-top":
10
- return 1 - y;
11
- case "in-out": {
12
- const dx = x - 0.5;
13
- const dy = y - 0.5;
14
- return Math.sqrt(dx * dx + dy * dy) * Math.sqrt(2);
15
- }
16
- case "out-in": {
17
- const dx = x - 0.5;
18
- const dy = y - 0.5;
19
- return 1 - Math.sqrt(dx * dx + dy * dy) * Math.sqrt(2);
20
- }
21
- default:
22
- return 0;
23
- }
24
- }
25
- export function createRepeatingGradient(colors, angle = 100) {
26
- const stops = colors.map((color, i) => {
27
- const position = 10 + i * 5;
28
- return `${color} ${position}%`;
29
- }).join(",");
30
- return `repeating-linear-gradient(${angle}deg,${stops})`;
31
- }
32
- export function useGradient() {
33
- return {
34
- calculateGradientIntensity,
35
- createRepeatingGradient
36
- };
37
- }
@@ -1,69 +0,0 @@
1
- /**
2
- * Parse OKLCH string to extract L, C, H components
3
- * @deprecated Use culori.parse instead
4
- */
5
- export declare function parseOklch(oklchStr: string): {
6
- l: number;
7
- c: number;
8
- h: number;
9
- } | null;
10
- /**
11
- * Create OKLCH string from L, C, H components
12
- */
13
- export declare function createOklch(l: number, c: number, h: number): string;
14
- /**
15
- * Adjust the lightness of a color while preserving chroma and hue
16
- * Accepts any valid CSS color string
17
- */
18
- export declare function adjustLightness(colorStr: string, targetLightness: number): string;
19
- /**
20
- * Darken a color by reducing its lightness
21
- * @param colorStr - Any valid CSS color string
22
- * @param amount - Amount to reduce lightness by (in percentage points, 0-100)
23
- * @returns Darkened color string
24
- */
25
- export declare function darkenColor(colorStr: string, amount?: number): string;
26
- /**
27
- * Adjust the chroma (saturation) of a color while preserving lightness and hue
28
- */
29
- export declare function adjustChroma(colorStr: string, targetChroma: number): string;
30
- /**
31
- * Adjust the hue of a color while preserving lightness and chroma
32
- */
33
- export declare function adjustHue(colorStr: string, targetHue: number): string;
34
- /**
35
- * Adjust all components of a color
36
- */
37
- export declare function adjustOklch(colorStr: string, adjustments: {
38
- l?: number;
39
- c?: number;
40
- h?: number;
41
- }): string;
42
- /**
43
- * Convert color to RGB string for canvas rendering
44
- */
45
- export declare function oklchToRgb(colorString: string): string;
46
- /**
47
- * Get the base color from Nuxt UI theme for a given color name and shade
48
- * @param colorName - The semantic color name (e.g., 'primary', 'error', 'success')
49
- * @param shade - The color shade (50-950), defaults to 500
50
- */
51
- export declare function getThemeColor(colorName: string, shade?: number): string;
52
- /**
53
- * Get multiple shades of a color by adjusting lightness
54
- * Useful for creating gradients or multi-tone effects
55
- */
56
- export declare function getColorShades(colorName: string, lightnessValues: number[]): string[];
57
- /**
58
- * Get multiple shades and convert to RGB
59
- */
60
- export declare function getColorShadesRgb(colorName: string, lightnessValues: number[]): string[];
61
- /**
62
- * Create a color palette with custom adjustments
63
- * Returns RGB strings ready for canvas use
64
- */
65
- export declare function createColorPalette(colorName: string, adjustments: Array<{
66
- l?: number;
67
- c?: number;
68
- h?: number;
69
- }>): string[];
@@ -1,94 +0,0 @@
1
- import { converter, parse, formatCss } from "culori";
2
- const toOklch = converter("oklch");
3
- const toRgb = converter("rgb");
4
- export function parseOklch(oklchStr) {
5
- const parsed = parse(oklchStr);
6
- if (!parsed) return null;
7
- const oklch = toOklch(parsed);
8
- if (!oklch) return null;
9
- return {
10
- l: (oklch.l ?? 0) * 100,
11
- // Convert 0-1 to 0-100%
12
- c: oklch.c ?? 0,
13
- h: oklch.h ?? 0
14
- };
15
- }
16
- export function createOklch(l, c, h) {
17
- return formatCss({ mode: "oklch", l: l / 100, c, h });
18
- }
19
- export function adjustLightness(colorStr, targetLightness) {
20
- const parsed = parse(colorStr);
21
- if (!parsed) return colorStr;
22
- const oklch = toOklch(parsed);
23
- if (!oklch) return colorStr;
24
- oklch.l = targetLightness / 100;
25
- return formatCss(oklch);
26
- }
27
- export function darkenColor(colorStr, amount = 10) {
28
- const parsed = parse(colorStr);
29
- if (!parsed) return colorStr;
30
- const oklch = toOklch(parsed);
31
- if (!oklch || oklch.l === void 0) return colorStr;
32
- const currentLightness = oklch.l * 100;
33
- const newLightness = Math.max(0, currentLightness - amount);
34
- oklch.l = newLightness / 100;
35
- return formatCss(oklch);
36
- }
37
- export function adjustChroma(colorStr, targetChroma) {
38
- const parsed = parse(colorStr);
39
- if (!parsed) return colorStr;
40
- const oklch = toOklch(parsed);
41
- if (!oklch) return colorStr;
42
- oklch.c = targetChroma;
43
- return formatCss(oklch);
44
- }
45
- export function adjustHue(colorStr, targetHue) {
46
- const parsed = parse(colorStr);
47
- if (!parsed) return colorStr;
48
- const oklch = toOklch(parsed);
49
- if (!oklch) return colorStr;
50
- oklch.h = targetHue;
51
- return formatCss(oklch);
52
- }
53
- export function adjustOklch(colorStr, adjustments) {
54
- const parsed = parse(colorStr);
55
- if (!parsed) return colorStr;
56
- const oklch = toOklch(parsed);
57
- if (!oklch) return colorStr;
58
- if (adjustments.l !== void 0) oklch.l = adjustments.l / 100;
59
- if (adjustments.c !== void 0) oklch.c = adjustments.c;
60
- if (adjustments.h !== void 0) oklch.h = adjustments.h;
61
- return formatCss(oklch);
62
- }
63
- export function oklchToRgb(colorString) {
64
- const parsed = parse(colorString);
65
- if (!parsed) return "rgb(255, 255, 255)";
66
- const rgb = toRgb(parsed);
67
- if (!rgb) return "rgb(255, 255, 255)";
68
- const r = Math.max(0, Math.min(255, Math.round((rgb.r ?? 0) * 255)));
69
- const g = Math.max(0, Math.min(255, Math.round((rgb.g ?? 0) * 255)));
70
- const b = Math.max(0, Math.min(255, Math.round((rgb.b ?? 0) * 255)));
71
- const a = rgb.alpha ?? 1;
72
- return a < 1 ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`;
73
- }
74
- export function getThemeColor(colorName, shade = 500) {
75
- if (typeof document === "undefined") return "oklch(50% 0 0)";
76
- const styles = getComputedStyle(document.documentElement);
77
- const colorValue = styles.getPropertyValue(`--ui-color-${colorName}-${shade}`).trim();
78
- return colorValue || "oklch(50% 0 0)";
79
- }
80
- export function getColorShades(colorName, lightnessValues) {
81
- const baseColor = getThemeColor(colorName, 500);
82
- return lightnessValues.map((lightness) => adjustLightness(baseColor, lightness));
83
- }
84
- export function getColorShadesRgb(colorName, lightnessValues) {
85
- const shades = getColorShades(colorName, lightnessValues);
86
- return shades.map(oklchToRgb);
87
- }
88
- export function createColorPalette(colorName, adjustments) {
89
- const baseColor = getThemeColor(colorName, 500);
90
- return adjustments.map((adj) => {
91
- const adjusted = adjustOklch(baseColor, adj);
92
- return oklchToRgb(adjusted);
93
- });
94
- }
@@ -1,2 +0,0 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
- export default _default;
@@ -1,4 +0,0 @@
1
- import { defineNuxtPlugin } from "#app";
2
- export default defineNuxtPlugin((_nuxtApp) => {
3
- console.log("Plugin injected by my-module!");
4
- });
@@ -1,7 +0,0 @@
1
- declare const _default: {
2
- slots: {
3
- base: string;
4
- canvas: string;
5
- };
6
- };
7
- export default _default;
@@ -1,6 +0,0 @@
1
- export default {
2
- slots: {
3
- base: "w-full h-full absolute inset-0",
4
- canvas: "w-full h-full block pointer-events-none"
5
- }
6
- };
@@ -1,14 +0,0 @@
1
- import type { TV } from "tailwind-variants";
2
- export type ComponentConfig<T extends Record<string, any>> = {
3
- variants: T extends {
4
- variants: infer V;
5
- } ? {
6
- [K in keyof V]: V[K] extends Record<string, any> ? keyof V[K] : never;
7
- } : never;
8
- slots: T extends {
9
- slots: infer S;
10
- } ? {
11
- [K in keyof S]: any;
12
- } : never;
13
- };
14
- export type { TV };
File without changes
@@ -1 +0,0 @@
1
- export declare const tv: import("tailwind-variants").TV;
@@ -1,2 +0,0 @@
1
- import { createTV } from "tailwind-variants";
2
- export const tv = /* @__PURE__ */ createTV({});