@markdy/core 0.8.20 → 0.8.22

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/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  type LayoutDirection = "LR" | "RL" | "TB" | "BT";
6
6
  type EdgeKind = "request" | "response" | "event" | "dependency";
7
- type DiagramType = "architecture" | "flowchart" | "tree" | "state" | "sequence" | "constellation";
7
+ type DiagramType = "architecture" | "flowchart" | "tree" | "state" | "sequence" | "constellation" | "loop" | "flywheel" | "medallion" | "quadrant" | "swimlane" | "pyramid" | "radar" | "timeline" | "gantt" | "venn" | "layers" | "nested";
8
8
  type NodeShape = "card" | "rounded" | "diamond" | "circle" | "pill" | "terminal";
9
9
  type SceneMeta = {
10
10
  title?: string;
@@ -60,6 +60,8 @@ type AnnotationDecl = {
60
60
  text: string;
61
61
  target?: string;
62
62
  position?: string;
63
+ /** Callout color intent: neutral (default), accent, or muted. */
64
+ intent?: string;
63
65
  props: Record<string, unknown>;
64
66
  line: number;
65
67
  };
@@ -185,6 +187,8 @@ type ThemeTokens = {
185
187
  flatCards?: boolean;
186
188
  roles: Record<string, string>;
187
189
  edges: Record<EdgeKind, string>;
190
+ /** Multi-series palette for chart types (radar, line, bar). */
191
+ series?: string[];
188
192
  fonts?: {
189
193
  title?: string;
190
194
  nodeName?: string;
@@ -325,6 +329,25 @@ declare function parseAndCompile(source: string): ParseResult;
325
329
  declare const THEMES: Record<string, ThemeTokens>;
326
330
  declare function resolveTheme(name: string): ThemeTokens;
327
331
 
332
+ /**
333
+ * packages/core/src/theme-generator.ts
334
+ * Algorithmic Theme Token Generator for Markdy.
335
+ * Computes WCAG-compliant high-contrast theme palettes from any base brand color.
336
+ * Zero external dependencies.
337
+ */
338
+
339
+ interface ThemeGeneratorOptions {
340
+ name: string;
341
+ accentHex: string;
342
+ mode?: "light" | "dark";
343
+ canvasHex?: string;
344
+ inkHex?: string;
345
+ }
346
+ /**
347
+ * Dynamically computes a cohesive ThemeTokens set from an accent color.
348
+ */
349
+ declare function generateThemeFromBrand(opts: ThemeGeneratorOptions): ThemeTokens;
350
+
328
351
  declare const NODE_KINDS: Set<string>;
329
352
  declare const DIAGRAM_TYPES: Set<string>;
330
353
  declare const EDGE_OPERATORS: Record<string, "request" | "response" | "event" | "dependency">;
@@ -338,8 +361,180 @@ declare function humanizeId(id: string): string;
338
361
  declare const NODE_ALIASES: Record<string, string>;
339
362
  declare function canonicalNodeKind(kind: string): string;
340
363
 
341
- declare const TECHNICAL_NODE_TYPES: readonly ["service", "api", "microservice", "backend", "server", "worker", "job", "scheduler", "cron", "batch", "function", "lambda", "edge", "controller", "handler", "repository", "module", "package", "library", "sdk", "cli", "runtime", "process", "client", "user", "browser", "web", "mobile", "desktop", "frontend", "app", "page", "view", "component", "store", "db", "database", "sql", "nosql", "table", "index", "warehouse", "lake", "object_store", "bucket", "blob", "volume", "disk", "search", "cache", "queue", "topic", "stream", "event", "event_bus", "bus", "broker", "pubsub", "kafka", "producer", "consumer", "dead_letter", "dlq", "webhook", "cloud", "region", "vpc", "subnet", "network", "internet", "dns", "cdn", "proxy", "gateway", "api_gateway", "load_balancer", "reverse_proxy", "router", "switch", "nat", "firewall", "waf", "vpn", "bastion", "container", "cluster", "pod", "node", "deployment", "replicaset", "statefulset", "daemonset", "namespace", "ingress", "service_mesh", "sidecar", "image", "registry", "docker", "compose", "helm", "chart", "configmap", "pvc", "auth", "identity", "oauth", "oidc", "jwt", "session", "policy", "role", "permission", "vault", "secret", "key", "certificate", "repo", "branch", "commit", "pipeline", "workflow", "runner", "build", "test", "artifact", "deploy", "release", "environment", "preview", "monitor", "metrics", "logs", "trace", "alert", "dashboard", "probe", "slo", "start", "end", "state", "decision", "condition", "step", "loop", "sequence", "participant", "replica", "shard", "leader", "follower", "quorum", "consensus", "lock", "class", "interface", "method", "object", "enum", "type"];
342
- declare const VISUAL_PRIMITIVE_TYPES: readonly ["panel", "surface", "terminal", "metric", "stat", "grid", "matrix", "lane", "track", "marker", "dot", "token_strip", "chips", "glyph_card", "glyph"];
364
+ declare const TECHNICAL_NODE_TYPES: readonly ["service", "api", "microservice", "backend", "server", "worker", "job", "scheduler", "cron", "batch", "function", "lambda", "edge", "controller", "handler", "repository", "module", "package", "library", "sdk", "cli", "runtime", "process", "client", "user", "browser", "web", "mobile", "desktop", "frontend", "app", "page", "view", "component", "store", "db", "database", "sql", "nosql", "table", "index", "warehouse", "lake", "object_store", "storage", "bucket", "blob", "volume", "disk", "search", "cache", "queue", "topic", "stream", "event", "event_bus", "bus", "broker", "pubsub", "kafka", "producer", "consumer", "dead_letter", "dlq", "webhook", "cloud", "region", "vpc", "subnet", "network", "internet", "dns", "cdn", "proxy", "gateway", "api_gateway", "load_balancer", "reverse_proxy", "router", "switch", "nat", "firewall", "waf", "vpn", "bastion", "container", "cluster", "pod", "node", "deployment", "replicaset", "statefulset", "daemonset", "namespace", "ingress", "service_mesh", "sidecar", "image", "registry", "docker", "compose", "helm", "chart", "configmap", "pvc", "auth", "identity", "oauth", "oidc", "jwt", "session", "policy", "role", "permission", "vault", "secret", "key", "certificate", "security", "repo", "branch", "commit", "pipeline", "workflow", "runner", "build", "test", "artifact", "deploy", "release", "environment", "preview", "monitor", "metrics", "logs", "trace", "alert", "dashboard", "probe", "slo", "start", "end", "state", "decision", "condition", "step", "loop", "sequence", "participant", "hub", "station", "bronze", "silver", "gold", "lane", "replica", "shard", "leader", "follower", "quorum", "consensus", "lock", "class", "interface", "method", "object", "enum", "type"];
365
+ declare const VISUAL_PRIMITIVE_TYPES: readonly ["panel", "surface", "terminal", "metric", "stat", "grid", "matrix", "lane", "track", "marker", "dot", "token_strip", "chips", "glyph_card", "glyph", "external", "optional"];
343
366
  declare const TECHNICAL_NODE_KINDS: Record<(typeof TECHNICAL_NODE_TYPES)[number], string>;
344
367
 
345
- export { type AnnotationDecl, BEAT_CUE_KEYWORDS, type BeatDecl, type BeatRange, CUE_ALIASES, type Cue, DIAGRAM_TYPES, type Diagnostic, type DiagramAST, type DiagramType, EDGE_OPERATORS, type EdgeDecl, type EdgeKind, type FlowSegment, type GroupBoundary, type GroupDecl, type LayoutDirection, NODE_ALIASES, NODE_KINDS, type NodeDecl, type NodeShape, ParseError, type ParseOptions, type ParseResult, type PatternDecl, type PositionedNode, type RenderPlan, type RoutedEdge, SCENE_KEYS, type SceneMeta, type SequenceActivation, type SequenceMessage, type StyleDecl, TECHNICAL_NODE_KINDS, TECHNICAL_NODE_TYPES, THEMES, type ThemeTokens, type TimedCue, type TreeBus, VISUAL_PRIMITIVE_TYPES, canonicalNodeKind, compile, compilePlan, humanizeId, nodeRole, parse, parseAndCompile, resolveTheme };
368
+ /**
369
+ * packages/core/src/arch-lint.ts
370
+ * Architecture topology and governance validation for MarkdyScript ASTs.
371
+ * Zero runtime dependencies.
372
+ */
373
+
374
+ type RuleSeverity = "error" | "warning" | "info";
375
+ type ArchRuleType = "cannot-connect" | "must-connect" | "forbidden-cycle" | "must-have-role" | "role-count-limit";
376
+ interface NodeSelector {
377
+ id?: string;
378
+ kindEquals?: string;
379
+ roleEquals?: string;
380
+ labelContains?: string;
381
+ }
382
+ interface EdgeSelector {
383
+ kind?: EdgeKind;
384
+ labelContains?: string;
385
+ }
386
+ interface ArchitectureRule {
387
+ id: string;
388
+ name: string;
389
+ description: string;
390
+ severity: RuleSeverity;
391
+ type: ArchRuleType;
392
+ from?: NodeSelector;
393
+ to?: NodeSelector;
394
+ edge?: EdgeSelector;
395
+ min?: number;
396
+ max?: number;
397
+ }
398
+ interface ArchitectureViolation {
399
+ ruleId: string;
400
+ ruleName: string;
401
+ message: string;
402
+ severity: RuleSeverity;
403
+ nodeIds: string[];
404
+ edgeKeys: string[];
405
+ line?: number;
406
+ }
407
+ interface ArchitecturePreset {
408
+ id: string;
409
+ name: string;
410
+ description: string;
411
+ rules: ArchitectureRule[];
412
+ }
413
+ declare const ARCH_RULE_PRESETS: Record<string, ArchitecturePreset>;
414
+ declare function validateArchitecture(ast: DiagramAST, rules?: ArchitectureRule[]): ArchitectureViolation[];
415
+ interface MarkdyConfig {
416
+ extends?: string[];
417
+ rules?: (ArchitectureRule | string)[];
418
+ severityOverrides?: Record<string, RuleSeverity>;
419
+ }
420
+ declare function resolveArchitectureConfig(config?: MarkdyConfig | null): ArchitectureRule[];
421
+
422
+ /**
423
+ * packages/core/src/classifier.ts
424
+ * Deep Technology and Semantic Classifier for Markdy.
425
+ * Zero external dependencies.
426
+ */
427
+ interface SemanticProfile {
428
+ kind: string;
429
+ role: string;
430
+ suggestedTheme: string;
431
+ badge?: string;
432
+ }
433
+ declare function classifyTechnology(id: string, label?: string): SemanticProfile;
434
+
435
+ /**
436
+ * packages/core/src/diff.ts
437
+ * Semantic AST Diffing and Architectural Evolution for MarkdyScript.
438
+ * Zero external dependencies.
439
+ */
440
+
441
+ type DiffChangeType = "added" | "removed" | "modified" | "unchanged";
442
+ interface NodeDiff {
443
+ id: string;
444
+ status: DiffChangeType;
445
+ before?: NodeDecl;
446
+ after?: NodeDecl;
447
+ changes: string[];
448
+ }
449
+ interface EdgeDiff {
450
+ key: string;
451
+ status: DiffChangeType;
452
+ before?: EdgeDecl;
453
+ after?: EdgeDecl;
454
+ }
455
+ interface DiagramDiffResult {
456
+ nodes: NodeDiff[];
457
+ edges: EdgeDiff[];
458
+ addedNodesCount: number;
459
+ removedNodesCount: number;
460
+ modifiedNodesCount: number;
461
+ summaryMarkdown: string;
462
+ evolutionMarkdyScript: string;
463
+ }
464
+ declare function diffDiagramASTs(beforeAST: DiagramAST, afterAST: DiagramAST): DiagramDiffResult;
465
+
466
+ /**
467
+ * packages/core/src/url-codec.ts
468
+ * Web Standard CompressionStream / DecompressionStream state codec for Markdy.
469
+ * Zero external dependencies. Works across modern browsers, Node, Bun, Deno.
470
+ */
471
+ declare function compressMarkdyToUrlHash(code: string): Promise<string>;
472
+ declare function decompressMarkdyFromUrlHash(hash: string): Promise<string>;
473
+
474
+ /**
475
+ * packages/core/src/router.ts
476
+ * Collision-aware Orthogonal Manhattan Router for Markdy.
477
+ * Zero external dependencies.
478
+ */
479
+ interface Point {
480
+ x: number;
481
+ y: number;
482
+ }
483
+ interface Box {
484
+ x: number;
485
+ y: number;
486
+ width: number;
487
+ height: number;
488
+ }
489
+ type CardinalPort = "left" | "right" | "top" | "bottom";
490
+ interface RoutedPath {
491
+ sourcePort: CardinalPort;
492
+ targetPort: CardinalPort;
493
+ startPoint: Point;
494
+ endPoint: Point;
495
+ waypoints: Point[];
496
+ svgPathData: string;
497
+ }
498
+ declare function getBoxPortPosition(box: Box, port: CardinalPort): Point;
499
+ declare function selectOptimalPorts(sourceBox: Box, targetBox: Box): {
500
+ sourcePort: CardinalPort;
501
+ targetPort: CardinalPort;
502
+ };
503
+ declare function routeOrthogonalEdge(sourceBox: Box, targetBox: Box): RoutedPath;
504
+
505
+ /**
506
+ * packages/core/src/ai-healing.ts
507
+ * Self-healing AI Prompt Generation & Diagnostic Repair Loop for Markdy.
508
+ * Zero external dependencies.
509
+ */
510
+
511
+ interface RepairPromptBundle {
512
+ isValid: boolean;
513
+ repairPrompt?: string;
514
+ syntaxErrors: string[];
515
+ archViolations: ArchitectureViolation[];
516
+ }
517
+ declare function analyzeAndBuildRepairPrompt(sourceCode: string): RepairPromptBundle;
518
+
519
+ /**
520
+ * Output size presets for various export targets.
521
+ * Maps named presets to viewBox dimensions and safe margins.
522
+ */
523
+ interface OutputPreset {
524
+ name: string;
525
+ width: number;
526
+ height: number;
527
+ /** Safe margin inset from each edge (px). */
528
+ safeArea: number;
529
+ /** Aspect ratio label for human display. */
530
+ aspect: string;
531
+ /** Intended output context. */
532
+ context: string;
533
+ }
534
+ declare const OUTPUT_PRESETS: Record<string, OutputPreset>;
535
+ /** Resolve a preset by name, falling back to doc-inline. */
536
+ declare function resolveOutputPreset(name: string): OutputPreset;
537
+ /** List all available preset names. */
538
+ declare function listOutputPresets(): string[];
539
+
540
+ export { ARCH_RULE_PRESETS, type AnnotationDecl, type ArchRuleType, type ArchitecturePreset, type ArchitectureRule, type ArchitectureViolation, BEAT_CUE_KEYWORDS, type BeatDecl, type BeatRange, type Box, CUE_ALIASES, type CardinalPort, type Cue, DIAGRAM_TYPES, type Diagnostic, type DiagramAST, type DiagramDiffResult, type DiagramType, type DiffChangeType, EDGE_OPERATORS, type EdgeDecl, type EdgeDiff, type EdgeKind, type EdgeSelector, type FlowSegment, type GroupBoundary, type GroupDecl, type LayoutDirection, type MarkdyConfig, NODE_ALIASES, NODE_KINDS, type NodeDecl, type NodeDiff, type NodeSelector, type NodeShape, OUTPUT_PRESETS, type OutputPreset, ParseError, type ParseOptions, type ParseResult, type PatternDecl, type Point, type PositionedNode, type RenderPlan, type RepairPromptBundle, type RoutedEdge, type RoutedPath, type RuleSeverity, SCENE_KEYS, type SceneMeta, type SemanticProfile, type SequenceActivation, type SequenceMessage, type StyleDecl, TECHNICAL_NODE_KINDS, TECHNICAL_NODE_TYPES, THEMES, type ThemeGeneratorOptions, type ThemeTokens, type TimedCue, type TreeBus, VISUAL_PRIMITIVE_TYPES, analyzeAndBuildRepairPrompt, canonicalNodeKind, classifyTechnology, compile, compilePlan, compressMarkdyToUrlHash, decompressMarkdyFromUrlHash, diffDiagramASTs, generateThemeFromBrand, getBoxPortPosition, humanizeId, listOutputPresets, nodeRole, parse, parseAndCompile, resolveArchitectureConfig, resolveOutputPreset, resolveTheme, routeOrthogonalEdge, selectOptimalPorts, validateArchitecture };