@xframes/node 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CMakeLists.txt CHANGED
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.15)
2
2
  cmake_policy(SET CMP0091 NEW)
3
3
  cmake_policy(SET CMP0042 NEW)
4
4
 
5
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
6
+
5
7
  if(NOT CMAKE_GENERATOR)
6
8
  set(CMAKE_GENERATOR "Ninja")
7
9
  endif()
@@ -34,6 +36,56 @@ find_package(glfw3 CONFIG REQUIRED)
34
36
  find_package(ada CONFIG REQUIRED)
35
37
  find_package(Stb REQUIRED)
36
38
  find_package(fmt CONFIG REQUIRED)
39
+ find_package(JPEG REQUIRED)
40
+ find_package(PNG REQUIRED)
41
+ find_package(TIFF REQUIRED)
42
+ find_package(CURL REQUIRED)
43
+ find_package(nlohmann_json REQUIRED)
44
+ find_package(qjs CONFIG REQUIRED)
45
+ find_package(Lua REQUIRED)
46
+ find_package(sol2 CONFIG REQUIRED)
47
+
48
+ # --- Janet 3-stage bootstrap ---
49
+ set(JANET_ROOT "${DEPS}/janet")
50
+ set(JANET_SRC_DIR "${JANET_ROOT}/src")
51
+ file(GLOB JANET_CORE_SOURCES "${JANET_SRC_DIR}/core/*.c")
52
+ file(GLOB JANET_BOOT_SOURCES "${JANET_SRC_DIR}/boot/*.c")
53
+ set(JANET_NO_FLAGS JANET_NO_EV JANET_NO_FFI JANET_NO_NET JANET_NO_DYNAMIC_MODULES)
54
+
55
+ # Stage 1: bootstrap interpreter
56
+ add_executable(janet_boot ${JANET_CORE_SOURCES} ${JANET_BOOT_SOURCES})
57
+ target_include_directories(janet_boot PRIVATE "${JANET_SRC_DIR}/include" "${JANET_SRC_DIR}/conf")
58
+ target_compile_definitions(janet_boot PRIVATE JANET_BOOTSTRAP ${JANET_NO_FLAGS})
59
+ if(WIN32)
60
+ target_compile_definitions(janet_boot PRIVATE _CRT_SECURE_NO_WARNINGS)
61
+ target_link_libraries(janet_boot PRIVATE ws2_32)
62
+ endif()
63
+
64
+ # Stage 2: generate core image
65
+ set(JANET_IMAGE_FILE "${CMAKE_BINARY_DIR}/janet_core_image.c")
66
+ add_custom_command(
67
+ OUTPUT "${JANET_IMAGE_FILE}"
68
+ COMMAND ${CMAKE_COMMAND} -E env "$<TARGET_FILE:janet_boot>" "${JANET_ROOT}" image-only > "${JANET_IMAGE_FILE}"
69
+ DEPENDS janet_boot "${JANET_ROOT}/src/boot/boot.janet"
70
+ COMMENT "Generating Janet core image"
71
+ )
72
+
73
+ # Stage 3: static library (JANET_SINGLE_THREADED: janet_init sets thread-local VM;
74
+ # XFrames calls InitJanet on JS thread but Render on render thread)
75
+ add_library(janet_core STATIC ${JANET_CORE_SOURCES} "${JANET_IMAGE_FILE}")
76
+ target_include_directories(janet_core PUBLIC "${JANET_SRC_DIR}/include" "${JANET_SRC_DIR}/conf")
77
+ target_compile_definitions(janet_core PRIVATE ${JANET_NO_FLAGS} JANET_SINGLE_THREADED)
78
+ if(WIN32)
79
+ target_compile_definitions(janet_core PRIVATE _CRT_SECURE_NO_WARNINGS)
80
+ target_link_libraries(janet_core PRIVATE ws2_32)
81
+ endif()
82
+
83
+ # Auto-copy core image for WASM builds
84
+ add_custom_command(TARGET janet_core POST_BUILD
85
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/../../cpp/app/generated"
86
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${JANET_IMAGE_FILE}" "${CMAKE_CURRENT_SOURCE_DIR}/../../cpp/app/generated/janet_core_image.c"
87
+ COMMENT "Copying Janet core image to app/generated/ for WASM"
88
+ )
37
89
 
38
90
  include_directories(${CMAKE_JS_INC})
39
91
 
@@ -41,6 +93,19 @@ file(GLOB YOGA_SRC CONFIGURE_DEPENDS
41
93
  ${DEPS}/yoga/yoga/*.cpp
42
94
  ${DEPS}/yoga/yoga/**/*.cpp)
43
95
 
