rvlib-shipkit 2.11.0 → 2.13.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 +56 -12
- package/README.md +1 -1
- package/package.json +4 -2
- package/src/agent-time/store.ts +2 -2
- package/src/check.ts +1 -1
- package/src/checks/SK001-package-json-shape.check.ts +4 -0
- package/src/checks/SK003-claude-md-shape.check.ts +1 -1
- package/src/checks/SK004-gitignore-policy.check.ts +27 -2
- package/src/checks/SK005-rvlib-versions.check.ts +1 -1
- package/src/checks/SK008-reviewer-agent.check.ts +2 -2
- package/src/checks/SK012-config-barrel-import.check.ts +1 -1
- package/src/checks/SK015-nested-repo.check.ts +1 -1
- package/src/checks/SK035-public-clean.check.ts +46 -0
- package/src/checks/SK036-draft-media-size.check.ts +28 -0
- package/src/cli/cmd_Backup.ts +152 -0
- package/src/cli/cmd_Ci.ts +8 -11
- package/src/cli/cmd_Drill.ts +145 -0
- package/src/cli/cmd_Home.ts +50 -3
- package/src/cli/cmd_Media.ts +96 -5
- package/src/cli/cmd_Review.ts +8 -2
- package/src/cli/cmd_Shot.ts +5 -2
- package/src/cli/cmd_Smoke.ts +4 -1
- package/src/cli/cmd_Social.ts +226 -0
- package/src/cli/cmd_Start.ts +1 -1
- package/src/cli/cmd_Time.ts +1 -1
- package/src/cli/cmd_Trailer.ts +9 -2
- package/src/cli/cmd_Veille.ts +173 -0
- package/src/cli/family-pages.ts +3 -0
- package/src/cli/registry.ts +13 -2
- package/src/cli.ts +5 -2
- package/src/collections/actions.ts +1 -49
- package/src/collections/checks.ts +2 -1
- package/src/collections/collection-types.ts +11 -2
- package/src/collections/providers.ts +4 -4
- package/src/collections/review.ts +2 -1
- package/src/collections/tests.ts +19 -8
- package/src/contracts/apply-contracts.ts +1 -3
- package/src/contracts/contract-manifests.ts +2 -3
- package/src/contracts/contract-types.ts +0 -1
- package/src/contracts/contracts-engine.ts +0 -3
- package/src/core/app-icon.ts +9 -3
- package/src/core/bun-builtins.ts +2 -2
- package/src/core/discover-checks.ts +37 -5
- package/src/core/fix-scope.ts +4 -2
- package/src/core/floor-resolve.ts +68 -48
- package/src/core/floor.ts +9 -0
- package/src/core/git-root.ts +24 -0
- package/src/core/last-good.ts +3 -1
- package/src/core/layout.ts +8 -0
- package/src/core/log-stamp.ts +36 -0
- package/src/core/loop-watch.ts +93 -0
- package/src/core/machine-link.ts +134 -0
- package/src/core/memory-watch.ts +41 -0
- package/src/core/one-way-in-policy.ts +27 -19
- package/src/core/run-ci.ts +6 -8
- package/src/core/run-fixers.ts +9 -9
- package/src/core/slots.ts +21 -0
- package/src/core/tree-rev.ts +60 -0
- package/src/core/unit-files.ts +42 -0
- package/src/drill/render.ts +140 -0
- package/src/drill/run.ts +269 -0
- package/src/fleet/scan-fleet.ts +6 -5
- package/src/home/daemon-jobs.ts +201 -0
- package/src/home/global-context.ts +34 -1
- package/src/home/home-routes.ts +22 -15
- package/src/home/hubs.ts +10 -3
- package/src/home/inbox-shape.ts +61 -6
- package/src/home/inbox.ts +75 -4
- package/src/home/lib-watch.ts +10 -3
- package/src/home/machine-stores.ts +15 -29
- package/src/home/run-daemon.ts +15 -18
- package/src/home/run-pm.ts +2 -0
- package/src/home/serve-daemon.ts +4 -3
- package/src/home/serve-web.ts +110 -1
- package/src/hooks/commit-message.ts +28 -19
- package/src/hooks/leak-guard.ts +10 -3
- package/src/hooks/run-hooks.ts +2 -6
- package/src/identities/identities.ts +334 -0
- package/src/identities/machine-route.ts +126 -0
- package/src/identities/machine.ts +62 -0
- package/src/init-repo.ts +1 -1
- package/src/ledger/check-stats.ts +10 -9
- package/src/ledger/gate-checks.ts +32 -1
- package/src/ledger/record-kept.ts +112 -0
- package/src/ledger/repo-view.ts +10 -0
- package/src/ledger/run-log.ts +17 -12
- package/src/ledger/run-timeline.ts +8 -4
- package/src/ledger/store.ts +7 -0
- package/src/ledger/suite-log.ts +17 -13
- package/src/media-kinds.ts +9 -1
- package/src/media-store/backup/daemon.ts +73 -0
- package/src/media-store/backup/keys.ts +25 -0
- package/src/media-store/backup/manifest.ts +193 -0
- package/src/media-store/backup/restore.ts +192 -0
- package/src/media-store/backup/run.ts +278 -0
- package/src/media-store/backup/secret.ts +86 -0
- package/src/media-store/backup/snapshot.ts +64 -0
- package/src/media-store/backup/sources.ts +199 -0
- package/src/media-store/content.ts +11 -1
- package/src/media-store/daemon.ts +56 -70
- package/src/media-store/hand.ts +58 -0
- package/src/media-store/put.ts +122 -0
- package/src/media-store/space.ts +73 -11
- package/src/pages/forward.ts +35 -0
- package/src/pages/frame-client.ts +118 -0
- package/src/pages/routes.ts +29 -0
- package/src/pages/unit.ts +92 -0
- package/src/plan/planner.ts +12 -0
- package/src/plan/repo-source.ts +19 -5
- package/src/reflect/transcript.ts +35 -10
- package/src/release/public-clean.ts +301 -0
- package/src/release/published-here.ts +22 -0
- package/src/release/run-bump.ts +2 -1
- package/src/release/run-release.ts +4 -1
- package/src/repo-config.ts +53 -2
- package/src/review/http.ts +16 -2
- package/src/review/media-kind.ts +3 -3
- package/src/review/media-read.ts +3 -3
- package/src/review/model.ts +24 -5
- package/src/review/notes.ts +77 -0
- package/src/review/project.ts +6 -38
- package/src/review/routes.ts +8 -13
- package/src/review/store.ts +46 -4
- package/src/review/trailer-media.ts +24 -3
- package/src/review/trailer-shots.ts +106 -0
- package/src/review/unit.ts +1 -1
- package/src/scaffold/files/agent-handoff.md +3 -0
- package/src/scaffold/files/agent-index.md +4 -12
- package/src/scaffold/project-scaffold.ts +5 -4
- package/src/serve/embed.ts +1 -1
- package/src/serve/hub-app/col-card.tsx +3 -17
- package/src/serve/hub-app/col-tables-view.tsx +2 -1
- package/src/serve/hub-app/cols-svc.ts +12 -14
- package/src/serve/hub-app/dock-st.ts +4 -2
- package/src/serve/hub-app/dock-view.tsx +2 -0
- package/src/serve/hub-app/frames-st.ts +35 -0
- package/src/serve/hub-app/hash-route.ts +64 -1
- package/src/serve/hub-app/home-st.ts +31 -7
- package/src/serve/hub-app/home-strip.css +9 -1
- package/src/serve/hub-app/home-strip.tsx +7 -6
- package/src/serve/hub-app/home.html +5 -0
- package/src/serve/hub-app/hub-app.tsx +49 -5
- package/src/serve/hub-app/hub.css +29 -11
- package/src/serve/hub-app/icons.tsx +16 -1
- package/src/serve/hub-app/identities-st.ts +210 -0
- package/src/serve/hub-app/identities-view.tsx +352 -0
- package/src/serve/hub-app/identities.css +48 -0
- package/src/serve/hub-app/identity-address.ts +52 -0
- package/src/serve/hub-app/inbox-st.ts +59 -6
- package/src/serve/hub-app/inbox-view.tsx +48 -6
- package/src/serve/hub-app/inbox.css +12 -1
- package/src/serve/hub-app/index.html +3 -0
- package/src/serve/hub-app/keys.ts +10 -2
- package/src/serve/hub-app/list-walk.ts +89 -0
- package/src/serve/hub-app/machine-st.ts +12 -0
- package/src/serve/hub-app/media-view.tsx +2 -1
- package/src/serve/hub-app/pages-frames.tsx +134 -0
- package/src/serve/hub-app/pages-svc.ts +111 -0
- package/src/serve/hub-app/palette-st.ts +18 -3
- package/src/serve/hub-app/palette-view.tsx +9 -2
- package/src/serve/hub-app/planned-view.tsx +2 -1
- package/src/serve/hub-app/project-list.css +18 -14
- package/src/serve/hub-app/project-list.tsx +88 -49
- package/src/serve/hub-app/projects-svc.ts +33 -3
- package/src/serve/hub-app/repo-sections.ts +19 -2
- package/src/serve/hub-app/repo-st.ts +75 -19
- package/src/serve/hub-app/review/review-cells.tsx +3 -3
- package/src/serve/hub-app/review/review-kit.ts +30 -7
- package/src/serve/hub-app/review/review-page.tsx +1 -1
- package/src/serve/hub-app/review/review-st.ts +33 -11
- package/src/serve/hub-app/review/review-thread.tsx +11 -9
- package/src/serve/hub-app/review/review-views.tsx +84 -19
- package/src/serve/hub-app/review/thread-st.ts +1 -10
- package/src/serve/hub-app/review/trailer-page.tsx +2 -1
- package/src/serve/hub-app/review.css +17 -8
- package/src/serve/hub-app/site/site-part.tsx +173 -0
- package/src/serve/hub-app/site/site-st.ts +157 -0
- package/src/serve/hub-app/site.css +35 -0
- package/src/serve/hub-app/social/calendar.tsx +182 -0
- package/src/serve/hub-app/social/comms-page.tsx +306 -0
- package/src/serve/hub-app/social/kit.tsx +244 -0
- package/src/serve/hub-app/social/post-card.tsx +456 -0
- package/src/serve/hub-app/social/problems.tsx +60 -0
- package/src/serve/hub-app/social/social-model.ts +154 -0
- package/src/serve/hub-app/social/social-page.tsx +674 -0
- package/src/serve/hub-app/social/social-st.ts +986 -0
- package/src/serve/hub-app/social.css +289 -0
- package/src/serve/hub-app/stores/stores-page.tsx +311 -0
- package/src/serve/hub-app/stores/stores-st.ts +286 -0
- package/src/serve/hub-app/stores.css +54 -0
- package/src/serve/hub-app/test-view.tsx +9 -2
- package/src/serve/hub-app/tests-svc.ts +16 -1
- package/src/serve/hub-app/timeline-geometry.ts +1 -1
- package/src/serve/hub-app/timeline-view.tsx +3 -2
- package/src/serve/hub-app/tree-build.ts +6 -0
- package/src/serve/hub-app/tree-row.tsx +27 -4
- package/src/serve/hub-app/tree-svc.ts +18 -49
- package/src/serve/hub-app/veille/veille-page.tsx +514 -0
- package/src/serve/hub-app/veille/veille-st.ts +443 -0
- package/src/serve/hub-app/veille.css +84 -0
- package/src/serve/hub-runtime.ts +14 -9
- package/src/serve/project-gutter-route.ts +44 -12
- package/src/serve/resources-wire.ts +48 -0
- package/src/serve/run-lanes.ts +7 -4
- package/src/serve/same-origin.ts +1 -1
- package/src/serve/serve-hub.ts +27 -18
- package/src/serve/tracked-watch.ts +24 -3
- package/src/serve/warm-cell.ts +5 -1
- package/src/shipkit-files.ts +15 -4
- package/src/shipkit.ts +0 -1
- package/src/shot/box.ts +162 -0
- package/src/shot/browser-slot.ts +62 -0
- package/src/shot/client.ts +43 -7
- package/src/shot/clip-encoder.ts +93 -12
- package/src/shot/film-box.ts +188 -0
- package/src/shot/shooter.ts +50 -15
- package/src/shot/shot-ask.ts +10 -2
- package/src/shot/stepped-clip.ts +5 -4
- package/src/site/desk.ts +242 -0
- package/src/site/routes.ts +66 -0
- package/src/site/unit.ts +62 -0
- package/src/social/brands.ts +22 -0
- package/src/social/compose.ts +97 -0
- package/src/social/desk-index.ts +123 -0
- package/src/social/desk-wire.ts +64 -0
- package/src/social/drafts.ts +183 -0
- package/src/social/house.ts +24 -0
- package/src/social/load.ts +319 -0
- package/src/social/md.ts +70 -0
- package/src/social/media-facts.ts +53 -0
- package/src/social/media-kind.ts +189 -0
- package/src/social/media-limit.ts +42 -0
- package/src/social/media-of.ts +30 -0
- package/src/social/migrate.ts +123 -0
- package/src/social/open.ts +17 -0
- package/src/social/post-url.ts +158 -0
- package/src/social/presence.ts +332 -0
- package/src/social/public-read.ts +53 -0
- package/src/social/publish/bluesky.ts +168 -0
- package/src/social/publish/discord.ts +76 -0
- package/src/social/publish/index.ts +24 -0
- package/src/social/publish/secret.ts +13 -0
- package/src/social/push.ts +31 -0
- package/src/social/richtext.ts +37 -0
- package/src/social/routes.ts +180 -0
- package/src/social/stats.ts +134 -0
- package/src/social/text.ts +267 -0
- package/src/social/tracker-route.ts +39 -0
- package/src/social/tracker.ts +255 -0
- package/src/social/unit.ts +53 -0
- package/src/social/writes.ts +130 -0
- package/src/start-repo.ts +14 -9
- package/src/stores/collection.ts +27 -0
- package/src/stores/desk.ts +336 -0
- package/src/stores/model.ts +187 -0
- package/src/stores/routes.ts +126 -0
- package/src/stores/unit.ts +57 -0
- package/src/suite/calibrate.ts +127 -0
- package/src/suite/core-counters.ts +91 -0
- package/src/suite/judge-suites.ts +94 -34
- package/src/suite/suite-cli.ts +44 -10
- package/src/suite/suite-cpu-preload.ts +34 -9
- package/src/trailer/adapter.ts +4 -0
- package/src/trailer/build.ts +42 -11
- package/src/trailer/ffmpeg.ts +11 -0
- package/src/trailer/footage.ts +30 -13
- package/src/trailer/grammar.ts +18 -2
- package/src/trailer/graph.ts +28 -6
- package/src/trailer/passage.ts +21 -6
- package/src/trailer/plan.ts +74 -3
- package/src/trailer/shelf.ts +16 -0
- package/src/trailer/stitch.ts +67 -26
- package/src/trailer/url.ts +1 -1
- package/src/trailer/versions.ts +24 -0
- package/src/ts/gate-typecheck.ts +32 -0
- package/src/ts/typecheck-cli.ts +9 -11
- package/src/tui/tui-app.tsx +0 -1
- package/src/veille/asks.ts +155 -0
- package/src/veille/auto.ts +31 -0
- package/src/veille/batch.ts +27 -0
- package/src/veille/chrome.ts +127 -0
- package/src/veille/collection.ts +28 -0
- package/src/veille/desk.ts +242 -0
- package/src/veille/identity.ts +80 -0
- package/src/veille/import.ts +68 -0
- package/src/veille/log.ts +183 -0
- package/src/veille/platforms.ts +118 -0
- package/src/veille/reads.ts +66 -0
- package/src/veille/replied.ts +110 -0
- package/src/veille/routes.ts +185 -0
- package/src/veille/service.ts +81 -0
- package/src/veille/watch.ts +116 -0
- package/src/veille/worth.ts +46 -0
- package/src/wiki/scan-md.ts +18 -0
- package/src/collections/posts.ts +0 -142
- package/src/contracts/manifests/social.contract.ts +0 -20
- package/src/scaffold/files/agent-coding.md +0 -35
- package/src/ts/typecheck-cache.ts +0 -11
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
// the list kept under the item so back finds it where it was
|
|
6
6
|
import { observer } from 'mobx-react-lite'
|
|
7
7
|
import { useLayoutEffect } from 'react'
|
|
8
|
-
import { isReviewId, type InboxRow } from '../../home/inbox-shape.ts'
|
|
8
|
+
import { INBOX_GROUPS, isReviewId, type InboxGroup, type InboxGroupNode, type InboxRow } from '../../home/inbox-shape.ts'
|
|
9
9
|
import { hashFor } from './hash-route.ts'
|
|
10
10
|
import { plainClick, repoPage, type HomeSt } from './home-st.ts'
|
|
11
|
-
import { Icon, ICON } from './icons.tsx'
|
|
11
|
+
import { Caret, Icon, ICON } from './icons.tsx'
|
|
12
12
|
import type { InboxSt } from './inbox-st.ts'
|
|
13
13
|
import { ItemView } from './item-view.tsx'
|
|
14
14
|
import { Face } from './project-list.tsx'
|
|
@@ -36,6 +36,7 @@ export const InboxView = observer(({ app }: { app: HomeSt }) => {
|
|
|
36
36
|
<h1>inbox</h1>
|
|
37
37
|
<Counts ib={ib} />
|
|
38
38
|
</div>
|
|
39
|
+
<Bar ib={ib} />
|
|
39
40
|
<InboxList app={app} />
|
|
40
41
|
</div>
|
|
41
42
|
{open != null ? <OpenItem app={app} item={open} /> : null}
|
|
@@ -48,6 +49,7 @@ export const InboxView = observer(({ app }: { app: HomeSt }) => {
|
|
|
48
49
|
<h1>inbox</h1>
|
|
49
50
|
<Counts ib={ib} />
|
|
50
51
|
</div>
|
|
52
|
+
<Bar ib={ib} />
|
|
51
53
|
<InboxList app={app} />
|
|
52
54
|
</div>
|
|
53
55
|
<div className="ib-itemcol">{open != null ? <OpenItem app={app} item={open} /> : <div className="ph">{ib.count > 0 ? 'pick a row: it opens here' : ''}</div>}</div>
|
|
@@ -64,6 +66,46 @@ const Counts = observer(({ ib }: { ib: InboxSt }) =>
|
|
|
64
66
|
),
|
|
65
67
|
)
|
|
66
68
|
|
|
69
|
+
const GROUP_WORDS: Record<InboxGroup, string> = { repo: 'project', kind: 'type', lane: 'lane' }
|
|
70
|
+
|
|
71
|
+
/** what the list shows (the review cards, or every kind) and what it groups by, each axis on its own */
|
|
72
|
+
const Bar = observer(({ ib }: { ib: InboxSt }) => (
|
|
73
|
+
<div className="ib-bar">
|
|
74
|
+
<span className="seg" title="the review cards only, or every kind: checks, asks and needs too">
|
|
75
|
+
<button className={ib.show === 'cards' ? 'on' : ''} onClick={() => ib.setShow('cards')}>cards</button>
|
|
76
|
+
<button className={ib.show === 'all' ? 'on' : ''} onClick={() => ib.setShow('all')}>all{ib.show === 'cards' && ib.allCount > ib.cardCount ? <span className="ib-dim"> · {ib.allCount}</span> : null}</button>
|
|
77
|
+
</span>
|
|
78
|
+
<span className="sp" />
|
|
79
|
+
<span className="ib-groupby">
|
|
80
|
+
<span className="ib-dim">group by</span>
|
|
81
|
+
<span className="seg">
|
|
82
|
+
{INBOX_GROUPS.map((g) => (
|
|
83
|
+
<button key={g} className={ib.groupBy.includes(g) ? 'on' : ''} aria-pressed={ib.groupBy.includes(g)} onClick={() => ib.toggleGroup(g)}>{GROUP_WORDS[g]}</button>
|
|
84
|
+
))}
|
|
85
|
+
</span>
|
|
86
|
+
</span>
|
|
87
|
+
</div>
|
|
88
|
+
))
|
|
89
|
+
|
|
90
|
+
/** the rows as their groups nest: a group's head says what it is and how many, then its rows or its inner groups */
|
|
91
|
+
const Groups = observer(({ app, gs, depth = 0 }: { app: HomeSt; gs: InboxGroupNode[]; depth?: number }) => (
|
|
92
|
+
<>
|
|
93
|
+
{gs.map((g) =>
|
|
94
|
+
g.label === '' ? (
|
|
95
|
+
g.rows.map((r) => <Row key={r.key} app={app} r={r} />)
|
|
96
|
+
) : (
|
|
97
|
+
<section key={g.key} className={`ib-group d${depth}`}>
|
|
98
|
+
<div className="ib-grouphead">
|
|
99
|
+
<span className="ib-glabel">{g.label}</span>
|
|
100
|
+
<span className="ib-gn">{g.n}</span>
|
|
101
|
+
</div>
|
|
102
|
+
{g.groups != null ? <Groups app={app} gs={g.groups} depth={depth + 1} /> : g.rows.map((r) => <Row key={r.key} app={app} r={r} />)}
|
|
103
|
+
</section>
|
|
104
|
+
),
|
|
105
|
+
)}
|
|
106
|
+
</>
|
|
107
|
+
))
|
|
108
|
+
|
|
67
109
|
const InboxList = observer(({ app }: { app: HomeSt }) => {
|
|
68
110
|
const ib = app.inbox
|
|
69
111
|
const p = ib.page
|
|
@@ -73,19 +115,19 @@ const InboxList = observer(({ app }: { app: HomeSt }) => {
|
|
|
73
115
|
{p == null ? (
|
|
74
116
|
ib.error === '' ? <div className="ib-wait"><span className="spin" />reading every repo…</div> : null
|
|
75
117
|
) : ib.rows.length === 0 ? (
|
|
76
|
-
<div className="ib-clear">nothing waits on you
|
|
118
|
+
<div className="ib-clear">{ib.show === 'cards' ? 'no card waits on you ✨' : 'nothing waits on you ✨'}</div>
|
|
77
119
|
) : (
|
|
78
|
-
|
|
120
|
+
<Groups app={app} gs={ib.groups} />
|
|
79
121
|
)}
|
|
80
122
|
{ib.more > 0 ? <button className="ib-more" onClick={() => ib.showMore()}>{ib.more} more</button> : null}
|
|
81
123
|
{ib.yellowCount > 0 ? (
|
|
82
124
|
<div className={`ib-fold${ib.yellowOpen ? ' on' : ''}`}>
|
|
83
125
|
<button className="ib-foldhead" aria-expanded={ib.yellowOpen} onClick={() => ib.toggleYellow()}>
|
|
84
|
-
<span className="ib-caret"
|
|
126
|
+
<span className="ib-caret"><Caret open={ib.yellowOpen} /></span>
|
|
85
127
|
<span>can wait</span>
|
|
86
128
|
<span className="ib-n">{ib.yellowCount}</span>
|
|
87
129
|
</button>
|
|
88
|
-
{ib.yellowOpen ?
|
|
130
|
+
{ib.yellowOpen ? <Groups app={app} gs={ib.yellowGroups} /> : null}
|
|
89
131
|
</div>
|
|
90
132
|
) : null}
|
|
91
133
|
{p != null && p.missing.length > 0 ? (
|
|
@@ -39,13 +39,24 @@ a.ib-row.t-yellow{border-left-color:var(--warn)}
|
|
|
39
39
|
.ib-l2 .ago{flex:none;margin-left:auto}
|
|
40
40
|
.ib-thumb{flex:none;width:64px;height:48px;object-fit:cover;border-radius:4px;border:1px solid var(--line);background:var(--panel2)}
|
|
41
41
|
|
|
42
|
+
/* what the list shows and groups by, under the title */
|
|
43
|
+
.ib-bar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s2);padding:0 var(--s4) var(--s2)}
|
|
44
|
+
.ib-bar .sp{flex:1}
|
|
45
|
+
.ib-bar .seg button{font-size:12px;padding:0 var(--s2);line-height:22px}
|
|
46
|
+
.ib-groupby{display:flex;align-items:center;gap:var(--s2);font-size:12px}
|
|
47
|
+
/* a group: its head, then its rows; an inner group steps in */
|
|
48
|
+
.ib-grouphead{display:flex;align-items:baseline;gap:var(--s2);padding:var(--s3) var(--s4) var(--s1);font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--dim);border-top:1px solid var(--line)}
|
|
49
|
+
.ib-group .ib-group > .ib-grouphead{margin-left:var(--s4);padding-top:var(--s2);border-top:0;font-size:10.5px}
|
|
50
|
+
.ib-glabel{text-transform:none;letter-spacing:0;font-size:12.5px;color:var(--ink)}
|
|
51
|
+
.ib-gn{font-variant-numeric:tabular-nums}
|
|
52
|
+
|
|
42
53
|
/* the folded list and the repos it could not read */
|
|
43
54
|
button.ib-more{margin:var(--s3) var(--s4) 0;min-height:44px;font-size:14px}
|
|
44
55
|
.ib-fold{margin-top:var(--s4);border-top:1px solid var(--line)}
|
|
45
56
|
button.ib-foldhead{display:flex;align-items:center;gap:var(--s2);width:100%;min-height:48px;padding:0 var(--s4);border:0;border-radius:0;
|
|
46
57
|
background:transparent;color:var(--dim);font-size:14px;text-align:left}
|
|
47
58
|
button.ib-foldhead:hover{color:var(--ink)}
|
|
48
|
-
.ib-caret{width:
|
|
59
|
+
.ib-caret{display:inline-flex;width:14px}
|
|
49
60
|
.ib-n{color:var(--warn);font-weight:700}
|
|
50
61
|
.ib-fold.on a.ib-row{opacity:.85}
|
|
51
62
|
.ib-missing{padding:var(--s3) var(--s4);color:var(--dim);font-size:12.5px;display:flex;flex-direction:column;gap:var(--s1)}
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
<link rel="stylesheet" href="./dock.css" />
|
|
16
16
|
<link rel="stylesheet" href="./controls.css" />
|
|
17
17
|
<link rel="stylesheet" href="./review.css" />
|
|
18
|
+
<link rel="stylesheet" href="./stores.css" />
|
|
19
|
+
<link rel="stylesheet" href="./veille.css" />
|
|
20
|
+
<link rel="stylesheet" href="./social.css" />
|
|
18
21
|
</head>
|
|
19
22
|
<body>
|
|
20
23
|
<div id="root"></div>
|
|
@@ -59,8 +59,8 @@ export function isSearchKey(e: Pick<KeyLike, 'key' | 'metaKey' | 'ctrlKey' | 'al
|
|
|
59
59
|
* plus a letter only types a character inside a text field, where the page
|
|
60
60
|
* leaves the key alone. Read from the physical key (`code`): on a Mac ⌥C
|
|
61
61
|
* types ç, and AZERTY moves the letters */
|
|
62
|
-
export type SectionId = 'readme' | 'contracts' | 'shipkit' | 'repo' | 'secrets' | 'when' | 'runs' | 'plan' | 'processes' | 'git' | 'asks' | 'review' | 'reflections' | 'tests' | 'media' | 'trailer' | 'wikis' | 'admin'
|
|
63
|
-
export const SECTION_LETTER: Record<SectionId, string> = { readme: 'E', review: 'V', trailer: 'L', contracts: 'K', shipkit: 'S', repo: 'C', secrets: 'X', when: 'O', runs: 'R', plan: 'N', processes: 'P', git: 'G', asks: 'A', reflections: 'F', tests: 'T', media: 'M', wikis: 'W', admin: 'D' }
|
|
62
|
+
export type SectionId = 'readme' | 'contracts' | 'shipkit' | 'repo' | 'secrets' | 'when' | 'runs' | 'plan' | 'processes' | 'git' | 'asks' | 'review' | 'reflections' | 'tests' | 'media' | 'trailer' | 'stores' | 'veille' | 'comms' | 'social' | 'wikis' | 'admin'
|
|
63
|
+
export const SECTION_LETTER: Record<SectionId, string> = { readme: 'E', review: 'V', trailer: 'L', stores: 'B', veille: 'Y', comms: 'U', social: 'I', contracts: 'K', shipkit: 'S', repo: 'C', secrets: 'X', when: 'O', runs: 'R', plan: 'N', processes: 'P', git: 'G', asks: 'A', reflections: 'F', tests: 'T', media: 'M', wikis: 'W', admin: 'D' }
|
|
64
64
|
/** a section's words on its row, where the id alone would not say it */
|
|
65
65
|
export const SECTION_LABEL: Partial<Record<SectionId, string>> = { shipkit: 'shipkit checks', repo: 'repo checks' }
|
|
66
66
|
export const sectionLabel = (id: SectionId): string => SECTION_LABEL[id] ?? id
|
|
@@ -74,3 +74,11 @@ export function sectionKey(e: KeyLike): SectionId | null {
|
|
|
74
74
|
const hit = Object.entries(SECTION_LETTER).find(([, l]) => l === m[1])
|
|
75
75
|
return hit == null ? null : (hit[0] as SectionId)
|
|
76
76
|
}
|
|
77
|
+
|
|
78
|
+
/** a repo's own page on ⌥⇧ and its letter (wiki build/shipkit/project-pages.md, Keys): shipkit's ⌥ letters stay its
|
|
79
|
+
* own. The letter, read from the physical key, or null */
|
|
80
|
+
export function pageLetterKey(e: KeyLike): string | null {
|
|
81
|
+
if (!e.altKey || !e.shiftKey || e.metaKey || e.ctrlKey) return null
|
|
82
|
+
return /^Key([A-Z])$/.exec(e.code)?.[1] ?? null
|
|
83
|
+
}
|
|
84
|
+
export const pageKeyLabel = (letter: string): string => `⌥⇧${letter}`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// the arrows over a list of rows: the one keyboard model of the hub's lists, the repo tree (tree-svc.ts) and the
|
|
2
|
+
// identity view (identities-st.ts). ↑ ↓ land on the row above or below, stepping over inert ones; → unfolds a folded
|
|
3
|
+
// row, else steps down; ← folds an unfolded row, else climbs to its parent; Enter and space open the row. What landing
|
|
4
|
+
// and opening do is the host's
|
|
5
|
+
export type WalkRow = { key: string; depth: number; dir: boolean }
|
|
6
|
+
|
|
7
|
+
export type WalkHost<R extends WalkRow> = {
|
|
8
|
+
readonly rows: readonly R[]
|
|
9
|
+
/** the row under the keyboard cursor */
|
|
10
|
+
cursor: string | null
|
|
11
|
+
/** where the arrows start with no cursor: the row of the page shown, -1 for none */
|
|
12
|
+
home(rows: readonly R[]): number
|
|
13
|
+
/** a row the arrows step over */
|
|
14
|
+
inert(row: R): boolean
|
|
15
|
+
/** an arrow landed on it */
|
|
16
|
+
land(row: R): void
|
|
17
|
+
/** Enter or space on it */
|
|
18
|
+
activate(row: R): void
|
|
19
|
+
isOpen(key: string): boolean
|
|
20
|
+
toggle(key: string): void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function from<R extends WalkRow>(h: WalkHost<R>): number {
|
|
24
|
+
const rows = h.rows
|
|
25
|
+
const i = rows.findIndex((r) => r.key === h.cursor)
|
|
26
|
+
return i !== -1 ? i : h.home(rows)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function move<R extends WalkRow>(h: WalkHost<R>, d: number): void {
|
|
30
|
+
const rows = h.rows
|
|
31
|
+
if (rows.length === 0) return
|
|
32
|
+
const i = from(h)
|
|
33
|
+
let next = i === -1 ? (d > 0 ? 0 : rows.length - 1) : i + d
|
|
34
|
+
while (next >= 0 && next < rows.length && h.inert(rows[next]!)) next += d
|
|
35
|
+
if (next < 0 || next >= rows.length || next === i) return
|
|
36
|
+
h.land(rows[next]!)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const cur = <R extends WalkRow>(h: WalkHost<R>): R | null => h.rows.find((r) => r.key === h.cursor) ?? null
|
|
40
|
+
|
|
41
|
+
function right<R extends WalkRow>(h: WalkHost<R>): void {
|
|
42
|
+
const r = cur(h)
|
|
43
|
+
if (r != null && r.dir && !h.isOpen(r.key)) h.toggle(r.key)
|
|
44
|
+
else move(h, 1)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function left<R extends WalkRow>(h: WalkHost<R>): void {
|
|
48
|
+
const r = cur(h)
|
|
49
|
+
if (r == null) return move(h, -1)
|
|
50
|
+
if (r.dir && h.isOpen(r.key)) return h.toggle(r.key)
|
|
51
|
+
const rows = h.rows
|
|
52
|
+
const i = rows.findIndex((x) => x.key === r.key)
|
|
53
|
+
for (let n = i - 1; n >= 0; n--) if (rows[n]!.depth < r.depth) return h.land(rows[n]!)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** one key on the list; true = it was the list's, so the page must not also scroll */
|
|
57
|
+
export function walkKey<R extends WalkRow>(h: WalkHost<R>, k: string): boolean {
|
|
58
|
+
if (k === 'ArrowDown') move(h, 1)
|
|
59
|
+
else if (k === 'ArrowUp') move(h, -1)
|
|
60
|
+
else if (k === 'ArrowRight') right(h)
|
|
61
|
+
else if (k === 'ArrowLeft') left(h)
|
|
62
|
+
else if (k === 'Enter' || k === ' ') {
|
|
63
|
+
const r = cur(h)
|
|
64
|
+
if (r != null) h.activate(r)
|
|
65
|
+
} else return false
|
|
66
|
+
return true
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** a walk with the arrows is one history entry: its first step pushes, every next one rewrites it, so back returns to
|
|
70
|
+
* where the walk started. A held arrow opens ~30 pages a second, and the browser throws past 100 pushState calls per
|
|
71
|
+
* 10 seconds */
|
|
72
|
+
export class WalkEntry {
|
|
73
|
+
private walking = false
|
|
74
|
+
private walked = false
|
|
75
|
+
run(open: () => void): void {
|
|
76
|
+
this.walking = true
|
|
77
|
+
try {
|
|
78
|
+
open()
|
|
79
|
+
} finally {
|
|
80
|
+
this.walking = false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** the history verb of a new address, asked once per address written */
|
|
84
|
+
how(): 'push' | 'replace' {
|
|
85
|
+
const h = this.walking && this.walked ? 'replace' : 'push'
|
|
86
|
+
this.walked = this.walking
|
|
87
|
+
return h
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -44,6 +44,10 @@ function loadKept(): Kept | null {
|
|
|
44
44
|
export const webDownText = (why: string): string =>
|
|
45
45
|
`the shipkit web does not answer on ${globalThis.location?.origin ?? 'this page\'s origin'} (${why}). \`shipkit pm\` runs it; this page comes back by itself once it answers`
|
|
46
46
|
|
|
47
|
+
/** the daemon restarting, as the machine card says it: the page keeps working on the web's copies */
|
|
48
|
+
export const restartingText = (at: number): string =>
|
|
49
|
+
`the daemon restarts: the page shows the last answers it gave${Number.isFinite(at) && at > 0 ? `, from ${new Date(at).toLocaleTimeString()}` : ''}, and comes back by itself`
|
|
50
|
+
|
|
47
51
|
export type MachineOpts = { reload?: () => void; timeoutMs?: number }
|
|
48
52
|
|
|
49
53
|
export class MachineSt {
|
|
@@ -62,6 +66,8 @@ export class MachineSt {
|
|
|
62
66
|
* shipkit app window */
|
|
63
67
|
/** why the daemon did not answer the last poll, or '' while it does */
|
|
64
68
|
down = ''
|
|
69
|
+
/** the daemon restarts: the web answered the last answers it kept (serve-web.ts LastGood), '' while it answers */
|
|
70
|
+
restarting = ''
|
|
65
71
|
/** which one did not answer: the web itself, or the daemon behind it */
|
|
66
72
|
downWho: 'web' | 'daemon' = 'daemon'
|
|
67
73
|
/** the daemon answered once since the load: until then data, pm and
|
|
@@ -191,6 +197,12 @@ export class MachineSt {
|
|
|
191
197
|
const r = await reach('/api/home.json', { signal: AbortSignal.timeout(this.o.timeoutMs ?? MACHINE_TIMEOUT_MS) })
|
|
192
198
|
if (!r.ok) throw new Error(`/api/home.json answered ${r.status}: ${await r.text()}`)
|
|
193
199
|
const j = (await r.json()) as HomeAnswer
|
|
200
|
+
const stale = r.headers.get('x-shipkit-daemon') === 'restarting'
|
|
201
|
+
runInAction(() => {
|
|
202
|
+
this.restarting = stale ? restartingText(Number(r.headers.get('x-shipkit-daemon-at'))) : ''
|
|
203
|
+
if (stale) this.down = ''
|
|
204
|
+
})
|
|
205
|
+
if (stale) return
|
|
194
206
|
const back = this.wasDown
|
|
195
207
|
const cleared = this.pollError
|
|
196
208
|
this.wasDown = false
|
|
@@ -10,6 +10,7 @@ import { AutoText } from './auto-text.tsx'
|
|
|
10
10
|
import { isAud, type MediaSvc } from './media-svc.ts'
|
|
11
11
|
import { GeometryLayer, Rectbar, measureBox, type Box } from './geometry-view.tsx'
|
|
12
12
|
import type { CatRow, CustomPanelRef } from './hub-types.ts'
|
|
13
|
+
import { Caret } from './icons.tsx'
|
|
13
14
|
|
|
14
15
|
const TEX = 1024
|
|
15
16
|
const MIX_UNIT = 24
|
|
@@ -26,7 +27,7 @@ export const MediaTopbar = observer(({ app }: { app: RepoSt }) => {
|
|
|
26
27
|
folded (default) = one ellipsized line, click to expand */}
|
|
27
28
|
<div className="promptrow">
|
|
28
29
|
<button className="fold" title={m.promptOpen ? 'fold the prompt' : 'expand the prompt'}
|
|
29
|
-
onClick={() => m.togglePrompt()}
|
|
30
|
+
onClick={() => m.togglePrompt()}><Caret open={m.promptOpen} /></button>
|
|
30
31
|
{m.promptOpen
|
|
31
32
|
// it grows on every prompt change, a selection's included; the css max-height caps it near 14 lines
|
|
32
33
|
? <AutoText className="prompt" value={m.prompt} placeholder="select an asset ←" onText={(t) => m.setPrompt(t)} />
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// the hub side of a repo page's frame (wiki build/shipkit/project-pages.md, The frame contract): every kept frame of
|
|
2
|
+
// this repo, the shown one displayed, the others hidden but alive (frames-st.ts). A frame loads through the hub's
|
|
3
|
+
// proxy, on this origin, and speaks `{ shipkit: <verb> }` messages, checked by source and origin. Its process down,
|
|
4
|
+
// the pane shows the start button, never a blank frame
|
|
5
|
+
import { reaction } from 'mobx'
|
|
6
|
+
import { observer } from 'mobx-react-lite'
|
|
7
|
+
import { useEffect, useRef, useState } from 'react'
|
|
8
|
+
import type { RepoSt } from './repo-st.ts'
|
|
9
|
+
|
|
10
|
+
type Msg = { shipkit?: unknown; keys?: unknown; title?: unknown; badge?: unknown; hash?: unknown; key?: unknown; code?: unknown; altKey?: unknown; shiftKey?: unknown; metaKey?: unknown; ctrlKey?: unknown }
|
|
11
|
+
|
|
12
|
+
/** the keys a frame passes up as typed on the hub: ⌥ letters, ⌥⇧ letters, the home's ⌘ keys */
|
|
13
|
+
function replayKey(m: Msg): void {
|
|
14
|
+
if (typeof m.key !== 'string' || typeof m.code !== 'string') return
|
|
15
|
+
document.body.dispatchEvent(new KeyboardEvent('keydown', { key: m.key, code: m.code, altKey: m.altKey === true, shiftKey: m.shiftKey === true, metaKey: m.metaKey === true, ctrlKey: m.ctrlKey === true, bubbles: true, cancelable: true }))
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** the page's process, as pm reports it: null when none is declared or pm does not say */
|
|
19
|
+
const processOf = (app: RepoSt, id: string) => {
|
|
20
|
+
const p = app.pages.find(id)
|
|
21
|
+
return p?.process == null ? null : (app.globalProcesses.find((r) => r.id === p.process) ?? null)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const DownCard = observer(({ app, id, text }: { app: RepoSt; id: string; text: string | null }) => {
|
|
25
|
+
const p = app.pages.find(id)
|
|
26
|
+
const proc = processOf(app, id)
|
|
27
|
+
const m = app.home.machine
|
|
28
|
+
const starting = proc?.dot === 'starting'
|
|
29
|
+
return (
|
|
30
|
+
<div className="stagewrap">
|
|
31
|
+
<div className="colcard checkcard">
|
|
32
|
+
<div className="chead"><span className="tid">page</span><h3 className="ctitle">{app.pages.title(id)}</h3></div>
|
|
33
|
+
<div className="usays">{text ?? (proc == null ? `the page does not answer on ${p?.url ?? id}` : `${proc.label} is ${proc.dot}: it serves this page`)}</div>
|
|
34
|
+
{proc != null && m != null ? (
|
|
35
|
+
<button disabled={starting} onClick={() => void m.processAct(proc.id, 'start')}>{starting ? `starting ${proc.label}…` : `start ${proc.label}`}</button>
|
|
36
|
+
) : null}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const PageFrame = observer(({ app, id, on }: { app: RepoSt; id: string; on: boolean }) => {
|
|
43
|
+
const ref = useRef<HTMLIFrameElement>(null)
|
|
44
|
+
/** the keys the frame holds now: what it posted, or what the hub last sent it */
|
|
45
|
+
const held = useRef<string>(app.sel?.t === 'page' && app.sel.id === id ? (app.sel.q ?? '') : (app.pages.keys.get(id) ?? ''))
|
|
46
|
+
const onNow = useRef(on)
|
|
47
|
+
onNow.current = on
|
|
48
|
+
const [downText, setDownText] = useState<string | null>(null)
|
|
49
|
+
const [epoch, setEpoch] = useState(0)
|
|
50
|
+
const proc = processOf(app, id)
|
|
51
|
+
const down = proc != null && proc.dot !== 'up' && proc.dot !== 'unknown'
|
|
52
|
+
const missing = app.pages.loaded && app.pages.find(id) == null
|
|
53
|
+
const mounted = !down && !missing && downText == null
|
|
54
|
+
// the process came back: a frame that showed the down text loads again
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!down && downText != null && proc?.dot === 'up') {
|
|
57
|
+
setDownText(null)
|
|
58
|
+
setEpoch((n) => n + 1)
|
|
59
|
+
}
|
|
60
|
+
}, [down, downText, proc?.dot])
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!mounted) return
|
|
63
|
+
const post = (m: Record<string, unknown>): void => ref.current?.contentWindow?.postMessage({ ...m }, location.origin)
|
|
64
|
+
/** the identity the repo speaks as (its row's `speaksAs`, the default already folded in), null with none */
|
|
65
|
+
const identity = (): string | null => app.home.projects.list.find((p) => p.name === app.key)?.speaksAs ?? null
|
|
66
|
+
const hello = (): void => post({ shipkit: 'hello', keys: held.current, theme: app.home.theme.resolved, identity: identity(), on: onNow.current })
|
|
67
|
+
const onMessage = (e: MessageEvent): void => {
|
|
68
|
+
if (e.source !== ref.current?.contentWindow || e.origin !== location.origin) return
|
|
69
|
+
const m = (e.data ?? {}) as Msg
|
|
70
|
+
switch (m.shipkit) {
|
|
71
|
+
case 'ready': return hello()
|
|
72
|
+
case 'keys':
|
|
73
|
+
if (typeof m.keys !== 'string') return
|
|
74
|
+
held.current = m.keys
|
|
75
|
+
return app.pageMoved(id, m.keys)
|
|
76
|
+
case 'title': return app.pages.post(id, m)
|
|
77
|
+
case 'open':
|
|
78
|
+
if (typeof m.hash === 'string' && m.hash.startsWith('#')) location.hash = m.hash
|
|
79
|
+
return
|
|
80
|
+
case 'key': return replayKey(m)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
window.addEventListener('message', onMessage)
|
|
84
|
+
const theme = reaction(() => app.home.theme.resolved, (t) => post({ shipkit: 'theme', theme: t }))
|
|
85
|
+
const speaker = reaction(identity, (i) => post({ shipkit: 'identity', identity: i }))
|
|
86
|
+
// the address moved from outside (back, a pasted link): the frame takes it
|
|
87
|
+
const keys = reaction(
|
|
88
|
+
() => (app.sel?.t === 'page' && app.sel.id === id ? (app.sel.q ?? '') : null),
|
|
89
|
+
(q) => {
|
|
90
|
+
if (q == null || q === held.current) return
|
|
91
|
+
held.current = q
|
|
92
|
+
post({ shipkit: 'keys', keys: q })
|
|
93
|
+
},
|
|
94
|
+
)
|
|
95
|
+
return () => {
|
|
96
|
+
window.removeEventListener('message', onMessage)
|
|
97
|
+
theme()
|
|
98
|
+
speaker()
|
|
99
|
+
keys()
|
|
100
|
+
}
|
|
101
|
+
}, [app, id, mounted, epoch])
|
|
102
|
+
// shown or hidden: the page decides what stops; shown, it takes the keyboard
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
ref.current?.contentWindow?.postMessage({ shipkit: 'focus', on }, location.origin)
|
|
105
|
+
if (on) ref.current?.contentWindow?.focus()
|
|
106
|
+
}, [on])
|
|
107
|
+
/** the proxy's answer when the process does not: its text, in the down card */
|
|
108
|
+
const onLoad = (): void => {
|
|
109
|
+
try {
|
|
110
|
+
const d = ref.current?.contentDocument
|
|
111
|
+
if (d?.contentType === 'text/plain') setDownText(d.body.innerText.trim())
|
|
112
|
+
else if (on) ref.current?.contentWindow?.focus()
|
|
113
|
+
} catch {
|
|
114
|
+
// another origin cannot be read: never the case behind the proxy
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return (
|
|
118
|
+
<div className="pframe" hidden={!on}>
|
|
119
|
+
{mounted ? <iframe key={epoch} ref={ref} src={app.pages.src(id)} title={app.pages.title(id)} onLoad={onLoad} /> : <DownCard app={app} id={id} text={missing ? (app.pages.problem ?? `this repo declares no page ${id}: a page({...}) unit adds one`) : downText} />}
|
|
120
|
+
</div>
|
|
121
|
+
)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
/** every kept frame of this repo: under the main pane, shown when the page is */
|
|
125
|
+
export const PageFrames = observer(({ app }: { app: RepoSt }) => {
|
|
126
|
+
const ids = app.home.frames.of(app.key)
|
|
127
|
+
const shown = app.sel?.t === 'page' ? app.sel.id : null
|
|
128
|
+
if (ids.length === 0) return null
|
|
129
|
+
return (
|
|
130
|
+
<div className="pframes" hidden={shown == null}>
|
|
131
|
+
{ids.map((id) => <PageFrame key={id} app={app} id={id} on={id === shown && app.isShown} />)}
|
|
132
|
+
</div>
|
|
133
|
+
)
|
|
134
|
+
})
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// a repo's own pages (wiki build/shipkit/project-pages.md), as the hub page holds them: the declared list, each
|
|
2
|
+
// page's badge (its declared route read through the proxy, else what its frame posted) and the words its frame
|
|
3
|
+
// gave. The frames themselves are the home's (FrameCache, pages-frames.tsx): they outlive a repo switch
|
|
4
|
+
import { makeAutoObservable, runInAction } from 'mobx'
|
|
5
|
+
import type { PageRow } from '../../pages/unit.ts'
|
|
6
|
+
import type { RepoSt } from './repo-st.ts'
|
|
7
|
+
|
|
8
|
+
export type PageBadge = { count: number; tone: 'red' | 'warn' | null; title?: string }
|
|
9
|
+
|
|
10
|
+
/** how often the declared badges are read again while the repo shows */
|
|
11
|
+
const BADGE_EVERY_MS = 30_000
|
|
12
|
+
const BADGE_WAIT_MS = 3_000
|
|
13
|
+
|
|
14
|
+
const badgeOf = (v: unknown): PageBadge | null => {
|
|
15
|
+
const b = v as { count?: unknown; tone?: unknown; title?: unknown } | null
|
|
16
|
+
if (b == null || typeof b.count !== 'number' || !Number.isFinite(b.count)) return null
|
|
17
|
+
const tone = b.tone === 'red' || b.tone === 'warn' ? b.tone : null
|
|
18
|
+
return { count: b.count, tone, ...(typeof b.title === 'string' ? { title: b.title } : {}) }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class PagesSvc {
|
|
22
|
+
list: PageRow[] = []
|
|
23
|
+
problem: string | null = null
|
|
24
|
+
loaded = false
|
|
25
|
+
/** by page: the badge its declared route answers */
|
|
26
|
+
declared = new Map<string, PageBadge>()
|
|
27
|
+
/** by page: the title and badge its frame posted, over the declared ones */
|
|
28
|
+
posted = new Map<string, { title?: string; badge?: PageBadge | null }>()
|
|
29
|
+
/** by page: the keys its frame posted last, so a row click opens it as it was left */
|
|
30
|
+
keys = new Map<string, string>()
|
|
31
|
+
private timer: ReturnType<typeof setInterval> | null = null
|
|
32
|
+
|
|
33
|
+
constructor(private st: RepoSt) {
|
|
34
|
+
makeAutoObservable<this, 'st' | 'timer'>(this, { st: false, timer: false })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
find(id: string): PageRow | null {
|
|
38
|
+
return this.list.find((p) => p.id === id) ?? null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** the page ⌥⇧ + this letter opens */
|
|
42
|
+
byKey(letter: string): PageRow | null {
|
|
43
|
+
return this.list.find((p) => p.key === letter) ?? null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
badge(id: string): PageBadge | null {
|
|
47
|
+
const live = this.posted.get(id)
|
|
48
|
+
if (live?.badge !== undefined) return live.badge
|
|
49
|
+
return this.declared.get(id) ?? null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
title(id: string): string {
|
|
53
|
+
return this.posted.get(id)?.title ?? this.find(id)?.title ?? id
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** where the page's frame loads: through the hub's proxy, on its origin */
|
|
57
|
+
src(id: string): string {
|
|
58
|
+
return this.st.url(`/page/${id}/`)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
post(id: string, m: { title?: unknown; badge?: unknown }): void {
|
|
62
|
+
const was = this.posted.get(id) ?? {}
|
|
63
|
+
const next = { ...was }
|
|
64
|
+
if (typeof m.title === 'string') next.title = m.title
|
|
65
|
+
if (m.badge !== undefined) next.badge = m.badge === null ? null : badgeOf(m.badge)
|
|
66
|
+
this.posted.set(id, next)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async load(): Promise<void> {
|
|
70
|
+
try {
|
|
71
|
+
const r = await fetch(this.st.url('/api/pages.json'))
|
|
72
|
+
if (!r.ok) throw new Error(`${r.status} ${await r.text()}`)
|
|
73
|
+
const j = (await r.json()) as { pages: PageRow[]; problem: string | null }
|
|
74
|
+
runInAction(() => {
|
|
75
|
+
this.list = j.pages
|
|
76
|
+
this.problem = j.problem
|
|
77
|
+
this.loaded = true
|
|
78
|
+
})
|
|
79
|
+
} catch (e) {
|
|
80
|
+
runInAction(() => {
|
|
81
|
+
this.problem = `the pages list did not load: ${(e as Error).message}`
|
|
82
|
+
this.loaded = true
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
await this.readBadges()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private async readBadges(): Promise<void> {
|
|
89
|
+
await Promise.all(this.list.map(async (p) => {
|
|
90
|
+
if (p.badge == null) return
|
|
91
|
+
try {
|
|
92
|
+
const r = await fetch(`${this.src(p.id)}${p.badge}`, { signal: AbortSignal.timeout(BADGE_WAIT_MS) })
|
|
93
|
+
const b = r.ok ? badgeOf(await r.json()) : null
|
|
94
|
+
runInAction(() => { if (b == null) this.declared.delete(p.id); else this.declared.set(p.id, b) })
|
|
95
|
+
} catch {
|
|
96
|
+
// the page's process is down: its row says so through the process, never a stale number
|
|
97
|
+
runInAction(() => this.declared.delete(p.id))
|
|
98
|
+
}
|
|
99
|
+
}))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
start(): void {
|
|
103
|
+
void this.load()
|
|
104
|
+
if (this.timer == null) this.timer = setInterval(() => void this.load(), BADGE_EVERY_MS)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
stop(): void {
|
|
108
|
+
if (this.timer != null) clearInterval(this.timer)
|
|
109
|
+
this.timer = null
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// the one picker of the page (cmd+j, keys.ts), a node of the root: the
|
|
2
|
-
// home's places (inbox, home, activity, planned, insights, archived) first,
|
|
2
|
+
// home's places (inbox, home, activity, planned, insights, archived) first, the identities and each of their
|
|
3
|
+
// accounts (their view on the home), then the shown repo's own jump
|
|
3
4
|
// targets, then every other house repo as a place to go. Another repo's
|
|
4
5
|
// resources are never listed: a jump to a repo selects it in place, and its
|
|
5
6
|
// own targets are one more cmd+j away.
|
|
@@ -33,6 +34,18 @@ export class PaletteSt {
|
|
|
33
34
|
]
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
/** every identity, then each of its accounts: their view on the home. The accounts come once the identities answer */
|
|
38
|
+
get identities(): Jump[] {
|
|
39
|
+
const st = this.st
|
|
40
|
+
if (st.machine == null) return []
|
|
41
|
+
const full = st.identities.data?.identities
|
|
42
|
+
const rail = full ?? st.projects.identities.map((i) => ({ ...i, accounts: [] }))
|
|
43
|
+
return rail.flatMap((i) => [
|
|
44
|
+
{ id: `identity:${i.id}`, label: i.name, section: 'identity', face: { identity: i.id }, run: () => st.openIdentity({ id: i.id, part: null, place: null }) },
|
|
45
|
+
...i.accounts.map((a) => ({ id: `account:${i.id}/${a.id}`, label: `${i.name} · ${a.name}`, section: 'account', face: { identity: i.id, account: a.id }, run: () => st.openIdentity({ id: i.id, part: a.id, place: null }) })),
|
|
46
|
+
])
|
|
47
|
+
}
|
|
48
|
+
|
|
36
49
|
/** every house repo but the one on screen, as a place to go: on a
|
|
37
50
|
* global page that is every repo */
|
|
38
51
|
get others(): Jump[] {
|
|
@@ -43,7 +56,7 @@ export class PaletteSt {
|
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
get jumps(): Jump[] {
|
|
46
|
-
return [...this.places, ...(this.st.shown?.jumps ?? []), ...this.others]
|
|
59
|
+
return [...this.places, ...this.identities, ...(this.st.shown?.jumps ?? []), ...this.others]
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
/** ranked: prefix matches first, then substring. With no query, home,
|
|
@@ -54,8 +67,9 @@ export class PaletteSt {
|
|
|
54
67
|
if (q === '') {
|
|
55
68
|
const own = this.st.shown?.jumps ?? []
|
|
56
69
|
const places = this.places
|
|
70
|
+
const ids = this.identities.filter((j) => j.section === 'identity')
|
|
57
71
|
const others = this.others
|
|
58
|
-
return [...places, ...own.slice(0, Math.max(4, PAL_ROWS - places.length - others.length)), ...others]
|
|
72
|
+
return [...places, ...ids, ...own.slice(0, Math.max(4, PAL_ROWS - places.length - ids.length - others.length)), ...others]
|
|
59
73
|
}
|
|
60
74
|
const pre: Jump[] = []
|
|
61
75
|
const sub: Jump[] = []
|
|
@@ -69,6 +83,7 @@ export class PaletteSt {
|
|
|
69
83
|
|
|
70
84
|
toggle(): void {
|
|
71
85
|
this.open = !this.open
|
|
86
|
+
if (this.open) this.st.identities.ensure()
|
|
72
87
|
this.query = ''
|
|
73
88
|
this.idx = 0
|
|
74
89
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
// the one picker, cmd+j (palette-st.ts): home, activity, planned and
|
|
2
|
-
// archived, the shown repo's targets, then every other repo. A place wears
|
|
3
|
-
// its button's icon, a repo its own icon, as the project list shows them
|
|
2
|
+
// archived, the identities and their accounts, the shown repo's targets, then every other repo. A place wears
|
|
3
|
+
// its button's icon, a repo its own icon, as the project list shows them, an identity its avatar, an account its
|
|
4
|
+
// platform's logo.
|
|
4
5
|
import { observer } from 'mobx-react-lite'
|
|
5
6
|
import type { HomeSt } from './home-st.ts'
|
|
6
7
|
import { Icon, ICON } from './icons.tsx'
|
|
7
8
|
import { Face } from './project-list.tsx'
|
|
9
|
+
import { Logo } from './social/kit.tsx'
|
|
8
10
|
import type { JumpFace } from './repo-st.ts'
|
|
9
11
|
|
|
10
12
|
/** the icon a picker entry wears; an empty slot keeps the labels aligned */
|
|
11
13
|
const PalFace = observer(({ app, face }: { app: HomeSt; face: JumpFace | undefined }) => {
|
|
12
14
|
if (face != null && 'place' in face) return <span className="pface"><Icon d={ICON[face.place]} /></span>
|
|
15
|
+
if (face != null && 'identity' in face) {
|
|
16
|
+
if (face.account != null) return <span className="pface"><Logo id={face.account} name={face.account} size={16} /></span>
|
|
17
|
+
const i = app.projects.identities.find((x) => x.id === face.identity)
|
|
18
|
+
return <span className="pface">{i?.mark != null ? <img src={i.mark} alt="" width={16} height={16} style={{ borderRadius: '50%' }} /> : <span className="pgi h1">{(i?.name ?? face.identity).charAt(0).toUpperCase()}</span>}</span>
|
|
19
|
+
}
|
|
13
20
|
const p = face == null ? null : app.projects.list.find((x) => x.name === face.repo) ?? null
|
|
14
21
|
return <span className="pface">{p == null ? null : <Face p={p} px={16} />}</span>
|
|
15
22
|
})
|
|
@@ -15,6 +15,7 @@ import type { HomeSt } from './home-st.ts'
|
|
|
15
15
|
import { checkAddress, plainClick, repoPage } from './home-st.ts'
|
|
16
16
|
import { LAST_TONE, markOf, reasonWords, whenWords, type Section } from './planned-st.ts'
|
|
17
17
|
import { ageWords, stampWords } from './time-ago.tsx'
|
|
18
|
+
import { Caret } from './icons.tsx'
|
|
18
19
|
|
|
19
20
|
/** a link that works as one (a new tab on cmd+click) and moves in place on a plain click */
|
|
20
21
|
const InPlace = ({ href, className, go, children }: { href: string; className: string; go: () => void; children: ReactNode }) => (
|
|
@@ -105,7 +106,7 @@ export const PlannedView = observer(({ app }: { app: HomeSt }) => {
|
|
|
105
106
|
</div>
|
|
106
107
|
{st.waitingLine !== '' ? (
|
|
107
108
|
<div className="plwait">
|
|
108
|
-
<button className="plwaitline" aria-expanded={st.waitingOpen} onClick={() => st.toggleWaiting()}
|
|
109
|
+
<button className="plwaitline" aria-expanded={st.waitingOpen} onClick={() => st.toggleWaiting()}><Caret open={st.waitingOpen} /> {st.waitingLine}</button>
|
|
109
110
|
{st.waitingOpen ? <div className="pllist">{st.waiting.map((r) => <Row key={`${r.repo}\0${r.check}`} app={app} r={r} now={now} />)}</div> : null}
|
|
110
111
|
</div>
|
|
111
112
|
) : null}
|