@kosdev-code/kos-ui-plugin 2.0.31 → 2.0.32

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/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./emotion-react-jsx-runtime.browser.esm-UFFvJLiS.cjs"),d=require("@emotion/styled"),v=require("@kosdev-code/kos-ui-sdk"),i=require("react"),a=require("./resolve-best-extension-D5Ord7XK.cjs");require("react/jsx-runtime");const h=i.createContext(void 0),P=d.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./emotion-react-jsx-runtime.browser.esm-UFFvJLiS.cjs"),h=require("@emotion/styled"),C=require("@kosdev-code/kos-ui-sdk"),o=require("react"),p=require("./resolve-best-extension-DSdPcuL3.cjs");require("react/jsx-runtime");const P=o.createContext(void 0),f=h.div`
2
2
  padding-inline: 20px;
3
3
  width: 100%;
4
4
  height: 100vh;
@@ -11,13 +11,13 @@
11
11
  top: 0;
12
12
  left: 0;
13
13
  z-index: 10000;
14
- `,w=({remotesOverride:e,children:t})=>{const[n,l]=i.useState();return i.useEffect(()=>{a.initPluginManager(e).then(r=>{l(r)})},[e]),c.jsx(h.Provider,{value:n,children:n?t:c.jsx(P,{children:"Loading remote plugins..."})})},x=()=>{const e=i.useContext(h);if(!e)throw new Error("useKosPluginsContext must be used within a KosPluginProvider");return e},j=e=>{var t;return((t=e==null?void 0:e.view)==null?void 0:t.component)!==void 0},f=({extension:e,module:t})=>{const{extensions:n}=x(),[l,r]=i.useState(null),[s,u]=i.useState(null);return i.useEffect(()=>{async function g(){const o=a.resolveBestExtension(n==null?void 0:n[e],t);u(o??null);const m=(o==null?void 0:o.remote)||"",p=j(o)?o.view.component:o==null?void 0:o.component,C=p?`./${p}`:"";if(!m)return;const y=i.lazy(()=>a.mf.loadRemoteModule(m,C));r(y)}g()},[n,t,e]),[l,s]},b=d.div`
14
+ `,j=({remotesOverride:e,onBeforeInitialize:n,pluginConfig:s,children:u})=>{const[l,r]=o.useState(),[a,x]=o.useState(null);return o.useEffect(()=>{(async()=>{var d,g;try{n&&(console.log("KosPluginProvider: Waiting for pre-initialization conditions..."),await n(),console.log("KosPluginProvider: Pre-initialization complete"));let c=e;const m=(d=window.KosPlugins)==null?void 0:d.__dynamicRemotes;c||(m&&Object.keys(m).length>0?(console.log("KosPluginProvider: Using existing plugin initialization"),c=m):(console.log("KosPluginProvider: Initializing plugins..."),await p.initializeKosPlugins(s),c=(g=window.KosPlugins)==null?void 0:g.__dynamicRemotes));const w=await p.initPluginManager(c);r(w)}catch(c){console.error("KosPluginProvider: Failed to initialize plugins",c),x(c)}})()},[e,n,s]),a?i.jsxs(f,{children:[i.jsx("div",{children:"Failed to load plugins"}),i.jsx("div",{style:{fontSize:"12px",marginTop:"10px",opacity:.8},children:a.message})]}):i.jsx(P.Provider,{value:l,children:l?u:i.jsx(f,{children:"Loading remote plugins..."})})},y=()=>{const e=o.useContext(P);if(!e)throw new Error("useKosPluginsContext must be used within a KosPluginProvider");return e},K=e=>{var n;return((n=e==null?void 0:e.view)==null?void 0:n.component)!==void 0},v=({extension:e,module:n})=>{const{extensions:s}=y(),[u,l]=o.useState(null),[r,a]=o.useState(null);return o.useEffect(()=>{async function x(){const t=p.resolveBestExtension(s==null?void 0:s[e],n);a(t??null);const d=(t==null?void 0:t.remote)||"",g=K(t)?t.view.component:t==null?void 0:t.component,c=g?`./${g}`:"";if(!d)return;const m=o.lazy(()=>p.mf.loadRemoteModule(d,c));l(m)}x()},[s,n,e]),[u,r]},z=h.div`
15
15
  align-items: center;
16
16
  display: flex;
17
17
  height: 100%;
18
18
  justify-content: center;
19
19
  width: 100%;
20
- `,S=d.div`
20
+ `,b=h.div`
21
21
  align-items: center;
22
22
  background-color: transparent;
23
23
  display: flex;
@@ -25,5 +25,5 @@
25
25
  height: ${e=>e.height};
26
26
  justify-content: center;
27
27
  width: ${e=>e.width};
28
- `,k=({extension:e,fallback:t,module:n,props:l})=>{const[r,s]=f({extension:e,module:n});if(!r)return null;const u=t||c.jsx(b,{children:`Dynamic component, ${e}, not found...`});return c.jsx(v.ErrorBoundaryWithFallback,{fallback:u,children:c.jsx(i.Suspense,{fallback:s!=null&&s.size?c.jsx(S,{width:s.size.width,height:s.size.height}):null,children:c.jsx(r,{...l})})})};exports.DynamicComponent=k;exports.KosPluginProvider=w;exports.RemotesContext=h;exports.useDynamicComponent=f;exports.useKosPluginsContext=x;
28
+ `,S=({extension:e,fallback:n,module:s,props:u})=>{const[l,r]=v({extension:e,module:s});if(!l)return null;const a=n||i.jsx(z,{children:`Dynamic component, ${e}, not found...`});return i.jsx(C.ErrorBoundaryWithFallback,{fallback:a,children:i.jsx(o.Suspense,{fallback:r!=null&&r.size?i.jsx(b,{width:r.size.width,height:r.size.height}):null,children:i.jsx(l,{...u})})})};exports.DynamicComponent=S;exports.KosPluginProvider=j;exports.RemotesContext=P;exports.useDynamicComponent=v;exports.useKosPluginsContext=y;
29
29
  //# sourceMappingURL=index.cjs.map
package/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/plugins-provider/plugins-provider.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-dynamic-component.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/components/dynamic-component/dynamic-component.tsx"],"sourcesContent":["/**\n *\n *\n * @module remotes-provider\n * @description Provides a context for managing dynamic remotes and extensions in a React application.\n */\n\nimport styled from \"@emotion/styled\";\nimport {\n PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport type { DynamicRemotes } from \"../../../types/global\";\nimport type { PluginExtension } from \"../../../types/plugins\";\nimport { initPluginManager } from \"../../utils/plugin-extension-manager\";\n\ninterface PluginsType {\n remotes?: DynamicRemotes;\n extensions?: PluginExtensionsType;\n extensionPoints?: Record<string, PluginExtension[]>;\n getExtensions: (extensionPointId: string) => PluginExtension[];\n}\n\nexport interface PluginExtensionsType {\n [k: string]: {\n [k: string]: PluginExtension;\n };\n}\n\n/**\n * The context for managing dynamic remotes and extensions.\n */\nexport const RemotesContext = createContext<PluginsType | undefined>(undefined);\n\ninterface Props {\n remotesOverride?: DynamicRemotes;\n}\n\nconst MessageContainer = styled.div`\n padding-inline: 20px;\n width: 100%;\n height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n font-size: 14px;\n top: 0;\n left: 0;\n z-index: 10000;\n`;\n/**\n * The provider component for the RemotesContext.\n */\nexport const KosPluginProvider: React.FunctionComponent<\n PropsWithChildren<Props>\n> = ({ remotesOverride, children }) => {\n const [contextValue, setContextValue] = useState<PluginsType | undefined>();\n\n useEffect(() => {\n initPluginManager(remotesOverride).then((value) => {\n setContextValue(value);\n });\n }, [remotesOverride]);\n\n return (\n <RemotesContext.Provider value={contextValue}>\n {contextValue ? (\n children\n ) : (\n <MessageContainer>Loading remote plugins...</MessageContainer>\n )}\n </RemotesContext.Provider>\n );\n};\n\n/**\n * Custom hook for accessing the RemotesContext.\n */\nexport const useKosPluginsContext = () => {\n const context = useContext(RemotesContext);\n if (!context) {\n throw new Error(\n \"useKosPluginsContext must be used within a KosPluginProvider\"\n );\n }\n return context;\n};\n","import { loadRemoteModule } from \"@nx/react/mf\";\n\nimport React, { useEffect, useState } from \"react\";\nimport type {\n BasePluginExtension,\n BaseViewPluginExtension,\n} from \"../../types/plugins\";\nimport { useKosPluginsContext } from \"../contexts\";\nimport { resolveBestExtension } from \"../utils/resolve-best-extension\";\n\ninterface Props {\n /**\n * The extension point ID to resolve plugin modules from.\n * Example: \"ddk.ncui.settings.tabView\"\n */\n extension: string;\n\n /**\n * Optional module ID to load a specific plugin.\n * If not provided, the plugin with the **lowest rank** for the extension point is used.\n */\n module?: string;\n}\n\ntype DynamicComponentResult = [\n React.FunctionComponent | null,\n BasePluginExtension | null\n];\n\n/**\n * Determines whether a plugin extension follows the \"view\" structure.\n * This allows resolving the correct field (`view.component` vs `component`) when loading.\n */\nconst isViewPlugin = (module: any): module is BaseViewPluginExtension =>\n module?.view?.component !== undefined;\n\n/**\n * React hook to resolve and lazily load a plugin component for a given extension point.\n *\n * - If `module` is provided, it directly loads that plugin.\n * - If `module` is not provided, it uses the **lowest-ranked plugin** from the extension point.\n * - Supports both standard plugins (`component`) and view-style plugins (`view.component`)\n * - Uses React.lazy + Module Federation to dynamically import the remote component.\n *\n * @param props.extension The extension point to resolve plugins from\n * @param props.module (Optional) Specific module ID to use, otherwise the highest-priority plugin is loaded\n * @returns A tuple: `[Component, PluginExtension]`\n */\nexport const useDynamicComponent = ({\n extension,\n module,\n}: Props): DynamicComponentResult => {\n const { extensions } = useKosPluginsContext();\n\n const [Component, setComponent] = useState<React.FunctionComponent | null>(\n null\n );\n const [extensionPoint, setExtensionPoint] =\n useState<BasePluginExtension | null>(null);\n\n useEffect(() => {\n async function loadComponent() {\n // Determine which plugin to use\n\n const _module = resolveBestExtension(extensions?.[extension], module);\n\n setExtensionPoint(_module ?? null);\n\n const remote = _module?.remote || \"\";\n\n // Resolve the component path for the module\n const componentName = isViewPlugin(_module)\n ? _module.view.component\n : _module?.component;\n\n const componentPath = componentName ? `./${componentName}` : \"\";\n\n if (!remote) return;\n\n // Load the component using Module Federation\n const Comp = React.lazy(() => loadRemoteModule(remote, componentPath));\n setComponent(Comp);\n }\n\n loadComponent();\n }, [extensions, module, extension]);\n\n return [Component, extensionPoint];\n};\n","import styled from \"@emotion/styled\";\nimport { ErrorBoundaryWithFallback } from \"@kosdev-code/kos-ui-sdk\";\nimport React, { Suspense } from \"react\";\nimport { useDynamicComponent } from \"../../hooks\";\n\nconst NotFound = styled.div`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n`;\ninterface Props {\n extension: string;\n fallback?: React.ReactNode;\n module?: string;\n props?: any;\n}\n\nconst Skeleton = styled.div<{ width: string; height: string }>`\n align-items: center;\n background-color: transparent;\n display: flex;\n flex-direction: column;\n height: ${(props) => props.height};\n justify-content: center;\n width: ${(props) => props.width};\n`;\n\nexport const DynamicComponent: React.FunctionComponent<Props> = ({\n extension,\n fallback,\n module,\n props,\n}) => {\n // get the list of extensions from the context\n const [Component, extensionPoint] = useDynamicComponent({\n extension,\n module,\n });\n // get the module from the extension\n\n if (!Component) {\n return null;\n }\n\n const fb = fallback || (\n <NotFound>{`Dynamic component, ${extension}, not found...`}</NotFound>\n );\n\n return (\n <ErrorBoundaryWithFallback fallback={fb}>\n <Suspense\n fallback={\n extensionPoint?.size ? (\n <Skeleton\n width={extensionPoint.size.width}\n height={extensionPoint.size.height}\n />\n ) : null\n }\n >\n <Component {...props} />\n </Suspense>\n </ErrorBoundaryWithFallback>\n );\n};\n"],"names":["RemotesContext","createContext","MessageContainer","styled","KosPluginProvider","remotesOverride","children","contextValue","setContextValue","useState","useEffect","initPluginManager","value","jsx","useKosPluginsContext","context","useContext","isViewPlugin","module","_a","useDynamicComponent","extension","extensions","Component","setComponent","extensionPoint","setExtensionPoint","loadComponent","_module","resolveBestExtension","remote","componentName","componentPath","Comp","React","loadRemoteModule","NotFound","Skeleton","props","DynamicComponent","fallback","fb","ErrorBoundaryWithFallback","Suspense"],"mappings":"6TAmCa,MAAAA,EAAiBC,EAAAA,cAAuC,MAAS,EAMxEC,EAAmBC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBnBC,EAET,CAAC,CAAE,gBAAAC,EAAiB,SAAAC,KAAe,CACrC,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAkC,SAAA,EAE1EC,OAAAA,EAAAA,UAAU,IAAM,CACdC,EAAAA,kBAAkBN,CAAe,EAAE,KAAMO,GAAU,CACjDJ,EAAgBI,CAAK,CAAA,CACtB,CAAA,EACA,CAACP,CAAe,CAAC,EAGlBQ,EAAAA,IAACb,E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AAM,KAAK;AAAA,EAGpBC,EAAmD,CAAC,CAC/D,UAAAlB,EACA,SAAAmB,EACA,OAAAtB,EACA,MAAAoB,CACF,IAAM,CAEJ,KAAM,CAACf,EAAWE,CAAc,EAAIL,EAAoB,CACtD,UAAAC,EACA,OAAAH,CAAA,CACD,EAGD,GAAI,CAACK,EACI,OAAA,KAGT,MAAMkB,EAAKD,GACT3B,EAAA,IAACuB,EAAU,CAAA,SAAA,sBAAsBf,CAAS,gBAAiB,CAAA,EAI3D,OAAAR,EAAAA,IAAC6B,EAAAA,0BAA0B,CAAA,SAAUD,EACnC,SAAA5B,EAAA,IAAC8B,EAAA,SAAA,CACC,SACElB,GAAA,MAAAA,EAAgB,KACdZ,EAAA,IAACwB,EAAA,CACC,MAAOZ,EAAe,KAAK,MAC3B,OAAQA,EAAe,KAAK,MAAA,CAAA,EAE5B,KAGN,SAAAZ,EAAAA,IAACU,EAAW,CAAA,GAAGe,CAAO,CAAA,CAAA,CAE1B,CAAA,CAAA,CAEJ"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/plugins-provider/plugins-provider.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-dynamic-component.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/components/dynamic-component/dynamic-component.tsx"],"sourcesContent":["/**\n *\n *\n * @module remotes-provider\n * @description Provides a context for managing dynamic remotes and extensions in a React application.\n */\n\nimport styled from \"@emotion/styled\";\nimport {\n PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport type { DynamicRemotes } from \"../../../types/global\";\nimport type { PluginExtension } from \"../../../types/plugins\";\nimport { initializeKosPlugins } from \"../../utils/initialize-plugins\";\nimport { initPluginManager } from \"../../utils/plugin-extension-manager\";\n\ninterface PluginsType {\n remotes?: DynamicRemotes;\n extensions?: PluginExtensionsType;\n extensionPoints?: Record<string, PluginExtension[]>;\n getExtensions: (extensionPointId: string) => PluginExtension[];\n}\n\nexport interface PluginExtensionsType {\n [k: string]: {\n [k: string]: PluginExtension;\n };\n}\n\n/**\n * The context for managing dynamic remotes and extensions.\n */\nexport const RemotesContext = createContext<PluginsType | undefined>(undefined);\n\ninterface Props {\n remotesOverride?: DynamicRemotes;\n /**\n * Optional async function to execute before initializing plugins.\n * This can be used to wait for specific events or conditions before\n * fetching and loading plugins.\n */\n onBeforeInitialize?: () => Promise<void>;\n /**\n * Optional configuration for plugin initialization\n */\n pluginConfig?: {\n pluginBaseUrl?: string;\n pluginApiPath?: string;\n pluginContext?: {\n context: string;\n group: string;\n };\n overrides?: Record<string, string>;\n };\n}\n\nconst MessageContainer = styled.div`\n padding-inline: 20px;\n width: 100%;\n height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n font-size: 14px;\n top: 0;\n left: 0;\n z-index: 10000;\n`;\n/**\n * The provider component for the RemotesContext.\n */\nexport const KosPluginProvider: React.FunctionComponent<\n PropsWithChildren<Props>\n> = ({ remotesOverride, onBeforeInitialize, pluginConfig, children }) => {\n const [contextValue, setContextValue] = useState<PluginsType | undefined>();\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const initialize = async () => {\n try {\n // Wait for any pre-initialization conditions\n if (onBeforeInitialize) {\n console.log(\n \"KosPluginProvider: Waiting for pre-initialization conditions...\"\n );\n await onBeforeInitialize();\n console.log(\"KosPluginProvider: Pre-initialization complete\");\n }\n\n let remotes = remotesOverride;\n\n // Check if plugins are already initialized (backwards compatibility)\n const existingRemotes = window.KosPlugins?.__dynamicRemotes;\n\n if (!remotes) {\n if (existingRemotes && Object.keys(existingRemotes).length > 0) {\n console.log(\n \"KosPluginProvider: Using existing plugin initialization\"\n );\n remotes = existingRemotes;\n } else {\n console.log(\"KosPluginProvider: Initializing plugins...\");\n await initializeKosPlugins(pluginConfig);\n // initializeKosPlugins sets window.KosPlugins.__dynamicRemotes\n remotes = window.KosPlugins?.__dynamicRemotes;\n }\n }\n\n // Initialize the plugin manager with the remotes\n const value = await initPluginManager(remotes);\n setContextValue(value);\n } catch (err) {\n console.error(\"KosPluginProvider: Failed to initialize plugins\", err);\n setError(err as Error);\n }\n };\n\n initialize();\n }, [remotesOverride, onBeforeInitialize, pluginConfig]);\n\n if (error) {\n return (\n <MessageContainer>\n <div>Failed to load plugins</div>\n <div style={{ fontSize: \"12px\", marginTop: \"10px\", opacity: 0.8 }}>\n {error.message}\n </div>\n </MessageContainer>\n );\n }\n\n return (\n <RemotesContext.Provider value={contextValue}>\n {contextValue ? (\n children\n ) : (\n <MessageContainer>Loading remote plugins...</MessageContainer>\n )}\n </RemotesContext.Provider>\n );\n};\n\n/**\n * Custom hook for accessing the RemotesContext.\n */\nexport const useKosPluginsContext = () => {\n const context = useContext(RemotesContext);\n if (!context) {\n throw new Error(\n \"useKosPluginsContext must be used within a KosPluginProvider\"\n );\n }\n return context;\n};\n","import { loadRemoteModule } from \"@nx/react/mf\";\n\nimport React, { useEffect, useState } from \"react\";\nimport type {\n BasePluginExtension,\n BaseViewPluginExtension,\n} from \"../../types/plugins\";\nimport { useKosPluginsContext } from \"../contexts\";\nimport { resolveBestExtension } from \"../utils/resolve-best-extension\";\n\ninterface Props {\n /**\n * The extension point ID to resolve plugin modules from.\n * Example: \"ddk.ncui.settings.tabView\"\n */\n extension: string;\n\n /**\n * Optional module ID to load a specific plugin.\n * If not provided, the plugin with the **lowest rank** for the extension point is used.\n */\n module?: string;\n}\n\ntype DynamicComponentResult = [\n React.FunctionComponent | null,\n BasePluginExtension | null\n];\n\n/**\n * Determines whether a plugin extension follows the \"view\" structure.\n * This allows resolving the correct field (`view.component` vs `component`) when loading.\n */\nconst isViewPlugin = (module: any): module is BaseViewPluginExtension =>\n module?.view?.component !== undefined;\n\n/**\n * React hook to resolve and lazily load a plugin component for a given extension point.\n *\n * - If `module` is provided, it directly loads that plugin.\n * - If `module` is not provided, it uses the **lowest-ranked plugin** from the extension point.\n * - Supports both standard plugins (`component`) and view-style plugins (`view.component`)\n * - Uses React.lazy + Module Federation to dynamically import the remote component.\n *\n * @param props.extension The extension point to resolve plugins from\n * @param props.module (Optional) Specific module ID to use, otherwise the highest-priority plugin is loaded\n * @returns A tuple: `[Component, PluginExtension]`\n */\nexport const useDynamicComponent = ({\n extension,\n module,\n}: Props): DynamicComponentResult => {\n const { extensions } = useKosPluginsContext();\n\n const [Component, setComponent] = useState<React.FunctionComponent | null>(\n null\n );\n const [extensionPoint, setExtensionPoint] =\n useState<BasePluginExtension | null>(null);\n\n useEffect(() => {\n async function loadComponent() {\n // Determine which plugin to use\n\n const _module = resolveBestExtension(extensions?.[extension], module);\n\n setExtensionPoint(_module ?? null);\n\n const remote = _module?.remote || \"\";\n\n // Resolve the component path for the module\n const componentName = isViewPlugin(_module)\n ? _module.view.component\n : _module?.component;\n\n const componentPath = componentName ? `./${componentName}` : \"\";\n\n if (!remote) return;\n\n // Load the component using Module Federation\n const Comp = React.lazy(() => loadRemoteModule(remote, componentPath));\n setComponent(Comp);\n }\n\n loadComponent();\n }, [extensions, module, extension]);\n\n return [Component, extensionPoint];\n};\n","import styled from \"@emotion/styled\";\nimport { ErrorBoundaryWithFallback } from \"@kosdev-code/kos-ui-sdk\";\nimport React, { Suspense } from \"react\";\nimport { useDynamicComponent } from \"../../hooks\";\n\nconst NotFound = styled.div`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n`;\ninterface Props {\n extension: string;\n fallback?: React.ReactNode;\n module?: string;\n props?: any;\n}\n\nconst Skeleton = styled.div<{ width: string; height: string }>`\n align-items: center;\n background-color: transparent;\n display: flex;\n flex-direction: column;\n height: ${(props) => props.height};\n justify-content: center;\n width: ${(props) => props.width};\n`;\n\nexport const DynamicComponent: React.FunctionComponent<Props> = ({\n extension,\n fallback,\n module,\n props,\n}) => {\n // get the list of extensions from the context\n const [Component, extensionPoint] = useDynamicComponent({\n extension,\n module,\n });\n // get the module from the extension\n\n if (!Component) {\n return null;\n }\n\n const fb = fallback || (\n <NotFound>{`Dynamic component, ${extension}, not found...`}</NotFound>\n );\n\n return (\n <ErrorBoundaryWithFallback fallback={fb}>\n <Suspense\n fallback={\n extensionPoint?.size ? (\n <Skeleton\n width={extensionPoint.size.width}\n height={extensionPoint.size.height}\n />\n ) : null\n }\n >\n <Component {...props} />\n </Suspense>\n </ErrorBoundaryWithFallback>\n );\n};\n"],"names":["RemotesContext","createContext","MessageContainer","styled","KosPluginProvider","remotesOverride","onBeforeInitialize","pluginConfig","children","contextValue","setContextValue","useState","error","setError","useEffect","remotes","existingRemotes","_a","initializeKosPlugins","_b","value","initPluginManager","err","jsx","useKosPluginsContext","context","useContext","isViewPlugin","module","useDynamicComponent","extension","extensions","Component","setComponent","extensionPoint","setExtensionPoint","loadComponent","_module","resolveBestExtension","remote","componentName","componentPath","Comp","React","loadRemoteModule","NotFound","Skeleton","props","DynamicComponent","fallback","fb","ErrorBoundaryWithFallback","Suspense"],"mappings":"6TAoCa,MAAAA,EAAiBC,EAAAA,cAAuC,MAAS,EAwBxEC,EAAmBC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBnBC,EAET,CAAC,CAAE,gBAAAC,EAAiB,mBAAAC,EAAoB,aAAAC,EAAc,SAAAC,KAAe,CACvE,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAkC,SAAA,EACpE,CAACC,EAAOC,CAAQ,EAAIF,WAAuB,IAAI,EA6CrD,OA3CAG,EAAAA,UAAU,IAAM,EACK,SAAY,SACzB,GAAA,CAEER,IACM,QAAA,IACN,iEAAA,EAEF,MAAMA,EAAmB,EACzB,QAAQ,IAAI,gDAAgD,GAG9D,IAAIS,EAAUV,EAGR,MAAAW,GAAkBC,EAAA,OAAO,aAAP,YAAAA,EAAmB,iBAEtCF,IACCC,GAAmB,OAAO,KAAKA,CAAe,EAAE,OAAS,GACnD,QAAA,IACN,yDAAA,EAEQD,EAAAC,IAEV,QA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I.js";
2
- import u from "@emotion/styled";
3
- import { ErrorBoundaryWithFallback as C } from "@kosdev-code/kos-ui-sdk";
4
- import y, { createContext as v, useState as a, useEffect as d, useContext as w, Suspense as P } from "react";
5
- import { i as b, r as z, m as j } from "./resolve-best-extension-DAJIkfJh.js";
1
+ import { j as y, a as r } from "./emotion-react-jsx-runtime.browser.esm-by8ODyOQ.js";
2
+ import h from "@emotion/styled";
3
+ import { ErrorBoundaryWithFallback as w } from "@kosdev-code/kos-ui-sdk";
4
+ import z, { createContext as C, useState as m, useEffect as P, useContext as K, Suspense as b } from "react";
5
+ import { i as j, a as k, r as E, m as R } from "./resolve-best-extension-CqHaJSdN.js";
6
6
  import "react/jsx-runtime";
7
- const h = v(void 0), k = u.div`
7
+ const x = C(void 0), f = h.div`
8
8
  padding-inline: 20px;
9
9
  width: 100%;
10
10
  height: 100vh;
@@ -17,88 +17,105 @@ const h = v(void 0), k = u.div`
17
17
  top: 0;
