@pixerate/editor 0.163.0 → 0.165.0

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 (159) hide show
  1. package/dist/agent/index.cjs +54 -39
  2. package/dist/agent/index.js +24 -9
  3. package/dist/animation/index.cjs +6 -5
  4. package/dist/animation/index.js +5 -4
  5. package/dist/animation-editor/index.cjs +65 -64
  6. package/dist/animation-editor/index.js +8 -7
  7. package/dist/bridge/cli.cjs +3 -3
  8. package/dist/bridge/cli.js +2 -2
  9. package/dist/bridge/index.cjs +3 -3
  10. package/dist/bridge/index.js +2 -2
  11. package/dist/canvas/displacement.d.cts +34 -2
  12. package/dist/canvas/displacement.d.ts +34 -2
  13. package/dist/canvas/explosion-tools.d.cts +43 -0
  14. package/dist/canvas/explosion-tools.d.ts +43 -0
  15. package/dist/canvas/explosionLayout.d.cts +50 -0
  16. package/dist/canvas/explosionLayout.d.ts +50 -0
  17. package/dist/canvas/explosionState.d.cts +52 -0
  18. package/dist/canvas/explosionState.d.ts +52 -0
  19. package/dist/canvas/index.cjs +512 -168
  20. package/dist/canvas/index.d.cts +3 -0
  21. package/dist/canvas/index.d.ts +3 -0
  22. package/dist/canvas/index.js +434 -90
  23. package/dist/canvas/types.d.cts +27 -2
  24. package/dist/canvas/types.d.ts +27 -2
  25. package/dist/chart/controller.d.cts +31 -2
  26. package/dist/chart/controller.d.ts +31 -2
  27. package/dist/chart/index.cjs +504 -132
  28. package/dist/chart/index.d.cts +2 -0
  29. package/dist/chart/index.d.ts +2 -0
  30. package/dist/chart/index.js +386 -14
  31. package/dist/chart/layout-families.d.cts +7 -0
  32. package/dist/chart/layout-families.d.ts +7 -0
  33. package/dist/chart/links.d.cts +34 -0
  34. package/dist/chart/links.d.ts +34 -0
  35. package/dist/chart/mermaid.d.cts +9 -6
  36. package/dist/chart/mermaid.d.ts +9 -6
  37. package/dist/chart/schemas.d.cts +3 -0
  38. package/dist/chart/schemas.d.ts +3 -0
  39. package/dist/chart/spec.d.cts +3 -2
  40. package/dist/chart/spec.d.ts +3 -2
  41. package/dist/chart/style.d.cts +33 -0
  42. package/dist/chart/style.d.ts +33 -0
  43. package/dist/chart/types.d.cts +24 -2
  44. package/dist/chart/types.d.ts +24 -2
  45. package/dist/{chunk-TALQONZ5.js → chunk-2J5VLJHC.js} +3 -3
  46. package/dist/{chunk-3NEZJCBY.js → chunk-2ZRN43IN.js} +340 -201
  47. package/dist/{chunk-ZVNAMTFO.cjs → chunk-3FSUJIXN.cjs} +18 -174
  48. package/dist/{chunk-RQCMSEM5.cjs → chunk-4QUUHTGJ.cjs} +2 -2
  49. package/dist/{chunk-CIPIESX4.cjs → chunk-4ZC5QJE2.cjs} +3 -3
  50. package/dist/{chunk-S6X2QRVU.cjs → chunk-5UEFBM2M.cjs} +1 -138
  51. package/dist/{chunk-YSAGBIRW.cjs → chunk-64VWWR5U.cjs} +16 -16
  52. package/dist/{chunk-QYZGBVNC.js → chunk-7272D3K2.js} +10 -8
  53. package/dist/{chunk-462WGGXX.cjs → chunk-AMX23CSN.cjs} +27 -16
  54. package/dist/{chunk-3VLOOO3G.js → chunk-BDIM6NVW.js} +1 -1
  55. package/dist/{chunk-POR54B55.js → chunk-CRFSQWKQ.js} +4 -1
  56. package/dist/{chunk-GZ2FM3ZB.js → chunk-DKNEQX7T.js} +6 -162
  57. package/dist/{chunk-JCXMJUQO.cjs → chunk-EGZM52EO.cjs} +3 -3
  58. package/dist/{chunk-ES3UEVUT.cjs → chunk-EUIDTZNQ.cjs} +112 -110
  59. package/dist/{chunk-H3OEM3Q2.js → chunk-F6R67I3A.js} +1 -1
  60. package/dist/{chunk-5FNGLV2D.js → chunk-FEU2XVQH.js} +15 -3
  61. package/dist/{chunk-SZA42R4N.js → chunk-FRBRLKNQ.js} +154 -16
  62. package/dist/chunk-HIDFL5LQ.js +484 -0
  63. package/dist/{chunk-MKTDELCD.js → chunk-I5MRJW7B.js} +1 -1
  64. package/dist/{chunk-SDHZG5TF.js → chunk-ILP77UD6.js} +160 -2
  65. package/dist/{chunk-GKNEJ6EN.cjs → chunk-IMRXC7OA.cjs} +241 -103
  66. package/dist/chunk-KGRZMHZB.js +204 -0
  67. package/dist/{chunk-SET6KJOP.js → chunk-LPIKXPBM.js} +1 -1
  68. package/dist/{chunk-BQWGN5WH.js → chunk-M2TPMYJE.js} +1 -1
  69. package/dist/{chunk-GTELFJRE.cjs → chunk-M5GLQQWG.cjs} +2 -2
  70. package/dist/{chunk-4VU4CP7R.js → chunk-MHLU6GRJ.js} +1 -138
  71. package/dist/{chunk-D54JHQK2.cjs → chunk-MKXK6E4O.cjs} +51 -51
  72. package/dist/{chunk-DAPQGA55.js → chunk-N7NBGT2Y.js} +2 -2
  73. package/dist/chunk-O6OGNDND.js +164 -0
  74. package/dist/{chunk-22KLZZGH.cjs → chunk-ODFCS7HF.cjs} +8 -8
  75. package/dist/{chunk-PA3IMPPS.cjs → chunk-OVYQAYGH.cjs} +81 -81
  76. package/dist/{chunk-YXOW456B.js → chunk-PPEDZ5WR.js} +1 -1
  77. package/dist/{chunk-YGG7WDWT.cjs → chunk-Q25WAFTD.cjs} +21 -18
  78. package/dist/{chunk-SBQVEBSU.cjs → chunk-QO2T6KA5.cjs} +165 -67
  79. package/dist/{chunk-24M7VD6M.cjs → chunk-S4EIAIEW.cjs} +7 -7
  80. package/dist/{chunk-M4MIZPQI.cjs → chunk-SJ2CPTQC.cjs} +189 -15
  81. package/dist/chunk-TFF2GTGN.cjs +153 -0
  82. package/dist/chunk-TTCJPX4U.cjs +204 -0
  83. package/dist/{chunk-NZD2MZJC.cjs → chunk-TVQW26AV.cjs} +35 -23
  84. package/dist/{chunk-R3P2M7HU.cjs → chunk-UVXTOZ2B.cjs} +346 -207
  85. package/dist/{chunk-WI7QJA7A.cjs → chunk-UXETV2NC.cjs} +161 -3
  86. package/dist/{chunk-Z4P2RBMJ.js → chunk-V5GSY3NC.js} +101 -3
  87. package/dist/{chunk-QY4KUDMY.js → chunk-VRXXAXUT.js} +2 -2
  88. package/dist/chunk-VU6WQSMB.cjs +164 -0
  89. package/dist/{chunk-OXERWBKE.js → chunk-X5W645RI.js} +3 -3
  90. package/dist/{chunk-NHLYK3AX.js → chunk-XBQX76CT.js} +182 -8
  91. package/dist/{chunk-5AARIS3R.cjs → chunk-XCDGM7TD.cjs} +37 -37
  92. package/dist/{chunk-EVXQNQND.js → chunk-XZB3TJ6K.js} +16 -5
  93. package/dist/chunk-YBAPT7NL.js +153 -0
  94. package/dist/chunk-Z2UQYMPS.cjs +484 -0
  95. package/dist/color/index.cjs +5 -3
  96. package/dist/color/index.js +12 -10
  97. package/dist/diagram/index.cjs +55 -243
  98. package/dist/diagram/index.js +12 -200
  99. package/dist/export/index.cjs +7 -6
  100. package/dist/export/index.js +6 -5
  101. package/dist/extensions/index.cjs +12 -9
  102. package/dist/extensions/index.js +11 -8
  103. package/dist/gradient/index.cjs +29 -27
  104. package/dist/gradient/index.js +6 -4
  105. package/dist/image-editor/index.cjs +644 -643
  106. package/dist/image-editor/index.js +7 -6
  107. package/dist/index.cjs +21 -18
  108. package/dist/index.js +14 -11
  109. package/dist/paint-editor/index.cjs +19 -18
  110. package/dist/paint-editor/index.js +7 -6
  111. package/dist/parameters/index.cjs +2 -2
  112. package/dist/parameters/index.js +1 -1
  113. package/dist/persistence/assetWrites.d.cts +22 -0
  114. package/dist/persistence/assetWrites.d.ts +22 -0
  115. package/dist/persistence/assets.d.cts +71 -0
  116. package/dist/persistence/assets.d.ts +71 -0
  117. package/dist/persistence/documentStore.d.cts +17 -1
  118. package/dist/persistence/documentStore.d.ts +17 -1
  119. package/dist/persistence/documentTools.d.cts +5 -1
  120. package/dist/persistence/documentTools.d.ts +5 -1
  121. package/dist/persistence/editorAutosave.d.cts +7 -0
  122. package/dist/persistence/editorAutosave.d.ts +7 -0
  123. package/dist/persistence/index.cjs +141 -21
  124. package/dist/persistence/index.js +130 -10
  125. package/dist/persistence/storage.d.cts +13 -1
  126. package/dist/persistence/storage.d.ts +13 -1
  127. package/dist/spreadsheet/index.cjs +3 -3
  128. package/dist/spreadsheet/index.js +2 -2
  129. package/dist/tokens/index.cjs +11 -3
  130. package/dist/tokens/index.d.cts +1 -0
  131. package/dist/tokens/index.d.ts +1 -0
  132. package/dist/tokens/index.js +10 -2
  133. package/dist/tokens/style.d.cts +36 -0
  134. package/dist/tokens/style.d.ts +36 -0
  135. package/dist/tools/index.cjs +15 -3
  136. package/dist/tools/index.d.cts +2 -0
  137. package/dist/tools/index.d.ts +2 -0
  138. package/dist/tools/index.js +14 -2
  139. package/dist/tools/style-tools.d.cts +19 -0
  140. package/dist/tools/style-tools.d.ts +19 -0
  141. package/dist/tools/style.d.cts +212 -0
  142. package/dist/tools/style.d.ts +212 -0
  143. package/dist/tools/view.d.cts +6 -0
  144. package/dist/tools/view.d.ts +6 -0
  145. package/dist/typography/index.cjs +8 -6
  146. package/dist/typography/index.js +5 -3
  147. package/dist/vector/index.cjs +953 -952
  148. package/dist/vector/index.js +7 -6
  149. package/dist/video-editor/index.cjs +8 -7
  150. package/dist/video-editor/index.js +6 -5
  151. package/package.json +1 -1
  152. package/skills/README.md +12 -0
  153. package/skills/pixerate-agent-tools/SKILL.md +34 -1
  154. package/skills/pixerate-chart/SKILL.md +41 -9
  155. package/skills/pixerate-image-editor/SKILL.md +2 -0
  156. package/skills/pixerate-paint-editor/SKILL.md +2 -0
  157. package/skills/pixerate-tokens/SKILL.md +5 -0
  158. package/dist/chunk-ERAGQL2N.cjs +0 -68
  159. package/dist/chunk-KMU6QJB7.js +0 -68
