@symbo.ls/mermaid 3.14.267 → 3.14.495

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @symbo.ls/mermaid
2
2
 
3
+ ## 3.14.495
4
+
5
+ ### Patch Changes
6
+
7
+ - Auto-generated cross-repo patch release.
8
+
9
+ ## 3.14.485
10
+
11
+ ### Patch Changes
12
+
13
+ - Auto-generated cross-repo patch release.
14
+ - Updated dependencies
15
+ - @symbo.ls/utils@3.14.485
16
+
3
17
  ## 3.14.267
4
18
 
5
19
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import b from"./utils/logger.js";import at from"./utils/vartranformer.js";import{getBundleScript as ct,getSmblsIife as lt}from"./bundle.js";import{deepDestringifyFunctions as pt}from"./utils/deepDestringify.js";import{transpile as J}from"./utils/funcql-transpile.js";import{normalizeRoute as gt,resolvePageRoute as ft}from"./route.js";import{generateMetaTags as mt,getPageMetadata as dt,getImportMapScript as ht}from"@symbo.ls/utils";const ut=process.env.BRENDER!=="false";let L=null,C=null,H=null;if(ut)try{const t=await import("@symbo.ls/brender");L=t.renderRoute,C=t.generateSitemap,H=t.prefetchPageData}catch(t){b.debug(`[MERMAID] Brender not available: ${t.message}`)}const yt=`<!doctype html>
1
+ import E from"./utils/logger.js";import ft from"./utils/vartranformer.js";import{getBundleScript as pt,getSmblsIife as gt}from"./bundle.js";import{deepDestringifyFunctions as ht}from"./utils/deepDestringify.js";import{transpile as J}from"./utils/funcql-transpile.js";import{normalizeRoute as mt,resolvePageRoute as dt}from"./route.js";import{generateMetaTags as ut,getPageMetadata as yt,getImportMapScript as bt}from"@symbo.ls/utils";const St=(t,r)=>{const e=parseInt(t,16);if(Number.isNaN(e))return t;const s=g=>g>255?255:g<0?0:g,n=s((e>>16)+r),i=s((e>>8&255)+r);return((s((e&255)+r)|i<<8|n<<16)+16777216).toString(16).slice(1)},H=(t,r)=>{if(typeof t!="string")return;if(r&&typeof r[t]=="string")return r[t];if(/^(#|rgb|hsl|var\(|[a-z]+$)/i.test(t))return t;const e=t.match(/^([a-z][a-z0-9]*)(?:\.(\d+))?([+-]\d+)?$/i);if(e&&(e[2]||e[3])){const s=r&&r[e[1]],n=typeof s=="string"&&s.match(/^#?([0-9a-f]{6})$/i);if(n){let i=n[1];if(e[3]&&(i=St(i,parseInt(e[3],10))),e[2]){const p=parseFloat("0."+e[2]),g=parseInt(i,16);return`rgba(${g>>16&255},${g>>8&255},${g&255},${p})`}return"#"+i}}},$t=process.env.BRENDER!=="false";let B=null,z=null,U=null;if($t)try{const t=await import("@symbo.ls/brender");B=t.renderRoute,z=t.generateSitemap,U=t.prefetchPageData}catch(t){E.debug(`[MERMAID] Brender not available: ${t.message}`)}const Et=`<!doctype html>
2
2
  <html'\${{{ ROOT_ATTRS }}}'>
3
3
  <head>
4
4
  <meta charset="UTF-8" />
@@ -20,25 +20,25 @@ import b from"./utils/logger.js";import at from"./utils/vartranformer.js";import
20
20
  <\/script>
21
21
  '\${{{ EDITOR }}}'
22
22
  </body>
