شعار Polycss

Polycss

مؤسسة
layoutit
polycss

Build PolyCSS scenes that render 3D meshes, primitive shapes, or custom polygons as DOM/CSS polygon elements. Use when asked to create, port, debug, or explain PolyCSS code in vanilla JavaScript, React, or Vue.

نظرة عامة

الناشرlayoutit
المستودعpolycss
اسم المهارةpolycss
النجوم
768
التفريعات
22
الملفات المرفقة
13
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 13

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها layoutit على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Polycss في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/layoutit/polycss/tree/main/packages/skills/skill
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/layoutit/polycss.git /tmp/polycss
mkdir -p .claude/skills
cp -r /tmp/polycss/packages/skills/skill .claude/skills/polycss
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Polycss في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Polycss تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Polycss بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

PolyCSS — DOM 3D Rendering

PolyCSS renders 3D polygon meshes as real DOM elements transformed with CSS matrix3d(...). No WebGL, no canvas-per-frame. It supports OBJ/MTL, STL, glTF/GLB, VOX, generated primitives, colors, textures, dynamic lighting, shadows, controls, selection, animation, and per-polygon interaction.

Use native PolyCSS when authoring PolyCSS-first scenes. Use the Three.js parity API when porting Three.js code or generating code from Three-shaped examples.

Reference docs

Read the file that matches the task before writing non-trivial code.

FileRead it when
docs/authoring-polygons.mdGenerating Polygon[] by hand. Winding, color format, coplanarity, the optimizer. Silent-failure rules.
docs/scenes-and-cameras.mdSetting up a scene, camera props, scene options, custom elements, coordinates.
docs/shapes-and-primitives.mdBoxes, spheres, planes, Platonic solids, raw polygon generators.
docs/loading-models.mdloadMesh, <PolyMesh src>, OBJ/MTL/STL/glTF/GLB/VOX, parse options.
docs/lighting.mdDirectional/ambient/point lights, baked vs dynamic, rebaking.
docs/shadows.mdcastShadow, receiveShadow, parametric shadows, renderer differences.
docs/textures.mdUV textures, the atlas pipeline, texture quality, presentation options.
docs/controls-and-interaction.mdOrbit/map/first-person controls, selection, transform gizmos, click handlers.
docs/animation.mdSkeletal clips from glTF/GLB, usePolyAnimation, stable DOM.
docs/performance.mdLeaf counts, render strategies, atlas memory, voxel fast paths.
docs/three-parity.mdPorting Three.js scenes through the */three subpaths.
docs/troubleshooting.mdSomething renders wrong. Symptom → cause table.
docs/api-index.md"Does this export exist?" Package-by-package export inventory.

Packages

PackageUse
@layoutit/polycssVanilla + custom elements. Re-exports all of core.
@layoutit/polycss-reactReact components and hooks. Re-exports core.
@layoutit/polycss-vueVue 3 mirror of React. Re-exports core.
@layoutit/polycss-corePure math and parsers, zero browser globals (Node, workers).
@layoutit/polycss-fontsText → extruded 3D Polygon[].
@layoutit/polycss-morphPrepared models with retained DOM, morphs, skinning, playback.

React and Vue depend on core only, so do not import renderer or component APIs from @layoutit/polycss in a React or Vue app — use the framework package, and take anything it does not re-export from @layoutit/polycss-core.

The one documented exception is exportPolySceneSnapshot, which lives only in @layoutit/polycss because it is browser DOM serialization rather than component API; React and Vue callers import it from there and pass the rendered element. See docs/api-index.md.

The public API is mirrored between React and Vue: same names, same defaults, idiomatic differences only (refs vs reactives).

Imports

ts
import {
  createPolyCamera,
  createPolyPerspectiveCamera,
  createPolyScene,
  createPolyOrbitControls,
  createPolyBox,
  createPolyPlane,
  loadMesh,
} from "@layoutit/polycss";
tsx
import {
  PolyCamera,
  PolyPerspectiveCamera,
  PolyScene,
  PolyMesh,
  PolyGround,
  PolyOrbitControls,
  Poly,
} from "@layoutit/polycss-react"; // or "@layoutit/polycss-vue"

Conventions

  • Coordinates are PolyCSS world space [x, y, z] with +Z up. World Y maps to CSS X (screen-right at identity rotation) and world X to CSS Y (screen-down); the default camera (rotX: 65, rotY: 45) presents that as an isometric view.
  • Camera rotations are degrees: rotX, rotY.
  • zoom is on-screen CSS pixels per world unit (default 0.65; orbit controls clamp to 0.1–10 by default). BASE_TILE (50) is the world-unit → CSS px factor; you need it when converting world units to raw CSS pixels yourself — e.g. <poly-iframe width> mounts a document width × 50 px wide.
  • PolyCamera / createPolyCamera are orthographic by default (this deliberately diverges from three.js). Use PolyPerspectiveCamera / createPolyPerspectiveCamera for depth foreshortening.
  • The camera is the outer node; the scene nests inside it. CSS perspective only applies to descendants.
  • Do not infer names from a prefix rule. Poly prefixing is a convention for newer renderer-facing components, hooks and types — not a description of the export inventory. Plenty of public names have no prefix: loadMesh, parseObj / parseStl / parseGltf / parseVox, every *Polygons generator, BASE_TILE, LoopOnce / LoopRepeat / LoopPingPong, the generic math types (Vec2, Vec3, Polygon), and the vanilla factories createSelect and createTransformControls. The */three subpaths use Three-compatible names deliberately. Check docs/api-index.md rather than guessing.

