@agent-native/core 0.124.2 → 0.124.4
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/README.md +1 -1
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +16 -0
- package/corpus/core/docs/content/cloneable-saas.mdx +9 -9
- package/corpus/core/docs/content/creating-templates.mdx +2 -2
- package/corpus/core/docs/content/deployment.mdx +23 -0
- package/corpus/core/docs/content/faq.mdx +4 -4
- package/corpus/core/docs/content/key-concepts.mdx +1 -1
- package/corpus/core/docs/content/multi-app-workspace.mdx +1 -1
- package/corpus/core/docs/content/syncing-template-changes.mdx +1 -1
- package/corpus/core/docs/content/template-analytics-developers.mdx +2 -2
- package/corpus/core/docs/content/template-analytics.mdx +2 -2
- package/corpus/core/docs/content/template-assets-developers.mdx +3 -3
- package/corpus/core/docs/content/template-assets.mdx +2 -2
- package/corpus/core/docs/content/template-brain-developers.mdx +2 -2
- package/corpus/core/docs/content/template-brain.mdx +1 -1
- package/corpus/core/docs/content/template-calendar-developers.mdx +1 -1
- package/corpus/core/docs/content/template-calendar.mdx +1 -1
- package/corpus/core/docs/content/template-chat.mdx +1 -1
- package/corpus/core/docs/content/template-clips-developers.mdx +4 -4
- package/corpus/core/docs/content/template-clips.mdx +2 -2
- package/corpus/core/docs/content/template-content-developers.mdx +2 -2
- package/corpus/core/docs/content/template-content.mdx +1 -1
- package/corpus/core/docs/content/template-design-brand-and-figma.mdx +1 -1
- package/corpus/core/docs/content/template-design-developers.mdx +2 -2
- package/corpus/core/docs/content/template-design.mdx +2 -2
- package/corpus/core/docs/content/template-dispatch-developers.mdx +5 -5
- package/corpus/core/docs/content/template-forms-developers.mdx +1 -1
- package/corpus/core/docs/content/template-forms.mdx +1 -1
- package/corpus/core/docs/content/template-mail-developers.mdx +2 -2
- package/corpus/core/docs/content/template-mail.mdx +2 -2
- package/corpus/core/docs/content/template-plan-developers.mdx +3 -3
- package/corpus/core/docs/content/template-plan.mdx +3 -3
- package/corpus/core/docs/content/template-slides-developers.mdx +4 -4
- package/corpus/core/docs/content/template-slides.mdx +1 -1
- package/corpus/core/docs/content/what-is-agent-native.mdx +5 -5
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/auth-policy.ts +1 -1
- package/corpus/core/src/agent/production-agent.ts +14 -1
- package/corpus/core/src/agent/run-manager.ts +6 -13
- package/corpus/core/src/cli/index.ts +11 -1
- package/corpus/core/src/client/route-chunk-recovery.ts +18 -7
- package/corpus/core/src/db/client.ts +7 -6
- package/corpus/core/src/db/migrations.ts +2 -1
- package/corpus/core/src/deploy/build.ts +290 -4
- package/corpus/core/src/deploy/nitro-preset.ts +50 -0
- package/corpus/core/src/integrations/pending-tasks-retry-job.ts +2 -1
- package/corpus/core/src/scripts/call-agent.ts +4 -2
- package/corpus/core/src/server/agent-discovery.ts +1 -0
- package/corpus/core/src/server/agent-run-context.ts +13 -3
- package/corpus/core/src/server/request-context.ts +2 -0
- package/corpus/core/src/shared/cloudflare-globals.d.ts +2 -1
- package/corpus/core/src/shared/runtime.ts +2 -0
- package/corpus/core/src/shared/streaming-text-smoothing.ts +15 -14
- package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +29 -0
- package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/de-DE.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/es-ES.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +6 -6
- package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +29 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +29 -0
- package/corpus/core/src/vite/client.ts +20 -1
- package/corpus/templates/analytics/actions/restore-dashboard-revision.ts +9 -2
- package/corpus/templates/analytics/app/components/dashboard/DashboardHistoryPanel.tsx +3 -0
- package/corpus/templates/analytics/app/components/dashboard/DashboardPanelSkeleton.tsx +1 -1
- package/corpus/templates/analytics/app/global.css +10 -9
- package/corpus/templates/analytics/app/hooks/use-chart-tooltip-portal.ts +59 -18
- package/corpus/templates/analytics/app/hooks/use-dashboard-revisions.ts +14 -2
- package/corpus/templates/analytics/app/i18n-data.ts +102 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +232 -2
- package/corpus/templates/analytics/changelog/2026-07-27-chart-tooltips-stay-beside-the-cursor-when-they-extend-beyon.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-27-chat-no-longer-claims-a-data-source-is-disconnected-when-it-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-27-dashboard-changes-can-be-undone-with-cmd-z-and-actions-menu.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-27-dashboard-redo-with-cmd-shift-z-and-actions-menu.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-27-dashboard-skeletons-are-subtler-and-smoother.md +6 -0
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +61 -20
- package/corpus/templates/analytics/server/lib/real-data-actions.ts +1 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +7 -3
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +7 -32
- package/corpus/templates/calendar/changelog/2026-07-27-calendar-s-sidebar-now-uses-a-cleaner-layout-with-fewer-util.md +6 -0
- package/corpus/templates/content/app/components/editor/database/sidebar.tsx +14 -6
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +32 -37
- package/corpus/templates/content/changelog/2026-07-27-content-sidebar-page-lists-now-load-with-quiet-skeletons-and.md +6 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +34 -11
- package/corpus/templates/design/.agents/skills/responsive-breakpoints/SKILL.md +8 -0
- package/corpus/templates/design/actions/generate-design.ts +259 -36
- package/corpus/templates/design/actions/generate-screens.ts +51 -14
- package/corpus/templates/design/actions/present-design-variants.ts +6 -3
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +8 -0
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +158 -9
- package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +124 -0
- package/corpus/templates/design/app/components/design/multi-screen/frame-geometry.ts +61 -9
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +16 -18
- package/corpus/templates/design/changelog/2026-07-24-ai-designs-now-default-to-a-full-size-desktop-mobile-pair-fr.md +6 -0
- package/corpus/templates/design/changelog/2026-07-24-design-frames-now-fill-the-viewport-height-and-grow-to-fit-t.md +6 -0
- package/corpus/templates/design/changelog/2026-07-24-generating-an-additional-screen-now-places-it-beside-the-exi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-27-collapsed-sidebar-keeps-the-agent-native-logo.md +6 -0
- package/corpus/templates/dispatch/AGENTS.md +7 -2
- package/corpus/templates/dispatch/actions/view-screen.ts +3 -2
- package/corpus/templates/dispatch/changelog/2026-07-17-curated-template-remixes.md +1 -1
- package/corpus/templates/dispatch/changelog/2026-07-27-creating-an-app-from-a-curated-template-now-uses-clearer-mor.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-27-thread-debug-accepts-request-run-ids.md +6 -0
- package/corpus/templates/slides/actions/create-design-system.ts +10 -2
- package/corpus/templates/slides/actions/import-file.ts +173 -1
- package/corpus/templates/slides/actions/list-slide-comments.ts +16 -1
- package/corpus/templates/slides/actions/update-design-system.ts +13 -2
- package/corpus/templates/slides/app/components/editor/AssetLibraryPanel.tsx +35 -12
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +36 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +3 -0
- package/corpus/templates/slides/app/lib/dynamic-import.ts +63 -0
- package/corpus/templates/slides/app/lib/export-pdf-client.ts +3 -2
- package/corpus/templates/slides/app/lib/export-pptx-client.ts +5 -2
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +9 -1
- package/corpus/templates/slides/server/db/schema.ts +11 -0
- package/corpus/templates/slides/server/handlers/assets.ts +64 -19
- package/corpus/templates/slides/server/handlers/import/html-converter.ts +38 -0
- package/corpus/templates/slides/server/plugins/db.ts +20 -0
- package/corpus/templates/slides/shared/design-system-validation.ts +62 -0
- package/dist/a2a/auth-policy.js +1 -1
- package/dist/a2a/auth-policy.js.map +1 -1
- package/dist/agent/production-agent.d.ts +1 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +12 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +2 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +4 -10
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/cli/index.js +8 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/client/route-chunk-recovery.d.ts.map +1 -1
- package/dist/client/route-chunk-recovery.js +16 -7
- package/dist/client/route-chunk-recovery.js.map +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +4 -2
- package/dist/db/client.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +2 -1
- package/dist/db/migrations.js.map +1 -1
- package/dist/deploy/build.d.ts +25 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +227 -4
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/nitro-preset.d.ts +8 -0
- package/dist/deploy/nitro-preset.d.ts.map +1 -0
- package/dist/deploy/nitro-preset.js +36 -0
- package/dist/deploy/nitro-preset.js.map +1 -0
- package/dist/integrations/pending-tasks-retry-job.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-retry-job.js +2 -1
- package/dist/integrations/pending-tasks-retry-job.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +11 -11
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +4 -2
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +1 -0
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/agent-run-context.d.ts.map +1 -1
- package/dist/server/agent-run-context.js +10 -3
- package/dist/server/agent-run-context.js.map +1 -1
- package/dist/server/request-context.d.ts +2 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/runtime.d.ts.map +1 -1
- package/dist/shared/runtime.js +2 -0
- package/dist/shared/runtime.js.map +1 -1
- package/dist/shared/streaming-text-smoothing.d.ts.map +1 -1
- package/dist/shared/streaming-text-smoothing.js +15 -8
- package/dist/shared/streaming-text-smoothing.js.map +1 -1
- package/dist/templates/default/.agents/skills/secrets/SKILL.md +29 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +6 -6
- package/dist/templates/default/app/i18n/de-DE.ts +6 -6
- package/dist/templates/default/app/i18n/en-US.ts +6 -6
- package/dist/templates/default/app/i18n/es-ES.ts +6 -6
- package/dist/templates/default/app/i18n/fr-FR.ts +6 -6
- package/dist/templates/default/app/i18n/hi-IN.ts +6 -6
- package/dist/templates/default/app/i18n/ja-JP.ts +6 -6
- package/dist/templates/default/app/i18n/ko-KR.ts +6 -6
- package/dist/templates/default/app/i18n/pt-BR.ts +6 -6
- package/dist/templates/default/app/i18n/zh-CN.ts +6 -6
- package/dist/templates/default/app/i18n/zh-TW.ts +6 -6
- package/dist/templates/headless/.agents/skills/secrets/SKILL.md +29 -0
- package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +29 -0
- package/dist/vite/client.d.ts +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +16 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/cloneable-saas.mdx +9 -9
- package/docs/content/creating-templates.mdx +2 -2
- package/docs/content/deployment.mdx +23 -0
- package/docs/content/faq.mdx +4 -4
- package/docs/content/key-concepts.mdx +1 -1
- package/docs/content/multi-app-workspace.mdx +1 -1
- package/docs/content/syncing-template-changes.mdx +1 -1
- package/docs/content/template-analytics-developers.mdx +2 -2
- package/docs/content/template-analytics.mdx +2 -2
- package/docs/content/template-assets-developers.mdx +3 -3
- package/docs/content/template-assets.mdx +2 -2
- package/docs/content/template-brain-developers.mdx +2 -2
- package/docs/content/template-brain.mdx +1 -1
- package/docs/content/template-calendar-developers.mdx +1 -1
- package/docs/content/template-calendar.mdx +1 -1
- package/docs/content/template-chat.mdx +1 -1
- package/docs/content/template-clips-developers.mdx +4 -4
- package/docs/content/template-clips.mdx +2 -2
- package/docs/content/template-content-developers.mdx +2 -2
- package/docs/content/template-content.mdx +1 -1
- package/docs/content/template-design-brand-and-figma.mdx +1 -1
- package/docs/content/template-design-developers.mdx +2 -2
- package/docs/content/template-design.mdx +2 -2
- package/docs/content/template-dispatch-developers.mdx +5 -5
- package/docs/content/template-forms-developers.mdx +1 -1
- package/docs/content/template-forms.mdx +1 -1
- package/docs/content/template-mail-developers.mdx +2 -2
- package/docs/content/template-mail.mdx +2 -2
- package/docs/content/template-plan-developers.mdx +3 -3
- package/docs/content/template-plan.mdx +3 -3
- package/docs/content/template-slides-developers.mdx +4 -4
- package/docs/content/template-slides.mdx +1 -1
- package/docs/content/what-is-agent-native.mdx +5 -5
- package/package.json +1 -1
- package/src/a2a/auth-policy.ts +1 -1
- package/src/agent/production-agent.ts +14 -1
- package/src/agent/run-manager.ts +6 -13
- package/src/cli/index.ts +11 -1
- package/src/client/route-chunk-recovery.ts +18 -7
- package/src/db/client.ts +7 -6
- package/src/db/migrations.ts +2 -1
- package/src/deploy/build.ts +290 -4
- package/src/deploy/nitro-preset.ts +50 -0
- package/src/integrations/pending-tasks-retry-job.ts +2 -1
- package/src/scripts/call-agent.ts +4 -2
- package/src/server/agent-discovery.ts +1 -0
- package/src/server/agent-run-context.ts +13 -3
- package/src/server/request-context.ts +2 -0
- package/src/shared/cloudflare-globals.d.ts +2 -1
- package/src/shared/runtime.ts +2 -0
- package/src/shared/streaming-text-smoothing.ts +15 -14
- package/src/templates/default/.agents/skills/secrets/SKILL.md +29 -0
- package/src/templates/default/app/i18n/ar-SA.ts +6 -6
- package/src/templates/default/app/i18n/de-DE.ts +6 -6
- package/src/templates/default/app/i18n/en-US.ts +6 -6
- package/src/templates/default/app/i18n/es-ES.ts +6 -6
- package/src/templates/default/app/i18n/fr-FR.ts +6 -6
- package/src/templates/default/app/i18n/hi-IN.ts +6 -6
- package/src/templates/default/app/i18n/ja-JP.ts +6 -6
- package/src/templates/default/app/i18n/ko-KR.ts +6 -6
- package/src/templates/default/app/i18n/pt-BR.ts +6 -6
- package/src/templates/default/app/i18n/zh-CN.ts +6 -6
- package/src/templates/default/app/i18n/zh-TW.ts +6 -6
- package/src/templates/headless/.agents/skills/secrets/SKILL.md +29 -0
- package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +29 -0
- package/src/vite/client.ts +20 -1
- /package/corpus/templates/slides/server/routes/api/assets/{[filename].delete.ts → [id].delete.ts} +0 -0
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
parsePendingEntry,
|
|
23
23
|
} from "../changelog/parse.js";
|
|
24
24
|
import { getViteDevRecoveryScript } from "../client/vite-dev-recovery-script.js";
|
|
25
|
+
import { writeAgentNativeNitroPresetMarker } from "../deploy/nitro-preset.js";
|
|
25
26
|
import { findWorkspaceRoot } from "../scripts/utils.js";
|
|
26
27
|
import { verifyEmbedSessionToken } from "../server/embed-session.js";
|
|
27
28
|
import {
|
|
@@ -1387,7 +1388,7 @@ function getCoreSourceAliases(
|
|
|
1387
1388
|
}
|
|
1388
1389
|
|
|
1389
1390
|
export interface NitroOptions {
|
|
1390
|
-
/** Nitro deployment preset (e.g. "node", "vercel", "netlify", "cloudflare_pages"). Default: "node" */
|
|
1391
|
+
/** Nitro deployment preset (e.g. "node", "vercel", "netlify", "cloudflare_pages", "cloudflare_module"). Default: "node" */
|
|
1391
1392
|
preset?: string;
|
|
1392
1393
|
/** Source directory for server files. Default: "./server" */
|
|
1393
1394
|
srcDir?: string;
|
|
@@ -2964,6 +2965,22 @@ function forceServeOnly(pluginOrPreset: any): any {
|
|
|
2964
2965
|
return { ...pluginOrPreset, apply: "serve" };
|
|
2965
2966
|
}
|
|
2966
2967
|
|
|
2968
|
+
function nitroPresetMarkerPlugin(
|
|
2969
|
+
options: ClientConfigOptions | AgentNativeVitePluginOptions,
|
|
2970
|
+
): Plugin | null {
|
|
2971
|
+
const preset = options.nitro?.preset;
|
|
2972
|
+
if (typeof preset !== "string" || !preset.trim()) return null;
|
|
2973
|
+
|
|
2974
|
+
return {
|
|
2975
|
+
name: "agent-native-nitro-preset-marker",
|
|
2976
|
+
configResolved(config) {
|
|
2977
|
+
if (config.command === "build") {
|
|
2978
|
+
writeAgentNativeNitroPresetMarker(preset);
|
|
2979
|
+
}
|
|
2980
|
+
},
|
|
2981
|
+
};
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2967
2984
|
function createAgentNativePlugins(
|
|
2968
2985
|
options: ClientConfigOptions | AgentNativeVitePluginOptions,
|
|
2969
2986
|
{
|
|
@@ -2981,8 +2998,10 @@ function createAgentNativePlugins(
|
|
|
2981
2998
|
const { appBasePath } = getConfiguredAppBasePath();
|
|
2982
2999
|
const nitroPlugin = createNitroDevPlugin(options, appBasePath);
|
|
2983
3000
|
const includeNitro = !isBuildCommand(command);
|
|
3001
|
+
const presetMarkerPlugin = nitroPresetMarkerPlugin(options);
|
|
2984
3002
|
|
|
2985
3003
|
return [
|
|
3004
|
+
presetMarkerPlugin,
|
|
2986
3005
|
// Stub packages from `options.ssrStubs` in the SSR bundle so they
|
|
2987
3006
|
// don't bloat the edge worker. Opt-in per template — the framework
|
|
2988
3007
|
// hardcodes nothing (e.g. docs sites legitimately import `shiki` on
|
|
@@ -43,25 +43,32 @@ export default defineAction({
|
|
|
43
43
|
schema: z.object({
|
|
44
44
|
dashboardId: z.string().describe("Dashboard id to restore"),
|
|
45
45
|
revisionId: z.string().describe("Revision id to restore"),
|
|
46
|
+
expectedUpdatedAt: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("The dashboard updatedAt value observed before this restore"),
|
|
46
50
|
}),
|
|
47
51
|
http: { method: "POST" },
|
|
48
52
|
run: async (args) => {
|
|
49
|
-
const
|
|
53
|
+
const restored = await restoreDashboardRevision(
|
|
50
54
|
args.dashboardId,
|
|
51
55
|
args.revisionId,
|
|
52
56
|
resolveScope(),
|
|
57
|
+
args.expectedUpdatedAt,
|
|
53
58
|
);
|
|
54
|
-
if (!
|
|
59
|
+
if (!restored) {
|
|
55
60
|
throw new Error(
|
|
56
61
|
`Dashboard revision "${args.revisionId}" was not found for dashboard "${args.dashboardId}".`,
|
|
57
62
|
);
|
|
58
63
|
}
|
|
64
|
+
const { dashboard, snapshotRevisionId } = restored;
|
|
59
65
|
await syncToCollab(dashboard.id, dashboard.config);
|
|
60
66
|
return {
|
|
61
67
|
id: dashboard.id,
|
|
62
68
|
kind: dashboard.kind,
|
|
63
69
|
name: dashboard.title,
|
|
64
70
|
updatedAt: dashboard.updatedAt,
|
|
71
|
+
snapshotRevisionId,
|
|
65
72
|
message: `Restored dashboard "${dashboard.title}" from history.`,
|
|
66
73
|
};
|
|
67
74
|
},
|
|
@@ -47,6 +47,7 @@ interface DashboardHistoryPanelProps {
|
|
|
47
47
|
open: boolean;
|
|
48
48
|
onOpenChange: (open: boolean) => void;
|
|
49
49
|
canRestore?: boolean;
|
|
50
|
+
onRestored?: () => void;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export function DashboardHistoryPanel({
|
|
@@ -54,6 +55,7 @@ export function DashboardHistoryPanel({
|
|
|
54
55
|
open,
|
|
55
56
|
onOpenChange,
|
|
56
57
|
canRestore = true,
|
|
58
|
+
onRestored,
|
|
57
59
|
}: DashboardHistoryPanelProps) {
|
|
58
60
|
const t = useT();
|
|
59
61
|
const { data: revisions, isLoading } = useDashboardRevisions(
|
|
@@ -70,6 +72,7 @@ export function DashboardHistoryPanel({
|
|
|
70
72
|
revisionId: revision.id,
|
|
71
73
|
});
|
|
72
74
|
toast.success(t("dashboard.historyRestored"));
|
|
75
|
+
onRestored?.();
|
|
73
76
|
setPendingRestore(null);
|
|
74
77
|
onOpenChange(false);
|
|
75
78
|
} catch {
|
|
@@ -139,25 +139,26 @@
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
.dashboard-panel-skeleton {
|
|
142
|
-
background-color: hsl(var(--muted-foreground) / 0.
|
|
142
|
+
background-color: hsl(var(--muted-foreground) / 0.14);
|
|
143
143
|
background-image: linear-gradient(
|
|
144
144
|
105deg,
|
|
145
|
-
transparent
|
|
146
|
-
hsl(var(--foreground) / 0.
|
|
147
|
-
hsl(var(--foreground) / 0.
|
|
148
|
-
hsl(var(--foreground) / 0.
|
|
149
|
-
transparent
|
|
145
|
+
transparent 28%,
|
|
146
|
+
hsl(var(--foreground) / 0.025) 44%,
|
|
147
|
+
hsl(var(--foreground) / 0.06) 50%,
|
|
148
|
+
hsl(var(--foreground) / 0.025) 56%,
|
|
149
|
+
transparent 72%
|
|
150
150
|
);
|
|
151
151
|
background-size: 220% 100%;
|
|
152
|
-
animation: dashboard-panel-skeleton-shimmer
|
|
152
|
+
animation: dashboard-panel-skeleton-shimmer 2.4s ease-in-out infinite;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
@keyframes dashboard-panel-skeleton-shimmer {
|
|
156
|
-
|
|
156
|
+
0%,
|
|
157
|
+
100% {
|
|
157
158
|
background-position: 120% 0;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
|
-
|
|
161
|
+
50% {
|
|
161
162
|
background-position: -120% 0;
|
|
162
163
|
}
|
|
163
164
|
}
|
|
@@ -1,9 +1,48 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef } from "react";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const VIEWPORT_EDGE_PADDING = 8;
|
|
4
4
|
const CURSOR_OFFSET = 14;
|
|
5
5
|
|
|
6
6
|
type TooltipCoordinate = { x?: number; y?: number } | undefined;
|
|
7
|
+
type Rect = { left: number; right: number; top: number; bottom: number };
|
|
8
|
+
type Size = { width: number; height: number };
|
|
9
|
+
|
|
10
|
+
export function getChartTooltipPortalPosition({
|
|
11
|
+
chartRect,
|
|
12
|
+
coordinate,
|
|
13
|
+
tooltipSize,
|
|
14
|
+
viewport,
|
|
15
|
+
}: {
|
|
16
|
+
chartRect: Rect;
|
|
17
|
+
coordinate: TooltipCoordinate;
|
|
18
|
+
tooltipSize: Size;
|
|
19
|
+
viewport: { width: number; height: number; right?: number };
|
|
20
|
+
}) {
|
|
21
|
+
const pointX = chartRect.left + (coordinate?.x ?? 0);
|
|
22
|
+
const pointY = chartRect.top + (coordinate?.y ?? 0);
|
|
23
|
+
const minLeft = VIEWPORT_EDGE_PADDING;
|
|
24
|
+
const maxLeft = Math.max(
|
|
25
|
+
minLeft,
|
|
26
|
+
(viewport.right ?? viewport.width) -
|
|
27
|
+
VIEWPORT_EDGE_PADDING -
|
|
28
|
+
tooltipSize.width,
|
|
29
|
+
);
|
|
30
|
+
let left = pointX + CURSOR_OFFSET;
|
|
31
|
+
if (left > maxLeft) left = pointX - CURSOR_OFFSET - tooltipSize.width;
|
|
32
|
+
left = Math.min(Math.max(left, minLeft), maxLeft);
|
|
33
|
+
|
|
34
|
+
const minTop = VIEWPORT_EDGE_PADDING;
|
|
35
|
+
const maxTop = Math.max(
|
|
36
|
+
minTop,
|
|
37
|
+
viewport.height - VIEWPORT_EDGE_PADDING - tooltipSize.height,
|
|
38
|
+
);
|
|
39
|
+
const top = Math.min(
|
|
40
|
+
Math.max(pointY - tooltipSize.height / 2, minTop),
|
|
41
|
+
maxTop,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return { left, top };
|
|
45
|
+
}
|
|
7
46
|
|
|
8
47
|
/**
|
|
9
48
|
* Ancestors of a dashboard chart (the scrollable app shell, the dashboard
|
|
@@ -15,8 +54,9 @@ type TooltipCoordinate = { x?: number; y?: number } | undefined;
|
|
|
15
54
|
* position off it. Instead, position the portaled box ourselves from the
|
|
16
55
|
* `coordinate` Recharts already passes to custom tooltip content (the exact
|
|
17
56
|
* pixel the cursor is over, relative to the chart) plus the chart's own
|
|
18
|
-
* `.recharts-wrapper` rect
|
|
19
|
-
*
|
|
57
|
+
* `.recharts-wrapper` rect. The chart rect is only the coordinate origin:
|
|
58
|
+
* the tooltip is constrained to the viewport so it can escape the chart and
|
|
59
|
+
* stay beside the cursor instead of covering it.
|
|
20
60
|
*/
|
|
21
61
|
export function useChartTooltipPortalPosition(
|
|
22
62
|
isVisible: boolean,
|
|
@@ -36,21 +76,22 @@ export function useChartTooltipPortalPosition(
|
|
|
36
76
|
const chartRect = chartEl.getBoundingClientRect();
|
|
37
77
|
const boxRect = box.getBoundingClientRect();
|
|
38
78
|
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
79
|
+
const sidebar = document.querySelector<HTMLElement>(".agent-sidebar-panel");
|
|
80
|
+
const sidebarRect = sidebar?.getBoundingClientRect();
|
|
81
|
+
const sidebarLeft =
|
|
82
|
+
sidebarRect && sidebarRect.width > 0 && sidebarRect.left > 0
|
|
83
|
+
? sidebarRect.left
|
|
84
|
+
: window.innerWidth;
|
|
85
|
+
const { left, top } = getChartTooltipPortalPosition({
|
|
86
|
+
chartRect,
|
|
87
|
+
coordinate,
|
|
88
|
+
tooltipSize: boxRect,
|
|
89
|
+
viewport: {
|
|
90
|
+
width: window.innerWidth,
|
|
91
|
+
height: window.innerHeight,
|
|
92
|
+
right: sidebarLeft,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
54
95
|
|
|
55
96
|
box.style.left = `${left}px`;
|
|
56
97
|
box.style.top = `${top}px`;
|
|
@@ -31,8 +31,17 @@ export function useDashboardRevisions(dashboardId: string | null) {
|
|
|
31
31
|
export function useRestoreDashboardRevision(dashboardId: string) {
|
|
32
32
|
const queryClient = useQueryClient();
|
|
33
33
|
return useActionMutation<
|
|
34
|
-
{
|
|
35
|
-
|
|
34
|
+
{
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
snapshotRevisionId: string;
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
dashboardId: string;
|
|
42
|
+
revisionId: string;
|
|
43
|
+
expectedUpdatedAt?: string;
|
|
44
|
+
}
|
|
36
45
|
>("restore-dashboard-revision", {
|
|
37
46
|
onSuccess: () => {
|
|
38
47
|
queryClient.invalidateQueries({
|
|
@@ -41,6 +50,9 @@ export function useRestoreDashboardRevision(dashboardId: string) {
|
|
|
41
50
|
queryClient.invalidateQueries({
|
|
42
51
|
queryKey: ["dashboard", dashboardId],
|
|
43
52
|
});
|
|
53
|
+
queryClient.invalidateQueries({
|
|
54
|
+
queryKey: ["data", "sql-dashboard", dashboardId],
|
|
55
|
+
});
|
|
44
56
|
},
|
|
45
57
|
});
|
|
46
58
|
}
|
|
@@ -46,6 +46,14 @@ const enUS = {
|
|
|
46
46
|
historyRestoreQuestion: "Restore this dashboard version?",
|
|
47
47
|
historyRestoreWarning:
|
|
48
48
|
"This replaces the current dashboard layout and saves the current state in history.",
|
|
49
|
+
undo: "Undo",
|
|
50
|
+
undoSuccess: "Dashboard change undone",
|
|
51
|
+
undoFailed: "Couldn't undo dashboard change",
|
|
52
|
+
undoFailedWithMessage: "Couldn't undo dashboard change: {{message}}",
|
|
53
|
+
redo: "Redo",
|
|
54
|
+
redoSuccess: "Dashboard change redone",
|
|
55
|
+
redoFailed: "Couldn't redo dashboard change",
|
|
56
|
+
redoFailedWithMessage: "Couldn't redo dashboard change: {{message}}",
|
|
49
57
|
panelSettings: "Panel settings",
|
|
50
58
|
revenueOverTime: "Revenue over time",
|
|
51
59
|
recentSales: "Recent Sales",
|
|
@@ -11772,6 +11780,14 @@ const translatedHistoryTranslations = {
|
|
|
11772
11780
|
historyRestoreQuestion: "要還原此儀表板版本嗎?",
|
|
11773
11781
|
historyRestoreWarning:
|
|
11774
11782
|
"這會取代目前的儀表板版面,並將目前狀態保存到歷史記錄。",
|
|
11783
|
+
undo: "復原",
|
|
11784
|
+
undoSuccess: "已復原儀表板變更",
|
|
11785
|
+
undoFailed: "無法復原儀表板變更",
|
|
11786
|
+
undoFailedWithMessage: "無法復原儀表板變更:{{message}}",
|
|
11787
|
+
redo: "重做",
|
|
11788
|
+
redoSuccess: "已重做儀表板變更",
|
|
11789
|
+
redoFailed: "無法重做儀表板變更",
|
|
11790
|
+
redoFailedWithMessage: "無法重做儀表板變更:{{message}}",
|
|
11775
11791
|
},
|
|
11776
11792
|
analyses: {
|
|
11777
11793
|
historyTitle: "分析歷史記錄",
|
|
@@ -11801,6 +11817,14 @@ const translatedHistoryTranslations = {
|
|
|
11801
11817
|
historyRestoreQuestion: "要还原此仪表板版本吗?",
|
|
11802
11818
|
historyRestoreWarning:
|
|
11803
11819
|
"这会替换当前仪表板布局,并把当前状态保存到历史记录。",
|
|
11820
|
+
undo: "撤销",
|
|
11821
|
+
undoSuccess: "已撤销仪表板更改",
|
|
11822
|
+
undoFailed: "无法撤销仪表板更改",
|
|
11823
|
+
undoFailedWithMessage: "无法撤销仪表板更改:{{message}}",
|
|
11824
|
+
redo: "重做",
|
|
11825
|
+
redoSuccess: "已重做仪表板更改",
|
|
11826
|
+
redoFailed: "无法重做仪表板更改",
|
|
11827
|
+
redoFailedWithMessage: "无法重做仪表板更改:{{message}}",
|
|
11804
11828
|
},
|
|
11805
11829
|
analyses: {
|
|
11806
11830
|
historyTitle: "分析历史记录",
|
|
@@ -11832,6 +11856,16 @@ const translatedHistoryTranslations = {
|
|
|
11832
11856
|
historyRestoreQuestion: "¿Restaurar esta versión del panel?",
|
|
11833
11857
|
historyRestoreWarning:
|
|
11834
11858
|
"Esto reemplaza el diseño actual del panel y guarda el estado actual en el historial.",
|
|
11859
|
+
undo: "Deshacer",
|
|
11860
|
+
undoSuccess: "Cambio del panel deshecho",
|
|
11861
|
+
undoFailed: "No se pudo deshacer el cambio del panel",
|
|
11862
|
+
undoFailedWithMessage:
|
|
11863
|
+
"No se pudo deshacer el cambio del panel: {{message}}",
|
|
11864
|
+
redo: "Rehacer",
|
|
11865
|
+
redoSuccess: "Cambio del panel rehecho",
|
|
11866
|
+
redoFailed: "No se pudo rehacer el cambio del panel",
|
|
11867
|
+
redoFailedWithMessage:
|
|
11868
|
+
"No se pudo rehacer el cambio del panel: {{message}}",
|
|
11835
11869
|
},
|
|
11836
11870
|
analyses: {
|
|
11837
11871
|
historyTitle: "Historial del análisis",
|
|
@@ -11865,6 +11899,16 @@ const translatedHistoryTranslations = {
|
|
|
11865
11899
|
historyRestoreQuestion: "Restaurer cette version du tableau de bord ?",
|
|
11866
11900
|
historyRestoreWarning:
|
|
11867
11901
|
"Cela remplace la mise en page actuelle du tableau de bord et enregistre l'état actuel dans l'historique.",
|
|
11902
|
+
undo: "Annuler",
|
|
11903
|
+
undoSuccess: "Modification du tableau de bord annulée",
|
|
11904
|
+
undoFailed: "Impossible d'annuler la modification du tableau de bord",
|
|
11905
|
+
undoFailedWithMessage:
|
|
11906
|
+
"Impossible d'annuler la modification du tableau de bord : {{message}}",
|
|
11907
|
+
redo: "Rétablir",
|
|
11908
|
+
redoSuccess: "Modification du tableau de bord rétablie",
|
|
11909
|
+
redoFailed: "Impossible de rétablir la modification du tableau de bord",
|
|
11910
|
+
redoFailedWithMessage:
|
|
11911
|
+
"Impossible de rétablir la modification du tableau de bord : {{message}}",
|
|
11868
11912
|
},
|
|
11869
11913
|
analyses: {
|
|
11870
11914
|
historyTitle: "Historique de l'analyse",
|
|
@@ -11898,6 +11942,16 @@ const translatedHistoryTranslations = {
|
|
|
11898
11942
|
historyRestoreQuestion: "Diese Dashboard-Version wiederherstellen?",
|
|
11899
11943
|
historyRestoreWarning:
|
|
11900
11944
|
"Dies ersetzt das aktuelle Dashboard-Layout und speichert den aktuellen Stand im Verlauf.",
|
|
11945
|
+
undo: "Rückgängig",
|
|
11946
|
+
undoSuccess: "Dashboard-Änderung rückgängig gemacht",
|
|
11947
|
+
undoFailed: "Dashboard-Änderung konnte nicht rückgängig gemacht werden",
|
|
11948
|
+
undoFailedWithMessage:
|
|
11949
|
+
"Dashboard-Änderung konnte nicht rückgängig gemacht werden: {{message}}",
|
|
11950
|
+
redo: "Wiederholen",
|
|
11951
|
+
redoSuccess: "Dashboard-Änderung wiederholt",
|
|
11952
|
+
redoFailed: "Dashboard-Änderung konnte nicht wiederholt werden",
|
|
11953
|
+
redoFailedWithMessage:
|
|
11954
|
+
"Dashboard-Änderung konnte nicht wiederholt werden: {{message}}",
|
|
11901
11955
|
},
|
|
11902
11956
|
analyses: {
|
|
11903
11957
|
historyTitle: "Analyseverlauf",
|
|
@@ -11931,6 +11985,16 @@ const translatedHistoryTranslations = {
|
|
|
11931
11985
|
historyRestoreQuestion: "このダッシュボード版を復元しますか?",
|
|
11932
11986
|
historyRestoreWarning:
|
|
11933
11987
|
"現在のダッシュボードレイアウトを置き換え、現在の状態を履歴に保存します。",
|
|
11988
|
+
undo: "元に戻す",
|
|
11989
|
+
undoSuccess: "ダッシュボードの変更を元に戻しました",
|
|
11990
|
+
undoFailed: "ダッシュボードの変更を元に戻せませんでした",
|
|
11991
|
+
undoFailedWithMessage:
|
|
11992
|
+
"ダッシュボードの変更を元に戻せませんでした:{{message}}",
|
|
11993
|
+
redo: "やり直す",
|
|
11994
|
+
redoSuccess: "ダッシュボードの変更をやり直しました",
|
|
11995
|
+
redoFailed: "ダッシュボードの変更をやり直せませんでした",
|
|
11996
|
+
redoFailedWithMessage:
|
|
11997
|
+
"ダッシュボードの変更をやり直せませんでした:{{message}}",
|
|
11934
11998
|
},
|
|
11935
11999
|
analyses: {
|
|
11936
12000
|
historyTitle: "分析履歴",
|
|
@@ -11964,6 +12028,16 @@ const translatedHistoryTranslations = {
|
|
|
11964
12028
|
historyRestoreQuestion: "이 대시보드 버전을 복원할까요?",
|
|
11965
12029
|
historyRestoreWarning:
|
|
11966
12030
|
"현재 대시보드 레이아웃을 대체하고 현재 상태를 기록에 저장합니다.",
|
|
12031
|
+
undo: "실행 취소",
|
|
12032
|
+
undoSuccess: "대시보드 변경을 실행 취소했습니다",
|
|
12033
|
+
undoFailed: "대시보드 변경을 실행 취소할 수 없습니다",
|
|
12034
|
+
undoFailedWithMessage:
|
|
12035
|
+
"대시보드 변경을 실행 취소할 수 없습니다: {{message}}",
|
|
12036
|
+
redo: "다시 실행",
|
|
12037
|
+
redoSuccess: "대시보드 변경을 다시 실행했습니다",
|
|
12038
|
+
redoFailed: "대시보드 변경을 다시 실행할 수 없습니다",
|
|
12039
|
+
redoFailedWithMessage:
|
|
12040
|
+
"대시보드 변경을 다시 실행할 수 없습니다: {{message}}",
|
|
11967
12041
|
},
|
|
11968
12042
|
analyses: {
|
|
11969
12043
|
historyTitle: "분석 기록",
|
|
@@ -11997,6 +12071,16 @@ const translatedHistoryTranslations = {
|
|
|
11997
12071
|
historyRestoreQuestion: "Restaurar esta versão do painel?",
|
|
11998
12072
|
historyRestoreWarning:
|
|
11999
12073
|
"Isso substitui o layout atual do painel e salva o estado atual no histórico.",
|
|
12074
|
+
undo: "Desfazer",
|
|
12075
|
+
undoSuccess: "Alteração do painel desfeita",
|
|
12076
|
+
undoFailed: "Não foi possível desfazer a alteração do painel",
|
|
12077
|
+
undoFailedWithMessage:
|
|
12078
|
+
"Não foi possível desfazer a alteração do painel: {{message}}",
|
|
12079
|
+
redo: "Refazer",
|
|
12080
|
+
redoSuccess: "Alteração do painel refeita",
|
|
12081
|
+
redoFailed: "Não foi possível refazer a alteração do painel",
|
|
12082
|
+
redoFailedWithMessage:
|
|
12083
|
+
"Não foi possível refazer a alteração do painel: {{message}}",
|
|
12000
12084
|
},
|
|
12001
12085
|
analyses: {
|
|
12002
12086
|
historyTitle: "Histórico da análise",
|
|
@@ -12030,6 +12114,14 @@ const translatedHistoryTranslations = {
|
|
|
12030
12114
|
historyRestoreQuestion: "इस डैशबोर्ड संस्करण को पुनर्स्थापित करें?",
|
|
12031
12115
|
historyRestoreWarning:
|
|
12032
12116
|
"यह वर्तमान डैशबोर्ड layout को बदल देगा और वर्तमान स्थिति को इतिहास में सहेजेगा।",
|
|
12117
|
+
undo: "पूर्ववत करें",
|
|
12118
|
+
undoSuccess: "डैशबोर्ड बदलाव पूर्ववत किया गया",
|
|
12119
|
+
undoFailed: "डैशबोर्ड बदलाव पूर्ववत नहीं किया जा सका",
|
|
12120
|
+
undoFailedWithMessage: "डैशबोर्ड बदलाव पूर्ववत नहीं किया जा सका: {{message}}",
|
|
12121
|
+
redo: "फिर से करें",
|
|
12122
|
+
redoSuccess: "डैशबोर्ड बदलाव फिर से किया गया",
|
|
12123
|
+
redoFailed: "डैशबोर्ड बदलाव फिर से नहीं किया जा सका",
|
|
12124
|
+
redoFailedWithMessage: "डैशबोर्ड बदलाव फिर से नहीं किया जा सका: {{message}}",
|
|
12033
12125
|
},
|
|
12034
12126
|
analyses: {
|
|
12035
12127
|
historyTitle: "विश्लेषण इतिहास",
|
|
@@ -12063,6 +12155,16 @@ const translatedHistoryTranslations = {
|
|
|
12063
12155
|
historyRestoreQuestion: "هل تريد استعادة هذا الإصدار من لوحة المعلومات؟",
|
|
12064
12156
|
historyRestoreWarning:
|
|
12065
12157
|
"سيستبدل هذا تخطيط لوحة المعلومات الحالي ويحفظ الحالة الحالية في السجل.",
|
|
12158
|
+
undo: "تراجع",
|
|
12159
|
+
undoSuccess: "تم التراجع عن تغيير لوحة المعلومات",
|
|
12160
|
+
undoFailed: "تعذر التراجع عن تغيير لوحة المعلومات",
|
|
12161
|
+
undoFailedWithMessage:
|
|
12162
|
+
"تعذر التراجع عن تغيير لوحة المعلومات: {{message}}",
|
|
12163
|
+
redo: "إعادة",
|
|
12164
|
+
redoSuccess: "تمت إعادة تطبيق تغيير لوحة المعلومات",
|
|
12165
|
+
redoFailed: "تعذرت إعادة تطبيق تغيير لوحة المعلومات",
|
|
12166
|
+
redoFailedWithMessage:
|
|
12167
|
+
"تعذرت إعادة تطبيق تغيير لوحة المعلومات: {{message}}",
|
|
12066
12168
|
},
|
|
12067
12169
|
analyses: {
|
|
12068
12170
|
historyTitle: "سجل التحليل",
|