Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
0acd864
feat(wip): start getting the dom graph
SRNV Oct 29, 2020
81233d2
feat: start dom tree description
SRNV Oct 30, 2020
68b5660
wip
SRNV Oct 30, 2020
862f0bb
chore: nodeType 2, update to DOMString for components
SRNV Oct 31, 2020
514a88f
wip
SRNV Oct 31, 2020
43990f5
feat(wip:) get component from jsxFactory
SRNV Oct 31, 2020
6969b9b
style: clean code
SRNV Oct 31, 2020
6c4856e
feat: speed up module resolution, type checks should be done at the e…
SRNV Oct 31, 2020
a3013fd
improve error display
SRNV Nov 1, 2020
6b0b63b
wip on ids
SRNV Nov 1, 2020
f316b9a
style: lint and add parentComponent
SRNV Nov 2, 2020
cdda177
chore: erase todos that are done
SRNV Nov 2, 2020
52d11de
fix: types after lint
SRNV Nov 2, 2020
32f0a4a
wip: start tests
SRNV Nov 2, 2020
549b60f
feat: improve tests
SRNV Nov 2, 2020
c52b0c1
feat: improve tests
SRNV Nov 3, 2020
f0fe174
fix: ignore lint errors for no-namespace and ban-ts-comment
SRNV Nov 3, 2020
96ae0de
wip
SRNV Nov 3, 2020
b79e0c8
fix: missing jsx parameter
SRNV Nov 3, 2020
ccd462e
fix: missing parameters
SRNV Nov 3, 2020
a19574f
fix: merge and conflicts
SRNV Nov 3, 2020
b81f55a
fix: duplicate identifier
SRNV Nov 3, 2020
a762c0e
feat(wip): add patterns and docs to render component declarations
SRNV Nov 3, 2020
387f8de
wip
SRNV Nov 3, 2020
eecbdac
wip
SRNV Nov 4, 2020
a65fb27
feat(wip): work on design, clean code, todo finish props checking system
SRNV Nov 7, 2020
6344f7c
feat(wip): wip, next step export default should be required
SRNV Nov 7, 2020
ffd8b42
wip
SRNV Nov 7, 2020
90c7f6d
feat(wip): need to create the cli to avoid tsconfig.json dependency -…
SRNV Nov 8, 2020
02e71ed
feat: eon sandbox transpile-render the modules-and typechecks
SRNV Nov 9, 2020
dcf3f76
feat(wip): stabilize errors displayed
SRNV Nov 9, 2020
fbe3455
add docs
SRNV Nov 9, 2020
ed65a52
wip
SRNV Nov 9, 2020
ea1e817
wip: ImportMeta no more required, just compare the values to identify…
SRNV Nov 9, 2020
f03c199
feat: components are now reactive, with deep reactions (nested objects)
SRNV Nov 10, 2020
d46cdec
clean
SRNV Nov 10, 2020
301717c
clean lifeCycle, avoid creating new bound functions at each call
SRNV Nov 10, 2020
14b8058
rm deno_plugins
SRNV Nov 10, 2020
02d1ef6
feat wip on props
SRNV Nov 10, 2020
1d05c18
feat: start todolist, remove get free port
SRNV Nov 11, 2020
5b07026
feat(wip): start todo list app
SRNV Nov 11, 2020
ae5bdc7
fix: order of domelements
SRNV Nov 11, 2020
dab94b9
wip: for directive need to update existing elements
SRNV Nov 11, 2020
92a36df
clean folders
SRNV Nov 11, 2020
7ece29d
clean: avoid using cwd to create files, create the files into sandbox…
SRNV Nov 11, 2020
4bfd3a5
wip: improve for directive
SRNV Nov 12, 2020
d8e9d66
wip: need to fix undefined element in for directive
SRNV Nov 12, 2020
acbc2ac
fixed undefined element in for directive
SRNV Nov 12, 2020
1fdf7cc
wip
SRNV Nov 12, 2020
cb2f6c6
wip
SRNV Nov 12, 2020
0873a29
add idea
SRNV Nov 13, 2020
a8e0596
fix typings in runtime
SRNV Nov 16, 2020
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
7 changes: 7 additions & 0 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
export * as path from "https://deno.land/[email protected]/path/mod.ts";
export { v4 } from "https://deno.land/[email protected]/uuid/mod.ts";
export * as fs from "https://deno.land/[email protected]/fs/mod.ts";
export * as colors from "https://deno.land/[email protected]/fmt/colors.ts";
export {
assertEquals,
} from "https://deno.land/[email protected]/testing/asserts.ts";
export { serve } from "https://deno.land/[email protected]/http/server.ts";
export { parse, print } from "https://x.nest.land/[email protected]/mod.ts";
97 changes: 97 additions & 0 deletions doc/PATTERN_COMPONENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Eon Component Declaration's pattern
Eon's reactivity would be quiet inspired by Svelte's Reactivity