Authoring polygons — the five silent failures

A Polygon is a plain object; vertices is the only required field.

ts
interface Polygon {
  vertices: [number, number, number][];  // 3+ points, CCW seen from outside
  color?: string;                        // hex or rgb()/rgba() ONLY
  texture?: string;                      // image URL
  uvs?: [number, number][];              // one per vertex
  material?: PolyMaterial;               // shared material; material.texture wins over `texture`
  data?: Record<string, string | number | boolean>;  // → data-* attributes
}

These constraints fail with no throw and no console warning:

  1. Winding decides visibility. Vertex order sets the normal by the right-hand rule ((v1-v0) × (v2-v0)), and PolyCSS backface-culls every leaf. Wind counter-clockwise as seen from the side you want to look at.
  2. color is not a full CSS color. Only #rgb, #rrggbb, rgb(), and rgba() parse. "tomato", hsl(), and color() render white.
  3. Non-triangular polygons must be coplanar, or they are flattened onto their average plane and crack against their neighbours. Triangles are safe.
  4. The optimizer rewrites geometry by default (merge: true, meshResolution: "lossy"). Pass { merge: false } to render your array as authored.
  5. Degenerate polygons vanish silently — under 3 vertices, zero area, or a degenerate first edge.

Read docs/authoring-polygons.md in full before generating geometry — it covers per-parser winding behaviour, which entry points normalize, and the exact optimizer thresholds.

Minimal scene

Vanilla:

ts
const camera = createPolyCamera({ rotX: 65, rotY: 45 });
const scene = createPolyScene(document.getElementById("host")!, {
  camera,
  textureLighting: "dynamic",
  directionalLight: { direction: [0.5, -0.6, 0.7], color: "#ffffff", intensity: 1 },
  ambientLight: { color: "#ffffff", intensity: 0.35 },
});

createPolyOrbitControls(scene, { drag: true, wheel: true });

scene.add(createPolyBox({ size: 100, color: "#ffd166" }), { position: [0, 0, 50] });
scene.add(await loadMesh("/model.glb"), { castShadow: true });
// Vanilla has no ground fallback — a caster needs an explicit receiver.
scene.add(createPolyPlane({ axis: 2, size: 60, offset: 0, color: "#7d848e" }), { receiveShadow: true });

React (Vue mirrors this with kebab-case props):

tsx
<PolyCamera rotX={65} rotY={45}>
  <PolyScene
    textureLighting="dynamic"
    ambientLight={{ intensity: 0.35 }}
    directionalLight={{ direction: [0.5, -0.6, 0.7], intensity: 1 }}
  >
    <PolyOrbitControls drag wheel />
    <PolyMesh src="/model.glb" autoCenter castShadow />
    <PolyGround size={8} />
    {polygons.map((p, i) => <Poly key={i} {...p} onClick={() => select(i)} />)}
  </PolyScene>
</PolyCamera>

Custom elements (no build step):

html
<script type="module" src="https://esm.sh/@layoutit/polycss/elements"></script>

<poly-camera rot-x="65" rot-y="45">
  <poly-scene>
    <poly-orbit-controls drag wheel></poly-orbit-controls>
    <poly-mesh src="/model.glb"></poly-mesh>
  </poly-scene>
</poly-camera>

Rules of thumb

  • Polygon count is the dominant cost. One visible polygon = one DOM leaf, one matrix3d, one paint. Halving polygon count beats every other optimisation.
  • Never run a requestAnimationFrame loop to update many leaves. Camera, mesh, and light motion are single-ancestor CSS updates. If you find yourself writing a per-frame loop over polygons, you are fighting the engine.
  • Prefer textureLighting: "dynamic" for live or animated lights (zero JS per light change). Prefer "baked" for point lights and maximum fidelity.
  • scene.destroy() and result.dispose() release atlas blob URLs. The mesh element and usePolyMesh do it for you.

Full documentation: https://polycss.com

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Polycss؟

Build PolyCSS scenes that render 3D meshes, primitive shapes, or custom polygons as DOM/CSS polygon elements. Use when asked to create, port, debug, or explain PolyCSS code in vanilla JavaScript, React, or Vue.

لماذا تستخدم Polycss على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Polycss عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Polycss في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/layoutit/polycss/tree/main/packages/skills/skill. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Polycss؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Polycss؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Polycss معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Polycss مجانية؟

نعم. نشرها layoutit على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