webtalekit-alpha 0.2.13 → 0.2.14
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 +145 -70
- package/package.json +10 -2
- package/parser/checker.js +184 -0
- package/parser/checker.test.ts +491 -0
- package/parser/cli.js +34 -2
- package/parser/parser.js +25 -18
- package/src/core/defaultUIHandler.js +309 -0
- package/src/core/defaultUIHandler.js.map +1 -0
- package/{dist/src → src}/core/drawer.js +65 -40
- package/src/core/drawer.js.map +1 -0
- package/{dist/src → src}/core/index.js +188 -257
- package/{dist/src → src}/core/scenarioManager.js +29 -7
- package/src/core/scenarioManager.js.map +1 -0
- package/src/utils/eventBus.js +88 -0
- package/src/utils/eventBus.js.map +1 -0
- package/{dist/src → src}/utils/logger.js +45 -1
- package/src/utils/logger.js.map +1 -0
- package/{dist/src → src}/utils/store.js +5 -0
- package/src/utils/store.js.map +1 -0
- package/.claude/settings.local.json +0 -12
- package/.clinerules +0 -65
- package/.history/README_20240812174230.md +0 -193
- package/.history/README_20240812175424.md +0 -185
- package/.history/README_20240812191012.md +0 -185
- package/.history/README_20240812191155.md +0 -185
- package/.history/README_20240812191211.md +0 -185
- package/.history/README_20240812192035.md +0 -185
- package/.history/dist/src/core/index_20240815021552.js +0 -474
- package/.history/dist/src/core/index_20240815022042.js +0 -476
- package/.history/dist/src/core/index_20240815022206.js +0 -476
- package/.history/dist/src/core/index_20240815023104.js +0 -478
- package/.history/dist/src/core/index_20240817022019.js +0 -494
- package/.history/dist/src/core/index_20240818013827.js +0 -493
- package/.history/dist/src/core/index_20240820001418.js +0 -502
- package/.history/package_20240812174230.json +0 -45
- package/.history/package_20240825011731.json +0 -45
- package/.history/package_20240825011739.json +0 -44
- package/.history/parser/parser_20240812174230.js +0 -50
- package/.history/parser/parser_20240825012739.js +0 -47
- package/.history/parser/parser_20240825012835.js +0 -52
- package/.history/src/core/drawer_20240813091343.ts +0 -262
- package/.history/src/core/drawer_20240815232345.ts +0 -262
- package/.history/src/core/drawer_20240815232350.ts +0 -262
- package/.history/src/core/drawer_20240816025257.ts +0 -357
- package/.history/src/core/drawer_20240816025358.ts +0 -357
- package/.history/src/core/drawer_20240816030148.ts +0 -365
- package/.history/src/core/drawer_20240816231033.ts +0 -294
- package/.history/src/core/drawer_20240816231107.ts +0 -262
- package/.history/src/core/drawer_20240816231234.ts +0 -268
- package/.history/src/core/drawer_20240817013836.ts +0 -290
- package/.history/src/core/drawer_20240817015150.ts +0 -289
- package/.history/src/core/drawer_20240817015353.ts +0 -290
- package/.history/src/core/drawer_20240817021254.ts +0 -291
- package/.history/src/core/drawer_20240817023440.ts +0 -295
- package/.history/src/core/drawer_20240817023445.ts +0 -295
- package/.history/src/core/drawer_20240818015327.ts +0 -295
- package/.history/src/core/drawer_20240819231006.ts +0 -318
- package/.history/src/core/drawer_20240820002829.ts +0 -317
- package/.history/src/core/drawer_20240820003141.ts +0 -295
- package/.history/src/core/drawer_20240824010043.ts +0 -295
- package/.history/src/core/drawer_20240825013311.ts +0 -293
- package/.history/src/core/drawer_20240902235257.ts +0 -295
- package/.history/src/core/drawer_20240904002038.ts +0 -262
- package/.history/src/core/drawer_20240904004020.ts +0 -262
- package/.history/src/core/drawer_20240904004238.ts +0 -262
- package/.history/src/core/drawer_20240904005648.ts +0 -262
- package/.history/src/core/drawer_20240904005808.ts +0 -262
- package/.history/src/core/drawer_20240904010523.ts +0 -262
- package/.history/src/core/drawer_20240904011611.ts +0 -262
- package/.history/src/core/drawer_20240904011740.ts +0 -262
- package/.history/src/core/index_20240812190102.js +0 -443
- package/.history/src/core/index_20240812190105.js +0 -443
- package/.history/src/core/index_20240812205421.js +0 -452
- package/.history/src/core/index_20240812213441.js +0 -452
- package/.history/src/core/index_20240812214203.js +0 -453
- package/.history/src/core/index_20240813090823.js +0 -453
- package/.history/src/core/index_20240813230449.js +0 -452
- package/.history/src/core/index_20240813230539.js +0 -452
- package/.history/src/core/index_20240813231447.js +0 -453
- package/.history/src/core/index_20240813231449.js +0 -453
- package/.history/src/core/index_20240813231511.js +0 -453
- package/.history/src/core/index_20240813231531.js +0 -453
- package/.history/src/core/index_20240813231913.js +0 -453
- package/.history/src/core/index_20240813232356.js +0 -453
- package/.history/src/core/index_20240813232640.js +0 -453
- package/.history/src/core/index_20240813232900.js +0 -453
- package/.history/src/core/index_20240814221127.js +0 -454
- package/.history/src/core/index_20240814221322.js +0 -454
- package/.history/src/core/index_20240814221526.js +0 -454
- package/.history/src/core/index_20240814222048.js +0 -454
- package/.history/src/core/index_20240814222918.js +0 -459
- package/.history/src/core/index_20240814223136.js +0 -459
- package/.history/src/core/index_20240814223501.js +0 -464
- package/.history/src/core/index_20240814224347.js +0 -468
- package/.history/src/core/index_20240815013712.js +0 -474
- package/.history/src/core/index_20240815021534.js +0 -474
- package/.history/src/core/index_20240815023143.js +0 -477
- package/.history/src/core/index_20240815023207.js +0 -479
- package/.history/src/core/index_20240815023344.js +0 -481
- package/.history/src/core/index_20240815035600.js +0 -479
- package/.history/src/core/index_20240815041549.js +0 -480
- package/.history/src/core/index_20240815185515.js +0 -481
- package/.history/src/core/index_20240815192158.js +0 -481
- package/.history/src/core/index_20240815222912.js +0 -482
- package/.history/src/core/index_20240815224052.js +0 -483
- package/.history/src/core/index_20240815224843.js +0 -484
- package/.history/src/core/index_20240815224850.js +0 -483
- package/.history/src/core/index_20240815231706.js +0 -479
- package/.history/src/core/index_20240816025748.js +0 -483
- package/.history/src/core/index_20240816030102.js +0 -484
- package/.history/src/core/index_20240817013329.js +0 -485
- package/.history/src/core/index_20240817013526.js +0 -485
- package/.history/src/core/index_20240817013819.js +0 -488
- package/.history/src/core/index_20240817013829.js +0 -488
- package/.history/src/core/index_20240817014921.js +0 -494
- package/.history/src/core/index_20240817022057.js +0 -494
- package/.history/src/core/index_20240817023316.js +0 -493
- package/.history/src/core/index_20240818005637.js +0 -493
- package/.history/src/core/index_20240818005721.js +0 -493
- package/.history/src/core/index_20240818011804.js +0 -493
- package/.history/src/core/index_20240818013835.js +0 -493
- package/.history/src/core/index_20240818014310.js +0 -493
- package/.history/src/core/index_20240818014323.js +0 -493
- package/.history/src/core/index_20240818014333.js +0 -493
- package/.history/src/core/index_20240818020725.js +0 -496
- package/.history/src/core/index_20240819195504.js +0 -497
- package/.history/src/core/index_20240819202012.js +0 -495
- package/.history/src/core/index_20240819231228.js +0 -501
- package/.history/src/core/index_20240819232555.js +0 -502
- package/.history/src/core/index_20240819233404.js +0 -502
- package/.history/src/core/index_20240820003114.js +0 -495
- package/.history/src/core/index_20240820003120.js +0 -495
- package/.history/src/core/index_20240820003331.js +0 -495
- package/.history/src/core/index_20240820004126.js +0 -498
- package/.history/src/core/index_20240820004357.js +0 -497
- package/.history/src/core/index_20240820005103.js +0 -498
- package/.history/src/core/index_20240820005110.js +0 -499
- package/.history/src/core/index_20240820005206.js +0 -497
- package/.history/src/core/index_20240820005352.js +0 -497
- package/.history/src/core/index_20240823224904.ts +0 -505
- package/.history/src/core/index_20240823224905.js +0 -505
- package/.history/src/core/index_20240823231631.ts +0 -530
- package/.history/src/core/index_20240823231735.ts +0 -530
- package/.history/src/core/index_20240823232123.ts +0 -539
- package/.history/src/core/index_20240823232329.ts +0 -539
- package/.history/src/core/index_20240823233058.ts +0 -539
- package/.history/src/core/index_20240823234946.ts +0 -539
- package/.history/src/core/index_20240824005956.ts +0 -534
- package/.history/src/core/index_20240824010113.ts +0 -534
- package/.history/src/core/index_20240824010124.ts +0 -534
- package/.history/src/core/index_20240824010212.ts +0 -534
- package/.history/src/core/index_20240824010218.ts +0 -534
- package/.history/src/core/index_20240824010407.ts +0 -534
- package/.history/src/core/index_20240824010611.ts +0 -534
- package/.history/src/core/index_20240824010623.ts +0 -534
- package/.history/src/core/index_20240824010652.ts +0 -534
- package/.history/src/core/index_20240824011007.ts +0 -534
- package/.history/src/core/index_20240824210450.ts +0 -534
- package/.history/src/core/index_20240824210703.ts +0 -534
- package/.history/src/core/index_20240824210708.ts +0 -534
- package/.history/src/core/index_20240824211001.ts +0 -537
- package/.history/src/core/index_20240824211258.ts +0 -537
- package/.history/src/core/index_20240824211654.ts +0 -537
- package/.history/src/core/index_20240824211723.ts +0 -537
- package/.history/src/core/index_20240824211808.ts +0 -538
- package/.history/src/core/index_20240824214041.js +0 -538
- package/.history/src/core/index_20240824215312.ts +0 -538
- package/.history/src/core/index_20240824215341.ts +0 -538
- package/.history/src/core/index_20240824220703.ts +0 -538
- package/.history/src/core/index_20240824220709.ts +0 -538
- package/.history/src/core/index_20240825012244.ts +0 -536
- package/.history/src/core/index_20240825012435.ts +0 -539
- package/.history/src/core/index_20240825012440.ts +0 -539
- package/.history/src/core/index_20240826005054.ts +0 -539
- package/.history/src/core/index_20240826005321.ts +0 -540
- package/.history/src/core/index_20240826005410.ts +0 -539
- package/.history/src/core/index_20240826005418.ts +0 -539
- package/.history/src/core/index_20240830231825.ts +0 -539
- package/.history/src/core/index_20240831022416.ts +0 -539
- package/.history/src/core/index_20240901222314.js +0 -459
- package/.history/src/core/index_20240901222951.js +0 -459
- package/.history/src/core/index_20240901223824.js +0 -471
- package/.history/src/core/index_20240901223833.js +0 -468
- package/.history/src/core/index_20240902223954.js +0 -447
- package/.history/src/core/index_20240902224000.js +0 -446
- package/.history/src/core/index_20240902230345.js +0 -448
- package/.history/src/core/index_20240902231130.js +0 -449
- package/.history/src/core/index_20240902231559.js +0 -449
- package/.history/src/core/index_20240902232135.js +0 -449
- package/.history/src/core/index_20240902232809.js +0 -452
- package/.history/src/core/index_20240902232815.js +0 -452
- package/.history/src/core/index_20240903000104.js +0 -467
- package/.history/src/core/index_20240904001731.js +0 -444
- package/.history/src/core/index_20240904002038.ts +0 -539
- package/.history/src/core/index_20240904011848.js +0 -444
- package/.history/src/core/index_20240904012138.js +0 -444
- package/.history/src/core/index_20240904012743.js +0 -444
- package/.history/src/core/index_20240904013051.js +0 -444
- package/.history/src/core/resourceManager_20240403231531.ts +0 -16
- package/.history/src/core/resourceManager_20240823232627.ts +0 -17
- package/.history/src/core/resourceManager_20240824214014.js +0 -16
- package/.history/src/core/resourceManager_20240824214620.js +0 -17
- package/.history/src/core/scenarioManager_20240812203410.ts +0 -86
- package/.history/src/core/scenarioManager_20240812203839.ts +0 -94
- package/.history/src/core/scenarioManager_20240812213437.ts +0 -85
- package/.history/src/core/scenarioManager_20240813225852.ts +0 -85
- package/.history/src/core/scenarioManager_20240823235010.ts +0 -85
- package/.history/src/core/scenarioManager_20240904002038.ts +0 -94
- package/.history/src/core/scenarioManager_20240904012411.ts +0 -94
- package/.history/src/core/scenarioManager_20240904012519.ts +0 -94
- package/.history/src/index_20240403231531.js +0 -6
- package/.history/src/index_20240429233436.js +0 -8
- package/.history/src/index_20240429233926.js +0 -8
- package/.history/src/index_20240429234401.js +0 -7
- package/.history/src/index_20240429234404.js +0 -6
- package/.history/src/resource/soundObject_20240419004314.ts +0 -71
- package/.history/src/resource/soundObject_20240815034420.ts +0 -66
- package/.history/src/resource/soundObject_20240815034836.ts +0 -79
- package/.history/src/resource/soundObject_20240815034919.ts +0 -87
- package/.history/src/resource/soundObject_20240815040724.ts +0 -81
- package/.history/src/resource/soundObject_20240815041022.ts +0 -87
- package/.history/src/resource/soundObject_20240815042103.ts +0 -87
- package/.history/src/resource/soundObject_20240823235929.ts +0 -91
- package/.history/src/resource/soundObject_20240824213129.ts +0 -99
- package/.history/src/resource/soundObject_20240824213611.ts +0 -101
- package/.history/src/resource/soundObject_20240824215734.ts +0 -101
- package/.history/src/resource/soundObject_20240825004926.ts +0 -101
- package/.history/src/resource/soundObject_20240825004947.ts +0 -101
- package/.history/src/utils/logger_20240812174230.ts +0 -13
- package/.history/src/utils/logger_20240823232736.ts +0 -14
- package/.history/src/utils/logger_20240824214930.js +0 -14
- package/.history/src/utils/store_20240812174230.ts +0 -17
- package/.history/src/utils/store_20240823232948.ts +0 -29
- package/.history/src/utils/store_20240824214020.js +0 -17
- package/.history/src/utils/store_20240824214955.js +0 -29
- package/.history/src/utils/waitUtil_20240812174230.ts +0 -4
- package/.history/src/utils/waitUtil_20240823232739.ts +0 -4
- package/.history/src/utils/waitUtil_20240824214024.js +0 -4
- package/.history/src/utils/waitUtil_20240824215009.js +0 -4
- package/.history/test/js/title_20240428215305.js +0 -254
- package/.history/test/js/title_20240429221911.js +0 -227
- package/.history/test/js/title_20240429222806.js +0 -243
- package/.history/test/js/title_20240429222854.js +0 -263
- package/.history/test/js/title_20240429222906.js +0 -263
- package/.history/test/js/title_20240429235639.js +0 -263
- package/.history/test/js/title_20240429235840.js +0 -263
- package/.history/test/js/title_20240430014721.js +0 -262
- package/.history/test/js/title_20240430014759.js +0 -254
- package/.history/test/js/title_20240430134612.js +0 -285
- package/.history/test/js/title_20240430141051.js +0 -285
- package/.history/test/js/title_20240430173745.js +0 -245
- package/.history/tsconfig_20240812174230.json +0 -22
- package/.history/tsconfig_20240824010157.json +0 -19
- package/.history/tsconfig_20240824220700.json +0 -20
- package/.history/tsconfig_20240825011301.json +0 -20
- package/.history/webpack.config_20240423002825.js +0 -37
- package/.history/webpack.config_20240430001157.js +0 -38
- package/.history/webpack.config_20240430001309.js +0 -37
- package/.history/webpack.config_20240430002112.js +0 -37
- package/CLAUDE.md +0 -96
- package/LICENSE +0 -21
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/core/drawer.ts.html +0 -1264
- package/coverage/lcov-report/core/index.html +0 -146
- package/coverage/lcov-report/core/resourceManager.ts.html +0 -136
- package/coverage/lcov-report/core/scenarioManager.ts.html +0 -373
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -146
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/resource/ImageObject.ts.html +0 -433
- package/coverage/lcov-report/resource/index.html +0 -131
- package/coverage/lcov-report/resource/soundObject.ts.html +0 -346
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/utils/TextMeasurer.ts.html +0 -520
- package/coverage/lcov-report/utils/index.html +0 -161
- package/coverage/lcov-report/utils/logger.ts.html +0 -142
- package/coverage/lcov-report/utils/store.ts.html +0 -151
- package/coverage/lcov-report/utils/waitUtil.ts.html +0 -97
- package/coverage/lcov.info +0 -882
- package/dist/README.md +0 -294
- package/dist/engineConfig.json +0 -10
- package/dist/package.json +0 -51
- package/dist/parser/cli.js +0 -61
- package/dist/parser/parser.js +0 -53
- package/dist/src/core/drawer.js.map +0 -1
- package/dist/src/core/scenarioManager.js.map +0 -1
- package/dist/src/utils/logger.js.map +0 -1
- package/dist/src/utils/store.js.map +0 -1
- package/dist/webtalekit-alpha-0.2.13.tgz +0 -0
- package/docs/event-system-specification.md +0 -493
- package/docs/glossary.html +0 -833
- package/docs/index.html +0 -296
- package/docs/tag-reference.html +0 -1317
- package/docs/ui-template-guide.html +0 -1068
- package/example/README.md +0 -29
- package/example/engineConfig.json +0 -10
- package/example/package-lock.json +0 -5145
- package/example/package.json +0 -26
- package/example/src/index.js +0 -13
- package/example/src/resource/background/beach.jpg +0 -0
- package/example/src/resource/background/city.jpg +0 -0
- package/example/src/resource/background/crossroad.jpg +0 -0
- package/example/src/resource/background/forest.jpg +0 -0
- package/example/src/resource/background/laboratory.jpg +0 -0
- package/example/src/resource/background/library.jpg +0 -0
- package/example/src/resource/background/living_room.jpg +0 -0
- package/example/src/resource/background/music_room.jpg +0 -0
- package/example/src/resource/background/stage.jpg +0 -0
- package/example/src/resource/background/sunset.jpg +0 -0
- package/example/src/resource/background/title_bg.png +0 -0
- package/example/src/resource/bgm/calm_music.wav +0 -0
- package/example/src/resource/bgm/doorbell.mp3 +0 -0
- package/example/src/resource/bgm/nc366476_Virtual_Voyage.mp3 +0 -0
- package/example/src/resource/bgm/title_theme.mp3 +0 -0
- package/example/src/resource/chara/dancer.png +0 -0
- package/example/src/resource/chara/guest.png +0 -0
- package/example/src/resource/chara/guide.png +0 -0
- package/example/src/resource/chara/scientist.png +0 -0
- package/example/src/resource/config.js +0 -0
- package/example/src/resource/se/doorbell.mp3 +0 -0
- package/example/src/resource/system/systemPicture/01_message/message.png +0 -0
- package/example/src/resource/system/systemPicture/02_button/button.png +0 -0
- package/example/src/resource/system/systemPicture/02_button/button2.png +0 -0
- package/example/src/resource/system/systemPicture/02_button/button3.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/auto.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/auto2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/close.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/close2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/config.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/config2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/load.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/load2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/log.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/log2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/menu.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/menu2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qload.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qload2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qsave.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/qsave2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/save.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/save2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/screen.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/screen2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/skip.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/skip2.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/title.png +0 -0
- package/example/src/resource/system/systemPicture/03_system_button/title2.png +0 -0
- package/example/src/resource/system/systemPicture//345/210/251/347/224/250/350/246/217/347/264/204.txt +0 -0
- package/example/src/resource/system/wait.gif +0 -0
- package/example/src/scene/animation.scene +0 -28
- package/example/src/scene/background.scene +0 -29
- package/example/src/scene/character.scene +0 -26
- package/example/src/scene/choice.scene +0 -97
- package/example/src/scene/dialog.scene +0 -105
- package/example/src/scene/effects.scene +0 -38
- package/example/src/scene/en/animation.scene +0 -28
- package/example/src/scene/en/background.scene +0 -26
- package/example/src/scene/en/character.scene +0 -26
- package/example/src/scene/en/choice.scene +0 -32
- package/example/src/scene/en/effects.scene +0 -37
- package/example/src/scene/en/sound.scene +0 -26
- package/example/src/scene/en/text.scene +0 -26
- package/example/src/scene/en/title.scene +0 -39
- package/example/src/scene/if_test.scene +0 -37
- package/example/src/scene/resource-error-test.scene +0 -15
- package/example/src/scene/save-load-test.scene +0 -48
- package/example/src/scene/sound.scene +0 -26
- package/example/src/scene/test_error.scene +0 -21
- package/example/src/scene/text.scene +0 -34
- package/example/src/scene/title.scene +0 -51
- package/example/src/screen/incoming.html +0 -474
- package/example/src/screen/title.html +0 -135
- package/example/src/template.html +0 -16
- package/example/test-results/.last-run.json +0 -4
- package/example/webpack.config.js +0 -69
- package/image.png +0 -0
- package/playwright-report/index.html +0 -71
- package/s-plan1-5Light-s-1.jpg +0 -0
- package/test-results/.last-run.json +0 -6
- package/tests/e2e/if-global-attribute.spec.js +0 -90
- package/tests/e2e/resource-error-handling.spec.js +0 -58
- package/tests/e2e/screenshots/before-error-check.png +0 -0
- package/tests/e2e/screenshots/choices.png +0 -0
- package/tests/e2e/screenshots/message-window-click-wait.png +0 -0
- /package/{dist/src → src}/core/resourceManager.js +0 -0
- /package/{dist/src → src}/core/resourceManager.js.map +0 -0
- /package/{dist/src → src}/resource/ImageObject.js +0 -0
- /package/{dist/src → src}/resource/ImageObject.js.map +0 -0
- /package/{dist/src → src}/resource/soundObject.js +0 -0
- /package/{dist/src → src}/resource/soundObject.js.map +0 -0
- /package/{dist/src → src}/utils/fallbackTemplate.js +0 -0
- /package/{dist/src → src}/utils/fallbackTemplate.js.map +0 -0
- /package/{dist/src → src}/utils/waitUtil.js +0 -0
- /package/{dist/src → src}/utils/waitUtil.js.map +0 -0
package/README.md
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
1
|
# webTaleKit
|
|
2
2
|
|
|
3
|
-

