diff --git a/.changeset/unlucky-dodos-drum.md b/.changeset/unlucky-dodos-drum.md new file mode 100644 index 0000000..f9ab08a --- /dev/null +++ b/.changeset/unlucky-dodos-drum.md @@ -0,0 +1,5 @@ +--- +"astro-vtbot": patch +--- + +Fixes a bug where explicitly set properties of `` were lost. diff --git a/components/ProgressBar.astro b/components/ProgressBar.astro index 6dec201..7303074 100644 --- a/components/ProgressBar.astro +++ b/components/ProgressBar.astro @@ -1,19 +1,23 @@ --- +export interface Props {} --- + - diff --git a/components/ProgressBar.d.ts b/components/ProgressBar.d.ts new file mode 100644 index 0000000..8745328 --- /dev/null +++ b/components/ProgressBar.d.ts @@ -0,0 +1 @@ +export default function ProgressBar(_props: import('./ProgressBar.astro').Props): any; diff --git a/components/loading-indicator.ts b/components/loading-indicator.ts index 34bb529..7ad2efb 100644 --- a/components/loading-indicator.ts +++ b/components/loading-indicator.ts @@ -1,6 +1,9 @@ /// -import { TRANSITION_BEFORE_PREPARATION, TRANSITION_BEFORE_SWAP, TRANSITION_PAGE_LOAD } from 'astro:transitions/client'; - +import { + TRANSITION_BEFORE_PREPARATION, + TRANSITION_BEFORE_SWAP, + TRANSITION_PAGE_LOAD, +} from 'astro:transitions/client'; let show: () => void; let hide: () => void; @@ -36,7 +39,6 @@ export async function ensureLoadingIndicator() { } } - const beforePreparation = () => { if (!ownIndicator) ensureLoadingIndicator(); document.documentElement.classList.add(`loading`); @@ -56,4 +58,3 @@ export function init(createIndicator: boolean = false) { createIndicator && document.addEventListener(TRANSITION_PAGE_LOAD, ensureLoadingIndicator); !createIndicator && document.removeEventListener(TRANSITION_PAGE_LOAD, ensureLoadingIndicator); } - diff --git a/components/template/LoadingIndicatorTemplate_CSS.astro b/components/template/LoadingIndicatorTemplate_CSS.astro index 015c60d..910c539 100644 --- a/components/template/LoadingIndicatorTemplate_CSS.astro +++ b/components/template/LoadingIndicatorTemplate_CSS.astro @@ -1,25 +1,33 @@ --- -import LoadingIndicator from 'astro-vtbot/components/LoadingIndicator.astro' +import LoadingIndicator from 'astro-vtbot/components/LoadingIndicator.astro'; --- -{/* By rendering here, - you inherit the logic that sets the "loading" CSS class */} +{ + /* By rendering here, + you inherit the logic that sets the "loading" CSS class */ +} -{/* Defining this div is only necessary - if you do not want to use the default element that holds the favicon image */} -
- ... -
- - +{ + /* Defining this div is only necessary + if you do not want to use the default element that holds the favicon image */ +} +
+ + +
+ +
+
diff --git a/integration/env.d.ts b/integration/env.d.ts index 8c34fb4..f964fe0 100644 --- a/integration/env.d.ts +++ b/integration/env.d.ts @@ -1 +1 @@ -/// \ No newline at end of file +/// diff --git a/integration/vite-plugin-extend.ts b/integration/vite-plugin-extend.ts index 80cbe89..037dab3 100644 --- a/integration/vite-plugin-extend.ts +++ b/integration/vite-plugin-extend.ts @@ -18,7 +18,7 @@ export default function vitePluginVtbotExtend(opts: ExtendOptions): Plugin { if (!import.meta.env.DEV) linter = false; if ((!linter && !loading) || id.match(/vtpl[123]\.astro$/) || !id.endsWith('.astro')) return; - const replacement = `"astro-vtbot/vtex${loading ? (linter ? "3" : "2") : "1"}"`; + const replacement = `"astro-vtbot/vtex${loading ? (linter ? '3' : '2') : '1'}"`; const match = code.match(/from\s*['"]astro:transitions["']/ms); if (match) { const ast = parse(code, { @@ -31,7 +31,7 @@ export default function vitePluginVtbotExtend(opts: ExtendOptions): Plugin { if (node.type === 'ImportDeclaration' && node.source.value === 'astro:transitions') { code = code.substring(0, node.source.start) + - replacement + + replacement + code.substring(node.source.end); } }, diff --git a/integration/vtpl1.astro b/integration/vtpl1.astro index 20cadfa..a167fcd 100644 --- a/integration/vtpl1.astro +++ b/integration/vtpl1.astro @@ -3,5 +3,5 @@ import { ViewTransitions } from 'astro:transitions'; import Linter from '../components/Linter.astro'; --- - + diff --git a/integration/vtpl2.astro b/integration/vtpl2.astro index 19153e5..cbe61a3 100644 --- a/integration/vtpl2.astro +++ b/integration/vtpl2.astro @@ -3,5 +3,5 @@ import { ViewTransitions } from 'astro:transitions'; import LoadingIndicator from '../components/LoadingIndicator.astro'; --- - + diff --git a/integration/vtpl3.astro b/integration/vtpl3.astro index 8dbfc45..747c40f 100644 --- a/integration/vtpl3.astro +++ b/integration/vtpl3.astro @@ -3,5 +3,5 @@ import VTPL from './vtpl1.astro'; import LoadingIndicator from '../components/LoadingIndicator.astro'; --- - +