@gears-frontx/react 0.1.0 → 0.2.0-alpha.15
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/CLAUDE.md +247 -64
- package/dist/index.cjs +1338 -434
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +653 -146
- package/dist/index.d.ts +653 -146
- package/dist/index.js +1179 -276
- package/dist/index.js.map +1 -1
- package/dist/testing-Dlmfu6tE.d.cts +56 -0
- package/dist/testing-Dlmfu6tE.d.ts +56 -0
- package/dist/testing.cjs +77 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +4 -0
- package/dist/testing.d.ts +4 -0
- package/dist/testing.js +56 -0
- package/dist/testing.js.map +1 -0
- package/dist/types-JtpziA_B.d.cts +224 -0
- package/dist/types-JtpziA_B.d.ts +224 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/llms.txt +49 -23
- package/package.json +40 -23
- package/commands/hai3-duplicate-screenset.md +0 -58
- package/commands/hai3-new-component.md +0 -48
- package/commands/hai3-new-mfe.md +0 -166
- package/commands/hai3-new-screen.md +0 -39
- package/commands/hai3-new-screenset.md +0 -47
- package/dist/types-Cp8Zm5s0.d.cts +0 -136
- package/dist/types-Cp8Zm5s0.d.ts +0 -136
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,174 +17,194 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var src_exports = {};
|
|
22
32
|
__export(src_exports, {
|
|
23
|
-
ACCOUNTS_DOMAIN: () =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
ACCOUNTS_DOMAIN: () => import_framework4.ACCOUNTS_DOMAIN,
|
|
34
|
+
ActionHandler: () => import_framework13.ActionHandler,
|
|
35
|
+
ApiPlugin: () => import_framework4.ApiPlugin,
|
|
36
|
+
ApiPluginBase: () => import_framework4.ApiPluginBase,
|
|
37
|
+
ApiProtocol: () => import_framework4.ApiProtocol,
|
|
38
|
+
AuthEvents: () => import_framework4.AuthEvents,
|
|
39
|
+
BaseApiService: () => import_framework4.BaseApiService,
|
|
40
|
+
CanAccess: () => CanAccess,
|
|
41
|
+
ChildMfeBridge: () => import_framework13.ChildMfeBridge,
|
|
42
|
+
ConcurrentMountStrategy: () => import_framework13.ConcurrentMountStrategy,
|
|
43
|
+
ExclusiveMountStrategy: () => import_framework13.ExclusiveMountStrategy,
|
|
44
|
+
ExtensionDomainImplementation: () => import_framework13.ExtensionDomainImplementation,
|
|
45
|
+
ExtensionDomainImplementationFactory: () => import_framework13.ExtensionDomainImplementationFactory,
|
|
29
46
|
ExtensionDomainSlot: () => ExtensionDomainSlot,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
MOCK_PLUGIN: () =>
|
|
50
|
-
MfeBridgeFactory: () =>
|
|
47
|
+
ExtensionMounter: () => import_framework13.ExtensionMounter,
|
|
48
|
+
FRONTX_ACTION_LOAD_EXT: () => import_framework11.FRONTX_ACTION_LOAD_EXT,
|
|
49
|
+
FRONTX_ACTION_MOUNT_EXT: () => import_framework11.FRONTX_ACTION_MOUNT_EXT,
|
|
50
|
+
FRONTX_ACTION_UNMOUNT_EXT: () => import_framework11.FRONTX_ACTION_UNMOUNT_EXT,
|
|
51
|
+
FRONTX_MFE_ENTRY_MF: () => import_framework10.FRONTX_MFE_ENTRY_MF,
|
|
52
|
+
FRONTX_OVERLAY_DOMAIN: () => import_framework9.FRONTX_OVERLAY_DOMAIN,
|
|
53
|
+
FRONTX_POPUP_DOMAIN: () => import_framework9.FRONTX_POPUP_DOMAIN,
|
|
54
|
+
FRONTX_SCREEN_DOMAIN: () => import_framework9.FRONTX_SCREEN_DOMAIN,
|
|
55
|
+
FRONTX_SCREEN_EXTENSION_TYPE: () => import_framework10.FRONTX_SCREEN_EXTENSION_TYPE,
|
|
56
|
+
FRONTX_SHARED_PROPERTY_LANGUAGE: () => import_framework12.FRONTX_SHARED_PROPERTY_LANGUAGE,
|
|
57
|
+
FRONTX_SHARED_PROPERTY_THEME: () => import_framework12.FRONTX_SHARED_PROPERTY_THEME,
|
|
58
|
+
FRONTX_SIDEBAR_DOMAIN: () => import_framework9.FRONTX_SIDEBAR_DOMAIN,
|
|
59
|
+
FrontXContext: () => FrontXContext,
|
|
60
|
+
FrontXProvider: () => FrontXProvider,
|
|
61
|
+
I18nRegistry: () => import_framework4.I18nRegistry,
|
|
62
|
+
I18nRegistryImpl: () => import_framework4.I18nRegistryImpl,
|
|
63
|
+
LAYOUT_SLICE_NAME: () => import_framework4.LAYOUT_SLICE_NAME,
|
|
64
|
+
Language: () => import_framework5.Language,
|
|
65
|
+
LanguageDisplayMode: () => import_framework5.LanguageDisplayMode,
|
|
66
|
+
MOCK_PLUGIN: () => import_framework4.MOCK_PLUGIN,
|
|
67
|
+
MfeBridgeFactory: () => import_framework13.MfeBridgeFactory,
|
|
51
68
|
MfeContext: () => MfeContext,
|
|
52
|
-
MfeHandler: () =>
|
|
53
|
-
MfeHandlerMF: () =>
|
|
69
|
+
MfeHandler: () => import_framework13.MfeHandler,
|
|
70
|
+
MfeHandlerMF: () => import_framework14.MfeHandlerMF,
|
|
54
71
|
MfeProvider: () => MfeProvider,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
SsePlugin: () =>
|
|
67
|
-
SsePluginWithConfig: () =>
|
|
68
|
-
SseProtocol: () =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
extractGtsPackage: () =>
|
|
92
|
-
footerActions: () =>
|
|
93
|
-
footerSlice: () =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
72
|
+
MfeRegistry: () => import_framework13.MfeRegistry,
|
|
73
|
+
MfeRegistryFactory: () => import_framework13.MfeRegistryFactory,
|
|
74
|
+
MockEvents: () => import_framework4.MockEvents,
|
|
75
|
+
MountStrategy: () => import_framework13.MountStrategy,
|
|
76
|
+
OptionalMountStrategy: () => import_framework13.OptionalMountStrategy,
|
|
77
|
+
ParentMfeBridge: () => import_framework13.ParentMfeBridge,
|
|
78
|
+
RestEndpointProtocol: () => import_framework4.RestEndpointProtocol,
|
|
79
|
+
RestPlugin: () => import_framework4.RestPlugin,
|
|
80
|
+
RestPluginWithConfig: () => import_framework4.RestPluginWithConfig,
|
|
81
|
+
RestProtocol: () => import_framework4.RestProtocol,
|
|
82
|
+
SUPPORTED_LANGUAGES: () => import_framework4.SUPPORTED_LANGUAGES,
|
|
83
|
+
SsePlugin: () => import_framework4.SsePlugin,
|
|
84
|
+
SsePluginWithConfig: () => import_framework4.SsePluginWithConfig,
|
|
85
|
+
SseProtocol: () => import_framework4.SseProtocol,
|
|
86
|
+
SseStreamProtocol: () => import_framework4.SseStreamProtocol,
|
|
87
|
+
TENANT_SLICE_NAME: () => import_framework4.TENANT_SLICE_NAME,
|
|
88
|
+
TenantEvents: () => import_framework4.TenantEvents,
|
|
89
|
+
TextDirection: () => import_framework5.TextDirection,
|
|
90
|
+
ThemeAwareReactLifecycle: () => ThemeAwareReactLifecycle,
|
|
91
|
+
apiRegistry: () => import_framework4.apiRegistry,
|
|
92
|
+
auth: () => import_framework4.auth,
|
|
93
|
+
changeTenant: () => import_framework4.changeTenant,
|
|
94
|
+
clearTenant: () => import_framework4.clearTenant,
|
|
95
|
+
clearTenantAction: () => import_framework4.clearTenantAction,
|
|
96
|
+
clearUser: () => import_framework4.clearUser,
|
|
97
|
+
closeAllPopups: () => import_framework4.closeAllPopups,
|
|
98
|
+
closePopup: () => import_framework4.closePopup,
|
|
99
|
+
closeTopPopup: () => import_framework4.closeTopPopup,
|
|
100
|
+
createFrontX: () => import_framework4.createFrontX,
|
|
101
|
+
createI18nRegistry: () => import_framework4.createI18nRegistry,
|
|
102
|
+
createShadowRoot: () => import_framework15.createShadowRoot,
|
|
103
|
+
createSlice: () => import_framework4.createSlice,
|
|
104
|
+
createStore: () => import_framework4.createStore,
|
|
105
|
+
createThemeRegistry: () => import_framework4.createThemeRegistry,
|
|
106
|
+
effects: () => import_framework4.effects,
|
|
107
|
+
eventBus: () => eventBus2,
|
|
108
|
+
extractGtsPackage: () => import_framework15.extractGtsPackage,
|
|
109
|
+
footerActions: () => import_framework4.footerActions,
|
|
110
|
+
footerSlice: () => import_framework4.footerSlice,
|
|
111
|
+
frontxApiTransport: () => import_framework4.frontxApiTransport,
|
|
112
|
+
getLanguageMetadata: () => import_framework4.getLanguageMetadata,
|
|
113
|
+
getStore: () => import_framework4.getStore,
|
|
114
|
+
gtsPlugin: () => import_framework14.gtsPlugin,
|
|
115
|
+
hasSlice: () => import_framework4.hasSlice,
|
|
116
|
+
headerActions: () => import_framework4.headerActions,
|
|
117
|
+
headerSlice: () => import_framework4.headerSlice,
|
|
118
|
+
hideOverlay: () => import_framework4.hideOverlay,
|
|
119
|
+
i18n: () => import_framework4.i18n,
|
|
120
|
+
i18nRegistry: () => import_framework4.i18nRegistry,
|
|
121
|
+
initMockEffects: () => import_framework4.initMockEffects,
|
|
122
|
+
initTenantEffects: () => import_framework4.initTenantEffects,
|
|
123
|
+
injectCssVariables: () => import_framework15.injectCssVariables,
|
|
124
|
+
invalidateQueryCacheForApp: () => invalidateQueryCacheForApp,
|
|
125
|
+
isMockPlugin: () => import_framework4.isMockPlugin,
|
|
126
|
+
isRestShortCircuit: () => import_framework4.isRestShortCircuit,
|
|
127
|
+
isShortCircuit: () => import_framework4.isShortCircuit,
|
|
128
|
+
isSseShortCircuit: () => import_framework4.isSseShortCircuit,
|
|
129
|
+
layout: () => import_framework4.layout,
|
|
130
|
+
layoutDomainReducers: () => import_framework4.layoutDomainReducers,
|
|
131
|
+
layoutReducer: () => import_framework4.layoutReducer,
|
|
132
|
+
loadExtension: () => import_framework7.loadExtension,
|
|
133
|
+
menuActions: () => import_framework4.menuActions,
|
|
134
|
+
menuSlice: () => import_framework4.menuSlice,
|
|
135
|
+
mfeRegistryFactory: () => import_framework13.mfeRegistryFactory,
|
|
136
|
+
microfrontends: () => import_framework6.microfrontends,
|
|
137
|
+
mock: () => import_framework6.mock,
|
|
138
|
+
mockActions: () => import_framework4.mockActions,
|
|
139
|
+
mockSlice: () => import_framework4.mockSlice,
|
|
140
|
+
mountExtension: () => import_framework7.mountExtension,
|
|
141
|
+
openPopup: () => import_framework4.openPopup,
|
|
142
|
+
overlayActions: () => import_framework4.overlayActions,
|
|
143
|
+
overlayDomain: () => import_framework9.overlayDomain,
|
|
144
|
+
overlaySlice: () => import_framework4.overlaySlice,
|
|
145
|
+
popupActions: () => import_framework4.popupActions,
|
|
146
|
+
popupDomain: () => import_framework9.popupDomain,
|
|
147
|
+
popupSlice: () => import_framework4.popupSlice,
|
|
148
|
+
presets: () => import_framework4.presets,
|
|
149
|
+
queryCache: () => import_framework4.queryCache,
|
|
150
|
+
queryCacheShared: () => import_framework4.queryCacheShared,
|
|
151
|
+
registerExtension: () => import_framework7.registerExtension,
|
|
152
|
+
registerSlice: () => import_framework4.registerSlice,
|
|
153
|
+
screenDomain: () => import_framework9.screenDomain,
|
|
154
|
+
selectExtensionError: () => import_framework8.selectExtensionError,
|
|
155
|
+
selectExtensionState: () => import_framework8.selectExtensionState,
|
|
156
|
+
selectRegisteredExtensions: () => import_framework8.selectRegisteredExtensions,
|
|
157
|
+
setFooterConfig: () => import_framework4.setFooterConfig,
|
|
158
|
+
setFooterVisible: () => import_framework4.setFooterVisible,
|
|
159
|
+
setHeaderLoading: () => import_framework4.setHeaderLoading,
|
|
160
|
+
setMenuCollapsed: () => import_framework4.setMenuCollapsed,
|
|
161
|
+
setMenuConfig: () => import_framework4.setMenuConfig,
|
|
162
|
+
setMenuItems: () => import_framework4.setMenuItems,
|
|
163
|
+
setMenuVisible: () => import_framework4.setMenuVisible,
|
|
164
|
+
setMockEnabled: () => import_framework4.setMockEnabled,
|
|
165
|
+
setOverlayVisible: () => import_framework4.setOverlayVisible,
|
|
166
|
+
setSidebarCollapsed: () => import_framework4.setSidebarCollapsed,
|
|
167
|
+
setSidebarConfig: () => import_framework4.setSidebarConfig,
|
|
168
|
+
setSidebarContent: () => import_framework4.setSidebarContent,
|
|
169
|
+
setSidebarPosition: () => import_framework4.setSidebarPosition,
|
|
170
|
+
setSidebarTitle: () => import_framework4.setSidebarTitle,
|
|
171
|
+
setSidebarVisible: () => import_framework4.setSidebarVisible,
|
|
172
|
+
setSidebarWidth: () => import_framework4.setSidebarWidth,
|
|
173
|
+
setTenant: () => import_framework4.setTenant,
|
|
174
|
+
setTenantLoading: () => import_framework4.setTenantLoading,
|
|
175
|
+
setTenantLoadingState: () => import_framework4.setTenantLoadingState,
|
|
176
|
+
setUser: () => import_framework4.setUser,
|
|
177
|
+
showOverlay: () => import_framework4.showOverlay,
|
|
178
|
+
sidebarActions: () => import_framework4.sidebarActions,
|
|
179
|
+
sidebarDomain: () => import_framework9.sidebarDomain,
|
|
180
|
+
sidebarSlice: () => import_framework4.sidebarSlice,
|
|
181
|
+
subscribeQueryCacheRuntimeChanged: () => import_framework4.subscribeQueryCacheRuntimeChanged,
|
|
182
|
+
tenantActions: () => import_framework4.tenantActions,
|
|
183
|
+
tenantReducer: () => import_framework4.tenantReducer,
|
|
184
|
+
tenantSlice: () => import_framework4.tenantSlice,
|
|
185
|
+
themes: () => import_framework4.themes,
|
|
186
|
+
toggleMenu: () => import_framework4.toggleMenu,
|
|
187
|
+
toggleMockMode: () => import_framework4.toggleMockMode,
|
|
188
|
+
toggleSidebar: () => import_framework4.toggleSidebar,
|
|
189
|
+
unmountExtension: () => import_framework7.unmountExtension,
|
|
190
|
+
unregisterExtension: () => import_framework7.unregisterExtension,
|
|
191
|
+
useApiInfiniteQuery: () => useApiInfiniteQuery,
|
|
192
|
+
useApiMutation: () => useApiMutation,
|
|
193
|
+
useApiQuery: () => useApiQuery,
|
|
194
|
+
useApiStream: () => useApiStream,
|
|
195
|
+
useApiSuspenseInfiniteQuery: () => useApiSuspenseInfiniteQuery,
|
|
196
|
+
useApiSuspenseQuery: () => useApiSuspenseQuery,
|
|
178
197
|
useAppDispatch: () => useAppDispatch,
|
|
179
198
|
useAppSelector: () => useAppSelector,
|
|
199
|
+
useCanAccess: () => useCanAccess,
|
|
180
200
|
useDomainExtensions: () => useDomainExtensions,
|
|
181
201
|
useFormatters: () => useFormatters,
|
|
182
|
-
|
|
202
|
+
useFrontX: () => useFrontX,
|
|
183
203
|
useHostAction: () => useHostAction,
|
|
184
204
|
useMfeBridge: () => useMfeBridge,
|
|
185
205
|
useMfeContext: () => useMfeContext,
|
|
206
|
+
useMfeRegistry: () => useMfeRegistry,
|
|
207
|
+
useQueryCache: () => useQueryCache,
|
|
186
208
|
useRegisteredPackages: () => useRegisteredPackages,
|
|
187
209
|
useScreenTranslations: () => useScreenTranslations,
|
|
188
210
|
useSharedProperty: () => useSharedProperty,
|
|
@@ -191,19 +213,18 @@ __export(src_exports, {
|
|
|
191
213
|
});
|
|
192
214
|
module.exports = __toCommonJS(src_exports);
|
|
193
215
|
|
|
194
|
-
// src/
|
|
195
|
-
var
|
|
216
|
+
// src/FrontXProvider.tsx
|
|
217
|
+
var import_react5 = require("react");
|
|
196
218
|
var import_react_redux = require("react-redux");
|
|
197
|
-
var import_framework = require("@gears-frontx/framework");
|
|
198
219
|
|
|
199
|
-
// src/
|
|
220
|
+
// src/FrontXContext.tsx
|
|
200
221
|
var import_react = require("react");
|
|
201
|
-
var
|
|
202
|
-
function
|
|
203
|
-
const context = (0, import_react.useContext)(
|
|
222
|
+
var FrontXContext = (0, import_react.createContext)(null);
|
|
223
|
+
function useFrontX() {
|
|
224
|
+
const context = (0, import_react.useContext)(FrontXContext);
|
|
204
225
|
if (!context) {
|
|
205
226
|
throw new Error(
|
|
206
|
-
"
|
|
227
|
+
"useFrontX must be used within a FrontXProvider. Wrap your application with <FrontXProvider> to access Gears FrontX features."
|
|
207
228
|
);
|
|
208
229
|
}
|
|
209
230
|
return context;
|
|
@@ -228,34 +249,625 @@ var MfeProvider = ({ value, children }) => {
|
|
|
228
249
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MfeContext.Provider, { value, children });
|
|
229
250
|
};
|
|
230
251
|
|
|
231
|
-
// src/
|
|
232
|
-
var
|
|
233
|
-
var
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
252
|
+
// src/queryClient.tsx
|
|
253
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
254
|
+
var import_react_query = require("@tanstack/react-query");
|
|
255
|
+
var import_framework2 = require("@gears-frontx/framework");
|
|
256
|
+
|
|
257
|
+
// src/hooks/QueryCache.ts
|
|
258
|
+
var import_framework = require("@gears-frontx/framework");
|
|
259
|
+
var QUERY_CLIENT_BROADCAST_TARGET = /* @__PURE__ */ Symbol.for("frontx:query-cache:broadcast-target");
|
|
260
|
+
var QUERY_CLIENT_BROADCAST_COUNTER = /* @__PURE__ */ Symbol.for("frontx:query-cache:broadcast-counter");
|
|
261
|
+
function emitCacheEvent(event, payload) {
|
|
262
|
+
import_framework.eventBus.emit(event, payload);
|
|
263
|
+
}
|
|
264
|
+
function ensureBroadcastSource(queryClient) {
|
|
265
|
+
const clientWithMetadata = queryClient;
|
|
266
|
+
const existingSource = clientWithMetadata[QUERY_CLIENT_BROADCAST_TARGET];
|
|
267
|
+
if (typeof existingSource === "string" && existingSource.length > 0) {
|
|
268
|
+
return existingSource;
|
|
269
|
+
}
|
|
270
|
+
const host = globalThis;
|
|
271
|
+
const nextCounter = (host[QUERY_CLIENT_BROADCAST_COUNTER] ?? 0) + 1;
|
|
272
|
+
host[QUERY_CLIENT_BROADCAST_COUNTER] = nextCounter;
|
|
273
|
+
const source = `query-cache-${nextCounter}`;
|
|
274
|
+
clientWithMetadata[QUERY_CLIENT_BROADCAST_TARGET] = source;
|
|
275
|
+
return source;
|
|
276
|
+
}
|
|
277
|
+
function resolveKey(target) {
|
|
278
|
+
if (target !== null && typeof target === "object" && !Array.isArray(target) && "key" in target && "fetch" in target && Array.isArray(target.key) && typeof target.fetch === "function") {
|
|
279
|
+
return target.key;
|
|
280
|
+
}
|
|
281
|
+
return target;
|
|
282
|
+
}
|
|
283
|
+
function toQueryUpdater(dataOrUpdater) {
|
|
284
|
+
if (typeof dataOrUpdater === "function") {
|
|
285
|
+
return dataOrUpdater;
|
|
286
|
+
}
|
|
287
|
+
return () => dataOrUpdater;
|
|
288
|
+
}
|
|
289
|
+
function mapQueryState(state) {
|
|
290
|
+
return {
|
|
291
|
+
data: state.data,
|
|
292
|
+
dataUpdatedAt: state.dataUpdatedAt,
|
|
293
|
+
error: state.error,
|
|
294
|
+
errorUpdatedAt: state.errorUpdatedAt,
|
|
295
|
+
fetchFailureCount: state.fetchFailureCount,
|
|
296
|
+
fetchFailureReason: state.fetchFailureReason,
|
|
297
|
+
fetchStatus: state.fetchStatus,
|
|
298
|
+
isInvalidated: state.isInvalidated,
|
|
299
|
+
status: state.status
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function createQueryCache(queryClient) {
|
|
303
|
+
return {
|
|
304
|
+
get: (key) => {
|
|
305
|
+
return queryClient.getQueryData(resolveKey(key));
|
|
306
|
+
},
|
|
307
|
+
getState: (key) => {
|
|
308
|
+
const state = queryClient.getQueryState(resolveKey(key));
|
|
309
|
+
return state ? mapQueryState(state) : void 0;
|
|
310
|
+
},
|
|
311
|
+
set: (key, dataOrUpdater) => {
|
|
312
|
+
const resolvedKey = resolveKey(key);
|
|
313
|
+
queryClient.setQueryData(resolvedKey, toQueryUpdater(dataOrUpdater));
|
|
314
|
+
emitCacheEvent("cache/set", {
|
|
315
|
+
queryKey: resolvedKey,
|
|
316
|
+
dataOrUpdater,
|
|
317
|
+
source: ensureBroadcastSource(queryClient)
|
|
318
|
+
});
|
|
319
|
+
},
|
|
320
|
+
cancel: (key) => {
|
|
321
|
+
return queryClient.cancelQueries({ queryKey: resolveKey(key) });
|
|
322
|
+
},
|
|
323
|
+
invalidate: (key) => {
|
|
324
|
+
const resolvedKey = resolveKey(key);
|
|
325
|
+
const result = queryClient.invalidateQueries({ queryKey: resolvedKey });
|
|
326
|
+
emitCacheEvent("cache/invalidate", {
|
|
327
|
+
queryKey: resolvedKey,
|
|
328
|
+
source: ensureBroadcastSource(queryClient)
|
|
329
|
+
});
|
|
330
|
+
return result;
|
|
331
|
+
},
|
|
332
|
+
invalidateMany: (filters) => {
|
|
333
|
+
if (filters?.queryKey == null) {
|
|
334
|
+
return Promise.resolve();
|
|
335
|
+
}
|
|
336
|
+
const resolvedKey = resolveKey(filters.queryKey);
|
|
337
|
+
if (!Array.isArray(resolvedKey) || resolvedKey.length === 0) {
|
|
338
|
+
return Promise.resolve();
|
|
339
|
+
}
|
|
340
|
+
const payload = {
|
|
341
|
+
...filters,
|
|
342
|
+
queryKey: resolvedKey
|
|
343
|
+
};
|
|
344
|
+
const result = queryClient.invalidateQueries(payload);
|
|
345
|
+
emitCacheEvent("cache/invalidate", {
|
|
346
|
+
...payload,
|
|
347
|
+
source: ensureBroadcastSource(queryClient)
|
|
348
|
+
});
|
|
349
|
+
return result;
|
|
350
|
+
},
|
|
351
|
+
remove: (key) => {
|
|
352
|
+
const resolvedKey = resolveKey(key);
|
|
353
|
+
queryClient.removeQueries({ queryKey: resolvedKey });
|
|
354
|
+
emitCacheEvent("cache/remove", {
|
|
355
|
+
queryKey: resolvedKey,
|
|
356
|
+
source: ensureBroadcastSource(queryClient)
|
|
357
|
+
});
|
|
242
358
|
}
|
|
243
|
-
|
|
244
|
-
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// src/hooks/useLatest.ts
|
|
363
|
+
var import_react3 = require("react");
|
|
364
|
+
function useLatest(value) {
|
|
365
|
+
const ref = (0, import_react3.useRef)(value);
|
|
245
366
|
(0, import_react3.useEffect)(() => {
|
|
367
|
+
ref.current = value;
|
|
368
|
+
});
|
|
369
|
+
return ref;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// src/queryClient.tsx
|
|
373
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
374
|
+
var APP_QUERY_CLIENT_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client");
|
|
375
|
+
var APP_QUERY_CLIENT_RESOLVER_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-resolver");
|
|
376
|
+
var APP_QUERY_CLIENT_ACTIVATOR_SYMBOL = /* @__PURE__ */ Symbol.for("frontx:query-cache:app-client-activator");
|
|
377
|
+
var FrontXQueryClientContext = (0, import_react4.createContext)(void 0);
|
|
378
|
+
var useCommitEffect = typeof globalThis.window === "undefined" ? import_react4.useEffect : import_react4.useLayoutEffect;
|
|
379
|
+
function resolveFrontXQueryClient(app) {
|
|
380
|
+
const clientApp = app;
|
|
381
|
+
return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_RESOLVER_SYMBOL]?.();
|
|
382
|
+
}
|
|
383
|
+
function hasFrontXQueryClientActivator(app) {
|
|
384
|
+
return typeof app[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL] === "function";
|
|
385
|
+
}
|
|
386
|
+
function activateFrontXQueryClient(app) {
|
|
387
|
+
const clientApp = app;
|
|
388
|
+
return clientApp[APP_QUERY_CLIENT_SYMBOL] ?? clientApp[APP_QUERY_CLIENT_ACTIVATOR_SYMBOL]?.();
|
|
389
|
+
}
|
|
390
|
+
async function invalidateQueryCacheForApp(app, target) {
|
|
391
|
+
const queryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
|
|
392
|
+
if (!queryClient) {
|
|
393
|
+
throw new Error(
|
|
394
|
+
"[invalidateQueryCacheForApp] No QueryClient on app. Ensure queryCache() or queryCacheShared() is in the plugin chain."
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
await createQueryCache(queryClient).invalidate(target);
|
|
398
|
+
}
|
|
399
|
+
function bootstrapFrontXQueryClient(app) {
|
|
400
|
+
return resolveFrontXQueryClient(app);
|
|
401
|
+
}
|
|
402
|
+
function useBootstrappedFrontXQueryClient(app) {
|
|
403
|
+
const fromApp = (0, import_react4.useMemo)(() => bootstrapFrontXQueryClient(app), [app]);
|
|
404
|
+
const [eventResolvedClient, setEventResolvedClient] = (0, import_react4.useState)(
|
|
405
|
+
void 0
|
|
406
|
+
);
|
|
407
|
+
const queryClient = fromApp ?? (eventResolvedClient?.app === app ? eventResolvedClient.queryClient : void 0);
|
|
408
|
+
useCommitEffect(() => {
|
|
409
|
+
if (fromApp || !hasFrontXQueryClientActivator(app)) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const tryResolveQueryClient = () => {
|
|
413
|
+
const nextQueryClient = resolveFrontXQueryClient(app) ?? activateFrontXQueryClient(app);
|
|
414
|
+
if (nextQueryClient) {
|
|
415
|
+
setEventResolvedClient((current) => {
|
|
416
|
+
if (current?.app === app && current.queryClient === nextQueryClient) {
|
|
417
|
+
return current;
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
app,
|
|
421
|
+
queryClient: nextQueryClient
|
|
422
|
+
};
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
tryResolveQueryClient();
|
|
427
|
+
const subscription = (0, import_framework2.subscribeQueryCacheRuntimeChanged)(() => {
|
|
428
|
+
tryResolveQueryClient();
|
|
429
|
+
});
|
|
246
430
|
return () => {
|
|
247
|
-
|
|
248
|
-
|
|
431
|
+
subscription.unsubscribe();
|
|
432
|
+
};
|
|
433
|
+
}, [app, fromApp]);
|
|
434
|
+
return queryClient;
|
|
435
|
+
}
|
|
436
|
+
function FrontXQueryClientProvider({
|
|
437
|
+
queryClient,
|
|
438
|
+
children
|
|
439
|
+
}) {
|
|
440
|
+
if (!queryClient) {
|
|
441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FrontXQueryClientContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_query.QueryClientContext.Provider, { value: void 0, children }) });
|
|
442
|
+
}
|
|
443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FrontXQueryClientContext.Provider, { value: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children }) });
|
|
444
|
+
}
|
|
445
|
+
function useOptionalFrontXQueryClient() {
|
|
446
|
+
return (0, import_react4.useContext)(FrontXQueryClientContext);
|
|
447
|
+
}
|
|
448
|
+
function useRequiredFrontXQueryClient() {
|
|
449
|
+
const queryClient = useOptionalFrontXQueryClient();
|
|
450
|
+
if (!queryClient) {
|
|
451
|
+
throw new Error(
|
|
452
|
+
"[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
return queryClient;
|
|
456
|
+
}
|
|
457
|
+
function buildPageContext(page, pages, descriptor, descriptors) {
|
|
458
|
+
return {
|
|
459
|
+
page,
|
|
460
|
+
pages,
|
|
461
|
+
descriptor,
|
|
462
|
+
descriptors
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
function normalizeFetchStaleTime(staleTime) {
|
|
466
|
+
if (staleTime === "static") {
|
|
467
|
+
return Number.POSITIVE_INFINITY;
|
|
468
|
+
}
|
|
469
|
+
if (typeof staleTime === "function") {
|
|
470
|
+
return 0;
|
|
471
|
+
}
|
|
472
|
+
return typeof staleTime === "number" ? staleTime : void 0;
|
|
473
|
+
}
|
|
474
|
+
function resolveFetchStaleTime(queryClient, queryKey, descriptor, overrideStaleTime) {
|
|
475
|
+
const clientDefaults = {
|
|
476
|
+
...queryClient.getDefaultOptions().queries,
|
|
477
|
+
...queryClient.getQueryDefaults(queryKey)
|
|
478
|
+
};
|
|
479
|
+
return normalizeFetchStaleTime(
|
|
480
|
+
overrideStaleTime ?? descriptor.staleTime ?? clientDefaults.staleTime
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
function cacheTimeOptions(staleTime, gcTime) {
|
|
484
|
+
return {
|
|
485
|
+
...staleTime === void 0 ? {} : { staleTime },
|
|
486
|
+
...gcTime === void 0 ? {} : { gcTime }
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function fetchDescriptor(descriptor, options) {
|
|
490
|
+
return descriptor.fetch(options);
|
|
491
|
+
}
|
|
492
|
+
function useFrontXQuery(descriptor, overrides) {
|
|
493
|
+
const queryClient = useRequiredFrontXQueryClient();
|
|
494
|
+
const staleTime = resolveFetchStaleTime(
|
|
495
|
+
queryClient,
|
|
496
|
+
descriptor.key,
|
|
497
|
+
descriptor,
|
|
498
|
+
overrides?.staleTime
|
|
499
|
+
);
|
|
500
|
+
const result = (0, import_react_query.useQuery)({
|
|
501
|
+
queryKey: descriptor.key,
|
|
502
|
+
queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
|
|
503
|
+
...cacheTimeOptions(
|
|
504
|
+
overrides?.staleTime ?? descriptor.staleTime,
|
|
505
|
+
overrides?.gcTime ?? descriptor.gcTime
|
|
506
|
+
),
|
|
507
|
+
...overrides?.enabled === void 0 ? {} : { enabled: overrides.enabled }
|
|
508
|
+
});
|
|
509
|
+
return {
|
|
510
|
+
data: result.data,
|
|
511
|
+
error: result.error,
|
|
512
|
+
isLoading: result.isLoading,
|
|
513
|
+
isFetching: result.isFetching,
|
|
514
|
+
isError: result.isError,
|
|
515
|
+
refetch: result.refetch
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function useFrontXSuspenseQuery(descriptor, overrides) {
|
|
519
|
+
const queryClient = useRequiredFrontXQueryClient();
|
|
520
|
+
const staleTime = resolveFetchStaleTime(
|
|
521
|
+
queryClient,
|
|
522
|
+
descriptor.key,
|
|
523
|
+
descriptor,
|
|
524
|
+
overrides?.staleTime
|
|
525
|
+
);
|
|
526
|
+
const result = (0, import_react_query.useSuspenseQuery)({
|
|
527
|
+
queryKey: descriptor.key,
|
|
528
|
+
queryFn: ({ signal }) => fetchDescriptor(descriptor, { signal, staleTime }),
|
|
529
|
+
...cacheTimeOptions(
|
|
530
|
+
overrides?.staleTime ?? descriptor.staleTime,
|
|
531
|
+
overrides?.gcTime ?? descriptor.gcTime
|
|
532
|
+
)
|
|
533
|
+
});
|
|
534
|
+
return {
|
|
535
|
+
data: result.data,
|
|
536
|
+
error: result.error,
|
|
537
|
+
isFetching: result.isFetching,
|
|
538
|
+
refetch: async () => {
|
|
539
|
+
await result.refetch();
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function useFrontXInfiniteQuery(options) {
|
|
544
|
+
const queryClient = useRequiredFrontXQueryClient();
|
|
545
|
+
const result = (0, import_react_query.useInfiniteQuery)({
|
|
546
|
+
queryKey: options.initialPage.key,
|
|
547
|
+
initialPageParam: options.initialPage,
|
|
548
|
+
queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
|
|
549
|
+
signal,
|
|
550
|
+
staleTime: resolveFetchStaleTime(
|
|
551
|
+
queryClient,
|
|
552
|
+
options.initialPage.key,
|
|
553
|
+
pageParam,
|
|
554
|
+
options.staleTime
|
|
555
|
+
)
|
|
556
|
+
}),
|
|
557
|
+
getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
|
|
558
|
+
buildPageContext(
|
|
559
|
+
lastPage,
|
|
560
|
+
allPages,
|
|
561
|
+
lastPageDescriptor,
|
|
562
|
+
allPageDescriptors
|
|
563
|
+
)
|
|
564
|
+
),
|
|
565
|
+
getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
|
|
566
|
+
buildPageContext(
|
|
567
|
+
firstPage,
|
|
568
|
+
allPages,
|
|
569
|
+
firstPageDescriptor,
|
|
570
|
+
allPageDescriptors
|
|
571
|
+
)
|
|
572
|
+
) : void 0,
|
|
573
|
+
select: (data) => data.pages,
|
|
574
|
+
...cacheTimeOptions(
|
|
575
|
+
options.staleTime ?? options.initialPage.staleTime,
|
|
576
|
+
options.gcTime ?? options.initialPage.gcTime
|
|
577
|
+
),
|
|
578
|
+
maxPages: options.maxPages,
|
|
579
|
+
...options.enabled === void 0 ? {} : { enabled: options.enabled }
|
|
580
|
+
});
|
|
581
|
+
return {
|
|
582
|
+
data: result.data,
|
|
583
|
+
error: result.error,
|
|
584
|
+
isLoading: result.isLoading,
|
|
585
|
+
isFetching: result.isFetching,
|
|
586
|
+
isError: result.isError,
|
|
587
|
+
hasNextPage: result.hasNextPage ?? false,
|
|
588
|
+
hasPreviousPage: result.hasPreviousPage ?? false,
|
|
589
|
+
isFetchingNextPage: result.isFetchingNextPage,
|
|
590
|
+
isFetchingPreviousPage: result.isFetchingPreviousPage,
|
|
591
|
+
fetchNextPage: async () => {
|
|
592
|
+
await result.fetchNextPage();
|
|
593
|
+
},
|
|
594
|
+
fetchPreviousPage: async () => {
|
|
595
|
+
await result.fetchPreviousPage();
|
|
596
|
+
},
|
|
597
|
+
refetch: async () => {
|
|
598
|
+
await result.refetch();
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
function useFrontXSuspenseInfiniteQuery(options) {
|
|
603
|
+
const queryClient = useRequiredFrontXQueryClient();
|
|
604
|
+
const result = (0, import_react_query.useSuspenseInfiniteQuery)({
|
|
605
|
+
queryKey: options.initialPage.key,
|
|
606
|
+
initialPageParam: options.initialPage,
|
|
607
|
+
queryFn: ({ pageParam, signal }) => fetchDescriptor(pageParam, {
|
|
608
|
+
signal,
|
|
609
|
+
staleTime: resolveFetchStaleTime(
|
|
610
|
+
queryClient,
|
|
611
|
+
options.initialPage.key,
|
|
612
|
+
pageParam,
|
|
613
|
+
options.staleTime
|
|
614
|
+
)
|
|
615
|
+
}),
|
|
616
|
+
getNextPageParam: (lastPage, allPages, lastPageDescriptor, allPageDescriptors) => options.getNextPage(
|
|
617
|
+
buildPageContext(
|
|
618
|
+
lastPage,
|
|
619
|
+
allPages,
|
|
620
|
+
lastPageDescriptor,
|
|
621
|
+
allPageDescriptors
|
|
622
|
+
)
|
|
623
|
+
),
|
|
624
|
+
getPreviousPageParam: options.getPreviousPage ? (firstPage, allPages, firstPageDescriptor, allPageDescriptors) => options.getPreviousPage?.(
|
|
625
|
+
buildPageContext(
|
|
626
|
+
firstPage,
|
|
627
|
+
allPages,
|
|
628
|
+
firstPageDescriptor,
|
|
629
|
+
allPageDescriptors
|
|
630
|
+
)
|
|
631
|
+
) : void 0,
|
|
632
|
+
select: (data) => data.pages,
|
|
633
|
+
...cacheTimeOptions(
|
|
634
|
+
options.staleTime ?? options.initialPage.staleTime,
|
|
635
|
+
options.gcTime ?? options.initialPage.gcTime
|
|
636
|
+
),
|
|
637
|
+
maxPages: options.maxPages
|
|
638
|
+
});
|
|
639
|
+
return {
|
|
640
|
+
data: result.data,
|
|
641
|
+
error: result.error,
|
|
642
|
+
isFetching: result.isFetching,
|
|
643
|
+
hasNextPage: result.hasNextPage ?? false,
|
|
644
|
+
hasPreviousPage: result.hasPreviousPage ?? false,
|
|
645
|
+
isFetchingNextPage: result.isFetchingNextPage,
|
|
646
|
+
isFetchingPreviousPage: result.isFetchingPreviousPage,
|
|
647
|
+
fetchNextPage: async () => {
|
|
648
|
+
await result.fetchNextPage();
|
|
649
|
+
},
|
|
650
|
+
fetchPreviousPage: async () => {
|
|
651
|
+
await result.fetchPreviousPage();
|
|
652
|
+
},
|
|
653
|
+
refetch: async () => {
|
|
654
|
+
await result.refetch();
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
var mutationScopes = /* @__PURE__ */ new WeakMap();
|
|
659
|
+
function scopeBoundQueryCache(queryCache2, scope) {
|
|
660
|
+
const scopeChanged = () => (0, import_framework2.readQueryCacheScopeGeneration)(scope.queryClient) !== scope.generation;
|
|
661
|
+
const dropped = () => {
|
|
662
|
+
if (!scopeChanged()) return false;
|
|
663
|
+
(0, import_framework2.recordQueryCacheScopeWriteDropped)(scope.queryClient, scope.generation);
|
|
664
|
+
return true;
|
|
665
|
+
};
|
|
666
|
+
return {
|
|
667
|
+
get: queryCache2.get,
|
|
668
|
+
getState: queryCache2.getState,
|
|
669
|
+
set: (key, dataOrUpdater) => {
|
|
670
|
+
if (!dropped()) queryCache2.set(key, dataOrUpdater);
|
|
671
|
+
},
|
|
672
|
+
cancel: (key) => scopeChanged() ? Promise.resolve() : queryCache2.cancel(key),
|
|
673
|
+
invalidate: (key) => dropped() ? Promise.resolve() : queryCache2.invalidate(key),
|
|
674
|
+
invalidateMany: (filters) => dropped() ? Promise.resolve() : queryCache2.invalidateMany(filters),
|
|
675
|
+
remove: (key) => {
|
|
676
|
+
if (!dropped()) queryCache2.remove(key);
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function scopeBoundCallbackCtx(callbackCtx, scope) {
|
|
681
|
+
return scope ? { queryCache: scopeBoundQueryCache(createQueryCache(scope.queryClient), scope) } : callbackCtx;
|
|
682
|
+
}
|
|
683
|
+
function useFrontXMutation(options, callbackCtx) {
|
|
684
|
+
const queryClient = useRequiredFrontXQueryClient();
|
|
685
|
+
const latestRef = useLatest({ options, callbackCtx, queryClient });
|
|
686
|
+
const fetchAbortControllersRef = import_react4.default.useRef(/* @__PURE__ */ new Set());
|
|
687
|
+
const abortFetchesOnUnmount = import_react4.default.useEffectEvent(() => {
|
|
688
|
+
if (options.abortOnUnmount) {
|
|
689
|
+
for (const controller of fetchAbortControllersRef.current) {
|
|
690
|
+
controller.abort();
|
|
691
|
+
}
|
|
692
|
+
fetchAbortControllersRef.current.clear();
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
import_react4.default.useEffect(() => {
|
|
696
|
+
return () => {
|
|
697
|
+
abortFetchesOnUnmount();
|
|
698
|
+
};
|
|
699
|
+
}, []);
|
|
700
|
+
const mutationFn = import_react4.default.useCallback((variables, context) => {
|
|
701
|
+
const cancelOnSupersede = latestRef.current.options.cancelOnSupersede;
|
|
702
|
+
if (cancelOnSupersede) {
|
|
703
|
+
for (const controller2 of fetchAbortControllersRef.current) {
|
|
704
|
+
controller2.abort();
|
|
705
|
+
}
|
|
706
|
+
fetchAbortControllersRef.current.clear();
|
|
707
|
+
}
|
|
708
|
+
const controller = new AbortController();
|
|
709
|
+
fetchAbortControllersRef.current.add(controller);
|
|
710
|
+
const librarySignal = context.signal;
|
|
711
|
+
if (cancelOnSupersede && librarySignal) {
|
|
712
|
+
if (librarySignal.aborted) {
|
|
713
|
+
controller.abort();
|
|
714
|
+
} else {
|
|
715
|
+
librarySignal.addEventListener("abort", () => controller.abort(), { once: true });
|
|
249
716
|
}
|
|
717
|
+
}
|
|
718
|
+
return latestRef.current.options.endpoint.fetch(variables, { signal: controller.signal }).finally(() => {
|
|
719
|
+
fetchAbortControllersRef.current.delete(controller);
|
|
720
|
+
});
|
|
721
|
+
}, [latestRef]);
|
|
722
|
+
const onMutate = import_react4.default.useCallback(async (variables, mutationFnContext) => {
|
|
723
|
+
const current = latestRef.current;
|
|
724
|
+
const scope = {
|
|
725
|
+
queryClient: current.queryClient,
|
|
726
|
+
generation: (0, import_framework2.readQueryCacheScopeGeneration)(current.queryClient)
|
|
250
727
|
};
|
|
251
|
-
|
|
252
|
-
|
|
728
|
+
mutationScopes.set(mutationFnContext, scope);
|
|
729
|
+
return current.options.onMutate?.(
|
|
730
|
+
variables,
|
|
731
|
+
scopeBoundCallbackCtx(current.callbackCtx, scope)
|
|
732
|
+
);
|
|
733
|
+
}, [latestRef]);
|
|
734
|
+
const onSuccess = import_react4.default.useCallback((data, variables, context, mutationFnContext) => {
|
|
735
|
+
const current = latestRef.current;
|
|
736
|
+
return current.options.onSuccess?.(
|
|
737
|
+
data,
|
|
738
|
+
variables,
|
|
739
|
+
context,
|
|
740
|
+
scopeBoundCallbackCtx(current.callbackCtx, mutationScopes.get(mutationFnContext))
|
|
741
|
+
);
|
|
742
|
+
}, [latestRef]);
|
|
743
|
+
const onError = import_react4.default.useCallback((error, variables, context, mutationFnContext) => {
|
|
744
|
+
const current = latestRef.current;
|
|
745
|
+
return current.options.onError?.(
|
|
746
|
+
error,
|
|
747
|
+
variables,
|
|
748
|
+
context,
|
|
749
|
+
scopeBoundCallbackCtx(current.callbackCtx, mutationScopes.get(mutationFnContext))
|
|
750
|
+
);
|
|
751
|
+
}, [latestRef]);
|
|
752
|
+
const onSettled = import_react4.default.useCallback((data, error, variables, context, mutationFnContext) => {
|
|
753
|
+
const current = latestRef.current;
|
|
754
|
+
return current.options.onSettled?.(
|
|
755
|
+
data,
|
|
756
|
+
error,
|
|
757
|
+
variables,
|
|
758
|
+
context,
|
|
759
|
+
scopeBoundCallbackCtx(current.callbackCtx, mutationScopes.get(mutationFnContext))
|
|
760
|
+
);
|
|
761
|
+
}, [latestRef]);
|
|
762
|
+
const mutation = (0, import_react_query.useMutation)({
|
|
763
|
+
mutationFn,
|
|
764
|
+
onMutate,
|
|
765
|
+
onSuccess: options.onSuccess ? onSuccess : void 0,
|
|
766
|
+
onError: options.onError ? onError : void 0,
|
|
767
|
+
onSettled: options.onSettled ? onSettled : void 0
|
|
768
|
+
});
|
|
769
|
+
return {
|
|
770
|
+
mutate: mutation.mutate,
|
|
771
|
+
mutateAsync: mutation.mutateAsync,
|
|
772
|
+
isPending: mutation.isPending,
|
|
773
|
+
error: mutation.error,
|
|
774
|
+
data: mutation.data,
|
|
775
|
+
reset: mutation.reset
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// src/FrontXProvider.tsx
|
|
780
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
781
|
+
var FrontXProvider = ({
|
|
782
|
+
children,
|
|
783
|
+
app,
|
|
784
|
+
mfeBridge
|
|
785
|
+
}) => {
|
|
786
|
+
const queryClient = useBootstrappedFrontXQueryClient(app);
|
|
787
|
+
const deferQuerySubtree = hasFrontXQueryClientActivator(app) && queryClient === void 0;
|
|
788
|
+
(0, import_react5.useEffect)(() => {
|
|
789
|
+
if (queryClient || hasFrontXQueryClientActivator(app) || process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test" || process.env.VITEST === "true") {
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
console.warn(
|
|
793
|
+
"[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition. useApiQuery/useApiMutation will fail without it."
|
|
794
|
+
);
|
|
795
|
+
}, [app, queryClient]);
|
|
796
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FrontXContext.Provider, { value: app, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_redux.Provider, { store: app.store, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FrontXQueryClientProvider, { queryClient, children: deferQuerySubtree ? null : children }) }) });
|
|
253
797
|
if (mfeBridge) {
|
|
254
|
-
return /* @__PURE__ */ (0,
|
|
798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MfeProvider, { value: mfeBridge, children: content });
|
|
255
799
|
}
|
|
256
800
|
return content;
|
|
257
801
|
};
|
|
258
802
|
|
|
803
|
+
// src/hooks/useCanAccess.ts
|
|
804
|
+
var import_react6 = require("react");
|
|
805
|
+
function serializeRecordValue(value) {
|
|
806
|
+
if (value === null) return "n:";
|
|
807
|
+
if (typeof value === "string") return `s:${value}`;
|
|
808
|
+
if (typeof value === "number") {
|
|
809
|
+
return `d:${Object.is(value, -0) ? "-0" : String(value)}`;
|
|
810
|
+
}
|
|
811
|
+
return value ? "b:1" : "b:0";
|
|
812
|
+
}
|
|
813
|
+
function accessQueryKey(query) {
|
|
814
|
+
const { action, resource, record } = query;
|
|
815
|
+
const normalizedRecord = record ? Object.entries(record).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, serializeRecordValue(v)]) : null;
|
|
816
|
+
return JSON.stringify([action, resource, normalizedRecord]);
|
|
817
|
+
}
|
|
818
|
+
function getAuthRuntime(app) {
|
|
819
|
+
return app.auth ?? null;
|
|
820
|
+
}
|
|
821
|
+
var DENIED_NO_AUTH = { allow: false, isResolving: false };
|
|
822
|
+
function useCanAccess(query) {
|
|
823
|
+
const app = useFrontX();
|
|
824
|
+
const auth2 = getAuthRuntime(app);
|
|
825
|
+
const stableKey = accessQueryKey(query);
|
|
826
|
+
const [stableQuery, setStableQuery] = (0, import_react6.useState)(() => query);
|
|
827
|
+
const [runState, setRunState] = (0, import_react6.useState)({ auth: auth2, stableKey });
|
|
828
|
+
const [result, setResult] = (0, import_react6.useState)({ allow: false, isResolving: true });
|
|
829
|
+
if (runState.auth !== auth2 || runState.stableKey !== stableKey) {
|
|
830
|
+
setRunState({ auth: auth2, stableKey });
|
|
831
|
+
setStableQuery(query);
|
|
832
|
+
setResult({ allow: false, isResolving: true });
|
|
833
|
+
}
|
|
834
|
+
(0, import_react6.useEffect)(() => {
|
|
835
|
+
if (!auth2) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
let alive = true;
|
|
839
|
+
const controller = new AbortController();
|
|
840
|
+
void auth2.canAccess(stableQuery, { signal: controller.signal }).then((decision) => {
|
|
841
|
+
if (alive) {
|
|
842
|
+
setResult({ allow: decision === "allow", isResolving: false });
|
|
843
|
+
}
|
|
844
|
+
}).catch(() => {
|
|
845
|
+
if (alive) {
|
|
846
|
+
setResult({ allow: false, isResolving: false });
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
return () => {
|
|
850
|
+
alive = false;
|
|
851
|
+
controller.abort();
|
|
852
|
+
};
|
|
853
|
+
}, [auth2, stableQuery]);
|
|
854
|
+
return auth2 ? result : DENIED_NO_AUTH;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// src/components/CanAccess.tsx
|
|
858
|
+
function CanAccess({
|
|
859
|
+
query,
|
|
860
|
+
allowed,
|
|
861
|
+
denied = null,
|
|
862
|
+
loading
|
|
863
|
+
}) {
|
|
864
|
+
const { allow, isResolving } = useCanAccess(query);
|
|
865
|
+
if (isResolving) {
|
|
866
|
+
return loading !== void 0 ? loading : denied;
|
|
867
|
+
}
|
|
868
|
+
return allow ? allowed : denied;
|
|
869
|
+
}
|
|
870
|
+
|
|
259
871
|
// src/hooks/useAppDispatch.ts
|
|
260
872
|
var import_react_redux2 = require("react-redux");
|
|
261
873
|
function useAppDispatch() {
|
|
@@ -267,12 +879,12 @@ var import_react_redux3 = require("react-redux");
|
|
|
267
879
|
var useAppSelector = import_react_redux3.useSelector;
|
|
268
880
|
|
|
269
881
|
// src/hooks/useTranslation.ts
|
|
270
|
-
var
|
|
882
|
+
var import_react7 = require("react");
|
|
271
883
|
function useTranslation() {
|
|
272
|
-
const app =
|
|
884
|
+
const app = useFrontX();
|
|
273
885
|
const { i18nRegistry: i18nRegistry2 } = app;
|
|
274
|
-
const version = (0,
|
|
275
|
-
(0,
|
|
886
|
+
const version = (0, import_react7.useSyncExternalStore)(
|
|
887
|
+
(0, import_react7.useCallback)(
|
|
276
888
|
(callback) => {
|
|
277
889
|
return i18nRegistry2.subscribe(callback);
|
|
278
890
|
},
|
|
@@ -281,17 +893,17 @@ function useTranslation() {
|
|
|
281
893
|
() => i18nRegistry2.getVersion(),
|
|
282
894
|
() => i18nRegistry2.getVersion()
|
|
283
895
|
);
|
|
284
|
-
const language = (0,
|
|
896
|
+
const language = (0, import_react7.useMemo)(() => {
|
|
285
897
|
void version;
|
|
286
898
|
return i18nRegistry2.getLanguage();
|
|
287
899
|
}, [i18nRegistry2, version]);
|
|
288
|
-
const t = (0,
|
|
900
|
+
const t = (0, import_react7.useCallback)(
|
|
289
901
|
(key, params) => {
|
|
290
902
|
return i18nRegistry2.t(key, params);
|
|
291
903
|
},
|
|
292
904
|
[i18nRegistry2]
|
|
293
905
|
);
|
|
294
|
-
const setLanguage = (0,
|
|
906
|
+
const setLanguage = (0, import_react7.useCallback)(
|
|
295
907
|
(lang) => {
|
|
296
908
|
if (app.actions.setLanguage) {
|
|
297
909
|
app.actions.setLanguage({ language: lang });
|
|
@@ -299,7 +911,7 @@ function useTranslation() {
|
|
|
299
911
|
},
|
|
300
912
|
[app.actions]
|
|
301
913
|
);
|
|
302
|
-
const isRTL = (0,
|
|
914
|
+
const isRTL = (0, import_react7.useMemo)(() => {
|
|
303
915
|
void language;
|
|
304
916
|
return i18nRegistry2.isRTL();
|
|
305
917
|
}, [i18nRegistry2, language]);
|
|
@@ -312,29 +924,28 @@ function useTranslation() {
|
|
|
312
924
|
}
|
|
313
925
|
|
|
314
926
|
// src/hooks/useScreenTranslations.ts
|
|
315
|
-
var
|
|
927
|
+
var import_react8 = require("react");
|
|
316
928
|
function isTranslationLoader(input) {
|
|
317
929
|
return typeof input === "function";
|
|
318
930
|
}
|
|
319
931
|
function useScreenTranslations(screensetId, screenId, translations) {
|
|
320
|
-
const app =
|
|
932
|
+
const app = useFrontX();
|
|
321
933
|
const { i18nRegistry: i18nRegistry2 } = app;
|
|
322
|
-
const [loadedLanguage, setLoadedLanguage] = (0,
|
|
323
|
-
const [
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
(0, import_react5.useCallback)(
|
|
934
|
+
const [loadedLanguage, setLoadedLanguage] = (0, import_react8.useState)(null);
|
|
935
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
936
|
+
const version = (0, import_react8.useSyncExternalStore)(
|
|
937
|
+
(0, import_react8.useCallback)(
|
|
327
938
|
(callback) => i18nRegistry2.subscribe(callback),
|
|
328
939
|
[i18nRegistry2]
|
|
329
940
|
),
|
|
330
941
|
() => i18nRegistry2.getVersion(),
|
|
331
942
|
() => i18nRegistry2.getVersion()
|
|
332
943
|
);
|
|
333
|
-
const currentLanguage = (0,
|
|
944
|
+
const currentLanguage = (0, import_react8.useMemo)(() => {
|
|
334
945
|
void version;
|
|
335
946
|
return i18nRegistry2.getLanguage();
|
|
336
947
|
}, [i18nRegistry2, version]);
|
|
337
|
-
const loader = (0,
|
|
948
|
+
const loader = (0, import_react8.useMemo)(() => {
|
|
338
949
|
if (isTranslationLoader(translations)) {
|
|
339
950
|
return translations;
|
|
340
951
|
}
|
|
@@ -347,12 +958,11 @@ function useScreenTranslations(screensetId, screenId, translations) {
|
|
|
347
958
|
return module2.default;
|
|
348
959
|
};
|
|
349
960
|
}, [translations]);
|
|
350
|
-
(0,
|
|
961
|
+
(0, import_react8.useEffect)(() => {
|
|
351
962
|
if (!currentLanguage || currentLanguage === loadedLanguage) {
|
|
352
963
|
return;
|
|
353
964
|
}
|
|
354
965
|
let cancelled = false;
|
|
355
|
-
setIsLoading(true);
|
|
356
966
|
const loadTranslations = async () => {
|
|
357
967
|
try {
|
|
358
968
|
const namespace = `screen.${screensetId}.${screenId}`;
|
|
@@ -361,13 +971,11 @@ function useScreenTranslations(screensetId, screenId, translations) {
|
|
|
361
971
|
i18nRegistry2.register(namespace, currentLanguage, loadedTranslations);
|
|
362
972
|
if (!cancelled) {
|
|
363
973
|
setLoadedLanguage(currentLanguage);
|
|
364
|
-
setIsLoading(false);
|
|
365
974
|
setError(null);
|
|
366
975
|
}
|
|
367
976
|
} catch (err) {
|
|
368
977
|
if (!cancelled) {
|
|
369
978
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
370
|
-
setIsLoading(false);
|
|
371
979
|
}
|
|
372
980
|
}
|
|
373
981
|
};
|
|
@@ -376,29 +984,29 @@ function useScreenTranslations(screensetId, screenId, translations) {
|
|
|
376
984
|
cancelled = true;
|
|
377
985
|
};
|
|
378
986
|
}, [screensetId, screenId, loader, i18nRegistry2, currentLanguage, loadedLanguage]);
|
|
379
|
-
const isLoaded = currentLanguage !== null && currentLanguage === loadedLanguage
|
|
987
|
+
const isLoaded = currentLanguage !== null && currentLanguage === loadedLanguage;
|
|
380
988
|
return { isLoaded, error };
|
|
381
989
|
}
|
|
382
990
|
|
|
383
991
|
// src/hooks/useFormatters.ts
|
|
384
|
-
var
|
|
385
|
-
var
|
|
992
|
+
var import_react9 = require("react");
|
|
993
|
+
var import_framework3 = require("@gears-frontx/framework");
|
|
386
994
|
function useFormatters() {
|
|
387
995
|
const { language } = useTranslation();
|
|
388
|
-
return (0,
|
|
996
|
+
return (0, import_react9.useMemo)(
|
|
389
997
|
() => {
|
|
390
998
|
void language;
|
|
391
999
|
return {
|
|
392
|
-
formatDate:
|
|
393
|
-
formatTime:
|
|
394
|
-
formatDateTime:
|
|
395
|
-
formatRelative:
|
|
396
|
-
formatNumber:
|
|
397
|
-
formatPercent:
|
|
398
|
-
formatCompact:
|
|
399
|
-
formatCurrency:
|
|
400
|
-
compareStrings:
|
|
401
|
-
createCollator:
|
|
1000
|
+
formatDate: import_framework3.formatDate,
|
|
1001
|
+
formatTime: import_framework3.formatTime,
|
|
1002
|
+
formatDateTime: import_framework3.formatDateTime,
|
|
1003
|
+
formatRelative: import_framework3.formatRelative,
|
|
1004
|
+
formatNumber: import_framework3.formatNumber,
|
|
1005
|
+
formatPercent: import_framework3.formatPercent,
|
|
1006
|
+
formatCompact: import_framework3.formatCompact,
|
|
1007
|
+
formatCurrency: import_framework3.formatCurrency,
|
|
1008
|
+
compareStrings: import_framework3.compareStrings,
|
|
1009
|
+
createCollator: import_framework3.createCollator
|
|
402
1010
|
};
|
|
403
1011
|
},
|
|
404
1012
|
[language]
|
|
@@ -406,12 +1014,12 @@ function useFormatters() {
|
|
|
406
1014
|
}
|
|
407
1015
|
|
|
408
1016
|
// src/hooks/useTheme.ts
|
|
409
|
-
var
|
|
1017
|
+
var import_react10 = require("react");
|
|
410
1018
|
function useTheme() {
|
|
411
|
-
const app =
|
|
1019
|
+
const app = useFrontX();
|
|
412
1020
|
const { themeRegistry } = app;
|
|
413
|
-
const version = (0,
|
|
414
|
-
(0,
|
|
1021
|
+
const version = (0, import_react10.useSyncExternalStore)(
|
|
1022
|
+
(0, import_react10.useCallback)(
|
|
415
1023
|
(callback) => {
|
|
416
1024
|
return themeRegistry.subscribe(callback);
|
|
417
1025
|
},
|
|
@@ -420,18 +1028,18 @@ function useTheme() {
|
|
|
420
1028
|
() => themeRegistry.getVersion(),
|
|
421
1029
|
() => themeRegistry.getVersion()
|
|
422
1030
|
);
|
|
423
|
-
const currentTheme = (0,
|
|
1031
|
+
const currentTheme = (0, import_react10.useMemo)(() => {
|
|
424
1032
|
void version;
|
|
425
1033
|
const theme = themeRegistry.getCurrent();
|
|
426
1034
|
return theme?.id;
|
|
427
1035
|
}, [themeRegistry, version]);
|
|
428
|
-
const themes2 = (0,
|
|
1036
|
+
const themes2 = (0, import_react10.useMemo)(() => {
|
|
429
1037
|
return themeRegistry.getAll().map((theme) => ({
|
|
430
1038
|
id: theme.id,
|
|
431
1039
|
name: theme.name
|
|
432
1040
|
}));
|
|
433
1041
|
}, [themeRegistry]);
|
|
434
|
-
const setTheme = (0,
|
|
1042
|
+
const setTheme = (0, import_react10.useCallback)(
|
|
435
1043
|
(themeId) => {
|
|
436
1044
|
if (app.actions.changeTheme) {
|
|
437
1045
|
app.actions.changeTheme({ themeId });
|
|
@@ -446,6 +1054,145 @@ function useTheme() {
|
|
|
446
1054
|
};
|
|
447
1055
|
}
|
|
448
1056
|
|
|
1057
|
+
// src/hooks/useApiQuery.ts
|
|
1058
|
+
function useApiQuery(descriptor, overrides) {
|
|
1059
|
+
return useFrontXQuery(descriptor, overrides);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// src/hooks/useApiSuspenseQuery.ts
|
|
1063
|
+
function useApiSuspenseQuery(descriptor, overrides) {
|
|
1064
|
+
return useFrontXSuspenseQuery(descriptor, overrides);
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
// src/hooks/useApiInfiniteQuery.ts
|
|
1068
|
+
function useApiInfiniteQuery(options) {
|
|
1069
|
+
return useFrontXInfiniteQuery(options);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// src/hooks/useApiSuspenseInfiniteQuery.ts
|
|
1073
|
+
function useApiSuspenseInfiniteQuery(options) {
|
|
1074
|
+
return useFrontXSuspenseInfiniteQuery(options);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
// src/hooks/useApiMutation.ts
|
|
1078
|
+
var import_react11 = require("react");
|
|
1079
|
+
function useApiMutation(options) {
|
|
1080
|
+
const queryClient = useRequiredFrontXQueryClient();
|
|
1081
|
+
const queryCache2 = (0, import_react11.useMemo)(() => createQueryCache(queryClient), [queryClient]);
|
|
1082
|
+
const callbackCtx = (0, import_react11.useMemo)(() => ({ queryCache: queryCache2 }), [queryCache2]);
|
|
1083
|
+
return useFrontXMutation(options, callbackCtx);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
// src/hooks/useApiStream.ts
|
|
1087
|
+
var import_react12 = require("react");
|
|
1088
|
+
function useApiStream(descriptor, options) {
|
|
1089
|
+
const mode = options?.mode ?? "latest";
|
|
1090
|
+
const enabled = options?.enabled ?? true;
|
|
1091
|
+
const [data, setData] = (0, import_react12.useState)(void 0);
|
|
1092
|
+
const [events, setEvents] = (0, import_react12.useState)([]);
|
|
1093
|
+
const [status, setStatus] = (0, import_react12.useState)(() => enabled ? "connecting" : "idle");
|
|
1094
|
+
const [error, setError] = (0, import_react12.useState)(null);
|
|
1095
|
+
const connectPromiseRef = (0, import_react12.useRef)(null);
|
|
1096
|
+
const connectionIdRef = (0, import_react12.useRef)(null);
|
|
1097
|
+
const disconnectRequestedRef = (0, import_react12.useRef)(false);
|
|
1098
|
+
const descriptorRef = useLatest(descriptor);
|
|
1099
|
+
const descriptorKey = (0, import_react12.useMemo)(() => JSON.stringify(descriptor.key), [descriptor.key]);
|
|
1100
|
+
const resetKey = `${descriptorKey}:${mode}`;
|
|
1101
|
+
const [prevResetKey, setPrevResetKey] = (0, import_react12.useState)(resetKey);
|
|
1102
|
+
if (resetKey !== prevResetKey) {
|
|
1103
|
+
setPrevResetKey(resetKey);
|
|
1104
|
+
setData(void 0);
|
|
1105
|
+
setEvents([]);
|
|
1106
|
+
setError(null);
|
|
1107
|
+
}
|
|
1108
|
+
const connectKey = `${resetKey}:${enabled}`;
|
|
1109
|
+
const [prevConnectKey, setPrevConnectKey] = (0, import_react12.useState)(connectKey);
|
|
1110
|
+
if (connectKey !== prevConnectKey) {
|
|
1111
|
+
setPrevConnectKey(connectKey);
|
|
1112
|
+
if (enabled) {
|
|
1113
|
+
setData(void 0);
|
|
1114
|
+
setEvents([]);
|
|
1115
|
+
setStatus("connecting");
|
|
1116
|
+
setError(null);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
const disconnect = (0, import_react12.useCallback)(() => {
|
|
1120
|
+
disconnectRequestedRef.current = true;
|
|
1121
|
+
if (connectionIdRef.current) {
|
|
1122
|
+
descriptorRef.current.disconnect(connectionIdRef.current);
|
|
1123
|
+
connectionIdRef.current = null;
|
|
1124
|
+
disconnectRequestedRef.current = false;
|
|
1125
|
+
}
|
|
1126
|
+
setStatus("disconnected");
|
|
1127
|
+
}, [descriptorRef]);
|
|
1128
|
+
(0, import_react12.useEffect)(() => {
|
|
1129
|
+
if (!enabled) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
let cancelled = false;
|
|
1133
|
+
disconnectRequestedRef.current = false;
|
|
1134
|
+
const d = descriptorRef.current;
|
|
1135
|
+
const connectPromise = d.connect(
|
|
1136
|
+
(event) => {
|
|
1137
|
+
if (cancelled) return;
|
|
1138
|
+
setData(event);
|
|
1139
|
+
setStatus("connected");
|
|
1140
|
+
if (mode === "accumulate") {
|
|
1141
|
+
setEvents((prev) => [...prev, event]);
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
() => {
|
|
1145
|
+
if (cancelled) return;
|
|
1146
|
+
setStatus("disconnected");
|
|
1147
|
+
connectionIdRef.current = null;
|
|
1148
|
+
}
|
|
1149
|
+
);
|
|
1150
|
+
connectPromiseRef.current = connectPromise;
|
|
1151
|
+
connectPromise.then((id) => {
|
|
1152
|
+
if (cancelled) return;
|
|
1153
|
+
if (disconnectRequestedRef.current) {
|
|
1154
|
+
d.disconnect(id);
|
|
1155
|
+
disconnectRequestedRef.current = false;
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
connectionIdRef.current = id;
|
|
1159
|
+
setStatus("connected");
|
|
1160
|
+
}).catch((err) => {
|
|
1161
|
+
if (cancelled) return;
|
|
1162
|
+
if (disconnectRequestedRef.current) {
|
|
1163
|
+
disconnectRequestedRef.current = false;
|
|
1164
|
+
setStatus("disconnected");
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
1168
|
+
setStatus("error");
|
|
1169
|
+
});
|
|
1170
|
+
return () => {
|
|
1171
|
+
cancelled = true;
|
|
1172
|
+
connectPromise.then(
|
|
1173
|
+
(id) => d.disconnect(id),
|
|
1174
|
+
() => {
|
|
1175
|
+
}
|
|
1176
|
+
);
|
|
1177
|
+
connectPromiseRef.current = null;
|
|
1178
|
+
connectionIdRef.current = null;
|
|
1179
|
+
};
|
|
1180
|
+
}, [descriptorKey, enabled, mode, descriptorRef]);
|
|
1181
|
+
return { data, events, status: enabled ? status : "idle", error, disconnect };
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// src/hooks/useQueryCache.ts
|
|
1185
|
+
var import_react13 = require("react");
|
|
1186
|
+
function useQueryCache() {
|
|
1187
|
+
const queryClient = useOptionalFrontXQueryClient();
|
|
1188
|
+
if (!queryClient) {
|
|
1189
|
+
throw new Error(
|
|
1190
|
+
"[FrontXProvider] No query cache available. Add queryCache() or queryCacheShared() to your plugin composition."
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
return (0, import_react13.useMemo)(() => createQueryCache(queryClient), [queryClient]);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
449
1196
|
// src/mfe/hooks/useMfeBridge.ts
|
|
450
1197
|
function useMfeBridge() {
|
|
451
1198
|
const { bridge } = useMfeContext();
|
|
@@ -453,61 +1200,73 @@ function useMfeBridge() {
|
|
|
453
1200
|
}
|
|
454
1201
|
|
|
455
1202
|
// src/mfe/hooks/useSharedProperty.ts
|
|
456
|
-
var
|
|
457
|
-
function useSharedProperty(propertyTypeId) {
|
|
458
|
-
const
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
1203
|
+
var import_react14 = require("react");
|
|
1204
|
+
function useSharedProperty(propertyTypeId, options) {
|
|
1205
|
+
const contextValue = (0, import_react14.useContext)(MfeContext);
|
|
1206
|
+
const bridge = options?.bridge ?? contextValue?.bridge;
|
|
1207
|
+
const fallback = options?.fallback;
|
|
1208
|
+
if (!bridge) {
|
|
1209
|
+
throw new Error(
|
|
1210
|
+
"useSharedProperty must be used within a MfeProvider, or given an explicit `bridge` option, for components that never mount MfeProvider."
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
const subscribe = (0, import_react14.useCallback)(
|
|
1214
|
+
(onStoreChange) => bridge.subscribeToProperty(propertyTypeId, () => {
|
|
1215
|
+
onStoreChange();
|
|
1216
|
+
}),
|
|
1217
|
+
[bridge, propertyTypeId]
|
|
1218
|
+
);
|
|
1219
|
+
const getSnapshot = (0, import_react14.useCallback)(() => {
|
|
1220
|
+
const raw = bridge.getProperty(propertyTypeId)?.value;
|
|
1221
|
+
return raw === void 0 ? fallback : raw;
|
|
1222
|
+
}, [bridge, propertyTypeId, fallback]);
|
|
1223
|
+
return (0, import_react14.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
470
1224
|
}
|
|
471
1225
|
|
|
472
1226
|
// src/mfe/hooks/useHostAction.ts
|
|
473
|
-
var
|
|
1227
|
+
var import_react15 = require("react");
|
|
474
1228
|
function useHostAction(actionTypeId) {
|
|
475
1229
|
const { bridge } = useMfeContext();
|
|
476
|
-
return (0,
|
|
1230
|
+
return (0, import_react15.useCallback)((payload) => {
|
|
477
1231
|
const chain = {
|
|
478
1232
|
action: {
|
|
479
1233
|
type: actionTypeId,
|
|
480
|
-
target: bridge.
|
|
1234
|
+
target: bridge.extDomainId,
|
|
481
1235
|
payload
|
|
482
1236
|
}
|
|
483
1237
|
};
|
|
484
|
-
bridge.executeActionsChain(chain)
|
|
485
|
-
console.error(
|
|
486
|
-
`[useHostAction] Failed to send action '${actionTypeId}':`,
|
|
487
|
-
error
|
|
488
|
-
);
|
|
489
|
-
});
|
|
1238
|
+
bridge.executeActionsChain(chain);
|
|
490
1239
|
}, [actionTypeId, bridge]);
|
|
491
1240
|
}
|
|
492
1241
|
|
|
493
|
-
// src/mfe/hooks/
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
const app = useHAI3();
|
|
497
|
-
const registry = app.screensetsRegistry;
|
|
1242
|
+
// src/mfe/hooks/useMfeRegistry.ts
|
|
1243
|
+
function resolveMfeRegistry(app, callerName) {
|
|
1244
|
+
const registry = app.mfeRegistry;
|
|
498
1245
|
if (!registry) {
|
|
499
1246
|
throw new Error(
|
|
500
|
-
|
|
1247
|
+
`${callerName} requires the microfrontends plugin. Add microfrontends() to your Gears FrontX app configuration.`
|
|
501
1248
|
);
|
|
502
1249
|
}
|
|
503
|
-
|
|
1250
|
+
return registry;
|
|
1251
|
+
}
|
|
1252
|
+
function useMfeRegistry() {
|
|
1253
|
+
const app = useFrontX();
|
|
1254
|
+
return resolveMfeRegistry(app, "useMfeRegistry");
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
// src/mfe/hooks/useDomainExtensions.ts
|
|
1258
|
+
var import_react16 = require("react");
|
|
1259
|
+
function useDomainExtensions(domainId) {
|
|
1260
|
+
const app = useFrontX();
|
|
1261
|
+
const registry = resolveMfeRegistry(app, "useDomainExtensions");
|
|
1262
|
+
const subscribe = (0, import_react16.useCallback)(
|
|
504
1263
|
(onStoreChange) => {
|
|
505
1264
|
return app.store.subscribe(onStoreChange);
|
|
506
1265
|
},
|
|
507
1266
|
[app.store]
|
|
508
1267
|
);
|
|
509
|
-
const cacheRef = (0,
|
|
510
|
-
const getSnapshot = (0,
|
|
1268
|
+
const cacheRef = (0, import_react16.useRef)({ ids: "", extensions: [] });
|
|
1269
|
+
const getSnapshot = (0, import_react16.useCallback)(() => {
|
|
511
1270
|
const extensions = registry.getExtensionsForDomain(domainId);
|
|
512
1271
|
const ids = extensions.map((e) => e.id).join(",");
|
|
513
1272
|
if (ids !== cacheRef.current.ids) {
|
|
@@ -515,27 +1274,22 @@ function useDomainExtensions(domainId) {
|
|
|
515
1274
|
}
|
|
516
1275
|
return cacheRef.current.extensions;
|
|
517
1276
|
}, [registry, domainId]);
|
|
518
|
-
return (0,
|
|
1277
|
+
return (0, import_react16.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
519
1278
|
}
|
|
520
1279
|
|
|
521
1280
|
// src/mfe/hooks/useRegisteredPackages.ts
|
|
522
|
-
var
|
|
1281
|
+
var import_react17 = require("react");
|
|
523
1282
|
function useRegisteredPackages() {
|
|
524
|
-
const app =
|
|
525
|
-
const registry = app
|
|
526
|
-
|
|
527
|
-
throw new Error(
|
|
528
|
-
"useRegisteredPackages requires the microfrontends plugin. Add microfrontends() to your HAI3 app configuration."
|
|
529
|
-
);
|
|
530
|
-
}
|
|
531
|
-
const subscribe = (0, import_react11.useCallback)(
|
|
1283
|
+
const app = useFrontX();
|
|
1284
|
+
const registry = resolveMfeRegistry(app, "useRegisteredPackages");
|
|
1285
|
+
const subscribe = (0, import_react17.useCallback)(
|
|
532
1286
|
(onStoreChange) => {
|
|
533
1287
|
return app.store.subscribe(onStoreChange);
|
|
534
1288
|
},
|
|
535
1289
|
[app.store]
|
|
536
1290
|
);
|
|
537
|
-
const cacheRef = (0,
|
|
538
|
-
const getSnapshot = (0,
|
|
1291
|
+
const cacheRef = (0, import_react17.useRef)({ packages: "", list: [] });
|
|
1292
|
+
const getSnapshot = (0, import_react17.useCallback)(() => {
|
|
539
1293
|
const list = registry.getRegisteredPackages();
|
|
540
1294
|
const packages = list.join(",");
|
|
541
1295
|
if (packages !== cacheRef.current.packages) {
|
|
@@ -543,177 +1297,318 @@ function useRegisteredPackages() {
|
|
|
543
1297
|
}
|
|
544
1298
|
return cacheRef.current.list;
|
|
545
1299
|
}, [registry]);
|
|
546
|
-
return (0,
|
|
1300
|
+
return (0, import_react17.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
547
1301
|
}
|
|
548
1302
|
|
|
549
|
-
// src/mfe/
|
|
550
|
-
var
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
1303
|
+
// src/mfe/ThemeAwareReactLifecycle.tsx
|
|
1304
|
+
var import_client = require("react-dom/client");
|
|
1305
|
+
|
|
1306
|
+
// src/mfe/domainTeardownCollector.ts
|
|
1307
|
+
var activeCollector;
|
|
1308
|
+
function collectDomainTeardowns(fn) {
|
|
1309
|
+
const previousCollector = activeCollector;
|
|
1310
|
+
const collector = [];
|
|
1311
|
+
activeCollector = collector;
|
|
1312
|
+
try {
|
|
1313
|
+
fn();
|
|
1314
|
+
} finally {
|
|
1315
|
+
activeCollector = previousCollector;
|
|
1316
|
+
}
|
|
1317
|
+
return collector;
|
|
1318
|
+
}
|
|
1319
|
+
function registerDomainTeardown(promise) {
|
|
1320
|
+
activeCollector?.push(promise);
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
// src/mfe/ThemeAwareReactLifecycle.tsx
|
|
1324
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1325
|
+
var ADOPTED_HOST_STYLE_ATTR = "data-frontx-adopted-host-style";
|
|
1326
|
+
var BASE_RESETS_STYLE_ID = "__frontx-base-resets__";
|
|
1327
|
+
var SHELL_OWNED_SHADOW_STYLE_IDS = ["__frontx-shadow-isolation__", "__frontx-css-variables__"];
|
|
1328
|
+
function cssToCopy(style) {
|
|
1329
|
+
const text = style.textContent ?? "";
|
|
1330
|
+
const sheet = style.sheet;
|
|
1331
|
+
if (text.trim() || !sheet) return text;
|
|
1332
|
+
return Array.from(sheet.cssRules, (rule) => rule.cssText).join("\n");
|
|
1333
|
+
}
|
|
1334
|
+
function resolveProviderMountOptions(app, bridge, mountContext) {
|
|
1335
|
+
const extensionId = mountContext?.extensionId;
|
|
1336
|
+
const domainId = mountContext?.domainId;
|
|
1337
|
+
const isMountedMfe = typeof extensionId === "string" && typeof domainId === "string";
|
|
1338
|
+
if (isMountedMfe && !resolveFrontXQueryClient(app) && !hasFrontXQueryClientActivator(app)) {
|
|
556
1339
|
throw new Error(
|
|
557
|
-
"
|
|
1340
|
+
"[FrontXProvider] Mounted MFEs require queryCacheShared() in the child app and queryCache() in the host app before loading the MFE app."
|
|
558
1341
|
);
|
|
559
1342
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
},
|
|
564
|
-
[app.store]
|
|
565
|
-
);
|
|
566
|
-
const cacheRef = (0, import_react12.useRef)({ activePackage: void 0 });
|
|
567
|
-
const getSnapshot = (0, import_react12.useCallback)(() => {
|
|
568
|
-
const mountedExtensionId = registry.getMountedExtension(import_framework3.FRONTX_SCREEN_DOMAIN);
|
|
569
|
-
if (!mountedExtensionId) {
|
|
570
|
-
const result = void 0;
|
|
571
|
-
if (result !== cacheRef.current.activePackage) {
|
|
572
|
-
cacheRef.current = { activePackage: result };
|
|
573
|
-
}
|
|
574
|
-
return cacheRef.current.activePackage;
|
|
575
|
-
}
|
|
576
|
-
const activePackage = (0, import_framework3.extractGtsPackage)(mountedExtensionId);
|
|
577
|
-
if (activePackage !== cacheRef.current.activePackage) {
|
|
578
|
-
cacheRef.current = { activePackage };
|
|
579
|
-
}
|
|
580
|
-
return cacheRef.current.activePackage;
|
|
581
|
-
}, [registry]);
|
|
582
|
-
return (0, import_react12.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
1343
|
+
return {
|
|
1344
|
+
mfeBridge: isMountedMfe ? { bridge, extensionId, domainId } : void 0
|
|
1345
|
+
};
|
|
583
1346
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
1347
|
+
function MountRuntimeAwareProvider({
|
|
1348
|
+
app,
|
|
1349
|
+
mfeBridge,
|
|
1350
|
+
children
|
|
1351
|
+
}) {
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FrontXProvider, { app, mfeBridge, children });
|
|
1353
|
+
}
|
|
1354
|
+
var ThemeAwareReactLifecycle = class {
|
|
1355
|
+
constructor(app) {
|
|
1356
|
+
this.app = app;
|
|
591
1357
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
1358
|
+
app;
|
|
1359
|
+
root = null;
|
|
1360
|
+
mount(container, bridge, mountContext) {
|
|
1361
|
+
void this.app.mfeRegistry;
|
|
1362
|
+
if (container instanceof ShadowRoot) {
|
|
1363
|
+
this.adoptHostStylesIntoShadowRoot(container);
|
|
595
1364
|
}
|
|
596
|
-
|
|
1365
|
+
this.injectBaseResets(container);
|
|
1366
|
+
this.initializeStyles(container);
|
|
1367
|
+
const providerMountOptions = resolveProviderMountOptions(this.app, bridge, mountContext);
|
|
1368
|
+
this.root = (0, import_client.createRoot)(container);
|
|
1369
|
+
this.root.render(
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1371
|
+
MountRuntimeAwareProvider,
|
|
1372
|
+
{
|
|
1373
|
+
app: this.app,
|
|
1374
|
+
mfeBridge: providerMountOptions.mfeBridge,
|
|
1375
|
+
children: this.renderContent(bridge)
|
|
1376
|
+
}
|
|
1377
|
+
)
|
|
1378
|
+
);
|
|
597
1379
|
}
|
|
598
|
-
|
|
1380
|
+
/**
|
|
1381
|
+
* `Root.unmount()` itself is synchronous, but a nested `ExtensionDomainSlot`
|
|
1382
|
+
* mounted anywhere in this root's own tree cannot make ITS cleanup
|
|
1383
|
+
* synchronous too — its mounter's own `detach()` awaits per-extension
|
|
1384
|
+
* unmounts. Collecting whatever that cleanup fire-and-forgets (through
|
|
1385
|
+
* `domainTeardownCollector`, scoped to this one `Root.unmount()` call) and
|
|
1386
|
+
* awaiting it here is what makes this method's own returned promise settle
|
|
1387
|
+
* only once every nested domain this root owns has actually finished
|
|
1388
|
+
* tearing down — never before. A root with no routed nested domain
|
|
1389
|
+
* collects nothing, and this resolves exactly as before (a microtask after
|
|
1390
|
+
* the synchronous unmount, same observable timing `void | Promise<void>`
|
|
1391
|
+
* already allows).
|
|
1392
|
+
*/
|
|
1393
|
+
async unmount(_container) {
|
|
1394
|
+
if (!this.root) return;
|
|
1395
|
+
const root = this.root;
|
|
1396
|
+
this.root = null;
|
|
1397
|
+
const pendingTeardowns = collectDomainTeardowns(() => root.unmount());
|
|
1398
|
+
const settled = await Promise.allSettled(pendingTeardowns);
|
|
1399
|
+
const failed = settled.find((result) => result.status === "rejected");
|
|
1400
|
+
if (failed) throw failed.reason;
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Copy all inline <style> and <link rel="stylesheet"> from the host document
|
|
1404
|
+
* into the shadow root so that Tailwind and component styles apply inside the MFE.
|
|
1405
|
+
*
|
|
1406
|
+
* The clones are inserted ahead of everything already in the shadow root, never
|
|
1407
|
+
* appended, because adopted host styles are context rather than authority: where
|
|
1408
|
+
* they and the MFE's own CSS declare the same property at equal specificity, the
|
|
1409
|
+
* MFE has to win. Appending inverted that. `MfeHandlerMF` injects the MFE's
|
|
1410
|
+
* compiled stylesheet into the shadow root before it calls mount, so an appended
|
|
1411
|
+
* clone of the shell's Tailwind preflight - whose
|
|
1412
|
+
* `button, [type='button'], [type='reset'], [type='submit']` rule sets
|
|
1413
|
+
* `background-color: transparent` at specificity (0,1,0) - tied with
|
|
1414
|
+
* `@gears-frontx/ui-kit`'s single-class button rule and won on document order,
|
|
1415
|
+
* leaving every kit Button transparent until it was hovered.
|
|
1416
|
+
*
|
|
1417
|
+
* Inserting at the front rather than pushing MFE styles to the back is what makes
|
|
1418
|
+
* the invariant hold for stylesheets that appear after mount too - a lazily
|
|
1419
|
+
* imported component's CSS module, or whatever initializeStyles() adds - since
|
|
1420
|
+
* those land behind the adopted block by construction.
|
|
1421
|
+
*
|
|
1422
|
+
* A cascade layer around the adopted CSS was the alternative and is rejected:
|
|
1423
|
+
* layered rules lose to unlayered ones at *any* specificity, so a host utility
|
|
1424
|
+
* class would stop overriding an MFE element selector. Document order keeps
|
|
1425
|
+
* specificity in charge and only settles the ties.
|
|
1426
|
+
*
|
|
1427
|
+
* The block replaces its predecessor instead of stacking on it, the same
|
|
1428
|
+
* upsert shape `injectStylesheet` and `injectCssVariables` use in
|
|
1429
|
+
* `@gears-frontx/mfes`' shadow utilities, widened from one id-keyed node to a
|
|
1430
|
+
* marked block. Replacement is required rather than tidy: `createShadowRoot`
|
|
1431
|
+
* hands back an existing `element.shadowRoot` instead of attaching a new one,
|
|
1432
|
+
* so remounting the same container runs this method again on a shadow root
|
|
1433
|
+
* that already holds a full adopted block, and appending would grow it once
|
|
1434
|
+
* per mount with no bound. It does not save re-resolving the cloned `<link>`s -
|
|
1435
|
+
* every mount clones them afresh and the browser resolves each clone; what
|
|
1436
|
+
* replacement buys is that the count stays at one block instead of one per
|
|
1437
|
+
* mount.
|
|
1438
|
+
*
|
|
1439
|
+
* The block is rebuilt from the host head rather than left in place, because
|
|
1440
|
+
* the head is not fixed: a lazily imported chunk adds stylesheets to it after
|
|
1441
|
+
* the first mount, and the second mount has to pick those up.
|
|
1442
|
+
*
|
|
1443
|
+
* A `<style>` is copied into a new element that holds the host's CSS - see
|
|
1444
|
+
* `cssToCopy` - and takes three things from the host element: `media`,
|
|
1445
|
+
* without which a print-only host style applies on screen inside the MFE;
|
|
1446
|
+
* `type`, which keeps the copy of a non-CSS element as inert as the original;
|
|
1447
|
+
* and the nonce, without which a nonce-based CSP blocks the copy. The nonce is read from the `nonce` property, because
|
|
1448
|
+
* browsers blank the attribute in a document served with a CSP header.
|
|
1449
|
+
* Nothing else is carried over, because libraries look for their own
|
|
1450
|
+
* attributes inside the shadow root: styled-components, rendering into it,
|
|
1451
|
+
* puts its tag right after the last `style[data-styled]` there, so a copy of
|
|
1452
|
+
* the host's tag would pull the MFE's rules ahead of the base resets and the
|
|
1453
|
+
* MFE's own CSS. A `<link>` is a deep clone and is loaded from its `href`
|
|
1454
|
+
* again.
|
|
1455
|
+
*
|
|
1456
|
+
* The fresh block goes in before the previous one comes out. Removing first
|
|
1457
|
+
* leaves the shadow root with no host CSS at all, and everything between that
|
|
1458
|
+
* removal and the insertion is synchronous work in this same task - so the gap
|
|
1459
|
+
* never reaches a paint, but any code that reads computed styles from the tree
|
|
1460
|
+
* in between sees an unstyled one. Inserting first costs one moment with two
|
|
1461
|
+
* blocks present, which changes nothing: the old block is a clone of the same
|
|
1462
|
+
* host head and loses every tie to the new one on document order anyway.
|
|
1463
|
+
*/
|
|
1464
|
+
adoptHostStylesIntoShadowRoot(shadowRoot) {
|
|
1465
|
+
const supersededStyles = Array.from(shadowRoot.querySelectorAll(`[${ADOPTED_HOST_STYLE_ATTR}]`));
|
|
1466
|
+
const adoptedStyles = document.createDocumentFragment();
|
|
1467
|
+
const hostStyleNodes = document.head.querySelectorAll('style, link[rel="stylesheet"]');
|
|
1468
|
+
hostStyleNodes.forEach((el) => {
|
|
1469
|
+
if (el instanceof HTMLStyleElement) {
|
|
1470
|
+
const copy = document.createElement("style");
|
|
1471
|
+
if (el.media) copy.media = el.media;
|
|
1472
|
+
if (el.type) copy.type = el.type;
|
|
1473
|
+
if (el.nonce) copy.nonce = el.nonce;
|
|
1474
|
+
copy.textContent = cssToCopy(el);
|
|
1475
|
+
copy.setAttribute(ADOPTED_HOST_STYLE_ATTR, "");
|
|
1476
|
+
adoptedStyles.appendChild(copy);
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
const linkClone = el.cloneNode(true);
|
|
1480
|
+
linkClone.setAttribute(ADOPTED_HOST_STYLE_ATTR, "");
|
|
1481
|
+
adoptedStyles.appendChild(linkClone);
|
|
1482
|
+
});
|
|
1483
|
+
shadowRoot.insertBefore(adoptedStyles, shadowRoot.firstChild);
|
|
1484
|
+
supersededStyles.forEach((el) => el.remove());
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Box-model resets and :host defaults needed inside every shadow root.
|
|
1488
|
+
* These aren't part of Tailwind's compiled output but are required for
|
|
1489
|
+
* consistent rendering across browsers.
|
|
1490
|
+
*
|
|
1491
|
+
* Reuses the node a previous mount left behind, exactly as `injectStylesheet`
|
|
1492
|
+
* does in `@gears-frontx/mfes`' shadow utilities: a remount runs against a
|
|
1493
|
+
* shadow root that `createShadowRoot` handed back intact, and appending a
|
|
1494
|
+
* second copy would add one node per mount forever.
|
|
1495
|
+
*
|
|
1496
|
+
* Reuse alone is not enough, which is why the node is also positioned on every
|
|
1497
|
+
* mount rather than left where the previous one sat. These resets are context
|
|
1498
|
+
* like the adopted block is - `border-color: currentColor` on `*` is a 0-0-0
|
|
1499
|
+
* declaration that beats an MFE preflight's own 0-0-0 reset purely on document
|
|
1500
|
+
* order - so they have to stay ahead of the MFE's CSS, and where they land is
|
|
1501
|
+
* not stable on its own. `MfeHandlerMF.wrapLifecycleWithStylesheets` removes the
|
|
1502
|
+
* MFE's stylesheet on unmount and appends a fresh one before the next mount, so
|
|
1503
|
+
* a node merely left in place ends up ahead of that stylesheet on a remount and
|
|
1504
|
+
* behind it on the first mount: two different cascades for one component.
|
|
1505
|
+
* Anchoring it to the end of the shell-owned head gives every mount the same
|
|
1506
|
+
* order - adopted block, isolation, resets, MFE - which is also the order the
|
|
1507
|
+
* adoption method's invariant is written against.
|
|
1508
|
+
*
|
|
1509
|
+
* With no shell-owned node to anchor to, the resets go to the front. That is the
|
|
1510
|
+
* plain-`Element` container: no adopted block, no isolation style, and the MFE
|
|
1511
|
+
* stylesheet already appended by the handler, so the front is again the only
|
|
1512
|
+
* position that leaves the MFE winning ties.
|
|
1513
|
+
*
|
|
1514
|
+
* Looked up by attribute-selector form rather than `getElementById`, which
|
|
1515
|
+
* `ShadowRoot` has but `Element` does not, and this hook takes either.
|
|
1516
|
+
*/
|
|
1517
|
+
injectBaseResets(container) {
|
|
1518
|
+
const existing = container.querySelector(
|
|
1519
|
+
`style[id="${BASE_RESETS_STYLE_ID}"]`
|
|
1520
|
+
);
|
|
1521
|
+
const style = existing ?? document.createElement("style");
|
|
1522
|
+
style.id = BASE_RESETS_STYLE_ID;
|
|
1523
|
+
style.textContent = `
|
|
1524
|
+
*, *::before, *::after {
|
|
1525
|
+
box-sizing: border-box;
|
|
1526
|
+
border-width: 0;
|
|
1527
|
+
border-style: solid;
|
|
1528
|
+
border-color: currentColor;
|
|
1529
|
+
}
|
|
1530
|
+
* { margin: 0; padding: 0; }
|
|
1531
|
+
:host {
|
|
1532
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
1533
|
+
line-height: 1.5;
|
|
1534
|
+
-webkit-font-smoothing: antialiased;
|
|
1535
|
+
-moz-osx-font-smoothing: grayscale;
|
|
1536
|
+
color: var(--foreground);
|
|
1537
|
+
background-color: var(--background);
|
|
1538
|
+
}
|
|
1539
|
+
`;
|
|
1540
|
+
const shellOwnedHead = container.querySelectorAll(
|
|
1541
|
+
[
|
|
1542
|
+
`[${ADOPTED_HOST_STYLE_ATTR}]`,
|
|
1543
|
+
...SHELL_OWNED_SHADOW_STYLE_IDS.map((id) => `[id="${id}"]`)
|
|
1544
|
+
].join(", ")
|
|
1545
|
+
);
|
|
1546
|
+
const lastShellOwnedNode = shellOwnedHead[shellOwnedHead.length - 1];
|
|
1547
|
+
container.insertBefore(
|
|
1548
|
+
style,
|
|
1549
|
+
lastShellOwnedNode ? lastShellOwnedNode.nextSibling : container.firstChild
|
|
1550
|
+
);
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Hook for subclasses to inject additional CSS not covered by the adopted host
|
|
1554
|
+
* stylesheet (e.g., MFE-specific @font-face rules or custom animations).
|
|
1555
|
+
* No-op by default: host styles adopted in adoptHostStylesIntoShadowRoot()
|
|
1556
|
+
* already include all Tailwind utilities compiled from MFE source files.
|
|
1557
|
+
*/
|
|
1558
|
+
initializeStyles(_container) {
|
|
599
1559
|
}
|
|
600
1560
|
};
|
|
601
1561
|
|
|
602
1562
|
// src/mfe/components/ExtensionDomainSlot.tsx
|
|
603
|
-
var
|
|
604
|
-
var
|
|
605
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1563
|
+
var import_react18 = require("react");
|
|
1564
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
606
1565
|
function ExtensionDomainSlot(props) {
|
|
607
1566
|
const {
|
|
608
1567
|
registry,
|
|
609
1568
|
domainId,
|
|
610
|
-
extensionId,
|
|
611
1569
|
className,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
loadingComponent,
|
|
616
|
-
errorComponent
|
|
1570
|
+
onAttached,
|
|
1571
|
+
onDetached,
|
|
1572
|
+
loadingComponent = null
|
|
617
1573
|
} = props;
|
|
618
|
-
const
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
(0,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
setIsLoading(true);
|
|
631
|
-
setError(null);
|
|
632
|
-
await registry.executeActionsChain({
|
|
633
|
-
action: {
|
|
634
|
-
type: import_framework5.FRONTX_ACTION_MOUNT_EXT,
|
|
635
|
-
target: domainId,
|
|
636
|
-
payload: {
|
|
637
|
-
extensionId
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
if (!mounted) {
|
|
642
|
-
await registry.executeActionsChain({
|
|
643
|
-
action: {
|
|
644
|
-
type: import_framework5.FRONTX_ACTION_UNMOUNT_EXT,
|
|
645
|
-
target: domainId,
|
|
646
|
-
payload: {
|
|
647
|
-
extensionId
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
const newBridge = registry.getParentBridge(extensionId);
|
|
654
|
-
if (!newBridge) {
|
|
655
|
-
throw new Error(`Failed to obtain bridge for extension ${extensionId} after mount`);
|
|
656
|
-
}
|
|
657
|
-
currentBridge = newBridge;
|
|
658
|
-
setBridge(newBridge);
|
|
659
|
-
setIsLoading(false);
|
|
660
|
-
if (onMounted) {
|
|
661
|
-
onMounted(newBridge);
|
|
662
|
-
}
|
|
663
|
-
} catch (err) {
|
|
664
|
-
if (!mounted) {
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
668
|
-
setError(errorObj);
|
|
669
|
-
setIsLoading(false);
|
|
670
|
-
if (onError) {
|
|
671
|
-
onError(errorObj);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
1574
|
+
const rootRef = (0, import_react18.useRef)(null);
|
|
1575
|
+
const emitAttached = (0, import_react18.useEffectEvent)((root) => {
|
|
1576
|
+
onAttached?.(root);
|
|
1577
|
+
});
|
|
1578
|
+
const emitDetached = (0, import_react18.useEffectEvent)(() => {
|
|
1579
|
+
onDetached?.();
|
|
1580
|
+
});
|
|
1581
|
+
const [attached, setAttached] = (0, import_react18.useState)(false);
|
|
1582
|
+
(0, import_react18.useEffect)(() => {
|
|
1583
|
+
const root = rootRef.current;
|
|
1584
|
+
if (!root) {
|
|
1585
|
+
return;
|
|
674
1586
|
}
|
|
675
|
-
|
|
1587
|
+
const mounter = registry.getMounter(domainId);
|
|
1588
|
+
mounter.attach(root);
|
|
1589
|
+
setAttached(true);
|
|
1590
|
+
emitAttached(root);
|
|
676
1591
|
return () => {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
type: import_framework5.FRONTX_ACTION_UNMOUNT_EXT,
|
|
682
|
-
target: domainId,
|
|
683
|
-
payload: {
|
|
684
|
-
extensionId
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
}).then(() => {
|
|
688
|
-
if (onUnmounted) {
|
|
689
|
-
onUnmounted();
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
}
|
|
1592
|
+
const detachPromise = mounter.detach();
|
|
1593
|
+
registerDomainTeardown(detachPromise);
|
|
1594
|
+
setAttached(false);
|
|
1595
|
+
emitDetached();
|
|
693
1596
|
};
|
|
694
|
-
}, [registry, domainId
|
|
695
|
-
|
|
696
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, "data-domain-id": domainId, "data-extension-id": extensionId, children: loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: "Loading extension..." }) });
|
|
697
|
-
}
|
|
698
|
-
if (error) {
|
|
699
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className, "data-domain-id": domainId, "data-extension-id": extensionId, children: errorComponent ? errorComponent(error) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
700
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "Error loading extension:" }),
|
|
701
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("pre", { children: error.message })
|
|
702
|
-
] }) });
|
|
703
|
-
}
|
|
704
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1597
|
+
}, [registry, domainId]);
|
|
1598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
705
1599
|
"div",
|
|
706
1600
|
{
|
|
707
|
-
ref:
|
|
1601
|
+
ref: rootRef,
|
|
708
1602
|
className,
|
|
709
1603
|
"data-domain-id": domainId,
|
|
710
|
-
|
|
711
|
-
"data-bridge-active": bridge !== null
|
|
1604
|
+
children: !attached ? loadingComponent : null
|
|
712
1605
|
}
|
|
713
1606
|
);
|
|
714
1607
|
}
|
|
715
1608
|
|
|
716
1609
|
// src/index.ts
|
|
1610
|
+
var import_framework4 = require("@gears-frontx/framework");
|
|
1611
|
+
var import_framework5 = require("@gears-frontx/framework");
|
|
717
1612
|
var import_framework6 = require("@gears-frontx/framework");
|
|
718
1613
|
var import_framework7 = require("@gears-frontx/framework");
|
|
719
1614
|
var import_framework8 = require("@gears-frontx/framework");
|
|
@@ -725,19 +1620,24 @@ var import_framework13 = require("@gears-frontx/framework");
|
|
|
725
1620
|
var import_framework14 = require("@gears-frontx/framework");
|
|
726
1621
|
var import_framework15 = require("@gears-frontx/framework");
|
|
727
1622
|
var import_framework16 = require("@gears-frontx/framework");
|
|
728
|
-
var
|
|
729
|
-
var import_framework18 = require("@gears-frontx/framework");
|
|
730
|
-
var import_framework19 = require("@gears-frontx/framework");
|
|
731
|
-
var eventBus = import_framework19.eventBus;
|
|
1623
|
+
var eventBus2 = import_framework16.eventBus;
|
|
732
1624
|
// Annotate the CommonJS export names for ESM import in node:
|
|
733
1625
|
0 && (module.exports = {
|
|
734
1626
|
ACCOUNTS_DOMAIN,
|
|
1627
|
+
ActionHandler,
|
|
735
1628
|
ApiPlugin,
|
|
736
1629
|
ApiPluginBase,
|
|
737
1630
|
ApiProtocol,
|
|
1631
|
+
AuthEvents,
|
|
738
1632
|
BaseApiService,
|
|
739
|
-
|
|
1633
|
+
CanAccess,
|
|
1634
|
+
ChildMfeBridge,
|
|
1635
|
+
ConcurrentMountStrategy,
|
|
1636
|
+
ExclusiveMountStrategy,
|
|
1637
|
+
ExtensionDomainImplementation,
|
|
1638
|
+
ExtensionDomainImplementationFactory,
|
|
740
1639
|
ExtensionDomainSlot,
|
|
1640
|
+
ExtensionMounter,
|
|
741
1641
|
FRONTX_ACTION_LOAD_EXT,
|
|
742
1642
|
FRONTX_ACTION_MOUNT_EXT,
|
|
743
1643
|
FRONTX_ACTION_UNMOUNT_EXT,
|
|
@@ -749,48 +1649,48 @@ var eventBus = import_framework19.eventBus;
|
|
|
749
1649
|
FRONTX_SHARED_PROPERTY_LANGUAGE,
|
|
750
1650
|
FRONTX_SHARED_PROPERTY_THEME,
|
|
751
1651
|
FRONTX_SIDEBAR_DOMAIN,
|
|
752
|
-
|
|
753
|
-
|
|
1652
|
+
FrontXContext,
|
|
1653
|
+
FrontXProvider,
|
|
754
1654
|
I18nRegistry,
|
|
755
1655
|
I18nRegistryImpl,
|
|
756
1656
|
LAYOUT_SLICE_NAME,
|
|
757
1657
|
Language,
|
|
758
1658
|
LanguageDisplayMode,
|
|
759
|
-
LayoutDomain,
|
|
760
1659
|
MOCK_PLUGIN,
|
|
761
1660
|
MfeBridgeFactory,
|
|
762
1661
|
MfeContext,
|
|
763
1662
|
MfeHandler,
|
|
764
1663
|
MfeHandlerMF,
|
|
765
1664
|
MfeProvider,
|
|
766
|
-
|
|
1665
|
+
MfeRegistry,
|
|
1666
|
+
MfeRegistryFactory,
|
|
767
1667
|
MockEvents,
|
|
768
|
-
|
|
769
|
-
|
|
1668
|
+
MountStrategy,
|
|
1669
|
+
OptionalMountStrategy,
|
|
1670
|
+
ParentMfeBridge,
|
|
1671
|
+
RestEndpointProtocol,
|
|
770
1672
|
RestPlugin,
|
|
771
1673
|
RestPluginWithConfig,
|
|
772
1674
|
RestProtocol,
|
|
773
1675
|
SUPPORTED_LANGUAGES,
|
|
774
|
-
ScreensetsRegistry,
|
|
775
|
-
ScreensetsRegistryFactory,
|
|
776
|
-
SseMockPlugin,
|
|
777
1676
|
SsePlugin,
|
|
778
1677
|
SsePluginWithConfig,
|
|
779
1678
|
SseProtocol,
|
|
1679
|
+
SseStreamProtocol,
|
|
780
1680
|
TENANT_SLICE_NAME,
|
|
781
1681
|
TenantEvents,
|
|
782
1682
|
TextDirection,
|
|
1683
|
+
ThemeAwareReactLifecycle,
|
|
783
1684
|
apiRegistry,
|
|
1685
|
+
auth,
|
|
784
1686
|
changeTenant,
|
|
785
|
-
clearActiveScreen,
|
|
786
1687
|
clearTenant,
|
|
787
1688
|
clearTenantAction,
|
|
788
1689
|
clearUser,
|
|
789
1690
|
closeAllPopups,
|
|
790
1691
|
closePopup,
|
|
791
1692
|
closeTopPopup,
|
|
792
|
-
|
|
793
|
-
createHAI3App,
|
|
1693
|
+
createFrontX,
|
|
794
1694
|
createI18nRegistry,
|
|
795
1695
|
createShadowRoot,
|
|
796
1696
|
createSlice,
|
|
@@ -798,10 +1698,10 @@ var eventBus = import_framework19.eventBus;
|
|
|
798
1698
|
createThemeRegistry,
|
|
799
1699
|
effects,
|
|
800
1700
|
eventBus,
|
|
801
|
-
extensionScreenSchema,
|
|
802
1701
|
extractGtsPackage,
|
|
803
1702
|
footerActions,
|
|
804
1703
|
footerSlice,
|
|
1704
|
+
frontxApiTransport,
|
|
805
1705
|
getLanguageMetadata,
|
|
806
1706
|
getStore,
|
|
807
1707
|
gtsPlugin,
|
|
@@ -814,23 +1714,23 @@ var eventBus = import_framework19.eventBus;
|
|
|
814
1714
|
initMockEffects,
|
|
815
1715
|
initTenantEffects,
|
|
816
1716
|
injectCssVariables,
|
|
1717
|
+
invalidateQueryCacheForApp,
|
|
817
1718
|
isMockPlugin,
|
|
818
1719
|
isRestShortCircuit,
|
|
819
1720
|
isShortCircuit,
|
|
820
1721
|
isSseShortCircuit,
|
|
821
|
-
languageSchema,
|
|
822
1722
|
layout,
|
|
823
1723
|
layoutDomainReducers,
|
|
824
1724
|
layoutReducer,
|
|
825
1725
|
loadExtension,
|
|
826
1726
|
menuActions,
|
|
827
1727
|
menuSlice,
|
|
1728
|
+
mfeRegistryFactory,
|
|
828
1729
|
microfrontends,
|
|
829
1730
|
mock,
|
|
830
1731
|
mockActions,
|
|
831
1732
|
mockSlice,
|
|
832
1733
|
mountExtension,
|
|
833
|
-
navigateTo,
|
|
834
1734
|
openPopup,
|
|
835
1735
|
overlayActions,
|
|
836
1736
|
overlayDomain,
|
|
@@ -839,17 +1739,14 @@ var eventBus = import_framework19.eventBus;
|
|
|
839
1739
|
popupDomain,
|
|
840
1740
|
popupSlice,
|
|
841
1741
|
presets,
|
|
1742
|
+
queryCache,
|
|
1743
|
+
queryCacheShared,
|
|
842
1744
|
registerExtension,
|
|
843
1745
|
registerSlice,
|
|
844
|
-
screenActions,
|
|
845
1746
|
screenDomain,
|
|
846
|
-
screenSlice,
|
|
847
|
-
screensets,
|
|
848
|
-
screensetsRegistryFactory,
|
|
849
1747
|
selectExtensionError,
|
|
850
1748
|
selectExtensionState,
|
|
851
1749
|
selectRegisteredExtensions,
|
|
852
|
-
setActiveScreen,
|
|
853
1750
|
setFooterConfig,
|
|
854
1751
|
setFooterVisible,
|
|
855
1752
|
setHeaderLoading,
|
|
@@ -859,7 +1756,6 @@ var eventBus = import_framework19.eventBus;
|
|
|
859
1756
|
setMenuVisible,
|
|
860
1757
|
setMockEnabled,
|
|
861
1758
|
setOverlayVisible,
|
|
862
|
-
setScreenLoading,
|
|
863
1759
|
setSidebarCollapsed,
|
|
864
1760
|
setSidebarConfig,
|
|
865
1761
|
setSidebarContent,
|
|
@@ -875,25 +1771,33 @@ var eventBus = import_framework19.eventBus;
|
|
|
875
1771
|
sidebarActions,
|
|
876
1772
|
sidebarDomain,
|
|
877
1773
|
sidebarSlice,
|
|
1774
|
+
subscribeQueryCacheRuntimeChanged,
|
|
878
1775
|
tenantActions,
|
|
879
1776
|
tenantReducer,
|
|
880
1777
|
tenantSlice,
|
|
881
|
-
themeSchema,
|
|
882
1778
|
themes,
|
|
883
1779
|
toggleMenu,
|
|
884
1780
|
toggleMockMode,
|
|
885
1781
|
toggleSidebar,
|
|
886
1782
|
unmountExtension,
|
|
887
1783
|
unregisterExtension,
|
|
888
|
-
|
|
1784
|
+
useApiInfiniteQuery,
|
|
1785
|
+
useApiMutation,
|
|
1786
|
+
useApiQuery,
|
|
1787
|
+
useApiStream,
|
|
1788
|
+
useApiSuspenseInfiniteQuery,
|
|
1789
|
+
useApiSuspenseQuery,
|
|
889
1790
|
useAppDispatch,
|
|
890
1791
|
useAppSelector,
|
|
1792
|
+
useCanAccess,
|
|
891
1793
|
useDomainExtensions,
|
|
892
1794
|
useFormatters,
|
|
893
|
-
|
|
1795
|
+
useFrontX,
|
|
894
1796
|
useHostAction,
|
|
895
1797
|
useMfeBridge,
|
|
896
1798
|
useMfeContext,
|
|
1799
|
+
useMfeRegistry,
|
|
1800
|
+
useQueryCache,
|
|
897
1801
|
useRegisteredPackages,
|
|
898
1802
|
useScreenTranslations,
|
|
899
1803
|
useSharedProperty,
|