@d1vij/react-mdx-loader 0.1.1 → 0.1.2

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 +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{createContext as U,useContext as G}from"react";var p=U({});function o(){return G(p)}import{cn as R}from"@d1vij/shit-i-always-use";import{useState as W}from"react";import{jsxDEV as Z}from"react/jsx-dev-runtime";var Y=new URL(window.location.href).origin.toString();function X(t){let e=o(),[r]=W(()=>{if(t.href?.match(/^#.*/))return"_self";return new URL(t.href??"").origin.toString()===Y?"_self":"_blank"});return Z("a",{className:R(e.anchor),target:r,href:t.href,children:t.children},void 0,!1,void 0,this)}import{cn as $}from"@d1vij/shit-i-always-use";import{jsxDEV as x}from"react/jsx-dev-runtime";function c(t){let e=o();return x("blockquote",{className:$(e.blockquote),children:t.children},void 0,!1,void 0,this)}import{cn as A}from"@d1vij/shit-i-always-use";import{jsxDEV as Q}from"react/jsx-dev-runtime";function h(t){let e=o();return Q("span",{className:A(e.bold),children:t.children},void 0,!1,void 0,this)}import{cn as T}from"@d1vij/shit-i-always-use";import{jsxDEV as B}from"react/jsx-dev-runtime";function i(t){let e=o(),r=/language-(\w+)/.exec(t.className||"")?.[1];return B("code",{className:T(e.code,r&&`language-${r}`),children:t.children},void 0,!1,void 0,this)}import{cn as I,useClipboardText as H}from"@d1vij/shit-i-always-use";import{useEffect as D,useRef as v,useState as V}from"react";import{jsxDEV as _}from"react/jsx-dev-runtime";function n(t){let e=o(),r=v(null),[a,u]=V(""),{copy:z}=H();async function K(){let d=new URL(`/#${a}`,window.location.origin).toString();console.log("clicked"),await z(d)}return D(()=>{if(!r.current)return;let O=(r.current.textContent??"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").slice(0,30);u(O)},[]),_("h1",{className:I(e.header,e[`header_${t.level}`]),children:_("button",{onClick:()=>void K(),ref:r,id:a,type:"button",children:t.children},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{cn as j}from"@d1vij/shit-i-always-use";import{jsxDEV as tt}from"react/jsx-dev-runtime";function y(t){let e=o();return tt("img",{className:j(e.image),alt:t.alt,title:t.title,src:t.src},void 0,!1,void 0,this)}import{cn as et}from"@d1vij/shit-i-always-use";import{jsxDEV as ot}from"react/jsx-dev-runtime";function b(t){let e=o();return ot("span",{className:et(e.italic),children:t.children},void 0,!1,void 0,this)}import{cn as J}from"@d1vij/shit-i-always-use";import{jsxDEV as g}from"react/jsx-dev-runtime";function s(t){let e=o(),r=t.type==="ordered"?"ol":"ul";return g(r,{className:J(e.list,t.type==="ordered"&&e.ordered_list,t.type==="unordered"&&e.unordered_list),children:t.children},void 0,!1,void 0,this)}function P(t){let e=o();return g("li",{className:J(e.list_item),children:t.children},void 0,!1,void 0,this)}import{cn as rt}from"@d1vij/shit-i-always-use";import{jsxDEV as nt}from"react/jsx-dev-runtime";function C(t){let e=o();return nt("p",{className:rt(e.paragraph),children:t.children},void 0,!1,void 0,this)}import{cn as lt}from"@d1vij/shit-i-always-use";import{jsxDEV as mt}from"react/jsx-dev-runtime";function f(t){let e=o();return mt("pre",{className:lt(e.preformatted),children:t.children},void 0,!1,void 0,this)}import{cn as st}from"@d1vij/shit-i-always-use";import{jsxDEV as at}from"react/jsx-dev-runtime";function N(t){let e=o();return at("span",{className:st(e.striked),children:t.children},void 0,!1,void 0,this)}import{cn as l}from"@d1vij/shit-i-always-use";import{jsxDEV as m}from"react/jsx-dev-runtime";function M(t){let e=o();return m("table",{className:l(e.table),children:t.children},void 0,!1,void 0,this)}function E(t){let e=o();return m("thead",{className:l(e.table_head),children:t.children},void 0,!1,void 0,this)}function L(t){let e=o();return m("tbody",{className:l(e.table_body),children:t.children},void 0,!1,void 0,this)}function k(t){let e=o();return m("tr",{className:l(e.table_row),children:t.children},void 0,!1,void 0,this)}function q(t){let e=o();return m("th",{className:l(e.table_head_cell),children:t.children},void 0,!1,void 0,this)}function F(t){let e=o();return m("td",{className:l(e.table_data),children:t.children},void 0,!1,void 0,this)}var pt={h1:(t)=>n({...t,level:1}),h2:(t)=>n({...t,level:2}),h3:(t)=>n({...t,level:3}),h4:(t)=>n({...t,level:4}),h5:(t)=>n({...t,level:5}),h6:(t)=>n({...t,level:6}),a:X,em:b,del:N,strong:h,code:i,blockquote:c,pre:f,p:C,ol:(t)=>s({...t,type:"ordered"}),ul:(t)=>s({...t,type:"unordered"}),li:P,img:y,table:M,thead:E,tbody:L,th:q,tr:k,td:F},S=pt;import{jsxDEV as ct}from"react/jsx-dev-runtime";function w({SourceComponent:t}){return ct(t,{components:S},void 0,!1,void 0,this)}import it from"@mdx-js/rollup";function yt({mdxPluginOptions:t}){return{name:"react-mdx-loader-plugin",enforce:"pre",config(e){return{...e,plugins:[it(t)]}}}}export{p as StyleContext,yt as MDXLoaderPlugin,w as MDXFromComponent};
1
+ import{createContext as U,useContext as G}from"react";var p=U({});function o(){return G(p)}import{cn as R}from"@d1vij/shit-i-always-use";import{useMemo as W,useState as Y}from"react";import{jsxDEV as Z}from"react/jsx-dev-runtime";function h(t){let e=W(()=>new URL(window.location.href).origin.toString(),[]),r=o(),[s]=Y(()=>{if(t.href?.match(/^#.*/))return"_self";return new URL(t.href??"").origin.toString()===e?"_self":"_blank"});return Z("a",{className:R(r.anchor),target:s,href:t.href,children:t.children},void 0,!1,void 0,this)}import{cn as $}from"@d1vij/shit-i-always-use";import{jsxDEV as x}from"react/jsx-dev-runtime";function c(t){let e=o();return x("blockquote",{className:$(e.blockquote),children:t.children},void 0,!1,void 0,this)}import{cn as A}from"@d1vij/shit-i-always-use";import{jsxDEV as Q}from"react/jsx-dev-runtime";function _(t){let e=o();return Q("span",{className:A(e.bold),children:t.children},void 0,!1,void 0,this)}import{cn as T}from"@d1vij/shit-i-always-use";import{jsxDEV as B}from"react/jsx-dev-runtime";function i(t){let e=o(),r=/language-(\w+)/.exec(t.className||"")?.[1];return B("code",{className:T(e.code,r&&`language-${r}`),children:t.children},void 0,!1,void 0,this)}import{cn as I,useClipboardText as H}from"@d1vij/shit-i-always-use";import{useEffect as D,useRef as v,useState as V}from"react";import{jsxDEV as b}from"react/jsx-dev-runtime";function n(t){let e=o(),r=v(null),[s,u]=V(""),{copy:d}=H();async function K(){let X=new URL(`/#${s}`,window.location.origin).toString();console.log("clicked"),await d(X)}return D(()=>{if(!r.current)return;let O=(r.current.textContent??"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").slice(0,30);u(O)},[]),b("h1",{className:I(e.header,e[`header_${t.level}`]),children:b("button",{onClick:()=>void K(),ref:r,id:s,type:"button",children:t.children},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{cn as j}from"@d1vij/shit-i-always-use";import{jsxDEV as tt}from"react/jsx-dev-runtime";function y(t){let e=o();return tt("img",{className:j(e.image),alt:t.alt,title:t.title,src:t.src},void 0,!1,void 0,this)}import{cn as et}from"@d1vij/shit-i-always-use";import{jsxDEV as ot}from"react/jsx-dev-runtime";function J(t){let e=o();return ot("span",{className:et(e.italic),children:t.children},void 0,!1,void 0,this)}import{cn as P}from"@d1vij/shit-i-always-use";import{jsxDEV as C}from"react/jsx-dev-runtime";function a(t){let e=o(),r=t.type==="ordered"?"ol":"ul";return C(r,{className:P(e.list,t.type==="ordered"&&e.ordered_list,t.type==="unordered"&&e.unordered_list),children:t.children},void 0,!1,void 0,this)}function g(t){let e=o();return C("li",{className:P(e.list_item),children:t.children},void 0,!1,void 0,this)}import{cn as rt}from"@d1vij/shit-i-always-use";import{jsxDEV as nt}from"react/jsx-dev-runtime";function N(t){let e=o();return nt("p",{className:rt(e.paragraph),children:t.children},void 0,!1,void 0,this)}import{cn as lt}from"@d1vij/shit-i-always-use";import{jsxDEV as mt}from"react/jsx-dev-runtime";function f(t){let e=o();return mt("pre",{className:lt(e.preformatted),children:t.children},void 0,!1,void 0,this)}import{cn as st}from"@d1vij/shit-i-always-use";import{jsxDEV as at}from"react/jsx-dev-runtime";function M(t){let e=o();return at("span",{className:st(e.striked),children:t.children},void 0,!1,void 0,this)}import{cn as l}from"@d1vij/shit-i-always-use";import{jsxDEV as m}from"react/jsx-dev-runtime";function E(t){let e=o();return m("table",{className:l(e.table),children:t.children},void 0,!1,void 0,this)}function L(t){let e=o();return m("thead",{className:l(e.table_head),children:t.children},void 0,!1,void 0,this)}function k(t){let e=o();return m("tbody",{className:l(e.table_body),children:t.children},void 0,!1,void 0,this)}function q(t){let e=o();return m("tr",{className:l(e.table_row),children:t.children},void 0,!1,void 0,this)}function F(t){let e=o();return m("th",{className:l(e.table_head_cell),children:t.children},void 0,!1,void 0,this)}function w(t){let e=o();return m("td",{className:l(e.table_data),children:t.children},void 0,!1,void 0,this)}var pt={h1:(t)=>n({...t,level:1}),h2:(t)=>n({...t,level:2}),h3:(t)=>n({...t,level:3}),h4:(t)=>n({...t,level:4}),h5:(t)=>n({...t,level:5}),h6:(t)=>n({...t,level:6}),a:h,em:J,del:M,strong:_,code:i,blockquote:c,pre:f,p:N,ol:(t)=>a({...t,type:"ordered"}),ul:(t)=>a({...t,type:"unordered"}),li:g,img:y,table:E,thead:L,tbody:k,th:F,tr:q,td:w},S=pt;import{jsxDEV as ct}from"react/jsx-dev-runtime";function z({SourceComponent:t}){return ct(t,{components:S},void 0,!1,void 0,this)}import it from"@mdx-js/rollup";function yt({mdxPluginOptions:t}){return{name:"react-mdx-loader-plugin",enforce:"pre",config(e){return{...e,plugins:[it(t)]}}}}export{p as StyleContext,yt as MDXLoaderPlugin,z as MDXFromComponent};
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/d1vij/react-mdx-loader"
6
6
  },
7
7
  "homepage": "https://github.com/d1vij/react-mdx-loader",
8
- "version": "0.1.1",
8
+ "version": "0.1.2",
9
9
  "description": "Supporting lib to create content driven sites using MDX",
10
10
  "license": "MIT",
11
11
  "files": [