@inglorious/create-app 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/create-app",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "A scaffolding tool to quickly create a new app with Inglorious Web.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
@@ -0,0 +1,26 @@
1
+ import { html } from "@inglorious/web"
2
+
3
+ export const about = {
4
+ click(entity) {
5
+ entity.name += "!"
6
+ },
7
+
8
+ render(entity, api) {
9
+ return html`
10
+ <div>
11
+ <h1>
12
+ About
13
+ <span @click=${() => api.notify(`#${entity.id}:click`)}
14
+ >${entity.name}</span
15
+ >
16
+ </h1>
17
+ <p>This is a static page generated by SSX.</p>
18
+ <a href="/">Back Home</a>
19
+ </div>
20
+ `
21
+ },
22
+ }
23
+
24
+ export const metadata = {
25
+ title: "About",
26
+ }
@@ -0,0 +1,6 @@
1
+ export const entities = {
2
+ about: {
3
+ type: "about",
4
+ name: "Us",
5
+ },
6
+ }
@@ -1,10 +1,21 @@
1
- import { html } from "@inglorious/web"
1
+ import { Api, html } from "@inglorious/web"
2
+
3
+ import type { AboutEntity } from "../../types"
2
4
 
3
5
  export const about = {
4
- render() {
6
+ click(entity: AboutEntity) {
7
+ entity.name += "!"
8
+ },
9
+
10
+ render(entity: AboutEntity, api: Api) {
5
11
  return html`
6
12
  <div>
7
- <h1>About</h1>
13
+ <h1>
14
+ About
15
+ <span @click=${() => api.notify(`#${entity.id}:click`)}
16
+ >${entity.name}</span
17
+ >
18
+ </h1>
8
19
  <p>This is a static page generated by SSX.</p>
9
20
  <a href="/">Back Home</a>
10
21
  </div>
@@ -1,4 +1,4 @@
1
- import { SiteConfig } from "@inglorious/ssx"
1
+ import type { SiteConfig } from "@inglorious/ssx"
2
2
 
3
3
  const siteConfig: SiteConfig = {
4
4
  title: "My SSX App",
@@ -0,0 +1,8 @@
1
+ import { AppState } from "../../types"
2
+
3
+ export const entities: AppState = {
4
+ about: {
5
+ type: "about",
6
+ name: "Us",
7
+ },
8
+ }
@@ -0,0 +1,23 @@
1
+ import { BaseEntity, EntitiesState } from "@inglorious/store"
2
+
3
+ // Define your entity types
4
+ export interface AboutEntity extends BaseEntity {
5
+ type: "about"
6
+ id?: string
7
+ name: string
8
+ }
9
+
10
+ // Union type of all entities
11
+ export type AppEntity = AboutEntity
12
+
13
+ // State type with known entity IDs
14
+ export interface AppState extends EntitiesState<AppEntity> {
15
+ about: AboutEntity
16
+ }
17
+
18
+ // Types configuration
19
+ export interface AppTypes {
20
+ about: {
21
+ click: (entity: AboutEntity) => void
22
+ }
23
+ }