@kosdev-code/kos-ui-plugin 2.1.1 → 2.1.3
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-BVDETA08.js +1523 -0
- package/documentation-generator-BVDETA08.js.map +1 -0
- package/documentation-generator-CTsesVKL.cjs +266 -0
- package/documentation-generator-CTsesVKL.cjs.map +1 -0
- package/index.cjs +16 -16
- package/index.cjs.map +1 -1
- package/index.js +433 -413
- package/index.js.map +1 -1
- package/lib/hooks/use-extension-component.d.ts +5 -0
- package/lib/hooks/use-extension-component.d.ts.map +1 -1
- package/lib/utils/extension-points/extension-point-schemas.d.ts +8 -8
- 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/plugin-system/plugin-extension-manager.d.ts.map +1 -1
- package/package.json +2 -2
- package/types/global.d.ts +15 -1
- package/utils.cjs +1 -1
- package/utils.cjs.map +1 -1
- package/utils.js +60 -80
- package/utils.js.map +1 -1
- package/documentation-generator-B8FuhDjB.js +0 -1271
- package/documentation-generator-B8FuhDjB.js.map +0 -1
- package/documentation-generator-E9tFyId_.cjs +0 -266
- package/documentation-generator-E9tFyId_.cjs.map +0 -1
|
@@ -1,1271 +0,0 @@
|
|
|
1
|
-
var T = Object.defineProperty;
|
|
2
|
-
var _ = (s, e, t) => e in s ? T(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var E = (s, e, t) => (_(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { z as P } from "zod";
|
|
5
|
-
function A(s, e) {
|
|
6
|
-
for (var t = 0; t < e.length; t++) {
|
|
7
|
-
const n = e[t];
|
|
8
|
-
if (typeof n != "string" && !Array.isArray(n)) {
|
|
9
|
-
for (const r in n)
|
|
10
|
-
if (r !== "default" && !(r in s)) {
|
|
11
|
-
const i = Object.getOwnPropertyDescriptor(n, r);
|
|
12
|
-
i && Object.defineProperty(s, r, i.get ? i : {
|
|
13
|
-
enumerable: !0,
|
|
14
|
-
get: () => n[r]
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return Object.freeze(Object.defineProperty(s, Symbol.toStringTag, { value: "Module" }));
|
|
20
|
-
}
|
|
21
|
-
var C = {}, x = {};
|
|
22
|
-
Object.defineProperty(x, "__esModule", { value: !0 });
|
|
23
|
-
x.loadRemoteModule = x.setRemoteDefinitions = x.setRemoteUrlResolver = void 0;
|
|
24
|
-
let w, R;
|
|
25
|
-
const k = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
|
|
26
|
-
let D = !1;
|
|
27
|
-
function K(s) {
|
|
28
|
-
R = s;
|
|
29
|
-
}
|
|
30
|
-
x.setRemoteUrlResolver = K;
|
|
31
|
-
function F(s) {
|
|
32
|
-
w = s;
|
|
33
|
-
}
|
|
34
|
-
x.setRemoteDefinitions = F;
|
|
35
|
-
async function M(s, e) {
|
|
36
|
-
const t = `${s}:${e}`;
|
|
37
|
-
if (k.has(t))
|
|
38
|
-
return k.get(t);
|
|
39
|
-
const i = (await (S.has(s) ? S.get(s) : await V(s)).get(e))();
|
|
40
|
-
return k.set(t, i), i;
|
|
41
|
-
}
|
|
42
|
-
x.loadRemoteModule = M;
|
|
43
|
-
const N = (s, e) => new Promise((t, n) => {
|
|
44
|
-
const r = document.createElement("script");
|
|
45
|
-
r.src = s, r.type = "text/javascript", r.async = !0, r.onload = () => {
|
|
46
|
-
t({
|
|
47
|
-
get: (a) => window[e].get(a),
|
|
48
|
-
init: (a) => {
|
|
49
|
-
try {
|
|
50
|
-
window[e].init(a);
|
|
51
|
-
} catch (o) {
|
|
52
|
-
console.error(`Failed to initialize remote ${e}`, o), n(o);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}, r.onerror = () => n(new Error(`Remote ${e} not found`)), document.head.appendChild(r);
|
|
57
|
-
});
|
|
58
|
-
async function V(s) {
|
|
59
|
-
if (!R && !w)
|
|
60
|
-
throw new Error("Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.");
|
|
61
|
-
D || (D = !0, await __webpack_init_sharing__("default"));
|
|
62
|
-
const e = w ? w[s] : await R(s);
|
|
63
|
-
let t = e;
|
|
64
|
-
!e.endsWith(".mjs") && !e.endsWith(".js") && (t = `${e}${e.endsWith("/") ? "" : "/"}remoteEntry.js`);
|
|
65
|
-
const n = await N(t, s);
|
|
66
|
-
return await n.init(__webpack_share_scopes__.default), S.set(s, n), n;
|
|
67
|
-
}
|
|
68
|
-
(function(s) {
|
|
69
|
-
Object.defineProperty(s, "__esModule", { value: !0 }), s.setRemoteUrlResolver = s.setRemoteDefinitions = s.loadRemoteModule = void 0;
|
|
70
|
-
var e = x;
|
|
71
|
-
Object.defineProperty(s, "loadRemoteModule", { enumerable: !0, get: function() {
|
|
72
|
-
return e.loadRemoteModule;
|
|
73
|
-
} }), Object.defineProperty(s, "setRemoteDefinitions", { enumerable: !0, get: function() {
|
|
74
|
-
return e.setRemoteDefinitions;
|
|
75
|
-
} }), Object.defineProperty(s, "setRemoteUrlResolver", { enumerable: !0, get: function() {
|
|
76
|
-
return e.setRemoteUrlResolver;
|
|
77
|
-
} });
|
|
78
|
-
})(C);
|
|
79
|
-
const oe = /* @__PURE__ */ A({
|
|
80
|
-
__proto__: null
|
|
81
|
-
}, [C]);
|
|
82
|
-
function B(s) {
|
|
83
|
-
var e;
|
|
84
|
-
try {
|
|
85
|
-
if ("shape" in s) {
|
|
86
|
-
const t = s, n = [];
|
|
87
|
-
for (const [r, i] of Object.entries(
|
|
88
|
-
t.shape
|
|
89
|
-
)) {
|
|
90
|
-
const a = i, o = {
|
|
91
|
-
name: r,
|
|
92
|
-
required: !a.isOptional()
|
|
93
|
-
};
|
|
94
|
-
if (a._def && a._def.description && (o.description = a._def.description), a._def) {
|
|
95
|
-
let c = a._def.typeName || "unknown";
|
|
96
|
-
c === "ZodOptional" && a._def.innerType && (c = ((e = a._def.innerType._def) == null ? void 0 : e.typeName) || "unknown"), o.type = c.replace("Zod", "").toLowerCase();
|
|
97
|
-
}
|
|
98
|
-
n.push(o);
|
|
99
|
-
}
|
|
100
|
-
return n;
|
|
101
|
-
}
|
|
102
|
-
return [];
|
|
103
|
-
} catch (t) {
|
|
104
|
-
return console.warn("Failed to extract schema field info:", t), [];
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
class L {
|
|
108
|
-
constructor() {
|
|
109
|
-
E(this, "issues", []);
|
|
110
|
-
}
|
|
111
|
-
addError(e) {
|
|
112
|
-
this.issues.push({ type: "error", message: e });
|
|
113
|
-
}
|
|
114
|
-
addWarning(e) {
|
|
115
|
-
this.issues.push({ type: "warning", message: e });
|
|
116
|
-
}
|
|
117
|
-
addInfo(e) {
|
|
118
|
-
this.issues.push({ type: "info", message: e });
|
|
119
|
-
}
|
|
120
|
-
hasErrors() {
|
|
121
|
-
return this.issues.some((e) => e.type === "error");
|
|
122
|
-
}
|
|
123
|
-
hasIssues() {
|
|
124
|
-
return this.issues.length > 0;
|
|
125
|
-
}
|
|
126
|
-
getIssues() {
|
|
127
|
-
return [...this.issues];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
class q {
|
|
131
|
-
constructor() {
|
|
132
|
-
E(this, "cache", /* @__PURE__ */ new Map());
|
|
133
|
-
}
|
|
134
|
-
set(e, t) {
|
|
135
|
-
this.cache.set(e, t);
|
|
136
|
-
}
|
|
137
|
-
get(e) {
|
|
138
|
-
return this.cache.get(e) || [];
|
|
139
|
-
}
|
|
140
|
-
clear() {
|
|
141
|
-
this.cache.clear();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
const v = new q();
|
|
145
|
-
function re(s) {
|
|
146
|
-
return v.get(s);
|
|
147
|
-
}
|
|
148
|
-
const U = [];
|
|
149
|
-
function H(s) {
|
|
150
|
-
U.push(s);
|
|
151
|
-
}
|
|
152
|
-
function z(s, e, t) {
|
|
153
|
-
return U.reduce(
|
|
154
|
-
(n, r) => r(n, e, t),
|
|
155
|
-
s
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
class G {
|
|
159
|
-
constructor() {
|
|
160
|
-
E(this, "extensionPoints", /* @__PURE__ */ new Map());
|
|
161
|
-
}
|
|
162
|
-
define(e) {
|
|
163
|
-
if (this.extensionPoints.has(e.id))
|
|
164
|
-
return console.warn(`Extension point ${e.id} is already defined`), this.extensionPoints.get(e.id);
|
|
165
|
-
const t = {
|
|
166
|
-
config: e,
|
|
167
|
-
id: e.id,
|
|
168
|
-
isRegistered: !1,
|
|
169
|
-
getExtensions: (n) => n[e.id] || {},
|
|
170
|
-
register: () => {
|
|
171
|
-
if (t.isRegistered) {
|
|
172
|
-
console.warn(`Extension point ${e.id} is already registered`);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
const n = this.createReducer(e);
|
|
176
|
-
H(n), t.isRegistered = !0;
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
return e.schema && (t.getSchemaFieldInfo = () => B(e.schema)), this.extensionPoints.set(e.id, t), t;
|
|
180
|
-
}
|
|
181
|
-
createReducer(e) {
|
|
182
|
-
return (t, n, r) => {
|
|
183
|
-
const i = n[e.contributionKey];
|
|
184
|
-
return !i || typeof i != "object" || Object.entries(i).forEach(
|
|
185
|
-
([a, o]) => {
|
|
186
|
-
var g, h;
|
|
187
|
-
if (!o)
|
|
188
|
-
return;
|
|
189
|
-
const c = {
|
|
190
|
-
remote: o.remote || "",
|
|
191
|
-
sectionId: o.sectionId || a,
|
|
192
|
-
experiences: r,
|
|
193
|
-
contributions: n
|
|
194
|
-
};
|
|
195
|
-
if (e.validate) {
|
|
196
|
-
const d = new L();
|
|
197
|
-
if (e.validate(
|
|
198
|
-
o,
|
|
199
|
-
d
|
|
200
|
-
) === "skip") {
|
|
201
|
-
v.set(a, [
|
|
202
|
-
{
|
|
203
|
-
type: "warning",
|
|
204
|
-
message: "Plugin marked to skip processing"
|
|
205
|
-
}
|
|
206
|
-
]);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (d.hasIssues()) {
|
|
210
|
-
const b = d.getIssues().map((m) => ({
|
|
211
|
-
...m,
|
|
212
|
-
message: `Extension point validation: ${m.message}`
|
|
213
|
-
}));
|
|
214
|
-
if (v.set(a, b), d.hasErrors()) {
|
|
215
|
-
console.error(
|
|
216
|
-
`Validation failed for ${e.id} contribution "${a}":`,
|
|
217
|
-
b.filter((m) => m.type === "error").map((m) => m.message).join(", ")
|
|
218
|
-
);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
} else
|
|
222
|
-
v.set(a, []);
|
|
223
|
-
}
|
|
224
|
-
const u = e.transform ? e.transform(o, c) : o;
|
|
225
|
-
t[e.id] || (t[e.id] = {});
|
|
226
|
-
const l = {
|
|
227
|
-
id: a,
|
|
228
|
-
type: e.contributionKey,
|
|
229
|
-
data: u,
|
|
230
|
-
remote: c.remote,
|
|
231
|
-
sectionId: c.sectionId
|
|
232
|
-
};
|
|
233
|
-
if (e.isRankable && typeof o.rank == "number" && (l.rank = o.rank), u && typeof u == "object" && ("component" in u && (l.component = u.component), "view" in u && (l.view = u.view), "location" in u && (l.location = u.location)), t[e.id][a] = l, e.hasView && ((g = e.relatedPoints) != null && g.view)) {
|
|
234
|
-
const d = o.experienceId, p = r == null ? void 0 : r[d];
|
|
235
|
-
p && (t[e.relatedPoints.view] || (t[e.relatedPoints.view] = {}), t[e.relatedPoints.view][a] = {
|
|
236
|
-
id: a,
|
|
237
|
-
type: `${e.contributionKey}.view`,
|
|
238
|
-
data: p,
|
|
239
|
-
remote: c.remote,
|
|
240
|
-
sectionId: c.sectionId
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
(h = e.relatedPoints) != null && h.definition && (t[e.relatedPoints.definition] || (t[e.relatedPoints.definition] = {}), t[e.relatedPoints.definition][a] = {
|
|
244
|
-
id: a,
|
|
245
|
-
type: `${e.contributionKey}.definition`,
|
|
246
|
-
data: u,
|
|
247
|
-
remote: c.remote,
|
|
248
|
-
sectionId: c.sectionId
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
), t;
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Get all registered extension points (for discovery/documentation)
|
|
256
|
-
*/
|
|
257
|
-
getAllExtensionPoints() {
|
|
258
|
-
return Array.from(this.extensionPoints.values()).filter(
|
|
259
|
-
(e) => e.isRegistered
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Get all defined extension points (registered and unregistered)
|
|
264
|
-
*/
|
|
265
|
-
getAllDefinedExtensionPoints() {
|
|
266
|
-
return Array.from(this.extensionPoints.values());
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Get a specific extension point definition
|
|
270
|
-
*/
|
|
271
|
-
getExtensionPoint(e) {
|
|
272
|
-
return this.extensionPoints.get(e);
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Check if an extension point is registered
|
|
276
|
-
*/
|
|
277
|
-
hasExtensionPoint(e) {
|
|
278
|
-
return this.extensionPoints.has(e);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
const W = new G();
|
|
282
|
-
function y() {
|
|
283
|
-
return W;
|
|
284
|
-
}
|
|
285
|
-
const Y = (s) => (e, t) => {
|
|
286
|
-
var c;
|
|
287
|
-
const n = s[t].remote, r = t, i = (c = s[t].contributes) == null ? void 0 : c.experiences;
|
|
288
|
-
return Object.keys(i).forEach((u) => {
|
|
289
|
-
const l = i[u];
|
|
290
|
-
e.experiences[u] = {
|
|
291
|
-
...l,
|
|
292
|
-
remote: n,
|
|
293
|
-
sectionId: r
|
|
294
|
-
};
|
|
295
|
-
}), y().getAllExtensionPoints().forEach((u) => {
|
|
296
|
-
var h;
|
|
297
|
-
const { contributionKey: l } = u.config, g = (h = s[t].contributes) == null ? void 0 : h[l];
|
|
298
|
-
g && (e[l] || (e[l] = {}), Array.isArray(g) ? g.forEach((d) => {
|
|
299
|
-
d && d.id && (e[l][d.id] = {
|
|
300
|
-
...d,
|
|
301
|
-
remote: n,
|
|
302
|
-
sectionId: r
|
|
303
|
-
});
|
|
304
|
-
}) : typeof g == "object" && Object.entries(g).forEach(([d, p]) => {
|
|
305
|
-
e[l][d] = {
|
|
306
|
-
...p,
|
|
307
|
-
id: d,
|
|
308
|
-
remote: n,
|
|
309
|
-
sectionId: r
|
|
310
|
-
};
|
|
311
|
-
}));
|
|
312
|
-
}), e;
|
|
313
|
-
};
|
|
314
|
-
async function Z(s) {
|
|
315
|
-
const e = s ?? window.KosPlugins.__dynamicRemotes;
|
|
316
|
-
if (window.KosPlugins.extensions) {
|
|
317
|
-
const i = window.KosPlugins.extensions;
|
|
318
|
-
return {
|
|
319
|
-
extensionPoints: i,
|
|
320
|
-
getExtensions: (a) => i[a] || [],
|
|
321
|
-
remotes: e,
|
|
322
|
-
extensions: window.KosPlugins.__extensions
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
const t = window.KosPlugins.__extensions ?? await J(e), n = {};
|
|
326
|
-
if (t)
|
|
327
|
-
for (const i of Object.keys(t))
|
|
328
|
-
n[i] = Object.values(
|
|
329
|
-
t[i] || {}
|
|
330
|
-
);
|
|
331
|
-
return window.KosPlugins.extensions = n, { extensionPoints: n, getExtensions: (i) => n[i] || [], remotes: e, extensions: t };
|
|
332
|
-
}
|
|
333
|
-
const j = {
|
|
334
|
-
controlPourDefinitions: {},
|
|
335
|
-
experiences: {}
|
|
336
|
-
};
|
|
337
|
-
function Q(s) {
|
|
338
|
-
return s ? Object.keys(s).reduce(Y(s), {
|
|
339
|
-
...j
|
|
340
|
-
}) : j;
|
|
341
|
-
}
|
|
342
|
-
async function J(s) {
|
|
343
|
-
if (!s)
|
|
344
|
-
return window.KosPlugins = window.KosPlugins || {}, {};
|
|
345
|
-
for (const a of Object.values(s))
|
|
346
|
-
if (a.init)
|
|
347
|
-
try {
|
|
348
|
-
const o = await C.loadRemoteModule(
|
|
349
|
-
a.remote,
|
|
350
|
-
"./InitPlugin"
|
|
351
|
-
);
|
|
352
|
-
if (o.default) {
|
|
353
|
-
const c = new o.default();
|
|
354
|
-
c == null || c.register();
|
|
355
|
-
}
|
|
356
|
-
} catch (o) {
|
|
357
|
-
console.warn(`Failed to load InitPlugin from ${a.remote}:`, o);
|
|
358
|
-
}
|
|
359
|
-
const e = Q(s), t = e.experiences, r = z(
|
|
360
|
-
{},
|
|
361
|
-
e,
|
|
362
|
-
t
|
|
363
|
-
), i = Object.keys(s).reduce((a, o) => {
|
|
364
|
-
const c = s[o].extensions ?? [];
|
|
365
|
-
for (const u of c)
|
|
366
|
-
a[u.extensionPointId] = a[u.extensionPointId] || {}, a[u.extensionPointId][u.id] = {
|
|
367
|
-
id: u.id,
|
|
368
|
-
type: u.type,
|
|
369
|
-
component: u.component,
|
|
370
|
-
remote: s[o].remote,
|
|
371
|
-
sectionId: o,
|
|
372
|
-
data: u
|
|
373
|
-
};
|
|
374
|
-
return a;
|
|
375
|
-
}, r);
|
|
376
|
-
return window.KosPlugins = window.KosPlugins || {}, window.KosPlugins.__extensions = i, i;
|
|
377
|
-
}
|
|
378
|
-
async function ae(s) {
|
|
379
|
-
const { getExtensions: e } = await Z();
|
|
380
|
-
return e(s);
|
|
381
|
-
}
|
|
382
|
-
const X = (s = null) => (s || window.location.search.replace("?", "")).split("&").map((e) => {
|
|
383
|
-
const [t, n] = e.split("=");
|
|
384
|
-
return [t, decodeURIComponent(n || "")];
|
|
385
|
-
}).reduce((e, [t, n]) => (e[t] = n, e), {}), ee = () => {
|
|
386
|
-
const s = window.location.origin, e = X();
|
|
387
|
-
return (e == null ? void 0 : e.host) || s;
|
|
388
|
-
}, ce = async (s) => {
|
|
389
|
-
var p, b;
|
|
390
|
-
const e = ee(), t = s ?? {}, {
|
|
391
|
-
pluginBaseUrl: n = e,
|
|
392
|
-
pluginApiPath: r = "/api/app/kosdev.ddk/ncui/plugins",
|
|
393
|
-
overrides: i = {},
|
|
394
|
-
pluginContext: a
|
|
395
|
-
} = t, o = !!a, c = o ? `${n}/api/kos/ui/plugins/context/${a.context}` : `${n}${r}`;
|
|
396
|
-
console.log(
|
|
397
|
-
`initialize-plugins: Using Plugin Framework: ${o}: Fetching plugins from ${c}`
|
|
398
|
-
);
|
|
399
|
-
const l = await (await fetch(c)).json(), g = o ? ((b = (p = l.data) == null ? void 0 : p.groups) == null ? void 0 : b[a.group]) ?? [] : l.data ?? [], h = g == null ? void 0 : g.reduce((m, f) => {
|
|
400
|
-
const $ = (i == null ? void 0 : i[f.id]) ?? o ? `${n}${f.path}` : `${n}${f.baseUrl}`;
|
|
401
|
-
return f.descriptor ? m[f.id] = {
|
|
402
|
-
basePath: `${$}remoteEntry.js`,
|
|
403
|
-
extensions: f.descriptor.extensions,
|
|
404
|
-
contributes: f.descriptor.contributes,
|
|
405
|
-
remote: f.descriptor.id,
|
|
406
|
-
init: !!f.descriptor.init
|
|
407
|
-
} : console.error(
|
|
408
|
-
`initialize-plugins: Plugin ${f.id} does not have a descriptor`
|
|
409
|
-
), m;
|
|
410
|
-
}, {});
|
|
411
|
-
window.KosPlugins = window.KosPlugins || {}, window.KosPlugins.__dynamicRemotes = h;
|
|
412
|
-
const d = Object.keys(h).reduce((m, f) => {
|
|
413
|
-
const $ = h[f].remote;
|
|
414
|
-
return m[$] = h[f].basePath, m;
|
|
415
|
-
}, {});
|
|
416
|
-
return C.setRemoteDefinitions(d), d;
|
|
417
|
-
};
|
|
418
|
-
function ue(s, e, t = !1) {
|
|
419
|
-
return !s || Object.keys(s).length === 0 ? null : t ? e && s[e] ? s[e] : null : e && s[e] ? s[e] : Object.values(s).filter((r) => typeof r.id == "string").sort((r, i) => {
|
|
420
|
-
const a = typeof r.rank == "number" ? r.rank : 1 / 0, o = typeof i.rank == "number" ? i.rank : 1 / 0;
|
|
421
|
-
if (a === o) {
|
|
422
|
-
const c = r.id ?? "", u = i.id ?? "";
|
|
423
|
-
return c.localeCompare(u);
|
|
424
|
-
}
|
|
425
|
-
return a - o;
|
|
426
|
-
})[0] ?? null;
|
|
427
|
-
}
|
|
428
|
-
const O = P.object({
|
|
429
|
-
id: P.string().min(1, "ID is required").describe("Unique identifier for this extension"),
|
|
430
|
-
title: P.string().min(1, "Title is required").describe("Display title shown in the interface"),
|
|
431
|
-
namespace: P.string().min(1, "Namespace is required").describe("Namespace for organizing related extensions"),
|
|
432
|
-
experienceId: P.string().min(1, "Experience ID is required").describe("Reference to the UI component experience for rendering")
|
|
433
|
-
}), te = O.extend({
|
|
434
|
-
rank: P.number().int().min(0).optional().describe("Optional ranking for ordering (higher = preferred)")
|
|
435
|
-
});
|
|
436
|
-
function le(s, e, t) {
|
|
437
|
-
const n = s.safeParse(e);
|
|
438
|
-
return n.success ? !0 : (n.error.errors.forEach((r) => {
|
|
439
|
-
t.addError(`${r.path.join(".")}: ${r.message}`);
|
|
440
|
-
}), !1);
|
|
441
|
-
}
|
|
442
|
-
function de(s, e, t) {
|
|
443
|
-
e && !e.includes(".") && t.addWarning(
|
|
444
|
-
`${s} '${e}' should typically include dot notation (e.g., 'category.item')`
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
function ne(s, e, t = 1e3) {
|
|
448
|
-
s !== void 0 && s > t && e.addWarning(
|
|
449
|
-
`Rank ${s} seems unusually high - consider using lower values for better ordering`
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
function pe(s, e = {}) {
|
|
453
|
-
return (e.rankable ? te : O).extend(s);
|
|
454
|
-
}
|
|
455
|
-
function ge(s, e, t = 1e3) {
|
|
456
|
-
typeof s == "object" && s !== null && "rank" in s && ne(s.rank, e, t);
|
|
457
|
-
}
|
|
458
|
-
class I {
|
|
459
|
-
/**
|
|
460
|
-
* Get all extension points with their plugin information
|
|
461
|
-
*/
|
|
462
|
-
static getExtensionPoints(e, t = {}) {
|
|
463
|
-
const {
|
|
464
|
-
includeLegacyExtensions: n = !0,
|
|
465
|
-
includeEmptyExtensionPoints: r = !0
|
|
466
|
-
} = t, a = y().getAllExtensionPoints(), o = [];
|
|
467
|
-
return a.forEach((c) => {
|
|
468
|
-
const u = Object.values((e == null ? void 0 : e[c.id]) || {});
|
|
469
|
-
!r && u.length === 0 || o.push({
|
|
470
|
-
id: c.id,
|
|
471
|
-
displayName: c.config.displayName,
|
|
472
|
-
description: c.config.description,
|
|
473
|
-
source: "simplified",
|
|
474
|
-
metadata: c.config.metadata,
|
|
475
|
-
pluginCount: u.length,
|
|
476
|
-
plugins: u
|
|
477
|
-
});
|
|
478
|
-
}), n && e && Object.entries(e).forEach(([c, u]) => {
|
|
479
|
-
if (o.some((g) => g.id === c))
|
|
480
|
-
return;
|
|
481
|
-
const l = Object.values(u || {});
|
|
482
|
-
!r && l.length === 0 || o.push({
|
|
483
|
-
id: c,
|
|
484
|
-
source: "legacy",
|
|
485
|
-
pluginCount: l.length,
|
|
486
|
-
plugins: l
|
|
487
|
-
});
|
|
488
|
-
}), o.sort((c, u) => c.id.localeCompare(u.id));
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Filter extension points based on search criteria
|
|
492
|
-
*/
|
|
493
|
-
static filterExtensionPoints(e, t) {
|
|
494
|
-
if (!t.trim())
|
|
495
|
-
return e;
|
|
496
|
-
const n = t.toLowerCase();
|
|
497
|
-
return e.filter(
|
|
498
|
-
(r) => {
|
|
499
|
-
var i, a, o, c, u, l;
|
|
500
|
-
return r.id.toLowerCase().includes(n) || ((i = r.displayName) == null ? void 0 : i.toLowerCase().includes(n)) || ((a = r.description) == null ? void 0 : a.toLowerCase().includes(n)) || ((c = (o = r.metadata) == null ? void 0 : o.category) == null ? void 0 : c.toLowerCase().includes(n)) || ((l = (u = r.metadata) == null ? void 0 : u.tags) == null ? void 0 : l.some((g) => g.toLowerCase().includes(n)));
|
|
501
|
-
}
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Calculate health statistics for the plugin system
|
|
506
|
-
*/
|
|
507
|
-
static calculateHealthStats(e) {
|
|
508
|
-
const t = e.length, n = e.filter(
|
|
509
|
-
(c) => c.pluginCount > 0
|
|
510
|
-
).length, r = e.reduce(
|
|
511
|
-
(c, u) => c + u.pluginCount,
|
|
512
|
-
0
|
|
513
|
-
), i = e.filter(
|
|
514
|
-
(c) => c.source === "simplified"
|
|
515
|
-
).length, a = e.filter(
|
|
516
|
-
(c) => c.source === "legacy"
|
|
517
|
-
).length, o = e.filter(
|
|
518
|
-
(c) => {
|
|
519
|
-
var u;
|
|
520
|
-
return (u = c.metadata) == null ? void 0 : u.deprecated;
|
|
521
|
-
}
|
|
522
|
-
).length;
|
|
523
|
-
return {
|
|
524
|
-
totalExtensionPoints: t,
|
|
525
|
-
extensionPointsWithPlugins: n,
|
|
526
|
-
totalPlugins: r,
|
|
527
|
-
simplifiedExtensionPoints: i,
|
|
528
|
-
legacyExtensionPoints: a,
|
|
529
|
-
deprecatedExtensionPoints: o
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Analyze a specific plugin for health and capabilities
|
|
534
|
-
*/
|
|
535
|
-
static analyzePlugin(e) {
|
|
536
|
-
const t = !!e.component, n = typeof e.rank == "number", r = e.rank || 0, i = [];
|
|
537
|
-
if (t ? i.push("UI Component") : i.push("Background Service"), n && i.push(`Rank: ${r}`), e.namespace) {
|
|
538
|
-
const o = e.namespace;
|
|
539
|
-
o.includes("kos") || o.includes("ddk") ? i.push("First-party") : i.push("Third-party");
|
|
540
|
-
}
|
|
541
|
-
e.modalMode && i.push(`Modal: ${e.modalMode}`);
|
|
542
|
-
let a = "healthy";
|
|
543
|
-
return e.remote || (a = "warning"), {
|
|
544
|
-
hasComponent: t,
|
|
545
|
-
hasRank: n,
|
|
546
|
-
healthStatus: a,
|
|
547
|
-
capabilities: i
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Get extension point by ID with detailed information
|
|
552
|
-
*/
|
|
553
|
-
static getExtensionPointById(e, t) {
|
|
554
|
-
return e.find((n) => n.id === t);
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Validate if an extension point ID follows conventions
|
|
558
|
-
*/
|
|
559
|
-
static validateExtensionPointId(e) {
|
|
560
|
-
const t = [], n = [];
|
|
561
|
-
e.includes(".") || (t.push(
|
|
562
|
-
"Extension point ID should contain at least one dot (namespace.feature)"
|
|
563
|
-
), n.push('Use format like "ddk.myFeature" or "app.myFeature"'));
|
|
564
|
-
const r = e.split(".");
|
|
565
|
-
r.length < 2 && t.push(
|
|
566
|
-
"Extension point ID should have at least 2 parts (namespace.feature)"
|
|
567
|
-
);
|
|
568
|
-
const i = r[0];
|
|
569
|
-
return i && !["ddk", "cui", "app"].includes(i) && !i.endsWith("app") && n.push(
|
|
570
|
-
"Consider using standard namespaces: ddk, cui, or [appname]app"
|
|
571
|
-
), r.some((o) => /[A-Z]/.test(o)) && (t.push("Extension point ID parts should be lowercase"), n.push(
|
|
572
|
-
'Use kebab-case or dot notation: "my.feature" not "my.myFeature"'
|
|
573
|
-
)), {
|
|
574
|
-
isValid: t.length === 0,
|
|
575
|
-
issues: t,
|
|
576
|
-
suggestions: n
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
/**
|
|
580
|
-
* Validate a plugin descriptor structure and content
|
|
581
|
-
*/
|
|
582
|
-
static validatePluginDescriptor(e) {
|
|
583
|
-
const t = [], n = [], r = [], i = [];
|
|
584
|
-
if (e.id ? e.id.match(/^[a-z0-9-]+$/) || i.push(
|
|
585
|
-
"Plugin ID convention: use lowercase letters, numbers, and hyphens (e.g., 'my-awesome-plugin')"
|
|
586
|
-
) : (r.push("id"), t.push("Plugin descriptor must have an 'id' field")), !e.contributes)
|
|
587
|
-
n.push(
|
|
588
|
-
"Plugin has no contributions - it won't extend any functionality"
|
|
589
|
-
), i.push("Add a 'contributes' section with plugin contributions");
|
|
590
|
-
else {
|
|
591
|
-
const a = Object.keys(e.contributes);
|
|
592
|
-
a.length === 0 && n.push("Plugin contributes section is empty"), a.forEach((o) => {
|
|
593
|
-
const c = e.contributes[o];
|
|
594
|
-
if (!Array.isArray(c)) {
|
|
595
|
-
t.push(`Contribution '${o}' must be an array`);
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
c.forEach((u, l) => {
|
|
599
|
-
u.id || t.push(
|
|
600
|
-
`Contribution ${o}[${l}] missing required 'id' field`
|
|
601
|
-
), o === "experiences" && u.component && !u.location && (t.push(
|
|
602
|
-
`Experience '${u.id}' has component but no location`
|
|
603
|
-
), i.push(
|
|
604
|
-
"Add 'location' field pointing to the component file"
|
|
605
|
-
)), ["cui", "utilities", "settings", "setup"].includes(o) && (u.title || n.push(
|
|
606
|
-
`${o} contribution '${u.id}' missing 'title' field`
|
|
607
|
-
), u.namespace || n.push(
|
|
608
|
-
`${o} contribution '${u.id}' missing 'namespace' field`
|
|
609
|
-
), u.experienceId || t.push(
|
|
610
|
-
`${o} contribution '${u.id}' missing required 'experienceId' field`
|
|
611
|
-
));
|
|
612
|
-
});
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
return e.init !== void 0 && typeof e.init != "boolean" && t.push("'init' field must be a boolean value"), {
|
|
616
|
-
isValid: t.length === 0 && r.length === 0,
|
|
617
|
-
errors: t,
|
|
618
|
-
warnings: n,
|
|
619
|
-
missingRequired: r,
|
|
620
|
-
suggestions: i
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Check compatibility between plugin contributions and available extension points
|
|
625
|
-
*/
|
|
626
|
-
static checkPluginCompatibility(e, t) {
|
|
627
|
-
const n = [], r = [], i = [], a = [];
|
|
628
|
-
if (!e.contributes)
|
|
629
|
-
return {
|
|
630
|
-
isCompatible: !0,
|
|
631
|
-
issues: ["Plugin has no contributions to check"],
|
|
632
|
-
missingExtensionPoints: [],
|
|
633
|
-
incompatibleTypes: [],
|
|
634
|
-
suggestions: []
|
|
635
|
-
};
|
|
636
|
-
const o = y(), c = new Set(
|
|
637
|
-
t.map((u) => u.id)
|
|
638
|
-
);
|
|
639
|
-
return Object.entries(e.contributes).forEach(
|
|
640
|
-
([u, l]) => {
|
|
641
|
-
this.getExpectedExtensionPoints(u).forEach((p) => {
|
|
642
|
-
c.has(p) || (r.push(p), n.push(
|
|
643
|
-
`Extension point '${p}' not available for '${u}' contributions`
|
|
644
|
-
), a.push(
|
|
645
|
-
`Ensure the extension point '${p}' is registered`
|
|
646
|
-
));
|
|
647
|
-
});
|
|
648
|
-
const d = o.getAllExtensionPoints().find(
|
|
649
|
-
(p) => p.config.contributionKey === u
|
|
650
|
-
);
|
|
651
|
-
d && l.length > 0 && l.forEach((p, b) => {
|
|
652
|
-
d.config.isRankable && typeof p.rank != "number" && (n.push(
|
|
653
|
-
`${u}[${b}]: Extension point '${d.id}' expects 'rank' property`
|
|
654
|
-
), a.push(
|
|
655
|
-
"Add 'rank' property with numeric value for ordering"
|
|
656
|
-
)), d.config.hasView && !p.experienceId && (n.push(
|
|
657
|
-
`${u}[${b}]: Extension point '${d.id}' expects 'experienceId' for view-based contributions`
|
|
658
|
-
), a.push(
|
|
659
|
-
"Add 'experienceId' property linking to an experience definition"
|
|
660
|
-
));
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
), {
|
|
664
|
-
isCompatible: n.length === 0,
|
|
665
|
-
issues: n,
|
|
666
|
-
missingExtensionPoints: r,
|
|
667
|
-
incompatibleTypes: i,
|
|
668
|
-
suggestions: a
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Map contribution keys to their expected extension point IDs
|
|
673
|
-
*/
|
|
674
|
-
static getExpectedExtensionPoints(e) {
|
|
675
|
-
return {
|
|
676
|
-
cui: ["ddk.cui", "ddk.cui.view", "ddk.cui.settings.config"],
|
|
677
|
-
utilities: ["ddk.utility", "ddk.utility.view", "ddk.utilities"],
|
|
678
|
-
setup: ["ddk.setup", "ddk.setup.view"],
|
|
679
|
-
settings: ["ddk.settings", "ddk.settings.view"],
|
|
680
|
-
troubleActions: ["ddk.troubleAction", "ddk.troubleAction.view"],
|
|
681
|
-
navViews: ["ddk.nav", "ddk.nav.view"],
|
|
682
|
-
controlPour: ["ddk.controlPour", "ddk.controlPour.view"],
|
|
683
|
-
experiences: [],
|
|
684
|
-
// Experiences don't directly map to extension points
|
|
685
|
-
views: []
|
|
686
|
-
// Views are mapped by their extension point ID keys
|
|
687
|
-
}[e] || [];
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Get comprehensive plugin analysis including validation and compatibility
|
|
691
|
-
*/
|
|
692
|
-
static analyzePluginDescriptor(e, t) {
|
|
693
|
-
const n = this.validatePluginDescriptor(e), r = this.checkPluginCompatibility(
|
|
694
|
-
e,
|
|
695
|
-
t
|
|
696
|
-
), i = [];
|
|
697
|
-
return n.warnings.length > 0 && i.push(
|
|
698
|
-
"Address validation warnings to improve plugin quality"
|
|
699
|
-
), r.isCompatible || i.push(
|
|
700
|
-
"Resolve compatibility issues before deploying plugin"
|
|
701
|
-
), e.contributes && Object.keys(e.contributes).length === 1 && i.push(
|
|
702
|
-
"Consider adding more contribution types to increase plugin value"
|
|
703
|
-
), {
|
|
704
|
-
validation: n,
|
|
705
|
-
compatibility: r,
|
|
706
|
-
recommendations: i
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
class fe {
|
|
711
|
-
/**
|
|
712
|
-
* Generate complete documentation for all extension points
|
|
713
|
-
*/
|
|
714
|
-
static generateFullDocumentation(e, t = {}) {
|
|
715
|
-
const {
|
|
716
|
-
includeUsageExamples: n = !0,
|
|
717
|
-
includeTypeDefinitions: r = !0,
|
|
718
|
-
includeLegacyExtensions: i = !0,
|
|
719
|
-
includePluginHealth: a = !0
|
|
720
|
-
} = t, o = I.getExtensionPoints(
|
|
721
|
-
e,
|
|
722
|
-
{
|
|
723
|
-
includeLegacyExtensions: i,
|
|
724
|
-
includeEmptyExtensionPoints: !0
|
|
725
|
-
}
|
|
726
|
-
), c = I.calculateHealthStats(o);
|
|
727
|
-
let u = this.generateHeader(c);
|
|
728
|
-
return u += this.generateTableOfContents(o), u += this.generateOverviewSection(o, c), o.forEach((l) => {
|
|
729
|
-
u += this.generateExtensionPointSection(l, {
|
|
730
|
-
includeUsageExamples: n,
|
|
731
|
-
includePluginHealth: a
|
|
732
|
-
});
|
|
733
|
-
}), r && (u += this.generateTypeDefinitionsSection(o)), u += this.generateContributionGuide(), u += this.generateTroubleshootingSection(), {
|
|
734
|
-
content: u,
|
|
735
|
-
metadata: {
|
|
736
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
737
|
-
totalExtensionPoints: c.totalExtensionPoints,
|
|
738
|
-
totalPlugins: c.totalPlugins,
|
|
739
|
-
simplifiedExtensionPoints: c.simplifiedExtensionPoints,
|
|
740
|
-
legacyExtensionPoints: c.legacyExtensionPoints
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
/**
|
|
745
|
-
* Generate documentation header with metadata
|
|
746
|
-
*/
|
|
747
|
-
static generateHeader(e) {
|
|
748
|
-
return `# KOS Plugin Extension Points Reference
|
|
749
|
-
|
|
750
|
-
**Generated**: ${(/* @__PURE__ */ new Date()).toLocaleString()}
|
|
751
|
-
|
|
752
|
-
## System Overview
|
|
753
|
-
|
|
754
|
-
- **Total Extension Points**: ${e.totalExtensionPoints}
|
|
755
|
-
- **Extension Points with Plugins**: ${e.extensionPointsWithPlugins}
|
|
756
|
-
- **Total Active Plugins**: ${e.totalPlugins}
|
|
757
|
-
- **Simplified Extension Points**: ${e.simplifiedExtensionPoints}
|
|
758
|
-
- **Legacy Extension Points**: ${e.legacyExtensionPoints}
|
|
759
|
-
|
|
760
|
-
---
|
|
761
|
-
|
|
762
|
-
`;
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* Generate table of contents
|
|
766
|
-
*/
|
|
767
|
-
static generateTableOfContents(e) {
|
|
768
|
-
let t = `## Table of Contents
|
|
769
|
-
|
|
770
|
-
`;
|
|
771
|
-
return t += `- [Overview](#overview)
|
|
772
|
-
`, t += `- [Extension Points](#extension-points)
|
|
773
|
-
`, e.forEach((n) => {
|
|
774
|
-
const r = n.id.toLowerCase().replace(/\./g, "");
|
|
775
|
-
t += ` - [${n.id}](#${r}) (${n.pluginCount} plugins)
|
|
776
|
-
`;
|
|
777
|
-
}), t += `- [Type Definitions](#type-definitions)
|
|
778
|
-
`, t += `- [Contribution Guide](#contribution-guide)
|
|
779
|
-
`, t += `- [Troubleshooting](#troubleshooting)
|
|
780
|
-
|
|
781
|
-
`, t;
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Generate overview section with health statistics
|
|
785
|
-
*/
|
|
786
|
-
static generateOverviewSection(e, t) {
|
|
787
|
-
let n = `## Overview
|
|
788
|
-
|
|
789
|
-
`;
|
|
790
|
-
return n += "This document provides a comprehensive reference for all available extension points in the KOS plugin system. ", n += `Extension points allow plugins to contribute functionality to the application.
|
|
791
|
-
|
|
792
|
-
`, n += `### Extension Point Types
|
|
793
|
-
|
|
794
|
-
`, n += "- **✨ Simplified Extension Points**: Use the new simplified API from `defineExtensionPoint`\n", n += `- **📚 Legacy Extension Points**: Use the traditional reducer-based system
|
|
795
|
-
|
|
796
|
-
`, t.deprecatedExtensionPoints > 0 && (n += `### ⚠️ Deprecated Extension Points
|
|
797
|
-
|
|
798
|
-
`, n += `${t.deprecatedExtensionPoints} extension points are marked as deprecated. `, n += `Consider migrating to newer alternatives.
|
|
799
|
-
|
|
800
|
-
`), n + `---
|
|
801
|
-
|
|
802
|
-
`;
|
|
803
|
-
}
|
|
804
|
-
/**
|
|
805
|
-
* Generate documentation section for a single extension point
|
|
806
|
-
*/
|
|
807
|
-
static generateExtensionPointSection(e, t) {
|
|
808
|
-
var a;
|
|
809
|
-
const { includeUsageExamples: n = !0, includePluginHealth: r = !0 } = t;
|
|
810
|
-
let i = `## ${e.source === "simplified" ? "✨" : "📚"} ${e.id}
|
|
811
|
-
|
|
812
|
-
`;
|
|
813
|
-
if (e.displayName && (i += `**Display Name**: ${e.displayName}
|
|
814
|
-
|
|
815
|
-
`), e.description && (i += `**Description**: ${e.description}
|
|
816
|
-
|
|
817
|
-
`), i += `**Source**: ${e.source}
|
|
818
|
-
`, i += `**Active Plugins**: ${e.pluginCount}
|
|
819
|
-
|
|
820
|
-
`, e.metadata) {
|
|
821
|
-
i += `### Metadata
|
|
822
|
-
|
|
823
|
-
`;
|
|
824
|
-
const o = e.metadata;
|
|
825
|
-
o.category && (i += `- **Category**: ${o.category}
|
|
826
|
-
`), o.owner && (i += `- **Owner**: ${o.owner}
|
|
827
|
-
`), o.since && (i += `- **Since**: ${o.since}
|
|
828
|
-
`), (a = o.tags) != null && a.length && (i += `- **Tags**: ${o.tags.join(", ")}
|
|
829
|
-
`), o.deprecated && (i += `- **⚠️ Status**: Deprecated
|
|
830
|
-
`), i += `
|
|
831
|
-
`;
|
|
832
|
-
}
|
|
833
|
-
return n && (i += this.generateUsageExamples(e)), e.plugins.length > 0 ? i += this.generatePluginList(
|
|
834
|
-
e.plugins,
|
|
835
|
-
r
|
|
836
|
-
) : i += `### Plugins
|
|
837
|
-
|
|
838
|
-
No plugins currently registered for this extension point.
|
|
839
|
-
|
|
840
|
-
`, i += this.generateSchemaFieldsSection(e), i += this.generateContributionStructure(e), i + `---
|
|
841
|
-
|
|
842
|
-
`;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* Generate usage examples for an extension point
|
|
846
|
-
*/
|
|
847
|
-
static generateUsageExamples(e) {
|
|
848
|
-
let t = `### Usage Examples
|
|
849
|
-
|
|
850
|
-
`;
|
|
851
|
-
return e.source === "simplified" && (t += `#### Using Simplified API
|
|
852
|
-
|
|
853
|
-
`, t += "```typescript\n", t += `// Import the extension point
|
|
854
|
-
`, t += `import { ${this.getExtensionPointImportName(
|
|
855
|
-
e.id
|
|
856
|
-
)} } from './extension-points';
|
|
857
|
-
|
|
858
|
-
`, t += `// Use extension component hook
|
|
859
|
-
`, t += `import { useExtensionComponent } from '@kosdev-code/kos-ui-plugin';
|
|
860
|
-
|
|
861
|
-
`, t += `const Component = useExtensionComponent(${this.getExtensionPointImportName(
|
|
862
|
-
e.id
|
|
863
|
-
)});
|
|
864
|
-
|
|
865
|
-
`, t += `if (Component) {
|
|
866
|
-
`, t += ` return (
|
|
867
|
-
`, t += ` <Component
|
|
868
|
-
`, t += ` customProp="value"
|
|
869
|
-
`, t += ` onComplete={handleComplete}
|
|
870
|
-
`, t += ` />
|
|
871
|
-
`, t += ` );
|
|
872
|
-
`, t += `}
|
|
873
|
-
|
|
874
|
-
`, t += `// Or use with dynamic component
|
|
875
|
-
`, t += `const [Component] = useDynamicComponent({
|
|
876
|
-
`, t += ` extension: ${this.getExtensionPointImportName(
|
|
877
|
-
e.id
|
|
878
|
-
)}.id
|
|
879
|
-
`, t += `});
|
|
880
|
-
`, t += "```\n\n", t += `#### Using Typed Hooks
|
|
881
|
-
|
|
882
|
-
`, t += "```typescript\n", t += `// Get all extensions with type safety
|
|
883
|
-
`, t += `const extensions = useExtensions(${this.getExtensionPointImportName(
|
|
884
|
-
e.id
|
|
885
|
-
)});
|
|
886
|
-
|
|
887
|
-
`, t += `// Get best extension
|
|
888
|
-
`, t += `const bestExtension = useBest(${this.getExtensionPointImportName(
|
|
889
|
-
e.id
|
|
890
|
-
)});
|
|
891
|
-
|
|
892
|
-
`, t += `// Check availability
|
|
893
|
-
`, t += `const hasExtensions = useHasExtensions(${this.getExtensionPointImportName(
|
|
894
|
-
e.id
|
|
895
|
-
)});
|
|
896
|
-
`, t += "```\n\n"), t += `#### Using DynamicComponent
|
|
897
|
-
|
|
898
|
-
`, t += "```typescript\n", t += `import { DynamicComponent } from '@kosdev-code/kos-ui-plugin';
|
|
899
|
-
`, t += `import { ${this.getExtensionPointImportName(
|
|
900
|
-
e.id
|
|
901
|
-
)} } from './extension-points';
|
|
902
|
-
|
|
903
|
-
`, t += `<DynamicComponent
|
|
904
|
-
`, t += ` extension={${this.getExtensionPointImportName(
|
|
905
|
-
e.id
|
|
906
|
-
)}.id}
|
|
907
|
-
`, t += ` props={{ customData: "value" }}
|
|
908
|
-
`, t += ` fallback={<div>Loading...</div>}
|
|
909
|
-
`, t += `/>
|
|
910
|
-
`, t += "```\n\n", t += `#### Using Context
|
|
911
|
-
|
|
912
|
-
`, t += "```typescript\n", t += `import { useKosPluginsContext } from '@kosdev-code/kos-ui-plugin';
|
|
913
|
-
`, t += `import { ${this.getExtensionPointImportName(
|
|
914
|
-
e.id
|
|
915
|
-
)} } from './extension-points';
|
|
916
|
-
|
|
917
|
-
`, t += `const { getExtensions } = useKosPluginsContext();
|
|
918
|
-
`, t += `const extensions = getExtensions(${this.getExtensionPointImportName(
|
|
919
|
-
e.id
|
|
920
|
-
)}.id);
|
|
921
|
-
`, t += "```\n\n", t;
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Generate plugin list with health information
|
|
925
|
-
*/
|
|
926
|
-
static generatePluginList(e, t) {
|
|
927
|
-
let n = `### Active Plugins
|
|
928
|
-
|
|
929
|
-
`;
|
|
930
|
-
return e.forEach((r) => {
|
|
931
|
-
if (n += `#### ${r.id}
|
|
932
|
-
|
|
933
|
-
`, r.remote && (n += `- **Remote**: ${r.remote}
|
|
934
|
-
`), r.sectionId && (n += `- **Section**: ${r.sectionId}
|
|
935
|
-
`), r.rank !== void 0 && (n += `- **Rank**: ${r.rank}
|
|
936
|
-
`), t) {
|
|
937
|
-
const i = I.analyzePlugin(r);
|
|
938
|
-
n += `- **Health**: ${this.getHealthEmoji(i.healthStatus)} ${i.healthStatus}
|
|
939
|
-
`, i.capabilities.length > 0 && (n += `- **Capabilities**: ${i.capabilities.join(", ")}
|
|
940
|
-
`);
|
|
941
|
-
}
|
|
942
|
-
n += `
|
|
943
|
-
`;
|
|
944
|
-
}), n;
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
|
-
* Generate schema fields documentation
|
|
948
|
-
*/
|
|
949
|
-
static generateSchemaFieldsSection(e) {
|
|
950
|
-
if (e.source !== "simplified")
|
|
951
|
-
return "";
|
|
952
|
-
const n = y().getExtensionPoint(e.id);
|
|
953
|
-
if (!(n != null && n.getSchemaFieldInfo))
|
|
954
|
-
return "";
|
|
955
|
-
const r = n.getSchemaFieldInfo();
|
|
956
|
-
if (r.length === 0)
|
|
957
|
-
return "";
|
|
958
|
-
let i = `### Schema Fields
|
|
959
|
-
|
|
960
|
-
`;
|
|
961
|
-
return i += `The following fields are defined in the schema for this extension point:
|
|
962
|
-
|
|
963
|
-
`, i += `| Field | Type | Required | Description |
|
|
964
|
-
`, i += `|-------|------|----------|-------------|
|
|
965
|
-
`, r.forEach((a) => {
|
|
966
|
-
const o = a.name, c = a.type || "unknown", u = a.required ? "✅" : "⭕", l = a.description || "-";
|
|
967
|
-
i += `| \`${o}\` | ${c} | ${u} | ${l} |
|
|
968
|
-
`;
|
|
969
|
-
}), i += `
|
|
970
|
-
`, i;
|
|
971
|
-
}
|
|
972
|
-
/**
|
|
973
|
-
* Generate contribution structure documentation
|
|
974
|
-
*/
|
|
975
|
-
static generateContributionStructure(e) {
|
|
976
|
-
let t = `### Contribution Structure
|
|
977
|
-
|
|
978
|
-
`;
|
|
979
|
-
t += `To contribute to this extension point, add the following to your plugin descriptor:
|
|
980
|
-
|
|
981
|
-
`, t += "```json\n", t += `{
|
|
982
|
-
`, t += ` "id": "your-plugin-id",
|
|
983
|
-
`, t += ` "contributes": {
|
|
984
|
-
`;
|
|
985
|
-
const n = this.inferContributionKey(e);
|
|
986
|
-
t += ` "${n}": [
|
|
987
|
-
`, t += ` {
|
|
988
|
-
`;
|
|
989
|
-
const r = this.getSchemaFieldsForContribution(e);
|
|
990
|
-
if (r.length > 0) {
|
|
991
|
-
const a = [];
|
|
992
|
-
r.forEach((o) => {
|
|
993
|
-
let c;
|
|
994
|
-
o.name === "id" ? c = '"your-contribution-id"' : o.name === "title" ? c = '"Your Contribution Title"' : o.name === "namespace" ? c = '"your-namespace"' : o.name === "experienceId" ? c = '"your-experience-id"' : o.name === "dashboardKey" ? c = '"your-dashboard-key"' : o.name === "rank" ? c = "10" : o.type === "string" ? c = `"your-${o.name}"` : o.type === "number" ? c = "0" : o.type === "boolean" ? c = "false" : c = `"your-${o.name}"`, (o.required || ["experienceId", "rank", "dashboardKey"].includes(o.name)) && a.push(` "${o.name}": ${c}`);
|
|
995
|
-
}), t += a.join(`,
|
|
996
|
-
`);
|
|
997
|
-
} else {
|
|
998
|
-
t += ` "id": "your-contribution-id",
|
|
999
|
-
`, t += ` "title": "Your Contribution Title",
|
|
1000
|
-
`, t += ' "namespace": "your-namespace"', this.isViewBasedExtensionPoint(e) && (t += `,
|
|
1001
|
-
"experienceId": "your-experience-id"`), this.isRankableExtensionPoint(e) && (t += `,
|
|
1002
|
-
"rank": 10`);
|
|
1003
|
-
const a = this.getSpecificFields(e);
|
|
1004
|
-
a.length > 0 && (t += `,
|
|
1005
|
-
${a.join(`,
|
|
1006
|
-
`)}`);
|
|
1007
|
-
}
|
|
1008
|
-
return t += `
|
|
1009
|
-
}
|
|
1010
|
-
`, t += " ]", (r.some((a) => a.name === "experienceId") || this.isViewBasedExtensionPoint(e)) && (t += `,
|
|
1011
|
-
"experiences": {
|
|
1012
|
-
`, t += ` "your-experience-id": {
|
|
1013
|
-
`, t += ` "id": "your-experience-id",
|
|
1014
|
-
`, t += ` "component": "YourComponent",
|
|
1015
|
-
`, t += ` "location": "./src/components/YourComponent.tsx"
|
|
1016
|
-
`, t += ` }
|
|
1017
|
-
`, t += " }"), t += `
|
|
1018
|
-
}
|
|
1019
|
-
`, t += `}
|
|
1020
|
-
`, t += "```\n\n", t;
|
|
1021
|
-
}
|
|
1022
|
-
/**
|
|
1023
|
-
* Generate TypeScript definitions section
|
|
1024
|
-
*/
|
|
1025
|
-
static generateTypeDefinitionsSection(e) {
|
|
1026
|
-
let t = `## Type Definitions
|
|
1027
|
-
|
|
1028
|
-
`;
|
|
1029
|
-
return t += `### Extension Point Types
|
|
1030
|
-
|
|
1031
|
-
`, t += "```typescript\n", e.forEach((n) => {
|
|
1032
|
-
n.source === "simplified" && (t += `// ${n.id}
|
|
1033
|
-
`, t += `interface ${this.getExtensionPointTypeName(n.id)} {
|
|
1034
|
-
`, t += ` id: "${n.id}";
|
|
1035
|
-
`, t += ` displayName?: "${n.displayName || ""}";
|
|
1036
|
-
`, t += ` description?: "${n.description || ""}";
|
|
1037
|
-
`, t += `}
|
|
1038
|
-
|
|
1039
|
-
`);
|
|
1040
|
-
}), t += "```\n\n", t += `### Plugin Contribution Types
|
|
1041
|
-
|
|
1042
|
-
`, t += "```typescript\n", t += `interface BaseContribution {
|
|
1043
|
-
`, t += ` id: string;
|
|
1044
|
-
`, t += ` title: string;
|
|
1045
|
-
`, t += ` namespace: string;
|
|
1046
|
-
`, t += `}
|
|
1047
|
-
|
|
1048
|
-
`, t += `interface ViewBasedContribution extends BaseContribution {
|
|
1049
|
-
`, t += ` experienceId: string;
|
|
1050
|
-
`, t += `}
|
|
1051
|
-
|
|
1052
|
-
`, t += `interface RankableContribution extends BaseContribution {
|
|
1053
|
-
`, t += ` rank: number;
|
|
1054
|
-
`, t += `}
|
|
1055
|
-
`, t += "```\n\n", t;
|
|
1056
|
-
}
|
|
1057
|
-
/**
|
|
1058
|
-
* Generate contribution guide
|
|
1059
|
-
*/
|
|
1060
|
-
static generateContributionGuide() {
|
|
1061
|
-
return `## Contribution Guide
|
|
1062
|
-
|
|
1063
|
-
### Creating a Plugin
|
|
1064
|
-
|
|
1065
|
-
1. **Create Plugin Project**
|
|
1066
|
-
\`\`\`bash
|
|
1067
|
-
kosui plugin-project --name my-plugin
|
|
1068
|
-
\`\`\`
|
|
1069
|
-
|
|
1070
|
-
2. **Add Components**
|
|
1071
|
-
\`\`\`bash
|
|
1072
|
-
kosui component --name MyComponent --pluginType utility --project my-plugin
|
|
1073
|
-
\`\`\`
|
|
1074
|
-
|
|
1075
|
-
3. **Update Plugin Descriptor**
|
|
1076
|
-
Add contributions to your \`kosdev-plugin.json\` file following the structure examples above.
|
|
1077
|
-
|
|
1078
|
-
4. **Test Integration**
|
|
1079
|
-
Use the Plugin Explorer (Ctrl+Shift+P) to validate your plugin registration.
|
|
1080
|
-
|
|
1081
|
-
### Best Practices
|
|
1082
|
-
|
|
1083
|
-
- **Use descriptive IDs**: Plugin and contribution IDs should be clear and unique
|
|
1084
|
-
- **Follow naming conventions**: Use kebab-case for IDs, PascalCase for components
|
|
1085
|
-
- **Provide meaningful titles**: Titles are shown to users in the interface
|
|
1086
|
-
- **Set appropriate ranks**: Higher numbers = higher priority for rankable contributions
|
|
1087
|
-
- **Include proper metadata**: Namespace helps organize plugins by owner
|
|
1088
|
-
|
|
1089
|
-
### Validation
|
|
1090
|
-
|
|
1091
|
-
Use the Plugin Discovery Service to validate your plugin descriptor:
|
|
1092
|
-
|
|
1093
|
-
\`\`\`typescript
|
|
1094
|
-
import { PluginDiscoveryService } from '@kosdev-code/kos-ui-plugin';
|
|
1095
|
-
|
|
1096
|
-
const validation = PluginDiscoveryService.validatePluginDescriptor(yourDescriptor);
|
|
1097
|
-
console.log(validation.errors); // Check for errors
|
|
1098
|
-
console.log(validation.warnings); // Check for warnings
|
|
1099
|
-
\`\`\`
|
|
1100
|
-
|
|
1101
|
-
`;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Generate troubleshooting section
|
|
1105
|
-
*/
|
|
1106
|
-
static generateTroubleshootingSection() {
|
|
1107
|
-
return `## Troubleshooting
|
|
1108
|
-
|
|
1109
|
-
### Common Issues
|
|
1110
|
-
|
|
1111
|
-
**Plugin not appearing in extension point**
|
|
1112
|
-
- Check plugin descriptor syntax
|
|
1113
|
-
- Verify contribution key matches extension point requirements
|
|
1114
|
-
- Ensure experienceId references exist in experiences section
|
|
1115
|
-
|
|
1116
|
-
**Component fails to load**
|
|
1117
|
-
- Verify component path in experience location
|
|
1118
|
-
- Check module federation configuration
|
|
1119
|
-
- Use Plugin Explorer to see detailed error messages
|
|
1120
|
-
|
|
1121
|
-
**Type errors with simplified extension points**
|
|
1122
|
-
- Ensure extension point is properly imported
|
|
1123
|
-
- Check that component props match expected interface
|
|
1124
|
-
- Verify extension point is registered before use
|
|
1125
|
-
|
|
1126
|
-
### Debugging Tools
|
|
1127
|
-
|
|
1128
|
-
**Plugin Explorer**
|
|
1129
|
-
- Press Ctrl+Shift+P in development mode
|
|
1130
|
-
- View all extension points and their plugins
|
|
1131
|
-
- See plugin health status and capabilities
|
|
1132
|
-
- Test component rendering with error boundaries
|
|
1133
|
-
|
|
1134
|
-
**Validation Service**
|
|
1135
|
-
- Use \`PluginDiscoveryService.validatePluginDescriptor()\`
|
|
1136
|
-
- Check \`PluginDiscoveryService.checkPluginCompatibility()\`
|
|
1137
|
-
- Run \`PluginDiscoveryService.analyzePluginDescriptor()\` for full analysis
|
|
1138
|
-
|
|
1139
|
-
**Browser DevTools**
|
|
1140
|
-
- Check \`window.KosPlugins.extensions\` for runtime state
|
|
1141
|
-
- Look for module federation errors in Network tab
|
|
1142
|
-
- Use React DevTools to inspect component loading
|
|
1143
|
-
|
|
1144
|
-
---
|
|
1145
|
-
|
|
1146
|
-
*Generated by KOS Plugin Documentation Generator*
|
|
1147
|
-
`;
|
|
1148
|
-
}
|
|
1149
|
-
// Helper methods
|
|
1150
|
-
static getExtensionPointImportName(e) {
|
|
1151
|
-
var a;
|
|
1152
|
-
const n = y().getExtensionPoint(e);
|
|
1153
|
-
if ((a = n == null ? void 0 : n.config.metadata) != null && a.exportName)
|
|
1154
|
-
return n.config.metadata.exportName;
|
|
1155
|
-
const r = e.split(".");
|
|
1156
|
-
return (r.length > 1 ? r.slice(1) : r).map(
|
|
1157
|
-
(o) => (
|
|
1158
|
-
// Handle hyphenated parts (e.g., "pump-detail" -> "PumpDetail")
|
|
1159
|
-
o.split("-").map((c) => c.charAt(0).toUpperCase() + c.slice(1)).join("")
|
|
1160
|
-
)
|
|
1161
|
-
).join("") + "Extension";
|
|
1162
|
-
}
|
|
1163
|
-
static getExtensionPointTypeName(e) {
|
|
1164
|
-
return this.getExtensionPointImportName(e) + "Type";
|
|
1165
|
-
}
|
|
1166
|
-
static getHealthEmoji(e) {
|
|
1167
|
-
switch (e) {
|
|
1168
|
-
case "healthy":
|
|
1169
|
-
return "✅";
|
|
1170
|
-
case "warning":
|
|
1171
|
-
return "⚠️";
|
|
1172
|
-
case "error":
|
|
1173
|
-
return "❌";
|
|
1174
|
-
default:
|
|
1175
|
-
return "❓";
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
static inferContributionKey(e) {
|
|
1179
|
-
if (e.source === "simplified") {
|
|
1180
|
-
const a = y().getExtensionPoint(e.id);
|
|
1181
|
-
if (a != null && a.config.contributionKey)
|
|
1182
|
-
return a.config.contributionKey;
|
|
1183
|
-
}
|
|
1184
|
-
const t = e.id.split("."), n = t[t.length - 1];
|
|
1185
|
-
return {
|
|
1186
|
-
cui: "cui",
|
|
1187
|
-
utility: "utilities",
|
|
1188
|
-
utilities: "utilities",
|
|
1189
|
-
setup: "setupStep",
|
|
1190
|
-
settings: "settings",
|
|
1191
|
-
nav: "navViews",
|
|
1192
|
-
troubleAction: "troubleActions",
|
|
1193
|
-
controlPour: "controlPour"
|
|
1194
|
-
}[n] || n + "s";
|
|
1195
|
-
}
|
|
1196
|
-
static isViewBasedExtensionPoint(e) {
|
|
1197
|
-
if (e.source === "simplified") {
|
|
1198
|
-
const n = y().getExtensionPoint(e.id);
|
|
1199
|
-
return (n == null ? void 0 : n.config.hasView) || !1;
|
|
1200
|
-
}
|
|
1201
|
-
return e.plugins.some(
|
|
1202
|
-
(t) => t.experienceId
|
|
1203
|
-
);
|
|
1204
|
-
}
|
|
1205
|
-
static isRankableExtensionPoint(e) {
|
|
1206
|
-
if (e.source === "simplified") {
|
|
1207
|
-
const n = y().getExtensionPoint(e.id);
|
|
1208
|
-
return (n == null ? void 0 : n.config.isRankable) || !1;
|
|
1209
|
-
}
|
|
1210
|
-
return e.plugins.some(
|
|
1211
|
-
(t) => typeof t.rank == "number"
|
|
1212
|
-
);
|
|
1213
|
-
}
|
|
1214
|
-
/**
|
|
1215
|
-
* Get schema fields for contribution structure generation
|
|
1216
|
-
*/
|
|
1217
|
-
static getSchemaFieldsForContribution(e) {
|
|
1218
|
-
if (e.source !== "simplified")
|
|
1219
|
-
return [];
|
|
1220
|
-
const n = y().getExtensionPoint(e.id);
|
|
1221
|
-
return n != null && n.getSchemaFieldInfo ? n.getSchemaFieldInfo() : [];
|
|
1222
|
-
}
|
|
1223
|
-
static getSpecificFields(e) {
|
|
1224
|
-
const t = [];
|
|
1225
|
-
switch (this.inferContributionKey(e)) {
|
|
1226
|
-
case "utilities":
|
|
1227
|
-
t.push('"utilDescriptor": "your-util-descriptor"');
|
|
1228
|
-
break;
|
|
1229
|
-
case "setupStep":
|
|
1230
|
-
t.push('"setupDescriptor": "your-setup-descriptor"');
|
|
1231
|
-
break;
|
|
1232
|
-
case "settings":
|
|
1233
|
-
t.push('"settingsGroup": "your-settings-group"');
|
|
1234
|
-
break;
|
|
1235
|
-
case "navViews":
|
|
1236
|
-
t.push('"navDescriptor": "your-nav-descriptor"');
|
|
1237
|
-
break;
|
|
1238
|
-
case "troubleActions":
|
|
1239
|
-
t.push('"troubleType": "your-trouble-type"');
|
|
1240
|
-
break;
|
|
1241
|
-
case "cui":
|
|
1242
|
-
t.push('"cuiDescriptor": "your-cui-descriptor"');
|
|
1243
|
-
break;
|
|
1244
|
-
}
|
|
1245
|
-
return t;
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
export {
|
|
1249
|
-
O as B,
|
|
1250
|
-
fe as D,
|
|
1251
|
-
I as P,
|
|
1252
|
-
te as R,
|
|
1253
|
-
ce as a,
|
|
1254
|
-
Z as b,
|
|
1255
|
-
y as c,
|
|
1256
|
-
W as d,
|
|
1257
|
-
Y as e,
|
|
1258
|
-
Q as f,
|
|
1259
|
-
re as g,
|
|
1260
|
-
ae as h,
|
|
1261
|
-
oe as i,
|
|
1262
|
-
de as j,
|
|
1263
|
-
ne as k,
|
|
1264
|
-
J as l,
|
|
1265
|
-
C as m,
|
|
1266
|
-
pe as n,
|
|
1267
|
-
ge as o,
|
|
1268
|
-
ue as r,
|
|
1269
|
-
le as v
|
|
1270
|
-
};
|
|
1271
|
-
//# sourceMappingURL=documentation-generator-B8FuhDjB.js.map
|