@opsydyn/foldkit-zloz-mermaid 0.11.0 → 0.11.1

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/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  - Add pure, content-bound review-packet export controls and optional composable Foldkit views.
12
12
 
13
+ ## [0.11.1](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.11.0...foldkit-zloz-mermaid-v0.11.1) (2026-11-30)
14
+
15
+ ### Miscellaneous Chores
16
+
17
+ - **foldkit-zloz-mermaid:** Synchronize foldkit-zloz versions
18
+
13
19
  ## [0.11.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.10.0...foldkit-zloz-mermaid-v0.11.0) (2026-11-26)
14
20
 
15
21
  ### Miscellaneous Chores
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ZLOZ Mermaid
2
2
 
3
3
  Optional, pure Mermaid flowchart export. No Mermaid parser, renderer, browser,
4
- Foldkit or Effect dependency is installed by the headless entry. Requires the
4
+ Effect UI or Effect dependency is installed by the headless entry. Requires the
5
5
  matching ZLOZ core peer. Export controls, native v3 projections and portable review
6
6
  packets are included in the linked 0.6.0 release.
7
7
 
@@ -9,7 +9,9 @@ packets are included in the linked 0.6.0 release.
9
9
  npm install @opsydyn/foldkit-zloz @opsydyn/foldkit-zloz-mermaid
10
10
  ```
11
11
 
12
- In this checkout, use workspace links or the tarballs produced by `pack:check`.
12
+ Use matching local candidate archives for the `/effect-ui` examples below. See the
13
+ [coordinated rehearsal](../../docs/assessments/2026-11-26-effect-ui-1.0-migration.md)
14
+ for the candidate and published Mermaid versions.
13
15
 
14
16
  ```ts
15
17
  import { exportMermaid } from '@opsydyn/foldkit-zloz-mermaid';
