windowpp 0.1.1 → 0.1.3
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/lib/create.js +98 -283
- package/package.json +4 -2
- package/scripts/publish.js +4 -0
- package/scripts/sync-templates.js +238 -0
- package/templates/example/CMakeLists.txt +59 -0
- package/templates/example/frontend/index.html +20 -0
- package/templates/example/frontend/src/API.ts +56 -0
- package/templates/example/frontend/src/App.tsx +781 -0
- package/templates/example/frontend/src/Layout.tsx +5 -0
- package/templates/example/frontend/src/components/ClipboardToast.tsx +23 -0
- package/templates/example/frontend/src/components/FileSearch.tsx +936 -0
- package/templates/example/frontend/src/components/InfiniteScrollList.tsx +267 -0
- package/templates/example/frontend/src/components/index.ts +13 -0
- package/templates/example/frontend/src/filedrop.css +421 -0
- package/templates/example/frontend/src/index.css +1 -0
- package/templates/example/frontend/src/index.tsx +24 -0
- package/templates/example/frontend/src/pages/About.tsx +47 -0
- package/templates/example/frontend/src/pages/Settings.tsx +37 -0
- package/templates/example/frontend/tsconfig.json +20 -0
- package/templates/example/frontend/vite.config.ts +27 -0
- package/templates/example/main.cpp +224 -0
- package/templates/example/package.json +12 -0
- package/templates/solid/CMakeLists.txt +4 -1
- package/templates/solid/frontend/vite.config.ts +3 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.16)
|
|
2
|
+
project({{CMAKE_TARGET}} VERSION 0.1.0 LANGUAGES CXX)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
5
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
6
|
+
|
|
7
|
+
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
|
8
|
+
|
|
9
|
+
# ─── WindowPP Framework ───────────────────────────────────────────────────────
|
|
10
|
+
# WPP_FRAMEWORK_DIR is injected by `windowpp build` / `windowpp dev`.
|
|
11
|
+
# To build manually without the CLI:
|
|
12
|
+
# cmake -S . -B build -DWPP_FRAMEWORK_DIR=/path/to/windowpp/framework
|
|
13
|
+
if(NOT DEFINED WPP_FRAMEWORK_DIR)
|
|
14
|
+
message(FATAL_ERROR
|
|
15
|
+
"WPP_FRAMEWORK_DIR is not set.\n"
|
|
16
|
+
" Build via: windowpp build\n"
|
|
17
|
+
" Or pass: -DWPP_FRAMEWORK_DIR=<path/to/windowpp/cli/framework>"
|
|
18
|
+
)
|
|
19
|
+
endif()
|
|
20
|
+
|
|
21
|
+
add_subdirectory("${WPP_FRAMEWORK_DIR}" "${CMAKE_BINARY_DIR}/windowpp_lib")
|
|
22
|
+
|
|
23
|
+
# ─── App Target ───────────────────────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
set(GENERATED_DIR ${CMAKE_BINARY_DIR}/generated)
|
|
26
|
+
set(EMBEDDED_ASSETS_CPP ${GENERATED_DIR}/embedded_assets.cpp)
|
|
27
|
+
set(EMBEDDED_ASSETS_H ${GENERATED_DIR}/embedded_assets.h)
|
|
28
|
+
|
|
29
|
+
add_custom_command(
|
|
30
|
+
OUTPUT ${EMBEDDED_ASSETS_CPP} ${EMBEDDED_ASSETS_H}
|
|
31
|
+
COMMAND ${CMAKE_COMMAND} -E make_directory ${GENERATED_DIR}
|
|
32
|
+
COMMAND ${Python3_EXECUTABLE}
|
|
33
|
+
${WPP_EMBED_SCRIPT}
|
|
34
|
+
${CMAKE_CURRENT_SOURCE_DIR}/frontend/dist
|
|
35
|
+
${EMBEDDED_ASSETS_CPP}
|
|
36
|
+
${EMBEDDED_ASSETS_H}
|
|
37
|
+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/frontend/dist/index.html
|
|
38
|
+
COMMENT "Embedding {{APP_TITLE}} frontend assets into C++ byte arrays..."
|
|
39
|
+
VERBATIM
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
set_source_files_properties(
|
|
43
|
+
${EMBEDDED_ASSETS_CPP}
|
|
44
|
+
${EMBEDDED_ASSETS_H}
|
|
45
|
+
PROPERTIES GENERATED TRUE
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
add_custom_target({{CMAKE_TARGET}}_frontend_assets ALL
|
|
49
|
+
DEPENDS ${EMBEDDED_ASSETS_CPP} ${EMBEDDED_ASSETS_H}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
add_executable({{CMAKE_TARGET}} main.cpp ${EMBEDDED_ASSETS_CPP})
|
|
53
|
+
target_include_directories({{CMAKE_TARGET}} PRIVATE
|
|
54
|
+
${GENERATED_DIR}
|
|
55
|
+
"${WPP_FRAMEWORK_DIR}/src" # bridge headers: AppData/, FileSystem/, Input/, platform/
|
|
56
|
+
)
|
|
57
|
+
target_compile_definitions({{CMAKE_TARGET}} PRIVATE WPP_EMBEDDED_ASSETS)
|
|
58
|
+
target_link_libraries({{CMAKE_TARGET}} PRIVATE windowpp windowpp_deps nlohmann_json::nlohmann_json)
|
|
59
|
+
add_dependencies({{CMAKE_TARGET}} {{CMAKE_TARGET}}_frontend_assets)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="theme-color" content="#000000" />
|
|
7
|
+
<title>Solid App</title>
|
|
8
|
+
<script>
|
|
9
|
+
// Kill WebView2/browser default "open file" on drag-and-drop
|
|
10
|
+
window.addEventListener('dragover', function(e) { e.preventDefault(); }, false);
|
|
11
|
+
window.addEventListener('drop', function(e) { e.preventDefault(); }, false);
|
|
12
|
+
</script>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
16
|
+
<div id="root"></div>
|
|
17
|
+
|
|
18
|
+
<script src="/src/index.tsx" type="module"></script>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// ─── AppData ─────────────────────────────────────────────────────────────────
|
|
2
|
+
export type { AppDataEntry, SeedEntry } from '@wpp/AppData/API/AppData';
|
|
3
|
+
export { default as appData } from '@wpp/AppData/API/AppData';
|
|
4
|
+
|
|
5
|
+
// ─── FileSystem ───────────────────────────────────────────────────────────────
|
|
6
|
+
export type {
|
|
7
|
+
FileStat,
|
|
8
|
+
DirEntry,
|
|
9
|
+
ApplicationEntry,
|
|
10
|
+
SearchOptions,
|
|
11
|
+
SearchStreamSummary,
|
|
12
|
+
SearchStreamCallbacks,
|
|
13
|
+
SearchStreamHandle,
|
|
14
|
+
} from '@wpp/FileSystem/API/FileSystem';
|
|
15
|
+
export { default as filesystem } from '@wpp/FileSystem/API/FileSystem';
|
|
16
|
+
|
|
17
|
+
// ─── FileDrop ─────────────────────────────────────────────────────────────────
|
|
18
|
+
export type { FileInfo, DropZone } from '@wpp/filedrop/filedrop';
|
|
19
|
+
export {
|
|
20
|
+
fileDrop,
|
|
21
|
+
formatFileSize,
|
|
22
|
+
createDropZone,
|
|
23
|
+
filterFilesByExtension,
|
|
24
|
+
filterFilesByMimeType,
|
|
25
|
+
isImageFile,
|
|
26
|
+
isVideoFile,
|
|
27
|
+
isAudioFile,
|
|
28
|
+
isTextFile,
|
|
29
|
+
} from '@wpp/filedrop/filedrop';
|
|
30
|
+
|
|
31
|
+
// ─── Input ────────────────────────────────────────────────────────────────────
|
|
32
|
+
export type { InputKeyEvent, ShortcutEvent } from '@wpp/Input/API/Input';
|
|
33
|
+
export { default as input } from '@wpp/Input/API/Input';
|
|
34
|
+
|
|
35
|
+
// ─── App (platform) ──────────────────────────────────────────────────────────
|
|
36
|
+
export type {
|
|
37
|
+
AppInfo,
|
|
38
|
+
Point,
|
|
39
|
+
Size,
|
|
40
|
+
Rect,
|
|
41
|
+
MonitorInfo,
|
|
42
|
+
ClipboardChangedEvent,
|
|
43
|
+
AppEvent,
|
|
44
|
+
} from '@wpp/platform/API/App';
|
|
45
|
+
export { default as appApi } from '@wpp/platform/API/App';
|
|
46
|
+
|
|
47
|
+
// ─── Window (platform) ───────────────────────────────────────────────────────
|
|
48
|
+
export type {
|
|
49
|
+
WindowState,
|
|
50
|
+
WindowInfo,
|
|
51
|
+
ResizeDetail,
|
|
52
|
+
MoveDetail,
|
|
53
|
+
WindowEvent,
|
|
54
|
+
CreateWindowOptions,
|
|
55
|
+
} from '@wpp/platform/API/Window';
|
|
56
|
+
export { default as windowApi } from '@wpp/platform/API/Window';
|