@kosdev-code/kos-ui-plugin 0.1.0-dev.5101 → 0.1.0-dev.5105

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.
Files changed (47) hide show
  1. package/documentation-generator-CAlVz5vA.cjs +266 -0
  2. package/documentation-generator-CAlVz5vA.cjs.map +1 -0
  3. package/documentation-generator-Di4c9D9P.js +2337 -0
  4. package/documentation-generator-Di4c9D9P.js.map +1 -0
  5. package/index.cjs +69 -69
  6. package/index.cjs.map +1 -1
  7. package/index.d.ts +1 -0
  8. package/index.d.ts.map +1 -1
  9. package/index.js +817 -753
  10. package/index.js.map +1 -1
  11. package/lib/components/dynamic-component/dynamic-component.d.ts +69 -0
  12. package/lib/components/dynamic-component/dynamic-component.d.ts.map +1 -1
  13. package/lib/contexts/index.d.ts +1 -0
  14. package/lib/contexts/index.d.ts.map +1 -1
  15. package/lib/contexts/plugins-provider/plugins-provider.d.ts.map +1 -1
  16. package/lib/contexts/reactive-extension-registry-context.d.ts +10 -0
  17. package/lib/contexts/reactive-extension-registry-context.d.ts.map +1 -0
  18. package/lib/hooks/index.d.ts +4 -2
  19. package/lib/hooks/index.d.ts.map +1 -1
  20. package/lib/hooks/use-dynamic-component.d.ts +12 -1
  21. package/lib/hooks/use-dynamic-component.d.ts.map +1 -1
  22. package/lib/hooks/use-extension-point.d.ts +95 -0
  23. package/lib/hooks/use-extension-point.d.ts.map +1 -0
  24. package/lib/hooks/use-reactive-extension-registry.d.ts +20 -0
  25. package/lib/hooks/use-reactive-extension-registry.d.ts.map +1 -0
  26. package/lib/hooks/use-typed-extensions.d.ts.map +1 -1
  27. package/lib/utils/contribution-registry.d.ts +170 -0
  28. package/lib/utils/contribution-registry.d.ts.map +1 -0
  29. package/lib/utils/extension-points/extension-point-registry.d.ts.map +1 -1
  30. package/lib/utils/extension-points/extension-point-schemas.d.ts +4 -4
  31. package/lib/utils/index.d.ts +3 -0
  32. package/lib/utils/index.d.ts.map +1 -1
  33. package/lib/utils/plugin-system/plugin-extension-manager.d.ts.map +1 -1
  34. package/lib/utils/reactive-extension-registry.d.ts +140 -0
  35. package/lib/utils/reactive-extension-registry.d.ts.map +1 -0
  36. package/package.json +2 -2
  37. package/types/contribution-enablement.d.ts +293 -0
  38. package/types/contribution-enablement.d.ts.map +1 -0
  39. package/types/plugins.d.ts +8 -0
  40. package/utils.cjs +1 -1
  41. package/utils.cjs.map +1 -1
  42. package/utils.js +29 -291
  43. package/utils.js.map +1 -1
  44. package/documentation-generator-D1Yzvcw3.cjs +0 -266
  45. package/documentation-generator-D1Yzvcw3.cjs.map +0 -1
  46. package/documentation-generator-vDywn3tb.js +0 -1634
  47. package/documentation-generator-vDywn3tb.js.map +0 -1
