fluid-pointer-react
Version:
A dependency-free fluid simulation component with WebGL-based physics - supports both vanilla web components and React
156 lines (132 loc) • 2.82 kB
CSS
/**
* Optional CSS styles for FluidPointer React component
* These styles provide additional customization options beyond the default inline styles
*/
/* Base component styles */
.fluid-pointer {
display: block;
position: relative;
overflow: hidden;
box-sizing: border-box;
cursor: crosshair;
}
.fluid-pointer canvas {
width: 100%;
height: 100%;
display: block;
object-fit: cover;
}
/* Responsive variant */
.fluid-pointer--responsive {
width: 100%;
height: auto;
}
/* Paused state */
.fluid-pointer--paused {
cursor: default;
}
/* Aspect ratio variants */
.fluid-pointer--aspect-16-9 {
aspect-ratio: 16 / 9;
}
.fluid-pointer--aspect-1-1 {
aspect-ratio: 1 / 1;
}
.fluid-pointer--aspect-4-3 {
aspect-ratio: 4 / 3;
}
/* Common styling presets */
.fluid-pointer--card {
border-radius: 12px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
overflow: hidden;
}
.fluid-pointer--hero {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: -1;
}
.fluid-pointer--widget {
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.05);
}
.fluid-pointer--fullscreen {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 1000;
}
/* Loading state */
.fluid-pointer--loading {
background: linear-gradient(45deg, #1a1a1a, #2a2a2a);
background-size: 400% 400%;
animation: fluid-loading 2s ease-in-out infinite;
}
@keyframes fluid-loading {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
/* Error state */
.fluid-pointer--error {
background: #2a1a1a;
display: flex;
align-items: center;
justify-content: center;
color: #ff6b6b;
font-family: system-ui, sans-serif;
}
.fluid-pointer--error::before {
content: "⚠️ WebGL not supported";
font-size: 14px;
}
/* Accessibility improvements */
.fluid-pointer:focus-visible {
outline: 2px solid #4caf50;
outline-offset: 2px;
}
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
.fluid-pointer {
cursor: default;
}
.fluid-pointer canvas {
filter: blur(1px);
opacity: 0.7;
}
}
/* High contrast mode support */
@media (prefers-contrast: high) {
.fluid-pointer {
border: 2px solid currentColor;
}
}
/* Dark mode support */
@media (prefers-color-scheme: dark) {
.fluid-pointer--card {
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.fluid-pointer--widget {
border-color: rgba(255, 255, 255, 0.2);
background: rgba(255, 255, 255, 0.05);
}
}
/* Light mode support */
@media (prefers-color-scheme: light) {
.fluid-pointer--card {
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.fluid-pointer--widget {
border-color: rgba(0, 0, 0, 0.1);
background: rgba(0, 0, 0, 0.02);
}
}