Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6c0aa36
Implement AlloyScript runtime and bindings
google-labs-jules[bot] Mar 29, 2026
e8318d1
Implement AlloyScript runtime with Shell scripting API
google-labs-jules[bot] Mar 29, 2026
fd9b26c
Finalize AlloyScript runtime and Shell API with native built-ins
google-labs-jules[bot] Mar 29, 2026
3a7b2e3
Implement AlloyScript runtime with comprehensive tests and native bui…
google-labs-jules[bot] Mar 29, 2026
4a35b3a
feat: Implement AlloyScript SQLite runtime
yumin-chen Mar 29, 2026
993c979
feat: Finalize AlloyScript SQLite runtime with PR feedback
yumin-chen Mar 29, 2026
a06f252
feat: Complete AlloyScript SQLite runtime with full metadata and Driz…
yumin-chen Mar 29, 2026
98016c6
feat: AlloyScript SQLite runtime with Bun integration and build system
yumin-chen Mar 29, 2026
f1becf1
feat: Implement AlloyScript Native GUI and source-built SQLite
yumin-chen Mar 30, 2026
6ea8841
feat: Direct SQLite source dependency for AlloyScript
yumin-chen Mar 30, 2026
4b2edc5
feat: Final AlloyScript runtime with native GUI and SQLite source
yumin-chen Mar 30, 2026
87bb00b
Implement AlloyScript runtime with SQLite and native GUI support
yumin-chen Mar 30, 2026
eabf0c0
Refine AlloyScript runtime with modular GUI implementation and fixed …
yumin-chen Mar 31, 2026
512ed7d
Implement Secure AlloyScript Engine with Dual Runtimes and Secure IPC
yumin-chen Apr 1, 2026
5f2d00d
Implement Secure Dual-Engine AlloyScript Runtime with Transpiler Support
yumin-chen Apr 1, 2026
64dd41a
Finalize Secure Dual-Engine AlloyScript Engine with REPL and Advanced…
yumin-chen Apr 1, 2026
d04c58f
Implement AlloyScript Dual-Engine Runtime
yumin-chen Apr 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions cmake/webview.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,39 @@ macro(webview_find_dependencies)

list(APPEND WEBVIEW_DEPENDENCIES PkgConfig::WEBVIEW_WEBKITGTK PkgConfig::WEBVIEW_GTK dl)
endif()

webview_setup_sqlite()
list(APPEND WEBVIEW_DEPENDENCIES sqlite3)

webview_fetch_yoga()
list(APPEND WEBVIEW_DEPENDENCIES yoga)
endmacro()

function(webview_setup_sqlite)
# Using the vendored SQLite amalgamation
add_library(sqlite3 STATIC
"${PROJECT_SOURCE_DIR}/core/sqlite/sqlite3.c"
)
target_include_directories(sqlite3 PUBLIC "${PROJECT_SOURCE_DIR}/core/sqlite")
target_compile_definitions(sqlite3 PRIVATE
SQLITE_ENABLE_SERIALIZE
SQLITE_ENABLE_COLUMN_METADATA
)
if(UNIX)
target_link_libraries(sqlite3 PRIVATE dl pthread)
endif()
endfunction()

function(webview_fetch_yoga)
include(FetchContent)
FetchContent_Declare(
yoga
GIT_REPOSITORY https://github.com/facebook/yoga.git
GIT_TAG v2.0.1
)
FetchContent_MakeAvailable(yoga)
endfunction()

