@farm.js/core 0.1.0-beta.54 → 0.1.0-beta.55

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.
Files changed (66) hide show
  1. package/dist/{chunk-PGZVE6P7.mjs → chunk-2ISN27CV.mjs} +2 -2
  2. package/dist/{chunk-ENPB4CSY.mjs → chunk-BLTATPSB.mjs} +2 -2
  3. package/dist/{chunk-ENPB4CSY.mjs.map → chunk-BLTATPSB.mjs.map} +1 -1
  4. package/dist/{chunk-J34JCW6R.mjs → chunk-MSQDIAQW.mjs} +2 -2
  5. package/dist/{chunk-GPHLXAFT.mjs → chunk-OGFWHBDO.mjs} +2 -2
  6. package/dist/{chunk-JECGLPIS.mjs → chunk-PYIVNTDI.mjs} +4 -4
  7. package/dist/{chunk-GVQ54ERX.mjs → chunk-RAZ7L3UY.mjs} +2 -2
  8. package/dist/{chunk-427JQ6OZ.mjs → chunk-YBHLSG7E.mjs} +54 -11
  9. package/dist/chunk-YBHLSG7E.mjs.map +1 -0
  10. package/dist/{chunk-BDHDDITP.mjs → chunk-ZP5IWDTE.mjs} +9 -8
  11. package/dist/chunk-ZP5IWDTE.mjs.map +1 -0
  12. package/dist/client/lifecycle.mjs +2 -2
  13. package/dist/client-plugins.cjs +1 -1
  14. package/dist/client-plugins.cjs.map +1 -1
  15. package/dist/client-plugins.mjs +2 -2
  16. package/dist/client.cjs +41 -12
  17. package/dist/client.cjs.map +1 -1
  18. package/dist/client.d.mts +2 -2
  19. package/dist/client.d.ts +2 -2
  20. package/dist/client.mjs +11 -11
  21. package/dist/index.cjs +41 -12
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.mts +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.mjs +17 -17
  26. package/dist/internal/build-runtime.cjs +1 -1
  27. package/dist/internal/build-runtime.cjs.map +1 -1
  28. package/dist/internal/build-runtime.mjs +3 -3
  29. package/dist/internal/client-runtime.cjs +1 -1
  30. package/dist/internal/client-runtime.cjs.map +1 -1
  31. package/dist/internal/client-runtime.mjs +2 -2
  32. package/dist/navigation.cjs +40 -11
  33. package/dist/navigation.cjs.map +1 -1
  34. package/dist/navigation.mjs +4 -4
  35. package/dist/plugin.cjs +1 -1
  36. package/dist/plugin.cjs.map +1 -1
  37. package/dist/plugin.mjs +2 -2
  38. package/dist/query/client.cjs +86 -7
  39. package/dist/query/client.cjs.map +1 -1
  40. package/dist/query/client.mjs +13 -7
  41. package/dist/query/client.mjs.map +1 -1
  42. package/dist/renderer-client.cjs +29 -9
  43. package/dist/renderer-client.cjs.map +1 -1
  44. package/dist/renderer-client.d.mts +1 -1
  45. package/dist/renderer-client.d.ts +1 -1
  46. package/dist/renderer-client.mjs +12 -9
  47. package/dist/renderer-client.mjs.map +1 -1
  48. package/dist/server.cjs +1 -1
  49. package/dist/server.cjs.map +1 -1
  50. package/dist/server.mjs +2 -2
  51. package/dist/{spa-router-BD7iUG-C.d.mts → spa-router-BV71GGW0.d.mts} +4 -3
  52. package/dist/{spa-router-swFKTqwR.d.ts → spa-router-BylM6JXm.d.ts} +4 -3
  53. package/dist/version.cjs +1 -1
  54. package/dist/version.cjs.map +1 -1
  55. package/dist/version.mjs +1 -1
  56. package/dist/vite.cjs +1 -1
  57. package/dist/vite.cjs.map +1 -1
  58. package/dist/vite.mjs +2 -2
  59. package/package.json +1 -1
  60. package/dist/chunk-427JQ6OZ.mjs.map +0 -1
  61. package/dist/chunk-BDHDDITP.mjs.map +0 -1
  62. /package/dist/{chunk-PGZVE6P7.mjs.map → chunk-2ISN27CV.mjs.map} +0 -0
  63. /package/dist/{chunk-J34JCW6R.mjs.map → chunk-MSQDIAQW.mjs.map} +0 -0
  64. /package/dist/{chunk-GPHLXAFT.mjs.map → chunk-OGFWHBDO.mjs.map} +0 -0
  65. /package/dist/{chunk-JECGLPIS.mjs.map → chunk-PYIVNTDI.mjs.map} +0 -0
  66. /package/dist/{chunk-GVQ54ERX.mjs.map → chunk-RAZ7L3UY.mjs.map} +0 -0
