ert-ui-refactor
Rules and patterns for refactoring UI components to the ERT archetype system.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
ERT UI Refactor Skill
This skill guides the refactoring of Obsidian plugin settings and modals to the Radial Timeline (ERT) UI system.
Core Principles
- Theme-First: Respect Obsidian theme variables for surfaces, borders, and typography.
-
Scoped: All custom styles MUST be under
.ert-ui. Skins (e.g.,.ert-skin--social) are nested under.ert-ui. -
Tokens: Use
--ert-*tokens for spacing and rhythm. Avoid literal pixels. -
Archetypes: Use reusable layout patterns (
ert-panel,ert-row,ert-stack). Do not use ad-hoc wrappers. - Additive: Add accents (glows, borders) rather than replacing theme surfaces.
-
Preservation: Do NOT delete legacy
rt-styles or files until the entire refactor is verified and complete. Keep them in reserve.
Refactoring Checklist
For each file (SettingsTab or Modal):
-
Add Scope Class: Ensure the top-level container has
.ert-ui.- For Modals: Add to
contentElor a wrapper div. - For Settings: Add to the main container.
- For Modals: Add to
-
Apply Archetypes:
- Replace generic
divs withert-panel,ert-row,ert-stackwhere layout dictates. - Use
ert-density--compactfor tighter spacing if needed.
- Replace generic
-
Remove Legacy Styles:
- Remove inline styles (except dynamic values).
- Remove
setting-itemor other Obsidian classes if creating a custom ERT component, BUT generic settings should generally strictly follow "Theme-First" and might just need the scope wrapper if they are standard. Correction: The guidelines say❌ .setting-item { ... }in CSS, meaning don't style them globally. But in HTML, we should use ERT archetypes if we want the ERT look. -
Clarification: If the element is a standard Obsidian setting (
new Setting(container)), leave it as is unless replacing with a custom React/HTML ERT component. The guidelines seem to focus on styling bespoke components or wrapping standard ones.
-
Tokenize Spacing:
- Ensure spacing uses vars like
var(--ert-row-gap).
- Ensure spacing uses vars like
CSS Selectors (Reference)
-
Scope:
.ert-ui -
Skins:
.ert-skin--social,.ert-skin--pro(apply to.ert-uicontainer or specific children). -
Archetypes:
-
.ert-panel: Card-like container. -
.ert-row: Flex row. -
.ert-stack: Vertical stack.
-
Example Transformation
Before:
const div = containerEl.createDiv();
div.addClass("my-custom-modal");
div.style.padding = "20px";
After:
const div = containerEl.createDiv("ert-ui"); // Scope
div.addClass("ert-panel"); // Archetype
// Spacing handled by archetype or tokens in CSS, not inline style.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-31
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!