@next2d/view-generator 3.0.12 → 4.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.
Files changed (2) hide show
  1. package/dist/index.js +77 -37
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import pc from "picocolors";
4
4
  import path from "path";
5
5
  import fs from "fs";
6
- const recommendeVersion = 18;
6
+ const recommendeVersion = 22;
7
7
  const version = process.versions.node;
8
8
  if (recommendeVersion > parseInt(version.split(".")[0])) {
9
9
  pc.red(`You are running Node Version:${version}.
@@ -41,12 +41,43 @@ const createViewFileForJavaScript = (name) => {
41
41
  export class ${name}View extends View
42
42
  {
43
43
  /**
44
+ * @param {${name}ViewModel} vm
44
45
  * @constructor
45
46
  * @public
46
47
  */
47
- constructor ()
48
+ constructor (vm)
48
49
  {
49
- super();
50
+ super(vm);
51
+ }
52
+
53
+ /**
54
+ * @return {Promise<void>}
55
+ * @method
56
+ * @public
57
+ */
58
+ async initialize ()
59
+ {
60
+ return void 0;
61
+ }
62
+
63
+ /**
64
+ * @return {Promise<void>}
65
+ * @method
66
+ * @public
67
+ */
68
+ async onEnter ()
69
+ {
70
+ return void 0;
71
+ }
72
+
73
+ /**
74
+ * @return {Promise<void>}
75
+ * @method
76
+ * @public
77
+ */
78
+ async onExit ()
79
+ {
80
+ return void 0;
50
81
  }
51
82
  }`;
52
83
  };
@@ -66,25 +97,14 @@ const createViewModelFileForJavaScript = (name) => {
66
97
  export class ${name}ViewModel extends ViewModel
67
98
  {
68
99
  /**
69
- * @param {View} view
70
- * @return {Promise<View>}
71
- * @method
72
- * @public
73
- */
74
- async unbind (view)
75
- {
76
- return await super.unbind(view);
77
- }
78
-
79
- /**
80
- * @param {View} view
81
100
  * @return {Promise<void>}
82
101
  * @method
102
+ * @override
83
103
  * @public
84
104
  */
85
- async bind (view)
105
+ async initialize ()
86
106
  {
87
- await super.bind(view);
107
+ return void 0;
88
108
  }
89
109
  }`;
90
110
  };
@@ -95,21 +115,53 @@ export class ${name}ViewModel extends ViewModel
95
115
  * @public
96
116
  */
97
117
  const createViewFileForTypeScript = (name) => {
98
- return `import { View } from "@next2d/framework";
118
+ return `import type { ${name}ViewModel } from "./${name}ViewModel";
119
+ import { View } from "@next2d/framework";
99
120
 
100
121
  /**
101
122
  * @class
102
123
  * @extends {View}
103
124
  */
104
- export class ${name}View extends View
125
+ export class ${name}View extends View<${name}ViewModel>
105
126
  {
106
127
  /**
128
+ * @param {${name}ViewModel} vm
107
129
  * @constructor
108
130
  * @public
109
131
  */
110
- constructor ()
132
+ constructor (vm: ${name}ViewModel)
111
133
  {
112
- super();
134
+ super(vm);
135
+ }
136
+
137
+ /**
138
+ * @return {Promise<void>}
139
+ * @method
140
+ * @public
141
+ */
142
+ async initialize (): Promise<void>
143
+ {
144
+ return void 0;
145
+ }
146
+
147
+ /**
148
+ * @return {Promise<void>}
149
+ * @method
150
+ * @public
151
+ */
152
+ async onEnter (): Promise<void>
153
+ {
154
+ return void 0;
155
+ }
156
+
157
+ /**
158
+ * @return {Promise<void>}
159
+ * @method
160
+ * @public
161
+ */
162
+ async onExit (): Promise<void>
163
+ {
164
+ return void 0;
113
165
  }
114
166
  }`;
115
167
  };
@@ -120,7 +172,7 @@ export class ${name}View extends View
120
172
  * @public
121
173
  */
122
174
  const createViewModelFileForTypeScript = (name) => {
123
- return `import { View, ViewModel } from "@next2d/framework";
175
+ return `import { ViewModel } from "@next2d/framework";
124
176
 
125
177
  /**
126
178
  * @class
@@ -129,25 +181,13 @@ const createViewModelFileForTypeScript = (name) => {
129
181
  export class ${name}ViewModel extends ViewModel
130
182
  {
131
183
  /**
132
- * @param {View} view
133
- * @return {Promise<View>}
134
- * @method
135
- * @public
136
- */
137
- async unbind (view: View): Promise<View>
138
- {
139
- return await super.unbind(view);
140
- }
141
-
142
- /**
143
- * @param {View} view
144
184
  * @return {Promise<void>}
145
185
  * @method
146
186
  * @public
147
187
  */
148
- async bind (view: View): Promise<void>
188
+ async initialize (): Promise<void>
149
189
  {
150
- await super.bind(view);
190
+ return void 0;
151
191
  }
152
192
  }`;
153
193
  };
@@ -173,7 +213,7 @@ const execute = () => {
173
213
  const routing = JSON.parse(fs.readFileSync(routingPath, { "encoding": "utf8" }));
174
214
  const keys = Object.keys(routing);
175
215
  for (let idx = 0; idx < keys.length; ++idx) {
176
- const names = keys[idx].split(/-|\//);
216
+ const names = keys[idx].split(/-|\/|_/);
177
217
  if (names[0].charAt(0) === "@") {
178
218
  continue;
179
219
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/view-generator",
3
- "version": "3.0.12",
3
+ "version": "4.0.0",
4
4
  "description": "Generate the View class required for routing.",
5
5
  "author": "Toshiyuki Ienaga<ienaga@next2d.app>",
6
6
  "license": "MIT",
@@ -28,17 +28,17 @@
28
28
  "@next2d/view-generator": "dist/index.js"
29
29
  },
30
30
  "devDependencies": {
31
- "@eslint/eslintrc": "^3.3.1",
32
- "@eslint/js": "^9.39.0",
33
- "@typescript-eslint/eslint-plugin": "^8.46.2",
34
- "@typescript-eslint/parser": "^8.46.2",
35
- "eslint": "^9.39.0",
31
+ "@eslint/eslintrc": "^3.3.3",
32
+ "@eslint/js": "^9.39.2",
33
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
34
+ "@typescript-eslint/parser": "^8.54.0",
35
+ "eslint": "^9.39.2",
36
36
  "eslint-plugin-unused-imports": "^4.3.0",
37
- "globals": "^16.4.0",
37
+ "globals": "^17.3.0",
38
38
  "typescript": "^5.9.3"
39
39
  },
40
40
  "dependencies": {
41
- "@types/node": "^24.9.2",
41
+ "@types/node": "^25.2.1",
42
42
  "picocolors": "^1.1.1"
43
43
  }
44
44
  }