Skip to content

Add thyn framework #1894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions frameworks/keyed/thyn/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>Thyn</title>
<link href="/css/currentStyle.css" rel="stylesheet"/>
<script type="module" crossorigin src="./src/main.js"></script>
</head>

<body></body>

</html>
1,566 changes: 1,566 additions & 0 deletions frameworks/keyed/thyn/package-lock.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions frameworks/keyed/thyn/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "thyn",
"private": true,
"version": "0.0.0",
"type": "module",
"js-framework-benchmark": {
"frameworkVersionFromPackage": "@thyn/core",
"frameworkHomeURL": "https://github.com/thynjs/thyn",
"customURL": "/dist"
},
"scripts": {
"build-prod": "vite build"
},
"devDependencies": {
"vite": "6.3.5",
"@thyn/vite-plugin": "0.0.45"
},
"dependencies": {
"@thyn/core": "0.0.45"
}
}
66 changes: 66 additions & 0 deletions frameworks/keyed/thyn/src/App.thyn
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<script>
import {data, buildData, selected} from "./state.thyn.js";
import Row from "./Row.thyn";

const add = () => data(d => [...d, ...buildData(1000)]);
const clear = () => data([]);
const partialUpdate = () => {for (let i = 0, d = data(), len = d.length; i < len; i += 10) d[i].label(l => l + " !!!")};
const run = () => {
data(buildData(1000));
};
const runLots = () => {
data(buildData(10000));
};
const swapRows = () => data(d => {
if (d.length > 998) {
const clone = d.slice();
const tmp = clone[1];
clone[1] = clone[998];
clone[998] = tmp;
return clone;
}
return d;
});
</script>

<div id="main" class="container">
<div class="jumbotron">
<div class="row">
<div class="col-md-6">
<h1>Thyn</h1>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="run" @click={run}>Create 1,000 rows</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="runlots" @click={runLots}>
Create 10,000 rows
</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="add" @click={add}>Append 1,000 rows</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="update" @click={partialUpdate}>
Update every 10th row
</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="clear" @click={clear}>Clear</button>
</div>
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="swaprows" @click={swapRows}>Swap Rows</button>
</div>
</div>
</div>
</div>
</div>
<table class="table table-hover table-striped test-data">
<tbody>
<Row #each={row in data()} row={row} />
</tbody>
</table>
<span class="preloadicon glyphicon glyphicon-remove" aria-hidden="true"></span>
</div>
23 changes: 23 additions & 0 deletions frameworks/keyed/thyn/src/Row.thyn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script>
import {selected, data, isSelected} from "./state.thyn.js";

const {row} = $props;
const {id, label} = row;
</script>

<tr class={isSelected(id) ? 'danger' : undefined}>
<td class="col-md-1">{{ id }}</td>
<td class="col-md-4">
<a @click={() => selected(id)}>{{ label() }}</a>
</td>
<td class="col-md-1">
<a @click={() => data(d => {
const clone = d.slice();
clone.splice(clone.indexOf(row), 1);
return clone;
})}>
<span class="glyphicon glyphicon-remove" aria-hidden="true" />
</a>
</td>
<td class="col-md-6" />
</tr>
4 changes: 4 additions & 0 deletions frameworks/keyed/thyn/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mount } from '@thyn/core';
import App from './App.thyn';

mount(App, document.body);
75 changes: 75 additions & 0 deletions frameworks/keyed/thyn/src/state.thyn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
let rowId = 1;
export const data = $signal([]);
export const selected = $signal();
export const isSelected = $compare(selected);

const adjectives = [
'pretty',
'large',
'big',
'small',
'tall',
'short',
'long',
'handsome',
'plain',
'quaint',
'clean',
'elegant',
'easy',
'angry',
'crazy',
'helpful',
'mushy',
'odd',
'unsightly',
'adorable',
'important',
'inexpensive',
'cheap',
'expensive',
'fancy'
];
const colors = [
'red',
'yellow',
'blue',
'green',
'pink',
'brown',
'purple',
'brown',
'white',
'black',
'orange'
];
const nouns = [
'table',
'chair',
'house',
'bbq',
'desk',
'car',
'pony',
'cookie',
'sandwich',
'burger',
'pizza',
'mouse',
'keyboard'
];

function random(max) {
return Math.round(Math.random() * 1000) % max;
}

export const buildData = (count) => {
let data = new Array(count);
for (let i = 0; i < count; i++) {
data[i] = {
id: rowId++,
label: $signal(`${adjectives[random(adjectives.length)]} ${colors[random(colors.length)]} ${nouns[random(nouns.length)]}`),
};
}
return data;
};
8 changes: 8 additions & 0 deletions frameworks/keyed/thyn/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import thyn from "@thyn/vite-plugin";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [thyn()],
base: '/frameworks/keyed/thyn/dist/',
build: { modulePreload: false },
});
299 changes: 150 additions & 149 deletions webdriver-ts-results/src/results.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webdriver-ts/results.json

Large diffs are not rendered by default.