18
18
  left: 0;
19
19
  z-index: 10000;
20
- `, L = ({ remotesOverride: t, children: n }) => {
21
- const [e, r] = a();
22
- return d(() => {
23
- b(t).then((c) => {
24
- r(c);
25
- });
26
- }, [t]), /* @__PURE__ */ s(h.Provider, { value: e, children: e ? n : /* @__PURE__ */ s(k, { children: "Loading remote plugins..." }) });
27
- }, E = () => {
28
- const t = w(h);
29
- if (!t)
20
+ `, U = ({ remotesOverride: n, onBeforeInitialize: t, pluginConfig: e, children: a }) => {
21
+ const [l, o] = m(), [c, p] = m(null);
22
+ return P(() => {
23
+ (async () => {
24
+ var d, u;
25
+ try {
26
+ t && (console.log(
27
+ "KosPluginProvider: Waiting for pre-initialization conditions..."
28
+ ), await t(), console.log("KosPluginProvider: Pre-initialization complete"));
29
+ let s = n;
30
+ const g = (d = window.KosPlugins) == null ? void 0 : d.__dynamicRemotes;
31
+ s || (g && Object.keys(g).length > 0 ? (console.log(
32
+ "KosPluginProvider: Using existing plugin initialization"
33
+ ), s = g) : (console.log("KosPluginProvider: Initializing plugins..."), await j(e), s = (u = window.KosPlugins) == null ? void 0 : u.__dynamicRemotes));
34
+ const v = await k(s);
35
+ o(v);
36
+ } catch (s) {
37
+ console.error("KosPluginProvider: Failed to initialize plugins", s), p(s);
38
+ }
39
+ })();
40
+ }, [n, t, e]), c ? /* @__PURE__ */ y(f, { children: [
41
+ /* @__PURE__ */ r("div", { children: "Failed to load plugins" }),
42
+ /* @__PURE__ */ r("div", { style: { fontSize: "12px", marginTop: "10px", opacity: 0.8 }, children: c.message })
43
+ ] }) : /* @__PURE__ */ r(x.Provider, { value: l, children: l ? a : /* @__PURE__ */ r(f, { children: "Loading remote plugins..." }) });
44
+ }, F = () => {
45
+ const n = K(x);
46
+ if (!n)
30
47
  throw new Error(
31
48
  "useKosPluginsContext must be used within a KosPluginProvider"
32
49
  );
33
- return t;
34
- }, K = (t) => {
35
- var n;
36
- return ((n = t == null ? void 0 : t.view) == null ? void 0 : n.component) !== void 0;
50
+ return n;
51
+ }, S = (n) => {
52
+ var t;
53
+ return ((t = n == null ? void 0 : n.view) == null ? void 0 : t.component) !== void 0;
37
54
  }, $ = ({
38
- extension: t,
39
- module: n
55
+ extension: n,
56
+ module: t
40
57
  }) => {
41
- const { extensions: e } = E(), [r, c] = a(
58
+ const { extensions: e } = F(), [a, l] = m(
42
59
  null
43
- ), [i, l] = a(null);
44
- return d(() => {
45
- async function f() {
46
- const o = z(e == null ? void 0 : e[t], n);
47
- l(o ?? null);
48
- const m = (o == null ? void 0 : o.remote) || "", p = K(o) ? o.view.component : o == null ? void 0 : o.component, g = p ? `./${p}` : "";
49
- if (!m)
60
+ ), [o, c] = m(null);
61
+ return P(() => {
62
+ async function p() {
63
+ const i = E(e == null ? void 0 : e[n], t);
64
+ c(i ?? null);
65
+ const d = (i == null ? void 0 : i.remote) || "", u = S(i) ? i.view.component : i == null ? void 0 : i.component, s = u ? `./${u}` : "";
66
+ if (!d)
50
67
  return;
51
- const x = y.lazy(() => j.loadRemoteModule(m, g));
52
- c(x);
68
+ const g = z.lazy(() => R.loadRemoteModule(d, s));
69
+ l(g);
53
70
  }
54
- f();
55
- }, [e, n, t]), [r, i];
56
- }, D = u.div`
71
+ p();
72
+ }, [e, t, n]), [a, o];
73
+ }, D = h.div`
57
74
  align-items: center;
58
75
  display: flex;
59
76
  height: 100%;
60
77
  justify-content: center;
61
78
  width: 100%;
62
- `, M = u.div`
79
+ `, M = h.div`
63
80
  align-items: center;
64
81
  background-color: transparent;
65
82
  display: flex;
66
83
  flex-direction: column;
67
- height: ${(t) => t.height};
84
+ height: ${(n) => n.height};
68
85
  justify-content: center;
69
- width: ${(t) => t.width};
70
- `, W = ({
71
- extension: t,
72
- fallback: n,
86
+ width: ${(n) => n.width};
87
+ `, q = ({
88
+ extension: n,
89
+ fallback: t,
73
90
  module: e,
74
- props: r
91
+ props: a
75
92
  }) => {
76
- const [c, i] = $({
77
- extension: t,
93
+ const [l, o] = $({
94
+ extension: n,
78
95
  module: e
79
96
  });
80
- if (!c)
97
+ if (!l)
81
98
  return null;
82
- const l = n || /* @__PURE__ */ s(D, { children: `Dynamic component, ${t}, not found...` });
83
- return /* @__PURE__ */ s(C, { fallback: l, children: /* @__PURE__ */ s(
84
- P,
99
+ const c = t || /* @__PURE__ */ r(D, { children: `Dynamic component, ${n}, not found...` });
100
+ return /* @__PURE__ */ r(w, { fallback: c, children: /* @__PURE__ */ r(
101
+ b,
85
102
  {
86
- fallback: i != null && i.size ? /* @__PURE__ */ s(
103
+ fallback: o != null && o.size ? /* @__PURE__ */ r(
87
104
  M,
88
105
  {
89
- width: i.size.width,
90
- height: i.size.height
106
+ width: o.size.width,
107
+ height: o.size.height
91
108
  }
92
109
  ) : null,
93
- children: /* @__PURE__ */ s(c, { ...r })
110
+ children: /* @__PURE__ */ r(l, { ...a })
94
111
  }
95
112
  ) });
96
113
  };
97
114
  export {
98
- W as DynamicComponent,
99
- L as KosPluginProvider,
100
- h as RemotesContext,
115
+ q as DynamicComponent,
116
+ U as KosPluginProvider,
117
+ x as RemotesContext,
101
118
  $ as useDynamicComponent,
102
- E as useKosPluginsContext
119
+ F as useKosPluginsContext
103
120
  };
104
121
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/plugins-provider/plugins-provider.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-dynamic-component.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/components/dynamic-component/dynamic-component.tsx"],"sourcesContent":["/**\n *\n *\n * @module remotes-provider\n * @description Provides a context for managing dynamic remotes and extensions in a React application.\n */\n\nimport styled from \"@emotion/styled\";\nimport {\n PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport type { DynamicRemotes } from \"../../../types/global\";\nimport type { PluginExtension } from \"../../../types/plugins\";\nimport { initPluginManager } from \"../../utils/plugin-extension-manager\";\n\ninterface PluginsType {\n remotes?: DynamicRemotes;\n extensions?: PluginExtensionsType;\n extensionPoints?: Record<string, PluginExtension[]>;\n getExtensions: (extensionPointId: string) => PluginExtension[];\n}\n\nexport interface PluginExtensionsType {\n [k: string]: {\n [k: string]: PluginExtension;\n };\n}\n\n/**\n * The context for managing dynamic remotes and extensions.\n */\nexport const RemotesContext = createContext<PluginsType | undefined>(undefined);\n\ninterface Props {\n remotesOverride?: DynamicRemotes;\n}\n\nconst MessageContainer = styled.div`\n padding-inline: 20px;\n width: 100%;\n height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n font-size: 14px;\n top: 0;\n left: 0;\n z-index: 10000;\n`;\n/**\n * The provider component for the RemotesContext.\n */\nexport const KosPluginProvider: React.FunctionComponent<\n PropsWithChildren<Props>\n> = ({ remotesOverride, children }) => {\n const [contextValue, setContextValue] = useState<PluginsType | undefined>();\n\n useEffect(() => {\n initPluginManager(remotesOverride).then((value) => {\n setContextValue(value);\n });\n }, [remotesOverride]);\n\n return (\n <RemotesContext.Provider value={contextValue}>\n {contextValue ? (\n children\n ) : (\n <MessageContainer>Loading remote plugins...</MessageContainer>\n )}\n </RemotesContext.Provider>\n );\n};\n\n/**\n * Custom hook for accessing the RemotesContext.\n */\nexport const useKosPluginsContext = () => {\n const context = useContext(RemotesContext);\n if (!context) {\n throw new Error(\n \"useKosPluginsContext must be used within a KosPluginProvider\"\n );\n }\n return context;\n};\n","import { loadRemoteModule } from \"@nx/react/mf\";\n\nimport React, { useEffect, useState } from \"react\";\nimport type {\n BasePluginExtension,\n BaseViewPluginExtension,\n} from \"../../types/plugins\";\nimport { useKosPluginsContext } from \"../contexts\";\nimport { resolveBestExtension } from \"../utils/resolve-best-extension\";\n\ninterface Props {\n /**\n * The extension point ID to resolve plugin modules from.\n * Example: \"ddk.ncui.settings.tabView\"\n */\n extension: string;\n\n /**\n * Optional module ID to load a specific plugin.\n * If not provided, the plugin with the **lowest rank** for the extension point is used.\n */\n module?: string;\n}\n\ntype DynamicComponentResult = [\n React.FunctionComponent | null,\n BasePluginExtension | null\n];\n\n/**\n * Determines whether a plugin extension follows the \"view\" structure.\n * This allows resolving the correct field (`view.component` vs `component`) when loading.\n */\nconst isViewPlugin = (module: any): module is BaseViewPluginExtension =>\n module?.view?.component !== undefined;\n\n/**\n * React hook to resolve and lazily load a plugin component for a given extension point.\n *\n * - If `module` is provided, it directly loads that plugin.\n * - If `module` is not provided, it uses the **lowest-ranked plugin** from the extension point.\n * - Supports both standard plugins (`component`) and view-style plugins (`view.component`)\n * - Uses React.lazy + Module Federation to dynamically import the remote component.\n *\n * @param props.extension The extension point to resolve plugins from\n * @param props.module (Optional) Specific module ID to use, otherwise the highest-priority plugin is loaded\n * @returns A tuple: `[Component, PluginExtension]`\n */\nexport const useDynamicComponent = ({\n extension,\n module,\n}: Props): DynamicComponentResult => {\n const { extensions } = useKosPluginsContext();\n\n const [Component, setComponent] = useState<React.FunctionComponent | null>(\n null\n );\n const [extensionPoint, setExtensionPoint] =\n useState<BasePluginExtension | null>(null);\n\n useEffect(() => {\n async function loadComponent() {\n // Determine which plugin to use\n\n const _module = resolveBestExtension(extensions?.[extension], module);\n\n setExtensionPoint(_module ?? null);\n\n const remote = _module?.remote || \"\";\n\n // Resolve the component path for the module\n const componentName = isViewPlugin(_module)\n ? _module.view.component\n : _module?.component;\n\n const componentPath = componentName ? `./${componentName}` : \"\";\n\n if (!remote) return;\n\n // Load the component using Module Federation\n const Comp = React.lazy(() => loadRemoteModule(remote, componentPath));\n setComponent(Comp);\n }\n\n loadComponent();\n }, [extensions, module, extension]);\n\n return [Component, extensionPoint];\n};\n","import styled from \"@emotion/styled\";\nimport { ErrorBoundaryWithFallback } from \"@kosdev-code/kos-ui-sdk\";\nimport React, { Suspense } from \"react\";\nimport { useDynamicComponent } from \"../../hooks\";\n\nconst NotFound = styled.div`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n`;\ninterface Props {\n extension: string;\n fallback?: React.ReactNode;\n module?: string;\n props?: any;\n}\n\nconst Skeleton = styled.div<{ width: string; height: string }>`\n align-items: center;\n background-color: transparent;\n display: flex;\n flex-direction: column;\n height: ${(props) => props.height};\n justify-content: center;\n width: ${(props) => props.width};\n`;\n\nexport const DynamicComponent: React.FunctionComponent<Props> = ({\n extension,\n fallback,\n module,\n props,\n}) => {\n // get the list of extensions from the context\n const [Component, extensionPoint] = useDynamicComponent({\n extension,\n module,\n });\n // get the module from the extension\n\n if (!Component) {\n return null;\n }\n\n const fb = fallback || (\n <NotFound>{`Dynamic component, ${extension}, not found...`}</NotFound>\n );\n\n return (\n <ErrorBoundaryWithFallback fallback={fb}>\n <Suspense\n fallback={\n extensionPoint?.size ? (\n <Skeleton\n width={extensionPoint.size.width}\n height={extensionPoint.size.height}\n />\n ) : null\n }\n >\n <Component {...props} />\n </Suspense>\n </ErrorBoundaryWithFallback>\n );\n};\n"],"names":["RemotesContext","createContext","MessageContainer","styled","KosPluginProvider","remotesOverride","children","contextValue","setContextValue","useState","useEffect","initPluginManager","value","jsx","useKosPluginsContext","context","useContext","isViewPlugin","module","_a","useDynamicComponent","extension","extensions","Component","setComponent","extensionPoint","setExtensionPoint","loadComponent","_module","resolveBestExtension","remote","componentName","componentPath","Comp","React","loadRemoteModule","NotFound","Skeleton","props","DynamicComponent","fallback","fb","ErrorBoundaryWithFallback","Suspense"],"mappings":";;;;;;AAmCa,MAAAA,IAAiBC,EAAuC,MAAS,GAMxEC,IAAmBC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAiBnBC,IAET,CAAC,EAAE,iBAAAC,GAAiB,UAAAC,QAAe;AACrC,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAkC;AAE1E,SAAAC,EAAU,MAAM;AACd,IAAAC,EAAkBN,CAAe,EAAE,KAAK,CAACO,MAAU;AACjD,MAAAJ,EAAgBI,CAAK;AAAA,IAAA,CACtB;AAAA,EAAA,GACA,CAACP,CAAe,CAAC,GAGlB,gBAAAQ,EAACb,EAAe,UAAf,EAAwB,OAAOO,GAC7B,UAAAA,IACCD,IAEA,gBAAAO,EAACX,GAAiB,EAAA,UAAA,4BAAA,CAAyB,EAE/C,CAAA;AAEJ,GAKaY,IAAuB,MAAM;AAClC,QAAAC,IAAUC,EAAWhB,CAAc;AACzC,MAAI,CAACe;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAGG,SAAAA;AACT,GC1DME,IAAe,CAACC,MACpB;;AAAA,WAAAC,IAAAD,KAAA,gBAAAA,EAAQ,SAAR,gBAAAC,EAAc,eAAc;AAAA,GAcjBC,IAAsB,CAAC;AAAA,EAClC,WAAAC;AAAA,EACA,QAAAH;AACF,MAAqC;AAC7B,QAAA,EAAE,YAAAI,MAAeR,KAEjB,CAACS,GAAWC,CAAY,IAAIf;AAAA,IAChC;AAAA,EAAA,GAEI,CAACgB,GAAgBC,CAAiB,IACtCjB,EAAqC,IAAI;AAE3C,SAAAC,EA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;AAAA,UACC,OAAOZ,EAAe,KAAK;AAAA,UAC3B,QAAQA,EAAe,KAAK;AAAA,QAAA;AAAA,MAAA,IAE5B;AAAA,MAGN,UAAA,gBAAAZ,EAACU,GAAW,EAAA,GAAGe,EAAO,CAAA;AAAA,IAAA;AAAA,EAE1B,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/plugins-provider/plugins-provider.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-dynamic-component.tsx","../../../../packages/sdk/kos-ui-plugin/src/lib/components/dynamic-component/dynamic-component.tsx"],"sourcesContent":["/**\n *\n *\n * @module remotes-provider\n * @description Provides a context for managing dynamic remotes and extensions in a React application.\n */\n\nimport styled from \"@emotion/styled\";\nimport {\n PropsWithChildren,\n createContext,\n useContext,\n useEffect,\n useState,\n} from \"react\";\nimport type { DynamicRemotes } from \"../../../types/global\";\nimport type { PluginExtension } from \"../../../types/plugins\";\nimport { initializeKosPlugins } from \"../../utils/initialize-plugins\";\nimport { initPluginManager } from \"../../utils/plugin-extension-manager\";\n\ninterface PluginsType {\n remotes?: DynamicRemotes;\n extensions?: PluginExtensionsType;\n extensionPoints?: Record<string, PluginExtension[]>;\n getExtensions: (extensionPointId: string) => PluginExtension[];\n}\n\nexport interface PluginExtensionsType {\n [k: string]: {\n [k: string]: PluginExtension;\n };\n}\n\n/**\n * The context for managing dynamic remotes and extensions.\n */\nexport const RemotesContext = createContext<PluginsType | undefined>(undefined);\n\ninterface Props {\n remotesOverride?: DynamicRemotes;\n /**\n * Optional async function to execute before initializing plugins.\n * This can be used to wait for specific events or conditions before\n * fetching and loading plugins.\n */\n onBeforeInitialize?: () => Promise<void>;\n /**\n * Optional configuration for plugin initialization\n */\n pluginConfig?: {\n pluginBaseUrl?: string;\n pluginApiPath?: string;\n pluginContext?: {\n context: string;\n group: string;\n };\n overrides?: Record<string, string>;\n };\n}\n\nconst MessageContainer = styled.div`\n padding-inline: 20px;\n width: 100%;\n height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n font-size: 14px;\n top: 0;\n left: 0;\n z-index: 10000;\n`;\n/**\n * The provider component for the RemotesContext.\n */\nexport const KosPluginProvider: React.FunctionComponent<\n PropsWithChildren<Props>\n> = ({ remotesOverride, onBeforeInitialize, pluginConfig, children }) => {\n const [contextValue, setContextValue] = useState<PluginsType | undefined>();\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const initialize = async () => {\n try {\n // Wait for any pre-initialization conditions\n if (onBeforeInitialize) {\n console.log(\n \"KosPluginProvider: Waiting for pre-initialization conditions...\"\n );\n await onBeforeInitialize();\n console.log(\"KosPluginProvider: Pre-initialization complete\");\n }\n\n let remotes = remotesOverride;\n\n // Check if plugins are already initialized (backwards compatibility)\n const existingRemotes = window.KosPlugins?.__dynamicRemotes;\n\n if (!remotes) {\n if (existingRemotes && Object.keys(existingRemotes).length > 0) {\n console.log(\n \"KosPluginProvider: Using existing plugin initialization\"\n );\n remotes = existingRemotes;\n } else {\n console.log(\"KosPluginProvider: Initializing plugins...\");\n await initializeKosPlugins(pluginConfig);\n // initializeKosPlugins sets window.KosPlugins.__dynamicRemotes\n remotes = window.KosPlugins?.__dynamicRemotes;\n }\n }\n\n // Initialize the plugin manager with the remotes\n const value = await initPluginManager(remotes);\n setContextValue(value);\n } catch (err) {\n console.error(\"KosPluginProvider: Failed to initialize plugins\", err);\n setError(err as Error);\n }\n };\n\n initialize();\n }, [remotesOverride, onBeforeInitialize, pluginConfig]);\n\n if (error) {\n return (\n <MessageContainer>\n <div>Failed to load plugins</div>\n <div style={{ fontSize: \"12px\", marginTop: \"10px\", opacity: 0.8 }}>\n {error.message}\n </div>\n </MessageContainer>\n );\n }\n\n return (\n <RemotesContext.Provider value={contextValue}>\n {contextValue ? (\n children\n ) : (\n <MessageContainer>Loading remote plugins...</MessageContainer>\n )}\n </RemotesContext.Provider>\n );\n};\n\n/**\n * Custom hook for accessing the RemotesContext.\n */\nexport const useKosPluginsContext = () => {\n const context = useContext(RemotesContext);\n if (!context) {\n throw new Error(\n \"useKosPluginsContext must be used within a KosPluginProvider\"\n );\n }\n return context;\n};\n","import { loadRemoteModule } from \"@nx/react/mf\";\n\nimport React, { useEffect, useState } from \"react\";\nimport type {\n BasePluginExtension,\n BaseViewPluginExtension,\n} from \"../../types/plugins\";\nimport { useKosPluginsContext } from \"../contexts\";\nimport { resolveBestExtension } from \"../utils/resolve-best-extension\";\n\ninterface Props {\n /**\n * The extension point ID to resolve plugin modules from.\n * Example: \"ddk.ncui.settings.tabView\"\n */\n extension: string;\n\n /**\n * Optional module ID to load a specific plugin.\n * If not provided, the plugin with the **lowest rank** for the extension point is used.\n */\n module?: string;\n}\n\ntype DynamicComponentResult = [\n React.FunctionComponent | null,\n BasePluginExtension | null\n];\n\n/**\n * Determines whether a plugin extension follows the \"view\" structure.\n * This allows resolving the correct field (`view.component` vs `component`) when loading.\n */\nconst isViewPlugin = (module: any): module is BaseViewPluginExtension =>\n module?.view?.component !== undefined;\n\n/**\n * React hook to resolve and lazily load a plugin component for a given extension point.\n *\n * - If `module` is provided, it directly loads that plugin.\n * - If `module` is not provided, it uses the **lowest-ranked plugin** from the extension point.\n * - Supports both standard plugins (`component`) and view-style plugins (`view.component`)\n * - Uses React.lazy + Module Federation to dynamically import the remote component.\n *\n * @param props.extension The extension point to resolve plugins from\n * @param props.module (Optional) Specific module ID to use, otherwise the highest-priority plugin is loaded\n * @returns A tuple: `[Component, PluginExtension]`\n */\nexport const useDynamicComponent = ({\n extension,\n module,\n}: Props): DynamicComponentResult => {\n const { extensions } = useKosPluginsContext();\n\n const [Component, setComponent] = useState<React.FunctionComponent | null>(\n null\n );\n const [extensionPoint, setExtensionPoint] =\n useState<BasePluginExtension | null>(null);\n\n useEffect(() => {\n async function loadComponent() {\n // Determine which plugin to use\n\n const _module = resolveBestExtension(extensions?.[extension], module);\n\n setExtensionPoint(_module ?? null);\n\n const remote = _module?.remote || \"\";\n\n // Resolve the component path for the module\n const componentName = isViewPlugin(_module)\n ? _module.view.component\n : _module?.component;\n\n const componentPath = componentName ? `./${componentName}` : \"\";\n\n if (!remote) return;\n\n // Load the component using Module Federation\n const Comp = React.lazy(() => loadRemoteModule(remote, componentPath));\n setComponent(Comp);\n }\n\n loadComponent();\n }, [extensions, module, extension]);\n\n return [Component, extensionPoint];\n};\n","import styled from \"@emotion/styled\";\nimport { ErrorBoundaryWithFallback } from \"@kosdev-code/kos-ui-sdk\";\nimport React, { Suspense } from \"react\";\nimport { useDynamicComponent } from \"../../hooks\";\n\nconst NotFound = styled.div`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n`;\ninterface Props {\n extension: string;\n fallback?: React.ReactNode;\n module?: string;\n props?: any;\n}\n\nconst Skeleton = styled.div<{ width: string; height: string }>`\n align-items: center;\n background-color: transparent;\n display: flex;\n flex-direction: column;\n height: ${(props) => props.height};\n justify-content: center;\n width: ${(props) => props.width};\n`;\n\nexport const DynamicComponent: React.FunctionComponent<Props> = ({\n extension,\n fallback,\n module,\n props,\n}) => {\n // get the list of extensions from the context\n const [Component, extensionPoint] = useDynamicComponent({\n extension,\n module,\n });\n // get the module from the extension\n\n if (!Component) {\n return null;\n }\n\n const fb = fallback || (\n <NotFound>{`Dynamic component, ${extension}, not found...`}</NotFound>\n );\n\n return (\n <ErrorBoundaryWithFallback fallback={fb}>\n <Suspense\n fallback={\n extensionPoint?.size ? (\n <Skeleton\n width={extensionPoint.size.width}\n height={extensionPoint.size.height}\n />\n ) : null\n }\n >\n <Component {...props} />\n </Suspense>\n </ErrorBoundaryWithFallback>\n );\n};\n"],"names":["RemotesContext","createContext","MessageContainer","styled","KosPluginProvider","remotesOverride","onBeforeInitialize","pluginConfig","children","contextValue","setContextValue","useState","error","setError","useEffect","remotes","existingRemotes","_a","initializeKosPlugins","_b","value","initPluginManager","err","jsx","useKosPluginsContext","context","useContext","isViewPlugin","module","useDynamicComponent","extension","extensions","Component","setComponent","extensionPoint","setExtensionPoint","loadComponent","_module","resolveBestExtension","remote","componentName","componentPath","Comp","React","loadRemoteModule","NotFound","Skeleton","props","DynamicComponent","fallback","fb","ErrorBoundaryWithFallback","Suspense"],"mappings":";;;;;;AAoCa,MAAAA,IAAiBC,EAAuC,MAAS,GAwBxEC,IAAmBC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAiBnBC,IAET,CAAC,EAAE,iBAAAC,GAAiB,oBAAAC,GAAoB,cAAAC,GAAc,UAAAC,QAAe;AACvE,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAkC,GACpE,CAACC,GAAOC,CAAQ,IAAIF,EAAuB,IAAI;AA6CrD,SA3CAG,EAAU,MAAM;AAwCH,KAvCQ,YAAY;;AACzB,UAAA;AAEF,QAAIR,MACM,QAAA;AAAA,UACN;AAAA,QAAA,GAEF,MAAMA,EAAmB,GACzB,QAAQ,IAAI,gDAAgD;AAG9D,YAAIS,IAAUV;AAGR,cAAAW,KAAkBC,IAAA,OAAO,eAAP,gBAAAA,EAAmB;AAE3C,QAAKF,MACCC,KAAmB,OAAO,KAAKA,CAAe,EAAE,SAAS,KACnD,QAAA;AAAA,UACN;AAAA,QAAA,GAEQD,IAAAC,MAEV,QAAQ,IAAI,4CAA4C,GACxD,MAAME,EAAqBX,CAAY,GAEvCQ,KAAUI,IAAA,OAAO,eAAP,gBAAAA,EAAmB;AAK3B,cAAAC,IAAQ,MAAMC,EAAkBN,CAAO;AAC7C,QAAAL,EAAgBU,CAAK;AAAA,eACdE,GAAK;AACJ,gBAAA,MAAM,mDAAmDA,CAAG,GACpET,EAASS,CAAY;AAAA,MACvB;AAAA,IAAA;EAID,GAAA,CAACjB,GAAiBC,GAAoBC,CAAY,CAAC,GAElDK,sBAECV,GACC,EAAA,UAAA;AAAA,IAAA,gBAAAqB,EAAC,SAAI,UAAsB,yBAAA,C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AAQE,CAAS,CAAC,GAE3B,CAACE,GAAWE,CAAc;AACnC,GCnFMW,IAAW1C,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAclB2C,IAAW3C,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,YAKZ,CAAC4C,MAAUA,EAAM,MAAM;AAAA;AAAA,WAExB,CAACA,MAAUA,EAAM,KAAK;AAAA,GAGpBC,IAAmD,CAAC;AAAA,EAC/D,WAAAlB;AAAA,EACA,UAAAmB;AAAA,EACA,QAAArB;AAAA,EACA,OAAAmB;AACF,MAAM;AAEJ,QAAM,CAACf,GAAWE,CAAc,IAAIL,EAAoB;AAAA,IACtD,WAAAC;AAAA,IACA,QAAAF;AAAA,EAAA,CACD;AAGD,MAAI,CAACI;AACI,WAAA;AAGT,QAAMkB,IAAKD,KACT,gBAAA1B,EAACsB,GAAU,EAAA,UAAA,sBAAsBf,CAAS,iBAAiB,CAAA;AAI3D,SAAA,gBAAAP,EAAC4B,GAA0B,EAAA,UAAUD,GACnC,UAAA,gBAAA3B;AAAA,IAAC6B;AAAA,IAAA;AAAA,MACC,UACElB,KAAA,QAAAA,EAAgB,OACd,gBAAAX;AAAA,QAACuB;AAAA,QAAA;AAAA,UACC,OAAOZ,EAAe,KAAK;AAAA,UAC3B,QAAQA,EAAe,KAAK;AAAA,QAAA;AAAA,MAAA,IAE5B;AAAA,MAGN,UAAA,gBAAAX,EAACS,GAAW,EAAA,GAAGe,EAAO,CAAA;AAAA,IAAA;AAAA,EAE1B,EAAA,CAAA;AAEJ;"}
@@ -19,6 +19,24 @@ export interface PluginExtensionsType {
19
19
  export declare const RemotesContext: import('react').Context<PluginsType | undefined>;
20
20
  interface Props {
21
21
  remotesOverride?: DynamicRemotes;
22
+ /**
23
+ * Optional async function to execute before initializing plugins.
24
+ * This can be used to wait for specific events or conditions before
25
+ * fetching and loading plugins.
26
+ */
27
+ onBeforeInitialize?: () => Promise<void>;
28
+ /**
29
+ * Optional configuration for plugin initialization
30
+ */
31
+ pluginConfig?: {
32
+ pluginBaseUrl?: string;
33
+ pluginApiPath?: string;
34
+ pluginContext?: {
35
+ context: string;
36
+ group: string;
37
+ };
38
+ overrides?: Record<string, string>;
39
+ };
22
40
  }
23
41
  /**
24
42
  * The provider component for the RemotesContext.
@@ -1 +1 @@
1
- {"version":3,"file":"plugins-provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/plugins-provider/plugins-provider.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IACpD,aAAa,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,eAAe,EAAE,CAAC;CAChE;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,CAAC,EAAE,MAAM,GAAG;QACX,CAAC,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;KAC9B,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,kDAAoD,CAAC;AAEhF,UAAU,KAAK;IACb,eAAe,CAAC,EAAE,cAAc,CAAC;CAClC;AAgBD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,CACrD,iBAAiB,CAAC,KAAK,CAAC,CAmBzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,mBAQhC,CAAC"}
1
+ {"version":3,"file":"plugins-provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/plugins-provider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1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-ui-plugin",
3
- "version": "2.0.31",
3
+ "version": "2.0.32",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "kos": {
28
28
  "build": {
29
- "gitHash": "d7b8c63a9bfe61bb6177f4e7628bbb17e3696c2b"
29
+ "gitHash": "ea8751ddd6a1c43f56f22bab3bf99a0e3bd3f824"
30
30
  }
31
31
  },
32
32
  "publishConfig": {