π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
feat: persist elementMeta and inputValue on step records
Luis Ortizb6a1233c8ca7
diff --git a/src/core/capture/events/input-session.ts b/src/core/capture/events/input-session.tsindex a6a942b..46bd7ea 100644--- a/src/core/capture/events/input-session.ts+++ b/src/core/capture/events/input-session.ts@@ -35,8 +35,8 @@ export class InputSession {if (!this.stepId) return;const val = getFieldValue(target);const desc = val ? `Type "${val}" in ${getFieldLabel(target)}` : `Clear ${getFieldLabel(target)}`;- sendMessage('updateInputStep', { stepId: this.stepId, description: desc }).catch((err) =>- logger.warn('Failed to update input step', err),+ sendMessage('updateInputStep', { stepId: this.stepId, description: desc, inputValue: val || undefined }).catch(+ (err) => logger.warn('Failed to update input step', err),);}diff --git a/src/core/guides/types.ts b/src/core/guides/types.tsindex 8e5f4ae..2717a1c 100644--- a/src/core/guides/types.ts+++ b/src/core/guides/types.ts@@ -17,6 +17,8 @@ export interface Step {url: string;timestamp: number;screenshotId?: string;+ elementMeta?: ElementMeta;+ inputValue?: string;}export interface ScreenshotBounds {diff --git a/src/entrypoints/background/index.ts b/src/entrypoints/background/index.tsindex 7dc472e..0ee8108 100644--- a/src/entrypoints/background/index.ts+++ b/src/entrypoints/background/index.ts@@ -91,7 +91,7 @@ export default defineBackground(() => {onMessage('updateInputStep', async ({ data }) => {await waitUntilReady();- await handleUpdateInputStep(data.stepId, data.description);+ await handleUpdateInputStep(data.stepId, data.description, data.inputValue);return { updated: true };});diff --git a/src/entrypoints/background/step-pipeline.ts b/src/entrypoints/background/step-pipeline.tsindex d4308f5..f8c0644 100644--- a/src/entrypoints/background/step-pipeline.ts+++ b/src/entrypoints/background/step-pipeline.ts@@ -4,7 +4,7 @@ import { CaptureState } from '@/core/capture/machine';import { buildFallbackDescription } from '@/core/capture/step-description';import { db } from '@/core/guides/db';import { addStepToGuide, createStep, saveScreenshot, updateStepDescription } from '@/core/guides/service';-import type { ElementMeta, Screenshot } from '@/core/guides/types';+import type { ElementMeta, Screenshot, Step } from '@/core/guides/types';import { captureVisibleTab, localStorage } from '@/lib/browser-api';import { logger } from '@/lib/logger';import type { CaptureStepData, CaptureStepResponse } from '@/lib/messaging';@@ -65,6 +65,7 @@ export async function handleCaptureStep(data: CaptureStepData): Promise<CaptureSurl: snap.context.currentUrl,timestamp: Date.now(),screenshotId,+ elementMeta: data.elementMeta,});await addStepToGuide(guideId, stepId);@@ -79,8 +80,11 @@ export async function handleCaptureStep(data: CaptureStepData): Promise<CaptureSreturn { stepId };}-export async function handleUpdateInputStep(stepId: string, description: string) {+export async function handleUpdateInputStep(stepId: string, description: string, inputValue?: string) {await updateStepDescription(stepId, description);+ if (inputValue !== undefined) {+ await db.steps.update(stepId, { inputValue });+ }}export async function handleFinalizeInputStep(@@ -89,9 +93,9 @@ export async function handleFinalizeInputStep(domContext: DOMContext | undefined,) {const screenshotId = await takeScreenshot(stepId, elementMeta);- if (screenshotId) {- await db.steps.update(stepId, { screenshotId });- }+ const updates: Partial<Step> = { elementMeta };+ if (screenshotId) updates.screenshotId = screenshotId;+ await db.steps.update(stepId, updates);if (domContext) {try {diff --git a/src/lib/messaging.ts b/src/lib/messaging.tsindex fe56885..e5393d4 100644--- a/src/lib/messaging.ts+++ b/src/lib/messaging.ts@@ -34,6 +34,7 @@ export type CaptureStepResponse = { stepId: string } | { ignored: true } | { errexport interface UpdateInputStepData {stepId: string;description: string;+ inputValue?: string;}export interface UpdateInputStepResponse {