@xframes/node 0.0.21 → 0.1.0

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
@@ -15,6 +15,8 @@ if(NOT VCPKG_TARGET_TRIPLET)
15
15
  set(VCPKG_TARGET_TRIPLET "x64-osx")
16
16
  elseif(DEFINED ENV{ARM64_LINUX})
17
17
  set(VCPKG_TARGET_TRIPLET "arm64-linux")
18
+ elseif(DEFINED ENV{RISCV64_LINUX})
19
+ set(VCPKG_TARGET_TRIPLET "riscv64-linux")
18
20
  else()
19
21
  set(VCPKG_TARGET_TRIPLET "x64-linux")
20
22
  endif()
@@ -47,6 +49,7 @@ add_library(${PROJECT_NAME} SHARED
47
49
  ${DEPS}/imgui/imgui_draw.cpp
48
50
  ${DEPS}/imgui/imgui_widgets.cpp
49
51
  ${DEPS}/imgui/imgui_tables.cpp
52
+ ${DEPS}/imgui/misc/cpp/imgui_stdlib.cpp
50
53
  ${DEPS}/imgui/backends/imgui_impl_opengl3.cpp
51
54
  ${DEPS}/imgui/backends/imgui_impl_glfw.cpp
52
55
 
@@ -72,6 +75,7 @@ add_library(${PROJECT_NAME} SHARED
72
75
 
73
76
  ${APP}/src/widget/button.cpp
74
77
  ${APP}/src/widget/checkbox.cpp
78
+ ${APP}/src/widget/color_picker.cpp
75
79
  ${APP}/src/widget/child.cpp
76
80
  ${APP}/src/widget/clipped_multi_line_text_renderer.cpp
77
81
  ${APP}/src/widget/collapsing_header.cpp
@@ -81,10 +85,17 @@ add_library(${PROJECT_NAME} SHARED
81
85
  ${APP}/src/widget/input_text.cpp
82
86
  ${APP}/src/widget/item_tooltip.cpp
83
87
  ${APP}/src/widget/multi_slider.cpp
88
+ ${APP}/src/widget/plot_bar.cpp
84
89
  ${APP}/src/widget/plot_candlestick.cpp
90
+ ${APP}/src/widget/plot_histogram.cpp
91
+ ${APP}/src/widget/plot_heatmap.cpp
92
+ ${APP}/src/widget/plot_pie_chart.cpp
85
93
  ${APP}/src/widget/plot_line.cpp
94
+ ${APP}/src/widget/plot_scatter.cpp
86
95
  ${APP}/src/widget/separator.cpp
87
96
  ${APP}/src/widget/separator_text.cpp
97
+ ${APP}/src/widget/progress_bar.cpp
98
+ ${APP}/src/widget/color_indicator.cpp
88
99
  ${APP}/src/widget/slider.cpp
89
100
  ${APP}/src/widget/table.cpp
90
101
  ${APP}/src/widget/tabs.cpp
@@ -131,6 +142,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE
131
142
  ${DEPS}/css-color-parser-cpp
132
143
  ${DEPS}/imgui
133
144
  ${DEPS}/imgui/backends
145
+ ${DEPS}/imgui/misc/cpp
134
146
  ${DEPS}/implot
135
147
  ${DEPS}/json/include
136
148
  ${DEPS}/yoga
package/README.md CHANGED
@@ -1,39 +1,103 @@
1
- # xframes for Node.js
1
+ # @xframes/node
2
2
 
3
- ## Building
3
+ DOM-free, GPU-accelerated desktop GUI development for Node.js — powered by [Dear ImGui](https://github.com/ocornut/imgui) and [Yoga Layout](https://www.yogalayout.dev/).
4
4
 
5
- ### Windows
5
+ Write React/TypeScript components that render as native desktop widgets with zero browser overhead.
6
6
 
7
- If a prebuilt module isn't found then you will need Visual Studio 2022
7
+ ## Quick Start
8
8
 
9
- ### WSL2 - Ubuntu 24.04
9
+ ```bash
10
+ npx create-xframes-node-app
11
+ cd my-app
12
+ npm start
13
+ ```
10
14
 
11
- You may need to run `export GALLIUM_DRIVER=d3d12` before starting the application to enable Direct3D 12 rendering support.
12
- This setting is required for proper GPU acceleration in WSL2 and needs to be set in each new terminal session.
13
- You can add this line to your ~/.bashrc to make it permanent.
15
+ ## Example
14
16
 
15
- ### Linux
17
+ ```tsx
18
+ import { resolve } from "path";
19
+ import * as React from "react";
20
+ import { render, XFrames } from "@xframes/node";
16
21
 
17
- If a prebuilt module isn't found then you will need gcc 13+ to build the project locally.
22
+ const fontDefs = {
23
+ defs: [{ name: "roboto-regular", sizes: [16, 18, 20, 24] }]
24
+ .map(({ name, sizes }) => sizes.map((size) => ({ name, size })))
25
+ .flat(),
26
+ };
18
27
 
19
- Ubuntu 24.04 dependencies:
28
+ const theme = { /* ... */ };
20
29
 
21
- `sudo apt install curl zip unzip tar build-essential cmake libglfw3 libglfw3-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config`
30
+ const App = () => (
31
+ <XFrames.Node root style={{ height: "100%" }}>
32
+ <XFrames.UnformattedText text="Hello, world" />
33
+ <XFrames.Button label="Click me" onClick={() => console.log("clicked")} />
34
+ </XFrames.Node>
35
+ );
22
36
 
23
- Fedora 41 dependencies:
37
+ render(App, resolve("./assets"), fontDefs, theme);
38
+ ```
24
39
 
25
- `sudo dnf install @development-tools gcc-c++ cmake glfw-devel`
40
+ ## Available Widgets
26
41
 
27
- Raspberry Pi OS
42
+ **Input**: Button, Checkbox, Combo, InputText, Slider, MultiSlider, ColorPicker
28
43
 
29
- `sudo apt install curl zip unzip tar build-essential cmake libglfw3 libglfw3-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config`
44
+ **Text**: BulletText, DisabledText, SeparatorText, TextWrap, UnformattedText
30
45
 
31
- You must set:
46
+ **Layout**: Node, Child, Group, DIWindow, Separator, TabBar, TabItem, CollapsingHeader, TreeNode, TreeView
32
47
 
33
- `export ARM64_LINUX=1`
48
+ **Data**: Table (sorting, filtering, column reorder/hide, context menus), PlotLine, PlotBar, PlotScatter, PlotHeatmap, PlotHistogram, PlotPieChart, PlotCandlestick
34
49
 
35
- We could not work out how to detect the correct architecture so, for convenience, in CMakeLists.txt we check for this ENV variable to be set.
50
+ **Other**: Image, ProgressBar, ColorIndicator, ClippedMultiLineTextRenderer, ItemTooltip
36
51
 
37
- `export VCPKG_FORCE_SYSTEM_BINARIES=1`
52
+ ## Key Features
38
53
 
39
- It suppresses the downloading of CMake and Ninja and forces the use of the system binaries.
54
+ - **React components** familiar JSX syntax, hooks, refs, state management
55
+ - **Yoga flexbox layout** — the same layout engine used by React Native
56
+ - **Per-state styling** — base, hover, active, and disabled style variants
57
+ - **Imperative handles** — refs for Table, Plot widgets, InputText, and more
58
+ - **Font Awesome icons** — built-in icon support in tables and text
59
+ - **Theme system** — runtime theme switching via `patchStyle`
60
+ - **Prebuilt binaries** — `npm install` downloads platform-specific native addons (NAPI v9)
61
+
62
+ ## Platform Support
63
+
64
+ | Architecture | OS | Notes |
65
+ |---|---|---|
66
+ | x64-windows | Windows 11 | Works |
67
+ | x64-linux | WSL2 Ubuntu 24.04 | Set `export GALLIUM_DRIVER=d3d12` |
68
+ | x64-linux | Debian Trixie | Works |
69
+ | x64-linux | Ubuntu 22.04 / 24.04 | Works |
70
+ | arm64-linux | Raspberry Pi OS (Bookworm) | Works |
71
+
72
+ ## Building from Source
73
+
74
+ If a prebuilt binary isn't available for your platform, the native addon compiles from source during `npm install`. Requirements:
75
+
76
+ **Windows**: Visual Studio 2022
77
+
78
+ **Ubuntu 24.04**:
79
+ ```bash
80
+ sudo apt install curl zip unzip tar build-essential cmake libglfw3 libglfw3-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config
81
+ ```
82
+
83
+ **Fedora 41**:
84
+ ```bash
85
+ sudo dnf install @development-tools gcc-c++ cmake glfw-devel
86
+ ```
87
+
88
+ **Raspberry Pi OS**:
89
+ ```bash
90
+ sudo apt install curl zip unzip tar build-essential cmake libglfw3 libglfw3-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config
91
+ export ARM64_LINUX=1
92
+ export VCPKG_FORCE_SYSTEM_BINARIES=1
93
+ ```
94
+
95
+ ## Links
96
+
97
+ - [Documentation](https://xframes.dev)
98
+ - [GitHub](https://github.com/xframes-project/xframes)
99
+ - [Discord](https://discord.gg/Cbgcajdq)
100
+
101
+ ## License
102
+
103
+ MIT
package/dist/render.js CHANGED
@@ -49,7 +49,19 @@ const render = (EntryPointComponent, assetsBasePath, fontDefs, theme) => {
49
49
  value: "clicked",
50
50
  });
51
51
  };
52
- xframes.init(assetsBasePath, JSON.stringify(fontDefs), JSON.stringify(theme), onInit, onTextChange, onComboChange, onNumericValueChange, onBooleanValueChange, onMultiValueChange, onClick);
52
+ const onTableSort = (id, columnIndex, sortDirection) => {
53
+ const rootNodeID = id;
54
+ const topLevelType = "onSort";
55
+ const nativeEventParam = { columnIndex, sortDirection };
56
+ common_1.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, nativeEventParam);
57
+ };
58
+ const onTableFilter = (id, columnIndex, filterText) => {
59
+ const rootNodeID = id;
60
+ const topLevelType = "onFilter";
61
+ const nativeEventParam = { columnIndex, filterText };
62
+ common_1.ReactNativePrivateInterface.nativeFabricUIManager.dispatchEvent(rootNodeID, topLevelType, nativeEventParam);
63
+ };
64
+ xframes.init(assetsBasePath, JSON.stringify(fontDefs), JSON.stringify(theme), onInit, onTextChange, onComboChange, onNumericValueChange, onBooleanValueChange, onMultiValueChange, onClick, onTableSort, onTableFilter);
53
65
  const widgetRegistrationService = new common_1.WidgetRegistrationService(xframes);
54
66
  common_1.ReactNativePrivateInterface.nativeFabricUIManager.init(xframes, widgetRegistrationService);
55
67
  let flag = true;
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xframes/node",
3
- "version": "0.0.21",
3
+ "version": "0.1.0",
4
4
  "description": "DOM-less, GPU-accelerated GUI development for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -20,12 +20,14 @@
20
20
  },
21
21
  "scripts": {
22
22
  "install": "prebuild-install -t 9 -r napi --tag-prefix xframes-node- && npm run copy-artifacts-to-dist-folder",
23
+ "build:common": "cd ../common && npx tsup --format cjs --external react,react-dom",
24
+ "prestart": "npm run build:common && cpy --flat ../common/dist/*.* node_modules/@xframes/common/dist/",
23
25
  "start": "tsx ./src/index.tsx",
24
26
  "build:library": "rimraf ./dist && npm run tsc && npm run copy-artifacts-to-dist-folder",
25
27
  "tsc": "rimraf ./dist && tsc --project ./tsconfig-build.json",
26
28
  "tsup": "tsup --format cjs --external react",
27
29
  "copy-artifacts-to-lib-folder": "cpy --flat ./build/Release/*.* ./src/lib",
28
- "copy-artifacts-to-dist-folder": "cpy --flat ./build/Release/*.dll ./dist",
30
+ "copy-artifacts-to-dist-folder": "cpy --flat ./build/Release/*.* ./dist",
29
31
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
30
32
  "cpp:compile": "cmake-js compile && npm run copy-artifacts-to-lib-folder",
31
33
  "cpp:generate-module": "prebuild --strip --backend cmake-js -t 9 -r napi --include-regex \"\\.(node|dll|o)$\" --tag-prefix xframes-node- --verbose",
@@ -66,11 +68,10 @@
66
68
  "whatwg-fetch": "^3.6.20"
67
69
  },
68
70
  "peerDependencies": {
69
- "@xframes/common": "^0.0.13",
71
+ "@xframes/common": "^0.1.0",
70
72
  "react": "^18.2.0"
71
73
  },
72
74
  "devDependencies": {
73
- "@alpacahq/alpaca-trade-api": "^3.1.2",
74
75
  "@babel/core": "^7.24.5",
75
76
  "@babel/plugin-proposal-class-properties": "^7.18.6",
76
77
  "@babel/plugin-transform-flow-strip-types": "^7.20.0",
@@ -81,8 +82,6 @@
81
82
  "@babel/preset-typescript": "^7.24.1",
82
83
  "@fortawesome/fontawesome-free": "^6.5.2",
83
84
  "@microsoft/api-extractor": "^7.43.4",
84
- "@react-rxjs/core": "^0.10.7",
85
- "@react-rxjs/utils": "^0.9.7",
86
85
  "@types/babel__core": "^7",
87
86
  "@types/babel__preset-env": "^7",
88
87
  "@types/invariant": "^2",
@@ -100,7 +99,7 @@
100
99
  "babel-plugin-syntax-hermes-parser": "0.21.0",
101
100
  "bindings": "^1.5.0",
102
101
  "clean-webpack-plugin": "^4.0.0",
103
- "cmake-js": "^7.3.0",
102
+ "cmake-js": "^8.0.0",
104
103
  "css-loader": "^7.1.1",
105
104
  "eslint": "^8.57.0",
106
105
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -109,7 +108,7 @@
109
108
  "html-webpack-plugin": "^5.6.0",
110
109
  "inline-source-map": "^0.6.3",
111
110
  "mini-css-extract-plugin": "^2.9.0",
112
- "node-addon-api": "^8.2.1",
111
+ "node-addon-api": "^8.6.0",
113
112
  "prebuild": "^13.0.1",
114
113
  "react-native": "^0.74.1",
115
114
  "rimraf": "^5.0.6",
@@ -122,7 +121,6 @@
122
121
  "webpack": "^5.91.0",
123
122
  "webpack-cli": "^5.1.4",
124
123
  "webpack-dev-server": "^5.0.4",
125
- "yaml": "^2.4.3",
126
- "zustand": "^5.0.0-rc.2"
124
+ "yaml": "^2.4.3"
127
125
  }
128
- }
126
+ }