@lovrozagar/flare 0.1.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/LICENSE +21 -0
- package/README.md +11 -0
- package/package.json +146 -0
- package/scripts/download-fonts.ts +136 -0
- package/scripts/populate-fonts.ts +721 -0
- package/src/await.ts +2 -0
- package/src/boundaries/index.ts +99 -0
- package/src/broadcast/channel.ts +65 -0
- package/src/broadcast/context.ts +12 -0
- package/src/broadcast/index.ts +75 -0
- package/src/broadcast/provider.tsx +7 -0
- package/src/build-location.ts +2 -0
- package/src/caches/index.ts +384 -0
- package/src/client/index.ts +75 -0
- package/src/client.tsx +2 -0
- package/src/codegen/index.ts +41 -0
- package/src/components/await.tsx +140 -0
- package/src/components/dev-error-overlay.tsx +154 -0
- package/src/components/direction-script.tsx +22 -0
- package/src/components/index.ts +150 -0
- package/src/components/locale-script.tsx +26 -0
- package/src/components/reset-css.tsx +14 -0
- package/src/components/ssr-context.tsx +37 -0
- package/src/components/theme-script.tsx +22 -0
- package/src/components/view-transition-css.tsx +21 -0
- package/src/config/index.ts +84 -0
- package/src/create-client-only-fn.ts +1 -0
- package/src/create-isomorphic-fn.ts +2 -0
- package/src/create-layout.ts +1 -0
- package/src/create-page.ts +1 -0
- package/src/create-path-segment.ts +1 -0
- package/src/create-query-client-getter.ts +2 -0
- package/src/create-root-layout.ts +1 -0
- package/src/create-router.ts +8 -0
- package/src/create-server-only-fn.ts +1 -0
- package/src/dedupe/index.ts +151 -0
- package/src/defer/index.ts +82 -0
- package/src/direction/index.tsx +163 -0
- package/src/direction.ts +3 -0
- package/src/duration/index.ts +18 -0
- package/src/env-fn/index.ts +101 -0
- package/src/env-fn.ts +2 -0
- package/src/errors/index.ts +166 -0
- package/src/fonts/abeezee.ts +50 -0
- package/src/fonts/abel.ts +26 -0
- package/src/fonts/abril-fatface.ts +34 -0
- package/src/fonts/acme.ts +26 -0
- package/src/fonts/advent-pro.ts +92 -0
- package/src/fonts/alegreya-sans.ts +228 -0
- package/src/fonts/alegreya.ts +228 -0
- package/src/fonts/alex-brush.ts +42 -0
- package/src/fonts/alfa-slab-one.ts +42 -0
- package/src/fonts/alice.ts +48 -0
- package/src/fonts/amatic-sc.ts +94 -0
- package/src/fonts/amiri.ts +114 -0
- package/src/fonts/antic-slab.ts +26 -0
- package/src/fonts/anton.ts +42 -0
- package/src/fonts/archivo-black.ts +34 -0
- package/src/fonts/archivo-narrow.ts +114 -0
- package/src/fonts/archivo.ts +66 -0
- package/src/fonts/arimo.ts +256 -0
- package/src/fonts/arvo.ts +50 -0
- package/src/fonts/asap.ts +66 -0
- package/src/fonts/assistant.ts +64 -0
- package/src/fonts/baloo-2.ts +82 -0
- package/src/fonts/barlow-condensed.ts +114 -0
- package/src/fonts/barlow-semi-condensed.ts +114 -0
- package/src/fonts/barlow.ts +114 -0
- package/src/fonts/be-vietnam-pro.ts +114 -0
- package/src/fonts/bebas-neue.ts +34 -0
- package/src/fonts/besley.ts +82 -0
- package/src/fonts/biorhyme.ts +50 -0
- package/src/fonts/bitter.ts +94 -0
- package/src/fonts/black-ops-one.ts +49 -0
- package/src/fonts/bree-serif.ts +34 -0
- package/src/fonts/bricolage-grotesque.ts +66 -0
- package/src/fonts/cabin.ts +114 -0
- package/src/fonts/cairo.ts +66 -0
- package/src/fonts/cardo.ts +193 -0
- package/src/fonts/catamaran.ts +41 -0
- package/src/fonts/caveat.ts +78 -0
- package/src/fonts/chakra-petch.ts +142 -0
- package/src/fonts/chivo.ts +66 -0
- package/src/fonts/cinzel.ts +50 -0
- package/src/fonts/comfortaa.ts +109 -0
- package/src/fonts/commissioner.ts +64 -0
- package/src/fonts/component.tsx +27 -0
- package/src/fonts/cormorant-garamond.ts +171 -0
- package/src/fonts/cormorant.ts +170 -0
- package/src/fonts/courgette.ts +34 -0
- package/src/fonts/courier-prime.ts +82 -0
- package/src/fonts/create-font.ts +47 -0
- package/src/fonts/create-registry-font.ts +40 -0
- package/src/fonts/crete-round.ts +50 -0
- package/src/fonts/crimson-text.ts +114 -0
- package/src/fonts/css.ts +86 -0
- package/src/fonts/dancing-script.ts +66 -0
- package/src/fonts/dm-mono.ts +50 -0
- package/src/fonts/dm-sans.ts +50 -0
- package/src/fonts/dm-serif-display.ts +50 -0
- package/src/fonts/domine.ts +50 -0
- package/src/fonts/dosis.ts +66 -0
- package/src/fonts/eb-garamond.ts +228 -0
- package/src/fonts/eczar.ts +94 -0
- package/src/fonts/encode-sans.ts +42 -0
- package/src/fonts/epilogue.ts +66 -0
- package/src/fonts/exo-2.ts +94 -0
- package/src/fonts/exo.ts +66 -0
- package/src/fonts/figtree.ts +82 -0
- package/src/fonts/fira-code.ts +121 -0
- package/src/fonts/fira-sans-condensed.ts +228 -0
- package/src/fonts/fira-sans.ts +228 -0
- package/src/fonts/fjalla-one.ts +49 -0
- package/src/fonts/font-urls.gen.json +1962 -0
- package/src/fonts/fraunces.ts +66 -0
- package/src/fonts/fredoka.ts +64 -0
- package/src/fonts/gelasio.ts +114 -0
- package/src/fonts/gloria-hallelujah.ts +34 -0
- package/src/fonts/gothic-a1.ts +124 -0
- package/src/fonts/great-vibes.ts +64 -0
- package/src/fonts/gudea.ts +66 -0
- package/src/fonts/heebo.ts +57 -0
- package/src/fonts/hind-siliguri.ts +66 -0
- package/src/fonts/hind.ts +66 -0
- package/src/fonts/ibm-plex-mono.ts +172 -0
- package/src/fonts/ibm-plex-sans-arabic.ts +80 -0
- package/src/fonts/ibm-plex-sans.ts +199 -0
- package/src/fonts/ibm-plex-serif.ts +171 -0
- package/src/fonts/inconsolata.ts +66 -0
- package/src/fonts/index.ts +4 -0
- package/src/fonts/indie-flower.ts +34 -0
- package/src/fonts/instrument-sans.ts +82 -0
- package/src/fonts/instrument-serif.ts +50 -0
- package/src/fonts/inter-display.ts +52 -0
- package/src/fonts/inter-tight.ts +124 -0
- package/src/fonts/inter.ts +123 -0
- package/src/fonts/jetbrains-mono.ts +199 -0
- package/src/fonts/josefin-sans.ts +114 -0
- package/src/fonts/josefin-slab.ts +50 -0
- package/src/fonts/jost.ts +64 -0
- package/src/fonts/kalam.ts +66 -0
- package/src/fonts/kanit.ts +142 -0
- package/src/fonts/karla.ts +82 -0
- package/src/fonts/khand.ts +66 -0
- package/src/fonts/lato.ts +82 -0
- package/src/fonts/league-spartan.ts +42 -0
- package/src/fonts/lexend-deca.ts +42 -0
- package/src/fonts/lexend.ts +42 -0
- package/src/fonts/libre-baskerville.ts +82 -0
- package/src/fonts/libre-franklin.ts +95 -0
- package/src/fonts/lilita-one.ts +34 -0
- package/src/fonts/lobster-two.ts +50 -0
- package/src/fonts/lobster.ts +56 -0
- package/src/fonts/lora.ts +235 -0
- package/src/fonts/m-plus-rounded-1c.ts +138 -0
- package/src/fonts/manrope.ts +109 -0
- package/src/fonts/maven-pro.ts +66 -0
- package/src/fonts/merriweather-sans.ts +142 -0
- package/src/fonts/merriweather.ts +171 -0
- package/src/fonts/montserrat-alternates.ts +171 -0
- package/src/fonts/montserrat.ts +94 -0
- package/src/fonts/mukta.ts +66 -0
- package/src/fonts/mulish.ts +170 -0
- package/src/fonts/nanum-gothic.ts +34 -0
- package/src/fonts/nanum-myeongjo.ts +34 -0
- package/src/fonts/neuton.ts +66 -0
- package/src/fonts/newsreader.ts +114 -0
- package/src/fonts/noticia-text.ts +114 -0
- package/src/fonts/noto-sans-arabic.ts +58 -0
- package/src/fonts/noto-sans-hk.ts +49 -0
- package/src/fonts/noto-sans-jp.ts +49 -0
- package/src/fonts/noto-sans-kr.ts +49 -0
- package/src/fonts/noto-sans-sc.ts +49 -0
- package/src/fonts/noto-sans-tc.ts +49 -0
- package/src/fonts/noto-sans.ts +140 -0
- package/src/fonts/noto-serif-jp.ts +80 -0
- package/src/fonts/noto-serif.ts +140 -0
- package/src/fonts/nunito-sans.ts +170 -0
- package/src/fonts/nunito.ts +170 -0
- package/src/fonts/old-standard-tt.ts +133 -0
- package/src/fonts/onest.ts +48 -0
- package/src/fonts/open-sans.ts +340 -0
- package/src/fonts/orbitron.ts +34 -0
- package/src/fonts/oswald.ts +94 -0
- package/src/fonts/outfit.ts +34 -0
- package/src/fonts/overpass.ts +94 -0
- package/src/fonts/oxygen.ts +50 -0
- package/src/fonts/pacifico.ts +56 -0
- package/src/fonts/passion-one.ts +50 -0
- package/src/fonts/pathway-gothic-one.ts +34 -0
- package/src/fonts/permanent-marker.ts +26 -0
- package/src/fonts/philosopher.ts +172 -0
- package/src/fonts/play.ts +109 -0
- package/src/fonts/playfair-display.ts +142 -0
- package/src/fonts/plus-jakarta-sans.ts +142 -0
- package/src/fonts/poppins.ts +114 -0
- package/src/fonts/prompt.ts +142 -0
- package/src/fonts/pt-sans-narrow.ts +78 -0
- package/src/fonts/pt-sans.ts +138 -0
- package/src/fonts/pt-serif.ts +138 -0
- package/src/fonts/public-sans.ts +66 -0
- package/src/fonts/questrial.ts +42 -0
- package/src/fonts/quicksand.ts +66 -0
- package/src/fonts/rajdhani.ts +66 -0
- package/src/fonts/raleway.ts +94 -0
- package/src/fonts/recursive.ts +80 -0
- package/src/fonts/red-hat-display.ts +82 -0
- package/src/fonts/red-rose.ts +66 -0
- package/src/fonts/registry.gen.ts +173 -0
- package/src/fonts/righteous.ts +34 -0
- package/src/fonts/roboto-condensed.ts +124 -0
- package/src/fonts/roboto-flex.ts +64 -0
- package/src/fonts/roboto-mono.ts +199 -0
- package/src/fonts/roboto-slab.ts +72 -0
- package/src/fonts/roboto.ts +156 -0
- package/src/fonts/rokkitt.ts +66 -0
- package/src/fonts/rubik.ts +199 -0
- package/src/fonts/sacramento.ts +34 -0
- package/src/fonts/saira.ts +66 -0
- package/src/fonts/sarabun.ts +142 -0
- package/src/fonts/satisfy.ts +26 -0
- package/src/fonts/sawarabi-mincho.ts +41 -0
- package/src/fonts/shadows-into-light.ts +34 -0
- package/src/fonts/signika-negative.ts +66 -0
- package/src/fonts/signika.ts +66 -0
- package/src/fonts/slabo-27px.ts +34 -0
- package/src/fonts/sora.ts +50 -0
- package/src/fonts/source-code-pro.ts +228 -0
- package/src/fonts/source-sans-3.ts +228 -0
- package/src/fonts/source-serif-4.ts +199 -0
- package/src/fonts/space-grotesk.ts +66 -0
- package/src/fonts/space-mono.ts +114 -0
- package/src/fonts/spectral.ts +170 -0
- package/src/fonts/tajawal.ts +50 -0
- package/src/fonts/teko.ts +66 -0
- package/src/fonts/tenor-sans.ts +41 -0
- package/src/fonts/tinos.ts +256 -0
- package/src/fonts/titillium-web.ts +82 -0
- package/src/fonts/types.ts +43 -0
- package/src/fonts/ubuntu-condensed.ts +63 -0
- package/src/fonts/ubuntu-mono.ts +195 -0
- package/src/fonts/ubuntu.ts +195 -0
- package/src/fonts/unbounded.ts +94 -0
- package/src/fonts/unicode-ranges.gen.ts +28 -0
- package/src/fonts/urbanist.ts +50 -0
- package/src/fonts/varela-round.ts +49 -0
- package/src/fonts/vollkorn.ts +199 -0
- package/src/fonts/work-sans.ts +66 -0
- package/src/fonts/yanone-kaffeesatz.ts +128 -0
- package/src/fonts/yantramanav.ts +66 -0
- package/src/fonts/yellowtail.ts +34 -0
- package/src/fonts/young-serif.ts +34 -0
- package/src/fonts/zen-kaku-gothic-new.ts +64 -0
- package/src/fonts/zilla-slab.ts +82 -0
- package/src/form/index.tsx +205 -0
- package/src/generators/index.ts +1589 -0
- package/src/head-client/index.ts +649 -0
- package/src/history/index.ts +210 -0
- package/src/hooks.ts +61 -0
- package/src/hydrate/index.tsx +381 -0
- package/src/hydration/index.ts +187 -0
- package/src/i18n/index.ts +250 -0
- package/src/i18n/jsx.tsx +42 -0
- package/src/i18n/message-format.ts +174 -0
- package/src/image/index.tsx +473 -0
- package/src/image.ts +12 -0
- package/src/intercept-outlet/index.tsx +18 -0
- package/src/intercept-outlet.ts +2 -0
- package/src/internal/index.ts +143 -0
- package/src/internal/once-idle.ts +24 -0
- package/src/internal.ts +12 -0
- package/src/lazy/index.tsx +205 -0
- package/src/link/index.tsx +367 -0
- package/src/loader-pipeline/index.ts +639 -0
- package/src/locale/index.tsx +137 -0
- package/src/locale.ts +3 -0
- package/src/logger.ts +22 -0
- package/src/middleware/builtins/api-proxy.ts +64 -0
- package/src/middleware/builtins/cdn-proxy.ts +58 -0
- package/src/middleware/builtins/i18n.ts +256 -0
- package/src/middleware/builtins/keepalive.ts +24 -0
- package/src/middleware/builtins/markdown-negotiation.ts +141 -0
- package/src/middleware/builtins/static-assets.ts +32 -0
- package/src/middleware/index.ts +223 -0
- package/src/module-graph/index.ts +181 -0
- package/src/mount/index.ts +146 -0
- package/src/navigate.ts +1 -0
- package/src/navigation/index.ts +1278 -0
- package/src/navigation/types.ts +59 -0
- package/src/navigation-progress/index.tsx +247 -0
- package/src/navigation-progress.ts +1 -0
- package/src/ndjson-client/index.ts +376 -0
- package/src/ndjson-server/index.ts +284 -0
- package/src/outlet/index.tsx +633 -0
- package/src/outlet/types.ts +243 -0
- package/src/plugins/css-transform.ts +70 -0
- package/src/plugins/dev-cdn-cache.ts +454 -0
- package/src/plugins/dev-dashboard/client.tsx +2603 -0
- package/src/plugins/dev-dashboard/match-route-tree.ts +159 -0
- package/src/plugins/dev-dashboard/plugin.ts +404 -0
- package/src/plugins/dev-prerender.ts +168 -0
- package/src/plugins/dev-server.ts +327 -0
- package/src/plugins/generate-watch.ts +32 -0
- package/src/plugins/image-plugin.ts +171 -0
- package/src/plugins/index.ts +445 -0
- package/src/plugins/options.ts +37 -0
- package/src/plugins/parse-utils.ts +59 -0
- package/src/plugins/prerender-plugin.ts +144 -0
- package/src/plugins/purge.ts +242 -0
- package/src/plugins/server-fn.ts +641 -0
- package/src/plugins/service-worker.ts +225 -0
- package/src/plugins/solid-jsx.d.ts +12 -0
- package/src/plugins/sx-ast/atomic.ts +166 -0
- package/src/plugins/sx-ast/evaluator.ts +235 -0
- package/src/plugins/sx-ast/index.ts +372 -0
- package/src/plugins/sx-ast/parser.ts +22 -0
- package/src/plugins/sx-ast/rewrite.ts +763 -0
- package/src/plugins/sx.d.ts +14 -0
- package/src/plugins/tw-compile.ts +240 -0
- package/src/plugins/types.ts +41 -0
- package/src/plugins/virtual.d.ts +110 -0
- package/src/plugins/virtual.ts +184 -0
- package/src/preload/index.ts +77 -0
- package/src/prerender/index.ts +431 -0
- package/src/query-client/index.tsx +168 -0
- package/src/registry/index.ts +88 -0
- package/src/reset-css.ts +1 -0
- package/src/revalidation/index.ts +84 -0
- package/src/rewrite/index.ts +83 -0
- package/src/route-builder/create-layout.ts +655 -0
- package/src/route-builder/create-page.ts +806 -0
- package/src/route-builder/create-path-segment.ts +34 -0
- package/src/route-builder/create-root-layout.ts +608 -0
- package/src/route-builder/index.ts +49 -0
- package/src/route-builder/register.ts +242 -0
- package/src/route-builder/types.ts +294 -0
- package/src/router-config/index.ts +91 -0
- package/src/router-primitives/index.ts +25 -0
- package/src/router-primitives/location.ts +29 -0
- package/src/router-primitives/match-id.ts +111 -0
- package/src/router-primitives/paths.ts +109 -0
- package/src/router-primitives/tree.ts +243 -0
- package/src/router-primitives/types.ts +74 -0
- package/src/router.ts +31 -0
- package/src/search-engine/bing.ts +32 -0
- package/src/search-engine/google-jwt.ts +95 -0
- package/src/search-engine/google.ts +139 -0
- package/src/search-engine/index-now.ts +64 -0
- package/src/search-engine/index.ts +12 -0
- package/src/security/index.ts +230 -0
- package/src/server/index.ts +286 -0
- package/src/server-context/browser.ts +113 -0
- package/src/server-context/index.ts +217 -0
- package/src/server-fn/index.ts +710 -0
- package/src/server-fn-query.ts +169 -0
- package/src/server-handler/etag.ts +51 -0
- package/src/server-handler/headers.ts +5 -0
- package/src/server-handler/index.ts +1664 -0
- package/src/server-handler/types.ts +24 -0
- package/src/server-handler/validate-static-params.ts +130 -0
- package/src/server.ts +2 -0
- package/src/service-worker/template.ts +153 -0
- package/src/service-worker-hook/index.ts +70 -0
- package/src/sitemap/index.ts +231 -0
- package/src/ssr/critical-css.ts +150 -0
- package/src/ssr/head-prefix.ts +65 -0
- package/src/ssr/head.ts +259 -0
- package/src/ssr/index.tsx +879 -0
- package/src/state-parser/index.ts +266 -0
- package/src/store/filesystem.ts +131 -0
- package/src/store/index.ts +29 -0
- package/src/styles/index.ts +1200 -0
- package/src/styles/sx-types.ts +11 -0
- package/src/testing/index.ts +251 -0
- package/src/testing.ts +2 -0
- package/src/theme/index.tsx +232 -0
- package/src/theme.ts +3 -0
- package/src/tracing/index.ts +4 -0
- package/src/tracing/noop.ts +13 -0
- package/src/tracing/otel.ts +37 -0
- package/src/tracing/timing.ts +34 -0
- package/src/tracing/types.ts +9 -0
- package/src/url/index.ts +140 -0
- package/src/use-router.ts +11 -0
- package/src/use-suspense-query.ts +2 -0
- package/src/validation/index.ts +57 -0
- package/src/view-transition-css.ts +1 -0
|
@@ -0,0 +1,2603 @@
|
|
|
1
|
+
import { createEffect, createMemo, createSignal, For, Match, onCleanup, Show, Switch } from "solid-js";
|
|
2
|
+
import { render } from "solid-js/web";
|
|
3
|
+
import type { LocaleMatch } from "../../router-primitives/tree.ts";
|
|
4
|
+
import { matchRouteTree } from "./match-route-tree.ts";
|
|
5
|
+
|
|
6
|
+
/* ── Types (mirror plugin.ts) ────────────────────────────────────────── */
|
|
7
|
+
|
|
8
|
+
interface RouteTreeNode {
|
|
9
|
+
auth: false | "optional" | true;
|
|
10
|
+
cache: Record<string, unknown>;
|
|
11
|
+
children: RouteTreeNode[];
|
|
12
|
+
filePath: string | null;
|
|
13
|
+
hasInput: boolean;
|
|
14
|
+
intercept?: Record<string, unknown>;
|
|
15
|
+
responseRoute: boolean;
|
|
16
|
+
segment: string;
|
|
17
|
+
type: "layout" | "page" | "path-segment" | "root-layout" | "segment";
|
|
18
|
+
urlPath: string;
|
|
19
|
+
virtualPath: string | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface RouteDef {
|
|
23
|
+
authenticateMode: false | "optional" | true;
|
|
24
|
+
cache: Record<string, unknown>;
|
|
25
|
+
exportName: string;
|
|
26
|
+
filePath: string;
|
|
27
|
+
hasInput: boolean;
|
|
28
|
+
intercept?: Record<string, unknown>;
|
|
29
|
+
responseRoute: boolean;
|
|
30
|
+
type: "layout" | "page" | "path-segment" | "root-layout";
|
|
31
|
+
virtualPath: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface ServerFnInfo {
|
|
35
|
+
authenticate: boolean;
|
|
36
|
+
file: string;
|
|
37
|
+
id: string;
|
|
38
|
+
method: string;
|
|
39
|
+
name: string;
|
|
40
|
+
stream: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface ApiData {
|
|
44
|
+
builderChains: Record<string, string[]>;
|
|
45
|
+
defs: RouteDef[];
|
|
46
|
+
localeMatch?: LocaleMatch;
|
|
47
|
+
routeTree: RouteTreeNode[];
|
|
48
|
+
serverFunctions: ServerFnInfo[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface MatchedRoute {
|
|
52
|
+
node: RouteTreeNode;
|
|
53
|
+
params: Record<string, string>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface RuntimeMatch {
|
|
57
|
+
loaderData: unknown;
|
|
58
|
+
preloaderContext?: Record<string, unknown>;
|
|
59
|
+
type: string;
|
|
60
|
+
virtualPath: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface CachedMatchInfo {
|
|
64
|
+
data: unknown;
|
|
65
|
+
headConfig?: Record<string, unknown>;
|
|
66
|
+
matchId: string;
|
|
67
|
+
updatedAt: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface DevtoolsActions {
|
|
71
|
+
clearError: () => void;
|
|
72
|
+
clearPrefetchCache: () => void;
|
|
73
|
+
getCacheStats: () => {
|
|
74
|
+
entries: { age: number; matchId: string }[];
|
|
75
|
+
matchCount: number;
|
|
76
|
+
prefetchCount: number;
|
|
77
|
+
};
|
|
78
|
+
invalidate: (options?: { revalidate?: boolean }) => void;
|
|
79
|
+
navigate: (options: { params?: Record<string, unknown>; replace?: boolean; to: string }) => Promise<void>;
|
|
80
|
+
prefetch: (options: { to: string }) => Promise<void>;
|
|
81
|
+
setError: (error: unknown) => void;
|
|
82
|
+
setNotFound: (v: boolean) => void;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare global {
|
|
86
|
+
interface Window {
|
|
87
|
+
__flare_devtools_actions__?: DevtoolsActions;
|
|
88
|
+
__flare_devtools_cache__?: CachedMatchInfo[];
|
|
89
|
+
__flare_devtools_matches__?: RuntimeMatch[];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ── Tabs ─────────────────────────────────────────────────────────────── */
|
|
94
|
+
|
|
95
|
+
type TabId = "actions" | "current" | "layouts" | "pages" | "root-layouts" | "segments" | "server-fns" | "tree";
|
|
96
|
+
|
|
97
|
+
const TABS: { id: TabId; label: string }[] = [
|
|
98
|
+
{ id: "current", label: "Current" },
|
|
99
|
+
{ id: "actions", label: "Global" },
|
|
100
|
+
{ id: "tree", label: "Tree" },
|
|
101
|
+
{ id: "pages", label: "Pages" },
|
|
102
|
+
{ id: "layouts", label: "Layouts" },
|
|
103
|
+
{ id: "root-layouts", label: "Root" },
|
|
104
|
+
{ id: "segments", label: "Segments" },
|
|
105
|
+
{ id: "server-fns", label: "Server Fns" },
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
const TAB_TO_DEF_TYPE: Record<string, RouteDef["type"]> = {
|
|
109
|
+
layouts: "layout",
|
|
110
|
+
pages: "page",
|
|
111
|
+
"root-layouts": "root-layout",
|
|
112
|
+
segments: "path-segment",
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/* ── Persistence ──────────────────────────────────────────────────────── */
|
|
116
|
+
|
|
117
|
+
const STORAGE_KEY = "__flare_devtools";
|
|
118
|
+
|
|
119
|
+
function loadState(): {
|
|
120
|
+
activeTab: TabId;
|
|
121
|
+
expandedNodes: string[];
|
|
122
|
+
sortCol: string;
|
|
123
|
+
sortDir: "asc" | "desc";
|
|
124
|
+
} {
|
|
125
|
+
try {
|
|
126
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
127
|
+
if (raw) {
|
|
128
|
+
const parsed = JSON.parse(raw) as Record<string, unknown>;
|
|
129
|
+
return {
|
|
130
|
+
activeTab: (parsed.activeTab as TabId) ?? "current",
|
|
131
|
+
expandedNodes: (parsed.expandedNodes as string[]) ?? [],
|
|
132
|
+
sortCol: (parsed.sortCol as string) ?? "name",
|
|
133
|
+
sortDir: (parsed.sortDir as "asc" | "desc") ?? "asc",
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
/* noop */
|
|
138
|
+
}
|
|
139
|
+
return { activeTab: "current", expandedNodes: [], sortCol: "name", sortDir: "asc" };
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function saveState(s: { activeTab: TabId; expandedNodes: string[]; sortCol: string; sortDir: string }): void {
|
|
143
|
+
try {
|
|
144
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(s));
|
|
145
|
+
} catch {
|
|
146
|
+
/* noop */
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* ── Badge helpers ────────────────────────────────────────────────────── */
|
|
151
|
+
|
|
152
|
+
function typeBadgeColor(type: string): string {
|
|
153
|
+
switch (type) {
|
|
154
|
+
case "page":
|
|
155
|
+
return "#fafafa";
|
|
156
|
+
case "layout":
|
|
157
|
+
return "#a1a1aa";
|
|
158
|
+
case "root-layout":
|
|
159
|
+
return "#3b82f6";
|
|
160
|
+
case "path-segment":
|
|
161
|
+
return "#71717a";
|
|
162
|
+
case "segment":
|
|
163
|
+
return "#52525b";
|
|
164
|
+
default:
|
|
165
|
+
return "#52525b";
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function typeBadgeLabel(type: string): string {
|
|
170
|
+
switch (type) {
|
|
171
|
+
case "page":
|
|
172
|
+
return "PAGE";
|
|
173
|
+
case "layout":
|
|
174
|
+
return "LYT";
|
|
175
|
+
case "root-layout":
|
|
176
|
+
return "ROOT";
|
|
177
|
+
case "path-segment":
|
|
178
|
+
return "SEG";
|
|
179
|
+
case "segment":
|
|
180
|
+
return "DIR";
|
|
181
|
+
default:
|
|
182
|
+
return type.toUpperCase();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* ── CSS ──────────────────────────────────────────────────────────────── */
|
|
187
|
+
|
|
188
|
+
const CSS = `
|
|
189
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
190
|
+
|
|
191
|
+
:host {
|
|
192
|
+
all: initial;
|
|
193
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
194
|
+
font-size: 13px;
|
|
195
|
+
color: #e4e4e7;
|
|
196
|
+
line-height: 1.4;
|
|
197
|
+
-webkit-font-smoothing: antialiased;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.toggle-btn {
|
|
201
|
+
position: fixed;
|
|
202
|
+
bottom: 16px;
|
|
203
|
+
left: 16px;
|
|
204
|
+
z-index: 2147483646;
|
|
205
|
+
width: 32px;
|
|
206
|
+
height: 32px;
|
|
207
|
+
border-radius: 2px;
|
|
208
|
+
border: 1px solid #27272a;
|
|
209
|
+
background: #09090b;
|
|
210
|
+
color: #71717a;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
|
|
216
|
+
font-size: 13px;
|
|
217
|
+
font-weight: 600;
|
|
218
|
+
font-family: inherit;
|
|
219
|
+
}
|
|
220
|
+
.toggle-btn:hover {
|
|
221
|
+
border-color: #3b82f6;
|
|
222
|
+
color: #fafafa;
|
|
223
|
+
}
|
|
224
|
+
.toggle-btn:active { opacity: 0.8; }
|
|
225
|
+
.toggle-btn.is-open {
|
|
226
|
+
display: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.overlay {
|
|
230
|
+
position: fixed;
|
|
231
|
+
inset: 0;
|
|
232
|
+
z-index: 2147483647;
|
|
233
|
+
background: rgba(0,0,0,0.6);
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.modal {
|
|
240
|
+
background: #09090b;
|
|
241
|
+
border: 1px solid #27272a;
|
|
242
|
+
border-radius: 2px;
|
|
243
|
+
width: min(1280px, calc(100vw - 48px));
|
|
244
|
+
height: calc(100vh - 96px);
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
overflow: hidden;
|
|
248
|
+
}
|
|
249
|
+
@media (max-width: 640px) {
|
|
250
|
+
.modal {
|
|
251
|
+
width: 100vw;
|
|
252
|
+
height: 100vh;
|
|
253
|
+
border-radius: 0;
|
|
254
|
+
border: none;
|
|
255
|
+
}
|
|
256
|
+
.overlay {
|
|
257
|
+
background: #09090b;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.header {
|
|
262
|
+
display: flex;
|
|
263
|
+
align-items: center;
|
|
264
|
+
gap: 0;
|
|
265
|
+
padding: 0;
|
|
266
|
+
border-bottom: 1px solid #27272a;
|
|
267
|
+
background: #09090b;
|
|
268
|
+
flex-shrink: 0;
|
|
269
|
+
}
|
|
270
|
+
@media (max-width: 640px) {
|
|
271
|
+
.header { padding: 0; gap: 0; }
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.tab-bar {
|
|
275
|
+
display: flex;
|
|
276
|
+
gap: 0;
|
|
277
|
+
flex: 1;
|
|
278
|
+
overflow-x: auto;
|
|
279
|
+
scrollbar-width: none;
|
|
280
|
+
}
|
|
281
|
+
.tab-bar::-webkit-scrollbar { display: none; }
|
|
282
|
+
|
|
283
|
+
.tab-btn {
|
|
284
|
+
padding: 8px 14px;
|
|
285
|
+
border-radius: 0;
|
|
286
|
+
border: none;
|
|
287
|
+
border-bottom: 2px solid transparent;
|
|
288
|
+
background: transparent;
|
|
289
|
+
color: #52525b;
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
font-size: 12px;
|
|
292
|
+
font-weight: 500;
|
|
293
|
+
font-family: inherit;
|
|
294
|
+
white-space: nowrap;
|
|
295
|
+
|
|
296
|
+
}
|
|
297
|
+
.tab-btn:hover { color: #a1a1aa; }
|
|
298
|
+
.tab-btn.active {
|
|
299
|
+
color: #fafafa;
|
|
300
|
+
border-bottom-color: #3b82f6;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.tab-count {
|
|
304
|
+
font-size: 10px;
|
|
305
|
+
color: #3f3f46;
|
|
306
|
+
margin-left: 4px;
|
|
307
|
+
}
|
|
308
|
+
.tab-btn.active .tab-count { color: #52525b; }
|
|
309
|
+
@media (max-width: 640px) {
|
|
310
|
+
.tab-btn { padding: 6px 10px; font-size: 11px; }
|
|
311
|
+
.tab-count { font-size: 9px; }
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.close-btn {
|
|
315
|
+
width: 36px;
|
|
316
|
+
height: 36px;
|
|
317
|
+
border-radius: 0;
|
|
318
|
+
border: none;
|
|
319
|
+
border-left: 1px solid #27272a;
|
|
320
|
+
background: transparent;
|
|
321
|
+
color: #52525b;
|
|
322
|
+
cursor: pointer;
|
|
323
|
+
display: flex;
|
|
324
|
+
align-items: center;
|
|
325
|
+
justify-content: center;
|
|
326
|
+
font-size: 14px;
|
|
327
|
+
font-family: inherit;
|
|
328
|
+
flex-shrink: 0;
|
|
329
|
+
}
|
|
330
|
+
.close-btn:hover { background: #18181b; color: #fafafa; }
|
|
331
|
+
|
|
332
|
+
.toolbar {
|
|
333
|
+
display: flex;
|
|
334
|
+
align-items: center;
|
|
335
|
+
gap: 8px;
|
|
336
|
+
padding: 6px 12px;
|
|
337
|
+
border-bottom: 1px solid #27272a;
|
|
338
|
+
background: #09090b;
|
|
339
|
+
flex-shrink: 0;
|
|
340
|
+
}
|
|
341
|
+
@media (max-width: 640px) {
|
|
342
|
+
.toolbar { padding: 4px 8px; }
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.search-input {
|
|
346
|
+
flex: 1;
|
|
347
|
+
background: #0f0f12;
|
|
348
|
+
border: 1px solid #27272a;
|
|
349
|
+
border-radius: 2px;
|
|
350
|
+
padding: 5px 8px;
|
|
351
|
+
color: #e4e4e7;
|
|
352
|
+
font-size: 12px;
|
|
353
|
+
font-family: inherit;
|
|
354
|
+
outline: none;
|
|
355
|
+
}
|
|
356
|
+
.search-input:focus { border-color: #3b82f6; }
|
|
357
|
+
.search-input::placeholder { color: #3f3f46; }
|
|
358
|
+
|
|
359
|
+
.content {
|
|
360
|
+
flex: 1;
|
|
361
|
+
overflow-y: auto;
|
|
362
|
+
padding: 8px 12px;
|
|
363
|
+
scrollbar-width: thin;
|
|
364
|
+
scrollbar-color: #27272a #09090b;
|
|
365
|
+
}
|
|
366
|
+
@media (max-width: 640px) {
|
|
367
|
+
.content { padding: 6px 8px; }
|
|
368
|
+
}
|
|
369
|
+
.content::-webkit-scrollbar { width: 6px; }
|
|
370
|
+
.content::-webkit-scrollbar-track { background: #09090b; }
|
|
371
|
+
.content::-webkit-scrollbar-thumb {
|
|
372
|
+
background: #27272a;
|
|
373
|
+
border-radius: 0;
|
|
374
|
+
}
|
|
375
|
+
.content::-webkit-scrollbar-thumb:hover { background: #3f3f46; }
|
|
376
|
+
|
|
377
|
+
.vlist {
|
|
378
|
+
position: relative;
|
|
379
|
+
padding: 0 12px;
|
|
380
|
+
}
|
|
381
|
+
@media (max-width: 640px) {
|
|
382
|
+
.vlist { padding: 0 8px; }
|
|
383
|
+
}
|
|
384
|
+
.vlist-inner {
|
|
385
|
+
position: relative;
|
|
386
|
+
width: 100%;
|
|
387
|
+
}
|
|
388
|
+
.vlist-window {
|
|
389
|
+
position: absolute;
|
|
390
|
+
left: 0;
|
|
391
|
+
right: 0;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.status-bar {
|
|
395
|
+
display: flex;
|
|
396
|
+
align-items: center;
|
|
397
|
+
gap: 12px;
|
|
398
|
+
padding: 4px 12px;
|
|
399
|
+
border-top: 1px solid #27272a;
|
|
400
|
+
background: #09090b;
|
|
401
|
+
font-size: 11px;
|
|
402
|
+
color: #3f3f46;
|
|
403
|
+
flex-shrink: 0;
|
|
404
|
+
}
|
|
405
|
+
@media (max-width: 640px) {
|
|
406
|
+
.status-bar {
|
|
407
|
+
gap: 8px;
|
|
408
|
+
padding: 4px 8px;
|
|
409
|
+
font-size: 10px;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/* ── Tree ──────────────────────────────────────────────────────────── */
|
|
414
|
+
|
|
415
|
+
.tree-row {
|
|
416
|
+
display: flex;
|
|
417
|
+
align-items: center;
|
|
418
|
+
gap: 6px;
|
|
419
|
+
padding: 0 4px;
|
|
420
|
+
cursor: pointer;
|
|
421
|
+
border-radius: 0;
|
|
422
|
+
height: 22px;
|
|
423
|
+
white-space: nowrap;
|
|
424
|
+
min-width: 0;
|
|
425
|
+
font-size: 12px;
|
|
426
|
+
border-left: 2px solid transparent;
|
|
427
|
+
}
|
|
428
|
+
.tree-row:hover { background: #18181b; border-left-color: #27272a; }
|
|
429
|
+
|
|
430
|
+
.tree-prefix {
|
|
431
|
+
color: #27272a;
|
|
432
|
+
user-select: none;
|
|
433
|
+
white-space: pre;
|
|
434
|
+
flex-shrink: 0;
|
|
435
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
436
|
+
font-size: 11px;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.tree-badge {
|
|
440
|
+
display: inline-block;
|
|
441
|
+
padding: 0 4px;
|
|
442
|
+
border-radius: 1px;
|
|
443
|
+
font-size: 9px;
|
|
444
|
+
font-weight: 600;
|
|
445
|
+
letter-spacing: 0.5px;
|
|
446
|
+
line-height: 16px;
|
|
447
|
+
flex-shrink: 0;
|
|
448
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.tree-segment {
|
|
452
|
+
color: #e4e4e7;
|
|
453
|
+
font-weight: 500;
|
|
454
|
+
overflow: hidden;
|
|
455
|
+
text-overflow: ellipsis;
|
|
456
|
+
min-width: 0;
|
|
457
|
+
}
|
|
458
|
+
.tree-segment.is-group { color: #71717a; font-style: italic; }
|
|
459
|
+
.tree-segment.is-param { color: #3b82f6; }
|
|
460
|
+
|
|
461
|
+
.tree-path {
|
|
462
|
+
color: #3f3f46;
|
|
463
|
+
margin-left: auto;
|
|
464
|
+
font-size: 11px;
|
|
465
|
+
white-space: nowrap;
|
|
466
|
+
overflow: hidden;
|
|
467
|
+
text-overflow: ellipsis;
|
|
468
|
+
max-width: 300px;
|
|
469
|
+
flex-shrink: 1;
|
|
470
|
+
min-width: 0;
|
|
471
|
+
}
|
|
472
|
+
@media (max-width: 768px) {
|
|
473
|
+
.tree-path { display: none; }
|
|
474
|
+
}
|
|
475
|
+
@media (max-width: 640px) {
|
|
476
|
+
.tree-url { display: none; }
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.tree-url {
|
|
480
|
+
color: #52525b;
|
|
481
|
+
font-size: 11px;
|
|
482
|
+
margin-left: 6px;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/* ── Typed list ────────────────────────────────────────────────────── */
|
|
486
|
+
|
|
487
|
+
.list-item {
|
|
488
|
+
padding: 8px 10px;
|
|
489
|
+
border-bottom: 1px solid #1a1a1e;
|
|
490
|
+
cursor: pointer;
|
|
491
|
+
|
|
492
|
+
overflow: hidden;
|
|
493
|
+
}
|
|
494
|
+
.list-item:hover { background: #18181b; }
|
|
495
|
+
|
|
496
|
+
.list-item-header {
|
|
497
|
+
display: flex;
|
|
498
|
+
align-items: center;
|
|
499
|
+
gap: 8px;
|
|
500
|
+
min-width: 0;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.list-item-url {
|
|
504
|
+
color: #e4e4e7;
|
|
505
|
+
font-weight: 500;
|
|
506
|
+
font-size: 12px;
|
|
507
|
+
overflow: hidden;
|
|
508
|
+
text-overflow: ellipsis;
|
|
509
|
+
white-space: nowrap;
|
|
510
|
+
min-width: 0;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.list-item-badges {
|
|
514
|
+
display: flex;
|
|
515
|
+
gap: 4px;
|
|
516
|
+
margin-left: auto;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.badge {
|
|
520
|
+
display: inline-block;
|
|
521
|
+
padding: 1px 5px;
|
|
522
|
+
border-radius: 1px;
|
|
523
|
+
font-size: 9px;
|
|
524
|
+
font-weight: 600;
|
|
525
|
+
letter-spacing: 0.5px;
|
|
526
|
+
line-height: 14px;
|
|
527
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
528
|
+
}
|
|
529
|
+
.badge-blue { background: #18181b; color: #71717a; border: 1px solid #27272a; }
|
|
530
|
+
.badge-green { background: #18181b; color: #71717a; border: 1px solid #27272a; }
|
|
531
|
+
.badge-yellow { background: #18181b; color: #a1a1aa; border: 1px solid #27272a; }
|
|
532
|
+
.badge-red { background: #18181b; color: #fafafa; border: 1px solid #3f3f46; }
|
|
533
|
+
.badge-purple { background: #18181b; color: #71717a; border: 1px solid #27272a; }
|
|
534
|
+
.badge-cyan { background: #18181b; color: #71717a; border: 1px solid #27272a; }
|
|
535
|
+
.badge-orange { background: #18181b; color: #a1a1aa; border: 1px solid #27272a; }
|
|
536
|
+
|
|
537
|
+
.list-item-file {
|
|
538
|
+
background: none;
|
|
539
|
+
border: none;
|
|
540
|
+
color: #3f3f46;
|
|
541
|
+
cursor: pointer;
|
|
542
|
+
display: block;
|
|
543
|
+
font: inherit;
|
|
544
|
+
font-size: 11px;
|
|
545
|
+
margin-top: 2px;
|
|
546
|
+
overflow: hidden;
|
|
547
|
+
padding: 0;
|
|
548
|
+
text-align: left;
|
|
549
|
+
text-overflow: ellipsis;
|
|
550
|
+
white-space: nowrap;
|
|
551
|
+
width: 100%;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.list-item-detail {
|
|
555
|
+
margin-top: 8px;
|
|
556
|
+
padding-top: 8px;
|
|
557
|
+
border-top: 1px solid #1a1a1e;
|
|
558
|
+
font-size: 12px;
|
|
559
|
+
color: #a1a1aa;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.detail-row {
|
|
563
|
+
display: flex;
|
|
564
|
+
gap: 8px;
|
|
565
|
+
padding: 2px 0;
|
|
566
|
+
}
|
|
567
|
+
.detail-label { color: #3f3f46; min-width: 80px; flex-shrink: 0; font-size: 11px; }
|
|
568
|
+
.detail-value { color: #a1a1aa; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
569
|
+
@media (max-width: 480px) {
|
|
570
|
+
.detail-row { flex-direction: column; gap: 2px; }
|
|
571
|
+
.detail-label { min-width: 0; }
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/* ── Server Fns table ──────────────────────────────────────────────── */
|
|
575
|
+
|
|
576
|
+
.fn-table-wrap {
|
|
577
|
+
overflow-x: auto;
|
|
578
|
+
scrollbar-width: thin;
|
|
579
|
+
scrollbar-color: #27272a #09090b;
|
|
580
|
+
}
|
|
581
|
+
.fn-table {
|
|
582
|
+
width: 100%;
|
|
583
|
+
border-collapse: collapse;
|
|
584
|
+
min-width: 500px;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.fn-table th {
|
|
588
|
+
text-align: left;
|
|
589
|
+
padding: 6px 10px;
|
|
590
|
+
border-bottom: 1px solid #27272a;
|
|
591
|
+
color: #3f3f46;
|
|
592
|
+
font-weight: 600;
|
|
593
|
+
font-size: 11px;
|
|
594
|
+
text-transform: uppercase;
|
|
595
|
+
letter-spacing: 0.5px;
|
|
596
|
+
cursor: pointer;
|
|
597
|
+
user-select: none;
|
|
598
|
+
white-space: nowrap;
|
|
599
|
+
}
|
|
600
|
+
.fn-table th:hover { color: #71717a; }
|
|
601
|
+
.fn-table th.sorted { color: #3b82f6; }
|
|
602
|
+
|
|
603
|
+
.fn-table td {
|
|
604
|
+
padding: 6px 10px;
|
|
605
|
+
border-bottom: 1px solid #1a1a1e;
|
|
606
|
+
font-size: 12px;
|
|
607
|
+
color: #a1a1aa;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.fn-table tr:hover td { background: #18181b; }
|
|
611
|
+
|
|
612
|
+
.method-badge {
|
|
613
|
+
display: inline-block;
|
|
614
|
+
padding: 1px 6px;
|
|
615
|
+
border-radius: 1px;
|
|
616
|
+
font-size: 10px;
|
|
617
|
+
font-weight: 600;
|
|
618
|
+
letter-spacing: 0.5px;
|
|
619
|
+
text-transform: uppercase;
|
|
620
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
621
|
+
border: 1px solid #27272a;
|
|
622
|
+
}
|
|
623
|
+
.method-get { background: transparent; color: #71717a; }
|
|
624
|
+
.method-post { background: transparent; color: #e4e4e7; border-color: #3f3f46; }
|
|
625
|
+
.method-put { background: transparent; color: #a1a1aa; }
|
|
626
|
+
.method-delete { background: transparent; color: #fafafa; border-color: #52525b; }
|
|
627
|
+
|
|
628
|
+
.file-link {
|
|
629
|
+
color: #3f3f46;
|
|
630
|
+
cursor: pointer;
|
|
631
|
+
text-decoration: none;
|
|
632
|
+
}
|
|
633
|
+
.file-link:hover { color: #3b82f6; text-decoration: underline; }
|
|
634
|
+
|
|
635
|
+
/* ── Current tab ───────────────────────────────────────────────────── */
|
|
636
|
+
|
|
637
|
+
.cur-grid {
|
|
638
|
+
display: grid;
|
|
639
|
+
gap: 1px;
|
|
640
|
+
background: #27272a;
|
|
641
|
+
border: 1px solid #27272a;
|
|
642
|
+
border-radius: 2px;
|
|
643
|
+
overflow: hidden;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
.cur-section {
|
|
647
|
+
background: #09090b;
|
|
648
|
+
border: none;
|
|
649
|
+
border-radius: 0;
|
|
650
|
+
padding: 10px 12px;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.cur-label {
|
|
654
|
+
font-size: 10px;
|
|
655
|
+
font-weight: 600;
|
|
656
|
+
color: #3f3f46;
|
|
657
|
+
text-transform: uppercase;
|
|
658
|
+
letter-spacing: 0.6px;
|
|
659
|
+
margin-bottom: 6px;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
.cur-path-rows {
|
|
663
|
+
display: flex;
|
|
664
|
+
flex-direction: column;
|
|
665
|
+
gap: 3px;
|
|
666
|
+
}
|
|
667
|
+
.cur-path-row {
|
|
668
|
+
display: flex;
|
|
669
|
+
align-items: baseline;
|
|
670
|
+
gap: 10px;
|
|
671
|
+
font-size: 12px;
|
|
672
|
+
}
|
|
673
|
+
.cur-path-label {
|
|
674
|
+
color: #3f3f46;
|
|
675
|
+
font-size: 10px;
|
|
676
|
+
font-weight: 600;
|
|
677
|
+
min-width: 52px;
|
|
678
|
+
flex-shrink: 0;
|
|
679
|
+
text-transform: uppercase;
|
|
680
|
+
letter-spacing: 0.5px;
|
|
681
|
+
}
|
|
682
|
+
.cur-path-value {
|
|
683
|
+
color: #e4e4e7;
|
|
684
|
+
word-break: break-all;
|
|
685
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
686
|
+
font-size: 12px;
|
|
687
|
+
}
|
|
688
|
+
.cur-url-search { color: #71717a; }
|
|
689
|
+
.cur-url-hash { color: #52525b; }
|
|
690
|
+
|
|
691
|
+
.cur-meta {
|
|
692
|
+
display: flex;
|
|
693
|
+
flex-wrap: wrap;
|
|
694
|
+
gap: 4px 16px;
|
|
695
|
+
font-size: 11px;
|
|
696
|
+
}
|
|
697
|
+
.cur-meta-item { display: flex; gap: 6px; align-items: center; }
|
|
698
|
+
.cur-meta-key { color: #3f3f46; font-weight: 500; }
|
|
699
|
+
.cur-meta-val { color: #a1a1aa; font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace; }
|
|
700
|
+
|
|
701
|
+
.cur-chain {
|
|
702
|
+
display: flex;
|
|
703
|
+
flex-direction: column;
|
|
704
|
+
gap: 0;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
.cur-chain-node {
|
|
708
|
+
border: 1px solid #1a1a1e;
|
|
709
|
+
border-radius: 0;
|
|
710
|
+
padding: 8px 10px;
|
|
711
|
+
cursor: pointer;
|
|
712
|
+
|
|
713
|
+
}
|
|
714
|
+
.cur-chain-node:hover { background: #18181b; }
|
|
715
|
+
.cur-chain-node + .cur-chain-node,
|
|
716
|
+
.cur-chain-arrow + .cur-chain-node { border-top: none; }
|
|
717
|
+
|
|
718
|
+
.cur-chain-header {
|
|
719
|
+
display: flex;
|
|
720
|
+
align-items: center;
|
|
721
|
+
gap: 8px;
|
|
722
|
+
font-size: 12px;
|
|
723
|
+
}
|
|
724
|
+
.cur-chain-seg { color: #e4e4e7; font-weight: 500; }
|
|
725
|
+
.cur-chain-seg.is-group { color: #52525b; font-style: italic; }
|
|
726
|
+
.cur-chain-seg.is-param { color: #3b82f6; }
|
|
727
|
+
.cur-chain-file {
|
|
728
|
+
background: none;
|
|
729
|
+
border: none;
|
|
730
|
+
color: #3f3f46;
|
|
731
|
+
cursor: pointer;
|
|
732
|
+
font: inherit;
|
|
733
|
+
font-size: 11px;
|
|
734
|
+
margin-left: auto;
|
|
735
|
+
max-width: 280px;
|
|
736
|
+
overflow: hidden;
|
|
737
|
+
padding: 0;
|
|
738
|
+
text-align: left;
|
|
739
|
+
text-overflow: ellipsis;
|
|
740
|
+
white-space: nowrap;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
.cur-chain-methods {
|
|
744
|
+
display: flex;
|
|
745
|
+
flex-wrap: wrap;
|
|
746
|
+
gap: 3px;
|
|
747
|
+
margin-top: 6px;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.cur-method {
|
|
751
|
+
display: inline-block;
|
|
752
|
+
padding: 1px 6px;
|
|
753
|
+
border-radius: 1px;
|
|
754
|
+
font-size: 9px;
|
|
755
|
+
font-weight: 500;
|
|
756
|
+
letter-spacing: 0.3px;
|
|
757
|
+
border: 1px solid #27272a;
|
|
758
|
+
background: transparent;
|
|
759
|
+
color: #52525b;
|
|
760
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
761
|
+
}
|
|
762
|
+
.cur-method.is-auth { color: #a1a1aa; border-color: #3f3f46; }
|
|
763
|
+
.cur-method.is-data { color: #3b82f6; border-color: #1d4ed8; }
|
|
764
|
+
.cur-method.is-cache { color: #71717a; border-color: #27272a; }
|
|
765
|
+
.cur-method.is-render { color: #a1a1aa; border-color: #3f3f46; }
|
|
766
|
+
.cur-method.is-head { color: #71717a; border-color: #27272a; }
|
|
767
|
+
.cur-method.is-error { color: #a1a1aa; border-color: #3f3f46; }
|
|
768
|
+
|
|
769
|
+
.cur-chain-arrow {
|
|
770
|
+
text-align: center;
|
|
771
|
+
color: #27272a;
|
|
772
|
+
font-size: 10px;
|
|
773
|
+
line-height: 1;
|
|
774
|
+
padding: 1px 0;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
.cur-chain-config {
|
|
778
|
+
margin-top: 6px;
|
|
779
|
+
padding-top: 6px;
|
|
780
|
+
border-top: 1px solid #1a1a1e;
|
|
781
|
+
font-size: 11px;
|
|
782
|
+
}
|
|
783
|
+
.cur-config-row {
|
|
784
|
+
display: flex;
|
|
785
|
+
gap: 8px;
|
|
786
|
+
padding: 2px 0;
|
|
787
|
+
}
|
|
788
|
+
.cur-config-key {
|
|
789
|
+
color: #3f3f46;
|
|
790
|
+
min-width: 60px;
|
|
791
|
+
flex-shrink: 0;
|
|
792
|
+
font-weight: 500;
|
|
793
|
+
font-size: 10px;
|
|
794
|
+
text-transform: uppercase;
|
|
795
|
+
letter-spacing: 0.3px;
|
|
796
|
+
}
|
|
797
|
+
.cur-config-val {
|
|
798
|
+
color: #a1a1aa;
|
|
799
|
+
word-break: break-all;
|
|
800
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
801
|
+
}
|
|
802
|
+
.cur-config-pre {
|
|
803
|
+
margin: 0;
|
|
804
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
805
|
+
font-size: 11px;
|
|
806
|
+
color: #71717a;
|
|
807
|
+
background: #0a0a0c;
|
|
808
|
+
border: 1px solid #1a1a1e;
|
|
809
|
+
border-radius: 0;
|
|
810
|
+
padding: 6px 8px;
|
|
811
|
+
overflow-x: auto;
|
|
812
|
+
max-height: 200px;
|
|
813
|
+
overflow-y: auto;
|
|
814
|
+
white-space: pre-wrap;
|
|
815
|
+
word-break: break-all;
|
|
816
|
+
scrollbar-width: thin;
|
|
817
|
+
scrollbar-color: #27272a #0a0a0c;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
.cur-params {
|
|
821
|
+
display: flex;
|
|
822
|
+
flex-wrap: wrap;
|
|
823
|
+
gap: 4px 16px;
|
|
824
|
+
font-size: 12px;
|
|
825
|
+
}
|
|
826
|
+
.cur-param-key {
|
|
827
|
+
color: #3b82f6;
|
|
828
|
+
font-weight: 500;
|
|
829
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
830
|
+
}
|
|
831
|
+
.cur-param-val {
|
|
832
|
+
color: #e4e4e7;
|
|
833
|
+
margin-left: 4px;
|
|
834
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
.cur-state {
|
|
838
|
+
display: flex;
|
|
839
|
+
flex-wrap: wrap;
|
|
840
|
+
gap: 4px 16px;
|
|
841
|
+
font-size: 11px;
|
|
842
|
+
}
|
|
843
|
+
.cur-state-item { display: flex; gap: 4px; }
|
|
844
|
+
.cur-state-key { color: #3f3f46; text-transform: uppercase; font-size: 10px; }
|
|
845
|
+
.cur-state-val { color: #e4e4e7; }
|
|
846
|
+
|
|
847
|
+
.cur-head-tags {
|
|
848
|
+
font-size: 11px;
|
|
849
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
850
|
+
max-height: 180px;
|
|
851
|
+
overflow-y: auto;
|
|
852
|
+
scrollbar-width: thin;
|
|
853
|
+
scrollbar-color: #27272a #09090b;
|
|
854
|
+
}
|
|
855
|
+
.cur-head-tag {
|
|
856
|
+
padding: 1px 0;
|
|
857
|
+
white-space: nowrap;
|
|
858
|
+
overflow: hidden;
|
|
859
|
+
text-overflow: ellipsis;
|
|
860
|
+
}
|
|
861
|
+
.cur-head-tag-name { color: #3f3f46; }
|
|
862
|
+
.cur-head-attr-key { color: #71717a; }
|
|
863
|
+
.cur-head-attr-val { color: #a1a1aa; }
|
|
864
|
+
|
|
865
|
+
@media (max-width: 768px) {
|
|
866
|
+
.cur-chain-file { display: none; }
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
.empty-state {
|
|
870
|
+
text-align: center;
|
|
871
|
+
padding: 40px 20px;
|
|
872
|
+
color: #3f3f46;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/* ── Actions tab ───────────────────────────────────────────────────── */
|
|
876
|
+
|
|
877
|
+
.act-grid {
|
|
878
|
+
display: grid;
|
|
879
|
+
gap: 1px;
|
|
880
|
+
background: #27272a;
|
|
881
|
+
border: 1px solid #27272a;
|
|
882
|
+
border-radius: 2px;
|
|
883
|
+
overflow: hidden;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
.act-section {
|
|
887
|
+
background: #09090b;
|
|
888
|
+
padding: 10px 12px;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
.act-label {
|
|
892
|
+
font-size: 10px;
|
|
893
|
+
font-weight: 600;
|
|
894
|
+
color: #3f3f46;
|
|
895
|
+
text-transform: uppercase;
|
|
896
|
+
letter-spacing: 0.6px;
|
|
897
|
+
margin-bottom: 8px;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
.act-row {
|
|
901
|
+
display: flex;
|
|
902
|
+
flex-wrap: wrap;
|
|
903
|
+
gap: 6px;
|
|
904
|
+
align-items: center;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.act-btn {
|
|
908
|
+
border: 1px solid #27272a;
|
|
909
|
+
background: transparent;
|
|
910
|
+
color: #a1a1aa;
|
|
911
|
+
border-radius: 1px;
|
|
912
|
+
padding: 4px 10px;
|
|
913
|
+
font-size: 11px;
|
|
914
|
+
font-family: inherit;
|
|
915
|
+
cursor: pointer;
|
|
916
|
+
white-space: nowrap;
|
|
917
|
+
}
|
|
918
|
+
.act-btn:hover { border-color: #3b82f6; color: #e4e4e7; }
|
|
919
|
+
.act-btn:active { background: #18181b; }
|
|
920
|
+
.act-btn.is-danger:hover { border-color: #ef4444; color: #fafafa; }
|
|
921
|
+
.act-btn.is-copied { border-color: #22c55e; color: #22c55e; pointer-events: none; }
|
|
922
|
+
|
|
923
|
+
.act-stat {
|
|
924
|
+
display: flex;
|
|
925
|
+
gap: 8px;
|
|
926
|
+
align-items: center;
|
|
927
|
+
font-size: 11px;
|
|
928
|
+
}
|
|
929
|
+
.act-stat-key {
|
|
930
|
+
color: #3f3f46;
|
|
931
|
+
font-weight: 500;
|
|
932
|
+
}
|
|
933
|
+
.act-stat-val {
|
|
934
|
+
color: #e4e4e7;
|
|
935
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
.act-select {
|
|
939
|
+
background: #0f0f12;
|
|
940
|
+
border: 1px solid #27272a;
|
|
941
|
+
border-radius: 2px;
|
|
942
|
+
padding: 4px 8px;
|
|
943
|
+
color: #e4e4e7;
|
|
944
|
+
font-size: 11px;
|
|
945
|
+
font-family: inherit;
|
|
946
|
+
outline: none;
|
|
947
|
+
flex: 1;
|
|
948
|
+
min-width: 0;
|
|
949
|
+
}
|
|
950
|
+
.act-select:focus { border-color: #3b82f6; }
|
|
951
|
+
|
|
952
|
+
.act-input {
|
|
953
|
+
background: #0f0f12;
|
|
954
|
+
border: 1px solid #27272a;
|
|
955
|
+
border-radius: 2px;
|
|
956
|
+
padding: 4px 8px;
|
|
957
|
+
color: #e4e4e7;
|
|
958
|
+
font-size: 11px;
|
|
959
|
+
font-family: inherit;
|
|
960
|
+
outline: none;
|
|
961
|
+
min-width: 60px;
|
|
962
|
+
}
|
|
963
|
+
.act-input:focus { border-color: #3b82f6; }
|
|
964
|
+
.act-input::placeholder { color: #3f3f46; }
|
|
965
|
+
|
|
966
|
+
.act-param-row {
|
|
967
|
+
display: flex;
|
|
968
|
+
gap: 6px;
|
|
969
|
+
align-items: center;
|
|
970
|
+
font-size: 11px;
|
|
971
|
+
}
|
|
972
|
+
.act-param-label {
|
|
973
|
+
color: #3b82f6;
|
|
974
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
975
|
+
min-width: 40px;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.act-cache-list {
|
|
979
|
+
margin-top: 8px;
|
|
980
|
+
max-height: 140px;
|
|
981
|
+
overflow-y: auto;
|
|
982
|
+
scrollbar-width: thin;
|
|
983
|
+
scrollbar-color: #27272a #09090b;
|
|
984
|
+
}
|
|
985
|
+
.act-cache-entry {
|
|
986
|
+
display: flex;
|
|
987
|
+
justify-content: space-between;
|
|
988
|
+
align-items: center;
|
|
989
|
+
padding: 3px 0;
|
|
990
|
+
font-size: 11px;
|
|
991
|
+
border-bottom: 1px solid #1a1a1e;
|
|
992
|
+
}
|
|
993
|
+
.act-cache-id {
|
|
994
|
+
color: #71717a;
|
|
995
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
996
|
+
overflow: hidden;
|
|
997
|
+
text-overflow: ellipsis;
|
|
998
|
+
white-space: nowrap;
|
|
999
|
+
min-width: 0;
|
|
1000
|
+
flex: 1;
|
|
1001
|
+
}
|
|
1002
|
+
.act-cache-age {
|
|
1003
|
+
color: #3f3f46;
|
|
1004
|
+
font-size: 10px;
|
|
1005
|
+
flex-shrink: 0;
|
|
1006
|
+
margin-left: 8px;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
.act-doc-row {
|
|
1010
|
+
display: flex;
|
|
1011
|
+
gap: 8px;
|
|
1012
|
+
align-items: center;
|
|
1013
|
+
font-size: 11px;
|
|
1014
|
+
padding: 3px 0;
|
|
1015
|
+
}
|
|
1016
|
+
.act-doc-key {
|
|
1017
|
+
color: #3f3f46;
|
|
1018
|
+
font-weight: 500;
|
|
1019
|
+
min-width: 50px;
|
|
1020
|
+
}
|
|
1021
|
+
.act-doc-val {
|
|
1022
|
+
color: #e4e4e7;
|
|
1023
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", monospace;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
@media (max-width: 480px) {
|
|
1027
|
+
.act-row { gap: 4px; }
|
|
1028
|
+
.act-btn { padding: 3px 8px; font-size: 10px; }
|
|
1029
|
+
.act-param-row { flex-direction: column; align-items: stretch; }
|
|
1030
|
+
}
|
|
1031
|
+
`;
|
|
1032
|
+
|
|
1033
|
+
/* ── Virtual list ─────────────────────────────────────────────────────── */
|
|
1034
|
+
|
|
1035
|
+
function VirtualList<T>(props: {
|
|
1036
|
+
containerRef?: (el: HTMLDivElement) => void;
|
|
1037
|
+
each: T[];
|
|
1038
|
+
estimateHeight: number;
|
|
1039
|
+
render: (item: T, index: number) => ReturnType<(typeof import("solid-js"))["createComponent"]>;
|
|
1040
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1041
|
+
let scrollEl: HTMLDivElement | null = null;
|
|
1042
|
+
const [scrollTop, setScrollTop] = createSignal(0);
|
|
1043
|
+
const [viewHeight, setViewHeight] = createSignal(500);
|
|
1044
|
+
|
|
1045
|
+
const totalHeight = () => props.each.length * props.estimateHeight;
|
|
1046
|
+
|
|
1047
|
+
const visibleRange = () => {
|
|
1048
|
+
const top = scrollTop();
|
|
1049
|
+
const height = viewHeight();
|
|
1050
|
+
const overscan = 5;
|
|
1051
|
+
const startIdx = Math.max(0, Math.floor(top / props.estimateHeight) - overscan);
|
|
1052
|
+
const endIdx = Math.min(props.each.length, Math.ceil((top + height) / props.estimateHeight) + overscan);
|
|
1053
|
+
return { endIdx, startIdx };
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
const visibleItems = () => {
|
|
1057
|
+
const { endIdx, startIdx } = visibleRange();
|
|
1058
|
+
const items: { idx: number; item: T }[] = [];
|
|
1059
|
+
for (let i = startIdx; i < endIdx; i++) {
|
|
1060
|
+
const item = props.each[i];
|
|
1061
|
+
if (item !== undefined) items.push({ idx: i, item });
|
|
1062
|
+
}
|
|
1063
|
+
return items;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
const onScroll = () => {
|
|
1067
|
+
if (scrollEl) {
|
|
1068
|
+
setScrollTop(scrollEl.scrollTop);
|
|
1069
|
+
setViewHeight(scrollEl.clientHeight);
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
createEffect(() => {
|
|
1074
|
+
if (scrollEl) {
|
|
1075
|
+
setViewHeight(scrollEl.clientHeight);
|
|
1076
|
+
if (props.containerRef) props.containerRef(scrollEl);
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
return (
|
|
1081
|
+
<div
|
|
1082
|
+
class="content"
|
|
1083
|
+
onScroll={onScroll}
|
|
1084
|
+
ref={(el) => {
|
|
1085
|
+
scrollEl = el;
|
|
1086
|
+
}}
|
|
1087
|
+
>
|
|
1088
|
+
<div class="vlist">
|
|
1089
|
+
<div class="vlist-inner" style={{ height: `${totalHeight()}px` }}>
|
|
1090
|
+
<div class="vlist-window" style={{ top: `${visibleRange().startIdx * props.estimateHeight}px` }}>
|
|
1091
|
+
<For each={visibleItems()}>{(entry) => props.render(entry.item, entry.idx)}</For>
|
|
1092
|
+
</div>
|
|
1093
|
+
</div>
|
|
1094
|
+
</div>
|
|
1095
|
+
</div>
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/* ── Components ───────────────────────────────────────────────────────── */
|
|
1100
|
+
|
|
1101
|
+
function sortArrow(dir: "asc" | "desc"): string {
|
|
1102
|
+
if (dir === "asc") return " \u2191";
|
|
1103
|
+
return " \u2193";
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
function openEditor(file: string): void {
|
|
1107
|
+
fetch(`/__flare/open-editor?file=${encodeURIComponent(file)}`);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
function matchesSearch(node: RouteTreeNode, term: string): boolean {
|
|
1111
|
+
if (!term) return true;
|
|
1112
|
+
const lower = term.toLowerCase();
|
|
1113
|
+
if (node.segment.toLowerCase().includes(lower)) return true;
|
|
1114
|
+
if (node.filePath?.toLowerCase().includes(lower)) return true;
|
|
1115
|
+
if (node.urlPath.toLowerCase().includes(lower)) return true;
|
|
1116
|
+
return node.children.some((c) => matchesSearch(c, term));
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
function TreeRow(props: {
|
|
1120
|
+
node: RouteTreeNode;
|
|
1121
|
+
prefix: string;
|
|
1122
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1123
|
+
const isGroup = () => props.node.segment.startsWith("(") && props.node.segment.endsWith(")");
|
|
1124
|
+
const isParam = () => props.node.segment.startsWith("[") && props.node.segment.endsWith("]");
|
|
1125
|
+
const label = () => props.node.segment || props.node.virtualPath || "_root_";
|
|
1126
|
+
|
|
1127
|
+
return (
|
|
1128
|
+
<button
|
|
1129
|
+
class="tree-row"
|
|
1130
|
+
onClick={() => {
|
|
1131
|
+
if (props.node.filePath) openEditor(props.node.filePath);
|
|
1132
|
+
}}
|
|
1133
|
+
type="button"
|
|
1134
|
+
>
|
|
1135
|
+
<span class="tree-prefix">{props.prefix}</span>
|
|
1136
|
+
<span
|
|
1137
|
+
class="tree-badge"
|
|
1138
|
+
style={{
|
|
1139
|
+
background: `${typeBadgeColor(props.node.type)}22`,
|
|
1140
|
+
color: typeBadgeColor(props.node.type),
|
|
1141
|
+
}}
|
|
1142
|
+
>
|
|
1143
|
+
{typeBadgeLabel(props.node.type)}
|
|
1144
|
+
</span>
|
|
1145
|
+
<span class="tree-segment" classList={{ "is-group": isGroup(), "is-param": isParam() }}>
|
|
1146
|
+
{label()}
|
|
1147
|
+
</span>
|
|
1148
|
+
<Show when={props.node.urlPath && props.node.type !== "segment"}>
|
|
1149
|
+
<span class="tree-url">{props.node.urlPath}</span>
|
|
1150
|
+
</Show>
|
|
1151
|
+
<Show when={props.node.filePath}>
|
|
1152
|
+
<span class="tree-path">{props.node.filePath}</span>
|
|
1153
|
+
</Show>
|
|
1154
|
+
</button>
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
function flattenTree(
|
|
1159
|
+
nodes: RouteTreeNode[],
|
|
1160
|
+
search: string,
|
|
1161
|
+
parentPrefix: string,
|
|
1162
|
+
): { node: RouteTreeNode; prefix: string }[] {
|
|
1163
|
+
const rows: { node: RouteTreeNode; prefix: string }[] = [];
|
|
1164
|
+
|
|
1165
|
+
const filtered = search ? nodes.filter((n) => matchesSearch(n, search)) : nodes;
|
|
1166
|
+
|
|
1167
|
+
for (let i = 0; i < filtered.length; i++) {
|
|
1168
|
+
const node = filtered[i];
|
|
1169
|
+
if (!node) continue;
|
|
1170
|
+
const isLast = i === filtered.length - 1;
|
|
1171
|
+
const connector = isLast ? "\u2514\u2500 " : "\u251C\u2500 ";
|
|
1172
|
+
const prefix = parentPrefix + connector;
|
|
1173
|
+
|
|
1174
|
+
rows.push({ node, prefix });
|
|
1175
|
+
|
|
1176
|
+
if (node.children.length > 0) {
|
|
1177
|
+
const childPrefix = parentPrefix + (isLast ? " " : "\u2502 ");
|
|
1178
|
+
rows.push(...flattenTree(node.children, search, childPrefix));
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
return rows;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
function TreeTab(props: {
|
|
1186
|
+
search: string;
|
|
1187
|
+
tree: RouteTreeNode[];
|
|
1188
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1189
|
+
const rows = createMemo(() => {
|
|
1190
|
+
const result: { node: RouteTreeNode; prefix: string }[] = [];
|
|
1191
|
+
|
|
1192
|
+
for (const root of props.tree) {
|
|
1193
|
+
result.push({ node: root, prefix: "" });
|
|
1194
|
+
if (root.children.length > 0) {
|
|
1195
|
+
result.push(...flattenTree(root.children, props.search, ""));
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
return result;
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
return (
|
|
1203
|
+
<Show fallback={<div class="empty-state">No routes found</div>} when={rows().length > 0}>
|
|
1204
|
+
<VirtualList
|
|
1205
|
+
each={rows()}
|
|
1206
|
+
estimateHeight={22}
|
|
1207
|
+
render={(row) => <TreeRow node={row.node} prefix={row.prefix} />}
|
|
1208
|
+
/>
|
|
1209
|
+
</Show>
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
function ListItem(props: {
|
|
1214
|
+
def: RouteDef;
|
|
1215
|
+
expanded: boolean;
|
|
1216
|
+
onClick: () => void;
|
|
1217
|
+
onOpenEditor: (f: string) => void;
|
|
1218
|
+
urlPath: string;
|
|
1219
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1220
|
+
return (
|
|
1221
|
+
<div
|
|
1222
|
+
class="list-item"
|
|
1223
|
+
onClick={() => props.onClick()}
|
|
1224
|
+
onKeyDown={(e) => {
|
|
1225
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1226
|
+
e.preventDefault();
|
|
1227
|
+
props.onClick();
|
|
1228
|
+
}
|
|
1229
|
+
}}
|
|
1230
|
+
role="button"
|
|
1231
|
+
tabIndex={0}
|
|
1232
|
+
>
|
|
1233
|
+
<div class="list-item-header">
|
|
1234
|
+
<span class="list-item-url">{props.urlPath}</span>
|
|
1235
|
+
<div class="list-item-badges">
|
|
1236
|
+
<Show when={props.def.hasInput}>
|
|
1237
|
+
<span class="badge badge-yellow">INPUT</span>
|
|
1238
|
+
</Show>
|
|
1239
|
+
<Show when={props.def.authenticateMode === true}>
|
|
1240
|
+
<span class="badge badge-red">AUTH</span>
|
|
1241
|
+
</Show>
|
|
1242
|
+
<Show when={props.def.authenticateMode === "optional"}>
|
|
1243
|
+
<span class="badge badge-orange">AUTH?</span>
|
|
1244
|
+
</Show>
|
|
1245
|
+
<Show when={props.def.responseRoute}>
|
|
1246
|
+
<span class="badge badge-orange">RSP</span>
|
|
1247
|
+
</Show>
|
|
1248
|
+
<Show when={props.def.cache && Object.keys(props.def.cache).length > 0}>
|
|
1249
|
+
<span class="badge badge-cyan">CACHE</span>
|
|
1250
|
+
</Show>
|
|
1251
|
+
</div>
|
|
1252
|
+
</div>
|
|
1253
|
+
<button
|
|
1254
|
+
class="list-item-file"
|
|
1255
|
+
onClick={(e) => {
|
|
1256
|
+
e.stopPropagation();
|
|
1257
|
+
props.onOpenEditor(props.def.filePath);
|
|
1258
|
+
}}
|
|
1259
|
+
type="button"
|
|
1260
|
+
>
|
|
1261
|
+
{props.def.filePath}
|
|
1262
|
+
</button>
|
|
1263
|
+
<Show when={props.expanded}>
|
|
1264
|
+
<div class="list-item-detail">
|
|
1265
|
+
<div class="detail-row">
|
|
1266
|
+
<span class="detail-label">Virtual Path</span>
|
|
1267
|
+
<span class="detail-value">{props.def.virtualPath}</span>
|
|
1268
|
+
</div>
|
|
1269
|
+
<div class="detail-row">
|
|
1270
|
+
<span class="detail-label">Export</span>
|
|
1271
|
+
<span class="detail-value">{props.def.exportName}</span>
|
|
1272
|
+
</div>
|
|
1273
|
+
<Show when={props.def.cache && Object.keys(props.def.cache).length > 0}>
|
|
1274
|
+
<div class="detail-row">
|
|
1275
|
+
<span class="detail-label">Cache</span>
|
|
1276
|
+
<span class="detail-value">{JSON.stringify(props.def.cache)}</span>
|
|
1277
|
+
</div>
|
|
1278
|
+
</Show>
|
|
1279
|
+
<Show when={props.def.intercept}>
|
|
1280
|
+
<div class="detail-row">
|
|
1281
|
+
<span class="detail-label">Intercept</span>
|
|
1282
|
+
<span class="detail-value">{JSON.stringify(props.def.intercept)}</span>
|
|
1283
|
+
</div>
|
|
1284
|
+
</Show>
|
|
1285
|
+
</div>
|
|
1286
|
+
</Show>
|
|
1287
|
+
</div>
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
function TypedListTab(props: {
|
|
1292
|
+
defs: RouteDef[];
|
|
1293
|
+
onOpenEditor: (f: string) => void;
|
|
1294
|
+
search: string;
|
|
1295
|
+
type: RouteDef["type"];
|
|
1296
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1297
|
+
const [expandedIdx, setExpandedIdx] = createSignal<number | null>(null);
|
|
1298
|
+
|
|
1299
|
+
const filtered = createMemo(() => {
|
|
1300
|
+
let items = props.defs.filter((d) => d.type === props.type);
|
|
1301
|
+
if (props.search) {
|
|
1302
|
+
const term = props.search.toLowerCase();
|
|
1303
|
+
items = items.filter(
|
|
1304
|
+
(d) => d.filePath.toLowerCase().includes(term) || d.virtualPath.toLowerCase().includes(term),
|
|
1305
|
+
);
|
|
1306
|
+
}
|
|
1307
|
+
return items;
|
|
1308
|
+
});
|
|
1309
|
+
|
|
1310
|
+
const urlPath = (vp: string): string => {
|
|
1311
|
+
const parts = vp.split("/");
|
|
1312
|
+
const rootIdx = parts.findIndex((p) => p.startsWith("_") && p.endsWith("_") && p.length >= 3);
|
|
1313
|
+
const urlParts: string[] = [];
|
|
1314
|
+
for (let i = 0; i < parts.length; i++) {
|
|
1315
|
+
const part = parts[i] ?? "";
|
|
1316
|
+
if (rootIdx >= 0 && i <= rootIdx) continue;
|
|
1317
|
+
if (part.startsWith("(") && part.endsWith(")")) continue;
|
|
1318
|
+
if (part === "") continue;
|
|
1319
|
+
urlParts.push(part);
|
|
1320
|
+
}
|
|
1321
|
+
return `/${urlParts.join("/")}`;
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1324
|
+
return (
|
|
1325
|
+
<Show fallback={<div class="empty-state">No {props.type} routes found</div>} when={filtered().length > 0}>
|
|
1326
|
+
<VirtualList
|
|
1327
|
+
each={filtered()}
|
|
1328
|
+
estimateHeight={48}
|
|
1329
|
+
render={(def, idx) => (
|
|
1330
|
+
<ListItem
|
|
1331
|
+
def={def}
|
|
1332
|
+
expanded={expandedIdx() === idx}
|
|
1333
|
+
onClick={() => setExpandedIdx(expandedIdx() === idx ? null : idx)}
|
|
1334
|
+
onOpenEditor={props.onOpenEditor}
|
|
1335
|
+
urlPath={urlPath(def.virtualPath)}
|
|
1336
|
+
/>
|
|
1337
|
+
)}
|
|
1338
|
+
/>
|
|
1339
|
+
</Show>
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
function ServerFnsTab(props: {
|
|
1344
|
+
fns: ServerFnInfo[];
|
|
1345
|
+
onOpenEditor: (f: string) => void;
|
|
1346
|
+
search: string;
|
|
1347
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1348
|
+
const [sortCol, setSortCol] = createSignal(loadState().sortCol);
|
|
1349
|
+
const [sortDir, setSortDir] = createSignal<"asc" | "desc">(loadState().sortDir);
|
|
1350
|
+
|
|
1351
|
+
const handleSort = (col: string) => {
|
|
1352
|
+
if (sortCol() === col) {
|
|
1353
|
+
setSortDir((d) => (d === "asc" ? "desc" : "asc"));
|
|
1354
|
+
} else {
|
|
1355
|
+
setSortCol(col);
|
|
1356
|
+
setSortDir("asc");
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
const filtered = createMemo(() => {
|
|
1361
|
+
let items = [...props.fns];
|
|
1362
|
+
if (props.search) {
|
|
1363
|
+
const term = props.search.toLowerCase();
|
|
1364
|
+
items = items.filter(
|
|
1365
|
+
(f) =>
|
|
1366
|
+
f.name.toLowerCase().includes(term) ||
|
|
1367
|
+
f.file.toLowerCase().includes(term) ||
|
|
1368
|
+
f.method.toLowerCase().includes(term),
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1371
|
+
const col = sortCol();
|
|
1372
|
+
const dir = sortDir();
|
|
1373
|
+
const getValue = (fn: ServerFnInfo): string => {
|
|
1374
|
+
switch (col) {
|
|
1375
|
+
case "name":
|
|
1376
|
+
return fn.name;
|
|
1377
|
+
case "method":
|
|
1378
|
+
return fn.method;
|
|
1379
|
+
case "authenticate":
|
|
1380
|
+
return String(fn.authenticate);
|
|
1381
|
+
case "stream":
|
|
1382
|
+
return String(fn.stream);
|
|
1383
|
+
case "file":
|
|
1384
|
+
return fn.file;
|
|
1385
|
+
default:
|
|
1386
|
+
return fn.name;
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
items.sort((a, b) => {
|
|
1390
|
+
const cmp = getValue(a).localeCompare(getValue(b));
|
|
1391
|
+
return dir === "asc" ? cmp : -cmp;
|
|
1392
|
+
});
|
|
1393
|
+
return items;
|
|
1394
|
+
});
|
|
1395
|
+
|
|
1396
|
+
const sortIndicator = (col: string) => {
|
|
1397
|
+
if (sortCol() !== col) return "";
|
|
1398
|
+
return sortArrow(sortDir());
|
|
1399
|
+
};
|
|
1400
|
+
|
|
1401
|
+
return (
|
|
1402
|
+
<Show fallback={<div class="empty-state">No server functions found</div>} when={filtered().length > 0}>
|
|
1403
|
+
<div class="fn-table-wrap">
|
|
1404
|
+
<table class="fn-table">
|
|
1405
|
+
<thead>
|
|
1406
|
+
<tr>
|
|
1407
|
+
<th classList={{ sorted: sortCol() === "name" }} onClick={() => handleSort("name")}>
|
|
1408
|
+
Name{sortIndicator("name")}
|
|
1409
|
+
</th>
|
|
1410
|
+
<th classList={{ sorted: sortCol() === "method" }} onClick={() => handleSort("method")}>
|
|
1411
|
+
Method{sortIndicator("method")}
|
|
1412
|
+
</th>
|
|
1413
|
+
<th classList={{ sorted: sortCol() === "authenticate" }} onClick={() => handleSort("authenticate")}>
|
|
1414
|
+
Auth{sortIndicator("authenticate")}
|
|
1415
|
+
</th>
|
|
1416
|
+
<th classList={{ sorted: sortCol() === "stream" }} onClick={() => handleSort("stream")}>
|
|
1417
|
+
Stream{sortIndicator("stream")}
|
|
1418
|
+
</th>
|
|
1419
|
+
<th>File</th>
|
|
1420
|
+
</tr>
|
|
1421
|
+
</thead>
|
|
1422
|
+
<tbody>
|
|
1423
|
+
<For each={filtered()}>
|
|
1424
|
+
{(fn) => (
|
|
1425
|
+
<tr>
|
|
1426
|
+
<td>{fn.name}</td>
|
|
1427
|
+
<td>
|
|
1428
|
+
<span class={`method-badge method-${fn.method}`}>{fn.method}</span>
|
|
1429
|
+
</td>
|
|
1430
|
+
<td>{fn.authenticate ? "\u2713" : "\u2013"}</td>
|
|
1431
|
+
<td>{fn.stream ? "\u2713" : "\u2013"}</td>
|
|
1432
|
+
<td>
|
|
1433
|
+
<button class="file-link" onClick={() => props.onOpenEditor(fn.file)} type="button">
|
|
1434
|
+
{fn.file}
|
|
1435
|
+
</button>
|
|
1436
|
+
</td>
|
|
1437
|
+
</tr>
|
|
1438
|
+
)}
|
|
1439
|
+
</For>
|
|
1440
|
+
</tbody>
|
|
1441
|
+
</table>
|
|
1442
|
+
</div>
|
|
1443
|
+
</Show>
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
function methodCategory(m: string): string {
|
|
1448
|
+
switch (m) {
|
|
1449
|
+
case "authenticate":
|
|
1450
|
+
case "authenticateOptional":
|
|
1451
|
+
case "authorize":
|
|
1452
|
+
return "is-auth";
|
|
1453
|
+
case "loader":
|
|
1454
|
+
case "preloader":
|
|
1455
|
+
case "effects":
|
|
1456
|
+
case "input":
|
|
1457
|
+
return "is-data";
|
|
1458
|
+
case "cache":
|
|
1459
|
+
return "is-cache";
|
|
1460
|
+
case "render":
|
|
1461
|
+
case "response":
|
|
1462
|
+
return "is-render";
|
|
1463
|
+
case "head":
|
|
1464
|
+
case "headers":
|
|
1465
|
+
return "is-head";
|
|
1466
|
+
case "errorRender":
|
|
1467
|
+
case "notFoundRender":
|
|
1468
|
+
case "unauthenticatedRender":
|
|
1469
|
+
case "unauthorizedRender":
|
|
1470
|
+
return "is-error";
|
|
1471
|
+
default:
|
|
1472
|
+
return "";
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
function shortMethod(m: string): string {
|
|
1477
|
+
switch (m) {
|
|
1478
|
+
case "authenticateOptional":
|
|
1479
|
+
return "auth?";
|
|
1480
|
+
case "authenticate":
|
|
1481
|
+
return "auth";
|
|
1482
|
+
case "unauthenticatedRender":
|
|
1483
|
+
return "401";
|
|
1484
|
+
case "unauthorizedRender":
|
|
1485
|
+
return "403";
|
|
1486
|
+
case "notFoundRender":
|
|
1487
|
+
return "404";
|
|
1488
|
+
case "errorRender":
|
|
1489
|
+
return "error";
|
|
1490
|
+
default:
|
|
1491
|
+
return m;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
function safeStringify(val: unknown, indent?: number): string {
|
|
1496
|
+
try {
|
|
1497
|
+
return JSON.stringify(val, null, indent);
|
|
1498
|
+
} catch {
|
|
1499
|
+
return String(val);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
function ChainNode(props: {
|
|
1504
|
+
builderChains: Record<string, string[]>;
|
|
1505
|
+
headConfig?: Record<string, unknown>;
|
|
1506
|
+
node: RouteTreeNode;
|
|
1507
|
+
runtimeMatch?: RuntimeMatch;
|
|
1508
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1509
|
+
const [expanded, setExpanded] = createSignal(false);
|
|
1510
|
+
const methods = () => (props.node.filePath ? (props.builderChains[props.node.filePath] ?? []) : []);
|
|
1511
|
+
const isGroup = () => props.node.segment.startsWith("(") && props.node.segment.endsWith(")");
|
|
1512
|
+
const isParam = () => props.node.segment.startsWith("[") && props.node.segment.endsWith("]");
|
|
1513
|
+
const hasDetails = () =>
|
|
1514
|
+
props.node.auth !== false ||
|
|
1515
|
+
(props.node.cache && Object.keys(props.node.cache).length > 0) ||
|
|
1516
|
+
props.node.hasInput ||
|
|
1517
|
+
props.node.intercept ||
|
|
1518
|
+
props.node.responseRoute ||
|
|
1519
|
+
props.runtimeMatch?.loaderData !== undefined ||
|
|
1520
|
+
props.runtimeMatch?.preloaderContext !== undefined ||
|
|
1521
|
+
props.headConfig !== undefined;
|
|
1522
|
+
|
|
1523
|
+
return (
|
|
1524
|
+
<div
|
|
1525
|
+
class="cur-chain-node"
|
|
1526
|
+
onClick={() => setExpanded((e) => !e)}
|
|
1527
|
+
onKeyDown={(e) => {
|
|
1528
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1529
|
+
e.preventDefault();
|
|
1530
|
+
setExpanded((v) => !v);
|
|
1531
|
+
}
|
|
1532
|
+
}}
|
|
1533
|
+
role="button"
|
|
1534
|
+
tabIndex={0}
|
|
1535
|
+
>
|
|
1536
|
+
<div class="cur-chain-header">
|
|
1537
|
+
<span
|
|
1538
|
+
class="tree-badge"
|
|
1539
|
+
style={{
|
|
1540
|
+
background: `${typeBadgeColor(props.node.type)}22`,
|
|
1541
|
+
color: typeBadgeColor(props.node.type),
|
|
1542
|
+
}}
|
|
1543
|
+
>
|
|
1544
|
+
{typeBadgeLabel(props.node.type)}
|
|
1545
|
+
</span>
|
|
1546
|
+
<span class="cur-chain-seg" classList={{ "is-group": isGroup(), "is-param": isParam() }}>
|
|
1547
|
+
{props.node.segment || "/"}
|
|
1548
|
+
</span>
|
|
1549
|
+
<Show when={props.node.filePath}>
|
|
1550
|
+
<button
|
|
1551
|
+
class="cur-chain-file"
|
|
1552
|
+
onClick={(e) => {
|
|
1553
|
+
e.stopPropagation();
|
|
1554
|
+
openEditor(props.node.filePath ?? "");
|
|
1555
|
+
}}
|
|
1556
|
+
type="button"
|
|
1557
|
+
>
|
|
1558
|
+
{props.node.filePath}
|
|
1559
|
+
</button>
|
|
1560
|
+
</Show>
|
|
1561
|
+
</div>
|
|
1562
|
+
<Show when={methods().length > 0}>
|
|
1563
|
+
<div class="cur-chain-methods">
|
|
1564
|
+
<For each={methods()}>{(m) => <span class={`cur-method ${methodCategory(m)}`}>{shortMethod(m)}</span>}</For>
|
|
1565
|
+
</div>
|
|
1566
|
+
</Show>
|
|
1567
|
+
<Show when={expanded() && hasDetails()}>
|
|
1568
|
+
<div class="cur-chain-config">
|
|
1569
|
+
<Show when={props.node.virtualPath}>
|
|
1570
|
+
<div class="cur-config-row">
|
|
1571
|
+
<span class="cur-config-key">virtual</span>
|
|
1572
|
+
<span class="cur-config-val">{props.node.virtualPath}</span>
|
|
1573
|
+
</div>
|
|
1574
|
+
</Show>
|
|
1575
|
+
<Show when={props.node.urlPath && props.node.type !== "segment"}>
|
|
1576
|
+
<div class="cur-config-row">
|
|
1577
|
+
<span class="cur-config-key">variable</span>
|
|
1578
|
+
<span class="cur-config-val">{props.node.urlPath}</span>
|
|
1579
|
+
</div>
|
|
1580
|
+
</Show>
|
|
1581
|
+
<Show when={props.node.auth !== false}>
|
|
1582
|
+
<div class="cur-config-row">
|
|
1583
|
+
<span class="cur-config-key">auth</span>
|
|
1584
|
+
<span class="cur-config-val">{String(props.node.auth)}</span>
|
|
1585
|
+
</div>
|
|
1586
|
+
</Show>
|
|
1587
|
+
<Show when={props.node.cache && Object.keys(props.node.cache).length > 0}>
|
|
1588
|
+
<div class="cur-config-row">
|
|
1589
|
+
<span class="cur-config-key">cache</span>
|
|
1590
|
+
<span class="cur-config-val">{safeStringify(props.node.cache)}</span>
|
|
1591
|
+
</div>
|
|
1592
|
+
</Show>
|
|
1593
|
+
<Show when={props.node.hasInput}>
|
|
1594
|
+
<div class="cur-config-row">
|
|
1595
|
+
<span class="cur-config-key">input</span>
|
|
1596
|
+
<span class="cur-config-val">true</span>
|
|
1597
|
+
</div>
|
|
1598
|
+
</Show>
|
|
1599
|
+
<Show when={props.node.intercept}>
|
|
1600
|
+
<div class="cur-config-row">
|
|
1601
|
+
<span class="cur-config-key">intercept</span>
|
|
1602
|
+
<span class="cur-config-val">{safeStringify(props.node.intercept)}</span>
|
|
1603
|
+
</div>
|
|
1604
|
+
</Show>
|
|
1605
|
+
<Show when={props.node.responseRoute}>
|
|
1606
|
+
<div class="cur-config-row">
|
|
1607
|
+
<span class="cur-config-key">response</span>
|
|
1608
|
+
<span class="cur-config-val">true</span>
|
|
1609
|
+
</div>
|
|
1610
|
+
</Show>
|
|
1611
|
+
<Show when={props.runtimeMatch?.preloaderContext !== undefined}>
|
|
1612
|
+
<div class="cur-config-row">
|
|
1613
|
+
<span class="cur-config-key">preloader</span>
|
|
1614
|
+
<pre class="cur-config-pre">{safeStringify(props.runtimeMatch?.preloaderContext, 2)}</pre>
|
|
1615
|
+
</div>
|
|
1616
|
+
</Show>
|
|
1617
|
+
<Show when={props.runtimeMatch?.loaderData !== undefined}>
|
|
1618
|
+
<div class="cur-config-row">
|
|
1619
|
+
<span class="cur-config-key">loader</span>
|
|
1620
|
+
<pre class="cur-config-pre">{safeStringify(props.runtimeMatch?.loaderData, 2)}</pre>
|
|
1621
|
+
</div>
|
|
1622
|
+
</Show>
|
|
1623
|
+
<Show when={props.headConfig !== undefined}>
|
|
1624
|
+
<div class="cur-config-row">
|
|
1625
|
+
<span class="cur-config-key">head</span>
|
|
1626
|
+
<pre class="cur-config-pre">{safeStringify(props.headConfig, 2)}</pre>
|
|
1627
|
+
</div>
|
|
1628
|
+
</Show>
|
|
1629
|
+
</div>
|
|
1630
|
+
</Show>
|
|
1631
|
+
</div>
|
|
1632
|
+
);
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
function parseSearchParams(search: string): [string, string][] {
|
|
1636
|
+
if (!search || search === "?") return [];
|
|
1637
|
+
const params = new URLSearchParams(search);
|
|
1638
|
+
const result: [string, string][] = [];
|
|
1639
|
+
for (const [k, v] of params) {
|
|
1640
|
+
result.push([k, v]);
|
|
1641
|
+
}
|
|
1642
|
+
return result;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
function formatAge(ms: number): string {
|
|
1646
|
+
if (ms < 1000) return `${ms}ms`;
|
|
1647
|
+
if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;
|
|
1648
|
+
return `${(ms / 60000).toFixed(1)}m`;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
function CurrentTab(props: {
|
|
1652
|
+
builderChains: Record<string, string[]>;
|
|
1653
|
+
defs: RouteDef[];
|
|
1654
|
+
localeMatch?: LocaleMatch;
|
|
1655
|
+
tree: RouteTreeNode[];
|
|
1656
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
1657
|
+
const [url, setUrl] = createSignal({
|
|
1658
|
+
hash: window.location.hash,
|
|
1659
|
+
pathname: window.location.pathname,
|
|
1660
|
+
search: window.location.search,
|
|
1661
|
+
});
|
|
1662
|
+
const [htmlAttrs, setHtmlAttrs] = createSignal({
|
|
1663
|
+
dir: document.documentElement.getAttribute("dir") ?? "ltr",
|
|
1664
|
+
lang: document.documentElement.getAttribute("lang") ?? "",
|
|
1665
|
+
theme: document.documentElement.getAttribute("data-theme") ?? "",
|
|
1666
|
+
});
|
|
1667
|
+
const [docTitle, setDocTitle] = createSignal(document.title);
|
|
1668
|
+
|
|
1669
|
+
/* Watch URL changes */
|
|
1670
|
+
createEffect(() => {
|
|
1671
|
+
const update = () => {
|
|
1672
|
+
setUrl({
|
|
1673
|
+
hash: window.location.hash,
|
|
1674
|
+
pathname: window.location.pathname,
|
|
1675
|
+
search: window.location.search,
|
|
1676
|
+
});
|
|
1677
|
+
setDocTitle(document.title);
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
window.addEventListener("popstate", update);
|
|
1681
|
+
|
|
1682
|
+
const origPush = history.pushState.bind(history);
|
|
1683
|
+
const origReplace = history.replaceState.bind(history);
|
|
1684
|
+
history.pushState = (...args: Parameters<typeof history.pushState>) => {
|
|
1685
|
+
origPush(...args);
|
|
1686
|
+
update();
|
|
1687
|
+
};
|
|
1688
|
+
history.replaceState = (...args: Parameters<typeof history.replaceState>) => {
|
|
1689
|
+
origReplace(...args);
|
|
1690
|
+
update();
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
onCleanup(() => {
|
|
1694
|
+
window.removeEventListener("popstate", update);
|
|
1695
|
+
history.pushState = origPush;
|
|
1696
|
+
history.replaceState = origReplace;
|
|
1697
|
+
});
|
|
1698
|
+
});
|
|
1699
|
+
|
|
1700
|
+
/* Watch <html> attributes + title */
|
|
1701
|
+
createEffect(() => {
|
|
1702
|
+
const observer = new MutationObserver(() => {
|
|
1703
|
+
setHtmlAttrs({
|
|
1704
|
+
dir: document.documentElement.getAttribute("dir") ?? "ltr",
|
|
1705
|
+
lang: document.documentElement.getAttribute("lang") ?? "",
|
|
1706
|
+
theme: document.documentElement.getAttribute("data-theme") ?? "",
|
|
1707
|
+
});
|
|
1708
|
+
});
|
|
1709
|
+
observer.observe(document.documentElement, {
|
|
1710
|
+
attributeFilter: ["data-theme", "dir", "lang"],
|
|
1711
|
+
attributes: true,
|
|
1712
|
+
});
|
|
1713
|
+
|
|
1714
|
+
const titleObs = new MutationObserver(() => setDocTitle(document.title));
|
|
1715
|
+
const titleEl = document.querySelector("title");
|
|
1716
|
+
if (titleEl) {
|
|
1717
|
+
titleObs.observe(titleEl, { characterData: true, childList: true, subtree: true });
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
onCleanup(() => {
|
|
1721
|
+
observer.disconnect();
|
|
1722
|
+
titleObs.disconnect();
|
|
1723
|
+
});
|
|
1724
|
+
});
|
|
1725
|
+
|
|
1726
|
+
const matched = createMemo(() => matchRouteTree(props.tree, url().pathname, props.localeMatch));
|
|
1727
|
+
const searchParams = createMemo(() => parseSearchParams(url().search));
|
|
1728
|
+
|
|
1729
|
+
/* Read runtime matches (loader data, preloader context) + cache (headConfig) */
|
|
1730
|
+
const [runtimeMatches, setRuntimeMatches] = createSignal<RuntimeMatch[]>([]);
|
|
1731
|
+
const [cachedMatches, setCachedMatches] = createSignal<CachedMatchInfo[]>([]);
|
|
1732
|
+
|
|
1733
|
+
createEffect(() => {
|
|
1734
|
+
const read = () => {
|
|
1735
|
+
const matches = window.__flare_devtools_matches__;
|
|
1736
|
+
if (matches) setRuntimeMatches(matches);
|
|
1737
|
+
const cache = window.__flare_devtools_cache__;
|
|
1738
|
+
if (cache) setCachedMatches(cache);
|
|
1739
|
+
};
|
|
1740
|
+
read();
|
|
1741
|
+
|
|
1742
|
+
/* Re-read on navigation (URL signal triggers this effect) */
|
|
1743
|
+
void url();
|
|
1744
|
+
const timer = setTimeout(read, 100);
|
|
1745
|
+
onCleanup(() => clearTimeout(timer));
|
|
1746
|
+
});
|
|
1747
|
+
|
|
1748
|
+
const runtimeMatchFor = (node: RouteTreeNode): RuntimeMatch | undefined => {
|
|
1749
|
+
if (!node.virtualPath) return undefined;
|
|
1750
|
+
return runtimeMatches().find((m) => m.virtualPath === node.virtualPath);
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1753
|
+
const headConfigFor = (node: RouteTreeNode): Record<string, unknown> | undefined => {
|
|
1754
|
+
if (!node.virtualPath) return undefined;
|
|
1755
|
+
const cached = cachedMatches().find((c) => c.matchId.startsWith(`${node.virtualPath}:`));
|
|
1756
|
+
return cached?.headConfig;
|
|
1757
|
+
};
|
|
1758
|
+
|
|
1759
|
+
const currentCacheEntries = createMemo(() => {
|
|
1760
|
+
const chain = matched().chain;
|
|
1761
|
+
const vPaths = new Set(chain.map((m) => m.node.virtualPath).filter((vp): vp is string => vp !== null));
|
|
1762
|
+
const stats = window.__flare_devtools_actions__?.getCacheStats();
|
|
1763
|
+
if (!stats) return [];
|
|
1764
|
+
return stats.entries.filter((e) => {
|
|
1765
|
+
for (const vp of vPaths) {
|
|
1766
|
+
if (e.matchId.startsWith(vp)) return true;
|
|
1767
|
+
}
|
|
1768
|
+
return false;
|
|
1769
|
+
});
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
/* Read resolved <head> tags from DOM */
|
|
1773
|
+
const [headTags, setHeadTags] = createSignal<{ attrs: Record<string, string>; tag: string }[]>([]);
|
|
1774
|
+
|
|
1775
|
+
const readHeadTags = () => {
|
|
1776
|
+
const tags: { attrs: Record<string, string>; tag: string }[] = [];
|
|
1777
|
+
const head = document.head;
|
|
1778
|
+
for (const el of head.querySelectorAll("meta, link[rel]")) {
|
|
1779
|
+
const attrs: Record<string, string> = {};
|
|
1780
|
+
for (const attr of el.attributes) {
|
|
1781
|
+
attrs[attr.name] = attr.value;
|
|
1782
|
+
}
|
|
1783
|
+
tags.push({ attrs, tag: el.tagName.toLowerCase() });
|
|
1784
|
+
}
|
|
1785
|
+
setHeadTags(tags);
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
createEffect(() => {
|
|
1789
|
+
void url();
|
|
1790
|
+
readHeadTags();
|
|
1791
|
+
const timer = setTimeout(readHeadTags, 200);
|
|
1792
|
+
onCleanup(() => clearTimeout(timer));
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
const leafMatch = createMemo(() => {
|
|
1796
|
+
const chain = matched().chain;
|
|
1797
|
+
for (let i = chain.length - 1; i >= 0; i--) {
|
|
1798
|
+
const node = chain[i]?.node;
|
|
1799
|
+
if (node?.virtualPath && node.type !== "segment") return node;
|
|
1800
|
+
}
|
|
1801
|
+
return null;
|
|
1802
|
+
});
|
|
1803
|
+
|
|
1804
|
+
return (
|
|
1805
|
+
<div class="cur-grid">
|
|
1806
|
+
{/* URL + paths */}
|
|
1807
|
+
<div class="cur-section">
|
|
1808
|
+
<div class="cur-path-rows">
|
|
1809
|
+
<div class="cur-path-row">
|
|
1810
|
+
<span class="cur-path-label">path</span>
|
|
1811
|
+
<span class="cur-path-value">
|
|
1812
|
+
{url().pathname}
|
|
1813
|
+
<Show when={url().search}>
|
|
1814
|
+
<span class="cur-url-search">{url().search}</span>
|
|
1815
|
+
</Show>
|
|
1816
|
+
<Show when={url().hash}>
|
|
1817
|
+
<span class="cur-url-hash">{url().hash}</span>
|
|
1818
|
+
</Show>
|
|
1819
|
+
</span>
|
|
1820
|
+
</div>
|
|
1821
|
+
<Show when={leafMatch()}>
|
|
1822
|
+
{(leaf) => (
|
|
1823
|
+
<>
|
|
1824
|
+
<div class="cur-path-row">
|
|
1825
|
+
<span class="cur-path-label">virtual</span>
|
|
1826
|
+
<span class="cur-path-value">{leaf().virtualPath}</span>
|
|
1827
|
+
</div>
|
|
1828
|
+
<div class="cur-path-row">
|
|
1829
|
+
<span class="cur-path-label">variable</span>
|
|
1830
|
+
<span class="cur-path-value">{leaf().urlPath}</span>
|
|
1831
|
+
</div>
|
|
1832
|
+
</>
|
|
1833
|
+
)}
|
|
1834
|
+
</Show>
|
|
1835
|
+
</div>
|
|
1836
|
+
</div>
|
|
1837
|
+
|
|
1838
|
+
{/* Search params */}
|
|
1839
|
+
<Show when={searchParams().length > 0}>
|
|
1840
|
+
<div class="cur-section">
|
|
1841
|
+
<div class="cur-label">Search Params</div>
|
|
1842
|
+
<div class="cur-params">
|
|
1843
|
+
<For each={searchParams()}>
|
|
1844
|
+
{([k, v]) => (
|
|
1845
|
+
<span>
|
|
1846
|
+
<span class="cur-param-key">{k}</span>
|
|
1847
|
+
<span class="cur-param-val">{v}</span>
|
|
1848
|
+
</span>
|
|
1849
|
+
)}
|
|
1850
|
+
</For>
|
|
1851
|
+
</div>
|
|
1852
|
+
</div>
|
|
1853
|
+
</Show>
|
|
1854
|
+
|
|
1855
|
+
{/* Route chain with builder methods */}
|
|
1856
|
+
<div class="cur-section">
|
|
1857
|
+
<div class="cur-label">Route Chain</div>
|
|
1858
|
+
<Show
|
|
1859
|
+
fallback={<div style={{ color: "#52525b", "font-size": "10px" }}>No matching route</div>}
|
|
1860
|
+
when={matched().chain.length > 0}
|
|
1861
|
+
>
|
|
1862
|
+
<div class="cur-chain">
|
|
1863
|
+
<For each={matched().chain}>
|
|
1864
|
+
{(match, idx) => (
|
|
1865
|
+
<>
|
|
1866
|
+
<Show when={idx() > 0}>
|
|
1867
|
+
<div class="cur-chain-arrow">{"\u2193"}</div>
|
|
1868
|
+
</Show>
|
|
1869
|
+
<ChainNode
|
|
1870
|
+
builderChains={props.builderChains}
|
|
1871
|
+
headConfig={headConfigFor(match.node)}
|
|
1872
|
+
node={match.node}
|
|
1873
|
+
runtimeMatch={runtimeMatchFor(match.node)}
|
|
1874
|
+
/>
|
|
1875
|
+
</>
|
|
1876
|
+
)}
|
|
1877
|
+
</For>
|
|
1878
|
+
</div>
|
|
1879
|
+
</Show>
|
|
1880
|
+
</div>
|
|
1881
|
+
|
|
1882
|
+
{/* Route params */}
|
|
1883
|
+
<Show when={Object.keys(matched().params).length > 0}>
|
|
1884
|
+
<div class="cur-section">
|
|
1885
|
+
<div class="cur-label">Route Params</div>
|
|
1886
|
+
<div class="cur-params">
|
|
1887
|
+
<For each={Object.entries(matched().params)}>
|
|
1888
|
+
{([k, v]) => (
|
|
1889
|
+
<span>
|
|
1890
|
+
<span class="cur-param-key">{k}</span>
|
|
1891
|
+
<span class="cur-param-val">{v}</span>
|
|
1892
|
+
</span>
|
|
1893
|
+
)}
|
|
1894
|
+
</For>
|
|
1895
|
+
</div>
|
|
1896
|
+
</div>
|
|
1897
|
+
</Show>
|
|
1898
|
+
|
|
1899
|
+
{/* Head tags */}
|
|
1900
|
+
<Show when={headTags().length > 0}>
|
|
1901
|
+
<div class="cur-section">
|
|
1902
|
+
<div class="cur-label">Head Tags</div>
|
|
1903
|
+
<div class="cur-head-tags">
|
|
1904
|
+
<For each={headTags()}>
|
|
1905
|
+
{(tag) => (
|
|
1906
|
+
<div class="cur-head-tag">
|
|
1907
|
+
<span class="cur-head-tag-name">{`<${tag.tag}`}</span>
|
|
1908
|
+
<For each={Object.entries(tag.attrs)}>
|
|
1909
|
+
{([k, v]) => (
|
|
1910
|
+
<span class="cur-head-attr">
|
|
1911
|
+
{" "}
|
|
1912
|
+
<span class="cur-head-attr-key">{k}</span>
|
|
1913
|
+
{v ? (
|
|
1914
|
+
<>
|
|
1915
|
+
=<span class="cur-head-attr-val">"{v}"</span>
|
|
1916
|
+
</>
|
|
1917
|
+
) : null}
|
|
1918
|
+
</span>
|
|
1919
|
+
)}
|
|
1920
|
+
</For>
|
|
1921
|
+
<span class="cur-head-tag-name">{" />"}</span>
|
|
1922
|
+
</div>
|
|
1923
|
+
)}
|
|
1924
|
+
</For>
|
|
1925
|
+
</div>
|
|
1926
|
+
</div>
|
|
1927
|
+
</Show>
|
|
1928
|
+
|
|
1929
|
+
{/* Document & State */}
|
|
1930
|
+
<div class="cur-section">
|
|
1931
|
+
<div class="cur-label">Document</div>
|
|
1932
|
+
<div class="cur-meta">
|
|
1933
|
+
<div class="cur-meta-item">
|
|
1934
|
+
<span class="cur-meta-key">title</span>
|
|
1935
|
+
<span class="cur-meta-val">{docTitle() || "\u2013"}</span>
|
|
1936
|
+
</div>
|
|
1937
|
+
<div class="cur-meta-item">
|
|
1938
|
+
<span class="cur-meta-key">theme</span>
|
|
1939
|
+
<span class="cur-meta-val">{htmlAttrs().theme || "\u2013"}</span>
|
|
1940
|
+
</div>
|
|
1941
|
+
<div class="cur-meta-item">
|
|
1942
|
+
<span class="cur-meta-key">dir</span>
|
|
1943
|
+
<span class="cur-meta-val">{htmlAttrs().dir}</span>
|
|
1944
|
+
</div>
|
|
1945
|
+
<div class="cur-meta-item">
|
|
1946
|
+
<span class="cur-meta-key">lang</span>
|
|
1947
|
+
<span class="cur-meta-val">{htmlAttrs().lang || "\u2013"}</span>
|
|
1948
|
+
</div>
|
|
1949
|
+
</div>
|
|
1950
|
+
</div>
|
|
1951
|
+
|
|
1952
|
+
{/* Route Cache */}
|
|
1953
|
+
<Show when={currentCacheEntries().length > 0}>
|
|
1954
|
+
<div class="cur-section">
|
|
1955
|
+
<div class="cur-label">Route Cache</div>
|
|
1956
|
+
<div class="act-row" style={{ "margin-bottom": "6px" }}>
|
|
1957
|
+
<button
|
|
1958
|
+
class="act-btn"
|
|
1959
|
+
onClick={() => {
|
|
1960
|
+
const a = window.__flare_devtools_actions__;
|
|
1961
|
+
if (a) {
|
|
1962
|
+
a.invalidate({ revalidate: true });
|
|
1963
|
+
}
|
|
1964
|
+
}}
|
|
1965
|
+
type="button"
|
|
1966
|
+
>
|
|
1967
|
+
Refetch Current
|
|
1968
|
+
</button>
|
|
1969
|
+
<For each={currentCacheEntries()}>
|
|
1970
|
+
{(entry) => (
|
|
1971
|
+
<div class="act-stat">
|
|
1972
|
+
<span class="act-stat-key">{entry.matchId}</span>
|
|
1973
|
+
<span class="act-cache-age">{formatAge(entry.age)}</span>
|
|
1974
|
+
</div>
|
|
1975
|
+
)}
|
|
1976
|
+
</For>
|
|
1977
|
+
</div>
|
|
1978
|
+
</div>
|
|
1979
|
+
</Show>
|
|
1980
|
+
|
|
1981
|
+
{/* Error Simulation */}
|
|
1982
|
+
<div class="cur-section">
|
|
1983
|
+
<div class="cur-label">Simulate Error</div>
|
|
1984
|
+
<div class="act-row">
|
|
1985
|
+
<button
|
|
1986
|
+
class="act-btn is-danger"
|
|
1987
|
+
onClick={() => {
|
|
1988
|
+
const err = new Error("Simulated unauthenticated");
|
|
1989
|
+
Object.defineProperty(err, "name", { value: "UnauthenticatedError" });
|
|
1990
|
+
Object.defineProperty(err, "status", { value: 401 });
|
|
1991
|
+
window.__flare_devtools_actions__?.setError(err);
|
|
1992
|
+
}}
|
|
1993
|
+
type="button"
|
|
1994
|
+
>
|
|
1995
|
+
401
|
|
1996
|
+
</button>
|
|
1997
|
+
<button
|
|
1998
|
+
class="act-btn is-danger"
|
|
1999
|
+
onClick={() => {
|
|
2000
|
+
const err = new Error("Simulated unauthorized");
|
|
2001
|
+
Object.defineProperty(err, "name", { value: "UnauthorizedError" });
|
|
2002
|
+
Object.defineProperty(err, "status", { value: 403 });
|
|
2003
|
+
window.__flare_devtools_actions__?.setError(err);
|
|
2004
|
+
}}
|
|
2005
|
+
type="button"
|
|
2006
|
+
>
|
|
2007
|
+
403
|
|
2008
|
+
</button>
|
|
2009
|
+
<button
|
|
2010
|
+
class="act-btn is-danger"
|
|
2011
|
+
onClick={() => window.__flare_devtools_actions__?.setNotFound(true)}
|
|
2012
|
+
type="button"
|
|
2013
|
+
>
|
|
2014
|
+
404
|
|
2015
|
+
</button>
|
|
2016
|
+
<button
|
|
2017
|
+
class="act-btn is-danger"
|
|
2018
|
+
onClick={() => {
|
|
2019
|
+
const err = new Error("Simulated validation error");
|
|
2020
|
+
Object.defineProperty(err, "name", { value: "ServerFnValidationError" });
|
|
2021
|
+
Object.defineProperty(err, "status", { value: 400 });
|
|
2022
|
+
Object.defineProperty(err, "errors", {
|
|
2023
|
+
value: { fieldErrors: {}, formErrors: ["Simulated validation error"] },
|
|
2024
|
+
});
|
|
2025
|
+
window.__flare_devtools_actions__?.setError(err);
|
|
2026
|
+
}}
|
|
2027
|
+
type="button"
|
|
2028
|
+
>
|
|
2029
|
+
400
|
|
2030
|
+
</button>
|
|
2031
|
+
<button
|
|
2032
|
+
class="act-btn is-danger"
|
|
2033
|
+
onClick={() => window.__flare_devtools_actions__?.setError(new Error("Simulated error"))}
|
|
2034
|
+
type="button"
|
|
2035
|
+
>
|
|
2036
|
+
500
|
|
2037
|
+
</button>
|
|
2038
|
+
<button
|
|
2039
|
+
class="act-btn"
|
|
2040
|
+
onClick={() => {
|
|
2041
|
+
window.__flare_devtools_actions__?.setNotFound(false);
|
|
2042
|
+
window.__flare_devtools_actions__?.clearError();
|
|
2043
|
+
}}
|
|
2044
|
+
type="button"
|
|
2045
|
+
>
|
|
2046
|
+
Reset
|
|
2047
|
+
</button>
|
|
2048
|
+
</div>
|
|
2049
|
+
</div>
|
|
2050
|
+
</div>
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
/* ── Actions tab ──────────────────────────────────────────────────────── */
|
|
2055
|
+
|
|
2056
|
+
function CopyButton(props: {
|
|
2057
|
+
getData: () => unknown;
|
|
2058
|
+
label: string;
|
|
2059
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
2060
|
+
const [copied, setCopied] = createSignal(false);
|
|
2061
|
+
|
|
2062
|
+
const handleCopy = () => {
|
|
2063
|
+
const text = JSON.stringify(props.getData(), null, 2);
|
|
2064
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
2065
|
+
setCopied(true);
|
|
2066
|
+
setTimeout(() => setCopied(false), 1500);
|
|
2067
|
+
});
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
return (
|
|
2071
|
+
<button class="act-btn" classList={{ "is-copied": copied() }} onClick={handleCopy} type="button">
|
|
2072
|
+
{copied() ? "Copied" : props.label}
|
|
2073
|
+
</button>
|
|
2074
|
+
);
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
function extractParams(virtualPath: string): string[] {
|
|
2078
|
+
const params: string[] = [];
|
|
2079
|
+
const re = /\[([^\]]+)\]/g;
|
|
2080
|
+
let m = re.exec(virtualPath);
|
|
2081
|
+
while (m) {
|
|
2082
|
+
const name = m[1] ?? "";
|
|
2083
|
+
if (name.startsWith("...")) {
|
|
2084
|
+
params.push(name.slice(3));
|
|
2085
|
+
} else {
|
|
2086
|
+
params.push(name);
|
|
2087
|
+
}
|
|
2088
|
+
m = re.exec(virtualPath);
|
|
2089
|
+
}
|
|
2090
|
+
return params;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
function ActionsTab(props: {
|
|
2094
|
+
defs: RouteDef[];
|
|
2095
|
+
matched: { chain: MatchedRoute[]; params: Record<string, string> };
|
|
2096
|
+
serverFns: ServerFnInfo[];
|
|
2097
|
+
tree: RouteTreeNode[];
|
|
2098
|
+
}): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
2099
|
+
const actions = () => window.__flare_devtools_actions__;
|
|
2100
|
+
const [cacheStats, setCacheStats] = createSignal<{
|
|
2101
|
+
entries: { age: number; matchId: string }[];
|
|
2102
|
+
matchCount: number;
|
|
2103
|
+
prefetchCount: number;
|
|
2104
|
+
}>({ entries: [], matchCount: 0, prefetchCount: 0 });
|
|
2105
|
+
|
|
2106
|
+
const refreshStats = () => {
|
|
2107
|
+
const a = actions();
|
|
2108
|
+
if (a) setCacheStats(a.getCacheStats());
|
|
2109
|
+
};
|
|
2110
|
+
|
|
2111
|
+
createEffect(() => {
|
|
2112
|
+
refreshStats();
|
|
2113
|
+
const timer = setInterval(refreshStats, 2000);
|
|
2114
|
+
onCleanup(() => clearInterval(timer));
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
/* Navigate section */
|
|
2118
|
+
const pageRoutes = createMemo(() =>
|
|
2119
|
+
props.defs.filter((d) => d.type === "page").sort((a, b) => a.virtualPath.localeCompare(b.virtualPath)),
|
|
2120
|
+
);
|
|
2121
|
+
const [selectedRoute, setSelectedRoute] = createSignal("");
|
|
2122
|
+
const selectedParams = createMemo(() => {
|
|
2123
|
+
const vp = selectedRoute();
|
|
2124
|
+
if (!vp) return [];
|
|
2125
|
+
return extractParams(vp);
|
|
2126
|
+
});
|
|
2127
|
+
const [paramValues, setParamValues] = createSignal<Record<string, string>>({});
|
|
2128
|
+
const [useReplace, setUseReplace] = createSignal(false);
|
|
2129
|
+
|
|
2130
|
+
const resolveUrl = (): string => {
|
|
2131
|
+
const vp = selectedRoute();
|
|
2132
|
+
if (!vp) return "/";
|
|
2133
|
+
const parts = vp.split("/");
|
|
2134
|
+
const rootIdx = parts.findIndex((p) => p.startsWith("_") && p.endsWith("_") && p.length >= 3);
|
|
2135
|
+
const urlParts: string[] = [];
|
|
2136
|
+
const pv = paramValues();
|
|
2137
|
+
for (let i = 0; i < parts.length; i++) {
|
|
2138
|
+
const part = parts[i] ?? "";
|
|
2139
|
+
if (rootIdx >= 0 && i <= rootIdx) continue;
|
|
2140
|
+
if (part.startsWith("(") && part.endsWith(")")) continue;
|
|
2141
|
+
if (part === "") continue;
|
|
2142
|
+
if (part.startsWith("[[...") && part.endsWith("]]")) {
|
|
2143
|
+
const name = part.slice(5, -2);
|
|
2144
|
+
const val = pv[name];
|
|
2145
|
+
if (val) urlParts.push(val);
|
|
2146
|
+
} else if (part.startsWith("[...") && part.endsWith("]")) {
|
|
2147
|
+
const name = part.slice(4, -1);
|
|
2148
|
+
urlParts.push(pv[name] ?? "");
|
|
2149
|
+
} else if (part.startsWith("[") && part.endsWith("]")) {
|
|
2150
|
+
const name = part.slice(1, -1);
|
|
2151
|
+
urlParts.push(pv[name] ?? "");
|
|
2152
|
+
} else {
|
|
2153
|
+
urlParts.push(part);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
return `/${urlParts.join("/")}`;
|
|
2157
|
+
};
|
|
2158
|
+
|
|
2159
|
+
/* Document state */
|
|
2160
|
+
const [docState, setDocState] = createSignal({
|
|
2161
|
+
dir: document.documentElement.getAttribute("dir") ?? "ltr",
|
|
2162
|
+
lang: document.documentElement.getAttribute("lang") ?? "",
|
|
2163
|
+
theme: document.documentElement.getAttribute("data-theme") ?? "",
|
|
2164
|
+
});
|
|
2165
|
+
|
|
2166
|
+
const refreshDocState = () => {
|
|
2167
|
+
setDocState({
|
|
2168
|
+
dir: document.documentElement.getAttribute("dir") ?? "ltr",
|
|
2169
|
+
lang: document.documentElement.getAttribute("lang") ?? "",
|
|
2170
|
+
theme: document.documentElement.getAttribute("data-theme") ?? "",
|
|
2171
|
+
});
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
return (
|
|
2175
|
+
<div class="content">
|
|
2176
|
+
<div class="act-grid">
|
|
2177
|
+
{/* Cache */}
|
|
2178
|
+
<div class="act-section">
|
|
2179
|
+
<div class="act-label">Cache</div>
|
|
2180
|
+
<div class="act-row" style={{ "margin-bottom": "8px" }}>
|
|
2181
|
+
<div class="act-stat">
|
|
2182
|
+
<span class="act-stat-key">match</span>
|
|
2183
|
+
<span class="act-stat-val">{cacheStats().matchCount}</span>
|
|
2184
|
+
</div>
|
|
2185
|
+
<div class="act-stat">
|
|
2186
|
+
<span class="act-stat-key">prefetch</span>
|
|
2187
|
+
<span class="act-stat-val">{cacheStats().prefetchCount}</span>
|
|
2188
|
+
</div>
|
|
2189
|
+
</div>
|
|
2190
|
+
<div class="act-row">
|
|
2191
|
+
<button
|
|
2192
|
+
class="act-btn"
|
|
2193
|
+
onClick={() => {
|
|
2194
|
+
actions()?.invalidate();
|
|
2195
|
+
refreshStats();
|
|
2196
|
+
}}
|
|
2197
|
+
type="button"
|
|
2198
|
+
>
|
|
2199
|
+
Invalidate All
|
|
2200
|
+
</button>
|
|
2201
|
+
<button
|
|
2202
|
+
class="act-btn"
|
|
2203
|
+
onClick={() => {
|
|
2204
|
+
actions()?.clearPrefetchCache();
|
|
2205
|
+
refreshStats();
|
|
2206
|
+
}}
|
|
2207
|
+
type="button"
|
|
2208
|
+
>
|
|
2209
|
+
Clear Prefetch
|
|
2210
|
+
</button>
|
|
2211
|
+
<button
|
|
2212
|
+
class="act-btn"
|
|
2213
|
+
onClick={() => {
|
|
2214
|
+
actions()?.invalidate({ revalidate: true });
|
|
2215
|
+
refreshStats();
|
|
2216
|
+
}}
|
|
2217
|
+
type="button"
|
|
2218
|
+
>
|
|
2219
|
+
Force Refetch
|
|
2220
|
+
</button>
|
|
2221
|
+
</div>
|
|
2222
|
+
<Show when={cacheStats().entries.length > 0}>
|
|
2223
|
+
<div class="act-cache-list">
|
|
2224
|
+
<For each={cacheStats().entries}>
|
|
2225
|
+
{(entry) => (
|
|
2226
|
+
<div class="act-cache-entry">
|
|
2227
|
+
<span class="act-cache-id">{entry.matchId}</span>
|
|
2228
|
+
<span class="act-cache-age">{formatAge(entry.age)}</span>
|
|
2229
|
+
</div>
|
|
2230
|
+
)}
|
|
2231
|
+
</For>
|
|
2232
|
+
</div>
|
|
2233
|
+
</Show>
|
|
2234
|
+
</div>
|
|
2235
|
+
|
|
2236
|
+
{/* Navigate */}
|
|
2237
|
+
<div class="act-section">
|
|
2238
|
+
<div class="act-label">Navigate</div>
|
|
2239
|
+
<div class="act-row" style={{ "margin-bottom": "6px" }}>
|
|
2240
|
+
<select
|
|
2241
|
+
class="act-select"
|
|
2242
|
+
onChange={(e) => {
|
|
2243
|
+
setSelectedRoute(e.currentTarget.value);
|
|
2244
|
+
setParamValues({});
|
|
2245
|
+
}}
|
|
2246
|
+
value={selectedRoute()}
|
|
2247
|
+
>
|
|
2248
|
+
<option value="">Select route...</option>
|
|
2249
|
+
<For each={pageRoutes()}>{(def) => <option value={def.virtualPath}>{def.virtualPath}</option>}</For>
|
|
2250
|
+
</select>
|
|
2251
|
+
</div>
|
|
2252
|
+
<Show when={selectedParams().length > 0}>
|
|
2253
|
+
<div
|
|
2254
|
+
style={{
|
|
2255
|
+
display: "flex",
|
|
2256
|
+
"flex-direction": "column",
|
|
2257
|
+
gap: "4px",
|
|
2258
|
+
"margin-bottom": "6px",
|
|
2259
|
+
}}
|
|
2260
|
+
>
|
|
2261
|
+
<For each={selectedParams()}>
|
|
2262
|
+
{(param) => (
|
|
2263
|
+
<div class="act-param-row">
|
|
2264
|
+
<span class="act-param-label">{param}</span>
|
|
2265
|
+
<input
|
|
2266
|
+
class="act-input"
|
|
2267
|
+
onInput={(e) => {
|
|
2268
|
+
setParamValues((prev) => ({
|
|
2269
|
+
...prev,
|
|
2270
|
+
[param]: e.currentTarget.value,
|
|
2271
|
+
}));
|
|
2272
|
+
}}
|
|
2273
|
+
placeholder={param}
|
|
2274
|
+
value={paramValues()[param] ?? ""}
|
|
2275
|
+
/>
|
|
2276
|
+
</div>
|
|
2277
|
+
)}
|
|
2278
|
+
</For>
|
|
2279
|
+
</div>
|
|
2280
|
+
</Show>
|
|
2281
|
+
<div class="act-row">
|
|
2282
|
+
<button
|
|
2283
|
+
class="act-btn"
|
|
2284
|
+
onClick={() => {
|
|
2285
|
+
const url = resolveUrl();
|
|
2286
|
+
if (url) actions()?.navigate({ replace: useReplace(), to: url });
|
|
2287
|
+
}}
|
|
2288
|
+
type="button"
|
|
2289
|
+
>
|
|
2290
|
+
Go
|
|
2291
|
+
</button>
|
|
2292
|
+
<button
|
|
2293
|
+
class="act-btn"
|
|
2294
|
+
onClick={() => {
|
|
2295
|
+
const url = resolveUrl();
|
|
2296
|
+
if (url) actions()?.prefetch({ to: url });
|
|
2297
|
+
}}
|
|
2298
|
+
type="button"
|
|
2299
|
+
>
|
|
2300
|
+
Prefetch
|
|
2301
|
+
</button>
|
|
2302
|
+
<button class="act-btn" onClick={() => history.back()} type="button">
|
|
2303
|
+
Back
|
|
2304
|
+
</button>
|
|
2305
|
+
<button class="act-btn" onClick={() => history.forward()} type="button">
|
|
2306
|
+
Forward
|
|
2307
|
+
</button>
|
|
2308
|
+
<button
|
|
2309
|
+
class="act-btn"
|
|
2310
|
+
classList={{ "is-copied": useReplace() }}
|
|
2311
|
+
onClick={() => setUseReplace((r) => !r)}
|
|
2312
|
+
style={useReplace() ? { "border-color": "#3b82f6", color: "#3b82f6" } : {}}
|
|
2313
|
+
type="button"
|
|
2314
|
+
>
|
|
2315
|
+
{useReplace() ? "Replace" : "Push"}
|
|
2316
|
+
</button>
|
|
2317
|
+
</div>
|
|
2318
|
+
</div>
|
|
2319
|
+
|
|
2320
|
+
{/* Document */}
|
|
2321
|
+
<div class="act-section">
|
|
2322
|
+
<div class="act-label">Document</div>
|
|
2323
|
+
<div class="act-doc-row">
|
|
2324
|
+
<span class="act-doc-key">theme</span>
|
|
2325
|
+
<span class="act-doc-val">{docState().theme || "(none)"}</span>
|
|
2326
|
+
<button
|
|
2327
|
+
class="act-btn"
|
|
2328
|
+
onClick={() => {
|
|
2329
|
+
const current = document.documentElement.getAttribute("data-theme") ?? "";
|
|
2330
|
+
let next = "";
|
|
2331
|
+
if (current === "") next = "light";
|
|
2332
|
+
else if (current === "light") next = "dark";
|
|
2333
|
+
if (next) {
|
|
2334
|
+
document.documentElement.setAttribute("data-theme", next);
|
|
2335
|
+
} else {
|
|
2336
|
+
document.documentElement.removeAttribute("data-theme");
|
|
2337
|
+
}
|
|
2338
|
+
refreshDocState();
|
|
2339
|
+
}}
|
|
2340
|
+
type="button"
|
|
2341
|
+
>
|
|
2342
|
+
Cycle
|
|
2343
|
+
</button>
|
|
2344
|
+
</div>
|
|
2345
|
+
<div class="act-doc-row">
|
|
2346
|
+
<span class="act-doc-key">dir</span>
|
|
2347
|
+
<span class="act-doc-val">{docState().dir}</span>
|
|
2348
|
+
<button
|
|
2349
|
+
class="act-btn"
|
|
2350
|
+
onClick={() => {
|
|
2351
|
+
const next = document.documentElement.getAttribute("dir") === "rtl" ? "ltr" : "rtl";
|
|
2352
|
+
document.documentElement.setAttribute("dir", next);
|
|
2353
|
+
refreshDocState();
|
|
2354
|
+
}}
|
|
2355
|
+
type="button"
|
|
2356
|
+
>
|
|
2357
|
+
Toggle
|
|
2358
|
+
</button>
|
|
2359
|
+
</div>
|
|
2360
|
+
<div class="act-doc-row">
|
|
2361
|
+
<span class="act-doc-key">lang</span>
|
|
2362
|
+
<input
|
|
2363
|
+
class="act-input"
|
|
2364
|
+
onInput={(e) => {
|
|
2365
|
+
document.documentElement.setAttribute("lang", e.currentTarget.value);
|
|
2366
|
+
refreshDocState();
|
|
2367
|
+
}}
|
|
2368
|
+
placeholder="en"
|
|
2369
|
+
value={docState().lang}
|
|
2370
|
+
/>
|
|
2371
|
+
</div>
|
|
2372
|
+
</div>
|
|
2373
|
+
|
|
2374
|
+
{/* Export */}
|
|
2375
|
+
<div class="act-section">
|
|
2376
|
+
<div class="act-label">Export</div>
|
|
2377
|
+
<div class="act-row">
|
|
2378
|
+
<CopyButton
|
|
2379
|
+
getData={() => ({
|
|
2380
|
+
chain: props.matched.chain.map((m) => ({
|
|
2381
|
+
segment: m.node.segment,
|
|
2382
|
+
type: m.node.type,
|
|
2383
|
+
virtualPath: m.node.virtualPath,
|
|
2384
|
+
})),
|
|
2385
|
+
params: props.matched.params,
|
|
2386
|
+
})}
|
|
2387
|
+
label="Route Chain"
|
|
2388
|
+
/>
|
|
2389
|
+
<CopyButton getData={() => props.matched.params} label="Params" />
|
|
2390
|
+
<CopyButton getData={() => props.tree} label="Route Tree" />
|
|
2391
|
+
<CopyButton getData={() => props.defs} label="All Defs" />
|
|
2392
|
+
<CopyButton getData={() => props.serverFns} label="Server Fns" />
|
|
2393
|
+
<CopyButton getData={() => cacheStats().entries} label="Cache" />
|
|
2394
|
+
</div>
|
|
2395
|
+
</div>
|
|
2396
|
+
</div>
|
|
2397
|
+
</div>
|
|
2398
|
+
);
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
/* ── DevTools root ────────────────────────────────────────────────────── */
|
|
2402
|
+
|
|
2403
|
+
function DevTools(): ReturnType<(typeof import("solid-js"))["createComponent"]> {
|
|
2404
|
+
const [isOpen, setIsOpen] = createSignal(false);
|
|
2405
|
+
const [activeTab, setActiveTab] = createSignal<TabId>(loadState().activeTab);
|
|
2406
|
+
const [search, setSearch] = createSignal("");
|
|
2407
|
+
const [data, setData] = createSignal<ApiData | null>(null);
|
|
2408
|
+
|
|
2409
|
+
let searchRef: HTMLInputElement | null = null;
|
|
2410
|
+
|
|
2411
|
+
/* Fetch data on open */
|
|
2412
|
+
createEffect(() => {
|
|
2413
|
+
if (isOpen()) {
|
|
2414
|
+
fetch("/__flare/api")
|
|
2415
|
+
.then((r) => r.json())
|
|
2416
|
+
.then((d) => setData(d as ApiData));
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
|
|
2420
|
+
/* Persist state */
|
|
2421
|
+
createEffect(() => {
|
|
2422
|
+
saveState({
|
|
2423
|
+
activeTab: activeTab(),
|
|
2424
|
+
expandedNodes: [],
|
|
2425
|
+
sortCol: "name",
|
|
2426
|
+
sortDir: "asc",
|
|
2427
|
+
});
|
|
2428
|
+
});
|
|
2429
|
+
|
|
2430
|
+
/* Keyboard shortcuts */
|
|
2431
|
+
createEffect(() => {
|
|
2432
|
+
const handler = (e: KeyboardEvent) => {
|
|
2433
|
+
if (e.ctrlKey && e.shiftKey && e.key === "D") {
|
|
2434
|
+
e.preventDefault();
|
|
2435
|
+
setIsOpen((o) => !o);
|
|
2436
|
+
}
|
|
2437
|
+
if (e.key === "Escape" && isOpen()) {
|
|
2438
|
+
setIsOpen(false);
|
|
2439
|
+
}
|
|
2440
|
+
if (e.key === "/" && isOpen() && document.activeElement !== searchRef) {
|
|
2441
|
+
e.preventDefault();
|
|
2442
|
+
searchRef?.focus();
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
window.addEventListener("keydown", handler);
|
|
2446
|
+
onCleanup(() => window.removeEventListener("keydown", handler));
|
|
2447
|
+
});
|
|
2448
|
+
|
|
2449
|
+
const tabCount = (tabId: TabId): number | null => {
|
|
2450
|
+
const d = data();
|
|
2451
|
+
if (!d) return null;
|
|
2452
|
+
if (tabId === "tree") return d.routeTree.length;
|
|
2453
|
+
if (tabId === "server-fns") return d.serverFunctions.length;
|
|
2454
|
+
if (tabId === "current") return null;
|
|
2455
|
+
const defType = TAB_TO_DEF_TYPE[tabId];
|
|
2456
|
+
if (defType) return d.defs.filter((def) => def.type === defType).length;
|
|
2457
|
+
return null;
|
|
2458
|
+
};
|
|
2459
|
+
|
|
2460
|
+
return (
|
|
2461
|
+
<>
|
|
2462
|
+
<button
|
|
2463
|
+
class="toggle-btn"
|
|
2464
|
+
classList={{ "is-open": isOpen() }}
|
|
2465
|
+
onClick={() => setIsOpen((o) => !o)}
|
|
2466
|
+
title="Flare DevTools (Ctrl+Shift+D)"
|
|
2467
|
+
type="button"
|
|
2468
|
+
>
|
|
2469
|
+
F
|
|
2470
|
+
</button>
|
|
2471
|
+
|
|
2472
|
+
<Show when={isOpen()}>
|
|
2473
|
+
<div
|
|
2474
|
+
class="overlay"
|
|
2475
|
+
onClick={(e) => {
|
|
2476
|
+
if (e.target === e.currentTarget) setIsOpen(false);
|
|
2477
|
+
}}
|
|
2478
|
+
>
|
|
2479
|
+
<div class="modal">
|
|
2480
|
+
{/* Header */}
|
|
2481
|
+
<div class="header">
|
|
2482
|
+
<div class="tab-bar">
|
|
2483
|
+
<For each={TABS}>
|
|
2484
|
+
{(tab) => (
|
|
2485
|
+
<button
|
|
2486
|
+
class="tab-btn"
|
|
2487
|
+
classList={{ active: activeTab() === tab.id }}
|
|
2488
|
+
onClick={() => {
|
|
2489
|
+
setActiveTab(tab.id);
|
|
2490
|
+
setSearch("");
|
|
2491
|
+
}}
|
|
2492
|
+
type="button"
|
|
2493
|
+
>
|
|
2494
|
+
{tab.label}
|
|
2495
|
+
<Show when={tabCount(tab.id) !== null}>
|
|
2496
|
+
<span class="tab-count">{tabCount(tab.id)}</span>
|
|
2497
|
+
</Show>
|
|
2498
|
+
</button>
|
|
2499
|
+
)}
|
|
2500
|
+
</For>
|
|
2501
|
+
</div>
|
|
2502
|
+
<button class="close-btn" onClick={() => setIsOpen(false)} type="button">
|
|
2503
|
+
{"\u00D7"}
|
|
2504
|
+
</button>
|
|
2505
|
+
</div>
|
|
2506
|
+
|
|
2507
|
+
{/* Toolbar */}
|
|
2508
|
+
<Show when={activeTab() !== "current" && activeTab() !== "actions"}>
|
|
2509
|
+
<div class="toolbar">
|
|
2510
|
+
<input
|
|
2511
|
+
class="search-input"
|
|
2512
|
+
onInput={(e) => setSearch(e.currentTarget.value)}
|
|
2513
|
+
placeholder={`Search ${activeTab()}... (press / to focus)`}
|
|
2514
|
+
ref={(el) => {
|
|
2515
|
+
searchRef = el;
|
|
2516
|
+
}}
|
|
2517
|
+
value={search()}
|
|
2518
|
+
/>
|
|
2519
|
+
</div>
|
|
2520
|
+
</Show>
|
|
2521
|
+
|
|
2522
|
+
{/* Content */}
|
|
2523
|
+
<Show
|
|
2524
|
+
fallback={
|
|
2525
|
+
<div class="content">
|
|
2526
|
+
<div class="empty-state">Loading...</div>
|
|
2527
|
+
</div>
|
|
2528
|
+
}
|
|
2529
|
+
when={data()}
|
|
2530
|
+
>
|
|
2531
|
+
{(d) => (
|
|
2532
|
+
<Switch>
|
|
2533
|
+
<Match when={activeTab() === "tree"}>
|
|
2534
|
+
<TreeTab search={search()} tree={d().routeTree} />
|
|
2535
|
+
</Match>
|
|
2536
|
+
<Match when={activeTab() === "pages"}>
|
|
2537
|
+
<TypedListTab defs={d().defs} onOpenEditor={openEditor} search={search()} type="page" />
|
|
2538
|
+
</Match>
|
|
2539
|
+
<Match when={activeTab() === "layouts"}>
|
|
2540
|
+
<TypedListTab defs={d().defs} onOpenEditor={openEditor} search={search()} type="layout" />
|
|
2541
|
+
</Match>
|
|
2542
|
+
<Match when={activeTab() === "root-layouts"}>
|
|
2543
|
+
<TypedListTab defs={d().defs} onOpenEditor={openEditor} search={search()} type="root-layout" />
|
|
2544
|
+
</Match>
|
|
2545
|
+
<Match when={activeTab() === "segments"}>
|
|
2546
|
+
<TypedListTab defs={d().defs} onOpenEditor={openEditor} search={search()} type="path-segment" />
|
|
2547
|
+
</Match>
|
|
2548
|
+
<Match when={activeTab() === "server-fns"}>
|
|
2549
|
+
<div class="content">
|
|
2550
|
+
<ServerFnsTab fns={d().serverFunctions} onOpenEditor={openEditor} search={search()} />
|
|
2551
|
+
</div>
|
|
2552
|
+
</Match>
|
|
2553
|
+
<Match when={activeTab() === "current"}>
|
|
2554
|
+
<div class="content">
|
|
2555
|
+
<CurrentTab
|
|
2556
|
+
builderChains={d().builderChains}
|
|
2557
|
+
defs={d().defs}
|
|
2558
|
+
localeMatch={d().localeMatch}
|
|
2559
|
+
tree={d().routeTree}
|
|
2560
|
+
/>
|
|
2561
|
+
</div>
|
|
2562
|
+
</Match>
|
|
2563
|
+
<Match when={activeTab() === "actions"}>
|
|
2564
|
+
<ActionsTab
|
|
2565
|
+
defs={d().defs}
|
|
2566
|
+
matched={matchRouteTree(d().routeTree, window.location.pathname, d().localeMatch)}
|
|
2567
|
+
serverFns={d().serverFunctions}
|
|
2568
|
+
tree={d().routeTree}
|
|
2569
|
+
/>
|
|
2570
|
+
</Match>
|
|
2571
|
+
</Switch>
|
|
2572
|
+
)}
|
|
2573
|
+
</Show>
|
|
2574
|
+
|
|
2575
|
+
{/* Status bar */}
|
|
2576
|
+
<div class="status-bar">
|
|
2577
|
+
<span>Ctrl+Shift+D toggle</span>
|
|
2578
|
+
<span>Esc close</span>
|
|
2579
|
+
<span>/ search</span>
|
|
2580
|
+
</div>
|
|
2581
|
+
</div>
|
|
2582
|
+
</div>
|
|
2583
|
+
</Show>
|
|
2584
|
+
</>
|
|
2585
|
+
);
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
/* ── Mount ────────────────────────────────────────────────────────────── */
|
|
2589
|
+
|
|
2590
|
+
export function mount(): void {
|
|
2591
|
+
if (typeof window === "undefined") return;
|
|
2592
|
+
|
|
2593
|
+
const host = document.createElement("div");
|
|
2594
|
+
host.id = "__flare-devtools-host";
|
|
2595
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
2596
|
+
|
|
2597
|
+
const style = document.createElement("style");
|
|
2598
|
+
style.textContent = CSS;
|
|
2599
|
+
shadow.appendChild(style);
|
|
2600
|
+
|
|
2601
|
+
document.body.appendChild(host);
|
|
2602
|
+
render(() => <DevTools />, shadow);
|
|
2603
|
+
}
|