lukeraymonddowning/alpinimations
最新稳定版本:v1.5.0
Composer 安装命令:
composer require lukeraymonddowning/alpinimations
包简介
Streamline your animations by using these simple blade includes in your components!
README 文档
README
Clean up your Alpine JS animations.
Table of Contents
About Alpinimations
Alpinimations helps you clean up your Laravel blade files when using Alpine JS. Alpine has a super powerful animation system, but it can often bloat your HTML. This package bundles common animations into small blade files that you can include in your HTML.
We currently support all Tailwind UI animations and will be adding animations from more places over time.
Installation
To install the package, simply run composer require lukeraymonddowning/alpinimations in the terminal from the root of
your Laravel project.
If you'd like to edit the animation files, you can publish the views by running
php artisan vendor:publish --tag=alpinimations.
Usage
Using Alpinimations couldn't be simpler. Let's take a super awesome Tailwind UI component, the slideover. After copying over the HTML from the Tailwind UI component library, you'll have something like this:
<div class="fixed inset-0 overflow-hidden"> <div class="absolute inset-0 overflow-hidden"> <!-- Background overlay, show/hide based on slide-over state. Entering: "ease-in-out duration-500" From: "opacity-0" To: "opacity-100" Leaving: "ease-in-out duration-500" From: "opacity-100" To: "opacity-0" --> <div class="absolute inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div> <section class="absolute inset-y-0 right-0 pl-10 max-w-full flex"> <!-- Slide-over panel, show/hide based on slide-over state. Entering: "transform transition ease-in-out duration-500 sm:duration-700" From: "translate-x-full" To: "translate-x-0" Leaving: "transform transition ease-in-out duration-500 sm:duration-700" From: "translate-x-0" To: "translate-x-full" --> <div class="w-screen max-w-md"> <div class="h-full flex flex-col space-y-6 py-6 bg-white shadow-xl overflow-y-scroll"> <header class="px-4 sm:px-6"> <div class="flex items-start justify-between space-x-3"> <h2 class="text-lg leading-7 font-medium text-gray-900"> Panel title </h2> <div class="h-7 flex items-center"> <button aria-label="Close panel" class="text-gray-400 hover:text-gray-500 transition ease-in-out duration-150"> <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/> </svg> </button> </div> </div> </header> <div class="relative flex-1 px-4 sm:px-6"> </div> </div> </div> </section> </div> </div>
Note that Tailwind UI includes the animations we should apply. These animations are included out of the box with Alpinimations. Let's sweeten up our component with Alpine:
<div x-data="{ showSlideover: false }" class="fixed inset-0 overflow-hidden"> <div class="absolute inset-0 overflow-hidden"> <div x-show="showSlideover" @anim('tailwindui.slideover.overlay') class="absolute inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div> <section class="absolute inset-y-0 right-0 pl-10 max-w-full flex"> <div x-show="showSlideover" @anim('tailwindui.slideover.panel') class="w-screen max-w-md"> <div class="h-full flex flex-col space-y-6 py-6 bg-white shadow-xl overflow-y-scroll"> <header class="px-4 sm:px-6"> <div class="flex items-start justify-between space-x-3"> <h2 class="text-lg leading-7 font-medium text-gray-900"> Panel title </h2> <div class="h-7 flex items-center"> <button @click="showSlideover = false" aria-label="Close panel" class="text-gray-400 hover:text-gray-500 transition ease-in-out duration-150"> <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/> </svg> </button> </div> </div> </header> <div class="relative flex-1 px-4 sm:px-6"> </div> </div> </div> </section> </div> </div>
Note how we can use the @anim blade directive to include all the necessary alpine animation directives. A list of all Tailwind UI animations available can be found below.
We can go even further here. As most animations are coupled with x-show, Alpinimations includes an @xshow blade directive. Check it out:
<div x-data="{ showSlideover: false }" class="fixed inset-0 overflow-hidden"> <div class="absolute inset-0 overflow-hidden"> <div @xshow('showSlideover', 'tailwindui.slideover.overlay') class="absolute inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div> <section class="absolute inset-y-0 right-0 pl-10 max-w-full flex"> <div @xshow('showSlideover', 'tailwindui.slideover.panel') class="w-screen max-w-md"> <div class="h-full flex flex-col space-y-6 py-6 bg-white shadow-xl overflow-y-scroll"> <header class="px-4 sm:px-6"> <div class="flex items-start justify-between space-x-3"> <h2 class="text-lg leading-7 font-medium text-gray-900"> Panel title </h2> <div class="h-7 flex items-center"> <button @click="showSlideover = false" aria-label="Close panel" class="text-gray-400 hover:text-gray-500 transition ease-in-out duration-150"> <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/> </svg> </button> </div> </div> </header> <div class="relative flex-1 px-4 sm:px-6"> </div> </div> </div> </section> </div> </div>
Suuuuuper clean.
Available animations
Tailwind UI
Dropdowns
tailwindui.dropdown.panel- Can apply to all dropdown components. Tailwind UI docs
Menus
tailwindui.menu.card- Can apply to mobile menus such as seen in Tailwind UI hero mobile menus. Tailwind UI docstailwindui.menu.flyout- Works with all flyout menus. Tailwind UI docstailwindui.menu.off-canvas- For those swanky mobile sidebar menus. Tailwind UI docstailwindui.menu.overlay- For any overlay backgrounds needed when menus are displayed, especially in mobile. Tailwind UI docs
Modals
tailwindui.modal.overlay- The overlay that shows behind a modal when it is displayed. Tailwind UI docstailwindui.modal.panel- The actual panel/card that shows the modal content. Tailwind UI docs
Notifications
tailwindui.notification.panel- The container for the notification. Tailwind UI docs
Select Boxes
tailwindui.select.popover- The option menu popover. Tailwind UI docs
Slideovers
tailwindui.slideover.close-button- The close button for a slideover. This could apply to any close button. Tailwind UI docstailwindui.slideover.overlay- The background overlay that applies to certain slideovers. Tailwind UI docstailwindui.slideover.panel- The actual slideover panel/card that will contain your content. Tailwind UI docs
Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
License
The Laravel framework is open-sourced software licensed under the MIT license.
lukeraymonddowning/alpinimations 适用场景与选型建议
lukeraymonddowning/alpinimations 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 20.23k 次下载、GitHub Stars 达 102, 最近一次更新时间为 2020 年 06 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「lukeraymonddowning」 「alpinimations」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lukeraymonddowning/alpinimations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lukeraymonddowning/alpinimations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lukeraymonddowning/alpinimations 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 20.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 102
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-27