@diagrammo/dgmo 0.75.0 → 0.76.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.
Files changed (43) hide show
  1. package/dist/advanced.d.ts +40 -1
  2. package/dist/advanced.js +181 -19
  3. package/dist/block.css +20 -3
  4. package/dist/block.d.ts +10 -2
  5. package/dist/block.js +29 -12
  6. package/dist/chart-meta.js +6 -6
  7. package/dist/{chunk-LYLRNAX2.js → chunk-3EGIU5WY.js} +2 -2
  8. package/dist/{chunk-2NRIGEHZ.js → chunk-46KVXDUJ.js} +10 -3
  9. package/dist/{chunk-M3IVOGZE.js → chunk-4CRLM3IT.js} +26 -20
  10. package/dist/chunk-7IATMZSA.js +72 -0
  11. package/dist/{chunk-6DYZ2JM6.js → chunk-BZQCAZZZ.js} +203 -29
  12. package/dist/{chunk-ZMKCG3FT.js → chunk-C576CU77.js} +2 -2
  13. package/dist/{chunk-DSH7NJ2G.js → chunk-EGXJWRO6.js} +2 -2
  14. package/dist/{chunk-RT7ACF77.js → chunk-EGY3TS62.js} +6 -6
  15. package/dist/{chunk-TDHD3HNO.js → chunk-F4X5NVKY.js} +37 -16
  16. package/dist/{chunk-BFTRW24X.js → chunk-FMZEU7MF.js} +64 -23
  17. package/dist/{chunk-R5JPMW2F.js → chunk-FTTB64OJ.js} +5 -5
  18. package/dist/{chunk-IGQW7TKM.js → chunk-GFXFRKUG.js} +2 -2
  19. package/dist/{chunk-F4CPZRG2.js → chunk-JLJ7SP4X.js} +2 -2
  20. package/dist/{chunk-SUA56ZSB.js → chunk-LTTZX6RD.js} +6 -2
  21. package/dist/{chunk-GE5RO4BS.js → chunk-N6MZSBOL.js} +5 -1
  22. package/dist/{chunk-DU3OIBQE.js → chunk-NWNSXHA5.js} +6 -2
  23. package/dist/{chunk-QUYYL3LP.js → chunk-OBYZU23V.js} +4 -4
  24. package/dist/{chunk-XCAEHWQB.js → chunk-PAW4RMH3.js} +2 -2
  25. package/dist/{chunk-XFLLYY3V.js → chunk-TF76LCZS.js} +33 -49
  26. package/dist/{dgmo-router-KYNLRE7S.js → dgmo-router-A3LIHT6H.js} +7 -7
  27. package/dist/{dimensions-NLQ64ED5.js → dimensions-7NYBSZRJ.js} +3 -3
  28. package/dist/{flowchart-parser-LY5GGQL2.js → flowchart-parser-NVBP3C5D.js} +2 -2
  29. package/dist/{flowchart-renderer-RIJ5FZKO.js → flowchart-renderer-QYGQ64BM.js} +5 -5
  30. package/dist/index.js +8 -8
  31. package/dist/{layout-UJ62RQQ3.js → layout-2OJ25STS.js} +2 -2
  32. package/dist/{layout-DAYQ46PS.js → layout-LAS67TK3.js} +3 -3
  33. package/dist/{parser-LUOINP6H.js → parser-QYAIFXLP.js} +3 -3
  34. package/dist/{parser-L7RXUKYN.js → parser-WVE6SKB7.js} +2 -2
  35. package/dist/{parser-JYIZEKAS.js → parser-ZYAFHXKQ.js} +2 -2
  36. package/dist/{renderer-WDSBFDQ2.js → renderer-E6NHTVN6.js} +3 -3
  37. package/dist/{renderer-A2YWSBPY.js → renderer-F6WSR7UM.js} +3 -3
  38. package/dist/{renderer-UYYBJ7OB.js → renderer-IH45QV6Z.js} +9 -9
  39. package/dist/{renderer-73QHYZ2Q.js → renderer-LE3ZKHNS.js} +3 -3
  40. package/dist/{state-renderer-454ADT7E.js → state-renderer-UIE3AQM6.js} +4 -4
  41. package/docs/language-reference.md +3 -3
  42. package/package.json +2 -2
  43. package/dist/chunk-PDKUANDZ.js +0 -35
@@ -2178,6 +2178,18 @@ interface SketchBox {
2178
2178
  readonly collapsed: boolean;
2179
2179
  /** child node ids, declaration order */
2180
2180
  readonly children: readonly string[];
2181
+ /**
2182
+ * Child BOX ids, declaration order (decision #58 — sketch nests to depth 2,
2183
+ * matching boxes-and-lines §14). Empty on an inner box: depth 2 is the bound.
2184
+ */
2185
+ readonly childBoxes: readonly string[];
2186
+ /**
2187
+ * The box this box sits inside, or null at the top level. Membership lives on
2188
+ * the CHILD, the same shape `boxes-and-lines` uses (`parentGroup`) and the one
2189
+ * the sketch rebuild's canvas model arrived at independently — a tree cannot
2190
+ * express double membership, so this cannot either.
2191
+ */
2192
+ readonly parentBoxId: string | null;
2181
2193
  readonly lineNumber: number;
2182
2194
  }
