bun-plugin-stx 0.2.248 → 0.2.250

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.
@@ -1960,6 +1960,21 @@ else {
1960
1960
  // mode where every page is part of the same SPA shell.
1961
1961
  document.addEventListener('click',function(e){
1962
1962
  if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;
1963
+ // A handler on the page has already decided this click is not a
1964
+ // navigation, so the router must not perform one - the same contract the
1965
+ // browser honours for a plain anchor.
1966
+ //
1967
+ // This listener used to run in the CAPTURE phase, which broke that twice
1968
+ // over: it saw the click before the anchor did, so defaultPrevented was
1969
+ // necessarily false by the time it was read here, and the stopPropagation
1970
+ // below then stopped the event ever reaching the element - so a page's own
1971
+ // click handler on an intercepted link never ran AT ALL. Progressive
1972
+ // enhancement on an anchor was impossible; the only way out was to swap it
1973
+ // for a button in script (stacksjs/stacks#2393).
1974
+ //
1975
+ // Bubbling instead puts the page's handlers first, which is where a
1976
+ // decision about the page's own markup belongs.
1977
+ if(e.defaultPrevented)return;
1963
1978
  if(!e.target||!e.target.closest)return;
1964
1979
  var link=e.target.closest('[data-stx-link]');
1965
1980
  // A marked link still has to clear the opt-out set. It used to skip it
@@ -1977,7 +1992,7 @@ else {
1977
1992
  e.stopPropagation();
1978
1993
  log('[router] navigating to:',href);
1979
1994
  navigate(withCurrentLocale(href));
1980
- },true);
1995
+ });
1981
1996
 
1982
1997
  // \u2500\u2500 Form submission \u2500\u2500
1983
1998
  // A submit IS a navigation, and the router only ever watched clicks. So any
package/dist/serve.js CHANGED
@@ -9592,7 +9592,7 @@ function __stxOverlay(errs){
9592
9592
  pageMiddlewarePatterns.length = 0;
9593
9593
  await Promise.all(files.map((f) => detectPageMiddleware(f)));
9594
9594
  try {
9595
- const { Router } = await import("./chunk-qqcjq6v2.js");
9595
+ const { Router } = await import("./chunk-3d72end9.js");
9596
9596
  const pagesDirs = patterns.map((p) => p.replace(/\/$/, "")).filter(Boolean);
9597
9597
  const router = new Router(process19.cwd(), { pagesDirs, stateDir: stateDirName() });
9598
9598
  if (!options.quiet)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-plugin-stx",
3
3
  "type": "module",
4
- "version": "0.2.248",
4
+ "version": "0.2.250",
5
5
  "description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",