المكوّنات · قائمة إعدادات مجمّعة
قائمة إعدادات مجمّعة
مجموعات بعناوين، وأنواع صفوف مختلفة تعمل كلّها
7 تصاميم من هذه العائلة
<div class="ap apls"><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">
<h6 data-ar="الإعدادات" data-en="Settings">الإعدادات</h6>
<div class="groups"></div>
<div class="lg" role="status" aria-live="polite"></div>
</div></div>
<div class="safe"></div>
</div></div>
/* pt-scoped */
/* applist-settings — إعدادات التطبيق */
.apls{width:100%;height:100%;display:flex;align-items:center;
justify-content:center;padding:6px;font-size:10px;color:var(--pt-text-secondary);
overflow:hidden}
.apls .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)}
/* شريط الحالة — ليس تزيينًا: يثبت أعلى الشاشة فلا يبدأ المحتوى عند الحافّة */
.apls .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}
.apls .sb .r{display:flex;gap:3px}
.apls .scr{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.apls .body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
-webkit-overflow-scrolling:touch}
.apls .body::-webkit-scrollbar{width:0}
/* المنطقة الآمنة السفلية — شريط الإيماءات يأكل ما تحته */
.apls .safe{flex:none;height:9px;display:grid;place-items:center}
.apls .safe::after{content:'';width:52px;height:3px;border-radius:99px;
background:var(--pt-border-strong)}
.apls h6{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.apls p{margin:0;font-size:8px;color:var(--pt-text-muted);line-height:1.65}
.apls .num{font-variant-numeric:tabular-nums}
.apls 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)}
.apls button:focus-visible, .apls a:focus-visible, .apls input:focus-visible{
outline:2px solid var(--pt-focus-ring);outline-offset:-1px}
/* هدف اللمس: 44 بكسلًا على الشاشات اللمسية، ومساحة نقر ممتدّة على غيرها */
@media(pointer:coarse){.apls .tap{min-width:44px;min-height:44px}
}
.apls .tap{position:relative}
.apls .tap::before{content:'';position:absolute;inset:-6px}
@media(prefers-reduced-motion:reduce){.apls *{transition:none!important;animation:none!important}
}
.apls .body{padding:9px 12px}
.apls .groups{display:flex;flex-direction:column;gap:11px;margin-top:8px}
.apls .g > b{display:block;font-size:7px;color:var(--pt-text-muted);padding:0 4px 4px;
letter-spacing:.04em}
.apls .g ul{list-style:none;margin:0;padding:0;border-radius:10px;overflow:hidden;
background:var(--pt-surface);border:1px solid var(--pt-border-subtle)}
.apls .g li{display:flex;align-items:center;gap:8px;padding:8px 10px;
border-bottom:1px solid var(--pt-border-subtle);font-size:8.5px}
.apls .g li:last-child{border-bottom:0}
.apls .g .e{flex:none;width:20px;height:20px;border-radius:6px;display:grid;place-items:center;
font-size:10px;background:var(--pt-bg-inset)}
.apls .g .t{flex:1;min-width:0;color:var(--pt-text-primary)}
.apls .g .v{font-size:7.5px;color:var(--pt-text-muted)}
.apls .g .ch{color:var(--pt-text-muted);font-size:10px}
[dir=rtl] .apls .g .ch{transform:scaleX(-1)}
.apls [role=switch]{position:relative;width:30px;height:17px;padding:0;flex:none;border:0;
border-radius:99px;background:var(--pt-border-subtle)}
.apls [role=switch] i{position:absolute;inset-block-start:2px;inset-inline-start:2px;
width:13px;height:13px;border-radius:50%;background:var(--pt-text-muted);
transition:inset-inline-start var(--pt-motion-duration-fast) var(--pt-motion-easing-emphasized),
background var(--pt-motion-duration-fast) var(--pt-motion-easing-standard)}
.apls [role=switch][aria-checked=true]{background:var(--pt-accent)}
.apls [role=switch][aria-checked=true] i{inset-inline-start:15px;background:var(--pt-color-ink-900)}
.apls .lg{min-height:14px;margin-top:9px;font-size:7.5px;color:var(--pt-accent);text-align:center}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.apls');
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 GROUPS = [
{ g: 'الحساب', rows: [
{ e: '◔', t: 'الملفّ الشخصي', k: 'nav' },
{ e: '🔒', t: 'الأمان وكلمة المرور', k: 'nav' },
{ e: '🌐', t: 'اللغة', k: 'val', v: 'العربية' }
] },
{ g: 'التنبيهات', rows: [
{ e: '🔔', t: 'الإشعارات', k: 'sw', on: true },
{ e: '🔊', t: 'الصوت', k: 'sw', on: false },
{ e: '📳', t: 'الاهتزاز', k: 'sw', on: true }
] },
{ g: 'المظهر', rows: [
{ e: '🌗', t: 'السمة', k: 'val', v: 'حسب النظام' },
{ e: 'Aa', t: 'حجم الخطّ', k: 'val', v: 'متوسّط' }
] }
];
var wrap = root.querySelector('.groups'), lg = root.querySelector('.lg');
var VALS = { 'اللغة': ['العربية', 'English'],
'السمة': ['حسب النظام', 'فاتح', 'داكن'],
'حجم الخطّ': ['صغير', 'متوسّط', 'كبير'] };
function draw() {
wrap.innerHTML = GROUPS.map(function (G, gi) {
return '<div class="g"><b>' + G.g + '</b><ul>' + G.rows.map(function (r, ri) {
var tail = r.k === 'sw'
? '<button role="switch" aria-checked="' + r.on + '" data-g="' + gi + '" data-r="' + ri +
'" aria-label="' + r.t + '"><i></i></button>'
: r.k === 'val'
? '<span class="v">' + r.v + '</span><span class="ch" aria-hidden="true">›</span>'
: '<span class="ch" aria-hidden="true">›</span>';
var tag = r.k === 'sw' ? 'li' : 'li';
return '<' + tag + ' data-g="' + gi + '" data-r="' + ri +
(r.k !== 'sw' ? '" tabindex="0" role="button"' : '"') + '>' +
'<span class="e">' + r.e + '</span><span class="t">' + r.t + '</span>' + tail + '</li>';
}).join('') + '</ul></div>';
}).join('');
}
draw();
function act(gi, ri) {
var r = GROUPS[gi].rows[ri];
if (r.k === 'sw') { r.on = !r.on; buzz(); draw();
lg.textContent = r.t + ': ' + (r.on ? 'مفعّل' : 'موقف'); return; }
if (r.k === 'val') {
var opts = VALS[r.t] || [r.v];
r.v = opts[(opts.indexOf(r.v) + 1) % opts.length];
buzz(); draw(); lg.textContent = r.t + ': ' + r.v; return;
}
lg.textContent = (ar ? 'فتح ' : 'Opening ') + r.t;
}
wrap.addEventListener('click', function (e) {
var el = e.target.closest('[data-g]'); if (!el) return;
act(+el.dataset.g, +el.dataset.r);
});
wrap.addEventListener('keydown', function (e) {
var el = e.target.closest('li[role=button]'); if (!el) return;
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); act(+el.dataset.g, +el.dataset.r); }
});
}
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(); });
})();
# Grouped Settings List
**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:** Grouped Settings List — Titled groups with several working row types
**Why this component matters:** Give each row type the right control: a switch for instant effect, a chevron for a sub-screen, and a value for a picker — mixing them teaches the user nothing about what a tap will do.
**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.