|
|
4
|
+
|
|
5
|
+
**[English](README_EN.md) | 日本語**
|
|
4
6
|
|
|
5
7
|
## 目次
|
|
6
8
|
|
|
7
|
-
- 概要
|
|
8
|
-
- デモ
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
9
|
+
- [概要](#概要)
|
|
10
|
+
- [デモ](#デモ)
|
|
11
|
+
- [ドキュメント](#ドキュメント)
|
|
12
|
+
- [環境構築手順](#環境構築手順)
|
|
13
|
+
- [動作確認手順](#動作確認手順)
|
|
14
|
+
- [Quick Start(デモゲームを弄ってみよう)](#quick-startデモゲームを弄ってみよう)
|
|
15
|
+
- [開発コマンド](#開発コマンド)
|
|
16
|
+
- [シナリオ検証API](#シナリオ検証api)
|
|
17
|
+
- [現在の状況](#現在の状況)
|
|
18
|
+
- [ロードマップ](#ロードマップ実装予定)
|
|
19
|
+
- [できること](#アルファ版01x-02xでできること)
|
|
20
|
+
- [制限事項](#アルファ版01x-02xの制限事項)
|
|
17
21
|
|
|
18
22
|
## 概要
|
|
19
23
|
|
|
20
|
-
TypeScript(JavaScript) ベースのビジュアルノベルゲームエンジンです。
|
|
21
|
-
UIをHTML・CSS・JavaScriptで柔軟に作成でき、シナリオをマークアップ言語とJavaScriptで制御できます。
|
|
22
|
-
|
|
23
|
-
VS Codeの拡張機能を用いたGUIエディタやREST API呼び出しによる生成AI連携の追加を提供予定です。
|
|
24
|
+
TypeScript(JavaScript) ベースのビジュアルノベルゲームエンジンです。
|
|
25
|
+
UIをHTML・CSS・JavaScriptで柔軟に作成でき、シナリオをマークアップ言語とJavaScriptで制御できます。
|
|
26
|
+
自動スケーリング機能で、様々なウィンドウサイズに対応します。
|
|
27
|
+
VS Codeの拡張機能を用いたGUIエディタやREST API呼び出しによる生成AI連携の追加を提供予定です。
|
|
28
|
+
|
|
29
|
+
### 特徴
|
|
30
|
+
|
|
31
|
+
- 🎮 **柔軟なUI作成**: HTML・CSS・JavaScriptで自由にUIをデザイン
|
|
32
|
+
- 📝 **直感的なシナリオ記述**: マークアップ言語とJavaScriptでシナリオを制御
|
|
33
|
+
- 🔄 **自動スケーリング**: 様々なウィンドウサイズに自動対応
|
|
34
|
+
- 🎨 **豊富な画像処理**: フィルター・アニメーション機能を搭載
|
|
35
|
+
- 🔊 **サウンド対応**: BGM・SE・ボイス再生に対応
|
|
36
|
+
- 🛠️ **TypeScript対応**: TypeScriptでの開発をサポート
|
|
37
|
+
- 🤖 **AI連携**: REST API呼び出しによる生成AI連携(予定)
|
|
24
38
|
|
|
25
39
|
## デモ
|
|
26
40
|
|
|
27
|
-
Firefoxでも、Chromeでも、Edge
|
|
41
|
+
Firefoxでも、Chromeでも、Edgeでも、好きなブラウザを使いたまえ・・・!
|
|
28
42
|
<https://test-game-chi.vercel.app/>
|
|
29
|
-

|
|
44
|
+
|
|
45
|
+
## ドキュメント
|
|
46
|
+
|
|
47
|
+
📖 **オンラインドキュメント**: <https://endohizumi.github.io/webTaleKit/>
|
|
30
48
|
|
|
31
49
|
## 環境構築手順
|
|
32
50
|
|
|
@@ -48,8 +66,8 @@ Firefoxでも、Chromeでも、Edgeでも、好きなブラウザを使いたま
|
|
|
48
66
|
- Linuxの場合は、以下のコマンドを実行して、インストールしてください。
|
|
49
67
|
|
|
50
68
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
|
70
|
+
sudo apt-get install -y nodejs
|
|
53
71
|
```
|
|
54
72
|
|
|
55
73
|
3. 以下のコマンドを実行してください
|
|
@@ -68,33 +86,34 @@ Firefoxでも、Chromeでも、Edgeでも、好きなブラウザを使いたま
|
|
|
68
86
|
|
|
69
87
|
```bash
|
|
70
88
|
git clone https://github.com/EndoHizumi/testGame.git
|
|
89
|
+
cd testGame
|
|
71
90
|
npm install
|
|
72
91
|
npm run play
|
|
73
92
|
```
|
|
74
93
|
|
|
75
|
-
## Quick Start
|
|
94
|
+
## Quick Start(デモゲームを弄ってみよう)
|
|
76
95
|
|
|
77
96
|
このセクションでは、プログラミングの知識がなくても簡単にゲームをカスタマイズできる方法を説明します。
|
|
78
97
|
|
|
79
|
-
###
|
|
98
|
+
### 画像を差し替える(簡単なカスタマイズ)
|
|
80
99
|
|
|
81
|
-
**手順:**
|
|
100
|
+
**手順:** 既存の画像ファイルを新しい画像で置き換える(ファイル名は同じにしてください)
|
|
82
101
|
|
|
83
102
|
#### キャラクターや背景を変える
|
|
84
103
|
|
|
85
104
|
- **キャラを変える場合**
|
|
86
|
-
- `./src/resource/chara/guide.png`
|
|
105
|
+
- `./src/resource/chara/guide.png` を新しいキャラ画像で上書きしてください(ファイル名は `guide.png` のまま)
|
|
87
106
|
- **背景画像を変える**
|
|
88
|
-
- `./src/resource/background/title_bg.png`
|
|
107
|
+
- `./src/resource/background/title_bg.png` を新しい背景画像で上書きしてください(ファイル名は `title_bg.png` のまま)
|
|
89
108
|
- **BGMを変える**
|
|
90
|
-
- `./src/resource/bgm/title_theme.mp3`
|
|
109
|
+
- `./src/resource/bgm/title_theme.mp3` を新しい音楽ファイルで上書きしてください(ファイル名は `title_theme.mp3` のまま)
|
|
91
110
|
|
|
92
111
|
#### ボタンの見た目を変える
|
|
93
112
|
|
|
94
113
|
- **選択肢の画像を変える**
|
|
95
|
-
- `./src/resource/system/systemPicture/02_button/button.png
|
|
96
|
-
- `./src/resource/system/systemPicture/02_button/button2.png
|
|
97
|
-
- `./src/resource/system/systemPicture/02_button/button3.png
|
|
114
|
+
- `./src/resource/system/systemPicture/02_button/button.png`(通常時) - ファイル名は `button.png` のまま上書き
|
|
115
|
+
- `./src/resource/system/systemPicture/02_button/button2.png`(マウスを乗せた時) - ファイル名は `button2.png` のまま上書き
|
|
116
|
+
- `./src/resource/system/systemPicture/02_button/button3.png`(クリック時) - ファイル名は `button3.png` のまま上書き
|
|
98
117
|
|
|
99
118
|
**パス表記について:**
|
|
100
119
|
|
|
@@ -102,9 +121,9 @@ npm run play
|
|
|
102
121
|
- パス区切り文字は `/` (スラッシュ) を使用しています
|
|
103
122
|
- **Windowsをお使いの方:** `\` (バックスラッシュ) でも動作しますが、上記の `/` 形式を推奨します
|
|
104
123
|
|
|
105
|
-
###
|
|
124
|
+
### シナリオファイルを編集する(テキストの変更)
|
|
106
125
|
|
|
107
|
-
|
|
126
|
+
シナリオファイル(`.scene`ファイル)をテキストエディタで開いて、以下の方法で内容を変更できます:
|
|
108
127
|
|
|
109
128
|
#### 基本的な要素の追加
|
|
110
129
|
|
|
@@ -113,7 +132,7 @@ npm run play
|
|
|
113
132
|
2. シナリオファイルで `<show src="キャラ画像のファイル名"></show>` を記述
|
|
114
133
|
- **セリフを増やす**
|
|
115
134
|
- `<say name="キャラの名前">ここにセリフを入力</say>` を記述
|
|
116
|
-
-
|
|
135
|
+
- **地の文(ナレーション)を増やす**
|
|
117
136
|
- `<text>ここに地の文を入力</text>` を記述
|
|
118
137
|
|
|
119
138
|
**初心者の方へ:** まずは既存のテキストを変更することから始めることをお勧めします。
|
|
@@ -132,46 +151,95 @@ npm run play
|
|
|
132
151
|
|
|
133
152
|
**実用的な例:**
|
|
134
153
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
```html
|
|
155
|
+
<choice prompt="ゲームを始めますか?">
|
|
156
|
+
<item label="はい">
|
|
157
|
+
<jump index="5" />
|
|
158
|
+
</item>
|
|
159
|
+
<item label="いいえ">
|
|
160
|
+
<jump index="16" />
|
|
161
|
+
</item>
|
|
162
|
+
<item label='ちょっと待ってくれ'>
|
|
163
|
+
<text>承知しました。</text>
|
|
164
|
+
<jump index="1" />
|
|
165
|
+
</item>
|
|
166
|
+
</choice>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 開発コマンド
|
|
170
|
+
|
|
171
|
+
### ビルドと開発
|
|
172
|
+
|
|
173
|
+
- `npm run build` - TypeScriptをJavaScriptにコンパイルし、配布ファイルを準備
|
|
174
|
+
- `npm run dev` - プロジェクトをビルドし、exampleフォルダで開発サーバーを起動
|
|
175
|
+
- `npm run lint` - ESLintでコード品質をチェック
|
|
176
|
+
- `npm run test` - Jestでテストを実行
|
|
177
|
+
|
|
178
|
+
### CLIツール
|
|
179
|
+
|
|
180
|
+
- `wtc` - WebTaleScriptパーサーCLI (`parser/cli.js` から利用可能)
|
|
181
|
+
- 使用方法: `wtc <scene-file> [output-directory]` で `.scene` ファイルを `.js/.ts` ファイルに変換
|
|
182
|
+
|
|
183
|
+
### ドキュメント
|
|
184
|
+
|
|
185
|
+
- `npm run docs:dev` - VitePressドキュメントサーバーを起動
|
|
186
|
+
- `npm run docs:build` - ドキュメントをビルド
|
|
187
|
+
- `npm run docs:preview` - ビルドしたドキュメントをプレビュー
|
|
188
|
+
|
|
189
|
+
## シナリオ検証API
|
|
190
|
+
|
|
191
|
+
WebTaleKit には、シナリオ配列を検証しつつ、HTML風の文字列を非破壊でサニタイズできる公開APIがあります。
|
|
192
|
+
|
|
193
|
+
- `validateScenarioObjects` - 検証結果とサニタイズ済みシナリオを返します
|
|
194
|
+
- `formatValidationOutput` - エラーと警告を表示用文字列へ整形します
|
|
195
|
+
- `createScenarioValidationError` - 検証結果から Error を生成します
|
|
196
|
+
- `assertScenarioValidation` - エラーがある場合に例外を送出します
|
|
197
|
+
- `reportScenarioValidation` - logger 経由で警告とエラーを出力します
|
|
198
|
+
|
|
199
|
+
これらのAPIは、エンジン実行時に自動で強制適用されません。シナリオの読み込み時、エディタ連携時、独自ビルド処理時などに、利用者が必要に応じて呼び出す想定です。
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
import {
|
|
203
|
+
assertScenarioValidation,
|
|
204
|
+
reportScenarioValidation,
|
|
205
|
+
validateScenarioObjects,
|
|
206
|
+
} from './src/utils/validateScenario'
|
|
207
|
+
|
|
208
|
+
const result = validateScenarioObjects(scenarioObjects, commandList)
|
|
209
|
+
|
|
210
|
+
await reportScenarioValidation(result, 'Scene import')
|
|
211
|
+
assertScenarioValidation(result, 'Scene import')
|
|
212
|
+
|
|
213
|
+
const safeScenario = result.sanitizedScenario
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`sanitizedScenario` は元の入力配列を破壊せずに返されます。`sanitized` が `true` の場合は、HTML風の文字列がエスケープされています。
|
|
149
217
|
|
|
150
218
|
## 現在の状況
|
|
151
219
|
|
|
152
|
-
webTaleKitは、現在アルファ版です。
|
|
220
|
+
webTaleKitは、現在アルファ版です。
|
|
153
221
|
|
|
154
222
|
開発進捗は、[@endo_hizumi](https://x.com/endo_hizumi) で行っております。
|
|
155
223
|
実装予定の項目については、こちらの[Trello](https://trello.com/b/qYNGh7MY)からも確認できます。
|
|
156
224
|
|
|
157
|
-
デモをプレイした感想・WebTaleKit
|
|
225
|
+
デモをプレイした感想・WebTaleKitを使って気になったことなど、意見・感想はこちらで受け付けています!
|
|
158
226
|
[https://forms.gle/uejQwvwAb99wcJht7](https://forms.gle/uejQwvwAb99wcJht7)
|
|
159
227
|
|
|
160
228
|
検索Hashtag: #webTalekit
|
|
161
229
|
|
|
162
|
-
##
|
|
230
|
+
## ロードマップ(実装予定)
|
|
163
231
|
|
|
164
232
|
| バージョン | コードネーム | codeName | 内容
|
|
165
233
|
| :--- | :--- | :--- | :---
|
|
166
234
|
| 0.1.0 | 初音| HATUNE | 初期リリース
|
|
167
|
-
| 0.2.0 | 礎 | ISHIZUE | 基本機能アップデート<br>0.2.12
|
|
168
|
-
| 0.3.0 | 舞踊 | BUYO |
|
|
169
|
-
| 0.4.0 | 狭間 | HAZAMA |
|
|
170
|
-
| 0.5.0 | 操手 | AYATURI |
|
|
171
|
-
| 0.6.0 | 絡繰 | KARAKURI |
|
|
172
|
-
| 0.7.0 | 綴り | TUDURI | GUI
|
|
173
|
-
| 0.8.0 | 迅雷 | JINRAI |
|
|
174
|
-
| 0.9.0 | 出島 | DEJIMA | KAG
|
|
235
|
+
| 0.2.0 | 礎 | ISHIZUE | 基本機能アップデート<br>0.2.12〜<br>ダイアログ表示タグの追加<br>engineConfig反映バグの修正<br>未定義タグがある場合、undefineを呼び出すバグの修正<br>文字列以外を囲むとこける問題の修正<br>リンク切れでこける問題の修正<br>メッセージウィンドウオーバーフローの修正<br>if属性の実装<br>for属性の実装<br>既読管理の追加
|
|
236
|
+
| 0.3.0 | 舞踊 | BUYO | トランジション・アニメーション関連のアップデート<br>テキストスピードの調整タグの追加<br>テキスト表示フォントサイズの変更<br>Webフォントのサポート(フォント変更設定の追加)<br>動画再生のサポート<br>子要素でフィルター・アニメーション設定
|
|
237
|
+
| 0.4.0 | 狭間 | HAZAMA | Vue.jsやReact、SvelteなどのUIフレームワークとの連携追加のアップデート
|
|
238
|
+
| 0.5.0 | 操手 | AYATURI | ゲームパッドのサポート追加<br>キーコンフィグの追加<br>VOICEBOX APIの対応<br>npm run recの追加
|
|
239
|
+
| 0.6.0 | 絡繰 | KARAKURI | wtsLinterの追加<br>VSCodeとの連携追加<br>wst2htmlの追加<br>プラグイン機能の追加<br>クロスプラットホームへのビルド追加
|
|
240
|
+
| 0.7.0 | 綴り | TUDURI | GUIエディタの追加
|
|
241
|
+
| 0.8.0 | 迅雷 | JINRAI | パフォーマンスアップデート
|
|
242
|
+
| 0.9.0 | 出島 | DEJIMA | KAGタグコンバータの追加
|
|
175
243
|
| 1.0.0 | 暁月 | AKATUKI | メジャーアップデート
|
|
176
244
|
|
|
177
245
|
## アルファ版(0.1.x-0.2.x)で、できること
|
|
@@ -212,13 +280,18 @@ webTaleKitは、現在アルファ版です。
|
|
|
212
280
|
|
|
213
281
|
- 表示する文章・画像の条件分岐
|
|
214
282
|
- セリフのジャンプ
|
|
215
|
-
-
|
|
283
|
+
- シナリオ(シーン)の切り替え
|
|
216
284
|
|
|
217
285
|
### 音声
|
|
218
286
|
|
|
219
287
|
- BGMの再生・停止
|
|
220
288
|
- SEの再生・停止
|
|
221
289
|
|
|
290
|
+
### セーブ&ロード
|
|
291
|
+
|
|
292
|
+
- セーブ機能
|
|
293
|
+
- ロード機能
|
|
294
|
+
|
|
222
295
|
### システム設定・UI
|
|
223
296
|
|
|
224
297
|
- HTMLで作った画面の表示
|
|
@@ -232,9 +305,9 @@ webTaleKitは、現在アルファ版です。
|
|
|
232
305
|
- 変数の定義・値の変更
|
|
233
306
|
- JavaScript側での背景画像の変更
|
|
234
307
|
- TypeScript連携
|
|
235
|
-
- REST API
|
|
308
|
+
- REST API呼び出し(レスポンスの表示)
|
|
236
309
|
|
|
237
|
-
##
|
|
310
|
+
## アルファ版(0.1.x-0.2.x)の制限事項
|
|
238
311
|
|
|
239
312
|
### ビルド・プラットフォーム
|
|
240
313
|
|
|
@@ -251,18 +324,14 @@ webTaleKitは、現在アルファ版です。
|
|
|
251
324
|
- sayタグの以下の機能
|
|
252
325
|
- キャラが表示されていないときは、表示する
|
|
253
326
|
|
|
254
|
-
### セーブ&ロード
|
|
255
|
-
|
|
256
|
-
- セーブ&ロード機能
|
|
257
|
-
|
|
258
327
|
### 視覚効果
|
|
259
328
|
|
|
260
329
|
- showタグ / hideタグの以下の機能
|
|
261
330
|
- 子要素でフィルター指定
|
|
262
331
|
- 子要素でアニメーション指定
|
|
263
332
|
- スラッシュで区切ってリソース種類を指定
|
|
264
|
-
- quake
|
|
265
|
-
- mask
|
|
333
|
+
- quakeタグ(画面を揺らす)
|
|
334
|
+
- maskタグ(画面の暗転)
|
|
266
335
|
|
|
267
336
|
### 音声
|
|
268
337
|
|
|
@@ -283,12 +352,18 @@ webTaleKitは、現在アルファ版です。
|
|
|
283
352
|
- ゲーム設定ファイルの反映
|
|
284
353
|
- 画面用HTMLのcss・jsのインライン化・minify化
|
|
285
354
|
|
|
286
|
-
##
|
|
355
|
+
## ライセンス
|
|
356
|
+
|
|
357
|
+
MIT License
|
|
358
|
+
|
|
359
|
+
## クレジット
|
|
360
|
+
|
|
361
|
+
### アイコン素材
|
|
287
362
|
|
|
288
363
|
- <https://www.silhouette-illust.com/>
|
|
289
364
|
|
|
290
|
-
|
|
365
|
+
### カラーコード
|
|
291
366
|
|
|
292
|
-
青: #3178C6 (TypeScript
|
|
293
|
-
緑: #02a889 (WebTaleKit Green)
|
|
294
|
-
白: #f8f8f8 (White Smoke)
|
|
367
|
+
- 青: #3178C6 (TypeScript Blue)
|
|
368
|
+
- 緑: #02a889 (WebTaleKit Green)
|
|
369
|
+
- 白: #f8f8f8 (White Smoke)
|
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webtalekit-alpha",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Web知識でノベルゲーを作ることを目指したやつ",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lint": "eslint . --ext .ts --ext .js",
|
|
8
8
|
"test": "jest",
|
|
9
|
+
"setup": "npm install && cd example && npm install",
|
|
9
10
|
"dev": "npm run build && cd example && npm run dev",
|
|
10
|
-
"
|
|
11
|
+
"api": "node server/api.js",
|
|
12
|
+
"build": "rimraf ./dist/ && tsc && cp -r package.json README.md engineConfig.json parser/ dist/ && cp src/core/index.js dist/src/core/",
|
|
13
|
+
"docs:dev": "vitepress dev docs",
|
|
14
|
+
"docs:build": "vitepress build docs",
|
|
15
|
+
"docs:preview": "vitepress preview docs"
|
|
11
16
|
},
|
|
12
17
|
"bin": {
|
|
13
18
|
"wtc": "parser/cli.js"
|
|
@@ -15,6 +20,8 @@
|
|
|
15
20
|
"author": "EndoHizumi",
|
|
16
21
|
"license": "MIT",
|
|
17
22
|
"dependencies": {
|
|
23
|
+
"express": "^5.2.1",
|
|
24
|
+
"gsap": "^3.14.2",
|
|
18
25
|
"html-inline": "^1.2.0",
|
|
19
26
|
"html-minifier": "^4.0.0",
|
|
20
27
|
"html-to-json-parser": "^2.0.1",
|
|
@@ -44,6 +51,7 @@
|
|
|
44
51
|
"ts-loader": "^9.5.1",
|
|
45
52
|
"ts-node": "^10.9.2",
|
|
46
53
|
"typescript": "^5.4.2",
|
|
54
|
+
"vitepress": "^1.6.4",
|
|
47
55
|
"webpack": "^5.90.3",
|
|
48
56
|
"webpack-cli": "^5.1.4",
|
|
49
57
|
"webpack-dev-server": "^5.0.2"
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* トップレベルコマンドの一覧 (core/index.js の Core.commandList から抽出)。
|
|
5
|
+
* HTTP サブタグはこれらのコマンドいずれかの子要素として使用できる。
|
|
6
|
+
*/
|
|
7
|
+
const TOP_LEVEL_COMMANDS = [
|
|
8
|
+
'text', 'choice', 'show', 'newpage', 'hide', 'jump', 'sound', 'say',
|
|
9
|
+
'if', 'call', 'moveto', 'route', 'wait', 'dialog', 'save', 'load',
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 各ノードタイプが配置できる親タイプを定義する。
|
|
14
|
+
* キー: 子ノードタイプ、値: 許可された親タイプの配列
|
|
15
|
+
*/
|
|
16
|
+
const ALLOWED_PARENTS = {
|
|
17
|
+
// choice 構造
|
|
18
|
+
item: ['choice'],
|
|
19
|
+
// dialog 構造
|
|
20
|
+
prompt: ['dialog'],
|
|
21
|
+
actions: ['dialog'],
|
|
22
|
+
action: ['actions'],
|
|
23
|
+
// if 構造
|
|
24
|
+
else: ['if'],
|
|
25
|
+
// then は <if> の子要素としても、トップレベルコマンドの HTTP レスポンスの子要素としても使用できる
|
|
26
|
+
then: ['if', ...TOP_LEVEL_COMMANDS],
|
|
27
|
+
// インラインテキスト装飾タグ (drawer.ts の createDecoratedElement と textHandler から)
|
|
28
|
+
color: ['text', 'say'],
|
|
29
|
+
ruby: ['text', 'say'],
|
|
30
|
+
b: ['text', 'say'],
|
|
31
|
+
i: ['text', 'say'],
|
|
32
|
+
br: ['text', 'say'],
|
|
33
|
+
// HTTP サブタグ (httpHandler から) — トップレベルコマンドの子要素として有効
|
|
34
|
+
header: TOP_LEVEL_COMMANDS,
|
|
35
|
+
data: TOP_LEVEL_COMMANDS,
|
|
36
|
+
error: TOP_LEVEL_COMMANDS,
|
|
37
|
+
progress: TOP_LEVEL_COMMANDS,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* すべてのノードタイプに共通して有効な属性。
|
|
42
|
+
* - type: タグタイプ自体
|
|
43
|
+
* - content: 子ノードの配列
|
|
44
|
+
* - if: 条件付き実行 (core/index.js の runScenario)
|
|
45
|
+
* - get/post/put/delete: HTTP メソッド属性 (core/index.js の httpHandler)
|
|
46
|
+
*/
|
|
47
|
+
const GLOBAL_ATTRIBUTES = new Set(['type', 'content', 'if', 'get', 'post', 'put', 'delete'])
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* ノードタイプごとの既知の属性セット (GLOBAL_ATTRIBUTES を除く)。
|
|
51
|
+
* このセットに含まれない属性は unknown_attribute 警告を生成する。
|
|
52
|
+
* このマップにないノードタイプは属性チェックをスキップする
|
|
53
|
+
* (<header> や <data> の子要素のような自由形式の子要素に対応)。
|
|
54
|
+
*/
|
|
55
|
+
const KNOWN_ATTRIBUTES = {
|
|
56
|
+
// トップレベルコマンド (core/index.js のハンドラ実装から取得)
|
|
57
|
+
text: new Set(['name', 'speed', 'time']),
|
|
58
|
+
say: new Set(['name', 'speed', 'voice']),
|
|
59
|
+
choice: new Set(['prompt', 'position']),
|
|
60
|
+
show: new Set(['src', 'name', 'mode', 'x', 'y', 'width', 'height', 'pos', 'look', 'entry', 'sepia', 'mono', 'blur', 'opacity', 'transition', 'duration']),
|
|
61
|
+
hide: new Set(['name', 'mode', 'transition', 'duration']),
|
|
62
|
+
moveto: new Set(['name', 'x', 'y', 'duration']),
|
|
63
|
+
sound: new Set(['src', 'name', 'mode', 'play', 'loop', 'stop', 'pause']),
|
|
64
|
+
jump: new Set(['index', 'sub']),
|
|
65
|
+
if: new Set(['condition']),
|
|
66
|
+
call: new Set(['method']),
|
|
67
|
+
route: new Set(['to']),
|
|
68
|
+
wait: new Set(['wait', 'time']),
|
|
69
|
+
newpage: new Set([]),
|
|
70
|
+
dialog: new Set(['name', 'template']),
|
|
71
|
+
save: new Set(['slot', 'name', 'message']),
|
|
72
|
+
load: new Set(['slot', 'message']),
|
|
73
|
+
// サブノード
|
|
74
|
+
item: new Set(['label', 'id', 'default', 'hover', 'select', 'color', 'position']),
|
|
75
|
+
action: new Set(['id', 'label', 'value']),
|
|
76
|
+
then: new Set([]),
|
|
77
|
+
else: new Set([]),
|
|
78
|
+
prompt: new Set([]),
|
|
79
|
+
actions: new Set([]),
|
|
80
|
+
// インラインテキスト装飾 (drawer.ts の createDecoratedElement から)
|
|
81
|
+
color: new Set(['value']),
|
|
82
|
+
ruby: new Set(['text']),
|
|
83
|
+
b: new Set([]),
|
|
84
|
+
i: new Set([]),
|
|
85
|
+
br: new Set([]),
|
|
86
|
+
// HTTP サブタグ (header/data の子要素は自由形式のキーを使用するため、チェックしない)
|
|
87
|
+
header: new Set([]),
|
|
88
|
+
data: new Set([]),
|
|
89
|
+
error: new Set([]),
|
|
90
|
+
progress: new Set([]),
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 親子関係が不正な場合のエラーメッセージを生成する。
|
|
95
|
+
* @param {string} nodeType - 誤った位置に配置されたノードのタイプ
|
|
96
|
+
* @param {string|null} parentType - 実際の親タイプ。ルートの場合は null
|
|
97
|
+
* @param {string[]} allowedParents - 許可された親タイプの配列
|
|
98
|
+
* @returns {string}
|
|
99
|
+
*/
|
|
100
|
+
const buildInvalidParentMessage = (nodeType, parentType, allowedParents) => {
|
|
101
|
+
const allowed = allowedParents.map((p) => `<${p}>`).join(' or ')
|
|
102
|
+
const actual = parentType ? `<${parentType}>` : 'scenario root'
|
|
103
|
+
return `<${nodeType}> must be inside ${allowed}, but found inside ${actual}`
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 未知の属性 (エンジンに無視される属性) の警告メッセージを生成する。
|
|
108
|
+
* @param {string} nodeType
|
|
109
|
+
* @param {string} attrName
|
|
110
|
+
* @returns {string}
|
|
111
|
+
*/
|
|
112
|
+
const buildUnknownAttributeMessage = (nodeType, attrName) => {
|
|
113
|
+
return `<${nodeType}> has unknown attribute "${attrName}" which will be ignored`
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* エンジンで認識されない属性をノード単位でチェックする。
|
|
118
|
+
* 該当する属性ごとに unknown_attribute 警告を結果配列に追加する。
|
|
119
|
+
* @param {Object} node
|
|
120
|
+
* @param {Array} results - 結果オブジェクトを蓄積する配列
|
|
121
|
+
*/
|
|
122
|
+
const checkAttributes = (node, results) => {
|
|
123
|
+
const nodeType = node.type
|
|
124
|
+
if (!nodeType) return
|
|
125
|
+
const knownForType = KNOWN_ATTRIBUTES[nodeType]
|
|
126
|
+
if (knownForType === undefined) return // 未知のノードタイプはスキップ
|
|
127
|
+
for (const key of Object.keys(node)) {
|
|
128
|
+
if (GLOBAL_ATTRIBUTES.has(key)) continue
|
|
129
|
+
if (knownForType.has(key)) continue
|
|
130
|
+
results.push({
|
|
131
|
+
type: 'unknown_attribute',
|
|
132
|
+
node: nodeType,
|
|
133
|
+
attribute: key,
|
|
134
|
+
message: buildUnknownAttributeMessage(nodeType, key),
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* ノードの親子関係の違反と未知の属性を再帰的にチェックする。
|
|
141
|
+
* @param {Array} nodes - パース済みシナリオノードの配列
|
|
142
|
+
* @param {string|null} parentType - 親ノードのタイプ。ルートの場合は null
|
|
143
|
+
* @param {Array} results - 結果オブジェクトを蓄積する配列
|
|
144
|
+
*/
|
|
145
|
+
const checkNodes = (nodes, parentType, results) => {
|
|
146
|
+
if (!Array.isArray(nodes)) return
|
|
147
|
+
for (const node of nodes) {
|
|
148
|
+
if (typeof node !== 'object' || node === null) continue
|
|
149
|
+
const nodeType = node.type
|
|
150
|
+
if (!nodeType) continue
|
|
151
|
+
|
|
152
|
+
const allowedParents = ALLOWED_PARENTS[nodeType]
|
|
153
|
+
if (allowedParents && !allowedParents.includes(parentType)) {
|
|
154
|
+
results.push({
|
|
155
|
+
type: 'invalid_parent',
|
|
156
|
+
node: nodeType,
|
|
157
|
+
parent: parentType,
|
|
158
|
+
message: buildInvalidParentMessage(nodeType, parentType, allowedParents),
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
checkAttributes(node, results)
|
|
163
|
+
|
|
164
|
+
if (Array.isArray(node.content)) {
|
|
165
|
+
checkNodes(node.content, nodeType, results)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* パース済みシナリオ配列の構文エラーと属性警告をチェックする。
|
|
172
|
+
* 結果オブジェクトの配列を返す:
|
|
173
|
+
* - type 'invalid_parent': 構造エラー (不正な親子関係)
|
|
174
|
+
* - type 'unknown_attribute': 警告 (エンジンが読み取らない属性)
|
|
175
|
+
* @param {Array} scenario - パース・フラット化されたシナリオ配列
|
|
176
|
+
* @returns {Array}
|
|
177
|
+
*/
|
|
178
|
+
const check = (scenario) => {
|
|
179
|
+
const results = []
|
|
180
|
+
checkNodes(scenario, null, results)
|
|
181
|
+
return results
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
module.exports = { check, ALLOWED_PARENTS, KNOWN_ATTRIBUTES, GLOBAL_ATTRIBUTES }
|