@@ -0,0 +1,140 @@
1
+ import { PluginExtension, PluginExtensionsType } from '../../types/plugins';
2
+
3
+ /**
4
+ * Event emitted when extension point changes
5
+ */
6
+ export interface ExtensionPointChangeEvent {
7
+ extensionPoint: string;
8
+ changeType: "contribution-enabled" | "contribution-disabled" | "best-changed";
9
+ affectedContribution: string;
10
+ newBest?: string;
11
+ timestamp: number;
12
+ }
13
+ /**
14
+ * Reactive extension registry that monitors contribution state
15
+ *
16
+ * Bridges the gap between ContributionRegistry (state management) and
17
+ * React components by providing filtered extension lists and change notifications.
18
+ *
19
+ * This registry:
20
+ * - Filters extensions based on enabled state
21
+ * - Subscribes to ContributionRegistry for state changes
22
+ * - Emits ExtensionPointChangeEvent when contributions change
23
+ * - Manages extension point-scoped subscriptions
24
+ * - Handles cleanup to prevent memory leaks
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const registry = new ReactiveExtensionRegistry(extensions);
29
+ *
30
+ * // Get only enabled extensions
31
+ * const enabledExtensions = registry.getExtensions('ddk.settings.view');
32
+ *
33
+ * // Subscribe to changes
34
+ * const unsubscribe = registry.subscribe('ddk.settings.view', (event) => {
35
+ * console.log('Extension point changed:', event);
36
+ * });
37
+ *
38
+ * // Cleanup when done
39
+ * registry.destroy();
40
+ * ```
41
+ */
42
+ export declare class ReactiveExtensionRegistry {
43
+ /**
44
+ * Reference to all plugin extensions (unfiltered)
45
+ */
46
+ private extensions;
47
+ /**
48
+ * Map of extension point to listeners
49
+ * Each extension point can have multiple components listening for changes
50
+ */
51
+ private listeners;
52
+ /**
53
+ * Unsubscribe function for ContributionRegistry subscription
54
+ * Used during cleanup to remove listener
55
+ */
56
+ private contributionUnsubscribe;
57
+ constructor(extensions: PluginExtensionsType);
58
+ /**
59
+ * Get extensions for an extension point (filtered by enabled state)
60
+ *
61
+ * By default, only returns enabled contributions. Use `includeDisabled: true`
62
+ * to get all contributions regardless of state.
63
+ *
64
+ * @param extensionPoint - Extension point identifier
65
+ * @param includeDisabled - If true, include disabled contributions (default: false)
66
+ * @returns Record of extension ID to extension object
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * // Get only enabled settings extensions
71
+ * const enabled = registry.getExtensions('ddk.settings.view');
72
+ *
73
+ * // Get all settings extensions (including disabled)
74
+ * const all = registry.getExtensions('ddk.settings.view', true);
75
+ * ```
76
+ */
77
+ getExtensions(extensionPoint: string, includeDisabled?: boolean): Record<string, PluginExtension>;
78
+ /**
79
+ * Subscribe to changes for a specific extension point
80
+ *
81
+ * Registers a listener that will be called whenever contributions for
82
+ * the specified extension point change state (enabled/disabled) or when
83
+ * the best contribution for that point changes.
84
+ *
85
+ * @param extensionPoint - Extension point identifier to monitor
86
+ * @param listener - Callback function to handle change events
87
+ * @returns Unsubscribe function to stop receiving events
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const unsubscribe = registry.subscribe('ddk.settings.view', (event) => {
92
+ * if (event.changeType === 'best-changed') {
93
+ * console.log('New best contribution:', event.newBest);
94
+ * }
95
+ * });
96
+ *
97
+ * // Later...
98
+ * unsubscribe();
99
+ * ```
100
+ */
101
+ subscribe(extensionPoint: string, listener: (event: ExtensionPointChangeEvent) => void): () => void;
102
+ /**
103
+ * Internal: Subscribe to contribution state changes
104
+ *
105
+ * Sets up subscription to ContributionRegistry to receive notifications
106
+ * when any contribution's enabled state changes. Routes these events to
107
+ * extension point-specific listeners.
108
+ *
109
+ * @private
110
+ */
111
+ private subscribeToContributionChanges;
112
+ /**
113
+ * Internal: Handle contribution state change
114
+ *
115
+ * Called when ContributionRegistry emits a state change event.
116
+ * Determines if the "best" contribution has changed and emits
117
+ * ExtensionPointChangeEvent to all listeners for that extension point.
118
+ *
119
+ * @param event - Contribution state change event from ContributionRegistry
120
+ * @private
121
+ */
122
+ private handleContributionChange;
123
+ /**
124
+ * Cleanup subscriptions and listeners
125
+ *
126
+ * Call this when the registry is no longer needed to prevent memory leaks.
127
+ * Typically called when the PluginsProvider is unmounted.
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * useEffect(() => {
132
+ * const registry = new ReactiveExtensionRegistry(extensions);
133
+ * // Use registry...
134
+ * return () => registry.destroy();
135
+ * }, []);
136
+ * ```
137
+ */
138
+ destroy(): void;
139
+ }
140
+ //# sourceMappingURL=reactive-extension-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactive-extension-registry.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-plugin/src/lib/utils/reactive-extension-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,sBAAsB,GAAG,uBAAuB,GAAG,cAAc,CAAC;IAC9E,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,yBAAyB;IACpC;;OAEG;IACH,OAAO,CAAC,UAAU,CAAuB;IAEzC;;;OAGG;IACH,OAAO,CAAC,SAAS,CAGf;IAEF;;;OAGG;IACH,OAAO,CAAC,uBAAuB,CAA6B;gBAEhD,UAAU,EAAE,oBAAoB;IAM5C;;;;;;;;;;;;;;;;;;OAkBG;IACH,aAAa,CACX,cAAc,EAAE,MAAM,EACtB,eAAe,UAAQ,GACtB,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAgBlC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,CACP,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,GACnD,MAAM,IAAI;IAuBb;;;;;;;;OAQG;IACH,OAAO,CAAC,8BAA8B;IAMtC;;;;;;;;;OASG;IACH,OAAO,CAAC,wBAAwB;IA6ChC;;;;;;;;;;;;;;OAcG;IACH,OAAO,IAAI,IAAI;CAQhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-ui-plugin",
3
- "version": "0.1.0-dev.5101",
3
+ "version": "0.1.0-dev.5105",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "kos": {
23
23
  "build": {
24
- "gitHash": "96dbc64113639eae888fbbd86d1258fbd6a9795f"
24
+ "gitHash": "3cb1fbf425504408f84cd704914a2f328bbb8fab"
25
25
  }
26
26
  },
