feat(icons): add the FA5 catalog, REST endpoint and unified icon helpers
Mirror the reference theme's universal picker on FA5: a generated full catalog of the bundled FA5 Free 5.15.4 fonts (src/Icons/fa5-icons.php, generated from the shipped CSS + SVG fonts), a zibsvg group parsed from the runtime sprite so it cannot drift, and GET /aksrt/v1/icons/catalog. Shared admin pieces: aksrt_icon_markup()/aksrt_sanitize_icon_value() with an SVG allowlist, the picker field/modal assets, and one canonical aksrt-font-awesome handle registered through aksrt_enqueue_fontawesome().
This commit is contained in:
@@ -0,0 +1,195 @@
|
||||
/* AKSRT universal icon picker (admin) */
|
||||
|
||||
#aksrt-modal-icon.aksrt-icon-modal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon.aksrt-icon-modal:not(.hidden) {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100100;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__inner {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: min(720px, calc(100vw - 32px));
|
||||
max-height: min(76vh, 640px);
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #e2e4e7;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__close {
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid #e2e4e7;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__tab.is-active {
|
||||
border-color: #2271b1;
|
||||
color: #2271b1;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__body {
|
||||
position: relative;
|
||||
overflow-y: auto;
|
||||
padding: 12px 16px 16px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__loading {
|
||||
padding: 24px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__error {
|
||||
color: #b32d2e;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
|
||||
gap: 4px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-picker__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
padding: 0;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
background: #f6f7f7;
|
||||
font-size: 18px;
|
||||
color: #3c434a;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-picker__item:hover {
|
||||
border-color: #2271b1;
|
||||
color: #2271b1;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-picker__item .icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-picker__empty {
|
||||
grid-column: 1 / -1;
|
||||
padding: 20px 0;
|
||||
color: #787c82;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Custom SVG tab */
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__custom {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__custom textarea {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__custom-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__custom-preview {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 1px dashed #c3c4c7;
|
||||
border-radius: 4px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__custom-preview svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#aksrt-modal-icon .aksrt-icon-modal__grid--session {
|
||||
margin-top: 12px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid #e2e4e7;
|
||||
}
|
||||
|
||||
/* Field markup (widgets, nav menus, meta boxes) */
|
||||
|
||||
.aksrt-icon-picker {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.aksrt-icon-picker .aksrt-icon-picker__preview {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border: 1px solid #dcdcde;
|
||||
border-radius: 4px;
|
||||
background: #f6f7f7;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.aksrt-icon-picker .aksrt-icon-picker__preview svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
.aksrt-icon-picker .aksrt-icon-picker__value {
|
||||
flex: 1 1 160px;
|
||||
min-width: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user