uikit-v1.3.4-appheader-mobile-logo-padding-complete
All checks were successful
Build and Deploy Next.js + Nginx Docker Image / build-and-deploy (push) Successful in 53s
Build and Deploy Next.js + Nginx Docker Image / deploy (push) Successful in 7s

This commit is contained in:
Mohamadzadeh 2026-10-31 15:33:09 +03:30
parent 46e32ff4db
commit e9efbaa39c
5 changed files with 70 additions and 53 deletions

View File

@ -0,0 +1,9 @@
# UI Kit v1.3.4 — AppHeader mobile logo padding
Base: complete `v1.3.3` package.
- `AppHeader.Logo` with `optimize` now has **0px padding** for mobile/tablet header rendering (viewport width < `62em`, matching the existing desktop breakpoint).
- Desktop retains **8px padding**, its prior dimensions, and its prior styling.
- The remote optimization request derives its dimensions from the actual computed horizontal padding rather than always subtracting 16px. This prevents undersized processed images on mobile.
- Unoptimized logos, header text, sidebar, provider behavior, and all other remote components are unchanged.
- Deploy `dist/remote/AppHeader.js` to `https://uikit.d.aiengines.ir/AppHeader.js` in addition to publishing the package tag `v1.3.4`. Invalidate the CDN cache if applicable.

View File

@ -1449,6 +1449,8 @@ function ExampleAppHeader() {
`AppHeader.Logo` به‌صورت پیش‌فرض URL را تغییر نمی‌دهد. اگر `optimize` را پاس بدهید، فقط در مرورگر URL نسبی (مثل `/logo.png`) با origin همان سامانه مقصد کامل می‌شود، سپس `processImage` با ابعاد نمایش لوگو، `q: 70` و `webp: true` صدا زده می‌شود. تغییر عرض نمایش (مثلاً breakpoint موبایل/دسکتاپ) باعث بروزرسانی تصویر می‌شود. اگر سرویس بهینه‌سازی خطا بدهد، لوگوی اصلی جایگزین می‌شود. این قابلیت به `domain` یا هیچ dependency اضافی در پروژه مقصد نیاز ندارد. برای استفاده از `optimize` باید نسخه npm/Git UI Kit حاوی این prop را در سامانه مقصد نصب کرد؛ اما سامانه‌های قبلی که `optimize` نمی‌دهند نیازی به آپدیت ندارند.
در نسخه `1.3.4`، لوگوی `AppHeader.Logo` با `optimize` در نمایش موبایل (عرض کمتر از `62em`) پدینگ ندارد؛ در دسکتاپ همان پدینگ `8px` حفظ شده است. اندازه تصویر بهینه‌شده نیز بر اساس پدینگ واقعی محاسبه می‌شود. لوگوهای بدون `optimize` تغییری نکرده‌اند.
`bg` اختیاری است و رنگ پس‌زمینه پیش‌فرض Header را override می‌کند. `AppHeader.Extra` نیز اختیاری است و لوگو + متن دلخواه می‌گیرد. `AppHeader.Extra` و `AppHeader.Bi` مستقل از هم هستند و می‌توان هرکدام را حذف کرد. اگر هر دو وجود داشته باشند، در انتهای Header ترتیب نمایشی `Extra` سپس `Bi` است.
فایل remote از این آدرس بارگذاری می‌شود:

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "uikit",
"version": "1.3.3",
"version": "1.3.4",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",

View File

@ -66,7 +66,7 @@ const STYLES = `
.logo.logo--optimized{
aspect-ratio:1 / 1;
max-height:none;
padding:8px;
padding:0;
}
.brand{
display:flex;
@ -156,6 +156,7 @@ const STYLES = `
}
.brand-section{gap:0}
.logo{width:100px;max-height:92px}
.logo.logo--optimized{padding:8px}
.brand{gap:3.5px}
.title{font-size:22px}
.description{
@ -260,9 +261,13 @@ class AppHeaderElement extends HTMLElement {
const boxSize = Math.max(0, Math.round(rect.width));
if (!boxSize) return;
// The optimized image sits in a square box with 8px of padding
// on every side; resize the remote asset to the usable inner square.
const imageSize = Math.max(1, boxSize - 16);
// Match the actual padding: 0 on mobile and 8px on desktop.
// The optimized remote image must fill the usable content box.
const logoStyle = window.getComputedStyle(logo);
const horizontalPadding =
(parseFloat(logoStyle.paddingLeft) || 0) +
(parseFloat(logoStyle.paddingRight) || 0);
const imageSize = Math.max(1, Math.round(boxSize - horizontalPadding));
const url = processImage(absoluteSource, {
w: imageSize,
h: imageSize,