@markdy/core 0.7.26 → 0.7.28

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
@@ -197,7 +197,7 @@ declare const PRESET_NAMES: readonly string[];
197
197
  */
198
198
  declare const BUILTIN_ACTOR_TYPES: readonly BuiltinActorType[];
199
199
  /** Actions valid on every actor type. */
200
- declare const UNIVERSAL_ACTION_NAMES: readonly ["enter", "exit", "move", "fade_in", "fade_out", "scale", "rotate", "shake", "say", "throw", "play"];
200
+ declare const UNIVERSAL_ACTION_NAMES: readonly ["enter", "exit", "move", "spring", "follow_path", "fade_in", "fade_out", "scale", "rotate", "shake", "pulse", "glow", "ripple", "blur", "line_reveal", "mask", "parallax", "say", "throw", "play"];
201
201
  /**
202
202
  * Actions that require a `figure` actor. Applying one to any other actor
203
203
  * type is a hard `ParseError`, not a soft warning — it's always a mistake.
@@ -212,4 +212,8 @@ type ActorPack = {
212
212
  };
213
213
  declare function registerActorPack(pack: ActorPack): void;
214
214
 
215
- export { type ActorDef, type ActorPack, type ActorType, type AssetDef, BUILTIN_ACTOR_TYPES, type BuiltinActorType, CAMERA_ACTION_NAMES, type Chapter, FIGURE_ONLY_ACTION_NAMES, type ImportDecl, PRESETS, PRESET_NAMES, ParseError, type ParseOptions, type ParseWarning, type PresetFn, type SceneAST, type SceneMeta, type SequenceDef, type TemplateDef, type TimelineEvent, UNIVERSAL_ACTION_NAMES, parse, registerActorPack };
215
+ 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"];
216
+ declare const VISUAL_PRIMITIVE_TYPES: readonly ["panel", "surface", "terminal", "metric", "stat", "grid", "matrix", "lane", "track", "marker", "dot", "token_strip", "chips", "glyph_card", "glyph"];
217
+ declare const TECHNICAL_NODE_KINDS: Record<(typeof TECHNICAL_NODE_TYPES)[number], string>;
218
+
219
+ export { type ActorDef, type ActorPack, type ActorType, type AssetDef, BUILTIN_ACTOR_TYPES, type BuiltinActorType, CAMERA_ACTION_NAMES, type Chapter, FIGURE_ONLY_ACTION_NAMES, type ImportDecl, PRESETS, PRESET_NAMES, ParseError, type ParseOptions, type ParseWarning, type PresetFn, type SceneAST, type SceneMeta, type SequenceDef, TECHNICAL_NODE_KINDS, TECHNICAL_NODE_TYPES, type TemplateDef, type TimelineEvent, UNIVERSAL_ACTION_NAMES, VISUAL_PRIMITIVE_TYPES, parse, registerActorPack };
package/dist/index.js CHANGED
@@ -236,11 +236,20 @@ var UNIVERSAL_ACTION_NAMES = [
236
236
  "enter",
237
237
  "exit",
238
238
  "move",
239
+ "spring",
240
+ "follow_path",
239
241
  "fade_in",
240
242
  "fade_out",
241
243
  "scale",
242
244
  "rotate",
243
245
  "shake",
246
+ "pulse",
247
+ "glow",
248
+ "ripple",
249
+ "blur",
250
+ "line_reveal",
251
+ "mask",
252
+ "parallax",
244
253
  "say",
245
254
  "throw",
246
255
  "play"
@@ -290,6 +299,349 @@ function isKnownAction(actorType, action) {
290
299
  return actorActions.get(actorType)?.has(action) ?? false;
291
300
  }
292
301
 
302
+ // src/system-vocabulary.ts
303
+ var TECHNICAL_NODE_TYPES = [
304
+ "service",
305
+ "api",
306
+ "microservice",
307
+ "backend",
308
+ "server",
309
+ "worker",
310
+ "job",
311
+ "scheduler",
312
+ "cron",
313
+ "batch",
314
+ "function",
315
+ "lambda",
316
+ "edge",
317
+ "controller",
318
+ "handler",
319
+ "repository",
320
+ "module",
321
+ "package",
322
+ "library",
323
+ "sdk",
324
+ "cli",
325
+ "runtime",
326
+ "process",
327
+ "client",
328
+ "user",
329
+ "browser",
330
+ "web",
331
+ "mobile",
332
+ "desktop",
333
+ "frontend",
334
+ "app",
335
+ "page",
336
+ "view",
337
+ "component",
338
+ "store",
339
+ "db",
340
+ "database",
341
+ "sql",
342
+ "nosql",
343
+ "table",
344
+ "index",
345
+ "warehouse",
346
+ "lake",
347
+ "object_store",
348
+ "bucket",
349
+ "blob",
350
+ "volume",
351
+ "disk",
352
+ "search",
353
+ "cache",
354
+ "queue",
355
+ "topic",
356
+ "stream",
357
+ "event",
358
+ "event_bus",
359
+ "bus",
360
+ "broker",
361
+ "pubsub",
362
+ "kafka",
363
+ "producer",
364
+ "consumer",
365
+ "dead_letter",
366
+ "dlq",
367
+ "webhook",
368
+ "cloud",
369
+ "region",
370
+ "vpc",
371
+ "subnet",
372
+ "network",
373
+ "internet",
374
+ "dns",
375
+ "cdn",
376
+ "proxy",
377
+ "gateway",
378
+ "api_gateway",
379
+ "load_balancer",
380
+ "reverse_proxy",
381
+ "router",
382
+ "switch",
383
+ "nat",
384
+ "firewall",
385
+ "waf",
386
+ "vpn",
387
+ "bastion",
388
+ "container",
389
+ "cluster",
390
+ "pod",
391
+ "node",
392
+ "deployment",
393
+ "replicaset",
394
+ "statefulset",
395
+ "daemonset",
396
+ "namespace",
397
+ "ingress",
398
+ "service_mesh",
399
+ "sidecar",
400
+ "image",
401
+ "registry",
402
+ "docker",
403
+ "compose",
404
+ "helm",
405
+ "chart",
406
+ "configmap",
407
+ "pvc",
408
+ "auth",
409
+ "identity",
410
+ "oauth",
411
+ "oidc",
412
+ "jwt",
413
+ "session",
414
+ "policy",
415
+ "role",
416
+ "permission",
417
+ "vault",
418
+ "secret",
419
+ "key",
420
+ "certificate",
421
+ "repo",
422
+ "branch",
423
+ "commit",
424
+ "pipeline",
425
+ "workflow",
426
+ "runner",
427
+ "build",
428
+ "test",
429
+ "artifact",
430
+ "deploy",
431
+ "release",
432
+ "environment",
433
+ "preview",
434
+ "monitor",
435
+ "metrics",
436
+ "logs",
437
+ "trace",
438
+ "alert",
439
+ "dashboard",
440
+ "probe",
441
+ "slo",
442
+ "start",
443
+ "end",
444
+ "state",
445
+ "decision",
446
+ "condition",
447
+ "step",
448
+ "loop",
449
+ "sequence",
450
+ "participant",
451
+ "replica",
452
+ "shard",
453
+ "leader",
454
+ "follower",
455
+ "quorum",
456
+ "consensus",
457
+ "lock",
458
+ "class",
459
+ "interface",
460
+ "method",
461
+ "object",
462
+ "enum",
463
+ "type"
464
+ ];
465
+ var VISUAL_PRIMITIVE_TYPES = [
466
+ "panel",
467
+ "surface",
468
+ "terminal",
469
+ "metric",
470
+ "stat",
471
+ "grid",
472
+ "matrix",
473
+ "lane",
474
+ "track",
475
+ "marker",
476
+ "dot",
477
+ "token_strip",
478
+ "chips",
479
+ "glyph_card",
480
+ "glyph"
481
+ ];
482
+ var TECHNICAL_NODE_KINDS = {
483
+ service: "compute",
484
+ api: "compute",
485
+ microservice: "compute",
486
+ backend: "compute",
487
+ server: "compute",
488
+ worker: "compute",
489
+ job: "compute",
490
+ scheduler: "compute",
491
+ cron: "compute",
492
+ batch: "compute",
493
+ function: "compute",
494
+ lambda: "compute",
495
+ edge: "compute",
496
+ controller: "compute",
497
+ handler: "compute",
498
+ repository: "compute",
499
+ runtime: "compute",
500
+ process: "compute",
501
+ module: "code",
502
+ package: "code",
503
+ library: "code",
504
+ sdk: "code",
505
+ cli: "code",
506
+ class: "code",
507
+ interface: "code",
508
+ method: "code",
509
+ object: "code",
510
+ enum: "code",
511
+ type: "code",
512
+ client: "client",
513
+ user: "client",
514
+ browser: "client",
515
+ web: "client",
516
+ mobile: "client",
517
+ desktop: "client",
518
+ frontend: "client",
519
+ app: "client",
520
+ page: "client",
521
+ view: "client",
522
+ component: "client",
523
+ store: "client",
524
+ db: "data",
525
+ database: "data",
526
+ sql: "data",
527
+ nosql: "data",
528
+ table: "data",
529
+ index: "data",
530
+ warehouse: "data",
531
+ lake: "data",
532
+ object_store: "data",
533
+ bucket: "data",
534
+ blob: "data",
535
+ volume: "data",
536
+ disk: "data",
537
+ search: "data",
538
+ cache: "data",
539
+ queue: "messaging",
540
+ topic: "messaging",
541
+ stream: "messaging",
542
+ event: "messaging",
543
+ event_bus: "messaging",
544
+ bus: "messaging",
545
+ broker: "messaging",
546
+ pubsub: "messaging",
547
+ kafka: "messaging",
548
+ producer: "messaging",
549
+ consumer: "messaging",
550
+ dead_letter: "messaging",
551
+ dlq: "messaging",
552
+ webhook: "messaging",
553
+ cloud: "network",
554
+ region: "network",
555
+ vpc: "network",
556
+ subnet: "network",
557
+ network: "network",
558
+ internet: "network",
559
+ dns: "network",
560
+ cdn: "network",
561
+ proxy: "network",
562
+ gateway: "network",
563
+ api_gateway: "network",
564
+ load_balancer: "network",
565
+ reverse_proxy: "network",
566
+ router: "network",
567
+ switch: "network",
568
+ nat: "network",
569
+ firewall: "network",
570
+ waf: "network",
571
+ vpn: "network",
572
+ bastion: "network",
573
+ container: "platform",
574
+ cluster: "platform",
575
+ pod: "platform",
576
+ node: "platform",
577
+ deployment: "platform",
578
+ replicaset: "platform",
579
+ statefulset: "platform",
580
+ daemonset: "platform",
581
+ namespace: "platform",
582
+ ingress: "platform",
583
+ service_mesh: "platform",
584
+ sidecar: "platform",
585
+ image: "platform",
586
+ registry: "platform",
587
+ docker: "platform",
588
+ compose: "platform",
589
+ helm: "platform",
590
+ chart: "platform",
591
+ configmap: "platform",
592
+ pvc: "platform",
593
+ auth: "security",
594
+ identity: "security",
595
+ oauth: "security",
596
+ oidc: "security",
597
+ jwt: "security",
598
+ session: "security",
599
+ policy: "security",
600
+ role: "security",
601
+ permission: "security",
602
+ vault: "security",
603
+ secret: "security",
604
+ key: "security",
605
+ certificate: "security",
606
+ repo: "delivery",
607
+ branch: "delivery",
608
+ commit: "delivery",
609
+ pipeline: "delivery",
610
+ workflow: "delivery",
611
+ runner: "delivery",
612
+ build: "delivery",
613
+ test: "delivery",
614
+ artifact: "delivery",
615
+ deploy: "delivery",
616
+ release: "delivery",
617
+ environment: "delivery",
618
+ preview: "delivery",
619
+ monitor: "observability",
620
+ metrics: "observability",
621
+ logs: "observability",
622
+ trace: "observability",
623
+ alert: "observability",
624
+ dashboard: "observability",
625
+ probe: "observability",
626
+ slo: "observability",
627
+ start: "flow",
628
+ end: "flow",
629
+ state: "flow",
630
+ decision: "flow",
631
+ condition: "flow",
632
+ step: "flow",
633
+ loop: "flow",
634
+ sequence: "flow",
635
+ participant: "flow",
636
+ replica: "distributed",
637
+ shard: "distributed",
638
+ leader: "distributed",
639
+ follower: "distributed",
640
+ quorum: "distributed",
641
+ consensus: "distributed",
642
+ lock: "distributed"
643
+ };
644
+
293
645
  // src/parser.ts
294
646
  var ParseError = class extends Error {
295
647
  constructor(message, line) {
@@ -517,6 +869,24 @@ var SEQ_EVENT_RE = /^@\+([\d.]+):\s+\$\.(!?\w+)\((.*)\)$/;
517
869
  var CHAPTER_HEADER_RE = /^scene\s+"([^"]+)"\s*\{$/;
518
870
  var IMPORT_RE = /^import\s+"([^"]+)"\s+as\s+(\w+)\s*$/;
519
871
  var PRESET_RE = /^preset\s+(\w+)(?:\s*\((.*)\))?\s*$/;
872
+ var ARCHITECTURE_NODE_RE = new RegExp(
873
+ `^(${TECHNICAL_NODE_TYPES.join("|")})\\s+(\\w+)(?:\\s+("[^"]+"|'[^']+'))?(?:\\s+at\\s+\\(\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*\\))?(.*)$`
874
+ );
875
+ var ARCHITECTURE_ALIAS_TO_TYPE = {
876
+ api: "service",
877
+ database: "database",
878
+ db: "db",
879
+ user: "client",
880
+ client: "client",
881
+ service: "service",
882
+ queue: "queue",
883
+ cache: "cache",
884
+ cloud: "cloud",
885
+ region: "region",
886
+ container: "container",
887
+ microservice: "microservice",
888
+ cluster: "cluster"
889
+ };
520
890
  function interpolate(s, vars) {
521
891
  return s.replace(
522
892
  /\\?\$\{([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*)\}/g,
@@ -779,7 +1149,7 @@ function parse(source, opts = {}) {
779
1149
  }
780
1150
  continue;
781
1151
  }
782
- if (raw.startsWith("actor ")) {
1152
+ if (raw.startsWith("actor ") || isArchitectureNodeLine(raw)) {
783
1153
  const actorInfo = parseActorLine(raw, lineNum, ast);
784
1154
  if (!actorCountWarned && actorCountWarningThreshold > 0) {
785
1155
  const actorCount = Object.keys(ast.actors).length;
@@ -845,6 +1215,8 @@ function parseActorCallArgs(argsRaw) {
845
1215
  });
846
1216
  }
847
1217
  function parseActorLine(raw, lineNum, ast) {
1218
+ const architectureNode = parseArchitectureNodeLine(raw, lineNum, ast);
1219
+ if (architectureNode) return architectureNode;
848
1220
  const amAnchor = ACTOR_ANCHOR_POS_RE.exec(raw);
849
1221
  const amNum = amAnchor ? null : ACTOR_NUM_POS_RE.exec(raw);
850
1222
  if (!amAnchor && !amNum) throw new ParseError(`Invalid actor declaration: ${raw}`, lineNum);
@@ -935,6 +1307,57 @@ function parseActorLine(raw, lineNum, ast) {
935
1307
  };
936
1308
  return { name, args: resolvedArgs };
937
1309
  }
1310
+ function isArchitectureNodeLine(raw) {
1311
+ return ARCHITECTURE_NODE_RE.test(raw);
1312
+ }
1313
+ function parseArchitectureNodeLine(raw, lineNum, ast) {
1314
+ const m = ARCHITECTURE_NODE_RE.exec(raw);
1315
+ if (!m) return null;
1316
+ const [, alias, name, labelRaw, xRaw, yRaw, trailer] = m;
1317
+ if (name === "camera") {
1318
+ throw new ParseError(
1319
+ `"camera" is a reserved actor name; choose a different architecture node name`,
1320
+ lineNum
1321
+ );
1322
+ }
1323
+ const typeName = ARCHITECTURE_ALIAS_TO_TYPE[alias] ?? alias;
1324
+ if (!isKnownActorType(typeName)) {
1325
+ throw new ParseError(
1326
+ `Architecture node "${alias}" requires an actor pack that registers type "${typeName}"`,
1327
+ lineNum
1328
+ );
1329
+ }
1330
+ const actorIndex = Object.keys(ast.actors).length;
1331
+ const x = xRaw === void 0 ? autoNodeX(actorIndex, ast.meta.width) : Number(xRaw);
1332
+ const y = yRaw === void 0 ? autoNodeY(actorIndex, ast.meta.height, ast.meta.width) : Number(yRaw);
1333
+ if (x < 0 || x > ast.meta.width || y < 0 || y > ast.meta.height) {
1334
+ throw new ParseError(
1335
+ `Actor "${name}" position (${x}, ${y}) is outside scene bounds (0\u2013${ast.meta.width}, 0\u2013${ast.meta.height})`,
1336
+ lineNum
1337
+ );
1338
+ }
1339
+ const quoted = labelRaw ? parseQuotedLiteral(labelRaw.trim()) : null;
1340
+ const label = quoted ?? labelRaw?.trim() ?? name;
1341
+ const modifiers = parseActorTrailer(trailer, lineNum, ast.warnings);
1342
+ ast.actors[name] = {
1343
+ type: typeName,
1344
+ args: [label],
1345
+ x,
1346
+ y,
1347
+ ...modifiers
1348
+ };
1349
+ return { name, args: [label] };
1350
+ }
1351
+ function autoNodeX(index, width) {
1352
+ const columns = Math.max(1, Math.floor(width / 220));
1353
+ const gutter = width / (columns + 1);
1354
+ return Math.round(gutter * (index % columns + 1));
1355
+ }
1356
+ function autoNodeY(index, height, width = DEFAULTS.width) {
1357
+ const columns = Math.max(1, Math.floor(width / 220));
1358
+ const row = Math.floor(index / columns);
1359
+ return Math.min(height - 60, 90 + row * 120);
1360
+ }
938
1361
  var GROUP_RE = /^group\s+([A-Za-z_][\w.]*)\s*=\s*(.+)$/;
939
1362
  function parseGroupLine(raw, lineNum, ast) {
940
1363
  const m = GROUP_RE.exec(raw);
@@ -1208,7 +1631,10 @@ export {
1208
1631
  PRESETS,
1209
1632
  PRESET_NAMES,
1210
1633
  ParseError,
1634
+ TECHNICAL_NODE_KINDS,
1635
+ TECHNICAL_NODE_TYPES,
1211
1636
  UNIVERSAL_ACTION_NAMES,
1637
+ VISUAL_PRIMITIVE_TYPES,
1212
1638
  parse,
1213
1639
  registerActorPack
1214
1640
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/core",
3
- "version": "0.7.26",
3
+ "version": "0.7.28",
4
4
  "description": "MarkdyScript parser and AST types — zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",