smonthl-liquid-glass-react
v1.0.0
Published
SmonthlAPI - Beautiful frosted glass UI with jelly physics, magnetic following, and cursor lights (React/TypeScript version)
Maintainers
Readme
SmonthlAPI - React TypeScript Version
React and TypeScript implementation of SmonthlAPI with liquid glass effects.
📦 Installation
Via npm
npm install @smonthl/liquid-glass-reactVia GitHub
git clone https://github.com/Moude-AI/smonthl_api.git
cd smonthl_api/tsx-react-ver
npm install🚀 Usage in Your Project
import { SmonthlAPI } from '@smonthl/liquid-glass-react';
import { LiquidGlassDemo } from '@smonthl/liquid-glass-react';
import '@smonthl/liquid-glass-react/dist/style.css';
// Initialize API
const api = new SmonthlAPI();
await api.loadConfig();
// Use component
function App() {
return <LiquidGlassDemo />;
}Features
- Full TypeScript type safety
- React hooks for state management
- Liquid glass effects with magnifying lens
- Jelly physics animations
- Magnetic cursor following
- Dynamic cursor lights
- Real-time configuration controls
- Import/Export JSON configuration
Installation
npm installRunning
Development Mode (Browser)
npm run devThis will start Vite dev server at http://localhost:5173
Development Mode (Electron)
npm run dev:electronThis will start Electron app (make sure Vite dev server is running first)
Development Mode (Both)
npm run dev:allThis will start both Vite dev server and Electron app concurrently
Build for Production
npm run buildBuild Electron App
npm run build:electronThis will create distributable Electron apps in dist-electron/
Project Structure
tsx-react-ver/
├── src/
│ ├── components/
│ │ ├── LiquidGlassDemo.tsx # Main component
│ │ └── LiquidGlassDemo.css # Styles
│ ├── types/
│ │ └── SmonthlAPI.ts # TypeScript types & API
│ ├── App-React.tsx # App component
│ └── index-react.tsx # Entry point
├── index.html # HTML template
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript configuration
├── glass-config.json # SmonthlAPI configuration
└── package.json # DependenciesComponents
LiquidGlassDemo
Main component that renders the liquid glass effect with all controls.
Features:
- Draggable glass container
- Jelly physics with spring animations
- Magnetic cursor attraction
- Dynamic cursor lighting
- Real-time configuration updates
- Background image rotation
SmonthlAPI
TypeScript class for configuration management.
Methods:
loadConfig(url)- Load configuration from JSONupdateConfig(path, value)- Update configuration valuegetConfig(path)- Get configuration valueexportConfig()- Export as JSON stringimportConfig(json)- Import from JSON stringcreateFromTemplate(name)- Create from templatesaveToLocalStorage()- Save to localStorageloadFromLocalStorage()- Load from localStorage
Configuration
Edit glass-config.json to customize all aspects:
{
"glass": {
"transparency": 6,
"blur": 60,
"magnifyingBlur": 30,
"magnifyingBrightness": 115,
"lensSize": 40,
"borderRadius": 32
},
"jelly": {
"elasticity": 0.6,
"friction": 0.85,
"magneticRange": 150,
"magneticStrength": 0.3
},
"lighting": {
"cursorFollowEnabled": true,
"lightIntensity": 0.8,
"lightSize": 120
}
}TypeScript Types
All types are defined in src/types/SmonthlAPI.ts:
GlassConfig- Glass visual propertiesJellyConfig- Physics parametersLightingConfig- Cursor light settingsSmonthlConfig- Complete configurationSmonthlAPI- API class
Development
Hot Module Replacement
Vite provides instant HMR for fast development.
Type Checking
npx tsc --noEmitLinting
npm run lintBuilding
npm run buildOutput will be in dist/ directory.
Browser Support
- Chrome/Edge 76+
- Safari 9+ (with -webkit- prefix)
- Firefox 103+
- Opera 63+
Requires backdrop-filter CSS support for glass effects.
