zcatui/build.zig
reugenio e7045097e5 Add Popup/Modal and Menu widgets
Popup widget:
- Floating overlay with optional backdrop dimming
- Configurable size and position (or centered)
- Block wrapper support

Modal widget:
- Title, message, and action buttons
- Keyboard navigation (Tab/arrows to switch buttons)
- Helper functions: confirmDialog, alertDialog, yesNoCancelDialog

Menu widgets:
- MenuItem: action, separator, submenu, toggle types
- Menu: Dropdown menu with selection navigation
- MenuBar: Horizontal menu bar with dropdown support
- Shortcut display support
- Enabled/disabled state

Example: menu_demo.zig with interactive menu bar and dialogs

Tests: 11 tests for popup/menu, all pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 16:52:38 +01:00

197 lines
6.7 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Módulo de la librería
const zcatui_mod = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
// Tests
const unit_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Ejecutar tests");
test_step.dependOn(&run_unit_tests.step);
// Ejemplo: hello
const hello_exe = b.addExecutable(.{
.name = "hello",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/hello.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(hello_exe);
const run_hello = b.addRunArtifact(hello_exe);
run_hello.step.dependOn(b.getInstallStep());
const hello_step = b.step("hello", "Ejecutar ejemplo hello");
hello_step.dependOn(&run_hello.step);
// Ejemplo: events_demo
const events_demo_exe = b.addExecutable(.{
.name = "events-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/events_demo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(events_demo_exe);
const run_events_demo = b.addRunArtifact(events_demo_exe);
run_events_demo.step.dependOn(b.getInstallStep());
const events_demo_step = b.step("events-demo", "Run events demo");
events_demo_step.dependOn(&run_events_demo.step);
// Ejemplo: list_demo
const list_demo_exe = b.addExecutable(.{
.name = "list-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/list_demo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(list_demo_exe);
const run_list_demo = b.addRunArtifact(list_demo_exe);
run_list_demo.step.dependOn(b.getInstallStep());
const list_demo_step = b.step("list-demo", "Run list demo");
list_demo_step.dependOn(&run_list_demo.step);
// Ejemplo: table_demo
const table_demo_exe = b.addExecutable(.{
.name = "table-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/table_demo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(table_demo_exe);
const run_table_demo = b.addRunArtifact(table_demo_exe);
run_table_demo.step.dependOn(b.getInstallStep());
const table_demo_step = b.step("table-demo", "Run table demo");
table_demo_step.dependOn(&run_table_demo.step);
// Ejemplo: dashboard
const dashboard_exe = b.addExecutable(.{
.name = "dashboard",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/dashboard.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(dashboard_exe);
const run_dashboard = b.addRunArtifact(dashboard_exe);
run_dashboard.step.dependOn(b.getInstallStep());
const dashboard_step = b.step("dashboard", "Run dashboard demo");
dashboard_step.dependOn(&run_dashboard.step);
// Ejemplo: input_demo
const input_demo_exe = b.addExecutable(.{
.name = "input-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/input_demo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(input_demo_exe);
const run_input_demo = b.addRunArtifact(input_demo_exe);
run_input_demo.step.dependOn(b.getInstallStep());
const input_demo_step = b.step("input-demo", "Run input demo");
input_demo_step.dependOn(&run_input_demo.step);
// Ejemplo: animation_demo
const animation_demo_exe = b.addExecutable(.{
.name = "animation-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/animation_demo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(animation_demo_exe);
const run_animation_demo = b.addRunArtifact(animation_demo_exe);
run_animation_demo.step.dependOn(b.getInstallStep());
const animation_demo_step = b.step("animation-demo", "Run animation demo");
animation_demo_step.dependOn(&run_animation_demo.step);
// Ejemplo: clipboard_demo
const clipboard_demo_exe = b.addExecutable(.{
.name = "clipboard-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/clipboard_demo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(clipboard_demo_exe);
const run_clipboard_demo = b.addRunArtifact(clipboard_demo_exe);
run_clipboard_demo.step.dependOn(b.getInstallStep());
const clipboard_demo_step = b.step("clipboard-demo", "Run clipboard demo");
clipboard_demo_step.dependOn(&run_clipboard_demo.step);
// Ejemplo: menu_demo
const menu_demo_exe = b.addExecutable(.{
.name = "menu-demo",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/menu_demo.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "zcatui", .module = zcatui_mod },
},
}),
});
b.installArtifact(menu_demo_exe);
const run_menu_demo = b.addRunArtifact(menu_demo_exe);
run_menu_demo.step.dependOn(b.getInstallStep());
const menu_demo_step = b.step("menu-demo", "Run menu demo");
menu_demo_step.dependOn(&run_menu_demo.step);
}