@arbidocs/blocks 0.5.191 → 0.5.193
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/bin/arbidocs-mix-take.mjs +34 -0
- package/bin/arbidocs-record-take.mjs +77 -11
- package/bin/arbidocs-voice-take.mjs +32 -0
- package/dist/{ConnectedCallDock-PVBDNOTA.cjs → ConnectedCallDock-ILFVXVCB.cjs} +26 -26
- package/dist/{ConnectedCallDock-PVBDNOTA.cjs.map → ConnectedCallDock-ILFVXVCB.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-H2OWGUEN.cjs → ConnectedCallRoom-XUMVIAWS.cjs} +19 -19
- package/dist/{ConnectedCallRoom-H2OWGUEN.cjs.map → ConnectedCallRoom-XUMVIAWS.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-NKVGPLSK.cjs → ConnectedNativeDocxComparison-3KBUDWLO.cjs} +19 -19
- package/dist/{ConnectedNativeDocxComparison-NKVGPLSK.cjs.map → ConnectedNativeDocxComparison-3KBUDWLO.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-N6HNSYRH.cjs → ConnectedPresentation-LNDESKYE.cjs} +20 -20
- package/dist/{ConnectedPresentation-N6HNSYRH.cjs.map → ConnectedPresentation-LNDESKYE.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-KT6BPSRE.cjs → ConnectedProductionSetDialog-SHDI7KP6.cjs} +6 -6
- package/dist/{ConnectedProductionSetDialog-KT6BPSRE.cjs.map → ConnectedProductionSetDialog-SHDI7KP6.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-J7OPUXI4.cjs → ConnectedSlidesTab-LEA5OW75.cjs} +17 -17
- package/dist/{ConnectedSlidesTab-J7OPUXI4.cjs.map → ConnectedSlidesTab-LEA5OW75.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-BLSAP7NY.cjs → ConnectedStreamedWordArtifact-F4XIWVOG.cjs} +19 -19
- package/dist/{ConnectedStreamedWordArtifact-BLSAP7NY.cjs.map → ConnectedStreamedWordArtifact-F4XIWVOG.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-C2ZXJ2ZL.cjs → DocumentReviewCard-GWMZMXKZ.cjs} +21 -21
- package/dist/{DocumentReviewCard-C2ZXJ2ZL.cjs.map → DocumentReviewCard-GWMZMXKZ.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-NUPMAEIC.cjs → FilesViewerDialog-SEMFURAU.cjs} +52 -52
- package/dist/{FilesViewerDialog-NUPMAEIC.cjs.map → FilesViewerDialog-SEMFURAU.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-CSOPEZFT.cjs → WorkspaceTableView-W6NGKKII.cjs} +11 -11
- package/dist/{WorkspaceTableView-CSOPEZFT.cjs.map → WorkspaceTableView-W6NGKKII.cjs.map} +1 -1
- package/dist/agents/index.cjs +287 -287
- package/dist/{ai-2B4BMS6O.cjs → ai-C5THVAML.cjs} +28 -28
- package/dist/ai-C5THVAML.cjs.map +1 -0
- package/dist/auth/index.cjs +12 -12
- package/dist/calls/index.cjs +126 -126
- package/dist/chat/index.cjs +48 -48
- package/dist/{chunk-VNUBBRJM.cjs → chunk-2K5DLB7B.cjs} +3 -3
- package/dist/{chunk-VNUBBRJM.cjs.map → chunk-2K5DLB7B.cjs.map} +1 -1
- package/dist/{chunk-NTXII2XQ.cjs → chunk-3EIO4ZH5.cjs} +6 -6
- package/dist/{chunk-NTXII2XQ.cjs.map → chunk-3EIO4ZH5.cjs.map} +1 -1
- package/dist/{chunk-3U6XE7SF.cjs → chunk-3P766LID.cjs} +4 -4
- package/dist/{chunk-3U6XE7SF.cjs.map → chunk-3P766LID.cjs.map} +1 -1
- package/dist/{chunk-B5AOYT4U.cjs → chunk-5FSULBPE.cjs} +3 -3
- package/dist/{chunk-B5AOYT4U.cjs.map → chunk-5FSULBPE.cjs.map} +1 -1
- package/dist/{chunk-SKIQ54TG.cjs → chunk-5IRDGXB2.cjs} +11 -11
- package/dist/{chunk-SKIQ54TG.cjs.map → chunk-5IRDGXB2.cjs.map} +1 -1
- package/dist/{chunk-3P6KGC46.cjs → chunk-5OD6DRG7.cjs} +3 -3
- package/dist/{chunk-3P6KGC46.cjs.map → chunk-5OD6DRG7.cjs.map} +1 -1
- package/dist/{chunk-XKQKHXRU.cjs → chunk-6AFAYGJW.cjs} +5 -5
- package/dist/{chunk-XKQKHXRU.cjs.map → chunk-6AFAYGJW.cjs.map} +1 -1
- package/dist/{chunk-PVT4EZUR.cjs → chunk-6QFHYV2J.cjs} +4 -4
- package/dist/{chunk-PVT4EZUR.cjs.map → chunk-6QFHYV2J.cjs.map} +1 -1
- package/dist/{chunk-DFQWX2XY.cjs → chunk-7GVKG3G4.cjs} +13 -13
- package/dist/{chunk-DFQWX2XY.cjs.map → chunk-7GVKG3G4.cjs.map} +1 -1
- package/dist/{chunk-GY4T4JSC.cjs → chunk-C4UNKFG6.cjs} +4 -4
- package/dist/{chunk-GY4T4JSC.cjs.map → chunk-C4UNKFG6.cjs.map} +1 -1
- package/dist/{chunk-CUYELFKB.cjs → chunk-DRYJIRBS.cjs} +4 -4
- package/dist/{chunk-CUYELFKB.cjs.map → chunk-DRYJIRBS.cjs.map} +1 -1
- package/dist/{chunk-R37KPMUZ.cjs → chunk-E56TJFIR.cjs} +8 -8
- package/dist/{chunk-R37KPMUZ.cjs.map → chunk-E56TJFIR.cjs.map} +1 -1
- package/dist/{chunk-YNFETLNZ.cjs → chunk-ER2MRSLT.cjs} +3 -3
- package/dist/{chunk-YNFETLNZ.cjs.map → chunk-ER2MRSLT.cjs.map} +1 -1
- package/dist/{chunk-CM2LUZ7K.cjs → chunk-GLYPVBBI.cjs} +29 -29
- package/dist/{chunk-CM2LUZ7K.cjs.map → chunk-GLYPVBBI.cjs.map} +1 -1
- package/dist/{chunk-SOJYSRO4.cjs → chunk-H4N6BZNU.cjs} +9 -9
- package/dist/{chunk-SOJYSRO4.cjs.map → chunk-H4N6BZNU.cjs.map} +1 -1
- package/dist/{chunk-H3CYXI46.cjs → chunk-HH5MKRBL.cjs} +7 -7
- package/dist/{chunk-H3CYXI46.cjs.map → chunk-HH5MKRBL.cjs.map} +1 -1
- package/dist/{chunk-E62542RM.cjs → chunk-I6JXZ4FU.cjs} +18 -18
- package/dist/{chunk-E62542RM.cjs.map → chunk-I6JXZ4FU.cjs.map} +1 -1
- package/dist/{chunk-GEVBY536.cjs → chunk-IOTSI4IZ.cjs} +37 -37
- package/dist/{chunk-GEVBY536.cjs.map → chunk-IOTSI4IZ.cjs.map} +1 -1
- package/dist/{chunk-4GMPS6VX.cjs → chunk-IRDL2EC6.cjs} +49 -49
- package/dist/{chunk-4GMPS6VX.cjs.map → chunk-IRDL2EC6.cjs.map} +1 -1
- package/dist/{chunk-SNYCK354.cjs → chunk-JEHGTPS2.cjs} +4 -4
- package/dist/{chunk-SNYCK354.cjs.map → chunk-JEHGTPS2.cjs.map} +1 -1
- package/dist/{chunk-JGU6YLIA.cjs → chunk-KQJUY2OE.cjs} +11 -11
- package/dist/{chunk-JGU6YLIA.cjs.map → chunk-KQJUY2OE.cjs.map} +1 -1
- package/dist/{chunk-KJ5M72M2.cjs → chunk-KSBXPXWT.cjs} +9 -8
- package/dist/chunk-KSBXPXWT.cjs.map +1 -0
- package/dist/{chunk-X6TSOKEP.cjs → chunk-LYJFE37D.cjs} +3 -3
- package/dist/{chunk-X6TSOKEP.cjs.map → chunk-LYJFE37D.cjs.map} +1 -1
- package/dist/{chunk-WHU7ABQE.cjs → chunk-M2KZ2GPP.cjs} +3 -3
- package/dist/{chunk-WHU7ABQE.cjs.map → chunk-M2KZ2GPP.cjs.map} +1 -1
- package/dist/{chunk-NBW67JUB.cjs → chunk-OHWYQI3B.cjs} +12 -12
- package/dist/{chunk-NBW67JUB.cjs.map → chunk-OHWYQI3B.cjs.map} +1 -1
- package/dist/{chunk-SLVWSTFY.cjs → chunk-OO5GWDXK.cjs} +28 -28
- package/dist/{chunk-SLVWSTFY.cjs.map → chunk-OO5GWDXK.cjs.map} +1 -1
- package/dist/{chunk-JEUHT7XH.cjs → chunk-PMZHUK3O.cjs} +6 -6
- package/dist/{chunk-JEUHT7XH.cjs.map → chunk-PMZHUK3O.cjs.map} +1 -1
- package/dist/{chunk-5UNZO4FA.cjs → chunk-POTF3QQB.cjs} +51 -51
- package/dist/{chunk-5UNZO4FA.cjs.map → chunk-POTF3QQB.cjs.map} +1 -1
- package/dist/{chunk-WXRAU2FF.cjs → chunk-QSY2VW7V.cjs} +6 -6
- package/dist/{chunk-WXRAU2FF.cjs.map → chunk-QSY2VW7V.cjs.map} +1 -1
- package/dist/{chunk-MXM4BTXY.cjs → chunk-RQN45P3L.cjs} +4 -4
- package/dist/{chunk-MXM4BTXY.cjs.map → chunk-RQN45P3L.cjs.map} +1 -1
- package/dist/{chunk-GOLLGCGK.cjs → chunk-S6SG5J4I.cjs} +71 -70
- package/dist/chunk-S6SG5J4I.cjs.map +1 -0
- package/dist/{chunk-W7TSEN3J.cjs → chunk-TLIZD6DV.cjs} +6 -6
- package/dist/{chunk-W7TSEN3J.cjs.map → chunk-TLIZD6DV.cjs.map} +1 -1
- package/dist/{chunk-ZLOPSDVW.cjs → chunk-UYYN3T73.cjs} +4 -4
- package/dist/{chunk-ZLOPSDVW.cjs.map → chunk-UYYN3T73.cjs.map} +1 -1
- package/dist/{chunk-NS7PWOL7.cjs → chunk-VD3HI5RF.cjs} +3 -3
- package/dist/{chunk-NS7PWOL7.cjs.map → chunk-VD3HI5RF.cjs.map} +1 -1
- package/dist/{chunk-6N7QT2DH.cjs → chunk-VDHBLDQC.cjs} +3 -3
- package/dist/{chunk-6N7QT2DH.cjs.map → chunk-VDHBLDQC.cjs.map} +1 -1
- package/dist/{chunk-6ZJBUMNK.cjs → chunk-VDT7TEAH.cjs} +3 -3
- package/dist/{chunk-6ZJBUMNK.cjs.map → chunk-VDT7TEAH.cjs.map} +1 -1
- package/dist/{chunk-QOTDPA62.cjs → chunk-VLB6ETIQ.cjs} +10 -10
- package/dist/{chunk-QOTDPA62.cjs.map → chunk-VLB6ETIQ.cjs.map} +1 -1
- package/dist/{chunk-HO2AURAQ.cjs → chunk-WBPP7IEW.cjs} +6 -6
- package/dist/{chunk-HO2AURAQ.cjs.map → chunk-WBPP7IEW.cjs.map} +1 -1
- package/dist/{chunk-XYMM6ZPS.cjs → chunk-WK4MI52B.cjs} +64 -64
- package/dist/{chunk-XYMM6ZPS.cjs.map → chunk-WK4MI52B.cjs.map} +1 -1
- package/dist/{chunk-MWJPCTBV.cjs → chunk-XKXKEVHH.cjs} +6 -6
- package/dist/{chunk-MWJPCTBV.cjs.map → chunk-XKXKEVHH.cjs.map} +1 -1
- package/dist/{chunk-YK3GUFZX.cjs → chunk-XP7BO4JJ.cjs} +15 -15
- package/dist/{chunk-YK3GUFZX.cjs.map → chunk-XP7BO4JJ.cjs.map} +1 -1
- package/dist/{chunk-DJ7LSKBJ.cjs → chunk-XQPJWPWE.cjs} +3 -3
- package/dist/{chunk-DJ7LSKBJ.cjs.map → chunk-XQPJWPWE.cjs.map} +1 -1
- package/dist/{chunk-VJFU2KKF.cjs → chunk-ZS74MKNV.cjs} +4 -4
- package/dist/{chunk-VJFU2KKF.cjs.map → chunk-ZS74MKNV.cjs.map} +1 -1
- package/dist/collaboration/index.cjs +13 -13
- package/dist/connect/docx.cjs +22 -22
- package/dist/connect/index.cjs +1233 -1220
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +40 -40
- package/dist/connection/config/useDeveloperConfig.d.ts +1 -0
- package/dist/connection/config/useModelPicker.d.ts +4 -0
- package/dist/connection/conversation/AgentSteps.js +1 -0
- package/dist/connection/conversation/AgentSteps.js.map +2 -2
- package/dist/connection/facts/useFactFilters.d.ts +3 -0
- package/dist/connection/settings-page/ConnectedPremiumModels.js +14 -1
- package/dist/connection/settings-page/ConnectedPremiumModels.js.map +2 -2
- package/dist/connection/tags/ConnectedTagTable.d.ts +1 -0
- package/dist/connection/workspace-list/useConnectedWorkspaceList.d.ts +1 -1
- package/dist/dashboards/index.cjs +1 -1
- package/dist/embed/index.cjs +48 -48
- package/dist/facts/index.cjs +40 -40
- package/dist/files/index.cjs +222 -222
- package/dist/home/index.cjs +10 -10
- package/dist/index.cjs +1667 -1667
- package/dist/pages/index.cjs +38 -38
- package/dist/record/band.d.ts +95 -0
- package/dist/record/index.cjs +414 -13
- package/dist/record/index.cjs.map +1 -1
- package/dist/record/index.d.ts +35 -2
- package/dist/record/index.js +402 -15
- package/dist/record/index.js.map +1 -1
- package/dist/record/narration.d.ts +71 -0
- package/dist/settings/index.cjs +140 -140
- package/dist/shell/index.cjs +82 -82
- package/dist/site/index.cjs +9 -9
- package/dist/studio/index.cjs +31 -31
- package/dist/styles.css +1 -1
- package/dist/tags/TagColumnsEditor.js +2 -1
- package/dist/tags/TagColumnsEditor.js.map +2 -2
- package/dist/workflow-canvas/index.cjs +64 -64
- package/dist/workspaces/index.cjs +5 -5
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +11 -6
- package/record/SKILL.md +178 -26
- package/record/mix-take.py +320 -0
- package/record/recap-slide.mjs +118 -0
- package/record/voice-take.py +129 -0
- package/dist/ai-2B4BMS6O.cjs.map +0 -1
- package/dist/chunk-GOLLGCGK.cjs.map +0 -1
- package/dist/chunk-KJ5M72M2.cjs.map +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closing recap slide of a narrated video, as PNGs, one per step: the story's points ticked off one
|
|
3
|
+
* by one as the voice names them, then the close (the title underlined, a thank-you). Styled with the
|
|
4
|
+
* brand the take recorded (its fonts and colours), like the edit's cards. Run by mix-take.py.
|
|
5
|
+
*
|
|
6
|
+
* node recap-slide.mjs <spec.json> <out dir>
|
|
7
|
+
*
|
|
8
|
+
* spec: { width, height, brand, recap: { kicker, title, lede, points: [{ title, detail }], closing } }.
|
|
9
|
+
* Writes step-0.png (nothing ticked) … step-N.png (all N ticked) and step-final.png.
|
|
10
|
+
*/
|
|
11
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
12
|
+
import path from 'node:path'
|
|
13
|
+
import { pathToFileURL } from 'node:url'
|
|
14
|
+
import { chromium } from '@playwright/test'
|
|
15
|
+
|
|
16
|
+
const esc = (s = '') =>
|
|
17
|
+
s.replace(/[&<>"]/g, (ch) => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[ch])
|
|
18
|
+
|
|
19
|
+
function css(b, w, h) {
|
|
20
|
+
const fonts = (b.fontFiles ?? [])
|
|
21
|
+
.map(
|
|
22
|
+
(f) =>
|
|
23
|
+
`@font-face { font-family: "${f.family}"; font-weight: ${f.weight ?? '100 900'}; src: url(${f.url});${f.unicodeRange ? ` unicode-range: ${f.unicodeRange};` : ''} }`
|
|
24
|
+
)
|
|
25
|
+
.join('\n')
|
|
26
|
+
return `${fonts}
|
|
27
|
+
:root { --from: ${b.coverFrom ?? '#0b1622'}; --mid: ${b.coverMid ?? '#0e1b2c'}; --to: ${b.coverTo ?? '#1f6feb'};
|
|
28
|
+
--accent: ${b.accent ?? '#c9a24b'}; --ink: ${b.ink ?? '#0e1b2d'}; --text: ${b.coverTitle ?? '#f4f6f8'};
|
|
29
|
+
--display: ${b.displayFont ?? 'ui-serif, Georgia, serif'}; --sans: ${b.sansFont ?? 'Inter, ui-sans-serif, system-ui, sans-serif'}; }
|
|
30
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
31
|
+
html, body { width: ${w}px; height: ${h}px; overflow: hidden; background: var(--from); color: var(--text);
|
|
32
|
+
font-family: var(--sans); -webkit-font-smoothing: antialiased; }
|
|
33
|
+
.slide { position: relative; width: ${w}px; height: ${h}px; overflow: hidden;
|
|
34
|
+
background: radial-gradient(70% 85% at 96% 112%, color-mix(in srgb, var(--to) 64%, transparent) 0%, transparent 62%),
|
|
35
|
+
radial-gradient(46% 58% at -4% -8%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 70%),
|
|
36
|
+
linear-gradient(135deg, var(--from) 0%, var(--mid) 58%, var(--from) 100%); }
|
|
37
|
+
.slide::before { content: ""; position: absolute; inset: 40px; border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); border-radius: 4px; }
|
|
38
|
+
.grid { position: absolute; inset: 0; display: grid; grid-template-columns: 0.9fr 1fr; column-gap: 110px; align-items: center;
|
|
39
|
+
padding: 120px 150px 170px; }
|
|
40
|
+
.kicker { text-transform: uppercase; letter-spacing: .28em; font-size: 22px; font-weight: 600; color: var(--accent); }
|
|
41
|
+
h1 { font-family: var(--display); font-weight: 560; font-size: 104px; line-height: 1.02; letter-spacing: -.02em; margin-top: 34px; }
|
|
42
|
+
h1 span { background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 94% / 0% 7px; }
|
|
43
|
+
.final h1 span { background-size: 100% 7px; }
|
|
44
|
+
.lede { margin-top: 38px; font-size: 30px; line-height: 1.45; color: color-mix(in srgb, var(--text) 72%, transparent); max-width: 25ch; }
|
|
45
|
+
ol { list-style: none; }
|
|
46
|
+
li { display: grid; grid-template-columns: 58px 1fr; column-gap: 30px; padding: 30px 0;
|
|
47
|
+
border-top: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); opacity: .3; }
|
|
48
|
+
li:last-child { border-bottom: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); }
|
|
49
|
+
li.done { opacity: 1; }
|
|
50
|
+
.tick { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; margin-top: 4px;
|
|
51
|
+
border: 2px solid color-mix(in srgb, var(--accent) 75%, transparent); }
|
|
52
|
+
.tick svg { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
|
|
53
|
+
li.done .tick { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 18%, transparent); }
|
|
54
|
+
li.done .tick svg { visibility: visible; }
|
|
55
|
+
.n { font-size: 17px; font-weight: 650; letter-spacing: .22em; color: var(--accent); }
|
|
56
|
+
li h2 { font-size: 37px; line-height: 1.18; font-weight: 600; letter-spacing: -.005em; margin-top: 8px; }
|
|
57
|
+
li p { font-size: 24px; line-height: 1.4; color: color-mix(in srgb, var(--text) 66%, transparent); margin-top: 8px; }
|
|
58
|
+
.foot { position: absolute; left: 150px; right: 150px; bottom: 92px; display: flex; align-items: center; justify-content: space-between; }
|
|
59
|
+
.mark { display: flex; align-items: center; gap: 16px; font-size: 22px; color: color-mix(in srgb, var(--text) 64%, transparent); }
|
|
60
|
+
.rule { width: 56px; height: 2px; background: var(--accent); }
|
|
61
|
+
.thanks { font-family: var(--display); font-size: 34px; font-weight: 500; color: var(--text); visibility: hidden; }
|
|
62
|
+
.thanks b { color: var(--accent); font-weight: 500; }
|
|
63
|
+
.final .thanks { visibility: visible; }
|
|
64
|
+
`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const TICK = '<svg viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>'
|
|
68
|
+
|
|
69
|
+
function markup(spec, done, final) {
|
|
70
|
+
const r = spec.recap
|
|
71
|
+
const [lead, last] = (() => {
|
|
72
|
+
const words = r.title.split(' ')
|
|
73
|
+
return [words.slice(0, -1).join(' '), words[words.length - 1]]
|
|
74
|
+
})()
|
|
75
|
+
const points = r.points
|
|
76
|
+
.map(
|
|
77
|
+
(p, i) => `<li class="${i < done ? 'done' : ''}"><div class="tick">${TICK}</div><div>
|
|
78
|
+
<div class="n">${String(i + 1).padStart(2, '0')}</div><h2>${esc(p.title)}</h2><p>${esc(p.detail)}</p></div></li>`
|
|
79
|
+
)
|
|
80
|
+
.join('')
|
|
81
|
+
return `<div class="slide${final ? ' final' : ''}"><div class="grid">
|
|
82
|
+
<div><div class="kicker">${esc(r.kicker)}</div><h1>${esc(lead)} <span>${esc(last)}</span></h1><p class="lede">${esc(r.lede)}</p></div>
|
|
83
|
+
<ol>${points}</ol></div>
|
|
84
|
+
<div class="foot"><div class="mark"><span class="rule"></span><span>${esc(spec.brand?.firmLabel ?? '')}</span></div>
|
|
85
|
+
<div class="thanks">${esc(r.closing)}</div></div></div>`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function main() {
|
|
89
|
+
const [specFile, outDir] = process.argv.slice(2)
|
|
90
|
+
if (!specFile || !outDir) throw new Error('usage: recap-slide.mjs <spec.json> <out dir>')
|
|
91
|
+
const spec = JSON.parse(readFileSync(specFile, 'utf8'))
|
|
92
|
+
const { width: w, height: h } = spec
|
|
93
|
+
mkdirSync(outDir, { recursive: true })
|
|
94
|
+
const html = path.join(outDir, 'recap.html')
|
|
95
|
+
writeFileSync(
|
|
96
|
+
html,
|
|
97
|
+
`<!doctype html><html><head><meta charset="utf-8"><style>${css(spec.brand ?? {}, w, h)}</style></head><body><div id="o"></div></body></html>`
|
|
98
|
+
)
|
|
99
|
+
const browser = await chromium.launch()
|
|
100
|
+
try {
|
|
101
|
+
const page = await browser.newPage({ viewport: { width: w, height: h } })
|
|
102
|
+
await page.goto(pathToFileURL(html).href)
|
|
103
|
+
const n = spec.recap.points.length
|
|
104
|
+
const steps = [
|
|
105
|
+
...Array.from({ length: n + 1 }, (_, i) => [`step-${i}`, i, false]),
|
|
106
|
+
['step-final', n, true],
|
|
107
|
+
]
|
|
108
|
+
for (const [name, done, final] of steps) {
|
|
109
|
+
await page.locator('#o').evaluate((el, m) => (el.innerHTML = m), markup(spec, done, final))
|
|
110
|
+
await page.evaluate(() => document.fonts.ready)
|
|
111
|
+
await page.screenshot({ path: path.join(outDir, `${name}.png`) })
|
|
112
|
+
}
|
|
113
|
+
} finally {
|
|
114
|
+
await browser.close()
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
await main()
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""Speak a story's narration: one clip per line, and a manifest of their lengths for the story to pace by.
|
|
2
|
+
|
|
3
|
+
arbidocs-voice-take <story>.narration.json <out dir> --model <kokoro dir> [--ref <clip.wav>]
|
|
4
|
+
|
|
5
|
+
The narration is the story's script:
|
|
6
|
+
|
|
7
|
+
{"voice": "bf_lily", "lang": "en-gb", "speed": 1, "lines": [{"id", "text", "speech"?}], "recap": {...},
|
|
8
|
+
"spoken": [[pattern, said]], "phonemes": [[heard, meant]], "respell": [[pattern, said]]}
|
|
9
|
+
|
|
10
|
+
`text` is what the band shows; what is spoken is `speech` when given, else `text` with `spoken`
|
|
11
|
+
applied (regular expressions: a time, a web address, a name written one way and said another).
|
|
12
|
+
`phonemes` fixes what Kokoro's phonemiser gets wrong (its guess -> the word as it is said);
|
|
13
|
+
`respell` does the same for Chatterbox, which reads text, not phonemes.
|
|
14
|
+
|
|
15
|
+
The house voice is Kokoro's `bf_lily` in British English (82M, ONNX, offline, on the CPU):
|
|
16
|
+
`pip install kokoro-onnx soundfile` in a venv, and <kokoro dir> holding `model.onnx` and
|
|
17
|
+
`voices/<voice>.bin` (both from the Hugging Face repo onnx-community/Kokoro-82M-v1.0-ONNX).
|
|
18
|
+
`"engine": "chatterbox"` (with `exaggeration`, `cfg`) instead clones the voice of the clip given as
|
|
19
|
+
`--ref` (`pip install chatterbox-tts`; a GPU if there is one, else the CPU: slower, same voice,
|
|
20
|
+
about 4.6 GB of memory).
|
|
21
|
+
|
|
22
|
+
A line whose words, voice and speed have not changed is not spoken again. After changing
|
|
23
|
+
`phonemes` or `respell`, delete the clips of the lines they touch.
|
|
24
|
+
"""
|
|
25
|
+
import argparse
|
|
26
|
+
import hashlib
|
|
27
|
+
import json
|
|
28
|
+
import re
|
|
29
|
+
import sys
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
PAD = 0.06 # s of silence kept either side of the voice
|
|
33
|
+
HOUSE_VOICE = "bf_lily"
|
|
34
|
+
HOUSE_LANG = "en-gb"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def spoken(text, rules):
|
|
38
|
+
"""`text` as it is said: each [pattern, said] rule applied in order."""
|
|
39
|
+
for pattern, said in rules:
|
|
40
|
+
text = re.sub(pattern, said, text)
|
|
41
|
+
return text
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def clip_key(tag, said):
|
|
45
|
+
"""A clip is spoken again only when this changes: the voice's settings and the words said."""
|
|
46
|
+
return hashlib.sha1(f"{tag}|{said}".encode()).hexdigest()[:12]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def main():
|
|
50
|
+
ap = argparse.ArgumentParser()
|
|
51
|
+
ap.add_argument("script")
|
|
52
|
+
ap.add_argument("out")
|
|
53
|
+
ap.add_argument("--model", help="Kokoro: directory with model.onnx and voices/<voice>.bin")
|
|
54
|
+
ap.add_argument("--ref", help="Chatterbox: reference clip of the voice to clone")
|
|
55
|
+
args = ap.parse_args()
|
|
56
|
+
|
|
57
|
+
import numpy as np
|
|
58
|
+
import soundfile as sf
|
|
59
|
+
|
|
60
|
+
script = json.loads(Path(args.script).read_text())
|
|
61
|
+
voice = script.get("voice", HOUSE_VOICE)
|
|
62
|
+
lang = script.get("lang", HOUSE_LANG)
|
|
63
|
+
speed = float(script.get("speed", 1.0))
|
|
64
|
+
out = Path(args.out)
|
|
65
|
+
out.mkdir(parents=True, exist_ok=True)
|
|
66
|
+
manifest_path = out / "manifest.json"
|
|
67
|
+
old = json.loads(manifest_path.read_text())["lines"] if manifest_path.exists() else {}
|
|
68
|
+
|
|
69
|
+
engine = script.get("engine", "kokoro")
|
|
70
|
+
if engine == "chatterbox":
|
|
71
|
+
if not args.ref:
|
|
72
|
+
sys.exit("engine chatterbox needs --ref <clip of the voice to clone>")
|
|
73
|
+
import torch
|
|
74
|
+
from chatterbox.tts import ChatterboxTTS
|
|
75
|
+
tts = ChatterboxTTS.from_pretrained(device="cuda" if torch.cuda.is_available() else "cpu")
|
|
76
|
+
ex, cfg = float(script.get("exaggeration", 0.5)), float(script.get("cfg", 0.5))
|
|
77
|
+
rate = tts.sr
|
|
78
|
+
respell = script.get("respell", [])
|
|
79
|
+
|
|
80
|
+
def render(said):
|
|
81
|
+
torch.manual_seed(0)
|
|
82
|
+
return tts.generate(spoken(said, respell), audio_prompt_path=args.ref, exaggeration=ex, cfg_weight=cfg).squeeze(0).cpu().numpy()
|
|
83
|
+
tag = f"cb|{Path(args.ref).name}|{ex}|{cfg}"
|
|
84
|
+
else:
|
|
85
|
+
if not args.model:
|
|
86
|
+
sys.exit("the Kokoro voice needs --model <directory with model.onnx and voices/>")
|
|
87
|
+
from kokoro_onnx import Kokoro
|
|
88
|
+
model = Path(args.model)
|
|
89
|
+
pack = model / f"voice-{voice}.npz"
|
|
90
|
+
if not pack.exists():
|
|
91
|
+
np.savez(pack, **{voice: np.fromfile(model / "voices" / f"{voice}.bin", dtype=np.float32).reshape(-1, 1, 256)})
|
|
92
|
+
kokoro = Kokoro(str(model / "model.onnx"), str(pack))
|
|
93
|
+
rate = 24000
|
|
94
|
+
fixes = script.get("phonemes", [])
|
|
95
|
+
|
|
96
|
+
def render(said):
|
|
97
|
+
phonemes = kokoro.tokenizer.phonemize(said, lang=lang)
|
|
98
|
+
for heard, meant in fixes:
|
|
99
|
+
phonemes = phonemes.replace(heard, meant)
|
|
100
|
+
audio, _ = kokoro.create(phonemes, voice=voice, speed=speed, lang=lang, is_phonemes=True)
|
|
101
|
+
return audio
|
|
102
|
+
tag = f"{voice}|{speed}"
|
|
103
|
+
|
|
104
|
+
rules = script.get("spoken", [])
|
|
105
|
+
lines = {}
|
|
106
|
+
for line in script["lines"]:
|
|
107
|
+
said = line.get("speech") or spoken(line["text"], rules)
|
|
108
|
+
key = clip_key(tag, said)
|
|
109
|
+
wav = out / f"{line['id']}.wav"
|
|
110
|
+
if old.get(line["id"], {}).get("key") == key and wav.exists():
|
|
111
|
+
lines[line["id"]] = {**old[line["id"]], "text": line["text"]}
|
|
112
|
+
continue
|
|
113
|
+
audio = np.asarray(render(said), np.float32)
|
|
114
|
+
loud = np.flatnonzero(np.abs(audio) > 0.01) # trim the model's own lead-in and tail
|
|
115
|
+
if loud.size:
|
|
116
|
+
audio = audio[max(0, loud[0] - int(0.02 * rate)):loud[-1] + int(0.08 * rate)]
|
|
117
|
+
audio = np.concatenate([np.zeros(int(PAD * rate), np.float32), audio, np.zeros(int(PAD * rate), np.float32)])
|
|
118
|
+
sf.write(wav, audio, rate, subtype="PCM_16")
|
|
119
|
+
lines[line["id"]] = {"text": line["text"], "spoken": said, "file": wav.name, "duration": round(len(audio) / rate, 3), "key": key,
|
|
120
|
+
"peak": round(float(np.abs(audio).max()), 3)}
|
|
121
|
+
print(f"{line['id']:10s} {lines[line['id']]['duration']:5.2f} s {said}", flush=True)
|
|
122
|
+
|
|
123
|
+
total = sum(v["duration"] for v in lines.values())
|
|
124
|
+
manifest_path.write_text(json.dumps({"voice": voice, "lang": lang, "speed": speed, "total": round(total, 2), "lines": lines}, indent=1))
|
|
125
|
+
print(f"{len(lines)} lines, {total:.1f} s of narration -> {manifest_path}")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
if __name__ == "__main__":
|
|
129
|
+
main()
|
package/dist/ai-2B4BMS6O.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"ai-2B4BMS6O.cjs"}
|