Skip to content

Commit 5ac68af

Browse files
committed
feat(scan-core): add 'part' attribute and create overlay element
1 parent e487669 commit 5ac68af

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

packages/scan/src/core/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,11 @@ export const start = () => {
319319

320320
const audioContext =
321321
typeof window !== 'undefined'
322-
? new (window.AudioContext ||
322+
? new (
323+
window.AudioContext ||
323324
// @ts-expect-error -- This is a fallback for Safari
324-
window.webkitAudioContext)()
325+
window.webkitAudioContext
326+
)()
325327
: null;
326328

327329
let ctx: ReturnType<typeof initReactScanOverlay> | null = null;
@@ -391,10 +393,8 @@ export const start = () => {
391393
toolbarContainer = createToolbar(shadow);
392394
}
393395

394-
// Add this right after creating the container
395396
container.setAttribute('part', 'scan-root');
396397

397-
// Add this before creating the Shadow DOM
398398
const mainStyles = document.createElement('style');
399399
mainStyles.textContent = `
400400
html[data-theme="light"] react-scan-root::part(scan-root) {
@@ -411,9 +411,7 @@ export const start = () => {
411411
if (existingOverlay) {
412412
return;
413413
}
414-
const overlayElement = document.createElement(
415-
'react-scan-overlay',
416-
) as any;
414+
const overlayElement = document.createElement('react-scan-overlay');
417415

418416
document.documentElement.appendChild(overlayElement);
419417

0 commit comments

Comments
 (0)