@nldoc/validation 1.0.0 → 2.0.0
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/LICENSE +291 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +282 -270
- package/package.json +14 -5
package/dist/index.mjs
CHANGED
|
@@ -1,77 +1,89 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import ce, { useMemo as pe, useState as H, useEffect as C, createContext as me, useContext as ge, useRef as de, useReducer as Ee, useCallback as he, useLayoutEffect as Se } from "react";
|
|
2
|
+
import { ContentType as ee, useConversion as Ie } from "@nldoc/api";
|
|
3
|
+
import { useDebounce as be } from "use-debounce";
|
|
4
|
+
import { TransactionMeta as ke } from "@nldoc/tiptap-extensions";
|
|
5
|
+
function ve(n, t = {}) {
|
|
6
|
+
const {
|
|
7
|
+
debounceDelay: r = 500,
|
|
8
|
+
debounceMaxWait: o = 5e3,
|
|
9
|
+
includeAssets: s = !1,
|
|
10
|
+
apiRoute: a = void 0
|
|
11
|
+
} = t, [d] = be(n, r, { maxWait: o }), p = pe(() => {
|
|
12
|
+
if (!d) return null;
|
|
13
|
+
const b = s ? d : {
|
|
14
|
+
...d,
|
|
15
|
+
attrs: { ...d.attrs, assets: {} }
|
|
13
16
|
};
|
|
14
|
-
return new Blob([JSON.stringify(
|
|
15
|
-
}, [
|
|
16
|
-
return
|
|
17
|
+
return new Blob([JSON.stringify(b)], { type: ee.Tiptap });
|
|
18
|
+
}, [d, s]);
|
|
19
|
+
return Ie(p, ee.Validation, a);
|
|
17
20
|
}
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
const Re = new Error("An unknown error occurred");
|
|
22
|
+
function xe(n) {
|
|
23
|
+
return Array.isArray(n);
|
|
24
|
+
}
|
|
25
|
+
function Te(n, t = {}) {
|
|
26
|
+
const r = ve(n, t), [o, s] = H(!1), [a, d] = H([]), [p, b] = H(null);
|
|
27
|
+
return C(() => {
|
|
28
|
+
switch (r.status) {
|
|
29
|
+
case "error":
|
|
30
|
+
s(!1), b(r.error);
|
|
31
|
+
return;
|
|
32
|
+
case "idle":
|
|
33
|
+
s(!1);
|
|
34
|
+
return;
|
|
35
|
+
case "uploading":
|
|
36
|
+
case "converting":
|
|
37
|
+
case "progress":
|
|
38
|
+
s(!0);
|
|
39
|
+
return;
|
|
40
|
+
case "done": {
|
|
41
|
+
try {
|
|
42
|
+
const E = typeof r.content == "string" ? r.content : new TextDecoder().decode(r.content), i = JSON.parse(E);
|
|
43
|
+
if (!xe(i))
|
|
44
|
+
throw new Error("Invalid validation findings format");
|
|
45
|
+
d((g) => JSON.stringify(g) === JSON.stringify(i) ? g : i), b(null);
|
|
46
|
+
} catch (E) {
|
|
47
|
+
b(E instanceof Error ? E : Re);
|
|
48
|
+
} finally {
|
|
49
|
+
s(!1);
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
41
53
|
}
|
|
42
|
-
}, [r]), { isValidating: o, findings:
|
|
54
|
+
}, [r]), { isValidating: o, findings: a, error: p };
|
|
43
55
|
}
|
|
44
56
|
var V = { exports: {} }, G = {};
|
|
45
57
|
var ne;
|
|
46
|
-
function
|
|
58
|
+
function _e() {
|
|
47
59
|
if (ne) return G;
|
|
48
60
|
ne = 1;
|
|
49
61
|
var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
50
|
-
function r(o, s,
|
|
51
|
-
var
|
|
52
|
-
if (
|
|
53
|
-
|
|
62
|
+
function r(o, s, a) {
|
|
63
|
+
var d = null;
|
|
64
|
+
if (a !== void 0 && (d = "" + a), s.key !== void 0 && (d = "" + s.key), "key" in s) {
|
|
65
|
+
a = {};
|
|
54
66
|
for (var p in s)
|
|
55
|
-
p !== "key" && (
|
|
56
|
-
} else
|
|
57
|
-
return s =
|
|
67
|
+
p !== "key" && (a[p] = s[p]);
|
|
68
|
+
} else a = s;
|
|
69
|
+
return s = a.ref, {
|
|
58
70
|
$$typeof: n,
|
|
59
71
|
type: o,
|
|
60
|
-
key:
|
|
72
|
+
key: d,
|
|
61
73
|
ref: s !== void 0 ? s : null,
|
|
62
|
-
props:
|
|
74
|
+
props: a
|
|
63
75
|
};
|
|
64
76
|
}
|
|
65
77
|
return G.Fragment = t, G.jsx = r, G.jsxs = r, G;
|
|
66
78
|
}
|
|
67
79
|
var U = {};
|
|
68
80
|
var te;
|
|
69
|
-
function
|
|
81
|
+
function Ne() {
|
|
70
82
|
return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
71
83
|
function n(e) {
|
|
72
84
|
if (e == null) return null;
|
|
73
85
|
if (typeof e == "function")
|
|
74
|
-
return e.$$typeof ===
|
|
86
|
+
return e.$$typeof === z ? null : e.displayName || e.name || null;
|
|
75
87
|
if (typeof e == "string") return e;
|
|
76
88
|
switch (e) {
|
|
77
89
|
case y:
|
|
@@ -82,7 +94,7 @@ function Ae() {
|
|
|
82
94
|
return "StrictMode";
|
|
83
95
|
case _:
|
|
84
96
|
return "Suspense";
|
|
85
|
-
case
|
|
97
|
+
case q:
|
|
86
98
|
return "SuspenseList";
|
|
87
99
|
case W:
|
|
88
100
|
return "Activity";
|
|
@@ -93,11 +105,11 @@ function Ae() {
|
|
|
93
105
|
), e.$$typeof) {
|
|
94
106
|
case m:
|
|
95
107
|
return "Portal";
|
|
96
|
-
case
|
|
108
|
+
case l:
|
|
97
109
|
return e.displayName || "Context";
|
|
98
110
|
case S:
|
|
99
111
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
100
|
-
case
|
|
112
|
+
case O:
|
|
101
113
|
var f = e.render;
|
|
102
114
|
return e = e.displayName, e || (e = f.displayName || f.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
103
115
|
case M:
|
|
@@ -123,11 +135,11 @@ function Ae() {
|
|
|
123
135
|
}
|
|
124
136
|
if (f) {
|
|
125
137
|
f = console;
|
|
126
|
-
var I = f.error,
|
|
138
|
+
var I = f.error, R = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
127
139
|
return I.call(
|
|
128
140
|
f,
|
|
129
141
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
130
|
-
|
|
142
|
+
R
|
|
131
143
|
), t(e);
|
|
132
144
|
}
|
|
133
145
|
}
|
|
@@ -146,10 +158,10 @@ function Ae() {
|
|
|
146
158
|
var e = D.A;
|
|
147
159
|
return e === null ? null : e.getOwner();
|
|
148
160
|
}
|
|
149
|
-
function
|
|
161
|
+
function a() {
|
|
150
162
|
return Error("react-stack-top-frame");
|
|
151
163
|
}
|
|
152
|
-
function
|
|
164
|
+
function d(e) {
|
|
153
165
|
if (B.call(e, "key")) {
|
|
154
166
|
var f = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
155
167
|
if (f && f.isReactWarning) return !1;
|
|
@@ -174,14 +186,14 @@ function Ae() {
|
|
|
174
186
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
175
187
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
176
188
|
}
|
|
177
|
-
function E(e, f, I,
|
|
189
|
+
function E(e, f, I, R, F, J) {
|
|
178
190
|
var x = I.ref;
|
|
179
191
|
return e = {
|
|
180
|
-
$$typeof:
|
|
192
|
+
$$typeof: v,
|
|
181
193
|
type: e,
|
|
182
194
|
key: f,
|
|
183
195
|
props: I,
|
|
184
|
-
_owner:
|
|
196
|
+
_owner: R
|
|
185
197
|
}, (x !== void 0 ? x : null) !== null ? Object.defineProperty(e, "ref", {
|
|
186
198
|
enumerable: !1,
|
|
187
199
|
get: b
|
|
@@ -207,13 +219,13 @@ function Ae() {
|
|
|
207
219
|
value: J
|
|
208
220
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
209
221
|
}
|
|
210
|
-
function
|
|
222
|
+
function i(e, f, I, R, F, J) {
|
|
211
223
|
var x = f.children;
|
|
212
224
|
if (x !== void 0)
|
|
213
|
-
if (
|
|
225
|
+
if (R)
|
|
214
226
|
if (Y(x)) {
|
|
215
|
-
for (
|
|
216
|
-
g(x[
|
|
227
|
+
for (R = 0; R < x.length; R++)
|
|
228
|
+
g(x[R]);
|
|
217
229
|
Object.freeze && Object.freeze(x);
|
|
218
230
|
} else
|
|
219
231
|
console.error(
|
|
@@ -222,23 +234,23 @@ function Ae() {
|
|
|
222
234
|
else g(x);
|
|
223
235
|
if (B.call(f, "key")) {
|
|
224
236
|
x = n(e);
|
|
225
|
-
var
|
|
237
|
+
var w = Object.keys(f).filter(function(fe) {
|
|
226
238
|
return fe !== "key";
|
|
227
239
|
});
|
|
228
|
-
|
|
240
|
+
R = 0 < w.length ? "{key: someKey, " + w.join(": ..., ") + ": ...}" : "{key: someKey}", Q[x + R] || (w = 0 < w.length ? "{" + w.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
229
241
|
`A props object containing a "key" prop is being spread into JSX:
|
|
230
242
|
let props = %s;
|
|
231
243
|
<%s {...props} />
|
|
232
244
|
React keys must be passed directly to JSX without using spread:
|
|
233
245
|
let props = %s;
|
|
234
246
|
<%s key={someKey} {...props} />`,
|
|
235
|
-
|
|
247
|
+
R,
|
|
236
248
|
x,
|
|
237
|
-
|
|
249
|
+
w,
|
|
238
250
|
x
|
|
239
|
-
), Q[x +
|
|
251
|
+
), Q[x + R] = !0);
|
|
240
252
|
}
|
|
241
|
-
if (x = null, I !== void 0 && (r(I), x = "" + I),
|
|
253
|
+
if (x = null, I !== void 0 && (r(I), x = "" + I), d(f) && (r(f.key), x = "" + f.key), "key" in f) {
|
|
242
254
|
I = {};
|
|
243
255
|
for (var K in f)
|
|
244
256
|
K !== "key" && (I[K] = f[K]);
|
|
@@ -259,9 +271,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
259
271
|
T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === P && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
260
272
|
}
|
|
261
273
|
function T(e) {
|
|
262
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
274
|
+
return typeof e == "object" && e !== null && e.$$typeof === v;
|
|
263
275
|
}
|
|
264
|
-
var k = ce,
|
|
276
|
+
var k = ce, v = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), y = /* @__PURE__ */ Symbol.for("react.fragment"), c = /* @__PURE__ */ Symbol.for("react.strict_mode"), h = /* @__PURE__ */ Symbol.for("react.profiler"), S = /* @__PURE__ */ Symbol.for("react.consumer"), l = /* @__PURE__ */ Symbol.for("react.context"), O = /* @__PURE__ */ Symbol.for("react.forward_ref"), _ = /* @__PURE__ */ Symbol.for("react.suspense"), q = /* @__PURE__ */ Symbol.for("react.suspense_list"), M = /* @__PURE__ */ Symbol.for("react.memo"), P = /* @__PURE__ */ Symbol.for("react.lazy"), W = /* @__PURE__ */ Symbol.for("react.activity"), z = /* @__PURE__ */ Symbol.for("react.client.reference"), D = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, Y = Array.isArray, A = console.createTask ? console.createTask : function() {
|
|
265
277
|
return null;
|
|
266
278
|
};
|
|
267
279
|
k = {
|
|
@@ -271,102 +283,102 @@ React keys must be passed directly to JSX without using spread:
|
|
|
271
283
|
};
|
|
272
284
|
var j, $ = {}, X = k.react_stack_bottom_frame.bind(
|
|
273
285
|
k,
|
|
274
|
-
|
|
275
|
-
)(), Z = A(o(
|
|
286
|
+
a
|
|
287
|
+
)(), Z = A(o(a)), Q = {};
|
|
276
288
|
U.Fragment = y, U.jsx = function(e, f, I) {
|
|
277
|
-
var
|
|
278
|
-
return
|
|
289
|
+
var R = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
290
|
+
return i(
|
|
279
291
|
e,
|
|
280
292
|
f,
|
|
281
293
|
I,
|
|
282
294
|
!1,
|
|
283
|
-
|
|
284
|
-
|
|
295
|
+
R ? Error("react-stack-top-frame") : X,
|
|
296
|
+
R ? A(o(e)) : Z
|
|
285
297
|
);
|
|
286
298
|
}, U.jsxs = function(e, f, I) {
|
|
287
|
-
var
|
|
288
|
-
return
|
|
299
|
+
var R = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
300
|
+
return i(
|
|
289
301
|
e,
|
|
290
302
|
f,
|
|
291
303
|
I,
|
|
292
304
|
!0,
|
|
293
|
-
|
|
294
|
-
|
|
305
|
+
R ? Error("react-stack-top-frame") : X,
|
|
306
|
+
R ? A(o(e)) : Z
|
|
295
307
|
);
|
|
296
308
|
};
|
|
297
309
|
})()), U;
|
|
298
310
|
}
|
|
299
311
|
var re;
|
|
300
|
-
function
|
|
301
|
-
return re || (re = 1, process.env.NODE_ENV === "production" ? V.exports =
|
|
312
|
+
function ye() {
|
|
313
|
+
return re || (re = 1, process.env.NODE_ENV === "production" ? V.exports = _e() : V.exports = Ne()), V.exports;
|
|
302
314
|
}
|
|
303
|
-
var
|
|
304
|
-
const ue =
|
|
315
|
+
var u = ye();
|
|
316
|
+
const ue = me({
|
|
305
317
|
findings: [],
|
|
306
318
|
isValidating: !1,
|
|
307
319
|
error: null
|
|
308
320
|
});
|
|
309
|
-
function
|
|
321
|
+
function Ke({
|
|
310
322
|
children: n,
|
|
311
323
|
editor: t,
|
|
312
324
|
editorJSON: r,
|
|
313
325
|
options: o,
|
|
314
326
|
autoApplyFindings: s = !0,
|
|
315
|
-
onApplyFindings:
|
|
327
|
+
onApplyFindings: a
|
|
316
328
|
}) {
|
|
317
|
-
const [
|
|
329
|
+
const [d, p] = H(
|
|
318
330
|
() => r !== void 0 ? null : t?.getJSON() ?? null
|
|
319
331
|
);
|
|
320
|
-
|
|
332
|
+
C(() => {
|
|
321
333
|
if (!t || r !== void 0) return;
|
|
322
|
-
const
|
|
334
|
+
const i = ({
|
|
323
335
|
editor: g,
|
|
324
336
|
transaction: T
|
|
325
337
|
}) => {
|
|
326
|
-
T.getMeta(
|
|
338
|
+
T.getMeta(ke.blockValidation) !== !0 && p(g.getJSON());
|
|
327
339
|
};
|
|
328
|
-
return t.on("update",
|
|
329
|
-
t.off("update",
|
|
340
|
+
return t.on("update", i), () => {
|
|
341
|
+
t.off("update", i);
|
|
330
342
|
};
|
|
331
343
|
}, [t, r]);
|
|
332
|
-
const E =
|
|
333
|
-
return
|
|
344
|
+
const E = Te(r ?? d, o);
|
|
345
|
+
return C(() => {
|
|
334
346
|
if (!(!t || !s))
|
|
335
|
-
if (
|
|
336
|
-
|
|
347
|
+
if (a)
|
|
348
|
+
a(t, E.findings);
|
|
337
349
|
else {
|
|
338
|
-
const
|
|
339
|
-
|
|
350
|
+
const i = t.commands;
|
|
351
|
+
i.setValidationFindings && i.setValidationFindings(E.findings);
|
|
340
352
|
}
|
|
341
|
-
}, [t, E.findings, s,
|
|
353
|
+
}, [t, E.findings, s, a]), /* @__PURE__ */ u.jsx(ue.Provider, { value: E, children: n });
|
|
342
354
|
}
|
|
343
|
-
function
|
|
344
|
-
return
|
|
355
|
+
function qe() {
|
|
356
|
+
return ge(ue);
|
|
345
357
|
}
|
|
346
|
-
const
|
|
358
|
+
const Ae = ({
|
|
347
359
|
findings: n,
|
|
348
360
|
isBundle: t = !1,
|
|
349
361
|
variant: r = "default",
|
|
350
362
|
stackAmount: o,
|
|
351
363
|
stackIsExpanded: s,
|
|
352
|
-
stackOnToggle:
|
|
353
|
-
onResolve:
|
|
364
|
+
stackOnToggle: a,
|
|
365
|
+
onResolve: d,
|
|
354
366
|
onRetrigger: p,
|
|
355
367
|
isExpanded: b,
|
|
356
368
|
onToggle: E,
|
|
357
|
-
labels:
|
|
369
|
+
labels: i = {},
|
|
358
370
|
renderIcon: g,
|
|
359
371
|
renderMessage: T,
|
|
360
372
|
renderResolution: k,
|
|
361
|
-
className:
|
|
373
|
+
className: v = "",
|
|
362
374
|
styles: m = {}
|
|
363
375
|
}) => {
|
|
364
376
|
const y = de(null), [c, h] = ce.useState(!1), S = r === "stack";
|
|
365
|
-
if (S && (o === void 0 || s === void 0 || !
|
|
377
|
+
if (S && (o === void 0 || s === void 0 || !a))
|
|
366
378
|
return console.error(
|
|
367
379
|
'ValidationResult: stackAmount, stackIsExpanded, and stackOnToggle are required when variant="stack"'
|
|
368
380
|
), null;
|
|
369
|
-
const
|
|
381
|
+
const l = S ? s : b ?? c, O = S ? a : E ?? (() => h(!c)), _ = n[0], M = g ?? ((A) => {
|
|
370
382
|
const j = {
|
|
371
383
|
error: "⚠️",
|
|
372
384
|
warning: "⚠️",
|
|
@@ -374,55 +386,55 @@ const Le = ({
|
|
|
374
386
|
close: "✕",
|
|
375
387
|
chevron: "▼"
|
|
376
388
|
};
|
|
377
|
-
return /* @__PURE__ */
|
|
378
|
-
}), W = T ?? ((A, j, $) => $ ? `${j} ${A.rule} findings` : j > 1 ? `${j} ${A.rule} findings` : A.rule), D = k ?? ((A, j) => /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ u.jsx("span", { children: j[A] });
|
|
390
|
+
}), W = T ?? ((A, j, $) => $ ? `${j} ${A.rule} findings` : j > 1 ? `${j} ${A.rule} findings` : A.rule), D = k ?? ((A, j) => /* @__PURE__ */ u.jsx(
|
|
379
391
|
"button",
|
|
380
392
|
{
|
|
381
393
|
onClick: () => {
|
|
382
|
-
|
|
394
|
+
d && d(A), j();
|
|
383
395
|
},
|
|
384
396
|
children: "Resolve"
|
|
385
397
|
}
|
|
386
398
|
)), B = () => {
|
|
387
399
|
p && p();
|
|
388
|
-
}, Y = /* @__PURE__ */
|
|
400
|
+
}, Y = /* @__PURE__ */ u.jsxs(
|
|
389
401
|
"div",
|
|
390
402
|
{
|
|
391
|
-
className: `${m.outerWrapper ?? ""} ${
|
|
403
|
+
className: `${m.outerWrapper ?? ""} ${v}`,
|
|
392
404
|
ref: S ? null : y,
|
|
393
405
|
children: [
|
|
394
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ u.jsx(
|
|
395
407
|
"button",
|
|
396
408
|
{
|
|
397
|
-
className: `${m.toggleButton ?? ""} ${
|
|
398
|
-
onClick:
|
|
409
|
+
className: `${m.toggleButton ?? ""} ${l ? m.toggleButtonSelected ?? "" : ""}`,
|
|
410
|
+
onClick: O,
|
|
399
411
|
"aria-controls": `comment-${t ? "" : "inner-"}${_.resourceId}`,
|
|
400
|
-
"aria-expanded":
|
|
401
|
-
"aria-label":
|
|
412
|
+
"aria-expanded": l,
|
|
413
|
+
"aria-label": i.toggleFinding ?? "Toggle finding details",
|
|
402
414
|
"data-testid": "toggle-button",
|
|
403
|
-
children: /* @__PURE__ */
|
|
415
|
+
children: /* @__PURE__ */ u.jsx("div", { className: m.dropShadow ?? "", children: S ? /* @__PURE__ */ u.jsx("div", { className: m.amount ?? "", children: /* @__PURE__ */ u.jsx("strong", { children: o }) }) : M(l ? "close" : _.severity) })
|
|
404
416
|
}
|
|
405
417
|
),
|
|
406
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ u.jsxs(
|
|
407
419
|
"div",
|
|
408
420
|
{
|
|
409
|
-
className: `${m.result ?? ""} ${m.resultSeverity ? `${m.resultSeverity}-${_.severity}` : ""} ${
|
|
421
|
+
className: `${m.result ?? ""} ${m.resultSeverity ? `${m.resultSeverity}-${_.severity}` : ""} ${l ? m.resultSelected ?? "" : ""}`,
|
|
410
422
|
id: `comment-${t ? "" : "inner-"}${_.resourceId}`,
|
|
411
423
|
tabIndex: -1,
|
|
412
424
|
"aria-live": "polite",
|
|
413
425
|
children: [
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ u.jsxs("div", { className: m.messageWrapper ?? "", children: [
|
|
427
|
+
/* @__PURE__ */ u.jsxs("div", { className: m.label ?? "", children: [
|
|
416
428
|
M(_.severity),
|
|
417
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ u.jsx("strong", { children: i.severity?.[_.severity] ?? _.severity })
|
|
418
430
|
] }),
|
|
419
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ u.jsx("div", { className: m.message ?? "", children: W(
|
|
420
432
|
_,
|
|
421
433
|
S ? o ?? 0 : n.length,
|
|
422
434
|
t
|
|
423
435
|
) })
|
|
424
436
|
] }),
|
|
425
|
-
S ? /* @__PURE__ */
|
|
437
|
+
S ? /* @__PURE__ */ u.jsx("div", { className: m.openValidations ?? "", children: /* @__PURE__ */ u.jsx("button", { onClick: a, children: i.toggleStackOpen ?? "Open validations" }) }) : /* @__PURE__ */ u.jsx("div", { className: m.resolution ?? "", children: D(
|
|
426
438
|
n.map((A) => A.resourceId),
|
|
427
439
|
B
|
|
428
440
|
) })
|
|
@@ -432,56 +444,56 @@ const Le = ({
|
|
|
432
444
|
]
|
|
433
445
|
}
|
|
434
446
|
);
|
|
435
|
-
return S ? /* @__PURE__ */
|
|
447
|
+
return S ? /* @__PURE__ */ u.jsxs("div", { className: m.stack ?? "", children: [
|
|
436
448
|
Y,
|
|
437
|
-
o === 2 ? /* @__PURE__ */
|
|
449
|
+
o === 2 ? /* @__PURE__ */ u.jsx("div", { className: m.stackDecorationTwoItems ?? "" }) : /* @__PURE__ */ u.jsx("div", { className: m.stackDecorationManyItems ?? "", children: /* @__PURE__ */ u.jsx("div", { className: m.stackDecorationManyItems ?? "" }) })
|
|
438
450
|
] }) : Y;
|
|
439
|
-
},
|
|
440
|
-
function
|
|
451
|
+
}, je = ["no-underline", "style-bold-in-header", "style-italic-in-header"];
|
|
452
|
+
function Oe(n, t) {
|
|
441
453
|
const r = /* @__PURE__ */ new Map();
|
|
442
454
|
for (const s of n) {
|
|
443
|
-
if (!
|
|
444
|
-
const
|
|
445
|
-
if (!
|
|
446
|
-
const
|
|
447
|
-
|
|
455
|
+
if (!je.includes(s.rule) || s.hidden) continue;
|
|
456
|
+
const a = t.get(s.resourceId);
|
|
457
|
+
if (!a) continue;
|
|
458
|
+
const d = r.get(a);
|
|
459
|
+
d ? d.push(s) : r.set(a, [s]);
|
|
448
460
|
}
|
|
449
461
|
const o = [];
|
|
450
|
-
for (const [s,
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
462
|
+
for (const [s, a] of r) {
|
|
463
|
+
if (a.length < 2) continue;
|
|
464
|
+
const d = [...a].sort((p, b) => p.desiredYLocation - b.desiredYLocation);
|
|
453
465
|
o.push({
|
|
454
466
|
id: crypto.randomUUID(),
|
|
455
467
|
type: "bundle",
|
|
456
|
-
findings:
|
|
468
|
+
findings: d,
|
|
457
469
|
blockId: s,
|
|
458
|
-
rule:
|
|
470
|
+
rule: d[0].rule,
|
|
459
471
|
// All findings in bundle have same rule
|
|
460
|
-
desiredYLocation:
|
|
461
|
-
yLocation:
|
|
472
|
+
desiredYLocation: d[0].desiredYLocation,
|
|
473
|
+
yLocation: d[0].desiredYLocation
|
|
462
474
|
});
|
|
463
475
|
}
|
|
464
476
|
return o;
|
|
465
477
|
}
|
|
466
|
-
function
|
|
478
|
+
function Le(n) {
|
|
467
479
|
const t = /* @__PURE__ */ new Set();
|
|
468
480
|
for (const r of n)
|
|
469
481
|
for (const o of r.findings)
|
|
470
482
|
t.add(o.resourceId);
|
|
471
483
|
return t;
|
|
472
484
|
}
|
|
473
|
-
function
|
|
485
|
+
function we(n, t = {}) {
|
|
474
486
|
const { editorSelector: r = "#tiptap" } = t, o = document.getElementById(n.resourceId);
|
|
475
487
|
if (!o)
|
|
476
488
|
return null;
|
|
477
489
|
const s = document.querySelector(r);
|
|
478
490
|
if (!s)
|
|
479
491
|
throw new Error(`Editor not found: ${r} element does not exist`);
|
|
480
|
-
const
|
|
481
|
-
return o.getBoundingClientRect().top -
|
|
492
|
+
const a = s.getBoundingClientRect().top;
|
|
493
|
+
return o.getBoundingClientRect().top - a;
|
|
482
494
|
}
|
|
483
|
-
function
|
|
484
|
-
const o =
|
|
495
|
+
function Ce(n, t) {
|
|
496
|
+
const o = we(n, t) ?? 0;
|
|
485
497
|
return {
|
|
486
498
|
...n,
|
|
487
499
|
desiredYLocation: o,
|
|
@@ -490,9 +502,9 @@ function De(n, t) {
|
|
|
490
502
|
};
|
|
491
503
|
}
|
|
492
504
|
function se(n, t) {
|
|
493
|
-
return n.map((r) =>
|
|
505
|
+
return n.map((r) => Ce(r, t)).sort(Me);
|
|
494
506
|
}
|
|
495
|
-
function
|
|
507
|
+
function Me(n, t) {
|
|
496
508
|
const r = n.desiredYLocation - t.desiredYLocation;
|
|
497
509
|
return Math.abs(r) > 0.01 ? r : n.resourceId.localeCompare(t.resourceId);
|
|
498
510
|
}
|
|
@@ -502,10 +514,10 @@ function le(n) {
|
|
|
502
514
|
function oe(n) {
|
|
503
515
|
return le(n) ? `bundle:${n.blockId}` : n.resourceId;
|
|
504
516
|
}
|
|
505
|
-
function
|
|
517
|
+
function L(n) {
|
|
506
518
|
return n.desiredYLocation;
|
|
507
519
|
}
|
|
508
|
-
function
|
|
520
|
+
function De(n) {
|
|
509
521
|
return n.map((t) => ({
|
|
510
522
|
id: crypto.randomUUID(),
|
|
511
523
|
type: "stack",
|
|
@@ -513,60 +525,60 @@ function Ue(n) {
|
|
|
513
525
|
rule: t.rule,
|
|
514
526
|
isExpandable: !1,
|
|
515
527
|
isExpanded: !1,
|
|
516
|
-
desiredYLocation:
|
|
517
|
-
yLocation:
|
|
528
|
+
desiredYLocation: L(t),
|
|
529
|
+
yLocation: L(t)
|
|
518
530
|
}));
|
|
519
531
|
}
|
|
520
|
-
function
|
|
532
|
+
function Ge(n, t, r = /* @__PURE__ */ new Set(), o = []) {
|
|
521
533
|
if (n.length === 0) return [];
|
|
522
|
-
const s = [...n].sort((T, k) => T.desiredYLocation - k.desiredYLocation),
|
|
523
|
-
let p = [], b = null, E = 0,
|
|
534
|
+
const s = [...n].sort((T, k) => T.desiredYLocation - k.desiredYLocation), a = [...o], d = [];
|
|
535
|
+
let p = [], b = null, E = 0, i = 0, g = 0;
|
|
524
536
|
for (const T of s) {
|
|
525
|
-
const k = T.items[0],
|
|
537
|
+
const k = T.items[0], v = k.rule, m = L(k), y = Ue(k, t), c = Math.max(m, g);
|
|
526
538
|
if (p.length === 0) {
|
|
527
|
-
p = [k], b =
|
|
539
|
+
p = [k], b = v, E = c, i = y, g = c + y;
|
|
528
540
|
continue;
|
|
529
541
|
}
|
|
530
|
-
const h =
|
|
531
|
-
h && S ? (p.push(k), g = E +
|
|
542
|
+
const h = v === b, S = c <= E + i;
|
|
543
|
+
h && S ? (p.push(k), g = E + i) : (d.push(ie(p, r, a)), p = [k], b = v, E = c, i = y, g = c + y);
|
|
532
544
|
}
|
|
533
|
-
return p.length > 0 &&
|
|
545
|
+
return p.length > 0 && d.push(ie(p, r, a)), d;
|
|
534
546
|
}
|
|
535
|
-
function
|
|
547
|
+
function Ue(n, t) {
|
|
536
548
|
return le(n) ? t.get(n.id) ?? 0 : t.get(n.resourceId) ?? 0;
|
|
537
549
|
}
|
|
538
550
|
function ie(n, t, r) {
|
|
539
|
-
const o = [...n].sort((
|
|
551
|
+
const o = [...n].sort((d, p) => L(d) - L(p)), s = Pe(o, r), a = s ? s.id : crypto.randomUUID();
|
|
540
552
|
return {
|
|
541
|
-
id:
|
|
553
|
+
id: a,
|
|
542
554
|
type: "stack",
|
|
543
555
|
items: o,
|
|
544
556
|
rule: o[0].rule,
|
|
545
557
|
isExpandable: o.length > 1,
|
|
546
|
-
isExpanded: t.has(
|
|
547
|
-
desiredYLocation:
|
|
548
|
-
yLocation:
|
|
558
|
+
isExpanded: t.has(a),
|
|
559
|
+
desiredYLocation: L(o[0]),
|
|
560
|
+
yLocation: L(o[0])
|
|
549
561
|
};
|
|
550
562
|
}
|
|
551
|
-
function
|
|
563
|
+
function Pe(n, t) {
|
|
552
564
|
if (t.length === 0) return null;
|
|
553
565
|
const r = new Set(n.map(oe));
|
|
554
|
-
let o = null, s = 0,
|
|
555
|
-
for (let
|
|
556
|
-
const p = t[
|
|
566
|
+
let o = null, s = 0, a = -1;
|
|
567
|
+
for (let d = 0; d < t.length; d++) {
|
|
568
|
+
const p = t[d], b = new Set(p.items.map(oe));
|
|
557
569
|
let E = 0;
|
|
558
570
|
for (const g of r)
|
|
559
571
|
b.has(g) && E++;
|
|
560
|
-
const
|
|
561
|
-
|
|
572
|
+
const i = E / Math.max(r.size, b.size);
|
|
573
|
+
i > s && (s = i, o = p, a = d);
|
|
562
574
|
}
|
|
563
|
-
return s >= 0.5 &&
|
|
575
|
+
return s >= 0.5 && a >= 0 ? (t.splice(a, 1), o) : null;
|
|
564
576
|
}
|
|
565
|
-
function
|
|
577
|
+
function Be(n, t) {
|
|
566
578
|
const r = n.map((o) => ({ ...o }));
|
|
567
579
|
for (let o = 1; o < r.length; o++) {
|
|
568
|
-
const s = r[o - 1],
|
|
569
|
-
|
|
580
|
+
const s = r[o - 1], a = r[o], d = t[s.id]?.offsetHeight ?? 0, p = s.yLocation + d;
|
|
581
|
+
a.yLocation = Math.max(a.desiredYLocation, p);
|
|
570
582
|
}
|
|
571
583
|
return r;
|
|
572
584
|
}
|
|
@@ -584,7 +596,7 @@ const N = {
|
|
|
584
596
|
// Merge overlapping stacks
|
|
585
597
|
POSITIONING: "positioning"
|
|
586
598
|
// Final absolute positioning calculation
|
|
587
|
-
},
|
|
599
|
+
}, Ye = {
|
|
588
600
|
phase: N.IDLE,
|
|
589
601
|
bundles: [],
|
|
590
602
|
stacks: [],
|
|
@@ -602,7 +614,7 @@ const N = {
|
|
|
602
614
|
stacks: [],
|
|
603
615
|
bundles: []
|
|
604
616
|
});
|
|
605
|
-
function
|
|
617
|
+
function $e(n, t) {
|
|
606
618
|
switch (t.type) {
|
|
607
619
|
case "FINDINGS_UPDATED":
|
|
608
620
|
case "ANIMATION_FINISHED":
|
|
@@ -640,93 +652,93 @@ function Ve(n, t) {
|
|
|
640
652
|
return n;
|
|
641
653
|
}
|
|
642
654
|
}
|
|
643
|
-
function
|
|
655
|
+
function Fe(n, t) {
|
|
644
656
|
let r;
|
|
645
657
|
return () => {
|
|
646
658
|
clearTimeout(r), r = setTimeout(n, t);
|
|
647
659
|
};
|
|
648
660
|
}
|
|
649
|
-
const
|
|
661
|
+
const ze = ({
|
|
650
662
|
findings: n,
|
|
651
663
|
isAnimating: t = !1,
|
|
652
664
|
positioningConfig: r,
|
|
653
665
|
buildFindingBlockMap: o,
|
|
654
666
|
validationResultProps: s = {},
|
|
655
|
-
resultComponent:
|
|
656
|
-
collapseButtonComponent:
|
|
667
|
+
resultComponent: a,
|
|
668
|
+
collapseButtonComponent: d,
|
|
657
669
|
resizeDebounceDelay: p = 100,
|
|
658
670
|
className: b = "",
|
|
659
671
|
styles: E = {}
|
|
660
672
|
}) => {
|
|
661
|
-
const [
|
|
673
|
+
const [i, g] = Ee($e, Ye), T = a ?? Ae, k = d, v = de({
|
|
662
674
|
findings: {},
|
|
663
675
|
bundles: {},
|
|
664
676
|
stacks: {}
|
|
665
|
-
}), m =
|
|
666
|
-
|
|
677
|
+
}), m = he(() => g({ type: "RECALCULATE" }), []);
|
|
678
|
+
C(() => {
|
|
667
679
|
t || g({ type: "ANIMATION_FINISHED", findings: n });
|
|
668
|
-
}, [t, n]),
|
|
680
|
+
}, [t, n]), C(() => {
|
|
669
681
|
g({ type: "FINDINGS_UPDATED", findings: n }), g(o ? {
|
|
670
682
|
type: "BLOCK_MAP_BUILT",
|
|
671
683
|
blockMap: o(n)
|
|
672
684
|
} : { type: "BLOCK_MAP_BUILT", blockMap: /* @__PURE__ */ new Map() });
|
|
673
|
-
}, [n, o]),
|
|
674
|
-
const c =
|
|
685
|
+
}, [n, o]), C(() => {
|
|
686
|
+
const c = Fe(m, p);
|
|
675
687
|
return window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
|
|
676
|
-
}, [m, p]),
|
|
677
|
-
const c = se(
|
|
678
|
-
switch (
|
|
688
|
+
}, [m, p]), Se(() => {
|
|
689
|
+
const c = se(i.findings, r);
|
|
690
|
+
switch (i.phase) {
|
|
679
691
|
case N.MEASURING: {
|
|
680
692
|
const h = /* @__PURE__ */ new Map();
|
|
681
693
|
c.forEach((S) => {
|
|
682
|
-
const
|
|
683
|
-
|
|
694
|
+
const l = v.current.findings[S.resourceId];
|
|
695
|
+
l && h.set(S.resourceId, l.offsetHeight);
|
|
684
696
|
}), g({ type: "HEIGHTS_MEASURED", heights: h });
|
|
685
697
|
break;
|
|
686
698
|
}
|
|
687
699
|
case N.BUNDLING: {
|
|
688
|
-
const h =
|
|
700
|
+
const h = Oe(c, i.findingBlockMap);
|
|
689
701
|
g({ type: "BUNDLES_CREATED", bundles: h });
|
|
690
702
|
break;
|
|
691
703
|
}
|
|
692
704
|
case N.MEASURING_BUNDLES: {
|
|
693
705
|
const h = /* @__PURE__ */ new Map();
|
|
694
|
-
|
|
695
|
-
const
|
|
696
|
-
|
|
706
|
+
i.bundles.forEach((S) => {
|
|
707
|
+
const l = v.current.bundles[S.id];
|
|
708
|
+
l && h.set(S.id, l.offsetHeight);
|
|
697
709
|
}), g({ type: "BUNDLE_HEIGHTS_MEASURED", heights: h });
|
|
698
710
|
break;
|
|
699
711
|
}
|
|
700
712
|
case N.STACKING: {
|
|
701
|
-
const h =
|
|
702
|
-
g({ type: "STACKS_CREATED", stacks:
|
|
713
|
+
const h = Le(i.bundles), S = c.filter((O) => !h.has(O.resourceId)), l = De([...i.bundles, ...S]);
|
|
714
|
+
g({ type: "STACKS_CREATED", stacks: l });
|
|
703
715
|
break;
|
|
704
716
|
}
|
|
705
717
|
case N.MERGING: {
|
|
706
|
-
const h =
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
718
|
+
const h = Ge(
|
|
719
|
+
i.stacks,
|
|
720
|
+
i.itemHeights,
|
|
721
|
+
i.expandedStackIds,
|
|
722
|
+
i.previousStacks
|
|
711
723
|
);
|
|
712
724
|
g({ type: "STACKS_MERGED", stacks: h });
|
|
713
725
|
break;
|
|
714
726
|
}
|
|
715
727
|
case N.POSITIONING: {
|
|
716
|
-
const h =
|
|
728
|
+
const h = Be(i.stacks, v.current.stacks);
|
|
717
729
|
g({ type: "STACKS_POSITIONED", stacks: h });
|
|
718
730
|
break;
|
|
719
731
|
}
|
|
720
732
|
}
|
|
721
733
|
}, [
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
734
|
+
i.phase,
|
|
735
|
+
i.findings,
|
|
736
|
+
i.bundles,
|
|
737
|
+
i.stacks,
|
|
738
|
+
i.findingBlockMap,
|
|
739
|
+
i.itemHeights,
|
|
740
|
+
i.expandedStackIds,
|
|
741
|
+
i.previousStacks,
|
|
730
742
|
r
|
|
731
743
|
]);
|
|
732
744
|
const y = {
|
|
@@ -734,21 +746,21 @@ const en = ({
|
|
|
734
746
|
visibility: "hidden",
|
|
735
747
|
pointerEvents: "none"
|
|
736
748
|
};
|
|
737
|
-
return /* @__PURE__ */
|
|
749
|
+
return /* @__PURE__ */ u.jsxs(
|
|
738
750
|
"section",
|
|
739
751
|
{
|
|
740
752
|
className: `${E.container ?? ""} ${b}`,
|
|
741
753
|
tabIndex: -1,
|
|
742
754
|
"data-testid": "validation-results-summary",
|
|
743
755
|
children: [
|
|
744
|
-
|
|
756
|
+
i.phase === N.MEASURING && se(i.findings, r).map((c) => /* @__PURE__ */ u.jsx(
|
|
745
757
|
"div",
|
|
746
758
|
{
|
|
747
759
|
ref: (h) => {
|
|
748
|
-
|
|
760
|
+
v.current.findings[c.resourceId] = h;
|
|
749
761
|
},
|
|
750
762
|
style: y,
|
|
751
|
-
children: /* @__PURE__ */
|
|
763
|
+
children: /* @__PURE__ */ u.jsx(
|
|
752
764
|
T,
|
|
753
765
|
{
|
|
754
766
|
...s,
|
|
@@ -759,15 +771,15 @@ const en = ({
|
|
|
759
771
|
},
|
|
760
772
|
c.resourceId
|
|
761
773
|
)),
|
|
762
|
-
|
|
774
|
+
i.phase === N.MEASURING_BUNDLES && i.bundles.map((c) => /* @__PURE__ */ u.jsx(
|
|
763
775
|
"div",
|
|
764
776
|
{
|
|
765
777
|
className: E.comment ?? "",
|
|
766
778
|
ref: (h) => {
|
|
767
|
-
|
|
779
|
+
v.current.bundles[c.id] = h;
|
|
768
780
|
},
|
|
769
781
|
style: y,
|
|
770
|
-
children: /* @__PURE__ */
|
|
782
|
+
children: /* @__PURE__ */ u.jsx(
|
|
771
783
|
T,
|
|
772
784
|
{
|
|
773
785
|
...s,
|
|
@@ -779,59 +791,59 @@ const en = ({
|
|
|
779
791
|
},
|
|
780
792
|
c.id
|
|
781
793
|
)),
|
|
782
|
-
|
|
794
|
+
i.stacks.map((c) => {
|
|
783
795
|
const h = c.items.length > 1, S = c.items.flatMap(
|
|
784
|
-
(
|
|
796
|
+
(l) => "type" in l && l.type === "bundle" ? l.findings : [l]
|
|
785
797
|
);
|
|
786
|
-
return /* @__PURE__ */
|
|
798
|
+
return /* @__PURE__ */ u.jsx(
|
|
787
799
|
"div",
|
|
788
800
|
{
|
|
789
801
|
"data-testid": `comment-item-${c.id}`,
|
|
790
802
|
className: E.comment ?? "",
|
|
791
|
-
ref: (
|
|
792
|
-
|
|
803
|
+
ref: (l) => {
|
|
804
|
+
v.current.stacks[c.id] = l;
|
|
793
805
|
},
|
|
794
806
|
style: { top: `${c.yLocation}px`, position: "absolute" },
|
|
795
807
|
children: h && !c.isExpanded ? (
|
|
796
808
|
// Collapsed stack: show count and render hidden items for measurement
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
c.items.map((
|
|
809
|
+
/* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
810
|
+
c.items.map((l) => "type" in l && l.type === "bundle" ? /* @__PURE__ */ u.jsx(
|
|
799
811
|
"div",
|
|
800
812
|
{
|
|
801
813
|
ref: (_) => {
|
|
802
|
-
|
|
814
|
+
v.current.bundles[l.id] = _;
|
|
803
815
|
},
|
|
804
816
|
style: y,
|
|
805
|
-
children: /* @__PURE__ */
|
|
817
|
+
children: /* @__PURE__ */ u.jsx(
|
|
806
818
|
T,
|
|
807
819
|
{
|
|
808
820
|
...s,
|
|
809
|
-
findings:
|
|
821
|
+
findings: l.findings,
|
|
810
822
|
onRetrigger: m,
|
|
811
823
|
isBundle: !0
|
|
812
824
|
}
|
|
813
825
|
)
|
|
814
826
|
},
|
|
815
|
-
|
|
816
|
-
) : /* @__PURE__ */
|
|
827
|
+
l.id
|
|
828
|
+
) : /* @__PURE__ */ u.jsx(
|
|
817
829
|
"div",
|
|
818
830
|
{
|
|
819
831
|
ref: (_) => {
|
|
820
|
-
|
|
832
|
+
v.current.findings[l.resourceId] = _;
|
|
821
833
|
},
|
|
822
834
|
style: y,
|
|
823
|
-
children: /* @__PURE__ */
|
|
835
|
+
children: /* @__PURE__ */ u.jsx(
|
|
824
836
|
T,
|
|
825
837
|
{
|
|
826
838
|
...s,
|
|
827
|
-
findings: [
|
|
839
|
+
findings: [l],
|
|
828
840
|
onRetrigger: m
|
|
829
841
|
}
|
|
830
842
|
)
|
|
831
843
|
},
|
|
832
|
-
|
|
844
|
+
l.resourceId
|
|
833
845
|
)),
|
|
834
|
-
/* @__PURE__ */
|
|
846
|
+
/* @__PURE__ */ u.jsx(
|
|
835
847
|
T,
|
|
836
848
|
{
|
|
837
849
|
...s,
|
|
@@ -846,50 +858,50 @@ const en = ({
|
|
|
846
858
|
] })
|
|
847
859
|
) : (
|
|
848
860
|
// Single item or expanded stack: show individual items
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
c.items.map((
|
|
861
|
+
/* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
862
|
+
c.items.map((l) => "type" in l && l.type === "bundle" ? /* @__PURE__ */ u.jsx(
|
|
851
863
|
"div",
|
|
852
864
|
{
|
|
853
865
|
ref: (_) => {
|
|
854
|
-
|
|
866
|
+
v.current.bundles[l.id] = _;
|
|
855
867
|
},
|
|
856
868
|
className: c.isExpanded ? E.findingInExpandedStack : void 0,
|
|
857
|
-
children: /* @__PURE__ */
|
|
869
|
+
children: /* @__PURE__ */ u.jsx(
|
|
858
870
|
T,
|
|
859
871
|
{
|
|
860
872
|
...s,
|
|
861
|
-
findings:
|
|
873
|
+
findings: l.findings,
|
|
862
874
|
onRetrigger: m,
|
|
863
875
|
isBundle: !0
|
|
864
876
|
}
|
|
865
877
|
)
|
|
866
878
|
},
|
|
867
|
-
|
|
868
|
-
) : /* @__PURE__ */
|
|
879
|
+
l.id
|
|
880
|
+
) : /* @__PURE__ */ u.jsx(
|
|
869
881
|
"div",
|
|
870
882
|
{
|
|
871
883
|
ref: (_) => {
|
|
872
|
-
|
|
884
|
+
v.current.findings[l.resourceId] = _;
|
|
873
885
|
},
|
|
874
886
|
className: c.isExpanded ? E.findingInExpandedStack : void 0,
|
|
875
|
-
children: /* @__PURE__ */
|
|
887
|
+
children: /* @__PURE__ */ u.jsx(
|
|
876
888
|
T,
|
|
877
889
|
{
|
|
878
890
|
...s,
|
|
879
|
-
findings: [
|
|
891
|
+
findings: [l],
|
|
880
892
|
onRetrigger: m
|
|
881
893
|
}
|
|
882
894
|
)
|
|
883
895
|
},
|
|
884
|
-
|
|
896
|
+
l.resourceId
|
|
885
897
|
)),
|
|
886
|
-
h && c.isExpanded && k && /* @__PURE__ */
|
|
898
|
+
h && c.isExpanded && k && /* @__PURE__ */ u.jsx(
|
|
887
899
|
k,
|
|
888
900
|
{
|
|
889
901
|
onClick: () => g({ type: "TOGGLE_STACK", stackId: c.id })
|
|
890
902
|
}
|
|
891
903
|
),
|
|
892
|
-
h && c.isExpanded && !k && /* @__PURE__ */
|
|
904
|
+
h && c.isExpanded && !k && /* @__PURE__ */ u.jsx("div", { children: /* @__PURE__ */ u.jsx("button", { onClick: () => g({ type: "TOGGLE_STACK", stackId: c.id }), children: s.labels?.toggleStackClosed ?? "Collapse" }) })
|
|
893
905
|
] })
|
|
894
906
|
)
|
|
895
907
|
},
|
|
@@ -901,22 +913,22 @@ const en = ({
|
|
|
901
913
|
);
|
|
902
914
|
};
|
|
903
915
|
export {
|
|
904
|
-
|
|
916
|
+
je as BUNDLEABLE_RULES,
|
|
905
917
|
ue as ValidationContext,
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
918
|
+
Ke as ValidationProvider,
|
|
919
|
+
Ae as ValidationResult,
|
|
920
|
+
ze as ValidationResultSummary,
|
|
921
|
+
Me as byIncreasingDesiredYLocation,
|
|
922
|
+
we as calculateDesiredYLocation,
|
|
923
|
+
Oe as computeBundles,
|
|
924
|
+
De as createInitialStacksFromItems,
|
|
925
|
+
Le as getBundledFindingIds,
|
|
914
926
|
le as isBundle,
|
|
915
|
-
|
|
927
|
+
Ce as makePositionedFinding,
|
|
916
928
|
se as makePositionedFindings,
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
929
|
+
Ge as mergeOverlappingStacksWithBundles,
|
|
930
|
+
Be as positionStacksWithBundles,
|
|
931
|
+
ve as useTiptapValidation,
|
|
932
|
+
Te as useValidation,
|
|
933
|
+
qe as useValidationContext
|
|
922
934
|
};
|