@kosdev-code/kos-ui-plugin 0.1.0-dev.5053
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/documentation-generator-DFaIDo0E.cjs +266 -0
- package/documentation-generator-DFaIDo0E.cjs.map +1 -0
- package/documentation-generator-auruIa_o.js +1560 -0
- package/documentation-generator-auruIa_o.js.map +1 -0
- package/index.cjs +437 -0
- package/index.cjs.map +1 -0
- package/index.d.ts +5 -0
- package/index.d.ts.map +1 -0
- package/index.js +2276 -0
- package/index.js.map +1 -0
- package/lib/components/dynamic-component/dynamic-component.d.ts +11 -0
- package/lib/components/dynamic-component/dynamic-component.d.ts.map +1 -0
- package/lib/components/dynamic-component/error-boundary.d.ts +17 -0
- package/lib/components/dynamic-component/error-boundary.d.ts.map +1 -0
- package/lib/components/dynamic-component/index.d.ts +2 -0
- package/lib/components/dynamic-component/index.d.ts.map +1 -0
- package/lib/components/dynamic-container/dynamic-container.d.ts +12 -0
- package/lib/components/dynamic-container/dynamic-container.d.ts.map +1 -0
- package/lib/components/dynamic-container/index.d.ts +2 -0
- package/lib/components/dynamic-container/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/plugin-explorer/extension-point-list.d.ts +13 -0
- package/lib/components/plugin-explorer/extension-point-list.d.ts.map +1 -0
- package/lib/components/plugin-explorer/floating-plugin-explorer.d.ts +13 -0
- package/lib/components/plugin-explorer/floating-plugin-explorer.d.ts.map +1 -0
- package/lib/components/plugin-explorer/index.d.ts +10 -0
- package/lib/components/plugin-explorer/index.d.ts.map +1 -0
- package/lib/components/plugin-explorer/plugin-card.d.ts +10 -0
- package/lib/components/plugin-explorer/plugin-card.d.ts.map +1 -0
- package/lib/components/plugin-explorer/plugin-explorer.d.ts +12 -0
- package/lib/components/plugin-explorer/plugin-explorer.d.ts.map +1 -0
- package/lib/components/plugin-explorer/plugin-health-dashboard.d.ts +9 -0
- package/lib/components/plugin-explorer/plugin-health-dashboard.d.ts.map +1 -0
- package/lib/contexts/index.d.ts +2 -0
- package/lib/contexts/index.d.ts.map +1 -0
- package/lib/contexts/plugins-provider/index.d.ts +2 -0
- package/lib/contexts/plugins-provider/index.d.ts.map +1 -0
- package/lib/contexts/plugins-provider/plugins-provider.d.ts +50 -0
- package/lib/contexts/plugins-provider/plugins-provider.d.ts.map +1 -0
- package/lib/hooks/index.d.ts +6 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/use-dynamic-component.d.ts +34 -0
- package/lib/hooks/use-dynamic-component.d.ts.map +1 -0
- package/lib/hooks/use-extension-component.d.ts +26 -0
- package/lib/hooks/use-extension-component.d.ts.map +1 -0
- package/lib/hooks/use-extension-i18n.d.ts +69 -0
- package/lib/hooks/use-extension-i18n.d.ts.map +1 -0
- package/lib/hooks/use-plugin-discovery.d.ts +23 -0
- package/lib/hooks/use-plugin-discovery.d.ts.map +1 -0
- package/lib/hooks/use-typed-extensions.d.ts +152 -0
- package/lib/hooks/use-typed-extensions.d.ts.map +1 -0
- package/lib/utils/discovery/documentation-generator.d.ts +85 -0
- package/lib/utils/discovery/documentation-generator.d.ts.map +1 -0
- package/lib/utils/discovery/plugin-discovery-service.d.ts +109 -0
- package/lib/utils/discovery/plugin-discovery-service.d.ts.map +1 -0
- package/lib/utils/extension-points/define-extension-point.d.ts +58 -0
- package/lib/utils/extension-points/define-extension-point.d.ts.map +1 -0
- package/lib/utils/extension-points/example-extension-point.d.ts +67 -0
- package/lib/utils/extension-points/example-extension-point.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-registry.d.ts +59 -0
- package/lib/utils/extension-points/extension-point-registry.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-schema.d.ts +9 -0
- package/lib/utils/extension-points/extension-point-schema.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-schemas.d.ts +92 -0
- package/lib/utils/extension-points/extension-point-schemas.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-transforms.d.ts +21 -0
- package/lib/utils/extension-points/extension-point-transforms.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-types.d.ts +162 -0
- package/lib/utils/extension-points/extension-point-types.d.ts.map +1 -0
- package/lib/utils/extension-points/extension-point-validation.d.ts +43 -0
- package/lib/utils/extension-points/extension-point-validation.d.ts.map +1 -0
- package/lib/utils/extension-points/json-extension-parser.d.ts +68 -0
- package/lib/utils/extension-points/json-extension-parser.d.ts.map +1 -0
- package/lib/utils/extension-points/type-generator.d.ts +43 -0
- package/lib/utils/extension-points/type-generator.d.ts.map +1 -0
- package/lib/utils/index.d.ts +10 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-extension-manager.d.ts +15 -0
- package/lib/utils/plugin-system/plugin-extension-manager.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-extension-registry-init.d.ts +2 -0
- package/lib/utils/plugin-system/plugin-extension-registry-init.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-extension-registry.d.ts +6 -0
- package/lib/utils/plugin-system/plugin-extension-registry.d.ts.map +1 -0
- package/lib/utils/plugin-system/plugin-reducer.d.ts +17 -0
- package/lib/utils/plugin-system/plugin-reducer.d.ts.map +1 -0
- package/lib/utils/plugin-system/resolve-best-extension.d.ts +12 -0
- package/lib/utils/plugin-system/resolve-best-extension.d.ts.map +1 -0
- package/lib/utils/processors/contribution-reducer.d.ts +5 -0
- package/lib/utils/processors/contribution-reducer.d.ts.map +1 -0
- package/lib/utils/processors/initialize-plugins.d.ts +82 -0
- package/lib/utils/processors/initialize-plugins.d.ts.map +1 -0
- package/lib/utils/processors/initialize-simplified-extensions.d.ts +13 -0
- package/lib/utils/processors/initialize-simplified-extensions.d.ts.map +1 -0
- package/lib/utils/processors/process-kos-config.d.ts +34 -0
- package/lib/utils/processors/process-kos-config.d.ts.map +1 -0
- package/lib/utils/processors/simplified-contribution-processor.d.ts +14 -0
- package/lib/utils/processors/simplified-contribution-processor.d.ts.map +1 -0
- package/lib/webpack/index.d.ts +2 -0
- package/lib/webpack/index.d.ts.map +1 -0
- package/lib/webpack/with-kos-config.d.ts +2 -0
- package/lib/webpack/with-kos-config.d.ts.map +1 -0
- package/package.json +30 -0
- package/types/global.d.ts +53 -0
- package/types/plugins.d.ts +41 -0
- package/utils.cjs +2 -0
- package/utils.cjs.map +1 -0
- package/utils.js +296 -0
- package/utils.js.map +1 -0
- package/webpack.cjs +13 -0
- package/webpack.cjs.map +1 -0
- package/webpack.js +795 -0
- package/webpack.js.map +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Props<T extends object = ReactElement> {
|
|
4
|
+
extension: string;
|
|
5
|
+
componentMap: ({ component, key, }: {
|
|
6
|
+
component: ReactNode;
|
|
7
|
+
key: string;
|
|
8
|
+
}) => T;
|
|
9
|
+
}
|
|
10
|
+
export declare const useDynamicContainer: <T extends object = ReactElement<any, string | import('react').JSXElementConstructor<any>>>({ extension, componentMap, }: Props<T>) => import("@emotion/react/jsx-runtime").JSX.Element[] | T[];
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=dynamic-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-container.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/dynamic-container/dynamic-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKhD,UAAU,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,YAAY;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,EACb,SAAS,EACT,GAAG,GACJ,EAAE;QACD,SAAS,EAAE,SAAS,CAAC;QACrB,GAAG,EAAE,MAAM,CAAC;KACb,KAAK,CAAC,CAAC;CACT;AAED,eAAO,MAAM,mBAAmB,4HAG7B,MAAM,CAAC,CAAC,6DAyBV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/dynamic-container/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExtensionPointInfo } from '../../utils';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface ExtensionPointListProps {
|
|
5
|
+
extensionPoints: ExtensionPointInfo[];
|
|
6
|
+
selectedExtensionId: string | null;
|
|
7
|
+
onExtensionSelect: (extensionId: string) => void;
|
|
8
|
+
searchTerm: string;
|
|
9
|
+
onSearchChange: (searchTerm: string) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ExtensionPointList: React.FC<ExtensionPointListProps>;
|
|
13
|
+
//# sourceMappingURL=extension-point-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-point-list.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/plugin-explorer/extension-point-list.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iBAAiB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmGD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmDhE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PluginExplorerProps } from './plugin-explorer';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface FloatingPluginExplorerProps extends Omit<PluginExplorerProps, "className"> {
|
|
5
|
+
/** Keyboard shortcut to toggle (default: "ctrl+shift+p") */
|
|
6
|
+
keyboardShortcut?: string;
|
|
7
|
+
/** Whether to show the toggle button (default: true) */
|
|
8
|
+
showToggleButton?: boolean;
|
|
9
|
+
/** Position of the toggle button (default: "bottom-right") */
|
|
10
|
+
toggleButtonPosition?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
11
|
+
}
|
|
12
|
+
export declare const FloatingPluginExplorer: React.FC<FloatingPluginExplorerProps>;
|
|
13
|
+
//# sourceMappingURL=floating-plugin-explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating-plugin-explorer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/plugin-explorer/floating-plugin-explorer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC;IAC9C,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8DAA8D;IAC9D,oBAAoB,CAAC,EACjB,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAC;CACpB;AA6GD,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAsHxE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ExtensionPointList } from './extension-point-list';
|
|
2
|
+
export { FloatingPluginExplorer } from './floating-plugin-explorer';
|
|
3
|
+
export { PluginCard } from './plugin-card';
|
|
4
|
+
export { PluginExplorer } from './plugin-explorer';
|
|
5
|
+
export { PluginHealthDashboard } from './plugin-health-dashboard';
|
|
6
|
+
export type { ExtensionPointListProps } from './extension-point-list';
|
|
7
|
+
export type { PluginCardProps } from './plugin-card';
|
|
8
|
+
export type { PluginExplorerProps } from './plugin-explorer';
|
|
9
|
+
export type { PluginHealthDashboardProps } from './plugin-health-dashboard';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/plugin-explorer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PluginExtension } from '../../../types/plugins';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface PluginCardProps {
|
|
5
|
+
plugin: PluginExtension;
|
|
6
|
+
extensionPointId: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const PluginCard: React.FC<PluginCardProps>;
|
|
10
|
+
//# sourceMappingURL=plugin-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-card.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/plugin-explorer/plugin-card.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,eAAe,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4LD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgGhD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface PluginExplorerProps {
|
|
4
|
+
/** Optional CSS class name */
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Whether to show legacy extension points (non-simplified) */
|
|
7
|
+
showLegacyExtensions?: boolean;
|
|
8
|
+
/** Optional filter for extension point IDs */
|
|
9
|
+
extensionFilter?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const PluginExplorer: React.FC<PluginExplorerProps>;
|
|
12
|
+
//# sourceMappingURL=plugin-explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-explorer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/plugin-explorer/plugin-explorer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,MAAM,WAAW,mBAAmB;IAClC,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAqHD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoMxD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginHealthStats } from '../../utils';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface PluginHealthDashboardProps {
|
|
5
|
+
healthStats: PluginHealthStats;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const PluginHealthDashboard: React.FC<PluginHealthDashboardProps>;
|
|
9
|
+
//# sourceMappingURL=plugin-health-dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-health-dashboard.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/components/plugin-explorer/plugin-health-dashboard.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA+FD,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAiFtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/contexts/plugins-provider/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PluginExtension } from '../../../types/plugins';
|
|
2
|
+
import { DynamicRemotes } from '../../../types/global';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
|
|
5
|
+
interface PluginsType {
|
|
6
|
+
remotes?: DynamicRemotes;
|
|
7
|
+
extensions?: PluginExtensionsType;
|
|
8
|
+
extensionPoints?: Record<string, PluginExtension[]>;
|
|
9
|
+
getExtensions: (extensionPointId: string) => PluginExtension[];
|
|
10
|
+
}
|
|
11
|
+
export interface PluginExtensionsType {
|
|
12
|
+
[k: string]: {
|
|
13
|
+
[k: string]: PluginExtension;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The context for managing dynamic remotes and extensions.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RemotesContext: import('react').Context<PluginsType | undefined>;
|
|
20
|
+
interface Props {
|
|
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 | string[];
|
|
36
|
+
group?: string;
|
|
37
|
+
};
|
|
38
|
+
overrides?: Record<string, string>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The provider component for the RemotesContext.
|
|
43
|
+
*/
|
|
44
|
+
export declare const KosPluginProvider: React.FunctionComponent<PropsWithChildren<Props>>;
|
|
45
|
+
/**
|
|
46
|
+
* Custom hook for accessing the RemotesContext.
|
|
47
|
+
*/
|
|
48
|
+
export declare const useKosPluginsContext: () => PluginsType;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=plugins-provider.d.ts.map
|
|
@@ -0,0 +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;AAI9D,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;IACjC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE;QACb,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE;YACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;YAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACpC,CAAC;CACH;AAgBD;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,CACrD,iBAAiB,CAAC,KAAK,CAAC,CAoEzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,mBAQhC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BasePluginExtension } from '../../types/plugins';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
/**
|
|
6
|
+
* The extension point ID to resolve plugin modules from.
|
|
7
|
+
* Example: "ddk.ncui.settings.tabView"
|
|
8
|
+
*/
|
|
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
|
+
*/
|
|
14
|
+
module?: string;
|
|
15
|
+
}
|
|
16
|
+
type DynamicComponentResult = [
|
|
17
|
+
React.FunctionComponent | null,
|
|
18
|
+
BasePluginExtension | null
|
|
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
|
+
*/
|
|
32
|
+
export declare const useDynamicComponent: ({ extension, module, }: Props) => DynamicComponentResult;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=use-dynamic-component.d.ts.map
|
|
@@ -0,0 +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":"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,2BAqCP,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ExtensionPointDefinition } from '../utils/extension-points/extension-point-types';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Props for extension components created by the hook
|
|
6
|
+
*/
|
|
7
|
+
export interface ExtensionComponentProps {
|
|
8
|
+
module?: string;
|
|
9
|
+
fallback?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Hook that creates a strongly typed React component for an extension point
|
|
13
|
+
* This moves the React component creation to runtime, avoiding webpack config issues
|
|
14
|
+
*/
|
|
15
|
+
export declare function useExtensionComponent<TData = any, TProcessed = TData, TProps = any>(definition: ExtensionPointDefinition<TData, TProcessed, TProps>): React.ComponentType<ExtensionComponentProps & TProps> | null;
|
|
16
|
+
/**
|
|
17
|
+
* Factory function that creates a component for an extension point
|
|
18
|
+
* Alternative to the hook for non-hook contexts
|
|
19
|
+
*/
|
|
20
|
+
export declare function createExtensionComponent<TData = any, TProcessed = TData, TProps = any>(definition: ExtensionPointDefinition<TData, TProcessed, TProps>): React.ComponentType<ExtensionComponentProps & TProps> | null;
|
|
21
|
+
/**
|
|
22
|
+
* Hook that creates a React component for an extension point by ID
|
|
23
|
+
* Useful for JSON-defined extension points where you only have the string ID
|
|
24
|
+
*/
|
|
25
|
+
export declare function useExtensionComponentById<TProps = any>(extensionPointId: string): React.ComponentType<ExtensionComponentProps & TProps> | null;
|
|
26
|
+
//# sourceMappingURL=use-extension-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-extension-component.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-extension-component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAGhG;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,UAAU,EAAE,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GAC9D,KAAK,CAAC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAAC,GAAG,IAAI,CAyB9D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,UAAU,EAAE,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GAC9D,KAAK,CAAC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAAC,GAAG,IAAI,CAuB9D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,GAAG,GAAG,EACpD,gBAAgB,EAAE,MAAM,GACvB,KAAK,CAAC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAAC,GAAG,IAAI,CAiC9D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ExtensionComponentProps } from './use-extension-component';
|
|
2
|
+
import { PluginExtension } from '../../types/plugins';
|
|
3
|
+
import { useKosTranslation } from '@kosdev-code/kos-ui-sdk';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base properties that all extension data includes
|
|
7
|
+
*/
|
|
8
|
+
export interface ExtensionBaseData {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
namespace: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Result from useExtensionI18n hook
|
|
15
|
+
*/
|
|
16
|
+
export interface UseExtensionI18nResult<TData = unknown, TProps = unknown> {
|
|
17
|
+
/** All extensions for this extension point - data includes base properties (id, title, namespace) plus custom TData */
|
|
18
|
+
extensions: PluginExtension<ExtensionBaseData & TData>[];
|
|
19
|
+
/** Translation function configured with all unique namespaces from extensions */
|
|
20
|
+
t: ReturnType<typeof useKosTranslation>["t"];
|
|
21
|
+
/** i18n utilities (e.g., exists check) */
|
|
22
|
+
i18n: ReturnType<typeof useKosTranslation>["i18n"];
|
|
23
|
+
/** Component that can render extensions of this type - requires module prop to specify which extension to render */
|
|
24
|
+
Component: React.ComponentType<ExtensionComponentProps & TProps> | null;
|
|
25
|
+
/** Unique namespaces extracted from extensions */
|
|
26
|
+
namespaces: string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hook to simplify the common pattern of:
|
|
30
|
+
* 1. Getting extensions for an extension point
|
|
31
|
+
* 2. Extracting their namespaces
|
|
32
|
+
* 3. Configuring i18n with those namespaces
|
|
33
|
+
* 4. Getting the extension component
|
|
34
|
+
*
|
|
35
|
+
* **For type safety:** Define only the custom properties from your extension schema.
|
|
36
|
+
* The hook automatically merges base properties (id, title, namespace) with your custom type.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* // Step 1: Define only your custom extension properties
|
|
41
|
+
* // src/types/nav-link-types.ts
|
|
42
|
+
* export interface NavLinkData {
|
|
43
|
+
* viewKey: string; // Only define your custom properties - base props are added automatically!
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // Step 2: Use the type with the hook
|
|
47
|
+
* import { NavLinkData } from '../types/nav-link-types';
|
|
48
|
+
*
|
|
49
|
+
* const { extensions, t, Component } = useExtensionI18n<NavLinkData, NavLinkProps>(
|
|
50
|
+
* EXTENSION_ID_NAV_LINK
|
|
51
|
+
* );
|
|
52
|
+
*
|
|
53
|
+
* // extensions.data includes both base properties AND your custom properties
|
|
54
|
+
* const navLinks = extensions.map(link => ({
|
|
55
|
+
* title: t(`${link.data.namespace}:${link.data.title}`), // namespace and title from base
|
|
56
|
+
* viewKey: link.data.viewKey, // viewKey from your custom NavLinkData
|
|
57
|
+
* icon: <Component module={link.id} navKey={link.data.viewKey} />
|
|
58
|
+
* }));
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @param extensionPointId - The extension point identifier
|
|
62
|
+
* @param options - Optional configuration
|
|
63
|
+
* @returns Object containing extensions, translation function, component, and namespaces
|
|
64
|
+
*/
|
|
65
|
+
export declare function useExtensionI18n<TData = unknown, TProps = unknown>(extensionPointId: string, options?: {
|
|
66
|
+
/** Property name in extension.data where namespace is stored (default: 'namespace') */
|
|
67
|
+
namespaceProperty?: string;
|
|
68
|
+
}): UseExtensionI18nResult<TData, TProps>;
|
|
69
|
+
//# sourceMappingURL=use-extension-i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-extension-i18n.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-extension-i18n.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,2BAA2B,CAAC;AAGnC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO;IACvE,uHAAuH;IACvH,UAAU,EAAE,eAAe,CAAC,iBAAiB,GAAG,KAAK,CAAC,EAAE,CAAC;IACzD,iFAAiF;IACjF,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7C,0CAA0C;IAC1C,IAAI,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,oHAAoH;IACpH,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,uBAAuB,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;IACxE,kDAAkD;IAClD,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EAChE,gBAAgB,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE;IACR,uFAAuF;IACvF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACA,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,CAwBvC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ExtensionPointInfo, PluginDiscoveryOptions, PluginHealthStats } from '../utils';
|
|
2
|
+
|
|
3
|
+
export interface UsePluginDiscoveryResult {
|
|
4
|
+
extensionPoints: ExtensionPointInfo[];
|
|
5
|
+
healthStats: PluginHealthStats;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error?: Error;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook for discovering extension points and plugins
|
|
11
|
+
*/
|
|
12
|
+
export declare function usePluginDiscovery(options?: PluginDiscoveryOptions): UsePluginDiscoveryResult;
|
|
13
|
+
/**
|
|
14
|
+
* Hook for filtered extension points with search
|
|
15
|
+
*/
|
|
16
|
+
export declare function useFilteredExtensionPoints(searchTerm: string, options?: PluginDiscoveryOptions): UsePluginDiscoveryResult & {
|
|
17
|
+
filteredExtensionPoints: ExtensionPointInfo[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Hook for a specific extension point
|
|
21
|
+
*/
|
|
22
|
+
export declare function useExtensionPoint(extensionPointId: string): ExtensionPointInfo | undefined;
|
|
23
|
+
//# sourceMappingURL=use-plugin-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-plugin-discovery.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-plugin-discovery.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,wBAAwB,CAoC1B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,wBAAwB,GAAG;IAC5B,uBAAuB,EAAE,kBAAkB,EAAE,CAAC;CAC/C,CAgBA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,MAAM,GACvB,kBAAkB,GAAG,SAAS,CAWhC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { ExtensionPointDefinition } from '../utils';
|
|
2
|
+
import { BasePluginExtension, PluginExtension } from '../../types/plugins';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Criteria for selecting the best extension from multiple candidates
|
|
6
|
+
*/
|
|
7
|
+
export interface BestExtensionCriteria {
|
|
8
|
+
/** Preferred module/plugin ID */
|
|
9
|
+
preferredModule?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Generic property matching - filters extensions where all specified
|
|
12
|
+
* properties match the values in extension.data
|
|
13
|
+
* @example { environment: 'production', version: '2.0' }
|
|
14
|
+
*/
|
|
15
|
+
propertyMatches?: Record<string, any>;
|
|
16
|
+
/** Custom ranking function */
|
|
17
|
+
customRanker?: (extensions: PluginExtension[]) => PluginExtension | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Hook to get all extensions for a specific extension point with full type safety
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // For simplified extension points (with type inference)
|
|
25
|
+
* const nutritionalExtensions = useExtensions(CuiNutritionalData);
|
|
26
|
+
* // Type: BasePluginExtension & { data: ProcessedNutritionalData }[]
|
|
27
|
+
*
|
|
28
|
+
* // For legacy extension points (generic)
|
|
29
|
+
* const cuiExtensions = useExtensions("ddk.cui.settings.config");
|
|
30
|
+
* // Type: PluginExtension[]
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useExtensions<TData = unknown, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>): (BasePluginExtension<TProcessed> & {
|
|
34
|
+
data: TProcessed;
|
|
35
|
+
})[];
|
|
36
|
+
export declare function useExtensions<TData = unknown>(extensionPointId: string): PluginExtension<TData>[];
|
|
37
|
+
/**
|
|
38
|
+
* Hook to get the best extension for a specific extension point with type safety
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Get best extension with automatic selection
|
|
43
|
+
* const bestNutrition = useBest(CuiNutritionalData);
|
|
44
|
+
*
|
|
45
|
+
* // Get best extension with property matching
|
|
46
|
+
* const bestNutrition = useBest(CuiNutritionalData, {
|
|
47
|
+
* propertyMatches: { environment: 'production', version: '2.0' }
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Legacy extension point
|
|
51
|
+
* const bestCui = useBest("ddk.cui.settings.config", {
|
|
52
|
+
* preferredModule: 'my-plugin-id'
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function useBest<TData = unknown, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>, criteria?: BestExtensionCriteria): (BasePluginExtension<TProcessed> & {
|
|
57
|
+
data: TProcessed;
|
|
58
|
+
}) | null;
|
|
59
|
+
export declare function useBest<TData = unknown>(extensionPointId: string, criteria?: BestExtensionCriteria): PluginExtension<TData> | null;
|
|
60
|
+
/**
|
|
61
|
+
* Hook to check if any extensions are available for an extension point
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* const hasNutritionExtensions = useHasExtensions(CuiNutritionalData);
|
|
66
|
+
* if (hasNutritionExtensions) {
|
|
67
|
+
* return <DynamicComponent extension={CuiNutritionalData.id} />;
|
|
68
|
+
* }
|
|
69
|
+
* return <DefaultNutritionInfo />;
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function useHasExtensions<TData = any, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>): boolean;
|
|
73
|
+
export declare function useHasExtensions(extensionPointId: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Hook to get extension count for an extension point
|
|
76
|
+
* Useful for displaying "X plugins available" messages
|
|
77
|
+
*/
|
|
78
|
+
export declare function useExtensionCount<TData = any, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>): number;
|
|
79
|
+
export declare function useExtensionCount(extensionPointId: string): number;
|
|
80
|
+
/**
|
|
81
|
+
* Hook to get extensions filtered by specific criteria
|
|
82
|
+
* More flexible than useBest when you need multiple filtered results
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* // Get all US-specific extensions
|
|
87
|
+
* const usExtensions = useFilteredExtensions(CuiNutritionalData, {
|
|
88
|
+
* filter: (ext) => ext.data.regionCode === 'US'
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function useFilteredExtensions<TData = unknown, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>, options: {
|
|
93
|
+
filter: (extension: BasePluginExtension<TProcessed> & {
|
|
94
|
+
data: TProcessed;
|
|
95
|
+
}) => boolean;
|
|
96
|
+
sort?: (a: BasePluginExtension<TProcessed> & {
|
|
97
|
+
data: TProcessed;
|
|
98
|
+
}, b: BasePluginExtension<TProcessed> & {
|
|
99
|
+
data: TProcessed;
|
|
100
|
+
}) => number;
|
|
101
|
+
}): (BasePluginExtension<TProcessed> & {
|
|
102
|
+
data: TProcessed;
|
|
103
|
+
})[];
|
|
104
|
+
export declare function useFilteredExtensions<TData = unknown>(extensionPointId: string, options: {
|
|
105
|
+
filter: (extension: PluginExtension<TData>) => boolean;
|
|
106
|
+
sort?: (a: PluginExtension<TData>, b: PluginExtension<TData>) => number;
|
|
107
|
+
}): PluginExtension<TData>[];
|
|
108
|
+
/**
|
|
109
|
+
* Hook to load raw modules (non-React components) from extensions
|
|
110
|
+
* Useful for accessing utility functions, services, configurations, or other non-UI modules
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```tsx
|
|
114
|
+
* // Load utility modules
|
|
115
|
+
* const utilityModules = useModules(UtilityExtension);
|
|
116
|
+
*
|
|
117
|
+
* // Load configuration modules
|
|
118
|
+
* const configModules = useModules(ConfigExtension, {
|
|
119
|
+
* filter: (ext) => ext.data.environment === 'production'
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* // Access loaded modules
|
|
123
|
+
* utilityModules.forEach(({ module, extension }) => {
|
|
124
|
+
* if (module?.validateData) {
|
|
125
|
+
* const isValid = module.validateData(someData);
|
|
126
|
+
* }
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function useModules<TData = unknown, TProcessed = TData, TModule = unknown>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>, options?: {
|
|
131
|
+
filter?: (extension: BasePluginExtension<TProcessed> & {
|
|
132
|
+
data: TProcessed;
|
|
133
|
+
}) => boolean;
|
|
134
|
+
moduleProperty?: string;
|
|
135
|
+
}): Array<{
|
|
136
|
+
extension: BasePluginExtension<TProcessed> & {
|
|
137
|
+
data: TProcessed;
|
|
138
|
+
};
|
|
139
|
+
module: TModule | null;
|
|
140
|
+
loading: boolean;
|
|
141
|
+
error: string | null;
|
|
142
|
+
}>;
|
|
143
|
+
export declare function useModules<TData = unknown, TModule = unknown>(extensionPointId: string, options?: {
|
|
144
|
+
filter?: (extension: PluginExtension<TData>) => boolean;
|
|
145
|
+
moduleProperty?: string;
|
|
146
|
+
}): Array<{
|
|
147
|
+
extension: PluginExtension<TData>;
|
|
148
|
+
module: TModule | null;
|
|
149
|
+
loading: boolean;
|
|
150
|
+
error: string | null;
|
|
151
|
+
}>;
|
|
152
|
+
//# sourceMappingURL=use-typed-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-typed-extensions.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/hooks/use-typed-extensions.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ExtensionPointInfo } from './plugin-discovery-service';
|
|
2
|
+
import { PluginExtensionsType } from '../../../types/plugins';
|
|
3
|
+
|
|
4
|
+
export interface DocumentationOptions {
|
|
5
|
+
includeUsageExamples?: boolean;
|
|
6
|
+
includeTypeDefinitions?: boolean;
|
|
7
|
+
includeLegacyExtensions?: boolean;
|
|
8
|
+
includePluginHealth?: boolean;
|
|
9
|
+
format?: "markdown" | "html";
|
|
10
|
+
}
|
|
11
|
+
export interface GeneratedDocumentation {
|
|
12
|
+
content: string;
|
|
13
|
+
metadata: {
|
|
14
|
+
generatedAt: string;
|
|
15
|
+
totalExtensionPoints: number;
|
|
16
|
+
totalPlugins: number;
|
|
17
|
+
simplifiedExtensionPoints: number;
|
|
18
|
+
legacyExtensionPoints: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Documentation Generator - Creates comprehensive documentation from extension points
|
|
23
|
+
*/
|
|
24
|
+
export declare class DocumentationGenerator {
|
|
25
|
+
/**
|
|
26
|
+
* Generate complete documentation for all extension points
|
|
27
|
+
*/
|
|
28
|
+
static generateFullDocumentation(extensions: PluginExtensionsType | undefined, options?: DocumentationOptions): GeneratedDocumentation;
|
|
29
|
+
/**
|
|
30
|
+
* Generate documentation header with metadata
|
|
31
|
+
*/
|
|
32
|
+
private static generateHeader;
|
|
33
|
+
/**
|
|
34
|
+
* Generate table of contents
|
|
35
|
+
*/
|
|
36
|
+
private static generateTableOfContents;
|
|
37
|
+
/**
|
|
38
|
+
* Generate overview section with health statistics
|
|
39
|
+
*/
|
|
40
|
+
private static generateOverviewSection;
|
|
41
|
+
/**
|
|
42
|
+
* Generate documentation section for a single extension point
|
|
43
|
+
*/
|
|
44
|
+
private static generateExtensionPointSection;
|
|
45
|
+
/**
|
|
46
|
+
* Generate usage examples for an extension point
|
|
47
|
+
*/
|
|
48
|
+
static generateUsageExamples(extensionPoint: ExtensionPointInfo): string;
|
|
49
|
+
/**
|
|
50
|
+
* Generate plugin list with health information
|
|
51
|
+
*/
|
|
52
|
+
private static generatePluginList;
|
|
53
|
+
/**
|
|
54
|
+
* Generate schema fields documentation
|
|
55
|
+
*/
|
|
56
|
+
private static generateSchemaFieldsSection;
|
|
57
|
+
/**
|
|
58
|
+
* Generate contribution structure documentation
|
|
59
|
+
*/
|
|
60
|
+
private static generateContributionStructure;
|
|
61
|
+
/**
|
|
62
|
+
* Generate TypeScript definitions section
|
|
63
|
+
*/
|
|
64
|
+
private static generateTypeDefinitionsSection;
|
|
65
|
+
/**
|
|
66
|
+
* Generate contribution guide
|
|
67
|
+
*/
|
|
68
|
+
private static generateContributionGuide;
|
|
69
|
+
/**
|
|
70
|
+
* Generate troubleshooting section
|
|
71
|
+
*/
|
|
72
|
+
private static generateTroubleshootingSection;
|
|
73
|
+
private static getExtensionPointImportName;
|
|
74
|
+
private static getExtensionPointTypeName;
|
|
75
|
+
private static getHealthEmoji;
|
|
76
|
+
private static inferContributionKey;
|
|
77
|
+
private static isViewBasedExtensionPoint;
|
|
78
|
+
private static isRankableExtensionPoint;
|
|
79
|
+
/**
|
|
80
|
+
* Get schema fields for contribution structure generation
|
|
81
|
+
*/
|
|
82
|
+
private static getSchemaFieldsForContribution;
|
|
83
|
+
private static getSpecificFields;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=documentation-generator.d.ts.map
|