openkit-macros 0.1.3

Procedural macros for the OpenKit UI framework
Documentation

Procedural macros for the OpenKit UI framework.

This crate provides derive macros and attribute macros for building OpenKit applications with less boilerplate.

Macros

  • [Widget] - Derive macro for implementing the Widget trait
  • [Component] - Derive macro for creating Angular-like components
  • [Styleable] - Derive macro for CSS styling support
  • [#[component]] - Attribute macro for component definitions
  • [#[prop]] - Attribute macro for component properties
  • [#[state]] - Attribute macro for component state
  • [#[event]] - Attribute macro for event emitters

Examples

use openkit::prelude::*;
use openkit_macros::{Widget, Component, Styleable};

#[derive(Widget, Styleable)]
struct MyWidget {
    #[base]
    base: WidgetBase,
    label: String,
}

#[derive(Component)]
#[component(selector = "my-counter")]
struct CounterComponent {
    #[state]
    count: i32,

    #[prop(default = 1)]
    step: i32,

    #[event]
    on_change: EventEmitter<i32>,
}