astro 3.0.9 → 3.0.10
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.
|
@@ -102,14 +102,10 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
102
102
|
|
|
103
103
|
function isInfinite(animation: Animation) {
|
|
104
104
|
const effect = animation.effect;
|
|
105
|
-
if(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
) return false;
|
|
110
|
-
const style = window.getComputedStyle(effect.target, effect.pseudoElement);
|
|
111
|
-
return style.animationIterationCount === "infinite";
|
|
112
|
-
}
|
|
105
|
+
if (!effect || !(effect instanceof KeyframeEffect) || !effect.target) return false;
|
|
106
|
+
const style = window.getComputedStyle(effect.target, effect.pseudoElement);
|
|
107
|
+
return style.animationIterationCount === 'infinite';
|
|
108
|
+
}
|
|
113
109
|
|
|
114
110
|
const parser = new DOMParser();
|
|
115
111
|
|
|
@@ -236,8 +232,10 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
236
232
|
// Trigger the animations
|
|
237
233
|
const currentAnimations = document.getAnimations();
|
|
238
234
|
document.documentElement.dataset.astroTransitionFallback = 'old';
|
|
239
|
-
const newAnimations = document
|
|
240
|
-
|
|
235
|
+
const newAnimations = document
|
|
236
|
+
.getAnimations()
|
|
237
|
+
.filter((a) => !currentAnimations.includes(a) && !isInfinite(a));
|
|
238
|
+
const finished = Promise.all(newAnimations.map((a) => a.finished));
|
|
241
239
|
const fallbackSwap = () => {
|
|
242
240
|
swap();
|
|
243
241
|
document.documentElement.dataset.astroTransitionFallback = 'new';
|
|
@@ -354,7 +352,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
354
352
|
// The current page doesn't haven't View Transitions,
|
|
355
353
|
// respect that with a full page reload
|
|
356
354
|
// -- but only for transition managed by us (ev.state is set)
|
|
357
|
-
history.scrollRestoration && (history.scrollRestoration =
|
|
355
|
+
history.scrollRestoration && (history.scrollRestoration = 'manual');
|
|
358
356
|
location.reload();
|
|
359
357
|
return;
|
|
360
358
|
}
|
|
@@ -365,7 +363,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
365
363
|
// The browser will handle navigation fine without our help
|
|
366
364
|
if (ev.state === null) {
|
|
367
365
|
if (history.scrollRestoration) {
|
|
368
|
-
history.scrollRestoration =
|
|
366
|
+
history.scrollRestoration = 'auto';
|
|
369
367
|
}
|
|
370
368
|
return;
|
|
371
369
|
}
|
|
@@ -373,7 +371,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
373
371
|
// With the default "auto", the browser will jump to the old scroll position
|
|
374
372
|
// before the ViewTransition is complete.
|
|
375
373
|
if (history.scrollRestoration) {
|
|
376
|
-
history.scrollRestoration =
|
|
374
|
+
history.scrollRestoration = 'manual';
|
|
377
375
|
}
|
|
378
376
|
|
|
379
377
|
const state: State | undefined = history.state;
|
|
@@ -404,13 +402,13 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
404
402
|
addEventListener('load', onPageLoad);
|
|
405
403
|
// There's not a good way to record scroll position before a back button.
|
|
406
404
|
// So the way we do it is by listening to scrollend if supported, and if not continuously record the scroll position.
|
|
407
|
-
|
|
405
|
+
const updateState = () => {
|
|
408
406
|
// only update history entries that are managed by us
|
|
409
407
|
// leave other entries alone and do not accidently add state.
|
|
410
408
|
if (history.state) {
|
|
411
409
|
persistState({ ...history.state, scrollY });
|
|
412
410
|
}
|
|
413
|
-
}
|
|
411
|
+
};
|
|
414
412
|
if ('onscrollend' in window) addEventListener('scrollend', updateState);
|
|
415
413
|
else addEventListener('scroll', throttle(updateState, 300));
|
|
416
414
|
}
|
|
@@ -6,10 +6,11 @@ import {
|
|
|
6
6
|
prependForwardSlash,
|
|
7
7
|
removeQueryString
|
|
8
8
|
} from "../core/path.js";
|
|
9
|
-
import { VIRTUAL_MODULE_ID, VIRTUAL_SERVICE_ID } from "./consts.js";
|
|
9
|
+
import { VALID_INPUT_FORMATS, VIRTUAL_MODULE_ID, VIRTUAL_SERVICE_ID } from "./consts.js";
|
|
10
10
|
import { emitESMImage } from "./utils/emitAsset.js";
|
|
11
11
|
import { hashTransform, propsToFilename } from "./utils/transformToPath.js";
|
|
12
12
|
const resolvedVirtualModuleId = "\0" + VIRTUAL_MODULE_ID;
|
|
13
|
+
const assetRegex = new RegExp(`.(${VALID_INPUT_FORMATS.join("|")})$`, "i");
|
|
13
14
|
function assets({
|
|
14
15
|
settings,
|
|
15
16
|
mode
|
|
@@ -99,7 +100,7 @@ function assets({
|
|
|
99
100
|
if (id !== removeQueryString(id)) {
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
|
-
if (
|
|
103
|
+
if (assetRegex.test(id)) {
|
|
103
104
|
const meta = await emitESMImage(id, this.meta.watchMode, this.emitFile);
|
|
104
105
|
return `export default ${JSON.stringify(meta)}`;
|
|
105
106
|
}
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -20,7 +20,7 @@ async function dev(inlineConfig) {
|
|
|
20
20
|
base: restart.container.settings.config.base
|
|
21
21
|
})
|
|
22
22
|
);
|
|
23
|
-
const currentVersion = "3.0.
|
|
23
|
+
const currentVersion = "3.0.10";
|
|
24
24
|
if (currentVersion.includes("-")) {
|
|
25
25
|
logger.warn(null, msg.prerelease({ currentVersion }));
|
|
26
26
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -50,7 +50,7 @@ function serverStart({
|
|
|
50
50
|
base,
|
|
51
51
|
isRestart = false
|
|
52
52
|
}) {
|
|
53
|
-
const version = "3.0.
|
|
53
|
+
const version = "3.0.10";
|
|
54
54
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
55
55
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
56
56
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -235,7 +235,7 @@ function printHelp({
|
|
|
235
235
|
message.push(
|
|
236
236
|
linebreak(),
|
|
237
237
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
238
|
-
`v${"3.0.
|
|
238
|
+
`v${"3.0.10"}`
|
|
239
239
|
)} ${headline}`
|
|
240
240
|
);
|
|
241
241
|
}
|