First commit

This commit is contained in:
2025-11-17 13:34:43 -06:00
commit bde690c9cb
36 changed files with 1363 additions and 0 deletions

10
6 CPKG/docker-compose.yml Normal file
View File

@@ -0,0 +1,10 @@
services:
pkg:
image: onedev.site.tesses.net/crosslang/crosslangextras/packageserver:latest
ports:
- "4206:4206"
volumes:
- data:/data
volumes:
data:

7
6 CPKG/exweb/cross.json Normal file
View File

@@ -0,0 +1,7 @@
{
"info": {
"type": "console"
},
"name": "exweb",
"version": "1.0.0.0-prod"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
6 CPKG/exweb/res/image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

1
6 CPKG/exweb/res/simple.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
var count = 0;
func Components.Counter()
{
return <p>Count is {++count}</p>;
}

View File

@@ -0,0 +1,38 @@
func Components.Shell(title,pages,body)
{
return <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>exweb - {title}</title>
<link rel="stylesheet" href="./css/simple.min.css">
</head>
<body>
<header>
<h1>exweb</h1>
<nav>
<ul>
<each(var item : pages)>
<li>
<if(item.active)>
<true>
<a aria-current="page" href={item.route}>{item.text}</a>
</true>
<false>
<a aria-current="page" href={item.route}>{item.text}</a>
</false>
</if>
</li>
</each>
</ul>
</nav>
</header>
<h1>{title}</h1>
<raw(body)>
<footer>
<p>Created using <a href="https://crosslang.tesseslanguage.com/">CrossLang</a> and <a href="https://simplecss.org/">SimpleCSS</a></p>
</footer>
</body>
</html>;
}

View File

@@ -0,0 +1,26 @@
func Pages.About()
{
var pages = [
{
active = false,
route = "/",
text = "Home"
},
{
active = false,
route = "/counter",
text = "Counter"
},
{
active = true,
route = "/about",
text = "About"
}
];
return Components.Shell(
"About Me",
pages,
<null><img src="./image.png"><p>{ipsum}</p></null>
);
}
var ipsum="";

View File

@@ -0,0 +1,25 @@
func Pages.Counter()
{
var pages = [
{
active = false,
route = "/",
text = "Home"
},
{
active = true,
route = "/counter",
text = "Counter"
},
{
active = false,
route = "/about",
text = "About"
}
];
return Components.Shell(
"Counter",
pages,
<null><h1>This is a counter</h1><raw(Components.Counter())></null>
);
}

View File

@@ -0,0 +1,32 @@
func Pages.Echo(text)
{
var pages = [
{
active = false,
route = "/",
text = "Home"
},
{
active = false,
route = "/counter",
text = "Counter"
},
{
active = false,
route = "/about",
text = "About"
}
];
return Components.Shell(
"Echo",
pages,
<if(text != null)>
<true>
<plink(text)>
</true>
<false>
<p>No text available</p>
</false>
</if>
);
}

View File

@@ -0,0 +1,27 @@
func Pages.Index()
{
var pages = [
{
active = true,
route = "/",
text = "Home"
},
{
active = false,
route = "/counter",
text = "Counter"
},
{
active = false,
route = "/about",
text = "About"
}
];
return Components.Shell("Main Page",pages,<section>
<form action="./echo" method="GET">
<input type="text" name="text" placeholder="Text to echo">
<input type="submit" value="Echo it">
</form>
<p>1 John 4:4: You, dear children, are from God and have overcome them, because the one who is in you is greater than the one who is in the world.</p>
</section>);
}

View File

@@ -0,0 +1,42 @@
var count = 0;
func main(args)
{
Net.Http.ListenSimpleWithLoop((ctx)=>{
if(ctx.Path == "/")
{
ctx.WithMimeType("text/html").SendText(Pages.Index());
return true;
}
else if(ctx.Path == "/counter")
{
ctx.WithMimeType("text/html").SendText(Pages.Counter());
return true;
}
else if(ctx.Path == "/about")
{
ctx.WithMimeType("text/html").SendText(Pages.About());
return true;
}
else if(ctx.Path == "/echo")
{
ctx.WithMimeType("text/html").SendText(Pages.Echo(ctx.QueryParams.TryGetFirst("text")));
return true;
}
else if(ctx.Path == "/image.png")
{
ctx.WithMimeType("image/png").SendBytes(embed("image.png"));
return true;
}
else if(ctx.Path == "/css/simple.min.css")
{
ctx.WithMimeType("text/css").SendBytes(embed("simple.min.css"));
return true;
}
else if(ctx.Path == "/favicon.ico")
{
ctx.WithMimeType("image/x-icon").SendBytes(embed("favicon.ico"));
return true;
}
return false;
},4207);
}

16
6 CPKG/myapp/cross.json Normal file
View File

@@ -0,0 +1,16 @@
{
"dependencies": [
{
"name": "mylibrary",
"version": "1.0.0.0-prod"
}
],
"info": {
"description": "An app that prints 42",
"short_name": "myapp",
"short_name_pretty": "My Dumb App",
"type": "console"
},
"name": "myapp",
"version": "1.0.0.0-prod"
}

View File

@@ -0,0 +1,4 @@
func main(args)
{
Console.WriteLine(MyLib.Times(6,7));
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "https://crosslang.tesseslanguage.com/schema/cross-json-schema.json",
"info": {
"type": "lib",
"maintainer": "Mike Nolan",
"description": "A library that does something",
"license": "GPLv3",
"repo": "https://onedev.site.tesses.net/crosslang/crosslang-tutorials",
"homepage": "https://crosslang.tesseslanguage.com/"
},
"name": "mylibrary",
"version": "1.0.0.0-prod"
}

View File

@@ -0,0 +1,5 @@
/^ Multiply two numbers ^/
func MyLib.Times(a,b)
{
return a * b;
}