96
+ file(GLOB LEPTONICA_SRC "${DEPS}/osm-static-map-generator/cpp/deps/leptonica/src/*.c")
97
+
98
+ # Generate endianness.h for leptonica (x64 is little-endian)
99
+ file(WRITE "${DEPS}/osm-static-map-generator/cpp/deps/leptonica/src/endianness.h" "#define L_LITTLE_ENDIAN\n")
100
+ add_compile_definitions(HAVE_LIBJPEG HAVE_LIBTIFF HAVE_LIBPNG NOMINMAX _USE_MATH_DEFINES)
101
+
102
+ set(OSM_STATIC_MAP_GENERATOR_SRC
103
+ ${DEPS}/osm-static-map-generator/cpp/shared.cpp
104
+ ${DEPS}/osm-static-map-generator/cpp/tiledownloader.cpp
105
+ ${DEPS}/osm-static-map-generator/cpp/mapgenerator.cpp
106
+ ${DEPS}/osm-static-map-generator/cpp/tilecache.cpp
107
+ )
108
+
44
109
  add_library(${PROJECT_NAME} SHARED
45
110
  ${DEPS}/css-color-parser-cpp/csscolorparser.hpp
46
111
  ${DEPS}/css-color-parser-cpp/csscolorparser.cpp
@@ -62,6 +127,7 @@ add_library(${PROJECT_NAME} SHARED
62
127
  ${APP}/src/color_helpers.cpp
63
128
  ${APP}/src/yoga_helpers.cpp
64
129
  ${APP}/src/imgui_helpers.cpp
130
+ ${APP}/src/disk_tile_cache.cpp
65
131
 
66
132
  ${APP}/src/element/layout_node.cpp
67
133
  ${APP}/src/element/element.cpp
@@ -84,6 +150,7 @@ add_library(${PROJECT_NAME} SHARED
84
150
  ${APP}/src/widget/image.cpp
85
151
  ${APP}/src/widget/input_text.cpp
86
152
  ${APP}/src/widget/item_tooltip.cpp
153
+ ${APP}/src/widget/map_view.cpp
87
154
  ${APP}/src/widget/multi_slider.cpp
88
155
  ${APP}/src/widget/plot_bar.cpp
89
156
  ${APP}/src/widget/plot_candlestick.cpp
@@ -103,9 +170,15 @@ add_library(${PROJECT_NAME} SHARED
103
170
  ${APP}/src/widget/text_wrap.cpp
104
171
  ${APP}/src/widget/tree_node.cpp
105
172
  ${APP}/src/widget/window.cpp
173
+ ${APP}/src/widget/js_canvas.cpp
174
+ ${APP}/src/widget/lua_canvas.cpp
175
+ ${APP}/src/widget/janet_canvas.cpp
106
176
 
107
177
  ./src/xframes-node.cpp
108
178
 
179
+ ${OSM_STATIC_MAP_GENERATOR_SRC}
180
+ ${LEPTONICA_SRC}
181
+
109
182
  ${SOURCE_FILES}
110
183
  ${CMAKE_JS_SRC}
111
184
  )
@@ -115,9 +188,18 @@ target_link_libraries(${PROJECT_NAME}
115
188
  ${CMAKE_JS_LIB}
116
189
  ada::ada
117
190
  fmt::fmt
191
+ nlohmann_json::nlohmann_json
192
+ JPEG::JPEG
193
+ PNG::PNG
194
+ TIFF::TIFF
195
+ CURL::libcurl
118
196
 
119
197
  glfw
120
198
  OpenGL::GL
199
+ qjs
200
+ ${LUA_LIBRARIES}
201
+ sol2::sol2
202
+ janet_core
121
203
  )
122
204
 
123
205
  # Include Node-API wrappers
@@ -147,6 +229,11 @@ target_include_directories(${PROJECT_NAME} PRIVATE
147
229
  ${DEPS}/json/include
148
230
  ${DEPS}/yoga
149
231
  ${DEPS}/glfw/include
232
+ ${DEPS}/osm-static-map-generator/cpp
233
+ ${DEPS}/osm-static-map-generator/cpp/deps/leptonica/src
234
+ ${LUA_INCLUDE_DIR}
235
+ "${DEPS}/janet/src/include"
236
+ "${DEPS}/janet/src/conf"
150
237
  )
151
238
 
152
239
  # define NAPI_VERSION
package/README.md CHANGED
@@ -47,6 +47,8 @@ render(App, resolve("./assets"), fontDefs, theme);
47
47
 
48
48
  **Data**: Table (sorting, filtering, column reorder/hide, context menus), PlotLine, PlotBar, PlotScatter, PlotHeatmap, PlotHistogram, PlotPieChart, PlotCandlestick
49
49
 
50
+ **Canvas**: JsCanvas (QuickJS), LuaCanvas (Lua/Sol2), JanetCanvas (Janet) — scripted 2D rendering with Canvas 2D API shim
51
+
50
52
  **Other**: Image, ProgressBar, ColorIndicator, ClippedMultiLineTextRenderer, ItemTooltip
51
53
 
52
54
  ## Key Features
@@ -56,6 +58,8 @@ render(App, resolve("./assets"), fontDefs, theme);
56
58
  - **Per-state styling** — base, hover, active, and disabled style variants
57
59
  - **Imperative handles** — refs for Table, Plot widgets, InputText, and more
58
60
  - **Font Awesome icons** — built-in icon support in tables and text
61
+ - **Scripted canvas rendering** — embed JavaScript, Lua, or Janet scripts for custom 2D drawing with an HTML5 Canvas 2D-style API
62
+ - **Interactive maps** — MapView widget with OpenStreetMap tiles, markers, polylines, and overlays
59
63
  - **Theme system** — runtime theme switching via `patchStyle`
60
64
  - **Prebuilt binaries** — `npm install` downloads platform-specific native addons (NAPI v9)
61
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xframes/node",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "DOM-less, GPU-accelerated GUI development for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "files": [
package/vcpkg.json CHANGED
@@ -6,6 +6,14 @@
6
6
  "ada-url",
7
7
  "fmt",
8
8
  "opengl-registry",
9
- "glfw3"
9
+ "glfw3",
10
+ "nlohmann-json",
11
+ "libjpeg-turbo",
12
+ "libpng",
13
+ "tiff",
14
+ "curl",
15
+ "quickjs-ng",
16
+ "lua",
17
+ "sol2"
10
18
  ]
11
19
  }