@celljs/ta 4.14.0 → 4.15.1
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/cli.mjs +106 -7
- package/dist/gateway.mjs +156 -46
- package/dist/pi/CHANGELOG.md +13 -0
- package/dist/pi/package.json +1 -1
- package/dist/pi/packages/ta-3d/README.en.md +11 -0
- package/dist/pi/packages/ta-3d/README.md +11 -0
- package/dist/pi/packages/ta-3d/extension/index.mjs +120 -0
- package/dist/pi/packages/ta-3d/lib/extension.d.ts +15 -0
- package/dist/pi/packages/ta-3d/lib/extension.js +24 -0
- package/dist/pi/packages/ta-3d/lib/i18n.d.ts +19 -0
- package/dist/pi/packages/ta-3d/lib/i18n.js +50 -0
- package/dist/pi/packages/ta-3d/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-3d/lib/index.js +22 -0
- package/dist/pi/packages/ta-3d/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-3d/lib/react.js +8 -0
- package/dist/pi/packages/ta-3d/lib/scene-card.d.ts +4 -0
- package/dist/pi/packages/ta-3d/lib/scene-card.js +60 -0
- package/dist/pi/packages/ta-3d/lib/scene-prompt.d.ts +7 -0
- package/dist/pi/packages/ta-3d/lib/scene-prompt.js +15 -0
- package/dist/pi/packages/ta-3d/lib/scene-protocol.d.ts +5 -0
- package/dist/pi/packages/ta-3d/lib/scene-protocol.js +8 -0
- package/dist/pi/packages/ta-3d/lib/scene-spec.d.ts +59 -0
- package/dist/pi/packages/ta-3d/lib/scene-spec.js +141 -0
- package/dist/pi/packages/ta-3d/lib/scene-view.d.ts +57 -0
- package/dist/pi/packages/ta-3d/lib/scene-view.js +339 -0
- package/dist/pi/packages/ta-3d/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-3d/lib/style.js +33 -0
- package/dist/pi/packages/ta-3d/package.json +58 -0
- package/dist/pi/packages/ta-3d/web/index.js +660 -0
- package/dist/pi/packages/ta-agents/README.en.md +2 -2
- package/dist/pi/packages/ta-agents/README.md +2 -2
- package/dist/pi/packages/ta-agents/extension/index.mjs +248 -27
- package/dist/pi/packages/ta-agents/lib/acp-agent.d.ts +4 -0
- package/dist/pi/packages/ta-agents/lib/acp-agent.js +20 -2
- package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +14 -5
- package/dist/pi/packages/ta-agents/lib/acp-protocol.js +7 -0
- package/dist/pi/packages/ta-agents/lib/agent-bindings.d.ts +13 -0
- package/dist/pi/packages/ta-agents/lib/agent-bindings.js +29 -4
- package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +2 -0
- package/dist/pi/packages/ta-agents/lib/agent-prompt.js +5 -0
- package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +16 -4
- package/dist/pi/packages/ta-agents/lib/agent-session.js +34 -4
- package/dist/pi/packages/ta-agents/lib/agent-sign-in.d.ts +28 -0
- package/dist/pi/packages/ta-agents/lib/agent-sign-in.js +62 -0
- package/dist/pi/packages/ta-agents/lib/agent-streamer.d.ts +7 -0
- package/dist/pi/packages/ta-agents/lib/agent-streamer.js +40 -3
- package/dist/pi/packages/ta-agents/lib/extension.js +12 -0
- package/dist/pi/packages/ta-agents/lib/texts.d.ts +86 -22
- package/dist/pi/packages/ta-agents/lib/texts.js +101 -21
- package/dist/pi/packages/ta-agents/package.json +7 -3
- package/dist/pi/packages/ta-bots/extension/index.mjs +81 -10
- package/dist/pi/packages/ta-bots/host/index.mjs +165 -53
- package/dist/pi/packages/ta-bots/lib/bot-service.d.ts +6 -0
- package/dist/pi/packages/ta-bots/lib/bot-service.js +27 -2
- package/dist/pi/packages/ta-bots/lib/bot-store.d.ts +8 -1
- package/dist/pi/packages/ta-bots/lib/bot-store.js +16 -2
- package/dist/pi/packages/ta-bots/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-bots/lib/i18n.js +167 -2
- package/dist/pi/packages/ta-bots/lib/server-texts.d.ts +0 -1
- package/dist/pi/packages/ta-bots/lib/server-texts.js +45 -12
- package/dist/pi/packages/ta-bots/lib/weixin-channel.js +3 -1
- package/dist/pi/packages/ta-bots/package.json +7 -3
- package/dist/pi/packages/ta-bots/web/index.js +203 -1
- package/dist/pi/packages/ta-changes/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-changes/lib/i18n.js +51 -2
- package/dist/pi/packages/ta-changes/package.json +7 -3
- package/dist/pi/packages/ta-changes/web/index.js +87 -1
- package/dist/pi/packages/ta-channels/extension/index.mjs +78 -13
- package/dist/pi/packages/ta-channels/host/index.mjs +121 -56
- package/dist/pi/packages/ta-channels/lib/agent-cards.d.ts +2 -1
- package/dist/pi/packages/ta-channels/lib/agent-cards.js +4 -3
- package/dist/pi/packages/ta-channels/lib/handoff.d.ts +5 -4
- package/dist/pi/packages/ta-channels/lib/handoff.js +22 -6
- package/dist/pi/packages/ta-channels/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-channels/lib/i18n.js +361 -2
- package/dist/pi/packages/ta-channels/lib/team-ask.d.ts +2 -1
- package/dist/pi/packages/ta-channels/lib/team-ask.js +19 -7
- package/dist/pi/packages/ta-channels/lib/team.d.ts +2 -2
- package/dist/pi/packages/ta-channels/lib/team.js +1 -1
- package/dist/pi/packages/ta-channels/package.json +7 -3
- package/dist/pi/packages/ta-channels/web/index.js +482 -47
- package/dist/pi/packages/ta-computer-use/extension/index.mjs +11 -1
- package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js +20 -2
- package/dist/pi/packages/ta-computer-use/package.json +7 -3
- package/dist/pi/packages/ta-cron/extension/index.mjs +82 -8
- package/dist/pi/packages/ta-cron/host/index.mjs +67 -3
- package/dist/pi/packages/ta-cron/lib/editor.js +1 -1
- package/dist/pi/packages/ta-cron/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-cron/lib/i18n.js +217 -2
- package/dist/pi/packages/ta-cron/lib/page.js +14 -4
- package/dist/pi/packages/ta-cron/lib/schedule-util.js +29 -3
- package/dist/pi/packages/ta-cron/lib/server-texts.d.ts +2 -1
- package/dist/pi/packages/ta-cron/lib/server-texts.js +16 -9
- package/dist/pi/packages/ta-cron/lib/tasks-view.js +4 -2
- package/dist/pi/packages/ta-cron/package.json +7 -3
- package/dist/pi/packages/ta-cron/web/index.js +302 -14
- package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-extensions/lib/i18n.js +240 -2
- package/dist/pi/packages/ta-extensions/package.json +7 -3
- package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +1 -0
- package/dist/pi/packages/ta-extensions/web/index.js +329 -42
- package/dist/pi/packages/ta-games/README.en.md +1 -1
- package/dist/pi/packages/ta-games/README.md +1 -1
- package/dist/pi/packages/ta-games/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-games/lib/i18n.js +61 -2
- package/dist/pi/packages/ta-games/package.json +7 -3
- package/dist/pi/packages/ta-games/skills/ta-game/SKILL.md +41 -3
- package/dist/pi/packages/ta-games/web/index.js +97 -1
- package/dist/pi/packages/ta-glance/extension/index.mjs +32 -13
- package/dist/pi/packages/ta-glance/lib/glance-json.d.ts +2 -0
- package/dist/pi/packages/ta-glance/lib/glance-json.js +38 -16
- package/dist/pi/packages/ta-glance/lib/glance-prompt.d.ts +1 -1
- package/dist/pi/packages/ta-glance/lib/glance-prompt.js +1 -0
- package/dist/pi/packages/ta-glance/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-glance/lib/i18n.js +31 -2
- package/dist/pi/packages/ta-glance/package.json +7 -3
- package/dist/pi/packages/ta-glance/web/index.js +98 -14
- package/dist/pi/packages/ta-initiative/extension/index.mjs +89 -9
- package/dist/pi/packages/ta-initiative/host/index.mjs +120 -19
- package/dist/pi/packages/ta-initiative/lib/chat-kinds.js +15 -3
- package/dist/pi/packages/ta-initiative/lib/cron-proposals.js +20 -3
- package/dist/pi/packages/ta-initiative/lib/event-proposals.d.ts +2 -1
- package/dist/pi/packages/ta-initiative/lib/event-proposals.js +20 -6
- package/dist/pi/packages/ta-initiative/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-initiative/lib/i18n.js +151 -2
- package/dist/pi/packages/ta-initiative/lib/inbox.js +49 -30
- package/dist/pi/packages/ta-initiative/lib/initiative-protocol.d.ts +13 -4
- package/dist/pi/packages/ta-initiative/lib/initiative-protocol.js +11 -1
- package/dist/pi/packages/ta-initiative/lib/initiative-service.js +1 -1
- package/dist/pi/packages/ta-initiative/lib/material-util.d.ts +2 -1
- package/dist/pi/packages/ta-initiative/lib/material-util.js +9 -3
- package/dist/pi/packages/ta-initiative/lib/review-service.js +1 -1
- package/dist/pi/packages/ta-initiative/lib/server-texts.d.ts +2 -1
- package/dist/pi/packages/ta-initiative/lib/server-texts.js +11 -4
- package/dist/pi/packages/ta-initiative/lib/settings.js +2 -3
- package/dist/pi/packages/ta-initiative/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-initiative/lib/style.js +27 -14
- package/dist/pi/packages/ta-initiative/package.json +7 -3
- package/dist/pi/packages/ta-initiative/web/index.js +289 -55
- package/dist/pi/packages/ta-launcher/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-launcher/lib/i18n.js +71 -2
- package/dist/pi/packages/ta-launcher/package.json +7 -3
- package/dist/pi/packages/ta-launcher/web/index.js +107 -1
- package/dist/pi/packages/ta-manual/README.en.md +1 -1
- package/dist/pi/packages/ta-manual/README.md +1 -1
- package/dist/pi/packages/ta-manual/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-manual/lib/i18n.js +21 -2
- package/dist/pi/packages/ta-manual/lib/manual-util.js +2 -1
- package/dist/pi/packages/ta-manual/lib/pictures-c.js +30 -0
- package/dist/pi/packages/ta-manual/lib/topics.d.ts +4 -0
- package/dist/pi/packages/ta-manual/lib/topics.js +188 -71
- package/dist/pi/packages/ta-manual/package.json +7 -3
- package/dist/pi/packages/ta-manual/skills/ta-manual/SKILL.md +9 -0
- package/dist/pi/packages/ta-manual/web/index.js +405 -119
- package/dist/pi/packages/ta-moments/extension/index.mjs +242 -102
- package/dist/pi/packages/ta-moments/host/index.mjs +268 -115
- package/dist/pi/packages/ta-moments/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-moments/lib/i18n.js +170 -3
- package/dist/pi/packages/ta-moments/lib/moments-host.js +24 -11
- package/dist/pi/packages/ta-moments/lib/page.js +4 -2
- package/dist/pi/packages/ta-moments/lib/server-texts.d.ts +10 -12
- package/dist/pi/packages/ta-moments/lib/server-texts.js +128 -62
- package/dist/pi/packages/ta-moments/lib/talk-host.js +29 -8
- package/dist/pi/packages/ta-moments/package.json +7 -3
- package/dist/pi/packages/ta-moments/web/index.js +260 -43
- package/dist/pi/packages/ta-nearby/extension/index.mjs +229 -32
- package/dist/pi/packages/ta-nearby/host/index.mjs +248 -35
- package/dist/pi/packages/ta-nearby/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-nearby/lib/i18n.js +173 -2
- package/dist/pi/packages/ta-nearby/lib/nearby-service.d.ts +2 -4
- package/dist/pi/packages/ta-nearby/lib/nearby-service.js +21 -3
- package/dist/pi/packages/ta-nearby/lib/page.js +6 -5
- package/dist/pi/packages/ta-nearby/lib/server-texts.d.ts +5 -13
- package/dist/pi/packages/ta-nearby/lib/server-texts.js +194 -42
- package/dist/pi/packages/ta-nearby/package.json +7 -3
- package/dist/pi/packages/ta-nearby/web/index.js +216 -9
- package/dist/pi/packages/ta-notify/extension/index.mjs +54 -5
- package/dist/pi/packages/ta-notify/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-notify/lib/i18n.js +53 -2
- package/dist/pi/packages/ta-notify/lib/server-texts.d.ts +2 -1
- package/dist/pi/packages/ta-notify/lib/server-texts.js +16 -5
- package/dist/pi/packages/ta-notify/lib/settings.js +9 -2
- package/dist/pi/packages/ta-notify/package.json +7 -3
- package/dist/pi/packages/ta-notify/web/index.js +107 -7
- package/dist/pi/packages/ta-plot/README.en.md +12 -0
- package/dist/pi/packages/ta-plot/README.md +12 -0
- package/dist/pi/packages/ta-plot/extension/index.mjs +121 -0
- package/dist/pi/packages/ta-plot/lib/extension.d.ts +15 -0
- package/dist/pi/packages/ta-plot/lib/extension.js +24 -0
- package/dist/pi/packages/ta-plot/lib/i18n.d.ts +14 -0
- package/dist/pi/packages/ta-plot/lib/i18n.js +30 -0
- package/dist/pi/packages/ta-plot/lib/index.d.ts +7 -0
- package/dist/pi/packages/ta-plot/lib/index.js +25 -0
- package/dist/pi/packages/ta-plot/lib/plot-expression.d.ts +16 -0
- package/dist/pi/packages/ta-plot/lib/plot-expression.js +209 -0
- package/dist/pi/packages/ta-plot/lib/plot-painter.d.ts +28 -0
- package/dist/pi/packages/ta-plot/lib/plot-painter.js +208 -0
- package/dist/pi/packages/ta-plot/lib/plot-prompt.d.ts +7 -0
- package/dist/pi/packages/ta-plot/lib/plot-prompt.js +16 -0
- package/dist/pi/packages/ta-plot/lib/plot-protocol.d.ts +7 -0
- package/dist/pi/packages/ta-plot/lib/plot-protocol.js +10 -0
- package/dist/pi/packages/ta-plot/lib/plot-scene.d.ts +65 -0
- package/dist/pi/packages/ta-plot/lib/plot-scene.js +427 -0
- package/dist/pi/packages/ta-plot/lib/plot-spec.d.ts +86 -0
- package/dist/pi/packages/ta-plot/lib/plot-spec.js +165 -0
- package/dist/pi/packages/ta-plot/lib/plot-view.d.ts +4 -0
- package/dist/pi/packages/ta-plot/lib/plot-view.js +205 -0
- package/dist/pi/packages/ta-plot/lib/react.d.ts +8 -0
- package/dist/pi/packages/ta-plot/lib/react.js +8 -0
- package/dist/pi/packages/ta-plot/lib/style.d.ts +4 -0
- package/dist/pi/packages/ta-plot/lib/style.js +47 -0
- package/dist/pi/packages/ta-plot/package.json +57 -0
- package/dist/pi/packages/ta-plot/web/index.js +1320 -0
- package/dist/pi/packages/ta-recall/extension/index.mjs +52 -2
- package/dist/pi/packages/ta-recall/host/index.mjs +136 -55
- package/dist/pi/packages/ta-recall/lib/brief-util.d.ts +6 -3
- package/dist/pi/packages/ta-recall/lib/brief-util.js +26 -5
- package/dist/pi/packages/ta-recall/lib/extension-util.d.ts +2 -1
- package/dist/pi/packages/ta-recall/lib/extension-util.js +7 -1
- package/dist/pi/packages/ta-recall/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-recall/lib/i18n.js +89 -2
- package/dist/pi/packages/ta-recall/lib/keep-util.d.ts +2 -1
- package/dist/pi/packages/ta-recall/lib/keep-util.js +8 -1
- package/dist/pi/packages/ta-recall/lib/recall-service.js +5 -3
- package/dist/pi/packages/ta-recall/lib/server-texts.d.ts +2 -3
- package/dist/pi/packages/ta-recall/lib/server-texts.js +15 -8
- package/dist/pi/packages/ta-recall/package.json +7 -3
- package/dist/pi/packages/ta-recall/web/index.js +164 -9
- package/dist/pi/packages/ta-rooms/extension/index.mjs +60 -3
- package/dist/pi/packages/ta-rooms/host/index.mjs +284 -37
- package/dist/pi/packages/ta-rooms/lib/dialogs.js +2 -1
- package/dist/pi/packages/ta-rooms/lib/double-agents.js +31 -7
- package/dist/pi/packages/ta-rooms/lib/double-grants.js +57 -13
- package/dist/pi/packages/ta-rooms/lib/double-host.js +31 -5
- package/dist/pi/packages/ta-rooms/lib/double-i18n.d.ts +3 -0
- package/dist/pi/packages/ta-rooms/lib/double-i18n.js +201 -2
- package/dist/pi/packages/ta-rooms/lib/double-tasks.d.ts +2 -1
- package/dist/pi/packages/ta-rooms/lib/double-tasks.js +93 -21
- package/dist/pi/packages/ta-rooms/lib/double-user.js +1 -1
- package/dist/pi/packages/ta-rooms/lib/double-util.d.ts +1 -1
- package/dist/pi/packages/ta-rooms/lib/double-util.js +22 -3
- package/dist/pi/packages/ta-rooms/lib/doubles-store.js +2 -1
- package/dist/pi/packages/ta-rooms/lib/doubles-view.js +8 -1
- package/dist/pi/packages/ta-rooms/lib/friend-notices.js +27 -8
- package/dist/pi/packages/ta-rooms/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-rooms/lib/i18n.js +243 -2
- package/dist/pi/packages/ta-rooms/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-rooms/lib/style.js +1 -0
- package/dist/pi/packages/ta-rooms/package.json +7 -3
- package/dist/pi/packages/ta-rooms/web/index.js +496 -9
- package/dist/pi/packages/ta-share/extension/index.mjs +98 -23
- package/dist/pi/packages/ta-share/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-share/lib/i18n.js +203 -2
- package/dist/pi/packages/ta-share/lib/page.js +1 -1
- package/dist/pi/packages/ta-share/lib/server-texts.d.ts +2 -1
- package/dist/pi/packages/ta-share/lib/server-texts.js +60 -29
- package/dist/pi/packages/ta-share/lib/share-dialog.js +3 -1
- package/dist/pi/packages/ta-share/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-share/lib/style.js +1 -0
- package/dist/pi/packages/ta-share/package.json +7 -3
- package/dist/pi/packages/ta-share/web/index.js +246 -4
- package/dist/pi/packages/ta-sync/host/index.mjs +170 -25
- package/dist/pi/packages/ta-sync/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-sync/lib/i18n.js +173 -2
- package/dist/pi/packages/ta-sync/lib/migrate-i18n.d.ts +3 -0
- package/dist/pi/packages/ta-sync/lib/migrate-i18n.js +183 -2
- package/dist/pi/packages/ta-sync/lib/panel.js +4 -1
- package/dist/pi/packages/ta-sync/lib/server-texts.d.ts +0 -1
- package/dist/pi/packages/ta-sync/lib/server-texts.js +132 -35
- package/dist/pi/packages/ta-sync/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-sync/lib/style.js +1 -0
- package/dist/pi/packages/ta-sync/package.json +7 -3
- package/dist/pi/packages/ta-sync/web/index.js +398 -5
- package/dist/pi/packages/ta-sync-cloud/host/index.mjs +52 -23
- package/dist/pi/packages/ta-sync-cloud/lib/host.js +49 -20
- package/dist/pi/packages/ta-sync-cloud/package.json +7 -3
- package/dist/pi/packages/ta-team/README.en.md +1 -1
- package/dist/pi/packages/ta-team/README.md +1 -1
- package/dist/pi/packages/ta-team/extension/index.mjs +86 -37
- package/dist/pi/packages/ta-team/host/index.mjs +130 -43
- package/dist/pi/packages/ta-team/lib/dialogs.js +68 -9
- package/dist/pi/packages/ta-team/lib/i18n.d.ts +7 -1
- package/dist/pi/packages/ta-team/lib/i18n.js +431 -8
- package/dist/pi/packages/ta-team/lib/member-dialog.js +30 -25
- package/dist/pi/packages/ta-team/lib/page.js +5 -1
- package/dist/pi/packages/ta-team/lib/style.d.ts +1 -1
- package/dist/pi/packages/ta-team/lib/style.js +11 -4
- package/dist/pi/packages/ta-team/lib/team-invites.d.ts +14 -8
- package/dist/pi/packages/ta-team/lib/team-invites.js +38 -6
- package/dist/pi/packages/ta-team/package.json +7 -3
- package/dist/pi/packages/ta-team/web/index.js +688 -102
- package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +3 -0
- package/dist/pi/packages/ta-workspace/lib/i18n.js +417 -1
- package/dist/pi/packages/ta-workspace/package.json +7 -3
- package/dist/pi/packages/ta-workspace/web/index.js +504 -40
- package/dist/public/assets/GLTFLoader-C8PT6dAj.js +1 -0
- package/dist/public/assets/SkeletonUtils-BBAzQdty.js +1 -0
- package/dist/public/assets/{abnfDiagram-S7VZAUFO-DMceNIR5.js → abnfDiagram-S7VZAUFO-CD8CaArq.js} +1 -1
- package/dist/public/assets/{architecture-WOLXFQ4H-5AdYeEv8.js → architecture-WOLXFQ4H-f2a9bodL.js} +1 -1
- package/dist/public/assets/{architectureDiagram-YGSQEFNW-CqkJHg0A.js → architectureDiagram-YGSQEFNW-BCWH9CwO.js} +1 -1
- package/dist/public/assets/{blockDiagram-APKKGZFW-BtuHdIjQ.js → blockDiagram-APKKGZFW-fUamQMeJ.js} +1 -1
- package/dist/public/assets/{browser-Ds5TwWWr.js → browser-CrMa174j.js} +1 -1
- package/dist/public/assets/{c4Diagram-KJ2TOQU5-eebbjTgZ.js → c4Diagram-KJ2TOQU5-CkLtnwp1.js} +1 -1
- package/dist/public/assets/{chunk-6MUBBAK2-BjMKSfTf.js → chunk-6MUBBAK2-cwcGPuAH.js} +1 -1
- package/dist/public/assets/{chunk-AXFCVDMN-BElluw_7.js → chunk-AXFCVDMN-DNkmkYfC.js} +1 -1
- package/dist/public/assets/{chunk-BG4553SI-CUDwpWNL.js → chunk-BG4553SI-C8qbbr2Z.js} +1 -1
- package/dist/public/assets/{chunk-DQASFODM-B-92o8Uj.js → chunk-DQASFODM-C-PJ2CrJ.js} +1 -1
- package/dist/public/assets/{chunk-HFQBQIA3-pveEMcXK.js → chunk-HFQBQIA3-BYcgxNEL.js} +1 -1
- package/dist/public/assets/{chunk-KQLB2F66-m7DKNjYW.js → chunk-KQLB2F66-BTDNzrRl.js} +1 -1
- package/dist/public/assets/{chunk-KS47KZWR-CnSSETdj.js → chunk-KS47KZWR-1sGg1pKP.js} +1 -1
- package/dist/public/assets/{chunk-LEVMRMFU-Ds7OnJrC.js → chunk-LEVMRMFU-7lAsFwHT.js} +1 -1
- package/dist/public/assets/{chunk-M57EVK23-PJSYCuUh.js → chunk-M57EVK23-C8K-ltig.js} +1 -1
- package/dist/public/assets/{chunk-OY52VR5R-C3ygRwSC.js → chunk-OY52VR5R-CBe1QL_V.js} +1 -1
- package/dist/public/assets/{chunk-QB3YPZ4I-DcFtmZh7.js → chunk-QB3YPZ4I-COhYyyE_.js} +1 -1
- package/dist/public/assets/{chunk-R3KSYZAL-B4BOidE6.js → chunk-R3KSYZAL-CREAgaSS.js} +1 -1
- package/dist/public/assets/{chunk-STOXU5M4-DcXfwN7k.js → chunk-STOXU5M4-CTl0P8_C.js} +1 -1
- package/dist/public/assets/{chunk-TU62E6Q5-B-rpQQxX.js → chunk-TU62E6Q5-B_GG7baF.js} +1 -1
- package/dist/public/assets/{chunk-X4PVCEUW-BBtlFSw1.js → chunk-X4PVCEUW-CDrSpVOj.js} +1 -1
- package/dist/public/assets/{chunk-XXDRQBXY-Do8BIocv.js → chunk-XXDRQBXY-sKeiDEnC.js} +1 -1
- package/dist/public/assets/{classDiagram-v2-L25IHNXF-bhGAODMS.js → classDiagram-v2-L25IHNXF-Cqo1O5FQ.js} +1 -1
- package/dist/public/assets/{cose-bilkent-JH36ORCC-B7Qv6Hv_.js → cose-bilkent-JH36ORCC-CTSKeRBe.js} +1 -1
- package/dist/public/assets/cynefin-EF2NZ3EQ-CP12ndt7.js +1 -0
- package/dist/public/assets/{cynefinDiagram-L36ESFBY-BX-R5Z6L.js → cynefinDiagram-L36ESFBY-67xEPyP9.js} +1 -1
- package/dist/public/assets/{d3-selection-D3xgEEla.js → d3-selection-BUiX-3qh.js} +1 -1
- package/dist/public/assets/{dagre-SPEB5RXH-MfJ9yO0v.js → dagre-SPEB5RXH-DDw-u3Kg.js} +1 -1
- package/dist/public/assets/{diagram-3B7GL73J-DxFRc2vC.js → diagram-3B7GL73J-BBFInaCs.js} +1 -1
- package/dist/public/assets/{diagram-DNEMPZML-BcBwOLbM.js → diagram-DNEMPZML-ZdnFKM7-.js} +1 -1
- package/dist/public/assets/{diagram-L3MUGCDN--Rw-isPI.js → diagram-L3MUGCDN-CPb04hOv.js} +1 -1
- package/dist/public/assets/{diagram-LA4NIPWU-DXkY85UN.js → diagram-LA4NIPWU-P9wHFGDS.js} +1 -1
- package/dist/public/assets/{diagram-MHCOC4E2-CbNmfAid.js → diagram-MHCOC4E2-Ce_Cr-t6.js} +1 -1
- package/dist/public/assets/{diagram-XPFHEONP-D1nGQjzf.js → diagram-XPFHEONP-CfS34OHW.js} +1 -1
- package/dist/public/assets/{dist-B1JMTrET.js → dist-6pZqZEaM.js} +1 -1
- package/dist/public/assets/{ebnfDiagram-UZSYDL2S-DGXbVfke.js → ebnfDiagram-UZSYDL2S-BkHabCn2.js} +1 -1
- package/dist/public/assets/{editor.api-e3yQoo1r.js → editor.api-CO4Q0NKb.js} +1 -1
- package/dist/public/assets/{elk-XV6XMXQE-pA-iT6fg.js → elk-XV6XMXQE-JpreOVeR.js} +1 -1
- package/dist/public/assets/{erDiagram-EYBAPDEH-BpgBun7y.js → erDiagram-EYBAPDEH-DDFJwzHx.js} +1 -1
- package/dist/public/assets/{eventmodeling-K75KTNOO-CVfyCcul.js → eventmodeling-K75KTNOO-DsnkF6Zc.js} +1 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-Djxeacjw.js +1 -0
- package/dist/public/assets/{freemarker2-dYGec-fT.js → freemarker2-Cm4NK652.js} +1 -1
- package/dist/public/assets/{ganttDiagram-23REXITY-DjLTTWwA.js → ganttDiagram-23REXITY-C7eedoYb.js} +1 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-qlWN7ijl.js +1 -0
- package/dist/public/assets/{gitGraphDiagram-STJD7YCW-D9m7IVyJ.js → gitGraphDiagram-STJD7YCW-Cuh3ih-z.js} +1 -1
- package/dist/public/assets/{handlebars-Bxerz7ci.js → handlebars-BnE51DUi.js} +1 -1
- package/dist/public/assets/{html-DlVnGsdp.js → html-7koekDfa.js} +1 -1
- package/dist/public/assets/{index-CZmGe9gc.js → index-CQG1XddL.js} +2 -2
- package/dist/public/assets/info-OHQRW6UA-jN69V28z.js +1 -0
- package/dist/public/assets/{infoDiagram-KBXO4MBG-DoYdhkAy.js → infoDiagram-KBXO4MBG-BY3iq7I8.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-M35NCXHK-Bc0GAInW.js → ishikawaDiagram-M35NCXHK-COjlz24y.js} +1 -1
- package/dist/public/assets/ja-BHBiml1x.js +12 -0
- package/dist/public/assets/{javascript-DZrowo_I.js → javascript-BUZgUhdn.js} +1 -1
- package/dist/public/assets/{journeyDiagram-OPLOXDXO-BM7Dwstu.js → journeyDiagram-OPLOXDXO-DReJE04Q.js} +1 -1
- package/dist/public/assets/{jsonMode-Bs30wPr5.js → jsonMode-qPeVDBDp.js} +1 -1
- package/dist/public/assets/{kanban-definition-BZKZHSQY-CO-Crrdu.js → kanban-definition-BZKZHSQY-BB0_ePvg.js} +1 -1
- package/dist/public/assets/{liquid-dLz9d3ax.js → liquid-CNKL9dLX.js} +1 -1
- package/dist/public/assets/{mdx-DO0x92Kn.js → mdx-D1_UzrBc.js} +1 -1
- package/dist/public/assets/{mermaid-parser.core-BXwArNvw.js → mermaid-parser.core-DiE3z_tV.js} +3 -3
- package/dist/public/assets/{mermaid.core-C6mppfDC.js → mermaid.core-CBCRrLdl.js} +4 -4
- package/dist/public/assets/meshopt_decoder.module-DXTYc6wn.js +1 -0
- package/dist/public/assets/{mindmap-definition-I2QAS2VK-vcQ2EU4T.js → mindmap-definition-I2QAS2VK-D-Y5fKl1.js} +1 -1
- package/dist/public/assets/module-BEbKICB1.js +2475 -0
- package/dist/public/assets/module-Egyx6Otv.js +1 -0
- package/dist/public/assets/{monaco-J_Pr5zjk.js → monaco--czRbHhk.js} +3 -3
- package/dist/public/assets/packet-JDAUHWVQ-Cl8QuXQJ.js +1 -0
- package/dist/public/assets/{pegDiagram-FD4XPPHP-DPDrbtS2.js → pegDiagram-FD4XPPHP-1jx5jc73.js} +1 -1
- package/dist/public/assets/pie-XZMESJXO-kVGJsGZe.js +1 -0
- package/dist/public/assets/{pieDiagram-J4AKIIQI-DXuaepGJ.js → pieDiagram-J4AKIIQI-DGv_WCCu.js} +1 -1
- package/dist/public/assets/{python-nnmIOv4s.js → python-DNZu5LjV.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-XTYBLID2-BuD_-coZ.js → quadrantDiagram-XTYBLID2-BgY0lf8V.js} +1 -1
- package/dist/public/assets/radar-ABXABTNO-Dw71L-n8.js +1 -0
- package/dist/public/assets/railroad-I3PHUGI6-DkaUvI4_.js +1 -0
- package/dist/public/assets/{railroad-abnf-LNEFI6M7-CkCl68xY.js → railroad-abnf-LNEFI6M7-tZ7rJxwM.js} +1 -1
- package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-DO3GiRv6.js → railroad-ebnf-DWYD2UWJ-JO6n_1TK.js} +1 -1
- package/dist/public/assets/{railroad-peg-JR7BVNR7-DZBsKy4P.js → railroad-peg-JR7BVNR7-Bf0PG2YJ.js} +1 -1
- package/dist/public/assets/{railroadDiagram-MRQ6NCDL-BeLq7Mqp.js → railroadDiagram-MRQ6NCDL-BMjog84X.js} +1 -1
- package/dist/public/assets/{razor-l2rRITgB.js → razor-DU-x8qSP.js} +1 -1
- package/dist/public/assets/{requirementDiagram-Y7LWUY3S-BBizkrON.js → requirementDiagram-Y7LWUY3S-CktbbWjr.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-WGJFYUXA-tyo-p7oc.js → sankeyDiagram-WGJFYUXA-CQonOre7.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-5NDRBG5M-BSGPbeJX.js → sequenceDiagram-5NDRBG5M-CAe8-JvA.js} +1 -1
- package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-Dcdy66MQ.js → stateDiagram-v2-FJ4FJNEA-BrkqOuRm.js} +1 -1
- package/dist/public/assets/{swimlanes-UMQ2AFYF-BJfgQyQo.js → swimlanes-UMQ2AFYF-sLpgHBKo.js} +1 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-amBdr5Wc.js +8 -0
- package/dist/public/assets/{timeline-definition-SEUHKTQE-Ch8aQwF6.js → timeline-definition-SEUHKTQE-CHE0x-WN.js} +1 -1
- package/dist/public/assets/treeView-D4JQ5SDB-DKLyFqZk.js +1 -0
- package/dist/public/assets/treemap-SAJKECNS-CRG6ogj8.js +1 -0
- package/dist/public/assets/{typescript-LasX-M7S.js → typescript-BrNT2oWW.js} +1 -1
- package/dist/public/assets/{usecaseDiagram-AFA6YXN4-BzlSB4R4.js → usecaseDiagram-AFA6YXN4-DwkFRI5R.js} +1 -1
- package/dist/public/assets/{vennDiagram-NNMJR3RB-4xaWLrMk.js → vennDiagram-NNMJR3RB-BquQVmJq.js} +1 -1
- package/dist/public/assets/wardley-7MLQ67FV-D2jQfflX.js +1 -0
- package/dist/public/assets/{wardleyDiagram-S7YFUSEH-C-iK1p-O.js → wardleyDiagram-S7YFUSEH-sNYFUfMe.js} +1 -1
- package/dist/public/assets/{xml-CGhYQUqn.js → xml-BY65QKv7.js} +1 -1
- package/dist/public/assets/{xychartDiagram-GGNKY7IX-CFsnisdM.js → xychartDiagram-GGNKY7IX-CnWEYuid.js} +1 -1
- package/dist/public/assets/{yaml-BcOaPfuH.js → yaml-BMovUwzO.js} +1 -1
- package/dist/public/assets/zh-tw-7q-tizR0.js +12 -0
- package/dist/public/index.html +1 -1
- package/dist/serve/index.mjs +2773 -626
- package/package.json +39 -37
- package/dist/public/assets/cynefin-EF2NZ3EQ-Dfu5k3iG.js +0 -1
- package/dist/public/assets/flowDiagram-MALGAFMO-BHlXeeVG.js +0 -1
- package/dist/public/assets/gitGraph-VSP46ZUC-CFVSDv3q.js +0 -1
- package/dist/public/assets/info-OHQRW6UA-C_Db4yjo.js +0 -1
- package/dist/public/assets/module-C0tELrcJ.js +0 -1
- package/dist/public/assets/module-CteT9pTP.js +0 -2405
- package/dist/public/assets/packet-JDAUHWVQ-Bw7hmDUU.js +0 -1
- package/dist/public/assets/pie-XZMESJXO-cb_eq1B6.js +0 -1
- package/dist/public/assets/radar-ABXABTNO-Dqy-xoY_.js +0 -1
- package/dist/public/assets/railroad-I3PHUGI6-CBPVCTd3.js +0 -1
- package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BWvcVkFg.js +0 -8
- package/dist/public/assets/treeView-D4JQ5SDB--XUqgqA6.js +0 -1
- package/dist/public/assets/treemap-SAJKECNS-CfrNtG7H.js +0 -1
- package/dist/public/assets/wardley-7MLQ67FV-BXBG-txR.js +0 -1
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlotScene = void 0;
|
|
4
|
+
const plot_painter_1 = require("./plot-painter");
|
|
5
|
+
const plot_spec_1 = require("./plot-spec");
|
|
6
|
+
/** Samples of a surface on each side, and of a curve. */
|
|
7
|
+
const GRID = 56;
|
|
8
|
+
const SAMPLES = 360;
|
|
9
|
+
/** Half the height of the box, in units of its half width. */
|
|
10
|
+
const HEIGHT = 0.75;
|
|
11
|
+
/** Colors of a surface by its height, low to high. */
|
|
12
|
+
const RAMP = ['#3b4cc0', '#4f8cff', '#2bb6a3', '#9ccc3c', '#f5b400', '#ff7a59'];
|
|
13
|
+
/**
|
|
14
|
+
* A plot in space (Plot.space) drawn with the Three.js of the page (`ui.Game3D`): a box of the ranges of x, y and z
|
|
15
|
+
* with its floor gridded, surfaces colored by height, curves and points, turned by dragging. Math's z is the
|
|
16
|
+
* height (Three's y). What moves with t or a slider is computed again each frame; a still plot is not.
|
|
17
|
+
*/
|
|
18
|
+
class PlotScene {
|
|
19
|
+
constructor(context, plot, input) {
|
|
20
|
+
var _a;
|
|
21
|
+
this.context = context;
|
|
22
|
+
this.plot = plot;
|
|
23
|
+
this.input = input;
|
|
24
|
+
this.surfaces = [];
|
|
25
|
+
this.curves = [];
|
|
26
|
+
this.points = [];
|
|
27
|
+
this.dots = [];
|
|
28
|
+
this.labels = [];
|
|
29
|
+
this.drawn = -1;
|
|
30
|
+
this.shownAt = 0;
|
|
31
|
+
this.wheel = (event) => {
|
|
32
|
+
if (!event.ctrlKey) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
const camera = this.context.camera;
|
|
37
|
+
const distance = Math.min(Math.max(camera.position.length() * Math.exp(event.deltaY * 0.01), this.controls.minDistance), this.controls.maxDistance);
|
|
38
|
+
camera.position.setLength(distance);
|
|
39
|
+
};
|
|
40
|
+
const THREE = context.THREE;
|
|
41
|
+
this.THREE = THREE;
|
|
42
|
+
const { renderer, scene, element } = context;
|
|
43
|
+
renderer.localClippingEnabled = true;
|
|
44
|
+
this.z = (_a = plot.z) !== null && _a !== void 0 ? _a : PlotScene.reach(plot, input.sliders);
|
|
45
|
+
const camera = context.camera;
|
|
46
|
+
camera.fov = 40;
|
|
47
|
+
camera.near = 0.05;
|
|
48
|
+
camera.far = 100;
|
|
49
|
+
camera.position.set(2.7, 2.1, 3.1);
|
|
50
|
+
camera.lookAt(0, 0, 0);
|
|
51
|
+
camera.updateProjectionMatrix();
|
|
52
|
+
this.controls = new context.OrbitControls(camera, element);
|
|
53
|
+
this.controls.enableDamping = true;
|
|
54
|
+
this.controls.enablePan = false;
|
|
55
|
+
this.controls.minDistance = 1.5;
|
|
56
|
+
this.controls.maxDistance = 9;
|
|
57
|
+
this.controls.autoRotateSpeed = 0.6;
|
|
58
|
+
this.controls.addEventListener('start', () => {
|
|
59
|
+
this.controls.autoRotate = false;
|
|
60
|
+
});
|
|
61
|
+
// A wheel scrolls the conversation; a pinch (Ctrl with the wheel, as a trackpad sends it) zooms.
|
|
62
|
+
this.controls.enableZoom = false;
|
|
63
|
+
element.addEventListener('wheel', this.wheel, { passive: false });
|
|
64
|
+
scene.add(new THREE.HemisphereLight(0xffffff, 0x445566, 1.6));
|
|
65
|
+
const sun = new THREE.DirectionalLight(0xffffff, 1.4);
|
|
66
|
+
sun.position.set(2, 4, 3);
|
|
67
|
+
scene.add(sun);
|
|
68
|
+
this.root = new THREE.Group();
|
|
69
|
+
scene.add(this.root);
|
|
70
|
+
this.frame = new THREE.Group();
|
|
71
|
+
this.root.add(this.frame);
|
|
72
|
+
this.build();
|
|
73
|
+
this.page(context.page);
|
|
74
|
+
}
|
|
75
|
+
/** Where a point of the plot is in the scene: x and y across, z up, each range to the box. */
|
|
76
|
+
at(x, y, z, target) {
|
|
77
|
+
const [x0, x1] = this.plot.x;
|
|
78
|
+
const [y0, y1] = this.plot.y;
|
|
79
|
+
const [z0, z1] = this.z;
|
|
80
|
+
return target.set(((x - x0) / (x1 - x0)) * 2 - 1, (((z - z0) / (z1 - z0)) * 2 - 1) * HEIGHT, -(((y - y0) / (y1 - y0)) * 2 - 1));
|
|
81
|
+
}
|
|
82
|
+
build() {
|
|
83
|
+
var _a;
|
|
84
|
+
const { THREE, plot } = this;
|
|
85
|
+
// What leaves the box is cut at its top and bottom.
|
|
86
|
+
const clipping = [new THREE.Plane(new THREE.Vector3(0, -1, 0), HEIGHT + 1e-3), new THREE.Plane(new THREE.Vector3(0, 1, 0), HEIGHT + 1e-3)];
|
|
87
|
+
for (const surface of plot.surfaces) {
|
|
88
|
+
const geometry = new THREE.BufferGeometry();
|
|
89
|
+
geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(GRID * GRID * 3), 3));
|
|
90
|
+
geometry.setAttribute('color', new THREE.BufferAttribute(new Float32Array(GRID * GRID * 3), 3));
|
|
91
|
+
const index = [];
|
|
92
|
+
for (let i = 0; i < GRID - 1; i++) {
|
|
93
|
+
for (let j = 0; j < GRID - 1; j++) {
|
|
94
|
+
const a = i * GRID + j;
|
|
95
|
+
index.push(a, a + GRID, a + 1, a + 1, a + GRID, a + GRID + 1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
geometry.setIndex(index);
|
|
99
|
+
const colored = !surface.color;
|
|
100
|
+
const material = new THREE.MeshStandardMaterial({
|
|
101
|
+
color: (_a = surface.color) !== null && _a !== void 0 ? _a : 0xffffff,
|
|
102
|
+
vertexColors: colored,
|
|
103
|
+
side: THREE.DoubleSide,
|
|
104
|
+
roughness: 0.55,
|
|
105
|
+
metalness: 0.05,
|
|
106
|
+
transparent: true,
|
|
107
|
+
opacity: 0.92,
|
|
108
|
+
clippingPlanes: clipping,
|
|
109
|
+
});
|
|
110
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
111
|
+
const wire = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000, wireframe: true, transparent: true, opacity: 0.08, clippingPlanes: clipping }));
|
|
112
|
+
mesh.add(wire);
|
|
113
|
+
this.root.add(mesh);
|
|
114
|
+
this.surfaces.push({ geometry, colored, mesh });
|
|
115
|
+
}
|
|
116
|
+
for (const curve of plot.curves) {
|
|
117
|
+
const geometry = new THREE.BufferGeometry();
|
|
118
|
+
geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(SAMPLES * 2 * 3), 3));
|
|
119
|
+
const material = curve.dash
|
|
120
|
+
? new THREE.LineDashedMaterial({ color: curve.color, dashSize: 0.06, gapSize: 0.05, clippingPlanes: clipping })
|
|
121
|
+
: new THREE.LineBasicMaterial({ color: curve.color, clippingPlanes: clipping });
|
|
122
|
+
const line = new THREE.LineSegments(geometry, material);
|
|
123
|
+
this.root.add(line);
|
|
124
|
+
this.curves.push({ geometry, line });
|
|
125
|
+
if (plot.dot && !curve.dash) {
|
|
126
|
+
const dot = new THREE.Mesh(new THREE.SphereGeometry(0.035, 16, 12), new THREE.MeshBasicMaterial({ color: curve.color }));
|
|
127
|
+
dot.visible = false;
|
|
128
|
+
this.root.add(dot);
|
|
129
|
+
this.dots.push(dot);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
for (const point of plot.points) {
|
|
133
|
+
const mesh = new THREE.Mesh(new THREE.SphereGeometry(0.028, 16, 12), new THREE.MeshBasicMaterial({ color: 0xffffff }));
|
|
134
|
+
mesh.visible = false;
|
|
135
|
+
this.root.add(mesh);
|
|
136
|
+
this.points.push(mesh);
|
|
137
|
+
if (point.label) {
|
|
138
|
+
const label = PlotScene.label(THREE, point.label);
|
|
139
|
+
mesh.add(label);
|
|
140
|
+
label.position.set(0, 0.12, 0);
|
|
141
|
+
this.labels.push(label);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** The box, its gridded floor, the names of the axes and the ends of their ranges, in the colors of the page. */
|
|
146
|
+
drawFrame(page) {
|
|
147
|
+
const { THREE, frame, plot } = this;
|
|
148
|
+
for (const child of [...frame.children]) {
|
|
149
|
+
frame.remove(child);
|
|
150
|
+
PlotScene.dispose(child);
|
|
151
|
+
}
|
|
152
|
+
const ink = page.colors.text;
|
|
153
|
+
const edges = new THREE.LineSegments(new THREE.EdgesGeometry(new THREE.BoxGeometry(2, HEIGHT * 2, 2)), new THREE.LineBasicMaterial({ color: ink, transparent: true, opacity: 0.22 }));
|
|
154
|
+
frame.add(edges);
|
|
155
|
+
const floor = [];
|
|
156
|
+
const [x0, x1] = plot.x;
|
|
157
|
+
const [y0, y1] = plot.y;
|
|
158
|
+
const step = plot_spec_1.PlotSpec.niceStep(Math.max(x1 - x0, y1 - y0));
|
|
159
|
+
const point = new THREE.Vector3();
|
|
160
|
+
for (let gx = Math.ceil(x0 / step) * step; gx <= x1 + 1e-9; gx += step) {
|
|
161
|
+
floor.push(...this.at(gx, y0, this.z[0], point).toArray(), ...this.at(gx, y1, this.z[0], point).toArray());
|
|
162
|
+
}
|
|
163
|
+
for (let gy = Math.ceil(y0 / step) * step; gy <= y1 + 1e-9; gy += step) {
|
|
164
|
+
floor.push(...this.at(x0, gy, this.z[0], point).toArray(), ...this.at(x1, gy, this.z[0], point).toArray());
|
|
165
|
+
}
|
|
166
|
+
const grid = new THREE.BufferGeometry();
|
|
167
|
+
grid.setAttribute('position', new THREE.Float32BufferAttribute(floor, 3));
|
|
168
|
+
frame.add(new THREE.LineSegments(grid, new THREE.LineBasicMaterial({ color: ink, transparent: true, opacity: 0.1 })));
|
|
169
|
+
const [z0, z1] = this.z;
|
|
170
|
+
const color = `#${ink.toString(16).padStart(6, '0')}`;
|
|
171
|
+
const marks = [
|
|
172
|
+
['x', x1, y0, z0],
|
|
173
|
+
['y', x1, y1, z0],
|
|
174
|
+
['z', x0, y0, z1],
|
|
175
|
+
[plot_spec_1.PlotSpec.format(x0), x0, y0, z0],
|
|
176
|
+
[plot_spec_1.PlotSpec.format(y1), x0, y1, z0],
|
|
177
|
+
[plot_spec_1.PlotSpec.format(z0), x0, y1, z0],
|
|
178
|
+
[plot_spec_1.PlotSpec.format(z1), x0, y1, z1],
|
|
179
|
+
];
|
|
180
|
+
const offsets = { x: [0.16, 0, 0.08], y: [0.1, 0, -0.14], z: [-0.08, 0.14, 0.08] };
|
|
181
|
+
marks.forEach(([name, x, y, z], index) => {
|
|
182
|
+
var _a;
|
|
183
|
+
const label = PlotScene.label(THREE, name, color, index < 3 ? 1 : 0.8);
|
|
184
|
+
this.at(x, y, z, label.position);
|
|
185
|
+
const [dx, dy, dz] = (_a = offsets[name]) !== null && _a !== void 0 ? _a : [-0.1, 0, 0.08];
|
|
186
|
+
label.position.add(new THREE.Vector3(dx, dy, dz));
|
|
187
|
+
frame.add(label);
|
|
188
|
+
});
|
|
189
|
+
for (const mesh of this.points) {
|
|
190
|
+
mesh.material.color.setHex(ink);
|
|
191
|
+
}
|
|
192
|
+
for (const label of this.labels) {
|
|
193
|
+
const old = label.material.map;
|
|
194
|
+
label.material.map = PlotScene.texture(THREE, PlotScene.textOf(label), color);
|
|
195
|
+
old === null || old === void 0 ? void 0 : old.dispose();
|
|
196
|
+
}
|
|
197
|
+
for (const { mesh } of this.surfaces) {
|
|
198
|
+
mesh.children[0].material.color.setHex(ink);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** Computes what is drawn at `elapsed` seconds: the surfaces rise and the curves draw in as it is shown. */
|
|
202
|
+
draw(elapsed) {
|
|
203
|
+
const { plot } = this;
|
|
204
|
+
const values = plot_spec_1.PlotSpec.values(plot, elapsed, this.input.sliders);
|
|
205
|
+
const rise = PlotScene.eased(elapsed / plot_painter_1.DRAW_IN);
|
|
206
|
+
const point = new this.THREE.Vector3();
|
|
207
|
+
const [x0, x1] = plot.x;
|
|
208
|
+
const [y0, y1] = plot.y;
|
|
209
|
+
const [z0, z1] = this.z;
|
|
210
|
+
const middle = (z0 + z1) / 2;
|
|
211
|
+
plot.surfaces.forEach((surface, index) => {
|
|
212
|
+
const { geometry, colored } = this.surfaces[index];
|
|
213
|
+
const positions = geometry.getAttribute('position');
|
|
214
|
+
const colors = geometry.getAttribute('color');
|
|
215
|
+
const scope = plot_spec_1.PlotSpec.scope(0, 0, 0, elapsed, values);
|
|
216
|
+
const color = new this.THREE.Color();
|
|
217
|
+
for (let i = 0; i < GRID; i++) {
|
|
218
|
+
for (let j = 0; j < GRID; j++) {
|
|
219
|
+
const x = x0 + ((x1 - x0) * j) / (GRID - 1);
|
|
220
|
+
const y = y0 + ((y1 - y0) * i) / (GRID - 1);
|
|
221
|
+
scope[0] = x;
|
|
222
|
+
scope[1] = y;
|
|
223
|
+
const value = surface.z.evaluate(scope);
|
|
224
|
+
// Far off, or none (a pole): far above, where the top of the box cuts it.
|
|
225
|
+
const z = Number.isFinite(value) ? Math.max(Math.min(value, z1 + (z1 - z0) * 4), z0 - (z1 - z0) * 4) : z1 + (z1 - z0) * 4;
|
|
226
|
+
this.at(x, y, middle + (z - middle) * rise, point);
|
|
227
|
+
positions.setXYZ(i * GRID + j, point.x, point.y, point.z);
|
|
228
|
+
if (colored) {
|
|
229
|
+
PlotScene.ramp((z - z0) / (z1 - z0), color);
|
|
230
|
+
colors.setXYZ(i * GRID + j, color.r, color.g, color.b);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
positions.needsUpdate = true;
|
|
235
|
+
colors.needsUpdate = colored;
|
|
236
|
+
geometry.computeVertexNormals();
|
|
237
|
+
geometry.computeBoundingSphere();
|
|
238
|
+
});
|
|
239
|
+
plot.curves.forEach((curve, index) => {
|
|
240
|
+
const shown = PlotScene.eased((elapsed - index * plot_painter_1.STAGGER) / plot_painter_1.DRAW_IN);
|
|
241
|
+
const { geometry, line } = this.curves[index];
|
|
242
|
+
const positions = geometry.getAttribute('position');
|
|
243
|
+
const [s0, s1] = curve.range;
|
|
244
|
+
const scope = plot_spec_1.PlotSpec.scope(0, 0, 0, elapsed, values);
|
|
245
|
+
let count = 0;
|
|
246
|
+
let last;
|
|
247
|
+
for (let i = 0; i < SAMPLES; i++) {
|
|
248
|
+
const s = s0 + ((s1 - s0) * shown * i) / (SAMPLES - 1);
|
|
249
|
+
const next = this.curvePoint(curve, scope, s, new this.THREE.Vector3());
|
|
250
|
+
if (next && last && last.distanceTo(next) < 1) {
|
|
251
|
+
positions.setXYZ(count++, last.x, last.y, last.z);
|
|
252
|
+
positions.setXYZ(count++, next.x, next.y, next.z);
|
|
253
|
+
}
|
|
254
|
+
last = next;
|
|
255
|
+
}
|
|
256
|
+
geometry.setDrawRange(0, count);
|
|
257
|
+
positions.needsUpdate = true;
|
|
258
|
+
geometry.computeBoundingSphere();
|
|
259
|
+
if (curve.dash) {
|
|
260
|
+
line.computeLineDistances();
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
let dot = 0;
|
|
264
|
+
plot.curves.forEach((curve, index) => {
|
|
265
|
+
if (!plot.dot || curve.dash) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const mesh = this.dots[dot++];
|
|
269
|
+
const [s0, s1] = curve.range;
|
|
270
|
+
const s = s0 + (s1 - s0) * (0.5 + 0.5 * Math.sin(elapsed * 0.9 + index * 1.3));
|
|
271
|
+
const at = this.curvePoint(curve, plot_spec_1.PlotSpec.scope(0, 0, 0, elapsed, values), s, mesh.position);
|
|
272
|
+
mesh.visible = !!at && elapsed > plot.curves.length * plot_painter_1.STAGGER + plot_painter_1.DRAW_IN;
|
|
273
|
+
});
|
|
274
|
+
const settled = elapsed > plot.curves.length * plot_painter_1.STAGGER + plot_painter_1.DRAW_IN * 0.6;
|
|
275
|
+
plot.points.forEach((point, index) => {
|
|
276
|
+
const scope = plot_spec_1.PlotSpec.scope(0, 0, 0, elapsed, values);
|
|
277
|
+
const x = point.x.evaluate(scope);
|
|
278
|
+
const y = point.y.evaluate(scope);
|
|
279
|
+
const z = point.z ? point.z.evaluate(scope) : this.z[0];
|
|
280
|
+
const mesh = this.points[index];
|
|
281
|
+
mesh.visible = settled && [x, y, z].every(Number.isFinite);
|
|
282
|
+
this.at(x, y, z, mesh.position);
|
|
283
|
+
});
|
|
284
|
+
return values;
|
|
285
|
+
}
|
|
286
|
+
/** A point of a curve in the scene: (x, y) on the floor for a curve y of x, (x, y, z) of s for one in space. */
|
|
287
|
+
curvePoint(curve, scope, s, target) {
|
|
288
|
+
scope[0] = s;
|
|
289
|
+
scope[2] = s;
|
|
290
|
+
const x = curve.x ? curve.x.evaluate(scope) : s;
|
|
291
|
+
const y = curve.y.evaluate(scope);
|
|
292
|
+
const z = curve.z ? curve.z.evaluate(scope) : this.z[0];
|
|
293
|
+
if (![x, y, z].every(Number.isFinite)) {
|
|
294
|
+
return undefined;
|
|
295
|
+
}
|
|
296
|
+
return this.at(x, y, z, target);
|
|
297
|
+
}
|
|
298
|
+
update(_seconds, elapsed) {
|
|
299
|
+
const { plot, input } = this;
|
|
300
|
+
const intro = elapsed < plot.curves.length * plot_painter_1.STAGGER + plot_painter_1.DRAW_IN + 0.6;
|
|
301
|
+
if (intro || plot.moving || plot.dot || input.dirty || this.drawn < 0) {
|
|
302
|
+
input.dirty = false;
|
|
303
|
+
const values = this.draw(elapsed);
|
|
304
|
+
this.drawn = elapsed;
|
|
305
|
+
if (values.length && elapsed - this.shownAt > 0.1) {
|
|
306
|
+
this.shownAt = elapsed;
|
|
307
|
+
input.shown(values);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
this.controls.update();
|
|
311
|
+
}
|
|
312
|
+
page(page) {
|
|
313
|
+
this.controls.autoRotate = !page.reduceMotion;
|
|
314
|
+
this.drawFrame(page);
|
|
315
|
+
}
|
|
316
|
+
dispose() {
|
|
317
|
+
this.context.element.removeEventListener('wheel', this.wheel);
|
|
318
|
+
this.controls.dispose();
|
|
319
|
+
}
|
|
320
|
+
/** How far the surfaces and curves in space reach in z, as they start: the range of z when none was written. */
|
|
321
|
+
static reach(plot, sliders) {
|
|
322
|
+
var _a;
|
|
323
|
+
var _b;
|
|
324
|
+
const values = plot_spec_1.PlotSpec.values(plot, 0, sliders);
|
|
325
|
+
const found = [];
|
|
326
|
+
const [x0, x1] = plot.x;
|
|
327
|
+
const [y0, y1] = plot.y;
|
|
328
|
+
const scope = plot_spec_1.PlotSpec.scope(0, 0, 0, 0, values);
|
|
329
|
+
for (const surface of plot.surfaces) {
|
|
330
|
+
for (let i = 0; i <= 24; i++) {
|
|
331
|
+
for (let j = 0; j <= 24; j++) {
|
|
332
|
+
scope[0] = x0 + ((x1 - x0) * j) / 24;
|
|
333
|
+
scope[1] = y0 + ((y1 - y0) * i) / 24;
|
|
334
|
+
found.push(surface.z.evaluate(scope));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
for (const curve of plot.curves) {
|
|
339
|
+
const [s0, s1] = curve.range;
|
|
340
|
+
for (let i = 0; i <= 100 && curve.z; i++) {
|
|
341
|
+
scope[0] = scope[2] = s0 + ((s1 - s0) * i) / 100;
|
|
342
|
+
found.push(curve.z.evaluate(scope));
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
for (const point of plot.points) {
|
|
346
|
+
found.push((_b = (_a = point.z) === null || _a === void 0 ? void 0 : _a.evaluate(scope)) !== null && _b !== void 0 ? _b : Number.NaN);
|
|
347
|
+
}
|
|
348
|
+
const finite = found.filter(Number.isFinite).sort((a, b) => a - b);
|
|
349
|
+
if (!finite.length) {
|
|
350
|
+
return [-1, 1];
|
|
351
|
+
}
|
|
352
|
+
// The middle 96%: a pole does not flatten the rest.
|
|
353
|
+
let low = finite[Math.floor(finite.length * 0.02)];
|
|
354
|
+
let high = finite[Math.ceil(finite.length * 0.98) - 1];
|
|
355
|
+
if (high - low < 1e-6) {
|
|
356
|
+
low -= 1;
|
|
357
|
+
high += 1;
|
|
358
|
+
}
|
|
359
|
+
const pad = (high - low) * 0.08;
|
|
360
|
+
return [low - pad, high + pad];
|
|
361
|
+
}
|
|
362
|
+
/** The color of a height between 0 (the bottom of the box) and 1 (its top). */
|
|
363
|
+
static ramp(height, target) {
|
|
364
|
+
const at = Math.min(Math.max(height, 0), 1) * (RAMP.length - 1);
|
|
365
|
+
const index = Math.min(Math.floor(at), RAMP.length - 2);
|
|
366
|
+
const low = target.set(RAMP[index]);
|
|
367
|
+
const r = low.r;
|
|
368
|
+
const g = low.g;
|
|
369
|
+
const b = low.b;
|
|
370
|
+
target.set(RAMP[index + 1]);
|
|
371
|
+
const k = at - index;
|
|
372
|
+
return target.setRGB(r + (target.r - r) * k, g + (target.g - g) * k, b + (target.b - b) * k);
|
|
373
|
+
}
|
|
374
|
+
static eased(shown) {
|
|
375
|
+
const clamped = Math.min(Math.max(shown, 0), 1);
|
|
376
|
+
return 1 - (1 - clamped) ** 3;
|
|
377
|
+
}
|
|
378
|
+
/** A word that always faces the camera. */
|
|
379
|
+
static label(THREE, text, color = '#888888', scale = 1) {
|
|
380
|
+
var _a;
|
|
381
|
+
const sprite = new THREE.Sprite(new THREE.SpriteMaterial({ map: PlotScene.texture(THREE, text, color), depthTest: false, transparent: true }));
|
|
382
|
+
sprite.userData.text = text;
|
|
383
|
+
const height = 0.13 * scale;
|
|
384
|
+
const image = (_a = sprite.material.map) === null || _a === void 0 ? void 0 : _a.image;
|
|
385
|
+
sprite.scale.set((height * image.width) / image.height, height, 1);
|
|
386
|
+
sprite.renderOrder = 10;
|
|
387
|
+
return sprite;
|
|
388
|
+
}
|
|
389
|
+
static textOf(sprite) {
|
|
390
|
+
var _a;
|
|
391
|
+
return String((_a = sprite.userData.text) !== null && _a !== void 0 ? _a : '');
|
|
392
|
+
}
|
|
393
|
+
static texture(THREE, text, color) {
|
|
394
|
+
var _a;
|
|
395
|
+
const canvas = document.createElement('canvas');
|
|
396
|
+
const context = canvas.getContext('2d');
|
|
397
|
+
const font = '600 40px system-ui, sans-serif';
|
|
398
|
+
if (context) {
|
|
399
|
+
context.font = font;
|
|
400
|
+
}
|
|
401
|
+
canvas.width = Math.ceil(((_a = context === null || context === void 0 ? void 0 : context.measureText(text).width) !== null && _a !== void 0 ? _a : 40) + 16);
|
|
402
|
+
canvas.height = 56;
|
|
403
|
+
if (context) {
|
|
404
|
+
context.font = font;
|
|
405
|
+
context.fillStyle = color;
|
|
406
|
+
context.textBaseline = 'middle';
|
|
407
|
+
context.fillText(text, 8, 28);
|
|
408
|
+
}
|
|
409
|
+
const texture = new THREE.CanvasTexture(canvas);
|
|
410
|
+
texture.colorSpace = THREE.SRGBColorSpace;
|
|
411
|
+
return texture;
|
|
412
|
+
}
|
|
413
|
+
static dispose(object) {
|
|
414
|
+
object.traverse(child => {
|
|
415
|
+
var _a, _b;
|
|
416
|
+
var _c;
|
|
417
|
+
const mesh = child;
|
|
418
|
+
(_a = mesh.geometry) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
419
|
+
for (const material of [].concat((_c = mesh.material) !== null && _c !== void 0 ? _c : [])) {
|
|
420
|
+
(_b = material.map) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
421
|
+
material.dispose();
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
exports.PlotScene = PlotScene;
|
|
427
|
+
//# sourceMappingURL=plot-scene.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { PlotExpression } from './plot-expression';
|
|
2
|
+
export type PlotRange = readonly [number, number];
|
|
3
|
+
/** A param the user drags. */
|
|
4
|
+
export interface PlotSlider {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
step: number;
|
|
8
|
+
/** Where it starts. */
|
|
9
|
+
value: number;
|
|
10
|
+
label?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A param of a plot: a slider, or an expression of t, the sliders and the params before it. */
|
|
13
|
+
export interface PlotParam {
|
|
14
|
+
name: string;
|
|
15
|
+
slider?: PlotSlider;
|
|
16
|
+
value?: PlotExpression.Compiled;
|
|
17
|
+
}
|
|
18
|
+
export interface PlotCurve {
|
|
19
|
+
label?: string;
|
|
20
|
+
dash: boolean;
|
|
21
|
+
color: string;
|
|
22
|
+
/** The range of s: of x for a curve y of x. */
|
|
23
|
+
range: PlotRange;
|
|
24
|
+
/** For a parametric curve; x is s otherwise. */
|
|
25
|
+
x?: PlotExpression.Compiled;
|
|
26
|
+
y: PlotExpression.Compiled;
|
|
27
|
+
/** For a curve in space: (x, y, z) of s. */
|
|
28
|
+
z?: PlotExpression.Compiled;
|
|
29
|
+
/** Drawn faintly for `count` values of the slider at `index` of the params too. */
|
|
30
|
+
family?: {
|
|
31
|
+
index: number;
|
|
32
|
+
count: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface PlotPoint {
|
|
36
|
+
label?: string;
|
|
37
|
+
x: PlotExpression.Compiled;
|
|
38
|
+
y: PlotExpression.Compiled;
|
|
39
|
+
z?: PlotExpression.Compiled;
|
|
40
|
+
}
|
|
41
|
+
/** A surface z of x and y, over the ranges of x and y. */
|
|
42
|
+
export interface PlotSurface {
|
|
43
|
+
label?: string;
|
|
44
|
+
/** One color; colored by height when none was written. */
|
|
45
|
+
color?: string;
|
|
46
|
+
z: PlotExpression.Compiled;
|
|
47
|
+
}
|
|
48
|
+
/** What the canvas draws of a `ta-plot` block. */
|
|
49
|
+
export interface Plot {
|
|
50
|
+
title?: string;
|
|
51
|
+
x: PlotRange;
|
|
52
|
+
y: PlotRange;
|
|
53
|
+
/** Of a plot in space, when written; else what its surfaces and curves reach. */
|
|
54
|
+
z?: PlotRange;
|
|
55
|
+
params: PlotParam[];
|
|
56
|
+
curves: PlotCurve[];
|
|
57
|
+
surfaces: PlotSurface[];
|
|
58
|
+
points: PlotPoint[];
|
|
59
|
+
/** In space (a surface, a curve or a point with z): drawn in 3D, turned by dragging. */
|
|
60
|
+
space: boolean;
|
|
61
|
+
/** A point running along each solid curve. */
|
|
62
|
+
dot: boolean;
|
|
63
|
+
/** Whether anything drawn changes with t, so that it is drawn every frame. */
|
|
64
|
+
moving: boolean;
|
|
65
|
+
}
|
|
66
|
+
export declare const PALETTE: string[];
|
|
67
|
+
/** The variables every expression has, before the params: `[x, y, s, t, ...params]` is the scope of an evaluation. */
|
|
68
|
+
export declare const VARIABLES: string[];
|
|
69
|
+
export declare namespace PlotSpec {
|
|
70
|
+
/** Throws an Error that says what is wrong for a block it cannot draw. */
|
|
71
|
+
function read(code: string): Plot;
|
|
72
|
+
/** A slider of a param written `{ value, min, max, step?, label? }`; undefined for anything else. */
|
|
73
|
+
function slider(value: unknown): PlotSlider | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* The values of the params at t seconds: the sliders where the user put them (`sliders`, by the index of their
|
|
76
|
+
* param; where they start when not moved), the others by their expressions, in order.
|
|
77
|
+
*/
|
|
78
|
+
function values(plot: Plot, t: number, sliders?: readonly (number | undefined)[]): number[];
|
|
79
|
+
/** The scope of an evaluation at (x, y), s and t, the params at `values`. */
|
|
80
|
+
function scope(x: number, y: number, s: number, t: number, values: readonly number[]): number[];
|
|
81
|
+
/** A step of the grid: 1, 2 or 5 times a power of ten, about an eighth of `span`. */
|
|
82
|
+
function niceStep(span: number): number;
|
|
83
|
+
/** A number as a label shows it: two decimals at most, 0 for what rounds to it. */
|
|
84
|
+
function format(value: number): string;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=plot-spec.d.ts.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlotSpec = exports.VARIABLES = exports.PALETTE = void 0;
|
|
4
|
+
const plot_expression_1 = require("./plot-expression");
|
|
5
|
+
exports.PALETTE = ['#4f8cff', '#ff7a59', '#2bb673', '#b36bff', '#f5b400', '#00b8d9'];
|
|
6
|
+
/** The variables every expression has, before the params: `[x, y, s, t, ...params]` is the scope of an evaluation. */
|
|
7
|
+
exports.VARIABLES = ['x', 'y', 's', 't'];
|
|
8
|
+
const MAX_CURVES = 12;
|
|
9
|
+
const MAX_SURFACES = 4;
|
|
10
|
+
const MAX_POINTS = 24;
|
|
11
|
+
var PlotSpec;
|
|
12
|
+
(function (PlotSpec) {
|
|
13
|
+
/** Throws an Error that says what is wrong for a block it cannot draw. */
|
|
14
|
+
function read(code) {
|
|
15
|
+
var _a;
|
|
16
|
+
const spec = object(JSON.parse(code));
|
|
17
|
+
if (!spec) {
|
|
18
|
+
throw new Error('A plot is a JSON object');
|
|
19
|
+
}
|
|
20
|
+
const x = range(spec.x, [-5, 5]);
|
|
21
|
+
const raw = (_a = object(spec.params)) !== null && _a !== void 0 ? _a : {};
|
|
22
|
+
const names = Object.keys(raw).filter(name => /^[A-Za-z_]\w*$/.test(name) && !exports.VARIABLES.includes(name));
|
|
23
|
+
const scope = [...exports.VARIABLES, ...names];
|
|
24
|
+
const moving = new Set(['t']);
|
|
25
|
+
const params = names.map((name, index) => {
|
|
26
|
+
const slider = PlotSpec.slider(raw[name]);
|
|
27
|
+
if (slider) {
|
|
28
|
+
return { name, slider };
|
|
29
|
+
}
|
|
30
|
+
const value = plot_expression_1.PlotExpression.compile(expression(raw[name], name), scope);
|
|
31
|
+
for (const used of value.uses) {
|
|
32
|
+
if (names.indexOf(used) >= index && !PlotSpec.slider(raw[used])) {
|
|
33
|
+
throw new Error(`Param ${name} uses ${used}, which is not before it`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if ([...value.uses].some(used => moving.has(used))) {
|
|
37
|
+
moving.add(name);
|
|
38
|
+
}
|
|
39
|
+
return { name, value };
|
|
40
|
+
});
|
|
41
|
+
const moves = (compiled) => !!compiled && [...compiled.uses].some(used => moving.has(used));
|
|
42
|
+
let color = 0;
|
|
43
|
+
const curves = list(spec.curves)
|
|
44
|
+
.slice(0, MAX_CURVES)
|
|
45
|
+
.map((curve) => {
|
|
46
|
+
const parametric = curve.x !== undefined || curve.z !== undefined;
|
|
47
|
+
const family = typeof curve.family === 'string' ? { param: curve.family } : object(curve.family);
|
|
48
|
+
const index = family ? params.findIndex(param => param.slider && param.name === family.param) : -1;
|
|
49
|
+
const count = family && Number.isFinite(family.count) ? Math.round(family.count) : 9;
|
|
50
|
+
return {
|
|
51
|
+
label: text(curve.label),
|
|
52
|
+
dash: !!curve.dash,
|
|
53
|
+
color: typeof curve.color === 'string' && curve.color.length < 40 ? curve.color : exports.PALETTE[color++ % exports.PALETTE.length],
|
|
54
|
+
range: parametric ? range(curve.s, [-3, 3]) : x,
|
|
55
|
+
x: parametric ? plot_expression_1.PlotExpression.compile(expression(curve.x, 'x'), scope) : undefined,
|
|
56
|
+
y: plot_expression_1.PlotExpression.compile(expression(curve.y, 'y'), scope),
|
|
57
|
+
z: curve.z === undefined ? undefined : plot_expression_1.PlotExpression.compile(expression(curve.z, 'z'), scope),
|
|
58
|
+
family: index < 0 ? undefined : { index, count: Math.min(Math.max(count, 2), 41) },
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const surfaces = list(spec.surfaces)
|
|
62
|
+
.slice(0, MAX_SURFACES)
|
|
63
|
+
.map((surface) => ({
|
|
64
|
+
label: text(surface.label),
|
|
65
|
+
color: typeof surface.color === 'string' && surface.color.length < 40 ? surface.color : undefined,
|
|
66
|
+
z: plot_expression_1.PlotExpression.compile(expression(surface.z, 'z'), scope),
|
|
67
|
+
}));
|
|
68
|
+
if (!curves.length && !surfaces.length) {
|
|
69
|
+
throw new Error('A plot has no curves');
|
|
70
|
+
}
|
|
71
|
+
const points = list(spec.points)
|
|
72
|
+
.slice(0, MAX_POINTS)
|
|
73
|
+
.map((point) => ({
|
|
74
|
+
label: text(point.label),
|
|
75
|
+
x: plot_expression_1.PlotExpression.compile(expression(point.x, 'x'), scope),
|
|
76
|
+
y: plot_expression_1.PlotExpression.compile(expression(point.y, 'y'), scope),
|
|
77
|
+
z: point.z === undefined ? undefined : plot_expression_1.PlotExpression.compile(expression(point.z, 'z'), scope),
|
|
78
|
+
}));
|
|
79
|
+
const space = surfaces.length > 0 || curves.some(curve => curve.z) || points.some(point => point.z);
|
|
80
|
+
return {
|
|
81
|
+
title: text(spec.title),
|
|
82
|
+
x,
|
|
83
|
+
y: range(spec.y, [-5, 5]),
|
|
84
|
+
z: spec.z === undefined ? undefined : range(spec.z, [-5, 5]),
|
|
85
|
+
params,
|
|
86
|
+
curves,
|
|
87
|
+
surfaces,
|
|
88
|
+
points,
|
|
89
|
+
space,
|
|
90
|
+
dot: !!spec.dot,
|
|
91
|
+
moving: params.some(param => moving.has(param.name)) ||
|
|
92
|
+
curves.some(curve => moves(curve.x) || moves(curve.y) || moves(curve.z)) ||
|
|
93
|
+
surfaces.some(surface => moves(surface.z)) ||
|
|
94
|
+
points.some(point => moves(point.x) || moves(point.y) || moves(point.z)),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
PlotSpec.read = read;
|
|
98
|
+
/** A slider of a param written `{ value, min, max, step?, label? }`; undefined for anything else. */
|
|
99
|
+
function slider(value) {
|
|
100
|
+
const spec = object(value);
|
|
101
|
+
if (!spec || !Number.isFinite(spec.min) || !Number.isFinite(spec.max) || spec.min === spec.max) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const [min, max] = [spec.min, spec.max].sort((a, b) => a - b);
|
|
105
|
+
const step = Number.isFinite(spec.step) && spec.step > 0 ? spec.step : niceStep(max - min) / 10;
|
|
106
|
+
const start = Number.isFinite(spec.value) ? Math.min(Math.max(spec.value, min), max) : (min + max) / 2;
|
|
107
|
+
return { min, max, step, value: start, label: text(spec.label) };
|
|
108
|
+
}
|
|
109
|
+
PlotSpec.slider = slider;
|
|
110
|
+
/**
|
|
111
|
+
* The values of the params at t seconds: the sliders where the user put them (`sliders`, by the index of their
|
|
112
|
+
* param; where they start when not moved), the others by their expressions, in order.
|
|
113
|
+
*/
|
|
114
|
+
function values(plot, t, sliders = []) {
|
|
115
|
+
const scope = [0, 0, 0, t];
|
|
116
|
+
plot.params.forEach((param, index) => {
|
|
117
|
+
var _a;
|
|
118
|
+
scope.push(param.slider ? ((_a = sliders[index]) !== null && _a !== void 0 ? _a : param.slider.value) : Number.NaN);
|
|
119
|
+
});
|
|
120
|
+
plot.params.forEach((param, index) => {
|
|
121
|
+
if (param.value) {
|
|
122
|
+
scope[exports.VARIABLES.length + index] = param.value.evaluate(scope);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
return scope.slice(exports.VARIABLES.length);
|
|
126
|
+
}
|
|
127
|
+
PlotSpec.values = values;
|
|
128
|
+
/** The scope of an evaluation at (x, y), s and t, the params at `values`. */
|
|
129
|
+
function scope(x, y, s, t, values) {
|
|
130
|
+
return [x, y, s, t, ...values];
|
|
131
|
+
}
|
|
132
|
+
PlotSpec.scope = scope;
|
|
133
|
+
/** A step of the grid: 1, 2 or 5 times a power of ten, about an eighth of `span`. */
|
|
134
|
+
function niceStep(span) {
|
|
135
|
+
const raw = span / 8;
|
|
136
|
+
const power = 10 ** Math.floor(Math.log10(raw));
|
|
137
|
+
const unit = raw / power;
|
|
138
|
+
return (unit < 1.5 ? 1 : unit < 3.5 ? 2 : unit < 7.5 ? 5 : 10) * power;
|
|
139
|
+
}
|
|
140
|
+
PlotSpec.niceStep = niceStep;
|
|
141
|
+
/** A number as a label shows it: two decimals at most, 0 for what rounds to it. */
|
|
142
|
+
function format(value) {
|
|
143
|
+
return Math.abs(value) < 1e-9 ? '0' : String(Math.round(value * 100) / 100);
|
|
144
|
+
}
|
|
145
|
+
PlotSpec.format = format;
|
|
146
|
+
})(PlotSpec || (exports.PlotSpec = PlotSpec = {}));
|
|
147
|
+
function object(value) {
|
|
148
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
|
|
149
|
+
}
|
|
150
|
+
function list(value) {
|
|
151
|
+
return Array.isArray(value) ? value.map(object).filter((item) => !!item) : [];
|
|
152
|
+
}
|
|
153
|
+
function text(value) {
|
|
154
|
+
return typeof value === 'string' && value ? value : undefined;
|
|
155
|
+
}
|
|
156
|
+
function range(value, fallback) {
|
|
157
|
+
return Array.isArray(value) && value.length === 2 && value.every(Number.isFinite) && value[0] < value[1] ? [value[0], value[1]] : fallback;
|
|
158
|
+
}
|
|
159
|
+
function expression(value, what) {
|
|
160
|
+
if (typeof value === 'string' || (typeof value === 'number' && Number.isFinite(value))) {
|
|
161
|
+
return value;
|
|
162
|
+
}
|
|
163
|
+
throw new Error(`No expression for ${what}`);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=plot-spec.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WebCodeRendererProps, WebExtensionAPI } from '@celljs/ta-web/lib/browser/extension/web-extension-api';
|
|
2
|
+
/** The renderer of a `ta-plot` block: the plot once the block is closed, what is wrong with it when it cannot be drawn. */
|
|
3
|
+
export declare function plotView(pi: WebExtensionAPI): React.ComponentType<WebCodeRendererProps>;
|
|
4
|
+
//# sourceMappingURL=plot-view.d.ts.map
|