Skip to content

Commit 9035370

Browse files
authored
setting up package with scratch main (#53)
1 parent 01884c1 commit 9035370

File tree

6 files changed

+190
-0
lines changed

6 files changed

+190
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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, shrink-to-fit=no">
6+
<title></title>
7+
<link rel="stylesheet" href="src/main.css">
8+
<script type="module" src="src/main.ts"></script>
9+
</head>
10+
<body class="theme">
11+
<com-app></com-app>
12+
</body>
13+
</html>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "@commontools/lookslike-high-level",
3+
"author": "The Common Authors",
4+
"version": "0.0.1",
5+
"description": "High level UI experiments.",
6+
"license": "UNLICENSED",
7+
"private": true,
8+
"type": "module",
9+
"scripts": {
10+
"build": "wireit",
11+
"clean": "wireit"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/commontoolsinc/labs.git"
16+
},
17+
"bugs": {
18+
"url": "https://github.com/commontoolsinc/labs/issues"
19+
},
20+
"homepage": "https://github.com/commontoolsinc/labs#readme",
21+
"devDependencies": {
22+
"typescript": "^5.2.2",
23+
"vite": "^5.2.0",
24+
"wireit": "^0.14.4"
25+
},
26+
"wireit": {
27+
"build": {
28+
"dependencies": [
29+
"../common-ui:build"
30+
],
31+
"command": "vite build"
32+
},
33+
"clean": {
34+
"command": "rm -rf ./lib ./dist ./.wireit ./node_modules"
35+
}
36+
},
37+
"dependencies": {
38+
"@commontools/common-ui": "^0.0.1",
39+
"@commontools/common-frp": "^0.0.1"
40+
}
41+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// @ts-ignore
2+
import { read } from 'common:io/state@0.0.1';
3+
4+
export class Body {
5+
run() {
6+
console.log('Running!');
7+
8+
const foo = read('foo');
9+
10+
console.log('Reference:', foo);
11+
12+
const value = foo?.deref();
13+
14+
console.log('Value:', value);
15+
}
16+
}
17+
18+
export const create = () => {
19+
console.log('Creating!');
20+
// return new Body();
21+
};
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import { view, tags, render } from "@commontools/common-ui";
2+
const { dict, datatable, vstack, hstack, checkbox, div } = tags;
3+
4+
const datatableNode = datatable({
5+
cols: [
6+
"title",
7+
"day",
8+
"time",
9+
"location",
10+
"address",
11+
"description",
12+
"level",
13+
"price",
14+
"email",
15+
"reservation",
16+
],
17+
rows: [
18+
{
19+
title: "Power Yoga",
20+
day: "Monday",
21+
time: "8:00am",
22+
location: "Studio 1 & 2 (combined)",
23+
description:
24+
"Stretch and relax with yoga practice at the studio. All levels welcome. Bring your own mat. Namaste. 🧘‍♂️",
25+
level: "Beginner to Advanced",
26+
price: "$10",
27+
address: "1234 Elm St, Springfield, IL 62701",
28+
email: "yogazon124@example.com",
29+
reservation: "https://example.com/reserve/power-yoga",
30+
},
31+
{
32+
title: "Pilates",
33+
day: "Wednesday",
34+
time: "8:00am",
35+
location: "Studio",
36+
description: "Strengthen and tone",
37+
level: "Intermediate",
38+
price: "$15",
39+
address: "1234 Elm St, Springfield, IL 62701",
40+
email: "pilates14asdf@example.com",
41+
reservation: "https://example.com/reserve/pilates",
42+
},
43+
{
44+
title: "Zumba",
45+
day: "Friday",
46+
time: "8:00am",
47+
location: "Studio",
48+
description: "Dance and have fun",
49+
level: "Advanced",
50+
price: "$20",
51+
address: "1234 Elm St, Springfield, IL 62701",
52+
email: "zumba@example.com",
53+
reservation: "https://example.com/reserve/zumba",
54+
},
55+
],
56+
});
57+
58+
const dictNode = dict({
59+
records: {
60+
one: "1",
61+
two: "2",
62+
three: "3",
63+
},
64+
});
65+
66+
const todoItems = [
67+
{ title: "Buy groceries", done: false },
68+
{ title: "Walk the dog", done: true },
69+
{ title: "Wash the car", done: false },
70+
];
71+
72+
const todos = vstack(
73+
{},
74+
...todoItems.map((item) => hstack({}, checkbox({}), div({}, item.title)))
75+
);
76+
77+
const tree = vstack({}, todos, datatableNode, dictNode);
78+
79+
const element = render.render(tree, {});
80+
81+
document.body.appendChild(element);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"moduleResolution": "nodenext",
4+
"compilerOptions": {
5+
"lib": [
6+
"es2022",
7+
"esnext.array",
8+
"esnext",
9+
"dom"
10+
],
11+
"outDir": "./",
12+
"experimentalDecorators": true,
13+
"useDefineForClassFields": false
14+
},
15+
"include": [
16+
"src/**/*.ts"
17+
],
18+
"exclude": []
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// vite.config.js
2+
import { resolve } from "path";
3+
import { defineConfig } from "vite";
4+
5+
export default defineConfig({
6+
build: {
7+
target: "esnext"
8+
},
9+
resolve: {
10+
preserveSymlinks: true
11+
},
12+
optimizeDeps: {
13+
noDiscovery: true
14+
}
15+
});

0 commit comments

Comments
 (0)