2183
2195
  interface SketchOptions {
@@ -2206,6 +2218,33 @@ declare function isSketchShapeKind(value: string): value is SketchShapeKind;
2206
2218
 
2207
2219
  declare function parseSketch(content: string, palette?: PaletteColors): ParsedSketch;
2208
2220
 
2221
+ /**
2222
+ * Emit DGMO source for a parsed sketch.
2223
+ *
2224
+ * The output re-parses to an equivalent scene (`sameSketch`) and raises no
2225
+ * diagnostics. It is not pretty-printed: this is the correctness emitter, whose
2226
+ * only reader is the parser. Presentation — stable aliases, ordering,
2227
+ * whitespace — is a separate job.
2228
+ */
2229
+ declare function emitSketch(parsed: ParsedSketch): string;
2230
+ interface CanonicalScene {
2231
+ title: string | null;
2232
+ options: string;
2233
+ tags: string;
2234
+ nodes: string[];
2235
+ boxes: string[];
2236
+ edges: string[];
2237
+ }
2238
+ /**
2239
+ * A scene reduced to what the PICTURE says, so two scenes that draw the same
2240
+ * thing compare equal. Ids and line numbers are dropped (they are parse
2241
+ * artifacts), sets are sorted (declaration order is not meaning), and edges are
2242
+ * keyed by resolved endpoint names rather than ids.
2243
+ */
2244
+ declare function canonicalSketch(parsed: ParsedSketch): CanonicalScene;
2245
+ /** True when two parses describe the same picture. */
2246
+ declare function sameSketch(a: ParsedSketch, b: ParsedSketch): boolean;
2247
+
2209
2248
  interface SketchLayoutNode {
2210
2249
  readonly id: string;
2211
2250
  readonly label: string;
@@ -6772,4 +6811,4 @@ declare function uncoveredCharacters(text: string, coverage: FontCoverage): read
6772
6811
  */
6773
6812
  declare function fontPortabilityWarning(runs: readonly UncoveredRun[]): string | undefined;
6774
6813
 
6775
- export { ARROW_DIAGNOSTIC_CODES, type Activation, type AncestorInfo, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, type BlipTrend, type BlockCell, type BlockGrid, type BlockLayoutItem, type BlockLayoutResult, type BlockNode, type BlockOptions, type BodyFigure, type BodyOptions, type BodyPart, type BracketMode, type BracketSide, type C4ArrowType, type C4DeploymentNode, type C4Element, type C4ElementType, type C4Group, type C4LayoutBoundary, type C4LayoutEdge, type C4LayoutNode, type C4LayoutResult, type C4LegendEntry, type C4LegendGroup, type C4Relationship, type C4Shape, type C4TagEntry, type C4TagGroup, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type ClockEntry, type ClockFace, type ClockZoneKind, type CodepointRange, type CollapsedMindmapResult, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type CountUnits, type CreateMapGeoQueryOptions, type CycleEdge, type CycleLayoutEdge, type CycleLayoutNode, type CycleLayoutResult, type CycleNode, type CycleRenderOptions, type D3ExportDimensions, DgmoError, type DiagramSymbols, type Duration, type DurationUnit, type ERCardinality, type ERColumn, type ERConstraint, type ERLayoutEdge, type ERLayoutNode, type ERLayoutResult, type ERRelationship, type ERTable, type ElseIfBranch, type EventLineEra, type EventLineEvent, type EventLineFocus, type EventLineOptions, type ExpandedActivity, type ExtendedChartType, type FamilyChild, type FamilyChildEdge, type FamilyLayoutNode, type FamilyLayoutResult, type FamilyMarriageBar, type FamilyPerson, type FamilySex, type FamilyUnion, type FocusOrgResult, type FocusResult, type FocusTarget, type FontCoverage, type GanttDependency, type GanttEra, type GanttGroup, type GroupRow as GanttGroupRow, type GanttHolidays, type GanttInteractiveOptions, type LaneHeaderRow as GanttLaneHeaderRow, type GanttMarker, type GanttNode, type GanttOptions, type Row as GanttRow, type GanttTask, type TaskRow as GanttTaskRow, GeoExtent, type GetOrCreateNameResult, type GoalMode, type GoalOptions, type GraphDirection, type GraphEdge, type GraphGroup, type GraphNode, type GraphShape, INFRA_BEHAVIOR_KEYS, INVALID_COLOR_CODE, INVALID_CSS_COLOR_HEX, type InfraAvailabilityPercentiles, type InfraBehaviorKey, type InfraCbState, type InfraComputeParams, type InfraDiagnostic, type InfraEdge, type InfraGroup, type InfraLatencyPercentiles, type InfraLayoutEdge, type InfraLayoutGroup, type InfraLayoutNode, type InfraLayoutResult, type InfraLegendGroup, type InfraNode, type InfraPlaybackState, type InfraProperty, type InfraRole, type InfraTagGroup, type InlineSpan, type JourneyMapAnnotation, type JourneyMapInteractiveOptions, type JourneyMapLayout, type JourneyMapPersona, type JourneyMapPhase, type JourneyMapStep, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_GEAR_PILL_W, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutOptions$1 as LayoutOptions, type LayoutResult$1 as LayoutResult, type LegendCallbacks, type LegendConfig, type LegendControl, type LegendGroupData, type LegendHandle, type LegendLayout, type LegendMode, type LegendPalette, type LegendPosition, type LegendState, MapData, type MapExportDimensions, type MapGeoQuery, type MapLayout, type MapLayoutInset, type MapLayoutLeg, MapLayoutLegend, type MapLayoutPoi, type MapLayoutRegion, type MapLayoutStretch, type MemberVisibility, type MindmapLayoutEdge, type MindmapLayoutNode, type MindmapLayoutResult, type MindmapNode, type MonteCarloResult, type NameEntry, type NearestCity, type NodeDetail, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, PaletteColors, PaletteConfig, type ParseInArrowLabelResult, type ParsedBlock, type ParsedBody, type ParsedBoxesAndLines, type ParsedBracket, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedClock, type ParsedCountdown, type ParsedCycle, type ParsedERDiagram, type ParsedEventLine, type ParsedExtendedChart, type ParsedFamily, type ParsedGantt, type ParsedGoal, type ParsedGraph, type ParsedInfra, type ParsedJourneyMap, type ParsedKanban, type ParsedLiveLink, ParsedMap, type ParsedMindmap, ParsedOrg, type ParsedPert, type ParsedPyramid, ParsedRaci, type ParsedRing, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedSketch, type ParsedSwimlane, type ParsedTechRadar, type ParsedTreemap, type ParsedVersionControl, type ParsedVisualization, type ParsedWireframe, type ParticipantType, type PertActivity, type Anchor as PertAnchor, type PertDirection, type PertEdge, type PertGroup, type PertLayoutEdge, type PertLayoutGroup, type PertLayoutNode, type LayoutOverrides as PertLayoutOverrides, type LayoutResult as PertLayoutResult, type PertMilestone, type PertOptions, type PertRenderOptions, type PlaceResolution, type PlacedLabel, type ProjectedCity, type PyramidLayer, type QuadrantPosition, RACI_ERROR_CODES, VARIANTS as RACI_VARIANTS, RACI_WARNING_CODES, RECOGNIZED_COLOR_NAMES, RULE_COUNT, type RaciDragSource, type RaciInteractionHandlers, RaciMarker, RaciTask, RaciVariant, type RadialCell, type RadialLayoutResult, type RawMatch, type RawSeed, type RecurRule, type RegionToken, type RelationshipType, type RenderStep, type ResolvedActivity, type ResolvedGroup$1 as ResolvedGroup, ResolvedMap, type ResolvedPert, type ResolvedGroup as ResolvedPertGroup, type ResolvedSchedule, type ResolvedTask, type ResultCard, type ResultTokens, type RingLayer, type RoundMode, SKETCH_AUTO_LAYOUT_DEFAULTS, SKETCH_FOOT_H, SKETCH_FOOT_W, SKETCH_GEOMETRY, SKETCH_HALF_SLOT_X, SKETCH_HALF_SLOT_Y, SKETCH_SEP, SKETCH_SHAPE_KINDS, SKETCH_SLOT_X, SKETCH_SLOT_Y, ScaleContext, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceNote, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, type SimulateOptions, type SitemapContainerBounds, type SitemapDirection, type SitemapEdge, type SitemapLayoutEdge, type SitemapLayoutNode, type SitemapLayoutResult, type SitemapLegendEntry, type SitemapLegendGroup, type SitemapNode, type SketchAt, type SketchAutoLayoutFlags, type SketchBox, type SketchCollapseResult, type SketchEdge, type SketchEdgeGeometry, type SketchEdgeHeads, type SketchLayout, type SketchLayoutBox, type SketchLayoutNode, type SketchLayoutOptions, type SketchNode, type SketchOptions, type SketchRenderOptions, type SketchShapeKind, type StateCollapseResult, type SwimEdge, type SwimEvent, type SwimLane, type SwimNode, type SwimPhase, type SwimShape, type LayoutBand as SwimlaneLayoutBand, type SwimlaneLayoutResult, TagEntry, TagGroup, type TechRadarBlip, type TechRadarLayoutPoint, type TechRadarQuadrant, type TechRadarRing, type TreemapCell, type TreemapColorMode, type TreemapLayoutResult, type TreemapNode, type TreemapOptions, type UncoveredRun, type VCBranch, type VCNode, type VCNote, type VCOptions, type VCRef, type VisualizationType, type WireframeElement, type WireframeElementType, type WireframeFormFactor, type WireframeLayout, type WireframeLayoutNode, type WorkWindow, type ZoneSuggestion, addDurationToDate, albersSkewFallback, analyzePert, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, atlasPalette, authoredCollapsedIds, blueprintPalette, buildNoteMessageMap, buildRenderSequence, buildSimulationContext, buildTagLaneRowList, calculateSchedule, catppuccinPalette, clearEventLineMuted, collapseBoxesAndLines, collapseMindmapTree, collapseOrgTree, collapseSitemapTree, collapseSketch, collapseStateGroups, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeCycleLayout, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeRadarLayout, computeTimeTicks, controlsGroupCapsuleWidth, createMapGeoQuery, displayName, extractSymbols$2 as extractClassSymbols, extractSymbols$1 as extractErSymbols, extractSymbols$3 as extractFlowchartSymbols, extractSymbols as extractInfraSymbols, extractPertSymbols, focusBoxesAndLines, focusEventLine, focusOrgTree, fontPortabilityWarning, formatDateLabel, formatOffsetLabel, getExtendedChartLegendGroups, getLegendReservedHeight, getOrCreateName, getRadarGeometry, getSimpleChartLegendGroups, groupMessagesBySection, inferParticipantType, inferRoles, invalidColorDiagnostic, isArchiveColumn, isInvalidColorToken, isRecognizedColorName, isSequenceBlock, isSequenceNote, isSketchShapeKind, layoutBlock, layoutBoxesAndLines, layoutBracket, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutFamily, layoutGraph, layoutInfra, layoutJourneyMap, layoutMap, layoutMindmap, layoutOrg, layoutPert, layoutSitemap, layoutSketch, layoutSwimlane, layoutTreemap, layoutTreemapRadial, layoutWireframe, loadMapData, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeMap, looksLikePert, looksLikeSequence, looksLikeSitemap, looksLikeState, mapBackgroundColor, mapContentAspect, mapExportDimensions, mapNeutralLandColor, measurePertAnalysisBlock, mulberry32, nearestNamedColor, nord, nordPalette, normalizeName, normalizePlace, orderArcNodes, parseAndLayoutInfra, parseBlock, parseBody, parseBoxesAndLines, parseBracket, parseC4, parseChart, parseClassDiagram, parseClock, parseCountdown, parseCycle, parseDataRowValues, parseERDiagram, parseEventLine, parseExtendedChart, parseFamily, parseFixedOffset, parseFlowchart, parseGantt, parseGoal, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseJourneyMap, parseKanban, parseLiveLink, parseMap, parseMindmap, parsePert, parsePyramid, parseRing, parseSequenceDgmo, parseSequenceDgmo as parseSequenceDiagram, parseSitemap, parseSketch, parseState, parseSwimlane, parseTechRadar, parseTimelineDate, parseTreemap, parseVersionControl, parseVisualization, parseWireframe, cellAppendMarker as raciCellAppendMarker, cellCycle as raciCellCycle, cellRemove as raciCellRemove, cellReplace as raciCellReplace, relayoutPert, render, renderArcDiagram, renderBlock, renderBlockForExport, renderBody, renderBodyForExport, renderBoxesAndLines, renderBoxesAndLinesForExport, renderBracket, renderBracketForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderClock, renderClockForExport, renderCountdown, renderCountdownForExport, renderCycle, renderCycleForExport, renderERDiagram, renderERDiagramForExport, renderEventLine, renderEventLineForExport, renderFamily, renderFamilyForExport, renderFlowchart, renderFlowchartForExport, renderGantt, renderGoal, renderGoalForExport, renderInfra, renderJourneyMap, renderJourneyMapForExport, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderLiveLinkCard, renderMap, renderMapForExport, renderMindmap, renderMindmapForExport, renderOrg, renderOrgForExport, renderPert, renderPertAnalysisBlock, renderPertForExport, renderPyramid, renderPyramidForExport, renderQuadrant, renderQuadrantFocus, renderQuadrantFocusForExport, renderRaci, renderRaciForExport, renderRing, renderRingForExport, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSketch, renderSketchForExport, renderSlopeChart, renderState, renderStateForExport, renderSwimlaneForExport, renderTechRadar, renderTechRadarForExport, renderTimeline, renderTreemap, renderTreemapForExport, renderTreemapRadial, renderTreemapRadialForExport, renderVenn, renderVersionControl, renderVersionControlForExport, renderWireframe, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveMap, resolvePlace, resolveTaskName, rollUpContextRelationships, sampleBetaPert, searchZones, seriesColors, simulateCanonical, simulateFast, sketchEdgeGeometry, sketchSlotToPx, slatePalette, startClocks, startCountdowns, targetToMs, textFromSvg, tickClocks, tickCountdowns, tidewaterPalette, tokyoNightPalette, truncateBareUrl, uncoveredCharacters, validateComputed, validateInfra, validateLabelCharacters };
6814
+ export { ARROW_DIAGNOSTIC_CODES, type Activation, type AncestorInfo, type ArcLink, type ArcNodeGroup, type BLCollapseResult, type BLEdge, type BLGroup, type BLLayoutEdge, type BLLayoutGroup, type BLLayoutNode, type BLLayoutResult, type BLNode, type BlipTrend, type BlockCell, type BlockGrid, type BlockLayoutItem, type BlockLayoutResult, type BlockNode, type BlockOptions, type BodyFigure, type BodyOptions, type BodyPart, type BracketMode, type BracketSide, type C4ArrowType, type C4DeploymentNode, type C4Element, type C4ElementType, type C4Group, type C4LayoutBoundary, type C4LayoutEdge, type C4LayoutNode, type C4LayoutResult, type C4LegendEntry, type C4LegendGroup, type C4Relationship, type C4Shape, type C4TagEntry, type C4TagGroup, type ChartDataPoint, type ChartEra, type ChartType$1 as ChartType, type ClassLayoutEdge, type ClassLayoutNode, type ClassLayoutResult, type ClassMember, type ClassModifier, type ClassNode, type ClassRelationship, type ClockEntry, type ClockFace, type ClockZoneKind, type CodepointRange, type CollapsedMindmapResult, type CollapsedOrgResult, type CollapsedSitemapResult, type CollapsedView, CompactViewState, type ComputedInfraEdge, type ComputedInfraModel, type ComputedInfraNode, type ContextRelationship, type CountUnits, type CreateMapGeoQueryOptions, type CycleEdge, type CycleLayoutEdge, type CycleLayoutNode, type CycleLayoutResult, type CycleNode, type CycleRenderOptions, type D3ExportDimensions, DgmoError, type DiagramSymbols, type Duration, type DurationUnit, type ERCardinality, type ERColumn, type ERConstraint, type ERLayoutEdge, type ERLayoutNode, type ERLayoutResult, type ERRelationship, type ERTable, type ElseIfBranch, type EventLineEra, type EventLineEvent, type EventLineFocus, type EventLineOptions, type ExpandedActivity, type ExtendedChartType, type FamilyChild, type FamilyChildEdge, type FamilyLayoutNode, type FamilyLayoutResult, type FamilyMarriageBar, type FamilyPerson, type FamilySex, type FamilyUnion, type FocusOrgResult, type FocusResult, type FocusTarget, type FontCoverage, type GanttDependency, type GanttEra, type GanttGroup, type GroupRow as GanttGroupRow, type GanttHolidays, type GanttInteractiveOptions, type LaneHeaderRow as GanttLaneHeaderRow, type GanttMarker, type GanttNode, type GanttOptions, type Row as GanttRow, type GanttTask, type TaskRow as GanttTaskRow, GeoExtent, type GetOrCreateNameResult, type GoalMode, type GoalOptions, type GraphDirection, type GraphEdge, type GraphGroup, type GraphNode, type GraphShape, INFRA_BEHAVIOR_KEYS, INVALID_COLOR_CODE, INVALID_CSS_COLOR_HEX, type InfraAvailabilityPercentiles, type InfraBehaviorKey, type InfraCbState, type InfraComputeParams, type InfraDiagnostic, type InfraEdge, type InfraGroup, type InfraLatencyPercentiles, type InfraLayoutEdge, type InfraLayoutGroup, type InfraLayoutNode, type InfraLayoutResult, type InfraLegendGroup, type InfraNode, type InfraPlaybackState, type InfraProperty, type InfraRole, type InfraTagGroup, type InlineSpan, type JourneyMapAnnotation, type JourneyMapInteractiveOptions, type JourneyMapLayout, type JourneyMapPersona, type JourneyMapPhase, type JourneyMapStep, type KanbanCard, type KanbanColumn, type KanbanTagEntry, type KanbanTagGroup, LEGEND_GEAR_PILL_W, LEGEND_HEIGHT, type LayoutEdge, type LayoutGroup, type LayoutNode, type LayoutOptions$1 as LayoutOptions, type LayoutResult$1 as LayoutResult, type LegendCallbacks, type LegendConfig, type LegendControl, type LegendGroupData, type LegendHandle, type LegendLayout, type LegendMode, type LegendPalette, type LegendPosition, type LegendState, MapData, type MapExportDimensions, type MapGeoQuery, type MapLayout, type MapLayoutInset, type MapLayoutLeg, MapLayoutLegend, type MapLayoutPoi, type MapLayoutRegion, type MapLayoutStretch, type MemberVisibility, type MindmapLayoutEdge, type MindmapLayoutNode, type MindmapLayoutResult, type MindmapNode, type MonteCarloResult, type NameEntry, type NearestCity, type NodeDetail, type OrgContainerBounds, type OrgLayoutEdge, type OrgLayoutNode, type OrgLayoutResult, PaletteColors, PaletteConfig, type ParseInArrowLabelResult, type ParsedBlock, type ParsedBody, type ParsedBoxesAndLines, type ParsedBracket, type ParsedC4, type ParsedChart, type ParsedClassDiagram, type ParsedClock, type ParsedCountdown, type ParsedCycle, type ParsedERDiagram, type ParsedEventLine, type ParsedExtendedChart, type ParsedFamily, type ParsedGantt, type ParsedGoal, type ParsedGraph, type ParsedInfra, type ParsedJourneyMap, type ParsedKanban, type ParsedLiveLink, ParsedMap, type ParsedMindmap, ParsedOrg, type ParsedPert, type ParsedPyramid, ParsedRaci, type ParsedRing, type ParsedSequenceDgmo, type ParsedSitemap, type ParsedSketch, type ParsedSwimlane, type ParsedTechRadar, type ParsedTreemap, type ParsedVersionControl, type ParsedVisualization, type ParsedWireframe, type ParticipantType, type PertActivity, type Anchor as PertAnchor, type PertDirection, type PertEdge, type PertGroup, type PertLayoutEdge, type PertLayoutGroup, type PertLayoutNode, type LayoutOverrides as PertLayoutOverrides, type LayoutResult as PertLayoutResult, type PertMilestone, type PertOptions, type PertRenderOptions, type PlaceResolution, type PlacedLabel, type ProjectedCity, type PyramidLayer, type QuadrantPosition, RACI_ERROR_CODES, VARIANTS as RACI_VARIANTS, RACI_WARNING_CODES, RECOGNIZED_COLOR_NAMES, RULE_COUNT, type RaciDragSource, type RaciInteractionHandlers, RaciMarker, RaciTask, RaciVariant, type RadialCell, type RadialLayoutResult, type RawMatch, type RawSeed, type RecurRule, type RegionToken, type RelationshipType, type RenderStep, type ResolvedActivity, type ResolvedGroup$1 as ResolvedGroup, ResolvedMap, type ResolvedPert, type ResolvedGroup as ResolvedPertGroup, type ResolvedSchedule, type ResolvedTask, type ResultCard, type ResultTokens, type RingLayer, type RoundMode, SKETCH_AUTO_LAYOUT_DEFAULTS, SKETCH_FOOT_H, SKETCH_FOOT_W, SKETCH_GEOMETRY, SKETCH_HALF_SLOT_X, SKETCH_HALF_SLOT_Y, SKETCH_SEP, SKETCH_SHAPE_KINDS, SKETCH_SLOT_X, SKETCH_SLOT_Y, ScaleContext, type SectionMessageGroup, type SequenceBlock, type SequenceElement, type SequenceGroup, type SequenceMessage, type SequenceNote, type SequenceParticipant, type SequenceRenderOptions, type SequenceSection, type SimulateOptions, type SitemapContainerBounds, type SitemapDirection, type SitemapEdge, type SitemapLayoutEdge, type SitemapLayoutNode, type SitemapLayoutResult, type SitemapLegendEntry, type SitemapLegendGroup, type SitemapNode, type SketchAt, type SketchAutoLayoutFlags, type SketchBox, type SketchCollapseResult, type SketchEdge, type SketchEdgeGeometry, type SketchEdgeHeads, type SketchLayout, type SketchLayoutBox, type SketchLayoutNode, type SketchLayoutOptions, type SketchNode, type SketchOptions, type SketchRenderOptions, type SketchShapeKind, type StateCollapseResult, type SwimEdge, type SwimEvent, type SwimLane, type SwimNode, type SwimPhase, type SwimShape, type LayoutBand as SwimlaneLayoutBand, type SwimlaneLayoutResult, TagEntry, TagGroup, type TechRadarBlip, type TechRadarLayoutPoint, type TechRadarQuadrant, type TechRadarRing, type TreemapCell, type TreemapColorMode, type TreemapLayoutResult, type TreemapNode, type TreemapOptions, type UncoveredRun, type VCBranch, type VCNode, type VCNote, type VCOptions, type VCRef, type VisualizationType, type WireframeElement, type WireframeElementType, type WireframeFormFactor, type WireframeLayout, type WireframeLayoutNode, type WorkWindow, type ZoneSuggestion, addDurationToDate, albersSkewFallback, analyzePert, applyCollapseProjection, applyGroupOrdering, applyPositionOverrides, atlasPalette, authoredCollapsedIds, blueprintPalette, buildNoteMessageMap, buildRenderSequence, buildSimulationContext, buildTagLaneRowList, calculateSchedule, canonicalSketch, catppuccinPalette, clearEventLineMuted, collapseBoxesAndLines, collapseMindmapTree, collapseOrgTree, collapseSitemapTree, collapseSketch, collapseStateGroups, collectDiagramRoles, collectTasks, colorNames, computeActivations, computeCardArchive, computeCardMove, computeCycleLayout, computeInfra, computeInfraLegendGroups, computeLegendLayout, computeRadarLayout, computeTimeTicks, controlsGroupCapsuleWidth, createMapGeoQuery, displayName, emitSketch, extractSymbols$2 as extractClassSymbols, extractSymbols$1 as extractErSymbols, extractSymbols$3 as extractFlowchartSymbols, extractSymbols as extractInfraSymbols, extractPertSymbols, focusBoxesAndLines, focusEventLine, focusOrgTree, fontPortabilityWarning, formatDateLabel, formatOffsetLabel, getExtendedChartLegendGroups, getLegendReservedHeight, getOrCreateName, getRadarGeometry, getSimpleChartLegendGroups, groupMessagesBySection, inferParticipantType, inferRoles, invalidColorDiagnostic, isArchiveColumn, isInvalidColorToken, isRecognizedColorName, isSequenceBlock, isSequenceNote, isSketchShapeKind, layoutBlock, layoutBoxesAndLines, layoutBracket, layoutC4Components, layoutC4Containers, layoutC4Context, layoutC4Deployment, layoutClassDiagram, layoutERDiagram, layoutFamily, layoutGraph, layoutInfra, layoutJourneyMap, layoutMap, layoutMindmap, layoutOrg, layoutPert, layoutSitemap, layoutSketch, layoutSwimlane, layoutTreemap, layoutTreemapRadial, layoutWireframe, loadMapData, looksLikeClassDiagram, looksLikeERDiagram, looksLikeFlowchart, looksLikeMap, looksLikePert, looksLikeSequence, looksLikeSitemap, looksLikeState, mapBackgroundColor, mapContentAspect, mapExportDimensions, mapNeutralLandColor, measurePertAnalysisBlock, mulberry32, nearestNamedColor, nord, nordPalette, normalizeName, normalizePlace, orderArcNodes, parseAndLayoutInfra, parseBlock, parseBody, parseBoxesAndLines, parseBracket, parseC4, parseChart, parseClassDiagram, parseClock, parseCountdown, parseCycle, parseDataRowValues, parseERDiagram, parseEventLine, parseExtendedChart, parseFamily, parseFixedOffset, parseFlowchart, parseGantt, parseGoal, parseInArrowLabel, parseInfra, parseInlineMarkdown, parseJourneyMap, parseKanban, parseLiveLink, parseMap, parseMindmap, parsePert, parsePyramid, parseRing, parseSequenceDgmo, parseSequenceDgmo as parseSequenceDiagram, parseSitemap, parseSketch, parseState, parseSwimlane, parseTechRadar, parseTimelineDate, parseTreemap, parseVersionControl, parseVisualization, parseWireframe, cellAppendMarker as raciCellAppendMarker, cellCycle as raciCellCycle, cellRemove as raciCellRemove, cellReplace as raciCellReplace, relayoutPert, render, renderArcDiagram, renderBlock, renderBlockForExport, renderBody, renderBodyForExport, renderBoxesAndLines, renderBoxesAndLinesForExport, renderBracket, renderBracketForExport, renderC4ComponentsForExport, renderC4Containers, renderC4ContainersForExport, renderC4Context, renderC4ContextForExport, renderC4Deployment, renderC4DeploymentForExport, renderClassDiagram, renderClassDiagramForExport, renderClock, renderClockForExport, renderCountdown, renderCountdownForExport, renderCycle, renderCycleForExport, renderERDiagram, renderERDiagramForExport, renderEventLine, renderEventLineForExport, renderFamily, renderFamilyForExport, renderFlowchart, renderFlowchartForExport, renderGantt, renderGoal, renderGoalForExport, renderInfra, renderJourneyMap, renderJourneyMapForExport, renderKanban, renderKanbanForExport, renderLegendD3, renderLegendSvg, renderLegendSvgFromConfig, renderLiveLinkCard, renderMap, renderMapForExport, renderMindmap, renderMindmapForExport, renderOrg, renderOrgForExport, renderPert, renderPertAnalysisBlock, renderPertForExport, renderPyramid, renderPyramidForExport, renderQuadrant, renderQuadrantFocus, renderQuadrantFocusForExport, renderRaci, renderRaciForExport, renderRing, renderRingForExport, renderSequenceDiagram, renderSitemap, renderSitemapForExport, renderSketch, renderSketchForExport, renderSlopeChart, renderState, renderStateForExport, renderSwimlaneForExport, renderTechRadar, renderTechRadarForExport, renderTimeline, renderTreemap, renderTreemapForExport, renderTreemapRadial, renderTreemapRadialForExport, renderVenn, renderVersionControl, renderVersionControlForExport, renderWireframe, renderWordCloud, resolveColor, resolveColorWithDiagnostic, resolveMap, resolvePlace, resolveTaskName, rollUpContextRelationships, sameSketch, sampleBetaPert, searchZones, seriesColors, simulateCanonical, simulateFast, sketchEdgeGeometry, sketchSlotToPx, slatePalette, startClocks, startCountdowns, targetToMs, textFromSvg, tickClocks, tickCountdowns, tidewaterPalette, tokyoNightPalette, truncateBareUrl, uncoveredCharacters, validateComputed, validateInfra, validateLabelCharacters };
package/dist/advanced.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-XHROEQ23.js";
34
34
  import {
35
35
  renderLiveLinkCard
36
- } from "./chunk-LYLRNAX2.js";
36
+ } from "./chunk-3EGIU5WY.js";
37
37
  import {
38
38
  authoredCollapsedIds,
39
39
  layoutBlock,
@@ -79,18 +79,18 @@ import {
79
79
  import {
80
80
  renderMap,
81
81
  renderMapForExport
82
- } from "./chunk-DSH7NJ2G.js";
82
+ } from "./chunk-EGXJWRO6.js";
83
83
  import "./chunk-MS5574I7.js";
84
84
  import {
85
85
  mapContentAspect,
86
86
  mapExportDimensions
87
- } from "./chunk-F4CPZRG2.js";
87
+ } from "./chunk-JLJ7SP4X.js";
88
88
  import {
89
89
  albersSkewFallback,
90
90
  layoutMap,
91
91
  mapBackgroundColor,
92
92
  mapNeutralLandColor
93
- } from "./chunk-BFTRW24X.js";
93
+ } from "./chunk-FMZEU7MF.js";
94
94
  import {
95
95
  decodeFeatures,
96
96
  regionAt
@@ -105,7 +105,7 @@ import {
105
105
  inferRoles,
106
106
  parseAndLayoutInfra,
107
107
  renderInfra
108
- } from "./chunk-IGQW7TKM.js";
108
+ } from "./chunk-GFXFRKUG.js";
109
109
  import {
110
110
  measurePertAnalysisBlock,
111
111
  renderPert,
@@ -136,7 +136,7 @@ import {
136
136
  import {
137
137
  renderState,
138
138
  renderStateForExport
139
- } from "./chunk-XFLLYY3V.js";
139
+ } from "./chunk-TF76LCZS.js";
140
140
  import {
141
141
  collapseStateGroups
142
142
  } from "./chunk-SQ7IY53Q.js";
@@ -165,11 +165,11 @@ import {
165
165
  import {
166
166
  renderFlowchart,
167
167
  renderFlowchartForExport
168
- } from "./chunk-QUYYL3LP.js";
169
- import "./chunk-PDKUANDZ.js";
168
+ } from "./chunk-OBYZU23V.js";
169
+ import "./chunk-7IATMZSA.js";
170
170
  import {
171
171
  layoutGraph
172
- } from "./chunk-GE5RO4BS.js";
172
+ } from "./chunk-N6MZSBOL.js";
173
173
  import {
174
174
  computeInfra
175
175
  } from "./chunk-ICZ7M6IZ.js";
