coliff/popover-css-inspector
Composer 安装命令:
composer require coliff/popover-css-inspector
包简介
Displays CSS attributes of elements in a Bootstrap popover. Ideal for design systems and style guides
关键字:
README 文档
README
Popover CSS Inspector
Displays CSS attributes of elements in a Bootstrap popover. Ideal for design systems and style guides.
- Easy to use - just add
data-bs-custom-class="popover-css-inspector"to the element (requires Bootstrap 5 JavaScript) - Customizable with your own CSS and Bootstrap's Popover options
- Popover remains static on the document and does not reposition on scroll
- Supports Bootstrap 5 dark mode
- Option to hide CSS elements - e.g. just add
data-css-inspector-hide="font-size"to prevent font-size properties from displaying - Some CSS properties are hidden by default but can be enabled - e.g. just add
data-css-inspector-show="border"to show border properties - Reloads CSS attributes if the theme is changed via the
data-bs-themeattribute - perfect for checking color value changes between light and dark mode - Supports optional title with
data-bs-titleattribute. - Only 3 KB minified and gzipped!
Quick start
Several quick start options are available:
- Download the latest release
- Clone the repo
git clone https://github.com/coliff/popover-css-inspector.git - Install with npm
npm install popover-css-inspector - Install with yarn
yarn add popover-css-inspector - Install with Composer
composer require coliff/popover-css-inspector
Usage
- Add the
data-bs-custom-class="popover-css-inspector"to the element you'd like to show the popover on. For example, a button.
<button type="button" class="btn btn-primary" data-bs-toggle="popover" data-bs-custom-class="popover-css-inspector"> Button </button>
- Load the script (either async or defer is recommended):
<script src="/js/popover-css-inspector.min.js" defer></script>
-
Some CSS properties are opt-in only. For example, to show border properties, add
data-css-inspector-show="border"to the element. -
All CSS properties can be hidden. For example, to hide font-size properties, add
data-css-inspector-hide="font-size"to the element. -
Optional. Consider adding the
pe-noneclass to the element to prevent the popover from being triggered by the user.
How it works
The script will look for any element with the data-bs-custom-class="css-inspector" attribute and add a click event listener to it. When clicked, it will get the element's CSS attributes and display them in a Bootstrap popover.
Demo
List of CSS properties
These CSS properties are displayed by default unless their value is null or empty. You can opt out of these rows with data-css-inspector-hide.
| Property | Opt-out attribute |
|---|---|
animation-duration |
data-css-inspector-hide="animation-duration" |
animation-name |
data-css-inspector-hide="animation-name" |
background-color |
data-css-inspector-hide="bg-color" |
border-radius |
data-css-inspector-hide="b-radius" |
color |
data-css-inspector-hide="color" |
font-size |
data-css-inspector-hide="font-size" |
font-style |
data-css-inspector-hide="font-style" |
font-weight |
data-css-inspector-hide="font-weight" |
height |
data-css-inspector-hide="height" |
margin |
data-css-inspector-hide="margin" |
max-height |
data-css-inspector-hide="max-height" |
max-width |
data-css-inspector-hide="max-width" |
opacity |
data-css-inspector-hide="opacity" |
padding |
data-css-inspector-hide="padding" |
text-align |
data-css-inspector-hide="text-align" |
text-transform |
data-css-inspector-hide="text-transform" |
width |
data-css-inspector-hide="width" |
Note: Most attributes are hidden if the value is none or null.
List of opt-in CSS properties
These CSS properties are hidden by default and are only shown when included in data-css-inspector-show.
| Property | Opt-in attribute |
|---|---|
accent-color |
data-css-inspector-show="accent-color" |
align-content |
data-css-inspector-show="align-content" |
align-items |
data-css-inspector-show="align-items" |
align-self |
data-css-inspector-show="align-self" |
animation |
data-css-inspector-show="animation" |
animation-delay |
data-css-inspector-show="animation-delay" |
animation-direction |
data-css-inspector-show="animation-direction" |
animation-fill-mode |
data-css-inspector-show="animation-fill-mode" |
animation-iteration-count |
data-css-inspector-show="animation-iteration-count" |
animation-play-state |
data-css-inspector-show="animation-play-state" |
animation-timing-function |
data-css-inspector-show="animation-timing-function" |
appearance |
data-css-inspector-show="appearance" |
aspect-ratio |
data-css-inspector-show="aspect-ratio" |
backdrop-filter |
data-css-inspector-show="backdrop-filter" |
background-blend-mode |
data-css-inspector-show="background-blend-mode" |
background-image |
data-css-inspector-show="bg-image" |
background-position |
data-css-inspector-show="bg-position" |
background-repeat |
data-css-inspector-show="bg-repeat" |
background-size |
data-css-inspector-show="bg-size" |
border |
data-css-inspector-show="border" |
border-bottom-color |
data-css-inspector-show="b-bottom-color" |
border-bottom-width |
data-css-inspector-show="b-bottom-width" |
border-color |
data-css-inspector-show="b-color" |
border-left-width |
data-css-inspector-show="b-left-width" |
border-style |
data-css-inspector-show="b-style" |
border-width |
data-css-inspector-show="b-width" |
box-shadow |
data-css-inspector-show="box-shadow" |
box-sizing |
data-css-inspector-show="box-sizing" |
clip-path |
data-css-inspector-show="clip-path" |
column-gap |
data-css-inspector-show="column-gap" |
color-scheme |
data-css-inspector-show="color-scheme" |
cursor |
data-css-inspector-show="cursor" |
display |
data-css-inspector-show="display" |
filter |
data-css-inspector-show="filter" |
float |
data-css-inspector-show="float" |
flex-direction |
data-css-inspector-show="flex-direction" |
flex-wrap |
data-css-inspector-show="flex-wrap" |
font-family |
data-css-inspector-show="font-family" |
font-variant |
data-css-inspector-show="font-variant" |
gap |
data-css-inspector-show="gap" |
grid-auto-flow |
data-css-inspector-show="grid-auto-flow" |
grid-column |
data-css-inspector-show="grid-column" |
grid-row |
data-css-inspector-show="grid-row" |
grid-template-columns |
data-css-inspector-show="grid-template-columns" |
grid-template-rows |
data-css-inspector-show="grid-template-rows" |
hyphens |
data-css-inspector-show="hyphens" |
isolation |
data-css-inspector-show="isolation" |
justify-items |
data-css-inspector-show="justify-items" |
justify-self |
data-css-inspector-show="justify-self" |
letter-spacing |
data-css-inspector-show="letter-spacing" |
line-break |
data-css-inspector-show="line-break" |
line-height |
data-css-inspector-show="line-height" |
list-style |
data-css-inspector-show="list-style" |
margin-bottom |
data-css-inspector-show="margin-bottom" |
margin-left |
data-css-inspector-show="margin-left" |
margin-right |
data-css-inspector-show="margin-right" |
margin-top |
data-css-inspector-show="margin-top" |
mix-blend-mode |
data-css-inspector-show="mix-blend-mode" |
min-height |
data-css-inspector-show="min-height" |
min-width |
data-css-inspector-show="min-width" |
object-fit |
data-css-inspector-show="object-fit" |
object-position |
data-css-inspector-show="object-position" |
overflow |
data-css-inspector-show="overflow" |
overflow-wrap |
data-css-inspector-show="overflow-wrap" |
outline |
data-css-inspector-show="outline" |
outline-offset |
data-css-inspector-show="outline-offset" |
place-content |
data-css-inspector-show="place-content" |
place-items |
data-css-inspector-show="place-items" |
pointer-events |
data-css-inspector-show="pointer-events" |
position |
data-css-inspector-show="position" |
row-gap |
data-css-inspector-show="row-gap" |
text-decoration |
data-css-inspector-show="text-decoration" |
text-decoration-thickness |
data-css-inspector-show="text-decoration-thickness" |
text-indent |
data-css-inspector-show="text-indent" |
text-overflow |
data-css-inspector-show="text-overflow" |
text-shadow |
data-css-inspector-show="text-shadow" |
text-underline-offset |
data-css-inspector-show="text-underline-offset" |
text-wrap |
data-css-inspector-show="text-wrap" |
transform |
data-css-inspector-show="transform" |
transform-origin |
data-css-inspector-show="transform-origin" |
transition |
data-css-inspector-show="transition" |
transition-delay |
data-css-inspector-show="transition-delay" |
transition-duration |
data-css-inspector-show="transition-duration" |
transition-property |
data-css-inspector-show="transition-property" |
transition-timing-function |
data-css-inspector-show="transition-timing-function" |
user-select |
data-css-inspector-show="user-select" |
vertical-align |
data-css-inspector-show="vertical-align" |
white-space |
data-css-inspector-show="white-space" |
will-change |
data-css-inspector-show="will-change" |
writing-mode |
data-css-inspector-show="writing-mode" |
word-break |
data-css-inspector-show="word-break" |
word-spacing |
data-css-inspector-show="word-spacing" |
word-wrap |
data-css-inspector-show="word-wrap" |
z-index |
data-css-inspector-show="z-index" |
Browser support
Works well with all the browsers supported by Bootstrap.
Credits
Created by Christian Oliff with help from GitHub Copilot.
coliff/popover-css-inspector 适用场景与选型建议
coliff/popover-css-inspector 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 8, 最近一次更新时间为 2024 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「css」 「bootstrap」 「style」 「inspector」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 coliff/popover-css-inspector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coliff/popover-css-inspector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 coliff/popover-css-inspector 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for using the CssToInlineStyles translator by tijsverkoyen
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
Fixing php code style
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
Run all code formatting tools with one command: pretty
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-07-18
