@celljs/ta 4.10.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +3 -1
- package/README.md +3 -1
- package/dist/cli.mjs +1675 -51
- package/dist/gateway.mjs +167 -5
- package/dist/pi/CHANGELOG.md +27 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-agents/extension/index.mjs +359 -155
- package/dist/pi/packages/ta-agents/lib/acp-agent.js +30 -10
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +5 -0
- package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +2 -2
- package/dist/pi/packages/ta-agents/lib/agent-catalog.js +4 -4
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +9 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +25 -0
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +71 -1
- package/dist/pi/packages/ta-agents/lib/agent-session.js +177 -17
- package/dist/pi/packages/ta-agents/lib/agent-streamer.js +23 -2
- package/dist/pi/packages/ta-agents/lib/agent-tool.js +4 -3
- package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +7 -1
- package/dist/pi/packages/ta-agents/lib/agent-turn.js +26 -3
- package/dist/pi/packages/ta-agents/lib/extension.js +7 -0
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +12 -0
- package/dist/pi/packages/ta-agents/lib/texts.js +12 -0
- package/dist/pi/packages/ta-agents/package.json +1 -1
- package/dist/pi/packages/ta-bots/extension/index.mjs +31 -299
- package/dist/pi/packages/ta-bots/host/index.mjs +143 -1
- package/dist/pi/packages/ta-bots/lib/bots-protocol.d.ts +2 -0
- package/dist/pi/packages/ta-bots/lib/bots-protocol.js +3 -1
- package/dist/pi/packages/ta-bots/lib/bots-view.js +24 -12
- package/dist/pi/packages/ta-bots/lib/composer.js +1 -0
- package/dist/pi/packages/ta-bots/lib/extension.js +10 -17
- package/dist/pi/packages/ta-bots/lib/i18n.d.ts +1 -0
- package/dist/pi/packages/ta-bots/lib/i18n.js +2 -0
- package/dist/pi/packages/ta-bots/lib/index.js +2 -0
- package/dist/pi/packages/ta-bots/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-bots/lib/style.js +1 -0
- package/dist/pi/packages/ta-bots/lib/text-util.js +8 -1
- package/dist/pi/packages/ta-bots/lib/tool-line.d.ts +8 -0
- package/dist/pi/packages/ta-bots/lib/tool-line.js +19 -0
- package/dist/pi/packages/ta-bots/package.json +1 -1
- package/dist/pi/packages/ta-bots/web/index.js +47 -16
- package/dist/pi/packages/ta-changes/extension/index.mjs +23 -13
- package/dist/pi/packages/ta-changes/lib/card.js +18 -4
- package/dist/pi/packages/ta-changes/lib/changes-protocol.d.ts +0 -4
- package/dist/pi/packages/ta-changes/lib/changes-protocol.js +1 -5
- package/dist/pi/packages/ta-changes/lib/extension.js +5 -13
- package/dist/pi/packages/ta-changes/package.json +1 -1
- package/dist/pi/packages/ta-changes/web/index.js +16 -3
- package/dist/pi/packages/ta-channels/README.en.md +4 -3
- package/dist/pi/packages/ta-channels/README.md +4 -3
- package/dist/pi/packages/ta-channels/extension/index.mjs +350 -28
- package/dist/pi/packages/ta-channels/host/index.mjs +588 -43
- package/dist/pi/packages/ta-channels/lib/agent-cards.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/agent-cards.js +58 -0
- package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts +2 -2
- package/dist/pi/packages/ta-channels/lib/agent-menu.js +20 -6
- package/dist/pi/packages/ta-channels/lib/card.d.ts +27 -0
- package/dist/pi/packages/ta-channels/lib/card.js +178 -0
- package/dist/pi/packages/ta-channels/lib/channels-model.d.ts +65 -13
- package/dist/pi/packages/ta-channels/lib/channels-model.js +15 -6
- package/dist/pi/packages/ta-channels/lib/channels-util.d.ts +31 -2
- package/dist/pi/packages/ta-channels/lib/channels-util.js +100 -6
- package/dist/pi/packages/ta-channels/lib/channels.d.ts +28 -18
- package/dist/pi/packages/ta-channels/lib/channels.js +65 -65
- package/dist/pi/packages/ta-channels/lib/create.js +3 -1
- package/dist/pi/packages/ta-channels/lib/extension.d.ts +8 -0
- package/dist/pi/packages/ta-channels/lib/extension.js +104 -18
- package/dist/pi/packages/ta-channels/lib/faces.d.ts +2 -0
- package/dist/pi/packages/ta-channels/lib/faces.js +6 -0
- package/dist/pi/packages/ta-channels/lib/handoff-view.d.ts +19 -0
- package/dist/pi/packages/ta-channels/lib/handoff-view.js +113 -0
- package/dist/pi/packages/ta-channels/lib/handoff.d.ts +67 -0
- package/dist/pi/packages/ta-channels/lib/handoff.js +114 -0
- package/dist/pi/packages/ta-channels/lib/host.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/host.js +1 -1
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts +45 -0
- package/dist/pi/packages/ta-channels/lib/i18n.js +90 -0
- package/dist/pi/packages/ta-channels/lib/index.js +10 -1
- package/dist/pi/packages/ta-channels/lib/member-tools.d.ts +23 -0
- package/dist/pi/packages/ta-channels/lib/member-tools.js +56 -0
- package/dist/pi/packages/ta-channels/lib/members.js +6 -2
- package/dist/pi/packages/ta-channels/lib/notice.d.ts +25 -0
- package/dist/pi/packages/ta-channels/lib/notice.js +101 -0
- package/dist/pi/packages/ta-channels/lib/room.js +13 -2
- package/dist/pi/packages/ta-channels/lib/sidebar.d.ts +1 -6
- package/dist/pi/packages/ta-channels/lib/sidebar.js +160 -79
- package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-channels/lib/style.js +72 -4
- package/dist/pi/packages/ta-channels/lib/team.d.ts +58 -10
- package/dist/pi/packages/ta-channels/lib/team.js +159 -38
- package/dist/pi/packages/ta-channels/lib/tool-lines.d.ts +22 -0
- package/dist/pi/packages/ta-channels/lib/tool-lines.js +113 -0
- package/dist/pi/packages/ta-channels/lib/views.d.ts +33 -16
- package/dist/pi/packages/ta-channels/lib/views.js +79 -31
- package/dist/pi/packages/ta-channels/package.json +2 -1
- package/dist/pi/packages/ta-channels/web/index.js +1551 -308
- package/dist/pi/packages/ta-computer-use/package.json +6 -1
- package/dist/pi/packages/ta-cron/README.en.md +4 -2
- package/dist/pi/packages/ta-cron/README.md +4 -2
- package/dist/pi/packages/ta-cron/extension/index.mjs +416 -44
- package/dist/pi/packages/ta-cron/host/index.mjs +24 -3
- package/dist/pi/packages/ta-cron/lib/chat-task.d.ts +48 -0
- package/dist/pi/packages/ta-cron/lib/chat-task.js +133 -0
- package/dist/pi/packages/ta-cron/lib/commands.d.ts +2 -1
- package/dist/pi/packages/ta-cron/lib/commands.js +10 -4
- package/dist/pi/packages/ta-cron/lib/composer.d.ts +11 -0
- package/dist/pi/packages/ta-cron/lib/composer.js +58 -0
- package/dist/pi/packages/ta-cron/lib/cron-protocol.d.ts +10 -3
- package/dist/pi/packages/ta-cron/lib/cron-protocol.js +6 -3
- package/dist/pi/packages/ta-cron/lib/editor.js +5 -3
- package/dist/pi/packages/ta-cron/lib/extension.d.ts +2 -0
- package/dist/pi/packages/ta-cron/lib/extension.js +33 -13
- package/dist/pi/packages/ta-cron/lib/i18n.d.ts +18 -0
- package/dist/pi/packages/ta-cron/lib/i18n.js +36 -0
- package/dist/pi/packages/ta-cron/lib/index.js +4 -0
- package/dist/pi/packages/ta-cron/lib/page.d.ts +5 -1
- package/dist/pi/packages/ta-cron/lib/page.js +12 -0
- package/dist/pi/packages/ta-cron/lib/react.d.ts +3 -0
- package/dist/pi/packages/ta-cron/lib/react.js +8 -0
- package/dist/pi/packages/ta-cron/lib/scheduler.js +3 -2
- package/dist/pi/packages/ta-cron/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-cron/lib/style.js +11 -13
- package/dist/pi/packages/ta-cron/lib/task-util.d.ts +2 -0
- package/dist/pi/packages/ta-cron/lib/task-util.js +20 -1
- package/dist/pi/packages/ta-cron/lib/tasks-view.js +6 -2
- package/dist/pi/packages/ta-cron/lib/tool-line.d.ts +9 -0
- package/dist/pi/packages/ta-cron/lib/tool-line.js +40 -0
- package/dist/pi/packages/ta-cron/lib/tool.d.ts +5 -1
- package/dist/pi/packages/ta-cron/lib/tool.js +6 -3
- package/dist/pi/packages/ta-cron/package.json +12 -1
- package/dist/pi/packages/ta-cron/web/index.js +661 -254
- package/dist/pi/packages/ta-extensions/README.en.md +1 -1
- package/dist/pi/packages/ta-extensions/README.md +1 -1
- package/dist/pi/packages/ta-extensions/host/index.mjs +3 -2
- package/dist/pi/packages/ta-extensions/lib/actions.d.ts +4 -0
- package/dist/pi/packages/ta-extensions/lib/actions.js +13 -4
- package/dist/pi/packages/ta-extensions/lib/extensions-util.d.ts +5 -0
- package/dist/pi/packages/ta-extensions/lib/extensions-util.js +10 -0
- package/dist/pi/packages/ta-extensions/lib/market-parts.js +8 -2
- package/dist/pi/packages/ta-extensions/lib/market-style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/market-style.js +4 -5
- package/dist/pi/packages/ta-extensions/lib/market-util.d.ts +2 -2
- package/dist/pi/packages/ta-extensions/lib/market-util.js +2 -2
- package/dist/pi/packages/ta-extensions/lib/page.js +12 -7
- package/dist/pi/packages/ta-extensions/lib/react.d.ts +3 -0
- package/dist/pi/packages/ta-extensions/lib/react.js +8 -0
- package/dist/pi/packages/ta-extensions/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-extensions/lib/style.js +3 -2
- package/dist/pi/packages/ta-extensions/package.json +6 -1
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +20 -8
- package/dist/pi/packages/ta-extensions/web/index.js +191 -22
- package/dist/pi/packages/ta-games/README.en.md +47 -0
- package/dist/pi/packages/ta-games/README.md +47 -0
- package/dist/pi/packages/ta-games/host/index.mjs +65 -0
- package/dist/pi/packages/ta-games/lib/games-view.d.ts +16 -0
- package/dist/pi/packages/ta-games/lib/games-view.js +77 -0
- package/dist/pi/packages/ta-games/lib/host.d.ts +36 -0
- package/dist/pi/packages/ta-games/lib/host.js +83 -0
- package/dist/pi/packages/ta-games/lib/i18n.d.ts +35 -0
- package/dist/pi/packages/ta-games/lib/i18n.js +71 -0
- package/dist/pi/packages/ta-games/lib/ideas.d.ts +6 -0
- package/dist/pi/packages/ta-games/lib/ideas.js +62 -0
- package/dist/pi/packages/ta-games/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-games/lib/index.js +24 -0
- package/dist/pi/packages/ta-games/lib/make-game.d.ts +23 -0
- package/dist/pi/packages/ta-games/lib/make-game.js +67 -0
- package/dist/pi/packages/ta-games/lib/react.d.ts +11 -0
- package/dist/pi/packages/ta-games/lib/react.js +16 -0
- package/dist/pi/packages/ta-games/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-games/lib/style.js +33 -0
- package/dist/pi/packages/ta-games/package.json +60 -0
- package/dist/pi/packages/ta-games/skills/ta-game/SKILL.md +127 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/dino-run/package.json +22 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/dino-run/web.js +389 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/stack/package.json +22 -0
- package/dist/pi/packages/ta-games/skills/ta-game/examples/stack/web.js +423 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/LICENSE.md +22 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/actions-and-utilities/SKILL.md +343 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/animations/SKILL.md +481 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/audio-and-sound/SKILL.md +453 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/cameras/SKILL.md +497 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/cameras/references/REFERENCE.md +128 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/curves-and-paths/SKILL.md +359 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/data-manager/SKILL.md +406 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/events-system/SKILL.md +497 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/filters-and-postfx/SKILL.md +449 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/game-object-components/SKILL.md +478 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/game-object-components/references/REFERENCE.md +76 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/game-setup-and-config/SKILL.md +485 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/geometry-and-math/SKILL.md +497 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/graphics-and-shapes/SKILL.md +473 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/groups-and-containers/SKILL.md +418 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/input-keyboard-mouse-touch/SKILL.md +500 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/input-keyboard-mouse-touch/references/REFERENCE.md +372 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/loading-assets/SKILL.md +474 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/loading-assets/references/REFERENCE.md +148 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/particles/SKILL.md +499 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/particles/references/REFERENCE.md +17 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/physics-arcade/SKILL.md +468 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/physics-matter/SKILL.md +499 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/render-textures/SKILL.md +441 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/scale-and-responsive/SKILL.md +371 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/scenes/SKILL.md +450 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/scenes/references/REFERENCE.md +78 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/sprites-and-images/SKILL.md +417 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/sprites-and-images/references/REFERENCE.md +160 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/text-and-bitmaptext/SKILL.md +460 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/tilemaps/SKILL.md +440 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/time-and-timers/SKILL.md +496 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/tweens/SKILL.md +414 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/v3-to-v4-migration/SKILL.md +430 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/v4-new-features/SKILL.md +384 -0
- package/dist/pi/packages/ta-games/skills/ta-game/phaser/v4-new-features/references/REFERENCE.md +69 -0
- package/dist/pi/packages/ta-games/web/index.js +431 -0
- package/dist/pi/packages/ta-glance/README.en.md +11 -0
- package/dist/pi/packages/ta-glance/README.md +11 -0
- package/dist/pi/packages/ta-glance/extension/index.mjs +67 -0
- package/dist/pi/packages/ta-glance/lib/card.d.ts +8 -0
- package/dist/pi/packages/ta-glance/lib/card.js +269 -0
- package/dist/pi/packages/ta-glance/lib/extension.d.ts +15 -0
- package/dist/pi/packages/ta-glance/lib/extension.js +24 -0
- package/dist/pi/packages/ta-glance/lib/glance-json.d.ts +9 -0
- package/dist/pi/packages/ta-glance/lib/glance-json.js +85 -0
- package/dist/pi/packages/ta-glance/lib/glance-prompt.d.ts +7 -0
- package/dist/pi/packages/ta-glance/lib/glance-prompt.js +34 -0
- package/dist/pi/packages/ta-glance/lib/glance-protocol.d.ts +98 -0
- package/dist/pi/packages/ta-glance/lib/glance-protocol.js +8 -0
- package/dist/pi/packages/ta-glance/lib/glance-spec.d.ts +7 -0
- package/dist/pi/packages/ta-glance/lib/glance-spec.js +206 -0
- package/dist/pi/packages/ta-glance/lib/glance-util.d.ts +3 -0
- package/dist/pi/packages/ta-glance/lib/glance-util.js +12 -0
- package/dist/pi/packages/ta-glance/lib/i18n.d.ts +22 -0
- package/dist/pi/packages/ta-glance/lib/i18n.js +41 -0
- package/dist/pi/packages/ta-glance/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-glance/lib/index.js +22 -0
- package/dist/pi/packages/ta-glance/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-glance/lib/react.js +8 -0
- package/dist/pi/packages/ta-glance/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-glance/lib/style.js +241 -0
- package/dist/pi/packages/ta-glance/package.json +53 -0
- package/dist/pi/packages/ta-glance/web/index.js +1013 -0
- package/dist/pi/packages/ta-launcher/lib/actions.d.ts +4 -4
- package/dist/pi/packages/ta-launcher/lib/actions.js +7 -3
- package/dist/pi/packages/ta-launcher/lib/launcher-util.d.ts +7 -7
- package/dist/pi/packages/ta-launcher/lib/launcher-util.js +11 -8
- package/dist/pi/packages/ta-launcher/lib/launcher-view.js +13 -7
- package/dist/pi/packages/ta-launcher/lib/react.d.ts +3 -0
- package/dist/pi/packages/ta-launcher/lib/react.js +8 -0
- package/dist/pi/packages/ta-launcher/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-launcher/lib/style.js +6 -4
- package/dist/pi/packages/ta-launcher/package.json +1 -1
- package/dist/pi/packages/ta-launcher/web/index.js +34 -17
- package/dist/pi/packages/ta-manual/README.en.md +10 -0
- package/dist/pi/packages/ta-manual/README.md +10 -0
- package/dist/pi/packages/ta-manual/lib/i18n.d.ts +15 -0
- package/dist/pi/packages/ta-manual/lib/i18n.js +31 -0
- package/dist/pi/packages/ta-manual/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-manual/lib/index.js +24 -0
- package/dist/pi/packages/ta-manual/lib/manual-util.d.ts +18 -0
- package/dist/pi/packages/ta-manual/lib/manual-util.js +40 -0
- package/dist/pi/packages/ta-manual/lib/manual-view.d.ts +9 -0
- package/dist/pi/packages/ta-manual/lib/manual-view.js +81 -0
- package/dist/pi/packages/ta-manual/lib/pictures-a.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-a.js +263 -0
- package/dist/pi/packages/ta-manual/lib/pictures-b.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-b.js +216 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.d.ts +2 -0
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +53 -0
- package/dist/pi/packages/ta-manual/lib/pictures.d.ts +9 -0
- package/dist/pi/packages/ta-manual/lib/pictures.js +17 -0
- package/dist/pi/packages/ta-manual/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-manual/lib/react.js +8 -0
- package/dist/pi/packages/ta-manual/lib/scene.d.ts +68 -0
- package/dist/pi/packages/ta-manual/lib/scene.js +115 -0
- package/dist/pi/packages/ta-manual/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-manual/lib/style.js +47 -0
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +43 -0
- package/dist/pi/packages/ta-manual/lib/topics.js +388 -0
- package/dist/pi/packages/ta-manual/package.json +54 -0
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +130 -0
- package/dist/pi/packages/ta-manual/web/index.js +2408 -0
- package/dist/pi/packages/ta-notify/README.en.md +29 -0
- package/dist/pi/packages/ta-notify/README.md +29 -0
- package/dist/pi/packages/ta-notify/extension/index.mjs +259 -0
- package/dist/pi/packages/ta-notify/host/index.mjs +163 -0
- package/dist/pi/packages/ta-notify/lib/ask-card.d.ts +9 -0
- package/dist/pi/packages/ta-notify/lib/ask-card.js +40 -0
- package/dist/pi/packages/ta-notify/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-notify/lib/extension.js +102 -0
- package/dist/pi/packages/ta-notify/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-notify/lib/host.js +9 -0
- package/dist/pi/packages/ta-notify/lib/i18n.d.ts +31 -0
- package/dist/pi/packages/ta-notify/lib/i18n.js +63 -0
- package/dist/pi/packages/ta-notify/lib/index.d.ts +8 -0
- package/dist/pi/packages/ta-notify/lib/index.js +29 -0
- package/dist/pi/packages/ta-notify/lib/notify-protocol.d.ts +74 -0
- package/dist/pi/packages/ta-notify/lib/notify-protocol.js +23 -0
- package/dist/pi/packages/ta-notify/lib/notify-service.d.ts +21 -0
- package/dist/pi/packages/ta-notify/lib/notify-service.js +75 -0
- package/dist/pi/packages/ta-notify/lib/notify-util.d.ts +39 -0
- package/dist/pi/packages/ta-notify/lib/notify-util.js +119 -0
- package/dist/pi/packages/ta-notify/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-notify/lib/react.js +8 -0
- package/dist/pi/packages/ta-notify/lib/server-texts.d.ts +9 -0
- package/dist/pi/packages/ta-notify/lib/server-texts.js +22 -0
- package/dist/pi/packages/ta-notify/lib/settings.d.ts +8 -0
- package/dist/pi/packages/ta-notify/lib/settings.js +85 -0
- package/dist/pi/packages/ta-notify/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-notify/lib/style.js +29 -0
- package/dist/pi/packages/ta-notify/lib/tool-line.d.ts +9 -0
- package/dist/pi/packages/ta-notify/lib/tool-line.js +20 -0
- package/dist/pi/packages/ta-notify/lib/tool.d.ts +37 -0
- package/dist/pi/packages/ta-notify/lib/tool.js +46 -0
- package/dist/pi/packages/ta-notify/lib/watcher.d.ts +15 -0
- package/dist/pi/packages/ta-notify/lib/watcher.js +81 -0
- package/dist/pi/packages/ta-notify/package.json +55 -0
- package/dist/pi/packages/ta-notify/web/index.js +436 -0
- package/dist/pi/packages/ta-recall/README.en.md +19 -0
- package/dist/pi/packages/ta-recall/README.md +19 -0
- package/dist/pi/packages/ta-recall/extension/index.mjs +615 -0
- package/dist/pi/packages/ta-recall/host/index.mjs +820 -0
- package/dist/pi/packages/ta-recall/lib/brief-card.d.ts +21 -0
- package/dist/pi/packages/ta-recall/lib/brief-card.js +67 -0
- package/dist/pi/packages/ta-recall/lib/brief-home.d.ts +49 -0
- package/dist/pi/packages/ta-recall/lib/brief-home.js +143 -0
- package/dist/pi/packages/ta-recall/lib/brief-seen.d.ts +9 -0
- package/dist/pi/packages/ta-recall/lib/brief-seen.js +26 -0
- package/dist/pi/packages/ta-recall/lib/brief-util.d.ts +64 -0
- package/dist/pi/packages/ta-recall/lib/brief-util.js +179 -0
- package/dist/pi/packages/ta-recall/lib/chat-icons.d.ts +8 -0
- package/dist/pi/packages/ta-recall/lib/chat-icons.js +56 -0
- package/dist/pi/packages/ta-recall/lib/composer.d.ts +7 -0
- package/dist/pi/packages/ta-recall/lib/composer.js +38 -0
- package/dist/pi/packages/ta-recall/lib/conversation-index.d.ts +25 -0
- package/dist/pi/packages/ta-recall/lib/conversation-index.js +72 -0
- package/dist/pi/packages/ta-recall/lib/conversation-util.d.ts +16 -0
- package/dist/pi/packages/ta-recall/lib/conversation-util.js +109 -0
- package/dist/pi/packages/ta-recall/lib/conversations.d.ts +11 -0
- package/dist/pi/packages/ta-recall/lib/conversations.js +52 -0
- package/dist/pi/packages/ta-recall/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-recall/lib/extension.js +132 -0
- package/dist/pi/packages/ta-recall/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-recall/lib/host.js +11 -0
- package/dist/pi/packages/ta-recall/lib/i18n.d.ts +41 -0
- package/dist/pi/packages/ta-recall/lib/i18n.js +83 -0
- package/dist/pi/packages/ta-recall/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-recall/lib/index.js +45 -0
- package/dist/pi/packages/ta-recall/lib/react.d.ts +11 -0
- package/dist/pi/packages/ta-recall/lib/react.js +16 -0
- package/dist/pi/packages/ta-recall/lib/recall-protocol.d.ts +186 -0
- package/dist/pi/packages/ta-recall/lib/recall-protocol.js +60 -0
- package/dist/pi/packages/ta-recall/lib/recall-service.d.ts +42 -0
- package/dist/pi/packages/ta-recall/lib/recall-service.js +241 -0
- package/dist/pi/packages/ta-recall/lib/search-source.d.ts +7 -0
- package/dist/pi/packages/ta-recall/lib/search-source.js +49 -0
- package/dist/pi/packages/ta-recall/lib/search-util.d.ts +30 -0
- package/dist/pi/packages/ta-recall/lib/search-util.js +167 -0
- package/dist/pi/packages/ta-recall/lib/server-texts.d.ts +7 -0
- package/dist/pi/packages/ta-recall/lib/server-texts.js +17 -0
- package/dist/pi/packages/ta-recall/lib/settings.d.ts +4 -0
- package/dist/pi/packages/ta-recall/lib/settings.js +77 -0
- package/dist/pi/packages/ta-recall/lib/skill-card.d.ts +9 -0
- package/dist/pi/packages/ta-recall/lib/skill-card.js +51 -0
- package/dist/pi/packages/ta-recall/lib/skill-util.d.ts +19 -0
- package/dist/pi/packages/ta-recall/lib/skill-util.js +110 -0
- package/dist/pi/packages/ta-recall/lib/stored.d.ts +5 -0
- package/dist/pi/packages/ta-recall/lib/stored.js +28 -0
- package/dist/pi/packages/ta-recall/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-recall/lib/style.js +48 -0
- package/dist/pi/packages/ta-recall/lib/tool-line.d.ts +10 -0
- package/dist/pi/packages/ta-recall/lib/tool-line.js +23 -0
- package/dist/pi/packages/ta-recall/lib/tool.d.ts +63 -0
- package/dist/pi/packages/ta-recall/lib/tool.js +71 -0
- package/dist/pi/packages/ta-recall/package.json +55 -0
- package/dist/pi/packages/ta-recall/web/index.js +1042 -0
- package/dist/pi/packages/ta-rooms/README.en.md +29 -0
- package/dist/pi/packages/ta-rooms/README.md +29 -0
- package/dist/pi/packages/ta-rooms/extension/index.mjs +362 -0
- package/dist/pi/packages/ta-rooms/host/index.mjs +966 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.d.ts +25 -0
- package/dist/pi/packages/ta-rooms/lib/agents-view.js +128 -0
- package/dist/pi/packages/ta-rooms/lib/dialogs.d.ts +39 -0
- package/dist/pi/packages/ta-rooms/lib/dialogs.js +235 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.d.ts +114 -0
- package/dist/pi/packages/ta-rooms/lib/double-host.js +645 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +85 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.js +172 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.d.ts +165 -0
- package/dist/pi/packages/ta-rooms/lib/double-protocol.js +73 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.d.ts +99 -0
- package/dist/pi/packages/ta-rooms/lib/double-util.js +180 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.d.ts +45 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-store.js +145 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.d.ts +34 -0
- package/dist/pi/packages/ta-rooms/lib/doubles-view.js +223 -0
- package/dist/pi/packages/ta-rooms/lib/extension.d.ts +24 -0
- package/dist/pi/packages/ta-rooms/lib/extension.js +176 -0
- package/dist/pi/packages/ta-rooms/lib/host.d.ts +7 -0
- package/dist/pi/packages/ta-rooms/lib/host.js +18 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +105 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.js +211 -0
- package/dist/pi/packages/ta-rooms/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-rooms/lib/index.js +106 -0
- package/dist/pi/packages/ta-rooms/lib/members-view.d.ts +3 -0
- package/dist/pi/packages/ta-rooms/lib/members-view.js +94 -0
- package/dist/pi/packages/ta-rooms/lib/page.d.ts +154 -0
- package/dist/pi/packages/ta-rooms/lib/page.js +400 -0
- package/dist/pi/packages/ta-rooms/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-rooms/lib/react.js +8 -0
- package/dist/pi/packages/ta-rooms/lib/room-view.d.ts +15 -0
- package/dist/pi/packages/ta-rooms/lib/room-view.js +168 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-home.d.ts +32 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-home.js +141 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-page.d.ts +14 -0
- package/dist/pi/packages/ta-rooms/lib/rooms-page.js +217 -0
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-rooms/lib/style.js +205 -0
- package/dist/pi/packages/ta-rooms/package.json +56 -0
- package/dist/pi/packages/ta-rooms/web/index.js +3165 -0
- package/dist/pi/packages/ta-share/README.en.md +27 -0
- package/dist/pi/packages/ta-share/README.md +27 -0
- package/dist/pi/packages/ta-share/extension/index.mjs +184 -0
- package/dist/pi/packages/ta-share/host/index.mjs +364 -0
- package/dist/pi/packages/ta-share/lib/extension.d.ts +15 -0
- package/dist/pi/packages/ta-share/lib/extension.js +115 -0
- package/dist/pi/packages/ta-share/lib/host.d.ts +4 -0
- package/dist/pi/packages/ta-share/lib/host.js +9 -0
- package/dist/pi/packages/ta-share/lib/i18n.d.ts +106 -0
- package/dist/pi/packages/ta-share/lib/i18n.js +213 -0
- package/dist/pi/packages/ta-share/lib/index.d.ts +9 -0
- package/dist/pi/packages/ta-share/lib/index.js +77 -0
- package/dist/pi/packages/ta-share/lib/page.d.ts +48 -0
- package/dist/pi/packages/ta-share/lib/page.js +105 -0
- package/dist/pi/packages/ta-share/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-share/lib/react.js +8 -0
- package/dist/pi/packages/ta-share/lib/server-texts.d.ts +14 -0
- package/dist/pi/packages/ta-share/lib/server-texts.js +52 -0
- package/dist/pi/packages/ta-share/lib/share-dialog.d.ts +18 -0
- package/dist/pi/packages/ta-share/lib/share-dialog.js +233 -0
- package/dist/pi/packages/ta-share/lib/share-protocol.d.ts +86 -0
- package/dist/pi/packages/ta-share/lib/share-protocol.js +30 -0
- package/dist/pi/packages/ta-share/lib/share-service.d.ts +50 -0
- package/dist/pi/packages/ta-share/lib/share-service.js +130 -0
- package/dist/pi/packages/ta-share/lib/shared-view.d.ts +18 -0
- package/dist/pi/packages/ta-share/lib/shared-view.js +225 -0
- package/dist/pi/packages/ta-share/lib/shares-page.d.ts +3 -0
- package/dist/pi/packages/ta-share/lib/shares-page.js +78 -0
- package/dist/pi/packages/ta-share/lib/snapshot.d.ts +30 -0
- package/dist/pi/packages/ta-share/lib/snapshot.js +195 -0
- package/dist/pi/packages/ta-share/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-share/lib/style.js +117 -0
- package/dist/pi/packages/ta-share/package.json +56 -0
- package/dist/pi/packages/ta-share/web/index.js +1224 -0
- package/dist/pi/packages/ta-workspace/README.md +1 -1
- package/dist/pi/packages/ta-workspace/README.zh-cn.md +1 -1
- package/dist/pi/packages/ta-workspace/lib/browser-common.d.ts +1 -1
- package/dist/pi/packages/ta-workspace/lib/browser-common.js +29 -30
- package/dist/pi/packages/ta-workspace/lib/browser-tool-line.d.ts +15 -0
- package/dist/pi/packages/ta-workspace/lib/browser-tool-line.js +70 -0
- package/dist/pi/packages/ta-workspace/lib/editors.js +29 -2
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +13 -2
- package/dist/pi/packages/ta-workspace/lib/i18n.js +29 -7
- package/dist/pi/packages/ta-workspace/lib/index.js +2 -0
- package/dist/pi/packages/ta-workspace/lib/preview.d.ts +10 -1
- package/dist/pi/packages/ta-workspace/lib/preview.js +136 -11
- package/dist/pi/packages/ta-workspace/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-workspace/lib/style.js +56 -40
- package/dist/pi/packages/ta-workspace/lib/terminal-sessions.d.ts +15 -4
- package/dist/pi/packages/ta-workspace/lib/terminal-sessions.js +31 -9
- package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +3 -2
- package/dist/pi/packages/ta-workspace/lib/terminal.js +51 -21
- package/dist/pi/packages/ta-workspace/lib/util/preview.d.ts +27 -0
- package/dist/pi/packages/ta-workspace/lib/util/preview.js +74 -0
- package/dist/pi/packages/ta-workspace/lib/util/terminal.d.ts +5 -0
- package/dist/pi/packages/ta-workspace/lib/util/terminal.js +14 -0
- package/dist/pi/packages/ta-workspace/package.json +1 -1
- package/dist/pi/packages/ta-workspace/web/index.js +823 -341
- package/dist/public/assets/OrbitControls-DVf70a7w.js +1 -0
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-BmIko5tV.js → abnfDiagram-S7VZAUFO-BnqtcbpZ.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-XgsdQ7ul.js → architecture-WOLXFQ4H-BzPq1Ioe.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW--sVhMS03.js → architectureDiagram-YGSQEFNW-BsquO3a7.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-8f9b-9k2.js → blockDiagram-APKKGZFW-BQNYOEP4.js} +1 -1
- package/dist/public/assets/{browser-DOHZ0JCf.js → browser-DS711n7Y.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-CwYQ0Jfy.js → c4Diagram-KJ2TOQU5-D6e79Ycq.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-7Y9ezehi.js → chunk-6MUBBAK2-B-sgaPoU.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-CZIH4pWz.js → chunk-AXFCVDMN-D8pJKIg2.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-DsNATY2m.js → chunk-BG4553SI-86TL-vCz.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-CoXkfYE-.js → chunk-DQASFODM-CfUVuGjc.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-C5OLqki8.js → chunk-HFQBQIA3-Drm0FEYk.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-DMHuYGEF.js → chunk-KQLB2F66-BVFRADlC.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-BKeOttO1.js → chunk-KS47KZWR-DfyALEmP.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-D6zCwkk7.js → chunk-LEVMRMFU-DtJVzk2c.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-B5-QqcZg.js → chunk-M57EVK23-DTy27PHQ.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-DQrq3n0T.js → chunk-OY52VR5R-nSgn7jZg.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-j6ZT7EDR.js → chunk-QB3YPZ4I-CkSxO_X6.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-D5MXUO36.js → chunk-R3KSYZAL-Ck6iAjAL.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-DaBkw4dD.js → chunk-STOXU5M4-DQPHdSTh.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-vXcRfGci.js → chunk-TU62E6Q5-Bc2AbV2Y.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-CIh6H4Y2.js → chunk-X4PVCEUW-Cgpm0IXm.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-C_Vwv1FM.js → chunk-XXDRQBXY-CGE4eLpg.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-DccDWEJn.js → classDiagram-v2-L25IHNXF-4eQuDPEo.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-BX47lumZ.js → cose-bilkent-JH36ORCC-tDLCWq07.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dd40W2Jh.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-BE6WOGxW.js → cynefinDiagram-L36ESFBY-ByqcZ8x9.js} +1 -1
- package/dist/public/assets/{d3-selection-ZcE6yRN5.js → d3-selection-Bgn1374-.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-CE6SOOcN.js → dagre-SPEB5RXH-mCgr71mV.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-xC8VtiYL.js → diagram-3B7GL73J-DpYSwpQ0.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-4dmcBbjL.js → diagram-DNEMPZML-DMozUQzi.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN-D14Yn3sQ.js → diagram-L3MUGCDN-Bk5Uf8PD.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-GxSXIhsK.js → diagram-LA4NIPWU-DFt5cPVK.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-Cm7Prlpc.js → diagram-MHCOC4E2-BkZZcKqK.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-mkUnnKFu.js → diagram-XPFHEONP-HEY6kyyN.js} +1 -1
- package/dist/public/assets/{dist-acJS-BlA.js → dist-Bj2CrKn7.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-m77ua3UQ.js → ebnfDiagram-UZSYDL2S-D4JvYyVb.js} +1 -1
- package/dist/public/assets/{editor.api-CljTm-EQ.js → editor.api-BpJFzYbl.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-DsQY1hw9.js → elk-XV6XMXQE-CT6qLJkF.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-CV8gJM0P.js → erDiagram-EYBAPDEH-BGng1goR.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-C1pymbUr.js → eventmodeling-K75KTNOO-Tt8O-Q1Z.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-uFzenfA3.js +1 -0
- package/dist/public/assets/{freemarker2-DYJXaMHN.js → freemarker2-Dd5ksoRn.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-CppxOWRh.js → ganttDiagram-23REXITY-Jl8VO_g2.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-D28I_jUc.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-CrQrZhcP.js → gitGraphDiagram-STJD7YCW-Be4qXALb.js} +1 -1
- package/dist/public/assets/{handlebars-DZCnH9e2.js → handlebars-4xabgUi4.js} +1 -1
- package/dist/public/assets/{html-DuzouNES.js → html-Dk3kt2w_.js} +1 -1
- package/dist/public/assets/{index-B7OYKvCE.js → index-Bx0c7eoh.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-5vIGEIq7.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-6pby19tQ.js → infoDiagram-KBXO4MBG-Coc0tdwb.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-Duf8c8rQ.js → ishikawaDiagram-M35NCXHK-CE_1VQCg.js} +1 -1
- package/dist/public/assets/{javascript-2d_L6cVd.js → javascript-DKLGqy6v.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-Dvv-xzNo.js → journeyDiagram-OPLOXDXO-CrolRZ_7.js} +1 -1
- package/dist/public/assets/{jsonMode-CFadYXyI.js → jsonMode-Chcs19_y.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-Dsk6F-TT.js → kanban-definition-BZKZHSQY-CjJj47De.js} +1 -1
- package/dist/public/assets/{liquid-Din4CF34.js → liquid-jff3p-Ji.js} +1 -1
- package/dist/public/assets/{mdx-DivDuCWI.js → mdx-DW4uRDfJ.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-BfCv4CYZ.js → mermaid-parser.core-XhQj6FvH.js} +3 -3
- package/dist/public/assets/{mermaid.core-DC20ZwJj.js → mermaid.core-OD4Atimg.js} +4 -4
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-DRZRrJU_.js → mindmap-definition-I2QAS2VK-DpGelVY7.js} +1 -1
- package/dist/public/assets/module-CrD0OHQp.js +1 -0
- package/dist/public/assets/module-DEBMgdtf.js +2273 -0
- package/dist/public/assets/{monaco-D1d6MOPe.js → monaco-BTVZP-tU.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-CBxQ5Mzy.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-DcGr3Tbk.js → pegDiagram-FD4XPPHP-CqcBmPfB.js} +1 -1
- package/dist/public/assets/phaser.esm-BxCDEWDb.js +3202 -0
- package/dist/public/assets/pie-XZMESJXO-DT5V3581.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-GF7pu6ch.js → pieDiagram-J4AKIIQI-CRir3beB.js} +1 -1
- package/dist/public/assets/{python-BQbTTTT5.js → python-BwW_0207.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-D-bcu7Ey.js → quadrantDiagram-XTYBLID2-DIY6gdcf.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-BAOovYEa.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-RZ2Rnwzh.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-BiBHsI-K.js → railroad-abnf-LNEFI6M7-XWNOzunl.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-zKjrfkHs.js → railroad-ebnf-DWYD2UWJ-CI0-j1Jz.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-DKuVn0GT.js → railroad-peg-JR7BVNR7-BVB_IaIG.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-Cyn-16mJ.js → railroadDiagram-MRQ6NCDL-CudwT6q2.js} +1 -1
- package/dist/public/assets/{razor-DiLk54O0.js → razor-DrjCyQqB.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-CwU2EBkW.js → requirementDiagram-Y7LWUY3S-CvRMeRqj.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-ajf00HyW.js → sankeyDiagram-WGJFYUXA-adxYCJKr.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-DiX_OIAw.js → sequenceDiagram-5NDRBG5M-lCRsoLUp.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-CV5bRqB7.js → stateDiagram-v2-FJ4FJNEA-DNst1BLg.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-BGQKSlj7.js → swimlanes-UMQ2AFYF-S_omrdvA.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-By5lnz4u.js +8 -0
- package/dist/public/assets/three.module-CeVBJVoU.js +4225 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-DhQoApff.js → timeline-definition-SEUHKTQE-_pMGrTE-.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-Cyb9N8KY.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-BkMo57pG.js +1 -0
- package/dist/public/assets/{typescript-COQ1g-up.js → typescript-0-z_OYCU.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-CmLFzjie.js → usecaseDiagram-AFA6YXN4-B2oJKi5Q.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-DOa6JR5K.js → vennDiagram-NNMJR3RB-inPs2Kkr.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-CSt-uQ-Y.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-BV7EEShp.js → wardleyDiagram-S7YFUSEH-DNhNHM7b.js} +1 -1
- package/dist/public/assets/{xml-BbvtjuaG.js → xml-BXPxQzKF.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-DtMpPbsq.js → xychartDiagram-GGNKY7IX-DJc93dNT.js} +1 -1
- package/dist/public/assets/{yaml-Bw8NFga9.js → yaml-CGmD9Rya.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/serve/index.mjs +6664 -2480
- package/package.json +32 -25
- package/dist/public/assets/cynefin-EF2NZ3EQ-MaI-3dMQ.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-shBnAQFk.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-BtQWboBz.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-CDSLjba_.js +0 -1
- package/dist/public/assets/module-BAQaY56j.js +0 -1
- package/dist/public/assets/module-DxRGg3ED.js +0 -1947
- package/dist/public/assets/packet-JDAUHWVQ-dYb4P9eU.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-CIompBnc.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-DiJl7BtK.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-B5cRBukM.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-DxXlavVT.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB-BOP6mkZC.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-BJxuPMz3.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-jqlowjVL.js +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STYLE = void 0;
|
|
4
|
+
exports.injectStyle = injectStyle;
|
|
5
|
+
/** The styles of the package; only the --ta-* variables of the page, so they follow its theme. */
|
|
6
|
+
exports.STYLE = `
|
|
7
|
+
.tgm-scroll { flex: 1; min-height: 0; height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
|
|
8
|
+
.tgm { display: flex; flex-direction: column; gap: 28px; width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 20px 40px; box-sizing: border-box; }
|
|
9
|
+
.tgm-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; }
|
|
10
|
+
.tgm-title { flex: 1; min-width: 0; color: var(--ta-text); font-size: calc(15px * var(--ta-font-scale)); line-height: calc(22px * var(--ta-font-scale)); font-weight: 600; }
|
|
11
|
+
.tgm-link { padding: 4px 8px; margin-right: -8px; border: 0; border-radius: 8px; background: none; color: var(--ta-accent); font: inherit; font-size: calc(13px * var(--ta-font-scale)); cursor: pointer; }
|
|
12
|
+
.tgm-link:hover { background: var(--ta-hover); }
|
|
13
|
+
.tgm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); row-gap: 16px; margin: 0 -2px; }
|
|
14
|
+
.tgm-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; padding: 4px 2px; border: 0; border-radius: 14px; background: none; color: var(--ta-text); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
|
|
15
|
+
.tgm-icon { position: relative; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 17px; background: var(--tgm-tint); color: var(--tgm-ink); transition: transform 160ms var(--ta-ease, ease-out); }
|
|
16
|
+
.tgm-tile:active .tgm-icon { transform: scale(0.92); }
|
|
17
|
+
.tgm-link.ta-busy { position: relative; }
|
|
18
|
+
.tgm-icon > .ta-busy-mark { width: 22px; height: 22px; border-width: 2.2px; border-color: color-mix(in srgb, var(--tgm-ink) 25%, transparent); border-top-color: var(--tgm-ink); }
|
|
19
|
+
.tgm-dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--ta-green); box-shadow: 0 0 0 2px var(--ta-main); }
|
|
20
|
+
.tgm-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-body, var(--ta-text)); font-size: calc(12.5px * var(--ta-font-scale)); line-height: calc(17px * var(--ta-font-scale)); }
|
|
21
|
+
.tgm-empty { display: flex; flex-direction: column; padding: 12px 0; }
|
|
22
|
+
.tgm-label { margin: 0 2px 4px; color: var(--ta-text); font-size: calc(15px * var(--ta-font-scale)); line-height: calc(22px * var(--ta-font-scale)); font-weight: 600; }
|
|
23
|
+
.tgm-note { margin: 0 2px 12px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); }
|
|
24
|
+
:root[data-handheld] .tgm { padding: 16px 14px 32px; gap: 22px; }
|
|
25
|
+
`;
|
|
26
|
+
function injectStyle() {
|
|
27
|
+
const style = document.createElement('style');
|
|
28
|
+
style.dataset.taGames = '';
|
|
29
|
+
style.textContent = exports.STYLE;
|
|
30
|
+
document.head.appendChild(style);
|
|
31
|
+
return () => style.remove();
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@celljs/ta-games",
|
|
3
|
+
"version": "4.12.0",
|
|
4
|
+
"description": "A pi package for Ta: games and game-like extensions on Phaser and Three.js, the game engines of Ta's web page, with the ta-game skill and the Games page",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/cellbang/cell",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/cellbang/cell/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/cellbang/cell.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"web",
|
|
19
|
+
"host",
|
|
20
|
+
"skills",
|
|
21
|
+
"!**/*.map"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc -b && node scripts/phaser-skills.mjs && bun build web-src/index.tsx --format esm --target browser --outfile web/index.js && bun build web-src/host.ts --format esm --target node --outfile host/index.mjs",
|
|
25
|
+
"clean": "rm -rf lib web host skills/ta-game/phaser *.tsbuildinfo",
|
|
26
|
+
"test": "bun test ./lib",
|
|
27
|
+
"watch": "tsc -b -w --preserveWatchOutput"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@celljs/ta-protocol": "workspace:*",
|
|
31
|
+
"@celljs/ta-web": "workspace:*",
|
|
32
|
+
"@types/react": "^19.3.0",
|
|
33
|
+
"phaser": "^4.2.1"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"pi": {
|
|
39
|
+
"title": {
|
|
40
|
+
"en": "Games",
|
|
41
|
+
"zh-CN": "游戏"
|
|
42
|
+
},
|
|
43
|
+
"summary": {
|
|
44
|
+
"en": "The Games page lists the extensions that are games and has Ta make more, on the game engines of the page (Phaser for 2D, Three.js for 3D); Dino Run and Stack come as examples.",
|
|
45
|
+
"zh-CN": "\"游戏\"页列出所有游戏扩展,也能让 Ta 再做;游戏用页面内置的引擎(2D 是 Phaser,3D 是 Three.js),自带恐龙快跑和叠方块两个示例。"
|
|
46
|
+
},
|
|
47
|
+
"icon": "Gamepad2",
|
|
48
|
+
"webActivation": "open",
|
|
49
|
+
"lists": [
|
|
50
|
+
"game"
|
|
51
|
+
],
|
|
52
|
+
"web": [
|
|
53
|
+
"./web/index.js"
|
|
54
|
+
],
|
|
55
|
+
"host": "./host/index.mjs",
|
|
56
|
+
"skills": [
|
|
57
|
+
"./skills"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ta-game
|
|
3
|
+
description: Makes a game, or something that plays like one (a pet that lives in a card, a little world of what Ta does, a score, a reward, a puzzle), as a web extension of Ta on the game engines of Ta's web page, Phaser 4 for 2D (pi.ui.Game) and Three.js for 3D (pi.ui.Game3D). Use it whenever the user wants to play something in Ta, or wants an extension to move, react and feel like a game, in 2D or 3D.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Games in Ta
|
|
7
|
+
|
|
8
|
+
A game in Ta is a web extension of a package, as the ta-package skill says: read that skill first, for where the package goes, its `package.json` and the rest of `pi`. This skill adds the engine. Keep the game small: one scene, shapes drawn in code, a few hundred lines.
|
|
9
|
+
|
|
10
|
+
## Two examples
|
|
11
|
+
|
|
12
|
+
Two whole games beside this file are packages written the way this skill says, and come to the user's `extensions/` the first time the Games page opens: `examples/dino-run/` (2D on Phaser: a runner, a pixel sprite drawn in code, a scene class, the best score kept) and `examples/stack/` (3D on Three.js: a tower of blocks, one geometry for all of them, a camera that follows, the score drawn by React over the game). Before writing a game, read the `web.js` of the one of the same engine and follow its shape: the rules in a class apart from what draws them, the page, the styles, the words in two languages. Copy from it rather than from memory of older versions of the engines. To change one of the user's, change its copy in `extensions/`, never the example.
|
|
13
|
+
|
|
14
|
+
## The engines
|
|
15
|
+
|
|
16
|
+
The page has two engines, and an extension imports neither, loads none from a CDN and brings no other: Phaser 4 for 2D (`pi.ui.Game`, below) and Three.js for 3D (`pi.ui.Game3D`, see "3D with Three.js"). Use 2D unless the user asks for 3D or the game is about depth (a maze to tilt, a tower, a world to fly over): 2D is lighter on a phone and Phaser has physics, input, sounds and scenes built in.
|
|
17
|
+
|
|
18
|
+
The page has Phaser 4 (the version of this skill's `phaser/LICENSE.md`) and gives it to web extensions through `pi.ui.Game`: never import Phaser, load it from a CDN or bring another engine. It loads the first time a game starts.
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
export default function (pi) {
|
|
22
|
+
const h = pi.React.createElement;
|
|
23
|
+
function Page() {
|
|
24
|
+
const config = pi.React.useCallback((Phaser, page) => ({
|
|
25
|
+
width: 480,
|
|
26
|
+
height: 270,
|
|
27
|
+
scene: {
|
|
28
|
+
create() {
|
|
29
|
+
const ball = this.add.circle(240, 135, 14, page.colors.green);
|
|
30
|
+
this.input.on('pointerdown', pointer => this.tweens.add({ targets: ball, x: pointer.worldX, y: pointer.worldY, duration: 200 }));
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}), []);
|
|
34
|
+
return h('div', { style: { display: 'flex', flexDirection: 'column', height: '100%' } }, h(pi.ui.Game, { config }));
|
|
35
|
+
}
|
|
36
|
+
pi.registerView('ball', { title: 'Ball', icon: pi.ui.icons.Gamepad2, render: Page });
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`pi.ui.Game` takes `{ config(Phaser, page), onReady?(game), className?, style? }`:
|
|
41
|
+
|
|
42
|
+
- `config` returns Phaser's game config without `parent`. It is read once, when the component mounts; give the component another React `key` to start the game again. A scene can be an object of `preload` / `create` / `update` (as above; its other functions are its methods, `this.build()` in `create`, as if in `extend`), or `class extends Phaser.Scene` written inside `config`, where `Phaser` is defined.
|
|
43
|
+
- What a scene's `init` / `preload` / `create` / `update` throws ends the game and shows the error in its place. Open the page once yourself after you write a game if you can; a game that shows an error is not done.
|
|
44
|
+
- The game fills the component, which fills its parent: give the parent a size (a column of flex with a height, or `aspect-ratio`). With `width` and `height` the game keeps that size and fits in the component, centered (`Scale.FIT`); without them it takes the size of the component and follows it (`Scale.RESIZE`: read `this.scale.width` / `height` and listen to `this.scale.on('resize', ...)`).
|
|
45
|
+
- The renderer is WebGL (`Phaser.AUTO`); there is no banner, and the background is the page's until `backgroundColor` is set.
|
|
46
|
+
- `onReady(game)` gets Phaser's `Game` once its first scene started, to talk to it from React (`game.scene.getScene(key)`, `game.events`).
|
|
47
|
+
- Several games can run at once, in a page, a card and a tab.
|
|
48
|
+
|
|
49
|
+
## A good guest of the page
|
|
50
|
+
|
|
51
|
+
- **Lifecycle.** The game sleeps while it cannot be seen (a page kept in the background, a tab not shown, a card scrolled away) and is destroyed when the component unmounts or the extension stops. So keep time inside Phaser (`this.time.addEvent`, `this.tweens`, `update(time, delta)`), never `setInterval` or `requestAnimationFrame` of your own, and move by `delta` (milliseconds) rather than by frames.
|
|
52
|
+
- **Input.** Pointer events are the mouse and a finger alike: `this.input.on('pointerdown' | 'pointermove' | 'pointerup', ...)`. Everything must be playable with taps or swipes on a phone, without a keyboard (`pi.ui.useDevice().touch` says there is a finger). The keyboard reaches the game only while it has the focus (the user clicked or tapped it), so that typing in the message box is never taken: `this.input.keyboard.on('keydown-SPACE', ...)` or `createCursorKeys()`; never listen on `window` or `document`.
|
|
53
|
+
- **Slides of the game and of Ta.** On a phone Ta has gestures of its own: a slide from the left edge goes back, a slide to the left brings out the workbench, a held finger opens a menu. On the element of `pi.ui.Game` and `pi.ui.Game3D` they give way: only a slide that starts at an edge of the screen (within 24 pixels) is Ta's, everything else that starts on the game is the game's, and neither a held finger, a right click, a pinch nor a double tap does anything of the page. So drag, swipe and hold freely in a game, but keep what is played 24 pixels off the edges of the screen (the padding of the page does), and leave the user a way out that is not a gesture: the page has its back button. By default the browser takes none of its touches (`touch-action: none`): a game played only by taps that sits in a page taller than the screen sets `touch-action: pan-y`, so that a slide up or down scrolls the page (see "A page scrolls itself"). An element of the extension's own that takes touches (a canvas to draw on, a joystick) gets the same with the attribute `data-own-gestures`. A game to play held sideways, or a world to walk in, goes in `pi.ui.FullScreen`: over all of the page and the notch, every touch its own (the edges too), so it needs its back button; keep its buttons inside `env(safe-area-inset-*)` and write `pi.ui.FullScreen ?? Fallback` for an older app.
|
|
54
|
+
- **The theme.** `page` is `{ theme: 'light' | 'dark', colors, touch, reduceMotion }`; `colors` has `main` (the background), `card`, `text`, `secondary`, `muted`, `border`, `accent`, `green` and `red` as numbers (`0xRRGGBB`) for Phaser's `fillStyle`, `circle`, `rectangle`. The game's registry holds the page as `'page'` and sets it again when the theme changes: `this.registry.get('page')` and `this.registry.events.on('changedata-page', (parent, page) => ...)` to paint again. Text colors are CSS strings: `'#' + color.toString(16).padStart(6, '0')`. With `reduceMotion`, no shaking, flashing or large movements that are only for show.
|
|
55
|
+
- **Sharp on any screen.** A game of a fixed size is drawn at that many pixels and scaled: for crisp lines and text, make it `devicePixelRatio` (at most 2) times larger and `this.cameras.main.setZoom(ratio).centerOn(width / 2, height / 2)`, with `resolution: ratio` in the style of each text.
|
|
56
|
+
- **Pictures.** Draw with `this.add.graphics()` (`fillStyle`, `fillRect`, `fillRoundedRect`, `fillCircle`), shapes (`this.add.rectangle`, `circle`, `star`), textures made in code (`graphics.generateTexture(key, w, h)`, or `this.textures.createCanvas(key, w, h)` and its 2D context, then `refresh()`), and emoji in `this.add.text`. Load no image or sound from the internet: a phone or a computer without a network must still play. A small picture of the user's can come from the workspace by `pi.files` as the ta-package skill says. Ta is drawn as its logo, `pi.ui.Avatar`, in React; in a scene, draw it as the game's own character.
|
|
57
|
+
- **Sound** is optional and off until the user turns it on in the game; Phaser unlocks audio after the first tap.
|
|
58
|
+
- **What it keeps.** Best scores, levels and settings go in `pi.storage` (`await pi.storage.get('best')`, `pi.storage.set('best', score)`), the same on every device; set them when a round ends, not every frame. Words of the game follow `pi.ui.language`.
|
|
59
|
+
- **Its size.** A page keeps the frame rate on a phone with up to some thousands of sprites; a card of the board or a widget should stay at tens. Reuse objects (`this.add.group` with `get` / `killAndHide`) rather than making and destroying them every frame.
|
|
60
|
+
|
|
61
|
+
## 3D with Three.js
|
|
62
|
+
|
|
63
|
+
`pi.ui.Game3D` takes `{ setup(context), onReady?(context), className?, style? }`. The page makes the renderer, runs the loop and follows the size; `setup` runs once, puts things in `context.scene` and returns what to do each frame:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
export default function (pi) {
|
|
67
|
+
const h = pi.React.createElement;
|
|
68
|
+
function Page() {
|
|
69
|
+
const setup = pi.React.useCallback(({ THREE, OrbitControls, scene, camera, element, page }) => {
|
|
70
|
+
camera.position.set(3, 3, 5);
|
|
71
|
+
camera.lookAt(0, 0, 0);
|
|
72
|
+
scene.add(new THREE.HemisphereLight(0xffffff, 0x707070, 1.8));
|
|
73
|
+
const cube = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshLambertMaterial({ color: page.colors.green }));
|
|
74
|
+
scene.add(cube);
|
|
75
|
+
const controls = new OrbitControls(camera, element);
|
|
76
|
+
return {
|
|
77
|
+
update(seconds) { cube.rotation.y += seconds; controls.update(); },
|
|
78
|
+
page(next) { cube.material.color.setHex(next.colors.green); },
|
|
79
|
+
dispose() { controls.dispose(); },
|
|
80
|
+
};
|
|
81
|
+
}, []);
|
|
82
|
+
return h('div', { style: { display: 'flex', flexDirection: 'column', height: '100%' } }, h(pi.ui.Game3D, { setup }));
|
|
83
|
+
}
|
|
84
|
+
pi.registerView('cube', { title: 'Cube', icon: pi.ui.icons.Gamepad2, render: Page });
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- `context` has `THREE` (the whole of `three`, r187), `OrbitControls` (its only addon here), `renderer` (a WebGLRenderer, antialiased, transparent over the page until `scene.background` is set, at the pixel ratio of the screen up to 2), `scene`, `camera` (a PerspectiveCamera of 50° at (0, 0, 5) looking at the origin; set `context.camera` to another one to use it), `element` (for pointer and key events), `page` (as for Phaser, the latest) and `width` / `height`.
|
|
89
|
+
- The loop: `update(seconds, elapsed)` each frame while it can be seen (`seconds` at most 0.1, time asleep not counted), then the page renders `scene` with `camera`, or calls `render()` if the loop has one. `resize(width, height)` when the element changes size (the renderer and a PerspectiveCamera already have it), `page(page)` when the theme or motion changes, `dispose()` before it ends. Move by `seconds`, never by frames; never `requestAnimationFrame`, `setInterval` or `THREE.Clock` of your own.
|
|
90
|
+
- The same rules as for Phaser: a parent with a size (a 3D view wants `aspect-ratio` or the height of a page), listeners on `element` only (`pointerdown` / `pointermove` / `pointerup` for mouse and finger; `keydown` while it has the focus), the colors of `page.colors` (numbers for `color`, `setHex`), no models, textures or sounds from the internet (shapes in code: `BoxGeometry`, `SphereGeometry`, `CylinderGeometry`, `CapsuleGeometry`, `TorusGeometry`, `ExtrudeGeometry` of a `Shape`, textures drawn on a canvas with `CanvasTexture`), scores in `pi.storage`, less motion with `reduceMotion`.
|
|
91
|
+
- What the scene holds when it ends (geometries, materials, their textures, `scene.background`) the page disposes, and it gives the WebGL context back; dispose yourself only what you take out of the scene before, and stop what is not in it (`controls.dispose()` in `dispose`).
|
|
92
|
+
- On a phone: a few hundred meshes at most; share one geometry and one material between meshes alike (or an `InstancedMesh`), `MeshLambertMaterial` or `MeshStandardMaterial`, no shadows unless they matter (`renderer.shadowMap.enabled` and one light that casts them).
|
|
93
|
+
- Text and scores are best drawn by React over the game (an element of `position: absolute` over the parent, `pointer-events: none`), told by the setup through a callback: sharp, in the font of the page, in its language.
|
|
94
|
+
- Collisions by hand: `THREE.Box3` / `Sphere` and `intersectsBox`, a `Raycaster` for what the pointer is on (`raycaster.setFromCamera(ndc, camera)`, `ndc` from the pointer and `element.getBoundingClientRect()`). There is no physics engine.
|
|
95
|
+
|
|
96
|
+
What most often goes wrong from older Three.js:
|
|
97
|
+
|
|
98
|
+
- Only `BufferGeometry`: `THREE.Geometry`, `Face3` and `vertices` are gone.
|
|
99
|
+
- Colors are managed: `renderer.outputEncoding` and `sRGBEncoding` are gone (`outputColorSpace`, `SRGBColorSpace`; a texture of colors drawn on a canvas sets `texture.colorSpace = THREE.SRGBColorSpace`).
|
|
100
|
+
- Lights are physical, `useLegacyLights` and `physicallyCorrectLights` are gone: a hemisphere light of about 1.5 to 2 and a directional one of about 1.5 light a scene of Lambert materials; values of old examples (0.5, 1) leave it dark.
|
|
101
|
+
- `THREE.Clock` is deprecated (r183): the loop gives the time.
|
|
102
|
+
- Addons are not importable (`three/addons/...`): only `context.OrbitControls`; no GLTFLoader, no post-processing, no WebGPU renderer or TSL.
|
|
103
|
+
|
|
104
|
+
## Where a game shows
|
|
105
|
+
|
|
106
|
+
- A page scrolls itself: Ta's main area does not, so the root of a page taller than the window is `{ height: '100%', overflowY: 'auto' }`. On a phone a game as wide as the page is where the finger is: unless it is played by dragging, let a slide up or down scroll the page (`touch-action: pan-y` on the element of the game) and play on a tap as the finger lifts, a slide being cancelled by the browser before. With Phaser, `input: { touch: { capture: false } }` in the config and `this.input.on('pointerup', pointer => pointer.wasTouch && play())` beside `pointerdown` for the mouse; with Three.js, `pointerup` of a pointer whose `pointerType` is not `'mouse'`.
|
|
107
|
+
|
|
108
|
+
- A 3D game shows the same ways; keep one 3D game per page, and none in widgets: each is a WebGL context of its own, and browsers allow a few at once.
|
|
109
|
+
- A game to play: a `page` view (`registerView`), with `"category": "game"` in `pi` (the Games page lists the extensions of that category, and opens their first page; they are not under Discover or in the navigation) and `"webActivation": "open"` when it is played now and then; or a temporary extension (the ta-package skill), when the user only wants to try it. Name its directory and package after the game (`snake`), and give `pi` its `title`, `summary` and `icon` (`Gamepad2` unless another fits).
|
|
110
|
+
- Something that plays like a game beside the work: a `board` card (a few lines high: a pet, a little world of the tasks, a streak), a `panel` card with `ui.setWidget`, or a widget above the message box. Its game reacts to what happens: `pi.on('agent_start' | 'agent_end' | 'tool_execution_end', ...)` for the conversation shown, `pi.ui.useTasks()` for the double's tasks, `pi.packages.callPackageHost('@celljs/ta-cron', 'list')` for scheduled tasks. Hand what React knows to the scene through the registry (`game.registry.set('tasks', tasks)` in an effect, `this.registry.events.on('changedata-tasks', ...)` in the scene).
|
|
111
|
+
|
|
112
|
+
## Phaser 4
|
|
113
|
+
|
|
114
|
+
Most of what you know of Phaser 3 holds, but not all. Before you use a part of the engine you are not sure of, read its file here: `phaser/<topic>/SKILL.md` and the files of its `references/` (the skills Phaser ships for agents). The topics are `game-setup-and-config`, `scenes`, `sprites-and-images`, `graphics-and-shapes`, `text-and-bitmaptext`, `input-keyboard-mouse-touch`, `tweens`, `time-and-timers`, `animations`, `physics-arcade`, `physics-matter`, `particles`, `cameras`, `groups-and-containers`, `tilemaps`, `loading-assets`, `audio-and-sound`, `render-textures`, `filters-and-postfx`, `curves-and-paths`, `geometry-and-math`, `data-manager`, `events-system`, `scale-and-responsive`, `game-object-components`, `actions-and-utilities`, `v4-new-features` and `v3-to-v4-migration`. What most often goes wrong from Phaser 3:
|
|
115
|
+
|
|
116
|
+
- FX, `preFX` / `postFX` and `BitmapMask` are gone: effects and masks are filters (`filters-and-postfx`).
|
|
117
|
+
- `setTintFill(color)` is gone: `setTint(color).setTintMode(Phaser.TintModes.FILL)`.
|
|
118
|
+
- `Phaser.Geom.Point` is gone: `Phaser.Math.Vector2`. `Phaser.Math.TAU` is `2π` now, and `Math.PI2` is gone.
|
|
119
|
+
- `Mesh` and `Plane` are gone; there is no 3D.
|
|
120
|
+
- A `DynamicTexture` or `RenderTexture` draws only when its `render()` is called.
|
|
121
|
+
- Do not use the Canvas renderer, and make no WebGL calls of your own.
|
|
122
|
+
|
|
123
|
+
## Check before you answer
|
|
124
|
+
|
|
125
|
+
1. `node --check web.js`.
|
|
126
|
+
2. Read the config or the setup once more against the rules above: no import, no `window` listeners, no timers of its own, no image, model or sound from the internet, a parent with a size, playable with a finger, the pitfalls of Phaser 4 or of Three.js avoided.
|
|
127
|
+
3. Tell the user in one or two sentences how to play and where the game is (the Games page, and Quick open). No file listings unless asked.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dino-run",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Dino Run: Ta's dinosaur jumps cacti that come faster and faster",
|
|
6
|
+
"pi": {
|
|
7
|
+
"title": {
|
|
8
|
+
"en": "Dino Run",
|
|
9
|
+
"zh-CN": "恐龙快跑"
|
|
10
|
+
},
|
|
11
|
+
"summary": {
|
|
12
|
+
"en": "Jump the cacti with space or a tap; the best score is kept on every device.",
|
|
13
|
+
"zh-CN": "空格键或轻点起跳,跳过越来越快的仙人掌;最高分各设备同步。"
|
|
14
|
+
},
|
|
15
|
+
"icon": "Gamepad2",
|
|
16
|
+
"category": "game",
|
|
17
|
+
"webActivation": "open",
|
|
18
|
+
"web": [
|
|
19
|
+
"./web.js"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
// Dino Run, a web extension of Ta on Phaser 4 (pi.ui.Game): the example of a 2D game of the ta-game skill.
|
|
2
|
+
// The rules (DinoRules) are apart from what draws them (the scene in config), so that they can be tested.
|
|
3
|
+
|
|
4
|
+
/** The sizes and the feel of the run, in pixels of the world and seconds. */
|
|
5
|
+
export const RUN_TUNING = {
|
|
6
|
+
width: 600,
|
|
7
|
+
height: 200,
|
|
8
|
+
ground: 178,
|
|
9
|
+
dinoX: 56,
|
|
10
|
+
dinoSize: 46,
|
|
11
|
+
gravity: 2600,
|
|
12
|
+
jumpSpeed: 860,
|
|
13
|
+
startSpeed: 380,
|
|
14
|
+
acceleration: 9,
|
|
15
|
+
maxSpeed: 920,
|
|
16
|
+
/** A restart waits that long after a fall, so that a jump held on does not start again at once. */
|
|
17
|
+
restartAfter: 0.45,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Pixels of the world per point of the score. */
|
|
21
|
+
const PIXELS_PER_POINT = 40;
|
|
22
|
+
/** What a collision forgives on each side: the dinosaur is not a box. */
|
|
23
|
+
const FORGIVE = 7;
|
|
24
|
+
/** The key of the package data that holds the best score, the same on every device. */
|
|
25
|
+
const BEST_KEY = 'best';
|
|
26
|
+
|
|
27
|
+
/** The dinosaur in pixels, facing right: `#` its body, `o` its eye; then its legs, two frames of a step. */
|
|
28
|
+
const DINO = [
|
|
29
|
+
'..........######',
|
|
30
|
+
'.........##o####',
|
|
31
|
+
'.........#######',
|
|
32
|
+
'.........#######',
|
|
33
|
+
'.........####...',
|
|
34
|
+
'.........######.',
|
|
35
|
+
'#.......#####...',
|
|
36
|
+
'#......#######..',
|
|
37
|
+
'##...#########..',
|
|
38
|
+
'###.#######.#...',
|
|
39
|
+
'###########.....',
|
|
40
|
+
'.#########......',
|
|
41
|
+
'..#######.......',
|
|
42
|
+
'...#####........',
|
|
43
|
+
];
|
|
44
|
+
const LEGS = [
|
|
45
|
+
['...##.##........', '...#...#........', '...##..##.......'],
|
|
46
|
+
['...##.##........', '...##...#.......', '.......##.......'],
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The rules of the run: the dinosaur jumps over cacti that come faster and faster. Time goes by `step`
|
|
51
|
+
* (seconds); `random` decides the cacti.
|
|
52
|
+
*/
|
|
53
|
+
export class DinoRules {
|
|
54
|
+
constructor(tuning = RUN_TUNING, random = Math.random) {
|
|
55
|
+
this.tuning = tuning;
|
|
56
|
+
this.random = random;
|
|
57
|
+
this.restart();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
get score() {
|
|
61
|
+
return Math.floor(this.distance / PIXELS_PER_POINT);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get onGround() {
|
|
65
|
+
return this.lift <= 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
restart() {
|
|
69
|
+
/** `ready`, `running` or `over`. */
|
|
70
|
+
this.state = 'ready';
|
|
71
|
+
/** How high the dinosaur is above the ground, and how fast it goes up. */
|
|
72
|
+
this.lift = 0;
|
|
73
|
+
this.rise = 0;
|
|
74
|
+
this.speed = this.tuning.startSpeed;
|
|
75
|
+
this.distance = 0;
|
|
76
|
+
/** Each `{ x, width, height }`, standing on the ground. */
|
|
77
|
+
this.cacti = [];
|
|
78
|
+
this.gap = 0;
|
|
79
|
+
this.since = 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The tap or the key: starts, jumps, or starts again once a fall has settled. True when it did something. */
|
|
83
|
+
jump() {
|
|
84
|
+
if (this.state === 'ready') {
|
|
85
|
+
this.state = 'running';
|
|
86
|
+
this.rise = this.tuning.jumpSpeed;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if (this.state === 'over') {
|
|
90
|
+
if (this.since < this.tuning.restartAfter) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
this.restart();
|
|
94
|
+
this.state = 'running';
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
if (!this.onGround) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
this.rise = this.tuning.jumpSpeed;
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** `seconds` of the game; a long one (a tab left a while) counts as a short one. True when it fell now. */
|
|
105
|
+
step(seconds) {
|
|
106
|
+
const dt = Math.min(seconds, 0.05);
|
|
107
|
+
if (this.state === 'over') {
|
|
108
|
+
this.since += dt;
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
if (this.state === 'ready') {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
const { tuning } = this;
|
|
115
|
+
this.rise -= tuning.gravity * dt;
|
|
116
|
+
this.lift = Math.max(0, this.lift + this.rise * dt);
|
|
117
|
+
if (this.lift === 0 && this.rise < 0) {
|
|
118
|
+
this.rise = 0;
|
|
119
|
+
}
|
|
120
|
+
this.speed = Math.min(tuning.maxSpeed, this.speed + tuning.acceleration * dt);
|
|
121
|
+
const moved = this.speed * dt;
|
|
122
|
+
this.distance += moved;
|
|
123
|
+
for (const cactus of this.cacti) {
|
|
124
|
+
cactus.x -= moved;
|
|
125
|
+
}
|
|
126
|
+
this.cacti = this.cacti.filter(cactus => cactus.x + cactus.width > -10);
|
|
127
|
+
this.gap -= moved;
|
|
128
|
+
if (this.gap <= 0) {
|
|
129
|
+
this.cacti.push(this.cactus());
|
|
130
|
+
this.gap = this.nextGap();
|
|
131
|
+
}
|
|
132
|
+
if (this.hit()) {
|
|
133
|
+
this.state = 'over';
|
|
134
|
+
this.since = 0;
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Whether the dinosaur touches a cactus. */
|
|
141
|
+
hit() {
|
|
142
|
+
const { dinoX, dinoSize, ground } = this.tuning;
|
|
143
|
+
const left = dinoX + FORGIVE;
|
|
144
|
+
const right = dinoX + dinoSize - FORGIVE;
|
|
145
|
+
const bottom = ground - this.lift - FORGIVE / 2;
|
|
146
|
+
return this.cacti.some(cactus => cactus.x < right && cactus.x + cactus.width > left && bottom > ground - cactus.height);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
cactus() {
|
|
150
|
+
const tall = this.random() < 0.35;
|
|
151
|
+
const width = 14 + Math.round(this.random() * (tall ? 10 : 22));
|
|
152
|
+
const height = tall ? 46 + Math.round(this.random() * 12) : 28 + Math.round(this.random() * 14);
|
|
153
|
+
return { x: this.tuning.width + 20, width, height };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Room enough to land and jump again at this speed: the time of a jump in the air, times the speed, and a random part more. */
|
|
157
|
+
nextGap() {
|
|
158
|
+
const air = (2 * this.tuning.jumpSpeed) / this.tuning.gravity;
|
|
159
|
+
const least = this.speed * air + 60;
|
|
160
|
+
return least + this.random() * least * 1.2;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const hex = color => `#${color.toString(16).padStart(6, '0')}`;
|
|
165
|
+
|
|
166
|
+
const WORDS = {
|
|
167
|
+
en: {
|
|
168
|
+
title: 'Dino Run',
|
|
169
|
+
best: 'Best {score}',
|
|
170
|
+
startKey: 'Space or tap to start',
|
|
171
|
+
startTouch: 'Tap to start',
|
|
172
|
+
over: 'Ouch! Tap to run again',
|
|
173
|
+
},
|
|
174
|
+
zh: {
|
|
175
|
+
title: '恐龙快跑',
|
|
176
|
+
best: '最高 {score}',
|
|
177
|
+
startKey: '按空格键或轻点开始',
|
|
178
|
+
startTouch: '轻点开始',
|
|
179
|
+
over: '撞上了!轻点再跑一次',
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const STYLE = `
|
|
184
|
+
.dnr-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
|
|
185
|
+
.dnr { display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 20px 40px; box-sizing: border-box; }
|
|
186
|
+
.dnr-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; }
|
|
187
|
+
.dnr-title { flex: 1; color: var(--ta-text); font-size: calc(15px * var(--ta-font-scale)); line-height: calc(22px * var(--ta-font-scale)); font-weight: 600; }
|
|
188
|
+
.dnr-best { display: inline-flex; align-items: center; gap: 5px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
|
|
189
|
+
.dnr-stage { display: flex; flex-direction: column; aspect-ratio: 3 / 1; border: 1px solid var(--ta-border); border-radius: 12px; background: var(--ta-card); overflow: hidden; }
|
|
190
|
+
/* A finger sliding up or down over the game scrolls the page; a tap plays as it lifts. */
|
|
191
|
+
.dnr-stage .ta-game { touch-action: pan-y; }
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
export default function (pi) {
|
|
195
|
+
const { React } = pi;
|
|
196
|
+
const h = React.createElement;
|
|
197
|
+
const style = document.createElement('style');
|
|
198
|
+
style.textContent = STYLE;
|
|
199
|
+
document.head.appendChild(style);
|
|
200
|
+
|
|
201
|
+
/** The dinosaur in the green of the theme, a texture of each frame (`dino0`, `dino1`), drawn at the size the screen shows it. */
|
|
202
|
+
function drawDino(scene, page, zoom) {
|
|
203
|
+
const rows = DINO.length + LEGS[0].length;
|
|
204
|
+
const cell = Math.ceil((RUN_TUNING.dinoSize / rows) * zoom);
|
|
205
|
+
for (const [frame, legs] of LEGS.entries()) {
|
|
206
|
+
const key = `dino${frame}`;
|
|
207
|
+
if (scene.textures.exists(key)) {
|
|
208
|
+
scene.textures.remove(key);
|
|
209
|
+
}
|
|
210
|
+
const art = [...DINO, ...legs];
|
|
211
|
+
const texture = scene.textures.createCanvas(key, art[0].length * cell, rows * cell);
|
|
212
|
+
const context = texture.getContext();
|
|
213
|
+
art.forEach((row, y) => {
|
|
214
|
+
[...row].forEach((pixel, x) => {
|
|
215
|
+
if (pixel !== '.') {
|
|
216
|
+
context.fillStyle = hex(pixel === 'o' ? page.colors.card : page.colors.green);
|
|
217
|
+
context.fillRect(x * cell, y * cell, cell, cell);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
texture.refresh();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The scene of the run, a class of the engine, which loads with the first game. */
|
|
226
|
+
function makeScene(Phaser, hooks, zoom) {
|
|
227
|
+
const { width, height, ground, dinoX, dinoSize } = RUN_TUNING;
|
|
228
|
+
// As wide as the art is to its height.
|
|
229
|
+
const dinoWidth = (dinoSize * DINO[0].length) / (DINO.length + LEGS[0].length);
|
|
230
|
+
return class DinoRunScene extends Phaser.Scene {
|
|
231
|
+
create() {
|
|
232
|
+
this.rules = new DinoRules();
|
|
233
|
+
this.page = this.registry.get('page');
|
|
234
|
+
this.cameras.main.setZoom(zoom).centerOn(width / 2, height / 2);
|
|
235
|
+
this.world = this.add.graphics();
|
|
236
|
+
drawDino(this, this.page, zoom);
|
|
237
|
+
this.dino = this.add.image(dinoX, ground, 'dino0').setOrigin(0, 1).setDisplaySize(dinoWidth, dinoSize);
|
|
238
|
+
const font = getComputedStyle(document.body).fontFamily || 'sans-serif';
|
|
239
|
+
this.score = this.add.text(width - 14, 12, '', { fontFamily: font, fontSize: '17px', resolution: zoom }).setOrigin(1, 0);
|
|
240
|
+
this.message = this.add
|
|
241
|
+
.text(width / 2, 82, '', {
|
|
242
|
+
fontFamily: font,
|
|
243
|
+
fontSize: '20px',
|
|
244
|
+
resolution: zoom,
|
|
245
|
+
align: 'center',
|
|
246
|
+
lineSpacing: 6,
|
|
247
|
+
})
|
|
248
|
+
.setOrigin(0.5);
|
|
249
|
+
this.time0 = 0;
|
|
250
|
+
this.paint();
|
|
251
|
+
// The mouse jumps as it goes down; a finger as it lifts, a slide being the page's scroll.
|
|
252
|
+
this.input.on('pointerdown', pointer => !pointer.wasTouch && this.rules.jump());
|
|
253
|
+
this.input.on('pointerup', pointer => pointer.wasTouch && this.rules.jump());
|
|
254
|
+
this.input.keyboard.on('keydown-SPACE', event => {
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
this.rules.jump();
|
|
257
|
+
});
|
|
258
|
+
this.input.keyboard.on('keydown-UP', () => this.rules.jump());
|
|
259
|
+
this.registry.events.on('changedata-page', (_parent, page) => {
|
|
260
|
+
this.page = page;
|
|
261
|
+
drawDino(this, page, zoom);
|
|
262
|
+
this.paint();
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
update(_time, delta) {
|
|
267
|
+
const { rules } = this;
|
|
268
|
+
if (rules.step(delta / 1000)) {
|
|
269
|
+
hooks.over(rules.score);
|
|
270
|
+
}
|
|
271
|
+
const motion = !this.page.reduceMotion;
|
|
272
|
+
this.time0 += delta;
|
|
273
|
+
const step = motion && rules.state === 'running' && rules.onGround ? Math.floor(this.time0 / 90) % 2 : 0;
|
|
274
|
+
this.dino.setTexture(`dino${step}`).setDisplaySize(dinoWidth, dinoSize);
|
|
275
|
+
this.dino.y = ground - rules.lift;
|
|
276
|
+
this.dino.setAlpha(rules.state === 'over' ? 0.55 : 1);
|
|
277
|
+
this.drawWorld();
|
|
278
|
+
this.score.setText(String(rules.score).padStart(5, '0'));
|
|
279
|
+
const words = hooks.words();
|
|
280
|
+
this.message.setText(rules.state === 'ready' ? words.start : rules.state === 'over' ? `${words.over}\n${words.best}` : '');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
paint() {
|
|
284
|
+
this.score.setColor(hex(this.page.colors.muted));
|
|
285
|
+
this.message.setColor(hex(this.page.colors.secondary));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
drawWorld() {
|
|
289
|
+
const { colors } = this.page;
|
|
290
|
+
const { world, rules } = this;
|
|
291
|
+
world.clear();
|
|
292
|
+
world.fillStyle(colors.border, 1);
|
|
293
|
+
world.fillRect(0, ground, width, 1.5);
|
|
294
|
+
// Pebbles that go by with the ground.
|
|
295
|
+
const offset = rules.distance % 48;
|
|
296
|
+
for (let x = -offset; x < width; x += 48) {
|
|
297
|
+
world.fillRect(x + 11, ground + 8, 6, 1.5);
|
|
298
|
+
world.fillRect(x + 33, ground + 14, 3, 1.5);
|
|
299
|
+
}
|
|
300
|
+
world.fillStyle(colors.secondary, 1);
|
|
301
|
+
for (const cactus of rules.cacti) {
|
|
302
|
+
const top = ground - cactus.height;
|
|
303
|
+
world.fillRoundedRect(cactus.x, top, cactus.width, cactus.height + 1, Math.min(6, cactus.width / 2));
|
|
304
|
+
if (cactus.height > 34) {
|
|
305
|
+
const arm = Math.max(4, Math.round(cactus.width / 3));
|
|
306
|
+
world.fillRoundedRect(cactus.x - arm + 1, top + 12, arm, 12, 2);
|
|
307
|
+
world.fillRoundedRect(cactus.x + cactus.width - 1, top + 18, arm, 10, 2);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function Page() {
|
|
315
|
+
const words = pi.ui.language.startsWith('zh') ? WORDS.zh : WORDS.en;
|
|
316
|
+
const touch = pi.ui.useDevice().touch;
|
|
317
|
+
const [best, setBest] = React.useState(0);
|
|
318
|
+
const kept = React.useRef({ best: 0, words, touch });
|
|
319
|
+
kept.current = { ...kept.current, words, touch };
|
|
320
|
+
React.useEffect(() => {
|
|
321
|
+
let live = true;
|
|
322
|
+
const read = () =>
|
|
323
|
+
pi.storage.get(BEST_KEY).then(value => {
|
|
324
|
+
if (live && typeof value === 'number') {
|
|
325
|
+
kept.current.best = value;
|
|
326
|
+
setBest(value);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
read();
|
|
330
|
+
const off = pi.storage.onChange(keys => keys.includes(BEST_KEY) && read());
|
|
331
|
+
return () => {
|
|
332
|
+
live = false;
|
|
333
|
+
off();
|
|
334
|
+
};
|
|
335
|
+
}, []);
|
|
336
|
+
const config = React.useCallback((Phaser, _page) => {
|
|
337
|
+
// Drawn at twice the world on a screen of two, so that lines and text stay sharp.
|
|
338
|
+
const zoom = Math.max(1, Math.min(2, Math.round(globalThis.devicePixelRatio || 1)));
|
|
339
|
+
const hooks = {
|
|
340
|
+
over: score => {
|
|
341
|
+
if (score > kept.current.best) {
|
|
342
|
+
kept.current.best = score;
|
|
343
|
+
setBest(score);
|
|
344
|
+
pi.storage.set(BEST_KEY, score);
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
words: () => {
|
|
348
|
+
const { words, touch, best } = kept.current;
|
|
349
|
+
return {
|
|
350
|
+
start: touch ? words.startTouch : words.startKey,
|
|
351
|
+
over: words.over,
|
|
352
|
+
best: words.best.replace('{score}', best),
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
return {
|
|
357
|
+
width: RUN_TUNING.width * zoom,
|
|
358
|
+
height: RUN_TUNING.height * zoom,
|
|
359
|
+
// A finger sliding over the game scrolls the page: Phaser leaves its touches alone.
|
|
360
|
+
input: { touch: { capture: false } },
|
|
361
|
+
scene: makeScene(Phaser, hooks, zoom),
|
|
362
|
+
};
|
|
363
|
+
}, []);
|
|
364
|
+
const Trophy = pi.ui.icons.Trophy;
|
|
365
|
+
return h(
|
|
366
|
+
'div',
|
|
367
|
+
{ className: 'dnr-scroll' },
|
|
368
|
+
h(
|
|
369
|
+
'div',
|
|
370
|
+
{ className: 'dnr' },
|
|
371
|
+
h(
|
|
372
|
+
'div',
|
|
373
|
+
{ className: 'dnr-head' },
|
|
374
|
+
// The bar of the page shows its title: here the best score only.
|
|
375
|
+
h('div', { className: 'dnr-title' }),
|
|
376
|
+
h('div', { className: 'dnr-best' }, Trophy ? h(Trophy, { size: 14 }) : null, words.best.replace('{score}', best)),
|
|
377
|
+
),
|
|
378
|
+
h('div', { className: 'dnr-stage' }, h(pi.ui.Game, { config })),
|
|
379
|
+
),
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
pi.registerView('dino-run', {
|
|
384
|
+
title: () => (pi.ui.language.startsWith('zh') ? WORDS.zh.title : WORDS.en.title),
|
|
385
|
+
icon: pi.ui.icons.Gamepad2,
|
|
386
|
+
render: Page,
|
|
387
|
+
});
|
|
388
|
+
return () => style.remove();
|
|
389
|
+
}
|