@@ -204,7 +204,7 @@ import {
204
204
  import {
205
205
  renderClassDiagram,
206
206
  renderClassDiagramForExport
207
- } from "./chunk-ZMKCG3FT.js";
207
+ } from "./chunk-C576CU77.js";
208
208
  import {
209
209
  layoutClassDiagram
210
210
  } from "./chunk-LM3HY3VG.js";
@@ -228,7 +228,7 @@ import {
228
228
  collapseSketch,
229
229
  layoutSketch,
230
230
  sketchSlotToPx
231
- } from "./chunk-6DYZ2JM6.js";
231
+ } from "./chunk-BZQCAZZZ.js";
232
232
  import {
233
233
  renderSketch,
234
234
  renderSketchForExport,
@@ -314,8 +314,8 @@ import {
314
314
  renderSlopeChart,
315
315
  renderVenn,
316
316
  renderWordCloud
317
- } from "./chunk-M3IVOGZE.js";
318
- import "./chunk-XCAEHWQB.js";
317
+ } from "./chunk-4CRLM3IT.js";
318
+ import "./chunk-PAW4RMH3.js";
319
319
  import "./chunk-EOYPX6SF.js";
320
320
  import {
321
321
  renderLegendSvg,
@@ -370,7 +370,7 @@ import {
370
370
  parseDgmo,
371
371
  parseDgmoChartType,
372
372
  parseVisualization
373
- } from "./chunk-R5JPMW2F.js";
373
+ } from "./chunk-FTTB64OJ.js";
374
374
  import {
375
375
  normalizePlace,
376
376
  parseClock,
@@ -460,8 +460,8 @@ import {
460
460
  SKETCH_SHAPE_KINDS,
461
461
  isSketchShapeKind,
462
462
  parseSketch
463
- } from "./chunk-TDHD3HNO.js";
464
- import "./chunk-RT7ACF77.js";
463
+ } from "./chunk-F4X5NVKY.js";
464
+ import "./chunk-EGY3TS62.js";
465
465
  import {
466
466
  parseSwimlane
467
467
  } from "./chunk-W7UBPARG.js";
