@webtypen/webframez-react 0.0.42 → 0.0.43
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 +15 -2
- package/dist/http.js +15 -2
- package/dist/index.cjs +15 -2
- package/dist/index.js +15 -2
- package/dist/route-slot.cjs +4 -0
- package/dist/route-slot.js +4 -0
- package/dist/router.cjs +15 -2
- package/dist/router.js +15 -2
- package/dist/webframez-core.cjs +15 -2
- package/dist/webframez-core.js +15 -2
- 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
|
@@ -228,6 +228,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
228
228
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
229
229
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
230
230
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
231
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
232
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
231
233
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
232
234
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
233
235
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -246,6 +248,17 @@ function isRouteChildrenType(type) {
|
|
|
246
248
|
return false;
|
|
247
249
|
}
|
|
248
250
|
}
|
|
251
|
+
function isRouteChildrenSlotType(type) {
|
|
252
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
const candidate = type;
|
|
257
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
258
|
+
} catch {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
249
262
|
function isReactElementLike(node) {
|
|
250
263
|
if (!node || typeof node !== "object") {
|
|
251
264
|
return false;
|
|
@@ -271,14 +284,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
271
284
|
});
|
|
272
285
|
return changed ? next : node;
|
|
273
286
|
}
|
|
274
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
287
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
275
288
|
return routeChildren;
|
|
276
289
|
}
|
|
277
290
|
const isValidElement = import_react.default.isValidElement(node);
|
|
278
291
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
279
292
|
return node;
|
|
280
293
|
}
|
|
281
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
294
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
282
295
|
return routeChildren;
|
|
283
296
|
}
|
|
284
297
|
const props = node.props ?? {};
|
package/dist/http.js
CHANGED
|
@@ -208,6 +208,8 @@ import React from "react";
|
|
|
208
208
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
209
209
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
210
210
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
211
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
212
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
211
213
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
212
214
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
213
215
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -226,6 +228,17 @@ function isRouteChildrenType(type) {
|
|
|
226
228
|
return false;
|
|
227
229
|
}
|
|
228
230
|
}
|
|
231
|
+
function isRouteChildrenSlotType(type) {
|
|
232
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
const candidate = type;
|
|
237
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
238
|
+
} catch {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
229
242
|
function isReactElementLike(node) {
|
|
230
243
|
if (!node || typeof node !== "object") {
|
|
231
244
|
return false;
|
|
@@ -251,14 +264,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
251
264
|
});
|
|
252
265
|
return changed ? next : node;
|
|
253
266
|
}
|
|
254
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
267
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
255
268
|
return routeChildren;
|
|
256
269
|
}
|
|
257
270
|
const isValidElement = React.isValidElement(node);
|
|
258
271
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
259
272
|
return node;
|
|
260
273
|
}
|
|
261
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
274
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
262
275
|
return routeChildren;
|
|
263
276
|
}
|
|
264
277
|
const props = node.props ?? {};
|
package/dist/index.cjs
CHANGED
|
@@ -263,6 +263,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
263
263
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
264
264
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
265
265
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
266
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
267
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
266
268
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
267
269
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
268
270
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -281,6 +283,17 @@ function isRouteChildrenType(type) {
|
|
|
281
283
|
return false;
|
|
282
284
|
}
|
|
283
285
|
}
|
|
286
|
+
function isRouteChildrenSlotType(type) {
|
|
287
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
try {
|
|
291
|
+
const candidate = type;
|
|
292
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
293
|
+
} catch {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
284
297
|
function isReactElementLike(node) {
|
|
285
298
|
if (!node || typeof node !== "object") {
|
|
286
299
|
return false;
|
|
@@ -306,14 +319,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
306
319
|
});
|
|
307
320
|
return changed ? next : node;
|
|
308
321
|
}
|
|
309
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
322
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
310
323
|
return routeChildren;
|
|
311
324
|
}
|
|
312
325
|
const isValidElement = import_react.default.isValidElement(node);
|
|
313
326
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
314
327
|
return node;
|
|
315
328
|
}
|
|
316
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
329
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
317
330
|
return routeChildren;
|
|
318
331
|
}
|
|
319
332
|
const props = node.props ?? {};
|
package/dist/index.js
CHANGED
|
@@ -224,6 +224,8 @@ import React from "react";
|
|
|
224
224
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
225
225
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
226
226
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
227
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
228
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
227
229
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
228
230
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
229
231
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -242,6 +244,17 @@ function isRouteChildrenType(type) {
|
|
|
242
244
|
return false;
|
|
243
245
|
}
|
|
244
246
|
}
|
|
247
|
+
function isRouteChildrenSlotType(type) {
|
|
248
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
const candidate = type;
|
|
253
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
254
|
+
} catch {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
245
258
|
function isReactElementLike(node) {
|
|
246
259
|
if (!node || typeof node !== "object") {
|
|
247
260
|
return false;
|
|
@@ -267,14 +280,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
267
280
|
});
|
|
268
281
|
return changed ? next : node;
|
|
269
282
|
}
|
|
270
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
283
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
271
284
|
return routeChildren;
|
|
272
285
|
}
|
|
273
286
|
const isValidElement = React.isValidElement(node);
|
|
274
287
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
275
288
|
return node;
|
|
276
289
|
}
|
|
277
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
290
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
278
291
|
return routeChildren;
|
|
279
292
|
}
|
|
280
293
|
const props = node.props ?? {};
|
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
|
@@ -112,6 +112,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
112
112
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
113
113
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
114
114
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
115
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
116
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
115
117
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
116
118
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
117
119
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -130,6 +132,17 @@ function isRouteChildrenType(type) {
|
|
|
130
132
|
return false;
|
|
131
133
|
}
|
|
132
134
|
}
|
|
135
|
+
function isRouteChildrenSlotType(type) {
|
|
136
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const candidate = type;
|
|
141
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
142
|
+
} catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
133
146
|
function isReactElementLike(node) {
|
|
134
147
|
if (!node || typeof node !== "object") {
|
|
135
148
|
return false;
|
|
@@ -155,14 +168,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
155
168
|
});
|
|
156
169
|
return changed ? next : node;
|
|
157
170
|
}
|
|
158
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
171
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
159
172
|
return routeChildren;
|
|
160
173
|
}
|
|
161
174
|
const isValidElement = import_react.default.isValidElement(node);
|
|
162
175
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
163
176
|
return node;
|
|
164
177
|
}
|
|
165
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
178
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
166
179
|
return routeChildren;
|
|
167
180
|
}
|
|
168
181
|
const props = node.props ?? {};
|
package/dist/router.js
CHANGED
|
@@ -82,6 +82,8 @@ import React from "react";
|
|
|
82
82
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
83
83
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
84
84
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
85
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
86
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
85
87
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
86
88
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
87
89
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -100,6 +102,17 @@ function isRouteChildrenType(type) {
|
|
|
100
102
|
return false;
|
|
101
103
|
}
|
|
102
104
|
}
|
|
105
|
+
function isRouteChildrenSlotType(type) {
|
|
106
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
const candidate = type;
|
|
111
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
112
|
+
} catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
103
116
|
function isReactElementLike(node) {
|
|
104
117
|
if (!node || typeof node !== "object") {
|
|
105
118
|
return false;
|
|
@@ -125,14 +138,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
125
138
|
});
|
|
126
139
|
return changed ? next : node;
|
|
127
140
|
}
|
|
128
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
141
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
129
142
|
return routeChildren;
|
|
130
143
|
}
|
|
131
144
|
const isValidElement = React.isValidElement(node);
|
|
132
145
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
133
146
|
return node;
|
|
134
147
|
}
|
|
135
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
148
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
136
149
|
return routeChildren;
|
|
137
150
|
}
|
|
138
151
|
const props = node.props ?? {};
|
package/dist/webframez-core.cjs
CHANGED
|
@@ -235,6 +235,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
235
235
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
236
236
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
237
237
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
238
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
239
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
238
240
|
var RouteChildrenImpl = () => import_react.default.createElement(ROUTE_CHILDREN_TAG);
|
|
239
241
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
240
242
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -253,6 +255,17 @@ function isRouteChildrenType(type) {
|
|
|
253
255
|
return false;
|
|
254
256
|
}
|
|
255
257
|
}
|
|
258
|
+
function isRouteChildrenSlotType(type) {
|
|
259
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
const candidate = type;
|
|
264
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
265
|
+
} catch {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
256
269
|
function isReactElementLike(node) {
|
|
257
270
|
if (!node || typeof node !== "object") {
|
|
258
271
|
return false;
|
|
@@ -278,14 +291,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
278
291
|
});
|
|
279
292
|
return changed ? next : node;
|
|
280
293
|
}
|
|
281
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
294
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
282
295
|
return routeChildren;
|
|
283
296
|
}
|
|
284
297
|
const isValidElement = import_react.default.isValidElement(node);
|
|
285
298
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
286
299
|
return node;
|
|
287
300
|
}
|
|
288
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
301
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
289
302
|
return routeChildren;
|
|
290
303
|
}
|
|
291
304
|
const props = node.props ?? {};
|
package/dist/webframez-core.js
CHANGED
|
@@ -211,6 +211,8 @@ import React from "react";
|
|
|
211
211
|
var ROUTE_CHILDREN_TAG = "webframez-route-children";
|
|
212
212
|
var ROUTE_CHILDREN_SENTINEL = "__webframezRouteChildren";
|
|
213
213
|
var ROUTE_CHILDREN_DISPLAY_NAME = "WebframezRouteChildren";
|
|
214
|
+
var ROUTE_CHILDREN_SLOT_SENTINEL = "__webframezRouteChildrenSlot";
|
|
215
|
+
var ROUTE_CHILDREN_SLOT_DISPLAY_NAME = "WebframezRouteChildrenSlot";
|
|
214
216
|
var RouteChildrenImpl = () => React.createElement(ROUTE_CHILDREN_TAG);
|
|
215
217
|
RouteChildrenImpl.displayName = ROUTE_CHILDREN_DISPLAY_NAME;
|
|
216
218
|
RouteChildrenImpl[ROUTE_CHILDREN_SENTINEL] = true;
|
|
@@ -229,6 +231,17 @@ function isRouteChildrenType(type) {
|
|
|
229
231
|
return false;
|
|
230
232
|
}
|
|
231
233
|
}
|
|
234
|
+
function isRouteChildrenSlotType(type) {
|
|
235
|
+
if (!type || typeof type !== "function" && typeof type !== "object") {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
try {
|
|
239
|
+
const candidate = type;
|
|
240
|
+
return candidate[ROUTE_CHILDREN_SLOT_SENTINEL] === true || candidate.displayName === ROUTE_CHILDREN_SLOT_DISPLAY_NAME || candidate.name === "RouteChildrenSlot";
|
|
241
|
+
} catch {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
232
245
|
function isReactElementLike(node) {
|
|
233
246
|
if (!node || typeof node !== "object") {
|
|
234
247
|
return false;
|
|
@@ -254,14 +267,14 @@ function injectRouteChildren(node, routeChildren) {
|
|
|
254
267
|
});
|
|
255
268
|
return changed ? next : node;
|
|
256
269
|
}
|
|
257
|
-
if (isReactElementLike(node) && isRouteChildrenType(node.type)) {
|
|
270
|
+
if (isReactElementLike(node) && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
258
271
|
return routeChildren;
|
|
259
272
|
}
|
|
260
273
|
const isValidElement = React.isValidElement(node);
|
|
261
274
|
if (!isValidElement && !isReactElementLike(node)) {
|
|
262
275
|
return node;
|
|
263
276
|
}
|
|
264
|
-
if (isValidElement && isRouteChildrenType(node.type)) {
|
|
277
|
+
if (isValidElement && (isRouteChildrenType(node.type) || isRouteChildrenSlotType(node.type))) {
|
|
265
278
|
return routeChildren;
|
|
266
279
|
}
|
|
267
280
|
const props = node.props ?? {};
|