@kosdev-code/kos-ui-plugin 2.1.10 → 2.1.11
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-DZ1-wZzF.js → documentation-generator-auruIa_o.js} +59 -48
- package/documentation-generator-auruIa_o.js.map +1 -0
- package/index.cjs +54 -54
- package/index.cjs.map +1 -1
- package/index.js +422 -402
- package/index.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/use-extension-i18n.d.ts +63 -0
- package/lib/hooks/use-extension-i18n.d.ts.map +1 -0
- package/lib/hooks/use-typed-extensions.d.ts +21 -21
- package/lib/hooks/use-typed-extensions.d.ts.map +1 -1
- package/lib/utils/extension-points/define-extension-point.d.ts +3 -3
- package/lib/utils/extension-points/define-extension-point.d.ts.map +1 -1
- package/lib/utils/extension-points/extension-point-registry.d.ts +25 -0
- package/lib/utils/extension-points/extension-point-registry.d.ts.map +1 -1
- package/lib/utils/plugin-system/plugin-extension-manager.d.ts +1 -1
- package/lib/utils/plugin-system/plugin-extension-manager.d.ts.map +1 -1
- package/package.json +2 -2
- package/types/plugins.d.ts +6 -7
- package/utils.cjs +1 -1
- package/utils.js +13 -12
- package/documentation-generator-CLTfyjgo.cjs +0 -266
- package/documentation-generator-CLTfyjgo.cjs.map +0 -1
- package/documentation-generator-DZ1-wZzF.js.map +0 -1
package/lib/hooks/index.d.ts
CHANGED
package/lib/hooks/index.d.ts.map
CHANGED
|
@@ -1 +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"}
|
|
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,63 @@
|
|
|
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
|
+
* Result from useExtensionI18n hook
|
|
7
|
+
*/
|
|
8
|
+
export interface UseExtensionI18nResult<TData = unknown, TProps = unknown> {
|
|
9
|
+
/** All extensions for this extension point */
|
|
10
|
+
extensions: PluginExtension<TData>[];
|
|
11
|
+
/** Translation function configured with all unique namespaces from extensions */
|
|
12
|
+
t: ReturnType<typeof useKosTranslation>["t"];
|
|
13
|
+
/** i18n utilities (e.g., exists check) */
|
|
14
|
+
i18n: ReturnType<typeof useKosTranslation>["i18n"];
|
|
15
|
+
/** Component that can render extensions of this type - requires module prop to specify which extension to render */
|
|
16
|
+
Component: React.ComponentType<ExtensionComponentProps & TProps> | null;
|
|
17
|
+
/** Unique namespaces extracted from extensions */
|
|
18
|
+
namespaces: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Hook to simplify the common pattern of:
|
|
22
|
+
* 1. Getting extensions for an extension point
|
|
23
|
+
* 2. Extracting their namespaces
|
|
24
|
+
* 3. Configuring i18n with those namespaces
|
|
25
|
+
* 4. Getting the extension component
|
|
26
|
+
*
|
|
27
|
+
* **For type safety:** Pass the inferred type from the schema as a generic parameter.
|
|
28
|
+
* Use `getExtensionPointSchema()` to retrieve the Zod schema and infer the type in a types file.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Step 1: Create a types file with inferred types (do this once)
|
|
33
|
+
* // src/types/nav-link-types.ts
|
|
34
|
+
* import { getExtensionPointSchema } from '@kosdev-code/kos-ui-plugin';
|
|
35
|
+
* import { z } from 'zod';
|
|
36
|
+
*
|
|
37
|
+
* const NavLinkSchema = getExtensionPointSchema('app.navigation.link');
|
|
38
|
+
* export type NavLinkData = z.infer<typeof NavLinkSchema>;
|
|
39
|
+
*
|
|
40
|
+
* // Step 2: Use the type with the hook
|
|
41
|
+
* import { NavLinkData } from '../types/nav-link-types';
|
|
42
|
+
*
|
|
43
|
+
* const { extensions, t, Component } = useExtensionI18n<NavLinkData, NavLinkProps>(
|
|
44
|
+
* EXTENSION_ID_NAV_LINK
|
|
45
|
+
* );
|
|
46
|
+
*
|
|
47
|
+
* // Now extensions is properly typed as PluginExtension<NavLinkData>[]
|
|
48
|
+
* const navLinks = extensions.map(link => ({
|
|
49
|
+
* title: t(`${link.data.namespace}:${link.data.title}`),
|
|
50
|
+
* viewKey: link.data.viewKey, // TypeScript knows this exists!
|
|
51
|
+
* icon: <Component module={link.id} navKey={link.data.viewKey} /> // module is required, navKey is from TProps
|
|
52
|
+
* }));
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param extensionPointId - The extension point identifier
|
|
56
|
+
* @param options - Optional configuration
|
|
57
|
+
* @returns Object containing extensions, translation function, component, and namespaces
|
|
58
|
+
*/
|
|
59
|
+
export declare function useExtensionI18n<TData = unknown, TProps = unknown>(extensionPointId: string, options?: {
|
|
60
|
+
/** Property name in extension.data where namespace is stored (default: 'namespace') */
|
|
61
|
+
namespaceProperty?: string;
|
|
62
|
+
}): UseExtensionI18nResult<TData, TProps>;
|
|
63
|
+
//# 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,sBAAsB,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO;IACvE,8CAA8C;IAC9C,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IACrC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;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"}
|
|
@@ -30,10 +30,10 @@ export interface BestExtensionCriteria {
|
|
|
30
30
|
* // Type: PluginExtension[]
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export declare function useExtensions<TData =
|
|
33
|
+
export declare function useExtensions<TData = unknown, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>): (BasePluginExtension<TProcessed> & {
|
|
34
34
|
data: TProcessed;
|
|
35
35
|
})[];
|
|
36
|
-
export declare function useExtensions(extensionPointId: string): PluginExtension[];
|
|
36
|
+
export declare function useExtensions<TData = unknown>(extensionPointId: string): PluginExtension<TData>[];
|
|
37
37
|
/**
|
|
38
38
|
* Hook to get the best extension for a specific extension point with type safety
|
|
39
39
|
*
|
|
@@ -53,10 +53,10 @@ export declare function useExtensions(extensionPointId: string): PluginExtension
|
|
|
53
53
|
* });
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
export declare function useBest<TData =
|
|
56
|
+
export declare function useBest<TData = unknown, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>, criteria?: BestExtensionCriteria): (BasePluginExtension<TProcessed> & {
|
|
57
57
|
data: TProcessed;
|
|
58
58
|
}) | null;
|
|
59
|
-
export declare function useBest(extensionPointId: string, criteria?: BestExtensionCriteria): PluginExtension | null;
|
|
59
|
+
export declare function useBest<TData = unknown>(extensionPointId: string, criteria?: BestExtensionCriteria): PluginExtension<TData> | null;
|
|
60
60
|
/**
|
|
61
61
|
* Hook to check if any extensions are available for an extension point
|
|
62
62
|
*
|
|
@@ -89,22 +89,22 @@ export declare function useExtensionCount(extensionPointId: string): number;
|
|
|
89
89
|
* });
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
|
-
export declare function useFilteredExtensions<TData =
|
|
93
|
-
filter: (extension: BasePluginExtension & {
|
|
92
|
+
export declare function useFilteredExtensions<TData = unknown, TProcessed = TData>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>, options: {
|
|
93
|
+
filter: (extension: BasePluginExtension<TProcessed> & {
|
|
94
94
|
data: TProcessed;
|
|
95
95
|
}) => boolean;
|
|
96
|
-
sort?: (a: BasePluginExtension & {
|
|
96
|
+
sort?: (a: BasePluginExtension<TProcessed> & {
|
|
97
97
|
data: TProcessed;
|
|
98
|
-
}, b: BasePluginExtension & {
|
|
98
|
+
}, b: BasePluginExtension<TProcessed> & {
|
|
99
99
|
data: TProcessed;
|
|
100
100
|
}) => number;
|
|
101
|
-
}): (BasePluginExtension & {
|
|
101
|
+
}): (BasePluginExtension<TProcessed> & {
|
|
102
102
|
data: TProcessed;
|
|
103
103
|
})[];
|
|
104
|
-
export declare function useFilteredExtensions(extensionPointId: string, options: {
|
|
105
|
-
filter: (extension: PluginExtension) => boolean;
|
|
106
|
-
sort?: (a: PluginExtension
|
|
107
|
-
}): PluginExtension[];
|
|
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
108
|
/**
|
|
109
109
|
* Hook to load raw modules (non-React components) from extensions
|
|
110
110
|
* Useful for accessing utility functions, services, configurations, or other non-UI modules
|
|
@@ -127,25 +127,25 @@ export declare function useFilteredExtensions(extensionPointId: string, options:
|
|
|
127
127
|
* });
|
|
128
128
|
* ```
|
|
129
129
|
*/
|
|
130
|
-
export declare function useModules<TData =
|
|
131
|
-
filter?: (extension: BasePluginExtension & {
|
|
130
|
+
export declare function useModules<TData = unknown, TProcessed = TData, TModule = unknown>(extensionPoint: ExtensionPointDefinition<TData, TProcessed>, options?: {
|
|
131
|
+
filter?: (extension: BasePluginExtension<TProcessed> & {
|
|
132
132
|
data: TProcessed;
|
|
133
133
|
}) => boolean;
|
|
134
134
|
moduleProperty?: string;
|
|
135
135
|
}): Array<{
|
|
136
|
-
extension: BasePluginExtension & {
|
|
136
|
+
extension: BasePluginExtension<TProcessed> & {
|
|
137
137
|
data: TProcessed;
|
|
138
138
|
};
|
|
139
|
-
module:
|
|
139
|
+
module: TModule | null;
|
|
140
140
|
loading: boolean;
|
|
141
141
|
error: string | null;
|
|
142
142
|
}>;
|
|
143
|
-
export declare function useModules(extensionPointId: string, options?: {
|
|
144
|
-
filter?: (extension: PluginExtension) => boolean;
|
|
143
|
+
export declare function useModules<TData = unknown, TModule = unknown>(extensionPointId: string, options?: {
|
|
144
|
+
filter?: (extension: PluginExtension<TData>) => boolean;
|
|
145
145
|
moduleProperty?: string;
|
|
146
146
|
}): Array<{
|
|
147
|
-
extension: PluginExtension
|
|
148
|
-
module:
|
|
147
|
+
extension: PluginExtension<TData>;
|
|
148
|
+
module: TModule | null;
|
|
149
149
|
loading: boolean;
|
|
150
150
|
error: string | null;
|
|
151
151
|
}>;
|
|
@@ -1 +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":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGzD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,iCAAiC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtC,8BAA8B;IAC9B,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,eAAe,GAAG,IAAI,CAAC;CAC1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAG,
|
|
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":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGzD;;GAEG;AAC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,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;AAoC5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CACxB,KAAK,GAAG,OAAO,EACf,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,OAAO,EAEjB,cAAc,EAAE,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC3D,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,CACP,SAAS,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,KAC9D,OAAO,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,KAAK,CAAC;IACP,SAAS,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;IAClE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC,CAAC;AAEH,wBAAgB,UAAU,CAAC,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAC3D,gBAAgB,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE;IACR,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,KAAK,CAAC;IACP,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExtensionPointConfig, ExtensionPointDefinition, ViewExtensionPointDefinition } from './extension-point-types';
|
|
2
2
|
|
|
3
|
-
export type {
|
|
4
|
-
export {
|
|
3
|
+
export type { ExtensionComponentProps, ExtensionPointConfig, ExtensionPointDefinition, SchemaFieldInfo, TransformContext, ValidationContext, ViewExtensionPointDefinition, } from './extension-point-types';
|
|
4
|
+
export { getExtensionPointRegistry, getExtensionPointSchema, registry, } from './extension-point-registry';
|
|
5
5
|
export { createViewAwareTransform } from './extension-point-transforms';
|
|
6
|
-
export {
|
|
6
|
+
export { extensionPointId } from './extension-point-types';
|
|
7
7
|
export { getValidationResults } from './extension-point-validation';
|
|
8
8
|
/**
|
|
9
9
|
* Define a new extension point with simplified API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-extension-point.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/define-extension-point.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"define-extension-point.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/define-extension-point.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,QAAQ,GACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,wBAAgB,oBAAoB,CAClC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,MAAM,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAC1E,4BAA4B,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAG3D,wBAAgB,oBAAoB,CAClC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,KAAK,EAClB,MAAM,GAAG,GAAG,EAEZ,MAAM,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GACtD,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -24,6 +24,11 @@ export declare class SimplifiedExtensionPointRegistry {
|
|
|
24
24
|
* Check if an extension point is registered
|
|
25
25
|
*/
|
|
26
26
|
hasExtensionPoint(id: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get the Zod schema for an extension point
|
|
29
|
+
* Returns undefined if the extension point doesn't have a schema
|
|
30
|
+
*/
|
|
31
|
+
getExtensionPointSchema(id: string): any | undefined;
|
|
27
32
|
}
|
|
28
33
|
export declare const registry: SimplifiedExtensionPointRegistry;
|
|
29
34
|
/**
|
|
@@ -31,4 +36,24 @@ export declare const registry: SimplifiedExtensionPointRegistry;
|
|
|
31
36
|
* Useful for discovery tools and documentation generation
|
|
32
37
|
*/
|
|
33
38
|
export declare function getExtensionPointRegistry(): SimplifiedExtensionPointRegistry;
|
|
39
|
+
/**
|
|
40
|
+
* Get the Zod schema for an extension point by ID
|
|
41
|
+
* Useful for inferring TypeScript types from JSON-defined extension points
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* import { getExtensionPointSchema } from '@kosdev-code/kos-ui-plugin';
|
|
46
|
+
* import { z } from 'zod';
|
|
47
|
+
*
|
|
48
|
+
* // Get the schema
|
|
49
|
+
* const schema = getExtensionPointSchema('app.navigation.link');
|
|
50
|
+
*
|
|
51
|
+
* // Infer the TypeScript type
|
|
52
|
+
* type NavLinkData = z.infer<typeof schema>;
|
|
53
|
+
*
|
|
54
|
+
* // Use it with hooks
|
|
55
|
+
* const { extensions, t } = useExtensionI18n<NavLinkData>(EXTENSION_ID_NAV_LINK);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function getExtensionPointSchema(id: string): any | undefined;
|
|
34
59
|
//# sourceMappingURL=extension-point-registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-point-registry.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"extension-point-registry.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAMjC;;;GAGG;AACH,qBAAa,gCAAgC;IAC3C,OAAO,CAAC,eAAe,CAAoD;IAE3E,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,KAAK,EAAE,MAAM,GAAG,GAAG,EAClD,MAAM,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,GACtD,wBAAwB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC;IAiDtD,OAAO,CAAC,aAAa;IAgKrB;;OAEG;IACH,qBAAqB,IAAI,wBAAwB,EAAE;IAMnD;;OAEG;IACH,4BAA4B,IAAI,wBAAwB,EAAE;IAI1D;;OAEG;IACH,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAInE;;OAEG;IACH,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAItC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS;CAIrD;AAGD,eAAO,MAAM,QAAQ,kCAAyC,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,gCAAgC,CAE5E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAEnE"}
|
|
@@ -10,6 +10,6 @@ interface PluginsType {
|
|
|
10
10
|
export declare function initPluginManager(remotesOverride?: DynamicRemotes): Promise<PluginsType>;
|
|
11
11
|
export declare function getContributions(remotes?: DynamicRemotes): ProcessedContributions;
|
|
12
12
|
export declare function loadExtensions(remotes?: DynamicRemotes): Promise<PluginExtensionsType>;
|
|
13
|
-
export declare function getExtensions(extensionPointId: string): Promise<PluginExtension
|
|
13
|
+
export declare function getExtensions(extensionPointId: string): Promise<PluginExtension[]>;
|
|
14
14
|
export {};
|
|
15
15
|
//# sourceMappingURL=plugin-extension-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-extension-manager.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-system/plugin-extension-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAOhC,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;AAOD,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,sBAAsB,CAOxB;AAED,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,iCA0E5D;AAED,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"plugin-extension-manager.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/plugin-system/plugin-extension-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAOhC,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;AAOD,wBAAgB,gBAAgB,CAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,sBAAsB,CAOxB;AAED,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE,cAAc,iCA0E5D;AAED,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,8BAG3D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ui-plugin",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"kos": {
|
|
23
23
|
"build": {
|
|
24
|
-
"gitHash": "
|
|
24
|
+
"gitHash": "e8a6dea773acaa706c5bfee1913e758d7bbfc032"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
package/types/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface BasePluginExtension {
|
|
1
|
+
export interface BasePluginExtension<TData = unknown> {
|
|
2
2
|
type: string;
|
|
3
3
|
component?: string;
|
|
4
4
|
remote?: string;
|
|
@@ -9,20 +9,19 @@ export interface BasePluginExtension {
|
|
|
9
9
|
height: string;
|
|
10
10
|
};
|
|
11
11
|
id: string;
|
|
12
|
-
data:
|
|
12
|
+
data: TData;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export interface BaseViewPluginExtension
|
|
15
|
+
export interface BaseViewPluginExtension<TData = unknown>
|
|
16
|
+
extends BasePluginExtension<TData> {
|
|
16
17
|
view: BaseViewContribution;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export type PluginExtension<
|
|
20
|
-
data: any;
|
|
21
|
-
};
|
|
20
|
+
export type PluginExtension<TData = unknown> = BasePluginExtension<TData>;
|
|
22
21
|
|
|
23
22
|
export interface PluginExtensionsType {
|
|
24
23
|
[k: string]: {
|
|
25
|
-
[k: string]: PluginExtension
|
|
24
|
+
[k: string]: PluginExtension<unknown>;
|
|
26
25
|
};
|
|
27
26
|
}
|
|
28
27
|
|
package/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./documentation-generator-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./documentation-generator-DFaIDo0E.cjs");require("zod");function m(n,e,...t){return[n,e,...t].filter(Boolean).join(".")}function V(n){const e=n.match(/^(\d+)\.(\d+)\.\d+(?:-\S+)?$/);if(!e)throw new Error(`Invalid version format: ${n}`);const[t,s,l]=e;return`${s}.${l}.0`}function h(n,e){var c,u;e!=null&&e.sdkVersion&&console.log("sdkVersion",e.sdkVersion),e!=null&&e.ddkVersion&&console.log("ddkVersion",e.ddkVersion);const t=V((e==null?void 0:e.sdkVersion)||"0.2.0"),s=V((e==null?void 0:e.ddkVersion)||"0.2.0");console.log(`Using DDK version: ${s}`),console.log(`Using SDK version: ${t}`);const l=n==null?void 0:n.name;if(!l)throw new Error("KOS Configuration should be added. Project name not found in config");const i=((e==null?void 0:e.pluginPath)||"kos.ui.plugin").split(".").reduce((a,o)=>(console.log(`Accessing key: ${o}`),a&&a[o]?a[o]:void 0),n),g=i==null?void 0:i.id;if(!g)throw new Error("KOS Configuration should be added. Plugin ID not found in config");const d=Object.keys(((c=i==null?void 0:i.contributes)==null?void 0:c.views)||{}).reduce((a,o)=>(i.contributes.views[o].forEach(f=>{a[`./${f.component}`]=f.location}),a),{});return Object.values(((u=i==null?void 0:i.contributes)==null?void 0:u.experiences)||{}).forEach(a=>{d[`./${a.component}`]=a.location}),i!=null&&i.init&&(d["./InitPlugin"]="./src/app/init.ts"),{name:l,exposes:d,library:{type:"var",name:g},additionalShared:[{libraryName:"@kosdev-code/kos-ui-plugin",sharedConfig:{singleton:!0,eager:!1,requiredVersion:`~${s}`}},{libraryName:"react",sharedConfig:{singleton:!0,eager:!1,strictVersion:!0,requiredVersion:"18.2.0"}},{libraryName:"react-dom",sharedConfig:{singleton:!0,eager:!1,strictVersion:!0,requiredVersion:"18.2.0"}},{libraryName:"@kosdev-code/kos-ui-sdk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${t}`}},{libraryName:"@kosdev-code/kos-dispense-sdk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${t}`}},{libraryName:"@kosdev-code/kos-freestyle-sdk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${t}`}},{libraryName:"@kosdev-code/kos-ddk-components",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk-model-components",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk-models",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@kosdev-code/kos-ddk-styles",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:`~${s}`}},{libraryName:"@emotion/styled",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"~11.11.0"}},{libraryName:"@emotion/react",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"~11.11.0"}},{libraryName:"reflect-metadata",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^0.2.2"}},{libraryName:"mobx",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^6.9.0"}},{libraryName:"loglevel",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^1.8.1"}},{libraryName:"robot3",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^0.4.0"}},{libraryName:"mobx-react-lite",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^3.4.3"}},{libraryName:"react-router-dom",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^6.11.2"}},{libraryName:"date-fns",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^2.30.0"}},{libraryName:"@use-gesture/react",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^10.3.0"}},{libraryName:"@react-spring/web",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^9.7.3"}},{libraryName:"react-simple-keyboard",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^3.6.13"}},{libraryName:"expr-eval",sharedConfig:{singleton:!0,eager:!1,strictVersion:!1,requiredVersion:"^2.0.2"}},{libraryName:"zod",sharedConfig:{singleton:!0,eager:!0,strictVersion:!1,requiredVersion:"^3.25.0"}}]}}exports.BaseViewExtensionSchema=r.BaseViewExtensionSchema;exports.DocumentationGenerator=r.DocumentationGenerator;exports.PluginDiscoveryService=r.PluginDiscoveryService;exports.RankableViewExtensionSchema=r.RankableViewExtensionSchema;exports.contributionReducer=r.contributionReducer;exports.createExtensionSchema=r.createExtensionSchema;exports.createViewAwareTransform=r.createViewAwareTransform;exports.defineExtensionPoint=r.defineExtensionPoint;exports.getContributions=r.getContributions;exports.getExtensionPointRegistry=r.getExtensionPointRegistry;exports.getExtensionPointSchema=r.getExtensionPointSchema;exports.getExtensions=r.getExtensions;exports.getValidationResults=r.getValidationResults;exports.initPluginManager=r.initPluginManager;exports.initializeKosPlugins=r.initializeKosPlugins;exports.loadExtensions=r.loadExtensions;exports.registry=r.registry;exports.resolveBestExtension=r.resolveBestExtension;exports.validateDescriptorFormat=r.validateDescriptorFormat;exports.validateRank=r.validateRank;exports.validateRankIfPresent=r.validateRankIfPresent;exports.validateWithSchema=r.validateWithSchema;exports.extensionPointId=m;exports.generatePluginConfiguration=h;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
package/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as v, D as q, P as N, R as $, d as x,
|
|
1
|
+
import { B as v, D as q, P as N, R as $, d as x, q as P, n as w, h as E, e as S, c as D, j as I, f as R, g as K, b as B, a as z, l as A, k as U, r as F, o as G, p as M, s as T, v as W } from "./documentation-generator-auruIa_o.js";
|
|
2
2
|
import "zod";
|
|
3
3
|
function k(i, e, ...n) {
|
|
4
4
|
return [i, e, ...n].filter(Boolean).join(".");
|
|
@@ -280,16 +280,17 @@ export {
|
|
|
280
280
|
y as generatePluginConfiguration,
|
|
281
281
|
S as getContributions,
|
|
282
282
|
D as getExtensionPointRegistry,
|
|
283
|
-
I as
|
|
284
|
-
R as
|
|
285
|
-
K as
|
|
286
|
-
B as
|
|
287
|
-
z as
|
|
288
|
-
A as
|
|
289
|
-
U as
|
|
290
|
-
F as
|
|
291
|
-
G as
|
|
292
|
-
M as
|
|
293
|
-
T as
|
|
283
|
+
I as getExtensionPointSchema,
|
|
284
|
+
R as getExtensions,
|
|
285
|
+
K as getValidationResults,
|
|
286
|
+
B as initPluginManager,
|
|
287
|
+
z as initializeKosPlugins,
|
|
288
|
+
A as loadExtensions,
|
|
289
|
+
U as registry,
|
|
290
|
+
F as resolveBestExtension,
|
|
291
|
+
G as validateDescriptorFormat,
|
|
292
|
+
M as validateRank,
|
|
293
|
+
T as validateRankIfPresent,
|
|
294
|
+
W as validateWithSchema
|
|
294
295
|
};
|
|
295
296
|
//# sourceMappingURL=utils.js.map
|