@diagrammo/dgmo 0.8.23 → 0.8.25

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 (72) hide show
  1. package/.claude/commands/dgmo.md +60 -72
  2. package/dist/cli.cjs +119 -114
  3. package/dist/editor.cjs +0 -2
  4. package/dist/editor.cjs.map +1 -1
  5. package/dist/editor.js +0 -2
  6. package/dist/editor.js.map +1 -1
  7. package/dist/highlight.cjs +0 -2
  8. package/dist/highlight.cjs.map +1 -1
  9. package/dist/highlight.js +0 -2
  10. package/dist/highlight.js.map +1 -1
  11. package/dist/index.cjs +690 -278
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +105 -18
  14. package/dist/index.d.ts +105 -18
  15. package/dist/index.js +680 -277
  16. package/dist/index.js.map +1 -1
  17. package/dist/internal.cjs +348 -51
  18. package/dist/internal.cjs.map +1 -1
  19. package/dist/internal.d.cts +93 -5
  20. package/dist/internal.d.ts +93 -5
  21. package/dist/internal.js +334 -38
  22. package/dist/internal.js.map +1 -1
  23. package/docs/guide/chart-area.md +17 -17
  24. package/docs/guide/chart-bar-stacked.md +12 -12
  25. package/docs/guide/chart-doughnut.md +10 -10
  26. package/docs/guide/chart-funnel.md +9 -9
  27. package/docs/guide/chart-heatmap.md +10 -10
  28. package/docs/guide/chart-kanban.md +2 -0
  29. package/docs/guide/chart-line.md +19 -19
  30. package/docs/guide/chart-multi-line.md +16 -16
  31. package/docs/guide/chart-pie.md +11 -11
  32. package/docs/guide/chart-polar-area.md +10 -10
  33. package/docs/guide/chart-radar.md +9 -9
  34. package/docs/guide/chart-scatter.md +24 -27
  35. package/docs/guide/index.md +3 -3
  36. package/docs/language-reference.md +46 -25
  37. package/fonts/Inter-Bold.ttf +0 -0
  38. package/fonts/Inter-Regular.ttf +0 -0
  39. package/fonts/LICENSE-Inter.txt +92 -0
  40. package/gallery/fixtures/bar-stacked.dgmo +12 -6
  41. package/gallery/fixtures/heatmap.dgmo +12 -6
  42. package/gallery/fixtures/multi-line.dgmo +11 -7
  43. package/gallery/fixtures/quadrant.dgmo +8 -8
  44. package/gallery/fixtures/scatter.dgmo +12 -12
  45. package/package.json +4 -2
  46. package/src/boxes-and-lines/parser.ts +13 -2
  47. package/src/boxes-and-lines/renderer.ts +22 -13
  48. package/src/chart-type-scoring.ts +162 -0
  49. package/src/chart-types.ts +437 -0
  50. package/src/cli.ts +147 -66
  51. package/src/completion.ts +0 -4
  52. package/src/d3.ts +9 -2
  53. package/src/dgmo-router.ts +85 -130
  54. package/src/editor/keywords.ts +0 -2
  55. package/src/fonts.ts +3 -2
  56. package/src/gantt/parser.ts +5 -1
  57. package/src/index.ts +24 -1
  58. package/src/infra/parser.ts +1 -1
  59. package/src/internal.ts +6 -2
  60. package/src/journey-map/layout.ts +7 -3
  61. package/src/journey-map/parser.ts +5 -1
  62. package/src/kanban/parser.ts +5 -1
  63. package/src/org/collapse.ts +1 -4
  64. package/src/org/parser.ts +1 -1
  65. package/src/org/renderer.ts +26 -17
  66. package/src/sequence/parser.ts +2 -2
  67. package/src/sequence/participant-inference.ts +0 -1
  68. package/src/sequence/renderer.ts +95 -263
  69. package/src/sharing.ts +0 -1
  70. package/src/sitemap/parser.ts +1 -1
  71. package/src/utils/tag-groups.ts +35 -5
  72. package/src/wireframe/parser.ts +3 -1
@@ -293,14 +293,32 @@ export function validateTagValues(
293
293
  // ── Tag Group Name Validation ────────────────────────────
294
294
 
295
295
  /**
296
- * Warn when a tag group uses the reserved name "none" (case-insensitive).
297
- * Should be called alongside `validateTagValues()` in each parser's
298
- * post-parse validation.
296
+ * Valid identifier for use as a `data-tag-<name>` attribute suffix.
297
+ * Must start with a letter or underscore, then letters/digits/underscore/hyphen only.
298
+ * Spaces and punctuation are rejected because they produce invalid DOM attribute
299
+ * names (setAttribute throws "Invalid qualified name").
300
+ */
301
+ const VALID_TAG_IDENT_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;
302
+
303
+ /**
304
+ * Validate tag group names (and aliases) for reserved keywords and DOM-safe
305
+ * identifier syntax. Should be called alongside `validateTagValues()` in each
306
+ * parser's post-parse validation.
307
+ *
308
+ * - Reserved name `none` (case-insensitive) → warning
309
+ * - Name or alias containing chars invalid for a `data-tag-*` attribute → error
310
+ * (falls back to `pushWarning` if `pushError` is not supplied)
299
311
  */
300
312
  export function validateTagGroupNames(
301
- tagGroups: ReadonlyArray<{ name: string; lineNumber: number }>,
302
- pushWarning: (lineNumber: number, message: string) => void
313
+ tagGroups: ReadonlyArray<{
314
+ name: string;
315
+ alias?: string | null;
316
+ lineNumber: number;
317
+ }>,
318
+ pushWarning: (lineNumber: number, message: string) => void,
319
+ pushError?: (lineNumber: number, message: string) => void
303
320
  ): void {
321
+ const report = pushError ?? pushWarning;
304
322
  for (const group of tagGroups) {
305
323
  if (group.name.toLowerCase() === 'none') {
306
324
  pushWarning(
@@ -308,6 +326,18 @@ export function validateTagGroupNames(
308
326
  `'none' is a reserved keyword and cannot be used as a tag group name`
309
327
  );
310
328
  }
329
+ if (!VALID_TAG_IDENT_RE.test(group.name)) {
330
+ report(
331
+ group.lineNumber,
332
+ `Tag group name "${group.name}" contains invalid characters — use a single identifier (letters, digits, underscore, hyphen)`
333
+ );
334
+ }
335
+ if (group.alias != null && !VALID_TAG_IDENT_RE.test(group.alias)) {
336
+ report(
337
+ group.lineNumber,
338
+ `Tag group alias "${group.alias}" contains invalid characters — use a single identifier (letters, digits, underscore, hyphen)`
339
+ );
340
+ }
311
341
  }
312
342
  }
313
343
 
@@ -871,7 +871,9 @@ export function parseWireframe(content: string): ParsedWireframe {
871
871
  }
872
872
 
873
873
  // Validate tag groups
874
- validateTagGroupNames(tagGroups, pushWarning);
874
+ validateTagGroupNames(tagGroups, pushWarning, (line, msg) => {
875
+ diagnostics.push(makeDgmoError(line, msg));
876
+ });
875
877
 
876
878
  const error = diagnostics.find((d) => d.severity === 'error')
877
879
  ? formatDgmoError(diagnostics.find((d) => d.severity === 'error')!)