akanjs 3.3.0-rc.2 → 3.3.0-rc.21
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/ARCHITECTURE.md +3 -2
- package/CHANGELOG.md +391 -23
- package/CONTRIBUTING.md +2 -2
- package/README.ko.md +40 -296
- package/README.md +41 -297
- package/client/appOpenedTab.ts +12 -0
- package/client/clientRuntime.ts +3 -10
- package/client/cn.ts +4 -4
- package/client/cookie.ts +15 -6
- package/client/csrTypes.ts +17 -0
- package/client/device.ts +43 -3
- package/client/frameConfig.ts +27 -6
- package/client/index.ts +12 -6
- package/client/keyboardRide.ts +124 -0
- package/client/router.ts +6 -3
- package/client/rscNavigation.ts +0 -7
- package/client/scriptPolicy.ts +14 -0
- package/common/CodeTranscript.ts +4 -2
- package/common/Logger.ts +4 -1
- package/common/TraceContext.ts +97 -0
- package/common/TrustedProxy.ts +10 -0
- package/common/codeAgentProfile.ts +1 -1
- package/common/codeAgentWire.ts +7 -2
- package/common/index.ts +1 -0
- package/common/inlineToken.ts +26 -0
- package/common/logContext.ts +1 -0
- package/common/sessionTokenContract.ts +7 -0
- package/constant/index.ts +0 -1
- package/constant/types.ts +0 -2
- package/document/documentSchema.ts +0 -3
- package/document/filterMeta.ts +3 -16
- package/fetch/client/fetchClient.ts +8 -17
- package/fetch/client/httpClient.ts +22 -12
- package/fetch/client/wsClient.ts +10 -6
- package/fetch/requestStorage.ts +30 -0
- package/index.ts +8 -0
- package/package.json +263 -57
- package/server/SSR_MEMORY_DIAGNOSIS.md +88 -1
- package/server/admissionQueue.ts +107 -0
- package/server/akanApp.ts +39 -14
- package/server/akanAppHeaders.ts +20 -6
- package/server/akanOption.ts +28 -0
- package/server/akanServer.ts +13 -1
- package/server/assetHeaders.ts +8 -3
- package/server/cachePolicy.ts +2 -1
- package/server/clientErrorReport.ts +191 -0
- package/server/clientReportId.ts +54 -0
- package/server/console.ts +5 -12
- package/server/devtools/README.md +15 -3
- package/server/devtools/devtoolsAccess.ts +119 -0
- package/server/devtools/devtoolsRouter.ts +30 -26
- package/server/devtools/devtoolsUnlockPage.ts +38 -0
- package/server/devtools/signalSerializer.ts +18 -1
- package/server/devtools/studio/studioDocument.tsx +3 -1
- package/server/devtools/studio/studioRoute.ts +4 -1
- package/server/devtools/types.ts +6 -0
- package/server/flightSanitizeRecorded.fixture.json +36 -34
- package/server/forwardedError.ts +43 -0
- package/server/gateway/gatewayChildren.ts +3 -0
- package/server/gateway/gatewayConfig.ts +5 -0
- package/server/gateway/gatewayHttpProxy.ts +10 -2
- package/server/gateway/gatewayStatus.ts +21 -1
- package/server/gateway/gatewayStatusPage.ts +18 -11
- package/server/headSplice.ts +73 -0
- package/server/hmr/clientReport.ts +9 -9
- package/server/hmr/csrDevShell.ts +7 -4
- package/server/htmlResultCache.ts +81 -14
- package/server/imageOptimizer.ts +44 -12
- package/server/index.ts +2 -4
- package/server/lifecycle/secretEnv.ts +98 -0
- package/server/lifecycle/shutdownManager.ts +6 -0
- package/server/logging/logForwarder.ts +2 -2
- package/server/logging/logQuery.ts +9 -1
- package/server/mcp/McpDispatcher.ts +13 -10
- package/server/metrics/metricAggregate.ts +27 -0
- package/server/metrics/metricExposition.ts +92 -0
- package/server/metrics/metricMerge.ts +81 -0
- package/server/metrics/metricRegistry.ts +271 -0
- package/server/metrics/pubsubGauges.ts +20 -0
- package/server/metrics/requestMetrics.ts +110 -0
- package/server/metrics/runtimeFamilies.ts +61 -0
- package/server/metrics/slowStatementLog.ts +63 -0
- package/server/metrics/statementMetrics.ts +259 -0
- package/server/metrics/statementPlanCheck.ts +141 -0
- package/server/metrics/statementReport.ts +105 -0
- package/server/migration/migrationRunner.ts +13 -10
- package/server/oauth/OAuthErrors.ts +5 -1
- package/server/ops/statusAccess.ts +23 -3
- package/server/otlp/otlpBatcher.ts +221 -0
- package/server/otlp/otlpConfig.ts +185 -0
- package/server/otlp/otlpEncode.ts +114 -0
- package/server/otlp/otlpExporter.ts +98 -0
- package/server/otlp/otlpSampler.ts +50 -0
- package/server/pageFailure.ts +33 -0
- package/server/processMetricsCollector.ts +1 -0
- package/server/renderBusyResponse.ts +97 -0
- package/server/reportText.ts +27 -0
- package/server/resolver/databaseModelInstance.ts +21 -19
- package/server/resolver/httpEndpointHandler.ts +43 -0
- package/server/resolver/jobTrace.ts +18 -0
- package/server/resolver/modelFacade.ts +24 -18
- package/server/resolver/modelLoaders.ts +10 -3
- package/server/resolver/signal.resolver.ts +28 -31
- package/server/resolver/timedQuery.ts +8 -4
- package/server/routeCacheQuery.ts +58 -0
- package/server/routeCacheTally.ts +65 -0
- package/server/routeElementComposer.tsx +16 -0
- package/server/routeTreeBuilder.ts +6 -0
- package/server/routing/apiRouter.ts +34 -11
- package/server/routing/appWsData.ts +4 -0
- package/server/routing/builtinRoutes.ts +4 -1
- package/server/routing/devRoutes.ts +50 -0
- package/server/routing/devSurfacePolicy.ts +40 -0
- package/server/routing/devSurfaces.ts +101 -0
- package/server/routing/hostAllowlist.ts +2 -0
- package/server/routing/roomReplay.ts +4 -0
- package/server/routing/serverListener.ts +13 -0
- package/server/routing/soloAppRoutes.ts +14 -1
- package/server/rscClient.tsx +6 -1
- package/server/rscClientChunks.ts +8 -1
- package/server/rscClientErrorSender.ts +77 -0
- package/server/rscClientErrors.ts +26 -0
- package/server/rscFirstRenderMemory.ts +49 -0
- package/server/rscFlightRenderer.ts +21 -4
- package/server/rscFlightStream.ts +2 -2
- package/server/rscHostRenderStream.ts +5 -3
- package/server/rscHostRequests.ts +17 -3
- package/server/rscRenderAdmission.ts +130 -0
- package/server/rscRenderControl.ts +2 -1
- package/server/rscRenderHandler.ts +112 -31
- package/server/rscRenderLevels.ts +40 -0
- package/server/rscRenderRefusal.ts +23 -0
- package/server/rscRenderStats.ts +3 -0
- package/server/rscResultCaches.ts +20 -2
- package/server/rscWorker.tsx +25 -5
- package/server/rscWorkerCache.ts +2 -0
- package/server/rscWorkerHost.ts +35 -4
- package/server/rscWorkerProcess.ts +12 -0
- package/server/rscWorkerRecycler.ts +3 -3
- package/server/scriptPolicy.ts +128 -0
- package/server/serverConfig.ts +11 -0
- package/server/serverMetrics.ts +34 -1
- package/server/sitemap.ts +0 -5
- package/server/ssrFromRscRenderer.tsx +32 -204
- package/server/ssrInlineScripts.ts +195 -0
- package/server/ssrTypes.ts +15 -2
- package/server/systemPageDocument.tsx +6 -2
- package/server/systemPages.tsx +9 -4
- package/server/webCsrSurface.ts +55 -21
- package/server/webDocumentRoute.ts +47 -21
- package/server/webRouteContext.ts +25 -8
- package/server/webRouter.ts +15 -12
- package/server/webRscRoute.ts +18 -14
- package/service/agent.service.ts +34 -8
- package/service/agentLoop/agentLoop.ts +35 -24
- package/service/agentLoop/agentLoopTypes.ts +16 -7
- package/service/agentLoop/loopCompaction.ts +1 -1
- package/service/agentLoop/loopContext.ts +33 -0
- package/service/agentLoop/loopToolkits.ts +17 -8
- package/service/index.ts +0 -1
- package/service/ipcTypes.ts +56 -0
- package/service/mentionToken.ts +44 -0
- package/service/predefinedAdaptor/anthropicLlm.ts +18 -17
- package/service/predefinedAdaptor/database.adaptor.ts +43 -9
- package/service/predefinedAdaptor/directoryNotWritableError.ts +30 -0
- package/service/predefinedAdaptor/index.ts +1 -0
- package/service/predefinedAdaptor/llm.adaptor.ts +9 -3
- package/service/predefinedAdaptor/llmContext.ts +26 -0
- package/service/predefinedAdaptor/llmFence.ts +55 -0
- package/service/predefinedAdaptor/openaiDialect.ts +45 -18
- package/service/predefinedAdaptor/solidSqlite.ts +2 -0
- package/service/predefinedAdaptor/sql/driver/bunSqlite.ts +49 -11
- package/service/predefinedAdaptor/sql/driver/postgres.ts +47 -10
- package/service/predefinedAdaptor/sql/statementFingerprint.ts +117 -0
- package/service/predefinedAdaptor/sql/statementPlans.ts +71 -0
- package/service/predefinedAdaptor/sql/statementProbe.ts +110 -0
- package/service/predefinedAdaptor/sql/statementScrub.ts +149 -0
- package/service/predefinedAdaptor/storage.adaptor.ts +5 -0
- package/service/predefinedAdaptor/websocket.adaptor.ts +6 -0
- package/signal/CrossSiteGuard.ts +5 -0
- package/signal/SignalFailure.ts +24 -2
- package/signal/browserError.ts +24 -0
- package/signal/errorReporting.ts +168 -0
- package/signal/httpPeer.ts +9 -0
- package/signal/index.ts +2 -3
- package/signal/openapi/openapi.ts +4 -0
- package/signal/requestTrace.ts +124 -0
- package/signal/signalContext.ts +15 -22
- package/signal/spanExport.ts +137 -0
- package/signal/trace.ts +168 -37
- package/store/agent/AgentBridge.ts +6 -2
- package/store/agent/AgentContext.ts +81 -14
- package/store/agent/AgentInline.ts +72 -0
- package/store/agent/StoreSurfaceSource.ts +2 -1
- package/store/baseSt.ts +0 -6
- package/store/index.ts +1 -3
- package/store/stateBuilder.ts +1 -6
- package/types/client/appOpenedTab.d.ts +1 -0
- package/types/client/clientRuntime.d.ts +4 -2
- package/types/client/cn.d.ts +0 -4
- package/types/client/cookie.d.ts +4 -3
- package/types/client/csrTypes.d.ts +20 -0
- package/types/client/device.d.ts +8 -0
- package/types/client/frameConfig.d.ts +1 -3
- package/types/client/index.d.ts +7 -7
- package/types/client/keyboardRide.d.ts +16 -0
- package/types/client/rscNavigation.d.ts +0 -10
- package/types/client/scriptPolicy.d.ts +4 -0
- package/types/common/CodeTranscript.d.ts +1 -0
- package/types/common/Logger.d.ts +2 -0
- package/types/common/TraceContext.d.ts +28 -0
- package/types/common/TrustedProxy.d.ts +1 -0
- package/types/common/codeAgentWire.d.ts +10 -2
- package/types/common/index.d.ts +1 -0
- package/types/common/inlineToken.d.ts +5 -0
- package/types/common/logContext.d.ts +1 -0
- package/types/common/sessionTokenContract.d.ts +6 -0
- package/types/constant/index.d.ts +1 -1
- package/types/constant/types.d.ts +0 -2
- package/types/document/documentSchema.d.ts +0 -2
- package/types/document/filterMeta.d.ts +0 -13
- package/types/fetch/client/fetchClient.d.ts +1 -4
- package/types/fetch/client/httpClient.d.ts +2 -5
- package/types/fetch/client/wsClient.d.ts +3 -3
- package/types/fetch/requestStorage.d.ts +9 -0
- package/types/index.d.ts +12 -0
- package/types/server/admissionQueue.d.ts +26 -0
- package/types/server/akanAppHeaders.d.ts +3 -1
- package/types/server/akanOption.d.ts +16 -1
- package/types/server/assetHeaders.d.ts +5 -3
- package/types/server/cachePolicy.d.ts +2 -0
- package/types/server/clientErrorReport.d.ts +27 -0
- package/types/server/clientReportId.d.ts +9 -0
- package/types/server/console.d.ts +0 -7
- package/types/server/devtools/devtoolsAccess.d.ts +12 -0
- package/types/server/devtools/devtoolsRouter.d.ts +0 -1
- package/types/server/devtools/devtoolsUnlockPage.d.ts +11 -0
- package/types/server/devtools/signalSerializer.d.ts +3 -1
- package/types/server/devtools/studio/studioDocument.d.ts +1 -0
- package/types/server/devtools/types.d.ts +5 -0
- package/types/server/forwardedError.d.ts +13 -0
- package/types/server/gateway/gatewayChildren.d.ts +2 -0
- package/types/server/gateway/gatewayConfig.d.ts +1 -0
- package/types/server/gateway/gatewayHttpProxy.d.ts +1 -0
- package/types/server/gateway/gatewayStatus.d.ts +2 -0
- package/types/server/headSplice.d.ts +11 -0
- package/types/server/hmr/clientReport.d.ts +2 -0
- package/types/server/hmr/csrDevShell.d.ts +3 -1
- package/types/server/htmlResultCache.d.ts +13 -3
- package/types/server/index.d.ts +4 -3
- package/types/server/lifecycle/secretEnv.d.ts +23 -0
- package/types/server/logging/logForwarder.d.ts +1 -0
- package/types/server/logging/logStdoutWriter.d.ts +1 -0
- package/types/server/logging/rotatingLogWriter.d.ts +1 -1
- package/types/server/metrics/metricAggregate.d.ts +6 -0
- package/types/server/metrics/metricExposition.d.ts +8 -0
- package/types/server/metrics/metricMerge.d.ts +9 -0
- package/types/server/metrics/metricRegistry.d.ts +76 -0
- package/types/server/metrics/pubsubGauges.d.ts +5 -0
- package/types/server/metrics/requestMetrics.d.ts +22 -0
- package/types/server/metrics/runtimeFamilies.d.ts +9 -0
- package/types/server/metrics/slowStatementLog.d.ts +18 -0
- package/types/server/metrics/statementMetrics.d.ts +45 -0
- package/types/server/metrics/statementPlanCheck.d.ts +16 -0
- package/types/server/metrics/statementReport.d.ts +28 -0
- package/types/server/ops/statusAccess.d.ts +7 -1
- package/types/server/otlp/otlpBatcher.d.ts +18 -0
- package/types/server/otlp/otlpConfig.d.ts +25 -0
- package/types/server/otlp/otlpEncode.d.ts +13 -0
- package/types/server/otlp/otlpExporter.d.ts +18 -0
- package/types/server/otlp/otlpSampler.d.ts +10 -0
- package/types/server/pageFailure.d.ts +14 -0
- package/types/server/renderBusyResponse.d.ts +9 -0
- package/types/server/reportText.d.ts +4 -0
- package/types/server/resolver/httpEndpointHandler.d.ts +14 -0
- package/types/server/resolver/jobTrace.d.ts +5 -0
- package/types/server/resolver/modelLoaders.d.ts +3 -0
- package/types/server/resolver/timedQuery.d.ts +2 -1
- package/types/server/routeCacheQuery.d.ts +11 -0
- package/types/server/routeCacheTally.d.ts +23 -0
- package/types/server/routeElementComposer.d.ts +2 -0
- package/types/server/routing/appWsData.d.ts +3 -0
- package/types/server/routing/devRoutes.d.ts +9 -0
- package/types/server/routing/devSurfacePolicy.d.ts +12 -0
- package/types/server/routing/devSurfaces.d.ts +18 -0
- package/types/server/routing/hostAllowlist.d.ts +1 -0
- package/types/server/routing/roomReplay.d.ts +1 -0
- package/types/server/routing/serverListener.d.ts +2 -0
- package/types/server/routing/soloAppRoutes.d.ts +3 -1
- package/types/server/rscClient.d.ts +1 -0
- package/types/server/rscClientChunks.d.ts +3 -1
- package/types/server/rscClientErrorSender.d.ts +8 -0
- package/types/server/rscClientErrors.d.ts +3 -0
- package/types/server/rscFirstRenderMemory.d.ts +16 -0
- package/types/server/rscFlightStream.d.ts +1 -1
- package/types/server/rscHostRenderStream.d.ts +2 -1
- package/types/server/rscRenderAdmission.d.ts +14 -0
- package/types/server/rscRenderControl.d.ts +2 -1
- package/types/server/rscRenderHandler.d.ts +5 -2
- package/types/server/rscRenderLevels.d.ts +8 -0
- package/types/server/rscRenderRefusal.d.ts +9 -0
- package/types/server/rscRenderStats.d.ts +2 -0
- package/types/server/rscResultCaches.d.ts +8 -1
- package/types/server/rscWorkerCache.d.ts +2 -0
- package/types/server/rscWorkerHost.d.ts +2 -1
- package/types/server/rscWorkerProcess.d.ts +1 -0
- package/types/server/rscWorkerRecycler.d.ts +1 -1
- package/types/server/scriptPolicy.d.ts +31 -0
- package/types/server/serverConfig.d.ts +1 -0
- package/types/server/serverMetrics.d.ts +4 -1
- package/types/server/sitemap.d.ts +0 -2
- package/types/server/ssrFromRscRenderer.d.ts +2 -6
- package/types/server/ssrInlineScripts.d.ts +39 -0
- package/types/server/ssrTypes.d.ts +14 -2
- package/types/server/systemPageDocument.d.ts +3 -1
- package/types/server/systemPages.d.ts +2 -1
- package/types/server/webRouteContext.d.ts +7 -4
- package/types/server/webRouter.d.ts +2 -1
- package/types/service/agent.service.d.ts +3 -0
- package/types/service/agentLoop/agentLoopTypes.d.ts +16 -7
- package/types/service/agentLoop/loopContext.d.ts +13 -0
- package/types/service/agentLoop/loopToolkits.d.ts +1 -0
- package/types/service/index.d.ts +0 -1
- package/types/service/ipcTypes.d.ts +60 -0
- package/types/service/mentionToken.d.ts +13 -0
- package/types/service/predefinedAdaptor/anthropicLlm.d.ts +3 -3
- package/types/service/predefinedAdaptor/database.adaptor.d.ts +2 -0
- package/types/service/predefinedAdaptor/directoryNotWritableError.d.ts +6 -0
- package/types/service/predefinedAdaptor/index.d.ts +1 -0
- package/types/service/predefinedAdaptor/llm.adaptor.d.ts +9 -3
- package/types/service/predefinedAdaptor/llmContext.d.ts +11 -0
- package/types/service/predefinedAdaptor/llmFence.d.ts +15 -0
- package/types/service/predefinedAdaptor/openaiDialect.d.ts +3 -3
- package/types/service/predefinedAdaptor/sql/driver/bunSqlite.d.ts +3 -1
- package/types/service/predefinedAdaptor/sql/driver/postgres.d.ts +3 -1
- package/types/service/predefinedAdaptor/sql/statementFingerprint.d.ts +21 -0
- package/types/service/predefinedAdaptor/sql/statementPlans.d.ts +17 -0
- package/types/service/predefinedAdaptor/sql/statementProbe.d.ts +37 -0
- package/types/service/predefinedAdaptor/sql/statementScrub.d.ts +5 -0
- package/types/service/predefinedAdaptor/storage.adaptor.d.ts +1 -0
- package/types/service/predefinedAdaptor/websocket.adaptor.d.ts +3 -0
- package/types/signal/CrossSiteGuard.d.ts +1 -0
- package/types/signal/SignalFailure.d.ts +2 -0
- package/types/signal/browserError.d.ts +17 -0
- package/types/signal/errorReporting.d.ts +27 -0
- package/types/signal/httpPeer.d.ts +5 -0
- package/types/signal/index.d.ts +3 -1
- package/types/signal/requestTrace.d.ts +33 -0
- package/types/signal/signalContext.d.ts +2 -1
- package/types/signal/spanExport.d.ts +47 -0
- package/types/signal/trace.d.ts +33 -12
- package/types/store/agent/AgentBridge.d.ts +1 -0
- package/types/store/agent/AgentContext.d.ts +6 -2
- package/types/store/agent/AgentInline.d.ts +16 -0
- package/types/store/baseSt.d.ts +0 -2
- package/types/store/index.d.ts +2 -2
- package/types/store/stateBuilder.d.ts +0 -4
- package/types/ui/Link/Action.d.ts +2 -1
- package/types/ui/Reference/origin.d.ts +0 -2
- package/types/ui/System/Common.d.ts +1 -1
- package/types/vendor/@akanjs/native/packages/cli/src/lib/project.d.ts +5 -0
- package/types/vendor/@akanjs/native/packages/core/src/boot.d.ts +5 -0
- package/types/vendor/@akanjs/native/plugins/external-view/src/index.d.ts +20 -8
- package/types/vendor/@akanjs/native/plugins/keyboard/src/index.d.ts +3 -2
- package/types/vendor/use-agentic/ToolRunner.d.ts +2 -1
- package/types/vendor/use-agentic/types.d.ts +8 -0
- package/types/webkit/CsrStack.d.ts +2 -1
- package/types/webkit/csrPageReadiness.d.ts +18 -0
- package/types/webkit/csrSlide.d.ts +30 -0
- package/types/webkit/index.d.ts +1 -1
- package/types/webkit/nativeNavigation.d.ts +2 -2
- package/types/webkit/nativeSplash.d.ts +6 -0
- package/types/webkit/openSurfaces.d.ts +13 -0
- package/types/webkit/useCsrKeyboard.d.ts +2 -1
- package/types/webkit/useCsrNavigation.d.ts +1 -1
- package/types/webkit/useEscapeKey.d.ts +7 -2
- package/types/webkit/useFrameRuntime.d.ts +6 -2
- package/types/webkit/usePageLocation.d.ts +3 -1
- package/types/webkit/useVisualViewportFrame.d.ts +2 -0
- package/ui/Dialog/Modal.tsx +16 -2
- package/ui/KeyboardAvoiding.tsx +2 -1
- package/ui/Layout/FrameSlotPortal.tsx +10 -3
- package/ui/Link/Action.tsx +2 -1
- package/ui/Reference/origin.ts +0 -10
- package/ui/System/CSR.tsx +33 -13
- package/ui/System/Common.tsx +8 -2
- package/ui/System/SSR.tsx +7 -4
- package/ui/Tooltip.tsx +1 -1
- package/ui/styles.css +14 -0
- package/vendor/@akanjs/native/CHANGELOG.md +20 -52
- package/vendor/@akanjs/native/native/android/src/com/akanjs/runtime/AkanNativeActivity.kt +27 -14
- package/vendor/@akanjs/native/native/desktop/Cargo.lock +1 -0
- package/vendor/@akanjs/native/native/desktop/Cargo.toml +2 -0
- package/vendor/@akanjs/native/native/desktop/src/acl.rs +27 -7
- package/vendor/@akanjs/native/native/desktop/src/external.rs +240 -29
- package/vendor/@akanjs/native/native/desktop/src/lib.rs +3 -3
- package/vendor/@akanjs/native/native/desktop/src/navigation.rs +4 -0
- package/vendor/@akanjs/native/native/ios/Sources/AkanNativeViewController.swift +21 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/acl.ts +10 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/project.ts +11 -1
- package/vendor/@akanjs/native/packages/core/src/boot.ts +6 -0
- package/vendor/@akanjs/native/plugins/external-view/native-plugin.json +26 -0
- package/vendor/@akanjs/native/plugins/external-view/src/desktop.ts +9 -1
- package/vendor/@akanjs/native/plugins/external-view/src/index.ts +20 -8
- package/vendor/@akanjs/native/plugins/keyboard/src/index.ts +3 -2
- package/vendor/use-agentic/AgentSession.ts +1 -1
- package/vendor/use-agentic/CHANGELOG.md +9 -59
- package/vendor/use-agentic/Compaction.ts +1 -1
- package/vendor/use-agentic/ToolRunner.ts +12 -0
- package/vendor/use-agentic/WIRE.md +8 -2
- package/vendor/use-agentic/types.ts +8 -0
- package/webkit/CsrStack.ts +17 -9
- package/webkit/McpAppAgent.ts +3 -1
- package/webkit/RenderLayer.tsx +22 -13
- package/webkit/bootCsr.tsx +19 -1
- package/webkit/csrPageReadiness.ts +43 -0
- package/webkit/csrSlide.ts +130 -0
- package/webkit/index.ts +1 -1
- package/webkit/nativeNavigation.ts +12 -3
- package/webkit/nativeSplash.ts +30 -0
- package/webkit/openSurfaces.ts +54 -0
- package/webkit/useCsrKeyboard.ts +33 -1
- package/webkit/useCsrNavigation.ts +69 -21
- package/webkit/useCsrTransitions.ts +130 -29
- package/webkit/useCsrValues.ts +17 -5
- package/webkit/useEscapeKey.tsx +10 -23
- package/webkit/useFrameRuntime.ts +55 -6
- package/webkit/usePageLocation.ts +8 -2
- package/webkit/useVisualViewportFrame.tsx +24 -0
- package/client/locale.ts +0 -5
- package/service/serviceRegistry.ts +0 -27
- package/types/client/locale.d.ts +0 -6
- package/types/service/serviceRegistry.d.ts +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentProgressReport } from "./AgentProgress.d.ts";
|
|
2
|
-
import type { SurfaceView, ToolActivity, ToolCallRequest, ToolCallResult, ToolCard, ToolEntry } from "./types.d.ts";
|
|
2
|
+
import type { RunnerRequest, SurfaceView, ToolActivity, ToolCallRequest, ToolCallResult, ToolCard, ToolEntry } from "./types.d.ts";
|
|
3
3
|
export interface ToolApprovalRequest {
|
|
4
4
|
callId: string;
|
|
5
5
|
name: string;
|
|
@@ -87,6 +87,7 @@ export declare class ToolRunner {
|
|
|
87
87
|
constructor(surface: SurfaceView, host?: ToolRunnerHost);
|
|
88
88
|
/** Never throws: a refused guard, a declined approval and an unknown name are all results the model reads. */
|
|
89
89
|
run(call: ToolCallRequest, signal: AbortSignal): Promise<ToolCallResult>;
|
|
90
|
+
sending<T extends Pick<RunnerRequest, "context"> & Partial<Pick<RunnerRequest, "messages">>>(request: T): T;
|
|
90
91
|
forgetUntrusted(): void;
|
|
91
92
|
/**
|
|
92
93
|
* The call, or the abort — whichever lands first.
|
|
@@ -222,6 +222,9 @@ export interface MessageAttachment {
|
|
|
222
222
|
* **`value` arrives masked, and nothing downstream can mask it again.** Masking needs the model class
|
|
223
223
|
* (`mask(model, value)`), which no wire carries, so whichever model the host names when it stages the reference is
|
|
224
224
|
* the whole of the decision about what leaves the browser.
|
|
225
|
+
*
|
|
226
|
+
* **A turn sent with one counts as a `taint: "source"` read.** The label and the value are the record's, written by
|
|
227
|
+
* whoever wrote the record, so the first change after the message asks the user first.
|
|
225
228
|
*/
|
|
226
229
|
export interface MessageReference {
|
|
227
230
|
/** The host's own `refName`, unchanged — the vocabulary its published tools already speak. */
|
|
@@ -269,6 +272,11 @@ export interface ChatMessage {
|
|
|
269
272
|
/** One block of screen context the host assembles per turn. `kind` is the host's vocabulary; the wire forwards it verbatim. */
|
|
270
273
|
export interface ContextBlock {
|
|
271
274
|
kind: string;
|
|
275
|
+
/**
|
|
276
|
+
* The block holds text someone other than the host's developer or the user may have written. A backend fences it
|
|
277
|
+
* as page content, and the turn counts as a `taint: "source"` read: the next change asks first.
|
|
278
|
+
*/
|
|
279
|
+
untrusted?: boolean;
|
|
272
280
|
[key: string]: unknown;
|
|
273
281
|
}
|
|
274
282
|
export type RunnerEvent = {
|
|
@@ -47,6 +47,7 @@ export declare class CsrStack {
|
|
|
47
47
|
*/
|
|
48
48
|
static redrawFor(history: History, current: Location, token: string | null): boolean;
|
|
49
49
|
static leave(history: History, current: Location): void;
|
|
50
|
-
static entriesOf(
|
|
50
|
+
static entriesOf(state: CsrStackState): CsrStackEntry[];
|
|
51
|
+
static holds(state: CsrStackState, target: Location): boolean;
|
|
51
52
|
}
|
|
52
53
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Location, RouteRender } from "akanjs/client";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a page's layers are drawn, by the entry id of the location they draw: each layer reports while it shows its
|
|
4
|
+
* loading fallback. A page switched in place waits on this, out of sight, so it never swaps in a shell of fallbacks.
|
|
5
|
+
*/
|
|
6
|
+
export declare class CsrPageReadiness {
|
|
7
|
+
#private;
|
|
8
|
+
static report(entryId: string, layerId: string, isLoading: boolean): void;
|
|
9
|
+
static drop(entryId: string, layerId: string): void;
|
|
10
|
+
static isAsync(render?: RouteRender): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether a page shows a fallback before it is drawn: only an async render or a guard makes a layer wait. A root
|
|
13
|
+
* layout is drawn once for every page, so only its guard, asked for each page, counts.
|
|
14
|
+
*/
|
|
15
|
+
static drawsLater(location: Location): boolean;
|
|
16
|
+
/** `false` until a layer of the page has reported, and while any of them shows its fallback. */
|
|
17
|
+
static isDrawn(entryId: string | undefined): boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { PathRoute } from "akanjs/client";
|
|
2
|
+
type FramePageState = PathRoute["pageState"];
|
|
3
|
+
type Keyframe = Record<string, string>;
|
|
4
|
+
export interface CsrSlideFrame {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
pageState: FramePageState;
|
|
8
|
+
prevPageState: FramePageState;
|
|
9
|
+
}
|
|
10
|
+
interface CsrSlidePlay {
|
|
11
|
+
fromUnit: number;
|
|
12
|
+
toUnit: number;
|
|
13
|
+
duration: number;
|
|
14
|
+
keep?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare class CsrSlide {
|
|
17
|
+
#private;
|
|
18
|
+
static readonly easing = "cubic-bezier(0.25, 1, 0.5, 1)";
|
|
19
|
+
private constructor();
|
|
20
|
+
static get supported(): boolean;
|
|
21
|
+
static get isCalm(): boolean;
|
|
22
|
+
static play(frame: CsrSlideFrame, { fromUnit, toUnit, duration, keep }: CsrSlidePlay): CsrSlide | null;
|
|
23
|
+
/** What each part's style is with the page `unit` px from its place: 0 shown, the frame's width gone right. */
|
|
24
|
+
static partsAt({ width, height, pageState, prevPageState }: CsrSlideFrame, unit: number): Record<string, Keyframe>;
|
|
25
|
+
/** Where the page is right now, as the spring's unit, or null when this slide does not move it. */
|
|
26
|
+
unitNow(): number | null;
|
|
27
|
+
get finished(): Promise<undefined>;
|
|
28
|
+
cancel(): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
package/types/webkit/index.d.ts
CHANGED
|
@@ -24,4 +24,4 @@ export { usePageTool } from "./usePageTool.d.ts";
|
|
|
24
24
|
export type { ScreenScopeItem } from "./useScreenScope.d.ts";
|
|
25
25
|
export { useScreenScope } from "./useScreenScope.d.ts";
|
|
26
26
|
export { useThrottle } from "./useThrottle.d.ts";
|
|
27
|
-
export { useVisualViewportFrame, type VisualViewportFrame } from "./useVisualViewportFrame.d.ts";
|
|
27
|
+
export { isPageKeyboardAvoidance, useVisualViewportFrame, type VisualViewportFrame } from "./useVisualViewportFrame.d.ts";
|
|
@@ -27,8 +27,8 @@ export declare class NativeNavigation {
|
|
|
27
27
|
showPushesExcept(pathname: string): void;
|
|
28
28
|
listen(): () => void;
|
|
29
29
|
/**
|
|
30
|
-
* Tells an Android shell whether back is the page's right now: the keyboard is up,
|
|
31
|
-
* index is still to come. Otherwise the system takes it and shows its own back-to-home animation.
|
|
30
|
+
* Tells an Android shell whether back is the page's right now: the keyboard is up, a dialog or sheet is open, there
|
|
31
|
+
* is history, or the index is still to come. Otherwise the system takes it and shows its own back-to-home animation.
|
|
32
32
|
*/
|
|
33
33
|
syncBack(force?: boolean): void;
|
|
34
34
|
openDeepLink(url: string): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The surfaces open on the page (dialogs, sheets, confirms), newest last. Escape and an app's back button close the
|
|
3
|
+
* newest one only: per-component listeners would all hear one key and close nested surfaces together.
|
|
4
|
+
*/
|
|
5
|
+
export declare class OpenSurfaces {
|
|
6
|
+
#private;
|
|
7
|
+
static open(close: () => void, { takesBack }?: {
|
|
8
|
+
takesBack?: boolean;
|
|
9
|
+
}): () => void;
|
|
10
|
+
static closeForBack(): boolean;
|
|
11
|
+
static takesBack(): boolean;
|
|
12
|
+
static listen(listener: () => void): () => void;
|
|
13
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KeyboardFrameState } from "akanjs/client";
|
|
1
2
|
import type { CsrLocationState } from "./useCsrLocationState.d.ts";
|
|
2
3
|
import type { CsrRefs } from "./useCsrRefs.d.ts";
|
|
3
4
|
import { type useFrameSlots, type useFrameViewport } from "./useFrameRuntime.d.ts";
|
|
@@ -13,7 +14,7 @@ export declare const useCsrKeyboard: ({ viewport, updateViewport, frameSlots, ph
|
|
|
13
14
|
platformProfile: import("akanjs/client").FramePlatformProfile;
|
|
14
15
|
accessoryHeight: number;
|
|
15
16
|
shouldAnchorContentBottom: boolean;
|
|
16
|
-
keyboardFrame:
|
|
17
|
+
keyboardFrame: KeyboardFrameState;
|
|
17
18
|
keyboardLayout: Pick<import("akanjs/client").FrameLayoutState, "keyboardAccessory" | "contentViewport">;
|
|
18
19
|
};
|
|
19
20
|
export type CsrKeyboard = ReturnType<typeof useCsrKeyboard>;
|
|
@@ -13,7 +13,7 @@ interface CsrNavigationInput {
|
|
|
13
13
|
frame: ResolvedFrame;
|
|
14
14
|
keyboard: CsrKeyboard;
|
|
15
15
|
}
|
|
16
|
-
export declare const useCsrNavigation: (
|
|
16
|
+
export declare const useCsrNavigation: (input: CsrNavigationInput) => {
|
|
17
17
|
shouldPrepareFrameTransition: (nextHref?: string) => boolean;
|
|
18
18
|
startFrameTransition: () => Promise<void>;
|
|
19
19
|
settle: (prev: LocationState["prevLocation"]) => void;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Calls `onEscape` on Escape, or an app's back button, while `active` and this surface is the newest active one.
|
|
3
|
+
* `back: false` leaves the back button to the page: for a hint the person did not open, such as a tooltip.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useEscapeKey: (active: boolean, onEscape: () => void, { back }?: {
|
|
6
|
+
back?: boolean;
|
|
7
|
+
}) => void;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { type FrameLayoutState, type FramePlatformProfile, type FrameSlotRegistration, type FrameSnapshot, type KeyboardFrameState, type Location, type NavigationIntent, type PageState, type PathRoute, type TransitionPlan, type TransitionType } from "akanjs/client";
|
|
1
|
+
import { ANDROID_KEYBOARD_ANIMATION_EASING, type FrameLayoutState, type FramePlatformProfile, type FrameSlotRegistration, type FrameSnapshot, IOS_KEYBOARD_ANIMATION_EASING, type KeyboardFrameState, type Location, type NavigationIntent, type PageState, type PathRoute, type TransitionPlan, type TransitionType } from "akanjs/client";
|
|
2
2
|
export type FrameSlotMap = Record<string, Record<string, FrameSlotRegistration>>;
|
|
3
3
|
export type FrameSlotBucket = "active" | "pending";
|
|
4
4
|
export type FrameSlotMapByBucket = Record<FrameSlotBucket, FrameSlotMap>;
|
|
5
5
|
export declare const PENDING_FRAME_READY_TIMEOUT_MS = 80;
|
|
6
6
|
export declare const PENDING_FRAME_READY_MAX_TIMEOUT_MS = 120;
|
|
7
|
+
export declare const STACK_TRANSITION_DURATION_MS = 350;
|
|
7
8
|
export declare const KEYBOARD_SHOW_ANIMATION_DURATION_MS = 420;
|
|
8
9
|
export declare const KEYBOARD_HIDE_ANIMATION_DURATION_MS = 90;
|
|
9
10
|
export declare const KEYBOARD_SHOW_ANIMATION_EASING = "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
10
11
|
export declare const KEYBOARD_HIDE_ANIMATION_EASING = "cubic-bezier(0.7, 0, 0.84, 0)";
|
|
12
|
+
export { ANDROID_KEYBOARD_ANIMATION_EASING, IOS_KEYBOARD_ANIMATION_EASING };
|
|
11
13
|
export declare const FRAME_Z_INDEX: {
|
|
12
14
|
readonly page: 10;
|
|
13
15
|
readonly previousPage: 0;
|
|
@@ -43,13 +45,15 @@ export declare function getKeyboardAccessorySlots(path: string, frameSlots: Fram
|
|
|
43
45
|
export declare function resolveKeyboardAccessoryHeight(path: string, frameSlots: FrameSlotMap): number;
|
|
44
46
|
export declare function hasKeyboardStickySlot(path: string, frameSlots: FrameSlotMap): boolean;
|
|
45
47
|
export declare function hasBottomAnchoredKeyboardSlot(path: string, frameSlots: FrameSlotMap): boolean;
|
|
46
|
-
export declare function resolveKeyboardFrame({ keyboardHeight, visualViewportKeyboardHeight, platformProfile, sticky, freeze, }: {
|
|
48
|
+
export declare function resolveKeyboardFrame({ keyboardHeight, visualViewportKeyboardHeight, platformProfile, sticky, freeze, pageAvoidsKeyboard, nativeAnimationDuration, }: {
|
|
47
49
|
keyboardHeight: number;
|
|
48
50
|
bottomSafeArea: number;
|
|
49
51
|
visualViewportKeyboardHeight: number;
|
|
50
52
|
platformProfile: FramePlatformProfile;
|
|
51
53
|
sticky: boolean;
|
|
52
54
|
freeze?: boolean;
|
|
55
|
+
pageAvoidsKeyboard?: boolean;
|
|
56
|
+
nativeAnimationDuration?: number;
|
|
53
57
|
}): KeyboardFrameState;
|
|
54
58
|
export declare function resolveKeyboardLayout({ viewport, keyboard, accessoryHeight, bottomSafeArea, }: {
|
|
55
59
|
viewport: FrameLayoutState["viewport"];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This page's own location. `st.use.searchParams()` and its siblings follow the page on screen, so a page mounted
|
|
3
3
|
* off it — one being prepared, one kept under the current one — reads its own here instead. An SSR page is always the
|
|
4
|
-
* one on screen
|
|
4
|
+
* one on screen: it keeps the query its server render used, which a route keyed on the sorted query sorts and strips
|
|
5
|
+
* of tracking parameters, until the URL's query moves off the one the document loaded with (a shallow replace, a
|
|
6
|
+
* back), and then follows the store's.
|
|
5
7
|
*/
|
|
6
8
|
export declare const usePageLocation: () => {
|
|
7
9
|
pathname: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPageKeyboardAvoidance } from "akanjs/client";
|
|
1
2
|
export interface VisualViewportFrame {
|
|
2
3
|
/** The on-screen keyboard's height over the layout viewport's bottom; 0 while it is closed. */
|
|
3
4
|
keyboardHeight: number;
|
|
@@ -5,6 +6,7 @@ export interface VisualViewportFrame {
|
|
|
5
6
|
height: number;
|
|
6
7
|
offsetTop: number;
|
|
7
8
|
}
|
|
9
|
+
export { isPageKeyboardAvoidance };
|
|
8
10
|
/**
|
|
9
11
|
* The visible part of the page while the on-screen keyboard is up, on the web. Only `visualViewport` reports the
|
|
10
12
|
* keyboard: `dvh` tracks the browser's own chrome, and iOS pans the visual viewport to the field instead of shrinking
|
package/ui/Dialog/Modal.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn, usePage } from "akanjs/client";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
isPageKeyboardAvoidance,
|
|
5
|
+
useBodyScrollLock,
|
|
6
|
+
useEscapeKey,
|
|
7
|
+
usePageActivity,
|
|
8
|
+
useVisualViewportFrame,
|
|
9
|
+
} from "akanjs/webkit";
|
|
4
10
|
import { type ReactNode, useCallback, useContext, useEffect, useId, useRef, useState } from "react";
|
|
5
11
|
import { createPortal } from "react-dom";
|
|
6
12
|
import { BiX } from "react-icons/bi";
|
|
@@ -47,6 +53,14 @@ export const Modal = ({
|
|
|
47
53
|
const [root, setRoot] = useState<HTMLDivElement | null>(null);
|
|
48
54
|
const [dragY, setDragY] = useState(0);
|
|
49
55
|
const surface = modalSurfaceOf(presentation, placement);
|
|
56
|
+
|
|
57
|
+
const { keyboardHeight } = useVisualViewportFrame();
|
|
58
|
+
const keyboardInset = isPageKeyboardAvoidance()
|
|
59
|
+
? {
|
|
60
|
+
paddingBottom: keyboardHeight,
|
|
61
|
+
transition: "padding-bottom var(--akan-keyboard-duration, 0ms) var(--akan-keyboard-easing, ease)",
|
|
62
|
+
}
|
|
63
|
+
: null;
|
|
50
64
|
|
|
51
65
|
const requestClose = useCallback(() => {
|
|
52
66
|
if (confirmClose && !window.confirm(l("base.confirmClose"))) return;
|
|
@@ -98,7 +112,7 @@ export const Modal = ({
|
|
|
98
112
|
{...overlayLayerProps}
|
|
99
113
|
ref={setRoot}
|
|
100
114
|
className={cn("fixed inset-0 flex bg-black/40", surface.root)}
|
|
101
|
-
style={{ zIndex: overlayZ.modal, visibility: isCurrentPage ? undefined : "hidden" }}
|
|
115
|
+
style={{ zIndex: overlayZ.modal, visibility: isCurrentPage ? undefined : "hidden", ...keyboardInset }}
|
|
102
116
|
onClick={(event) => {
|
|
103
117
|
if (event.target !== event.currentTarget) return;
|
|
104
118
|
requestClose();
|
package/ui/KeyboardAvoiding.tsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { useSpring } from "@react-spring/web";
|
|
3
3
|
import { useCsr } from "akanjs/client";
|
|
4
4
|
import { st } from "akanjs/store";
|
|
5
|
+
import { isPageKeyboardAvoidance } from "akanjs/webkit";
|
|
5
6
|
import { type ReactNode, useEffect, useRef } from "react";
|
|
6
7
|
import { animated } from "./animated";
|
|
7
8
|
|
|
@@ -28,7 +29,7 @@ export const KeyboardAvoiding = ({ children, className }: KeyboardAvoidingProps)
|
|
|
28
29
|
const test = async () => {
|
|
29
30
|
if (!pageContentRef.current) return;
|
|
30
31
|
|
|
31
|
-
const newHeight = keyboardHeight ? keyboardHeight - pageState.bottomSafeArea : 0;
|
|
32
|
+
const newHeight = keyboardHeight && !isPageKeyboardAvoidance() ? keyboardHeight - pageState.bottomSafeArea : 0;
|
|
32
33
|
|
|
33
34
|
await onChange(newHeight);
|
|
34
35
|
|
|
@@ -41,10 +41,11 @@ const moveInto = (parent: HTMLElement, node: HTMLElement) => {
|
|
|
41
41
|
|
|
42
42
|
interface SsrFrameSlotProps {
|
|
43
43
|
slot: FrameSlotName;
|
|
44
|
+
isOverlaid: boolean;
|
|
44
45
|
children: ReactNode;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
const SsrFrameSlot = ({ slot, children }: SsrFrameSlotProps) => {
|
|
48
|
+
const SsrFrameSlot = ({ slot, isOverlaid, children }: SsrFrameSlotProps) => {
|
|
48
49
|
const boxRef = useRef<HTMLDivElement>(null);
|
|
49
50
|
const contentRef = useRef<HTMLDivElement>(null);
|
|
50
51
|
useLayoutEffect(() => {
|
|
@@ -61,7 +62,7 @@ const SsrFrameSlot = ({ slot, children }: SsrFrameSlotProps) => {
|
|
|
61
62
|
<div
|
|
62
63
|
ref={boxRef}
|
|
63
64
|
data-akan-frame-fallback={slot}
|
|
64
|
-
className={cn(frameSlotContainerClassNames[slot], "z-10 empty:hidden")}
|
|
65
|
+
className={cn(frameSlotContainerClassNames[slot], "z-10 empty:hidden", isOverlaid && "bg-transparent")}
|
|
65
66
|
style={frameSlotStyles[slot]}
|
|
66
67
|
>
|
|
67
68
|
<div ref={contentRef} className={frameSlotContentClassNames[slot]}>
|
|
@@ -78,7 +79,13 @@ interface FrameSlotPortalProps {
|
|
|
78
79
|
}
|
|
79
80
|
export const FrameSlotPortal = ({ slot, children }: FrameSlotPortalProps) => {
|
|
80
81
|
const pathCtx = usePathCtx();
|
|
81
|
-
|
|
82
|
+
const overlay = pathCtx.location?.pathRoute?.pageState?.overlay;
|
|
83
|
+
if (getEnv().renderMode !== "csr")
|
|
84
|
+
return (
|
|
85
|
+
<SsrFrameSlot slot={slot} isOverlaid={slot === "topInset" && !!overlay?.top}>
|
|
86
|
+
{children}
|
|
87
|
+
</SsrFrameSlot>
|
|
88
|
+
);
|
|
82
89
|
|
|
83
90
|
const path = pathCtx.location?.pathRoute?.path;
|
|
84
91
|
return <Portal id={path ? `${slot}Content-${pathCtx.pageKey ?? path}` : `${slot}Content`}>{children}</Portal>;
|
package/ui/Link/Action.tsx
CHANGED
|
@@ -8,7 +8,8 @@ export interface ActionProps {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface BackProps extends ActionProps {
|
|
11
|
-
/** Where to go when there is no history to go back to, as on a deep link or a freshly opened app
|
|
11
|
+
/** Where to go when there is no history to go back to, as on a deep link or a freshly opened app; a browser tab this
|
|
12
|
+
* app opened closes instead. */
|
|
12
13
|
fallback?: string;
|
|
13
14
|
}
|
|
14
15
|
|
package/ui/Reference/origin.ts
CHANGED
|
@@ -20,13 +20,3 @@ export const originText = (origin: string[]) => {
|
|
|
20
20
|
const bases = origin.slice(0, -1).reverse().join(", ");
|
|
21
21
|
return bases ? { en: `${owner} (extends ${bases})`, ko: `${owner} (${bases} 확장)` } : { en: owner, ko: owner };
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
/** @deprecated Unused by akanjs, and removed in a later minor. */
|
|
25
|
-
export const groupByOwner = <Item>(items: Item[], originOf: (item: Item) => string[] | undefined, order: string[]) => {
|
|
26
|
-
const groups = new Map<string, Item[]>(order.map((owner) => [owner, []]));
|
|
27
|
-
for (const item of items) {
|
|
28
|
-
const owner = ownerOf(originOf(item)) ?? "";
|
|
29
|
-
groups.set(owner, [...(groups.get(owner) ?? []), item]);
|
|
30
|
-
}
|
|
31
|
-
return [...groups.entries()].filter(([, grouped]) => grouped.length);
|
|
32
|
-
};
|
package/ui/System/CSR.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
debugFrame,
|
|
9
9
|
getPathInfo,
|
|
10
10
|
type PageActivity,
|
|
11
|
+
type PageState,
|
|
11
12
|
type ReactFont,
|
|
12
13
|
router,
|
|
13
14
|
useCsr,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
useState,
|
|
26
27
|
} from "react";
|
|
27
28
|
import { createPortal } from "react-dom";
|
|
29
|
+
import { NativeSplash } from "../../webkit/nativeSplash";
|
|
28
30
|
import { NativeUpdates } from "../../webkit/nativeUpdates";
|
|
29
31
|
import { RenderLayer } from "../../webkit/RenderLayer";
|
|
30
32
|
import { animated } from "../animated";
|
|
@@ -101,6 +103,21 @@ const CSRProvider = ({
|
|
|
101
103
|
};
|
|
102
104
|
CSR.Provider = CSRProvider;
|
|
103
105
|
|
|
106
|
+
const chromeClassNamesOf = (overlay?: PageState["overlay"]) => ({
|
|
107
|
+
topSafeArea: cn(
|
|
108
|
+
"akan-frame-chrome fixed inset-x-0 top-0 max-w-screen bg-background",
|
|
109
|
+
overlay?.top && "pointer-events-none",
|
|
110
|
+
),
|
|
111
|
+
topInset: cn(
|
|
112
|
+
"akan-frame-chrome fixed inset-x-0 isolate max-w-screen overflow-hidden bg-background",
|
|
113
|
+
overlay?.top && "bg-transparent",
|
|
114
|
+
),
|
|
115
|
+
bottomSafeArea: cn(
|
|
116
|
+
"akan-frame-chrome fixed inset-x-0 max-w-screen bg-background",
|
|
117
|
+
overlay?.bottom && "pointer-events-none",
|
|
118
|
+
),
|
|
119
|
+
});
|
|
120
|
+
|
|
104
121
|
interface CSRWrapperProps {
|
|
105
122
|
className?: string;
|
|
106
123
|
appName: string;
|
|
@@ -137,7 +154,8 @@ const CSRWrapper = ({
|
|
|
137
154
|
stackEntries,
|
|
138
155
|
} = useCsr();
|
|
139
156
|
const csrLoaded = st.use.csrLoaded({ agent: false });
|
|
140
|
-
const { router: reactRouter, history } = useCsr();
|
|
157
|
+
const { router: reactRouter, history, location } = useCsr();
|
|
158
|
+
const chrome = chromeClassNamesOf(location?.pathRoute?.pageState?.overlay);
|
|
141
159
|
useEffect(() => {
|
|
142
160
|
debugFrame("csrWrapper.mount", { appName, layoutStyle, pathCount: pathRoutes.length });
|
|
143
161
|
if (layoutStyle === "mobile") {
|
|
@@ -197,15 +215,11 @@ const CSRWrapper = ({
|
|
|
197
215
|
: null}
|
|
198
216
|
<TopChromeLayer
|
|
199
217
|
id="topSafeArea"
|
|
200
|
-
className={
|
|
218
|
+
className={chrome.topSafeArea}
|
|
201
219
|
layerRef={topSafeAreaRef}
|
|
202
220
|
style={topSafeArea?.containerStyle}
|
|
203
221
|
/>
|
|
204
|
-
<TopChromeLayer
|
|
205
|
-
id="topInsetContainer"
|
|
206
|
-
className={cn("akan-frame-chrome fixed inset-x-0 isolate max-w-screen overflow-hidden bg-background")}
|
|
207
|
-
style={topInset?.containerStyle}
|
|
208
|
-
>
|
|
222
|
+
<TopChromeLayer id="topInsetContainer" className={chrome.topInset} style={topInset?.containerStyle}>
|
|
209
223
|
<CSRFrameSlotTargets slot="topInset" />
|
|
210
224
|
</TopChromeLayer>
|
|
211
225
|
<TopChromeLayer
|
|
@@ -245,7 +259,7 @@ const CSRWrapper = ({
|
|
|
245
259
|
</KeyboardLayer>
|
|
246
260
|
<BottomChromeLayer
|
|
247
261
|
id="bottomSafeArea"
|
|
248
|
-
className=
|
|
262
|
+
className={chrome.bottomSafeArea}
|
|
249
263
|
layerRef={bottomSafeAreaRef}
|
|
250
264
|
style={bottomSafeArea?.containerStyle}
|
|
251
265
|
/>
|
|
@@ -335,6 +349,7 @@ const CSRFrameSlotTargets = ({ slot }: { slot: FrameSlotTarget }) => {
|
|
|
335
349
|
<animated.div
|
|
336
350
|
key={id}
|
|
337
351
|
id={id}
|
|
352
|
+
data-page-type={pageType}
|
|
338
353
|
inert={hidden}
|
|
339
354
|
aria-hidden={hidden ? true : undefined}
|
|
340
355
|
className={cn(
|
|
@@ -422,6 +437,10 @@ const CSRPageContainer = ({ entry, prefix, layoutStyle }: CSRPageContainerProps)
|
|
|
422
437
|
useEffect(() => {
|
|
423
438
|
if (pageType === "current") NativeUpdates.confirm();
|
|
424
439
|
}, [pageType]);
|
|
440
|
+
useEffect(
|
|
441
|
+
() => (pageType === "current" ? NativeSplash.hideOnceDrawn(location) : undefined),
|
|
442
|
+
[pageType, location.entryId],
|
|
443
|
+
);
|
|
425
444
|
|
|
426
445
|
const [pageContainers, setPageContainers] = useState(() => document.getElementById("pageContainers"));
|
|
427
446
|
useLayoutEffect(() => {
|
|
@@ -440,18 +459,19 @@ const CSRPageContainer = ({ entry, prefix, layoutStyle }: CSRPageContainerProps)
|
|
|
440
459
|
? { page: prevPage, pageContentRef: prevPageContentRef, pageClassName: "", pageBind: () => ({}) }
|
|
441
460
|
: { page: null, pageContentRef: null, pageClassName: "", pageBind: () => ({}) };
|
|
442
461
|
|
|
462
|
+
const isLeftInPlace =
|
|
463
|
+
pageType === "prev" &&
|
|
464
|
+
currentLocation.pathRoute.pageState.transition === "none" &&
|
|
465
|
+
(csr.phase === "idle" || csr.pendingLocation?.pathRoute.pageState.transition === "none");
|
|
443
466
|
const activity: PageActivity =
|
|
444
|
-
pageType === "cached" ||
|
|
445
|
-
(pageType === "prev" &&
|
|
446
|
-
(csr.isBackgrounded || (currentLocation.pathRoute.pageState.transition === "none" && csr.phase === "idle")))
|
|
447
|
-
? "hidden"
|
|
448
|
-
: pageType;
|
|
467
|
+
pageType === "cached" || (pageType === "prev" && csr.isBackgrounded) || isLeftInPlace ? "hidden" : pageType;
|
|
449
468
|
return (
|
|
450
469
|
<Activity mode={activity === "hidden" ? "hidden" : "visible"}>
|
|
451
470
|
{createPortal(
|
|
452
471
|
<animated.div
|
|
453
472
|
id={`pageContainer-${key}`}
|
|
454
473
|
data-path={pathRoute.path}
|
|
474
|
+
data-page-type={pageType}
|
|
455
475
|
inert={pageType !== "current"}
|
|
456
476
|
aria-hidden={pageType === "current" ? undefined : true}
|
|
457
477
|
style={{
|
package/ui/System/Common.tsx
CHANGED
|
@@ -61,6 +61,8 @@ export type AkanFrameCssVarName =
|
|
|
61
61
|
| "--akan-bottom-inset"
|
|
62
62
|
| "--akan-page-padding-top"
|
|
63
63
|
| "--akan-page-padding-bottom"
|
|
64
|
+
| "--akan-overlay-top"
|
|
65
|
+
| "--akan-overlay-bottom"
|
|
64
66
|
| "--akan-content-height"
|
|
65
67
|
| `--akan-${"top" | "bottom"}-inset-visibility`
|
|
66
68
|
| `--akan-${"top" | "bottom"}-inset-${InsetBreakpoint}`
|
|
@@ -83,11 +85,15 @@ export const isResponsiveFrame = (pageState: PageState, { cssResolved }: { cssRe
|
|
|
83
85
|
*/
|
|
84
86
|
export function getFrameCssVars(pageState: PageState, { cssResolved }: { cssResolved: boolean }): AkanFrameCssVars {
|
|
85
87
|
const safeAreaEnv = cssResolved ? pageState.safeAreaEnv : undefined;
|
|
88
|
+
const topChrome = "calc(var(--akan-top-safe-area) + var(--akan-top-inset))";
|
|
89
|
+
const bottomChrome = "calc(var(--akan-bottom-safe-area) + var(--akan-bottom-inset))";
|
|
86
90
|
const vars: AkanFrameCssVars = {
|
|
87
91
|
"--akan-top-safe-area": safeAreaEnv?.top ? "env(safe-area-inset-top, 0px)" : px(pageState.topSafeArea),
|
|
88
92
|
"--akan-bottom-safe-area": safeAreaEnv?.bottom ? "env(safe-area-inset-bottom, 0px)" : px(pageState.bottomSafeArea),
|
|
89
|
-
"--akan-page-padding-top":
|
|
90
|
-
"--akan-page-padding-bottom":
|
|
93
|
+
"--akan-page-padding-top": pageState.overlay?.top ? "0px" : topChrome,
|
|
94
|
+
"--akan-page-padding-bottom": pageState.overlay?.bottom ? "0px" : bottomChrome,
|
|
95
|
+
"--akan-overlay-top": pageState.overlay?.top ? topChrome : "0px",
|
|
96
|
+
"--akan-overlay-bottom": pageState.overlay?.bottom ? bottomChrome : "0px",
|
|
91
97
|
"--akan-content-height":
|
|
92
98
|
"calc(var(--akan-viewport-height, 100dvh) - var(--akan-page-padding-top) - var(--akan-page-padding-bottom))",
|
|
93
99
|
};
|
package/ui/System/SSR.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Translator,
|
|
10
10
|
usePage,
|
|
11
11
|
} from "akanjs/client";
|
|
12
|
-
import { getRequestFrameState, setRequestTheme, untrackedRequest } from "akanjs/fetch";
|
|
12
|
+
import { getRequestFrameState, getRequestRenderSearch, setRequestTheme, untrackedRequest } from "akanjs/fetch";
|
|
13
13
|
import { Children, type CSSProperties, Fragment, type ReactNode, Suspense } from "react";
|
|
14
14
|
import { FontCss } from "../fontCss";
|
|
15
15
|
import { frameSlotContainerClassNames, frameSlotContentClassNames, frameSlotStyles } from "../Layout/frameSlot";
|
|
@@ -138,7 +138,9 @@ const SSRWrapper = ({
|
|
|
138
138
|
pageState = defaultPageState,
|
|
139
139
|
}: SSRWrapperProps) => {
|
|
140
140
|
|
|
141
|
-
const requestSearch = path.includes("?")
|
|
141
|
+
const requestSearch = path.includes("?")
|
|
142
|
+
? ""
|
|
143
|
+
: (getRequestRenderSearch() ?? new URL(untrackedRequest()?.url ?? "http://localhost").search);
|
|
142
144
|
const { href, pathname, search, hash } = getPathInfo(`${path}${requestSearch}`, lang, prefix ?? "");
|
|
143
145
|
const frameCssVars = getFrameCssVars(pageState, { cssResolved: true });
|
|
144
146
|
const pageContentStyle: CSSProperties = {
|
|
@@ -185,7 +187,7 @@ const SSRWrapper = ({
|
|
|
185
187
|
<div
|
|
186
188
|
key="top-safe-area"
|
|
187
189
|
id="topSafeArea"
|
|
188
|
-
className={cn("fixed inset-x-0 top-0 bg-background")}
|
|
190
|
+
className={cn("fixed inset-x-0 top-0 bg-background", pageState.overlay?.top && "pointer-events-none")}
|
|
189
191
|
style={topSafeAreaStyle}
|
|
190
192
|
/>
|
|
191
193
|
<div key="page-containers" id="pageContainers" className={cn("isolate")}>
|
|
@@ -210,6 +212,7 @@ const SSRWrapper = ({
|
|
|
210
212
|
frameSlotContainerClassNames.topInset,
|
|
211
213
|
layoutStyle === "mobile" && "left-1/2 w-full max-w-[600px] -translate-x-1/2",
|
|
212
214
|
layoutStyle === "web" && "w-full",
|
|
215
|
+
pageState.overlay?.top && "bg-transparent",
|
|
213
216
|
)}
|
|
214
217
|
style={frameSlotStyles.topInset}
|
|
215
218
|
>
|
|
@@ -253,7 +256,7 @@ const SSRWrapper = ({
|
|
|
253
256
|
<div
|
|
254
257
|
key="bottom-safe-area"
|
|
255
258
|
id="bottomSafeArea"
|
|
256
|
-
className="fixed inset-x-0 bg-background"
|
|
259
|
+
className={cn("fixed inset-x-0 bg-background", pageState.overlay?.bottom && "pointer-events-none")}
|
|
257
260
|
style={bottomSafeAreaStyle}
|
|
258
261
|
/>
|
|
259
262
|
</ClientPathWrapper>
|
package/ui/Tooltip.tsx
CHANGED
|
@@ -52,7 +52,7 @@ const DefaultTooltip = ({ content, children, side = "top", className, variant =
|
|
|
52
52
|
showTimer.current = null;
|
|
53
53
|
};
|
|
54
54
|
useEffect(() => cancelShow, []);
|
|
55
|
-
useEscapeKey(open, () => setOpen(false));
|
|
55
|
+
useEscapeKey(open, () => setOpen(false), { back: false });
|
|
56
56
|
if (content === undefined || content === null || content === "") return <>{children}</>;
|
|
57
57
|
const landed = position?.side ?? side;
|
|
58
58
|
const vertical = landed === "top" || landed === "bottom";
|
package/ui/styles.css
CHANGED
|
@@ -216,6 +216,20 @@ body.akan-mobile-document {
|
|
|
216
216
|
contain: layout paint;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/* iOS turns a long press on any selectable block into a text selection, so the empty safe-area fills lit up blue
|
|
220
|
+
under a Copy menu wherever the page itself opts out of selection; the frame's bars are app chrome, never text. */
|
|
221
|
+
@media (pointer: coarse) {
|
|
222
|
+
.akan-frame-chrome {
|
|
223
|
+
-webkit-user-select: none;
|
|
224
|
+
user-select: none;
|
|
225
|
+
-webkit-touch-callout: none;
|
|
226
|
+
}
|
|
227
|
+
.akan-frame-chrome :is(input, textarea, [contenteditable]:not([contenteditable="false"])) {
|
|
228
|
+
-webkit-user-select: text;
|
|
229
|
+
user-select: text;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
219
233
|
.akan-mobile-frame #pageContainers {
|
|
220
234
|
position: relative;
|
|
221
235
|
z-index: 10;
|