rvlib-shipkit 2.19.0 โ†’ 2.20.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/src/annex/annex.ts +227 -0
  4. package/src/annex/offload.ts +279 -0
  5. package/src/checks/SK040-release-words.check.ts +43 -0
  6. package/src/checks/SK041-annex-links.check.ts +28 -0
  7. package/src/checks/SK042-post-kinds.check.ts +73 -0
  8. package/src/cli/cmd_Annex.ts +179 -0
  9. package/src/cli/cmd_Commands.ts +4 -1
  10. package/src/cli/cmd_Home.ts +3 -2
  11. package/src/cli/cmd_Messages.ts +155 -0
  12. package/src/cli/cmd_Releases.ts +48 -0
  13. package/src/cli/cmd_Review.ts +161 -6
  14. package/src/cli/cmd_Shot.ts +4 -4
  15. package/src/cli/cmd_Social.ts +143 -6
  16. package/src/cli/family-pages.ts +2 -0
  17. package/src/cli/kit/index.ts +1 -1
  18. package/src/cli/kit/verb.ts +11 -3
  19. package/src/cli/registry.ts +6 -1
  20. package/src/collections/collection-types.ts +8 -1
  21. package/src/collections/providers.ts +4 -1
  22. package/src/commands/model.ts +36 -0
  23. package/src/commands/registry.ts +49 -0
  24. package/src/commands/routes.ts +59 -0
  25. package/src/commands/runner.ts +35 -0
  26. package/src/commands/runs.ts +112 -0
  27. package/src/core/app-icon.ts +4 -3
  28. package/src/core/icon-type.ts +8 -0
  29. package/src/core/jobs.ts +4 -3
  30. package/src/core/layout.ts +5 -2
  31. package/src/core/squircle.ts +95 -0
  32. package/src/home/daemon-jobs.ts +26 -2
  33. package/src/home/global-units.ts +3 -0
  34. package/src/home/gui-app/ShipkitGui.swift +302 -5
  35. package/src/home/gui-app.ts +63 -33
  36. package/src/home/hmr-keep.ts +134 -0
  37. package/src/home/home-start.ts +2 -2
  38. package/src/home/lib-watch.ts +21 -11
  39. package/src/home/pm.ts +1 -1
  40. package/src/home/process-apps.ts +181 -0
  41. package/src/home/resources.ts +3 -3
  42. package/src/home/run-web.ts +7 -4
  43. package/src/home/serve-web.ts +64 -14
  44. package/src/identities/collection.ts +49 -0
  45. package/src/identities/identities.ts +110 -8
  46. package/src/identities/machine.ts +4 -3
  47. package/src/identities/rating.ts +33 -0
  48. package/src/identities/shown.ts +170 -0
  49. package/src/identities/steps.ts +5 -0
  50. package/src/media-store/purge.ts +15 -1
  51. package/src/media-store/remote.ts +22 -6
  52. package/src/messages/brief.ts +117 -0
  53. package/src/messages/collection.ts +40 -0
  54. package/src/messages/model.ts +171 -0
  55. package/src/messages/routes.ts +15 -0
  56. package/src/messages/score.ts +180 -0
  57. package/src/messages/tabs.ts +13 -0
  58. package/src/release/notes.ts +130 -0
  59. package/src/release/run-bump.ts +41 -18
  60. package/src/release/run-release.ts +22 -4
  61. package/src/release/run-releases.ts +17 -15
  62. package/src/release/unit-resolve.ts +9 -0
  63. package/src/releases/add.ts +66 -0
  64. package/src/releases/collection.ts +36 -0
  65. package/src/releases/from-card.ts +66 -0
  66. package/src/releases/model.ts +267 -0
  67. package/src/releases/pictures.ts +89 -0
  68. package/src/releases/routes.ts +36 -0
  69. package/src/releases/store.ts +71 -0
  70. package/src/repo-config.ts +5 -0
  71. package/src/review/cells.ts +0 -11
  72. package/src/review/format.ts +10 -6
  73. package/src/review/model.ts +92 -3
  74. package/src/review/notes.ts +2 -48
  75. package/src/review/routes.ts +28 -10
  76. package/src/review/stage-card.ts +197 -0
  77. package/src/review/stage-routes.ts +123 -0
  78. package/src/review/store.ts +36 -0
  79. package/src/review/trailer-card.ts +99 -0
  80. package/src/review/trailer-desk.ts +57 -4
  81. package/src/review/trailer-model.ts +41 -7
  82. package/src/review/trailer-notes.ts +45 -0
  83. package/src/review/trailer-routes.ts +22 -13
  84. package/src/serve/hub-app/app-bridge.ts +71 -0
  85. package/src/serve/hub-app/commands/commands-page.tsx +122 -0
  86. package/src/serve/hub-app/commands/commands-st.ts +177 -0
  87. package/src/serve/hub-app/commands.css +24 -0
  88. package/src/serve/hub-app/hash-route.ts +40 -1
  89. package/src/serve/hub-app/home-st.ts +11 -2
  90. package/src/serve/hub-app/home.html +3 -0
  91. package/src/serve/hub-app/hub-app.tsx +6 -0
  92. package/src/serve/hub-app/icons.tsx +5 -0
  93. package/src/serve/hub-app/identities-view.tsx +4 -1
  94. package/src/serve/hub-app/identities.css +1 -0
  95. package/src/serve/hub-app/index.html +3 -0
  96. package/src/serve/hub-app/keys.ts +2 -2
  97. package/src/serve/hub-app/machine-st.ts +41 -10
  98. package/src/serve/hub-app/messages/messages-page.tsx +354 -0
  99. package/src/serve/hub-app/messages/messages-st.ts +74 -0
  100. package/src/serve/hub-app/messages.css +35 -0
  101. package/src/serve/hub-app/releases/releases-page.tsx +94 -0
  102. package/src/serve/hub-app/releases/releases-st.ts +69 -0
  103. package/src/serve/hub-app/releases.css +25 -0
  104. package/src/serve/hub-app/repo-sections.ts +15 -1
  105. package/src/serve/hub-app/repo-st.ts +56 -5
  106. package/src/serve/hub-app/review/clip-st.ts +31 -3
  107. package/src/serve/hub-app/review/note-place.ts +31 -0
  108. package/src/serve/hub-app/review/review-cells.tsx +27 -3
  109. package/src/serve/hub-app/review/review-st.ts +77 -2
  110. package/src/serve/hub-app/review/review-thread.tsx +9 -31
  111. package/src/serve/hub-app/review/review-views.tsx +164 -58
  112. package/src/serve/hub-app/review/thread-st.ts +108 -41
  113. package/src/serve/hub-app/review/trailer-card.tsx +187 -0
  114. package/src/serve/hub-app/review/trailer-page.tsx +62 -31
  115. package/src/serve/hub-app/review/trailer-st.ts +138 -26
  116. package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
  117. package/src/serve/hub-app/review.css +49 -6
  118. package/src/serve/hub-app/social/comms-page.tsx +55 -23
  119. package/src/serve/hub-app/social/identity-pictures.ts +46 -8
  120. package/src/serve/hub-app/social/kit.tsx +9 -6
  121. package/src/serve/hub-app/social/post-card.tsx +10 -2
  122. package/src/serve/hub-app/social/social-model.ts +37 -3
  123. package/src/serve/hub-app/social/social-page.tsx +179 -65
  124. package/src/serve/hub-app/social/social-st.ts +79 -26
  125. package/src/serve/hub-app/social/stage-popup.tsx +268 -0
  126. package/src/serve/hub-app/social/stage-st.ts +310 -0
  127. package/src/serve/hub-app/social/step-layout.ts +42 -0
  128. package/src/serve/hub-app/social.css +60 -1
  129. package/src/serve/hub-app/tree-build.ts +38 -1
  130. package/src/serve/hub-app/tree-svc.ts +10 -3
  131. package/src/serve/project-gutter-route.ts +4 -2
  132. package/src/serve/same-origin.ts +24 -1
  133. package/src/serve/serve-hub.ts +15 -1
  134. package/src/shipkit-files.ts +9 -7
  135. package/src/shot/shooter.ts +3 -3
  136. package/src/shot/shot-ask.ts +14 -3
  137. package/src/shot/shot.shipkit.ts +1 -1
  138. package/src/social/discord-layout.ts +48 -5
  139. package/src/social/fit.ts +84 -0
  140. package/src/social/identity-words.ts +74 -0
  141. package/src/social/kind-pages.ts +41 -0
  142. package/src/social/kinds.ts +92 -0
  143. package/src/social/load.ts +105 -9
  144. package/src/social/media-limit.ts +63 -2
  145. package/src/social/presence.ts +1 -1
  146. package/src/social/publish/bluesky.ts +58 -19
  147. package/src/social/publish/index.ts +31 -5
  148. package/src/social/reach.ts +49 -0
  149. package/src/social/release-stage.ts +173 -0
  150. package/src/social/routes.ts +42 -7
  151. package/src/social/stage.ts +227 -0
  152. package/src/social/strip.ts +85 -0
  153. package/src/social/text.ts +6 -2
  154. package/src/social/unit.ts +57 -1
  155. package/src/social/writes.ts +11 -0
  156. package/src/trailer/build.ts +15 -2
  157. package/src/trailer/grammar.ts +14 -4
  158. package/src/trailer/public-words.ts +41 -0
