md2x 0.7.4 → 0.7.5

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 (135) hide show
  1. package/README.md +12 -6
  2. package/dist/chunks/chunk-54X5GPSM.js +1552 -0
  3. package/dist/chunks/chunk-US45GBOT.js +415 -0
  4. package/dist/chunks/docx-exporter-7C6T4DFB.js +1 -0
  5. package/dist/core-worker.js +1764 -0
  6. package/dist/index.js +1 -1
  7. package/dist/md2x.js +5 -5
  8. package/dist/renderer/core-worker-browser.js +1775 -0
  9. package/dist/renderer/live-runtime-canvas.js +1 -1
  10. package/dist/renderer/live-runtime-dot.js +1 -1
  11. package/dist/renderer/live-runtime-html.js +1 -1
  12. package/dist/renderer/live-runtime-infographic.js +1 -1
  13. package/dist/renderer/live-runtime-md2x.js +4 -4
  14. package/dist/renderer/live-runtime-mermaid.js +1 -1
  15. package/dist/renderer/live-runtime-svg.js +1 -1
  16. package/dist/renderer/live-runtime-vega.js +1 -1
  17. package/dist/types/node/src/host/browser-renderer.d.ts +1 -175
  18. package/dist/types/node/src/host/core.d.ts +59 -0
  19. package/dist/types/node/src/host/index.d.ts +4 -49
  20. package/dist/types/node/src/host/node-exporter.d.ts +1 -90
  21. package/dist/types/node/src/host/node-platform.d.ts +1 -23
  22. package/dist/types/node/src/host/templates-data.d.ts +5 -0
  23. package/dist/types/node/src/host/themes-data.d.ts +2385 -0
  24. package/dist/types/node/src/host/types.d.ts +251 -0
  25. package/dist/types/node/src/index.d.ts +2 -3
  26. package/package.json +10 -2
  27. package/dist/chunks/chunk-2LPNL4GA.js +0 -1
  28. package/dist/chunks/chunk-3P5X57NT.js +0 -262
  29. package/dist/chunks/chunk-3VL755NO.js +0 -1
  30. package/dist/chunks/chunk-5DPTQTJJ.js +0 -1
  31. package/dist/chunks/chunk-AK6TXLWO.js +0 -1
  32. package/dist/chunks/chunk-CN4F5HOV.js +0 -5
  33. package/dist/chunks/chunk-CVKZIRZW.js +0 -5
  34. package/dist/chunks/chunk-DFROP2PD.js +0 -11
  35. package/dist/chunks/chunk-DJGIYXVP.js +0 -3
  36. package/dist/chunks/chunk-EFKQH5UR.js +0 -108
  37. package/dist/chunks/chunk-FXZD57XY.js +0 -532
  38. package/dist/chunks/chunk-IENSDROB.js +0 -1
  39. package/dist/chunks/chunk-LLCWR7UA.js +0 -1
  40. package/dist/chunks/chunk-MHCTK6WW.js +0 -1
  41. package/dist/chunks/chunk-NM6J3ND7.js +0 -1
  42. package/dist/chunks/chunk-PARPCLXM.js +0 -1
  43. package/dist/chunks/chunk-PUOHPY5L.js +0 -16
  44. package/dist/chunks/chunk-R65AQGTF.js +0 -1
  45. package/dist/chunks/chunk-R6G2575A.js +0 -3
  46. package/dist/chunks/chunk-TRGQPVRY.js +0 -2
  47. package/dist/chunks/chunk-URO5RPHJ.js +0 -9
  48. package/dist/chunks/chunk-YFL3W3OS.js +0 -1
  49. package/dist/chunks/chunk-Z4LVGK7Y.js +0 -1
  50. package/dist/chunks/docx-exporter-ZZ76JXFU.js +0 -1
  51. package/dist/chunks/rehype-highlight-Y4Q4RX67.js +0 -1
  52. package/dist/chunks/rehype-katex-FXTCTSUE.js +0 -1
  53. package/dist/chunks/rehype-stringify-4CQSSRDL.js +0 -1
  54. package/dist/chunks/remark-gfm-BUZ4SLP3.js +0 -1
  55. package/dist/chunks/remark-math-HEZQAPFK.js +0 -1
  56. package/dist/chunks/remark-parse-QC7TSXTK.js +0 -1
  57. package/dist/chunks/remark-rehype-C2LX643P.js +0 -1
  58. package/dist/chunks/remark-super-sub-EP2AQS54.js +0 -1
  59. package/dist/chunks/theme-manager-AZBU2SLL.js +0 -1
  60. package/dist/chunks/theme-to-css-GLV3WYDU.js +0 -85
  61. package/dist/chunks/unified-PU53JLVJ.js +0 -1
  62. package/dist/chunks/unist-util-visit-SBSD62C6.js +0 -1
  63. package/dist/templates/html/example.html +0 -35
  64. package/dist/templates/svelte/example.svelte +0 -18
  65. package/dist/templates/vue/PrinterComponent.vue +0 -875
  66. package/dist/templates/vue/example.vue +0 -17
  67. package/dist/templates/vue/mapLibre.vue +0 -371
  68. package/dist/themes/code-themes/business-contrast.json +0 -31
  69. package/dist/themes/code-themes/colorful.json +0 -32
  70. package/dist/themes/code-themes/cool-modern.json +0 -31
  71. package/dist/themes/code-themes/high-contrast.json +0 -31
  72. package/dist/themes/code-themes/light-clean.json +0 -31
  73. package/dist/themes/code-themes/warm-book.json +0 -31
  74. package/dist/themes/color-schemes/candy.json +0 -34
  75. package/dist/themes/color-schemes/cool.json +0 -34
  76. package/dist/themes/color-schemes/coral.json +0 -34
  77. package/dist/themes/color-schemes/dino.json +0 -34
  78. package/dist/themes/color-schemes/forest.json +0 -34
  79. package/dist/themes/color-schemes/garden.json +0 -34
  80. package/dist/themes/color-schemes/neutral.json +0 -34
  81. package/dist/themes/color-schemes/ocean.json +0 -34
  82. package/dist/themes/color-schemes/rainbow.json +0 -43
  83. package/dist/themes/color-schemes/sakura.json +0 -34
  84. package/dist/themes/color-schemes/sepia.json +0 -34
  85. package/dist/themes/color-schemes/space.json +0 -34
  86. package/dist/themes/color-schemes/starry.json +0 -34
  87. package/dist/themes/color-schemes/sunset.json +0 -34
  88. package/dist/themes/color-schemes/warm.json +0 -34
  89. package/dist/themes/font-config.json +0 -184
  90. package/dist/themes/layout-schemes/academic.json +0 -40
  91. package/dist/themes/layout-schemes/book.json +0 -40
  92. package/dist/themes/layout-schemes/document.json +0 -40
  93. package/dist/themes/layout-schemes/magazine.json +0 -40
  94. package/dist/themes/layout-schemes/student.json +0 -40
  95. package/dist/themes/layout-schemes/technical.json +0 -40
  96. package/dist/themes/presets/academic.json +0 -24
  97. package/dist/themes/presets/business.json +0 -22
  98. package/dist/themes/presets/candy.json +0 -23
  99. package/dist/themes/presets/century.json +0 -22
  100. package/dist/themes/presets/coral.json +0 -22
  101. package/dist/themes/presets/default.json +0 -22
  102. package/dist/themes/presets/dinosaur.json +0 -23
  103. package/dist/themes/presets/elegant.json +0 -22
  104. package/dist/themes/presets/forest.json +0 -22
  105. package/dist/themes/presets/garamond.json +0 -22
  106. package/dist/themes/presets/garden.json +0 -23
  107. package/dist/themes/presets/handwritten.json +0 -23
  108. package/dist/themes/presets/heiti.json +0 -22
  109. package/dist/themes/presets/magazine.json +0 -24
  110. package/dist/themes/presets/manuscript.json +0 -22
  111. package/dist/themes/presets/minimal.json +0 -22
  112. package/dist/themes/presets/mixed.json +0 -24
  113. package/dist/themes/presets/newspaper.json +0 -24
  114. package/dist/themes/presets/ocean.json +0 -22
  115. package/dist/themes/presets/palatino.json +0 -22
  116. package/dist/themes/presets/rainbow.json +0 -23
  117. package/dist/themes/presets/space.json +0 -23
  118. package/dist/themes/presets/starry.json +0 -23
  119. package/dist/themes/presets/sunset.json +0 -22
  120. package/dist/themes/presets/swiss.json +0 -22
  121. package/dist/themes/presets/technical.json +0 -22
  122. package/dist/themes/presets/typewriter.json +0 -23
  123. package/dist/themes/presets/verdana.json +0 -22
  124. package/dist/themes/presets/water.json +0 -22
  125. package/dist/themes/registry.json +0 -270
  126. package/dist/themes/table-styles/academic.json +0 -30
  127. package/dist/themes/table-styles/borderless.json +0 -26
  128. package/dist/themes/table-styles/compact.json +0 -24
  129. package/dist/themes/table-styles/grid.json +0 -22
  130. package/dist/themes/table-styles/high-contrast.json +0 -22
  131. package/dist/themes/table-styles/minimal-gray.json +0 -26
  132. package/dist/themes/table-styles/modern-tech.json +0 -34
  133. package/dist/themes/table-styles/professional.json +0 -34
  134. package/dist/themes/table-styles/zebra.json +0 -22
  135. package/dist/types/src/utils/theme-to-css.d.ts +0 -171
