@tdacorp/hyle-sdk 0.3.0 → 0.8.1

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 (38) hide show
  1. package/README.md +135 -5
  2. package/bin/hyle-sdk-check-routes.mjs +3 -0
  3. package/dist/check-routes-bin.js +537 -0
  4. package/dist/chunk-67IOIAVW.js +35 -0
  5. package/dist/chunk-BUJFMR3M.js +38 -0
  6. package/dist/chunk-EBNIKRQH.js +536 -0
  7. package/dist/{chunk-EARQBSMF.js → chunk-LGW2KP4X.js} +109 -5
  8. package/dist/{chunk-7VCMJUPC.js → chunk-N4QYPO7S.js} +1 -1
  9. package/dist/diagram-viewer-DYX6R63Y.js +1132 -0
  10. package/dist/index.cjs +279 -23
  11. package/dist/index.d.cts +147 -3
  12. package/dist/index.d.ts +147 -3
  13. package/dist/index.js +18 -1
  14. package/dist/mermaid-diagram.cjs +1267 -16
  15. package/dist/mermaid-diagram.d.cts +39 -1
  16. package/dist/mermaid-diagram.d.ts +39 -1
  17. package/dist/mermaid-diagram.js +35 -5
  18. package/dist/next.cjs +385 -30
  19. package/dist/next.d.cts +93 -5
  20. package/dist/next.d.ts +93 -5
  21. package/dist/next.js +210 -5
  22. package/dist/react.cjs +118 -5
  23. package/dist/react.d.cts +44 -4
  24. package/dist/react.d.ts +44 -4
  25. package/dist/react.js +2 -1
  26. package/dist/{resolve-fMx2W8RR.d.ts → resolve-1rQntRBh.d.ts} +1 -1
  27. package/dist/{resolve-B_p0p4Zn.d.cts → resolve-36-Ng1H0.d.cts} +1 -1
  28. package/dist/styles.css +76 -0
  29. package/dist/{types-CBvLhUPr.d.ts → types-BoyBWF2F.d.ts} +1 -1
  30. package/dist/{types-DjXf6iPo.d.cts → types-CwBCPh6K.d.cts} +20 -1
  31. package/dist/{types-DjXf6iPo.d.ts → types-CwBCPh6K.d.ts} +20 -1
  32. package/dist/{types-D0qoLh4E.d.cts → types-DnPzhrFx.d.cts} +1 -1
  33. package/dist/use-cache.cjs +55 -23
  34. package/dist/use-cache.d.cts +2 -2
  35. package/dist/use-cache.d.ts +2 -2
  36. package/dist/use-cache.js +3 -2
  37. package/package.json +5 -1
  38. package/dist/chunk-HFUJRNFP.js +0 -290
@@ -1,3 +1,8 @@
1
+ import {
2
+ hostAssetHtml,
3
+ hostAssetSrc
4
+ } from "./chunk-67IOIAVW.js";
5
+
1
6
  // src/react/content.tsx
2
7
  import { toJsxRuntime } from "hast-util-to-jsx-runtime";
3
8
  import { Children, Fragment as Fragment2, isValidElement } from "react";
@@ -194,6 +199,7 @@ function clean(node, depth, ctx2, budget) {
194
199
  if (Object.hasOwn(rules, key) && rules[key](value, inner)) properties[key] = value;
195
200
  }
196
201
  }
