@wwawing/page-generator 0.0.0-exe-chousa.based-on.3.12.21

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 (40) hide show
  1. package/LICENSE +21 -0
  2. package/lib/data-types/copyright.d.ts +13 -0
  3. package/lib/data-types/copyright.js +2 -0
  4. package/lib/data-types/index.d.ts +4 -0
  5. package/lib/data-types/index.js +20 -0
  6. package/lib/data-types/page.d.ts +4 -0
  7. package/lib/data-types/page.js +2 -0
  8. package/lib/data-types/string-boolean.d.ts +1 -0
  9. package/lib/data-types/string-boolean.js +2 -0
  10. package/lib/data-types/wwa.d.ts +27 -0
  11. package/lib/data-types/wwa.js +2 -0
  12. package/lib/helper/copyright.d.ts +4 -0
  13. package/lib/helper/copyright.js +44 -0
  14. package/lib/helper/index.d.ts +2 -0
  15. package/lib/helper/index.js +18 -0
  16. package/lib/helper/string-boolean.d.ts +3 -0
  17. package/lib/helper/string-boolean.js +10 -0
  18. package/lib/index.d.ts +48 -0
  19. package/lib/index.js +81 -0
  20. package/lib/wwa.pug +47 -0
  21. package/module/data-types/copyright.d.ts +13 -0
  22. package/module/data-types/copyright.js +1 -0
  23. package/module/data-types/index.d.ts +4 -0
  24. package/module/data-types/index.js +4 -0
  25. package/module/data-types/page.d.ts +4 -0
  26. package/module/data-types/page.js +1 -0
  27. package/module/data-types/string-boolean.d.ts +1 -0
  28. package/module/data-types/string-boolean.js +1 -0
  29. package/module/data-types/wwa.d.ts +27 -0
  30. package/module/data-types/wwa.js +1 -0
  31. package/module/helper/copyright.d.ts +4 -0
  32. package/module/helper/copyright.js +39 -0
  33. package/module/helper/index.d.ts +2 -0
  34. package/module/helper/index.js +2 -0
  35. package/module/helper/string-boolean.d.ts +3 -0
  36. package/module/helper/string-boolean.js +6 -0
  37. package/module/index.d.ts +48 -0
  38. package/module/index.js +45 -0
  39. package/module/wwa.pug +47 -0
  40. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018-2025 WWA Wing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ export interface Copyright {
2
+ range: {
3
+ firstYear: number;
4
+ lastYear: number;
5
+ };
6
+ credit: string;
7
+ product: {
8
+ genre?: string;
9
+ name: string;
10
+ href: string;
11
+ };
12
+ }
13
+ export type BuiltInCopyright = "official-only" | "official-and-wing";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export * from "./string-boolean";
2
+ export * from "./copyright";
3
+ export * from "./page";
4
+ export * from "./wwa";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./string-boolean"), exports);
18
+ __exportStar(require("./copyright"), exports);
19
+ __exportStar(require("./page"), exports);
20
+ __exportStar(require("./wwa"), exports);
@@ -0,0 +1,4 @@
1
+ export interface Page {
2
+ title?: string;
3
+ additionalCssFiles?: string[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type StringBoolean = "true" | "false";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ export interface GameOption {
2
+ isUrlGateEnabled?: boolean;
3
+ isClassicMode?: boolean;
4
+ isItemEffectEnabled?: boolean;
5
+ useGoToWWA?: boolean;
6
+ autoSave?: {
7
+ intervalSteps: number;
8
+ };
9
+ useLookingAround?: boolean;
10
+ userVars?: {
11
+ dumpElementId: string;
12
+ canDisplay?: boolean;
13
+ };
14
+ virtualPad?: {
15
+ enable: boolean;
16
+ viewportFitEnable?: boolean;
17
+ controllerId?: string;
18
+ };
19
+ }
20
+ export interface Resources {
21
+ mapData: string;
22
+ audioDir?: string;
23
+ wwaJs?: string;
24
+ wwaCss?: string;
25
+ titleImage?: string;
26
+ userVarNamesFile?: string;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import * as DataTypes from "../data-types";
2
+ export declare function generateOfficialCopyright(date?: Date): DataTypes.Copyright;
3
+ export declare function generateWWAWingCopyright(date?: Date): DataTypes.Copyright;
4
+ export declare function generateCopyrights(configCopyright: DataTypes.BuiltInCopyright | DataTypes.Copyright[] | undefined): DataTypes.Copyright[];
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateOfficialCopyright = generateOfficialCopyright;
4
+ exports.generateWWAWingCopyright = generateWWAWingCopyright;
5
+ exports.generateCopyrights = generateCopyrights;
6
+ function generateOfficialCopyright(date = new Date()) {
7
+ return {
8
+ range: {
9
+ firstYear: 1996,
10
+ lastYear: date.getFullYear(),
11
+ },
12
+ product: {
13
+ genre: "Internet RPG",
14
+ name: "World Wide Adventure",
15
+ href: "https://wwajp.com/",
16
+ },
17
+ credit: "NAO",
18
+ };
19
+ }
20
+ function generateWWAWingCopyright(date = new Date()) {
21
+ return {
22
+ range: {
23
+ firstYear: 2013,
24
+ lastYear: date.getFullYear(),
25
+ },
26
+ product: {
27
+ name: "WWA Wing",
28
+ href: "https://wwawing.com/",
29
+ },
30
+ credit: "WWA Wing Team",
31
+ };
32
+ }
33
+ function generateCopyrights(configCopyright) {
34
+ switch (configCopyright) {
35
+ case undefined:
36
+ return [];
37
+ case "official-only":
38
+ return [generateOfficialCopyright()];
39
+ case "official-and-wing":
40
+ return [generateOfficialCopyright(), generateWWAWingCopyright()];
41
+ default:
42
+ return configCopyright;
43
+ }
44
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./copyright";
2
+ export * from "./string-boolean";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./copyright"), exports);
18
+ __exportStar(require("./string-boolean"), exports);
@@ -0,0 +1,3 @@
1
+ import { StringBoolean } from "../data-types";
2
+ export declare function toStringBoolean(x: boolean): StringBoolean;
3
+ export declare function toStringBooleanOptional(x: boolean | undefined): StringBoolean | undefined;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toStringBoolean = toStringBoolean;
4
+ exports.toStringBooleanOptional = toStringBooleanOptional;
5
+ function toStringBoolean(x) {
6
+ return x ? "true" : "false";
7
+ }
8
+ function toStringBooleanOptional(x) {
9
+ return x === undefined ? undefined : toStringBoolean(x);
10
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import * as DataTypes from "./data-types";
2
+ export interface InputConfig {
3
+ page?: DataTypes.Page;
4
+ wwa: {
5
+ gameOption?: DataTypes.GameOption;
6
+ resources: DataTypes.Resources;
7
+ resumeSaveData?: string;
8
+ };
9
+ copyrights?: DataTypes.BuiltInCopyright | DataTypes.Copyright[];
10
+ }
11
+ export interface TemplateValues {
12
+ head: {
13
+ pageTitle: string;
14
+ additionalCssFiles?: string[];
15
+ wwaCss: string;
16
+ wwaJs: string;
17
+ };
18
+ wwa: {
19
+ attributes: {
20
+ "data-wwa-mapdata": string;
21
+ "data-wwa-urlgate-enable": DataTypes.StringBoolean;
22
+ "data-wwa-title-img"?: string;
23
+ "data-wwa-audio-dir"?: string;
24
+ "data-wwa-classic-mode-enable"?: DataTypes.StringBoolean;
25
+ "data-wwa-item-effect-enable"?: DataTypes.StringBoolean;
26
+ "data-wwa-use-go-to-wwa"?: DataTypes.StringBoolean;
27
+ "data-wwa-looking-around"?: DataTypes.StringBoolean;
28
+ "data-wwa-autosave"?: string;
29
+ "data-wwa-resume-savedata"?: string;
30
+ "data-wwa-var-dump-elm"?: string;
31
+ "data-wwa-user-var-names-file"?: string;
32
+ "data-wwa-display-user-vars"?: string;
33
+ "data-wwa-virtualpad-enable"?: string;
34
+ "data-wwa-virtualpad-viewport-fit-enable"?: string;
35
+ "data-wwa-virtualpad-controller-elm"?: string;
36
+ };
37
+ };
38
+ varDumpElement?: {
39
+ id: string;
40
+ };
41
+ virtualPadController?: {
42
+ id: string;
43
+ };
44
+ footer: {
45
+ copyrights?: DataTypes.Copyright[];
46
+ };
47
+ }
48
+ export declare function render(config: InputConfig): string;
package/lib/index.js ADDED
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.render = render;
37
+ const pug = __importStar(require("pug"));
38
+ const path = __importStar(require("path"));
39
+ const Helper = __importStar(require("./helper"));
40
+ function generateTemplateValues({ page, wwa, copyrights }) {
41
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
42
+ return {
43
+ head: {
44
+ pageTitle: (page === null || page === void 0 ? void 0 : page.title) || "World Wide Adventure Wing",
45
+ additionalCssFiles: (page === null || page === void 0 ? void 0 : page.additionalCssFiles) || [],
46
+ wwaCss: wwa.resources.wwaCss || "wwa.css",
47
+ wwaJs: wwa.resources.wwaJs || "wwa.js"
48
+ },
49
+ wwa: {
50
+ attributes: {
51
+ "data-wwa-mapdata": wwa.resources.mapData,
52
+ "data-wwa-urlgate-enable": Helper.toStringBoolean(((_a = wwa.gameOption) === null || _a === void 0 ? void 0 : _a.isUrlGateEnabled) || true),
53
+ "data-wwa-title-img": wwa.resources.titleImage,
54
+ "data-wwa-audio-dir": wwa.resources.audioDir,
55
+ "data-wwa-classic-mode-enable": Helper.toStringBooleanOptional((_b = wwa.gameOption) === null || _b === void 0 ? void 0 : _b.isClassicMode),
56
+ "data-wwa-item-effect-enable": Helper.toStringBooleanOptional((_c = wwa.gameOption) === null || _c === void 0 ? void 0 : _c.isItemEffectEnabled),
57
+ "data-wwa-use-go-to-wwa": Helper.toStringBooleanOptional((_d = wwa.gameOption) === null || _d === void 0 ? void 0 : _d.useGoToWWA),
58
+ "data-wwa-looking-around": Helper.toStringBooleanOptional((_e = wwa.gameOption) === null || _e === void 0 ? void 0 : _e.useLookingAround),
59
+ "data-wwa-autosave": `${(_h = (_g = (_f = wwa.gameOption) === null || _f === void 0 ? void 0 : _f.autoSave) === null || _g === void 0 ? void 0 : _g.intervalSteps) !== null && _h !== void 0 ? _h : "0"}`,
60
+ "data-wwa-resume-savedata": wwa.resumeSaveData,
61
+ "data-wwa-var-dump-elm": ((_k = (_j = wwa.gameOption) === null || _j === void 0 ? void 0 : _j.userVars) === null || _k === void 0 ? void 0 : _k.dumpElementId) ? `#${wwa.gameOption.userVars.dumpElementId}` : undefined,
62
+ "data-wwa-user-var-names-file": wwa.resources.userVarNamesFile,
63
+ "data-wwa-display-user-vars": Helper.toStringBooleanOptional((_m = (_l = wwa.gameOption) === null || _l === void 0 ? void 0 : _l.userVars) === null || _m === void 0 ? void 0 : _m.canDisplay),
64
+ "data-wwa-virtualpad-enable": Helper.toStringBooleanOptional((_p = (_o = wwa.gameOption) === null || _o === void 0 ? void 0 : _o.virtualPad) === null || _p === void 0 ? void 0 : _p.enable),
65
+ "data-wwa-virtualpad-viewport-fit-enable": Helper.toStringBooleanOptional((_r = (_q = wwa.gameOption) === null || _q === void 0 ? void 0 : _q.virtualPad) === null || _r === void 0 ? void 0 : _r.viewportFitEnable),
66
+ "data-wwa-virtualpad-controller-elm": ((_t = (_s = wwa.gameOption) === null || _s === void 0 ? void 0 : _s.virtualPad) === null || _t === void 0 ? void 0 : _t.controllerId) ? `#${wwa.gameOption.virtualPad.controllerId}` : undefined,
67
+ }
68
+ },
69
+ varDumpElement: ((_v = (_u = wwa.gameOption) === null || _u === void 0 ? void 0 : _u.userVars) === null || _v === void 0 ? void 0 : _v.dumpElementId) ? { id: wwa.gameOption.userVars.dumpElementId } : undefined,
70
+ virtualPadController: ((_x = (_w = wwa.gameOption) === null || _w === void 0 ? void 0 : _w.virtualPad) === null || _x === void 0 ? void 0 : _x.controllerId) ? { id: wwa.gameOption.virtualPad.controllerId } : undefined,
71
+ footer: {
72
+ copyrights: Helper.generateCopyrights(copyrights)
73
+ }
74
+ };
75
+ }
76
+ function render(config) {
77
+ const templateValues = generateTemplateValues(config);
78
+ const pugFilePath = path.join(__dirname, "wwa.pug");
79
+ const compileTemplate = pug.compileFile(pugFilePath, { pretty: true });
80
+ return compileTemplate(templateValues) + "\n";
81
+ }
package/lib/wwa.pug ADDED
@@ -0,0 +1,47 @@
1
+ doctype html
2
+ html(lang="ja")
3
+ head
4
+ meta(charset="UTF-8")
5
+ title #{head.pageTitle}
6
+ each cssFileName in head.additionalCssFiles
7
+ link(rel="stylesheet" href=cssFileName)
8
+ // wwa requirements
9
+ link(rel="stylesheet" href=head.wwaCss)
10
+ script(src=head.wwaJs)
11
+ // wwa requirements
12
+
13
+ body
14
+ #wrapper
15
+ #wwa-wrapper.wwa-size-box(
16
+ data-wwa-mapdata=wwa.attributes["data-wwa-mapdata"]
17
+ data-wwa-urlgate-enable=wwa.attributes["data-wwa-urlgate-enable"]
18
+ data-wwa-title-img=wwa.attributes["data-wwa-title-img"]
19
+ data-wwa-audio-dir=wwa.attributes["data-wwa-audio-dir"]
20
+ data-wwa-classic-mode-enable=wwa.attributes["data-wwa-classic-mode-enable"]
21
+ data-wwa-item-effect-enable=wwa.attributes["data-wwa-item-effect-enable"]
22
+ data-wwa-use-go-to-wwa=wwa.attributes["data-wwa-use-go-to-wwa"]
23
+ data-wwa-looking-around=wwa.attributes["data-wwa-looking-around"]
24
+ data-wwa-autosave=wwa.attributes["data-wwa-autosave"]
25
+ data-wwa-resume-savedata=wwa.attributes["data-wwa-resume-savedata"]
26
+ data-wwa-var-dump-elm=wwa.attributes["data-wwa-var-dump-elm"]
27
+ data-wwa-user-var-names-file=wwa.attributes["data-wwa-user-var-names-file"]
28
+ data-wwa-display-user-vars=wwa.attributes["data-wwa-display-user-vars"]
29
+ data-wwa-virtualpad-enable=wwa.attributes["data-wwa-virtualpad-enable"]
30
+ data-wwa-virtualpad-viewport-fit-enable=wwa.attributes["data-wwa-virtualpad-viewport-fit-enable"]
31
+ data-wwa-virtualpad-controller-elm=wwa.attributes["data-wwa-virtualpad-controller-elm"]
32
+ )
33
+
34
+ if virtualPadController
35
+ div(id=virtualPadController.id)
36
+
37
+ if varDumpElement
38
+ // 下記 div 要素内に変数一覧が出ます。実際に公開する WWA では、変数一覧を表示させないよう、次の行は消してください。
39
+ div(id=varDumpElement.id)
40
+
41
+ if footer.copyrights
42
+ footer#copyright
43
+ each copyright in footer.copyrights
44
+ p
45
+ | #{copyright.product.genre} &quot;
46
+ a(href=copyright.product.href).wwa-copyright #{copyright.product.name}
47
+ | &quot; #{copyright.range.firstYear}-#{copyright.range.lastYear} &copy; #{copyright.credit}
@@ -0,0 +1,13 @@
1
+ export interface Copyright {
2
+ range: {
3
+ firstYear: number;
4
+ lastYear: number;
5
+ };
6
+ credit: string;
7
+ product: {
8
+ genre?: string;
9
+ name: string;
10
+ href: string;
11
+ };
12
+ }
13
+ export type BuiltInCopyright = "official-only" | "official-and-wing";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./string-boolean";
2
+ export * from "./copyright";
3
+ export * from "./page";
4
+ export * from "./wwa";
@@ -0,0 +1,4 @@
1
+ export * from "./string-boolean";
2
+ export * from "./copyright";
3
+ export * from "./page";
4
+ export * from "./wwa";
@@ -0,0 +1,4 @@
1
+ export interface Page {
2
+ title?: string;
3
+ additionalCssFiles?: string[];
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type StringBoolean = "true" | "false";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ export interface GameOption {
2
+ isUrlGateEnabled?: boolean;
3
+ isClassicMode?: boolean;
4
+ isItemEffectEnabled?: boolean;
5
+ useGoToWWA?: boolean;
6
+ autoSave?: {
7
+ intervalSteps: number;
8
+ };
9
+ useLookingAround?: boolean;
10
+ userVars?: {
11
+ dumpElementId: string;
12
+ canDisplay?: boolean;
13
+ };
14
+ virtualPad?: {
15
+ enable: boolean;
16
+ viewportFitEnable?: boolean;
17
+ controllerId?: string;
18
+ };
19
+ }
20
+ export interface Resources {
21
+ mapData: string;
22
+ audioDir?: string;
23
+ wwaJs?: string;
24
+ wwaCss?: string;
25
+ titleImage?: string;
26
+ userVarNamesFile?: string;
27
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import * as DataTypes from "../data-types";
2
+ export declare function generateOfficialCopyright(date?: Date): DataTypes.Copyright;
3
+ export declare function generateWWAWingCopyright(date?: Date): DataTypes.Copyright;
4
+ export declare function generateCopyrights(configCopyright: DataTypes.BuiltInCopyright | DataTypes.Copyright[] | undefined): DataTypes.Copyright[];
@@ -0,0 +1,39 @@
1
+ export function generateOfficialCopyright(date = new Date()) {
2
+ return {
3
+ range: {
4
+ firstYear: 1996,
5
+ lastYear: date.getFullYear(),
6
+ },
7
+ product: {
8
+ genre: "Internet RPG",
9
+ name: "World Wide Adventure",
10
+ href: "https://wwajp.com/",
11
+ },
12
+ credit: "NAO",
13
+ };
14
+ }
15
+ export function generateWWAWingCopyright(date = new Date()) {
16
+ return {
17
+ range: {
18
+ firstYear: 2013,
19
+ lastYear: date.getFullYear(),
20
+ },
21
+ product: {
22
+ name: "WWA Wing",
23
+ href: "https://wwawing.com/",
24
+ },
25
+ credit: "WWA Wing Team",
26
+ };
27
+ }
28
+ export function generateCopyrights(configCopyright) {
29
+ switch (configCopyright) {
30
+ case undefined:
31
+ return [];
32
+ case "official-only":
33
+ return [generateOfficialCopyright()];
34
+ case "official-and-wing":
35
+ return [generateOfficialCopyright(), generateWWAWingCopyright()];
36
+ default:
37
+ return configCopyright;
38
+ }
39
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./copyright";
2
+ export * from "./string-boolean";
@@ -0,0 +1,2 @@
1
+ export * from "./copyright";
2
+ export * from "./string-boolean";
@@ -0,0 +1,3 @@
1
+ import { StringBoolean } from "../data-types";
2
+ export declare function toStringBoolean(x: boolean): StringBoolean;
3
+ export declare function toStringBooleanOptional(x: boolean | undefined): StringBoolean | undefined;
@@ -0,0 +1,6 @@
1
+ export function toStringBoolean(x) {
2
+ return x ? "true" : "false";
3
+ }
4
+ export function toStringBooleanOptional(x) {
5
+ return x === undefined ? undefined : toStringBoolean(x);
6
+ }
@@ -0,0 +1,48 @@
1
+ import * as DataTypes from "./data-types";
2
+ export interface InputConfig {
3
+ page?: DataTypes.Page;
4
+ wwa: {
5
+ gameOption?: DataTypes.GameOption;
6
+ resources: DataTypes.Resources;
7
+ resumeSaveData?: string;
8
+ };
9
+ copyrights?: DataTypes.BuiltInCopyright | DataTypes.Copyright[];
10
+ }
11
+ export interface TemplateValues {
12
+ head: {
13
+ pageTitle: string;
14
+ additionalCssFiles?: string[];
15
+ wwaCss: string;
16
+ wwaJs: string;
17
+ };
18
+ wwa: {
19
+ attributes: {
20
+ "data-wwa-mapdata": string;
21
+ "data-wwa-urlgate-enable": DataTypes.StringBoolean;
22
+ "data-wwa-title-img"?: string;
23
+ "data-wwa-audio-dir"?: string;
24
+ "data-wwa-classic-mode-enable"?: DataTypes.StringBoolean;
25
+ "data-wwa-item-effect-enable"?: DataTypes.StringBoolean;
26
+ "data-wwa-use-go-to-wwa"?: DataTypes.StringBoolean;
27
+ "data-wwa-looking-around"?: DataTypes.StringBoolean;
28
+ "data-wwa-autosave"?: string;
29
+ "data-wwa-resume-savedata"?: string;
30
+ "data-wwa-var-dump-elm"?: string;
31
+ "data-wwa-user-var-names-file"?: string;
32
+ "data-wwa-display-user-vars"?: string;
33
+ "data-wwa-virtualpad-enable"?: string;
34
+ "data-wwa-virtualpad-viewport-fit-enable"?: string;
35
+ "data-wwa-virtualpad-controller-elm"?: string;
36
+ };
37
+ };
38
+ varDumpElement?: {
39
+ id: string;
40
+ };
41
+ virtualPadController?: {
42
+ id: string;
43
+ };
44
+ footer: {
45
+ copyrights?: DataTypes.Copyright[];
46
+ };
47
+ }
48
+ export declare function render(config: InputConfig): string;
@@ -0,0 +1,45 @@
1
+ import * as pug from "pug";
2
+ import * as path from "path";
3
+ import * as Helper from "./helper";
4
+ function generateTemplateValues({ page, wwa, copyrights }) {
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
6
+ return {
7
+ head: {
8
+ pageTitle: (page === null || page === void 0 ? void 0 : page.title) || "World Wide Adventure Wing",
9
+ additionalCssFiles: (page === null || page === void 0 ? void 0 : page.additionalCssFiles) || [],
10
+ wwaCss: wwa.resources.wwaCss || "wwa.css",
11
+ wwaJs: wwa.resources.wwaJs || "wwa.js"
12
+ },
13
+ wwa: {
14
+ attributes: {
15
+ "data-wwa-mapdata": wwa.resources.mapData,
16
+ "data-wwa-urlgate-enable": Helper.toStringBoolean(((_a = wwa.gameOption) === null || _a === void 0 ? void 0 : _a.isUrlGateEnabled) || true),
17
+ "data-wwa-title-img": wwa.resources.titleImage,
18
+ "data-wwa-audio-dir": wwa.resources.audioDir,
19
+ "data-wwa-classic-mode-enable": Helper.toStringBooleanOptional((_b = wwa.gameOption) === null || _b === void 0 ? void 0 : _b.isClassicMode),
20
+ "data-wwa-item-effect-enable": Helper.toStringBooleanOptional((_c = wwa.gameOption) === null || _c === void 0 ? void 0 : _c.isItemEffectEnabled),
21
+ "data-wwa-use-go-to-wwa": Helper.toStringBooleanOptional((_d = wwa.gameOption) === null || _d === void 0 ? void 0 : _d.useGoToWWA),
22
+ "data-wwa-looking-around": Helper.toStringBooleanOptional((_e = wwa.gameOption) === null || _e === void 0 ? void 0 : _e.useLookingAround),
23
+ "data-wwa-autosave": `${(_h = (_g = (_f = wwa.gameOption) === null || _f === void 0 ? void 0 : _f.autoSave) === null || _g === void 0 ? void 0 : _g.intervalSteps) !== null && _h !== void 0 ? _h : "0"}`,
24
+ "data-wwa-resume-savedata": wwa.resumeSaveData,
25
+ "data-wwa-var-dump-elm": ((_k = (_j = wwa.gameOption) === null || _j === void 0 ? void 0 : _j.userVars) === null || _k === void 0 ? void 0 : _k.dumpElementId) ? `#${wwa.gameOption.userVars.dumpElementId}` : undefined,
26
+ "data-wwa-user-var-names-file": wwa.resources.userVarNamesFile,
27
+ "data-wwa-display-user-vars": Helper.toStringBooleanOptional((_m = (_l = wwa.gameOption) === null || _l === void 0 ? void 0 : _l.userVars) === null || _m === void 0 ? void 0 : _m.canDisplay),
28
+ "data-wwa-virtualpad-enable": Helper.toStringBooleanOptional((_p = (_o = wwa.gameOption) === null || _o === void 0 ? void 0 : _o.virtualPad) === null || _p === void 0 ? void 0 : _p.enable),
29
+ "data-wwa-virtualpad-viewport-fit-enable": Helper.toStringBooleanOptional((_r = (_q = wwa.gameOption) === null || _q === void 0 ? void 0 : _q.virtualPad) === null || _r === void 0 ? void 0 : _r.viewportFitEnable),
30
+ "data-wwa-virtualpad-controller-elm": ((_t = (_s = wwa.gameOption) === null || _s === void 0 ? void 0 : _s.virtualPad) === null || _t === void 0 ? void 0 : _t.controllerId) ? `#${wwa.gameOption.virtualPad.controllerId}` : undefined,
31
+ }
32
+ },
33
+ varDumpElement: ((_v = (_u = wwa.gameOption) === null || _u === void 0 ? void 0 : _u.userVars) === null || _v === void 0 ? void 0 : _v.dumpElementId) ? { id: wwa.gameOption.userVars.dumpElementId } : undefined,
34
+ virtualPadController: ((_x = (_w = wwa.gameOption) === null || _w === void 0 ? void 0 : _w.virtualPad) === null || _x === void 0 ? void 0 : _x.controllerId) ? { id: wwa.gameOption.virtualPad.controllerId } : undefined,
35
+ footer: {
36
+ copyrights: Helper.generateCopyrights(copyrights)
37
+ }
38
+ };
39
+ }
40
+ export function render(config) {
41
+ const templateValues = generateTemplateValues(config);
42
+ const pugFilePath = path.join(__dirname, "wwa.pug");
43
+ const compileTemplate = pug.compileFile(pugFilePath, { pretty: true });
44
+ return compileTemplate(templateValues) + "\n";
45
+ }
package/module/wwa.pug ADDED
@@ -0,0 +1,47 @@
1
+ doctype html
2
+ html(lang="ja")
3
+ head
4
+ meta(charset="UTF-8")
5
+ title #{head.pageTitle}
6
+ each cssFileName in head.additionalCssFiles
7
+ link(rel="stylesheet" href=cssFileName)
8
+ // wwa requirements
9
+ link(rel="stylesheet" href=head.wwaCss)
10
+ script(src=head.wwaJs)
11
+ // wwa requirements
12
+
13
+ body
14
+ #wrapper
15
+ #wwa-wrapper.wwa-size-box(
16
+ data-wwa-mapdata=wwa.attributes["data-wwa-mapdata"]
17
+ data-wwa-urlgate-enable=wwa.attributes["data-wwa-urlgate-enable"]
18
+ data-wwa-title-img=wwa.attributes["data-wwa-title-img"]
19
+ data-wwa-audio-dir=wwa.attributes["data-wwa-audio-dir"]
20
+ data-wwa-classic-mode-enable=wwa.attributes["data-wwa-classic-mode-enable"]
21
+ data-wwa-item-effect-enable=wwa.attributes["data-wwa-item-effect-enable"]
22
+ data-wwa-use-go-to-wwa=wwa.attributes["data-wwa-use-go-to-wwa"]
23
+ data-wwa-looking-around=wwa.attributes["data-wwa-looking-around"]
24
+ data-wwa-autosave=wwa.attributes["data-wwa-autosave"]
25
+ data-wwa-resume-savedata=wwa.attributes["data-wwa-resume-savedata"]
26
+ data-wwa-var-dump-elm=wwa.attributes["data-wwa-var-dump-elm"]
27
+ data-wwa-user-var-names-file=wwa.attributes["data-wwa-user-var-names-file"]
28
+ data-wwa-display-user-vars=wwa.attributes["data-wwa-display-user-vars"]
29
+ data-wwa-virtualpad-enable=wwa.attributes["data-wwa-virtualpad-enable"]
30
+ data-wwa-virtualpad-viewport-fit-enable=wwa.attributes["data-wwa-virtualpad-viewport-fit-enable"]
31
+ data-wwa-virtualpad-controller-elm=wwa.attributes["data-wwa-virtualpad-controller-elm"]
32
+ )
33
+
34
+ if virtualPadController
35
+ div(id=virtualPadController.id)
36
+
37
+ if varDumpElement
38
+ // 下記 div 要素内に変数一覧が出ます。実際に公開する WWA では、変数一覧を表示させないよう、次の行は消してください。
39
+ div(id=varDumpElement.id)
40
+
41
+ if footer.copyrights
42
+ footer#copyright
43
+ each copyright in footer.copyrights
44
+ p
45
+ | #{copyright.product.genre} &quot;
46
+ a(href=copyright.product.href).wwa-copyright #{copyright.product.name}
47
+ | &quot; #{copyright.range.firstYear}-#{copyright.range.lastYear} &copy; #{copyright.credit}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@wwawing/page-generator",
3
+ "version": "0.0.0-exe-chousa.based-on.3.12.21",
4
+ "description": "a HTML file generator for WWA Wing",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/WWAWing/WWAWing.git",
10
+ "directory": "packages/page-generator"
11
+ },
12
+ "scripts": {
13
+ "test": "echo \"Error: no test specified\" && exit 1",
14
+ "start": "npm run build && shx mkdir -p output && node debug/debug.js",
15
+ "build": "run-p build:*",
16
+ "build:lib": "tsc && shx cp ./src/wwa.pug ./lib/wwa.pug",
17
+ "build:module": "tsc -p ./tsconfig.module.json && shx cp ./src/wwa.pug ./module/wwa.pug",
18
+ "clean": "run-s clean:*",
19
+ "clean:lib": "shx rm -rf ./lib",
20
+ "clean:module": "shx rm -rf ./module"
21
+ },
22
+ "files": [
23
+ "lib",
24
+ "module",
25
+ "template",
26
+ "config"
27
+ ],
28
+ "keywords": [
29
+ "WWA"
30
+ ],
31
+ "author": "WWA Wing Team",
32
+ "license": "MIT",
33
+ "devDependencies": {
34
+ "@types/node": "^22.10.1",
35
+ "@types/pug": "^2.0.6",
36
+ "npm-run-all2": "^8.0.1",
37
+ "shelljs": "^0.9.2",
38
+ "shx": "^0.4.0",
39
+ "typescript": "^5.8.3"
40
+ },
41
+ "dependencies": {
42
+ "pug": "^3.0.2"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "engines": {
48
+ "node": ">=22",
49
+ "npm": ">=11"
50
+ },
51
+ "gitHead": "b52982378576ed3ef7223fae8457a7923eba7ace"
52
+ }