Логотип Forge Auto Widget Layout

Forge Auto Widget Layout

Спільнота
Nebulavenus
forge-auto-widget-layout

Add automatic widget layout to a ForgeUiContext application. Replace manual rect calculations with a stack-based cursor model supporting vertical/horizontal directions, padding, spacing, and nesting.

Огляд

ВидавецьNebulavenus
Репозиторійforge-gpu
Назва навичкиforge-auto-widget-layout
Зірки
46
Форки
7
Файли в пакеті
Лише інструкції
ЛіцензіяZlib
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Усе необхідне — в інструкціях

    Усе потрібне моделі міститься в інструкціях — жодних додаткових файлів для синхронізації.

  • Відкритий вихідний код

    Видавець на GitHub: Nebulavenus. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Forge Auto Widget Layout у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-auto-widget-layout
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nebulavenus/forge-gpu.git /tmp/forge-gpu
mkdir -p .claude/skills
cp -r /tmp/forge-gpu/.claude/skills/forge-auto-widget-layout .claude/skills/forge-auto-widget-layout
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Forge Auto Widget Layout в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Forge Auto Widget Layout, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Forge Auto Widget Layout не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Add automatic widget positioning to any application that uses ForgeUiContext. Based on UI Lesson 08.

When to use

  • You have an immediate-mode UI with manually computed widget rects and want to automate placement
  • You need a vertical panel of stacked widgets (labels, checkboxes, sliders)
  • You need a horizontal row of buttons or controls side by side
  • You need nested layouts (a vertical panel containing a horizontal button row)
  • You want to change padding or add/remove widgets without recalculating every rect by hand

Key API calls

  • forge_ui_ctx_layout_push(ctx, rect, direction, padding, spacing) — push a layout region onto the stack
  • forge_ui_ctx_layout_pop(ctx) — pop and return to the parent layout
  • forge_ui_ctx_layout_next(ctx, size) — return the next widget rect and advance the cursor
  • forge_ui_ctx_label_layout(ctx, text, size, r, g, b, a) — label placed by the current layout
  • forge_ui_ctx_button_layout(ctx, id, text, size) — button placed by the current layout
  • forge_ui_ctx_checkbox_layout(ctx, id, label, value, size) — checkbox placed by the current layout
  • forge_ui_ctx_slider_layout(ctx, id, value, min, max, size) — slider placed by the current layout

Correct order

  1. Push a layout with a bounding rect, direction, padding, and spacing
  2. Declare widgets using _layout() variants — each call advances the cursor automatically
  3. For nested layouts: call layout_next() to reserve a sub-rect from the parent, then layout_push() inside that rect
  4. Pop nested layouts before continuing in the parent
  5. Pop the root layout when done

Every layout_push() must have a matching layout_pop() — including on error paths. Unmatched pushes are logged as warnings by forge_ui_ctx_end().

Key concepts

  1. Layout cursor — a position (x, y) that starts at the top-left content area (after padding) and advances after each widget
  2. Direction — FORGE_UI_LAYOUT_VERTICAL advances downward (widgets get full width, caller specifies height); FORGE_UI_LAYOUT_HORIZONTAL advances rightward (widgets get full height, caller specifies width)
  3. Padding — uniform inset from all four edges of the layout rect
  4. Spacing — gap inserted before each widget except the first
  5. Size parameter — the widget dimension along the layout's primary axis (height for vertical, width for horizontal); the cross-axis dimension is filled automatically
  6. Layout stack — up to FORGE_UI_LAYOUT_MAX_DEPTH (8) nested layouts
  7. Spacing-before-item model — spacing is added before each item (except the first), keeping remaining_h/remaining_w accurate

Common mistakes

  1. Forgetting layout_pop() — every push needs a pop on every code path, including early returns from failed nested pushes
  2. Using standard widget API inside a layout — use _layout() variants (button_layout, checkbox_layout) to get automatic positioning; the standard API (button, checkbox) still requires explicit rects
  3. Wrong size parameter — in a vertical layout, size is height; in a horizontal layout, size is width. Passing the wrong dimension produces unexpectedly stretched or squished widgets
  4. Not reserving a sub-rect for nested layouts — call layout_next(row_h) first to get the sub-rect, then push a new layout inside it. Pushing a layout with the full parent rect would overlap existing widgets
  5. Exceeding stack depth — layout_push() returns false if the stack overflows (8 levels max). Always check the return value

