@d1vij/jassm 0.1.21 → 0.1.22

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import{cn as Z}from"@d1vij/shit-i-always-use";import{useMemo as R,useState as G}from"react";import{createContext as W,useContext as Y}from"react";var $o=["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"],J=W(null);function e(){let o=Y(J);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 x}from"react/jsx-runtime";function A(o){let t=R(()=>new URL(window.location.href).origin.toString(),[]),r=e(),[n]=G(()=>{if(o.href?.match(/^#.*/))return"_self";return new URL(o.href??"").origin.toString()===t?"_self":"_blank"});return x("a",{className:Z(r.anchor),target:n,href:o.href,children:o.children})}import{cn as j}from"@d1vij/shit-i-always-use";import{jsx as oo}from"react/jsx-runtime";function E(o){let t=e();return oo("blockquote",{className:j(t.blockquote),children:o.children})}import{cn as to}from"@d1vij/shit-i-always-use";import{jsx as eo}from"react/jsx-runtime";function H(o){let t=e();return eo("span",{className:to(t.bold),children:o.children})}import{cn as ro}from"@d1vij/shit-i-always-use";import{jsx as no}from"react/jsx-runtime";function P(o){let t=e(),r=/language-(\w+)/.exec(o.className||"")?.[1];return no("code",{className:ro(t.code,r&&`language-${r}`),children:o.children})}import{cn as _,useClipboardText as lo}from"@d1vij/shit-i-always-use";import{useEffect as so,useRef as mo,useState as co}from"react";import{jsx as v}from"react/jsx-runtime";function h(o){let t=e(),r=mo(null),[n,s]=co(""),{copy:l}=lo();async function m(){let a=new URL(`/#${n}`,window.location.origin).toString();console.log("clicked"),await l(a)}return so(()=>{if(!r.current)return;let c=(r.current.textContent??"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").slice(0,30);s(c)},[]),v("h1",{className:_(t.header,t[`header_${o.level}`]),children:v("button",{onClick:()=>void m(),ref:r,id:n,className:_(t.header_button),type:"button",children:o.children})})}import{cn as ao}from"@d1vij/shit-i-always-use";import{jsx as po}from"react/jsx-runtime";function S(o){let t=e();return po("hr",{className:ao(t.horizontal_line)})}import{cn as io}from"@d1vij/shit-i-always-use";import{jsx as uo}from"react/jsx-runtime";function X(o){let t=e();return uo("img",{className:io(t.image),alt:o.alt,title:o.title,src:o.src})}import{cn as fo}from"@d1vij/shit-i-always-use";import{jsx as ho}from"react/jsx-runtime";function B(o){let t=e();return ho("span",{className:fo(t.italic),children:o.children})}import{cn as O}from"@d1vij/shit-i-always-use";import{jsx as C}from"react/jsx-runtime";function b(o){let t=e(),r=o.type==="ordered"?"ol":"ul";return C(r,{className:O(t.list,o.type==="ordered"&&t.ordered_list,o.type==="unordered"&&t.unordered_list),children:o.children})}function q(o){let t=e();return C("li",{className:O(t.list_item),children:o.children})}import{cn as bo}from"@d1vij/shit-i-always-use";import{jsx as yo}from"react/jsx-runtime";function M(o){let t=e();return yo("p",{className:bo(t.paragraph),children:o.children})}import{cn as To}from"@d1vij/shit-i-always-use";import{jsx as Jo}from"react/jsx-runtime";function g(o){let t=e();return Jo("pre",{className:To(t.preformatted),children:o.children})}import{cn as Eo}from"@d1vij/shit-i-always-use";import{jsx as Po}from"react/jsx-runtime";function $(o){let t=e();return Po("span",{className:Eo(t.striked),children:o.children})}import{cn as u,useClipboardText as So}from"@d1vij/shit-i-always-use";import{useCallback as Xo,useEffect as go,useRef as k,useState as wo}from"react";import{jsx as i,jsxs as I}from"react/jsx-runtime";function y({label:o,onClick:t,setOpen:r}){let n=e();function s(l){r(!1),t(l)}return i("button",{onClick:s,className:u(n.table_action_button),type:"button",children:o})}function Lo(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 m=[];l.querySelectorAll("td").forEach((a,c)=>{m.push({column:t[c]??c.toString(),content:a.innerText.trim()})}),n.push(m)}),{meta:{columns:t.length,rows:s.length},headings:t,rows:n}}function No(o){let t=o.headings.join(","),r=o.rows.map((n)=>n.map((s)=>s.content).join(",")).join(`
1
+ import{cn as Z}from"@d1vij/shit-i-always-use";import{useMemo as R,useState as G}from"react";import{createContext as W,useContext as Y}from"react";var $o=["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"],J=W(null);function e(){let o=Y(J);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 x}from"react/jsx-runtime";function A(o){let t=R(()=>new URL(window.location.href).origin.toString(),[]),r=e(),[n]=G(()=>{if(o.href?.match(/^#.*/))return"_self";return new URL(o.href??"").origin.toString()===t?"_self":"_blank"});return x("a",{className:Z(r.anchor),target:n,href:o.href,children:o.children})}import{cn as j}from"@d1vij/shit-i-always-use";import{jsx as oo}from"react/jsx-runtime";function E(o){let t=e();return oo("blockquote",{className:j(t.blockquote),children:o.children})}import{cn as to}from"@d1vij/shit-i-always-use";import{jsx as eo}from"react/jsx-runtime";function H(o){let t=e();return eo("span",{className:to(t.bold),children:o.children})}import{cn as ro}from"@d1vij/shit-i-always-use";import{jsx as no}from"react/jsx-runtime";function P(o){let t=e(),r=/language-(\w+)/.exec(o.className||"")?.[1];return no("code",{className:ro(t.code,r&&`language-${r}`),children:o.children})}import{cn as _,useClipboardText as lo}from"@d1vij/shit-i-always-use";import{useEffect as so,useRef as mo,useState as co}from"react";import{jsx as v}from"react/jsx-runtime";function h(o){let t=e(),r=mo(null),[n,s]=co(""),{copy:l}=lo();async function m(){let a=new URL(`/#${n}`,window.location.origin).toString();await l(a)}return so(()=>{if(!r.current)return;let c=(r.current.textContent??"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").slice(0,30);s(c)},[]),v("h1",{className:_(t.header,t[`header_${o.level}`]),children:v("button",{onClick:()=>void m(),ref:r,id:n,className:_(t.header_button),type:"button",children:o.children})})}import{cn as ao}from"@d1vij/shit-i-always-use";import{jsx as po}from"react/jsx-runtime";function S(o){let t=e();return po("hr",{className:ao(t.horizontal_line)})}import{cn as io}from"@d1vij/shit-i-always-use";import{jsx as uo}from"react/jsx-runtime";function X(o){let t=e();return uo("img",{className:io(t.image),alt:o.alt,title:o.title,src:o.src})}import{cn as fo}from"@d1vij/shit-i-always-use";import{jsx as ho}from"react/jsx-runtime";function B(o){let t=e();return ho("span",{className:fo(t.italic),children:o.children})}import{cn as O}from"@d1vij/shit-i-always-use";import{jsx as C}from"react/jsx-runtime";function b(o){let t=e(),r=o.type==="ordered"?"ol":"ul";return C(r,{className:O(t.list,o.type==="ordered"&&t.ordered_list,o.type==="unordered"&&t.unordered_list),children:o.children})}function q(o){let t=e();return C("li",{className:O(t.list_item),children:o.children})}import{cn as bo}from"@d1vij/shit-i-always-use";import{jsx as yo}from"react/jsx-runtime";function M(o){let t=e();return yo("p",{className:bo(t.paragraph),children:o.children})}import{cn as To}from"@d1vij/shit-i-always-use";import{jsx as Jo}from"react/jsx-runtime";function g(o){let t=e();return Jo("pre",{className:To(t.preformatted),children:o.children})}import{cn as Eo}from"@d1vij/shit-i-always-use";import{jsx as Po}from"react/jsx-runtime";function $(o){let t=e();return Po("span",{className:Eo(t.striked),children:o.children})}import{cn as u,useClipboardText as So}from"@d1vij/shit-i-always-use";import{useCallback as Xo,useEffect as go,useRef as k,useState as wo}from"react";import{jsx as p,jsxs as I}from"react/jsx-runtime";function y({label:o,onClick:t,setOpen:r}){let n=e();function s(l){r(!1),t(l)}return p("button",{onClick:s,className:u(n.table_action_button),type:"button",children:o})}function Lo(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 m=[];l.querySelectorAll("td").forEach((a,c)=>{m.push({column:t[c]??c.toString(),content:a.innerText.trim()})}),n.push(m)}),{meta:{columns:t.length,rows:s.length},headings:t,rows:n}}function No(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
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 d(){l(!0)}return c.addEventListener("mouseenter",d),c.addEventListener("mouseleave",f),()=>{c.removeEventListener("mouseenter",d),c.removeEventListener("mouseleave",f)}},[]);let a=Xo((c)=>{return async()=>{let f=r.current;if(!f)return;let d=Lo(f),p;switch(c){case"html":p=Ao(d);break;case"csv":p=No(d);break;case"markdown":p=Ho(d);break;case"json":p=JSON.stringify(d,null,4);break;default:return}await m(p)}},[m]);return I("div",{className:u(t.table_container),children:[i("table",{ref:r,className:u(t.table),children:o.children}),I("details",{ref:n,className:u(t.table_action_buttons_details),open:s,children:[i("summary",{className:u(t.table_action_buttons_summary),children:"Copy"}),i(y,{setOpen:l,label:"HTML",onClick:a("html")}),i(y,{setOpen:l,label:"CSV",onClick:a("csv")}),i(y,{setOpen:l,label:"Json",onClick:a("json")}),i(y,{setOpen:l,label:"Markdown",onClick:a("markdown")})]})]})}function Q(o){let t=e();return i("thead",{className:u(t.table_head),children:o.children})}function D(o){let t=e();return i("tbody",{className:u(t.table_body),children:o.children})}function U(o){let t=e();return i("tr",{className:u(t.table_row),children:o.children})}function V(o){let t=e();return i("th",{className:u(t.table_head_cell),children:o.children})}function F(o){let t=e();return i("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;console.log("virtual",f);for(let d of s){let p=d.replace(`${r}/`,f).replace(".mdx","");console.log(p);let N=o[d];l.push(p),m.push([p,_o(N)]),a.push([p,N()]);let K=t[d.replace(".mdx",".meta.ts")];c.push([p,{__splat:p,...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
  `)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d1vij/jassm",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
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",