schematex 0.9.9 → 0.9.11

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 (87) hide show
  1. package/dist/ai/ai-sdk.cjs +9 -9
  2. package/dist/ai/ai-sdk.d.cts +3 -3
  3. package/dist/ai/ai-sdk.d.ts +3 -3
  4. package/dist/ai/ai-sdk.js +4 -4
  5. package/dist/ai/index.cjs +18 -18
  6. package/dist/ai/index.d.cts +4 -4
  7. package/dist/ai/index.d.ts +4 -4
  8. package/dist/ai/index.js +5 -5
  9. package/dist/{api-D_d-JklT.d.ts → api-DAiP83-P.d.ts} +1 -1
  10. package/dist/{api-DnTyW-6F.d.cts → api-DecITB-t.d.cts} +1 -1
  11. package/dist/browser.cjs +10 -10
  12. package/dist/browser.d.cts +3 -3
  13. package/dist/browser.d.ts +3 -3
  14. package/dist/browser.js +4 -4
  15. package/dist/{chunk-IHX6J4HF.js → chunk-32LOZTNP.js} +178 -4
  16. package/dist/chunk-32LOZTNP.js.map +1 -0
  17. package/dist/{chunk-RCR4UGKV.js → chunk-4QBC4475.js} +35 -20
  18. package/dist/chunk-4QBC4475.js.map +1 -0
  19. package/dist/{chunk-OY2CXLVY.cjs → chunk-5YTFNOKY.cjs} +170 -15
  20. package/dist/{chunk-OY2CXLVY.cjs.map → chunk-5YTFNOKY.cjs.map} +1 -1
  21. package/dist/{chunk-EUN6FEGE.cjs → chunk-6ZTPWE22.cjs} +37 -22
  22. package/dist/chunk-6ZTPWE22.cjs.map +1 -0
  23. package/dist/{chunk-TXWVJAMR.cjs → chunk-HEGDKO2E.cjs} +178 -4
  24. package/dist/chunk-HEGDKO2E.cjs.map +1 -0
  25. package/dist/{chunk-T5QOVX2I.js → chunk-RU3N57OB.js} +168 -13
  26. package/dist/{chunk-T5QOVX2I.js.map → chunk-RU3N57OB.js.map} +1 -1
  27. package/dist/{chunk-MVTYPWHO.js → chunk-WTGABYFK.js} +80 -17
  28. package/dist/chunk-WTGABYFK.js.map +1 -0
  29. package/dist/{chunk-MXV3XJFH.cjs → chunk-YN7EBTWB.cjs} +80 -17
  30. package/dist/chunk-YN7EBTWB.cjs.map +1 -0
  31. package/dist/{diagnostics-D2qkBfFx.d.cts → diagnostics-Bps9pzlF.d.cts} +8 -2
  32. package/dist/{diagnostics-D2qkBfFx.d.ts → diagnostics-Bps9pzlF.d.ts} +8 -2
  33. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  34. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  35. package/dist/diagrams/circuit/index.cjs +8 -8
  36. package/dist/diagrams/circuit/index.d.cts +1 -1
  37. package/dist/diagrams/circuit/index.d.ts +1 -1
  38. package/dist/diagrams/circuit/index.js +1 -1
  39. package/dist/diagrams/ecomap/index.d.cts +1 -1
  40. package/dist/diagrams/ecomap/index.d.ts +1 -1
  41. package/dist/diagrams/entity/index.d.cts +1 -1
  42. package/dist/diagrams/entity/index.d.ts +1 -1
  43. package/dist/diagrams/fishbone/index.d.cts +1 -1
  44. package/dist/diagrams/fishbone/index.d.ts +1 -1
  45. package/dist/diagrams/flowchart/index.d.cts +2 -2
  46. package/dist/diagrams/flowchart/index.d.ts +2 -2
  47. package/dist/diagrams/genogram/index.d.cts +1 -1
  48. package/dist/diagrams/genogram/index.d.ts +1 -1
  49. package/dist/diagrams/ladder/index.d.cts +1 -1
  50. package/dist/diagrams/ladder/index.d.ts +1 -1
  51. package/dist/diagrams/logic/index.d.cts +1 -1
  52. package/dist/diagrams/logic/index.d.ts +1 -1
  53. package/dist/diagrams/orgchart/index.d.cts +1 -1
  54. package/dist/diagrams/orgchart/index.d.ts +1 -1
  55. package/dist/diagrams/pedigree/index.d.cts +1 -1
  56. package/dist/diagrams/pedigree/index.d.ts +1 -1
  57. package/dist/diagrams/phylo/index.d.cts +1 -1
  58. package/dist/diagrams/phylo/index.d.ts +1 -1
  59. package/dist/diagrams/sld/index.cjs +7 -7
  60. package/dist/diagrams/sld/index.d.cts +4 -1
  61. package/dist/diagrams/sld/index.d.ts +4 -1
  62. package/dist/diagrams/sld/index.js +1 -1
  63. package/dist/diagrams/sociogram/index.d.cts +1 -1
  64. package/dist/diagrams/sociogram/index.d.ts +1 -1
  65. package/dist/diagrams/timing/index.d.cts +1 -1
  66. package/dist/diagrams/timing/index.d.ts +1 -1
  67. package/dist/diagrams/venn/index.d.cts +1 -1
  68. package/dist/diagrams/venn/index.d.ts +1 -1
  69. package/dist/{index-D9u0YRxL.d.ts → index-F6MCisQe.d.ts} +1 -1
  70. package/dist/{index-JZlLiE6K.d.cts → index-fvBAmlv7.d.cts} +1 -1
  71. package/dist/index.cjs +43 -43
  72. package/dist/index.d.cts +4 -4
  73. package/dist/index.d.ts +4 -4
  74. package/dist/index.js +6 -6
  75. package/dist/react.cjs +4 -4
  76. package/dist/react.d.cts +2 -2
  77. package/dist/react.d.ts +2 -2
  78. package/dist/react.js +3 -3
  79. package/dist/{tools-DM0aLCbc.d.ts → tools-CdzIw2Az.d.ts} +2 -2
  80. package/dist/{tools-DAKYNcPv.d.cts → tools-vyVK2DHa.d.cts} +2 -2
  81. package/package.json +1 -1
  82. package/dist/chunk-EUN6FEGE.cjs.map +0 -1
  83. package/dist/chunk-IHX6J4HF.js.map +0 -1
  84. package/dist/chunk-MVTYPWHO.js.map +0 -1
  85. package/dist/chunk-MXV3XJFH.cjs.map +0 -1
  86. package/dist/chunk-RCR4UGKV.js.map +0 -1
  87. package/dist/chunk-TXWVJAMR.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkEUN6FEGE_cjs = require('../chunk-EUN6FEGE.cjs');
