المكوّنات · زرّان عائمان متلازمان
زرّان عائمان متلازمان
إجراء رئيسي وثانوي بحجمين مختلفين ووزنين مختلفين
7 تصاميم من هذه العائلة
<div class="ap apfw"><div class="ph">
<div class="sb"><span class="tm num"></span>
<span class="r" aria-hidden="true"><span>▲</span><span>◗</span><span class="bt num"></span></span></div>
<div class="scr"><div class="body">
<div class="canvas"><span class="sel"></span></div>
<div class="tools"></div>
</div></div>
<div class="pair">
<button class="sec tap" aria-label="تراجع">↺</button>
<button class="pri tap" aria-label="تصدير التصميم">↓</button>
</div>
<div class="lg" role="status" aria-live="polite"></div>
<div class="safe"></div>
</div></div>
/* pt-scoped */
/* appfab-double — تطبيق تصميم */
.apfw{width:100%;height:100%;display:flex;align-items:center;
justify-content:center;padding:6px;font-size:10px;color:var(--pt-text-secondary);
overflow:hidden}
.apfw .ph{position:relative;width:198px;height:100%;max-height:224px;display:flex;
flex-direction:column;overflow:hidden;background:var(--pt-bg-base);
border:1px solid var(--pt-border-default);border-radius:20px;
box-shadow:var(--pt-shadow-3)}
/* شريط الحالة — ليس تزيينًا: يثبت أعلى الشاشة فلا يبدأ المحتوى عند الحافّة */
.apfw .sb{flex:none;display:flex;align-items:center;justify-content:space-between;
padding:5px 12px 2px;font-size:7px;color:var(--pt-text-muted);
font-variant-numeric:tabular-nums}
.apfw .sb .r{display:flex;gap:3px}
.apfw .scr{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.apfw .body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
-webkit-overflow-scrolling:touch}
.apfw .body::-webkit-scrollbar{width:0}
/* المنطقة الآمنة السفلية — شريط الإيماءات يأكل ما تحته */
.apfw .safe{flex:none;height:9px;display:grid;place-items:center}
.apfw .safe::after{content:'';width:52px;height:3px;border-radius:99px;
background:var(--pt-border-strong)}
.apfw h6{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.apfw p{margin:0;font-size:8px;color:var(--pt-text-muted);line-height:1.65}
.apfw .num{font-variant-numeric:tabular-nums}
.apfw button{font:inherit;cursor:pointer;
transition:background var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
color var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
transform var(--pt-motion-duration-fast) var(--pt-motion-easing-standard)}
.apfw button:focus-visible, .apfw a:focus-visible, .apfw input:focus-visible{
outline:2px solid var(--pt-focus-ring);outline-offset:-1px}
/* هدف اللمس: 44 بكسلًا على الشاشات اللمسية، ومساحة نقر ممتدّة على غيرها */
@media(pointer:coarse){.apfw .tap{min-width:44px;min-height:44px}
}
.apfw .tap{position:relative}
.apfw .tap::before{content:'';position:absolute;inset:-6px}
@media(prefers-reduced-motion:reduce){.apfw *{transition:none!important;animation:none!important}
}
.apfw .ph{position:relative}
.apfw .body{padding:9px 12px 46px}
.apfw .canvas{position:relative;height:96px;border-radius:var(--pt-radius-md);
background:repeating-conic-gradient(var(--pt-bg-inset) 0% 25%,transparent 0% 50%) 0/12px 12px;
border:1px solid var(--pt-border-subtle);overflow:hidden}
.apfw .sel{position:absolute;inset-block-start:22px;inset-inline-start:30px;width:62px;height:44px;
border-radius:var(--pt-radius-sm);background:linear-gradient(135deg,#4b6cb7,#8a5fb8);
outline:1px solid var(--pt-accent);outline-offset:2px}
.apfw .tools{display:flex;gap:4px;margin-top:8px;flex-wrap:wrap}
.apfw .tools button{width:26px;height:26px;border-radius:var(--pt-radius-sm);
border:1px solid var(--pt-border-subtle);background:var(--pt-surface);
color:var(--pt-text-muted);font-size:11px}
.apfw .tools button[aria-pressed=true]{border-color:var(--pt-accent);color:var(--pt-accent);
background:var(--pt-accent-muted)}
.apfw .pair{position:absolute;inset-block-end:13px;inset-inline-end:11px;z-index:5;
display:flex;align-items:center;gap:7px}
/* الحجمان مختلفان عمدًا: زرّان متساويان يجبران على القراءة كل مرّة */
.apfw .sec{width:30px;height:30px;border-radius:50%;
border:1px solid var(--pt-border-default);background:var(--pt-bg-overlay);
color:var(--pt-text-secondary);font-size:12px;display:grid;place-items:center;
box-shadow:var(--pt-shadow-2)}
.apfw .pri{width:42px;height:42px;border-radius:50%;border:0;background:var(--pt-accent);
color:var(--pt-color-ink-900);font-size:17px;display:grid;place-items:center;
box-shadow:var(--pt-shadow-4)}
.apfw .lg{position:absolute;inset-block-end:18px;inset-inline-start:12px;z-index:4;
font-size:7.5px;color:var(--pt-accent)}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.apfw');
if (!host) return;
var snapshot = host.innerHTML;
var timers = [];
var ac = null;
/* الجسم كما كتبه المولِّد. يستقبل بدائل مظلَّلة لـ root وdocument
والمؤقّتات، فينظّف نفسه دون أن يعرف أنه قابل لإعادة التركيب. */
function run(root, document, setTimeout, setInterval) {
var ar = document.documentElement.lang !== 'en';
var n = function (v, d) { return Number(v).toLocaleString('en-US', {
minimumFractionDigits: d || 0, maximumFractionDigits: d || 0 }); };
var money = function (usd, d) {
return ar ? n(usd * 3.75, d) + ' ر.س' : '$' + n(usd, d);
};
var set = function (sel, txt) {
var el = root.querySelector(sel); if (el) el.textContent = txt; return el;
};
/* الساعة بأرقام لاتينية دائمًا — قرار موحّد في المشروع كلّه */
(function clock() {
var t = root.querySelector('.tm');
if (!t) return;
function tick() {
var d = new Date();
t.textContent = String(d.getHours()).padStart(2, '0') + ':' +
String(d.getMinutes()).padStart(2, '0');
setTimeout(tick, 20000);
}
tick();
})();
var bt = root.querySelector('.bt');
if (bt) bt.textContent = '84%';
/* اهتزاز خفيف حيث يوجد — تأكيد لمسيّ لا يعتمد عليه شيء */
var buzz = function (ms) { try { if (navigator.vibrate) navigator.vibrate(ms || 8); } catch (e) {} };
var TOOLS = ['▭', '◯', '✎', 'T', '◫'];
var tools = root.querySelector('.tools');
tools.innerHTML = TOOLS.map(function (t, i) {
return '<button class="tap" aria-pressed="' + (i === 0) + '" aria-label="أداة ' + (i + 1) +
'">' + t + '</button>';
}).join('');
tools.addEventListener('click', function (e) {
var b = e.target.closest('button'); if (!b) return;
tools.querySelectorAll('button').forEach(function (x) {
x.setAttribute('aria-pressed', String(x === b));
});
});
var sel = root.querySelector('.sel'), lg = root.querySelector('.lg');
var history = [], hue = 220;
function say(t) { lg.textContent = t; setTimeout(function () { lg.textContent = ''; }, 1400); }
root.querySelector('.pri').addEventListener('click', function () {
buzz(14); say(ar ? 'صُدّر بصيغة PNG · 2x' : 'Exported PNG · 2x');
});
root.querySelector('.sec').addEventListener('click', function () {
buzz();
if (!history.length) { say(ar ? 'لا شيء للتراجع عنه' : 'Nothing to undo'); return; }
sel.style.background = history.pop();
say(ar ? 'تمّ التراجع' : 'Undone');
});
root.querySelector('.canvas').addEventListener('click', function () {
history.push(sel.style.background || 'linear-gradient(135deg,#4b6cb7,#8a5fb8)');
hue = (hue + 47) % 360;
sel.style.background = 'linear-gradient(135deg,hsl(' + hue + ' 52% 48%),hsl(' +
((hue + 48) % 360) + ' 46% 56%))';
say(ar ? 'غُيّر التدرّج — جرّب التراجع' : 'Gradient changed — try undo');
});
}
function mount() {
ac = new AbortController();
var real = window.document;
/* وسيط يمرّر كل شيء إلى المستند الحقيقي، ويعلّق كل مستمع بإشارة
تُقطع عند إعادة التركيب — فلا يبقى مستمع من نسخة ماتت. */
var doc = new Proxy(real, {
get: function (t, k) {
if (k === 'addEventListener') {
return function (type, fn, opts) {
var o = (opts && typeof opts === 'object') ? Object.assign({}, opts)
: { capture: !!opts };
o.signal = ac.signal;
return t.addEventListener(type, fn, o);
};
}
var v = t[k];
return typeof v === 'function' ? v.bind(t) : v;
}
});
function track(fn) {
return function (f, ms) { var id = fn(f, ms); timers.push(id); return id; };
}
run(host, doc, track(window.setTimeout.bind(window)),
track(window.setInterval.bind(window)));
}
function unmount() {
if (ac) ac.abort();
// المعرّفان يتشاركان فضاءً واحدًا في المتصفّح، فالإلغاء المزدوج آمن
timers.forEach(function (id) { window.clearTimeout(id); window.clearInterval(id); });
timers = [];
host.innerHTML = snapshot;
}
mount();
addEventListener('pt-lang', function () { unmount(); mount(); });
})();
# Paired Floating Actions
**Role:** You are an Arabic-first UI designer and front-end engineer. Read the whole
specification before writing a single line, then follow it literally. If two requirements
conflict, favour usability over visual effect.
**Goal:** Paired Floating Actions — A primary and a secondary action at different sizes and weights
**Why this component matters:** When two floating actions coexist, they must differ in size and weight — equal-looking buttons force the user to read both every time instead of recognising one.
**Direction:** Genuine RTL — not a mirrored Latin layout. Use logical properties
(`margin-inline-start`, `padding-inline`, `inset-inline-start`, `text-align: start`),
never physical ones (`margin-left`, `left`). The layout must flip with `dir` on its own,
with no duplicated rules.
**Typography:** Cairo for Arabic, IBM Plex Sans for Latin. Arabic line-height must be
`0.18` higher than the Latin equivalent — dots, hamzas and maddas need more vertical room.
Arabic font-size runs `1.06×` the Latin size at the same optical weight.
**Numerals:** Western digits in both languages (`1,234.50`). Only the currency changes:
`ر.س` **after** the number in Arabic, `$` **before** it in English. Jordanian dinar
uses **three** decimal places, not two.
**Colors:** Dark mode — background `#0D142B` · surfaces `#211F54` · borders `#545C91` · text `#918FC2`.
Accent `#ADA9E8` must never exceed 8% of the screen area.
**Language:** Bilingual — every string carries both Arabic and English, and the layout
flips with `dir` automatically.
**States:** `default` · `hover` · `focus` · `active` · `disabled` · `loading` · `error`.
Do not design the resting state alone.
**Accessibility:** Contrast ratio at least `4.5:1`, complete keyboard navigation,
visible focus rings, and honour `prefers-reduced-motion`.
**Output:** Clean HTML and CSS in two separate files. No frameworks, no libraries,
no external dependencies.