@arbidocs/blocks 0.5.190 → 0.5.192
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/{ConnectedNativeDocxComparison-XE5NMZMY.cjs → ConnectedNativeDocxComparison-PPVXDQY3.cjs} +7 -7
- package/dist/{ConnectedNativeDocxComparison-XE5NMZMY.cjs.map → ConnectedNativeDocxComparison-PPVXDQY3.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-EY3YWYDD.cjs → ConnectedStreamedWordArtifact-GAACBGTY.cjs} +7 -7
- package/dist/{ConnectedStreamedWordArtifact-EY3YWYDD.cjs.map → ConnectedStreamedWordArtifact-GAACBGTY.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-RFE4THHR.cjs → DocumentReviewCard-Q3NKJLSM.cjs} +14 -14
- package/dist/{DocumentReviewCard-RFE4THHR.cjs.map → DocumentReviewCard-Q3NKJLSM.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-VO247UEI.cjs → FilesViewerDialog-4JWDTDO7.cjs} +11 -11
- package/dist/{FilesViewerDialog-VO247UEI.cjs.map → FilesViewerDialog-4JWDTDO7.cjs.map} +1 -1
- package/dist/agents/index.cjs +172 -172
- package/dist/{chunk-PGKCL6YA.cjs → chunk-33236Q7Y.cjs} +8 -8
- package/dist/{chunk-PGKCL6YA.cjs.map → chunk-33236Q7Y.cjs.map} +1 -1
- package/dist/{chunk-E7BSG5IS.cjs → chunk-633ZCYVN.cjs} +37 -37
- package/dist/{chunk-E7BSG5IS.cjs.map → chunk-633ZCYVN.cjs.map} +1 -1
- package/dist/{chunk-U4MJIYGD.cjs → chunk-65NQW4RR.cjs} +4 -4
- package/dist/{chunk-U4MJIYGD.cjs.map → chunk-65NQW4RR.cjs.map} +1 -1
- package/dist/{chunk-JAKLLNLL.cjs → chunk-AWQEN6WW.cjs} +9 -7
- package/dist/chunk-AWQEN6WW.cjs.map +1 -0
- package/dist/{chunk-GENUGV6V.cjs → chunk-AZUPMHZI.cjs} +4 -4
- package/dist/{chunk-GENUGV6V.cjs.map → chunk-AZUPMHZI.cjs.map} +1 -1
- package/dist/{chunk-72O4YH5M.cjs → chunk-EAH7LFJN.cjs} +5 -5
- package/dist/{chunk-72O4YH5M.cjs.map → chunk-EAH7LFJN.cjs.map} +1 -1
- package/dist/{chunk-UNT2VY3B.cjs → chunk-EFV52SZ6.cjs} +4 -4
- package/dist/{chunk-UNT2VY3B.cjs.map → chunk-EFV52SZ6.cjs.map} +1 -1
- package/dist/{chunk-IXSOSISW.cjs → chunk-ELN3YOXF.cjs} +28 -28
- package/dist/{chunk-IXSOSISW.cjs.map → chunk-ELN3YOXF.cjs.map} +1 -1
- package/dist/{chunk-NAEBNQTO.cjs → chunk-GLNL5AL5.cjs} +29 -29
- package/dist/{chunk-NAEBNQTO.cjs.map → chunk-GLNL5AL5.cjs.map} +1 -1
- package/dist/{chunk-HTH3XIFF.cjs → chunk-GZPNBSRE.cjs} +8 -8
- package/dist/{chunk-HTH3XIFF.cjs.map → chunk-GZPNBSRE.cjs.map} +1 -1
- package/dist/chunk-HME72RFP.cjs +145 -0
- package/dist/chunk-HME72RFP.cjs.map +1 -0
- package/dist/{chunk-GW5LTX66.cjs → chunk-J46Y2L26.cjs} +4 -4
- package/dist/{chunk-GW5LTX66.cjs.map → chunk-J46Y2L26.cjs.map} +1 -1
- package/dist/{chunk-LHWFSXM5.cjs → chunk-KD37PODE.cjs} +3 -3
- package/dist/{chunk-LHWFSXM5.cjs.map → chunk-KD37PODE.cjs.map} +1 -1
- package/dist/{chunk-VCCAG4GQ.cjs → chunk-KZH6HMJL.cjs} +4 -4
- package/dist/{chunk-VCCAG4GQ.cjs.map → chunk-KZH6HMJL.cjs.map} +1 -1
- package/dist/{chunk-AQYCL2IJ.cjs → chunk-QDIIOZBP.cjs} +5 -5
- package/dist/{chunk-AQYCL2IJ.cjs.map → chunk-QDIIOZBP.cjs.map} +1 -1
- package/dist/{chunk-USYCBTKK.cjs → chunk-R6HGMPF4.cjs} +41 -7
- package/dist/chunk-R6HGMPF4.cjs.map +1 -0
- package/dist/{chunk-QSVYI72E.cjs → chunk-RNQ3MDTR.cjs} +4 -4
- package/dist/{chunk-QSVYI72E.cjs.map → chunk-RNQ3MDTR.cjs.map} +1 -1
- package/dist/{chunk-HZ35LMO3.cjs → chunk-VJHDCYKE.cjs} +4 -4
- package/dist/{chunk-HZ35LMO3.cjs.map → chunk-VJHDCYKE.cjs.map} +1 -1
- package/dist/{chunk-3GWYFQSI.cjs → chunk-Z6M2CI63.cjs} +84 -79
- package/dist/chunk-Z6M2CI63.cjs.map +1 -0
- package/dist/collaboration/index.cjs +3 -3
- package/dist/collaboration/sharing/ShareControl.d.ts +10 -1
- package/dist/collaboration/sharing/ShareControl.js +64 -4
- package/dist/collaboration/sharing/ShareControl.js.map +2 -2
- package/dist/components/GridRowNavigator.d.ts +8 -1
- package/dist/components/GridRowNavigator.js +4 -2
- package/dist/components/GridRowNavigator.js.map +2 -2
- package/dist/connect/docx.cjs +10 -10
- package/dist/connect/index.cjs +816 -767
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +9 -9
- package/dist/connection/billing/ProjectDetail.d.ts +5 -1
- package/dist/connection/billing/ProjectDetail.js +82 -69
- package/dist/connection/billing/ProjectDetail.js.map +2 -2
- package/dist/connection/databases/ConnectedDatabasesPage.d.ts +7 -1
- package/dist/connection/databases/ConnectedDatabasesPage.js +18 -9
- package/dist/connection/databases/ConnectedDatabasesPage.js.map +2 -2
- package/dist/connection/databases/DatabaseWorkbench.d.ts +6 -1
- package/dist/connection/databases/DatabaseWorkbench.js +20 -15
- package/dist/connection/databases/DatabaseWorkbench.js.map +2 -2
- package/dist/connection/facts/factsSource.d.ts +2 -0
- package/dist/connection/facts/factsSource.js +10 -3
- package/dist/connection/facts/factsSource.js.map +2 -2
- package/dist/connection/files/page/ConnectedFilesPage.js +2 -1
- package/dist/connection/files/page/ConnectedFilesPage.js.map +2 -2
- package/dist/connection/projects/ConnectedProjectPage.d.ts +8 -1
- package/dist/connection/projects/ConnectedProjectPage.js +15 -1
- package/dist/connection/projects/ConnectedProjectPage.js.map +2 -2
- package/dist/connection/viewer/ConnectedDocumentViewer.d.ts +7 -0
- package/dist/connection/viewer/ConnectedDocumentViewer.js +28 -23
- package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
- package/dist/databases/DatabaseFilterMenu.d.ts +6 -1
- package/dist/databases/DatabaseFilterMenu.js +13 -4
- package/dist/databases/DatabaseFilterMenu.js.map +2 -2
- package/dist/databases/DatabaseToolbar.d.ts +11 -1
- package/dist/databases/DatabaseToolbar.js +26 -1
- package/dist/databases/DatabaseToolbar.js.map +2 -2
- package/dist/databases/index.cjs +70 -69
- package/dist/embed/index.cjs +13 -13
- package/dist/files/index.cjs +221 -221
- package/dist/index.cjs +242 -242
- package/dist/pages/index.cjs +21 -21
- 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/shell/index.cjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +24 -24
- 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/chunk-3GWYFQSI.cjs.map +0 -1
- package/dist/chunk-JAKLLNLL.cjs.map +0 -1
- package/dist/chunk-USYCBTKK.cjs.map +0 -1
- package/dist/chunk-WCT6FT2K.cjs +0 -87
- package/dist/chunk-WCT6FT2K.cjs.map +0 -1
package/dist/record/index.js
CHANGED
|
@@ -1,8 +1,354 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync, existsSync, writeFileSync, mkdirSync } from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
4
|
// src/record/index.ts
|
|
5
5
|
|
|
6
|
+
// src/record/band.ts
|
|
7
|
+
var BAND_HEIGHT = 64;
|
|
8
|
+
var PLAYER_STRIP = 84;
|
|
9
|
+
var CHUNK_MS = 100;
|
|
10
|
+
var BAND_LABEL_WIDTH = 360;
|
|
11
|
+
var BAND_BOX = {
|
|
12
|
+
x: BAND_LABEL_WIDTH,
|
|
13
|
+
y: 0,
|
|
14
|
+
width: 1600 - BAND_LABEL_WIDTH,
|
|
15
|
+
height: BAND_HEIGHT
|
|
16
|
+
};
|
|
17
|
+
var BAND_FRAME = "__BAND_FRAME__";
|
|
18
|
+
var DEFAULT_FONT = "'Space Grotesk', 'Trebuchet MS', system-ui, sans-serif";
|
|
19
|
+
var DEFAULT_FONT_URL = "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&display=swap";
|
|
20
|
+
var DEFAULT_GROUND = "#07090c";
|
|
21
|
+
var DEFAULT_TEXT = "#f6f0e2";
|
|
22
|
+
function captionChunks(text) {
|
|
23
|
+
const chunks = [];
|
|
24
|
+
let run = [];
|
|
25
|
+
for (const word of text.split(/\s+/).filter(Boolean)) {
|
|
26
|
+
run.push(word);
|
|
27
|
+
if (run.length === 3 || /[,.;:?!…]$/.test(word)) {
|
|
28
|
+
chunks.push(run.join(" "));
|
|
29
|
+
run = [];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (run.length) chunks.push(run.join(" "));
|
|
33
|
+
return chunks;
|
|
34
|
+
}
|
|
35
|
+
function readingMs(text) {
|
|
36
|
+
return Math.min(4200, 900 + text.length * 45);
|
|
37
|
+
}
|
|
38
|
+
async function installBand(page, skin, options = {}) {
|
|
39
|
+
const frame = `calc(100dvh - ${BAND_HEIGHT + PLAYER_STRIP}px)`;
|
|
40
|
+
await page.addInitScript(
|
|
41
|
+
({ H, B, L, ink, accent, sans, ground, text, root, extra, fontUrl }) => {
|
|
42
|
+
const boot = () => {
|
|
43
|
+
if (document.getElementById("__band")) return;
|
|
44
|
+
const w = window;
|
|
45
|
+
const style = document.createElement("style");
|
|
46
|
+
style.textContent = `
|
|
47
|
+
html, body { background: ${ink} !important; }
|
|
48
|
+
/* The app sits between the band and the player's strip. Its transform keeps the app's own
|
|
49
|
+
* fixed parts (the toasts) inside it; the dialogs and menus, portalled to the body, open
|
|
50
|
+
* at the viewport's centre, which is the app's. */
|
|
51
|
+
${root} {
|
|
52
|
+
position: fixed !important; top: ${H}px; bottom: ${B}px; left: 0; right: 0; height: auto !important;
|
|
53
|
+
overflow: hidden; transform: translateZ(0); background: var(--color-background, #fff);
|
|
54
|
+
}
|
|
55
|
+
.h-dvh, .h-screen, .h-svh, .h-lvh { height: calc(100dvh - ${H + B}px) !important; }
|
|
56
|
+
.min-h-dvh, .min-h-screen, .min-h-svh, .min-h-lvh { min-height: calc(100dvh - ${H + B}px) !important; }
|
|
57
|
+
.max-h-dvh, .max-h-screen { max-height: calc(100dvh - ${H + B}px) !important; }
|
|
58
|
+
${extra}
|
|
59
|
+
/* The stage's floating caption stays hidden: captions are painted in the band. */
|
|
60
|
+
#__cine_cap { display: none !important; }
|
|
61
|
+
#__band_cap span { opacity: 0; transition: opacity .18s ease-out; }
|
|
62
|
+
#__band_cap span.on { opacity: 1; }
|
|
63
|
+
/* A click: at full strength for a moment, then the ring spreads out and fades. */
|
|
64
|
+
@keyframes __band_ring {
|
|
65
|
+
0% { width: 18px; height: 18px; margin: -9px 0 0 -9px; opacity: 1; }
|
|
66
|
+
45% { opacity: 1; }
|
|
67
|
+
100% { width: 72px; height: 72px; margin: -36px 0 0 -36px; opacity: 0; border-width: 2px; }
|
|
68
|
+
}
|
|
69
|
+
@keyframes __band_dot { 0% { transform: scale(.4); opacity: 1; } 45% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.1); opacity: 0; } }
|
|
70
|
+
`;
|
|
71
|
+
document.head.appendChild(style);
|
|
72
|
+
if (fontUrl) {
|
|
73
|
+
const font = document.createElement("link");
|
|
74
|
+
font.rel = "stylesheet";
|
|
75
|
+
font.href = fontUrl;
|
|
76
|
+
document.head.appendChild(font);
|
|
77
|
+
}
|
|
78
|
+
const bar = (edge, height) => {
|
|
79
|
+
const el = document.createElement("div");
|
|
80
|
+
el.style.cssText = `position:fixed;left:0;right:0;${edge}:0;height:${height}px;z-index:2147483645;background:${ground};display:flex;box-shadow:inset 0 ${edge === "top" ? -3 : 3}px 0 ${accent};align-items:center;pointer-events:none;font-family:${sans};`;
|
|
81
|
+
document.body.appendChild(el);
|
|
82
|
+
return el;
|
|
83
|
+
};
|
|
84
|
+
const band = bar("top", H);
|
|
85
|
+
band.id = "__band";
|
|
86
|
+
bar("bottom", B).id = "__band_strip";
|
|
87
|
+
const label = document.createElement("div");
|
|
88
|
+
label.style.cssText = `width:${L}px;flex:none;padding:0 24px;display:flex;flex-direction:column;justify-content:center;gap:4px;`;
|
|
89
|
+
const kicker = document.createElement("div");
|
|
90
|
+
kicker.id = "__band_kicker";
|
|
91
|
+
kicker.style.cssText = `font:600 12px/1 ${sans};letter-spacing:.12em;text-transform:uppercase;color:${accent};`;
|
|
92
|
+
const name = document.createElement("div");
|
|
93
|
+
name.id = "__band_feature";
|
|
94
|
+
name.style.cssText = `font:700 20px/1.2 ${sans};color:${text};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;`;
|
|
95
|
+
label.append(kicker, name);
|
|
96
|
+
const cap = document.createElement("div");
|
|
97
|
+
cap.id = "__band_cap";
|
|
98
|
+
cap.style.cssText = `flex:1;min-width:0;height:100%;display:flex;align-items:center;padding:0 28px 0 24px;border-left:2px solid ${accent}66;font:500 19px/1.3 ${sans};color:${text};letter-spacing:.01em;`;
|
|
99
|
+
const words = document.createElement("div");
|
|
100
|
+
words.style.cssText = "display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;";
|
|
101
|
+
cap.appendChild(words);
|
|
102
|
+
band.append(label, cap);
|
|
103
|
+
const show = (k, n) => {
|
|
104
|
+
kicker.textContent = k;
|
|
105
|
+
name.textContent = n;
|
|
106
|
+
};
|
|
107
|
+
w.__band_feature = (k, n) => {
|
|
108
|
+
sessionStorage.setItem("__band_feature", JSON.stringify([k, n]));
|
|
109
|
+
show(k, n);
|
|
110
|
+
};
|
|
111
|
+
let timers = [];
|
|
112
|
+
let clearer = 0;
|
|
113
|
+
const paint = (line, chunks, chunkMs) => {
|
|
114
|
+
timers.forEach(clearTimeout);
|
|
115
|
+
timers = [];
|
|
116
|
+
words.textContent = "";
|
|
117
|
+
words.dataset.text = line;
|
|
118
|
+
chunks.forEach((chunk, i) => {
|
|
119
|
+
const span = document.createElement("span");
|
|
120
|
+
span.textContent = chunk;
|
|
121
|
+
words.append(span, i < chunks.length - 1 ? " " : "");
|
|
122
|
+
if (chunkMs <= 0) span.classList.add("on");
|
|
123
|
+
else timers.push(window.setTimeout(() => span.classList.add("on"), i * chunkMs));
|
|
124
|
+
});
|
|
125
|
+
return chunkMs > 0 ? chunks.length * chunkMs : 0;
|
|
126
|
+
};
|
|
127
|
+
w.__band_say = (line, chunks, chunkMs = 100, clearMs = 0) => {
|
|
128
|
+
window.clearTimeout(clearer);
|
|
129
|
+
sessionStorage.setItem(
|
|
130
|
+
"__band_cap",
|
|
131
|
+
JSON.stringify([line, clearMs > 0 ? Date.now() + clearMs : 0])
|
|
132
|
+
);
|
|
133
|
+
if (clearMs > 0) clearer = window.setTimeout(() => w.__band_say?.("", []), clearMs);
|
|
134
|
+
if (line && words.dataset.text === line) return 0;
|
|
135
|
+
return paint(line, chunks, chunkMs);
|
|
136
|
+
};
|
|
137
|
+
window.__cine_cap = (t) => void w.__band_say?.(t, t ? [t] : [], 0);
|
|
138
|
+
const pulse = (x, y) => {
|
|
139
|
+
const dot = document.createElement("div");
|
|
140
|
+
dot.style.cssText = `position:fixed;left:${x}px;top:${y}px;z-index:2147483646;width:34px;height:34px;margin:-17px 0 0 -17px;border-radius:50%;pointer-events:none;background:${accent}99;box-shadow:0 0 0 2px rgba(255,255,255,.8);animation:__band_dot .6s ease-out forwards;`;
|
|
141
|
+
const ring = document.createElement("div");
|
|
142
|
+
ring.style.cssText = `position:fixed;left:${x}px;top:${y}px;z-index:2147483646;width:18px;height:18px;margin:-9px 0 0 -9px;border-radius:50%;pointer-events:none;border:4px solid ${accent};box-shadow:0 0 0 2px #fff,0 0 0 3.5px ${ink}55,0 0 18px ${accent}aa;animation:__band_ring .75s cubic-bezier(.3,.6,.4,1) forwards;`;
|
|
143
|
+
document.body.append(dot, ring);
|
|
144
|
+
window.setTimeout(() => {
|
|
145
|
+
dot.remove();
|
|
146
|
+
ring.remove();
|
|
147
|
+
}, 800);
|
|
148
|
+
};
|
|
149
|
+
w.__band_pulse = pulse;
|
|
150
|
+
const press = (down) => {
|
|
151
|
+
const cursor = document.getElementById("__cine_cursor");
|
|
152
|
+
if (!cursor) return;
|
|
153
|
+
const moved = cursor.style.transform.replace(/\s*scale\([^)]*\)/, "");
|
|
154
|
+
cursor.style.transform = down ? `${moved} scale(.72)` : moved;
|
|
155
|
+
};
|
|
156
|
+
window.addEventListener(
|
|
157
|
+
"pointerdown",
|
|
158
|
+
(e) => {
|
|
159
|
+
pulse(e.clientX, e.clientY);
|
|
160
|
+
press(true);
|
|
161
|
+
},
|
|
162
|
+
true
|
|
163
|
+
);
|
|
164
|
+
window.addEventListener("pointerup", () => press(false), true);
|
|
165
|
+
try {
|
|
166
|
+
const saved = JSON.parse(sessionStorage.getItem("__band_feature") || "null");
|
|
167
|
+
if (saved) show(saved[0], saved[1]);
|
|
168
|
+
const [line, until] = JSON.parse(sessionStorage.getItem("__band_cap") || '["",0]');
|
|
169
|
+
if (line && (!until || until > Date.now())) {
|
|
170
|
+
paint(line, [line], 0);
|
|
171
|
+
if (until) clearer = window.setTimeout(() => w.__band_say?.("", []), until - Date.now());
|
|
172
|
+
}
|
|
173
|
+
} catch {
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
if (document.body) boot();
|
|
177
|
+
else document.addEventListener("DOMContentLoaded", boot);
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
H: BAND_HEIGHT,
|
|
181
|
+
B: PLAYER_STRIP,
|
|
182
|
+
L: BAND_LABEL_WIDTH,
|
|
183
|
+
ink: skin.ink,
|
|
184
|
+
accent: skin.accent,
|
|
185
|
+
sans: options.font ?? DEFAULT_FONT,
|
|
186
|
+
ground: options.ground ?? DEFAULT_GROUND,
|
|
187
|
+
text: options.text ?? DEFAULT_TEXT,
|
|
188
|
+
root: options.root ?? "#root",
|
|
189
|
+
extra: (options.css ?? "").split(BAND_FRAME).join(frame),
|
|
190
|
+
fontUrl: options.fontUrl === void 0 ? DEFAULT_FONT_URL : options.fontUrl
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
async function feature(page, kicker, name) {
|
|
195
|
+
await page.evaluate(
|
|
196
|
+
([k, n]) => window.__band_feature?.(k, n),
|
|
197
|
+
[kicker, name]
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
async function bandSay(page, text, holdMs, clearMs = 0) {
|
|
201
|
+
const reveal = await page.evaluate(
|
|
202
|
+
([t, chunks, ms, clear]) => window.__band_say?.(t, chunks, ms, clear) ?? 0,
|
|
203
|
+
[text, captionChunks(text), CHUNK_MS, clearMs]
|
|
204
|
+
) ?? 0;
|
|
205
|
+
if (holdMs === 0 || !text) return;
|
|
206
|
+
await page.waitForTimeout(Math.max(holdMs ?? readingMs(text), reveal + 1500));
|
|
207
|
+
}
|
|
208
|
+
async function pulseAt(page, box) {
|
|
209
|
+
if (!box) return;
|
|
210
|
+
await page.evaluate(
|
|
211
|
+
([x, y]) => window.__band_pulse?.(x, y),
|
|
212
|
+
[box.x + box.width / 2, box.y + box.height / 2]
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
async function interlude(page, skin, card, holdMs) {
|
|
216
|
+
const FADE = 350;
|
|
217
|
+
await page.evaluate(
|
|
218
|
+
({ card: card2, ink, accent, sans, FADE: FADE2, H, B }) => {
|
|
219
|
+
document.getElementById("__interlude")?.remove();
|
|
220
|
+
const veil = document.createElement("div");
|
|
221
|
+
veil.id = "__interlude";
|
|
222
|
+
veil.style.cssText = `position:fixed;left:0;right:0;top:${H}px;bottom:${B}px;z-index:2147483644;display:flex;align-items:center;justify-content:center;pointer-events:none;background:rgba(8,14,24,.38);opacity:0;transition:opacity ${FADE2}ms ease;font-family:${sans};`;
|
|
223
|
+
const box = document.createElement("div");
|
|
224
|
+
box.style.cssText = `width:760px;max-width:80%;padding:34px 44px 38px;border-radius:18px;color:#fff;background:linear-gradient(135deg, ${ink} 0%, ${ink} 55%, ${accent}66 140%);box-shadow:0 24px 70px rgba(0,0,0,.45), inset 0 0 0 1px ${accent}55;transform:translateY(10px) scale(.98);transition:transform ${FADE2}ms ease;`;
|
|
225
|
+
const k = document.createElement("div");
|
|
226
|
+
k.textContent = card2.kicker;
|
|
227
|
+
k.style.cssText = `font-size:14px;letter-spacing:.14em;text-transform:uppercase;color:${accent};font-weight:600;margin-bottom:12px;`;
|
|
228
|
+
const t = document.createElement("div");
|
|
229
|
+
t.textContent = card2.title;
|
|
230
|
+
t.style.cssText = "font-size:38px;line-height:1.15;font-weight:700;margin-bottom:12px;";
|
|
231
|
+
const s = document.createElement("div");
|
|
232
|
+
s.textContent = card2.subtitle ?? "";
|
|
233
|
+
s.style.cssText = "font-size:18px;line-height:1.45;color:#c8d3dd;";
|
|
234
|
+
box.append(k, t, s);
|
|
235
|
+
veil.append(box);
|
|
236
|
+
document.body.append(veil);
|
|
237
|
+
requestAnimationFrame(
|
|
238
|
+
() => requestAnimationFrame(() => {
|
|
239
|
+
veil.style.opacity = "1";
|
|
240
|
+
box.style.transform = "none";
|
|
241
|
+
})
|
|
242
|
+
);
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
card,
|
|
246
|
+
ink: skin.ink,
|
|
247
|
+
accent: skin.accent,
|
|
248
|
+
sans: skin.sansFont,
|
|
249
|
+
FADE,
|
|
250
|
+
H: BAND_HEIGHT,
|
|
251
|
+
B: PLAYER_STRIP
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
await page.waitForTimeout(FADE + holdMs);
|
|
255
|
+
await page.evaluate((fade) => {
|
|
256
|
+
const veil = document.getElementById("__interlude");
|
|
257
|
+
if (!veil) return;
|
|
258
|
+
veil.style.opacity = "0";
|
|
259
|
+
window.setTimeout(() => veil.remove(), fade + 50);
|
|
260
|
+
}, FADE);
|
|
261
|
+
await page.waitForTimeout(FADE + 50);
|
|
262
|
+
}
|
|
263
|
+
var NARRATION_GAP_MS = 520;
|
|
264
|
+
var NARRATION_LINGER_MS = 700;
|
|
265
|
+
function readingSeconds(text) {
|
|
266
|
+
return 1 + text.split(/\s+/).filter(Boolean).length / 2.9;
|
|
267
|
+
}
|
|
268
|
+
var Narrator = class {
|
|
269
|
+
constructor(take, story, options = {}) {
|
|
270
|
+
this.take = take;
|
|
271
|
+
const scriptFile = path.resolve(options.scriptDir ?? "e2e/record", `${story}.narration.json`);
|
|
272
|
+
const script = JSON.parse(readFileSync(scriptFile, "utf8"));
|
|
273
|
+
const clips = path.resolve(options.clipsDir ?? "e2e/videos/narration", story);
|
|
274
|
+
const manifest = path.join(clips, "manifest.json");
|
|
275
|
+
const spoken = existsSync(manifest) ? JSON.parse(readFileSync(manifest, "utf8")).lines : {};
|
|
276
|
+
this.voiced = Object.keys(spoken).length > 0;
|
|
277
|
+
for (const { id, text } of script.lines) {
|
|
278
|
+
const clip = spoken[id];
|
|
279
|
+
this.lines.set(
|
|
280
|
+
id,
|
|
281
|
+
clip && clip.text === text ? { text, duration: clip.duration, file: path.join(clips, clip.file) } : { text, duration: readingSeconds(text) }
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
this.stale = [...this.lines].filter(([, l]) => !l.file).map(([id]) => id);
|
|
285
|
+
if (this.voiced && this.stale.length)
|
|
286
|
+
console.warn(`[narration] not spoken yet (run arbidocs-voice-take): ${this.stale.join(", ")}`);
|
|
287
|
+
this.logFile = take.focusFile.replace(/\.focus\.json$/, ".narration.json");
|
|
288
|
+
this.save();
|
|
289
|
+
}
|
|
290
|
+
take;
|
|
291
|
+
lines = /* @__PURE__ */ new Map();
|
|
292
|
+
said = [];
|
|
293
|
+
logFile;
|
|
294
|
+
until = 0;
|
|
295
|
+
/** Whether any line has a clip (else the take is a silent rehearsal, paced by reading time). */
|
|
296
|
+
voiced;
|
|
297
|
+
/** The lines whose clip is missing or was spoken from other words. */
|
|
298
|
+
stale;
|
|
299
|
+
/** The line `id` of the script. */
|
|
300
|
+
line(id) {
|
|
301
|
+
const line = this.lines.get(id);
|
|
302
|
+
if (!line) throw new Error(`no line "${id}" in the narration`);
|
|
303
|
+
return line;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Say the line `id`, captioned in the band: once the line before it has ended, and held until
|
|
307
|
+
* it has been said, and `afterMs` more. `over`: return at once, the line said over what the
|
|
308
|
+
* story does next (start a line as the screen begins to change, so the speech covers the change
|
|
309
|
+
* instead of waiting for it). `caption: false` for a line said over a card, which covers the
|
|
310
|
+
* band: the frame stays still as the card fades in.
|
|
311
|
+
*/
|
|
312
|
+
async say(id, { over = false, afterMs = 0, caption = true } = {}) {
|
|
313
|
+
const line = this.line(id);
|
|
314
|
+
await this.hush();
|
|
315
|
+
let start = this.take.now();
|
|
316
|
+
if (caption) {
|
|
317
|
+
await bandSay(this.take.page, line.text, 0, line.duration * 1e3 + NARRATION_LINGER_MS);
|
|
318
|
+
start = this.take.now();
|
|
319
|
+
}
|
|
320
|
+
this.until = start + line.duration;
|
|
321
|
+
this.take.record({
|
|
322
|
+
kind: "read",
|
|
323
|
+
mode: "none",
|
|
324
|
+
label: `narration: ${id}`,
|
|
325
|
+
start,
|
|
326
|
+
end: this.until,
|
|
327
|
+
box: BAND_BOX
|
|
328
|
+
});
|
|
329
|
+
this.said.push({
|
|
330
|
+
id,
|
|
331
|
+
start: Math.round(start * 1e3) / 1e3,
|
|
332
|
+
duration: line.duration,
|
|
333
|
+
file: line.file,
|
|
334
|
+
caption
|
|
335
|
+
});
|
|
336
|
+
this.save();
|
|
337
|
+
if (!over) await this.hush(afterMs);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Wait for the line being said to end, a narrator's breath after it (and `extraMs`). Call it
|
|
341
|
+
* before any logged wait and before a card: speech cannot be cut.
|
|
342
|
+
*/
|
|
343
|
+
async hush(extraMs = 0) {
|
|
344
|
+
const left = (this.until - this.take.now()) * 1e3 + NARRATION_GAP_MS + extraMs;
|
|
345
|
+
if (left > 0) await this.take.page.waitForTimeout(left);
|
|
346
|
+
}
|
|
347
|
+
save() {
|
|
348
|
+
writeFileSync(this.logFile, JSON.stringify({ lines: this.said }, null, 1));
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
6
352
|
// src/record/runs.ts
|
|
7
353
|
async function spaGo(page, url) {
|
|
8
354
|
await page.evaluate((to) => {
|
|
@@ -11,12 +357,12 @@ async function spaGo(page, url) {
|
|
|
11
357
|
}, url);
|
|
12
358
|
}
|
|
13
359
|
async function openWordById(take, documentId, {
|
|
14
|
-
path:
|
|
360
|
+
path: path3 = "/app/documents",
|
|
15
361
|
lowerThird,
|
|
16
362
|
timeoutMs = 12e4
|
|
17
363
|
} = {}) {
|
|
18
364
|
const { page } = take;
|
|
19
|
-
await spaGo(page, `${
|
|
365
|
+
await spaGo(page, `${path3}?doc=${encodeURIComponent(documentId)}`);
|
|
20
366
|
const editor = page.getByTestId("native-docx-editor");
|
|
21
367
|
await take.wait(
|
|
22
368
|
"word: editor opens",
|
|
@@ -177,12 +523,12 @@ function createRunKit(cine, config = {}) {
|
|
|
177
523
|
);
|
|
178
524
|
}
|
|
179
525
|
async function resumeRun(page, { env = "E2E_RESUME_RUN", readyTestId } = {}) {
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
182
|
-
await spaGo(page,
|
|
526
|
+
const path3 = process.env[env];
|
|
527
|
+
if (!path3) return null;
|
|
528
|
+
await spaGo(page, path3);
|
|
183
529
|
const ready = readyTestId ? page.getByTestId(readyTestId) : page.locator(`[data-testid^="${prefix}-step-"], [data-testid^="workflow-thread-step-"]`);
|
|
184
530
|
await ready.first().waitFor({ state: "visible", timeout: 6e4 });
|
|
185
|
-
return
|
|
531
|
+
return path3;
|
|
186
532
|
}
|
|
187
533
|
return { stepChip, currentStep, whileWorking, driveRun, approveStep, pickTile, resumeRun };
|
|
188
534
|
}
|
|
@@ -364,6 +710,8 @@ function createCinematic(config) {
|
|
|
364
710
|
logout: config.testIds?.logout ?? "app-logout"
|
|
365
711
|
};
|
|
366
712
|
const toastSelector = config.toastSelector ?? "[data-sonner-toast]";
|
|
713
|
+
const style = config.style ?? "band";
|
|
714
|
+
const band = style === "band";
|
|
367
715
|
const resolve = (page, t) => typeof t === "string" ? page.getByTestId(t) : t;
|
|
368
716
|
async function boxOf(page, loc) {
|
|
369
717
|
const box = await loc.boundingBox().catch(() => null);
|
|
@@ -387,7 +735,7 @@ function createCinematic(config) {
|
|
|
387
735
|
return { loc, box };
|
|
388
736
|
}
|
|
389
737
|
async function take(page, options) {
|
|
390
|
-
return new Take(page, options, b);
|
|
738
|
+
return new Take(page, band ? { zoom: false, pip: false, ...options } : options, b);
|
|
391
739
|
}
|
|
392
740
|
async function installStage(page) {
|
|
393
741
|
await page.addInitScript(
|
|
@@ -420,9 +768,9 @@ function createCinematic(config) {
|
|
|
420
768
|
cap.id = "__cine_cap";
|
|
421
769
|
cap.style.cssText = `position:fixed;left:50%;bottom:34px;transform:translateX(-50%) translateY(8px);z-index:2147483646;max-width:72%;padding:13px 24px;border-radius:13px;font:500 17px/1.45 ${s.sansFont};color:#fff;letter-spacing:.01em;background:${s.ink}e0;backdrop-filter:blur(7px);box-shadow:0 10px 34px rgba(0,0,0,.4);text-align:center;opacity:0;transition:opacity .35s,transform .35s;`;
|
|
422
770
|
document.body.appendChild(cap);
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
document.head.appendChild(
|
|
771
|
+
const style2 = document.createElement("style");
|
|
772
|
+
style2.textContent = "@keyframes __cine_ripple{to{width:46px;height:46px;margin:-23px 0 0 -23px;opacity:0}}";
|
|
773
|
+
document.head.appendChild(style2);
|
|
426
774
|
window.__cine_cap = (t) => {
|
|
427
775
|
cap.textContent = t;
|
|
428
776
|
cap.style.opacity = t ? "1" : "0";
|
|
@@ -453,6 +801,27 @@ function createCinematic(config) {
|
|
|
453
801
|
},
|
|
454
802
|
{ s: skin, t0: Take.on(page)?.t0 ?? null, TC: TIMECODE_CELL }
|
|
455
803
|
);
|
|
804
|
+
if (band) await installBand(page, skin, config.band);
|
|
805
|
+
}
|
|
806
|
+
async function feature2(page, kicker, name) {
|
|
807
|
+
if (band) await feature(page, kicker, name);
|
|
808
|
+
}
|
|
809
|
+
async function pulseAt2(page, box) {
|
|
810
|
+
if (band) await pulseAt(page, box);
|
|
811
|
+
}
|
|
812
|
+
async function interlude2(page, card, holdMs = 2200) {
|
|
813
|
+
if (!band) throw new Error("interlude is the band style's card: use chapter() in 'overlay'");
|
|
814
|
+
await interlude(page, skin, card, holdMs);
|
|
815
|
+
}
|
|
816
|
+
async function still(page) {
|
|
817
|
+
const toasts = page.locator(toastSelector);
|
|
818
|
+
const until = Date.now() + 8e3;
|
|
819
|
+
while (await toasts.count() && Date.now() < until) await page.waitForTimeout(200);
|
|
820
|
+
await page.waitForTimeout(500);
|
|
821
|
+
}
|
|
822
|
+
function narrator(take2, story, options) {
|
|
823
|
+
if (!band) throw new Error("a narrated take is captioned in the band: not in 'overlay'");
|
|
824
|
+
return new Narrator(take2, story, options);
|
|
456
825
|
}
|
|
457
826
|
async function cover(page, { kicker, title, subtitle }, holdMs = 2600) {
|
|
458
827
|
const running = Take.on(page);
|
|
@@ -495,18 +864,30 @@ function createCinematic(config) {
|
|
|
495
864
|
}
|
|
496
865
|
async function caption(page, text, holdMs) {
|
|
497
866
|
const running = Take.on(page);
|
|
498
|
-
|
|
867
|
+
const hold = holdMs ?? readingMs(text);
|
|
868
|
+
if (band) {
|
|
869
|
+
const start = running?.now() ?? 0;
|
|
870
|
+
await bandSay(page, text, 0);
|
|
871
|
+
running?.record({
|
|
872
|
+
kind: "read",
|
|
873
|
+
mode: "none",
|
|
874
|
+
label: "caption",
|
|
875
|
+
start,
|
|
876
|
+
end: start + hold / 1e3,
|
|
877
|
+
box: BAND_BOX
|
|
878
|
+
});
|
|
879
|
+
} else if (running) running.captionStart(text);
|
|
499
880
|
else
|
|
500
881
|
await page.evaluate(
|
|
501
882
|
(t) => window.__cine_cap?.(t),
|
|
502
883
|
text
|
|
503
884
|
);
|
|
504
|
-
const hold = holdMs ?? Math.min(4200, 900 + text.length * 45);
|
|
505
885
|
await page.waitForTimeout(hold);
|
|
506
886
|
}
|
|
507
887
|
async function clearCaption(page) {
|
|
508
888
|
const running = Take.on(page);
|
|
509
|
-
if (
|
|
889
|
+
if (band) await bandSay(page, "", 0);
|
|
890
|
+
else if (running) running.captionEnd();
|
|
510
891
|
else
|
|
511
892
|
await page.evaluate(
|
|
512
893
|
() => window.__cine_cap?.("")
|
|
@@ -610,8 +991,14 @@ function createCinematic(config) {
|
|
|
610
991
|
await page.getByTestId(ids.userMenu).waitFor({ state: "visible", timeout: 6e4 });
|
|
611
992
|
}
|
|
612
993
|
return {
|
|
994
|
+
style,
|
|
613
995
|
take,
|
|
614
996
|
installStage,
|
|
997
|
+
feature: feature2,
|
|
998
|
+
pulseAt: pulseAt2,
|
|
999
|
+
interlude: interlude2,
|
|
1000
|
+
still,
|
|
1001
|
+
narrator,
|
|
615
1002
|
cover,
|
|
616
1003
|
chapter,
|
|
617
1004
|
uncover,
|
|
@@ -630,6 +1017,6 @@ function createCinematic(config) {
|
|
|
630
1017
|
};
|
|
631
1018
|
}
|
|
632
1019
|
|
|
633
|
-
export { TIMECODE_CELL, Take, cinematicSkin, createCinematic, createRunKit, fillSecret, openWordById, spaGo };
|
|
1020
|
+
export { BAND_BOX, BAND_FRAME, BAND_HEIGHT, BAND_LABEL_WIDTH, CHUNK_MS, NARRATION_GAP_MS, NARRATION_LINGER_MS, Narrator, PLAYER_STRIP, TIMECODE_CELL, Take, bandSay, captionChunks, cinematicSkin, createCinematic, createRunKit, fillSecret, installBand, openWordById, readingMs, readingSeconds, spaGo };
|
|
634
1021
|
//# sourceMappingURL=index.js.map
|
|
635
1022
|
//# sourceMappingURL=index.js.map
|