@@ -504,7 +504,7 @@ import {
504
504
  INFRA_BEHAVIOR_KEYS,
505
505
  extractSymbols as extractSymbols4,
506
506
  parseInfra
507
- } from "./chunk-2NRIGEHZ.js";
507
+ } from "./chunk-46KVXDUJ.js";
508
508
  import {
509
509
  parseGantt
510
510
  } from "./chunk-TPN7RJOM.js";
@@ -524,7 +524,7 @@ import {
524
524
  extractSymbols,
525
525
  looksLikeFlowchart,
526
526
  parseFlowchart
527
- } from "./chunk-DU3OIBQE.js";
527
+ } from "./chunk-NWNSXHA5.js";
528
528
  import "./chunk-7TF3QOOD.js";
529
529
  import {
530
530
  looksLikeState,
@@ -535,7 +535,7 @@ import {
535
535
  extractSymbols as extractSymbols2,
536
536
  looksLikeClassDiagram,
537
537
  parseClassDiagram
538
- } from "./chunk-SUA56ZSB.js";
538
+ } from "./chunk-LTTZX6RD.js";
539
539
  import {
540
540
  extractSymbols as extractSymbols3,
541
541
  looksLikeERDiagram,
@@ -682,6 +682,165 @@ function collapseBoxesAndLines(parsed, collapsedGroups) {
682
682
  };
683
683
  }