4
- require('../chunk-OY2CXLVY.cjs');
3
+ var chunk6ZTPWE22_cjs = require('../chunk-6ZTPWE22.cjs');
4
+ require('../chunk-5YTFNOKY.cjs');
5
5
  require('../chunk-UHRNFBWY.cjs');
6
- require('../chunk-TXWVJAMR.cjs');
6
+ require('../chunk-HEGDKO2E.cjs');
7
7
  require('../chunk-T55OQILI.cjs');
8
8
  require('../chunk-GTCGATOL.cjs');
9
- require('../chunk-MXV3XJFH.cjs');
9
+ require('../chunk-YN7EBTWB.cjs');
10
10
  require('../chunk-4MANMKQ4.cjs');
11
11
  require('../chunk-YFPDZVB7.cjs');
12
12
  require('../chunk-3JN4762U.cjs');
@@ -31,7 +31,7 @@ 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 () => chunkEUN6FEGE_cjs.listDiagrams()
34
+ execute: async () => chunk6ZTPWE22_cjs.listDiagrams()
35
35
  }),
36
36
  getSyntax: ai.tool({
37
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.",
@@ -46,7 +46,7 @@ var schematexTools = {
46
46
  execute: async ({
47
47
  type,
48
48
  detail
49
- }) => chunkEUN6FEGE_cjs.getSyntax(type, { detail })
49
+ }) => chunk6ZTPWE22_cjs.getSyntax(type, { detail })
50
50
  }),
51
51
  getExamples: ai.tool({
52
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.",
@@ -56,7 +56,7 @@ var schematexTools = {
56
56
  preferFeatured: zod.z.boolean().optional().describe("Rank featured examples first."),
57
57
  maxComplexity: zod.z.number().int().min(1).max(5).optional().describe("Only return examples with complexity <= this value (1=simplest).")
58
58
  }),
59
- execute: async (args) => chunkEUN6FEGE_cjs.getExamples(args.type, {
59
+ execute: async (args) => chunk6ZTPWE22_cjs.getExamples(args.type, {
60
60
  limit: args.limit,
61
61
  preferFeatured: args.preferFeatured,
62
62
  maxComplexity: args.maxComplexity
@@ -70,7 +70,7 @@ var schematexTools = {
70
70
  ),
71
71
  dsl: zod.z.string().describe("The DSL source text to validate.")
72
72
  }),
73
- execute: async ({ type, dsl }) => chunkEUN6FEGE_cjs.validateDsl(type, dsl)
73
+ execute: async ({ type, dsl }) => chunk6ZTPWE22_cjs.validateDsl(type, dsl)
74
74
  }),
75
75
  renderDsl: ai.tool({
76
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.",
@@ -85,7 +85,7 @@ var schematexTools = {
85
85
  dsl,
86
86
  theme,
87
87
  padding
88
- }) => chunkEUN6FEGE_cjs.renderDsl(type, dsl, { theme, padding })
88
+ }) => chunk6ZTPWE22_cjs.renderDsl(type, dsl, { theme, padding })
89
89
  })
90
90
  };
91
91
 
@@ -1,7 +1,7 @@
1
1
  import * as ai from 'ai';
2
- import { c as DiagramListItem, g as GetSyntaxResult, e as GetExamplesResult, V as ValidateDslResult, R as RenderDslResult } from '../tools-DAKYNcPv.cjs';
3
- import '../api-DnTyW-6F.cjs';
4
- import '../diagnostics-D2qkBfFx.cjs';
2
+ import { c as DiagramListItem, g as GetSyntaxResult, e as GetExamplesResult, V as ValidateDslResult, R as RenderDslResult } from '../tools-vyVK2DHa.cjs';
3
+ import '../api-DecITB-t.cjs';
4
+ import '../diagnostics-Bps9pzlF.cjs';
5
5
 