the idea is to use vars (from the template provided by the end user), and to assign value in two time.
for this we would use two functions `component_ctx` and `init`.
the first one contains the second one.

```js
function component_ctx() {
// element's vars declarations here like: let tmp, n;
// ...
function init() {
// element assignment here
}
return {
init,
};
}
customElement.define('[component-uuid]', class extends HTMLElement {
connectedCallback() {
super();
const ctx = component_ctx();
const template = ctx.init();
}
})
```
# TODO: more documentations here

```js
import { VMC } from '../[path_to_component].ts';

function component_ctx() {
// tmp is a template element
// n3 is a div element
// t4 is a boundtext textnode
let tmp1,
n2,
n3,
t4,
/* boundtextnode with end user's input */
t4_data_update;
t4_data_prev,
t4_data_next
/* c5 is a component */
c5,
c5_props_update,
/* and then the component */
component = new VMC();

/* will assign all the nodes inside vars*/
function init() {
tmp1 = document.createElement('template');
n3 = document.createElement('div');
c5 = document.createElement('data-[uuid_sub_component]');
t4 = new Text(' ');
t4_data_update = () => this.message;
/* using the component's props attribute value */
c5_props_update = () => ({
message: this.message
});
// append childs
tmp1.append(n3);
n3.append(t4);
n3.append(c5);
// TODO attributes and bound attributes
// return the template
return tmp1;
}
/* general updates */
function update() {
t4_data_next = t4_data_update(component);
if (t4_data2_prev !== t4_data_next) {
t4.data = t4_data_next;
t4_data2_prev = t4_data_next;
}
/* using the component's props attribute value */
c5.props(c5_props_update(component));
}
return {
component,
init: init.bind(component),
update: update.bind(component)
}
}
customElement.define('data-[uuid_component]', class extends HTMLElement {
constructor() {
super();
const { init, update, component } = component_ctx();
let template = init();
let templateContent = template.content;
this.component = component;

const shadowRoot = this.attachShadow({mode: 'open'})
.appendChild(templateContent.cloneNode(true));
}
});
```
45 changes: 45 additions & 0 deletions doc/PATTERN_FOR_STATEMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
```ts
function component_ctx() {
let wrapper1; // wrapper of all the elements rendered
function init() {
// template creation
wrapper1 = document.createElement('eon-list');
// a section has no style applied
render_iteration1();
tmp1.append(wrapper1);
return tmp1;
}
function render_iteration1() {
// start iterations rendering
// usign pattern 'for_directive.ts'
// @ts-nocheck
let arr_uuid_element = this.array, i = 0;
for (const number of arr_uuid_element) {
i = arr_uuid_element.indexOf(number);
// add missing elements
if (i > wrapper1.childNodes.length) {
let n1;
wrapper1.append(n1);
n1.setAttribute('test', 'true');
"{{ childs_add_event_listener }}"
// update elements
"{{ childs_update }}"
} else {
// need to get the corresponding element
"{{ childs_reassignment }}"
// update elements
"{{ childs_update }}"
}
}
// remove extra elements
if (i < wrapper1.childNodes.length) {
for (let i_remove = wrapper1.childNodes.length; i < i_remove; i_remove--) {
wrapper1.childNodes[i_remove].remove();
}
}
}
function update() {
render_iteration1();
}
}
```
20 changes: 20 additions & 0 deletions examples/hello-app/AnotherComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @ts-ignore
export type AnProps = EonProps<{ test: string; }>;
export default function (this: VMC, props: AnProps) {
return (<template>
<style>{/*css*/`div { color: blue }`}</style>
<div>
test of props {() => this.test}
</div>
</template>)
}
export class VMC {
public message = 'Hello World overwritten';
public test: string = 'test';
static props(this: VMC, props: AnProps) {
this.test = props.test as string;
}
static updated(this: VMC) {
this.message = 'Im updated';
}
}
66 changes: 44 additions & 22 deletions examples/hello-app/HelloApp.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
import * as HelloApp2 from './HelloApp2.jsx';
import * as HelloApp3 from './HelloApp2.jsx';
import * as HelloApp4 from './HelloApp2.jsx';

