aktion-runtime 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -125
- package/dist/aktion.iife.js +106 -460
- package/dist/aktion.iife.js.map +1 -1
- package/dist/aktion.js +13612 -12644
- package/dist/aktion.js.map +1 -1
- package/dist/aktion.umd.cjs +106 -460
- package/dist/aktion.umd.cjs.map +1 -1
- package/dist/devtools.js +1367 -0
- package/dist/devtools.js.map +1 -0
- package/dist/{node/index-8OvnOYPI.js → language.js} +14789 -12298
- package/dist/language.js.map +1 -0
- package/dist/plugin.cjs +2660 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.js +2660 -0
- package/dist/plugin.js.map +1 -0
- package/dist/system_prompt.txt +200 -451
- package/dist/system_prompt_chat.txt +35 -85
- package/dist/testing.js +30190 -0
- package/dist/testing.js.map +1 -0
- package/dist/types/aktion-modules.d.ts +6 -10
- package/dist/types/compiler/index.d.ts +9 -11
- package/dist/types/compiler/linker.d.ts +11 -11
- package/dist/types/compiler/project.d.ts +45 -0
- package/dist/types/compiler/runtime.d.ts +22 -26
- package/dist/types/devtools/hook.d.ts +88 -0
- package/dist/types/devtools/index.d.ts +35 -0
- package/dist/types/devtools/panel.d.ts +109 -0
- package/dist/types/devtools/protocol.d.ts +130 -0
- package/dist/types/devtools/styles.d.ts +7 -0
- package/dist/types/element.d.ts +56 -25
- package/dist/types/index.d.ts +1 -1
- package/dist/types/language/builtins.d.ts +52 -0
- package/dist/types/language/index.d.ts +5 -2
- package/dist/types/language-api.d.ts +12 -8
- package/dist/types/library/components/helpers.d.ts +0 -5
- package/dist/types/library/components/wrappers.d.ts +1 -0
- package/dist/types/parser/types.d.ts +8 -9
- package/dist/types/plugin/index.d.ts +13 -6
- package/dist/types/renderer/renderer.d.ts +28 -0
- package/dist/types/runtime/builtins.d.ts +5 -11
- package/dist/types/runtime/effects.d.ts +16 -18
- package/dist/types/runtime/evaluator.d.ts +46 -5
- package/dist/types/runtime/http.d.ts +41 -1
- package/dist/types/runtime/index.d.ts +2 -1
- package/dist/types/runtime/router.d.ts +28 -2
- package/dist/types/runtime/toast.d.ts +45 -0
- package/dist/types/runtime/util.d.ts +11 -1
- package/dist/types/testing/index.d.ts +201 -0
- package/dist/types/theme/index.d.ts +3 -3
- package/dist/types/theme/styles.d.ts +1 -1
- package/dist/types/tooling/formatter.d.ts +7 -1
- package/dist/types/tooling/index.d.ts +6 -3
- package/dist/types/tooling/language-service.d.ts +10 -5
- package/dist/types/tooling/navigation.d.ts +91 -0
- package/dist/types/tooling/semantic-tokens.d.ts +24 -0
- package/dist/types/tooling/signature-help.d.ts +21 -0
- package/package.json +21 -19
- package/dist/node/compile-BUw0GAvN.cjs +0 -491
- package/dist/node/compile-BUw0GAvN.cjs.map +0 -1
- package/dist/node/compile-DxttTzo8.js +0 -492
- package/dist/node/compile-DxttTzo8.js.map +0 -1
- package/dist/node/compiler.cjs +0 -11
- package/dist/node/compiler.cjs.map +0 -1
- package/dist/node/compiler.js +0 -11
- package/dist/node/compiler.js.map +0 -1
- package/dist/node/index-8OvnOYPI.js.map +0 -1
- package/dist/node/index-DBgA3bHQ.cjs +0 -14069
- package/dist/node/index-DBgA3bHQ.cjs.map +0 -1
- package/dist/node/language.cjs +0 -1244
- package/dist/node/language.cjs.map +0 -1
- package/dist/node/language.js +0 -1244
- package/dist/node/language.js.map +0 -1
- package/dist/node/vite.cjs +0 -65
- package/dist/node/vite.cjs.map +0 -1
- package/dist/node/vite.js +0 -65
- package/dist/node/vite.js.map +0 -1
- package/dist/types/compiler/compile.d.ts +0 -54
- package/dist/types/compiler/emit.d.ts +0 -15
- package/dist/types/compiler/sourcemap.d.ts +0 -40
- package/dist/types/library/components/theme.d.ts +0 -2
- package/dist/types/plugin/vite.d.ts +0 -21
- package/dist/types/tooling/codemod.d.ts +0 -36
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ambient module declarations for `.aktion` files,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Ambient module declarations for `.aktion` files, so TypeScript resolves
|
|
3
|
+
* `import app from "./app.aktion"` to a typed `CompiledProgram` default export
|
|
4
|
+
* (the artefact the `aktion-runtime/vite` plugin emits). Opt in with one line
|
|
5
|
+
* in any `.d.ts` / `env.d.ts`:
|
|
5
6
|
*
|
|
6
7
|
* /// <reference types="aktion-runtime/aktion-modules" />
|
|
7
8
|
*
|
|
8
|
-
* The
|
|
9
|
-
* `import`/`export` graph) into a module whose default export is a
|
|
10
|
-
* `CompiledProgram`; this declaration is what types that default export.
|
|
11
|
-
*
|
|
12
|
-
* The relative import resolves both during this package's own build
|
|
9
|
+
* The relative import resolves both in this package's own build
|
|
13
10
|
* (`src/compiler/runtime.ts`) and in the published package
|
|
14
|
-
* (`dist/types/aktion-modules.d.ts` → `dist/types/compiler/runtime.d.ts`)
|
|
15
|
-
* avoiding a fragile self-referential `"aktion-runtime"` import.
|
|
11
|
+
* (`dist/types/aktion-modules.d.ts` → `dist/types/compiler/runtime.d.ts`).
|
|
16
12
|
*/
|
|
17
13
|
|
|
18
14
|
declare module "*.aktion" {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `aktion-runtime
|
|
2
|
+
* `aktion-runtime` multi-file module support — all browser-safe (no `node:*`,
|
|
3
|
+
* no bundler dependencies). Re-exported from the package root so a browser host
|
|
4
|
+
* (or the playground) can link a multi-file project in-page:
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* so it must NOT be re-exported from `src/index.ts` (the browser bundle) —
|
|
8
|
-
* only `./runtime.js` is browser-safe.
|
|
6
|
+
* import { linkProject, defineCompiledProgram } from "aktion-runtime";
|
|
7
|
+
* const { program, source } = await linkProject({ entry: "app.aktion", files });
|
|
8
|
+
* el.mountCompiled(defineCompiledProgram({ __aktionCompiled: 1, program, source, path: "app.aktion" }));
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export { emitModule, type EmitOptions } from './emit.js';
|
|
14
|
-
export { generateSourceMap, type RawSourceMap } from './sourcemap.js';
|
|
10
|
+
export { COMPILED_PROGRAM_VERSION, defineCompiledProgram, isCompiledProgram, compileLite, type CompiledProgram, type CompileLiteOptions, } from './runtime.js';
|
|
11
|
+
export { linkProgram, type LinkResult, type LinkDiagnostic, type ModuleResolver, } from './linker.js';
|
|
12
|
+
export { linkProject, resolveSpecifier, createMemoryResolver, type LinkProjectOptions, type LinkProjectResult, } from './project.js';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Program } from '../parser/types.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/** A single linker diagnostic. Positions are 1-indexed, matching `loc`. */
|
|
3
|
+
export interface LinkDiagnostic {
|
|
4
|
+
line: number;
|
|
5
|
+
column: number;
|
|
6
|
+
message: string;
|
|
7
|
+
severity: "error" | "warning";
|
|
8
|
+
}
|
|
9
|
+
/** Injected so the linker is host-agnostic (filesystem, in-memory, URL cache). */
|
|
4
10
|
export interface ModuleResolver {
|
|
5
11
|
/** Resolve a specifier relative to the importer; `null` = unresolved. */
|
|
6
12
|
resolve(spec: string, importerPath: string): string | null;
|
|
@@ -10,17 +16,11 @@ export interface ModuleResolver {
|
|
|
10
16
|
export interface LinkResult {
|
|
11
17
|
/** The merged, scope-renamed program (import statements dropped). */
|
|
12
18
|
program: Program;
|
|
13
|
-
/** Linker errors: unresolved import, missing export,
|
|
14
|
-
diagnostics:
|
|
15
|
-
/**
|
|
19
|
+
/** Linker errors: unresolved import, missing export, dep load/parse errors. */
|
|
20
|
+
diagnostics: LinkDiagnostic[];
|
|
21
|
+
/** Resolved paths of the imported modules (excludes the entry). */
|
|
16
22
|
dependencies: string[];
|
|
17
23
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Default resolver backed by Node's filesystem: relative specifiers resolve
|
|
20
|
-
* against the importer's directory. (Top-level `node:` imports are externalized
|
|
21
|
-
* in the Node build and this module never enters the browser bundle.)
|
|
22
|
-
*/
|
|
23
|
-
export declare function createNodeResolver(): ModuleResolver;
|
|
24
24
|
/**
|
|
25
25
|
* Link the import graph rooted at `entrySource`/`entryPath` into one program.
|
|
26
26
|
*/
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Program } from '../parser/types.js';
|
|
2
|
+
import { LinkDiagnostic, ModuleResolver } from './linker.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve an import specifier to a module key.
|
|
5
|
+
*
|
|
6
|
+
* - `https://host/x.aktion` → itself (a remote module)
|
|
7
|
+
* - relative/absolute under a URL importer → resolved against the URL
|
|
8
|
+
* - `/components/Button.aktion` (project root) → `components/Button.aktion`
|
|
9
|
+
* - `./Button.aktion` from `app.aktion` → `Button.aktion`
|
|
10
|
+
* - `../Button.aktion` from `components/App.aktion`→ `Button.aktion`
|
|
11
|
+
* - bare `lodash` → `null` (unresolved)
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveSpecifier(spec: string, importerPath: string): string | null;
|
|
14
|
+
/** A sync `ModuleResolver` backed by a complete in-memory `{ path → source }` map. */
|
|
15
|
+
export declare function createMemoryResolver(files: Readonly<Record<string, string>>): ModuleResolver;
|
|
16
|
+
export interface LinkProjectOptions {
|
|
17
|
+
/** Entry module key (must exist in `files`), e.g. `"app.aktion"`. */
|
|
18
|
+
entry: string;
|
|
19
|
+
/** In-memory project files, keyed by path. */
|
|
20
|
+
files: Readonly<Record<string, string>>;
|
|
21
|
+
/**
|
|
22
|
+
* Fetch a remote module's text. Defaults to the global `fetch`. Override in
|
|
23
|
+
* tests / hosts that want a custom transport or to disable remote loading.
|
|
24
|
+
*/
|
|
25
|
+
fetch?: (url: string) => Promise<string>;
|
|
26
|
+
}
|
|
27
|
+
export interface LinkProjectResult {
|
|
28
|
+
/** The merged, scope-renamed program. */
|
|
29
|
+
program: Program;
|
|
30
|
+
/** Re-emitted source of the merged program (for `mountCompiled` round-trips). */
|
|
31
|
+
source: string;
|
|
32
|
+
/** Linker + fetch diagnostics. */
|
|
33
|
+
diagnostics: LinkDiagnostic[];
|
|
34
|
+
/** Resolved paths/URLs of the imported modules (excludes the entry). */
|
|
35
|
+
dependencies: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Link an in-memory project (entry + files) into a single `CompiledProgram`-
|
|
39
|
+
* ready `Program`, fetching any `https://…` imports along the way.
|
|
40
|
+
*
|
|
41
|
+
* The walk is async only because of URL fetches — a project with no URL imports
|
|
42
|
+
* resolves on a single microtask. URL-fetch failures become diagnostics (the
|
|
43
|
+
* rest of the graph still links) rather than thrown errors.
|
|
44
|
+
*/
|
|
45
|
+
export declare function linkProject(options: LinkProjectOptions): Promise<LinkProjectResult>;
|
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
import { Program } from '../parser/types.js';
|
|
2
2
|
import { ComponentLibrary } from '../library/types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Schema version of the compiled-program contract. Bumped only on a
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* mounting garbage.
|
|
4
|
+
* Schema version of the compiled-program contract. Bumped only on a breaking
|
|
5
|
+
* change to the `CompiledProgram` shape so the runtime can reject an artefact
|
|
6
|
+
* produced by an incompatible compiler version instead of mounting garbage.
|
|
8
7
|
*/
|
|
9
8
|
export declare const COMPILED_PROGRAM_VERSION = 1;
|
|
10
9
|
/**
|
|
11
|
-
* The
|
|
12
|
-
* `<aktion-app>.mountCompiled(...)`. It carries the parsed AST
|
|
13
|
-
* skips `parse()`, plus the original source so text-based
|
|
14
|
-
* (`applyDelta`, `serializeState` round-trips, debugging) keep working.
|
|
10
|
+
* The artefact produced by the Aktion linker (`linkProject`) or `compileLite`
|
|
11
|
+
* and consumed by `<aktion-app>.mountCompiled(...)`. It carries the parsed AST
|
|
12
|
+
* so the runtime skips `parse()`, plus the original source so text-based
|
|
13
|
+
* features (`applyDelta`, `serializeState` round-trips, debugging) keep working.
|
|
15
14
|
*/
|
|
16
15
|
export interface CompiledProgram {
|
|
17
16
|
/** Version marker — see {@link COMPILED_PROGRAM_VERSION}. */
|
|
18
17
|
readonly __aktionCompiled: typeof COMPILED_PROGRAM_VERSION;
|
|
19
18
|
/** Already-parsed component-tree AST. Mounted without re-parsing. */
|
|
20
19
|
readonly program: Program;
|
|
21
|
-
/** Original
|
|
20
|
+
/** Original (or re-emitted, for a linked project) DSL source. */
|
|
22
21
|
readonly source: string;
|
|
23
|
-
/** Module id / file path — used for diagnostics
|
|
22
|
+
/** Module id / file path — used for diagnostics and HMR targeting. */
|
|
24
23
|
readonly path: string;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
|
-
* Narrowing guard for values that cross the `mountCompiled` boundary
|
|
28
|
-
*
|
|
29
|
-
* compiled artefact.
|
|
26
|
+
* Narrowing guard for values that cross the `mountCompiled` boundary so a stray
|
|
27
|
+
* object can't be mistaken for a compiled artefact.
|
|
30
28
|
*/
|
|
31
29
|
export declare function isCompiledProgram(value: unknown): value is CompiledProgram;
|
|
32
30
|
/**
|
|
33
|
-
* Identity helper the emitted module wraps its payload with. It gives
|
|
34
|
-
* a single, typed construction point —
|
|
35
|
-
*
|
|
36
|
-
*
|
|
31
|
+
* Identity helper the linker / emitted module wraps its payload with. It gives
|
|
32
|
+
* authors a single, typed construction point — `defineCompiledProgram({...})`
|
|
33
|
+
* returns a value typed as `CompiledProgram`, so a malformed payload is a
|
|
34
|
+
* compile error rather than a runtime surprise.
|
|
37
35
|
*/
|
|
38
36
|
export declare function defineCompiledProgram(compiled: CompiledProgram): CompiledProgram;
|
|
39
37
|
/** Options for {@link compileLite}. */
|
|
@@ -43,21 +41,19 @@ export interface CompileLiteOptions {
|
|
|
43
41
|
/**
|
|
44
42
|
* Library reserved for future lite-path validation. The browser runtime
|
|
45
43
|
* already re-runs `validateProgramSchema` on mount (see `element.ts`
|
|
46
|
-
* `replan()`), so the lite path intentionally skips validation here to
|
|
47
|
-
*
|
|
44
|
+
* `replan()`), so the lite path intentionally skips validation here to avoid
|
|
45
|
+
* duplicating diagnostics — it only parses and wraps.
|
|
48
46
|
*/
|
|
49
47
|
library?: ComponentLibrary;
|
|
50
48
|
}
|
|
51
49
|
/**
|
|
52
50
|
* Parse `source` and wrap it as a {@link CompiledProgram} — the minimal,
|
|
53
51
|
* browser-safe single-file compile path. Useful for mounting a program string
|
|
54
|
-
* via `mountCompiled` without the streamed-string `setResponse` API
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* validates on mount), so it adds nothing to the browser bundle beyond the
|
|
58
|
-
* parser that already ships there.
|
|
52
|
+
* via `mountCompiled` without the streamed-string `setResponse` API. It performs
|
|
53
|
+
* no module linking and no schema validation (the runtime validates on mount),
|
|
54
|
+
* so it adds nothing to the browser bundle beyond the parser that already ships.
|
|
59
55
|
*
|
|
60
|
-
* For
|
|
61
|
-
*
|
|
56
|
+
* For multi-file projects use `linkProject(...)`, which resolves the
|
|
57
|
+
* `import`/`export` graph before wrapping.
|
|
62
58
|
*/
|
|
63
59
|
export declare function compileLite(source: string, options?: CompileLiteOptions): CompiledProgram;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { DevtoolsEvent, EffectEventPayload } from './protocol.js';
|
|
2
|
+
export type { DevtoolsEvent, EffectEventPayload };
|
|
3
|
+
/** Property name the hook lives under on `globalThis`. */
|
|
4
|
+
export declare const HOOK_KEY = "__AKTION_DEVTOOLS_HOOK__";
|
|
5
|
+
/** Protocol version — bumped if the event shapes change incompatibly. */
|
|
6
|
+
export declare const DEVTOOLS_PROTOCOL_VERSION = 1;
|
|
7
|
+
/**
|
|
8
|
+
* The handle a frontend gets for one live `<aktion-app>`. It deliberately
|
|
9
|
+
* exposes only what a debugger legitimately needs — read the current state,
|
|
10
|
+
* push an edit back, read the program source, force a render, and reach the
|
|
11
|
+
* host element for DOM highlighting — never the raw runtime internals.
|
|
12
|
+
*/
|
|
13
|
+
export interface DevtoolsAppRecord {
|
|
14
|
+
/** Stable per-element id (`aktion-app-1`). */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Human label shown in the app picker. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** The live custom element (used for highlight flashes / scroll-into-view). */
|
|
19
|
+
element: HTMLElement;
|
|
20
|
+
/** Current reactive `$state` snapshot. */
|
|
21
|
+
getState(): Record<string, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Apply an edit to a reactive atom. `path` may be dotted (`user.name`);
|
|
24
|
+
* the write goes through the normal reactive pipeline so dependents
|
|
25
|
+
* re-render and computed atoms re-derive.
|
|
26
|
+
*/
|
|
27
|
+
setState(path: string, value: unknown): void;
|
|
28
|
+
/** The current program source text. */
|
|
29
|
+
getProgram(): string;
|
|
30
|
+
/** Force a full (non-memoized) re-render — handy after a manual edit. */
|
|
31
|
+
forceRender(): void;
|
|
32
|
+
}
|
|
33
|
+
export type DevtoolsEventListener = (event: DevtoolsEvent) => void;
|
|
34
|
+
export type DevtoolsAppListener = (action: "register" | "unregister", app: DevtoolsAppRecord) => void;
|
|
35
|
+
export interface AktionDevtoolsHook {
|
|
36
|
+
/** Marker so a frontend can be sure it found the genuine hub. */
|
|
37
|
+
readonly aktion: true;
|
|
38
|
+
/** Protocol version of the installed hub. */
|
|
39
|
+
readonly protocolVersion: number;
|
|
40
|
+
/** Runtime library version that last touched the hook (best-effort). */
|
|
41
|
+
libraryVersion: string;
|
|
42
|
+
/** Apps currently mounted on the page, keyed by id. */
|
|
43
|
+
readonly apps: Map<string, DevtoolsAppRecord>;
|
|
44
|
+
/**
|
|
45
|
+
* Ring buffer of recent events so a frontend that attaches *after* an app
|
|
46
|
+
* has already rendered can backfill its timeline. Capped to `bufferLimit`.
|
|
47
|
+
*/
|
|
48
|
+
readonly buffer: DevtoolsEvent[];
|
|
49
|
+
/** Max events retained in {@link buffer}. */
|
|
50
|
+
bufferLimit: number;
|
|
51
|
+
/**
|
|
52
|
+
* True once at least one frontend is listening. The runtime checks this to
|
|
53
|
+
* decide whether to pay for profiler bookkeeping — when no DevTools is open
|
|
54
|
+
* the answer is `false` and the instrumentation stays dormant.
|
|
55
|
+
*/
|
|
56
|
+
readonly active: boolean;
|
|
57
|
+
emit(event: DevtoolsEvent): void;
|
|
58
|
+
registerApp(app: DevtoolsAppRecord): void;
|
|
59
|
+
unregisterApp(id: string): void;
|
|
60
|
+
subscribe(listener: DevtoolsEventListener): () => void;
|
|
61
|
+
subscribeApps(listener: DevtoolsAppListener): () => void;
|
|
62
|
+
}
|
|
63
|
+
/** Return the installed hook, or `undefined` when no DevTools is present. */
|
|
64
|
+
export declare function getDevtoolsHook(): AktionDevtoolsHook | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Cheap predicate the runtime uses to gate profiling work. Returns `true`
|
|
67
|
+
* only when a hook exists AND a frontend is actually subscribed, so an
|
|
68
|
+
* installed-but-idle hook still costs nothing.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isDevtoolsActive(): boolean;
|
|
71
|
+
/** Emit one event to the hook if present. */
|
|
72
|
+
export declare function emitDevtoolsEvent(event: DevtoolsEvent): void;
|
|
73
|
+
/** Register a live app with the hook if present. */
|
|
74
|
+
export declare function registerDevtoolsApp(app: DevtoolsAppRecord): void;
|
|
75
|
+
/** Remove an app from the hook if present. */
|
|
76
|
+
export declare function unregisterDevtoolsApp(id: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Install (idempotently) the reference hub implementation and return it. The
|
|
79
|
+
* in-page UI calls this; a browser extension could install its own
|
|
80
|
+
* conforming object instead. Calling it twice returns the same instance, so
|
|
81
|
+
* multiple `mountDevtools()` panels share one event stream.
|
|
82
|
+
*/
|
|
83
|
+
export declare function installDevtoolsHook(libraryVersion?: string): AktionDevtoolsHook;
|
|
84
|
+
/**
|
|
85
|
+
* High-resolution monotonic clock in milliseconds, with a `Date.now()`
|
|
86
|
+
* fallback for environments without `performance` (some headless DOMs).
|
|
87
|
+
*/
|
|
88
|
+
export declare function nowMs(): number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aktion DevTools (`aktion/devtools`)
|
|
3
|
+
* ===================================
|
|
4
|
+
*
|
|
5
|
+
* A real, in-page debugger for any `<aktion-app>` on the page — the Aktion
|
|
6
|
+
* equivalent of the React / Vue DevTools, built around Aktion's own runtime
|
|
7
|
+
* signals:
|
|
8
|
+
*
|
|
9
|
+
* - **State inspector** — a live, editable tree of every reactive `$state`
|
|
10
|
+
* atom. Edits flow back through the genuine reactive pipeline, so changing
|
|
11
|
+
* a value here re-renders the app and re-derives computed atoms exactly as
|
|
12
|
+
* a real event handler would. Changed atoms flash.
|
|
13
|
+
* - **Render profiler** — every commit, captured with its trigger, duration,
|
|
14
|
+
* and a flamegraph of which component instances mounted / updated / were
|
|
15
|
+
* memoized (and *why*), plus a ranked "most expensive components" table.
|
|
16
|
+
* - **Effect timeline** — every effect's mount → run → cleanup → unmount,
|
|
17
|
+
* attributed to the trigger that fired it (`$count` change, `every(N)`
|
|
18
|
+
* tick, lifecycle), with per-effect lanes and run timings.
|
|
19
|
+
*
|
|
20
|
+
* Architecture mirrors the browser-DevTools split: the runtime ("backend")
|
|
21
|
+
* always emits to a global hook (`__AKTION_DEVTOOLS_HOOK__`) but the calls are
|
|
22
|
+
* cheap no-ops until a frontend subscribes. This module is the in-page
|
|
23
|
+
* frontend; a browser-extension frontend could speak the identical protocol.
|
|
24
|
+
*
|
|
25
|
+
* Usage — drop one line into any page that loads Aktion:
|
|
26
|
+
*
|
|
27
|
+
* import { mountDevtools } from "aktion/devtools";
|
|
28
|
+
* mountDevtools();
|
|
29
|
+
*
|
|
30
|
+
* It is a separate, opt-in entry so production bundles that never import it
|
|
31
|
+
* pay nothing for the panel UI.
|
|
32
|
+
*/
|
|
33
|
+
export { installDevtoolsHook, getDevtoolsHook, isDevtoolsActive, HOOK_KEY, DEVTOOLS_PROTOCOL_VERSION, type AktionDevtoolsHook, type DevtoolsAppRecord, type DevtoolsEventListener, type DevtoolsAppListener, } from './hook.js';
|
|
34
|
+
export type { DevtoolsEvent, DevtoolsEventKind, CommitRecord, ComponentRenderRecord, RenderPhase, ComponentKind, StateEvent, EffectEvent, EffectEventPayload, EffectPhase, } from './protocol.js';
|
|
35
|
+
export { mountDevtools, defineDevtoolsElement, isDevtoolsInstalled, AktionDevtoolsElement, type MountDevtoolsOptions, type DevtoolsController, } from './panel.js';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { AktionDevtoolsHook } from './hook.js';
|
|
2
|
+
import { CommitRecord, EffectEvent } from './protocol.js';
|
|
3
|
+
/** Per-app derived model the panel maintains from the event stream. */
|
|
4
|
+
interface AppModel {
|
|
5
|
+
commits: CommitRecord[];
|
|
6
|
+
effects: EffectEvent[];
|
|
7
|
+
state: Record<string, unknown>;
|
|
8
|
+
/** Atom (root) → timestamp of last change, for flash highlighting. */
|
|
9
|
+
changed: Map<string, number>;
|
|
10
|
+
/** Timestamp of the first observed event (timeline zero). */
|
|
11
|
+
firstTime: number | null;
|
|
12
|
+
}
|
|
13
|
+
export declare class AktionDevtoolsElement extends HTMLElement {
|
|
14
|
+
static readonly tagName = "aktion-devtools";
|
|
15
|
+
private hook;
|
|
16
|
+
private unsubEvents;
|
|
17
|
+
private unsubApps;
|
|
18
|
+
private readonly models;
|
|
19
|
+
private selectedAppId;
|
|
20
|
+
private tab;
|
|
21
|
+
private paused;
|
|
22
|
+
private stateFilter;
|
|
23
|
+
private expanded;
|
|
24
|
+
private editingPath;
|
|
25
|
+
private selectedCommitId;
|
|
26
|
+
private flashOnCommit;
|
|
27
|
+
private phaseFilter;
|
|
28
|
+
private collapsed;
|
|
29
|
+
private renderScheduled;
|
|
30
|
+
private flashTimer;
|
|
31
|
+
private root;
|
|
32
|
+
private panelEl;
|
|
33
|
+
private controlsEl;
|
|
34
|
+
private tabsEl;
|
|
35
|
+
private bodyEl;
|
|
36
|
+
connectedCallback(): void;
|
|
37
|
+
disconnectedCallback(): void;
|
|
38
|
+
open(): void;
|
|
39
|
+
close(): void;
|
|
40
|
+
toggle(): void;
|
|
41
|
+
selectApp(id: string): void;
|
|
42
|
+
/** Test/inspection hook: the derived model for an app (or the selected one). */
|
|
43
|
+
getModel(appId?: string): AppModel | null;
|
|
44
|
+
private ensureModel;
|
|
45
|
+
/** Adopt an app: ensure a model and seed its current state snapshot. */
|
|
46
|
+
private adopt;
|
|
47
|
+
/** Ask every `<aktion-app>` on the page to register with the hook. */
|
|
48
|
+
private discoverApps;
|
|
49
|
+
private onApp;
|
|
50
|
+
private onEvent;
|
|
51
|
+
private ingest;
|
|
52
|
+
private scheduleRender;
|
|
53
|
+
private currentApp;
|
|
54
|
+
private render;
|
|
55
|
+
private buildSkeleton;
|
|
56
|
+
private renderControls;
|
|
57
|
+
private renderTabs;
|
|
58
|
+
private renderBody;
|
|
59
|
+
private renderStateTab;
|
|
60
|
+
/** Re-render only the tree (used by the filter box to keep its focus). */
|
|
61
|
+
private renderTreeOnly;
|
|
62
|
+
private fillTree;
|
|
63
|
+
private appendRow;
|
|
64
|
+
private beginEdit;
|
|
65
|
+
private renderProfilerTab;
|
|
66
|
+
private renderCommitDetail;
|
|
67
|
+
private renderFlameRow;
|
|
68
|
+
private renderRankedComponents;
|
|
69
|
+
private renderEffectsTab;
|
|
70
|
+
private renderEffectLanes;
|
|
71
|
+
private renderEffectLog;
|
|
72
|
+
private flashApp;
|
|
73
|
+
private makeDraggable;
|
|
74
|
+
private makeResizable;
|
|
75
|
+
}
|
|
76
|
+
/** Register the custom element (idempotent). */
|
|
77
|
+
export declare function defineDevtoolsElement(): void;
|
|
78
|
+
export interface MountDevtoolsOptions {
|
|
79
|
+
/** Where to append the panel (default `document.body`). */
|
|
80
|
+
container?: HTMLElement;
|
|
81
|
+
/** Pre-select an app by id. */
|
|
82
|
+
appId?: string;
|
|
83
|
+
/** Start open (default `true`). */
|
|
84
|
+
open?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface DevtoolsController {
|
|
87
|
+
/** The live panel element. */
|
|
88
|
+
element: AktionDevtoolsElement;
|
|
89
|
+
/** The installed hook (shared across panels). */
|
|
90
|
+
hook: AktionDevtoolsHook;
|
|
91
|
+
open(): void;
|
|
92
|
+
close(): void;
|
|
93
|
+
toggle(): void;
|
|
94
|
+
selectApp(id: string): void;
|
|
95
|
+
/** Remove the panel from the DOM (the hook + event stream stay installed). */
|
|
96
|
+
destroy(): void;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Install the DevTools hook and mount an in-page panel. Idempotent at the
|
|
100
|
+
* hook level — multiple panels share one event stream — but each call mounts
|
|
101
|
+
* a fresh panel element.
|
|
102
|
+
*
|
|
103
|
+
* import { mountDevtools } from "aktion/devtools";
|
|
104
|
+
* mountDevtools();
|
|
105
|
+
*/
|
|
106
|
+
export declare function mountDevtools(options?: MountDevtoolsOptions): DevtoolsController;
|
|
107
|
+
/** Whether a DevTools hook is currently installed on the page. */
|
|
108
|
+
export declare function isDevtoolsInstalled(): boolean;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aktion DevTools — wire protocol.
|
|
3
|
+
*
|
|
4
|
+
* The runtime ("backend") and the DevTools UI ("frontend") only ever talk
|
|
5
|
+
* through the structured events declared here, exactly like the
|
|
6
|
+
* React/Vue DevTools split. Keeping the protocol in its own dependency-free
|
|
7
|
+
* module means:
|
|
8
|
+
*
|
|
9
|
+
* - the runtime can emit events without pulling in any UI code, and
|
|
10
|
+
* - a future *browser-extension* frontend (running in a different realm,
|
|
11
|
+
* behind `postMessage`) can re-use the identical, JSON-serialisable
|
|
12
|
+
* shapes without importing the runtime.
|
|
13
|
+
*
|
|
14
|
+
* Every payload is plain data — no class instances, no DOM nodes, no
|
|
15
|
+
* functions — so an event survives `structuredClone` / `JSON` transport.
|
|
16
|
+
*/
|
|
17
|
+
/** Discriminator shared by every event flowing over the hook. */
|
|
18
|
+
export type DevtoolsEventKind = "commit" | "state" | "effect";
|
|
19
|
+
/**
|
|
20
|
+
* What happened to one component instance during a commit.
|
|
21
|
+
* - `mount` — first time this instance appeared in the tree.
|
|
22
|
+
* - `update` — re-evaluated (its args or a `$state` dep it reads changed,
|
|
23
|
+
* or the commit was a forced full render).
|
|
24
|
+
* - `memo` — skipped via per-instance memoization; its cached value was
|
|
25
|
+
* reused and its body did NOT run.
|
|
26
|
+
*/
|
|
27
|
+
export type RenderPhase = "mount" | "update" | "memo";
|
|
28
|
+
/** Whether a component is a user `function Foo()` or a built-in library one. */
|
|
29
|
+
export type ComponentKind = "user" | "library";
|
|
30
|
+
/** One component instance's contribution to a single commit. */
|
|
31
|
+
export interface ComponentRenderRecord {
|
|
32
|
+
/** Stable per-instance key derived from the render path. */
|
|
33
|
+
instanceKey: string;
|
|
34
|
+
/** Display name (`Counter`, `Button`, …). */
|
|
35
|
+
name: string;
|
|
36
|
+
/** `user` (`function Foo()`) or `library` (built-in primitive). */
|
|
37
|
+
kind: ComponentKind;
|
|
38
|
+
/** Render phase for this commit. */
|
|
39
|
+
phase: RenderPhase;
|
|
40
|
+
/**
|
|
41
|
+
* Self time in milliseconds.
|
|
42
|
+
* - user components: body-evaluation time only (children excluded).
|
|
43
|
+
* - library components: inclusive of synchronously-rendered children
|
|
44
|
+
* (their render function builds the subtree in one call).
|
|
45
|
+
* Zero for `memo` (skipped) records.
|
|
46
|
+
*/
|
|
47
|
+
selfTime: number;
|
|
48
|
+
/** Nesting depth in the render tree — drives flamegraph indentation. */
|
|
49
|
+
depth: number;
|
|
50
|
+
/** For user components: the `$state` paths this body read (its memo deps). */
|
|
51
|
+
deps?: string[];
|
|
52
|
+
/** Human-readable reason the instance rendered (or was skipped). */
|
|
53
|
+
reason: string;
|
|
54
|
+
}
|
|
55
|
+
/** A single committed render pass over the whole program tree. */
|
|
56
|
+
export interface CommitRecord {
|
|
57
|
+
kind: "commit";
|
|
58
|
+
appId: string;
|
|
59
|
+
/** Monotonic sequence number within the app (0 = initial mount). */
|
|
60
|
+
commitId: number;
|
|
61
|
+
/** Timestamp (ms, from `nowMs()`) when the commit started. */
|
|
62
|
+
startTime: number;
|
|
63
|
+
/** Total wall-clock time of the commit (evaluate → render → morph), in ms. */
|
|
64
|
+
duration: number;
|
|
65
|
+
/** Reactive `$state` paths that triggered this commit (empty if forced). */
|
|
66
|
+
changedPaths: string[];
|
|
67
|
+
/** True when memoization was disabled and the whole tree re-evaluated. */
|
|
68
|
+
fullRender: boolean;
|
|
69
|
+
/** True for the very first commit of the program (initial mount). */
|
|
70
|
+
initial: boolean;
|
|
71
|
+
/** Per-instance records (both rendered and memoized), in render order. */
|
|
72
|
+
components: ComponentRenderRecord[];
|
|
73
|
+
/** Number of instances that actually rendered (phase !== "memo"). */
|
|
74
|
+
rendered: number;
|
|
75
|
+
/** Number of instances skipped via memoization. */
|
|
76
|
+
memoized: number;
|
|
77
|
+
}
|
|
78
|
+
/** A reactive-state change notification (one per state-store flush). */
|
|
79
|
+
export interface StateEvent {
|
|
80
|
+
kind: "state";
|
|
81
|
+
appId: string;
|
|
82
|
+
/** Full reactive `$state` snapshot after the change. */
|
|
83
|
+
snapshot: Record<string, unknown>;
|
|
84
|
+
/** Dotted paths changed in this flush (`count`, `user.name`, …). */
|
|
85
|
+
changedPaths: string[];
|
|
86
|
+
/** Timestamp (ms, from `nowMs()`). */
|
|
87
|
+
time: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Effect lifecycle phases.
|
|
91
|
+
* - `mount` — the declaration was registered (subscriptions/intervals wired).
|
|
92
|
+
* - `run` — the effect body executed.
|
|
93
|
+
* - `cleanup` — registered `cleanup(fn)` handlers fired (before a re-run or teardown).
|
|
94
|
+
* - `unmount` — the declaration was torn down (instance left the tree / replan).
|
|
95
|
+
* - `error` — the body threw.
|
|
96
|
+
*/
|
|
97
|
+
export type EffectPhase = "mount" | "run" | "cleanup" | "unmount" | "error";
|
|
98
|
+
/**
|
|
99
|
+
* The runtime-facing half of an effect event — everything the
|
|
100
|
+
* {@link EffectRunner} can compute on its own. The host element stamps on
|
|
101
|
+
* `appId` + `time` to produce the full {@link EffectEvent}.
|
|
102
|
+
*/
|
|
103
|
+
export interface EffectEventPayload {
|
|
104
|
+
/** Mounted-effect key (`__effect_L3_C1`, or `<instanceKey>::<name>`). */
|
|
105
|
+
effectKey: string;
|
|
106
|
+
/** Friendly label (`effect @ L3:C1`). */
|
|
107
|
+
label: string;
|
|
108
|
+
/** Owning component instance key, or `null` for a top-level effect. */
|
|
109
|
+
instanceKey: string | null;
|
|
110
|
+
phase: EffectPhase;
|
|
111
|
+
/** Why this happened: `mount`, `state:count`, `every(1000)`, `cleanup`, `unmount`. */
|
|
112
|
+
reason: string;
|
|
113
|
+
/** Declared trigger summary (`["mount", $count]`). */
|
|
114
|
+
triggers: string;
|
|
115
|
+
/** Body run time in ms (only for `run`). */
|
|
116
|
+
duration?: number;
|
|
117
|
+
/** Number of cleanup handlers fired (only for `cleanup`). */
|
|
118
|
+
cleanups?: number;
|
|
119
|
+
/** Error message (only for `error`). */
|
|
120
|
+
error?: string;
|
|
121
|
+
}
|
|
122
|
+
/** A timeline-ready effect event. */
|
|
123
|
+
export interface EffectEvent extends EffectEventPayload {
|
|
124
|
+
kind: "effect";
|
|
125
|
+
appId: string;
|
|
126
|
+
/** Timestamp (ms, from `nowMs()`). */
|
|
127
|
+
time: number;
|
|
128
|
+
}
|
|
129
|
+
/** The full union of events the hook fans out to DevTools frontends. */
|
|
130
|
+
export type DevtoolsEvent = CommitRecord | StateEvent | EffectEvent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styles for the `<aktion-devtools>` panel. Injected once into the panel's
|
|
3
|
+
* own shadow root so it is fully isolated from both the host page and the
|
|
4
|
+
* inspected `<aktion-app>` — the inspector can never be restyled by the app
|
|
5
|
+
* it is inspecting, and vice versa.
|
|
6
|
+
*/
|
|
7
|
+
export declare const devtoolsStyles = "\n:host {\n --dt-bg: #16181d;\n --dt-bg-raised: #1d2026;\n --dt-bg-inset: #101216;\n --dt-border: #2b2f38;\n --dt-border-strong: #3a3f4b;\n --dt-text: #e6e8ec;\n --dt-text-dim: #9aa0ab;\n --dt-text-faint: #6b7280;\n --dt-accent: #7c9cff;\n --dt-accent-soft: #2a3357;\n --dt-green: #5ad19b;\n --dt-blue: #6aa6ff;\n --dt-amber: #f0b35e;\n --dt-grey: #5b626f;\n --dt-red: #f87171;\n --dt-purple: #c08cf0;\n --dt-mono: ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace;\n --dt-sans: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n all: initial;\n position: fixed;\n z-index: 2147483000;\n font-family: var(--dt-sans);\n color: var(--dt-text);\n contain: layout style;\n}\n:host([hidden]) { display: none; }\n\n*, *::before, *::after { box-sizing: border-box; }\n\n.panel {\n display: flex;\n flex-direction: column;\n width: 480px;\n height: 560px;\n max-width: 96vw;\n max-height: 92vh;\n background: var(--dt-bg);\n border: 1px solid var(--dt-border-strong);\n border-radius: 12px;\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);\n overflow: hidden;\n font-size: 12px;\n line-height: 1.45;\n}\n.panel.is-collapsed { height: auto !important; }\n.panel.is-collapsed .panel-body,\n.panel.is-collapsed .tabs { display: none; }\n\n/* ---- Header ---- */\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 10px;\n background: var(--dt-bg-raised);\n border-bottom: 1px solid var(--dt-border);\n cursor: grab;\n user-select: none;\n}\n.header.is-dragging { cursor: grabbing; }\n.brand {\n display: flex;\n align-items: center;\n gap: 6px;\n font-weight: 700;\n font-size: 12px;\n letter-spacing: 0.2px;\n white-space: nowrap;\n}\n.brand .bolt { color: var(--dt-accent); font-size: 13px; }\n.brand .ver { color: var(--dt-text-faint); font-weight: 500; font-size: 10px; }\n.header .spacer { flex: 1; }\n\n.app-select {\n appearance: none;\n background: var(--dt-bg-inset);\n color: var(--dt-text);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n padding: 3px 22px 3px 8px;\n font-size: 11px;\n font-family: var(--dt-sans);\n max-width: 150px;\n cursor: pointer;\n background-image: url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 3.5 5 6.5 8 3.5' stroke='%239aa0ab' fill='none' stroke-width='1.4'/></svg>\");\n background-repeat: no-repeat;\n background-position: right 6px center;\n}\n.app-select:focus { outline: none; border-color: var(--dt-accent); }\n\n.icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n height: 24px;\n min-width: 24px;\n padding: 0 6px;\n background: var(--dt-bg-inset);\n color: var(--dt-text-dim);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n font-size: 11px;\n cursor: pointer;\n font-family: var(--dt-sans);\n}\n.icon-btn:hover { color: var(--dt-text); border-color: var(--dt-border-strong); }\n.icon-btn.is-on { color: var(--dt-text); border-color: var(--dt-accent); }\n.rec-dot {\n width: 8px; height: 8px; border-radius: 50%;\n background: var(--dt-red);\n}\n.rec-dot.is-paused { background: var(--dt-text-faint); }\n\n/* ---- Tabs ---- */\n.tabs {\n display: flex;\n gap: 2px;\n padding: 6px 8px 0;\n background: var(--dt-bg-raised);\n border-bottom: 1px solid var(--dt-border);\n}\n.tab {\n appearance: none;\n background: transparent;\n border: none;\n border-bottom: 2px solid transparent;\n color: var(--dt-text-dim);\n padding: 6px 12px 8px;\n font-size: 12px;\n font-family: var(--dt-sans);\n cursor: pointer;\n border-radius: 6px 6px 0 0;\n}\n.tab:hover { color: var(--dt-text); background: rgba(255,255,255,0.03); }\n.tab.is-active { color: var(--dt-text); border-bottom-color: var(--dt-accent); font-weight: 600; }\n.tab .count {\n margin-left: 5px;\n font-size: 10px;\n color: var(--dt-text-faint);\n font-variant-numeric: tabular-nums;\n}\n\n/* ---- Body ---- */\n.panel-body {\n flex: 1;\n overflow: auto;\n background: var(--dt-bg);\n}\n.panel-body::-webkit-scrollbar { width: 10px; height: 10px; }\n.panel-body::-webkit-scrollbar-thumb { background: var(--dt-border-strong); border-radius: 6px; border: 2px solid var(--dt-bg); }\n\n.toolbar {\n position: sticky;\n top: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 7px 10px;\n background: var(--dt-bg);\n border-bottom: 1px solid var(--dt-border);\n}\n.toolbar .grow { flex: 1; }\n.search {\n flex: 1;\n background: var(--dt-bg-inset);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n padding: 4px 8px;\n color: var(--dt-text);\n font-size: 11px;\n font-family: var(--dt-mono);\n}\n.search:focus { outline: none; border-color: var(--dt-accent); }\n.muted { color: var(--dt-text-dim); font-size: 11px; }\n.faint { color: var(--dt-text-faint); }\n.empty {\n padding: 28px 16px;\n text-align: center;\n color: var(--dt-text-faint);\n font-size: 12px;\n}\n.empty code { color: var(--dt-text-dim); font-family: var(--dt-mono); }\n\n/* ---- State inspector tree ---- */\n.tree { padding: 4px 0; }\n.row {\n display: flex;\n align-items: flex-start;\n gap: 4px;\n padding: 2px 10px 2px 0;\n font-family: var(--dt-mono);\n font-size: 11.5px;\n white-space: nowrap;\n}\n.row:hover { background: rgba(255,255,255,0.035); }\n.row .twist {\n width: 14px;\n flex: 0 0 14px;\n color: var(--dt-text-faint);\n cursor: pointer;\n text-align: center;\n user-select: none;\n}\n.row .twist.is-leaf { visibility: hidden; }\n.row .k { color: var(--dt-purple); }\n.row .sep { color: var(--dt-text-faint); }\n.row .v { color: var(--dt-text); cursor: text; }\n.row .v.t-string { color: var(--dt-green); }\n.row .v.t-number { color: var(--dt-amber); }\n.row .v.t-boolean { color: var(--dt-blue); }\n.row .v.t-null, .row .v.t-undefined { color: var(--dt-text-faint); font-style: italic; }\n.row .v.t-object, .row .v.t-array, .row .v.t-function { color: var(--dt-text-dim); }\n.row .tag {\n margin-left: 6px;\n font-size: 9px;\n font-family: var(--dt-sans);\n color: var(--dt-text-faint);\n border: 1px solid var(--dt-border);\n border-radius: 4px;\n padding: 0 4px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n.row.is-changed { background: var(--dt-accent-soft); animation: dt-flash 1.1s ease-out; }\n@keyframes dt-flash {\n 0% { background: rgba(124,156,255,0.55); }\n 100% { background: transparent; }\n}\n.edit-input {\n background: var(--dt-bg-inset);\n border: 1px solid var(--dt-accent);\n border-radius: 4px;\n color: var(--dt-text);\n font-family: var(--dt-mono);\n font-size: 11.5px;\n padding: 0 4px;\n min-width: 80px;\n}\n.edit-input:focus { outline: none; }\n\n/* ---- Profiler ---- */\n.commit-strip {\n display: flex;\n align-items: flex-end;\n gap: 2px;\n height: 64px;\n padding: 8px 10px;\n background: var(--dt-bg-inset);\n border-bottom: 1px solid var(--dt-border);\n overflow-x: auto;\n}\n.commit-bar {\n flex: 0 0 9px;\n min-height: 3px;\n background: var(--dt-blue);\n border-radius: 2px 2px 0 0;\n cursor: pointer;\n opacity: 0.65;\n transition: opacity 0.1s;\n}\n.commit-bar:hover { opacity: 1; }\n.commit-bar.is-full { background: var(--dt-amber); }\n.commit-bar.is-initial { background: var(--dt-green); }\n.commit-bar.is-selected { opacity: 1; outline: 1.5px solid var(--dt-text); outline-offset: 1px; }\n\n.section { padding: 10px; border-bottom: 1px solid var(--dt-border); }\n.section-title {\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.6px;\n color: var(--dt-text-faint);\n margin: 0 0 7px;\n font-weight: 700;\n}\n.kv { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }\n.kv span { font-size: 11px; color: var(--dt-text-dim); }\n.kv b { color: var(--dt-text); font-weight: 600; }\n.kv .mono { font-family: var(--dt-mono); }\n.chip {\n display: inline-block;\n font-size: 10px;\n padding: 1px 6px;\n border-radius: 999px;\n font-family: var(--dt-mono);\n}\n.chip.green { background: rgba(90,209,155,0.16); color: var(--dt-green); }\n.chip.blue { background: rgba(106,166,255,0.16); color: var(--dt-blue); }\n.chip.amber { background: rgba(240,179,94,0.16); color: var(--dt-amber); }\n.chip.grey { background: rgba(91,98,111,0.22); color: var(--dt-text-dim); }\n.chip.red { background: rgba(248,113,113,0.16); color: var(--dt-red); }\n.chip.purple { background: rgba(192,140,240,0.16); color: var(--dt-purple); }\n\n/* flamegraph rows */\n.flame-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 1px 0;\n font-size: 11px;\n}\n.flame-bar-wrap { flex: 1; min-width: 0; }\n.flame-bar {\n height: 16px;\n border-radius: 3px;\n display: flex;\n align-items: center;\n padding: 0 6px;\n color: #0c0e12;\n font-family: var(--dt-mono);\n font-size: 10px;\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n min-width: 2px;\n}\n.flame-bar.p-mount { background: var(--dt-green); }\n.flame-bar.p-update { background: var(--dt-blue); }\n.flame-bar.p-memo { background: var(--dt-grey); color: var(--dt-text-dim); opacity: 0.8; }\n.flame-time { flex: 0 0 56px; text-align: right; font-family: var(--dt-mono); color: var(--dt-text-dim); font-size: 10px; }\n.flame-reason { font-size: 10px; color: var(--dt-text-faint); }\n\n/* tables */\ntable.dt-table { width: 100%; border-collapse: collapse; font-size: 11px; }\ntable.dt-table th {\n text-align: left;\n color: var(--dt-text-faint);\n font-weight: 600;\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n padding: 4px 6px;\n border-bottom: 1px solid var(--dt-border);\n position: sticky;\n top: 0;\n background: var(--dt-bg);\n}\ntable.dt-table td {\n padding: 3px 6px;\n border-bottom: 1px solid rgba(43,47,56,0.5);\n font-variant-numeric: tabular-nums;\n}\ntable.dt-table td.name { font-family: var(--dt-mono); color: var(--dt-text); }\ntable.dt-table td.num { text-align: right; font-family: var(--dt-mono); color: var(--dt-text-dim); }\ntable.dt-table tr:hover td { background: rgba(255,255,255,0.03); }\n.bar-cell { position: relative; }\n.bar-cell .barfill {\n position: absolute;\n left: 0; top: 2px; bottom: 2px;\n background: rgba(124,156,255,0.22);\n border-radius: 3px;\n z-index: 0;\n}\n.bar-cell span { position: relative; z-index: 1; }\n\n/* ---- Effect timeline ---- */\n.lane {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 5px 10px;\n border-bottom: 1px solid rgba(43,47,56,0.5);\n}\n.lane .lane-name { font-family: var(--dt-mono); color: var(--dt-text); font-size: 11px; flex: 0 0 auto; }\n.lane .lane-trig { font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.lane .lane-stat { color: var(--dt-text-dim); font-size: 10px; font-variant-numeric: tabular-nums; }\n\n.log-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 2px 10px;\n font-size: 11px;\n border-bottom: 1px solid rgba(43,47,56,0.35);\n}\n.log-row:hover { background: rgba(255,255,255,0.03); }\n.log-row .t { flex: 0 0 62px; text-align: right; font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; }\n.log-row .ph { flex: 0 0 64px; }\n.log-row .lbl { font-family: var(--dt-mono); color: var(--dt-text-dim); }\n.log-row .rsn { flex: 1; font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; text-align: right; }\n\n.filters { display: flex; gap: 4px; flex-wrap: wrap; }\n.filter-chip {\n font-size: 10px;\n padding: 2px 8px;\n border-radius: 999px;\n border: 1px solid var(--dt-border);\n background: var(--dt-bg-inset);\n color: var(--dt-text-faint);\n cursor: pointer;\n font-family: var(--dt-sans);\n}\n.filter-chip.is-on { color: var(--dt-text); border-color: var(--dt-border-strong); background: var(--dt-bg-raised); }\n\n/* ---- Resize grip ---- */\n.resize {\n position: absolute;\n width: 16px;\n height: 16px;\n right: 0;\n bottom: 0;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--dt-border-strong) 50%, var(--dt-border-strong) 60%, transparent 60%, transparent 72%, var(--dt-border-strong) 72%, var(--dt-border-strong) 82%, transparent 82%);\n border-bottom-right-radius: 12px;\n}\n";
|