@@ -253,6 +253,12 @@ var ToolRegistryView = (_class = class {
253
253
  return set.tools.some((t) => this.enabledTools.has(t)) ? "some" : "none";
254
254
  };
255
255
  const listedCount = () => this.listed(this.catalogue()).length;
256
+ const styleOf = async (set) => {
257
+ const domain = _optionalChain([set, 'access', _13 => _13.skill, 'optionalAccess', _14 => _14.replace, 'call', _15 => _15(/^pixerate-/, "")]);
258
+ if (!discovery.styles || !domain || !discovery.styles.domains.some((d) => d.id === domain)) return void 0;
259
+ const style = await discovery.styles.resolve(domain);
260
+ return style.skills.length ? { domain, skills: style.skills.length, layers: [...new Set(style.skills.map((s) => s.layer))] } : void 0;
261
+ };
256
262
  const tools = [
257
263
  {
258
264
  name: "list_toolsets",
@@ -260,16 +266,18 @@ var ToolRegistryView = (_class = class {
260
266
  description: "Lists the groups of editor tools available here (one per open editor or feature): name, title, what it covers, its agent skill, how many tools it has and whether they are in your tool list (`enabled`: all, some or none). Start here, then call search_tools or enable_tools.",
261
267
  annotations: READ_ONLY,
262
268
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
263
- handler: () => {
269
+ handler: async () => {
264
270
  const cat = this.catalogue();
271
+ const styles = await Promise.all(cat.sets.map(styleOf));
265
272
  return {
266
- toolsets: cat.sets.map((set) => ({
273
+ toolsets: cat.sets.map((set, i) => ({
267
274
  name: set.name,
268
275
  ...set.title ? { title: set.title } : {},
269
276
  ...set.description ? { description: set.description } : {},
270
277
  ...set.skill ? { skill: set.skill } : {},
271
278
  tools: set.tools.length,
272
- enabled: enabledState(set)
279
+ enabled: enabledState(set),
280
+ ...styles[i] ? { style: styles[i] } : {}
273
281
  })),
274
282
  ...skills.length > 0 ? { skills: skills.map((s) => s.name) } : {}
275
283
  };
@@ -312,9 +320,12 @@ var ToolRegistryView = (_class = class {
312
320
  description: "Adds tools to your tool list: single tools by name (from search_tools) and/or whole toolsets (from list_toolsets). Returns the names added and how many tools are listed now. Prefer single tools over large toolsets. Unknown names fail and change nothing.",
313
321
  annotations: LISTING,
314
322
  inputSchema: SELECTION_SCHEMA,
315
- handler: (args) => {
323
+ handler: async (args) => {
316
324
  const added = this.enableTools(args);
317
- return { added, listed: listedCount() };
325
+ const sets = this.catalogue().sets.filter((set) => set.tools.some((t) => added.includes(t)));
326
+ const domains = (await Promise.all(sets.map(styleOf))).filter((s) => s !== void 0).map((s) => s.domain);
327
+ const style = [...new Set(domains)].map((d) => `House style applies: call get_style with domain "${d}" before making changes.`);
328
+ return { added, listed: listedCount(), ...style.length ? { style } : {} };
318
329
  }
319
330
  },
320
331
  {
@@ -417,7 +428,7 @@ function toDefinition2(name, tool) {
417
428
  return { name, ...rest };
418
429
  }
419
430
  function errorResult(error) {
420
- const details = _optionalChain([error, 'access', _13 => _13.details, 'optionalAccess', _14 => _14.length]) ? "\n" + error.details.map((d) => `- ${d.path}: ${d.message}`).join("\n") : "";
431
+ const details = _optionalChain([error, 'access', _16 => _16.details, 'optionalAccess', _17 => _17.length]) ? "\n" + error.details.map((d) => `- ${d.path}: ${d.message}`).join("\n") : "";
421
432
  return {
422
433
  isError: true,
423
434
  content: [{ type: "text", text: `${error.message}${details}` }],
@@ -499,7 +510,7 @@ var ToolRegistry = (_class2 = class {
499
510
  );
500
511
  if (index === -1) return false;
501
512
  const [entry] = this.entries.splice(index, 1);
502
- _optionalChain([entry, 'access', _15 => _15.unsubscribe, 'optionalCall', _16 => _16()]);
513
+ _optionalChain([entry, 'access', _18 => _18.unsubscribe, 'optionalCall', _19 => _19()]);
503
514
  this.notifyListChanged();
504
515
  return true;
505
516
  }
@@ -680,7 +691,7 @@ var ToolRegistry = (_class2 = class {
680
691
  dispose() {
681
692
  if (this.timer !== null) clearTimeout(this.timer);
682
693
  this.timer = null;
683
- for (const entry of this.entries.splice(0)) _optionalChain([entry, 'access', _17 => _17.unsubscribe, 'optionalCall', _18 => _18()]);
694
+ for (const entry of this.entries.splice(0)) _optionalChain([entry, 'access', _20 => _20.unsubscribe, 'optionalCall', _21 => _21()]);
684
695
  this.listeners.clear();
685
696
  }
686
697
  }, _class2);
@@ -791,7 +802,7 @@ function paramText(schema, depth = 0) {
791
802
  function document(tool, toolset) {
792
803
  const fields = {
793
804
  name: new Set(searchTokens(baseToolName(tool.name))),
794
- title: new Set(searchTokens(_nullishCoalesce(_nullishCoalesce(tool.title, () => ( _optionalChain([tool, 'access', _19 => _19.annotations, 'optionalAccess', _20 => _20.title]))), () => ( "")))),
805
+ title: new Set(searchTokens(_nullishCoalesce(_nullishCoalesce(tool.title, () => ( _optionalChain([tool, 'access', _22 => _22.annotations, 'optionalAccess', _23 => _23.title]))), () => ( "")))),
795
806
  toolset: new Set(searchTokens(`${toolset.name} ${_nullishCoalesce(toolset.title, () => ( ""))} ${_nullishCoalesce(toolset.description, () => ( ""))}`)),
796
807
  description: new Set(searchTokens(_nullishCoalesce(tool.description, () => ( "")))),
797
808
  params: new Set(searchTokens(paramText(tool.inputSchema)))
@@ -859,7 +870,7 @@ function searchTools(tools, toolsets, query, options = {}) {
859
870
  toolset: doc.toolset.name,
860
871
  ...doc.tool.title ? { title: doc.tool.title } : {},
861
872
  summary: summarize(doc.tool.description),
862
- readOnly: _optionalChain([doc, 'access', _21 => _21.tool, 'access', _22 => _22.annotations, 'optionalAccess', _23 => _23.readOnlyHint]) === true,
873
+ readOnly: _optionalChain([doc, 'access', _24 => _24.tool, 'access', _25 => _25.annotations, 'optionalAccess', _26 => _26.readOnlyHint]) === true,
863
874
  score: Math.round(score * 100) / 100
864
875
  });
865
876
  }
@@ -911,7 +922,7 @@ function createMcpServer(registry, options) {
911
922
  ...registry.capabilities,
912
923
  ...skills.length > 0 ? { resources: {}, prompts: {} } : {}
913
924
  };
914
- const readSkillPath = (path) => _nullishCoalesce(_optionalChain([skillFiles, 'optionalAccess', _24 => _24[path]]), () => ( _optionalChain([skillFiles, 'optionalAccess', _25 => _25[`./${path}`]])));
925
+ const readSkillPath = (path) => _nullishCoalesce(_optionalChain([skillFiles, 'optionalAccess', _27 => _27[path]]), () => ( _optionalChain([skillFiles, 'optionalAccess', _28 => _28[`./${path}`]])));
915
926
  let initialized = false;
916
927
  let actor;
917
928
  let unsubscribe = null;
@@ -951,7 +962,7 @@ function createMcpServer(registry, options) {
951
962
  return null;
952
963
  case "notifications/cancelled": {
953
964
  const requestId = params.requestId;
954
- if (requestId !== void 0) _optionalChain([running, 'access', _26 => _26.get, 'call', _27 => _27(requestId), 'optionalAccess', _28 => _28.abort, 'call', _29 => _29(params.reason)]);
965
+ if (requestId !== void 0) _optionalChain([running, 'access', _29 => _29.get, 'call', _30 => _30(requestId), 'optionalAccess', _31 => _31.abort, 'call', _32 => _32(params.reason)]);
955
966
  return null;
956
967
  }
957
968
  case "ping":
@@ -1052,7 +1063,7 @@ function createMcpServer(registry, options) {
1052
1063
  }
1053
1064
  },
1054
1065
  close() {
1055
- _optionalChain([unsubscribe, 'optionalCall', _30 => _30()]);
1066
+ _optionalChain([unsubscribe, 'optionalCall', _33 => _33()]);
1056
1067
  unsubscribe = null;
1057
1068
  for (const controller of running.values()) controller.abort("Server closed.");
1058
1069
  running.clear();
@@ -1078,7 +1089,7 @@ function connectToolBridge(registry, options) {
1078
1089
  const setStatus = (next, detail) => {
1079
1090
  if (next === status && !detail) return;
1080
1091
  status = next;
1081
- _optionalChain([options, 'access', _31 => _31.onStatus, 'optionalCall', _32 => _32(next, detail)]);
1092
+ _optionalChain([options, 'access', _34 => _34.onStatus, 'optionalCall', _35 => _35(next, detail)]);
1082
1093
  };
1083
1094
  const send = (message) => {
1084
1095
  if (socket && socket.readyState === 1) socket.send(JSON.stringify(message));
@@ -1111,7 +1122,7 @@ function connectToolBridge(registry, options) {
1111
1122
  if (!controller.signal.aborted) send({ t: "result", id: message.id, result });
1112
1123
  });
1113
1124
  } else if (message.t === "cancel") {
1114
- _optionalChain([running, 'access', _33 => _33.get, 'call', _34 => _34(message.id), 'optionalAccess', _35 => _35.abort, 'call', _36 => _36(_nullishCoalesce(message.reason, () => ( "Cancelled by the agent.")))]);
1125
+ _optionalChain([running, 'access', _36 => _36.get, 'call', _37 => _37(message.id), 'optionalAccess', _38 => _38.abort, 'call', _39 => _39(_nullishCoalesce(message.reason, () => ( "Cancelled by the agent.")))]);
1115
1126
  running.delete(message.id);
1116
1127
  }
1117
1128
  });
@@ -1147,7 +1158,7 @@ function connectToolBridge(registry, options) {
1147
1158
  running.clear();
1148
1159
  const ws = socket;
1149
1160
  socket = null;
1150
- _optionalChain([ws, 'optionalAccess', _37 => _37.close, 'call', _38 => _38(1e3, "Editor closed.")]);
1161
+ _optionalChain([ws, 'optionalAccess', _40 => _40.close, 'call', _41 => _41(1e3, "Editor closed.")]);
1151
1162
  setStatus("closed");
1152
1163
  }
1153
1164
  };
@@ -89,7 +89,7 @@ import {
89
89
  textRectPath,
90
90
  translateMatrix,
91
91
  warpPresetMesh
92
- } from "./chunk-SET6KJOP.js";
92
+ } from "./chunk-LPIKXPBM.js";
93
93
  import {
94
94
  bezierPathBounds,
95
95
  outlineStroke,
@@ -8,7 +8,7 @@ import {
8
8
  isCartesianChart,
9
9
  normalizeChartSpec,
10
10
  parseChartColor
11
- } from "./chunk-3NEZJCBY.js";
11
+ } from "./chunk-2ZRN43IN.js";
12
12
 
13
13
  // src/chart/ooxml.ts
14
14
  var CHART_OOXML_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
@@ -475,6 +475,9 @@ function chartToOoxml(spec) {
475
475
  } else if (family === "sunburst") {
476
476
  issues.push(`Sunburst charts are written as doughnut charts of the ${spec.tree.length ? "top-level group totals" : "values"}: DrawingML has no sunburst type (Office 2016 stores it as chartex).`);
477
477
  type = "donut";
478
+ } else if (family === "sankey") {
479
+ issues.push("Sankey diagrams are written as bar charts of how much passes through each node: DrawingML has no flows.");
480
+ type = "bar";
478
481
  } else if (family === "parliament") {
479
482
  issues.push("Parliament charts are written as doughnut charts of the seats: DrawingML has no parliament type.");
480
483
  type = "donut";
@@ -1,3 +1,9 @@
1
+ import {
2
+ detectFamilyFromHeader,
3
+ splitSource,
4
+ splitStatements
5
+ } from "./chunk-O6OGNDND.js";
6
+
1
7
  // src/diagram/layout-registry.ts
2
8
  var familyLayouts = /* @__PURE__ */ new Map();
3
9
  function registerFamilyLayout(family, layout) {
@@ -20,165 +26,6 @@ function sharedFrameLayout(box) {
20
26
  };
21
27
  }
22
28
 
23
- // src/diagram/source/lines.ts
24
- var HEADER_PATTERNS = [
25
- [/^\s*(flowchart|graph)(?:-elk)?\b/i, "flowchart"],
26
- [/^\s*stateDiagram(?:-v2)?\b/i, "state"],
27
- [/^\s*classDiagram(?:-v2)?\b/i, "class"],
28
- [/^\s*erDiagram\b/i, "er"],
29
- [/^\s*requirementDiagram\b/i, "requirement"],
30
- [/^\s*mindmap\b/i, "mindmap"],
31
- [/^\s*sequenceDiagram\b/i, "sequence"],
32
- [/^\s*gantt\b/i, "gantt"],
33
- [/^\s*pie\b/i, "pie"],
34
- [/^\s*journey\b/i, "journey"],
35
- [/^\s*timeline\b/i, "timeline"],
36
- [/^\s*gitGraph\b/i, "gitGraph"],
37
- [/^\s*C4(Context|Container|Component|Dynamic|Deployment)\b/, "c4"],
38
- [/^\s*quadrantChart\b/i, "quadrant"],
39
- [/^\s*sankey(?:-beta)?\b/i, "sankey"],
40
- [/^\s*xychart(?:-beta)?\b/i, "xychart"],
41
- [/^\s*block(?:-beta)?\b/i, "block"],
42
- [/^\s*architecture(?:-beta)?\b/i, "architecture"],
43
- [/^\s*packet(?:-beta)?\b/i, "packet"],
44
- [/^\s*kanban\b/i, "kanban"],
45
- [/^\s*radar(?:-beta)?\b/i, "radar"],
46
- [/^\s*treemap(?:-beta)?\b/i, "treemap"],
47
- [/^\s*info\b/i, "info"]
48
- ];
49
- function detectFamilyFromHeader(header) {
50
- for (const [re, family] of HEADER_PATTERNS) {
51
- if (re.test(header)) return family;
52
- }
53
- return "unknown";
54
- }
55
- function isCommentLine(line) {
56
- const t = line.trim();
57
- return t.startsWith("%%") && !t.startsWith("%%{");
58
- }
59
- function isDirectiveLine(line) {
60
- return /^\s*%%\{.*\}%%\s*$/.test(line);
61
- }
62
- function splitSource(source) {
63
- const eol = source.includes("\r\n") ? "\r\n" : "\n";
64
- const rawLines = source.split(/\r\n|\n/);
65
- let end = rawLines.length;
66
- while (end > 0 && rawLines[end - 1].trim() === "") end--;
67
- const trailingLines = rawLines.slice(end);
68
- const trailing = trailingLines.length ? eol + trailingLines.join(eol) : "";
69
- const lines = rawLines.slice(0, end);
70
- const preambleLines = [];
71
- let i = 0;
72
- let frontmatter;
73
- if (lines[0] !== void 0 && /^---\s*$/.test(lines[0])) {
74
- preambleLines.push(lines[0]);
75
- i = 1;
76
- const fm = [];
77
- while (i < lines.length && !/^---\s*$/.test(lines[i])) {
78
- fm.push(lines[i]);
79
- preambleLines.push(lines[i]);
80
- i++;
81
- }
82
- if (i < lines.length) {
83
- preambleLines.push(lines[i]);
84
- i++;
85
- }
86
- frontmatter = parseSimpleYaml(fm);
87
- }
88
- while (i < lines.length) {
89
- const line = lines[i];
90
- if (line.trim() === "" || isDirectiveLine(line) || isCommentLine(line)) {
91
- preambleLines.push(line);
92
- i++;
93
- continue;
94
- }
95
- break;
96
- }
97
- const headerIndex = i;
98
- const header = lines[i] ?? "";
99
- const bodyLines = lines.slice(i + 1);
100
- return {
101
- eol,
102
- preamble: { lines: preambleLines, frontmatter },
103
- header,
104
- headerIndex,
105
- bodyLines,
106
- trailing
107
- };
108
- }
109
- function parseSimpleYaml(lines) {
110
- const out = {};
111
- let currentKey = null;
112
- let nested = null;
113
- for (const raw of lines) {
114
- if (raw.trim() === "" || raw.trim().startsWith("#")) continue;
115
- const indent = raw.length - raw.trimStart().length;
116
- const m = /^([A-Za-z_][\w-]*)\s*:\s*(.*)$/.exec(raw.trim());
117
- if (!m) continue;
118
- const [, key, valueRaw] = m;
119
- const value = parseYamlScalar(valueRaw);
120
- if (indent === 0) {
121
- currentKey = key;
122
- if (valueRaw.trim() === "") {
123
- nested = {};
124
- out[key] = nested;
125
- } else {
126
- nested = null;
127
- out[key] = value;
128
- }
129
- } else if (nested && currentKey) {
130
- nested[key] = value;
131
- }
132
- }
133
- return out;
134
- }
135
- function parseYamlScalar(v) {
136
- const t = v.trim();
137
- if (t === "") return "";
138
- if (t.startsWith("{") || t.startsWith("[")) {
139
- try {
140
- return JSON.parse(t);
141
- } catch {
142
- return t;
143
- }
144
- }
145
- if (/^(true|false)$/i.test(t)) return t.toLowerCase() === "true";
146
- if (/^-?\d+(\.\d+)?$/.test(t)) return Number(t);
147
- if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'")) {
148
- return t.slice(1, -1);
149
- }
150
- return t;
151
- }
152
- function splitStatements(line) {
153
- const parts = [];
154
- let depth = 0;
155
- let quote2 = null;
156
- let cur = "";
157
- for (let i = 0; i < line.length; i++) {
158
- const ch = line[i];
159
- if (quote2) {
160
- cur += ch;
161
- if (ch === quote2) quote2 = null;
162
- continue;
163
- }
164
- if (ch === '"' || ch === "`") {
165
- quote2 = ch;
166
- cur += ch;
167
- continue;
168
- }
169
- if (ch === "[" || ch === "(" || ch === "{") depth++;
170
- else if (ch === "]" || ch === ")" || ch === "}") depth = Math.max(0, depth - 1);
171
- if (ch === ";" && depth === 0) {
172
- parts.push(cur);
173
- cur = "";
174
- continue;
175
- }
176
- cur += ch;
177
- }
178
- parts.push(cur);
179
- return parts;
180
- }
181
-
182
29
  // src/diagram/source/metadata.ts
183
30
  var META_COMMENT_PREFIX = "%% @pixerate ";
184
31
  var META_FRONTMATTER_KEY = "pixerate";
@@ -10977,9 +10824,6 @@ export {
10977
10824
  XY_CHART_BOX,
10978
10825
  RADAR_CHART_BOX,
10979
10826
  sharedFrameLayout,
10980
- detectFamilyFromHeader,
10981
- splitSource,
10982
- splitStatements,
10983
10827
  META_COMMENT_PREFIX,
10984
10828
  META_FRONTMATTER_KEY,
10985
10829
  emptyMeta,
@@ -51,7 +51,7 @@ var _chunkEBDCRTZIcjs = require('./chunk-EBDCRTZI.cjs');
51
51
 
52
52
 
53
53
 
54
- var _chunkCIPIESX4cjs = require('./chunk-CIPIESX4.cjs');
54
+ var _chunk4ZC5QJE2cjs = require('./chunk-4ZC5QJE2.cjs');
55
55
 
56
56
 
57
57
 
@@ -192,7 +192,7 @@ var toGamma = (c) => {
192
192
  function intoSpace(space, [r, g, b]) {
193
193
  if (space === "linear") return [toLinear(r), toLinear(g), toLinear(b)];
194
194
  if (space === "oklab") {
195
- const c = _chunkCIPIESX4cjs.rgbToOklab.call(void 0, r, g, b);
195
+ const c = _chunk4ZC5QJE2cjs.rgbToOklab.call(void 0, r, g, b);
196
196
  return [c.l, c.a, c.b];
197
197
  }
198
198
  return [r, g, b];
@@ -200,7 +200,7 @@ function intoSpace(space, [r, g, b]) {
200
200
  function outOfSpace(space, [x, y, z]) {
201
201
  if (space === "linear") return [toGamma(x), toGamma(y), toGamma(z)];
202
202
  if (space === "oklab") {
203
- const c = _chunkCIPIESX4cjs.oklabToRgb.call(void 0, { l: x, a: y, b: z, alpha: 1 });
203
+ const c = _chunk4ZC5QJE2cjs.oklabToRgb.call(void 0, { l: x, a: y, b: z, alpha: 1 });
204
204
  return [c.r, c.g, c.b];
205
205
  }
206
206
  return [clamp(x, 0, 1), clamp(y, 0, 1), clamp(z, 0, 1)];