@almadar/ui 2.57.0 → 2.59.1

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.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Trait-binding resolver for the interpreted runtime path.
3
+ *
4
+ * When a pattern tree contains a string like `"@trait.ItemSearch"` or
5
+ * `"@trait.ItemSearch.main"` inside a `children:` array (or a
6
+ * `node`-typed prop), the `SlotContentRenderer` walker calls this
7
+ * resolver to transform those string leaves into `<TraitFrame>` React
8
+ * elements before rendering.
9
+ *
10
+ * This module only handles the INTERPRETED path — compiled apps bake
11
+ * `<TraitFrame>` into JSX at build time via the TypeScript shell
12
+ * codegen (`orbital-shell-typescript/src/backend.rs`). Both paths land
13
+ * on the same component.
14
+ *
15
+ * Scope:
16
+ * - string values `"@trait.X[.slot]"` are replaced with
17
+ * `<TraitFrame traitName="X" slot={...} />`.
18
+ * - strings that don't match the `@trait.*` shape pass through
19
+ * verbatim (they may be `@entity.X` bindings resolved elsewhere,
20
+ * or plain text content).
21
+ * - recurses into arrays and objects so nested children are covered.
22
+ *
23
+ * @see docs/Almadar_Std_Gaps.md §3.8
24
+ */
25
+ export interface ResolveTraitBindingsContext {
26
+ /**
27
+ * Depth cap — the walker refuses to descend deeper than this to
28
+ * protect against deeply nested patterns (real or adversarial).
29
+ * Default 8; roughly matches the deepest layout trees seen in the
30
+ * std catalog plus head-room.
31
+ */
32
+ depth?: number;
33
+ }
34
+ /**
35
+ * Walk a pattern-tree value, returning a structurally-identical tree
36
+ * with `@trait.*` string leaves replaced by `<TraitFrame>` React
37
+ * elements.
38
+ *
39
+ * The walker preserves insertion order of object keys and array
40
+ * positions — it only transforms the narrow subset of string values
41
+ * that match the `@trait.X[.slot]` form. Other strings are copied as-is.
42
+ *
43
+ * Call from `SlotContentRenderer` once per render, pointed at
44
+ * `content.props` with `currentSlot` bound to the slot whose render-ui
45
+ * is being composed.
46
+ */
47
+ export declare function resolveTraitBindingsInPattern(value: unknown, ctx: ResolveTraitBindingsContext): unknown;
48
+ /**
49
+ * Lower-level helper: is this string a `@trait.*` binding the resolver
50
+ * would handle? Useful for consumers that need to treat the trait case
51
+ * specially before handing the string back to the walker.
52
+ */
53
+ export declare function isTraitBinding(value: unknown): value is string;