@@ -4,7 +4,7 @@
4
4
  // payouts, its profile or the place's rules. Its parts are the home's identity view too (identities-view.tsx). Green
5
5
  // is only ever a link he pasted
6
6
  import { observer } from 'mobx-react-lite'
7
- import { useEffect, type CSSProperties } from 'react'
7
+ import { useEffect, type CSSProperties, type ReactNode } from 'react'
8
8
  import { Panel, Separator } from 'react-resizable-panels'
9
9
  import { KeptCols } from '../kept-cols.tsx'
10
10
  import { plainClick } from '../home-st.ts'
@@ -13,9 +13,11 @@ import { PANEL, PhoneTop } from '../review/review-page.tsx'
13
13
  import { brandVar, CopyIcon, CopyRow, ErrorLine, Go, KeptFold, Lightbox, Logo, Md, MdInline, Toast } from './kit.tsx'
14
14
  import { PostCard } from './post-card.tsx'
15
15
  import { Problems } from './problems.tsx'
16
- import { bannerGroups, factsOf, hasNote, otherRating, pictureOf, ratingOf, rowPictures, usedBy } from './identity-pictures.ts'
16
+ import { stepRefs } from '../../../identities/steps.ts'
17
+ import { bannerGroups, factsOf, hasNote, otherRating, otherRows, pasteOf, pasteState, pictureOf, ratingOf, rowPictures, shownFile, staleBadge, staleWhy, uploadOf, usedBy, type Upload } from './identity-pictures.ts'
17
18
  import { AUTOMATION, fileName, LEGAL, linksText, ME, type DeskAccount, type DeskIdentity, type Picture, type Place, type Row } from './social-model.ts'
18
19
  import type { SocialSt } from './social-st.ts'
20
+ import { stepLayout, textKind, type RefKind } from './step-layout.ts'
19
21
 
