@webtypen/webframez-react 0.0.42 → 0.0.44
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/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/http.cjs +17 -5
- package/dist/http.js +17 -5
- package/dist/index.cjs +17 -5
- package/dist/index.js +17 -5
- package/dist/route-slot.cjs +4 -0
- package/dist/route-slot.js +4 -0
- package/dist/router.cjs +17 -5
- package/dist/router.js +17 -5
- package/dist/webframez-core.cjs +17 -5
- package/dist/webframez-core.js +17 -5
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var de=Object.create;var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of le(t))!me.call(e,r)&&r!==n&&y(e,r,{get:()=>t[r],enumerable:!(o=ue(t,r))||o.enumerable});return e};var H=(e,t,n)=>(n=e!=null?de(fe(e)):{},k(t||!e||!e.__esModule?y(n,"default",{value:e,enumerable:!0}):n,e)),Re=e=>k(y({},"__esModule",{value:!0}),e);var ze={};pe(ze,{mountWebframezClient:()=>He,useCookie:()=>ve,useRouter:()=>xe});module.exports=Re(ze);var s=H(require("react"),1),V=require("react-dom/client"),_=require("react-server-dom-webpack/client"),X=require("@webtypen/webframez-react/route-slot");var _e=/^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;function u(e){if(typeof e!="string")return;let t=e.trim();return!t||t==="/"?"":t.replace(/\/+$/,"")}function z(e,t){let n=e.trim(),o=u(t);return!n||!o||_e.test(n)||n.startsWith("/")||o!=="/"&&(n===o||n.startsWith(`${o}/`))?n:o==="/"?n.startsWith("/")?n:`/${n}`:n.startsWith("/")?`${o}${n}`:`${o}/${n}`}function P(e,t){if(!e)return;let n=u(e.basename)??u(t),o=u(e.routeBasePath),r=u(e.transportBasePath),a={...e,...n!==void 0?{basename:n}:{},...o!==void 0?{routeBasePath:o}:{},...r!==void 0?{transportBasePath:r}:{}};return a.favicon&&(a.favicon=z(a.favicon,n)),a.links&&(a.links=a.links.map(c=>({...c,href:z(c.href,n)}))),a}var p=H(require("react"),1),W="webframez-route-children",F="__webframezRouteChildren",j="WebframezRouteChildren",we="__webframezRouteChildrenSlot",he="WebframezRouteChildrenSlot",N=()=>p.default.createElement(W);N.displayName=j;N[F]=!0;var ge=N;function D(e){if(e===W||e===ge)return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{let t=e;return t[F]===!0||t.displayName===j||t.name==="RouteChildren"}catch{return!1}}function M(e){if(!e||typeof e!="function"&&typeof e!="object")return!1;try{let t=e;return t[we]===!0||t.displayName===he||t.name==="RouteChildrenSlot"}catch{return!1}}function $(e){if(!e||typeof e!="object")return!1;try{return"type"in e&&"props"in e}catch{return!1}}function T(e,t){if(e==null||typeof e=="boolean")return e;if(Array.isArray(e)){let l=!1,w=e.map(m=>{let h=T(m,t);return h!==m&&(l=!0),h});return l?w:e}if($(e)&&(D(e.type)||M(e.type)))return t;let n=p.default.isValidElement(e);if(!n&&!$(e))return e;if(n&&(D(e.type)||M(e.type)))return t;let o=e.props??{};if(!("children"in o))return e;let r=T(o.children,t);if(r===o.children)return e;if(n)return Array.isArray(r)?p.default.cloneElement(e,void 0,...r):p.default.cloneElement(e,void 0,r);let a=e,c={...a.props??{},children:r,...a.key!==void 0&&a.key!==null?{key:a.key}:{}};return p.default.createElement(a.type,c)}var d=require("react/jsx-runtime"),Ce={push:()=>{},replace:()=>{},refresh:()=>{},refreshContext:()=>{}},A=typeof s.default.createContext=="function"?s.default.createContext(null):null,J="__WEBFRAMEZ_ROUTER__",Ee="__WEBFRAMEZ_REACT_BUILD_ID",ye="x-webframez-react-build",Te="[data-webframez-head='true']";function G(){if(typeof window>"u"||typeof document>"u")return;let e=()=>{window.scrollTo({top:0,left:0}),document.scrollingElement&&(document.scrollingElement.scrollTop=0),document.documentElement.scrollTop=0,document.body&&(document.body.scrollTop=0)};if(typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(e);return}window.setTimeout(e,0)}function v(e){return u(e)??""}function Ae(e,t){return t?e===t?"/":e.startsWith(`${t}/`)?e.slice(t.length)||"/":e||"/":e||"/"}function Q(e,t){let n=!t||t==="/"?"/":t.startsWith("/")?t:`/${t}`;return e?n==="/"?e:`${e}${n}`:n}function Se(){return v(typeof window>"u"?globalThis.__RSC_ROUTE_BASE_PATH:window.__RSC_ROUTE_BASE_PATH)}function ee(e){if(typeof window>"u")return e||"/";let t=v(window.__RSC_BASENAME),n=Se(),o=Ae(e||"/",t);return Q(n,o)}function te(e){if(typeof window>"u")return e;let t=window.__RSC_ENDPOINT;return typeof t=="string"&&t.trim()!==""?t:e}function Pe(){if(typeof window>"u")return"";let e=window[Ee];return typeof e=="string"?e:""}function Ne(e){let t=Pe();return!!t&&!!e&&t!==e}function I(e){typeof window>"u"||window.location.assign(`${e.pathname}${e.search}${e.hash}`)}function Ie(){return typeof window>"u"?null:window[J]??null}function Le(e){typeof window>"u"||(window[J]=e)}function q(){let e={},t=typeof document>"u"?"":document.cookie;if(!t||t.trim()==="")return e;for(let n of t.split(";")){let o=n.trim();if(!o)continue;let r=o.indexOf("="),a=r>=0?o.slice(0,r).trim():o,c=r>=0?o.slice(r+1):"";a&&(e[a]=decodeURIComponent(c))}return e}function Y(e,t,n={}){let o=[`${e}=${encodeURIComponent(t)}`];return n.path&&o.push(`Path=${n.path}`),n.domain&&o.push(`Domain=${n.domain}`),typeof n.maxAge=="number"&&o.push(`Max-Age=${Math.floor(n.maxAge)}`),n.expires&&o.push(`Expires=${n.expires.toUTCString()}`),n.sameSite&&o.push(`SameSite=${n.sameSite}`),n.secure&&o.push("Secure"),o.join("; ")}function ve(){return s.default.useMemo(()=>({all:()=>q(),get:e=>q()[e],set:(e,t,n)=>{typeof document>"u"||(document.cookie=Y(e,t,n))},remove:(e,t)=>{typeof document>"u"||(document.cookie=Y(e,"",{...t??{},maxAge:0}))}}),[])}function xe(){let e=A?s.default.useContext(A):null;if(!e){let t=Ie();if(t)return t;if(typeof window>"u")return Ce;throw new Error("useRouter must be used inside mountWebframezClient()")}return e}function be({active:e}){return(0,d.jsx)("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:3,zIndex:9999,transformOrigin:"left",transform:e?"scaleX(1)":"scaleX(0)",transition:"transform 180ms ease",background:"linear-gradient(90deg, #0ea5e9, #22c55e)"}})}function Z(e){let t=document.createElement("meta");t.setAttribute("data-webframez-head","true");let n=Object.entries(e).filter(([,o])=>!!o);for(let[o,r]of n)t.setAttribute(o,String(r));document.head.appendChild(t)}function K(e){let t=document.createElement("link");t.setAttribute("data-webframez-head","true");let n=Object.entries(e).filter(([,o])=>!!o);for(let[o,r]of n)t.setAttribute(o,String(r));document.head.appendChild(t)}function L(e){if(typeof document>"u")return;let t=P(e)??e;ne(t),document.body.className=t.bodyClassName||"",document.title=t.title||"Webframez React";for(let n of document.head.querySelectorAll(Te))n.remove();t.description&&Z({name:"description",content:t.description}),t.favicon&&K({rel:"icon",href:t.favicon});for(let n of t.meta??[])Z(n);for(let n of t.links??[])K(n)}function ne(e){if(typeof window>"u")return;let t=P(e)??e,n=u(t.basename),o=u(t.routeBasePath),r=u(t.transportBasePath);window.__RSC_BASENAME=n??"",window.__RSC_ROUTE_BASE_PATH=o??"",r!==void 0&&(window.__RSC_ENDPOINT=Q(r,"/rsc"))}function Be(e){let t=new TextEncoder;return new ReadableStream({start(n){n.enqueue(t.encode(e)),n.close()}})}function Oe(){if(typeof window>"u")return null;let e=window.__RSC_INITIAL_PAYLOAD;return typeof e!="string"||e===""?null:(delete window.__RSC_INITIAL_PAYLOAD,(0,_.createFromReadableStream)(Be(e)))}function Ue(e){let t=te(e),n=ee(window.location.pathname);return Oe()??(0,_.createFromFetch)(fetch(`${t}?path=${encodeURIComponent(n)}&search=${encodeURIComponent(window.location.search)}`,{cache:"no-store",credentials:"same-origin",headers:{Accept:"text/x-component"}}))}function ke(e,t){return function(){let o=s.default.use(e),r=typeof o.contextModel<"u"&&typeof o.pageModel<"u",[a,c]=(0,s.useState)(o.model),[l,w]=(0,s.useState)(o.contextModel),[m,h]=(0,s.useState)(o.pageModel),[x,b]=(0,s.useState)(o.head),[oe,g]=(0,s.useState)(!1),[re,ie]=(0,s.useState)(!1),[ae,S]=(0,s.useState)(r);async function B(i){let E=te(t),f=ee(i.pathname),R=await fetch(`${E}?path=${encodeURIComponent(f)}&search=${encodeURIComponent(i.search)}`,{cache:"no-store",credentials:"same-origin",headers:{Accept:"text/x-component"}});return Ne(R.headers.get(ye))?(I(i),await new Promise(()=>{})):await(0,_.createFromFetch)(Promise.resolve(R))}async function C(i,E="push"){g(!0);try{let f=await B(i);L(f.head),b(f.head),c(f.model),w(f.contextModel),h(f.pageModel),S(!0);let R=`${i.pathname}${i.search}${i.hash}`;E==="replace"?(history.replaceState(null,"",R),G()):E==="push"&&(history.pushState(null,"",R),G())}catch(f){console.error("[webframez-react] Failed to render route",f),I(i),c((0,d.jsx)("p",{children:"Failed to load route."}))}finally{g(!1)}}async function se(){g(!0);try{let i=await B(new URL(window.location.href));if(L(i.head),b(i.head),Object.prototype.hasOwnProperty.call(i,"contextModel")){w(i.contextModel),S(!0);return}c(i.model),S(!1)}catch(i){console.error("[webframez-react] Failed to refresh route context",i),I(new URL(window.location.href))}finally{g(!1)}}(0,s.useEffect)(()=>{L(x)},[x]),(0,s.useEffect)(()=>{ie(!0);let i=()=>{C(new URL(window.location.href),"none")};return window.addEventListener("popstate",i),()=>{window.removeEventListener("popstate",i)}},[]);let O=s.default.useMemo(()=>({push:i=>{C(new URL(i,window.location.origin),"push")},replace:i=>{C(new URL(i,window.location.origin),"replace")},refresh:()=>{C(new URL(window.location.href),"none")},refreshContext:()=>{se()}}),[]);Le(O);let ce=ae&&typeof m<"u"?l?(0,d.jsx)(X.RouteChildrenSlotProvider,{page:m,children:T(l,m)}):m:a,U=(0,d.jsxs)(d.Fragment,{children:[re?(0,d.jsx)(be,{active:oe}):null,ce??(0,d.jsx)("p",{style:{padding:24},children:"Loading..."})]});return A?(0,d.jsx)(A.Provider,{value:O,children:U}):U}}function He(e={}){let t=e.rootId??"root",n=document.getElementById(t);if(!n)throw new Error(`Missing #${t} element`);let o=typeof window<"u"&&window.__RSC_ENDPOINT,r=e.rscEndpoint??o??"/rsc",a=Promise.resolve(Ue(r)).then(l=>(l?.head&&ne(l.head),l)),c=ke(a,r);return(0,V.hydrateRoot)(n,(0,d.jsx)(c,{}))}
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import p,{useEffect as W,useState as f}from"react";import{hydrateRoot as ue}from"react-dom/client";import{createFromFetch as Z,createFromReadableStream as le}from"react-server-dom-webpack/client";import{RouteChildrenSlotProvider as fe}from"@webtypen/webframez-react/route-slot";var ae=/^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;function c(e){if(typeof e!="string")return;let t=e.trim();return!t||t==="/"?"":t.replace(/\/+$/,"")}function U(e,t){let n=e.trim(),o=c(t);return!n||!o||ae.test(n)||n.startsWith("/")||o!=="/"&&(n===o||n.startsWith(`${o}/`))?n:o==="/"?n.startsWith("/")?n:`/${n}`:n.startsWith("/")?`${o}${n}`:`${o}/${n}`}function S(e,t){if(!e)return;let n=c(e.basename)??c(t),o=c(e.routeBasePath),r=c(e.transportBasePath),a={...e,...n!==void 0?{basename:n}:{},...o!==void 0?{routeBasePath:o}:{},...r!==void 0?{transportBasePath:r}:{}};return a.favicon&&(a.favicon=U(a.favicon,n)),a.links&&(a.links=a.links.map(s=>({...s,href:U(s.href,n)}))),a}import _ from"react";var D="webframez-route-children",M="__webframezRouteChildren",$="WebframezRouteChildren",se="__webframezRouteChildrenSlot",ce="WebframezRouteChildrenSlot",P=()=>_.createElement(D);P.displayName=$;P[M]=!0;var de=P;function k(e){if(e===D||e===de)return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{let t=e;return t[M]===!0||t.displayName===$||t.name==="RouteChildren"}catch{return!1}}function H(e){if(!e||typeof e!="function"&&typeof e!="object")return!1;try{let t=e;return t[se]===!0||t.displayName===ce||t.name==="RouteChildrenSlot"}catch{return!1}}function z(e){if(!e||typeof e!="object")return!1;try{return"type"in e&&"props"in e}catch{return!1}}function y(e,t){if(e==null||typeof e=="boolean")return e;if(Array.isArray(e)){let d=!1,w=e.map(l=>{let h=y(l,t);return h!==l&&(d=!0),h});return d?w:e}if(z(e)&&(k(e.type)||H(e.type)))return t;let n=_.isValidElement(e);if(!n&&!z(e))return e;if(n&&(k(e.type)||H(e.type)))return t;let o=e.props??{};if(!("children"in o))return e;let r=y(o.children,t);if(r===o.children)return e;if(n)return Array.isArray(r)?_.cloneElement(e,void 0,...r):_.cloneElement(e,void 0,r);let a=e,s={...a.props??{},children:r,...a.key!==void 0&&a.key!==null?{key:a.key}:{}};return _.createElement(a.type,s)}import{Fragment as Ie,jsx as m,jsxs as Le}from"react/jsx-runtime";var me={push:()=>{},replace:()=>{},refresh:()=>{},refreshContext:()=>{}},T=typeof p.createContext=="function"?p.createContext(null):null,K="__WEBFRAMEZ_ROUTER__",pe="__WEBFRAMEZ_REACT_BUILD_ID",Re="x-webframez-react-build",_e="[data-webframez-head='true']";function F(){if(typeof window>"u"||typeof document>"u")return;let e=()=>{window.scrollTo({top:0,left:0}),document.scrollingElement&&(document.scrollingElement.scrollTop=0),document.documentElement.scrollTop=0,document.body&&(document.body.scrollTop=0)};if(typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(e);return}window.setTimeout(e,0)}function L(e){return c(e)??""}function we(e,t){return t?e===t?"/":e.startsWith(`${t}/`)?e.slice(t.length)||"/":e||"/":e||"/"}function V(e,t){let n=!t||t==="/"?"/":t.startsWith("/")?t:`/${t}`;return e?n==="/"?e:`${e}${n}`:n}function he(){return L(typeof window>"u"?globalThis.__RSC_ROUTE_BASE_PATH:window.__RSC_ROUTE_BASE_PATH)}function X(e){if(typeof window>"u")return e||"/";let t=L(window.__RSC_BASENAME),n=he(),o=we(e||"/",t);return V(n,o)}function J(e){if(typeof window>"u")return e;let t=window.__RSC_ENDPOINT;return typeof t=="string"&&t.trim()!==""?t:e}function ge(){if(typeof window>"u")return"";let e=window[pe];return typeof e=="string"?e:""}function Ce(e){let t=ge();return!!t&&!!e&&t!==e}function N(e){typeof window>"u"||window.location.assign(`${e.pathname}${e.search}${e.hash}`)}function Ee(){return typeof window>"u"?null:window[K]??null}function ye(e){typeof window>"u"||(window[K]=e)}function j(){let e={},t=typeof document>"u"?"":document.cookie;if(!t||t.trim()==="")return e;for(let n of t.split(";")){let o=n.trim();if(!o)continue;let r=o.indexOf("="),a=r>=0?o.slice(0,r).trim():o,s=r>=0?o.slice(r+1):"";a&&(e[a]=decodeURIComponent(s))}return e}function G(e,t,n={}){let o=[`${e}=${encodeURIComponent(t)}`];return n.path&&o.push(`Path=${n.path}`),n.domain&&o.push(`Domain=${n.domain}`),typeof n.maxAge=="number"&&o.push(`Max-Age=${Math.floor(n.maxAge)}`),n.expires&&o.push(`Expires=${n.expires.toUTCString()}`),n.sameSite&&o.push(`SameSite=${n.sameSite}`),n.secure&&o.push("Secure"),o.join("; ")}function Me(){return p.useMemo(()=>({all:()=>j(),get:e=>j()[e],set:(e,t,n)=>{typeof document>"u"||(document.cookie=G(e,t,n))},remove:(e,t)=>{typeof document>"u"||(document.cookie=G(e,"",{...t??{},maxAge:0}))}}),[])}function $e(){let e=T?p.useContext(T):null;if(!e){let t=Ee();if(t)return t;if(typeof window>"u")return me;throw new Error("useRouter must be used inside mountWebframezClient()")}return e}function Te({active:e}){return m("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:3,zIndex:9999,transformOrigin:"left",transform:e?"scaleX(1)":"scaleX(0)",transition:"transform 180ms ease",background:"linear-gradient(90deg, #0ea5e9, #22c55e)"}})}function q(e){let t=document.createElement("meta");t.setAttribute("data-webframez-head","true");let n=Object.entries(e).filter(([,o])=>!!o);for(let[o,r]of n)t.setAttribute(o,String(r));document.head.appendChild(t)}function Y(e){let t=document.createElement("link");t.setAttribute("data-webframez-head","true");let n=Object.entries(e).filter(([,o])=>!!o);for(let[o,r]of n)t.setAttribute(o,String(r));document.head.appendChild(t)}function I(e){if(typeof document>"u")return;let t=S(e)??e;Q(t),document.body.className=t.bodyClassName||"",document.title=t.title||"Webframez React";for(let n of document.head.querySelectorAll(_e))n.remove();t.description&&q({name:"description",content:t.description}),t.favicon&&Y({rel:"icon",href:t.favicon});for(let n of t.meta??[])q(n);for(let n of t.links??[])Y(n)}function Q(e){if(typeof window>"u")return;let t=S(e)??e,n=c(t.basename),o=c(t.routeBasePath),r=c(t.transportBasePath);window.__RSC_BASENAME=n??"",window.__RSC_ROUTE_BASE_PATH=o??"",r!==void 0&&(window.__RSC_ENDPOINT=V(r,"/rsc"))}function Ae(e){let t=new TextEncoder;return new ReadableStream({start(n){n.enqueue(t.encode(e)),n.close()}})}function Se(){if(typeof window>"u")return null;let e=window.__RSC_INITIAL_PAYLOAD;return typeof e!="string"||e===""?null:(delete window.__RSC_INITIAL_PAYLOAD,le(Ae(e)))}function Pe(e){let t=J(e),n=X(window.location.pathname);return Se()??Z(fetch(`${t}?path=${encodeURIComponent(n)}&search=${encodeURIComponent(window.location.search)}`,{cache:"no-store",credentials:"same-origin",headers:{Accept:"text/x-component"}}))}function Ne(e,t){return function(){let o=p.use(e),r=typeof o.contextModel<"u"&&typeof o.pageModel<"u",[a,s]=f(o.model),[d,w]=f(o.contextModel),[l,h]=f(o.pageModel),[v,x]=f(o.head),[ee,g]=f(!1),[te,ne]=f(!1),[oe,A]=f(r);async function b(i){let E=J(t),u=X(i.pathname),R=await fetch(`${E}?path=${encodeURIComponent(u)}&search=${encodeURIComponent(i.search)}`,{cache:"no-store",credentials:"same-origin",headers:{Accept:"text/x-component"}});return Ce(R.headers.get(Re))?(N(i),await new Promise(()=>{})):await Z(Promise.resolve(R))}async function C(i,E="push"){g(!0);try{let u=await b(i);I(u.head),x(u.head),s(u.model),w(u.contextModel),h(u.pageModel),A(!0);let R=`${i.pathname}${i.search}${i.hash}`;E==="replace"?(history.replaceState(null,"",R),F()):E==="push"&&(history.pushState(null,"",R),F())}catch(u){console.error("[webframez-react] Failed to render route",u),N(i),s(m("p",{children:"Failed to load route."}))}finally{g(!1)}}async function re(){g(!0);try{let i=await b(new URL(window.location.href));if(I(i.head),x(i.head),Object.prototype.hasOwnProperty.call(i,"contextModel")){w(i.contextModel),A(!0);return}s(i.model),A(!1)}catch(i){console.error("[webframez-react] Failed to refresh route context",i),N(new URL(window.location.href))}finally{g(!1)}}W(()=>{I(v)},[v]),W(()=>{ne(!0);let i=()=>{C(new URL(window.location.href),"none")};return window.addEventListener("popstate",i),()=>{window.removeEventListener("popstate",i)}},[]);let B=p.useMemo(()=>({push:i=>{C(new URL(i,window.location.origin),"push")},replace:i=>{C(new URL(i,window.location.origin),"replace")},refresh:()=>{C(new URL(window.location.href),"none")},refreshContext:()=>{re()}}),[]);ye(B);let ie=oe&&typeof l<"u"?d?m(fe,{page:l,children:y(d,l)}):l:a,O=Le(Ie,{children:[te?m(Te,{active:ee}):null,ie??m("p",{style:{padding:24},children:"Loading..."})]});return T?m(T.Provider,{value:B,children:O}):O}}function We(e={}){let t=e.rootId??"root",n=document.getElementById(t);if(!n)throw new Error(`Missing #${t} element`);let o=typeof window<"u"&&window.__RSC_ENDPOINT,r=e.rscEndpoint??o??"/rsc",a=Promise.resolve(Pe(r)).then(d=>(d?.head&&Q(d.head),d)),s=Ne(a,r);return ue(n,m(s,{}))}export{We as mountWebframezClient,Me as useCookie,$e as useRouter};
|
package/dist/http.cjs
CHANGED
|
@@ -156,7 +156,6 @@ function sendRSC(res, model, options = {}) {
|
|
|
156
156
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
157
157
|
var import_node_module2 = __toESM(require("node:module"), 1);
|
|
158
158
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
159
|
-
var import_route_slot = require("@webtypen/webframez-react/route-slot");
|
|
160
159
|
|
|
161
160
|
// src/head.ts
|
|
162
161
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -228,6 +227,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
228
227
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
229
228
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
230
229
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
230
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
231
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
231
232
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
232
233
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
233
234
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -246,6 +247,17 @@ function isRouteChildrenType(type) {
|
|
|
246
247
|
return false;
|
|
247
248
|
}
|
|
248
249
|
}
|
|
250
|
+
function isRouteChildrenSlotType(type) {
|
|
251
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
const candidate = type;
|
|
256
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
257
|
+
} catch {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
249
261
|
function isReactElementLike(node) {
|
|
250
262
|
if (!node || typeof node !== "object") {
|
|
251
263
|
return false;
|
|
@@ -271,14 +283,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
271
283
|
});
|
|
272
284
|
return changed ? next : node;
|
|
273
285
|
}
|
|
274
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
286
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
275
287
|
return routeChildren;
|
|
276
288
|
}
|
|
277
289
|
const isValidElement = import_react.default.isValidElement(node);
|
|
278
290
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
279
291
|
return node;
|
|
280
292
|
}
|
|
281
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
293
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
282
294
|
return routeChildren;
|
|
283
295
|
}
|
|
284
296
|
const props = node.props ?? {};
|
|
@@ -646,7 +658,7 @@ function createFileRouter(options) {
|
|
|
646
658
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
647
659
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
648
660
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
649
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
661
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
650
662
|
return {
|
|
651
663
|
statusCode,
|
|
652
664
|
model,
|
|
@@ -772,7 +784,7 @@ function createFileRouter(options) {
|
|
|
772
784
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
773
785
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
774
786
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
775
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
787
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
776
788
|
return {
|
|
777
789
|
statusCode: 200,
|
|
778
790
|
model,
|
package/dist/http.js
CHANGED
|
@@ -136,7 +136,6 @@ function sendRSC(res, model, options = {}) {
|
|
|
136
136
|
import fs from "node:fs";
|
|
137
137
|
import Module from "node:module";
|
|
138
138
|
import path2 from "node:path";
|
|
139
|
-
import { RouteChildrenSlot } from "@webtypen/webframez-react/route-slot";
|
|
140
139
|
|
|
141
140
|
// src/head.ts
|
|
142
141
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -208,6 +207,8 @@ import React from "react";
|
|
|
208
207
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
209
208
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
210
209
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
210
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
211
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
211
212
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
212
213
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
213
214
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -226,6 +227,17 @@ function isRouteChildrenType(type) {
|
|
|
226
227
|
return false;
|
|
227
228
|
}
|
|
228
229
|
}
|
|
230
|
+
function isRouteChildrenSlotType(type) {
|
|
231
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
try {
|
|
235
|
+
const candidate = type;
|
|
236
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
237
|
+
} catch {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
229
241
|
function isReactElementLike(node) {
|
|
230
242
|
if (!node || typeof node !== "object") {
|
|
231
243
|
return false;
|
|
@@ -251,14 +263,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
251
263
|
});
|
|
252
264
|
return changed ? next : node;
|
|
253
265
|
}
|
|
254
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
266
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
255
267
|
return routeChildren;
|
|
256
268
|
}
|
|
257
269
|
const isValidElement = React.isValidElement(node);
|
|
258
270
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
259
271
|
return node;
|
|
260
272
|
}
|
|
261
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
273
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
262
274
|
return routeChildren;
|
|
263
275
|
}
|
|
264
276
|
const props = node.props ?? {};
|
|
@@ -626,7 +638,7 @@ function createFileRouter(options) {
|
|
|
626
638
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
627
639
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
628
640
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
629
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
641
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
630
642
|
return {
|
|
631
643
|
statusCode,
|
|
632
644
|
model,
|
|
@@ -752,7 +764,7 @@ function createFileRouter(options) {
|
|
|
752
764
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
753
765
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
754
766
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
755
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
767
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
756
768
|
return {
|
|
757
769
|
statusCode: 200,
|
|
758
770
|
model,
|
package/dist/index.cjs
CHANGED
|
@@ -191,7 +191,6 @@ function createRSCHandler(options) {
|
|
|
191
191
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
192
192
|
var import_node_module2 = __toESM(require("node:module"), 1);
|
|
193
193
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
194
|
-
var import_route_slot = require("@webtypen/webframez-react/route-slot");
|
|
195
194
|
|
|
196
195
|
// src/head.ts
|
|
197
196
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -263,6 +262,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
263
262
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
264
263
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
265
264
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
265
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
266
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
266
267
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
267
268
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
268
269
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -281,6 +282,17 @@ function isRouteChildrenType(type) {
|
|
|
281
282
|
return false;
|
|
282
283
|
}
|
|
283
284
|
}
|
|
285
|
+
function isRouteChildrenSlotType(type) {
|
|
286
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
const candidate = type;
|
|
291
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
292
|
+
} catch {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
284
296
|
function isReactElementLike(node) {
|
|
285
297
|
if (!node || typeof node !== "object") {
|
|
286
298
|
return false;
|
|
@@ -306,14 +318,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
306
318
|
});
|
|
307
319
|
return changed ? next : node;
|
|
308
320
|
}
|
|
309
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
321
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
310
322
|
return routeChildren;
|
|
311
323
|
}
|
|
312
324
|
const isValidElement = import_react.default.isValidElement(node);
|
|
313
325
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
314
326
|
return node;
|
|
315
327
|
}
|
|
316
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
328
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
317
329
|
return routeChildren;
|
|
318
330
|
}
|
|
319
331
|
const props = node.props ?? {};
|
|
@@ -681,7 +693,7 @@ function createFileRouter(options) {
|
|
|
681
693
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
682
694
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
683
695
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
684
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
696
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
685
697
|
return {
|
|
686
698
|
statusCode,
|
|
687
699
|
model,
|
|
@@ -807,7 +819,7 @@ function createFileRouter(options) {
|
|
|
807
819
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
808
820
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
809
821
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
810
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
822
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
811
823
|
return {
|
|
812
824
|
statusCode: 200,
|
|
813
825
|
model,
|
package/dist/index.js
CHANGED
|
@@ -152,7 +152,6 @@ function createRSCHandler(options) {
|
|
|
152
152
|
import fs from "node:fs";
|
|
153
153
|
import Module from "node:module";
|
|
154
154
|
import path2 from "node:path";
|
|
155
|
-
import { RouteChildrenSlot } from "@webtypen/webframez-react/route-slot";
|
|
156
155
|
|
|
157
156
|
// src/head.ts
|
|
158
157
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -224,6 +223,8 @@ import React from "react";
|
|
|
224
223
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
225
224
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
226
225
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
226
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
227
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
227
228
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
228
229
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
229
230
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -242,6 +243,17 @@ function isRouteChildrenType(type) {
|
|
|
242
243
|
return false;
|
|
243
244
|
}
|
|
244
245
|
}
|
|
246
|
+
function isRouteChildrenSlotType(type) {
|
|
247
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
try {
|
|
251
|
+
const candidate = type;
|
|
252
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
253
|
+
} catch {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
245
257
|
function isReactElementLike(node) {
|
|
246
258
|
if (!node || typeof node !== "object") {
|
|
247
259
|
return false;
|
|
@@ -267,14 +279,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
267
279
|
});
|
|
268
280
|
return changed ? next : node;
|
|
269
281
|
}
|
|
270
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
282
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
271
283
|
return routeChildren;
|
|
272
284
|
}
|
|
273
285
|
const isValidElement = React.isValidElement(node);
|
|
274
286
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
275
287
|
return node;
|
|
276
288
|
}
|
|
277
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
289
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
278
290
|
return routeChildren;
|
|
279
291
|
}
|
|
280
292
|
const props = node.props ?? {};
|
|
@@ -642,7 +654,7 @@ function createFileRouter(options) {
|
|
|
642
654
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
643
655
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
644
656
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
645
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
657
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
646
658
|
return {
|
|
647
659
|
statusCode,
|
|
648
660
|
model,
|
|
@@ -768,7 +780,7 @@ function createFileRouter(options) {
|
|
|
768
780
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
769
781
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
770
782
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
771
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
783
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
772
784
|
return {
|
|
773
785
|
statusCode: 200,
|
|
774
786
|
model,
|
package/dist/route-slot.cjs
CHANGED
|
@@ -36,6 +36,8 @@ __export(route_slot_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(route_slot_exports);
|
|
37
37
|
var import_react = __toESM(require("react"), 1);
|
|
38
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
40
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
39
41
|
var RouteChildrenSlotContext = import_react.default.createContext(null);
|
|
40
42
|
function RouteChildrenSlotProvider({
|
|
41
43
|
children,
|
|
@@ -46,6 +48,8 @@ function RouteChildrenSlotProvider({
|
|
|
46
48
|
function RouteChildrenSlot() {
|
|
47
49
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: import_react.default.useContext(RouteChildrenSlotContext) });
|
|
48
50
|
}
|
|
51
|
+
RouteChildrenSlot.displayName = ROUTE_CHILDREN_SLOT_DISPLAY_NAME;
|
|
52
|
+
RouteChildrenSlot[ROUTE_CHILDREN_SLOT_SENTINEL] = true;
|
|
49
53
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50
54
|
0 && (module.exports = {
|
|
51
55
|
RouteChildrenSlot,
|
package/dist/route-slot.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// src/route-slot.tsx
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
7
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
6
8
|
var RouteChildrenSlotContext = React.createContext(null);
|
|
7
9
|
function RouteChildrenSlotProvider({
|
|
8
10
|
children,
|
|
@@ -13,6 +15,8 @@ function RouteChildrenSlotProvider({
|
|
|
13
15
|
function RouteChildrenSlot() {
|
|
14
16
|
return /* @__PURE__ */ jsx(Fragment, { children: React.useContext(RouteChildrenSlotContext) });
|
|
15
17
|
}
|
|
18
|
+
RouteChildrenSlot.displayName = ROUTE_CHILDREN_SLOT_DISPLAY_NAME;
|
|
19
|
+
RouteChildrenSlot[ROUTE_CHILDREN_SLOT_SENTINEL] = true;
|
|
16
20
|
export {
|
|
17
21
|
RouteChildrenSlot,
|
|
18
22
|
RouteChildrenSlotProvider
|
package/dist/router.cjs
CHANGED
|
@@ -40,7 +40,6 @@ module.exports = __toCommonJS(router_exports);
|
|
|
40
40
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
41
41
|
var import_node_module = __toESM(require("node:module"), 1);
|
|
42
42
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
43
|
-
var import_route_slot = require("@webtypen/webframez-react/route-slot");
|
|
44
43
|
|
|
45
44
|
// src/head.ts
|
|
46
45
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -112,6 +111,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
112
111
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
113
112
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
114
113
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
114
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
115
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
115
116
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
116
117
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
117
118
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -130,6 +131,17 @@ function isRouteChildrenType(type) {
|
|
|
130
131
|
return false;
|
|
131
132
|
}
|
|
132
133
|
}
|
|
134
|
+
function isRouteChildrenSlotType(type) {
|
|
135
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const candidate = type;
|
|
140
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
141
|
+
} catch {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
133
145
|
function isReactElementLike(node) {
|
|
134
146
|
if (!node || typeof node !== "object") {
|
|
135
147
|
return false;
|
|
@@ -155,14 +167,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
155
167
|
});
|
|
156
168
|
return changed ? next : node;
|
|
157
169
|
}
|
|
158
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
170
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
159
171
|
return routeChildren;
|
|
160
172
|
}
|
|
161
173
|
const isValidElement = import_react.default.isValidElement(node);
|
|
162
174
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
163
175
|
return node;
|
|
164
176
|
}
|
|
165
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
177
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
166
178
|
return routeChildren;
|
|
167
179
|
}
|
|
168
180
|
const props = node.props ?? {};
|
|
@@ -530,7 +542,7 @@ function createFileRouter(options) {
|
|
|
530
542
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
531
543
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
532
544
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
533
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
545
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
534
546
|
return {
|
|
535
547
|
statusCode,
|
|
536
548
|
model,
|
|
@@ -656,7 +668,7 @@ function createFileRouter(options) {
|
|
|
656
668
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
657
669
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
658
670
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
659
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
671
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
660
672
|
return {
|
|
661
673
|
statusCode: 200,
|
|
662
674
|
model,
|
package/dist/router.js
CHANGED
|
@@ -10,7 +10,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
10
10
|
import fs from "node:fs";
|
|
11
11
|
import Module from "node:module";
|
|
12
12
|
import path from "node:path";
|
|
13
|
-
import { RouteChildrenSlot } from "@webtypen/webframez-react/route-slot";
|
|
14
13
|
|
|
15
14
|
// src/head.ts
|
|
16
15
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -82,6 +81,8 @@ import React from "react";
|
|
|
82
81
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
83
82
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
84
83
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
84
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
85
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
85
86
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
86
87
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
87
88
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -100,6 +101,17 @@ function isRouteChildrenType(type) {
|
|
|
100
101
|
return false;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
104
|
+
function isRouteChildrenSlotType(type) {
|
|
105
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const candidate = type;
|
|
110
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
111
|
+
} catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
103
115
|
function isReactElementLike(node) {
|
|
104
116
|
if (!node || typeof node !== "object") {
|
|
105
117
|
return false;
|
|
@@ -125,14 +137,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
125
137
|
});
|
|
126
138
|
return changed ? next : node;
|
|
127
139
|
}
|
|
128
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
140
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
129
141
|
return routeChildren;
|
|
130
142
|
}
|
|
131
143
|
const isValidElement = React.isValidElement(node);
|
|
132
144
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
133
145
|
return node;
|
|
134
146
|
}
|
|
135
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
147
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
136
148
|
return routeChildren;
|
|
137
149
|
}
|
|
138
150
|
const props = node.props ?? {};
|
|
@@ -500,7 +512,7 @@ function createFileRouter(options) {
|
|
|
500
512
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
501
513
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
502
514
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
503
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
515
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
504
516
|
return {
|
|
505
517
|
statusCode,
|
|
506
518
|
model,
|
|
@@ -626,7 +638,7 @@ function createFileRouter(options) {
|
|
|
626
638
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
627
639
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
628
640
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
629
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
641
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
630
642
|
return {
|
|
631
643
|
statusCode: 200,
|
|
632
644
|
model,
|
package/dist/webframez-core.cjs
CHANGED
|
@@ -163,7 +163,6 @@ function sendRSC(res, model, options = {}) {
|
|
|
163
163
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
164
164
|
var import_node_module2 = __toESM(require("node:module"), 1);
|
|
165
165
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
166
|
-
var import_route_slot = require("@webtypen/webframez-react/route-slot");
|
|
167
166
|
|
|
168
167
|
// src/head.ts
|
|
169
168
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -235,6 +234,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
235
234
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
236
235
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
237
236
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
237
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
238
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
238
239
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
239
240
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
240
241
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -253,6 +254,17 @@ function isRouteChildrenType(type) {
|
|
|
253
254
|
return false;
|
|
254
255
|
}
|
|
255
256
|
}
|
|
257
|
+
function isRouteChildrenSlotType(type) {
|
|
258
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
const candidate = type;
|
|
263
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
264
|
+
} catch {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
256
268
|
function isReactElementLike(node) {
|
|
257
269
|
if (!node || typeof node !== "object") {
|
|
258
270
|
return false;
|
|
@@ -278,14 +290,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
278
290
|
});
|
|
279
291
|
return changed ? next : node;
|
|
280
292
|
}
|
|
281
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
293
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
282
294
|
return routeChildren;
|
|
283
295
|
}
|
|
284
296
|
const isValidElement = import_react.default.isValidElement(node);
|
|
285
297
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
286
298
|
return node;
|
|
287
299
|
}
|
|
288
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
300
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
289
301
|
return routeChildren;
|
|
290
302
|
}
|
|
291
303
|
const props = node.props ?? {};
|
|
@@ -653,7 +665,7 @@ function createFileRouter(options) {
|
|
|
653
665
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
654
666
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
655
667
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
656
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
668
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
657
669
|
return {
|
|
658
670
|
statusCode,
|
|
659
671
|
model,
|
|
@@ -779,7 +791,7 @@ function createFileRouter(options) {
|
|
|
779
791
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
780
792
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
781
793
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
782
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
794
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouteChildren, {})) : void 0;
|
|
783
795
|
return {
|
|
784
796
|
statusCode: 200,
|
|
785
797
|
model,
|
package/dist/webframez-core.js
CHANGED
|
@@ -139,7 +139,6 @@ function sendRSC(res, model, options = {}) {
|
|
|
139
139
|
import fs from "node:fs";
|
|
140
140
|
import Module from "node:module";
|
|
141
141
|
import path2 from "node:path";
|
|
142
|
-
import { RouteChildrenSlot } from "@webtypen/webframez-react/route-slot";
|
|
143
142
|
|
|
144
143
|
// src/head.ts
|
|
145
144
|
var ABSOLUTE_ASSET_URL_PATTERN = /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:|\/\/|#)/;
|
|
@@ -211,6 +210,8 @@ import React from "react";
|
|
|
211
210
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
212
211
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
213
212
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
213
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
214
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
214
215
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
215
216
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
216
217
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -229,6 +230,17 @@ function isRouteChildrenType(type) {
|
|
|
229
230
|
return false;
|
|
230
231
|
}
|
|
231
232
|
}
|
|
233
|
+
function isRouteChildrenSlotType(type) {
|
|
234
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
const candidate = type;
|
|
239
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
240
|
+
} catch {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
232
244
|
function isReactElementLike(node) {
|
|
233
245
|
if (!node || typeof node !== "object") {
|
|
234
246
|
return false;
|
|
@@ -254,14 +266,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
254
266
|
});
|
|
255
267
|
return changed ? next : node;
|
|
256
268
|
}
|
|
257
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
269
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
258
270
|
return routeChildren;
|
|
259
271
|
}
|
|
260
272
|
const isValidElement = React.isValidElement(node);
|
|
261
273
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
262
274
|
return node;
|
|
263
275
|
}
|
|
264
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
276
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
265
277
|
return routeChildren;
|
|
266
278
|
}
|
|
267
279
|
const props = node.props ?? {};
|
|
@@ -629,7 +641,7 @@ function createFileRouter(options) {
|
|
|
629
641
|
const errorHead = await resolveHead(errorModule, errorProps);
|
|
630
642
|
const layoutNode = layoutModule ? await layoutModule.default(context) : null;
|
|
631
643
|
const model = layoutNode ? injectRouteChildren(layoutNode, errorNode) : errorNode;
|
|
632
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
644
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
633
645
|
return {
|
|
634
646
|
statusCode,
|
|
635
647
|
model,
|
|
@@ -755,7 +767,7 @@ function createFileRouter(options) {
|
|
|
755
767
|
const pageHead = await resolveHead(pageModule, pageContext);
|
|
756
768
|
const layoutNode = layoutModule ? await layoutModule.default(pageContext) : null;
|
|
757
769
|
const model = layoutNode ? injectRouteChildren(layoutNode, pageNode) : pageNode;
|
|
758
|
-
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(
|
|
770
|
+
const contextModel = layoutNode ? injectRouteChildren(layoutNode, /* @__PURE__ */ jsx(RouteChildren, {})) : void 0;
|
|
759
771
|
return {
|
|
760
772
|
statusCode: 200,
|
|
761
773
|
model,
|