{ "$schema": "../../schemas/code-crispies-module-schema.json", "id": "html-details-summary", "title": "HTML Details & Summary", "description": "أنشئ أقسام قابلة للتوسيع بدون JavaScript", "mode": "html", "difficulty": "beginner", "lessons": [ { "id": "details-summary-basic", "title": "أول عنصر تفاعلي", "description": "عنصر <details> ينشئ قسماً قابلاً للطي. عنصر <summary> يوفر التسمية القابلة للنقر.

انقر على الملخص لإظهار المحتوى المخفي - بدون JavaScript!", "task": "أنشئ عنصر <details> مع:
1. عنصر <summary> يقول Click to reveal
2. عنصر <p> بالنص This content was hidden!", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; padding: 20px; } details { border: 1px solid #ddd; border-radius: 8px; padding: 15px; } summary { font-weight: 600; cursor: pointer; } summary:hover { color: #1976d2; } details p { margin-top: 15px; color: #666; }", "sandboxCSS": "", "initialCode": "", "solution": "
\n Click to reveal\n

This content was hidden!

\n
", "previewContainer": "preview-area", "validations": [ { "type": "element_exists", "value": "details", "message": "أضف عنصر <details>" }, { "type": "element_exists", "value": "summary", "message": "أضف <summary> داخل details" }, { "type": "parent_child", "value": { "parent": "details", "child": "summary" }, "message": "يجب أن يكون <summary> داخل <details>" }, { "type": "parent_child", "value": { "parent": "details", "child": "p" }, "message": "أضف <p> داخل <details> للمحتوى المخفي" } ] }, { "id": "details-open-attribute", "title": "موسع افتراضياً", "description": "افتراضياً، <details> مغلق. أضف سمة open لإظهار المحتوى في البداية.

هذه سمة منطقية - فقط أضف open بدون قيمة.", "task": "أضف سمة open لعنصر <details> لإظهار المحتوى افتراضياً.", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; padding: 20px; } details { border: 1px solid #ddd; border-radius: 8px; padding: 15px; background: #f9f9f9; } summary { font-weight: 600; cursor: pointer; } details p { margin-top: 15px; color: #666; }", "sandboxCSS": "", "initialCode": "
\n FAQ: What is HTML5?\n

HTML5 is the latest version of the HTML standard with new semantic elements and APIs.

\n
", "solution": "
\n FAQ: What is HTML5?\n

HTML5 is the latest version of the HTML standard with new semantic elements and APIs.

\n
", "previewContainer": "preview-area", "validations": [ { "type": "attribute_value", "value": { "selector": "details", "attr": "open", "value": true }, "message": "أضف سمة open إلى <details>" } ] }, { "id": "faq-accordion", "title": "أكورديون FAQ", "description": "عناصر <details> المتعددة تنشئ FAQ بأسلوب الأكورديون. كل سؤال يمكن توسيعه بشكل مستقل.

نصيحة: اكتب details*3>summary+p واضغط Tab لتوسيع Emmet. *3 ينشئ 3 عناصر، > يضع بالداخل، + يضيف أشقاء.", "task": "أنشئ قسم FAQ مع:
1. عنصر <h1> يقول Frequently Asked Questions
2. ثلاثة عناصر <details>، كل واحد بسؤال في <summary> وإجابة في <p>", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; min-height: 100vh; background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); display: flex; flex-direction: column; justify-content: center; padding: 40px; margin: 0; box-sizing: border-box; } h1 { font-size: 2.5rem; color: #4a4a4a; text-align: center; margin: 0 0 30px 0; } details { background: white; border-radius: 12px; margin-bottom: 15px; padding: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); } summary { font-size: 1.3rem; font-weight: 600; color: #5c5c5c; cursor: pointer; list-style: none; } summary::before { content: '▸ '; color: #fcb69f; } details[open] summary::before { content: '▾ '; } details p { margin: 15px 0 0 0; color: #666; line-height: 1.6; }", "sandboxCSS": "", "initialCode": "", "solution": "

Frequently Asked Questions

\n\n
\n What is HTML5?\n

HTML5 is the latest version of HTML with new semantic elements and APIs.

\n
\n\n
\n Do I need JavaScript?\n

Many interactive features work with pure HTML5, no JavaScript required!

\n
\n\n
\n Is this accessible?\n

Yes! Native HTML elements have built-in keyboard and screen reader support.

\n
", "previewContainer": "preview-area", "validations": [ { "type": "element_exists", "value": "h1", "message": "أضف عنوان <h1> لعنوان FAQ" }, { "type": "element_count", "value": { "selector": "details", "min": 3 }, "message": "أنشئ على الأقل 3 عناصر <details> للـ FAQ" }, { "type": "element_count", "value": { "selector": "summary", "min": 3 }, "message": "كل <details> يحتاج <summary> للسؤال" }, { "type": "element_count", "value": { "selector": "details p", "min": 3 }, "message": "كل <details> يحتاج <p> للإجابة" } ] } ] }