castle-web-cli 0.4.232 → 0.4.234
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/dist/agent-failures.d.ts +8 -0
- package/dist/agent-failures.js +19 -2
- package/dist/agent-prompts.d.ts +1 -1
- package/dist/agent-prompts.js +10 -3
- package/dist/agent.d.ts +64 -3
- package/dist/agent.js +170 -81
- package/dist/api.d.ts +11 -0
- package/dist/api.js +43 -0
- package/dist/bundle.d.ts +64 -0
- package/dist/bundle.js +558 -2
- package/dist/castle-host/host.d.ts +18 -2
- package/dist/castle-host/host.js +844 -39
- package/dist/castleJson.d.ts +23 -2
- package/dist/castleJson.js +46 -2
- package/dist/check.d.ts +3 -1
- package/dist/check.js +20 -3
- package/dist/chunkLoader.d.ts +3 -0
- package/dist/chunkLoader.js +111 -0
- package/dist/devParty.d.ts +26 -0
- package/dist/devParty.js +231 -0
- package/dist/devSaveStorage.js +4 -0
- package/dist/devSessionStorage.js +50 -2
- package/dist/devSocial.d.ts +24 -0
- package/dist/devSocial.js +70 -0
- package/dist/ide.d.ts +2 -0
- package/dist/ide.js +119 -15
- package/dist/importPinMismatch.d.ts +22 -0
- package/dist/importPinMismatch.js +77 -0
- package/dist/importRegression.js +3 -15
- package/dist/imports.d.ts +10 -3
- package/dist/imports.js +88 -20
- package/dist/index.js +11 -4
- package/dist/init.js +1 -1
- package/dist/platformDoc.js +22 -0
- package/dist/routerFences.d.ts +5 -0
- package/dist/routerFences.js +12 -2
- package/dist/save-deck.d.ts +25 -1
- package/dist/save-deck.js +178 -9
- package/dist/serve.js +32 -11
- package/dist/shell/assets/{index-D2tWM896.js → index-DulbYIJm.js} +97 -97
- package/dist/shell/assets/index-MVLfNYd9.css +1 -0
- package/dist/shell/index.html +2 -2
- package/dist/taskSteer.d.ts +13 -0
- package/dist/taskSteer.js +22 -2
- package/dist/vitePlugins.d.ts +2 -1
- package/dist/vitePlugins.js +13 -0
- package/kits/base/castle.json +1 -1
- package/kits/base/package-lock.json +1 -1
- package/kits/base/sdk/README.md +339 -5
- package/kits/base/sdk/avatar.d.ts +6 -2
- package/kits/base/sdk/avatar.js +12 -4
- package/kits/base/sdk/castle.d.ts +7 -3
- package/kits/base/sdk/castle.js +2 -0
- package/kits/base/sdk/commands.d.ts +176 -1
- package/kits/base/sdk/commands.js +3 -0
- package/kits/base/sdk/display.d.ts +3 -0
- package/kits/base/sdk/display.js +9 -3
- package/kits/base/sdk/hub.d.ts +37 -6
- package/kits/base/sdk/hub.js +63 -4
- package/kits/base/sdk/multiplayer.d.ts +7 -1
- package/kits/base/sdk/multiplayer.js +148 -32
- package/kits/base/sdk/multiplayerProtocol.d.ts +2 -0
- package/kits/base/sdk/party.d.ts +23 -0
- package/kits/base/sdk/party.js +91 -0
- package/kits/base/sdk/reconnectBudget.d.ts +23 -0
- package/kits/base/sdk/reconnectBudget.js +96 -0
- package/kits/base/sdk/save.d.ts +38 -1
- package/kits/base/sdk/save.js +81 -7
- package/kits/base/sdk/server/hub.d.ts +117 -0
- package/kits/base/sdk/server/hub.js +119 -2
- package/kits/base/sdk/server/platformHandle.d.ts +43 -1
- package/kits/base/sdk/server/storage.d.ts +17 -0
- package/kits/base/sdk/server/storage.js +65 -3
- package/kits/base/sdk/server/wrapper.d.ts +43 -6
- package/kits/base/sdk/server/wrapper.js +93 -9
- package/kits/base/sdk/social.d.ts +9 -0
- package/kits/base/sdk/social.js +5 -0
- package/kits/hub-game/CLAUDE.md +451 -13
- package/kits/hub-game/README.md +63 -0
- package/kits/hub-game/blueprints/avatar-10.scene +28 -0
- package/kits/hub-game/blueprints/avatar-11.scene +28 -0
- package/kits/hub-game/blueprints/avatar-12.scene +28 -0
- package/kits/hub-game/blueprints/avatar-13.scene +28 -0
- package/kits/hub-game/blueprints/avatar-14.scene +28 -0
- package/kits/hub-game/blueprints/avatar-15.scene +28 -0
- package/kits/hub-game/blueprints/avatar-4.scene +28 -0
- package/kits/hub-game/blueprints/avatar-5.scene +28 -0
- package/kits/hub-game/blueprints/avatar-6.scene +28 -0
- package/kits/hub-game/blueprints/avatar-7.scene +28 -0
- package/kits/hub-game/blueprints/avatar-8.scene +28 -0
- package/kits/hub-game/blueprints/avatar-9.scene +28 -0
- package/kits/hub-game/castle.json +5 -5
- package/kits/hub-game/code/client/act.js +312 -0
- package/kits/hub-game/code/client/actionLayout.js +147 -0
- package/kits/hub-game/code/client/actionOverflow.js +556 -0
- package/kits/hub-game/code/client/actorBudget.js +47 -0
- package/kits/hub-game/code/client/arrivalCamera.js +50 -0
- package/kits/hub-game/code/client/askSlot.js +117 -0
- package/kits/hub-game/code/client/attention.js +11 -2
- package/kits/hub-game/code/client/avatar.js +311 -35
- package/kits/hub-game/code/client/avatarCap.js +228 -0
- package/kits/hub-game/code/client/avatarColors.js +70 -0
- package/kits/hub-game/code/client/avatarFaces.js +21 -0
- package/kits/hub-game/code/client/avatarShare.js +253 -0
- package/kits/hub-game/code/client/backVisibility.js +13 -0
- package/kits/hub-game/code/client/ballot.js +472 -0
- package/kits/hub-game/code/client/build.js +38 -0
- package/kits/hub-game/code/client/chat.js +41 -5
- package/kits/hub-game/code/client/chatModeration.js +5 -0
- package/kits/hub-game/code/client/chrome.js +2144 -160
- package/kits/hub-game/code/client/companion.js +716 -0
- package/kits/hub-game/code/client/companionDress.js +99 -0
- package/kits/hub-game/code/client/crowdNames.js +241 -0
- package/kits/hub-game/code/client/decor.js +515 -0
- package/kits/hub-game/code/client/defaultEnvironment.js +194 -0
- package/kits/hub-game/code/client/doorErrors.js +39 -0
- package/kits/hub-game/code/client/earned.js +131 -0
- package/kits/hub-game/code/client/emoteBubble.js +75 -0
- package/kits/hub-game/code/client/fall.js +18 -0
- package/kits/hub-game/code/client/farAvatars.js +233 -0
- package/kits/hub-game/code/client/firstJoin.js +9 -2
- package/kits/hub-game/code/client/fpsTelemetry.js +50 -0
- package/kits/hub-game/code/client/frameBatch.js +5 -0
- package/kits/hub-game/code/client/grab.js +368 -29
- package/kits/hub-game/code/client/hookLayer.js +385 -20
- package/kits/hub-game/code/client/hudCopy.js +51 -0
- package/kits/hub-game/code/client/hudRate.js +20 -0
- package/kits/hub-game/code/client/idle.js +177 -24
- package/kits/hub-game/code/client/interestCap.js +81 -0
- package/kits/hub-game/code/client/invites.js +231 -0
- package/kits/hub-game/code/client/joinError.js +9 -0
- package/kits/hub-game/code/client/keys.js +36 -0
- package/kits/hub-game/code/client/labelsNear.js +234 -0
- package/kits/hub-game/code/client/landscapeLayout.js +17 -0
- package/kits/hub-game/code/client/layoutCache.js +264 -0
- package/kits/hub-game/code/client/loadTelemetry.js +20 -0
- package/kits/hub-game/code/client/loadingCover.js +148 -0
- package/kits/hub-game/code/client/loadingEntry.js +8 -0
- package/kits/hub-game/code/client/menuIcons.js +34 -0
- package/kits/hub-game/code/client/menuRows.js +43 -0
- package/kits/hub-game/code/client/modelReady.js +7 -0
- package/kits/hub-game/code/client/pack.js +6 -2
- package/kits/hub-game/code/client/packFormat.js +3 -3
- package/kits/hub-game/code/client/padCueArrival.js +23 -0
- package/kits/hub-game/code/client/padCues.js +112 -0
- package/kits/hub-game/code/client/padOccupancy.js +88 -0
- package/kits/hub-game/code/client/padReadability.js +26 -0
- package/kits/hub-game/code/client/padRings.js +69 -0
- package/kits/hub-game/code/client/pushVisit.js +14 -0
- package/kits/hub-game/code/client/quality.js +205 -0
- package/kits/hub-game/code/client/qualityEntry.js +55 -0
- package/kits/hub-game/code/client/rehello.js +167 -0
- package/kits/hub-game/code/client/safeLayout.js +338 -0
- package/kits/hub-game/code/client/safeStyle.js +42 -0
- package/kits/hub-game/code/client/say.js +12 -3
- package/kits/hub-game/code/client/shot.js +146 -0
- package/kits/hub-game/code/client/shotFit.js +56 -0
- package/kits/hub-game/code/client/signIn.js +28 -0
- package/kits/hub-game/code/client/sound.js +63 -8
- package/kits/hub-game/code/client/soundscape.js +1151 -0
- package/kits/hub-game/code/client/soundscapeActions.js +99 -0
- package/kits/hub-game/code/client/soundscapeAmbience.js +453 -0
- package/kits/hub-game/code/client/soundscapeBaked.js +143 -0
- package/kits/hub-game/code/client/soundscapeBusker.js +217 -0
- package/kits/hub-game/code/client/soundscapeCourt.js +200 -0
- package/kits/hub-game/code/client/soundscapeCrowd.js +331 -0
- package/kits/hub-game/code/client/soundscapeCues.js +362 -0
- package/kits/hub-game/code/client/soundscapeMap.js +181 -0
- package/kits/hub-game/code/client/soundscapeMarket.js +176 -0
- package/kits/hub-game/code/client/soundscapeMusic.js +126 -0
- package/kits/hub-game/code/client/soundscapeMusicEngine.js +460 -0
- package/kits/hub-game/code/client/soundscapeSimlish.js +737 -0
- package/kits/hub-game/code/client/soundscapeSongs.js +127 -0
- package/kits/hub-game/code/client/soundscapeSongsRound3.js +63 -0
- package/kits/hub-game/code/client/soundscapeSynthesis.js +168 -0
- package/kits/hub-game/code/client/soundscapeUi.js +211 -0
- package/kits/hub-game/code/client/soundscapeVoice.js +1209 -0
- package/kits/hub-game/code/client/soundscapeWaves.js +206 -0
- package/kits/hub-game/code/client/spin.js +101 -0
- package/kits/hub-game/code/client/state.js +162 -1
- package/kits/hub-game/code/client/stuck.js +259 -0
- package/kits/hub-game/code/client/talk.js +714 -59
- package/kits/hub-game/code/client/tiers.js +543 -52
- package/kits/hub-game/code/client/toastBand.js +37 -0
- package/kits/hub-game/code/client/together.js +39 -2
- package/kits/hub-game/code/client/visibility.js +43 -0
- package/kits/hub-game/code/client/weakestLookBake.js +92 -0
- package/kits/hub-game/code/client/weakestTier.js +295 -0
- package/kits/hub-game/code/client/wear.js +461 -170
- package/kits/hub-game/code/client/worldLabels.js +241 -0
- package/kits/hub-game/code/client/yours.js +200 -0
- package/kits/hub-game/code/companionSpec.js +45 -0
- package/kits/hub-game/code/npcDisplayText.js +55 -0
- package/kits/hub-game/code/privateText.js +7 -0
- package/kits/hub-game/code/server/act.js +124 -0
- package/kits/hub-game/code/server/actions.js +138 -0
- package/kits/hub-game/code/server/actors.js +11 -2
- package/kits/hub-game/code/server/analytics.js +83 -0
- package/kits/hub-game/code/server/anonymousEntry.js +49 -0
- package/kits/hub-game/code/server/arrivalPose.js +36 -0
- package/kits/hub-game/code/server/ask.js +155 -0
- package/kits/hub-game/code/server/ballot.js +539 -0
- package/kits/hub-game/code/server/cells.js +100 -0
- package/kits/hub-game/code/server/companion.js +107 -0
- package/kits/hub-game/code/server/cues.js +70 -0
- package/kits/hub-game/code/server/decor.js +269 -0
- package/kits/hub-game/code/server/doorAnalytics.js +52 -0
- package/kits/hub-game/code/server/earned.js +478 -0
- package/kits/hub-game/code/server/frameBatch.js +183 -0
- package/kits/hub-game/code/server/friendBests.js +166 -0
- package/kits/hub-game/code/server/friendsAmong.js +272 -0
- package/kits/hub-game/code/server/history.js +7 -0
- package/kits/hub-game/code/server/hub.js +2510 -95
- package/kits/hub-game/code/server/idle.js +60 -12
- package/kits/hub-game/code/server/index.js +28 -6
- package/kits/hub-game/code/server/invites.js +19 -0
- package/kits/hub-game/code/server/labels.js +36 -2
- package/kits/hub-game/code/server/loadAbandon.js +106 -0
- package/kits/hub-game/code/server/manifest.js +586 -7
- package/kits/hub-game/code/server/menu.js +161 -0
- package/kits/hub-game/code/server/npcs.js +1025 -113
- package/kits/hub-game/code/server/observe.js +408 -0
- package/kits/hub-game/code/server/padOccupancy.js +85 -0
- package/kits/hub-game/code/server/party.js +2 -2
- package/kits/hub-game/code/server/players.js +30 -0
- package/kits/hub-game/code/server/resumePose.js +152 -0
- package/kits/hub-game/code/server/say.js +1 -1
- package/kits/hub-game/code/server/shot.js +110 -0
- package/kits/hub-game/code/server/standing.js +123 -0
- package/kits/hub-game/code/server/storageLimit.js +187 -0
- package/kits/hub-game/code/server/vis.js +175 -0
- package/kits/hub-game/code/server/wear.js +12 -0
- package/kits/hub-game/code/server/yours.js +59 -0
- package/kits/hub-game/code/shared/act.js +35 -0
- package/kits/hub-game/code/shared/cues.js +9 -0
- package/kits/hub-game/code/shared/danceIdle.js +28 -0
- package/kits/hub-game/code/shared/decor.js +41 -0
- package/kits/hub-game/code/shared/loadStages.js +12 -0
- package/kits/hub-game/code/shared/quality.js +74 -0
- package/kits/hub-game/code/shared/say.js +2 -0
- package/kits/hub-game/code/shared/shot.js +53 -0
- package/kits/hub-game/code/shared/spin.js +57 -0
- package/kits/hub-game/code/systems/hub.js +1753 -202
- package/kits/hub-game/docs/analytics.md +279 -0
- package/kits/hub-game/docs/content-pack.md +1 -1
- package/kits/hub-game/docs/contract.md +3475 -77
- package/kits/hub-game/docs/home-pieces.md +71 -0
- package/kits/hub-game/docs/observed-progress.md +252 -0
- package/kits/hub-game/main.jsx +2 -0
- package/kits/hub-game/models/avatar-10.pxmodel +28 -0
- package/kits/hub-game/models/avatar-11.pxmodel +28 -0
- package/kits/hub-game/models/avatar-12.pxmodel +27 -0
- package/kits/hub-game/models/avatar-13.pxmodel +24 -0
- package/kits/hub-game/models/avatar-14.pxmodel +29 -0
- package/kits/hub-game/models/avatar-15.pxmodel +24 -0
- package/kits/hub-game/models/avatar-4.pxmodel +29 -0
- package/kits/hub-game/models/avatar-5.pxmodel +27 -0
- package/kits/hub-game/models/avatar-6.pxmodel +26 -0
- package/kits/hub-game/models/avatar-7.pxmodel +25 -0
- package/kits/hub-game/models/avatar-8.pxmodel +24 -0
- package/kits/hub-game/models/avatar-9.pxmodel +30 -0
- package/kits/hub-game/models/earned/badge-round.pxmodel +100 -0
- package/kits/hub-game/models/earned/badge-shield.pxmodel +117 -0
- package/kits/hub-game/models/earned/badge-star.pxmodel +87 -0
- package/kits/hub-game/models/earned/belt-plain.pxmodel +72 -0
- package/kits/hub-game/models/earned/held-ball.pxmodel +43 -0
- package/kits/hub-game/models/earned/held-lantern.pxmodel +85 -0
- package/kits/hub-game/models/earned/held-net.pxmodel +57 -0
- package/kits/hub-game/models/earned/held-trophy.pxmodel +109 -0
- package/kits/hub-game/models/earned/pin-round.pxmodel +62 -0
- package/kits/hub-game/models/earned/sash-plain.pxmodel +66 -0
- package/kits/hub-game/models/earned/square/belt-plain.pxmodel +104 -0
- package/kits/hub-game/models/earned/square/sash-plain.pxmodel +98 -0
- package/kits/hub-game/models/hats/bat-clip.pxmodel +206 -0
- package/kits/hub-game/models/hats/beekeeper.pxmodel +149 -0
- package/kits/hub-game/models/hats/cap.pxmodel +162 -0
- package/kits/hub-game/models/hats/captain.pxmodel +178 -0
- package/kits/hub-game/models/hats/crooked-top.pxmodel +172 -0
- package/kits/hub-game/models/hats/flower-crown.pxmodel +451 -0
- package/kits/hub-game/models/hats/foam-crown.pxmodel +179 -0
- package/kits/hub-game/models/hats/lantern.pxmodel +230 -0
- package/kits/hub-game/models/hats/laurel.pxmodel +533 -0
- package/kits/hub-game/models/hats/lighthouse.pxmodel +96 -0
- package/kits/hub-game/models/hats/sailor.pxmodel +141 -0
- package/kits/hub-game/models/hats/souwester.pxmodel +131 -0
- package/kits/hub-game/models/hats/straw.pxmodel +139 -0
- package/kits/hub-game/models/hats/sunflower.pxmodel +406 -0
- package/kits/hub-game/models/hats/sweatband.pxmodel +112 -0
- package/kits/hub-game/models/hats/witch.pxmodel +147 -0
- package/kits/hub-game/package-lock.json +10 -1
- package/kits/hub-game/package.json +6 -2
- package/kits/hub-game/play/player.js +142 -0
- package/kits/hub-game/play/registry.js +47 -0
- package/kits/hub-game/play.jsx +37 -0
- package/kits/hub-game/scripts/check.mjs +117 -16
- package/kits/hub-game/scripts/companion-follower-wire.json +1 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +132 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless.json +293 -0
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +26 -0
- package/kits/hub-game/scripts/fixtures/fake-dom.mjs +123 -0
- package/kits/hub-game/scripts/fixtures/interest-legacy.json +385 -0
- package/kits/hub-game/scripts/fixtures/npc-notes-v1.77.jsonl +4 -0
- package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -0
- package/kits/hub-game/scripts/gen-avatars.mjs +933 -16
- package/kits/hub-game/scripts/gen-earned.mjs +285 -0
- package/kits/hub-game/scripts/gen-hats.mjs +827 -0
- package/kits/hub-game/scripts/grab.before-orbit.mjs +400 -0
- package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -0
- package/kits/hub-game/scripts/soundscape-wave-analysis.mjs +125 -0
- package/kits/hub-game/scripts/test-act-client.mjs +186 -0
- package/kits/hub-game/scripts/test-act.mjs +171 -0
- package/kits/hub-game/scripts/test-action-layout.mjs +80 -0
- package/kits/hub-game/scripts/test-action-observers.mjs +46 -0
- package/kits/hub-game/scripts/test-actions-client.mjs +853 -0
- package/kits/hub-game/scripts/test-actions.mjs +298 -0
- package/kits/hub-game/scripts/test-actor-budget.mjs +44 -0
- package/kits/hub-game/scripts/test-actors.mjs +38 -23
- package/kits/hub-game/scripts/test-analytics.mjs +76 -0
- package/kits/hub-game/scripts/test-anonymous-entry.mjs +28 -0
- package/kits/hub-game/scripts/test-arrival-pose-server.mjs +196 -0
- package/kits/hub-game/scripts/test-arrival-pose.mjs +24 -0
- package/kits/hub-game/scripts/test-ask-client.mjs +358 -0
- package/kits/hub-game/scripts/test-ask-slot.mjs +85 -0
- package/kits/hub-game/scripts/test-ask.mjs +269 -0
- package/kits/hub-game/scripts/test-attention.mjs +10 -1
- package/kits/hub-game/scripts/test-avatar-cap.mjs +379 -0
- package/kits/hub-game/scripts/test-avatar-colors.mjs +72 -0
- package/kits/hub-game/scripts/test-avatar-models.mjs +181 -0
- package/kits/hub-game/scripts/test-avatar-share.mjs +318 -0
- package/kits/hub-game/scripts/test-avatar-wire.mjs +792 -0
- package/kits/hub-game/scripts/test-avatar.mjs +584 -7
- package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
- package/kits/hub-game/scripts/test-ballot.mjs +1008 -0
- package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
- package/kits/hub-game/scripts/test-build.mjs +49 -0
- package/kits/hub-game/scripts/test-cells.mjs +71 -0
- package/kits/hub-game/scripts/test-chat.mjs +863 -0
- package/kits/hub-game/scripts/test-classic.mjs +2 -0
- package/kits/hub-game/scripts/test-companion-chat.mjs +216 -0
- package/kits/hub-game/scripts/test-companion-client.mjs +1167 -0
- package/kits/hub-game/scripts/test-companion.mjs +259 -0
- package/kits/hub-game/scripts/test-control-layout-dom.mjs +120 -0
- package/kits/hub-game/scripts/test-crowd-names.mjs +205 -0
- package/kits/hub-game/scripts/test-decor-client.mjs +344 -0
- package/kits/hub-game/scripts/test-decor.mjs +464 -0
- package/kits/hub-game/scripts/test-default-environment-root.mjs +95 -0
- package/kits/hub-game/scripts/test-default-environment.mjs +267 -0
- package/kits/hub-game/scripts/test-door-analytics.mjs +58 -0
- package/kits/hub-game/scripts/test-door-jump.mjs +100 -0
- package/kits/hub-game/scripts/test-earned-client.mjs +459 -0
- package/kits/hub-game/scripts/test-earned.mjs +1224 -0
- package/kits/hub-game/scripts/test-emote-bubble.mjs +110 -0
- package/kits/hub-game/scripts/test-far-avatars.mjs +340 -0
- package/kits/hub-game/scripts/test-fps-telemetry.mjs +112 -0
- package/kits/hub-game/scripts/test-frame-batch.mjs +252 -0
- package/kits/hub-game/scripts/test-fresh-friends.mjs +118 -0
- package/kits/hub-game/scripts/test-friend-bests.mjs +435 -0
- package/kits/hub-game/scripts/test-grab-orbit.mjs +961 -0
- package/kits/hub-game/scripts/test-grab.mjs +7 -0
- package/kits/hub-game/scripts/test-hats.mjs +422 -168
- package/kits/hub-game/scripts/test-high-only.mjs +170 -0
- package/kits/hub-game/scripts/test-hub-leaving.mjs +203 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +758 -2
- package/kits/hub-game/scripts/test-hub-trip.mjs +1594 -12
- package/kits/hub-game/scripts/test-hud-clear.mjs +484 -57
- package/kits/hub-game/scripts/test-hud-defects-dom.mjs +100 -0
- package/kits/hub-game/scripts/test-hud-rate.mjs +224 -0
- package/kits/hub-game/scripts/test-hud-safe-visibility-dom.mjs +83 -0
- package/kits/hub-game/scripts/test-idle.mjs +427 -1
- package/kits/hub-game/scripts/test-interest-cap.mjs +36 -0
- package/kits/hub-game/scripts/test-interest-cells.mjs +513 -0
- package/kits/hub-game/scripts/test-interest-client.mjs +118 -0
- package/kits/hub-game/scripts/test-interest.mjs +15 -0
- package/kits/hub-game/scripts/test-invites-client.mjs +430 -0
- package/kits/hub-game/scripts/test-invites.mjs +109 -0
- package/kits/hub-game/scripts/test-keys.mjs +46 -1
- package/kits/hub-game/scripts/test-labels.mjs +664 -0
- package/kits/hub-game/scripts/test-landscape-layout.mjs +194 -0
- package/kits/hub-game/scripts/test-list-scroll-dom.mjs +49 -0
- package/kits/hub-game/scripts/test-load-abandon.mjs +246 -0
- package/kits/hub-game/scripts/test-loading-cover.mjs +162 -0
- package/kits/hub-game/scripts/test-manifest.mjs +472 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +585 -0
- package/kits/hub-game/scripts/test-menu.mjs +319 -0
- package/kits/hub-game/scripts/test-npcs.mjs +2528 -13
- package/kits/hub-game/scripts/test-object-entry.mjs +76 -0
- package/kits/hub-game/scripts/test-observed.mjs +745 -0
- package/kits/hub-game/scripts/test-pack.mjs +7 -0
- package/kits/hub-game/scripts/test-pad-cues.mjs +304 -0
- package/kits/hub-game/scripts/test-pad-occupancy.mjs +177 -0
- package/kits/hub-game/scripts/test-picker.mjs +541 -0
- package/kits/hub-game/scripts/test-placement-cache.mjs +690 -0
- package/kits/hub-game/scripts/test-progress-reset.mjs +559 -0
- package/kits/hub-game/scripts/test-push-visit.mjs +26 -0
- package/kits/hub-game/scripts/test-quality.mjs +385 -0
- package/kits/hub-game/scripts/test-rehello.mjs +1733 -0
- package/kits/hub-game/scripts/test-relations-among.mjs +222 -0
- package/kits/hub-game/scripts/test-relations-refresh.mjs +188 -0
- package/kits/hub-game/scripts/test-resume-action-order.mjs +598 -0
- package/kits/hub-game/scripts/test-resume-held.mjs +239 -0
- package/kits/hub-game/scripts/test-resume-pose.mjs +142 -0
- package/kits/hub-game/scripts/test-safe-events-dom.mjs +116 -0
- package/kits/hub-game/scripts/test-safe-layout.mjs +330 -0
- package/kits/hub-game/scripts/test-say.mjs +1 -1
- package/kits/hub-game/scripts/test-shot.mjs +901 -0
- package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +5437 -0
- package/kits/hub-game/scripts/test-spin.mjs +314 -0
- package/kits/hub-game/scripts/test-standing.mjs +449 -0
- package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
- package/kits/hub-game/scripts/test-stuck.mjs +1904 -0
- package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
- package/kits/hub-game/scripts/test-tier-cells.mjs +706 -0
- package/kits/hub-game/scripts/test-tiers-render.mjs +412 -0
- package/kits/hub-game/scripts/test-tiers.mjs +476 -2
- package/kits/hub-game/scripts/test-toast-band.mjs +61 -0
- package/kits/hub-game/scripts/test-try-on.mjs +22 -22
- package/kits/hub-game/scripts/test-vis.mjs +770 -0
- package/kits/hub-game/scripts/test-visibility.mjs +134 -0
- package/kits/hub-game/scripts/test-weakest-tier.mjs +924 -0
- package/kits/hub-game/scripts/test-world-labels.mjs +367 -0
- package/kits/hub-game/scripts/test-yours-chrome.mjs +210 -0
- package/kits/hub-game/scripts/test-yours.mjs +403 -0
- package/kits/multiplayer-3d/CLAUDE.md +50 -0
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/avatars.js +7 -0
- package/kits/multiplayer-3d/code/client/gait.js +65 -0
- package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
- package/kits/multiplayer-3d/code/client/nameTags.js +59 -4
- package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
- package/kits/multiplayer-3d/code/options.js +5 -0
- package/kits/multiplayer-3d/code/server/ownership.js +10 -2
- package/kits/multiplayer-3d/code/server/sceneBodies.js +12 -0
- package/kits/multiplayer-3d/code/server/world.js +7 -0
- package/kits/multiplayer-3d/code/systems/multiplayer.js +443 -34
- package/kits/multiplayer-3d/package-lock.json +8 -1
- package/kits/multiplayer-3d/package.json +3 -1
- package/kits/multiplayer-3d/scripts/fixtures/README.md +11 -0
- package/kits/multiplayer-3d/scripts/fixtures/ownership-legacy.json +2 -0
- package/kits/multiplayer-3d/scripts/ownership-harness.mjs +102 -0
- package/kits/multiplayer-3d/scripts/ownership-loader.mjs +46 -0
- package/kits/multiplayer-3d/scripts/ownership-worker.mjs +15 -0
- package/kits/multiplayer-3d/scripts/record-ownership-session.mjs +98 -0
- package/kits/multiplayer-3d/scripts/test-eligible-claims.mjs +167 -0
- package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
- package/kits/multiplayer-3d/scripts/test-own-name-tag.mjs +247 -0
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
- package/kits/physics-2d/CLAUDE.md +19 -1
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/frozenActors.js +233 -0
- package/kits/physics-2d/engine/scene.js +337 -3
- package/kits/physics-2d/engine/skyKey.js +129 -0
- package/kits/physics-2d/engine/stillClock.js +106 -0
- package/kits/physics-2d/engine/updateBudget.js +21 -0
- package/kits/physics-2d/eslint.config.js +1 -1
- package/kits/physics-2d/play/behaviors/AnalogStick.js +198 -0
- package/kits/physics-2d/play/behaviors/Camera.js +40 -0
- package/kits/physics-2d/play/behaviors/Collider.js +122 -0
- package/kits/physics-2d/play/behaviors/Draggable.js +115 -0
- package/kits/physics-2d/play/behaviors/Goal.js +46 -0
- package/kits/physics-2d/play/behaviors/Joints.js +126 -0
- package/kits/physics-2d/play/behaviors/Layout.js +71 -0
- package/kits/physics-2d/play/behaviors/RigidBody.js +57 -0
- package/kits/physics-2d/play/behaviors/Slingshot.js +142 -0
- package/kits/physics-2d/play/behaviors/SoundPlayer.js +263 -0
- package/kits/physics-2d/play/behaviors/Sprite.js +406 -0
- package/kits/physics-2d/play/behaviors/Style.js +209 -0
- package/kits/physics-2d/play/behaviors/Text.js +85 -0
- package/kits/physics-2d/play/behaviors/Video.js +93 -0
- package/kits/physics-2d/scripts/test-skip-unchanged.mjs +326 -1
- package/kits/physics-3d/CLAUDE.md +42 -529
- package/kits/physics-3d/behaviors/Body.jsx +3 -0
- package/kits/physics-3d/behaviors/Model.jsx +3 -0
- package/kits/physics-3d/behaviors/Player.jsx +661 -87
- package/kits/physics-3d/behaviors/Shape.jsx +3 -0
- package/kits/physics-3d/behaviors/Solid.jsx +3 -0
- package/kits/physics-3d/behaviors/Transform.jsx +3 -0
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/docs/engine-camera.md +542 -0
- package/kits/physics-3d/docs/engine-frame-cap.md +136 -0
- package/kits/physics-3d/docs/engine-load.md +149 -0
- package/kits/physics-3d/docs/engine-look.md +114 -0
- package/kits/physics-3d/docs/engine-shadows.md +372 -0
- package/kits/physics-3d/docs/engine-skip-work.md +187 -0
- package/kits/physics-3d/docs/engine-sky.md +198 -0
- package/kits/physics-3d/docs/engine-static-actors.md +226 -0
- package/kits/physics-3d/docs/engine-view.md +37 -0
- package/kits/physics-3d/docs/pxmodel-format.md +9 -1
- package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -277
- package/kits/physics-3d/engine3d/actornode.js +87 -0
- package/kits/physics-3d/engine3d/animationBudget.js +23 -0
- package/kits/physics-3d/engine3d/branches.js +3 -13
- package/kits/physics-3d/engine3d/cage.js +2 -7
- package/kits/physics-3d/engine3d/cageops.js +2 -17
- package/kits/physics-3d/engine3d/dataBehaviors.js +12 -0
- package/kits/physics-3d/engine3d/editorWorld.js +6 -0
- package/kits/physics-3d/engine3d/emptynodes.js +232 -0
- package/kits/physics-3d/engine3d/framecap.js +99 -0
- package/kits/physics-3d/engine3d/frozenphysics.js +140 -0
- package/kits/physics-3d/engine3d/frozenstatics.js +273 -0
- package/kits/physics-3d/engine3d/gait.js +126 -0
- package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
- package/kits/physics-3d/engine3d/kithooks.js +47 -0
- package/kits/physics-3d/engine3d/look.js +514 -48
- package/kits/physics-3d/engine3d/lookbake.js +208 -0
- package/kits/physics-3d/engine3d/materialpresets.js +2 -0
- package/kits/physics-3d/engine3d/modelFiles.js +3 -17
- package/kits/physics-3d/engine3d/modelMath.js +49 -0
- package/kits/physics-3d/engine3d/modelready.js +16 -0
- package/kits/physics-3d/engine3d/motion.js +39 -10
- package/kits/physics-3d/engine3d/nearshadows.js +106 -21
- package/kits/physics-3d/engine3d/optimize.js +9 -5
- package/kits/physics-3d/engine3d/orbitinput.js +522 -10
- package/kits/physics-3d/engine3d/orbitlens.js +48 -0
- package/kits/physics-3d/engine3d/ownmodel.js +213 -0
- package/kits/physics-3d/engine3d/partgeometry.js +1 -16
- package/kits/physics-3d/engine3d/paths.js +1 -9
- package/kits/physics-3d/engine3d/playTimings.js +50 -0
- package/kits/physics-3d/engine3d/playerRun.js +372 -0
- package/kits/physics-3d/engine3d/pxmodel.js +42 -11
- package/kits/physics-3d/engine3d/rapier.js +27 -0
- package/kits/physics-3d/engine3d/scatter.js +1 -11
- package/kits/physics-3d/engine3d/shadowfade.js +890 -0
- package/kits/physics-3d/engine3d/sky.js +547 -0
- package/kits/physics-3d/engine3d/skylife.js +306 -0
- package/kits/physics-3d/engine3d/squarefirst.js +177 -0
- package/kits/physics-3d/engine3d/stillshadows.js +399 -0
- package/kits/physics-3d/engine3d/sweep.js +1 -25
- package/kits/physics-3d/engine3d/unchanged.js +11 -0
- package/kits/physics-3d/engine3d/viewrange.js +52 -0
- package/kits/physics-3d/engine3d/world3d.js +1253 -76
- package/kits/physics-3d/eslint.config.js +2 -1
- package/kits/physics-3d/main.jsx +10 -2
- package/kits/physics-3d/package-lock.json +7 -0
- package/kits/physics-3d/package.json +5 -1
- package/kits/physics-3d/play/behaviors/Body.js +31 -0
- package/kits/physics-3d/play/behaviors/Door.js +37 -0
- package/kits/physics-3d/play/behaviors/Lookable.js +16 -0
- package/kits/physics-3d/play/behaviors/Model.js +23 -0
- package/kits/physics-3d/play/behaviors/Pickup.js +46 -0
- package/kits/physics-3d/play/behaviors/Player.js +1204 -0
- package/kits/physics-3d/play/behaviors/Shape.js +47 -0
- package/kits/physics-3d/play/behaviors/Solid.js +16 -0
- package/kits/physics-3d/play/behaviors/Transform.js +29 -0
- package/kits/physics-3d/pnpm-lock.yaml +8 -0
- package/kits/physics-3d/scripts/bench-shadow-fade.mjs +37 -0
- package/kits/physics-3d/scripts/build-rapier-gz.mjs +56 -0
- package/kits/physics-3d/scripts/frozen-statics-fixture.mjs +141 -0
- package/kits/physics-3d/scripts/look-baseline.mjs +155 -0
- package/kits/physics-3d/scripts/test-camera-follow.mjs +5 -1
- package/kits/physics-3d/scripts/test-camera-orbit.mjs +2613 -82
- package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +2 -2
- package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
- package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +438 -0
- package/kits/physics-3d/scripts/test-frame-cap.mjs +452 -0
- package/kits/physics-3d/scripts/test-frozen-nested.mjs +49 -0
- package/kits/physics-3d/scripts/test-frozen-statics-legacy-physics2d.mjs +123 -0
- package/kits/physics-3d/scripts/test-frozen-statics.mjs +434 -0
- package/kits/physics-3d/scripts/test-gait.mjs +387 -0
- package/kits/physics-3d/scripts/test-look-bake.mjs +1056 -0
- package/kits/physics-3d/scripts/test-model-parse-cache.mjs +92 -0
- package/kits/physics-3d/scripts/test-near-shadows.mjs +5 -2
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +2001 -0
- package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +582 -0
- package/kits/physics-3d/scripts/test-orbit-shot.mjs +657 -0
- package/kits/physics-3d/scripts/test-orbit-view.mjs +230 -0
- package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
- package/kits/physics-3d/scripts/test-skip-empty-nodes.mjs +845 -0
- package/kits/physics-3d/scripts/test-sky.mjs +2470 -0
- package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
- package/kits/physics-3d/scripts/test-static-actors.mjs +10 -1
- package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
- package/kits/physics-3d/scripts/test-static-scenery.mjs +2174 -0
- package/kits/physics-3d/scripts/test-steady-hover.mjs +7 -2
- package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
- package/kits/physics-3d/scripts/test-view-range.mjs +260 -0
- package/kits/physics-3d/systems/physics3d.js +419 -9
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/connection.js +33 -10
- package/kits/real-time/code/client/gameHooks.js +2 -0
- package/kits/real-time/code/client/joinOverlay.js +9 -4
- package/kits/real-time/code/server/gameHooks.js +7 -0
- package/kits/real-time/code/server/session.js +102 -22
- package/kits/real-time/package-lock.json +1 -1
- package/package.json +2 -2
- package/dist/shell/assets/index-Cf61cNfT.css +0 -1
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
// v1.74 private action state, phone chrome, taps and reconnect cleanup.
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { setMaxListeners } from 'node:events';
|
|
4
|
+
import { register } from 'node:module';
|
|
5
|
+
|
|
6
|
+
register(`data:text/javascript,${encodeURIComponent(`
|
|
7
|
+
import { readFile } from 'node:fs/promises';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
export async function resolve(specifier, context, next) {
|
|
10
|
+
if (['pxmodel', 'optimize', 'look', 'lookbake'].some((m) => specifier === '@imports/castle.physics-3d/engine3d/' + m)) return { url: ${JSON.stringify(new URL('./fixtures/engine-models-stub.mjs', import.meta.url).href)}, shortCircuit: true };
|
|
11
|
+
if (specifier === '@imports/castle.physics-3d/engine3d/orbitlens.js') return { url: ${JSON.stringify(new URL('../../physics-3d/engine3d/orbitlens.js', import.meta.url).href)}, shortCircuit: true };
|
|
12
|
+
if (specifier === 'castle-web-sdk') return { url: 'data:text/javascript,export {};', shortCircuit: true };
|
|
13
|
+
if (specifier === '@imports/castle.multiplayer-3d/code/client/avatars.js') return { url: 'data:text/javascript,export const dropMissing = () => {};', shortCircuit: true };
|
|
14
|
+
if (specifier.startsWith('@imports/castle.physics-2d/engine/')) return { url: 'data:text/javascript,export const initialMedia = {}; export const playMedia = () => {}; export const stopMedia = () => {};', shortCircuit: true };
|
|
15
|
+
if (specifier === '../client/pack.js') return { url: 'data:text/javascript,export const cachedPacks = () => []; export const loadPack = () => {}; export const matchesOwn = () => false; export const resolveDeckDoor = () => {};', shortCircuit: true };
|
|
16
|
+
return next(specifier, context);
|
|
17
|
+
}
|
|
18
|
+
export async function load(url, context, next) {
|
|
19
|
+
if (url.endsWith('/code/client/hookLayer.js')) {
|
|
20
|
+
const source = await readFile(fileURLToPath(url), 'utf8');
|
|
21
|
+
return { format: 'module', source: source.replaceAll('import.meta.glob(', '(() => ({}))('), shortCircuit: true };
|
|
22
|
+
}
|
|
23
|
+
return next(url, context);
|
|
24
|
+
}
|
|
25
|
+
`)}`);
|
|
26
|
+
const State = await import('../code/client/state.js');
|
|
27
|
+
const hook = (await import('../code/client/hookLayer.js')).default;
|
|
28
|
+
const { installSystem } = await import('../code/systems/hub.js');
|
|
29
|
+
const { makeChrome } = await import('../code/client/chrome.js');
|
|
30
|
+
const { makeSignIn } = await import('../code/client/signIn.js');
|
|
31
|
+
function fakeDom(view) {
|
|
32
|
+
const log = [];
|
|
33
|
+
let ids = 0;
|
|
34
|
+
const made = [];
|
|
35
|
+
const chipSize = (chip, maxWidth) => {
|
|
36
|
+
const width = Math.min(chip.textContent.length * 7 + 40, maxWidth);
|
|
37
|
+
const lines = Math.ceil(chip.textContent.length * 7 / Math.max(1, width - 40));
|
|
38
|
+
return { width, height: 44 + Math.max(0, lines - 1) * 20 };
|
|
39
|
+
};
|
|
40
|
+
function node(tag) {
|
|
41
|
+
const id = `${tag}#${(ids += 1)}`;
|
|
42
|
+
const styles = {};
|
|
43
|
+
let text = '';
|
|
44
|
+
const self = {
|
|
45
|
+
id,
|
|
46
|
+
tag,
|
|
47
|
+
children: [],
|
|
48
|
+
parent: null,
|
|
49
|
+
dataset: {},
|
|
50
|
+
attrs: {},
|
|
51
|
+
rect: null,
|
|
52
|
+
size: null,
|
|
53
|
+
style: new Proxy(styles, {
|
|
54
|
+
get: (target, key) => target[key] ?? '',
|
|
55
|
+
set(target, key, value) {
|
|
56
|
+
target[key] = String(value);
|
|
57
|
+
log.push(`${id} style.${String(key)}=${value}`);
|
|
58
|
+
return true;
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
styles,
|
|
62
|
+
get textContent() {
|
|
63
|
+
return text;
|
|
64
|
+
},
|
|
65
|
+
set textContent(value) {
|
|
66
|
+
text = String(value);
|
|
67
|
+
log.push(`${id} text=${text}`);
|
|
68
|
+
},
|
|
69
|
+
appendChild(child) {
|
|
70
|
+
if (child.parent) {
|
|
71
|
+
if (document.activeElement === child) {document.activeElement = document.body;}
|
|
72
|
+
child.parent.children = child.parent.children.filter((c) => c !== child);
|
|
73
|
+
}
|
|
74
|
+
child.parent = self;
|
|
75
|
+
self.children.push(child);
|
|
76
|
+
log.push(`${id} +${child.id}`);
|
|
77
|
+
return child;
|
|
78
|
+
},
|
|
79
|
+
append(...kids) {
|
|
80
|
+
kids.forEach((kid) => self.appendChild(kid));
|
|
81
|
+
},
|
|
82
|
+
insertBefore(child, before) {
|
|
83
|
+
if (child.parent) {
|
|
84
|
+
child.parent.children = child.parent.children.filter((c) => c !== child);
|
|
85
|
+
}
|
|
86
|
+
child.parent = self;
|
|
87
|
+
const at = self.children.indexOf(before);
|
|
88
|
+
self.children.splice(at < 0 ? self.children.length : at, 0, child);
|
|
89
|
+
return child;
|
|
90
|
+
},
|
|
91
|
+
remove() {
|
|
92
|
+
if (self.parent) {
|
|
93
|
+
self.parent.children = self.parent.children.filter((c) => c !== self);
|
|
94
|
+
log.push(`${id} removed`);
|
|
95
|
+
self.parent = null;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
replaceChildren(...kids) {
|
|
99
|
+
self.children = [];
|
|
100
|
+
log.push(`${id} emptied`);
|
|
101
|
+
kids.forEach((kid) => self.appendChild(kid));
|
|
102
|
+
},
|
|
103
|
+
handlers: {},
|
|
104
|
+
addEventListener(type, fn, options) {
|
|
105
|
+
self.handlers[type] = fn;
|
|
106
|
+
if (options?.signal) {
|
|
107
|
+
setMaxListeners(0, options.signal);
|
|
108
|
+
options.signal.addEventListener('abort', () => { delete self.handlers[type]; }, { once: true });
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
removeEventListener() {},
|
|
112
|
+
setAttribute(key, value) {
|
|
113
|
+
self.attrs[key] = String(value);
|
|
114
|
+
},
|
|
115
|
+
getAttribute: (key) => self.attrs[key] ?? null,
|
|
116
|
+
focus() { document.activeElement = self; },
|
|
117
|
+
blur() { if (document.activeElement === self) document.activeElement = null; },
|
|
118
|
+
// A stand-in layout: 7 px a character and 20 of padding, one 24 px line.
|
|
119
|
+
get offsetWidth() {
|
|
120
|
+
log.push(`${id} read`);
|
|
121
|
+
return (typeof self.size === 'function' ? self.size(self) : self.size)?.w ?? text.length * 7 + 20;
|
|
122
|
+
},
|
|
123
|
+
get offsetHeight() {
|
|
124
|
+
log.push(`${id} read`);
|
|
125
|
+
return (typeof self.size === 'function' ? self.size(self) : self.size)?.h ?? 24;
|
|
126
|
+
},
|
|
127
|
+
get offsetLeft() {
|
|
128
|
+
return parseFloat(styles.left) || 0;
|
|
129
|
+
},
|
|
130
|
+
get clientWidth() {
|
|
131
|
+
return self.client ?? self.offsetWidth;
|
|
132
|
+
},
|
|
133
|
+
get scrollWidth() {
|
|
134
|
+
return self.scroll ?? self.offsetWidth;
|
|
135
|
+
},
|
|
136
|
+
getBoundingClientRect() {
|
|
137
|
+
let r = self.rect ?? { left: 0, right: 0, top: 0, bottom: 0 };
|
|
138
|
+
if (styles.flexDirection === 'column-reverse') {
|
|
139
|
+
const sizes = self.children.filter((child) => child.style.display !== 'none').map((child) => chipSize(child, parseFloat(styles.maxWidth) || view.viewW - 24));
|
|
140
|
+
const height = sizes.reduce((sum, size) => sum + size.height, 0) + Math.max(0, sizes.length - 1) * 6;
|
|
141
|
+
const width = Math.max(0, ...sizes.map((size) => size.width));
|
|
142
|
+
const bottom = styles.bottom.startsWith('max') ? 132 : parseFloat(styles.bottom);
|
|
143
|
+
const right = view.viewW - parseFloat(styles.right);
|
|
144
|
+
r = { left: right - width, right, top: view.viewH - bottom - height, bottom: view.viewH - bottom };
|
|
145
|
+
} else if (self.parent?.style.flexDirection === 'column-reverse') {
|
|
146
|
+
const stack = self.parent.getBoundingClientRect();
|
|
147
|
+
const maxWidth = parseFloat(self.parent.style.maxWidth) || view.viewW - 24;
|
|
148
|
+
const size = chipSize(self, maxWidth);
|
|
149
|
+
let bottom = stack.bottom;
|
|
150
|
+
for (const child of self.parent.children) {
|
|
151
|
+
if (child === self) break;
|
|
152
|
+
if (child.style.display !== 'none') bottom -= chipSize(child, maxWidth).height + 6;
|
|
153
|
+
}
|
|
154
|
+
r = { left: stack.right - size.width, right: stack.right, top: bottom - size.height, bottom };
|
|
155
|
+
}
|
|
156
|
+
return { ...r, width: r.right - r.left, height: r.bottom - r.top };
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
made.push(self);
|
|
160
|
+
return self;
|
|
161
|
+
}
|
|
162
|
+
const body = node('body');
|
|
163
|
+
globalThis.document = { body, createElement: node, activeElement: null };
|
|
164
|
+
globalThis.window = { innerWidth: view.viewW, innerHeight: view.viewH };
|
|
165
|
+
globalThis.innerWidth = view.viewW;
|
|
166
|
+
return { log, body, made };
|
|
167
|
+
}
|
|
168
|
+
const items = [{ id: 'start', label: 'Start' }, { id: 'sit', label: 'Sit' }, { id: 'watch', label: 'Watch' }];
|
|
169
|
+
const find = (dom, text) => dom.made.findLast((node) => node.textContent === text);
|
|
170
|
+
const tap = (node) => node.handlers.click?.({ stopPropagation() {} });
|
|
171
|
+
let passed = 0;
|
|
172
|
+
function test(name, fn) { fn(); passed += 1; console.log(`ok: ${name}`); }
|
|
173
|
+
async function testAsync(name, fn) { await fn(); passed += 1; console.log(`ok: ${name}`); }
|
|
174
|
+
function rig(width = 360, height = 780) {
|
|
175
|
+
const dom = fakeDom({ viewW: width, viewH: height }), sent = [];
|
|
176
|
+
const chrome = makeChrome({ avatarCount: 4, onBack() {}, onAvatar() {} });
|
|
177
|
+
return { dom, chrome, sent, draw: (value = items, can = true, n = 1) => chrome.setActions(value, (id, n) => sent.push({ k: 'hub-action', id, n }), can, n) };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
test('private messages may precede WORLD; known keyless place ignores and clears them', () => {
|
|
181
|
+
State.clear();
|
|
182
|
+
assert(!Object.hasOwn(State.hub, 'actions'));
|
|
183
|
+
hook.message({}, { k: 'hub-actions', items, n: 1 }); assert.deepEqual(State.hub.actions, { items, n: 1 });
|
|
184
|
+
hook.state({}, { hubPlace: { id: 'main', actions: true } }); assert.deepEqual(State.hub.actions, { items, n: 1 });
|
|
185
|
+
hook.message({}, { k: 'hub-actions', items: null, n: 1 }); assert.deepEqual(State.hub.actions, { items: null, n: 1 });
|
|
186
|
+
hook.message({}, { k: 'hub-actions', items, n: 1 });
|
|
187
|
+
hook.state({}, { hubPlace: { id: 'plain' } }); assert(!Object.hasOwn(State.hub, 'actions'));
|
|
188
|
+
hook.message({}, { k: 'hub-actions', items, n: 1 }); assert(!Object.hasOwn(State.hub, 'actions'));
|
|
189
|
+
State.clear();
|
|
190
|
+
});
|
|
191
|
+
test('chrome is lazy, labels are text, phone targets stack upward and taps echo id and offer version', () => {
|
|
192
|
+
for (const width of [360, 412, 1100]) {
|
|
193
|
+
const r = rig(width), n = r.dom.made.length;
|
|
194
|
+
r.draw(null); assert.equal(r.dom.made.length, n);
|
|
195
|
+
r.draw();
|
|
196
|
+
const buttons = items.map((item) => find(r.dom, item.label));
|
|
197
|
+
assert.equal(buttons[0].parent.style.flexDirection, 'column-reverse');
|
|
198
|
+
for (const node of buttons) {
|
|
199
|
+
assert.equal(node.style.minHeight, '44px');
|
|
200
|
+
assert.equal(node.style.touchAction, 'manipulation');
|
|
201
|
+
tap(node);
|
|
202
|
+
}
|
|
203
|
+
assert.deepEqual(r.sent, items.map(({ id }) => ({ k: 'hub-action', id, n: 1 })));
|
|
204
|
+
const made = r.dom.made.length; r.draw(); assert.equal(r.dom.made.length, made);
|
|
205
|
+
r.draw([{ id: 'literal', label: '<b>Go</b>' }]); assert.equal(find(r.dom, '<b>Go</b>').innerHTML, undefined);
|
|
206
|
+
r.chrome.dispose();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
test('chips clear old listeners on replacement, null, keyless travel and disposal', () => {
|
|
210
|
+
const r = rig(); r.draw(); const old = find(r.dom, 'Start');
|
|
211
|
+
r.draw([{ id: 'new', label: 'New' }]); tap(old); assert.deepEqual(r.sent, []);
|
|
212
|
+
const current = find(r.dom, 'New'); r.draw(null); tap(current); assert.deepEqual(r.sent, []);
|
|
213
|
+
assert(!r.dom.body.children[0].children.includes(current.parent));
|
|
214
|
+
r.draw(); const gone = find(r.dom, 'Start'); r.chrome.clearActions(); tap(gone); assert.deepEqual(r.sent, []);
|
|
215
|
+
r.draw(); const disposed = find(r.dom, 'Start'); r.chrome.dispose(); tap(disposed); assert.deepEqual(r.sent, []);
|
|
216
|
+
});
|
|
217
|
+
test('chips sit above all right-hand chrome; short views use the fallback', () => {
|
|
218
|
+
const r = rig();
|
|
219
|
+
r.chrome.showPicker(true, 0); r.chrome.grabPrompt('Grab'); r.chrome.setEmotes([['wave', '👋']]); r.chrome.setSay({ reactions: [], phrases: [] });
|
|
220
|
+
// Existing controls in a 360 px phone viewport, including a safe-area inset.
|
|
221
|
+
find(r.dom, 'Character').parent.rect = { left: 240, right: 350, top: 706, bottom: 770 };
|
|
222
|
+
find(r.dom, 'Grab').rect = { left: 270, right: 346, top: 624, bottom: 700 };
|
|
223
|
+
const emote = r.dom.made.find((node) => node.attrs['aria-label'] === 'Emote');
|
|
224
|
+
emote.rect = { left: 288, right: 340, top: 550, bottom: 602 };
|
|
225
|
+
const speech = r.dom.made.find((node) => node.style.borderRadius === '26px' && node !== emote && node.tag === 'button');
|
|
226
|
+
assert(speech); speech.rect = { left: 288, right: 340, top: 490, bottom: 542 };
|
|
227
|
+
r.draw();
|
|
228
|
+
const box = find(r.dom, 'Start').parent.getBoundingClientRect();
|
|
229
|
+
assert(box.bottom <= 490 - 12); assert(box.bottom <= 780 - 132);
|
|
230
|
+
r.draw(items, false); assert.equal(find(r.dom, 'Start').parent.style.display, 'none');
|
|
231
|
+
r.draw(); assert.equal(find(r.dom, 'Start').parent.style.display, 'flex');
|
|
232
|
+
emote.handlers.pointerdown({ stopPropagation() {}, preventDefault() {} }); r.draw(); assert.equal(find(r.dom, 'Start').parent.style.display, 'none');
|
|
233
|
+
r.chrome.dispose();
|
|
234
|
+
const short = rig(780, 220); short.draw(); assert.equal(find(short.dom, 'Start').parent.style.display, 'flex'); short.chrome.dispose();
|
|
235
|
+
});
|
|
236
|
+
test('a top-right sound button is an upper bound, never something to stack above', () => {
|
|
237
|
+
const r = rig(360, 780);
|
|
238
|
+
r.chrome.soundControl(true, { volume: 0.5, muted: false });
|
|
239
|
+
const sound = r.dom.made.find((node) => node.dataset.hub === 'sound');
|
|
240
|
+
sound.rect = { left: 308, right: 348, top: 12, bottom: 52 };
|
|
241
|
+
r.chrome.showPicker(true, 0); r.chrome.grabPrompt('Grab');
|
|
242
|
+
find(r.dom, 'Character').parent.rect = { left: 240, right: 350, top: 706, bottom: 770 };
|
|
243
|
+
const grab = find(r.dom, 'Grab'); grab.rect = { left: 270, right: 346, top: 624, bottom: 700 };
|
|
244
|
+
r.draw();
|
|
245
|
+
const stack = find(r.dom, 'Start').parent;
|
|
246
|
+
assert.equal(stack.style.display, 'flex');
|
|
247
|
+
assert(stack.getBoundingClientRect().top >= sound.rect.bottom + 12);
|
|
248
|
+
assert(stack.getBoundingClientRect().bottom <= grab.rect.top - 12);
|
|
249
|
+
// Grab is still a lower bound in the top half; the chips move beside it.
|
|
250
|
+
grab.rect = { left: 270, right: 346, top: 80, bottom: 156 }; r.draw();
|
|
251
|
+
assert.equal(stack.style.display, 'flex');
|
|
252
|
+
assert(stack.getBoundingClientRect().right <= grab.rect.left);
|
|
253
|
+
r.chrome.dispose();
|
|
254
|
+
});
|
|
255
|
+
function phoneRig(height = 475) {
|
|
256
|
+
const r = rig(360, height), shift = height - 475;
|
|
257
|
+
r.chrome.showPicker(true, 0);
|
|
258
|
+
r.chrome.setEmotes([['wave', '👋']]);
|
|
259
|
+
r.chrome.setSay({ reactions: [], phrases: [] });
|
|
260
|
+
r.chrome.setDoors([{ id: 'town', title: 'Town' }]);
|
|
261
|
+
r.chrome.soundControl(true, { volume: 0.5, muted: false });
|
|
262
|
+
const controls = [
|
|
263
|
+
[find(r.dom, 'Character').parent, 246, 427 + shift, 96, 38],
|
|
264
|
+
[r.dom.made.find((node) => node.attrs['aria-label'] === 'Emote'), 280, 276 + shift, 52, 52],
|
|
265
|
+
[r.dom.made.find((node) => node.attrs['aria-label'] === 'Quick chat'), 280, 216 + shift, 52, 52],
|
|
266
|
+
[find(r.dom, 'Doors'), 10, 427 + shift, 70, 38],
|
|
267
|
+
[r.dom.made.find((node) => node.dataset.hub === 'sound'), 300, 12, 40, 40],
|
|
268
|
+
];
|
|
269
|
+
for (const [node, x, y, w, h] of controls) node.rect = { left: x, right: x + w, top: y, bottom: y + h };
|
|
270
|
+
find(r.dom, 'Doors').parent.rect = find(r.dom, 'Doors').rect;
|
|
271
|
+
r.controls = controls.map(([node]) => node);
|
|
272
|
+
return r;
|
|
273
|
+
}
|
|
274
|
+
function assertClearChips(r, offered) {
|
|
275
|
+
const stack = find(r.dom, offered[0].label).parent;
|
|
276
|
+
assert.equal(stack.style.display, 'flex');
|
|
277
|
+
const shown = offered.map(({ label }) => find(r.dom, label)).filter((node) => node.style.display !== 'none');
|
|
278
|
+
assert(shown.includes(find(r.dom, offered[0].label)), 'first offer remains shown');
|
|
279
|
+
for (const chip of shown) {
|
|
280
|
+
const box = chip.getBoundingClientRect();
|
|
281
|
+
assert(box.left >= 12 && box.right <= window.innerWidth - 12 && box.top >= 12 && box.bottom <= window.innerHeight - 12, 'chip stays inside view margins');
|
|
282
|
+
for (const node of r.controls) {
|
|
283
|
+
const control = node.getBoundingClientRect();
|
|
284
|
+
assert(!(box.left < control.right && box.right > control.left && box.top < control.bottom && box.bottom > control.top), `chip overlaps ${node.textContent || node.id}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return shown;
|
|
288
|
+
}
|
|
289
|
+
const carrot = [{ id: 'pick', label: 'Pick Carrot' }];
|
|
290
|
+
test('360 x 475 phone shows Pick Carrot inside the frame and clear of every control', () => {
|
|
291
|
+
const r = phoneRig(); r.draw(carrot);
|
|
292
|
+
const [chip] = assertClearChips(r, carrot);
|
|
293
|
+
assert.deepEqual(chip.getBoundingClientRect(), { left: 231, right: 348, top: 160, bottom: 204, width: 117, height: 44 });
|
|
294
|
+
r.chrome.dispose();
|
|
295
|
+
});
|
|
296
|
+
test('360 x 475 phone moves three chips to the second position without control overlaps', () => {
|
|
297
|
+
const r = phoneRig(); r.draw();
|
|
298
|
+
assert.equal(assertClearChips(r, items).length, 3);
|
|
299
|
+
assert.equal(find(r.dom, 'Start').parent.style.right, '92px');
|
|
300
|
+
r.chrome.dispose();
|
|
301
|
+
});
|
|
302
|
+
test('360 x 780 phone keeps the right column', () => {
|
|
303
|
+
const r = phoneRig(780); r.draw();
|
|
304
|
+
assert.equal(assertClearChips(r, items).length, 3);
|
|
305
|
+
assert.equal(find(r.dom, 'Start').parent.style.right, '12px');
|
|
306
|
+
r.chrome.dispose();
|
|
307
|
+
});
|
|
308
|
+
test('second position trims only top chips, restores them, and yields only if one cannot fit', () => {
|
|
309
|
+
const r = phoneRig();
|
|
310
|
+
r.chrome.setHud({ title: 'Harvest', text: 'Pick a carrot' }, null);
|
|
311
|
+
const hud = find(r.dom, 'Harvest').parent;
|
|
312
|
+
hud.rect = { left: 30, right: 290, top: 12, bottom: 310 };
|
|
313
|
+
r.controls.push(hud);
|
|
314
|
+
r.draw();
|
|
315
|
+
const chips = items.map(({ label }) => find(r.dom, label));
|
|
316
|
+
assert.equal(assertClearChips(r, items).length, 1);
|
|
317
|
+
assert.equal(chips[1].style.display, 'none'); assert.equal(chips[2].style.display, 'none');
|
|
318
|
+
// Each frame retries the full offer, even when items and n have not changed.
|
|
319
|
+
hud.rect.bottom = 40; r.draw(); assert.equal(assertClearChips(r, items).length, 3);
|
|
320
|
+
hud.rect.bottom = 410; r.draw(); assert.equal(chips[0].parent.style.display, 'none');
|
|
321
|
+
r.chrome.dispose();
|
|
322
|
+
});
|
|
323
|
+
test('shown decor bounds chips; hidden decor does not', () => {
|
|
324
|
+
const r = phoneRig();
|
|
325
|
+
const decorLayer = document.createElement('div'); decorLayer.style.zIndex = '3';
|
|
326
|
+
r.chrome.decorRoot().appendChild(decorLayer);
|
|
327
|
+
const decor = document.createElement('button'); decorLayer.appendChild(decor);
|
|
328
|
+
decor.rect = { left: 220, right: 348, top: 150, bottom: 194 };
|
|
329
|
+
r.controls.push(decor);
|
|
330
|
+
const wide = [{ id: 'wide', label: 'abcdefghijklmnop' }, ...items.slice(0, 2)];
|
|
331
|
+
r.draw(wide); assert.equal(assertClearChips(r, wide).length, 2);
|
|
332
|
+
assert(find(r.dom, wide[0].label).getBoundingClientRect().bottom <= decor.rect.top - 12);
|
|
333
|
+
decorLayer.style.display = 'none'; r.controls = r.controls.filter((node) => node !== decor);
|
|
334
|
+
r.draw(wide); assert.equal(assertClearChips(r, wide).length, 3);
|
|
335
|
+
r.chrome.dispose();
|
|
336
|
+
});
|
|
337
|
+
test('fallback measures wrapped chips and respects ask and Back upper bounds', () => {
|
|
338
|
+
const r = rig(240, 475);
|
|
339
|
+
r.chrome.grabPrompt('Grab');
|
|
340
|
+
const grab = find(r.dom, 'Grab'); grab.rect = { left: 150, right: 226, top: 80, bottom: 156 };
|
|
341
|
+
r.chrome.setAsk({ key: 'ask', text: 'Choose', yes: 'Yes', no: 'No' });
|
|
342
|
+
const ask = find(r.dom, 'Choose').parent; ask.rect = { left: 12, right: 140, top: 92, bottom: 340 };
|
|
343
|
+
r.chrome.showBack(true);
|
|
344
|
+
const back = find(r.dom, '‹ Back'); back.rect = { left: 12, right: 100, top: 12, bottom: 50 };
|
|
345
|
+
r.controls = [grab, ask, back];
|
|
346
|
+
const wide = [{ id: 'wide', label: 'abcdefghijklmnop' }, ...items.slice(0, 2)];
|
|
347
|
+
r.draw(wide); const [chip] = assertClearChips(r, wide);
|
|
348
|
+
assert.equal(assertClearChips(r, wide).length, 1);
|
|
349
|
+
assert.equal(chip.getBoundingClientRect().width, 126);
|
|
350
|
+
assert.equal(chip.getBoundingClientRect().height, 64);
|
|
351
|
+
assert(chip.getBoundingClientRect().top >= ask.rect.bottom + 12);
|
|
352
|
+
ask.rect.bottom = 430; r.draw(wide); assert.equal(chip.parent.style.display, 'none');
|
|
353
|
+
r.chrome.setAsk(null); r.controls = [grab, back];
|
|
354
|
+
r.draw(wide); assert.equal(assertClearChips(r, wide).length, 3);
|
|
355
|
+
back.rect.bottom = 430; r.draw(wide); assert.equal(chip.parent.style.display, 'none');
|
|
356
|
+
r.chrome.dispose();
|
|
357
|
+
});
|
|
358
|
+
test('640 x 300 fallback clears the measured left edge of the round column', () => {
|
|
359
|
+
const r = rig(640, 300);
|
|
360
|
+
r.chrome.showPicker(true, 0); r.chrome.setEmotes([['wave', '👋']]); r.chrome.setSay({ reactions: [], phrases: [] });
|
|
361
|
+
const picker = find(r.dom, 'Character').parent;
|
|
362
|
+
const speech = r.dom.made.find((node) => node.attrs['aria-label'] === 'Quick chat');
|
|
363
|
+
const emote = r.dom.made.find((node) => node.attrs['aria-label'] === 'Emote');
|
|
364
|
+
picker.rect = { left: 526, right: 622, top: 252, bottom: 290 };
|
|
365
|
+
speech.rect = { left: 560, right: 612, top: 41, bottom: 93 };
|
|
366
|
+
emote.rect = { left: 560, right: 612, top: 101, bottom: 153 };
|
|
367
|
+
r.controls = [picker, speech, emote];
|
|
368
|
+
r.draw(carrot); const [chip] = assertClearChips(r, carrot);
|
|
369
|
+
assert.deepEqual(chip.getBoundingClientRect(), { left: 431, right: 548, top: 196, bottom: 240, width: 117, height: 44 });
|
|
370
|
+
assert(chip.getBoundingClientRect().right <= speech.rect.left - 12);
|
|
371
|
+
r.chrome.dispose();
|
|
372
|
+
});
|
|
373
|
+
test('640 x 300 fallback remeasures wrapping in its narrower candidate on the first frame', () => {
|
|
374
|
+
const r = rig(640, 300), wide = [{ id: 'wide', label: 'W'.repeat(73) }];
|
|
375
|
+
r.draw(wide);
|
|
376
|
+
const chip = find(r.dom, wide[0].label);
|
|
377
|
+
assert.equal(chip.getBoundingClientRect().width, 551);
|
|
378
|
+
r.chrome.setHud({ title: 'Town' }, null);
|
|
379
|
+
const hud = find(r.dom, 'Town').parent;
|
|
380
|
+
hud.rect = { left: 12, right: 400, top: 12, bottom: 100 };
|
|
381
|
+
r.chrome.setEmotes([['wave', '👋']]);
|
|
382
|
+
const emote = r.dom.made.find((node) => node.attrs['aria-label'] === 'Emote');
|
|
383
|
+
emote.rect = { left: 500, right: 552, top: 100, bottom: 152 };
|
|
384
|
+
r.controls = [hud, emote];
|
|
385
|
+
for (let frame = 0; frame < 8; frame += 1) {
|
|
386
|
+
r.chrome.beginLayoutFrame();
|
|
387
|
+
r.draw(wide);
|
|
388
|
+
assert.equal(assertClearChips(r, wide).length, 1, `frame ${frame}: the wrapped action is visible immediately`);
|
|
389
|
+
assert.deepEqual(chip.getBoundingClientRect(), { left: 12, right: 488, top: 224, bottom: 288, width: 476, height: 64 });
|
|
390
|
+
r.chrome.endLayoutFrame();
|
|
391
|
+
}
|
|
392
|
+
r.chrome.dispose();
|
|
393
|
+
});
|
|
394
|
+
test('640 x 300 trimming retries the right column when Start alone clears HUD and decor', () => {
|
|
395
|
+
const r = rig(640, 300);
|
|
396
|
+
r.chrome.setHud({ title: 'Harvest' }, null); r.chrome.showPicker(true, 0); r.chrome.setEmotes([['wave', '👋']]);
|
|
397
|
+
const hud = find(r.dom, 'Harvest').parent, picker = find(r.dom, 'Character').parent;
|
|
398
|
+
const emote = r.dom.made.find((node) => node.attrs['aria-label'] === 'Emote');
|
|
399
|
+
hud.rect = { left: 96, right: 544, top: 12, bottom: 140 };
|
|
400
|
+
emote.rect = { left: 568, right: 620, top: 102, bottom: 154 };
|
|
401
|
+
picker.rect = { left: 534, right: 630, top: 252, bottom: 290 };
|
|
402
|
+
const layer = document.createElement('div'); layer.style.zIndex = '3'; r.chrome.decorRoot().appendChild(layer);
|
|
403
|
+
const decor = document.createElement('button'); layer.appendChild(decor);
|
|
404
|
+
decor.rect = { left: 468, right: 628, top: 180, bottom: 224 };
|
|
405
|
+
r.controls = [hud, emote, picker, decor];
|
|
406
|
+
const offered = [items[0], { id: 'wide', label: 'abcdefghijklmnop' }, items[2]];
|
|
407
|
+
r.draw(offered); const [chip] = assertClearChips(r, offered);
|
|
408
|
+
assert.equal(assertClearChips(r, offered).length, 1);
|
|
409
|
+
assert.deepEqual(chip.getBoundingClientRect(), { left: 553, right: 628, top: 46, bottom: 90, width: 75, height: 44 });
|
|
410
|
+
assert.equal(chip.parent.style.right, '12px');
|
|
411
|
+
r.chrome.dispose();
|
|
412
|
+
});
|
|
413
|
+
test('open Sound card bounds every shown chip, including after trimming', () => {
|
|
414
|
+
const r = phoneRig();
|
|
415
|
+
const sound = r.dom.made.find((node) => node.dataset.hub === 'sound');
|
|
416
|
+
sound.handlers.pointerdown({ stopPropagation() {}, preventDefault() {} });
|
|
417
|
+
const card = r.dom.made.find((node) => node.dataset.hub === 'sound-card');
|
|
418
|
+
assert.equal(card.style.display, 'flex');
|
|
419
|
+
card.rect = { left: 140, right: 348, top: 58, bottom: 106 }; r.controls.push(card);
|
|
420
|
+
r.draw(); assertClearChips(r, items);
|
|
421
|
+
// Force the stack into the card's vertical span unless it trims.
|
|
422
|
+
const picker = find(r.dom, 'Character').parent;
|
|
423
|
+
picker.rect = { left: 246, right: 342, top: 174, bottom: 212 };
|
|
424
|
+
r.draw(); const [chip] = assertClearChips(r, items);
|
|
425
|
+
assert.equal(assertClearChips(r, items).length, 1);
|
|
426
|
+
assert(chip.getBoundingClientRect().top >= card.rect.bottom + 12);
|
|
427
|
+
r.chrome.dispose();
|
|
428
|
+
});
|
|
429
|
+
test('duplicate items and n keep DOM; version-only changes echo the new n', () => {
|
|
430
|
+
const r = rig(); State.clear(); State.hub.place = { actions: true };
|
|
431
|
+
const receive = (n) => {
|
|
432
|
+
hook.message({}, { k: 'hub-actions', items: structuredClone(items), n });
|
|
433
|
+
r.draw(State.hub.actions.items, true, State.hub.actions.n);
|
|
434
|
+
};
|
|
435
|
+
receive(7); const node = find(r.dom, 'Start'), count = r.dom.made.length;
|
|
436
|
+
for (let i = 0; i < 100; i++) receive(7);
|
|
437
|
+
assert.equal(r.dom.made.length, count); assert.equal(find(r.dom, 'Start'), node);
|
|
438
|
+
tap(node); assert.deepEqual(r.sent, [{ k: 'hub-action', id: 'start', n: 7 }]);
|
|
439
|
+
receive(8); tap(node); tap(find(r.dom, 'Start'));
|
|
440
|
+
assert.deepEqual(r.sent.at(-1), { k: 'hub-action', id: 'start', n: 8 }); assert.equal(r.sent.length, 2);
|
|
441
|
+
r.chrome.dispose(); State.clear();
|
|
442
|
+
});
|
|
443
|
+
test('pointer presses leave no focus; focused chips contain Space/Enter down/up and blur on click', () => {
|
|
444
|
+
const r = rig(); r.draw(); const chip = find(r.dom, 'Start');
|
|
445
|
+
assert.equal(chip.tabIndex, -1);
|
|
446
|
+
const event = (code) => ({ code, stopped: false, prevented: false, stopPropagation() { this.stopped = true; }, preventDefault() { this.prevented = true; } });
|
|
447
|
+
for (const type of ['pointerdown', 'mousedown']) {
|
|
448
|
+
const e = event(); chip.handlers[type](e);
|
|
449
|
+
if (!e.prevented) chip.focus();
|
|
450
|
+
assert(e.prevented); assert(e.stopped); assert.equal(document.activeElement, null);
|
|
451
|
+
}
|
|
452
|
+
let gameKeys = 0;
|
|
453
|
+
chip.focus();
|
|
454
|
+
for (const code of ['Space', 'Enter']) {
|
|
455
|
+
for (const type of ['keydown', 'keyup']) {
|
|
456
|
+
const e = event(code); chip.handlers[type](e);
|
|
457
|
+
if (!e.stopped) gameKeys += 1;
|
|
458
|
+
if (!e.prevented) tap(chip);
|
|
459
|
+
assert(e.stopped); assert(e.prevented);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
assert.equal(gameKeys, 0); assert.deepEqual(r.sent, []);
|
|
463
|
+
tap(chip); assert.equal(document.activeElement, null);
|
|
464
|
+
assert.deepEqual(r.sent, [{ k: 'hub-action', id: 'start', n: 1 }]);
|
|
465
|
+
r.chrome.dispose();
|
|
466
|
+
});
|
|
467
|
+
await testAsync('opt-in overflow keeps all offers in one reusable sheet, current by id and version', async () => {
|
|
468
|
+
const r = rig(509, 218), opened = [];
|
|
469
|
+
r.chrome.showBack(true);
|
|
470
|
+
const back = find(r.dom, '‹ Back');
|
|
471
|
+
// Leave only one launcher-sized slot at the right edge. The measured rail
|
|
472
|
+
// must not trim an offer merely because no direct row clears this obstacle.
|
|
473
|
+
back.rect = { left: 0, right: 380, top: 0, bottom: 218 };
|
|
474
|
+
const long = [
|
|
475
|
+
{ id: 'reset', label: 'Reset ball right now' },
|
|
476
|
+
{ id: 'practice', label: 'Start practice together' },
|
|
477
|
+
{ id: 'watch', label: 'Watch from the rail' },
|
|
478
|
+
];
|
|
479
|
+
const draw = (value = long, n = 41) => r.chrome.setActions(value, (id, version) => r.sent.push({ id, n: version }), true, n, true, (open) => opened.push(open));
|
|
480
|
+
draw();
|
|
481
|
+
const launcher = find(r.dom, 'Actions (3)');
|
|
482
|
+
assert(launcher); assert.equal(launcher.style.display, 'block'); assert.equal(launcher.tabIndex, 0);
|
|
483
|
+
tap(launcher);
|
|
484
|
+
const backdrop = r.dom.made.find((node) => node.dataset.hub === 'action-backdrop');
|
|
485
|
+
assert.equal(backdrop.style.background, '#14100c', 'open actions fully obscure underlying HUD and world labels');
|
|
486
|
+
const sheet = r.dom.made.find((node) => node.dataset.hub === 'action-sheet');
|
|
487
|
+
assert(sheet); assert.equal(r.chrome.actionOverflowOpen(), true); assert.equal(launcher.tabIndex, -1);
|
|
488
|
+
const original = find(r.dom, 'Start practice together');
|
|
489
|
+
assert.equal(original.parent, sheet);
|
|
490
|
+
original.focus();
|
|
491
|
+
const changed = [
|
|
492
|
+
{ id: 'reset', label: 'Reset again' },
|
|
493
|
+
{ id: 'practice', label: 'Continue practice' },
|
|
494
|
+
{ id: 'leave', label: 'Leave' },
|
|
495
|
+
];
|
|
496
|
+
tap(original);
|
|
497
|
+
draw(changed, 42);
|
|
498
|
+
assert.deepEqual(r.sent, [{ id: 'practice', n: 41 }]);
|
|
499
|
+
assert.equal(find(r.dom, 'Continue practice'), original, 'offer node is reused by id');
|
|
500
|
+
assert.equal(document.activeElement, original, 'focus stays on a retained id');
|
|
501
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
502
|
+
assert.equal(r.chrome.actionOverflowOpen(), true, 'an old pressed timer cannot close a changed sheet');
|
|
503
|
+
tap(original); tap(original);
|
|
504
|
+
assert.deepEqual(r.sent.at(-1), { id: 'practice', n: 42 });
|
|
505
|
+
assert.equal(r.sent.length, 2, 'double activation while pressed dispatches once');
|
|
506
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
507
|
+
assert.equal(r.chrome.actionOverflowOpen(), false);
|
|
508
|
+
assert.deepEqual(opened, [true, false]);
|
|
509
|
+
r.chrome.dispose();
|
|
510
|
+
});
|
|
511
|
+
test('sheet close relays out after an obstacle clears and restores absolute offer placement', () => {
|
|
512
|
+
const r = rig(509, 218);
|
|
513
|
+
r.chrome.showBack(true);
|
|
514
|
+
const back = find(r.dom, '‹ Back');
|
|
515
|
+
back.rect = { left: 0, right: 380, top: 0, bottom: 218 };
|
|
516
|
+
const offered = [
|
|
517
|
+
{ id: 'a', label: 'A' },
|
|
518
|
+
{ id: 'b', label: 'B' },
|
|
519
|
+
{ id: 'c', label: 'C' },
|
|
520
|
+
];
|
|
521
|
+
r.chrome.setActions(offered, () => {}, true, 4, true);
|
|
522
|
+
tap(find(r.dom, 'Actions (3)'));
|
|
523
|
+
back.rect = null;
|
|
524
|
+
r.chrome.cancelActionOverflow();
|
|
525
|
+
const rail = r.dom.made.find((node) => node.dataset.hub === 'action-rail');
|
|
526
|
+
const shown = offered.map(({ id }) => rail.children.find((node) => node.dataset.actionId === id));
|
|
527
|
+
assert(shown.every((button) => button.style.display === 'block'));
|
|
528
|
+
assert(shown.every((button) => button.style.position === 'absolute'));
|
|
529
|
+
r.chrome.dispose();
|
|
530
|
+
});
|
|
531
|
+
test('retained rail offers follow changed server order without replacing or blurring them', () => {
|
|
532
|
+
const r = rig(844, 390);
|
|
533
|
+
r.chrome.showBack(true);
|
|
534
|
+
const back = find(r.dom, '‹ Back');
|
|
535
|
+
back.rect = { left: 0, right: 64, top: 0, bottom: 56 };
|
|
536
|
+
const offered = [
|
|
537
|
+
{ id: 'a', label: 'Alpha' },
|
|
538
|
+
{ id: 'b', label: 'Beta' },
|
|
539
|
+
{ id: 'c', label: 'Gamma' },
|
|
540
|
+
];
|
|
541
|
+
r.chrome.setActions(offered, () => {}, true, 5, true);
|
|
542
|
+
const rail = r.dom.made.find((node) => node.dataset.hub === 'action-rail');
|
|
543
|
+
const beta = rail.children.find((node) => node.dataset.actionId === 'b');
|
|
544
|
+
beta.focus();
|
|
545
|
+
r.chrome.setActions([...offered].reverse(), () => {}, true, 6, true);
|
|
546
|
+
assert.deepEqual(rail.children.filter((node) => node.dataset.actionId).map((node) => node.dataset.actionId), ['c', 'b', 'a']);
|
|
547
|
+
assert.equal(rail.children.find((node) => node.dataset.actionId === 'b'), beta);
|
|
548
|
+
assert.equal(document.activeElement, beta);
|
|
549
|
+
r.chrome.setActions([offered[2], offered[0]], () => {}, true, 7, true);
|
|
550
|
+
assert.equal(document.activeElement, back, 'a removed focused offer restores a safe current control');
|
|
551
|
+
r.chrome.dispose();
|
|
552
|
+
});
|
|
553
|
+
test('empty overflow offer closes the sheet, removes its nodes and restores a safe control', () => {
|
|
554
|
+
const r = rig(509, 218), opened = [];
|
|
555
|
+
r.chrome.showBack(true);
|
|
556
|
+
const back = find(r.dom, '‹ Back'); back.rect = { left: 0, right: 380, top: 0, bottom: 218 };
|
|
557
|
+
const offered = [
|
|
558
|
+
{ id: 'left', label: 'Shoot left side' },
|
|
559
|
+
{ id: 'right', label: 'Shoot right side' },
|
|
560
|
+
{ id: 'reset', label: 'Reset the ball' },
|
|
561
|
+
];
|
|
562
|
+
r.chrome.setActions(offered, () => {}, true, 7, true, (open) => opened.push(open));
|
|
563
|
+
tap(find(r.dom, 'Actions (3)'));
|
|
564
|
+
assert.equal(r.chrome.actionOverflowOpen(), true);
|
|
565
|
+
r.chrome.setActions([], () => {}, true, 8, true, (open) => opened.push(open));
|
|
566
|
+
assert.equal(r.chrome.actionOverflowOpen(), false);
|
|
567
|
+
assert.equal(r.dom.made.findLast((node) => node.dataset.hub === 'action-backdrop').parent, null);
|
|
568
|
+
assert.equal(document.activeElement, back);
|
|
569
|
+
assert.deepEqual(opened, [true, false]);
|
|
570
|
+
r.chrome.dispose();
|
|
571
|
+
});
|
|
572
|
+
test('omitted and false overflow markers produce identical legacy action DOM', () => {
|
|
573
|
+
const snapshot = (flag) => {
|
|
574
|
+
const r = rig(352, 526);
|
|
575
|
+
if (flag === undefined) {r.chrome.setActions(items, () => {}, true, 9);}
|
|
576
|
+
else {r.chrome.setActions(items, () => {}, true, 9, flag);}
|
|
577
|
+
const created = r.dom.made.slice(-4).map((node) => ({
|
|
578
|
+
tag: node.tag,
|
|
579
|
+
text: node.textContent,
|
|
580
|
+
styles: { ...node.styles },
|
|
581
|
+
tabIndex: node.tabIndex,
|
|
582
|
+
handlers: Object.keys(node.handlers).sort(),
|
|
583
|
+
hub: node.dataset.hub ?? null,
|
|
584
|
+
}));
|
|
585
|
+
r.chrome.dispose();
|
|
586
|
+
return created;
|
|
587
|
+
};
|
|
588
|
+
assert.deepEqual(snapshot(), snapshot(false));
|
|
589
|
+
});
|
|
590
|
+
test('frame wiring only draws in opted-in places and clears once on keyless travel', () => {
|
|
591
|
+
State.clear(); fakeDom({ viewW: 360, viewH: 780 });
|
|
592
|
+
let system; installSystem({ registerSystem(value) { system = value; } });
|
|
593
|
+
const calls = [], sent = [];
|
|
594
|
+
system.chrome = new Proxy({ peopleOpen: () => false, chatFocused: () => false, padOccupancyControls: () => [] }, { get(target, name) { return target[name] ?? ((...args) => calls.push([name, ...args])); } });
|
|
595
|
+
system.talk = { frame() {}, talking: () => false, typing: () => false, talkingWith: () => null };
|
|
596
|
+
system.idle = { frame() {}, draw() {}, labels: () => [] };
|
|
597
|
+
system.grab = { frame() {} }; system.sound = { frame() {} }; system.sayHooked = true;
|
|
598
|
+
system.together.frame = () => {};
|
|
599
|
+
for (const method of ['keepResident', 'wearAvatar', 'applyTune', 'watchSession', 'sayHello', 'followPlace', 'holdFall', 'turnSpinners', 'applySpawns', 'applyTints', 'registerInterest', 'applyVisibility', 'applyWear', 'adoptLate', 'runCommands', 'askFriends', 'stepEnd', 'faceArrival', 'measure']) system[method] = () => {};
|
|
600
|
+
system.sceneKey = 'main';
|
|
601
|
+
const scene = { sceneKey: 'main', currentScenePath: 'scenes/main.scene', multiplayer: { net: { selfId: () => 'p1', send: (msg) => sent.push(msg) } }, actorWith: () => null, persistent: { hubTickets: [], hubAvatar: 0 }, getActors: () => [] };
|
|
602
|
+
hook.message({}, { k: 'hub-actions', items, n: 1 });
|
|
603
|
+
assert.equal(State.hub.place, null);
|
|
604
|
+
system.afterBehaviors(scene, 0.05);
|
|
605
|
+
assert(!calls.some(([name]) => name === 'setActions' || name === 'clearActions'), 'buffered offers do not draw before WORLD');
|
|
606
|
+
assert(!Object.hasOwn(system, 'actionsDrawn'));
|
|
607
|
+
system.fadeNames(scene);
|
|
608
|
+
assert(!Object.hasOwn(system, 'crowdNamesHeld') && !Object.hasOwn(system, 'crowdFrame') && !Object.hasOwn(system, 'crowdHidden'), 'absent crowd flag allocates no collision or ranking state');
|
|
609
|
+
scene.data = { engine: { hubCrowdNames: false } };
|
|
610
|
+
system.fadeNames(scene);
|
|
611
|
+
assert(!Object.hasOwn(system, 'crowdNamesHeld') && !Object.hasOwn(system, 'crowdFrame') && !Object.hasOwn(system, 'crowdHidden'), 'false crowd flag stays the absent path');
|
|
612
|
+
let cameraUpdates = 0;
|
|
613
|
+
const camera = {
|
|
614
|
+
parent: null,
|
|
615
|
+
matrixWorldAutoUpdate: true,
|
|
616
|
+
updateMatrixWorld() {
|
|
617
|
+
assert(!Object.hasOwn(system, 'crowdFrame'), 'E updates the root camera before capturing shared projection geometry');
|
|
618
|
+
cameraUpdates += 1;
|
|
619
|
+
},
|
|
620
|
+
};
|
|
621
|
+
scene.three = { camera };
|
|
622
|
+
scene.data.engine.hubCrowdNames = true;
|
|
623
|
+
system.afterBehaviors(scene, 0.05);
|
|
624
|
+
assert.equal(cameraUpdates, 1, 'E mirrors the renderer root-camera update once');
|
|
625
|
+
assert.equal(system.crowdFrame.camera, camera, 'the synchronized camera is captured for the late pass');
|
|
626
|
+
scene.data.engine.hubCrowdNames = false;
|
|
627
|
+
system.afterBehaviors(scene, 0.05);
|
|
628
|
+
assert.equal(cameraUpdates, 1, 'OFF does no camera synchronization work');
|
|
629
|
+
system.fadeNames(scene);
|
|
630
|
+
delete scene.three;
|
|
631
|
+
hook.state({}, { hubPlace: { id: 'main', title: 'Town', scene: 'scenes/main.scene', result: null } });
|
|
632
|
+
assert(!Object.hasOwn(State.hub, 'actions'));
|
|
633
|
+
system.afterBehaviors(scene, 0.05);
|
|
634
|
+
assert(!calls.some(([name]) => name === 'setActions' || name === 'clearActions'));
|
|
635
|
+
assert(!Object.hasOwn(system, 'actionsDrawn'));
|
|
636
|
+
State.hub.place.actions = true; State.hub.actions = { items, n: 1 };
|
|
637
|
+
system.afterBehaviors(scene, 0.05);
|
|
638
|
+
const draw = calls.findLast(([name]) => name === 'setActions');
|
|
639
|
+
assert.deepEqual(draw[1], items); assert.equal(draw[3], true);
|
|
640
|
+
assert.equal(draw[4], 1); assert.equal(draw[5], true, 'portrait uses compact overflow without an authored flag');
|
|
641
|
+
window.innerWidth = 844; window.innerHeight = 390;
|
|
642
|
+
system.afterBehaviors(scene, 0.05);
|
|
643
|
+
assert.equal(calls.findLast(([name]) => name === 'setActions')[5], false, 'landscape retains the authored overflow choice');
|
|
644
|
+
draw[2]('start', draw[4]); assert.deepEqual(sent, [{ k: 'hub-action', id: 'start', n: 1 }]);
|
|
645
|
+
scene.data = { engine: { hubActionOverflow: true } };
|
|
646
|
+
system.afterBehaviors(scene, 0.05);
|
|
647
|
+
const opted = calls.findLast(([name]) => name === 'setActions');
|
|
648
|
+
assert.equal(opted[5], true);
|
|
649
|
+
opted[6](true); assert(system.actionInput);
|
|
650
|
+
let travelled = 0;
|
|
651
|
+
system.chrome.actionOverflowOpen = () => true;
|
|
652
|
+
system.chrome.cancelActionOverflow = () => opted[6](false);
|
|
653
|
+
system.back = () => {travelled += 1;};
|
|
654
|
+
system.backFromControl(scene);
|
|
655
|
+
assert(!system.actionInput, 'platform Back releases the held controls when it dismisses actions');
|
|
656
|
+
assert.equal(travelled, 0, 'platform Back is consumed by the action sheet');
|
|
657
|
+
hook.state({}, { hubPlace: { id: 'main' } }); system.afterBehaviors(scene, 0.05);
|
|
658
|
+
assert.equal(calls.filter(([name]) => name === 'clearActions').length, 1);
|
|
659
|
+
system.afterBehaviors(scene, 0.05);
|
|
660
|
+
assert.equal(calls.filter(([name]) => name === 'clearActions').length, 1);
|
|
661
|
+
assert(!Object.hasOwn(system, 'actionsDrawn'));
|
|
662
|
+
});
|
|
663
|
+
test('opted-in late crowd pass uses current renderer eligibility and restores OFF', () => {
|
|
664
|
+
State.clear();
|
|
665
|
+
State.hub.place = { id: 'main', result: null };
|
|
666
|
+
for (const id of ['a', 'b', 'c']) {State.hub.avatars.set(id, 0);}
|
|
667
|
+
let system; installSystem({ registerSystem(value) { system = value; } });
|
|
668
|
+
const labels = [];
|
|
669
|
+
let ordinaryLabelWrites = 0;
|
|
670
|
+
system.chrome = {
|
|
671
|
+
crowdNameLabelBoxes: () => [],
|
|
672
|
+
measureLabel: (text) => ({ w: text.length * 7 + 20, h: 24 }),
|
|
673
|
+
setLabels: (items) => {ordinaryLabelWrites += 1; labels.splice(0, labels.length, ...items);},
|
|
674
|
+
setCrowdNameSummary: (item) => {
|
|
675
|
+
const ordinary = labels.filter((label) => label.id !== 'crowd:summary');
|
|
676
|
+
labels.splice(0, labels.length, ...ordinary, ...(item ? [item] : []));
|
|
677
|
+
},
|
|
678
|
+
};
|
|
679
|
+
const view = { w: 844, h: 390 };
|
|
680
|
+
const camera = {
|
|
681
|
+
matrixWorld: { elements: [1, 0, 0, 0, 0, 1, 0, 0] },
|
|
682
|
+
position: {
|
|
683
|
+
clone() {
|
|
684
|
+
return {
|
|
685
|
+
set(x, y, z) {this.x = x; this.y = y; this.z = z; return this;},
|
|
686
|
+
project() {
|
|
687
|
+
this.x = ((100 + this.x * 200) / view.w) * 2 - 1;
|
|
688
|
+
this.y = 1 - ((330 - this.y * 120) / view.h) * 2;
|
|
689
|
+
this.z = 0;
|
|
690
|
+
return this;
|
|
691
|
+
},
|
|
692
|
+
};
|
|
693
|
+
},
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
const sprite = (x) => ({
|
|
697
|
+
position: { x, y: 2, z: 0 },
|
|
698
|
+
scale: { x: 0.3, y: 0.16 },
|
|
699
|
+
material: { opacity: 1 },
|
|
700
|
+
visible: true,
|
|
701
|
+
});
|
|
702
|
+
const tags = new Map(['c', 'b', 'a'].map((id, index) => [id, { sprite: sprite((2 - index) * 0.4) }]));
|
|
703
|
+
const actors = new Map(['a', 'b', 'c'].map((id) => [id, `actor:${id}`]));
|
|
704
|
+
const transforms = new Map([['a', 0], ['b', 0.4], ['c', 0.8]].map(([id, x]) => [`actor:${id}`, { x, y: 0, z: 0 }]));
|
|
705
|
+
const roster = new Map([['a', 'same'], ['b', 'same'], ['c', 'same']]);
|
|
706
|
+
let netState = 'connected';
|
|
707
|
+
const net = { others: () => roster, userId: (id) => `u${id}`, status: () => netState === null ? undefined : { state: netState } };
|
|
708
|
+
const local = { components: { Transform: { x: 0, y: 0, z: 0 } } };
|
|
709
|
+
const scene = {
|
|
710
|
+
data: { engine: { hubCrowdNames: true } },
|
|
711
|
+
multiplayer: { net, avatars: { tags, actors } },
|
|
712
|
+
three: { camera },
|
|
713
|
+
actorWith: () => local,
|
|
714
|
+
getActor: (id) => ({ components: { Transform: transforms.get(id) } }),
|
|
715
|
+
};
|
|
716
|
+
system.friendsAll = [{ userId: 'uc' }];
|
|
717
|
+
system.helloMark = { selfId: 'self', again: 0 };
|
|
718
|
+
system.crowdFrame = { scene, data: scene.data, net, camera, local: local.components.Transform, own: null, controls: [], view, labels: [] };
|
|
719
|
+
system.fadeNames(scene);
|
|
720
|
+
assert.equal(tags.get('c').sprite.visible, true, 'current friend has first priority');
|
|
721
|
+
assert.equal([...tags.values()].filter((tag) => tag.sprite.visible).length, 2);
|
|
722
|
+
const eScale = system.crowdNameScales.get(tags.get('a').sprite);
|
|
723
|
+
assert.ok(eScale && eScale.scaledY > eScale.y, 'E raises a too-small projected font before collision');
|
|
724
|
+
assert.ok(Math.abs(eScale.scaledY * 120 * 44 / 68 - 15) < 1e-9, 'the final projected font meets the 15 CSS pixel floor');
|
|
725
|
+
assert.equal(labels.at(-1).text, '+1 more');
|
|
726
|
+
assert.equal(ordinaryLabelWrites, 0, 'late crowd pass does not reset already-cleared ordinary labels');
|
|
727
|
+
const firstVisit = system.crowdNamesHeld.state;
|
|
728
|
+
system.helloMark = { selfId: 'self', again: 1 };
|
|
729
|
+
system.fadeNames(scene);
|
|
730
|
+
assert.notEqual(system.crowdNamesHeld.state, firstVisit, 'same-net WORLD reconnect clears late-pass history');
|
|
731
|
+
State.hub.avatars.delete('c');
|
|
732
|
+
system.fadeNames(scene);
|
|
733
|
+
assert.equal(tags.get('c').sprite.visible, false, 'renderer eligibility revocation is immediate and not counted');
|
|
734
|
+
assert.equal(labels.find((item) => item.id === 'crowd:summary')?.text, '+1 more', 'summary counts only the still-eligible suppressed candidate');
|
|
735
|
+
State.hub.avatars.set('c', 0);
|
|
736
|
+
const originalData = scene.data;
|
|
737
|
+
const originalMultiplayer = scene.multiplayer;
|
|
738
|
+
const validFrame = () => ({ scene, data: scene.data, net: scene.multiplayer.net, camera: scene.three.camera, local: local.components.Transform, own: null, controls: [], view, labels: [] });
|
|
739
|
+
const prerequisiteCases = [
|
|
740
|
+
['multiplayer missing', () => {scene.multiplayer = null;}],
|
|
741
|
+
['net missing', () => {scene.multiplayer.net = null;}],
|
|
742
|
+
['camera missing', () => {scene.three.camera = null;}],
|
|
743
|
+
['fresh frame with camera missing', () => {scene.three.camera = null; system.crowdFrame = validFrame();}],
|
|
744
|
+
['frame scene mismatch', () => {system.crowdFrame = { ...validFrame(), scene: {} };}],
|
|
745
|
+
['frame absent', () => {delete system.crowdFrame;}],
|
|
746
|
+
['reconnecting net with retained roster', () => {netState = 'reconnecting';}],
|
|
747
|
+
['unknown net status', () => {netState = 'mystery';}],
|
|
748
|
+
['unavailable net status', () => {netState = null;}],
|
|
749
|
+
['same-scene data replacement', () => {scene.data = { engine: { hubCrowdNames: true } };}],
|
|
750
|
+
['same-scene net replacement', () => {scene.multiplayer.net = { ...net, status: () => ({ state: 'connected' }) };}],
|
|
751
|
+
['same-scene camera replacement', () => {scene.three.camera = { ...camera };}],
|
|
752
|
+
];
|
|
753
|
+
for (const [name, invalidate] of prerequisiteCases) {
|
|
754
|
+
netState = 'connected';
|
|
755
|
+
scene.data = originalData;
|
|
756
|
+
scene.multiplayer = originalMultiplayer;
|
|
757
|
+
scene.multiplayer.net = net;
|
|
758
|
+
scene.three.camera = camera;
|
|
759
|
+
system.crowdFrame = validFrame();
|
|
760
|
+
system.fadeNames(scene);
|
|
761
|
+
const visit = system.crowdNamesHeld.state;
|
|
762
|
+
const scales = [...system.crowdNameScales.entries()];
|
|
763
|
+
assert(labels.some((item) => item.id === 'crowd:summary'), `${name}: fixture begins with a populated summary`);
|
|
764
|
+
invalidate();
|
|
765
|
+
system.fadeNames(scene);
|
|
766
|
+
assert(!labels.some((item) => item.id === 'crowd:summary'), `${name}: stale summary is destroyed`);
|
|
767
|
+
assert([...tags.values()].every((tag) => !tag.sprite.visible), `${name}: no nonself name is exposed`);
|
|
768
|
+
assert(!Object.hasOwn(system, 'crowdNamesHeld'), `${name}: visit ranking is reset`);
|
|
769
|
+
assert(!Object.hasOwn(system, 'crowdFrame'), `${name}: stale frame provenance is discarded`);
|
|
770
|
+
assert(!Object.hasOwn(system, 'crowdNameScales'), `${name}: E leaves no scale override`);
|
|
771
|
+
assert(!Object.hasOwn(system, 'crowdSprites'), `${name}: prior sprite ownership moves into the hidden recovery set`);
|
|
772
|
+
for (const [scaledSprite, scale] of scales) {
|
|
773
|
+
assert.equal(scaledSprite.scale.x, scale.x, `${name}: ordinary x scale is restored`);
|
|
774
|
+
assert.equal(scaledSprite.scale.y, scale.y, `${name}: ordinary y scale is restored`);
|
|
775
|
+
}
|
|
776
|
+
netState = 'connected';
|
|
777
|
+
scene.data = originalData;
|
|
778
|
+
scene.multiplayer = originalMultiplayer;
|
|
779
|
+
scene.multiplayer.net = net;
|
|
780
|
+
scene.three.camera = camera;
|
|
781
|
+
system.crowdFrame = validFrame();
|
|
782
|
+
system.fadeNames(scene);
|
|
783
|
+
assert.notEqual(system.crowdNamesHeld.state, visit, `${name}: authorized recovery starts a fresh visit state`);
|
|
784
|
+
assert([...tags.values()].some((tag) => tag.sprite.visible), `${name}: authorized names recover`);
|
|
785
|
+
assert(labels.some((item) => item.id === 'crowd:summary'), `${name}: current eligible summary recovers`);
|
|
786
|
+
}
|
|
787
|
+
scene.data.engine.hubCrowdNames = false;
|
|
788
|
+
system.fadeNames(scene);
|
|
789
|
+
assert.equal(tags.get('a').sprite.scale.x, eScale.x, 'OFF restores the exact ordinary scale E replaced');
|
|
790
|
+
assert.equal(tags.get('a').sprite.scale.y, eScale.y, 'OFF restores both scale axes');
|
|
791
|
+
assert([...tags.values()].every((tag) => tag.sprite.visible), 'OFF restores only E-suppressed sprites through the baseline pass');
|
|
792
|
+
assert(!Object.hasOwn(system, 'crowdNamesHeld') && !Object.hasOwn(system, 'crowdFrame') && !Object.hasOwn(system, 'crowdHidden'));
|
|
793
|
+
assert(!Object.hasOwn(system, 'crowdNameScales'));
|
|
794
|
+
const rendererResized = { scale: { x: 9, y: 10 } };
|
|
795
|
+
system.crowdNameScales = new Map([[rendererResized, { x: 1, y: 2, scaledX: 3, scaledY: 4 }]]);
|
|
796
|
+
system.restoreCrowdNameScales();
|
|
797
|
+
assert.deepEqual(rendererResized.scale, { x: 9, y: 10 }, 'restoration never overwrites a newer multiplayer scale');
|
|
798
|
+
scene.data.engine.hubCrowdNames = true;
|
|
799
|
+
system.crowdFrame = { ...validFrame(), view: { w: 509, h: 218 } };
|
|
800
|
+
system.fadeNames(scene);
|
|
801
|
+
assert(!Object.hasOwn(system, 'crowdNameScales'), 'the tiny layout suppresses individuals without scale overrides');
|
|
802
|
+
scene.data.engine.hubCrowdNames = false;
|
|
803
|
+
system.fadeNames(scene);
|
|
804
|
+
});
|
|
805
|
+
test('rehello drops stale chips, identity clear drops them, avatar hello keeps them', () => {
|
|
806
|
+
let system; installSystem({ registerSystem(value) { system = value; } });
|
|
807
|
+
State.clear(); State.hub.place = { actions: true }; State.hub.actions = { items, n: 1 };
|
|
808
|
+
const scene = { persistent: {} }, sent = [];
|
|
809
|
+
let playerId = 'p1';
|
|
810
|
+
const net = { selfId: () => playerId, send: (msg) => sent.push(msg), drain: () => [] }, mp = { net };
|
|
811
|
+
system.sendHello(scene, mp, net, 0, { again: true }); assert.deepEqual(State.hub.actions, { items, n: 1 });
|
|
812
|
+
system.sendHello(scene, mp, net, 0, { resume: true }); assert(!Object.hasOwn(State.hub, 'actions'));
|
|
813
|
+
assert.equal(sent.at(-1).resume, true);
|
|
814
|
+
hook.message({}, { k: 'hub-actions', items, n: 1 }); assert.deepEqual(State.hub.actions, { items, n: 1 });
|
|
815
|
+
playerId = 'p2'; net.drain(); assert(!Object.hasOwn(State.hub, 'actions'));
|
|
816
|
+
hook.message({}, { k: 'hub-actions', items, n: 1 }); assert.deepEqual(State.hub.actions, { items, n: 1 });
|
|
817
|
+
State.clear(); assert(!Object.hasOwn(State.hub, 'actions'));
|
|
818
|
+
system.sendHello(scene, mp, net, 0, {}); assert(!Object.hasOwn(State.hub, 'actions'));
|
|
819
|
+
});
|
|
820
|
+
for (const status of ['signedIn', 'dismissed', 'unavailable', 'UNKNOWN_COMMAND']) {
|
|
821
|
+
State.clear(); fakeDom({ viewW: 360, viewH: 780 });
|
|
822
|
+
let system; installSystem({ registerSystem(value) { system = value; } });
|
|
823
|
+
const calls = [], sent = [], requests = [];
|
|
824
|
+
system.chrome = new Proxy({ peopleOpen: () => false, chatFocused: () => false }, { get(target, name) { return target[name] ?? ((...args) => calls.push([name, ...args])); } });
|
|
825
|
+
system.talk = { frame() {}, talking: () => false, typing: () => false, talkingWith: () => null };
|
|
826
|
+
system.idle = { frame() {}, draw() {}, labels: () => [] };
|
|
827
|
+
system.grab = { frame() {} }; system.sound = { frame() {} }; system.sayHooked = true;
|
|
828
|
+
system.together.frame = () => {};
|
|
829
|
+
for (const method of ['keepResident', 'wearAvatar', 'applyTune', 'watchSession', 'sayHello', 'followPlace', 'holdFall', 'turnSpinners', 'applySpawns', 'applyTints', 'registerInterest', 'applyVisibility', 'applyWear', 'adoptLate', 'runCommands', 'askFriends', 'stepEnd', 'faceArrival', 'measure']) system[method] = () => {};
|
|
830
|
+
system.sceneKey = 'main';
|
|
831
|
+
const scene = { sceneKey: 'main', currentScenePath: 'scenes/main.scene', multiplayer: { net: { selfId: () => 'p1', send: (msg) => sent.push(msg) } }, actorWith: () => null, persistent: { hubTickets: [], hubAvatar: 0 }, getActors: () => [] };
|
|
832
|
+
const identity = system.helloNet = scene.multiplayer.net;
|
|
833
|
+
system.signIn = makeSignIn({ api: { signIn: async (params) => {
|
|
834
|
+
requests.push(params);
|
|
835
|
+
if (status === 'UNKNOWN_COMMAND') throw Object.assign(new Error('Unknown command'), { code: status });
|
|
836
|
+
return { status };
|
|
837
|
+
} }, signedIn: () => { system.helloNet = null; } });
|
|
838
|
+
State.hub.place = { id: 'main', anonymousEntry: true };
|
|
839
|
+
State.hub.hudMe = { title: 'Practice', text: 'Sign in to keep your progress' };
|
|
840
|
+
system.afterBehaviors(scene, 0.05);
|
|
841
|
+
const draw = calls.findLast(([name]) => name === 'setActions');
|
|
842
|
+
assert.equal(draw[1][0].id, 'signin');
|
|
843
|
+
draw[2]('signin', draw[4]);
|
|
844
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
845
|
+
assert.deepEqual(requests, [{ reason: 'Sign in to keep your progress' }]);
|
|
846
|
+
assert.deepEqual(sent, [], 'native sign-in chip never sends a forged server action');
|
|
847
|
+
assert.equal(system.helloNet, status === 'signedIn' ? null : identity);
|
|
848
|
+
system.afterBehaviors(scene, 0.05);
|
|
849
|
+
if (status === 'UNKNOWN_COMMAND' || status === 'unavailable') assert.equal(calls.findLast(([name]) => name === 'setActions')[1], null);
|
|
850
|
+
passed += 1;
|
|
851
|
+
console.log(`ok: real system sign-in chip handles ${status}`);
|
|
852
|
+
}
|
|
853
|
+
console.log(`${passed} action client tests passed`);
|