@kosdev-code/kos-ui-plugin 2.1.9 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ Object.defineProperty(E, "__esModule", { value: !0 });
23
23
  E.loadRemoteModule = E.setRemoteDefinitions = E.setRemoteUrlResolver = void 0;
24
24
  let R, D;
25
25
  const O = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
26
- let j = !1;
26
+ let N = !1;
27
27
  function J(n) {
28
28
  D = n;
29
29
  }
@@ -58,7 +58,7 @@ const Q = (n, t) => new Promise((e, i) => {
58
58
  async function X(n) {
59
59
  if (!D && !R)
60
60
  throw new Error("Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.");
61
- j || (j = !0, await __webpack_init_sharing__("default"));
61
+ N || (N = !0, await __webpack_init_sharing__("default"));
62
62
  const t = R ? R[n] : await D(n);
63
63
  let e = t;
64
64
  !t.endsWith(".mjs") && !t.endsWith(".js") && (e = `${t}${t.endsWith("/") ? "" : "/"}remoteEntry.js`);
@@ -78,8 +78,17 @@ async function X(n) {
78
78
  })(F);
79
79
  const Ne = /* @__PURE__ */ z({
80
80
  __proto__: null
81
- }, [F]);
81
+ }, [F]), V = [];
82
82
  function ee(n) {
83
+ V.push(n);
84
+ }
85
+ function te(n, t, e) {
86
+ return V.reduce(
87
+ (i, s) => s(i, t, e),
88
+ n
89
+ );
90
+ }
91
+ function ne(n) {
83
92
  var t;
84
93
  try {
85
94
  if ("shape" in n) {
@@ -104,7 +113,7 @@ function ee(n) {
104
113
  return console.warn("Failed to extract schema field info:", e), [];
105
114
  }
106
115
  }
107
- class te {
116
+ class ie {
108
117
  constructor() {
109
118
  C(this, "issues", []);
110
119
  }
@@ -127,7 +136,7 @@ class te {
127
136
  return [...this.issues];
128
137
  }
129
138
  }
130
- class ne {
139
+ class se {
131
140
  constructor() {
132
141
  C(this, "cache", /* @__PURE__ */ new Map());
133
142
  }
@@ -141,20 +150,10 @@ class ne {
141
150
  this.cache.clear();
142
151
  }
143
152
  }
144
- const I = new ne();
153
+ const I = new se();
145
154
  function Ke(n) {
146
155
  return I.get(n);
147
156
  }
148
- const K = [];
149
- function ie(n) {
150
- K.push(n);
151
- }
152
- function se(n, t, e) {
153
- return K.reduce(
154
- (i, s) => s(i, t, e),
155
- n
156
- );
157
- }
158
157
  class oe {
159
158
  constructor() {
160
159
  C(this, "extensionPoints", /* @__PURE__ */ new Map());
@@ -173,10 +172,10 @@ class oe {
173
172
  return;
174
173
  }
175
174
  const i = this.createReducer(t);
176
- ie(i), e.isRegistered = !0;
175
+ ee(i), e.isRegistered = !0;
177
176
  }
178
177
  };
179
- return t.schema && (e.getSchemaFieldInfo = () => ee(t.schema)), this.extensionPoints.set(t.id, e), e;
178
+ return t.schema && (e.getSchemaFieldInfo = () => ne(t.schema)), this.extensionPoints.set(t.id, e), e;
180
179
  }
181
180
  createReducer(t) {
182
181
  return (e, i, s) => {
@@ -193,7 +192,7 @@ class oe {
193
192
  contributions: i
194
193
  };
195
194
  if (t.validate) {
196
- const d = new te();
195
+ const d = new ie();
197
196
  if (t.validate(
198
197
  r,
199
198
  d
@@ -277,10 +276,21 @@ class oe {
277
276
  hasExtensionPoint(t) {
278
277
  return this.extensionPoints.has(t);
279
278
  }
279
+ /**
280
+ * Get the Zod schema for an extension point
281
+ * Returns undefined if the extension point doesn't have a schema
282
+ */
283
+ getExtensionPointSchema(t) {
284
+ const e = this.extensionPoints.get(t);
285
+ return e == null ? void 0 : e.config.schema;
286
+ }
280
287
  }
281
- const V = new oe();
288
+ const A = new oe();
282
289
  function b() {
283
- return V;
290
+ return A;
291
+ }
292
+ function Ve(n) {
293
+ return A.getExtensionPointSchema(n);
284
294
  }
285
295
  function re(n = {}) {
286
296
  const {
@@ -299,7 +309,7 @@ function re(n = {}) {
299
309
  };
300
310
  }
301
311
  function ae(n) {
302
- return V.define(n);
312
+ return A.define(n);
303
313
  }
304
314
  const ce = {
305
315
  $timestamp: () => Date.now(),
@@ -521,7 +531,7 @@ function S(n, t) {
521
531
  }
522
532
  const Re = (n) => (t, e) => {
523
533
  var c;
524
- const i = n[e].remote, s = e, o = ((c = n[e].contributes) == null ? void 0 : c.experiences) ?? {};
534
+ const i = n[e].remote, s = n[e].section || "default", o = ((c = n[e].contributes) == null ? void 0 : c.experiences) ?? {};
525
535
  return Object.keys(o).forEach((l) => {
526
536
  const u = o[l];
527
537
  t.experiences[l] = {
@@ -567,14 +577,14 @@ async function Ie(n) {
567
577
  );
568
578
  return window.KosPlugins.extensions = i, { extensionPoints: i, getExtensions: (o) => i[o] || [], remotes: t, extensions: e };
569
579
  }
570
- const N = {
580
+ const K = {
571
581
  controlPourDefinitions: {},
572
582
  experiences: {}
573
583
  };
574
584
  function Se(n) {
575
585
  return n ? Object.keys(n).reduce(Re(n), {
576
- ...N
577
- }) : N;
586
+ ...K
587
+ }) : K;
578
588
  }
579
589
  async function Fe(n) {
580
590
  if (!n)
@@ -618,14 +628,14 @@ async function Fe(n) {
618
628
  console.warn(`Failed to load InitPlugin from ${o.remote}:`, a);
619
629
  }
620
630
  }
621
- const t = Se(n), e = t.experiences, s = se(
631
+ const t = Se(n), e = t.experiences, s = te(
622
632
  {},
623
633
  t,
624
634
  e
625
635
  );
626
636
  return window.KosPlugins = window.KosPlugins || {}, window.KosPlugins.__extensions = s, s;
627
637
  }
628
- async function Ve(n) {
638
+ async function Me(n) {
629
639
  const { getExtensions: t } = await Ie();
630
640
  return t(n);
631
641
  }
@@ -635,7 +645,7 @@ const _e = (n = null) => (n || window.location.search.replace("?", "")).split("&
635
645
  }).reduce((t, [e, i]) => (t[e] = i, t), {}), Oe = () => {
636
646
  const n = window.location.origin, t = _e();
637
647
  return (t == null ? void 0 : t.host) || n;
638
- }, Me = async (n) => {
648
+ }, Le = async (n) => {
639
649
  var x;
640
650
  const t = Oe(), e = n ?? {}, {
641
651
  pluginBaseUrl: i = t,
@@ -646,10 +656,12 @@ const _e = (n = null) => (n || window.location.search.replace("?", "")).split("&
646
656
  console.log(
647
657
  `initialize-plugins: Using Plugin Framework. Fetching plugins from ${r}`
648
658
  );
649
- const l = await (await fetch(r)).json(), u = typeof (a == null ? void 0 : a.context) == "string" ? [a.context] : (a == null ? void 0 : a.context) || [], f = ((x = l.data) == null ? void 0 : x.filter((m) => u.length === 0 || u.includes(m.name)).flatMap((m) => m.plugins)) ?? [], h = a == null ? void 0 : a.group, d = f == null ? void 0 : f.reduce((m, g) => {
659
+ const l = await (await fetch(r)).json(), u = typeof (a == null ? void 0 : a.context) == "string" ? [a.context] : (a == null ? void 0 : a.context) || [], f = (x = l.data) == null ? void 0 : x.filter((m) => u.length === 0 || u.includes(m.name)).flatMap(
660
+ (m) => m.plugins.map((g) => ({ ...g, name: m.name })) ?? []
661
+ ), h = a == null ? void 0 : a.group, d = f == null ? void 0 : f.reduce((m, g) => {
650
662
  const _ = (o == null ? void 0 : o[g.id]) ?? `${i}${g.path}`;
651
663
  if (g.descriptor) {
652
- const A = (g.descriptor.extensions || []).reduce((P, y) => {
664
+ const j = (g.descriptor.extensions || []).reduce((P, y) => {
653
665
  const k = y.groups || [];
654
666
  return (!h || k.includes(h)) && P.push(y), P;
655
667
  }, []), v = g.descriptor.contributes || {};
@@ -667,10 +679,11 @@ const _e = (n = null) => (n || window.location.search.replace("?", "")).split("&
667
679
  return P;
668
680
  },
669
681
  {}
670
- ), q = !!g.descriptor.init && (A.length > 0 || $);
682
+ ), q = !!g.descriptor.init && (j.length > 0 || $);
671
683
  m[g.id] = {
684
+ section: g.name,
672
685
  basePath: `${_}remoteEntry.js`,
673
- extensions: A,
686
+ extensions: j,
674
687
  contributes: L,
675
688
  remote: g.descriptor.id,
676
689
  init: q
@@ -688,7 +701,7 @@ const _e = (n = null) => (n || window.location.search.replace("?", "")).split("&
688
701
  }, {});
689
702
  return F.setRemoteDefinitions(p), p;
690
703
  };
691
- function Le(n, t, e = !1) {
704
+ function qe(n, t, e = !1) {
692
705
  return !n || Object.keys(n).length === 0 ? null : e ? t && n[t] ? n[t] : null : t && n[t] ? n[t] : Object.values(n).filter((s) => typeof s.id == "string").sort((s, o) => {
693
706
  const a = typeof s.rank == "number" ? s.rank : 1 / 0, r = typeof o.rank == "number" ? o.rank : 1 / 0;
694
707
  if (a === r) {
@@ -706,13 +719,13 @@ const M = w.object({
706
719
  }), Te = M.extend({
707
720
  rank: w.number().int().min(0).optional().describe("Optional ranking for ordering (higher = preferred)")
708
721
  });
709
- function qe(n, t, e) {
722
+ function Be(n, t, e) {
710
723
  const i = n.safeParse(t);
711
724
  return i.success ? !0 : (i.error.errors.forEach((s) => {
712
725
  e.addError(`${s.path.join(".")}: ${s.message}`);
713
726
  }), !1);
714
727
  }
715
- function Be(n, t, e) {
728
+ function He(n, t, e) {
716
729
  t && !t.includes(".") && e.addWarning(
717
730
  `${n} '${t}' should typically include dot notation (e.g., 'category.item')`
718
731
  );
@@ -722,10 +735,10 @@ function De(n, t, e = 1e3) {
722
735
  `Rank ${n} seems unusually high - consider using lower values for better ordering`
723
736
  );
724
737
  }
725
- function He(n, t = {}) {
738
+ function We(n, t = {}) {
726
739
  return (t.rankable ? Te : M).extend(n);
727
740
  }
728
- function We(n, t, e = 1e3) {
741
+ function Ge(n, t, e = 1e3) {
729
742
  typeof n == "object" && n !== null && "rank" in n && De(n.rank, t, e);
730
743
  }
731
744
  class T {
@@ -980,7 +993,7 @@ class T {
980
993
  };
981
994
  }
982
995
  }
983
- class Ge {
996
+ class ze {
984
997
  /**
985
998
  * Generate complete documentation for all extension points
986
999
  */
@@ -1520,27 +1533,28 @@ console.log(validation.warnings); // Check for warnings
1520
1533
  }
1521
1534
  export {
1522
1535
  M as B,
1523
- Ge as D,
1536
+ ze as D,
1524
1537
  T as P,
1525
1538
  Te as R,
1526
- Me as a,
1539
+ Le as a,
1527
1540
  Ie as b,
1528
1541
  b as c,
1529
1542
  Re as d,
1530
1543
  Se as e,
1531
- Ve as f,
1544
+ Me as f,
1532
1545
  Ke as g,
1533
1546
  ae as h,
1534
1547
  Ne as i,
1535
- re as j,
1536
- V as k,
1548
+ Ve as j,
1549
+ A as k,
1537
1550
  Fe as l,
1538
1551
  F as m,
1539
- Be as n,
1540
- De as o,
1541
- He as p,
1552
+ re as n,
1553
+ He as o,
1554
+ De as p,
1542
1555
  We as q,
1543
- Le as r,
1544
- qe as v
1556
+ qe as r,
1557
+ Ge as s,
1558
+ Be as v
1545
1559
  };
1546
- //# sourceMappingURL=documentation-generator-7qgOfgJZ.js.map
1560
+ //# sourceMappingURL=documentation-generator-auruIa_o.js.map