@weasel-js/diagram 1.11.1 → 1.12.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/dist/{chunk-43LDZ6L4.js → chunk-2SYY4W3B.js} +18 -16
- package/dist/chunk-2SYY4W3B.js.map +1 -0
- package/dist/{chunk-QKSWZEJH.js → chunk-5GIP2LA6.js} +3 -3
- package/dist/{chunk-QKSWZEJH.js.map → chunk-5GIP2LA6.js.map} +1 -1
- package/dist/{chunk-CI3I3I6T.js → chunk-DYDX6EJC.js} +144 -91
- package/dist/chunk-DYDX6EJC.js.map +1 -0
- package/dist/{chunk-T6DQT553.js → chunk-GA4BX7SH.js} +3 -3
- package/dist/{chunk-T6DQT553.js.map → chunk-GA4BX7SH.js.map} +1 -1
- package/dist/{chunk-IM6DHWZO.js → chunk-R2XB6D32.js} +45 -20
- package/dist/chunk-R2XB6D32.js.map +1 -0
- package/dist/{dataTypes-B-iEwKZp.d.ts → dataTypes-DHdkzCL8.d.ts} +11 -6
- package/dist/effect-audio.d.ts +2 -1
- package/dist/effect-audio.js +12 -6
- package/dist/effect-audio.js.map +1 -1
- package/dist/effect.d.ts +2 -2
- package/dist/effect.js +40 -14
- package/dist/effect.js.map +1 -1
- package/dist/index.d.ts +24 -18
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +2 -2
- package/dist/{layout.entry-CH9gc0CY.d.ts → layout.entry-B-jJMc50.d.ts} +108 -3
- package/dist/layout.js +2 -2
- package/dist/{types-BbHunLXm.d.ts → types-M_ccNAlk.d.ts} +151 -252
- package/package.json +9 -9
- package/dist/chunk-43LDZ6L4.js.map +0 -1
- package/dist/chunk-CI3I3I6T.js.map +0 -1
- package/dist/chunk-IM6DHWZO.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DIAGRAM_THEMES, edgeIdOf } from './chunk-
|
|
1
|
+
import { DIAGRAM_THEMES, edgeIdOf } from './chunk-2SYY4W3B.js';
|
|
2
2
|
|
|
3
3
|
// src/effect/check.ts
|
|
4
4
|
function splitProblem(stage) {
|
|
@@ -308,5 +308,5 @@ function closeBitmaps(bitmaps) {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
export { LOOK_THEME, NO_VALUE, PREVIEW_DENSITY, PREVIEW_SIZE, PROBLEM_COLOR, boxNode, checkPipeline, closeBitmaps, drawableWires, exitLabel, formatParam, isControl, kindOf, paramValues, portOn, previewRowId, previewsOf, runOrder, sceneStyles, shownPorts, splitProblem, stageFromType, stageRows, stageStyle, typeColors, uniqueGroups, uniqueStages, valueRowId, wireEdge, wireEdges, wireStyle };
|
|
311
|
-
//# sourceMappingURL=chunk-
|
|
312
|
-
//# sourceMappingURL=chunk-
|
|
311
|
+
//# sourceMappingURL=chunk-5GIP2LA6.js.map
|
|
312
|
+
//# sourceMappingURL=chunk-5GIP2LA6.js.map
|
|
@@ -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,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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-QKSWZEJH.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,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,EAAsB,KAAA,CAAM,EAAA,CAAG,SAAS,CAAC,CAAA,CAAA;AAC3H,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,cAAc,QAAA,EAA2C;AACvE,EAAA,MAAM,MAAuB,EAAC;AAC9B,EAAA,MAAM,MA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AAA,OAAA,CAAQ,CAAC,CAAA,GAAI,KAAA;AACb,MAAA,SAAA,CAAU,KAAK,CAAC,CAAA;AAAA,IAClB,SAAS,CAAA,KAAM,CAAA;AACf,IAAA,IAAI,SAAA,CAAU,MAAA,GAAS,CAAA,IAAK,IAAA,CAAK,CAAC,CAAA,CAAG,QAAA,CAAS,CAAC,CAAA,EAAG,KAAA,MAAW,CAAA,IAAK,SAAA,EAAW,MAAA,CAAO,CAAC,CAAA,GAAI,IAAA;AAAA,EAC3F,CAAA;AACA,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,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-5GIP2LA6.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,9 +1,9 @@
|
|
|
1
|
-
import { createAvoidRouter, placeLabels, edgeHops, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, simplifyStops } from './chunk-
|
|
2
|
-
import { edgeRouter, registerMarkShape, withDiagramRegistry,
|
|
3
|
-
import { diagramEdgeOf, isPromise, dataKeyReader, diagramNodeOf, portsOf, portSitesOf, outlinePath, samePoints, layoutWritesRoute, plannerPlan, planOf, layered, forceRelaxation, center, layoutOwnsPort, chain, force, tree, portOf, labelCenter, labelSpotAt, isPinned, layoutOwnsRoute } from './chunk-
|
|
4
|
-
import { bodyPredicate, dragPanContribution, WeaselProvider, useScene, useSelection, useLatest, SceneCanvas, useDepSource,
|
|
1
|
+
import { createAvoidRouter, placeLabels, edgeHops, DEFAULT_HOP_SIZE, HOPS_DOC_KEY, simplifyStops } from './chunk-GA4BX7SH.js';
|
|
2
|
+
import { edgeRouter, registerMarkShape, withDiagramRegistry, diagramLabelOf, editEdgeLabelBinding, editEdgeLabelAction, diagramGroupOf, diagramContainerOf, headerBox, labelFollowsLayout, buildGraph, LABEL_DRAG_AFFORDANCE_KIND, EDIT_EDGE_LABEL_ACTION_ID, labelDragLayer, laneOutlineOf, routerOf, labelScratchOf, ROUTERS, avoid, LABEL_PLACEMENT, editableLabels, titleIdOf, orthogonal, diagramAnchorOf, MIN_LANE_SIZE, endAims, resolveEnd, EDGE_DERIVE_PATH, titlePose, regionSpecs, DIAGRAM_THEME_KEY, diagramThemeOf, boxCenter, themeLabelFamily, roleEdgeStyle, roleStyle, themeLabelFont, firstLanes, DEFAULT_LANE_SIZE, bodyBox } from './chunk-2SYY4W3B.js';
|
|
3
|
+
import { diagramEdgeOf, isPromise, dataKeyReader, diagramNodeOf, portsOf, portSitesOf, outlinePath, samePoints, layoutWritesRoute, plannerPlan, planOf, layered, forceRelaxation, center, layoutOwnsPort, chain, force, tree, portOf, labelCenter, labelSpotAt, isPinned, layoutOwnsRoute } from './chunk-R2XB6D32.js';
|
|
4
|
+
import { bodyPredicate, dragPanContribution, WeaselProvider, useScene, useSelection, useLatest, SceneCanvas, useDepSource, registerNodeShape, reconcileSpecs, nodeGates, effectivePose, pagesBounds, pagesLayer, AUTO_POSE_DESCRIPTOR, usePoseRun, drawnBoundsScene, pointAlongPath, drawnAABBOf, RECT_POSE_DESCRIPTOR, resolveFill, resolveStroke, commandFill, commandStroke, fitViewToBounds, translatePoseViaDescriptor, composeAffordanceLayer, createResizeAction, createDeleteAction, polylineFromPoints, SNAP_ROLES, ActionDisabledReason, paintsLayer, viewToTransform, ellipsePath, snapMods, documentDepOf, carriedDescendants, sceneCarrySource, derivedDepOf, PathBuilder, createInsertOp, createSetDataOp, documentPose } from '@weasel-js/core';
|
|
5
5
|
import { AUTO_POSE_DESCRIPTOR as AUTO_POSE_DESCRIPTOR$1, rotatePoint } from '@weasel-js/core/math';
|
|
6
|
-
import { placeRect, pathContainsPoint } from '@weasel-js/geom';
|
|
6
|
+
import { clampRectWithin, placeRect, pathContainsPoint } from '@weasel-js/geom';
|
|
7
7
|
import { useLatest as useLatest$1, adoptCssOnce } from '@weasel-js/react';
|
|
8
8
|
import { forwardRef, useMemo, useEffect, useState, useRef, useCallback, useImperativeHandle, useLayoutEffect } from 'react';
|
|
9
9
|
import '@weasel-js/animator';
|
|
@@ -181,7 +181,8 @@ var DEFAULT_ROUTER = "straight";
|
|
|
181
181
|
function connectBinding(actionId = CONNECT_ACTION_ID) {
|
|
182
182
|
return {
|
|
183
183
|
spec: { kind: "drag", target: `affordance:${PORT_AFFORDANCE_KIND}` },
|
|
184
|
-
actionId
|
|
184
|
+
actionId,
|
|
185
|
+
opts: { id: `${actionId}.drag` }
|
|
185
186
|
};
|
|
186
187
|
}
|
|
187
188
|
var GRAB_PORT_ACTION_ID = "diagram.grabPort";
|
|
@@ -197,8 +198,8 @@ function grabPortAction(id = GRAB_PORT_ACTION_ID) {
|
|
|
197
198
|
}
|
|
198
199
|
function grabPortBindings(actionId = GRAB_PORT_ACTION_ID, kind = PORT_AFFORDANCE_KIND) {
|
|
199
200
|
return [
|
|
200
|
-
{ spec: { kind: "pointerDown", target: `affordance:${kind}` }, actionId },
|
|
201
|
-
{ spec: { kind: "click", target: `affordance:${kind}` }, actionId }
|
|
201
|
+
{ spec: { kind: "pointerDown", target: `affordance:${kind}` }, actionId, opts: { id: `${actionId}.pointerDown` } },
|
|
202
|
+
{ spec: { kind: "click", target: `affordance:${kind}` }, actionId, opts: { id: `${actionId}.click` } }
|
|
202
203
|
];
|
|
203
204
|
}
|
|
204
205
|
function commitEdgeToScene(edge, ctx, opts = {}) {
|
|
@@ -772,8 +773,8 @@ function diagramContainers(opts) {
|
|
|
772
773
|
grabPortAction(GRAB_LANE_ACTION_ID)
|
|
773
774
|
],
|
|
774
775
|
bindings: [
|
|
775
|
-
{ spec: { kind: "drag", target }, actionId: LANE_RESIZE_ACTION_ID },
|
|
776
|
-
{ spec: { kind: "click", target }, actionId: ADD_LANE_ACTION_ID },
|
|
776
|
+
{ spec: { kind: "drag", target }, actionId: LANE_RESIZE_ACTION_ID, opts: { id: "weasel-diagram-containers.drag" } },
|
|
777
|
+
{ spec: { kind: "click", target }, actionId: ADD_LANE_ACTION_ID, opts: { id: "weasel-diagram-containers.click" } },
|
|
777
778
|
...grabPortBindings(GRAB_LANE_ACTION_ID, LANE_AFFORDANCE_KIND).filter((b) => b.spec.kind !== "click")
|
|
778
779
|
]
|
|
779
780
|
}
|
|
@@ -811,7 +812,11 @@ function editContainerTitleAction(commit) {
|
|
|
811
812
|
}
|
|
812
813
|
var onBody = bodyPredicate((target) => target === "selected-body" || target === "unselected-body");
|
|
813
814
|
function editContainerTitleBinding() {
|
|
814
|
-
return {
|
|
815
|
+
return {
|
|
816
|
+
spec: { kind: "doubleClick", target: { kindOf: onBody } },
|
|
817
|
+
actionId: EDIT_CONTAINER_TITLE_ACTION_ID,
|
|
818
|
+
opts: { id: `${EDIT_CONTAINER_TITLE_ACTION_ID}.doubleClick` }
|
|
819
|
+
};
|
|
815
820
|
}
|
|
816
821
|
|
|
817
822
|
// src/hops/hopsAction.ts
|
|
@@ -1573,8 +1578,8 @@ function diagramWaypoints(opts) {
|
|
|
1573
1578
|
grabPortAction(GRAB_WAYPOINT_ACTION_ID)
|
|
1574
1579
|
],
|
|
1575
1580
|
bindings: [
|
|
1576
|
-
{ spec: { kind: "drag", target }, actionId },
|
|
1577
|
-
{ spec: { kind: "doubleClick", target }, actionId: REMOVE_WAYPOINT_ACTION_ID },
|
|
1581
|
+
{ spec: { kind: "drag", target }, actionId, opts: { id: "weasel-diagram-waypoints.drag" } },
|
|
1582
|
+
{ spec: { kind: "doubleClick", target }, actionId: REMOVE_WAYPOINT_ACTION_ID, opts: { id: "weasel-diagram-waypoints.doubleClick" } },
|
|
1578
1583
|
...grabPortBindings(GRAB_WAYPOINT_ACTION_ID, WAYPOINT_AFFORDANCE_KIND)
|
|
1579
1584
|
]
|
|
1580
1585
|
}
|
|
@@ -1616,10 +1621,10 @@ function diagramLabelDrag(opts) {
|
|
|
1616
1621
|
selectLabelEdgeAction()
|
|
1617
1622
|
],
|
|
1618
1623
|
bindings: [
|
|
1619
|
-
{ spec: { kind: "drag", target }, actionId },
|
|
1620
|
-
{ spec: { kind: "pointerDown", target }, actionId: GRAB_LABEL_ACTION_ID },
|
|
1621
|
-
{ spec: { kind: "click", target, mods: ANY_MODIFIERS }, actionId: SELECT_LABEL_EDGE_ACTION_ID },
|
|
1622
|
-
{ spec: { kind: "doubleClick", target }, actionId: EDIT_EDGE_LABEL_ACTION_ID }
|
|
1624
|
+
{ spec: { kind: "drag", target }, actionId, opts: { id: "weasel-diagram-label-drag.drag" } },
|
|
1625
|
+
{ spec: { kind: "pointerDown", target }, actionId: GRAB_LABEL_ACTION_ID, opts: { id: "weasel-diagram-label-drag.pointerDown" } },
|
|
1626
|
+
{ spec: { kind: "click", target, mods: ANY_MODIFIERS }, actionId: SELECT_LABEL_EDGE_ACTION_ID, opts: { id: "weasel-diagram-label-drag.click" } },
|
|
1627
|
+
{ spec: { kind: "doubleClick", target }, actionId: EDIT_EDGE_LABEL_ACTION_ID, opts: { id: "weasel-diagram-label-drag.doubleClick" } }
|
|
1623
1628
|
]
|
|
1624
1629
|
}
|
|
1625
1630
|
};
|
|
@@ -1957,7 +1962,7 @@ function createReconnectAction(opts) {
|
|
|
1957
1962
|
};
|
|
1958
1963
|
}
|
|
1959
1964
|
function reconnectBinding(actionId = RECONNECT_ACTION_ID) {
|
|
1960
|
-
return { spec: { kind: "drag", target: `affordance:${EDGE_END_AFFORDANCE_KIND}` }, actionId };
|
|
1965
|
+
return { spec: { kind: "drag", target: `affordance:${EDGE_END_AFFORDANCE_KIND}` }, actionId, opts: { id: `${actionId}.drag` } };
|
|
1961
1966
|
}
|
|
1962
1967
|
function diagramEdgeEnds(opts) {
|
|
1963
1968
|
const actionId = opts.id ?? RECONNECT_ACTION_ID;
|
|
@@ -2150,7 +2155,7 @@ function createReorderAction(opts) {
|
|
|
2150
2155
|
}
|
|
2151
2156
|
var ANYWHERE = bodyPredicate(() => true);
|
|
2152
2157
|
function reorderBinding(actionId = REORDER_ACTION_ID, on = ANYWHERE) {
|
|
2153
|
-
return { spec: { kind: "drag", target: { kindOf: on } }, actionId };
|
|
2158
|
+
return { spec: { kind: "drag", target: { kindOf: on } }, actionId, opts: { id: on === ANYWHERE ? `${actionId}.drag` : `${actionId}.bodyDrag` } };
|
|
2154
2159
|
}
|
|
2155
2160
|
function reorderContribution(opts) {
|
|
2156
2161
|
const actionId = opts.id ?? REORDER_ACTION_ID;
|
|
@@ -2179,16 +2184,10 @@ function screenRectOf(rect, view) {
|
|
|
2179
2184
|
};
|
|
2180
2185
|
}
|
|
2181
2186
|
var CENTER = "center";
|
|
2182
|
-
function place(el, overlay, anchor,
|
|
2187
|
+
function place(el, overlay, anchor, view) {
|
|
2183
2188
|
const size = { width: el.offsetWidth, height: el.offsetHeight };
|
|
2184
2189
|
const placement = overlay.placement ?? CENTER;
|
|
2185
|
-
const at = placement === CENTER ? { x: anchor.x + (anchor.width - size.width) / 2, y: anchor.y + (anchor.height - size.height) / 2 } : placeRect({
|
|
2186
|
-
anchor,
|
|
2187
|
-
overlay: size,
|
|
2188
|
-
boundary: { x: 0, y: 0, width, height },
|
|
2189
|
-
placement,
|
|
2190
|
-
offset: overlay.offset ?? 0
|
|
2191
|
-
}).rect;
|
|
2190
|
+
const at = placement === CENTER ? { x: anchor.x + (anchor.width - size.width) / 2, y: anchor.y + (anchor.height - size.height) / 2 } : clampRectWithin(placeRect({ anchor, overlay: size, boundary: view, placement, offset: overlay.offset ?? 0 }).rect, view);
|
|
2192
2191
|
el.style.transform = `translate(${Math.round(at.x)}px, ${Math.round(at.y)}px)`;
|
|
2193
2192
|
}
|
|
2194
2193
|
function useOverlayPlacement(canvasRef, scene, overlays) {
|
|
@@ -2207,7 +2206,12 @@ function useOverlayPlacement(canvasRef, scene, overlays) {
|
|
|
2207
2206
|
if (world === null) continue;
|
|
2208
2207
|
const rect = screenRectOf(world, view);
|
|
2209
2208
|
const anchor = { ...rect, x: rect.x + surface.offsetLeft, y: rect.y + surface.offsetTop };
|
|
2210
|
-
place(el, overlay, anchor,
|
|
2209
|
+
place(el, overlay, anchor, {
|
|
2210
|
+
x: surface.offsetLeft,
|
|
2211
|
+
y: surface.offsetTop,
|
|
2212
|
+
width: surface.offsetWidth,
|
|
2213
|
+
height: surface.offsetHeight
|
|
2214
|
+
});
|
|
2211
2215
|
}
|
|
2212
2216
|
}, [canvasRef, scene, current]);
|
|
2213
2217
|
useLayoutEffect(() => {
|
|
@@ -2309,10 +2313,10 @@ function groupReorderSlots(deps, at) {
|
|
|
2309
2313
|
})));
|
|
2310
2314
|
}
|
|
2311
2315
|
var STEPS = [
|
|
2312
|
-
{ key: "ArrowUp", axis: "y", step: -1 },
|
|
2313
|
-
{ key: "ArrowDown", axis: "y", step: 1 },
|
|
2314
|
-
{ key: "ArrowLeft", axis: "x", step: -1 },
|
|
2315
|
-
{ key: "ArrowRight", axis: "x", step: 1 }
|
|
2316
|
+
{ key: "ArrowUp", role: "up", axis: "y", step: -1 },
|
|
2317
|
+
{ key: "ArrowDown", role: "down", axis: "y", step: 1 },
|
|
2318
|
+
{ key: "ArrowLeft", role: "left", axis: "x", step: -1 },
|
|
2319
|
+
{ key: "ArrowRight", role: "right", axis: "x", step: 1 }
|
|
2316
2320
|
];
|
|
2317
2321
|
function createStepReorderAction(report) {
|
|
2318
2322
|
const selectedTarget = (deps) => targetAt(deps, deps?.selection?.get()[0]);
|
|
@@ -2320,9 +2324,9 @@ function createStepReorderAction(report) {
|
|
|
2320
2324
|
id: STEP_REORDER_ACTION_ID,
|
|
2321
2325
|
label: "Move along",
|
|
2322
2326
|
group: "diagram",
|
|
2323
|
-
defaultBinding: STEPS.map(({ key, axis, step }) => ({
|
|
2327
|
+
defaultBinding: STEPS.map(({ key, role, axis, step }) => ({
|
|
2324
2328
|
spec: { kind: "key", key, mods: { alt: true } },
|
|
2325
|
-
opts: { params: { axis, step } }
|
|
2329
|
+
opts: { id: `${STEP_REORDER_ACTION_ID}.${role}`, params: { axis, step } }
|
|
2326
2330
|
})),
|
|
2327
2331
|
requires: ["scene", "selection"],
|
|
2328
2332
|
invoker: {
|
|
@@ -2967,13 +2971,13 @@ function diagramShape(opts = {}) {
|
|
|
2967
2971
|
return {
|
|
2968
2972
|
id: opts.id ?? "diagram:outline",
|
|
2969
2973
|
matches: (node) => outlineOf(node) !== void 0,
|
|
2970
|
-
paint: (node, pose) => {
|
|
2974
|
+
paint: (node, pose, ctx) => {
|
|
2971
2975
|
const outline = outlineOf(node);
|
|
2972
2976
|
if (outline === void 0) return [];
|
|
2973
2977
|
const d = node.data;
|
|
2974
2978
|
const box = geometry.getBounds(pose);
|
|
2975
|
-
const declaredFill = d.fill
|
|
2976
|
-
const declaredStroke = d.stroke
|
|
2979
|
+
const declaredFill = resolveFill(d.fill, ctx?.inherited?.fill);
|
|
2980
|
+
const declaredStroke = resolveStroke(d.stroke, ctx?.inherited?.stroke);
|
|
2977
2981
|
const fill = declaredFill && commandFill(declaredFill, box);
|
|
2978
2982
|
const stroke = declaredStroke && commandStroke(declaredStroke, box);
|
|
2979
2983
|
const header = headerBox(box, diagramContainerOf(node)?.header);
|
|
@@ -3357,12 +3361,94 @@ function usePagesView(pages) {
|
|
|
3357
3361
|
};
|
|
3358
3362
|
}, [placed, fill]);
|
|
3359
3363
|
}
|
|
3364
|
+
function diagramBounds(specs, extra) {
|
|
3365
|
+
const boxes = specs.filter((s) => s.kind === "container" || diagramGroupOf(s) !== null).map((s) => s.pose);
|
|
3366
|
+
if (extra !== void 0) boxes.push(extra);
|
|
3367
|
+
if (boxes.length === 0) return null;
|
|
3368
|
+
const x = Math.min(...boxes.map((b) => b.x));
|
|
3369
|
+
const y = Math.min(...boxes.map((b) => b.y));
|
|
3370
|
+
return {
|
|
3371
|
+
x,
|
|
3372
|
+
y,
|
|
3373
|
+
width: Math.max(...boxes.map((b) => b.x + b.width)) - x,
|
|
3374
|
+
height: Math.max(...boxes.map((b) => b.y + b.height)) - y
|
|
3375
|
+
};
|
|
3376
|
+
}
|
|
3377
|
+
function fitDiagram(specs, size, fit = {}, extra) {
|
|
3378
|
+
const bounds = diagramBounds(specs, extra);
|
|
3379
|
+
if (bounds === null) return void 0;
|
|
3380
|
+
return fitViewToBounds(bounds, size, { x: 0, y: 0, scale: { x: 1, y: 1 } }, {
|
|
3381
|
+
maxScale: fit.maxScale ?? 1,
|
|
3382
|
+
...fit.minScale !== void 0 ? { minScale: fit.minScale } : {},
|
|
3383
|
+
...fit.anchor !== void 0 ? { anchor: fit.anchor } : {},
|
|
3384
|
+
...fit.padding !== void 0 ? { padding: fit.padding } : {}
|
|
3385
|
+
});
|
|
3386
|
+
}
|
|
3387
|
+
var IDENTITY = { x: 0, y: 0, scale: { x: 1, y: 1 } };
|
|
3388
|
+
var sameView = (a, b) => a.x === b.x && a.y === b.y && a.scale.x === b.scale.x && a.scale.y === b.scale.y;
|
|
3389
|
+
function inView(inner, view, size) {
|
|
3390
|
+
const x1 = view.x + size.width / view.scale.x;
|
|
3391
|
+
const y1 = view.y + size.height / view.scale.y;
|
|
3392
|
+
return inner.x >= view.x && inner.y >= view.y && inner.x + inner.width <= x1 && inner.y + inner.height <= y1;
|
|
3393
|
+
}
|
|
3394
|
+
function useDiagramFit(args) {
|
|
3395
|
+
const { canvasRef, specs, controlled, size, fit, extra } = args;
|
|
3396
|
+
const unsized = size.width === 0 || size.height === 0;
|
|
3397
|
+
const defaultView = useMemo(
|
|
3398
|
+
() => controlled || unsized ? void 0 : fitDiagram(specs, size, fit, extra),
|
|
3399
|
+
// A later `specs` is the overflow check's to answer.
|
|
3400
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3401
|
+
[controlled, unsized, size.width, size.height, fit.minScale, fit.maxScale, fit.anchor, fit.padding, extra]
|
|
3402
|
+
);
|
|
3403
|
+
const [later, setLater] = useState(null);
|
|
3404
|
+
const target = later !== null && later.over === defaultView ? later.view : defaultView;
|
|
3405
|
+
const fitted = useRef(target);
|
|
3406
|
+
const opts = useLatest({ controlled, unsized, size, fit, extra, defaultView, current: args.current });
|
|
3407
|
+
useEffect(() => {
|
|
3408
|
+
const canvas = canvasRef.current;
|
|
3409
|
+
const was = fitted.current;
|
|
3410
|
+
if (canvas === null || target === void 0 || was === target) return;
|
|
3411
|
+
if (!sameView(canvas.getView(), was ?? IDENTITY)) return;
|
|
3412
|
+
fitted.current = target;
|
|
3413
|
+
canvas.setView(target);
|
|
3414
|
+
}, [canvasRef, target]);
|
|
3415
|
+
const first = useRef(true);
|
|
3416
|
+
useEffect(() => {
|
|
3417
|
+
if (first.current) {
|
|
3418
|
+
first.current = false;
|
|
3419
|
+
return;
|
|
3420
|
+
}
|
|
3421
|
+
const { controlled: c, unsized: u, size: box, fit: f, extra: more, defaultView: over } = opts.current;
|
|
3422
|
+
const canvas = canvasRef.current;
|
|
3423
|
+
const bounds = diagramBounds(specs, more);
|
|
3424
|
+
if (c || u || canvas === null || bounds === null || inView(bounds, canvas.getView(), box)) return;
|
|
3425
|
+
setLater({ view: fitDiagram(specs, box, f, more), over });
|
|
3426
|
+
}, [specs, canvasRef, opts]);
|
|
3427
|
+
return useMemo(() => {
|
|
3428
|
+
const now = () => {
|
|
3429
|
+
const { size: box, fit: f, extra: more, current } = opts.current;
|
|
3430
|
+
return fitDiagram(current(), box, f, more);
|
|
3431
|
+
};
|
|
3432
|
+
return {
|
|
3433
|
+
defaultView,
|
|
3434
|
+
settle: () => {
|
|
3435
|
+
if (opts.current.controlled) return;
|
|
3436
|
+
setLater({ view: now(), over: opts.current.defaultView });
|
|
3437
|
+
},
|
|
3438
|
+
fitNow: () => {
|
|
3439
|
+
const canvas = canvasRef.current;
|
|
3440
|
+
const view = now();
|
|
3441
|
+
if (canvas === null || view === void 0) return;
|
|
3442
|
+
fitted.current = view;
|
|
3443
|
+
canvas.setView(view);
|
|
3444
|
+
}
|
|
3445
|
+
};
|
|
3446
|
+
}, [defaultView, canvasRef, opts]);
|
|
3447
|
+
}
|
|
3360
3448
|
var VIEW_RULE = ':where([data-wzl-diagram]) { position: relative; width: fit-content; } :where([data-wzl-diagram~="fill-x"]) { width: 100%; } :where([data-wzl-diagram~="fill-y"]) { height: 100%; } :where([data-wzl-diagram]) > canvas { display: block; } :where([data-wzl-diagram-overlay]) { position: absolute; left: 0; top: 0; } :where([data-wzl-diagram-overlay][hidden]) { display: none; }';
|
|
3361
3449
|
var adoptViewRule = (el) => {
|
|
3362
3450
|
if (el !== null) adoptCssOnce(el, VIEW_RULE);
|
|
3363
3451
|
};
|
|
3364
|
-
var IDENTITY = { x: 0, y: 0, scale: { x: 1, y: 1 } };
|
|
3365
|
-
var sameView = (a, b) => a.x === b.x && a.y === b.y && a.scale.x === b.scale.x && a.scale.y === b.scale.y;
|
|
3366
3452
|
var DiagramView = forwardRef(function DiagramView2(props, ref) {
|
|
3367
3453
|
return /* @__PURE__ */ jsx(WeaselProvider, { children: /* @__PURE__ */ jsx(Inner, { ...props, apiRef: ref }) });
|
|
3368
3454
|
});
|
|
@@ -3433,24 +3519,22 @@ function Inner({
|
|
|
3433
3519
|
const controlled = view !== void 0;
|
|
3434
3520
|
const fills = width === void 0 || height === void 0;
|
|
3435
3521
|
const [measured, setMeasured] = useState(null);
|
|
3436
|
-
const boxWidth = width ?? measured?.width ?? 0;
|
|
3437
|
-
const boxHeight = height ?? measured?.height ?? 0;
|
|
3438
|
-
const unsized = boxWidth === 0 || boxHeight === 0;
|
|
3439
|
-
const fitOpts = { minScale, maxScale, anchor, padding: fitPadding };
|
|
3440
3522
|
const { layers, box: pagesBox } = usePagesView(pages);
|
|
3441
|
-
const
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3523
|
+
const canvasRef = useRef(null);
|
|
3524
|
+
const current = useCallback(() => Array.from(source(), ({ node, pose }) => ({ ...node, pose })), [source]);
|
|
3525
|
+
const fitting = useDiagramFit({
|
|
3526
|
+
canvasRef,
|
|
3527
|
+
specs,
|
|
3528
|
+
current,
|
|
3529
|
+
controlled,
|
|
3530
|
+
size: { width: width ?? measured?.width ?? 0, height: height ?? measured?.height ?? 0 },
|
|
3531
|
+
fit: { minScale, maxScale, anchor, padding: fitPadding },
|
|
3532
|
+
extra: pagesBox
|
|
3533
|
+
});
|
|
3534
|
+
const { defaultView } = fitting;
|
|
3449
3535
|
const settled = useLatest((moved) => {
|
|
3450
3536
|
liveOpts?.onSettle?.(moved);
|
|
3451
|
-
if (
|
|
3452
|
-
const boxes = Array.from(source(), ({ node, pose }) => ({ ...node, pose }));
|
|
3453
|
-
setSettledFit({ view: fitDiagram(boxes, { width: boxWidth, height: boxHeight }, fitOpts, pagesBox), over: defaultView });
|
|
3537
|
+
if (moved !== 0) fitting.settle();
|
|
3454
3538
|
});
|
|
3455
3539
|
const live = useLiveLayout({
|
|
3456
3540
|
...liveOpts,
|
|
@@ -3462,8 +3546,7 @@ function Inner({
|
|
|
3462
3546
|
useEffect(() => {
|
|
3463
3547
|
if (run !== null) live.restart();
|
|
3464
3548
|
}, [run, live]);
|
|
3465
|
-
|
|
3466
|
-
useDiagramApi(apiRef, canvasRef, scene, live, setRun);
|
|
3549
|
+
useDiagramApi(apiRef, canvasRef, scene, live, setRun, fitting.fitNow);
|
|
3467
3550
|
const selectedIds = useCallback(() => selection.get(), [selection]);
|
|
3468
3551
|
const editing = useDiagramEditing({
|
|
3469
3552
|
scene,
|
|
@@ -3496,7 +3579,6 @@ function Inner({
|
|
|
3496
3579
|
const edits = moves || onConnect !== void 0 || onReorder !== void 0 || resizes || edgesPick;
|
|
3497
3580
|
const features = useMemo(() => ["view", "pick", ...moves ? ["move"] : [], ...resizes ? ["resize"] : []], [moves, resizes]);
|
|
3498
3581
|
const selectTool = useMemo(() => ({ resize: { resizable: diagramResizable(scene) } }), [scene]);
|
|
3499
|
-
useRefit(canvasRef, fit);
|
|
3500
3582
|
const overlayRef = useOverlayPlacement(canvasRef, scene, overlays);
|
|
3501
3583
|
const fillsOn = [width === void 0 ? "fill-x" : "", height === void 0 ? "fill-y" : ""].join(" ").trim();
|
|
3502
3584
|
return /* @__PURE__ */ jsxs("div", { ref: adoptViewRule, "data-wzl-diagram": fillsOn, className, children: [
|
|
@@ -3536,9 +3618,10 @@ function DropRules({ scene }) {
|
|
|
3536
3618
|
useDepSource("canDropInto", () => canDropInto);
|
|
3537
3619
|
return null;
|
|
3538
3620
|
}
|
|
3539
|
-
function useDiagramApi(apiRef, canvasRef, scene, live, setRun) {
|
|
3621
|
+
function useDiagramApi(apiRef, canvasRef, scene, live, setRun, fitNow) {
|
|
3540
3622
|
useImperativeHandle(apiRef, () => ({
|
|
3541
3623
|
layout: (algorithm = "force") => setRun({ algorithm }),
|
|
3624
|
+
fit: fitNow,
|
|
3542
3625
|
live,
|
|
3543
3626
|
worldAt: (clientX, clientY) => {
|
|
3544
3627
|
const [x, y] = canvasRef.current?.clientToWorld(clientX, clientY) ?? [clientX, clientY];
|
|
@@ -3562,39 +3645,9 @@ function useDiagramApi(apiRef, canvasRef, scene, live, setRun) {
|
|
|
3562
3645
|
},
|
|
3563
3646
|
subscribeFrame: (fn) => canvasRef.current?.subscribeFrame(() => fn()) ?? (() => {
|
|
3564
3647
|
})
|
|
3565
|
-
}), [canvasRef, live, scene, setRun]);
|
|
3566
|
-
}
|
|
3567
|
-
function useRefit(canvasRef, fit) {
|
|
3568
|
-
const fitted = useRef(fit);
|
|
3569
|
-
useEffect(() => {
|
|
3570
|
-
const canvas = canvasRef.current;
|
|
3571
|
-
const was = fitted.current;
|
|
3572
|
-
if (canvas === null || fit === void 0 || was === fit) return;
|
|
3573
|
-
if (!sameView(canvas.getView(), was ?? IDENTITY)) return;
|
|
3574
|
-
fitted.current = fit;
|
|
3575
|
-
canvas.setView(fit);
|
|
3576
|
-
}, [canvasRef, fit]);
|
|
3577
|
-
}
|
|
3578
|
-
function fitDiagram(specs, size, fit = {}, extra) {
|
|
3579
|
-
const boxes = specs.filter((s) => s.kind === "container" || diagramGroupOf(s) !== null).map((s) => s.pose);
|
|
3580
|
-
if (extra !== void 0) boxes.push({ ...extra });
|
|
3581
|
-
if (boxes.length === 0) return void 0;
|
|
3582
|
-
const x = Math.min(...boxes.map((b) => b.x));
|
|
3583
|
-
const y = Math.min(...boxes.map((b) => b.y));
|
|
3584
|
-
const bounds = {
|
|
3585
|
-
x,
|
|
3586
|
-
y,
|
|
3587
|
-
width: Math.max(...boxes.map((b) => b.x + b.width)) - x,
|
|
3588
|
-
height: Math.max(...boxes.map((b) => b.y + b.height)) - y
|
|
3589
|
-
};
|
|
3590
|
-
return fitViewToBounds(bounds, size, { x: 0, y: 0, scale: { x: 1, y: 1 } }, {
|
|
3591
|
-
maxScale: fit.maxScale ?? 1,
|
|
3592
|
-
...fit.minScale !== void 0 ? { minScale: fit.minScale } : {},
|
|
3593
|
-
...fit.anchor !== void 0 ? { anchor: fit.anchor } : {},
|
|
3594
|
-
...fit.padding !== void 0 ? { padding: fit.padding } : {}
|
|
3595
|
-
});
|
|
3648
|
+
}), [canvasRef, live, scene, setRun, fitNow]);
|
|
3596
3649
|
}
|
|
3597
3650
|
|
|
3598
3651
|
export { ADD_LANE_ACTION_ID, ANYWHERE, CONNECT_ACTION_ID, CONTAINER_STENCILS, DEFAULT_EDGE_STROKE, DiagramView, EASED_LAYOUTS, EDGE_END_AFFORDANCE_KIND, EDGE_END_LAYER_ID, EDIT_CONTAINER_TITLE_ACTION_ID, GRAB_EDGE_END_ACTION_ID, GRAB_LABEL_ACTION_ID, GRAB_PORT_ACTION_ID, GRAB_WAYPOINT_ACTION_ID, LANE_AFFORDANCE_KIND, LANE_LAYER_ID, LANE_RESIZE_ACTION_ID, LAYOUTS, LAYOUT_ACTION_ID, MOVE_LABEL_ACTION_ID, PORT_AFFORDANCE_KIND, PORT_LAYER_ID, RECONNECT_ACTION_ID, RELEASE_MEMBERS_ACTION_ID, REMOVE_WAYPOINT_ACTION_ID, REORDER_ACTION_ID, RESET_LABEL_ACTION_ID, RESET_ROUTE_ACTION_ID, ROUTER_LABELS, ROUTE_EDIT_ACTION_ID, SELECT_LABEL_EDGE_ACTION_ID, SET_HOPS_ACTION_ID, SET_ROUTER_ACTION_IDS, STEP_REORDER_ACTION_ID, WAYPOINT_AFFORDANCE_KIND, WAYPOINT_HIT_PX, WAYPOINT_LAYER_ID, addLane, applyLayout, avoidSceneInput, bodyAt, commitEdgeToScene, commitLabelToScene, commitLaneResizeToScene, commitReconnectToScene, commitRouteToScene, commitRouterToScene, connectBinding, containerBuild, createAddLaneAction, createConnectAction, createDiagramContribution, createEdgeEndAffordance, createLabelDragAction, createLaneAffordance, createLaneResizeAction, createLayoutAction, createPortAffordance, createReconnectAction, createReleaseMembersAction, createRemoveWaypointAction, createReorderAction, createResetLabelAction, createResetRouteAction, createRouteEditAction, createSetHopsAction, createSetRouterAction, createSpecHops, createSpecLabelPlacer, createSpecRouter, createStepReorderAction, createWaypointAffordance, defaultCanConnect, diagramCanDropInto, diagramContainers, diagramDropParentAt, diagramEdgeEnds, diagramLabelDrag, diagramLayoutOf, diagramPorts, diagramResizable, diagramShape, diagramWaypoints, dragSegment, dragVertex, easedProducer, edgeEndLayer, edgeEndScratchOf, edgePolylines, editContainerTitleAction, editContainerTitleBinding, forceProducer, grabPortAction, grabPortBindings, groupReorderContribution, groupReorderSlots, headerIdOf, hopDataOps, inOrUnder, insertWaypoint, isBodyEnd, laneLayer, laneResizeFrame, laneScratchOf, lanesOf, layoutPoses, movedLabelData, pinSegment, poolAxisOf, poolsOf, portLayer, portScratchOf, reconnectBinding, regionHeaderAt, registerDiagramShape, releaseMembers, removeSegment, removeWaypoint, reorderBinding, reorderContribution, routeHandles, routeStateOf, routeWrites, routedData, routerActions, routesOf, sceneEdges, sceneParticipants, segmentAxis, sequenceSlots, themeWrites, unpinSegment, useLiveLayout, useMirroredSelection, waypointLayer, waypointScratchOf, withHopsData, withRouter };
|
|
3599
|
-
//# sourceMappingURL=chunk-
|
|
3600
|
-
//# sourceMappingURL=chunk-
|
|
3652
|
+
//# sourceMappingURL=chunk-DYDX6EJC.js.map
|
|
3653
|
+
//# sourceMappingURL=chunk-DYDX6EJC.js.map
|