@imsovikde/source-grab 1.0.1
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/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +281 -0
- package/background/capture-registry.js +306 -0
- package/background/debugger-capture.js +171 -0
- package/background/download-engine.js +316 -0
- package/background/service-worker.js +426 -0
- package/content-scripts/auto-scroll.js +51 -0
- package/content-scripts/isolated-bridge.js +36 -0
- package/content-scripts/main-world-hook.js +278 -0
- package/design-tokens.css +67 -0
- package/icons/2-double-tap.svg +12 -0
- package/icons/2-scroll-left.svg +11 -0
- package/icons/2-scroll-right.svg +11 -0
- package/icons/2-scroll-up-1.svg +11 -0
- package/icons/2-scroll-up.svg +11 -0
- package/icons/2-tap-1.svg +15 -0
- package/icons/2-tap.svg +11 -0
- package/icons/2-touch-hold.svg +13 -0
- package/icons/3-scroll-down.svg +11 -0
- package/icons/3-scroll-up.svg +11 -0
- package/icons/3-tap-scroll.svg +13 -0
- package/icons/3-tap.svg +11 -0
- package/icons/analytics.svg +10 -0
- package/icons/anchor.svg +10 -0
- package/icons/apple.svg +11 -0
- package/icons/arrow-circle-down.svg +4 -0
- package/icons/arrow-circle-left.svg +4 -0
- package/icons/arrow-circle-right.svg +4 -0
- package/icons/arrow-circle-up.svg +4 -0
- package/icons/arrow-down-2.svg +3 -0
- package/icons/arrow-down.svg +11 -0
- package/icons/arrow-left.svg +3 -0
- package/icons/arrow-ne.svg +3 -0
- package/icons/arrow-nw.svg +3 -0
- package/icons/arrow-right.svg +3 -0
- package/icons/arrow-se.svg +3 -0
- package/icons/arrow-single-down.svg +3 -0
- package/icons/arrow-single-left.svg +3 -0
- package/icons/arrow-single-right.svg +3 -0
- package/icons/arrow-single-up.svg +3 -0
- package/icons/arrow-square-down.svg +4 -0
- package/icons/arrow-square-left.svg +4 -0
- package/icons/arrow-square-right.svg +4 -0
- package/icons/arrow-square-up.svg +4 -0
- package/icons/arrow-sw.svg +3 -0
- package/icons/arrow-up-2.svg +3 -0
- package/icons/arrow-up.svg +11 -0
- package/icons/arrow.svg +10 -0
- package/icons/at-the-rate.svg +10 -0
- package/icons/automation.svg +4 -0
- package/icons/backward.svg +11 -0
- package/icons/bag-2.svg +3 -0
- package/icons/bag.svg +3 -0
- package/icons/balloon-2.svg +10 -0
- package/icons/balloon.svg +10 -0
- package/icons/bank.svg +10 -0
- package/icons/basket.svg +6 -0
- package/icons/behance.svg +12 -0
- package/icons/bell-2.svg +10 -0
- package/icons/bell.svg +10 -0
- package/icons/bill.svg +19 -0
- package/icons/bisexual.svg +10 -0
- package/icons/blood-bag.svg +10 -0
- package/icons/blood.svg +12 -0
- package/icons/bluetooth.svg +10 -0
- package/icons/bookmark.svg +10 -0
- package/icons/bot.svg +6 -0
- package/icons/bottle.svg +15 -0
- package/icons/box-2.svg +6 -0
- package/icons/box.svg +3 -0
- package/icons/bug.svg +3 -0
- package/icons/bulb.svg +10 -0
- package/icons/burger.svg +16 -0
- package/icons/bus.svg +8 -0
- package/icons/cake.svg +10 -0
- package/icons/calculator.svg +15 -0
- package/icons/calendar.svg +15 -0
- package/icons/call.svg +12 -0
- package/icons/camera-2.svg +10 -0
- package/icons/camera.svg +12 -0
- package/icons/candy.svg +10 -0
- package/icons/car.svg +8 -0
- package/icons/card-2.svg +9 -0
- package/icons/card-3.svg +6 -0
- package/icons/card.svg +4 -0
- package/icons/cart-add.svg +4 -0
- package/icons/cart-delete.svg +4 -0
- package/icons/cart-remove.svg +4 -0
- package/icons/cash.svg +11 -0
- package/icons/caution.svg +12 -0
- package/icons/center-align-2.svg +10 -0
- package/icons/center-align.svg +13 -0
- package/icons/checklist.svg +4 -0
- package/icons/chevrons-down.svg +4 -0
- package/icons/chevrons-left.svg +4 -0
- package/icons/chevrons-right.svg +4 -0
- package/icons/chevrons-up.svg +4 -0
- package/icons/chip.svg +4 -0
- package/icons/clap.svg +14 -0
- package/icons/clock.svg +11 -0
- package/icons/cloud-down.svg +10 -0
- package/icons/cloud-up.svg +10 -0
- package/icons/cloud.svg +10 -0
- package/icons/cloudy-day.svg +15 -0
- package/icons/cloudy-night.svg +10 -0
- package/icons/codepen.svg +10 -0
- package/icons/coffee-cup-1.svg +7 -0
- package/icons/coffee-cup-2.svg +6 -0
- package/icons/coin-2.svg +11 -0
- package/icons/coin.svg +11 -0
- package/icons/confused-emoji.svg +8 -0
- package/icons/conveyor-belt.svg +8 -0
- package/icons/cookie.svg +14 -0
- package/icons/cool-emoji.svg +4 -0
- package/icons/copy.svg +10 -0
- package/icons/crop.svg +10 -0
- package/icons/cross.svg +10 -0
- package/icons/crown.svg +14 -0
- package/icons/crying-emoji.svg +4 -0
- package/icons/cut.svg +10 -0
- package/icons/cutlery.svg +11 -0
- package/icons/dashboard-2.svg +10 -0
- package/icons/dashboard-3.svg +11 -0
- package/icons/dashboard-4.svg +11 -0
- package/icons/dashboard.svg +11 -0
- package/icons/delete.svg +12 -0
- package/icons/diamond.svg +10 -0
- package/icons/dish.svg +10 -0
- package/icons/doc-add.svg +11 -0
- package/icons/doc-remove.svg +11 -0
- package/icons/doc.svg +15 -0
- package/icons/dollar-2.svg +11 -0
- package/icons/dollar.svg +10 -0
- package/icons/double-tap.svg +12 -0
- package/icons/download.svg +11 -0
- package/icons/drawer.svg +10 -0
- package/icons/dribbble.svg +10 -0
- package/icons/drink.svg +10 -0
- package/icons/dropbox.svg +10 -0
- package/icons/dropper.svg +10 -0
- package/icons/egg.svg +11 -0
- package/icons/eject.svg +12 -0
- package/icons/eraser.svg +10 -0
- package/icons/euro.svg +11 -0
- package/icons/facebook-2.svg +10 -0
- package/icons/facebook.svg +3 -0
- package/icons/factory.svg +7 -0
- package/icons/fast-forward.svg +10 -0
- package/icons/fast-rewind.svg +10 -0
- package/icons/fb-messenger.svg +11 -0
- package/icons/femaile.svg +10 -0
- package/icons/file-attachment.svg +10 -0
- package/icons/file-audio.svg +13 -0
- package/icons/file-code.svg +13 -0
- package/icons/file-contract.svg +15 -0
- package/icons/file-csv.svg +13 -0
- package/icons/file-figma.svg +14 -0
- package/icons/file-form.svg +15 -0
- package/icons/file-image-2.svg +12 -0
- package/icons/file-image.svg +12 -0
- package/icons/file-invoice.svg +15 -0
- package/icons/file-jpg.svg +13 -0
- package/icons/file-list.svg +17 -0
- package/icons/file-mov.svg +13 -0
- package/icons/file-mp4.svg +13 -0
- package/icons/file-notes.svg +12 -0
- package/icons/file-pdf.svg +13 -0
- package/icons/file-png.svg +13 -0
- package/icons/file-spreadsheet.svg +11 -0
- package/icons/file-svg.svg +13 -0
- package/icons/file-text.svg +14 -0
- package/icons/file-vector.svg +11 -0
- package/icons/file-zip.svg +10 -0
- package/icons/file.svg +10 -0
- package/icons/filter.svg +10 -0
- package/icons/fire.svg +5 -0
- package/icons/first-aid.svg +11 -0
- package/icons/firstaid-2.svg +12 -0
- package/icons/flag-2.svg +10 -0
- package/icons/flag.svg +10 -0
- package/icons/flashlight.svg +8 -0
- package/icons/flask-round.svg +10 -0
- package/icons/flask.svg +10 -0
- package/icons/flip.svg +12 -0
- package/icons/floppy.svg +11 -0
- package/icons/folded-hands.svg +12 -0
- package/icons/folder-add.svg +11 -0
- package/icons/folder-delete.svg +11 -0
- package/icons/folder-empty.svg +10 -0
- package/icons/folder-remove.svg +11 -0
- package/icons/folder.svg +10 -0
- package/icons/fork.svg +10 -0
- package/icons/forward.svg +11 -0
- package/icons/frame.svg +11 -0
- package/icons/franc.svg +11 -0
- package/icons/free-drag.svg +11 -0
- package/icons/gay.svg +10 -0
- package/icons/genderless.svg +10 -0
- package/icons/gift.svg +10 -0
- package/icons/globe.svg +10 -0
- package/icons/google.svg +10 -0
- package/icons/grid-2.svg +10 -0
- package/icons/grid.svg +10 -0
- package/icons/grinning-squinting-emoji.svg +6 -0
- package/icons/guitar.svg +10 -0
- package/icons/hand-truck.svg +5 -0
- package/icons/hand.svg +10 -0
- package/icons/happy-emoji.svg +8 -0
- package/icons/headphone.svg +10 -0
- package/icons/heart-beat.svg +10 -0
- package/icons/heart-eyes-emoji.svg +6 -0
- package/icons/heart.svg +10 -0
- package/icons/hetro.svg +10 -0
- package/icons/hide.svg +12 -0
- package/icons/home-1.svg +10 -0
- package/icons/home.svg +10 -0
- package/icons/horizontal-scroll.svg +12 -0
- package/icons/hot-air-balloon.svg +3 -0
- package/icons/ice-cream.svg +10 -0
- package/icons/icon.svg +12 -0
- package/icons/info.svg +5 -0
- package/icons/injection.svg +10 -0
- package/icons/instagram.svg +12 -0
- package/icons/intersex.svg +10 -0
- package/icons/key.svg +11 -0
- package/icons/laugh-emoji.svg +8 -0
- package/icons/layer.svg +10 -0
- package/icons/left-align-2.svg +12 -0
- package/icons/left-align.svg +13 -0
- package/icons/lesbian.svg +10 -0
- package/icons/link.svg +11 -0
- package/icons/linkedin.svg +13 -0
- package/icons/list.svg +15 -0
- package/icons/location-pin.svg +10 -0
- package/icons/location.svg +4 -0
- package/icons/lock.svg +11 -0
- package/icons/login.svg +11 -0
- package/icons/logout.svg +11 -0
- package/icons/lungs.svg +10 -0
- package/icons/magic-wand.svg +13 -0
- package/icons/mail-gift.svg +10 -0
- package/icons/mail-open.svg +10 -0
- package/icons/mail-surprise.svg +10 -0
- package/icons/mail.svg +10 -0
- package/icons/male.svg +10 -0
- package/icons/map.svg +13 -0
- package/icons/maximize.svg +13 -0
- package/icons/medical-logo.svg +10 -0
- package/icons/megaphone.svg +10 -0
- package/icons/menu-2.svg +12 -0
- package/icons/menu.svg +12 -0
- package/icons/message-2.svg +13 -0
- package/icons/message.svg +13 -0
- package/icons/mic-2.svg +11 -0
- package/icons/mic.svg +10 -0
- package/icons/microscope.svg +10 -0
- package/icons/minimize.svg +13 -0
- package/icons/money-plant.svg +11 -0
- package/icons/move.svg +10 -0
- package/icons/movie-clapper.svg +13 -0
- package/icons/multi-touch.svg +11 -0
- package/icons/music-2.svg +10 -0
- package/icons/music-3.svg +10 -0
- package/icons/music.svg +10 -0
- package/icons/mute.svg +11 -0
- package/icons/navigation-2.svg +10 -0
- package/icons/navigation.svg +10 -0
- package/icons/night.svg +10 -0
- package/icons/non-binary-transgender.svg +10 -0
- package/icons/note.svg +11 -0
- package/icons/offer.svg +9 -0
- package/icons/ok.svg +10 -0
- package/icons/other-gender.svg +10 -0
- package/icons/page-move.svg +11 -0
- package/icons/paint-brush-2.svg +10 -0
- package/icons/paint-brush.svg +10 -0
- package/icons/paint-bucket-2.svg +10 -0
- package/icons/paint-bucket.svg +10 -0
- package/icons/paint-roller.svg +10 -0
- package/icons/paper-clip-2.svg +10 -0
- package/icons/paper-clip.svg +10 -0
- package/icons/paste.svg +10 -0
- package/icons/pause.svg +11 -0
- package/icons/paypal.svg +10 -0
- package/icons/pen-tool.svg +10 -0
- package/icons/pen.svg +10 -0
- package/icons/pencil-2.svg +10 -0
- package/icons/pencil-3.svg +11 -0
- package/icons/pencil-ruler.svg +11 -0
- package/icons/pencil.svg +10 -0
- package/icons/phone-setting.svg +12 -0
- package/icons/phone.svg +11 -0
- package/icons/photo.svg +11 -0
- package/icons/pie.svg +11 -0
- package/icons/piggy-bank.svg +13 -0
- package/icons/pills.svg +10 -0
- package/icons/pin.svg +10 -0
- package/icons/pinterest.svg +10 -0
- package/icons/pizza-2.svg +10 -0
- package/icons/pizza.svg +33 -0
- package/icons/plane.svg +3 -0
- package/icons/play.svg +10 -0
- package/icons/png.svg +11 -0
- package/icons/point-down.svg +10 -0
- package/icons/point-left.svg +10 -0
- package/icons/point-right.svg +3 -0
- package/icons/point-up.svg +10 -0
- package/icons/popsicle.svg +10 -0
- package/icons/pound.svg +11 -0
- package/icons/product-hunt.svg +10 -0
- package/icons/puzzle-2.svg +10 -0
- package/icons/puzzle.svg +10 -0
- package/icons/qr.svg +21 -0
- package/icons/question-2.svg +11 -0
- package/icons/question.svg +11 -0
- package/icons/rain-heavy.svg +17 -0
- package/icons/rain-light.svg +13 -0
- package/icons/record.svg +11 -0
- package/icons/rectangle.svg +10 -0
- package/icons/right-align-2.svg +12 -0
- package/icons/right-align.svg +13 -0
- package/icons/rocket.svg +7 -0
- package/icons/rotate.svg +11 -0
- package/icons/rss.svg +13 -0
- package/icons/ruble.svg +11 -0
- package/icons/ruler.svg +10 -0
- package/icons/rupee.svg +11 -0
- package/icons/sad-emoji.svg +8 -0
- package/icons/safe.svg +13 -0
- package/icons/sale.svg +7 -0
- package/icons/satellite.svg +3 -0
- package/icons/saving.svg +15 -0
- package/icons/scan-2.svg +15 -0
- package/icons/scan-fingerprint.svg +20 -0
- package/icons/scan.svg +14 -0
- package/icons/screen-rotate.svg +12 -0
- package/icons/scroll-down.svg +11 -0
- package/icons/scroll-left-1.svg +11 -0
- package/icons/scroll-left.svg +11 -0
- package/icons/scroll-up.svg +11 -0
- package/icons/search.svg +10 -0
- package/icons/send-2.svg +10 -0
- package/icons/send-3.svg +11 -0
- package/icons/send.svg +10 -0
- package/icons/server-2.svg +15 -0
- package/icons/server.svg +3 -0
- package/icons/setting-2.svg +11 -0
- package/icons/setting-3.svg +10 -0
- package/icons/setting.svg +12 -0
- package/icons/shape.svg +10 -0
- package/icons/shield-2.svg +11 -0
- package/icons/shield.svg +11 -0
- package/icons/ship.svg +4 -0
- package/icons/shocked-emoji.svg +8 -0
- package/icons/shop.svg +4 -0
- package/icons/shopping-cart-2.svg +4 -0
- package/icons/shopping-cart-3.svg +4 -0
- package/icons/shopping-cart.svg +5 -0
- package/icons/shuffle.svg +10 -0
- package/icons/signal.svg +14 -0
- package/icons/skype.svg +11 -0
- package/icons/smiling-emoji.svg +6 -0
- package/icons/smiling-with-eyes-emoji.svg +8 -0
- package/icons/snapchat.svg +10 -0
- package/icons/snow.svg +22 -0
- package/icons/snowflake.svg +10 -0
- package/icons/snowman.svg +16 -0
- package/icons/sofa.svg +10 -0
- package/icons/speaker.svg +12 -0
- package/icons/spoon.svg +10 -0
- package/icons/spotify.svg +13 -0
- package/icons/square.svg +10 -0
- package/icons/star.svg +10 -0
- package/icons/stethoscope.svg +11 -0
- package/icons/stopwatch.svg +11 -0
- package/icons/suitcase.svg +10 -0
- package/icons/sun-2.svg +11 -0
- package/icons/sun-3.svg +18 -0
- package/icons/sun-4.svg +11 -0
- package/icons/sun.svg +18 -0
- package/icons/sunny.svg +18 -0
- package/icons/surprised-emoji.svg +8 -0
- package/icons/swipe-left.svg +11 -0
- package/icons/swipe-right.svg +11 -0
- package/icons/switch-1.svg +11 -0
- package/icons/switch.svg +10 -0
- package/icons/sync.svg +11 -0
- package/icons/tablet-2.svg +19 -0
- package/icons/tablet.svg +11 -0
- package/icons/tag-2.svg +3 -0
- package/icons/tag.svg +4 -0
- package/icons/tap-1.svg +15 -0
- package/icons/tap.svg +11 -0
- package/icons/target-2.svg +11 -0
- package/icons/target.svg +13 -0
- package/icons/test-tube.svg +10 -0
- package/icons/thumbs-down.svg +11 -0
- package/icons/thumbs-up-2.svg +11 -0
- package/icons/thumbs-up.svg +11 -0
- package/icons/thunderstorm.svg +11 -0
- package/icons/tick-2.svg +4 -0
- package/icons/tick.svg +3 -0
- package/icons/tik-tok.svg +10 -0
- package/icons/tooth.svg +12 -0
- package/icons/tornado.svg +25 -0
- package/icons/touch-hold.svg +13 -0
- package/icons/transform.svg +10 -0
- package/icons/transgender-2.svg +10 -0
- package/icons/transgender.svg +10 -0
- package/icons/tree-2.svg +10 -0
- package/icons/tree.svg +10 -0
- package/icons/trend-down-square.svg +11 -0
- package/icons/trend-down.svg +10 -0
- package/icons/trend-up-square.svg +11 -0
- package/icons/trend-up.svg +10 -0
- package/icons/trophy-2.svg +3 -0
- package/icons/trophy.svg +10 -0
- package/icons/truck.svg +4 -0
- package/icons/tumblr.svg +11 -0
- package/icons/tv.svg +11 -0
- package/icons/twitch.svg +13 -0
- package/icons/twitter.svg +10 -0
- package/icons/uber.svg +10 -0
- package/icons/unbox.svg +3 -0
- package/icons/unhide.svg +11 -0
- package/icons/unlink.svg +12 -0
- package/icons/upload.svg +11 -0
- package/icons/user-add.svg +12 -0
- package/icons/user-caution.svg +13 -0
- package/icons/user-delete.svg +12 -0
- package/icons/user-female.svg +11 -0
- package/icons/user-male.svg +11 -0
- package/icons/user-remove.svg +12 -0
- package/icons/user.svg +11 -0
- package/icons/v.svg +10 -0
- package/icons/vector.svg +10 -0
- package/icons/vibrate.svg +15 -0
- package/icons/video-camera.svg +10 -0
- package/icons/volume-down.svg +11 -0
- package/icons/volume-up.svg +12 -0
- package/icons/wallet.svg +11 -0
- package/icons/warehouse.svg +3 -0
- package/icons/water.svg +10 -0
- package/icons/wave-left.svg +11 -0
- package/icons/wave-right.svg +11 -0
- package/icons/webflow.svg +10 -0
- package/icons/whatsapp.svg +11 -0
- package/icons/wheelchair.svg +11 -0
- package/icons/wind.svg +14 -0
- package/icons/windows.svg +10 -0
- package/icons/wink-emoji.svg +6 -0
- package/icons/won.svg +11 -0
- package/icons/worried-emoji.svg +8 -0
- package/icons/y-combinator.svg +10 -0
- package/icons/yen.svg +11 -0
- package/icons/youtube.svg +11 -0
- package/icons/zap.svg +10 -0
- package/icons/zoom-in-2.svg +12 -0
- package/icons/zoom-in.svg +11 -0
- package/icons/zoom-out-1.svg +11 -0
- package/icons/zoom-out-2.svg +11 -0
- package/icons/zoom-out.svg +11 -0
- package/manifest.json +43 -0
- package/package.json +53 -0
- package/sidepanel/app.js +437 -0
- package/sidepanel/components/bottom-dock.js +148 -0
- package/sidepanel/components/empty-state.js +40 -0
- package/sidepanel/components/file-list-item.js +58 -0
- package/sidepanel/components/file-list.js +134 -0
- package/sidepanel/components/filter-bar.js +261 -0
- package/sidepanel/components/progress-overlay.js +79 -0
- package/sidepanel/components/recording-indicator.js +32 -0
- package/sidepanel/components/stats-header.js +37 -0
- package/sidepanel/icons/file-type-icons.svg +55 -0
- package/sidepanel/icons/ui-icons.svg +85 -0
- package/sidepanel/index.html +37 -0
- package/sidepanel/styles.css +934 -0
- package/sidepanel/utils/clipboard.js +33 -0
- package/sidepanel/utils/format.js +23 -0
- package/sidepanel/utils/virtual-scroll.js +107 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { formatFileSize } from '../utils/format.js';
|
|
2
|
+
|
|
3
|
+
export function createFileListItem(entry, isChecked, onCheckChange) {
|
|
4
|
+
const el = document.createElement('div');
|
|
5
|
+
el.className = `file-item ${entry.isNew ? 'is-new' : ''}`;
|
|
6
|
+
el.dataset.url = entry.url;
|
|
7
|
+
|
|
8
|
+
// Category badge color
|
|
9
|
+
const catVar = entry.category;
|
|
10
|
+
const bgColor = `var(--cat-${catVar})`;
|
|
11
|
+
const textColor = `var(--cat-${catVar}-text)`;
|
|
12
|
+
|
|
13
|
+
// Extract URL path for display
|
|
14
|
+
let urlPath = entry.url;
|
|
15
|
+
try {
|
|
16
|
+
const parsed = new URL(entry.url);
|
|
17
|
+
urlPath = parsed.hostname + parsed.pathname;
|
|
18
|
+
if (urlPath.length > 60) urlPath = urlPath.substring(0, 57) + '...';
|
|
19
|
+
} catch(e) {}
|
|
20
|
+
|
|
21
|
+
// Category label mapping
|
|
22
|
+
const categoryLabels = {
|
|
23
|
+
images: 'IMG', svg: 'SVG', pdf: 'PDF', scripts: 'JS',
|
|
24
|
+
stylesheets: 'CSS', fonts: 'FONT', media: 'MEDIA',
|
|
25
|
+
documents: 'DOC', other: 'FILE'
|
|
26
|
+
};
|
|
27
|
+
const label = categoryLabels[entry.category] || 'FILE';
|
|
28
|
+
|
|
29
|
+
el.innerHTML = `
|
|
30
|
+
<input type="checkbox" class="file-item-checkbox" ${isChecked ? 'checked' : ''}>
|
|
31
|
+
<div class="file-item-icon" style="color: ${bgColor}">
|
|
32
|
+
<svg width="22" height="22"><use href="icons/file-type-icons.svg#icon-${entry.category}"></use></svg>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="file-item-info">
|
|
35
|
+
<div class="file-item-name" title="${entry.filename || 'unknown'}">${entry.filename || 'unknown'}</div>
|
|
36
|
+
<div class="file-item-url" title="${entry.url}">${urlPath}</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="file-item-badge" style="background-color: ${bgColor}; color: ${textColor}">
|
|
39
|
+
${label}
|
|
40
|
+
</div>
|
|
41
|
+
<div class="file-item-size">${formatFileSize(entry.size)}</div>
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const checkbox = el.querySelector('.file-item-checkbox');
|
|
45
|
+
checkbox.addEventListener('change', (e) => {
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
onCheckChange(entry.url, e.target.checked);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
el.addEventListener('click', (e) => {
|
|
51
|
+
if (e.target !== checkbox && e.target.type !== 'checkbox') {
|
|
52
|
+
checkbox.checked = !checkbox.checked;
|
|
53
|
+
onCheckChange(entry.url, checkbox.checked);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return el;
|
|
58
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { VirtualScroll } from '../utils/virtual-scroll.js';
|
|
2
|
+
import { createFileListItem } from './file-list-item.js';
|
|
3
|
+
|
|
4
|
+
export class FileList {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.container = null;
|
|
7
|
+
this.virtualScroll = null;
|
|
8
|
+
this.allResources = [];
|
|
9
|
+
this.filteredResources = [];
|
|
10
|
+
this.selectedUrls = new Set();
|
|
11
|
+
this.currentFilter = null;
|
|
12
|
+
this.selectionCallback = null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
init(container) {
|
|
16
|
+
this.container = container;
|
|
17
|
+
this.virtualScroll = new VirtualScroll(this.container, {
|
|
18
|
+
itemHeight: 56,
|
|
19
|
+
bufferRows: 10,
|
|
20
|
+
renderItem: (entry, index) => {
|
|
21
|
+
return createFileListItem(entry, this.selectedUrls.has(entry.url), (url, checked) => {
|
|
22
|
+
if (checked) {
|
|
23
|
+
this.selectedUrls.add(url);
|
|
24
|
+
} else {
|
|
25
|
+
this.selectedUrls.delete(url);
|
|
26
|
+
}
|
|
27
|
+
this.notifySelectionChange();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setResources(resources, currentFilter) {
|
|
34
|
+
this.allResources = resources;
|
|
35
|
+
this.currentFilter = currentFilter;
|
|
36
|
+
this.applyFilters();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
applyFilters() {
|
|
40
|
+
if (!this.currentFilter) {
|
|
41
|
+
this.filteredResources = [...this.allResources];
|
|
42
|
+
} else {
|
|
43
|
+
const { category, searchText, sizeRange, newOnly, sortBy } = this.currentFilter;
|
|
44
|
+
|
|
45
|
+
this.filteredResources = this.allResources.filter(entry => {
|
|
46
|
+
if (category !== '*' && entry.category !== category) return false;
|
|
47
|
+
if (newOnly && !entry.isNew) return false;
|
|
48
|
+
if (searchText) {
|
|
49
|
+
const matchName = entry.filename && entry.filename.toLowerCase().includes(searchText);
|
|
50
|
+
const matchUrl = entry.url && entry.url.toLowerCase().includes(searchText);
|
|
51
|
+
if (!matchName && !matchUrl) return false;
|
|
52
|
+
}
|
|
53
|
+
if (sizeRange !== 'any') {
|
|
54
|
+
if (entry.size === null || entry.size === undefined) return false;
|
|
55
|
+
const kb = entry.size / 1024;
|
|
56
|
+
if (sizeRange === '<10KB' && kb >= 10) return false;
|
|
57
|
+
if (sizeRange === '10-100KB' && (kb < 10 || kb > 100)) return false;
|
|
58
|
+
if (sizeRange === '100KB-1MB' && (kb < 100 || kb > 1024)) return false;
|
|
59
|
+
if (sizeRange === '1-10MB' && (kb < 1024 || kb > 10240)) return false;
|
|
60
|
+
if (sizeRange === '>10MB' && kb <= 10240) return false;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
this.filteredResources.sort((a, b) => {
|
|
66
|
+
if (sortBy === 'loadOrder') return a.index - b.index;
|
|
67
|
+
if (sortBy === 'fileSize') {
|
|
68
|
+
if (a.size === null) return 1;
|
|
69
|
+
if (b.size === null) return -1;
|
|
70
|
+
return b.size - a.size;
|
|
71
|
+
}
|
|
72
|
+
if (sortBy === 'fileType') {
|
|
73
|
+
if (a.category !== b.category) return a.category.localeCompare(b.category);
|
|
74
|
+
return (a.filename || '').localeCompare(b.filename || '');
|
|
75
|
+
}
|
|
76
|
+
if (sortBy === 'alphabetical') {
|
|
77
|
+
return (a.filename || '').localeCompare(b.filename || '');
|
|
78
|
+
}
|
|
79
|
+
if (sortBy === 'newest') {
|
|
80
|
+
return (b.timestamp || 0) - (a.timestamp || 0);
|
|
81
|
+
}
|
|
82
|
+
return 0;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.virtualScroll.setItems(this.filteredResources);
|
|
87
|
+
this.notifySelectionChange();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getSelectedUrls() {
|
|
91
|
+
return Array.from(this.selectedUrls);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
getFilteredResources() {
|
|
95
|
+
return this.filteredResources;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
selectAll() {
|
|
99
|
+
this.filteredResources.forEach(r => this.selectedUrls.add(r.url));
|
|
100
|
+
this.virtualScroll.forceRender();
|
|
101
|
+
this.notifySelectionChange();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
selectNone() {
|
|
105
|
+
this.selectedUrls.clear();
|
|
106
|
+
this.virtualScroll.forceRender();
|
|
107
|
+
this.notifySelectionChange();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
invertSelection() {
|
|
111
|
+
this.filteredResources.forEach(r => {
|
|
112
|
+
if (this.selectedUrls.has(r.url)) {
|
|
113
|
+
this.selectedUrls.delete(r.url);
|
|
114
|
+
} else {
|
|
115
|
+
this.selectedUrls.add(r.url);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
this.virtualScroll.forceRender();
|
|
119
|
+
this.notifySelectionChange();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onSelectionChange(callback) {
|
|
123
|
+
this.selectionCallback = callback;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
notifySelectionChange() {
|
|
127
|
+
if (this.selectionCallback) {
|
|
128
|
+
this.selectionCallback({
|
|
129
|
+
selectedCount: this.selectedUrls.size,
|
|
130
|
+
totalFiltered: this.filteredResources.length
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// sidepanel/components/filter-bar.js
|
|
2
|
+
// v1.1 — Custom dropdown menus replacing native <select>
|
|
3
|
+
|
|
4
|
+
export class FilterBar {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.container = null;
|
|
7
|
+
this.callback = null;
|
|
8
|
+
this.state = {
|
|
9
|
+
category: '*',
|
|
10
|
+
searchText: '',
|
|
11
|
+
sizeRange: 'any',
|
|
12
|
+
newOnly: false,
|
|
13
|
+
sortBy: 'loadOrder'
|
|
14
|
+
};
|
|
15
|
+
this.searchTimeout = null;
|
|
16
|
+
this.openDropdown = null; // Track which dropdown is open
|
|
17
|
+
this.categories = [
|
|
18
|
+
{ id: '*', label: 'All' },
|
|
19
|
+
{ id: 'images', label: 'Images' },
|
|
20
|
+
{ id: 'svg', label: 'SVG' },
|
|
21
|
+
{ id: 'pdf', label: 'PDF' },
|
|
22
|
+
{ id: 'scripts', label: 'Scripts' },
|
|
23
|
+
{ id: 'stylesheets', label: 'Styles' },
|
|
24
|
+
{ id: 'fonts', label: 'Fonts' },
|
|
25
|
+
{ id: 'media', label: 'Media' },
|
|
26
|
+
{ id: 'documents', label: 'Docs' },
|
|
27
|
+
{ id: 'other', label: 'Other' }
|
|
28
|
+
];
|
|
29
|
+
this.sortOptions = [
|
|
30
|
+
{ value: 'loadOrder', label: 'Load Order' },
|
|
31
|
+
{ value: 'fileSize', label: 'File Size' },
|
|
32
|
+
{ value: 'fileType', label: 'File Type' },
|
|
33
|
+
{ value: 'alphabetical', label: 'Alphabetical' },
|
|
34
|
+
{ value: 'newest', label: 'Newest' }
|
|
35
|
+
];
|
|
36
|
+
this.sizeOptions = [
|
|
37
|
+
{ value: 'any', label: 'Any Size' },
|
|
38
|
+
{ value: '<10KB', label: '< 10KB' },
|
|
39
|
+
{ value: '10-100KB', label: '10 – 100KB' },
|
|
40
|
+
{ value: '100KB-1MB', label: '100KB – 1MB' },
|
|
41
|
+
{ value: '1-10MB', label: '1 – 10MB' },
|
|
42
|
+
{ value: '>10MB', label: '> 10MB' }
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
// Close dropdowns when clicking outside
|
|
46
|
+
this._documentClickHandler = (e) => {
|
|
47
|
+
if (!e.target.closest('.custom-dropdown')) {
|
|
48
|
+
this.closeAllDropdowns();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
init(container) {
|
|
54
|
+
this.container = container;
|
|
55
|
+
this.render();
|
|
56
|
+
this.attachEvents();
|
|
57
|
+
document.addEventListener('click', this._documentClickHandler);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
onFilterChange(callback) {
|
|
61
|
+
this.callback = callback;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getCurrentFilter() {
|
|
65
|
+
return { ...this.state };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
updateCounts(counts) {
|
|
69
|
+
this.categories.forEach(cat => {
|
|
70
|
+
const el = this.container.querySelector(`.filter-chip[data-cat="${cat.id}"] .chip-count`);
|
|
71
|
+
if (el) {
|
|
72
|
+
const count = cat.id === '*' ? (counts['*'] || 0) : (counts[cat.id] || 0);
|
|
73
|
+
el.textContent = count;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
buildDropdownHtml(id, options, currentValue) {
|
|
79
|
+
const current = options.find(o => o.value === currentValue);
|
|
80
|
+
return `
|
|
81
|
+
<div class="custom-dropdown" data-dropdown="${id}">
|
|
82
|
+
<button class="dropdown-trigger" type="button">
|
|
83
|
+
<span class="dropdown-label">${current?.label || 'Select'}</span>
|
|
84
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
85
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
86
|
+
</svg>
|
|
87
|
+
</button>
|
|
88
|
+
</div>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
render() {
|
|
93
|
+
const chipsHtml = this.categories.map(cat => {
|
|
94
|
+
const isActive = this.state.category === cat.id;
|
|
95
|
+
const catColor = cat.id === '*' ? 'var(--text-primary)' : `var(--cat-${cat.id})`;
|
|
96
|
+
const catTextColor = cat.id === '*' ? 'var(--text-secondary)' : `var(--cat-${cat.id}-text)`;
|
|
97
|
+
return `
|
|
98
|
+
<button class="filter-chip ${isActive ? 'active' : ''}"
|
|
99
|
+
data-cat="${cat.id}"
|
|
100
|
+
style="${isActive
|
|
101
|
+
? `background-color: ${cat.id === '*' ? 'var(--text-primary)' : catColor}; color: white; border-color: ${cat.id === '*' ? 'var(--text-primary)' : catColor};`
|
|
102
|
+
: `border-color: ${cat.id === '*' ? 'var(--text-tertiary)' : catColor}; color: ${cat.id === '*' ? 'var(--text-secondary)' : catTextColor};`
|
|
103
|
+
}">
|
|
104
|
+
<span class="chip-text">${cat.label}</span>
|
|
105
|
+
<span class="chip-count" style="opacity:0.7;">0</span>
|
|
106
|
+
</button>
|
|
107
|
+
`;
|
|
108
|
+
}).join('');
|
|
109
|
+
|
|
110
|
+
this.container.innerHTML = `
|
|
111
|
+
<div class="filter-bar-container">
|
|
112
|
+
<div class="search-input-wrapper">
|
|
113
|
+
<svg width="16" height="16"><use href="icons/ui-icons.svg#icon-search"></use></svg>
|
|
114
|
+
<input type="text" class="search-input" id="search-input"
|
|
115
|
+
placeholder="Search by name or URL..."
|
|
116
|
+
value="${this.state.searchText}">
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<div class="chip-row" id="category-chips">
|
|
120
|
+
${chipsHtml}
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div style="display:flex; gap:8px; margin-top:4px; align-items:center; flex-wrap:wrap;">
|
|
124
|
+
${this.buildDropdownHtml('sort', this.sortOptions, this.state.sortBy)}
|
|
125
|
+
|
|
126
|
+
<button id="new-only-toggle" class="filter-toggle ${this.state.newOnly ? 'active' : ''}">
|
|
127
|
+
New Only
|
|
128
|
+
</button>
|
|
129
|
+
|
|
130
|
+
${this.buildDropdownHtml('size', this.sizeOptions, this.state.sizeRange)}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
attachEvents() {
|
|
137
|
+
// Category chip clicks
|
|
138
|
+
this.container.addEventListener('click', (e) => {
|
|
139
|
+
const chip = e.target.closest('.filter-chip');
|
|
140
|
+
if (chip) {
|
|
141
|
+
const catId = chip.getAttribute('data-cat');
|
|
142
|
+
this.state.category = catId;
|
|
143
|
+
|
|
144
|
+
// Re-render chips to update active styles
|
|
145
|
+
const chips = this.container.querySelectorAll('.filter-chip');
|
|
146
|
+
chips.forEach(c => {
|
|
147
|
+
const cId = c.getAttribute('data-cat');
|
|
148
|
+
const isNowActive = cId === catId;
|
|
149
|
+
c.classList.toggle('active', isNowActive);
|
|
150
|
+
const catColor = cId === '*' ? 'var(--text-primary)' : `var(--cat-${cId})`;
|
|
151
|
+
const catTextColor = cId === '*' ? 'var(--text-secondary)' : `var(--cat-${cId}-text)`;
|
|
152
|
+
if (isNowActive) {
|
|
153
|
+
c.style.backgroundColor = cId === '*' ? 'var(--text-primary)' : catColor;
|
|
154
|
+
c.style.color = 'white';
|
|
155
|
+
c.style.borderColor = cId === '*' ? 'var(--text-primary)' : catColor;
|
|
156
|
+
} else {
|
|
157
|
+
c.style.backgroundColor = 'transparent';
|
|
158
|
+
c.style.color = cId === '*' ? 'var(--text-secondary)' : catTextColor;
|
|
159
|
+
c.style.borderColor = cId === '*' ? 'var(--text-tertiary)' : catColor;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
this.notifyChange();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const newOnlyToggle = e.target.closest('#new-only-toggle');
|
|
168
|
+
if (newOnlyToggle) {
|
|
169
|
+
this.state.newOnly = !this.state.newOnly;
|
|
170
|
+
newOnlyToggle.classList.toggle('active', this.state.newOnly);
|
|
171
|
+
this.notifyChange();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Custom dropdown trigger click
|
|
176
|
+
const trigger = e.target.closest('.dropdown-trigger');
|
|
177
|
+
if (trigger) {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
const dropdown = trigger.closest('.custom-dropdown');
|
|
180
|
+
const dropdownId = dropdown.getAttribute('data-dropdown');
|
|
181
|
+
|
|
182
|
+
if (this.openDropdown === dropdownId) {
|
|
183
|
+
this.closeAllDropdowns();
|
|
184
|
+
} else {
|
|
185
|
+
this.closeAllDropdowns();
|
|
186
|
+
this.openDropdownMenu(dropdown, dropdownId);
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Dropdown option click
|
|
192
|
+
const option = e.target.closest('.dropdown-option');
|
|
193
|
+
if (option) {
|
|
194
|
+
const dropdown = option.closest('.custom-dropdown');
|
|
195
|
+
const dropdownId = dropdown.getAttribute('data-dropdown');
|
|
196
|
+
const value = option.getAttribute('data-value');
|
|
197
|
+
|
|
198
|
+
if (dropdownId === 'sort') {
|
|
199
|
+
this.state.sortBy = value;
|
|
200
|
+
} else if (dropdownId === 'size') {
|
|
201
|
+
this.state.sizeRange = value;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Update trigger label
|
|
205
|
+
const trigger = dropdown.querySelector('.dropdown-trigger .dropdown-label');
|
|
206
|
+
if (trigger) trigger.textContent = option.textContent;
|
|
207
|
+
|
|
208
|
+
this.closeAllDropdowns();
|
|
209
|
+
this.notifyChange();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Search input
|
|
215
|
+
const searchInput = this.container.querySelector('#search-input');
|
|
216
|
+
if (searchInput) {
|
|
217
|
+
searchInput.addEventListener('input', (e) => {
|
|
218
|
+
clearTimeout(this.searchTimeout);
|
|
219
|
+
this.searchTimeout = setTimeout(() => {
|
|
220
|
+
this.state.searchText = e.target.value.toLowerCase().trim();
|
|
221
|
+
this.notifyChange();
|
|
222
|
+
}, 150);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
openDropdownMenu(dropdownEl, dropdownId) {
|
|
228
|
+
const trigger = dropdownEl.querySelector('.dropdown-trigger');
|
|
229
|
+
trigger.classList.add('open');
|
|
230
|
+
|
|
231
|
+
const options = dropdownId === 'sort' ? this.sortOptions : this.sizeOptions;
|
|
232
|
+
const currentValue = dropdownId === 'sort' ? this.state.sortBy : this.state.sizeRange;
|
|
233
|
+
|
|
234
|
+
const menuHtml = options.map(opt =>
|
|
235
|
+
`<button class="dropdown-option ${opt.value === currentValue ? 'active' : ''}" data-value="${opt.value}">${opt.label}</button>`
|
|
236
|
+
).join('');
|
|
237
|
+
|
|
238
|
+
const menu = document.createElement('div');
|
|
239
|
+
menu.className = 'dropdown-menu';
|
|
240
|
+
menu.innerHTML = menuHtml;
|
|
241
|
+
dropdownEl.appendChild(menu);
|
|
242
|
+
this.openDropdown = dropdownId;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
closeAllDropdowns() {
|
|
246
|
+
const menus = this.container.querySelectorAll('.dropdown-menu');
|
|
247
|
+
menus.forEach(menu => {
|
|
248
|
+
menu.classList.add('closing');
|
|
249
|
+
setTimeout(() => menu.remove(), 150);
|
|
250
|
+
});
|
|
251
|
+
const triggers = this.container.querySelectorAll('.dropdown-trigger.open');
|
|
252
|
+
triggers.forEach(t => t.classList.remove('open'));
|
|
253
|
+
this.openDropdown = null;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
notifyChange() {
|
|
257
|
+
if (this.callback) {
|
|
258
|
+
this.callback({ ...this.state });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export class ProgressOverlay {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.container = null;
|
|
4
|
+
this.retryCallback = null;
|
|
5
|
+
this.cancelCallback = null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
init(container) {
|
|
9
|
+
this.container = container;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
show(progress) {
|
|
13
|
+
if (!progress) return;
|
|
14
|
+
const { total, completed, failed, items } = progress;
|
|
15
|
+
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
|
16
|
+
|
|
17
|
+
const itemsHtml = (items || []).map(item => {
|
|
18
|
+
let icon = '⏳';
|
|
19
|
+
let statusText = 'Queued';
|
|
20
|
+
let statusClass = 'status-queued';
|
|
21
|
+
if (item.status === 'completed') { icon = '✅'; statusText = 'Complete'; statusClass = 'status-complete'; }
|
|
22
|
+
else if (item.status === 'downloading') { icon = '⬇️'; statusText = 'Downloading...'; statusClass = 'status-downloading'; }
|
|
23
|
+
else if (item.status === 'failed') { icon = '❌'; statusText = item.error || 'Failed'; statusClass = 'status-failed'; }
|
|
24
|
+
|
|
25
|
+
return `
|
|
26
|
+
<div class="progress-item ${statusClass}">
|
|
27
|
+
<span class="progress-item-icon">${icon}</span>
|
|
28
|
+
<span class="progress-item-name">${item.filename || 'unknown'}</span>
|
|
29
|
+
<span class="progress-item-status">${statusText}</span>
|
|
30
|
+
${item.status === 'failed' ? `<button class="progress-retry-btn" data-url="${item.url}">Retry</button>` : ''}
|
|
31
|
+
</div>
|
|
32
|
+
`;
|
|
33
|
+
}).join('');
|
|
34
|
+
|
|
35
|
+
this.container.innerHTML = `
|
|
36
|
+
<div class="progress-card">
|
|
37
|
+
<h3 class="progress-title">Downloading Files</h3>
|
|
38
|
+
<div class="progress-bar-container">
|
|
39
|
+
<div class="progress-bar-fill" style="width: ${percent}%"></div>
|
|
40
|
+
</div>
|
|
41
|
+
<p class="progress-counter">${completed} of ${total} completed${failed > 0 ? ` · ${failed} failed` : ''}</p>
|
|
42
|
+
<div class="progress-items-list">
|
|
43
|
+
${itemsHtml}
|
|
44
|
+
</div>
|
|
45
|
+
<button class="progress-cancel-btn" id="progress-cancel">
|
|
46
|
+
${completed >= total ? 'Close' : 'Cancel'}
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
this.container.classList.add('active');
|
|
52
|
+
|
|
53
|
+
// Attach events
|
|
54
|
+
this.container.querySelector('#progress-cancel')?.addEventListener('click', () => {
|
|
55
|
+
this.hide();
|
|
56
|
+
if (this.cancelCallback) this.cancelCallback();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
this.container.querySelectorAll('.progress-retry-btn').forEach(btn => {
|
|
60
|
+
btn.addEventListener('click', () => {
|
|
61
|
+
const url = btn.getAttribute('data-url');
|
|
62
|
+
if (this.retryCallback && url) this.retryCallback(url);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
hide() {
|
|
68
|
+
this.container.classList.remove('active');
|
|
69
|
+
this.container.innerHTML = '';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onRetry(callback) {
|
|
73
|
+
this.retryCallback = callback;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
onCancel(callback) {
|
|
77
|
+
this.cancelCallback = callback;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// sidepanel/components/recording-indicator.js
|
|
2
|
+
// v1.2 — No blinking: only updates if state actually changes
|
|
3
|
+
|
|
4
|
+
export class RecordingIndicator {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.container = null;
|
|
7
|
+
this._lastActive = null;
|
|
8
|
+
this._lastDeepScan = null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
init(container) {
|
|
12
|
+
this.container = container;
|
|
13
|
+
this.update({ active: false, deepScan: false });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
update(state) {
|
|
17
|
+
const { active, deepScan } = state;
|
|
18
|
+
|
|
19
|
+
// Prevent unnecessary re-renders that cause blinking
|
|
20
|
+
if (active === this._lastActive && deepScan === this._lastDeepScan) return;
|
|
21
|
+
this._lastActive = active;
|
|
22
|
+
this._lastDeepScan = deepScan;
|
|
23
|
+
|
|
24
|
+
this.container.innerHTML = `
|
|
25
|
+
<div class="recording-indicator">
|
|
26
|
+
<span class="recording-dot ${active ? 'active' : ''}"></span>
|
|
27
|
+
<span>${active ? 'Capturing' : 'Ready'}</span>
|
|
28
|
+
${active && deepScan ? '<span class="deep-scan-badge">Deep Scan</span>' : ''}
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// sidepanel/components/stats-header.js
|
|
2
|
+
// v1.2 — No blinking: only updates if stats actually change
|
|
3
|
+
|
|
4
|
+
export class StatsHeader {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.container = null;
|
|
7
|
+
this._lastKey = '';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
init(container) {
|
|
11
|
+
this.container = container;
|
|
12
|
+
this.update({ total: 0, newSinceLastBatch: 0, tabUrl: '' });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
update(stats) {
|
|
16
|
+
const { total, newSinceLastBatch, tabUrl } = stats;
|
|
17
|
+
|
|
18
|
+
// Prevent unnecessary re-renders that cause blinking
|
|
19
|
+
const key = `${total}_${newSinceLastBatch}_${tabUrl}`;
|
|
20
|
+
if (key === this._lastKey) return;
|
|
21
|
+
this._lastKey = key;
|
|
22
|
+
|
|
23
|
+
let domain = '';
|
|
24
|
+
try {
|
|
25
|
+
domain = new URL(tabUrl).hostname;
|
|
26
|
+
} catch(e) {}
|
|
27
|
+
|
|
28
|
+
this.container.innerHTML = `
|
|
29
|
+
<div class="stats-header-container">
|
|
30
|
+
<span class="stats-count">${total}</span>
|
|
31
|
+
<span>files detected</span>
|
|
32
|
+
${newSinceLastBatch > 0 ? `<span>· <strong>${newSinceLastBatch}</strong> new</span>` : ''}
|
|
33
|
+
${domain ? `<span class="stats-domain" title="${domain}">${domain}</span>` : ''}
|
|
34
|
+
</div>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
|
2
|
+
<symbol id="icon-images" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
3
|
+
<path d="M4 18L10 11L14 15L20 8" />
|
|
4
|
+
<circle cx="16" cy="6" r="2" />
|
|
5
|
+
<rect x="2" y="3" width="20" height="18" rx="2" />
|
|
6
|
+
</symbol>
|
|
7
|
+
|
|
8
|
+
<symbol id="icon-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
9
|
+
<path d="M4 20C4 20 8 4 12 4C16 4 20 20 20 20" />
|
|
10
|
+
<circle cx="4" cy="20" r="1.5" />
|
|
11
|
+
<circle cx="12" cy="4" r="1.5" />
|
|
12
|
+
<circle cx="20" cy="20" r="1.5" />
|
|
13
|
+
</symbol>
|
|
14
|
+
|
|
15
|
+
<symbol id="icon-pdf" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
16
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
|
|
17
|
+
<polyline points="14 2 14 8 20 8" />
|
|
18
|
+
<path d="M8 13h2a2 2 0 1 0 0-4H8v8" />
|
|
19
|
+
<path d="M14 17h-2v-8h2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2z" />
|
|
20
|
+
</symbol>
|
|
21
|
+
|
|
22
|
+
<symbol id="icon-scripts" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
23
|
+
<polyline points="8 6 2 12 8 18" />
|
|
24
|
+
<polyline points="16 6 22 12 16 18" />
|
|
25
|
+
<line x1="14" y1="4" x2="10" y2="20" />
|
|
26
|
+
</symbol>
|
|
27
|
+
|
|
28
|
+
<symbol id="icon-stylesheets" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
29
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.53-.21-1.04-.59-1.41-.36-.36-.59-.86-.59-1.41 0-1.1.9-2 2-2h1.17C19.5 14.67 22 12.17 22 9c0-3.87-4.48-7-10-7zm-4 9c-.83 0-1.5-.67-1.5-1.5S7.17 8 8 8s1.5.67 1.5 1.5S8.83 11 8 11zm4-3c-.83 0-1.5-.67-1.5-1.5S11.17 5 12 5s1.5.67 1.5 1.5S12.83 8 12 8zm4 3c-.83 0-1.5-.67-1.5-1.5S15.17 8 16 8s1.5.67 1.5 1.5S16.83 11 16 11z" />
|
|
30
|
+
</symbol>
|
|
31
|
+
|
|
32
|
+
<symbol id="icon-fonts" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
33
|
+
<path d="M4 20L9 5h6l5 15" />
|
|
34
|
+
<path d="M6 14h12" />
|
|
35
|
+
</symbol>
|
|
36
|
+
|
|
37
|
+
<symbol id="icon-media" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
38
|
+
<circle cx="12" cy="12" r="10" />
|
|
39
|
+
<polygon points="10 8 16 12 10 16 10 8" />
|
|
40
|
+
</symbol>
|
|
41
|
+
|
|
42
|
+
<symbol id="icon-documents" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
43
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
|
|
44
|
+
<polyline points="14 2 14 8 20 8" />
|
|
45
|
+
<line x1="8" y1="13" x2="16" y2="13" />
|
|
46
|
+
<line x1="8" y1="17" x2="16" y2="17" />
|
|
47
|
+
</symbol>
|
|
48
|
+
|
|
49
|
+
<symbol id="icon-other" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
50
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
|
|
51
|
+
<polyline points="14 2 14 8 20 8" />
|
|
52
|
+
<path d="M12 12a1.5 1.5 0 0 1 1.5 1.5c0 .7-.5 1-1 1.5s-1 .8-1 1.5v.5" />
|
|
53
|
+
<circle cx="12" cy="19" r=".5" />
|
|
54
|
+
</symbol>
|
|
55
|
+
</svg>
|