Ready-to-use template

Vertical panel with mixed widgets

c
#define PANEL_PADDING    16.0f   /* inset from panel edges */
#define WIDGET_SPACING    8.0f   /* vertical gap between widgets */
#define LABEL_HEIGHT     30.0f   /* height of a label row */
#define CHECKBOX_HEIGHT  28.0f   /* height of a checkbox row */
#define BUTTON_HEIGHT    34.0f   /* height of a button */
#define SLIDER_HEIGHT    32.0f   /* height of a slider */
#define BUTTON_SPACING   10.0f   /* horizontal gap between buttons */

ForgeUiRect panel = { x, y, w, h };

/* Draw panel background */
forge_ui__emit_rect(ctx, panel, bg_r, bg_g, bg_b, bg_a);

/* Push vertical layout for the panel */
if (!forge_ui_ctx_layout_push(ctx, panel,
                              FORGE_UI_LAYOUT_VERTICAL,
                              PANEL_PADDING, WIDGET_SPACING)) {
    return;
}

/* Title label */
forge_ui_ctx_label_layout(ctx, "Settings", LABEL_HEIGHT,
                          title_r, title_g, title_b, title_a);

/* Checkboxes */
(void)forge_ui_ctx_checkbox_layout(ctx, ID_CB_1, "Option A",
                                   &option_a, CHECKBOX_HEIGHT);
(void)forge_ui_ctx_checkbox_layout(ctx, ID_CB_2, "Option B",
                                   &option_b, CHECKBOX_HEIGHT);

/* Horizontal button row */
ForgeUiRect btn_row = forge_ui_ctx_layout_next(ctx, BUTTON_HEIGHT);

if (!forge_ui_ctx_layout_push(ctx, btn_row,
                              FORGE_UI_LAYOUT_HORIZONTAL,
                              0.0f, BUTTON_SPACING)) {
    forge_ui_ctx_layout_pop(ctx);  /* pop outer before returning */
    return;
}

float btn_w = (btn_row.w - BUTTON_SPACING) * 0.5f;
(void)forge_ui_ctx_button_layout(ctx, ID_BTN_OK, "OK", btn_w);
(void)forge_ui_ctx_button_layout(ctx, ID_BTN_CANCEL, "Cancel", btn_w);

forge_ui_ctx_layout_pop(ctx);  /* end horizontal row */

/* Slider */
(void)forge_ui_ctx_slider_layout(ctx, ID_SLIDER, &value,
                                 0.0f, 100.0f, SLIDER_HEIGHT);

forge_ui_ctx_layout_pop(ctx);  /* end vertical panel */

Key observations

  • The 0.5f in btn_w is inherent math (dividing by 2), not a magic number
  • layout_next() returns a rect from the outer vertical layout, which becomes the bounds for the inner horizontal layout
  • The inner layout_push error path pops the outer layout before returning
  • Widget return values can be (void) cast when the result is not needed

Reference

Поширені запитання

Що робить навичка ШІ Forge Auto Widget Layout?

Add automatic widget layout to a ForgeUiContext application. Replace manual rect calculations with a stack-based cursor model supporting vertical/horizontal directions, padding, spacing, and nesting.

Навіщо використовувати Forge Auto Widget Layout у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Forge Auto Widget Layout — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Forge Auto Widget Layout у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-auto-widget-layout. TypingMind прочитає файл SKILL.md і встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Forge Auto Widget Layout?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Forge Auto Widget Layout?

Зі скількома забажаєте. У TypingMind ви можете використовувати Forge Auto Widget Layout із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Forge Auto Widget Layout?

Так. На GitHub цю навичку публікує Nebulavenus за ліцензією Zlib. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