aktion-runtime 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1246 -0
- package/dist/aktion.iife.js +8431 -0
- package/dist/aktion.iife.js.map +1 -0
- package/dist/aktion.js +22594 -0
- package/dist/aktion.js.map +1 -0
- package/dist/aktion.umd.cjs +8431 -0
- package/dist/aktion.umd.cjs.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/system_prompt.txt +1095 -0
- package/dist/system_prompt_chat.txt +404 -0
- package/dist/types/element.d.ts +175 -0
- package/dist/types/icons/index.d.ts +45 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/language/builtins.d.ts +33 -0
- package/dist/types/language/components.d.ts +28 -0
- package/dist/types/language/grammar.d.ts +121 -0
- package/dist/types/language/index.d.ts +41 -0
- package/dist/types/language/snippets.d.ts +17 -0
- package/dist/types/library/components/_internal.d.ts +56 -0
- package/dist/types/library/components/advanced-charts.d.ts +6 -0
- package/dist/types/library/components/advanced-data.d.ts +6 -0
- package/dist/types/library/components/advanced-forms.d.ts +12 -0
- package/dist/types/library/components/advanced-patterns.d.ts +13 -0
- package/dist/types/library/components/charts.d.ts +5 -0
- package/dist/types/library/components/chat.d.ts +6 -0
- package/dist/types/library/components/content.d.ts +33 -0
- package/dist/types/library/components/data.d.ts +9 -0
- package/dist/types/library/components/editors.d.ts +5 -0
- package/dist/types/library/components/feedback.d.ts +14 -0
- package/dist/types/library/components/forms-shared.d.ts +7 -0
- package/dist/types/library/components/forms.d.ts +21 -0
- package/dist/types/library/components/helpers.d.ts +33 -0
- package/dist/types/library/components/layout.d.ts +20 -0
- package/dist/types/library/components/media.d.ts +7 -0
- package/dist/types/library/components/menu.d.ts +5 -0
- package/dist/types/library/components/navigation.d.ts +6 -0
- package/dist/types/library/components/new-components.d.ts +13 -0
- package/dist/types/library/components/patterns.d.ts +39 -0
- package/dist/types/library/components/router.d.ts +2 -0
- package/dist/types/library/components/theme.d.ts +2 -0
- package/dist/types/library/index.d.ts +5 -0
- package/dist/types/library/registry.d.ts +15 -0
- package/dist/types/library/types.d.ts +140 -0
- package/dist/types/library/utils.d.ts +73 -0
- package/dist/types/library/validate.d.ts +27 -0
- package/dist/types/parser/frontier.d.ts +65 -0
- package/dist/types/parser/index.d.ts +4 -0
- package/dist/types/parser/lexer.d.ts +46 -0
- package/dist/types/parser/parser.d.ts +2 -0
- package/dist/types/parser/types.d.ts +349 -0
- package/dist/types/prompt/generator.d.ts +33 -0
- package/dist/types/prompt/index.d.ts +1 -0
- package/dist/types/renderer/index.d.ts +1 -0
- package/dist/types/renderer/morph.d.ts +42 -0
- package/dist/types/renderer/renderer.d.ts +73 -0
- package/dist/types/runtime/builtins.d.ts +27 -0
- package/dist/types/runtime/console.d.ts +21 -0
- package/dist/types/runtime/effects.d.ts +69 -0
- package/dist/types/runtime/evaluator.d.ts +151 -0
- package/dist/types/runtime/http.d.ts +85 -0
- package/dist/types/runtime/i18n.d.ts +40 -0
- package/dist/types/runtime/index.d.ts +9 -0
- package/dist/types/runtime/router.d.ts +105 -0
- package/dist/types/runtime/state.d.ts +84 -0
- package/dist/types/runtime/storage.d.ts +50 -0
- package/dist/types/theme/index.d.ts +175 -0
- package/dist/types/theme/styles.d.ts +9 -0
- package/dist/types/tooling/codemod.d.ts +36 -0
- package/dist/types/tooling/delta.d.ts +74 -0
- package/dist/types/tooling/formatter.d.ts +8 -0
- package/dist/types/tooling/index.d.ts +29 -0
- package/dist/types/tooling/inspector.d.ts +49 -0
- package/dist/types/tooling/language-service.d.ts +57 -0
- package/package.json +63 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Font Awesome integration for `<aktion-app>`.
|
|
3
|
+
*
|
|
4
|
+
* Icons across the library are referenced by Font Awesome name (without the
|
|
5
|
+
* `fa-` prefix). The optional `variant:` prefix (`solid:`, `regular:`,
|
|
6
|
+
* `brands:`) picks the FA style — when omitted, it defaults to `solid`.
|
|
7
|
+
*
|
|
8
|
+
* The custom element auto-loads the CDN stylesheet on connect (once per
|
|
9
|
+
* page and once per shadow root) so host apps do not have to add anything
|
|
10
|
+
* to make icons render.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FONT_AWESOME_CDN_URL = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css";
|
|
13
|
+
export declare const FONT_AWESOME_VERSION = "6.7.2";
|
|
14
|
+
/**
|
|
15
|
+
* Inject the Font Awesome stylesheet into `document.head` (once per page)
|
|
16
|
+
* and into the given shadow root (once per instance) so icon classes
|
|
17
|
+
* resolve both outside and inside the custom element.
|
|
18
|
+
*
|
|
19
|
+
* Safe to call from every `connectedCallback`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ensureFontAwesomeLoaded(shadow: ShadowRoot): void;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve a Aktion icon string into Font Awesome class tokens.
|
|
24
|
+
*
|
|
25
|
+
* - `"house"` → `["fa-solid", "fa-house"]`
|
|
26
|
+
* - `"regular:star"` → `["fa-regular", "fa-star"]`
|
|
27
|
+
* - `"brands:github"` → `["fa-brands", "fa-github"]`
|
|
28
|
+
*
|
|
29
|
+
* Invisible Unicode glyph modifiers (variation selectors U+FE0E/U+FE0F and
|
|
30
|
+
* the zero-width joiner U+200D) are stripped before validation — they often
|
|
31
|
+
* sneak in when an LLM copies an FA name out of a doc that previously used
|
|
32
|
+
* an emoji glyph, and would otherwise break ASCII-only validation.
|
|
33
|
+
*
|
|
34
|
+
* Returns an empty array for blank input or names that contain non-ASCII
|
|
35
|
+
* characters (legacy emoji input — the caller renders those inline as text).
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveIconClasses(value: unknown): string[];
|
|
38
|
+
/**
|
|
39
|
+
* True when the value should be treated as a Font Awesome name (vs legacy
|
|
40
|
+
* emoji text that the renderer should print inline).
|
|
41
|
+
*/
|
|
42
|
+
export declare function isIconName(value: unknown): value is string;
|
|
43
|
+
export declare const ICON_SIZES: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
44
|
+
export type IconSize = (typeof ICON_SIZES)[number];
|
|
45
|
+
export declare function isIconSize(value: unknown): value is IconSize;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AktionElement, defineElement } from './element.js';
|
|
2
|
+
export { AktionElement, defineElement };
|
|
3
|
+
export * from './parser/index.js';
|
|
4
|
+
export * from './runtime/index.js';
|
|
5
|
+
export * from './library/index.js';
|
|
6
|
+
export * from './renderer/index.js';
|
|
7
|
+
export * from './prompt/index.js';
|
|
8
|
+
export * from './theme/index.js';
|
|
9
|
+
export * from './language/index.js';
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"aktion-app": AktionElement;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare const SYSTEM_PROMPT_TEXT: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in `@Name(...)` catalog.
|
|
3
|
+
*
|
|
4
|
+
* Sourced (by name) from `src/runtime/builtins.ts` plus the action steps
|
|
5
|
+
* handled directly in the evaluator. Each entry carries a short description
|
|
6
|
+
* and parameter signature so editors can show argument hints.
|
|
7
|
+
*
|
|
8
|
+
* Adding a new builtin to the runtime? Add an entry here too — the test
|
|
9
|
+
* suite guards the union (see `tests/language.test.ts`).
|
|
10
|
+
*/
|
|
11
|
+
export interface BuiltinParam {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
required: boolean;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface BuiltinEntry {
|
|
18
|
+
name: string;
|
|
19
|
+
category: "data" | "iteration";
|
|
20
|
+
description: string;
|
|
21
|
+
params: BuiltinParam[];
|
|
22
|
+
signature: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Return the catalog of all `@-builtins`. The list is deterministic — data
|
|
26
|
+
* builtins first (sourced from the runtime registry), then iteration
|
|
27
|
+
* fallbacks. Aktion 0.5 removed the legacy action-step builtins
|
|
28
|
+
* (`@Set`, `@Run`, `@Reset`, `@ToAssistant`, `@OpenUrl`, `@Navigate`, `@Js`)
|
|
29
|
+
* and the `@Const` memo helper; use `action` declarations and `$computed`
|
|
30
|
+
* bindings instead.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getBuiltinCatalog(): BuiltinEntry[];
|
|
33
|
+
export declare function indexBuiltins(entries: BuiltinEntry[]): Record<string, BuiltinEntry>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ComponentLibrary } from '../library/types.js';
|
|
2
|
+
export interface ComponentParam {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
description?: string;
|
|
7
|
+
enumValues?: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export interface ComponentEntry {
|
|
10
|
+
name: string;
|
|
11
|
+
group: string;
|
|
12
|
+
description: string;
|
|
13
|
+
params: ComponentParam[];
|
|
14
|
+
/** Short positional signature, e.g. `Card(children, variant?)`. */
|
|
15
|
+
signature: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Project a library's component specs into a flat catalog. Defaults to the
|
|
19
|
+
* built-in `defaultLibrary`, but accepts a custom library so consumers that
|
|
20
|
+
* register extra components via `registerComponents()` get the right autocomplete
|
|
21
|
+
* data.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getComponentCatalog(library?: ComponentLibrary): ComponentEntry[];
|
|
24
|
+
/**
|
|
25
|
+
* Returns an index of component name → entry for O(1) lookup. Convenient
|
|
26
|
+
* inside editor extensions that need to render details on hover.
|
|
27
|
+
*/
|
|
28
|
+
export declare function indexCatalog(entries: ComponentEntry[]): Record<string, ComponentEntry>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-data grammar description for Aktion.
|
|
3
|
+
*
|
|
4
|
+
* The grammar lives here as plain JSON-style data and a minimal stream
|
|
5
|
+
* tokenizer factory. The stream tokenizer returned by
|
|
6
|
+
* `createStreamTokenizer` matches the shape of CodeMirror 6's `StreamParser`
|
|
7
|
+
* (`token`, `startState`, `copyState`), but it does NOT import CodeMirror or
|
|
8
|
+
* any DOM API — so the same data drives Monaco, a VS Code TextMate grammar,
|
|
9
|
+
* or any other editor.
|
|
10
|
+
*
|
|
11
|
+
* Token kinds are reported as semantic strings. Consumers map them to their
|
|
12
|
+
* own highlight tags (CodeMirror's `tags`, Monaco's `TokenType`, etc.).
|
|
13
|
+
*/
|
|
14
|
+
export type GrammarTokenKind = "comment" | "string" | "number" | "atom" | "builtin" | "state" | "component" | "identifier" | "operator" | "punctuation" | "loopvar" | "property";
|
|
15
|
+
export interface GrammarSpec {
|
|
16
|
+
name: "aktion";
|
|
17
|
+
/** No keywords reserved beyond literal atoms. */
|
|
18
|
+
atoms: readonly string[];
|
|
19
|
+
/** Operators (longest-match first when tokenising). */
|
|
20
|
+
operators: readonly string[];
|
|
21
|
+
/** Two-character operators that must be matched before single chars. */
|
|
22
|
+
operatorsLong: readonly string[];
|
|
23
|
+
/** Brackets that must be balanced; useful for editor bracket matching. */
|
|
24
|
+
brackets: ReadonlyArray<{
|
|
25
|
+
open: string;
|
|
26
|
+
close: string;
|
|
27
|
+
}>;
|
|
28
|
+
comments: {
|
|
29
|
+
/** Primary line-comment introducer (used by editors for Ctrl+/ toggle). */
|
|
30
|
+
line: string;
|
|
31
|
+
/**
|
|
32
|
+
* Additional line-comment introducers. Tokenizers strip these the same
|
|
33
|
+
* way as `line`; editors that expose a single comment-toggle keystroke
|
|
34
|
+
* should still use `line` as the canonical form.
|
|
35
|
+
*/
|
|
36
|
+
extraLine: readonly string[];
|
|
37
|
+
blockStart: string;
|
|
38
|
+
blockEnd: string;
|
|
39
|
+
};
|
|
40
|
+
strings: {
|
|
41
|
+
/** Quote characters allowed for single-line escape-supporting strings. */
|
|
42
|
+
singleLineQuotes: readonly string[];
|
|
43
|
+
/** Quote character for multi-line raw strings (no escaping needed). */
|
|
44
|
+
multiLineQuote: string;
|
|
45
|
+
};
|
|
46
|
+
identifier: {
|
|
47
|
+
start: RegExp;
|
|
48
|
+
part: RegExp;
|
|
49
|
+
};
|
|
50
|
+
/** Sigils that mark non-identifier categories. */
|
|
51
|
+
sigils: {
|
|
52
|
+
builtin: string;
|
|
53
|
+
state: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export declare const grammarSpec: GrammarSpec;
|
|
57
|
+
/**
|
|
58
|
+
* Mutable state carried by the stream tokenizer between calls. We track the
|
|
59
|
+
* unclosed multi-line constructs (backtick strings, block comments).
|
|
60
|
+
*/
|
|
61
|
+
export interface StreamState {
|
|
62
|
+
inBacktick: boolean;
|
|
63
|
+
inBlockComment: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface StreamLike {
|
|
66
|
+
/** True at column 0 of a line (CodeMirror exposes `stream.sol()`). */
|
|
67
|
+
sol(): boolean;
|
|
68
|
+
/** Returns next char without consuming. */
|
|
69
|
+
peek(): string | null | undefined;
|
|
70
|
+
/** Consume and return the next char, advancing the stream. */
|
|
71
|
+
next(): string | undefined;
|
|
72
|
+
/** Consume while the predicate matches. */
|
|
73
|
+
eatWhile(test: RegExp | ((ch: string) => boolean)): boolean;
|
|
74
|
+
/** Consume one char if it matches; returns whether it consumed. */
|
|
75
|
+
eat(test: string | RegExp | ((ch: string) => boolean)): string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Consume everything up to (and optionally including) the given string or
|
|
78
|
+
* regex. CodeMirror's `skipTo` matches the string in the rest of the line.
|
|
79
|
+
* We rely only on `match(string, consume?)` which is available in CM6.
|
|
80
|
+
*/
|
|
81
|
+
match(pattern: string | RegExp, consume?: boolean): boolean | RegExpMatchArray | null;
|
|
82
|
+
/** Skip to end of line. */
|
|
83
|
+
skipToEnd(): void;
|
|
84
|
+
/** True at end of line. */
|
|
85
|
+
eol(): boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface StreamTokenizer {
|
|
88
|
+
startState(): StreamState;
|
|
89
|
+
copyState(state: StreamState): StreamState;
|
|
90
|
+
token(stream: StreamLike, state: StreamState): GrammarTokenKind | null;
|
|
91
|
+
/**
|
|
92
|
+
* Language metadata that CodeMirror's `StreamLanguage.define(...)` will pick
|
|
93
|
+
* up — comment style and bracket pairs for auto-pairing.
|
|
94
|
+
*/
|
|
95
|
+
languageData: {
|
|
96
|
+
commentTokens: {
|
|
97
|
+
line: string;
|
|
98
|
+
block: {
|
|
99
|
+
open: string;
|
|
100
|
+
close: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
closeBrackets: {
|
|
104
|
+
brackets: readonly string[];
|
|
105
|
+
};
|
|
106
|
+
indentOnInput: RegExp;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Lookahead tokenizer driven by `grammarSpec`. Suitable for
|
|
111
|
+
* `StreamLanguage.define(...)` in CodeMirror 6, but framework-agnostic.
|
|
112
|
+
*/
|
|
113
|
+
export declare function createStreamTokenizer(spec?: GrammarSpec): StreamTokenizer;
|
|
114
|
+
/**
|
|
115
|
+
* Default mapping from grammar token kinds to CodeMirror highlight tag names.
|
|
116
|
+
*
|
|
117
|
+
* Returned as plain strings so consumers can resolve them to whatever their
|
|
118
|
+
* highlighter understands. We keep `tagName: string | null` so consumers may
|
|
119
|
+
* skip a kind entirely (e.g. punctuation is often left unhighlighted).
|
|
120
|
+
*/
|
|
121
|
+
export declare const defaultTagMap: Record<GrammarTokenKind, string | null>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentLibrary } from '../library/types.js';
|
|
2
|
+
import { grammarSpec, createStreamTokenizer, defaultTagMap, GrammarSpec, GrammarTokenKind, StreamTokenizer } from './grammar.js';
|
|
3
|
+
import { getComponentCatalog, indexCatalog, ComponentEntry, ComponentParam } from './components.js';
|
|
4
|
+
import { getBuiltinCatalog, indexBuiltins, BuiltinEntry, BuiltinParam } from './builtins.js';
|
|
5
|
+
import { getSnippets, SnippetEntry } from './snippets.js';
|
|
6
|
+
export type { GrammarSpec, GrammarTokenKind, StreamTokenizer, ComponentEntry, ComponentParam, BuiltinEntry, BuiltinParam, SnippetEntry, };
|
|
7
|
+
export { grammarSpec, createStreamTokenizer, defaultTagMap, getComponentCatalog, indexCatalog, getBuiltinCatalog, indexBuiltins, getSnippets, };
|
|
8
|
+
/**
|
|
9
|
+
* Diagnostic severity buckets that map to common editor lint levels.
|
|
10
|
+
* Editors typically map: `error` → red squiggle, `warning` → yellow,
|
|
11
|
+
* `info` → blue, `hint` → grey.
|
|
12
|
+
*/
|
|
13
|
+
export type DiagnosticSeverity = "error" | "warning" | "info" | "hint";
|
|
14
|
+
export interface LanguageSpec {
|
|
15
|
+
grammar: GrammarSpec;
|
|
16
|
+
/** Build a fresh tokenizer instance suitable for CodeMirror StreamLanguage. */
|
|
17
|
+
tokenizer: StreamTokenizer;
|
|
18
|
+
/** Map from grammar token kind → CodeMirror highlight tag name. */
|
|
19
|
+
tagMap: Record<GrammarTokenKind, string | null>;
|
|
20
|
+
components: ComponentEntry[];
|
|
21
|
+
componentsByName: Record<string, ComponentEntry>;
|
|
22
|
+
builtins: BuiltinEntry[];
|
|
23
|
+
builtinsByName: Record<string, BuiltinEntry>;
|
|
24
|
+
snippets: readonly SnippetEntry[];
|
|
25
|
+
/** Built-in theme names; useful for theme-picker autocomplete. */
|
|
26
|
+
themeNames: readonly string[];
|
|
27
|
+
/** Default severity for the parser's ParseError stream. */
|
|
28
|
+
severityTokenMap: Record<"parse-error", DiagnosticSeverity>;
|
|
29
|
+
/**
|
|
30
|
+
* Font Awesome icon aliases used by components that accept `icon: string`.
|
|
31
|
+
* Editors can use these to power icon-name autocomplete.
|
|
32
|
+
*/
|
|
33
|
+
iconAliases: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Build a complete language spec ready for editor consumption. Pass a custom
|
|
37
|
+
* `ComponentLibrary` if your host has registered extra components via
|
|
38
|
+
* `<aktion-app>.registerComponents([...])` — the returned spec will
|
|
39
|
+
* include them in autocomplete and inspection tooltips.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getLanguageSpec(library?: ComponentLibrary): LanguageSpec;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snippet templates for common Aktion composites.
|
|
3
|
+
*
|
|
4
|
+
* Placeholders use `${1:label}` syntax. CodeMirror's `snippet()` from
|
|
5
|
+
* `@codemirror/autocomplete` parses this format natively. Monaco and VS
|
|
6
|
+
* Code do too (it matches the LSP snippet format).
|
|
7
|
+
*/
|
|
8
|
+
export interface SnippetEntry {
|
|
9
|
+
/** Snippet key — used as the autocomplete completion label. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Human-readable description shown in the autocomplete popup. */
|
|
12
|
+
description: string;
|
|
13
|
+
/** The template body with `${n:label}` placeholders. */
|
|
14
|
+
template: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const snippetCatalog: readonly SnippetEntry[];
|
|
17
|
+
export declare function getSnippets(): readonly SnippetEntry[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal DOM helpers shared by primitives (`feedback.ts`) and pattern
|
|
3
|
+
* composites (`patterns.ts`). Not exported from the package barrel — these
|
|
4
|
+
* are implementation details that keep avatar/initials rendering consistent
|
|
5
|
+
* across every component that needs them.
|
|
6
|
+
*/
|
|
7
|
+
export type AvatarSize = "sm" | "md" | "lg" | "xl";
|
|
8
|
+
/** Render an `<rui-avatar>` matching the canonical Avatar primitive. */
|
|
9
|
+
export declare function renderAvatar(src: string, name: string, size: AvatarSize): HTMLElement;
|
|
10
|
+
/** Two-letter initials, falling back to `?` for empty input. */
|
|
11
|
+
export declare function initialsFor(name: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Shared outside-click + Escape dismissal for popovers, dropdowns, comboboxes.
|
|
14
|
+
*
|
|
15
|
+
* Previous implementations leaked listeners in three subtle ways:
|
|
16
|
+
*
|
|
17
|
+
* 1. Re-opening the floater (trigger clicked while still open) installed a
|
|
18
|
+
* second listener pair without removing the first.
|
|
19
|
+
* 2. Closing via any code path *other than* an outside-click / Escape (e.g.
|
|
20
|
+
* clicking the trigger again, selecting an item, programmatic close)
|
|
21
|
+
* left the listeners attached, holding references to detached DOM.
|
|
22
|
+
* 3. The host node being removed from the DOM (LLM produced a new response,
|
|
23
|
+
* route changed, parent re-rendered) silently kept the listeners on the
|
|
24
|
+
* shadow root forever.
|
|
25
|
+
*
|
|
26
|
+
* This helper installs listeners exactly once per open, exposes a single
|
|
27
|
+
* `dispose()` so every close path can clean up, and observes the host so we
|
|
28
|
+
* auto-dispose when the floater is unmounted.
|
|
29
|
+
*
|
|
30
|
+
* `key` lets the caller dedupe re-opens — if the same `key` is passed while
|
|
31
|
+
* a previous registration is still live, we dispose it before installing
|
|
32
|
+
* the new one.
|
|
33
|
+
*/
|
|
34
|
+
export interface DismissHandle {
|
|
35
|
+
dispose: () => void;
|
|
36
|
+
}
|
|
37
|
+
interface DismissOptions {
|
|
38
|
+
liveRoot: HTMLElement;
|
|
39
|
+
onDismiss: () => void;
|
|
40
|
+
/** Stable per-instance identifier, used to deduplicate re-opens. */
|
|
41
|
+
key?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function installDismissListeners(opts: DismissOptions): DismissHandle;
|
|
44
|
+
/** Trigger an immediate dispose for a live root if one is registered. */
|
|
45
|
+
export declare function disposeDismissListeners(liveRoot: HTMLElement | null | undefined): void;
|
|
46
|
+
export declare function pickIconForLabel(label: string | null | undefined): string | null;
|
|
47
|
+
export declare function pickIconForTone(tone: string | null | undefined): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Build a deterministic DiceBear avatar URL for a person name.
|
|
50
|
+
*
|
|
51
|
+
* Used as the fallback when the LLM passes a name but omits `src`.
|
|
52
|
+
* `style` defaults to `initials` which is bulletproof (no network face-art),
|
|
53
|
+
* but callers can pass `shapes`, `avataaars`, etc. for fancier looks.
|
|
54
|
+
*/
|
|
55
|
+
export declare function dicebearUrlFor(name: string, style?: string): string;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const Gauge: ComponentSpec;
|
|
3
|
+
export declare const Heatmap: ComponentSpec;
|
|
4
|
+
export declare const RadarChart: ComponentSpec;
|
|
5
|
+
export declare const ScatterChart: ComponentSpec;
|
|
6
|
+
export declare const Histogram: ComponentSpec;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const DataGrid: ComponentSpec;
|
|
3
|
+
export declare const CalendarView: ComponentSpec;
|
|
4
|
+
export declare const ActivityLog: ComponentSpec;
|
|
5
|
+
export declare const ComparisonTable: ComponentSpec;
|
|
6
|
+
export declare const InfiniteList: ComponentSpec;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const PinInput: ComponentSpec;
|
|
3
|
+
export declare const PasswordInput: ComponentSpec;
|
|
4
|
+
export declare const TagInput: ComponentSpec;
|
|
5
|
+
export declare const MentionInput: ComponentSpec;
|
|
6
|
+
export declare const TimePicker: ComponentSpec;
|
|
7
|
+
export declare const DateTimePicker: ComponentSpec;
|
|
8
|
+
export declare const MaskedInput: ComponentSpec;
|
|
9
|
+
export declare const FormSection: ComponentSpec;
|
|
10
|
+
export declare const FieldSet: ComponentSpec;
|
|
11
|
+
export declare const ValidationSummary: ComponentSpec;
|
|
12
|
+
export declare const MultiStepForm: ComponentSpec;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const InboxPanel: ComponentSpec;
|
|
3
|
+
export declare const OnboardingChecklist: ComponentSpec;
|
|
4
|
+
export declare const LoadingState: ComponentSpec;
|
|
5
|
+
export declare const ErrorState: ComponentSpec;
|
|
6
|
+
export declare const SuccessState: ComponentSpec;
|
|
7
|
+
export declare const Tour: ComponentSpec;
|
|
8
|
+
export declare const Spotlight: ComponentSpec;
|
|
9
|
+
export declare const Sticky: ComponentSpec;
|
|
10
|
+
export declare const ResizablePanels: ComponentSpec;
|
|
11
|
+
export declare const MasonryGrid: ComponentSpec;
|
|
12
|
+
export declare const Drawer: ComponentSpec;
|
|
13
|
+
export declare const TopBar: ComponentSpec;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const SectionBlock: ComponentSpec;
|
|
3
|
+
export declare const ListBlock: ComponentSpec;
|
|
4
|
+
export declare const FollowUpBlock: ComponentSpec;
|
|
5
|
+
export declare const FollowUpItem: ComponentSpec;
|
|
6
|
+
export declare const ActionLink: ComponentSpec;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
import { asNumber } from '../utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Normalise a legacy size token to the shared `xs|sm|md|lg|xl` vocabulary.
|
|
5
|
+
* Keeps the catalogue self-consistent (suggestion 4.2) while letting old
|
|
6
|
+
* prompts that emit `"small"` / `"normal"` / `"large"` still render.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normaliseSize(value: unknown, fallback?: string): string;
|
|
9
|
+
export declare const Icon: ComponentSpec;
|
|
10
|
+
export declare const Text: ComponentSpec;
|
|
11
|
+
/**
|
|
12
|
+
* Deprecated alias for `Text`. Kept registered so existing Aktion
|
|
13
|
+
* programs that still emit `TextContent(...)` keep rendering. New code
|
|
14
|
+
* should use `Text(...)`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const TextContent: ComponentSpec;
|
|
17
|
+
export declare const Image: ComponentSpec;
|
|
18
|
+
export declare const Link: ComponentSpec;
|
|
19
|
+
export declare const Badge: ComponentSpec;
|
|
20
|
+
/**
|
|
21
|
+
* `BadgeList` renders an array of string labels as a row of Badge pills.
|
|
22
|
+
* Replaces the legacy `TagBlock` component.
|
|
23
|
+
*/
|
|
24
|
+
export declare const BadgeList: ComponentSpec;
|
|
25
|
+
export declare const Callout: ComponentSpec;
|
|
26
|
+
export declare const CodeBlock: ComponentSpec;
|
|
27
|
+
export declare const Skeleton: ComponentSpec;
|
|
28
|
+
export declare const Markdown: ComponentSpec;
|
|
29
|
+
export declare const Container: ComponentSpec;
|
|
30
|
+
export declare const Spacer: ComponentSpec;
|
|
31
|
+
export declare const Spinner: ComponentSpec;
|
|
32
|
+
export declare const Quote: ComponentSpec;
|
|
33
|
+
export { asNumber };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const Col: ComponentSpec;
|
|
3
|
+
export declare const Table: ComponentSpec;
|
|
4
|
+
export declare const ListItem: ComponentSpec;
|
|
5
|
+
export declare const List: ComponentSpec;
|
|
6
|
+
export declare const StatCard: ComponentSpec;
|
|
7
|
+
export declare const Sparkline: ComponentSpec;
|
|
8
|
+
export declare const TreeNode: ComponentSpec;
|
|
9
|
+
export declare const Tree: ComponentSpec;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const Avatar: ComponentSpec;
|
|
3
|
+
export declare const AvatarGroup: ComponentSpec;
|
|
4
|
+
export declare const Progress: ComponentSpec;
|
|
5
|
+
export declare const Switch: ComponentSpec;
|
|
6
|
+
export declare const ToggleGroup: ComponentSpec;
|
|
7
|
+
export declare const Tooltip: ComponentSpec;
|
|
8
|
+
export declare const HoverCard: ComponentSpec;
|
|
9
|
+
export declare const Rating: ComponentSpec;
|
|
10
|
+
export declare const ProgressRing: ComponentSpec;
|
|
11
|
+
export declare const ChatBubble: ComponentSpec;
|
|
12
|
+
export declare const Kbd: ComponentSpec;
|
|
13
|
+
export declare const Popover: ComponentSpec;
|
|
14
|
+
export declare const Toast: ComponentSpec;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const Button: ComponentSpec;
|
|
3
|
+
export declare const Buttons: ComponentSpec;
|
|
4
|
+
export declare const Input: ComponentSpec;
|
|
5
|
+
export declare const TextArea: ComponentSpec;
|
|
6
|
+
export declare const SelectItem: ComponentSpec;
|
|
7
|
+
export declare const Select: ComponentSpec;
|
|
8
|
+
export declare const Checkbox: ComponentSpec;
|
|
9
|
+
export declare const CheckBoxItem: ComponentSpec;
|
|
10
|
+
export declare const CheckBoxGroup: ComponentSpec;
|
|
11
|
+
export declare const Radio: ComponentSpec;
|
|
12
|
+
export declare const FormControl: ComponentSpec;
|
|
13
|
+
export declare const SearchBar: ComponentSpec;
|
|
14
|
+
export declare const Form: ComponentSpec;
|
|
15
|
+
export declare const Slider: ComponentSpec;
|
|
16
|
+
export declare const NumberInput: ComponentSpec;
|
|
17
|
+
export declare const DatePicker: ComponentSpec;
|
|
18
|
+
export declare const FileUpload: ComponentSpec;
|
|
19
|
+
export declare const Combobox: ComponentSpec;
|
|
20
|
+
export declare const MultiSelect: ComponentSpec;
|
|
21
|
+
export declare const DateRangePicker: ComponentSpec;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `Async(resource, loading:, error:, empty:, data:)` — render the
|
|
4
|
+
* appropriate branch based on the resource's `state`. The resource is
|
|
5
|
+
* expected to expose at least `{ state, data, error, loading }`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Async: ComponentSpec;
|
|
8
|
+
/**
|
|
9
|
+
* `Show(when, fallback?, children)` — sugar over `if`. Renders `children`
|
|
10
|
+
* when `when` is truthy; falls back to `fallback` (or nothing) otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Show: ComponentSpec;
|
|
13
|
+
/**
|
|
14
|
+
* `Portal(target?, children)` — render `children` outside the normal
|
|
15
|
+
* subtree. `target` accepts a CSS selector; falls back to `document.body`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Portal: ComponentSpec;
|
|
18
|
+
/**
|
|
19
|
+
* `Redirect(path)` — Issued by a route guard component. The runtime
|
|
20
|
+
* recognises the rendered output and redirects the router immediately.
|
|
21
|
+
*/
|
|
22
|
+
export declare const Redirect: ComponentSpec;
|
|
23
|
+
/**
|
|
24
|
+
* `Lazy(loader, fallback?)` — Defer the children until the `loader`
|
|
25
|
+
* promise resolves. The `loader` can be either a function returning a
|
|
26
|
+
* promise or a promise directly.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Lazy: ComponentSpec;
|
|
29
|
+
/**
|
|
30
|
+
* `ErrorBoundary(fallback?, onError?, children)` — catches rendering
|
|
31
|
+
* errors raised by descendants and renders the fallback instead.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ErrorBoundary: ComponentSpec;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const StackItem: ComponentSpec;
|
|
3
|
+
export declare const Stack: ComponentSpec;
|
|
4
|
+
export declare const Card: ComponentSpec;
|
|
5
|
+
export declare const CardHeader: ComponentSpec;
|
|
6
|
+
export declare const CardFooter: ComponentSpec;
|
|
7
|
+
export declare const Separator: ComponentSpec;
|
|
8
|
+
export declare const Steps: ComponentSpec;
|
|
9
|
+
export declare const TabItem: ComponentSpec;
|
|
10
|
+
export declare const Tabs: ComponentSpec;
|
|
11
|
+
export declare const AccordionItem: ComponentSpec;
|
|
12
|
+
export declare const Accordion: ComponentSpec;
|
|
13
|
+
/** Resolve a grid span from a number or fraction string (e.g. `"1/3"` → 4 on a 12-col grid). */
|
|
14
|
+
export declare function resolveSpan(span: unknown): number;
|
|
15
|
+
export declare const GridItem: ComponentSpec;
|
|
16
|
+
export declare const Box: ComponentSpec;
|
|
17
|
+
export declare const Grid: ComponentSpec;
|
|
18
|
+
export declare const AspectRatio: ComponentSpec;
|
|
19
|
+
export declare const ScrollArea: ComponentSpec;
|
|
20
|
+
export declare const Modal: ComponentSpec;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const VideoPlayer: ComponentSpec;
|
|
3
|
+
export declare const AudioPlayer: ComponentSpec;
|
|
4
|
+
export declare const Carousel: ComponentSpec;
|
|
5
|
+
export declare const Gallery: ComponentSpec;
|
|
6
|
+
export declare const Lightbox: ComponentSpec;
|
|
7
|
+
export declare const Map: ComponentSpec;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const BreadcrumbItem: ComponentSpec;
|
|
3
|
+
export declare const Breadcrumb: ComponentSpec;
|
|
4
|
+
export declare const Pagination: ComponentSpec;
|
|
5
|
+
export declare const NavbarItem: ComponentSpec;
|
|
6
|
+
export declare const Navbar: ComponentSpec;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const IconButton: ComponentSpec;
|
|
3
|
+
export declare const CommandPalette: ComponentSpec;
|
|
4
|
+
export declare const FilterChips: ComponentSpec;
|
|
5
|
+
export declare const FieldRepeater: ComponentSpec;
|
|
6
|
+
export declare const VirtualList: ComponentSpec;
|
|
7
|
+
export declare const QueryBuilder: ComponentSpec;
|
|
8
|
+
export declare const DiffViewer: ComponentSpec;
|
|
9
|
+
export declare const JsonTree: ComponentSpec;
|
|
10
|
+
export declare const Gantt: ComponentSpec;
|
|
11
|
+
export declare const Truncate: ComponentSpec;
|
|
12
|
+
export declare const InlineEdit: ComponentSpec;
|
|
13
|
+
export declare const NotificationBell: ComponentSpec;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ComponentSpec } from '../types.js';
|
|
2
|
+
export declare const Hero: ComponentSpec;
|
|
3
|
+
export declare const PageHeader: ComponentSpec;
|
|
4
|
+
export declare const EmptyState: ComponentSpec;
|
|
5
|
+
export declare const TimelineItem: ComponentSpec;
|
|
6
|
+
export declare const Timeline: ComponentSpec;
|
|
7
|
+
export declare const FeatureItem: ComponentSpec;
|
|
8
|
+
export declare const FeatureGrid: ComponentSpec;
|
|
9
|
+
export declare const Testimonial: ComponentSpec;
|
|
10
|
+
export declare const ProfileCard: ComponentSpec;
|
|
11
|
+
export declare const Comment: ComponentSpec;
|
|
12
|
+
export declare const Banner: ComponentSpec;
|
|
13
|
+
export declare const KanbanCard: ComponentSpec;
|
|
14
|
+
export declare const KanbanColumn: ComponentSpec;
|
|
15
|
+
export declare const KanbanBoard: ComponentSpec;
|
|
16
|
+
export declare const SectionHeader: ComponentSpec;
|
|
17
|
+
export declare const Toolbar: ComponentSpec;
|
|
18
|
+
export declare const SidebarItem: ComponentSpec;
|
|
19
|
+
export declare const SidebarSection: ComponentSpec;
|
|
20
|
+
export declare const Sidebar: ComponentSpec;
|
|
21
|
+
export declare const AppShell: ComponentSpec;
|
|
22
|
+
export declare const SplitView: ComponentSpec;
|
|
23
|
+
export declare const DescriptionItem: ComponentSpec;
|
|
24
|
+
export declare const DescriptionList: ComponentSpec;
|
|
25
|
+
export declare const StatusDot: ComponentSpec;
|
|
26
|
+
export declare const PricingCard: ComponentSpec;
|
|
27
|
+
export declare const PricingTable: ComponentSpec;
|
|
28
|
+
export declare const MediaCard: ComponentSpec;
|
|
29
|
+
/**
|
|
30
|
+
* Render a tiny inline sparkline as an SVG. Shared by `Stats`, `StatCard`,
|
|
31
|
+
* and the standalone `Sparkline` component so the visual language stays
|
|
32
|
+
* consistent across surfaces. `tone` maps to a CSS variable so themes can
|
|
33
|
+
* override the stroke colour.
|
|
34
|
+
*/
|
|
35
|
+
export declare function renderInlineSparkline(values: number[], tone?: string): SVGSVGElement;
|
|
36
|
+
export declare const Stats: ComponentSpec;
|
|
37
|
+
export declare const Tile: ComponentSpec;
|
|
38
|
+
export declare const Notification: ComponentSpec;
|
|
39
|
+
export declare const PersonChip: ComponentSpec;
|