@wirestate/lit 0.6.1 → 0.7.0-experimental.2

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/README.md +88 -70
  3. package/cjs/development/index.js +412 -320
  4. package/cjs/development/index.js.map +1 -1
  5. package/cjs/production/index.js +1 -1
  6. package/cjs/production/index.js.map +1 -1
  7. package/esm/development/commands/on-command-controller.js +8 -7
  8. package/esm/development/commands/on-command-controller.js.map +1 -1
  9. package/esm/development/commands/on-command.js +7 -6
  10. package/esm/development/commands/on-command.js.map +1 -1
  11. package/esm/development/commands/use-on-command.js +7 -7
  12. package/esm/development/consumption/injection.js +8 -8
  13. package/esm/development/consumption/injection.js.map +1 -1
  14. package/esm/development/consumption/use-container.js +40 -0
  15. package/esm/development/consumption/use-container.js.map +1 -0
  16. package/esm/development/consumption/use-injection.js +8 -8
  17. package/esm/development/consumption/use-injection.js.map +1 -1
  18. package/esm/development/consumption/use-scope.js +44 -0
  19. package/esm/development/consumption/use-scope.js.map +1 -0
  20. package/esm/development/context/container-context.js +17 -0
  21. package/esm/development/context/container-context.js.map +1 -0
  22. package/esm/development/events/on-event-controller.js +11 -9
  23. package/esm/development/events/on-event-controller.js.map +1 -1
  24. package/esm/development/events/on-event.js +11 -8
  25. package/esm/development/events/on-event.js.map +1 -1
  26. package/esm/development/events/use-on-events.js +8 -8
  27. package/esm/development/index.js +9 -7
  28. package/esm/development/index.js.map +1 -1
  29. package/esm/development/provision/container-provide.js +68 -0
  30. package/esm/development/provision/container-provide.js.map +1 -0
  31. package/esm/development/provision/container-provider.js +74 -0
  32. package/esm/development/provision/container-provider.js.map +1 -0
  33. package/esm/development/provision/sub-container-provide.js +56 -0
  34. package/esm/development/provision/sub-container-provide.js.map +1 -0
  35. package/esm/development/provision/sub-container-provider.js +93 -0
  36. package/esm/development/provision/sub-container-provider.js.map +1 -0
  37. package/esm/development/provision/use-container-provision.js +44 -0
  38. package/esm/development/provision/use-container-provision.js.map +1 -0
  39. package/esm/development/provision/use-sub-container-provider.js +34 -0
  40. package/esm/development/provision/use-sub-container-provider.js.map +1 -0
  41. package/esm/development/queries/on-query-controller.js +9 -8
  42. package/esm/development/queries/on-query-controller.js.map +1 -1
  43. package/esm/development/queries/on-query.js +7 -6
  44. package/esm/development/queries/on-query.js.map +1 -1
  45. package/esm/development/queries/use-on-query.js +7 -7
  46. package/esm/production/commands/on-command-controller.js +1 -1
  47. package/esm/production/commands/on-command-controller.js.map +1 -1
  48. package/esm/production/commands/on-command.js.map +1 -1
  49. package/esm/production/consumption/injection.js +1 -1
  50. package/esm/production/consumption/injection.js.map +1 -1
  51. package/esm/production/consumption/use-container.js +1 -0
  52. package/esm/production/consumption/use-container.js.map +1 -0
  53. package/esm/production/consumption/use-injection.js +1 -1
  54. package/esm/production/consumption/use-injection.js.map +1 -1
  55. package/esm/production/consumption/use-scope.js +1 -0
  56. package/esm/production/consumption/use-scope.js.map +1 -0
  57. package/esm/production/context/container-context.js +1 -0
  58. package/esm/production/context/container-context.js.map +1 -0
  59. package/esm/production/events/on-event-controller.js +1 -1
  60. package/esm/production/events/on-event-controller.js.map +1 -1
  61. package/esm/production/events/on-event.js.map +1 -1
  62. package/esm/production/index.js +1 -1
  63. package/esm/production/provision/container-provide.js +1 -0
  64. package/esm/production/provision/container-provide.js.map +1 -0
  65. package/esm/production/provision/container-provider.js +1 -0
  66. package/esm/production/provision/container-provider.js.map +1 -0
  67. package/esm/production/provision/sub-container-provide.js +1 -0
  68. package/esm/production/provision/sub-container-provide.js.map +1 -0
  69. package/esm/production/provision/sub-container-provider.js +1 -0
  70. package/esm/production/provision/sub-container-provider.js.map +1 -0
  71. package/esm/production/provision/use-container-provision.js +1 -0
  72. package/esm/production/provision/use-container-provision.js.map +1 -0
  73. package/esm/production/provision/use-sub-container-provider.js +1 -0
  74. package/esm/production/provision/use-sub-container-provider.js.map +1 -0
  75. package/esm/production/queries/on-query-controller.js +1 -1
  76. package/esm/production/queries/on-query-controller.js.map +1 -1
  77. package/esm/production/queries/on-query.js.map +1 -1
  78. package/index.d.ts +413 -291
  79. package/package.json +2 -2
  80. package/esm/development/context/ioc-context.js +0 -17
  81. package/esm/development/context/ioc-context.js.map +0 -1
  82. package/esm/development/provision/injectables-provide.js +0 -47
  83. package/esm/development/provision/injectables-provide.js.map +0 -1
  84. package/esm/development/provision/injectables-provider-controller.js +0 -123
  85. package/esm/development/provision/injectables-provider-controller.js.map +0 -1
  86. package/esm/development/provision/ioc-provide.js +0 -55
  87. package/esm/development/provision/ioc-provide.js.map +0 -1
  88. package/esm/development/provision/ioc-provider-controller.js +0 -72
  89. package/esm/development/provision/ioc-provider-controller.js.map +0 -1
  90. package/esm/development/provision/use-injectables-provider.js +0 -33
  91. package/esm/development/provision/use-injectables-provider.js.map +0 -1
  92. package/esm/development/provision/use-ioc-provision.js +0 -29
  93. package/esm/development/provision/use-ioc-provision.js.map +0 -1
  94. package/esm/production/context/ioc-context.js +0 -1
  95. package/esm/production/context/ioc-context.js.map +0 -1
  96. package/esm/production/provision/injectables-provide.js +0 -1
  97. package/esm/production/provision/injectables-provide.js.map +0 -1
  98. package/esm/production/provision/injectables-provider-controller.js +0 -1
  99. package/esm/production/provision/injectables-provider-controller.js.map +0 -1
  100. package/esm/production/provision/ioc-provide.js +0 -1
  101. package/esm/production/provision/ioc-provide.js.map +0 -1
  102. package/esm/production/provision/ioc-provider-controller.js +0 -1
  103. package/esm/production/provision/ioc-provider-controller.js.map +0 -1
  104. package/esm/production/provision/use-injectables-provider.js +0 -1
  105. package/esm/production/provision/use-injectables-provider.js.map +0 -1
  106. package/esm/production/provision/use-ioc-provision.js +0 -1
  107. package/esm/production/provision/use-ioc-provision.js.map +0 -1
