@foxford/den 2.0.0 → 3.0.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/adapter.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { R as RequestContext } from './types-Deyolj1-.cjs';
1
+ export { R as RequestContext } from './types-COwVwgzE.cjs';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
package/adapter.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { R as RequestContext } from './types-Deyolj1-.js';
1
+ export { R as RequestContext } from './types-COwVwgzE.js';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -6,7 +6,7 @@ function isViewAdapter(value) {
6
6
  return false;
7
7
  }
8
8
  const candidate = value;
9
- return typeof candidate.type === "string" && typeof candidate.createIsland === "function" && typeof candidate.installResolver === "function";
9
+ return typeof candidate.type === "string" && typeof candidate.createIsland === "function" && typeof candidate.renderIsland === "function" && typeof candidate.installResolver === "function";
10
10
  }
11
11
  function viewAdapterOf(layer) {
12
12
  return adapterOfConfig(layer.config);
@@ -14,7 +14,7 @@ function viewAdapterOf(layer) {
14
14
  function adapterOfConfig(config) {
15
15
  if (!isViewAdapter(config.adapter)) {
16
16
  throw new Error(
17
- `den/island: view-\u0441\u043B\u043E\u0439 \xAB${config.name}\xBB \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D \u0431\u0435\u0437 \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u0430 \u2014 \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F ViewAdapter (type + createIsland + installResolver), \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 reactAdapter()`
17
+ `den/island: view-\u0441\u043B\u043E\u0439 \xAB${config.name}\xBB \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D \u0431\u0435\u0437 \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u0430 \u2014 \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F ViewAdapter (type + createIsland + renderIsland + installResolver), \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 reactAdapter()`
18
18
  );
19
19
  }
20
20
  return config.adapter;
@@ -6,7 +6,7 @@ function isViewAdapter(value) {
6
6
  return false;
7
7
  }
8
8
  const candidate = value;
9
- return typeof candidate.type === "string" && typeof candidate.createIsland === "function" && typeof candidate.installResolver === "function";
9
+ return typeof candidate.type === "string" && typeof candidate.createIsland === "function" && typeof candidate.renderIsland === "function" && typeof candidate.installResolver === "function";
10
10
  }
11
11
  function viewAdapterOf(layer) {
12
12
  return adapterOfConfig(layer.config);
@@ -14,7 +14,7 @@ function viewAdapterOf(layer) {
14
14
  function adapterOfConfig(config) {
15
15
  if (!isViewAdapter(config.adapter)) {
16
16
  throw new Error(
17
- `den/island: view-\u0441\u043B\u043E\u0439 \xAB${config.name}\xBB \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D \u0431\u0435\u0437 \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u0430 \u2014 \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F ViewAdapter (type + createIsland + installResolver), \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 reactAdapter()`
17
+ `den/island: view-\u0441\u043B\u043E\u0439 \xAB${config.name}\xBB \u043E\u0431\u044A\u044F\u0432\u043B\u0435\u043D \u0431\u0435\u0437 \u0430\u0434\u0430\u043F\u0442\u0435\u0440\u0430 \u2014 \u043E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F ViewAdapter (type + createIsland + renderIsland + installResolver), \u043D\u0430\u043F\u0440\u0438\u043C\u0435\u0440 reactAdapter()`
18
18
  );
19
19
  }
20
20
  return config.adapter;
@@ -1,4 +1,4 @@
1
- import { x as DefineServiceOptions, K as ServiceDefinition, y as DefineViewModelOptions, X as ViewModelDefinition, w as DefineRepositoryOptions, I as RepositoryDefinition } from './types-Deyolj1-.js';
1
+ import { v as DefineServiceOptions, H as ServiceDefinition, w as DefineViewModelOptions, V as ViewModelDefinition, u as DefineRepositoryOptions, B as RepositoryDefinition } from './types-COwVwgzE.js';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { x as DefineServiceOptions, K as ServiceDefinition, y as DefineViewModelOptions, X as ViewModelDefinition, w as DefineRepositoryOptions, I as RepositoryDefinition } from './types-Deyolj1-.cjs';
1
+ import { v as DefineServiceOptions, H as ServiceDefinition, w as DefineViewModelOptions, V as ViewModelDefinition, u as DefineRepositoryOptions, B as RepositoryDefinition } from './types-COwVwgzE.cjs';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { z as Definition, s as LayerDefinition } from './types-Deyolj1-.cjs';
1
+ import { x as Definition, q as LayerDefinition } from './types-COwVwgzE.cjs';
2
2
  import { Container } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { z as Definition, s as LayerDefinition } from './types-Deyolj1-.js';
1
+ import { x as Definition, q as LayerDefinition } from './types-COwVwgzE.js';
2
2
  import { Container } from '@foxford/ioc';
3
3
 
4
4
  /**
package/define.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-OpMj-Q9O.cjs';
2
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-RfgqKa6n.cjs';
3
- export { w as DefineRepositoryOptions, x as DefineServiceOptions, y as DefineViewModelOptions, z as Definition, I as RepositoryDefinition, K as ServiceDefinition, M as SlotEntry, O as SlotRegistry, P as SlotRegistryToken, X as ViewModelDefinition } from './types-Deyolj1-.cjs';
1
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-MDEWHqM7.cjs';
2
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BKvArA02.cjs';
3
+ export { u as DefineRepositoryOptions, v as DefineServiceOptions, w as DefineViewModelOptions, x as Definition, B as RepositoryDefinition, H as ServiceDefinition, I as SlotEntry, J as SlotRegistry, K as SlotRegistryToken, V as ViewModelDefinition } from './types-COwVwgzE.cjs';
4
4
  import { Token, Container } from '@foxford/ioc';
5
5
  import { HierarchicalLogger } from '@foxford/logger';
6
6
 
package/define.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-DZg34Tb3.js';
2
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-ESU7FR9O.js';
3
- export { w as DefineRepositoryOptions, x as DefineServiceOptions, y as DefineViewModelOptions, z as Definition, I as RepositoryDefinition, K as ServiceDefinition, M as SlotEntry, O as SlotRegistry, P as SlotRegistryToken, X as ViewModelDefinition } from './types-Deyolj1-.js';
1
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-Ca62_YCy.js';
2
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-Dil8Kr1A.js';
3
+ export { u as DefineRepositoryOptions, v as DefineServiceOptions, w as DefineViewModelOptions, x as Definition, B as RepositoryDefinition, H as ServiceDefinition, I as SlotEntry, J as SlotRegistry, K as SlotRegistryToken, V as ViewModelDefinition } from './types-COwVwgzE.js';
4
4
  import { Token, Container } from '@foxford/ioc';
5
5
  import { HierarchicalLogger } from '@foxford/logger';
6
6
 
package/index.cjs CHANGED
@@ -16,7 +16,7 @@ var _chunk5DJZZML5cjs = require('./chunk-5DJZZML5.cjs');
16
16
  require('./chunk-C7BM4DGX.cjs');
17
17
 
18
18
 
19
- var _chunkLJE7K7VDcjs = require('./chunk-LJE7K7VD.cjs');
19
+ var _chunkXOJ2VWX4cjs = require('./chunk-XOJ2VWX4.cjs');
20
20
  require('./chunk-A6ZPAM6Z.cjs');
21
21
 
22
22
 
@@ -589,28 +589,6 @@ function defineGuard(token, options) {
589
589
  };
590
590
  }
591
591
 
592
- // src/define-host.ts
593
- function defineHost(token, options = {}) {
594
- var _a, _b, _c;
595
- const eager = (_a = options.eager) != null ? _a : [];
596
- const lazy = (_b = options.lazy) != null ? _b : [];
597
- const guards = (_c = options.guards) != null ? _c : [];
598
- const config = { eager, guards, lazy };
599
- return {
600
- __meta: { eager, guards, lazy, requires: [] },
601
- __type: "host",
602
- /**
603
- * Регистрирует HostConfig как value в IoC-контейнере.
604
- * Позволяет runtime получать конфигурацию приложения через контейнер.
605
- * @param container - Контейнер для регистрации
606
- */
607
- register(container) {
608
- container.bind(token).toValue(config);
609
- },
610
- token
611
- };
612
- }
613
-
614
592
  // src/define-extension.ts
615
593
 
616
594
  function defineExtension(token, options = {}) {
@@ -739,5 +717,4 @@ function defineLayer(token, options) {
739
717
 
740
718
 
741
719
 
742
-
743
- exports.ActivatableToken = _chunk5DJZZML5cjs.ActivatableToken; exports.ContainerManagerImpl = ContainerManagerImpl; exports.ContainerManagerToken = _chunk5DJZZML5cjs.ContainerManagerToken; exports.GuardRunnerImpl = GuardRunnerImpl; exports.GuardRunnerToken = _chunk5DJZZML5cjs.GuardRunnerToken; exports.NavigationManagerImpl = NavigationManagerImpl; exports.NavigationManagerToken = _chunk5DJZZML5cjs.NavigationManagerToken; exports.RequestContextToken = _chunk5DJZZML5cjs.RequestContextToken; exports.SlotRegistry = _chunk5DJZZML5cjs.SlotRegistry; exports.SlotRegistryToken = _chunk5DJZZML5cjs.SlotRegistryToken; exports.StateCache = StateCache; exports.StateRegistry = StateRegistry; exports.StateRegistryToken = _chunk5DJZZML5cjs.StateRegistryToken; exports.StateSerializerImpl = StateSerializerImpl; exports.StateSerializerToken = _chunk5DJZZML5cjs.StateSerializerToken; exports.ViewLayerToken = _chunkLJE7K7VDcjs.ViewLayerToken; exports.createCore = createCore; exports.defaultGlobalResolver = defaultGlobalResolver; exports.defineActionGuard = defineActionGuard; exports.defineExtension = defineExtension; exports.defineGuard = defineGuard; exports.defineHost = defineHost; exports.defineLayer = defineLayer; exports.defineLayout = defineLayout; exports.defineRepository = _chunk5DJZZML5cjs.defineRepository; exports.defineService = _chunk5DJZZML5cjs.defineService; exports.defineSlot = _chunk5DJZZML5cjs.defineSlot; exports.defineViewModel = _chunk5DJZZML5cjs.defineViewModel;
720
+ exports.ActivatableToken = _chunk5DJZZML5cjs.ActivatableToken; exports.ContainerManagerImpl = ContainerManagerImpl; exports.ContainerManagerToken = _chunk5DJZZML5cjs.ContainerManagerToken; exports.GuardRunnerImpl = GuardRunnerImpl; exports.GuardRunnerToken = _chunk5DJZZML5cjs.GuardRunnerToken; exports.NavigationManagerImpl = NavigationManagerImpl; exports.NavigationManagerToken = _chunk5DJZZML5cjs.NavigationManagerToken; exports.RequestContextToken = _chunk5DJZZML5cjs.RequestContextToken; exports.SlotRegistry = _chunk5DJZZML5cjs.SlotRegistry; exports.SlotRegistryToken = _chunk5DJZZML5cjs.SlotRegistryToken; exports.StateCache = StateCache; exports.StateRegistry = StateRegistry; exports.StateRegistryToken = _chunk5DJZZML5cjs.StateRegistryToken; exports.StateSerializerImpl = StateSerializerImpl; exports.StateSerializerToken = _chunk5DJZZML5cjs.StateSerializerToken; exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.createCore = createCore; exports.defaultGlobalResolver = defaultGlobalResolver; exports.defineActionGuard = defineActionGuard; exports.defineExtension = defineExtension; exports.defineGuard = defineGuard; exports.defineLayer = defineLayer; exports.defineLayout = defineLayout; exports.defineRepository = _chunk5DJZZML5cjs.defineRepository; exports.defineService = _chunk5DJZZML5cjs.defineService; exports.defineSlot = _chunk5DJZZML5cjs.defineSlot; exports.defineViewModel = _chunk5DJZZML5cjs.defineViewModel;
package/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { C as Core, a as ContainerManager, R as RequestContext, G as GuardRunner, b as Guard, c as GuardResult, N as NavigationManager, d as NavigationEntry, e as NavigationInterceptor, D as Disposable, L as LeaveGuardResult, S as StateSerializer, f as DefineGuardOptions, g as GuardDefinition, H as HostConfig, h as DefineHostOptions, i as HostDefinition, E as ExtensionConfig, j as DefineExtensionOptions, k as ExtensionDefinition, A as ActionGuard, l as DefineActionGuardOptions, m as ActionGuardDefinition, n as LayoutConfig, o as DefineLayoutOptions, p as LayoutDefinition, q as LayerConfig, r as DefineLayerOptions, s as LayerDefinition } from './types-Deyolj1-.cjs';
2
- export { t as Activatable, u as ActivatableToken, v as ContainerManagerToken, w as DefineRepositoryOptions, x as DefineServiceOptions, y as DefineViewModelOptions, z as Definition, B as GuardRunnerToken, F as NavigationManagerToken, I as RepositoryDefinition, J as RequestContextToken, K as ServiceDefinition, M as SlotEntry, O as SlotRegistry, P as SlotRegistryToken, Q as StateCache, T as StateParticipant, U as StateRegistry, V as StateRegistryToken, W as StateSerializerToken, X as ViewModelDefinition } from './types-Deyolj1-.cjs';
1
+ import { C as Core, a as ContainerManager, R as RequestContext, G as GuardRunner, b as Guard, c as GuardResult, N as NavigationManager, d as NavigationEntry, e as NavigationInterceptor, D as Disposable, L as LeaveGuardResult, S as StateSerializer, f as DefineGuardOptions, g as GuardDefinition, E as ExtensionConfig, h as DefineExtensionOptions, i as ExtensionDefinition, A as ActionGuard, j as DefineActionGuardOptions, k as ActionGuardDefinition, l as LayoutConfig, m as DefineLayoutOptions, n as LayoutDefinition, o as LayerConfig, p as DefineLayerOptions, q as LayerDefinition } from './types-COwVwgzE.cjs';
2
+ export { r as Activatable, s as ActivatableToken, t as ContainerManagerToken, u as DefineRepositoryOptions, v as DefineServiceOptions, w as DefineViewModelOptions, x as Definition, y as GuardRunnerToken, z as NavigationManagerToken, B as RepositoryDefinition, F as RequestContextToken, H as ServiceDefinition, I as SlotEntry, J as SlotRegistry, K as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-COwVwgzE.cjs';
3
3
  import { Container, Token } from '@foxford/ioc';
4
4
  import { DefinitionResolver } from './adapter.cjs';
5
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-OpMj-Q9O.cjs';
6
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-RfgqKa6n.cjs';
7
- export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-vwO-7b1t.cjs';
5
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-MDEWHqM7.cjs';
6
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BKvArA02.cjs';
7
+ export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-BvDC5O4y.cjs';
8
8
 
9
9
  /**
10
10
  * Опции для создания Core Runtime.
@@ -270,27 +270,6 @@ declare const defaultGlobalResolver: DefinitionResolver;
270
270
  */
271
271
  declare function defineGuard<Deps extends readonly Token<unknown>[] = readonly []>(token: Token<Guard>, options: DefineGuardOptions<Deps>): GuardDefinition;
272
272
 
273
- /**
274
- * Определяет конфигурацию приложения с декларативным списком сервисов и guards.
275
- * Заменяет ручной вызов setupContainer() — декларирует, какие сервисы запускаются
276
- * при старте (eager), какие — лениво (lazy), и какие guards применяются глобально.
277
- * Регистрирует HostConfig-значение в IoC-контейнере.
278
- *
279
- * @param token - Токен для регистрации HostConfig в IoC
280
- * @param options - Опции: eager, lazy, guards
281
- * @returns HostDefinition с методом register(container)
282
- *
283
- * @example
284
- * // app/app.ts
285
- * export const app = defineHost(AppToken, {
286
- * eager: [AuthServiceToken, NotificationServiceToken],
287
- * lazy: [CartServiceToken],
288
- * guards: [GlobalAuthGuardToken],
289
- * })
290
- * app.register(appContainer)
291
- */
292
- declare function defineHost(token: Token<HostConfig>, options?: DefineHostOptions): HostDefinition;
293
-
294
273
  /**
295
274
  * Определяет app-scope расширение с lifecycle-хуками activate/deactivate.
296
275
  * Extension — модуль с собственным lifecycle, живущий в скоупе приложения
@@ -384,4 +363,4 @@ declare function defineLayout(token: Token<LayoutConfig>, options?: DefineLayout
384
363
  */
385
364
  declare function defineLayer(token: Token<LayerConfig>, options: DefineLayerOptions): LayerDefinition;
386
365
 
387
- export { ActionGuard, ActionGuardDefinition, ContainerManager, ContainerManagerImpl, Core, type CreateCoreOptions, DefineActionGuardOptions, DefineExtensionOptions, DefineGuardOptions, DefineHostOptions, DefineLayerOptions, DefineLayoutOptions, Disposable, ExtensionConfig, ExtensionDefinition, Guard, GuardDefinition, GuardResult, GuardRunner, GuardRunnerImpl, HostConfig, HostDefinition, LayerConfig, LayerDefinition, LayoutConfig, LayoutDefinition, LeaveGuardResult, NavigationEntry, NavigationInterceptor, NavigationManager, NavigationManagerImpl, RequestContext, StateSerializer, StateSerializerImpl, createCore, defaultGlobalResolver, defineActionGuard, defineExtension, defineGuard, defineHost, defineLayer, defineLayout };
366
+ export { ActionGuard, ActionGuardDefinition, ContainerManager, ContainerManagerImpl, Core, type CreateCoreOptions, DefineActionGuardOptions, DefineExtensionOptions, DefineGuardOptions, DefineLayerOptions, DefineLayoutOptions, Disposable, ExtensionConfig, ExtensionDefinition, Guard, GuardDefinition, GuardResult, GuardRunner, GuardRunnerImpl, LayerConfig, LayerDefinition, LayoutConfig, LayoutDefinition, LeaveGuardResult, NavigationEntry, NavigationInterceptor, NavigationManager, NavigationManagerImpl, RequestContext, StateSerializer, StateSerializerImpl, createCore, defaultGlobalResolver, defineActionGuard, defineExtension, defineGuard, defineLayer, defineLayout };
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { C as Core, a as ContainerManager, R as RequestContext, G as GuardRunner, b as Guard, c as GuardResult, N as NavigationManager, d as NavigationEntry, e as NavigationInterceptor, D as Disposable, L as LeaveGuardResult, S as StateSerializer, f as DefineGuardOptions, g as GuardDefinition, H as HostConfig, h as DefineHostOptions, i as HostDefinition, E as ExtensionConfig, j as DefineExtensionOptions, k as ExtensionDefinition, A as ActionGuard, l as DefineActionGuardOptions, m as ActionGuardDefinition, n as LayoutConfig, o as DefineLayoutOptions, p as LayoutDefinition, q as LayerConfig, r as DefineLayerOptions, s as LayerDefinition } from './types-Deyolj1-.js';
2
- export { t as Activatable, u as ActivatableToken, v as ContainerManagerToken, w as DefineRepositoryOptions, x as DefineServiceOptions, y as DefineViewModelOptions, z as Definition, B as GuardRunnerToken, F as NavigationManagerToken, I as RepositoryDefinition, J as RequestContextToken, K as ServiceDefinition, M as SlotEntry, O as SlotRegistry, P as SlotRegistryToken, Q as StateCache, T as StateParticipant, U as StateRegistry, V as StateRegistryToken, W as StateSerializerToken, X as ViewModelDefinition } from './types-Deyolj1-.js';
1
+ import { C as Core, a as ContainerManager, R as RequestContext, G as GuardRunner, b as Guard, c as GuardResult, N as NavigationManager, d as NavigationEntry, e as NavigationInterceptor, D as Disposable, L as LeaveGuardResult, S as StateSerializer, f as DefineGuardOptions, g as GuardDefinition, E as ExtensionConfig, h as DefineExtensionOptions, i as ExtensionDefinition, A as ActionGuard, j as DefineActionGuardOptions, k as ActionGuardDefinition, l as LayoutConfig, m as DefineLayoutOptions, n as LayoutDefinition, o as LayerConfig, p as DefineLayerOptions, q as LayerDefinition } from './types-COwVwgzE.js';
2
+ export { r as Activatable, s as ActivatableToken, t as ContainerManagerToken, u as DefineRepositoryOptions, v as DefineServiceOptions, w as DefineViewModelOptions, x as Definition, y as GuardRunnerToken, z as NavigationManagerToken, B as RepositoryDefinition, F as RequestContextToken, H as ServiceDefinition, I as SlotEntry, J as SlotRegistry, K as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-COwVwgzE.js';
3
3
  import { Container, Token } from '@foxford/ioc';
4
4
  import { DefinitionResolver } from './adapter.js';
5
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-DZg34Tb3.js';
6
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-ESU7FR9O.js';
7
- export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-CL0vZ-rv.js';
5
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-Ca62_YCy.js';
6
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-Dil8Kr1A.js';
7
+ export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-DtNgyjIf.js';
8
8
 
9
9
  /**
10
10
  * Опции для создания Core Runtime.
@@ -270,27 +270,6 @@ declare const defaultGlobalResolver: DefinitionResolver;
270
270
  */
271
271
  declare function defineGuard<Deps extends readonly Token<unknown>[] = readonly []>(token: Token<Guard>, options: DefineGuardOptions<Deps>): GuardDefinition;
272
272
 
273
- /**
274
- * Определяет конфигурацию приложения с декларативным списком сервисов и guards.
275
- * Заменяет ручной вызов setupContainer() — декларирует, какие сервисы запускаются
276
- * при старте (eager), какие — лениво (lazy), и какие guards применяются глобально.
277
- * Регистрирует HostConfig-значение в IoC-контейнере.
278
- *
279
- * @param token - Токен для регистрации HostConfig в IoC
280
- * @param options - Опции: eager, lazy, guards
281
- * @returns HostDefinition с методом register(container)
282
- *
283
- * @example
284
- * // app/app.ts
285
- * export const app = defineHost(AppToken, {
286
- * eager: [AuthServiceToken, NotificationServiceToken],
287
- * lazy: [CartServiceToken],
288
- * guards: [GlobalAuthGuardToken],
289
- * })
290
- * app.register(appContainer)
291
- */
292
- declare function defineHost(token: Token<HostConfig>, options?: DefineHostOptions): HostDefinition;
293
-
294
273
  /**
295
274
  * Определяет app-scope расширение с lifecycle-хуками activate/deactivate.
296
275
  * Extension — модуль с собственным lifecycle, живущий в скоупе приложения
@@ -384,4 +363,4 @@ declare function defineLayout(token: Token<LayoutConfig>, options?: DefineLayout
384
363
  */
385
364
  declare function defineLayer(token: Token<LayerConfig>, options: DefineLayerOptions): LayerDefinition;
386
365
 
387
- export { ActionGuard, ActionGuardDefinition, ContainerManager, ContainerManagerImpl, Core, type CreateCoreOptions, DefineActionGuardOptions, DefineExtensionOptions, DefineGuardOptions, DefineHostOptions, DefineLayerOptions, DefineLayoutOptions, Disposable, ExtensionConfig, ExtensionDefinition, Guard, GuardDefinition, GuardResult, GuardRunner, GuardRunnerImpl, HostConfig, HostDefinition, LayerConfig, LayerDefinition, LayoutConfig, LayoutDefinition, LeaveGuardResult, NavigationEntry, NavigationInterceptor, NavigationManager, NavigationManagerImpl, RequestContext, StateSerializer, StateSerializerImpl, createCore, defaultGlobalResolver, defineActionGuard, defineExtension, defineGuard, defineHost, defineLayer, defineLayout };
366
+ export { ActionGuard, ActionGuardDefinition, ContainerManager, ContainerManagerImpl, Core, type CreateCoreOptions, DefineActionGuardOptions, DefineExtensionOptions, DefineGuardOptions, DefineLayerOptions, DefineLayoutOptions, Disposable, ExtensionConfig, ExtensionDefinition, Guard, GuardDefinition, GuardResult, GuardRunner, GuardRunnerImpl, LayerConfig, LayerDefinition, LayoutConfig, LayoutDefinition, LeaveGuardResult, NavigationEntry, NavigationInterceptor, NavigationManager, NavigationManagerImpl, RequestContext, StateSerializer, StateSerializerImpl, createCore, defaultGlobalResolver, defineActionGuard, defineExtension, defineGuard, defineLayer, defineLayout };
package/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  import "./chunk-WBHHHICS.js";
17
17
  import {
18
18
  ViewLayerToken
19
- } from "./chunk-TCYGDT2A.js";
19
+ } from "./chunk-E23E2VUC.js";
20
20
  import "./chunk-TPBI6TOU.js";
21
21
  import {
22
22
  __async
@@ -589,28 +589,6 @@ function defineGuard(token, options) {
589
589
  };
590
590
  }
591
591
 
592
- // src/define-host.ts
593
- function defineHost(token, options = {}) {
594
- var _a, _b, _c;
595
- const eager = (_a = options.eager) != null ? _a : [];
596
- const lazy = (_b = options.lazy) != null ? _b : [];
597
- const guards = (_c = options.guards) != null ? _c : [];
598
- const config = { eager, guards, lazy };
599
- return {
600
- __meta: { eager, guards, lazy, requires: [] },
601
- __type: "host",
602
- /**
603
- * Регистрирует HostConfig как value в IoC-контейнере.
604
- * Позволяет runtime получать конфигурацию приложения через контейнер.
605
- * @param container - Контейнер для регистрации
606
- */
607
- register(container) {
608
- container.bind(token).toValue(config);
609
- },
610
- token
611
- };
612
- }
613
-
614
592
  // src/define-extension.ts
615
593
  import { inject as inject2, Lifecycle as Lifecycle2 } from "@foxford/ioc";
616
594
  function defineExtension(token, options = {}) {
@@ -733,7 +711,6 @@ export {
733
711
  defineActionGuard,
734
712
  defineExtension,
735
713
  defineGuard,
736
- defineHost,
737
714
  defineLayer,
738
715
  defineLayout,
739
716
  defineRepository,
package/island/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkLJE7K7VDcjs = require('../chunk-LJE7K7VD.cjs');
5
+ var _chunkXOJ2VWX4cjs = require('../chunk-XOJ2VWX4.cjs');
6
6
 
7
7
 
8
8
 
@@ -10,8 +10,14 @@ var _chunkLJE7K7VDcjs = require('../chunk-LJE7K7VD.cjs');
10
10
  var _chunkA6ZPAM6Zcjs = require('../chunk-A6ZPAM6Z.cjs');
11
11
 
12
12
 
13
+
13
14
  var _chunkXHYR3SGGcjs = require('../chunk-XHYR3SGG.cjs');
14
15
 
16
+ // src/island/document.ts
17
+ function isDocumentSource(value) {
18
+ return typeof value === "object" && value !== null && typeof value.describeDocument === "function";
19
+ }
20
+
15
21
  // src/island/lifecycle.ts
16
22
  var _logger = require('@foxford/logger');
17
23
 
@@ -28,6 +34,8 @@ function getAppContainer() {
28
34
  }
29
35
 
30
36
  // src/island/lifecycle.ts
37
+ var EMPTY_ROUTE = { params: {}, pathname: "", search: "" };
38
+ var REDIRECT_FOUND = 302;
31
39
  function createIslandContainer(descriptor, options = {}) {
32
40
  var _a, _b, _c, _d, _e;
33
41
  const { parent = getAppContainer() } = options;
@@ -68,15 +76,95 @@ function hydrateIslandState(container, descriptor, denState) {
68
76
  }
69
77
  }
70
78
  }
71
- function activateIslandViewModels(container, descriptor) {
79
+ function activateIslandViewModels(_0, _1) {
80
+ return _chunkXHYR3SGGcjs.__async.call(void 0, this, arguments, function* (container, descriptor, route = EMPTY_ROUTE) {
81
+ var _a;
82
+ yield Promise.all(
83
+ ((_a = descriptor.viewModels) != null ? _a : []).map((vm) => _chunkXHYR3SGGcjs.__async.call(void 0, null, null, function* () {
84
+ var _a2;
85
+ const instance = container.resolve(vm.token);
86
+ _chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, vm.token.description).debug(`\u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u044F VM (${route.pathname || "\u2014"})`);
87
+ yield (_a2 = instance.activate) == null ? void 0 : _a2.call(instance, route);
88
+ }))
89
+ );
90
+ });
91
+ }
92
+ function collectIslandState(container, descriptor) {
72
93
  var _a, _b;
94
+ const state = {};
73
95
  for (const vm of (_a = descriptor.viewModels) != null ? _a : []) {
74
96
  const instance = container.resolve(vm.token);
75
- _chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, vm.token.description).debug("\u0430\u043A\u0442\u0438\u0432\u0430\u0446\u0438\u044F VM (\u0431\u0435\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043D\u043E\u0433\u043E denState)");
76
- void ((_b = instance.activate) == null ? void 0 : _b.call(instance));
97
+ if (typeof ((_b = instance.state) == null ? void 0 : _b.get) === "function") {
98
+ state[vm.token.description] = instance.state.get();
99
+ }
100
+ }
101
+ return state;
102
+ }
103
+ function collectDocumentContribution(container, descriptor) {
104
+ var _a, _b;
105
+ const contribution = {};
106
+ for (const vm of (_a = descriptor.viewModels) != null ? _a : []) {
107
+ const instance = container.resolve(vm.token);
108
+ if (!isDocumentSource(instance)) {
109
+ continue;
110
+ }
111
+ const part = instance.describeDocument();
112
+ if (part.head) {
113
+ contribution.head = _chunkXHYR3SGGcjs.__spreadValues.call(void 0, _chunkXHYR3SGGcjs.__spreadValues.call(void 0, {}, contribution.head), part.head);
114
+ }
115
+ const declared = part.status !== void 0 || part.redirect !== void 0;
116
+ if (declared && contribution.status === void 0) {
117
+ contribution.status = (_b = part.status) != null ? _b : REDIRECT_FOUND;
118
+ contribution.redirect = part.redirect;
119
+ }
120
+ }
121
+ return contribution;
122
+ }
123
+ function resolveEagerUnits(container, descriptor) {
124
+ var _a;
125
+ for (const token of (_a = descriptor.eager) != null ? _a : []) {
126
+ const instance = container.resolve(token);
127
+ _chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, token.description).debug("eager: \u0435\u0434\u0438\u043D\u0438\u0446\u0430 \u043F\u043E\u0434\u043D\u044F\u0442\u0430 \u043F\u0440\u0438 \u043C\u043E\u043D\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0438");
128
+ if (instance instanceof Promise) {
129
+ instance.catch(
130
+ (error) => _chunkA6ZPAM6Zcjs.unitLogger.call(void 0, container, token.description).error("eager: \u0435\u0434\u0438\u043D\u0438\u0446\u0430 \u043D\u0435 \u043F\u043E\u0434\u043D\u044F\u043B\u0430\u0441\u044C", error)
131
+ );
132
+ }
77
133
  }
78
134
  }
79
135
 
136
+ // src/island/render.ts
137
+ var STATUS_OK = 200;
138
+ function renderApp(descriptor, request) {
139
+ return _chunkXHYR3SGGcjs.__async.call(void 0, this, null, function* () {
140
+ var _a, _b;
141
+ const route = {
142
+ params: (_a = request.params) != null ? _a : {},
143
+ pathname: request.pathname,
144
+ search: (_b = request.search) != null ? _b : ""
145
+ };
146
+ const container = createIslandContainer(descriptor, { parent: request.parent });
147
+ if (container === null) {
148
+ throw new Error(`den/island: \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \xAB${descriptor.name}\xBB \u043D\u0435 \u0441\u043E\u0431\u0440\u0430\u043B\u043E\u0441\u044C \u2014 \u0440\u0435\u043D\u0434\u0435\u0440 \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436\u0435\u043D`);
149
+ }
150
+ try {
151
+ yield activateIslandViewModels(container, descriptor, route);
152
+ const { head, redirect, status = STATUS_OK } = collectDocumentContribution(container, descriptor);
153
+ if (status !== STATUS_OK) {
154
+ return { head, html: "", redirect, state: {}, status };
155
+ }
156
+ const state = collectIslandState(container, descriptor);
157
+ const rendered = _chunkXOJ2VWX4cjs.resolveViewAdapter.call(void 0, container).renderIsland(descriptor, {
158
+ container,
159
+ slots: request.slots
160
+ });
161
+ return { head, headHtml: rendered.head, html: rendered.html, state, status };
162
+ } finally {
163
+ yield container.dispose();
164
+ }
165
+ });
166
+ }
167
+
80
168
  // src/island/slot-address.ts
81
169
  function slotAddress(app, slot) {
82
170
  return `${app}:${slot}`;
@@ -122,6 +210,17 @@ function describeIsland(descriptor, denState) {
122
210
  };
123
211
  }
124
212
 
213
+ // src/island/routes.ts
214
+ function normalizeRoutes(routes = []) {
215
+ return routes.map((route) => typeof route === "string" ? { source: route } : route);
216
+ }
217
+
218
+
219
+
220
+
221
+
222
+
223
+
125
224
 
126
225
 
127
226
 
@@ -134,4 +233,4 @@ function describeIsland(descriptor, denState) {
134
233
 
135
234
 
136
235
 
137
- exports.ViewLayerToken = _chunkLJE7K7VDcjs.ViewLayerToken; exports.activateIslandViewModels = activateIslandViewModels; exports.createIslandContainer = createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = hydrateIslandState; exports.registerIsland = registerIsland; exports.resolveViewAdapter = _chunkLJE7K7VDcjs.resolveViewAdapter; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkLJE7K7VDcjs.viewAdapterOf;
236
+ exports.ViewLayerToken = _chunkXOJ2VWX4cjs.ViewLayerToken; exports.activateIslandViewModels = activateIslandViewModels; exports.collectDocumentContribution = collectDocumentContribution; exports.collectIslandState = collectIslandState; exports.createIslandContainer = createIslandContainer; exports.describeIsland = describeIsland; exports.getAppContainer = getAppContainer; exports.getIslandsSnapshot = getIslandsSnapshot; exports.hydrateIslandState = hydrateIslandState; exports.isDocumentSource = isDocumentSource; exports.normalizeRoutes = normalizeRoutes; exports.registerIsland = registerIsland; exports.renderApp = renderApp; exports.resolveEagerUnits = resolveEagerUnits; exports.resolveViewAdapter = _chunkXOJ2VWX4cjs.resolveViewAdapter; exports.slotAddress = slotAddress; exports.subscribeIslands = subscribeIslands; exports.viewAdapterOf = _chunkXOJ2VWX4cjs.viewAdapterOf;