@inglorious/create-app 0.5.0 → 1.0.0
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 +2 -2
- package/templates/js/src/app.js +2 -2
- package/templates/js/src/main.js +2 -2
- package/templates/js/src/store/entities.js +3 -3
- package/templates/js/src/store/index.js +2 -2
- package/templates/js/src/{message → types}/message.js +3 -3
- package/templates/js/vite.config.js +7 -1
- package/templates/js-jsx/src/app.jsx +5 -2
- package/templates/js-jsx/src/main.js +2 -2
- package/templates/js-jsx/src/store/entities.js +3 -3
- package/templates/js-jsx/src/store/index.js +2 -2
- package/templates/js-jsx/src/types/message.jsx +12 -0
- package/templates/js-jsx/vite.config.js +7 -1
- package/templates/js-vue/src/app.vue +8 -1
- package/templates/js-vue/src/main.js +2 -2
- package/templates/js-vue/src/store/entities.js +3 -3
- package/templates/js-vue/src/store/index.js +2 -2
- package/templates/js-vue/vite.config.js +7 -1
- package/templates/minimal/src/app.js +2 -2
- package/templates/minimal/src/main.js +2 -2
- package/templates/minimal/src/store/entities.js +3 -3
- package/templates/minimal/src/store/index.js +2 -2
- package/templates/minimal/src/{message → types}/message.js +3 -3
- package/templates/ssx-js/src/pages/about.js +1 -1
- package/templates/ssx-js/src/pages/index.js +1 -1
- package/templates/ssx-js/src/store/entities.js +1 -1
- package/templates/ssx-ts/src/pages/about.ts +1 -1
- package/templates/ssx-ts/src/pages/index.ts +1 -1
- package/templates/ssx-ts/src/store/entities.ts +1 -1
- package/templates/ssx-ts/types/index.d.ts +2 -2
- package/templates/ts/src/app.ts +2 -2
- package/templates/ts/src/main.ts +2 -2
- package/templates/ts/src/store/entities.ts +3 -3
- package/templates/ts/src/store/index.ts +2 -2
- package/templates/ts/src/{message → types}/message.ts +3 -3
- package/templates/ts/types/index.d.ts +1 -1
- package/templates/ts/vite.config.ts +7 -1
- package/templates/ts-jsx/src/app.tsx +10 -3
- package/templates/ts-jsx/src/main.ts +2 -2
- package/templates/ts-jsx/src/store/entities.ts +3 -3
- package/templates/ts-jsx/src/store/index.ts +2 -2
- package/templates/ts-jsx/src/types/message.tsx +14 -0
- package/templates/ts-jsx/types/index.d.ts +1 -1
- package/templates/ts-jsx/vite.config.ts +7 -1
- package/templates/ts-vue/src/app.vue +4 -1
- package/templates/ts-vue/src/main.ts +2 -2
- package/templates/ts-vue/src/store/entities.ts +3 -3
- package/templates/ts-vue/src/store/index.ts +2 -2
- package/templates/ts-vue/types/index.d.ts +1 -1
- package/templates/ts-vue/vite.config.ts +7 -1
- package/templates/js-jsx/src/message/message.jsx +0 -14
- package/templates/ts-jsx/src/message/message.tsx +0 -16
- /package/templates/js-vue/src/{message → types}/message.vue +0 -0
- /package/templates/ts-vue/src/{message → types}/message.vue +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/create-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"prettier": "^3.6.2",
|
|
41
|
-
"@inglorious/eslint-config": "1.1.
|
|
41
|
+
"@inglorious/eslint-config": "1.1.2"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"format": "prettier --write .",
|
package/templates/js/src/app.js
CHANGED
package/templates/js/src/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { App } from "./app"
|
|
4
4
|
import { store } from "./store"
|
|
5
5
|
|
|
6
|
-
mount(store,
|
|
6
|
+
mount(store, (api) => App.render(null, api), document.getElementById("root"))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const entities = {
|
|
2
2
|
message1: {
|
|
3
|
-
type: "
|
|
3
|
+
type: "Message",
|
|
4
4
|
who: "world",
|
|
5
5
|
},
|
|
6
6
|
message2: {
|
|
7
|
-
type: "
|
|
7
|
+
type: "Message",
|
|
8
8
|
who: "wide",
|
|
9
9
|
},
|
|
10
10
|
message3: {
|
|
11
|
-
type: "
|
|
11
|
+
type: "Message",
|
|
12
12
|
who: "web",
|
|
13
13
|
},
|
|
14
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createStore } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Message } from "../types/message"
|
|
4
4
|
import { entities } from "./entities"
|
|
5
5
|
import { middlewares } from "./middlewares"
|
|
6
6
|
|
|
7
7
|
export const store = createStore({
|
|
8
|
-
types: {
|
|
8
|
+
types: { Message },
|
|
9
9
|
entities,
|
|
10
10
|
middlewares,
|
|
11
11
|
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { html } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const Message = {
|
|
4
4
|
click(entity) {
|
|
5
5
|
entity.isUpperCase = !entity.isUpperCase
|
|
6
6
|
},
|
|
7
7
|
|
|
8
8
|
render(entity, api) {
|
|
9
|
-
const
|
|
9
|
+
const who = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
10
10
|
return html`<span @click=${() => api.notify(`#${entity.id}:click`)}
|
|
11
|
-
>Hello ${
|
|
11
|
+
>Hello ${who}</span
|
|
12
12
|
>`
|
|
13
13
|
},
|
|
14
14
|
}
|
|
@@ -10,7 +10,13 @@ const __dirname = path.dirname(__filename)
|
|
|
10
10
|
|
|
11
11
|
// https://vite.dev/config/
|
|
12
12
|
export default defineConfig({
|
|
13
|
-
plugins: [
|
|
13
|
+
plugins: [ViteImageOptimizer()],
|
|
14
|
+
|
|
15
|
+
build: {
|
|
16
|
+
rollupOptions: {
|
|
17
|
+
plugins: [minifyTemplateLiterals()],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
14
20
|
|
|
15
21
|
resolve: {
|
|
16
22
|
alias: {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { Message } from "./types/message"
|
|
2
|
+
|
|
3
|
+
export const App = {
|
|
2
4
|
render() {
|
|
3
5
|
return (
|
|
4
6
|
<h1>
|
|
5
|
-
<
|
|
7
|
+
<Message entityId="message1" />, <Message entityId="message2" />,{" "}
|
|
8
|
+
<Message entityId="message3" />!
|
|
6
9
|
</h1>
|
|
7
10
|
)
|
|
8
11
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { App } from "./app"
|
|
4
4
|
import { store } from "./store"
|
|
5
5
|
|
|
6
|
-
mount(store,
|
|
6
|
+
mount(store, (api) => App.render(null, api), document.getElementById("root"))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const entities = {
|
|
2
2
|
message1: {
|
|
3
|
-
type: "
|
|
3
|
+
type: "Message",
|
|
4
4
|
who: "world",
|
|
5
5
|
},
|
|
6
6
|
message2: {
|
|
7
|
-
type: "
|
|
7
|
+
type: "Message",
|
|
8
8
|
who: "wide",
|
|
9
9
|
},
|
|
10
10
|
message3: {
|
|
11
|
-
type: "
|
|
11
|
+
type: "Message",
|
|
12
12
|
who: "web",
|
|
13
13
|
},
|
|
14
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createStore } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Message } from "../types/message"
|
|
4
4
|
import { entities } from "./entities"
|
|
5
5
|
import { middlewares } from "./middlewares"
|
|
6
6
|
|
|
7
7
|
export const store = createStore({
|
|
8
|
-
types: {
|
|
8
|
+
types: { Message },
|
|
9
9
|
entities,
|
|
10
10
|
middlewares,
|
|
11
11
|
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const Message = {
|
|
2
|
+
click(entity) {
|
|
3
|
+
entity.isUpperCase = !entity.isUpperCase
|
|
4
|
+
},
|
|
5
|
+
|
|
6
|
+
render(entity, api) {
|
|
7
|
+
const who = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
8
|
+
return (
|
|
9
|
+
<span onClick={() => api.notify(`#${entity.id}:click`)}>Hello {who}</span>
|
|
10
|
+
)
|
|
11
|
+
},
|
|
12
|
+
}
|
|
@@ -11,7 +11,13 @@ const __dirname = path.dirname(__filename)
|
|
|
11
11
|
|
|
12
12
|
// https://vite.dev/config/
|
|
13
13
|
export default defineConfig({
|
|
14
|
-
plugins: [
|
|
14
|
+
plugins: [ViteImageOptimizer(), jsx()],
|
|
15
|
+
|
|
16
|
+
build: {
|
|
17
|
+
rollupOptions: {
|
|
18
|
+
plugins: [minifyTemplateLiterals()],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
15
21
|
|
|
16
22
|
resolve: {
|
|
17
23
|
alias: {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Message } from "./types/message.vue"
|
|
3
|
+
</script>
|
|
4
|
+
|
|
1
5
|
<template>
|
|
2
|
-
<h1
|
|
6
|
+
<h1>
|
|
7
|
+
<Message v-bind="message1" />, <Message v-bind="message2" />,
|
|
8
|
+
<Message v-bind="message3" />!
|
|
9
|
+
</h1>
|
|
3
10
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { App } from "./app.vue"
|
|
4
4
|
import { store } from "./store"
|
|
5
5
|
|
|
6
|
-
mount(store, (api) =>
|
|
6
|
+
mount(store, (api) => App.render(null, api), document.getElementById("root"))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const entities = {
|
|
2
2
|
message1: {
|
|
3
|
-
type: "
|
|
3
|
+
type: "Message",
|
|
4
4
|
who: "world",
|
|
5
5
|
},
|
|
6
6
|
message2: {
|
|
7
|
-
type: "
|
|
7
|
+
type: "Message",
|
|
8
8
|
who: "wide",
|
|
9
9
|
},
|
|
10
10
|
message3: {
|
|
11
|
-
type: "
|
|
11
|
+
type: "Message",
|
|
12
12
|
who: "web",
|
|
13
13
|
},
|
|
14
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createStore } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Message } from "../types/message.vue"
|
|
4
4
|
import { entities } from "./entities"
|
|
5
5
|
import { middlewares } from "./middlewares"
|
|
6
6
|
|
|
7
7
|
export const store = createStore({
|
|
8
|
-
types: {
|
|
8
|
+
types: { Message },
|
|
9
9
|
entities,
|
|
10
10
|
middlewares,
|
|
11
11
|
})
|
|
@@ -11,7 +11,13 @@ const __dirname = path.dirname(__filename)
|
|
|
11
11
|
|
|
12
12
|
// https://vite.dev/config/
|
|
13
13
|
export default defineConfig({
|
|
14
|
-
plugins: [
|
|
14
|
+
plugins: [ViteImageOptimizer(), vue()],
|
|
15
|
+
|
|
16
|
+
build: {
|
|
17
|
+
rollupOptions: {
|
|
18
|
+
plugins: [minifyTemplateLiterals()],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
15
21
|
|
|
16
22
|
resolve: {
|
|
17
23
|
alias: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { App } from "./app.js"
|
|
4
4
|
import { store } from "./store/index.js"
|
|
5
5
|
|
|
6
|
-
mount(store,
|
|
6
|
+
mount(store, (api) => App.render(null, api), document.getElementById("root"))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export const entities = {
|
|
2
2
|
message1: {
|
|
3
|
-
type: "
|
|
3
|
+
type: "Message",
|
|
4
4
|
who: "world",
|
|
5
5
|
},
|
|
6
6
|
message2: {
|
|
7
|
-
type: "
|
|
7
|
+
type: "Message",
|
|
8
8
|
who: "wide",
|
|
9
9
|
},
|
|
10
10
|
message3: {
|
|
11
|
-
type: "
|
|
11
|
+
type: "Message",
|
|
12
12
|
who: "web",
|
|
13
13
|
},
|
|
14
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createStore } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Message } from "../types/message.js"
|
|
4
4
|
import { entities } from "./entities.js"
|
|
5
5
|
import { middlewares } from "./middlewares.js"
|
|
6
6
|
|
|
7
7
|
export const store = createStore({
|
|
8
|
-
types: {
|
|
8
|
+
types: { Message },
|
|
9
9
|
entities,
|
|
10
10
|
middlewares,
|
|
11
11
|
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { html } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const Message = {
|
|
4
4
|
click(entity) {
|
|
5
5
|
entity.isUpperCase = !entity.isUpperCase
|
|
6
6
|
},
|
|
7
7
|
|
|
8
8
|
render(entity, api) {
|
|
9
|
-
const
|
|
9
|
+
const who = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
10
10
|
return html`<span @click=${() => api.notify(`#${entity.id}:click`)}
|
|
11
|
-
>Hello ${
|
|
11
|
+
>Hello ${who}</span
|
|
12
12
|
>`
|
|
13
13
|
},
|
|
14
14
|
}
|
|
@@ -2,7 +2,7 @@ import { BaseEntity, EntitiesState } from "@inglorious/store"
|
|
|
2
2
|
|
|
3
3
|
// Define your entity types
|
|
4
4
|
export interface AboutEntity extends BaseEntity {
|
|
5
|
-
type: "
|
|
5
|
+
type: "About"
|
|
6
6
|
id?: string
|
|
7
7
|
name: string
|
|
8
8
|
}
|
|
@@ -17,7 +17,7 @@ export interface AppState extends EntitiesState<AppEntity> {
|
|
|
17
17
|
|
|
18
18
|
// Types configuration
|
|
19
19
|
export interface AppTypes {
|
|
20
|
-
|
|
20
|
+
About: {
|
|
21
21
|
click: (entity: AboutEntity) => void
|
|
22
22
|
}
|
|
23
23
|
}
|
package/templates/ts/src/app.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Api, html } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
render(api: Api) {
|
|
3
|
+
export const App = {
|
|
4
|
+
render(props: Record<string, unknown> | null, api: Api) {
|
|
5
5
|
return html`<h1>
|
|
6
6
|
${api.render("message1")}, ${api.render("message2")},
|
|
7
7
|
${api.render("message3")}!
|
package/templates/ts/src/main.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { App } from "./app"
|
|
4
4
|
import { store } from "./store"
|
|
5
5
|
|
|
6
|
-
mount(store,
|
|
6
|
+
mount(store, (api) => App.render(null, api), document.getElementById("root")!)
|
|
@@ -2,15 +2,15 @@ import type { AppState } from "../../types"
|
|
|
2
2
|
|
|
3
3
|
export const entities: AppState = {
|
|
4
4
|
message1: {
|
|
5
|
-
type: "
|
|
5
|
+
type: "Message",
|
|
6
6
|
who: "world",
|
|
7
7
|
},
|
|
8
8
|
message2: {
|
|
9
|
-
type: "
|
|
9
|
+
type: "Message",
|
|
10
10
|
who: "wide",
|
|
11
11
|
},
|
|
12
12
|
message3: {
|
|
13
|
-
type: "
|
|
13
|
+
type: "Message",
|
|
14
14
|
who: "web",
|
|
15
15
|
},
|
|
16
16
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createStore, type TypesConfig } from "@inglorious/web"
|
|
2
2
|
|
|
3
3
|
import type { AppEntity, AppState } from "../../types"
|
|
4
|
-
import {
|
|
4
|
+
import { Message } from "../types/message"
|
|
5
5
|
import { entities } from "./entities"
|
|
6
6
|
import { middlewares } from "./middlewares"
|
|
7
7
|
|
|
8
8
|
export const store = createStore<AppEntity, AppState>({
|
|
9
|
-
types: {
|
|
9
|
+
types: { Message } as unknown as TypesConfig<AppEntity>,
|
|
10
10
|
entities,
|
|
11
11
|
middlewares,
|
|
12
12
|
})
|
|
@@ -2,15 +2,15 @@ import { html } from "@inglorious/web"
|
|
|
2
2
|
|
|
3
3
|
import type { MessageType } from "../../types"
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const Message: MessageType = {
|
|
6
6
|
click(entity) {
|
|
7
7
|
entity.isUpperCase = !entity.isUpperCase
|
|
8
8
|
},
|
|
9
9
|
|
|
10
10
|
render(entity, api) {
|
|
11
|
-
const
|
|
11
|
+
const who = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
12
12
|
return html`<span @click=${() => api.notify(`#${entity.id}:click`)}
|
|
13
|
-
>Hello ${
|
|
13
|
+
>Hello ${who}</span
|
|
14
14
|
>`
|
|
15
15
|
},
|
|
16
16
|
}
|
|
@@ -13,7 +13,13 @@ export default defineConfig({
|
|
|
13
13
|
// @see https://github.com/vitejs/vite/issues/1973
|
|
14
14
|
define: { "process.env": {} },
|
|
15
15
|
|
|
16
|
-
plugins: [
|
|
16
|
+
plugins: [ViteImageOptimizer()],
|
|
17
|
+
|
|
18
|
+
build: {
|
|
19
|
+
rollupOptions: {
|
|
20
|
+
plugins: [minifyTemplateLiterals()],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
17
23
|
|
|
18
24
|
resolve: {
|
|
19
25
|
alias: {
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import type { Api } from "@inglorious/web"
|
|
3
|
+
|
|
4
|
+
import { Message } from "./types/message"
|
|
5
|
+
|
|
6
|
+
export const App = {
|
|
7
|
+
render(props: Record<string, unknown> | null, api: Api) {
|
|
3
8
|
return (
|
|
4
9
|
<h1>
|
|
5
10
|
{/* @ts-expect-error - JSX components are entity type names, not imports */}
|
|
6
|
-
<
|
|
11
|
+
<Message entityId="message1" />, <Message entityId="message2" />,{" "}
|
|
12
|
+
{/* @ts-expect-error - JSX components are entity type names, not imports */}
|
|
13
|
+
<Message entityId="message3" />!
|
|
7
14
|
</h1>
|
|
8
15
|
)
|
|
9
16
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from "@inglorious/web"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { App } from "./app"
|
|
4
4
|
import { store } from "./store"
|
|
5
5
|
|
|
6
|
-
mount(store,
|
|
6
|
+
mount(store, (api) => App.render(null, api), document.getElementById("root")!)
|
|
@@ -2,15 +2,15 @@ import type { AppState } from "../../types"
|
|
|
2
2
|
|
|
3
3
|
export const entities: AppState = {
|
|
4
4
|
message1: {
|
|
5
|
-
type: "
|
|
5
|
+
type: "Message",
|
|
6
6
|
who: "world",
|
|
7
7
|
},
|
|
8
8
|
message2: {
|
|
9
|
-
type: "
|
|
9
|
+
type: "Message",
|
|
10
10
|
who: "wide",
|
|
11
11
|
},
|
|
12
12
|
message3: {
|
|
13
|
-
type: "
|
|
13
|
+
type: "Message",
|
|
14
14
|
who: "web",
|
|
15
15
|
},
|
|
16
16
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createStore, type TypesConfig } from "@inglorious/web"
|
|
2
2
|
|
|
3
3
|
import type { AppEntity, AppState } from "../../types"
|
|
4
|
-
import {
|
|
4
|
+
import { Message } from "../types/message"
|
|
5
5
|
import { entities } from "./entities"
|
|
6
6
|
import { middlewares } from "./middlewares"
|
|
7
7
|
|
|
8
8
|
export const store = createStore<AppEntity, AppState>({
|
|
9
|
-
types: {
|
|
9
|
+
types: { Message } as unknown as TypesConfig<AppEntity>,
|
|
10
10
|
entities,
|
|
11
11
|
middlewares,
|
|
12
12
|
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MessageType } from "../../types"
|
|
2
|
+
|
|
3
|
+
export const Message: MessageType = {
|
|
4
|
+
click(entity) {
|
|
5
|
+
entity.isUpperCase = !entity.isUpperCase
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
render(entity, api) {
|
|
9
|
+
const who = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
10
|
+
return (
|
|
11
|
+
<span onClick={() => api.notify(`#${entity.id}:click`)}>Hello {who}</span>
|
|
12
|
+
)
|
|
13
|
+
},
|
|
14
|
+
}
|
|
@@ -14,7 +14,13 @@ export default defineConfig({
|
|
|
14
14
|
// @see https://github.com/vitejs/vite/issues/1973
|
|
15
15
|
define: { "process.env": {} },
|
|
16
16
|
|
|
17
|
-
plugins: [
|
|
17
|
+
plugins: [ViteImageOptimizer(), jsx()],
|
|
18
|
+
|
|
19
|
+
build: {
|
|
20
|
+
rollupOptions: {
|
|
21
|
+
plugins: [minifyTemplateLiterals()],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
18
24
|
|
|
19
25
|
resolve: {
|
|
20
26
|
alias: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mount } from "@inglorious/web"
|
|
2
2
|
|
|
3
3
|
// @ts-expect-error - Handled by @inglorious/vite-plugin-vue
|
|
4
|
-
import {
|
|
4
|
+
import { App } from "./app.vue"
|
|
5
5
|
import { store } from "./store"
|
|
6
6
|
|
|
7
|
-
mount(store, (api) =>
|
|
7
|
+
mount(store, (api) => App.render(null, api), document.getElementById("root"))
|
|
@@ -2,15 +2,15 @@ import type { AppState } from "../../types"
|
|
|
2
2
|
|
|
3
3
|
export const entities: AppState = {
|
|
4
4
|
message1: {
|
|
5
|
-
type: "
|
|
5
|
+
type: "Message",
|
|
6
6
|
who: "world",
|
|
7
7
|
},
|
|
8
8
|
message2: {
|
|
9
|
-
type: "
|
|
9
|
+
type: "Message",
|
|
10
10
|
who: "wide",
|
|
11
11
|
},
|
|
12
12
|
message3: {
|
|
13
|
-
type: "
|
|
13
|
+
type: "Message",
|
|
14
14
|
who: "web",
|
|
15
15
|
},
|
|
16
16
|
}
|
|
@@ -2,12 +2,12 @@ import { createStore, type TypesConfig } from "@inglorious/web"
|
|
|
2
2
|
|
|
3
3
|
import type { AppEntity, AppState } from "../../types"
|
|
4
4
|
// @ts-expect-error - Handled by @inglorious/vite-plugin-vue
|
|
5
|
-
import {
|
|
5
|
+
import { Message } from "../message/message.vue"
|
|
6
6
|
import { entities } from "./entities"
|
|
7
7
|
import { middlewares } from "./middlewares"
|
|
8
8
|
|
|
9
9
|
export const store = createStore<AppEntity, AppState>({
|
|
10
|
-
types: {
|
|
10
|
+
types: { Message } as unknown as TypesConfig<AppEntity>,
|
|
11
11
|
entities,
|
|
12
12
|
middlewares,
|
|
13
13
|
})
|
|
@@ -14,7 +14,13 @@ export default defineConfig({
|
|
|
14
14
|
// @see https://github.com/vitejs/vite/issues/1973
|
|
15
15
|
define: { "process.env": {} },
|
|
16
16
|
|
|
17
|
-
plugins: [
|
|
17
|
+
plugins: [ViteImageOptimizer(), vue()],
|
|
18
|
+
|
|
19
|
+
build: {
|
|
20
|
+
rollupOptions: {
|
|
21
|
+
plugins: [minifyTemplateLiterals()],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
18
24
|
|
|
19
25
|
resolve: {
|
|
20
26
|
alias: {
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const message = {
|
|
2
|
-
click(entity) {
|
|
3
|
-
entity.isUpperCase = !entity.isUpperCase
|
|
4
|
-
},
|
|
5
|
-
|
|
6
|
-
render(entity, api) {
|
|
7
|
-
const message = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
8
|
-
return (
|
|
9
|
-
<span onClick={() => api.notify(`#${entity.id}:click`)}>
|
|
10
|
-
Hello {message}
|
|
11
|
-
</span>
|
|
12
|
-
)
|
|
13
|
-
},
|
|
14
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { MessageType } from "../../types"
|
|
2
|
-
|
|
3
|
-
export const message: MessageType = {
|
|
4
|
-
click(entity) {
|
|
5
|
-
entity.isUpperCase = !entity.isUpperCase
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
render(entity, api) {
|
|
9
|
-
const message = entity.isUpperCase ? entity.who.toUpperCase() : entity.who
|
|
10
|
-
return (
|
|
11
|
-
<span onClick={() => api.notify(`#${entity.id}:click`)}>
|
|
12
|
-
Hello {message}
|
|
13
|
-
</span>
|
|
14
|
-
)
|
|
15
|
-
},
|
|
16
|
-
}
|
|
File without changes
|
|
File without changes
|