akanjs 3.1.0-rc.2 → 3.1.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/base/baseEnv.ts +5 -2
- package/client/device.ts +1 -1
- package/client/frameConfig.ts +2 -2
- package/client/href.ts +35 -0
- package/client/index.ts +1 -0
- package/client/makePageProto.tsx +3 -2
- package/client/router.ts +6 -4
- package/client/rscNavigation.ts +1 -1
- package/client/transitionTypes.ts +0 -4
- package/client/translator.ts +16 -0
- package/client/types.ts +3 -2
- package/client/viewportMeta.ts +23 -8
- package/client/webManifest.ts +5 -3
- package/common/TrustedProxy.ts +14 -0
- package/common/codeAgentWire.ts +8 -1
- package/common/index.ts +1 -0
- package/common/interpolateTranslation.ts +17 -3
- package/common/isEmail.ts +1 -1
- package/common/localeConfig.ts +10 -4
- package/common/markdownSpans.ts +1 -1
- package/common/restClient.ts +3 -1
- package/common/routeConvention.ts +4 -4
- package/common/trimSlashes.ts +11 -0
- package/common/types.ts +1 -1
- package/constant/fieldInfo.ts +2 -2
- package/constant/fieldPlan.ts +80 -0
- package/constant/index.ts +3 -0
- package/constant/inputParser.ts +148 -0
- package/constant/invalidInputError.ts +13 -0
- package/constant/serialize.ts +36 -20
- package/constant/types.ts +1 -1
- package/constant/via.ts +2 -0
- package/dictionary/base.dictionary.ts +4 -0
- package/dictionary/trans.ts +8 -0
- package/document/database.ts +3 -6
- package/document/documentSchema.ts +1 -1
- package/document/noDocumentError.ts +6 -1
- package/fetch/client/fetchClient.ts +2 -1
- package/fetch/client/sliceInitHandle.ts +2 -3
- package/fetch/fetchType/appliedReturn.type.ts +3 -1
- package/fetch/types.ts +4 -2
- package/index.ts +2 -0
- package/package.json +31 -21
- package/server/akanApp.ts +15 -3
- package/server/akanServer.ts +34 -14
- package/server/artifact/routeClientCache.ts +4 -5
- package/server/artifact/routeSeedIndexStore.ts +3 -20
- package/server/artifact/routeSeedMatcher.ts +70 -0
- package/server/console.ts +1 -1
- package/server/di/diLifecycle.ts +16 -7
- package/server/imageOptimizer.ts +1 -1
- package/server/index.ts +1 -0
- package/server/machine/machineAccount.ts +28 -3
- package/server/machine/machineToken.ts +27 -3
- package/server/mcp/McpDispatcher.ts +2 -3
- package/server/mcp/McpExecutionContext.ts +9 -3
- package/server/migration/docPath.ts +121 -0
- package/server/migration/index.ts +15 -0
- package/server/migration/migrationChangeLog.ts +86 -0
- package/server/migration/migrationChanges.ts +70 -0
- package/server/migration/migrationCommand.ts +179 -0
- package/server/migration/migrationContext.ts +53 -0
- package/server/migration/migrationDefinition.ts +87 -0
- package/server/migration/migrationError.ts +45 -0
- package/server/migration/migrationLedger.ts +172 -0
- package/server/migration/migrationLock.ts +103 -0
- package/server/migration/migrationParams.ts +122 -0
- package/server/migration/migrationPulse.ts +39 -0
- package/server/migration/migrationRunner.ts +525 -0
- package/server/migration/migrationScope.ts +93 -0
- package/server/migration/migrationTable.ts +258 -0
- package/server/migration/migrations.ts +57 -0
- package/server/ops/opsCommand.ts +30 -1
- package/server/resolver/CascadeRunner.ts +15 -2
- package/server/resolver/signal.resolver.ts +35 -55
- package/server/routeState.ts +0 -6
- package/server/rscClient.tsx +22 -37
- package/server/rscNavigationState.ts +3 -5
- package/server/rscScrollRestoration.ts +116 -0
- package/server/rscWorker.tsx +12 -19
- package/server/sitemap.ts +4 -4
- package/server/tunnel/TunnelAgent.ts +9 -1
- package/server/webRouter.ts +17 -2
- package/service/agent.service.ts +21 -1
- package/service/endpointCacheKeys.ts +35 -0
- package/service/index.ts +1 -0
- package/service/injectInfo.ts +2 -2
- package/service/predefinedAdaptor/anthropicLlm.ts +37 -17
- package/service/predefinedAdaptor/database.adaptor.ts +15 -0
- package/service/predefinedAdaptor/documentTransfer.ts +50 -0
- package/service/predefinedAdaptor/endpointCacheControl.adaptor.ts +19 -0
- package/service/predefinedAdaptor/index.ts +1 -0
- package/service/predefinedAdaptor/llm.adaptor.ts +7 -0
- package/service/predefinedAdaptor/openaiDialect.ts +53 -17
- package/service/predefinedAdaptor/openaiLlm.ts +1 -1
- package/service/predefinedAdaptor/sql/MigrationTables.ts +90 -0
- package/service/predefinedAdaptor/sql/RawDocumentTable.ts +200 -0
- package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +6 -2
- package/service/predefinedAdaptor/sql/SqliteInsightSession.ts +4 -1
- package/service/predefinedAdaptor/sql/dialect/postgres.ts +0 -1
- package/service/predefinedAdaptor/sql/dialect/sqlite.ts +0 -1
- package/service/predefinedAdaptor/sql/types.ts +3 -1
- package/service/predefinedAdaptor/storage.adaptor.ts +19 -0
- package/signal/endpointCache.ts +23 -7
- package/signal/endpointErrorContract.ts +37 -0
- package/signal/endpointIdempotency.ts +5 -3
- package/signal/endpointInfo.ts +4 -1
- package/signal/endpointRateLimit.ts +6 -2
- package/signal/exception.ts +4 -1
- package/signal/index.ts +1 -0
- package/signal/mcp/McpDocument.ts +16 -1
- package/signal/mcp/McpUriTemplate.ts +1 -1
- package/signal/middlewareChain.ts +105 -0
- package/signal/openapi/openapi.ts +46 -2
- package/signal/serializer/fetch.serializer.ts +1 -0
- package/signal/signalContext.ts +110 -82
- package/signal/slice.ts +2 -2
- package/signal/trace.ts +8 -2
- package/signal/types.ts +13 -0
- package/store/action.ts +102 -42
- package/store/agent/ScreenImage.ts +166 -0
- package/store/agent/ScreenReader.ts +2 -1
- package/store/agent/StoreSurfaceSource.ts +41 -2
- package/store/agent/index.ts +2 -1
- package/store/databaseStateNames.ts +1 -0
- package/store/formUploadOf.ts +41 -0
- package/store/index.ts +1 -0
- package/store/liveInsert.ts +2 -2
- package/store/state.ts +9 -1
- package/store/stateBuilder.ts +8 -2
- package/store/storeInstance.ts +12 -3
- package/store/withSelector.ts +2 -2
- package/types/client/href.d.ts +11 -0
- package/types/client/index.d.ts +1 -0
- package/types/client/rscNavigation.d.ts +1 -1
- package/types/client/transitionTypes.d.ts +0 -2
- package/types/client/translator.d.ts +2 -0
- package/types/common/codeAgentWire.d.ts +7 -0
- package/types/common/index.d.ts +1 -0
- package/types/common/trimSlashes.d.ts +2 -0
- package/types/common/types.d.ts +1 -1
- package/types/constant/fieldInfo.d.ts +2 -2
- package/types/constant/fieldPlan.d.ts +33 -0
- package/types/constant/index.d.ts +3 -0
- package/types/constant/inputParser.d.ts +11 -0
- package/types/constant/invalidInputError.d.ts +8 -0
- package/types/constant/types.d.ts +1 -1
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictionary.d.ts +3 -3
- package/types/dictionary/trans.d.ts +3 -0
- package/types/document/database.d.ts +2 -3
- package/types/document/documentSchema.d.ts +1 -1
- package/types/document/noDocumentError.d.ts +6 -1
- package/types/fetch/fetchType/appliedReturn.type.d.ts +3 -1
- package/types/fetch/types.d.ts +2 -2
- package/types/index.d.ts +5 -0
- package/types/server/akanServer.d.ts +1 -1
- package/types/server/artifact/routeSeedMatcher.d.ts +8 -0
- package/types/server/di/diLifecycle.d.ts +1 -0
- package/types/server/index.d.ts +1 -0
- package/types/server/machine/machineAccount.d.ts +1 -0
- package/types/server/machine/machineToken.d.ts +9 -0
- package/types/server/migration/docPath.d.ts +20 -0
- package/types/server/migration/index.d.ts +15 -0
- package/types/server/migration/migrationChangeLog.d.ts +27 -0
- package/types/server/migration/migrationChanges.d.ts +27 -0
- package/types/server/migration/migrationCommand.d.ts +33 -0
- package/types/server/migration/migrationContext.d.ts +28 -0
- package/types/server/migration/migrationDefinition.d.ts +42 -0
- package/types/server/migration/migrationError.d.ts +15 -0
- package/types/server/migration/migrationLedger.d.ts +51 -0
- package/types/server/migration/migrationLock.d.ts +34 -0
- package/types/server/migration/migrationParams.d.ts +41 -0
- package/types/server/migration/migrationPulse.d.ts +15 -0
- package/types/server/migration/migrationRunner.d.ts +93 -0
- package/types/server/migration/migrationScope.d.ts +42 -0
- package/types/server/migration/migrationTable.d.ts +52 -0
- package/types/server/migration/migrations.d.ts +12 -0
- package/types/server/migration.d.ts +1 -0
- package/types/server/ops/opsCommand.d.ts +10 -1
- package/types/server/routeState.d.ts +1 -4
- package/types/server/rscNavigationState.d.ts +2 -3
- package/types/server/rscScrollRestoration.d.ts +14 -0
- package/types/server/sitemap.d.ts +1 -1
- package/types/service/agent.service.d.ts +2 -0
- package/types/service/endpointCacheKeys.d.ts +8 -0
- package/types/service/index.d.ts +1 -0
- package/types/service/injectInfo.d.ts +2 -2
- package/types/service/predefinedAdaptor/anthropicLlm.d.ts +9 -4
- package/types/service/predefinedAdaptor/database.adaptor.d.ts +8 -1
- package/types/service/predefinedAdaptor/documentTransfer.d.ts +1 -0
- package/types/service/predefinedAdaptor/endpointCacheControl.adaptor.d.ts +9 -0
- package/types/service/predefinedAdaptor/index.d.ts +1 -0
- package/types/service/predefinedAdaptor/llm.adaptor.d.ts +7 -0
- package/types/service/predefinedAdaptor/openaiDialect.d.ts +20 -5
- package/types/service/predefinedAdaptor/sql/MigrationTables.d.ts +17 -0
- package/types/service/predefinedAdaptor/sql/RawDocumentTable.d.ts +38 -0
- package/types/service/predefinedAdaptor/sql/types.d.ts +1 -0
- package/types/service/predefinedAdaptor/storage.adaptor.d.ts +8 -0
- package/types/signal/endpointCache.d.ts +2 -0
- package/types/signal/endpointErrorContract.d.ts +10 -0
- package/types/signal/endpointIdempotency.d.ts +1 -0
- package/types/signal/endpointRateLimit.d.ts +1 -1
- package/types/signal/exception.d.ts +4 -1
- package/types/signal/index.d.ts +1 -0
- package/types/signal/middlewareChain.d.ts +11 -0
- package/types/signal/signalContext.d.ts +2 -6
- package/types/signal/slice.d.ts +1 -1
- package/types/signal/trace.d.ts +1 -1
- package/types/signal/types.d.ts +12 -0
- package/types/store/action.d.ts +2 -0
- package/types/store/agent/ScreenImage.d.ts +27 -0
- package/types/store/agent/StoreSurfaceSource.d.ts +1 -1
- package/types/store/agent/index.d.ts +2 -1
- package/types/store/databaseStateNames.d.ts +1 -0
- package/types/store/formUploadOf.d.ts +9 -0
- package/types/store/index.d.ts +1 -0
- package/types/store/state.d.ts +7 -1
- package/types/store/stateBuilder.d.ts +2 -1
- package/types/store/storeInstance.d.ts +2 -2
- package/types/store/withSelector.d.ts +1 -1
- package/types/ui/Agent/Composer.d.ts +2 -0
- package/types/ui/Agent/Menu.d.ts +2 -0
- package/types/ui/CsrImage.d.ts +2 -0
- package/types/ui/Data/CardList.d.ts +1 -1
- package/types/ui/Data/Dashboard.d.ts +1 -1
- package/types/ui/Data/Insight.d.ts +1 -1
- package/types/ui/Data/Item.d.ts +2 -2
- package/types/ui/Data/ListContainer.d.ts +1 -1
- package/types/ui/Data/Pagination.d.ts +1 -1
- package/types/ui/Data/TableList.d.ts +1 -1
- package/types/ui/Field/Relation.d.ts +13 -10
- package/types/ui/Field/index.d.ts +4 -4
- package/types/ui/Field/useRelationOptions.d.ts +3 -1
- package/types/ui/Field/useRelationWindow.d.ts +14 -0
- package/types/ui/Image.d.ts +3 -1
- package/types/ui/Load/View.d.ts +1 -1
- package/types/ui/Pagination.d.ts +1 -1
- package/types/ui/Signal/Arg.d.ts +1 -1
- package/types/ui/System/CSR.d.ts +1 -1
- package/types/ui/System/Client.d.ts +1 -1
- package/types/ui/System/SSR.d.ts +1 -1
- package/types/vendor/@akanjs/native/packages/core/src/plugin.d.ts +3 -3
- package/types/vendor/@akanjs/native/packages/desktop/src/page-veto.d.ts +1 -1
- package/types/vendor/@akanjs/native/packages/desktop/src/plugin.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/auth-session/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/auth-session/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/autostart/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/autostart/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/badge/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/badge/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/badge/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/biometric/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/camera/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/camera/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/camera/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/clipboard/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/clipboard/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/clipboard/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/contacts/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/device/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/device/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/device/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dialog/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dialog/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dialog/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dock/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dock/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/file-picker/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/file-picker/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/filesystem/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/filesystem/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/haptics/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/haptics/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/http/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/http/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/keep-awake/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/keep-awake/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/keep-awake/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/opener/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/opener/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/opener/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/preferences/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/preferences/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/preferences/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/secure-storage/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/secure-storage/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/share/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/share/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/single-instance/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/splash-screen/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/splash-screen/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/sqlite/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/toast/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/toast/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/window/src/index.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/window-state/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/window-state/src/index.d.ts +1 -1
- package/types/vendor/use-agentic/Compaction.d.ts +3 -1
- package/types/vendor/use-agentic/Reference.d.ts +9 -1
- package/types/vendor/use-agentic/ToolOutput.d.ts +6 -1
- package/types/vendor/use-agentic/ToolReturn.d.ts +18 -0
- package/types/vendor/use-agentic/Transcript.d.ts +7 -0
- package/types/vendor/use-agentic/index.d.ts +1 -0
- package/types/vendor/use-agentic/types.d.ts +6 -0
- package/types/webkit/useDebounce.d.ts +1 -1
- package/ui/Agent/Chat.tsx +1 -0
- package/ui/Agent/Composer.tsx +2 -0
- package/ui/Agent/Menu.tsx +5 -1
- package/ui/Agent/agentSessionOf.ts +15 -8
- package/ui/Agent/mentionDraft.ts +2 -3
- package/ui/Agent/useReferenceMenu.ts +1 -0
- package/ui/Agent/useSlashMenu.ts +1 -0
- package/ui/Clipboard.tsx +1 -0
- package/ui/CsrImage.tsx +3 -1
- package/ui/Data/CardList.tsx +1 -1
- package/ui/Data/Dashboard.tsx +1 -1
- package/ui/Data/Insight.tsx +1 -1
- package/ui/Data/Item.tsx +5 -2
- package/ui/Data/ListContainer.tsx +2 -2
- package/ui/Data/Pagination.tsx +1 -1
- package/ui/Data/TableList.tsx +1 -1
- package/ui/DraggableList.tsx +1 -0
- package/ui/Field/Collection.tsx +4 -0
- package/ui/Field/Relation.tsx +33 -14
- package/ui/Field/useRelationOptions.ts +33 -5
- package/ui/Field/useRelationWindow.ts +50 -0
- package/ui/Image.tsx +4 -4
- package/ui/Input.tsx +1 -0
- package/ui/Layout/Sider.tsx +1 -1
- package/ui/Link/Anchor.tsx +7 -5
- package/ui/Load/Units.tsx +17 -7
- package/ui/Load/View.tsx +2 -2
- package/ui/Model/Edit.tsx +1 -1
- package/ui/Model/EditModal.tsx +11 -5
- package/ui/Model/New.tsx +1 -1
- package/ui/Model/SureToRemove.tsx +1 -0
- package/ui/Model/ViewEditModal.tsx +17 -5
- package/ui/Model/ViewModal.tsx +2 -2
- package/ui/ObjectId.tsx +5 -1
- package/ui/Pagination.tsx +1 -1
- package/ui/Signal/Arg.tsx +1 -3
- package/ui/Signal/Doc.tsx +5 -1
- package/ui/System/CSR.tsx +1 -1
- package/ui/System/Client.tsx +1 -1
- package/ui/System/Reconnect.tsx +1 -1
- package/ui/System/SSR.tsx +3 -36
- package/ui/ToggleSelect.tsx +2 -0
- package/ui/styles.css +10 -103
- package/vendor/@akanjs/native/native/ios/Sources/AkanNativeBridge.swift +3 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/addons.ts +4 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/apk.ts +2 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/codegen.ts +1 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/csp.ts +4 -3
- package/vendor/@akanjs/native/packages/cli/src/lib/googleservices.ts +7 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/hmr.ts +8 -5
- package/vendor/@akanjs/native/packages/cli/src/lib/html.ts +18 -3
- package/vendor/@akanjs/native/packages/cli/src/lib/manifestmerge.ts +1 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/plist.ts +2 -4
- package/vendor/@akanjs/native/packages/cli/src/lib/toolchains.ts +1 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/updates.ts +10 -4
- package/vendor/@akanjs/native/packages/cli/src/lib/xml.ts +4 -3
- package/vendor/@akanjs/native/packages/cli/src/platforms/android.ts +3 -3
- package/vendor/@akanjs/native/packages/core/src/kernel.ts +3 -3
- package/vendor/@akanjs/native/packages/core/src/live.ts +1 -0
- package/vendor/@akanjs/native/packages/core/src/plugin.ts +5 -3
- package/vendor/@akanjs/native/packages/desktop/src/host.ts +13 -5
- package/vendor/@akanjs/native/packages/desktop/src/lifecycle.ts +1 -0
- package/vendor/@akanjs/native/packages/desktop/src/page-veto.ts +1 -1
- package/vendor/@akanjs/native/packages/desktop/src/plugin.ts +4 -1
- package/vendor/@akanjs/native/plugins/camera/src/web.ts +3 -3
- package/vendor/@akanjs/native/plugins/file-picker/src/index.ts +4 -1
- package/vendor/@akanjs/native/plugins/local-notifications/src/web.ts +1 -1
- package/vendor/@akanjs/native/plugins/secure-storage/src/desktop.ts +1 -1
- package/vendor/@akanjs/native/plugins/share/src/options.ts +1 -1
- package/vendor/@akanjs/native/plugins/single-instance/src/desktop.ts +3 -2
- package/vendor/@akanjs/native/plugins/updates/src/desktop.ts +4 -1
- package/vendor/@akanjs/native/plugins/window/src/index.ts +2 -2
- package/vendor/use-agentic/Compaction.ts +38 -7
- package/vendor/use-agentic/Reference.ts +16 -9
- package/vendor/use-agentic/ToolOutput.ts +25 -3
- package/vendor/use-agentic/ToolReturn.ts +32 -0
- package/vendor/use-agentic/ToolRunner.ts +15 -13
- package/vendor/use-agentic/Transcript.ts +38 -2
- package/vendor/use-agentic/WIRE.md +20 -0
- package/vendor/use-agentic/index.ts +1 -0
- package/vendor/use-agentic/types.ts +6 -0
- package/webkit/McpAppAgent.ts +12 -2
- package/webkit/RenderLayer.tsx +23 -4
- package/webkit/useDebounce.ts +23 -14
- package/client/viewTransition.ts +0 -10
- package/types/client/viewTransition.d.ts +0 -3
package/ui/Field/Collection.tsx
CHANGED
|
@@ -50,6 +50,7 @@ export const List = <Item,>({
|
|
|
50
50
|
{renderItem(item, idx)}
|
|
51
51
|
<div className="flex gap-2 border-border border-l pl-2">
|
|
52
52
|
<button
|
|
53
|
+
type="button"
|
|
53
54
|
className={recipe(
|
|
54
55
|
{ variant: "outline", size: "icon" },
|
|
55
56
|
"size-6 border-destructive p-0 text-destructive hover:bg-destructive hover:text-destructive-foreground",
|
|
@@ -66,6 +67,7 @@ export const List = <Item,>({
|
|
|
66
67
|
</Fragment>
|
|
67
68
|
))}
|
|
68
69
|
<button
|
|
70
|
+
type="button"
|
|
69
71
|
className={recipe({ variant: "outline" })}
|
|
70
72
|
onClick={() => {
|
|
71
73
|
onAdd();
|
|
@@ -151,6 +153,7 @@ export const TextList = ({
|
|
|
151
153
|
disabled={disabled}
|
|
152
154
|
/>
|
|
153
155
|
<button
|
|
156
|
+
type="button"
|
|
154
157
|
className={recipe(
|
|
155
158
|
{ variant: "outline", size: "icon" },
|
|
156
159
|
"size-6 border-destructive p-0 text-destructive hover:bg-destructive hover:text-destructive-foreground",
|
|
@@ -169,6 +172,7 @@ export const TextList = ({
|
|
|
169
172
|
<div className="my-5 h-[0.5px] bg-foreground/20" />
|
|
170
173
|
{texts.length < maxlength ? (
|
|
171
174
|
<button
|
|
175
|
+
type="button"
|
|
172
176
|
className={recipe({ variant: "outline" }, "w-full")}
|
|
173
177
|
onClick={() => {
|
|
174
178
|
onChange([...texts, ""]);
|
package/ui/Field/Relation.tsx
CHANGED
|
@@ -24,7 +24,7 @@ const renderRow = <Light extends { id: string }>(
|
|
|
24
24
|
return model ? render(model) : <Unresolved id={id} />;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
interface RelationProps<Light> {
|
|
27
|
+
interface RelationProps<Light, Sort> {
|
|
28
28
|
label?: string;
|
|
29
29
|
desc?: string;
|
|
30
30
|
labelClassName?: string;
|
|
@@ -32,18 +32,21 @@ interface RelationProps<Light> {
|
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
nullable?: boolean;
|
|
34
34
|
initArgs?: any[];
|
|
35
|
-
slice: SliceMeta
|
|
35
|
+
slice: SliceMeta<Sort>;
|
|
36
|
+
/** Either one gives the field its own option window, leaving the slice's list on the page as it is. */
|
|
37
|
+
limit?: number;
|
|
38
|
+
sort?: NoInfer<Sort> & string;
|
|
36
39
|
onSearch?: (text: string) => void;
|
|
37
40
|
sortOption?: (a: Light, b: Light) => number;
|
|
38
41
|
}
|
|
39
|
-
export interface ParentProps<Light> extends RelationProps<Light> {
|
|
42
|
+
export interface ParentProps<Light, Sort = unknown> extends RelationProps<Light, Sort> {
|
|
40
43
|
selectClassName?: string;
|
|
41
44
|
value: Light | null;
|
|
42
45
|
onChange: (value: Light | null) => void;
|
|
43
46
|
renderOption: (model: Light) => ReactNode;
|
|
44
47
|
renderSelected?: (value: Light) => ReactNode;
|
|
45
48
|
}
|
|
46
|
-
export const Parent = <Light extends { id: string }>({
|
|
49
|
+
export const Parent = <Light extends { id: string }, Sort = unknown>({
|
|
47
50
|
label,
|
|
48
51
|
desc,
|
|
49
52
|
labelClassName,
|
|
@@ -52,6 +55,8 @@ export const Parent = <Light extends { id: string }>({
|
|
|
52
55
|
nullable,
|
|
53
56
|
disabled,
|
|
54
57
|
initArgs,
|
|
58
|
+
limit,
|
|
59
|
+
sort,
|
|
55
60
|
slice,
|
|
56
61
|
value,
|
|
57
62
|
onChange,
|
|
@@ -59,12 +64,14 @@ export const Parent = <Light extends { id: string }>({
|
|
|
59
64
|
sortOption,
|
|
60
65
|
renderOption,
|
|
61
66
|
renderSelected = renderOption,
|
|
62
|
-
}: ParentProps<Light>) => {
|
|
67
|
+
}: ParentProps<Light, Sort>) => {
|
|
63
68
|
const { models, options, optionLabel, listLoading, load, read } = useRelationOptions<Light>({
|
|
64
69
|
slice,
|
|
65
70
|
ids: value ? [value.id] : [],
|
|
66
71
|
pinned: [value],
|
|
67
72
|
initArgs,
|
|
73
|
+
limit,
|
|
74
|
+
sort,
|
|
68
75
|
sortOption,
|
|
69
76
|
renderOption,
|
|
70
77
|
});
|
|
@@ -92,14 +99,14 @@ export const Parent = <Light extends { id: string }>({
|
|
|
92
99
|
);
|
|
93
100
|
};
|
|
94
101
|
|
|
95
|
-
export interface ParentIdProps<Light> extends RelationProps<Light> {
|
|
102
|
+
export interface ParentIdProps<Light, Sort = unknown> extends RelationProps<Light, Sort> {
|
|
96
103
|
selectClassName?: string;
|
|
97
104
|
value: string | null;
|
|
98
105
|
onChange: (id: string | null, model: Light | null) => void;
|
|
99
106
|
renderOption?: (model: Light) => ReactNode;
|
|
100
107
|
renderSelected?: (value: Light) => ReactNode;
|
|
101
108
|
}
|
|
102
|
-
export const ParentId = <Light extends { id: string }>({
|
|
109
|
+
export const ParentId = <Light extends { id: string }, Sort = unknown>({
|
|
103
110
|
label,
|
|
104
111
|
desc,
|
|
105
112
|
className,
|
|
@@ -108,6 +115,8 @@ export const ParentId = <Light extends { id: string }>({
|
|
|
108
115
|
nullable,
|
|
109
116
|
disabled,
|
|
110
117
|
initArgs,
|
|
118
|
+
limit,
|
|
119
|
+
sort,
|
|
111
120
|
slice,
|
|
112
121
|
value,
|
|
113
122
|
onChange,
|
|
@@ -115,11 +124,13 @@ export const ParentId = <Light extends { id: string }>({
|
|
|
115
124
|
sortOption,
|
|
116
125
|
renderOption,
|
|
117
126
|
renderSelected = renderOption,
|
|
118
|
-
}: ParentIdProps<Light>) => {
|
|
127
|
+
}: ParentIdProps<Light, Sort>) => {
|
|
119
128
|
const { models, options, optionLabel, listLoading, load } = useRelationOptions<Light>({
|
|
120
129
|
slice,
|
|
121
130
|
ids: value ? [value] : [],
|
|
122
131
|
initArgs,
|
|
132
|
+
limit,
|
|
133
|
+
sort,
|
|
123
134
|
sortOption,
|
|
124
135
|
renderOption,
|
|
125
136
|
});
|
|
@@ -149,14 +160,14 @@ export const ParentId = <Light extends { id: string }>({
|
|
|
149
160
|
);
|
|
150
161
|
};
|
|
151
162
|
|
|
152
|
-
export interface ChildrenProps<Light> extends RelationProps<Light> {
|
|
163
|
+
export interface ChildrenProps<Light, Sort = unknown> extends RelationProps<Light, Sort> {
|
|
153
164
|
selectClassName?: string;
|
|
154
165
|
value: Light[] | null;
|
|
155
166
|
onChange: (value: Light[]) => void;
|
|
156
167
|
renderOption: (model: Light) => ReactNode;
|
|
157
168
|
renderSelected?: (value: Light) => ReactNode;
|
|
158
169
|
}
|
|
159
|
-
export const Children = <Light extends { id: string }>({
|
|
170
|
+
export const Children = <Light extends { id: string }, Sort = unknown>({
|
|
160
171
|
label,
|
|
161
172
|
desc,
|
|
162
173
|
labelClassName,
|
|
@@ -165,6 +176,8 @@ export const Children = <Light extends { id: string }>({
|
|
|
165
176
|
nullable,
|
|
166
177
|
disabled,
|
|
167
178
|
initArgs,
|
|
179
|
+
limit,
|
|
180
|
+
sort,
|
|
168
181
|
slice,
|
|
169
182
|
value,
|
|
170
183
|
onChange,
|
|
@@ -172,12 +185,14 @@ export const Children = <Light extends { id: string }>({
|
|
|
172
185
|
sortOption,
|
|
173
186
|
renderOption,
|
|
174
187
|
renderSelected = renderOption,
|
|
175
|
-
}: ChildrenProps<Light>) => {
|
|
188
|
+
}: ChildrenProps<Light, Sort>) => {
|
|
176
189
|
const { models, options, optionLabel, listLoading, load, read } = useRelationOptions<Light>({
|
|
177
190
|
slice,
|
|
178
191
|
ids: (value ?? []).map((model) => model.id),
|
|
179
192
|
pinned: value ?? [],
|
|
180
193
|
initArgs,
|
|
194
|
+
limit,
|
|
195
|
+
sort,
|
|
181
196
|
sortOption,
|
|
182
197
|
renderOption,
|
|
183
198
|
});
|
|
@@ -206,12 +221,12 @@ export const Children = <Light extends { id: string }>({
|
|
|
206
221
|
);
|
|
207
222
|
};
|
|
208
223
|
|
|
209
|
-
export interface ChildrenIdProps<Light> extends RelationProps<Light> {
|
|
224
|
+
export interface ChildrenIdProps<Light, Sort = unknown> extends RelationProps<Light, Sort> {
|
|
210
225
|
value: string[] | null;
|
|
211
226
|
onChange: (value: string[]) => void;
|
|
212
227
|
renderOption: (model: Light) => ReactNode;
|
|
213
228
|
}
|
|
214
|
-
export const ChildrenId = <Light extends { id: string }>({
|
|
229
|
+
export const ChildrenId = <Light extends { id: string }, Sort = unknown>({
|
|
215
230
|
label,
|
|
216
231
|
desc,
|
|
217
232
|
labelClassName,
|
|
@@ -219,17 +234,21 @@ export const ChildrenId = <Light extends { id: string }>({
|
|
|
219
234
|
nullable,
|
|
220
235
|
disabled,
|
|
221
236
|
initArgs,
|
|
237
|
+
limit,
|
|
238
|
+
sort,
|
|
222
239
|
slice,
|
|
223
240
|
value,
|
|
224
241
|
onChange,
|
|
225
242
|
onSearch,
|
|
226
243
|
sortOption,
|
|
227
244
|
renderOption,
|
|
228
|
-
}: ChildrenIdProps<Light>) => {
|
|
245
|
+
}: ChildrenIdProps<Light, Sort>) => {
|
|
229
246
|
const { models, options, listLoading, load } = useRelationOptions<Light>({
|
|
230
247
|
slice,
|
|
231
248
|
ids: value ?? [],
|
|
232
249
|
initArgs,
|
|
250
|
+
limit,
|
|
251
|
+
sort,
|
|
233
252
|
sortOption,
|
|
234
253
|
renderOption,
|
|
235
254
|
});
|
|
@@ -6,6 +6,7 @@ import type { SliceMeta } from "akanjs/fetch";
|
|
|
6
6
|
import { st } from "akanjs/store";
|
|
7
7
|
import { type ReactNode, useEffect, useMemo, useState } from "react";
|
|
8
8
|
import { LightRefCache } from "./lightRefCache";
|
|
9
|
+
import { useRelationWindow } from "./useRelationWindow";
|
|
9
10
|
|
|
10
11
|
export interface RelationOptionsSource<Light extends { id: string }> {
|
|
11
12
|
slice: SliceMeta;
|
|
@@ -14,6 +15,8 @@ export interface RelationOptionsSource<Light extends { id: string }> {
|
|
|
14
15
|
/** Rows the control was handed outright, which a `Light`-valued field's own value already is. */
|
|
15
16
|
pinned?: (Light | null)[];
|
|
16
17
|
initArgs?: any[];
|
|
18
|
+
limit?: number;
|
|
19
|
+
sort?: string;
|
|
17
20
|
sortOption?: (a: Light, b: Light) => number;
|
|
18
21
|
renderOption?: (model: Light) => ReactNode;
|
|
19
22
|
}
|
|
@@ -34,21 +37,30 @@ export const useRelationOptions = <Light extends { id: string }>({
|
|
|
34
37
|
ids,
|
|
35
38
|
pinned,
|
|
36
39
|
initArgs,
|
|
40
|
+
limit,
|
|
41
|
+
sort,
|
|
37
42
|
sortOption,
|
|
38
43
|
renderOption,
|
|
39
44
|
}: RelationOptionsSource<Light>) => {
|
|
40
|
-
const { refName, sliceName } = slice;
|
|
45
|
+
const { refName, sliceName, argLength } = slice;
|
|
41
46
|
const [modelName, ModelName] = [lowerlize(refName), capitalize(refName)];
|
|
42
47
|
const names = {
|
|
43
48
|
modelList: sliceName.replace(modelName, `${modelName}List`),
|
|
44
49
|
modelListLoading: sliceName.replace(modelName, `${modelName}ListLoading`),
|
|
45
50
|
refreshModel: sliceName.replace(modelName, `refresh${ModelName}`),
|
|
51
|
+
queryArgsOfModel: sliceName.replace(modelName, `queryArgsOf${ModelName}`),
|
|
52
|
+
limitOfModel: sliceName.replace(modelName, `limitOf${ModelName}`),
|
|
53
|
+
sortOfModel: sliceName.replace(modelName, `sortOf${ModelName}`),
|
|
46
54
|
};
|
|
47
55
|
const storeUse = st.use as { [key: string]: () => unknown };
|
|
48
56
|
const storeDo = st.do as unknown as { [key: string]: (...args: any[]) => Promise<void> };
|
|
49
57
|
const storeGet = st.get as unknown as <V>() => { [key: string]: V };
|
|
50
|
-
const
|
|
51
|
-
const
|
|
58
|
+
const storeList = storeUse[names.modelList]() as DataList<Light>;
|
|
59
|
+
const storeListLoading = storeUse[names.modelListLoading]() as boolean;
|
|
60
|
+
const ownWindow = useRelationWindow<Light>(names.modelList, argLength);
|
|
61
|
+
const isWindowed = limit !== undefined || sort !== undefined;
|
|
62
|
+
const sliceList = isWindowed ? ownWindow.list : storeList;
|
|
63
|
+
const listLoading = isWindowed ? ownWindow.loading : storeListLoading;
|
|
52
64
|
const [resolvedCount, setResolvedCount] = useState(0);
|
|
53
65
|
|
|
54
66
|
const held = (pinned ?? []).filter((row): row is Light => !!row);
|
|
@@ -78,6 +90,19 @@ export const useRelationOptions = <Light extends { id: string }>({
|
|
|
78
90
|
return labelOf(cnst?.full, model) ?? model.id;
|
|
79
91
|
};
|
|
80
92
|
const options = useMemo(() => models.map((model) => ({ label: optionLabel(model), value: model.id })), [models]);
|
|
93
|
+
|
|
94
|
+
const windowQuery = () => {
|
|
95
|
+
const state = storeGet<unknown>();
|
|
96
|
+
const args = initArgs ?? [];
|
|
97
|
+
return {
|
|
98
|
+
queryArgs: [
|
|
99
|
+
...args.slice(0, argLength),
|
|
100
|
+
...(state[names.queryArgsOfModel] as unknown[]).slice(args.length, argLength),
|
|
101
|
+
],
|
|
102
|
+
limit: limit ?? (state[names.limitOfModel] as number),
|
|
103
|
+
sort: sort ?? (state[names.sortOfModel] as string),
|
|
104
|
+
};
|
|
105
|
+
};
|
|
81
106
|
|
|
82
107
|
return {
|
|
83
108
|
models,
|
|
@@ -85,11 +110,14 @@ export const useRelationOptions = <Light extends { id: string }>({
|
|
|
85
110
|
optionLabel,
|
|
86
111
|
listLoading,
|
|
87
112
|
|
|
88
|
-
load: () =>
|
|
113
|
+
load: () =>
|
|
114
|
+
isWindowed
|
|
115
|
+
? ownWindow.load(windowQuery())
|
|
116
|
+
: storeDo[names.refreshModel]({ invalidate: false, queryArgs: initArgs }),
|
|
89
117
|
|
|
90
118
|
read: () =>
|
|
91
119
|
merge(
|
|
92
|
-
storeGet<DataList<Light>>()[names.modelList],
|
|
120
|
+
isWindowed ? ownWindow.read() : storeGet<DataList<Light>>()[names.modelList],
|
|
93
121
|
[...held, ...ids.map((id) => LightRefCache.get<Light>(refName, id))],
|
|
94
122
|
sortOption,
|
|
95
123
|
),
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { DataList } from "akanjs/base";
|
|
3
|
+
import { fetch } from "akanjs/client";
|
|
4
|
+
import { isQueryEqual } from "akanjs/common";
|
|
5
|
+
import { useRef, useState } from "react";
|
|
6
|
+
|
|
7
|
+
export interface RelationWindowQuery {
|
|
8
|
+
queryArgs: unknown[];
|
|
9
|
+
limit: number;
|
|
10
|
+
sort: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface WindowHold<Light extends { id: string }> {
|
|
14
|
+
list: DataList<Light>;
|
|
15
|
+
query: RelationWindowQuery | null;
|
|
16
|
+
request: Promise<void> | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const useRelationWindow = <Light extends { id: string }>(listName: string, argLength: number) => {
|
|
20
|
+
const [list, setList] = useState(() => new DataList<Light>());
|
|
21
|
+
const [loading, setLoading] = useState(false);
|
|
22
|
+
const hold = useRef<WindowHold<Light>>({ list, query: null, request: null });
|
|
23
|
+
|
|
24
|
+
const load = (query: RelationWindowQuery) => {
|
|
25
|
+
const current = hold.current;
|
|
26
|
+
if (current.query && current.request && isQueryEqual(current.query, query)) return current.request;
|
|
27
|
+
const listFn = (fetch as unknown as { [key: string]: (...args: unknown[]) => Promise<Light[]> })[listName];
|
|
28
|
+
const args = Array.from({ length: argLength }, (_, idx) => query.queryArgs[idx]);
|
|
29
|
+
setLoading(true);
|
|
30
|
+
const request: Promise<void> = listFn(...args, 0, query.limit, query.sort)
|
|
31
|
+
.then((rows) => {
|
|
32
|
+
if (hold.current.request !== request) return;
|
|
33
|
+
hold.current.list = new DataList(rows);
|
|
34
|
+
setList(hold.current.list);
|
|
35
|
+
})
|
|
36
|
+
.catch((error: unknown) => {
|
|
37
|
+
|
|
38
|
+
if (hold.current.request === request) hold.current.query = null;
|
|
39
|
+
throw error;
|
|
40
|
+
})
|
|
41
|
+
.finally(() => {
|
|
42
|
+
if (hold.current.request === request) setLoading(false);
|
|
43
|
+
});
|
|
44
|
+
hold.current.query = query;
|
|
45
|
+
hold.current.request = request;
|
|
46
|
+
return request;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return { list, loading, load, read: () => hold.current.list };
|
|
50
|
+
};
|
package/ui/Image.tsx
CHANGED
|
@@ -19,7 +19,9 @@ const EMPTY_IMAGE = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAAL
|
|
|
19
19
|
|
|
20
20
|
type NativeImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, "alt" | "src" | "srcSet"> & {
|
|
21
21
|
fill?: boolean;
|
|
22
|
+
/** Accepted for next/image compatibility; an `<img>` has no such attribute, so it draws nothing. */
|
|
22
23
|
placeholder?: string;
|
|
24
|
+
/** Accepted for next/image compatibility; an `<img>` has no such attribute, so it draws nothing. */
|
|
23
25
|
blurDataURL?: string;
|
|
24
26
|
};
|
|
25
27
|
|
|
@@ -27,7 +29,7 @@ type AkanImageProps = NativeImageProps & {
|
|
|
27
29
|
/** Takes precedence over `file.url`. */
|
|
28
30
|
src?: string;
|
|
29
31
|
file?: ImageLikeFile;
|
|
30
|
-
/** Overrides `file.abstractData
|
|
32
|
+
/** Overrides `file.abstractData`, which no render path draws as a placeholder. */
|
|
31
33
|
abstractData?: string | null;
|
|
32
34
|
/** Defaults to "image". */
|
|
33
35
|
alt?: string;
|
|
@@ -63,7 +65,6 @@ export const Image = (
|
|
|
63
65
|
const url = src || file?.url || null;
|
|
64
66
|
const [width, height] = [props.width ?? file?.imageSize[0], props.height ?? file?.imageSize[1]];
|
|
65
67
|
|
|
66
|
-
const blurDataURL = abstractData ?? file?.abstractData;
|
|
67
68
|
const isPriority = Boolean(priority || preload);
|
|
68
69
|
|
|
69
70
|
const optimized = url
|
|
@@ -79,7 +80,7 @@ export const Image = (
|
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
const { fill, ...imgProps } = props;
|
|
83
|
+
const { fill, placeholder, blurDataURL, ...imgProps } = props;
|
|
83
84
|
|
|
84
85
|
return (
|
|
85
86
|
<img
|
|
@@ -93,7 +94,6 @@ export const Image = (
|
|
|
93
94
|
loading={props.loading ?? (isPriority ? "eager" : "lazy")}
|
|
94
95
|
decoding={props.decoding ?? "async"}
|
|
95
96
|
fetchPriority={props.fetchPriority ?? (isPriority ? "high" : undefined)}
|
|
96
|
-
{...(blurDataURL ? { placeholder: "blur", blurDataURL } : {})}
|
|
97
97
|
{...imgProps}
|
|
98
98
|
/>
|
|
99
99
|
);
|
package/ui/Input.tsx
CHANGED
package/ui/Layout/Sider.tsx
CHANGED
|
@@ -127,7 +127,7 @@ export const LeftSider = ({ className, children, open, width, close, onCancel }:
|
|
|
127
127
|
}}
|
|
128
128
|
>
|
|
129
129
|
{close ?? (
|
|
130
|
-
<button className={buttonRecipe({ variant: "ghost", size: "icon" })}>
|
|
130
|
+
<button type="button" className={buttonRecipe({ variant: "ghost", size: "icon" })}>
|
|
131
131
|
<BiX />
|
|
132
132
|
</button>
|
|
133
133
|
)}
|
package/ui/Link/Anchor.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getEnv } from "akanjs/base";
|
|
3
|
-
import { cn, csrLocation, getPathInfo, router, usePage, usePathCtx } from "akanjs/client";
|
|
3
|
+
import { cn, csrLocation, getPathInfo, Href, router, usePage, usePathCtx } from "akanjs/client";
|
|
4
4
|
import { openExternalUrl } from "akanjs/client/native";
|
|
5
5
|
import { Logger } from "akanjs/common";
|
|
6
6
|
import { st } from "akanjs/store";
|
|
@@ -50,10 +50,12 @@ export const CsrLink = ({
|
|
|
50
50
|
onClick={(event) => {
|
|
51
51
|
props.onClick?.(event);
|
|
52
52
|
if (event.defaultPrevented) return;
|
|
53
|
-
const isExternal =
|
|
53
|
+
const isExternal = Href.isExternal(href);
|
|
54
54
|
const url = href.startsWith("#") ? `${csrLocation.pathname}#${hash}` : href;
|
|
55
|
-
if (isExternal)
|
|
56
|
-
|
|
55
|
+
if (isExternal) {
|
|
56
|
+
const target = Href.toExternalUrl(href, document.baseURI);
|
|
57
|
+
void openExternalUrl(target).catch(() => window.open(target, "_blank", "noopener,noreferrer"));
|
|
58
|
+
} else if (replace) router.replace(url, { scrollToTop });
|
|
57
59
|
else router.push(url, { scrollToTop });
|
|
58
60
|
}}
|
|
59
61
|
>
|
|
@@ -78,7 +80,7 @@ export const SsrLink = ({
|
|
|
78
80
|
const { lang } = usePage();
|
|
79
81
|
const pathname = useCurrentPathname();
|
|
80
82
|
const currentPath = getPathInfo(pathname, lang, prefix).path;
|
|
81
|
-
const isExternal =
|
|
83
|
+
const isExternal = Href.isExternal(href);
|
|
82
84
|
const internalPathInfo = getPathInfo(href, lang, prefix);
|
|
83
85
|
const requestHref = getEnv().operationMode === "local" ? internalPathInfo.href : getPathInfo(href, lang, "").href;
|
|
84
86
|
const path = internalPathInfo.path;
|
package/ui/Load/Units.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DataList } from "akanjs/base";
|
|
3
|
-
import { cn, router } from "akanjs/client";
|
|
3
|
+
import { cn, isRscNavigationFromCache, router } from "akanjs/client";
|
|
4
4
|
import { type DynamicRecord, isQueryEqual, lowerlize } from "akanjs/common";
|
|
5
5
|
import type { BaseInsight } from "akanjs/constant";
|
|
6
6
|
import { ConstantRegistry, labelOf, withSharedInstances } from "akanjs/constant";
|
|
@@ -52,7 +52,7 @@ function Render<RefName extends string, Light extends { id: string }>({
|
|
|
52
52
|
noDiv,
|
|
53
53
|
from,
|
|
54
54
|
to,
|
|
55
|
-
loading
|
|
55
|
+
loading = <Loading.Area />,
|
|
56
56
|
empty,
|
|
57
57
|
renderItem,
|
|
58
58
|
renderList,
|
|
@@ -142,9 +142,11 @@ function Render<RefName extends string, Light extends { id: string }>({
|
|
|
142
142
|
}, [initSignature, queryArgsSignature]);
|
|
143
143
|
|
|
144
144
|
useEffect(() => {
|
|
145
|
+
|
|
146
|
+
const seededFromReplay = !loaded && isRscNavigationFromCache();
|
|
145
147
|
const modelStaleAt = storeGet<Date>()[namesOfSlice.modelStaleAt];
|
|
146
148
|
const staleThreshold = Math.max(modelStaleAt.getTime(), staleTime === undefined ? 0 : Date.now() - staleTime);
|
|
147
|
-
if (storeGet<Date>()[namesOfSlice.modelInitAt].getTime() >= staleThreshold) return;
|
|
149
|
+
if (!seededFromReplay && storeGet<Date>()[namesOfSlice.modelInitAt].getTime() >= staleThreshold) return;
|
|
148
150
|
if (storeGet<boolean>()[namesOfSlice.modelListLoading]) return;
|
|
149
151
|
void storeDo[namesOfSlice.refreshModel]({ invalidate: true });
|
|
150
152
|
}, [initSignature]);
|
|
@@ -213,12 +215,11 @@ function Render<RefName extends string, Light extends { id: string }>({
|
|
|
213
215
|
) : typeof renderEmpty === "function" ? (
|
|
214
216
|
renderEmpty()
|
|
215
217
|
) : null}
|
|
216
|
-
{showLoading ?
|
|
218
|
+
{showLoading ? loading : null}
|
|
217
219
|
</>
|
|
218
220
|
);
|
|
219
221
|
else if (!renderItem) throw new Error("renderItem is required");
|
|
220
222
|
|
|
221
|
-
const RenderItem = ({ model, idx }: { model: Light; idx: number }) => renderItem(model, idx);
|
|
222
223
|
return (
|
|
223
224
|
<>
|
|
224
225
|
<ContainerWrapper
|
|
@@ -232,14 +233,16 @@ function Render<RefName extends string, Light extends { id: string }>({
|
|
|
232
233
|
{modelDataList.length
|
|
233
234
|
? (reverse ? [...modelDataList].reverse() : modelDataList)
|
|
234
235
|
.slice(from ?? 0, to ?? modelDataList.length + 1)
|
|
235
|
-
.map((model: Light, idx: number) =>
|
|
236
|
+
.map((model: Light, idx: number) => (
|
|
237
|
+
<RenderItem key={model.id} renderItem={renderItem} model={model} idx={idx} />
|
|
238
|
+
))
|
|
236
239
|
: empty !== undefined
|
|
237
240
|
? empty
|
|
238
241
|
: typeof renderEmpty === "function"
|
|
239
242
|
? renderEmpty()
|
|
240
243
|
: null}
|
|
241
244
|
</ContainerWrapper>
|
|
242
|
-
{showLoading ?
|
|
245
|
+
{showLoading ? loading : null}
|
|
243
246
|
</>
|
|
244
247
|
);
|
|
245
248
|
}
|
|
@@ -286,6 +289,13 @@ export default function Units<RefName extends string, Light extends { id: string
|
|
|
286
289
|
);
|
|
287
290
|
}
|
|
288
291
|
|
|
292
|
+
interface RenderItemProps<Light> {
|
|
293
|
+
renderItem: (item: Light, idx: number) => ReactNode;
|
|
294
|
+
model: Light;
|
|
295
|
+
idx: number;
|
|
296
|
+
}
|
|
297
|
+
const RenderItem = <Light,>({ renderItem, model, idx }: RenderItemProps<Light>) => renderItem(model, idx);
|
|
298
|
+
|
|
289
299
|
interface MoreProps {
|
|
290
300
|
total: number;
|
|
291
301
|
itemsPerPage: number;
|
package/ui/Load/View.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { Empty } from "../Empty";
|
|
|
11
11
|
import { Loading } from "../Loading";
|
|
12
12
|
import Stream from "./Stream";
|
|
13
13
|
|
|
14
|
-
interface DefaultProps<
|
|
14
|
+
interface DefaultProps<_T extends string, M> {
|
|
15
15
|
className?: string;
|
|
16
16
|
/** Renders the model without the default wrapper div. */
|
|
17
17
|
noDiv?: boolean;
|
|
@@ -86,7 +86,7 @@ function Render<T extends string, Full extends { id: string }>({
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
return noDiv && renderModel ? (
|
|
89
|
-
|
|
89
|
+
renderView(renderModel)
|
|
90
90
|
) : renderModel ? (
|
|
91
91
|
<div className={cn("w-full", className)} data-agent-scope={scopePath}>
|
|
92
92
|
{renderView(renderModel)}
|
package/ui/Model/Edit.tsx
CHANGED
|
@@ -24,7 +24,7 @@ export default function Edit({ trigger, children, slice, modelId, modal, renderT
|
|
|
24
24
|
<>
|
|
25
25
|
<EditWrapper className="contents" slice={slice} modelId={modelId} modal={modal} draft={draft}>
|
|
26
26
|
{trigger ?? (
|
|
27
|
-
<button className={buttonRecipe({ variant: "primary" })}>
|
|
27
|
+
<button type="button" className={buttonRecipe({ variant: "primary" })}>
|
|
28
28
|
<AiOutlineEdit /> {l("base.edit")}
|
|
29
29
|
</button>
|
|
30
30
|
)}
|
package/ui/Model/EditModal.tsx
CHANGED
|
@@ -56,7 +56,7 @@ const EditModel = <Full,>({
|
|
|
56
56
|
loadingWrapper,
|
|
57
57
|
cancelEdit,
|
|
58
58
|
}: OpenEditorProps<Full>) => {
|
|
59
|
-
const storeUse = st.use as { [key: string]: () => unknown };
|
|
59
|
+
const storeUse = st.use as { [key: string]: (option?: { agent?: boolean }) => unknown };
|
|
60
60
|
const storeDo = st.do as unknown as { [key: string]: (...args: any[]) => void };
|
|
61
61
|
const { refName } = slice;
|
|
62
62
|
const [modelName, ModelName] = useMemo(() => [lowerlize(refName), capitalize(refName)], []);
|
|
@@ -66,6 +66,7 @@ const EditModel = <Full,>({
|
|
|
66
66
|
Model: ModelName,
|
|
67
67
|
modelForm: `${modelName}Form`,
|
|
68
68
|
modelFormLoading: `${modelName}FormLoading`,
|
|
69
|
+
modelFormUploading: `${modelName}FormUploading`,
|
|
69
70
|
modelModal: `${modelName}Modal`,
|
|
70
71
|
checkModelSubmitable: `check${ModelName}Submitable`,
|
|
71
72
|
}),
|
|
@@ -73,6 +74,8 @@ const EditModel = <Full,>({
|
|
|
73
74
|
);
|
|
74
75
|
const modelModal = storeUse[names.modelModal]() as string | null;
|
|
75
76
|
const modelForm = storeUse[names.modelForm]() as { id: string | null; [key: string]: any };
|
|
77
|
+
|
|
78
|
+
const modelFormUploading = storeUse[names.modelFormUploading]({ agent: false });
|
|
76
79
|
|
|
77
80
|
st.tool(cancelEdit ? `cancelEditOf${ModelName}` : null)
|
|
78
81
|
.desc(`Close the ${modelName} form without saving.`)
|
|
@@ -84,7 +87,7 @@ const EditModel = <Full,>({
|
|
|
84
87
|
|
|
85
88
|
useEffect(() => {
|
|
86
89
|
if (checkSubmit) checkSubmitable();
|
|
87
|
-
}, [modelModal, modelForm]);
|
|
90
|
+
}, [modelModal, modelForm, modelFormUploading]);
|
|
88
91
|
|
|
89
92
|
const LoadingWrapper = useMemo(() => {
|
|
90
93
|
return loadingWrapper === false
|
|
@@ -167,6 +170,7 @@ export default function EditModal<Full extends { id: string }>({
|
|
|
167
170
|
modelFormLoading: `${modelName}FormLoading`,
|
|
168
171
|
modelModal: `${modelName}Modal`,
|
|
169
172
|
modelSubmit: `${modelName}Submit`,
|
|
173
|
+
modelFormUploading: `${modelName}FormUploading`,
|
|
170
174
|
submitModel: `submit${ModelName}`,
|
|
171
175
|
resetModel: `reset${ModelName}`,
|
|
172
176
|
setModelModal: `set${ModelName}Modal`,
|
|
@@ -301,6 +305,9 @@ export default function EditModal<Full extends { id: string }>({
|
|
|
301
305
|
? () => renderSubmit(storeUse[names.modelForm]() as Full)
|
|
302
306
|
: () => {
|
|
303
307
|
const modelSubmit = storeUse[names.modelSubmit]() as Submit;
|
|
308
|
+
const isUploading =
|
|
309
|
+
Object.keys(storeUse[names.modelFormUploading]({ agent: false }) as object).length > 0;
|
|
310
|
+
const isBlocked = modelSubmit.disabled || isUploading || !!disabled;
|
|
304
311
|
const handleSubmit = async ({ onError }: { onError?: (e: string) => void } = {}) => {
|
|
305
312
|
await storeDo[names.submitModel]({
|
|
306
313
|
...submitOption,
|
|
@@ -321,8 +328,7 @@ export default function EditModal<Full extends { id: string }>({
|
|
|
321
328
|
};
|
|
322
329
|
const submitModel = st
|
|
323
330
|
.tool(names.submitModel, {
|
|
324
|
-
guard: () =>
|
|
325
|
-
modelSubmit.disabled || disabled ? `The ${names.model} form is not ready to submit.` : true,
|
|
331
|
+
guard: () => (isBlocked ? `The ${names.model} form is not ready to submit.` : true),
|
|
326
332
|
})
|
|
327
333
|
.desc(`Save the ${names.model} the open form holds.`)
|
|
328
334
|
.exec(() => handleSubmit());
|
|
@@ -330,7 +336,7 @@ export default function EditModal<Full extends { id: string }>({
|
|
|
330
336
|
<Button
|
|
331
337
|
{...agentAttrs(submitModel)}
|
|
332
338
|
className={cn("mt-4 w-full gap-2", submitClassName)}
|
|
333
|
-
disabled={
|
|
339
|
+
disabled={isBlocked}
|
|
334
340
|
onClick={async (e, { onError }) => {
|
|
335
341
|
await handleSubmit({ onError });
|
|
336
342
|
}}
|
package/ui/Model/New.tsx
CHANGED
|
@@ -45,7 +45,7 @@ export default function New({
|
|
|
45
45
|
draft={draft}
|
|
46
46
|
>
|
|
47
47
|
{trigger ?? (
|
|
48
|
-
<button className={buttonRecipe({ variant: "primary" })}>
|
|
48
|
+
<button type="button" className={buttonRecipe({ variant: "primary" })}>
|
|
49
49
|
<AiOutlinePlus /> {l("base.new")}
|
|
50
50
|
</button>
|
|
51
51
|
)}
|
|
@@ -89,6 +89,7 @@ export default function SureToRemove({
|
|
|
89
89
|
bodyClassName="border-destructive"
|
|
90
90
|
action={
|
|
91
91
|
<button
|
|
92
|
+
type="button"
|
|
92
93
|
className={buttonRecipe({ variant: "destructive" }, "w-full")}
|
|
93
94
|
disabled={typeNameToRemove && repeatName !== name}
|
|
94
95
|
onClick={async () => {
|