@symbo.ls/brender 3.14.656 → 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/packageEntry.js +1 -0
- package/dist/esm/render.js +20 -20
- package/package.json +2 -2
- package/packageEntry.js +31 -0
- package/render.js +3 -10
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve as e}from"path";import{existsSync as s}from"fs";const c=r=>{if(!r)return null;const t=e(r,"index.js");if(s(t))return t;const n=e(r,"src","index.js");return s(n)?n:null};export{c as resolvePackageEntry};
|
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 h,unlinkSync as _t,readFileSync as K,realpathSync as kt}from"fs";import{tmpdir as $t}from"os";import{randomBytes as Ct}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 Tt}from"./metadata.js";import"./hydrate.js";import{prefetchPageData as Ot,injectPrefetchedState as Lt,fetchSSRTranslations as At}from"./prefetch.js";let z=null;const Pt=async()=>{if(z)return z;try{return z=(await import("@symbo.ls/funcql")).funcqlPlugin,z}catch{return null}};import"linkedom";import{reset as It}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},qt=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(h(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(h(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(h(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},le=(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},ae=(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(h(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 vt=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=h(c)?c:i}if(!e||!h(e))throw new Error(`brender: cannot find createDomql.js (isMonorepo=${t.isMonorepo}, entry=${e})`);const o=await import("esbuild"),s=tt($t(),`br_createDomql_${Ct(6).toString("hex")}.mjs`),r=c=>{if(!c)return null;const i=d(c,"src","index.js");if(h(i))return i;const n=d(c,"index.js");return h(n)?n:null},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(h(u))return{path:u};if(h(u+".js"))return{path:u+".js"};const a=d(u,"index.js");if(h(a))return{path:a}}),c.onResolve({filter:/^domql$/},i=>{if(t.isMonorepo){const n=d(t.monorepoRoot,"packages","domql","src","index.js");if(h(n))return{path:n};const l=d(t.monorepoRoot,"packages","domql","index.js");if(h(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(h(a))return{path:a};const m=d(t.monorepoRoot,u,n,"index.js");if(h(m))return{path:m}}const l=d(t.monorepoRoot,"packages","default-config","blank","index.js");if(n==="default-config"&&h(l))return{path:l}}else{const l=H(t,n,"src","index.js");if(l&&h(l))return{path:l};const u=H(t,n,"index.js");if(u&&h(u))return{path:u};if(n==="default-config"){const a=H(t,"default-config","blank","index.js");if(a&&h(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(h(l))return{path:l};const u=d(t.monorepoRoot,"packages","domql","packages",n,"index.js");if(h(u))return{path:u}}else{const l=Y(t,n,"src","index.js");if(l&&h(l))return{path:l};const u=Y(t,n,"index.js");if(u&&h(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(h(m))return{path:m};if(h(a+".js"))return{path:a+".js"};if(h(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(h(n)){const l=d(n,"package.json");if(h(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(h(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=>h(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},Et={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 b=t.pages||{};l={...b};const E=await Ot(t,o);if(E.size){const V=JSON.parse(JSON.stringify(b[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(b[o],V),Lt(V,E),l[o]=V}}catch(b){console.error("[brender] Prefetch error:",b),l=t.pages}let u;if(f)try{u=await At(t)}catch(b){console.warn("[brender] SSR translation fetch failed:",b.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 y=globalThis.document,g=globalThis.location;globalThis.document=m,globalThis.location=a.location;const{createDomqlElement:I}=await vt(),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 b of["useReset","useVariable","useFontImport","useIconSprite","useSvgSprite","useDefaultConfig","useDocumentTheme"])t[b]!=null&&R[b]==null&&(R[b]=t[b]);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})),It();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:qt,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 Pt();F&&(C.plugins=C.plugins||[],C.plugins.some(b=>b.name==="funcql")||C.plugins.push(F)),st();const A=await I(L,C),w=f?2e3:50;await new Promise(b=>setTimeout(b,w)),rt(_);const $=it(A),S=ut(A),x=ct(t,o,A,A?.state),j=[],T=m.head||m.querySelector("head");if(T)for(const b of T.querySelectorAll("style")){if(b.sheet&&b.sheet.cssRules)for(const E of b.sheet.cssRules)E.cssText&&j.push(E.cssText);if(!j.length){const E=b.textContent||"";E&&j.push(E)}}let P=dt(_.innerHTML);if(u){const b=k?.defaultLang||"en",E=u[b]||Object.values(u)[0]||{};P=P.replace(/\{\{\s*([^|{}]+?)\s*\|\s*polyglot\s*\}\}/g,(V,U)=>{const v=U.trim();return E[v]??V})}return y!==void 0?globalThis.document=y:delete globalThis.document,g!==void 0?globalThis.location=g:delete globalThis.location,{html:P,metadata:x,registry:$,brRegistry:S,element:A,emotionCSS:j,document:m,window:a,ssrTranslations:u,prefetchedPages:l}},fe=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={...Et,...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,`
|
|
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
|
|
|
@@ -36,31 +36,31 @@ import{resolve as d,join as tt,dirname as q}from"path";import{existsSync as h,un
|
|
|
36
36
|
// Export as globalThis so we can read it
|
|
37
37
|
globalThis.__BR_GLOBAL_CSS__ = result
|
|
38
38
|
export default result
|
|
39
|
-
`);const a=ft(),m={name:"workspace-resolve",setup(
|
|
39
|
+
`);const a=ft(),m={name:"workspace-resolve",setup(x){x.onResolve({filter:/^@symbo\.ls\//},$=>{const S=$.path.replace("@symbo.ls/","");if(a.isMonorepo){for(const j of["packages","plugins"]){const T=d(a.monorepoRoot,j,S,"src","index.js");if(o(T))return{path:T};const P=d(a.monorepoRoot,j,S,"index.js");if(o(P))return{path:P}}const w=d(a.monorepoRoot,"packages","default-config","blank","index.js");if(S==="default-config"&&o(w))return{path:w}}else{const w=H(a,S,"src","index.js");if(w&&o(w))return{path:w};const j=H(a,S,"index.js");if(j&&o(j))return{path:j};if(S==="default-config"){const T=H(a,"default-config","blank","index.js");if(T&&o(T))return{path:T}}}}),x.onResolve({filter:/^@domql\//},$=>{const S=$.path.replace("@symbo.ls/","");if(a.isMonorepo){const w=d(a.monorepoRoot,"packages","domql","packages",S,"src","index.js");if(o(w))return{path:w}}else{const w=Y(a,S,"src","index.js");if(w&&o(w))return{path:w};const j=Y(a,S,"index.js");if(j&&o(j))return{path:j}}})}};await c.build({entryPoints:[l],bundle:!0,format:"esm",platform:"node",outfile:u,write:!0,logLevel:"silent",plugins:[m],nodePaths:a.isMonorepo?[d(a.monorepoRoot,"node_modules")]:[...a.smblsRoot?[d(a.smblsRoot,"node_modules")]:[],...a.projectRoot?[d(a.projectRoot,"node_modules")]:[],...a.smblsRoot?[d(a.smblsRoot,"..","..","node_modules")]:[]].filter(x=>o(x)),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"]});const h=(await import(`file://${u}`)).default||{};try{r(l)}catch{}try{r(u)}catch{}const g=h.CSS_VARS||{},I=h.CSS_MEDIA_VARS||{},L=h.RESET||{},R=h.ANIMATION||{},k=Object.entries(g).map(([x,$])=>` ${x}: ${$}`).join(`;
|
|
40
40
|
`);let O=k?`:root {
|
|
41
41
|
${k};
|
|
42
|
-
}`:"";const C=Object.entries(I).map(([
|
|
43
|
-
`);return S?
|
|
42
|
+
}`:"";const C=Object.entries(I).map(([x,$])=>{const S=Object.entries($).map(([w,j])=>` ${w}: ${j}`).join(`;
|
|
43
|
+
`);return S?x.startsWith("@media")?`${x} {
|
|
44
44
|
:root:not([data-theme]) {
|
|
45
45
|
${S};
|
|
46
46
|
}
|
|
47
|
-
}`:`${
|
|
47
|
+
}`:`${x} {
|
|
48
48
|
${S};
|
|
49
49
|
}`:""}).filter(Boolean).join(`
|
|
50
50
|
|
|
51
51
|
`);C&&(O+=`
|
|
52
52
|
|
|
53
|
-
`+C);const F=
|
|
54
|
-
`);A.push(`@keyframes ${
|
|
53
|
+
`+C);const F=wt(L),A=[];for(const x in R){const $=R[x];if(!$||typeof $!="object")continue;const S=Object.entries($).map(([w,j])=>{if(typeof j!="object")return"";const T=Object.entries(j).map(([P,y])=>`${J(P)}: ${y}`).join("; ");return` ${w} { ${T}; }`}).join(`
|
|
54
|
+
`);A.push(`@keyframes ${x} {
|
|
55
55
|
${S}
|
|
56
56
|
}`)}return W={rootRule:O,resetRules:F,fontFaceCSS:"",keyframeRules:A.join(`
|
|
57
|
-
`)},W}catch(o){return console.warn("generateGlobalCSS failed:",o.message,o.stack),W={rootRule:"",resetRules:"",fontFaceCSS:"",keyframeRules:""},W}};let X=new Set;const
|
|
58
|
-
`),
|
|
57
|
+
`)},W}catch(o){return console.warn("generateGlobalCSS failed:",o.message,o.stack),W={rootRule:"",resetRules:"",fontFaceCSS:"",keyframeRules:""},W}};let X=new Set;const de=()=>{W=null,X=new Set},me=()=>Array.from(X).join(`
|
|
58
|
+
`),ge=(t,e)=>t.replace(/<style data-emotion="smbls">[\s\S]*?<\/style>/,e?`<style data-emotion="smbls">
|
|
59
59
|
${e}
|
|
60
|
-
</style>`:""),
|
|
61
|
-
`):"",globalCSS:f,resetCss:f.resetRules||
|
|
62
|
-
`),m=t.designSystem||{},_=await gt(m,mt(t)),
|
|
63
|
-
`)}const
|
|
60
|
+
</style>`:""),he=async(t,e={})=>{const{route:o="/",pathname:s}=e,r=await pt(t,{route:o,pathname:s,prefetch:!0});if(!r)return null;const p=t.designSystem||{},f=await gt(p,mt(t));let c=null,i=null;try{const n=r.element,l=n?.context?.polyglot||t.polyglot||t.config?.polyglot;if(i=n?.state?.root?.lang||l?.defaultLang||"en",r.prefetchedPages&&r.prefetchedPages[o]){const u=r.prefetchedPages[o],a=(m,_={})=>{if(!m||typeof m!="object")return _;if(m.state&&typeof m.state=="object")for(const[h,g]of Object.entries(m.state))g!=null&&typeof g!="function"&&(_[h]=g);for(const[h,g]of Object.entries(m))h==="state"||h==="props"||h==="attr"||h==="on"||h==="define"||h==="__ref"||h.startsWith("__")||g&&typeof g=="object"&&!Array.isArray(g)&&a(g,_);return _};c=a(u)}}catch{}return{html:r.html,css:r.emotionCSS?r.emotionCSS.join(`
|
|
61
|
+
`):"",globalCSS:f,resetCss:f.resetRules||wt(p.reset),fontLinks:xt(p),metadata:r.metadata||ct(t,o),brKeyCount:r.registry?Object.keys(r.registry).length:0,brRegistry:r.brRegistry||{},ssrTranslations:r.ssrTranslations,prefetchedState:c,activeLang:i}},ye=async(t,e="/",o={})=>{const{lang:s,themeColor:r,isr:p,hydrate:f=!0,prefetch:c=!0}=o,i=s||t.state?.lang||t.app?.metadata?.lang||"en",n=await pt(t,{route:e,prefetch:c});if(!n)return null;const l={...n.metadata};r&&(l["theme-color"]=r);const u=Ot(l);if(n.emotionCSS&&n.emotionCSS.length)for(const C of n.emotionCSS)C&&X.add(C);const a=Array.from(X).join(`
|
|
62
|
+
`),m=t.designSystem||{},_=await gt(m,mt(t)),h=xt(m),g=Object.keys(n.registry).length;let I="";if(p&&p.clientScript){const C=e==="/"?0:e.replace(/^\/|\/$/g,"").split("/").length,F=C>0?"../".repeat(C):"./";if(f){let A="";if(n.ssrTranslations){const S=t.polyglot||t.config?.polyglot,w=S?.storagePrefix||"",j=S?.storageLangKey||"",T=[];for(const P in n.ssrTranslations){const y=n.ssrTranslations[P];y&&typeof y=="object"&&T.push(`localStorage.setItem(${JSON.stringify(w+P)},${JSON.stringify(JSON.stringify(y))})`)}if(j){const P=S?.defaultLang||"en";T.push(`if(!localStorage.getItem(${JSON.stringify(j)}))localStorage.setItem(${JSON.stringify(j)},${JSON.stringify(P)})`)}T.length&&(A=`<script>try{${T.join(";")}}catch(e){}<\/script>
|
|
63
|
+
`)}const x=n.brRegistry&&Object.keys(n.brRegistry).length?JSON.stringify(n.brRegistry):null,$=x?`<script>window.__BR_REGISTRY__=${x}<\/script>
|
|
64
64
|
`:"";I=`${A}${$}<script>window.__BRENDER__=true<\/script>
|
|
65
65
|
<script type="module" src="${F}${p.clientScript}"><\/script>`}else I=`<script type="module">
|
|
66
66
|
{
|
|
@@ -79,11 +79,11 @@ ${e}
|
|
|
79
79
|
observer.observe(document.body, { childList: true })
|
|
80
80
|
}
|
|
81
81
|
<\/script>
|
|
82
|
-
<script type="module" src="${F}${p.clientScript}"><\/script>`}const L={...t.config||{}};t.polyglot&&!L.polyglot&&(L.polyglot=t.polyglot);const R=L.polyglot;let k=u;if(R){const C=R.defaultLang||"en",A={...R.translations||{},...n.ssrTranslations||{}}[C]||{};k=u.replace(/\{\{\s*([^|{}]+?)\s*\|\s*polyglot\s*\}\}/g,(
|
|
82
|
+
<script type="module" src="${F}${p.clientScript}"><\/script>`}const L={...t.config||{}};t.polyglot&&!L.polyglot&&(L.polyglot=t.polyglot);const R=L.polyglot;let k=u;if(R){const C=R.defaultLang||"en",A={...R.translations||{},...n.ssrTranslations||{}}[C]||{};k=u.replace(/\{\{\s*([^|{}]+?)\s*\|\s*polyglot\s*\}\}/g,(x,$)=>{const S=$.trim();return A[S]??x})}return{html:`<!DOCTYPE html>
|
|
83
83
|
<html lang="${i}">
|
|
84
84
|
<head>
|
|
85
85
|
${k}
|
|
86
|
-
${
|
|
86
|
+
${h}
|
|
87
87
|
${_.fontFaceCSS?`<style>${_.fontFaceCSS}</style>`:""}
|
|
88
88
|
<style>
|
|
89
89
|
${_.rootRule||""}
|
|
@@ -98,11 +98,11 @@ ${a}
|
|
|
98
98
|
${n.html}
|
|
99
99
|
${I}
|
|
100
100
|
</body>
|
|
101
|
-
</html>`,route:e,brKeyCount:g}},
|
|
102
|
-
`)},Rt={Flex:{display:"flex"},InlineFlex:{display:"inline-flex"},Grid:{display:"grid"},InlineGrid:{display:"inline-grid"},Block:{display:"block"},Inline:{display:"inline"}},
|
|
101
|
+
</html>`,route:e,brKeyCount:g}},Ft={U:-6,V:-5,W:-4,X:-3,Y:-2,Z:-1,A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15},ht=new Set(["padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingInline","paddingBlockStart","paddingBlockEnd","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginInline","marginBlockStart","marginBlockEnd","marginInlineStart","marginInlineEnd","gap","rowGap","columnGap","top","right","bottom","left","width","height","minWidth","maxWidth","minHeight","maxHeight","flexBasis","fontSize","lineHeight","letterSpacing","borderWidth","borderRadius","outlineWidth","outlineOffset","inset","insetBlock","insetInline","boxSize","round"]),yt=(t,e)=>{if(!t||typeof t!="string"||!e)return null;const o=e.base||16,s=e.ratio||1.618,r=e.unit||"px",p=e.subSequence!==!1;if(t.includes(" "))return t.split(" ").map(g=>g==="-"||g===""?g:yt(g,e)||g).join(" ");if(/^(none|auto|inherit|initial|unset|0)$/i.test(t)||/\d+(px|em|rem|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc|fr|s|ms)$/i.test(t)||/^(#|rgb|hsl|var\()/i.test(t))return null;const f=t.startsWith("-"),i=(f?t.slice(1):t).match(/^([A-Z])(\d)?$/i);if(!i)return null;const n=i[1].toUpperCase(),l=i[2]?parseInt(i[2]):0,u=Ft[n];if(u===void 0)return null;let a=o*Math.pow(s,u);if(l>0&&p){const h=o*Math.pow(s,u+1),I=(h-a)/s,L=h-I,R=a+I,k=(L+R)/2,O=~~h-~~a>16?[L,k,R]:[L,R];l<=O.length&&(a=O[l-1])}const m=Math.round(a*100)/100;return`${f?"-":""}${m}${r}`},Bt=new Set([...ht].map(t=>t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()))),Q=(t,e,o)=>{if(typeof e!="string")return e;if(Nt.has(t)){const s=o?.color||{};if(s[e])return s[e]}if(ht.has(t)||Bt.has(t)){const s=o?.spacing||{},r=yt(e,s);if(r)return r}return e},Nt=new Set(["color","background","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor","fill","stroke"]),bt=new Set(["href","src","alt","title","id","name","type","value","placeholder","target","rel","loading","srcset","sizes","media","role","tabindex","for","action","method","enctype","autocomplete","autofocus","theme","__element","update","childrenAs","childExtends","childProps","children"]),J=t=>t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),St=(t,e)=>{if(typeof e>"u"||e===null)return null;if(t==="flow"&&typeof e=="string"){let[o,s]=(e||"row").split(" ");return(e.startsWith("x")||e==="row")&&(o="row"),(e.startsWith("y")||e==="column")&&(o="column"),{display:"flex","flex-flow":(o||"")+" "+(s||"")}}if(t==="wrap")return{display:"flex","flex-wrap":e};if((t==="align"||t==="flexAlign")&&typeof e=="string"){const[o,s]=e.split(" "),r={display:"flex","align-items":o};return s&&(r["justify-content"]=s),r}if(t==="gridAlign"&&typeof e=="string"){const[o,s]=e.split(" "),r={display:"grid","align-items":o};return s&&(r["justify-content"]=s),r}if(t==="flexFlow"&&typeof e=="string"){let[o,s]=(e||"row").split(" ");return(e.startsWith("x")||e==="row")&&(o="row"),(e.startsWith("y")||e==="column")&&(o="column"),{display:"flex","flex-flow":(o||"")+" "+(s||"")}}if(t==="flexWrap")return{display:"flex","flex-wrap":e};if(t==="backgroundImage"&&typeof e=="string"&&!e.startsWith("url(")&&!e.startsWith("linear-gradient")&&!e.startsWith("radial-gradient")&&!e.startsWith("none"))return{"background-image":`url(${e})`};if(t==="round"||t==="borderRadius"&&e)return{"border-radius":typeof e=="number"?e+"px":e};if(t==="boxSize"&&typeof e=="string"){const[o,s]=e.split(" ");return{height:o,width:s||o}}if(t==="widthRange"&&typeof e=="string"){const[o,s]=e.split(" ");return{"min-width":o,"max-width":s||o}}if(t==="heightRange"&&typeof e=="string"){const[o,s]=e.split(" ");return{"min-height":o,"max-height":s||o}}return t==="column"?{"grid-column":e}:t==="columns"?{"grid-template-columns":e}:t==="templateColumns"?{"grid-template-columns":e}:t==="row"?{"grid-row":e}:t==="rows"?{"grid-template-rows":e}:t==="templateRows"?{"grid-template-rows":e}:t==="area"?{"grid-area":e}:t==="template"?{"grid-template":e}:t==="templateAreas"?{"grid-template-areas":e}:t==="autoColumns"?{"grid-auto-columns":e}:t==="autoRows"?{"grid-auto-rows":e}:t==="autoFlow"?{"grid-auto-flow":e}:t==="columnStart"?{"grid-column-start":e}:t==="rowStart"?{"grid-row-start":e}:null},jt=(t,e)=>{const o={};for(const s in t){const r=t[s],p=St(s,r);if(p){for(const f in p)o[f]=Q(f,p[f],e);continue}typeof r!="string"&&typeof r!="number"||(o[J(s)]=Q(s,r,e))}return o},Wt=(t,e,o)=>{const s={},r={},p={};for(const f in t){const c=t[f];if(f.charCodeAt(0)===64&&typeof c=="object"){const n=o?.[f.slice(1)];if(n){const l=jt(c,e);Object.keys(l).length&&(r[n]=l)}continue}if(f.charCodeAt(0)===58&&typeof c=="object"){const n=jt(c,e);Object.keys(n).length&&(p[f]=n);continue}if(typeof c!="string"&&typeof c!="number"||f.charCodeAt(0)>=65&&f.charCodeAt(0)<=90||bt.has(f))continue;const i=St(f,c);if(i){for(const n in i)s[n]=Q(n,i[n],e);continue}s[J(f)]=Q(f,c,e)}return{base:s,mediaRules:r,pseudoRules:p}},Jt=(t,{base:e,mediaRules:o,pseudoRules:s})=>{const r=[],p=Object.entries(e).map(([f,c])=>`${f}: ${c}`).join("; ");p&&r.push(`${t} { ${p}; }`);for(const[f,c]of Object.entries(s)){const i=Object.entries(c).map(([n,l])=>`${n}: ${l}`).join("; ");i&&r.push(`${t}${f} { ${i}; }`)}for(const[f,c]of Object.entries(o)){const i=Object.entries(c).map(([l,u])=>`${l}: ${u}`).join("; "),n=f.startsWith("@")?f:`@media ${f}`;i&&r.push(`${n} { ${t} { ${i}; } }`)}return r.join(`
|
|
102
|
+
`)},Rt={Flex:{display:"flex"},InlineFlex:{display:"inline-flex"},Grid:{display:"grid"},InlineGrid:{display:"inline-grid"},Block:{display:"block"},Inline:{display:"inline"}},Gt=t=>{const e=t.__ref?.__extends;if(!e||!Array.isArray(e))return null;for(const o of e)if(Rt[o])return Rt[o];return null},Ht=t=>{let e;for(const o in t){if(typeof t[o]!="function"||bt.has(o)||o.charCodeAt(0)>=65&&o.charCodeAt(0)<=90||o.startsWith("on")||o.startsWith("__"))continue;e||(e={});let s;try{s=t[o](t,t.state||{})}catch{try{const r={root:{},...t.state||{}};s=t[o](t,r)}catch{}}s!=null&&s!==!1&&(e[o]=s)}return e||t},be=(t,e)=>{const o=e?.media||{},s=e?.animation||{},r=[],p=new Set,f=new Set,c=n=>{if(!n||!n.__ref)return;const l=Ht(n);if(l&&n.node){const u=n.node.getAttribute?.("class");if(u&&!p.has(u)){p.add(u);const a=Wt(l,e,o),m=Gt(n);if(m)for(const[g,I]of Object.entries(m)){const L=J(g);a.base[L]||(a.base[L]=I)}(Object.keys(a.base).length||Object.keys(a.mediaRules).length||Object.keys(a.pseudoRules).length)&&r.push(Jt("."+u.split(" ")[0],a));const h=l.animation||l.animationName;if(typeof h=="string"){const g=h.split(" ")[0];s[g]&&f.add(g)}}}if(n.__ref?.__children)for(const u of n.__ref.__children)n[u]?.__ref&&c(n[u])};c(t);const i=[];for(const n of f){const l=s[n],u=Object.entries(l).map(([a,m])=>{const _=Object.entries(m).map(([h,g])=>`${J(h)}: ${g}`).join("; ");return` ${a} { ${_}; }`}).join(`
|
|
103
103
|
`);i.push(`@keyframes ${n} {
|
|
104
104
|
${u}
|
|
105
105
|
}`)}return[...i,...r].join(`
|
|
106
|
-
`)},
|
|
107
|
-
`)},
|
|
108
|
-
`):""};export{
|
|
106
|
+
`)},wt=t=>{if(!t)return"";const e=[];for(const[o,s]of Object.entries(t)){if(!s||typeof s!="object")continue;const r=[],p=[];for(const[f,c]of Object.entries(s)){if(typeof c=="object"&&c!==null){if(f.startsWith("@media")||f.startsWith("@")){const i=Object.entries(c).filter(([,n])=>typeof n!="object").map(([n,l])=>`${J(n)}: ${l}`).join("; ");i&&p.push(`${f} { ${o} { ${i}; } }`)}continue}r.push(`${J(f)}: ${c}`)}r.length&&e.push(`${o} { ${r.join("; ")}; }`),e.push(...p)}return e.join(`
|
|
107
|
+
`)},xt=t=>{if(!t)return"";const e=t.font_family||t.fontFamily||{},o=new Set;for(const r of Object.values(e)){if(typeof r!="string")continue;const p=r.match(/'([^']+)'/);p&&o.add(p[1])}return o.size?['<link rel="preconnect" href="https://fonts.googleapis.com">','<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>',`<link href="https://fonts.googleapis.com/css2?${[...o].map(r=>`family=${r.replace(/\s+/g,"+")}:wght@300;400;500;600;700`).join("&")}&display=swap" rel="stylesheet">`].join(`
|
|
108
|
+
`):""};export{me as getAccumulatedEmotionCSS,pt as render,pe as renderElement,ye as renderPage,he as renderRoute,ge as replaceEmotionCSS,de as resetGlobalCSSCache};
|
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/packageEntry.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { resolve } from 'path'
|
|
4
|
+
import { existsSync } from 'fs'
|
|
5
|
+
|
|
6
|
+
// Helper to find a package's PUBLIC entry: root `index.js`, then `src/index.js`.
|
|
7
|
+
//
|
|
8
|
+
// Root-index FIRST, and the order is load-bearing. A package's root
|
|
9
|
+
// `index.js` is its public entry; `src/index.js` is an internal module this
|
|
10
|
+
// resolver only reaches for because a monorepo `dist/` may be stale or
|
|
11
|
+
// absent. For every @symbo.ls package the root index is exactly
|
|
12
|
+
// `export * from './src/index.js'`, so either order resolves the same
|
|
13
|
+
// module — but `smbls`'s root `index.js` is the UMBRELLA, re-exporting
|
|
14
|
+
// @symbo.ls/signal, /css, /scratch, /default-config and more ON TOP of
|
|
15
|
+
// `./src/index.js`. Preferring `src/index.js` therefore dropped every
|
|
16
|
+
// umbrella re-export from the SSR bundle, and esbuild failed the whole
|
|
17
|
+
// build with `No matching export in "packages/smbls/src/index.js" for
|
|
18
|
+
// import "createEffect"` — raised by plugins/dropdown and plugins/windows,
|
|
19
|
+
// which import `createEffect` through the umbrella deliberately (a second
|
|
20
|
+
// `@symbo.ls/signal` instance silently breaks every subscription; see the
|
|
21
|
+
// comment above their imports). `src/index.js` stays the fallback for a
|
|
22
|
+
// package that ships no root index. Locked by
|
|
23
|
+
// __tests__/packageEntryResolution.test.js (+ brenderStubDistFreshness.test.js end-to-end).
|
|
24
|
+
export const resolvePackageEntry = (base) => {
|
|
25
|
+
if (!base) return null
|
|
26
|
+
const idx = resolve(base, 'index.js')
|
|
27
|
+
if (existsSync(idx)) return idx
|
|
28
|
+
const src = resolve(base, 'src', 'index.js')
|
|
29
|
+
if (existsSync(src)) return src
|
|
30
|
+
return null
|
|
31
|
+
}
|
package/render.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { resolve, join, dirname } from 'path'
|
|
2
2
|
import { existsSync, writeFileSync, unlinkSync, readFileSync, realpathSync } from 'fs'
|
|
3
|
+
import { resolvePackageEntry } from './packageEntry.js'
|
|
3
4
|
import { tmpdir } from 'os'
|
|
4
5
|
import { randomBytes } from 'crypto'
|
|
5
6
|
import { createRequire } from 'module'
|
|
@@ -297,15 +298,7 @@ const bundleCreateDomql = async () => {
|
|
|
297
298
|
const esbuild = await import('esbuild')
|
|
298
299
|
const outFile = join(tmpdir(), `br_createDomql_${randomBytes(6).toString('hex')}.mjs`)
|
|
299
300
|
|
|
300
|
-
|
|
301
|
-
const tryResolve = (base) => {
|
|
302
|
-
if (!base) return null
|
|
303
|
-
const src = resolve(base, 'src', 'index.js')
|
|
304
|
-
if (existsSync(src)) return src
|
|
305
|
-
const idx = resolve(base, 'index.js')
|
|
306
|
-
if (existsSync(idx)) return idx
|
|
307
|
-
return null
|
|
308
|
-
}
|
|
301
|
+
const tryResolve = resolvePackageEntry
|
|
309
302
|
|
|
310
303
|
const workspacePlugin = {
|
|
311
304
|
name: 'workspace-resolve',
|
|
@@ -463,7 +456,7 @@ const bundleCreateDomql = async () => {
|
|
|
463
456
|
// We set globalThis.document/location before import to make it SSR-safe
|
|
464
457
|
// Stub loader for brender-stub namespace (used for @symbo.ls/sync etc.)
|
|
465
458
|
build.onLoad({ filter: /.*/, namespace: 'brender-stub' }, () => {
|
|
466
|
-
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' }
|
|
467
460
|
})
|
|
468
461
|
// Fix router.js: break circular import of Link from smbls
|
|
469
462
|
build.onLoad({ filter: /smbls\/src\/router\.js$/ }, async (args) => {
|