Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nasal-canvas-gui

БесплатноБез исполняемых скриптовНе проверен

Provides patterns for Nasal Canvas GUI — dialogs, windows, layouts, widgets, events, and message boxes.

container32от container32155 установок в других каталогах

Об этом скилле

Canvas GUI

Canvas GUI is a framework for modern UI drawn using Canvas.

Dialogs

Canvas dialogs are Nasal objects that build a canvas.Window, attach a canvas and a root group, populate it with canvas.gui.widgets.* instances through layouts, and return a table (m) that owns the whole tree.

Skeleton

Every dialog follows this shape:

var MyDialog = {
  new: func(width=400, height=300) {
    var m = {
      parents: [MyDialog],
      window: canvas.Window.new([width, height], "dialog")
    };

    m.window.set("title", "My Dialog")
            .setBool("resize", 1);

    m.root = m.window.getCanvas(1)
                    .set("background", canvas.style.getColor("bg_color"))
                    .createGroup();

    m.vbox = canvas.VBoxLayout.new();
    m.window.setLayout(m.vbox);

    # ... add widgets here ...

    var hint = m.vbox.sizeHint();
    hint[0] = math.max(width, hint[0]);
    m.window.setSize(hint);

    return m;
  },

  del: func {
    me.window.del();
  }
};

var dialog = MyDialog.new();

Rules the skeleton encodes:

  • Every handle you later need (window, root, layouts, widgets) is stored on the object so del and callbacks can reach it.
  • m.parents: [MyDialog] gives the object inheritance, so methods defined on MyDialog (del, helpers) are callable as me.foo().
  • getCanvas(1) creates the canvas if it does not exist. createCanvas() also works but additionally installs a mousedown listener and a placement.
  • Set the background on the canvas, not the group.
  • setLayout on the window makes the top-level layout drive the canvas size.
  • Finish with setSize(hint) so the window fits its content instead of clipping.

Window

canvas.Window.new([w, h], type) — type is "dialog" for a decorated, movable window; omit it for a borderless overlay.

Call Effect
set("title", s) / setTitle(s) titlebar text
setBool("resize", 1) allow user resizing
set("resize", 1) same property via generic setter
setPosition([x, y]) (0,0) = top-left of screen
setSize(w, h) or setSize([w, h]) content size; calls onResize if defined
move(x, y) relative move
raise() bump z-index and focus
setFocus() / clearFocus() focus bookkeeping with gui
getSize() [w, h]
del() destroy; canvas survives if other placements reference it

setBool("capture-events", 0) makes the window click-through.

Layouts

Layouts own geometry; widgets are added with addItem, never positioned by hand.

var vbox = canvas.VBoxLayout.new();
var hbox = canvas.HBoxLayout.new();

vbox.setSpacing(0);
vbox.setContentsMargin(10);
vbox.addItem(someWidget);
hbox.addItem(vbox);
  • Nest layouts to compose rows inside columns.
  • sizeHint() returns [w, h] — feed it to window.setSize().
  • ScrollArea is a widget, not a layout: give it a layout via setLayout() and add children to scrollArea.getContent().
  • TabWidget is also a container: widgets added to a tab go on tabWidget.getContent(), and the tab body is a layout passed to addTab.

BoxLayout also exposes addStretch(), addSpacing(n), insertItem(i, item, stretch), setStretchFactor(item, n), setSpacing(n).

Use addStretch() to push a button row to the bottom of a VBox. ScrollArea and TabWidget expose getContent(); widgets inside a scroll area or tab are parented to that content group and placed in a layout assigned with scrollArea.setLayout(l).

Widgets

Construct as canvas.gui.widgets.<Type>.new(parent, canvas.style, cfg), then chain setters. parent must be the container element the widget lives in — usually the tab content or the root group, not the layout object.

Widget Notable cfg / methods
Button setText, setFixedSize, setCheckable(1), setChecked(0), event clicked / toggled
Label setText, setImage, setBackground, setAlignment(canvas.AlignBottom), setVisible(0)
CheckBox setText, cfg "label-position": "left", event toggled
PropertyCheckBox cfg "node": props.globals.getNode("/path") — binds to a property
RadioButton cfg "parent-radio": otherRadio; event group-checked-radio-changed; getRadioButtonsGroup().getCheckedRadio()
Switch setChecked(1), event toggled
Slider cfg "max-value", "page-size", "tick-step", "value-style": gui.widgets.Slider.ValueStyle.Moving, "value-position", "ticks-position"
Dial cfg "min-value", "max-value", "step-size", "value", "value-format": "%.1f", "wrap", "show-value", "show-ticks"; setters setShowValue, setShowTicks, setWrap
ComboBox addMenuItem(text, id), setFixedSize
List createItem(text), getSelectedItems(), setSizeHint([List._MAX_SIZE, List._MAX_SIZE]), event selection-changed
LineEdit single-line text input, setText
ScrollArea setLayout, getContent(), `setSizeHi
Полный SKILL.md на ClawHub

Установить nasal-canvas-gui в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл nasal-canvas-gui?

Provides patterns for Nasal Canvas GUI — dialogs, windows, layouts, widgets, events, and message boxes.

Как установить скилл nasal-canvas-gui?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nasal-canvas-gui запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить nasal-canvas-gui с