@weasel-js/diagram 1.15.0 → 1.15.2

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.
Files changed (35) hide show
  1. package/README.md +114 -5
  2. package/dist/{chunk-GR2DK4S2.js → chunk-6YQSQXQT.js} +1485 -266
  3. package/dist/chunk-6YQSQXQT.js.map +1 -0
  4. package/dist/{chunk-FDCODMFW.js → chunk-7BV2MBED.js} +906 -606
  5. package/dist/chunk-7BV2MBED.js.map +1 -0
  6. package/dist/{chunk-IYUU5KUY.js → chunk-FQVZWS24.js} +11 -101
  7. package/dist/chunk-FQVZWS24.js.map +1 -0
  8. package/dist/{chunk-AXL4JQBM.js → chunk-LPTNAYER.js} +3 -3
  9. package/dist/{chunk-AXL4JQBM.js.map → chunk-LPTNAYER.js.map} +1 -1
  10. package/dist/{chunk-DE7UILJA.js → chunk-QGL6QJE4.js} +183 -23
  11. package/dist/chunk-QGL6QJE4.js.map +1 -0
  12. package/dist/{dataTypes-BIkhAOc4.d.ts → dataTypes-1ch6cMtq.d.ts} +12 -3
  13. package/dist/effect-audio.d.ts +2 -2
  14. package/dist/effect-audio.js +7 -11
  15. package/dist/effect-audio.js.map +1 -1
  16. package/dist/effect.d.ts +5 -5
  17. package/dist/effect.js +13 -20
  18. package/dist/effect.js.map +1 -1
  19. package/dist/icons.table.js +44 -0
  20. package/dist/icons.table.js.map +1 -1
  21. package/dist/icons.table.json +44 -0
  22. package/dist/index.d.ts +932 -37
  23. package/dist/index.js +707 -34
  24. package/dist/index.js.map +1 -1
  25. package/dist/{labelTrait-BBjRgxbz.d.ts → labelTrait-moIciyXr.d.ts} +4 -0
  26. package/dist/layout.d.ts +3 -3
  27. package/dist/{layout.entry-CbmGuqE-.d.ts → layout.entry-zstuljAl.d.ts} +2 -2
  28. package/dist/layout.js +2 -2
  29. package/dist/{stageTypes-UiO25hcn.d.ts → stageTypes-B7oF8Lww.d.ts} +1 -1
  30. package/dist/{types-B0n2CNTW.d.ts → types-D5ybp8Xh.d.ts} +32 -1
  31. package/package.json +12 -11
  32. package/dist/chunk-DE7UILJA.js.map +0 -1
  33. package/dist/chunk-FDCODMFW.js.map +0 -1
  34. package/dist/chunk-GR2DK4S2.js.map +0 -1
  35. package/dist/chunk-IYUU5KUY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/effect/check.ts","../src/effect/stageTypes.ts","../src/effect/draw.ts","../src/effect/runner/order.ts","../src/effect/runner/params.ts","../src/effect/runner/previews.ts"],"names":["w"],"mappings":";;;AAeO,SAAS,aAAa,KAAA,EAAmC;AAC9D,EAAA,MAAM,QAAQ,KAAA,CAAM,KAAA;AACpB,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,IAAA;AAChC,EAAA,IAAI,EAAE,KAAA,CAAM,MAAA,IAAU,EAAC,EAAG,KAAK,CAAC,CAAA,KAAM,CAAA,CAAE,EAAA,KAAO,MAAM,KAAK,CAAA,EAAG,OAAO,CAAA,WAAA,EAAc,MAAM,KAAK,CAAA,iCAAA,CAAA;AAC7F,EAAA,IAAI,KAAA,CAAM,EAAA,CAAG,MAAA,KAAW,CAAA,EAAG,OAAO,qBAAA;AAClC,EAAA,IAAI,CAAC,KAAA,CAAM,EAAA,CAAG,MAAM,MAAA,CAAO,QAAQ,GAAG,OAAO,uCAAA;AAC7C,EAAA,IAAI,KAAA,CAAM,EAAA,CAAG,IAAA,CAAK,CAAC,KAAK,CAAA,KAAM,CAAA,GAAI,CAAA,IAAK,GAAA,IAAO,MAAM,EAAA,CAAG,CAAA,GAAI,CAAC,CAAE,GAAG,OAAO,0CAAA;AACxE,EAAA,MAAM,KAAA,GAAA,CAAS,KAAA,CAAM,OAAA,IAAW,EAAC,EAAG,MAAA;AACpC,EAAA,IAAI,UAAU,KAAA,CAAM,EAAA,CAAG,MAAA,GAAS,CAAA,SAAU,CAAA,IAAA,EAAO,KAAA,CAAM,EAAA,CAAG,MAAM,aAAa,KAAK,CAAA,mBAAA,EAAs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KAAA,EAAM;AAC5C","file":"chunk-AXL4JQBM.js","sourcesContent":["import type { EffectPipeline, EffectStage } from './types';\n\n/** One thing wrong with a pipeline, and where. */\nexport interface EffectProblem {\n kind: 'missing-stage' | 'missing-port' | 'wrong-direction' | 'type-mismatch'\n | 'duplicate-stage' | 'duplicate-port' | 'duplicate-group' | 'missing-member' | 'bad-split';\n message: string;\n stage?: string;\n port?: string;\n /** Index into `pipeline.wires`. */\n wire?: number;\n group?: string;\n}\n\n/** What `split` gets wrong on `stage`, or null. */\nexport function splitProblem(stage: EffectStage): string | null {\n const split = stage.split;\n if (split === undefined) return null;\n if (!(stage.inputs ?? []).some((p) => p.id === split.input)) return `splits on \"${split.input}\", which is not one of its inputs`;\n if (split.at.length === 0) return 'splits with no cuts';\n if (!split.at.every(Number.isFinite)) return 'has a cut that is not a finite number';\n if (split.at.some((cut, i) => i > 0 && cut <= split.at[i - 1]!)) return 'has cuts that are not in ascending order';\n const exits = (stage.outputs ?? []).length;\n if (exits !== split.at.length + 1) return `has ${split.at.length} cuts and ${exits} outputs; it needs ${split.at.length + 1}`;\n return null;\n}\n\n/** Everything wrong with `pipeline`. Never throws. */\nexport function checkPipeline(pipeline: EffectPipeline): EffectProblem[] {\n const out: EffectProblem[] = [];\n const stages = new Map<string, EffectStage>();\n for (const stage of pipeline.stages) {\n if (stages.has(stage.id)) {\n out.push({ kind: 'duplicate-stage', stage: stage.id, message: `Stage \"${stage.id}\" appears more than once.` });\n continue;\n }\n stages.set(stage.id, stage);\n const seen = new Set<string>();\n for (const port of [...(stage.inputs ?? []), ...(stage.outputs ?? [])]) {\n if (seen.has(port.id)) {\n out.push({ kind: 'duplicate-port', stage: stage.id, port: port.id, message: `Stage \"${stage.id}\" has two ports called \"${port.id}\".` });\n }\n seen.add(port.id);\n }\n const split = splitProblem(stage);\n if (split !== null) out.push({ kind: 'bad-split', stage: stage.id, message: `Stage \"${stage.id}\" ${split}.` });\n }\n\n pipeline.wires.forEach((wire, index) => {\n const ends = ([['from', 'outputs', 'inputs'], ['to', 'inputs', 'outputs']] as const).map(([end, own, other]) => {\n const ref = wire[end];\n const stage = stages.get(ref.stage);\n if (stage === undefined) {\n out.push({ kind: 'missing-stage', wire: index, stage: ref.stage, message: `Wire ${index} names stage \"${ref.stage}\", which does not exist.` });\n return null;\n }\n const port = (stage[own] ?? []).find((p) => p.id === ref.port);\n if (port !== undefined) return port;\n const wrong = (stage[other] ?? []).some((p) => p.id === ref.port);\n out.push(wrong\n ? { kind: 'wrong-direction', wire: index, stage: ref.stage, port: ref.port, message: `Wire ${index} ${end === 'from' ? 'starts at an input' : 'ends at an output'}, \"${ref.stage}.${ref.port}\".` }\n : { kind: 'missing-port', wire: index, stage: ref.stage, port: ref.port, message: `Wire ${index} names port \"${ref.stage}.${ref.port}\", which does not exist.` });\n return null;\n });\n const [from, to] = ends;\n if (from && to && from.type !== to.type) {\n out.push({ kind: 'type-mismatch', wire: index, message: `Wire ${index} joins a \"${from.type}\" output to a \"${to.type}\" input.` });\n }\n });\n\n const groupIds = new Set<string>();\n const groups = (pipeline.groups ?? []).filter((group) => {\n const repeat = groupIds.has(group.id);\n if (repeat || stages.has(group.id)) {\n out.push({\n kind: 'duplicate-group',\n group: group.id,\n message: repeat ? `Group \"${group.id}\" appears more than once.` : `Group \"${group.id}\" has the id of a stage.`,\n });\n return false;\n }\n groupIds.add(group.id);\n return true;\n });\n for (const group of groups) {\n for (const member of group.members) {\n if (stages.has(member) || groupIds.has(member)) continue;\n out.push({ kind: 'missing-member', group: group.id, message: `Group \"${group.id}\" names \"${member}\", which is neither a stage nor a group.` });\n }\n }\n return out;\n}\n","import type { EffectParam, EffectParamControl, EffectPort, EffectStage } from './types';\n\n/** A palette entry: a stage's ports and params, ready to be copied into a pipeline. */\nexport interface EffectStageType {\n type: string;\n title: string;\n kind?: string;\n inputs?: readonly EffectPort[];\n outputs?: readonly EffectPort[];\n params?: readonly EffectParam[];\n}\n\n/** A stage of type `t` with its own copy of the ports and params; no link back. */\nexport function stageFromType(t: EffectStageType, id: string): EffectStage {\n const stage: EffectStage = { id, title: t.title, type: t.type };\n if (t.kind !== undefined) stage.kind = t.kind;\n if (t.inputs) stage.inputs = t.inputs.map((p) => ({ ...p }));\n if (t.outputs) stage.outputs = t.outputs.map((p) => ({ ...p }));\n if (t.params) stage.params = t.params.map((p) => ({ ...p, ...(p.control ? { control: structuredClone(p.control) } : {}) }));\n return stage;\n}\n\n/** The places after the point `step` is written with, which a multiple of it needs. */\nfunction stepPlaces(step: number): number {\n const text = String(step);\n if (text.includes('e')) return Math.min(20, Math.max(0, -Math.floor(Math.log10(step))));\n const dot = text.indexOf('.');\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/** The display string for a control's value, to as many places as its `step` has (one without a step). */\nexport function formatParam(control: EffectParamControl): string {\n switch (control.kind) {\n case 'number': {\n const n = control.value.toFixed(control.step === undefined ? 1 : stepPlaces(control.step)).replace(/^-(?=[0.]*$)/, '');\n return control.unit ? `${n} ${control.unit}` : n;\n }\n case 'enum':\n return control.options.find((x) => x.value === control.value)?.label ?? control.value;\n case 'boolean':\n return control.value ? 'on' : 'off';\n case 'string':\n return control.value;\n }\n}\n","/** What every look shares: how a type is colored, how a stage and a wire are\n * styled, and the lookups a look does over a pipeline. */\nimport type { Row } from '../body';\nimport { edgeIdOf, type DataEdge, type DataNode, type DiagramData, type DiagramSceneOptions, type EdgeStyle, type NodeStyle } from '../fromData';\nimport { DIAGRAM_THEMES } from '../theme/themes';\nimport type { DiagramTheme } from '../theme/types';\nimport type { PortSpec } from '../types';\nimport { checkPipeline } from './check';\nimport { formatParam } from './stageTypes';\nimport type { EffectGroup, EffectPipeline, EffectPort, EffectStage, EffectWire } from './types';\n\n/** The color of a value type, for a port or a wire. Answers `undefined`, a\n * port with no type, with a neutral color. */\nexport type TypeColor = (type: string | undefined) => string;\n\n/** What a look hands back: `diagramScene`'s two arguments, and its colors. */\nexport interface EffectLookResult {\n data: DiagramData;\n scene: DiagramSceneOptions;\n color: TypeColor;\n /** Edges standing in for a decision's exits where the look draws no\n * decision, keyed by edge id: which stage chose, and by which output. A\n * run reads that stage's `taken` for them. */\n exits?: ReadonlyMap<string, { stage: string; port: string }>;\n /** The stages on the main line, in the order the look draws them, for a\n * reorder to drag along. Looks that place stages freely leave it out. */\n order?: LookOrder;\n /** The lanes, top down, where the look draws lanes. */\n laneOrder?: LookOrder;\n}\n\n/** A sequence a look draws: the scene node ids of its items in order along\n * `axis`. `reorder`'s `sequenceSlots` turns it into slots once the items\n * have drawn boxes. */\nexport interface LookOrder {\n axis: 'x' | 'y';\n /** `grip` is where a press picks the item up, in world units; default its drawn box. */\n items: readonly { id: string; grip?: { x: number; y: number; width: number; height: number } }[];\n}\n\n/** One way of drawing a pipeline. Unparameterized, a look whose options are\n * not known: any look fits it, and it is called with none. */\nexport type EffectLook<TOptions = never> = (pipeline: EffectPipeline, options?: TOptions) => EffectLookResult;\n\n/** The theme the shipped looks draw in when their options name none. */\nexport const LOOK_THEME: DiagramTheme = DIAGRAM_THEMES.night!;\n\n/** The option every shipped look takes for its colors. */\nexport interface LookThemeOptions {\n /** Stages take its default role, bypassed ones its muted role; value types its `series` in\n * turn; groups its container; lanes its lane bodies. Default `night`. */\n theme?: DiagramTheme;\n}\n\nconst UNTYPED = '#8aa2b5';\n/** The color `wireStyle` draws a wire in when `checkPipeline` reported it. */\nexport const PROBLEM_COLOR = '#ff5d5d';\n\nconst BYPASSED_DASH = [4, 3];\n\n/** A color per type: the one given, or the next in `series` in the order\n * types first appear on the pipeline's ports. */\nexport function typeColors(\n pipeline: EffectPipeline, given: Readonly<Record<string, string>> = {}, series: readonly string[] = LOOK_THEME.series,\n): TypeColor {\n const colors = new Map<string, string>();\n for (const stage of pipeline.stages) {\n for (const port of [...(stage.inputs ?? []), ...(stage.outputs ?? [])]) {\n if (colors.has(port.type)) continue;\n colors.set(port.type, given[port.type] ?? series[colors.size % series.length]!);\n }\n }\n return (type) => (type === undefined ? UNTYPED : colors.get(type) ?? given[type] ?? UNTYPED);\n}\n\n/** Whether `type` is one the pipeline's `types` mark as `control`. */\nexport function isControl(pipeline: EffectPipeline, type: string | undefined): boolean {\n return type !== undefined && pipeline.types?.[type]?.control === true;\n}\n\n/** The node style the shipped looks give a stage: the theme's default role, or dashed in its\n * muted role when the stage is bypassed. */\nexport function stageStyle(stage: EffectStage, theme: DiagramTheme = LOOK_THEME): NodeStyle {\n const { roles, defaultRole } = theme;\n return stage.bypassed === true ? { ...(roles.muted ?? roles[defaultRole]!), dash: BYPASSED_DASH } : roles[defaultRole]!;\n}\n\n/** The edge style the shipped looks give a wire: `color`, dashed for a\n * control wire, and `PROBLEM_COLOR` in place of `color` for a flagged one. */\nexport function wireStyle(color: string, control: boolean, problem: boolean): EdgeStyle {\n return {\n stroke: problem ? PROBLEM_COLOR : color,\n width: 2,\n markerEnd: null,\n ...(control ? { dash: [5, 4] } : {}),\n };\n}\n\n/** Stages with the repeats dropped, first one kept. `diagramScene` throws on\n * a repeated id, so a look builds its nodes from these. */\nexport function uniqueStages(pipeline: EffectPipeline): EffectStage[] {\n const seen = new Set<string>();\n return pipeline.stages.filter((s) => (seen.has(s.id) ? false : (seen.add(s.id), true)));\n}\n\n/** Groups with the repeats dropped, first one kept, and none that has the id\n * of a stage: `diagramScene` throws on an id that names two things. */\nexport function uniqueGroups(pipeline: EffectPipeline): EffectGroup[] {\n const seen = new Set(pipeline.stages.map((s) => s.id));\n return (pipeline.groups ?? []).filter((g) => (seen.has(g.id) ? false : (seen.add(g.id), true)));\n}\n\n/** The port called `id` among a stage's inputs and outputs, inputs first. */\nexport function portOn(stage: EffectStage | undefined, id: string): EffectPort | undefined {\n return [...(stage?.inputs ?? []), ...(stage?.outputs ?? [])].find((p) => p.id === id);\n}\n\n/** A stage's `kind` as the shipped looks read it: any value they do not know is `'stage'`. */\nexport function kindOf(stage: EffectStage): 'stage' | 'decision' | 'source' | 'sink' {\n return stage.kind === 'decision' || stage.kind === 'source' || stage.kind === 'sink' ? stage.kind : 'stage';\n}\n\n/** A wire with both ends present, and what a look needs to draw it. */\nexport interface DrawableWire {\n wire: EffectWire;\n /** Index into `pipeline.wires`. */\n index: number;\n /** The value type of the port the wire leaves. */\n type: string | undefined;\n /** `checkPipeline` reported it. */\n problem: boolean;\n fromStage: EffectStage;\n toStage: EffectStage;\n}\n\n/** The wires a look can draw: each one whose two stages and two ports exist,\n * in the pipeline's order. A wire `checkPipeline` reported and that still has\n * both ends is kept, with `problem` set. */\nexport function drawableWires(pipeline: EffectPipeline): DrawableWire[] {\n const stages = new Map(uniqueStages(pipeline).map((s) => [s.id, s]));\n const flagged = new Set(checkPipeline(pipeline).flatMap((p) => (p.wire === undefined ? [] : [p.wire])));\n return pipeline.wires.flatMap((wire, index) => {\n const fromStage = stages.get(wire.from.stage);\n const toStage = stages.get(wire.to.stage);\n const from = portOn(fromStage, wire.from.port);\n if (fromStage === undefined || toStage === undefined || from === undefined || portOn(toStage, wire.to.port) === undefined) return [];\n return [{ wire, index, type: from.type, problem: flagged.has(index), fromStage, toStage }];\n });\n}\n\n/** What a value row shows before a run fills it in. */\nexport const NO_VALUE = '–';\n/** What a value row is measured as, so most values a run writes fit. */\nconst VALUE_ROOM = '00000.000';\n\n/** The ports a run shows values and previews on: a stage's outputs, or for a\n * stage with none, such as a sink, its inputs, so the end of a pipeline\n * shows what reached it. */\nexport function shownPorts(stage: EffectStage): readonly EffectPort[] {\n return (stage.outputs?.length ?? 0) > 0 ? stage.outputs! : stage.inputs ?? [];\n}\n\n/** The row id of the value row for an output, under its stage's body. */\nexport const valueRowId = (port: string): string => `value:${port}`;\n/** The row id of the preview slot for an output, under its stage's body. */\nexport const previewRowId = (port: string): string => `preview:${port}`;\n\n/** `RunRowOptions.previewSize`'s default: a 48-unit square. */\nexport const PREVIEW_SIZE = 48;\n\n/** Device pixels per preview unit, so a preview stays sharp on a 2× display. */\nexport const PREVIEW_DENSITY = 2;\n\n/** The rows a look keeps on each stage for what an `EffectRun` shows there.\n * Kept from the start, so a run fills them in without the chart laying out\n * again. A decision's symbol keeps neither. */\nexport interface RunRowOptions {\n /** A row per output for its value. Default false. */\n showValues?: boolean;\n /** A slot per output for its preview, after its value row. Default false. */\n showPreviews?: boolean;\n /** The preview slot's size: a square's side, or a width and height. A\n * preview is stretched to fill it. Default `PREVIEW_SIZE`. */\n previewSize?: number | { width: number; height: number };\n}\n\n/** The `RunRowOptions` out of a look's options. */\nfunction runRowsOf(o: RunRowOptions): RunRowOptions {\n return {\n ...(o.showValues !== undefined ? { showValues: o.showValues } : {}),\n ...(o.showPreviews !== undefined ? { showPreviews: o.showPreviews } : {}),\n ...(o.previewSize !== undefined ? { previewSize: o.previewSize } : {}),\n };\n}\n\n/** The body rows of an ordinary stage: its title, a row of its ports when\n * `withPorts` (inputs left, outputs right), then for each of its\n * `shownPorts` its value row when `showValues` and its preview slot when\n * `showPreviews`, then its\n * params when `showParams`. */\nexport function stageRows(\n stage: EffectStage,\n opts: { showParams: boolean; withPorts: boolean } & RunRowOptions,\n): Row[] {\n const rows: Row[] = [{ kind: 'label', text: stage.title, style: { bold: true } }];\n const side = (ports: EffectStage['inputs']) => (ports ?? []).map((p) => ({ id: p.id, label: p.label ?? p.id, type: p.type }));\n if (opts.withPorts && ((stage.inputs?.length ?? 0) > 0 || (stage.outputs?.length ?? 0) > 0)) {\n rows.push({ kind: 'ports', left: side(stage.inputs), right: side(stage.outputs) });\n }\n const size = opts.previewSize ?? PREVIEW_SIZE;\n const preview = typeof size === 'number' ? { width: size, height: size } : size;\n // A repeated port id is a problem `checkPipeline` reports; one row for it.\n const seen = new Set<string>();\n for (const p of shownPorts(stage)) {\n if (seen.has(p.id)) continue;\n seen.add(p.id);\n if (opts.showValues === true) {\n rows.push({ kind: 'field', id: valueRowId(p.id), label: p.label ?? p.id, value: NO_VALUE, room: VALUE_ROOM });\n }\n if (opts.showPreviews === true) rows.push({ kind: 'slot', id: previewRowId(p.id), ...preview });\n }\n if (opts.showParams) for (const p of stage.params ?? []) rows.push({ kind: 'field', label: p.label, value: p.control ? formatParam(p.control) : p.value });\n return rows;\n}\n\n/** What a wire is called: its own label, or for a wire leaving a decision the\n * exit's label, which defaults to the exit's id. Any other wire has no name. */\nexport function exitLabel(d: DrawableWire): string | undefined {\n if (d.wire.label !== undefined) return d.wire.label;\n return kindOf(d.fromStage) === 'decision' ? portOn(d.fromStage, d.wire.from.port)?.label ?? d.wire.from.port : undefined;\n}\n\n/** The node the shipped looks draw for a stage that is not a decision: a box,\n * or a stadium for a source or a sink, holding `stageRows`. `ports` are its\n * perimeter ports; pass none when the rows carry them. */\nexport function boxNode(\n stage: EffectStage,\n opts: { showParams: boolean; rowPorts: boolean; ports: readonly PortSpec[]; run?: RunRowOptions },\n): DataNode {\n return {\n id: stage.id,\n outline: kindOf(stage) === 'stage' ? 'rect' : 'stadium',\n rows: stageRows(stage, { showParams: opts.showParams, withPorts: opts.rowPorts, ...runRowsOf(opts.run ?? {}) }),\n // Always set: left off, a stage port named n, e, s or w would share its id with a compass default.\n ports: opts.ports,\n };\n}\n\n/** One edge of a look's data, from port to port. */\nexport function wireEdge(\n from: EffectWire['from'],\n to: EffectWire['to'],\n label: string | undefined,\n id?: string,\n): DataEdge {\n return {\n ...(id !== undefined ? { id } : {}),\n from: from.stage, fromPort: from.port, to: to.stage, toPort: to.port,\n ...(label !== undefined ? { label } : {}),\n };\n}\n\n/** One edge per drawable wire, from port to port, named by `exitLabel` and\n * styled by `wireStyle` in its type's color. */\nexport function wireEdges(pipeline: EffectPipeline, color: TypeColor): { edge: DataEdge; style: EdgeStyle }[] {\n return drawableWires(pipeline).map((d) => ({\n edge: wireEdge(d.wire.from, d.wire.to, exitLabel(d), d.wire.id),\n style: wireStyle(color(d.type), isControl(pipeline, d.type), d.problem),\n }));\n}\n\n/** A look's `nodeStyle`, `edgeStyle`, and `theme`: `stageStyle` for each stage,\n * and for each edge the style paired with it. */\nexport function sceneStyles(\n stages: readonly EffectStage[],\n edges: readonly { edge: DataEdge; style: EdgeStyle }[],\n theme: DiagramTheme = LOOK_THEME,\n): Required<Pick<DiagramSceneOptions, 'nodeStyle' | 'edgeStyle' | 'theme'>> {\n const nodes = new Map(stages.map((s) => [s.id, stageStyle(s, theme)]));\n const wires = new Map(edges.map((e) => [edgeIdOf(e.edge), e.style]));\n return {\n theme,\n nodeStyle: (n) => nodes.get(n.id) ?? theme.roles[theme.defaultRole]!,\n edgeStyle: (e) => wires.get(edgeIdOf(e)) ?? wireStyle(UNTYPED, false, false),\n };\n}\n","import { uniqueStages } from '../draw';\nimport type { EffectPipeline } from '../types';\n\n/** The order a run evaluates stages in, and the stages it never can. */\nexport interface RunOrder {\n /** Every stage outside a cycle, each after every stage that feeds it. */\n order: string[];\n /** The stages on a cycle of wires, in stage order. */\n cyclic: string[];\n}\n\n/** The stages topologically over data and control wires alike, stable by\n * stage order: of the stages ready to go, the earliest goes first. A stage on\n * a cycle is left out, and so are its wires. */\nexport function runOrder(pipeline: EffectPipeline): RunOrder {\n const ids = uniqueStages(pipeline).map((s) => s.id);\n const index = new Map(ids.map((id, i) => [id, i]));\n const next = ids.map(() => [] as number[]);\n for (const w of pipeline.wires) {\n const a = index.get(w.from.stage);\n const b = index.get(w.to.stage);\n if (a !== undefined && b !== undefined) next[a]!.push(b);\n }\n const onCycle = cycleMembers(next);\n\n const waiting = ids.map(() => 0);\n for (let a = 0; a < ids.length; a++) {\n if (!onCycle[a]) for (const b of next[a]!) if (!onCycle[b]) waiting[b]!++;\n }\n const ready = new Set(ids.flatMap((_, i) => (!onCycle[i] && waiting[i] === 0 ? [i] : [])));\n const order: string[] = [];\n while (ready.size > 0) {\n const i = Math.min(...ready);\n ready.delete(i);\n order.push(ids[i]!);\n for (const b of next[i]!) if (!onCycle[b] && --waiting[b]! === 0) ready.add(b);\n }\n return { order, cyclic: ids.filter((_, i) => onCycle[i]) };\n}\n\n/** Whether each vertex is on a cycle: in a strongly connected component of\n * more than one vertex, or wired to itself. Tarjan's algorithm. */\nfunction cycleMembers(next: readonly (readonly number[])[]): boolean[] {\n const n = next.length;\n const low = new Array<number>(n).fill(-1);\n const seen = new Array<number>(n).fill(-1);\n const onStack = new Array<boolean>(n).fill(false);\n const result = new Array<boolean>(n).fill(false);\n const stack: number[] = [];\n let counter = 0;\n const visit = (v: number): void => {\n seen[v] = low[v] = counter++;\n stack.push(v);\n onStack[v] = true;\n for (const w of next[v]!) {\n if (seen[w] === -1) {\n visit(w);\n low[v] = Math.min(low[v]!, low[w]!);\n } else if (onStack[w]) {\n low[v] = Math.min(low[v]!, seen[w]!);\n }\n }\n if (low[v] !== seen[v]) return;\n const component: number[] = [];\n let w: number;\n do {\n w = stack.pop()!;\n onStack[w] = false;\n component.push(w);\n } while (w !== v);\n if (component.length > 1 || next[v]!.includes(v)) for (const c of component) result[c] = true;\n };\n for (let v = 0; v < n; v++) if (seen[v] === -1) visit(v);\n return result;\n}\n","import type { EffectStage } from '../types';\n\n/** A stage's params by id (label when it has none), each its control's value or its display value. */\nexport function paramValues(stage: EffectStage): Record<string, unknown> {\n return Object.fromEntries((stage.params ?? []).map((p) => [p.id ?? p.label, p.control?.value ?? p.value]));\n}\n","import type { EffectRun } from '../types';\n\nexport function previewsOf(run: EffectRun): ImageBitmap[] {\n return Object.values(run.stages).flatMap((s) => Object.values(s.previews ?? {}));\n}\n\nexport function closeBitmaps(bitmaps: readonly ImageBitmap[]): void {\n for (const b of new Set(bitmaps)) b.close();\n}\n"]}
1
+ {"version":3,"sources":["../src/effect/check.ts","../src/effect/stageTypes.ts","../src/effect/draw.ts","../src/effect/runner/order.ts","../src/effect/runner/params.ts","../src/effect/runner/previews.ts"],"names":["w"],"mappings":";;;AAeO,SAAS,aAAa,KAAA,EAAmC;AAC9D,EAAA,MAAM,QAAQ,KAAA,CAAM,KAAA;AACpB,EAAA,IAAI,KAAA,KAAU,QAAW,OAAO,IAAA;AAChC,EAAA,IAAI,EAAE,KAAA,CAAM,MAAA,IAAU,EAAC,EAAG,KAAK,CAAC,CAAA,KAAM,CAAA,CAAE,EA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,EAAA,EAAK,IAAI,IAAA,CAAK,CAAC,CAAA,KAAM,EAAA,EAAI,KAAA,CAAM,CAAC,CAAA;AACvD,EAAA,OAAO,MAAA;AACT;;;ACvEO,SAAS,YAAY,KAAA,EAA6C;AACvE,EAAA,OAAO,MAAA,CAAO,aAAa,KAAA,CAAM,MAAA,IAAU,EAAC,EAAG,GAAA,CAAI,CAAC,CAAA,KAAM,CAAC,EAAE,EAAA,IAAM,CAAA,CAAE,OAAO,CAAA,CAAE,OAAA,EAAS,SAAS,CAAA,CAAE,KAAK,CAAC,CAAC,CAAA;AAC3G;;;ACHO,SAAS,WAAW,GAAA,EAA+B;AACxD,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,GAAA,CAAI,MAAM,EAAE,OAAA,CAAQ,CAAC,CAAA,KAAM,MAAA,CAAO,MAAA,CAAO,CAAA,CAAE,QAAA,IAAY,EAAE,CAAC,CAAA;AACjF;AAEO,SAAS,aAAa,OAAA,EAAuC;AAClE,EAAA,KAAA,MAAW,KAAK,IAAI,GAAA,CAAI,OAAO,CAAA,IAAK,KAAA,EAAM;AAC5C","file":"chunk-LPTNAYER.js","sourcesContent":["import type { EffectPipeline, EffectStage } from './types';\n\n/** One thing wrong with a pipeline, and where. */\nexport interface EffectProblem {\n kind: 'missing-stage' | 'missing-port' | 'wrong-direction' | 'type-mismatch'\n | 'duplicate-stage' | 'duplicate-port' | 'duplicate-group' | 'missing-member' | 'bad-split';\n message: string;\n stage?: string;\n port?: string;\n /** Index into `pipeline.wires`. */\n wire?: number;\n group?: string;\n}\n\n/** What `split` gets wrong on `stage`, or null. */\nexport function splitProblem(stage: EffectStage): string | null {\n const split = stage.split;\n if (split === undefined) return null;\n if (!(stage.inputs ?? []).some((p) => p.id === split.input)) return `splits on \"${split.input}\", which is not one of its inputs`;\n if (split.at.length === 0) return 'splits with no cuts';\n if (!split.at.every(Number.isFinite)) return 'has a cut that is not a finite number';\n if (split.at.some((cut, i) => i > 0 && cut <= split.at[i - 1]!)) return 'has cuts that are not in ascending order';\n const exits = (stage.outputs ?? []).length;\n if (exits !== split.at.length + 1) return `has ${split.at.length} cuts and ${exits} outputs; it needs ${split.at.length + 1}`;\n return null;\n}\n\n/** Everything wrong with `pipeline`. Never throws. */\nexport function checkPipeline(pipeline: EffectPipeline): EffectProblem[] {\n const out: EffectProblem[] = [];\n const stages = new Map<string, EffectStage>();\n for (const stage of pipeline.stages) {\n if (stages.has(stage.id)) {\n out.push({ kind: 'duplicate-stage', stage: stage.id, message: `Stage \"${stage.id}\" appears more than once.` });\n continue;\n }\n stages.set(stage.id, stage);\n const seen = new Set<string>();\n for (const port of [...(stage.inputs ?? []), ...(stage.outputs ?? [])]) {\n if (seen.has(port.id)) {\n out.push({ kind: 'duplicate-port', stage: stage.id, port: port.id, message: `Stage \"${stage.id}\" has two ports called \"${port.id}\".` });\n }\n seen.add(port.id);\n }\n const split = splitProblem(stage);\n if (split !== null) out.push({ kind: 'bad-split', stage: stage.id, message: `Stage \"${stage.id}\" ${split}.` });\n }\n\n pipeline.wires.forEach((wire, index) => {\n const ends = ([['from', 'outputs', 'inputs'], ['to', 'inputs', 'outputs']] as const).map(([end, own, other]) => {\n const ref = wire[end];\n const stage = stages.get(ref.stage);\n if (stage === undefined) {\n out.push({ kind: 'missing-stage', wire: index, stage: ref.stage, message: `Wire ${index} names stage \"${ref.stage}\", which does not exist.` });\n return null;\n }\n const port = (stage[own] ?? []).find((p) => p.id === ref.port);\n if (port !== undefined) return port;\n const wrong = (stage[other] ?? []).some((p) => p.id === ref.port);\n out.push(wrong\n ? { kind: 'wrong-direction', wire: index, stage: ref.stage, port: ref.port, message: `Wire ${index} ${end === 'from' ? 'starts at an input' : 'ends at an output'}, \"${ref.stage}.${ref.port}\".` }\n : { kind: 'missing-port', wire: index, stage: ref.stage, port: ref.port, message: `Wire ${index} names port \"${ref.stage}.${ref.port}\", which does not exist.` });\n return null;\n });\n const [from, to] = ends;\n if (from && to && from.type !== to.type) {\n out.push({ kind: 'type-mismatch', wire: index, message: `Wire ${index} joins a \"${from.type}\" output to a \"${to.type}\" input.` });\n }\n });\n\n const groupIds = new Set<string>();\n const groups = (pipeline.groups ?? []).filter((group) => {\n const repeat = groupIds.has(group.id);\n if (repeat || stages.has(group.id)) {\n out.push({\n kind: 'duplicate-group',\n group: group.id,\n message: repeat ? `Group \"${group.id}\" appears more than once.` : `Group \"${group.id}\" has the id of a stage.`,\n });\n return false;\n }\n groupIds.add(group.id);\n return true;\n });\n for (const group of groups) {\n for (const member of group.members) {\n if (stages.has(member) || groupIds.has(member)) continue;\n out.push({ kind: 'missing-member', group: group.id, message: `Group \"${group.id}\" names \"${member}\", which is neither a stage nor a group.` });\n }\n }\n return out;\n}\n","import type { EffectParam, EffectParamControl, EffectPort, EffectStage } from './types';\n\n/** A palette entry: a stage's ports and params, ready to be copied into a pipeline. */\nexport interface EffectStageType {\n type: string;\n title: string;\n kind?: string;\n inputs?: readonly EffectPort[];\n outputs?: readonly EffectPort[];\n params?: readonly EffectParam[];\n}\n\n/** A stage of type `t` with its own copy of the ports and params; no link back. */\nexport function stageFromType(t: EffectStageType, id: string): EffectStage {\n const stage: EffectStage = { id, title: t.title, type: t.type };\n if (t.kind !== undefined) stage.kind = t.kind;\n if (t.inputs) stage.inputs = t.inputs.map((p) => ({ ...p }));\n if (t.outputs) stage.outputs = t.outputs.map((p) => ({ ...p }));\n if (t.params) stage.params = t.params.map((p) => ({ ...p, ...(p.control ? { control: structuredClone(p.control) } : {}) }));\n return stage;\n}\n\n/** The places after the point `step` is written with, which a multiple of it needs. */\nfunction stepPlaces(step: number): number {\n const text = String(step);\n if (text.includes('e')) return Math.min(20, Math.max(0, -Math.floor(Math.log10(step))));\n const dot = text.indexOf('.');\n return dot === -1 ? 0 : text.length - dot - 1;\n}\n\n/** The display string for a control's value, to as many places as its `step` has (one without a step). */\nexport function formatParam(control: EffectParamControl): string {\n switch (control.kind) {\n case 'number': {\n const n = control.value.toFixed(control.step === undefined ? 1 : stepPlaces(control.step)).replace(/^-(?=[0.]*$)/, '');\n return control.unit ? `${n} ${control.unit}` : n;\n }\n case 'enum':\n return control.options.find((x) => x.value === control.value)?.label ?? control.value;\n case 'boolean':\n return control.value ? 'on' : 'off';\n case 'string':\n return control.value;\n }\n}\n","/** What every look shares: how a type is colored, how a stage and a wire are\n * styled, and the lookups a look does over a pipeline. */\nimport type { Row } from '../body';\nimport { edgeIdOf, type DataEdge, type DataNode, type DiagramData, type DiagramSceneOptions, type EdgeStyle, type NodeStyle } from '../fromData';\nimport { DIAGRAM_THEMES } from '../theme/themes';\nimport type { DiagramTheme } from '../theme/types';\nimport type { PortSpec } from '../types';\nimport { checkPipeline } from './check';\nimport { formatParam } from './stageTypes';\nimport type { EffectGroup, EffectPipeline, EffectPort, EffectStage, EffectWire } from './types';\n\n/** The color of a value type, for a port or a wire. Answers `undefined`, a\n * port with no type, with a neutral color. */\nexport type TypeColor = (type: string | undefined) => string;\n\n/** What a look hands back: `diagramScene`'s two arguments, and its colors. */\nexport interface EffectLookResult {\n data: DiagramData;\n scene: DiagramSceneOptions;\n color: TypeColor;\n /** Edges standing in for a decision's exits where the look draws no\n * decision, keyed by edge id: which stage chose, and by which output. A\n * run reads that stage's `taken` for them. */\n exits?: ReadonlyMap<string, { stage: string; port: string }>;\n /** The stages on the main line, in the order the look draws them, for a\n * reorder to drag along. Looks that place stages freely leave it out. */\n order?: LookOrder;\n /** The lanes, top down, where the look draws lanes. */\n laneOrder?: LookOrder;\n}\n\n/** A sequence a look draws: the scene node ids of its items in order along\n * `axis`. `reorder`'s `sequenceSlots` turns it into slots once the items\n * have drawn boxes. */\nexport interface LookOrder {\n axis: 'x' | 'y';\n /** `grip` is where a press picks the item up, in world units; default its drawn box. */\n items: readonly { id: string; grip?: { x: number; y: number; width: number; height: number } }[];\n}\n\n/** One way of drawing a pipeline. Unparameterized, a look whose options are\n * not known: any look fits it, and it is called with none. */\nexport type EffectLook<TOptions = never> = (pipeline: EffectPipeline, options?: TOptions) => EffectLookResult;\n\n/** The theme the shipped looks draw in when their options name none. */\nexport const LOOK_THEME: DiagramTheme = DIAGRAM_THEMES.night!;\n\n/** The option every shipped look takes for its colors. */\nexport interface LookThemeOptions {\n /** Stages take its default role, bypassed ones its muted role; value types its `series` in\n * turn; groups its container; lanes its lane bodies. Default `night`. */\n theme?: DiagramTheme;\n}\n\nconst UNTYPED = '#8aa2b5';\n/** The color `wireStyle` draws a wire in when `checkPipeline` reported it. */\nexport const PROBLEM_COLOR = '#ff5d5d';\n\nconst BYPASSED_DASH = [4, 3];\n\n/** A color per type: the one given, or the next in `series` in the order\n * types first appear on the pipeline's ports. */\nexport function typeColors(\n pipeline: EffectPipeline, given: Readonly<Record<string, string>> = {}, series: readonly string[] = LOOK_THEME.series,\n): TypeColor {\n const colors = new Map<string, string>();\n for (const stage of pipeline.stages) {\n for (const port of [...(stage.inputs ?? []), ...(stage.outputs ?? [])]) {\n if (colors.has(port.type)) continue;\n colors.set(port.type, given[port.type] ?? series[colors.size % series.length]!);\n }\n }\n return (type) => (type === undefined ? UNTYPED : colors.get(type) ?? given[type] ?? UNTYPED);\n}\n\n/** Whether `type` is one the pipeline's `types` mark as `control`. */\nexport function isControl(pipeline: EffectPipeline, type: string | undefined): boolean {\n return type !== undefined && pipeline.types?.[type]?.control === true;\n}\n\n/** The node style the shipped looks give a stage: the theme's default role, or dashed in its\n * muted role when the stage is bypassed. */\nexport function stageStyle(stage: EffectStage, theme: DiagramTheme = LOOK_THEME): NodeStyle {\n const { roles, defaultRole } = theme;\n return stage.bypassed === true ? { ...(roles.muted ?? roles[defaultRole]!), dash: BYPASSED_DASH } : roles[defaultRole]!;\n}\n\n/** The edge style the shipped looks give a wire: `color`, dashed for a\n * control wire, and `PROBLEM_COLOR` in place of `color` for a flagged one. */\nexport function wireStyle(color: string, control: boolean, problem: boolean): EdgeStyle {\n return {\n stroke: problem ? PROBLEM_COLOR : color,\n width: 2,\n markerEnd: null,\n ...(control ? { dash: [5, 4] } : {}),\n };\n}\n\n/** Stages with the repeats dropped, first one kept. `diagramScene` throws on\n * a repeated id, so a look builds its nodes from these. */\nexport function uniqueStages(pipeline: EffectPipeline): EffectStage[] {\n const seen = new Set<string>();\n return pipeline.stages.filter((s) => (seen.has(s.id) ? false : (seen.add(s.id), true)));\n}\n\n/** Groups with the repeats dropped, first one kept, and none that has the id\n * of a stage: `diagramScene` throws on an id that names two things. */\nexport function uniqueGroups(pipeline: EffectPipeline): EffectGroup[] {\n const seen = new Set(pipeline.stages.map((s) => s.id));\n return (pipeline.groups ?? []).filter((g) => (seen.has(g.id) ? false : (seen.add(g.id), true)));\n}\n\n/** The port called `id` among a stage's inputs and outputs, inputs first. */\nexport function portOn(stage: EffectStage | undefined, id: string): EffectPort | undefined {\n return [...(stage?.inputs ?? []), ...(stage?.outputs ?? [])].find((p) => p.id === id);\n}\n\n/** A stage's `kind` as the shipped looks read it: any value they do not know is `'stage'`. */\nexport function kindOf(stage: EffectStage): 'stage' | 'decision' | 'source' | 'sink' {\n return stage.kind === 'decision' || stage.kind === 'source' || stage.kind === 'sink' ? stage.kind : 'stage';\n}\n\n/** A wire with both ends present, and what a look needs to draw it. */\nexport interface DrawableWire {\n wire: EffectWire;\n /** Index into `pipeline.wires`. */\n index: number;\n /** The value type of the port the wire leaves. */\n type: string | undefined;\n /** `checkPipeline` reported it. */\n problem: boolean;\n fromStage: EffectStage;\n toStage: EffectStage;\n}\n\n/** The wires a look can draw: each one whose two stages and two ports exist,\n * in the pipeline's order. A wire `checkPipeline` reported and that still has\n * both ends is kept, with `problem` set. */\nexport function drawableWires(pipeline: EffectPipeline): DrawableWire[] {\n const stages = new Map(uniqueStages(pipeline).map((s) => [s.id, s]));\n const flagged = new Set(checkPipeline(pipeline).flatMap((p) => (p.wire === undefined ? [] : [p.wire])));\n return pipeline.wires.flatMap((wire, index) => {\n const fromStage = stages.get(wire.from.stage);\n const toStage = stages.get(wire.to.stage);\n const from = portOn(fromStage, wire.from.port);\n if (fromStage === undefined || toStage === undefined || from === undefined || portOn(toStage, wire.to.port) === undefined) return [];\n return [{ wire, index, type: from.type, problem: flagged.has(index), fromStage, toStage }];\n });\n}\n\n/** What a value row shows before a run fills it in. */\nexport const NO_VALUE = '–';\n/** What a value row is measured as, so most values a run writes fit. */\nconst VALUE_ROOM = '00000.000';\n\n/** The ports a run shows values and previews on: a stage's outputs, or for a\n * stage with none, such as a sink, its inputs, so the end of a pipeline\n * shows what reached it. */\nexport function shownPorts(stage: EffectStage): readonly EffectPort[] {\n return (stage.outputs?.length ?? 0) > 0 ? stage.outputs! : stage.inputs ?? [];\n}\n\n/** The row id of the value row for an output, under its stage's body. */\nexport const valueRowId = (port: string): string => `value:${port}`;\n/** The row id of the preview slot for an output, under its stage's body. */\nexport const previewRowId = (port: string): string => `preview:${port}`;\n\n/** `RunRowOptions.previewSize`'s default: a 48-unit square. */\nexport const PREVIEW_SIZE = 48;\n\n/** Device pixels per preview unit, so a preview stays sharp on a 2× display. */\nexport const PREVIEW_DENSITY = 2;\n\n/** The rows a look keeps on each stage for what an `EffectRun` shows there.\n * Kept from the start, so a run fills them in without the chart laying out\n * again. A decision's symbol keeps neither. */\nexport interface RunRowOptions {\n /** A row per output for its value. Default false. */\n showValues?: boolean;\n /** A slot per output for its preview, after its value row. Default false. */\n showPreviews?: boolean;\n /** The preview slot's size: a square's side, or a width and height. A\n * preview is stretched to fill it. Default `PREVIEW_SIZE`. */\n previewSize?: number | { width: number; height: number };\n}\n\n/** The `RunRowOptions` out of a look's options. */\nfunction runRowsOf(o: RunRowOptions): RunRowOptions {\n return {\n ...(o.showValues !== undefined ? { showValues: o.showValues } : {}),\n ...(o.showPreviews !== undefined ? { showPreviews: o.showPreviews } : {}),\n ...(o.previewSize !== undefined ? { previewSize: o.previewSize } : {}),\n };\n}\n\n/** The body rows of an ordinary stage: its title, a row of its ports when\n * `withPorts` (inputs left, outputs right), then for each of its\n * `shownPorts` its value row when `showValues` and its preview slot when\n * `showPreviews`, then its\n * params when `showParams`. */\nexport function stageRows(\n stage: EffectStage,\n opts: { showParams: boolean; withPorts: boolean } & RunRowOptions,\n): Row[] {\n const rows: Row[] = [{ kind: 'label', text: stage.title, style: { bold: true } }];\n const side = (ports: EffectStage['inputs']) => (ports ?? []).map((p) => ({ id: p.id, label: p.label ?? p.id, type: p.type }));\n if (opts.withPorts && ((stage.inputs?.length ?? 0) > 0 || (stage.outputs?.length ?? 0) > 0)) {\n rows.push({ kind: 'ports', left: side(stage.inputs), right: side(stage.outputs) });\n }\n const size = opts.previewSize ?? PREVIEW_SIZE;\n const preview = typeof size === 'number' ? { width: size, height: size } : size;\n // A repeated port id is a problem `checkPipeline` reports; one row for it.\n const seen = new Set<string>();\n for (const p of shownPorts(stage)) {\n if (seen.has(p.id)) continue;\n seen.add(p.id);\n if (opts.showValues === true) {\n rows.push({ kind: 'field', id: valueRowId(p.id), label: p.label ?? p.id, value: NO_VALUE, room: VALUE_ROOM });\n }\n if (opts.showPreviews === true) rows.push({ kind: 'slot', id: previewRowId(p.id), ...preview });\n }\n if (opts.showParams) for (const p of stage.params ?? []) rows.push({ kind: 'field', label: p.label, value: p.control ? formatParam(p.control) : p.value });\n return rows;\n}\n\n/** What a wire is called: its own label, or for a wire leaving a decision the\n * exit's label, which defaults to the exit's id. Any other wire has no name. */\nexport function exitLabel(d: DrawableWire): string | undefined {\n if (d.wire.label !== undefined) return d.wire.label;\n return kindOf(d.fromStage) === 'decision' ? portOn(d.fromStage, d.wire.from.port)?.label ?? d.wire.from.port : undefined;\n}\n\n/** The node the shipped looks draw for a stage that is not a decision: a box,\n * or a stadium for a source or a sink, holding `stageRows`. `ports` are its\n * perimeter ports; pass none when the rows carry them. */\nexport function boxNode(\n stage: EffectStage,\n opts: { showParams: boolean; rowPorts: boolean; ports: readonly PortSpec[]; run?: RunRowOptions },\n): DataNode {\n return {\n id: stage.id,\n outline: kindOf(stage) === 'stage' ? 'rect' : 'stadium',\n rows: stageRows(stage, { showParams: opts.showParams, withPorts: opts.rowPorts, ...runRowsOf(opts.run ?? {}) }),\n // Always set: left off, a stage port named n, e, s or w would share its id with a compass default.\n ports: opts.ports,\n };\n}\n\n/** One edge of a look's data, from port to port. */\nexport function wireEdge(\n from: EffectWire['from'],\n to: EffectWire['to'],\n label: string | undefined,\n id?: string,\n): DataEdge {\n return {\n ...(id !== undefined ? { id } : {}),\n from: from.stage, fromPort: from.port, to: to.stage, toPort: to.port,\n ...(label !== undefined ? { label } : {}),\n };\n}\n\n/** One edge per drawable wire, from port to port, named by `exitLabel` and\n * styled by `wireStyle` in its type's color. */\nexport function wireEdges(pipeline: EffectPipeline, color: TypeColor): { edge: DataEdge; style: EdgeStyle }[] {\n return drawableWires(pipeline).map((d) => ({\n edge: wireEdge(d.wire.from, d.wire.to, exitLabel(d), d.wire.id),\n style: wireStyle(color(d.type), isControl(pipeline, d.type), d.problem),\n }));\n}\n\n/** A look's `nodeStyle`, `edgeStyle`, and `theme`: `stageStyle` for each stage,\n * and for each edge the style paired with it. */\nexport function sceneStyles(\n stages: readonly EffectStage[],\n edges: readonly { edge: DataEdge; style: EdgeStyle }[],\n theme: DiagramTheme = LOOK_THEME,\n): Required<Pick<DiagramSceneOptions, 'nodeStyle' | 'edgeStyle' | 'theme'>> {\n const nodes = new Map(stages.map((s) => [s.id, stageStyle(s, theme)]));\n const wires = new Map(edges.map((e) => [edgeIdOf(e.edge), e.style]));\n return {\n theme,\n nodeStyle: (n) => nodes.get(n.id) ?? theme.roles[theme.defaultRole]!,\n edgeStyle: (e) => wires.get(edgeIdOf(e)) ?? wireStyle(UNTYPED, false, false),\n };\n}\n","import { uniqueStages } from '../draw';\nimport type { EffectPipeline } from '../types';\n\n/** The order a run evaluates stages in, and the stages it never can. */\nexport interface RunOrder {\n /** Every stage outside a cycle, each after every stage that feeds it. */\n order: string[];\n /** The stages on a cycle of wires, in stage order. */\n cyclic: string[];\n}\n\n/** The stages topologically over data and control wires alike, stable by\n * stage order: of the stages ready to go, the earliest goes first. A stage on\n * a cycle is left out, and so are its wires. */\nexport function runOrder(pipeline: EffectPipeline): RunOrder {\n const ids = uniqueStages(pipeline).map((s) => s.id);\n const index = new Map(ids.map((id, i) => [id, i]));\n const next = ids.map(() => [] as number[]);\n for (const w of pipeline.wires) {\n const a = index.get(w.from.stage);\n const b = index.get(w.to.stage);\n if (a !== undefined && b !== undefined) next[a]!.push(b);\n }\n const onCycle = cycleMembers(next);\n\n const waiting = ids.map(() => 0);\n for (let a = 0; a < ids.length; a++) {\n if (!onCycle[a]) for (const b of next[a]!) if (!onCycle[b]) waiting[b]!++;\n }\n const ready = new Set(ids.flatMap((_, i) => (!onCycle[i] && waiting[i] === 0 ? [i] : [])));\n const order: string[] = [];\n while (ready.size > 0) {\n const i = Math.min(...ready);\n ready.delete(i);\n order.push(ids[i]!);\n for (const b of next[i]!) if (!onCycle[b] && --waiting[b]! === 0) ready.add(b);\n }\n return { order, cyclic: ids.filter((_, i) => onCycle[i]) };\n}\n\n/** Whether each vertex is on a cycle: in a strongly connected component of\n * more than one vertex, or wired to itself. Tarjan's algorithm. */\nfunction cycleMembers(next: readonly (readonly number[])[]): boolean[] {\n const n = next.length;\n const low = new Array<number>(n).fill(-1);\n const seen = new Array<number>(n).fill(-1);\n const onStack = new Array<boolean>(n).fill(false);\n const result = new Array<boolean>(n).fill(false);\n const stack: number[] = [];\n let counter = 0;\n const visit = (v: number): void => {\n seen[v] = low[v] = counter++;\n stack.push(v);\n onStack[v] = true;\n for (const w of next[v]!) {\n if (seen[w] === -1) {\n visit(w);\n low[v] = Math.min(low[v]!, low[w]!);\n } else if (onStack[w]) {\n low[v] = Math.min(low[v]!, seen[w]!);\n }\n }\n if (low[v] !== seen[v]) return;\n const component: number[] = [];\n let w: number;\n do {\n w = stack.pop()!;\n onStack[w] = false;\n component.push(w);\n } while (w !== v);\n if (component.length > 1 || next[v]!.includes(v)) for (const c of component) result[c] = true;\n };\n for (let v = 0; v < n; v++) if (seen[v] === -1) visit(v);\n return result;\n}\n","import type { EffectStage } from '../types';\n\n/** A stage's params by id (label when it has none), each its control's value or its display value. */\nexport function paramValues(stage: EffectStage): Record<string, unknown> {\n return Object.fromEntries((stage.params ?? []).map((p) => [p.id ?? p.label, p.control?.value ?? p.value]));\n}\n","import type { EffectRun } from '../types';\n\nexport function previewsOf(run: EffectRun): ImageBitmap[] {\n return Object.values(run.stages).flatMap((s) => Object.values(s.previews ?? {}));\n}\n\nexport function closeBitmaps(bitmaps: readonly ImageBitmap[]): void {\n for (const b of new Set(bitmaps)) b.close();\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { grownBy, labelCenter, diagramEdgeOf, DIAGRAM_TRAIT_KEY, insetOf, subpathOf, portsOf, portSitesOf, routeHolds, rowHeights, sizeToBody, measureBody, layoutBody, layoutOwnsRoute, diagramNodeOf, expandGroupEdges, DEFAULT_GROUP_INSET, bodyTrait, authoredOver, chain, force, tree, layered, planOf, buildBody } from './chunk-FDCODMFW.js';
2
- import { bodyPredicate, AUTO_POSE_DESCRIPTOR, translatePoseViaDescriptor, createTransformOp, polylineFromPoints, PathBuilder, documentDepOf, documentPose, composeAffordanceLayer, ActionDisabledReason, pageName, pageOfBounds, layoutPages, RECT_POSE_DESCRIPTOR, resolveFill, resolveStroke, commandFill, commandStroke, transformPath, registerNodeShape, RIGID_POSE_COMPOSITION, localizeWorldPoses, pathFromD } from '@weasel-js/core';
1
+ import { grownBy, labelCenter, diagramEdgeOf, DIAGRAM_TRAIT_KEY, insetOf, subpathOf, portsOf, portSitesOf, routeHolds, rowHeights, sizeToBody, measureBody, layoutBody, layoutOwnsRoute, diagramNodeOf, expandGroupEdges, layoutWritesRoute, layoutOwnsPort, grid, radial, chain, force, tree, layered, planOf, DEFAULT_GROUP_INSET, bodyTrait, authoredOver, buildBody } from './chunk-7BV2MBED.js';
2
+ import { bodyPredicate, AUTO_POSE_DESCRIPTOR, translatePoseViaDescriptor, createTransformOp, polylineFromPoints, PathBuilder, documentDepOf, documentPose, composeAffordanceLayer, ActionDisabledReason, pageName, pageOfBounds, layoutPages, scenePoseAdapter, composeWorldPose, rebaseLocalPose, carriedDescendants, sceneCarrySource, RECT_POSE_DESCRIPTOR, resolveFill, resolveStroke, commandFill, commandStroke, transformPath, registerNodeShape, RIGID_POSE_COMPOSITION, localizeWorldPoses, pathFromD } from '@weasel-js/core';
3
3
  import { createSettledCache, createBvh } from '@weasel-js/geom/nd';
4
4
  import { worldCoords, PathBuilder as PathBuilder$1, polylineFromPoints as polylineFromPoints$1, portCurvePoints, PORT_REACH } from '@weasel-js/geom';
5
5
  import { AUTO_POSE_DESCRIPTOR as AUTO_POSE_DESCRIPTOR$1 } from '@weasel-js/core/math';
@@ -366,9 +366,9 @@ function labelIndexOf(scene) {
366
366
  }
367
367
  function labelsAt(scene, at) {
368
368
  const built = labelIndexOf(scene)();
369
- const near = built && boxesMeeting(built.boxes, at.x, at.y, at.x, at.y);
370
- if (!built || !near) return draggableLabels(scene);
371
- return near.map((i) => built.labels[i]);
369
+ const near2 = built && boxesMeeting(built.boxes, at.x, at.y, at.x, at.y);
370
+ if (!built || !near2) return draggableLabels(scene);
371
+ return near2.map((i) => built.labels[i]);
372
372
  }
373
373
  function labelUnder(scene, at) {
374
374
  let found = null;
@@ -415,10 +415,12 @@ function labelSize(text, style, measure) {
415
415
  const size = style.fontSize ?? LABEL_STYLE.fontSize;
416
416
  return { width: measure !== void 0 ? measure(text, style).width : text.length * size * GLYPH, height: size };
417
417
  }
418
+ var endLabelIdOf = (edgeId, end) => `${edgeId}/label:${end}`;
419
+ var END_LABEL_PLACEMENT = { at: "start", offset: 4, inset: 4 };
418
420
  function edgeLabelSpec(edgeId, text, opts) {
419
421
  const style = opts.style ?? LABEL_STYLE;
420
422
  return {
421
- id: `${edgeId}/label`,
423
+ id: opts.id ?? `${edgeId}/label`,
422
424
  kind: "mark",
423
425
  layer: opts.layer,
424
426
  pickable: false,
@@ -1140,15 +1142,15 @@ function regionSpecs(role, axis, pose, title, opts) {
1140
1142
  data: titleData(title, style, opts.fontFamily)
1141
1143
  }];
1142
1144
  }
1143
- function firstLanes(poolId, axis, at, opts) {
1145
+ function firstLanes(poolId, axis, at, opts, titles = Array.from({ length: NEW_POOL_LANES }, (_, i) => `Lane ${i + 1}`)) {
1144
1146
  const { header } = containerShape("pool", axis);
1145
- const size = Math.max(MIN_LANE_SIZE, (axis === "y" ? at.height : at.width) / NEW_POOL_LANES);
1147
+ const size = Math.max(MIN_LANE_SIZE, (axis === "y" ? at.height : at.width) / Math.max(1, titles.length));
1146
1148
  const out = [];
1147
- for (let i = 0; i < NEW_POOL_LANES; i++) {
1149
+ for (let i = 0; i < titles.length; i++) {
1148
1150
  const pose = axis === "y" ? { x: at.x + header.size, y: at.y + i * size, width: at.width - header.size, height: size } : { x: at.x + i * size, y: at.y + header.size, width: size, height: at.height - header.size };
1149
1151
  const bodies = opts.laneStyles?.bodies ?? [];
1150
1152
  const style = bodies.length > 0 ? bodies[i % bodies.length] : opts.style;
1151
- out.push(...regionSpecs("lane", axis, pose, `Lane ${i + 1}`, {
1153
+ out.push(...regionSpecs("lane", axis, pose, titles[i], {
1152
1154
  id: opts.newId(),
1153
1155
  layer: opts.layer,
1154
1156
  parent: poolId,
@@ -1436,6 +1438,164 @@ function rowTextStyle(row, font) {
1436
1438
  const face = textFace(row?.kind === "label" || row?.kind === "field" ? row.style : void 0, font);
1437
1439
  return row?.kind === "label" ? { ...face, align: "center" } : face;
1438
1440
  }
1441
+
1442
+ // src/routeWrites.ts
1443
+ var ROUTE_TOLERANCE = 1e-3;
1444
+ function routesOf(graph, plan) {
1445
+ return {
1446
+ edges: new Set(graph.edges.map((e) => e.origin?.id ?? e.id)),
1447
+ waypoints: plan.waypoints ?? /* @__PURE__ */ new Map(),
1448
+ ...plan.labels !== void 0 ? { labels: plan.labels } : {},
1449
+ ...plan.ports !== void 0 ? { ports: plan.ports } : {}
1450
+ };
1451
+ }
1452
+ function routeWrites(scene, routes) {
1453
+ const out = /* @__PURE__ */ new Map();
1454
+ const owned = /* @__PURE__ */ new Set();
1455
+ for (const id of routes.edges) {
1456
+ const node = scene.get(id);
1457
+ const edge = node === void 0 ? null : diagramEdgeOf(node);
1458
+ if (node === void 0 || edge === null || scene.isLocked(id)) {
1459
+ if (edge !== null && layoutWritesRoute(edge)) owned.add(id);
1460
+ continue;
1461
+ }
1462
+ let next = edge;
1463
+ if (layoutWritesRoute(edge)) {
1464
+ owned.add(id);
1465
+ next = rerouted(edge, routes.waypoints.get(id));
1466
+ }
1467
+ const ports = routes.ports?.get(id);
1468
+ const from = renamed(edge.from, ports?.from);
1469
+ const to = renamed(edge.to, ports?.to);
1470
+ if (from !== edge.from || to !== edge.to) next = { ...next, from, to };
1471
+ if (next !== edge) out.set(id, withTrait(node.data, next));
1472
+ }
1473
+ const stationed = /* @__PURE__ */ new Set();
1474
+ for (const node of scene.renderOrderNodes()) {
1475
+ const label = diagramLabelOf(node);
1476
+ const deps = node.dependsOn;
1477
+ if (label === null || !Array.isArray(deps) || deps.length !== 1 || !owned.has(deps[0])) continue;
1478
+ if (!labelFollowsLayout(label.at) || stationed.has(deps[0])) continue;
1479
+ stationed.add(deps[0]);
1480
+ const near2 = routes.labels?.get(deps[0]);
1481
+ const at = near2 === void 0 ? "mid" : { near: near2 };
1482
+ if (sameAt(label.at, at) || scene.isLocked(node.id)) continue;
1483
+ out.set(node.id, withTrait(node.data, { ...label, at }, "label"));
1484
+ }
1485
+ return out;
1486
+ }
1487
+ function rerouted(edge, route) {
1488
+ if (route === void 0 || route.length === 0) {
1489
+ if ((edge.waypoints ?? []).length === 0 && edge.laidOut === void 0) return edge;
1490
+ const { waypoints: _w, laidOut: _l, ...rest } = edge;
1491
+ return rest;
1492
+ }
1493
+ if (edge.waypoints !== void 0 && near(edge.waypoints, route)) return edge;
1494
+ return { ...edge, waypoints: route, laidOut: route };
1495
+ }
1496
+ function renamed(end, port) {
1497
+ if (!layoutOwnsPort(end) || end.port === port && (port === void 0 || end.laidOut === port)) return end;
1498
+ const { port: _p, laidOut: _l, ...rest } = end;
1499
+ return port === void 0 ? rest : { ...rest, port, laidOut: port };
1500
+ }
1501
+ function near(a, b) {
1502
+ return a.length === b.length && a.every((p, i) => Math.abs(p.x - b[i].x) <= ROUTE_TOLERANCE && Math.abs(p.y - b[i].y) <= ROUTE_TOLERANCE);
1503
+ }
1504
+ function sameAt(a, b) {
1505
+ if (typeof a === "object" && typeof b === "object") return near([a.near], [b.near]);
1506
+ return a === b;
1507
+ }
1508
+ function withTrait(data, value, key) {
1509
+ const own = data;
1510
+ const diagram = key === void 0 ? value : { ...own.diagram, [key]: value };
1511
+ return { ...own, diagram };
1512
+ }
1513
+ var LAYOUTS = Object.freeze({
1514
+ layered,
1515
+ tree,
1516
+ force,
1517
+ chain,
1518
+ radial,
1519
+ grid
1520
+ });
1521
+ function applyLayout(scene, result, opts = {}) {
1522
+ const poses = layoutPoses(scene, result, opts.geometry);
1523
+ const data = opts.routes === void 0 ? /* @__PURE__ */ new Map() : routeWrites(scene, opts.routes);
1524
+ if (poses.size === 0 && data.size === 0) return 0;
1525
+ const open = [...poses].filter(([id]) => !scene.isLocked(id));
1526
+ if (open.length === 0 && data.size === 0) return 0;
1527
+ scene.batch(opts.label ?? "Layout", () => {
1528
+ for (const [id, pose] of open) scene.setPose(id, pose);
1529
+ for (const [id, d] of data) scene.update(id, { data: d });
1530
+ });
1531
+ const wrote = new Set(open.map(([id]) => id));
1532
+ let moved = 0;
1533
+ for (const id of result.keys()) if (wrote.has(id)) moved++;
1534
+ return moved;
1535
+ }
1536
+ function layoutPoses(scene, result, geometry = AUTO_POSE_DESCRIPTOR) {
1537
+ const sc = scene;
1538
+ const { compose, decompose } = sc.composition;
1539
+ const stored = scenePoseAdapter(sc);
1540
+ const out = /* @__PURE__ */ new Map();
1541
+ const decided = { ...stored, getPose: (id) => out.has(id) ? out.get(id) : stored.getPose(id) };
1542
+ const depth = (id) => {
1543
+ let d = 0;
1544
+ for (let at = scene.get(id)?.parent; at != null; at = scene.get(at)?.parent) d++;
1545
+ return d;
1546
+ };
1547
+ const ids = [...result.keys()].filter((id) => scene.get(id) !== void 0).sort((a, b) => depth(a) - depth(b));
1548
+ for (const id of ids) {
1549
+ const at = result.get(id);
1550
+ const world = composeWorldPose(stored, id, compose);
1551
+ const bounds = geometry.getBounds(world);
1552
+ const dx = at.x - bounds.x;
1553
+ const dy = at.y - bounds.y;
1554
+ if (dx === 0 && dy === 0) continue;
1555
+ const parent = scene.get(id).parent;
1556
+ out.set(id, rebaseLocalPose(decided, translatePoseViaDescriptor(world, dx, dy, geometry), parent, compose, decompose));
1557
+ const carried = carriedDescendants(sceneCarrySource(sc), id, (w) => translatePoseViaDescriptor(w, dx, dy, geometry));
1558
+ for (const [d, pose] of carried) out.set(d, pose);
1559
+ }
1560
+ return out;
1561
+ }
1562
+ var LAYOUT_ACTION_ID = "diagram.layout";
1563
+ function layoutDiagram(scene, source, algorithm, opts = {}) {
1564
+ const fn = typeof algorithm === "function" ? algorithm : LAYOUTS[algorithm] ?? layered;
1565
+ const graph = buildGraph(source, {
1566
+ ...opts.read ? { read: opts.read } : {},
1567
+ ...opts.geometry ? { geometry: opts.geometry } : {}
1568
+ });
1569
+ const plan = planOf(fn, graph, opts.layout);
1570
+ return applyLayout(scene, plan.moves, {
1571
+ ...opts.geometry ? { geometry: opts.geometry } : {},
1572
+ ...opts.label ? { label: opts.label } : {},
1573
+ routes: routesOf(graph, plan)
1574
+ });
1575
+ }
1576
+ function createLayoutAction(opts) {
1577
+ const { read, geometry, layout, label } = opts;
1578
+ const options = {
1579
+ ...read ? { read } : {},
1580
+ ...geometry ? { geometry } : {},
1581
+ ...layout ? { layout } : {},
1582
+ ...label ? { label } : {}
1583
+ };
1584
+ return {
1585
+ id: opts.id ?? LAYOUT_ACTION_ID,
1586
+ label: opts.label ?? "Lay out diagram",
1587
+ group: opts.group ?? "diagram",
1588
+ requires: ["scene"],
1589
+ invoker: {
1590
+ timing: "immediate",
1591
+ run: (deps) => {
1592
+ const scene = deps["scene"];
1593
+ if (scene !== void 0) layoutDiagram(scene, opts.source, opts.algorithm ?? "layered", options);
1594
+ }
1595
+ },
1596
+ enabled: () => true
1597
+ };
1598
+ }
1439
1599
  function diagramMarkOf(node) {
1440
1600
  const data = node.data;
1441
1601
  if (data === null || typeof data !== "object") return null;
@@ -1957,14 +2117,15 @@ function edgeSpecs(edges, ctx) {
1957
2117
  dependsOn: [e.from, e.to],
1958
2118
  derivePath: EDGE_DERIVE_PATH
1959
2119
  });
2120
+ const look = { layer: "main", style: labelStyleOf(ctx.labelFont ?? ctx.font), fill: style.label ?? style.stroke, measure: ctx.measure };
2121
+ for (const end of ["from", "to"]) {
2122
+ const text = e.endLabels?.[end];
2123
+ if (!text) continue;
2124
+ const label = end === "from" ? END_LABEL_PLACEMENT : { ...END_LABEL_PLACEMENT, at: "end" };
2125
+ specs.push(edgeLabelSpec(id, text, { ...look, id: endLabelIdOf(id, end), label }));
2126
+ }
1960
2127
  if (!e.label) continue;
1961
- specs.push(edgeLabelSpec(id, e.label, {
1962
- layer: "main",
1963
- label: placementOf(e, route, ctx),
1964
- style: labelStyleOf(ctx.labelFont ?? ctx.font),
1965
- fill: style.label ?? style.stroke,
1966
- measure: ctx.measure
1967
- }));
2128
+ specs.push(edgeLabelSpec(id, e.label, { ...look, label: placementOf(e, route, ctx) }));
1968
2129
  }
1969
2130
  return specs;
1970
2131
  }
@@ -1974,7 +2135,6 @@ var SLOT_FRAME = "M0 0H1V1H0Z";
1974
2135
  var DEFAULT_GROUP_STYLE = { fill: "rgba(123, 167, 199, 0.08)", stroke: "#7ba7c7", text: "#9fbdd6", strokeWidth: 1, dash: [4, 3] };
1975
2136
  var LINE2 = 1.4;
1976
2137
  var MIN_WIDTH = 64;
1977
- var LAYOUTS = { layered, tree, force, chain };
1978
2138
  function labelRoomOf(e, opts, font, measure) {
1979
2139
  if (!e.label || e.waypoints !== void 0) return null;
1980
2140
  if (e.labelPlacement !== void 0 && !labelFollowsLayout(e.labelPlacement.at)) return null;
@@ -2010,7 +2170,7 @@ function nodeSpecs(n, body, box, look) {
2010
2170
  fill: { paint: { color: style.fill } },
2011
2171
  stroke: { paint: { color: style.stroke }, width: style.strokeWidth ?? NODE_STROKE_WIDTH, ...style.dash ? { dash: style.dash } : {} }
2012
2172
  }),
2013
- row: (text, at) => at.row.kind === "slot" ? at.row.id === void 0 ? null : { diagram: { mark: { d: SLOT_FRAME } }, stroke: { paint: { color: style.stroke }, width: 1 } } : text === "" ? null : { ...textData(text, at.row), bodyRow: at.index },
2173
+ row: (text, at) => at.row.kind === "slot" ? at.row.id === void 0 ? null : { diagram: { mark: { d: SLOT_FRAME } }, stroke: { paint: { color: style.stroke }, width: 1 } } : text === "" ? null : { ...textData(text, at.row), bodyRow: at.index, ...at.row.kind === "field" ? { bodyField: at.row.label } : {} },
2014
2174
  portLabel: (text) => textData(text, void 0)
2015
2175
  });
2016
2176
  return built.specs.map((s, k) => ({ ...s, ...s.id !== void 0 ? {} : { id: `${n.id}/${k}` } }));
@@ -2150,7 +2310,7 @@ function layOut(seeds, edges, groups, boxes, opts, room) {
2150
2310
  }];
2151
2311
  });
2152
2312
  const graph = graphOf(visible, expandGroupEdges(graphEdges, graphGroups), graphGroups);
2153
- const layout = typeof opts.layout === "function" ? opts.layout : opts.layout === "none" ? null : LAYOUTS[opts.layout ?? "layered"];
2313
+ const layout = typeof opts.layout === "function" ? opts.layout : opts.layout === "none" ? null : LAYOUTS[opts.layout ?? "layered"] ?? layered;
2154
2314
  const layoutOptions = { order: "barycenter", ...opts.layoutOptions };
2155
2315
  const plan = layout === null ? null : planOf(layout, graph, layoutOptions);
2156
2316
  const moved = plan?.moves ?? /* @__PURE__ */ new Map();
@@ -2161,6 +2321,6 @@ function layOut(seeds, edges, groups, boxes, opts, room) {
2161
2321
  return { placed, plan: layout?.plan === void 0 ? null : plan, remapped };
2162
2322
  }
2163
2323
 
2164
- export { ANCHOR_DERIVE_POSE, CONTAINER_HEADER, CONTAINER_LAYOUTS, DEFAULT_EDGE_STYLE, DEFAULT_FONT, DEFAULT_GROUP_STYLE, DEFAULT_LANE_SIZE, DEFAULT_NODE_STYLE, DEFAULT_POOL_ACROSS, DIAGRAM_ANCHOR, DIAGRAM_CONTAINER_LAYOUT, DIAGRAM_EDGE, DIAGRAM_GROUP, DIAGRAM_LABEL, DIAGRAM_LANE_COLUMNS_LAYOUT, DIAGRAM_LANE_ROWS_LAYOUT, DIAGRAM_OFF_PAGE_TAG, DIAGRAM_POOL_COLUMNS_LAYOUT, DIAGRAM_POOL_ROWS_LAYOUT, DIAGRAM_ROLES, DIAGRAM_THEMES, DIAGRAM_THEME_KEY, EDGE_DERIVE_PATH, EDGE_STROKE_WIDTH, EDIT_EDGE_LABEL_ACTION_ID, GROUP_DERIVE_POSE, LABEL_DERIVE_POSE, LABEL_DRAG_AFFORDANCE_KIND, LABEL_DRAG_LAYER_ID, LABEL_PLACEMENT, LANE_HEADER_SIZE, LANE_STROKE_WIDTH, MIN_LANE_SIZE, NODE_STROKE_WIDTH, OFF_PAGE_STUB, OFF_PAGE_TAG_DERIVE_POSE, OFF_PAGE_TAG_PADDING, POOL_HEADER_SIZE, ROUTERS, anchorDerivePose, avoid, bezier, bodyBox, bodyLayoutOf, boxAround, boxCenter, boxIndex, boxesMeeting, buildGraph, containerShape, dataEdgeStyle, dataNodeStyle, dataOffPage, dataRegionStyle, diagramAnchorOf, diagramContainerLayout, diagramContainerOf, diagramGroupOf, diagramLabelOf, diagramMarkOf, diagramPages, diagramScene, diagramThemeFrom, diagramThemeOf, draggableLabels, dropEmptyEdgeLabel, edgeDerivePath, edgeIdOf, edgeLabelSpec, edgeRouter, editEdgeLabelAction, editEdgeLabelBinding, editableLabels, endAims, firstLanes, groupDerivePose, groupLabelIdOf, groupMinWidth, headerBox, keyedIndex, labelDerivePose, labelDragLayer, labelFollowsLayout, labelScratchOf, labelSize, labelStyleOf, labelUnder, laneHeader, laneOutlineOf, laneStackLayout, markShape, nestGroups, nextOffPageRef, offPageFarText, offPageSplits, offPageTagData, offPageTagDerivePose, offPageTagId, offPageTagLook, offPageTagOf, offPageTagSize, offPageTagSpec, offPageTagSpecs, offPageTagText, orthogonal, poolHeader, recordedRows, regionSpecs, registerMarkShape, relayoutBodies, resolveEnd, roleEdgeStyle, roleStyle, routerOf, rowTextStyle, selfLoop, stackedLanes, straight, themeDocValue, themeEdgeStroke, themeFont, themeLabelFamily, themeLabelFont, themeLabelStyle, titleIdOf, titleInFrame, titlePose, withDiagramRegistry, withHops };
2165
- //# sourceMappingURL=chunk-DE7UILJA.js.map
2166
- //# sourceMappingURL=chunk-DE7UILJA.js.map
2324
+ export { ANCHOR_DERIVE_POSE, CONTAINER_HEADER, CONTAINER_LAYOUTS, DEFAULT_EDGE_STYLE, DEFAULT_FONT, DEFAULT_GROUP_STYLE, DEFAULT_LANE_SIZE, DEFAULT_NODE_STYLE, DEFAULT_POOL_ACROSS, DIAGRAM_ANCHOR, DIAGRAM_CONTAINER_LAYOUT, DIAGRAM_EDGE, DIAGRAM_GROUP, DIAGRAM_LABEL, DIAGRAM_LANE_COLUMNS_LAYOUT, DIAGRAM_LANE_ROWS_LAYOUT, DIAGRAM_OFF_PAGE_TAG, DIAGRAM_POOL_COLUMNS_LAYOUT, DIAGRAM_POOL_ROWS_LAYOUT, DIAGRAM_ROLES, DIAGRAM_THEMES, DIAGRAM_THEME_KEY, EDGE_DERIVE_PATH, EDGE_STROKE_WIDTH, EDIT_EDGE_LABEL_ACTION_ID, END_LABEL_PLACEMENT, GLYPH, GROUP_DERIVE_POSE, LABEL_DERIVE_POSE, LABEL_DRAG_AFFORDANCE_KIND, LABEL_DRAG_LAYER_ID, LABEL_PLACEMENT, LANE_HEADER_SIZE, LANE_STROKE_WIDTH, LAYOUTS, LAYOUT_ACTION_ID, MIN_LANE_SIZE, NODE_STROKE_WIDTH, OFF_PAGE_STUB, OFF_PAGE_TAG_DERIVE_POSE, OFF_PAGE_TAG_PADDING, POOL_HEADER_SIZE, ROUTERS, anchorDerivePose, applyLayout, avoid, bezier, bodyBox, bodyLayoutOf, boxAround, boxCenter, boxIndex, boxesMeeting, buildGraph, containerShape, createLayoutAction, dataEdgeStyle, dataNodeStyle, dataOffPage, dataRegionStyle, diagramAnchorOf, diagramContainerLayout, diagramContainerOf, diagramGroupOf, diagramLabelOf, diagramMarkOf, diagramPages, diagramScene, diagramThemeFrom, diagramThemeOf, draggableLabels, dropEmptyEdgeLabel, edgeDerivePath, edgeIdOf, edgeLabelSpec, edgeRouter, editEdgeLabelAction, editEdgeLabelBinding, editableLabels, endAims, endLabelIdOf, firstLanes, groupDerivePose, groupLabelIdOf, groupMinWidth, headerBox, keyedIndex, labelDerivePose, labelDragLayer, labelScratchOf, labelSize, labelStyleOf, labelUnder, laneHeader, laneOutlineOf, laneStackLayout, layoutDiagram, layoutPoses, markShape, nestGroups, nextOffPageRef, offPageFarText, offPageSplits, offPageTagData, offPageTagDerivePose, offPageTagId, offPageTagLook, offPageTagOf, offPageTagSize, offPageTagSpec, offPageTagSpecs, offPageTagText, orthogonal, poolHeader, recordedRows, regionSpecs, registerMarkShape, relayoutBodies, resolveEnd, roleEdgeStyle, roleStyle, routeWrites, routerOf, routesOf, rowTextStyle, selfLoop, stackedLanes, straight, themeDocValue, themeEdgeStroke, themeFont, themeLabelFamily, themeLabelFont, themeLabelStyle, titleIdOf, titleInFrame, titlePose, withColors, withDiagramRegistry, withHops };
2325
+ //# sourceMappingURL=chunk-QGL6QJE4.js.map
2326
+ //# sourceMappingURL=chunk-QGL6QJE4.js.map