schematex 0.4.3 → 0.5.2
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/README.md +36 -7
- package/dist/ai/ai-sdk.cjs +19 -13
- package/dist/ai/ai-sdk.cjs.map +1 -1
- package/dist/ai/ai-sdk.d.cts +4 -3
- package/dist/ai/ai-sdk.d.ts +4 -3
- package/dist/ai/ai-sdk.js +15 -9
- package/dist/ai/ai-sdk.js.map +1 -1
- package/dist/ai/index.cjs +16 -12
- package/dist/ai/index.d.cts +20 -153
- package/dist/ai/index.d.ts +20 -153
- package/dist/ai/index.js +4 -4
- package/dist/api-C5SECOxZ.d.cts +69 -0
- package/dist/api-Cr_MxttI.d.ts +69 -0
- package/dist/browser.cjs +24 -6
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +12 -3
- package/dist/browser.d.ts +12 -3
- package/dist/browser.js +14 -6
- package/dist/browser.js.map +1 -1
- package/dist/{chunk-SMXU3KYA.cjs → chunk-4QPDZJAL.cjs} +6337 -120
- package/dist/chunk-4QPDZJAL.cjs.map +1 -0
- package/dist/{chunk-N3SLYVNW.cjs → chunk-HK56GQQP.cjs} +751 -80
- package/dist/chunk-HK56GQQP.cjs.map +1 -0
- package/dist/{chunk-KWQTF6ZL.js → chunk-OK5ZS3LU.js} +6330 -119
- package/dist/chunk-OK5ZS3LU.js.map +1 -0
- package/dist/{chunk-2Z543TC3.cjs → chunk-QMTWG6JL.cjs} +1297 -1151
- package/dist/chunk-QMTWG6JL.cjs.map +1 -0
- package/dist/{chunk-VITE3MZQ.cjs → chunk-QTNPMIO2.cjs} +99 -5
- package/dist/chunk-QTNPMIO2.cjs.map +1 -0
- package/dist/{chunk-6IGSKU6D.js → chunk-UFTYX73U.js} +99 -5
- package/dist/chunk-UFTYX73U.js.map +1 -0
- package/dist/{chunk-J7JWMQD5.js → chunk-VCH7RI5H.js} +1297 -1151
- package/dist/chunk-VCH7RI5H.js.map +1 -0
- package/dist/{chunk-UBTKM2TB.js → chunk-VKPCR7BG.js} +751 -81
- package/dist/chunk-VKPCR7BG.js.map +1 -0
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.cjs +7 -7
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.js +1 -1
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/flowchart/index.cjs +7 -7
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/flowchart/index.js +1 -1
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/{index-DYpJXJcy.d.cts → index-BD2yDfQM.d.cts} +1 -1
- package/dist/{index-BeUVaQiD.d.ts → index-C30zQWZI.d.ts} +1 -1
- package/dist/index.cjs +35 -11
- package/dist/index.d.cts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +3 -3
- package/dist/react.cjs +8 -10
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/react.js +8 -10
- package/dist/react.js.map +1 -1
- package/dist/tools-BHWaJPOl.d.ts +153 -0
- package/dist/tools-DlpuE76u.d.cts +153 -0
- package/dist/{types-DKdo-Ua_.d.cts → types-WTr9W5Ud.d.cts} +3 -3
- package/dist/{types-DKdo-Ua_.d.ts → types-WTr9W5Ud.d.ts} +3 -3
- package/package.json +2 -2
- package/dist/api-BIj9t4Oc.d.cts +0 -22
- package/dist/api-BIj9t4Oc.d.ts +0 -22
- package/dist/chunk-2Z543TC3.cjs.map +0 -1
- package/dist/chunk-6IGSKU6D.js.map +0 -1
- package/dist/chunk-J7JWMQD5.js.map +0 -1
- package/dist/chunk-KWQTF6ZL.js.map +0 -1
- package/dist/chunk-N3SLYVNW.cjs.map +0 -1
- package/dist/chunk-SMXU3KYA.cjs.map +0 -1
- package/dist/chunk-UBTKM2TB.js.map +0 -1
- package/dist/chunk-VITE3MZQ.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -29,14 +29,15 @@
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
**Schematex** is the open-source rendering engine for the diagrams professionals actually use — medical, electrical, legal, and analytical.
|
|
32
|
+
**Schematex** is the open-source rendering engine for the diagrams professionals actually use — medical, electrical, legal, and analytical. 31 diagram families across nine domains:
|
|
33
33
|
|
|
34
34
|
- 👪 **Relationships** — genograms, ecomaps, pedigrees, sociograms, phylogenetic trees
|
|
35
35
|
- ⚡ **Electrical & Industrial** — ladder logic, single-line diagrams, circuit schematics, logic gates, timing, block diagrams, **FBD**, **SFC**, breadboard, **P&ID** (ISA-5.1)
|
|
36
36
|
- 🏢 **Corporate & Legal** — entity structures, cap tables
|
|
37
37
|
- 🐟 **Causality & Analysis** — fishbone / Ishikawa, decision trees (Howard-Raiffa EV · CART/sklearn · taxonomy)
|
|
38
|
-
- 🔄 **Behavior modeling** — UML 2.5 / Harel **state diagrams** (Mermaid-compatible superset), **BPMN 2.0** (OMG)
|
|
38
|
+
- 🔄 **Behavior modeling** — UML 2.5 / Harel **state diagrams** (Mermaid-compatible superset), **BPMN 2.0** (OMG), **use case diagrams** (UML 2.5.1 §18), **sequence diagrams** (UML 2.5.1 §17 — all 12 combined fragments + `ref`)
|
|
39
39
|
- 🗄️ **Data modeling** — ERD crow's-foot notation
|
|
40
|
+
- 🗓️ **Project management** — **PERT / CPM** networks (PMBOK 7) that *compute* the schedule: ES/EF/LS/LF, slack, critical path, three-point estimation, swimlanes, time-scaled layout
|
|
40
41
|
- 📅 **Timelines** — proportional / equidistant / log axis · swimlane · gantt · lollipop · BC dates · geological Ma scale
|
|
41
42
|
|
|
42
43
|
Mermaid draws generic flowcharts. Schematex draws the diagrams doctors, engineers, and lawyers actually use — a genogram a genetic counselor accepts clinically, ladder logic that maps 1:1 to IEC 61131-3, a cap table that survives a Series A review.
|
|
@@ -72,7 +73,7 @@ import { render } from 'schematex/genogram';
|
|
|
72
73
|
|
|
73
74
|
## Gallery
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
31 diagram types, one unified pipeline. **Try any of these live at [schematex.dev/playground](https://schematex.dev/playground).**
|
|
76
77
|
|
|
77
78
|
### 👪 Genogram — *McGoldrick family-systems standard*
|
|
78
79
|
|
|
@@ -481,6 +482,26 @@ config: style = gantt
|
|
|
481
482
|
|
|
482
483
|
[Timeline syntax →](https://schematex.dev/docs/timeline)
|
|
483
484
|
|
|
485
|
+
### 🗓️ PERT / CPM — *PMI PMBOK 7 activity-on-node network*
|
|
486
|
+
|
|
487
|
+
The only text-DSL PERT tool that **computes the schedule**. You write tasks, durations, and dependencies — the engine runs the forward and backward pass and returns Early/Late Start & Finish, total slack, project duration, and the critical path (highlighted in red). Supports FS/SS/FF/SF dependencies with lag/lead, three-point estimation (`te + variance`), milestones, swimlanes (`lane:`), and a time-scaled layout.
|
|
488
|
+
|
|
489
|
+
```
|
|
490
|
+
pert
|
|
491
|
+
title: "Q3 Product Launch"
|
|
492
|
+
unit: days
|
|
493
|
+
|
|
494
|
+
task A "Market research" duration: 5
|
|
495
|
+
task B "Design mockups" duration: 8 after: A
|
|
496
|
+
task C "Backend API" duration: 15 after: A
|
|
497
|
+
task D "Frontend build" duration: 10 after: B, C
|
|
498
|
+
task E "QA / testing" duration: 5 after: D
|
|
499
|
+
task F "Marketing collateral" duration: 7 after: B
|
|
500
|
+
task G "Launch event" duration: 2 after: E, F
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
[PERT / CPM syntax →](https://schematex.dev/docs/pert)
|
|
504
|
+
|
|
484
505
|
## Why SchemaTex?
|
|
485
506
|
|
|
486
507
|
**Generic flowchart tools can't draw professional diagrams.** Every diagram domain has published standards — symbol conventions, layout rules, labelling grammars — and when you ignore them, domain experts reject the output:
|
|
@@ -517,16 +538,24 @@ Written by humans, shaped by what LLMs get wrong.
|
|
|
517
538
|
|
|
518
539
|
```ts
|
|
519
540
|
// Universal entry — auto-detects diagram type from first keyword
|
|
520
|
-
import { render, parse } from 'schematex';
|
|
541
|
+
import { render, renderPreview, renderResult, parse, parseResult } from 'schematex';
|
|
521
542
|
|
|
522
|
-
const svg = render(text, config?);
|
|
523
|
-
const ast = parse(text, config?);
|
|
543
|
+
const svg = render(text, config?); // strict → SVG string or throw
|
|
544
|
+
const ast = parse(text, config?); // strict → AST or throw
|
|
545
|
+
const previewSvg = renderPreview(text, config?); // always → SVG, including a visible diagnostic fallback
|
|
546
|
+
const renderState = renderResult(text, config?); // → SVG + diagnostics + valid/partial/invalid status
|
|
547
|
+
const parseState = parseResult(text, config?); // → AST or diagnostics without throwing
|
|
524
548
|
|
|
525
549
|
// Per-diagram tree-shaking
|
|
526
550
|
import { render } from 'schematex/genogram';
|
|
527
551
|
|
|
528
552
|
// Browser DOM
|
|
529
|
-
import {
|
|
553
|
+
import {
|
|
554
|
+
renderToElement,
|
|
555
|
+
renderToContainer,
|
|
556
|
+
renderPreviewToElement,
|
|
557
|
+
renderPreviewToContainer,
|
|
558
|
+
} from 'schematex/browser';
|
|
530
559
|
container.appendChild(renderToElement(dsl));
|
|
531
560
|
|
|
532
561
|
// React
|
package/dist/ai/ai-sdk.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkHK56GQQP_cjs = require('../chunk-HK56GQQP.cjs');
|
|
4
|
+
require('../chunk-4QPDZJAL.cjs');
|
|
5
5
|
require('../chunk-QUKVGHN4.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-QMTWG6JL.cjs');
|
|
7
7
|
require('../chunk-SUIDD2C5.cjs');
|
|
8
8
|
require('../chunk-N7W5KZK7.cjs');
|
|
9
9
|
require('../chunk-3M6WB62Y.cjs');
|
|
@@ -11,7 +11,7 @@ require('../chunk-SBB6C4OP.cjs');
|
|
|
11
11
|
require('../chunk-RYVV5UVI.cjs');
|
|
12
12
|
require('../chunk-VFZOPRQP.cjs');
|
|
13
13
|
require('../chunk-BW4KGTV7.cjs');
|
|
14
|
-
require('../chunk-
|
|
14
|
+
require('../chunk-QTNPMIO2.cjs');
|
|
15
15
|
require('../chunk-TZTCIAYW.cjs');
|
|
16
16
|
require('../chunk-VZ5LDNHK.cjs');
|
|
17
17
|
require('../chunk-EGSUMHCS.cjs');
|
|
@@ -31,16 +31,22 @@ var schematexTools = {
|
|
|
31
31
|
listDiagrams: ai.tool({
|
|
32
32
|
description: "List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.",
|
|
33
33
|
inputSchema: zod.z.object({}),
|
|
34
|
-
execute: async () =>
|
|
34
|
+
execute: async () => chunkHK56GQQP_cjs.listDiagrams()
|
|
35
35
|
}),
|
|
36
36
|
getSyntax: ai.tool({
|
|
37
|
-
description: "Return
|
|
37
|
+
description: "Return syntax for one diagram type. Default `detail: canonical` is the compact first-shot generation path: canonical header, preferred forms, rules, and repair checks. Request `detail: reference` only for advanced forms or imported adapters after choosing a type.",
|
|
38
38
|
inputSchema: zod.z.object({
|
|
39
39
|
type: zod.z.string().describe(
|
|
40
40
|
"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone')."
|
|
41
|
+
),
|
|
42
|
+
detail: zod.z.enum(["canonical", "reference"]).optional().describe(
|
|
43
|
+
"Default `canonical` is best for generation. Use `reference` for the fuller grammar/tutorial."
|
|
41
44
|
)
|
|
42
45
|
}),
|
|
43
|
-
execute: async ({
|
|
46
|
+
execute: async ({
|
|
47
|
+
type,
|
|
48
|
+
detail
|
|
49
|
+
}) => chunkHK56GQQP_cjs.getSyntax(type, { detail })
|
|
44
50
|
}),
|
|
45
51
|
getExamples: ai.tool({
|
|
46
52
|
description: "Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.",
|
|
@@ -50,26 +56,26 @@ var schematexTools = {
|
|
|
50
56
|
preferFeatured: zod.z.boolean().optional().describe("Rank featured examples first."),
|
|
51
57
|
maxComplexity: zod.z.number().int().min(1).max(5).optional().describe("Only return examples with complexity <= this value (1=simplest).")
|
|
52
58
|
}),
|
|
53
|
-
execute: async (args) =>
|
|
59
|
+
execute: async (args) => chunkHK56GQQP_cjs.getExamples(args.type, {
|
|
54
60
|
limit: args.limit,
|
|
55
61
|
preferFeatured: args.preferFeatured,
|
|
56
62
|
maxComplexity: args.maxComplexity
|
|
57
63
|
})
|
|
58
64
|
}),
|
|
59
65
|
validateDsl: ai.tool({
|
|
60
|
-
description: "Validate Schematex DSL. Returns { ok: true } or { ok: false, errors: [{line, column, message, source}] }. Call before returning DSL
|
|
66
|
+
description: "Validate Schematex DSL. Pass the selected diagram `type` whenever you know it. Returns { ok: true } or { ok: false, errors: [{line, column, message, source, hint}] }. Call before returning DSL and self-correct on errors.",
|
|
61
67
|
inputSchema: zod.z.object({
|
|
62
68
|
type: zod.z.string().optional().describe(
|
|
63
|
-
"
|
|
69
|
+
"Selected diagram type. Optional for adapters/autodetect, but explicit canonical types are more robust."
|
|
64
70
|
),
|
|
65
71
|
dsl: zod.z.string().describe("The DSL source text to validate.")
|
|
66
72
|
}),
|
|
67
|
-
execute: async ({ type, dsl }) =>
|
|
73
|
+
execute: async ({ type, dsl }) => chunkHK56GQQP_cjs.validateDsl(type, dsl)
|
|
68
74
|
}),
|
|
69
75
|
renderDsl: ai.tool({
|
|
70
76
|
description: "Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.",
|
|
71
77
|
inputSchema: zod.z.object({
|
|
72
|
-
type: zod.z.string().optional().describe("
|
|
78
|
+
type: zod.z.string().optional().describe("Selected diagram type. Prefer passing it once chosen."),
|
|
73
79
|
dsl: zod.z.string().describe("The DSL source text to render."),
|
|
74
80
|
theme: zod.z.string().optional().describe("Theme name, e.g. 'default' or 'dark'."),
|
|
75
81
|
padding: zod.z.number().optional().describe("Outer padding in pixels.")
|
|
@@ -79,7 +85,7 @@ var schematexTools = {
|
|
|
79
85
|
dsl,
|
|
80
86
|
theme,
|
|
81
87
|
padding
|
|
82
|
-
}) =>
|
|
88
|
+
}) => chunkHK56GQQP_cjs.renderDsl(type, dsl, { theme, padding })
|
|
83
89
|
})
|
|
84
90
|
};
|
|
85
91
|
|
package/dist/ai/ai-sdk.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ai/ai-sdk.ts"],"names":["tool","z","listDiagrams","getSyntax","getExamples","validateDsl","renderDsl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,IAAM,cAAA,GAAiB;AAAA,EAC5B,cAAcA,OAAA,CAAK;AAAA,IACjB,WAAA,EACE,8JAAA;AAAA,IACF,WAAA,EAAaC,KAAA,CAAE,MAAA,CAAO,EAAE,CAAA;AAAA,IACxB,OAAA,EAAS,YAAYC,8BAAA;AAAiB,GACvC,CAAA;AAAA,EAED,WAAWF,OAAA,CAAK;AAAA,IACd,WAAA,EACE,
|
|
1
|
+
{"version":3,"sources":["../../src/ai/ai-sdk.ts"],"names":["tool","z","listDiagrams","getSyntax","getExamples","validateDsl","renderDsl"],"mappings":"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","file":"ai-sdk.cjs","sourcesContent":["/**\n * Vercel AI SDK adapter — ready-to-use `tools` object for `generateText` /\n * `streamText`.\n *\n * @example\n * ```ts\n * import { streamText } from 'ai';\n * import { schematexTools } from 'schematex/ai/sdk';\n *\n * const result = streamText({\n * model: 'anthropic/claude-opus-4-7',\n * tools: schematexTools,\n * maxSteps: 5,\n * system: `You write Schematex DSL. Discover types with listDiagrams,\n * then fetch getSyntax + getExamples before writing. Call validateDsl\n * before returning DSL to the user.`,\n * prompt: userMessage,\n * });\n * ```\n *\n * Peer-deps `ai` and `zod` are optional — this module only loads if both\n * are installed.\n */\nimport { tool } from \"ai\";\nimport { z } from \"zod\";\n\nimport {\n listDiagrams as listDiagramsImpl,\n getSyntax as getSyntaxImpl,\n getExamples as getExamplesImpl,\n validateDsl as validateDslImpl,\n renderDsl as renderDslImpl,\n} from \"./tools\";\n\nexport const schematexTools = {\n listDiagrams: tool({\n description:\n \"List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.\",\n inputSchema: z.object({}),\n execute: async () => listDiagramsImpl(),\n }),\n\n getSyntax: tool({\n description:\n \"Return syntax for one diagram type. Default `detail: canonical` is the compact first-shot generation path: canonical header, preferred forms, rules, and repair checks. Request `detail: reference` only for advanced forms or imported adapters after choosing a type.\",\n inputSchema: z.object({\n type: z\n .string()\n .describe(\n \"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone').\"\n ),\n detail: z\n .enum([\"canonical\", \"reference\"])\n .optional()\n .describe(\n \"Default `canonical` is best for generation. Use `reference` for the fuller grammar/tutorial.\"\n ),\n }),\n execute: async ({\n type,\n detail,\n }: {\n type: string;\n detail?: \"canonical\" | \"reference\";\n }) => getSyntaxImpl(type, { detail }),\n }),\n\n getExamples: tool({\n description:\n \"Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.\",\n inputSchema: z.object({\n type: z.string().describe(\"Diagram type id.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe(\"Max examples to return (default 5).\"),\n preferFeatured: z\n .boolean()\n .optional()\n .describe(\"Rank featured examples first.\"),\n maxComplexity: z\n .number()\n .int()\n .min(1)\n .max(5)\n .optional()\n .describe(\"Only return examples with complexity <= this value (1=simplest).\"),\n }),\n execute: async (args: {\n type: string;\n limit?: number;\n preferFeatured?: boolean;\n maxComplexity?: number;\n }) =>\n getExamplesImpl(args.type, {\n limit: args.limit,\n preferFeatured: args.preferFeatured,\n maxComplexity: args.maxComplexity,\n }),\n }),\n\n validateDsl: tool({\n description:\n \"Validate Schematex DSL. Pass the selected diagram `type` whenever you know it. Returns { ok: true } or { ok: false, errors: [{line, column, message, source, hint}] }. Call before returning DSL and self-correct on errors.\",\n inputSchema: z.object({\n type: z\n .string()\n .optional()\n .describe(\n \"Selected diagram type. Optional for adapters/autodetect, but explicit canonical types are more robust.\"\n ),\n dsl: z.string().describe(\"The DSL source text to validate.\"),\n }),\n execute: async ({ type, dsl }: { type?: string; dsl: string }) =>\n validateDslImpl(type, dsl),\n }),\n\n renderDsl: tool({\n description:\n \"Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.\",\n inputSchema: z.object({\n type: z\n .string()\n .optional()\n .describe(\"Selected diagram type. Prefer passing it once chosen.\"),\n dsl: z.string().describe(\"The DSL source text to render.\"),\n theme: z.string().optional().describe(\"Theme name, e.g. 'default' or 'dark'.\"),\n padding: z.number().optional().describe(\"Outer padding in pixels.\"),\n }),\n execute: async ({\n type,\n dsl,\n theme,\n padding,\n }: {\n type?: string;\n dsl: string;\n theme?: string;\n padding?: number;\n }) => renderDslImpl(type, dsl, { theme, padding }),\n }),\n} as const;\n\nexport type SchematexTools = typeof schematexTools;\n"]}
|
package/dist/ai/ai-sdk.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
|
-
import { DiagramListItem, GetSyntaxResult, GetExamplesResult, ValidateDslResult, RenderDslResult } from '
|
|
3
|
-
import '../api-
|
|
4
|
-
import '../types-
|
|
2
|
+
import { b as DiagramListItem, f as GetSyntaxResult, d as GetExamplesResult, V as ValidateDslResult, R as RenderDslResult } from '../tools-DlpuE76u.cjs';
|
|
3
|
+
import '../api-C5SECOxZ.cjs';
|
|
4
|
+
import '../types-WTr9W5Ud.cjs';
|
|
5
5
|
|
|
6
6
|
declare const schematexTools: {
|
|
7
7
|
readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
|
|
8
8
|
readonly getSyntax: ai.Tool<{
|
|
9
9
|
type: string;
|
|
10
|
+
detail?: "canonical" | "reference" | undefined;
|
|
10
11
|
}, GetSyntaxResult>;
|
|
11
12
|
readonly getExamples: ai.Tool<{
|
|
12
13
|
type: string;
|
package/dist/ai/ai-sdk.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as ai from 'ai';
|
|
2
|
-
import { DiagramListItem, GetSyntaxResult, GetExamplesResult, ValidateDslResult, RenderDslResult } from '
|
|
3
|
-
import '../api-
|
|
4
|
-
import '../types-
|
|
2
|
+
import { b as DiagramListItem, f as GetSyntaxResult, d as GetExamplesResult, V as ValidateDslResult, R as RenderDslResult } from '../tools-BHWaJPOl.js';
|
|
3
|
+
import '../api-Cr_MxttI.js';
|
|
4
|
+
import '../types-WTr9W5Ud.js';
|
|
5
5
|
|
|
6
6
|
declare const schematexTools: {
|
|
7
7
|
readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
|
|
8
8
|
readonly getSyntax: ai.Tool<{
|
|
9
9
|
type: string;
|
|
10
|
+
detail?: "canonical" | "reference" | undefined;
|
|
10
11
|
}, GetSyntaxResult>;
|
|
11
12
|
readonly getExamples: ai.Tool<{
|
|
12
13
|
type: string;
|
package/dist/ai/ai-sdk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { renderDsl, validateDsl, getExamples, getSyntax, listDiagrams } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
import { renderDsl, validateDsl, getExamples, getSyntax, listDiagrams } from '../chunk-VKPCR7BG.js';
|
|
2
|
+
import '../chunk-OK5ZS3LU.js';
|
|
3
3
|
import '../chunk-I55HO32M.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-VCH7RI5H.js';
|
|
5
5
|
import '../chunk-EPKIJEH7.js';
|
|
6
6
|
import '../chunk-IBRW3UOA.js';
|
|
7
7
|
import '../chunk-6OSUNBZY.js';
|
|
@@ -9,7 +9,7 @@ import '../chunk-PIV2A3HG.js';
|
|
|
9
9
|
import '../chunk-SZK376QB.js';
|
|
10
10
|
import '../chunk-3M6T7KB4.js';
|
|
11
11
|
import '../chunk-L3CTXXVZ.js';
|
|
12
|
-
import '../chunk-
|
|
12
|
+
import '../chunk-UFTYX73U.js';
|
|
13
13
|
import '../chunk-VJGMEGMR.js';
|
|
14
14
|
import '../chunk-JHDR56XO.js';
|
|
15
15
|
import '../chunk-ZL5RB4UV.js';
|
|
@@ -32,13 +32,19 @@ var schematexTools = {
|
|
|
32
32
|
execute: async () => listDiagrams()
|
|
33
33
|
}),
|
|
34
34
|
getSyntax: tool({
|
|
35
|
-
description: "Return
|
|
35
|
+
description: "Return syntax for one diagram type. Default `detail: canonical` is the compact first-shot generation path: canonical header, preferred forms, rules, and repair checks. Request `detail: reference` only for advanced forms or imported adapters after choosing a type.",
|
|
36
36
|
inputSchema: z.object({
|
|
37
37
|
type: z.string().describe(
|
|
38
38
|
"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone')."
|
|
39
|
+
),
|
|
40
|
+
detail: z.enum(["canonical", "reference"]).optional().describe(
|
|
41
|
+
"Default `canonical` is best for generation. Use `reference` for the fuller grammar/tutorial."
|
|
39
42
|
)
|
|
40
43
|
}),
|
|
41
|
-
execute: async ({
|
|
44
|
+
execute: async ({
|
|
45
|
+
type,
|
|
46
|
+
detail
|
|
47
|
+
}) => getSyntax(type, { detail })
|
|
42
48
|
}),
|
|
43
49
|
getExamples: tool({
|
|
44
50
|
description: "Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.",
|
|
@@ -55,10 +61,10 @@ var schematexTools = {
|
|
|
55
61
|
})
|
|
56
62
|
}),
|
|
57
63
|
validateDsl: tool({
|
|
58
|
-
description: "Validate Schematex DSL. Returns { ok: true } or { ok: false, errors: [{line, column, message, source}] }. Call before returning DSL
|
|
64
|
+
description: "Validate Schematex DSL. Pass the selected diagram `type` whenever you know it. Returns { ok: true } or { ok: false, errors: [{line, column, message, source, hint}] }. Call before returning DSL and self-correct on errors.",
|
|
59
65
|
inputSchema: z.object({
|
|
60
66
|
type: z.string().optional().describe(
|
|
61
|
-
"
|
|
67
|
+
"Selected diagram type. Optional for adapters/autodetect, but explicit canonical types are more robust."
|
|
62
68
|
),
|
|
63
69
|
dsl: z.string().describe("The DSL source text to validate.")
|
|
64
70
|
}),
|
|
@@ -67,7 +73,7 @@ var schematexTools = {
|
|
|
67
73
|
renderDsl: tool({
|
|
68
74
|
description: "Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.",
|
|
69
75
|
inputSchema: z.object({
|
|
70
|
-
type: z.string().optional().describe("
|
|
76
|
+
type: z.string().optional().describe("Selected diagram type. Prefer passing it once chosen."),
|
|
71
77
|
dsl: z.string().describe("The DSL source text to render."),
|
|
72
78
|
theme: z.string().optional().describe("Theme name, e.g. 'default' or 'dark'."),
|
|
73
79
|
padding: z.number().optional().describe("Outer padding in pixels.")
|
package/dist/ai/ai-sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ai/ai-sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCO,IAAM,cAAA,GAAiB;AAAA,EAC5B,cAAc,IAAA,CAAK;AAAA,IACjB,WAAA,EACE,8JAAA;AAAA,IACF,WAAA,EAAa,CAAA,CAAE,MAAA,CAAO,EAAE,CAAA;AAAA,IACxB,OAAA,EAAS,YAAY,YAAA;AAAiB,GACvC,CAAA;AAAA,EAED,WAAW,IAAA,CAAK;AAAA,IACd,WAAA,EACE,
|
|
1
|
+
{"version":3,"sources":["../../src/ai/ai-sdk.ts"],"names":[],"mappings":"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","file":"ai-sdk.js","sourcesContent":["/**\n * Vercel AI SDK adapter — ready-to-use `tools` object for `generateText` /\n * `streamText`.\n *\n * @example\n * ```ts\n * import { streamText } from 'ai';\n * import { schematexTools } from 'schematex/ai/sdk';\n *\n * const result = streamText({\n * model: 'anthropic/claude-opus-4-7',\n * tools: schematexTools,\n * maxSteps: 5,\n * system: `You write Schematex DSL. Discover types with listDiagrams,\n * then fetch getSyntax + getExamples before writing. Call validateDsl\n * before returning DSL to the user.`,\n * prompt: userMessage,\n * });\n * ```\n *\n * Peer-deps `ai` and `zod` are optional — this module only loads if both\n * are installed.\n */\nimport { tool } from \"ai\";\nimport { z } from \"zod\";\n\nimport {\n listDiagrams as listDiagramsImpl,\n getSyntax as getSyntaxImpl,\n getExamples as getExamplesImpl,\n validateDsl as validateDslImpl,\n renderDsl as renderDslImpl,\n} from \"./tools\";\n\nexport const schematexTools = {\n listDiagrams: tool({\n description:\n \"List every Schematex diagram type with a tagline, 'use when' hint, domain cluster, and authoritative standard. Call this first to discover what's available.\",\n inputSchema: z.object({}),\n execute: async () => listDiagramsImpl(),\n }),\n\n getSyntax: tool({\n description:\n \"Return syntax for one diagram type. Default `detail: canonical` is the compact first-shot generation path: canonical header, preferred forms, rules, and repair checks. Request `detail: reference` only for advanced forms or imported adapters after choosing a type.\",\n inputSchema: z.object({\n type: z\n .string()\n .describe(\n \"Diagram type id from listDiagrams (e.g. 'genogram', 'sld', 'fishbone').\"\n ),\n detail: z\n .enum([\"canonical\", \"reference\"])\n .optional()\n .describe(\n \"Default `canonical` is best for generation. Use `reference` for the fuller grammar/tutorial.\"\n ),\n }),\n execute: async ({\n type,\n detail,\n }: {\n type: string;\n detail?: \"canonical\" | \"reference\";\n }) => getSyntaxImpl(type, { detail }),\n }),\n\n getExamples: tool({\n description:\n \"Return curated real-world DSL examples for a diagram type, each with scenario notes and tags. Use as few-shot context before generating DSL.\",\n inputSchema: z.object({\n type: z.string().describe(\"Diagram type id.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(10)\n .optional()\n .describe(\"Max examples to return (default 5).\"),\n preferFeatured: z\n .boolean()\n .optional()\n .describe(\"Rank featured examples first.\"),\n maxComplexity: z\n .number()\n .int()\n .min(1)\n .max(5)\n .optional()\n .describe(\"Only return examples with complexity <= this value (1=simplest).\"),\n }),\n execute: async (args: {\n type: string;\n limit?: number;\n preferFeatured?: boolean;\n maxComplexity?: number;\n }) =>\n getExamplesImpl(args.type, {\n limit: args.limit,\n preferFeatured: args.preferFeatured,\n maxComplexity: args.maxComplexity,\n }),\n }),\n\n validateDsl: tool({\n description:\n \"Validate Schematex DSL. Pass the selected diagram `type` whenever you know it. Returns { ok: true } or { ok: false, errors: [{line, column, message, source, hint}] }. Call before returning DSL and self-correct on errors.\",\n inputSchema: z.object({\n type: z\n .string()\n .optional()\n .describe(\n \"Selected diagram type. Optional for adapters/autodetect, but explicit canonical types are more robust.\"\n ),\n dsl: z.string().describe(\"The DSL source text to validate.\"),\n }),\n execute: async ({ type, dsl }: { type?: string; dsl: string }) =>\n validateDslImpl(type, dsl),\n }),\n\n renderDsl: tool({\n description:\n \"Render Schematex DSL to an SVG string. Returns { ok: true, svg } or { ok: false, errors }. Use when the caller needs the actual diagram output, not just validation.\",\n inputSchema: z.object({\n type: z\n .string()\n .optional()\n .describe(\"Selected diagram type. Prefer passing it once chosen.\"),\n dsl: z.string().describe(\"The DSL source text to render.\"),\n theme: z.string().optional().describe(\"Theme name, e.g. 'default' or 'dark'.\"),\n padding: z.number().optional().describe(\"Outer padding in pixels.\"),\n }),\n execute: async ({\n type,\n dsl,\n theme,\n padding,\n }: {\n type?: string;\n dsl: string;\n theme?: string;\n padding?: number;\n }) => renderDslImpl(type, dsl, { theme, padding }),\n }),\n} as const;\n\nexport type SchematexTools = typeof schematexTools;\n"]}
|
package/dist/ai/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkHK56GQQP_cjs = require('../chunk-HK56GQQP.cjs');
|
|
4
|
+
require('../chunk-4QPDZJAL.cjs');
|
|
5
5
|
require('../chunk-QUKVGHN4.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-QMTWG6JL.cjs');
|
|
7
7
|
require('../chunk-SUIDD2C5.cjs');
|
|
8
8
|
require('../chunk-N7W5KZK7.cjs');
|
|
9
9
|
require('../chunk-3M6WB62Y.cjs');
|
|
@@ -11,7 +11,7 @@ require('../chunk-SBB6C4OP.cjs');
|
|
|
11
11
|
require('../chunk-RYVV5UVI.cjs');
|
|
12
12
|
require('../chunk-VFZOPRQP.cjs');
|
|
13
13
|
require('../chunk-BW4KGTV7.cjs');
|
|
14
|
-
require('../chunk-
|
|
14
|
+
require('../chunk-QTNPMIO2.cjs');
|
|
15
15
|
require('../chunk-TZTCIAYW.cjs');
|
|
16
16
|
require('../chunk-VZ5LDNHK.cjs');
|
|
17
17
|
require('../chunk-EGSUMHCS.cjs');
|
|
@@ -29,35 +29,39 @@ require('../chunk-3WNW5Y7P.cjs');
|
|
|
29
29
|
|
|
30
30
|
Object.defineProperty(exports, "DIAGRAM_REGISTRY", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkHK56GQQP_cjs.DIAGRAM_REGISTRY; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "getAllDiagramTypes", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkHK56GQQP_cjs.getAllDiagramTypes; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "getDiagramMeta", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkHK56GQQP_cjs.getDiagramMeta; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "getExamples", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkHK56GQQP_cjs.getExamples; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "getSyntax", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkHK56GQQP_cjs.getSyntax; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "listDiagrams", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkHK56GQQP_cjs.listDiagrams; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "renderDsl", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkHK56GQQP_cjs.renderDsl; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "resolveDiagramType", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunkHK56GQQP_cjs.resolveDiagramType; }
|
|
57
61
|
});
|
|
58
62
|
Object.defineProperty(exports, "validateDsl", {
|
|
59
63
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkHK56GQQP_cjs.validateDsl; }
|
|
61
65
|
});
|
|
62
66
|
//# sourceMappingURL=index.cjs.map
|
|
63
67
|
//# sourceMappingURL=index.cjs.map
|
package/dist/ai/index.d.cts
CHANGED
|
@@ -1,155 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import { q as DiagramType } from '../types-
|
|
1
|
+
export { D as DIAGRAM_REGISTRY, a as DiagramCluster, b as DiagramListItem, c as DiagramMeta, E as Example, G as GetExamplesOptions, d as GetExamplesResult, e as GetSyntaxOptions, f as GetSyntaxResult, R as RenderDslResult, S as SchematexValidationError, g as SyntaxDetail, h as SyntaxDoc, V as ValidateDslResult, i as getAllDiagramTypes, j as getDiagramMeta, k as getExamples, l as getSyntax, m as listDiagrams, r as renderDsl, n as resolveDiagramType, v as validateDsl } from '../tools-DlpuE76u.cjs';
|
|
2
|
+
import { q as DiagramType } from '../types-WTr9W5Ud.cjs';
|
|
3
|
+
import '../api-C5SECOxZ.cjs';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* This is the index an LLM sees when calling `listDiagrams()`. Descriptions
|
|
8
|
-
* are tuned to help the model pick the right type for a user request.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
type DiagramCluster = "relationships" | "electrical-industrial" | "corporate-legal" | "causality-analysis" | "generic" | "strategy" | "knowledge" | "behavior-modeling";
|
|
12
|
-
interface DiagramMeta {
|
|
13
|
-
/** Canonical type id — matches `DiagramType` and plugin keys. */
|
|
5
|
+
interface GenerationProfile {
|
|
6
|
+
/** Canonical type id from `listDiagrams()`. */
|
|
14
7
|
type: DiagramType;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
declare function getAllDiagramTypes(): DiagramType[];
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Structured error type returned by the AI tool layer.
|
|
34
|
-
*
|
|
35
|
-
* The underlying per-diagram parsers each throw their own error class
|
|
36
|
-
* (genogram.ParseError, SLDParseError, PedigreeParseError, ...). Some
|
|
37
|
-
* carry line/column, some don't. {@link extractError} normalises any
|
|
38
|
-
* thrown value into this shape via structural extraction — no parser
|
|
39
|
-
* refactor required.
|
|
40
|
-
*/
|
|
41
|
-
interface SchematexValidationError {
|
|
42
|
-
/** 1-based line number where the error occurred, if the parser reported it. */
|
|
43
|
-
line?: number;
|
|
44
|
-
/** 1-based column, if reported. */
|
|
45
|
-
column?: number;
|
|
46
|
-
/** Source snippet from the offending line, if the parser captured it. */
|
|
47
|
-
source?: string;
|
|
48
|
-
/** Human-readable error message. */
|
|
49
|
-
message: string;
|
|
50
|
-
/** Optional remediation hint. */
|
|
51
|
-
hint?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* AUTO-GENERATED by scripts/build-ai-content.mjs — do not edit by hand.
|
|
56
|
-
* Regenerate with: npm run build:ai
|
|
57
|
-
*
|
|
58
|
-
* Compiled content bundle for the AI tool layer. Keeps MDX content
|
|
59
|
-
* available to the published npm package without runtime fs access.
|
|
60
|
-
*/
|
|
61
|
-
interface GeneratedExample {
|
|
62
|
-
slug: string;
|
|
63
|
-
diagram: string;
|
|
64
|
-
title: string;
|
|
65
|
-
description: string;
|
|
66
|
-
standard: string;
|
|
67
|
-
tags: readonly string[];
|
|
68
|
-
complexity: number;
|
|
69
|
-
featured: boolean;
|
|
70
|
-
dsl: string;
|
|
71
|
-
notes: string;
|
|
72
|
-
}
|
|
73
|
-
interface GeneratedSyntax {
|
|
74
|
-
title: string;
|
|
75
|
-
content: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Example library — runtime lookup over the bundled MDX examples.
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
type Example = GeneratedExample;
|
|
83
|
-
interface GetExamplesOptions {
|
|
84
|
-
/** Maximum number of examples to return. Default 5. */
|
|
85
|
-
limit?: number;
|
|
86
|
-
/** Prefer examples marked `featured: true` when set. */
|
|
87
|
-
preferFeatured?: boolean;
|
|
88
|
-
/** Maximum complexity (1–5). */
|
|
89
|
-
maxComplexity?: number;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Syntax lookup — LLM-facing per-diagram grammar reference.
|
|
94
|
-
*
|
|
95
|
-
* v1: returns the stripped-MDX content from `website/content/docs/*.mdx`
|
|
96
|
-
* (JSX components replaced with fenced DSL code blocks).
|
|
97
|
-
*
|
|
98
|
-
* Later: may be replaced with curated compact summaries per diagram if
|
|
99
|
-
* the stripped docs prove too long for good LLM performance.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
type SyntaxDoc = GeneratedSyntax & {
|
|
103
|
-
key: string;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* AI-facing tool functions — the five tools an LLM uses to work with Schematex.
|
|
108
|
-
*
|
|
109
|
-
* Pure TypeScript, zero framework deps. Both the Vercel AI SDK adapter
|
|
110
|
-
* (ai-sdk.ts) and the MCP server wrap these functions.
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
interface DiagramListItem {
|
|
114
|
-
type: string;
|
|
115
|
-
name: string;
|
|
116
|
-
tagline: string;
|
|
117
|
-
useWhen: string;
|
|
118
|
-
cluster: DiagramMeta["cluster"];
|
|
119
|
-
standard: string;
|
|
120
|
-
}
|
|
121
|
-
declare function listDiagrams(): DiagramListItem[];
|
|
122
|
-
interface GetSyntaxResult {
|
|
123
|
-
type: string;
|
|
124
|
-
name: string;
|
|
125
|
-
standard: string;
|
|
126
|
-
syntax: SyntaxDoc;
|
|
127
|
-
}
|
|
128
|
-
declare function getSyntax(type: string): GetSyntaxResult;
|
|
129
|
-
interface GetExamplesResult {
|
|
130
|
-
type: string;
|
|
131
|
-
count: number;
|
|
132
|
-
examples: Example[];
|
|
133
|
-
}
|
|
134
|
-
declare function getExamples(type: string, opts?: GetExamplesOptions): GetExamplesResult;
|
|
135
|
-
type ValidateDslResult = {
|
|
136
|
-
ok: true;
|
|
137
|
-
type: string | null;
|
|
138
|
-
} | {
|
|
139
|
-
ok: false;
|
|
140
|
-
type: string | null;
|
|
141
|
-
errors: SchematexValidationError[];
|
|
142
|
-
};
|
|
143
|
-
declare function validateDsl(type: string | undefined, dsl: string): ValidateDslResult;
|
|
144
|
-
type RenderDslResult = {
|
|
145
|
-
ok: true;
|
|
146
|
-
type: string | null;
|
|
147
|
-
svg: string;
|
|
148
|
-
} | {
|
|
149
|
-
ok: false;
|
|
150
|
-
type: string | null;
|
|
151
|
-
errors: SchematexValidationError[];
|
|
152
|
-
};
|
|
153
|
-
declare function renderDsl(type: string | undefined, dsl: string, options?: Omit<SchematexConfig, "type">): RenderDslResult;
|
|
154
|
-
|
|
155
|
-
export { DIAGRAM_REGISTRY, type DiagramCluster, type DiagramListItem, type DiagramMeta, type Example, type GetExamplesOptions, type GetExamplesResult, type GetSyntaxResult, type RenderDslResult, type SchematexValidationError, type SyntaxDoc, type ValidateDslResult, getAllDiagramTypes, getDiagramMeta, getExamples, getSyntax, listDiagrams, renderDsl, validateDsl };
|
|
8
|
+
/** First line form preferred for generated DSL. */
|
|
9
|
+
header: string;
|
|
10
|
+
/** Short name for the preferred authoring mode when a parser has several. */
|
|
11
|
+
mode: string;
|
|
12
|
+
/** Forms that cover most first-shot generations for this type. */
|
|
13
|
+
forms: readonly string[];
|
|
14
|
+
/** Short grammar choices the model should make by default. */
|
|
15
|
+
prefer: readonly string[];
|
|
16
|
+
/** Accepted adapters / advanced paths to avoid unless explicitly needed. */
|
|
17
|
+
avoid: readonly string[];
|
|
18
|
+
/** Validation or semantic reminders that prevent common failed renders. */
|
|
19
|
+
repair: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type { GenerationProfile };
|