@@ -1 +0,0 @@
1
- import{a}from"./chunk-5DPTQTJJ.js";import"./chunk-Z4LVGK7Y.js";import"./chunk-NM6J3ND7.js";export{a as default};
@@ -1 +0,0 @@
1
- import{b as a}from"./chunk-3VL755NO.js";import"./chunk-NM6J3ND7.js";export{a as default};
@@ -1,85 +0,0 @@
1
- import{a as u,b as f}from"./chunk-3VL755NO.js";import"./chunk-NM6J3ND7.js";function b(){return globalThis.platform}function $(s,r,o,t,e){let n=[];return n.push(k(s.fontScheme,r,o)),n.push(w(t,o)),n.push(B(s.fontScheme.code,e,r.code,o)),n.push(C(r,o)),n.join(`
2
-
3
- `)}function k(s,r,o){let t=[],e=f.buildFontFamily(s.body.fontFamily),n=f.ptToPx(r.body.fontSize),a=r.body.lineHeight;return t.push(`#markdown-content {
4
- font-family: ${e};
5
- font-size: ${n};
6
- line-height: ${a};
7
- color: ${o.text.primary};
8
- }`),t.push(`#markdown-content a {
9
- color: ${o.accent.link};
10
- }`),t.push(`#markdown-content a:hover {
11
- color: ${o.accent.linkHover};
12
- }`),t.push(`.katex {
13
- font-size: ${n};
14
- }`),["h1","h2","h3","h4","h5","h6"].forEach(c=>{let l=s.headings[c],i=r.headings[c],g=f.buildFontFamily(l?.fontFamily||s.headings.fontFamily||s.body.fontFamily),h=f.ptToPx(i.fontSize),p=l?.fontWeight||s.headings.fontWeight||"bold",y=o.headings?.[c]||o.text.primary,m=[` font-family: ${g};`,` font-size: ${h};`,` font-weight: ${p};`,` color: ${y};`];i.alignment&&i.alignment!=="left"&&m.push(` text-align: ${i.alignment};`),i.spacingBefore&&i.spacingBefore!=="0pt"&&m.push(` margin-top: ${f.ptToPx(i.spacingBefore)};`),i.spacingAfter&&i.spacingAfter!=="0pt"&&m.push(` margin-bottom: ${f.ptToPx(i.spacingAfter)};`),t.push(`#markdown-content ${c} {
15
- ${m.join(`
16
- `)}
17
- }`)}),t.join(`
18
-
19
- `)}function w(s,r){let o=[];o.push(`#markdown-content table {
20
- border-collapse: collapse;
21
- margin: 13px auto;
22
- overflow: auto;
23
- }`);let t=s.border||{},e=r.table.border,n=i=>i.endsWith("pt")?i.replace("pt","px"):i,a=i=>({single:"solid",double:"double",dashed:"dashed",dotted:"dotted",solid:"solid"})[i]||"solid",d=(i,g)=>{let h=n(i);if(g==="double"){let p=h.match(/^(\d+\.?\d*)(.*)$/);if(p){let y=parseFloat(p[1]),m=p[2];return`${y*3}${m}`}}return h};if(o.push(`#markdown-content table th,
24
- #markdown-content table td {
25
- padding: ${s.cell.padding};
26
- }`),t.all){let i=d(t.all.width,t.all.style),g=a(t.all.style),h=`${i} ${g} ${e}`;o.push(`#markdown-content table th,
27
- #markdown-content table td {
28
- border: ${h};
29
- }`)}else{if(o.push(`#markdown-content table th,
30
- #markdown-content table td {
31
- border: none;
32
- }`),t.headerTop){let i=d(t.headerTop.width,t.headerTop.style),g=a(t.headerTop.style);o.push(`#markdown-content table th {
33
- border-top: ${i} ${g} ${e};
34
- }`)}if(t.headerBottom){let i=d(t.headerBottom.width,t.headerBottom.style),g=a(t.headerBottom.style);o.push(`#markdown-content table th {
35
- border-bottom: ${i} ${g} ${e};
36
- }`)}if(t.rowBottom){let i=d(t.rowBottom.width,t.rowBottom.style),g=a(t.rowBottom.style);o.push(`#markdown-content table td {
37
- border-bottom: ${i} ${g} ${e};
38
- }`)}if(t.lastRowBottom){let i=d(t.lastRowBottom.width,t.lastRowBottom.style),g=a(t.lastRowBottom.style);o.push(`#markdown-content table tr:last-child td {
39
- border-bottom: ${i} ${g} ${e};
40
- }`)}}let c=s.header,l=[];if(l.push(` background-color: ${r.table.headerBackground};`),l.push(` color: ${r.table.headerText};`),c.fontWeight){let i=c.fontWeight==="bold"?"bold":c.fontWeight;l.push(` font-weight: ${i};`)}return c.fontSize&&l.push(` font-size: ${c.fontSize};`),l.length>0&&o.push(`#markdown-content table th {
41
- ${l.join(`
42
- `)}
43
- }`),s.zebra&&s.zebra.enabled&&(o.push(`#markdown-content table tr:nth-child(even) {
44
- background-color: ${r.table.zebraEven};
45
- }`),o.push(`#markdown-content table tr:nth-child(odd) {
46
- background-color: ${r.table.zebraOdd};
47
- }`)),o.join(`
48
-
49
- `)}function B(s,r,o,t){let e=[],n=f.buildFontFamily(s.fontFamily),a=f.ptToPx(o.fontSize),d=t.background.code;return e.push(`#markdown-content code {
50
- font-family: ${n};
51
- font-size: ${a};
52
- background-color: ${d};
53
- }`),e.push(`#markdown-content pre {
54
- background-color: ${d};
55
- }`),e.push(`#markdown-content pre code {
56
- font-family: ${n};
57
- font-size: ${a};
58
- background-color: transparent;
59
- }`),e.push(`#markdown-content .hljs {
60
- background: ${d} !important;
61
- color: ${r.foreground};
62
- }`),Object.keys(r.colors).forEach(c=>{let l=r.colors[c],i=l.startsWith("#")?l.slice(1):l;e.push(`#markdown-content .hljs-${c} {
63
- color: #${i};
64
- }`)}),e.join(`
65
-
66
- `)}function C(s,r){let o=[],t=s.blocks,e=n=>!n||n==="0pt"?"0":f.ptToPx(n);if(t.paragraph){let n=e(t.paragraph.spacingBefore),a=e(t.paragraph.spacingAfter);o.push(`#markdown-content p {
67
- margin: ${n} 0 ${a} 0;
68
- }`)}if(t.list){let n=e(t.list.spacingBefore),a=e(t.list.spacingAfter);o.push(`#markdown-content ul,
69
- #markdown-content ol {
70
- margin: ${n} 0 ${a} 0;
71
- }`)}if(t.listItem){let n=e(t.listItem.spacingBefore),a=e(t.listItem.spacingAfter);o.push(`#markdown-content li {
72
- margin: ${n} 0 ${a} 0;
73
- }`)}if(t.blockquote){let n=t.blockquote,a=e(n.spacingBefore),d=e(n.spacingAfter),c=e(n.paddingVertical),l=e(n.paddingHorizontal);o.push(`#markdown-content blockquote {
74
- margin: ${a} 0 ${d} 0;
75
- padding: ${c} ${l};
76
- border-left-color: ${r.blockquote.border};
77
- }`)}if(t.codeBlock){let n=e(t.codeBlock.spacingBefore),a=e(t.codeBlock.spacingAfter);o.push(`#markdown-content pre {
78
- margin: ${n} 0 ${a} 0;
79
- }`)}if(t.table){let n=e(t.table.spacingBefore),a=e(t.table.spacingAfter);o.push(`#markdown-content table {
80
- margin: ${n} auto ${a} auto;
81
- }`)}if(t.horizontalRule){let n=t.horizontalRule,a=e(n.spacingBefore),d=e(n.spacingAfter);o.push(`#markdown-content hr {
82
- margin: ${a} 0 ${d} 0;
83
- }`)}return o.join(`
84
-
85
- `)}function S(s){let r=document.getElementById("theme-dynamic-style");r&&r.remove();let o=document.createElement("style");o.id="theme-dynamic-style",o.textContent=s,document.head.appendChild(o)}async function F(s){try{let r=b(),o=await f.loadTheme(s),t=r.resource.getURL(`themes/layout-schemes/${o.layoutScheme}.json`),e=await u(t),n=r.resource.getURL(`themes/color-schemes/${o.colorScheme}.json`),a=await u(n),d=await u(r.resource.getURL(`themes/table-styles/${o.tableStyle}.json`)),c=await u(r.resource.getURL(`themes/code-themes/${o.codeTheme}.json`)),l=$(o,e,a,d,c);S(l);let i=f.buildFontFamily(o.fontScheme.body.fontFamily),g=parseFloat(e.body.fontSize),h=o.diagramStyle||"normal";r.renderer.setThemeConfig({fontFamily:i,fontSize:g,diagramStyle:h})}catch(r){throw console.error("[Theme] Error loading theme:",r),r}}async function L(s){try{return await f.switchTheme(s),await F(s),!0}catch(r){throw console.error("Error switching theme:",r),r}}export{S as applyThemeCSS,F as loadAndApplyTheme,L as switchTheme,$ as themeToCSS};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-2LPNL4GA.js";import"./chunk-MHCTK6WW.js";import"./chunk-AK6TXLWO.js";import"./chunk-NM6J3ND7.js";export{a as unified};
@@ -1 +0,0 @@
1
- import{b as a,c as b,d as c,f as d}from"./chunk-Z4LVGK7Y.js";import"./chunk-NM6J3ND7.js";export{a as CONTINUE,b as EXIT,c as SKIP,d as visit};
@@ -1,35 +0,0 @@
1
- <div class="md2x-html-example">
2
- <div class="my-component">Hello md2x! This is html template</div>
3
- <div class="items"></div>
4
-
5
- <script>
6
- (() => {
7
- const root = document.currentScript && document.currentScript.parentElement;
8
- if (!root) return;
9
-
10
- const data = templateData;
11
- const items = root.querySelector('.items');
12
- if (!items) return;
13
-
14
- // Render a simple list: [{ title, message }, ...]
15
- items.textContent = '';
16
- const arr = Array.isArray(data) ? data : (data != null ? [data] : []);
17
- for (let i = 0; i < arr.length; i++) {
18
- const item = arr[i] || {};
19
- const h2 = document.createElement('h2');
20
- h2.textContent = item.title != null ? String(item.title) : '';
21
- const p = document.createElement('p');
22
- p.textContent = item.message != null ? String(item.message) : '';
23
- items.appendChild(h2);
24
- items.appendChild(p);
25
- }
26
- })();
27
- </script>
28
-
29
- <style>
30
- .md2x-html-example .my-component {
31
- color: red;
32
- }
33
- </style>
34
- </div>
35
-
@@ -1,18 +0,0 @@
1
- <script>
2
- const data = templateData;
3
- </script>
4
-
5
- <div class="my-component">Hello md2x! This is svelte template</div>
6
- {#each data as item, index}
7
- <div>
8
- <h2>{item.title}</h2>
9
- <p>{item.message}</p>
10
- </div>
11
- {/each}
12
-
13
- <style>
14
- .my-component {
15
- color: red;
16
- }
17
- </style>
18
-