@squadbase/vantage 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -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-7IPAXPPY.js → chunk-EHPJXDJU.js} +2 -2
- package/dist/chunk-EHPJXDJU.js.map +1 -0
- package/dist/{chunk-WQZYXXQW.js → chunk-JC6MT5UU.js} +26 -3
- package/dist/chunk-JC6MT5UU.js.map +1 -0
- package/dist/{chunk-5L2MH2NG.js → chunk-UHZ7XSAN.js} +3 -3
- 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.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +109 -22
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- 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.js.map +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.js +1 -1
- 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.d.ts +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 +133 -0
- package/docs/en/cli-reference.md +1 -1
- package/docs/en/components.md +2 -2
- package/docs/en/parts/echart.md +18 -11
- package/docs/en/routing.md +0 -4
- package/docs/en/ui/select.md +16 -10
- package/docs/index.json +27 -5
- package/docs/ja/agent-skills.md +13 -9
- package/docs/ja/changelog.md +124 -0
- package/docs/ja/cli-reference.md +1 -1
- package/docs/ja/components.md +2 -2
- package/docs/ja/parts/echart.md +16 -9
- package/docs/ja/routing.md +0 -4
- package/docs/ja/ui/select.md +17 -10
- package/package.json +1 -1
- package/skills/vantage-add-feature/SKILL.md +0 -1
- package/skills/vantage-app/SKILL.md +65 -236
- package/skills/vantage-pitfalls/SKILL.md +21 -24
- package/templates/AGENTS.md +48 -26
- package/dist/chunk-5L2MH2NG.js.map +0 -1
- package/dist/chunk-7IPAXPPY.js.map +0 -1
- package/dist/chunk-WQZYXXQW.js.map +0 -1
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createQueryClient } from '../chunk-DTDVSFRY.js';
|
|
2
|
-
import { setRoutes } from '../chunk-
|
|
2
|
+
import { setRoutes } from '../chunk-EHPJXDJU.js';
|
|
3
3
|
import { StrictMode, Component } from 'react';
|
|
4
4
|
import { createRoot } from 'react-dom/client';
|
|
5
5
|
import { RouterProvider, createRootRoute, createRoute, createRouter, Outlet, lazyRouteComponent } from '@tanstack/react-router';
|
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,KAA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,EAAgC;AAGxD,EAAA,SAAA,CAAU,QAAQ,CAAA;AAElB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,WAAA,CAAY,QAAQ,CAAA;AACvC,EAAA,MAAM,cAAc,iBAAA,EAAkB;AAItC,EAAA,MAAM,eAAe,QAAA,CAAS,KAAA;AAE9B,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,IAAI;AAEF,MAAA,MAAM,OAAA,GAAiB,MAAA,CAAO,KAAA,EAAO,OAAA,IAAW,EAAC;AACjD,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 { setRoutes } from \"../router/registry.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 // 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
|
+
{"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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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"]}
|
|
@@ -260,7 +260,13 @@ interface EChartProps {
|
|
|
260
260
|
*/
|
|
261
261
|
height?: string | number;
|
|
262
262
|
loading?: boolean;
|
|
263
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* `echarts.init` にそのまま渡すテーマ(名前または登録済みテーマオブジェクト)。
|
|
265
|
+
*
|
|
266
|
+
* 渡すとデザイントークン追従は**完全に無効**になり、明暗の切り替えにも追従しなく
|
|
267
|
+
* なる。系列色だけ変えたいなら `option.color` を使う ― option はテーマより優先
|
|
268
|
+
* されるので、軸・凡例・ツールチップのトークン追従は残る。
|
|
269
|
+
*/
|
|
264
270
|
theme?: string | object;
|
|
265
271
|
onEvents?: Record<string, (params: unknown) => void>;
|
|
266
272
|
ariaLabel?: string;
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-JC6MT5UU.js';
|
|
2
2
|
import { cn } from '../chunk-A2UUGASH.js';
|
|
3
|
-
import { forwardRef, useRef, useState, useEffect, useCallback, Fragment, createContext,
|
|
3
|
+
import { forwardRef, useRef, useState, useEffect, useMemo, useCallback, Fragment, createContext, useId, useContext } from 'react';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
6
6
|
import { Check, Copy, Download, Search, ArrowUp, ArrowDown, ArrowUpDown, Columns3, CalendarIcon, ChevronDownIcon, Minus, ChevronRight, XIcon, LoaderIcon, CheckIcon, ChevronDown, X } from 'lucide-react';
|
|
@@ -183,7 +183,6 @@ function NavSelect({
|
|
|
183
183
|
return /* @__PURE__ */ jsxs(
|
|
184
184
|
Select,
|
|
185
185
|
{
|
|
186
|
-
items: Object.fromEntries(allItems.map((item) => [item.href, item.label])),
|
|
187
186
|
value: currentValue,
|
|
188
187
|
onValueChange: (href) => {
|
|
189
188
|
if (href !== null) onNavigate(href);
|
|
@@ -474,6 +473,84 @@ function DashboardCardPreset({
|
|
|
474
473
|
footer && /* @__PURE__ */ jsx(DashboardCardFooter, { className: footerClassName, children: footer })
|
|
475
474
|
] });
|
|
476
475
|
}
|
|
476
|
+
|
|
477
|
+
// src/components/chart-theme.ts
|
|
478
|
+
var SERIES_TOKENS = ["--chart-1", "--chart-2", "--chart-3", "--chart-4", "--chart-5"];
|
|
479
|
+
var normalizeContext;
|
|
480
|
+
function toCanvasColor(value) {
|
|
481
|
+
const raw = value.trim();
|
|
482
|
+
if (!raw) return null;
|
|
483
|
+
if (normalizeContext === void 0) {
|
|
484
|
+
normalizeContext = document.createElement("canvas").getContext("2d");
|
|
485
|
+
}
|
|
486
|
+
const ctx = normalizeContext;
|
|
487
|
+
if (!ctx) return raw;
|
|
488
|
+
ctx.fillStyle = "#000000";
|
|
489
|
+
ctx.fillStyle = raw;
|
|
490
|
+
const onBlack = ctx.fillStyle;
|
|
491
|
+
ctx.fillStyle = "#ffffff";
|
|
492
|
+
ctx.fillStyle = raw;
|
|
493
|
+
return onBlack === ctx.fillStyle ? onBlack : null;
|
|
494
|
+
}
|
|
495
|
+
function readChartTokens(el) {
|
|
496
|
+
if (typeof document === "undefined") return null;
|
|
497
|
+
const target = document.documentElement;
|
|
498
|
+
if (!target) return null;
|
|
499
|
+
const styles = getComputedStyle(target);
|
|
500
|
+
const read = (name) => toCanvasColor(styles.getPropertyValue(name));
|
|
501
|
+
const series = [];
|
|
502
|
+
for (const token of SERIES_TOKENS) {
|
|
503
|
+
const color = read(token);
|
|
504
|
+
if (color) series.push(color);
|
|
505
|
+
}
|
|
506
|
+
return {
|
|
507
|
+
series,
|
|
508
|
+
foreground: read("--foreground"),
|
|
509
|
+
mutedForeground: read("--muted-foreground"),
|
|
510
|
+
border: read("--border"),
|
|
511
|
+
popover: read("--popover"),
|
|
512
|
+
popoverForeground: read("--popover-foreground")
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function sameChartTokens(a, b) {
|
|
516
|
+
if (a === b) return true;
|
|
517
|
+
if (!a || !b) return false;
|
|
518
|
+
return a.series.length === b.series.length && a.series.every((color, i) => color === b.series[i]) && a.foreground === b.foreground && a.mutedForeground === b.mutedForeground && a.border === b.border && a.popover === b.popover && a.popoverForeground === b.popoverForeground;
|
|
519
|
+
}
|
|
520
|
+
function axisTheme(tokens, splitLine) {
|
|
521
|
+
const line = tokens.border ?? void 0;
|
|
522
|
+
return {
|
|
523
|
+
axisLine: { show: true, lineStyle: { color: line } },
|
|
524
|
+
axisTick: { show: true, lineStyle: { color: line } },
|
|
525
|
+
axisLabel: { show: true, color: tokens.mutedForeground ?? void 0 },
|
|
526
|
+
splitLine: { show: splitLine, lineStyle: { color: line ? [line] : void 0 } },
|
|
527
|
+
splitArea: { show: false }
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
function buildChartTheme(tokens) {
|
|
531
|
+
const text = tokens.foreground ?? void 0;
|
|
532
|
+
const muted = tokens.mutedForeground ?? void 0;
|
|
533
|
+
const line = tokens.border ?? void 0;
|
|
534
|
+
return {
|
|
535
|
+
// Let the page background show through: charts sit on cards, not on a canvas.
|
|
536
|
+
backgroundColor: "transparent",
|
|
537
|
+
...tokens.series.length > 0 ? { color: tokens.series } : {},
|
|
538
|
+
textStyle: { color: text },
|
|
539
|
+
title: { textStyle: { color: text }, subtextStyle: { color: muted } },
|
|
540
|
+
legend: { textStyle: { color: muted } },
|
|
541
|
+
categoryAxis: axisTheme(tokens, false),
|
|
542
|
+
valueAxis: axisTheme(tokens, true),
|
|
543
|
+
logAxis: axisTheme(tokens, true),
|
|
544
|
+
timeAxis: axisTheme(tokens, true),
|
|
545
|
+
tooltip: {
|
|
546
|
+
backgroundColor: tokens.popover ?? void 0,
|
|
547
|
+
borderColor: line,
|
|
548
|
+
borderWidth: 1,
|
|
549
|
+
textStyle: { color: tokens.popoverForeground ?? void 0 },
|
|
550
|
+
axisPointer: { lineStyle: { color: line }, crossStyle: { color: line } }
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
}
|
|
477
554
|
var EChart = forwardRef(function EChart2({
|
|
478
555
|
option,
|
|
479
556
|
height,
|
|
@@ -488,10 +565,33 @@ var EChart = forwardRef(function EChart2({
|
|
|
488
565
|
const containerRef = useRef(null);
|
|
489
566
|
const [instance, setInstance] = useState(null);
|
|
490
567
|
const [copied, setCopied] = useState(false);
|
|
568
|
+
const [tokens, setTokens] = useState(() => readChartTokens());
|
|
569
|
+
useEffect(() => {
|
|
570
|
+
if (theme !== void 0) return;
|
|
571
|
+
const sync = () => {
|
|
572
|
+
setTokens((prev) => {
|
|
573
|
+
const next = readChartTokens();
|
|
574
|
+
return sameChartTokens(prev, next) ? prev : next;
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
sync();
|
|
578
|
+
const observer = new MutationObserver(sync);
|
|
579
|
+
const attributeFilter = ["class", "style", "data-theme"];
|
|
580
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter });
|
|
581
|
+
if (document.body) observer.observe(document.body, { attributes: true, attributeFilter });
|
|
582
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
583
|
+
media.addEventListener("change", sync);
|
|
584
|
+
return () => {
|
|
585
|
+
observer.disconnect();
|
|
586
|
+
media.removeEventListener("change", sync);
|
|
587
|
+
};
|
|
588
|
+
}, [theme]);
|
|
589
|
+
const autoTheme = useMemo(() => tokens ? buildChartTheme(tokens) : void 0, [tokens]);
|
|
590
|
+
const resolvedTheme = theme ?? autoTheme;
|
|
491
591
|
useEffect(() => {
|
|
492
592
|
const container = containerRef.current;
|
|
493
593
|
if (!container) return;
|
|
494
|
-
const inst = echarts.init(container,
|
|
594
|
+
const inst = echarts.init(container, resolvedTheme, { renderer: "canvas" });
|
|
495
595
|
setInstance(inst);
|
|
496
596
|
const observer = new ResizeObserver(() => inst.resize());
|
|
497
597
|
observer.observe(container);
|
|
@@ -499,7 +599,7 @@ var EChart = forwardRef(function EChart2({
|
|
|
499
599
|
observer.disconnect();
|
|
500
600
|
inst.dispose();
|
|
501
601
|
};
|
|
502
|
-
}, [
|
|
602
|
+
}, [resolvedTheme]);
|
|
503
603
|
useEffect(() => {
|
|
504
604
|
if (!instance) return;
|
|
505
605
|
instance.setOption(option, { notMerge: true, lazyUpdate: true });
|
|
@@ -1181,7 +1281,6 @@ var DataTablePagination = forwardRef(
|
|
|
1181
1281
|
/* @__PURE__ */ jsxs(
|
|
1182
1282
|
Select,
|
|
1183
1283
|
{
|
|
1184
|
-
items: Object.fromEntries(pageSizeOptions.map((size) => [String(size), `${size}\u4EF6`])),
|
|
1185
1284
|
value: String(currentPageSize),
|
|
1186
1285
|
onValueChange: (value) => table.setPageSize(Number(value)),
|
|
1187
1286
|
children: [
|
|
@@ -1326,22 +1425,10 @@ function FilterBarSelect({
|
|
|
1326
1425
|
}) {
|
|
1327
1426
|
const { value, onChange } = useFilterBar();
|
|
1328
1427
|
const handleChange = (selected) => onChange({ ...value, [filterKey]: selected ?? void 0 });
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
);
|
|
1333
|
-
return /* @__PURE__ */ jsxs(
|
|
1334
|
-
Select,
|
|
1335
|
-
{
|
|
1336
|
-
items,
|
|
1337
|
-
value: value[filterKey] ?? "",
|
|
1338
|
-
onValueChange: handleChange,
|
|
1339
|
-
children: [
|
|
1340
|
-
/* @__PURE__ */ jsx(SelectTrigger, { size: "sm", "aria-label": label, "data-slot": "filter-bar-select", className, children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? label }) }),
|
|
1341
|
-
/* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, disabled: option.disabled, children: option.label }, option.value)) })
|
|
1342
|
-
]
|
|
1343
|
-
}
|
|
1344
|
-
);
|
|
1428
|
+
return /* @__PURE__ */ jsxs(Select, { value: value[filterKey] ?? "", onValueChange: handleChange, children: [
|
|
1429
|
+
/* @__PURE__ */ jsx(SelectTrigger, { size: "sm", "aria-label": label, "data-slot": "filter-bar-select", className, children: /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? label }) }),
|
|
1430
|
+
/* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, disabled: option.disabled, children: option.label }, option.value)) })
|
|
1431
|
+
] });
|
|
1345
1432
|
}
|
|
1346
1433
|
FilterBarSelect.displayName = "FilterBarSelect";
|
|
1347
1434
|
function FilterBarMultiSelect({
|