684
684
 
685
+ // src/sketch/emit.ts
686
+ var LIFTED_KEYS = /* @__PURE__ */ new Set(["shape", "at", "as"]);
687
+ function atText(at) {
688
+ return at ? `at: ${String(at.c)} ${String(at.r)}` : null;
689
+ }
690
+ function safeValue(value) {
691
+ return value.includes(",") ? value.replace(/,/g, " \u2014") : value;
692
+ }
693
+ function tailFor(thing, at, extra = []) {
694
+ const alias = thing.alias !== void 0 ? ` as ${thing.alias}` : "";
695
+ const parts = [];
696
+ const atPart = atText(at);
697
+ if (atPart) parts.push(atPart);
698
+ for (const [k, v] of Object.entries(thing.metadata)) {
699
+ if (LIFTED_KEYS.has(k)) continue;
700
+ parts.push(`${k}: ${safeValue(v)}`);
701
+ }
702
+ parts.push(...extra);
703
+ return `${alias}${parts.length > 0 ? ` ${parts.join(", ")}` : ""}`;
704
+ }
705
+ function shapeLine(node, indent) {
706
+ const extra = [];
707
+ if (node.shape !== "rectangle") extra.push(`shape: ${node.shape}`);
708
+ const out = [`${indent}${node.label}${tailFor(node, node.at, extra)}`];
709
+ if (node.description !== void 0 && node.description !== "") {
710
+ for (const line of node.description.split("\n")) {
711
+ out.push(`${indent} > ${line}`);
712
+ }
713
+ }
714
+ return out;
715
+ }
716
+ function boxLine(box, indent) {
717
+ const extra = box.collapsed ? ["collapsed"] : [];
718
+ return `${indent}[${box.label}]${tailFor(box, box.at, extra)}`;
719
+ }
720
+ function edgeText(edge, target) {
721
+ const d = edge.dashed;
722
+ const label = edge.label ?? "";
723
+ if (label === "") {
724
+ if (edge.heads === "none") return `${d ? "~~" : "--"} ${target}`;
725
+ if (edge.heads === "both") return `${d ? "<~>" : "<->"} ${target}`;
726
+ return `${d ? "~>" : "->"} ${target}`;
727
+ }
728
+ const l = safeValue(label);
729
+ if (edge.heads === "none")
730
+ return `${d ? "~" : "-"}${l}${d ? "~" : "-"} ${target}`;
731
+ if (edge.heads === "both")
732
+ return `${d ? "<~" : "<-"}${l}${d ? "~>" : "->"} ${target}`;
733
+ return `${d ? "~" : "-"}${l}${d ? "~>" : "->"} ${target}`;
734
+ }
735
+ function emitSketch(parsed) {
736
+ const lines = [];
737
+ lines.push(parsed.title ? `sketch ${parsed.title}` : "sketch");
738
+ const o = parsed.options;
739
+ if (o.noLegend) lines.push("no-legend");
740
+ if (o.legendInline === true) lines.push("legend-inline");
741
+ if (o.fillMode === "solid") lines.push("fill-solid");
742
+ if (o.fillMode === "outline") lines.push("fill-outline");
743
+ if (o.noDescriptions) lines.push("no-descriptions");
744
+ for (const group of parsed.tagGroups) {
745
+ lines.push("");
746
+ lines.push(
747
+ group.alias !== void 0 ? `tag ${group.name} as ${group.alias}` : `tag ${group.name}`
748
+ );
749
+ for (const entry of group.entries) {
750
+ const isDefault = group.defaultValue !== void 0 && entry.value === group.defaultValue;
751
+ lines.push(` ${entry.value}${isDefault ? " default" : ""}`);
752
+ }
753
+ }
754
+ const refOf = (id) => {
755
+ const node = parsed.nodes.find((n) => n.id === id);
756
+ if (node) return node.alias ?? node.label;
757
+ const box = parsed.boxes.find((b) => b.id === id);
758
+ if (box) return box.alias ?? `[${box.label}]`;
759
+ return id;
760
+ };
761
+ const edgesBySource = /* @__PURE__ */ new Map();
762
+ for (const edge of parsed.edges) {
763
+ const list = edgesBySource.get(edge.sourceId);
764
+ if (list) list.push(edge);
765
+ else edgesBySource.set(edge.sourceId, [edge]);
766
+ }
767
+ const emitEdgesFor = (id, indent) => {
768
+ for (const edge of edgesBySource.get(id) ?? []) {
769
+ lines.push(`${indent}${edgeText(edge, refOf(edge.targetId))}`);
770
+ }
771
+ };
772
+ const nodesByBox = /* @__PURE__ */ new Map();
773
+ const rootNodes = [];
774
+ for (const node of parsed.nodes) {
775
+ if (node.boxLabel === void 0) {
776
+ rootNodes.push(node);
777
+ continue;
778
+ }
779
+ const list = nodesByBox.get(node.boxLabel);
780
+ if (list) list.push(node);
781
+ else nodesByBox.set(node.boxLabel, [node]);
782
+ }
783
+ const emitBox = (box, depth) => {
784
+ const indent = " ".repeat(depth);
785
+ lines.push("");
786
+ lines.push(boxLine(box, indent));
787
+ emitEdgesFor(box.id, `${indent} `);
788
+ for (const node of nodesByBox.get(box.label) ?? []) {
789
+ lines.push(...shapeLine(node, `${indent} `));
790
+ emitEdgesFor(node.id, `${indent} `);
791
+ }
792
+ for (const childId of box.childBoxes) {
793
+ const child = parsed.boxes.find((b) => b.id === childId);
794
+ if (child) emitBox(child, depth + 1);
795
+ }
796
+ };
797
+ for (const node of rootNodes) {
798
+ lines.push("");
799
+ lines.push(...shapeLine(node, ""));
800
+ emitEdgesFor(node.id, " ");
801
+ }
802
+ for (const box of parsed.boxes) {
803
+ if (box.parentBoxId !== null) continue;
804
+ emitBox(box, 0);
805
+ }
806
+ return `${lines.join("\n")}
807
+ `;
808
+ }
809
+ function canonicalSketch(parsed) {
810
+ const nameOf = (id) => {
811
+ const node = parsed.nodes.find((n) => n.id === id);
812
+ if (node) return `n:${node.label}`;
813
+ const box = parsed.boxes.find((b) => b.id === id);
814
+ if (box) return `b:${box.label}`;
815
+ return `?:${id}`;
816
+ };
817
+ const meta = (m) => Object.entries(m).filter(([k]) => !LIFTED_KEYS.has(k)).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}=${v}`).join(";");
818
+ return {
819
+ title: parsed.title,
820
+ options: JSON.stringify({
821
+ noLegend: parsed.options.noLegend,
822
+ legendInline: parsed.options.legendInline === true,
823
+ fillMode: parsed.options.fillMode ?? null,
824
+ noDescriptions: parsed.options.noDescriptions
825
+ }),
826
+ tags: parsed.tagGroups.map(
827
+ (g) => `${g.name}[${g.entries.map((e) => e.value).join("|")}]${g.defaultValue ?? ""}`
828
+ ).sort().join(","),
829
+ nodes: parsed.nodes.map(
830
+ (n) => `${n.label}|${n.shape}|${n.at ? `${String(n.at.c)},${String(n.at.r)}` : "-"}|${n.boxLabel ?? "-"}|${n.description ?? ""}|${meta(n.metadata)}`
831
+ ).sort(),
832
+ boxes: parsed.boxes.map(
833
+ (b) => `${b.label}|${b.at ? `${String(b.at.c)},${String(b.at.r)}` : "-"}|${String(b.collapsed)}|${b.parentBoxId === null ? "-" : parsed.boxes.find((x) => x.id === b.parentBoxId)?.label ?? "?"}|${meta(b.metadata)}`
834
+ ).sort(),
835
+ edges: parsed.edges.map(
836
+ (e) => `${nameOf(e.sourceId)}->${nameOf(e.targetId)}|${e.label ?? ""}|${e.heads}|${String(e.dashed)}`
837
+ ).sort()
838
+ };
839
+ }
840
+ function sameSketch(a, b) {
841
+ return JSON.stringify(canonicalSketch(a)) === JSON.stringify(canonicalSketch(b));
842
+ }
843
+
685
844
  // src/boxes-and-lines/focus.ts
686
845
  var GROUP_PREFIX = "__group_";
687
846
  var groupKey = (label) => `${GROUP_PREFIX}${label}`;
@@ -1878,6 +2037,7 @@ export {
1878
2037
  buildSimulationContext,
1879
2038
  buildTagLaneRowList,
1880
2039
  calculateSchedule,
2040
+ canonicalSketch,
1881
2041
  catppuccinPalette,
1882
2042
  chartTypeParsers,
1883
2043
  chartTypes,
@@ -1908,6 +2068,7 @@ export {
1908
2068
  decodeDiagramUrl,
1909
2069
  decodeViewState,
1910
2070
  displayName,
2071
+ emitSketch,
1911
2072
  encodeDiagramUrl,
1912
2073
  encodeViewState,
1913
2074
  extractSymbols2 as extractClassSymbols,
@@ -2143,6 +2304,7 @@ export {
2143
2304
  resolvePlace,
2144
2305
  resolveTaskName,
2145
2306
  rollUpContextRelationships,
2307
+ sameSketch,
2146
2308
  sampleBetaPert,
2147
2309
  searchMapLocations,
2148
2310
  searchZones,
package/dist/block.css CHANGED
@@ -1,8 +1,19 @@
1
1
  /* @diagrammo/dgmo block — standard embed chrome.
2
- * Override the [data-theme="dark"] selectors if your site uses .dark or
3
- * another color-mode convention. */
2
+ * Dark mode is keyed on a data-theme="dark" attribute (Starlight, Docusaurus)
3
+ * AND an html.dark class (Tailwind, next-themes, VitePress), so all of those
4
+ * work as shipped. Add your own selector if your site marks dark a third way.
5
+ *
6
+ * No selector is spelled in bracket form anywhere in these comments on
7
+ * purpose: the adapters that re-key the attribute rules onto another host's
8
+ * signal match that exact substring, and a mention inside a comment would be
9
+ * swallowed into a rule they then emit as garbage. */
4
10
 
5
- /* === Color-mode visibility (dual-render) === */
11
+ /* === Color-mode visibility (dual-render) ===
12
+ * The dark wrapper also carries the "hidden" ATTRIBUTE, so a page that never
13
+ * loaded this stylesheet shows the light diagram rather than both of them.
14
+ * Every rule below is author-origin and therefore still overrides it.
15
+ * Keep the two host conventions in separate rule blocks — the adapters
16
+ * rewrite by literal replace and a folded rule would half-rewrite. */
6
17
  .dgmo-dark {
7
18
  display: none;
8
19
  }
@@ -12,6 +23,12 @@
12
23
  [data-theme="dark"] .dgmo-dark {
13
24
  display: block;
14
25
  }
26
+ html.dark .dgmo-light {
27
+ display: none;
28
+ }
29
+ html.dark .dgmo-dark {
30
+ display: block;
31
+ }
15
32
 
16
33
  /* === Diagram sizing ===
17
34
  * SVGs are emitted with viewBox only (no fixed width/height). Force them to
package/dist/block.d.ts CHANGED
@@ -9,10 +9,18 @@ import './tag-groups-DrHT2tEc.js';
9
9
  * consumers, and the `BLOCK_CSS` string export for embedders that inject a
10
10
  * `<style>` tag.
11
11
  *
12
- * Dark mode keys off `[data-theme="dark"]`. Hosts with a different signal
13
- * (`html.dark`, `body.theme-dark`) rewrite the selector at their build step —
12
+ * Dark mode keys off BOTH `[data-theme="dark"]` (Starlight, Docusaurus) and
13
+ * `html.dark` (Tailwind, next-themes, VitePress), because those two cover
14
+ * essentially every host and picking one silently left the other half of the
15
+ * ecosystem with a diagram that never toggled. A host on a third signal
16
+ * (`body.theme-dark`) still rewrites the selector at its build step —
14
17
  * fumadocs-dgmo/nextra-dgmo's build-css.mjs is the reference adapter.
15
18
  *
19
+ * 🔴 Keep the two conventions in SEPARATE rule blocks. `auto/styles.ts`
20
+ * re-scopes the `[data-theme="dark"]` rules onto `.dgmo-theme-dark` with a
21
+ * regex that swallows everything up to the `{`, so folding them into one
22
+ * multi-selector rule would drag `html.dark` into the re-scoped copy too.
23
+ *
16
24
  * The `.dgmo-tok-*` role colors mirror LIGHT_ROLE_STYLES (light) and
17
25
  * NORD_ROLE_STYLES (dark) from editor/highlight-api.ts. A parity test
18
26
  * (tests/block.test.ts) guards against drift — update both when either
package/dist/block.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-D3K4U3ZM.js";
5
5
  import {
6
6
  render
7
- } from "./chunk-M3IVOGZE.js";
7
+ } from "./chunk-4CRLM3IT.js";
8
8
  import {
9
9
  docsLink,
10
10
  renderErrorCard
11
- } from "./chunk-XCAEHWQB.js";
11
+ } from "./chunk-PAW4RMH3.js";
12
12
  import "./chunk-EOYPX6SF.js";
13
13
  import "./chunk-JL7BDLC6.js";
14
14
  import "./chunk-L65WI4HO.js";
@@ -27,7 +27,7 @@ import "./chunk-MTGGOCND.js";
27
27
  import {
28
28
  encodeDiagramUrl
29
29
  } from "./chunk-U7VO6JAA.js";
30
- import "./chunk-R5JPMW2F.js";
30
+ import "./chunk-FTTB64OJ.js";
31
31
  import "./chunk-SH4PPRU7.js";
32
32
  import "./chunk-A2RUBBVT.js";
33
33
  import "./chunk-5PFNUDXR.js";
@@ -51,8 +51,8 @@ import {
51
51
  } from "./chunk-WFA6IULY.js";
52
52
  import "./chunk-BWJLLNUX.js";
53
53
  import "./chunk-KRTLS3G6.js";
54
- import "./chunk-TDHD3HNO.js";
55
- import "./chunk-RT7ACF77.js";
54
+ import "./chunk-F4X5NVKY.js";
55
+ import "./chunk-EGY3TS62.js";
56
56
  import "./chunk-W7UBPARG.js";
57
57
  import "./chunk-S5P5Z5Y5.js";
58
58
  import "./chunk-QQJUTGQH.js";
@@ -66,7 +66,7 @@ import "./chunk-UCZBRGJN.js";
66
66
  import "./chunk-7BMX2M3F.js";
67
67
  import "./chunk-3SP6G4LN.js";
68
68
  import "./chunk-ZM27UI5O.js";
69
- import "./chunk-2NRIGEHZ.js";
69
+ import "./chunk-46KVXDUJ.js";
70
70
  import "./chunk-TPN7RJOM.js";
71
71
  import "./chunk-EQW6HOP4.js";
72
72
  import {
@@ -74,11 +74,11 @@ import {
74
74
  } from "./chunk-DAOFNU6J.js";
75
75
  import "./chunk-7NSNE52V.js";
76
76
  import "./chunk-C3Z4DX3V.js";
77
- import "./chunk-DU3OIBQE.js";
77
+ import "./chunk-NWNSXHA5.js";
78
78
  import "./chunk-7TF3QOOD.js";
79
79
  import "./chunk-M5JT2AU7.js";
80
80
  import "./chunk-NXMESY4J.js";
81
- import "./chunk-SUA56ZSB.js";
81
+ import "./chunk-LTTZX6RD.js";
82
82
  import "./chunk-ICVIJLBA.js";
83
83
  import "./chunk-76NHL5UG.js";
84
84
  import "./chunk-E6PNTYRK.js";
@@ -572,10 +572,21 @@ function escapeAttr(s) {
572
572
  // src/embed/css.ts
573
573
  var BLOCK_CSS = `
574
574
  /* @diagrammo/dgmo block \u2014 standard embed chrome.
575
- * Override the [data-theme="dark"] selectors if your site uses .dark or
576
- * another color-mode convention. */
575
+ * Dark mode is keyed on a data-theme="dark" attribute (Starlight, Docusaurus)
576
+ * AND an html.dark class (Tailwind, next-themes, VitePress), so all of those
577
+ * work as shipped. Add your own selector if your site marks dark a third way.
578
+ *
579
+ * No selector is spelled in bracket form anywhere in these comments on
580
+ * purpose: the adapters that re-key the attribute rules onto another host's
581
+ * signal match that exact substring, and a mention inside a comment would be
582
+ * swallowed into a rule they then emit as garbage. */
577
583
 
578
- /* === Color-mode visibility (dual-render) === */
584
+ /* === Color-mode visibility (dual-render) ===
585
+ * The dark wrapper also carries the "hidden" ATTRIBUTE, so a page that never
586
+ * loaded this stylesheet shows the light diagram rather than both of them.
587
+ * Every rule below is author-origin and therefore still overrides it.
588
+ * Keep the two host conventions in separate rule blocks \u2014 the adapters
589
+ * rewrite by literal replace and a folded rule would half-rewrite. */
579
590
  .dgmo-dark {
580
591
  display: none;
581
592
  }
@@ -585,6 +596,12 @@ var BLOCK_CSS = `
585
596
  [data-theme="dark"] .dgmo-dark {
586
597
  display: block;
587
598
  }
599
+ html.dark .dgmo-light {
600
+ display: none;
601
+ }
602
+ html.dark .dgmo-dark {
603
+ display: block;
604
+ }
588
605
 
589
606
  /* === Diagram sizing ===
590
607
  * SVGs are emitted with viewBox only (no fixed width/height). Force them to
@@ -1068,7 +1085,7 @@ async function renderDgmoBlock(source, options = {}) {
1068
1085
  renderTheme("dark")
1069
1086
  ]);
1070
1087
  const background = opts.background === "auto" ? defaultEmbedBackground(chartType) : opts.background;
1071
- svgsHtml = `<div class="${escapeAttr(innerClasses(opts, "dgmo-light"))}" data-dgmo-bg="${escapeAttr(palette.light.bg)}">${normalizeSvgForEmbed(light, { background })}</div><div class="${escapeAttr(innerClasses(opts, "dgmo-dark"))}" data-dgmo-bg="${escapeAttr(palette.dark.bg)}">${normalizeSvgForEmbed(dark, { background })}</div>`;
1088
+ svgsHtml = `<div class="${escapeAttr(innerClasses(opts, "dgmo-light"))}" data-dgmo-bg="${escapeAttr(palette.light.bg)}">${normalizeSvgForEmbed(light, { background })}</div><div class="${escapeAttr(innerClasses(opts, "dgmo-dark"))}" data-dgmo-bg="${escapeAttr(palette.dark.bg)}" hidden>${normalizeSvgForEmbed(dark, { background })}</div>`;
1072
1089
  } else {
1073
1090
  const svg = await renderTheme(opts.colorMode);
1074
1091
  const background = opts.background === "auto" ? defaultEmbedBackground(chartType) : opts.background;
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-U7VO6JAA.js";
11
11
  import {
12
12
  parseDgmoChartType
13
- } from "./chunk-R5JPMW2F.js";
13
+ } from "./chunk-FTTB64OJ.js";
14
14
  import "./chunk-SH4PPRU7.js";
15
15
  import "./chunk-A2RUBBVT.js";
16
16
  import "./chunk-5PFNUDXR.js";
@@ -33,8 +33,8 @@ import "./chunk-Z7KVOVE4.js";
33
33
  import "./chunk-WFA6IULY.js";
34
34
  import "./chunk-BWJLLNUX.js";
35
35
  import "./chunk-KRTLS3G6.js";
36
- import "./chunk-TDHD3HNO.js";
37
- import "./chunk-RT7ACF77.js";
36
+ import "./chunk-F4X5NVKY.js";
37
+ import "./chunk-EGY3TS62.js";
38
38
  import "./chunk-W7UBPARG.js";
39
39
  import "./chunk-S5P5Z5Y5.js";
40
40
  import "./chunk-QQJUTGQH.js";
@@ -48,17 +48,17 @@ import "./chunk-UCZBRGJN.js";
48
48
  import "./chunk-7BMX2M3F.js";
49
49
  import "./chunk-3SP6G4LN.js";
50
50
  import "./chunk-ZM27UI5O.js";
51
- import "./chunk-2NRIGEHZ.js";
51
+ import "./chunk-46KVXDUJ.js";
52
52
  import "./chunk-TPN7RJOM.js";
53
53
  import "./chunk-EQW6HOP4.js";
54
54
  import "./chunk-DAOFNU6J.js";
55
55
  import "./chunk-7NSNE52V.js";
56
56
  import "./chunk-C3Z4DX3V.js";
57
- import "./chunk-DU3OIBQE.js";
57
+ import "./chunk-NWNSXHA5.js";
58
58
  import "./chunk-7TF3QOOD.js";
59
59
  import "./chunk-M5JT2AU7.js";
60
60
  import "./chunk-NXMESY4J.js";
61
- import "./chunk-SUA56ZSB.js";
61
+ import "./chunk-LTTZX6RD.js";
62
62
  import "./chunk-ICVIJLBA.js";
63
63
  import "./chunk-76NHL5UG.js";
64
64
  import "./chunk-E6PNTYRK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MONO_FAMILY
3
- } from "./chunk-XCAEHWQB.js";
3
+ } from "./chunk-PAW4RMH3.js";
4
4
  import {
5
5
  FONT_FAMILY
6
6
  } from "./chunk-UTCPNJND.js";
@@ -62,4 +62,4 @@ function escapeXml(s) {
62
62
  export {
63
63
  renderLiveLinkCard
64
64
  };
65
- //# sourceMappingURL=chunk-LYLRNAX2.js.map
65
+ //# sourceMappingURL=chunk-3EGIU5WY.js.map