@squadbase/vantage 0.1.0 → 0.2.0
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 +5 -2
- package/dist/{chunk-YLAB6UQS.js → chunk-46QI6GFC.js} +2 -2
- package/dist/{chunk-YLAB6UQS.js.map → chunk-46QI6GFC.js.map} +1 -1
- package/dist/{chunk-WQZYXXQW.js → chunk-DIABD3KZ.js} +2 -2
- package/dist/chunk-DIABD3KZ.js.map +1 -0
- package/dist/chunk-DTDVSFRY.js +29 -0
- package/dist/chunk-DTDVSFRY.js.map +1 -0
- package/dist/chunk-EHPJXDJU.js +51 -0
- package/dist/chunk-EHPJXDJU.js.map +1 -0
- package/dist/{chunk-PRFBSQA4.js → chunk-UHZ7XSAN.js} +10 -5
- package/dist/chunk-UHZ7XSAN.js.map +1 -0
- package/dist/cli.js +19 -11
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +3 -1
- package/dist/client/index.js.map +1 -1
- package/dist/components/index.d.ts +23 -2
- package/dist/components/index.js +116 -2
- package/dist/components/index.js.map +1 -1
- package/dist/{define-page-B6y9TOfZ.d.ts → define-page-BfhrK99G.d.ts} +5 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/markdown/index.js.map +1 -1
- package/dist/query/index.d.ts +69 -2
- package/dist/query/index.js +85 -2
- package/dist/query/index.js.map +1 -1
- package/dist/router/index.d.ts +86 -1
- package/dist/router/index.js +71 -7
- package/dist/router/index.js.map +1 -1
- package/dist/server/node.js +1 -1
- package/dist/server/node.js.map +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/index.js.map +1 -1
- package/dist/vite/index.js +2 -2
- package/docs/en/agent-skills.md +12 -8
- package/docs/en/changelog.md +98 -0
- package/docs/en/cli-reference.md +1 -1
- package/docs/en/components.md +2 -0
- package/docs/en/data-fetching.md +77 -13
- package/docs/en/pages-and-metadata.md +6 -3
- package/docs/en/parts/placeholder.md +38 -0
- package/docs/en/parts/sparkline.md +47 -0
- package/docs/en/routing.md +82 -4
- package/docs/index.json +75 -13
- package/docs/ja/agent-skills.md +13 -9
- package/docs/ja/changelog.md +89 -0
- package/docs/ja/cli-reference.md +1 -1
- package/docs/ja/components.md +2 -0
- package/docs/ja/data-fetching.md +76 -12
- package/docs/ja/pages-and-metadata.md +6 -3
- package/docs/ja/parts/placeholder.md +37 -0
- package/docs/ja/parts/sparkline.md +47 -0
- package/docs/ja/routing.md +80 -4
- package/package.json +1 -1
- package/skills/vantage-add-feature/SKILL.md +14 -12
- package/skills/vantage-app/SKILL.md +55 -24
- package/skills/vantage-pitfalls/SKILL.md +27 -13
- package/templates/AGENTS.md +65 -23
- package/dist/chunk-ATYZ45XL.js +0 -19
- package/dist/chunk-ATYZ45XL.js.map +0 -1
- package/dist/chunk-PRFBSQA4.js.map +0 -1
- package/dist/chunk-WQZYXXQW.js.map +0 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { a as PageConfig } from '../define-page-
|
|
2
|
+
import { a as PageConfig } from '../define-page-BfhrK99G.js';
|
|
3
3
|
|
|
4
4
|
/** A page module as loaded by a route loader. */
|
|
5
5
|
interface PageModule {
|
|
@@ -21,6 +21,7 @@ interface ClientPage {
|
|
|
21
21
|
routePath: string;
|
|
22
22
|
title?: string;
|
|
23
23
|
description?: string;
|
|
24
|
+
navLabel?: string;
|
|
24
25
|
load: Loader;
|
|
25
26
|
}
|
|
26
27
|
/** The route manifest emitted into `.vantage/route-tree.gen.ts`. */
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createQueryClient } from '../chunk-
|
|
1
|
+
import { createQueryClient } from '../chunk-DTDVSFRY.js';
|
|
2
|
+
import { setRoutes } from '../chunk-EHPJXDJU.js';
|
|
2
3
|
import { StrictMode, Component } from 'react';
|
|
3
4
|
import { createRoot } from 'react-dom/client';
|
|
4
5
|
import { RouterProvider, createRootRoute, createRoute, createRouter, Outlet, lazyRouteComponent } from '@tanstack/react-router';
|
|
@@ -113,6 +114,7 @@ function layoutDepth(layout, manifest) {
|
|
|
113
114
|
return depth;
|
|
114
115
|
}
|
|
115
116
|
function bootstrap(manifest) {
|
|
117
|
+
setRoutes(manifest);
|
|
116
118
|
const { router } = buildRouter(manifest);
|
|
117
119
|
const queryClient = createQueryClient();
|
|
118
120
|
const defaultTitle = document.title;
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/states.tsx","../../src/client/error-boundary.tsx","../../src/client/build-router.tsx","../../src/client/bootstrap.tsx"],"names":["jsx"],"mappings":";;;;;;;;AAIO,SAAS,cAAA,GAA4B;AAC1C,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,+CAAA,EAAgD,IAAA,EAAK,QAAA,EAAS,WAAA,EAAU,QAAA,EACrF,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wEAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,WAAU,gFAAA,EAAiF,CAAA;AAAA,IAAE;AAAA,GAAA,EAErG,CAAA,EACF,CAAA;AAEJ;AAEO,SAAS,YAAA,CAAa,EAAE,KAAA,EAAM,EAAkC;AACrE,EAAA,MAAM,UAAU,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AACrE,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAU,uBAAA,EAAwB,MAAK,OAAA,EAC1C,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4EAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,wDAAA,EAAyD,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D,MAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,OAAA,CAAQ,MAAA,GAAS,CAAC,CAAA;AACvC,MAAA,MAAM,KAAA,GAAQ,MAAM,UAAA,EAAY,KAAA;AAChC,MAAA,QAAA,CAAS,QAAQ,OAAO,KAAA,KAAU,YAAY,KAAA,CAAM,MAAA,GAAS,IAAI,KAAA,GAAQ,YAAA;AAAA,IAC3E,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF,CAAA;AACA,EAAA,MAAA,CAAO,SAAA,GAAY,cAAc,WAAW,CAAA;AAE5C,EAAA,MAAM,EAAA,GAAK,QAAA,CAAS,cAAA,CAAe,MAAM,CAAA;AACzC,EAAA,IAAI,CAAC,EAAA,EAAI;AACP,IAAA,MAAM,IAAI,MAAM,+DAA+D,CAAA;AAAA,EACjF;AAEA,EAAA,UAAA,CAAW,EAAE,CAAA,CAAE,MAAA;AAAA,oBACbA,GAAAA,CAAC,UAAA,EAAA,EACC,QAAA,kBAAAA,GAAAA,CAAC,oBACC,QAAA,kBAAAA,GAAAA,CAAC,mBAAA,EAAA,EAAoB,MAAA,EAAQ,aAC3B,QAAA,kBAAAA,GAAAA,CAAC,kBAAe,MAAA,EAAgB,CAAA,EAClC,GACF,CAAA,EACF;AAAA,GACF;AAEA,EAAA,WAAA,EAAY;AACd","file":"index.js","sourcesContent":["import type { ReactNode } from \"react\"\n\n/** Minimal internal states used as router-level defaults. */\n\nexport function DefaultPending(): ReactNode {\n return (\n <div className=\"flex min-h-[40vh] items-center justify-center\" role=\"status\" aria-live=\"polite\">\n <div className=\"flex items-center gap-3 text-sm text-[var(--muted-foreground,#71717a)]\">\n <span className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\" />\n Loading…\n </div>\n </div>\n )\n}\n\nexport function DefaultError({ error }: { error: unknown }): ReactNode {\n const message = error instanceof Error ? error.message : String(error)\n return (\n <div className=\"mx-auto max-w-2xl p-6\" role=\"alert\">\n <div className=\"rounded-lg border border-[var(--border,#e4e4e7)] bg-[var(--card,#fff)] p-6\">\n <h2 className=\"text-lg font-semibold text-[var(--foreground,#09090b)]\">Something went wrong</h2>\n <p className=\"mt-2 text-sm text-[var(--muted-foreground,#71717a)]\">{message}</p>\n </div>\n </div>\n )\n}\n\nexport function DefaultNotFound(): ReactNode {\n return (\n <div className=\"mx-auto max-w-2xl p-6 text-center\">\n <p className=\"text-5xl font-bold text-[var(--muted-foreground,#a1a1aa)]\">404</p>\n <h2 className=\"mt-3 text-lg font-semibold text-[var(--foreground,#09090b)]\">Page not found</h2>\n <p className=\"mt-1 text-sm text-[var(--muted-foreground,#71717a)]\">\n The page you are looking for does not exist.\n </p>\n </div>\n )\n}\n","import { Component, type ErrorInfo, type ReactNode } from \"react\"\nimport { DefaultError } from \"./states.js\"\n\ninterface Props {\n children: ReactNode\n fallback?: (error: unknown) => ReactNode\n}\n\ninterface State {\n error: unknown\n}\n\n/**\n * Top-level error boundary that wraps the entire application (outside the\n * router). Route-level errors are handled by the router's errorComponent; this\n * catches catastrophic render failures in the provider tree.\n */\nexport class AppErrorBoundary extends Component<Props, State> {\n state: State = { error: null }\n\n static getDerivedStateFromError(error: unknown): State {\n return { error }\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo): void {\n // Forwarded to the terminal in dev via the console bridge.\n console.error(\"[vantage] Unhandled application error:\", error, info.componentStack)\n }\n\n render(): ReactNode {\n if (this.state.error != null) {\n return this.props.fallback\n ? this.props.fallback(this.state.error)\n : <DefaultError error={this.state.error} />\n }\n return this.props.children\n }\n}\n","import {\n createRootRoute,\n createRoute,\n createRouter,\n lazyRouteComponent,\n Outlet,\n} from \"@tanstack/react-router\"\nimport type { ClientManifest, Loader } from \"./manifest.js\"\nimport { DefaultError, DefaultNotFound, DefaultPending } from \"./states.js\"\n\n// The programmatic route tree fights TanStack's file-route generics, which are\n// designed for codegen. Internal assembly is intentionally untyped; the public\n// surface (pages, definePage) stays fully typed.\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype AnyRoute = any\n\nfunction RootPassthrough() {\n return <Outlet />\n}\n\nfunction lazyComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\nfunction lazyErrorComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\nexport interface BuiltRouter {\n router: AnyRoute\n /** routeId -> page meta, for the title manager. */\n meta: Map<string, { title?: string; description?: string; routePath: string }>\n}\n\n/** Assemble a TanStack Router instance from the generated manifest. */\nexport function buildRouter(manifest: ClientManifest): BuiltRouter {\n const rootRoute = createRootRoute({\n component: manifest.rootLayout ? lazyComponent(manifest.rootLayout) : RootPassthrough,\n errorComponent: manifest.error ? lazyErrorComponent(manifest.error) : DefaultError,\n notFoundComponent: manifest.notFound ? lazyComponent(manifest.notFound) : DefaultNotFound,\n })\n\n const layoutById = new Map<string, AnyRoute>()\n const childrenByParent = new Map<string, AnyRoute[]>()\n const meta = new Map<string, { title?: string; description?: string; routePath: string }>()\n\n const pushChild = (parentKey: string, route: AnyRoute) => {\n const list = childrenByParent.get(parentKey) ?? []\n list.push(route)\n childrenByParent.set(parentKey, list)\n }\n\n // 1. Create layout routes (parents referenced lazily via getParentRoute).\n for (const layout of manifest.layouts) {\n const parentKey = layout.parentId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n layout.parentId ? layoutById.get(layout.parentId)! : rootRoute,\n path: layout.path,\n component: lazyComponent(layout.load),\n } as AnyRoute)\n layoutById.set(layout.id, route)\n pushChild(parentKey, route)\n }\n\n // 2. Create page routes.\n for (const page of manifest.pages) {\n const parentKey = page.parentLayoutId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n page.parentLayoutId ? layoutById.get(page.parentLayoutId)! : rootRoute,\n path: page.path,\n component: lazyComponent(page.load),\n staticData: { title: page.title, description: page.description, routePath: page.routePath },\n } as AnyRoute)\n pushChild(parentKey, route)\n // route.id is finalized after createRouter; index by routePath-derived key\n // is unreliable, so the title manager reads staticData off matches instead.\n }\n\n // 3. Attach children — deepest layouts first so nested trees are built before\n // their parent references them.\n const layoutsDeepFirst = [...manifest.layouts].sort(\n (a, b) => layoutDepth(b, manifest) - layoutDepth(a, manifest),\n )\n for (const layout of layoutsDeepFirst) {\n const route = layoutById.get(layout.id)!\n route.addChildren(childrenByParent.get(layout.id) ?? [])\n }\n rootRoute.addChildren(childrenByParent.get(\"__root__\") ?? [])\n\n const router = createRouter({\n routeTree: rootRoute,\n defaultPendingComponent: DefaultPending,\n defaultErrorComponent: DefaultError,\n defaultNotFoundComponent: DefaultNotFound,\n defaultPreload: \"intent\",\n scrollRestoration: true,\n } as AnyRoute)\n\n return { router, meta }\n}\n\nfunction layoutDepth(layout: { id: string; parentId: string | null }, manifest: ClientManifest): number {\n let depth = 0\n let current: string | null = layout.parentId\n const byId = new Map(manifest.layouts.map((l) => [l.id, l]))\n while (current) {\n depth++\n current = byId.get(current)?.parentId ?? null\n }\n return depth\n}\n","import { StrictMode } from \"react\"\nimport { createRoot } from \"react-dom/client\"\nimport { RouterProvider } from \"@tanstack/react-router\"\nimport { QueryClientProvider } from \"@tanstack/react-query\"\nimport { createQueryClient } from \"../query/client.js\"\nimport { AppErrorBoundary } from \"./error-boundary.js\"\nimport { buildRouter } from \"./build-router.js\"\nimport type { ClientManifest } from \"./manifest.js\"\n\n/**\n * Client entrypoint. The generated `.vantage/client-entry.tsx` calls this with\n * the route manifest. Owns React root creation and the provider tree:\n *\n * <AppErrorBoundary>\n * <QueryClientProvider>\n * <RouterProvider />\n */\nexport function bootstrap(manifest: ClientManifest): void {\n const { router } = buildRouter(manifest)\n const queryClient = createQueryClient()\n\n // The document's initial title is the fallback for pages without a definePage\n // title, so navigating away from a titled page doesn't leave a stale title.\n const defaultTitle = document.title\n\n const updateTitle = () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const matches: any[] = router.state?.matches ?? []\n const leaf = matches[matches.length - 1]\n const title = leaf?.staticData?.title\n document.title = typeof title === \"string\" && title.length > 0 ? title : defaultTitle\n } catch {\n /* title updates are best-effort */\n }\n }\n router.subscribe?.(\"onResolved\", updateTitle)\n\n const el = document.getElementById(\"root\")\n if (!el) {\n throw new Error('[vantage] Root element \"#root\" was not found in the document.')\n }\n\n createRoot(el).render(\n <StrictMode>\n <AppErrorBoundary>\n <QueryClientProvider client={queryClient}>\n <RouterProvider router={router} />\n </QueryClientProvider>\n </AppErrorBoundary>\n </StrictMode>,\n )\n\n updateTitle()\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/client/states.tsx","../../src/client/error-boundary.tsx","../../src/client/build-router.tsx","../../src/client/bootstrap.tsx"],"names":["jsx"],"mappings":";;;;;;;;;AAIO,SAAS,cAAA,GAA4B;AAC1C,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,+CAAA,EAAgD,IAAA,EAAK,QAAA,EAAS,WAAA,EAAU,QAAA,EACrF,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wEAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,WAAU,gFAAA,EAAiF,CAAA;AAAA,IAAE;AAAA,GAAA,EAErG,CAAA,EACF,CAAA;AAEJ;AAEO,SAAS,YAAA,CAAa,EAAE,KAAA,EAAM,EAAkC;AACrE,EAAA,MAAM,UAAU,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AACrE,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAU,uBAAA,EAAwB,MAAK,OAAA,EAC1C,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,4EAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,wDAAA,EAAyD,QAAA,EAAA,sBAAA,EAAoB,CAAA;AAAA,oBAC3F,GAAA,CAAC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,GAAO,OAAA,CAAQ,OAAA,CAAQ,MAAA,GAAS,CAAC,CAAA;AACvC,MAAA,MAAM,KAAA,GAAQ,MAAM,UAAA,EAAY,KAAA;AAChC,MAAA,QAAA,CAAS,QAAQ,OAAO,KAAA,KAAU,YAAY,KAAA,CAAM,MAAA,GAAS,IAAI,KAAA,GAAQ,YAAA;AAAA,IAC3E,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF,CAAA;AACA,EAAA,MAAA,CAAO,SAAA,GAAY,cAAc,WAAW,CAAA;AAE5C,EAAA,MAAM,EAAA,GAAK,QAAA,CAAS,cAAA,CAAe,MAAM,CAAA;AACzC,EAAA,IAAI,CAAC,EAAA,EAAI;AACP,IAAA,MAAM,IAAI,MAAM,+DAA+D,CAAA;AAAA,EACjF;AAEA,EAAA,UAAA,CAAW,EAAE,CAAA,CAAE,MAAA;AAAA,oBACbA,GAAAA,CAAC,UAAA,EAAA,EACC,QAAA,kBAAAA,GAAAA,CAAC,oBACC,QAAA,kBAAAA,GAAAA,CAAC,mBAAA,EAAA,EAAoB,MAAA,EAAQ,aAC3B,QAAA,kBAAAA,GAAAA,CAAC,kBAAe,MAAA,EAAgB,CAAA,EAClC,GACF,CAAA,EACF;AAAA,GACF;AAEA,EAAA,WAAA,EAAY;AACd","file":"index.js","sourcesContent":["import type { ReactNode } from \"react\"\n\n/** Minimal internal states used as router-level defaults. */\n\nexport function DefaultPending(): ReactNode {\n return (\n <div className=\"flex min-h-[40vh] items-center justify-center\" role=\"status\" aria-live=\"polite\">\n <div className=\"flex items-center gap-3 text-sm text-[var(--muted-foreground,#71717a)]\">\n <span className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\" />\n Loading…\n </div>\n </div>\n )\n}\n\nexport function DefaultError({ error }: { error: unknown }): ReactNode {\n const message = error instanceof Error ? error.message : String(error)\n return (\n <div className=\"mx-auto max-w-2xl p-6\" role=\"alert\">\n <div className=\"rounded-lg border border-[var(--border,#e4e4e7)] bg-[var(--card,#fff)] p-6\">\n <h2 className=\"text-lg font-semibold text-[var(--foreground,#09090b)]\">Something went wrong</h2>\n <p className=\"mt-2 text-sm text-[var(--muted-foreground,#71717a)]\">{message}</p>\n </div>\n </div>\n )\n}\n\nexport function DefaultNotFound(): ReactNode {\n return (\n <div className=\"mx-auto max-w-2xl p-6 text-center\">\n <p className=\"text-5xl font-bold text-[var(--muted-foreground,#a1a1aa)]\">404</p>\n <h2 className=\"mt-3 text-lg font-semibold text-[var(--foreground,#09090b)]\">Page not found</h2>\n <p className=\"mt-1 text-sm text-[var(--muted-foreground,#71717a)]\">\n The page you are looking for does not exist.\n </p>\n </div>\n )\n}\n","import { Component, type ErrorInfo, type ReactNode } from \"react\"\nimport { DefaultError } from \"./states\"\n\ninterface Props {\n children: ReactNode\n fallback?: (error: unknown) => ReactNode\n}\n\ninterface State {\n error: unknown\n}\n\n/**\n * Top-level error boundary that wraps the entire application (outside the\n * router). Route-level errors are handled by the router's errorComponent; this\n * catches catastrophic render failures in the provider tree.\n */\nexport class AppErrorBoundary extends Component<Props, State> {\n state: State = { error: null }\n\n static getDerivedStateFromError(error: unknown): State {\n return { error }\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo): void {\n // Forwarded to the terminal in dev via the console bridge.\n console.error(\"[vantage] Unhandled application error:\", error, info.componentStack)\n }\n\n render(): ReactNode {\n if (this.state.error != null) {\n return this.props.fallback\n ? this.props.fallback(this.state.error)\n : <DefaultError error={this.state.error} />\n }\n return this.props.children\n }\n}\n","import {\n createRootRoute,\n createRoute,\n createRouter,\n lazyRouteComponent,\n Outlet,\n} from \"@tanstack/react-router\"\nimport type { ClientManifest, Loader } from \"./manifest\"\nimport { DefaultError, DefaultNotFound, DefaultPending } from \"./states\"\n\n// The programmatic route tree fights TanStack's file-route generics, which are\n// designed for codegen. Internal assembly is intentionally untyped; the public\n// surface (pages, definePage) stays fully typed.\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype AnyRoute = any\n\nfunction RootPassthrough() {\n return <Outlet />\n}\n\nfunction lazyComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\nfunction lazyErrorComponent(load: Loader): AnyRoute {\n return lazyRouteComponent(load as () => Promise<{ default: any }>)\n}\n\nexport interface BuiltRouter {\n router: AnyRoute\n /** routeId -> page meta, for the title manager. */\n meta: Map<string, { title?: string; description?: string; routePath: string }>\n}\n\n/** Assemble a TanStack Router instance from the generated manifest. */\nexport function buildRouter(manifest: ClientManifest): BuiltRouter {\n const rootRoute = createRootRoute({\n component: manifest.rootLayout ? lazyComponent(manifest.rootLayout) : RootPassthrough,\n errorComponent: manifest.error ? lazyErrorComponent(manifest.error) : DefaultError,\n notFoundComponent: manifest.notFound ? lazyComponent(manifest.notFound) : DefaultNotFound,\n })\n\n const layoutById = new Map<string, AnyRoute>()\n const childrenByParent = new Map<string, AnyRoute[]>()\n const meta = new Map<string, { title?: string; description?: string; routePath: string }>()\n\n const pushChild = (parentKey: string, route: AnyRoute) => {\n const list = childrenByParent.get(parentKey) ?? []\n list.push(route)\n childrenByParent.set(parentKey, list)\n }\n\n // 1. Create layout routes (parents referenced lazily via getParentRoute).\n for (const layout of manifest.layouts) {\n const parentKey = layout.parentId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n layout.parentId ? layoutById.get(layout.parentId)! : rootRoute,\n path: layout.path,\n component: lazyComponent(layout.load),\n } as AnyRoute)\n layoutById.set(layout.id, route)\n pushChild(parentKey, route)\n }\n\n // 2. Create page routes.\n for (const page of manifest.pages) {\n const parentKey = page.parentLayoutId ?? \"__root__\"\n const route: AnyRoute = createRoute({\n getParentRoute: () =>\n page.parentLayoutId ? layoutById.get(page.parentLayoutId)! : rootRoute,\n path: page.path,\n component: lazyComponent(page.load),\n staticData: { title: page.title, description: page.description, routePath: page.routePath },\n } as AnyRoute)\n pushChild(parentKey, route)\n // route.id is finalized after createRouter; index by routePath-derived key\n // is unreliable, so the title manager reads staticData off matches instead.\n }\n\n // 3. Attach children — deepest layouts first so nested trees are built before\n // their parent references them.\n const layoutsDeepFirst = [...manifest.layouts].sort(\n (a, b) => layoutDepth(b, manifest) - layoutDepth(a, manifest),\n )\n for (const layout of layoutsDeepFirst) {\n const route = layoutById.get(layout.id)!\n route.addChildren(childrenByParent.get(layout.id) ?? [])\n }\n rootRoute.addChildren(childrenByParent.get(\"__root__\") ?? [])\n\n const router = createRouter({\n routeTree: rootRoute,\n defaultPendingComponent: DefaultPending,\n defaultErrorComponent: DefaultError,\n defaultNotFoundComponent: DefaultNotFound,\n defaultPreload: \"intent\",\n scrollRestoration: true,\n } as AnyRoute)\n\n return { router, meta }\n}\n\nfunction layoutDepth(layout: { id: string; parentId: string | null }, manifest: ClientManifest): number {\n let depth = 0\n let current: string | null = layout.parentId\n const byId = new Map(manifest.layouts.map((l) => [l.id, l]))\n while (current) {\n depth++\n current = byId.get(current)?.parentId ?? null\n }\n return depth\n}\n","import { StrictMode } from \"react\"\nimport { createRoot } from \"react-dom/client\"\nimport { RouterProvider } from \"@tanstack/react-router\"\nimport { QueryClientProvider } from \"@tanstack/react-query\"\nimport { createQueryClient } from \"../query/client\"\nimport { setRoutes } from \"../router/registry\"\nimport { AppErrorBoundary } from \"./error-boundary\"\nimport { buildRouter } from \"./build-router\"\nimport type { ClientManifest } from \"./manifest\"\n\n/**\n * Client entrypoint. The generated `.vantage/client-entry.tsx` calls this with\n * the route manifest. Owns React root creation and the provider tree:\n *\n * <AppErrorBoundary>\n * <QueryClientProvider>\n * <RouterProvider />\n */\nexport function bootstrap(manifest: ClientManifest): void {\n // Publish the route list before the first render so `useRoutes()` is\n // populated for the very first page, not one paint late.\n setRoutes(manifest)\n\n const { router } = buildRouter(manifest)\n const queryClient = createQueryClient()\n\n // The document's initial title is the fallback for pages without a definePage\n // title, so navigating away from a titled page doesn't leave a stale title.\n const defaultTitle = document.title\n\n const updateTitle = () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const matches: any[] = router.state?.matches ?? []\n const leaf = matches[matches.length - 1]\n const title = leaf?.staticData?.title\n document.title = typeof title === \"string\" && title.length > 0 ? title : defaultTitle\n } catch {\n /* title updates are best-effort */\n }\n }\n router.subscribe?.(\"onResolved\", updateTitle)\n\n const el = document.getElementById(\"root\")\n if (!el) {\n throw new Error('[vantage] Root element \"#root\" was not found in the document.')\n }\n\n createRoot(el).render(\n <StrictMode>\n <AppErrorBoundary>\n <QueryClientProvider client={queryClient}>\n <RouterProvider router={router} />\n </QueryClientProvider>\n </AppErrorBoundary>\n </StrictMode>,\n )\n\n updateTitle()\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { HTMLAttributes, ComponentType, ReactNode, ElementType, ComponentProps } from 'react';
|
|
3
|
+
import { HTMLAttributes, ComponentType, ReactNode, ElementType, ComponentProps, SVGAttributes } from 'react';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
import { EChartsOption } from 'echarts';
|
|
6
6
|
export { EChartsOption } from 'echarts';
|
|
@@ -298,6 +298,23 @@ interface FunnelStepsProps extends ComponentProps<"div">, VariantProps<typeof fu
|
|
|
298
298
|
}
|
|
299
299
|
declare const FunnelSteps: React.ForwardRefExoticComponent<Omit<FunnelStepsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
300
300
|
|
|
301
|
+
type SparklineVariant = "line" | "bar";
|
|
302
|
+
interface SparklineDataPoint {
|
|
303
|
+
value: number;
|
|
304
|
+
label?: string;
|
|
305
|
+
}
|
|
306
|
+
interface SparklineProps extends SVGAttributes<SVGSVGElement> {
|
|
307
|
+
data: SparklineDataPoint[];
|
|
308
|
+
variant?: SparklineVariant;
|
|
309
|
+
height?: number;
|
|
310
|
+
/** Tailwind text-colour class; drives both stroke and fill via `currentColor`. */
|
|
311
|
+
color?: string;
|
|
312
|
+
area?: boolean;
|
|
313
|
+
animate?: boolean;
|
|
314
|
+
className?: string;
|
|
315
|
+
}
|
|
316
|
+
declare const Sparkline: React.ForwardRefExoticComponent<SparklineProps & React.RefAttributes<SVGSVGElement>>;
|
|
317
|
+
|
|
301
318
|
interface DataTableContextValue<TData> {
|
|
302
319
|
table: Table<TData>;
|
|
303
320
|
selectedRows: TData[];
|
|
@@ -551,4 +568,8 @@ interface StatusBadgeProps {
|
|
|
551
568
|
}
|
|
552
569
|
declare const StatusBadge: React.ForwardRefExoticComponent<StatusBadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
553
570
|
|
|
554
|
-
|
|
571
|
+
interface PlaceholderProps extends HTMLAttributes<HTMLSpanElement> {
|
|
572
|
+
}
|
|
573
|
+
declare const Placeholder: React.ForwardRefExoticComponent<PlaceholderProps & React.RefAttributes<HTMLSpanElement>>;
|
|
574
|
+
|
|
575
|
+
export { AppShell, type AppShellHeaderProps, type AppShellProps, type AppShellSidebarProps, DashboardCard, DashboardCardAction, type DashboardCardActionProps, DashboardCardContent, type DashboardCardContentProps, DashboardCardDescription, type DashboardCardDescriptionProps, DashboardCardFooter, type DashboardCardFooterProps, DashboardCardHeader, type DashboardCardHeaderProps, DashboardCardPreset, type DashboardCardPresetProps, type DashboardCardProps, DashboardCardSkeleton, type DashboardCardSkeletonProps, DashboardCardTitle, type DashboardCardTitleProps, DataTable, DataTableColumnVisibility, type DataTableColumnVisibilityProps, DataTableContent, type DataTableContentProps, DataTablePagination, type DataTablePaginationProps, DataTablePreset, type DataTablePresetProps, type DataTableProps, DataTableToolbar, type DataTableToolbarProps, type DateRange, DateRangePicker, type DateRangePickerProps, EChart, type EChartProps, FilterBar, FilterBarActiveChips, type FilterBarActiveChipsProps, FilterBarClearButton, type FilterBarClearButtonProps, FilterBarMultiSelect, type FilterBarMultiSelectProps, FilterBarPreset, type FilterBarPresetProps, type FilterBarProps, FilterBarSelect, type FilterBarSelectProps, type FilterConfig, type FilterOption, type FilterType, type FilterValues, type FunnelStep, FunnelSteps, type FunnelStepsProps, type MetricItem, MetricUnit, type MetricUnitProps, MetricValue, type MetricValueProps, type MetricVariant, MultiSelect, type MultiSelectProps, type NavGroup, type NavItem, PageShell, PageShellActions, type PageShellActionsProps, PageShellContent, type PageShellContentProps, PageShellDescription, type PageShellDescriptionProps, PageShellHeader, PageShellHeaderEnd, type PageShellHeaderEndProps, type PageShellHeaderProps, PageShellHeading, type PageShellHeadingProps, PageShellMeta, type PageShellMetaProps, type PageShellProps, PageShellSummary, PageShellSummaryCard, type PageShellSummaryCardProps, type PageShellSummaryProps, PageShellTitle, type PageShellTitleProps, Placeholder, type PlaceholderProps, type PresetItem, SearchableSelect, type SearchableSelectProps, SectionHeader, type SectionHeaderProps, type SegmentOption, SegmentedControl, type SegmentedControlProps, type SelectOption, type SelectOptionGroup, type SelectOptions, Sparkline, type SparklineDataPoint, type SparklineProps, type SparklineVariant, StatusBadge, type StatusBadgeProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, defaultPresets, flattenOptions, funnelStepsVariants, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, useDataTable };
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarFooter, SidebarRail, SidebarInset, SidebarTrigger, Separator, Button, Input, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuCheckboxItem, useIsMobile, Popover, PopoverTrigger, PopoverContent, Calendar, ToggleGroup, ToggleGroupItem, Badge, SelectGroup, SelectLabel, Collapsible, CollapsibleTrigger, SidebarMenuButton, SidebarMenuBadge, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, SidebarMenuItem, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, Skeleton, Checkbox } from '../chunk-
|
|
1
|
+
import { SidebarProvider, Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarFooter, SidebarRail, SidebarInset, SidebarTrigger, Separator, Button, Input, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuCheckboxItem, useIsMobile, Popover, PopoverTrigger, PopoverContent, Calendar, ToggleGroup, ToggleGroupItem, Badge, SelectGroup, SelectLabel, Collapsible, CollapsibleTrigger, SidebarMenuButton, SidebarMenuBadge, CollapsibleContent, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton, SidebarMenuItem, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, Skeleton, Checkbox } from '../chunk-DIABD3KZ.js';
|
|
2
2
|
import { cn } from '../chunk-A2UUGASH.js';
|
|
3
3
|
import { forwardRef, useRef, useState, useEffect, useCallback, Fragment, createContext, useMemo, useId, useContext } from 'react';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
@@ -815,6 +815,108 @@ var FunnelSteps = forwardRef(function FunnelSteps2({
|
|
|
815
815
|
);
|
|
816
816
|
});
|
|
817
817
|
FunnelSteps.displayName = "FunnelSteps";
|
|
818
|
+
var VB_WIDTH = 100;
|
|
819
|
+
function normalizeData(values, height, vPad = 2) {
|
|
820
|
+
const min = Math.min(...values);
|
|
821
|
+
const max = Math.max(...values);
|
|
822
|
+
const range = max - min;
|
|
823
|
+
const drawHeight = height - vPad * 2;
|
|
824
|
+
if (range === 0) return values.map(() => vPad + drawHeight / 2);
|
|
825
|
+
return values.map((v) => height - vPad - (v - min) / range * drawHeight);
|
|
826
|
+
}
|
|
827
|
+
function buildLinePath(ys) {
|
|
828
|
+
if (ys.length === 0) return "";
|
|
829
|
+
const step = ys.length > 1 ? VB_WIDTH / (ys.length - 1) : 0;
|
|
830
|
+
return ys.map((y, i) => `${i === 0 ? "M" : "L"}${(i * step).toFixed(2)},${y.toFixed(2)}`).join(" ");
|
|
831
|
+
}
|
|
832
|
+
function buildAreaPath(ys, height) {
|
|
833
|
+
if (ys.length === 0) return "";
|
|
834
|
+
const step = ys.length > 1 ? VB_WIDTH / (ys.length - 1) : 0;
|
|
835
|
+
const lastX = ((ys.length - 1) * step).toFixed(2);
|
|
836
|
+
return `${buildLinePath(ys)} L${lastX},${height} L0,${height} Z`;
|
|
837
|
+
}
|
|
838
|
+
function buildBarRects(ys, height, gap = 1) {
|
|
839
|
+
const barW = Math.max(1, VB_WIDTH / ys.length - gap);
|
|
840
|
+
return ys.map((y, i) => ({ x: i * (barW + gap), y, w: barW, h: height - y }));
|
|
841
|
+
}
|
|
842
|
+
var Sparkline = forwardRef(function Sparkline2({
|
|
843
|
+
data,
|
|
844
|
+
variant = "line",
|
|
845
|
+
height = 40,
|
|
846
|
+
color = "text-chart-1",
|
|
847
|
+
area = false,
|
|
848
|
+
animate = false,
|
|
849
|
+
className,
|
|
850
|
+
...props
|
|
851
|
+
}, ref) {
|
|
852
|
+
const [mounted, setMounted] = useState(false);
|
|
853
|
+
useEffect(() => {
|
|
854
|
+
if (animate) setMounted(true);
|
|
855
|
+
}, [animate]);
|
|
856
|
+
if (data.length === 0) return null;
|
|
857
|
+
const ys = normalizeData(
|
|
858
|
+
data.map((d) => d.value),
|
|
859
|
+
height
|
|
860
|
+
);
|
|
861
|
+
return /* @__PURE__ */ jsxs(
|
|
862
|
+
"svg",
|
|
863
|
+
{
|
|
864
|
+
ref,
|
|
865
|
+
"data-slot": "sparkline",
|
|
866
|
+
viewBox: `0 0 ${VB_WIDTH} ${height}`,
|
|
867
|
+
preserveAspectRatio: "none",
|
|
868
|
+
width: "100%",
|
|
869
|
+
height,
|
|
870
|
+
"aria-hidden": "true",
|
|
871
|
+
className: cn("overflow-visible", className),
|
|
872
|
+
...props,
|
|
873
|
+
children: [
|
|
874
|
+
variant === "line" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
875
|
+
area && /* @__PURE__ */ jsx(
|
|
876
|
+
"path",
|
|
877
|
+
{
|
|
878
|
+
d: buildAreaPath(ys, height),
|
|
879
|
+
strokeWidth: 0,
|
|
880
|
+
className: cn("fill-current opacity-15", color)
|
|
881
|
+
}
|
|
882
|
+
),
|
|
883
|
+
/* @__PURE__ */ jsx(
|
|
884
|
+
"path",
|
|
885
|
+
{
|
|
886
|
+
d: buildLinePath(ys),
|
|
887
|
+
fill: "none",
|
|
888
|
+
strokeWidth: 1.5,
|
|
889
|
+
strokeLinecap: "round",
|
|
890
|
+
strokeLinejoin: "round",
|
|
891
|
+
vectorEffect: "non-scaling-stroke",
|
|
892
|
+
pathLength: animate ? 1 : void 0,
|
|
893
|
+
strokeDasharray: animate ? 1 : void 0,
|
|
894
|
+
strokeDashoffset: animate ? mounted ? 0 : 1 : void 0,
|
|
895
|
+
className: cn("stroke-current", color),
|
|
896
|
+
style: animate ? { transition: "stroke-dashoffset 0.6s ease-in-out" } : void 0
|
|
897
|
+
}
|
|
898
|
+
)
|
|
899
|
+
] }),
|
|
900
|
+
variant === "bar" && buildBarRects(ys, height).map((rect, i) => /* @__PURE__ */ jsx(
|
|
901
|
+
"rect",
|
|
902
|
+
{
|
|
903
|
+
x: rect.x,
|
|
904
|
+
y: animate ? mounted ? rect.y : height : rect.y,
|
|
905
|
+
width: rect.w,
|
|
906
|
+
height: animate ? mounted ? rect.h : 0 : rect.h,
|
|
907
|
+
rx: 0.5,
|
|
908
|
+
className: cn("fill-current", color),
|
|
909
|
+
style: animate ? {
|
|
910
|
+
transition: `height 0.4s ease-out ${i * 0.02}s, y 0.4s ease-out ${i * 0.02}s`
|
|
911
|
+
} : void 0
|
|
912
|
+
},
|
|
913
|
+
i
|
|
914
|
+
))
|
|
915
|
+
]
|
|
916
|
+
}
|
|
917
|
+
);
|
|
918
|
+
});
|
|
919
|
+
Sparkline.displayName = "Sparkline";
|
|
818
920
|
function useControlledState(controlledValue, defaultValue, onChange) {
|
|
819
921
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
820
922
|
const isControlled = controlledValue !== void 0;
|
|
@@ -1977,7 +2079,19 @@ var StatusBadge = forwardRef(function StatusBadge2({ status, label, colorMap, cl
|
|
|
1977
2079
|
);
|
|
1978
2080
|
});
|
|
1979
2081
|
StatusBadge.displayName = "StatusBadge";
|
|
2082
|
+
var Placeholder = forwardRef(function Placeholder2({ className, ...props }, ref) {
|
|
2083
|
+
return /* @__PURE__ */ jsx(
|
|
2084
|
+
"span",
|
|
2085
|
+
{
|
|
2086
|
+
ref,
|
|
2087
|
+
"data-slot": "placeholder",
|
|
2088
|
+
className: cn("inline-block animate-pulse text-muted-foreground", className),
|
|
2089
|
+
...props
|
|
2090
|
+
}
|
|
2091
|
+
);
|
|
2092
|
+
});
|
|
2093
|
+
Placeholder.displayName = "Placeholder";
|
|
1980
2094
|
|
|
1981
|
-
export { AppShell, DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardDescription, DashboardCardFooter, DashboardCardHeader, DashboardCardPreset, DashboardCardSkeleton, DashboardCardTitle, DataTable, DataTableColumnVisibility, DataTableContent, DataTablePagination, DataTablePreset, DataTableToolbar, DateRangePicker, EChart, FilterBar, FilterBarActiveChips, FilterBarClearButton, FilterBarMultiSelect, FilterBarPreset, FilterBarSelect, FunnelSteps, MetricUnit, MetricValue, MultiSelect, PageShell, PageShellActions, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellMeta, PageShellSummary, PageShellSummaryCard, PageShellTitle, SearchableSelect, SectionHeader, SegmentedControl, StatusBadge, TrendIndicator, defaultPresets, flattenOptions, funnelStepsVariants, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, useDataTable };
|
|
2095
|
+
export { AppShell, DashboardCard, DashboardCardAction, DashboardCardContent, DashboardCardDescription, DashboardCardFooter, DashboardCardHeader, DashboardCardPreset, DashboardCardSkeleton, DashboardCardTitle, DataTable, DataTableColumnVisibility, DataTableContent, DataTablePagination, DataTablePreset, DataTableToolbar, DateRangePicker, EChart, FilterBar, FilterBarActiveChips, FilterBarClearButton, FilterBarMultiSelect, FilterBarPreset, FilterBarSelect, FunnelSteps, MetricUnit, MetricValue, MultiSelect, PageShell, PageShellActions, PageShellContent, PageShellDescription, PageShellHeader, PageShellHeaderEnd, PageShellHeading, PageShellMeta, PageShellSummary, PageShellSummaryCard, PageShellTitle, Placeholder, SearchableSelect, SectionHeader, SegmentedControl, Sparkline, StatusBadge, TrendIndicator, defaultPresets, flattenOptions, funnelStepsVariants, isGroupedOptions, metricValueVariants, pageShellSummaryCardVariants, useDataTable };
|
|
1982
2096
|
//# sourceMappingURL=index.js.map
|
|
1983
2097
|
//# sourceMappingURL=index.js.map
|