package/index.d.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  import { ReactiveElement, ReactiveControllerHost, ReactiveController } from '@lit/reactive-element';
2
- import { ServiceIdentifier, CommandType, CommandHandler, Event, EventType, EventHandler, QueryType, QueryHandler, Container, Newable, InjectableDescriptor, SeedEntries } from '@wirestate/core';
2
+ import { ServiceIdentifier, Container as Container$1, WireScope, CommandType, CommandHandler, Event, EventType, EventHandler, QueryType, QueryHandler, CreateContainerOptions, Newable, InjectableDescriptor, SeedEntries } from '@wirestate/core';
3
3
  import { ContextProvider, ContextConsumer } from '@lit/context';
4
4
 
5
5
  /**
6
- * Represents any object with string or symbol keys.
6
+ * Type that can be null.
7
7
  *
8
- * @group types
8
+ * @group Types
9
9
  */
10
- type AnyObject = Record<string | symbol, any>;
10
+ type Optional<T> = T | null;
11
11
  /**
12
- * Represents a type that can be null.
12
+ * Value or a promise of that value.
13
13
  *
14
- * @group types
14
+ * @group Types
15
15
  */
16
- type Optional<T> = T | null;
16
+ type MaybePromise<T> = T | Promise<T>;
17
17
  /**
18
- * Represents a type that can be a value or a promise of that value.
18
+ * Value that can be null or undefined.
19
19
  *
20
- * @group types
20
+ * @group Types
21
21
  */
22
- type MaybePromise<T> = T | Promise<T>;
22
+ type Maybe<T> = T | null | undefined;
23
23
  /**
24
24
  * Helper to extract the interface of a type.
25
25
  *
26
- * @group types
26
+ * @group Types
27
27
  */