23
- </html>`;function M(t,i=Array.isArray(t)?[]:{}){for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const n=t[o];if(typeof n=="string"){const s=n.trim();if(s.startsWith("(")&&s.includes("=>")||s.startsWith("function")||s.startsWith("async ")){const l=J(n);i[o]=l?l.schema:null}else i[o]=n}else Array.isArray(n)?i[o]=n.map(s=>{if(typeof s=="string"){const a=s.trim();if(a.startsWith("(")&&a.includes("=>")||a.startsWith("function")||a.startsWith("async ")){const y=J(s);return y?y.schema:null}}return s&&typeof s=="object"?M(s):s}):n&&typeof n=="object"&&!Array.isArray(n)?i[o]=M(n):i[o]=n}return i}async function xt(t,i={}){const{appkey:o,pathname:n="/",channel:s="production",userEnv:a=s,isProd:l=!1,req:y,query:bt,userId:B,smblsIife:U,editorBundle:A,analyzedScript:z="",indexHtml:K,ssrCache:r,ProjectDataService:W}=i;if(!t)return{html:"",status:404,contentType:"text/html"};if(typeof o=="string"&&o.includes("/")){const[c,p]=o.split("/");t.key||(t.key=p),t.owner||(t.owner=c)}const w=gt(n),S=ft(t.pages,n),N=a==="production"||a==="staging";let E="",I="",e=null,O=null,x="";if(r&&N){E=r.html||"";const c=[];r.fontLinks&&c.push(r.fontLinks);const p=[r.globalCSS||"",r.resetCss||""].filter(Boolean).join(`
24
- `);p&&c.push(`<style>${p}</style>`),r.css&&c.push(`<style data-emotion="smbls">${r.css}</style>`),I=c.join(`
25
- `);const g=[];if(r.ssrTranslations){const d=(t.config||t.settings||{}).polyglot||t.polyglot,h=d?.storagePrefix||"",T=d?.storageLangKey||"",f=[];for(const u in r.ssrTranslations){const m=r.ssrTranslations[u];m&&typeof m=="object"&&f.push(`localStorage.setItem(${JSON.stringify(h+u)},${JSON.stringify(JSON.stringify(m))})`)}if(T){const u=d?.defaultLang||"en";f.push(`if(!localStorage.getItem(${JSON.stringify(T)}))localStorage.setItem(${JSON.stringify(T)},${JSON.stringify(u)})`)}f.length&&g.push(`<script>try{${f.join(";")}}catch(e){}<\/script>`)}g.push("<script>window.__BRENDER__=true<\/script>"),x=g.join(`
26
- `),e={metadata:r.metadata,prefetchedState:r.prefetchedState,activeLang:r.activeLang}}else if(L&&N)try{const c=S?S.route:w;b.debug(`[MERMAID] Running brender for route: ${c}`);let p=!1;try{(0,eval)("1"),p=!0}catch{}if(O=p?pt(t):M(t),e=await L(O,{route:c,pathname:w}),e){E=e.html||"";const g=[];e.fontLinks&&g.push(e.fontLinks);const D=e.globalCSS||{},d=[D.rootRule||"",e.resetCss||"",D.keyframeRules||""].filter(Boolean).join(`
27
- `);d&&g.push(`<style>${d}</style>`),e.css&&g.push(`<style data-emotion="smbls">${e.css}</style>`),I=g.join(`
28
- `);const h=[];if(e.ssrTranslations){const f=(O?.config||{}).polyglot||O?.polyglot,u=f?.storagePrefix||"",m=f?.storageLangKey||"",v=[];for(const R in e.ssrTranslations){const P=e.ssrTranslations[R];P&&typeof P=="object"&&v.push(`localStorage.setItem(${JSON.stringify(u+R)},${JSON.stringify(JSON.stringify(P))})`)}if(m){const R=f?.defaultLang||"en";v.push(`if(!localStorage.getItem(${JSON.stringify(m)}))localStorage.setItem(${JSON.stringify(m)},${JSON.stringify(R)})`)}v.length&&h.push(`<script>try{${v.join(";")}}catch(e){}<\/script>`)}p&&e.brRegistry&&Object.keys(e.brRegistry).length&&h.push(`<script>window.__BR_REGISTRY__=${JSON.stringify(e.brRegistry)}<\/script>`),h.push("<script>window.__BRENDER__=true<\/script>"),x=h.join(`
29
- `),b.debug(`[MERMAID] Brender completed: body=${E.length}b, registry=${Object.keys(e.brRegistry||{}).length}`)}}catch(c){b.warn(`[MERMAID] Brender failed, falling back to client render: ${c.message}`)}const V=ct(o,t,y,{ProjectDataService:W}),Y=ht(t,t?.settings?.cdnProvider||"esmsh"),q=t?.files&&t.files["index.html"],G=K||q?.code||yt,Q=B?`<script>window.__SYMBOLS_AUTH__=${JSON.stringify({userId:B})}<\/script>`:"",_=e?.prefetchedState,X=(t.config||t.settings||{}).polyglot||t.polyglot,Z=e?.activeLang||X?.defaultLang||"en",tt=_&&Object.keys(_).length?{state:_,lang:Z,actualPathname:n}:{actualPathname:n},et=e?.metadata&&Object.keys(e.metadata).length?e.metadata:dt(t,S?S.route:w,tt,{isProduction:l,channel:s}),nt=mt(et,l),j=U||lt();if(!j)return b.error("[MERMAID] smbls IIFE bundle not available"),{html:"Internal Server Error: smbls bundle not found",status:500,contentType:"text/plain"};const st=A&&!l?`<script defer type="text/javascript">${A}<\/script>`:"",ot=l?`<!-- built with symbols.app -->
30
- `:`<!-- symbols | ${o} | ${a} | ${N?"ssr":"csr"} | noindex -->
31
- `,k=t.useDocumentTheme!==!1,$=t.globalTheme&&t.globalTheme!=="auto"?String(t.globalTheme):null,F=t.themeStorageKey?String(t.themeStorageKey):"",rt=k&&$?' data-theme="'+$+'"':"",it=k?"<script>(function(){try{var t=null;try{t=new URLSearchParams(location.search).get('globalTheme')}catch(e){}"+(F?"if(!t){try{t=localStorage.getItem("+JSON.stringify(F)+")}catch(e){}}":"")+"if(!t||t==='auto'){"+($?"t="+JSON.stringify($)+";":"try{t=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}catch(e){}")+`}if(t&&t!=='auto')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();<\/script>
32
- <meta name="color-scheme" content="light dark">`:"";return{html:at(ot+G,{ROOT_ATTRS:rt,HEAD_BOOT:it,META:nt+`
23
+ </html>`;function M(t,r=Array.isArray(t)?[]:{}){for(const e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;const s=t[e];if(typeof s=="string"){const n=s.trim();if(n.startsWith("(")&&n.includes("=>")||n.startsWith("function")||n.startsWith("async ")){const p=J(s);r[e]=p?p.schema:null}else r[e]=s}else Array.isArray(s)?r[e]=s.map(n=>{if(typeof n=="string"){const i=n.trim();if(i.startsWith("(")&&i.includes("=>")||i.startsWith("function")||i.startsWith("async ")){const g=J(n);return g?g.schema:null}}return n&&typeof n=="object"?M(n):n}):s&&typeof s=="object"&&!Array.isArray(s)?r[e]=M(s):r[e]=s}return r}async function Lt(t,r={}){const{appkey:e,pathname:s="/",channel:n="production",userEnv:i=n,isProd:p=!1,req:g,query:Tt,userId:j,smblsIife:K,editorBundle:A,analyzedScript:W="",indexHtml:V,ssrCache:a,ProjectDataService:Y}=r;if(!t)return{html:"",status:404,contentType:"text/html"};if(typeof e=="string"&&e.includes("/")){const[c,m]=e.split("/");t.key||(t.key=m),t.owner||(t.owner=c)}const N=mt(s),T=dt(t.pages,s),_=i==="production"||i==="staging";let O="",I="",o=null,v=null,w="";if(a&&_){O=a.html||"";const c=[];a.fontLinks&&c.push(a.fontLinks);const m=[a.globalCSS||"",a.resetCss||""].filter(Boolean).join(`
24
+ `);m&&c.push(`<style>${m}</style>`),a.css&&c.push(`<style data-emotion="smbls">${a.css}</style>`),I=c.join(`
25
+ `);const u=[];if(a.ssrTranslations){const f=(t.config||t.settings||{}).polyglot||t.polyglot,l=f?.storagePrefix||"",h=f?.storageLangKey||"",d=[];for(const y in a.ssrTranslations){const b=a.ssrTranslations[y];b&&typeof b=="object"&&d.push(`localStorage.setItem(${JSON.stringify(l+y)},${JSON.stringify(JSON.stringify(b))})`)}if(h){const y=f?.defaultLang||"en";d.push(`if(!localStorage.getItem(${JSON.stringify(h)}))localStorage.setItem(${JSON.stringify(h)},${JSON.stringify(y)})`)}d.length&&u.push(`<script>try{${d.join(";")}}catch(e){}<\/script>`)}u.push("<script>window.__BRENDER__=true<\/script>"),w=u.join(`
26
+ `),o={metadata:a.metadata,prefetchedState:a.prefetchedState,activeLang:a.activeLang}}else if(B&&_)try{const c=T?T.route:N;E.debug(`[MERMAID] Running brender for route: ${c}`);let m=!1;try{(0,eval)("1"),m=!0}catch{}if(v=m?ht(t):M(t),o=await B(v,{route:c,pathname:N}),o){O=o.html||"";const u=[];o.fontLinks&&u.push(o.fontLinks);const S=o.globalCSS||{},f=[S.rootRule||"",o.resetCss||"",S.keyframeRules||""].filter(Boolean).join(`
27
+ `);f&&u.push(`<style>${f}</style>`),o.css&&u.push(`<style data-emotion="smbls">${o.css}</style>`),I=u.join(`
28
+ `);const l=[];if(o.ssrTranslations){const d=(v?.config||{}).polyglot||v?.polyglot,y=d?.storagePrefix||"",b=d?.storageLangKey||"",R=[];for(const x in o.ssrTranslations){const L=o.ssrTranslations[x];L&&typeof L=="object"&&R.push(`localStorage.setItem(${JSON.stringify(y+x)},${JSON.stringify(JSON.stringify(L))})`)}if(b){const x=d?.defaultLang||"en";R.push(`if(!localStorage.getItem(${JSON.stringify(b)}))localStorage.setItem(${JSON.stringify(b)},${JSON.stringify(x)})`)}R.length&&l.push(`<script>try{${R.join(";")}}catch(e){}<\/script>`)}m&&o.brRegistry&&Object.keys(o.brRegistry).length&&l.push(`<script>window.__BR_REGISTRY__=${JSON.stringify(o.brRegistry)}<\/script>`),l.push("<script>window.__BRENDER__=true<\/script>"),w=l.join(`
29
+ `),E.debug(`[MERMAID] Brender completed: body=${O.length}b, registry=${Object.keys(o.brRegistry||{}).length}`)}}catch(c){E.warn(`[MERMAID] Brender failed, falling back to client render: ${c.message}`)}const q=pt(e,t,g,{ProjectDataService:Y}),G=bt(t,t?.settings?.cdnProvider||"esmsh"),Q=t?.files&&t.files["index.html"],X=V||Q?.code||Et,Z=j?`<script>window.__SYMBOLS_AUTH__=${JSON.stringify({userId:j})}<\/script>`:"",D=o?.prefetchedState,tt=(t.config||t.settings||{}).polyglot||t.polyglot,et=o?.activeLang||tt?.defaultLang||"en",st=D&&Object.keys(D).length?{state:D,lang:et,actualPathname:s}:{actualPathname:s},nt=o?.metadata&&Object.keys(o.metadata).length?o.metadata:yt(t,T?T.route:N,st,{isProduction:p,channel:n}),ot=ut(nt,p),k=K||gt();if(!k)return E.error("[MERMAID] smbls IIFE bundle not available"),{html:"Internal Server Error: smbls bundle not found",status:500,contentType:"text/plain"};const rt=A&&!p?`<script defer type="text/javascript">${A}<\/script>`:"",it=p?`<!-- built with symbols.app -->
30
+ `:`<!-- symbols | ${e} | ${i} | ${_?"ssr":"csr"} | noindex -->
31
+ `,P=t.useDocumentTheme!==!1,$=t.globalTheme&&t.globalTheme!=="auto"?String(t.globalTheme):null,F=t.themeStorageKey?String(t.themeStorageKey):"",ct=P&&$?' data-theme="'+$+'"':"",lt=P?"<script>(function(){try{var t=null;try{t=new URLSearchParams(location.search).get('globalTheme')}catch(e){}"+(F?"if(!t){try{t=localStorage.getItem("+JSON.stringify(F)+")}catch(e){}}":"")+"if(!t||t==='auto'){"+($?"t="+JSON.stringify($)+";":"try{t=window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}catch(e){}")+`}if(t&&t!=='auto')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();<\/script>
32
+ <meta name="color-scheme" content="light dark">`:"";let C="";if(P){const c=t.designSystem||t.config&&t.config.designSystem||{},m=c.color||{},u=c.theme&&c.theme.document||{},S=l=>{const h=u["@"+l];if(!h)return null;const d=H(h.background,m),y=H(h.color,m);return[d&&`background:${d}`,y&&`color:${y}`].filter(Boolean).join(";")||null},f=[];if($){const l=S($);l&&f.push(`html{${l}}`)}else{const l=S("dark"),h=S("light");l&&(f.push(`@media (prefers-color-scheme:dark){:root:not([data-theme]) html{${l}}}`),f.push(`[data-theme="dark"] html{${l}}`)),h&&(f.push(`@media (prefers-color-scheme:light){:root:not([data-theme]) html{${h}}}`),f.push(`[data-theme="light"] html{${h}}`))}f.length&&(C=`<style>${f.join("")}</style>`)}const at=typeof t.__criticalCss=="string"&&t.__criticalCss.trim()?`<style>${t.__criticalCss}</style>`:"";return{html:ft(it+X,{ROOT_ATTRS:ct,HEAD_BOOT:lt+(at||C),META:ot+`
33
33
  `+I+`