function(webview_fetch_mswebview2 VERSION)
cmake_policy(PUSH)
# Avoid warning related to FetchContent and DOWNLOAD_EXTRACT_TIMESTAMP
Expand Down
15 changes: 13 additions & 2 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ target_include_directories(
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
target_link_libraries(webview_core_headers INTERFACE ${WEBVIEW_DEPENDENCIES})
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(webview_core_headers INTERFACE util)
endif()

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/mquickjs")
target_include_directories(webview_core_headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/vendor/mquickjs")
target_compile_definitions(webview_core_headers INTERFACE WEBVIEW_USE_MJS)
# Note: Implementation files would need to be added to GUI_SOURCES or similar if we were to build them here
endif()
# Note that we also use CMAKE_CXX_STANDARD which can override this
target_compile_features(webview_core_headers INTERFACE cxx_std_11)
set_target_properties(webview_core_headers PROPERTIES
Expand All @@ -20,7 +29,8 @@ endif()
if(WEBVIEW_BUILD_SHARED_LIBRARY)
add_library(webview_core_shared SHARED)
add_library(webview::core_shared ALIAS webview_core_shared)
target_sources(webview_core_shared PRIVATE src/webview.cc)
file(GLOB GUI_SOURCES src/gui/*.cc)
target_sources(webview_core_shared PRIVATE src/webview.cc ${GUI_SOURCES})
target_link_libraries(webview_core_shared PUBLIC webview_core_headers)
set_target_properties(webview_core_shared PROPERTIES
OUTPUT_NAME webview
Expand All @@ -43,7 +53,8 @@ if(WEBVIEW_BUILD_STATIC_LIBRARY)

add_library(webview_core_static STATIC)
add_library(webview::core_static ALIAS webview_core_static)
target_sources(webview_core_static PRIVATE src/webview.cc)
file(GLOB GUI_SOURCES src/gui/*.cc)
target_sources(webview_core_static PRIVATE src/webview.cc ${GUI_SOURCES})
target_link_libraries(webview_core_static PUBLIC webview_core_headers)
set_target_properties(webview_core_static PROPERTIES
OUTPUT_NAME "${STATIC_LIBRARY_OUTPUT_NAME}"
Expand Down
202 changes: 202 additions & 0 deletions core/include/alloy/api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
#ifndef ALLOY_API_H
#define ALLOY_API_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>

#ifndef ALLOY_API
#define ALLOY_API
#endif

// ── Types ──────────────────────────────────────────────────────────────────

typedef void *alloy_component_t; // opaque component handle
typedef void *alloy_signal_t; // opaque signal handle
typedef void *alloy_computed_t; // opaque computed signal handle
typedef void *alloy_effect_t; // opaque effect handle

typedef enum {
ALLOY_OK = 0,
ALLOY_ERROR_INVALID_ARGUMENT = -1,
ALLOY_ERROR_INVALID_STATE = -2,
ALLOY_ERROR_PLATFORM = -3,
ALLOY_ERROR_BUFFER_TOO_SMALL = -4,
ALLOY_ERROR_NOT_SUPPORTED = -5,
} alloy_error_t;

typedef enum {
ALLOY_EVENT_CLICK = 0,
ALLOY_EVENT_CHANGE,
ALLOY_EVENT_CLOSE,
ALLOY_EVENT_FOCUS,
ALLOY_EVENT_BLUR,
} alloy_event_type_t;

typedef enum {
ALLOY_PROP_TEXT = 0,
ALLOY_PROP_CHECKED,
ALLOY_PROP_VALUE,
ALLOY_PROP_ENABLED,
ALLOY_PROP_VISIBLE,
ALLOY_PROP_LABEL,
} alloy_prop_id_t;

typedef void (*alloy_event_cb_t)(alloy_component_t handle,
alloy_event_type_t event,
void *userdata);

typedef struct {
unsigned int background; // RGBA packed
unsigned int foreground; // RGBA packed
float font_size; // points; 0 = inherit
const char *font_family; // NULL = inherit
float border_radius;// points
float opacity; // 0.0–1.0
} alloy_style_t;

// ── Error ──────────────────────────────────────────────────────────────────

ALLOY_API const char *alloy_error_message(alloy_error_t err);

// ── Signal system ──────────────────────────────────────────────────────────

ALLOY_API alloy_signal_t alloy_signal_create_str(const char *initial);
ALLOY_API alloy_signal_t alloy_signal_create_double(double initial);
ALLOY_API alloy_signal_t alloy_signal_create_int(int initial);
ALLOY_API alloy_signal_t alloy_signal_create_bool(int initial);

ALLOY_API alloy_error_t alloy_signal_set_str(alloy_signal_t s, const char *v);
ALLOY_API alloy_error_t alloy_signal_set_double(alloy_signal_t s, double v);
ALLOY_API alloy_error_t alloy_signal_set_int(alloy_signal_t s, int v);
ALLOY_API alloy_error_t alloy_signal_set_bool(alloy_signal_t s, int v);

ALLOY_API const char *alloy_signal_get_str(alloy_signal_t s);
ALLOY_API double alloy_signal_get_double(alloy_signal_t s);
ALLOY_API int alloy_signal_get_int(alloy_signal_t s);
ALLOY_API int alloy_signal_get_bool(alloy_signal_t s);

ALLOY_API alloy_computed_t alloy_computed_create(
alloy_signal_t *deps, size_t dep_count,
void (*compute)(alloy_signal_t *deps, size_t dep_count, void *out, void *userdata),
void *userdata);

ALLOY_API alloy_effect_t alloy_effect_create(
alloy_signal_t *deps, size_t dep_count,
void (*run)(void *userdata), void *userdata);

ALLOY_API alloy_error_t alloy_signal_destroy(alloy_signal_t s);
ALLOY_API alloy_error_t alloy_computed_destroy(alloy_computed_t c);
ALLOY_API alloy_error_t alloy_effect_destroy(alloy_effect_t e);

// ── Property binding ───────────────────────────────────────────────────────

ALLOY_API alloy_error_t alloy_bind_property(alloy_component_t component,
alloy_prop_id_t property,
alloy_signal_t signal);
ALLOY_API alloy_error_t alloy_unbind_property(alloy_component_t component,
alloy_prop_id_t property);

// ── Component lifecycle ────────────────────────────────────────────────────

ALLOY_API alloy_component_t alloy_create_window(const char *title,
int width, int height);
ALLOY_API alloy_component_t alloy_create_button(alloy_component_t parent, const char* label);
ALLOY_API alloy_component_t alloy_create_textfield(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_textarea(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_label(alloy_component_t parent, const char* text);
ALLOY_API alloy_component_t alloy_create_checkbox(alloy_component_t parent, const char* label);
ALLOY_API alloy_component_t alloy_create_radiobutton(alloy_component_t parent, const char* label, const char* name, const char* value);
ALLOY_API alloy_component_t alloy_create_combobox(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_slider(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_progressbar(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_tabview(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_listview(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_treeview(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_webview(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_vstack(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_hstack(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_scrollview(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_spinner(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_menubar(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_menu(alloy_component_t parent, const char* label);
ALLOY_API alloy_component_t alloy_create_menuitem(alloy_component_t parent, const char* label);
ALLOY_API alloy_component_t alloy_create_toolbar(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_statusbar(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_splitter(alloy_component_t parent, int vertical);
ALLOY_API alloy_component_t alloy_create_dialog(alloy_component_t parent, const char* title);
ALLOY_API alloy_component_t alloy_create_image(alloy_component_t parent, const char* src);
ALLOY_API alloy_component_t alloy_create_groupbox(alloy_component_t parent, const char* label);
ALLOY_API alloy_component_t alloy_create_switch(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_datepicker(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_colorpicker(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_link(alloy_component_t parent, const char* text, const char* url);
ALLOY_API alloy_component_t alloy_create_timepicker(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_tooltip(alloy_component_t parent, const char* text);
ALLOY_API alloy_component_t alloy_create_divider(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_icon(alloy_component_t parent, const char* name);
ALLOY_API alloy_component_t alloy_create_separator(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_accordion(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_popover(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_contextmenu(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_badge(alloy_component_t parent, const char* text);
ALLOY_API alloy_component_t alloy_create_chip(alloy_component_t parent, const char* label);
ALLOY_API alloy_component_t alloy_create_loading_spinner(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_card(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_rating(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_richtexteditor(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_codeeditor(alloy_component_t parent);
ALLOY_API alloy_component_t alloy_create_file_dialog(alloy_component_t parent, int save);

ALLOY_API alloy_error_t alloy_destroy(alloy_component_t handle);

// ── Property getters/setters ───────────────────────────────────────────────

ALLOY_API alloy_error_t alloy_set_text(alloy_component_t h, const char *text);
ALLOY_API alloy_error_t alloy_get_text(alloy_component_t h,
char *buf, size_t buf_len);
ALLOY_API alloy_error_t alloy_set_checked(alloy_component_t h, int checked);
ALLOY_API int alloy_get_checked(alloy_component_t h);
ALLOY_API alloy_error_t alloy_set_value(alloy_component_t h, double value);
ALLOY_API double alloy_get_value(alloy_component_t h);
ALLOY_API alloy_error_t alloy_set_enabled(alloy_component_t h, int enabled);
ALLOY_API int alloy_get_enabled(alloy_component_t h);
ALLOY_API alloy_error_t alloy_set_visible(alloy_component_t h, int visible);
ALLOY_API int alloy_get_visible(alloy_component_t h);
ALLOY_API alloy_error_t alloy_set_style(alloy_component_t h,
const alloy_style_t *style);

// ── Layout ─────────────────────────────────────────────────────────────────

ALLOY_API alloy_error_t alloy_add_child(alloy_component_t container,
alloy_component_t child);
ALLOY_API alloy_error_t alloy_set_flex(alloy_component_t h, float flex);
ALLOY_API alloy_error_t alloy_set_padding(alloy_component_t h,
float top, float right,
float bottom, float left);
ALLOY_API alloy_error_t alloy_set_margin(alloy_component_t h,
float top, float right,
float bottom, float left);
ALLOY_API alloy_error_t alloy_layout(alloy_component_t window);

// ── Events ─────────────────────────────────────────────────────────────────

ALLOY_API alloy_error_t alloy_set_event_callback(alloy_component_t handle,
alloy_event_type_t event,
alloy_event_cb_t callback,
void *userdata);

// ── Event loop ─────────────────────────────────────────────────────────────

ALLOY_API alloy_error_t alloy_run(alloy_component_t window);
ALLOY_API alloy_error_t alloy_terminate(alloy_component_t window);
ALLOY_API alloy_error_t alloy_dispatch(alloy_component_t window,
void (*fn)(void *arg), void *arg);

#ifdef __cplusplus
}
#endif

#endif // ALLOY_API_H
Loading