@designbasekorea/ui-wc 0.5.5 → 0.5.6
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/chunks/lottie-e273b936.js +17032 -0
- package/dist/esm/components/animation-background/canvas-controller.js +121 -1
- package/dist/esm/components/animation-background/controls.js +180 -1
- package/dist/esm/components/animation-background/graphite-controller.js +196 -1
- package/dist/esm/components/animation-background/graphite-presets.js +42 -1
- package/dist/esm/components/animation-background/graphite-shader.js +111 -1
- package/dist/esm/components/animation-background/layers.js +369 -1
- package/dist/esm/components/animation-background/lumina-presets.js +53 -1
- package/dist/esm/components/animation-background/lumina-shaders.js +181 -1
- package/dist/esm/components/animation-background/lumina-utils.js +60 -1
- package/dist/esm/components/animation-background/particle-defaults.js +36 -1
- package/dist/esm/components/animation-background/renderers.js +167 -1
- package/dist/esm/components/animation-background/shader-controller.js +154 -1
- package/dist/esm/components/color-picker-utils.js +134 -1
- package/dist/esm/components/date-picker-utils.js +140 -1
- package/dist/esm/components/db-accordion.js +304 -1
- package/dist/esm/components/db-ad-banner.js +455 -1
- package/dist/esm/components/db-alert.js +149 -1
- package/dist/esm/components/db-animation-background.js +486 -1
- package/dist/esm/components/db-animation-text.js +601 -1
- package/dist/esm/components/db-app-badge.js +88 -1
- package/dist/esm/components/db-audio-player.js +752 -1
- package/dist/esm/components/db-avatar.js +188 -1
- package/dist/esm/components/db-backdrop.js +139 -1
- package/dist/esm/components/db-badge.js +91 -1
- package/dist/esm/components/db-banner.js +188 -1
- package/dist/esm/components/db-bottom-navigation.js +146 -1
- package/dist/esm/components/db-bottom-sheet.js +481 -1
- package/dist/esm/components/db-breadcrumbs.js +329 -1
- package/dist/esm/components/db-button.js +316 -1
- package/dist/esm/components/db-calendar.js +675 -1
- package/dist/esm/components/db-card.js +265 -1
- package/dist/esm/components/db-carousel.js +264 -1
- package/dist/esm/components/db-checkbox.js +202 -1
- package/dist/esm/components/db-chip.js +104 -1
- package/dist/esm/components/db-code-block.js +304 -1
- package/dist/esm/components/db-color-picker.js +746 -1
- package/dist/esm/components/db-confirm.js +191 -1
- package/dist/esm/components/db-container.js +39 -1
- package/dist/esm/components/db-context-menu.js +265 -1
- package/dist/esm/components/db-countdown.js +146 -1
- package/dist/esm/components/db-cursor-follower.js +173 -1
- package/dist/esm/components/db-date-picker.js +837 -1
- package/dist/esm/components/db-divider.js +66 -1
- package/dist/esm/components/db-drawer.js +245 -1
- package/dist/esm/components/db-dropdown.js +493 -1
- package/dist/esm/components/db-dropzone.js +266 -1
- package/dist/esm/components/db-empty-state.js +97 -1
- package/dist/esm/components/db-file-uploader.js +256 -1
- package/dist/esm/components/db-floating-action-button.js +139 -1
- package/dist/esm/components/db-footer.js +385 -1
- package/dist/esm/components/db-form.js +566 -1
- package/dist/esm/components/db-gantt.js +882 -1
- package/dist/esm/components/db-gradient.js +133 -1
- package/dist/esm/components/db-grid-background.js +909 -1
- package/dist/esm/components/db-grid.js +73 -1
- package/dist/esm/components/db-icons.js +82 -1
- package/dist/esm/components/db-image-list.js +214 -1
- package/dist/esm/components/db-image-placeholder.js +96 -1
- package/dist/esm/components/db-image.js +289 -1
- package/dist/esm/components/db-indicator.js +517 -1
- package/dist/esm/components/db-input.js +420 -1
- package/dist/esm/components/db-kanban.js +538 -1
- package/dist/esm/components/db-label.js +66 -1
- package/dist/esm/components/db-lightbox.js +372 -1
- package/dist/esm/components/db-list.js +340 -1
- package/dist/esm/components/db-logo-svg.js +72 -1
- package/dist/esm/components/db-logo.js +106 -1
- package/dist/esm/components/db-lottie.js +109 -1
- package/dist/esm/components/db-markdown-editor.js +458 -1
- package/dist/esm/components/db-marquee.js +402 -1
- package/dist/esm/components/db-masonry.js +94 -1
- package/dist/esm/components/db-menu-item.js +211 -1
- package/dist/esm/components/db-modal.js +522 -1
- package/dist/esm/components/db-navbar.js +680 -1
- package/dist/esm/components/db-onboarding-modal.js +322 -1
- package/dist/esm/components/db-page-header.js +312 -1
- package/dist/esm/components/db-pagination.js +271 -1
- package/dist/esm/components/db-popover.js +580 -1
- package/dist/esm/components/db-progress-step.js +166 -1
- package/dist/esm/components/db-progress.js +171 -1
- package/dist/esm/components/db-progressbar.js +72 -1
- package/dist/esm/components/db-radio.js +172 -1
- package/dist/esm/components/db-random-gradient.js +121 -1
- package/dist/esm/components/db-range-slider.js +811 -1
- package/dist/esm/components/db-rating.js +325 -1
- package/dist/esm/components/db-reorder.js +286 -1
- package/dist/esm/components/db-resizable-panels.js +282 -1
- package/dist/esm/components/db-scroll-area.js +126 -1
- package/dist/esm/components/db-search-bar.js +668 -1
- package/dist/esm/components/db-section-app-download.js +101 -1
- package/dist/esm/components/db-section-contact.js +102 -1
- package/dist/esm/components/db-section-cta.js +150 -1
- package/dist/esm/components/db-section-faq.js +120 -1
- package/dist/esm/components/db-section-feature-grid.js +137 -1
- package/dist/esm/components/db-section-feature.js +179 -1
- package/dist/esm/components/db-section-hero.js +243 -1
- package/dist/esm/components/db-section-logo-cloud.js +138 -1
- package/dist/esm/components/db-section-pricing.js +166 -1
- package/dist/esm/components/db-section-stats.js +129 -1
- package/dist/esm/components/db-section-testimonials.js +252 -1
- package/dist/esm/components/db-section.js +385 -1
- package/dist/esm/components/db-segment-control.js +231 -1
- package/dist/esm/components/db-select.js +571 -1
- package/dist/esm/components/db-share-icons.js +40 -1
- package/dist/esm/components/db-share.js +489 -1
- package/dist/esm/components/db-sidebar.js +1068 -1
- package/dist/esm/components/db-skeleton.js +94 -1
- package/dist/esm/components/db-spinner.js +102 -1
- package/dist/esm/components/db-split-view.js +297 -1
- package/dist/esm/components/db-stack.js +46 -1
- package/dist/esm/components/db-stat.js +218 -1
- package/dist/esm/components/db-stepper.js +398 -1
- package/dist/esm/components/db-table.js +412 -1
- package/dist/esm/components/db-tabs.js +335 -1
- package/dist/esm/components/db-testimonial.js +162 -1
- package/dist/esm/components/db-textarea.js +233 -1
- package/dist/esm/components/db-time-picker.js +523 -1
- package/dist/esm/components/db-timeline.js +174 -1
- package/dist/esm/components/db-toast.js +158 -1
- package/dist/esm/components/db-toggle.js +162 -1
- package/dist/esm/components/db-toolbar.js +94 -1
- package/dist/esm/components/db-tooltip.js +440 -1
- package/dist/esm/components/db-top-banner.js +121 -1
- package/dist/esm/components/db-tutorial.js +324 -1
- package/dist/esm/components/db-video-player.js +503 -1
- package/dist/esm/components/db-youtube-player.js +194 -1
- package/dist/esm/components/highlight-code.js +65 -1
- package/dist/esm/components/input-validation.js +50 -1
- package/dist/esm/components/marketing-block-host-utils.js +9 -1
- package/dist/esm/components/number-scrub.js +117 -1
- package/dist/esm/components/random-gradient-palettes.js +67 -1
- package/dist/esm/components/section-block-header-utils.js +48 -1
- package/dist/esm/helpers/confirm.js +52 -1
- package/dist/esm/helpers/toast.js +73 -1
- package/dist/esm/index.js +111 -1
- package/dist/esm/node_modules/prismjs/components/prism-bash.js +235 -1
- package/dist/esm/node_modules/prismjs/components/prism-clike.js +31 -1
- package/dist/esm/node_modules/prismjs/components/prism-css.js +64 -1
- package/dist/esm/node_modules/prismjs/components/prism-javascript.js +172 -1
- package/dist/esm/node_modules/prismjs/components/prism-json.js +27 -1
- package/dist/esm/node_modules/prismjs/components/prism-jsx.js +143 -1
- package/dist/esm/node_modules/prismjs/components/prism-markup.js +186 -1
- package/dist/esm/node_modules/prismjs/components/prism-scss.js +81 -1
- package/dist/esm/node_modules/prismjs/components/prism-tsx.js +15 -1
- package/dist/esm/node_modules/prismjs/components/prism-typescript.js +60 -1
- package/dist/index.cjs +55414 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +38284 -1
- package/dist/react/chunks/lottie-72a4c6d4.js +17032 -0
- package/dist/react/index.cjs +56503 -1
- package/dist/react/index.esm.js +39373 -1
- package/package.json +1 -1
- package/dist/chunks/lottie-2637aa0f.js +0 -1
- package/dist/react/chunks/lottie-14e7addb.js +0 -1
|
@@ -1 +1,111 @@
|
|
|
1
|
-
const
|
|
1
|
+
const GRAPHITE_VS_SOURCE = `
|
|
2
|
+
attribute vec4 aVertexPosition;
|
|
3
|
+
void main() {
|
|
4
|
+
gl_Position = aVertexPosition;
|
|
5
|
+
}
|
|
6
|
+
`;
|
|
7
|
+
const GRAPHITE_FS_SOURCE = `
|
|
8
|
+
precision highp float;
|
|
9
|
+
uniform vec2 uResolution;
|
|
10
|
+
uniform float uTime;
|
|
11
|
+
uniform float uSpeed;
|
|
12
|
+
uniform float uIntensity;
|
|
13
|
+
uniform float uGrain;
|
|
14
|
+
uniform float uScale;
|
|
15
|
+
uniform float uWarp;
|
|
16
|
+
uniform vec3 uColor1;
|
|
17
|
+
uniform vec3 uColor2;
|
|
18
|
+
uniform vec3 uColor3;
|
|
19
|
+
|
|
20
|
+
vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}
|
|
21
|
+
vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}
|
|
22
|
+
vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}
|
|
23
|
+
|
|
24
|
+
float cnoise(vec3 P){
|
|
25
|
+
vec3 Pi0 = floor(P);
|
|
26
|
+
vec3 Pi1 = Pi0 + vec3(1.0);
|
|
27
|
+
Pi0 = mod(Pi0, 289.0);
|
|
28
|
+
Pi1 = mod(Pi1, 289.0);
|
|
29
|
+
vec3 Pf0 = fract(P);
|
|
30
|
+
vec3 Pf1 = Pf0 - vec3(1.0);
|
|
31
|
+
vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
|
|
32
|
+
vec4 iy = vec4(Pi0.yy, Pi1.yy);
|
|
33
|
+
vec4 iz0 = Pi0.zzzz;
|
|
34
|
+
vec4 iz1 = Pi1.zzzz;
|
|
35
|
+
|
|
36
|
+
vec4 ixy = permute(permute(ix) + iy);
|
|
37
|
+
vec4 ixy0 = permute(ixy + iz0);
|
|
38
|
+
vec4 ixy1 = permute(ixy + iz1);
|
|
39
|
+
|
|
40
|
+
vec4 gx0 = ixy0 / 7.0;
|
|
41
|
+
vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;
|
|
42
|
+
gx0 = fract(gx0);
|
|
43
|
+
vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
|
|
44
|
+
vec4 sz0 = step(gz0, vec4(0.0));
|
|
45
|
+
gx0 -= sz0 * (step(0.0, gx0) - 0.5);
|
|
46
|
+
gy0 -= sz0 * (step(0.0, gy0) - 0.5);
|
|
47
|
+
|
|
48
|
+
vec4 gx1 = ixy1 / 7.0;
|
|
49
|
+
vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;
|
|
50
|
+
gx1 = fract(gx1);
|
|
51
|
+
vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
|
|
52
|
+
vec4 sz1 = step(gz1, vec4(0.0));
|
|
53
|
+
gx1 -= sz1 * (step(0.0, gx1) - 0.5);
|
|
54
|
+
gy1 -= sz1 * (step(0.0, gy1) - 0.5);
|
|
55
|
+
|
|
56
|
+
vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
|
|
57
|
+
vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
|
|
58
|
+
vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
|
|
59
|
+
vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
|
|
60
|
+
vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
|
|
61
|
+
vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
|
|
62
|
+
vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
|
|
63
|
+
vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
|
|
64
|
+
|
|
65
|
+
vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
|
|
66
|
+
g000 *= norm0.x;
|
|
67
|
+
g010 *= norm0.y;
|
|
68
|
+
g100 *= norm0.z;
|
|
69
|
+
g110 *= norm0.w;
|
|
70
|
+
vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
|
|
71
|
+
g001 *= norm1.x;
|
|
72
|
+
g011 *= norm1.y;
|
|
73
|
+
g101 *= norm1.z;
|
|
74
|
+
g111 *= norm1.w;
|
|
75
|
+
|
|
76
|
+
float n000 = dot(g000, Pf0);
|
|
77
|
+
float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
|
|
78
|
+
float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
|
|
79
|
+
float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
|
|
80
|
+
float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
|
|
81
|
+
float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
|
|
82
|
+
float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
|
|
83
|
+
float n111 = dot(g111, Pf1);
|
|
84
|
+
|
|
85
|
+
vec3 fade_xyz = fade(Pf0);
|
|
86
|
+
vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
|
|
87
|
+
vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
|
|
88
|
+
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
|
|
89
|
+
return 2.2 * n_xyz;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void main() {
|
|
93
|
+
vec2 p = gl_FragCoord.xy / uResolution.xy;
|
|
94
|
+
float base = p.x * 0.5 + p.y * 0.5;
|
|
95
|
+
|
|
96
|
+
float n = cnoise(vec3(p * uScale, uTime * uSpeed)) * 0.5 + 0.5;
|
|
97
|
+
float n2 = cnoise(vec3(p * (uScale * 1.5) - (n * uWarp), uTime * (uSpeed * 1.2))) * 0.5 + 0.5;
|
|
98
|
+
|
|
99
|
+
float mask = (base * 0.2 + n * 0.5 + n2 * 0.3) * uIntensity;
|
|
100
|
+
|
|
101
|
+
vec3 color = mix(uColor1, uColor2, smoothstep(0.1, 0.6, mask));
|
|
102
|
+
color = mix(color, uColor3, smoothstep(0.5, 0.9, mask));
|
|
103
|
+
|
|
104
|
+
float grain = fract(sin(dot(p + fract(uTime), vec2(12.9898, 78.233))) * 43758.5453);
|
|
105
|
+
color += (grain - 0.5) * uGrain;
|
|
106
|
+
|
|
107
|
+
gl_FragColor = vec4(color, 1.0);
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
export { GRAPHITE_FS_SOURCE, GRAPHITE_VS_SOURCE };
|
|
@@ -1 +1,369 @@
|
|
|
1
|
-
import{LUMINA_NOISE_SVG
|
|
1
|
+
import { LUMINA_NOISE_SVG, isLuminaType, FLUID_DEFAULT_COLORS, padColors, toAnimationDurationSec, LUMINA_ANIMATION_DURATION_SEC, toLuminaSpeed } from './lumina-utils.js';
|
|
2
|
+
import { getLuminaPresetColors } from './lumina-presets.js';
|
|
3
|
+
import { getGraphitePreset, GRAPHITE_DEFAULT_COLORS, isGraphitePresetId } from './graphite-presets.js';
|
|
4
|
+
import { getFallingParticleDefaults } from './particle-defaults.js';
|
|
5
|
+
import { CanvasAnimationController } from './canvas-controller.js';
|
|
6
|
+
import { ShaderAnimationController } from './shader-controller.js';
|
|
7
|
+
import { GraphiteShaderController } from './graphite-controller.js';
|
|
8
|
+
|
|
9
|
+
const CLASS = 'designbase-wc-animation-background';
|
|
10
|
+
const DEFAULT_ANIMATION_TYPE = 'graphite';
|
|
11
|
+
const ANIMATION_TYPES = new Set([
|
|
12
|
+
'particles',
|
|
13
|
+
'stars',
|
|
14
|
+
'snow',
|
|
15
|
+
'flowers',
|
|
16
|
+
'confetti',
|
|
17
|
+
'aurora',
|
|
18
|
+
'plasma',
|
|
19
|
+
'mesh-flow',
|
|
20
|
+
'fluid',
|
|
21
|
+
'radiant',
|
|
22
|
+
'ethereal',
|
|
23
|
+
'graphite',
|
|
24
|
+
]);
|
|
25
|
+
function normalizeAnimationType(raw) {
|
|
26
|
+
if (!raw || raw === 'gradient')
|
|
27
|
+
return DEFAULT_ANIMATION_TYPE;
|
|
28
|
+
return ANIMATION_TYPES.has(raw)
|
|
29
|
+
? raw
|
|
30
|
+
: DEFAULT_ANIMATION_TYPE;
|
|
31
|
+
}
|
|
32
|
+
function parseColors(raw, fallback) {
|
|
33
|
+
if (!raw)
|
|
34
|
+
return fallback;
|
|
35
|
+
try {
|
|
36
|
+
const parsed = JSON.parse(raw);
|
|
37
|
+
return Array.isArray(parsed) && parsed.length ? parsed : fallback;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return raw.split(',').map((c) => c.trim()).filter(Boolean);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function parseAnimationBackgroundConfig(el) {
|
|
44
|
+
const type = normalizeAnimationType(el.getAttribute('type'));
|
|
45
|
+
const theme = el.getAttribute('theme') === 'light' ? 'light' : 'dark';
|
|
46
|
+
const intensity = (el.getAttribute('intensity') || 'subtle');
|
|
47
|
+
const defaultColors = ['#667eea', '#764ba2', '#f093fb'];
|
|
48
|
+
const presetAttr = el.getAttribute('preset') || undefined;
|
|
49
|
+
const zoomAttr = el.getAttribute('zoom');
|
|
50
|
+
const isGraphite = type === 'graphite';
|
|
51
|
+
let zoom = Number(zoomAttr || 1);
|
|
52
|
+
if (isGraphite && zoomAttr === null) {
|
|
53
|
+
const presetId = isGraphitePresetId(presetAttr) ? presetAttr : 'graphite';
|
|
54
|
+
zoom = getGraphitePreset(presetId).scale;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
type,
|
|
58
|
+
theme,
|
|
59
|
+
intensity,
|
|
60
|
+
blur: Number(el.getAttribute('blur') || 80),
|
|
61
|
+
speed: Number(el.getAttribute('speed') || 3000),
|
|
62
|
+
direction: (el.getAttribute('direction') || 'left'),
|
|
63
|
+
colors: parseColors(el.getAttribute('colors'), isGraphite ? [...GRAPHITE_DEFAULT_COLORS] : defaultColors),
|
|
64
|
+
opacity: Number(el.getAttribute('opacity') || 1),
|
|
65
|
+
particleCount: Number(el.getAttribute('particle-count') || (type === 'particles' ? 15 : 50)),
|
|
66
|
+
particleSize: Number(el.getAttribute('particle-size') || 2),
|
|
67
|
+
starCount: Number(el.getAttribute('star-count') || 100),
|
|
68
|
+
starSize: Number(el.getAttribute('star-size') || 1.5),
|
|
69
|
+
clickable: el.hasAttribute('clickable') && el.getAttribute('clickable') !== 'false',
|
|
70
|
+
wind: Number(el.getAttribute('wind') || 0.5),
|
|
71
|
+
noise: Number(el.getAttribute('noise') ?? (isGraphite ? 0.1 : 0.05)),
|
|
72
|
+
showVignette: !el.hasAttribute('show-vignette') || el.getAttribute('show-vignette') !== 'false',
|
|
73
|
+
preset: (presetAttr || (isGraphite ? 'graphite' : undefined)),
|
|
74
|
+
zoom,
|
|
75
|
+
shaderSpeed: Number(el.getAttribute('shader-speed') || 0.4),
|
|
76
|
+
shaderIntensity: Number(el.getAttribute('shader-intensity') || 1.2),
|
|
77
|
+
warp: Number(el.getAttribute('warp') || 1.4),
|
|
78
|
+
disabled: el.hasAttribute('disabled') && el.getAttribute('disabled') !== 'false',
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function resolveColors(config) {
|
|
82
|
+
const { type, preset, colors } = config;
|
|
83
|
+
if (type === 'graphite') {
|
|
84
|
+
if (preset && isGraphitePresetId(preset))
|
|
85
|
+
return [...getGraphitePreset(preset).colors];
|
|
86
|
+
if (colors.length >= 3)
|
|
87
|
+
return colors.slice(0, 3);
|
|
88
|
+
return [...GRAPHITE_DEFAULT_COLORS];
|
|
89
|
+
}
|
|
90
|
+
if (preset && !isGraphitePresetId(preset))
|
|
91
|
+
return getLuminaPresetColors(preset);
|
|
92
|
+
if (type === 'fluid' && colors.length < 5)
|
|
93
|
+
return FLUID_DEFAULT_COLORS;
|
|
94
|
+
if (type === 'snow' || type === 'flowers' || type === 'confetti') {
|
|
95
|
+
const defaults = getFallingParticleDefaults(type);
|
|
96
|
+
const isGenericDefault = colors.length === 3 && colors[0] === '#667eea' && colors[1] === '#764ba2';
|
|
97
|
+
return isGenericDefault ? defaults : colors;
|
|
98
|
+
}
|
|
99
|
+
return colors;
|
|
100
|
+
}
|
|
101
|
+
function createMeshAuroraLayer(colors, speed, blur, intensity, theme) {
|
|
102
|
+
const root = document.createElement('div');
|
|
103
|
+
root.className = `${CLASS}__aurora-mesh`;
|
|
104
|
+
const baseOpacity = intensity === 'subtle' ? 0.3 : intensity === 'medium' ? 0.6 : 0.8;
|
|
105
|
+
const duration = toAnimationDurationSec(speed, 5, 1.25);
|
|
106
|
+
const palette = colors.length >= 3 ? colors : ['#4f46e5', '#ec4899', '#06b6d4', '#8b5cf6'];
|
|
107
|
+
const blendMode = theme === 'dark' ? 'screen' : 'multiply';
|
|
108
|
+
const filterStyle = `blur(${blur}px)`;
|
|
109
|
+
const blobClass = `${CLASS}__aurora-blob`;
|
|
110
|
+
const blobs = [
|
|
111
|
+
{ backgroundColor: palette[0], top: '-10%', left: '-10%', animationDuration: `${duration}s`, animationDelay: '0s' },
|
|
112
|
+
{ backgroundColor: palette[1], top: '-10%', right: '-10%', animationDuration: `${duration * 1.2}s`, animationDelay: '2s' },
|
|
113
|
+
{ backgroundColor: palette[2], bottom: '-20%', left: '20%', animationDuration: `${duration * 1.5}s`, animationDelay: '4s' },
|
|
114
|
+
];
|
|
115
|
+
if (palette[3]) {
|
|
116
|
+
blobs.push({
|
|
117
|
+
backgroundColor: palette[3],
|
|
118
|
+
bottom: '-10%',
|
|
119
|
+
right: '-10%',
|
|
120
|
+
animationDuration: `${duration * 1.1}s`,
|
|
121
|
+
animationDelay: '1s',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
blobs.forEach((style) => {
|
|
125
|
+
const blob = document.createElement('div');
|
|
126
|
+
blob.className = blobClass;
|
|
127
|
+
Object.assign(blob.style, {
|
|
128
|
+
filter: filterStyle,
|
|
129
|
+
opacity: String(baseOpacity),
|
|
130
|
+
mixBlendMode: blendMode,
|
|
131
|
+
...style,
|
|
132
|
+
});
|
|
133
|
+
root.appendChild(blob);
|
|
134
|
+
});
|
|
135
|
+
const noise = document.createElement('div');
|
|
136
|
+
noise.className = `${CLASS}__aurora-noise`;
|
|
137
|
+
noise.style.opacity = theme === 'dark' ? '0.03' : '0.05';
|
|
138
|
+
noise.style.backgroundImage = `url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E")`;
|
|
139
|
+
root.appendChild(noise);
|
|
140
|
+
return root;
|
|
141
|
+
}
|
|
142
|
+
function createPlasmaLayer(colors, speed, blur) {
|
|
143
|
+
const root = document.createElement('div');
|
|
144
|
+
root.className = `${CLASS}__plasma`;
|
|
145
|
+
const animId = Math.random().toString(36).slice(2, 11);
|
|
146
|
+
const palette = padColors(colors);
|
|
147
|
+
const c = (idx) => palette[idx % palette.length];
|
|
148
|
+
const luminaSpeed = toLuminaSpeed(speed);
|
|
149
|
+
const duration = LUMINA_ANIMATION_DURATION_SEC / luminaSpeed;
|
|
150
|
+
const style = document.createElement('style');
|
|
151
|
+
style.textContent = `
|
|
152
|
+
@keyframes designbase-wc-plasma-move-1-${animId} {
|
|
153
|
+
0% { transform: translate(0, 0) rotate(0deg) scale(1); }
|
|
154
|
+
25% { transform: translate(10%, 10%) rotate(90deg) scale(1.2); }
|
|
155
|
+
50% { transform: translate(0, 20%) rotate(180deg) scale(1); }
|
|
156
|
+
75% { transform: translate(-10%, 10%) rotate(270deg) scale(0.9); }
|
|
157
|
+
100% { transform: translate(0, 0) rotate(360deg) scale(1); }
|
|
158
|
+
}
|
|
159
|
+
@keyframes designbase-wc-plasma-move-2-${animId} {
|
|
160
|
+
0% { transform: translate(0, 0) rotate(0deg) scale(1.2); }
|
|
161
|
+
33% { transform: translate(-20%, 0) rotate(120deg) scale(1); }
|
|
162
|
+
66% { transform: translate(20%, -10%) rotate(240deg) scale(0.8); }
|
|
163
|
+
100% { transform: translate(0, 0) rotate(360deg) scale(1.2); }
|
|
164
|
+
}
|
|
165
|
+
@keyframes designbase-wc-plasma-move-3-${animId} {
|
|
166
|
+
0% { transform: translate(0, 0) scale(0.8); }
|
|
167
|
+
50% { transform: translate(15%, -15%) scale(1.4); }
|
|
168
|
+
100% { transform: translate(0, 0) scale(0.8); }
|
|
169
|
+
}
|
|
170
|
+
@keyframes designbase-wc-plasma-rotate-${animId} {
|
|
171
|
+
0% { transform: rotate(0deg) scale(1.5); }
|
|
172
|
+
50% { transform: rotate(180deg) scale(2.0); }
|
|
173
|
+
100% { transform: rotate(360deg) scale(1.5); }
|
|
174
|
+
}`;
|
|
175
|
+
root.appendChild(style);
|
|
176
|
+
const base = document.createElement('div');
|
|
177
|
+
base.className = `${CLASS}__plasma-base`;
|
|
178
|
+
base.style.backgroundColor = c(0);
|
|
179
|
+
root.appendChild(base);
|
|
180
|
+
const blobDefs = [
|
|
181
|
+
{ top: '-10%', left: '-10%', width: '70%', height: '70%', background: `radial-gradient(circle, ${c(1)} 0%, transparent 70%)`, animation: `designbase-wc-plasma-move-1-${animId} ${duration}s infinite linear` },
|
|
182
|
+
{ bottom: '-20%', right: '-10%', width: '80%', height: '80%', background: `radial-gradient(circle, ${c(2)} 0%, transparent 70%)`, animation: `designbase-wc-plasma-move-2-${animId} ${duration}s infinite linear` },
|
|
183
|
+
{ top: '20%', left: '20%', width: '60%', height: '60%', background: `radial-gradient(circle, ${c(3)} 0%, transparent 70%)`, animation: `designbase-wc-plasma-rotate-${animId} ${duration}s infinite linear`, extraClass: `${CLASS}__plasma-blob--exclusion` },
|
|
184
|
+
{ top: '40%', right: '20%', width: '40%', height: '40%', background: c(4), animation: `designbase-wc-plasma-move-3-${animId} ${duration}s infinite ease-in-out`, extraClass: `${CLASS}__plasma-blob--accent`, filter: `blur(${blur}px)`, opacity: '0.6' },
|
|
185
|
+
];
|
|
186
|
+
blobDefs.forEach((def) => {
|
|
187
|
+
const blob = document.createElement('div');
|
|
188
|
+
blob.className = `${CLASS}__plasma-blob${def.extraClass ? ` ${def.extraClass}` : ''}`;
|
|
189
|
+
Object.assign(blob.style, {
|
|
190
|
+
filter: def.filter || `blur(${blur}px)`,
|
|
191
|
+
opacity: def.opacity || '0.9',
|
|
192
|
+
...def,
|
|
193
|
+
});
|
|
194
|
+
root.appendChild(blob);
|
|
195
|
+
});
|
|
196
|
+
return root;
|
|
197
|
+
}
|
|
198
|
+
function createLuminaOverlays(noise, showVignette) {
|
|
199
|
+
const fragment = document.createDocumentFragment();
|
|
200
|
+
if (noise > 0) {
|
|
201
|
+
const noiseEl = document.createElement('div');
|
|
202
|
+
noiseEl.className = `${CLASS}__lumina-noise`;
|
|
203
|
+
noiseEl.style.backgroundImage = `url("${LUMINA_NOISE_SVG}")`;
|
|
204
|
+
noiseEl.style.opacity = String(noise);
|
|
205
|
+
fragment.appendChild(noiseEl);
|
|
206
|
+
}
|
|
207
|
+
if (showVignette) {
|
|
208
|
+
const vignette = document.createElement('div');
|
|
209
|
+
vignette.className = `${CLASS}__lumina-vignette`;
|
|
210
|
+
fragment.appendChild(vignette);
|
|
211
|
+
}
|
|
212
|
+
return fragment;
|
|
213
|
+
}
|
|
214
|
+
function syncLuminaOverlays(layersEl, noise, showVignette) {
|
|
215
|
+
let noiseEl = layersEl.querySelector(`.${CLASS}__lumina-noise`);
|
|
216
|
+
let vignetteEl = layersEl.querySelector(`.${CLASS}__lumina-vignette`);
|
|
217
|
+
if (noise > 0) {
|
|
218
|
+
if (!noiseEl) {
|
|
219
|
+
noiseEl = document.createElement('div');
|
|
220
|
+
noiseEl.className = `${CLASS}__lumina-noise`;
|
|
221
|
+
noiseEl.style.backgroundImage = `url("${LUMINA_NOISE_SVG}")`;
|
|
222
|
+
noiseEl.style.mixBlendMode = 'overlay';
|
|
223
|
+
layersEl.appendChild(noiseEl);
|
|
224
|
+
}
|
|
225
|
+
noiseEl.style.opacity = String(noise);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
noiseEl?.remove();
|
|
229
|
+
}
|
|
230
|
+
if (showVignette) {
|
|
231
|
+
if (!vignetteEl) {
|
|
232
|
+
vignetteEl = document.createElement('div');
|
|
233
|
+
vignetteEl.className = `${CLASS}__lumina-vignette`;
|
|
234
|
+
layersEl.appendChild(vignetteEl);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
vignetteEl?.remove();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function mountAnimationLayers(layersEl, config) {
|
|
242
|
+
const resolvedColors = resolveColors(config);
|
|
243
|
+
let handle = {};
|
|
244
|
+
if (config.disabled)
|
|
245
|
+
return handle;
|
|
246
|
+
switch (config.type) {
|
|
247
|
+
case 'particles':
|
|
248
|
+
case 'stars':
|
|
249
|
+
case 'snow':
|
|
250
|
+
case 'flowers':
|
|
251
|
+
case 'confetti': {
|
|
252
|
+
const container = document.createElement('div');
|
|
253
|
+
container.className = `${CLASS}__canvas-layer`;
|
|
254
|
+
layersEl.appendChild(container);
|
|
255
|
+
const controller = new CanvasAnimationController(container, {
|
|
256
|
+
type: config.type,
|
|
257
|
+
colors: resolvedColors,
|
|
258
|
+
speed: config.speed,
|
|
259
|
+
particleCount: config.particleCount,
|
|
260
|
+
particleSize: config.particleSize,
|
|
261
|
+
starCount: config.starCount,
|
|
262
|
+
starSize: config.starSize,
|
|
263
|
+
clickable: config.clickable,
|
|
264
|
+
wind: config.wind,
|
|
265
|
+
layerOpacity: config.opacity,
|
|
266
|
+
});
|
|
267
|
+
handle = {
|
|
268
|
+
destroy: () => controller.destroy(),
|
|
269
|
+
update: (next) => {
|
|
270
|
+
const nextColors = resolveColors(next);
|
|
271
|
+
controller.updateOptions({
|
|
272
|
+
colors: nextColors,
|
|
273
|
+
speed: next.speed,
|
|
274
|
+
particleCount: next.particleCount,
|
|
275
|
+
particleSize: next.particleSize,
|
|
276
|
+
starCount: next.starCount,
|
|
277
|
+
starSize: next.starSize,
|
|
278
|
+
clickable: next.clickable,
|
|
279
|
+
wind: next.wind,
|
|
280
|
+
layerOpacity: next.opacity,
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
case 'aurora':
|
|
287
|
+
layersEl.appendChild(createMeshAuroraLayer(resolvedColors, config.speed, config.blur, config.intensity, config.theme));
|
|
288
|
+
break;
|
|
289
|
+
case 'plasma':
|
|
290
|
+
layersEl.appendChild(createPlasmaLayer(resolvedColors, config.speed, config.blur));
|
|
291
|
+
layersEl.appendChild(createLuminaOverlays(config.noise, config.showVignette));
|
|
292
|
+
break;
|
|
293
|
+
case 'mesh-flow':
|
|
294
|
+
case 'fluid':
|
|
295
|
+
case 'radiant':
|
|
296
|
+
case 'ethereal': {
|
|
297
|
+
const shaderContainer = document.createElement('div');
|
|
298
|
+
shaderContainer.className = `${CLASS}__shader-layer`;
|
|
299
|
+
layersEl.appendChild(shaderContainer);
|
|
300
|
+
const controller = new ShaderAnimationController(shaderContainer, {
|
|
301
|
+
variant: config.type,
|
|
302
|
+
colors: resolvedColors,
|
|
303
|
+
speed: config.speed,
|
|
304
|
+
blur: config.blur,
|
|
305
|
+
noise: config.noise,
|
|
306
|
+
zoom: config.zoom,
|
|
307
|
+
});
|
|
308
|
+
layersEl.appendChild(createLuminaOverlays(config.noise, config.showVignette));
|
|
309
|
+
handle = {
|
|
310
|
+
destroy: () => controller.destroy(),
|
|
311
|
+
update: (next) => {
|
|
312
|
+
const nextColors = resolveColors(next);
|
|
313
|
+
controller.updateOptions({
|
|
314
|
+
colors: nextColors,
|
|
315
|
+
speed: next.speed,
|
|
316
|
+
blur: next.blur,
|
|
317
|
+
noise: next.noise,
|
|
318
|
+
zoom: next.zoom,
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
case 'graphite': {
|
|
325
|
+
const shaderContainer = document.createElement('div');
|
|
326
|
+
shaderContainer.className = `${CLASS}__shader-layer`;
|
|
327
|
+
layersEl.appendChild(shaderContainer);
|
|
328
|
+
const controller = new GraphiteShaderController(shaderContainer, {
|
|
329
|
+
colors: resolvedColors,
|
|
330
|
+
shaderSpeed: config.shaderSpeed,
|
|
331
|
+
shaderIntensity: config.shaderIntensity,
|
|
332
|
+
grain: config.noise,
|
|
333
|
+
scale: config.zoom,
|
|
334
|
+
warp: config.warp,
|
|
335
|
+
});
|
|
336
|
+
handle = {
|
|
337
|
+
destroy: () => controller.destroy(),
|
|
338
|
+
update: (next) => {
|
|
339
|
+
const nextColors = resolveColors(next);
|
|
340
|
+
controller.updateOptions({
|
|
341
|
+
colors: nextColors,
|
|
342
|
+
shaderSpeed: next.shaderSpeed,
|
|
343
|
+
shaderIntensity: next.shaderIntensity,
|
|
344
|
+
grain: next.noise,
|
|
345
|
+
scale: next.zoom,
|
|
346
|
+
warp: next.warp,
|
|
347
|
+
});
|
|
348
|
+
},
|
|
349
|
+
};
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return handle;
|
|
354
|
+
}
|
|
355
|
+
function applyContainerStyles(host, config) {
|
|
356
|
+
const isLumina = isLuminaType(config.type);
|
|
357
|
+
const isGraphite = config.type === 'graphite';
|
|
358
|
+
const backgroundColor = isLumina || isGraphite
|
|
359
|
+
? '#000000'
|
|
360
|
+
: config.theme === 'dark'
|
|
361
|
+
? 'var(--db-surface-base, #0f172a)'
|
|
362
|
+
: 'var(--db-surface-base, #ffffff)';
|
|
363
|
+
host.style.position = 'relative';
|
|
364
|
+
host.style.overflow = 'hidden';
|
|
365
|
+
host.style.backgroundColor = backgroundColor;
|
|
366
|
+
host.style.border = 'none';
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export { CLASS as ANIMATION_BACKGROUND_CLASS, applyContainerStyles, mountAnimationLayers, parseAnimationBackgroundConfig, syncLuminaOverlays };
|
|
@@ -1 +1,53 @@
|
|
|
1
|
-
const
|
|
1
|
+
const LUMINA_COLOR_PRESETS = [
|
|
2
|
+
{
|
|
3
|
+
id: 'neon_dream',
|
|
4
|
+
name: 'Neon Dream',
|
|
5
|
+
colors: ['#7000FF', '#FF00AA', '#3300FF', '#FFCC00', '#00FFFF'],
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
id: 'sunset_bliss',
|
|
9
|
+
name: 'Sunset Bliss',
|
|
10
|
+
colors: ['#FF9900', '#FF00CC', '#6600FF', '#FF5500', '#220055'],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 'deep_ocean',
|
|
14
|
+
name: 'Deep Ocean',
|
|
15
|
+
colors: ['#001133', '#0044FF', '#00DDFF', '#00FFAA', '#000066'],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 'forest_mist',
|
|
19
|
+
name: 'Forest Mist',
|
|
20
|
+
colors: ['#002200', '#00FF44', '#AAFF00', '#006622', '#CCFFCC'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'northern_lights',
|
|
24
|
+
name: 'Northern Lights',
|
|
25
|
+
colors: ['#000000', '#00FF99', '#AA00FF', '#0044FF', '#FFFFFF'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'monochrome_fog',
|
|
29
|
+
name: 'Monochrome Fog',
|
|
30
|
+
colors: ['#000000', '#333333', '#888888', '#CCCCCC', '#FFFFFF'],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'cotton_candy',
|
|
34
|
+
name: 'Cotton Candy',
|
|
35
|
+
colors: ['#FFC0CB', '#87CEFA', '#E0FFFF', '#DDA0DD', '#FF69B4'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'cyber_glitch',
|
|
39
|
+
name: 'Cyber Glitch',
|
|
40
|
+
colors: ['#1A1A1D', '#C3073F', '#6F2232', '#950740', '#4E4E50'],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'golden_hour',
|
|
44
|
+
name: 'Golden Hour',
|
|
45
|
+
colors: ['#FF4E50', '#FC913A', '#F9D423', '#EDE574', '#E1F5C4'],
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
function getLuminaPresetColors(presetId) {
|
|
49
|
+
const preset = LUMINA_COLOR_PRESETS.find((p) => p.id === presetId);
|
|
50
|
+
return preset?.colors ?? LUMINA_COLOR_PRESETS[0].colors;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { LUMINA_COLOR_PRESETS, getLuminaPresetColors };
|