package/dist/client.d.mts CHANGED
@@ -7,8 +7,8 @@ export { UseServerQueryOptions, UseServerQueryResult, useServerQuery } from './s
7
7
  export { F as FarmIntegrationAPI, e as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIMethod, a as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, b as api, d as defineIntegrationAPI, c as defineIntegrationAPIOperation, i as endpoint } from './config-DtTPh5Ml.mjs';
8
8
  export { UseThemeResult, useTheme } from './theme/client.mjs';
9
9
  import { FarmRouterPathParams, FarmRouterPathParam, FarmRouterBuildOptions, FarmRouterRouteInput } from './router.mjs';
10
- import { i as FarmViewTransitionMode, e as FarmNavigationBlockerContext, F as FarmNavigationState } from './spa-router-BD7iUG-C.mjs';
11
- export { a as FarmNavigateOptions, d as FarmNavigationBlocker, f as FarmNavigationListener, h as FarmNavigationLocation, S as SPARouter, g as getRouter, n as navigateTo, p as prefetch, b as pushState, r as readPageState, c as replaceState } from './spa-router-BD7iUG-C.mjs';
10
+ import { i as FarmViewTransitionMode, e as FarmNavigationBlockerContext, F as FarmNavigationState } from './spa-router-BV71GGW0.mjs';
11
+ export { a as FarmNavigateOptions, d as FarmNavigationBlocker, f as FarmNavigationListener, h as FarmNavigationLocation, S as SPARouter, g as getRouter, n as navigateTo, p as prefetch, b as pushState, r as readPageState, c as replaceState } from './spa-router-BV71GGW0.mjs';
12
12
  import { b as FarmI18nLocale } from './types-mP6R6CzS.mjs';
13
13
  export { F as FarmChunkRecoveryOptions, i as installChunkErrorRecovery, a as isChunkLoadError } from './chunk-recovery-lnQFzcQP.mjs';
14
14
  export { a as FarmClientHydrationCompleteEvent, b as FarmClientHydrationEvent, d as FarmClientHydrationMode, e as FarmClientHydrationSession, f as FarmClientLocation, g as FarmClientNavigationAction, h as FarmClientNavigationErrorEvent, i as FarmClientNavigationEvent, j as FarmClientNavigationLoadedEvent, k as FarmClientNavigationResolvedEvent, l as FarmClientNavigationSession, m as FarmClientPerformanceEvent, n as FarmClientPlugin, o as FarmClientPluginCloseEvent, p as FarmClientPluginEnforce, q as FarmClientPluginErrorEvent, r as FarmClientPluginErrorPhase, F as FarmClientPluginManager, s as FarmClientPluginManagerOptions, t as FarmClientPluginMetadata, u as FarmClientPluginRegistration, v as FarmClientPluginRouter, w as FarmClientPluginSetupEvent, x as FarmClientPluginStateEvent, c as createClientPluginManager } from './lifecycle-CgO0tX2y.mjs';
package/dist/client.d.ts CHANGED
@@ -7,8 +7,8 @@ export { UseServerQueryOptions, UseServerQueryResult, useServerQuery } from './s
7
7
  export { F as FarmIntegrationAPI, e as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIMethod, a as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, b as api, d as defineIntegrationAPI, c as defineIntegrationAPIOperation, i as endpoint } from './config-kwlUiWBX.js';
8
8
  export { UseThemeResult, useTheme } from './theme/client.js';
9
9
  import { FarmRouterPathParams, FarmRouterPathParam, FarmRouterBuildOptions, FarmRouterRouteInput } from './router.js';
10
- import { i as FarmViewTransitionMode, e as FarmNavigationBlockerContext, F as FarmNavigationState } from './spa-router-swFKTqwR.js';
11
- export { a as FarmNavigateOptions, d as FarmNavigationBlocker, f as FarmNavigationListener, h as FarmNavigationLocation, S as SPARouter, g as getRouter, n as navigateTo, p as prefetch, b as pushState, r as readPageState, c as replaceState } from './spa-router-swFKTqwR.js';
10
+ import { i as FarmViewTransitionMode, e as FarmNavigationBlockerContext, F as FarmNavigationState } from './spa-router-BylM6JXm.js';
11
+ export { a as FarmNavigateOptions, d as FarmNavigationBlocker, f as FarmNavigationListener, h as FarmNavigationLocation, S as SPARouter, g as getRouter, n as navigateTo, p as prefetch, b as pushState, r as readPageState, c as replaceState } from './spa-router-BylM6JXm.js';
12
12
  import { b as FarmI18nLocale } from './types-mP6R6CzS.js';
