How mistylady/titleandurlcapturer works
Project type and purpose
• From the file tree and README, this is a browser extension (full‐stack in the narrow sense of “UI + logic”, but not a web server).
File structure
• Top level:
• src/
– config/parameter.ts (extension parameters, default settings)
– lib/ (utility functions: tab info retrieval, formatting, clipboard, filename validation)
– popup/index.tsx (React or JSX popup entry)
– style/style.css
• package.json & pnpm-lock.yaml (build & dependency management)
• tsconfig.json (TypeScript compile config)
• .prettierrc, .gitignore, LICENSE, README.md
• No explicit “background” folder is shown; this appears to be a “popup-only” extension relying on browser.tabs API invoked from the popup.
README for additional insights
• Confirms two user actions: “Copy To Clipboard” and “Export to Markdown.”
• Mentions an optional filename input for Markdown export.
• Provides dev/build commands (pnpm dev, pnpm build).
Main components & interactions
a. Components:
1. Browser Extension Host (the Chrome/Firefox extension engine)
3. Popup UI (src/popup/index.tsx + style.css)
4. Utility Library (src/lib)
5. Configuration (src/config/parameter.ts)
6. Browser Tabs API (external service)
7. Clipboard API & File Download mechanism
b. Relationships / Data Flow:
• Popup UI imports config & lib modules
• Popup UI calls lib.getTabsInfo → calls browser.tabs.query → returns tabs info
• Depending on user choice:
– lib.copyToClipboard formats data and calls Clipboard API
– lib.exportToMarkdown formats data, asks user for filename (validFilename), then calls a download API or generates a Blob for file save
• All modules are bundled at build time via pnpm scripts + TypeScript compiler
c. Architectural patterns / design principles:
– Separation of concerns: UI layer (popup) vs. business logic (lib) vs. configuration
– Single responsibility: each lib function does one job (copy, format, filename validation)
– Event-driven: UI events trigger tab queries and output actions
d. Key technologies & frameworks:
– TypeScript + tsconfig.json
– React/JSX or Preact (tsx in popup)
– pnpm for package management
– Browser Extension APIs (tabs, clipboard, download)