@symbo.ls/brender 3.14.657 → 3.14.658
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 +12 -0
- package/dist/esm/render.js +1 -1
- package/package.json +2 -2
- package/render.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @symbo.ls/brender
|
|
2
2
|
|
|
3
|
+
## 3.14.658
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Seed the raw design system at BOOT rather than only in the socket's `onSnapshot`, so every livesync/HMR push re-paints correctly without a manual reload (RUNTIME-LIVESYNC-STYLE-LOSS-1).
|
|
8
|
+
|
|
9
|
+
`onOps` re-inits the design system from `ctx.__rawDesignSystem`. That copy was seeded only in `onSnapshot`, so transports that echo a boot snapshot were covered while the dev-server runner — which emits ops and never a snapshot — was not. `buildReinitDesignSystem` then returned null and `onOps` fell back to `init(ctx.designSystem)`, re-feeding scratch's PROCESSED config through the token transformers: alpha was stripped (`--color-transparent` rgba(0,0,0,0) → rgba(0,0,0,1)) and new tokens never reached the sheet.
|
|
10
|
+
|
|
11
|
+
`seedRawDesignSystem` is now called in `createDomql.js` immediately before `prepareDesignSystem` — shared libraries merged, scratch processing not yet run — and re-exported from `@symbo.ls/sync`. brender's sync stub gains the same export.
|
|
12
|
+
|
|
13
|
+
`@symbo.ls/utils` is republished because its shipped dist was missing `isPolyglotWritableKey`, which exists at `packages/utils/state.js:261` and is imported by `@symbo.ls/element` and `smbls/src/prepare.js`. The published 3.14.769 tarball lacks it, so any consumer importing that symbol from the package root fails at import time.
|
|
14
|
+
|
|
3
15
|
## 3.14.656
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/esm/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{resolve as d,join as tt,dirname as q}from"path";import{existsSync as b,unlinkSync as _t,readFileSync as K,realpathSync as kt}from"fs";import{resolvePackageEntry as $t}from"./packageEntry.js";import{tmpdir as Ct}from"os";import{randomBytes as Tt}from"crypto";import{createRequire as et}from"module";import{createEnv as nt}from"./env.js";import{resetKeys as st,assignKeys as rt,mapKeysToElements as it}from"./keys.js";import{extractMetadata as ct,generateHeadHtml as Ot}from"./metadata.js";import"./hydrate.js";import{prefetchPageData as Lt,injectPrefetchedState as At,fetchSSRTranslations as Pt}from"./prefetch.js";let z=null;const It=async()=>{if(z)return z;try{return z=(await import("@symbo.ls/funcql")).funcqlPlugin,z}catch{return null}};import"linkedom";import{reset as qt}from"@symbo.ls/css";const ot=(t,e)=>{if(!t||!e)return;if(t[e]!==void 0)return t[e];const o=e.split(".");let s=t;for(const r of o){if(s==null||typeof s!="object")return;s=s[r]}return s},vt=function(t,e){if(!t)return"";const o=this?.context,s=o?.polyglot,r=e||s?.defaultLang||"en";if(s?.translations){const c=s.translations[r];if(c){const i=ot(c,t);if(i!==void 0)return i}}const p=this?.state?.root||o?.state?.root;if(p?.translations){const c=p.translations[r];if(c){const i=ot(c,t);if(i!==void 0)return i}}const f=s?.defaultLang||"en";if(f!==r&&s?.translations){const c=s.translations[f];if(c){const i=ot(c,t);if(i!==void 0)return i}}return t},lt=function(){const t=this?.context;return this?.state?.root?.lang||t?.polyglot?.defaultLang||"en"},D=(t,e=new WeakMap)=>{if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(Array.isArray(t)){const s=[];e.set(t,s);for(const r of t)s.push(typeof r=="object"&&r!==null?D(r,e):r);return s}const o={};e.set(t,o);for(const s of Object.keys(t)){const r=t[s];o[s]=typeof r=="object"&&r!==null?D(r,e):r}return o},at=()=>{const t=new WeakSet;return(e,o)=>{if(typeof o!="function"){if(typeof o=="object"&&o!==null){if(t.has(o))return;t.add(o)}return o}}};let N=null;try{import.meta.url&&(N=et(import.meta.url))}catch{}const ft=()=>{if(!import.meta.url||!N)return{isMonorepo:!1,monorepoRoot:null,resolvePackage:i=>i};const t=kt(new URL(".",import.meta.url).pathname),e=d(t,"../..");if(b(d(e,"packages","smbls","src","createDomql.js")))return{isMonorepo:!0,monorepoRoot:e};let s;try{const i=N.resolve("smbls/package.json");s=q(i)}catch{let i=t;for(;i!==q(i);){const n=d(i,"node_modules","smbls");if(b(d(n,"package.json"))){s=n;break}i=q(i)}}let r=N;if(s)try{r=et(d(s,"package.json"))}catch{}let p,f=process.cwd();for(;f!==q(f);){if(b(d(f,"package.json"))){p=f;break}f=q(f)}let c=r;if(p)try{c=et(d(p,"package.json"))}catch{}return{isMonorepo:!1,smblsRoot:s,brenderDir:t,projectRoot:p,_smblsRequire:r,_projectRequire:c}},G=(t,e)=>{const o=t.isMonorepo?[N]:[t._smblsRequire,t._projectRequire,N].filter(Boolean);for(const s of o)try{return s.resolve(e)}catch{}return null},fe=(t,e,...o)=>{if(t.isMonorepo)return d(t.monorepoRoot,"packages",e,...o);const s=G(t,`${e}/package.json`);return s?d(q(s),...o):null},ue=(t,e,...o)=>{if(t.isMonorepo)return d(t.monorepoRoot,"plugins",e,...o);const s=G(t,`@symbo.ls/${e}/package.json`);return s?d(q(s),...o):null},H=(t,e,...o)=>{if(t.isMonorepo){for(const r of["packages","plugins"]){const p=d(t.monorepoRoot,r,e,...o);if(b(p))return p}return null}const s=G(t,`@symbo.ls/${e}/package.json`);return s?d(q(s),...o):null},Y=(t,e,...o)=>{if(t.isMonorepo)return d(t.monorepoRoot,"packages","domql","packages",e,...o);const s=G(t,`@symbo.ls/${e}/package.json`);return s?d(q(s),...o):null};let Z=null;const Et=async()=>{if(Z)return Z;const t=ft();if(!N)try{const c=await import("./dist/createDomql.bundled.mjs");return Z=c,c}catch(c){throw new Error(`brender: pre-bundled createDomql not available in bundled runtime: ${c.message}`)}let e;if(t.isMonorepo)e=d(t.monorepoRoot,"packages","smbls","src","createDomql.js");else if(t.smblsRoot){const c=d(t.smblsRoot,"src","createDomql.js"),i=d(t.smblsRoot,"dist","esm","src","createDomql.js");e=b(c)?c:i}if(!e||!b(e))throw new Error(`brender: cannot find createDomql.js (isMonorepo=${t.isMonorepo}, entry=${e})`);const o=await import("esbuild"),s=tt(Ct(),`br_createDomql_${Tt(6).toString("hex")}.mjs`),r=$t,p={name:"workspace-resolve",setup(c){c.onResolve({filter:/^smbls/},i=>{const n=i.path.replace(/^smbls\/?/,""),l=t.isMonorepo?d(t.monorepoRoot,"packages","smbls"):t.smblsRoot;if(!l)return;if(!n){const m=r(l);return m?{path:m}:void 0}const u=d(l,n);if(b(u))return{path:u};if(b(u+".js"))return{path:u+".js"};const a=d(u,"index.js");if(b(a))return{path:a}}),c.onResolve({filter:/^domql$/},i=>{if(t.isMonorepo){const n=d(t.monorepoRoot,"packages","domql","src","index.js");if(b(n))return{path:n};const l=d(t.monorepoRoot,"packages","domql","index.js");if(b(l))return{path:l}}else try{const n=_require.resolve("domql/package.json"),l=r(q(n));if(l)return{path:l}}catch{}}),c.onResolve({filter:/^@symbo\.ls\//},i=>{const n=i.path.replace("@symbo.ls/","");if(n==="sync")return{path:"sync-stub",namespace:"brender-stub"};if(t.isMonorepo){for(const u of["packages","plugins"]){const a=d(t.monorepoRoot,u,n,"src","index.js");if(b(a))return{path:a};const m=d(t.monorepoRoot,u,n,"index.js");if(b(m))return{path:m}}const l=d(t.monorepoRoot,"packages","default-config","blank","index.js");if(n==="default-config"&&b(l))return{path:l}}else{const l=H(t,n,"src","index.js");if(l&&b(l))return{path:l};const u=H(t,n,"index.js");if(u&&b(u))return{path:u};if(n==="default-config"){const a=H(t,"default-config","blank","index.js");if(a&&b(a))return{path:a}}}}),c.onResolve({filter:/^@domql\//},i=>{const n=i.path.replace("@symbo.ls/","");if(t.isMonorepo){const l=d(t.monorepoRoot,"packages","domql","packages",n,"src","index.js");if(b(l))return{path:l};const u=d(t.monorepoRoot,"packages","domql","packages",n,"index.js");if(b(u))return{path:u}}else{const l=Y(t,n,"src","index.js");if(l&&b(l))return{path:l};const u=Y(t,n,"index.js");if(u&&b(u))return{path:u}}}),c.onResolve({filter:/^css-in-props/},i=>{let n;if(t.isMonorepo)n=d(t.monorepoRoot,"packages","css-in-props");else{const a=G(t,"css-in-props/package.json");a&&(n=q(a))}if(!n)return;const l=i.path.replace(/^css-in-props\/?/,"");if(l){const a=d(n,l),m=d(a,"index.js");if(b(m))return{path:m};if(b(a+".js"))return{path:a+".js"};if(b(a))return{path:a}}const u=r(n);if(u)return{path:u}}),c.onResolve({filter:/^@emotion\//},i=>{let n;if(t.isMonorepo)n=d(t.monorepoRoot,"node_modules",i.path);else{const l=G(t,`${i.path}/package.json`);if(!l)return;n=q(l)}if(b(n)){const l=d(n,"package.json");if(b(l))try{const u=JSON.parse(K(l,"utf8")),a=u.module||u.main||"dist/emotion-css.esm.js";return{path:d(n,a)}}catch{}return{path:n}}}),c.onResolve({filter:/\.json$/},i=>{if(i.resolveDir){const n=d(i.resolveDir,i.path);if(b(n))return{path:n}}}),c.onLoad({filter:/smbls\/.*options\.js$/},async i=>{if(!i.path.includes("smbls/")||!i.path.endsWith("options.js"))return;let n=K(i.path,"utf8");return n=n.replace(/import\s*\{[^}]*version[^}]*\}\s*from\s*['"][^'"]*package\.json['"][^;\n]*/,"const version = '0.0.0'"),n=n.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:n,loader:"js"}}),c.onLoad({filter:/smbls\/.*init\.js$/},async i=>{if(!i.path.includes("smbls/")||!i.path.endsWith("init.js"))return;let n=K(i.path,"utf8");return n=n.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:n,loader:"js"}}),c.onLoad({filter:/.*/,namespace:"brender-stub"},()=>({contents:"export const SyncComponent = {}; export const Inspect = {}; export const Notifications = {}; export const syncPlugin = () => ({}); export const notificationsPlugin = () => ({}); export const inspectPlugin = () => ({}); export default {}",loader:"js"})),c.onLoad({filter:/smbls\/src\/router\.js$/},async i=>{let n=K(i.path,"utf8");return n=n.replace(/import\s*\{\s*Link\s*\}\s*from\s*['"]smbls['"]/,"const Link = { tag: 'a', attr: { href: (el) => el.href } }"),{contents:n,loader:"js"}}),c.onLoad({filter:/fetchOnCreate\.js$/},async i=>{if(!i.path.includes("smbls/"))return;let n=K(i.path,"utf8");return n=n.replace(/window\s*&&\s*window\.location\s*\?\s*window\.location\.host\.includes/g,"window && window.location && window.location.host ? window.location.host.includes"),{contents:n,loader:"js"}})}};await o.build({entryPoints:[e],bundle:!0,format:"esm",platform:"node",outfile:s,write:!0,logLevel:"warning",plugins:[p],nodePaths:t.isMonorepo?[d(t.monorepoRoot,"node_modules")]:[...t.smblsRoot?[d(t.smblsRoot,"node_modules")]:[],...t.projectRoot?[d(t.projectRoot,"node_modules")]:[],...t.smblsRoot?[d(t.smblsRoot,"..","..","node_modules")]:[]].filter(c=>b(c)),supported:{"import-attributes":!1},external:["fs","path","os","crypto","url","http","https","stream","util","events","buffer","child_process","worker_threads","net","tls","dns","dgram","zlib","assert","querystring","string_decoder","readline","perf_hooks","async_hooks","v8","vm","cluster","inspector","module","process","tty","color-contrast-checker","linkedom"]});const f=await import(`file://${s}`);if(process.env.BRENDER_DEBUG)console.log("[brender] Bundle saved:",s);else try{_t(s)}catch{}return Z=f,f},Mt={Box:{},Focusable:{},Block:{display:"block"},Inline:{display:"inline"},Flex:{display:"flex"},InlineFlex:{display:"inline-flex"},Grid:{display:"grid"},InlineGrid:{display:"inline-grid"},Link:{tag:"a",attr:{href:t=>t.href,target:t=>t.target,rel:t=>t.rel}},A:{extends:"Link"},RouteLink:{extends:"Link"},Img:{tag:"img",attr:{src:t=>{let e=t.src;return typeof e=="string"&&e.includes("{{")&&(e=t.call("replaceLiteralsWithObjectFields",e,t.state)),e},alt:t=>t.alt,loading:t=>t.loading}},Image:{extends:"Img"},Button:{tag:"button"},FocusableComponent:{tag:"button"},Form:{tag:"form"},Input:{tag:"input"},TextArea:{tag:"textarea"},Textarea:{tag:"textarea"},Select:{tag:"select"},Label:{tag:"label"},Iframe:{tag:"iframe"},Video:{tag:"video"},Audio:{tag:"audio"},Canvas:{tag:"canvas"},Span:{tag:"span"},P:{tag:"p"},H1:{tag:"h1"},H2:{tag:"h2"},H3:{tag:"h3"},H4:{tag:"h4"},H5:{tag:"h5"},H6:{tag:"h6"},Svg:{tag:"svg",attr:{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},Text:{tag:"span"}},ut=(t,e="")=>{if(!t||!t.__ref)return{};const o={},s=t.__ref.__brKey;if(s&&(o[e===""?"__root":e]=s),t.__ref.__children)for(const r of t.__ref.__children){const p=t[r];if(p&&p.__ref){const f=e===""?r:`${e}.${r}`;Object.assign(o,ut(p,f))}}return o},pt=async(t,e={})=>{const{route:o="/",pathname:s,state:r,context:p,prefetch:f=!1}=e,c=s||o,i=globalThis.location,n=globalThis.window;(!globalThis.location||globalThis.location.pathname!==c)&&(globalThis.location={pathname:c,href:c,search:"",hash:"",origin:""}),globalThis.window||(globalThis.window={location:globalThis.location});let l;if(f)try{const y=t.pages||{};l={...y};const E=await Lt(t,o);if(E.size){const V=JSON.parse(JSON.stringify(y[o],(v,B)=>{if(typeof B!="function")return B})),U=(v,B)=>{if(!(!v||!B))for(const M in v)typeof v[M]=="function"?B[M]=v[M]:typeof v[M]=="object"&&v[M]!==null&&!Array.isArray(v[M])&&typeof B[M]=="object"&&B[M]!==null&&U(v[M],B[M])};U(y[o],V),At(V,E),l[o]=V}}catch(y){console.error("[brender] Prefetch error:",y),l=t.pages}let u;if(f)try{u=await Pt(t)}catch(y){console.warn("[brender] SSR translation fetch failed:",y.message)}i!==void 0?globalThis.location=i:delete globalThis.location,n!==void 0?globalThis.window=n:delete globalThis.window;const{window:a,document:m}=nt(),_=m.body;a.location.pathname=c;const h=globalThis.document,g=globalThis.location;globalThis.document=m,globalThis.location=a.location;const{createDomqlElement:I}=await Et(),L=D(t.app||{}),R={...t.config||{}};t.polyglot&&!R.polyglot&&(R.polyglot=t.polyglot),t.fetch&&!R.fetch&&(R.fetch=t.fetch),t.router&&!R.router&&(R.router=t.router);for(const y of["useReset","useVariable","useFontImport","useIconSprite","useSvgSprite","useDefaultConfig","useDocumentTheme"])t[y]!=null&&R[y]==null&&(R[y]=t[y]);const k=R.polyglot?{...R.polyglot}:void 0;u&&k&&(k.translations={...k.translations||{},...u});const O=D(t.state||{});(u||k)&&(O.root||(O.root={}),k&&(O.root.lang=O.root.lang||k.defaultLang||"en"),u&&(O.root.translations={...O.root.translations||{},...u})),qt();const C={state:O,...r?{state:{...O,...r}}:{},dependencies:D(t.dependencies||{}),components:D(t.components||{}),snippets:D(t.snippets||{}),pages:D(l||t.pages||{}),functions:{...t.functions||{},polyglot:vt,getActiveLang:lt,getLang:lt},methods:t.methods||{},designSystem:D(t.designSystem||{}),files:t.files||{},sharedLibraries:t.sharedLibraries||[],...R,...k?{polyglot:k}:{},document:m,window:a,parent:{node:_},initOptions:{},domqlOptions:{sourcemap:!1},...p||{}},F=await It();F&&(C.plugins=C.plugins||[],C.plugins.some(y=>y.name==="funcql")||C.plugins.push(F)),st();const A=await I(L,C),x=f?2e3:50;await new Promise(y=>setTimeout(y,x)),rt(_);const $=it(A),S=ut(A),w=ct(t,o,A,A?.state),j=[],T=m.head||m.querySelector("head");if(T)for(const y of T.querySelectorAll("style")){if(y.sheet&&y.sheet.cssRules)for(const E of y.sheet.cssRules)E.cssText&&j.push(E.cssText);if(!j.length){const E=y.textContent||"";E&&j.push(E)}}let P=dt(_.innerHTML);if(u){const y=k?.defaultLang||"en",E=u[y]||Object.values(u)[0]||{};P=P.replace(/\{\{\s*([^|{}]+?)\s*\|\s*polyglot\s*\}\}/g,(V,U)=>{const v=U.trim();return E[v]??V})}return h!==void 0?globalThis.document=h:delete globalThis.document,g!==void 0?globalThis.location=g:delete globalThis.location,{html:P,metadata:w,registry:$,brRegistry:S,element:A,emotionCSS:j,document:m,window:a,ssrTranslations:u,prefetchedPages:l}},pe=async(t,e={})=>{const{context:o={}}=e,{window:s,document:r}=nt(),p=r.body,{create:f}=await import("@symbo.ls/element"),c=await import("@symbo.ls/utils"),i={...Mt,...o.components||{}},n={...c,...o.utils||{},...o.functions||{}};st();let l;try{l=f(t,{node:p},"root",{context:{document:r,window:s,...o,components:i,utils:n}})}catch{}rt(p);const u=l?it(l):{};return{html:dt(p.innerHTML),registry:u,element:l}},dt=t=>t.replace(/(<svg\b[^>]*>)([\s\S]*?)(<\/svg>)/gi,(e,o,s,r)=>{if(s.includes("<")){const p=s.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");return o+p+r}return e});let W=null;const Dt=["globalTheme","themeStorageKey","themeRoot","useReset","useVariable","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultConfig","useDefaultIcons","useThemeSuffixedVars","verbose","semanticIcons"],mt=t=>{if(!t||typeof t!="object")return null;if(t.config&&typeof t.config=="object")return t.config;const e={};let o=!1;for(const s of Dt)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s],o=!0);return o?e:t.settings||null},gt=async(t,e)=>{if(W)return W;try{const{existsSync:o,writeFileSync:s,unlinkSync:r}=await import("fs"),{tmpdir:p}=await import("os"),{randomBytes:f}=await import("crypto");try{p()}catch{return{}}const c=await import("esbuild"),i=JSON.stringify(t||{},at()),n=JSON.stringify(e||{},at()),l=tt(p(),`br_global_${f(6).toString("hex")}.mjs`),u=tt(p(),`br_global_${f(6).toString("hex")}_out.mjs`);s(l,`
|
|
1
|
+
import{resolve as d,join as tt,dirname as q}from"path";import{existsSync as b,unlinkSync as _t,readFileSync as K,realpathSync as kt}from"fs";import{resolvePackageEntry as $t}from"./packageEntry.js";import{tmpdir as Ct}from"os";import{randomBytes as Tt}from"crypto";import{createRequire as et}from"module";import{createEnv as nt}from"./env.js";import{resetKeys as st,assignKeys as rt,mapKeysToElements as it}from"./keys.js";import{extractMetadata as ct,generateHeadHtml as Ot}from"./metadata.js";import"./hydrate.js";import{prefetchPageData as Lt,injectPrefetchedState as At,fetchSSRTranslations as Pt}from"./prefetch.js";let z=null;const It=async()=>{if(z)return z;try{return z=(await import("@symbo.ls/funcql")).funcqlPlugin,z}catch{return null}};import"linkedom";import{reset as qt}from"@symbo.ls/css";const ot=(t,e)=>{if(!t||!e)return;if(t[e]!==void 0)return t[e];const o=e.split(".");let s=t;for(const r of o){if(s==null||typeof s!="object")return;s=s[r]}return s},vt=function(t,e){if(!t)return"";const o=this?.context,s=o?.polyglot,r=e||s?.defaultLang||"en";if(s?.translations){const c=s.translations[r];if(c){const i=ot(c,t);if(i!==void 0)return i}}const p=this?.state?.root||o?.state?.root;if(p?.translations){const c=p.translations[r];if(c){const i=ot(c,t);if(i!==void 0)return i}}const f=s?.defaultLang||"en";if(f!==r&&s?.translations){const c=s.translations[f];if(c){const i=ot(c,t);if(i!==void 0)return i}}return t},lt=function(){const t=this?.context;return this?.state?.root?.lang||t?.polyglot?.defaultLang||"en"},M=(t,e=new WeakMap)=>{if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(Array.isArray(t)){const s=[];e.set(t,s);for(const r of t)s.push(typeof r=="object"&&r!==null?M(r,e):r);return s}const o={};e.set(t,o);for(const s of Object.keys(t)){const r=t[s];o[s]=typeof r=="object"&&r!==null?M(r,e):r}return o},at=()=>{const t=new WeakSet;return(e,o)=>{if(typeof o!="function"){if(typeof o=="object"&&o!==null){if(t.has(o))return;t.add(o)}return o}}};let N=null;try{import.meta.url&&(N=et(import.meta.url))}catch{}const ft=()=>{if(!import.meta.url||!N)return{isMonorepo:!1,monorepoRoot:null,resolvePackage:i=>i};const t=kt(new URL(".",import.meta.url).pathname),e=d(t,"../..");if(b(d(e,"packages","smbls","src","createDomql.js")))return{isMonorepo:!0,monorepoRoot:e};let s;try{const i=N.resolve("smbls/package.json");s=q(i)}catch{let i=t;for(;i!==q(i);){const n=d(i,"node_modules","smbls");if(b(d(n,"package.json"))){s=n;break}i=q(i)}}let r=N;if(s)try{r=et(d(s,"package.json"))}catch{}let p,f=process.cwd();for(;f!==q(f);){if(b(d(f,"package.json"))){p=f;break}f=q(f)}let c=r;if(p)try{c=et(d(p,"package.json"))}catch{}return{isMonorepo:!1,smblsRoot:s,brenderDir:t,projectRoot:p,_smblsRequire:r,_projectRequire:c}},G=(t,e)=>{const o=t.isMonorepo?[N]:[t._smblsRequire,t._projectRequire,N].filter(Boolean);for(const s of o)try{return s.resolve(e)}catch{}return null},fe=(t,e,...o)=>{if(t.isMonorepo)return d(t.monorepoRoot,"packages",e,...o);const s=G(t,`${e}/package.json`);return s?d(q(s),...o):null},ue=(t,e,...o)=>{if(t.isMonorepo)return d(t.monorepoRoot,"plugins",e,...o);const s=G(t,`@symbo.ls/${e}/package.json`);return s?d(q(s),...o):null},H=(t,e,...o)=>{if(t.isMonorepo){for(const r of["packages","plugins"]){const p=d(t.monorepoRoot,r,e,...o);if(b(p))return p}return null}const s=G(t,`@symbo.ls/${e}/package.json`);return s?d(q(s),...o):null},Y=(t,e,...o)=>{if(t.isMonorepo)return d(t.monorepoRoot,"packages","domql","packages",e,...o);const s=G(t,`@symbo.ls/${e}/package.json`);return s?d(q(s),...o):null};let Z=null;const Et=async()=>{if(Z)return Z;const t=ft();if(!N)try{const c=await import("./dist/createDomql.bundled.mjs");return Z=c,c}catch(c){throw new Error(`brender: pre-bundled createDomql not available in bundled runtime: ${c.message}`)}let e;if(t.isMonorepo)e=d(t.monorepoRoot,"packages","smbls","src","createDomql.js");else if(t.smblsRoot){const c=d(t.smblsRoot,"src","createDomql.js"),i=d(t.smblsRoot,"dist","esm","src","createDomql.js");e=b(c)?c:i}if(!e||!b(e))throw new Error(`brender: cannot find createDomql.js (isMonorepo=${t.isMonorepo}, entry=${e})`);const o=await import("esbuild"),s=tt(Ct(),`br_createDomql_${Tt(6).toString("hex")}.mjs`),r=$t,p={name:"workspace-resolve",setup(c){c.onResolve({filter:/^smbls/},i=>{const n=i.path.replace(/^smbls\/?/,""),l=t.isMonorepo?d(t.monorepoRoot,"packages","smbls"):t.smblsRoot;if(!l)return;if(!n){const m=r(l);return m?{path:m}:void 0}const u=d(l,n);if(b(u))return{path:u};if(b(u+".js"))return{path:u+".js"};const a=d(u,"index.js");if(b(a))return{path:a}}),c.onResolve({filter:/^domql$/},i=>{if(t.isMonorepo){const n=d(t.monorepoRoot,"packages","domql","src","index.js");if(b(n))return{path:n};const l=d(t.monorepoRoot,"packages","domql","index.js");if(b(l))return{path:l}}else try{const n=_require.resolve("domql/package.json"),l=r(q(n));if(l)return{path:l}}catch{}}),c.onResolve({filter:/^@symbo\.ls\//},i=>{const n=i.path.replace("@symbo.ls/","");if(n==="sync")return{path:"sync-stub",namespace:"brender-stub"};if(t.isMonorepo){for(const u of["packages","plugins"]){const a=d(t.monorepoRoot,u,n,"src","index.js");if(b(a))return{path:a};const m=d(t.monorepoRoot,u,n,"index.js");if(b(m))return{path:m}}const l=d(t.monorepoRoot,"packages","default-config","blank","index.js");if(n==="default-config"&&b(l))return{path:l}}else{const l=H(t,n,"src","index.js");if(l&&b(l))return{path:l};const u=H(t,n,"index.js");if(u&&b(u))return{path:u};if(n==="default-config"){const a=H(t,"default-config","blank","index.js");if(a&&b(a))return{path:a}}}}),c.onResolve({filter:/^@domql\//},i=>{const n=i.path.replace("@symbo.ls/","");if(t.isMonorepo){const l=d(t.monorepoRoot,"packages","domql","packages",n,"src","index.js");if(b(l))return{path:l};const u=d(t.monorepoRoot,"packages","domql","packages",n,"index.js");if(b(u))return{path:u}}else{const l=Y(t,n,"src","index.js");if(l&&b(l))return{path:l};const u=Y(t,n,"index.js");if(u&&b(u))return{path:u}}}),c.onResolve({filter:/^css-in-props/},i=>{let n;if(t.isMonorepo)n=d(t.monorepoRoot,"packages","css-in-props");else{const a=G(t,"css-in-props/package.json");a&&(n=q(a))}if(!n)return;const l=i.path.replace(/^css-in-props\/?/,"");if(l){const a=d(n,l),m=d(a,"index.js");if(b(m))return{path:m};if(b(a+".js"))return{path:a+".js"};if(b(a))return{path:a}}const u=r(n);if(u)return{path:u}}),c.onResolve({filter:/^@emotion\//},i=>{let n;if(t.isMonorepo)n=d(t.monorepoRoot,"node_modules",i.path);else{const l=G(t,`${i.path}/package.json`);if(!l)return;n=q(l)}if(b(n)){const l=d(n,"package.json");if(b(l))try{const u=JSON.parse(K(l,"utf8")),a=u.module||u.main||"dist/emotion-css.esm.js";return{path:d(n,a)}}catch{}return{path:n}}}),c.onResolve({filter:/\.json$/},i=>{if(i.resolveDir){const n=d(i.resolveDir,i.path);if(b(n))return{path:n}}}),c.onLoad({filter:/smbls\/.*options\.js$/},async i=>{if(!i.path.includes("smbls/")||!i.path.endsWith("options.js"))return;let n=K(i.path,"utf8");return n=n.replace(/import\s*\{[^}]*version[^}]*\}\s*from\s*['"][^'"]*package\.json['"][^;\n]*/,"const version = '0.0.0'"),n=n.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:n,loader:"js"}}),c.onLoad({filter:/smbls\/.*init\.js$/},async i=>{if(!i.path.includes("smbls/")||!i.path.endsWith("init.js"))return;let n=K(i.path,"utf8");return n=n.replace(/import\s*\{[^}]*createRequire[^}]*\}\s*from\s*['"]module['"][^;\n]*/g,"// createRequire removed for brender build"),{contents:n,loader:"js"}}),c.onLoad({filter:/.*/,namespace:"brender-stub"},()=>({contents:"export const SyncComponent = {}; export const Inspect = {}; export const Notifications = {}; export const syncPlugin = () => ({}); export const notificationsPlugin = () => ({}); export const seedRawDesignSystem = () => {}; export const inspectPlugin = () => ({}); export default {}",loader:"js"})),c.onLoad({filter:/smbls\/src\/router\.js$/},async i=>{let n=K(i.path,"utf8");return n=n.replace(/import\s*\{\s*Link\s*\}\s*from\s*['"]smbls['"]/,"const Link = { tag: 'a', attr: { href: (el) => el.href } }"),{contents:n,loader:"js"}}),c.onLoad({filter:/fetchOnCreate\.js$/},async i=>{if(!i.path.includes("smbls/"))return;let n=K(i.path,"utf8");return n=n.replace(/window\s*&&\s*window\.location\s*\?\s*window\.location\.host\.includes/g,"window && window.location && window.location.host ? window.location.host.includes"),{contents:n,loader:"js"}})}};await o.build({entryPoints:[e],bundle:!0,format:"esm",platform:"node",outfile:s,write:!0,logLevel:"warning",plugins:[p],nodePaths:t.isMonorepo?[d(t.monorepoRoot,"node_modules")]:[...t.smblsRoot?[d(t.smblsRoot,"node_modules")]:[],...t.projectRoot?[d(t.projectRoot,"node_modules")]:[],...t.smblsRoot?[d(t.smblsRoot,"..","..","node_modules")]:[]].filter(c=>b(c)),supported:{"import-attributes":!1},external:["fs","path","os","crypto","url","http","https","stream","util","events","buffer","child_process","worker_threads","net","tls","dns","dgram","zlib","assert","querystring","string_decoder","readline","perf_hooks","async_hooks","v8","vm","cluster","inspector","module","process","tty","color-contrast-checker","linkedom"]});const f=await import(`file://${s}`);if(process.env.BRENDER_DEBUG)console.log("[brender] Bundle saved:",s);else try{_t(s)}catch{}return Z=f,f},Dt={Box:{},Focusable:{},Block:{display:"block"},Inline:{display:"inline"},Flex:{display:"flex"},InlineFlex:{display:"inline-flex"},Grid:{display:"grid"},InlineGrid:{display:"inline-grid"},Link:{tag:"a",attr:{href:t=>t.href,target:t=>t.target,rel:t=>t.rel}},A:{extends:"Link"},RouteLink:{extends:"Link"},Img:{tag:"img",attr:{src:t=>{let e=t.src;return typeof e=="string"&&e.includes("{{")&&(e=t.call("replaceLiteralsWithObjectFields",e,t.state)),e},alt:t=>t.alt,loading:t=>t.loading}},Image:{extends:"Img"},Button:{tag:"button"},FocusableComponent:{tag:"button"},Form:{tag:"form"},Input:{tag:"input"},TextArea:{tag:"textarea"},Textarea:{tag:"textarea"},Select:{tag:"select"},Label:{tag:"label"},Iframe:{tag:"iframe"},Video:{tag:"video"},Audio:{tag:"audio"},Canvas:{tag:"canvas"},Span:{tag:"span"},P:{tag:"p"},H1:{tag:"h1"},H2:{tag:"h2"},H3:{tag:"h3"},H4:{tag:"h4"},H5:{tag:"h5"},H6:{tag:"h6"},Svg:{tag:"svg",attr:{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},Text:{tag:"span"}},ut=(t,e="")=>{if(!t||!t.__ref)return{};const o={},s=t.__ref.__brKey;if(s&&(o[e===""?"__root":e]=s),t.__ref.__children)for(const r of t.__ref.__children){const p=t[r];if(p&&p.__ref){const f=e===""?r:`${e}.${r}`;Object.assign(o,ut(p,f))}}return o},pt=async(t,e={})=>{const{route:o="/",pathname:s,state:r,context:p,prefetch:f=!1}=e,c=s||o,i=globalThis.location,n=globalThis.window;(!globalThis.location||globalThis.location.pathname!==c)&&(globalThis.location={pathname:c,href:c,search:"",hash:"",origin:""}),globalThis.window||(globalThis.window={location:globalThis.location});let l;if(f)try{const y=t.pages||{};l={...y};const E=await Lt(t,o);if(E.size){const V=JSON.parse(JSON.stringify(y[o],(v,B)=>{if(typeof B!="function")return B})),U=(v,B)=>{if(!(!v||!B))for(const D in v)typeof v[D]=="function"?B[D]=v[D]:typeof v[D]=="object"&&v[D]!==null&&!Array.isArray(v[D])&&typeof B[D]=="object"&&B[D]!==null&&U(v[D],B[D])};U(y[o],V),At(V,E),l[o]=V}}catch(y){console.error("[brender] Prefetch error:",y),l=t.pages}let u;if(f)try{u=await Pt(t)}catch(y){console.warn("[brender] SSR translation fetch failed:",y.message)}i!==void 0?globalThis.location=i:delete globalThis.location,n!==void 0?globalThis.window=n:delete globalThis.window;const{window:a,document:m}=nt(),_=m.body;a.location.pathname=c;const h=globalThis.document,g=globalThis.location;globalThis.document=m,globalThis.location=a.location;const{createDomqlElement:I}=await Et(),L=M(t.app||{}),R={...t.config||{}};t.polyglot&&!R.polyglot&&(R.polyglot=t.polyglot),t.fetch&&!R.fetch&&(R.fetch=t.fetch),t.router&&!R.router&&(R.router=t.router);for(const y of["useReset","useVariable","useFontImport","useIconSprite","useSvgSprite","useDefaultConfig","useDocumentTheme"])t[y]!=null&&R[y]==null&&(R[y]=t[y]);const k=R.polyglot?{...R.polyglot}:void 0;u&&k&&(k.translations={...k.translations||{},...u});const O=M(t.state||{});(u||k)&&(O.root||(O.root={}),k&&(O.root.lang=O.root.lang||k.defaultLang||"en"),u&&(O.root.translations={...O.root.translations||{},...u})),qt();const C={state:O,...r?{state:{...O,...r}}:{},dependencies:M(t.dependencies||{}),components:M(t.components||{}),snippets:M(t.snippets||{}),pages:M(l||t.pages||{}),functions:{...t.functions||{},polyglot:vt,getActiveLang:lt,getLang:lt},methods:t.methods||{},designSystem:M(t.designSystem||{}),files:t.files||{},sharedLibraries:t.sharedLibraries||[],...R,...k?{polyglot:k}:{},document:m,window:a,parent:{node:_},initOptions:{},domqlOptions:{sourcemap:!1},...p||{}},F=await It();F&&(C.plugins=C.plugins||[],C.plugins.some(y=>y.name==="funcql")||C.plugins.push(F)),st();const A=await I(L,C),x=f?2e3:50;await new Promise(y=>setTimeout(y,x)),rt(_);const $=it(A),S=ut(A),w=ct(t,o,A,A?.state),j=[],T=m.head||m.querySelector("head");if(T)for(const y of T.querySelectorAll("style")){if(y.sheet&&y.sheet.cssRules)for(const E of y.sheet.cssRules)E.cssText&&j.push(E.cssText);if(!j.length){const E=y.textContent||"";E&&j.push(E)}}let P=dt(_.innerHTML);if(u){const y=k?.defaultLang||"en",E=u[y]||Object.values(u)[0]||{};P=P.replace(/\{\{\s*([^|{}]+?)\s*\|\s*polyglot\s*\}\}/g,(V,U)=>{const v=U.trim();return E[v]??V})}return h!==void 0?globalThis.document=h:delete globalThis.document,g!==void 0?globalThis.location=g:delete globalThis.location,{html:P,metadata:w,registry:$,brRegistry:S,element:A,emotionCSS:j,document:m,window:a,ssrTranslations:u,prefetchedPages:l}},pe=async(t,e={})=>{const{context:o={}}=e,{window:s,document:r}=nt(),p=r.body,{create:f}=await import("@symbo.ls/element"),c=await import("@symbo.ls/utils"),i={...Dt,...o.components||{}},n={...c,...o.utils||{},...o.functions||{}};st();let l;try{l=f(t,{node:p},"root",{context:{document:r,window:s,...o,components:i,utils:n}})}catch{}rt(p);const u=l?it(l):{};return{html:dt(p.innerHTML),registry:u,element:l}},dt=t=>t.replace(/(<svg\b[^>]*>)([\s\S]*?)(<\/svg>)/gi,(e,o,s,r)=>{if(s.includes("<")){const p=s.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");return o+p+r}return e});let W=null;const Mt=["globalTheme","themeStorageKey","themeRoot","useReset","useVariable","useFontImport","useIconSprite","useSvgSprite","useDocumentTheme","useDefaultConfig","useDefaultIcons","useThemeSuffixedVars","verbose","semanticIcons"],mt=t=>{if(!t||typeof t!="object")return null;if(t.config&&typeof t.config=="object")return t.config;const e={};let o=!1;for(const s of Mt)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s],o=!0);return o?e:t.settings||null},gt=async(t,e)=>{if(W)return W;try{const{existsSync:o,writeFileSync:s,unlinkSync:r}=await import("fs"),{tmpdir:p}=await import("os"),{randomBytes:f}=await import("crypto");try{p()}catch{return{}}const c=await import("esbuild"),i=JSON.stringify(t||{},at()),n=JSON.stringify(e||{},at()),l=tt(p(),`br_global_${f(6).toString("hex")}.mjs`),u=tt(p(),`br_global_${f(6).toString("hex")}_out.mjs`);s(l,`
|
|
2
2
|
import { set, getActiveConfig, getFontFaceString } from '@symbo.ls/scratch'
|
|
3
3
|
import { DEFAULT_CONFIG } from '@symbo.ls/default-config'
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/brender",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.658",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": false,
|
|
52
52
|
"publishConfig": {
|
|
53
|
-
"access": "
|
|
53
|
+
"access": "public"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/render.js
CHANGED
|
@@ -456,7 +456,7 @@ const bundleCreateDomql = async () => {
|
|
|
456
456
|
// We set globalThis.document/location before import to make it SSR-safe
|
|
457
457
|
// Stub loader for brender-stub namespace (used for @symbo.ls/sync etc.)
|
|
458
458
|
build.onLoad({ filter: /.*/, namespace: 'brender-stub' }, () => {
|
|
459
|
-
return { contents: 'export const SyncComponent = {}; export const Inspect = {}; export const Notifications = {}; export const syncPlugin = () => ({}); export const notificationsPlugin = () => ({}); export const inspectPlugin = () => ({}); export default {}', loader: 'js' }
|
|
459
|
+
return { contents: 'export const SyncComponent = {}; export const Inspect = {}; export const Notifications = {}; export const syncPlugin = () => ({}); export const notificationsPlugin = () => ({}); export const seedRawDesignSystem = () => {}; export const inspectPlugin = () => ({}); export default {}', loader: 'js' }
|
|
460
460
|
})
|
|
461
461
|
// Fix router.js: break circular import of Link from smbls
|
|
462
462
|
build.onLoad({ filter: /smbls\/src\/router\.js$/ }, async (args) => {
|