202
+ if ((tag === "img" || tag === "video" || tag === "audio") && typeof properties.src === "string") properties.src = hostAssetSrc(properties.src);
197
203
  if (tag === "iframe") {
198
204
  if (properties.sandbox === void 0 || properties.srcdoc === void 0) return [];
199
205
  properties.sandbox = "allow-scripts";
@@ -219,6 +225,101 @@ function sanitizeHast(tree, title) {
219
225
  return { type: "root", children: raw.filter((n) => n !== skip).flatMap((n) => clean(n, 0, { katex: false }, budget)) };
220
226
  }
221
227
 
228
+ // src/react/viewer/labels.ts
229
+ var VIEWER_LABELS_EN = {
230
+ expand: "Expand diagram",
231
+ expandHint: "Expand",
232
+ viewer: "Diagram viewer",
233
+ close: "Close",
234
+ zoomIn: "Zoom in",
235
+ zoomOut: "Zoom out",
236
+ fit: "Fit to window",
237
+ actual: "Actual size",
238
+ search: "Find in diagram",
239
+ searchPlaceholder: "Find",
240
+ noMatch: "No match",
241
+ matchOf: "{n} of {total}",
242
+ copySource: "Copy diagram source",
243
+ downloadSvg: "Download SVG",
244
+ downloadPng: "Download PNG",
245
+ copyImage: "Copy as image",
246
+ pngScale: "PNG scale",
247
+ fullscreen: "Fullscreen",
248
+ exitFullscreen: "Exit fullscreen",
249
+ copied: "Copied",
250
+ saved: "Saved",
251
+ unavailable: "Not available here",
252
+ hint: "Scroll to zoom, drag to pan, click a node to trace its paths, press / to search",
253
+ legendSelected: "Selected",
254
+ legendUpstream: "Upstream",
255
+ legendDownstream: "Downstream",
256
+ outgoing: "outgoing",
257
+ tracing: "{label}: {up} upstream, {down} downstream",
258
+ map: "Overview map"
259
+ };
260
+ var VIEWER_LABELS_FR = {
261
+ expand: "Agrandir le sch\xE9ma",
262
+ expandHint: "Agrandir",
263
+ viewer: "Visionneuse de sch\xE9ma",
264
+ close: "Fermer",
265
+ zoomIn: "Zoom avant",
266
+ zoomOut: "Zoom arri\xE8re",
267
+ fit: "Ajuster \xE0 la fen\xEAtre",
268
+ actual: "Taille r\xE9elle",
269
+ search: "Rechercher dans le sch\xE9ma",
270
+ searchPlaceholder: "Rechercher",
271
+ noMatch: "Aucun r\xE9sultat",
272
+ matchOf: "{n} sur {total}",
273
+ copySource: "Copier la source du sch\xE9ma",
274
+ downloadSvg: "T\xE9l\xE9charger le SVG",
275
+ downloadPng: "T\xE9l\xE9charger le PNG",
276
+ copyImage: "Copier comme image",
277
+ pngScale: "\xC9chelle du PNG",
278
+ fullscreen: "Plein \xE9cran",
279
+ exitFullscreen: "Quitter le plein \xE9cran",
280
+ copied: "Copi\xE9",
281
+ saved: "Enregistr\xE9",
282
+ unavailable: "Indisponible ici",
283
+ hint: "Molette pour zoomer, glisser pour d\xE9placer, cliquer un n\u0153ud pour suivre ses chemins, / pour chercher",
284
+ legendSelected: "S\xE9lection",
285
+ legendUpstream: "En amont",
286
+ legendDownstream: "En aval",
287
+ outgoing: "sortants",
288
+ tracing: "{label} : {up} en amont, {down} en aval",
289
+ map: "Carte d'ensemble"
290
+ };
291
+ var VIEWER_LABELS_ES = {
292
+ expand: "Ampliar el diagrama",
293
+ expandHint: "Ampliar",
294
+ viewer: "Visor de diagramas",
295
+ close: "Cerrar",
296
+ zoomIn: "Acercar",
297
+ zoomOut: "Alejar",
298
+ fit: "Ajustar a la ventana",
299
+ actual: "Tama\xF1o real",
300
+ search: "Buscar en el diagrama",
301
+ searchPlaceholder: "Buscar",
302
+ noMatch: "Sin resultados",
303
+ matchOf: "{n} de {total}",
304
+ copySource: "Copiar el c\xF3digo del diagrama",
305
+ downloadSvg: "Descargar SVG",
306
+ downloadPng: "Descargar PNG",
307
+ copyImage: "Copiar como imagen",
308
+ pngScale: "Escala del PNG",
309
+ fullscreen: "Pantalla completa",
310
+ exitFullscreen: "Salir de pantalla completa",
311
+ copied: "Copiado",
312
+ saved: "Guardado",
313
+ unavailable: "No disponible aqu\xED",
314
+ hint: "Rueda para acercar, arrastra para mover, pulsa un nodo para seguir sus caminos, / para buscar",
315
+ legendSelected: "Seleccionado",
316
+ legendUpstream: "Aguas arriba",
317
+ legendDownstream: "Aguas abajo",
318
+ outgoing: "salientes",
319
+ tracing: "{label}: {up} aguas arriba, {down} aguas abajo",
320
+ map: "Mapa general"
321
+ };
322
+
222
323
  // src/react/strings.ts
223
324
  var en = {
224
325
  toc: "On this page",
@@ -258,7 +359,8 @@ var en = {
258
359
  rdFallback: "If nothing happens, go to the new address.",
259
360
  unKind: "Unavailable",
260
361
  unTitle: "This page is temporarily unavailable",
261
- unBody: "The content could not be loaded. Please try again in a moment."
362
+ unBody: "The content could not be loaded. Please try again in a moment.",
363
+ viewer: VIEWER_LABELS_EN
262
364
  };
263
365
  var fr = {
264
366
  toc: "Sur cette page",
@@ -298,7 +400,8 @@ var fr = {
298
400
  rdFallback: "Si rien ne se passe, allez \xE0 la nouvelle adresse.",
299
401
  unKind: "Indisponible",
300
402
  unTitle: "Cette page est momentan\xE9ment indisponible",
301
- unBody: "Le contenu n'a pas pu \xEAtre charg\xE9. R\xE9essayez dans un instant."
403
+ unBody: "Le contenu n'a pas pu \xEAtre charg\xE9. R\xE9essayez dans un instant.",
404
+ viewer: VIEWER_LABELS_FR
302
405
  };
303
406
  var es = {
304
407
  toc: "En esta p\xE1gina",
@@ -338,7 +441,8 @@ var es = {
338
441
  rdFallback: "Si no pasa nada, ve a la nueva direcci\xF3n.",
339
442
  unKind: "No disponible",
340
443
  unTitle: "Esta p\xE1gina no est\xE1 disponible por el momento",
341
- unBody: "No se pudo cargar el contenido. Int\xE9ntalo de nuevo en un momento."
444
+ unBody: "No se pudo cargar el contenido. Int\xE9ntalo de nuevo en un momento.",
445
+ viewer: VIEWER_LABELS_ES
342
446
  };
343
447
  var TABLE = { en, fr, es };
344
448
  function stringsFor(locale) {
@@ -406,7 +510,7 @@ function buildComponents(c, s) {
406
510
  if (typeof srcDoc !== "string") return null;
407
511
  const source = mermaidSource(srcDoc);
408
512
  if (c.Mermaid) return /* @__PURE__ */ jsx3(c.Mermaid, { srcDoc, source, title: s.diagram });
409
- if (source !== void 0) return /* @__PURE__ */ jsx3(MermaidDiagram, { source, title: s.diagram, errorText: s.diagramError });
513
+ if (source !== void 0) return /* @__PURE__ */ jsx3(MermaidDiagram, { source, title: s.diagram, errorText: s.diagramError, labels: s.viewer });
410
514
  return /* @__PURE__ */ jsx3("figure", { className: "hyle-mermaid", "data-slot-component": "Mermaid", children: /* @__PURE__ */ jsx3("iframe", { srcDoc, sandbox: String(sandbox), title: s.diagram, loading: "lazy", referrerPolicy: "no-referrer", ...{ csp: MERMAID_FRAME_CSP } }) });
411
515
  };
412
516
  const Heading = (level) => function HyleHeading({ id, children, ...rest }) {
@@ -443,7 +547,7 @@ function HastContent({ tree, title, components = {}, locale }) {
443
547
  });
444
548
  }
445
549
  function TrustedServerHtml({ html }) {
446
- return /* @__PURE__ */ jsx3("div", { dangerouslySetInnerHTML: { __html: html } });
550
+ return /* @__PURE__ */ jsx3("div", { dangerouslySetInnerHTML: { __html: hostAssetHtml(html) } });
447
551
  }
448
552
 
449
553
  // src/react/index.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createHyleClient,
3
3
  isValidCacheTag
4
- } from "./chunk-HFUJRNFP.js";
4
+ } from "./chunk-EBNIKRQH.js";
5
5
 
6
6
  // src/next/resolve.ts
7
7
  var DEFAULT_REVALIDATE = 300;