@carats/render 0.0.6 → 0.0.8
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/index.d.ts +6 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ interface CaratsComponent<T = any> extends JSX.FunctionComponent<T> {
|
|
|
2
2
|
defaultProps?: T;
|
|
3
3
|
head?: string;
|
|
4
4
|
burnished?: boolean;
|
|
5
|
+
recast?: boolean;
|
|
5
6
|
}
|
|
6
7
|
interface Facets {
|
|
7
8
|
inAppRouting?: boolean;
|
|
@@ -19,8 +20,11 @@ interface PageComponentResult {
|
|
|
19
20
|
params: Record<string, string>;
|
|
20
21
|
route: string;
|
|
21
22
|
}
|
|
22
|
-
declare function getPageComponent(this: Facets,
|
|
23
|
+
declare function getPageComponent(this: Facets, url: string): PageComponentResult;
|
|
23
24
|
declare function renderPage<T = any>(this: Facets, component: CaratsComponent<T>, props: T): Promise<string>;
|
|
24
|
-
|
|
25
|
+
interface BurnishOptions {
|
|
26
|
+
recast?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare function Burnish<T = any>(component: CaratsComponent<T>, options?: BurnishOptions): CaratsComponent<T>;
|
|
25
29
|
|
|
26
30
|
export { Burnish, type CaratsComponent, type Facets, type PageComponentResult, getPageComponent, renderPage };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{matchRoute as
|
|
1
|
+
import{matchRoute as c}from"@carats/url";import{transpile as p}from"jjsx";function l(e){let{routes:t,suspense:o}=this,u=new URL(e,"http://localhost").pathname;for(let n in t){let r=t[n],s=c(n,u);if(s)return r instanceof Promise?{component:()=>{let a=`carats-suspense-${n}`;return r.then(i=>{document.getElementById(a)?.replaceWith(p(i))}).catch(i=>{document.getElementById(a)?.replaceWith(p(o.error(i)))}),JJSX.jsxFactory("div",{id:a},o.loading())},params:s,route:n}:{component:r,params:s,route:n}}return{component:o.notFound,params:{},route:"/not-found"}}async function C(e,t){return p(e(t))}function g(e,t){return e.burnished=!0,t?.recast&&(e.recast=!0),e}export{g as Burnish,l as getPageComponent,C as renderPage};
|