deictic 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/annotations/client.d.ts +4 -0
- package/dist/annotations/client.d.ts.map +1 -0
- package/dist/annotations/client.js +497 -0
- package/dist/annotations/client.js.map +1 -0
- package/dist/annotations/index.d.ts +110 -0
- package/dist/annotations/index.d.ts.map +1 -0
- package/dist/annotations/index.js +22 -0
- package/dist/annotations/index.js.map +1 -0
- package/dist/astro.d.ts +29 -0
- package/dist/astro.d.ts.map +1 -0
- package/dist/astro.js +24 -0
- package/dist/astro.js.map +1 -0
- package/dist/bun.d.ts +12 -0
- package/dist/bun.d.ts.map +1 -0
- package/dist/bun.js +67 -0
- package/dist/bun.js.map +1 -0
- package/dist/client/index.d.ts +95 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +1333 -0
- package/dist/client/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +15 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +17 -0
- package/dist/loader.js.map +1 -0
- package/dist/next.d.ts +17 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +150 -0
- package/dist/next.js.map +1 -0
- package/dist/recommended/index.d.ts +25 -0
- package/dist/recommended/index.d.ts.map +1 -0
- package/dist/recommended/index.js +19 -0
- package/dist/recommended/index.js.map +1 -0
- package/dist/recordings/client.d.ts +4 -0
- package/dist/recordings/client.d.ts.map +1 -0
- package/dist/recordings/client.js +376 -0
- package/dist/recordings/client.js.map +1 -0
- package/dist/recordings/index.d.ts +2 -0
- package/dist/recordings/index.js +3 -0
- package/dist/screenshots/client.d.ts +23 -0
- package/dist/screenshots/client.d.ts.map +1 -0
- package/dist/screenshots/client.js +76 -0
- package/dist/screenshots/client.js.map +1 -0
- package/dist/screenshots/dom.d.ts +4 -0
- package/dist/screenshots/dom.d.ts.map +1 -0
- package/dist/screenshots/dom.js +92 -0
- package/dist/screenshots/dom.js.map +1 -0
- package/dist/screenshots/index.d.ts +2 -0
- package/dist/screenshots/index.js +98 -0
- package/dist/screenshots/index.js.map +1 -0
- package/dist/screenshots/rrweb.d.ts +9 -0
- package/dist/screenshots/rrweb.d.ts.map +1 -0
- package/dist/screenshots/rrweb.js +60 -0
- package/dist/screenshots/rrweb.js.map +1 -0
- package/dist/shared/endpoints.js +354 -0
- package/dist/shared/endpoints.js.map +1 -0
- package/dist/shared/index.d.ts +226 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index2.d.ts +98 -0
- package/dist/shared/index2.d.ts.map +1 -0
- package/dist/shared/index3.d.ts +86 -0
- package/dist/shared/index3.d.ts.map +1 -0
- package/dist/shared/index4.d.ts +184 -0
- package/dist/shared/index4.d.ts.map +1 -0
- package/dist/shared/index5.d.ts +70 -0
- package/dist/shared/index5.d.ts.map +1 -0
- package/dist/shared/integration.d.ts +20 -0
- package/dist/shared/integration.d.ts.map +1 -0
- package/dist/shared/integration.js +279 -0
- package/dist/shared/integration.js.map +1 -0
- package/dist/shared/kept.js +23 -0
- package/dist/shared/kept.js.map +1 -0
- package/dist/shared/marks.js +14 -0
- package/dist/shared/marks.js.map +1 -0
- package/dist/shared/playwright.js +105 -0
- package/dist/shared/playwright.js.map +1 -0
- package/dist/shared/recordings.js +246 -0
- package/dist/shared/recordings.js.map +1 -0
- package/dist/shared/shortcut.js +63 -0
- package/dist/shared/shortcut.js.map +1 -0
- package/dist/shared/tasks.js +521 -0
- package/dist/shared/tasks.js.map +1 -0
- package/dist/shared/waveform.js +93 -0
- package/dist/shared/waveform.js.map +1 -0
- package/dist/tailwind/client.d.ts +4 -0
- package/dist/tailwind/client.d.ts.map +1 -0
- package/dist/tailwind/client.js +613 -0
- package/dist/tailwind/client.js.map +1 -0
- package/dist/tailwind/index.d.ts +2 -0
- package/dist/tailwind/index.js +557 -0
- package/dist/tailwind/index.js.map +1 -0
- package/dist/tasks/client.d.ts +6 -0
- package/dist/tasks/client.d.ts.map +1 -0
- package/dist/tasks/client.js +642 -0
- package/dist/tasks/client.js.map +1 -0
- package/dist/tasks/index.d.ts +2 -0
- package/dist/tasks/index.js +1 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +61 -0
- package/dist/vite.js.map +1 -0
- package/dist/voice/client.d.ts +4 -0
- package/dist/voice/client.d.ts.map +1 -0
- package/dist/voice/client.js +66 -0
- package/dist/voice/client.js.map +1 -0
- package/dist/voice/index.d.ts +47 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +74 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/webpack.d.ts +50 -0
- package/dist/webpack.d.ts.map +1 -0
- package/dist/webpack.js +78 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +307 -7
- package/skills/deictic/SKILL.md +47 -0
- package/skills/deictic/references/install.md +96 -0
- package/skills/deictic/references/recordings.md +83 -0
- package/skills/deictic/references/tasks.md +79 -0
- package/skills/deictic/references/watch.md +43 -0
- package/skills/deictic/scripts/frame.mjs +62 -0
- package/skills/deictic/scripts/lib.mjs +211 -0
- package/skills/deictic/scripts/recording.mjs +186 -0
- package/skills/deictic/scripts/task.mjs +84 -0
- package/skills/deictic/scripts/transcribe.mjs +93 -0
- package/skills/deictic/scripts/voice.mjs +50 -0
- package/skills/deictic/scripts/watch.mjs +51 -0
- package/src/astro.ts +34 -0
- package/src/bun.ts +79 -0
- package/src/client/index.ts +846 -0
- package/src/client/lightbox.ts +256 -0
- package/src/client/style.ts +243 -0
- package/src/client/tooltip.ts +78 -0
- package/src/client/waveform.ts +98 -0
- package/src/index.ts +247 -0
- package/src/loader.ts +28 -0
- package/src/next.ts +133 -0
- package/src/plugins/annotations/client.ts +301 -0
- package/src/plugins/annotations/draw.ts +169 -0
- package/src/plugins/annotations/index.ts +105 -0
- package/src/plugins/annotations/svg.ts +61 -0
- package/src/plugins/recommended/index.ts +35 -0
- package/src/plugins/recordings/client.ts +316 -0
- package/src/plugins/recordings/index.ts +175 -0
- package/src/plugins/recordings/marks.ts +11 -0
- package/src/plugins/recordings/ours.ts +70 -0
- package/src/plugins/recordings/replay.ts +165 -0
- package/src/plugins/screenshots/client.ts +64 -0
- package/src/plugins/screenshots/dom.ts +79 -0
- package/src/plugins/screenshots/index.ts +194 -0
- package/src/plugins/screenshots/playwright.ts +119 -0
- package/src/plugins/screenshots/rrweb.ts +45 -0
- package/src/plugins/tailwind/catalog.ts +396 -0
- package/src/plugins/tailwind/client.ts +669 -0
- package/src/plugins/tailwind/index.ts +267 -0
- package/src/plugins/tasks/client.ts +622 -0
- package/src/plugins/tasks/index.ts +557 -0
- package/src/plugins/tasks/local.ts +170 -0
- package/src/plugins/voice/client.ts +58 -0
- package/src/plugins/voice/index.ts +114 -0
- package/src/shortcut.ts +83 -0
- package/src/tools/astro.ts +81 -0
- package/src/tools/editor.ts +22 -0
- package/src/tools/endpoints.ts +163 -0
- package/src/tools/history.ts +203 -0
- package/src/tools/integration.ts +108 -0
- package/src/tools/kept.ts +21 -0
- package/src/tools/locate.ts +94 -0
- package/src/tools/plugins.ts +41 -0
- package/src/tools/source.ts +72 -0
- package/src/vite.ts +81 -0
- package/src/webpack.ts +107 -0
- package/index.js +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// src/client/waveform.ts
|
|
2
|
+
/**
|
|
3
|
+
* Waveforms: a clip's, read off its audio, drawn as bars with what's played in the accent; and a mic's live,
|
|
4
|
+
* a meter scrolling left as it hears. For the lightbox's player and whatever records the mic (the task
|
|
5
|
+
* panel's Voice, the recording toolbar's mic). Bars, not a line: they read at any size, and at a glance.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* How loud each of `bars` stretches of the clip at `url` is, from 0 to 1, the loudest 1, and how long it is in
|
|
9
|
+
* seconds: MediaRecorder's webm doesn't say until it's played through.
|
|
10
|
+
*/
|
|
11
|
+
async function peaksOf(url, bars) {
|
|
12
|
+
const data = await (await fetch(url)).arrayBuffer();
|
|
13
|
+
const context = new AudioContext();
|
|
14
|
+
try {
|
|
15
|
+
const audio = await context.decodeAudioData(data);
|
|
16
|
+
const samples = audio.getChannelData(0);
|
|
17
|
+
const size = Math.max(1, Math.floor(samples.length / bars));
|
|
18
|
+
const peaks = [];
|
|
19
|
+
for (let b = 0; b < bars; b++) {
|
|
20
|
+
let sum = 0;
|
|
21
|
+
const from = b * size;
|
|
22
|
+
for (let i = from; i < Math.min(samples.length, from + size); i++) sum += samples[i] * samples[i];
|
|
23
|
+
peaks.push(Math.sqrt(sum / size));
|
|
24
|
+
}
|
|
25
|
+
const top = Math.max(...peaks, 1e-6);
|
|
26
|
+
return {
|
|
27
|
+
peaks: peaks.map((p) => p / top),
|
|
28
|
+
duration: audio.duration
|
|
29
|
+
};
|
|
30
|
+
} finally {
|
|
31
|
+
context.close();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Draws `peaks` as bars across `canvas`, centred on its middle, the share `progress` (0–1) of them played. */
|
|
35
|
+
function drawBars(canvas, peaks, progress, colors) {
|
|
36
|
+
const { width, height } = fit(canvas);
|
|
37
|
+
const g = canvas.getContext("2d");
|
|
38
|
+
if (g === null) return;
|
|
39
|
+
g.clearRect(0, 0, width, height);
|
|
40
|
+
const step = width / Math.max(1, peaks.length);
|
|
41
|
+
const bar = Math.max(1, step * .6);
|
|
42
|
+
const dpr = devicePixelRatio;
|
|
43
|
+
peaks.forEach((p, i) => {
|
|
44
|
+
const h = Math.max(2 * dpr, p * height * .9);
|
|
45
|
+
g.fillStyle = (i + .5) / peaks.length <= progress ? colors.played : colors.rest;
|
|
46
|
+
g.fillRect(i * step + (step - bar) / 2, (height - h) / 2, bar, h);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The mic's level, live, as bars scrolling in from the right, drawn on `canvas` until the answer's called.
|
|
51
|
+
* It listens to `stream` on its own; the recording goes on as it was.
|
|
52
|
+
*/
|
|
53
|
+
function liveWaveform(canvas, stream, colors) {
|
|
54
|
+
const context = new AudioContext();
|
|
55
|
+
const analyser = context.createAnalyser();
|
|
56
|
+
analyser.fftSize = 1024;
|
|
57
|
+
context.createMediaStreamSource(stream).connect(analyser);
|
|
58
|
+
const samples = new Float32Array(analyser.fftSize);
|
|
59
|
+
const levels = [];
|
|
60
|
+
let frame = 0;
|
|
61
|
+
let last = 0;
|
|
62
|
+
const tick = (now) => {
|
|
63
|
+
frame = requestAnimationFrame(tick);
|
|
64
|
+
if (now - last < 50) return;
|
|
65
|
+
last = now;
|
|
66
|
+
analyser.getFloatTimeDomainData(samples);
|
|
67
|
+
let sum = 0;
|
|
68
|
+
for (const s of samples) sum += s * s;
|
|
69
|
+
levels.push(Math.min(1, Math.sqrt(sum / samples.length) * 4));
|
|
70
|
+
const room = Math.max(8, Math.floor(canvas.clientWidth / 4));
|
|
71
|
+
if (levels.length > room) levels.splice(0, levels.length - room);
|
|
72
|
+
drawBars(canvas, [...Array(room - levels.length).fill(0), ...levels], 1, colors);
|
|
73
|
+
};
|
|
74
|
+
frame = requestAnimationFrame(tick);
|
|
75
|
+
return () => {
|
|
76
|
+
cancelAnimationFrame(frame);
|
|
77
|
+
context.close();
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** Sizes the canvas's pixels to its box, at the display's density: what it draws stays sharp. */
|
|
81
|
+
function fit(canvas) {
|
|
82
|
+
const width = Math.max(1, Math.round(canvas.clientWidth * devicePixelRatio));
|
|
83
|
+
const height = Math.max(1, Math.round(canvas.clientHeight * devicePixelRatio));
|
|
84
|
+
if (canvas.width !== width) canvas.width = width;
|
|
85
|
+
if (canvas.height !== height) canvas.height = height;
|
|
86
|
+
return {
|
|
87
|
+
width,
|
|
88
|
+
height
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export { liveWaveform as n, peaksOf as r, drawBars as t };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=waveform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waveform.js","names":[],"sources":["../../src/client/waveform.ts"],"sourcesContent":["/**\n * Waveforms: a clip's, read off its audio, drawn as bars with what's played in the accent; and a mic's live,\n * a meter scrolling left as it hears. For the lightbox's player and whatever records the mic (the task\n * panel's Voice, the recording toolbar's mic). Bars, not a line: they read at any size, and at a glance.\n */\n\n/**\n * How loud each of `bars` stretches of the clip at `url` is, from 0 to 1, the loudest 1, and how long it is in\n * seconds: MediaRecorder's webm doesn't say until it's played through.\n */\nexport async function peaksOf(url: string, bars: number): Promise<{ peaks: number[]; duration: number }> {\n const data = await (await fetch(url)).arrayBuffer();\n const context = new AudioContext();\n try {\n const audio = await context.decodeAudioData(data);\n const samples = audio.getChannelData(0);\n const size = Math.max(1, Math.floor(samples.length / bars));\n const peaks: number[] = [];\n for (let b = 0; b < bars; b++) {\n // The stretch's loudness as its RMS: a peak would make every click a wall.\n let sum = 0;\n const from = b * size;\n for (let i = from; i < Math.min(samples.length, from + size); i++) sum += samples[i]! * samples[i]!;\n peaks.push(Math.sqrt(sum / size));\n }\n const top = Math.max(...peaks, 1e-6);\n return { peaks: peaks.map((p) => p / top), duration: audio.duration };\n } finally {\n void context.close();\n }\n}\n\nexport interface Colors {\n /** What's played. */\n played: string;\n /** What isn't, yet. */\n rest: string;\n}\n\n/** Draws `peaks` as bars across `canvas`, centred on its middle, the share `progress` (0–1) of them played. */\nexport function drawBars(canvas: HTMLCanvasElement, peaks: readonly number[], progress: number, colors: Colors): void {\n const { width, height } = fit(canvas);\n const g = canvas.getContext('2d');\n if (g === null) return;\n g.clearRect(0, 0, width, height);\n const step = width / Math.max(1, peaks.length);\n const bar = Math.max(1, step * 0.6);\n const dpr = devicePixelRatio;\n peaks.forEach((p, i) => {\n // Silence still shows as a sliver, so the clip's length reads from end to end.\n const h = Math.max(2 * dpr, p * height * 0.9);\n g.fillStyle = (i + 0.5) / peaks.length <= progress ? colors.played : colors.rest;\n g.fillRect(i * step + (step - bar) / 2, (height - h) / 2, bar, h);\n });\n}\n\n/**\n * The mic's level, live, as bars scrolling in from the right, drawn on `canvas` until the answer's called.\n * It listens to `stream` on its own; the recording goes on as it was.\n */\nexport function liveWaveform(canvas: HTMLCanvasElement, stream: MediaStream, colors: Colors): () => void {\n const context = new AudioContext();\n const analyser = context.createAnalyser();\n analyser.fftSize = 1024;\n context.createMediaStreamSource(stream).connect(analyser);\n const samples = new Float32Array(analyser.fftSize);\n const levels: number[] = [];\n let frame = 0;\n let last = 0;\n const tick = (now: number) => {\n frame = requestAnimationFrame(tick);\n // About 20 bars a second, whatever the display's rate.\n if (now - last < 50) return;\n last = now;\n analyser.getFloatTimeDomainData(samples);\n let sum = 0;\n for (const s of samples) sum += s * s;\n // Speech sits low in the range: lifted so a normal voice fills most of the height.\n levels.push(Math.min(1, Math.sqrt(sum / samples.length) * 4));\n const room = Math.max(8, Math.floor(canvas.clientWidth / 4));\n if (levels.length > room) levels.splice(0, levels.length - room);\n drawBars(canvas, [...Array<number>(room - levels.length).fill(0), ...levels], 1, colors);\n };\n frame = requestAnimationFrame(tick);\n return () => {\n cancelAnimationFrame(frame);\n void context.close();\n };\n}\n\n/** Sizes the canvas's pixels to its box, at the display's density: what it draws stays sharp. */\nfunction fit(canvas: HTMLCanvasElement): { width: number; height: number } {\n const width = Math.max(1, Math.round(canvas.clientWidth * devicePixelRatio));\n const height = Math.max(1, Math.round(canvas.clientHeight * devicePixelRatio));\n if (canvas.width !== width) canvas.width = width;\n if (canvas.height !== height) canvas.height = height;\n return { width, height };\n}\n"],"mappings":";;;;;;;;;;AAUA,eAAsB,QAAQ,KAAa,MAA8D;CACvG,MAAM,OAAO,OAAO,MAAM,MAAM,GAAG,EAAA,CAAG,YAAY;CAClD,MAAM,UAAU,IAAI,aAAa;CACjC,IAAI;EACF,MAAM,QAAQ,MAAM,QAAQ,gBAAgB,IAAI;EAChD,MAAM,UA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