-
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
0 parents
commit a5d3579
Showing
14 changed files
with
265 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.nim] | ||
indent_style = space | ||
indent_size = 2 |
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,77 @@ | ||
name: Testing 👨🔬 | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'dev' | ||
paths-ignore: | ||
- 'docs/**' | ||
- '.github/ISSUE_TEMPLATE/*' | ||
- '*.md' | ||
- '*.nimble' | ||
- '.gitignore' | ||
- 'LICENSE' | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
- '.github/ISSUE_TEMPLATE/*' | ||
- '*.md' | ||
- '*.nimble' | ||
- '.gitignore' | ||
- 'LICENSE' | ||
|
||
jobs: | ||
dependencies: | ||
name: Install dependencies 🧩 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
nim_version: | ||
- '2.0.0' | ||
- '2.0.4' | ||
env: | ||
TIMEOUT_EXIT_STATUS: 124 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: jiro4989/setup-nim-action@v1 | ||
with: | ||
nim-version: ${{ matrix.nim_version }} | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.nimble | ||
~/.choosenim | ||
key: ${{ runner.os }}-nimble-${{ hashFiles('*.nimble') }} | ||
- name: Install Dependencies 🔃 | ||
run: | | ||
nimble refresh | ||
nimble install -y -d | ||
js: | ||
name: Test with JavaScript 🧪 | ||
needs: dependencies | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
env: | ||
TIMEOUT_EXIT_STATUS: 124 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.nimble | ||
~/.choosenim | ||
key: ${{ runner.os }}-nimble-${{ hashFiles('*.nimble') }} | ||
- name: Build JS tests 🍍 | ||
run: | | ||
cd tests | ||
for file in $(ls -v testjs*.nim); do | ||
echo "###===--- JS Test for " $file " ---===###" | ||
/home/runner/.nimble/bin/nim js -d:debug --hints:off --warnings:off $file | ||
done | ||
shell: bash |
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,21 @@ | ||
# IDE | ||
.idea/ | ||
.vs-code/ | ||
.vscode/ | ||
.vs/ | ||
|
||
# Cache | ||
nimcache/ | ||
nimble/ | ||
htmldocs/ | ||
|
||
# builded | ||
**/build/ | ||
happyx_ui_linkerArgs.txt | ||
|
||
# Logs | ||
*.log | ||
|
||
# Compiled | ||
*.js | ||
*.exe |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 HapticX | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
<div align="center"> | ||
|
||
# HappyX-UI | ||
### HappyX UI library | ||
|
||
</div> | ||
|
||
|
||
|
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,12 @@ | ||
# Package | ||
|
||
description = "UI library for HappyX web framework" | ||
author = "HapticX" | ||
version = "1.0.0" | ||
license = "MIT" | ||
srcDir = "src" | ||
|
||
# Deps | ||
|
||
requires "nim >= 1.6.14" | ||
requires "happyx >= 3.10.2" |
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,10 @@ | ||
import | ||
happyx_ui/[ | ||
core, column, button | ||
] | ||
|
||
|
||
export | ||
core, | ||
column, | ||
button |
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,41 @@ | ||
import | ||
happyx, | ||
./colors | ||
|
||
|
||
type | ||
ButtonAction* = proc(): void | ||
const defaultButtonAction = proc() = discard | ||
|
||
|
||
component Button: | ||
action: ButtonAction = defaultButtonAction | ||
|
||
html: | ||
tButton: | ||
slot | ||
@click: | ||
self.action() | ||
|
||
`style`: """ | ||
button { | ||
border-radius: .4rem; | ||
border: 0 solid transparent; | ||
cursor: pointer; | ||
background-color: <PRIMARY_COLOR>; | ||
padding: .5rem 1rem; | ||
outline: none; | ||
transition: all; | ||
transition-duration: .3s; | ||
color: <BACKGROUND_COLOR>; | ||
font-weight: 700; | ||
} | ||
button:hover { | ||
background-color: <PRIMARY_HOVER_COLOR>; | ||
} | ||
button:active { | ||
background-color: <PRIMARY_ACTIVE_COLOR>; | ||
} | ||
""" |
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,10 @@ | ||
var | ||
PRIMARY_COLOR* = "#d56c6c" | ||
PRIMARY_HOVER_COLOR* = "#e26969" | ||
PRIMARY_ACTIVE_COLOR* = "#ec6f6f" | ||
FOREGROUND_COLOR* = "#f1dcc1" | ||
FOREGROUND_HOVER_COLOR* = "#dfccb4" | ||
FOREGROUND_ACTIVE_COLOR* = "#d4c1ab" | ||
BACKGROUND_COLOR* = "#141d1f" | ||
BACKGROUND_HOVER_COLOR* = "#182225" | ||
BACKGROUND_ACTIVE_COLOR* = "#1c282b" |
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 @@ | ||
import happyx | ||
|
||
|
||
component Column: | ||
spacing: string = "0" | ||
|
||
html: | ||
tDiv(class = "column"): | ||
slot | ||
|
||
`style`: """ | ||
div.column { | ||
display: flex; | ||
flex-direction: column; | ||
gap: <self.spacing>; | ||
} | ||
""" |
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 @@ | ||
proc px*(val: SomeNumber): string = $val.float & "px" | ||
proc em*(val: SomeNumber): string = $val.float & "em" | ||
proc rem*(val: SomeNumber): string = $val.float & "rem" | ||
proc vw*(val: int): string = $val & "vw" | ||
proc vh*(val: int): string = $val & "vh" |
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,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>HappyX UI library</title> | ||
<style> | ||
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:[email protected]&display=swap'); | ||
* { | ||
font-family: "Comfortaa", sans-serif; | ||
font-optical-sizing: auto; | ||
font-style: normal; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="test.js"></script> | ||
</body> | ||
</html> |
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,14 @@ | ||
import | ||
happyx, | ||
happyx_ui | ||
|
||
|
||
appRoutes "app": | ||
"/": | ||
tDiv: | ||
Column(1.em): | ||
Button( | ||
proc() = | ||
echo "Hello, world!" | ||
): | ||
"Hello, world!" |
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 @@ | ||
--path:"../src" |