Installation:
composer require contao-thememanager/ctm-effects
Ensure your Laravel project uses Laravel 8+ (check composer.json for compatibility).
Publish Assets:
Run the package’s asset publisher (if available) or manually link the JS/CSS files in your resources/views or public folder. Check the package’s README for exact paths (e.g., vendor/contao-thememanager/ctm-effects/dist/).
First Use Case:
<div class="ctm-fade-in">) and include the package’s JS:
<script src="{{ asset('vendor/contao-thememanager/ctm-effects/dist/ctm-effects.js') }}"></script>
data-ctm-effect="slide-up") on elements to apply animations on page load or via JavaScript events.Configuration:
No config file is required for basic usage. For advanced options, check if the package supports a .env or config file (e.g., config/ctm-effects.php). If not, inspect the JS source for customization hooks.
Component Integration:
<!-- Example: Add effect to a ThemeManager modal -->
<div class="theme-manager-modal" data-ctm-effect="fade" data-ctm-duration="500">
<!-- Modal content -->
</div>
Event-Driven Effects:
document.querySelector('.my-element').addEventListener('click', function() {
CtmEffects.trigger(this, 'pulse', 300);
});
CtmEffects.init(), CtmEffects.play()).Performance Optimization:
let ticking = false;
window.addEventListener('scroll', function() {
if (!ticking) {
window.requestAnimationFrame(() => CtmEffects.checkScrollEffects());
ticking = true;
}
});
Theming and Styling:
/* Customize transition duration */
.ctm-effect {
transition-duration: 0.8s !important;
}
Server-Side Rendering (SSR) Considerations:
@if(!app()->runningInConsole())
<script src="{{ asset('vendor/ctm-effects.js') }}"></script>
@endif
No Official Documentation:
README.md or dedicated docs. Reverse-engineer usage by inspecting:
vendor/contao-thememanager/ctm-effects/src/ for classes/methods.vendor/contao-thememanager/ctm-effects/tests/ for usage examples.release/0.1.0.md for initial feature list.Dependency Conflicts:
composer require contao/core-bundle # If ThemeManager is a Symfony bundle
Animation Conflicts:
<div class="my-prefix-fade-in">...</div>
.ctm-effect, .my-prefix-fade-in { transition: none !important; }
Browser Support:
requestAnimationFrame).<script src="https://cdn.polyfill.io/v3/polyfill.min.js?features=default,Element.prototype.classList"></script>
Debugging:
F12) for missing dependencies or typos in effect names.ctm-effects.js).Extending Functionality:
CtmEffects.registerEffect('custom-spin', {
enter: 'transform: rotate(0deg);',
leave: 'transform: rotate(360deg);'
});
@if(auth()->check())
<div data-ctm-effect="slide-down">Welcome back!</div>
@endif
Testing:
// Example Jest test
test('applies fade effect', () => {
document.body.innerHTML = '<div class="ctm-fade-in">Test</div>';
CtmEffects.init();
expect(document.querySelector('.ctm-fade-in')).toHaveStyle('opacity: 1');
});
Performance Monitoring:
transition-timing-function uses cubic-bezier for smoothness.transform changes that trigger repaints.Fallbacks:
<noscript>
<div class="static-fallback">This content loads without animations.</div>
</noscript>
Community Support:
laravel-animation) if this package is abandoned.How can I help you explore Laravel packages today?