27
27
  "publishConfig": {
@@ -0,0 +1,293 @@
1
+ import { BaseContribution, PluginExtensionsType, ProcessedContributions } from './plugins';
2
+
3
+ /**
4
+ * Enhanced contribution interface with runtime enablement state
5
+ *
6
+ * Extends BaseContribution with fields that enable dynamic runtime control
7
+ * over contribution visibility and availability. This allows plugins to
8
+ * respond to events (feature flags, device state, etc.) and update which
9
+ * contributions are visible to the plugin system.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const contribution: DynamicContribution = {
14
+ * id: 'advanced-settings',
15
+ * remote: 'settingsPlugin',
16
+ * sectionId: 'settings',
17
+ * enabled: true,
18
+ * enabledCondition: (context) => {
19
+ * return context.context?.userRole === 'admin';
20
+ * }
21
+ * };
22
+ * ```
23
+ */
24
+ export interface DynamicContribution extends BaseContribution {
25
+ /**
26
+ * Whether this contribution is currently enabled
27
+ *
28
+ * When false, the contribution will be filtered out by resolveBestExtension
29
+ * and will not be visible to DynamicComponent or other plugin consumers.
30
+ *
31
+ * @default true
32
+ */
33
+ enabled: boolean;
34
+ /**
35
+ * Optional reason for disabled state
36
+ *
37
+ * Useful for debugging, logging, and displaying to users why a contribution
38
+ * is unavailable. Should be a human-readable string.
39
+ *
40
+ * @example "Feature flag 'advanced-mode' is disabled"
41
+ * @example "User lacks premium license"
42
+ * @example "Device mode: basic"
43
+ */
44
+ disabledReason?: string;
45
+ /**
46
+ * Optional timestamp when enabled state last changed
47
+ *
48
+ * Unix timestamp (milliseconds) of the last state transition.
49
+ * Useful for debugging, auditing, and temporal queries.
50
+ *
51
+ * @example Date.now() // 1705780800000
52
+ */
53
+ lastStateChange?: number;
54
+ /**
55
+ * Optional conditional enablement function
56
+ *
57
+ * Evaluated when contribution is accessed via isEnabled().
58
+ * Allows for dynamic enablement based on runtime context.
59
+ *
60
+ * If provided, this function is called in addition to checking the
61
+ * `enabled` boolean field. Both must be true for the contribution
62
+ * to be considered enabled.
63
+ *
64
+ * @param context - Current runtime context including extensions, contributions, and custom data
65
+ * @returns true if contribution should be enabled, false otherwise
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * enabledCondition: (context) => {
70
+ * const licenseModel = context.context?.licenseModel;
71
+ * return licenseModel?.hasPremiumLicense === true;
72
+ * }
73
+ * ```
74
+ */
75
+ enabledCondition?: (context: EnablementContext) => boolean;
76
+ }
77
+ /**
78
+ * Context provided to enablement condition functions
79
+ *
80
+ * Provides runtime information that enablement conditions can use to
81
+ * determine whether a contribution should be enabled. This includes
82
+ * the current plugin system state and custom application data.
83
+ */
84
+ export interface EnablementContext {
85
+ /**
86
+ * Current extensions state
87
+ *
88
+ * The full PluginExtensionsType object representing all registered
89
+ * extension points and their contributions.
90
+ */
91
+ extensions: PluginExtensionsType;
92
+ /**
93
+ * Current contributions state
94
+ *
95
+ * Processed contributions including experiences and other contribution types.
96
+ */
97
+ contributions: ProcessedContributions;
98
+ /**
99
+ * Custom context data
100
+ *
101
+ * Application-specific context that can be used in enablement conditions.
102
+ * For example, user model, license model, device state, etc.
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * {
107
+ * userModel: { role: 'admin', id: '123' },
108
+ * licenseModel: { hasPremiumLicense: true },
109
+ * deviceState: { mode: 'advanced' }
110
+ * }
111
+ * ```
112
+ */
113
+ context?: Record<string, any>;
114
+ }
115
+ /**
116
+ * Event emitted when a contribution's enabled state changes
117
+ *
118
+ * This event is emitted by ContributionRegistry whenever setEnabled()
119
+ * or batchUpdate() changes a contribution's state. Listeners can subscribe
120
+ * to these events to react to enablement changes.
121
+ */
122
+ export interface ContributionStateChangeEvent {
123
+ /**
124
+ * Unique identifier of the contribution that changed
125
+ */
126
+ contributionId: string;
127
+ /**
128
+ * Extension point this contribution belongs to
129
+ *
130
+ * @example "ddk.features"
131
+ * @example "ddk.settings.view"
132
+ */
133
+ extensionPoint: string;
134
+ /**
135
+ * New enabled state (true = enabled, false = disabled)
136
+ */
137
+ enabled: boolean;
138
+ /**
139
+ * Previous enabled state before this change
140
+ */
141
+ previousState: boolean;
142
+ /**
143
+ * Optional reason for the state change
144
+ *
145
+ * @example "Feature flag 'advanced-mode' changed to enabled"
146
+ * @example "App unloaded"
147
+ */
148
+ reason?: string;
149
+ /**
150
+ * Unix timestamp (milliseconds) when this change occurred
151
+ */
152
+ timestamp: number;
153
+ }
154
+ /**
155
+ * Centralized contribution enablement registry interface
156
+ *
157
+ * The ContributionRegistry manages the enabled/disabled state of all
158
+ * contributions in the plugin system. It provides methods to:
159
+ * - Update contribution state
160
+ * - Query contribution state
161
+ * - Subscribe to state changes
162
+ * - Perform batch atomic updates
163
+ *
164
+ * This is the primary API for implementing dynamic contribution enablement.
165
+ */
166
+ export interface IContributionRegistry {
167
+ /**
168
+ * Set enabled state for a contribution
169
+ *
170
+ * Updates the contribution's enabled state and emits a
171
+ * ContributionStateChangeEvent to all subscribers.
172
+ *
173
+ * @param contributionId - Unique identifier of the contribution
174
+ * @param enabled - New enabled state (true = enabled, false = disabled)
175
+ * @param reason - Optional human-readable reason for the change
176
+ *
177
+ * @throws Error if contribution does not exist
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * ContributionRegistry.setEnabled(
182
+ * 'advanced-settings',
183
+ * false,
184
+ * 'Device mode changed to basic'
185
+ * );
186
+ * ```
187
+ */
188
+ setEnabled(contributionId: string, enabled: boolean, reason?: string): void;
189
+ /**
190
+ * Get enabled state for a contribution
191
+ *
192
+ * Checks both the enabled boolean field and evaluates any
193
+ * enabledCondition function if present. Returns true only if
194
+ * both checks pass.
195
+ *
196
+ * @param contributionId - Unique identifier of the contribution
197
+ * @returns true if contribution is enabled, false otherwise
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * if (ContributionRegistry.isEnabled('advanced-settings')) {
202
+ * // Show advanced settings UI
203
+ * }
204
+ * ```
205
+ */
206
+ isEnabled(contributionId: string): boolean;
207
+ /**
208
+ * Subscribe to all contribution state changes
209
+ *
210
+ * Registers a listener that will be called whenever any contribution's
211
+ * enabled state changes. The listener receives a ContributionStateChangeEvent.
212
+ *
213
+ * @param listener - Callback function to handle state change events
214
+ * @returns Unsubscribe function to stop receiving events
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const unsubscribe = ContributionRegistry.subscribe((event) => {
219
+ * console.log(`${event.contributionId} ${event.enabled ? 'enabled' : 'disabled'}`);
220
+ * });
221
+ *
222
+ * // Later: stop listening
223
+ * unsubscribe();
224
+ * ```
225
+ */
226
+ subscribe(listener: (event: ContributionStateChangeEvent) => void): () => void;
227
+ /**
228
+ * Subscribe to changes for a specific extension point
229
+ *
230
+ * Like subscribe(), but only emits events for contributions
231
+ * belonging to the specified extension point.
232
+ *
233
+ * @param extensionPoint - Extension point identifier to monitor
234
+ * @param listener - Callback function to handle state change events
235
+ * @returns Unsubscribe function to stop receiving events
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * const unsubscribe = ContributionRegistry.subscribeToExtensionPoint(
240
+ * 'ddk.settings.view',
241
+ * (event) => {
242
+ * console.log(`Settings contribution changed: ${event.contributionId}`);
243
+ * }
244
+ * );
245
+ * ```
246
+ */
247
+ subscribeToExtensionPoint(extensionPoint: string, listener: (event: ContributionStateChangeEvent) => void): () => void;
248
+ /**
249
+ * Batch update multiple contributions atomically
250
+ *
251
+ * Updates multiple contribution states in a single atomic operation.
252
+ * All updates succeed or all fail together. Emits one event per
253
+ * contribution that changed state.
254
+ *
255
+ * @param updates - Array of contribution updates to apply
256
+ *
257
+ * @example
258
+ * ```typescript
259
+ * // Disable all advanced features at once
260
+ * ContributionRegistry.batchUpdate([
261
+ * { contributionId: 'advanced-settings', enabled: false, reason: 'Basic mode' },
262
+ * { contributionId: 'diagnostics', enabled: false, reason: 'Basic mode' },
263
+ * { contributionId: 'dev-tools', enabled: false, reason: 'Basic mode' }
264
+ * ]);
265
+ * ```
266
+ */
267
+ batchUpdate(updates: Array<{
268
+ contributionId: string;
269
+ enabled: boolean;
270
+ reason?: string;
271
+ }>): void;
272
+ /**
273
+ * Get all contributions for an extension point
274
+ *
275
+ * Returns an array of DynamicContribution objects for the specified
276
+ * extension point. By default, only returns enabled contributions.
277
+ *
278
+ * @param extensionPoint - Extension point identifier
279
+ * @param includeDisabled - If true, include disabled contributions in results
280
+ * @returns Array of contributions for the extension point
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * // Get only enabled settings contributions
285
+ * const enabledSettings = ContributionRegistry.getContributions('ddk.settings.view');
286
+ *
287
+ * // Get all settings contributions (including disabled)
288
+ * const allSettings = ContributionRegistry.getContributions('ddk.settings.view', true);
289
+ * ```
290
+ */
291
+ getContributions(extensionPoint: string, includeDisabled?: boolean): DynamicContribution[];
292
+ }
293
+ //# sourceMappingURL=contribution-enablement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contribution-enablement.d.ts","sourceRoot":"","sources":["../../../../../packages/sdk/kos-ui-plugin/src/types/contribution-enablement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D;;;;;;;OAOG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,UAAU,EAAE,oBAAoB,CAAC;IAEjC;;;;OAIG;IACH,aAAa,EAAE,sBAAsB,CAAC;IAEtC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5E;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3C;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CACP,QAAQ,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,GACtD,MAAM,IAAI,CAAC;IAEd;;;;;;;;;;;;;;;;;;;OAmBG;IACH,yBAAyB,CACvB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,4BAA4B,KAAK,IAAI,GACtD,MAAM,IAAI,CAAC;IAEd;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CACT,OAAO,EAAE,KAAK,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,GACD,IAAI,CAAC;IAER;;;;;;;;;;;;;;;;;;OAkBG;IACH,gBAAgB,CACd,cAAc,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE,OAAO,GACxB,mBAAmB,EAAE,CAAC;CAC1B"}
@@ -39,3 +39,11 @@ export type ProcessedContributions = {
39
39
  controlPourDefinitions: Record<string, ProcessedControlPourDefinition>;
40
40
  experiences: Record<string, ProcessedExperience>;
41
41
  };
42
+
43
+ // Export contribution enablement types
44
+ export type {
45
+ ContributionStateChangeEvent,
46
+ DynamicContribution,
47
+ EnablementContext,
48
+ IContributionRegistry,
49
+ } from './contribution-enablement';
package/utils.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./documentation-generator-D1Yzvcw3.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./documentation-generator-CAlVz5vA.cjs");require("zod");function o(i,t,...n){return[i,t,...n].filter(Boolean).join(".")}exports.BaseViewExtensionSchema=e.BaseViewExtensionSchema;exports.ContributionRegistry=e.ContributionRegistry;exports.DocumentationGenerator=e.DocumentationGenerator;exports.PluginDiscoveryService=e.PluginDiscoveryService;exports.RankableViewExtensionSchema=e.RankableViewExtensionSchema;exports.ReactiveExtensionRegistry=e.ReactiveExtensionRegistry;exports.contributionReducer=e.contributionReducer;exports.createExtensionSchema=e.createExtensionSchema;exports.createViewAwareTransform=e.createViewAwareTransform;exports.defineExtensionPoint=e.defineExtensionPoint;exports.generatePluginConfiguration=e.generatePluginConfiguration;exports.getContributions=e.getContributions;exports.getExtensionPointRegistry=e.getExtensionPointRegistry;exports.getExtensionPointSchema=e.getExtensionPointSchema;exports.getExtensions=e.getExtensions;exports.getValidationResults=e.getValidationResults;exports.initPluginManager=e.initPluginManager;exports.initializeKosPlugins=e.initializeKosPlugins;exports.loadExtensions=e.loadExtensions;exports.registry=e.registry;exports.resolveBestExtension=e.resolveBestExtension;exports.validateDescriptorFormat=e.validateDescriptorFormat;exports.validateRank=e.validateRank;exports.validateRankIfPresent=e.validateRankIfPresent;exports.validateWithSchema=e.validateWithSchema;exports.extensionPointId=o;
2
2
  //# sourceMappingURL=utils.cjs.map
package/utils.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-types.ts","../../../../packages/sdk/kos-ui-plugin/src/lib/utils/processors/process-kos-config.ts"],"sourcesContent":["/**\n * Core types and interfaces for extension point system\n */\n\n// React import removed - component creation happens at runtime via hooks\nimport type { z } from \"zod\";\nimport type {\n BasePluginExtension,\n PluginExtensionsType,\n ProcessedContributions,\n} from \"../../../types/plugins\";\n\n/**\n * Validation context for collecting validation issues\n */\nexport interface ValidationContext {\n addError(message: string): void;\n addWarning(message: string): void;\n addInfo(message: string): void;\n hasErrors(): boolean;\n hasIssues(): boolean;\n getIssues(): { type: \"error\" | \"warning\" | \"info\"; message: string }[];\n}\n\n/**\n * Context provided to transform functions\n */\nexport interface TransformContext {\n remote: string;\n sectionId: string;\n experiences?: Record<string, any>;\n contributions: ProcessedContributions;\n}\n\n/**\n * Schema field information for documentation\n */\nexport interface SchemaFieldInfo {\n name: string;\n description?: string;\n type?: string;\n required?: boolean;\n}\n\n/**\n * Configuration for defining a new extension point\n */\nexport interface ExtensionPointConfig<\n TData = any,\n TProcessed = TData,\n _TProps = any\n> {\n /**\n * Unique identifier for this extension point\n * Convention: \"ddk.{feature}\" or \"ddk.{feature}.{sub-feature}\"\n */\n id: string;\n\n /**\n * Optional display name for documentation/discovery\n */\n displayName?: string;\n\n /**\n * Optional description for documentation/discovery\n */\n description?: string;\n\n /**\n * The contribution key in the plugin descriptor\n * e.g., \"myFeature\" maps to contributes.myFeature in kosdev-plugin.json\n */\n contributionKey: string;\n\n /**\n * Optional related extension points\n * For example, a main extension might have .view and .definition variants\n */\n relatedPoints?: {\n view?: string;\n definition?: string;\n [key: string]: string | undefined;\n };\n\n /**\n * Transform function to process raw contribution data\n * Allows custom processing logic while maintaining type safety\n */\n transform?: (data: TData, context: TransformContext) => TProcessed;\n\n /**\n * Optional validation function\n * Use context.addError/addWarning/addInfo to collect validation issues\n * Return \"skip\" to skip processing this contribution\n */\n validate?: (data: TData, context: ValidationContext) => \"skip\" | void;\n\n /**\n * Whether this extension point uses view/experience pattern\n * Default: false\n */\n hasView?: boolean;\n\n /**\n * Whether contributions should be ranked\n * Default: false\n */\n isRankable?: boolean;\n\n /**\n * Optional Zod schema for runtime validation and documentation\n * Provides both type safety and field introspection for Plugin Explorer\n */\n schema?: z.ZodSchema<TData>;\n\n /**\n * Metadata for discovery/documentation\n */\n metadata?: {\n category?: string;\n tags?: string[];\n since?: string;\n deprecated?: boolean;\n replacedBy?: string;\n owner?: string;\n /**\n * The actual export name of this extension point in the code\n * Used for documentation generation to show correct import statements\n */\n exportName?: string;\n };\n}\n\n/**\n * Props for extension point components\n */\nexport interface ExtensionComponentProps {\n /** Specific module to load (optional) */\n module?: string;\n /** Fallback component when extension not found */\n fallback?: React.ReactNode;\n}\n\n/**\n * Result of defining an extension point\n */\nexport interface ExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> {\n /**\n * The extension point configuration\n */\n config: ExtensionPointConfig<TData, TProcessed, TProps>;\n\n /**\n * Extension point ID for use in components\n */\n id: string;\n\n /**\n * Helper to get typed extensions (for future use with hooks)\n */\n getExtensions?: (\n extensions: PluginExtensionsType\n ) => Record<string, BasePluginExtension & { data: TProcessed }>;\n\n /**\n * Registration status\n */\n isRegistered: boolean;\n\n /**\n * Method to register this extension point\n */\n register: () => void;\n\n // Component property removed - use useExtensionComponent hook or createExtensionComponent factory at runtime\n\n /**\n * Get schema field information for documentation purposes\n * Returns field info that can be safely displayed by Plugin Explorer\n */\n getSchemaFieldInfo?: () => SchemaFieldInfo[];\n}\n\n/**\n * Extension point with hasView: true, guarantees Component property\n */\nexport interface ViewExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> extends ExtensionPointDefinition<TData, TProcessed, TProps> {\n Component: React.ComponentType<ExtensionComponentProps & TProps>;\n}\n\n/**\n * Type-safe extension point ID helper\n * Ensures consistent naming and helps with refactoring\n */\nexport function extensionPointId(\n namespace: string,\n feature: string,\n ...subFeatures: string[]\n): string {\n const parts = [namespace, feature, ...subFeatures].filter(Boolean);\n return parts.join(\".\");\n}\n","/* eslint-disable max-lines-per-function */\nimport type { Contributions } from \"../../../types/global\";\n\ninterface KosConfigView {\n id: string;\n title: string;\n component: string;\n location: string;\n}\n\ninterface KosPluginConfig {\n id: string;\n init?: boolean;\n contributes: Contributions;\n}\n\ninterface DDKConfig {\n name: string;\n kosdev: {\n ddk: {\n ncui: {\n plugin: KosPluginConfig;\n };\n };\n };\n}\n\ninterface CoreKosConfig {\n name: string;\n kos: {\n ui: {\n plugin: KosPluginConfig;\n };\n };\n}\n\nexport type KosConfig = DDKConfig | CoreKosConfig;\n\nfunction normalizeVersion(version: string): string {\n const match = version.match(/^(\\d+)\\.(\\d+)\\.\\d+(?:-\\S+)?$/);\n if (!match) {\n throw new Error(`Invalid version format: ${version}`);\n }\n const [_, major, minor] = match;\n return `${major}.${minor}.0`;\n}\n\nexport interface PluginOptions {\n sdkVersion?: string;\n ddkVersion?: string;\n pluginPath?: string;\n}\nexport function generatePluginConfiguration(\n config: KosConfig,\n options?: PluginOptions\n): any {\n if (options?.sdkVersion) {\n console.log(\"sdkVersion\", options.sdkVersion);\n }\n if (options?.ddkVersion) {\n console.log(\"ddkVersion\", options.ddkVersion);\n }\n const sdkVersion = normalizeVersion(options?.sdkVersion || \"0.2.0\");\n const ddkVersion = normalizeVersion(options?.ddkVersion || \"0.2.0\");\n\n console.log(`Using DDK version: ${ddkVersion}`);\n console.log(`Using SDK version: ${sdkVersion}`);\n const projectId = config?.name;\n if (!projectId) {\n throw new Error(\n \"KOS Configuration should be added. Project name not found in config\"\n );\n }\n const pluginPath = options?.pluginPath || \"kos.ui.plugin\";\n const pluginObj = pluginPath\n .split(\".\")\n .reduce<KosPluginConfig>((obj, key) => {\n console.log(`Accessing key: ${key}`);\n return obj && obj[key] ? obj[key] : undefined;\n }, config as unknown as KosPluginConfig);\n\n const pluginId = pluginObj?.id;\n if (!pluginId) {\n throw new Error(\n \"KOS Configuration should be added. Plugin ID not found in config\"\n );\n }\n const mfConfig = Object.keys(pluginObj?.contributes?.views || {}).reduce(\n (acc, key) => {\n const views = pluginObj.contributes.views[key];\n\n views.forEach((view) => {\n acc[`./${view.component}`] = view.location;\n });\n return acc;\n },\n {}\n );\n\n Object.values(pluginObj?.contributes?.experiences || {}).forEach(\n (experience) => {\n mfConfig[`./${experience.component}`] = experience.location;\n }\n );\n\n if (pluginObj?.init) {\n mfConfig[\"./InitPlugin\"] = \"./src/app/init.ts\";\n }\n\n return {\n name: projectId,\n exposes: mfConfig,\n library: { type: \"var\", name: pluginId },\n additionalShared: [\n {\n libraryName: \"@kosdev-code/kos-ui-plugin\",\n sharedConfig: {\n singleton: true,\n eager: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: true,\n requiredVersion: \"18.2.0\",\n },\n },\n\n {\n libraryName: \"react-dom\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: true,\n requiredVersion: \"18.2.0\",\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ui-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-dispense-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n\n {\n libraryName: \"@kosdev-code/kos-freestyle-sdk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${sdkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-components\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-model-components\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-models\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@kosdev-code/kos-ddk-styles\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: `~${ddkVersion}`,\n },\n },\n {\n libraryName: \"@emotion/styled\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"~11.11.0\",\n },\n },\n {\n libraryName: \"@emotion/react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"~11.11.0\",\n },\n },\n {\n libraryName: \"reflect-metadata\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^0.2.2\",\n },\n },\n {\n libraryName: \"mobx\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^6.9.0\",\n },\n },\n\n {\n libraryName: \"loglevel\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^1.8.1\",\n },\n },\n {\n libraryName: \"robot3\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^0.4.0\",\n },\n },\n {\n libraryName: \"mobx-react-lite\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^3.4.3\",\n },\n },\n {\n libraryName: \"react-router-dom\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^6.11.2\",\n },\n },\n {\n libraryName: \"date-fns\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^2.30.0\",\n },\n },\n {\n libraryName: \"@use-gesture/react\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^10.3.0\",\n },\n },\n {\n libraryName: \"@react-spring/web\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^9.7.3\",\n },\n },\n {\n libraryName: \"react-simple-keyboard\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^3.6.13\",\n },\n },\n {\n libraryName: \"expr-eval\",\n sharedConfig: {\n singleton: true,\n eager: false,\n strictVersion: false,\n requiredVersion: \"^2.0.2\",\n },\n },\n {\n libraryName: \"zod\",\n sharedConfig: {\n singleton: true,\n eager: true,\n strictVersion: false,\n requiredVersion: \"^3.25.0\",\n },\n },\n ],\n };\n}\n"],"names":["extensionPointId","namespace","feature","subFeatures","normalizeVersion","version","match","_","major","minor","generatePluginConfiguration","config","options","sdkVersion","ddkVersion","projectId","pluginObj","obj","key","pluginId","mfConfig","_a","acc","view","_b","experience"],"mappings":"yJA0MO,SAASA,EACdC,EACAC,KACGC,EACK,CAER,MADc,CAACF,EAAWC,EAAS,GAAGC,CAAW,EAAE,OAAO,OAAO,EACpD,KAAK,GAAG,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W,GACX,MAAO,GACP,cAAe,GACf,gBAAiB,QAAA,CACnB,EAEF,CACE,YAAa,MACb,aAAc,CACZ,UAAW,GACX,MAAO,GACP,cAAe,GACf,gBAAiB,SAAA,CACnB,CACF,CACF,CAEJ"}
1
+ {"version":3,"file":"utils.cjs","sources":["../../../../packages/sdk/kos-ui-plugin/src/lib/utils/extension-points/extension-point-types.ts"],"sourcesContent":["/**\n * Core types and interfaces for extension point system\n */\n\n// React import removed - component creation happens at runtime via hooks\nimport type { z } from \"zod\";\nimport type {\n BasePluginExtension,\n PluginExtensionsType,\n ProcessedContributions,\n} from \"../../../types/plugins\";\n\n/**\n * Validation context for collecting validation issues\n */\nexport interface ValidationContext {\n addError(message: string): void;\n addWarning(message: string): void;\n addInfo(message: string): void;\n hasErrors(): boolean;\n hasIssues(): boolean;\n getIssues(): { type: \"error\" | \"warning\" | \"info\"; message: string }[];\n}\n\n/**\n * Context provided to transform functions\n */\nexport interface TransformContext {\n remote: string;\n sectionId: string;\n experiences?: Record<string, any>;\n contributions: ProcessedContributions;\n}\n\n/**\n * Schema field information for documentation\n */\nexport interface SchemaFieldInfo {\n name: string;\n description?: string;\n type?: string;\n required?: boolean;\n}\n\n/**\n * Configuration for defining a new extension point\n */\nexport interface ExtensionPointConfig<\n TData = any,\n TProcessed = TData,\n _TProps = any\n> {\n /**\n * Unique identifier for this extension point\n * Convention: \"ddk.{feature}\" or \"ddk.{feature}.{sub-feature}\"\n */\n id: string;\n\n /**\n * Optional display name for documentation/discovery\n */\n displayName?: string;\n\n /**\n * Optional description for documentation/discovery\n */\n description?: string;\n\n /**\n * The contribution key in the plugin descriptor\n * e.g., \"myFeature\" maps to contributes.myFeature in kosdev-plugin.json\n */\n contributionKey: string;\n\n /**\n * Optional related extension points\n * For example, a main extension might have .view and .definition variants\n */\n relatedPoints?: {\n view?: string;\n definition?: string;\n [key: string]: string | undefined;\n };\n\n /**\n * Transform function to process raw contribution data\n * Allows custom processing logic while maintaining type safety\n */\n transform?: (data: TData, context: TransformContext) => TProcessed;\n\n /**\n * Optional validation function\n * Use context.addError/addWarning/addInfo to collect validation issues\n * Return \"skip\" to skip processing this contribution\n */\n validate?: (data: TData, context: ValidationContext) => \"skip\" | void;\n\n /**\n * Whether this extension point uses view/experience pattern\n * Default: false\n */\n hasView?: boolean;\n\n /**\n * Whether contributions should be ranked\n * Default: false\n */\n isRankable?: boolean;\n\n /**\n * Optional Zod schema for runtime validation and documentation\n * Provides both type safety and field introspection for Plugin Explorer\n */\n schema?: z.ZodSchema<TData>;\n\n /**\n * Metadata for discovery/documentation\n */\n metadata?: {\n category?: string;\n tags?: string[];\n since?: string;\n deprecated?: boolean;\n replacedBy?: string;\n owner?: string;\n /**\n * The actual export name of this extension point in the code\n * Used for documentation generation to show correct import statements\n */\n exportName?: string;\n };\n}\n\n/**\n * Props for extension point components\n */\nexport interface ExtensionComponentProps {\n /** Specific module to load (optional) */\n module?: string;\n /** Fallback component when extension not found */\n fallback?: React.ReactNode;\n}\n\n/**\n * Result of defining an extension point\n */\nexport interface ExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> {\n /**\n * The extension point configuration\n */\n config: ExtensionPointConfig<TData, TProcessed, TProps>;\n\n /**\n * Extension point ID for use in components\n */\n id: string;\n\n /**\n * Helper to get typed extensions (for future use with hooks)\n */\n getExtensions?: (\n extensions: PluginExtensionsType\n ) => Record<string, BasePluginExtension & { data: TProcessed }>;\n\n /**\n * Registration status\n */\n isRegistered: boolean;\n\n /**\n * Method to register this extension point\n */\n register: () => void;\n\n // Component property removed - use useExtensionComponent hook or createExtensionComponent factory at runtime\n\n /**\n * Get schema field information for documentation purposes\n * Returns field info that can be safely displayed by Plugin Explorer\n */\n getSchemaFieldInfo?: () => SchemaFieldInfo[];\n}\n\n/**\n * Extension point with hasView: true, guarantees Component property\n */\nexport interface ViewExtensionPointDefinition<\n TData = any,\n TProcessed = TData,\n TProps = any\n> extends ExtensionPointDefinition<TData, TProcessed, TProps> {\n Component: React.ComponentType<ExtensionComponentProps & TProps>;\n}\n\n/**\n * Type-safe extension point ID helper\n * Ensures consistent naming and helps with refactoring\n */\nexport function extensionPointId(\n namespace: string,\n feature: string,\n ...subFeatures: string[]\n): string {\n const parts = [namespace, feature, ...subFeatures].filter(Boolean);\n return parts.join(\".\");\n}\n"],"names":["extensionPointId","namespace","feature","subFeatures"],"mappings":"yJA0MO,SAASA,EACdC,EACAC,KACGC,EACK,CAER,MADc,CAACF,EAAWC,EAAS,GAAGC,CAAW,EAAE,OAAO,OAAO,EACpD,KAAK,GAAG,CACvB"}