13
13
  export { F as FarmChunkRecoveryOptions, i as installChunkErrorRecovery, a as isChunkLoadError } from './chunk-recovery-lnQFzcQP.js';
14
14
  export { a as FarmClientHydrationCompleteEvent, b as FarmClientHydrationEvent, d as FarmClientHydrationMode, e as FarmClientHydrationSession, f as FarmClientLocation, g as FarmClientNavigationAction, h as FarmClientNavigationErrorEvent, i as FarmClientNavigationEvent, j as FarmClientNavigationLoadedEvent, k as FarmClientNavigationResolvedEvent, l as FarmClientNavigationSession, m as FarmClientPerformanceEvent, n as FarmClientPlugin, o as FarmClientPluginCloseEvent, p as FarmClientPluginEnforce, q as FarmClientPluginErrorEvent, r as FarmClientPluginErrorPhase, F as FarmClientPluginManager, s as FarmClientPluginManagerOptions, t as FarmClientPluginMetadata, u as FarmClientPluginRegistration, v as FarmClientPluginRouter, w as FarmClientPluginSetupEvent, x as FarmClientPluginStateEvent, c as createClientPluginManager } from './lifecycle-CgO0tX2y.js';
package/dist/client.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createStore,
4
4
  useFetcher,
5
5
  useMutation
6
- } from "./chunk-JECGLPIS.mjs";
6
+ } from "./chunk-PYIVNTDI.mjs";
7
7
  import {
8
8
  useAction
9
9
  } from "./chunk-SALMKQXH.mjs";
@@ -16,7 +16,7 @@ import {
16
16
  usePageState,
17
17
  useRouter,
18
18
  useScrollRestoration
19
- } from "./chunk-BDHDDITP.mjs";
19
+ } from "./chunk-ZP5IWDTE.mjs";
20
20
  import {
21
21
  useTheme
22
22
  } from "./chunk-CHITERV2.mjs";
@@ -39,6 +39,12 @@ import {
39
39
  fetchServerQuery,
40
40
  prefetchServerQuery
41
41
  } from "./chunk-3E2WRUR2.mjs";
42
+ import {
43
+ getTheme,
44
+ setTheme,
45
+ toggleTheme
46
+ } from "./chunk-ZUSJ5CDC.mjs";
47
+ import "./chunk-ZBE6MLHL.mjs";
42
48
  import {
43
49
  SPARouter,
44
50
  getRouter,
@@ -47,14 +53,8 @@ import {
47
53
  pushState,
48
54
  readPageState,
49
55
  replaceState
50
- } from "./chunk-427JQ6OZ.mjs";
56
+ } from "./chunk-YBHLSG7E.mjs";
51
57
  import "./chunk-ITN462YM.mjs";
52
- import {
53
- getTheme,
54
- setTheme,
55
- toggleTheme
56
- } from "./chunk-ZUSJ5CDC.mjs";
57
- import "./chunk-ZBE6MLHL.mjs";
58
58
  import "./chunk-C4XSKA7P.mjs";
59
59
  import "./chunk-SCFX4UTD.mjs";
60
60
  import {
@@ -62,7 +62,7 @@ import {
62
62
  createClientPluginManager,
63
63
  installChunkErrorRecovery,
64
64
  isChunkLoadError
65
- } from "./chunk-J34JCW6R.mjs";
65
+ } from "./chunk-MSQDIAQW.mjs";
66
66
  import "./chunk-GQVQESLY.mjs";
