@d1vij/jassm 0.1.23 → 0.1.24
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 +2 -1
- package/dist/index.js +11 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ type RegistryOptions<
|
|
|
102
102
|
* Virtual route mount point
|
|
103
103
|
*/
|
|
104
104
|
virtual: Virtual;
|
|
105
|
+
meta_extension?: string;
|
|
105
106
|
};
|
|
106
107
|
/**
|
|
107
108
|
* Internal function used by {@link Registry}.
|
|
@@ -117,7 +118,7 @@ declare function generateRegistry<
|
|
|
117
118
|
Modules extends Record<string, WrappedUnknownPromise>,
|
|
118
119
|
Root extends string,
|
|
119
120
|
Virtual extends string
|
|
120
|
-
>({ modulesGlob, metadataGlob, root, virtual }: RegistryOptions<MetaType, Modules, Root, Virtual>): {
|
|
121
|
+
>({ modulesGlob, metadataGlob, root, virtual, meta_extension }: RegistryOptions<MetaType, Modules, Root, Virtual>): {
|
|
121
122
|
/**
|
|
122
123
|
* List of route keys
|
|
123
124
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{cn as
|
|
1
|
+
import{cn as R}from"@d1vij/shit-i-always-use";import{useMemo as G,useState as x}from"react";import{createContext as Y,useContext as Z}from"react";var ko=["header","header_button","header_1","header_2","header_3","header_4","header_5","header_6","header_icon","anchor","button","bold","italic","span","striked","paragraph","code","preformatted","blockquote","horizontal_line","image","list","unordered_list","ordered_list","list_item","table","table_head","table_head_cell","table_body","table_row","table_data","table_container","table_action_buttons_details","table_action_buttons_summary","table_action_button","table_action_button_html","table_action_button_csv","table_action_button_json","table_action_button_markdown"],E=Y(null);function e(){let o=Z(E);if(o===null)throw Error("No stylesmap found at any parent level. Either you forgot to pass the stylesmap to component loader or didnt wrap your component in StyleContext");return o}import{jsx as j}from"react/jsx-runtime";function H(o){let t=G(()=>new URL(window.location.href).origin.toString(),[]),r=e(),[n]=x(()=>{if(o.href?.match(/^#.*/))return"_self";return new URL(o.href??"").origin.toString()===t?"_self":"_blank"});return j("a",{className:R(r.anchor),target:n,href:o.href,children:o.children})}import{cn as oo}from"@d1vij/shit-i-always-use";import{jsx as to}from"react/jsx-runtime";function P(o){let t=e();return to("blockquote",{className:oo(t.blockquote),children:o.children})}import{cn as eo}from"@d1vij/shit-i-always-use";import{jsx as ro}from"react/jsx-runtime";function v(o){let t=e();return ro("span",{className:eo(t.bold),children:o.children})}import{cn as no}from"@d1vij/shit-i-always-use";import{jsx as lo}from"react/jsx-runtime";function S(o){let t=e(),r=/language-(\w+)/.exec(o.className||"")?.[1];return lo("code",{className:no(t.code,r&&`language-${r}`),children:o.children})}import{cn as _,useClipboardText as so}from"@d1vij/shit-i-always-use";import{useEffect as co,useRef as mo,useState as ao}from"react";import{jsx as B}from"react/jsx-runtime";function h(o){let t=e(),r=mo(null),[n,s]=ao(""),{copy:l}=so();async function c(){let a=new URL(`/#${n}`,window.location.origin).toString();await l(a)}return co(()=>{if(!r.current)return;let m=(r.current.textContent??"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").slice(0,30);s(m)},[]),B("h1",{className:_(t.header,t[`header_${o.level}`]),children:B("button",{onClick:()=>void c(),ref:r,id:n,className:_(t.header_button),type:"button",children:o.children})})}import{cn as po}from"@d1vij/shit-i-always-use";import{jsx as io}from"react/jsx-runtime";function X(o){let t=e();return io("hr",{className:po(t.horizontal_line)})}import{cn as uo}from"@d1vij/shit-i-always-use";import{jsx as fo}from"react/jsx-runtime";function g(o){let t=e();return fo("img",{className:uo(t.image),alt:o.alt,title:o.title,src:o.src})}import{cn as ho}from"@d1vij/shit-i-always-use";import{jsx as bo}from"react/jsx-runtime";function O(o){let t=e();return bo("span",{className:ho(t.italic),children:o.children})}import{cn as q}from"@d1vij/shit-i-always-use";import{jsx as M}from"react/jsx-runtime";function y(o){let t=e(),r=o.type==="ordered"?"ol":"ul";return M(r,{className:q(t.list,o.type==="ordered"&&t.ordered_list,o.type==="unordered"&&t.unordered_list),children:o.children})}function C(o){let t=e();return M("li",{className:q(t.list_item),children:o.children})}import{cn as yo}from"@d1vij/shit-i-always-use";import{jsx as To}from"react/jsx-runtime";function $(o){let t=e();return To("p",{className:yo(t.paragraph),children:o.children})}import{cn as Jo}from"@d1vij/shit-i-always-use";import{jsx as Eo}from"react/jsx-runtime";function w(o){let t=e();return Eo("pre",{className:Jo(t.preformatted),children:o.children})}import{cn as Po}from"@d1vij/shit-i-always-use";import{jsx as So}from"react/jsx-runtime";function k(o){let t=e();return So("span",{className:Po(t.striked),children:o.children})}import{cn as i,useClipboardText as Xo}from"@d1vij/shit-i-always-use";import{useCallback as go,useEffect as wo,useRef as I,useState as Lo}from"react";import{jsx as p,jsxs as z}from"react/jsx-runtime";function T({label:o,onClick:t,setOpen:r}){let n=e();function s(l){r(!1),t(l)}return p("button",{onClick:s,className:i(n.table_action_button),type:"button",children:o})}function No(o){let t=[];o.querySelectorAll("thead > tr > th").forEach((l)=>{t.push(l.innerText.trim())});let n=[],s=o.querySelectorAll("tbody > tr");return s.forEach((l)=>{let c=[];l.querySelectorAll("td").forEach((a,m)=>{c.push({column:t[m]??m.toString(),content:a.innerText.trim()})}),n.push(c)}),{meta:{columns:t.length,rows:s.length},headings:t,rows:n}}function Ao(o){let t=o.headings.join(","),r=o.rows.map((n)=>n.map((s)=>s.content).join(",")).join(`
|
|
2
2
|
`);return[t,r].join(`
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function
|
|
3
|
+
`)}function Ho(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
|
+
`)}function vo(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 Q(o){let t=e(),r=I(null),n=I(null),[s,l]=Lo(!1),{copy:c}=Xo();wo(()=>{let m=n.current;if(!m)return;function f(){l(!1)}function d(){l(!0)}return m.addEventListener("mouseenter",d),m.addEventListener("mouseleave",f),()=>{m.removeEventListener("mouseenter",d),m.removeEventListener("mouseleave",f)}},[]);let a=go((m)=>{return async()=>{let f=r.current;if(!f)return;let d=No(f),u;switch(m){case"html":u=Ho(d);break;case"csv":u=Ao(d);break;case"markdown":u=vo(d);break;case"json":u=JSON.stringify(d,null,4);break;default:return}await c(u)}},[c]);return z("div",{className:i(t.table_container),children:[p("table",{ref:r,className:i(t.table),children:o.children}),z("details",{ref:n,className:i(t.table_action_buttons_details),open:s,children:[p("summary",{className:i(t.table_action_buttons_summary),children:"Copy"}),p(T,{setOpen:l,label:"HTML",onClick:a("html")}),p(T,{setOpen:l,label:"CSV",onClick:a("csv")}),p(T,{setOpen:l,label:"Json",onClick:a("json")}),p(T,{setOpen:l,label:"Markdown",onClick:a("markdown")})]})]})}function D(o){let t=e();return p("thead",{className:i(t.table_head),children:o.children})}function U(o){let t=e();return p("tbody",{className:i(t.table_body),children:o.children})}function V(o){let t=e();return p("tr",{className:i(t.table_row),children:o.children})}function F(o){let t=e();return p("th",{className:i(t.table_head_cell),children:o.children})}function K(o){let t=e();return p("td",{className:i(t.table_data),children:o.children})}var oe=["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"],J={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:H,em:O,del:k,strong:v,code:S,blockquote:P,pre:w,p:$,hr:X,ol:(o)=>y({...o,type:"ordered"}),ul:(o)=>y({...o,type:"unordered"}),li:C,img:g,table:Q,thead:D,tbody:U,th:F,tr:V,td:K};import{Suspense as Co}from"react";function le(o,t=!0){if(t)return{...J,...o};else return{...o}}import{lazy as _o}from"react";function Bo({modulesGlob:o,metadataGlob:t,root:r,virtual:n,meta_extension:s=".meta.ts"}){let l=Object.keys(o),c=[],a=[],m=[],f=[],d=n==="/"||n===""?"":n;for(let u of l){let b=u.replace(`${r}/`,d).replace(".mdx",""),A=o[u];c.push(b),a.push([b,_o(()=>A())]),m.push([b,A]);let W=t[u.replace(".mdx",s)];f.push([b,{__splat:b,...W}])}return{keys:c,components:Object.fromEntries(a),exports:Object.fromEntries(m),metadata:Object.fromEntries(f)}}class L{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=[],c={inComponentsButNotInExports:void 0,inComponentsButNotInMetadata:void 0,inExportsButNotInComponents:void 0,inMetadataButNotInComponents:void 0};if(n.size!==0)c.inComponentsButNotInExports=Array.from(o.difference(t)),c.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
|
+
${c.inComponentsButNotInExports.join(`
|
|
8
8
|
`)}
|
|
9
9
|
and the keys present in Exports but not in component map are
|
|
10
|
-
${
|
|
10
|
+
${c.inExportsButNotInComponents.join(`
|
|
11
11
|
`)}
|
|
12
|
-
`);if(s.size!==0)
|
|
12
|
+
`);if(s.size!==0)c.inComponentsButNotInMetadata=Array.from(o.difference(r)),c.inMetadataButNotInComponents=Array.from(s.difference(o)),l.push(`Metadata Registry and Component Registry have ${s.size} key mismatches.
|
|
13
13
|
Keys which are present in Component map but not in Metadata
|
|
14
|
-
${
|
|
14
|
+
${c.inComponentsButNotInMetadata.join(`
|
|
15
15
|
`)}
|
|
16
16
|
and the keys present in Metadata but not in Component map are
|
|
17
|
-
${
|
|
17
|
+
${c.inMetadataButNotInComponents.join(`
|
|
18
18
|
`)}
|
|
19
|
-
`);if(l.length===0)return null;return{diffs:
|
|
19
|
+
`);if(l.length===0)return null;return{diffs:c,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.exports[o]()}getMetadata(o){return this.get(this.metadata,o)}}class
|
|
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 Oo extends L{keys;components;exports;metadata;constructor(o){super();let t=Bo(o);this.keys=t.keys,this.components=t.components,this.exports=t.exports,this.metadata=t.metadata}}class qo extends L{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 N}from"react/jsx-runtime";function Mo({source:o,styles:t,fallback:r,elements:n=J}){return N(E,{value:t,children:N(Co,{fallback:r,children:N(o,{components:n})})})}export{e as useStyles,Bo as generateRegistry,le as generateElementsFrom,E as StyleContext,ko as StyleClassesList,Oo as Registry,Mo as MDXFromComponent,qo as CoalescedRegistry,J as BaseElements,oe as BaseElementTags};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d1vij/jassm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
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",
|