~repos /atoms-element
git clone https://pyrossh.dev/repos/atoms-element.git
A simple web component library for defining your custom elements. It works on both client and server.
101b4a2e
—
Peter John 4 years ago
v2.5.0
- example/page.js +0 -5
- index.d.ts +3 -18
- package-lock.json +2 -2
- package.json +3 -5
example/page.js
CHANGED
|
@@ -2,10 +2,6 @@ import { createPage, html, css } from '../index.js';
|
|
|
2
2
|
import { pageStyles } from './styles.js';
|
|
3
3
|
import './app-counter.js';
|
|
4
4
|
|
|
5
|
-
const route = () => {
|
|
6
|
-
return '/counter';
|
|
7
|
-
};
|
|
8
|
-
|
|
9
5
|
const head = ({ config }) => {
|
|
10
6
|
return html`
|
|
11
7
|
<title>${config.title}</title>
|
|
@@ -24,7 +20,6 @@ const body = () => {
|
|
|
24
20
|
};
|
|
25
21
|
|
|
26
22
|
export default createPage({
|
|
27
|
-
route,
|
|
28
23
|
head,
|
|
29
24
|
body,
|
|
30
25
|
});
|
index.d.ts
CHANGED
|
@@ -54,26 +54,11 @@ export type CreateElementProps = {
|
|
|
54
54
|
|
|
55
55
|
export const createElement = (props: CreateElementProps) => CreateElementProps;
|
|
56
56
|
|
|
57
|
-
export type HandlerProps = {
|
|
58
|
-
config: Config;
|
|
59
|
-
data: Data;
|
|
60
|
-
item: Item;
|
|
61
|
-
}
|
|
62
|
-
export type Handler = (props: HandlerProps) => string;
|
|
63
|
-
|
|
64
|
-
export type CreatePageProps = {
|
|
65
|
-
route: Handler;
|
|
66
|
-
datapaths: Handler;
|
|
67
|
-
head: Handler;
|
|
68
|
-
body: Handler;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
57
|
export type PageRenderProps = {
|
|
72
|
-
config: Config;
|
|
73
|
-
|
|
58
|
+
props: any;
|
|
74
|
-
item: Item;
|
|
75
59
|
headScript: string;
|
|
76
60
|
bodyScript: string;
|
|
77
61
|
}
|
|
62
|
+
export type Handler = (props: any) => string;
|
|
78
63
|
|
|
79
|
-
export const createPage = (props:
|
|
64
|
+
export const createPage = (props: { head: Handler, body: Handler}) => (props: PageRenderProps) => string;
|
package-lock.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atoms-element",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.5.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"jest": "^27.0.5"
|
package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atoms-element",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A simple web component library for defining your custom elements. It works on both client and server. It supports hooks and follows the same principles of react.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pyros.sh",
|
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
],
|
|
16
16
|
"files": [
|
|
17
17
|
"lit-html.js",
|
|
18
|
-
"element.js",
|
|
19
|
-
"element.d.ts",
|
|
20
|
-
"
|
|
18
|
+
"index.js",
|
|
21
|
-
"
|
|
19
|
+
"index.d.ts"
|
|
22
20
|
],
|
|
23
21
|
"license": "MIT",
|
|
24
22
|
"author": "pyros.sh",
|