-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
2,737 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.8.0) | ||
project(SpaicExample) | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
include_directories("../include/") | ||
file(GLOB_RECURSE SOURCE_LIST "./*.cpp") | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin") | ||
|
||
add_executable(${PROJECT_NAME} ${SOURCE_LIST}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <cstdlib> | ||
|
||
#include <spaic/Prelude.hpp> | ||
|
||
namespace props::counter | ||
{ | ||
auto is_dark_theme = fallback<bool>(false); | ||
} | ||
class Counter | ||
{ | ||
private: | ||
bool test; | ||
|
||
public: | ||
template <typename... T> | ||
Counter(T... values) | ||
{ | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
using namespace props::counter; | ||
// new Counter(is_dark_theme = true); | ||
// Counter{is_dark_theme = true}; | ||
// Counter(is_dark_theme = true); | ||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <spaic-css/Stylesheet.hpp> | ||
|
||
namespace spaic | ||
{ | ||
template <typename... T> | ||
spaic::css::Stylesheet css(T... params); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#pragma once | ||
|
||
namespace spaic::css | ||
{ | ||
class Stylesheet | ||
{ | ||
}; | ||
} // namespace spaic::css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include <functional> | ||
|
||
namespace spaic | ||
{ | ||
using ShouldRender = bool; | ||
template <typename State, typename Msg> | ||
using Update = std::function(Msg)->ShouldRender; | ||
|
||
template <typename Props, typename State> | ||
class Component | ||
{ | ||
}; | ||
template <typename Props, typename State> | ||
Component<Props, State> create_component(); | ||
} // namespace spaic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include <spaic/Property.hpp> | ||
|
||
using namespace spaic::props; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
|
||
#include <optional> | ||
|
||
namespace spaic::props | ||
{ | ||
|
||
template <typename I, typename O> | ||
class AssignedProperty; | ||
|
||
template <typename I, typename O> | ||
class Property | ||
{ | ||
|
||
public: | ||
virtual AssignedProperty<I, O> operator=(I &&value) noexcept; | ||
}; | ||
|
||
template <typename I, typename O> | ||
class AssignedProperty | ||
{ | ||
private: | ||
Property<I, O> ⌖ | ||
O value; | ||
|
||
AssignedProperty(Property<I, O> &target, O &&value); | ||
}; | ||
template <typename T> | ||
Property<T, T> &&required() noexcept; | ||
|
||
template <typename T> | ||
Property<T, std::optional<T>> &&optional() noexcept; | ||
|
||
template <typename T> | ||
Property<T, T> &&fallback(T &&value) noexcept; | ||
} // namespace spaic::props |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <spaic/Property.hpp> | ||
|
||
#include <optional> | ||
|
||
namespace spaic::props | ||
{ | ||
template <typename T> | ||
class Required : Property<T, T> | ||
{ | ||
public: | ||
AssignedProperty<T, T> operator=(T &&value) noexcept | ||
{ | ||
return std::move(new AssignedProperty(&this, value)); | ||
}; | ||
}; | ||
template <typename T> | ||
class Optional : Property<T, std::optional<T>> | ||
{ | ||
public: | ||
AssignedProperty<T, std::optional<T>> operator=(T &&value) noexcept | ||
{ | ||
return std::move(new AssignedProperty(&this, std::optional(value))); | ||
}; | ||
}; | ||
template <typename T> | ||
class Fallback : Property<T, T> | ||
{ | ||
private: | ||
T &&m_fallback_value; | ||
|
||
public: | ||
Fallback(T &&fallback_value) : m_fallback_value(fallback_value) | ||
{ | ||
} | ||
AssignedProperty<T, T> operator=(T &&value) noexcept | ||
{ | ||
return std::move(new AssignedProperty(&this, value)); | ||
}; | ||
}; | ||
template <typename T> | ||
Property<T, T> &&required() noexcept | ||
{ | ||
return std::move(Required<T>()); | ||
} | ||
template <typename T> | ||
Property<T, std::optional<T>> &&optional() noexcept | ||
{ | ||
return std::move(Optional<T>()); | ||
} | ||
template <typename T> | ||
Property<T, T> &&fallback(T &&fallback_value) noexcept | ||
{ | ||
return std::move(Fallback<T>(fallback_value)); | ||
} | ||
} // namespace spaic::props |