67
67
  import {
68
68
  api,
@@ -80,7 +80,7 @@ import "./chunk-RBRLLZL5.mjs";
80
80
  import "./chunk-WZ5QFROO.mjs";
81
81
  import "./chunk-7ZMKVETU.mjs";
82
82
  import "./chunk-FXG2PS27.mjs";
83
- import "./chunk-ENPB4CSY.mjs";
83
+ import "./chunk-BLTATPSB.mjs";
84
84
  import "./chunk-CGILA3WO.mjs";
85
85
  export {
86
86
  APIClientError,
package/dist/index.cjs CHANGED
@@ -15255,7 +15255,7 @@ var init_server3 = __esm({
15255
15255
  var version;
15256
15256
  var init_package = __esm({
15257
15257
  "package.json"() {
15258
- version = "0.1.0-beta.54";
15258
+ version = "0.1.0-beta.55";
15259
15259
  }
15260
15260
  });
15261
15261
 
@@ -47933,6 +47933,16 @@ var _SPARouter = class _SPARouter {
47933
47933
  this.navigationListeners = /* @__PURE__ */ new Set();
47934
47934
  this.navigationState = IDLE_NAVIGATION_STATE;
47935
47935
  this.scrollElements = /* @__PURE__ */ new Map();
47936
+ this.onPopState = /* @__PURE__ */ __name((event) => {
47937
+ void this.handlePopState(event);
47938
+ }, "onPopState");
47939
+ this.onBeforeUnload = /* @__PURE__ */ __name((event) => {
47940
+ if (this.blockers.size > 0) {
47941
+ event.preventDefault();
47942
+ event.returnValue = "";
47943
+ }
47944
+ this.saveScrollPosition(window.location.pathname);
47945
+ }, "onBeforeUnload");
47936
47946
  this.options = {
47937
47947
  prefetchTimeout: options.prefetchTimeout ?? 100,
47938
47948
  cacheMaxAge: options.cacheMaxAge ?? 3e4,
@@ -47942,16 +47952,16 @@ var _SPARouter = class _SPARouter {
47942
47952
  deploymentId: options.deploymentId ?? readBrowserDeploymentId()
47943
47953
  };
47944
47954
  if (typeof window !== "undefined") {
47945
- window.addEventListener("popstate", this.handlePopState.bind(this));
47946
- window.addEventListener("beforeunload", (event) => {
47947
- if (this.blockers.size > 0) {
47948
- event.preventDefault();
47949
- event.returnValue = "";
47950
- }
47951
- this.saveScrollPosition(window.location.pathname);
47952
- });
47955
+ window.addEventListener("popstate", this.onPopState);
47956
+ window.addEventListener("beforeunload", this.onBeforeUnload);
47953
47957
  }
47954
47958
  }
47959
+ /** Remove global listeners. Intended for tests and teardown. */
47960
+ destroy() {
47961
+ if (typeof window === "undefined") return;
47962
+ window.removeEventListener("popstate", this.onPopState);
47963
+ window.removeEventListener("beforeunload", this.onBeforeUnload);
47964
+ }
47955
47965
  /**
47956
47966
  * Set the navigation handler that updates React
47957
47967
  */
@@ -48414,11 +48424,16 @@ function dispatchDeploymentMismatch(error) {
48414
48424
  window.dispatchEvent(new CustomEvent("farm:deployment-mismatch", { detail: error }));
48415
48425
  }
48416
48426
  __name(dispatchDeploymentMismatch, "dispatchDeploymentMismatch");
48427
+ function getInstalledFarmSPARouter() {
48428
+ if (typeof window === "undefined") return void 0;
48429
+ return window.__FARM_SPA_ROUTER__;
48430
+ }
48431
+ __name(getInstalledFarmSPARouter, "getInstalledFarmSPARouter");
48417
48432
  function getRouter2() {
48418
48433
  if (typeof window === "undefined") {
48419
48434
  return new SPARouter();
48420
48435
  }
48421
- const installedRouter = window.__FARM_SPA_ROUTER__;
48436
+ const installedRouter = getInstalledFarmSPARouter();
48422
48437
  if (installedRouter) {
48423
48438
  routerInstance = installedRouter;
48424
48439
  return installedRouter;
@@ -48486,6 +48501,20 @@ function getScrollElementStorageKey(path38, key) {
48486
48501
  }
48487
48502
  __name(getScrollElementStorageKey, "getScrollElementStorageKey");
48488
48503
 
48504
+ // src/client/url-search-sync.ts
48505
+ var FARM_URL_SEARCH_CHANGE_EVENT = "farm:urlsearchchange";
48506
+ function subscribeUrlSearchObservers(listener) {
48507
+ if (typeof window === "undefined") return () => {
48508
+ };
48509
+ window.addEventListener("popstate", listener);
48510
+ window.addEventListener(FARM_URL_SEARCH_CHANGE_EVENT, listener);
48511
+ return () => {
48512
+ window.removeEventListener("popstate", listener);
48513
+ window.removeEventListener(FARM_URL_SEARCH_CHANGE_EVENT, listener);
48514
+ };
48515
+ }
48516
+ __name(subscribeUrlSearchObservers, "subscribeUrlSearchObservers");
48517
+
48489
48518
  // src/client/router.ts
48490
48519
  init_routing();
48491
48520
  function useRouter(options = {}) {
@@ -48505,8 +48534,8 @@ function useRouter(options = {}) {
48505
48534
  setState(readRouterState(basePath, routeMatcher));
48506
48535
  }, "handlePopState");
48507
48536
  handlePopState();
48508
- window.addEventListener("popstate", handlePopState);
48509
- return () => window.removeEventListener("popstate", handlePopState);
48537
+ const unsubscribe = subscribeUrlSearchObservers(handlePopState);
48538
+ return unsubscribe;
48510
48539
  }, [basePath, routeMatcher]);
48511
48540
  const push = /* @__PURE__ */ __name((href) => {
48512
48541
  if (typeof window === "undefined") return;