@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.
- package/.claude/commands/dgmo.md +60 -72
- package/dist/cli.cjs +119 -114
- package/dist/editor.cjs +0 -2
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.js +0 -2
- package/dist/editor.js.map +1 -1
- package/dist/highlight.cjs +0 -2
- package/dist/highlight.cjs.map +1 -1
- package/dist/highlight.js +0 -2
- package/dist/highlight.js.map +1 -1
- package/dist/index.cjs +690 -278
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -18
- package/dist/index.d.ts +105 -18
- package/dist/index.js +680 -277
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +348 -51
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +93 -5
- package/dist/internal.d.ts +93 -5
- package/dist/internal.js +334 -38
- package/dist/internal.js.map +1 -1
- package/docs/guide/chart-area.md +17 -17
- package/docs/guide/chart-bar-stacked.md +12 -12
- package/docs/guide/chart-doughnut.md +10 -10
- package/docs/guide/chart-funnel.md +9 -9
- package/docs/guide/chart-heatmap.md +10 -10
- package/docs/guide/chart-kanban.md +2 -0
- package/docs/guide/chart-line.md +19 -19
- package/docs/guide/chart-multi-line.md +16 -16
- package/docs/guide/chart-pie.md +11 -11
- package/docs/guide/chart-polar-area.md +10 -10
- package/docs/guide/chart-radar.md +9 -9
- package/docs/guide/chart-scatter.md +24 -27
- package/docs/guide/index.md +3 -3
- package/docs/language-reference.md +46 -25
- package/fonts/Inter-Bold.ttf +0 -0
- package/fonts/Inter-Regular.ttf +0 -0
- package/fonts/LICENSE-Inter.txt +92 -0
- package/gallery/fixtures/bar-stacked.dgmo +12 -6
- package/gallery/fixtures/heatmap.dgmo +12 -6
- package/gallery/fixtures/multi-line.dgmo +11 -7
- package/gallery/fixtures/quadrant.dgmo +8 -8
- package/gallery/fixtures/scatter.dgmo +12 -12
- package/package.json +4 -2
- package/src/boxes-and-lines/parser.ts +13 -2
- package/src/boxes-and-lines/renderer.ts +22 -13
- package/src/chart-type-scoring.ts +162 -0
- package/src/chart-types.ts +437 -0
- package/src/cli.ts +147 -66
- package/src/completion.ts +0 -4
- package/src/d3.ts +9 -2
- package/src/dgmo-router.ts +85 -130
- package/src/editor/keywords.ts +0 -2
- package/src/fonts.ts +3 -2
- package/src/gantt/parser.ts +5 -1
- package/src/index.ts +24 -1
- package/src/infra/parser.ts +1 -1
- package/src/internal.ts +6 -2
- package/src/journey-map/layout.ts +7 -3
- package/src/journey-map/parser.ts +5 -1
- package/src/kanban/parser.ts +5 -1
- package/src/org/collapse.ts +1 -4
- package/src/org/parser.ts +1 -1
- package/src/org/renderer.ts +26 -17
- package/src/sequence/parser.ts +2 -2
- package/src/sequence/participant-inference.ts +0 -1
- package/src/sequence/renderer.ts +95 -263
- package/src/sharing.ts +0 -1
- package/src/sitemap/parser.ts +1 -1
- package/src/utils/tag-groups.ts +35 -5
- package/src/wireframe/parser.ts +3 -1
package/src/utils/tag-groups.ts
CHANGED
|
@@ -293,14 +293,32 @@ export function validateTagValues(
|
|
|
293
293
|
// ── Tag Group Name Validation ────────────────────────────
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
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<{
|
|
302
|
-
|
|
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
|
|
package/src/wireframe/parser.ts
CHANGED
|
@@ -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')!)
|