akanjs 3.0.0 → 3.0.1
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/CHANGELOG.md +3659 -0
- package/client/csrTypes.ts +2 -2
- package/common/index.ts +0 -1
- package/common/routeConvention.ts +1 -9
- package/package.json +1 -1
- package/server/cachePolicy.ts +12 -2
- package/server/crawler.ts +6 -0
- package/server/head.tsx +0 -4
- package/server/robots.ts +1 -23
- package/server/routeTreeBuilder.ts +4 -2
- package/server/rscWorker.tsx +12 -24
- package/server/ssrFromRscRenderer.tsx +19 -15
- package/server/ssrTypes.ts +9 -0
- package/server/webRouter.ts +6 -2
- package/types/client/csrTypes.d.ts +2 -2
- package/types/common/index.d.ts +1 -1
- package/types/common/routeConvention.d.ts +0 -2
- package/types/server/cachePolicy.d.ts +2 -1
- package/types/server/crawler.d.ts +1 -0
- package/types/server/head.d.ts +0 -3
- package/types/server/ssrFromRscRenderer.d.ts +3 -1
- package/types/server/ssrTypes.d.ts +8 -0
- package/types/ui/recipe/badgeRecipe.d.ts +2 -2
- package/types/ui/recipe/buttonRecipe.d.ts +2 -2
- package/types/webkit/useFrameRuntime.d.ts +0 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/addons.ts +2 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/exec.ts +11 -1
- package/vendor/use-agentic/CHANGELOG.md +663 -0
- package/webkit/CsrRouteTable.ts +0 -2
- package/webkit/useCsrValues.ts +21 -11
package/webkit/CsrRouteTable.ts
CHANGED
|
@@ -177,7 +177,6 @@ export class CsrRouteTable {
|
|
|
177
177
|
: {
|
|
178
178
|
renderPage: routeRender,
|
|
179
179
|
pageIncludesOwnLayout: parsed.leaf === "_index",
|
|
180
|
-
isSpecialRoute: parsed.isSpecialRoute,
|
|
181
180
|
pageConfig: (page as RouteModuleWithConfig).pageConfig,
|
|
182
181
|
PageConfig: (page as RouteModuleWithConfig).pageConfig,
|
|
183
182
|
}),
|
|
@@ -214,7 +213,6 @@ export class CsrRouteTable {
|
|
|
214
213
|
renderPage: route.renderPage,
|
|
215
214
|
renderRootLayouts: layer.pageRenderRootLayouts,
|
|
216
215
|
renderLayouts: layer.pageRenderLayouts,
|
|
217
|
-
isSpecialRoute: route.isSpecialRoute,
|
|
218
216
|
pageState: route.pageState ?? pageState,
|
|
219
217
|
pageConfigChain: finalPageConfigChain,
|
|
220
218
|
explicitPageConfigKeys: getExplicitPageConfigKeys(finalPageConfigChain),
|
package/webkit/useCsrValues.ts
CHANGED
|
@@ -599,6 +599,7 @@ export const useCsrValues = (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]
|
|
|
599
599
|
const onBack = useRef<{ [K in TransitionType]?: () => Promise<void> }>({});
|
|
600
600
|
const frameRootRef = useRef<HTMLDivElement>(null);
|
|
601
601
|
const lastBroadcastSyncHref = useRef<string | null>(null);
|
|
602
|
+
const syncNavigationReset = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
602
603
|
|
|
603
604
|
const { getLocation } = useLocation({ rootRouteGuide });
|
|
604
605
|
const [initialStack] = useState(() => {
|
|
@@ -848,7 +849,8 @@ export const useCsrValues = (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]
|
|
|
848
849
|
});
|
|
849
850
|
const applyingSyncNavigation = useRef(false);
|
|
850
851
|
const broadcastSyncNavigation = useCallback((kind: "push" | "replace" | "back" | "pop", href: string) => {
|
|
851
|
-
if (applyingSyncNavigation.current) return;
|
|
852
|
+
if (applyingSyncNavigation.current || lastBroadcastSyncHref.current === href) return;
|
|
853
|
+
lastBroadcastSyncHref.current = href;
|
|
852
854
|
const syncNavigation = (
|
|
853
855
|
globalThis as typeof globalThis & {
|
|
854
856
|
__AKAN_DEV_SYNC_NAVIGATION__?: (href: string, kind: "push" | "replace" | "back" | "pop") => void;
|
|
@@ -1063,12 +1065,13 @@ export const useCsrValues = (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]
|
|
|
1063
1065
|
if (!targetLocation) return;
|
|
1064
1066
|
const location = getCurrentLocation();
|
|
1065
1067
|
debugFrame("router.back", { from: location.href, to: targetLocation.href, scrollToTop });
|
|
1068
|
+
|
|
1069
|
+
broadcastSyncNavigation("back", getSyncRouteHref(targetLocation));
|
|
1066
1070
|
if (shouldPrepareFrameTransition()) await startFrameTransition();
|
|
1067
1071
|
await onBack.current[location.pathRoute.pageState.transition]?.();
|
|
1068
1072
|
const scrollTop = pageContentRef.current?.scrollTop ?? 0;
|
|
1069
1073
|
setHistoryBack({ type: "back", location, scrollTop, scrollToTop });
|
|
1070
1074
|
settle(getPrevLocation());
|
|
1071
|
-
broadcastSyncNavigation("back", getSyncRouteHref(targetLocation));
|
|
1072
1075
|
window.history.back();
|
|
1073
1076
|
},
|
|
1074
1077
|
};
|
|
@@ -1102,19 +1105,18 @@ export const useCsrValues = (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]
|
|
|
1102
1105
|
broadcastSyncNavigation("pop", getSyncRouteHref(getLocation(href)));
|
|
1103
1106
|
return;
|
|
1104
1107
|
}
|
|
1108
|
+
broadcastSyncNavigation(routeType === "back" ? "back" : "pop", getSyncRouteHref(getLocation(href)));
|
|
1105
1109
|
if (routeType === "forward") {
|
|
1106
1110
|
if (shouldPrepareFrameTransition(href)) await startFrameTransition();
|
|
1107
1111
|
const location = getCurrentLocation();
|
|
1108
1112
|
setHistoryForward({ type: "popForward", location, scrollTop });
|
|
1109
1113
|
settle(location);
|
|
1110
|
-
broadcastSyncNavigation("pop", getSyncRouteHref(getLocation(href)));
|
|
1111
1114
|
} else {
|
|
1112
1115
|
const location = getCurrentLocation();
|
|
1113
1116
|
if (shouldPrepareFrameTransition(href)) await startFrameTransition();
|
|
1114
1117
|
if (!isUaAnimated) await onBack.current[location.pathRoute.pageState.transition]?.();
|
|
1115
1118
|
setHistoryBack({ type: "popBack", location, scrollTop });
|
|
1116
1119
|
settle(getPrevLocation());
|
|
1117
|
-
broadcastSyncNavigation("pop", getSyncRouteHref(getLocation(href)));
|
|
1118
1120
|
}
|
|
1119
1121
|
};
|
|
1120
1122
|
return router;
|
|
@@ -1122,13 +1124,14 @@ export const useCsrValues = (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]
|
|
|
1122
1124
|
const router = getRouter();
|
|
1123
1125
|
useEffect(() => {
|
|
1124
1126
|
const syncHref = getSyncRouteHref(resolvedLocation);
|
|
1125
|
-
if (
|
|
1127
|
+
if (
|
|
1128
|
+
lastBroadcastSyncHref.current === null ||
|
|
1129
|
+
applyingSyncNavigation.current ||
|
|
1130
|
+
globalThis.__AKAN_DEV_SYNC_NAVIGATION_APPLYING__
|
|
1131
|
+
) {
|
|
1126
1132
|
lastBroadcastSyncHref.current = syncHref;
|
|
1127
1133
|
return;
|
|
1128
1134
|
}
|
|
1129
|
-
if (lastBroadcastSyncHref.current === syncHref) return;
|
|
1130
|
-
lastBroadcastSyncHref.current = syncHref;
|
|
1131
|
-
if (applyingSyncNavigation.current || globalThis.__AKAN_DEV_SYNC_NAVIGATION_APPLYING__) return;
|
|
1132
1135
|
broadcastSyncNavigation(
|
|
1133
1136
|
history.current.type === "back" ? "back" : history.current.type === "forward" ? "push" : "pop",
|
|
1134
1137
|
syncHref,
|
|
@@ -1141,8 +1144,10 @@ export const useCsrValues = (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]
|
|
|
1141
1144
|
history,
|
|
1142
1145
|
]);
|
|
1143
1146
|
useEffect(() => {
|
|
1147
|
+
|
|
1144
1148
|
const resetSyncNavigation = () => {
|
|
1145
|
-
|
|
1149
|
+
if (syncNavigationReset.current) clearTimeout(syncNavigationReset.current);
|
|
1150
|
+
syncNavigationReset.current = setTimeout(() => {
|
|
1146
1151
|
applyingSyncNavigation.current = false;
|
|
1147
1152
|
globalThis.__AKAN_DEV_SYNC_NAVIGATION_APPLYING__ = false;
|
|
1148
1153
|
}, 1000);
|
|
@@ -1153,10 +1158,15 @@ export const useCsrValues = (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]
|
|
|
1153
1158
|
if (!href) return;
|
|
1154
1159
|
const target = new URL(href, window.location.origin);
|
|
1155
1160
|
const targetHref = `${target.pathname}${target.search}${target.hash}`;
|
|
1156
|
-
|
|
1161
|
+
|
|
1162
|
+
if (targetHref === getSyncRouteHref(getCurrentLocation()) || targetHref === lastBroadcastSyncHref.current) return;
|
|
1157
1163
|
applyingSyncNavigation.current = true;
|
|
1158
1164
|
globalThis.__AKAN_DEV_SYNC_NAVIGATION_APPLYING__ = true;
|
|
1159
|
-
|
|
1165
|
+
const previous = getPrevLocation();
|
|
1166
|
+
|
|
1167
|
+
if (kind !== "push" && kind !== "replace" && previous && getSyncRouteHref(previous) === targetHref)
|
|
1168
|
+
clientRouter.back({ scrollToTop: false });
|
|
1169
|
+
else if (kind === "replace" || kind === "back" || kind === "pop")
|
|
1160
1170
|
clientRouter.replace(targetHref, { scrollToTop: false });
|
|
1161
1171
|
else clientRouter.push(targetHref, { scrollToTop: false });
|
|
1162
1172
|
resetSyncNavigation();
|