@farm.js/core 0.1.0-beta.55 → 0.1.0-beta.56
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.
- package/dist/{chunk-YBHLSG7E.mjs → chunk-5T2XATMK.mjs} +22 -18
- package/dist/chunk-5T2XATMK.mjs.map +1 -0
- package/dist/{chunk-MSQDIAQW.mjs → chunk-FOEPWRHM.mjs} +2 -2
- package/dist/{chunk-ZP5IWDTE.mjs → chunk-FPLRESQA.mjs} +25 -14
- package/dist/chunk-FPLRESQA.mjs.map +1 -0
- package/dist/{chunk-OGFWHBDO.mjs → chunk-UH5R4J5M.mjs} +2 -2
- package/dist/{chunk-BLTATPSB.mjs → chunk-XLQVJDK2.mjs} +2 -2
- package/dist/{chunk-BLTATPSB.mjs.map → chunk-XLQVJDK2.mjs.map} +1 -1
- package/dist/{chunk-RAZ7L3UY.mjs → chunk-YPKCFGA7.mjs} +9 -3
- package/dist/chunk-YPKCFGA7.mjs.map +1 -0
- package/dist/{chunk-2ISN27CV.mjs → chunk-ZOQLQAUG.mjs} +2 -2
- package/dist/client/lifecycle.mjs +2 -2
- package/dist/client-plugins.cjs +1 -1
- package/dist/client-plugins.cjs.map +1 -1
- package/dist/client-plugins.mjs +2 -2
- package/dist/client.cjs +51 -27
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.mts +0 -3
- package/dist/client.d.ts +0 -3
- package/dist/client.mjs +4 -4
- package/dist/index.cjs +60 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/internal/build-runtime.cjs +8 -2
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.mjs +3 -3
- package/dist/internal/client-runtime.cjs +1 -1
- package/dist/internal/client-runtime.cjs.map +1 -1
- package/dist/internal/client-runtime.mjs +2 -2
- package/dist/navigation.cjs +49 -24
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.mjs +3 -3
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs +2 -2
- package/dist/query/client.cjs +28 -13
- package/dist/query/client.cjs.map +1 -1
- package/dist/query/client.mjs +8 -7
- package/dist/query/client.mjs.map +1 -1
- package/dist/renderer-client.cjs +32 -8
- package/dist/renderer-client.cjs.map +1 -1
- package/dist/renderer-client.mjs +5 -7
- package/dist/renderer-client.mjs.map +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.mjs +2 -2
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-RAZ7L3UY.mjs.map +0 -1
- package/dist/chunk-YBHLSG7E.mjs.map +0 -1
- package/dist/chunk-ZP5IWDTE.mjs.map +0 -1
- /package/dist/{chunk-MSQDIAQW.mjs.map → chunk-FOEPWRHM.mjs.map} +0 -0
- /package/dist/{chunk-OGFWHBDO.mjs.map → chunk-UH5R4J5M.mjs.map} +0 -0
- /package/dist/{chunk-2ISN27CV.mjs.map → chunk-ZOQLQAUG.mjs.map} +0 -0
package/dist/client-plugins.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FarmClientPluginManager,
|
|
3
3
|
createClientPluginManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FOEPWRHM.mjs";
|
|
5
5
|
import "./chunk-FXG2PS27.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-XLQVJDK2.mjs";
|
|
7
7
|
import "./chunk-CGILA3WO.mjs";
|
|
8
8
|
export {
|
|
9
9
|
FarmClientPluginManager,
|
package/dist/client.cjs
CHANGED
|
@@ -4664,6 +4664,35 @@ function rejectPendingDeferred(controllers, message) {
|
|
|
4664
4664
|
}
|
|
4665
4665
|
__name(rejectPendingDeferred, "rejectPendingDeferred");
|
|
4666
4666
|
|
|
4667
|
+
// src/client/history-sync.ts
|
|
4668
|
+
var FARM_HISTORY_CHANGE_EVENT = "farm:historychange";
|
|
4669
|
+
function notifyHistoryChange(kind) {
|
|
4670
|
+
if (typeof window === "undefined") return;
|
|
4671
|
+
setTimeout(() => {
|
|
4672
|
+
if (kind === "url-search" && !getInstalledFarmSPARouter()) {
|
|
4673
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
4674
|
+
return;
|
|
4675
|
+
}
|
|
4676
|
+
window.dispatchEvent(
|
|
4677
|
+
new CustomEvent(FARM_HISTORY_CHANGE_EVENT, {
|
|
4678
|
+
detail: { kind }
|
|
4679
|
+
})
|
|
4680
|
+
);
|
|
4681
|
+
}, 0);
|
|
4682
|
+
}
|
|
4683
|
+
__name(notifyHistoryChange, "notifyHistoryChange");
|
|
4684
|
+
function subscribeHistoryChange(listener) {
|
|
4685
|
+
if (typeof window === "undefined") return () => {
|
|
4686
|
+
};
|
|
4687
|
+
window.addEventListener("popstate", listener);
|
|
4688
|
+
window.addEventListener(FARM_HISTORY_CHANGE_EVENT, listener);
|
|
4689
|
+
return () => {
|
|
4690
|
+
window.removeEventListener("popstate", listener);
|
|
4691
|
+
window.removeEventListener(FARM_HISTORY_CHANGE_EVENT, listener);
|
|
4692
|
+
};
|
|
4693
|
+
}
|
|
4694
|
+
__name(subscribeHistoryChange, "subscribeHistoryChange");
|
|
4695
|
+
|
|
4667
4696
|
// src/deployment.ts
|
|
4668
4697
|
var FARM_DEPLOYMENT_ID_HEADER = "x-farm-deployment-id";
|
|
4669
4698
|
var FARM_DEPLOYMENT_MISMATCH_HEADER = "x-farm-deployment-mismatch";
|
|
@@ -5160,7 +5189,7 @@ var _SPARouter = class _SPARouter {
|
|
|
5160
5189
|
} else {
|
|
5161
5190
|
window.history.pushState(nextState, "", url);
|
|
5162
5191
|
}
|
|
5163
|
-
|
|
5192
|
+
notifyHistoryChange("page-state");
|
|
5164
5193
|
}
|
|
5165
5194
|
/**
|
|
5166
5195
|
* Save scroll position for a path
|
|
@@ -5306,21 +5335,23 @@ function getScrollElementStorageKey(path, key) {
|
|
|
5306
5335
|
}
|
|
5307
5336
|
__name(getScrollElementStorageKey, "getScrollElementStorageKey");
|
|
5308
5337
|
|
|
5309
|
-
// src/client/url-search-sync.ts
|
|
5310
|
-
var FARM_URL_SEARCH_CHANGE_EVENT = "farm:urlsearchchange";
|
|
5311
|
-
function subscribeUrlSearchObservers(listener) {
|
|
5312
|
-
if (typeof window === "undefined") return () => {
|
|
5313
|
-
};
|
|
5314
|
-
window.addEventListener("popstate", listener);
|
|
5315
|
-
window.addEventListener(FARM_URL_SEARCH_CHANGE_EVENT, listener);
|
|
5316
|
-
return () => {
|
|
5317
|
-
window.removeEventListener("popstate", listener);
|
|
5318
|
-
window.removeEventListener(FARM_URL_SEARCH_CHANGE_EVENT, listener);
|
|
5319
|
-
};
|
|
5320
|
-
}
|
|
5321
|
-
__name(subscribeUrlSearchObservers, "subscribeUrlSearchObservers");
|
|
5322
|
-
|
|
5323
5338
|
// src/client/router.ts
|
|
5339
|
+
function navigateViaRouter(href, basePath, replace) {
|
|
5340
|
+
if (typeof window === "undefined") return;
|
|
5341
|
+
const url = href.startsWith("/") ? basePath + href : href;
|
|
5342
|
+
const spaRouter = getInstalledFarmSPARouter();
|
|
5343
|
+
if (spaRouter) {
|
|
5344
|
+
void spaRouter.navigate(url, { replace });
|
|
5345
|
+
return;
|
|
5346
|
+
}
|
|
5347
|
+
if (replace) {
|
|
5348
|
+
window.history.replaceState(null, "", url);
|
|
5349
|
+
} else {
|
|
5350
|
+
window.history.pushState(null, "", url);
|
|
5351
|
+
}
|
|
5352
|
+
notifyHistoryChange("url-search");
|
|
5353
|
+
}
|
|
5354
|
+
__name(navigateViaRouter, "navigateViaRouter");
|
|
5324
5355
|
function useRouter(options = {}) {
|
|
5325
5356
|
const basePath = options.basePath || "";
|
|
5326
5357
|
const routes = options.routes;
|
|
@@ -5338,20 +5369,14 @@ function useRouter(options = {}) {
|
|
|
5338
5369
|
setState(readRouterState(basePath, routeMatcher));
|
|
5339
5370
|
}, "handlePopState");
|
|
5340
5371
|
handlePopState();
|
|
5341
|
-
const unsubscribe =
|
|
5372
|
+
const unsubscribe = subscribeHistoryChange(handlePopState);
|
|
5342
5373
|
return unsubscribe;
|
|
5343
5374
|
}, [basePath, routeMatcher]);
|
|
5344
5375
|
const push = /* @__PURE__ */ __name((href) => {
|
|
5345
|
-
|
|
5346
|
-
const url = href.startsWith("/") ? basePath + href : href;
|
|
5347
|
-
window.history.pushState(null, "", url);
|
|
5348
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
5376
|
+
navigateViaRouter(href, basePath, false);
|
|
5349
5377
|
}, "push");
|
|
5350
5378
|
const replace = /* @__PURE__ */ __name((href) => {
|
|
5351
|
-
|
|
5352
|
-
const url = href.startsWith("/") ? basePath + href : href;
|
|
5353
|
-
window.history.replaceState(null, "", url);
|
|
5354
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
5379
|
+
navigateViaRouter(href, basePath, true);
|
|
5355
5380
|
}, "replace");
|
|
5356
5381
|
const pushState2 = /* @__PURE__ */ __name((pageState, href) => {
|
|
5357
5382
|
if (typeof window === "undefined") return;
|
|
@@ -5390,8 +5415,7 @@ function usePageState() {
|
|
|
5390
5415
|
setState(readPageState());
|
|
5391
5416
|
}, "handlePopState");
|
|
5392
5417
|
handlePopState();
|
|
5393
|
-
|
|
5394
|
-
return () => window.removeEventListener("popstate", handlePopState);
|
|
5418
|
+
return subscribeHistoryChange(handlePopState);
|
|
5395
5419
|
}, []);
|
|
5396
5420
|
return state;
|
|
5397
5421
|
}
|
|
@@ -6078,7 +6102,7 @@ body {
|
|
|
6078
6102
|
`;
|
|
6079
6103
|
|
|
6080
6104
|
// package.json
|
|
6081
|
-
var version = "0.1.0-beta.
|
|
6105
|
+
var version = "0.1.0-beta.56";
|
|
6082
6106
|
|
|
6083
6107
|
// src/version.ts
|
|
6084
6108
|
var FARM_VERSION = version;
|