@exponential-at/ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +54 -0
- package/README.md +360 -2
- package/catalog/a11y.json +668 -0
- package/catalog/basic-map.json +104 -0
- package/catalog/code.json +58 -0
- package/catalog/core.catalog.json +4752 -0
- package/catalog/core.schema.json +22667 -0
- package/catalog/host.json +64 -0
- package/catalog/layout.json +20 -0
- package/catalog/limits.json +9 -0
- package/catalog/locale.json +48 -0
- package/catalog/macros.json +3417 -0
- package/catalog/recipes.json +61 -0
- package/catalog/strings.json +72 -0
- package/catalog/style.json +128 -0
- package/catalog/theme.schema.json +42543 -0
- package/catalog/tokens.json +47 -0
- package/conformance/README.md +217 -0
- package/conformance/baseline.ts +101 -0
- package/conformance/browser-page.ts +146 -0
- package/conformance/browser-suites.ts +683 -0
- package/conformance/compare.ts +201 -0
- package/conformance/dom.ts +96 -0
- package/conformance/dump.ts +163 -0
- package/conformance/fonts.json +154 -0
- package/conformance/manifest.json +224 -0
- package/conformance/parity-compare.ts +191 -0
- package/conformance/parity-report.schema.json +73 -0
- package/conformance/parity.ts +412 -0
- package/conformance/pixel.ts +177 -0
- package/conformance/primitives-page.ts +49 -0
- package/conformance/report.schema.json +66 -0
- package/conformance/run.ts +118 -0
- package/dist/chunks/index-98npjvsd.js +3940 -0
- package/dist/chunks/index-98npjvsd.js.map +27 -0
- package/dist/chunks/index-gwkt14w3.js +7314 -0
- package/dist/chunks/index-gwkt14w3.js.map +10 -0
- package/dist/chunks/index-njt7yzzm.js +134 -0
- package/dist/chunks/index-njt7yzzm.js.map +9 -0
- package/dist/chunks/index-we7va6v6.js +7984 -0
- package/dist/chunks/index-we7va6v6.js.map +15 -0
- package/dist/chunks/index-xrm6f7wc.js +2563 -0
- package/dist/chunks/index-xrm6f7wc.js.map +10 -0
- package/dist/conformance.js +182749 -0
- package/dist/conformance.js.map +10 -0
- package/dist/entries/prompt.js +251 -0
- package/dist/entries/prompt.js.map +11 -0
- package/dist/entries/schema.js +1725 -0
- package/dist/entries/schema.js.map +11 -0
- package/dist/host/index.js +122 -0
- package/dist/host/index.js.map +9 -0
- package/dist/index.js +3213 -0
- package/dist/index.js.map +27 -0
- package/dist/types/src/a11y.d.ts +21 -0
- package/dist/types/src/animation.d.ts +76 -0
- package/dist/types/src/basic-map.d.ts +38 -0
- package/dist/types/src/builder.d.ts +50 -0
- package/dist/types/src/catalog.d.ts +54 -0
- package/dist/types/src/catalog.described.d.ts +33 -0
- package/dist/types/src/catalog.generated.d.ts +829 -0
- package/dist/types/src/chart.d.ts +46 -0
- package/dist/types/src/code.d.ts +44 -0
- package/dist/types/src/color.d.ts +20 -0
- package/dist/types/src/conformance.d.ts +39 -0
- package/dist/types/src/connector/app.d.ts +14 -0
- package/dist/types/src/connector/connector.d.ts +77 -0
- package/dist/types/src/connector/index.d.ts +4 -0
- package/dist/types/src/css.d.ts +29 -0
- package/dist/types/src/define.d.ts +66 -0
- package/dist/types/src/direction.d.ts +16 -0
- package/dist/types/src/dynamic.d.ts +159 -0
- package/dist/types/src/entries/prompt.d.ts +11 -0
- package/dist/types/src/entries/schema.d.ts +8 -0
- package/dist/types/src/expr.d.ts +71 -0
- package/dist/types/src/extension.d.ts +4 -0
- package/dist/types/src/format.d.ts +112 -0
- package/dist/types/src/geometry.d.ts +40 -0
- package/dist/types/src/host/contract.d.ts +188 -0
- package/dist/types/src/host/decoders.d.ts +61 -0
- package/dist/types/src/host/index.d.ts +11 -0
- package/dist/types/src/host/package.d.ts +58 -0
- package/dist/types/src/host/policy.d.ts +105 -0
- package/dist/types/src/host/router.d.ts +34 -0
- package/dist/types/src/host/runtime.d.ts +205 -0
- package/dist/types/src/host/sources.d.ts +15 -0
- package/dist/types/src/host/transports.d.ts +109 -0
- package/dist/types/src/index.d.ts +63 -0
- package/dist/types/src/layout.d.ts +20 -0
- package/dist/types/src/limits.d.ts +21 -0
- package/dist/types/src/list.d.ts +133 -0
- package/dist/types/src/locale.d.ts +22 -0
- package/dist/types/src/macros.d.ts +29 -0
- package/dist/types/src/overlay.d.ts +27 -0
- package/dist/types/src/prompt.d.ts +44 -0
- package/dist/types/src/recipes.d.ts +17 -0
- package/dist/types/src/reducer.d.ts +41 -0
- package/dist/types/src/resizable.d.ts +38 -0
- package/dist/types/src/schema.d.ts +7 -0
- package/dist/types/src/strings.d.ts +13 -0
- package/dist/types/src/style.d.ts +201 -0
- package/dist/types/src/test-preload.d.ts +1 -0
- package/dist/types/src/text-shimmer.d.ts +24 -0
- package/dist/types/src/theme-types.d.ts +162 -0
- package/dist/types/src/theme.d.ts +73 -0
- package/dist/types/src/themes.d.ts +22 -0
- package/dist/types/src/tree-guides.d.ts +17 -0
- package/dist/types/src/types.d.ts +314 -0
- package/dist/types/src/validate.d.ts +31 -0
- package/dist/types/src/web/base-css.d.ts +1 -0
- package/dist/types/src/web/box-css.d.ts +55 -0
- package/dist/types/src/web/coerce.d.ts +32 -0
- package/dist/types/src/web/data.d.ts +105 -0
- package/dist/types/src/web/dates.d.ts +12 -0
- package/dist/types/src/web/form.d.ts +44 -0
- package/dist/types/src/web/host-types.d.ts +119 -0
- package/dist/types/src/web/index.d.ts +28 -0
- package/dist/types/src/web/inputs.d.ts +55 -0
- package/dist/types/src/web/list.d.ts +13 -0
- package/dist/types/src/web/listbox.d.ts +14 -0
- package/dist/types/src/web/markdown.d.ts +96 -0
- package/dist/types/src/web/media.d.ts +62 -0
- package/dist/types/src/web/parts.d.ts +4 -0
- package/dist/types/src/web/primitives/alert-dialog.d.ts +10 -0
- package/dist/types/src/web/primitives/alert.d.ts +9 -0
- package/dist/types/src/web/primitives/avatar-color.d.ts +2 -0
- package/dist/types/src/web/primitives/avatar.d.ts +13 -0
- package/dist/types/src/web/primitives/badge.d.ts +10 -0
- package/dist/types/src/web/primitives/breadcrumb.d.ts +10 -0
- package/dist/types/src/web/primitives/button.d.ts +6 -0
- package/dist/types/src/web/primitives/calendar.d.ts +43 -0
- package/dist/types/src/web/primitives/card.d.ts +9 -0
- package/dist/types/src/web/primitives/checkbox.d.ts +5 -0
- package/dist/types/src/web/primitives/choice-tiles.d.ts +32 -0
- package/dist/types/src/web/primitives/cn.d.ts +3 -0
- package/dist/types/src/web/primitives/code-block.d.ts +24 -0
- package/dist/types/src/web/primitives/command.d.ts +134 -0
- package/dist/types/src/web/primitives/context-ring.d.ts +24 -0
- package/dist/types/src/web/primitives/dialog-arms.d.ts +6 -0
- package/dist/types/src/web/primitives/dialog.d.ts +24 -0
- package/dist/types/src/web/primitives/disclosure-header.d.ts +5 -0
- package/dist/types/src/web/primitives/dock.d.ts +42 -0
- package/dist/types/src/web/primitives/dropdown-menu.d.ts +14 -0
- package/dist/types/src/web/primitives/empty-state.d.ts +15 -0
- package/dist/types/src/web/primitives/glass-card.d.ts +4 -0
- package/dist/types/src/web/primitives/hover-card.d.ts +7 -0
- package/dist/types/src/web/primitives/icon-disc.d.ts +12 -0
- package/dist/types/src/web/primitives/index.d.ts +48 -0
- package/dist/types/src/web/primitives/input.d.ts +5 -0
- package/dist/types/src/web/primitives/kbd.d.ts +4 -0
- package/dist/types/src/web/primitives/label.d.ts +3 -0
- package/dist/types/src/web/primitives/menu-surface.d.ts +17 -0
- package/dist/types/src/web/primitives/meter.d.ts +21 -0
- package/dist/types/src/web/primitives/popover.d.ts +3 -0
- package/dist/types/src/web/primitives/progress-ring.d.ts +5 -0
- package/dist/types/src/web/primitives/progress.d.ts +8 -0
- package/dist/types/src/web/primitives/scroll-area.d.ts +49 -0
- package/dist/types/src/web/primitives/segmented-control.d.ts +5 -0
- package/dist/types/src/web/primitives/select.d.ts +47 -0
- package/dist/types/src/web/primitives/separator.d.ts +3 -0
- package/dist/types/src/web/primitives/sheet-chrome.d.ts +4 -0
- package/dist/types/src/web/primitives/sheet.d.ts +20 -0
- package/dist/types/src/web/primitives/skeleton.d.ts +3 -0
- package/dist/types/src/web/primitives/spinner.d.ts +3 -0
- package/dist/types/src/web/primitives/switch.d.ts +4 -0
- package/dist/types/src/web/primitives/table.d.ts +11 -0
- package/dist/types/src/web/primitives/tabs.d.ts +13 -0
- package/dist/types/src/web/primitives/textarea.d.ts +3 -0
- package/dist/types/src/web/primitives/toast.d.ts +163 -0
- package/dist/types/src/web/primitives/tooltip.d.ts +3 -0
- package/dist/types/src/web/primitives/truncate.d.ts +7 -0
- package/dist/types/src/web/primitives/typeahead-portal.d.ts +12 -0
- package/dist/types/src/web/share.d.ts +6 -0
- package/dist/types/src/web/table.d.ts +20 -0
- package/dist/types/src/web/theme-css.d.ts +69 -0
- package/dist/types/src/web/urls.d.ts +21 -0
- package/dist/web/index.js +2303 -0
- package/dist/web/index.js.map +26 -0
- package/dist/web/primitives/index.js +1450 -0
- package/dist/web/primitives/index.js.map +57 -0
- package/docs/components.generated.json +6238 -0
- package/docs/round-1-contract.md +679 -0
- package/docs/round-2-contract.md +476 -0
- package/docs/round-3-contract.md +174 -0
- package/docs/themes.generated.json +3503 -0
- package/fixtures/animations.json +2890 -0
- package/fixtures/bench-list.json +58 -0
- package/fixtures/bind-time.json +30664 -0
- package/fixtures/catalog-basic-map.json +1692 -0
- package/fixtures/catalog-components.json +9323 -0
- package/fixtures/catalog-extension.json +620 -0
- package/fixtures/catalog-macros.json +36370 -0
- package/fixtures/code-tokens.json +1993 -0
- package/fixtures/conformance-baseline.json +55544 -0
- package/fixtures/conformance-cases.json +49 -0
- package/fixtures/conformance-known.json +2123 -0
- package/fixtures/control-geometry.json +4200 -0
- package/fixtures/dashboard.data.json +74 -0
- package/fixtures/dashboard.json +752 -0
- package/fixtures/demo-surface.json +47 -0
- package/fixtures/format.json +870 -0
- package/fixtures/host-policy.json +1067 -0
- package/fixtures/host-router.json +1152 -0
- package/fixtures/host-transport.json +590 -0
- package/fixtures/interactions-round1.json +773 -0
- package/fixtures/kitchen-sink.expanded.json +10844 -0
- package/fixtures/kitchen-sink.json +3049 -0
- package/fixtures/layout-geometry-round1.json +7278 -0
- package/fixtures/layout-geometry.json +2072 -0
- package/fixtures/overlay-geometry.json +272 -0
- package/fixtures/primitive-specimens.json +58 -0
- package/fixtures/prompt-budget.json +33 -0
- package/fixtures/resizable.json +714 -0
- package/fixtures/round4-contract.json +2985 -0
- package/fixtures/specimens.json +9832 -0
- package/fixtures/style-conditions.json +336 -0
- package/fixtures/template-items.json +2215 -0
- package/fixtures/text-direction.json +309 -0
- package/fixtures/text-shimmer.json +96 -0
- package/fixtures/theme-extends.json +573 -0
- package/fixtures/theme-invalid.json +1296 -0
- package/fixtures/theme-recipes.json +58600 -0
- package/fixtures/theme-resolved.json +23949 -0
- package/fixtures/toast-stack.json +215 -0
- package/fixtures/tree-guides.json +224 -0
- package/fixtures/virtual-list.json +733 -0
- package/generated/ExponentialUICatalog.generated.kt +67 -0
- package/generated/ExponentialUICatalog.generated.swift +67 -0
- package/generated/ExponentialUIThemes.generated.kt +23 -0
- package/generated/ExponentialUIThemes.generated.swift +23 -0
- package/generated/catalog.descriptions.generated.rs +6 -0
- package/generated/catalog.generated.rs +80 -0
- package/generated/catalog.themes.generated.rs +34 -0
- package/generated/core.descriptions.json +2505 -0
- package/generated/core.runtime.json +3609 -0
- package/package.json +87 -4
- package/themes/exponential.recipes.json +49 -0
- package/themes/exponential.theme.json +755 -0
- package/themes/neutral.theme.json +5676 -0
- package/themes/orange.theme.json +43 -0
- package/themes/playful.theme.json +219 -0
- package/vendor/a2ui/LICENSE.txt +203 -0
- package/vendor/a2ui/README.md +27 -0
- package/vendor/a2ui/v0_9/basic_catalog.json +1387 -0
- package/vendor/a2ui/v0_9/basic_catalog_rules.txt +5 -0
- package/vendor/a2ui/v0_9/client_capabilities.json +97 -0
- package/vendor/a2ui/v0_9/client_to_server.json +104 -0
- package/vendor/a2ui/v0_9/common_types.json +315 -0
- package/vendor/a2ui/v0_9/server_to_client.json +132 -0
- package/vendor/json-render/LICENSE.txt +201 -0
- package/vendor/json-render/README.md +13 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface ChartSeries {
|
|
2
|
+
name: string;
|
|
3
|
+
values: readonly number[];
|
|
4
|
+
tone?: string;
|
|
5
|
+
}
|
|
6
|
+
/** The value range the y axis spans: `min` defaults to 0 (lower when a value
|
|
7
|
+
* is negative), `max` to the largest value (at least 0) — for `stackedBar`
|
|
8
|
+
* the largest category sum of the POSITIVE values, and `min` the lowest sum
|
|
9
|
+
* of the NEGATIVE ones (positive and negative stacks grow apart from 0).
|
|
10
|
+
* Sparkline spans its own min..max. Pie/donut use the same. Non-finite
|
|
11
|
+
* values are skipped. Loops, never spreads: a 150k-point series is fine. */
|
|
12
|
+
export declare function chartExtent(kind: string, series: readonly ChartSeries[], min?: number, max?: number): {
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
};
|
|
16
|
+
/** The numbers a Chart's accessible name fills `$string.chartSummary` with:
|
|
17
|
+
* the series names (", "-joined) and the extent of the data (not the axis). */
|
|
18
|
+
export declare function chartSummaryParams(series: readonly ChartSeries[]): {
|
|
19
|
+
series: string;
|
|
20
|
+
min: number;
|
|
21
|
+
max: number;
|
|
22
|
+
};
|
|
23
|
+
/** The numbers a sparkline's accessible name fills `$string.sparklineSummary`
|
|
24
|
+
* with: first, last, min, max of the finite values (0 when there are none). */
|
|
25
|
+
export declare function sparklineSummaryParams(values: readonly number[]): {
|
|
26
|
+
first: number;
|
|
27
|
+
last: number;
|
|
28
|
+
min: number;
|
|
29
|
+
max: number;
|
|
30
|
+
};
|
|
31
|
+
/** Axis ticks over [min, max]: a nice step (1, 2 or 5 × 10^n) giving about
|
|
32
|
+
* `target` ticks, the range widened to whole steps, every tick rounded to
|
|
33
|
+
* the step's decimals. */
|
|
34
|
+
export declare function niceTicks(min: number, max: number, target?: number): {
|
|
35
|
+
min: number;
|
|
36
|
+
max: number;
|
|
37
|
+
step: number;
|
|
38
|
+
ticks: number[];
|
|
39
|
+
};
|
|
40
|
+
/** The colour token of series (or slice) i: its tone's colour when set,
|
|
41
|
+
* else `$color.chart1..8` in order, wrapping. */
|
|
42
|
+
export declare function seriesColor(index: number, tone?: string): string;
|
|
43
|
+
/** The donut's hole as a share of its radius (pie = 0). */
|
|
44
|
+
export declare const DONUT_HOLE = 0.6;
|
|
45
|
+
/** Rows past which Table and List window their children (catalog/layout.json). */
|
|
46
|
+
export { WINDOW_THRESHOLD } from "./layout.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface CodeToken {
|
|
2
|
+
kind: string;
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
interface LanguageSpec {
|
|
6
|
+
plain?: boolean;
|
|
7
|
+
ansi?: boolean;
|
|
8
|
+
lineKinds?: Record<string, string>;
|
|
9
|
+
lineComment?: string[];
|
|
10
|
+
blockComment?: [string, string][];
|
|
11
|
+
strings?: string[];
|
|
12
|
+
multiline?: string[];
|
|
13
|
+
keyStrings?: boolean;
|
|
14
|
+
markup?: boolean;
|
|
15
|
+
numbers?: boolean;
|
|
16
|
+
identExtra?: string;
|
|
17
|
+
keywords?: string[];
|
|
18
|
+
caseInsensitive?: boolean;
|
|
19
|
+
keyIdents?: boolean;
|
|
20
|
+
typeNames?: string[];
|
|
21
|
+
types?: string;
|
|
22
|
+
operators?: string;
|
|
23
|
+
punctuation?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const CODE_LANGUAGES: Record<string, LanguageSpec>;
|
|
26
|
+
export declare const CODE_LANGUAGE_NAMES: readonly string[];
|
|
27
|
+
/** EXP-1324 `ansi`: one run of the escape-free text, with the SGR colour
|
|
28
|
+
* (a codeToken kind) it was printed in, or null. */
|
|
29
|
+
export interface AnsiRun {
|
|
30
|
+
kind: string | null;
|
|
31
|
+
text: string;
|
|
32
|
+
}
|
|
33
|
+
/** The source with every ANSI CSI escape removed, split into runs by SGR
|
|
34
|
+
* colour (catalog/code.json `$comment`, `ansi`). Adjacent runs of one
|
|
35
|
+
* colour merge; an incomplete escape stays text. */
|
|
36
|
+
export declare function ansiRuns(source: string): AnsiRun[];
|
|
37
|
+
/** The text a CodeBlock shows and copies: the source with CRLF → LF and,
|
|
38
|
+
* for `ansi`, every escape removed. */
|
|
39
|
+
export declare function codeText(source: string, language: string): string;
|
|
40
|
+
/** The source tokenized per LINE: each line's tokens concatenate to exactly
|
|
41
|
+
* its text (no `\n`), adjacent tokens of one kind merged; an empty line is
|
|
42
|
+
* an empty list. An unknown language tokenizes as `plain`. */
|
|
43
|
+
export declare function tokenizeCode(source: string, language: string): CodeToken[][];
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Rgba {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
/** 0–1 */
|
|
6
|
+
a: number;
|
|
7
|
+
}
|
|
8
|
+
/** Any CSS colour a theme import may meet → `Rgba`, or null when it is not
|
|
9
|
+
* one (a `var()`, a word we do not know). */
|
|
10
|
+
export declare function parseColor(input: unknown): Rgba | null;
|
|
11
|
+
/** `#rrggbb`, or `#rrggbbaa` when the alpha is below 1. Lowercase. */
|
|
12
|
+
export declare function toHex(c: Rgba): `#${string}`;
|
|
13
|
+
/** True for the ONE form a theme file accepts: `#rrggbb` / `#rrggbbaa`. */
|
|
14
|
+
export declare function isThemeHex(value: unknown): value is `#${string}`;
|
|
15
|
+
/** Any CSS colour → the theme form, or null. */
|
|
16
|
+
export declare function toThemeHex(input: unknown): `#${string}` | null;
|
|
17
|
+
/** Relative luminance (WCAG) of an opaque colour, 0–1. */
|
|
18
|
+
export declare function luminance(c: Rgba): number;
|
|
19
|
+
/** WCAG contrast ratio between two opaque colours. */
|
|
20
|
+
export declare function contrast(a: Rgba, b: Rgba): number;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** 2 = round 2: the round-1 bind/style/code fixtures and the round-2
|
|
2
|
+
* contract fixtures became suites (docs/round-2-contract.md §8). */
|
|
3
|
+
export declare const CONFORMANCE_VERSION = 2;
|
|
4
|
+
export interface ConformanceSuite {
|
|
5
|
+
id: string;
|
|
6
|
+
files: string[];
|
|
7
|
+
/** What a runner does with each case. */
|
|
8
|
+
check: string;
|
|
9
|
+
/** How a case is counted. */
|
|
10
|
+
unit: string;
|
|
11
|
+
cases: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ConformanceManifest {
|
|
14
|
+
$comment: string;
|
|
15
|
+
version: number;
|
|
16
|
+
hostContractVersion: number;
|
|
17
|
+
suites: ConformanceSuite[];
|
|
18
|
+
}
|
|
19
|
+
/** The manifest over the bundled fixtures, or over `fixture(name)` (the
|
|
20
|
+
* generator passes the files it is about to write). */
|
|
21
|
+
export declare function conformanceManifest(fixture?: (name: string) => unknown): ConformanceManifest;
|
|
22
|
+
/** What a runner writes (conformance/report.schema.json). */
|
|
23
|
+
export interface ConformanceReport {
|
|
24
|
+
renderer: string;
|
|
25
|
+
platform: string;
|
|
26
|
+
version: string;
|
|
27
|
+
conformanceVersion: number;
|
|
28
|
+
suites: Record<string, {
|
|
29
|
+
cases: number;
|
|
30
|
+
passed: number;
|
|
31
|
+
failed: string[];
|
|
32
|
+
skipped?: string[];
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export interface ReportVerdict {
|
|
36
|
+
conformant: boolean;
|
|
37
|
+
problems: string[];
|
|
38
|
+
}
|
|
39
|
+
export declare function checkReport(report: ConformanceReport, manifest?: ConformanceManifest): ReportVerdict;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PackageIssue, AppPackage } from "../host/package.js";
|
|
2
|
+
import { ExponentialHost } from "../host/runtime.js";
|
|
3
|
+
import type { HostOptions } from "../host/runtime.js";
|
|
4
|
+
export interface AppHostOptions extends HostOptions {
|
|
5
|
+
/** The package to run. */
|
|
6
|
+
package: AppPackage;
|
|
7
|
+
}
|
|
8
|
+
export interface AppHost {
|
|
9
|
+
host: ExponentialHost;
|
|
10
|
+
issues: PackageIssue[];
|
|
11
|
+
/** Apply a template of the package onto a surface (default: the first). */
|
|
12
|
+
open(surfaceId: string, templateId?: string, data?: unknown): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function createAppHost(options: AppHostOptions): AppHost;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { HostFunction } from "../host/runtime.js";
|
|
2
|
+
import type { SourceResolvers } from "../host/sources.js";
|
|
3
|
+
export interface AuthServerMetadata {
|
|
4
|
+
issuer: string;
|
|
5
|
+
authorization_endpoint: string;
|
|
6
|
+
token_endpoint: string;
|
|
7
|
+
registration_endpoint?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ConnectorTokens {
|
|
10
|
+
accessToken: string;
|
|
11
|
+
refreshToken?: string;
|
|
12
|
+
/** Epoch ms. */
|
|
13
|
+
expiresAt?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ConnectorOptions {
|
|
16
|
+
/** The Exponential instance, e.g. `https://app.exponential.at`. */
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
/** Where the instance sends the person back with `?code=&state=`. */
|
|
19
|
+
redirectUri: string;
|
|
20
|
+
clientName?: string;
|
|
21
|
+
/** A client id registered earlier (skips dynamic registration). */
|
|
22
|
+
clientId?: string;
|
|
23
|
+
tokens?: ConnectorTokens;
|
|
24
|
+
/** Called whenever tokens change (persist them). */
|
|
25
|
+
onTokens?: (tokens: ConnectorTokens) => void;
|
|
26
|
+
fetch?: typeof fetch;
|
|
27
|
+
/** Seconds between re-reads of a bound source (MCP has no live feed). */
|
|
28
|
+
pollSeconds?: number;
|
|
29
|
+
}
|
|
30
|
+
/** A PKCE verifier and its S256 challenge. */
|
|
31
|
+
export declare function pkcePair(): Promise<{
|
|
32
|
+
verifier: string;
|
|
33
|
+
challenge: string;
|
|
34
|
+
}>;
|
|
35
|
+
export declare class ExponentialConnector {
|
|
36
|
+
private options;
|
|
37
|
+
private metadata?;
|
|
38
|
+
private clientId?;
|
|
39
|
+
tokens?: ConnectorTokens;
|
|
40
|
+
private rpcId;
|
|
41
|
+
constructor(options: ConnectorOptions);
|
|
42
|
+
private get fetch();
|
|
43
|
+
private url;
|
|
44
|
+
discover(): Promise<AuthServerMetadata>;
|
|
45
|
+
/** Dynamic client registration (a public client: PKCE, no secret). */
|
|
46
|
+
register(): Promise<string>;
|
|
47
|
+
/** Where to send the person. Keep `verifier`, `state` AND `clientId`
|
|
48
|
+
* for the callback: a connector rebuilt after the redirect needs the
|
|
49
|
+
* dynamically registered client id (pass it to `exchange`, or as
|
|
50
|
+
* `ConnectorOptions.clientId`), or the code was issued to a client the
|
|
51
|
+
* token request does not name. */
|
|
52
|
+
authorizeUrl(): Promise<{
|
|
53
|
+
url: string;
|
|
54
|
+
verifier: string;
|
|
55
|
+
state: string;
|
|
56
|
+
clientId: string;
|
|
57
|
+
}>;
|
|
58
|
+
private token;
|
|
59
|
+
/** The callback: trade the code for tokens. `clientId` = the one
|
|
60
|
+
* `authorizeUrl` returned (required unless this connector registered it
|
|
61
|
+
* or got it in its options): the exchange never registers a new client,
|
|
62
|
+
* whose id the code was not issued to. */
|
|
63
|
+
exchange(code: string, verifier: string, clientId?: string): Promise<ConnectorTokens>;
|
|
64
|
+
refresh(): Promise<ConnectorTokens>;
|
|
65
|
+
/** One MCP tool call on the instance, as the person who consented.
|
|
66
|
+
* Returns the tool's JSON payload (its text content parsed). */
|
|
67
|
+
callTool(name: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
68
|
+
/** The `exp:` scheme over MCP: `exp:issues?board=<id>&team=<id>&limit=<n>&search=<q>`,
|
|
69
|
+
* `exp:boards?team=<id>`, `exp:teams`, `exp:members?team=<id>`. Each
|
|
70
|
+
* emits `{rows, count}` and re-reads every `pollSeconds` (default 30, the
|
|
71
|
+
* `poll` param overrides; 0 = once). Unknown names emit `null`. */
|
|
72
|
+
sources(): SourceResolvers;
|
|
73
|
+
private follow;
|
|
74
|
+
/** `exponential.mcp({tool, arguments})` for an ExponentialHost (gate it
|
|
75
|
+
* with an `ask` policy: it acts as the person). */
|
|
76
|
+
functions(): Record<string, HostFunction>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FontSpec, ResolvedStyle, ResolvedTheme } from "./theme-types.js";
|
|
2
|
+
interface GradientValue {
|
|
3
|
+
angle: number;
|
|
4
|
+
stops: {
|
|
5
|
+
color: string;
|
|
6
|
+
offset: number;
|
|
7
|
+
}[];
|
|
8
|
+
}
|
|
9
|
+
export declare function gradientCss(gradient: GradientValue): string;
|
|
10
|
+
/** A CSS string literal: backslashes and quotes escaped, so a family name
|
|
11
|
+
* can never end the string early (`validateTheme` also refuses them). */
|
|
12
|
+
export declare function cssString(text: string): string;
|
|
13
|
+
/** `font-family` for a theme family: the quoted name, then its `fonts`
|
|
14
|
+
* fallback list. Shared by the web layer's `web/theme-css.ts`. */
|
|
15
|
+
export declare function fontStack(family: string, fonts: Record<string, FontSpec>): string;
|
|
16
|
+
/** Flat declarations for one resolved style (condition blocks are the
|
|
17
|
+
* caller's: resolve them against the surface first). `native` is not CSS
|
|
18
|
+
* and is dropped; `transitionEasing` folds into `transition`; round 2:
|
|
19
|
+
* `backdropBlur` (px) → `backdrop-filter` (+ the -webkit- twin);
|
|
20
|
+
* `animation` (+ `animationDuration`, ms once resolved) → the `animation`
|
|
21
|
+
* shorthand over `@keyframes xui-<name>` (src/animation.ts keyframesCss)
|
|
22
|
+
* when `theme` is given (its motion tokens time it), else nothing; a set
|
|
23
|
+
* that animates opacity makes `opacity` = own × `var(--xui-a-opacity, 1)`
|
|
24
|
+
* (register it: ANIMATION_PROPERTIES_CSS). The caller drops `animation`
|
|
25
|
+
* under reduced motion. */
|
|
26
|
+
export declare function styleToCss(style: ResolvedStyle | Record<string, unknown>, fonts?: Record<string, FontSpec>, theme?: ResolvedTheme): Record<string, string>;
|
|
27
|
+
/** The same as one `style=""` attribute string. */
|
|
28
|
+
export declare function styleAttribute(style: ResolvedStyle | Record<string, unknown>, fonts?: Record<string, FontSpec>): string;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type ComponentName, type ComponentProps } from "./catalog.generated.js";
|
|
2
|
+
import type { Action, AuthoredAccessibility, DataBinding, ExtensionDef, FlatComponent, FunctionCall, ReduceIssue, UiNode, Visible } from "./types.js";
|
|
3
|
+
/** A node of the typed tree: `component` picks the props type. */
|
|
4
|
+
export interface SurfaceNode<C extends ComponentName = ComponentName> {
|
|
5
|
+
/** Explicit id; `defineSurface` assigns `root` to the top node and `<component>-<n>` to the rest. */
|
|
6
|
+
id?: string;
|
|
7
|
+
component: C;
|
|
8
|
+
props: ComponentProps[C];
|
|
9
|
+
style?: Record<string, unknown>;
|
|
10
|
+
on?: Record<string, Action>;
|
|
11
|
+
visible?: Visible;
|
|
12
|
+
accessibility?: AuthoredAccessibility;
|
|
13
|
+
/** Static children, or one template rendered per item of `path`. */
|
|
14
|
+
children?: SurfaceNode[] | TemplateChildren;
|
|
15
|
+
slots?: Record<string, SurfaceNode>;
|
|
16
|
+
}
|
|
17
|
+
export interface TemplateChildren {
|
|
18
|
+
template: SurfaceNode;
|
|
19
|
+
/** The JSON pointer of the array. */
|
|
20
|
+
path: string;
|
|
21
|
+
/** The item field that identifies it. */
|
|
22
|
+
key?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DefineOptions {
|
|
25
|
+
surfaceId?: string;
|
|
26
|
+
catalogId?: string;
|
|
27
|
+
extensions?: readonly ExtensionDef[];
|
|
28
|
+
/** Initial data model writes: pointer → value (one updateDataModel each). */
|
|
29
|
+
data?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface DefinedSurface {
|
|
32
|
+
surfaceId: string;
|
|
33
|
+
catalogId: string;
|
|
34
|
+
components: FlatComponent[];
|
|
35
|
+
issues: ReduceIssue[];
|
|
36
|
+
/** The normalized tree (macros expanded), for a host that paints directly. */
|
|
37
|
+
root: UiNode;
|
|
38
|
+
messages: Record<string, unknown>[];
|
|
39
|
+
jsonl: string;
|
|
40
|
+
}
|
|
41
|
+
/** A data binding: `{ path }`. A pointer relative to the item inside a template. */
|
|
42
|
+
export declare const bind: (path: string) => DataBinding;
|
|
43
|
+
/** A client function call: `{ call, args }`. */
|
|
44
|
+
export declare const call: (name: string, args?: Record<string, unknown>) => FunctionCall;
|
|
45
|
+
/** An action that sends an event to the agent / server. */
|
|
46
|
+
export declare const event: (name: string, context?: Record<string, unknown>) => Action;
|
|
47
|
+
/** An action that runs a client function (`set`, `openUrl`, `app.toast`…). */
|
|
48
|
+
export declare const run: (name: string, args?: Record<string, unknown>) => Action;
|
|
49
|
+
type Extra<C extends ComponentName> = Omit<SurfaceNode<C>, `component` | `props` | `children`>;
|
|
50
|
+
/** The typed factory per component: `ui.Stack(props, children?, extra?)`. */
|
|
51
|
+
export type Factory<C extends ComponentName> = (props: ComponentProps[C], children?: SurfaceNode[] | TemplateChildren, extra?: Extra<C>) => SurfaceNode<C>;
|
|
52
|
+
/** `ui.Card({ title: "…" }, [ui.Text({ text: "…" })])`: one factory per
|
|
53
|
+
* catalog component, typed by name. Props only: style, on, visible,
|
|
54
|
+
* slots and an explicit id go in the third argument. */
|
|
55
|
+
export declare const ui: {
|
|
56
|
+
[C in ComponentName]: Factory<C>;
|
|
57
|
+
};
|
|
58
|
+
/** A typed node from a name (for a component picked at runtime). */
|
|
59
|
+
export declare function el<C extends ComponentName>(component: C, props: ComponentProps[C], children?: SurfaceNode[] | TemplateChildren, extra?: Extra<C>): SurfaceNode<C>;
|
|
60
|
+
/** The tree → the flat list, ids assigned (the top node is `root`; an
|
|
61
|
+
* unnamed node is `<component lower-case>-<n>`, unique within the tree). */
|
|
62
|
+
export declare function flattenSurface(tree: SurfaceNode, rootId?: string): FlatComponent[];
|
|
63
|
+
/** The typed tree → everything a host or an agent transport needs. Never
|
|
64
|
+
* throws on a bad surface: read `issues`. */
|
|
65
|
+
export declare function defineSurface(tree: SurfaceNode, options?: DefineOptions): DefinedSurface;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ConditionContext } from "./style.js";
|
|
2
|
+
import type { UiNode } from "./types.js";
|
|
3
|
+
export type Direction = `ltr` | `rtl`;
|
|
4
|
+
export type PhysicalAlign = `left` | `right` | `center` | `justify`;
|
|
5
|
+
/** Every node's direction: its own style `direction` (resolved against
|
|
6
|
+
* `ctx` when given), else its parent's; the root's parent is the surface
|
|
7
|
+
* (catalog/locale.json `textDirection(locale)`). Slots inherit from their
|
|
8
|
+
* owner. A template's items take the direction of the node that renders
|
|
9
|
+
* them (call again with that direction for the template node). */
|
|
10
|
+
export declare function nodeDirections(root: UiNode, surface: Direction, ctx?: ConditionContext): Record<string, Direction>;
|
|
11
|
+
/** `start`/`end` (and an absent value = `start`) as the physical side for
|
|
12
|
+
* a direction; `left`, `right`, `center` and `justify` stay. */
|
|
13
|
+
export declare function physicalTextAlign(align: unknown, direction: Direction): PhysicalAlign;
|
|
14
|
+
/** A node's text alignment: its style `textAlign`, else a Text's `align`
|
|
15
|
+
* prop, else `start` — resolved against the node's direction. */
|
|
16
|
+
export declare function nodeTextAlign(node: UiNode, direction: Direction, ctx?: ConditionContext): PhysicalAlign;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { type Formatter } from "./format.js";
|
|
2
|
+
import type { Action, ComponentDef, ExtensionDef, PropSchema, UiNode } from "./types.js";
|
|
3
|
+
/** Where relative paths resolve: the pointer of the current template item
|
|
4
|
+
* (`/rows/3`), or the root; `item` (when the key is present) = a LITERAL
|
|
5
|
+
* item that is not in the data model (a Table row of literal `rows`):
|
|
6
|
+
* relative paths then read inside it, absolute ones still the data. */
|
|
7
|
+
export interface DataScope {
|
|
8
|
+
base?: string;
|
|
9
|
+
item?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare function absolutePath(path: string, scope?: DataScope): string;
|
|
12
|
+
/** True when relative paths of this scope read a literal item. */
|
|
13
|
+
export declare function hasItem(scope: DataScope | undefined): boolean;
|
|
14
|
+
/** The value a binding path names in a scope: inside the literal item for a
|
|
15
|
+
* relative path under an item scope, else at its absolute pointer. */
|
|
16
|
+
export declare function readPath(data: unknown, path: string, scope?: DataScope): unknown;
|
|
17
|
+
/** The value at an absolute pointer; undefined when any step is missing.
|
|
18
|
+
* `` and `/` = the whole model (as `writeTokens` writes it); only OWN
|
|
19
|
+
* keys and real indices are read (`/constructor` names nothing). */
|
|
20
|
+
export declare function readPointer(data: unknown, pointer: string): unknown;
|
|
21
|
+
/** A pointer write: the new data model, or `error` (data unchanged). */
|
|
22
|
+
export interface PointerWrite {
|
|
23
|
+
data: unknown;
|
|
24
|
+
error?: string;
|
|
25
|
+
}
|
|
26
|
+
/** A pointer's tokens (`` and `/` = the whole model), or the limit it breaks. */
|
|
27
|
+
export declare function writeTokens(pointer: string): string[] | string;
|
|
28
|
+
/** VAPP-103: the pointer-write refusals, byte-identical in every core. */
|
|
29
|
+
export declare const POINTER_ISSUES: {
|
|
30
|
+
readonly bytes: `data: pointer longer than ${number} bytes`;
|
|
31
|
+
readonly segments: `data: pointer has more than ${number} segments`;
|
|
32
|
+
readonly notIndex: (token: string) => string;
|
|
33
|
+
readonly pastEnd: (token: string, length: number) => string;
|
|
34
|
+
};
|
|
35
|
+
/** A copy of `data` with `value` written at the absolute pointer
|
|
36
|
+
* (`undefined` removes). Missing containers are OBJECTS; an array takes an
|
|
37
|
+
* index up to its length (`length` and `-` append). Refused (data
|
|
38
|
+
* unchanged, `error` set): a pointer past `maxPointerBytes` /
|
|
39
|
+
* `maxPointerSegments`, a non-index token or an index past the end of an
|
|
40
|
+
* array. Iterative: any depth, no recursion. */
|
|
41
|
+
export declare function writePointer(data: unknown, pointer: string, value: unknown): PointerWrite;
|
|
42
|
+
export type FunctionTable = Record<string, (args: Record<string, unknown>) => unknown>;
|
|
43
|
+
/** The reference function table: the core functions + and/or/not/required
|
|
44
|
+
* + (round 2) the format functions through the English fallback Formatter
|
|
45
|
+
* (`formatNumber`, `formatCurrency`, `formatPercent`, `formatDate`,
|
|
46
|
+
* `formatRelativeTime`, `pluralize`; ResolveOptions.formatter replaces it).
|
|
47
|
+
* `set` is an action, never a value. The expander EMITS `not`/`and`/`or`
|
|
48
|
+
* too, so a renderer must implement this whole table (generated as
|
|
49
|
+
* `bindFunctionNames`), not just the core names. */
|
|
50
|
+
export declare const BIND_FUNCTIONS: FunctionTable;
|
|
51
|
+
export declare const BIND_FUNCTION_NAMES: readonly string[];
|
|
52
|
+
export interface ResolveOptions {
|
|
53
|
+
scope?: DataScope;
|
|
54
|
+
/** Extra functions (the host's own, the locale formatters). */
|
|
55
|
+
functions?: FunctionTable;
|
|
56
|
+
/** The surface's built-in string table (`stringTable(overrides)`): a
|
|
57
|
+
* `$string.<id>` value resolves through it. Absent = left as written. */
|
|
58
|
+
strings?: Readonly<Record<string, string>>;
|
|
59
|
+
/** The surface's extensions: their components' prop schemas decide which
|
|
60
|
+
* props are DATA (bindTree). */
|
|
61
|
+
extensions?: readonly ExtensionDef[];
|
|
62
|
+
/** Round 2: the surface's Formatter (SurfaceSettings.locale + timeZone);
|
|
63
|
+
* the format functions run through it. Absent = the English fallback. */
|
|
64
|
+
formatter?: Formatter;
|
|
65
|
+
/** The clock `formatRelativeTime` reads without a `now` argument. */
|
|
66
|
+
now?: () => number;
|
|
67
|
+
}
|
|
68
|
+
/** A prop or style value with every binding and call resolved, at any
|
|
69
|
+
* depth. An unknown function resolves to undefined. */
|
|
70
|
+
export declare function resolveDynamic(value: unknown, data: unknown, options?: ResolveOptions): unknown;
|
|
71
|
+
/** A node's `visible`: absent = shown; else its resolved truthiness. */
|
|
72
|
+
export declare function isVisible(visible: unknown, data: unknown, options?: ResolveOptions): boolean;
|
|
73
|
+
export interface ActionOutcome {
|
|
74
|
+
/** The data model after the action's `set` (unchanged without one). */
|
|
75
|
+
data: unknown;
|
|
76
|
+
/** VAPP-103: the `set` was refused (writePointer's reason). */
|
|
77
|
+
error?: string;
|
|
78
|
+
/** The event to dispatch, its context resolved BEFORE the write. */
|
|
79
|
+
event?: {
|
|
80
|
+
name: string;
|
|
81
|
+
context?: Record<string, unknown>;
|
|
82
|
+
};
|
|
83
|
+
/** A function other than `set` the host must run (openUrl…), args resolved. */
|
|
84
|
+
call?: {
|
|
85
|
+
call: string;
|
|
86
|
+
args: Record<string, unknown>;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** Round 4 (VAPP-103): the data an interaction's action resolves against =
|
|
90
|
+
* the data model WITH the source component's OWN write applied first.
|
|
91
|
+
* `own` = EXACTLY what the component wrote, by prop (an Input's `value`,
|
|
92
|
+
* a Checkbox's `checked`, an overlay's `open`, a FileUpload's MERGED
|
|
93
|
+
* `files`), never inferred from the event payload (an `upload` payload's
|
|
94
|
+
* `added` is the new batch, the write is the whole list): each prop that
|
|
95
|
+
* is a `{path}` binding is written at that path, so a `context.query`
|
|
96
|
+
* bound to the path the Input writes reads the text just typed. Renderers
|
|
97
|
+
* apply it before `runAction` (Rust: every write lands before
|
|
98
|
+
* `Surface::fire`). */
|
|
99
|
+
export declare function withOwnWrites(data: unknown, props: Record<string, unknown>, own: Record<string, unknown> | undefined, scope?: DataScope): unknown;
|
|
100
|
+
/** The overlay components (catalog group `overlay`; AlertDialog expands to
|
|
101
|
+
* a non-dismissible Dialog). */
|
|
102
|
+
export declare const OVERLAY_COMPONENTS: readonly string[];
|
|
103
|
+
/** Round 4 (VAPP-103): a successful Form submit CLOSES the overlay around
|
|
104
|
+
* the form (the author never resets the bound `open` flag). The NEAREST
|
|
105
|
+
* enclosing overlay of ANY kind decides: it closes only when it is a
|
|
106
|
+
* Dialog or Drawer that is dismissible (`dismissible: false` — an
|
|
107
|
+
* AlertDialog — never auto-closes); a nearest Popover, Menu, Tooltip or
|
|
108
|
+
* Toast closes nothing, nor does anything around it. The id of that
|
|
109
|
+
* overlay in the EXPANDED tree, null when nothing closes. Renderers close
|
|
110
|
+
* it like a dismiss (`open` false written through, `change {open:
|
|
111
|
+
* false}`) right after the form's `submit`. */
|
|
112
|
+
export declare function submitClosesOverlay(root: UiNode, formId: string): string | null;
|
|
113
|
+
/** What a press does: resolve the function args and the event context
|
|
114
|
+
* against the data AS IT IS (after `withOwnWrites`), then apply `set`, then
|
|
115
|
+
* hand back the event. */
|
|
116
|
+
export declare function runAction(action: Action, data: unknown, options?: ResolveOptions): ActionOutcome;
|
|
117
|
+
/** A DATA schema: a shape-less `object` (any object) or an array of them —
|
|
118
|
+
* Table `rows` in the core catalog. A literal value there is the author's
|
|
119
|
+
* data, copied verbatim: no binding, call or `$string.<id>` inside it is
|
|
120
|
+
* interpreted (a row `{path: "/etc/hosts"}` is a row). A dynamic value AT
|
|
121
|
+
* the position still resolves (and its result is never descended). */
|
|
122
|
+
export declare function isDataSchema(schema: PropSchema | undefined): boolean;
|
|
123
|
+
/** One prop value resolved along its schema: dynamic → resolved, DATA
|
|
124
|
+
* literal → verbatim, arrays and shaped objects → per item / property,
|
|
125
|
+
* anything else → `resolveDynamic` (any depth). */
|
|
126
|
+
export declare function resolveProp(value: unknown, schema: PropSchema | undefined, data: unknown, options?: ResolveOptions, defs?: Record<string, {
|
|
127
|
+
properties: Record<string, PropSchema>;
|
|
128
|
+
}>): unknown;
|
|
129
|
+
/** A node's props resolved along its component's schema (an unknown
|
|
130
|
+
* component's props resolve at any depth). */
|
|
131
|
+
export declare function resolveNodeProps(def: ComponentDef | undefined, props: Record<string, unknown>, data: unknown, options?: ResolveOptions, defs?: Record<string, {
|
|
132
|
+
properties: Record<string, PropSchema>;
|
|
133
|
+
}>): Record<string, unknown>;
|
|
134
|
+
/** True when the component's slots are ROW-SCOPED (catalog `slotScope:
|
|
135
|
+
* "row"`, Table): each slot is a cell template the painter binds once per
|
|
136
|
+
* row (`bindRowSlot`), never against the surface. */
|
|
137
|
+
export declare function hasRowSlots(def: ComponentDef | undefined): boolean;
|
|
138
|
+
/** The scope row `index` of a row-scoped component binds its slot cells in.
|
|
139
|
+
* `rowsProp` = the UNBOUND `rows` value: a binding → `{base: <its pointer>/
|
|
140
|
+
* <index>}` (relative paths read the row in the data model and `set` writes
|
|
141
|
+
* into it); a literal or a call → `{item: rows[index]}` (relative paths read
|
|
142
|
+
* inside the row; a relative `set` writes nothing). `index` = the row's index
|
|
143
|
+
* in `rows` as given, before any local sort. */
|
|
144
|
+
export declare function rowScope(rowsProp: unknown, rows: readonly unknown[], index: number, scope?: DataScope): DataScope;
|
|
145
|
+
/** A row-scoped slot cell bound for row `index` (see `rowScope`). */
|
|
146
|
+
export declare function bindRowSlot(slot: UiNode, rowsProp: unknown, rows: readonly unknown[], index: number, data: unknown, options?: ResolveOptions): UiNode | null;
|
|
147
|
+
/** Round 2 (docs/round-2-contract.md §4): the scope a List's `section`
|
|
148
|
+
* header binds in — a LITERAL item `{value, count, index}` (relative paths
|
|
149
|
+
* read it: `{path: "value"}`; absolute ones the surface data). */
|
|
150
|
+
export declare function sectionScope(section: {
|
|
151
|
+
value: string;
|
|
152
|
+
count: number;
|
|
153
|
+
}, index: number, scope?: DataScope): DataScope;
|
|
154
|
+
/** A List `section` header bound for section `index` (see `sectionScope`). */
|
|
155
|
+
export declare function bindSectionHeader(slot: UiNode, section: {
|
|
156
|
+
value: string;
|
|
157
|
+
count: number;
|
|
158
|
+
}, index: number, data: unknown, options?: ResolveOptions): UiNode | null;
|
|
159
|
+
export declare function bindTree(node: UiNode, data: unknown, options?: ResolveOptions): UiNode | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describeCatalog } from "../catalog.described.js";
|
|
2
|
+
import { CHARS_PER_TOKEN, COMMON_PROPS, DEFAULT_SECTIONS, PROMPT_RULES, PROMPT_SECTIONS, catalogIndex as bareCatalogIndex, componentPrompt as bareComponentPrompt, estimateTokens } from "../prompt.js";
|
|
3
|
+
import type { PromptOptions, PromptSection } from "../prompt.js";
|
|
4
|
+
export { CHARS_PER_TOKEN, COMMON_PROPS, DEFAULT_SECTIONS, PROMPT_RULES, PROMPT_SECTIONS, describeCatalog, estimateTokens };
|
|
5
|
+
export type { PromptOptions, PromptSection };
|
|
6
|
+
/** The catalog prompt (src/prompt.ts `catalogPrompt`) over the described catalog. */
|
|
7
|
+
export declare function catalogPrompt(options?: PromptOptions): string;
|
|
8
|
+
/** One component's prompt section (VAPP-108, the on-demand per-component prompt) over the described catalog. */
|
|
9
|
+
export declare function componentPrompt(name: string, options?: Parameters<typeof bareComponentPrompt>[1]): string;
|
|
10
|
+
/** The one-line-per-component index (VAPP-108) over the described catalog. */
|
|
11
|
+
export declare function catalogIndex(options?: Parameters<typeof bareCatalogIndex>[0]): string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { describeCatalog } from "../catalog.described.js";
|
|
2
|
+
import { coreSchema as bareCoreSchema, extensionSchema as bareExtensionSchema } from "../schema.js";
|
|
3
|
+
import type { ExtensionDef } from "../types.js";
|
|
4
|
+
export { describeCatalog };
|
|
5
|
+
/** The core catalog as JSON Schema (src/schema.ts `coreSchema`), descriptions included. */
|
|
6
|
+
export declare function coreSchema(iconNames: readonly string[]): ReturnType<typeof bareCoreSchema>;
|
|
7
|
+
/** An extension's schema (src/schema.ts `extensionSchema`), descriptions included. */
|
|
8
|
+
export declare function extensionSchema(ext: ExtensionDef, iconNames: readonly string[]): ReturnType<typeof bareExtensionSchema>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface ExprContext {
|
|
2
|
+
id: string;
|
|
3
|
+
props: Record<string, unknown>;
|
|
4
|
+
vars: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
/** An A2UI data binding: an object with exactly one key, `path`. */
|
|
7
|
+
export interface DataBinding {
|
|
8
|
+
path: string;
|
|
9
|
+
}
|
|
10
|
+
/** An A2UI function call. */
|
|
11
|
+
export interface FunctionCall {
|
|
12
|
+
call: string;
|
|
13
|
+
args?: Record<string, unknown>;
|
|
14
|
+
returnType?: string;
|
|
15
|
+
}
|
|
16
|
+
export type Dynamic = DataBinding | FunctionCall;
|
|
17
|
+
export declare function isBinding(value: unknown): value is DataBinding;
|
|
18
|
+
export declare function isCall(value: unknown): value is FunctionCall;
|
|
19
|
+
/** A value the expander cannot evaluate: the renderer will. */
|
|
20
|
+
export declare function isDynamic(value: unknown): value is Dynamic;
|
|
21
|
+
/** `undefined`, `null`, `false` and `""` are false; 0 is TRUE (a count of
|
|
22
|
+
* zero still shows). */
|
|
23
|
+
export declare function truthy(value: unknown): boolean;
|
|
24
|
+
/** `eq` (and `$eq`): strict equality, except that a NUMBER and a string
|
|
25
|
+
* spelling that number are equal (`5` vs `"5"`: form and URL state arrive as
|
|
26
|
+
* strings). Nothing else coerces (`0` vs `""`, `1` vs `true` differ). */
|
|
27
|
+
export declare function valuesEqual(a: unknown, b: unknown): boolean;
|
|
28
|
+
/** `clamp`: the value as a number held inside [min, max]; a missing bound
|
|
29
|
+
* (undefined or null) does not clamp; `min` wins when max < min. */
|
|
30
|
+
export declare function clampNumber(value: unknown, min: unknown, max: unknown): number;
|
|
31
|
+
/** `fill`: the template (already resolved through the string table) with its
|
|
32
|
+
* `{name}` placeholders filled from params (strings.ts formatString). */
|
|
33
|
+
export declare function fillTemplate(template: unknown, params: unknown): string;
|
|
34
|
+
/** The most indexes `range(n)` yields (R8 F51): a Rating's `max` of 1e8 or
|
|
35
|
+
* 1e300 would otherwise allocate that many items before the component
|
|
36
|
+
* budget could refuse them. Equals `maxTemplateItems`; a larger `n` is
|
|
37
|
+
* silently clamped (the reducer's `maxComponents` reports the overflow).
|
|
38
|
+
* Mirrors `MAX_RANGE_ITEMS` in the Rust core's `expr.rs`. */
|
|
39
|
+
export declare const MAX_RANGE_ITEMS = 10000;
|
|
40
|
+
/** One expression: `len(path)`, `range(n)`, `path|fallback`, `!path`, `path`.
|
|
41
|
+
* The function forms wrap the whole expression and are tried first, so a
|
|
42
|
+
* fallback inside their parentheses stays theirs. */
|
|
43
|
+
export declare function evalExpr(expr: string, ctx: ExprContext): unknown;
|
|
44
|
+
/** A condition: a string expression or a value object ($eq …). `true` or
|
|
45
|
+
* `false` when it can be decided now; the dynamic value when it cannot. */
|
|
46
|
+
export declare function evalConditionValue(cond: unknown, ctx: ExprContext): boolean | Dynamic;
|
|
47
|
+
/** A condition decided NOW: a dynamic condition counts as true (the part
|
|
48
|
+
* exists; `visible` carries the bound test, see macros.ts). */
|
|
49
|
+
export declare function evalCondition(cond: unknown, ctx: ExprContext): boolean;
|
|
50
|
+
/** Any template value: strings interpolate, arrays and objects recurse, the
|
|
51
|
+
* `$`-objects compute (or emit a call when an input is dynamic). `undefined`
|
|
52
|
+
* results are dropped by the caller. */
|
|
53
|
+
export declare function evalValue(value: unknown, ctx: ExprContext): unknown;
|
|
54
|
+
/** `$percent`'s arithmetic, shared with the core `percent` function: the
|
|
55
|
+
* share of `max` as "N%", clamped to 0..100, two decimals. */
|
|
56
|
+
export declare function percent(value: unknown, max: unknown): string;
|
|
57
|
+
/** Round 4 (VAPP-103) `filter`: the items of an array that match, in order,
|
|
58
|
+
* so a List or Table binds to a filtered view without an agent round trip.
|
|
59
|
+
* `where` = field → value, every entry must hold (`eq` equality); an entry
|
|
60
|
+
* whose value is missing, null or "" does NOT constrain (a bound "all"
|
|
61
|
+
* choice). `query` = a case-insensitive substring of ANY of `fields` (the
|
|
62
|
+
* item's own string and number values when `fields` is absent; a string or
|
|
63
|
+
* number item matches itself); a missing, null or blank query does not
|
|
64
|
+
* constrain. Not an array → []. */
|
|
65
|
+
export declare function filterItems(items: unknown, query: unknown, fields: unknown, where: unknown): unknown[];
|
|
66
|
+
/** The core value functions (core.catalog.json `functions.core`; `set` is
|
|
67
|
+
* an action, src/dynamic.ts runAction) as the renderer
|
|
68
|
+
* evaluates them once the arguments are resolved: the reference every
|
|
69
|
+
* client function table mirrors. `undefined` = no value. */
|
|
70
|
+
export declare const CORE_FUNCTIONS: Record<string, (args: Record<string, unknown>) => unknown>;
|
|
71
|
+
export declare const CORE_FUNCTION_NAMES: readonly string[];
|