@gears-frontx/react 0.2.0-alpha.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 +118 -61
- package/dist/index.cjs +607 -426
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +365 -100
- package/dist/index.d.ts +365 -100
- package/dist/index.js +437 -253
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +7 -4
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +7 -2
- package/dist/testing.js.map +1 -1
- package/dist/{types-Cjd20AT-.d.cts → types-JtpziA_B.d.cts} +5 -12
- package/dist/{types-Cjd20AT-.d.ts → types-JtpziA_B.d.ts} +5 -12
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/llms.txt +38 -12
- package/package.json +20 -15
- package/commands/frontx-duplicate-screenset.md +0 -58
- package/commands/frontx-new-component.md +0 -57
- package/commands/frontx-new-mfe.md +0 -153
- package/commands/frontx-new-screen.md +0 -45
- package/commands/frontx-new-screenset.md +0 -57
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ReactElement } from 'react';
|
|
3
|
-
import { F as FrontXProviderProps, A as ApiQueryResult, a as ApiInfiniteQueryResult, b as ApiMutationResult, C as CanAccessProps, U as UseTranslationReturn, c as UseScreenTranslationsReturn, d as UseFormattersReturn, e as UseThemeReturn, f as ApiSuspenseQueryResult, g as ApiSuspenseInfiniteQueryResult, h as UseCanAccessResult, M as MfeContextValue } from './types-
|
|
4
|
-
export { i as MfeContext, j as UseAppDispatchReturn, k as UseAppSelector, l as UseFrontXReturn, u as useMfeContext } from './types-
|
|
5
|
-
import { FrontXApp, EndpointDescriptor, MutationDescriptor, AccessRecord, AppDispatch, RootState, TranslationMap, TranslationLoader, StreamStatus, StreamDescriptor, AccessQuery, ChildMfeBridge, Extension, MfeEntryLifecycle, MfeMountContext,
|
|
6
|
-
export { ACCOUNTS_DOMAIN, AccessDecision, AccessQuery, Action, ActionHandler, ActionPayload, ActionsChain, ApiPlugin, ApiPluginBase, ApiPluginErrorContext, ApiProtocol, ApiRequestContext, ApiResponseContext, ApiServiceConfig, AppDispatch, AuthCallbackInput, AuthCapabilities, AuthCheckResult, AuthContext, AuthLoginInput, AuthPermissions, AuthPluginConfig, AuthProvider, AuthRuntime, AuthSession, AuthState, AuthStateEvent, AuthStateListener, AuthTransition, AuthUnsubscribe, BaseApiService, BasePluginHooks, ChangeThemePayload, ChildMfeBridge, ConcurrentMountStrategy, ContainerHooks, DomainContext, EndpointDescriptor, EndpointOptions, EventHandler, EventSourceLike, ExclusiveMountStrategy, Extension, ExtensionDomain, ExtensionDomainImplementation, ExtensionDomainImplementationFactory, ExtensionMounter, ExtensionPresentation, ExtensionRegistrationState, FRONTX_ACTION_LOAD_EXT, FRONTX_ACTION_MOUNT_EXT, FRONTX_ACTION_UNMOUNT_EXT, FRONTX_MFE_ENTRY_MF, FRONTX_OVERLAY_DOMAIN, FRONTX_POPUP_DOMAIN, FRONTX_SCREEN_DOMAIN, FRONTX_SCREEN_EXTENSION_TYPE, FRONTX_SHARED_PROPERTY_LANGUAGE, FRONTX_SHARED_PROPERTY_THEME, FRONTX_SIDEBAR_DOMAIN, FooterConfig, FooterState, FrontXApp, FrontXAppBuilder, FrontXConfig, FrontXPlugin, FrontXStore, HeaderConfig, HeaderState, HeaderUser, I18nConfig, I18nRegistry, I18nRegistryImpl, I18nRegistryType, JSONSchema, JsonCompatible, JsonObject, JsonPrimitive, JsonValue, LAYOUT_SLICE_NAME, Language, LanguageDisplayMode, LanguageMetadata,
|
|
3
|
+
import { F as FrontXProviderProps, A as ApiQueryResult, a as ApiInfiniteQueryResult, b as ApiMutationResult, C as CanAccessProps, U as UseTranslationReturn, c as UseScreenTranslationsReturn, d as UseFormattersReturn, e as UseThemeReturn, f as ApiSuspenseQueryResult, g as ApiSuspenseInfiniteQueryResult, h as UseCanAccessResult, M as MfeContextValue } from './types-JtpziA_B.js';
|
|
4
|
+
export { i as MfeContext, j as UseAppDispatchReturn, k as UseAppSelector, l as UseFrontXReturn, u as useMfeContext } from './types-JtpziA_B.js';
|
|
5
|
+
import { FrontXApp, EndpointDescriptor, MutationDescriptor, AccessRecord, AppDispatch, RootState, TranslationMap, TranslationLoader, StreamStatus, StreamDescriptor, AccessQuery, ChildMfeBridge, MfeRegistry, Extension, MfeEntryLifecycle, MfeMountContext, EventPayloadMap as EventPayloadMap$1, EventBus } from '@gears-frontx/framework';
|
|
6
|
+
export { ACCOUNTS_DOMAIN, AccessDecision, AccessQuery, Action, ActionHandler, ActionPayload, ActionsChain, ApiPlugin, ApiPluginBase, ApiPluginErrorContext, ApiProtocol, ApiRequestContext, ApiResponseContext, ApiServiceConfig, AppDispatch, AuthCallbackInput, AuthCapabilities, AuthCheckResult, AuthContext, AuthEvents, AuthLoggedInPayload, AuthLoggedOutPayload, AuthLoginInput, AuthPermissions, AuthPluginConfig, AuthProvider, AuthRuntime, AuthSession, AuthState, AuthStateEvent, AuthStateListener, AuthTransition, AuthUnsubscribe, BaseApiService, BasePluginHooks, ChangeThemePayload, ChildMfeBridge, ConcurrentMountStrategy, ContainerHooks, DomainContext, EndpointDescriptor, EndpointOptions, EventHandler, EventSourceLike, ExclusiveMountStrategy, Extension, ExtensionDomain, ExtensionDomainImplementation, ExtensionDomainImplementationFactory, ExtensionMounter, ExtensionPresentation, ExtensionRegistrationState, FRONTX_ACTION_LOAD_EXT, FRONTX_ACTION_MOUNT_EXT, FRONTX_ACTION_UNMOUNT_EXT, FRONTX_MFE_ENTRY_MF, FRONTX_OVERLAY_DOMAIN, FRONTX_POPUP_DOMAIN, FRONTX_SCREEN_DOMAIN, FRONTX_SCREEN_EXTENSION_TYPE, FRONTX_SHARED_PROPERTY_LANGUAGE, FRONTX_SHARED_PROPERTY_THEME, FRONTX_SIDEBAR_DOMAIN, FooterConfig, FooterState, FrontXApp, FrontXAppBuilder, FrontXConfig, FrontXPlugin, FrontXStore, HeaderConfig, HeaderState, HeaderUser, I18nConfig, I18nRegistry, I18nRegistryImpl, I18nRegistryType, JSONSchema, JsonCompatible, JsonObject, JsonPrimitive, JsonValue, LAYOUT_SLICE_NAME, Language, LanguageDisplayMode, LanguageMetadata, LayoutDomainReducers, LayoutDomainState, LayoutState, LifecycleHook, LifecycleStage, LoadExtPayload, MOCK_PLUGIN, MenuItem, MenuState, MfManifest, MfManifestAssets, MfManifestBuildInfo, MfManifestMetaData, MfManifestRemoteEntry, MfManifestShared, MfeBridgeFactory, MfeEntry, MfeEntryLifecycle, MfeEntryMF, MfeHandler, MfeHandlerMF, MfeMountContext, MfeRegistry, MfeRegistryConfig, MfeRegistryFactory, MfeState, MockEvents, MockMap, MockState, MockTogglePayload, MountExtPayload, MountStrategy, MutationDescriptor, OptionalMountStrategy, OverlayConfig, OverlayState, ParameterizedEndpointDescriptor, ParentMfeBridge, PluginClass, PluginFactory, PluginLifecycle, PluginProvides, PopupConfig, PopupSliceState, PopupState, Preset, Presets, ProtocolClass, ProtocolPluginType, ReducerPayload, RegisterExtensionPayload, RestEndpointProtocol, RestPlugin, RestPluginHooks, RestPluginWithConfig, RestProtocol, RestProtocolConfig, RestRequestContext, RestResponseContext, RestShortCircuitResponse, RootState, RootStateWithLayout, SUPPORTED_LANGUAGES, ScreenExtension, SetLanguagePayload, SharedProperty, ShortCircuitResponse, ShowPopupPayload, SidebarPosition, SidebarState, SliceObject, SseConnectContext, SsePlugin, SsePluginHooks, SsePluginWithConfig, SseProtocol, SseProtocolConfig, SseShortCircuitResponse, SseStreamProtocol, StreamDescriptor, StreamStatus, Subscription, TENANT_SLICE_NAME, Tenant, TenantChangedPayload, TenantClearedPayload, TenantEvents, TenantState, TextDirection, ThemeConfig, ThemeRegistry, TranslationDictionary, TranslationLoader, TranslationMap, TypeSystemPlugin, UnmountExtPayload, UnregisterExtensionPayload, apiRegistry, auth, changeTenant, clearTenant, clearTenantAction, clearUser, closeAllPopups, closePopup, closeTopPopup, createFrontX, createI18nRegistry, createShadowRoot, createSlice, createStore, createThemeRegistry, effects, extractGtsPackage, footerActions, footerSlice, frontxApiTransport, getLanguageMetadata, getStore, gtsPlugin, hasSlice, headerActions, headerSlice, hideOverlay, i18n, i18nRegistry, initMockEffects, initTenantEffects, injectCssVariables, isMockPlugin, isRestShortCircuit, isShortCircuit, isSseShortCircuit, layout, layoutDomainReducers, layoutReducer, loadExtension, menuActions, menuSlice, mfeRegistryFactory, microfrontends, mock, mockActions, mockSlice, mountExtension, openPopup, overlayActions, overlayDomain, overlaySlice, popupActions, popupDomain, popupSlice, presets, queryCache, queryCacheShared, registerExtension, registerSlice, screenDomain, selectExtensionError, selectExtensionState, selectRegisteredExtensions, setFooterConfig, setFooterVisible, setHeaderLoading, setMenuCollapsed, setMenuConfig, setMenuItems, setMenuVisible, setMockEnabled, setOverlayVisible, setSidebarCollapsed, setSidebarConfig, setSidebarContent, setSidebarPosition, setSidebarTitle, setSidebarVisible, setSidebarWidth, setTenant, setTenantLoading, setTenantLoadingState, setUser, showOverlay, sidebarActions, sidebarDomain, sidebarSlice, subscribeQueryCacheRuntimeChanged, tenantActions, tenantReducer, tenantSlice, themes, toggleMenu, toggleMockMode, toggleSidebar, unmountExtension, unregisterExtension } from '@gears-frontx/framework';
|
|
7
7
|
import { M as MutationCallbackContext, Q as QueryCache } from './testing-Dlmfu6tE.js';
|
|
8
8
|
export { a as QueryCacheInvalidateFilters, b as QueryCacheState, i as invalidateQueryCacheForApp } from './testing-Dlmfu6tE.js';
|
|
9
9
|
import { TypedUseSelectorHook } from 'react-redux';
|
|
@@ -23,29 +23,19 @@ import '@gears-frontx/framework/testing';
|
|
|
23
23
|
/**
|
|
24
24
|
* FrontX Provider Component
|
|
25
25
|
*
|
|
26
|
-
* Provides the FrontX application context to all child components.
|
|
27
|
-
*
|
|
26
|
+
* Provides the FrontX application context to all child components. The app
|
|
27
|
+
* is built once per runtime by the caller (`createFrontX(...).build()`); the
|
|
28
|
+
* provider never creates or destroys one.
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* ```tsx
|
|
31
|
-
* // Default - creates app with full preset
|
|
32
|
-
* <FrontXProvider>
|
|
33
|
-
* <App />
|
|
34
|
-
* </FrontXProvider>
|
|
35
|
-
*
|
|
36
|
-
* // With configuration
|
|
37
|
-
* <FrontXProvider config={{ devMode: true }}>
|
|
38
|
-
* <App />
|
|
39
|
-
* </FrontXProvider>
|
|
40
|
-
*
|
|
41
|
-
* // With pre-built app
|
|
42
32
|
* const app = createFrontX().use(queryCache()).build();
|
|
43
33
|
* <FrontXProvider app={app}>
|
|
44
34
|
* <App />
|
|
45
35
|
* </FrontXProvider>
|
|
46
36
|
*
|
|
47
37
|
* // With MFE bridge (for MFE components)
|
|
48
|
-
* <FrontXProvider mfeBridge={{ bridge, extensionId, domainId }}>
|
|
38
|
+
* <FrontXProvider app={app} mfeBridge={{ bridge, extensionId, domainId }}>
|
|
49
39
|
* <MyMfeApp />
|
|
50
40
|
* </FrontXProvider>
|
|
51
41
|
*
|
|
@@ -79,16 +69,36 @@ declare function useFrontX(): FrontXApp;
|
|
|
79
69
|
*
|
|
80
70
|
* Cache config cascade: component overrides > descriptor defaults > plugin defaults.
|
|
81
71
|
* Omit overrides to rely on the descriptor's staleTime/gcTime, which in turn
|
|
82
|
-
* fall back to the plugin-level query-cache defaults
|
|
72
|
+
* fall back to the plugin-level query-cache defaults, so a screen that remounts
|
|
73
|
+
* within staleTime paints from cache without refetching.
|
|
74
|
+
*
|
|
75
|
+
* Pass `enabled: false` to hold a query whose input is not known yet.
|
|
83
76
|
*/
|
|
84
77
|
|
|
85
|
-
/**
|
|
86
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Per-call cache overrides shared by every read hook.
|
|
80
|
+
* Cascade: these > descriptor > plugin defaults.
|
|
81
|
+
*/
|
|
82
|
+
interface ApiQueryCacheOverrides {
|
|
87
83
|
/** Override staleTime for this specific call site. */
|
|
88
84
|
staleTime?: number;
|
|
89
85
|
/** Override gcTime for this specific call site. */
|
|
90
86
|
gcTime?: number;
|
|
91
87
|
}
|
|
88
|
+
/** Per-call overrides for useApiSuspenseQuery. */
|
|
89
|
+
interface ApiSuspenseQueryOverrides extends ApiQueryCacheOverrides {
|
|
90
|
+
/** A suspense query always runs; use useApiQuery to hold one back. */
|
|
91
|
+
enabled?: never;
|
|
92
|
+
}
|
|
93
|
+
/** Per-call overrides for useApiQuery. */
|
|
94
|
+
interface ApiQueryOverrides extends ApiQueryCacheOverrides {
|
|
95
|
+
/**
|
|
96
|
+
* `false` keeps the query idle: it is not fetched automatically and
|
|
97
|
+
* `isLoading` stays false until it turns `true`. An explicit `refetch`
|
|
98
|
+
* still fetches. Defaults to `true`.
|
|
99
|
+
*/
|
|
100
|
+
enabled?: boolean;
|
|
101
|
+
}
|
|
92
102
|
declare function useApiQuery<TData = unknown, TError = Error>(descriptor: EndpointDescriptor<TData>, overrides?: ApiQueryOverrides): ApiQueryResult<TData, TError>;
|
|
93
103
|
|
|
94
104
|
/**
|
|
@@ -105,7 +115,8 @@ interface ApiInfiniteQueryPageContext<TPage> {
|
|
|
105
115
|
descriptor: EndpointDescriptor<TPage>;
|
|
106
116
|
descriptors: readonly EndpointDescriptor<TPage>[];
|
|
107
117
|
}
|
|
108
|
-
|
|
118
|
+
/** Options shared by useApiInfiniteQuery and useApiSuspenseInfiniteQuery. */
|
|
119
|
+
interface ApiInfiniteQueryBaseOptions<TPage> extends ApiQueryCacheOverrides {
|
|
109
120
|
/** Descriptor for the first page in the sequence. */
|
|
110
121
|
initialPage: EndpointDescriptor<TPage>;
|
|
111
122
|
/**
|
|
@@ -121,6 +132,18 @@ interface ApiInfiniteQueryOptions<TPage> extends ApiQueryOverrides {
|
|
|
121
132
|
/** Optional TanStack maxPages passthrough for bounded page windows. */
|
|
122
133
|
maxPages?: number;
|
|
123
134
|
}
|
|
135
|
+
/** Options for useApiSuspenseInfiniteQuery. */
|
|
136
|
+
interface ApiSuspenseInfiniteQueryOptions<TPage> extends ApiInfiniteQueryBaseOptions<TPage> {
|
|
137
|
+
/** A suspense query always runs; use useApiInfiniteQuery to hold one back. */
|
|
138
|
+
enabled?: never;
|
|
139
|
+
}
|
|
140
|
+
interface ApiInfiniteQueryOptions<TPage> extends ApiInfiniteQueryBaseOptions<TPage> {
|
|
141
|
+
/**
|
|
142
|
+
* `false` keeps the query idle: no page is fetched until it turns `true`.
|
|
143
|
+
* Defaults to `true`.
|
|
144
|
+
*/
|
|
145
|
+
enabled?: boolean;
|
|
146
|
+
}
|
|
124
147
|
declare function useApiInfiniteQuery<TPage = unknown, TError = Error>(options: ApiInfiniteQueryOptions<TPage>): ApiInfiniteQueryResult<TPage, TError>;
|
|
125
148
|
|
|
126
149
|
/**
|
|
@@ -348,10 +371,11 @@ declare function useTheme(): UseThemeReturn;
|
|
|
348
371
|
* useApiSuspenseQuery - Suspense declarative data fetching hook
|
|
349
372
|
*
|
|
350
373
|
* Mirrors useApiQuery but integrates with React Suspense so the initial load is
|
|
351
|
-
* handled by a Suspense boundary.
|
|
374
|
+
* handled by a Suspense boundary. A suspense query always runs, so there is no
|
|
375
|
+
* `enabled` override.
|
|
352
376
|
*/
|
|
353
377
|
|
|
354
|
-
declare function useApiSuspenseQuery<TData = unknown, TError = Error>(descriptor: EndpointDescriptor<TData>, overrides?:
|
|
378
|
+
declare function useApiSuspenseQuery<TData = unknown, TError = Error>(descriptor: EndpointDescriptor<TData>, overrides?: ApiSuspenseQueryOverrides): ApiSuspenseQueryResult<TData, TError>;
|
|
355
379
|
|
|
356
380
|
/**
|
|
357
381
|
* useApiSuspenseInfiniteQuery - Suspense paginated data fetching hook
|
|
@@ -361,15 +385,14 @@ declare function useApiSuspenseQuery<TData = unknown, TError = Error>(descriptor
|
|
|
361
385
|
* descriptor-driven.
|
|
362
386
|
*/
|
|
363
387
|
|
|
364
|
-
declare function useApiSuspenseInfiniteQuery<TPage = unknown, TError = Error>(options:
|
|
388
|
+
declare function useApiSuspenseInfiniteQuery<TPage = unknown, TError = Error>(options: ApiSuspenseInfiniteQueryOptions<TPage>): ApiSuspenseInfiniteQueryResult<TPage, TError>;
|
|
365
389
|
|
|
366
390
|
/**
|
|
367
391
|
* useApiStream - Declarative SSE streaming hook
|
|
368
392
|
*
|
|
369
|
-
* Accepts a StreamDescriptor from @gears-frontx/api and
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* a manual disconnect function.
|
|
393
|
+
* Accepts a StreamDescriptor from @gears-frontx/api and returns the latest
|
|
394
|
+
* event, accumulated events, connection status, and a manual disconnect
|
|
395
|
+
* function.
|
|
373
396
|
*
|
|
374
397
|
* @example
|
|
375
398
|
* ```tsx
|
|
@@ -395,17 +418,96 @@ interface ApiStreamOptions {
|
|
|
395
418
|
}
|
|
396
419
|
/** Return type of useApiStream. */
|
|
397
420
|
interface ApiStreamResult<TEvent> {
|
|
398
|
-
/** Latest event payload
|
|
421
|
+
/** Latest event payload, set in both modes — `undefined` until the first event and after each connect attempt resets it. */
|
|
399
422
|
data: TEvent | undefined;
|
|
400
423
|
/** All received events when `mode: 'accumulate'`; empty array in `'latest'` mode. */
|
|
401
424
|
events: TEvent[];
|
|
402
425
|
/** Connection lifecycle status. */
|
|
403
426
|
status: StreamStatus;
|
|
404
|
-
/**
|
|
427
|
+
/** Last connect error — set when a connect attempt rejects, cleared when the next attempt starts. */
|
|
405
428
|
error: Error | null;
|
|
406
429
|
/** Manually close the connection. */
|
|
407
430
|
disconnect: () => void;
|
|
408
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* Manages the status lifecycle for a single SSE stream connection.
|
|
434
|
+
*
|
|
435
|
+
* **Status values**
|
|
436
|
+
* - `'idle'` — no connection is being attempted. This is the status whenever
|
|
437
|
+
* `enabled` is `false`, including on mount: a hook that mounts disabled
|
|
438
|
+
* never reports anything but `'idle'` until `enabled` flips to `true`. A
|
|
439
|
+
* hook that mounts enabled skips `'idle'` entirely — the status is set
|
|
440
|
+
* during render, so its very first render already reports `'connecting'`.
|
|
441
|
+
* Consumers must not assume `'idle'` means "never
|
|
442
|
+
* connected" — a stream that is disabled after having connected returns to
|
|
443
|
+
* `'idle'` too, and `data`/`events` from the earlier connection are not
|
|
444
|
+
* cleared by that transition alone (they are cleared by mode/key changes,
|
|
445
|
+
* see below).
|
|
446
|
+
* - `'connecting'` — a connection attempt is committed to but has not settled.
|
|
447
|
+
* It is published during the render that turns the stream on, which is
|
|
448
|
+
* before `descriptor.connect()` runs: the call is made from an effect after
|
|
449
|
+
* that render commits. So `'connecting'` means "this stream is being
|
|
450
|
+
* opened", not "the connect promise is pending" — for one render the two
|
|
451
|
+
* differ, and a consumer that reads the status as proof a request is already
|
|
452
|
+
* in flight is reading it too strongly.
|
|
453
|
+
* - `'connected'` — set both when `connect()` resolves (unless a disconnect
|
|
454
|
+
* was requested while it was pending) and, independently, whenever the
|
|
455
|
+
* `onEvent` callback delivers a new event. Because every event re-asserts
|
|
456
|
+
* `'connected'`, this status also serves as "still receiving events."
|
|
457
|
+
* - `'disconnected'` — reached via any of: the descriptor's `onComplete`
|
|
458
|
+
* callback firing (the stream ended normally), `connect()` rejecting while
|
|
459
|
+
* a disconnect was requested concurrently, or the manual `disconnect()`
|
|
460
|
+
* function being called. `disconnect()` has no `enabled` guard, but calling
|
|
461
|
+
* it while the stream is disabled is not observable: the stored status moves
|
|
462
|
+
* to `'disconnected'` while the published one stays `'idle'`, and flipping
|
|
463
|
+
* `enabled` back to `true` sets `'connecting'` during that render, so the
|
|
464
|
+
* stored `'disconnected'` is overwritten before it is ever returned.
|
|
465
|
+
* - `'error'` — `connect()` rejected and no disconnect was requested while it
|
|
466
|
+
* was pending. `error` holds the rejection, coerced to an `Error` if it
|
|
467
|
+
* wasn't one already.
|
|
468
|
+
*
|
|
469
|
+
* **Transitions**
|
|
470
|
+
* - Mounting enabled, `enabled` becoming `true`, or `descriptor.key` / `mode`
|
|
471
|
+
* changing while `enabled` is `true`: `data`, `events`, and `error` are reset
|
|
472
|
+
* and status is set to `'connecting'` synchronously during render (not from
|
|
473
|
+
* an effect); `connect()` is then called from an effect that runs after that
|
|
474
|
+
* render commits.
|
|
475
|
+
* - `descriptor.key` or `mode` changing while `enabled` is `false`: `data`,
|
|
476
|
+
* `events`, and `error` are reset all the same, since that reset is not gated
|
|
477
|
+
* on `enabled`, but the status write is - so no `'connecting'` is written and
|
|
478
|
+
* the published status stays `'idle'`; `connect()` is not called. The skipped
|
|
479
|
+
* `'connecting'` is not owed later either: the change counts as handled when
|
|
480
|
+
* it happens, so what publishes `'connecting'` is the subsequent flip of
|
|
481
|
+
* `enabled` to `true`, once, for whichever key and mode are in force by then.
|
|
482
|
+
* - `enabled` becomes `false` (or starts `false`): the published status is
|
|
483
|
+
* `'idle'` for as long as `enabled` stays `false` — it is derived from
|
|
484
|
+
* `enabled` rather than written, so nothing a prior connection stored can
|
|
485
|
+
* surface through it — and `connect()` is never called; no other field is
|
|
486
|
+
* reset by this transition alone.
|
|
487
|
+
* - Unmount, `descriptor.key` change, `mode` change, or `enabled` flipping to
|
|
488
|
+
* `false` while connected or connecting: the previous connection is torn
|
|
489
|
+
* down via `descriptor.disconnect()` once its `connect()` promise settles
|
|
490
|
+
* (or immediately skipped if it rejected). All four share the same cleanup
|
|
491
|
+
* path: the effect's cleanup runs on every dependency change and on unmount.
|
|
492
|
+
* - Calling `disconnect()`: if a connection id is already resolved, it is
|
|
493
|
+
* disconnected immediately and status becomes `'disconnected'`. If
|
|
494
|
+
* `connect()` is still pending, the request is recorded and honored when
|
|
495
|
+
* the promise settles — the newly resolved connection is torn down instead
|
|
496
|
+
* of being adopted, and status is `'disconnected'`. One caveat:
|
|
497
|
+
* `disconnect()` does not cancel the event callback, so a buffered or
|
|
498
|
+
* in-flight event landing after the call re-asserts `'connected'` — and in
|
|
499
|
+
* the pending-connect case the settle handler tears the connection down
|
|
500
|
+
* without touching status, so that stray `'connected'` persists.
|
|
501
|
+
* - Stream completion while `connect()` is still pending: the current
|
|
502
|
+
* implementation lets `onComplete` set `'disconnected'`, then the settle
|
|
503
|
+
* handler adopts the connection id and re-asserts `'connected'` anyway.
|
|
504
|
+
* This is known current behavior, not a durable guarantee: a pending
|
|
505
|
+
* upstream derived-status rewrite is expected to remove this transition.
|
|
506
|
+
*
|
|
507
|
+
* `enabled` (default `true`) is the only way to defer connecting past mount;
|
|
508
|
+
* flipping it back to `true` re-runs the same connect sequence as a fresh
|
|
509
|
+
* mount would.
|
|
510
|
+
*/
|
|
409
511
|
declare function useApiStream<TEvent>(descriptor: StreamDescriptor<TEvent>, options?: ApiStreamOptions): ApiStreamResult<TEvent>;
|
|
410
512
|
|
|
411
513
|
/**
|
|
@@ -416,6 +518,11 @@ declare function useApiStream<TEvent>(descriptor: StreamDescriptor<TEvent>, opti
|
|
|
416
518
|
* - useApiQuery() for declarative reads
|
|
417
519
|
* - useApiMutation() for writes
|
|
418
520
|
* - useQueryCache() for controlled imperative cache inspection and invalidation
|
|
521
|
+
*
|
|
522
|
+
* The returned handle is not bound to the cache scope (mock mode, tenant,
|
|
523
|
+
* session): it writes to whatever scope is current. A write after an await or
|
|
524
|
+
* inside a mutation callback must use the `queryCache` that callback receives,
|
|
525
|
+
* which drops writes once the scope changed since the mutation started.
|
|
419
526
|
*/
|
|
420
527
|
declare function useQueryCache(): QueryCache;
|
|
421
528
|
|
|
@@ -498,7 +605,7 @@ declare const MfeProvider: React__default.FC<MfeProviderProps>;
|
|
|
498
605
|
* // bridge.executeActionsChain(chain);
|
|
499
606
|
* // bridge.subscribeToProperty(propertyTypeId, callback);
|
|
500
607
|
*
|
|
501
|
-
* return <div>Domain: {bridge.
|
|
608
|
+
* return <div>Domain: {bridge.extDomainId}</div>;
|
|
502
609
|
* }
|
|
503
610
|
* ```
|
|
504
611
|
*/
|
|
@@ -507,32 +614,94 @@ declare function useMfeBridge(): ChildMfeBridge;
|
|
|
507
614
|
/**
|
|
508
615
|
* useSharedProperty Hook - Shared property subscription
|
|
509
616
|
*
|
|
510
|
-
* Subscribes to shared property updates from the host
|
|
617
|
+
* Subscribes to shared property updates from the host, either through the
|
|
618
|
+
* ambient MfeProvider context or through an explicitly supplied bridge.
|
|
511
619
|
*
|
|
512
620
|
* React Layer: L3
|
|
513
621
|
*/
|
|
622
|
+
|
|
514
623
|
/**
|
|
515
|
-
*
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
624
|
+
* Options for {@link useSharedProperty}.
|
|
625
|
+
*/
|
|
626
|
+
interface UseSharedPropertyOptions<T> {
|
|
627
|
+
/**
|
|
628
|
+
* Bridge to read the property from, bypassing `MfeContext`.
|
|
629
|
+
*
|
|
630
|
+
* Pass this when the calling component never mounts `MfeProvider` (for
|
|
631
|
+
* example, a component that receives its bridge directly as a prop or from
|
|
632
|
+
* a non-React entry point). When omitted, the hook falls back to the
|
|
633
|
+
* bridge from `MfeContext` and throws if no `MfeProvider` is mounted,
|
|
634
|
+
* matching the zero-argument form.
|
|
635
|
+
*
|
|
636
|
+
* `bridge` and `propertyTypeId` identify the subscription: changing either
|
|
637
|
+
* one unsubscribes from the old source and subscribes to the new one, and
|
|
638
|
+
* the returned value reflects the new source on the same render.
|
|
639
|
+
*/
|
|
640
|
+
bridge?: ChildMfeBridge;
|
|
641
|
+
/**
|
|
642
|
+
* Value returned while the host has not published the property yet
|
|
643
|
+
* (`bridge.getProperty()` returns `undefined`).
|
|
644
|
+
*
|
|
645
|
+
* Only the `undefined` sentinel is substituted: a published `null` is a
|
|
646
|
+
* real value and is returned as-is. The host validates every published
|
|
647
|
+
* value against the property's schema before it reaches any MFE
|
|
648
|
+
* (`TypeSystemPlugin.register()` throws on a schema mismatch and the
|
|
649
|
+
* update is never stored or delivered), so no consumer-side filtering is
|
|
650
|
+
* needed -- `T` is simply the caller's declaration of that schema.
|
|
651
|
+
*
|
|
652
|
+
* `fallback` may be passed inline on every render; it does not affect the
|
|
653
|
+
* host subscription.
|
|
654
|
+
*/
|
|
655
|
+
fallback?: T;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Subscribe to a shared property from the host.
|
|
659
|
+
*
|
|
660
|
+
* Two forms:
|
|
661
|
+
*
|
|
662
|
+
* 1. **Context form** -- `useSharedProperty(propertyTypeId)`. Reads the
|
|
663
|
+
* bridge from `MfeContext` and throws if no `MfeProvider` is mounted.
|
|
664
|
+
* 2. **Options form** -- `useSharedProperty(propertyTypeId, options)`. Pass
|
|
665
|
+
* `options.bridge` for components that never mount `MfeProvider`, and/or
|
|
666
|
+
* `options.fallback` for a value to show until the host publishes one.
|
|
667
|
+
* `options.bridge` may be omitted, in which case the hook still falls
|
|
668
|
+
* back to `MfeContext`.
|
|
669
|
+
*
|
|
670
|
+
* Both forms read through `useSyncExternalStore`: the bridge is the store,
|
|
671
|
+
* `bridge.getProperty()` is the snapshot, so the first render already shows
|
|
672
|
+
* the host's current value, a publish between render and commit is picked
|
|
673
|
+
* up when React re-reads the snapshot after subscribing, and the value is
|
|
674
|
+
* tearing-protected under concurrent rendering.
|
|
675
|
+
*
|
|
676
|
+
* @param propertyTypeId - GTS type ID of the shared property to subscribe to
|
|
677
|
+
* @param options - Optional bridge override and fallback
|
|
678
|
+
* @returns The current property value; `T` when `options.fallback` is set,
|
|
679
|
+
* otherwise `T | undefined`
|
|
680
|
+
*
|
|
681
|
+
* @example Context form (inside MfeProvider)
|
|
527
682
|
* ```tsx
|
|
528
|
-
* function
|
|
529
|
-
* const
|
|
683
|
+
* function ThemedComponent() {
|
|
684
|
+
* const theme = useSharedProperty<{ primaryColor: string }>(THEME_PROPERTY_ID);
|
|
685
|
+
* return <div style={{ color: theme?.primaryColor }} />;
|
|
686
|
+
* }
|
|
687
|
+
* ```
|
|
530
688
|
*
|
|
531
|
-
*
|
|
689
|
+
* @example Explicit bridge with fallback (no MfeProvider)
|
|
690
|
+
* ```tsx
|
|
691
|
+
* function StandaloneComponent({ bridge }: { bridge: ChildMfeBridge }) {
|
|
692
|
+
* const label = useSharedProperty<string>(LABEL_PROPERTY_ID, {
|
|
693
|
+
* bridge,
|
|
694
|
+
* fallback: 'Untitled',
|
|
695
|
+
* });
|
|
696
|
+
* return <span>{label}</span>;
|
|
532
697
|
* }
|
|
533
698
|
* ```
|
|
534
699
|
*/
|
|
535
700
|
declare function useSharedProperty<T = unknown>(propertyTypeId: string): T | undefined;
|
|
701
|
+
declare function useSharedProperty<T>(propertyTypeId: string, options: UseSharedPropertyOptions<T> & {
|
|
702
|
+
fallback: T;
|
|
703
|
+
}): T;
|
|
704
|
+
declare function useSharedProperty<T = unknown>(propertyTypeId: string, options?: UseSharedPropertyOptions<T>): T | undefined;
|
|
536
705
|
|
|
537
706
|
/**
|
|
538
707
|
* useHostAction Hook - Host action requests
|
|
@@ -568,84 +737,64 @@ declare function useSharedProperty<T = unknown>(propertyTypeId: string): T | und
|
|
|
568
737
|
declare function useHostAction<TPayload extends Record<string, unknown> = Record<string, unknown>>(actionTypeId: string): (payload?: TPayload) => void;
|
|
569
738
|
|
|
570
739
|
/**
|
|
571
|
-
*
|
|
740
|
+
* useMfeRegistry Hook - Shared MfeRegistry access guard
|
|
572
741
|
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
742
|
+
* Resolves the MFE-enabled registry off the FrontX app instance and throws a
|
|
743
|
+
* descriptive error when the `microfrontends()` plugin was not installed.
|
|
744
|
+
* Extracted so every registry-consuming hook shares one guard implementation
|
|
745
|
+
* instead of hand-rolling the same `if (!app.mfeRegistry)` check.
|
|
575
746
|
*
|
|
576
747
|
* React Layer: L3
|
|
577
748
|
*/
|
|
578
749
|
|
|
579
750
|
/**
|
|
580
|
-
* Hook for
|
|
751
|
+
* Hook for accessing the MFE-enabled registry off the current FrontX app.
|
|
581
752
|
*
|
|
582
|
-
*
|
|
583
|
-
* and returns the current list of extensions for the specified domain.
|
|
753
|
+
* Throws if the app was built without the `microfrontends()` plugin.
|
|
584
754
|
*
|
|
585
|
-
* @
|
|
586
|
-
* @returns Array of extensions currently registered for the domain
|
|
755
|
+
* @returns The MFE-enabled registry
|
|
587
756
|
*
|
|
588
757
|
* @example
|
|
589
|
-
* ```
|
|
590
|
-
*
|
|
591
|
-
* const extensions = useDomainExtensions('gts.frontx.mfes.ext.domain.v1~frontx.screensets.layout.sidebar.v1');
|
|
592
|
-
*
|
|
593
|
-
* return (
|
|
594
|
-
* <div>
|
|
595
|
-
* {extensions.map(ext => (
|
|
596
|
-
* <div key={ext.id}>{ext.id}</div>
|
|
597
|
-
* ))}
|
|
598
|
-
* </div>
|
|
599
|
-
* );
|
|
600
|
-
* }
|
|
758
|
+
* ```ts
|
|
759
|
+
* const registry = useMfeRegistry();
|
|
601
760
|
* ```
|
|
602
761
|
*/
|
|
603
|
-
declare function
|
|
762
|
+
declare function useMfeRegistry(): MfeRegistry;
|
|
604
763
|
|
|
605
764
|
/**
|
|
606
|
-
*
|
|
765
|
+
* useDomainExtensions Hook - Domain extension list subscription
|
|
607
766
|
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
* ConcurrentMountStrategy.
|
|
767
|
+
* Subscribes to store changes to detect when extensions are registered or unregistered,
|
|
768
|
+
* and returns the current list of extensions for a domain.
|
|
611
769
|
*
|
|
612
770
|
* React Layer: L3
|
|
613
771
|
*/
|
|
614
772
|
|
|
615
773
|
/**
|
|
616
|
-
* Hook for observing
|
|
617
|
-
*
|
|
618
|
-
* Subscribes to the FrontX store to detect mount state changes, and returns
|
|
619
|
-
* the array of Extension instances currently mounted in the specified domain.
|
|
620
|
-
*
|
|
621
|
-
* Pairs with getMountedExtensions(domainId) on the registry and resolves each
|
|
622
|
-
* mounted extension ID to its Extension instance. IDs that have been unregistered
|
|
623
|
-
* concurrently (race against unregister) are filtered out.
|
|
624
|
-
*
|
|
625
|
-
* Returns a referentially stable array when the underlying ID list is unchanged.
|
|
774
|
+
* Hook for observing extensions registered for a domain.
|
|
626
775
|
*
|
|
627
|
-
*
|
|
628
|
-
*
|
|
776
|
+
* Subscribes to the FrontX store to detect registration state changes,
|
|
777
|
+
* and returns the current list of extensions for the specified domain.
|
|
629
778
|
*
|
|
630
|
-
* @param domainId - Domain ID to query
|
|
631
|
-
* @returns Array of
|
|
779
|
+
* @param domainId - Domain ID to query extensions for
|
|
780
|
+
* @returns Array of extensions currently registered for the domain
|
|
632
781
|
*
|
|
633
782
|
* @example
|
|
634
783
|
* ```tsx
|
|
635
|
-
* function
|
|
636
|
-
* const
|
|
784
|
+
* function SidebarExtensions() {
|
|
785
|
+
* const extensions = useDomainExtensions('gts.frontx.mfes.ext.domain.v1~frontx.screensets.layout.sidebar.v1');
|
|
637
786
|
*
|
|
638
787
|
* return (
|
|
639
|
-
* <
|
|
640
|
-
* {
|
|
641
|
-
* <
|
|
788
|
+
* <div>
|
|
789
|
+
* {extensions.map(ext => (
|
|
790
|
+
* <div key={ext.id}>{ext.id}</div>
|
|
642
791
|
* ))}
|
|
643
|
-
* </
|
|
792
|
+
* </div>
|
|
644
793
|
* );
|
|
645
794
|
* }
|
|
646
795
|
* ```
|
|
647
796
|
*/
|
|
648
|
-
declare function
|
|
797
|
+
declare function useDomainExtensions(domainId: string): Array<Omit<Extension, 'route'>>;
|
|
649
798
|
|
|
650
799
|
/**
|
|
651
800
|
* useRegisteredPackages Hook - Registered GTS packages subscription
|
|
@@ -698,13 +847,32 @@ declare function useRegisteredPackages(): string[];
|
|
|
698
847
|
*
|
|
699
848
|
* Styling strategy:
|
|
700
849
|
* 1. adoptHostStylesIntoShadowRoot() clones all host <style> and <link> into the
|
|
701
|
-
* shadow root, bringing the full compiled Tailwind CSS (including
|
|
702
|
-
* since the host's content paths cover src/mfe_packages/**)
|
|
850
|
+
* front of the shadow root, bringing the full compiled Tailwind CSS (including
|
|
851
|
+
* MFE utilities, since the host's content paths cover src-app/mfe_packages/**) and
|
|
852
|
+
* the ui-kit component CSS (the host entry side-effect-imports
|
|
853
|
+
* @gears-frontx/ui-kit so that CSS exists in the host document; the kit's
|
|
854
|
+
* CSS-module class names are stable per kit version, so they match the
|
|
855
|
+
* classes MFE bundles reference only while host and MFE install the same
|
|
856
|
+
* kit version - the template-pin-drift policy check is what guarantees
|
|
857
|
+
* that; a drifted MFE renders its kit components unstyled with no error).
|
|
858
|
+
* Front, not back, so the MFE's own stylesheets
|
|
859
|
+
* outrank them - see the method. Design tokens must therefore be full CSS
|
|
860
|
+
* colors - both Tailwind utilities (var(--x)) and ui-kit component CSS
|
|
861
|
+
* consume them directly.
|
|
703
862
|
* 2. injectBaseResets() adds box-model resets and :host defaults that aren't part
|
|
704
|
-
* of Tailwind's compiled output but are needed for consistent rendering
|
|
863
|
+
* of Tailwind's compiled output but are needed for consistent rendering, and
|
|
864
|
+
* positions them at the end of the shell-owned head - after the adopted block
|
|
865
|
+
* and the isolation style, ahead of the MFE's own CSS.
|
|
705
866
|
* 3. Subclasses may override initializeStyles() to inject additional CSS that is
|
|
706
867
|
* not covered by the host stylesheet (e.g., MFE-specific @font-face rules).
|
|
707
868
|
*
|
|
869
|
+
* Every mount therefore leaves the same sequence - adopted host block, shadow
|
|
870
|
+
* isolation, base resets, then the MFE's stylesheets - so the shell's CSS is
|
|
871
|
+
* context and the MFE wins every specificity tie against all three shell blocks.
|
|
872
|
+
* Steps 1 and 2 both position what they own rather than appending beside it,
|
|
873
|
+
* because a remounted container arrives with its shadow root intact and the MFE's
|
|
874
|
+
* own stylesheet removed and re-appended around the remount - see each method.
|
|
875
|
+
*
|
|
708
876
|
* Theme CSS variables are delivered via CSS inheritance from :root (Shadow DOM)
|
|
709
877
|
* or via MountManager injection (iframe). MFE lifecycles do NOT need to subscribe
|
|
710
878
|
* to theme changes or call applyThemeToShadowRoot.
|
|
@@ -717,16 +885,113 @@ declare abstract class ThemeAwareReactLifecycle implements MfeEntryLifecycle<Chi
|
|
|
717
885
|
private root;
|
|
718
886
|
constructor(app: FrontXApp);
|
|
719
887
|
mount(container: Element | ShadowRoot, bridge: ChildMfeBridge, mountContext?: MfeMountContext): void;
|
|
720
|
-
|
|
888
|
+
/**
|
|
889
|
+
* `Root.unmount()` itself is synchronous, but a nested `ExtensionDomainSlot`
|
|
890
|
+
* mounted anywhere in this root's own tree cannot make ITS cleanup
|
|
891
|
+
* synchronous too — its mounter's own `detach()` awaits per-extension
|
|
892
|
+
* unmounts. Collecting whatever that cleanup fire-and-forgets (through
|
|
893
|
+
* `domainTeardownCollector`, scoped to this one `Root.unmount()` call) and
|
|
894
|
+
* awaiting it here is what makes this method's own returned promise settle
|
|
895
|
+
* only once every nested domain this root owns has actually finished
|
|
896
|
+
* tearing down — never before. A root with no routed nested domain
|
|
897
|
+
* collects nothing, and this resolves exactly as before (a microtask after
|
|
898
|
+
* the synchronous unmount, same observable timing `void | Promise<void>`
|
|
899
|
+
* already allows).
|
|
900
|
+
*/
|
|
901
|
+
unmount(_container: Element | ShadowRoot): Promise<void>;
|
|
721
902
|
/**
|
|
722
903
|
* Copy all inline <style> and <link rel="stylesheet"> from the host document
|
|
723
904
|
* into the shadow root so that Tailwind and component styles apply inside the MFE.
|
|
905
|
+
*
|
|
906
|
+
* The clones are inserted ahead of everything already in the shadow root, never
|
|
907
|
+
* appended, because adopted host styles are context rather than authority: where
|
|
908
|
+
* they and the MFE's own CSS declare the same property at equal specificity, the
|
|
909
|
+
* MFE has to win. Appending inverted that. `MfeHandlerMF` injects the MFE's
|
|
910
|
+
* compiled stylesheet into the shadow root before it calls mount, so an appended
|
|
911
|
+
* clone of the shell's Tailwind preflight - whose
|
|
912
|
+
* `button, [type='button'], [type='reset'], [type='submit']` rule sets
|
|
913
|
+
* `background-color: transparent` at specificity (0,1,0) - tied with
|
|
914
|
+
* `@gears-frontx/ui-kit`'s single-class button rule and won on document order,
|
|
915
|
+
* leaving every kit Button transparent until it was hovered.
|
|
916
|
+
*
|
|
917
|
+
* Inserting at the front rather than pushing MFE styles to the back is what makes
|
|
918
|
+
* the invariant hold for stylesheets that appear after mount too - a lazily
|
|
919
|
+
* imported component's CSS module, or whatever initializeStyles() adds - since
|
|
920
|
+
* those land behind the adopted block by construction.
|
|
921
|
+
*
|
|
922
|
+
* A cascade layer around the adopted CSS was the alternative and is rejected:
|
|
923
|
+
* layered rules lose to unlayered ones at *any* specificity, so a host utility
|
|
924
|
+
* class would stop overriding an MFE element selector. Document order keeps
|
|
925
|
+
* specificity in charge and only settles the ties.
|
|
926
|
+
*
|
|
927
|
+
* The block replaces its predecessor instead of stacking on it, the same
|
|
928
|
+
* upsert shape `injectStylesheet` and `injectCssVariables` use in
|
|
929
|
+
* `@gears-frontx/mfes`' shadow utilities, widened from one id-keyed node to a
|
|
930
|
+
* marked block. Replacement is required rather than tidy: `createShadowRoot`
|
|
931
|
+
* hands back an existing `element.shadowRoot` instead of attaching a new one,
|
|
932
|
+
* so remounting the same container runs this method again on a shadow root
|
|
933
|
+
* that already holds a full adopted block, and appending would grow it once
|
|
934
|
+
* per mount with no bound. It does not save re-resolving the cloned `<link>`s -
|
|
935
|
+
* every mount clones them afresh and the browser resolves each clone; what
|
|
936
|
+
* replacement buys is that the count stays at one block instead of one per
|
|
937
|
+
* mount.
|
|
938
|
+
*
|
|
939
|
+
* The block is rebuilt from the host head rather than left in place, because
|
|
940
|
+
* the head is not fixed: a lazily imported chunk adds stylesheets to it after
|
|
941
|
+
* the first mount, and the second mount has to pick those up.
|
|
942
|
+
*
|
|
943
|
+
* A `<style>` is copied into a new element that holds the host's CSS - see
|
|
944
|
+
* `cssToCopy` - and takes three things from the host element: `media`,
|
|
945
|
+
* without which a print-only host style applies on screen inside the MFE;
|
|
946
|
+
* `type`, which keeps the copy of a non-CSS element as inert as the original;
|
|
947
|
+
* and the nonce, without which a nonce-based CSP blocks the copy. The nonce is read from the `nonce` property, because
|
|
948
|
+
* browsers blank the attribute in a document served with a CSP header.
|
|
949
|
+
* Nothing else is carried over, because libraries look for their own
|
|
950
|
+
* attributes inside the shadow root: styled-components, rendering into it,
|
|
951
|
+
* puts its tag right after the last `style[data-styled]` there, so a copy of
|
|
952
|
+
* the host's tag would pull the MFE's rules ahead of the base resets and the
|
|
953
|
+
* MFE's own CSS. A `<link>` is a deep clone and is loaded from its `href`
|
|
954
|
+
* again.
|
|
955
|
+
*
|
|
956
|
+
* The fresh block goes in before the previous one comes out. Removing first
|
|
957
|
+
* leaves the shadow root with no host CSS at all, and everything between that
|
|
958
|
+
* removal and the insertion is synchronous work in this same task - so the gap
|
|
959
|
+
* never reaches a paint, but any code that reads computed styles from the tree
|
|
960
|
+
* in between sees an unstyled one. Inserting first costs one moment with two
|
|
961
|
+
* blocks present, which changes nothing: the old block is a clone of the same
|
|
962
|
+
* host head and loses every tie to the new one on document order anyway.
|
|
724
963
|
*/
|
|
725
964
|
protected adoptHostStylesIntoShadowRoot(shadowRoot: ShadowRoot): void;
|
|
726
965
|
/**
|
|
727
966
|
* Box-model resets and :host defaults needed inside every shadow root.
|
|
728
967
|
* These aren't part of Tailwind's compiled output but are required for
|
|
729
968
|
* consistent rendering across browsers.
|
|
969
|
+
*
|
|
970
|
+
* Reuses the node a previous mount left behind, exactly as `injectStylesheet`
|
|
971
|
+
* does in `@gears-frontx/mfes`' shadow utilities: a remount runs against a
|
|
972
|
+
* shadow root that `createShadowRoot` handed back intact, and appending a
|
|
973
|
+
* second copy would add one node per mount forever.
|
|
974
|
+
*
|
|
975
|
+
* Reuse alone is not enough, which is why the node is also positioned on every
|
|
976
|
+
* mount rather than left where the previous one sat. These resets are context
|
|
977
|
+
* like the adopted block is - `border-color: currentColor` on `*` is a 0-0-0
|
|
978
|
+
* declaration that beats an MFE preflight's own 0-0-0 reset purely on document
|
|
979
|
+
* order - so they have to stay ahead of the MFE's CSS, and where they land is
|
|
980
|
+
* not stable on its own. `MfeHandlerMF.wrapLifecycleWithStylesheets` removes the
|
|
981
|
+
* MFE's stylesheet on unmount and appends a fresh one before the next mount, so
|
|
982
|
+
* a node merely left in place ends up ahead of that stylesheet on a remount and
|
|
983
|
+
* behind it on the first mount: two different cascades for one component.
|
|
984
|
+
* Anchoring it to the end of the shell-owned head gives every mount the same
|
|
985
|
+
* order - adopted block, isolation, resets, MFE - which is also the order the
|
|
986
|
+
* adoption method's invariant is written against.
|
|
987
|
+
*
|
|
988
|
+
* With no shell-owned node to anchor to, the resets go to the front. That is the
|
|
989
|
+
* plain-`Element` container: no adopted block, no isolation style, and the MFE
|
|
990
|
+
* stylesheet already appended by the handler, so the front is again the only
|
|
991
|
+
* position that leaves the MFE winning ties.
|
|
992
|
+
*
|
|
993
|
+
* Looked up by attribute-selector form rather than `getElementById`, which
|
|
994
|
+
* `ShadowRoot` has but `Element` does not, and this hook takes either.
|
|
730
995
|
*/
|
|
731
996
|
private injectBaseResets;
|
|
732
997
|
/**
|
|
@@ -763,7 +1028,7 @@ declare abstract class ThemeAwareReactLifecycle implements MfeEntryLifecycle<Chi
|
|
|
763
1028
|
*/
|
|
764
1029
|
interface ExtensionDomainSlotProps {
|
|
765
1030
|
/**
|
|
766
|
-
* The
|
|
1031
|
+
* The MFE registry instance.
|
|
767
1032
|
*/
|
|
768
1033
|
registry: MfeRegistry;
|
|
769
1034
|
/**
|
|
@@ -829,4 +1094,4 @@ interface EventPayloadMap extends EventPayloadMap$1 {
|
|
|
829
1094
|
*/
|
|
830
1095
|
declare const eventBus: EventBus<EventPayloadMap>;
|
|
831
1096
|
|
|
832
|
-
export { type ApiInfiniteQueryOptions, type ApiInfiniteQueryPageContext, ApiInfiniteQueryResult, ApiMutationResult, type ApiQueryOverrides, ApiQueryResult, type ApiStreamOptions, type ApiStreamResult, ApiSuspenseInfiniteQueryResult, ApiSuspenseQueryResult, CanAccess, CanAccessProps, type EventPayloadMap, ExtensionDomainSlot, type ExtensionDomainSlotProps, FrontXContext, FrontXProvider, FrontXProviderProps, MfeContextValue, MfeProvider, type MfeProviderProps, MutationCallbackContext, QueryCache, ThemeAwareReactLifecycle, type UseApiMutationOptions, UseCanAccessResult, UseFormattersReturn, UseScreenTranslationsReturn, UseThemeReturn, UseTranslationReturn, eventBus, useApiInfiniteQuery, useApiMutation, useApiQuery, useApiStream, useApiSuspenseInfiniteQuery, useApiSuspenseQuery, useAppDispatch, useAppSelector, useCanAccess, useDomainExtensions, useFormatters, useFrontX, useHostAction, useMfeBridge,
|
|
1097
|
+
export { type ApiInfiniteQueryOptions, type ApiInfiniteQueryPageContext, ApiInfiniteQueryResult, ApiMutationResult, type ApiQueryOverrides, ApiQueryResult, type ApiStreamOptions, type ApiStreamResult, type ApiSuspenseInfiniteQueryOptions, ApiSuspenseInfiniteQueryResult, type ApiSuspenseQueryOverrides, ApiSuspenseQueryResult, CanAccess, CanAccessProps, type EventPayloadMap, ExtensionDomainSlot, type ExtensionDomainSlotProps, FrontXContext, FrontXProvider, FrontXProviderProps, MfeContextValue, MfeProvider, type MfeProviderProps, MutationCallbackContext, QueryCache, ThemeAwareReactLifecycle, type UseApiMutationOptions, UseCanAccessResult, UseFormattersReturn, UseScreenTranslationsReturn, type UseSharedPropertyOptions, UseThemeReturn, UseTranslationReturn, eventBus, useApiInfiniteQuery, useApiMutation, useApiQuery, useApiStream, useApiSuspenseInfiniteQuery, useApiSuspenseQuery, useAppDispatch, useAppSelector, useCanAccess, useDomainExtensions, useFormatters, useFrontX, useHostAction, useMfeBridge, useMfeRegistry, useQueryCache, useRegisteredPackages, useScreenTranslations, useSharedProperty, useTheme, useTranslation };
|