@skillcdn/console 0.4.7 → 0.5.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/README.md +74 -14
- package/SKILLCDN.md +5 -3
- package/dist/agent-page.d.ts +44 -0
- package/dist/agent-page.d.ts.map +1 -0
- package/dist/agent-page.js +415 -0
- package/dist/agent-page.js.map +1 -0
- package/dist/agent-stream.d.ts +52 -0
- package/dist/agent-stream.d.ts.map +1 -0
- package/dist/agent-stream.js +155 -0
- package/dist/agent-stream.js.map +1 -0
- package/dist/api.d.ts +12 -6
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +11 -5
- package/dist/api.js.map +1 -1
- package/dist/avatar.d.ts +137 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +1216 -0
- package/dist/avatar.js.map +1 -0
- package/dist/charts.d.ts +103 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +182 -0
- package/dist/charts.js.map +1 -0
- package/dist/cli/cli.d.ts +39 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +2424 -296
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/command-words.d.ts +20 -0
- package/dist/cli/command-words.d.ts.map +1 -0
- package/dist/cli/command-words.js +51 -0
- package/dist/cli/command-words.js.map +1 -0
- package/dist/cli/credentials.d.ts +59 -5
- package/dist/cli/credentials.d.ts.map +1 -1
- package/dist/cli/credentials.js +128 -16
- package/dist/cli/credentials.js.map +1 -1
- package/dist/cli/directory.d.ts +19 -4
- package/dist/cli/directory.d.ts.map +1 -1
- package/dist/cli/directory.js +16 -8
- package/dist/cli/directory.js.map +1 -1
- package/dist/cli/format.d.ts +91 -8
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +386 -57
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts +13 -4
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +202 -62
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +94 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/pack.d.ts +69 -36
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +241 -188
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/plugin-check.d.ts +42 -0
- package/dist/cli/plugin-check.d.ts.map +1 -1
- package/dist/cli/plugin-check.js +221 -36
- package/dist/cli/plugin-check.js.map +1 -1
- package/dist/cli/plugin-cli.d.ts +6 -1
- package/dist/cli/plugin-cli.d.ts.map +1 -1
- package/dist/cli/plugin-cli.js +21 -4
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/plugin-main.js +1 -0
- package/dist/cli/plugin-main.js.map +1 -1
- package/dist/cli/runner-host.d.ts +36 -0
- package/dist/cli/runner-host.d.ts.map +1 -0
- package/dist/cli/runner-host.js +154 -0
- package/dist/cli/runner-host.js.map +1 -0
- package/dist/cli/serve.d.ts +33 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +275 -6
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/setup-machine.d.ts +36 -0
- package/dist/cli/setup-machine.d.ts.map +1 -0
- package/dist/cli/setup-machine.js +109 -0
- package/dist/cli/setup-machine.js.map +1 -0
- package/dist/client.d.ts +189 -10
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +192 -57
- package/dist/client.js.map +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js +2 -2
- package/dist/components/agent-page.d.ts +384 -0
- package/dist/components/agent-page.d.ts.map +1 -0
- package/dist/components/agent-page.js +985 -0
- package/dist/components/agent-page.js.map +1 -0
- package/dist/components/agents.d.ts +102 -0
- package/dist/components/agents.d.ts.map +1 -0
- package/dist/components/agents.js +246 -0
- package/dist/components/agents.js.map +1 -0
- package/dist/components/calendar.d.ts +17 -17
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +7 -2
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/charts.d.ts +157 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/charts.js +182 -0
- package/dist/components/charts.js.map +1 -0
- package/dist/components/comments.d.ts +2 -0
- package/dist/components/comments.d.ts.map +1 -1
- package/dist/components/comments.js +1 -1
- package/dist/components/comments.js.map +1 -1
- package/dist/components/connect.d.ts.map +1 -1
- package/dist/components/connect.js +7 -2
- package/dist/components/connect.js.map +1 -1
- package/dist/components/decision-form.d.ts +21 -0
- package/dist/components/decision-form.d.ts.map +1 -1
- package/dist/components/decision-form.js +20 -6
- package/dist/components/decision-form.js.map +1 -1
- package/dist/components/decision-list.d.ts +24 -0
- package/dist/components/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +54 -5
- package/dist/components/decision-list.js.map +1 -1
- package/dist/components/desk-records.d.ts +102 -0
- package/dist/components/desk-records.d.ts.map +1 -0
- package/dist/components/desk-records.js +221 -0
- package/dist/components/desk-records.js.map +1 -0
- package/dist/components/desk.d.ts +85 -0
- package/dist/components/desk.d.ts.map +1 -0
- package/dist/components/desk.js +135 -0
- package/dist/components/desk.js.map +1 -0
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +26 -1
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/home.d.ts +12 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +175 -16
- package/dist/components/home.js.map +1 -1
- package/dist/components/my-decisions.d.ts +5 -0
- package/dist/components/my-decisions.d.ts.map +1 -1
- package/dist/components/my-decisions.js +3 -3
- package/dist/components/my-decisions.js.map +1 -1
- package/dist/components/people.d.ts +17 -0
- package/dist/components/people.d.ts.map +1 -1
- package/dist/components/people.js +55 -19
- package/dist/components/people.js.map +1 -1
- package/dist/components/picker.d.ts +2 -0
- package/dist/components/picker.d.ts.map +1 -1
- package/dist/components/picker.js +1 -1
- package/dist/components/picker.js.map +1 -1
- package/dist/components/pictures.d.ts +38 -10
- package/dist/components/pictures.d.ts.map +1 -1
- package/dist/components/pictures.js +195 -40
- package/dist/components/pictures.js.map +1 -1
- package/dist/components/plugin-events.d.ts +29 -0
- package/dist/components/plugin-events.d.ts.map +1 -0
- package/dist/components/plugin-events.js +139 -0
- package/dist/components/plugin-events.js.map +1 -0
- package/dist/components/plugin-frame.d.ts.map +1 -1
- package/dist/components/plugin-frame.js +14 -37
- package/dist/components/plugin-frame.js.map +1 -1
- package/dist/components/plugin-settings.d.ts.map +1 -1
- package/dist/components/plugin-settings.js +58 -7
- package/dist/components/plugin-settings.js.map +1 -1
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +30 -10
- package/dist/components/projects.js.map +1 -1
- package/dist/components/rules.d.ts +8 -10
- package/dist/components/rules.d.ts.map +1 -1
- package/dist/components/rules.js +36 -14
- package/dist/components/rules.js.map +1 -1
- package/dist/components/sessions.d.ts.map +1 -1
- package/dist/components/sessions.js +8 -4
- package/dist/components/sessions.js.map +1 -1
- package/dist/components/setup.d.ts +59 -0
- package/dist/components/setup.d.ts.map +1 -0
- package/dist/components/setup.js +93 -0
- package/dist/components/setup.js.map +1 -0
- package/dist/components/sign-in.js +1 -1
- package/dist/components/sign-in.js.map +1 -1
- package/dist/components/task-form.d.ts.map +1 -1
- package/dist/components/task-form.js +2 -2
- package/dist/components/task-form.js.map +1 -1
- package/dist/components/task-list.d.ts +7 -6
- package/dist/components/task-list.d.ts.map +1 -1
- package/dist/components/task-list.js.map +1 -1
- package/dist/components/task-view.d.ts +3 -0
- package/dist/components/task-view.d.ts.map +1 -1
- package/dist/components/task-view.js +1 -1
- package/dist/components/task-view.js.map +1 -1
- package/dist/components/ui.d.ts +78 -8
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +88 -9
- package/dist/components/ui.js.map +1 -1
- package/dist/components/work.d.ts +5 -5
- package/dist/components/work.d.ts.map +1 -1
- package/dist/components/work.js.map +1 -1
- package/dist/components/workspace.d.ts +17 -0
- package/dist/components/workspace.d.ts.map +1 -1
- package/dist/components/workspace.js +129 -2
- package/dist/components/workspace.js.map +1 -1
- package/dist/connect-page.d.ts.map +1 -1
- package/dist/connect-page.js +5 -2
- package/dist/connect-page.js.map +1 -1
- package/dist/console.css +7551 -4580
- package/dist/console.d.ts +20 -0
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +331 -57
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts +22 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +62 -34
- package/dist/data.js.map +1 -1
- package/dist/desk-page.d.ts +38 -0
- package/dist/desk-page.d.ts.map +1 -0
- package/dist/desk-page.js +184 -0
- package/dist/desk-page.js.map +1 -0
- package/dist/desk-records-page.d.ts +18 -0
- package/dist/desk-records-page.d.ts.map +1 -0
- package/dist/desk-records-page.js +130 -0
- package/dist/desk-records-page.js.map +1 -0
- package/dist/desk-records.d.ts +247 -0
- package/dist/desk-records.d.ts.map +1 -0
- package/dist/desk-records.js +543 -0
- package/dist/desk-records.js.map +1 -0
- package/dist/desk.d.ts +122 -0
- package/dist/desk.d.ts.map +1 -0
- package/dist/desk.js +211 -0
- package/dist/desk.js.map +1 -0
- package/dist/feed-stream.d.ts +39 -0
- package/dist/feed-stream.d.ts.map +1 -0
- package/dist/feed-stream.js +117 -0
- package/dist/feed-stream.js.map +1 -0
- package/dist/glances.d.ts +39 -0
- package/dist/glances.d.ts.map +1 -0
- package/dist/glances.js +94 -0
- package/dist/glances.js.map +1 -0
- package/dist/home-tiles.d.ts +69 -5
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +347 -9
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +773 -3
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +770 -9
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +736 -9
- package/dist/i18n/ko.js.map +1 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +67 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +67 -0
- package/dist/limits.js.map +1 -1
- package/dist/onboarding.d.ts +21 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +43 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/persona.d.ts +34 -0
- package/dist/persona.d.ts.map +1 -0
- package/dist/persona.js +71 -0
- package/dist/persona.js.map +1 -0
- package/dist/plugin/context.d.ts +42 -11
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/limits.d.ts +2 -0
- package/dist/plugin/limits.d.ts.map +1 -1
- package/dist/plugin/limits.js +2 -0
- package/dist/plugin/limits.js.map +1 -1
- package/dist/plugin/manifest.d.ts +13 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +34 -4
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +56 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +42 -0
- package/dist/plugin/rest-schemas.js.map +1 -1
- package/dist/plugin/sandbox.d.ts.map +1 -1
- package/dist/plugin/sandbox.js +4 -1
- package/dist/plugin/sandbox.js.map +1 -1
- package/dist/plugin/testing.d.ts +6 -2
- package/dist/plugin/testing.d.ts.map +1 -1
- package/dist/plugin/testing.js +52 -10
- package/dist/plugin/testing.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/records.d.ts +283 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +543 -0
- package/dist/records.js.map +1 -0
- package/dist/router.d.ts +50 -3
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +78 -7
- package/dist/router.js.map +1 -1
- package/dist/routes.d.ts +12 -2
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +14 -1
- package/dist/routes.js.map +1 -1
- package/dist/rules.d.ts +30 -11
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +99 -42
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts +20 -0
- package/dist/runner/acp.d.ts.map +1 -0
- package/dist/runner/acp.js +1132 -0
- package/dist/runner/acp.js.map +1 -0
- package/dist/runner/claude.d.ts +13 -0
- package/dist/runner/claude.d.ts.map +1 -0
- package/dist/runner/claude.js +615 -0
- package/dist/runner/claude.js.map +1 -0
- package/dist/runner/codex.d.ts +19 -0
- package/dist/runner/codex.d.ts.map +1 -0
- package/dist/runner/codex.js +597 -0
- package/dist/runner/codex.js.map +1 -0
- package/dist/runner/config.d.ts +35 -0
- package/dist/runner/config.d.ts.map +1 -0
- package/dist/runner/config.js +74 -0
- package/dist/runner/config.js.map +1 -0
- package/dist/runner/desk.d.ts +81 -0
- package/dist/runner/desk.d.ts.map +1 -0
- package/dist/runner/desk.js +303 -0
- package/dist/runner/desk.js.map +1 -0
- package/dist/runner/launchd.d.ts +7 -0
- package/dist/runner/launchd.d.ts.map +1 -0
- package/dist/runner/launchd.js +78 -0
- package/dist/runner/launchd.js.map +1 -0
- package/dist/runner/message.d.ts +66 -0
- package/dist/runner/message.d.ts.map +1 -0
- package/dist/runner/message.js +181 -0
- package/dist/runner/message.js.map +1 -0
- package/dist/runner/modules.d.ts +13 -0
- package/dist/runner/modules.d.ts.map +1 -0
- package/dist/runner/modules.js +30 -0
- package/dist/runner/modules.js.map +1 -0
- package/dist/runner/process.d.ts +7 -0
- package/dist/runner/process.d.ts.map +1 -0
- package/dist/runner/process.js +65 -0
- package/dist/runner/process.js.map +1 -0
- package/dist/runner/redact.d.ts +48 -0
- package/dist/runner/redact.d.ts.map +1 -0
- package/dist/runner/redact.js +214 -0
- package/dist/runner/redact.js.map +1 -0
- package/dist/runner/registry.d.ts +37 -0
- package/dist/runner/registry.d.ts.map +1 -0
- package/dist/runner/registry.js +26 -0
- package/dist/runner/registry.js.map +1 -0
- package/dist/runner/runner.d.ts +130 -0
- package/dist/runner/runner.d.ts.map +1 -0
- package/dist/runner/runner.js +1551 -0
- package/dist/runner/runner.js.map +1 -0
- package/dist/runner/slack.d.ts +16 -0
- package/dist/runner/slack.d.ts.map +1 -0
- package/dist/runner/slack.js +157 -0
- package/dist/runner/slack.js.map +1 -0
- package/dist/runner/systemd-user.d.ts +7 -0
- package/dist/runner/systemd-user.d.ts.map +1 -0
- package/dist/runner/systemd-user.js +93 -0
- package/dist/runner/systemd-user.js.map +1 -0
- package/dist/runner/task-scheduler.d.ts +38 -0
- package/dist/runner/task-scheduler.d.ts.map +1 -0
- package/dist/runner/task-scheduler.js +216 -0
- package/dist/runner/task-scheduler.js.map +1 -0
- package/dist/runner/types.d.ts +315 -0
- package/dist/runner/types.d.ts.map +1 -0
- package/dist/runner/types.js +24 -0
- package/dist/runner/types.js.map +1 -0
- package/dist/runner.d.ts +18 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +20 -0
- package/dist/runner.js.map +1 -0
- package/dist/schemas.d.ts +6082 -1295
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +930 -31
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts +110 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +305 -0
- package/dist/services.js.map +1 -0
- package/dist/setup-guide.d.ts +64 -0
- package/dist/setup-guide.d.ts.map +1 -0
- package/dist/setup-guide.js +256 -0
- package/dist/setup-guide.js.map +1 -0
- package/dist/setup-page.d.ts +6 -0
- package/dist/setup-page.d.ts.map +1 -0
- package/dist/setup-page.js +29 -0
- package/dist/setup-page.js.map +1 -0
- package/dist/sse.d.ts +15 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +73 -0
- package/dist/sse.js.map +1 -0
- package/dist/tab-title.d.ts +6 -0
- package/dist/tab-title.d.ts.map +1 -0
- package/dist/tab-title.js +22 -0
- package/dist/tab-title.js.map +1 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +3 -0
- package/dist/tokens.js.map +1 -1
- package/dist/use-action.d.ts +5 -2
- package/dist/use-action.d.ts.map +1 -1
- package/dist/use-action.js +6 -1
- package/dist/use-action.js.map +1 -1
- package/dist/vocabulary.d.ts +84 -4
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +115 -3
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +147 -41
- package/docs/specs/plugins.md +37 -27
- package/docs/specs/records.md +113 -0
- package/docs/specs/rest.md +155 -20
- package/docs/specs/runner.md +347 -0
- package/package.json +12 -3
- package/skills/building-a-console/SKILL.md +4 -4
- package/skills/building-a-console/references/configuring.md +1 -0
- package/skills/building-a-plugin/SKILL.md +7 -7
- package/skills/deploying-a-console/SKILL.md +4 -4
- package/skills/deploying-a-console/references/resources.md +48 -8
- package/skills/deploying-a-console/references/running-it-again.md +3 -2
- package/skills/keeping-a-desk/SKILL.md +133 -0
- package/skills/keeping-a-desk/collections.md +96 -0
- package/skills/planning-the-board/SKILL.md +14 -18
- package/skills/planning-the-board/references/a-task.md +2 -2
- package/skills/planning-the-board/references/project-rules.md +13 -14
- package/skills/planning-the-board/references/setting-up.md +22 -9
- package/skills/running-an-agent/SKILL.md +107 -0
- package/skills/running-an-agent/references/slack-app.md +61 -0
- package/skills/working-the-board/SKILL.md +66 -39
- package/skills/working-the-board/references/terms.md +9 -5
- package/skills/working-the-board/references/the-pack.md +14 -9
- package/skills/working-the-board/references/the-sentence.md +2 -2
- package/src/agent-page.tsx +1039 -0
- package/src/agent-stream.ts +199 -0
- package/src/api.ts +317 -2
- package/src/avatar.ts +1506 -0
- package/src/charts.ts +250 -0
- package/src/cli/cli.ts +3210 -503
- package/src/cli/command-words.ts +56 -0
- package/src/cli/credentials.ts +188 -16
- package/src/cli/directory.ts +28 -10
- package/src/cli/format.ts +470 -67
- package/src/cli/help.ts +233 -61
- package/src/cli/main.ts +89 -0
- package/src/cli/pack.ts +332 -263
- package/src/cli/plugin-check.ts +275 -34
- package/src/cli/plugin-cli.ts +28 -4
- package/src/cli/plugin-main.ts +1 -0
- package/src/cli/runner-host.ts +188 -0
- package/src/cli/serve.ts +320 -5
- package/src/cli/setup-machine.ts +153 -0
- package/src/client.ts +711 -126
- package/src/compat.ts +2 -2
- package/src/components/agent-page.tsx +1946 -0
- package/src/components/agents.tsx +638 -0
- package/src/components/calendar.tsx +74 -53
- package/src/components/charts.tsx +680 -0
- package/src/components/comments.tsx +3 -0
- package/src/components/connect.tsx +37 -2
- package/src/components/decision-form.tsx +89 -51
- package/src/components/decision-list.tsx +140 -4
- package/src/components/desk-records.tsx +724 -0
- package/src/components/desk.tsx +471 -0
- package/src/components/event-feed.tsx +30 -1
- package/src/components/home.tsx +353 -12
- package/src/components/my-decisions.tsx +8 -2
- package/src/components/people.tsx +300 -203
- package/src/components/picker.tsx +3 -1
- package/src/components/pictures.tsx +256 -44
- package/src/components/plugin-events.ts +159 -0
- package/src/components/plugin-frame.tsx +14 -38
- package/src/components/plugin-settings.tsx +178 -22
- package/src/components/projects.tsx +33 -15
- package/src/components/rules.tsx +96 -36
- package/src/components/sessions.tsx +7 -4
- package/src/components/setup.tsx +252 -0
- package/src/components/sign-in.tsx +1 -1
- package/src/components/task-form.tsx +11 -2
- package/src/components/task-list.tsx +7 -6
- package/src/components/task-view.tsx +4 -0
- package/src/components/ui.tsx +169 -25
- package/src/components/work.tsx +9 -9
- package/src/components/workspace.tsx +345 -4
- package/src/connect-page.tsx +15 -2
- package/src/console.tsx +657 -83
- package/src/data.ts +109 -43
- package/src/desk-page.tsx +332 -0
- package/src/desk-records-page.tsx +256 -0
- package/src/desk-records.ts +808 -0
- package/src/desk.ts +329 -0
- package/src/feed-stream.ts +144 -0
- package/src/glances.ts +132 -0
- package/src/home-tiles.ts +411 -9
- package/src/i18n/en.ts +828 -10
- package/src/i18n/ko.ts +792 -10
- package/src/index.ts +172 -3
- package/src/limits.ts +67 -0
- package/src/onboarding.ts +84 -0
- package/src/persona.ts +100 -0
- package/src/plugin/context.ts +55 -12
- package/src/plugin/limits.ts +2 -0
- package/src/plugin/manifest.ts +42 -3
- package/src/plugin/rest-schemas.ts +46 -0
- package/src/plugin/sandbox.ts +4 -1
- package/src/plugin/testing.ts +63 -12
- package/src/plugin.ts +2 -0
- package/src/records.ts +702 -0
- package/src/router.ts +120 -10
- package/src/routes.ts +17 -1
- package/src/rules.ts +109 -44
- package/src/runner/acp.ts +1267 -0
- package/src/runner/claude.ts +695 -0
- package/src/runner/codex.ts +691 -0
- package/src/runner/config.ts +97 -0
- package/src/runner/desk.ts +377 -0
- package/src/runner/launchd.ts +86 -0
- package/src/runner/message.ts +232 -0
- package/src/runner/modules.ts +30 -0
- package/src/runner/process.ts +72 -0
- package/src/runner/redact.ts +242 -0
- package/src/runner/registry.ts +67 -0
- package/src/runner/runner.ts +1879 -0
- package/src/runner/slack.ts +180 -0
- package/src/runner/systemd-user.ts +103 -0
- package/src/runner/task-scheduler.ts +236 -0
- package/src/runner/types.ts +334 -0
- package/src/runner.ts +110 -0
- package/src/schemas.ts +1183 -30
- package/src/services.ts +424 -0
- package/src/setup-guide.ts +336 -0
- package/src/setup-page.tsx +46 -0
- package/src/sse.ts +84 -0
- package/src/styles/README.md +111 -0
- package/src/styles/base.css +130 -0
- package/src/styles/console.css +85 -7095
- package/src/styles/drawn-by-pages.json +256 -0
- package/src/styles/pages/agents.css +1195 -0
- package/src/styles/pages/board.css +380 -0
- package/src/styles/pages/calendar.css +214 -0
- package/src/styles/pages/connect.css +182 -0
- package/src/styles/pages/decisions.css +370 -0
- package/src/styles/pages/desk.css +126 -0
- package/src/styles/pages/documents.css +273 -0
- package/src/styles/pages/feed.css +118 -0
- package/src/styles/pages/home.css +718 -0
- package/src/styles/pages/people.css +90 -0
- package/src/styles/pages/plugins.css +212 -0
- package/src/styles/pages/roadmap.css +377 -0
- package/src/styles/pages/settings.css +171 -0
- package/src/styles/pages/shell.css +208 -0
- package/src/styles/pages/sign-in.css +178 -0
- package/src/styles/pages/task.css +108 -0
- package/src/styles/pages/thread.css +331 -0
- package/src/styles/pages/work.css +68 -0
- package/src/styles/parts/avatar.css +82 -0
- package/src/styles/parts/badge.css +227 -0
- package/src/styles/parts/bars.css +80 -0
- package/src/styles/parts/button.css +99 -0
- package/src/styles/parts/calendar.css +547 -0
- package/src/styles/parts/callout.css +41 -0
- package/src/styles/parts/category.css +8 -0
- package/src/styles/parts/chart.css +173 -0
- package/src/styles/parts/chip.css +90 -0
- package/src/styles/parts/code.css +48 -0
- package/src/styles/parts/count.css +27 -0
- package/src/styles/parts/crumbs.css +61 -0
- package/src/styles/parts/detail.css +110 -0
- package/src/styles/parts/empty.css +21 -0
- package/src/styles/parts/eyebrow.css +9 -0
- package/src/styles/parts/facts.css +147 -0
- package/src/styles/parts/figures.css +65 -0
- package/src/styles/parts/files.css +38 -0
- package/src/styles/parts/filters.css +42 -0
- package/src/styles/parts/form.css +109 -0
- package/src/styles/parts/frame.css +45 -0
- package/src/styles/parts/input.css +243 -0
- package/src/styles/parts/legend.css +48 -0
- package/src/styles/parts/links.css +37 -0
- package/src/styles/parts/mark.css +79 -0
- package/src/styles/parts/menu.css +147 -0
- package/src/styles/parts/page.css +174 -0
- package/src/styles/parts/pager.css +19 -0
- package/src/styles/parts/panel.css +33 -0
- package/src/styles/parts/person.css +257 -0
- package/src/styles/parts/picker.css +185 -0
- package/src/styles/parts/progress.css +25 -0
- package/src/styles/parts/prose.css +128 -0
- package/src/styles/parts/rows.css +63 -0
- package/src/styles/parts/series.css +32 -0
- package/src/styles/parts/settings.css +101 -0
- package/src/styles/parts/share.css +25 -0
- package/src/styles/parts/spark.css +23 -0
- package/src/styles/parts/spinner.css +29 -0
- package/src/styles/parts/stat.css +69 -0
- package/src/styles/parts/steps.css +68 -0
- package/src/styles/parts/tabs.css +175 -0
- package/src/styles/parts/text.css +61 -0
- package/src/styles/parts/toggle.css +71 -0
- package/src/styles/parts/workers.css +37 -0
- package/src/styles/tokens.css +295 -0
- package/src/tab-title.ts +25 -0
- package/src/tokens.ts +3 -0
- package/src/use-action.ts +7 -2
- package/src/vocabulary.ts +151 -3
- package/template/desk-web/README.md +8 -0
- package/template/desk-web/index.html +13 -0
- package/template/desk-web/package.json +25 -0
- package/template/desk-web/src/main.tsx +24 -0
- package/template/desk-web/src/page.tsx +51 -0
- package/template/desk-web/tsconfig.json +16 -0
- package/template/desk-web/vite.config.ts +15 -0
|
@@ -29,53 +29,121 @@ export interface Picture {
|
|
|
29
29
|
readonly size?: number | undefined;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/** How
|
|
32
|
+
/** How wide and how tall something is, in pixels: a picture by its own, the stage it is shown on. */
|
|
33
|
+
export interface PictureSize {
|
|
34
|
+
readonly width: number;
|
|
35
|
+
readonly height: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* How the picture is seen in the overlay: its scale against its own size, `1` a pixel of the
|
|
40
|
+
* picture for a pixel of the page, and where its centre is, in pixels from the stage's centre.
|
|
41
|
+
*/
|
|
33
42
|
export interface PictureView {
|
|
34
43
|
readonly scale: number;
|
|
35
44
|
readonly x: number;
|
|
36
45
|
readonly y: number;
|
|
37
46
|
}
|
|
38
47
|
|
|
39
|
-
/** How far the picture zooms:
|
|
40
|
-
export const MIN_SCALE = 1;
|
|
48
|
+
/** How far the picture zooms in: to eight times its own size. It zooms out until all of it is in view. */
|
|
41
49
|
export const MAX_SCALE = 8;
|
|
42
50
|
/** What one press of a zoom button does to the scale. */
|
|
43
51
|
export const ZOOM_STEP = 1.25;
|
|
52
|
+
/**
|
|
53
|
+
* How much longer than the stage a picture is, in its shape, before it opens at the stage's
|
|
54
|
+
* width and from its top, and no longer whole: a page captured from top to bottom, shown whole,
|
|
55
|
+
* is a strip nobody reads.
|
|
56
|
+
*/
|
|
57
|
+
export const LONG_PICTURE = 2;
|
|
44
58
|
/** How far a pointer travels before a press is a drag and no longer a click. */
|
|
45
59
|
const DRAG_SLACK = 4;
|
|
60
|
+
/** How far a press of an arrow key moves the picture. */
|
|
61
|
+
const KEY_STEP = 80;
|
|
62
|
+
|
|
63
|
+
const measured = (size: PictureSize): boolean =>
|
|
64
|
+
Number.isFinite(size.width) && Number.isFinite(size.height) && size.width > 0 && size.height > 0;
|
|
46
65
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
66
|
+
/**
|
|
67
|
+
* The scale at which all of the picture is in view: as its own size where the stage has room
|
|
68
|
+
* for that, smaller where it has not, and never larger than its own size.
|
|
69
|
+
*/
|
|
70
|
+
export function wholeScale(picture: PictureSize, stage: PictureSize): number {
|
|
71
|
+
if (!measured(picture) || !measured(stage)) {
|
|
72
|
+
return 1;
|
|
73
|
+
}
|
|
74
|
+
return Math.min(1, stage.width / picture.width, stage.height / picture.height);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The view held to what there is to see: the scale between all of the picture in view and
|
|
79
|
+
* eight times its own size; on an axis where the picture is no larger than the stage it stands
|
|
80
|
+
* in the middle, and where it is larger its edge never comes in from the stage's.
|
|
81
|
+
*/
|
|
82
|
+
export function boundView(
|
|
83
|
+
view: PictureView,
|
|
84
|
+
picture: PictureSize,
|
|
85
|
+
stage: PictureSize,
|
|
86
|
+
): PictureView {
|
|
87
|
+
const least = wholeScale(picture, stage);
|
|
88
|
+
const asked = Number.isFinite(view.scale) ? view.scale : least;
|
|
89
|
+
const scale = Math.min(Math.max(MAX_SCALE, least), Math.max(least, asked));
|
|
90
|
+
const within = (at: number, length: number, room: number): number => {
|
|
91
|
+
const reach = Math.max(0, (length * scale - room) / 2);
|
|
92
|
+
return Number.isFinite(at) ? Math.min(reach, Math.max(-reach, at)) : 0;
|
|
93
|
+
};
|
|
94
|
+
const x = within(view.x, picture.width, stage.width);
|
|
95
|
+
const y = within(view.y, picture.height, stage.height);
|
|
96
|
+
return scale === view.scale && x === view.x && y === view.y ? view : { scale, x, y };
|
|
97
|
+
}
|
|
49
98
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
99
|
+
/**
|
|
100
|
+
* The picture as it first appears: all of it in view, in the middle; a picture much longer than
|
|
101
|
+
* the stage as wide as the stage has room for, from its top, and one much wider as tall as the
|
|
102
|
+
* stage has room for, from its left, so that what is shown can be read. Zooming out brings all
|
|
103
|
+
* of it in view.
|
|
104
|
+
*/
|
|
105
|
+
export function openingView(picture: PictureSize, stage: PictureSize): PictureView {
|
|
106
|
+
if (!measured(picture) || !measured(stage)) {
|
|
107
|
+
return { scale: 1, x: 0, y: 0 };
|
|
53
108
|
}
|
|
54
|
-
|
|
109
|
+
const whole = wholeScale(picture, stage);
|
|
110
|
+
const across = Math.min(1, stage.width / picture.width);
|
|
111
|
+
const down = Math.min(1, stage.height / picture.height);
|
|
112
|
+
if (across >= whole * LONG_PICTURE) {
|
|
113
|
+
return boundView({ scale: across, x: 0, y: Number.MAX_SAFE_INTEGER }, picture, stage);
|
|
114
|
+
}
|
|
115
|
+
if (down >= whole * LONG_PICTURE) {
|
|
116
|
+
return boundView({ scale: down, x: Number.MAX_SAFE_INTEGER, y: 0 }, picture, stage);
|
|
117
|
+
}
|
|
118
|
+
return { scale: whole, x: 0, y: 0 };
|
|
55
119
|
}
|
|
56
120
|
|
|
57
121
|
/**
|
|
58
122
|
* The view after zooming by `factor` around a point of the stage, so that what was under the
|
|
59
|
-
* pointer stays under it
|
|
123
|
+
* pointer stays under it, as far as the picture's edges allow.
|
|
60
124
|
*/
|
|
61
125
|
export function zoomAround(
|
|
62
126
|
view: PictureView,
|
|
63
127
|
factor: number,
|
|
64
128
|
point: { readonly x: number; readonly y: number },
|
|
129
|
+
picture: PictureSize,
|
|
130
|
+
stage: PictureSize,
|
|
65
131
|
): PictureView {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
132
|
+
const from = boundView(view, picture, stage);
|
|
133
|
+
const scale = boundView({ ...from, scale: from.scale * factor }, picture, stage).scale;
|
|
134
|
+
if (scale === from.scale) {
|
|
135
|
+
return from;
|
|
69
136
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
137
|
+
const ratio = scale / from.scale;
|
|
138
|
+
return boundView(
|
|
139
|
+
{
|
|
140
|
+
scale,
|
|
141
|
+
x: point.x - (point.x - from.x) * ratio,
|
|
142
|
+
y: point.y - (point.y - from.y) * ratio,
|
|
143
|
+
},
|
|
144
|
+
picture,
|
|
145
|
+
stage,
|
|
146
|
+
);
|
|
79
147
|
}
|
|
80
148
|
|
|
81
149
|
/** What a notch of the wheel does to the scale: in for a wheel rolled up, out for one rolled down, a step per hundred units. */
|
|
@@ -86,12 +154,15 @@ export function wheelFactor(deltaY: number): number {
|
|
|
86
154
|
return ZOOM_STEP ** (-deltaY / 100);
|
|
87
155
|
}
|
|
88
156
|
|
|
89
|
-
/** The view moved by a drag
|
|
90
|
-
export function panBy(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
157
|
+
/** The view moved by a drag, as far as there is more of the picture that way. */
|
|
158
|
+
export function panBy(
|
|
159
|
+
view: PictureView,
|
|
160
|
+
dx: number,
|
|
161
|
+
dy: number,
|
|
162
|
+
picture: PictureSize,
|
|
163
|
+
stage: PictureSize,
|
|
164
|
+
): PictureView {
|
|
165
|
+
return boundView({ ...view, x: view.x + dx, y: view.y + dy }, picture, stage);
|
|
95
166
|
}
|
|
96
167
|
|
|
97
168
|
export interface PictureThumbProps {
|
|
@@ -137,10 +208,15 @@ const midpoint = (a: Point, b: Point): Point => ({ x: (a.x + b.x) / 2, y: (a.y +
|
|
|
137
208
|
export function PictureOverlay(props: PictureOverlayProps) {
|
|
138
209
|
const words = useWords().pictures;
|
|
139
210
|
const { picture, onClose } = props;
|
|
140
|
-
|
|
211
|
+
/** How the picture is seen once a person zoomed or moved it; until then, as it opens. */
|
|
212
|
+
const [chosen, setChosen] = useState<PictureView | null>(null);
|
|
213
|
+
/** The picture's own size, known once it has loaded, and the stage's, kept as the window changes. */
|
|
214
|
+
const [size, setSize] = useState<PictureSize | null>(null);
|
|
215
|
+
const [room, setRoom] = useState<PictureSize | null>(null);
|
|
141
216
|
const [dragging, setDragging] = useState(false);
|
|
142
217
|
const dialog = useRef<HTMLDivElement>(null);
|
|
143
218
|
const stage = useRef<HTMLDivElement>(null);
|
|
219
|
+
const image = useRef<HTMLImageElement>(null);
|
|
144
220
|
const closeButton = useRef<HTMLButtonElement>(null);
|
|
145
221
|
/** The pointers on the stage, by id, where each was last seen. */
|
|
146
222
|
const pointers = useRef(new Map<number, Point>());
|
|
@@ -158,6 +234,67 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
158
234
|
};
|
|
159
235
|
}, []);
|
|
160
236
|
|
|
237
|
+
// The stage is measured when the overlay opens and whenever its size changes.
|
|
238
|
+
useEffect(() => {
|
|
239
|
+
const element = stage.current;
|
|
240
|
+
if (element === null) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const measure = () => {
|
|
244
|
+
const rect = element.getBoundingClientRect();
|
|
245
|
+
setRoom((before) =>
|
|
246
|
+
before !== null && before.width === rect.width && before.height === rect.height
|
|
247
|
+
? before
|
|
248
|
+
: { width: rect.width, height: rect.height },
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
measure();
|
|
252
|
+
if (typeof ResizeObserver === "undefined") {
|
|
253
|
+
window.addEventListener("resize", measure);
|
|
254
|
+
return () => window.removeEventListener("resize", measure);
|
|
255
|
+
}
|
|
256
|
+
const observer = new ResizeObserver(measure);
|
|
257
|
+
observer.observe(element);
|
|
258
|
+
return () => observer.disconnect();
|
|
259
|
+
}, []);
|
|
260
|
+
|
|
261
|
+
/** The picture's own size, or the size it is drawn at where it says none of its own. */
|
|
262
|
+
const sizeOf = useCallback((element: HTMLImageElement) => {
|
|
263
|
+
if (element.naturalWidth > 0 && element.naturalHeight > 0) {
|
|
264
|
+
setSize({ width: element.naturalWidth, height: element.naturalHeight });
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const rect = element.getBoundingClientRect();
|
|
268
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
269
|
+
setSize({ width: rect.width, height: rect.height });
|
|
270
|
+
}
|
|
271
|
+
}, []);
|
|
272
|
+
|
|
273
|
+
// A picture the thumbnail loaded already is complete before anything is heard of it.
|
|
274
|
+
useEffect(() => {
|
|
275
|
+
const element = image.current;
|
|
276
|
+
if (element?.complete === true) {
|
|
277
|
+
sizeOf(element);
|
|
278
|
+
}
|
|
279
|
+
}, [sizeOf]);
|
|
280
|
+
|
|
281
|
+
const view =
|
|
282
|
+
size === null || room === null
|
|
283
|
+
? null
|
|
284
|
+
: boundView(chosen ?? openingView(size, room), size, room);
|
|
285
|
+
|
|
286
|
+
/** Changes the view from what it is, once the sizes are known; nothing before. */
|
|
287
|
+
const change = (
|
|
288
|
+
next: (current: PictureView, picture: PictureSize, stage: PictureSize) => PictureView,
|
|
289
|
+
) => {
|
|
290
|
+
if (size === null || room === null) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
setChosen((current) =>
|
|
294
|
+
next(boundView(current ?? openingView(size, room), size, room), size, room),
|
|
295
|
+
);
|
|
296
|
+
};
|
|
297
|
+
|
|
161
298
|
/** A point of the stage, in pixels from its centre. */
|
|
162
299
|
const pointOf = useCallback((event: { clientX: number; clientY: number }): Point => {
|
|
163
300
|
const rect = stage.current?.getBoundingClientRect();
|
|
@@ -171,7 +308,11 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
171
308
|
}, []);
|
|
172
309
|
|
|
173
310
|
const zoom = (factor: number, point: Point = { x: 0, y: 0 }) =>
|
|
174
|
-
|
|
311
|
+
change((current, own, around) => zoomAround(current, factor, point, own, around));
|
|
312
|
+
const move = (dx: number, dy: number) =>
|
|
313
|
+
change((current, own, around) => panBy(current, dx, dy, own, around));
|
|
314
|
+
/** All of the picture in view, in the middle. */
|
|
315
|
+
const whole = () => change((_, own, around) => ({ scale: wholeScale(own, around), x: 0, y: 0 }));
|
|
175
316
|
|
|
176
317
|
const onWheel = (event: WheelEvent<HTMLDivElement>) => {
|
|
177
318
|
zoom(wheelFactor(event.deltaY), pointOf(event));
|
|
@@ -203,10 +344,18 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
203
344
|
distance(before, other) === 0 ? 1 : distance(now, other) / distance(before, other);
|
|
204
345
|
const from = midpoint(before, other);
|
|
205
346
|
const to = midpoint(now, other);
|
|
206
|
-
|
|
347
|
+
change((current, own, around) =>
|
|
348
|
+
zoomAround(
|
|
349
|
+
panBy(current, to.x - from.x, to.y - from.y, own, around),
|
|
350
|
+
factor,
|
|
351
|
+
to,
|
|
352
|
+
own,
|
|
353
|
+
around,
|
|
354
|
+
),
|
|
355
|
+
);
|
|
207
356
|
return;
|
|
208
357
|
}
|
|
209
|
-
|
|
358
|
+
move(now.x - before.x, now.y - before.y);
|
|
210
359
|
};
|
|
211
360
|
|
|
212
361
|
const onPointerUp = (event: PointerEvent<HTMLDivElement>) => {
|
|
@@ -216,32 +365,82 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
216
365
|
}
|
|
217
366
|
};
|
|
218
367
|
|
|
219
|
-
// A click beside the picture closes the overlay; a drag that ends there does not
|
|
368
|
+
// A click beside the picture closes the overlay; a drag that ends there does not, and neither
|
|
369
|
+
// does a click on the picture. Where the click fell is read off the picture's place: the stage
|
|
370
|
+
// holds the pointer while it is down, so the click is told as the stage's wherever it fell.
|
|
220
371
|
const onBackdropClick = (event: MouseEvent<HTMLDivElement>) => {
|
|
221
|
-
const
|
|
222
|
-
|
|
372
|
+
const on =
|
|
373
|
+
event.target === event.currentTarget ||
|
|
374
|
+
event.target === stage.current ||
|
|
375
|
+
event.target === image.current;
|
|
376
|
+
const rect = image.current?.getBoundingClientRect();
|
|
377
|
+
const onPicture =
|
|
378
|
+
rect !== undefined &&
|
|
379
|
+
event.clientX >= rect.left &&
|
|
380
|
+
event.clientX <= rect.right &&
|
|
381
|
+
event.clientY >= rect.top &&
|
|
382
|
+
event.clientY <= rect.bottom;
|
|
383
|
+
if (on && !onPicture && !moved.current) {
|
|
223
384
|
onClose();
|
|
224
385
|
}
|
|
225
386
|
};
|
|
226
387
|
|
|
388
|
+
// A press on the picture or beside it takes the focus from nothing: it stays with the button
|
|
389
|
+
// that has it, so that Escape and the keys that zoom and move are heard after a drag as before.
|
|
390
|
+
const keepFocus = (event: MouseEvent<HTMLDivElement>) => {
|
|
391
|
+
if (!(event.target instanceof Element) || event.target.closest("a, button") === null) {
|
|
392
|
+
event.preventDefault();
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// A double press looks closer where it was pressed, and from any closer view shows all of it again.
|
|
227
397
|
const onDoubleClick = (event: MouseEvent<HTMLDivElement>) => {
|
|
228
398
|
const point = pointOf(event);
|
|
229
|
-
|
|
399
|
+
change((current, own, around) => {
|
|
400
|
+
const least = wholeScale(own, around);
|
|
401
|
+
if (current.scale > least) {
|
|
402
|
+
return { scale: least, x: 0, y: 0 };
|
|
403
|
+
}
|
|
404
|
+
// To its own size; a picture that is all in view at its own size, to two and a half times it.
|
|
405
|
+
const closer = least < 1 ? 1 : 2.5;
|
|
406
|
+
return zoomAround(current, closer / current.scale, point, own, around);
|
|
407
|
+
});
|
|
230
408
|
};
|
|
231
409
|
|
|
232
|
-
// Escape closes; the keys zoom; Tab stays within the dialog.
|
|
410
|
+
// Escape closes; the keys zoom and move; Tab stays within the dialog.
|
|
233
411
|
const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
234
412
|
if (event.key === "Escape") {
|
|
235
413
|
event.preventDefault();
|
|
236
414
|
onClose();
|
|
237
415
|
return;
|
|
238
416
|
}
|
|
239
|
-
|
|
417
|
+
const page = (room?.height ?? 0) * 0.85;
|
|
418
|
+
const far = Number.MAX_SAFE_INTEGER;
|
|
419
|
+
const moves: Readonly<Record<string, readonly [number, number]>> = {
|
|
420
|
+
ArrowLeft: [KEY_STEP, 0],
|
|
421
|
+
ArrowRight: [-KEY_STEP, 0],
|
|
422
|
+
ArrowUp: [0, KEY_STEP],
|
|
423
|
+
ArrowDown: [0, -KEY_STEP],
|
|
424
|
+
PageUp: [0, page],
|
|
425
|
+
PageDown: [0, -page],
|
|
426
|
+
Home: [0, far],
|
|
427
|
+
End: [0, -far],
|
|
428
|
+
};
|
|
429
|
+
const by = moves[event.key];
|
|
430
|
+
if (by !== undefined) {
|
|
431
|
+
event.preventDefault();
|
|
432
|
+
move(by[0], by[1]);
|
|
433
|
+
} else if (event.key === "+" || event.key === "=") {
|
|
240
434
|
zoom(ZOOM_STEP);
|
|
241
435
|
} else if (event.key === "-") {
|
|
242
436
|
zoom(1 / ZOOM_STEP);
|
|
243
437
|
} else if (event.key === "0") {
|
|
244
|
-
|
|
438
|
+
whole();
|
|
439
|
+
} else if (event.key === "1") {
|
|
440
|
+
// Its own size: a pixel of the picture for a pixel of the page.
|
|
441
|
+
change((current, own, around) =>
|
|
442
|
+
zoomAround(current, 1 / current.scale, { x: 0, y: 0 }, own, around),
|
|
443
|
+
);
|
|
245
444
|
} else if (event.key === "Tab" && dialog.current !== null) {
|
|
246
445
|
const focusable = [
|
|
247
446
|
...dialog.current.querySelectorAll<HTMLElement>("a[href], button:not(:disabled)"),
|
|
@@ -261,7 +460,16 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
261
460
|
}
|
|
262
461
|
};
|
|
263
462
|
|
|
264
|
-
|
|
463
|
+
// Drawn at the size the scale gives it, and placed by its centre: until its size is known it
|
|
464
|
+
// is held within the stage by the stylesheet alone, whole and in the middle.
|
|
465
|
+
const drawn =
|
|
466
|
+
view === null || size === null
|
|
467
|
+
? undefined
|
|
468
|
+
: {
|
|
469
|
+
width: `${size.width * view.scale}px`,
|
|
470
|
+
height: `${size.height * view.scale}px`,
|
|
471
|
+
transform: `translate(calc(-50% + ${view.x}px), calc(-50% + ${view.y}px))`,
|
|
472
|
+
};
|
|
265
473
|
return (
|
|
266
474
|
<div
|
|
267
475
|
ref={dialog}
|
|
@@ -271,6 +479,7 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
271
479
|
aria-label={words.label(picture.name)}
|
|
272
480
|
onKeyDown={onKeyDown}
|
|
273
481
|
onClick={onBackdropClick}
|
|
482
|
+
onMouseDown={keepFocus}
|
|
274
483
|
>
|
|
275
484
|
<div className="sc-overlay-bar">
|
|
276
485
|
<a
|
|
@@ -302,8 +511,9 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
302
511
|
>
|
|
303
512
|
+
|
|
304
513
|
</Button>
|
|
305
|
-
|
|
306
|
-
|
|
514
|
+
{/* The scale against the picture's own size; pressed, all of it is in view. */}
|
|
515
|
+
<Button variant="ghost" size="sm" aria-label={words.fit} onClick={whole}>
|
|
516
|
+
{view === null ? "–" : `${Math.round(view.scale * 100)}%`}
|
|
307
517
|
</Button>
|
|
308
518
|
<button
|
|
309
519
|
ref={closeButton}
|
|
@@ -330,12 +540,14 @@ export function PictureOverlay(props: PictureOverlayProps) {
|
|
|
330
540
|
onDoubleClick={onDoubleClick}
|
|
331
541
|
>
|
|
332
542
|
<img
|
|
333
|
-
|
|
543
|
+
ref={image}
|
|
544
|
+
className={cx("sc-overlay-picture", drawn === undefined && "sc-overlay-picture-unsized")}
|
|
334
545
|
src={picture.src}
|
|
335
546
|
alt={picture.alt}
|
|
336
547
|
decoding="async"
|
|
337
548
|
draggable={false}
|
|
338
|
-
style={
|
|
549
|
+
style={drawn}
|
|
550
|
+
onLoad={(event) => sizeOf(event.currentTarget)}
|
|
339
551
|
/>
|
|
340
552
|
</div>
|
|
341
553
|
<p className="sc-overlay-hint">{words.hint}</p>
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { ConsoleClient, PluginClient } from "../client.js";
|
|
2
|
+
import type { RestPluginEvent } from "../plugin/rest-schemas.js";
|
|
3
|
+
|
|
4
|
+
// A plugin's own events (docs/specs/plugins.md, "The bridge"), as the frames of the plugin hear
|
|
5
|
+
// them: nothing reaches a frame but through the console's page, so the page asks the console
|
|
6
|
+
// for them now and then. One reader serves every frame of a plugin on the page, however many
|
|
7
|
+
// widgets and pages of it stand there, so that a front page with four widgets asks for a
|
|
8
|
+
// plugin's events once in a while and not four times, and asks nothing while the page is out
|
|
9
|
+
// of view.
|
|
10
|
+
|
|
11
|
+
/** How often a plugin's events are asked for while a frame of it listens and the page is in view. */
|
|
12
|
+
export const EVENTS_POLL_MS = 5_000;
|
|
13
|
+
/** How many events one ask reads at most; what is past them comes with the next. */
|
|
14
|
+
const EVENTS_PAGE = 50;
|
|
15
|
+
/** How many events are read to find the newest where the console does not say it (one older than 0.5.0). */
|
|
16
|
+
const NEWEST_PAGE = 200;
|
|
17
|
+
|
|
18
|
+
/** What a reader asks of the page: whether it is out of view, and a word when it comes back. */
|
|
19
|
+
export interface PageView {
|
|
20
|
+
readonly hidden: () => boolean;
|
|
21
|
+
readonly onVisible: (listener: () => void) => () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The document the console's page is: out of view while its tab is in the background. */
|
|
25
|
+
const documentView: PageView = {
|
|
26
|
+
hidden: () => typeof document !== "undefined" && document.visibilityState === "hidden",
|
|
27
|
+
onVisible: (listener) => {
|
|
28
|
+
if (typeof document === "undefined") {
|
|
29
|
+
return () => undefined;
|
|
30
|
+
}
|
|
31
|
+
const onChange = () => {
|
|
32
|
+
if (document.visibilityState === "visible") {
|
|
33
|
+
listener();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
document.addEventListener("visibilitychange", onChange);
|
|
37
|
+
return () => document.removeEventListener("visibilitychange", onChange);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type HearPluginEvent = (event: RestPluginEvent) => void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* One reader of a plugin's events for the frames of it on the page. While someone listens and
|
|
45
|
+
* the page is in view, it asks the console every `EVENTS_POLL_MS` for what came after the last
|
|
46
|
+
* event it saw, one ask at a time, and tells every listener of each event; a page out of view
|
|
47
|
+
* asks nothing, and asks at once when it comes back. The stream is read from where it stands
|
|
48
|
+
* when the first listener comes: what the plugin emitted before is not replayed, nor what it
|
|
49
|
+
* emitted while nobody listened.
|
|
50
|
+
*/
|
|
51
|
+
export class PluginEventsReader {
|
|
52
|
+
readonly #client: Pick<PluginClient, "pluginEvents">;
|
|
53
|
+
readonly #view: PageView;
|
|
54
|
+
readonly #listeners = new Set<HearPluginEvent>();
|
|
55
|
+
/** The number of the last event seen; none until the reader has found where the stream stands. */
|
|
56
|
+
#after: number | undefined;
|
|
57
|
+
#asking = false;
|
|
58
|
+
#timer: ReturnType<typeof setInterval> | undefined;
|
|
59
|
+
#stopWatching: (() => void) | undefined;
|
|
60
|
+
|
|
61
|
+
constructor(client: Pick<PluginClient, "pluginEvents">, view: PageView = documentView) {
|
|
62
|
+
this.#client = client;
|
|
63
|
+
this.#view = view;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Whether any frame listens. */
|
|
67
|
+
get listening(): boolean {
|
|
68
|
+
return this.#listeners.size > 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Hears every event from now on, until what is returned is called. */
|
|
72
|
+
listen(hear: HearPluginEvent): () => void {
|
|
73
|
+
this.#listeners.add(hear);
|
|
74
|
+
if (this.#listeners.size === 1) {
|
|
75
|
+
this.#start();
|
|
76
|
+
}
|
|
77
|
+
return () => {
|
|
78
|
+
this.#listeners.delete(hear);
|
|
79
|
+
if (this.#listeners.size === 0) {
|
|
80
|
+
this.#stop();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#start(): void {
|
|
86
|
+
this.#after = undefined;
|
|
87
|
+
this.#timer = setInterval(() => void this.#ask(), EVENTS_POLL_MS);
|
|
88
|
+
this.#stopWatching = this.#view.onVisible(() => void this.#ask());
|
|
89
|
+
void this.#ask();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#stop(): void {
|
|
93
|
+
clearInterval(this.#timer);
|
|
94
|
+
this.#timer = undefined;
|
|
95
|
+
this.#stopWatching?.();
|
|
96
|
+
this.#stopWatching = undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async #ask(): Promise<void> {
|
|
100
|
+
if (this.#asking || this.#listeners.size === 0 || this.#view.hidden()) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.#asking = true;
|
|
104
|
+
try {
|
|
105
|
+
const after = this.#after;
|
|
106
|
+
if (after === undefined) {
|
|
107
|
+
this.#after = await this.#newest();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const page = await this.#client.pluginEvents({ after, limit: EVENTS_PAGE });
|
|
111
|
+
if (this.#after !== after) {
|
|
112
|
+
// Stopped and started again meanwhile: the stream is read anew from where it stands.
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
for (const event of page.items) {
|
|
116
|
+
this.#after = Math.max(after, event.id);
|
|
117
|
+
for (const hear of this.#listeners) {
|
|
118
|
+
hear(event);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} catch {
|
|
122
|
+
// Asked again at the next tick.
|
|
123
|
+
} finally {
|
|
124
|
+
this.#asking = false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Where the stream stands: the number of the newest event, 0 where there is none. */
|
|
129
|
+
async #newest(): Promise<number> {
|
|
130
|
+
const first = await this.#client.pluginEvents({ after: 0, limit: 1 });
|
|
131
|
+
if (first.newest !== undefined) {
|
|
132
|
+
return first.newest;
|
|
133
|
+
}
|
|
134
|
+
// A console older than 0.5.0 says no newest: the first page of the stream is read for it,
|
|
135
|
+
// and past the page the stream is read from the page's last event.
|
|
136
|
+
if (!first.more) {
|
|
137
|
+
return first.items.at(-1)?.id ?? 0;
|
|
138
|
+
}
|
|
139
|
+
const page = await this.#client.pluginEvents({ after: 0, limit: NEWEST_PAGE });
|
|
140
|
+
return page.items.at(-1)?.id ?? 0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const readers = new WeakMap<ConsoleClient, Map<string, PluginEventsReader>>();
|
|
145
|
+
|
|
146
|
+
/** The one reader of a plugin's events on the pages of a console, made when first asked for. */
|
|
147
|
+
export function pluginEventsReaderOf(client: ConsoleClient, key: string): PluginEventsReader {
|
|
148
|
+
let mine = readers.get(client);
|
|
149
|
+
if (mine === undefined) {
|
|
150
|
+
mine = new Map();
|
|
151
|
+
readers.set(client, mine);
|
|
152
|
+
}
|
|
153
|
+
let reader = mine.get(key);
|
|
154
|
+
if (reader === undefined) {
|
|
155
|
+
reader = new PluginEventsReader(client.plugin(key));
|
|
156
|
+
mine.set(key, reader);
|
|
157
|
+
}
|
|
158
|
+
return reader;
|
|
159
|
+
}
|