6
6
  declare const schematexTools: {
7
7
  readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
@@ -1,7 +1,7 @@
1
1
  import * as ai from 'ai';
2
- import { c as DiagramListItem, g as GetSyntaxResult, e as GetExamplesResult, V as ValidateDslResult, R as RenderDslResult } from '../tools-DM0aLCbc.js';
3
- import '../api-D_d-JklT.js';
4
- import '../diagnostics-D2qkBfFx.js';
2
+ import { c as DiagramListItem, g as GetSyntaxResult, e as GetExamplesResult, V as ValidateDslResult, R as RenderDslResult } from '../tools-CdzIw2Az.js';
3
+ import '../api-DAiP83-P.js';
4
+ import '../diagnostics-Bps9pzlF.js';
5
5
 
6
6
  declare const schematexTools: {
7
7
  readonly listDiagrams: ai.Tool<{}, DiagramListItem[]>;
package/dist/ai/ai-sdk.js CHANGED
@@ -1,10 +1,10 @@
1
- import { renderDsl, validateDsl, getExamples, getSyntax, listDiagrams } from '../chunk-RCR4UGKV.js';
2
- import '../chunk-T5QOVX2I.js';
1
+ import { renderDsl, validateDsl, getExamples, getSyntax, listDiagrams } from '../chunk-4QBC4475.js';
2
+ import '../chunk-RU3N57OB.js';
3
3
  import '../chunk-EB7T5SEO.js';
4
- import '../chunk-IHX6J4HF.js';
4
+ import '../chunk-32LOZTNP.js';
5
5
  import '../chunk-P4U565XH.js';
6
6
  import '../chunk-W4UVDMUC.js';
7
- import '../chunk-MVTYPWHO.js';
7
+ import '../chunk-WTGABYFK.js';
8
8
  import '../chunk-2IRYXK4M.js';
9
9
  import '../chunk-NP7N3DZG.js';
10
10
  import '../chunk-KUSW5I2P.js';
package/dist/ai/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkEUN6FEGE_cjs = require('../chunk-EUN6FEGE.cjs');
4
- require('../chunk-OY2CXLVY.cjs');
3
+ var chunk6ZTPWE22_cjs = require('../chunk-6ZTPWE22.cjs');
4
+ require('../chunk-5YTFNOKY.cjs');
5
5
  require('../chunk-UHRNFBWY.cjs');
6
- require('../chunk-TXWVJAMR.cjs');
6
+ require('../chunk-HEGDKO2E.cjs');
7
7
  require('../chunk-T55OQILI.cjs');
8
8
  require('../chunk-GTCGATOL.cjs');
9
- require('../chunk-MXV3XJFH.cjs');
9
+ require('../chunk-YN7EBTWB.cjs');
10
10
  require('../chunk-4MANMKQ4.cjs');
11
11
  require('../chunk-YFPDZVB7.cjs');
12
12
  require('../chunk-3JN4762U.cjs');
@@ -27,10 +27,10 @@ require('../chunk-3WNW5Y7P.cjs');
27
27
 
28
28
  // src/ai/prompt-context.ts
29
29
  function buildPromptContext(type, opts = {}) {
30
- const resolved = chunkEUN6FEGE_cjs.resolveDiagramType(type) ?? type;
30
+ const resolved = chunk6ZTPWE22_cjs.resolveDiagramType(type) ?? type;
31
31
  const detail = opts.detail ?? "canonical";
32
32
  const limit = opts.examples ?? 2;
33
- const { type: canonical, name, standard, syntax } = chunkEUN6FEGE_cjs.getSyntax(resolved, {
33
+ const { type: canonical, name, standard, syntax } = chunk6ZTPWE22_cjs.getSyntax(resolved, {
34
34
  detail
35
35
  });
36
36
  const parts = [
@@ -41,7 +41,7 @@ function buildPromptContext(type, opts = {}) {
41
41
  ];
42
42
  let exampleCount = 0;
43
43
  if (limit > 0) {
44
- const examples = chunkEUN6FEGE_cjs.getExamples(canonical, {
44
+ const examples = chunk6ZTPWE22_cjs.getExamples(canonical, {
45
45
  preferFeatured: opts.preferFeatured ?? true,
46
46
  limit,
47
47
  maxComplexity: opts.maxComplexity
@@ -67,47 +67,47 @@ function buildPromptContext(type, opts = {}) {
67
67
 
68
68
  Object.defineProperty(exports, "DIAGRAM_REGISTRY", {
69
69
  enumerable: true,
70
- get: function () { return chunkEUN6FEGE_cjs.DIAGRAM_REGISTRY; }
70
+ get: function () { return chunk6ZTPWE22_cjs.DIAGRAM_REGISTRY; }
71
71
  });
72
72
  Object.defineProperty(exports, "DIAGRAM_SINCE", {
73
73
  enumerable: true,
74
- get: function () { return chunkEUN6FEGE_cjs.DIAGRAM_SINCE; }
74
+ get: function () { return chunk6ZTPWE22_cjs.DIAGRAM_SINCE; }
75
75
  });
76
76
  Object.defineProperty(exports, "getAllDiagramTypes", {
77
77
  enumerable: true,
78
- get: function () { return chunkEUN6FEGE_cjs.getAllDiagramTypes; }
78
+ get: function () { return chunk6ZTPWE22_cjs.getAllDiagramTypes; }
79
79
  });
80
80
  Object.defineProperty(exports, "getDiagramMeta", {
81
81
  enumerable: true,
82
- get: function () { return chunkEUN6FEGE_cjs.getDiagramMeta; }
82
+ get: function () { return chunk6ZTPWE22_cjs.getDiagramMeta; }
83
83
  });
84
84
  Object.defineProperty(exports, "getDiagramSince", {
85
85
  enumerable: true,
86
- get: function () { return chunkEUN6FEGE_cjs.getDiagramSince; }
86
+ get: function () { return chunk6ZTPWE22_cjs.getDiagramSince; }
87
87
  });
88
88
  Object.defineProperty(exports, "getExamples", {
89
89
  enumerable: true,
90
- get: function () { return chunkEUN6FEGE_cjs.getExamples; }
90
+ get: function () { return chunk6ZTPWE22_cjs.getExamples; }
91
91
  });
92
92
  Object.defineProperty(exports, "getSyntax", {
93
93
  enumerable: true,
94
- get: function () { return chunkEUN6FEGE_cjs.getSyntax; }
94
+ get: function () { return chunk6ZTPWE22_cjs.getSyntax; }
95
95
  });
96
96
  Object.defineProperty(exports, "listDiagrams", {
97
97
  enumerable: true,
98
- get: function () { return chunkEUN6FEGE_cjs.listDiagrams; }
98
+ get: function () { return chunk6ZTPWE22_cjs.listDiagrams; }
99
99
  });
100
100
  Object.defineProperty(exports, "renderDsl", {
101
101
  enumerable: true,
102
- get: function () { return chunkEUN6FEGE_cjs.renderDsl; }
102
+ get: function () { return chunk6ZTPWE22_cjs.renderDsl; }
103
103
  });
104
104
  Object.defineProperty(exports, "resolveDiagramType", {
105
105
  enumerable: true,
106
- get: function () { return chunkEUN6FEGE_cjs.resolveDiagramType; }
106
+ get: function () { return chunk6ZTPWE22_cjs.resolveDiagramType; }
107
107
  });
108
108
  Object.defineProperty(exports, "validateDsl", {
109
109
  enumerable: true,
110
- get: function () { return chunkEUN6FEGE_cjs.validateDsl; }
110
+ get: function () { return chunk6ZTPWE22_cjs.validateDsl; }
111
111
  });
112
112
  exports.buildPromptContext = buildPromptContext;
113
113
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- import { S as SyntaxDetail } from '../tools-DAKYNcPv.cjs';
2
- export { D as DIAGRAM_REGISTRY, a as DIAGRAM_SINCE, b as DiagramCluster, c as DiagramListItem, d as DiagramMeta, E as Example, G as GetExamplesOptions, e as GetExamplesResult, f as GetSyntaxOptions, g as GetSyntaxResult, R as RenderDslResult, h as SchematexValidationError, i as SyntaxDoc, V as ValidateDslResult, j as getAllDiagramTypes, k as getDiagramMeta, l as getDiagramSince, m as getExamples, n as getSyntax, o as listDiagrams, r as renderDsl, p as resolveDiagramType, v as validateDsl } from '../tools-DAKYNcPv.cjs';
3
- import { a as DiagramType } from '../diagnostics-D2qkBfFx.cjs';
4
- import '../api-DnTyW-6F.cjs';
1
+ import { S as SyntaxDetail } from '../tools-vyVK2DHa.cjs';
2
+ export { D as DIAGRAM_REGISTRY, a as DIAGRAM_SINCE, b as DiagramCluster, c as DiagramListItem, d as DiagramMeta, E as Example, G as GetExamplesOptions, e as GetExamplesResult, f as GetSyntaxOptions, g as GetSyntaxResult, R as RenderDslResult, h as SchematexValidationError, i as SyntaxDoc, V as ValidateDslResult, j as getAllDiagramTypes, k as getDiagramMeta, l as getDiagramSince, m as getExamples, n as getSyntax, o as listDiagrams, r as renderDsl, p as resolveDiagramType, v as validateDsl } from '../tools-vyVK2DHa.cjs';
3
+ import { a as DiagramType } from '../diagnostics-Bps9pzlF.cjs';
4
+ import '../api-DecITB-t.cjs';
5
5
 
6
6
  interface BuildPromptContextOptions {
7
7
  /** How many few-shot examples to embed. Default 2. Set 0 to omit examples. */
@@ -1,7 +1,7 @@
1
- import { S as SyntaxDetail } from '../tools-DM0aLCbc.js';
2
- export { D as DIAGRAM_REGISTRY, a as DIAGRAM_SINCE, b as DiagramCluster, c as DiagramListItem, d as DiagramMeta, E as Example, G as GetExamplesOptions, e as GetExamplesResult, f as GetSyntaxOptions, g as GetSyntaxResult, R as RenderDslResult, h as SchematexValidationError, i as SyntaxDoc, V as ValidateDslResult, j as getAllDiagramTypes, k as getDiagramMeta, l as getDiagramSince, m as getExamples, n as getSyntax, o as listDiagrams, r as renderDsl, p as resolveDiagramType, v as validateDsl } from '../tools-DM0aLCbc.js';
3
- import { a as DiagramType } from '../diagnostics-D2qkBfFx.js';
4
- import '../api-D_d-JklT.js';
1
+ import { S as SyntaxDetail } from '../tools-CdzIw2Az.js';
2
+ export { D as DIAGRAM_REGISTRY, a as DIAGRAM_SINCE, b as DiagramCluster, c as DiagramListItem, d as DiagramMeta, E as Example, G as GetExamplesOptions, e as GetExamplesResult, f as GetSyntaxOptions, g as GetSyntaxResult, R as RenderDslResult, h as SchematexValidationError, i as SyntaxDoc, V as ValidateDslResult, j as getAllDiagramTypes, k as getDiagramMeta, l as getDiagramSince, m as getExamples, n as getSyntax, o as listDiagrams, r as renderDsl, p as resolveDiagramType, v as validateDsl } from '../tools-CdzIw2Az.js';
3
+ import { a as DiagramType } from '../diagnostics-Bps9pzlF.js';
4
+ import '../api-DAiP83-P.js';
5
5
 
6
6
  interface BuildPromptContextOptions {
7
7
  /** How many few-shot examples to embed. Default 2. Set 0 to omit examples. */
package/dist/ai/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { resolveDiagramType, getSyntax, getExamples } from '../chunk-RCR4UGKV.js';
2
- export { DIAGRAM_REGISTRY, DIAGRAM_SINCE, getAllDiagramTypes, getDiagramMeta, getDiagramSince, getExamples, getSyntax, listDiagrams, renderDsl, resolveDiagramType, validateDsl } from '../chunk-RCR4UGKV.js';
3
- import '../chunk-T5QOVX2I.js';
1
+ import { resolveDiagramType, getSyntax, getExamples } from '../chunk-4QBC4475.js';
2
+ export { DIAGRAM_REGISTRY, DIAGRAM_SINCE, getAllDiagramTypes, getDiagramMeta, getDiagramSince, getExamples, getSyntax, listDiagrams, renderDsl, resolveDiagramType, validateDsl } from '../chunk-4QBC4475.js';
3
+ import '../chunk-RU3N57OB.js';
4
4
  import '../chunk-EB7T5SEO.js';
5
- import '../chunk-IHX6J4HF.js';
5
+ import '../chunk-32LOZTNP.js';
6
6
  import '../chunk-P4U565XH.js';
7
7
  import '../chunk-W4UVDMUC.js';
8
- import '../chunk-MVTYPWHO.js';
8
+ import '../chunk-WTGABYFK.js';
9
9
  import '../chunk-2IRYXK4M.js';
10
10
  import '../chunk-NP7N3DZG.js';
11
11
  import '../chunk-KUSW5I2P.js';
@@ -1,4 +1,4 @@
1
- import { b as SchematexParseResult, c as SchematexRenderResult } from './diagnostics-D2qkBfFx.js';
1
+ import { b as SchematexParseResult, c as SchematexRenderResult } from './diagnostics-Bps9pzlF.js';
2
2
 
3
3
  interface SchematexConfig {
4
4
  type?: "genogram" | "ecomap" | "pedigree" | "phylo" | "sociogram" | "timing" | "logic" | "circuit" | "blockdiagram" | "ladder" | "sld" | "entity" | "fishbone" | "venn" | "flowchart" | "mindmap" | "matrix" | "orgchart" | "decisiontree" | "timeline" | "state" | "pid" | "erd" | "breadboard" | "bpmn" | "fbd" | "sfc" | "prisma" | "usecase" | "pert" | "sequence" | "petri" | "network" | "umlclass" | "faulttree" | "bowtie" | "rbd" | "floorplan" | "playbook";
@@ -1,4 +1,4 @@
1
- import { b as SchematexParseResult, c as SchematexRenderResult } from './diagnostics-D2qkBfFx.cjs';
1
+ import { b as SchematexParseResult, c as SchematexRenderResult } from './diagnostics-Bps9pzlF.cjs';
2
2
 
3
3
  interface SchematexConfig {
4
4
  type?: "genogram" | "ecomap" | "pedigree" | "phylo" | "sociogram" | "timing" | "logic" | "circuit" | "blockdiagram" | "ladder" | "sld" | "entity" | "fishbone" | "venn" | "flowchart" | "mindmap" | "matrix" | "orgchart" | "decisiontree" | "timeline" | "state" | "pid" | "erd" | "breadboard" | "bpmn" | "fbd" | "sfc" | "prisma" | "usecase" | "pert" | "sequence" | "petri" | "network" | "umlclass" | "faulttree" | "bowtie" | "rbd" | "floorplan" | "playbook";
package/dist/browser.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkOY2CXLVY_cjs = require('./chunk-OY2CXLVY.cjs');
3
+ var chunk5YTFNOKY_cjs = require('./chunk-5YTFNOKY.cjs');
4
4
  require('./chunk-UHRNFBWY.cjs');
5
- require('./chunk-TXWVJAMR.cjs');
5
+ require('./chunk-HEGDKO2E.cjs');
6
6
  require('./chunk-T55OQILI.cjs');
7
7
  require('./chunk-GTCGATOL.cjs');
8
- require('./chunk-MXV3XJFH.cjs');
8
+ require('./chunk-YN7EBTWB.cjs');
9
9
  require('./chunk-4MANMKQ4.cjs');
10
10
  require('./chunk-YFPDZVB7.cjs');
11
11
  require('./chunk-3JN4762U.cjs');
@@ -26,10 +26,10 @@ require('./chunk-3WNW5Y7P.cjs');
26
26
 
27
27
  // src/browser.ts
28
28
  function renderToElement(text, config) {
29
- return svgStringToElement(chunkOY2CXLVY_cjs.render(text, config));
29
+ return svgStringToElement(chunk5YTFNOKY_cjs.render(text, config));
30
30
  }
31
31
  function renderPreviewToElement(text, config) {
32
- return svgStringToElement(chunkOY2CXLVY_cjs.renderPreview(text, config));
32
+ return svgStringToElement(chunk5YTFNOKY_cjs.renderPreview(text, config));
33
33
  }
34
34
  function svgStringToElement(svgString) {
35
35
  const parser = new DOMParser();
@@ -42,23 +42,23 @@ function svgStringToElement(svgString) {
42
42
  return el;
43
43
  }
44
44
  function renderToContainer(text, container, config) {
45
- container.innerHTML = chunkOY2CXLVY_cjs.render(text, config);
45
+ container.innerHTML = chunk5YTFNOKY_cjs.render(text, config);
46
46
  }
47
47
  function renderPreviewToContainer(text, container, config) {
48
- container.innerHTML = chunkOY2CXLVY_cjs.renderPreview(text, config);
48
+ container.innerHTML = chunk5YTFNOKY_cjs.renderPreview(text, config);
49
49
  }
50
50
 
51
51
  Object.defineProperty(exports, "render", {
52
52
  enumerable: true,
53
- get: function () { return chunkOY2CXLVY_cjs.render; }
53
+ get: function () { return chunk5YTFNOKY_cjs.render; }
54
54
  });
55
55
  Object.defineProperty(exports, "renderPreview", {
56
56
  enumerable: true,
57
- get: function () { return chunkOY2CXLVY_cjs.renderPreview; }
57
+ get: function () { return chunk5YTFNOKY_cjs.renderPreview; }
58
58
  });
59
59
  Object.defineProperty(exports, "renderResult", {
60
60
  enumerable: true,
61
- get: function () { return chunkOY2CXLVY_cjs.renderResult; }
61
+ get: function () { return chunk5YTFNOKY_cjs.renderResult; }
62
62
  });
63
63
  exports.renderPreviewToContainer = renderPreviewToContainer;
64
64
  exports.renderPreviewToElement = renderPreviewToElement;
@@ -1,6 +1,6 @@
1
- import { S as SchematexConfig } from './api-DnTyW-6F.cjs';
2
- export { r as render, b as renderPreview, c as renderResult } from './api-DnTyW-6F.cjs';
3
- import './diagnostics-D2qkBfFx.cjs';
1
+ import { S as SchematexConfig } from './api-DecITB-t.cjs';
2
+ export { r as render, b as renderPreview, c as renderResult } from './api-DecITB-t.cjs';
3
+ import './diagnostics-Bps9pzlF.cjs';
4
4
 
5
5
  /**
6
6
  * Browser-specific utilities for Schematex.
package/dist/browser.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { S as SchematexConfig } from './api-D_d-JklT.js';
2
- export { r as render, b as renderPreview, c as renderResult } from './api-D_d-JklT.js';
3
- import './diagnostics-D2qkBfFx.js';
1
+ import { S as SchematexConfig } from './api-DAiP83-P.js';
2
+ export { r as render, b as renderPreview, c as renderResult } from './api-DAiP83-P.js';
3
+ import './diagnostics-Bps9pzlF.js';
4
4
 
5
5
  /**
6
6
  * Browser-specific utilities for Schematex.
package/dist/browser.js CHANGED
@@ -1,10 +1,10 @@
1
- import { render, renderPreview } from './chunk-T5QOVX2I.js';
2
- export { render, renderPreview, renderResult } from './chunk-T5QOVX2I.js';
1
+ import { render, renderPreview } from './chunk-RU3N57OB.js';
2
+ export { render, renderPreview, renderResult } from './chunk-RU3N57OB.js';
3
3
  import './chunk-EB7T5SEO.js';
4
- import './chunk-IHX6J4HF.js';
4
+ import './chunk-32LOZTNP.js';
5
5
  import './chunk-P4U565XH.js';
6
6
  import './chunk-W4UVDMUC.js';
7
- import './chunk-MVTYPWHO.js';
7
+ import './chunk-WTGABYFK.js';
8
8
  import './chunk-2IRYXK4M.js';
9
9
  import './chunk-NP7N3DZG.js';
10
10
  import './chunk-KUSW5I2P.js';
@@ -756,6 +756,126 @@ var terminal_block = {
756
756
  return parts.join("");
757
757
  }
758
758
  };
759
+ function numAttr(attrs, key, fallback) {
760
+ const v = Number(attrs?.[key]);
761
+ return Number.isFinite(v) && v > 0 ? v : fallback;
762
+ }
763
+ function effectiveSymbolDef(type, attrs) {
764
+ const sym = getSymbol(type);
765
+ if (!sym) return void 0;
766
+ if (type !== "enclosure" && type !== "din_rail" && type !== "wire_duct") return sym;
767
+ if (type === "enclosure") {
768
+ const w = numAttr(attrs, "width", numAttr(attrs, "w", 240));
769
+ const h2 = numAttr(attrs, "height", numAttr(attrs, "h", 160));
770
+ return {
771
+ ...sym,
772
+ length: w,
773
+ anchors: {
774
+ start: { x: 0, y: 0 },
775
+ end: { x: w, y: 0 },
776
+ center: { x: w / 2, y: h2 / 2 },
777
+ bottom_left: { x: 0, y: h2 },
778
+ bottom_right: { x: w, y: h2 }
779
+ }
780
+ };
781
+ }
782
+ const length = numAttr(attrs, "length", 180);
783
+ const h = type === "wire_duct" ? 22 : 14;
784
+ return {
785
+ ...sym,
786
+ length,
787
+ anchors: {
788
+ start: { x: 0, y: 0 },
789
+ end: { x: length, y: 0 },
790
+ center: { x: length / 2, y: 0 },
791
+ bottom_right: { x: length, y: h }
792
+ }
793
+ };
794
+ }
795
+ var enclosure = {
796
+ length: 240,
797
+ anchors: { start: { x: 0, y: 0 }, end: { x: 240, y: 0 }, bottom_right: { x: 240, y: 160 } },
798
+ svg: (label, _value, attrs) => {
799
+ const w = numAttr(attrs, "width", numAttr(attrs, "w", 240));
800
+ const h = numAttr(attrs, "height", numAttr(attrs, "h", 160));
801
+ const title2 = label ?? attrs?.title ?? "Panel";
802
+ return [
803
+ `<rect x="0" y="0" width="${w}" height="${h}" rx="8" fill="none" class="schematex-circuit-enclosure"/>`,
804
+ `<rect x="10" y="20" width="${Math.max(10, w - 20)}" height="${Math.max(10, h - 30)}" rx="3" fill="none" class="schematex-circuit-enclosure-inner"/>`,
805
+ `<text x="${w / 2}" y="15" text-anchor="middle" class="schematex-circuit-panel-label">${title2}</text>`
806
+ ].join("");
807
+ }
808
+ };
809
+ var din_rail = {
810
+ length: 180,
811
+ anchors: { start: { x: 0, y: 0 }, end: { x: 180, y: 0 } },
812
+ svg: (_label, _value, attrs) => {
813
+ const l = numAttr(attrs, "length", 180);
814
+ const slots = [];
815
+ for (let x = 8; x < l - 4; x += 16) {
816
+ slots.push(`<rect x="${x}" y="-3" width="8" height="6" rx="2" class="schematex-circuit-din-slot"/>`);
817
+ }
818
+ return [
819
+ `<rect x="0" y="-7" width="${l}" height="14" rx="2" class="schematex-circuit-din"/>`,
820
+ ...slots
821
+ ].join("");
822
+ }
823
+ };
824
+ var wire_duct = {
825
+ length: 180,
826
+ anchors: { start: { x: 0, y: 0 }, end: { x: 180, y: 0 }, bottom_right: { x: 180, y: 22 } },
827
+ svg: (_label, _value, attrs) => {
828
+ const l = numAttr(attrs, "length", 180);
829
+ const teeth = [];
830
+ for (let x = 8; x < l - 4; x += 12) {
831
+ teeth.push(`<line x1="${x}" y1="0" x2="${x}" y2="22" class="schematex-circuit-duct-tooth"/>`);
832
+ }
833
+ return [
834
+ `<rect x="0" y="0" width="${l}" height="22" rx="2" class="schematex-circuit-duct"/>`,
835
+ ...teeth
836
+ ].join("");
837
+ }
838
+ };
839
+ var plc = {
840
+ length: 70,
841
+ anchors: { start: { x: 0, y: 0 }, end: { x: 70, y: 0 }, pwr: { x: 0, y: 24 }, out: { x: 70, y: 24 } },
842
+ svg: (label, _value, attrs) => {
843
+ const title2 = label ?? attrs?.model ?? "PLC";
844
+ const leds = [12, 24, 36, 48, 60].map((x) => `<circle cx="${x}" cy="28" r="2.2" class="schematex-circuit-panel-led"/>`).join("");
845
+ return [
846
+ `<rect x="0" y="-20" width="70" height="56" rx="4" fill="white" ${BODY}/>`,
847
+ `<text x="35" y="-2" text-anchor="middle" class="schematex-circuit-meter">${title2}</text>`,
848
+ leds
849
+ ].join("");
850
+ }
851
+ };
852
+ var pilot_light = {
853
+ length: 22,
854
+ anchors: { start: { x: 0, y: 0 }, end: { x: 22, y: 0 } },
855
+ svg: (label, _value) => [
856
+ `<circle cx="11" cy="0" r="10" class="schematex-circuit-panel-light"/>`,
857
+ `<circle cx="11" cy="0" r="4" class="schematex-circuit-panel-led"/>`,
858
+ label ? `<text x="11" y="20" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
859
+ ].join("")
860
+ };
861
+ var selector_switch = {
862
+ length: 26,
863
+ anchors: { start: { x: 0, y: 0 }, end: { x: 26, y: 0 } },
864
+ svg: (label) => [
865
+ `<circle cx="13" cy="0" r="12" fill="white" ${BODY}/>`,
866
+ `<line x1="7" y1="5" x2="19" y2="-5" ${BODY}/>`,
867
+ label ? `<text x="13" y="22" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
868
+ ].join("")
869
+ };
870
+ var emergency_stop = {
871
+ length: 30,
872
+ anchors: { start: { x: 0, y: 0 }, end: { x: 30, y: 0 } },
873
+ svg: (label) => [
874
+ `<circle cx="15" cy="0" r="14" class="schematex-circuit-estop"/>`,
875
+ `<text x="15" y="4" text-anchor="middle" class="schematex-circuit-meter">E</text>`,
876
+ label ? `<text x="15" y="25" text-anchor="middle" class="schematex-circuit-pol">${label}</text>` : ""
877
+ ].join("")
878
+ };
759
879
  var relay_coil = {
760
880
  length: 40,
761
881
  anchors: { start: { x: 0, y: 0 }, end: { x: 40, y: 0 } },
@@ -1357,6 +1477,13 @@ var SYMBOLS = {
1357
1477
  antenna,
1358
1478
  generic_ic,
1359
1479
  terminal_block,
1480
+ enclosure,
1481
+ din_rail,
1482
+ wire_duct,
1483
+ plc,
1484
+ pilot_light,
1485
+ selector_switch,
1486
+ emergency_stop,
1360
1487
  "555_timer": timer_555,
1361
1488
  voltage_regulator,
1362
1489
  // Industrial control / power electrical (IEC 60617)
@@ -1455,7 +1582,15 @@ var TYPE_ALIASES = {
1455
1582
  tb: "terminal_block",
1456
1583
  junction_box: "terminal_block",
1457
1584
  jbox: "terminal_block",
1458
- enclosure: "terminal_block"
1585
+ enclosure: "enclosure",
1586
+ cabinet: "enclosure",
1587
+ panel: "enclosure",
1588
+ dinrail: "din_rail",
1589
+ din_rail: "din_rail",
1590
+ wireduct: "wire_duct",
1591
+ wire_duct: "wire_duct",
1592
+ trunking: "wire_duct",
1593
+ plc: "plc"
1459
1594
  };
1460
1595
  var GROUND_REF = /^(0|gnd|ground|earth|pe|agnd|dgnd|gnda|gndd|vss|com)(_\w+|\d+)?$/i;
1461
1596
  function isGroundRef(s) {
@@ -1719,6 +1854,14 @@ var COMPONENT_TYPES = /* @__PURE__ */ new Set([
1719
1854
  "voltage_regulator",
1720
1855
  "dc_dc_converter",
1721
1856
  "555_timer",
1857
+ "terminal_block",
1858
+ "enclosure",
1859
+ "din_rail",
1860
+ "wire_duct",
1861
+ "plc",
1862
+ "pilot_light",
1863
+ "selector_switch",
1864
+ "emergency_stop",
1722
1865
  "voltage_source",
1723
1866
  "current_source",
1724
1867
  "ac_source",
@@ -1773,6 +1916,25 @@ var ALIASES = {
1773
1916
  ic: "generic_ic",
1774
1917
  reg: "voltage_regulator",
1775
1918
  timer555: "555_timer",
1919
+ terminal: "terminal_block",
1920
+ tb: "terminal_block",
1921
+ junction_box: "terminal_block",
1922
+ jbox: "terminal_block",
1923
+ cabinet: "enclosure",
1924
+ panel: "enclosure",
1925
+ backplate: "enclosure",
1926
+ dinrail: "din_rail",
1927
+ "din-rail": "din_rail",
1928
+ duct: "wire_duct",
1929
+ wireduct: "wire_duct",
1930
+ trunking: "wire_duct",
1931
+ controller: "plc",
1932
+ indicator: "pilot_light",
1933
+ pilot: "pilot_light",
1934
+ selector: "selector_switch",
1935
+ estop: "emergency_stop",
1936
+ e_stop: "emergency_stop",
1937
+ "e-stop": "emergency_stop",
1776
1938
  therm: "thermistor_ntc",
1777
1939
  ntc: "thermistor_ntc",
1778
1940
  ptc: "thermistor_ptc",
@@ -2164,6 +2326,8 @@ function rotatePoint(p, angleDeg) {
2164
2326
  }
2165
2327
  function resolveAnchorRef(ref, byId, nets) {
2166
2328
  if (ref === "origin") return { x: 0, y: 0 };
2329
+ const coord = /^@?(-?\d+(?:\.\d+)?),(-?\d+(?:\.\d+)?)$/.exec(ref.trim());
2330
+ if (coord) return { x: Number(coord[1]), y: Number(coord[2]) };
2167
2331
  if (nets.has(ref)) return nets.get(ref);
2168
2332
  const dot = ref.indexOf(".");
2169
2333
  if (dot < 0) {
@@ -2188,7 +2352,7 @@ function layoutCircuit(ast) {
2188
2352
  const resolved = resolveAnchorRef(comp.at, byId, nets);
2189
2353
  if (resolved) startPt = resolved;
2190
2354
  }
2191
- const sym = getSymbol(comp.componentType);
2355
+ const sym = effectiveSymbolDef(comp.componentType, comp.attrs) ?? getSymbol(comp.componentType);
2192
2356
  const rot = rotationDeg(comp.direction);
2193
2357
  if (comp.componentType === "wire") {
2194
2358
  const len = parseInt(comp.attrs?.length ?? "20", 10);
@@ -2658,6 +2822,16 @@ function renderCircuit(ast, config) {
2658
2822
  .schematex-circuit-meter { font: bold 12px sans-serif; fill: ${t.stroke}; }
2659
2823
  .schematex-circuit-title { font: 700 16px sans-serif; fill: ${t.text}; }
2660
2824
  .schematex-circuit-err { stroke: ${t.error}; fill: ${t.error}; }
2825
+ .schematex-circuit-enclosure { stroke: ${t.stroke}; stroke-width: 2; stroke-dasharray: 8 5; fill: ${t.bg}; }
2826
+ .schematex-circuit-enclosure-inner { stroke: ${t.textMuted}; stroke-width: 1; stroke-dasharray: 4 3; fill: none; }
2827
+ .schematex-circuit-panel-label { font: 700 11px system-ui, sans-serif; fill: ${t.text}; }
2828
+ .schematex-circuit-din { fill: ${t.bg}; stroke: ${t.stroke}; stroke-width: 1.4; }
2829
+ .schematex-circuit-din-slot { fill: ${t.textMuted}; opacity: 0.5; }
2830
+ .schematex-circuit-duct { fill: none; stroke: ${t.textMuted}; stroke-width: 1.2; stroke-dasharray: 3 2; }
2831
+ .schematex-circuit-duct-tooth { stroke: ${t.textMuted}; stroke-width: 0.8; opacity: 0.65; }
2832
+ .schematex-circuit-panel-led { fill: ${t.accent}; stroke: ${t.stroke}; stroke-width: 0.8; }
2833
+ .schematex-circuit-panel-light { fill: ${t.bg}; stroke: ${t.stroke}; stroke-width: 1.5; }
2834
+ .schematex-circuit-estop { fill: ${t.error}; stroke: ${t.stroke}; stroke-width: 1.4; }
2661
2835
  `.trim();
2662
2836
  const titleBar = ast.title ? text(
2663
2837
  {
@@ -2706,5 +2880,5 @@ var circuit = {
2706
2880
  };
2707
2881
 
2708
2882
  export { EXTRA_SYMBOLS, SYMBOLS, circuit, layoutCircuit, layoutCircuitNetlist, lintCircuit, parseCircuit, parseNetlist, renderCircuit };
2709
- //# sourceMappingURL=chunk-IHX6J4HF.js.map
2710
- //# sourceMappingURL=chunk-IHX6J4HF.js.map
2883
+ //# sourceMappingURL=chunk-32LOZTNP.js.map
2884
+ //# sourceMappingURL=chunk-32LOZTNP.js.map