28
28
  type Interface<T> = {
29
29
  [K in keyof T]: T[K];
@@ -31,13 +31,13 @@ type Interface<T> = {
31
31
  /**
32
32
  * Return type for decorators.
33
33
  *
34
- * @group types
34
+ * @group Types
35
35
  */
36
36
  type DecoratorReturn = void | any;
37
37
  /**
38
- * Type helper to ensure that a decorated field matches the type being provided.
38
+ * Ensures that a decorated field matches the type being provided.
39
39
  *
40
- * @group types
40
+ * @group Types
41
41
  */
42
42
  type FieldMustMatchProvidedType<Obj, Key extends PropertyKey, ProvidedType> = Obj extends Record<Key, infer ConsumingType> ? [ProvidedType] extends [ConsumingType] ? DecoratorReturn : {
43
43
  message: "provided type not assignable to consuming field";
@@ -50,39 +50,43 @@ type FieldMustMatchProvidedType<Obj, Key extends PropertyKey, ProvidedType> = Ob
50
50
  } : DecoratorReturn;
51
51
 
52
52
  /**
53
- * Type definition for the injection decorator.
53
+ * Represents definition of the injection decorator.
54
+ *
55
+ * @remarks
56
+ * Supports both TC39 and legacy experimental decorators.
54
57
  *
55
- * @group consumption
58
+ * @group Consumption
56
59
  */
57
60
  interface InjectionDecorator<T> {
58
61
  <C extends Interface<Omit<ReactiveElement, "renderRoot">>, V extends T>(value: ClassAccessorDecoratorTarget<C, V>, context: ClassAccessorDecoratorContext<C, V>): void;
59
62
  <K extends PropertyKey, Proto extends Interface<Omit<ReactiveElement, "renderRoot">>>(protoOrDescriptor: Proto, name?: K): FieldMustMatchProvidedType<Proto, K, T>;
60
63
  }
61
64
  /**
62
- * Options for the {@link injection} decorator.
65
+ * Represents options for the {@link injection} decorator.
63
66
  *
64
- * @group consumption
67
+ * @group Consumption
65
68
  */
66
69
  interface InjectionOptions<T> {
67
70
  /**
68
- * The service identifier to inject from the IoC container.
71
+ * The service identifier to inject.
69
72
  */
70
73
  injectionId: ServiceIdentifier<T>;
71
74
  /**
72
- * Whether to subscribe to changes in the context.
75
+ * Whether to subscribe to container changes.
73
76
  *
77
+ * @remarks
74
78
  * If true, the property will be updated if the container in the context changes.
75
- * False by default.
79
+ * Defaults to false.
76
80
  */
77
81
  once?: boolean;
78
82
  }
79
83
  /**
80
84
  * Decorator to inject a service from the IoC container into a Lit element property.
81
85
  *
82
- * @group consumption
86
+ * @group Consumption
83
87
  *
84
- * @param optionsOrInjectionId - injection options including the service identifier or the service identifier itself
85
- * @returns injection decorator instance
88
+ * @param optionsOrInjectionId - Injection options or service identifier.
89
+ * @returns An instance of {@link InjectionDecorator}.
86
90
  *
87
91
  * @example
88
92
  * ```typescript
@@ -111,18 +115,56 @@ interface InjectionOptions<T> {
111
115
  declare function injection<T>(optionsOrInjectionId: InjectionOptions<T> | ServiceIdentifier<T>): InjectionDecorator<T>;
112
116
 
113
117
  /**
114
- * Options for the {@link useInjection} hook.
118
+ * Represents result of the {@link useContainer} hook.
119
+ *
120
+ * @group Consumption
121
+ */
122
+ interface UseContainerValue {
123
+ /**
124
+ * The active container from the nearest parent context.
125
+ */
126
+ value: Container$1;
127
+ }
128
+ /**
129
+ * Hook (consumer) to access the active container from the nearest parent context.
130
+ *
131
+ * @remarks
132
+ * The returned value updates when the nearest provided container changes.
133
+ *
134
+ * @group Consumption
135
+ *
136
+ * @param host - The host element.
137
+ * @returns An instance of {@link UseContainerValue}.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * class MyElement extends LitElement {
142
+ * private container: UseContainerValue = useContainer(this);
143
+ *
144
+ * public render() {
145
+ * return html`<div>${this.container.value.isBound(MyService)}</div>`;
146
+ * }
147
+ * }
148
+ * ```
149
+ */
150
+ declare function useContainer<E extends ReactiveControllerHost & HTMLElement>(host: E): UseContainerValue;
151
+
152
+ /**
153
+ * Represents options for the {@link useInjection} hook.
115
154
  *
116
- * @group consumption
155
+ * @group Consumption
117
156
  */
118
157
  interface UseInjectionOptions<T> {
119
158
  /**
159
+ * Whether to subscribe to container changes.
160
+ *
161
+ * @remarks
120
162
  * If true, the service will be fetched only once when the controller is created.
121
- * If false (default), it will update if the container in the context changes.
163
+ * Defaults to false.
122
164
  */
123
165
  once?: boolean;
124
166
  /**
125
- * Initial value for the injection before it's fetched from the container.
167
+ * Initial value before the service is fetched.
126
168
  */
127
169
  value?: Optional<T>;
128
170
  /**
@@ -131,9 +173,9 @@ interface UseInjectionOptions<T> {
131
173
  injectionId: ServiceIdentifier<T>;
132
174
  }
133
175
  /**
134
- * The return value of the {@link useInjection} hook, containing the injected service.
176
+ * Represents result of the {@link useInjection} hook.
135
177
  *
136
- * @group consumption
178
+ * @group Consumption
137
179
  */
138
180
  interface UseInjectionValue<T> {
139
181
  /**
@@ -146,13 +188,13 @@ interface UseInjectionValue<T> {
146
188
  value: T;
147
189
  }
148
190
  /**
149
- * Hook (controller) to inject a service from the IoC container in a Lit component.
191
+ * Hook (controller) to inject a service from the IoC container.
150
192
  *
151
- * @group consumption
193
+ * @group Consumption
152
194
  *
153
- * @param host - the host element
154
- * @param optionsOrInjectionId - injection options including the service identifier or the service identifier itself
155
- * @returns injection descriptor object
195
+ * @param host - The host element.
196
+ * @param optionsOrInjectionId - Injection options or service identifier.
197
+ * @returns An instance of {@link UseInjectionValue}.
156
198
  *
157
199
  * @example
158
200
  * ```typescript
@@ -179,31 +221,64 @@ interface UseInjectionValue<T> {
179
221
  declare function useInjection<T extends object, E extends ReactiveControllerHost & HTMLElement>(host: E, optionsOrInjectionId: UseInjectionOptions<T> | ServiceIdentifier<T>): UseInjectionValue<T>;
180
222
 
181
223
  /**
182
- * Interface for the {@link onCommand} decorator.
224
+ * Represents result of the {@link useScope} hook.
225
+ *
226
+ * @group Consumption
227
+ */
228
+ type UseScopeValue = UseInjectionValue<WireScope>;
229
+ /**
230
+ * Hook (consumer) to access the active {@link WireScope} from the nearest parent context.
231
+ *
232
+ * @remarks
233
+ * The returned value updates when the nearest provided container changes.
183
234
  *
184
- * Supports both standard (TC39) and legacy experimental decorators.
235
+ * @group Consumption
185
236
  *
186
- * @group commands
237
+ * @param host - The host element.
238
+ * @returns An instance of {@link UseScopeValue}.
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * class MyElement extends LitElement {
243
+ * private scope: UseScopeValue = useScope(this);
244
+ *
245
+ * public connectedCallback(): void {
246
+ * super.connectedCallback();
247
+ * this.scope.value.emitEvent("UI_READY");
248
+ * }
249
+ * }
250
+ * ```
251
+ */
252
+ declare function useScope<E extends ReactiveControllerHost & HTMLElement>(host: E): UseScopeValue;
253
+
254
+ /**
255
+ * Represents interface for the {@link onCommand} decorator.
256
+ *
257
+ * @remarks
258
+ * Supports both TC39 and legacy experimental decorators.
259
+ *
260
+ * @group Commands
187
261
  */
188
262
  interface OnCommandDecorator<D = unknown, R = unknown> {
189
263
  <This extends Interface<Omit<ReactiveElement, "renderRoot">>>(value: (this: This, data: D) => MaybePromise<R>, context: ClassMethodDecoratorContext<This>): void;
190
264
  (target: object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
191
265
  }
192
266
  /**
193
- * Decorator that registers a Lit element method as a command handler for the given type.
267
+ * Decorator for Lit element methods that handle a specific command.
194
268
  *
195
- * The handler is registered when the host element connects to the DOM and unregistered when it disconnects.
269
+ * @remarks
270
+ * The handler is registered when the host connects and unregistered when it disconnects.
196
271
  *
197
- * @group commands
272
+ * @group Commands
198
273
  *
199
- * @param type - the command type to handle
200
- * @returns the decorator function.
274
+ * @param type - Unique identifier of the command to handle.
275
+ * @returns A method decorator function.
201
276
  *
202
277
  * @example
203
278
  * ```typescript
204
279
  * class MyElement extends LitElement {
205
280
  * @onCommand("SAVE")
206
- * private handleSave(data: SomeData): void {
281
+ * private onSave(data: SomeData): void {
207
282
  * // handle command
208
283
  * }
209
284
  * }
@@ -212,12 +287,13 @@ interface OnCommandDecorator<D = unknown, R = unknown> {
212
287
  declare function onCommand<D = unknown, R = unknown>(type: CommandType): OnCommandDecorator<D, R>;
213
288
 
214
289
  /**
215
- * Reactive controller that registers a command handler on the {@link CommandBus} for the host element's lifetime.
290
+ * Controller that registers a command handler for the host element's lifetime.
216
291
  *
292
+ * @remarks
217
293
  * The handler is registered when the host connects and unregistered when it disconnects.
218
- * When the IoC context is updated (container revision change), the handler is re-registered automatically.
294
+ * It automatically re-registers if the IoC container is updated.
219
295
  *
220
- * @group commands
296
+ * @group Commands
221
297
  */
222
298
  declare class OnCommandController<D = unknown, R = unknown> implements ReactiveController {
223
299
  private bus;
@@ -226,7 +302,7 @@ declare class OnCommandController<D = unknown, R = unknown> implements ReactiveC
226
302
  private readonly handler;
227
303
  /**
228
304
  * @param host - The host element.
229
- * @param type - The command type to handle.
305
+ * @param type - Unique identifier of the command to handle.
230
306
  * @param handler - The command handler function.
231
307
  */
232
308
  constructor(host: ReactiveElement, type: CommandType, handler: CommandHandler<D, R>);
@@ -237,9 +313,9 @@ declare class OnCommandController<D = unknown, R = unknown> implements ReactiveC
237
313
  }
238
314
 
239
315
  /**
240
- * Options for the {@link useOnCommand} hook.
316
+ * Represents options for the {@link useOnCommand} hook.
241
317
  *
242
- * @group commands
318
+ * @group Commands
243
319
  */
244
320
  interface UseOnCommandOptions<D = unknown, R = unknown> {
245
321
  /**
@@ -252,15 +328,15 @@ interface UseOnCommandOptions<D = unknown, R = unknown> {
252
328
  handler: CommandHandler<D, R>;
253
329
  }
254
330
  /**
255
- * Registers a command handler on the CommandBus for the host element's lifetime.
331
+ * Hook that registers a command handler for the host element's lifetime.
256
332
  *
257
- * @group commands
333
+ * @group Commands
258
334
  *
259
- * @param host - the host element
260
- * @param options - command handling options
261
- * @param options.type - the command type to listen for
262
- * @param options.handler - the command handler function
263
- * @returns the command controller instance
335
+ * @param host - The host element.
336
+ * @param options - Command handling options.
337
+ * @param options.type - The command type to listen for.
338
+ * @param options.handler - The command handler function.
339
+ * @returns The command controller instance.
264
340
  *
265
341
  * @example
266
342
  * ```typescript
@@ -275,28 +351,34 @@ interface UseOnCommandOptions<D = unknown, R = unknown> {
275
351
  declare function useOnCommand<D = unknown, R = unknown>(host: ReactiveElement, { type, handler }: UseOnCommandOptions<D, R>): OnCommandController<D, R>;
276
352
 
277
353
  /**
278
- * Type definition for the on-event decorator.
354
+ * Represents type definition for the on-event decorator.
355
+ *
356
+ * @remarks
357
+ * Supports both TC39 and legacy experimental decorators.
279
358
  *
280
- * @group events
359
+ * @group Events
281
360
  */
282
361
  interface OnEventDecorator<E extends Event = Event> {
283
362
  <This extends Interface<Omit<ReactiveElement, "renderRoot">>>(value: (this: This, event: E) => void, context: ClassMethodDecoratorContext<This>): void;
284
363
  (target: object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
285
364
  }
286
365
  /**
287
- * Decorator to handle events from the event bus.
366
+ * Decorator for Lit element methods that handle events from the event bus.
288
367
  *
289
- * @group events
368
+ * @remarks
369
+ * The handler is registered when the host connects and unregistered when it disconnects.
370
+ *
371
+ * @group Events
290
372
  *
291
373
  * @param types - Event types to listen for. If omitted, all events will be handled.
292
- * @returns The decorator function.
374
+ * @returns A method decorator function.
293
375
  *
294
376
  * @example
295
377
  * ```typescript
296
378
  * class MyElement extends LitElement {
297
379
  * @onEvent()
298
380
  * private onMyEvent(event: Event) {
299
- * console.log('Event received:', event);
381
+ * console.log("Event received:", event);
300
382
  * }
301
383
  * }
302
384
  * ```
@@ -304,9 +386,9 @@ interface OnEventDecorator<E extends Event = Event> {
304
386
  * @example
305
387
  * ```typescript
306
388
  * class MyElement extends LitElement {
307
- * @onEvent('MY_EVENT_TYPE')
389
+ * @onEvent("MY_EVENT_TYPE")
308
390
  * private onMyEvent(event: MyEvent) {
309
- * console.log('Event received:', event);
391
+ * console.log("Event received:", event);
310
392
  * }
311
393
  * }
312
394
  * ```
@@ -314,9 +396,9 @@ interface OnEventDecorator<E extends Event = Event> {
314
396
  * @example
315
397
  * ```typescript
316
398
  * class MyElement extends LitElement {
317
- * @onEvent(['MY_EVENT_TYPE_1', 'MY_EVENT_TYPE_2'])
399
+ * @onEvent(["MY_EVENT_TYPE_1", "MY_EVENT_TYPE_2"])
318
400
  * private onMyEvent(event: Event) {
319
- * console.log('Event received:', event);
401
+ * console.log("Event received:", event);
320
402
  * }
321
403
  * }
322
404
  * ```
@@ -324,11 +406,13 @@ interface OnEventDecorator<E extends Event = Event> {
324
406
  declare function onEvent<E extends Event = Event>(types?: EventType | ReadonlyArray<EventType>): OnEventDecorator<E>;
325
407
 
326
408
  /**
327
- * Controller that subscribes to events from the event bus.
409
+ * Controller that subscribes to events for the host element's lifetime.
328
410
  *
329
- * It automatically handles subscription and unsubscription based on the host element's lifecycle.
411
+ * @remarks
412
+ * The handler is registered when the host connects and unregistered when it disconnects.
413
+ * It automatically re-subscribes if the IoC container is updated.
330
414
  *
331
- * @group events
415
+ * @group Events
332
416
  */
333
417
  declare class OnEventController<E extends Event = Event> implements ReactiveController {
334
418
  private bus;
@@ -336,9 +420,9 @@ declare class OnEventController<E extends Event = Event> implements ReactiveCont
336
420
  private readonly types;
337
421
  private readonly handler;
338
422
  /**
339
- * @param host - the host element
340
- * @param types - event types to listen for, if null, all events will be handled
341
- * @param handler - the event handler function
423
+ * @param host - The host element.
424
+ * @param types - Event types to listen for. If null, all events will be handled.
425
+ * @param handler - The event handler function.
342
426
  */
343
427
  constructor(host: ReactiveElement, types: Optional<ReadonlyArray<EventType>>, handler: EventHandler<E>);
344
428
  hostConnected(): void;
@@ -348,13 +432,13 @@ declare class OnEventController<E extends Event = Event> implements ReactiveCont
348
432
  }
349
433
 
350
434
  /**
351
- * Options for the {@link useOnEvents} hook.
435
+ * Represents options for the {@link useOnEvents} hook.
352
436
  *
353
- * @group events
437
+ * @group Events
354
438
  */
355
439
  interface UseOnEventsOptions<E extends Event = Event> {
356
440
  /**
357
- * Event handler function.
441
+ * The event handler function.
358
442
  */
359
443
  handler: EventHandler<E>;
360
444
  /**
@@ -363,15 +447,15 @@ interface UseOnEventsOptions<E extends Event = Event> {
363
447
  types?: Optional<EventType | ReadonlyArray<EventType>>;
364
448
  }
365
449
  /**
366
- * Hook (controller) to handle events from the event bus.
450
+ * Hook that subscribes to events for the host element's lifetime.
367
451
  *
368
- * @group events
452
+ * @group Events
369
453
  *
370
- * @param host - the host element
371
- * @param options - event handling options
372
- * @param options.handler - event handler function
373
- * @param options.types - event types to listen for, if null or undefined, all events will be handled
374
- * @returns events subscription controller
454
+ * @param host - The host element.
455
+ * @param options - Event handling options.
456
+ * @param options.handler - Event handler function.
457
+ * @param options.types - Event types to listen for, if null or undefined, all events will be handled.
458
+ * @returns An instance of {@link OnEventController}.
375
459
  *
376
460
  * @example
377
461
  * ```typescript
@@ -386,7 +470,7 @@ interface UseOnEventsOptions<E extends Event = Event> {
386
470
  * ```typescript
387
471
  * class MyElement extends LitElement {
388
472
  * private eventHandler = useOnEvents(this, {
389
- * types: [MyEvent],
473
+ * types: ["MY_EVENT"],
390
474
  * handler: (event) => console.log(event),
391
475
  * });
392
476
  * }
@@ -395,31 +479,33 @@ interface UseOnEventsOptions<E extends Event = Event> {
395
479
  declare function useOnEvents<E extends Event = Event>(host: ReactiveElement, { types, handler }: UseOnEventsOptions): OnEventController<E>;
396
480
 
397
481
  /**
398
- * Interface for the {@link onQuery} decorator.
482
+ * Represents interface for the {@link onQuery} decorator.
399
483
  *
400
- * Supports both standard (TC39) and legacy experimental decorators.
484
+ * @remarks
485
+ * Supports both TC39 and legacy experimental decorators.
401
486
  *
402
- * @group queries
487
+ * @group Queries
403
488
  */
404
489
  interface OnQueryDecorator<D = unknown, R = unknown> {
405
490
  <This extends Interface<Omit<ReactiveElement, "renderRoot">>>(value: (this: This, data: D) => MaybePromise<R>, context: ClassMethodDecoratorContext<This>): void;
406
491
  (target: object, propertyKey: string | symbol, descriptor: PropertyDescriptor): void;
407
492
  }
408
493
  /**
409
- * Decorator that registers a Lit element method as a query handler for the given type.
494
+ * Decorator for Lit element methods that handle a specific query.
410
495
  *
411
- * The handler is registered when the host element connects to the DOM and unregistered when it disconnects.
496
+ * @remarks
497
+ * The handler is registered when the host connects and unregistered when it disconnects.
412
498
  *
413
- * @group queries
499
+ * @group Queries
414
500
  *
415
- * @param type - the query type to handle
416
- * @returns the decorator function
501
+ * @param type - Unique identifier of the query to handle.
502
+ * @returns A method decorator function.
417
503
  *
418
504
  * @example
419
505
  * ```typescript
420
506
  * class MyElement extends LitElement {
421
507
  * @onQuery("GET_USER_NAME")
422
- * public onGetUserName(data: QueryData) {
508
+ * private onGetUserName(data: QueryData) {
423
509
  * return "Alice";
424
510
  * }
425
511
  * }
@@ -430,10 +516,11 @@ declare function onQuery<D = unknown, R = unknown>(type: QueryType): OnQueryDeco
430
516
  /**
431
517
  * Reactive controller that registers a query handler on the {@link QueryBus} for the host element's lifetime.
432
518
  *
519
+ * @remarks
433
520
  * The handler is registered when the host connects and unregistered when it disconnects.
434
- * When the IoC context is updated (container revision change), the handler is re-registered automatically.
521
+ * It automatically re-registers if the IoC container is updated.
435
522
  *
436
- * @group queries
523
+ * @group Queries
437
524
  */
438
525
  declare class OnQueryController<D = unknown, R = unknown> implements ReactiveController {
439
526
  private bus;
@@ -441,9 +528,9 @@ declare class OnQueryController<D = unknown, R = unknown> implements ReactiveCon
441
528
  private readonly type;
442
529
  private readonly handler;
443
530
  /**
444
- * @param host - the host element
445
- * @param type - the query type to handle
446
- * @param handler - the query handler function
531
+ * @param host - The host element.
532
+ * @param type - Unique identifier of the query to handle.
533
+ * @param handler - The query handler function.
447
534
  */
448
535
  constructor(host: ReactiveElement, type: QueryType, handler: QueryHandler<D, R>);
449
536
  hostConnected(): void;
@@ -453,9 +540,9 @@ declare class OnQueryController<D = unknown, R = unknown> implements ReactiveCon
453
540
  }
454
541
 
455
542
  /**
456
- * Options for the {@link useOnQuery} hook.
543
+ * Represents options for the {@link useOnQuery} hook.
457
544
  *
458
- * @group queries
545
+ * @group Queries
459
546
  */
460
547
  interface UseOnQueryOptions<D = unknown, R = unknown> {
461
548
  /**
@@ -468,15 +555,15 @@ interface UseOnQueryOptions<D = unknown, R = unknown> {
468
555
  handler: QueryHandler<D, R>;
469
556
  }
470
557
  /**
471
- * Registers a query handler on the {@link QueryBus} for the host element's lifetime.
558
+ * Hook that registers a query handler for the host element's lifetime.
472
559
  *
473
- * @group queries
560
+ * @group Queries
474
561
  *
475
- * @param host - the host element
476
- * @param options - query handling options
477
- * @param options.type - the query type to handle
478
- * @param options.handler - the query handler function
479
- * @returns the query controller instance
562
+ * @param host - The host element.
563
+ * @param options - Query handling options.
564
+ * @param options.type - The query type to handle.
565
+ * @param options.handler - The query handler function.
566
+ * @returns An instance of {@link OnQueryController}.
480
567
  *
481
568
  * @example
482
569
  * ```typescript
@@ -491,280 +578,315 @@ interface UseOnQueryOptions<D = unknown, R = unknown> {
491
578
  declare function useOnQuery<D = unknown, R = unknown>(host: ReactiveElement, { type, handler }: UseOnQueryOptions<D, R>): OnQueryController<D, R>;
492
579
 
493
580
  /**
494
- * Interface for the IoC context value.
495
- *
496
- * @group context
497
- */
498
- interface IocContext {
499
- /**
500
- * The Inversify IoC container.
501
- */
502
- readonly container: Container;
503
- /**
504
- * Revision counter for cache invalidation.
505
- */
506
- readonly revision: number;
507
- /**
508
- * Function to force a revision update.
509
- */
510
- readonly nextRevision: () => number;
511
- }
512
- /**
513
- * Lit context for providing and consuming the IoC container.
581
+ * Lit context object for providing and consuming the container.
514
582
  *
515
- * @group context
583
+ * @group Context
516
584
  */
517
585
  declare const ContainerContext: {
518
- __context__: IocContext;
586
+ __context__: Container;
519
587
  };
520
588
 
521
589
  /**
522
- * Options for the {@link IocProviderController}.
590
+ * Represents options for the {@link ContainerProvider}.
523
591
  *
524
- * @group provision
592
+ * @remarks
593
+ * Provide either an external `container` or managed creation `options`, but
594
+ * never both at the same time.
595
+ *
596
+ * @group Provision
525
597
  */
526
- interface IocProviderControllerOptions {
598
+ interface ContainerProviderOptions {
527
599
  /**
528
- * Optional existing container to use. If not provided, a new one will be created.
600
+ * External container instance to provide as-is.
601
+ *
602
+ * @remarks
603
+ * External containers are never activated, recreated, or disposed by this
604
+ * provider.
529
605
  */
530
- container?: Container;
606
+ readonly container?: Container$1;
531
607
  /**
532
- * Optional seed data to apply to the container.
608
+ * Managed container creation options.
609
+ *
610
+ * @remarks
611
+ * The managed container is created during provider construction without
612
+ * eager activation, activated when the host connects, disposed when it
613
+ * disconnects, and recreated on the next reconnect.
533
614
  */
534
- seed?: AnyObject;
615
+ readonly options?: CreateContainerOptions;
535
616
  }
536
617
  /**
537
- * Controller that provides an IoC container context to the host element and its children.
618
+ * Provider that exposes an IoC container context to the host element and its children.
619
+ *
620
+ * @remarks
621
+ * The provider supports two modes:
538
622
  *
539
- * It manages the lifecycle of the container and handles revision updates to notify consumers.
623
+ * - External mode: `container` is an existing {@link Container}. The
624
+ * provider passes it through context and does not alter its lifecycle.
625
+ * - Managed mode: `options` is {@link CreateContainerOptions}. The provider
626
+ * creates a container during construction without eager activation,
627
+ * activates configured entries when the host connects, disposes the
628
+ * container when the host disconnects, and recreates it on reconnect.
540
629
  *
541
- * @group provision
630
+ * @group Provision
542
631
  */
543
- declare class IocProviderController<E extends ReactiveControllerHost & HTMLElement = ReactiveControllerHost & HTMLElement> implements ReactiveController {
544
- private readonly host;
545
- protected readonly provider: ContextProvider<typeof ContainerContext>;
546
- protected readonly seed?: AnyObject;
547
- protected revision: number;
632
+ declare class ContainerProvider<E extends ReactiveControllerHost & HTMLElement = ReactiveControllerHost & HTMLElement> extends ContextProvider<typeof ContainerContext, E> implements ReactiveController {
633
+ protected readonly options: Maybe<CreateContainerOptions>;
634
+ protected destroyed: boolean;
548
635
  /**
549
- * The managed Inversify IoC container.
550
- */
551
- container: Container;
552
- /**
553
- * @returns current {@link IocContext} value served to child consumers
554
- */
555
- get value(): IocContext;
556
- /**
557
- * @param host - the host element
558
- * @param options - provisioning options
559
- * @param options.container - optional existing container to use. If not provided, a new one will be created
560
- * @param options.seed - optional seed data to apply to the container
636
+ * @param host - The host element.
637
+ * @param options - Provisioning options.
638
+ * @param options.container - External container instance to provide.
639
+ * @param options.options - Managed container creation options.
561
640
  */
562
- constructor(host: E, { container, seed }?: IocProviderControllerOptions);
641
+ constructor(host: E, options: ContainerProviderOptions);
563
642
  hostConnected(): void;
564
643
  hostDisconnected(): void;
565
- nextRevision(): number;
566
644
  }
567
645
 
568
646
  /**
569
- * Type definition for the ioc-provide decorator.
647
+ * Represents options for the {@link SubContainerProvider}.
570
648
  *
571
- * @group provision
649
+ * @group Provision
572
650
  */
573
- interface IocProviderDecorator<E extends ReactiveElement = ReactiveElement> {
574
- <C extends Interface<Omit<ReactiveElement, "renderRoot">>, V extends IocProviderController<E>>(value: ClassAccessorDecoratorTarget<C, V>, context: ClassAccessorDecoratorContext<C, V>): void;
575
- <K extends PropertyKey, Proto extends Interface<Omit<ReactiveElement, "renderRoot">>>(protoOrDescriptor: Proto, name?: K): FieldMustMatchProvidedType<Proto, K, IocProviderController<E>>;
651
+ interface SubContainerProviderOptions {
652
+ /**
653
+ * Managed child-container creation options.
654
+ *
655
+ * @remarks
656
+ * The child container is created from the current parent context when the
657
+ * host connects, destroyed when the host disconnects, and recreated when the
658
+ * parent context changes or the host reconnects.
659
+ */
660
+ readonly options: {
661
+ /**
662
+ * List of service entries to bind to the container.
663
+ */
664
+ readonly entries: ReadonlyArray<Newable<object> | InjectableDescriptor>;
665
+ /**
666
+ * List of service identifiers to activate (get from container) immediately after binding.
667
+ */
668
+ readonly activate?: ReadonlyArray<ServiceIdentifier>;
669
+ /**
670
+ * Seed data to apply to the container before binding.
671
+ * Applied before entries are bound so that `@Inject(SEEDS_TOKEN)` works during activation.
672
+ */
673
+ readonly seeds?: SeedEntries;
674
+ };
576
675
  }
577
676
  /**
578
- * Decorator to provide an IoC container to child components.
677
+ * Provider that exposes a managed child container for the host element's lifetime.
579
678
  *
580
- * @group provision
679
+ * @remarks
680
+ * The provider always owns a child container derived from the nearest parent
681
+ * {@link ContainerContext}. When connected, it creates a child container using
682
+ * the latest parent context, provides it to descendants, destroys it when the
683
+ * host disconnects, and replaces it whenever the parent container changes.
581
684
  *
582
- * @param options - provisioning options including container and seed data
583
- * @param options.container - optional existing container to use, if not provided, a new one will be created
584
- * @param options.seed - optional seed data to apply to the container
585
- * @returns IOC provision controller instance
685
+ * @group Provision
586
686
  *
587
687
  * @example
588
688
  * ```typescript
589
- * class MyRootElement extends LitElement {
590
- * @iocProvide({ seed: { someData: 'value' } })
591
- * private ioc!: IocProviderController;
689
+ * class MyComponent extends LitElement {
690
+ * private container = new SubContainerProvider(this, {
691
+ * options: {
692
+ * entries: [AuthService, UserService],
693
+ * activate: [AuthService],
694
+ * seeds: [[AuthService, { role: "admin" }]],
695
+ * },
696
+ * });
592
697
  * }
593
698
  * ```
594
699
  */
595
- declare function iocProvide<E extends ReactiveElement>({ container, seed, }?: IocProviderControllerOptions): IocProviderDecorator<E>;
596
-
597
- /**
598
- * @group general-types
599
- */
600
- type Callable<T> = () => T;
601
-
602
- /**
603
- * Options for the {@link InjectablesProviderController}.
604
- *
605
- * @group provision
606
- */
607
- interface InjectablesProviderControllerOptions {
700
+ declare class SubContainerProvider<E extends ReactiveControllerHost & HTMLElement = ReactiveControllerHost & HTMLElement> extends ContextProvider<typeof ContainerContext, E> implements ReactiveController {
701
+ protected readonly consumer: ContextConsumer<typeof ContainerContext, E>;
702
+ protected readonly options: SubContainerProviderOptions["options"];
703
+ protected parent: Maybe<Container$1>;
704
+ protected destroyed: boolean;
608
705
  /**
609
- * List of service entries to bind to the container.
610
- */
611
- entries: ReadonlyArray<Newable<object> | InjectableDescriptor>;
612
- /**
613
- * Target IoC context to bind injectables into.
614
- * If not provided, uses the context from the nearest provider.
615
- * Accepts a static {@link IocContext} reference or a resolver function.
706
+ * @param host - The host element.
707
+ * @param options - Provisioning options, including child entries, eager activations, and seeds.
616
708
  */
617
- into?: IocContext | Callable<IocContext>;
709
+ constructor(host: E, options: SubContainerProviderOptions);
710
+ hostConnected(): void;
711
+ hostDisconnected(): void;
618
712
  /**
619
- * List of service identifiers to activate (get from container) immediately after binding.
713
+ * Replaces the currently provided child container with a new one derived
714
+ * from the latest parent context.
620
715
  */
621
- activate?: ReadonlyArray<ServiceIdentifier>;
716
+ protected createContainer(): void;
622
717
  /**
623
- * Seed data to apply to the container before binding.
624
- * Applied before entries are bound so that `@Inject(SEEDS_TOKEN)` works during activation.
718
+ * Destroys the currently provided child container.
625
719
  */
626
- seeds?: SeedEntries;
720
+ protected destroyContainer(): void;
627
721
  }
722
+
628
723
  /**
629
- * Controller that binds a set of injectables to an IoC container when the host connects
630
- * and unbinds them when the host disconnects.
724
+ * Represents interface for the {@link containerProvide} decorator.
631
725
  *
632
- * When no `into` context is provided, the controller uses the nearest {@link IocProviderController}
633
- * ancestor via Lit context. Seeds are applied before entries so that `@Inject(SEEDS_TOKEN)`
634
- * works during service activation.
726
+ * @remarks
727
+ * Supports both TC39 and legacy experimental decorators.
635
728
  *
636
- * @group provision
729
+ * @group Provision
730
+ */
731
+ interface ContainerProviderDecorator<E extends ReactiveElement = ReactiveElement> {
732
+ <C extends Interface<Omit<ReactiveElement, "renderRoot">>, V extends ContainerProvider<E>>(value: ClassAccessorDecoratorTarget<C, V>, context: ClassAccessorDecoratorContext<C, V>): void;
733
+ <K extends PropertyKey, Proto extends Interface<Omit<ReactiveElement, "renderRoot">>>(protoOrDescriptor: Proto, name?: K): FieldMustMatchProvidedType<Proto, K, ContainerProvider<E>>;
734
+ }
735
+ /**
736
+ * Decorator that provides an IoC container to child components.
737
+ *
738
+ * @remarks
739
+ * The container is provided via Lit context.
740
+ *
741
+ * - Pass `container` to expose an external container without taking
742
+ * ownership.
743
+ * - Pass `options` to create a managed container during construction,
744
+ * activate configured entries on connect, destroy it on disconnect, and
745
+ * recreate it on reconnect.
746
+ *
747
+ * @group Provision
748
+ *
749
+ * @param options - Provisioning options.
750
+ * @param options.container - External container instance to provide.
751
+ * @param options.options - Managed container creation options.
752
+ * @returns An instance of {@link ContainerProviderDecorator}.
637
753
  *
638
754
  * @example
639
755
  * ```typescript
640
- * class MyComponent extends LitElement {
641
- * private services = new InjectablesProviderController(this, {
642
- * entries: [AuthService, UserService],
643
- * activate: [AuthService],
644
- * seeds: [[AuthService, { role: "admin" }]],
645
- * });
756
+ * class MyRootElement extends LitElement {
757
+ * @containerProvide({
758
+ * options: {
759
+ * seed: { someData: "value" },
760
+ * entries: [LoggerService],
761
+ * },
762
+ * })
763
+ * private containerProvider!: ContainerProvider;
764
+ * }
765
+ * ```
766
+ *
767
+ * @example
768
+ * ```typescript
769
+ * class MyRootElement extends LitElement {
770
+ * @containerProvide({ container: container })
771
+ * private containerProvider!: ContainerProvider;
646
772
  * }
647
773
  * ```
648
774
  */
649
- declare class InjectablesProviderController<E extends ReactiveControllerHost & HTMLElement = ReactiveControllerHost & HTMLElement> implements ReactiveController {
650
- private readonly host;
651
- protected readonly consumer?: ContextConsumer<typeof ContainerContext, E>;
652
- private readonly entries;
653
- private readonly activate;
654
- private readonly seeds;
655
- private readonly into;
656
- /**
657
- * Tracks the context to which entries are currently bound, for correct cleanup on disconnect.
658
- */
659
- private boundContext;
660
- /**
661
- * @param host - the host element
662
- * @param options - provisioning options
663
- * @param options.entries - list of service entries to bind to the container
664
- * @param options.into - target IoC context; if omitted, uses the nearest provider context
665
- * @param options.activate - list of service identifiers to activate immediately after binding
666
- * @param options.seeds - seed data applied before binding
667
- */
668
- constructor(host: E, options: InjectablesProviderControllerOptions);
669
- hostConnected(): void;
670
- hostDisconnected(): void;
671
- private bind;
672
- private unbind;
673
- }
775
+ declare function containerProvide<E extends ReactiveElement>(options: ContainerProviderOptions): ContainerProviderDecorator<E>;
674
776
 
675
777
  /**
676
- * Type for the {@link injectablesProvide} decorator.
778
+ * Represents type for the {@link subContainerProvide} decorator.
677
779
  *
678
- * Supports both standard (TC39) and legacy experimental decorators.
780
+ * @remarks
781
+ * Supports both TC39 and legacy experimental decorators.
679
782
  *
680
- * @group provision
783
+ * @group Provision
681
784
  */
682
- interface InjectablesProviderDecorator<T extends ReactiveElement = ReactiveElement> {
683
- <C extends Interface<Omit<ReactiveElement, "renderRoot">>, V extends InjectablesProviderController<T>>(value: ClassAccessorDecoratorTarget<C, V>, context: ClassAccessorDecoratorContext<C, V>): void;
684
- <K extends PropertyKey, Proto extends Interface<Omit<ReactiveElement, "renderRoot">>>(protoOrDescriptor: Proto, name?: K): FieldMustMatchProvidedType<Proto, K, InjectablesProviderController<T>>;
785
+ interface SubContainerProviderDecorator<T extends ReactiveElement = ReactiveElement> {
786
+ <C extends Interface<Omit<ReactiveElement, "renderRoot">>, V extends SubContainerProvider<T>>(value: ClassAccessorDecoratorTarget<C, V>, context: ClassAccessorDecoratorContext<C, V>): void;
787
+ <K extends PropertyKey, Proto extends Interface<Omit<ReactiveElement, "renderRoot">>>(protoOrDescriptor: Proto, name?: K): FieldMustMatchProvidedType<Proto, K, SubContainerProvider<T>>;
685
788
  }
686
789
  /**
687
- * Decorator that binds a set of injectables to the nearest IoC container for the host element's lifetime.
790
+ * Decorator that provides a managed child container derived from the nearest
791
+ * parent container context.
688
792
  *
689
- * Entries are bound when the host connects and unbound when it disconnects.
690
- * The decorated accessor or property holds the resulting {@link InjectablesProviderController} instance.
793
+ * @remarks
794
+ * The child container is created from the current parent context when the host
795
+ * connects, destroyed when it disconnects, and recreated when the parent
796
+ * container changes.
691
797
  *
692
- * @group provision
798
+ * @group Provision
693
799
  *
694
- * @param options - provisioning options
695
- * @returns injectables provider decorator instance
800
+ * @param options - Provisioning options.
801
+ * @param options.options - Child-container creation options.
802
+ * @returns An instance of {@link SubContainerProviderDecorator}.
696
803
  *
697
804
  * @example
698
805
  * ```typescript
699
806
  * class MyComponent extends LitElement {
700
- * @injectablesProvide({ entries: [AuthService, UserService], activate: [AuthService] })
701
- * public services!: InjectablesProviderController<MyComponent>;
807
+ * @subContainerProvide({
808
+ * options: {
809
+ * entries: [AuthService, UserService],
810
+ * activate: [AuthService],
811
+ * },
812
+ * })
813
+ * public containerProvider!: SubContainerProvider<MyComponent>;
702
814
  * }
703
815
  * ```
704
816
  */
705
- declare function injectablesProvide<E extends ReactiveElement = ReactiveElement>(options: InjectablesProviderControllerOptions): InjectablesProviderDecorator<E>;
817
+ declare function subContainerProvide<E extends ReactiveElement = ReactiveElement>(options: SubContainerProviderOptions): SubContainerProviderDecorator<E>;
706
818
 
707
819
  /**
708
- * Binds a set of injectables to the nearest IoC container for the host element's lifetime.
820
+ * Represents options for the {@link useContainerProvision} hook.
821
+ *
822
+ * @group Provision
823
+ */
824
+ type UseContainerProvisionOptions = ContainerProviderOptions;
825
+ /**
826
+ * Hook that provides a container to the host element and its children.
709
827
  *
710
- * Entries are bound when the host connects and unbound when it disconnects.
828
+ * @remarks
829
+ * Pass `container` to expose an external `Container` without taking
830
+ * ownership. Pass `options` to create a managed container during
831
+ * construction, activate configured entries on connect, destroy it on
832
+ * disconnect, and recreate it on reconnect.
711
833
  *
712
- * @group provision
834
+ * @group Provision
713
835
  *
714
- * @param host - the host element
715
- * @param options - provisioning options
716
- * @param options.entries - list of service entries to bind to the container
717
- * @param options.into - target IoC context; if omitted, uses the nearest provider context
718
- * @param options.activate - list of service identifiers to activate immediately after binding
719
- * @param options.seeds - seed data applied before binding
720
- * @returns the controller instance
836
+ * @param host - The host element.
837
+ * @param options - Provisioning options.
838
+ * @param options.container - External container instance to provide.
839
+ * @param options.options - Managed container creation options.
840
+ * @returns An instance of {@link ContainerProvider}.
721
841
  *
722
842
  * @example
723
843
  * ```typescript
724
- * class MyComponent extends LitElement {
725
- * private services = useInjectablesProvider(this, {
726
- * entries: [AuthService, UserService],
727
- * activate: [AuthService],
844
+ * class MyRootElement extends LitElement {
845
+ * private containerProvider: ContainerProvider = useContainerProvision(this, {
846
+ * options: {
847
+ * entries: [LoggerService],
848
+ * activate: [LoggerService],
849
+ * },
728
850
  * });
729
851
  * }
730
852
  * ```
853
+ *
854
+ * @example
855
+ * ```typescript
856
+ * class MyRootElement extends LitElement {
857
+ * private containerProvider: ContainerProvider = useContainerProvision(this, { container: container });
858
+ * }
859
+ * ```
731
860
  */
732
- declare function useInjectablesProvider<E extends ReactiveControllerHost & HTMLElement>(host: E, options: InjectablesProviderControllerOptions): InjectablesProviderController<E>;
861
+ declare function useContainerProvision<E extends ReactiveControllerHost & HTMLElement>(host: E, options: UseContainerProvisionOptions): ContainerProvider<E>;
733
862
 
734
863
  /**
735
- * Options for the {@link useIocProvision} hook.
864
+ * Hook that provides a managed child container for the host element's lifetime.
736
865
  *
737
- * @group provision
738
- */
739
- interface UseIocProvisionOptions {
740
- /**
741
- * Optional existing container to use.
742
- */
743
- container?: Container;
744
- /**
745
- * Optional seed data to apply to the container.
746
- */
747
- seed?: AnyObject;
748
- }
749
- /**
750
- * Hook (controller) to provide an IoC container to the host element and its children.
866
+ * @remarks
867
+ * The child container is derived from the current parent
868
+ * {@link ContainerContext}, recreated when that parent context changes, and
869
+ * destroyed when the host disconnects.
751
870
  *
752
- * @group provision
871
+ * @group Provision
753
872
  *
754
- * @param host - the host element
755
- * @param options - provisioning options
756
- * @param options.container - optional existing container to use
757
- * @param options.seed - optional seed data to apply to the container
758
- * @returns ioc provision controller instance
873
+ * @param host - The host element.
874
+ * @param options - Provisioning options.
875
+ * @param options.options - Child-container creation options.
876
+ * @returns An instance of {@link SubContainerProvider}.
759
877
  *
760
878
  * @example
761
879
  * ```typescript
762
- * class MyRootElement extends LitElement {
763
- * private ioc = useIocProvision(this, { seed: { initialData: '...' } });
880
+ * class MyComponent extends LitElement {
881
+ * private containerProvider: SubContainerProvider = useSubContainerProvider(this, {
882
+ * options: {
883
+ * entries: [AuthService, UserService],
884
+ * },
885
+ * });
764
886
  * }
765
887
  * ```
766
888
  */
767
- declare function useIocProvision<E extends ReactiveControllerHost & HTMLElement>(host: E, options?: UseIocProvisionOptions): IocProviderController<E>;
889
+ declare function useSubContainerProvider<E extends ReactiveControllerHost & HTMLElement>(host: E, options: SubContainerProviderOptions): SubContainerProvider<E>;
768
890
 
769
- export { ContainerContext, InjectablesProviderController, IocProviderController, OnCommandController, OnEventController, OnQueryController, injectablesProvide, injection, iocProvide, onCommand, onEvent, onQuery, useInjectablesProvider, useInjection, useIocProvision, useOnCommand, useOnEvents, useOnQuery };
770
- export type { InjectablesProviderControllerOptions, InjectablesProviderDecorator, InjectionDecorator, InjectionOptions, IocProviderControllerOptions, IocProviderDecorator, OnCommandDecorator, OnEventDecorator, OnQueryDecorator, UseInjectionOptions, UseInjectionValue, UseIocProvisionOptions, UseOnCommandOptions, UseOnEventsOptions, UseOnQueryOptions };
891
+ export { ContainerContext, ContainerProvider, OnCommandController, OnEventController, OnQueryController, SubContainerProvider, containerProvide, injection, onCommand, onEvent, onQuery, subContainerProvide, useContainer, useContainerProvision, useInjection, useOnCommand, useOnEvents, useOnQuery, useScope, useSubContainerProvider };
892
+ export type { ContainerProviderDecorator, ContainerProviderOptions, InjectionDecorator, InjectionOptions, OnCommandDecorator, OnEventDecorator, OnQueryDecorator, SubContainerProviderDecorator, SubContainerProviderOptions, UseContainerProvisionOptions, UseContainerValue, UseInjectionOptions, UseInjectionValue, UseOnCommandOptions, UseOnEventsOptions, UseOnQueryOptions, UseScopeValue };