@opsydyn/foldkit-zloz-mermaid 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +205 -4
- package/dist/foldkit.d.mts +63 -0
- package/dist/foldkit.mjs +135 -0
- package/dist/foldkit.mjs.map +1 -0
- package/dist/index.d.mts +2 -126
- package/dist/index.mjs +53 -315
- package/dist/index.mjs.map +1 -1
- package/dist/review-reader-CVhaZtUE.mjs +849 -0
- package/dist/review-reader-CVhaZtUE.mjs.map +1 -0
- package/dist/review-reader-D_31oCfi.d.mts +323 -0
- package/package.json +20 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- Add native v2 review packet creation, strict recomputing decoding and independent read-only side opening, with explicit reopening budgets and unchanged v1 readers.
|
|
6
|
+
|
|
7
|
+
- Add explicit v2 connection-document export with retained mode, ordered identity and source-only loss reporting; legacy graph export stays strict.
|
|
8
|
+
|
|
9
|
+
- Add a pure guarded review-packet reader and composable Foldkit opening/comparison controls.
|
|
10
|
+
|
|
11
|
+
- Add pure, content-bound review-packet export controls and optional composable Foldkit views.
|
|
12
|
+
|
|
13
|
+
## [0.5.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.4.0...foldkit-zloz-mermaid-v0.5.0) (2026-11-15)
|
|
14
|
+
|
|
15
|
+
### Miscellaneous Chores
|
|
16
|
+
|
|
17
|
+
- **foldkit-zloz-mermaid:** Synchronize foldkit-zloz versions
|
|
18
|
+
|
|
19
|
+
## [0.4.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.3.0...foldkit-zloz-mermaid-v0.4.0) (2026-11-15)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
- **zloz:** add portable authored edge waypoints ([e5218b8](https://github.com/opsydyn/fold-kit-experiments/commit/e5218b89a834066c40e10a7a2c72d466b3df5713))
|
|
24
|
+
- **zloz:** complete native v2 authoring and review ([3ad374f](https://github.com/opsydyn/fold-kit-experiments/commit/3ad374fbb40eea89c40d1793bf88ec3a2c945327))
|
|
25
|
+
- **zloz:** compose review packet export controls ([f23d27c](https://github.com/opsydyn/fold-kit-experiments/commit/f23d27c5abd831d21eb624d4b3930ad1a88c3c2f))
|
|
26
|
+
- **zloz:** define DDD relationship contracts ([45604f4](https://github.com/opsydyn/fold-kit-experiments/commit/45604f43796e3352d70a9d5cb82f896a1532434b))
|
|
27
|
+
- **zloz:** define EventStorming workshop semantics ([458ab16](https://github.com/opsydyn/fold-kit-experiments/commit/458ab1679cff22a7788eaaf61e711e2584133e3b))
|
|
28
|
+
- **zloz:** open portable packets in guarded read-only reviews ([ae1fcce](https://github.com/opsydyn/fold-kit-experiments/commit/ae1fcce175916f9b5eaa45ac6440fdcd2bd76a48))
|
|
29
|
+
- **zloz:** qualify v2 portable adapter boundaries ([e19efa7](https://github.com/opsydyn/fold-kit-experiments/commit/e19efa782bcd22424d62ea545fafa8770120a49c))
|
|
30
|
+
- **zloz:** strictly decode portable review packets ([58344d9](https://github.com/opsydyn/fold-kit-experiments/commit/58344d902e2825006cf5d306fa3daf80840b20de))
|
|
31
|
+
|
|
3
32
|
## [0.3.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.2.0...foldkit-zloz-mermaid-v0.3.0) (2026-11-10)
|
|
4
33
|
|
|
5
34
|
### Features
|
package/README.md
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# Foldkit Zloz Mermaid
|
|
2
2
|
|
|
3
3
|
Optional, pure Mermaid flowchart export. No Mermaid parser, renderer, browser,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
After publication:
|
|
4
|
+
Foldkit or Effect dependency is installed by the headless entry. Requires the
|
|
5
|
+
matching Zloz core peer. The published baseline is 0.3.0; the export controls below
|
|
6
|
+
are the next unreleased feature.
|
|
8
7
|
|
|
9
8
|
```sh
|
|
10
9
|
npm install @opsydyn/foldkit-zloz @opsydyn/foldkit-zloz-mermaid
|
|
@@ -147,3 +146,205 @@ The package additionally exports `ZlozReviewPacketOptions`,
|
|
|
147
146
|
Packet JSON round-trip tests reproduce its audit using only the chosen snapshots
|
|
148
147
|
and exported rules. The optional adapter still installs no Effect, Foldkit,
|
|
149
148
|
Mermaid parser, browser or layout engine. See [ADR 0035](../../docs/adr/0035-export-portable-review-packets.md).
|
|
149
|
+
|
|
150
|
+
## Strict review-packet reopening (unreleased)
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
import { parseReviewPacket } from '@opsydyn/foldkit-zloz-mermaid';
|
|
154
|
+
|
|
155
|
+
const result = parseReviewPacket(fileText);
|
|
156
|
+
if (result.status === 'parsed') {
|
|
157
|
+
// Owned, deeply frozen read-only data. No editor/model import is performed.
|
|
158
|
+
console.log(result.value.comparison.summary, result.value.diagnostics);
|
|
159
|
+
} else {
|
|
160
|
+
console.log(result.code, result.reason, result.path);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`ZlozReviewPacketParseResult` distinguishes `parsed` and `rejected`. Rejection codes
|
|
165
|
+
are `invalid-json`, `limit-exceeded`, `unsupported-format`, `unsupported-version`,
|
|
166
|
+
`invalid-packet` and `inconsistent-packet`; `path` is a JSON Pointer (empty for root).
|
|
167
|
+
Invalid configured limits throw the existing core configuration error.
|
|
168
|
+
|
|
169
|
+
The decoder accepts exact `foldkit-zloz-review` v1 packets in selected-snapshots
|
|
170
|
+
scope. It validates snapshots/identities and data-only conventions, then recomputes
|
|
171
|
+
all audits, deltas, diagnostics, Mermaid sources and identity/fidelity projections
|
|
172
|
+
through the existing creator. The full wire representation must agree, with object
|
|
173
|
+
key order ignored and array order retained. Unknown fields, duplicate JSON keys
|
|
174
|
+
(including escaped aliases), non-finite numbers, conflicting edition identities,
|
|
175
|
+
invalid rules, stale findings and forged projections reject. Returned data is the
|
|
176
|
+
recomputed packet, never trusted cached projections. Current, distinct-edition and
|
|
177
|
+
same-edition comparisons are supported. Builtin v1 conventions must match the
|
|
178
|
+
builtin catalogue; custom catalogues retain their explicit validated rule data.
|
|
179
|
+
|
|
180
|
+
Optional limits are `maxCharacters` (default 2,000,000 UTF-16 code units, cap
|
|
181
|
+
16,000,000), `maxDepth` (64, cap 128), and `maxValues` (100,000, cap 1,000,000).
|
|
182
|
+
All must be positive safe integers. Nesting/duplicate keys are scanned before
|
|
183
|
+
JSON.parse; value traversal and freezing avoid spread-based argument limits.
|
|
184
|
+
These are input-shape budgets, not a wall-clock or peak-memory guarantee. Hosts
|
|
185
|
+
own file-byte limits, decoding and worker isolation when needed.
|
|
186
|
+
|
|
187
|
+
Reopening validates **self-consistency, not authenticity**. A coherently rewritten
|
|
188
|
+
packet can still be valid. Parsing does not execute Mermaid or confer model import,
|
|
189
|
+
editing, graph mutation or trust in an author's identity. The decoder performs
|
|
190
|
+
no IO; the reader below and Effect CLI compose it at their host boundaries. See
|
|
191
|
+
[ADR 0057](../../docs/adr/0057-decode-portable-review-packets-strictly.md) and
|
|
192
|
+
[decoder qualification](evidence/review-packet-parse.md). PNG and Alchemy remain deferred.
|
|
193
|
+
|
|
194
|
+
## Composable review-packet controls (unreleased)
|
|
195
|
+
|
|
196
|
+
The root entry exports `resolveReviewPacketControls` and
|
|
197
|
+
`resolveReviewPacketRequest`. The optional `/foldkit` entry exports
|
|
198
|
+
`zlozReviewPacketControls`, `zlozReviewPacketConsent`, `zlozReviewPacketDownload`
|
|
199
|
+
and their view/parts types. Install matching `foldkit` to use the native controls;
|
|
200
|
+
it remains an optional peer and is not installed for headless consumers.
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
import {
|
|
204
|
+
resolveReviewPacketControls,
|
|
205
|
+
resolveReviewPacketRequest,
|
|
206
|
+
} from '@opsydyn/foldkit-zloz-mermaid';
|
|
207
|
+
import { zlozReviewPacketControls } from '@opsydyn/foldkit-zloz-mermaid/foldkit';
|
|
208
|
+
|
|
209
|
+
const selection = { baselineId: 'before', selectedId: null }; // null = current
|
|
210
|
+
const state = { consentKey: null }; // host-owned, ephemeral Foldkit model state
|
|
211
|
+
const context = resolveReviewPacketControls(document, selection, state, {
|
|
212
|
+
blockedReason: null, // supply live host protection; direction and data-only rules are optional
|
|
213
|
+
});
|
|
214
|
+
const controls = zlozReviewPacketControls(
|
|
215
|
+
h,
|
|
216
|
+
context,
|
|
217
|
+
(request) => Message.ObservedReviewPacketInput({ request }),
|
|
218
|
+
{
|
|
219
|
+
showCounts: !minimalMode && diagnosticsEnabled,
|
|
220
|
+
renderStatus: () => (minimalMode || !diagnosticsEnabled ? null : undefined),
|
|
221
|
+
},
|
|
222
|
+
);
|
|
223
|
+
// In update: rebuild with the current document, selection, state and options.
|
|
224
|
+
const decision = resolveReviewPacketRequest(document, selection, state, request);
|
|
225
|
+
// ready: retain decision.state; blocked: show decision.reason;
|
|
226
|
+
// download: pass decision.packet to a host Command, never perform I/O in update.
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Preview materializes report-mode projections in memory. Scope text discloses that
|
|
230
|
+
both full authored snapshots and cameras travel; only Mermaid omissions need
|
|
231
|
+
loss consent. Projection errors always block download. Consent and requests use
|
|
232
|
+
an opaque, exact-content key; a fresh resolution catches changes to chosen sources,
|
|
233
|
+
model identity/name, graph/camera, conventions and projection direction. The key
|
|
234
|
+
contains packet data: keep it ephemeral, do not log it, put it in DOM attributes or
|
|
235
|
+
use it as an authentication credential. Hosts also check session identity/epoch
|
|
236
|
+
and current protection before acting; they own storage/download and any playback
|
|
237
|
+
pause. Unrelated history changes do not alter a selected-snapshot packet.
|
|
238
|
+
|
|
239
|
+
Every part has a nullable/custom renderer, with independent attributes, labels,
|
|
240
|
+
layout and count visibility. Custom diagnostics own list-item semantics. Native
|
|
241
|
+
checkbox/button helpers retain disabled state and accessible protection reasons.
|
|
242
|
+
Hiding a part never bypasses the pure request resolver. Counts can disappear in
|
|
243
|
+
minimal mode while functional scope, losses and reasons remain available. No
|
|
244
|
+
packet import, graph mutation or new Undo entry is implied. Exact serialization
|
|
245
|
+
costs packet-sized memory and projection work while previewing; no performance
|
|
246
|
+
claim is made. See [ADR 0037](../../docs/adr/0037-compose-review-packet-export-controls.md).
|
|
247
|
+
|
|
248
|
+
## Read-only packet reader (unreleased)
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
import {
|
|
252
|
+
createReviewReader,
|
|
253
|
+
resolveReviewReader,
|
|
254
|
+
updateReviewReader,
|
|
255
|
+
} from '@opsydyn/foldkit-zloz-mermaid';
|
|
256
|
+
|
|
257
|
+
let reader = createReviewReader('model-id/incarnation-1');
|
|
258
|
+
const started = updateReviewReader(reader, {
|
|
259
|
+
scope: reader.scope,
|
|
260
|
+
type: 'ReadRequested',
|
|
261
|
+
file: { name: file.name, byteLength: file.size },
|
|
262
|
+
});
|
|
263
|
+
reader = started.state;
|
|
264
|
+
const readDescriptor = started.read;
|
|
265
|
+
// Continue only when readDescriptor exists.
|
|
266
|
+
// A host Command reads the File within maxBytes,
|
|
267
|
+
// checking actual bytes and decoding fatal UTF-8. Return its correlated fact:
|
|
268
|
+
if (readDescriptor) {
|
|
269
|
+
reader = updateReviewReader(reader, {
|
|
270
|
+
scope: readDescriptor.scope,
|
|
271
|
+
type: 'ReadSucceeded',
|
|
272
|
+
run: readDescriptor.run,
|
|
273
|
+
text: fileText,
|
|
274
|
+
}).state;
|
|
275
|
+
}
|
|
276
|
+
const snapshot = resolveReviewReader(reader).snapshot;
|
|
277
|
+
// Render snapshot in a detached read-only editor. Do not replace the working model.
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
`updateReviewReader` returns `{ state, read }`. Its requests include correlated
|
|
281
|
+
read success/failure/cancel, `SideSelected` and `ReviewClosed`. `blockedReason` and
|
|
282
|
+
`selectionReason` are live policies; opening is checked again at completion.
|
|
283
|
+
`reviewReaderForScope` resets the reader when the host model incarnation changes.
|
|
284
|
+
Use unique scopes: stale callbacks must never collide with a new model session.
|
|
285
|
+
Default `maxBytes` is 1 MiB (configurable integer 1–16,000,000); the host must enforce
|
|
286
|
+
actual bytes before and after IO. `parseOptions` independently bounds decoding.
|
|
287
|
+
No file IO occurs in the package. Cancellation prevents publication; it need not
|
|
288
|
+
abort underlying IO. Invalid/stale/protected/cancelled reads preserve the last
|
|
289
|
+
good review and chosen side. Closing invalidates pending reads.
|
|
290
|
+
|
|
291
|
+
The optional `@opsydyn/foldkit-zloz-mermaid/foldkit` export `zlozReviewReader`
|
|
292
|
+
accepts the HtmlBuilder, state, request callback, file callback, live policy and
|
|
293
|
+
view options. It renders native opening/cancel/close and baseline/selected controls,
|
|
294
|
+
audit findings and projection losses. `renderSummary`, `renderFinding` and
|
|
295
|
+
`renderLayout` compose custom presentations; undefined falls back, null omits.
|
|
296
|
+
`showCounts: false` and `instructions: false` provide a clean UI while findings
|
|
297
|
+
and actions remain available. Hosts own detached canvas rendering and interaction
|
|
298
|
+
protection. Reading grants no editing/import permission, authenticity guarantee or
|
|
299
|
+
new loss consent. See [ADR 0059](../../docs/adr/0059-open-review-packets-with-detached-reader-controls.md)
|
|
300
|
+
and [local qualification](../../apps/zloz-demo/evidence/review-reader.md).
|
|
301
|
+
|
|
302
|
+
## Explicit v2 connection documents
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
import { exportConnectionMermaid } from '@opsydyn/foldkit-zloz-mermaid';
|
|
306
|
+
const result = exportConnectionMermaid(documentV2, { lossPolicy: 'report' });
|
|
307
|
+
// Converted bundles use foldkit-zloz-mermaid/v2 and retain connectionMode.
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
This entry validates the complete v2 connection document and preserves ordered
|
|
311
|
+
source/target identity even for input-to-input or output-to-output links. Mermaid
|
|
312
|
+
source cannot express loose future-connection rules or the camera; those losses
|
|
313
|
+
reject by default. `report` accepts projection omissions, never invalid graphs.
|
|
314
|
+
Keep canonical JSON as authority. No general import or model reconstruction is
|
|
315
|
+
promised. The existing `exportMermaid(graph)` remains strict and its protocol and
|
|
316
|
+
output are unchanged. V1 review packets/readers remain v1; they do not accept v2
|
|
317
|
+
bundles or silently remove checkpoint modes.
|
|
318
|
+
|
|
319
|
+
## Native v2 review packets
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
const result = createReviewPacketV2(
|
|
323
|
+
modelV2,
|
|
324
|
+
{ baselineId: 'baseline' },
|
|
325
|
+
{
|
|
326
|
+
lossPolicy: 'report',
|
|
327
|
+
},
|
|
328
|
+
);
|
|
329
|
+
if (result.status === 'created') {
|
|
330
|
+
const text = JSON.stringify(result.value);
|
|
331
|
+
const opened = openReviewPacketV2(text, 'selected', workingEditor);
|
|
332
|
+
// opened.review.editor is independent and read-only when status is 'opened'.
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Version-2 packets retain baseline/selected connection documents, modes, data-only
|
|
337
|
+
conventions, mode-aware audit comparisons and v2 Mermaid projections. The scope is
|
|
338
|
+
selected snapshots, not a whole-model/ancestry archive. Role interpretation stays
|
|
339
|
+
`zloz-event-storming/v1` because domain rules are independent from port kinds.
|
|
340
|
+
|
|
341
|
+
`parseReviewPacketV2` shares strict bounded scanning and deterministic recomputation
|
|
342
|
+
with the v1 decoder. Conflicting side identities, duplicate fields, altered modes,
|
|
343
|
+
forged projections/audits or unknown fields reject. V1 readers stay fixed at v1.
|
|
344
|
+
Creation checks default reopening budgets (2,000,000 characters, depth 64, 100,000
|
|
345
|
+
JSON values) and reports `packet-limit` before claiming portable success.
|
|
346
|
+
|
|
347
|
+
`openReviewPacketV2` revalidates text before initializing either side in its saved
|
|
348
|
+
mode with zero Undo, leaving the working editor/history untouched. Packets and
|
|
349
|
+
recorded findings never authorize editing, import or Apply. Native workbench file
|
|
350
|
+
controls remain a separate adoption slice.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { D as ZlozReviewPacketDiagnostic, S as ZlozReviewPacketRequest, i as ZlozReviewReaderState, n as ZlozReviewReaderRequest, t as ZlozReviewReaderOptions, v as ZlozReviewPacketControlsContext } from "./review-reader-D_31oCfi.mjs";
|
|
2
|
+
import { Html, HtmlBuilder } from "foldkit/html";
|
|
3
|
+
|
|
4
|
+
//#region src/review-reader-view.d.ts
|
|
5
|
+
type Attributes$1<M> = Parameters<HtmlBuilder<M>['div']>[0];
|
|
6
|
+
type ZlozReviewReaderParts = Readonly<{
|
|
7
|
+
open: Html | null;
|
|
8
|
+
status: Html | null;
|
|
9
|
+
summary: Html | null;
|
|
10
|
+
selection: Html | null;
|
|
11
|
+
findings: Html | null;
|
|
12
|
+
cancel: Html | null;
|
|
13
|
+
close: Html | null;
|
|
14
|
+
}>;
|
|
15
|
+
type ZlozReviewReaderViewOptions<M> = Readonly<{
|
|
16
|
+
attributes?: Attributes$1<M>;
|
|
17
|
+
idPrefix?: string;
|
|
18
|
+
instructions?: boolean;
|
|
19
|
+
showCounts?: boolean;
|
|
20
|
+
renderFinding?: (finding: ZlozReviewPacketDiagnostic, h: HtmlBuilder<M>) => Html | null | undefined;
|
|
21
|
+
renderSummary?: (state: ZlozReviewReaderState, h: HtmlBuilder<M>) => Html | null | undefined;
|
|
22
|
+
renderLayout?: (parts: ZlozReviewReaderParts, h: HtmlBuilder<M>) => readonly Html[];
|
|
23
|
+
}>;
|
|
24
|
+
/** Native/composable read-only reader controls; file IO and canvas ownership stay with the host. */
|
|
25
|
+
declare function zlozReviewReader<M>(h: HtmlBuilder<M>, state: ZlozReviewReaderState, onRequest: (request: ZlozReviewReaderRequest) => M, onFiles: (files: readonly File[]) => M, policy?: ZlozReviewReaderOptions, options?: ZlozReviewReaderViewOptions<M>): Html;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/foldkit.d.ts
|
|
28
|
+
type Attributes<M> = Parameters<HtmlBuilder<M>['div']>[0];
|
|
29
|
+
type Children<M> = Parameters<HtmlBuilder<M>['div']>[1];
|
|
30
|
+
type OnRequest<M> = (request: ZlozReviewPacketRequest) => M;
|
|
31
|
+
type ZlozReviewPacketParts = Readonly<{
|
|
32
|
+
scope: Html | null;
|
|
33
|
+
diagnostics: readonly Html[];
|
|
34
|
+
consent: Html | null;
|
|
35
|
+
download: Html | null;
|
|
36
|
+
reason: Html | null;
|
|
37
|
+
status: Html | null;
|
|
38
|
+
}>;
|
|
39
|
+
type ZlozReviewPacketViewOptions<M> = Readonly<{
|
|
40
|
+
attributes?: Attributes<M>;
|
|
41
|
+
label?: string;
|
|
42
|
+
showCounts?: boolean;
|
|
43
|
+
scopeLabel?: string;
|
|
44
|
+
diagnosticsLabel?: string;
|
|
45
|
+
consentLabel?: string;
|
|
46
|
+
downloadLabel?: string;
|
|
47
|
+
reasonLabel?: string;
|
|
48
|
+
statusLabel?: string;
|
|
49
|
+
renderScope?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => Html | null | undefined;
|
|
50
|
+
renderDiagnostic?: (item: ZlozReviewPacketDiagnostic, h: HtmlBuilder<M>) => Html | null | undefined;
|
|
51
|
+
renderConsent?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>, onRequest: OnRequest<M>) => Html | null | undefined;
|
|
52
|
+
renderDownload?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>, onRequest: OnRequest<M>) => Html | null | undefined;
|
|
53
|
+
renderReason?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => Html | null | undefined;
|
|
54
|
+
renderStatus?: (context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => Html | null | undefined;
|
|
55
|
+
renderLayout?: (parts: ZlozReviewPacketParts, context: ZlozReviewPacketControlsContext, h: HtmlBuilder<M>) => readonly Html[];
|
|
56
|
+
}>;
|
|
57
|
+
declare function zlozReviewPacketConsent<M>(h: HtmlBuilder<M>, context: ZlozReviewPacketControlsContext, onRequest: OnRequest<M>, attributes?: Parameters<HtmlBuilder<M>['input']>[0], label?: string): Html;
|
|
58
|
+
declare function zlozReviewPacketDownload<M>(h: HtmlBuilder<M>, context: ZlozReviewPacketControlsContext, onRequest: OnRequest<M>, attributes?: Parameters<HtmlBuilder<M>['button']>[0], children?: Children<M>, label?: string): Html;
|
|
59
|
+
/** Nullable slots remove parts; undefined retains accessible native defaults. Custom diagnostics own list-item semantics. */
|
|
60
|
+
declare function zlozReviewPacketControls<M>(h: HtmlBuilder<M>, context: ZlozReviewPacketControlsContext, onRequest: OnRequest<M>, options?: ZlozReviewPacketViewOptions<M>): Html;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { ZlozReviewPacketParts, ZlozReviewPacketViewOptions, type ZlozReviewReaderParts, type ZlozReviewReaderViewOptions, zlozReviewPacketConsent, zlozReviewPacketControls, zlozReviewPacketDownload, zlozReviewReader };
|
|
63
|
+
//# sourceMappingURL=foldkit.d.mts.map
|
package/dist/foldkit.mjs
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { n as resolveReviewReader } from "./review-reader-CVhaZtUE.mjs";
|
|
2
|
+
//#region src/review-reader-view.ts
|
|
3
|
+
/** Native/composable read-only reader controls; file IO and canvas ownership stay with the host. */
|
|
4
|
+
function zlozReviewReader(h, state, onRequest, onFiles, policy = {}, options = {}) {
|
|
5
|
+
const context = resolveReviewReader(state, policy), id = options.idPrefix ?? "zloz-review-reader";
|
|
6
|
+
const open = h.label([h.For(`${id}-file`)], ["Open review packet", h.input([
|
|
7
|
+
h.Id(`${id}-file`),
|
|
8
|
+
h.Type("file"),
|
|
9
|
+
h.Accept(".json,application/json"),
|
|
10
|
+
h.Disabled(context.openReason !== null),
|
|
11
|
+
h.OnFileChange(onFiles)
|
|
12
|
+
])]);
|
|
13
|
+
const status = h.p([h.Role("status"), h.AriaLive("polite")], [context.openReason ?? state.notice]);
|
|
14
|
+
const cancel = state.pending ? h.button([h.Type("button"), h.OnClick(onRequest({
|
|
15
|
+
scope: state.scope,
|
|
16
|
+
type: "ReadCancelled",
|
|
17
|
+
run: state.pending.run
|
|
18
|
+
}))], ["Cancel packet read"]) : null;
|
|
19
|
+
const review = state.review;
|
|
20
|
+
const customSummary = options.renderSummary?.(state, h);
|
|
21
|
+
const summary = customSummary === void 0 ? review ? h.div([], [
|
|
22
|
+
h.strong([], [review.packet.model.name]),
|
|
23
|
+
h.p([], ["Read-only packet · ", review.name]),
|
|
24
|
+
h.p([], [`Audit: ${review.packet.comparison.status}`]),
|
|
25
|
+
...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`])]
|
|
26
|
+
]) : null : customSummary;
|
|
27
|
+
const selection = review ? h.div([h.Role("group"), h.AriaLabel("Packet snapshot")], [...["baseline", "selected"].map((side) => h.button([
|
|
28
|
+
h.Type("button"),
|
|
29
|
+
h.AriaPressed(String(review.side === side)),
|
|
30
|
+
h.Disabled(context.sideReason !== null),
|
|
31
|
+
h.OnClick(onRequest({
|
|
32
|
+
scope: state.scope,
|
|
33
|
+
type: "SideSelected",
|
|
34
|
+
reviewId: review.id,
|
|
35
|
+
side
|
|
36
|
+
}))
|
|
37
|
+
], [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;
|
|
38
|
+
const findings = review ? h.div([h.AriaLabel("Packet findings")], [
|
|
39
|
+
...review.packet.comparison.introduced.map((f) => h.p([], [`Introduced · ${f.edgeId}: ${f.message}`])),
|
|
40
|
+
...review.packet.comparison.resolved.map((f) => h.p([], [`Resolved · ${f.edgeId}: ${f.message}`])),
|
|
41
|
+
...review.packet.comparison.persisting.map((f) => h.p([], [`Persisting · ${f.after.edgeId}: ${f.after.message}`])),
|
|
42
|
+
h.ul([h.AriaLabel("Packet projection findings")], review.packet.diagnostics.flatMap((f) => {
|
|
43
|
+
const custom = options.renderFinding?.(f, h);
|
|
44
|
+
return custom === null ? [] : [custom ?? h.li([], [`${f.side} · ${f.code}: ${f.message}`])];
|
|
45
|
+
}))
|
|
46
|
+
]) : null;
|
|
47
|
+
const close = review ? h.button([h.Type("button"), h.OnClick(onRequest({
|
|
48
|
+
scope: state.scope,
|
|
49
|
+
type: "ReviewClosed",
|
|
50
|
+
reviewId: review.id
|
|
51
|
+
}))], ["Close packet review"]) : null;
|
|
52
|
+
const parts = {
|
|
53
|
+
open,
|
|
54
|
+
status,
|
|
55
|
+
summary,
|
|
56
|
+
selection,
|
|
57
|
+
findings,
|
|
58
|
+
cancel,
|
|
59
|
+
close
|
|
60
|
+
};
|
|
61
|
+
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) ?? [
|
|
62
|
+
open,
|
|
63
|
+
status,
|
|
64
|
+
cancel,
|
|
65
|
+
summary,
|
|
66
|
+
selection,
|
|
67
|
+
close,
|
|
68
|
+
findings
|
|
69
|
+
].flatMap((part) => part === null ? [] : [part])]);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/foldkit.ts
|
|
73
|
+
function zlozReviewPacketConsent(h, context, onRequest, attributes = [], label = "Allow reported projection losses for this packet") {
|
|
74
|
+
return h.input([
|
|
75
|
+
...attributes,
|
|
76
|
+
h.Type("checkbox"),
|
|
77
|
+
h.AriaLabel(label),
|
|
78
|
+
h.Checked(context.consented),
|
|
79
|
+
h.Disabled(context.reason !== null || !context.requiresConsent || context.key === null),
|
|
80
|
+
...context.reason ? [h.AriaDescription(context.reason)] : [],
|
|
81
|
+
h.OnClick(onRequest({
|
|
82
|
+
type: "ConsentChanged",
|
|
83
|
+
key: context.key ?? "",
|
|
84
|
+
accepted: !context.consented
|
|
85
|
+
}))
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
function zlozReviewPacketDownload(h, context, onRequest, attributes = [], children = ["Download review packet"], label = "Download review packet") {
|
|
89
|
+
return h.button([
|
|
90
|
+
...attributes,
|
|
91
|
+
h.Type("button"),
|
|
92
|
+
h.AriaLabel(label),
|
|
93
|
+
h.Disabled(context.downloadReason !== null || context.key === null),
|
|
94
|
+
...context.downloadReason ? [h.AriaDescription(context.downloadReason), h.Title(context.downloadReason)] : [],
|
|
95
|
+
h.OnClick(onRequest({
|
|
96
|
+
type: "DownloadClicked",
|
|
97
|
+
key: context.key ?? ""
|
|
98
|
+
}))
|
|
99
|
+
], children);
|
|
100
|
+
}
|
|
101
|
+
/** Nullable slots remove parts; undefined retains accessible native defaults. Custom diagnostics own list-item semantics. */
|
|
102
|
+
function zlozReviewPacketControls(h, context, onRequest, options = {}) {
|
|
103
|
+
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);
|
|
104
|
+
const consentLabel = options.consentLabel ?? "Allow reported projection losses for this packet";
|
|
105
|
+
const parts = {
|
|
106
|
+
scope: scope === void 0 ? h.p([h.AriaLabel(options.scopeLabel ?? "Review packet scope")], [context.scopeText]) : scope,
|
|
107
|
+
diagnostics: context.diagnostics.flatMap((item) => {
|
|
108
|
+
const custom = options.renderDiagnostic?.(item, h);
|
|
109
|
+
const result = custom === void 0 ? h.li([], [`${item.side} · ${item.severity}: ${item.subject ? `${item.subject}: ` : ""}${item.message}`]) : custom;
|
|
110
|
+
return result === null ? [] : [result];
|
|
111
|
+
}),
|
|
112
|
+
consent: consent === void 0 ? context.requiresConsent ? h.label([], [zlozReviewPacketConsent(h, context, onRequest, [], consentLabel), consentLabel]) : null : consent,
|
|
113
|
+
download: download === void 0 ? zlozReviewPacketDownload(h, context, onRequest, [], [options.downloadLabel ?? "Download review packet"], options.downloadLabel) : download,
|
|
114
|
+
reason: reason === void 0 ? context.downloadReason === null ? null : h.p([h.AriaLabel(options.reasonLabel ?? "Review packet availability")], [context.downloadReason]) : reason,
|
|
115
|
+
status: status === void 0 ? h.p([
|
|
116
|
+
h.Role("status"),
|
|
117
|
+
h.AriaLive("polite"),
|
|
118
|
+
h.AriaLabel(options.statusLabel ?? "Review packet status")
|
|
119
|
+
], [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
|
|
120
|
+
};
|
|
121
|
+
const content = options.renderLayout?.(parts, context, h) ?? [
|
|
122
|
+
...[parts.scope, parts.status].filter((item) => item !== null),
|
|
123
|
+
...parts.diagnostics.length ? [h.ul([h.AriaLabel(options.diagnosticsLabel ?? "Review packet diagnostics")], parts.diagnostics)] : [],
|
|
124
|
+
...[
|
|
125
|
+
parts.consent,
|
|
126
|
+
parts.reason,
|
|
127
|
+
parts.download
|
|
128
|
+
].filter((item) => item !== null)
|
|
129
|
+
];
|
|
130
|
+
return h.section([...options.attributes ?? [], h.AriaLabel(options.label ?? "Review packet export")], content);
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { zlozReviewPacketConsent, zlozReviewPacketControls, zlozReviewPacketDownload, zlozReviewReader };
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=foldkit.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foldkit.mjs","names":[],"sources":["../src/review-reader-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","/** 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"],"mappings":";;;AAgCA,SAAgB,iBACd,GACA,OACA,WACA,SACA,SAAkC,EAAE,EACpC,UAA0C,EAAE,EACtC;CACN,MAAM,UAAU,oBAAoB,OAAO,OAAO,EAChD,KAAK,QAAQ,YAAY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S,WAAW,EAAE,EAAE,aAAa,EAAE,aAAa,CACjF,GACD,OACF;EACN,UACE,aAAa,KAAA,IACT,yBACE,GACA,SACA,WACA,EAAE,EACF,CAAC,QAAQ,iBAAiB,yBAAyB,EACnD,QAAQ,cACT,GACD;EACN,QACE,WAAW,KAAA,IACP,QAAQ,mBAAmB,OACzB,OACA,EAAE,EACA,CAAC,EAAE,UAAU,QAAQ,eAAe,6BAA6B,CAAC,EAClE,CAAC,QAAQ,eAAe,CACzB,GACH;EACN,QACE,WAAW,KAAA,IACP,EAAE,EACA;GACE,EAAE,KAAK,SAAS;GAChB,EAAE,SAAS,SAAS;GACpB,EAAE,UAAU,QAAQ,eAAe,uBAAuB;GAC3D,EACD,CACE,QAAQ,WACL,QAAQ,kBACL,QAAQ,eAAe,QACrB,8CACA,GAAG,QAAQ,YAAY,QAAQ,SAAS,KAAK,aAAa,OAAO,CAAC,OAAO,gCAC3E,kCACP,CACF,GACD;EACP;CACD,MAAM,UAAU,QAAQ,eAAe,OAAO,SAAS,EAAE,IAAI;EAC3D,GAAG,CAAC,MAAM,OAAO,MAAM,OAAO,CAAC,QAAQ,SAAuB,SAAS,KAAK;EAC5E,GAAI,MAAM,YAAY,SAClB,CACE,EAAE,GACA,CAAC,EAAE,UAAU,QAAQ,oBAAoB,4BAA4B,CAAC,EACtE,MAAM,YACP,CACF,GACD,EAAE;EACN,GAAG;GAAC,MAAM;GAAS,MAAM;GAAQ,MAAM;GAAS,CAAC,QAAQ,SAAuB,SAAS,KAAK;EAC/F;AACD,QAAO,EAAE,QACP,CAAC,GAAI,QAAQ,cAAc,EAAE,EAAG,EAAE,UAAU,QAAQ,SAAS,uBAAuB,CAAC,EACrF,QACD"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,126 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/export-mermaid.d.ts
|
|
4
|
-
declare const mermaidProtocol = "foldkit-flow-mermaid/v1";
|
|
5
|
-
/** Maximum generated source size, in UTF-16 code units. */
|
|
6
|
-
declare const mermaidSourceLimit = 32768;
|
|
7
|
-
type MermaidDirection = 'LR' | 'RL' | 'TB' | 'BT';
|
|
8
|
-
type MermaidLossPolicy = 'reject' | 'report';
|
|
9
|
-
type MermaidDiagnosticCode = 'invalid-graph' | 'invalid-options' | 'unsupported-subgraph' | 'group-presentation-omitted' | 'unsupported-label-encoding' | 'source-limit' | 'node-fields-omitted' | 'edge-fields-omitted' | 'port-details-omitted' | 'layout-omitted' | 'identity-map-required';
|
|
10
|
-
type MermaidDiagnostic = Readonly<{
|
|
11
|
-
code: MermaidDiagnosticCode;
|
|
12
|
-
severity: 'loss' | 'error';
|
|
13
|
-
dimension: 'syntax' | 'semantics' | 'identity' | 'layout';
|
|
14
|
-
message: string;
|
|
15
|
-
subject: string | null;
|
|
16
|
-
}>;
|
|
17
|
-
type MermaidIdentity = Readonly<{
|
|
18
|
-
version: 1;
|
|
19
|
-
nodes: readonly Readonly<{
|
|
20
|
-
mermaidId: string;
|
|
21
|
-
flowId: string; /** Present for group entries; flat v1 entries are unchanged. */
|
|
22
|
-
kind?: 'group'; /** Original Zloz parent group ID, never a Mermaid alias. */
|
|
23
|
-
parentId?: string;
|
|
24
|
-
ports: readonly Readonly<{
|
|
25
|
-
id: string;
|
|
26
|
-
kind: 'input' | 'output';
|
|
27
|
-
}>[];
|
|
28
|
-
}>[];
|
|
29
|
-
edges: readonly Readonly<{
|
|
30
|
-
mermaidId: string;
|
|
31
|
-
flowId: string;
|
|
32
|
-
sourceNode: string;
|
|
33
|
-
sourcePort: string;
|
|
34
|
-
targetNode: string;
|
|
35
|
-
targetPort: string;
|
|
36
|
-
}>[];
|
|
37
|
-
}>;
|
|
38
|
-
/** A projection, not a substitute for canonical Zloz JSON. No full graph is hidden in identity. */
|
|
39
|
-
type MermaidBundle = Readonly<{
|
|
40
|
-
protocol: typeof mermaidProtocol;
|
|
41
|
-
source: string;
|
|
42
|
-
direction: MermaidDirection;
|
|
43
|
-
identity: MermaidIdentity;
|
|
44
|
-
diagnostics: readonly MermaidDiagnostic[];
|
|
45
|
-
}>;
|
|
46
|
-
type MermaidExportOptions = Readonly<{
|
|
47
|
-
direction?: MermaidDirection;
|
|
48
|
-
lossPolicy?: MermaidLossPolicy;
|
|
49
|
-
}>;
|
|
50
|
-
type MermaidExportResult = Readonly<{
|
|
51
|
-
protocol: typeof mermaidProtocol;
|
|
52
|
-
status: 'converted';
|
|
53
|
-
value: MermaidBundle;
|
|
54
|
-
diagnostics: readonly MermaidDiagnostic[];
|
|
55
|
-
}> | Readonly<{
|
|
56
|
-
protocol: typeof mermaidProtocol;
|
|
57
|
-
status: 'rejected';
|
|
58
|
-
diagnostics: readonly MermaidDiagnostic[];
|
|
59
|
-
}>;
|
|
60
|
-
/**
|
|
61
|
-
* Export the qualified flowchart subset without changing the graph or performing I/O.
|
|
62
|
-
* Losses reject by default. `report` consents to omitted fields, never to errors.
|
|
63
|
-
* Keep the bundle's identity metadata with source; source alone contains safe aliases.
|
|
64
|
-
*/
|
|
65
|
-
declare function exportMermaid(graph: ZlozGraph, options?: MermaidExportOptions): MermaidExportResult;
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/review-packet.d.ts
|
|
68
|
-
type ZlozReviewPacketOptions = MermaidExportOptions & Readonly<{
|
|
69
|
-
/** Complete replacement catalogue. Packet interpretation is deliberately data-only. */rules?: readonly ZlozEventStormingRelationshipRule[];
|
|
70
|
-
}>;
|
|
71
|
-
type ZlozReviewPacketDiagnostic = Readonly<{
|
|
72
|
-
side: 'packet' | 'baseline' | 'selected';
|
|
73
|
-
code: MermaidDiagnostic['code'] | 'invalid-options' | 'unknown-baseline' | 'unknown-edition' | 'viewport-omitted';
|
|
74
|
-
severity: 'error' | 'loss';
|
|
75
|
-
dimension: MermaidDiagnostic['dimension'];
|
|
76
|
-
message: string;
|
|
77
|
-
subject: string | null;
|
|
78
|
-
}>;
|
|
79
|
-
type ZlozReviewSnapshot = Readonly<{
|
|
80
|
-
source: ZlozRelationshipAuditSource;
|
|
81
|
-
snapshot: ZlozSnapshot;
|
|
82
|
-
}>;
|
|
83
|
-
type ZlozReviewPacket = Readonly<{
|
|
84
|
-
format: 'foldkit-zloz-review';
|
|
85
|
-
version: 1;
|
|
86
|
-
scope: 'selected-snapshots';
|
|
87
|
-
model: Readonly<{
|
|
88
|
-
id: string;
|
|
89
|
-
name: string;
|
|
90
|
-
}>;
|
|
91
|
-
baseline: Readonly<{
|
|
92
|
-
source: Extract<ZlozRelationshipAuditSource, {
|
|
93
|
-
kind: 'edition';
|
|
94
|
-
}>;
|
|
95
|
-
snapshot: ZlozSnapshot;
|
|
96
|
-
}>;
|
|
97
|
-
selected: ZlozReviewSnapshot;
|
|
98
|
-
conventions: Readonly<{
|
|
99
|
-
source: 'builtin' | 'custom';
|
|
100
|
-
roleInterpretation: 'zloz-event-storming/v1';
|
|
101
|
-
rules: readonly ZlozEventStormingRelationshipRule[];
|
|
102
|
-
}>;
|
|
103
|
-
comparison: ZlozRelationshipAuditComparison;
|
|
104
|
-
projectionOptions: Readonly<Required<MermaidExportOptions>>;
|
|
105
|
-
projections: Readonly<{
|
|
106
|
-
baseline: MermaidBundle;
|
|
107
|
-
selected: MermaidBundle;
|
|
108
|
-
}>;
|
|
109
|
-
diagnostics: readonly ZlozReviewPacketDiagnostic[];
|
|
110
|
-
}>;
|
|
111
|
-
type ZlozReviewPacketResult = Readonly<{
|
|
112
|
-
status: 'created';
|
|
113
|
-
value: ZlozReviewPacket;
|
|
114
|
-
diagnostics: readonly ZlozReviewPacketDiagnostic[];
|
|
115
|
-
}> | Readonly<{
|
|
116
|
-
status: 'rejected';
|
|
117
|
-
reason: 'input' | 'projection';
|
|
118
|
-
diagnostics: readonly ZlozReviewPacketDiagnostic[];
|
|
119
|
-
}>;
|
|
120
|
-
/** ADR-0035: Data-only composition in the optional adapter; no I/O, clocks, imports or graph writes.
|
|
121
|
-
* Invalid model/rule data throws at the existing core validation boundary. Selector/options and
|
|
122
|
-
* projection failures return rejected results. Created packets may contain introduced audit findings. */
|
|
123
|
-
declare function createReviewPacket(document: ZlozModelDocument, selection: ZlozRelationshipAuditSelection, options?: ZlozReviewPacketOptions): ZlozReviewPacketResult;
|
|
124
|
-
//#endregion
|
|
125
|
-
export { MermaidBundle, MermaidDiagnostic, MermaidDiagnosticCode, MermaidDirection, MermaidExportOptions, MermaidExportResult, MermaidIdentity, MermaidLossPolicy, type ZlozReviewPacket, type ZlozReviewPacketDiagnostic, type ZlozReviewPacketOptions, type ZlozReviewPacketResult, type ZlozReviewSnapshot, createReviewPacket, exportMermaid, mermaidProtocol, mermaidSourceLimit };
|
|
126
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
import { A as ZlozReviewSnapshot, B as MermaidIdentity, C as ZlozReviewPacketSelection, D as ZlozReviewPacketDiagnostic, E as ZlozReviewPacket, F as MermaidDiagnosticCode, G as mermaidProtocolV2, H as exportConnectionMermaid, I as MermaidDirection, K as mermaidSourceLimit, L as MermaidExportOptions, M as MermaidBundle, N as MermaidBundleV2, O as ZlozReviewPacketOptions, P as MermaidDiagnostic, R as MermaidExportResult, S as ZlozReviewPacketRequest, T as resolveReviewPacketRequest, U as exportMermaid, V as MermaidLossPolicy, W as mermaidProtocol, _ as openReviewPacketV2, a as ZlozReviewReaderUpdate, b as ZlozReviewPacketDecision, c as reviewReaderForScope, d as ZlozReviewPacketParseResult, f as parseReviewPacket, g as createReviewPacketV2, h as ZlozReviewPacketV2, i as ZlozReviewReaderState, j as createReviewPacket, k as ZlozReviewPacketResult, l as updateReviewReader, m as ZlozReviewPacketResultV2, n as ZlozReviewReaderRequest, o as createReviewReader, p as parseReviewPacketV2, r as ZlozReviewReaderSide, s as resolveReviewReader, t as ZlozReviewReaderOptions, u as ZlozReviewPacketParseOptions, v as ZlozReviewPacketControlsContext, w as resolveReviewPacketControls, x as ZlozReviewPacketExportState, y as ZlozReviewPacketControlsOptions, z as MermaidExportResultV2 } from "./review-reader-D_31oCfi.mjs";
|
|
2
|
+
export { MermaidBundle, MermaidBundleV2, MermaidDiagnostic, MermaidDiagnosticCode, MermaidDirection, MermaidExportOptions, MermaidExportResult, MermaidExportResultV2, MermaidIdentity, MermaidLossPolicy, type ZlozReviewPacket, type ZlozReviewPacketControlsContext, type ZlozReviewPacketControlsOptions, type ZlozReviewPacketDecision, type ZlozReviewPacketDiagnostic, type ZlozReviewPacketExportState, type ZlozReviewPacketOptions, type ZlozReviewPacketParseOptions, type ZlozReviewPacketParseResult, type ZlozReviewPacketRequest, type ZlozReviewPacketResult, ZlozReviewPacketResultV2, type ZlozReviewPacketSelection, ZlozReviewPacketV2, type ZlozReviewReaderOptions, type ZlozReviewReaderRequest, type ZlozReviewReaderSide, type ZlozReviewReaderState, type ZlozReviewReaderUpdate, type ZlozReviewSnapshot, createReviewPacket, createReviewPacketV2, createReviewReader, exportConnectionMermaid, exportMermaid, mermaidProtocol, mermaidProtocolV2, mermaidSourceLimit, openReviewPacketV2, parseReviewPacket, parseReviewPacketV2, resolveReviewPacketControls, resolveReviewPacketRequest, resolveReviewReader, reviewReaderForScope, updateReviewReader };
|