@@ -36,6 +38,12 @@ The four public ZLOZ packages release together, with adapters pinned to the exac
36
38
  core version. The [release train](https://github.com/opsydyn/fold-kit-experiments/blob/main/docs/releases/foldkit-zloz.md#release-action)
37
39
  verifies registry archives and provenance before advancing to the next package.
38
40
 
41
+ The private Effect UI preview exports `groupMermaidReviewV3` from
42
+ `@opsydyn/foldkit-zloz-mermaid/effect-ui`. Pass the native v3 review controls
43
+ and route its requests through `updateGroupMermaidReviewV3` to protect
44
+ source-bound consent and give the host the reviewed download payload. The
45
+ host supplies its Effect UI version and HTML builder.
46
+
39
47
  ## Type contract
40
48
 
41
49
  - `MermaidExportOptions`: optional direction (`LR | RL | TB | BT`) and loss policy
@@ -202,24 +210,24 @@ no IO; the reader below and Effect CLI compose it at their host boundaries. See
202
210
  ## Composable review-packet controls
203
211
 
204
212
  The root entry exports `resolveReviewPacketControls` and
205
- `resolveReviewPacketRequest`. The optional `/foldkit` entry exports
206
- `zlozReviewPacketControls`, `zlozReviewPacketConsent`, `zlozReviewPacketDownload`
207
- and their view/parts types. Install matching `foldkit` to use the native controls;
208
- it remains an optional peer and is not installed for headless consumers.
213
+ `resolveReviewPacketRequest`. The optional `/effect-ui` entry exports
214
+ `reviewPacket`, `reviewPacketConsent`, `reviewPacketDownload` and their
215
+ view/parts types. Interactive consumers install the matching Effect UI runtime in the host app.
216
+ Headless consumers can install just the root package and ZLOZ core.
209
217
 
210
218
  ```ts
211
219
  import {
212
220
  resolveReviewPacketControls,
213
221
  resolveReviewPacketRequest,
214
222
  } from '@opsydyn/foldkit-zloz-mermaid';
215
- import { zlozReviewPacketControls } from '@opsydyn/foldkit-zloz-mermaid/foldkit';
223
+ import { reviewPacket } from '@opsydyn/foldkit-zloz-mermaid/effect-ui';
216
224
 
217
225
  const selection = { baselineId: 'before', selectedId: null }; // null = current
218
- const state = { consentKey: null }; // host-owned, ephemeral Foldkit model state
226
+ const state = { consentKey: null }; // host-owned, ephemeral component state
219
227
  const context = resolveReviewPacketControls(document, selection, state, {
220
228
  blockedReason: null, // supply live host protection; direction and data-only rules are optional
221
229
  });
222
- const controls = zlozReviewPacketControls(
230
+ const controls = reviewPacket(
223
231
  h,
224
232
  context,
225
233
  (request) => Message.ObservedReviewPacketInput({ request }),
@@ -298,8 +306,8 @@ No file IO occurs in the package. Cancellation prevents publication; it need not
298
306
  abort underlying IO. Invalid/stale/protected/cancelled reads preserve the last
299
307
  good review and chosen side. Closing invalidates pending reads.
300
308
 
301
- The optional `@opsydyn/foldkit-zloz-mermaid/foldkit` export `zlozReviewReader`
302
- accepts the HtmlBuilder, state, request callback, file callback, live policy and
309
+ The optional `@opsydyn/foldkit-zloz-mermaid/effect-ui` export `reviewReader`
310
+ accepts the Effect UI builder, state, request callback, file callback, live policy and
303
311
  view options. It renders native opening/cancel/close and baseline/selected controls,
304
312
  audit findings and projection losses. `renderSummary`, `renderFinding` and
305
313
  `renderLayout` compose custom presentations; undefined falls back, null omits.
@@ -406,16 +414,16 @@ while retaining direction preference. Review state is trusted transient Model da
406
414
  not a credential or portable session codec. A download already dispatched cannot
407
415
  be retroactively revoked. Graph, revision and Undo remain unchanged by export.
408
416
 
409
- Optional `/foldkit` `zlozGroupMermaidReviewV3(h, controls, onRequest, { id })`
417
+ Optional `/effect-ui` `groupMermaidReviewV3(h, controls, onRequest, { id })`
410
418
  provides a direction selector, safe highlighted source, all findings, consent and
411
419
  download. Minimal/global diagnostics hide optional status, preserving functional
412
420
  findings and denial reasons. `renderPart`, `renderFinding` and `renderLayout` use
413
421
  undefined for native defaults and null to omit; replacements own their semantics
414
- and explanations. Compose `zlozGroupMermaidConsentV3` /
415
- `zlozGroupMermaidDownloadV3` independently or use headless APIs for a fully custom
416
- surface. Scoped `theme` uses core's shared public Foldkit theme mapper.
422
+ and explanations. Use the headless review controls to build a custom surface.
423
+ Apply theme tokens on the parent element with the shared ZLOZ Effect UI theme
424
+ mapper.
417
425
 
418
- No Mermaid parser/renderer, DOM, Astro, Foldkit or Effect dependency enters the
426
+ No Mermaid parser/renderer, DOM, Astro, Effect UI or Effect dependency enters the
419
427
  headless root. Local browser oracle evidence is version-specific and separate from
420
428
  human AT/device, hosted deployment, broad performance and registry acceptance.
421
429
  The private CLI's current Mermaid export remains v1/v2; compatibility inspection
@@ -0,0 +1,99 @@
1
+ import { C as ZlozReviewPacketControlsContext, D as ZlozReviewPacketRequest, M as ZlozReviewPacketDiagnostic, V as ZlozGroupMermaidReviewRequestV3, Z as MermaidDiagnostic, i as ZlozReviewReaderState, n as ZlozReviewReaderRequest, t as ZlozReviewReaderOptions, z as ZlozGroupMermaidReviewControlsV3 } from "./review-reader-CuGbHsR3.mjs";
2
+ import { View } from "@effect/ui";
3
+ import { Html } from "@effect/ui/html";
4
+
5
+ //#region src/effect-ui-review-packet.d.ts
6
+ type Request<M> = (request: ZlozReviewPacketRequest) => M;
7
+ type Part$1<M> = View.Content<M> | null;
8
+ type RenderPart<M> = (context: ZlozReviewPacketControlsContext, h: Html.H<M>, request: Request<M>) => Part$1<M> | undefined;
9
+ type ReviewPacketParts<M> = Readonly<{
10
+ scope: Part$1<M>;
11
+ diagnostics: readonly View.Content<M>[];
12
+ consent: Part$1<M>;
13
+ download: Part$1<M>;
14
+ reason: Part$1<M>;
15
+ status: Part$1<M>;
16
+ }>;
17
+ type ReviewPacketOptions<M> = Readonly<{
18
+ attributes?: Readonly<Record<string, string>>;
19
+ label?: string;
20
+ showStatus?: boolean;
21
+ showCounts?: boolean;
22
+ scopeHeading?: string;
23
+ scopeLabel?: string;
24
+ diagnosticsDisclosure?: string;
25
+ diagnosticsLabel?: string;
26
+ consentLabel?: string;
27
+ downloadLabel?: string;
28
+ reasonLabel?: string;
29
+ statusLabel?: string;
30
+ renderScope?: RenderPart<M>;
31
+ renderConsent?: RenderPart<M>;
32
+ renderDownload?: RenderPart<M>;
33
+ renderReason?: RenderPart<M>;
34
+ renderStatus?: RenderPart<M>;
35
+ renderDiagnostic?: (item: ZlozReviewPacketDiagnostic, h: Html.H<M>) => Part$1<M> | undefined;
36
+ renderLayout?: (parts: ReviewPacketParts<M>, context: ZlozReviewPacketControlsContext, h: Html.H<M>) => readonly (View.Content<M> | string | null | undefined)[];
37
+ }>;
38
+ declare function reviewPacketConsent<M>(h: Html.H<M>, {
39
+ key,
40
+ reason,
41
+ requiresConsent,
42
+ consented
43
+ }: ZlozReviewPacketControlsContext, request: Request<M>, label?: string): Html.VoidElement<M, never, Html.EventsOf<"input">, HTMLInputElement, "input">;
44
+ declare function reviewPacketDownload<M>(h: Html.H<M>, {
45
+ key,
46
+ downloadReason
47
+ }: ZlozReviewPacketControlsContext, request: Request<M>, label?: string): Html.Element<M, never, Html.Events, HTMLButtonElement, "button">;
48
+ /** Render a portable review export. The host owns consent validation and downloading. */
49
+ declare function reviewPacket<M>(h: Html.H<M>, context: ZlozReviewPacketControlsContext, request: Request<M>, options?: ReviewPacketOptions<M>): Html.Element<M, never, Html.Events, HTMLElement, "section">;
50
+ //#endregion
51
+ //#region src/effect-ui-review-reader.d.ts
52
+ type Part<M> = View.Content<M> | null;
53
+ type ReviewReaderParts<M> = Readonly<{
54
+ open: Part<M>;
55
+ status: Part<M>;
56
+ summary: Part<M>;
57
+ selection: Part<M>;
58
+ findings: Part<M>;
59
+ cancel: Part<M>;
60
+ close: Part<M>;
61
+ }>;
62
+ type ReviewReaderOptions<M> = Readonly<{
63
+ attributes?: Readonly<Record<string, string>>;
64
+ idPrefix?: string;
65
+ instructions?: boolean;
66
+ showCounts?: boolean;
67
+ renderFinding?: (finding: ZlozReviewPacketDiagnostic, h: Html.H<M>) => Part<M> | undefined;
68
+ renderSummary?: (state: ZlozReviewReaderState, h: Html.H<M>) => Part<M> | undefined;
69
+ renderLayout?: (parts: ReviewReaderParts<M>, h: Html.H<M>) => readonly (View.Content<M> | string | null | undefined)[];
70
+ }>;
71
+ /** Inspect a detached packet. The host owns file IO and the read-only canvas. */
72
+ declare function reviewReader<M>(h: Html.H<M>, state: ZlozReviewReaderState, onRequest: (request: ZlozReviewReaderRequest) => M, onFiles: (files: readonly File[]) => M, policy?: ZlozReviewReaderOptions, options?: ReviewReaderOptions<M>): Html.Element<M, never, Html.Events, HTMLDivElement, "div">;
73
+ //#endregion
74
+ //#region src/effect-ui.d.ts
75
+ type GroupMermaidParts<M> = Readonly<{
76
+ direction: View.Content<M> | null;
77
+ source: View.Content<M> | null;
78
+ findings: readonly View.Content<M>[];
79
+ consent: View.Content<M> | null;
80
+ download: View.Content<M> | null;
81
+ reason: View.Content<M> | null;
82
+ status: View.Content<M> | null;
83
+ }>;
84
+ type GroupMermaidReviewOptions<M = never> = Readonly<{
85
+ id: string;
86
+ label?: string;
87
+ minimalMode?: boolean;
88
+ findingLabel?: (finding: MermaidDiagnostic) => string | null;
89
+ attributes?: Readonly<Record<string, string>>;
90
+ diagnostics?: boolean;
91
+ renderPart?: (part: Exclude<keyof GroupMermaidParts<M>, 'findings'>, controls: ZlozGroupMermaidReviewControlsV3, h: Html.H<M>, onRequest: (request: ZlozGroupMermaidReviewRequestV3) => M) => View.Content<M> | null | undefined;
92
+ renderFinding?: (finding: MermaidDiagnostic, h: Html.H<M>) => View.Content<M> | null | undefined;
93
+ renderLayout?: (parts: GroupMermaidParts<M>, controls: ZlozGroupMermaidReviewControlsV3, h: Html.H<M>) => readonly (View.Content<M> | string | null | undefined)[];
94
+ }>;
95
+ /** Native Effect UI controls. The host handles requests through the headless review reducer. */
96
+ declare function groupMermaidReviewV3<Message>(h: Html.H<Message>, controls: ZlozGroupMermaidReviewControlsV3, onRequest: (request: ZlozGroupMermaidReviewRequestV3) => Message, options: GroupMermaidReviewOptions<Message>): Html.Element<Message, never, Html.Events, HTMLElement, "section">;
97
+ //#endregion
98
+ export { GroupMermaidParts, GroupMermaidReviewOptions, type ReviewPacketOptions, type ReviewPacketParts, type ReviewReaderOptions, type ReviewReaderParts, groupMermaidReviewV3, reviewPacket, reviewPacketConsent, reviewPacketDownload, reviewReader };
99
+ //# sourceMappingURL=effect-ui.d.mts.map
@@ -0,0 +1,172 @@
1
+ import { n as resolveReviewReader } from "./review-reader-BjZIRpPb.mjs";
2
+ //#region src/effect-ui-review-packet.ts
3
+ function reviewPacketConsent(h, { key, reason, requiresConsent, consented }, request, label = "Allow reported projection losses for this packet") {
4
+ return h.input.attr("type", "checkbox").attr("aria-label", label).attr("aria-description", reason ?? void 0).checked(consented).disabled(!requiresConsent || reason !== null || key === null).on("change", ({ checked }) => requiresConsent && key !== null && reason === null ? request({
5
+ type: "ConsentChanged",
6
+ key,
7
+ accepted: checked
8
+ }) : void 0);
9
+ }
10
+ function reviewPacketDownload(h, { key, downloadReason }, request, label = "Download review packet") {
11
+ return h.button.attr("type", "button").attr("aria-description", downloadReason ?? void 0).attr("title", downloadReason ?? void 0).disabled(downloadReason !== null || key === null).on("click", () => key !== null && downloadReason === null ? request({
12
+ type: "DownloadClicked",
13
+ key
14
+ }) : void 0).children(label);
15
+ }
16
+ /** Render a portable review export. The host owns consent validation and downloading. */
17
+ function reviewPacket(h, context, request, options = {}) {
18
+ const { reason, downloadReason, requiresConsent } = context;
19
+ const consentLabel = options.consentLabel ?? "Allow reported projection losses for this packet";
20
+ const part = (render, fallback) => {
21
+ const custom = render?.(context, h, request);
22
+ return custom === void 0 ? fallback : custom;
23
+ };
24
+ const losses = context.diagnostics.filter((item) => item.severity === "loss").length;
25
+ const status = requiresConsent ? options.showCounts === false ? "Mermaid projections have reported losses." : `${losses} reported projection losses.` : "No reported projection losses.";
26
+ const parts = {
27
+ scope: part(options.renderScope, h.div.children(options.scopeHeading ? h.strong.children(options.scopeHeading) : null, h.p.attr("aria-label", options.scopeLabel ?? "Review packet scope").children(context.scopeText))),
28
+ status: part(options.renderStatus, options.showStatus === false ? null : h.p.attr("role", "status").attr("aria-live", "polite").attr("aria-label", options.statusLabel ?? "Review packet status").children(reason ?? status)),
29
+ diagnostics: context.diagnostics.flatMap((item) => {
30
+ const custom = options.renderDiagnostic?.(item, h);
31
+ if (custom === null) return [];
32
+ const subject = item.subject ? `${item.subject}: ` : "";
33
+ return [custom ?? h.li.children(`${item.side} · ${item.severity}: ${subject}${item.message}`)];
34
+ }),
35
+ consent: part(options.renderConsent, requiresConsent ? h.label.children(reviewPacketConsent(h, context, request, consentLabel), consentLabel) : null),
36
+ reason: part(options.renderReason, downloadReason ? h.p.attr("aria-label", options.reasonLabel ?? "Review packet availability").children(downloadReason) : null),
37
+ download: part(options.renderDownload, reviewPacketDownload(h, context, request, options.downloadLabel))
38
+ };
39
+ const list = parts.diagnostics.length ? h.ul.attr("aria-label", options.diagnosticsLabel ?? "Review packet diagnostics").children(...parts.diagnostics) : null;
40
+ const diagnostics = list && options.diagnosticsDisclosure ? h.details.children(h.summary.children(options.diagnosticsDisclosure), list.style({
41
+ maxHeight: "220px",
42
+ overflow: "auto",
43
+ padding: "0",
44
+ margin: "8px 0"
45
+ })) : list;
46
+ return h.section.attrs(options.attributes ?? {}).attr("aria-label", options.label ?? "Review packet export").children(...options.renderLayout?.(parts, context, h) ?? [
47
+ parts.scope,
48
+ parts.status,
49
+ diagnostics,
50
+ parts.consent,
51
+ parts.reason,
52
+ parts.download
53
+ ]);
54
+ }
55
+ //#endregion
56
+ //#region src/effect-ui-review-reader.ts
57
+ /** Inspect a detached packet. The host owns file IO and the read-only canvas. */
58
+ function reviewReader(h, state, onRequest, onFiles, policy = {}, options = {}) {
59
+ const context = resolveReviewReader(state, policy);
60
+ const { scope, pending, review } = state;
61
+ const fileId = `${options.idPrefix ?? "zloz-review-reader"}-file`;
62
+ const comparison = review?.packet.comparison;
63
+ const customSummary = options.renderSummary?.(state, h);
64
+ const parts = {
65
+ open: h.label.attr("for", fileId).children("Open review packet", h.input.id(fileId).attr("type", "file").attr("accept", ".json,application/json").value("").disabled(context.openReason !== null).on("change", ({ files }) => context.openReason === null ? onFiles(files) : void 0)),
66
+ status: h.p.attr("role", "status").attr("aria-live", "polite").children(context.openReason ?? state.notice),
67
+ cancel: pending ? h.button.attr("type", "button").on("click", onRequest({
68
+ scope,
69
+ type: "ReadCancelled",
70
+ run: pending.run
71
+ })).children("Cancel packet read") : null,
72
+ summary: customSummary !== void 0 ? customSummary : review && comparison ? h.div.children(h.strong.children(review.packet.model.name), h.p.children("Read-only packet · ", review.name), h.p.children(`Audit: ${comparison.status}`), options.showCounts === false ? null : h.p.attr("data-review-reader-counts", "").children(`${comparison.summary.introduced} introduced · ${comparison.summary.resolved} resolved · ${comparison.summary.persisting} persisting`)) : null,
73
+ selection: review ? h.div.attr("role", "group").attr("aria-label", "Packet snapshot").children(...["baseline", "selected"].map((side) => h.button.key(side).attr("type", "button").attr("aria-pressed", review.side === side ? "true" : "false").disabled(context.sideReason !== null).on("click", onRequest({
74
+ scope,
75
+ type: "SideSelected",
76
+ reviewId: review.id,
77
+ side
78
+ })).children(side === "baseline" ? `Baseline: ${review.packet.baseline.source.name}` : `Selected: ${review.packet.selected.source.kind === "current" ? "Current graph" : review.packet.selected.source.name}`)), context.sideReason ? h.p.children(context.sideReason) : null) : null,
79
+ close: review ? h.button.attr("type", "button").on("click", onRequest({
80
+ scope,
81
+ type: "ReviewClosed",
82
+ reviewId: review.id
83
+ })).children("Close packet review") : null,
84
+ findings: review && comparison ? h.div.attr("aria-label", "Packet findings").children(...comparison.introduced.map((item) => h.p.children(`Introduced · ${item.edgeId}: ${item.message}`)), ...comparison.resolved.map((item) => h.p.children(`Resolved · ${item.edgeId}: ${item.message}`)), ...comparison.persisting.map((item) => h.p.children(`Persisting · ${item.after.edgeId}: ${item.after.message}`)), h.ul.attr("aria-label", "Packet projection findings").children(...review.packet.diagnostics.flatMap((item) => {
85
+ const rendered = options.renderFinding?.(item, h);
86
+ return rendered === null ? [] : [rendered ?? h.li.children(`${item.side} · ${item.code}: ${item.message}`)];
87
+ }))) : null
88
+ };
89
+ const reviewView = review && comparison ? h.div.children(parts.summary, parts.selection, parts.close, parts.findings) : null;
90
+ return h.div.attrs(options.attributes ?? {}).attr("data-review-reader", "").children(options.instructions === false ? null : h.p.children("Open a portable packet for inspection. Reading never imports or edits your model."), ...options.renderLayout?.(parts, h) ?? [
91
+ parts.open,
92
+ parts.status,
93
+ parts.cancel,
94
+ reviewView
95
+ ]);
96
+ }
97
+ //#endregion
98
+ //#region src/effect-ui.ts
99
+ const directions = [
100
+ "LR",
101
+ "RL",
102
+ "TB",
103
+ "BT"
104
+ ];
105
+ /** Native Effect UI controls. The host handles requests through the headless review reducer. */
106
+ function groupMermaidReviewV3(h, controls, onRequest, options) {
107
+ const { identity, direction, findings, downloadReason } = controls;
108
+ const selectId = `${options.id}-direction`;
109
+ const reasonId = `${options.id}-reason`;
110
+ const preview = controls.result.status === "converted" ? controls.result.value.source : null;
111
+ const part = (name, fallback) => {
112
+ const rendered = options.renderPart?.(name, controls, h, onRequest);
113
+ return rendered === void 0 ? fallback : rendered;
114
+ };
115
+ const items = findings.flatMap((finding) => {
116
+ const custom = options.renderFinding?.(finding, h);
117
+ if (custom === null) return [];
118
+ const subject = options.findingLabel ? options.findingLabel(finding) : finding.subject;
119
+ return [custom ?? h.li.attr("data-zloz-mermaid-finding", finding.code).attr("title", finding.subject ?? finding.code).children(`${finding.severity}: ${subject ? subject + ": " : ""}${finding.message}`)];
120
+ });
121
+ const parts = {
122
+ direction: part("direction", h.div(h.label.attr("for", selectId).children("Mermaid direction"), h.select.id(selectId).on("change", ({ value }) => {
123
+ const chosen = directions.find((item) => item === value);
124
+ return chosen ? onRequest({
125
+ ...identity,
126
+ type: "MermaidDirectionChanged",
127
+ direction: chosen
128
+ }) : void 0;
129
+ }).children(...directions.map((value) => h.option.attr("value", value).selected(direction === value).children(value))))),
130
+ source: part("source", preview === null ? null : h.pre.attr("aria-label", "Mermaid source preview").attr("tabindex", "0").style({
131
+ overflow: "auto",
132
+ maxHeight: "280px",
133
+ fontSize: "12px",
134
+ padding: "12px",
135
+ border: "1px solid var(--flow-node-border, #94a3b8)",
136
+ borderRadius: "6px",
137
+ background: "var(--flow-node-background, transparent)"
138
+ }).children(h.code.class("language-mermaid").children(...preview.split(/("[^"]*"|\bflowchart\b|\bsubgraph\b|\bend\b)/g).map((token) => token.startsWith("\"") ? h.span.style({ color: "var(--flow-input-port, #0f766e)" }).children(token) : [
139
+ "flowchart",
140
+ "subgraph",
141
+ "end"
142
+ ].includes(token) ? h.span.style({
143
+ color: "var(--flow-output-port, #2563eb)",
144
+ fontWeight: "600"
145
+ }).children(token) : token)))),
146
+ status: part("status", options.minimalMode || options.diagnostics === false ? null : h.p.attr("role", "status").children(controls.reason ?? (controls.accepted ? "Exact Mermaid output accepted." : "Review Mermaid source and fidelity findings."))),
147
+ findings: items,
148
+ consent: part("consent", controls.hasLosses ? h.label(h.input.attr("type", "checkbox").attr("aria-label", "Accept the reported Mermaid losses").checked(controls.accepted).disabled(controls.reason !== null || controls.busy).on("click", onRequest({
149
+ ...identity,
150
+ type: "MermaidLossAcceptanceChanged",
151
+ accepted: !controls.accepted
152
+ })), "Accept the reported Mermaid losses") : null),
153
+ reason: part("reason", downloadReason ? h.p.id(reasonId).attr("aria-label", "Mermaid export availability").children(downloadReason) : null),
154
+ download: part("download", h.button.attr("type", "button").attr("aria-describedby", downloadReason ? reasonId : void 0).disabled(downloadReason !== null).on("click", onRequest({
155
+ ...identity,
156
+ type: "MermaidDownloadRequested"
157
+ })).children("Download Mermaid bundle"))
158
+ };
159
+ return h.section.attrs(options.attributes ?? {}).id(options.id).attr("aria-label", options.label ?? "Native v3 Mermaid export review").attr("data-zloz-mermaid-generation", String(identity.generation)).children(...options.renderLayout?.(parts, controls, h) ?? [
160
+ parts.direction,
161
+ parts.source,
162
+ parts.status,
163
+ items.length > 0 ? h.ul.attr("aria-label", "Mermaid fidelity findings").children(...items) : null,
164
+ parts.consent,
165
+ parts.reason,
166
+ parts.download
167
+ ]);
168
+ }
169
+ //#endregion
170
+ export { groupMermaidReviewV3, reviewPacket, reviewPacketConsent, reviewPacketDownload, reviewReader };
171
+
172
+ //# sourceMappingURL=effect-ui.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-ui.mjs","names":[],"sources":["../src/effect-ui-review-packet.ts","../src/effect-ui-review-reader.ts","../src/effect-ui.ts"],"sourcesContent":["import type { View } from '@effect/ui';\nimport type { Html } from '@effect/ui/html';\n\nimport type { ZlozReviewPacketDiagnostic } from './review-packet';\nimport type {\n ZlozReviewPacketControlsContext,\n ZlozReviewPacketRequest,\n} from './review-packet-controls';\n\ntype Request<M> = (request: ZlozReviewPacketRequest) => M;\ntype Part<M> = View.Content<M> | null;\ntype RenderPart<M> = (\n context: ZlozReviewPacketControlsContext,\n h: Html.H<M>,\n request: Request<M>,\n) => Part<M> | undefined;\n\nexport type ReviewPacketParts<M> = Readonly<{\n scope: Part<M>;\n diagnostics: readonly View.Content<M>[];\n consent: Part<M>;\n download: Part<M>;\n reason: Part<M>;\n status: Part<M>;\n}>;\nexport type ReviewPacketOptions<M> = Readonly<{\n attributes?: Readonly<Record<string, string>>;\n label?: string;\n showStatus?: boolean;\n showCounts?: boolean;\n scopeHeading?: string;\n scopeLabel?: string;\n diagnosticsDisclosure?: string;\n diagnosticsLabel?: string;\n consentLabel?: string;\n downloadLabel?: string;\n reasonLabel?: string;\n statusLabel?: string;\n renderScope?: RenderPart<M>;\n renderConsent?: RenderPart<M>;\n renderDownload?: RenderPart<M>;\n renderReason?: RenderPart<M>;\n renderStatus?: RenderPart<M>;\n renderDiagnostic?: (item: ZlozReviewPacketDiagnostic, h: Html.H<M>) => Part<M> | undefined;\n renderLayout?: (\n parts: ReviewPacketParts<M>,\n context: ZlozReviewPacketControlsContext,\n h: Html.H<M>,\n ) => readonly (View.Content<M> | string | null | undefined)[];\n}>;\n\nexport function reviewPacketConsent<M>(\n h: Html.H<M>,\n { key, reason, requiresConsent, consented }: ZlozReviewPacketControlsContext,\n request: Request<M>,\n label = 'Allow reported projection losses for this packet',\n) {\n return h.input\n .attr('type', 'checkbox')\n .attr('aria-label', label)\n .attr('aria-description', reason ?? undefined)\n .checked(consented)\n .disabled(!requiresConsent || reason !== null || key === null)\n .on('change', ({ checked }) =>\n requiresConsent && key !== null && reason === null\n ? request({ type: 'ConsentChanged', key, accepted: checked })\n : undefined,\n );\n}\n\nexport function reviewPacketDownload<M>(\n h: Html.H<M>,\n { key, downloadReason }: ZlozReviewPacketControlsContext,\n request: Request<M>,\n label = 'Download review packet',\n) {\n return h.button\n .attr('type', 'button')\n .attr('aria-description', downloadReason ?? undefined)\n .attr('title', downloadReason ?? undefined)\n .disabled(downloadReason !== null || key === null)\n .on('click', () =>\n key !== null && downloadReason === null\n ? request({ type: 'DownloadClicked', key })\n : undefined,\n )\n .children(label);\n}\n\n/** Render a portable review export. The host owns consent validation and downloading. */\nexport function reviewPacket<M>(\n h: Html.H<M>,\n context: ZlozReviewPacketControlsContext,\n request: Request<M>,\n options: ReviewPacketOptions<M> = {},\n) {\n const { reason, downloadReason, requiresConsent } = context;\n const consentLabel = options.consentLabel ?? 'Allow reported projection losses for this packet';\n const part = (render: RenderPart<M> | undefined, fallback: Part<M>) => {\n const custom = render?.(context, h, request);\n return custom === undefined ? fallback : custom;\n };\n const losses = context.diagnostics.filter((item) => item.severity === 'loss').length;\n const status = requiresConsent\n ? options.showCounts === false\n ? 'Mermaid projections have reported losses.'\n : `${losses} reported projection losses.`\n : 'No reported projection losses.';\n const parts: ReviewPacketParts<M> = {\n scope: part(\n options.renderScope,\n h.div.children(\n options.scopeHeading ? h.strong.children(options.scopeHeading) : null,\n h.p\n .attr('aria-label', options.scopeLabel ?? 'Review packet scope')\n .children(context.scopeText),\n ),\n ),\n status: part(\n options.renderStatus,\n options.showStatus === false\n ? null\n : h.p\n .attr('role', 'status')\n .attr('aria-live', 'polite')\n .attr('aria-label', options.statusLabel ?? 'Review packet status')\n .children(reason ?? status),\n ),\n diagnostics: context.diagnostics.flatMap((item) => {\n const custom = options.renderDiagnostic?.(item, h);\n if (custom === null) return [];\n const subject = item.subject ? `${item.subject}: ` : '';\n return [\n custom ?? h.li.children(`${item.side} · ${item.severity}: ${subject}${item.message}`),\n ];\n }),\n consent: part(\n options.renderConsent,\n requiresConsent\n ? h.label.children(reviewPacketConsent(h, context, request, consentLabel), consentLabel)\n : null,\n ),\n reason: part(\n options.renderReason,\n downloadReason\n ? h.p\n .attr('aria-label', options.reasonLabel ?? 'Review packet availability')\n .children(downloadReason)\n : null,\n ),\n download: part(\n options.renderDownload,\n reviewPacketDownload(h, context, request, options.downloadLabel),\n ),\n };\n const list = parts.diagnostics.length\n ? h.ul\n .attr('aria-label', options.diagnosticsLabel ?? 'Review packet diagnostics')\n .children(...parts.diagnostics)\n : null;\n const diagnostics =\n list && options.diagnosticsDisclosure\n ? h.details.children(\n h.summary.children(options.diagnosticsDisclosure),\n list.style({ maxHeight: '220px', overflow: 'auto', padding: '0', margin: '8px 0' }),\n )\n : list;\n return h.section\n .attrs(options.attributes ?? {})\n .attr('aria-label', options.label ?? 'Review packet export')\n .children(\n ...(options.renderLayout?.(parts, context, h) ?? [\n parts.scope,\n parts.status,\n diagnostics,\n parts.consent,\n parts.reason,\n parts.download,\n ]),\n );\n}\n","import type { View } from '@effect/ui';\nimport type { Html } from '@effect/ui/html';\n\nimport type { ZlozReviewPacketDiagnostic } from './review-packet';\nimport {\n resolveReviewReader,\n type ZlozReviewReaderOptions,\n type ZlozReviewReaderRequest,\n type ZlozReviewReaderState,\n} from './review-reader';\n\ntype Part<M> = View.Content<M> | null;\nexport type ReviewReaderParts<M> = Readonly<{\n open: Part<M>;\n status: Part<M>;\n summary: Part<M>;\n selection: Part<M>;\n findings: Part<M>;\n cancel: Part<M>;\n close: Part<M>;\n}>;\nexport type ReviewReaderOptions<M> = Readonly<{\n attributes?: Readonly<Record<string, string>>;\n idPrefix?: string;\n instructions?: boolean;\n showCounts?: boolean;\n renderFinding?: (finding: ZlozReviewPacketDiagnostic, h: Html.H<M>) => Part<M> | undefined;\n renderSummary?: (state: ZlozReviewReaderState, h: Html.H<M>) => Part<M> | undefined;\n renderLayout?: (\n parts: ReviewReaderParts<M>,\n h: Html.H<M>,\n ) => readonly (View.Content<M> | string | null | undefined)[];\n}>;\n\n/** Inspect a detached packet. The host owns file IO and the read-only canvas. */\nexport function reviewReader<M>(\n h: Html.H<M>,\n state: ZlozReviewReaderState,\n onRequest: (request: ZlozReviewReaderRequest) => M,\n onFiles: (files: readonly File[]) => M,\n policy: ZlozReviewReaderOptions = {},\n options: ReviewReaderOptions<M> = {},\n) {\n const context = resolveReviewReader(state, policy);\n const { scope, pending, review } = state;\n const fileId = `${options.idPrefix ?? 'zloz-review-reader'}-file`;\n const comparison = review?.packet.comparison;\n const customSummary = options.renderSummary?.(state, h);\n const parts: ReviewReaderParts<M> = {\n open: h.label.attr('for', fileId).children(\n 'Open review packet',\n h.input\n .id(fileId)\n .attr('type', 'file')\n .attr('accept', '.json,application/json')\n .value('')\n .disabled(context.openReason !== null)\n .on('change', ({ files }) => (context.openReason === null ? onFiles(files) : undefined)),\n ),\n status: h.p\n .attr('role', 'status')\n .attr('aria-live', 'polite')\n .children(context.openReason ?? state.notice),\n cancel: pending\n ? h.button\n .attr('type', 'button')\n .on('click', onRequest({ scope, type: 'ReadCancelled', run: pending.run }))\n .children('Cancel packet read')\n : null,\n summary:\n customSummary !== undefined\n ? customSummary\n : review && comparison\n ? h.div.children(\n h.strong.children(review.packet.model.name),\n h.p.children('Read-only packet · ', review.name),\n h.p.children(`Audit: ${comparison.status}`),\n options.showCounts === false\n ? null\n : h.p\n .attr('data-review-reader-counts', '')\n .children(\n `${comparison.summary.introduced} introduced · ${comparison.summary.resolved} resolved · ${comparison.summary.persisting} persisting`,\n ),\n )\n : null,\n selection: review\n ? h.div\n .attr('role', 'group')\n .attr('aria-label', 'Packet snapshot')\n .children(\n ...(['baseline', 'selected'] as const).map((side) =>\n h.button\n .key(side)\n .attr('type', 'button')\n .attr('aria-pressed', review.side === side ? 'true' : 'false')\n .disabled(context.sideReason !== null)\n .on('click', onRequest({ scope, type: 'SideSelected', reviewId: review.id, side }))\n .children(\n side === 'baseline'\n ? `Baseline: ${review.packet.baseline.source.name}`\n : `Selected: ${review.packet.selected.source.kind === 'current' ? 'Current graph' : review.packet.selected.source.name}`,\n ),\n ),\n context.sideReason ? h.p.children(context.sideReason) : null,\n )\n : null,\n close: review\n ? h.button\n .attr('type', 'button')\n .on('click', onRequest({ scope, type: 'ReviewClosed', reviewId: review.id }))\n .children('Close packet review')\n : null,\n findings:\n review && comparison\n ? h.div.attr('aria-label', 'Packet findings').children(\n ...comparison.introduced.map((item) =>\n h.p.children(`Introduced · ${item.edgeId}: ${item.message}`),\n ),\n ...comparison.resolved.map((item) =>\n h.p.children(`Resolved · ${item.edgeId}: ${item.message}`),\n ),\n ...comparison.persisting.map((item) =>\n h.p.children(`Persisting · ${item.after.edgeId}: ${item.after.message}`),\n ),\n h.ul.attr('aria-label', 'Packet projection findings').children(\n ...review.packet.diagnostics.flatMap((item) => {\n const rendered = options.renderFinding?.(item, h);\n return rendered === null\n ? []\n : [rendered ?? h.li.children(`${item.side} · ${item.code}: ${item.message}`)];\n }),\n ),\n )\n : null,\n };\n const reviewView =\n review && comparison\n ? h.div.children(parts.summary, parts.selection, parts.close, parts.findings)\n : null;\n return h.div\n .attrs(options.attributes ?? {})\n .attr('data-review-reader', '')\n .children(\n options.instructions === false\n ? null\n : h.p.children(\n 'Open a portable packet for inspection. Reading never imports or edits your model.',\n ),\n ...(options.renderLayout?.(parts, h) ?? [parts.open, parts.status, parts.cancel, reviewView]),\n );\n}\n","/** @module MermaidEffectUI */\nimport type { View } from '@effect/ui';\nimport type { Html } from '@effect/ui/html';\n\nimport type { MermaidDiagnostic } from './export-mermaid';\nimport type {\n ZlozGroupMermaidReviewControlsV3,\n ZlozGroupMermaidReviewRequestV3,\n} from './group-review-v3';\n\nconst directions = ['LR', 'RL', 'TB', 'BT'] as const;\n\nexport type GroupMermaidParts<M> = Readonly<{\n direction: View.Content<M> | null;\n source: View.Content<M> | null;\n findings: readonly View.Content<M>[];\n consent: View.Content<M> | null;\n download: View.Content<M> | null;\n reason: View.Content<M> | null;\n status: View.Content<M> | null;\n}>;\nexport type GroupMermaidReviewOptions<M = never> = Readonly<{\n id: string;\n label?: string;\n minimalMode?: boolean;\n findingLabel?: (finding: MermaidDiagnostic) => string | null;\n attributes?: Readonly<Record<string, string>>;\n diagnostics?: boolean;\n renderPart?: (\n part: Exclude<keyof GroupMermaidParts<M>, 'findings'>,\n controls: ZlozGroupMermaidReviewControlsV3,\n h: Html.H<M>,\n onRequest: (request: ZlozGroupMermaidReviewRequestV3) => M,\n ) => View.Content<M> | null | undefined;\n renderFinding?: (finding: MermaidDiagnostic, h: Html.H<M>) => View.Content<M> | null | undefined;\n renderLayout?: (\n parts: GroupMermaidParts<M>,\n controls: ZlozGroupMermaidReviewControlsV3,\n h: Html.H<M>,\n ) => readonly (View.Content<M> | string | null | undefined)[];\n}>;\n\n/** Native Effect UI controls. The host handles requests through the headless review reducer. */\nexport function groupMermaidReviewV3<Message>(\n h: Html.H<Message>,\n controls: ZlozGroupMermaidReviewControlsV3,\n onRequest: (request: ZlozGroupMermaidReviewRequestV3) => Message,\n options: GroupMermaidReviewOptions<Message>,\n) {\n const { identity, direction, findings, downloadReason } = controls;\n const selectId = `${options.id}-direction`;\n const reasonId = `${options.id}-reason`;\n const preview = controls.result.status === 'converted' ? controls.result.value.source : null;\n const part = (\n name: Exclude<keyof GroupMermaidParts<Message>, 'findings'>,\n fallback: View.Content<Message> | null,\n ) => {\n const rendered = options.renderPart?.(name, controls, h, onRequest);\n return rendered === undefined ? fallback : rendered;\n };\n const items = findings.flatMap((finding) => {\n const custom = options.renderFinding?.(finding, h);\n if (custom === null) return [];\n const subject = options.findingLabel ? options.findingLabel(finding) : finding.subject;\n return [\n custom ??\n h.li\n .attr('data-zloz-mermaid-finding', finding.code)\n .attr('title', finding.subject ?? finding.code)\n .children(`${finding.severity}: ${subject ? subject + ': ' : ''}${finding.message}`),\n ];\n });\n const parts: GroupMermaidParts<Message> = {\n direction: part(\n 'direction',\n h.div(\n h.label.attr('for', selectId).children('Mermaid direction'),\n h.select\n .id(selectId)\n .on('change', ({ value }) => {\n const chosen = directions.find((item) => item === value);\n return chosen\n ? onRequest({ ...identity, type: 'MermaidDirectionChanged', direction: chosen })\n : undefined;\n })\n .children(\n ...directions.map((value) =>\n h.option\n .attr('value', value)\n .selected(direction === value)\n .children(value),\n ),\n ),\n ),\n ),\n source: part(\n 'source',\n preview === null\n ? null\n : h.pre\n .attr('aria-label', 'Mermaid source preview')\n .attr('tabindex', '0')\n .style({\n overflow: 'auto',\n maxHeight: '280px',\n fontSize: '12px',\n padding: '12px',\n border: '1px solid var(--flow-node-border, #94a3b8)',\n borderRadius: '6px',\n background: 'var(--flow-node-background, transparent)',\n })\n .children(\n h.code.class('language-mermaid').children(\n ...preview.split(/(\"[^\"]*\"|\\bflowchart\\b|\\bsubgraph\\b|\\bend\\b)/g).map((token) =>\n token.startsWith('\"')\n ? h.span.style({ color: 'var(--flow-input-port, #0f766e)' }).children(token)\n : ['flowchart', 'subgraph', 'end'].includes(token)\n ? h.span\n .style({\n color: 'var(--flow-output-port, #2563eb)',\n fontWeight: '600',\n })\n .children(token)\n : token,\n ),\n ),\n ),\n ),\n status: part(\n 'status',\n options.minimalMode || options.diagnostics === false\n ? null\n : h.p\n .attr('role', 'status')\n .children(\n controls.reason ??\n (controls.accepted\n ? 'Exact Mermaid output accepted.'\n : 'Review Mermaid source and fidelity findings.'),\n ),\n ),\n findings: items,\n consent: part(\n 'consent',\n controls.hasLosses\n ? h.label(\n h.input\n .attr('type', 'checkbox')\n .attr('aria-label', 'Accept the reported Mermaid losses')\n .checked(controls.accepted)\n .disabled(controls.reason !== null || controls.busy)\n .on(\n 'click',\n onRequest({\n ...identity,\n type: 'MermaidLossAcceptanceChanged',\n accepted: !controls.accepted,\n }),\n ),\n 'Accept the reported Mermaid losses',\n )\n : null,\n ),\n reason: part(\n 'reason',\n downloadReason\n ? h.p\n .id(reasonId)\n .attr('aria-label', 'Mermaid export availability')\n .children(downloadReason)\n : null,\n ),\n download: part(\n 'download',\n h.button\n .attr('type', 'button')\n .attr('aria-describedby', downloadReason ? reasonId : undefined)\n .disabled(downloadReason !== null)\n .on('click', onRequest({ ...identity, type: 'MermaidDownloadRequested' }))\n .children('Download Mermaid bundle'),\n ),\n };\n return h.section\n .attrs(options.attributes ?? {})\n .id(options.id)\n .attr('aria-label', options.label ?? 'Native v3 Mermaid export review')\n .attr('data-zloz-mermaid-generation', String(identity.generation))\n .children(\n ...(options.renderLayout?.(parts, controls, h) ?? [\n parts.direction,\n parts.source,\n parts.status,\n items.length > 0\n ? h.ul.attr('aria-label', 'Mermaid fidelity findings').children(...items)\n : null,\n parts.consent,\n parts.reason,\n parts.download,\n ]),\n );\n}\n\nexport { reviewPacket, reviewPacketConsent, reviewPacketDownload } from './effect-ui-review-packet';\nexport type { ReviewPacketOptions, ReviewPacketParts } from './effect-ui-review-packet';\nexport { reviewReader } from './effect-ui-review-reader';\nexport type { ReviewReaderOptions, ReviewReaderParts } from './effect-ui-review-reader';\n"],"mappings":";;AAmDA,SAAgB,oBACd,GACA,EAAE,KAAK,QAAQ,iBAAiB,aAChC,SACA,QAAQ,oDACR;AACA,QAAO,EAAE,MACN,KAAK,QAAQ,WAAW,CACxB,KAAK,cAAc,MAAM,CACzB,KAAK,oBAAoB,UAAU,KAAA,EAAU,CAC7C,QAAQ,UAAU,CAClB,SAAS,CAAC,mBAAmB,WAAW,QAAQ,QAAQ,KAAK,CAC7D,GAAG,WAAW,EAAE,cACf,mBAAmB,QAAQ,QAAQ,WAAW,OAC1C,QAAQ;EAAE,MAAM;EAAkB;EAAK,UAAU;EAAS,CAAC,GAC3D,KAAA,EACL;;AAGL,SAAgB,qBACd,GACA,EAAE,KAAK,kBACP,SACA,QAAQ,0BACR;AACA,QAAO,EAAE,OACN,KAAK,QAAQ,SAAS,CACtB,KAAK,oBAAoB,kBAAkB,KAAA,EAAU,CACrD,KAAK,SAAS,kBAAkB,KAAA,EAAU,CAC1C,SAAS,mBAAmB,QAAQ,QAAQ,KAAK,CACjD,GAAG,eACF,QAAQ,QAAQ,mBAAmB,OAC/B,QAAQ;EAAE,MAAM;EAAmB;EAAK,CAAC,GACzC,KAAA,EACL,CACA,SAAS,MAAM;;;AAIpB,SAA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AAgC,OAAO,SAAS,WAAW,CAAC,CACjE,SACC,GAAI,QAAQ,eAAe,OAAO,UAAU,EAAE,IAAI;EAChD,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM,SAAS,IACX,EAAE,GAAG,KAAK,cAAc,4BAA4B,CAAC,SAAS,GAAG,MAAM,GACvE;EACJ,MAAM;EACN,MAAM;EACN,MAAM;EACP,CACF"}
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as MermaidDirection, A as ZlozReviewPacketResultV2, B as resolveReviewPacketControls, C as parseReviewPacket, D as ZlozReviewPacketV3, E as ZlozReviewPacketResultV3, F as ZlozReviewPacketControlsOptions, G as ZlozReviewPacketResult, H as ZlozReviewPacket, I as ZlozReviewPacketDecision, J as MermaidBundle, K as ZlozReviewSnapshot, L as ZlozReviewPacketExportState, M as createReviewPacketV2, N as openReviewPacketV2, O as createReviewPacketV3, P as ZlozReviewPacketControlsContext, Q as MermaidDiagnosticCode, R as ZlozReviewPacketRequest, S as ZlozReviewPacketParseResult, T as parseReviewPacketV3, U as ZlozReviewPacketDiagnostic, V as resolveReviewPacketRequest, W as ZlozReviewPacketOptions, X as MermaidBundleV3, Y as MermaidBundleV2, Z as MermaidDiagnostic, _ as createReviewReader, a as ZlozGroupMermaidReviewRequestV3, at as MermaidIdentityV3, b as updateReviewReader, c as createGroupMermaidReviewV3, ct as exportGroupMermaidV3, d as updateGroupMermaidReviewV3, dt as mermaidProtocolV2, et as MermaidExportOptions, f as ZlozReviewReaderOptions, ft as mermaidProtocolV3, g as ZlozReviewReaderUpdate, h as ZlozReviewReaderState, i as ZlozGroupMermaidReviewIdentityV3, it as MermaidIdentity, j as ZlozReviewPacketV2, k as openReviewPacketV3, l as groupMermaidReviewForScopeV3, lt as exportMermaid, m as ZlozReviewReaderSide, n as ZlozGroupMermaidReviewContextV3, nt as MermaidExportResultV2, o as ZlozGroupMermaidReviewStateV3, ot as MermaidLossPolicy, p as ZlozReviewReaderRequest, pt as mermaidSourceLimit, q as createReviewPacket, r as ZlozGroupMermaidReviewControlsV3, rt as MermaidExportResultV3, s as ZlozGroupMermaidReviewUpdateV3, st as exportConnectionMermaid, t as ZlozGroupMermaidDownloadV3, tt as MermaidExportResult, u as resolveGroupMermaidReviewV3, ut as mermaidProtocol, v as resolveReviewReader, w as parseReviewPacketV2, x as ZlozReviewPacketParseOptions, y as reviewReaderForScope, z as ZlozReviewPacketSelection } from "./group-review-v3-BHP9Srfp.mjs";
1
+ import { $ as MermaidDirection, A as resolveReviewPacketRequest, B as ZlozGroupMermaidReviewIdentityV3, C as ZlozReviewPacketControlsContext, D as ZlozReviewPacketRequest, E as ZlozReviewPacketExportState, F as ZlozReviewSnapshot, G as groupMermaidReviewForScopeV3, H as ZlozGroupMermaidReviewStateV3, I as createReviewPacket, J as MermaidBundle, K as resolveGroupMermaidReviewV3, L as ZlozGroupMermaidDownloadV3, M as ZlozReviewPacketDiagnostic, N as ZlozReviewPacketOptions, O as ZlozReviewPacketSelection, P as ZlozReviewPacketResult, Q as MermaidDiagnosticCode, R as ZlozGroupMermaidReviewContextV3, S as openReviewPacketV2, T as ZlozReviewPacketDecision, U as ZlozGroupMermaidReviewUpdateV3, V as ZlozGroupMermaidReviewRequestV3, W as createGroupMermaidReviewV3, X as MermaidBundleV3, Y as MermaidBundleV2, Z as MermaidDiagnostic, _ as createReviewPacketV3, a as ZlozReviewReaderUpdate, at as MermaidIdentityV3, b as ZlozReviewPacketV2, c as reviewReaderForScope, ct as exportGroupMermaidV3, d as ZlozReviewPacketParseResult, dt as mermaidProtocolV2, et as MermaidExportOptions, f as parseReviewPacket, ft as mermaidProtocolV3, g as ZlozReviewPacketV3, h as ZlozReviewPacketResultV3, i as ZlozReviewReaderState, it as MermaidIdentity, j as ZlozReviewPacket, k as resolveReviewPacketControls, l as updateReviewReader, lt as exportMermaid, m as parseReviewPacketV3, n as ZlozReviewReaderRequest, nt as MermaidExportResultV2, o as createReviewReader, ot as MermaidLossPolicy, p as parseReviewPacketV2, pt as mermaidSourceLimit, q as updateGroupMermaidReviewV3, r as ZlozReviewReaderSide, rt as MermaidExportResultV3, s as resolveReviewReader, st as exportConnectionMermaid, t as ZlozReviewReaderOptions, tt as MermaidExportResult, u as ZlozReviewPacketParseOptions, ut as mermaidProtocol, v as openReviewPacketV3, w as ZlozReviewPacketControlsOptions, x as createReviewPacketV2, y as ZlozReviewPacketResultV2, z as ZlozGroupMermaidReviewControlsV3 } from "./review-reader-CuGbHsR3.mjs";
2
2
  export { MermaidBundle, MermaidBundleV2, MermaidBundleV3, MermaidDiagnostic, MermaidDiagnosticCode, MermaidDirection, MermaidExportOptions, MermaidExportResult, MermaidExportResultV2, MermaidExportResultV3, MermaidIdentity, MermaidIdentityV3, MermaidLossPolicy, ZlozGroupMermaidDownloadV3, ZlozGroupMermaidReviewContextV3, ZlozGroupMermaidReviewControlsV3, ZlozGroupMermaidReviewIdentityV3, ZlozGroupMermaidReviewRequestV3, ZlozGroupMermaidReviewStateV3, ZlozGroupMermaidReviewUpdateV3, type ZlozReviewPacket, type ZlozReviewPacketControlsContext, type ZlozReviewPacketControlsOptions, type ZlozReviewPacketDecision, type ZlozReviewPacketDiagnostic, type ZlozReviewPacketExportState, type ZlozReviewPacketOptions, type ZlozReviewPacketParseOptions, type ZlozReviewPacketParseResult, type ZlozReviewPacketRequest, type ZlozReviewPacketResult, ZlozReviewPacketResultV2, ZlozReviewPacketResultV3, type ZlozReviewPacketSelection, ZlozReviewPacketV2, ZlozReviewPacketV3, type ZlozReviewReaderOptions, type ZlozReviewReaderRequest, type ZlozReviewReaderSide, type ZlozReviewReaderState, type ZlozReviewReaderUpdate, type ZlozReviewSnapshot, createGroupMermaidReviewV3, createReviewPacket, createReviewPacketV2, createReviewPacketV3, createReviewReader, exportConnectionMermaid, exportGroupMermaidV3, exportMermaid, groupMermaidReviewForScopeV3, mermaidProtocol, mermaidProtocolV2, mermaidProtocolV3, mermaidSourceLimit, openReviewPacketV2, openReviewPacketV3, parseReviewPacket, parseReviewPacketV2, parseReviewPacketV3, resolveGroupMermaidReviewV3, resolveReviewPacketControls, resolveReviewPacketRequest, resolveReviewReader, reviewReaderForScope, updateGroupMermaidReviewV3, updateReviewReader };
@@ -108,6 +108,78 @@ type MermaidExportResultV3 = Readonly<{
108
108
  /** Native full-document projection. Boundary links do not preserve socket attachment: explicit report policy never hides that loss or permits errors. */
109
109
  declare function exportGroupMermaidV3(document: ZlozGroupDocumentV3, options?: MermaidExportOptions): MermaidExportResultV3;
110
110
  //#endregion
111
+ //#region src/group-review-v3.d.ts
112
+ type ZlozGroupMermaidReviewStateV3 = Readonly<{
113
+ scope: string;
114
+ generation: number;
115
+ direction: MermaidDirection;
116
+ lossKey: string | null;
117
+ run: number;
118
+ download: Readonly<{
119
+ type: 'idle';
120
+ }> | Readonly<{
121
+ type: 'pending';
122
+ key: string;
123
+ run: number;
124
+ }>;
125
+ }>;
126
+ type ZlozGroupMermaidReviewContextV3 = Readonly<{
127
+ scope: string;
128
+ sourceRevision: number | string;
129
+ document: ZlozGroupDocumentV3;
130
+ fileName?: string;
131
+ canDownload?: (document: ZlozGroupDocumentV3, bundle: MermaidBundleV3 | null) => string | null;
132
+ }>;
133
+ type ZlozGroupMermaidReviewIdentityV3 = Readonly<{
134
+ scope: string;
135
+ generation: number;
136
+ key: string;
137
+ }>;
138
+ type ZlozGroupMermaidReviewRequestV3 = ZlozGroupMermaidReviewIdentityV3 & (Readonly<{
139
+ type: 'MermaidDirectionChanged';
140
+ direction: MermaidDirection;
141
+ }> | Readonly<{
142
+ type: 'MermaidLossAcceptanceChanged';
143
+ accepted: boolean;
144
+ }> | Readonly<{
145
+ type: 'MermaidDownloadRequested';
146
+ }> | Readonly<{
147
+ type: 'MermaidDownloadSettled';
148
+ run: number;
149
+ outcome: 'succeeded' | 'failed';
150
+ }>);
151
+ type ZlozGroupMermaidReviewControlsV3 = Readonly<{
152
+ identity: ZlozGroupMermaidReviewIdentityV3;
153
+ direction: MermaidDirection;
154
+ result: MermaidExportResultV3;
155
+ findings: readonly MermaidDiagnostic[];
156
+ hasLosses: boolean;
157
+ accepted: boolean;
158
+ busy: boolean;
159
+ reason: string | null;
160
+ downloadReason: string | null;
161
+ fileName: string;
162
+ }>;
163
+ type ZlozGroupMermaidDownloadV3 = ZlozGroupMermaidReviewIdentityV3 & Readonly<{
164
+ run: number;
165
+ fileName: string;
166
+ bundle: MermaidBundleV3;
167
+ text: string;
168
+ }>;
169
+ type ZlozGroupMermaidReviewUpdateV3 = Readonly<{
170
+ state: ZlozGroupMermaidReviewStateV3;
171
+ payload: ZlozGroupMermaidDownloadV3 | null;
172
+ notice: string;
173
+ }>;
174
+ /** Trusted model state only. Never deserialize this record as consent or download authority. */
175
+ declare function createGroupMermaidReviewV3(scope: string, direction?: MermaidDirection): ZlozGroupMermaidReviewStateV3;
176
+ /** Reset authority when switching working/edition scopes; direction is a preference only. */
177
+ declare function groupMermaidReviewForScopeV3(state: ZlozGroupMermaidReviewStateV3, scope: string): ZlozGroupMermaidReviewStateV3;
178
+ /** Pure full-document preview; report mode exposes losses without authorizing IO. Exact keys must not be persisted or used as DOM attributes. */
179
+ declare function resolveGroupMermaidReviewV3(state: ZlozGroupMermaidReviewStateV3, context: ZlozGroupMermaidReviewContextV3): ZlozGroupMermaidReviewControlsV3;
180
+ /** Recompute source/output/policy immediately before each request. Host Commands consume only returned detached payloads. */
181
+ declare function updateGroupMermaidReviewV3(state: ZlozGroupMermaidReviewStateV3, context: ZlozGroupMermaidReviewContextV3, request: ZlozGroupMermaidReviewRequestV3): ZlozGroupMermaidReviewUpdateV3;
182
+ //#endregion
111
183
  //#region src/review-packet.d.ts
112
184
  type ZlozReviewPacketOptions = MermaidExportOptions & Readonly<{
113
185
  /** Complete replacement catalogue. Packet interpretation is deliberately data-only. */rules?: readonly ZlozEventStormingRelationshipRule[];
@@ -385,77 +457,5 @@ declare function resolveReviewReader(state: ZlozReviewReaderState, options?: Zlo
385
457
  /** Pure request/live-policy boundary. Last good review survives failed, cancelled or stale reads. */
386
458
  declare function updateReviewReader(state: ZlozReviewReaderState, request: ZlozReviewReaderRequest, options?: ZlozReviewReaderOptions): ZlozReviewReaderUpdate;
387
459
  //#endregion
388
- //#region src/group-review-v3.d.ts
389
- type ZlozGroupMermaidReviewStateV3 = Readonly<{
390
- scope: string;
391
- generation: number;
392
- direction: MermaidDirection;
393
- lossKey: string | null;
394
- run: number;
395
- download: Readonly<{
396
- type: 'idle';
397
- }> | Readonly<{
398
- type: 'pending';
399
- key: string;
400
- run: number;
401
- }>;
402
- }>;
403
- type ZlozGroupMermaidReviewContextV3 = Readonly<{
404
- scope: string;
405
- sourceRevision: number | string;
406
- document: ZlozGroupDocumentV3;
407
- fileName?: string;
408
- canDownload?: (document: ZlozGroupDocumentV3, bundle: MermaidBundleV3 | null) => string | null;
409
- }>;
410
- type ZlozGroupMermaidReviewIdentityV3 = Readonly<{
411
- scope: string;
412
- generation: number;
413
- key: string;
414
- }>;
415
- type ZlozGroupMermaidReviewRequestV3 = ZlozGroupMermaidReviewIdentityV3 & (Readonly<{
416
- type: 'MermaidDirectionChanged';
417
- direction: MermaidDirection;
418
- }> | Readonly<{
419
- type: 'MermaidLossAcceptanceChanged';
420
- accepted: boolean;
421
- }> | Readonly<{
422
- type: 'MermaidDownloadRequested';
423
- }> | Readonly<{
424
- type: 'MermaidDownloadSettled';
425
- run: number;
426
- outcome: 'succeeded' | 'failed';
427
- }>);
428
- type ZlozGroupMermaidReviewControlsV3 = Readonly<{
429
- identity: ZlozGroupMermaidReviewIdentityV3;
430
- direction: MermaidDirection;
431
- result: MermaidExportResultV3;
432
- findings: readonly MermaidDiagnostic[];
433
- hasLosses: boolean;
434
- accepted: boolean;
435
- busy: boolean;
436
- reason: string | null;
437
- downloadReason: string | null;
438
- fileName: string;
439
- }>;
440
- type ZlozGroupMermaidDownloadV3 = ZlozGroupMermaidReviewIdentityV3 & Readonly<{
441
- run: number;
442
- fileName: string;
443
- bundle: MermaidBundleV3;
444
- text: string;
445
- }>;
446
- type ZlozGroupMermaidReviewUpdateV3 = Readonly<{
447
- state: ZlozGroupMermaidReviewStateV3;
448
- payload: ZlozGroupMermaidDownloadV3 | null;
449
- notice: string;
450
- }>;
451
- /** Trusted model state only. Never deserialize this record as consent or download authority. */
452
- declare function createGroupMermaidReviewV3(scope: string, direction?: MermaidDirection): ZlozGroupMermaidReviewStateV3;
453
- /** Reset authority when switching working/edition scopes; direction is a preference only. */
454
- declare function groupMermaidReviewForScopeV3(state: ZlozGroupMermaidReviewStateV3, scope: string): ZlozGroupMermaidReviewStateV3;
455
- /** Pure full-document preview; report mode exposes losses without authorizing IO. Exact keys must not be persisted or used as DOM attributes. */
456
- declare function resolveGroupMermaidReviewV3(state: ZlozGroupMermaidReviewStateV3, context: ZlozGroupMermaidReviewContextV3): ZlozGroupMermaidReviewControlsV3;
457
- /** Recompute source/output/policy immediately before each request. Host Commands consume only returned detached payloads. */
458
- declare function updateGroupMermaidReviewV3(state: ZlozGroupMermaidReviewStateV3, context: ZlozGroupMermaidReviewContextV3, request: ZlozGroupMermaidReviewRequestV3): ZlozGroupMermaidReviewUpdateV3;
459
- //#endregion
460
- export { MermaidDirection as $, ZlozReviewPacketResultV2 as A, resolveReviewPacketControls as B, parseReviewPacket as C, ZlozReviewPacketV3 as D, ZlozReviewPacketResultV3 as E, ZlozReviewPacketControlsOptions as F, ZlozReviewPacketResult as G, ZlozReviewPacket as H, ZlozReviewPacketDecision as I, MermaidBundle as J, ZlozReviewSnapshot as K, ZlozReviewPacketExportState as L, createReviewPacketV2 as M, openReviewPacketV2 as N, createReviewPacketV3 as O, ZlozReviewPacketControlsContext as P, MermaidDiagnosticCode as Q, ZlozReviewPacketRequest as R, ZlozReviewPacketParseResult as S, parseReviewPacketV3 as T, ZlozReviewPacketDiagnostic as U, resolveReviewPacketRequest as V, ZlozReviewPacketOptions as W, MermaidBundleV3 as X, MermaidBundleV2 as Y, MermaidDiagnostic as Z, createReviewReader as _, ZlozGroupMermaidReviewRequestV3 as a, MermaidIdentityV3 as at, updateReviewReader as b, createGroupMermaidReviewV3 as c, exportGroupMermaidV3 as ct, updateGroupMermaidReviewV3 as d, mermaidProtocolV2 as dt, MermaidExportOptions as et, ZlozReviewReaderOptions as f, mermaidProtocolV3 as ft, ZlozReviewReaderUpdate as g, ZlozReviewReaderState as h, ZlozGroupMermaidReviewIdentityV3 as i, MermaidIdentity as it, ZlozReviewPacketV2 as j, openReviewPacketV3 as k, groupMermaidReviewForScopeV3 as l, exportMermaid as lt, ZlozReviewReaderSide as m, ZlozGroupMermaidReviewContextV3 as n, MermaidExportResultV2 as nt, ZlozGroupMermaidReviewStateV3 as o, MermaidLossPolicy as ot, ZlozReviewReaderRequest as p, mermaidSourceLimit as pt, createReviewPacket as q, ZlozGroupMermaidReviewControlsV3 as r, MermaidExportResultV3 as rt, ZlozGroupMermaidReviewUpdateV3 as s, exportConnectionMermaid as st, ZlozGroupMermaidDownloadV3 as t, MermaidExportResult as tt, resolveGroupMermaidReviewV3 as u, mermaidProtocol as ut, resolveReviewReader as v, parseReviewPacketV2 as w, ZlozReviewPacketParseOptions as x, reviewReaderForScope as y, ZlozReviewPacketSelection as z };
461
- //# sourceMappingURL=group-review-v3-BHP9Srfp.d.mts.map
460
+ export { MermaidDirection as $, resolveReviewPacketRequest as A, ZlozGroupMermaidReviewIdentityV3 as B, ZlozReviewPacketControlsContext as C, ZlozReviewPacketRequest as D, ZlozReviewPacketExportState as E, ZlozReviewSnapshot as F, groupMermaidReviewForScopeV3 as G, ZlozGroupMermaidReviewStateV3 as H, createReviewPacket as I, MermaidBundle as J, resolveGroupMermaidReviewV3 as K, ZlozGroupMermaidDownloadV3 as L, ZlozReviewPacketDiagnostic as M, ZlozReviewPacketOptions as N, ZlozReviewPacketSelection as O, ZlozReviewPacketResult as P, MermaidDiagnosticCode as Q, ZlozGroupMermaidReviewContextV3 as R, openReviewPacketV2 as S, ZlozReviewPacketDecision as T, ZlozGroupMermaidReviewUpdateV3 as U, ZlozGroupMermaidReviewRequestV3 as V, createGroupMermaidReviewV3 as W, MermaidBundleV3 as X, MermaidBundleV2 as Y, MermaidDiagnostic as Z, createReviewPacketV3 as _, ZlozReviewReaderUpdate as a, MermaidIdentityV3 as at, ZlozReviewPacketV2 as b, reviewReaderForScope as c, exportGroupMermaidV3 as ct, ZlozReviewPacketParseResult as d, mermaidProtocolV2 as dt, MermaidExportOptions as et, parseReviewPacket as f, mermaidProtocolV3 as ft, ZlozReviewPacketV3 as g, ZlozReviewPacketResultV3 as h, ZlozReviewReaderState as i, MermaidIdentity as it, ZlozReviewPacket as j, resolveReviewPacketControls as k, updateReviewReader as l, exportMermaid as lt, parseReviewPacketV3 as m, ZlozReviewReaderRequest as n, MermaidExportResultV2 as nt, createReviewReader as o, MermaidLossPolicy as ot, parseReviewPacketV2 as p, mermaidSourceLimit as pt, updateGroupMermaidReviewV3 as q, ZlozReviewReaderSide as r, MermaidExportResultV3 as rt, resolveReviewReader as s, exportConnectionMermaid as st, ZlozReviewReaderOptions as t, MermaidExportResult as tt, ZlozReviewPacketParseOptions as u, mermaidProtocol as ut, openReviewPacketV3 as v, ZlozReviewPacketControlsOptions as w, createReviewPacketV2 as x, ZlozReviewPacketResultV2 as y, ZlozGroupMermaidReviewControlsV3 as z };
461
+ //# sourceMappingURL=review-reader-CuGbHsR3.d.mts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opsydyn/foldkit-zloz-mermaid",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Optional, loss-aware Mermaid export for ZLOZ.",
5
5
  "keywords": [
6
6
  "diagram",
@@ -38,9 +38,9 @@
38
38
  "import": "./dist/index.mjs"
39
39
  },
40
40
  "./package.json": "./package.json",
41
- "./foldkit": {
42
- "types": "./dist/foldkit.d.mts",
43
- "import": "./dist/foldkit.mjs"
41
+ "./effect-ui": {
42
+ "types": "./dist/effect-ui.d.mts",
43
+ "import": "./dist/effect-ui.mjs"
44
44
  }
45
45
  },
46
46
  "publishConfig": {
@@ -56,24 +56,18 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@arethetypeswrong/cli": "0.18.5",
59
- "@opsydyn/foldkit-zloz": "0.11.0",
59
+ "@effect/ui": "https://pkg.pr.new/Effect-TS/ui/@effect/ui@6679263",
60
+ "@opsydyn/foldkit-zloz": "0.11.1",
60
61
  "@types/node": "^22.0.0",
61
62
  "bun-types": "^1.3.14",
62
- "effect": "4.1.0",
63
- "foldkit": "0.171.0",
63
+ "effect": "4.1.6",
64
64
  "happy-dom": "^21.0.4",
65
65
  "publint": "0.3.25",
66
66
  "tsdown": "^0.21.8",
67
67
  "typescript": "^6.0.3"
68
68
  },
69
69
  "peerDependencies": {
70
- "@opsydyn/foldkit-zloz": "0.11.0",
71
- "foldkit": ">=0.170.0 <0.172.0"
72
- },
73
- "peerDependenciesMeta": {
74
- "foldkit": {
75
- "optional": true
76
- }
70
+ "@opsydyn/foldkit-zloz": "0.11.1"
77
71
  },
78
72
  "engines": {
79
73
  "node": ">=22.0.0"
@@ -1,89 +0,0 @@
1
- import { P as ZlozReviewPacketControlsContext, R as ZlozReviewPacketRequest, U as ZlozReviewPacketDiagnostic, Z as MermaidDiagnostic, a as ZlozGroupMermaidReviewRequestV3, f as ZlozReviewReaderOptions, h as ZlozReviewReaderState, p as ZlozReviewReaderRequest, r as ZlozGroupMermaidReviewControlsV3 } from "./group-review-v3-BHP9Srfp.mjs";
2
- import { ZlozDiagnosticOptions, ZlozTheme } from "@opsydyn/foldkit-zloz/foldkit";
3
- import { Html, HtmlBuilder } from "foldkit/html";
4
-
5
- //#region src/review-reader-view.d.ts
6
- type Attributes$1<M> = Parameters<HtmlBuilder<M>['div']>[0];
7
- type ZlozReviewReaderParts = Readonly<{
8
- open: Html | null;
9
- status: Html | null;
10
- summary: Html | null;
11
- selection: Html | null;
12
- findings: Html | null;
13
- cancel: Html | null;
14
- close: Html | null;
15
- }>;
16
- type ZlozReviewReaderViewOptions<M> = Readonly<{
17
- attributes?: Attributes$1<M>;
18
- idPrefix?: string;
19
- instructions?: boolean;
20
- showCounts?: boolean;
21
- renderFinding?: (finding: ZlozReviewPacketDiagnostic, h: HtmlBuilder<M>) => Html | null | undefined;
22
- renderSummary?: (state: ZlozReviewReaderState, h: HtmlBuilder<M>) => Html | null | undefined;
23
- renderLayout?: (parts: ZlozReviewReaderParts, h: HtmlBuilder<M>) => readonly Html[];
24
- }>;
25
- /** Native/composable read-only reader controls; file IO and canvas ownership stay with the host. */
26
- declare function zlozReviewReader<M>(h: HtmlBuilder<M>, state: ZlozReviewReaderState, onRequest: (request: ZlozReviewReaderRequest) => M, onFiles: (files: readonly File[]) => M, policy?: ZlozReviewReaderOptions, options?: ZlozReviewReaderViewOptions<M>): Html;
27
- //#endregion
28
- //#region src/group-review-v3-view.d.ts
29
- type OnRequest$1<M> = (request: ZlozGroupMermaidReviewRequestV3) => M;
30
- type ZlozGroupMermaidReviewPartsV3 = Readonly<{
31
- direction: Html | null;
32
- source: Html | null;
33
- findings: readonly Html[];
34
- consent: Html | null;
35
- download: Html | null;
36
- reason: Html | null;
37
- status: Html | null;
38
- }>;
39
- type ZlozGroupMermaidReviewViewOptionsV3<M> = ZlozDiagnosticOptions & Readonly<{
40
- id: string;
41
- label?: string;
42
- theme?: ZlozTheme;
43
- attributes?: Parameters<HtmlBuilder<M>['section']>[0]; /** Undefined retains the default; null removes the part. The host owns explanations in replacements. */
44
- renderPart?: (part: Exclude<keyof ZlozGroupMermaidReviewPartsV3, 'findings'>, controls: ZlozGroupMermaidReviewControlsV3, h: HtmlBuilder<M>, onRequest: OnRequest$1<M>) => Html | null | undefined;
45
- renderFinding?: (finding: MermaidDiagnostic, h: HtmlBuilder<M>) => Html | null | undefined;
46
- renderLayout?: (parts: ZlozGroupMermaidReviewPartsV3, controls: ZlozGroupMermaidReviewControlsV3, h: HtmlBuilder<M>) => readonly Html[];
47
- }>;
48
- declare function zlozGroupMermaidConsentV3<M>(h: HtmlBuilder<M>, controls: ZlozGroupMermaidReviewControlsV3, onRequest: OnRequest$1<M>, attributes?: Parameters<HtmlBuilder<M>['input']>[0]): Html;
49
- declare function zlozGroupMermaidDownloadV3<M>(h: HtmlBuilder<M>, controls: ZlozGroupMermaidReviewControlsV3, onRequest: OnRequest$1<M>, attributes?: Parameters<HtmlBuilder<M>['button']>[0], children?: Parameters<HtmlBuilder<M>['button']>[1]): Html;
50
- /** Optional source review only. No Mermaid renderer, executable markup or DOM IO enters the product. */
51
- declare function zlozGroupMermaidReviewV3<M>(h: HtmlBuilder<M>, controls: ZlozGroupMermaidReviewControlsV3, onRequest: OnRequest$1<M>, options: ZlozGroupMermaidReviewViewOptionsV3<M>): Html;
52
- //#endregion
53
- //#region src/foldkit.d.ts
54
- type Attributes<M> = Parameters<HtmlBuilder<M>['div']>[0];
55
- type Children<M> = Parameters<HtmlBuilder<M>['div']>[1];
56
- type OnRequest<M> = (request: ZlozReviewPacketRequest) => M;
57
- type ZlozReviewPacketParts = Readonly<{
58
- scope: Html | null;
59
- diagnostics: readonly Html[];
60
- consent: Html | null;
61
- download: Html | null;
62
- reason: Html | null;
63
- status: Html | null;
64
- }>;
65
- type ZlozReviewPacketViewOptions<M> = Readonly<{
66
- attributes?: Attributes<M>;
67
- label?: string;
68
- showCounts?: boolean;
69
- scopeLabel?: string;
70
- diagnosticsLabel?: string;
71
- consentLabel?: string;
72
- downloadLabel?: string;
73
- reasonLabel?: string;
74
- statusLabel?: string;
75
- renderScope?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => Html | null | undefined;
76
- renderDiagnostic?: (item: ZlozReviewPacketDiagnostic, h: HtmlBuilder<M>) => Html | null | undefined;
77
- renderConsent?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>, onRequest: OnRequest<M>) => Html | null | undefined;
78
- renderDownload?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>, onRequest: OnRequest<M>) => Html | null | undefined;
79
- renderReason?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => Html | null | undefined;
80
- renderStatus?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => Html | null | undefined;
81
- renderLayout?: (parts: ZlozReviewPacketParts, context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => readonly Html[];
82
- }>;
83
- declare function zlozReviewPacketConsent<M>(h: HtmlBuilder<M>, context: ZlozReviewPacketControlsContext, onRequest: OnRequest<M>, attributes?: Parameters<HtmlBuilder<M>['input']>[0], label?: string): Html;
84
- declare function zlozReviewPacketDownload<M>(h: HtmlBuilder<M>, context: ZlozReviewPacketControlsContext, onRequest: OnRequest<M>, attributes?: Parameters<HtmlBuilder<M>['button']>[0], children?: Children<M>, label?: string): Html;
85
- /** Nullable slots remove parts; undefined retains accessible native defaults. Custom diagnostics own list-item semantics. */
86
- declare function zlozReviewPacketControls<M>(h: HtmlBuilder<M>, context: ZlozReviewPacketControlsContext, onRequest: OnRequest<M>, options?: ZlozReviewPacketViewOptions<M>): Html;
87
- //#endregion
88
- export { type ZlozGroupMermaidReviewPartsV3, type ZlozGroupMermaidReviewViewOptionsV3, ZlozReviewPacketParts, ZlozReviewPacketViewOptions, type ZlozReviewReaderParts, type ZlozReviewReaderViewOptions, zlozGroupMermaidConsentV3, zlozGroupMermaidDownloadV3, zlozGroupMermaidReviewV3, zlozReviewPacketConsent, zlozReviewPacketControls, zlozReviewPacketDownload, zlozReviewReader };
89
- //# sourceMappingURL=foldkit.d.mts.map
package/dist/foldkit.mjs DELETED
@@ -1,246 +0,0 @@
1
- import { n as resolveReviewReader } from "./review-reader-BjZIRpPb.mjs";
2
- import { resolveZlozDiagnostics, zlozThemeStyle } from "@opsydyn/foldkit-zloz/foldkit";
3
- //#region src/review-reader-view.ts
4
- /** Native/composable read-only reader controls; file IO and canvas ownership stay with the host. */
5
- function zlozReviewReader(h, state, onRequest, onFiles, policy = {}, options = {}) {
6
- const context = resolveReviewReader(state, policy), id = options.idPrefix ?? "zloz-review-reader";
7
- const open = h.label([h.For(`${id}-file`)], ["Open review packet", h.input([
8
- h.Id(`${id}-file`),
9
- h.Type("file"),
10
- h.Accept(".json,application/json"),
11
- h.Disabled(context.openReason !== null),
12
- h.OnFileChange(onFiles)
13
- ])]);
14
- const status = h.p([h.Role("status"), h.AriaLive("polite")], [context.openReason ?? state.notice]);
15
- const cancel = state.pending ? h.button([h.Type("button"), h.OnClick(onRequest({
16
- scope: state.scope,
17
- type: "ReadCancelled",
18
- run: state.pending.run
19
- }))], ["Cancel packet read"]) : null;
20
- const review = state.review;
21
- const customSummary = options.renderSummary?.(state, h);
22
- const summary = customSummary === void 0 ? review ? h.div([], [
23
- h.strong([], [review.packet.model.name]),
24
- h.p([], ["Read-only packet · ", review.name]),
25
- h.p([], [`Audit: ${review.packet.comparison.status}`]),
26
- ...options.showCounts === false ? [] : [h.p([h.DataAttribute("review-reader-counts", "")], [`${review.packet.comparison.summary.introduced} introduced · ${review.packet.comparison.summary.resolved} resolved · ${review.packet.comparison.summary.persisting} persisting`])]
27
- ]) : null : customSummary;
28
- const selection = review ? h.div([h.Role("group"), h.AriaLabel("Packet snapshot")], [...["baseline", "selected"].map((side) => h.button([
29
- h.Type("button"),
30
- h.AriaPressed(String(review.side === side)),
31
- h.Disabled(context.sideReason !== null),
32
- h.OnClick(onRequest({
33
- scope: state.scope,
34
- type: "SideSelected",
35
- reviewId: review.id,
36
- side
37
- }))
38
- ], [side === "baseline" ? `Baseline: ${review.packet.baseline.source.name}` : `Selected: ${review.packet.selected.source.kind === "current" ? "Current graph" : review.packet.selected.source.name}`])), ...context.sideReason ? [h.p([], [context.sideReason])] : []]) : null;
39
- const findings = review ? h.div([h.AriaLabel("Packet findings")], [
40
- ...review.packet.comparison.introduced.map((f) => h.p([], [`Introduced · ${f.edgeId}: ${f.message}`])),
41
- ...review.packet.comparison.resolved.map((f) => h.p([], [`Resolved · ${f.edgeId}: ${f.message}`])),
42
- ...review.packet.comparison.persisting.map((f) => h.p([], [`Persisting · ${f.after.edgeId}: ${f.after.message}`])),
43
- h.ul([h.AriaLabel("Packet projection findings")], review.packet.diagnostics.flatMap((f) => {
44
- const custom = options.renderFinding?.(f, h);
45
- return custom === null ? [] : [custom ?? h.li([], [`${f.side} · ${f.code}: ${f.message}`])];
46
- }))
47
- ]) : null;
48
- const close = review ? h.button([h.Type("button"), h.OnClick(onRequest({
49
- scope: state.scope,
50
- type: "ReviewClosed",
51
- reviewId: review.id
52
- }))], ["Close packet review"]) : null;
53
- const parts = {
54
- open,
55
- status,
56
- summary,
57
- selection,
58
- findings,
59
- cancel,
60
- close
61
- };
62
- return h.div([h.DataAttribute("review-reader", ""), ...options.attributes ?? []], [...options.instructions === false ? [] : [h.p([], ["Open a portable packet for inspection. Reading never imports or edits your model."])], ...options.renderLayout?.(parts, h) ?? [
63
- open,
64
- status,
65
- cancel,
66
- summary,
67
- selection,
68
- close,
69
- findings
70
- ].flatMap((part) => part === null ? [] : [part])]);
71
- }
72
- //#endregion
73
- //#region src/group-review-v3-view.ts
74
- function zlozGroupMermaidConsentV3(h, controls, onRequest, attributes = []) {
75
- return h.input([
76
- ...attributes,
77
- h.Type("checkbox"),
78
- h.AriaLabel("Accept the reported Mermaid losses"),
79
- h.Checked(controls.accepted),
80
- h.Disabled(controls.reason !== null || !controls.hasLosses || controls.busy),
81
- h.OnClick(onRequest({
82
- ...controls.identity,
83
- type: "MermaidLossAcceptanceChanged",
84
- accepted: !controls.accepted
85
- }))
86
- ]);
87
- }
88
- function zlozGroupMermaidDownloadV3(h, controls, onRequest, attributes = [], children = ["Download Mermaid bundle"]) {
89
- return h.button([
90
- ...attributes,
91
- h.Type("button"),
92
- h.Disabled(controls.downloadReason !== null),
93
- h.Title(controls.downloadReason ?? "Download the reviewed native bundle"),
94
- h.OnClick(onRequest({
95
- ...controls.identity,
96
- type: "MermaidDownloadRequested"
97
- }))
98
- ], children);
99
- }
100
- /** Optional source review only. No Mermaid renderer, executable markup or DOM IO enters the product. */
101
- function zlozGroupMermaidReviewV3(h, controls, onRequest, options) {
102
- const diagnostics = resolveZlozDiagnostics(options), choose = options.id + "-direction";
103
- const part = (name, fallback) => {
104
- const custom = options.renderPart?.(name, controls, h, onRequest);
105
- return custom === void 0 ? fallback() : custom;
106
- };
107
- const parts = {
108
- direction: part("direction", () => h.div([], [h.label([h.For(choose)], ["Mermaid direction"]), h.select([
109
- h.Id(choose),
110
- h.Value(controls.direction),
111
- h.OnChange((value) => onRequest({
112
- ...controls.identity,
113
- type: "MermaidDirectionChanged",
114
- direction: value === "TB" ? "TB" : value === "RL" ? "RL" : value === "BT" ? "BT" : "LR"
115
- }))
116
- ], [
117
- "LR",
118
- "RL",
119
- "TB",
120
- "BT"
121
- ].map((value) => h.option([h.Value(value)], [value])))])),
122
- source: part("source", () => controls.result.status === "converted" ? h.pre([
123
- h.AriaLabel("Mermaid source preview"),
124
- h.Tabindex(0),
125
- h.Style({
126
- overflow: "auto",
127
- "max-height": "280px",
128
- "font-size": "12px",
129
- padding: "12px",
130
- border: "1px solid var(--flow-node-border, #94a3b8)",
131
- "border-radius": "6px",
132
- background: "var(--flow-node-background, transparent)"
133
- })
134
- ], [h.code([h.Class("language-mermaid")], controls.result.value.source.split(/("[^"]*"|\bflowchart\b|\bsubgraph\b|\bend\b)/g).map((token) => token.startsWith("\"") ? h.span([h.Style({ color: "var(--flow-input-port, #0f766e)" })], [token]) : [
135
- "flowchart",
136
- "subgraph",
137
- "end"
138
- ].includes(token) ? h.span([h.Style({
139
- color: "var(--flow-output-port, #2563eb)",
140
- "font-weight": "600"
141
- })], [token]) : token))]) : null),
142
- findings: controls.findings.flatMap((finding) => {
143
- const custom = options.renderFinding?.(finding, h), node = custom === void 0 ? h.li([h.DataAttribute("zloz-mermaid-finding", finding.code)], [`${finding.severity}: ${finding.subject ? finding.subject + ": " : ""}${finding.message}`]) : custom;
144
- return node === null ? [] : [node];
145
- }),
146
- consent: part("consent", () => controls.hasLosses ? h.label([h.Style({
147
- display: "flex",
148
- "align-items": "center",
149
- gap: "8px"
150
- })], [zlozGroupMermaidConsentV3(h, controls, onRequest, [h.Style({
151
- display: "inline-block",
152
- width: "auto",
153
- "margin-right": "8px"
154
- })]), "Accept the reported Mermaid losses"]) : null),
155
- download: part("download", () => zlozGroupMermaidDownloadV3(h, controls, onRequest)),
156
- reason: part("reason", () => controls.downloadReason ? h.p([h.AriaLabel("Mermaid export availability")], [controls.downloadReason]) : null),
157
- status: part("status", () => diagnostics.status ? h.p([h.Role("status"), h.AriaLive("polite")], [controls.reason ?? (controls.accepted ? "Exact Mermaid output accepted." : "Review Mermaid source and fidelity findings.")]) : null)
158
- };
159
- const content = options.renderLayout?.(parts, controls, h) ?? [
160
- ...[
161
- parts.direction,
162
- parts.source,
163
- parts.status
164
- ].filter((item) => item !== null),
165
- ...parts.findings.length ? [h.ul([h.AriaLabel("Mermaid fidelity findings")], parts.findings)] : [],
166
- ...[
167
- parts.consent,
168
- parts.reason,
169
- parts.download
170
- ].filter((item) => item !== null)
171
- ];
172
- return h.section([
173
- ...options.attributes ?? [],
174
- h.AriaLabel(options.label ?? "Native v3 Mermaid export review"),
175
- h.DataAttribute("zloz-mermaid-generation", String(controls.identity.generation)),
176
- h.Style({
177
- ...zlozThemeStyle(options.theme ?? {}),
178
- color: "var(--flow-node-color, inherit)"
179
- })
180
- ], content);
181
- }
182
- //#endregion
183
- //#region src/foldkit.ts
184
- function zlozReviewPacketConsent(h, context, onRequest, attributes = [], label = "Allow reported projection losses for this packet") {
185
- return h.input([
186
- ...attributes,
187
- h.Type("checkbox"),
188
- h.AriaLabel(label),
189
- h.Checked(context.consented),
190
- h.Disabled(context.reason !== null || !context.requiresConsent || context.key === null),
191
- ...context.reason ? [h.AriaDescription(context.reason)] : [],
192
- h.OnClick(onRequest({
193
- type: "ConsentChanged",
194
- key: context.key ?? "",
195
- accepted: !context.consented
196
- }))
197
- ]);
198
- }
199
- function zlozReviewPacketDownload(h, context, onRequest, attributes = [], children = ["Download review packet"], label = "Download review packet") {
200
- return h.button([
201
- ...attributes,
202
- h.Type("button"),
203
- h.AriaLabel(label),
204
- h.Disabled(context.downloadReason !== null || context.key === null),
205
- ...context.downloadReason ? [h.AriaDescription(context.downloadReason), h.Title(context.downloadReason)] : [],
206
- h.OnClick(onRequest({
207
- type: "DownloadClicked",
208
- key: context.key ?? ""
209
- }))
210
- ], children);
211
- }
212
- /** Nullable slots remove parts; undefined retains accessible native defaults. Custom diagnostics own list-item semantics. */
213
- function zlozReviewPacketControls(h, context, onRequest, options = {}) {
214
- const scope = options.renderScope?.(context, h), consent = options.renderConsent?.(context, h, onRequest), download = options.renderDownload?.(context, h, onRequest), reason = options.renderReason?.(context, h), status = options.renderStatus?.(context, h);
215
- const consentLabel = options.consentLabel ?? "Allow reported projection losses for this packet";
216
- const parts = {
217
- scope: scope === void 0 ? h.p([h.AriaLabel(options.scopeLabel ?? "Review packet scope")], [context.scopeText]) : scope,
218
- diagnostics: context.diagnostics.flatMap((item) => {
219
- const custom = options.renderDiagnostic?.(item, h);
220
- const result = custom === void 0 ? h.li([], [`${item.side} · ${item.severity}: ${item.subject ? `${item.subject}: ` : ""}${item.message}`]) : custom;
221
- return result === null ? [] : [result];
222
- }),
223
- consent: consent === void 0 ? context.requiresConsent ? h.label([], [zlozReviewPacketConsent(h, context, onRequest, [], consentLabel), consentLabel]) : null : consent,
224
- download: download === void 0 ? zlozReviewPacketDownload(h, context, onRequest, [], [options.downloadLabel ?? "Download review packet"], options.downloadLabel) : download,
225
- reason: reason === void 0 ? context.downloadReason === null ? null : h.p([h.AriaLabel(options.reasonLabel ?? "Review packet availability")], [context.downloadReason]) : reason,
226
- status: status === void 0 ? h.p([
227
- h.Role("status"),
228
- h.AriaLive("polite"),
229
- h.AriaLabel(options.statusLabel ?? "Review packet status")
230
- ], [context.reason ?? (context.requiresConsent ? options.showCounts === false ? "Mermaid projections have reported losses." : `${context.diagnostics.filter((item) => item.severity === "loss").length} reported projection losses.` : "No reported projection losses.")]) : status
231
- };
232
- const content = options.renderLayout?.(parts, context, h) ?? [
233
- ...[parts.scope, parts.status].filter((item) => item !== null),
234
- ...parts.diagnostics.length ? [h.ul([h.AriaLabel(options.diagnosticsLabel ?? "Review packet diagnostics")], parts.diagnostics)] : [],
235
- ...[
236
- parts.consent,
237
- parts.reason,
238
- parts.download
239
- ].filter((item) => item !== null)
240
- ];
241
- return h.section([...options.attributes ?? [], h.AriaLabel(options.label ?? "Review packet export")], content);
242
- }
243
- //#endregion
244
- export { zlozGroupMermaidConsentV3, zlozGroupMermaidDownloadV3, zlozGroupMermaidReviewV3, zlozReviewPacketConsent, zlozReviewPacketControls, zlozReviewPacketDownload, zlozReviewReader };
245
-
246
- //# sourceMappingURL=foldkit.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"foldkit.mjs","names":[],"sources":["../src/review-reader-view.ts","../src/group-review-v3-view.ts","../src/foldkit.ts"],"sourcesContent":["import type { Html, HtmlBuilder } from 'foldkit/html';\n\nimport type { ZlozReviewPacketDiagnostic } from './review-packet';\nimport {\n resolveReviewReader,\n type ZlozReviewReaderRequest,\n type ZlozReviewReaderState,\n type ZlozReviewReaderOptions,\n} from './review-reader';\ntype Attributes<M> = Parameters<HtmlBuilder<M>['div']>[0];\nexport type ZlozReviewReaderParts = Readonly<{\n open: Html | null;\n status: Html | null;\n summary: Html | null;\n selection: Html | null;\n findings: Html | null;\n cancel: Html | null;\n close: Html | null;\n}>;\nexport type ZlozReviewReaderViewOptions<M> = Readonly<{\n attributes?: Attributes<M>;\n idPrefix?: string;\n instructions?: boolean;\n showCounts?: boolean;\n renderFinding?: (\n finding: ZlozReviewPacketDiagnostic,\n h: HtmlBuilder<M>,\n ) => Html | null | undefined;\n renderSummary?: (state: ZlozReviewReaderState, h: HtmlBuilder<M>) => Html | null | undefined;\n renderLayout?: (parts: ZlozReviewReaderParts, h: HtmlBuilder<M>) => readonly Html[];\n}>;\n/** Native/composable read-only reader controls; file IO and canvas ownership stay with the host. */\nexport function zlozReviewReader<M>(\n h: HtmlBuilder<M>,\n state: ZlozReviewReaderState,\n onRequest: (request: ZlozReviewReaderRequest) => M,\n onFiles: (files: readonly File[]) => M,\n policy: ZlozReviewReaderOptions = {},\n options: ZlozReviewReaderViewOptions<M> = {},\n): Html {\n const context = resolveReviewReader(state, policy),\n id = options.idPrefix ?? 'zloz-review-reader';\n const open = h.label(\n [h.For(`${id}-file`)],\n [\n 'Open review packet',\n h.input([\n h.Id(`${id}-file`),\n h.Type('file'),\n h.Accept('.json,application/json'),\n h.Disabled(context.openReason !== null),\n h.OnFileChange(onFiles),\n ]),\n ],\n );\n const status = h.p(\n [h.Role('status'), h.AriaLive('polite')],\n [context.openReason ?? state.notice],\n );\n const cancel = state.pending\n ? h.button(\n [\n h.Type('button'),\n h.OnClick(\n onRequest({ scope: state.scope, type: 'ReadCancelled', run: state.pending.run }),\n ),\n ],\n ['Cancel packet read'],\n )\n : null;\n const review = state.review;\n const customSummary = options.renderSummary?.(state, h);\n const summary =\n customSummary === undefined\n ? review\n ? h.div(\n [],\n [\n h.strong([], [review.packet.model.name]),\n h.p([], ['Read-only packet · ', review.name]),\n h.p([], [`Audit: ${review.packet.comparison.status}`]),\n ...(options.showCounts === false\n ? []\n : [\n h.p(\n [h.DataAttribute('review-reader-counts', '')],\n [\n `${review.packet.comparison.summary.introduced} introduced · ${review.packet.comparison.summary.resolved} resolved · ${review.packet.comparison.summary.persisting} persisting`,\n ],\n ),\n ]),\n ],\n )\n : null\n : customSummary;\n const selection = review\n ? h.div(\n [h.Role('group'), h.AriaLabel('Packet snapshot')],\n [\n ...(['baseline', 'selected'] as const).map((side) =>\n h.button(\n [\n h.Type('button'),\n h.AriaPressed(String(review.side === side)),\n h.Disabled(context.sideReason !== null),\n h.OnClick(\n onRequest({\n scope: state.scope,\n type: 'SideSelected',\n reviewId: review.id,\n side,\n }),\n ),\n ],\n [\n side === 'baseline'\n ? `Baseline: ${review.packet.baseline.source.name}`\n : `Selected: ${review.packet.selected.source.kind === 'current' ? 'Current graph' : review.packet.selected.source.name}`,\n ],\n ),\n ),\n ...(context.sideReason ? [h.p([], [context.sideReason])] : []),\n ],\n )\n : null;\n const findings = review\n ? h.div(\n [h.AriaLabel('Packet findings')],\n [\n ...review.packet.comparison.introduced.map((f) =>\n h.p([], [`Introduced · ${f.edgeId}: ${f.message}`]),\n ),\n ...review.packet.comparison.resolved.map((f) =>\n h.p([], [`Resolved · ${f.edgeId}: ${f.message}`]),\n ),\n ...review.packet.comparison.persisting.map((f) =>\n h.p([], [`Persisting · ${f.after.edgeId}: ${f.after.message}`]),\n ),\n h.ul(\n [h.AriaLabel('Packet projection findings')],\n review.packet.diagnostics.flatMap((f) => {\n const custom = options.renderFinding?.(f, h);\n return custom === null\n ? []\n : [custom ?? h.li([], [`${f.side} · ${f.code}: ${f.message}`])];\n }),\n ),\n ],\n )\n : null;\n const close = review\n ? h.button(\n [\n h.Type('button'),\n h.OnClick(onRequest({ scope: state.scope, type: 'ReviewClosed', reviewId: review.id })),\n ],\n ['Close packet review'],\n )\n : null;\n const parts = { open, status, summary, selection, findings, cancel, close };\n return h.div(\n [h.DataAttribute('review-reader', ''), ...(options.attributes ?? [])],\n [\n ...(options.instructions === false\n ? []\n : [\n h.p(\n [],\n ['Open a portable packet for inspection. Reading never imports or edits your model.'],\n ),\n ]),\n ...(options.renderLayout?.(parts, h) ??\n [open, status, cancel, summary, selection, close, findings].flatMap((part) =>\n part === null ? [] : [part],\n )),\n ],\n );\n}\n","import {\n resolveZlozDiagnostics,\n zlozThemeStyle,\n type ZlozDiagnosticOptions,\n type ZlozTheme,\n} from '@opsydyn/foldkit-zloz/foldkit';\nimport type { Html, HtmlBuilder } from 'foldkit/html';\n\nimport type { MermaidDiagnostic } from './export-mermaid';\nimport type {\n ZlozGroupMermaidReviewControlsV3,\n ZlozGroupMermaidReviewRequestV3,\n} from './group-review-v3';\ntype OnRequest<M> = (request: ZlozGroupMermaidReviewRequestV3) => M;\nexport type ZlozGroupMermaidReviewPartsV3 = Readonly<{\n direction: Html | null;\n source: Html | null;\n findings: readonly Html[];\n consent: Html | null;\n download: Html | null;\n reason: Html | null;\n status: Html | null;\n}>;\nexport type ZlozGroupMermaidReviewViewOptionsV3<M> = ZlozDiagnosticOptions &\n Readonly<{\n id: string;\n label?: string;\n theme?: ZlozTheme;\n attributes?: Parameters<HtmlBuilder<M>['section']>[0];\n /** Undefined retains the default; null removes the part. The host owns explanations in replacements. */\n renderPart?: (\n part: Exclude<keyof ZlozGroupMermaidReviewPartsV3, 'findings'>,\n controls: ZlozGroupMermaidReviewControlsV3,\n h: HtmlBuilder<M>,\n onRequest: OnRequest<M>,\n ) => Html | null | undefined;\n renderFinding?: (finding: MermaidDiagnostic, h: HtmlBuilder<M>) => Html | null | undefined;\n renderLayout?: (\n parts: ZlozGroupMermaidReviewPartsV3,\n controls: ZlozGroupMermaidReviewControlsV3,\n h: HtmlBuilder<M>,\n ) => readonly Html[];\n }>;\nexport function zlozGroupMermaidConsentV3<M>(\n h: HtmlBuilder<M>,\n controls: ZlozGroupMermaidReviewControlsV3,\n onRequest: OnRequest<M>,\n attributes: Parameters<HtmlBuilder<M>['input']>[0] = [],\n): Html {\n return h.input([\n ...attributes,\n h.Type('checkbox'),\n h.AriaLabel('Accept the reported Mermaid losses'),\n h.Checked(controls.accepted),\n h.Disabled(controls.reason !== null || !controls.hasLosses || controls.busy),\n h.OnClick(\n onRequest({\n ...controls.identity,\n type: 'MermaidLossAcceptanceChanged',\n accepted: !controls.accepted,\n }),\n ),\n ]);\n}\nexport function zlozGroupMermaidDownloadV3<M>(\n h: HtmlBuilder<M>,\n controls: ZlozGroupMermaidReviewControlsV3,\n onRequest: OnRequest<M>,\n attributes: Parameters<HtmlBuilder<M>['button']>[0] = [],\n children: Parameters<HtmlBuilder<M>['button']>[1] = ['Download Mermaid bundle'],\n): Html {\n return h.button(\n [\n ...attributes,\n h.Type('button'),\n h.Disabled(controls.downloadReason !== null),\n h.Title(controls.downloadReason ?? 'Download the reviewed native bundle'),\n h.OnClick(onRequest({ ...controls.identity, type: 'MermaidDownloadRequested' })),\n ],\n children,\n );\n}\n/** Optional source review only. No Mermaid renderer, executable markup or DOM IO enters the product. */\nexport function zlozGroupMermaidReviewV3<M>(\n h: HtmlBuilder<M>,\n controls: ZlozGroupMermaidReviewControlsV3,\n onRequest: OnRequest<M>,\n options: ZlozGroupMermaidReviewViewOptionsV3<M>,\n): Html {\n const diagnostics = resolveZlozDiagnostics(options),\n choose = options.id + '-direction';\n const part = (\n name: Exclude<keyof ZlozGroupMermaidReviewPartsV3, 'findings'>,\n fallback: () => Html | null,\n ) => {\n const custom = options.renderPart?.(name, controls, h, onRequest);\n return custom === undefined ? fallback() : custom;\n };\n const parts: ZlozGroupMermaidReviewPartsV3 = {\n direction: part('direction', () =>\n h.div(\n [],\n [\n h.label([h.For(choose)], ['Mermaid direction']),\n h.select(\n [\n h.Id(choose),\n h.Value(controls.direction),\n h.OnChange((value) =>\n onRequest({\n ...controls.identity,\n type: 'MermaidDirectionChanged',\n direction:\n value === 'TB' ? 'TB' : value === 'RL' ? 'RL' : value === 'BT' ? 'BT' : 'LR',\n }),\n ),\n ],\n (['LR', 'RL', 'TB', 'BT'] as const).map((value) => h.option([h.Value(value)], [value])),\n ),\n ],\n ),\n ),\n source: part('source', () =>\n controls.result.status === 'converted'\n ? h.pre(\n [\n h.AriaLabel('Mermaid source preview'),\n h.Tabindex(0),\n h.Style({\n overflow: 'auto',\n 'max-height': '280px',\n 'font-size': '12px',\n padding: '12px',\n border: '1px solid var(--flow-node-border, #94a3b8)',\n 'border-radius': '6px',\n background: 'var(--flow-node-background, transparent)',\n }),\n ],\n [\n h.code(\n [h.Class('language-mermaid')],\n controls.result.value.source\n .split(/(\"[^\"]*\"|\\bflowchart\\b|\\bsubgraph\\b|\\bend\\b)/g)\n .map((token) =>\n token.startsWith('\"')\n ? h.span([h.Style({ color: 'var(--flow-input-port, #0f766e)' })], [token])\n : ['flowchart', 'subgraph', 'end'].includes(token)\n ? h.span(\n [\n h.Style({\n color: 'var(--flow-output-port, #2563eb)',\n 'font-weight': '600',\n }),\n ],\n [token],\n )\n : token,\n ),\n ),\n ],\n )\n : null,\n ),\n findings: controls.findings.flatMap((finding) => {\n const custom = options.renderFinding?.(finding, h),\n node =\n custom === undefined\n ? h.li(\n [h.DataAttribute('zloz-mermaid-finding', finding.code)],\n [\n `${finding.severity}: ${finding.subject ? finding.subject + ': ' : ''}${finding.message}`,\n ],\n )\n : custom;\n return node === null ? [] : [node];\n }),\n consent: part('consent', () =>\n controls.hasLosses\n ? h.label(\n [h.Style({ display: 'flex', 'align-items': 'center', gap: '8px' })],\n [\n zlozGroupMermaidConsentV3(h, controls, onRequest, [\n h.Style({ display: 'inline-block', width: 'auto', 'margin-right': '8px' }),\n ]),\n 'Accept the reported Mermaid losses',\n ],\n )\n : null,\n ),\n download: part('download', () => zlozGroupMermaidDownloadV3(h, controls, onRequest)),\n reason: part('reason', () =>\n controls.downloadReason\n ? h.p([h.AriaLabel('Mermaid export availability')], [controls.downloadReason])\n : null,\n ),\n status: part('status', () =>\n diagnostics.status\n ? h.p(\n [h.Role('status'), h.AriaLive('polite')],\n [\n controls.reason ??\n (controls.accepted\n ? 'Exact Mermaid output accepted.'\n : 'Review Mermaid source and fidelity findings.'),\n ],\n )\n : null,\n ),\n };\n const content = options.renderLayout?.(parts, controls, h) ?? [\n ...[parts.direction, parts.source, parts.status].filter((item): item is Html => item !== null),\n ...(parts.findings.length\n ? [h.ul([h.AriaLabel('Mermaid fidelity findings')], parts.findings)]\n : []),\n ...[parts.consent, parts.reason, parts.download].filter((item): item is Html => item !== null),\n ];\n return h.section(\n [\n ...(options.attributes ?? []),\n h.AriaLabel(options.label ?? 'Native v3 Mermaid export review'),\n h.DataAttribute('zloz-mermaid-generation', String(controls.identity.generation)),\n h.Style({ ...zlozThemeStyle(options.theme ?? {}), color: 'var(--flow-node-color, inherit)' }),\n ],\n content,\n );\n}\n","/** Optional, unstyled Foldkit composition; the root adapter remains headless. @module MermaidFoldkit */\nimport type { Html, HtmlBuilder } from 'foldkit/html';\n\nimport type { ZlozReviewPacketDiagnostic } from './review-packet';\nimport type {\n ZlozReviewPacketControlsContext,\n ZlozReviewPacketRequest,\n} from './review-packet-controls';\ntype Attributes<M> = Parameters<HtmlBuilder<M>['div']>[0];\ntype Children<M> = Parameters<HtmlBuilder<M>['div']>[1];\ntype OnRequest<M> = (request: ZlozReviewPacketRequest) => M;\nexport type ZlozReviewPacketParts = Readonly<{\n scope: Html | null;\n diagnostics: readonly Html[];\n consent: Html | null;\n download: Html | null;\n reason: Html | null;\n status: Html | null;\n}>;\nexport type ZlozReviewPacketViewOptions<M> = Readonly<{\n attributes?: Attributes<M>;\n label?: string;\n showCounts?: boolean;\n scopeLabel?: string;\n diagnosticsLabel?: string;\n consentLabel?: string;\n downloadLabel?: string;\n reasonLabel?: string;\n statusLabel?: string;\n renderScope?: (\n context: ZlozReviewPacketControlsContext,\n h: HtmlBuilder<M>,\n ) => Html | null | undefined;\n renderDiagnostic?: (\n item: ZlozReviewPacketDiagnostic,\n h: HtmlBuilder<M>,\n ) => Html | null | undefined;\n renderConsent?: (\n context: ZlozReviewPacketControlsContext,\n h: HtmlBuilder<M>,\n onRequest: OnRequest<M>,\n ) => Html | null | undefined;\n renderDownload?: (\n context: ZlozReviewPacketControlsContext,\n h: HtmlBuilder<M>,\n onRequest: OnRequest<M>,\n ) => Html | null | undefined;\n renderReason?: (\n context: ZlozReviewPacketControlsContext,\n h: HtmlBuilder<M>,\n ) => Html | null | undefined;\n renderStatus?: (\n context: ZlozReviewPacketControlsContext,\n h: HtmlBuilder<M>,\n ) => Html | null | undefined;\n renderLayout?: (\n parts: ZlozReviewPacketParts,\n context: ZlozReviewPacketControlsContext,\n h: HtmlBuilder<M>,\n ) => readonly Html[];\n}>;\nexport function zlozReviewPacketConsent<M>(\n h: HtmlBuilder<M>,\n context: ZlozReviewPacketControlsContext,\n onRequest: OnRequest<M>,\n attributes: Parameters<HtmlBuilder<M>['input']>[0] = [],\n label = 'Allow reported projection losses for this packet',\n): Html {\n return h.input([\n ...attributes,\n h.Type('checkbox'),\n h.AriaLabel(label),\n h.Checked(context.consented),\n h.Disabled(context.reason !== null || !context.requiresConsent || context.key === null),\n ...(context.reason ? [h.AriaDescription(context.reason)] : []),\n h.OnClick(\n onRequest({ type: 'ConsentChanged', key: context.key ?? '', accepted: !context.consented }),\n ),\n ]);\n}\nexport function zlozReviewPacketDownload<M>(\n h: HtmlBuilder<M>,\n context: ZlozReviewPacketControlsContext,\n onRequest: OnRequest<M>,\n attributes: Parameters<HtmlBuilder<M>['button']>[0] = [],\n children: Children<M> = ['Download review packet'],\n label = 'Download review packet',\n): Html {\n return h.button(\n [\n ...attributes,\n h.Type('button'),\n h.AriaLabel(label),\n h.Disabled(context.downloadReason !== null || context.key === null),\n ...(context.downloadReason\n ? [h.AriaDescription(context.downloadReason), h.Title(context.downloadReason)]\n : []),\n h.OnClick(onRequest({ type: 'DownloadClicked', key: context.key ?? '' })),\n ],\n children,\n );\n}\n/** Nullable slots remove parts; undefined retains accessible native defaults. Custom diagnostics own list-item semantics. */\nexport function zlozReviewPacketControls<M>(\n h: HtmlBuilder<M>,\n context: ZlozReviewPacketControlsContext,\n onRequest: OnRequest<M>,\n options: ZlozReviewPacketViewOptions<M> = {},\n): Html {\n const scope = options.renderScope?.(context, h),\n consent = options.renderConsent?.(context, h, onRequest),\n download = options.renderDownload?.(context, h, onRequest),\n reason = options.renderReason?.(context, h),\n status = options.renderStatus?.(context, h);\n const consentLabel = options.consentLabel ?? 'Allow reported projection losses for this packet';\n const parts: ZlozReviewPacketParts = {\n scope:\n scope === undefined\n ? h.p([h.AriaLabel(options.scopeLabel ?? 'Review packet scope')], [context.scopeText])\n : scope,\n diagnostics: context.diagnostics.flatMap((item) => {\n const custom = options.renderDiagnostic?.(item, h);\n const result =\n custom === undefined\n ? h.li(\n [],\n [\n `${item.side} · ${item.severity}: ${item.subject ? `${item.subject}: ` : ''}${item.message}`,\n ],\n )\n : custom;\n return result === null ? [] : [result];\n }),\n consent:\n consent === undefined\n ? context.requiresConsent\n ? h.label(\n [],\n [zlozReviewPacketConsent(h, context, onRequest, [], consentLabel), consentLabel],\n )\n : null\n : consent,\n download:\n download === undefined\n ? zlozReviewPacketDownload(\n h,\n context,\n onRequest,\n [],\n [options.downloadLabel ?? 'Download review packet'],\n options.downloadLabel,\n )\n : download,\n reason:\n reason === undefined\n ? context.downloadReason === null\n ? null\n : h.p(\n [h.AriaLabel(options.reasonLabel ?? 'Review packet availability')],\n [context.downloadReason],\n )\n : reason,\n status:\n status === undefined\n ? h.p(\n [\n h.Role('status'),\n h.AriaLive('polite'),\n h.AriaLabel(options.statusLabel ?? 'Review packet status'),\n ],\n [\n context.reason ??\n (context.requiresConsent\n ? options.showCounts === false\n ? 'Mermaid projections have reported losses.'\n : `${context.diagnostics.filter((item) => item.severity === 'loss').length} reported projection losses.`\n : 'No reported projection losses.'),\n ],\n )\n : status,\n };\n const content = options.renderLayout?.(parts, context, h) ?? [\n ...[parts.scope, parts.status].filter((item): item is Html => item !== null),\n ...(parts.diagnostics.length\n ? [\n h.ul(\n [h.AriaLabel(options.diagnosticsLabel ?? 'Review packet diagnostics')],\n parts.diagnostics,\n ),\n ]\n : []),\n ...[parts.consent, parts.reason, parts.download].filter((item): item is Html => item !== null),\n ];\n return h.section(\n [...(options.attributes ?? []), h.AriaLabel(options.label ?? 'Review packet export')],\n content,\n );\n}\n\nexport { zlozReviewReader } from './review-reader-view';\nexport type { ZlozReviewReaderParts, ZlozReviewReaderViewOptions } from './review-reader-view';\n\nexport {\n zlozGroupMermaidReviewV3,\n zlozGroupMermaidConsentV3,\n zlozGroupMermaidDownloadV3,\n} from './group-review-v3-view';\nexport type {\n ZlozGroupMermaidReviewViewOptionsV3,\n ZlozGroupMermaidReviewPartsV3,\n} from './group-review-v3-view';\n"],"mappings":";;;;AAgCA,SAAgB,iBACd,GACA,OACA,WACA,SACA,SAAkC,EAAE,EACpC,UAA0C,EAAE,EACtC;CACN,MAAM,UAAU,oBAAo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