@kosdev-code/kos-ui-plugin 2.0.1 → 2.0.19
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/dev.cjs +7 -7
- package/dev.cjs.map +1 -1
- package/dev.js +37 -34
- package/dev.js.map +1 -1
- package/index.cjs +6 -6
- package/index.cjs.map +1 -1
- package/index.js +49 -57
- package/index.js.map +1 -1
- package/lib/dev/components/storybook/control-pour-story-container/control-pour-story-container.d.ts +8 -0
- package/lib/dev/components/storybook/control-pour-story-container/control-pour-story-container.d.ts.map +1 -0
- package/lib/dev/components/storybook/control-pour-story-container/index.d.ts +2 -0
- package/lib/dev/components/storybook/control-pour-story-container/index.d.ts.map +1 -0
- package/lib/dev/components/storybook/index.d.ts +1 -0
- package/lib/dev/components/storybook/index.d.ts.map +1 -1
- package/lib/hooks/use-dynamic-component.d.ts +20 -0
- package/lib/hooks/use-dynamic-component.d.ts.map +1 -1
- package/lib/utils/contribution-reducer.d.ts.map +1 -1
- package/lib/utils/control-pour-reducer.d.ts +5 -0
- package/lib/utils/control-pour-reducer.d.ts.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/initialize-plugins.d.ts +39 -0
- package/lib/utils/initialize-plugins.d.ts.map +1 -1
- package/lib/utils/plugin-extension-manager.d.ts.map +1 -1
- package/lib/utils/plugin-extension-registry-init.d.ts +2 -0
- package/lib/utils/plugin-extension-registry-init.d.ts.map +1 -0
- package/lib/utils/plugin-extension-registry.d.ts +6 -0
- package/lib/utils/plugin-extension-registry.d.ts.map +1 -0
- package/lib/utils/resolve-best-extension.d.ts +12 -0
- package/lib/utils/resolve-best-extension.d.ts.map +1 -0
- package/package.json +2 -2
- package/resolve-best-extension-D5Ord7XK.cjs +2 -0
- package/resolve-best-extension-D5Ord7XK.cjs.map +1 -0
- package/resolve-best-extension-DAJIkfJh.js +272 -0
- package/resolve-best-extension-DAJIkfJh.js.map +1 -0
- package/types/global.d.ts +5 -0
- package/types/plugins.d.ts +6 -1
- package/utils.cjs +1 -1
- package/utils.cjs.map +1 -1
- package/utils.js +344 -101
- package/utils.js.map +1 -1
- package/plugin-extension-manager-7xDx0VSt.js +0 -524
- package/plugin-extension-manager-7xDx0VSt.js.map +0 -1
- package/plugin-extension-manager-D9aw-mUM.cjs +0 -2
- package/plugin-extension-manager-D9aw-mUM.cjs.map +0 -1
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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`
|
|
2
2
|
padding-inline: 20px;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100vh;
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
top: 0;
|
|
12
12
|
left: 0;
|
|
13
13
|
z-index: 10000;
|
|
14
|
-
`,
|
|
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..."})})},p=()=>{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},x=({extension:e,module:t})=>{const{extensions:n}=p(),[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 f=(o==null?void 0:o.remote)||"",m=j(o)?o.view.component:o==null?void 0:o.component,C=m?`./${m}`:"",y=i.lazy(()=>a.mf.loadRemoteModule(f,C));r(y)}g()},[n,t,e]),[l,s]},b=d.div`
|
|
15
15
|
align-items: center;
|
|
16
16
|
display: flex;
|
|
17
17
|
height: 100%;
|
|
18
18
|
justify-content: center;
|
|
19
19
|
width: 100%;
|
|
20
|
-
`,
|
|
20
|
+
`,S=d.div`
|
|
21
21
|
align-items: center;
|
|
22
22
|
background-color: transparent;
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
|
-
height: ${
|
|
25
|
+
height: ${e=>e.height};
|
|
26
26
|
justify-content: center;
|
|
27
|
-
width: ${
|
|
28
|
-
`,
|
|
27
|
+
width: ${e=>e.width};
|
|
28
|
+
`,k=({extension:e,fallback:t,module:n,props:l})=>{const[r,s]=x({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=x;exports.useKosPluginsContext=p;
|
|
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 {
|
|
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 // 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,EAAe,SAAf,CAAwB,MAAOO,EAC7B,SAAAA,EACCD,EAEAO,EAAAA,IAACX,EAAiB,CAAA,SAAA,2BAAA,CAAyB,CAE/C,CAAA,CAEJ,EAKaY,EAAuB,IAAM,CAClC,MAAAC,EAAUC,aAAWhB,CAAc,EACzC,GAAI,CAACe,EACH,MAAM,IAAI,MACR,8DAAA,EAGG,OAAAA,CACT,EC1DME,EAAgBC,GACpB,OAAA,QAAAC,EAAAD,GAAA,YAAAA,EAAQ,OAAR,YAAAC,EAAc,aAAc,QAcjBC,EAAsB,CAAC,CAClC,UAAAC,EACA,OAAAH,CACF,IAAqC,CAC7B,KAAA,CAAE,WAAAI,GAAeR,IAEjB,CAACS,EAAWC,CAAY,EAAIf,EAAA,SAChC,IAAA,EAEI,CAACgB,EAAgBC,CAAiB,EACtCjB,WAAqC,IAAI,EAE3CC,OAAAA,EAAAA,UAAU,IAAM,CACd,eAAeiB,GAAgB,CAG7B,MAAMC,EAAUC,EAAAA,qBAAqBP,GAAA,YAAAA,EAAaD,GAAYH,CAAM,EAEpEQ,EAAkBE,GAAW,IAAI,EAE3B,MAAAE,GAASF,GAAA,YAAAA,EAAS,SAAU,GAG5BG,EAAgBd,EAAaW,CAAO,EACtCA,EAAQ,KAAK,UACbA,GAAA,YAAAA,EAAS,UAEPI,EAAgBD,EAAgB,KAAKA,CAAa,GAAK,GAGvDE,EAAOC,EAAM,KAAK,IAAMC,EAAAA,GAAAA,iBAAiBL,EAAQE,CAAa,CAAC,EACrER,EAAaS,CAAI,CACnB,CAEcN,GACb,EAAA,CAACL,EAAYJ,EAAQG,CAAS,CAAC,EAE3B,CAACE,EAAWE,CAAc,CACnC,ECjFMW,EAAWjC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAclBkC,EAAWlC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,YAKXmC,GAAUA,EAAM,MAAM;AAAA;AAAA,WAEvBA,GAAUA,EAAM,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"}
|
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { i as
|
|
1
|
+
import { j as s } from "./emotion-react-jsx-runtime.browser.esm-vwuMB3sI.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 p, 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";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
|
-
const
|
|
7
|
+
const d = v(void 0), k = u.div`
|
|
8
8
|
padding-inline: 20px;
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100vh;
|
|
@@ -17,54 +17,46 @@ const h = j(void 0), M = d.div`
|
|
|
17
17
|
top: 0;
|
|
18
18
|
left: 0;
|
|
19
19
|
z-index: 10000;
|
|
20
|
-
`,
|
|
21
|
-
const [
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
`, L = ({ remotesOverride: t, children: n }) => {
|
|
21
|
+
const [e, r] = a();
|
|
22
|
+
return p(() => {
|
|
23
|
+
b(t).then((c) => {
|
|
24
|
+
r(c);
|
|
25
25
|
});
|
|
26
|
-
}, [t]), /* @__PURE__ */
|
|
26
|
+
}, [t]), /* @__PURE__ */ s(d.Provider, { value: e, children: e ? n : /* @__PURE__ */ s(k, { children: "Loading remote plugins..." }) });
|
|
27
27
|
}, E = () => {
|
|
28
|
-
const t =
|
|
28
|
+
const t = w(d);
|
|
29
29
|
if (!t)
|
|
30
30
|
throw new Error(
|
|
31
31
|
"useKosPluginsContext must be used within a KosPluginProvider"
|
|
32
32
|
);
|
|
33
33
|
return t;
|
|
34
|
-
},
|
|
35
|
-
var
|
|
36
|
-
return ((
|
|
37
|
-
},
|
|
38
|
-
const s = o.rank || 0, e = n.rank || 0;
|
|
39
|
-
return s === e ? (k.info(
|
|
40
|
-
`found same rank for extension ${o.id} and ${n.id} using id to sort`
|
|
41
|
-
), o.id.localeCompare(n.id)) : s - e;
|
|
42
|
-
}), V = ({
|
|
34
|
+
}, K = (t) => {
|
|
35
|
+
var n;
|
|
36
|
+
return ((n = t == null ? void 0 : t.view) == null ? void 0 : n.component) !== void 0;
|
|
37
|
+
}, $ = ({
|
|
43
38
|
extension: t,
|
|
44
|
-
module:
|
|
39
|
+
module: n
|
|
45
40
|
}) => {
|
|
46
|
-
const { extensions:
|
|
41
|
+
const { extensions: e } = E(), [r, c] = a(
|
|
47
42
|
null
|
|
48
|
-
), [
|
|
49
|
-
return
|
|
50
|
-
async function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
l(i ?? null);
|
|
56
|
-
const y = (i == null ? void 0 : i.remote) || "", u = D(i) ? i.view.component : i == null ? void 0 : i.component, v = u ? `./${u}` : "", w = b.lazy(() => K.loadRemoteModule(y, v));
|
|
57
|
-
e(w);
|
|
43
|
+
), [i, l] = a(null);
|
|
44
|
+
return p(() => {
|
|
45
|
+
async function h() {
|
|
46
|
+
const o = z(e == null ? void 0 : e[t], n);
|
|
47
|
+
l(o ?? null);
|
|
48
|
+
const f = (o == null ? void 0 : o.remote) || "", m = K(o) ? o.view.component : o == null ? void 0 : o.component, g = m ? `./${m}` : "", x = y.lazy(() => j.loadRemoteModule(f, g));
|
|
49
|
+
c(x);
|
|
58
50
|
}
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
},
|
|
51
|
+
h();
|
|
52
|
+
}, [e, n, t]), [r, i];
|
|
53
|
+
}, D = u.div`
|
|
62
54
|
align-items: center;
|
|
63
55
|
display: flex;
|
|
64
56
|
height: 100%;
|
|
65
57
|
justify-content: center;
|
|
66
58
|
width: 100%;
|
|
67
|
-
`,
|
|
59
|
+
`, M = u.div`
|
|
68
60
|
align-items: center;
|
|
69
61
|
background-color: transparent;
|
|
70
62
|
display: flex;
|
|
@@ -72,38 +64,38 @@ const h = j(void 0), M = d.div`
|
|
|
72
64
|
height: ${(t) => t.height};
|
|
73
65
|
justify-content: center;
|
|
74
66
|
width: ${(t) => t.width};
|
|
75
|
-
`,
|
|
67
|
+
`, W = ({
|
|
76
68
|
extension: t,
|
|
77
|
-
fallback:
|
|
78
|
-
module:
|
|
79
|
-
props:
|
|
69
|
+
fallback: n,
|
|
70
|
+
module: e,
|
|
71
|
+
props: r
|
|
80
72
|
}) => {
|
|
81
|
-
const [
|
|
73
|
+
const [c, i] = $({
|
|
82
74
|
extension: t,
|
|
83
|
-
module:
|
|
75
|
+
module: e
|
|
84
76
|
});
|
|
85
|
-
if (!
|
|
77
|
+
if (!c)
|
|
86
78
|
return null;
|
|
87
|
-
const l =
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
79
|
+
const l = n || /* @__PURE__ */ s(D, { children: `Dynamic component, ${t}, not found...` });
|
|
80
|
+
return /* @__PURE__ */ s(C, { fallback: l, children: /* @__PURE__ */ s(
|
|
81
|
+
P,
|
|
90
82
|
{
|
|
91
|
-
fallback:
|
|
92
|
-
|
|
83
|
+
fallback: i != null && i.size ? /* @__PURE__ */ s(
|
|
84
|
+
M,
|
|
93
85
|
{
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
86
|
+
width: i.size.width,
|
|
87
|
+
height: i.size.height
|
|
96
88
|
}
|
|
97
89
|
) : null,
|
|
98
|
-
children: /* @__PURE__ */ c
|
|
90
|
+
children: /* @__PURE__ */ s(c, { ...r })
|
|
99
91
|
}
|
|
100
92
|
) });
|
|
101
93
|
};
|
|
102
94
|
export {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
W as DynamicComponent,
|
|
96
|
+
L as KosPluginProvider,
|
|
97
|
+
d as RemotesContext,
|
|
98
|
+
$ as useDynamicComponent,
|
|
107
99
|
E as useKosPluginsContext
|
|
108
100
|
};
|
|
109
101
|
//# 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 {
|
|
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 // 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,EAAU,MAAM;AACd,mBAAeiB,IAAgB;AAG7B,YAAMC,IAAUC,EAAqBP,KAAA,gBAAAA,EAAaD,IAAYH,CAAM;AAEpE,MAAAQ,EAAkBE,KAAW,IAAI;AAE3B,YAAAE,KAASF,KAAA,gBAAAA,EAAS,WAAU,IAG5BG,IAAgBd,EAAaW,CAAO,IACtCA,EAAQ,KAAK,YACbA,KAAA,gBAAAA,EAAS,WAEPI,IAAgBD,IAAgB,KAAKA,CAAa,KAAK,IAGvDE,IAAOC,EAAM,KAAK,MAAMC,EAAAA,iBAAiBL,GAAQE,CAAa,CAAC;AACrE,MAAAR,EAAaS,CAAI;AAAA,IACnB;AAEc,IAAAN;EACb,GAAA,CAACL,GAAYJ,GAAQG,CAAS,CAAC,GAE3B,CAACE,GAAWE,CAAc;AACnC,GCjFMW,IAAWjC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAclBkC,IAAWlC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA,YAKZ,CAACmC,MAAUA,EAAM,MAAM;AAAA;AAAA,WAExB,CAACA,MAAUA,EAAM,KAAK;AAAA,GAGpBC,IAAmD,CAAC;AAAA,EAC/D,WAAAlB;AAAA,EACA,UAAAmB;AAAA,EACA,QAAAtB;AAAA,EACA,OAAAoB;AACF,MAAM;AAEJ,QAAM,CAACf,GAAWE,CAAc,IAAIL,EAAoB;AAAA,IACtD,WAAAC;AAAA,IACA,QAAAH;AAAA,EAAA,CACD;AAGD,MAAI,CAACK;AACI,WAAA;AAGT,QAAMkB,IAAKD,KACT,gBAAA3B,EAACuB,GAAU,EAAA,UAAA,sBAAsBf,CAAS,iBAAiB,CAAA;AAI3D,SAAA,gBAAAR,EAAC6B,GAA0B,EAAA,UAAUD,GACnC,UAAA,gBAAA5B;AAAA,IAAC8B;AAAA,IAAA;AAAA,MACC,UACElB,KAAA,QAAAA,EAAgB,OACd,gBAAAZ;AAAA,QAACwB;AAAA,QAAA;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;"}
|
package/lib/dev/components/storybook/control-pour-story-container/control-pour-story-container.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ControlPourStoryContainerProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const ControlPourStoryContainer: ({ children, }: ControlPourStoryContainerProps) => ReactNode;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=control-pour-story-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-pour-story-container.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/sdk/kos-ui-plugin/src/lib/dev/components/storybook/control-pour-story-container/control-pour-story-container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,8BAA8B;IACtC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,yBAAyB,kBAEnC,8BAA8B,cAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/sdk/kos-ui-plugin/src/lib/dev/components/storybook/control-pour-story-container/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-ui-plugin/src/lib/dev/components/storybook/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/sdk/kos-ui-plugin/src/lib/dev/components/storybook/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC"}
|
|
@@ -2,13 +2,33 @@ import { BasePluginExtension } from '../../types/plugins';
|
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
|
+
/**
|
|
6
|
+
* The extension point ID to resolve plugin modules from.
|
|
7
|
+
* Example: "ddk.ncui.settings.tabView"
|
|
8
|
+
*/
|
|
5
9
|
extension: string;
|
|
10
|
+
/**
|
|
11
|
+
* Optional module ID to load a specific plugin.
|
|
12
|
+
* If not provided, the plugin with the **lowest rank** for the extension point is used.
|
|
13
|
+
*/
|
|
6
14
|
module?: string;
|
|
7
15
|
}
|
|
8
16
|
type DynamicComponentResult = [
|
|
9
17
|
React.FunctionComponent | null,
|
|
10
18
|
BasePluginExtension | null
|
|
11
19
|
];
|
|
20
|
+
/**
|
|
21
|
+
* React hook to resolve and lazily load a plugin component for a given extension point.
|
|
22
|
+
*
|
|
23
|
+
* - If `module` is provided, it directly loads that plugin.
|
|
24
|
+
* - If `module` is not provided, it uses the **lowest-ranked plugin** from the extension point.
|
|
25
|
+
* - Supports both standard plugins (`component`) and view-style plugins (`view.component`)
|
|
26
|
+
* - Uses React.lazy + Module Federation to dynamically import the remote component.
|
|
27
|
+
*
|
|
28
|
+
* @param props.extension The extension point to resolve plugins from
|
|
29
|
+
* @param props.module (Optional) Specific module ID to use, otherwise the highest-priority plugin is loaded
|
|
30
|
+
* @returns A tuple: `[Component, PluginExtension]`
|
|
31
|
+
*/
|
|
12
32
|
export declare const useDynamicComponent: ({ extension, module, }: Props) => DynamicComponentResult;
|
|
13
33
|
export {};
|
|
14
34
|
//# sourceMappingURL=use-dynamic-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dynamic-component.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-dynamic-component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-dynamic-component.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-dynamic-component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,qBAAqB,CAAC;AAI7B,UAAU,KAAK;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,sBAAsB,GAAG;IAC5B,KAAK,CAAC,iBAAiB,GAAG,IAAI;IAC9B,mBAAmB,GAAG,IAAI;CAC3B,CAAC;AASF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,2BAG7B,KAAK,2BAmCP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contribution-reducer.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/contribution-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,eAAO,MAAM,mBAAmB,YACpB,cAAc,WAAW,sBAAsB,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"contribution-reducer.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/contribution-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,eAAO,MAAM,mBAAmB,YACpB,cAAc,WAAW,sBAAsB,OAAO,MAAM,2BA+IrE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const EXTENSION_POINT_CONTROL_POUR_DEF = "cui.control.pour";
|
|
2
|
+
export declare const EXTENSION_POINT_CONTROL_POUR_VIEW = "cui.control.pour.view";
|
|
3
|
+
export declare const EXTENSION_POINT_CONTROL_POUR = "cui.control.pour.config";
|
|
4
|
+
export declare const controlPourReducer: (experiences: Record<string, any>, contributions: import('../../types/plugins').ProcessedContributions) => (acc: import('../..').PluginExtensionsType, key: string) => import('../..').PluginExtensionsType;
|
|
5
|
+
//# sourceMappingURL=control-pour-reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-pour-reducer.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/control-pour-reducer.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC,qBAAqB,CAAC;AACnE,eAAO,MAAM,iCAAiC,0BAA0B,CAAC;AACzE,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,eAAO,MAAM,kBAAkB,6MAQ7B,CAAC"}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './initialize-plugins';
|
|
|
8
8
|
export * from './nav-view-reducer';
|
|
9
9
|
export * from './plugin-extension-manager';
|
|
10
10
|
export * from './process-kos-config';
|
|
11
|
+
export * from './resolve-best-extension';
|
|
11
12
|
export * from './settings-reducer';
|
|
12
13
|
export * from './setup-reducer';
|
|
13
14
|
export * from './state-action-reducer';
|
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
|
|
@@ -30,7 +30,46 @@ interface KosPluginsProps {
|
|
|
30
30
|
pluginApiPath?: string;
|
|
31
31
|
overrides?: Record<string, string>;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Parses the query string from the URL or a provided string and returns an object
|
|
35
|
+
* representing the key-value pairs in the query string.
|
|
36
|
+
*
|
|
37
|
+
* @param query - An optional query string to parse. If not provided, the function
|
|
38
|
+
* will use the current window's `location.search` string.
|
|
39
|
+
* The query string should not include the leading "?" character.
|
|
40
|
+
*
|
|
41
|
+
* @returns An object where each key is a parameter name from the query string,
|
|
42
|
+
* and each value is the corresponding decoded parameter value.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Assuming the URL is: https://example.com/?name=John&age=30
|
|
46
|
+
* getQueryParams();
|
|
47
|
+
* // Returns: { name: "John", age: "30" }
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* getQueryParams("foo=bar&baz=qux");
|
|
51
|
+
* // Returns: { foo: "bar", baz: "qux" }
|
|
52
|
+
*/
|
|
33
53
|
export declare const getQueryParams: (query?: null) => {};
|
|
54
|
+
/**
|
|
55
|
+
* Initializes KOS plugins by fetching plugin metadata and configuring dynamic remotes.
|
|
56
|
+
*
|
|
57
|
+
* @param props - Optional properties to configure the plugin initialization.
|
|
58
|
+
* @param props.pluginBaseUrl - The base URL for the plugins. Defaults to the result of `getDefaultHost()`.
|
|
59
|
+
* @param props.pluginApiPath - The API path to fetch plugin metadata. Defaults to `"/api/app/kosdev.ddk/ncui/plugins"`.
|
|
60
|
+
* @param props.overrides - An object containing overrides for plugin base URLs, keyed by plugin ID.
|
|
61
|
+
*
|
|
62
|
+
* @returns A promise that resolves to a record of remote definitions, where the keys are remote IDs
|
|
63
|
+
* and the values are the corresponding base paths for the remote entries.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* - This function fetches plugin metadata from the specified API endpoint and processes the data
|
|
67
|
+
* to configure dynamic remotes for the KOS plugin system.
|
|
68
|
+
* - If a plugin does not have a descriptor, an error is logged to the console.
|
|
69
|
+
* - The remote definitions are also set using the `setRemoteDefinitions` function.
|
|
70
|
+
*
|
|
71
|
+
* @throws Will throw an error if the fetch request fails or if the response cannot be parsed as JSON.
|
|
72
|
+
*/
|
|
34
73
|
export declare const initializeKosPlugins: (props?: KosPluginsProps) => Promise<Record<string, string>>;
|
|
35
74
|
export {};
|
|
36
75
|
//# sourceMappingURL=initialize-plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-plugins.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/initialize-plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"initialize-plugins.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/initialize-plugins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,kCAAkC,CAAC;AAE1C,OAAO,WAAW,cAAc;IAC9B,gBAAgB,EAAE,cAAc,CAAC;IACjC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;CAChD;AACD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,EAAE,cAAc,CAAC;KAC5B;CACF;AAED,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,UAAU,EAAE,CAAC;QACzB,WAAW,EAAE,aAAa,CAAC;KAC5B,CAAC;CACH;AAED,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,sBAiBjB,CAAC;AAWX;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,WAAkB,eAAe,oCAoCjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-extension-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-extension-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-extension-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-extension-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAK7B,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,wBAAsB,iBAAiB,CACrC,eAAe,CAAC,EAAE,cAAc,GAC/B,OAAO,CAAC,WAAW,CAAC,CAgCtB;AAkBD,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,sBAAsB,CAOxB;AAED,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,iCA8D5D;AAED,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM;;MAG3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-extension-registry-init.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-extension-registry-init.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PluginExtensionsType, ProcessedContributions } from '../../types/plugins';
|
|
2
|
+
|
|
3
|
+
export type ExtensionReducer = (extensions: PluginExtensionsType, contributions: ProcessedContributions, experiences: any) => PluginExtensionsType;
|
|
4
|
+
export declare function registerExtensionReducer(reducer: ExtensionReducer): void;
|
|
5
|
+
export declare function applyExtensionReducers(base: PluginExtensionsType, contributions: ProcessedContributions, experiences: any): PluginExtensionsType;
|
|
6
|
+
//# sourceMappingURL=plugin-extension-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-extension-registry.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-extension-registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,gBAAgB,GAAG,CAC7B,UAAU,EAAE,oBAAoB,EAChC,aAAa,EAAE,sBAAsB,EACrC,WAAW,EAAE,GAAG,KACb,oBAAoB,CAAC;AAI1B,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,QAEjE;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,oBAAoB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,EAAE,GAAG,GACf,oBAAoB,CAKtB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PluginExtension } from '../../types/plugins';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the best plugin extension for a given extension point.
|
|
5
|
+
*
|
|
6
|
+
* @param extensions A map of plugin extensions keyed by module/plugin ID
|
|
7
|
+
* @param module Optional module ID to resolve
|
|
8
|
+
* @param exact If true, only returns a plugin if the given `module` matches exactly. If false (default), falls back to the best-ranked plugin if no match is found.
|
|
9
|
+
* @returns The resolved PluginExtension or null
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveBestExtension<T extends PluginExtension>(extensions: Record<string, T> | undefined, module?: string, exact?: boolean): T | null;
|
|
12
|
+
//# sourceMappingURL=resolve-best-extension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-best-extension.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/resolve-best-extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,eAAe,EAC5D,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,EACzC,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,UAAQ,GACZ,CAAC,GAAG,IAAI,CAgCV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ui-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"kos": {
|
|
28
28
|
"build": {
|
|
29
|
-
"gitHash": "
|
|
29
|
+
"gitHash": "e0c503e557110d60c4da6b5f600eed0298c35d01"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var R={},f={};Object.defineProperty(f,"__esModule",{value:!0});f.loadRemoteModule=f.setRemoteDefinitions=f.setRemoteUrlResolver=void 0;let h,w;const D=new Map,g=new Map;let S=!1;function W(n){w=n}f.setRemoteUrlResolver=W;function z(n){h=n}f.setRemoteDefinitions=z;async function L(n,t){const o=`${n}:${t}`;if(D.has(o))return D.get(o);const d=(await(g.has(n)?g.get(n):await H(n)).get(t))();return D.set(o,d),d}f.loadRemoteModule=L;const q=(n,t)=>new Promise((o,s)=>{const i=document.createElement("script");i.src=n,i.type="text/javascript",i.async=!0,i.onload=()=>{o({get:r=>window[t].get(r),init:r=>{try{window[t].init(r)}catch(a){console.error(`Failed to initialize remote ${t}`,a),s(a)}}})},i.onerror=()=>s(new Error(`Remote ${t} not found`)),document.head.appendChild(i)});async function H(n){if(!w&&!h)throw new Error("Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.");S||(S=!0,await __webpack_init_sharing__("default"));const t=h?h[n]:await w(n);let o=t;!t.endsWith(".mjs")&&!t.endsWith(".js")&&(o=`${t}${t.endsWith("/")?"":"/"}remoteEntry.js`);const s=await q(o,n);return await s.init(__webpack_share_scopes__.default),g.set(n,s),s}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.setRemoteUrlResolver=n.setRemoteDefinitions=n.loadRemoteModule=void 0;var t=f;Object.defineProperty(n,"loadRemoteModule",{enumerable:!0,get:function(){return t.loadRemoteModule}}),Object.defineProperty(n,"setRemoteDefinitions",{enumerable:!0,get:function(){return t.setRemoteDefinitions}}),Object.defineProperty(n,"setRemoteUrlResolver",{enumerable:!0,get:function(){return t.setRemoteUrlResolver}})})(R);const V=n=>(t,o)=>{var m,x,E,v,C,_,K,M,j,O,I,U;t.cuiDefinitions=t.cuiDefinitions||{};const s=n[o].remote,i=o;(((m=n[o].contributes)==null?void 0:m.cui)||[]).forEach(e=>{t.cuiDefinitions[e.id]={...e,cuiDescriptor:i,remote:s,sectionId:i}}),(((x=n[o].contributes)==null?void 0:x.navViews)||[]).forEach(e=>{t.navViewDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((E=n[o].contributes)==null?void 0:E.utilities)||[]).forEach(e=>{t.utilDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((v=n[o].contributes)==null?void 0:v.setupStep)||[]).forEach(e=>{t.setupDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((C=n[o].contributes)==null?void 0:C.troubleActions)||[]).forEach(e=>{t.troubleActionDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((_=n[o].contributes)==null?void 0:_.controlPour)||[]).forEach(e=>{t.controlPourDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((K=n[o].contributes)==null?void 0:K.settingsGroup)||[]).forEach(e=>{t.settingsGroupDefinitions[e.id]={...e,settings:[],remote:s,sectionId:i}}),(((M=n[o].contributes)==null?void 0:M.settings)||[]).forEach(e=>{t.settingsDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((j=n[o].contributes)==null?void 0:j.dashboardSummary)||[]).forEach(e=>{t.dashboardDefinitions[e.dashboardKey]=t.dashboardDefinitions[e.dashboardKey]||{},t.dashboardDefinitions[e.dashboardKey].summary={...e,remote:s,sectionId:i},t.dashboardSummaryDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((O=n[o].contributes)==null?void 0:O.dashboardDetail)||[]).forEach(e=>{t.dashboardDefinitions[e.dashboardKey]=t.dashboardDefinitions[e.dashboardKey]||{},t.dashboardDefinitions[e.dashboardKey].detail={...e,remote:s,sectionId:i},t.dashboardDetailDefinitions[e.id]={...e,remote:s,sectionId:i}}),(((I=n[o].contributes)==null?void 0:I.dashboardPumpDetail)||[]).forEach(e=>{t.dashboardDefinitions[e.dashboardKey]=t.dashboardDefinitions[e.dashboardKey]||{},t.dashboardDefinitions[e.dashboardKey].pumpDetail={...e,remote:s,sectionId:i},t.dashboardPumpDetailDefinitions[e.id]={...e,remote:s,sectionId:i}});const y=(U=n[o].contributes)==null?void 0:U.experiences;return Object.keys(y).forEach(e=>{const T=y[e];t.experiences[e]={...T,remote:s,sectionId:i}}),t},$=[];function J(n){$.push(n)}function Q(n,t,o){return $.reduce((s,i)=>i(s,t,o),n)}async function G(n){const t=n??window.KosPlugins.__dynamicRemotes;if(window.KosPlugins.extensions){const d=window.KosPlugins.extensions;return{extensionPoints:d,getExtensions:r=>d[r]||[],remotes:t,extensions:window.KosPlugins.__extensions}}const o=window.KosPlugins.__extensions??await F(t),s={};if(o)for(const d of Object.keys(o))s[d]=Object.values(o[d]||{});return window.KosPlugins.extensions=s,{extensionPoints:s,getExtensions:d=>s[d]||[],remotes:t,extensions:o}}const A={cuiDefinitions:{},controlPourDefinitions:{},utilDefinitions:{},setupDefinitions:{},settingsGroupDefinitions:{},settingsDefinitions:{},dashboardSummaryDefinitions:{},dashboardDetailDefinitions:{},dashboardPumpDetailDefinitions:{},dashboardDefinitions:{},navViewDefinitions:{},troubleActionDefinitions:{},experiences:{}};function B(n){return n?Object.keys(n).reduce(V(n),{...A}):A}async function F(n){if(!n)return window.KosPlugins=window.KosPlugins||{},{};const t=B(n),o=t.experiences,i=Q({},t,o);for(const r of Object.values(n))if(r.init){const a=await R.loadRemoteModule(r.remote,"./InitPlugin");if(a.default){const l=new a.default;l==null||l.register()}}const d=Object.keys(n).reduce((r,a)=>{var p;const l=((p=n[a].contributes)==null?void 0:p.views)??{};for(const u of Object.keys(l)){const P=l[u];r[u]=r[u]||{};for(const c of P)r[u][c.id]={id:c.id,type:"view",component:c.component,remote:n[a].remote,sectionId:a,data:c}}const b=n[a].extensions??[];for(const u of b)r[u.extensionPointId]=r[u.extensionPointId]||{},r[u.extensionPointId][u.id]={id:u.id,type:u.type,component:u.component,remote:n[a].remote,sectionId:a,data:u};return r},i);return window.KosPlugins=window.KosPlugins||{},window.KosPlugins.__extensions=d,d}async function X(n){const{getExtensions:t}=await G();return t(n)}function Y(n,t,o=!1){return!n||Object.keys(n).length===0?null:o?t&&n[t]?n[t]:null:t&&n[t]?n[t]:Object.values(n).filter(i=>typeof i.id=="string").sort((i,d)=>{const r=typeof i.rank=="number"?i.rank:1/0,a=typeof d.rank=="number"?d.rank:1/0;if(r===a){const l=i.id??"",b=d.id??"";return l.localeCompare(b)}return r-a})[0]??null}exports.contributionReducer=V;exports.getContributions=B;exports.getExtensions=X;exports.initPluginManager=G;exports.loadExtensions=F;exports.mf=R;exports.registerExtensionReducer=J;exports.resolveBestExtension=Y;
|
|
2
|
+
//# sourceMappingURL=resolve-best-extension-D5Ord7XK.cjs.map
|