@vnejs/docs 0.2.79 → 0.2.81
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/README.md +17 -17
- package/architecture/backends.md +7 -7
- package/architecture/bridge.md +22 -0
- package/architecture/build.md +8 -7
- package/architecture/bundles.md +5 -5
- package/architecture/cli.md +7 -7
- package/architecture/configs.md +9 -9
- package/architecture/contracts.md +12 -12
- package/architecture/dependencies.md +37 -35
- package/architecture/editor.md +4 -4
- package/architecture/games.md +7 -7
- package/architecture/helpers.md +5 -5
- package/architecture/model.md +14 -14
- package/architecture/modules.md +35 -35
- package/architecture/packages.md +16 -16
- package/architecture/plugins.md +15 -15
- package/architecture/shared.md +16 -15
- package/architecture/uis.md +8 -8
- package/changelog/0.2.80.md +3 -0
- package/changelog/0.2.81.md +3 -0
- package/changelog/README.md +2 -0
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/plugins/controls/cursor.md +1 -1
- package/plugins/controls/gamepad.md +2 -2
- package/plugins/scenario/choose.md +14 -14
- package/plugins/scenario/fastforward.md +1 -1
- package/plugins/scenario/history.md +7 -7
- package/plugins/scenario/point_and_click.md +5 -5
- package/plugins/scenario/qte.md +6 -6
- package/plugins/text/smooth.md +4 -4
- package/plugins/text/text.md +10 -10
- package/plugins/views.scenario/choose.md +1 -1
- package/plugins/views.scenario/interface.md +8 -8
- package/plugins/views.scenario/point_and_click.md +4 -4
- package/plugins/views.scenario/qte.md +5 -5
- package/scenario.guide/choose.md +1 -1
- package/scenario.guide/qte-random.md +1 -1
- package/architecture/compatibility.md +0 -22
package/README.md
CHANGED
|
@@ -32,21 +32,21 @@ The package has two scenario entries. Compare them and pick one. Both link to `p
|
|
|
32
32
|
|
|
33
33
|
## Monorepo map
|
|
34
34
|
|
|
35
|
-
| Directory | Role
|
|
36
|
-
| --------------------------------------------------- |
|
|
35
|
+
| Directory | Role |
|
|
36
|
+
| --------------------------------------------------- | ------------------------------------------ |
|
|
37
37
|
| [`packages/`](./architecture/packages.md) | Runtime: `registry`, `observer`, `core`, … |
|
|
38
|
-
| [`modules_extensions/`](./architecture/modules.md) | Module base classes
|
|
39
|
-
| [`configs/`](./architecture/configs.md) | Shared TypeScript configs
|
|
40
|
-
| [`contracts/`](./architecture/contracts.md) | Public plugin API
|
|
41
|
-
| [`shared/`](./architecture/shared.md) | Plugin setup presets
|
|
42
|
-
| [`plugins/`](./architecture/plugins.md) | Behavior on the bus
|
|
43
|
-
| [`
|
|
44
|
-
| [`bundles/`](./architecture/bundles.md) | Plugin set for a game
|
|
45
|
-
| [`helpers/`](./architecture/helpers.md) | Utils with no engine tie
|
|
46
|
-
| [`uis/`](./architecture/uis.md) | React components for view plugins
|
|
47
|
-
| [`cli/`](./architecture/cli.md) | Build the monorepo and the games
|
|
48
|
-
| [`games/`](./architecture/games.md) | Game projects: scenario, entry, dist
|
|
49
|
-
| [`backends/`](./architecture/backends.md) | Workers: Steam token and label JSON
|
|
50
|
-
| [`vs_code_extensions/`](./architecture/editor.md) | `.vne` highlighting in the editor
|
|
51
|
-
|
|
52
|
-
A game imports one `bundles/` package and gets `VneCore`, the engine entry. Menu factories come from `@vnejs/shared.*` in the game script.
|
|
38
|
+
| [`modules_extensions/`](./architecture/modules.md) | Module base classes |
|
|
39
|
+
| [`configs/`](./architecture/configs.md) | Shared TypeScript configs |
|
|
40
|
+
| [`contracts/`](./architecture/contracts.md) | Public plugin API |
|
|
41
|
+
| [`shared/`](./architecture/shared.md) | Plugin setup presets |
|
|
42
|
+
| [`plugins/`](./architecture/plugins.md) | Behavior on the bus |
|
|
43
|
+
| [`bridge/`](./architecture/bridge.md) | Link between plugins |
|
|
44
|
+
| [`bundles/`](./architecture/bundles.md) | Plugin set for a game |
|
|
45
|
+
| [`helpers/`](./architecture/helpers.md) | Utils with no engine tie |
|
|
46
|
+
| [`uis/`](./architecture/uis.md) | React components for view plugins |
|
|
47
|
+
| [`cli/`](./architecture/cli.md) | Build the monorepo and the games |
|
|
48
|
+
| [`games/`](./architecture/games.md) | Game projects: scenario, entry, dist |
|
|
49
|
+
| [`backends/`](./architecture/backends.md) | Workers: Steam token and label JSON |
|
|
50
|
+
| [`vs_code_extensions/`](./architecture/editor.md) | `.vne` highlighting in the editor |
|
|
51
|
+
|
|
52
|
+
A game imports one `bundles/` package and gets `VneCore`, the engine entry. That bundle lists the matching `@vnejs/shared.*` package in `dependencies`. Menu factories still come from `@vnejs/shared.*` in the game script.
|
package/architecture/backends.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# backends/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Separate Cloudflare Workers.** Not plugins and not part of `VneCore`. The game calls them over HTTP. Packages in `plugins/` do not import them.
|
|
4
4
|
|
|
5
|
-
|
|
|
6
|
-
| ---------------------- |
|
|
7
|
-
| **`backends/auth`** | Steam OpenID
|
|
8
|
-
| **`backends/content`** | `GET /label/*` — JSON
|
|
5
|
+
| Package | Role |
|
|
6
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| **`backends/auth`** | Steam OpenID and a check that the user owns this AppID. Returns a signed JWT (`steamId`, `ownsApp`, `exp`). |
|
|
8
|
+
| **`backends/content`** | `GET /label/*` — label JSON from `dist/label`. Allows only a request with that JWT and `ownsApp`. Does not serve images or `mods.json`. |
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Both workers share one `AUTH_SECRET`. The content worker does not call Steam. On deploy, the asset catalog points at the game `dist`. The worker repo does not copy those JSON files. A closed deploy does not put the same `label/` tree next to the game static files.
|
|
11
11
|
|
|
12
12
|
```mermaid
|
|
13
13
|
flowchart LR
|
|
14
14
|
Game[games/] -->|popup OpenID| Auth[backends/auth]
|
|
15
15
|
Auth --> Steam[steamcommunity.com]
|
|
16
16
|
Game -->|GET /label Bearer| Content[backends/content]
|
|
17
|
-
Auth
|
|
17
|
+
Auth -.->|shared AUTH_SECRET| Content
|
|
18
18
|
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# bridge/
|
|
2
|
+
|
|
3
|
+
**Optional integration** between independent plugins. A `bundles/` package turns it on. It is not hard-wired inside `plugins/`.
|
|
4
|
+
|
|
5
|
+
- One module. It extends `ModuleCore`. The class lives in `src/modules/`. `src/index.ts` only imports and calls `regPlugin`.
|
|
6
|
+
- In **`subscribe`** it listens to A and emits B.
|
|
7
|
+
- **`regPlugin`** with an empty shape. The namespace is `BRIDGE_PLUGIN_{PLUGIN_NAME_1}_PLUGIN_{PLUGIN_NAME_2}`. There is no package in `contracts/` for the bridge.
|
|
8
|
+
- It depends only on **contracts** from `contracts/`, not on implementations in `plugins/`.
|
|
9
|
+
|
|
10
|
+
Naming: `@vnejs/bridge.plugins.{package-1}.plugins.{package-2}` → path `bridge/plugins.{package-1}/plugins.{package-2}/`. The two segments are the real plugin package names, without the `@vnejs/` scope.
|
|
11
|
+
|
|
12
|
+
```mermaid
|
|
13
|
+
flowchart LR
|
|
14
|
+
PA[plugins/ A] -->|"emit EVENT_A"| OBS[Observer]
|
|
15
|
+
OBS --> BR[bridge/]
|
|
16
|
+
BR -->|"emit EVENT_B"| OBS
|
|
17
|
+
OBS --> PB[plugins/ B]
|
|
18
|
+
|
|
19
|
+
PA -.->|"does not import"| PB
|
|
20
|
+
BR --> CTA[contracts/ A]
|
|
21
|
+
BR --> CTB[contracts/ B]
|
|
22
|
+
```
|
package/architecture/build.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# End-to-end build
|
|
2
2
|
|
|
3
3
|
```mermaid
|
|
4
4
|
flowchart TD
|
|
5
|
-
subgraph repo ["
|
|
5
|
+
subgraph repo ["Monorepo"]
|
|
6
6
|
CFG[configs/]
|
|
7
7
|
PKG[packages/]
|
|
8
8
|
ME[modules_extensions/]
|
|
9
9
|
CT[contracts/]
|
|
10
10
|
SH[shared/]
|
|
11
11
|
PL[plugins/]
|
|
12
|
-
CP[
|
|
12
|
+
CP[bridge/]
|
|
13
13
|
BD[bundles/]
|
|
14
14
|
CL[cli/]
|
|
15
15
|
end
|
|
@@ -26,6 +26,7 @@ flowchart TD
|
|
|
26
26
|
CT --> SH
|
|
27
27
|
PL --> BD
|
|
28
28
|
CP --> BD
|
|
29
|
+
SH --> BD
|
|
29
30
|
BD --> EN
|
|
30
31
|
SC --> CL
|
|
31
32
|
CL -->|"data + client"| ART[dist/]
|
|
@@ -33,7 +34,7 @@ flowchart TD
|
|
|
33
34
|
ART --> PLAY[Browser / Electron]
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
1. `bundles/`
|
|
37
|
-
2. `cli/`
|
|
38
|
-
3. `new VneCore().init()` —
|
|
39
|
-
4.
|
|
37
|
+
1. `bundles/` registers `plugins/` and `bridge/` in `VNE` and lists the matching `@vnejs/shared.*` in `dependencies`. The game script imports factories from `shared/`.
|
|
38
|
+
2. `cli/` builds the scenario to JSON and the client to `dist/`.
|
|
39
|
+
3. `new VneCore().init()` — modules, media, and the lifecycle up to `start`.
|
|
40
|
+
4. The game runs on bus events. Cross-plugin links go through `bridge/` from `bundles/`.
|
package/architecture/bundles.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# bundles/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Composition** with no business logic. A chain of side-effect imports from `plugins/` and `bridge/`.
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
5
|
+
- Sets the **ability set** for `games/`.
|
|
6
|
+
- Exports **`VneCore`**.
|
|
7
|
+
- A bundle that includes a plugin lists the matching **`@vnejs/shared.*`** in `dependencies`. Bundle source does not import or re-export the factories. The game script imports them.
|
|
8
8
|
|
|
9
9
|
```mermaid
|
|
10
10
|
flowchart BT
|
|
@@ -17,4 +17,4 @@ flowchart BT
|
|
|
17
17
|
CORE --> CANVAS --> SKEL --> BASE --> GAME
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Entry point: re-export `VneCore` →
|
|
20
|
+
Entry point: re-export `VneCore` → import `plugins/` → import `bridge/`.
|
package/architecture/cli.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# cli/
|
|
2
2
|
|
|
3
|
-
**CLI**
|
|
3
|
+
**CLI** for the monorepo and for building `games/` (`npx @vnejs/*`).
|
|
4
4
|
|
|
5
5
|
```mermaid
|
|
6
6
|
flowchart LR
|
|
@@ -9,17 +9,17 @@ flowchart LR
|
|
|
9
9
|
DS["@vnejs/desktop"]
|
|
10
10
|
TL["@vnejs/tools"]
|
|
11
11
|
|
|
12
|
-
MR --> WS[workspace
|
|
12
|
+
MR --> WS[workspace packages]
|
|
13
13
|
BD --> G[games/]
|
|
14
14
|
DS --> G
|
|
15
15
|
TL --> G
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
| CLI |
|
|
18
|
+
| CLI | Role |
|
|
19
19
|
| --------------------- | ----------------------------------------------------------------------------------- |
|
|
20
20
|
| **`@vnejs/monorepo`** | `build`, `package`, `publish`, `bump`, `sync-deps`, `graph`, `run-changed`, `clear` |
|
|
21
|
-
| **`@vnejs/build`** | **`data`** — `game/` → JSON
|
|
22
|
-
| **`@vnejs/desktop`** | **`web`** — static
|
|
23
|
-
| **`@vnejs/tools`** | Resize image
|
|
21
|
+
| **`@vnejs/build`** | **`data`** — `game/` → JSON in `dist/`; **`client`** — Vite entry → `dist/` |
|
|
22
|
+
| **`@vnejs/desktop`** | **`web`** — a static server for `dist/` |
|
|
23
|
+
| **`@vnejs/tools`** | Resize image, video, and audio. Content pipeline |
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Root: `npm run build` → monorepo build. **Turbo** caches `build` with `dependsOn: ["^build"]`.
|
package/architecture/configs.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# configs/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Shared build configs.** Reusable TypeScript settings. Not runtime.
|
|
4
4
|
|
|
5
|
-
|
|
|
6
|
-
| ------------------------------ |
|
|
7
|
-
| **`@vnejs/configs.ts-common`** | tsconfig
|
|
8
|
-
| **`@vnejs/configs.ts-uis`** | tsconfig
|
|
9
|
-
| **`@vnejs/configs.vitest`** |
|
|
5
|
+
| Package | Role |
|
|
6
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------ |
|
|
7
|
+
| **`@vnejs/configs.ts-common`** | tsconfig for `plugins/`, `bridge/`, `contracts/`, `packages/`, `modules_extensions/`, `helpers/`, `shared/` |
|
|
8
|
+
| **`@vnejs/configs.ts-uis`** | tsconfig for `uis/react/` and view code in `games/` (JSX, React types) |
|
|
9
|
+
| **`@vnejs/configs.vitest`** | Shared Vitest config (`create-config.js`, `setup.js`) for packages with tests |
|
|
10
10
|
|
|
11
11
|
```mermaid
|
|
12
12
|
flowchart LR
|
|
13
|
-
TC[configs.ts-common] --> PL[plugins/ / contracts/ / packages/ / shared/]
|
|
13
|
+
TC[configs.ts-common] --> PL[plugins/ / bridge/ / contracts/ / packages/ / shared/]
|
|
14
14
|
TU[configs.ts-uis] --> UI[uis/react/]
|
|
15
15
|
TU --> GM[games/]
|
|
16
|
-
TV[configs.vitest] --> TEST[
|
|
16
|
+
TV[configs.vitest] --> TEST[packages with vitest]
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`ts-*` packages export JSON. A package `tsconfig.json` **extends** the shared one and sets `rootDir` / `outDir`. The Vitest config is JS helpers, not a tsconfig.
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
# contracts/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A **contract** is the public API of one plugin. It is a **specification**, not behavior.
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### What a contract holds
|
|
6
6
|
|
|
7
|
-
- **`PLUGIN_NAME`** — namespace
|
|
7
|
+
- **`PLUGIN_NAME`** — the namespace in the `VNE` registry.
|
|
8
8
|
- **`CONSTANTS`**, **`SUBSCRIBE_EVENTS`**, **`PARAMS`**, **`SETTINGS_KEYS`**.
|
|
9
|
-
-
|
|
9
|
+
- **Types** — event payloads, the shape of global state, shared fields.
|
|
10
10
|
|
|
11
11
|
### TypeScript augmentation
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
A contract extends types through `declare module`:
|
|
14
14
|
|
|
15
15
|
- `@vnejs/registry` — `VnePluginEventsMap`, `VnePluginConstantsMap`, …
|
|
16
16
|
- `@vnejs/module` — `ModuleGlobalState`, `ModuleShared`
|
|
17
|
-
-
|
|
17
|
+
- other contracts — for cross-cutting types
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### Principles
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
21
|
+
- One contract usually matches **one plugin** in `plugins/` (1:1).
|
|
22
|
+
- A contract **does not import** an implementation from `plugins/`.
|
|
23
|
+
- The folder layout of `contracts/` mirrors the `plugins/` taxonomy.
|
|
24
24
|
|
|
25
25
|
```mermaid
|
|
26
26
|
flowchart LR
|
|
27
|
-
CT[contracts/] -->|"declare module"| TS[
|
|
28
|
-
CT -->|"CONSTANTS, EVENTS, PARAMS"| REG[regPlugin
|
|
27
|
+
CT[contracts/] -->|"declare module"| TS[VNE / Module types]
|
|
28
|
+
CT -->|"CONSTANTS, EVENTS, PARAMS"| REG[regPlugin when plugins/ load]
|
|
29
29
|
PL[plugins/] -->|"import"| CT
|
|
30
30
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dependency graph between directories
|
|
2
2
|
|
|
3
3
|
```mermaid
|
|
4
4
|
flowchart TD
|
|
@@ -6,8 +6,9 @@ flowchart TD
|
|
|
6
6
|
G --> CLI[cli/]
|
|
7
7
|
G -.->|HTTP| BE[backends/]
|
|
8
8
|
B --> P[plugins/]
|
|
9
|
-
B --> C[
|
|
10
|
-
|
|
9
|
+
B --> C[bridge/]
|
|
10
|
+
B --> SH[shared/]
|
|
11
|
+
G --> SH
|
|
11
12
|
SH --> CT[contracts/]
|
|
12
13
|
P --> CT[contracts/]
|
|
13
14
|
C --> CT
|
|
@@ -19,41 +20,42 @@ flowchart TD
|
|
|
19
20
|
CFG[configs/] --> P
|
|
20
21
|
CFG --> PKG
|
|
21
22
|
CFG --> U
|
|
22
|
-
VSC[vs_code_extensions/] -.->|"
|
|
23
|
+
VSC[vs_code_extensions/] -.->|".vne highlight"| G
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
**Dependency direction:**
|
|
26
27
|
|
|
27
|
-
|
|
|
28
|
-
| ---------------- | ----------------------------------- |
|
|
29
|
-
| `games/` | `bundles/`, `cli/`, `shared/` |
|
|
30
|
-
| `games/` | `backends/` | HTTP
|
|
31
|
-
| `bundles/` | `plugins/`, `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `plugins/` | `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `plugins/` |
|
|
38
|
-
| `
|
|
28
|
+
| From | To | Meaning |
|
|
29
|
+
| ---------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `games/` | `bundles/`, `cli/`, `shared/` | Build goes through `cli/`. The game script imports `shared/` factories. The game `package.json` does not list them |
|
|
31
|
+
| `games/` | `backends/` | HTTP to the token and label workers. No package import |
|
|
32
|
+
| `bundles/` | `plugins/`, `bridge/` | The plugin set |
|
|
33
|
+
| `bundles/` | `shared/` | The bundle lists `@vnejs/shared.*` in `dependencies` when it includes that plugin. The bundle does not re-export factories |
|
|
34
|
+
| `shared/` | `contracts/` | Setup factories read events, not implementations |
|
|
35
|
+
| `plugins/` | `contracts/` | The implementation follows the declared API |
|
|
36
|
+
| `plugins/` | `modules_extensions/` → `packages/` | Modules extend bases. Bases rest on registry and observer |
|
|
37
|
+
| `bridge/` | `contracts/` (2+) | A link by events. No import of implementations |
|
|
38
|
+
| `plugins/` | `helpers/`, `uis/` | Shared utils and UI |
|
|
39
|
+
| `plugins/` | — another `plugins/` | **No direct dependency** |
|
|
40
|
+
| `configs/` | workspace packages | Shared tsconfig. Not runtime |
|
|
39
41
|
|
|
40
|
-
##
|
|
42
|
+
## Summary
|
|
41
43
|
|
|
42
|
-
|
|
|
43
|
-
| ------------------------- |
|
|
44
|
-
| **`packages/`** |
|
|
45
|
-
| **`modules_extensions/`** |
|
|
46
|
-
| **`configs/`** |
|
|
47
|
-
| **`contracts/`** | API
|
|
48
|
-
| **`shared/`** |
|
|
49
|
-
| **`plugins/`** |
|
|
50
|
-
| **`
|
|
51
|
-
| **`bundles/`** |
|
|
52
|
-
| **`helpers/`** |
|
|
53
|
-
| **`uis/`** | React
|
|
54
|
-
| **`cli/`** |
|
|
55
|
-
| **`games/`** |
|
|
56
|
-
| **`backends/`** | Workers:
|
|
57
|
-
| **`vs_code_extensions/`** |
|
|
44
|
+
| Directory | In one line |
|
|
45
|
+
| ------------------------- | ----------------------------------- |
|
|
46
|
+
| **`packages/`** | Registry, bus, VneCore |
|
|
47
|
+
| **`modules_extensions/`** | Base classes for modules |
|
|
48
|
+
| **`configs/`** | Shared tsconfig |
|
|
49
|
+
| **`contracts/`** | Plugin API: events and types |
|
|
50
|
+
| **`shared/`** | Plugin setup presets |
|
|
51
|
+
| **`plugins/`** | Behavior on the bus |
|
|
52
|
+
| **`bridge/`** | Opt-in link between two plugins |
|
|
53
|
+
| **`bundles/`** | A set of abilities for a game |
|
|
54
|
+
| **`helpers/`** | Utils with no engine tie |
|
|
55
|
+
| **`uis/`** | React UI for views |
|
|
56
|
+
| **`cli/`** | Build the monorepo and the games |
|
|
57
|
+
| **`games/`** | Scenario, entry, and dist |
|
|
58
|
+
| **`backends/`** | Workers: Steam token and label JSON |
|
|
59
|
+
| **`vs_code_extensions/`** | `.vne` highlight |
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
**Main rule:** `plugins/` do not know each other. Integration goes through events in `contracts/` and an explicit `bridge/` package in `bundles/`.
|
package/architecture/editor.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# vs_code_extensions/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Editor extensions** for the scenario format. Not runtime.
|
|
4
4
|
|
|
5
|
-
|
|
|
6
|
-
| --------------------- |
|
|
7
|
-
| **`@vnejs/language`** |
|
|
5
|
+
| Extension | Role |
|
|
6
|
+
| --------------------- | --------------------------------------------------- |
|
|
7
|
+
| **`@vnejs/language`** | Highlight **`.vne`** in `games/*/game/**/scenario/` |
|
package/architecture/games.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# games/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Game projects.** They consume `bundles/` and `cli/`.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
games/<name>/
|
|
7
|
-
├── entry/ # index.ts, index.html →
|
|
7
|
+
├── entry/ # index.ts, index.html → import bundles/, new VneCore()
|
|
8
8
|
├── game/<mod>/ # scenario (.vne), scripts, media, public
|
|
9
9
|
├── desktop/ # Electron dev/prod
|
|
10
|
-
├── dist/ # JSON + JS
|
|
10
|
+
├── dist/ # JSON + JS after the build
|
|
11
11
|
│ ├── mods.json
|
|
12
|
-
│ ├── label/ # label/<path>.json (
|
|
13
|
-
│ └── media_info/ # media_info/<mod>.json (
|
|
12
|
+
│ ├── label/ # label/<path>.json (for example label/prologue/1.json)
|
|
13
|
+
│ └── media_info/ # media_info/<mod>.json (not the /media/ assets)
|
|
14
14
|
└── package.json
|
|
15
15
|
```
|
|
16
16
|
|
|
@@ -31,8 +31,8 @@ flowchart LR
|
|
|
31
31
|
SRV --> RUN
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
1. **`build:data`** — JSON
|
|
34
|
+
1. **`build:data`** — JSON for **`VneCore.init()`**: `mods.json`, `label/<path>.json`, `media_info/<mod>.json`.
|
|
35
35
|
2. **`build:client`** — Vite + `bundles/`.
|
|
36
36
|
3. **`entry/`** — `new VneCore()`, `await init()`.
|
|
37
37
|
|
|
38
|
-
`games/`
|
|
38
|
+
`games/` **do not build** `plugins/`. A game picks a `bundles/` package and adds content.
|
package/architecture/helpers.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# helpers/
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Plain utils** outside the event architecture.
|
|
4
4
|
|
|
5
|
-
- **`helpers/primitives/`** —
|
|
6
|
-
- **`helpers/composites/`** —
|
|
7
|
-
- **`helpers/base/`** — barrel **`@vnejs/helpers`** (
|
|
5
|
+
- **`helpers/primitives/`** — atomic functions (`tokenize-*`, `get-id`, `to-json`, …).
|
|
6
|
+
- **`helpers/composites/`** — composite utils on top of primitives (for example `call-all-promises`).
|
|
7
|
+
- **`helpers/base/`** — barrel **`@vnejs/helpers`** (re-exports primitives and composites).
|
|
8
8
|
|
|
9
9
|
```mermaid
|
|
10
10
|
flowchart LR
|
|
11
11
|
H[helpers/] --> P[plugins/]
|
|
12
12
|
H --> CORE[VneCore]
|
|
13
|
-
H -.->|"
|
|
13
|
+
H -.->|"no tie"| VNE[(VNE / Observer)]
|
|
14
14
|
```
|
package/architecture/model.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# VNEJS monorepo architecture
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file describes the **shared model** of the monorepo: engine directories, dependency direction, and how a game is built. It does not list concrete packages. It states principles and links.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Model
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The engine is an **event bus** and a **global registry**:
|
|
8
8
|
|
|
9
|
-
- **`Observer`** —
|
|
10
|
-
- **`VNE`** —
|
|
11
|
-
- **`VneCore`** — runtime
|
|
9
|
+
- **`Observer`** — the event bus. Modules subscribe (`on`) and publish (`emit`) by string keys.
|
|
10
|
+
- **`VNE`** — the registry, filled at load: `CONST`, `EVENTS`, `SETTINGS`, `PARAMS`, one namespace per plugin.
|
|
11
|
+
- **`VneCore`** — the runtime. It builds registered modules, injects dependencies, and runs the lifecycle (`inject → subscribe → setup → init → start`).
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Registration is a **side effect of import**. On import, the package calls `regPlugin` or `regModule` at once. It does not wait for an explicit API call.
|
|
14
14
|
|
|
15
15
|
```mermaid
|
|
16
16
|
flowchart LR
|
|
17
|
-
subgraph load ["
|
|
17
|
+
subgraph load ["Load bundles/"]
|
|
18
18
|
I[side-effect import]
|
|
19
19
|
RP[regPlugin / regModule]
|
|
20
20
|
VNE[(VNE + VNE_MODULES)]
|
|
@@ -24,21 +24,21 @@ flowchart LR
|
|
|
24
24
|
subgraph runtime ["Runtime"]
|
|
25
25
|
VC[VneCore]
|
|
26
26
|
OBS[Observer]
|
|
27
|
-
VC -->|"
|
|
27
|
+
VC -->|"creates modules from VNE_MODULES"| MOD[Modules]
|
|
28
28
|
MOD -->|"on / emit"| OBS
|
|
29
|
-
MOD -->|"
|
|
29
|
+
MOD -->|"reads"| VNE
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
VNE --> VC
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## npm package names
|
|
36
36
|
|
|
37
37
|
```
|
|
38
38
|
plugins/core/system/ → @vnejs/plugins.core.system
|
|
39
39
|
contracts/text/text/ → @vnejs/contracts.text
|
|
40
40
|
shared/views.screens/gamemenu/ → @vnejs/shared.views.screens.gamemenu
|
|
41
|
-
|
|
41
|
+
bridge/plugins.text/plugins.scenario.autoread/ → @vnejs/bridge.plugins.text.plugins.scenario.autoread
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
A slash in the path becomes a dot in the name. `bridge/` repeats `plugins.` so the two plugin packages stay visible.
|