@symbo.ls/mermaid 3.14.712 → 3.14.714
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 +25 -0
- package/README.md +1 -1
- package/dist/esm/src/bundle.js +4 -4
- package/dist/esm/src/render.js +18 -18
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @symbo.ls/mermaid
|
|
2
2
|
|
|
3
|
+
## 3.14.714
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Server rendering is correct and fast, opt-in hydration, and Cloudflare deploys run the full build (FW-BRENDER-HYDRATION-AND-CF-DEPLOY-PROVIDER-1, FW-PUBLISH-TIME-PRERENDER-SSRCACHE-1).
|
|
8
|
+
|
|
9
|
+
Behaviour changes (check these first):
|
|
10
|
+
|
|
11
|
+
- `smbls build` copies `public/` into the output root (never replacing a file the bundler wrote), so `_redirects`, `_headers` and `404.html` ship with every bundler.
|
|
12
|
+
- Booting over a pre-rendered page removes only `style[data-emotion="smbls"]` and `style[data-brender]`; the host page's own `<style>` tags stay.
|
|
13
|
+
- The Cloudflare worker (`renderProjectHtml` without eval) keeps the client render instead of painting a wrong pre-render; a stored pre-render (`ssrCache` / `__ssr`) is still served. `ssrWithoutEval: true` opts back in.
|
|
14
|
+
|
|
15
|
+
Fixes:
|
|
16
|
+
|
|
17
|
+
- Every server render after the first one paints its theme colours again (linkedom made `deepClone` copy nothing nested).
|
|
18
|
+
- Server pages ship their own reset, keyframes and `:root` once, also in the Cloudflare worker (`generateGlobalCSS` read the wrong keys, wrote files and cached across projects).
|
|
19
|
+
- A pre-render waits for its own requests instead of a flat 2 s; server renders stop rescanning the head for every inserted rule.
|
|
20
|
+
- The server render gets the project's `globalScope` and context keys, as the client does; a `<select>` with a value no longer drops its parent.
|
|
21
|
+
|
|
22
|
+
New, opt-in:
|
|
23
|
+
|
|
24
|
+
- Hydration: `hydrate: true` (or `window.__BRENDER_HYDRATE__` from the server, with `__BR_REGISTRY__`) adopts the server DOM instead of replacing it; a mismatch falls back to a fresh node, a throw to the fresh render. brender `renderPage({ adoptDom })` ships the registry and the recorded GET answers; `@symbo.ls/fetch` exports `createEarlySeedScript`, `earlyKey`, `EARLY_KEY`.
|
|
25
|
+
- `smbls deploy --provider cloudflare [--target pages|workers] [--dry-run] [--no-brender]` runs the full `smbls build` pipeline; `--target workers` writes Workers Static Assets config.
|
|
26
|
+
- `smbls publish --ssr` (or `"prerender": true` in `symbols.json`) pre-renders every static route and stores it as `__ssr`, which the platform renderer serves; off by default.
|
|
27
|
+
|
|
3
28
|
## 3.14.707
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ Pure runtime-agnostic renderer. Returns `{ html, status, contentType }`.
|
|
|
53
53
|
| `analyzedScript` | string | analytics tracking `<script>` to inject |
|
|
54
54
|
| `indexHtml` | string | override the index.html template |
|
|
55
55
|
| `ssrCache` | object | pre-computed SSR cache (skips runtime brender) |
|
|
56
|
-
| `ProjectDataService` | object |
|
|
56
|
+
| `ProjectDataService` | object | ignored — shared libraries ship unmerged, the browser merges them |
|
|
57
57
|
|
|
58
58
|
### `loadJsonData(jsonPath)`
|
|
59
59
|
|
package/dist/esm/src/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import o from"./utils/logger.js";import*as
|
|
2
|
-
var context = Smbls.deepDestringifyFunctions(${
|
|
1
|
+
import o from"./utils/logger.js";import*as m from"smbls/iife-string";import{isWrappedLibrary as D}from"@symbo.ls/utils";const p=m.default,f=m.version||null;o.debug(`[BUNDLE] smbls IIFE loaded from smbls/iife-string (${p.length} bytes, v${f||"unknown"})`);const g=i=>i.replace(/</g,"\\u003c");function E(){return p}function _(){return f}function N(i,e,t,T={}){if(o.debug(`[BUNDLE] getBundleScript started for ${i}`),!e)return o.warn("[BUNDLE] No data provided, returning empty"),"";try{if(e.dependencies&&Array.isArray(e.sharedLibraries))for(const r of e.sharedLibraries){const s=D(r)?r.library:r,u=s&&s.key;if(u)for(const k of["@symbo-ls","@symbo.ls"]){const a=`${k}/${u}`;e.dependencies[a]&&(delete e.dependencies[a],o.debug(`[BUNDLE] Dropped CDN dependency ${a} \u2014 shipped as a shared library`))}}}catch(r){o.error(`[BUNDLE] Failed to strip shared-library dependencies: ${r.message}`)}const b=g(JSON.stringify(e,(r,s)=>r==="__ssr"?void 0:s)),y=t?.headers&&typeof t.headers.get=="function"&&t.headers.get("host")||t?.headers?.host||t?.host||t?.url&&(()=>{try{return new URL(t.url).host}catch{return""}})()||"",n=String(y).toLowerCase().split(":")[0],c=(()=>{if(t?.query)return t.query;try{return Object.fromEntries(new URL(t?.url||"","http://x").searchParams)}catch{return{}}})(),v=c.release||!1,S=c.version,l=n.endsWith(".symbo.ls")||n.endsWith(".preview.symbols.app")||n==="localhost"||n.endsWith(".localhost"),d=!!v||!!S||!l,w=e&&(e._id||e.projectId||e.id)||null,x=l?g(JSON.stringify({...e.settings,liveSync:!d,inspect:!0,verbose:!d,projectId:w})):"null",h=`
|
|
2
|
+
var context = Smbls.deepDestringifyFunctions(${b}, {}, { lazy: 'context', window: window });
|
|
3
3
|
// Must name the SAME provider render.js used for the page's importmap
|
|
4
4
|
// (default 'symbols' \u2192 pkg.symbo.ls). This drives prepareDependencies'
|
|
5
5
|
// runtime loads; if the two disagree, a package arrives twice from two
|
|
@@ -20,7 +20,7 @@ import o from"./utils/logger.js";import*as p from"smbls/iife-string";import{isWr
|
|
|
20
20
|
|
|
21
21
|
var app = context.app || {};
|
|
22
22
|
delete context.app;
|
|
23
|
-
var settings = ${
|
|
23
|
+
var settings = ${x};
|
|
24
24
|
if (settings) context.editor = settings;
|
|
25
25
|
|
|
26
26
|
// Theme initialization: set data-theme before app renders to avoid FOUC.
|
|
@@ -98,4 +98,4 @@ import o from"./utils/logger.js";import*as p from"smbls/iife-string";import{isWr
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
Smbls.create(app, context);
|
|
101
|
-
`;return o.debug(`[BUNDLE] Script generated (${h.length} bytes)`),h}export{
|
|
101
|
+
`;return o.debug(`[BUNDLE] Script generated (${h.length} bytes)`),h}export{N as getBundleScript,E as getSmblsIife,_ as getSmblsRuntimeVersion};
|
package/dist/esm/src/render.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import I from"./utils/logger.js";import Et from"./utils/vartranformer.js";import{getBundleScript as Tt,getSmblsIife as vt,getSmblsRuntimeVersion as _t}from"./bundle.js";import{deepDestringifyFunctions as It,isStringTag as W,markRevived as Ot}from"./utils/deepDestringify.js";import{transpile as K}from"./utils/funcql-transpile.js";import{normalizeRoute as Rt,resolvePageRoute as Nt}from"./route.js";import{generateMetaTags as Dt,getPageMetadata as xt,getImportMapScript as wt}from"@symbo.ls/utils";import{getTapStyles as Lt,getTapRuntimeSnippet as Pt}from"@symbo.ls/tap";import{resolveDeployIdentity as Bt,deployIdentityScript as At}from"./deployIdentity.js";const Mt=(t,o)=>{const e=parseInt(t,16);if(Number.isNaN(e))return t;const s=d=>d>255?255:d<0?0:d,n=s((e>>16)+o),i=s((e>>8&255)+o);return((s((e&255)+o)|i<<8|n<<16)+16777216).toString(16).slice(1)},q=(t,o)=>{if(typeof t!="string")return;if(o&&typeof o[t]=="string")return o[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=o&&o[e[1]],n=typeof s=="string"&&s.match(/^#?([0-9a-f]{6})$/i);if(n){let i=n[1];if(e[3]&&(i=Mt(i,parseInt(e[3],10))),e[2]){const f=parseFloat("0."+e[2]),d=parseInt(i,16);return`rgba(${d>>16&255},${d>>8&255},${d&255},${f})`}return"#"+i}}},jt=process.env.BRENDER!=="false";let D=null,G=null,Q=null,M=null;if(jt)try{const t=await import("@symbo.ls/brender");D=t.renderRoute,G=t.generateSitemap,Q=t.prefetchPageData,M=t.adoptionScripts||null}catch(t){I.debug(`[MERMAID] Brender not available: ${t.message}`)}const kt=()=>{try{return(0,eval)("1"),!0}catch{return!1}},Ct=`<!doctype html>
|
|
2
2
|
<html'\${{{ ROOT_ATTRS }}}'>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
'\${{{ HEAD_BOOT }}}'
|
|
6
6
|
'\${{{ META }}}'
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
|
-
<style id="smbls-tap-styles">${
|
|
9
|
-
<script>${
|
|
8
|
+
<style id="smbls-tap-styles">${Lt()}</style>
|
|
9
|
+
<script>${Pt()}<\/script>
|
|
10
10
|
'\${{{ IMPORTMAP }}}'
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
@@ -23,20 +23,20 @@ import E from"./utils/logger.js";import yt from"./utils/vartranformer.js";import
|
|
|
23
23
|
<\/script>
|
|
24
24
|
'\${{{ EDITOR }}}'
|
|
25
25
|
</body>
|
|
26
|
-
</html>`;function j(t,o=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 f=
|
|
27
|
-
`);g&&
|
|
28
|
-
`);const
|
|
29
|
-
`),r={metadata:a.metadata,prefetchedState:a.prefetchedState,activeLang:a.activeLang}}else if(
|
|
30
|
-
`);
|
|
31
|
-
`);const l=[];if(r.ssrTranslations){const
|
|
32
|
-
`),
|
|
33
|
-
`:`<!-- symbols | ${e} | ${i} | ${
|
|
34
|
-
`,
|
|
35
|
-
<meta name="color-scheme" content="light dark">`:"";let
|
|
36
|
-
`+
|
|
37
|
-
`+
|
|
38
|
-
`+
|
|
39
|
-
`+
|
|
26
|
+
</html>`;function j(t,o=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 f=K(s);o[e]=f?f.schema:null}else o[e]=s}else W(s)?o[e]=s.value:Array.isArray(s)?o[e]=s.map(n=>{if(typeof n=="string"){const i=n.trim();if(i.startsWith("(")&&i.includes("=>")||i.startsWith("function")||i.startsWith("async ")){const d=K(n);return d?d.schema:null}}return W(n)?n.value:n&&typeof n=="object"?j(n):n}):s&&typeof s=="object"&&!Array.isArray(s)?o[e]=j(s):o[e]=s}return Ot(o)}async function te(t,o={}){const{appkey:e,pathname:s="/",channel:n="production",userEnv:i=n,isProd:f=!1,req:d,query:Ft,userId:k,smblsIife:X,editorBundle:C,analyzedScript:Z="",indexHtml:tt,ssrCache:a,deployChannel:et,apiBaseUrl:st,evalAvailable:F,ssrWithoutEval:nt=process.env.BRENDER_WITHOUT_EVAL==="true",adoptDom:rt=!1}=o;if(!t)return{html:"",status:404,contentType:"text/html"};const J=typeof F=="boolean"?F:kt();if(typeof e=="string"&&e.includes("/")){const[p,y]=e.split("/");t.key||(t.key=y),t.owner||(t.owner=p)}const x=Rt(s),T=Nt(t.pages,s),O=i==="production"||i==="staging";let R="",w="",r=null,N=null,L="";if((a&&typeof a=="object"&&typeof a.html=="string"&&a.html?a:null)&&O){const p=t.__ssr&&typeof t.__ssr=="object"&&t.__ssr.__styles||{};R=(typeof p.sprite=="string"&&!/id="svgSprite"/.test(a.html)?p.sprite:"")+(a.html||"");const m=c=>a[c]!=null?a[c]:p[c],h=[];m("fontLinks")&&h.push(m("fontLinks"));const g=[m("globalCSS")||"",m("resetCss")||""].filter(Boolean).join(`
|
|
27
|
+
`);g&&h.push(`<style data-brender>${g}</style>`),m("css")&&h.push(`<style data-emotion="smbls">${m("css")}</style>`),w=h.join(`
|
|
28
|
+
`);const l=[];if(a.ssrTranslations){const u=(t.config||t.settings||{}).polyglot||t.polyglot,_=u?.storagePrefix||"",$=u?.storageLangKey||"",b=[];for(const S in a.ssrTranslations){const E=a.ssrTranslations[S];E&&typeof E=="object"&&b.push(`localStorage.setItem(${JSON.stringify(_+S)},${JSON.stringify(JSON.stringify(E))})`)}if($){const S=u?.defaultLang||"en";b.push(`if(!localStorage.getItem(${JSON.stringify($)}))localStorage.setItem(${JSON.stringify($)},${JSON.stringify(S)})`)}b.length&&l.push(`<script>try{${b.join(";")}}catch(e){}<\/script>`)}l.push("<script>window.__BRENDER__=true<\/script>"),L=l.join(`
|
|
29
|
+
`),r={metadata:a.metadata,prefetchedState:a.prefetchedState,activeLang:a.activeLang}}else if(D&&O&&!J&&!nt)I.debug("[MERMAID] Brender skipped: eval is unavailable in this runtime (client render)");else if(D&&O)try{const p=T?T.route:x;I.debug(`[MERMAID] Running brender for route: ${p}`);const y=J;if(N=y?It(t):j(t),r=await D(N,{route:p,pathname:x}),r){R=r.html||"";const m=[];r.fontLinks&&m.push(r.fontLinks);const h=r.globalCSS||{},g=[h.rootRule||"",r.resetCss||"",h.keyframeRules||""].filter(Boolean).join(`
|
|
30
|
+
`);g&&m.push(`<style data-brender>${g}</style>`),r.css&&m.push(`<style data-emotion="smbls">${r.css}</style>`),w=m.join(`
|
|
31
|
+
`);const l=[];if(r.ssrTranslations){const u=(N?.config||{}).polyglot||N?.polyglot,_=u?.storagePrefix||"",$=u?.storageLangKey||"",b=[];for(const S in r.ssrTranslations){const E=r.ssrTranslations[S];E&&typeof E=="object"&&b.push(`localStorage.setItem(${JSON.stringify(_+S)},${JSON.stringify(JSON.stringify(E))})`)}if($){const S=u?.defaultLang||"en";b.push(`if(!localStorage.getItem(${JSON.stringify($)}))localStorage.setItem(${JSON.stringify($)},${JSON.stringify(S)})`)}b.length&&l.push(`<script>try{${b.join(";")}}catch(e){}<\/script>`)}if(rt&&y&&M){const c=M(r);c&&l.push(c)}else y&&r.brRegistry&&Object.keys(r.brRegistry).length&&l.push(`<script>window.__BR_REGISTRY__=${JSON.stringify(r.brRegistry)}<\/script>`);l.push("<script>window.__BRENDER__=true<\/script>"),L=l.join(`
|
|
32
|
+
`),I.debug(`[MERMAID] Brender completed: body=${R.length}b, registry=${Object.keys(r.brRegistry||{}).length}`)}}catch(p){I.warn(`[MERMAID] Brender failed, falling back to client render: ${p.message}`)}const ot=Tt(e,t,d),H=_t(),it=wt(t,t?.settings?.cdnProvider||"symbols",{pin:H?{smbls:H}:void 0}),lt=t?.files&&t.files["index.html"],Y=tt||lt?.code||Ct,ct=Bt({deployChannel:et,channel:n,userEnv:i,apiBaseUrl:st}),z=At(ct),at=/\$\{\{\{\s*DEPLOY_IDENTITY\s*\}\}\}/.test(Y),pt=k?`<script>window.__SYMBOLS_AUTH__=${JSON.stringify({userId:k})}<\/script>`:"",P=r?.prefetchedState,ft=(t.config||t.settings||{}).polyglot||t.polyglot,dt=r?.activeLang||ft?.defaultLang||"en",mt=P&&Object.keys(P).length?{state:P,lang:dt,actualPathname:s}:{actualPathname:s},gt=r?.metadata&&Object.keys(r.metadata).length?r.metadata:xt(t,T?T.route:x,mt,{isProduction:f,channel:n}),ht=Dt(gt,f),B=X||vt();if(!B)return I.error("[MERMAID] smbls IIFE bundle not available"),{html:"Internal Server Error: smbls bundle not found",status:500,contentType:"text/plain"};const ut=C&&!f?`<script defer type="text/javascript">${C}<\/script>`:"",yt=f?`<!-- built with symbols.app -->
|
|
33
|
+
`:`<!-- symbols | ${e} | ${i} | ${O?"ssr":"csr"} | noindex -->
|
|
34
|
+
`,A=t.useDocumentTheme!==!1,v=t.globalTheme&&t.globalTheme!=="auto"?String(t.globalTheme):null,U=t.themeStorageKey?String(t.themeStorageKey):"",bt=A&&v?' data-theme="'+v+'"':"",St=A?"<script>(function(){try{var t=null;try{t=new URLSearchParams(location.search).get('globalTheme')}catch(e){}"+(U?"if(!t){try{t=localStorage.getItem("+JSON.stringify(U)+")}catch(e){}}":"")+"if(!t||t==='auto'){"+(v?"t="+JSON.stringify(v)+";":"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>
|
|
35
|
+
<meta name="color-scheme" content="light dark">`:"";let V="";if(A){const p=t.designSystem||t.config&&t.config.designSystem||{},y=p.color||{},m=p.theme&&p.theme.document||{},h=l=>{const c=m["@"+l];if(!c)return null;const u=q(c.background,y),_=q(c.color,y);return[u&&`background:${u}`,_&&`color:${_}`].filter(Boolean).join(";")||null},g=[];if(v){const l=h(v);l&&g.push(`html{${l}}`)}else{const l=h("dark"),c=h("light");l&&(g.push(`@media (prefers-color-scheme:dark){:root:not([data-theme]) html{${l}}}`),g.push(`[data-theme="dark"] html{${l}}`)),c&&(g.push(`@media (prefers-color-scheme:light){:root:not([data-theme]) html{${c}}}`),g.push(`[data-theme="light"] html{${c}}`))}g.length&&(V=`<style>${g.join("")}</style>`)}const $t=typeof t.__criticalCss=="string"&&t.__criticalCss.trim()?`<style>${t.__criticalCss}</style>`:"";return{html:Et(yt+Y,{ROOT_ATTRS:bt,HEAD_BOOT:St+($t||V),META:ht+`
|
|
36
|
+
`+w+`
|
|
37
|
+
`+L+`
|
|
38
|
+
`+pt,BUNDLE:ot,BODY:R,SMBLS_IIFE:at?B:z+`
|
|
39
|
+
`+B,DEPLOY_IDENTITY:z,NODE_ENV:"'production'",IMPORTMAP:it,EDITOR:ut+Z},{allowScript:!0}),status:T&&T.notFound?404:200,contentType:"text/html"}}function ee(t,o="production",e=null){const s=o!=="production"?` (${o})`:"",n=e==="not_public",i=n?"Site Not Yet Public":"Not Published",f=n?`This site isn't public yet${s}`:`This project hasn't been published yet${s}`;return`<!doctype html>
|
|
40
40
|
<html>
|
|
41
41
|
<head>
|
|
42
42
|
<meta charset="UTF-8">
|
|
@@ -62,4 +62,4 @@ import E from"./utils/logger.js";import yt from"./utils/vartranformer.js";import
|
|
|
62
62
|
<span class="env">${t}${s}</span>
|
|
63
63
|
</div>
|
|
64
64
|
</body>
|
|
65
|
-
</html>`}export{
|
|
65
|
+
</html>`}export{Ct as DEFAULT_TEMPLATE_HTML,G as generateSitemap,Q as prefetchPageData,ee as renderNotPublishedHtml,te as renderProjectHtml,j as transpileFunctionStrings};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/mermaid",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.714",
|
|
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.",
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@symbo.ls/channels": "^3.14.676",
|
|
65
65
|
"@symbo.ls/tap": "^3.14.612",
|
|
66
|
-
"@symbo.ls/utils": "^3.14.
|
|
66
|
+
"@symbo.ls/utils": "^3.14.783",
|
|
67
67
|
"cors": "^2.8.6",
|
|
68
68
|
"express": "^4.22.2"
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
|
-
"@symbo.ls/brender": "^3.14.
|
|
71
|
+
"@symbo.ls/brender": "^3.14.663"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|