@hanzo/ui

الخطوط

Zen وZen Mono، وسُلّم خط يقرؤه كل مكوّن، وحاوية نثر لنص لم تكتبه أنت.

الوجوه

Zen وجه القراءة؛ وZen Mono للكود والمعرّفات وكل ما هو عددي. يأتيان مع الحزمة ومربوطان بخاصيتين مخصصتين تسمّيان الدور لا الوجه:

--font-sans: var(--font-sans-provided, 'Zen', ui-sans-serif, system-ui, sans-serif);
--font-mono: var(--font-mono-provided, 'Zen Mono', ui-monospace, monospace);

تقرأ المكوّنات المتغيّرين ولا تقرأ اسم عائلة أبدًا. المُضيف الذي يفضّل وجهه يربط --font-sans-provided؛ وربط الحزمة نفسها يقعد في طبقة تتالٍ، فيفوز ربط المُضيف خارج الطبقة. والمُضيف الذي لا يربط شيئًا يأخذ Zen.

The quick brown fox jumps over the lazy dogZen at the section and body rungs, tracked and leaded for the size.pnpm add @hanzo/ui — Zen Mono for code and numbers 0123456789

السُلّم

سُلّم خط واحد، وكل مكوّن عليه. يأخذ Text القيمة fontSize="$n" مع مسافة أسطر تلك الدرجة وتتبّعها؛ وتأخذ العناوين وParagraph القيمة size="$n" وتضع الثلاثة معًا.

import { H1, H2, Paragraph, SizableText, Text } from '@hanzo/ui'

<H1>A page title</H1>
<H2 size="$6">A section</H2>
<Paragraph size="$4">Body copy at the base rung.</Paragraph>
<SizableText size="$2" color="$color11">A label.</SizableText>
<Text fontFamily="$mono" fontSize="$2">an identifier</Text>

ليس رقمًا أبدًا. fontSize={14} ثابت عند 14؛ وfontSize="$3" هو 14 اليوم وما يصنعه منه مقياس خط الشخص، لأن الدرجة تُحل عبر var(--text-base) والمقبض يضرب التدرّج. الجدول في صفحة السمات.

النثر

المحتوى المؤلَّف — حقل في نظام إدارة، أو ملف Markdown، أو متن كتلة — يصل وسومًا عارية. لا شيء داخله يستطيع حمل prop، فلا بد أن يأتي التنسيق من سلف وينزل بحسب الوسم. ApplyTypography هو ذلك السلف.

import { ApplyTypography } from '@hanzo/ui'

<ApplyTypography size="base">
  <h2>Install</h2>
  <p>
    Add the package, then wrap the app once at the root. The full guide is
    at <a href="https://ui.hanzo.ai">ui.hanzo.ai</a>.
  </p>
  <pre>
    <code>{"pnpm add @hanzo/ui\npnpm dev"}</code>
  </pre>
  <ol>
    <li>
      Render <strong>Hanzo</strong> once, around the whole tree.
    </li>
    <li>
      Import <code>Button</code> or any other component from the same
      package.
    </li>
    <li>Pass it the props its type declares.</li>
  </ol>
  <blockquote>
    Components read their colours from the theme, so a token changed there
    changes every surface at once.
  </blockquote>
</ApplyTypography>

Install

Add the package, then wrap the app once at the root. The full guide is at ui.hanzo.ai.

pnpm add @hanzo/ui
pnpm dev
  1. Render Hanzo once, around the whole tree.
  2. Import Button or any other component from the same package.
  3. Pass it the props its type declares.
Components read their colours from the theme, so a token changed there changes every surface at once.

size هي responsive افتراضيًا — الدرجة الوحيدة التي تتحرّك مع إطار العرض — أو sm أو base أو lg أو xl، وهذه تبقى مكانها، لأن المقاس الذي اختاره المستدعي قرار لا اقتراح. يختار asTag العنصر، أيًا من div وsection وnav وmain وarticle وaside. تعيش القواعد في ورقة الأنماط تحت .hz-prose، في فضاء أسماء، حتى لا يتشاجر جزء من الموقع خارج لتوّه من إضافة خطوط أخرى بورقتين على محدّد واحد. صفحة النثر تصيّر كل درجة، وحاوية متداخلة في حاوية.