next2d-development-mcp 0.0.1
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 +344 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +211 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/prompts.test.d.ts +2 -0
- package/dist/prompts/prompts.test.d.ts.map +1 -0
- package/dist/prompts/prompts.test.js +23 -0
- package/dist/prompts/prompts.test.js.map +1 -0
- package/dist/references/develop-specs.md +1576 -0
- package/dist/references/framework-specs.md +1687 -0
- package/dist/references/player-specs.md +3292 -0
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +185 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/resources.test.d.ts +2 -0
- package/dist/resources/resources.test.d.ts.map +1 -0
- package/dist/resources/resources.test.js +32 -0
- package/dist/resources/resources.test.js.map +1 -0
- package/dist/templates/animation.d.ts +6 -0
- package/dist/templates/animation.d.ts.map +1 -0
- package/dist/templates/animation.js +65 -0
- package/dist/templates/animation.js.map +1 -0
- package/dist/templates/animation.test.d.ts +2 -0
- package/dist/templates/animation.test.d.ts.map +1 -0
- package/dist/templates/animation.test.js +30 -0
- package/dist/templates/animation.test.js.map +1 -0
- package/dist/templates/domainService.d.ts +9 -0
- package/dist/templates/domainService.d.ts.map +1 -0
- package/dist/templates/domainService.js +56 -0
- package/dist/templates/domainService.js.map +1 -0
- package/dist/templates/domainService.test.d.ts +2 -0
- package/dist/templates/domainService.test.d.ts.map +1 -0
- package/dist/templates/domainService.test.js +33 -0
- package/dist/templates/domainService.test.js.map +1 -0
- package/dist/templates/interfaceFile.d.ts +5 -0
- package/dist/templates/interfaceFile.d.ts.map +1 -0
- package/dist/templates/interfaceFile.js +16 -0
- package/dist/templates/interfaceFile.js.map +1 -0
- package/dist/templates/interfaceFile.test.d.ts +2 -0
- package/dist/templates/interfaceFile.test.d.ts.map +1 -0
- package/dist/templates/interfaceFile.test.js +30 -0
- package/dist/templates/interfaceFile.test.js.map +1 -0
- package/dist/templates/loading.d.ts +5 -0
- package/dist/templates/loading.d.ts.map +1 -0
- package/dist/templates/loading.js +62 -0
- package/dist/templates/loading.js.map +1 -0
- package/dist/templates/loading.test.d.ts +2 -0
- package/dist/templates/loading.test.d.ts.map +1 -0
- package/dist/templates/loading.test.js +31 -0
- package/dist/templates/loading.test.js.map +1 -0
- package/dist/templates/repository.d.ts +2 -0
- package/dist/templates/repository.d.ts.map +1 -0
- package/dist/templates/repository.js +42 -0
- package/dist/templates/repository.js.map +1 -0
- package/dist/templates/repository.test.d.ts +2 -0
- package/dist/templates/repository.test.d.ts.map +1 -0
- package/dist/templates/repository.test.js +44 -0
- package/dist/templates/repository.test.js.map +1 -0
- package/dist/templates/uiComponent.d.ts +4 -0
- package/dist/templates/uiComponent.d.ts.map +1 -0
- package/dist/templates/uiComponent.js +108 -0
- package/dist/templates/uiComponent.js.map +1 -0
- package/dist/templates/uiComponent.test.d.ts +2 -0
- package/dist/templates/uiComponent.test.d.ts.map +1 -0
- package/dist/templates/uiComponent.test.js +76 -0
- package/dist/templates/uiComponent.test.js.map +1 -0
- package/dist/templates/usecase.d.ts +2 -0
- package/dist/templates/usecase.d.ts.map +1 -0
- package/dist/templates/usecase.js +31 -0
- package/dist/templates/usecase.js.map +1 -0
- package/dist/templates/usecase.test.d.ts +2 -0
- package/dist/templates/usecase.test.d.ts.map +1 -0
- package/dist/templates/usecase.test.js +23 -0
- package/dist/templates/usecase.test.js.map +1 -0
- package/dist/templates/view.d.ts +3 -0
- package/dist/templates/view.d.ts.map +1 -0
- package/dist/templates/view.js +112 -0
- package/dist/templates/view.js.map +1 -0
- package/dist/templates/view.test.d.ts +2 -0
- package/dist/templates/view.test.d.ts.map +1 -0
- package/dist/templates/view.test.js +71 -0
- package/dist/templates/view.test.js.map +1 -0
- package/dist/tools/addRoute.d.ts +3 -0
- package/dist/tools/addRoute.d.ts.map +1 -0
- package/dist/tools/addRoute.js +101 -0
- package/dist/tools/addRoute.js.map +1 -0
- package/dist/tools/createAnimation.d.ts +3 -0
- package/dist/tools/createAnimation.d.ts.map +1 -0
- package/dist/tools/createAnimation.js +53 -0
- package/dist/tools/createAnimation.js.map +1 -0
- package/dist/tools/createDomainService.d.ts +3 -0
- package/dist/tools/createDomainService.d.ts.map +1 -0
- package/dist/tools/createDomainService.js +82 -0
- package/dist/tools/createDomainService.js.map +1 -0
- package/dist/tools/createInterface.d.ts +3 -0
- package/dist/tools/createInterface.d.ts.map +1 -0
- package/dist/tools/createInterface.js +59 -0
- package/dist/tools/createInterface.js.map +1 -0
- package/dist/tools/createLoading.d.ts +3 -0
- package/dist/tools/createLoading.d.ts.map +1 -0
- package/dist/tools/createLoading.js +52 -0
- package/dist/tools/createLoading.js.map +1 -0
- package/dist/tools/createRepository.d.ts +3 -0
- package/dist/tools/createRepository.d.ts.map +1 -0
- package/dist/tools/createRepository.js +55 -0
- package/dist/tools/createRepository.js.map +1 -0
- package/dist/tools/createUiComponent.d.ts +3 -0
- package/dist/tools/createUiComponent.d.ts.map +1 -0
- package/dist/tools/createUiComponent.js +80 -0
- package/dist/tools/createUiComponent.js.map +1 -0
- package/dist/tools/createUseCase.d.ts +3 -0
- package/dist/tools/createUseCase.d.ts.map +1 -0
- package/dist/tools/createUseCase.js +52 -0
- package/dist/tools/createUseCase.js.map +1 -0
- package/dist/tools/createView.d.ts +3 -0
- package/dist/tools/createView.d.ts.map +1 -0
- package/dist/tools/createView.js +59 -0
- package/dist/tools/createView.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +25 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/tools.test.d.ts +2 -0
- package/dist/tools/tools.test.d.ts.map +1 -0
- package/dist/tools/tools.test.js +58 -0
- package/dist/tools/tools.test.js.map +1 -0
- package/dist/tools/validateArchitecture.d.ts +3 -0
- package/dist/tools/validateArchitecture.d.ts.map +1 -0
- package/dist/tools/validateArchitecture.js +134 -0
- package/dist/tools/validateArchitecture.js.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +18 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.test.d.ts +2 -0
- package/dist/utils.test.d.ts.map +1 -0
- package/dist/utils.test.js +34 -0
- package/dist/utils.test.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4BzE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmFzD"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = path.dirname(__filename);
|
|
6
|
+
function loadReference(filename) {
|
|
7
|
+
// Search locations (in priority order):
|
|
8
|
+
// 1. Bundled with package: dist/references/ (works after npm publish)
|
|
9
|
+
// 2. Development: .github/skills/references/ (relative to project root)
|
|
10
|
+
// 3. User's project: cwd/.github/skills/references/ (if user has specs locally)
|
|
11
|
+
const candidates = [
|
|
12
|
+
path.join(__dirname, "..", "references", filename),
|
|
13
|
+
path.join(__dirname, "..", "..", ".github", "skills", "references", filename),
|
|
14
|
+
path.join(process.cwd(), ".github", "skills", "references", filename)
|
|
15
|
+
];
|
|
16
|
+
for (const candidate of candidates) {
|
|
17
|
+
if (fs.existsSync(candidate)) {
|
|
18
|
+
return fs.readFileSync(candidate, "utf-8");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return `Reference file '${filename}' not found. Searched: ${candidates.join(", ")}`;
|
|
22
|
+
}
|
|
23
|
+
export function registerResources(server) {
|
|
24
|
+
server.registerResource("player-specs", "next2d://specs/player", {
|
|
25
|
+
"description": "Next2D Player API reference - DisplayObject, MovieClip, Sprite, Shape, TextField, " +
|
|
26
|
+
"Video, Sound, Tween, Events, Filters, Geom. Read when implementing rendering, " +
|
|
27
|
+
"animation, graphics, or interaction logic.",
|
|
28
|
+
"mimeType": "text/markdown"
|
|
29
|
+
}, async () => ({
|
|
30
|
+
"contents": [
|
|
31
|
+
{
|
|
32
|
+
"uri": "next2d://specs/player",
|
|
33
|
+
"mimeType": "text/markdown",
|
|
34
|
+
"text": loadReference("player-specs.md")
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}));
|
|
38
|
+
server.registerResource("framework-specs", "next2d://specs/framework", {
|
|
39
|
+
"description": "Next2D Framework reference - MVVM architecture, routing, config, " +
|
|
40
|
+
"View/ViewModel lifecycle, Animation Tool integration, gotoView flow. " +
|
|
41
|
+
"Read when working on application architecture, screen transitions, or configuration.",
|
|
42
|
+
"mimeType": "text/markdown"
|
|
43
|
+
}, async () => ({
|
|
44
|
+
"contents": [
|
|
45
|
+
{
|
|
46
|
+
"uri": "next2d://specs/framework",
|
|
47
|
+
"mimeType": "text/markdown",
|
|
48
|
+
"text": loadReference("framework-specs.md")
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}));
|
|
52
|
+
server.registerResource("develop-specs", "next2d://specs/develop", {
|
|
53
|
+
"description": "Development template specs - project structure, CLI commands, interfaces, " +
|
|
54
|
+
"Model layer, UI layer with Atomic Design, View/ViewModel patterns. " +
|
|
55
|
+
"Read when creating new components, setting up projects, or following coding patterns.",
|
|
56
|
+
"mimeType": "text/markdown"
|
|
57
|
+
}, async () => ({
|
|
58
|
+
"contents": [
|
|
59
|
+
{
|
|
60
|
+
"uri": "next2d://specs/develop",
|
|
61
|
+
"mimeType": "text/markdown",
|
|
62
|
+
"text": loadReference("develop-specs.md")
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}));
|
|
66
|
+
server.registerResource("architecture-overview", "next2d://architecture", {
|
|
67
|
+
"description": "Next2D architecture overview - Clean Architecture layers, MVVM pattern, " +
|
|
68
|
+
"dependency rules, and data flow diagrams.",
|
|
69
|
+
"mimeType": "text/markdown"
|
|
70
|
+
}, async () => ({
|
|
71
|
+
"contents": [
|
|
72
|
+
{
|
|
73
|
+
"uri": "next2d://architecture",
|
|
74
|
+
"mimeType": "text/markdown",
|
|
75
|
+
"text": ARCHITECTURE_OVERVIEW
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
const ARCHITECTURE_OVERVIEW = `# Next2D Architecture Overview
|
|
81
|
+
|
|
82
|
+
## Technology Stack
|
|
83
|
+
- **Rendering Engine**: Next2D Player (WebGL/WebGPU hardware-accelerated 2D)
|
|
84
|
+
- **Framework**: Next2D Framework (MVVM + Clean Architecture)
|
|
85
|
+
- **UI Design**: Atomic Design (Atom/Molecule/Organism/Page)
|
|
86
|
+
- **Language**: TypeScript (strict, no \`any\`)
|
|
87
|
+
- **Build Tool**: Vite
|
|
88
|
+
- **Testing**: Vitest
|
|
89
|
+
- **Platforms**: Web, Steam (Windows/macOS/Linux), iOS, Android
|
|
90
|
+
|
|
91
|
+
## Layer Architecture
|
|
92
|
+
|
|
93
|
+
\`\`\`
|
|
94
|
+
View Layer (view/, ui/)
|
|
95
|
+
└─ depends on ─→ Interface Layer (interface/)
|
|
96
|
+
↑
|
|
97
|
+
Application Layer (model/application/)
|
|
98
|
+
├─ depends on ─→ Interface Layer
|
|
99
|
+
├─ depends on ─→ Domain Layer (model/domain/)
|
|
100
|
+
└─ calls ──────→ Infrastructure Layer (model/infrastructure/)
|
|
101
|
+
\`\`\`
|
|
102
|
+
|
|
103
|
+
### View Layer (src/view/, src/ui/)
|
|
104
|
+
- **View**: Extends Sprite, manages display structure. No business logic.
|
|
105
|
+
- **ViewModel**: Bridge between View and Model. Holds UseCases.
|
|
106
|
+
- **UI Components**: Atomic Design hierarchy (Atom → Molecule → Organism → Page)
|
|
107
|
+
|
|
108
|
+
### Interface Layer (src/interface/)
|
|
109
|
+
- TypeScript interfaces with \`I\` prefix
|
|
110
|
+
- Defines contracts between layers
|
|
111
|
+
- Enables dependency inversion
|
|
112
|
+
|
|
113
|
+
### Application Layer (src/model/application/)
|
|
114
|
+
- **UseCase**: 1 action = 1 class. Entry point: \`execute()\`
|
|
115
|
+
- Orchestrates business logic
|
|
116
|
+
- Depends only on interfaces and domain
|
|
117
|
+
|
|
118
|
+
### Domain Layer (src/model/domain/)
|
|
119
|
+
- Core business rules
|
|
120
|
+
- No external API/DB dependencies (Next2D display APIs are allowed)
|
|
121
|
+
- Pure logic (callbacks, services)
|
|
122
|
+
|
|
123
|
+
### Infrastructure Layer (src/model/infrastructure/)
|
|
124
|
+
- **Repository**: Data access abstraction
|
|
125
|
+
- External API calls with try-catch
|
|
126
|
+
- Endpoints from config.json
|
|
127
|
+
|
|
128
|
+
## Configuration Files
|
|
129
|
+
|
|
130
|
+
### stage.json
|
|
131
|
+
\`\`\`json
|
|
132
|
+
{ "width": 240, "height": 240, "fps": 60, "options": { "fullScreen": true } }
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
### config.json
|
|
136
|
+
Environment-specific settings (local/dev/stg/prd) + common settings (all).
|
|
137
|
+
- \`defaultTop\`: Default view name
|
|
138
|
+
- \`spa\`: Enable SPA mode
|
|
139
|
+
- \`loading.callback\`: Loading screen class
|
|
140
|
+
- \`gotoView.callback\`: Post-transition callback(s)
|
|
141
|
+
|
|
142
|
+
### routing.json
|
|
143
|
+
URL-to-View mapping with request configurations.
|
|
144
|
+
- \`type\`: json | content | custom | cluster
|
|
145
|
+
- \`path\`: URL with config variable interpolation (\`{{ api.endPoint }}\`)
|
|
146
|
+
- \`name\`: Response key for \`app.getResponse().get(name)\`
|
|
147
|
+
- \`cache\`: Persist data across screen transitions
|
|
148
|
+
|
|
149
|
+
## View Lifecycle
|
|
150
|
+
\`\`\`
|
|
151
|
+
ViewModel.constructor → ViewModel.initialize() → View.constructor(vm) → View.initialize() → View.onEnter() → (interaction) → View.onExit()
|
|
152
|
+
\`\`\`
|
|
153
|
+
|
|
154
|
+
## Key Rules
|
|
155
|
+
1. View: Display only. Delegate events to ViewModel.
|
|
156
|
+
2. ViewModel: Hold UseCases. Depend on interfaces. Get data via \`app.getResponse()\`.
|
|
157
|
+
3. UseCase: Single responsibility. \`execute()\` entry point. Can call Repository, Domain, framework APIs.
|
|
158
|
+
4. Repository: try-catch required. Config for endpoints. Return typed interfaces.
|
|
159
|
+
5. Interface: \`I\` prefix. Minimal properties.
|
|
160
|
+
6. No \`any\` type. Explicit types always.
|
|
161
|
+
7. Domain: No external API/DB dependencies (Next2D display APIs allowed). Pure business logic.
|
|
162
|
+
8. Animation: Separate from components. Use Tween/Easing/Job.
|
|
163
|
+
|
|
164
|
+
## DisplayObject Centering Pattern
|
|
165
|
+
\`\`\`typescript
|
|
166
|
+
// Center child in parent for correct scale/rotation pivot
|
|
167
|
+
const sprite = new Sprite();
|
|
168
|
+
const child = new Shape();
|
|
169
|
+
child.x = -child.width / 2;
|
|
170
|
+
child.y = -child.height / 2;
|
|
171
|
+
sprite.addChild(child);
|
|
172
|
+
\`\`\`
|
|
173
|
+
|
|
174
|
+
## npm Commands
|
|
175
|
+
| Command | Description |
|
|
176
|
+
|---------|-------------|
|
|
177
|
+
| \`npm start\` | Dev server (Vite, localhost:5173) |
|
|
178
|
+
| \`npm test\` | Run tests (Vitest) |
|
|
179
|
+
| \`npm run generate\` | Auto-generate View/ViewModel from routing.json |
|
|
180
|
+
| \`npm run build:web -- --env prd\` | Build for web |
|
|
181
|
+
| \`npm run build:steam:windows -- --env prd\` | Build for Steam/Windows |
|
|
182
|
+
| \`npm run build:ios -- --env prd\` | Build for iOS |
|
|
183
|
+
| \`npm run build:android -- --env prd\` | Build for Android |
|
|
184
|
+
`;
|
|
185
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,SAAS,aAAa,CAAC,QAAgB;IACnC,wCAAwC;IACxC,sEAAsE;IACtE,wEAAwE;IACxE,gFAAgF;IAChF,MAAM,UAAU,GAAG;QACf,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC;QAClD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC;QAC7E,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC;KACxE,CAAC;IAEF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACjC,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;IACL,CAAC;IAED,OAAO,mBAAmB,QAAQ,0BAA0B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,M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R;gBACI,KAAK,EAAE,uBAAuB;gBAC9B,UAAU,EAAE,eAAe;gBAC3B,MAAM,EAAE,qBAAqB;aAChC;SACJ;KACJ,CAAC,CACL,CAAC;AACN,CAAC;AAED,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwG7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.test.d.ts","sourceRoot":"","sources":["../../src/resources/resources.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { registerResources } from "./index.js";
|
|
4
|
+
describe("Resource registration", () => {
|
|
5
|
+
let server;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
server = new McpServer({ name: "test", version: "0.0.1" });
|
|
8
|
+
});
|
|
9
|
+
it("registers 4 resources without error", () => {
|
|
10
|
+
const spy = vi.spyOn(server, "registerResource");
|
|
11
|
+
registerResources(server);
|
|
12
|
+
expect(spy).toHaveBeenCalledTimes(4);
|
|
13
|
+
});
|
|
14
|
+
it("registers expected resource names", () => {
|
|
15
|
+
const spy = vi.spyOn(server, "registerResource");
|
|
16
|
+
registerResources(server);
|
|
17
|
+
const names = spy.mock.calls.map((call) => call[0]);
|
|
18
|
+
expect(names).toContain("player-specs");
|
|
19
|
+
expect(names).toContain("framework-specs");
|
|
20
|
+
expect(names).toContain("develop-specs");
|
|
21
|
+
expect(names).toContain("architecture-overview");
|
|
22
|
+
});
|
|
23
|
+
it("uses next2d:// URI scheme", () => {
|
|
24
|
+
const spy = vi.spyOn(server, "registerResource");
|
|
25
|
+
registerResources(server);
|
|
26
|
+
const uris = spy.mock.calls.map((call) => call[1]);
|
|
27
|
+
for (const uri of uris) {
|
|
28
|
+
expect(String(uri)).toMatch(/^next2d:\/\//);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=resources.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.test.js","sourceRoot":"","sources":["../../src/resources/resources.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,IAAI,MAAiB,CAAC;IAEtB,UAAU,CAAC,GAAG,EAAE;QACZ,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC3C,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACjD,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACzC,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACjD,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACjC,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACjD,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAChD,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../src/templates/animation.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACnB,MAAM,CA2DR"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { toPascalCase } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Animation class template
|
|
4
|
+
* Naming: {Component}{Action}Animation.ts
|
|
5
|
+
*/
|
|
6
|
+
export function generateAnimation(componentName, actionName) {
|
|
7
|
+
const component = toPascalCase(componentName);
|
|
8
|
+
const action = toPascalCase(actionName);
|
|
9
|
+
const className = `${component}${action}Animation`;
|
|
10
|
+
return `import type { Sprite } from "@next2d/display";
|
|
11
|
+
import { Tween, Easing, type Job } from "@next2d/ui";
|
|
12
|
+
import { Event } from "@next2d/events";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description ${component}の${action}アニメーション
|
|
16
|
+
* ${action} animation for ${component}
|
|
17
|
+
*
|
|
18
|
+
* @class
|
|
19
|
+
*/
|
|
20
|
+
export class ${className} {
|
|
21
|
+
|
|
22
|
+
private readonly _job: Job;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {Sprite} sprite - アニメーション対象
|
|
26
|
+
* @param {() => void} callback - 完了時コールバック
|
|
27
|
+
* @constructor
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
constructor (
|
|
31
|
+
sprite: Sprite,
|
|
32
|
+
callback: () => void
|
|
33
|
+
) {
|
|
34
|
+
// 初期状態設定
|
|
35
|
+
sprite.alpha = 0;
|
|
36
|
+
|
|
37
|
+
// Tween設定: (対象, 開始値, 終了値, 秒数, 遅延秒数, イージング)
|
|
38
|
+
this._job = Tween.add(sprite,
|
|
39
|
+
{ "alpha": 0 },
|
|
40
|
+
{ "alpha": 1 },
|
|
41
|
+
0.5, 0, Easing.outQuad
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
this._job.addEventListener(Event.COMPLETE, (): void =>
|
|
45
|
+
{
|
|
46
|
+
callback();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @description アニメーション開始
|
|
52
|
+
* Start animation
|
|
53
|
+
*
|
|
54
|
+
* @return {void}
|
|
55
|
+
* @method
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
start (): void
|
|
59
|
+
{
|
|
60
|
+
this._job.start();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../../src/templates/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC7B,aAAqB,EACrB,UAAkB;IAElB,MAAM,SAAS,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,GAAG,SAAS,GAAG,MAAM,WAAW,CAAC;IAEnD,OAAO;;;;;kBAKO,SAAS,IAAI,MAAM;kBACnB,MAAM,kBAAkB,SAAS;;;;eAIpC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CvB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.test.d.ts","sourceRoot":"","sources":["../../src/templates/animation.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { generateAnimation } from "./animation.js";
|
|
3
|
+
describe("generateAnimation", () => {
|
|
4
|
+
it("generates animation class with correct naming", () => {
|
|
5
|
+
const code = generateAnimation("TopBtn", "Show");
|
|
6
|
+
expect(code).toContain("export class TopBtnShowAnimation");
|
|
7
|
+
});
|
|
8
|
+
it("imports Tween and Easing from @next2d/ui", () => {
|
|
9
|
+
const code = generateAnimation("TopBtn", "Show");
|
|
10
|
+
expect(code).toContain('import { Tween, Easing, type Job } from "@next2d/ui"');
|
|
11
|
+
});
|
|
12
|
+
it("imports Event from @next2d/events", () => {
|
|
13
|
+
const code = generateAnimation("TopBtn", "Show");
|
|
14
|
+
expect(code).toContain('import { Event } from "@next2d/events"');
|
|
15
|
+
});
|
|
16
|
+
it("includes start method", () => {
|
|
17
|
+
const code = generateAnimation("TopBtn", "Show");
|
|
18
|
+
expect(code).toContain("start (): void");
|
|
19
|
+
});
|
|
20
|
+
it("includes callback support via Event.COMPLETE", () => {
|
|
21
|
+
const code = generateAnimation("TopBtn", "Show");
|
|
22
|
+
expect(code).toContain("Event.COMPLETE");
|
|
23
|
+
});
|
|
24
|
+
it("takes Sprite parameter and required callback", () => {
|
|
25
|
+
const code = generateAnimation("TopBtn", "Show");
|
|
26
|
+
expect(code).toContain("sprite: Sprite");
|
|
27
|
+
expect(code).toContain("callback: () => void");
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=animation.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.test.js","sourceRoot":"","sources":["../../src/templates/animation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,sDAAsD,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACzC,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,wCAAwC,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC7B,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACpD,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACpD,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain service template (functional style)
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateDomainService(featureName: string, actionName: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Domain callback template (for gotoView.callback)
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateDomainCallback(name: string): string;
|
|
9
|
+
//# sourceMappingURL=domainService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domainService.d.ts","sourceRoot":"","sources":["../../src/templates/domainService.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,qBAAqB,CACjC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACnB,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgC3D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { toPascalCase } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Domain service template (functional style)
|
|
4
|
+
*/
|
|
5
|
+
export function generateDomainService(featureName, actionName) {
|
|
6
|
+
const feature = toPascalCase(featureName);
|
|
7
|
+
const action = toPascalCase(actionName);
|
|
8
|
+
return `/**
|
|
9
|
+
* @description ${feature}の${action}サービス
|
|
10
|
+
* ${action} service for ${feature}
|
|
11
|
+
*
|
|
12
|
+
* @param {unknown} param
|
|
13
|
+
* @return {void}
|
|
14
|
+
*/
|
|
15
|
+
export const execute = (param: unknown): void =>
|
|
16
|
+
{
|
|
17
|
+
// TODO: Implement domain business logic
|
|
18
|
+
};
|
|
19
|
+
`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Domain callback template (for gotoView.callback)
|
|
23
|
+
*/
|
|
24
|
+
export function generateDomainCallback(name) {
|
|
25
|
+
const pascal = toPascalCase(name);
|
|
26
|
+
return `import { app } from "@next2d/framework";
|
|
27
|
+
import { Shape, stage } from "@next2d/display";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @description ${pascal}コールバック (gotoView完了後に実行)
|
|
31
|
+
* ${pascal} callback (executed after gotoView completes)
|
|
32
|
+
*
|
|
33
|
+
* @class
|
|
34
|
+
*/
|
|
35
|
+
export class ${pascal} {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description コールバック実行
|
|
39
|
+
* Execute callback
|
|
40
|
+
*
|
|
41
|
+
* @return {void}
|
|
42
|
+
* @method
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
execute (): void
|
|
46
|
+
{
|
|
47
|
+
const context = app.getContext();
|
|
48
|
+
const view = context.view;
|
|
49
|
+
if (!view) return;
|
|
50
|
+
|
|
51
|
+
// TODO: Implement callback logic
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=domainService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domainService.js","sourceRoot":"","sources":["../../src/templates/domainService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACjC,WAAmB,EACnB,UAAkB;IAElB,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;IAExC,OAAO;kBACO,OAAO,IAAI,MAAM;kBACjB,MAAM,gBAAgB,OAAO;;;;;;;;;CAS9C,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO;;;;kBAIO,MAAM;kBACN,MAAM;;;;eAIT,MAAM;;;;;;;;;;;;;;;;;;;CAmBpB,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domainService.test.d.ts","sourceRoot":"","sources":["../../src/templates/domainService.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { generateDomainService, generateDomainCallback } from "./domainService.js";
|
|
3
|
+
describe("generateDomainService", () => {
|
|
4
|
+
it("generates functional-style service with execute export", () => {
|
|
5
|
+
const code = generateDomainService("Background", "Draw");
|
|
6
|
+
expect(code).toContain("export const execute =");
|
|
7
|
+
});
|
|
8
|
+
it("uses correct parameter types", () => {
|
|
9
|
+
const code = generateDomainService("Background", "Draw");
|
|
10
|
+
expect(code).toContain("(param: unknown): void");
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
describe("generateDomainCallback", () => {
|
|
14
|
+
it("generates callback class with execute method", () => {
|
|
15
|
+
const code = generateDomainCallback("Background");
|
|
16
|
+
expect(code).toContain("export class Background");
|
|
17
|
+
expect(code).toContain("execute (): void");
|
|
18
|
+
});
|
|
19
|
+
it("imports app from framework", () => {
|
|
20
|
+
const code = generateDomainCallback("Background");
|
|
21
|
+
expect(code).toContain('import { app } from "@next2d/framework"');
|
|
22
|
+
});
|
|
23
|
+
it("imports display objects for stage manipulation", () => {
|
|
24
|
+
const code = generateDomainCallback("Background");
|
|
25
|
+
expect(code).toContain('import { Shape, stage } from "@next2d/display"');
|
|
26
|
+
});
|
|
27
|
+
it("accesses context.view", () => {
|
|
28
|
+
const code = generateDomainCallback("Background");
|
|
29
|
+
expect(code).toContain("app.getContext()");
|
|
30
|
+
expect(code).toContain("context.view");
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=domainService.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domainService.test.js","sourceRoot":"","sources":["../../src/templates/domainService.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,MAAM,IAAI,GAAG,qBAAqB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACzD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACpC,MAAM,IAAI,GAAG,qBAAqB,CAAC,YAAY,EAAE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":"AAEA,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAM,GACvD,MAAM,CAeR"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { toPascalCase } from "../utils.js";
|
|
2
|
+
export function generateInterface(name, properties = []) {
|
|
3
|
+
const pascal = toPascalCase(name);
|
|
4
|
+
const interfaceName = pascal.startsWith("I") ? pascal : `I${pascal}`;
|
|
5
|
+
const propsStr = properties.length > 0
|
|
6
|
+
? properties.map((p) => ` ${p.name}: ${p.type};`).join("\n")
|
|
7
|
+
: " // TODO: Define properties";
|
|
8
|
+
return `/**
|
|
9
|
+
* @interface
|
|
10
|
+
*/
|
|
11
|
+
export interface ${interfaceName} {
|
|
12
|
+
${propsStr}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=interfaceFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaceFile.js","sourceRoot":"","sources":["../../src/templates/interfaceFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,UAAU,iBAAiB,CAC7B,IAAY,EACZ,aAAoD,EAAE;IAEtD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;IAErE,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC;QAClC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC/D,CAAC,CAAC,gCAAgC,CAAC;IAEvC,OAAO;;;mBAGQ,aAAa;EAC9B,QAAQ;;CAET,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaceFile.test.d.ts","sourceRoot":"","sources":["../../src/templates/interfaceFile.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { generateInterface } from "./interfaceFile.js";
|
|
3
|
+
describe("generateInterface", () => {
|
|
4
|
+
it("generates interface with I prefix", () => {
|
|
5
|
+
const code = generateInterface("Draggable");
|
|
6
|
+
expect(code).toContain("export interface IDraggable");
|
|
7
|
+
});
|
|
8
|
+
it("does not double-prefix if already starts with I", () => {
|
|
9
|
+
const code = generateInterface("IDraggable");
|
|
10
|
+
expect(code).toContain("export interface IDraggable");
|
|
11
|
+
expect(code).not.toContain("IIDraggable");
|
|
12
|
+
});
|
|
13
|
+
it("generates properties", () => {
|
|
14
|
+
const code = generateInterface("UserData", [
|
|
15
|
+
{ name: "id", type: "number" },
|
|
16
|
+
{ name: "name", type: "string" },
|
|
17
|
+
]);
|
|
18
|
+
expect(code).toContain("id: number;");
|
|
19
|
+
expect(code).toContain("name: string;");
|
|
20
|
+
});
|
|
21
|
+
it("generates TODO comment when no properties", () => {
|
|
22
|
+
const code = generateInterface("Empty");
|
|
23
|
+
expect(code).toContain("// TODO: Define properties");
|
|
24
|
+
});
|
|
25
|
+
it("handles slash-separated name", () => {
|
|
26
|
+
const code = generateInterface("home/text");
|
|
27
|
+
expect(code).toContain("export interface IHomeText");
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=interfaceFile.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaceFile.test.js","sourceRoot":"","sources":["../../src/templates/interfaceFile.test.ts"],"names":[],"mappings":"AAA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IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACpC,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../src/templates/loading.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAyDhE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { toPascalCase } from "../utils.js";
|
|
2
|
+
/**
|
|
3
|
+
* Loading class template (for config.json loading.callback)
|
|
4
|
+
*/
|
|
5
|
+
export function generateLoading(name = "Loading") {
|
|
6
|
+
const pascal = toPascalCase(name);
|
|
7
|
+
return `import { Shape, stage } from "@next2d/display";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description ローディング画面
|
|
11
|
+
* Loading Screen
|
|
12
|
+
*
|
|
13
|
+
* @class
|
|
14
|
+
*/
|
|
15
|
+
export class ${pascal} {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @type {Shape}
|
|
19
|
+
* @private
|
|
20
|
+
* @readonly
|
|
21
|
+
*/
|
|
22
|
+
private readonly _shape: Shape;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @constructor
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
constructor ()
|
|
29
|
+
{
|
|
30
|
+
this._shape = new Shape();
|
|
31
|
+
// TODO: Initialize loading display (e.g. spinner, progress bar)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @description ローディング開始時に呼ばれる
|
|
36
|
+
* Called when loading starts
|
|
37
|
+
*
|
|
38
|
+
* @return {void}
|
|
39
|
+
* @method
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
start (): void
|
|
43
|
+
{
|
|
44
|
+
stage.addChild(this._shape);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description ローディング終了時に呼ばれる
|
|
49
|
+
* Called when loading ends
|
|
50
|
+
*
|
|
51
|
+
* @return {void}
|
|
52
|
+
* @method
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
end (): void
|
|
56
|
+
{
|
|
57
|
+
this._shape.remove();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=loading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading.js","sourceRoot":"","sources":["../../src/templates/loading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,SAAS;IACpD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO;;;;;;;;eAQI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CpB,CAAC;AACF,CAAC"}
|