20
22
  export const SocialPage = observer(({ app }: { app: RepoSt }) => {
21
23
  const so = app.social
@@ -288,6 +290,7 @@ export const IdentityPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity
288
290
  <Logo id={a.id} name={a.name} size={22} muted={a.live === ''} />
289
291
  <b className="so-rowname">{a.name}</b>
290
292
  <span className="so-rowvalue so-ellip">{a.handle}</span>
293
+ {staleBadge(a) == null ? null : <span className="so-badge solid t-warn">{staleBadge(a)}</span>}
291
294
  <span className={`so-badge ${a.live ? 't-ok solid' : 't-dim'}`}>{a.live ? 'online' : 'to create'}</span>
292
295
  {a.live ? <CopyIcon so={so} text={a.live} k={`${i.id}/link/${a.id}`} title="copy the link" /> : null}
293
296
  {a.live || a.profile ? (
@@ -357,13 +360,35 @@ const YOUTUBE_AREAS = [
357
360
  { w: 1546, label: 'phone', cls: ' phone' },
358
361
  ]
359
362
 
363
+ /** what one does with a picture, wherever it shows: ยซ copy ยป (not a clip), ยซ โฌ‡ ยป, ๐Ÿ“‚ the Finder (none on a phone) */
364
+ const PictureActions = observer(({ so, i, f }: { so: SocialSt; i: DeskIdentity; f: Picture }) => {
365
+ const { url, clip } = so.picture(i, f)
366
+ const key = `${i.id}/pic/${f.file}`
367
+ return (
368
+ <>
369
+ {!clip ? (
370
+ <button className="so-icon" onClick={() => void so.copyImage(url, key)} title="copy the image, to paste in the account's page">
371
+ {so.copiedKey === key ? 'โœ“' : 'โง‰'}
372
+ </button>
373
+ ) : null}
374
+ <a className="so-icon" href={url} download={fileName(f.file)} title="download">
375
+ โฌ‡
376
+ </a>
377
+ {!so.phone ? (
378
+ <button className="so-icon" onClick={() => void so.revealPicture(i.id, f.file)} title={`show ${fileName(f.file)} in the Finder`}>
379
+ ๐Ÿ“‚
380
+ </button>
381
+ ) : null}
382
+ </>
383
+ )
384
+ })
385
+
360
386
  /** one picture: the image (a clip plays muted), its name or `label` and size, ยซ copy ยป, ยซ โฌ‡ ยป, ๐Ÿ“‚ the Finder (the
361
387
  * desktop has one, a phone none) and a download per other format; under it the accounts whose row names it (`used`);
362
388
  * `width` a tile, else the width it is given */
363
- const PictureTile = observer(({ so, i, f, width, label, used }: { so: SocialSt; i: DeskIdentity; f: Picture; width?: number; label?: string; used?: readonly string[] }) => {
389
+ const PictureTile = observer(({ so, i, f, width, label, used, foot }: { so: SocialSt; i: DeskIdentity; f: Picture; width?: number; label?: string; used?: readonly string[]; foot?: ReactNode }) => {
364
390
  const { url, clip } = so.picture(i, f)
365
391
  const size = f.w !== null ? ` ยท ${f.w}ร—${f.h}` : ''
366
- const key = `${i.id}/pic/${f.file}`
367
392
  const ext = (file: string): string => file.replace(/^.*\./, '')
368
393
  return (
369
394
  <div className="so-card so-pic" style={width ? { width } : undefined}>
@@ -382,19 +407,7 @@ const PictureTile = observer(({ so, i, f, width, label, used }: { so: SocialSt;
382
407
  {label ?? fileName(f.file).replace(/^(avatar|banner)-(caid-)?/, '').replace(/\.\w+$/, '').replace(/-round$/, ' round')}
383
408
  {label == null && !width ? <span className="rv-dim so-light">{size}</span> : null}
384
409
  </b>
385
- {!clip ? (
386
- <button className="so-icon" onClick={() => void so.copyImage(url, key)} title="copy the image, to paste in the account's page">
387
- {so.copiedKey === key ? 'โœ“' : 'โง‰'}
388
- </button>
389
- ) : null}
390
- <a className="so-icon" href={url} download={fileName(f.file)} title="download">
391
- โฌ‡
392
- </a>
393
- {!so.phone ? (
394
- <button className="so-icon" onClick={() => void so.revealPicture(i.id, f.file)} title={`show ${fileName(f.file)} in the Finder`}>
395
- ๐Ÿ“‚
396
- </button>
397
- ) : null}
410
+ <PictureActions so={so} i={i} f={f} />
398
411
  </div>
399
412
  {f.also.length > 0 || (label != null && size !== '') ? (
400
413
  <div className="so-picrow so-picmore">
@@ -407,10 +420,83 @@ const PictureTile = observer(({ so, i, f, width, label, used }: { so: SocialSt;
407
420
  </div>
408
421
  ) : null}
409
422
  {used?.length ? <span className="rv-dim rv-small" title="the accounts whose row names it">โ†’ {used.join(', ')}</span> : null}
423
+ {foot}
410
424
  </div>
411
425
  )
412
426
  })
413
427
 
428
+ /** the row file a tile shows, by its shown file or one of its other formats */
429
+ const rowFileOf = (u: Upload, f: Picture): string | null => u.files.find((x) => x === f.file || f.also.includes(x)) ?? null
430
+
431
+ /** under a picture of a row: ยซ Done, uploaded ยป while the account does not show the row as it is now, ยซ on X ยป under
432
+ * the one it shows */
433
+ const ShownFoot = observer(({ so, a, u, f }: { so: SocialSt; a: DeskAccount; u: Upload; f: Picture }) => {
434
+ const file = rowFileOf(u, f)
435
+ if (file == null) return null
436
+ if (!u.stale) return shownFile(u) === file ? <span className="so-badge t-ok so-shownok" title={`recorded ${u.shown!.on}, sha ${u.shown!.sha}`}>โœ“ on {a.name}</span> : null
437
+ return (
438
+ <button className="so-btn primary so-uploaded" disabled={so.busy} onClick={() => void so.markShown(a, u.field, file)} title={`records that ${a.name} now shows ${fileName(file)}`}>
439
+ โœ“ Done, uploaded
440
+ </button>
441
+ )
442
+ })
443
+
444
+ /** after a text row he pastes: ยซ โœ“ pasted ยป when the account shows it as it is now, else ยซ Done, pasted ยป, with
445
+ * ยซ changed, paste again ยป once its value moved since he pasted it */
446
+ const PasteFoot = observer(({ so, a, field }: { so: SocialSt; a: DeskAccount; field: string }) => {
447
+ const u = pasteOf(a, field)
448
+ if (u == null) return null
449
+ const state = pasteState(u)
450
+ if (state === 'pasted')
451
+ return (
452
+ <span className="so-paste">
453
+ <span className="so-badge t-ok" title={`pasted on ${a.name} ${u.shown!.on}, sha ${u.shown!.sha}`}>โœ“ pasted</span>
454
+ </span>
455
+ )
456
+ return (
457
+ <span className="so-paste">
458
+ {state === 'changed' ? (
459
+ <span className="so-badge solid t-warn" title={staleWhy(a, u)}>
460
+ changed, paste again
461
+ </span>
462
+ ) : null}
463
+ <button className={`so-btn so-pastebtn${state === 'changed' ? ' primary' : ''}`} disabled={so.busy} onClick={() => void so.markPasted(a, field, u.shas[0]!)} title={`records that ${a.name} now shows this text as it is here`}>
464
+ โœ“ Done, pasted
465
+ </button>
466
+ </span>
467
+ )
468
+ })
469
+
470
+ /** a text row's tone on the page: warn once its value moved since he pasted it */
471
+ const pasteTone = (a: DeskAccount, field: string): string | undefined => (pasteOf(a, field)?.stale === true ? 'warn' : undefined)
472
+
473
+ /** one picture row of ยซ Upload here ยป: its stale headline, its tiles with ยซ Done, uploaded ยป or ยซ on X ยป, its note */
474
+ const UploadRow = observer(({ so, i, a, r }: { so: SocialSt; i: DeskIdentity; a: DeskAccount; r: Row }) => {
475
+ const u = uploadOf(a, r.field)
476
+ return (
477
+ <div className="so-row">
478
+ <span className="so-rowfield">{r.field}</span>
479
+ <div className="so-uppics">
480
+ {u?.stale ? <StaleLine a={a} u={u} /> : null}
481
+ <div className="so-tiles">
482
+ {rowPictures(i, r.files).map((f) => (
483
+ <PictureTile key={f.file} so={so} i={i} f={f} width={tileWidth(f)} label={factsOf(f.file, i.id).label} foot={u == null ? null : <ShownFoot so={so} a={a} u={u} f={f} />} />
484
+ ))}
485
+ </div>
486
+ {hasNote(r) ? <span className="rv-dim rv-small">{r.value}</span> : null}
487
+ </div>
488
+ </div>
489
+ )
490
+ })
491
+
492
+ /** a stale row's headline, impossible to miss: ยซ new: not on X yet ยป, and why */
493
+ const StaleLine = ({ a, u }: { a: DeskAccount; u: Upload }) => (
494
+ <div className="so-stale t-warn">
495
+ <b>new: not on {a.name} yet</b>
496
+ <span>{staleWhy(a, u)}</span>
497
+ </div>
498
+ )
499
+
414
500
  /** the middle of the company: every row a form asks, the private ones under a lock, then the open questions */
415
501
  export const LegalPage = observer(({ so, i }: { so: SocialSt; i: DeskIdentity }) => {
416
502
  const l = i.legal
@@ -542,6 +628,7 @@ export const PlatformHeader = observer(({ so, a }: { so: SocialSt; a: DeskAccoun
542
628
  <Go href={a.write.replace('{text}', '')} label="Write" icon="โœŽ" solid />
543
629
  <Go href={a.inbox} label="Replies" icon="๐Ÿ””" solid />
544
630
  <Go href={a.stats} label="Stats" icon="โ–ฅ" solid />
631
+ <Go href={a.settings} label="Settings" icon="โš™" solid />
545
632
  </div>
546
633
  </div>
547
634
  <KeptFold so={so} card="automation" title="What can be automated" open={false} summary={a.automationText} right={<span className={`so-badge t-${auto.tone}`}>{auto.label}</span>}>
@@ -585,23 +672,35 @@ const Checklist = observer(({ so, a }: { so: SocialSt; a: DeskAccount }) => {
585
672
  )
586
673
  })
587
674
 
588
- const REF = /\[\[([^\]]+)\]\]/g
589
-
590
- /** a step's words, its refs drawn inline: a row's value with ยซ copy ยป, an image with ยซ โฌ‡ ยป, a draft to copy */
675
+ /** a step's words, then its form (step-layout.ts): a short row a chip whole in the sentence, a long row or a picture
676
+ * one line under it with its name, its whole value and ยซ copy ยป, or its pictures with ยซ โฌ‡ ยป and ยซ Done, uploaded ยป */
591
677
  const StepText = observer(({ so, a, index, text }: { so: SocialSt; a: DeskAccount; index: number; text: string }) => {
592
- const parts = text.split(REF)
593
678
  const i = so.identityOf(a.identity)
679
+ const rowOf = (ref: string): Row | undefined => a.rows.find((r) => r.field === ref)
680
+ const kindOf = (ref: string): RefKind => {
681
+ if (so.refDraft(a, ref)) return 'draft'
682
+ const row = rowOf(ref)
683
+ if (row == null) return 'bad'
684
+ return row.files.length > 0 && i ? 'picture' : textKind(row.value)
685
+ }
686
+ const { sentence, fields } = stepLayout(text, kindOf)
687
+ const keyOf = (ref: string): string => `${a.identity}/${a.id}/step/${index}/${ref}`
594
688
  return (
595
689
  <>
596
- {parts.map((part, j) => {
597
- if (j % 2 === 0) return <MdInline key={j} text={part} />
598
- const key = `${a.identity}/${a.id}/step/${index}/${part}`
599
- const draft = so.refDraft(a, part)
690
+ {sentence.map((p, j) => {
691
+ if ('text' in p) return <MdInline key={j} text={p.text} />
692
+ if (p.as === 'tag')
693
+ return (
694
+ <span key={j} className="so-steptag" title="its value is in the form under this step">
695
+ {p.ref}
696
+ </span>
697
+ )
698
+ const draft = so.refDraft(a, p.ref)
600
699
  if (draft)
601
700
  return (
602
701
  <span key={j} className="so-chip">
603
- <button className="primary" onClick={() => void so.copy(draft.text, key)} title="copy that draft's text">
604
- {so.copiedKey === key ? 'โœ“ copied' : `โง‰ ยซ ${draft.title || draft.slug.replace(/^\d{8}-\d{6}-/, '')} ยป`}
702
+ <button className="primary" onClick={() => void so.copy(draft.text, keyOf(p.ref))} title="copy that draft's text">
703
+ {so.copiedKey === keyOf(p.ref) ? 'โœ“ copied' : `โง‰ ยซ ${draft.title || draft.slug.replace(/^\d{8}-\d{6}-/, '')} ยป`}
605
704
  </button>
606
705
  {draft.media ? (
607
706
  <a className="so-btn" href={so.mediaUrl(draft.slug, draft.media)} download={fileName(draft.media.name)}>
@@ -610,34 +709,46 @@ const StepText = observer(({ so, a, index, text }: { so: SocialSt; a: DeskAccoun
610
709
  ) : null}
611
710
  </span>
612
711
  )
613
- const row: Row | undefined = a.rows.find((r) => r.field === part)
614
- if (row?.files.length && i)
615
- return (
616
- <span key={j} className="so-chip">
617
- {row.files.map((file) => (
618
- <span key={file} className="so-chip">
619
- <img className="so-stepimg" src={so.pictureUrl(i.id, file)} alt="" />
620
- <a className="so-btn" href={so.pictureUrl(i.id, file)} download={fileName(file)}>
621
- โฌ‡
622
- </a>
623
- </span>
624
- ))}
625
- </span>
626
- )
712
+ const row = rowOf(p.ref)
627
713
  if (row)
628
714
  return (
629
715
  <span key={j} className="so-chip">
630
- <button className="primary so-chipvalue" onClick={() => void so.copy(row.value, key)} title={row.value}>
631
- <span className="so-ellip">{row.value}</span> {so.copiedKey === key ? 'โœ“' : 'โง‰'}
716
+ <button className="primary so-chipvalue" onClick={() => void so.copy(row.value, keyOf(p.ref))} title={`copy ${row.field}`}>
717
+ {row.value} {so.copiedKey === keyOf(p.ref) ? 'โœ“' : 'โง‰'}
632
718
  </button>
719
+ <PasteFoot so={so} a={a} field={row.field} />
633
720
  </span>
634
721
  )
635
722
  return (
636
723
  <span key={j} className="so-badref">
637
- [[{part}]]
724
+ [[{p.ref}]]
638
725
  </span>
639
726
  )
640
727
  })}
728
+ {fields.length > 0 ? (
729
+ <div className="so-stepform">
730
+ {fields.map((ref) => {
731
+ const row = rowOf(ref)!
732
+ if (row.files.length === 0 || i == null) return <CopyRow key={ref} so={so} k={keyOf(ref)} field={ref} value={row.value} tone={pasteTone(a, ref)} foot={<PasteFoot so={so} a={a} field={ref} />} />
733
+ // one chip a picture, its other formats (the svg master of a png) under it, never an image of their own
734
+ const u = uploadOf(a, ref)
735
+ return (
736
+ <CopyRow key={ref} so={so} k={keyOf(ref)} field={ref} value={row.value}>
737
+ <span className="so-steppics">
738
+ {u?.stale ? <span className="so-badge solid t-warn" title={staleWhy(a, u)}>new: not on {a.name} yet</span> : null}
739
+ {rowPictures(i, row.files).map((f) => (
740
+ <span key={f.file} className="so-chip">
741
+ <img className="so-stepimg" src={so.pictureUrl(i.id, f.file)} alt="" title={fileName(f.file)} />
742
+ <PictureActions so={so} i={i} f={f} />
743
+ {u == null ? null : <ShownFoot so={so} a={a} u={u} f={f} />}
744
+ </span>
745
+ ))}
746
+ </span>
747
+ </CopyRow>
748
+ )
749
+ })}
750
+ </div>
751
+ ) : null}
641
752
  </>
642
753
  )
643
754
  })
@@ -653,33 +764,36 @@ export const AccountProfile = observer(({ so, a }: { so: SocialSt; a: DeskAccoun
653
764
  const pics = i == null ? [] : a.rows.filter((r) => r.files.length > 0)
654
765
  const mine = pics.filter((r) => !otherRating(r.field, rating))
655
766
  const others = pics.filter((r) => otherRating(r.field, rating))
767
+ // a row of the other rating the account names itself is a variant it shows too, tracked like the others
768
+ const variants = others.filter((r) => uploadOf(a, r.field) != null)
769
+ const apart = others.filter((r) => uploadOf(a, r.field) == null)
770
+ const stale = a.uploads.filter((u) => u.stale && u.kind === 'picture').length
771
+ const guided = stepRefs(a.steps).size > 0
772
+ const rest = otherRows(i, a)
773
+ const right = (
774
+ <>
775
+ {stale > 0 ? <span className="so-badge solid t-warn" title="rows this account does not show as the folder holds them now">{stale} to update</span> : null}
776
+ {rating === '' ? null : <span className={`so-badge solid ${rating === 'sfw' ? 't-ok' : 't-warn'}`} title="its rating row: the pictures it shows">{rating}</span>}
777
+ </>
778
+ )
656
779
  return (
657
780
  <div className="so-colin">
658
781
  {i != null && mine.length > 0 ? (
659
- <KeptFold so={so} card="upload" title="Upload here" flush right={rating === '' ? null : <span className={`so-badge solid ${rating === 'sfw' ? 't-ok' : 't-warn'}`} title="its rating row: the pictures it shows">{rating}</span>}>
660
- {mine.map((r) => (
661
- <div key={r.field} className="so-row">
662
- <span className="so-rowfield">{r.field}</span>
663
- <div className="so-uppics">
664
- <div className="so-tiles">
665
- {rowPictures(i, r.files).map((f) => (
666
- <PictureTile key={f.file} so={so} i={i} f={f} width={tileWidth(f)} label={factsOf(f.file, i.id).label} />
667
- ))}
668
- </div>
669
- {hasNote(r) ? <span className="rv-dim rv-small">{r.value}</span> : null}
670
- </div>
671
- </div>
672
- ))}
673
- {others.length > 0 ? <div className="so-row rv-dim rv-small">not for this venue, its rating is {rating}: {others.map((r) => r.field).join(', ')}</div> : null}
782
+ <KeptFold so={so} card="upload" title="Upload here" flush tone={stale > 0 ? 'warn' : undefined} right={right}>
783
+ {mine.map((r) => <UploadRow key={r.field} so={so} i={i} a={a} r={r} />)}
784
+ {variants.length > 0 ? <div className="so-row so-upband rv-small">its {variants[0]!.field.split(/\s+/).pop()} variant, named by this account</div> : null}
785
+ {variants.map((r) => <UploadRow key={r.field} so={so} i={i} a={a} r={r} />)}
786
+ {apart.length > 0 ? <div className="so-row rv-dim rv-small">not for this venue, its rating is {rating}: {apart.map((r) => r.field).join(', ')}</div> : null}
674
787
  </KeptFold>
675
788
  ) : null}
676
- <KeptFold so={so} card="profile" title="The profile" flush>
677
- {a.rows
678
- .filter((r) => i == null || r.files.length === 0)
679
- .map((r) => (
680
- <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value} />
789
+ {rest.length > 0 ? (
790
+ // with a setup, its steps are the form he fills; the rows no step names stay apart, folded
791
+ <KeptFold so={so} card={guided ? 'rows' : 'profile'} title={guided ? 'Other rows' : 'The profile'} open={!guided} flush right={guided ? <span className="rv-dim rv-small">{rest.length}</span> : undefined}>
792
+ {rest.map((r) => (
793
+ <CopyRow key={r.field} so={so} k={`${a.identity}/${a.id}/row/${r.field}`} field={r.field} value={r.value} tone={pasteTone(a, r.field)} foot={<PasteFoot so={so} a={a} field={r.field} />} />
681
794
  ))}
682
- </KeptFold>
795
+ </KeptFold>
796
+ ) : null}
683
797
  {a.notes ? (
684
798
  <KeptFold so={so} card="notes" title="Notes" open={false} summary={a.notes}>
685
799
  <Md text={a.notes} />
@@ -1,10 +1,10 @@
1
1
  // the Communications and Social pages as state (wiki tools/shipkit/social.md, The desks in the hub): one desk read from
2
2
  // the hub for both, what each page picked, the list's view, the folds he set, the editor, his notes, the writes. A
3
3
  // pick goes through RepoSt (showComms, showSocial), the one writer of the address
4
- import { makeAutoObservable, runInAction } from 'mobx'
4
+ import { makeAutoObservable, observableRef, runInAction } from 'mobx'
5
+ import { releaseSource, StageSt } from './stage-st.ts'
5
6
  import { compose, messageLength } from '../../../social/compose.ts'
6
7
  import { deskOfWire, type Wire } from '../../../social/desk-wire.ts'
7
- import type { AskedPost } from '../../../review/notes.ts'
8
8
  import { identityAddress } from '../identity-address.ts'
9
9
  import { SEARCH_KEY } from '../keys.ts'
10
10
  import { reach } from '../reach.ts'
@@ -15,7 +15,9 @@ import {
15
15
  commsQuery,
16
16
  countsOf,
17
17
  draftWaiting,
18
+ editorLink,
18
19
  FAMS,
20
+ kindChoices,
19
21
  LEGAL,
20
22
  legalLive,
21
23
  ME,
@@ -26,7 +28,9 @@ import {
26
28
  type DeskAccount,
27
29
  type DeskIdentity,
28
30
  type DeskJson,
31
+ type DeskKind,
29
32
  type Draft,
33
+ type KindChoice,
30
34
  type Fam,
31
35
  type Media,
32
36
  type Picture,
@@ -94,6 +98,8 @@ export class SocialSt {
94
98
  newestFirst = true
95
99
  /** the identity the list keeps; null, every one */
96
100
  who: string | null = null
101
+ /** the kind the list keeps, a word of the set or one off it; null, every one */
102
+ kind: string | null = null
97
103
  draftQuery = ''
98
104
  calendarOpen = true
99
105
  /** the drafts whose sub entries he folded in the list */
@@ -126,8 +132,8 @@ export class SocialSt {
126
132
  /** the headings open in the editor, `<heading key>/<slug>` */
127
133
  edits: Record<string, DraftEdit> = {}
128
134
  notes: Record<string, DraftNote[]> = {}
129
- /** the posts he asked from a review card that no draft answers yet (ยซ ๐Ÿ“ฃ post ยป), oldest first */
130
- asked: AskedPost[] = []
135
+ /** the stage popup on a release draft: its media picked among the approved cards the release ships */
136
+ stage: StageSt | null = null
131
137
  toast: string | null = null
132
138
  /** the phone shows one pane at a time: the list, or what it opened */
133
139
  phonePane: 'list' | 'detail' = 'list'
@@ -152,10 +158,11 @@ export class SocialSt {
152
158
  this.channel = v.channel ?? null
153
159
  this.newestFirst = v.newestFirst ?? true
154
160
  this.who = v.who ?? null
161
+ this.kind = typeof v.kind === 'string' ? v.kind : null
155
162
  for (const slug of kept<unknown[]>(SERIES, [])) if (typeof slug === 'string') this.foldedSeries[slug] = true
156
163
  this.calendarOpen = kept<boolean>(CALENDAR, true)
157
164
  for (const [k, x] of Object.entries(kept<Record<string, unknown>>(FOLDS, {}))) if (typeof x === 'boolean') this.folds[k] = x
158
- makeAutoObservable<this, 'st' | 'nav' | 'started' | 'toastTimer' | 'copyTimer' | 'trackerTimer' | 'onBack'>(this, { st: false, nav: false, started: false, toastTimer: false, copyTimer: false, trackerTimer: false, onBack: false, searchEl: false })
165
+ makeAutoObservable<this, 'st' | 'nav' | 'started' | 'toastTimer' | 'copyTimer' | 'trackerTimer' | 'onBack'>(this, { st: false, nav: false, started: false, toastTimer: false, copyTimer: false, trackerTimer: false, onBack: false, searchEl: false, stage: observableRef })
159
166
  }
160
167
 
161
168
  /** the home's view of an identity, every account its own page; null off the home (a hub of its own, a frame) */
@@ -187,7 +194,6 @@ export class SocialSt {
187
194
  this.trackerTimer = setInterval(() => void this.loadTracker(), TRACKER_MS)
188
195
  }
189
196
  void this.load()
190
- void this.loadAsked()
191
197
  void this.loadStats()
192
198
  void this.loadTracker()
193
199
  }
@@ -266,7 +272,6 @@ export class SocialSt {
266
272
 
267
273
  private readonly onBack = (): void => {
268
274
  void this.load()
269
- void this.loadAsked()
270
275
  }
271
276
 
272
277
  /** what the page says while the desk is not read yet: never a bare ยซ loadingโ€ฆ ยป */
@@ -347,8 +352,9 @@ export class SocialSt {
347
352
  return this.accountOf(p.identity, p.platform)
348
353
  }
349
354
 
355
+ /** the load's lines: its errors, then what only warns (an old kind word), each a line of the problems row */
350
356
  get errors(): string[] {
351
- return this.desk?.errors ?? []
357
+ return [...(this.desk?.errors ?? []), ...(this.desk?.warnings ?? [])]
352
358
  }
353
359
 
354
360
  statOf(a: DeskAccount): string | undefined {
@@ -375,8 +381,32 @@ export class SocialSt {
375
381
  return d.posts.filter((p) => this.inFamilyPost(p))
376
382
  }
377
383
 
378
- private kept(d: Draft): boolean {
379
- return (this.family === null || this.familyPosts(d).length > 0) && (this.channel === null || d.posts.some((p) => p.platform === this.channel)) && (this.who === null || d.identity === this.who)
384
+ /** `byKind` false: every filter but the kind's, the drafts its choices count */
385
+ private kept(d: Draft, byKind = true): boolean {
386
+ return (this.family === null || this.familyPosts(d).length > 0) && (this.channel === null || d.posts.some((p) => p.platform === this.channel)) && (this.who === null || d.identity === this.who) && (!byKind || this.kindShown === null || d.kind === this.kindShown)
387
+ }
388
+
389
+ /** the kind the list keeps, or null when the word it remembers is neither a kind of the repo nor one a draft names:
390
+ * a word every draft moved off would hide them all */
391
+ get kindShown(): string | null {
392
+ const k = this.kind
393
+ if (k === null || this.desk == null) return k
394
+ return this.desk.kinds.some((x) => x.id === k) || this.drafts.some((d) => d.kind === k) ? k : null
395
+ }
396
+
397
+ /** the kind filter's choices: each kind the repo takes with its drafts under the other filters, then the words off the set */
398
+ get kindChoices(): KindChoice[] {
399
+ return kindChoices(this.drafts.filter((d) => this.kept(d, false)), this.desk?.kinds ?? [])
400
+ }
401
+
402
+ /** a kind the repo takes, with its rules page; null for a word off the set */
403
+ kindOf(id: string): DeskKind | null {
404
+ return this.desk?.kinds.find((k) => k.id === id) ?? null
405
+ }
406
+
407
+ /** what the load says of a word off the set, from a draft that names it */
408
+ kindProblemOf(id: string): string | undefined {
409
+ return this.drafts.find((d) => d.kind === id && d.kindProblem != null)?.kindProblem ?? undefined
380
410
  }
381
411
 
382
412
  /** every platform some draft writes for, the family's only, in the accounts' order */
@@ -470,7 +500,7 @@ export class SocialSt {
470
500
 
471
501
  /** the list's view as the address carries it */
472
502
  get commsAddress(): string {
473
- return commsQuery({ fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who })
503
+ return commsQuery({ fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who, kind: this.kind })
474
504
  }
475
505
 
476
506
  /** an address's query: a key it leaves out keeps what the page remembers */
@@ -483,9 +513,10 @@ export class SocialSt {
483
513
  if (v.newestFirst !== undefined) this.newestFirst = v.newestFirst
484
514
  if (v.who !== undefined) this.who = v.who
485
515
  if (v.channel !== undefined) this.channel = v.channel
516
+ if (v.kind !== undefined) this.kind = v.kind
486
517
  // a channel outside the family would hide every draft
487
518
  if (this.channel !== null && this.desk != null && !this.channels.includes(this.channel)) this.channel = null
488
- keep(VIEW, { fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who })
519
+ keep(VIEW, { fam: this.fam, channel: this.channel, newestFirst: this.newestFirst, who: this.who, kind: this.kind })
489
520
  }
490
521
 
491
522
  /** a filter, the order: the view changes, the address follows it */
@@ -504,6 +535,7 @@ export class SocialSt {
504
535
  if (this.family !== null && this.familyPosts(d).length === 0) clear.fam = null
505
536
  if (this.channel !== null && !d.posts.some((p) => p.platform === this.channel)) clear.channel = null
506
537
  if (this.who !== null && d.identity !== this.who) clear.who = null
538
+ if (this.kind !== null && d.kind !== this.kind) clear.kind = null
507
539
  if (Object.keys(clear).length > 0) this.applyView(clear)
508
540
  }
509
541
  }
@@ -710,8 +742,10 @@ export class SocialSt {
710
742
  return this.st.url(`/api/social/media/${slug}/${encodeURIComponent(m.name)}`)
711
743
  }
712
744
 
745
+ /** a picture's url carries its version, so a page that stays open never shows the old bytes of a redrawn file */
713
746
  pictureUrl(identity: string, file: string): string {
714
- return this.st.url(`/api/social/picture/${identity}/${file.split('/').map(encodeURIComponent).join('/')}`)
747
+ const v = this.identityOf(identity)?.pictures.find((p) => p.v[file] != null)?.v[file] ?? ''
748
+ return this.st.url(`/api/social/picture/${identity}/${file.split('/').map(encodeURIComponent).join('/')}${v === '' ? '' : `?v=${v}`}`)
715
749
  }
716
750
 
717
751
  previewUrl(slug: string): string {
@@ -720,7 +754,7 @@ export class SocialSt {
720
754
 
721
755
  /** a file in VS Code: a file joins the open window, a folder would replace it */
722
756
  editorUrl(abs: string): string {
723
- return `vscode://file${encodeURI(abs)}`
757
+ return editorLink(abs)
724
758
  }
725
759
 
726
760
  /** a path from the repo's root, as he reads it */
@@ -760,6 +794,26 @@ export class SocialSt {
760
794
  this.copyTimer = setTimeout(() => runInAction(() => (this.copiedKey = null)), 1500)
761
795
  }
762
796
 
797
+ /** a path of the repo's hub as the page reaches it */
798
+ url(p: string): string {
799
+ return this.st.url(p)
800
+ }
801
+
802
+ /** ยซ ๐Ÿ“ค add a media ยป on a release draft */
803
+ openStage(slug: string): void {
804
+ this.stage?.dispose()
805
+ this.stage = new StageSt(releaseSource((p) => this.st.url(p), slug), '', () => {
806
+ this.closeStage()
807
+ this.say('media added: the draft waits for your Publish')
808
+ void this.load()
809
+ })
810
+ }
811
+
812
+ closeStage(): void {
813
+ this.stage?.dispose()
814
+ this.stage = null
815
+ }
816
+
763
817
  say(words: string): void {
764
818
  this.toast = words
765
819
  if (this.toastTimer) clearTimeout(this.toastTimer)
@@ -864,6 +918,17 @@ export class SocialSt {
864
918
  await this.write('step', { identity: a.identity, account: a.id, index, done: !step.done })
865
919
  }
866
920
 
921
+ /** ยซ Done, uploaded ยป: the account now shows this file of the row, its sha recorded by the server */
922
+ async markShown(a: DeskAccount, row: string, file: string): Promise<void> {
923
+ await this.write('shown', { identity: a.identity, account: a.id, row, file })
924
+ }
925
+
926
+ /** ยซ Done, pasted ยป: the account now shows this text row as the page showed it, `sha` its value's; the server
927
+ * refuses it when the value moved since */
928
+ async markPasted(a: DeskAccount, row: string, sha: string): Promise<void> {
929
+ await this.write('shown', { identity: a.identity, account: a.id, row, sha })
930
+ }
931
+
867
932
  /** a public act: asked first, then the message posts as its identity and its link lands in the draft */
868
933
  async publish(a: DeskAccount, p: SocialPost): Promise<void> {
869
934
  const k = this.postKey(p)
@@ -954,18 +1019,6 @@ export class SocialSt {
954
1019
 
955
1020
  // โ”€โ”€ his notes on a draft โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
956
1021
 
957
- /** the post requests still open: the review store's, the same items the card's bar shows */
958
- async loadAsked(): Promise<void> {
959
- try {
960
- const r = await reach(this.st.url('/api/social/asked'))
961
- const body = (await r.json()) as { asked?: AskedPost[]; error?: string }
962
- if (!r.ok) throw new Error(body.error ?? `HTTP ${r.status}`)
963
- runInAction(() => (this.asked = body.asked ?? []))
964
- } catch (e) {
965
- runInAction(() => (this.error = (e as Error).message))
966
- }
967
- }
968
-
969
1022
  async loadNotes(slug: string): Promise<void> {
970
1023
  try {
971
1024
  const r = await reach(this.st.url(`/api/social/notes?slug=${encodeURIComponent(slug)}`))