Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

refactor: drop the comments the bundle work added

davbiod1a0a623bd68
diff --git a/src/core/guides/__tests__/import-guide.test.ts b/src/core/guides/__tests__/import-guide.test.ts
index bff0a40..e14afe5 100644
--- a/src/core/guides/__tests__/import-guide.test.ts
+++ b/src/core/guides/__tests__/import-guide.test.ts
@@ -71,8 +71,6 @@ describe('importGuide', () => {
});
it('cannot overwrite a step the recipient already has', async () => {
- // Step ids come from the file, so this is the collision that can actually
- // happen: a guide the recipient recorded already owns 'step-1'.
await createGuide('mine');
const mine: Step = {
id: 'step-1',
diff --git a/src/core/guides/service.ts b/src/core/guides/service.ts
index 0498d5e..ea06964 100644
--- a/src/core/guides/service.ts
+++ b/src/core/guides/service.ts
@@ -129,14 +129,6 @@ export async function permanentlyDeleteGuide(id: string): Promise<void> {
notifyGuidesChanged({ type: 'mutated' });
}
-/**
- * Writes an imported bundle into this browser's library.
- *
- * Every identifier is minted fresh. Reusing the ones in the file would let a
- * shared guide silently overwrite a guide the recipient recorded themselves, and
- * the file comes from someone else's machine. Ownership flags reset for the same
- * reason: the guide is new here, whatever it was to its author.
- */
export async function importGuide(bundle: ParsedBundle): Promise<string> {
const { manifest, images } = bundle;
const guideId = crypto.randomUUID();
@@ -166,8 +158,6 @@ export async function importGuide(bundle: ParsedBundle): Promise<string> {
id,
guideId,
index,
- // No background job exists to resolve a pending description here, and a
- // step that waits for one spins in the editor forever.
aiPending: undefined,
...(screenshotId ? { screenshotId } : {}),
});
diff --git a/src/core/screenshot/__tests__/render.test.ts b/src/core/screenshot/__tests__/render.test.ts
index 4603611..418b43d 100644
--- a/src/core/screenshot/__tests__/render.test.ts
+++ b/src/core/screenshot/__tests__/render.test.ts
@@ -227,10 +227,6 @@ describe('renderScreenshot annotations', () => {
});
describe("annotations: 'redactions'", () => {
- // This is the guarantee the bundle format rests on: the exported pixels must
- // carry the redactions and nothing else. Inverting the filter would ship the
- // concealed content in the clear, so it is asserted directly rather than via
- // the caller.
it('draws the redactions and leaves every other annotation out', async () => {
const s = makeScreenshot({
bounds: { x: 10, y: 10, width: 20, height: 20 },
diff --git a/src/core/screenshot/render.ts b/src/core/screenshot/render.ts
index cc13446..9df1682 100644
--- a/src/core/screenshot/render.ts
+++ b/src/core/screenshot/render.ts
@@ -7,7 +7,6 @@ interface RenderOptions {
quality?: number;
viewport?: ScreenshotBounds;
target?: boolean;
- /** 'redactions' bakes only what must never be undone, leaving the rest editable. */
annotations?: 'all' | 'redactions';
}
diff --git a/src/core/transfer/__tests__/bundle.test.ts b/src/core/transfer/__tests__/bundle.test.ts
index 160e7cf..1dc543b 100644
--- a/src/core/transfer/__tests__/bundle.test.ts
+++ b/src/core/transfer/__tests__/bundle.test.ts
@@ -6,8 +6,6 @@ vi.mock('@/core/screenshot/render', () => ({
renderScreenshot: async () => new Blob(['pixels'], { type: 'image/webp' }),
}));
vi.mock('@/core/export/markdown-export', () => ({
- // Echo the step text, not just the title: a title-only stub makes every
- // assertion about README scrubbing vacuous.
exportGuideAsMarkdown: async (guide: Guide, steps: Step[]) =>
[`# ${guide.title}`, ...steps.map((s) => s.description)].join('\n'),
}));
@@ -97,8 +95,6 @@ describe('exportGuideAsBundle', () => {
await exportGuideAsBundle(makeGuide(), [makeStep()], new Map([['step-1', makeScreenshot()]])),
);
- // The capture pipeline writes the value into the description as well, so
- // dropping inputValue alone would still ship the secret.
expect(JSON.stringify(manifest)).not.toContain('hunter2');
expect(manifest.steps[0].description).toBe(`Type "${SCRUB_PLACEHOLDER}" in the password box`);
expect(strFromU8(entries[README_PATH])).not.toContain('hunter2');
@@ -221,7 +217,6 @@ describe('exportGuideAsBundle', () => {
});
it('drops the captured text of the field that was typed into', async () => {
- // getCleanText stores a truncated copy, so scrubbing the full value misses it.
const long = 'x'.repeat(200);
const step = makeStep({
inputValue: long,
@@ -249,7 +244,6 @@ describe('exportGuideAsBundle', () => {
expect(manifest.steps[0].elementMeta?.textContent).toBeNull();
expect(JSON.stringify(manifest)).not.toContain('xxxxxxxxxx');
- // The signals Guide Me actually matches on survive.
expect(manifest.steps[0].elementMeta?.ariaLabel).toBe('Message');
expect(manifest.steps[0].elementMeta?.cssSelector).toBe('div.editor');
});
diff --git a/src/core/transfer/__tests__/flatten.test.ts b/src/core/transfer/__tests__/flatten.test.ts
index 70d1c76..ed1040b 100644
--- a/src/core/transfer/__tests__/flatten.test.ts
+++ b/src/core/transfer/__tests__/flatten.test.ts
@@ -92,7 +92,6 @@ describe('flattenScreenshot', () => {
}),
);
- // bounds are CSS pixels: 150 * 2 = 300 device px, then rebased by the crop's x.
expect(meta.edits?.target).toMatchObject({ x: 200, y: 150, width: 100, height: 50 });
expect(meta.bounds).toBeUndefined();
expect(meta.pixelRatio).toBeUndefined();
diff --git a/src/core/transfer/__tests__/parse.test.ts b/src/core/transfer/__tests__/parse.test.ts
index 1c5b6af..7efa0a9 100644
--- a/src/core/transfer/__tests__/parse.test.ts
+++ b/src/core/transfer/__tests__/parse.test.ts
@@ -137,8 +137,6 @@ describe('parseManifest', () => {
],
}),
);
- // Otherwise it becomes a blob: URL in the extension origin, and the
- // extension of whatever "Download original" writes to disk.
expect(parsed.screenshots[0].mimeType).toBe('image/webp');
});
@@ -181,8 +179,6 @@ describe('parseManifest', () => {
steps: [{ id: 's', index: 0, description: 'x', action: 'input', url: '', timestamp: 1, inputValue: 'hunter2' }],
}),
);
- // The recipient is shown the claim, so it is enforced rather than trusted β€”
- // Guide Me would otherwise replay the value into a live page.
expect(parsed.steps[0].inputValue).toBeUndefined();
});
@@ -261,8 +257,6 @@ describe('readBundle', () => {
});
it('refuses a zip bomb before inflating it', async () => {
- // 400MB of zeros compresses to a few hundred KB; the guard must fire on the
- // declared sizes, not on the memory it would otherwise already hold.
const huge = new Uint8Array(210 * 1024 * 1024);
const bomb = bundleFile({ [MANIFEST_PATH]: strToU8(JSON.stringify(manifest())), 'screenshots/big.webp': huge });
expect(bomb.size).toBeLessThan(5 * 1024 * 1024);
diff --git a/src/core/transfer/bundle.ts b/src/core/transfer/bundle.ts
index 4be1e23..018a1a8 100644
--- a/src/core/transfer/bundle.ts
+++ b/src/core/transfer/bundle.ts
@@ -17,7 +17,6 @@ import { scrubValues, typedValues } from './scrub';
export type BundleUrlMode = 'full' | 'path' | 'origin';
export interface BundleOptions {
- /** Typed text can be a name, a token, or a password nobody meant to publish. */
stripInputValues: boolean;
urls: BundleUrlMode;
}
@@ -27,7 +26,6 @@ export const DEFAULT_BUNDLE_OPTIONS: BundleOptions = {
urls: 'path',
};
-/** Query strings and fragments carry session tokens far more often than they carry meaning. */
export function trimUrl(url: string, mode: BundleUrlMode): string {
if (mode === 'full' || !url) return url;
let parsed: URL;
@@ -36,9 +34,6 @@ export function trimUrl(url: string, mode: BundleUrlMode): string {
} catch {
return '';
}
- // Opaque-origin schemes (file:, about:, chrome:) report an origin of the
- // literal string "null", so composing origin + pathname would yield
- // "null/Users/…". They have no host to trim down to, so leave them whole.
if (parsed.origin === 'null') return url;
return mode === 'origin' ? parsed.origin : `${parsed.origin}${parsed.pathname}`;
}
@@ -49,18 +44,11 @@ function bundleStep(step: Step, options: BundleOptions, secrets: readonly string
if (options.stripInputValues) {
delete travelling.inputValue;
- // The value is also written into the description at capture time, and an AI
- // description can quote it again. Removing one copy and shipping the other
- // would make the setting a lie.
travelling.description = scrubValues(travelling.description, secrets);
}
if (travelling.elementMeta) {
const meta = travelling.elementMeta;
- // For the field that was typed into, the captured text *is* the typed value β€”
- // stored truncated, so a literal scrub can miss it. Drop it outright: Guide Me
- // matches a field on its selector, label and placeholder, never on the text
- // the author happened to put in it.
const ownText = options.stripInputValues && step.inputValue ? null : meta.textContent;
travelling.elementMeta = {
...meta,
@@ -72,13 +60,6 @@ function bundleStep(step: Step, options: BundleOptions, secrets: readonly string
return travelling;
}
-/**
- * Packs a guide into a `.mimik` zip another Mimik can import.
- *
- * Screenshots are flattened first, so redactions are gone rather than merely
- * hidden. A plain-markdown `README.md` rides along so the file still says
- * something to someone who does not have Mimik installed.
- */
export async function exportGuideAsBundle(
guide: Guide,
steps: Step[],
@@ -97,7 +78,6 @@ export async function exportGuideAsBundle(
anyRedaction ||= redacted;
const file = `${SCREENSHOT_DIR}/${meta.id}.webp`;
- // Already-compressed webp: deflating it again costs time and saves nothing.
files[file] = [new Uint8Array(await blob.arrayBuffer()), { level: 0 }];
manifestScreenshots.push({
@@ -121,8 +101,6 @@ export async function exportGuideAsBundle(
version: BUNDLE_VERSION,
exportedAt: Date.now(),
guide: {
- // An AI title is written from the step descriptions, so it can carry the
- // typed value through even though nobody typed it into the title.
title: scrub(guide.title),
...(guide.description ? { description: scrub(guide.description) } : {}),
createdAt: guide.createdAt,
@@ -139,8 +117,6 @@ export async function exportGuideAsBundle(
files[MANIFEST_PATH] = strToU8(JSON.stringify(manifest, null, 2));
- // The README is generated from the guide, so it needs the same scrubbing the
- // manifest got β€” otherwise the value walks out in the readable copy instead.
const { exportGuideAsMarkdown } = await import('@/core/export/markdown-export');
const readmeGuide: Guide = {
...guide,
@@ -150,8 +126,6 @@ export async function exportGuideAsBundle(
const readmeSteps = steps.map((step) => ({ ...step, description: scrub(step.description) }));
files[README_PATH] = strToU8(await exportGuideAsMarkdown(readmeGuide, readmeSteps, screenshots));
- // Synchronous for the same reason as readBundle: the async variant needs a
- // blob: Worker that Firefox's extension CSP blocks.
const zipped = zipSync(files);
return new Blob([zipped as unknown as BlobPart], { type: BUNDLE_MIME });
}
diff --git a/src/core/transfer/flatten.ts b/src/core/transfer/flatten.ts
index 85d3dad..f0594a1 100644
--- a/src/core/transfer/flatten.ts
+++ b/src/core/transfer/flatten.ts
@@ -6,31 +6,12 @@ import type { ScreenshotEdits } from '@/core/screenshot/types';
export interface FlattenedScreenshot {
meta: Omit<Screenshot, 'blob'>;
blob: Blob;
- /**
- * True only when a redaction was burnt in. A crop also destroys pixels, but
- * the recipient is told "blurred areas were removed", and saying that about a
- * screenshot the author merely zoomed would be a lie.
- */
redacted: boolean;
}
const FORMAT = 'image/webp';
const QUALITY = 0.9;
-/**
- * Prepares a screenshot to leave this browser.
- *
- * A `redact` annotation is drawn at render time, so `screenshot.blob` still holds
- * the unblurred capture underneath it. Shipping that blob would hand the recipient
- * everything the author hid. So redactions are burnt into the pixels here and then
- * dropped from `edits`, leaving nothing to undo.
- *
- * An explicit crop is baked for the same reason β€” framing is sometimes how people
- * hide things. The automatic zoom-to-target crop is presentation rather than
- * concealment, so it stays as data and travels untouched.
- *
- * Everything else β€” the target outline, boxes, arrows, text β€” stays editable.
- */
export async function flattenScreenshot(screenshot: Screenshot): Promise<FlattenedScreenshot> {
const crop = screenshot.edits?.viewport;
const frame = crop ?? { x: 0, y: 0, width: screenshot.width, height: screenshot.height };
@@ -62,12 +43,8 @@ export async function flattenScreenshot(screenshot: Screenshot): Promise<Flatten
};
}
- // The crop is now the whole image, so every coordinate moves with it.
if (kept.length > 0) edits.annotations = kept.map((a) => moveAnnotation(a, -crop.x, -crop.y));
- // `bounds` is in CSS pixels and only exists so the target and auto-crop can be
- // derived. Resolve it once, rebase it, and drop the source β€” a rebased image
- // must never be re-derived from pre-crop coordinates.
const target = resolveTarget(screenshot);
edits.target = target
? { ...target, x: target.x - crop.x, y: target.y - crop.y }
diff --git a/src/core/transfer/parse.ts b/src/core/transfer/parse.ts
index cf49b21..554e382 100644
--- a/src/core/transfer/parse.ts
+++ b/src/core/transfer/parse.ts
@@ -3,34 +3,18 @@ import { BundleError, type BundleManifest, MANIFEST_PATH, parseManifest } from '
export interface ParsedBundle {
manifest: BundleManifest;
- /** Zip entry path β†’ image, for the screenshots the manifest actually points at. */
images: Map<string, Blob>;
}
-/** 200MB of decompressed entries is far past any real guide and well short of an OOM. */
const MAX_UNPACKED_BYTES = 200 * 1024 * 1024;
-/** A compressed bundle this large is not a guide; reject before reading it into memory. */
const MAX_FILE_BYTES = 100 * 1024 * 1024;
-/**
- * Reads a `.mimik` file from disk. Everything in it is untrusted: the manifest is
- * validated, entries it does not reference are ignored, and a file that is not a
- * bundle fails with a reason the import screen can show.
- */
export async function readBundle(file: Blob): Promise<ParsedBundle> {
if (file.size > MAX_FILE_BYTES) throw new BundleError('unreadable', 'bundle is implausibly large');
let entries: Record<string, Uint8Array>;
try {
- // Deliberately the synchronous API. fflate's async variant runs in a Worker
- // built from a blob: URL, which Firefox's extension CSP refuses to execute β€”
- // the callback then never fires and the import hangs on its spinner forever.
- // Screenshots are stored uncompressed, so there is little to inflate anyway.
- //
- // The filter runs against the central directory before anything is inflated,
- // so a zip bomb is refused while it is still a few kilobytes on disk. Summing
- // the entries afterwards would only measure memory already committed.
let unpacked = 0;
entries = unzipSync(new Uint8Array(await file.arrayBuffer()), {
filter: (entry) => {
diff --git a/src/core/transfer/schema.ts b/src/core/transfer/schema.ts
index b13b7b0..c045b56 100644
--- a/src/core/transfer/schema.ts
+++ b/src/core/transfer/schema.ts
@@ -8,10 +8,6 @@ import type {
} from '@/core/guides/types';
import type { Annotation, ScreenshotEdits } from '@/core/screenshot/types';
-/**
- * Bump when the manifest shape changes. Readers reject anything newer than they
- * understand rather than guessing at fields they have never seen.
- */
export const BUNDLE_VERSION = 1;
export const BUNDLE_EXTENSION = 'mimik';
@@ -20,10 +16,8 @@ export const MANIFEST_PATH = 'manifest.json';
export const SCREENSHOT_DIR = 'screenshots';
export const README_PATH = 'README.md';
-/** A step as it travels: no `guideId`, no transient capture state. */
export type BundleStep = Omit<Step, 'guideId' | 'aiPending' | 'screenshotId'>;
-/** Screenshot metadata plus the zip entry holding its pixels. */
export interface BundleScreenshot {
id: string;
stepId: string;
@@ -46,7 +40,6 @@ export interface BundleManifest {
createdAt: number;
};
sourceDomain: string | null;
- /** What the exporter removed, so the import screen can say so. */
redacted: {
screenshots: boolean;
inputValues: boolean;
@@ -75,11 +68,6 @@ const str = (value: unknown): string | undefined => (typeof value === 'string' ?
const num = (value: unknown): number | undefined =>
typeof value === 'number' && Number.isFinite(value) ? value : undefined;
-/**
- * Geometry from an untrusted manifest ends up sizing an OffscreenCanvas and
- * allocating pixels, so it is clamped rather than merely checked for finiteness.
- * 32768 is past any real capture and far short of an allocation failure.
- */
const MAX_DIMENSION = 32_768;
const MAX_POINTS = 20_000;
@@ -95,7 +83,6 @@ const positive = (value: unknown): number | undefined => {
return Math.min(n, MAX_DIMENSION);
};
-/** Only schemes a browser can safely open. `javascript:` must never reach an href. */
const SAFE_SCHEMES = ['http:', 'https:'];
export function safeUrl(value: unknown): string {
@@ -134,10 +121,6 @@ const CALLOUT_VARIANTS: CalloutVariant[] = ['info', 'warning', 'error', 'success
const oneOf = <T extends string>(value: unknown, allowed: T[]): T | undefined =>
typeof value === 'string' && (allowed as string[]).includes(value) ? (value as T) : undefined;
-/**
- * Annotations are replayed onto a canvas, so a malformed one is dropped rather
- * than defaulted β€” a half-built redaction is worse than a missing decoration.
- */
function annotations(value: unknown): Annotation[] | undefined {
if (!Array.isArray(value)) return undefined;
const kept = value.filter((a): a is Annotation => {
@@ -152,8 +135,6 @@ function annotations(value: unknown): Annotation[] | undefined {
case 'arrow':
return [a.x1, a.y1, a.x2, a.y2].every((n) => bounded(n) !== undefined) && typeof a.color === 'string';
case 'text':
- // `size` drives every derived coordinate; without it annotationBounds
- // yields NaN and resizing persists NaN back into the recipient's DB.
return (
bounded(a.x) !== undefined &&
bounded(a.y) !== undefined &&
@@ -162,8 +143,6 @@ function annotations(value: unknown): Annotation[] | undefined {
positive(a.size) !== undefined
);
case 'freehand':
- // An empty list makes Math.min(...[]) Infinity; an odd length leaves a
- // dangling x with no y.
return (
Array.isArray(a.points) &&
a.points.length >= 2 &&
@@ -224,9 +203,6 @@ function parseStep(value: unknown, index: number, stripInputValues: boolean): Bu
if (variant) step.calloutVariant = variant;
const color = str(value.calloutColor);
if (color) step.calloutColor = color;
- // A bundle that claims it stripped typed values does not get to carry them
- // anyway. The claim is what the recipient is shown, so it is enforced here
- // rather than trusted β€” Guide Me would otherwise replay the value into a page.
const inputValue = str(value.inputValue);
if (inputValue !== undefined && !stripInputValues) step.inputValue = inputValue;
const meta = parseElementMeta(value.elementMeta);
@@ -235,7 +211,6 @@ function parseStep(value: unknown, index: number, stripInputValues: boolean): Bu
return step;
}
-/** Guide Me matches live DOM against these fields, so a partial one still has value. */
function parseElementMeta(value: unknown): ElementMeta | null {
if (!isObject(value)) return null;
const tag = str(value.tag);
@@ -262,7 +237,6 @@ function parseElementMeta(value: unknown): ElementMeta | null {
};
}
-/** Zip entries are never written to disk, but a manifest should still only point inside itself. */
function safeEntryPath(file: string): boolean {
return file.startsWith(`${SCREENSHOT_DIR}/`) && !file.includes('..') && !file.includes('\\');
}
@@ -281,8 +255,6 @@ function parseScreenshot(value: unknown): BundleScreenshot | null {
id,
stepId,
file,
- // An arbitrary type would become a blob: URL in the extension's own origin
- // and the extension of whatever "Download original" writes to disk.
mimeType: declaredType && SAFE_IMAGE_TYPES.includes(declaredType) ? declaredType : 'image/webp',
width,
height,
@@ -300,10 +272,6 @@ function parseScreenshot(value: unknown): BundleScreenshot | null {
return shot;
}
-/**
- * Validates a manifest from an untrusted file. Structural problems throw so the
- * import screen can explain them; individual malformed steps are dropped.
- */
export function parseManifest(raw: unknown): BundleManifest {
if (!isObject(raw)) throw new BundleError('not-a-bundle', 'manifest is not an object');
diff --git a/src/core/transfer/scrub.ts b/src/core/transfer/scrub.ts
index 7cc6fb7..410c798 100644
--- a/src/core/transfer/scrub.ts
+++ b/src/core/transfer/scrub.ts
@@ -1,30 +1,11 @@
export const SCRUB_PLACEHOLDER = '…';
-/**
- * Bare values shorter than this are left alone. A three-letter value is as likely
- * to be a word inside an unrelated sentence as it is to be the secret, and
- * mangling the guide's prose is a worse trade than leaving a short value in.
- * The quoted form is replaced at any length, because that one is unambiguous.
- */
export const MIN_BARE_SCRUB = 4;
function escapeRegExp(value: string): string {
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
-/**
- * Removes typed field values from text that is about to leave the browser.
- *
- * Stripping `step.inputValue` is not enough on its own: the capture pipeline also
- * writes the value into the step description (`Type "hunter2" in Search`), and an
- * AI-written title or description can quote it again. Those are copies of the same
- * secret, so they have to go the same way.
- *
- * Two passes, because they carry different risks. The quoted form is exactly what
- * the description template produces, so it is replaced whatever its length. A bare
- * occurrence could be an ordinary word, so it is only replaced once it is long
- * enough to be unlikely to collide.
- */
export function scrubValues(text: string, values: readonly string[]): string {
let out = text;
@@ -42,17 +23,8 @@ export function scrubValues(text: string, values: readonly string[]): string {
return out;
}
-/** How far `getCleanText` truncates captured element text. Keep in step with element-meta.ts. */
const CAPTURED_TEXT_LIMIT = 80;
-/**
- * The forms one typed value can take elsewhere in the guide.
- *
- * `elementMeta.textContent` is not a copy of `inputValue` β€” `getCleanText` keeps
- * only the first meaningful line of `innerText`, cut to 80 characters. A literal
- * search for the whole value therefore sails straight past it, so the shortened
- * forms have to be searched for too.
- */
function variantsOf(value: string): string[] {
const variants = new Set<string>([value]);
const firstLine = value
@@ -66,7 +38,6 @@ function variantsOf(value: string): string[] {
return [...variants];
}
-/** Every distinct value typed anywhere in the guide β€” a later step can echo an earlier one. */
export function typedValues(steps: readonly { inputValue?: string }[]): string[] {
const values = new Set<string>();
for (const step of steps) {
@@ -74,6 +45,5 @@ export function typedValues(steps: readonly { inputValue?: string }[]): string[]
if (!value) continue;
for (const variant of variantsOf(value)) values.add(variant);
}
- // Longest first, so a value containing another is replaced before its substring.
return [...values].sort((a, b) => b.length - a.length);
}
diff --git a/src/ui/fullview/ExportPreviewModal.tsx b/src/ui/fullview/ExportPreviewModal.tsx
index dab2e27..6cdab87 100644
--- a/src/ui/fullview/ExportPreviewModal.tsx
+++ b/src/ui/fullview/ExportPreviewModal.tsx
@@ -68,15 +68,9 @@ export default function ExportPreviewModal({ open, onOpenChange, guide, steps, s
}, []);
const videoPending = steps.length > VIDEO_AUTOPLAY_STEP_LIMIT && !videoRequested;
- // Stripping the stored value cannot touch the pixels: a screenshot taken while a
- // field held the text still shows it. Count the screenshots that will actually
- // ship, not the steps β€” a typed step whose screenshot was deleted shows nothing.
const typedStepCount = steps.filter((step) => step.inputValue && screenshots.has(step.id)).length;
const { cover, stepDescriptions, resolution, screenshots: withScreenshots, stepUrls, imageScale } = options;
- // Only the settings the HTML actually reflects. The bundle settings cannot
- // change the preview, and re-encoding every screenshot when one is toggled
- // blanks the pane for seconds on a long guide.
const previewOptions = useMemo<ExportOptions>(
() => ({ ...DEFAULT_EXPORT_OPTIONS, cover, screenshots: withScreenshots, stepUrls, imageScale, stepDescriptions }),
[cover, withScreenshots, stepUrls, imageScale, stepDescriptions],
diff --git a/src/ui/fullview/LibraryContent.tsx b/src/ui/fullview/LibraryContent.tsx
index f178faa..fa4e20c 100644
--- a/src/ui/fullview/LibraryContent.tsx
+++ b/src/ui/fullview/LibraryContent.tsx
@@ -298,16 +298,12 @@ export default function LibraryContent({ category }: LibraryContentProps) {
await loadGuides();
};
- // Prefer a .mimik among several dropped files rather than only inspecting the
- // first, and hand back whatever was dropped otherwise so the modal can explain
- // itself. Silently ignoring a drop reads as the app being broken.
const bundleFrom = (list: FileList | null): File | null => {
const files = Array.from(list ?? []);
if (files.length === 0) return null;
return files.find((f) => f.name.toLowerCase().endsWith(`.${BUNDLE_EXTENSION}`)) ?? files[0];
};
- // Counting enter/leave keeps the overlay steady as the pointer crosses children.
const handleDragEnter = (e: React.DragEvent) => {
if (!e.dataTransfer.types.includes('Files')) return;
dragDepth.current += 1;
diff --git a/src/ui/sidepanel/LibraryView.tsx b/src/ui/sidepanel/LibraryView.tsx
index 18500da..6834503 100644
--- a/src/ui/sidepanel/LibraryView.tsx
+++ b/src/ui/sidepanel/LibraryView.tsx
@@ -15,10 +15,6 @@ import { formatRelativeTime } from '@/lib/utils';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/ui/components/ui/tooltip';
import FaviconImg from '@/ui/shared/FaviconImg';
-/**
- * The dashboard is where the library, import and export live. Reuses an open
- * dashboard tab rather than stacking up duplicates.
- */
async function openDashboard() {
const url = getExtensionURL('/fullview.html');
const tabs = await queryTabs({ url });
diff --git a/vitest.setup.ts b/vitest.setup.ts
index b53ab06..71371e9 100644
--- a/vitest.setup.ts
+++ b/vitest.setup.ts
@@ -99,11 +99,6 @@ class ESBuildAndJSDOMCompatibleTextEncoder extends TextEncoder {
super();
}
- // The shim exists so the result is a Uint8Array from *this* realm β€” jsdom and
- // esbuild otherwise hand back one that fails `instanceof` checks. The bytes
- // themselves must still be real UTF-8: truncating each char to `charCodeAt(0)`
- // turns "…" into "&" and every accented or CJK character into mojibake, which
- // silently breaks any test that round-trips non-ASCII text.
encode(input: string) {
if (typeof input !== "string") {
throw new TypeError("`input` must be a string");