34
- `+x+`
35
- `+Q,BUNDLE:V,BODY:E,SMBLS_IIFE:j,NODE_ENV:"'production'",IMPORTMAP:Y,EDITOR:st+z},{allowScript:!0}),status:200,contentType:"text/html"}}function _t(t,i="production",o=null){const n=i!=="production"?` (${i})`:"",s=o==="not_public",a=s?"Site Not Yet Public":"Not Published",l=s?`This site isn't public yet${n}`:`This project hasn't been published yet${n}`;return`<!doctype html>
34
+ `+w+`
35
+ `+Z,BUNDLE:q,BODY:O,SMBLS_IIFE:k,NODE_ENV:"'production'",IMPORTMAP:G,EDITOR:rt+W},{allowScript:!0}),status:200,contentType:"text/html"}}function Bt(t,r="production",e=null){const s=r!=="production"?` (${r})`:"",n=e==="not_public",i=n?"Site Not Yet Public":"Not Published",p=n?`This site isn't public yet${s}`:`This project hasn't been published yet${s}`;return`<!doctype html>
36
36
  <html>
37
37
  <head>
38
38
  <meta charset="UTF-8">
39
39
  <meta name="viewport" content="width=device-width, initial-scale=1">
40
40
  <meta name="robots" content="noindex">
