@nice2dev/game-engine 1.3.14 → 1.3.16
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/CHANGELOG.md +13 -0
- package/dist/cjs/accessibility/Accessibility.js +152 -165
- package/dist/cjs/ai/AI.js +292 -294
- package/dist/cjs/ai/BehaviorTree.js +1029 -1113
- package/dist/cjs/ai/StateMachine.js +694 -756
- package/dist/cjs/animation/Animation.js +232 -241
- package/dist/cjs/audio/AudioAdvanced.js +221 -236
- package/dist/cjs/audio/AudioBridge.js +441 -435
- package/dist/cjs/audio/AudioManager.js +242 -259
- package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
- package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
- package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
- package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
- package/dist/cjs/core/EventBus.js +51 -56
- package/dist/cjs/core/GameClock.js +62 -66
- package/dist/cjs/core/GameConfig.js +72 -79
- package/dist/cjs/core/GameLoop.js +80 -89
- package/dist/cjs/core/ServiceLocator.js +61 -65
- package/dist/cjs/core/Validation.js +72 -82
- package/dist/cjs/core/math.js +108 -112
- package/dist/cjs/devtools/DevTools.js +542 -563
- package/dist/cjs/devtools/DeveloperExperience.js +521 -559
- package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
- package/dist/cjs/dialogue/DialogueSystem.js +984 -986
- package/dist/cjs/docs/DocGenerator.js +339 -364
- package/dist/cjs/ecs/World.js +355 -371
- package/dist/cjs/editor/AchievementEditor.js +580 -636
- package/dist/cjs/editor/AdvancedEditor.js +184 -191
- package/dist/cjs/editor/AnimationRetargeting.js +696 -741
- package/dist/cjs/editor/AssetBrowser.js +1072 -1160
- package/dist/cjs/editor/AssetManager.js +187 -192
- package/dist/cjs/editor/ConsolePro.js +971 -1061
- package/dist/cjs/editor/CraftingEditor.js +680 -730
- package/dist/cjs/editor/DebugTools.js +187 -185
- package/dist/cjs/editor/DialogueSystem.js +844 -901
- package/dist/cjs/editor/LeaderboardSystem.js +429 -483
- package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
- package/dist/cjs/editor/PrefabSystem.js +772 -838
- package/dist/cjs/editor/ProfilerPanel.js +649 -700
- package/dist/cjs/editor/QuestEditor.js +792 -839
- package/dist/cjs/editor/ReplaySystem.js +585 -634
- package/dist/cjs/editor/SceneEditor.js +176 -200
- package/dist/cjs/editor/ScreenshotMode.js +621 -688
- package/dist/cjs/editor/ShaderGraph.js +1556 -1582
- package/dist/cjs/editor/TimelineEditor.js +715 -778
- package/dist/cjs/editor/UndoRedoPro.js +830 -904
- package/dist/cjs/editor/VRARMode.js +582 -645
- package/dist/cjs/engine/NiceGameEngine.js +141 -164
- package/dist/cjs/engine/SaveSystem.js +441 -495
- package/dist/cjs/enterprise/Enterprise.js +254 -261
- package/dist/cjs/export/BevyExporter.js +927 -967
- package/dist/cjs/export/CocosExporter.js +644 -673
- package/dist/cjs/export/Construct3Exporter.js +783 -794
- package/dist/cjs/export/DefoldExporter.js +1028 -1069
- package/dist/cjs/export/GDevelopExporter.js +674 -708
- package/dist/cjs/export/GameMakerExporter.js +791 -805
- package/dist/cjs/export/GodotExporter.js +1003 -1045
- package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
- package/dist/cjs/export/MonoGameExporter.js +1265 -1293
- package/dist/cjs/export/Pico8Exporter.js +766 -812
- package/dist/cjs/export/PlatformExporter.js +188 -206
- package/dist/cjs/export/RPGMakerExporter.js +860 -879
- package/dist/cjs/export/RobloxExporter.js +883 -919
- package/dist/cjs/export/Solar2DExporter.js +1218 -1256
- package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
- package/dist/cjs/export/Tic80Exporter.js +1210 -1267
- package/dist/cjs/export/UnityExporter.js +1116 -1131
- package/dist/cjs/export/UnrealExporter.js +889 -919
- package/dist/cjs/export/WebExporter.js +931 -970
- package/dist/cjs/export/index.js +42 -65
- package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
- package/dist/cjs/godot-integration/GodotImport.js +929 -1027
- package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
- package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
- package/dist/cjs/i18n/I18n.js +860 -900
- package/dist/cjs/i18n/useTranslation.js +84 -89
- package/dist/cjs/import/AsepriteImporter.js +658 -716
- package/dist/cjs/import/DragonBonesImporter.js +437 -461
- package/dist/cjs/import/GameMakerImporter.js +511 -521
- package/dist/cjs/import/GodotSceneImporter.js +788 -822
- package/dist/cjs/import/LDtkImporter.js +436 -454
- package/dist/cjs/import/Live2DImporter.js +497 -518
- package/dist/cjs/import/NdgFormat.js +424 -457
- package/dist/cjs/import/OgmoImporter.js +466 -493
- package/dist/cjs/import/RPGMakerImporter.js +451 -477
- package/dist/cjs/import/SceneImporter.js +378 -423
- package/dist/cjs/import/SpineImporter.js +511 -546
- package/dist/cjs/import/SpriterImporter.js +590 -613
- package/dist/cjs/import/TiledMapImporter.js +811 -846
- package/dist/cjs/import/UnitySceneImporter.js +687 -703
- package/dist/cjs/import/index.js +206 -251
- package/dist/cjs/index.js +275 -278
- package/dist/cjs/input/GamepadNavigation.js +185 -205
- package/dist/cjs/input/InputManager.js +397 -421
- package/dist/cjs/input/useGamepads.js +70 -81
- package/dist/cjs/integration/IconSprite.js +129 -256
- package/dist/cjs/inventory/InventorySystem.js +920 -995
- package/dist/cjs/kids/KidMode.js +997 -1022
- package/dist/cjs/kids/KidTools.js +570 -594
- package/dist/cjs/monetization/Monetization.js +170 -177
- package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
- package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
- package/dist/cjs/native-engine/AnimationSystem.js +731 -806
- package/dist/cjs/native-engine/AssetPipeline.js +454 -515
- package/dist/cjs/native-engine/AudioEngine.js +763 -804
- package/dist/cjs/native-engine/InputSystem.js +1075 -1145
- package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
- package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
- package/dist/cjs/native-engine/RenderingEngine.js +302 -350
- package/dist/cjs/native-engine/SceneGraph.js +769 -808
- package/dist/cjs/network/MultiplayerTransport.js +97 -132
- package/dist/cjs/network/Networking.js +549 -564
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
- package/dist/cjs/pathfinding/Pathfinding.js +245 -263
- package/dist/cjs/performance/AssetStreaming.js +561 -635
- package/dist/cjs/performance/BenchmarkSuite.js +283 -311
- package/dist/cjs/performance/DeltaCompression.js +467 -526
- package/dist/cjs/performance/DeterministicPhysics.js +450 -498
- package/dist/cjs/performance/ECSOptimization.js +644 -695
- package/dist/cjs/performance/GameSaveSystem.js +509 -556
- package/dist/cjs/performance/HotReload.js +447 -500
- package/dist/cjs/performance/InputRecording.js +511 -561
- package/dist/cjs/performance/InterestManagement.js +453 -500
- package/dist/cjs/performance/LocalizationRuntime.js +376 -423
- package/dist/cjs/performance/MemoryManagement.js +410 -470
- package/dist/cjs/performance/ModSupport.js +445 -496
- package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
- package/dist/cjs/performance/NetworkPrediction.js +424 -482
- package/dist/cjs/performance/ObjectPooling.js +569 -617
- package/dist/cjs/performance/Performance.js +174 -190
- package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
- package/dist/cjs/performance/WebGPURenderer.js +656 -683
- package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
- package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
- package/dist/cjs/plugins/PluginSDK.js +432 -466
- package/dist/cjs/plugins/PluginTestKit.js +307 -330
- package/dist/cjs/procedural/Procedural.js +243 -254
- package/dist/cjs/procedural/WorldBuilding.js +297 -314
- package/dist/cjs/quest/QuestSystem.js +975 -932
- package/dist/cjs/release/MobileExport.js +157 -163
- package/dist/cjs/release/Release.js +225 -238
- package/dist/cjs/rendering/Camera2D.js +121 -124
- package/dist/cjs/rendering/Renderer2D.js +321 -335
- package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
- package/dist/cjs/runtime3d/Runtime3D.js +359 -378
- package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
- package/dist/cjs/scene/SceneManager.js +177 -193
- package/dist/cjs/scripting/GraphToAST.js +574 -547
- package/dist/cjs/scripting/LanguageExporter.js +254 -279
- package/dist/cjs/scripting/NodeGraph.js +546 -570
- package/dist/cjs/scripting/ScriptAST.js +31 -39
- package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
- package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
- package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
- package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
- package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
- package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
- package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
- package/dist/cjs/social/Social.js +72 -80
- package/dist/cjs/systems/LightingSystem.js +844 -931
- package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
- package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
- package/dist/cjs/systems/TerrainSystem.js +985 -1098
- package/dist/cjs/templates/ActionTemplates.js +296 -309
- package/dist/cjs/templates/FightingTemplate.js +417 -463
- package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
- package/dist/cjs/templates/PartyTemplates.js +190 -202
- package/dist/cjs/templates/PuzzleTemplates.js +245 -261
- package/dist/cjs/templates/RPGTemplates.js +160 -178
- package/dist/cjs/templates/SportsTemplates.js +237 -250
- package/dist/cjs/templates/StrategyTemplates.js +143 -153
- package/dist/cjs/templates/SurvivalTemplate.js +336 -380
- package/dist/cjs/templates/WaveDefense.js +499 -526
- package/dist/cjs/tilemap/Tilemap.js +207 -214
- package/dist/cjs/tutorials/TutorialBranching.js +396 -417
- package/dist/cjs/tutorials/TutorialEngine.js +888 -931
- package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
- package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
- package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
- package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
- package/dist/cjs/ui/GameUI.js +295 -312
- package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
- package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
- package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
- package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
- package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
- package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
- package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
- package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
- package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
- package/dist/cjs/xr/ARVR.js +167 -175
- package/dist/esm/accessibility/Accessibility.js +160 -164
- package/dist/esm/ai/AI.js +310 -293
- package/dist/esm/ai/BehaviorTree.js +1057 -1112
- package/dist/esm/ai/StateMachine.js +709 -755
- package/dist/esm/animation/Animation.js +237 -240
- package/dist/esm/audio/AudioAdvanced.js +239 -235
- package/dist/esm/audio/AudioBridge.js +448 -434
- package/dist/esm/audio/AudioManager.js +243 -258
- package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
- package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
- package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
- package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
- package/dist/esm/core/EventBus.js +52 -55
- package/dist/esm/core/GameClock.js +63 -65
- package/dist/esm/core/GameConfig.js +77 -78
- package/dist/esm/core/GameLoop.js +81 -88
- package/dist/esm/core/ServiceLocator.js +63 -64
- package/dist/esm/core/Validation.js +82 -81
- package/dist/esm/core/math.js +109 -111
- package/dist/esm/devtools/DevTools.js +546 -562
- package/dist/esm/devtools/DeveloperExperience.js +535 -558
- package/dist/esm/devtools/GameplayAnalytics.js +647 -645
- package/dist/esm/dialogue/DialogueSystem.js +998 -985
- package/dist/esm/docs/DocGenerator.js +342 -363
- package/dist/esm/ecs/World.js +358 -370
- package/dist/esm/editor/AchievementEditor.js +584 -635
- package/dist/esm/editor/AdvancedEditor.js +191 -190
- package/dist/esm/editor/AnimationRetargeting.js +700 -740
- package/dist/esm/editor/AssetBrowser.js +1078 -1159
- package/dist/esm/editor/AssetManager.js +188 -191
- package/dist/esm/editor/ConsolePro.js +977 -1060
- package/dist/esm/editor/CraftingEditor.js +684 -729
- package/dist/esm/editor/DebugTools.js +194 -184
- package/dist/esm/editor/DialogueSystem.js +849 -900
- package/dist/esm/editor/LeaderboardSystem.js +433 -482
- package/dist/esm/editor/NiceGameEditor.js +1908 -1200
- package/dist/esm/editor/PrefabSystem.js +777 -837
- package/dist/esm/editor/ProfilerPanel.js +654 -699
- package/dist/esm/editor/QuestEditor.js +795 -838
- package/dist/esm/editor/ReplaySystem.js +591 -633
- package/dist/esm/editor/SceneEditor.js +189 -199
- package/dist/esm/editor/ScreenshotMode.js +628 -687
- package/dist/esm/editor/ShaderGraph.js +1565 -1581
- package/dist/esm/editor/TimelineEditor.js +733 -777
- package/dist/esm/editor/UndoRedoPro.js +835 -903
- package/dist/esm/editor/VRARMode.js +586 -644
- package/dist/esm/engine/NiceGameEngine.js +142 -163
- package/dist/esm/engine/SaveSystem.js +447 -494
- package/dist/esm/enterprise/Enterprise.js +265 -260
- package/dist/esm/export/BevyExporter.js +929 -966
- package/dist/esm/export/CocosExporter.js +646 -672
- package/dist/esm/export/Construct3Exporter.js +785 -793
- package/dist/esm/export/DefoldExporter.js +1030 -1068
- package/dist/esm/export/GDevelopExporter.js +676 -707
- package/dist/esm/export/GameMakerExporter.js +793 -804
- package/dist/esm/export/GodotExporter.js +1004 -1044
- package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
- package/dist/esm/export/MonoGameExporter.js +1267 -1292
- package/dist/esm/export/Pico8Exporter.js +768 -811
- package/dist/esm/export/PlatformExporter.js +193 -205
- package/dist/esm/export/RPGMakerExporter.js +862 -878
- package/dist/esm/export/RobloxExporter.js +885 -918
- package/dist/esm/export/Solar2DExporter.js +1220 -1255
- package/dist/esm/export/ThreeJSExporter.js +1007 -1072
- package/dist/esm/export/Tic80Exporter.js +1212 -1266
- package/dist/esm/export/UnityExporter.js +1117 -1130
- package/dist/esm/export/UnrealExporter.js +891 -918
- package/dist/esm/export/WebExporter.js +933 -969
- package/dist/esm/export/index.js +86 -71
- package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
- package/dist/esm/godot-integration/GodotImport.js +935 -1026
- package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
- package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
- package/dist/esm/i18n/I18n.js +871 -899
- package/dist/esm/i18n/useTranslation.js +88 -88
- package/dist/esm/import/AsepriteImporter.js +637 -715
- package/dist/esm/import/DragonBonesImporter.js +417 -460
- package/dist/esm/import/GameMakerImporter.js +491 -520
- package/dist/esm/import/GodotSceneImporter.js +767 -821
- package/dist/esm/import/LDtkImporter.js +415 -453
- package/dist/esm/import/Live2DImporter.js +477 -517
- package/dist/esm/import/NdgFormat.js +410 -456
- package/dist/esm/import/OgmoImporter.js +446 -492
- package/dist/esm/import/RPGMakerImporter.js +431 -476
- package/dist/esm/import/SceneImporter.js +385 -422
- package/dist/esm/import/SpineImporter.js +491 -545
- package/dist/esm/import/SpriterImporter.js +570 -612
- package/dist/esm/import/TiledMapImporter.js +790 -845
- package/dist/esm/import/UnitySceneImporter.js +666 -702
- package/dist/esm/import/index.js +247 -258
- package/dist/esm/index.js +1332 -188
- package/dist/esm/input/GamepadNavigation.js +187 -204
- package/dist/esm/input/InputManager.js +401 -420
- package/dist/esm/input/useGamepads.js +72 -80
- package/dist/esm/integration/IconSprite.js +143 -255
- package/dist/esm/inventory/InventorySystem.js +925 -994
- package/dist/esm/kids/KidMode.js +1003 -1021
- package/dist/esm/kids/KidTools.js +573 -593
- package/dist/esm/monetization/Monetization.js +180 -176
- package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
- package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
- package/dist/esm/native-engine/AnimationSystem.js +735 -805
- package/dist/esm/native-engine/AssetPipeline.js +456 -514
- package/dist/esm/native-engine/AudioEngine.js +765 -803
- package/dist/esm/native-engine/InputSystem.js +1079 -1144
- package/dist/esm/native-engine/NetworkingSystem.js +740 -792
- package/dist/esm/native-engine/PhysicsEngine.js +585 -606
- package/dist/esm/native-engine/RenderingEngine.js +304 -349
- package/dist/esm/native-engine/SceneGraph.js +773 -807
- package/dist/esm/network/MultiplayerTransport.js +99 -131
- package/dist/esm/network/Networking.js +556 -563
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
- package/dist/esm/pathfinding/Pathfinding.js +249 -262
- package/dist/esm/performance/AssetStreaming.js +567 -634
- package/dist/esm/performance/BenchmarkSuite.js +285 -310
- package/dist/esm/performance/DeltaCompression.js +478 -525
- package/dist/esm/performance/DeterministicPhysics.js +479 -497
- package/dist/esm/performance/ECSOptimization.js +653 -694
- package/dist/esm/performance/GameSaveSystem.js +515 -555
- package/dist/esm/performance/HotReload.js +454 -499
- package/dist/esm/performance/InputRecording.js +520 -560
- package/dist/esm/performance/InterestManagement.js +460 -499
- package/dist/esm/performance/LocalizationRuntime.js +382 -422
- package/dist/esm/performance/MemoryManagement.js +415 -469
- package/dist/esm/performance/ModSupport.js +455 -495
- package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
- package/dist/esm/performance/NetworkPrediction.js +436 -481
- package/dist/esm/performance/ObjectPooling.js +582 -616
- package/dist/esm/performance/Performance.js +182 -189
- package/dist/esm/performance/PerformanceAdvanced.js +621 -636
- package/dist/esm/performance/WebGPURenderer.js +660 -682
- package/dist/esm/physics/PhysicsAdvanced.js +359 -378
- package/dist/esm/physics/PhysicsEngine2D.js +393 -426
- package/dist/esm/plugins/PluginSDK.js +435 -465
- package/dist/esm/plugins/PluginTestKit.js +315 -329
- package/dist/esm/procedural/Procedural.js +248 -253
- package/dist/esm/procedural/WorldBuilding.js +316 -313
- package/dist/esm/quest/QuestSystem.js +982 -931
- package/dist/esm/release/MobileExport.js +163 -162
- package/dist/esm/release/Release.js +234 -237
- package/dist/esm/rendering/Camera2D.js +122 -123
- package/dist/esm/rendering/Renderer2D.js +323 -334
- package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
- package/dist/esm/runtime3d/Runtime3D.js +368 -377
- package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
- package/dist/esm/scene/SceneManager.js +178 -192
- package/dist/esm/scripting/GraphToAST.js +576 -546
- package/dist/esm/scripting/LanguageExporter.js +263 -278
- package/dist/esm/scripting/NodeGraph.js +550 -569
- package/dist/esm/scripting/ScriptAST.js +45 -38
- package/dist/esm/scripting/VisualScripting2.js +1025 -1064
- package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
- package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
- package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
- package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
- package/dist/esm/scripting/exporters/RustExporter.js +460 -511
- package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
- package/dist/esm/social/Social.js +77 -79
- package/dist/esm/systems/LightingSystem.js +855 -930
- package/dist/esm/systems/ParticleSystem2.js +1453 -1450
- package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
- package/dist/esm/systems/TerrainSystem.js +996 -1097
- package/dist/esm/templates/ActionTemplates.js +307 -308
- package/dist/esm/templates/FightingTemplate.js +439 -462
- package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
- package/dist/esm/templates/PartyTemplates.js +206 -201
- package/dist/esm/templates/PuzzleTemplates.js +260 -260
- package/dist/esm/templates/RPGTemplates.js +172 -177
- package/dist/esm/templates/SportsTemplates.js +251 -249
- package/dist/esm/templates/StrategyTemplates.js +158 -152
- package/dist/esm/templates/SurvivalTemplate.js +367 -379
- package/dist/esm/templates/WaveDefense.js +501 -525
- package/dist/esm/tilemap/Tilemap.js +209 -213
- package/dist/esm/tutorials/TutorialBranching.js +399 -416
- package/dist/esm/tutorials/TutorialEngine.js +893 -930
- package/dist/esm/tutorials/TutorialOverlay.js +603 -639
- package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
- package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
- package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
- package/dist/esm/ui/GameUI.js +296 -311
- package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
- package/dist/esm/unity-integration/UnityImport.js +1071 -1175
- package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
- package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
- package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
- package/dist/esm/unreal-integration/UnrealImport.js +395 -411
- package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
- package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
- package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
- package/dist/esm/xr/ARVR.js +181 -174
- package/package.json +7 -12
|
@@ -1,678 +1,640 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/* ────────────────────────────────────────────────────────────────
|
|
6
|
-
Tutorial Overlay UI — LEGENDARY L4
|
|
7
|
-
|
|
8
|
-
Provides DOM-based overlay components for the tutorial system:
|
|
9
|
-
• Spotlight mask (highlight a target element)
|
|
10
|
-
• Tooltip with arrow (positioned relative to target)
|
|
11
|
-
• Progress bar (current step / total)
|
|
12
|
-
• Navigation buttons (next, back, skip)
|
|
13
|
-
• Quiz renderer
|
|
14
|
-
|
|
15
|
-
Designed for use in HTML/DOM environments.
|
|
16
|
-
──────────────────────────────────────────────────────────────── */
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const EventBus = require("../core/EventBus.js");
|
|
17
4
|
const DEFAULT_OVERLAY_CONFIG = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
5
|
+
zIndex: 1e4,
|
|
6
|
+
spotlightPadding: 8,
|
|
7
|
+
spotlightBorderRadius: 8,
|
|
8
|
+
maskOpacity: 0.65,
|
|
9
|
+
animate: true,
|
|
10
|
+
animationDuration: 300,
|
|
11
|
+
theme: "dark",
|
|
12
|
+
classPrefix: "n2d-tutorial",
|
|
13
|
+
closeOnOutsideClick: false,
|
|
14
|
+
showProgress: true,
|
|
15
|
+
showNavigation: true,
|
|
16
|
+
locale: "en"
|
|
30
17
|
};
|
|
31
|
-
/* Button label translations. */
|
|
32
18
|
const BUTTON_LABELS = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
19
|
+
next: {
|
|
20
|
+
en: "Next",
|
|
21
|
+
pl: "Dalej",
|
|
22
|
+
de: "Weiter",
|
|
23
|
+
es: "Siguiente",
|
|
24
|
+
fr: "Suivant",
|
|
25
|
+
ja: "次へ",
|
|
26
|
+
ko: "다음",
|
|
27
|
+
"zh-CN": "下一步"
|
|
28
|
+
},
|
|
29
|
+
back: {
|
|
30
|
+
en: "Back",
|
|
31
|
+
pl: "Wstecz",
|
|
32
|
+
de: "Zurück",
|
|
33
|
+
es: "Atrás",
|
|
34
|
+
fr: "Retour",
|
|
35
|
+
ja: "戻る",
|
|
36
|
+
ko: "뒤로",
|
|
37
|
+
"zh-CN": "返回"
|
|
38
|
+
},
|
|
39
|
+
skip: {
|
|
40
|
+
en: "Skip",
|
|
41
|
+
pl: "Pomiń",
|
|
42
|
+
de: "Überspringen",
|
|
43
|
+
es: "Saltar",
|
|
44
|
+
fr: "Passer",
|
|
45
|
+
ja: "スキップ",
|
|
46
|
+
ko: "건너뛰기",
|
|
47
|
+
"zh-CN": "跳过"
|
|
48
|
+
},
|
|
49
|
+
close: {
|
|
50
|
+
en: "Close",
|
|
51
|
+
pl: "Zamknij",
|
|
52
|
+
de: "Schließen",
|
|
53
|
+
es: "Cerrar",
|
|
54
|
+
fr: "Fermer",
|
|
55
|
+
ja: "閉じる",
|
|
56
|
+
ko: "닫기",
|
|
57
|
+
"zh-CN": "关闭"
|
|
58
|
+
},
|
|
59
|
+
showHint: {
|
|
60
|
+
en: "Show Hint",
|
|
61
|
+
pl: "Pokaż podpowiedź",
|
|
62
|
+
de: "Hinweis zeigen",
|
|
63
|
+
es: "Mostrar pista",
|
|
64
|
+
fr: "Indice",
|
|
65
|
+
ja: "ヒント",
|
|
66
|
+
ko: "힌트 보기",
|
|
67
|
+
"zh-CN": "提示"
|
|
68
|
+
},
|
|
69
|
+
submit: {
|
|
70
|
+
en: "Submit",
|
|
71
|
+
pl: "Zatwierdź",
|
|
72
|
+
de: "Absenden",
|
|
73
|
+
es: "Enviar",
|
|
74
|
+
fr: "Envoyer",
|
|
75
|
+
ja: "送信",
|
|
76
|
+
ko: "제출",
|
|
77
|
+
"zh-CN": "提交"
|
|
78
|
+
}
|
|
93
79
|
};
|
|
94
|
-
/* ══════════════════════════════════════════════════════════════
|
|
95
|
-
CSS Stylesheet (injected once)
|
|
96
|
-
══════════════════════════════════════════════════════════════ */
|
|
97
80
|
function generateStyles(cfg) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.${p}-mask {
|
|
106
|
-
position: fixed;
|
|
107
|
-
inset: 0;
|
|
108
|
-
z-index: ${cfg.zIndex};
|
|
109
|
-
pointer-events: none;
|
|
110
|
-
}
|
|
111
|
-
.${p}-mask-bg {
|
|
112
|
-
position: fixed;
|
|
113
|
-
inset: 0;
|
|
114
|
-
background: rgba(0,0,0,${cfg.maskOpacity});
|
|
115
|
-
z-index: ${cfg.zIndex};
|
|
116
|
-
pointer-events: auto;
|
|
117
|
-
transition: opacity ${dur} ease;
|
|
118
|
-
}
|
|
119
|
-
.${p}-spotlight {
|
|
120
|
-
position: fixed;
|
|
121
|
-
box-shadow: 0 0 0 9999px rgba(0,0,0,${cfg.maskOpacity});
|
|
122
|
-
border-radius: ${cfg.spotlightBorderRadius}px;
|
|
123
|
-
z-index: ${cfg.zIndex + 1};
|
|
124
|
-
pointer-events: none;
|
|
125
|
-
transition: all ${dur} ease;
|
|
126
|
-
}
|
|
127
|
-
.${p}-tooltip {
|
|
128
|
-
position: fixed;
|
|
129
|
-
z-index: ${cfg.zIndex + 2};
|
|
130
|
-
background: ${bg};
|
|
131
|
-
color: ${fg};
|
|
132
|
-
border-radius: 12px;
|
|
133
|
-
padding: 20px;
|
|
134
|
-
max-width: 420px;
|
|
135
|
-
min-width: 260px;
|
|
136
|
-
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
|
|
137
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
138
|
-
font-size: 14px;
|
|
139
|
-
line-height: 1.5;
|
|
140
|
-
transition: all ${dur} ease;
|
|
141
|
-
}
|
|
142
|
-
.${p}-tooltip-title {
|
|
143
|
-
font-size: 16px;
|
|
144
|
-
font-weight: 700;
|
|
145
|
-
margin-bottom: 8px;
|
|
146
|
-
color: ${accent};
|
|
147
|
-
}
|
|
148
|
-
.${p}-tooltip-content {
|
|
149
|
-
margin-bottom: 16px;
|
|
150
|
-
}
|
|
151
|
-
.${p}-tooltip-content code {
|
|
152
|
-
background: ${isDark ?
|
|
153
|
-
padding: 2px 6px;
|
|
154
|
-
border-radius: 4px;
|
|
155
|
-
font-family: 'Fira Code', 'Cascadia Code', monospace;
|
|
156
|
-
font-size: 13px;
|
|
157
|
-
}
|
|
158
|
-
.${p}-arrow {
|
|
159
|
-
position: absolute;
|
|
160
|
-
width: 12px;
|
|
161
|
-
height: 12px;
|
|
162
|
-
background: ${bg};
|
|
163
|
-
transform: rotate(45deg);
|
|
164
|
-
}
|
|
165
|
-
.${p}-arrow-top { top: -6px; left: 50%; margin-left: -6px; }
|
|
166
|
-
.${p}-arrow-bottom { bottom: -6px; left: 50%; margin-left: -6px; }
|
|
167
|
-
.${p}-arrow-left { left: -6px; top: 50%; margin-top: -6px; }
|
|
168
|
-
.${p}-arrow-right { right: -6px; top: 50%; margin-top: -6px; }
|
|
169
|
-
.${p}-progress {
|
|
170
|
-
display: flex;
|
|
171
|
-
align-items: center;
|
|
172
|
-
gap: 8px;
|
|
173
|
-
margin-bottom: 12px;
|
|
174
|
-
}
|
|
175
|
-
.${p}-progress-bar {
|
|
176
|
-
flex: 1;
|
|
177
|
-
height: 4px;
|
|
178
|
-
background: ${isDark ?
|
|
179
|
-
border-radius: 2px;
|
|
180
|
-
overflow: hidden;
|
|
181
|
-
}
|
|
182
|
-
.${p}-progress-fill {
|
|
183
|
-
height: 100%;
|
|
184
|
-
background: ${accent};
|
|
185
|
-
border-radius: 2px;
|
|
186
|
-
transition: width ${dur} ease;
|
|
187
|
-
}
|
|
188
|
-
.${p}-progress-text {
|
|
189
|
-
font-size: 12px;
|
|
190
|
-
color: ${isDark ?
|
|
191
|
-
white-space: nowrap;
|
|
192
|
-
}
|
|
193
|
-
.${p}-nav {
|
|
194
|
-
display: flex;
|
|
195
|
-
gap: 8px;
|
|
196
|
-
justify-content: flex-end;
|
|
197
|
-
margin-top: 12px;
|
|
198
|
-
}
|
|
199
|
-
.${p}-btn {
|
|
200
|
-
padding: 8px 16px;
|
|
201
|
-
border: none;
|
|
202
|
-
border-radius: 6px;
|
|
203
|
-
cursor: pointer;
|
|
204
|
-
font-size: 13px;
|
|
205
|
-
font-weight: 600;
|
|
206
|
-
transition: background ${dur} ease;
|
|
207
|
-
}
|
|
208
|
-
.${p}-btn-primary {
|
|
209
|
-
background: ${accent};
|
|
210
|
-
color: #000;
|
|
211
|
-
}
|
|
212
|
-
.${p}-btn-primary:hover { background: #29b6f6; }
|
|
213
|
-
.${p}-btn-secondary {
|
|
214
|
-
background: ${isDark ?
|
|
215
|
-
color: ${fg};
|
|
216
|
-
}
|
|
217
|
-
.${p}-btn-secondary:hover { background: ${isDark ?
|
|
218
|
-
.${p}-btn-skip {
|
|
219
|
-
background: transparent;
|
|
220
|
-
color: ${isDark ?
|
|
221
|
-
text-decoration: underline;
|
|
222
|
-
}
|
|
223
|
-
.${p}-quiz-options {
|
|
224
|
-
display: flex;
|
|
225
|
-
flex-direction: column;
|
|
226
|
-
gap: 8px;
|
|
227
|
-
margin-bottom: 12px;
|
|
228
|
-
}
|
|
229
|
-
.${p}-quiz-option {
|
|
230
|
-
padding: 10px 14px;
|
|
231
|
-
border: 2px solid ${isDark ?
|
|
232
|
-
border-radius: 8px;
|
|
233
|
-
cursor: pointer;
|
|
234
|
-
transition: all 200ms ease;
|
|
235
|
-
background: transparent;
|
|
236
|
-
color: ${fg};
|
|
237
|
-
text-align: left;
|
|
238
|
-
font-size: 14px;
|
|
239
|
-
}
|
|
240
|
-
.${p}-quiz-option:hover {
|
|
241
|
-
border-color: ${accent};
|
|
242
|
-
background: ${isDark ?
|
|
243
|
-
}
|
|
244
|
-
.${p}-quiz-option.selected {
|
|
245
|
-
border-color: ${accent};
|
|
246
|
-
background: ${isDark ?
|
|
247
|
-
}
|
|
248
|
-
.${p}-quiz-option.correct {
|
|
249
|
-
border-color: #4caf50;
|
|
250
|
-
background: rgba(76,175,80,0.15);
|
|
251
|
-
}
|
|
252
|
-
.${p}-quiz-option.incorrect {
|
|
253
|
-
border-color: #f44336;
|
|
254
|
-
background: rgba(244,67,54,0.1);
|
|
255
|
-
}
|
|
256
|
-
.${p}-hint {
|
|
257
|
-
margin-top: 8px;
|
|
258
|
-
padding: 10px;
|
|
259
|
-
border-radius: 6px;
|
|
260
|
-
background: ${isDark ?
|
|
261
|
-
border-left: 3px solid #ffc107;
|
|
262
|
-
font-size: 13px;
|
|
263
|
-
}
|
|
264
|
-
.${p}-code-block {
|
|
265
|
-
background: ${isDark ?
|
|
266
|
-
border-radius: 8px;
|
|
267
|
-
padding: 12px;
|
|
268
|
-
margin: 8px 0;
|
|
269
|
-
font-family: 'Fira Code', 'Cascadia Code', monospace;
|
|
270
|
-
font-size: 13px;
|
|
271
|
-
white-space: pre-wrap;
|
|
272
|
-
overflow-x: auto;
|
|
273
|
-
max-height: 200px;
|
|
274
|
-
overflow-y: auto;
|
|
275
|
-
}
|
|
81
|
+
const p = cfg.classPrefix;
|
|
82
|
+
const isDark = cfg.theme === "dark";
|
|
83
|
+
const bg = isDark ? "#1e1e2e" : "#ffffff";
|
|
84
|
+
const fg = isDark ? "#e0e0e0" : "#1e1e2e";
|
|
85
|
+
const accent = "#4fc3f7";
|
|
86
|
+
const dur = `${cfg.animationDuration}ms`;
|
|
87
|
+
return `
|
|
88
|
+
.${p}-mask {
|
|
89
|
+
position: fixed;
|
|
90
|
+
inset: 0;
|
|
91
|
+
z-index: ${cfg.zIndex};
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
}
|
|
94
|
+
.${p}-mask-bg {
|
|
95
|
+
position: fixed;
|
|
96
|
+
inset: 0;
|
|
97
|
+
background: rgba(0,0,0,${cfg.maskOpacity});
|
|
98
|
+
z-index: ${cfg.zIndex};
|
|
99
|
+
pointer-events: auto;
|
|
100
|
+
transition: opacity ${dur} ease;
|
|
101
|
+
}
|
|
102
|
+
.${p}-spotlight {
|
|
103
|
+
position: fixed;
|
|
104
|
+
box-shadow: 0 0 0 9999px rgba(0,0,0,${cfg.maskOpacity});
|
|
105
|
+
border-radius: ${cfg.spotlightBorderRadius}px;
|
|
106
|
+
z-index: ${cfg.zIndex + 1};
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
transition: all ${dur} ease;
|
|
109
|
+
}
|
|
110
|
+
.${p}-tooltip {
|
|
111
|
+
position: fixed;
|
|
112
|
+
z-index: ${cfg.zIndex + 2};
|
|
113
|
+
background: ${bg};
|
|
114
|
+
color: ${fg};
|
|
115
|
+
border-radius: 12px;
|
|
116
|
+
padding: 20px;
|
|
117
|
+
max-width: 420px;
|
|
118
|
+
min-width: 260px;
|
|
119
|
+
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
|
|
120
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
121
|
+
font-size: 14px;
|
|
122
|
+
line-height: 1.5;
|
|
123
|
+
transition: all ${dur} ease;
|
|
124
|
+
}
|
|
125
|
+
.${p}-tooltip-title {
|
|
126
|
+
font-size: 16px;
|
|
127
|
+
font-weight: 700;
|
|
128
|
+
margin-bottom: 8px;
|
|
129
|
+
color: ${accent};
|
|
130
|
+
}
|
|
131
|
+
.${p}-tooltip-content {
|
|
132
|
+
margin-bottom: 16px;
|
|
133
|
+
}
|
|
134
|
+
.${p}-tooltip-content code {
|
|
135
|
+
background: ${isDark ? "#2d2d44" : "#f0f0f0"};
|
|
136
|
+
padding: 2px 6px;
|
|
137
|
+
border-radius: 4px;
|
|
138
|
+
font-family: 'Fira Code', 'Cascadia Code', monospace;
|
|
139
|
+
font-size: 13px;
|
|
140
|
+
}
|
|
141
|
+
.${p}-arrow {
|
|
142
|
+
position: absolute;
|
|
143
|
+
width: 12px;
|
|
144
|
+
height: 12px;
|
|
145
|
+
background: ${bg};
|
|
146
|
+
transform: rotate(45deg);
|
|
147
|
+
}
|
|
148
|
+
.${p}-arrow-top { top: -6px; left: 50%; margin-left: -6px; }
|
|
149
|
+
.${p}-arrow-bottom { bottom: -6px; left: 50%; margin-left: -6px; }
|
|
150
|
+
.${p}-arrow-left { left: -6px; top: 50%; margin-top: -6px; }
|
|
151
|
+
.${p}-arrow-right { right: -6px; top: 50%; margin-top: -6px; }
|
|
152
|
+
.${p}-progress {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
gap: 8px;
|
|
156
|
+
margin-bottom: 12px;
|
|
157
|
+
}
|
|
158
|
+
.${p}-progress-bar {
|
|
159
|
+
flex: 1;
|
|
160
|
+
height: 4px;
|
|
161
|
+
background: ${isDark ? "#333" : "#ddd"};
|
|
162
|
+
border-radius: 2px;
|
|
163
|
+
overflow: hidden;
|
|
164
|
+
}
|
|
165
|
+
.${p}-progress-fill {
|
|
166
|
+
height: 100%;
|
|
167
|
+
background: ${accent};
|
|
168
|
+
border-radius: 2px;
|
|
169
|
+
transition: width ${dur} ease;
|
|
170
|
+
}
|
|
171
|
+
.${p}-progress-text {
|
|
172
|
+
font-size: 12px;
|
|
173
|
+
color: ${isDark ? "#888" : "#999"};
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
}
|
|
176
|
+
.${p}-nav {
|
|
177
|
+
display: flex;
|
|
178
|
+
gap: 8px;
|
|
179
|
+
justify-content: flex-end;
|
|
180
|
+
margin-top: 12px;
|
|
181
|
+
}
|
|
182
|
+
.${p}-btn {
|
|
183
|
+
padding: 8px 16px;
|
|
184
|
+
border: none;
|
|
185
|
+
border-radius: 6px;
|
|
186
|
+
cursor: pointer;
|
|
187
|
+
font-size: 13px;
|
|
188
|
+
font-weight: 600;
|
|
189
|
+
transition: background ${dur} ease;
|
|
190
|
+
}
|
|
191
|
+
.${p}-btn-primary {
|
|
192
|
+
background: ${accent};
|
|
193
|
+
color: #000;
|
|
194
|
+
}
|
|
195
|
+
.${p}-btn-primary:hover { background: #29b6f6; }
|
|
196
|
+
.${p}-btn-secondary {
|
|
197
|
+
background: ${isDark ? "#333" : "#eee"};
|
|
198
|
+
color: ${fg};
|
|
199
|
+
}
|
|
200
|
+
.${p}-btn-secondary:hover { background: ${isDark ? "#444" : "#ddd"}; }
|
|
201
|
+
.${p}-btn-skip {
|
|
202
|
+
background: transparent;
|
|
203
|
+
color: ${isDark ? "#888" : "#999"};
|
|
204
|
+
text-decoration: underline;
|
|
205
|
+
}
|
|
206
|
+
.${p}-quiz-options {
|
|
207
|
+
display: flex;
|
|
208
|
+
flex-direction: column;
|
|
209
|
+
gap: 8px;
|
|
210
|
+
margin-bottom: 12px;
|
|
211
|
+
}
|
|
212
|
+
.${p}-quiz-option {
|
|
213
|
+
padding: 10px 14px;
|
|
214
|
+
border: 2px solid ${isDark ? "#444" : "#ccc"};
|
|
215
|
+
border-radius: 8px;
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
transition: all 200ms ease;
|
|
218
|
+
background: transparent;
|
|
219
|
+
color: ${fg};
|
|
220
|
+
text-align: left;
|
|
221
|
+
font-size: 14px;
|
|
222
|
+
}
|
|
223
|
+
.${p}-quiz-option:hover {
|
|
224
|
+
border-color: ${accent};
|
|
225
|
+
background: ${isDark ? "rgba(79,195,247,0.1)" : "rgba(79,195,247,0.05)"};
|
|
226
|
+
}
|
|
227
|
+
.${p}-quiz-option.selected {
|
|
228
|
+
border-color: ${accent};
|
|
229
|
+
background: ${isDark ? "rgba(79,195,247,0.2)" : "rgba(79,195,247,0.1)"};
|
|
230
|
+
}
|
|
231
|
+
.${p}-quiz-option.correct {
|
|
232
|
+
border-color: #4caf50;
|
|
233
|
+
background: rgba(76,175,80,0.15);
|
|
234
|
+
}
|
|
235
|
+
.${p}-quiz-option.incorrect {
|
|
236
|
+
border-color: #f44336;
|
|
237
|
+
background: rgba(244,67,54,0.1);
|
|
238
|
+
}
|
|
239
|
+
.${p}-hint {
|
|
240
|
+
margin-top: 8px;
|
|
241
|
+
padding: 10px;
|
|
242
|
+
border-radius: 6px;
|
|
243
|
+
background: ${isDark ? "#2d2d44" : "#fff8e1"};
|
|
244
|
+
border-left: 3px solid #ffc107;
|
|
245
|
+
font-size: 13px;
|
|
246
|
+
}
|
|
247
|
+
.${p}-code-block {
|
|
248
|
+
background: ${isDark ? "#1a1a2e" : "#f5f5f5"};
|
|
249
|
+
border-radius: 8px;
|
|
250
|
+
padding: 12px;
|
|
251
|
+
margin: 8px 0;
|
|
252
|
+
font-family: 'Fira Code', 'Cascadia Code', monospace;
|
|
253
|
+
font-size: 13px;
|
|
254
|
+
white-space: pre-wrap;
|
|
255
|
+
overflow-x: auto;
|
|
256
|
+
max-height: 200px;
|
|
257
|
+
overflow-y: auto;
|
|
258
|
+
}
|
|
276
259
|
`;
|
|
277
260
|
}
|
|
278
|
-
/* ══════════════════════════════════════════════════════════════
|
|
279
|
-
TutorialOverlay — Main overlay controller
|
|
280
|
-
══════════════════════════════════════════════════════════════ */
|
|
281
261
|
class TutorialOverlay {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
262
|
+
constructor(config) {
|
|
263
|
+
this.events = new EventBus.EventBus();
|
|
264
|
+
this.container = null;
|
|
265
|
+
this.styleEl = null;
|
|
266
|
+
this.maskEl = null;
|
|
267
|
+
this.spotlightEl = null;
|
|
268
|
+
this.tooltipEl = null;
|
|
269
|
+
this.active = false;
|
|
270
|
+
this.currentTutorial = null;
|
|
271
|
+
this.currentStepIndex = 0;
|
|
272
|
+
this.selectedQuizAnswer = null;
|
|
273
|
+
this.hintVisible = false;
|
|
274
|
+
this.config = { ...DEFAULT_OVERLAY_CONFIG, ...config };
|
|
275
|
+
}
|
|
276
|
+
/** Whether the overlay is currently showing. */
|
|
277
|
+
get isActive() {
|
|
278
|
+
return this.active;
|
|
279
|
+
}
|
|
280
|
+
/** Current step index. */
|
|
281
|
+
get stepIndex() {
|
|
282
|
+
return this.currentStepIndex;
|
|
283
|
+
}
|
|
284
|
+
/** Total steps in current tutorial. */
|
|
285
|
+
get totalSteps() {
|
|
286
|
+
return this.currentTutorial?.steps.length ?? 0;
|
|
287
|
+
}
|
|
288
|
+
/** Show the overlay for a tutorial at a given step. */
|
|
289
|
+
show(tutorial, stepIndex = 0) {
|
|
290
|
+
this.currentTutorial = tutorial;
|
|
291
|
+
this.currentStepIndex = stepIndex;
|
|
292
|
+
this.active = true;
|
|
293
|
+
this.selectedQuizAnswer = null;
|
|
294
|
+
this.hintVisible = false;
|
|
295
|
+
this.ensureDOM();
|
|
296
|
+
this.renderStep();
|
|
297
|
+
this.events.emit("overlay:show", { tutorialId: tutorial.id, stepIndex });
|
|
298
|
+
}
|
|
299
|
+
/** Hide the overlay and clean up. */
|
|
300
|
+
hide() {
|
|
301
|
+
this.active = false;
|
|
302
|
+
this.currentTutorial = null;
|
|
303
|
+
this.currentStepIndex = 0;
|
|
304
|
+
this.removeDOM();
|
|
305
|
+
this.events.emit("overlay:hide", {});
|
|
306
|
+
}
|
|
307
|
+
/** Go to a specific step. */
|
|
308
|
+
goToStep(index) {
|
|
309
|
+
if (!this.currentTutorial) {
|
|
310
|
+
return;
|
|
295
311
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return this.active;
|
|
312
|
+
if (index < 0 || index >= this.currentTutorial.steps.length) {
|
|
313
|
+
return;
|
|
299
314
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
315
|
+
this.currentStepIndex = index;
|
|
316
|
+
this.selectedQuizAnswer = null;
|
|
317
|
+
this.hintVisible = false;
|
|
318
|
+
this.renderStep();
|
|
319
|
+
this.events.emit("overlay:step", { stepIndex: index });
|
|
320
|
+
}
|
|
321
|
+
/** Advance to next step. */
|
|
322
|
+
next() {
|
|
323
|
+
this.goToStep(this.currentStepIndex + 1);
|
|
324
|
+
}
|
|
325
|
+
/** Go to previous step. */
|
|
326
|
+
back() {
|
|
327
|
+
this.goToStep(this.currentStepIndex - 1);
|
|
328
|
+
}
|
|
329
|
+
/** Update the locale for button labels. */
|
|
330
|
+
setLocale(locale) {
|
|
331
|
+
this.config.locale = locale;
|
|
332
|
+
if (this.active) {
|
|
333
|
+
this.renderStep();
|
|
303
334
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
335
|
+
}
|
|
336
|
+
/* ── DOM Management ─────────────────────────────────────── */
|
|
337
|
+
ensureDOM() {
|
|
338
|
+
if (this.container) {
|
|
339
|
+
return;
|
|
307
340
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
this.currentTutorial = tutorial;
|
|
311
|
-
this.currentStepIndex = stepIndex;
|
|
312
|
-
this.active = true;
|
|
313
|
-
this.selectedQuizAnswer = null;
|
|
314
|
-
this.hintVisible = false;
|
|
315
|
-
this.ensureDOM();
|
|
316
|
-
this.renderStep();
|
|
317
|
-
this.events.emit('overlay:show', { tutorialId: tutorial.id, stepIndex });
|
|
341
|
+
if (typeof document === "undefined") {
|
|
342
|
+
return;
|
|
318
343
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
344
|
+
this.styleEl = document.createElement("style");
|
|
345
|
+
this.styleEl.textContent = generateStyles(this.config);
|
|
346
|
+
document.head.appendChild(this.styleEl);
|
|
347
|
+
const p = this.config.classPrefix;
|
|
348
|
+
this.maskEl = document.createElement("div");
|
|
349
|
+
this.maskEl.className = `${p}-mask-bg`;
|
|
350
|
+
if (this.config.closeOnOutsideClick) {
|
|
351
|
+
this.maskEl.addEventListener("click", () => {
|
|
352
|
+
this.events.emit("overlay:action", { action: "close" });
|
|
353
|
+
this.hide();
|
|
354
|
+
});
|
|
326
355
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
356
|
+
document.body.appendChild(this.maskEl);
|
|
357
|
+
this.spotlightEl = document.createElement("div");
|
|
358
|
+
this.spotlightEl.className = `${p}-spotlight`;
|
|
359
|
+
document.body.appendChild(this.spotlightEl);
|
|
360
|
+
this.tooltipEl = document.createElement("div");
|
|
361
|
+
this.tooltipEl.className = `${p}-tooltip`;
|
|
362
|
+
document.body.appendChild(this.tooltipEl);
|
|
363
|
+
this.container = this.maskEl;
|
|
364
|
+
}
|
|
365
|
+
removeDOM() {
|
|
366
|
+
if (this.styleEl) {
|
|
367
|
+
this.styleEl.remove();
|
|
368
|
+
this.styleEl = null;
|
|
340
369
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
370
|
+
if (this.maskEl) {
|
|
371
|
+
this.maskEl.remove();
|
|
372
|
+
this.maskEl = null;
|
|
344
373
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
374
|
+
if (this.spotlightEl) {
|
|
375
|
+
this.spotlightEl.remove();
|
|
376
|
+
this.spotlightEl = null;
|
|
348
377
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (this.active) {
|
|
353
|
-
this.renderStep();
|
|
354
|
-
}
|
|
378
|
+
if (this.tooltipEl) {
|
|
379
|
+
this.tooltipEl.remove();
|
|
380
|
+
this.tooltipEl = null;
|
|
355
381
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
// Inject styles once
|
|
365
|
-
this.styleEl = document.createElement('style');
|
|
366
|
-
this.styleEl.textContent = generateStyles(this.config);
|
|
367
|
-
document.head.appendChild(this.styleEl);
|
|
368
|
-
const p = this.config.classPrefix;
|
|
369
|
-
// Mask background
|
|
370
|
-
this.maskEl = document.createElement('div');
|
|
371
|
-
this.maskEl.className = `${p}-mask-bg`;
|
|
372
|
-
if (this.config.closeOnOutsideClick) {
|
|
373
|
-
this.maskEl.addEventListener('click', () => {
|
|
374
|
-
this.events.emit('overlay:action', { action: 'close' });
|
|
375
|
-
this.hide();
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
document.body.appendChild(this.maskEl);
|
|
379
|
-
// Spotlight
|
|
380
|
-
this.spotlightEl = document.createElement('div');
|
|
381
|
-
this.spotlightEl.className = `${p}-spotlight`;
|
|
382
|
-
document.body.appendChild(this.spotlightEl);
|
|
383
|
-
// Tooltip container
|
|
384
|
-
this.tooltipEl = document.createElement('div');
|
|
385
|
-
this.tooltipEl.className = `${p}-tooltip`;
|
|
386
|
-
document.body.appendChild(this.tooltipEl);
|
|
387
|
-
this.container = this.maskEl; // just a flag
|
|
382
|
+
this.container = null;
|
|
383
|
+
}
|
|
384
|
+
/* ── Rendering ──────────────────────────────────────────── */
|
|
385
|
+
renderStep() {
|
|
386
|
+
if (!this.currentTutorial || !this.tooltipEl || !this.spotlightEl || !this.maskEl) {
|
|
387
|
+
return;
|
|
388
388
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
this.styleEl = null;
|
|
393
|
-
}
|
|
394
|
-
if (this.maskEl) {
|
|
395
|
-
this.maskEl.remove();
|
|
396
|
-
this.maskEl = null;
|
|
397
|
-
}
|
|
398
|
-
if (this.spotlightEl) {
|
|
399
|
-
this.spotlightEl.remove();
|
|
400
|
-
this.spotlightEl = null;
|
|
401
|
-
}
|
|
402
|
-
if (this.tooltipEl) {
|
|
403
|
-
this.tooltipEl.remove();
|
|
404
|
-
this.tooltipEl = null;
|
|
405
|
-
}
|
|
406
|
-
this.container = null;
|
|
389
|
+
const step = this.currentTutorial.steps[this.currentStepIndex];
|
|
390
|
+
if (!step) {
|
|
391
|
+
return;
|
|
407
392
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
this.spotlightEl.style.display = 'block';
|
|
428
|
-
this.spotlightEl.style.top = `${rect.top - pad}px`;
|
|
429
|
-
this.spotlightEl.style.left = `${rect.left - pad}px`;
|
|
430
|
-
this.spotlightEl.style.width = `${rect.width + pad * 2}px`;
|
|
431
|
-
this.spotlightEl.style.height = `${rect.height + pad * 2}px`;
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
this.spotlightEl.style.display = 'none';
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
this.spotlightEl.style.display = 'none';
|
|
439
|
-
}
|
|
440
|
-
// Build tooltip HTML
|
|
441
|
-
let html = '';
|
|
442
|
-
// Progress bar
|
|
443
|
-
if (this.config.showProgress) {
|
|
444
|
-
const pct = ((this.currentStepIndex + 1) / this.currentTutorial.steps.length) * 100;
|
|
445
|
-
html += `<div class="${p}-progress">`;
|
|
446
|
-
html += `<div class="${p}-progress-bar"><div class="${p}-progress-fill" style="width:${pct}%"></div></div>`;
|
|
447
|
-
html += `<span class="${p}-progress-text">${this.currentStepIndex + 1} / ${this.currentTutorial.steps.length}</span>`;
|
|
448
|
-
html += `</div>`;
|
|
449
|
-
}
|
|
450
|
-
// Title
|
|
451
|
-
html += `<div class="${p}-tooltip-title">${this.escapeHtml(title)}</div>`;
|
|
452
|
-
// Content
|
|
453
|
-
html += `<div class="${p}-tooltip-content">${this.renderContent(content)}</div>`;
|
|
454
|
-
// Code block (for code steps)
|
|
455
|
-
if (step.type === 'code' && step.codeTemplate) {
|
|
456
|
-
html += `<div class="${p}-code-block">${this.escapeHtml(step.codeTemplate)}</div>`;
|
|
457
|
-
}
|
|
458
|
-
// Quiz options
|
|
459
|
-
if (step.type === 'quiz' && step.quizOptions) {
|
|
460
|
-
html += this.renderQuizOptions(step.quizOptions, step.quizCorrectId ?? '', locale);
|
|
461
|
-
}
|
|
462
|
-
// Hint
|
|
463
|
-
if (step.hint) {
|
|
464
|
-
const hintText = step.hint[locale] ?? step.hint['en'] ?? '';
|
|
465
|
-
if (hintText) {
|
|
466
|
-
if (this.hintVisible) {
|
|
467
|
-
html += `<div class="${p}-hint">${this.escapeHtml(hintText)}</div>`;
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
470
|
-
html += `<button class="${p}-btn ${p}-btn-secondary" data-action="hint">${this.label('showHint')}</button>`;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
// Navigation
|
|
475
|
-
if (this.config.showNavigation) {
|
|
476
|
-
html += `<div class="${p}-nav">`;
|
|
477
|
-
if (step.skippable) {
|
|
478
|
-
html += `<button class="${p}-btn ${p}-btn-skip" data-action="skip">${this.label('skip')}</button>`;
|
|
479
|
-
}
|
|
480
|
-
if (this.currentStepIndex > 0) {
|
|
481
|
-
html += `<button class="${p}-btn ${p}-btn-secondary" data-action="back">${this.label('back')}</button>`;
|
|
482
|
-
}
|
|
483
|
-
if (step.type === 'quiz') {
|
|
484
|
-
html += `<button class="${p}-btn ${p}-btn-primary" data-action="submit">${this.label('submit')}</button>`;
|
|
485
|
-
}
|
|
486
|
-
else {
|
|
487
|
-
html += `<button class="${p}-btn ${p}-btn-primary" data-action="next">${this.label('next')}</button>`;
|
|
488
|
-
}
|
|
489
|
-
html += `</div>`;
|
|
490
|
-
}
|
|
491
|
-
this.tooltipEl.innerHTML = html;
|
|
492
|
-
// Position tooltip
|
|
493
|
-
this.positionTooltip(step);
|
|
494
|
-
// Bind events
|
|
495
|
-
this.bindTooltipEvents(step);
|
|
393
|
+
const locale = this.config.locale;
|
|
394
|
+
const p = this.config.classPrefix;
|
|
395
|
+
const title = step.title[locale] ?? step.title["en"] ?? "";
|
|
396
|
+
const content = step.content[locale] ?? step.content["en"] ?? "";
|
|
397
|
+
if (step.highlightTarget) {
|
|
398
|
+
const target = document.querySelector(step.highlightTarget);
|
|
399
|
+
if (target) {
|
|
400
|
+
const rect = target.getBoundingClientRect();
|
|
401
|
+
const pad = this.config.spotlightPadding;
|
|
402
|
+
this.spotlightEl.style.display = "block";
|
|
403
|
+
this.spotlightEl.style.top = `${rect.top - pad}px`;
|
|
404
|
+
this.spotlightEl.style.left = `${rect.left - pad}px`;
|
|
405
|
+
this.spotlightEl.style.width = `${rect.width + pad * 2}px`;
|
|
406
|
+
this.spotlightEl.style.height = `${rect.height + pad * 2}px`;
|
|
407
|
+
} else {
|
|
408
|
+
this.spotlightEl.style.display = "none";
|
|
409
|
+
}
|
|
410
|
+
} else {
|
|
411
|
+
this.spotlightEl.style.display = "none";
|
|
496
412
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
413
|
+
let html = "";
|
|
414
|
+
if (this.config.showProgress) {
|
|
415
|
+
const pct = (this.currentStepIndex + 1) / this.currentTutorial.steps.length * 100;
|
|
416
|
+
html += `<div class="${p}-progress">`;
|
|
417
|
+
html += `<div class="${p}-progress-bar"><div class="${p}-progress-fill" style="width:${pct}%"></div></div>`;
|
|
418
|
+
html += `<span class="${p}-progress-text">${this.currentStepIndex + 1} / ${this.currentTutorial.steps.length}</span>`;
|
|
419
|
+
html += `</div>`;
|
|
500
420
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
text = opt.text[locale] ?? opt.text['en'] ?? '???';
|
|
511
|
-
}
|
|
512
|
-
const optId = opt.id ?? String(opt.text);
|
|
513
|
-
let cls = `${p}-quiz-option`;
|
|
514
|
-
if (this.selectedQuizAnswer === optId) {
|
|
515
|
-
cls += ' selected';
|
|
516
|
-
if (this.selectedQuizAnswer === correctId) {
|
|
517
|
-
cls += ' correct';
|
|
518
|
-
}
|
|
519
|
-
else {
|
|
520
|
-
cls += ' incorrect';
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
html += `<button class="${cls}" data-quiz-id="${this.escapeHtml(optId)}">${this.escapeHtml(text)}</button>`;
|
|
524
|
-
}
|
|
525
|
-
html += `</div>`;
|
|
526
|
-
return html;
|
|
421
|
+
html += `<div class="${p}-tooltip-title">${this.escapeHtml(title)}</div>`;
|
|
422
|
+
html += `<div class="${p}-tooltip-content">${this.renderContent(content)}</div>`;
|
|
423
|
+
if (step.type === "code" && step.codeTemplate) {
|
|
424
|
+
html += `<div class="${p}-code-block">${this.escapeHtml(step.codeTemplate)}</div>`;
|
|
425
|
+
}
|
|
426
|
+
if (step.type === "quiz" && step.quizOptions) {
|
|
427
|
+
html += this.renderQuizOptions(step.quizOptions, step.quizCorrectId ?? "", locale);
|
|
527
428
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
429
|
+
if (step.hint) {
|
|
430
|
+
const hintText = step.hint[locale] ?? step.hint["en"] ?? "";
|
|
431
|
+
if (hintText) {
|
|
432
|
+
if (this.hintVisible) {
|
|
433
|
+
html += `<div class="${p}-hint">${this.escapeHtml(hintText)}</div>`;
|
|
434
|
+
} else {
|
|
435
|
+
html += `<button class="${p}-btn ${p}-btn-secondary" data-action="hint">${this.label("showHint")}</button>`;
|
|
531
436
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (this.config.showNavigation) {
|
|
440
|
+
html += `<div class="${p}-nav">`;
|
|
441
|
+
if (step.skippable) {
|
|
442
|
+
html += `<button class="${p}-btn ${p}-btn-skip" data-action="skip">${this.label("skip")}</button>`;
|
|
443
|
+
}
|
|
444
|
+
if (this.currentStepIndex > 0) {
|
|
445
|
+
html += `<button class="${p}-btn ${p}-btn-secondary" data-action="back">${this.label("back")}</button>`;
|
|
446
|
+
}
|
|
447
|
+
if (step.type === "quiz") {
|
|
448
|
+
html += `<button class="${p}-btn ${p}-btn-primary" data-action="submit">${this.label("submit")}</button>`;
|
|
449
|
+
} else {
|
|
450
|
+
html += `<button class="${p}-btn ${p}-btn-primary" data-action="next">${this.label("next")}</button>`;
|
|
451
|
+
}
|
|
452
|
+
html += `</div>`;
|
|
453
|
+
}
|
|
454
|
+
this.tooltipEl.innerHTML = html;
|
|
455
|
+
this.positionTooltip(step);
|
|
456
|
+
this.bindTooltipEvents(step);
|
|
457
|
+
}
|
|
458
|
+
renderContent(content) {
|
|
459
|
+
return this.escapeHtml(content).replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
460
|
+
}
|
|
461
|
+
renderQuizOptions(options, correctId, locale) {
|
|
462
|
+
const p = this.config.classPrefix;
|
|
463
|
+
let html = `<div class="${p}-quiz-options">`;
|
|
464
|
+
for (const opt of options) {
|
|
465
|
+
let text;
|
|
466
|
+
if (typeof opt.text === "string") {
|
|
467
|
+
text = opt.text;
|
|
468
|
+
} else {
|
|
469
|
+
text = opt.text[locale] ?? opt.text["en"] ?? "???";
|
|
470
|
+
}
|
|
471
|
+
const optId = opt.id ?? String(opt.text);
|
|
472
|
+
let cls = `${p}-quiz-option`;
|
|
473
|
+
if (this.selectedQuizAnswer === optId) {
|
|
474
|
+
cls += " selected";
|
|
475
|
+
if (this.selectedQuizAnswer === correctId) {
|
|
476
|
+
cls += " correct";
|
|
477
|
+
} else {
|
|
478
|
+
cls += " incorrect";
|
|
552
479
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
this.tooltipEl.style.left = '50%';
|
|
556
|
-
this.tooltipEl.style.transform = 'translate(-50%, -50%)';
|
|
480
|
+
}
|
|
481
|
+
html += `<button class="${cls}" data-quiz-id="${this.escapeHtml(optId)}">${this.escapeHtml(text)}</button>`;
|
|
557
482
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
return { top, left, arrowDirection: 'bottom' };
|
|
578
|
-
}
|
|
579
|
-
break;
|
|
580
|
-
}
|
|
581
|
-
case 'right': {
|
|
582
|
-
const top = Math.max(8, targetRect.top + targetRect.height / 2 - tooltipHeight / 2);
|
|
583
|
-
const left = targetRect.right + gap + this.config.spotlightPadding;
|
|
584
|
-
if (left + tooltipWidth < vw) {
|
|
585
|
-
return { top, left, arrowDirection: 'left' };
|
|
586
|
-
}
|
|
587
|
-
break;
|
|
588
|
-
}
|
|
589
|
-
case 'left': {
|
|
590
|
-
const top = Math.max(8, targetRect.top + targetRect.height / 2 - tooltipHeight / 2);
|
|
591
|
-
const left = targetRect.left - tooltipWidth - gap - this.config.spotlightPadding;
|
|
592
|
-
if (left > 0) {
|
|
593
|
-
return { top, left, arrowDirection: 'right' };
|
|
594
|
-
}
|
|
595
|
-
break;
|
|
596
|
-
}
|
|
483
|
+
html += `</div>`;
|
|
484
|
+
return html;
|
|
485
|
+
}
|
|
486
|
+
positionTooltip(step) {
|
|
487
|
+
if (!this.tooltipEl) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
const preferred = step.tooltipPosition ?? "bottom";
|
|
491
|
+
if (step.highlightTarget) {
|
|
492
|
+
const target = document.querySelector(step.highlightTarget);
|
|
493
|
+
if (target) {
|
|
494
|
+
const rect = target.getBoundingClientRect();
|
|
495
|
+
const pos = this.calculatePosition(rect, preferred);
|
|
496
|
+
this.tooltipEl.style.top = `${pos.top}px`;
|
|
497
|
+
this.tooltipEl.style.left = `${pos.left}px`;
|
|
498
|
+
const p = this.config.classPrefix;
|
|
499
|
+
const existingArrow = this.tooltipEl.querySelector(`.${p}-arrow`);
|
|
500
|
+
if (existingArrow) {
|
|
501
|
+
existingArrow.remove();
|
|
597
502
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
};
|
|
503
|
+
const arrowEl = document.createElement("div");
|
|
504
|
+
arrowEl.className = `${p}-arrow ${p}-arrow-${pos.arrowDirection}`;
|
|
505
|
+
this.tooltipEl.appendChild(arrowEl);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
604
508
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
509
|
+
this.tooltipEl.style.top = "50%";
|
|
510
|
+
this.tooltipEl.style.left = "50%";
|
|
511
|
+
this.tooltipEl.style.transform = "translate(-50%, -50%)";
|
|
512
|
+
}
|
|
513
|
+
calculatePosition(targetRect, preferred) {
|
|
514
|
+
const gap = 16;
|
|
515
|
+
const tooltipWidth = 380;
|
|
516
|
+
const tooltipHeight = 200;
|
|
517
|
+
const vw = window.innerWidth;
|
|
518
|
+
const vh = window.innerHeight;
|
|
519
|
+
switch (preferred) {
|
|
520
|
+
case "bottom": {
|
|
521
|
+
const top = targetRect.bottom + gap + this.config.spotlightPadding;
|
|
522
|
+
const left = Math.max(
|
|
523
|
+
8,
|
|
524
|
+
Math.min(
|
|
525
|
+
targetRect.left + targetRect.width / 2 - tooltipWidth / 2,
|
|
526
|
+
vw - tooltipWidth - 8
|
|
527
|
+
)
|
|
528
|
+
);
|
|
529
|
+
if (top + tooltipHeight < vh) {
|
|
530
|
+
return { top, left, arrowDirection: "top" };
|
|
531
|
+
}
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
case "top": {
|
|
535
|
+
const top = targetRect.top - tooltipHeight - gap - this.config.spotlightPadding;
|
|
536
|
+
const left = Math.max(
|
|
537
|
+
8,
|
|
538
|
+
Math.min(
|
|
539
|
+
targetRect.left + targetRect.width / 2 - tooltipWidth / 2,
|
|
540
|
+
vw - tooltipWidth - 8
|
|
541
|
+
)
|
|
542
|
+
);
|
|
543
|
+
if (top > 0) {
|
|
544
|
+
return { top, left, arrowDirection: "bottom" };
|
|
608
545
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
case 'next':
|
|
617
|
-
this.next();
|
|
618
|
-
break;
|
|
619
|
-
case 'back':
|
|
620
|
-
this.back();
|
|
621
|
-
break;
|
|
622
|
-
case 'skip':
|
|
623
|
-
this.next();
|
|
624
|
-
break;
|
|
625
|
-
case 'hint':
|
|
626
|
-
this.hintVisible = true;
|
|
627
|
-
this.renderStep();
|
|
628
|
-
break;
|
|
629
|
-
case 'submit':
|
|
630
|
-
if (this.selectedQuizAnswer) {
|
|
631
|
-
const correct = this.selectedQuizAnswer === step.quizCorrectId;
|
|
632
|
-
this.events.emit('overlay:quiz-answer', {
|
|
633
|
-
stepId: step.id,
|
|
634
|
-
answerId: this.selectedQuizAnswer,
|
|
635
|
-
correct,
|
|
636
|
-
});
|
|
637
|
-
if (correct) {
|
|
638
|
-
setTimeout(() => this.next(), 600);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
break;
|
|
642
|
-
}
|
|
643
|
-
if (action && action !== 'hint' && action !== 'submit') {
|
|
644
|
-
this.events.emit('overlay:action', { action: action });
|
|
645
|
-
}
|
|
646
|
-
});
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
case "right": {
|
|
549
|
+
const top = Math.max(8, targetRect.top + targetRect.height / 2 - tooltipHeight / 2);
|
|
550
|
+
const left = targetRect.right + gap + this.config.spotlightPadding;
|
|
551
|
+
if (left + tooltipWidth < vw) {
|
|
552
|
+
return { top, left, arrowDirection: "left" };
|
|
647
553
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
});
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
case "left": {
|
|
557
|
+
const top = Math.max(8, targetRect.top + targetRect.height / 2 - tooltipHeight / 2);
|
|
558
|
+
const left = targetRect.left - tooltipWidth - gap - this.config.spotlightPadding;
|
|
559
|
+
if (left > 0) {
|
|
560
|
+
return { top, left, arrowDirection: "right" };
|
|
656
561
|
}
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
657
564
|
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
565
|
+
return {
|
|
566
|
+
top: targetRect.bottom + gap + this.config.spotlightPadding,
|
|
567
|
+
left: Math.max(
|
|
568
|
+
8,
|
|
569
|
+
Math.min(targetRect.left + targetRect.width / 2 - tooltipWidth / 2, vw - tooltipWidth - 8)
|
|
570
|
+
),
|
|
571
|
+
arrowDirection: "top"
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
bindTooltipEvents(step) {
|
|
575
|
+
if (!this.tooltipEl) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
const buttons = this.tooltipEl.querySelectorAll("[data-action]");
|
|
579
|
+
for (let i = 0; i < buttons.length; i++) {
|
|
580
|
+
const btn = buttons[i];
|
|
581
|
+
btn.addEventListener("click", () => {
|
|
582
|
+
const action = btn.getAttribute("data-action");
|
|
583
|
+
switch (action) {
|
|
584
|
+
case "next":
|
|
585
|
+
this.next();
|
|
586
|
+
break;
|
|
587
|
+
case "back":
|
|
588
|
+
this.back();
|
|
589
|
+
break;
|
|
590
|
+
case "skip":
|
|
591
|
+
this.next();
|
|
592
|
+
break;
|
|
593
|
+
case "hint":
|
|
594
|
+
this.hintVisible = true;
|
|
595
|
+
this.renderStep();
|
|
596
|
+
break;
|
|
597
|
+
case "submit":
|
|
598
|
+
if (this.selectedQuizAnswer) {
|
|
599
|
+
const correct = this.selectedQuizAnswer === step.quizCorrectId;
|
|
600
|
+
this.events.emit("overlay:quiz-answer", {
|
|
601
|
+
stepId: step.id,
|
|
602
|
+
answerId: this.selectedQuizAnswer,
|
|
603
|
+
correct
|
|
604
|
+
});
|
|
605
|
+
if (correct) {
|
|
606
|
+
setTimeout(() => this.next(), 600);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
break;
|
|
610
|
+
}
|
|
611
|
+
if (action && action !== "hint" && action !== "submit") {
|
|
612
|
+
this.events.emit("overlay:action", { action });
|
|
662
613
|
}
|
|
663
|
-
|
|
614
|
+
});
|
|
664
615
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
616
|
+
const quizBtns = this.tooltipEl.querySelectorAll("[data-quiz-id]");
|
|
617
|
+
for (let i = 0; i < quizBtns.length; i++) {
|
|
618
|
+
const btn = quizBtns[i];
|
|
619
|
+
btn.addEventListener("click", () => {
|
|
620
|
+
this.selectedQuizAnswer = btn.getAttribute("data-quiz-id");
|
|
621
|
+
this.renderStep();
|
|
622
|
+
});
|
|
671
623
|
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
624
|
+
}
|
|
625
|
+
label(key) {
|
|
626
|
+
const labels = BUTTON_LABELS[key];
|
|
627
|
+
if (!labels) {
|
|
628
|
+
return key;
|
|
675
629
|
}
|
|
630
|
+
return labels[this.config.locale] ?? labels["en"] ?? key;
|
|
631
|
+
}
|
|
632
|
+
escapeHtml(text) {
|
|
633
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
634
|
+
}
|
|
635
|
+
/** Dispose the overlay and all DOM elements. */
|
|
636
|
+
dispose() {
|
|
637
|
+
this.hide();
|
|
638
|
+
}
|
|
676
639
|
}
|
|
677
|
-
|
|
678
640
|
exports.TutorialOverlay = TutorialOverlay;
|