rvlib-shipkit 2.26.0 → 2.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/package.json +1 -1
- package/src/agent-time/diet.ts +77 -0
- package/src/agent-time/family.ts +72 -0
- package/src/agent-time/hooks.ts +6 -4
- package/src/agent-time/limits.ts +44 -0
- package/src/agent-time/live.ts +1 -3
- package/src/agent-time/mask.ts +96 -18
- package/src/agent-time/refused.ts +45 -0
- package/src/agent-time/render.ts +122 -21
- package/src/agent-time/report-cache.ts +57 -0
- package/src/agent-time/report.ts +314 -40
- package/src/agent-time/shape.ts +50 -3
- package/src/agent-time/store.ts +320 -99
- package/src/agent-time/timeline.ts +140 -21
- package/src/agent-time/turns.ts +18 -8
- package/src/annex/offload.ts +17 -6
- package/src/annex/tidy.ts +70 -10
- package/src/asks/ask-after.ts +40 -0
- package/src/asks/asks-queue.ts +205 -47
- package/src/assets/kit-config.ts +7 -3
- package/src/assets/kits/identity-kit.ts +289 -10
- package/src/check.ts +3 -1
- package/src/checks/SK004-gitignore-policy.check.ts +12 -5
- package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
- package/src/checks/SK026-asks-autoclose.check.ts +5 -5
- package/src/checks/SK028-readme.check.ts +7 -66
- package/src/checks/SK030-cache-audit.check.ts +6 -1
- package/src/checks/SK031-trace-audit.check.ts +2 -0
- package/src/checks/SK033-global-contribution.check.ts +3 -1
- package/src/checks/SK035-public-clean.check.ts +2 -2
- package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
- package/src/checks/SK047-login-in-description.check.ts +36 -0
- package/src/checks/SK048-one-local-file.check.ts +36 -0
- package/src/cli/cmd_Asks.ts +71 -5
- package/src/cli/cmd_Backup.ts +2 -2
- package/src/cli/cmd_Capacity.ts +2 -2
- package/src/cli/cmd_CrossRepoActivity.ts +5 -4
- package/src/cli/cmd_Db.ts +253 -0
- package/src/cli/cmd_History.ts +212 -0
- package/src/cli/cmd_Home.ts +31 -3
- package/src/cli/cmd_Hq.ts +516 -0
- package/src/cli/cmd_Machines.ts +36 -0
- package/src/cli/cmd_Media.ts +38 -6
- package/src/cli/cmd_Reflect.ts +23 -2
- package/src/cli/cmd_Review.ts +548 -116
- package/src/cli/cmd_Secret.ts +62 -12
- package/src/cli/cmd_Social.ts +83 -1
- package/src/cli/cmd_Space.ts +324 -0
- package/src/cli/cmd_Time.ts +76 -5
- package/src/cli/cmd_Tmp.ts +28 -4
- package/src/cli/cmd_Trailer.ts +14 -10
- package/src/cli/cmd_Urls.ts +56 -0
- package/src/cli/cmd_Vault.ts +583 -0
- package/src/cli/family-help.ts +4 -2
- package/src/cli/family-pages.ts +1 -1
- package/src/cli/registry.ts +24 -3
- package/src/collections/actions.ts +63 -13
- package/src/collections/collection-types.ts +23 -1
- package/src/collections/providers.ts +117 -23
- package/src/collections/review.ts +4 -4
- package/src/contracts/contract-manifests.ts +6 -5
- package/src/contracts/contract-types.ts +6 -4
- package/src/contracts/contracts-engine.ts +11 -0
- package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
- package/src/core/budget.ts +12 -17
- package/src/core/capacity.ts +27 -18
- package/src/core/check-runner.ts +7 -4
- package/src/core/layout.ts +3 -0
- package/src/core/machine-busy.ts +127 -0
- package/src/core/machine-commit.ts +6 -1
- package/src/core/machine-db.ts +368 -20
- package/src/core/machine-layout.ts +137 -0
- package/src/core/machine-read.ts +81 -0
- package/src/core/migrate-layout.ts +1 -1
- package/src/core/one-way-in-policy.ts +64 -7
- package/src/core/polling-policy.ts +27 -0
- package/src/core/retention.ts +16 -2
- package/src/core/scope.ts +107 -14
- package/src/core/slots.ts +5 -4
- package/src/drill/clean.ts +25 -1
- package/src/drill/run.ts +1 -1
- package/src/drill/seal.ts +27 -4
- package/src/home/activity-shape.ts +2 -0
- package/src/home/activity.ts +66 -3
- package/src/home/app-sign.ts +15 -4
- package/src/home/daemon-jobs.ts +149 -7
- package/src/home/database-projects.ts +111 -0
- package/src/home/database-words.ts +203 -0
- package/src/home/databases.ts +460 -0
- package/src/home/global-units.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +122 -1
- package/src/home/gui-app.ts +6 -3
- package/src/home/home-move.ts +514 -0
- package/src/home/home-paths.ts +12 -3
- package/src/home/home-routes.ts +68 -0
- package/src/home/inbox-shape.ts +24 -14
- package/src/home/machine-fold.ts +820 -0
- package/src/home/machine-host.ts +20 -5
- package/src/home/machine-repair.ts +503 -0
- package/src/home/machine-stores.ts +66 -15
- package/src/home/machine-temp.ts +547 -86
- package/src/home/resume.ts +79 -0
- package/src/home/run-daemon.ts +25 -4
- package/src/home/run-pm.ts +18 -5
- package/src/home/serve-daemon.ts +18 -3
- package/src/home/serve-web.ts +175 -7
- package/src/home/space-job.ts +115 -0
- package/src/home/space-page.ts +257 -0
- package/src/home/space-route.ts +167 -0
- package/src/home/space-words.ts +103 -0
- package/src/home/time-page-shape.ts +202 -0
- package/src/home/time-page.ts +64 -0
- package/src/home/vault-page.ts +482 -0
- package/src/home/vault-words.ts +132 -0
- package/src/hooks/leak-guard.ts +40 -13
- package/src/hooks/one-way-in-guard.ts +17 -4
- package/src/hq/cards.ts +581 -0
- package/src/hq/door-route.ts +43 -0
- package/src/hq/door.ts +163 -0
- package/src/hq/files-send.ts +348 -0
- package/src/hq/forgotten-log.ts +35 -0
- package/src/hq/history-check.ts +255 -0
- package/src/hq/history-place.ts +146 -0
- package/src/hq/history-send.ts +487 -0
- package/src/hq/hq-db.ts +99 -0
- package/src/hq/hq-local.ts +469 -0
- package/src/hq/hq-routes.ts +196 -0
- package/src/hq/hq-store.ts +599 -0
- package/src/hq/kinds/ask.ts +147 -0
- package/src/hq/kinds/card-gone.ts +83 -0
- package/src/hq/kinds/card-msg.ts +66 -0
- package/src/hq/kinds/card.ts +99 -0
- package/src/hq/kinds/index.ts +21 -0
- package/src/hq/kinds/kind.ts +126 -0
- package/src/hq/kinds/media.ts +125 -0
- package/src/hq/kinds/prompt.ts +219 -0
- package/src/hq/kinds/reflection.ts +128 -0
- package/src/hq/kinds/report.ts +55 -0
- package/src/hq/kinds/time-day.ts +236 -0
- package/src/hq/ledger.ts +473 -0
- package/src/hq/machine-key.ts +44 -0
- package/src/hq/machine-notes.ts +131 -0
- package/src/hq/outbox.ts +372 -0
- package/src/hq/replica.ts +168 -0
- package/src/hq/repo-id.ts +4 -0
- package/src/hq/report-facts.ts +117 -0
- package/src/hq/report.ts +274 -0
- package/src/hq/switch.ts +151 -0
- package/src/hq/vault-grant.ts +92 -0
- package/src/identities/identities.ts +15 -3
- package/src/identities/steps.ts +31 -0
- package/src/ledger/db.ts +73 -26
- package/src/ledger/gate-checks.ts +6 -2
- package/src/ledger/run-log.ts +11 -3
- package/src/ledger/store.ts +26 -4
- package/src/media-store/backup/daemon.ts +25 -17
- package/src/media-store/backup/kept.ts +241 -0
- package/src/media-store/backup/restore.ts +14 -4
- package/src/media-store/backup/run.ts +11 -11
- package/src/media-store/backup/secret.ts +6 -4
- package/src/media-store/backup/snapshot.ts +4 -2
- package/src/media-store/backup/sources.ts +67 -16
- package/src/media-store/copy/config.ts +77 -0
- package/src/media-store/copy/copy.ts +194 -0
- package/src/media-store/copy/lifecycle.ts +43 -0
- package/src/media-store/copy/night.ts +90 -0
- package/src/media-store/copy/proof.ts +151 -0
- package/src/media-store/copy/snapshot.ts +152 -0
- package/src/media-store/copy/store.ts +62 -0
- package/src/media-store/copy/stream.ts +176 -0
- package/src/media-store/daemon.ts +66 -16
- package/src/media-store/db.ts +22 -11
- package/src/media-store/forget.ts +23 -3
- package/src/media-store/hand.ts +4 -3
- package/src/media-store/hq-find.ts +75 -0
- package/src/media-store/hq-send.ts +277 -0
- package/src/media-store/kind.ts +2 -0
- package/src/media-store/purge.ts +18 -15
- package/src/media-store/put.ts +24 -8
- package/src/media-store/remote.ts +16 -7
- package/src/media-store/space-listing.ts +240 -0
- package/src/media-store/space.ts +40 -21
- package/src/media-store/sync.ts +5 -5
- package/src/media-store/tidy.ts +98 -0
- package/src/media-store/upload.ts +3 -3
- package/src/media-store/webp.ts +66 -0
- package/src/messages/model.ts +16 -7
- package/src/messages/routes.ts +14 -4
- package/src/messages/score.ts +2 -2
- package/src/messages/suggest.ts +96 -0
- package/src/pages/frame-client.ts +10 -0
- package/src/plan/planner.ts +28 -17
- package/src/recordings/media-kind.ts +1 -0
- package/src/recordings/model.ts +1 -1
- package/src/recordings/recorder-app/Capture.swift +9 -7
- package/src/reflect/hq-corpus.ts +56 -0
- package/src/reflect/prompt-corpus.ts +3 -1
- package/src/reflect/transcript.ts +129 -37
- package/src/release/machine-words.ts +67 -0
- package/src/release/public-clean.ts +8 -3
- package/src/releases/from-card.ts +1 -1
- package/src/releases/routes.ts +10 -5
- package/src/releases/store.ts +10 -1
- package/src/repo-config.ts +32 -2
- package/src/review/anim.ts +2 -2
- package/src/review/auto.ts +2 -2
- package/src/review/card-db.ts +244 -0
- package/src/review/card-rows.ts +266 -0
- package/src/review/cells.ts +76 -5
- package/src/review/draft-card.ts +41 -0
- package/src/review/draft-model.ts +78 -0
- package/src/review/format.ts +29 -10
- package/src/review/gone.ts +98 -0
- package/src/review/inbox-hook.ts +4 -4
- package/src/review/marks.ts +1 -1
- package/src/review/media-kind.ts +7 -5
- package/src/review/media-read.ts +9 -7
- package/src/review/media.ts +32 -5
- package/src/review/model.ts +202 -39
- package/src/review/move.ts +491 -0
- package/src/review/notes.ts +12 -20
- package/src/review/previews.ts +15 -19
- package/src/review/project.ts +1 -1
- package/src/review/rev.ts +8 -0
- package/src/review/role.ts +1 -1
- package/src/review/routes.ts +64 -13
- package/src/review/stage-card.ts +8 -4
- package/src/review/stage-routes.ts +1 -1
- package/src/review/store.ts +529 -83
- package/src/review/thread-fold.ts +51 -0
- package/src/review/threads.ts +147 -9
- package/src/review/trailer-auto-mock.ts +63 -0
- package/src/review/trailer-card.ts +4 -4
- package/src/review/trailer-desk.ts +41 -7
- package/src/review/trailer-media.ts +1 -0
- package/src/review/trailer-model.ts +8 -0
- package/src/review/trailer-notes.ts +1 -1
- package/src/review/trailer-routes.ts +9 -1
- package/src/review/unit.ts +6 -6
- package/src/review/watchers.ts +1 -1
- package/src/rules/untrack-generated.ts +92 -8
- package/src/secrets/held.ts +16 -0
- package/src/secrets/keychain.ts +113 -0
- package/src/secrets/list.ts +16 -6
- package/src/secrets/manager.ts +24 -10
- package/src/secrets/read.ts +257 -0
- package/src/secrets/who-reads.ts +49 -0
- package/src/serve/door-forward.ts +268 -0
- package/src/serve/door-names.ts +47 -0
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/activity-view.tsx +56 -32
- package/src/serve/hub-app/activity.css +7 -1
- package/src/serve/hub-app/asks-page.tsx +48 -0
- package/src/serve/hub-app/asks-st.ts +25 -0
- package/src/serve/hub-app/clock-svc.ts +1 -2
- package/src/serve/hub-app/col-card.tsx +64 -13
- package/src/serve/hub-app/col-list-page.tsx +122 -0
- package/src/serve/hub-app/col-list-st.ts +103 -0
- package/src/serve/hub-app/col-tables-view.tsx +10 -41
- package/src/serve/hub-app/col-tables.ts +76 -8
- package/src/serve/hub-app/cols-svc.ts +70 -16
- package/src/serve/hub-app/database-st.ts +260 -0
- package/src/serve/hub-app/database-view.tsx +289 -0
- package/src/serve/hub-app/database.css +32 -0
- package/src/serve/hub-app/entry-bar.css +14 -0
- package/src/serve/hub-app/entry-bar.tsx +33 -0
- package/src/serve/hub-app/entry-pick.ts +31 -0
- package/src/serve/hub-app/floating.tsx +1 -0
- package/src/serve/hub-app/hash-route.ts +11 -1
- package/src/serve/hub-app/header-bar.tsx +14 -18
- package/src/serve/hub-app/home-st.ts +89 -9
- package/src/serve/hub-app/home-strip.css +5 -19
- package/src/serve/hub-app/home-strip.tsx +58 -92
- package/src/serve/hub-app/home.html +7 -0
- package/src/serve/hub-app/hub-app.tsx +31 -142
- package/src/serve/hub-app/hub-types.ts +3 -1
- package/src/serve/hub-app/hub.css +109 -23
- package/src/serve/hub-app/icons.tsx +18 -1
- package/src/serve/hub-app/identities-st.ts +56 -6
- package/src/serve/hub-app/identities-view.tsx +100 -58
- package/src/serve/hub-app/identities.css +17 -15
- package/src/serve/hub-app/identity-address.ts +5 -0
- package/src/serve/hub-app/inbox-st.ts +41 -24
- package/src/serve/hub-app/inbox-view.tsx +37 -41
- package/src/serve/hub-app/inbox.css +2 -5
- package/src/serve/hub-app/index.html +7 -0
- package/src/serve/hub-app/kept-cols.tsx +7 -0
- package/src/serve/hub-app/keys.ts +28 -15
- package/src/serve/hub-app/later.tsx +26 -0
- package/src/serve/hub-app/list-filter.tsx +14 -0
- package/src/serve/hub-app/list-walk.ts +72 -3
- package/src/serve/hub-app/machines-st.ts +251 -0
- package/src/serve/hub-app/machines-view.tsx +224 -0
- package/src/serve/hub-app/machines.css +76 -0
- package/src/serve/hub-app/md-copy.tsx +79 -0
- package/src/serve/hub-app/media-view.tsx +2 -0
- package/src/serve/hub-app/messages/messages-page.tsx +79 -7
- package/src/serve/hub-app/messages/messages-st.ts +99 -3
- package/src/serve/hub-app/messages.css +14 -0
- package/src/serve/hub-app/page-keys.ts +175 -0
- package/src/serve/hub-app/pages-frames.tsx +11 -3
- package/src/serve/hub-app/palette-st.ts +58 -11
- package/src/serve/hub-app/palette-view.tsx +3 -1
- package/src/serve/hub-app/project-list.css +54 -8
- package/src/serve/hub-app/project-list.tsx +128 -59
- package/src/serve/hub-app/projects-svc.ts +78 -7
- package/src/serve/hub-app/reader-chips.tsx +13 -0
- package/src/serve/hub-app/readme-view.tsx +2 -3
- package/src/serve/hub-app/readme.css +27 -5
- package/src/serve/hub-app/reflections-page.tsx +42 -0
- package/src/serve/hub-app/reflections-st.ts +17 -0
- package/src/serve/hub-app/releases/releases-page.tsx +25 -2
- package/src/serve/hub-app/releases/releases-st.ts +1 -1
- package/src/serve/hub-app/repo-sections.ts +9 -5
- package/src/serve/hub-app/repo-st.ts +35 -8
- package/src/serve/hub-app/review/draft-card.tsx +163 -0
- package/src/serve/hub-app/review/kit.tsx +50 -7
- package/src/serve/hub-app/review/note-place.ts +1 -1
- package/src/serve/hub-app/review/review-board.tsx +2 -2
- package/src/serve/hub-app/review/review-cells.tsx +145 -65
- package/src/serve/hub-app/review/review-kit.ts +27 -1
- package/src/serve/hub-app/review/review-list.tsx +68 -30
- package/src/serve/hub-app/review/review-page.tsx +7 -8
- package/src/serve/hub-app/review/review-st.ts +111 -24
- package/src/serve/hub-app/review/review-thread.tsx +49 -19
- package/src/serve/hub-app/review/review-views.tsx +475 -144
- package/src/serve/hub-app/review/thread-control-st.ts +115 -0
- package/src/serve/hub-app/review/thread-control.tsx +74 -0
- package/src/serve/hub-app/review/thread-st.ts +73 -26
- package/src/serve/hub-app/review/trailer-card.tsx +1 -1
- package/src/serve/hub-app/review/trailer-page.tsx +37 -16
- package/src/serve/hub-app/review/trailer-st.ts +41 -7
- package/src/serve/hub-app/review.css +267 -61
- package/src/serve/hub-app/side-lists.ts +72 -0
- package/src/serve/hub-app/sidebar.tsx +6 -3
- package/src/serve/hub-app/site/site-part.tsx +2 -8
- package/src/serve/hub-app/site/site-st.ts +4 -4
- package/src/serve/hub-app/social/comms-page.tsx +20 -5
- package/src/serve/hub-app/social/kit.tsx +30 -4
- package/src/serve/hub-app/social/post-card.tsx +139 -49
- package/src/serve/hub-app/social/serial-writes.ts +13 -0
- package/src/serve/hub-app/social/social-model.ts +11 -0
- package/src/serve/hub-app/social/social-page.tsx +94 -35
- package/src/serve/hub-app/social/social-st.ts +120 -36
- package/src/serve/hub-app/social/stage-popup.tsx +1 -1
- package/src/serve/hub-app/social/stage-st.ts +1 -1
- package/src/serve/hub-app/social/step-layout.ts +1 -1
- package/src/serve/hub-app/social.css +3 -0
- package/src/serve/hub-app/space-st.ts +209 -0
- package/src/serve/hub-app/space-view.tsx +196 -0
- package/src/serve/hub-app/space.css +27 -0
- package/src/serve/hub-app/stores/stores-page.tsx +91 -23
- package/src/serve/hub-app/stores/stores-st.ts +44 -19
- package/src/serve/hub-app/stores.css +6 -1
- package/src/serve/hub-app/theme-st.ts +22 -9
- package/src/serve/hub-app/time-charts.tsx +291 -0
- package/src/serve/hub-app/time-pages.tsx +749 -0
- package/src/serve/hub-app/time-st.ts +162 -0
- package/src/serve/hub-app/time-view.tsx +76 -0
- package/src/serve/hub-app/time.css +138 -0
- package/src/serve/hub-app/tree-build.ts +52 -42
- package/src/serve/hub-app/tree-row.tsx +4 -4
- package/src/serve/hub-app/tree-svc.ts +18 -9
- package/src/serve/hub-app/urls-svc.ts +154 -0
- package/src/serve/hub-app/urls-view.tsx +117 -0
- package/src/serve/hub-app/urls.css +30 -0
- package/src/serve/hub-app/vault-st.ts +127 -0
- package/src/serve/hub-app/vault-view.tsx +154 -0
- package/src/serve/hub-app/vault.css +38 -0
- package/src/serve/hub-app/veille/veille-st.ts +12 -10
- package/src/serve/hub-app/waiting-svc.ts +29 -0
- package/src/serve/hub-app/wikis-view.tsx +2 -2
- package/src/serve/hub-runtime.ts +15 -2
- package/src/serve/project-gutter-route.ts +27 -14
- package/src/serve/project-gutter.ts +25 -12
- package/src/serve/same-origin.ts +10 -0
- package/src/serve/serve-hub.ts +13 -4
- package/src/shipkit-files.ts +16 -2
- package/src/shipkit.ts +1 -1
- package/src/shot/shooter.ts +616 -420
- package/src/shot/shot-ask.ts +246 -155
- package/src/site/desk.ts +2 -2
- package/src/smoke/run-smoke.ts +3 -2
- package/src/social/cover.ts +202 -0
- package/src/social/discord-layout.ts +37 -13
- package/src/social/drafts.ts +3 -0
- package/src/social/load.ts +23 -2
- package/src/social/media-kind.ts +2 -1
- package/src/social/publish/discord.ts +5 -2
- package/src/social/publish/secret.ts +2 -2
- package/src/social/release-stage.ts +28 -13
- package/src/social/routes.ts +26 -1
- package/src/social/stage.ts +1 -1
- package/src/social/stats.ts +12 -9
- package/src/social/strip.ts +4 -1
- package/src/social/thumbnail.ts +255 -0
- package/src/stores/collection.ts +15 -11
- package/src/stores/desk.ts +236 -42
- package/src/stores/model.ts +72 -6
- package/src/stores/routes.ts +37 -12
- package/src/stores/unit.ts +14 -8
- package/src/suite/judge-suites.ts +41 -11
- package/src/suite/select.ts +45 -3
- package/src/suite/suite-cli.ts +16 -10
- package/src/trailer/bed.ts +1 -1
- package/src/trailer/build.ts +134 -21
- package/src/trailer/ffmpeg.ts +7 -0
- package/src/trailer/fonts.ts +3 -2
- package/src/trailer/grammar.ts +201 -2
- package/src/trailer/graph.ts +42 -5
- package/src/trailer/look.ts +21 -0
- package/src/trailer/mock.ts +154 -0
- package/src/trailer/passage.ts +65 -26
- package/src/trailer/score/heard.ts +89 -0
- package/src/trailer/score/sound.ts +14 -8
- package/src/trailer/sound/run.ts +16 -6
- package/src/trailer/stitch.ts +26 -5
- package/src/trailer/titles.ts +82 -19
- package/src/trailer/versions.ts +1 -3
- package/src/trailer/vertical.ts +3 -1
- package/src/urls/frame.ts +195 -0
- package/src/urls/routes.ts +43 -0
- package/src/urls/rows.ts +171 -0
- package/src/urls/unit.ts +73 -0
- package/src/vault/house-keys.ts +42 -0
- package/src/vault/layout.ts +50 -0
- package/src/vault/policy.ts +165 -0
- package/src/vault/vault-audit.ts +276 -0
- package/src/vault/vault-client.ts +40 -0
- package/src/vault/vault-config.ts +159 -0
- package/src/vault/vault-destroy.ts +78 -0
- package/src/vault/vault-handover.ts +305 -0
- package/src/vault/vault-http.ts +352 -0
- package/src/vault/vault-import.ts +208 -0
- package/src/vault/vault-init.ts +328 -0
- package/src/vault/vault-minter.ts +271 -0
- package/src/vault/vault-restore.ts +333 -0
- package/src/vault/vault-serve.ts +342 -0
- package/src/vault/vault-snapshot.ts +281 -0
- package/src/veille/asks.ts +1 -1
- package/src/veille/desk.ts +2 -2
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// the Space page's state: `GET /api/home/space` read while the page shows, the entry of its bar (in the address,
|
|
2
|
+
// `/space#about`), the Space shown when the house names two, the folders opened in place (each read once, `/ls`),
|
|
3
|
+
// the filter over keys and names, all kept per viewer but the data. The words are `sk space`'s (home/space-words.ts)
|
|
4
|
+
import { makeAutoObservable, observable, observableRef, runInAction } from 'mobx'
|
|
5
|
+
import type { FolderPage, SpacePage, SpaceView } from '../../home/space-words.ts'
|
|
6
|
+
import { EntryPick } from './entry-pick.ts'
|
|
7
|
+
import type { HomeSt } from './home-st.ts'
|
|
8
|
+
import { ownTrouble, reach } from './reach.ts'
|
|
9
|
+
|
|
10
|
+
/** the page asks again by itself this often; while a listing runs, every few seconds until it is kept */
|
|
11
|
+
export const SPACE_POLL_MS = 60_000
|
|
12
|
+
export const SPACE_RUNNING_POLL_MS = 3_000
|
|
13
|
+
const KEEP_KEY = 'home:space:view'
|
|
14
|
+
|
|
15
|
+
/** the bar's entries, in their order: the files first, the page's default */
|
|
16
|
+
export const SPACE_ENTRIES = ['files', 'about', 'health'] as const
|
|
17
|
+
export type SpaceEntry = (typeof SPACE_ENTRIES)[number]
|
|
18
|
+
|
|
19
|
+
type Kept = { space: string; opened: string[] }
|
|
20
|
+
function kept(): Kept {
|
|
21
|
+
try {
|
|
22
|
+
const v = JSON.parse(globalThis.localStorage?.getItem(KEEP_KEY) ?? 'null') as Partial<Kept> | null
|
|
23
|
+
return { space: typeof v?.space === 'string' ? v.space : 'space', opened: Array.isArray(v?.opened) ? v.opened.filter((x): x is string => typeof x === 'string').slice(0, 50) : [] }
|
|
24
|
+
} catch {
|
|
25
|
+
return { space: 'space', opened: [] }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** a folder's read: its page, or why it could not be read */
|
|
30
|
+
export type FolderRead = { page: FolderPage | null; error: string }
|
|
31
|
+
|
|
32
|
+
export class SpaceSt {
|
|
33
|
+
data: SpacePage | null = null
|
|
34
|
+
error = ''
|
|
35
|
+
loading = false
|
|
36
|
+
readonly pick = new EntryPick<SpaceEntry>('/space', SPACE_ENTRIES)
|
|
37
|
+
/** the Space shown: `space` the private one, `copy` its second place */
|
|
38
|
+
space: string
|
|
39
|
+
/** the folders opened in place, by `<space>:<prefix>` */
|
|
40
|
+
readonly opened = observable.set<string>()
|
|
41
|
+
/** each folder read, by `<space>:<prefix>`: read once, read again when the listing moved */
|
|
42
|
+
readonly folders = observable.map<string, FolderRead>({}, { deep: false })
|
|
43
|
+
filter = ''
|
|
44
|
+
found: FolderRead | null = null
|
|
45
|
+
asking = false
|
|
46
|
+
private timer: ReturnType<typeof setTimeout> | null = null
|
|
47
|
+
private findTimer: ReturnType<typeof setTimeout> | null = null
|
|
48
|
+
private gen = 0
|
|
49
|
+
private on = false
|
|
50
|
+
|
|
51
|
+
constructor(private st: HomeSt) {
|
|
52
|
+
const k = kept()
|
|
53
|
+
this.space = k.space
|
|
54
|
+
for (const o of k.opened) this.opened.add(o)
|
|
55
|
+
makeAutoObservable<this, 'st' | 'timer' | 'findTimer' | 'gen' | 'on'>(this, { st: false, timer: false, findTimer: false, gen: false, on: false, pick: false, opened: false, folders: false, data: observableRef, found: observableRef })
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get entry(): SpaceEntry {
|
|
59
|
+
return this.pick.entry
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get address(): string {
|
|
63
|
+
return this.pick.address
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
fromHash(hash: string): void {
|
|
67
|
+
this.pick.fromHash(hash)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
open(e: SpaceEntry, how: 'push' | 'replace' = 'push'): void {
|
|
71
|
+
this.pick.open(e, how)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** the Space shown, the first one when the kept pick names none the house has */
|
|
75
|
+
get shown(): SpaceView | null {
|
|
76
|
+
const all = this.data?.spaces ?? []
|
|
77
|
+
return all.find((s) => s.id === this.space) ?? all[0] ?? null
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private keep(): void {
|
|
81
|
+
try { globalThis.localStorage?.setItem(KEEP_KEY, JSON.stringify({ space: this.space, opened: [...this.opened] } satisfies Kept)) } catch { /* private window: the pick lasts the tab */ }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
pickSpace(id: string): void {
|
|
85
|
+
this.space = id
|
|
86
|
+
this.keep()
|
|
87
|
+
if (this.filter !== '') this.find(this.filter)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** the folder's key of the maps */
|
|
91
|
+
at = (prefix: string): string => `${this.shown?.id ?? this.space}:${prefix}`
|
|
92
|
+
|
|
93
|
+
isOpen(prefix: string): boolean {
|
|
94
|
+
return this.opened.has(this.at(prefix))
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** a folder opened in place, read the first time; a second click folds it */
|
|
98
|
+
toggle(prefix: string): void {
|
|
99
|
+
const k = this.at(prefix)
|
|
100
|
+
if (this.opened.has(k)) this.opened.delete(k)
|
|
101
|
+
else {
|
|
102
|
+
this.opened.add(k)
|
|
103
|
+
if (!this.folders.has(k)) void this.read(prefix)
|
|
104
|
+
}
|
|
105
|
+
this.keep()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async read(prefix: string): Promise<void> {
|
|
109
|
+
const space = this.shown?.id ?? this.space
|
|
110
|
+
const k = `${space}:${prefix}`
|
|
111
|
+
try {
|
|
112
|
+
const r = await reach(`/api/home/space/ls?space=${encodeURIComponent(space)}&prefix=${encodeURIComponent(prefix)}`, { signal: AbortSignal.timeout(8_000) })
|
|
113
|
+
const j = (await r.json()) as FolderPage | { refused: string }
|
|
114
|
+
runInAction(() => this.folders.set(k, 'refused' in j ? { page: null, error: j.refused } : { page: j, error: '' }))
|
|
115
|
+
} catch (e) {
|
|
116
|
+
runInAction(() => this.folders.set(k, { page: null, error: ownTrouble(e, this.st.machine) || 'the folder was not read' }))
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** the filter: a pause in the typing, then one read of the matches */
|
|
121
|
+
setFilter(text: string): void {
|
|
122
|
+
this.filter = text
|
|
123
|
+
if (this.findTimer != null) clearTimeout(this.findTimer)
|
|
124
|
+
if (text.trim() === '') {
|
|
125
|
+
this.found = null
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
this.findTimer = setTimeout(() => this.find(text), 250)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async find(text: string): Promise<void> {
|
|
132
|
+
const space = this.shown?.id ?? this.space
|
|
133
|
+
try {
|
|
134
|
+
const r = await reach(`/api/home/space/ls?space=${encodeURIComponent(space)}&q=${encodeURIComponent(text)}`, { signal: AbortSignal.timeout(8_000) })
|
|
135
|
+
const j = (await r.json()) as FolderPage | { refused: string }
|
|
136
|
+
runInAction(() => { if (this.filter === text) this.found = 'refused' in j ? { page: null, error: j.refused } : { page: j, error: '' } })
|
|
137
|
+
} catch (e) {
|
|
138
|
+
runInAction(() => { if (this.filter === text) this.found = { page: null, error: ownTrouble(e, this.st.machine) || 'the filter was not read' } })
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** a file opened: the home signs a link for the hour at the click */
|
|
143
|
+
fileHref(key: string): string {
|
|
144
|
+
return `/api/home/space/file?space=${encodeURIComponent(this.shown?.id ?? this.space)}&key=${encodeURIComponent(key)}`
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** the refresh: the daemon's job lists again at its next look */
|
|
148
|
+
async ask(): Promise<void> {
|
|
149
|
+
this.asking = true
|
|
150
|
+
try {
|
|
151
|
+
const r = await reach('/api/home/space/list', { method: 'POST', signal: AbortSignal.timeout(8_000) })
|
|
152
|
+
const j = (await r.json()) as { asked?: boolean; refused?: string }
|
|
153
|
+
if (j.refused != null) throw new Error(j.refused)
|
|
154
|
+
} catch (e) {
|
|
155
|
+
runInAction(() => { this.error = ownTrouble(e, this.st.machine) })
|
|
156
|
+
} finally {
|
|
157
|
+
runInAction(() => { this.asking = false })
|
|
158
|
+
}
|
|
159
|
+
await this.poll()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async poll(): Promise<void> {
|
|
163
|
+
const id = this.gen
|
|
164
|
+
this.loading = true
|
|
165
|
+
try {
|
|
166
|
+
const r = await reach('/api/home/space', { signal: AbortSignal.timeout(8_000) })
|
|
167
|
+
if (!r.ok && r.status !== 503) throw new Error(`the daemon answers ${r.status} ${r.statusText} to /api/home/space`)
|
|
168
|
+
const j = (await r.json()) as SpacePage | { refused: string }
|
|
169
|
+
if ('refused' in j) throw new Error(j.refused)
|
|
170
|
+
runInAction(() => {
|
|
171
|
+
if (id !== this.gen) return
|
|
172
|
+
const moved = j.spaces.some((s) => s.listing?.at !== this.data?.spaces.find((o) => o.id === s.id)?.listing?.at)
|
|
173
|
+
this.data = j
|
|
174
|
+
this.error = ''
|
|
175
|
+
// a new listing: every folder opened is read again
|
|
176
|
+
if (moved) {
|
|
177
|
+
this.folders.clear()
|
|
178
|
+
for (const k of this.opened) if (k.startsWith(`${this.shown?.id}:`)) void this.read(k.slice(k.indexOf(':') + 1))
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
} catch (e) {
|
|
182
|
+
runInAction(() => { if (id === this.gen) this.error = ownTrouble(e, this.st.machine) })
|
|
183
|
+
} finally {
|
|
184
|
+
runInAction(() => { this.loading = false })
|
|
185
|
+
}
|
|
186
|
+
this.next()
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** a listing that runs or was asked is watched closely, else once a minute */
|
|
190
|
+
private next(): void {
|
|
191
|
+
if (this.timer != null) clearTimeout(this.timer)
|
|
192
|
+
if (!this.on) return
|
|
193
|
+
const busy = this.data?.spaces.some((s) => s.running != null || s.asked != null) === true
|
|
194
|
+
this.timer = setTimeout(() => void this.poll(), busy ? SPACE_RUNNING_POLL_MS : SPACE_POLL_MS)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
start(): void {
|
|
198
|
+
if (this.on) return
|
|
199
|
+
this.on = true
|
|
200
|
+
void this.poll()
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
stop(): void {
|
|
204
|
+
this.on = false
|
|
205
|
+
if (this.timer != null) clearTimeout(this.timer)
|
|
206
|
+
this.timer = null
|
|
207
|
+
this.gen++
|
|
208
|
+
}
|
|
209
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// `/space`: what each Space of the house holds and where the room goes. A narrow bar of three entries on the left
|
|
2
|
+
// (entry-bar.tsx; a phone: one row of tabs on top), the entry picked alone on the right: files (the Space as a tree
|
|
3
|
+
// of folders, each with its size, its share and its count, the biggest first, opened in place down to a file, a
|
|
4
|
+
// filter over keys and names), about (which bucket, who may read it, its versioning and rules, its key's name, its
|
|
5
|
+
// copy), health (its listing, what waits to go up, what the index and the listing disagree on, the room nobody sees).
|
|
6
|
+
// A switch above the entries when the house names a second copy.
|
|
7
|
+
//
|
|
8
|
+
// The constraint a reader breaks first: every word comes from the answer, in the console's words (sk space), and the
|
|
9
|
+
// page only reads: a file opens through the home's link signed at the click. Colour is state only
|
|
10
|
+
import { observer } from 'mobx-react-lite'
|
|
11
|
+
import type { ReactNode } from 'react'
|
|
12
|
+
import { ago } from '../../hq/machine-notes.ts'
|
|
13
|
+
import { count, size } from '../../home/database-words.ts'
|
|
14
|
+
import { listedWords, shareWords, totalWords, type FileRow, type FolderRow, type SpaceView as View } from '../../home/space-words.ts'
|
|
15
|
+
import { EntryBar, EntryCols } from './entry-bar.tsx'
|
|
16
|
+
import type { HomeSt } from './home-st.ts'
|
|
17
|
+
import { Caret } from './icons.tsx'
|
|
18
|
+
import { SPACE_ENTRIES, type SpaceEntry, type SpaceSt } from './space-st.ts'
|
|
19
|
+
import { type Cell, type Col, Hint, type Row, Table } from './time-charts.tsx'
|
|
20
|
+
import { FactRow } from './vault-view.tsx'
|
|
21
|
+
import { entryMark } from './vault-st.ts'
|
|
22
|
+
|
|
23
|
+
/** what each entry of the bar holds, said beside its name on the right */
|
|
24
|
+
const ABOUT: Record<SpaceEntry, string> = {
|
|
25
|
+
files: 'every folder with its size and its count, the biggest first; a file opens in a new tab',
|
|
26
|
+
about: 'which bucket, who may read it, its versioning and rules, its key, its copy',
|
|
27
|
+
health: 'its listing, what waits to go up, what the index and the listing disagree on',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const day = (at: number): string => new Date(at).toISOString().slice(0, 16).replace('T', ' ')
|
|
31
|
+
|
|
32
|
+
const head = (narrow: boolean, dated: boolean): Col[] => [
|
|
33
|
+
{ label: 'name', title: 'a folder opens in place; a file opens in a new tab, through a link the home signs for the hour' },
|
|
34
|
+
{ label: 'size', num: true, look: 'bar', title: 'its bytes, every object under it at any depth' },
|
|
35
|
+
{ label: 'share', num: true, title: 'of the whole Space' },
|
|
36
|
+
...(narrow ? [] : [{ label: 'objects', num: true, title: 'its objects, at any depth under it' }, ...(dated ? [{ label: 'put', title: 'when the Space wrote it, its own date; the day on hover' }] : [])]),
|
|
37
|
+
// a phone says it under the name
|
|
38
|
+
...(narrow ? [] : [{ label: 'what it is', more: true, title: 'a folder: what the code keeps there; a file: the repo and the kind that put it' }]),
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
/** a name and, on a phone, what it is under it */
|
|
42
|
+
const Named = ({ narrow, what, children }: { narrow: boolean; what: string | null; children: ReactNode }) => (narrow && what != null && what !== '' ? <span className="spstack">{children}<span className="spwhat mcdim">{what}</span></span> : <>{children}</>)
|
|
43
|
+
|
|
44
|
+
/** a long content key cut to what a person tells apart: its first and last characters */
|
|
45
|
+
const shortKey = (key: string): string => {
|
|
46
|
+
const last = key.slice(key.lastIndexOf('/') + 1)
|
|
47
|
+
return last.length > 20 ? `${last.slice(0, 8)}…${last.slice(last.indexOf('.') > 0 ? last.indexOf('.') - 4 : -8)}` : last
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const Indent = ({ depth }: { depth: number }) => (depth === 0 ? null : <i className="spind" style={{ width: depth * 16 }} />)
|
|
51
|
+
|
|
52
|
+
/** the rows of the tree: each folder, and under an opened one its folders and its files */
|
|
53
|
+
function treeRows(st: SpaceSt, folders: readonly FolderRow[], files: readonly FileRow[], more: number, depth: number, whole: number, narrow: boolean, where: string, opens = true): Row[] {
|
|
54
|
+
const n = (v: number, text: string): Cell => ({ v, text })
|
|
55
|
+
const out: Row[] = []
|
|
56
|
+
for (const f of folders) {
|
|
57
|
+
const open = opens && st.isOpen(f.prefix)
|
|
58
|
+
out.push({
|
|
59
|
+
key: `d:${f.prefix}`,
|
|
60
|
+
title: f.prefix,
|
|
61
|
+
...(opens ? { onClick: () => st.toggle(f.prefix) } : {}),
|
|
62
|
+
cells: [
|
|
63
|
+
<span className="spname"><Indent depth={depth} /><i className="spcaret">{opens ? <Caret open={open} /> : null}</i><Named narrow={narrow} what={f.what}><b>{f.name}</b></Named></span>,
|
|
64
|
+
n(f.bytes, size(f.bytes)),
|
|
65
|
+
n(f.bytes, shareWords(f.bytes, whole)),
|
|
66
|
+
...(narrow ? [] : [n(f.objects, count(f.objects)), '', f.what ?? '']),
|
|
67
|
+
],
|
|
68
|
+
})
|
|
69
|
+
if (!open) continue
|
|
70
|
+
const read = st.folders.get(st.at(f.prefix))
|
|
71
|
+
if (read == null) out.push(note(`r:${f.prefix}`, depth + 1, 'reading…', narrow))
|
|
72
|
+
else if (read.page == null) out.push(note(`e:${f.prefix}`, depth + 1, read.error, narrow))
|
|
73
|
+
else out.push(...treeRows(st, read.page.folders, read.page.files, read.page.more, depth + 1, whole, narrow, f.prefix))
|
|
74
|
+
}
|
|
75
|
+
for (const x of files) out.push(fileRow(st, x, depth, whole, narrow))
|
|
76
|
+
if (more > 0) out.push(note(`m:${where}`, depth, `… and ${count(more)} more files here, the biggest are above: the filter finds any of them by its key or its name`, narrow))
|
|
77
|
+
return out
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const note = (key: string, depth: number, text: string, narrow: boolean): Row => {
|
|
81
|
+
const none = { v: 0, text: '' }
|
|
82
|
+
return { key, cells: [<span className="spname spnote mcdim"><Indent depth={depth} />{text}</span>, none, none, ...(narrow ? [] : [none, '', ''])] }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function fileRow(st: SpaceSt, x: FileRow, depth: number, whole: number, narrow: boolean): Row {
|
|
86
|
+
return {
|
|
87
|
+
key: `f:${x.key}`,
|
|
88
|
+
title: x.key,
|
|
89
|
+
cells: [
|
|
90
|
+
<span className="spname"><Indent depth={depth} /><i className="spcaret" /><Named narrow={narrow} what={x.by}><span>{x.opens ? <a className="spfile" href={st.fileHref(x.key)} target="_blank" rel="noopener noreferrer">{x.named ? x.name : shortKey(x.name)}</a> : <span title="its own command reads it, the page does not open it">{x.named ? x.name : shortKey(x.name)}</span>}{x.named && !narrow ? <span className="mcdim spkey">{shortKey(x.key)}</span> : null}</span></Named></span>,
|
|
91
|
+
{ v: x.size, text: size(x.size) },
|
|
92
|
+
{ v: x.size, text: shareWords(x.size, whole) },
|
|
93
|
+
...(narrow ? [] : [{ v: 0, text: '' }, x.modified == null ? '' : <span title={day(x.modified)}>{`${ago(Math.max(0, (st.data?.at ?? Date.now()) - x.modified))} ago`}</span>, x.by ?? '']),
|
|
94
|
+
],
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const Notes = observer(({ app, v, now }: { app: HomeSt; v: View; now: number }) => {
|
|
99
|
+
const lines: { text: string; tone: 'warn' | 'dim' }[] = []
|
|
100
|
+
if (v.noKey != null) lines.push({ text: v.noKey, tone: 'warn' })
|
|
101
|
+
if (v.listing == null && v.fromIndex) lines.push({ text: `${v.noKey == null ? `${listedWords(v, now)}; until then, ` : ''}below is what this machine's media index says is up: not the whole Space, other machines' files, the backup and the snapshots are not in it`, tone: 'dim' })
|
|
102
|
+
return lines.length === 0 ? null : <ul className="vtfacts vtloud">{lines.map((f) => <FactRow key={f.text} app={app} f={f} />)}</ul>
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
const Files = observer(({ app, st, v }: { app: HomeSt; st: SpaceSt; v: View }) => {
|
|
106
|
+
const narrow = app.layout.narrow
|
|
107
|
+
const now = st.data!.at
|
|
108
|
+
const whole = v.listing?.bytes ?? v.top.reduce((n, f) => n + f.bytes, 0) + v.loose.bytes
|
|
109
|
+
const found = st.found
|
|
110
|
+
const listed = v.listing != null
|
|
111
|
+
const rows = found != null && st.filter.trim() !== ''
|
|
112
|
+
? found.page == null ? [note('find', 0, found.error, narrow)] : treeRows(st, [], found.page.files, found.page.more, 0, whole, narrow, '?')
|
|
113
|
+
: [...treeRows(st, v.top, [], 0, 0, whole, narrow, '', listed), ...(v.loose.n > 0 ? looseRows(st, v, whole, narrow) : [])]
|
|
114
|
+
// the date column only once a file is in the table: a folder has none
|
|
115
|
+
const dated = !narrow && rows.some((r) => r.key.startsWith('f:'))
|
|
116
|
+
const shown = dated || narrow ? rows : rows.map((r) => ({ ...r, cells: r.cells.filter((_, i) => i !== 4) }))
|
|
117
|
+
const dangers = v.health.filter((h) => h.tone === 'danger')
|
|
118
|
+
return (
|
|
119
|
+
<section className="vtsecrets" aria-label="files">
|
|
120
|
+
<div className="vthead">
|
|
121
|
+
<b>{listed ? totalWords(v.listing!) : v.fromIndex ? 'what the index says is up' : 'files'}</b>
|
|
122
|
+
<span className="mcdim">{listed ? listedWords(v, now) : v.fromIndex ? 'this machine\'s media index, not the Space\'s listing' : ABOUT.files}</span>
|
|
123
|
+
</div>
|
|
124
|
+
{dangers.length === 0 ? null : <ul className="vtfacts vtfirst" aria-label="what is in danger">{dangers.map((f) => <FactRow key={f.text} app={app} f={f} more={<> · <a className="vtlink" href="/space#health" onClick={(e) => { e.preventDefault(); st.open('health') }}>open health</a></>} />)}</ul>}
|
|
125
|
+
<Notes app={app} v={v} now={now} />
|
|
126
|
+
{listed ? (
|
|
127
|
+
<div className="vtbar">
|
|
128
|
+
<input className="inquery" type="search" placeholder="filter by a key or a file's name…" aria-label="filter the objects" value={st.filter} onChange={(e) => st.setFilter(e.currentTarget.value)} />
|
|
129
|
+
{found?.page != null && st.filter.trim() !== '' ? <span className="mcdim">{found.page.n === 0 ? 'nothing matches' : `${count(found.page.n)} match${found.page.n === 1 ? '' : 'es'}${found.page.more > 0 ? `, the ${count(found.page.files.length)} biggest shown` : ''}`}</span> : null}
|
|
130
|
+
</div>
|
|
131
|
+
) : null}
|
|
132
|
+
<div className={narrow ? 'sptable spnarrow' : 'sptable'}><Table head={head(narrow, dated)} rows={listed || v.fromIndex ? shown : []} empty={listed ? 'the Space holds no object' : 'nothing listed yet'} /></div>
|
|
133
|
+
</section>
|
|
134
|
+
)
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
/** the objects of no folder: one row that opens on them */
|
|
138
|
+
function looseRows(st: SpaceSt, v: View, whole: number, narrow: boolean): Row[] {
|
|
139
|
+
const open = st.isOpen('')
|
|
140
|
+
const read = open ? st.folders.get(st.at('')) : undefined
|
|
141
|
+
const row: Row = {
|
|
142
|
+
key: 'd:',
|
|
143
|
+
onClick: v.listing == null ? undefined : () => st.toggle(''),
|
|
144
|
+
cells: [<span className="spname"><i className="spcaret">{v.listing == null ? null : <Caret open={open} />}</i><Named narrow={narrow} what="objects at the top of the bucket"><b className="mcdim">(no folder)</b></Named></span>, { v: v.loose.bytes, text: size(v.loose.bytes) }, { v: v.loose.bytes, text: shareWords(v.loose.bytes, whole) }, ...(narrow ? [] : [{ v: v.loose.n, text: count(v.loose.n) }, '', 'objects at the top of the bucket'])],
|
|
145
|
+
}
|
|
146
|
+
if (!open) return [row]
|
|
147
|
+
if (read == null) return [row, note('r:', 1, 'reading…', narrow)]
|
|
148
|
+
if (read.page == null) return [row, note('e:', 1, read.error, narrow)]
|
|
149
|
+
return [row, ...treeRows(st, [], read.page.files, read.page.more, 1, whole, narrow, '')]
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const Facts = observer(({ app, v, e }: { app: HomeSt; v: View; e: 'about' | 'health' }) => (
|
|
153
|
+
<section className="vtsecrets" aria-label={e}>
|
|
154
|
+
<div className="vthead"><b>{e}</b><span className="mcdim">{e === 'health' && v.id === 'copy' ? 'its listing, what it lacks of the Space, the room nobody sees' : ABOUT[e]}</span></div>
|
|
155
|
+
<ul className="vtfacts">{v[e].map((f) => <FactRow key={f.text} app={app} f={f} />)}</ul>
|
|
156
|
+
</section>
|
|
157
|
+
))
|
|
158
|
+
|
|
159
|
+
/** the switch between the Space and its copy, above the entries */
|
|
160
|
+
const Switch = observer(({ st }: { st: SpaceSt }) => {
|
|
161
|
+
const all = st.data?.spaces ?? []
|
|
162
|
+
if (all.length < 2) return null
|
|
163
|
+
return (
|
|
164
|
+
<div className="seg spswitch" role="group" aria-label="which Space">
|
|
165
|
+
{all.map((s) => <button key={s.id} type="button" aria-pressed={st.shown?.id === s.id} className={st.shown?.id === s.id ? 'on' : ''} title={s.role} onClick={() => st.pickSpace(s.id)}>{s.id === 'space' ? 'the Space' : 'its copy'}</button>)}
|
|
166
|
+
</div>
|
|
167
|
+
)
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
/** the listing's state in a few words, for the top line: the files entry says the rest */
|
|
171
|
+
const shortListed = (v: View, now: number): string => (v.running != null ? 'listing now' : v.listing != null ? listedWords({ ...v, asked: null }, now) : v.noKey != null ? 'not listed: no key here' : 'not listed yet')
|
|
172
|
+
|
|
173
|
+
export const SpaceView = observer(({ app }: { app: HomeSt }) => {
|
|
174
|
+
const st = app.space
|
|
175
|
+
const d = st.data
|
|
176
|
+
const v = st.shown
|
|
177
|
+
const narrow = app.layout.narrow
|
|
178
|
+
const busy = v != null && (v.running != null || v.asked != null)
|
|
179
|
+
const cost = v?.listing == null ? 'about one call per 1,000 objects' : `${count(v.listing.calls)} calls and ${Math.round(v.listing.ms / 1000)} s the last time`
|
|
180
|
+
return (
|
|
181
|
+
<div className="vaultpage spacepage">
|
|
182
|
+
<div className="actop vttop">
|
|
183
|
+
<button type="button" className="acpill" disabled={st.asking || busy || v?.noKey != null} onClick={() => void st.ask()}>
|
|
184
|
+
<Hint tip={`list the Space again now, in the daemon: ${cost}; by itself it lists once a day`} className={`acring${busy || st.asking ? ' on' : ''}`}>↻</Hint>
|
|
185
|
+
</button>
|
|
186
|
+
<span className="acdim">{d == null ? (st.error !== '' ? '' : 'reading what the listing kept…') : v == null ? `${d.machine} · the house config names no Space` : narrow ? `${v.title} · ${shortListed(v, d.at)}` : `${d.machine} · ${v.title}, ${v.role} · ${shortListed(v, d.at)} · a page to read, nothing is changed from here · in the console: sk space`}</span>
|
|
187
|
+
</div>
|
|
188
|
+
{st.error !== '' ? <div className="hnote mcerr">{st.error}</div> : null}
|
|
189
|
+
{d == null || v == null ? null : (
|
|
190
|
+
<EntryCols narrow={narrow} bar={<EntryBar label="the Space's entries" entries={SPACE_ENTRIES} current={st.entry} open={(e) => st.open(e as SpaceEntry)} mark={(e) => (e === 'files' ? { tone: '', title: '' } : entryMark(v[e as 'about' | 'health']))} tabs={narrow} head={<Switch st={st} />} />}>
|
|
191
|
+
{st.entry === 'files' ? <Files app={app} st={st} v={v} /> : <Facts app={app} v={v} e={st.entry} />}
|
|
192
|
+
</EntryCols>
|
|
193
|
+
)}
|
|
194
|
+
</div>
|
|
195
|
+
)
|
|
196
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* the Space page (space-view.tsx): the vault page's frame (vault.css .vaultpage, its heads and facts) and the bar of
|
|
2
|
+
entries (entry-bar.css); here the tree of folders: a caret, an indent a level, a file a link, its key dim */
|
|
3
|
+
.sptable{overflow-x:auto}
|
|
4
|
+
.sptable .tvtable td{vertical-align:baseline}
|
|
5
|
+
/* what a row is takes the width that is left and cuts with an ellipsis, so the table never passes its area */
|
|
6
|
+
.sptable .tvtable td.tvmore{width:100%;max-width:0}
|
|
7
|
+
.sptable .tvtable td:first-child{max-width:340px}
|
|
8
|
+
.spname{display:inline-flex;align-items:baseline;gap:var(--s1);white-space:nowrap}
|
|
9
|
+
.spind{display:inline-block;flex:none}
|
|
10
|
+
.spcaret{display:inline-flex;align-items:center;justify-content:center;width:14px;flex:none;color:var(--dim);transform:translateY(1px)}
|
|
11
|
+
.spfile{color:var(--ink);text-decoration:none}
|
|
12
|
+
.spfile:hover{color:var(--accent);text-decoration:underline}
|
|
13
|
+
.spkey{margin-left:var(--s2);font:11px ui-monospace,SFMono-Regular,Menlo,monospace}
|
|
14
|
+
.spswitch{height:24px}
|
|
15
|
+
.spswitch button{padding:0 var(--s2);font-size:12px}
|
|
16
|
+
.spswitch button.on{background:var(--sel);color:var(--ink)}
|
|
17
|
+
.spacepage .inquery{width:min(320px,100%)}
|
|
18
|
+
.spacepage .vtsecrets .vtfirst{margin:0 0 var(--s3)}
|
|
19
|
+
/* a phone: what a row is under its name, the name cut first */
|
|
20
|
+
.spstack{display:inline-flex;flex-direction:column;min-width:0;line-height:1.3}
|
|
21
|
+
.spwhat{font-size:11.5px;white-space:normal}
|
|
22
|
+
.spnote{white-space:normal}
|
|
23
|
+
/* a phone: the name takes the width the figures leave, and wraps */
|
|
24
|
+
.spnarrow .tvtable td:first-child{max-width:none;width:100%;white-space:normal}
|
|
25
|
+
.spnarrow .spname{white-space:normal;overflow-wrap:anywhere}
|
|
26
|
+
/* a row of two lines draws its share as a thin bar under the figure, never a block */
|
|
27
|
+
.spnarrow .tvtable td.tvbar{background-size:calc(100% - var(--s2)) 4px;background-position:0 calc(var(--s1) + 1.3em)}
|