41
- <title>${a}</title>
41
+ <title>${i}</title>
42
42
  <style>
43
43
  * { margin: 0; padding: 0; box-sizing: border-box; }
44
44
  body { min-height: 100vh; display: flex; align-items: center; justify-content: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #0a0a0a; color: #fafafa; }
@@ -53,9 +53,9 @@ import b from"./utils/logger.js";import at from"./utils/vartranformer.js";import
53
53
  </head>
54
54
  <body>
55
55
  <div class="container">
56
- <h1>${l}</h1>
57
- <p>${s?"The owner has connected this domain but the project's visibility is set to private. Once they switch it to public in the workspace settings, the site will appear here automatically.":'Run <code>smbls publish</code> to deploy your project, or visit <a href="https://symbols.app">symbols.app</a> to get started.'}</p>
58
- <span class="env">${t}${n}</span>
56
+ <h1>${p}</h1>
57
+ <p>${n?"The owner has connected this domain but the project's visibility is set to private. Once they switch it to public in the workspace settings, the site will appear here automatically.":'Run <code>smbls publish</code> to deploy your project, or visit <a href="https://symbols.app">symbols.app</a> to get started.'}</p>
58
+ <span class="env">${t}${s}</span>
59
59
  </div>
60
60
  </body>
61
- </html>`}export{yt as DEFAULT_TEMPLATE_HTML,C as generateSitemap,H as prefetchPageData,_t as renderNotPublishedHtml,xt as renderProjectHtml,M as transpileFunctionStrings};
61
+ </html>`}export{Et as DEFAULT_TEMPLATE_HTML,z as generateSitemap,U as prefetchPageData,Bt as renderNotPublishedHtml,Lt as renderProjectHtml,M as transpileFunctionStrings};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/mermaid",
3
- "version": "3.14.267",
3
+ "version": "3.14.495",
4
4
  "type": "module",
5
5
  "license": "CC-BY-NC-4.0",
6
6
  "description": "Self-sustaining server runner for Symbols projects from JSON. Renders DOMQL projects to HTML with optional brender SSR.",
@@ -69,7 +69,7 @@
69
69
  "mermaid": "./dist/esm/bin/start.js"
70
70
  },
71
71
  "dependencies": {
72
- "@symbo.ls/utils": "^3.14.105",
72
+ "@symbo.ls/utils": "^3.14.485",
73
73
  "cors": "^2.8.6",
74
74
  "express": "^4.21.2"
75
75
  },