@d1vij/jassm 0.1.22 → 0.1.23-beta.1

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 CHANGED
@@ -133,7 +133,7 @@ declare function generateRegistry<
133
133
  /**
134
134
  * Raw module registry
135
135
  */
136
- exports: Record<RouteKey<Modules, Root, Virtual>, Promise<Record<string, unknown>>>;
136
+ exports: Record<RouteKey<Modules, Root, Virtual>, () => Promise<Record<string, unknown>>>;
137
137
  };
138
138
  type Diffs = { [K in `inComponentsButNotIn${"Exports" | "Metadata"}` | `in${"Metadata" | "Exports"}ButNotInComponents`] : string[] | undefined };
139
139
  /**
@@ -147,7 +147,7 @@ type Diffs = { [K in `inComponentsButNotIn${"Exports" | "Metadata"}` | `in${"Met
147
147
  declare abstract class AbstractRegistry<
148
148
  Key extends string,
149
149
  Components extends Record<Key, React.LazyExoticComponent<React.ComponentType>>,
150
- Exports extends Record<Key, unknown>,
150
+ Exports extends Record<Key, () => unknown>,
151
151
  Metadata extends Record<Key, unknown>
152
152
  > {
153
153
  /**
@@ -201,10 +201,10 @@ declare class Registry<
201
201
  Modules extends Record<string, WrappedUnknownPromise>,
202
202
  Root extends string,
203
203
  Virtual extends string
204
- > extends AbstractRegistry<RouteKey<Modules, Root, Virtual>, Record<RouteKey<Modules, Root, Virtual>, React.LazyExoticComponent<React.ComponentType>>, Record<RouteKey<Modules, Root, Virtual>, unknown>, Record<RouteKey<Modules, Root, Virtual>, MetaType>> {
204
+ > extends AbstractRegistry<RouteKey<Modules, Root, Virtual>, Record<RouteKey<Modules, Root, Virtual>, React.LazyExoticComponent<React.ComponentType>>, Record<RouteKey<Modules, Root, Virtual>, () => unknown>, Record<RouteKey<Modules, Root, Virtual>, MetaType>> {
205
205
  readonly keys: RouteKey<Modules, Root, Virtual>[];
206
206
  readonly components: Record<RouteKey<Modules, Root, Virtual>, React.LazyExoticComponent<React.ComponentType>>;
207
- readonly exports: Record<RouteKey<Modules, Root, Virtual>, unknown>;
207
+ readonly exports: Record<RouteKey<Modules, Root, Virtual>, () => unknown>;
208
208
  readonly metadata: Record<RouteKey<Modules, Root, Virtual>, MetaType>;
209
209
  constructor(opts: RegistryOptions<MetaType, Modules, Root, Virtual>);
210
210
  }
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import{cn as Z}from"@d1vij/shit-i-always-use";import{useMemo as R,useState as G}
2
2
  `);return[t,r].join(`
3
3
  `)}function Ao(o){let t=o.headings.map((n)=>`<th>${n}</th>`).join(""),r=o.rows.map((n)=>{return`<tr>${n.map((l)=>`<td>${l.content}</td>`).join("")}</tr>`});return["<table>","<thead>",`<tr>${t}</tr>`,"</thead>","<tbody>",...r,"</tbody>","</table>"].join(`
4
4
  `)}function Ho(o){let t=`|${o.headings.join("|")}|`,r=`|${o.headings.map(()=>"-----").join("|")}|`,n=o.rows.map((s)=>`|${s.map((l)=>l.content).join("|")}|`);return[t,r,...n].join(`
5
- `)}function z(o){let t=e(),r=k(null),n=k(null),[s,l]=wo(!1),{copy:m}=So();go(()=>{let c=n.current;if(!c)return;function f(){l(!1)}function i(){l(!0)}return c.addEventListener("mouseenter",i),c.addEventListener("mouseleave",f),()=>{c.removeEventListener("mouseenter",i),c.removeEventListener("mouseleave",f)}},[]);let a=Xo((c)=>{return async()=>{let f=r.current;if(!f)return;let i=Lo(f),d;switch(c){case"html":d=Ao(i);break;case"csv":d=No(i);break;case"markdown":d=Ho(i);break;case"json":d=JSON.stringify(i,null,4);break;default:return}await m(d)}},[m]);return I("div",{className:u(t.table_container),children:[p("table",{ref:r,className:u(t.table),children:o.children}),I("details",{ref:n,className:u(t.table_action_buttons_details),open:s,children:[p("summary",{className:u(t.table_action_buttons_summary),children:"Copy"}),p(y,{setOpen:l,label:"HTML",onClick:a("html")}),p(y,{setOpen:l,label:"CSV",onClick:a("csv")}),p(y,{setOpen:l,label:"Json",onClick:a("json")}),p(y,{setOpen:l,label:"Markdown",onClick:a("markdown")})]})]})}function Q(o){let t=e();return p("thead",{className:u(t.table_head),children:o.children})}function D(o){let t=e();return p("tbody",{className:u(t.table_body),children:o.children})}function U(o){let t=e();return p("tr",{className:u(t.table_row),children:o.children})}function V(o){let t=e();return p("th",{className:u(t.table_head_cell),children:o.children})}function F(o){let t=e();return p("td",{className:u(t.table_data),children:o.children})}var jt=["h1","h2","h3","h4","h5","h6","a","em","del","strong","code","blockquote","pre","p","hr","ol","ul","li","img","table","thead","tbody","th","tr","td"],T={h1:(o)=>h({...o,level:1}),h2:(o)=>h({...o,level:2}),h3:(o)=>h({...o,level:3}),h4:(o)=>h({...o,level:4}),h5:(o)=>h({...o,level:5}),h6:(o)=>h({...o,level:6}),a:A,em:B,del:$,strong:H,code:P,blockquote:E,pre:g,p:M,hr:S,ol:(o)=>b({...o,type:"ordered"}),ul:(o)=>b({...o,type:"unordered"}),li:q,img:X,table:z,thead:Q,tbody:D,th:V,tr:U,td:F};import{Suspense as qo}from"react";function ne(o,t=!0){if(t)return{...T,...o};else return{...o}}import{lazy as _o}from"react";function vo({modulesGlob:o,metadataGlob:t,root:r,virtual:n}){let s=Object.keys(o),l=[],m=[],a=[],c=[],f=n==="/"||n===""?"":n;for(let i of s){let d=i.replace(`${r}/`,f).replace(".mdx",""),N=o[i];l.push(d),m.push([d,_o(N)]),a.push([d,N()]);let K=t[i.replace(".mdx",".meta.ts")];c.push([d,{__splat:d,...K}])}return{keys:l,components:Object.fromEntries(m),exports:Object.fromEntries(a),metadata:Object.fromEntries(c)}}class w{diffKeys(){let o=new Set(this.keys),t=new Set(Object.keys(this.exports)),r=new Set(Object.keys(this.metadata)),n=o.symmetricDifference(t),s=o.symmetricDifference(r),l=[],m={inComponentsButNotInExports:void 0,inComponentsButNotInMetadata:void 0,inExportsButNotInComponents:void 0,inMetadataButNotInComponents:void 0};if(n.size!==0)m.inComponentsButNotInExports=Array.from(o.difference(t)),m.inExportsButNotInComponents=Array.from(t.difference(o)),l.push(`Exports Registry and Component Registry have ${n.size} key mismatches.
5
+ `)}function z(o){let t=e(),r=k(null),n=k(null),[s,l]=wo(!1),{copy:m}=So();go(()=>{let c=n.current;if(!c)return;function f(){l(!1)}function i(){l(!0)}return c.addEventListener("mouseenter",i),c.addEventListener("mouseleave",f),()=>{c.removeEventListener("mouseenter",i),c.removeEventListener("mouseleave",f)}},[]);let a=Xo((c)=>{return async()=>{let f=r.current;if(!f)return;let i=Lo(f),d;switch(c){case"html":d=Ao(i);break;case"csv":d=No(i);break;case"markdown":d=Ho(i);break;case"json":d=JSON.stringify(i,null,4);break;default:return}await m(d)}},[m]);return I("div",{className:u(t.table_container),children:[p("table",{ref:r,className:u(t.table),children:o.children}),I("details",{ref:n,className:u(t.table_action_buttons_details),open:s,children:[p("summary",{className:u(t.table_action_buttons_summary),children:"Copy"}),p(y,{setOpen:l,label:"HTML",onClick:a("html")}),p(y,{setOpen:l,label:"CSV",onClick:a("csv")}),p(y,{setOpen:l,label:"Json",onClick:a("json")}),p(y,{setOpen:l,label:"Markdown",onClick:a("markdown")})]})]})}function Q(o){let t=e();return p("thead",{className:u(t.table_head),children:o.children})}function D(o){let t=e();return p("tbody",{className:u(t.table_body),children:o.children})}function U(o){let t=e();return p("tr",{className:u(t.table_row),children:o.children})}function V(o){let t=e();return p("th",{className:u(t.table_head_cell),children:o.children})}function F(o){let t=e();return p("td",{className:u(t.table_data),children:o.children})}var jt=["h1","h2","h3","h4","h5","h6","a","em","del","strong","code","blockquote","pre","p","hr","ol","ul","li","img","table","thead","tbody","th","tr","td"],T={h1:(o)=>h({...o,level:1}),h2:(o)=>h({...o,level:2}),h3:(o)=>h({...o,level:3}),h4:(o)=>h({...o,level:4}),h5:(o)=>h({...o,level:5}),h6:(o)=>h({...o,level:6}),a:A,em:B,del:$,strong:H,code:P,blockquote:E,pre:g,p:M,hr:S,ol:(o)=>b({...o,type:"ordered"}),ul:(o)=>b({...o,type:"unordered"}),li:q,img:X,table:z,thead:Q,tbody:D,th:V,tr:U,td:F};import{Suspense as qo}from"react";function ne(o,t=!0){if(t)return{...T,...o};else return{...o}}import{lazy as _o}from"react";function vo({modulesGlob:o,metadataGlob:t,root:r,virtual:n}){let s=Object.keys(o),l=[],m=[],a=[],c=[],f=n==="/"||n===""?"":n;for(let i of s){let d=i.replace(`${r}/`,f).replace(".mdx",""),N=o[i];l.push(d),m.push([d,_o(()=>N())]),a.push([d,N]);let K=t[i.replace(".mdx",".meta.ts")];c.push([d,{__splat:d,...K}])}return{keys:l,components:Object.fromEntries(m),exports:Object.fromEntries(a),metadata:Object.fromEntries(c)}}class w{diffKeys(){let o=new Set(this.keys),t=new Set(Object.keys(this.exports)),r=new Set(Object.keys(this.metadata)),n=o.symmetricDifference(t),s=o.symmetricDifference(r),l=[],m={inComponentsButNotInExports:void 0,inComponentsButNotInMetadata:void 0,inExportsButNotInComponents:void 0,inMetadataButNotInComponents:void 0};if(n.size!==0)m.inComponentsButNotInExports=Array.from(o.difference(t)),m.inExportsButNotInComponents=Array.from(t.difference(o)),l.push(`Exports Registry and Component Registry have ${n.size} key mismatches.
6
6
  Keys which are present in Component map but not in Exports
7
7
  ${m.inComponentsButNotInExports.join(`
8
8
  `)}
@@ -18,4 +18,4 @@ import{cn as Z}from"@d1vij/shit-i-always-use";import{useMemo as R,useState as G}
18
18
  `)}
19
19
  `);if(l.length===0)return null;return{diffs:m,error:Error(l.join(`
20
20
 
21
- `))}}get(o,t){let r=o[t];if(!r)throw Error(`Invalid key passed ${t.toString()} to access whatever the fuck we were extractign`);return r}getComponent(o){return this.get(this.components,o)}getExport(o){return this.get(this.exports,o)}getMetadata(o){return this.get(this.metadata,o)}}class Bo extends w{keys;components;exports;metadata;constructor(o){super();let t=vo(o);this.keys=t.keys,this.components=t.components,this.exports=t.exports,this.metadata=t.metadata}}class Oo extends w{keys=[];components={};exports={};metadata={};constructor(...o){super();for(let t of o)this.keys.push(...t.keys),Object.assign(this.components,t.components),Object.assign(this.exports,t.exports),Object.assign(this.metadata,t.metadata)}}import{jsx as L}from"react/jsx-runtime";function Co({source:o,styles:t,fallback:r,elements:n=T}){return L(J,{value:t,children:L(qo,{fallback:r,children:L(o,{components:n})})})}export{e as useStyles,vo as generateRegistry,ne as generateElementsFrom,J as StyleContext,$o as StyleClassesList,Bo as Registry,Co as MDXFromComponent,Oo as CoalescedRegistry,T as BaseElements,jt as BaseElementTags};
21
+ `))}}get(o,t){let r=o[t];if(!r)throw Error(`Invalid key passed ${t.toString()} to access whatever the fuck we were extractign`);return r}getComponent(o){return this.get(this.components,o)}getExport(o){return this.exports[o]()}getMetadata(o){return this.get(this.metadata,o)}}class Bo extends w{keys;components;exports;metadata;constructor(o){super();let t=vo(o);this.keys=t.keys,this.components=t.components,this.exports=t.exports,this.metadata=t.metadata}}class Oo extends w{keys=[];components={};exports={};metadata={};constructor(...o){super();for(let t of o)this.keys.push(...t.keys),Object.assign(this.components,t.components),Object.assign(this.exports,t.exports),Object.assign(this.metadata,t.metadata)}}import{jsx as L}from"react/jsx-runtime";function Co({source:o,styles:t,fallback:r,elements:n=T}){return L(J,{value:t,children:L(qo,{fallback:r,children:L(o,{components:n})})})}export{e as useStyles,vo as generateRegistry,ne as generateElementsFrom,J as StyleContext,$o as StyleClassesList,Bo as Registry,Co as MDXFromComponent,Oo as CoalescedRegistry,T as BaseElements,jt as BaseElementTags};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d1vij/jassm",
3
- "version": "0.1.22",
3
+ "version": "0.1.23-beta.1",
4
4
  "description": "Just another static site maker. Create simple content driven sites using MDX and React along with Typescript safety.",
5
5
  "homepage": "https://github.com/d1vij/jassm",
6
6
  "license": "MIT",