@almadar/ui 5.121.3 → 5.122.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.
@@ -257,6 +257,18 @@ declare namespace OrbitalProvider {
257
257
  * path's codegen wraps each trait view with the same provider so both
258
258
  * paths share the qualification contract.
259
259
  *
260
+ * ## Embedded-trait emit bubbling (R-EMBEDDED-EMIT-BUBBLE)
261
+ *
262
+ * Providers NEST: when a trait's `render-ui` embeds another trait
263
+ * (`@trait.X` / inline `<External.Trait …/>`), the embedded view is
264
+ * rendered inside the host's subtree AND wraps itself in its own
265
+ * provider. The context therefore carries the full scope CHAIN
266
+ * (innermost-first), not a single scope. `useEventBus` fans every
267
+ * `UI:*` emit out to each scope on the chain so the host trait's
268
+ * subscribers hear emits from the embedded trait — a button authored
269
+ * as `<UiButton.traits.ButtonRender action={CREATE}/>` inside a host
270
+ * dispatches on the host's qualified key, not only the hoisted atom's.
271
+ *
260
272
  * @packageDocumentation
261
273
  */
262
274
 
@@ -266,6 +278,13 @@ interface TraitScope {
266
278
  /** Trait name within the orbital (e.g. `"ContactBrowse"`). */
267
279
  trait: string;
268
280
  }
281
+ /**
282
+ * Scope chain, innermost-first. `chain[0]` is the trait whose subtree
283
+ * the caller renders inside; `chain[1..]` are its host ancestors (the
284
+ * traits whose `render-ui` embedded it, outermost last). An empty
285
+ * chain means the caller is outside any `TraitScopeProvider`.
286
+ */
287
+ type TraitScopeChain = readonly TraitScope[];
269
288
  interface TraitScopeProviderProps {
270
289
  orbital: string;
271
290
  trait: string;
@@ -275,12 +294,22 @@ interface TraitScopeProviderProps {
275
294
  * Wrap a trait's rendered subtree to qualify bare `UI:*` emits with the
276
295
  * trait's scope. Mount this at the slot-content boundary in runtime
277
296
  * mode (UISlotRenderer) and at each generated trait view's outermost
278
- * element in compiled mode (orbital-shell-typescript codegen).
297
+ * element in compiled mode (orbital-shell-typescript codegen). Nesting
298
+ * is preserved: a provider prepends itself to the parent chain so
299
+ * embedded-trait emits can bubble to their host.
279
300
  */
280
301
  declare function TraitScopeProvider({ orbital, trait, children, }: TraitScopeProviderProps): React__default.ReactElement;
281
302
  /**
282
- * Read the current trait scope. Returns `null` when called outside
283
- * any `TraitScopeProvider` (e.g. Storybook, design-system catalog).
303
+ * Read the full trait-scope chain, innermost-first. Empty when called
304
+ * outside any `TraitScopeProvider` (e.g. Storybook, design-system
305
+ * catalog). `useEventBus` uses this to fan embedded-trait emits out to
306
+ * every host ancestor.
307
+ */
308
+ declare function useTraitScopeChain(): TraitScopeChain;
309
+ /**
310
+ * Read the innermost (nearest) trait scope. Returns `null` when called
311
+ * outside any `TraitScopeProvider`. Kept for callers that only need the
312
+ * immediate scope.
284
313
  */
285
314
  declare function useTraitScope(): TraitScope | null;
286
315
 
@@ -425,4 +454,4 @@ declare function useOfflineMode(): OfflineModeContextValue;
425
454
  */
426
455
  declare function useOptionalOfflineMode(): OfflineModeContextValue | null;
427
456
 
428
- export { EventBusContext, EventBusProvider, type OfflineModeContextValue, OfflineModeProvider, type OfflineModeProviderProps, OrbitalProvider, type OrbitalProviderProps, SelectionContext, type SelectionContextType, SelectionProvider, type TraitScope, TraitScopeProvider, type TraitScopeProviderProps, UIThemeDefinition, VerificationProvider, type VerificationProviderProps, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional, useTraitScope };
457
+ export { EventBusContext, EventBusProvider, type OfflineModeContextValue, OfflineModeProvider, type OfflineModeProviderProps, OrbitalProvider, type OrbitalProviderProps, SelectionContext, type SelectionContextType, SelectionProvider, type TraitScope, TraitScopeProvider, type TraitScopeProviderProps, UIThemeDefinition, VerificationProvider, type VerificationProviderProps, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional, useTraitScope, useTraitScopeChain };
@@ -257,6 +257,18 @@ declare namespace OrbitalProvider {
257
257
  * path's codegen wraps each trait view with the same provider so both
258
258
  * paths share the qualification contract.
259
259
  *
260
+ * ## Embedded-trait emit bubbling (R-EMBEDDED-EMIT-BUBBLE)
261
+ *
262
+ * Providers NEST: when a trait's `render-ui` embeds another trait
263
+ * (`@trait.X` / inline `<External.Trait …/>`), the embedded view is
264
+ * rendered inside the host's subtree AND wraps itself in its own
265
+ * provider. The context therefore carries the full scope CHAIN
266
+ * (innermost-first), not a single scope. `useEventBus` fans every
267
+ * `UI:*` emit out to each scope on the chain so the host trait's
268
+ * subscribers hear emits from the embedded trait — a button authored
269
+ * as `<UiButton.traits.ButtonRender action={CREATE}/>` inside a host
270
+ * dispatches on the host's qualified key, not only the hoisted atom's.
271
+ *
260
272
  * @packageDocumentation
261
273
  */
262
274
 
@@ -266,6 +278,13 @@ interface TraitScope {
266
278
  /** Trait name within the orbital (e.g. `"ContactBrowse"`). */
267
279
  trait: string;
268
280
  }
281
+ /**
282
+ * Scope chain, innermost-first. `chain[0]` is the trait whose subtree
283
+ * the caller renders inside; `chain[1..]` are its host ancestors (the
284
+ * traits whose `render-ui` embedded it, outermost last). An empty
285
+ * chain means the caller is outside any `TraitScopeProvider`.
286
+ */
287
+ type TraitScopeChain = readonly TraitScope[];
269
288
  interface TraitScopeProviderProps {
270
289
  orbital: string;
271
290
  trait: string;
@@ -275,12 +294,22 @@ interface TraitScopeProviderProps {
275
294
  * Wrap a trait's rendered subtree to qualify bare `UI:*` emits with the
276
295
  * trait's scope. Mount this at the slot-content boundary in runtime
277
296
  * mode (UISlotRenderer) and at each generated trait view's outermost
278
- * element in compiled mode (orbital-shell-typescript codegen).
297
+ * element in compiled mode (orbital-shell-typescript codegen). Nesting
298
+ * is preserved: a provider prepends itself to the parent chain so
299
+ * embedded-trait emits can bubble to their host.
279
300
  */
280
301
  declare function TraitScopeProvider({ orbital, trait, children, }: TraitScopeProviderProps): React__default.ReactElement;
281
302
  /**
282
- * Read the current trait scope. Returns `null` when called outside
283
- * any `TraitScopeProvider` (e.g. Storybook, design-system catalog).
303
+ * Read the full trait-scope chain, innermost-first. Empty when called
304
+ * outside any `TraitScopeProvider` (e.g. Storybook, design-system
305
+ * catalog). `useEventBus` uses this to fan embedded-trait emits out to
306
+ * every host ancestor.
307
+ */
308
+ declare function useTraitScopeChain(): TraitScopeChain;
309
+ /**
310
+ * Read the innermost (nearest) trait scope. Returns `null` when called
311
+ * outside any `TraitScopeProvider`. Kept for callers that only need the
312
+ * immediate scope.
284
313
  */
285
314
  declare function useTraitScope(): TraitScope | null;
286
315
 
@@ -425,4 +454,4 @@ declare function useOfflineMode(): OfflineModeContextValue;
425
454
  */
426
455
  declare function useOptionalOfflineMode(): OfflineModeContextValue | null;
427
456
 
428
- export { EventBusContext, EventBusProvider, type OfflineModeContextValue, OfflineModeProvider, type OfflineModeProviderProps, OrbitalProvider, type OrbitalProviderProps, SelectionContext, type SelectionContextType, SelectionProvider, type TraitScope, TraitScopeProvider, type TraitScopeProviderProps, UIThemeDefinition, VerificationProvider, type VerificationProviderProps, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional, useTraitScope };
457
+ export { EventBusContext, EventBusProvider, type OfflineModeContextValue, OfflineModeProvider, type OfflineModeProviderProps, OrbitalProvider, type OrbitalProviderProps, SelectionContext, type SelectionContextType, SelectionProvider, type TraitScope, TraitScopeProvider, type TraitScopeProviderProps, UIThemeDefinition, VerificationProvider, type VerificationProviderProps, useOfflineMode, useOptionalOfflineMode, useSelection, useSelectionOptional, useTraitScope, useTraitScopeChain };