@hai3/framework 0.2.0-alpha.4 → 0.4.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -25,13 +25,28 @@ __export(src_exports, {
25
25
  ApiPluginBase: () => import_api3.ApiPluginBase,
26
26
  ApiProtocol: () => import_api3.ApiProtocol,
27
27
  BaseApiService: () => import_api3.BaseApiService,
28
+ ContainerProvider: () => import_screensets11.ContainerProvider,
29
+ HAI3_ACTION_LOAD_EXT: () => import_screensets9.HAI3_ACTION_LOAD_EXT,
30
+ HAI3_ACTION_MOUNT_EXT: () => import_screensets9.HAI3_ACTION_MOUNT_EXT,
31
+ HAI3_ACTION_UNMOUNT_EXT: () => import_screensets9.HAI3_ACTION_UNMOUNT_EXT,
32
+ HAI3_MFE_ENTRY_MF: () => import_screensets8.HAI3_MFE_ENTRY_MF,
33
+ HAI3_OVERLAY_DOMAIN: () => HAI3_OVERLAY_DOMAIN,
34
+ HAI3_POPUP_DOMAIN: () => HAI3_POPUP_DOMAIN,
35
+ HAI3_SCREEN_DOMAIN: () => HAI3_SCREEN_DOMAIN,
36
+ HAI3_SCREEN_EXTENSION_TYPE: () => import_screensets8.HAI3_SCREEN_EXTENSION_TYPE,
37
+ HAI3_SHARED_PROPERTY_LANGUAGE: () => import_screensets10.HAI3_SHARED_PROPERTY_LANGUAGE,
38
+ HAI3_SHARED_PROPERTY_THEME: () => import_screensets10.HAI3_SHARED_PROPERTY_THEME,
39
+ HAI3_SIDEBAR_DOMAIN: () => HAI3_SIDEBAR_DOMAIN,
28
40
  I18nRegistry: () => import_i18n6.I18nRegistryImpl,
29
- I18nRegistryImpl: () => import_i18n5.I18nRegistryImpl,
41
+ I18nRegistryImpl: () => import_i18n4.I18nRegistryImpl,
30
42
  LAYOUT_SLICE_NAME: () => LAYOUT_SLICE_NAME,
31
- Language: () => import_i18n5.Language,
32
- LanguageDisplayMode: () => import_i18n5.LanguageDisplayMode,
33
- LayoutDomain: () => import_screensets6.LayoutDomain,
43
+ Language: () => import_i18n4.Language,
44
+ LanguageDisplayMode: () => import_i18n4.LanguageDisplayMode,
45
+ LayoutDomain: () => import_screensets13.LayoutDomain,
34
46
  MOCK_PLUGIN: () => import_api3.MOCK_PLUGIN,
47
+ MfeBridgeFactory: () => import_screensets11.MfeBridgeFactory,
48
+ MfeHandler: () => import_screensets11.MfeHandler,
49
+ MfeHandlerMF: () => import_handler.MfeHandlerMF,
35
50
  MockEventSource: () => import_api3.MockEventSource,
36
51
  MockEvents: () => MockEvents,
37
52
  RestMockPlugin: () => import_api3.RestMockPlugin,
@@ -39,15 +54,16 @@ __export(src_exports, {
39
54
  RestPluginWithConfig: () => import_api3.RestPluginWithConfig,
40
55
  RestProtocol: () => import_api3.RestProtocol,
41
56
  STATE_PATH_MAPPING: () => STATE_PATH_MAPPING,
42
- SUPPORTED_LANGUAGES: () => import_i18n5.SUPPORTED_LANGUAGES,
43
- ScreensetCategory: () => import_screensets6.ScreensetCategory,
57
+ SUPPORTED_LANGUAGES: () => import_i18n4.SUPPORTED_LANGUAGES,
58
+ ScreensetsRegistry: () => import_screensets11.ScreensetsRegistry,
59
+ ScreensetsRegistryFactory: () => import_screensets11.ScreensetsRegistryFactory,
44
60
  SseMockPlugin: () => import_api3.SseMockPlugin,
45
61
  SsePlugin: () => import_api3.SsePlugin,
46
62
  SsePluginWithConfig: () => import_api3.SsePluginWithConfig,
47
63
  SseProtocol: () => import_api3.SseProtocol,
48
64
  TENANT_SLICE_NAME: () => TENANT_SLICE_NAME,
49
65
  TenantEvents: () => TenantEvents,
50
- TextDirection: () => import_i18n5.TextDirection,
66
+ TextDirection: () => import_i18n4.TextDirection,
51
67
  apiRegistry: () => import_api3.apiRegistry,
52
68
  changeTenant: () => changeTenant,
53
69
  clearActiveScreen: () => clearActiveScreen,
@@ -57,34 +73,46 @@ __export(src_exports, {
57
73
  closeAllPopups: () => closeAllPopups,
58
74
  closePopup: () => closePopup,
59
75
  closeTopPopup: () => closeTopPopup,
76
+ compareStrings: () => import_i18n5.compareStrings,
77
+ createCollator: () => import_i18n5.createCollator,
60
78
  createHAI3: () => createHAI3,
61
79
  createHAI3App: () => createHAI3App,
62
- createI18nRegistry: () => import_i18n5.createI18nRegistry,
80
+ createI18nRegistry: () => import_i18n4.createI18nRegistry,
63
81
  createLegacySelector: () => createLegacySelector,
64
- createRouteRegistry: () => createRouteRegistry,
65
- createScreensetRegistry: () => import_screensets4.createScreensetRegistry,
66
- createSlice: () => import_state17.createSlice,
67
- createStore: () => import_state17.createStore,
82
+ createShadowRoot: () => import_screensets12.createShadowRoot,
83
+ createSlice: () => import_state21.createSlice,
84
+ createStore: () => import_state21.createStore,
68
85
  createThemeRegistry: () => createThemeRegistry,
69
86
  effects: () => effects,
70
- eventBus: () => import_state17.eventBus,
87
+ eventBus: () => import_state21.eventBus,
88
+ extractGtsPackage: () => import_screensets12.extractGtsPackage,
71
89
  footerActions: () => footerActions,
72
90
  footerSlice: () => footerSlice,
91
+ formatCompact: () => import_i18n5.formatCompact,
92
+ formatCurrency: () => import_i18n5.formatCurrency,
93
+ formatDate: () => import_i18n5.formatDate,
94
+ formatDateTime: () => import_i18n5.formatDateTime,
95
+ formatNumber: () => import_i18n5.formatNumber,
96
+ formatPercent: () => import_i18n5.formatPercent,
97
+ formatRelative: () => import_i18n5.formatRelative,
98
+ formatTime: () => import_i18n5.formatTime,
73
99
  full: () => full,
74
- getLanguageMetadata: () => import_i18n5.getLanguageMetadata,
100
+ getLanguageMetadata: () => import_i18n4.getLanguageMetadata,
75
101
  getLayoutDomainState: () => getLayoutDomainState,
76
- getStore: () => import_state17.getStore,
102
+ getStore: () => import_state21.getStore,
103
+ gtsPlugin: () => import_gts.gtsPlugin,
77
104
  hasLegacyUicoreState: () => hasLegacyUicoreState,
78
105
  hasNewLayoutState: () => hasNewLayoutState,
79
- hasSlice: () => import_state17.hasSlice,
106
+ hasSlice: () => import_state21.hasSlice,
80
107
  headerActions: () => headerActions,
81
108
  headerSlice: () => headerSlice,
82
109
  headless: () => headless,
83
110
  hideOverlay: () => hideOverlay,
84
111
  i18n: () => i18n,
85
- i18nRegistry: () => import_i18n5.i18nRegistry,
112
+ i18nRegistry: () => import_i18n4.i18nRegistry,
86
113
  initMockEffects: () => initMockEffects,
87
114
  initTenantEffects: () => initTenantEffects,
115
+ injectCssVariables: () => import_screensets12.injectCssVariables,
88
116
  isDeprecationWarningsEnabled: () => isDeprecationWarningsEnabled,
89
117
  isMockPlugin: () => import_api3.isMockPlugin,
90
118
  isRestShortCircuit: () => import_api3.isRestShortCircuit,
@@ -93,26 +121,34 @@ __export(src_exports, {
93
121
  layout: () => layout,
94
122
  layoutDomainReducers: () => layoutDomainReducers,
95
123
  layoutReducer: () => layoutReducer,
124
+ loadExtension: () => loadExtension,
96
125
  menuActions: () => menuActions,
97
126
  menuSlice: () => menuSlice,
127
+ microfrontends: () => microfrontends,
98
128
  minimal: () => minimal,
99
129
  mock: () => mock,
100
130
  mockActions: () => mockActions,
101
131
  mockSlice: () => mockSlice,
132
+ mountExtension: () => mountExtension,
102
133
  navigateTo: () => navigateTo,
103
- navigation: () => navigation,
104
134
  openPopup: () => openPopup,
105
135
  overlayActions: () => overlayActions,
136
+ overlayDomain: () => overlayDomain,
106
137
  overlaySlice: () => overlaySlice,
107
138
  popupActions: () => popupActions,
139
+ popupDomain: () => popupDomain,
108
140
  popupSlice: () => popupSlice,
109
141
  presets: () => presets,
110
- registerSlice: () => import_state17.registerSlice,
111
- routing: () => routing,
142
+ registerExtension: () => registerExtension,
143
+ registerSlice: () => import_state21.registerSlice,
112
144
  screenActions: () => screenActions,
145
+ screenDomain: () => screenDomain,
113
146
  screenSlice: () => screenSlice,
114
- screensetRegistry: () => import_screensets5.screensetRegistry,
115
147
  screensets: () => screensets,
148
+ screensetsRegistryFactory: () => import_screensets11.screensetsRegistryFactory,
149
+ selectExtensionError: () => selectExtensionError,
150
+ selectExtensionState: () => selectExtensionState,
151
+ selectRegisteredExtensions: () => selectRegisteredExtensions,
116
152
  setActiveScreen: () => setActiveScreen,
117
153
  setDeprecationWarnings: () => setDeprecationWarnings,
118
154
  setFooterConfig: () => setFooterConfig,
@@ -138,6 +174,7 @@ __export(src_exports, {
138
174
  setUser: () => setUser,
139
175
  showOverlay: () => showOverlay,
140
176
  sidebarActions: () => sidebarActions,
177
+ sidebarDomain: () => sidebarDomain,
141
178
  sidebarSlice: () => sidebarSlice,
142
179
  tenantActions: () => tenantActions,
143
180
  tenantReducer: () => tenantSlice_default,
@@ -145,7 +182,9 @@ __export(src_exports, {
145
182
  themes: () => themes,
146
183
  toggleMenu: () => toggleMenu,
147
184
  toggleMockMode: () => toggleMockMode,
148
- toggleSidebar: () => toggleSidebar
185
+ toggleSidebar: () => toggleSidebar,
186
+ unmountExtension: () => unmountExtension,
187
+ unregisterExtension: () => unregisterExtension
149
188
  });
150
189
  module.exports = __toCommonJS(src_exports);
151
190
 
@@ -173,6 +212,8 @@ var HAI3AppBuilderImpl = class {
173
212
  * Add a plugin to the application.
174
213
  * Also accepts an array of plugins (for preset support).
175
214
  */
215
+ // @cpt-begin:cpt-hai3-flow-framework-composition-app-bootstrap:p1:inst-1
216
+ // @cpt-begin:cpt-hai3-state-framework-composition-builder:p1:inst-1
176
217
  use(plugin) {
177
218
  if (Array.isArray(plugin)) {
178
219
  plugin.forEach((p) => this.use(p));
@@ -190,6 +231,8 @@ var HAI3AppBuilderImpl = class {
190
231
  this.plugins.push(resolved);
191
232
  return this;
192
233
  }
234
+ // @cpt-end:cpt-hai3-flow-framework-composition-app-bootstrap:p1:inst-1
235
+ // @cpt-end:cpt-hai3-state-framework-composition-builder:p1:inst-1
193
236
  /**
194
237
  * Add multiple plugins at once.
195
238
  */
@@ -200,6 +243,8 @@ var HAI3AppBuilderImpl = class {
200
243
  /**
201
244
  * Build the application.
202
245
  */
246
+ // @cpt-begin:cpt-hai3-flow-framework-composition-app-bootstrap:p1:inst-2
247
+ // @cpt-begin:cpt-hai3-state-framework-composition-builder:p1:inst-2
203
248
  build() {
204
249
  const orderedPlugins = this.resolveDependencies();
205
250
  orderedPlugins.forEach((plugin) => {
@@ -215,11 +260,10 @@ var HAI3AppBuilderImpl = class {
215
260
  const app = {
216
261
  config: this.config,
217
262
  store,
218
- screensetRegistry: aggregated.registries.screensetRegistry,
219
263
  themeRegistry: aggregated.registries.themeRegistry,
220
- routeRegistry: aggregated.registries.routeRegistry,
221
264
  apiRegistry: import_api.apiRegistry,
222
265
  i18nRegistry: aggregated.registries.i18nRegistry,
266
+ screensetsRegistry: aggregated.registries.screensetsRegistry,
223
267
  actions: aggregated.actions,
224
268
  destroy: () => this.destroyApp(orderedPlugins, app)
225
269
  };
@@ -230,9 +274,13 @@ var HAI3AppBuilderImpl = class {
230
274
  });
231
275
  return app;
232
276
  }
277
+ // @cpt-end:cpt-hai3-flow-framework-composition-app-bootstrap:p1:inst-2
278
+ // @cpt-end:cpt-hai3-state-framework-composition-builder:p1:inst-2
233
279
  /**
234
280
  * Resolve plugin dependencies using topological sort.
235
281
  */
282
+ // @cpt-begin:cpt-hai3-algo-framework-composition-dep-resolution:p1:inst-1
283
+ // @cpt-begin:cpt-hai3-flow-framework-composition-plugin-dependency:p1:inst-2
236
284
  resolveDependencies() {
237
285
  const resolved = [];
238
286
  const visited = /* @__PURE__ */ new Set();
@@ -271,14 +319,17 @@ Add the missing plugin: .use(${depName}())`
271
319
  this.plugins.forEach(visit);
272
320
  return resolved;
273
321
  }
322
+ // @cpt-end:cpt-hai3-algo-framework-composition-dep-resolution:p1:inst-1
323
+ // @cpt-end:cpt-hai3-flow-framework-composition-plugin-dependency:p1:inst-2
274
324
  /**
275
325
  * Aggregate all provides from plugins.
276
326
  */
327
+ // @cpt-begin:cpt-hai3-algo-framework-composition-provides-aggregation:p1:inst-1
277
328
  aggregateProvides(plugins) {
278
329
  const registries = {};
279
330
  const slices = [];
280
331
  const effects2 = [];
281
- const actions = {};
332
+ const actions2 = {};
282
333
  plugins.forEach((plugin) => {
283
334
  if (!plugin.provides) return;
284
335
  if (plugin.provides.registries) {
@@ -291,11 +342,12 @@ Add the missing plugin: .use(${depName}())`
291
342
  effects2.push(...plugin.provides.effects);
292
343
  }
293
344
  if (plugin.provides.actions) {
294
- Object.assign(actions, plugin.provides.actions);
345
+ Object.assign(actions2, plugin.provides.actions);
295
346
  }
296
347
  });
297
- return { registries, slices, effects: effects2, actions };
348
+ return { registries, slices, effects: effects2, actions: actions2 };
298
349
  }
350
+ // @cpt-end:cpt-hai3-algo-framework-composition-provides-aggregation:p1:inst-1
299
351
  /**
300
352
  * Create store with all aggregated slices.
301
353
  *
@@ -310,14 +362,15 @@ Add the missing plugin: .use(${depName}())`
310
362
  */
311
363
  createStoreWithSlices(slices) {
312
364
  const store = (0, import_state.getStore)();
313
- slices.forEach((slice10) => {
314
- (0, import_state.registerSlice)(slice10);
365
+ slices.forEach((slice11) => {
366
+ (0, import_state.registerSlice)(slice11);
315
367
  });
316
368
  return store;
317
369
  }
318
370
  /**
319
371
  * Destroy the app and cleanup resources.
320
372
  */
373
+ // @cpt-begin:cpt-hai3-flow-framework-composition-teardown:p2:inst-1
321
374
  destroyApp(plugins, app) {
322
375
  [...plugins].reverse().forEach((plugin) => {
323
376
  if (plugin.onDestroy) {
@@ -325,14 +378,12 @@ Add the missing plugin: .use(${depName}())`
325
378
  }
326
379
  });
327
380
  }
381
+ // @cpt-end:cpt-hai3-flow-framework-composition-teardown:p2:inst-1
328
382
  };
329
383
  function createHAI3(config) {
330
384
  return new HAI3AppBuilderImpl(config);
331
385
  }
332
386
 
333
- // src/plugins/screensets.ts
334
- var import_screensets = require("@hai3/screensets");
335
-
336
387
  // src/slices/index.ts
337
388
  var import_toolkit = require("@reduxjs/toolkit");
338
389
 
@@ -629,35 +680,26 @@ var layoutDomainReducers = {
629
680
  var layoutReducer = (0, import_toolkit.combineReducers)(layoutDomainReducers);
630
681
 
631
682
  // src/plugins/screensets.ts
632
- var screenSlice2 = screenSlice;
633
- var screenActions2 = screenActions;
634
- function screensets(config) {
635
- const screensetRegistry3 = import_screensets.screensetRegistry;
683
+ function screensets(_config) {
636
684
  return {
637
685
  name: "screensets",
638
686
  dependencies: [],
639
687
  provides: {
640
- registries: {
641
- screensetRegistry: screensetRegistry3
642
- },
643
- slices: [screenSlice2],
688
+ registries: {},
689
+ slices: [screenSlice],
644
690
  actions: {
645
- setActiveScreen: screenActions2.navigateTo,
646
- setScreenLoading: screenActions2.setScreenLoading
691
+ setActiveScreen: screenActions.navigateTo,
692
+ setScreenLoading: screenActions.setScreenLoading
647
693
  }
648
694
  },
649
695
  onInit() {
650
- if (config?.autoDiscover) {
651
- console.log(
652
- "[HAI3] Auto-discover is enabled. Screensets should be registered via screensetRegistry.register() in your app."
653
- );
654
- }
655
696
  }
656
697
  };
657
698
  }
658
699
 
659
700
  // src/plugins/themes.ts
660
701
  var import_state11 = require("@hai3/state");
702
+ var import_screensets = require("@hai3/screensets");
661
703
 
662
704
  // src/registries/themeRegistry.ts
663
705
  function createThemeRegistry(config) {
@@ -795,32 +837,29 @@ function themes(config) {
795
837
  changeTheme
796
838
  }
797
839
  },
798
- onInit(_app) {
840
+ // @cpt-begin:cpt-hai3-flow-framework-composition-theme-propagation:p1:inst-2
841
+ // @cpt-begin:cpt-hai3-dod-framework-composition-propagation:p1:inst-1
842
+ onInit(app) {
799
843
  import_state11.eventBus.on("theme/changed", (payload) => {
800
844
  themeRegistry.apply(payload.themeId);
845
+ try {
846
+ app.screensetsRegistry?.updateSharedProperty(import_screensets.HAI3_SHARED_PROPERTY_THEME, payload.themeId);
847
+ } catch (error) {
848
+ console.error("[HAI3] Failed to propagate theme to MFE domains", error);
849
+ }
801
850
  });
802
851
  const themes2 = themeRegistry.getAll();
803
852
  if (themes2.length > 0) {
804
853
  themeRegistry.apply(themes2[0].id);
805
854
  }
806
855
  }
856
+ // @cpt-end:cpt-hai3-flow-framework-composition-theme-propagation:p1:inst-2
857
+ // @cpt-end:cpt-hai3-dod-framework-composition-propagation:p1:inst-1
807
858
  };
808
859
  }
809
860
 
810
861
  // src/plugins/layout.ts
811
862
  var import_state12 = require("@hai3/state");
812
- var headerSlice2 = headerSlice;
813
- var footerSlice2 = footerSlice;
814
- var menuSlice2 = menuSlice;
815
- var sidebarSlice2 = sidebarSlice;
816
- var popupSlice2 = popupSlice;
817
- var overlaySlice2 = overlaySlice;
818
- var headerActions2 = headerActions;
819
- var footerActions2 = footerActions;
820
- var menuActions2 = menuActions;
821
- var sidebarActions2 = sidebarActions;
822
- var popupActions2 = popupActions;
823
- var overlayActions2 = overlayActions;
824
863
  function showPopup(payload) {
825
864
  import_state12.eventBus.emit("layout/popup/requested", payload);
826
865
  }
@@ -839,18 +878,20 @@ function toggleMenuCollapsed(payload) {
839
878
  function toggleSidebarCollapsed(payload) {
840
879
  import_state12.eventBus.emit("layout/sidebar/collapsed", payload);
841
880
  }
881
+ function setHeaderVisible(_visible) {
882
+ }
842
883
  function layout() {
843
884
  return {
844
885
  name: "layout",
845
886
  dependencies: ["screensets"],
846
887
  provides: {
847
888
  slices: [
848
- headerSlice2,
849
- footerSlice2,
850
- menuSlice2,
851
- sidebarSlice2,
852
- popupSlice2,
853
- overlaySlice2
889
+ headerSlice,
890
+ footerSlice,
891
+ menuSlice,
892
+ sidebarSlice,
893
+ popupSlice,
894
+ overlaySlice
854
895
  ],
855
896
  actions: {
856
897
  showPopup,
@@ -860,466 +901,78 @@ function layout() {
860
901
  toggleMenuCollapsed,
861
902
  toggleSidebarCollapsed,
862
903
  // Direct slice actions for backward compatibility
863
- setHeaderVisible: headerActions2.setVisible,
864
- setFooterVisible: footerActions2.setVisible,
865
- setMenuCollapsed: menuActions2.setCollapsed,
866
- setSidebarCollapsed: sidebarActions2.setCollapsed
904
+ setHeaderVisible,
905
+ setFooterVisible: footerActions.setFooterVisible,
906
+ setMenuCollapsed: menuActions.setMenuCollapsed,
907
+ setSidebarCollapsed: sidebarActions.setSidebarCollapsed
867
908
  }
868
909
  },
869
910
  onInit(app) {
870
911
  const dispatch = app.store.dispatch;
871
912
  import_state12.eventBus.on("layout/popup/requested", (payload) => {
872
- dispatch(popupActions2.open({
913
+ dispatch(popupActions.openPopup({
873
914
  id: payload.id,
874
- title: payload.title,
875
- content: payload.content,
876
- size: payload.size
915
+ title: payload.title ?? "",
916
+ component: ""
917
+ // Payload doesn't include component - this needs review
877
918
  }));
878
919
  });
879
920
  import_state12.eventBus.on("layout/popup/hidden", () => {
880
- dispatch(popupActions2.close());
921
+ dispatch(popupActions.closeAllPopups());
881
922
  });
882
- import_state12.eventBus.on("layout/overlay/requested", (payload) => {
883
- dispatch(overlayActions2.show({ id: payload.id }));
923
+ import_state12.eventBus.on("layout/overlay/requested", (_payload) => {
924
+ dispatch(overlayActions.showOverlay());
884
925
  });
885
926
  import_state12.eventBus.on("layout/overlay/hidden", () => {
886
- dispatch(overlayActions2.hide());
927
+ dispatch(overlayActions.hideOverlay());
887
928
  });
888
929
  import_state12.eventBus.on("layout/menu/collapsed", (payload) => {
889
- dispatch(menuActions2.setCollapsed(payload.collapsed));
930
+ dispatch(menuActions.setMenuCollapsed(payload.collapsed));
890
931
  });
891
932
  import_state12.eventBus.on("layout/sidebar/collapsed", (payload) => {
892
- dispatch(sidebarActions2.setCollapsed(payload.collapsed));
933
+ dispatch(sidebarActions.setSidebarCollapsed(payload.collapsed));
893
934
  });
894
935
  }
895
936
  };
896
937
  }
897
938
 
898
- // src/plugins/navigation.ts
939
+ // src/plugins/i18n.ts
899
940
  var import_state13 = require("@hai3/state");
900
941
  var import_i18n = require("@hai3/i18n");
901
-
902
- // src/utils/basePath.ts
903
- function normalizeBase(base) {
904
- if (!base) {
905
- return "/";
906
- }
907
- let normalized = base.startsWith("/") ? base : `/${base}`;
908
- if (normalized !== "/" && normalized.endsWith("/")) {
909
- normalized = normalized.slice(0, -1);
910
- }
911
- return normalized;
912
- }
913
- function stripBase(pathname, base) {
914
- if (base === "/") {
915
- return pathname;
916
- }
917
- if (!pathname.startsWith(base)) {
918
- return null;
919
- }
920
- const nextChar = pathname.charAt(base.length);
921
- if (nextChar && nextChar !== "/") {
922
- return null;
923
- }
924
- return pathname.slice(base.length) || "/";
925
- }
926
- function prependBase(path, base) {
927
- if (base === "/") {
928
- return path;
929
- }
930
- const cleanPath = path.startsWith("/") ? path : `/${path}`;
931
- return `${base}${cleanPath}`;
932
- }
933
- function resolveBase(pluginConfig, appConfig) {
934
- const rawBase = pluginConfig?.base ?? appConfig?.base ?? "/";
935
- return normalizeBase(rawBase);
936
- }
937
-
938
- // src/utils/routeMatcher.ts
939
- var import_path_to_regexp = require("path-to-regexp");
940
- function compileRoute(pattern, screensetId, screenId) {
941
- return {
942
- pattern,
943
- screensetId,
944
- screenId,
945
- matcher: (0, import_path_to_regexp.match)(pattern, { decode: decodeURIComponent }),
946
- toPath: (0, import_path_to_regexp.compile)(pattern, { encode: encodeURIComponent })
947
- };
948
- }
949
- function matchPath(path, routes) {
950
- for (const route of routes) {
951
- const result = route.matcher(path);
952
- if (result) {
953
- return {
954
- screensetId: route.screensetId,
955
- screenId: route.screenId,
956
- params: result.params
957
- };
958
- }
959
- }
960
- return void 0;
961
- }
962
- function generatePath(route, params) {
963
- return route.toPath(params);
964
- }
965
- function extractRequiredParams(pattern) {
966
- const params = [];
967
- const matches = pattern.match(/:([^/]+)/g);
968
- if (matches) {
969
- for (const match2 of matches) {
970
- params.push(match2.slice(1));
971
- }
972
- }
973
- return params;
974
- }
975
-
976
- // src/plugins/navigation.ts
977
- var screenActions3 = screenActions;
978
- var menuActions3 = menuActions;
979
- function navigateToScreen(payload) {
980
- import_state13.eventBus.emit("navigation/screen/navigated", payload);
981
- }
982
- function navigateToScreenset(payload) {
983
- import_state13.eventBus.emit("navigation/screenset/navigated", payload);
984
- }
985
- function navigation(config) {
986
- return {
987
- name: "navigation",
988
- dependencies: ["screensets"],
989
- provides: {
990
- actions: {
991
- navigateToScreen,
992
- navigateToScreenset
993
- }
994
- },
995
- onInit(app) {
996
- const dispatch = app.store.dispatch;
997
- const base = resolveBase(config, app.config);
998
- const routerMode = app.config.routerMode ?? "browser";
999
- let currentScreensetId = null;
1000
- const getCurrentPath = () => {
1001
- if (typeof window === "undefined") return "/";
1002
- switch (routerMode) {
1003
- case "hash":
1004
- return window.location.hash.slice(1) || "/";
1005
- case "memory":
1006
- return "/";
1007
- case "browser":
1008
- default:
1009
- return window.location.pathname;
1010
- }
1011
- };
1012
- const updateURL = (path) => {
1013
- if (typeof window === "undefined" || routerMode === "memory") {
1014
- return;
1015
- }
1016
- const url = prependBase(path, base);
1017
- switch (routerMode) {
1018
- case "hash":
1019
- if (window.location.hash !== `#${url}`) {
1020
- window.location.hash = url;
1021
- }
1022
- break;
1023
- case "browser":
1024
- default:
1025
- if (window.location.pathname !== url) {
1026
- window.history.pushState(null, "", url);
1027
- }
1028
- break;
1029
- }
1030
- };
1031
- const loadScreensetTranslations = async (screensetId, language) => {
1032
- await import_i18n.i18nRegistry.loadScreensetTranslations(
1033
- screensetId,
1034
- language
1035
- );
1036
- };
1037
- const updateScreensetMenu = (screenset) => {
1038
- const menuItems = screenset.menu.map((item) => ({
1039
- id: item.menuItem.screenId ?? item.menuItem.id,
1040
- label: item.menuItem.label,
1041
- icon: item.menuItem.icon
1042
- }));
1043
- dispatch(menuActions3.setMenuItems(menuItems));
1044
- };
1045
- const activateScreenset = (screensetId) => {
1046
- if (screensetId === currentScreensetId) {
1047
- return;
1048
- }
1049
- const screenset = app.screensetRegistry.get(screensetId);
1050
- if (!screenset) {
1051
- return;
1052
- }
1053
- currentScreensetId = screensetId;
1054
- loadScreensetTranslations(screensetId).catch((err) => {
1055
- console.warn(`[HAI3] Failed to load translations for screenset ${screensetId}:`, err);
1056
- });
1057
- updateScreensetMenu(screenset);
1058
- };
1059
- const extractInternalPath = () => {
1060
- const currentPath = getCurrentPath();
1061
- return stripBase(currentPath, base) || "/";
1062
- };
1063
- const activateFromRouteMatch = (match2) => {
1064
- activateScreenset(match2.screensetId);
1065
- dispatch(screenActions3.navigateTo(match2.screenId));
1066
- };
1067
- const matchCurrentPath = () => {
1068
- const path = extractInternalPath();
1069
- return app.routeRegistry?.matchRoute(path);
1070
- };
1071
- import_state13.eventBus.on("navigation/screen/navigated", (payload) => {
1072
- if (!app.routeRegistry?.hasScreen(payload.screensetId, payload.screenId)) {
1073
- console.warn(
1074
- `Screen "${payload.screenId}" in screenset "${payload.screensetId}" not found.`
1075
- );
1076
- return;
1077
- }
1078
- const pattern = app.routeRegistry?.getRoutePattern(payload.screenId);
1079
- if (pattern) {
1080
- const requiredParams = extractRequiredParams(pattern);
1081
- const providedParams = payload.params || {};
1082
- const missingParams = requiredParams.filter((param) => !(param in providedParams));
1083
- if (missingParams.length > 0) {
1084
- console.warn(
1085
- `Screen "${payload.screenId}" requires route params [${requiredParams.join(", ")}] but missing: [${missingParams.join(", ")}]`
1086
- );
1087
- return;
1088
- }
1089
- }
1090
- activateScreenset(payload.screensetId);
1091
- dispatch(screenActions3.navigateTo(payload.screenId));
1092
- const path = app.routeRegistry?.generatePath(payload.screenId, payload.params) ?? `/${payload.screenId}`;
1093
- updateURL(path);
1094
- });
1095
- import_state13.eventBus.on("navigation/screenset/navigated", (payload) => {
1096
- const screenset = app.screensetRegistry.get(payload.screensetId);
1097
- if (!screenset) {
1098
- console.warn(`Screenset "${payload.screensetId}" not found.`);
1099
- return;
1100
- }
1101
- navigateToScreen({
1102
- screensetId: payload.screensetId,
1103
- screenId: screenset.defaultScreen
1104
- });
1105
- });
1106
- let lastLoadedLanguage = null;
1107
- import_i18n.i18nRegistry.subscribe(() => {
1108
- const currentLanguage = import_i18n.i18nRegistry.getLanguage();
1109
- if (!currentLanguage || currentLanguage === lastLoadedLanguage) {
1110
- return;
1111
- }
1112
- if (!currentScreensetId) {
1113
- return;
1114
- }
1115
- const screenset = app.screensetRegistry.get(currentScreensetId);
1116
- if (!screenset) {
1117
- return;
1118
- }
1119
- lastLoadedLanguage = currentLanguage;
1120
- loadScreensetTranslations(currentScreensetId, currentLanguage).then(() => updateScreensetMenu(screenset)).catch((err) => {
1121
- console.warn(
1122
- `[HAI3] Failed to reload translations for screenset ${currentScreensetId}:`,
1123
- err
1124
- );
1125
- });
1126
- });
1127
- if (typeof window !== "undefined" && routerMode !== "memory") {
1128
- const handleURLChange = () => {
1129
- const match3 = matchCurrentPath();
1130
- if (match3) {
1131
- activateFromRouteMatch(match3);
1132
- }
1133
- };
1134
- if (routerMode === "hash") {
1135
- window.addEventListener("hashchange", handleURLChange);
1136
- } else {
1137
- window.addEventListener("popstate", handleURLChange);
1138
- }
1139
- const match2 = matchCurrentPath();
1140
- const autoNavigate = app.config.autoNavigate !== false;
1141
- if (match2) {
1142
- activateFromRouteMatch(match2);
1143
- } else if (autoNavigate) {
1144
- const screensets2 = app.screensetRegistry.getAll();
1145
- if (screensets2.length > 0) {
1146
- navigateToScreenset({ screensetId: screensets2[0].id });
1147
- }
1148
- }
1149
- } else if (routerMode === "memory") {
1150
- const autoNavigate = app.config.autoNavigate !== false;
1151
- if (autoNavigate) {
1152
- const screensets2 = app.screensetRegistry.getAll();
1153
- if (screensets2.length > 0) {
1154
- navigateToScreenset({ screensetId: screensets2[0].id });
1155
- }
1156
- }
1157
- }
1158
- }
1159
- };
1160
- }
1161
-
1162
- // src/registries/routeRegistry.ts
1163
- function createRouteRegistry(screensetRegistry3) {
1164
- let routes = null;
1165
- function buildRoutes() {
1166
- if (routes !== null) {
1167
- return routes;
1168
- }
1169
- routes = [];
1170
- const screensets2 = screensetRegistry3.getAll();
1171
- screensets2.forEach((screenset) => {
1172
- screenset.menu.forEach((menuScreenItem) => {
1173
- const screenId = menuScreenItem.menuItem.screenId ?? menuScreenItem.menuItem.id;
1174
- if (screenId && menuScreenItem.screen) {
1175
- const pattern = menuScreenItem.menuItem.path ?? `/${screenId}`;
1176
- const compiledRoute = compileRoute(pattern, screenset.id, screenId);
1177
- routes.push({
1178
- screensetId: screenset.id,
1179
- screenId,
1180
- loader: menuScreenItem.screen,
1181
- pattern,
1182
- compiledRoute
1183
- });
1184
- }
1185
- });
1186
- });
1187
- routes.sort((a, b) => {
1188
- const aHasParams = a.pattern.includes(":");
1189
- const bHasParams = b.pattern.includes(":");
1190
- if (!aHasParams && bHasParams) return -1;
1191
- if (aHasParams && !bHasParams) return 1;
1192
- return 0;
1193
- });
1194
- return routes;
1195
- }
1196
- return {
1197
- /**
1198
- * Check if a screen exists by screenId only (globally unique).
1199
- */
1200
- hasScreenById(screenId) {
1201
- const allRoutes = buildRoutes();
1202
- return allRoutes.some((route) => route.screenId === screenId);
1203
- },
1204
- /**
1205
- * Check if a screen exists by both screensetId and screenId (explicit lookup when screenset context is known).
1206
- */
1207
- hasScreen(screensetId, screenId) {
1208
- const allRoutes = buildRoutes();
1209
- return allRoutes.some(
1210
- (route) => route.screensetId === screensetId && route.screenId === screenId
1211
- );
1212
- },
1213
- /**
1214
- * Get screenset ID for a given screen ID (reverse lookup).
1215
- * Screen IDs are globally unique across all screensets.
1216
- */
1217
- getScreensetForScreen(screenId) {
1218
- const allRoutes = buildRoutes();
1219
- const route = allRoutes.find((r) => r.screenId === screenId);
1220
- return route?.screensetId;
1221
- },
1222
- /**
1223
- * Get screen loader by screenId only.
1224
- */
1225
- getScreenById(screenId) {
1226
- const allRoutes = buildRoutes();
1227
- const route = allRoutes.find((r) => r.screenId === screenId);
1228
- return route?.loader;
1229
- },
1230
- /**
1231
- * Get screen loader by both screensetId and screenId (explicit lookup when screenset context is known).
1232
- */
1233
- getScreen(screensetId, screenId) {
1234
- const allRoutes = buildRoutes();
1235
- const route = allRoutes.find(
1236
- (r) => r.screensetId === screensetId && r.screenId === screenId
1237
- );
1238
- return route?.loader;
1239
- },
1240
- /**
1241
- * Get all routes.
1242
- */
1243
- getAll() {
1244
- const allRoutes = buildRoutes();
1245
- return allRoutes.map(({ screensetId, screenId }) => ({
1246
- screensetId,
1247
- screenId
1248
- }));
1249
- },
1250
- /**
1251
- * Match a URL path against registered routes, extracting params.
1252
- * Returns the first matching route with extracted params, or undefined if no match.
1253
- */
1254
- matchRoute(path) {
1255
- const allRoutes = buildRoutes();
1256
- const compiledRoutes = allRoutes.map((r) => r.compiledRoute);
1257
- return matchPath(path, compiledRoutes);
1258
- },
1259
- /**
1260
- * Generate a URL path for a screen with given params.
1261
- */
1262
- generatePath(screenId, params = {}) {
1263
- const allRoutes = buildRoutes();
1264
- const route = allRoutes.find((r) => r.screenId === screenId);
1265
- if (!route) {
1266
- console.warn(`Route not found for screen: ${screenId}`);
1267
- return `/${screenId}`;
1268
- }
1269
- return generatePath(route.compiledRoute, params);
1270
- },
1271
- /**
1272
- * Get the route pattern for a screen.
1273
- */
1274
- getRoutePattern(screenId) {
1275
- const allRoutes = buildRoutes();
1276
- const route = allRoutes.find((r) => r.screenId === screenId);
1277
- return route?.pattern;
1278
- }
1279
- };
1280
- }
1281
-
1282
- // src/plugins/routing.ts
1283
- function routing() {
1284
- return {
1285
- name: "routing",
1286
- dependencies: ["screensets"],
1287
- onRegister(_app) {
1288
- },
1289
- onInit(app) {
1290
- const routeRegistry = createRouteRegistry(app.screensetRegistry);
1291
- app.routeRegistry = routeRegistry;
1292
- }
1293
- };
1294
- }
1295
-
1296
- // src/plugins/i18n.ts
1297
- var import_state14 = require("@hai3/state");
1298
- var import_i18n2 = require("@hai3/i18n");
942
+ var import_screensets2 = require("@hai3/screensets");
1299
943
  function setLanguage(payload) {
1300
- import_state14.eventBus.emit("i18n/language/changed", payload);
944
+ import_state13.eventBus.emit("i18n/language/changed", payload);
1301
945
  }
1302
946
  function i18n() {
1303
- const i18nRegistry3 = import_i18n2.i18nRegistry;
947
+ const i18nRegistry2 = import_i18n.i18nRegistry;
1304
948
  return {
1305
949
  name: "i18n",
1306
950
  dependencies: [],
1307
951
  provides: {
1308
952
  registries: {
1309
- i18nRegistry: i18nRegistry3
953
+ i18nRegistry: i18nRegistry2
1310
954
  },
1311
955
  actions: {
1312
956
  setLanguage
1313
957
  }
1314
958
  },
1315
- onInit(_app) {
1316
- import_state14.eventBus.on("i18n/language/changed", async (payload) => {
1317
- await i18nRegistry3.setLanguage(payload.language);
959
+ // @cpt-begin:cpt-hai3-flow-framework-composition-i18n-propagation:p1:inst-2
960
+ // @cpt-begin:cpt-hai3-dod-framework-composition-propagation:p1:inst-2
961
+ onInit(app) {
962
+ import_state13.eventBus.on("i18n/language/changed", async (payload) => {
963
+ await i18nRegistry2.setLanguage(payload.language);
964
+ try {
965
+ app.screensetsRegistry?.updateSharedProperty(import_screensets2.HAI3_SHARED_PROPERTY_LANGUAGE, payload.language);
966
+ } catch (error) {
967
+ console.error("[HAI3] Failed to propagate language to MFE domains", error);
968
+ }
1318
969
  });
1319
- i18nRegistry3.setLanguage(import_i18n2.Language.English).catch((err) => {
970
+ i18nRegistry2.setLanguage(import_i18n.Language.English).catch((err) => {
1320
971
  console.warn("[HAI3] Failed to load initial translations:", err);
1321
972
  });
1322
973
  }
974
+ // @cpt-end:cpt-hai3-flow-framework-composition-i18n-propagation:p1:inst-2
975
+ // @cpt-end:cpt-hai3-dod-framework-composition-propagation:p1:inst-2
1323
976
  };
1324
977
  }
1325
978
 
@@ -1328,16 +981,13 @@ function effects() {
1328
981
  return {
1329
982
  name: "effects",
1330
983
  dependencies: [],
1331
- onInit(app) {
1332
- if (app.config.devMode) {
1333
- console.log("[HAI3] Effects plugin initialized");
1334
- }
984
+ onInit() {
1335
985
  }
1336
986
  };
1337
987
  }
1338
988
 
1339
989
  // src/effects/mockEffects.ts
1340
- var import_state15 = require("@hai3/state");
990
+ var import_state14 = require("@hai3/state");
1341
991
  var import_api2 = require("@hai3/api");
1342
992
  function hasPluginManagement(protocol) {
1343
993
  return "plugins" in protocol && typeof protocol.plugins === "object";
@@ -1366,8 +1016,8 @@ function syncMockPlugins(enabled) {
1366
1016
  }
1367
1017
  }
1368
1018
  function initMockEffects() {
1369
- const store = (0, import_state15.getStore)();
1370
- const unsubscribe = import_state15.eventBus.on(MockEvents.Toggle, (payload) => {
1019
+ const store = (0, import_state14.getStore)();
1020
+ const unsubscribe = import_state14.eventBus.on(MockEvents.Toggle, (payload) => {
1371
1021
  store.dispatch(setMockEnabled(payload.enabled));
1372
1022
  syncMockPlugins(payload.enabled);
1373
1023
  });
@@ -1380,7 +1030,7 @@ function initMockEffects() {
1380
1030
  };
1381
1031
  }
1382
1032
  function toggleMockMode(enabled) {
1383
- import_state15.eventBus.emit(MockEvents.Toggle, { enabled });
1033
+ import_state14.eventBus.emit(MockEvents.Toggle, { enabled });
1384
1034
  }
1385
1035
 
1386
1036
  // src/plugins/mock.ts
@@ -1406,9 +1056,6 @@ function mock(config) {
1406
1056
  const enabledByDefault = config?.enabledByDefault ?? isDev;
1407
1057
  if (enabledByDefault) {
1408
1058
  toggleMockMode(true);
1409
- if (isDev) {
1410
- console.log("[HAI3] Mock mode enabled by default (dev environment detected)");
1411
- }
1412
1059
  }
1413
1060
  },
1414
1061
  onDestroy() {
@@ -1420,18 +1067,299 @@ function mock(config) {
1420
1067
  };
1421
1068
  }
1422
1069
 
1070
+ // src/plugins/microfrontends/index.ts
1071
+ var import_screensets5 = require("@hai3/screensets");
1072
+ var import_state18 = require("@hai3/state");
1073
+
1074
+ // src/plugins/microfrontends/slice.ts
1075
+ var import_state15 = require("@hai3/state");
1076
+ var SLICE_KEY10 = "mfe";
1077
+ var initialState10 = {
1078
+ registrationStates: {},
1079
+ errors: {},
1080
+ mountedExtensions: {}
1081
+ };
1082
+ var { slice: slice10, ...actions } = (0, import_state15.createSlice)({
1083
+ name: SLICE_KEY10,
1084
+ initialState: initialState10,
1085
+ reducers: {
1086
+ // Registration state reducers
1087
+ setExtensionRegistering: (state, action) => {
1088
+ state.registrationStates[action.payload.extensionId] = "registering";
1089
+ },
1090
+ setExtensionRegistered: (state, action) => {
1091
+ state.registrationStates[action.payload.extensionId] = "registered";
1092
+ },
1093
+ setExtensionUnregistered: (state, action) => {
1094
+ state.registrationStates[action.payload.extensionId] = "unregistered";
1095
+ },
1096
+ setExtensionError: (state, action) => {
1097
+ state.registrationStates[action.payload.extensionId] = "error";
1098
+ state.errors[action.payload.extensionId] = action.payload.error;
1099
+ },
1100
+ // Mount state reducers
1101
+ setExtensionMounted: (state, action) => {
1102
+ state.mountedExtensions[action.payload.domainId] = action.payload.extensionId;
1103
+ },
1104
+ setExtensionUnmounted: (state, action) => {
1105
+ state.mountedExtensions[action.payload.domainId] = void 0;
1106
+ }
1107
+ }
1108
+ });
1109
+ var mfeSlice = slice10;
1110
+ var {
1111
+ setExtensionRegistering,
1112
+ setExtensionRegistered,
1113
+ setExtensionUnregistered,
1114
+ setExtensionError,
1115
+ setExtensionMounted,
1116
+ setExtensionUnmounted
1117
+ } = actions;
1118
+ function selectExtensionState(state, extensionId) {
1119
+ return state.mfe.registrationStates[extensionId] ?? "unregistered";
1120
+ }
1121
+ function selectRegisteredExtensions(state) {
1122
+ return Object.entries(state.mfe.registrationStates).filter(([_, regState]) => regState === "registered").map(([extensionId]) => extensionId);
1123
+ }
1124
+ function selectExtensionError(state, extensionId) {
1125
+ return state.mfe.errors[extensionId];
1126
+ }
1127
+ var slice_default = slice10.reducer;
1128
+
1129
+ // src/plugins/microfrontends/effects.ts
1130
+ var import_state16 = require("@hai3/state");
1131
+
1132
+ // src/plugins/microfrontends/constants.ts
1133
+ var HAI3_POPUP_DOMAIN = "gts.hai3.mfes.ext.domain.v1~hai3.screensets.layout.popup.v1";
1134
+ var HAI3_SIDEBAR_DOMAIN = "gts.hai3.mfes.ext.domain.v1~hai3.screensets.layout.sidebar.v1";
1135
+ var HAI3_SCREEN_DOMAIN = "gts.hai3.mfes.ext.domain.v1~hai3.screensets.layout.screen.v1";
1136
+ var HAI3_OVERLAY_DOMAIN = "gts.hai3.mfes.ext.domain.v1~hai3.screensets.layout.overlay.v1";
1137
+ var MfeEvents = {
1138
+ RegisterExtensionRequested: "mfe/registerExtensionRequested",
1139
+ UnregisterExtensionRequested: "mfe/unregisterExtensionRequested"
1140
+ };
1141
+
1142
+ // src/plugins/microfrontends/effects.ts
1143
+ function initMfeEffects(screensetsRegistry2) {
1144
+ const store = (0, import_state16.getStore)();
1145
+ const unsubscribers = [];
1146
+ const unsubRegisterExtension = import_state16.eventBus.on(MfeEvents.RegisterExtensionRequested, async (payload) => {
1147
+ const { extension } = payload;
1148
+ try {
1149
+ store.dispatch(setExtensionRegistering({ extensionId: extension.id }));
1150
+ await screensetsRegistry2.registerExtension(extension);
1151
+ store.dispatch(setExtensionRegistered({ extensionId: extension.id }));
1152
+ } catch (error) {
1153
+ const errorMessage = error instanceof Error ? error.message : "Unknown registration error";
1154
+ store.dispatch(setExtensionError({ extensionId: extension.id, error: errorMessage }));
1155
+ }
1156
+ });
1157
+ unsubscribers.push(unsubRegisterExtension);
1158
+ const unsubUnregisterExtension = import_state16.eventBus.on(MfeEvents.UnregisterExtensionRequested, async (payload) => {
1159
+ const { extensionId } = payload;
1160
+ try {
1161
+ await screensetsRegistry2.unregisterExtension(extensionId);
1162
+ store.dispatch(setExtensionUnregistered({ extensionId }));
1163
+ } catch (error) {
1164
+ const errorMessage = error instanceof Error ? error.message : "Unknown unregistration error";
1165
+ store.dispatch(setExtensionError({ extensionId, error: errorMessage }));
1166
+ }
1167
+ });
1168
+ unsubscribers.push(unsubUnregisterExtension);
1169
+ return () => {
1170
+ unsubscribers.forEach((unsub) => unsub.unsubscribe());
1171
+ };
1172
+ }
1173
+
1174
+ // src/plugins/microfrontends/actions.ts
1175
+ var import_state17 = require("@hai3/state");
1176
+ var import_screensets3 = require("@hai3/screensets");
1177
+ var screensetsRegistry = null;
1178
+ function setMfeRegistry(registry) {
1179
+ screensetsRegistry = registry;
1180
+ }
1181
+ function resolveDomainId(extensionId) {
1182
+ if (!screensetsRegistry) {
1183
+ throw new Error("MFE registry not initialized. Call setMfeRegistry() before using lifecycle actions.");
1184
+ }
1185
+ const extension = screensetsRegistry.getExtension(extensionId);
1186
+ if (!extension) {
1187
+ throw new Error(`Extension '${extensionId}' is not registered. Register it before calling lifecycle actions.`);
1188
+ }
1189
+ return extension.domain;
1190
+ }
1191
+ function loadExtension(extensionId) {
1192
+ const domainId = resolveDomainId(extensionId);
1193
+ screensetsRegistry.executeActionsChain({
1194
+ action: {
1195
+ type: import_screensets3.HAI3_ACTION_LOAD_EXT,
1196
+ target: domainId,
1197
+ payload: { extensionId }
1198
+ }
1199
+ }).catch((error) => {
1200
+ console.error(`[MFE] Load failed for ${extensionId}:`, error);
1201
+ });
1202
+ }
1203
+ function mountExtension(extensionId) {
1204
+ const domainId = resolveDomainId(extensionId);
1205
+ screensetsRegistry.executeActionsChain({
1206
+ action: {
1207
+ type: import_screensets3.HAI3_ACTION_MOUNT_EXT,
1208
+ target: domainId,
1209
+ payload: { extensionId }
1210
+ }
1211
+ }).catch((error) => {
1212
+ console.error(`[MFE] Mount failed for ${extensionId}:`, error);
1213
+ });
1214
+ }
1215
+ function unmountExtension(extensionId) {
1216
+ const domainId = resolveDomainId(extensionId);
1217
+ screensetsRegistry.executeActionsChain({
1218
+ action: {
1219
+ type: import_screensets3.HAI3_ACTION_UNMOUNT_EXT,
1220
+ target: domainId,
1221
+ payload: { extensionId }
1222
+ }
1223
+ }).catch((error) => {
1224
+ console.error(`[MFE] Unmount failed for ${extensionId}:`, error);
1225
+ });
1226
+ }
1227
+ function registerExtension(extension) {
1228
+ import_state17.eventBus.emit(MfeEvents.RegisterExtensionRequested, { extension });
1229
+ }
1230
+ function unregisterExtension(extensionId) {
1231
+ import_state17.eventBus.emit(MfeEvents.UnregisterExtensionRequested, { extensionId });
1232
+ }
1233
+
1234
+ // src/plugins/microfrontends/base-domains.ts
1235
+ var import_screensets4 = require("@hai3/screensets");
1236
+ var INIT_ONLY_LIFECYCLE_STAGES = [
1237
+ "gts.hai3.mfes.lifecycle.stage.v1~hai3.mfes.lifecycle.init.v1"
1238
+ ];
1239
+ var DEFAULT_LIFECYCLE_STAGES = [
1240
+ "gts.hai3.mfes.lifecycle.stage.v1~hai3.mfes.lifecycle.init.v1",
1241
+ "gts.hai3.mfes.lifecycle.stage.v1~hai3.mfes.lifecycle.activated.v1",
1242
+ "gts.hai3.mfes.lifecycle.stage.v1~hai3.mfes.lifecycle.deactivated.v1",
1243
+ "gts.hai3.mfes.lifecycle.stage.v1~hai3.mfes.lifecycle.destroyed.v1"
1244
+ ];
1245
+ var screenDomain = {
1246
+ id: HAI3_SCREEN_DOMAIN,
1247
+ actions: [import_screensets4.HAI3_ACTION_LOAD_EXT, import_screensets4.HAI3_ACTION_MOUNT_EXT],
1248
+ extensionsActions: [],
1249
+ sharedProperties: [import_screensets4.HAI3_SHARED_PROPERTY_THEME, import_screensets4.HAI3_SHARED_PROPERTY_LANGUAGE],
1250
+ defaultActionTimeout: 3e4,
1251
+ lifecycleStages: [...INIT_ONLY_LIFECYCLE_STAGES],
1252
+ extensionsLifecycleStages: [...DEFAULT_LIFECYCLE_STAGES],
1253
+ extensionsTypeId: import_screensets4.HAI3_SCREEN_EXTENSION_TYPE,
1254
+ lifecycle: void 0
1255
+ };
1256
+ var sidebarDomain = {
1257
+ id: HAI3_SIDEBAR_DOMAIN,
1258
+ actions: [import_screensets4.HAI3_ACTION_LOAD_EXT, import_screensets4.HAI3_ACTION_MOUNT_EXT, import_screensets4.HAI3_ACTION_UNMOUNT_EXT],
1259
+ extensionsActions: [],
1260
+ sharedProperties: [import_screensets4.HAI3_SHARED_PROPERTY_THEME, import_screensets4.HAI3_SHARED_PROPERTY_LANGUAGE],
1261
+ defaultActionTimeout: 3e4,
1262
+ lifecycleStages: [...DEFAULT_LIFECYCLE_STAGES],
1263
+ extensionsLifecycleStages: [...DEFAULT_LIFECYCLE_STAGES],
1264
+ lifecycle: void 0
1265
+ };
1266
+ var popupDomain = {
1267
+ id: HAI3_POPUP_DOMAIN,
1268
+ actions: [import_screensets4.HAI3_ACTION_LOAD_EXT, import_screensets4.HAI3_ACTION_MOUNT_EXT, import_screensets4.HAI3_ACTION_UNMOUNT_EXT],
1269
+ extensionsActions: [],
1270
+ sharedProperties: [import_screensets4.HAI3_SHARED_PROPERTY_THEME, import_screensets4.HAI3_SHARED_PROPERTY_LANGUAGE],
1271
+ defaultActionTimeout: 3e4,
1272
+ lifecycleStages: [...DEFAULT_LIFECYCLE_STAGES],
1273
+ extensionsLifecycleStages: [...DEFAULT_LIFECYCLE_STAGES],
1274
+ lifecycle: void 0
1275
+ };
1276
+ var overlayDomain = {
1277
+ id: HAI3_OVERLAY_DOMAIN,
1278
+ actions: [import_screensets4.HAI3_ACTION_LOAD_EXT, import_screensets4.HAI3_ACTION_MOUNT_EXT, import_screensets4.HAI3_ACTION_UNMOUNT_EXT],
1279
+ extensionsActions: [],
1280
+ sharedProperties: [import_screensets4.HAI3_SHARED_PROPERTY_THEME, import_screensets4.HAI3_SHARED_PROPERTY_LANGUAGE],
1281
+ defaultActionTimeout: 3e4,
1282
+ lifecycleStages: [...DEFAULT_LIFECYCLE_STAGES],
1283
+ extensionsLifecycleStages: [...DEFAULT_LIFECYCLE_STAGES],
1284
+ lifecycle: void 0
1285
+ };
1286
+
1287
+ // src/plugins/microfrontends/index.ts
1288
+ function microfrontends(config) {
1289
+ const screensetsRegistry2 = import_screensets5.screensetsRegistryFactory.build({
1290
+ typeSystem: config.typeSystem,
1291
+ mfeHandlers: config.mfeHandlers
1292
+ });
1293
+ const originalExecuteActionsChain = screensetsRegistry2.executeActionsChain.bind(screensetsRegistry2);
1294
+ screensetsRegistry2.executeActionsChain = async (chain) => {
1295
+ await originalExecuteActionsChain(chain);
1296
+ const actionType = chain.action?.type;
1297
+ if (actionType === import_screensets5.HAI3_ACTION_MOUNT_EXT) {
1298
+ const store = (0, import_state18.getStore)();
1299
+ const domainId = chain.action.target;
1300
+ const extensionId = chain.action.payload?.extensionId;
1301
+ if (domainId && extensionId) {
1302
+ store.dispatch(setExtensionMounted({ domainId, extensionId }));
1303
+ }
1304
+ } else if (actionType === import_screensets5.HAI3_ACTION_UNMOUNT_EXT) {
1305
+ const store = (0, import_state18.getStore)();
1306
+ const domainId = chain.action.target;
1307
+ if (domainId) {
1308
+ store.dispatch(setExtensionUnmounted({ domainId }));
1309
+ }
1310
+ }
1311
+ };
1312
+ let effectsCleanup = null;
1313
+ return {
1314
+ name: "microfrontends",
1315
+ dependencies: ["screensets"],
1316
+ // Requires screensets to be initialized
1317
+ provides: {
1318
+ registries: {
1319
+ // Expose the MFE-enabled ScreensetsRegistry
1320
+ // This registry has registerDomain(), registerExtension(), etc.
1321
+ screensetsRegistry: screensetsRegistry2
1322
+ },
1323
+ slices: [mfeSlice],
1324
+ // NOTE: Effects are NOT initialized via provides.effects.
1325
+ // They are initialized in onInit to capture cleanup references.
1326
+ // The framework calls provides.effects at build step 5, then onInit at step 7.
1327
+ // We only initialize effects in onInit to avoid duplicate event listeners.
1328
+ actions: {
1329
+ loadExtension,
1330
+ mountExtension,
1331
+ unmountExtension,
1332
+ registerExtension,
1333
+ unregisterExtension
1334
+ }
1335
+ },
1336
+ onInit() {
1337
+ setMfeRegistry(screensetsRegistry2);
1338
+ effectsCleanup = initMfeEffects(screensetsRegistry2);
1339
+ },
1340
+ onDestroy() {
1341
+ if (effectsCleanup) {
1342
+ effectsCleanup();
1343
+ effectsCleanup = null;
1344
+ }
1345
+ }
1346
+ };
1347
+ }
1348
+
1423
1349
  // src/presets/index.ts
1424
1350
  function full(config) {
1425
- return [
1351
+ const plugins = [
1426
1352
  effects(),
1427
1353
  screensets({ autoDiscover: true }),
1428
1354
  themes(config?.themes),
1429
1355
  layout(),
1430
- routing(),
1431
- navigation(),
1432
1356
  i18n(),
1433
1357
  mock()
1434
1358
  ];
1359
+ if (config?.microfrontends) {
1360
+ plugins.push(microfrontends(config.microfrontends));
1361
+ }
1362
+ return plugins;
1435
1363
  }
1436
1364
  function minimal() {
1437
1365
  return [
@@ -1452,28 +1380,35 @@ var presets = {
1452
1380
 
1453
1381
  // src/createHAI3App.ts
1454
1382
  function createHAI3App(config) {
1455
- return createHAI3(config).useAll(full({ themes: config?.themes })).build();
1383
+ return createHAI3(config).useAll(full({
1384
+ themes: config?.themes,
1385
+ microfrontends: config?.microfrontends
1386
+ })).build();
1456
1387
  }
1457
1388
 
1458
- // src/registries/index.ts
1459
- var import_screensets4 = require("@hai3/screensets");
1460
-
1461
1389
  // src/index.ts
1462
- var import_state17 = require("@hai3/state");
1463
- var import_screensets6 = require("@hai3/screensets");
1390
+ var import_screensets8 = require("@hai3/screensets");
1391
+ var import_screensets9 = require("@hai3/screensets");
1392
+ var import_screensets10 = require("@hai3/screensets");
1393
+ var import_screensets11 = require("@hai3/screensets");
1394
+ var import_handler = require("@hai3/screensets/mfe/handler");
1395
+ var import_gts = require("@hai3/screensets/plugins/gts");
1396
+ var import_screensets12 = require("@hai3/screensets");
1397
+ var import_state21 = require("@hai3/state");
1398
+ var import_screensets13 = require("@hai3/screensets");
1464
1399
 
1465
1400
  // src/effects/tenantEffects.ts
1466
- var import_state16 = require("@hai3/state");
1401
+ var import_state19 = require("@hai3/state");
1467
1402
  var TenantEvents = {
1468
1403
  Changed: "app/tenant/changed",
1469
1404
  Cleared: "app/tenant/cleared"
1470
1405
  };
1471
1406
  function initTenantEffects() {
1472
- const store = (0, import_state16.getStore)();
1473
- const subChanged = import_state16.eventBus.on(TenantEvents.Changed, (payload) => {
1407
+ const store = (0, import_state19.getStore)();
1408
+ const subChanged = import_state19.eventBus.on(TenantEvents.Changed, (payload) => {
1474
1409
  store.dispatch(setTenant(payload.tenant));
1475
1410
  });
1476
- const subCleared = import_state16.eventBus.on(TenantEvents.Cleared, () => {
1411
+ const subCleared = import_state19.eventBus.on(TenantEvents.Cleared, () => {
1477
1412
  store.dispatch(clearTenant());
1478
1413
  });
1479
1414
  return () => {
@@ -1481,23 +1416,26 @@ function initTenantEffects() {
1481
1416
  subCleared.unsubscribe();
1482
1417
  };
1483
1418
  }
1419
+
1420
+ // src/effects/tenantActions.ts
1421
+ var import_state20 = require("@hai3/state");
1484
1422
  function changeTenant(tenant) {
1485
- import_state16.eventBus.emit(TenantEvents.Changed, { tenant });
1423
+ import_state20.eventBus.emit(TenantEvents.Changed, { tenant });
1486
1424
  }
1487
1425
  function clearTenantAction() {
1488
- import_state16.eventBus.emit(TenantEvents.Cleared, {});
1426
+ import_state20.eventBus.emit(TenantEvents.Cleared, {});
1489
1427
  }
1490
1428
  function setTenantLoadingState(loading) {
1491
- (0, import_state16.getStore)().dispatch(setTenantLoading(loading));
1429
+ (0, import_state20.getStore)().dispatch(setTenantLoading(loading));
1492
1430
  }
1493
1431
 
1494
1432
  // src/index.ts
1495
1433
  var import_api3 = require("@hai3/api");
1434
+ var import_i18n4 = require("@hai3/i18n");
1496
1435
  var import_i18n5 = require("@hai3/i18n");
1497
1436
  var import_i18n6 = require("@hai3/i18n");
1498
1437
 
1499
1438
  // src/compat.ts
1500
- var import_screensets5 = require("@hai3/screensets");
1501
1439
  var ACCOUNTS_DOMAIN = "accounts";
1502
1440
 
1503
1441
  // src/migration.ts
@@ -1560,6 +1498,18 @@ function hasNewLayoutState(state) {
1560
1498
  ApiPluginBase,
1561
1499
  ApiProtocol,
1562
1500
  BaseApiService,
1501
+ ContainerProvider,
1502
+ HAI3_ACTION_LOAD_EXT,
1503
+ HAI3_ACTION_MOUNT_EXT,
1504
+ HAI3_ACTION_UNMOUNT_EXT,
1505
+ HAI3_MFE_ENTRY_MF,
1506
+ HAI3_OVERLAY_DOMAIN,
1507
+ HAI3_POPUP_DOMAIN,
1508
+ HAI3_SCREEN_DOMAIN,
1509
+ HAI3_SCREEN_EXTENSION_TYPE,
1510
+ HAI3_SHARED_PROPERTY_LANGUAGE,
1511
+ HAI3_SHARED_PROPERTY_THEME,
1512
+ HAI3_SIDEBAR_DOMAIN,
1563
1513
  I18nRegistry,
1564
1514
  I18nRegistryImpl,
1565
1515
  LAYOUT_SLICE_NAME,
@@ -1567,6 +1517,9 @@ function hasNewLayoutState(state) {
1567
1517
  LanguageDisplayMode,
1568
1518
  LayoutDomain,
1569
1519
  MOCK_PLUGIN,
1520
+ MfeBridgeFactory,
1521
+ MfeHandler,
1522
+ MfeHandlerMF,
1570
1523
  MockEventSource,
1571
1524
  MockEvents,
1572
1525
  RestMockPlugin,
@@ -1575,7 +1528,8 @@ function hasNewLayoutState(state) {
1575
1528
  RestProtocol,
1576
1529
  STATE_PATH_MAPPING,
1577
1530
  SUPPORTED_LANGUAGES,
1578
- ScreensetCategory,
1531
+ ScreensetsRegistry,
1532
+ ScreensetsRegistryFactory,
1579
1533
  SseMockPlugin,
1580
1534
  SsePlugin,
1581
1535
  SsePluginWithConfig,
@@ -1592,23 +1546,34 @@ function hasNewLayoutState(state) {
1592
1546
  closeAllPopups,
1593
1547
  closePopup,
1594
1548
  closeTopPopup,
1549
+ compareStrings,
1550
+ createCollator,
1595
1551
  createHAI3,
1596
1552
  createHAI3App,
1597
1553
  createI18nRegistry,
1598
1554
  createLegacySelector,
1599
- createRouteRegistry,
1600
- createScreensetRegistry,
1555
+ createShadowRoot,
1601
1556
  createSlice,
1602
1557
  createStore,
1603
1558
  createThemeRegistry,
1604
1559
  effects,
1605
1560
  eventBus,
1561
+ extractGtsPackage,
1606
1562
  footerActions,
1607
1563
  footerSlice,
1564
+ formatCompact,
1565
+ formatCurrency,
1566
+ formatDate,
1567
+ formatDateTime,
1568
+ formatNumber,
1569
+ formatPercent,
1570
+ formatRelative,
1571
+ formatTime,
1608
1572
  full,
1609
1573
  getLanguageMetadata,
1610
1574
  getLayoutDomainState,
1611
1575
  getStore,
1576
+ gtsPlugin,
1612
1577
  hasLegacyUicoreState,
1613
1578
  hasNewLayoutState,
1614
1579
  hasSlice,
@@ -1620,6 +1585,7 @@ function hasNewLayoutState(state) {
1620
1585
  i18nRegistry,
1621
1586
  initMockEffects,
1622
1587
  initTenantEffects,
1588
+ injectCssVariables,
1623
1589
  isDeprecationWarningsEnabled,
1624
1590
  isMockPlugin,
1625
1591
  isRestShortCircuit,
@@ -1628,26 +1594,34 @@ function hasNewLayoutState(state) {
1628
1594
  layout,
1629
1595
  layoutDomainReducers,
1630
1596
  layoutReducer,
1597
+ loadExtension,
1631
1598
  menuActions,
1632
1599
  menuSlice,
1600
+ microfrontends,
1633
1601
  minimal,
1634
1602
  mock,
1635
1603
  mockActions,
1636
1604
  mockSlice,
1605
+ mountExtension,
1637
1606
  navigateTo,
1638
- navigation,
1639
1607
  openPopup,
1640
1608
  overlayActions,
1609
+ overlayDomain,
1641
1610
  overlaySlice,
1642
1611
  popupActions,
1612
+ popupDomain,
1643
1613
  popupSlice,
1644
1614
  presets,
1615
+ registerExtension,
1645
1616
  registerSlice,
1646
- routing,
1647
1617
  screenActions,
1618
+ screenDomain,
1648
1619
  screenSlice,
1649
- screensetRegistry,
1650
1620
  screensets,
1621
+ screensetsRegistryFactory,
1622
+ selectExtensionError,
1623
+ selectExtensionState,
1624
+ selectRegisteredExtensions,
1651
1625
  setActiveScreen,
1652
1626
  setDeprecationWarnings,
1653
1627
  setFooterConfig,
@@ -1673,6 +1647,7 @@ function hasNewLayoutState(state) {
1673
1647
  setUser,
1674
1648
  showOverlay,
1675
1649
  sidebarActions,
1650
+ sidebarDomain,
1676
1651
  sidebarSlice,
1677
1652
  tenantActions,
1678
1653
  tenantReducer,
@@ -1680,6 +1655,8 @@ function hasNewLayoutState(state) {
1680
1655
  themes,
1681
1656
  toggleMenu,
1682
1657
  toggleMockMode,
1683
- toggleSidebar
1658
+ toggleSidebar,
1659
+ unmountExtension,
1660
+ unregisterExtension
1684
1661
  });
1685
1662
  //# sourceMappingURL=index.cjs.map