aktion-runtime 0.5.9 → 0.5.11
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 +216 -36
- package/dist/aktion.iife.js +920 -144
- package/dist/aktion.iife.js.map +1 -1
- package/dist/aktion.js +17025 -10815
- package/dist/aktion.js.map +1 -1
- package/dist/aktion.umd.cjs +920 -144
- package/dist/aktion.umd.cjs.map +1 -1
- package/dist/devtools.js +554 -20
- package/dist/devtools.js.map +1 -1
- package/dist/language.js +7042 -2455
- package/dist/language.js.map +1 -1
- package/dist/plugin.cjs +2 -2
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +2 -2
- package/dist/plugin.js.map +1 -1
- package/dist/system_prompt.txt +292 -41
- package/dist/system_prompt_chat.txt +14 -14
- package/dist/testing.js +16223 -7977
- package/dist/testing.js.map +1 -1
- package/dist/types/devtools/panel.d.ts +32 -0
- package/dist/types/devtools/styles.d.ts +1 -1
- package/dist/types/element.d.ts +26 -0
- package/dist/types/icons/index.d.ts +10 -0
- package/dist/types/library/components/_internal.d.ts +18 -0
- package/dist/types/library/components/a11y.d.ts +5 -0
- package/dist/types/library/components/canvas.d.ts +3 -0
- package/dist/types/library/components/extras.d.ts +15 -0
- package/dist/types/library/components/feedback.d.ts +1 -0
- package/dist/types/library/components/forms-shared.d.ts +55 -0
- package/dist/types/library/components/layout-motion.d.ts +14 -0
- package/dist/types/library/components/layout.d.ts +1 -0
- package/dist/types/library/components/marketing.d.ts +35 -0
- package/dist/types/library/components/new-components.d.ts +1 -0
- package/dist/types/library/components/scheduling.d.ts +2 -0
- package/dist/types/library/components/wave3.d.ts +6 -0
- package/dist/types/library/highlight.d.ts +21 -0
- package/dist/types/library/qr.d.ts +12 -0
- package/dist/types/library/responsive-style.d.ts +51 -0
- package/dist/types/library/sx.d.ts +51 -0
- package/dist/types/library/types.d.ts +50 -0
- package/dist/types/library/utils.d.ts +28 -0
- package/dist/types/library/validate.d.ts +2 -2
- package/dist/types/runtime/env.d.ts +33 -0
- package/dist/types/runtime/evaluator.d.ts +38 -0
- package/dist/types/runtime/http.d.ts +37 -1
- package/dist/types/runtime/index.d.ts +2 -0
- package/dist/types/runtime/namespaces-extra.d.ts +73 -0
- package/dist/types/runtime/realtime.d.ts +46 -0
- package/dist/types/runtime/router.d.ts +42 -4
- package/dist/types/runtime/ssr.d.ts +29 -0
- package/dist/types/runtime/util.d.ts +65 -0
- package/dist/types/testing/index.d.ts +35 -0
- package/dist/types/theme/fonts.d.ts +30 -0
- package/dist/types/theme/index.d.ts +31 -0
- package/dist/types/theme/styles.d.ts +1 -1
- package/dist/types/tooling/html-import.d.ts +19 -0
- package/dist/types/tooling/index.d.ts +3 -0
- package/dist/types/tooling/schema.d.ts +58 -0
- package/dist/types/tooling/signature-help.d.ts +35 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML → Aktion importer (suggestions-global XIV.1).
|
|
3
|
+
*
|
|
4
|
+
* A pragmatic codemod that converts a chunk of static HTML into an equivalent
|
|
5
|
+
* Aktion program string, mapping common tags to the closest library component.
|
|
6
|
+
* It is not a 1:1 fidelity tool — it gives authors a running head-start that
|
|
7
|
+
* they then refine. Parsing uses the DOM when available (browsers / jsdom /
|
|
8
|
+
* happy-dom) and falls back to a tiny tag tokenizer in pure-Node contexts.
|
|
9
|
+
*
|
|
10
|
+
* import { htmlToAktion } from "aktion-runtime/tooling";
|
|
11
|
+
* const program = htmlToAktion("<section><h1>Hi</h1><p>Body</p></section>");
|
|
12
|
+
* // → $app(Section([Heading("Hi"), Text("Body")]))
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Convert an HTML string to an Aktion program. The result is wrapped in
|
|
16
|
+
* `$app(...)`; a single root renders directly, multiple roots become a
|
|
17
|
+
* `Column([...])`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function htmlToAktion(html: string): string;
|
|
@@ -30,3 +30,6 @@ export { getSemanticTokens, semanticTokenTypes, semanticTokenModifiers, } from '
|
|
|
30
30
|
export type { SemanticToken, SemanticTokenType, SemanticTokenModifier, } from './semantic-tokens.js';
|
|
31
31
|
export { getSignatureHelp, } from './signature-help.js';
|
|
32
32
|
export type { SignatureHelp, SignatureInfo, ParameterInfo, } from './signature-help.js';
|
|
33
|
+
export { htmlToAktion } from './html-import.js';
|
|
34
|
+
export { componentSchema, tailwindToSx, buildGallery, suggestComponent, } from './schema.js';
|
|
35
|
+
export type { LibrarySchema, ComponentSchemaEntry, ComponentPropSchema, GalleryOptions, } from './schema.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ComponentLibrary } from '../library/types.js';
|
|
2
|
+
export interface ComponentPropSchema {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
optional: boolean;
|
|
6
|
+
positional: boolean;
|
|
7
|
+
required: boolean;
|
|
8
|
+
enum?: readonly string[];
|
|
9
|
+
aliases?: readonly string[];
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ComponentSchemaEntry {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
props: ComponentPropSchema[];
|
|
16
|
+
}
|
|
17
|
+
export interface LibrarySchema {
|
|
18
|
+
version: 1;
|
|
19
|
+
components: ComponentSchemaEntry[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build a stable, machine-readable JSON schema of every component in a
|
|
23
|
+
* library — names, props, types, enums, positional/required flags. Feed it
|
|
24
|
+
* to an editor for autocomplete / hover docs, or diff it across releases.
|
|
25
|
+
*/
|
|
26
|
+
export declare function componentSchema(library: ComponentLibrary): LibrarySchema;
|
|
27
|
+
/**
|
|
28
|
+
* Suggest the closest real component name(s) for a misspelling (XIV.4) — the
|
|
29
|
+
* "did you mean `Button`?" experience. Returns up to `limit` names within a
|
|
30
|
+
* small edit distance, best first.
|
|
31
|
+
*/
|
|
32
|
+
export declare function suggestComponent(name: unknown, library: ComponentLibrary, limit?: number): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Map a Tailwind-style class string to the closest Aktion `sx` object (XIV.2).
|
|
35
|
+
* A pragmatic migration aid:
|
|
36
|
+
*
|
|
37
|
+
* - spacing / color / typography / flex / grid / radius / shadow / sizing /
|
|
38
|
+
* position / z-index / overflow utilities map onto sx tokens;
|
|
39
|
+
* - responsive prefixes (`md:p-8`) become sx breakpoint maps
|
|
40
|
+
* (`{ p: { base: "m", md: "l" } }`, 2xl folds onto xl);
|
|
41
|
+
* - state prefixes (`hover:bg-primary`) become `sx.states` entries for the
|
|
42
|
+
* props the bounded state engine supports;
|
|
43
|
+
* - anything unrecognised is returned under `_unmapped` so callers can
|
|
44
|
+
* surface a warning instead of silently dropping intent.
|
|
45
|
+
*/
|
|
46
|
+
export declare function tailwindToSx(classString: unknown): Record<string, unknown>;
|
|
47
|
+
export interface GalleryOptions {
|
|
48
|
+
/** Page title (default "Aktion Components"). */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** Only include components whose name matches this filter. */
|
|
51
|
+
include?: (name: string) => boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Build a static HTML "Storybook"-style gallery from a library's schema
|
|
55
|
+
* (XIV.5): one card per component listing its description and prop table.
|
|
56
|
+
* Self-contained (inline CSS); write it to a file or serve it for browsing.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildGallery(library: ComponentLibrary, options?: GalleryOptions): string;
|
|
@@ -12,6 +12,12 @@ export interface SignatureInfo {
|
|
|
12
12
|
export interface SignatureHelp {
|
|
13
13
|
signatures: SignatureInfo[];
|
|
14
14
|
activeSignature: number;
|
|
15
|
+
/**
|
|
16
|
+
* Index into `signatures[activeSignature].parameters`. May equal
|
|
17
|
+
* `parameters.length` (out of range) when no parameter should be
|
|
18
|
+
* highlighted — e.g. the cursor is on a not-yet-matching object key or
|
|
19
|
+
* past the last slot of an all-positional call.
|
|
20
|
+
*/
|
|
15
21
|
activeParameter: number;
|
|
16
22
|
}
|
|
17
23
|
/**
|
|
@@ -19,3 +25,32 @@ export interface SignatureHelp {
|
|
|
19
25
|
* is not inside a recognised call.
|
|
20
26
|
*/
|
|
21
27
|
export declare function getSignatureHelp(source: string, position: Position, library?: ComponentLibrary): SignatureHelp | null;
|
|
28
|
+
/** Per-argument shape gathered by the scanner (feeds `chooseNamedBagIndex`). */
|
|
29
|
+
interface ScannedArg {
|
|
30
|
+
/** Top-level keys when the argument is an object literal; null otherwise. */
|
|
31
|
+
objectKeys: string[] | null;
|
|
32
|
+
}
|
|
33
|
+
interface ActiveObjectContext {
|
|
34
|
+
/**
|
|
35
|
+
* The prop key the cursor is on: the key whose value region contains the
|
|
36
|
+
* cursor, or the partial identifier being typed in key position. Empty
|
|
37
|
+
* when the cursor sits before any key (e.g. right after `{`).
|
|
38
|
+
*/
|
|
39
|
+
activeKey: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ActiveCall {
|
|
42
|
+
callee: string;
|
|
43
|
+
/** Zero-based index of the argument the cursor is in. */
|
|
44
|
+
argIndex: number;
|
|
45
|
+
/** Shapes of every argument seen so far (the cursor's one included). */
|
|
46
|
+
args: ScannedArg[];
|
|
47
|
+
/** Set when the cursor is inside an object literal that IS the argument. */
|
|
48
|
+
objectArg: ActiveObjectContext | null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Expose the cursor → enclosing-call analysis so other language-service
|
|
52
|
+
* surfaces (completions) can apply the same §19 binding rules without
|
|
53
|
+
* re-implementing the scan.
|
|
54
|
+
*/
|
|
55
|
+
export declare function analyseCallContext(source: string, position: Position): ActiveCall | null;
|
|
56
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aktion-runtime",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
4
4
|
"description": "Aktion is a single web component that turns a compact, streaming-first DSL into a rich, interactive UI inside its shadow DOM. Works in React, Vue, Angular, Svelte, plain HTML — or no framework at all.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|