export const name = "AppHello";
export default function(this: ViewModel): JSX.Element {
// what to do about all the things referenced here
// maybe it's a helper zone for SSR
// but what about SPA
// keep in mind, this function is just to do the dom tree
return (<>
<template>
<div class="container">{() => this.message}</div>
</template>
<style>
{`.container { color: red; }`}
</style>
</>
)
}
export class ViewModel {
public message = "Hello World";
import AnotherComponent, { VMC as AnVMC } from "./AnotherComponent.tsx";
export default function (this: VMC) {
return (<template>
<style>{
/*css*/`.container {
color: red;
}
`}</style>
{() => this.array.length}
<div class="container">
{() => this.message}
{() => this.newData.test.message}
<span class="span">
{() => '> ' + Date.now()}
</span>
<span class={() => this.newData.test.message}>
test on reactive attributes
</span>
</div>
<AnotherComponent test={() => this.newData.test.message} />
</template>)
}


export class VMC extends AnVMC {
public message: string = "Hello World";
public array: number[] = [0];
public newData = {
test: {
message: 'string'
}
};

static connected(this: VMC) {
let i = 0;
setInterval(() => {
this.newData.test.message = `${i} test deep reactivity`;
i++;
}, 50);
}

public switchText() {
this.message = 'test';
}
}
19 changes: 0 additions & 19 deletions examples/hello-app/HelloApp2.jsx

This file was deleted.

20 changes: 0 additions & 20 deletions examples/hello-app/ListForeach.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions examples/hello-app/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { EonApplication } from '../../mod.ts';

await EonApplication.dev('./examples/hello-app/HelloApp.tsx');
32 changes: 32 additions & 0 deletions examples/ideas/design-prototype.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
```tsx
import TodoListRow, { Todo } from '../todo-list/TodoListRow.tsx';

export interface DesignPrototypeProps { message: string }
export interface DesignPrototype {
list: Todo[];
props: DesignPrototypeProps
}

export function connected(this: DesignPrototype) {
this.list.push({
active: false,
value: 'test from design-prototype',
issues: [],
});
}

export default function(this: DesignPrototype, props: DesignPrototypeProps) {
this.list = [];
this.props = props;
return (<template>
{() => this.props.message}
{(todo: Todo, i: number, arr: Todo[] = this.list) =>
<TodoListRow todo={() => todo}>
<span>
{() => `${i} - `}
</span>
</TodoListRow>
}
</template>)
}
```
7 changes: 7 additions & 0 deletions examples/todo-list/ThemeTodoList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
grey: '#333',
lightGrey: '#f8f8ff',
border: '#d0d0d0',
green: '#d0fdd0',
inactive: '#fdd0d0',
};
Loading