react-markdown-table-ts 1.4.9 → 1.4.11
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/MarkdownTable.d.ts.map +1 -1
- package/dist/index.cjs +14 -14
- package/dist/index.mjs +82 -82
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownTable.d.ts","sourceRoot":"","sources":["../src/MarkdownTable.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA0E7D,wBAAgB,aAAa,CAAC,EAC5B,SAAgB,EAChB,SAAgB,EAChB,gBAAqB,EACrB,SAAiB,EACjB,OAAe,EACf,UAAiB,EACjB,iBAAyB,EACzB,SAAS,EACT,UAAU,EACV,KAAe,EACf,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"MarkdownTable.d.ts","sourceRoot":"","sources":["../src/MarkdownTable.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA0E7D,wBAAgB,aAAa,CAAC,EAC5B,SAAgB,EAChB,SAAgB,EAChB,gBAAqB,EACrB,SAAiB,EACjB,OAAe,EACf,UAAiB,EACjB,iBAAyB,EACzB,SAAS,EACT,UAAU,EACV,KAAe,EACf,QAAQ,EACR,UAAc,EACd,QAAQ,EACR,eAAsB,GACvB,EAAE,kBAAkB,2CA4EpB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react");var q={exports:{}},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react");var q={exports:{}},Y={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ke;function gr(){if(ke)return
|
|
9
|
+
*/var ke;function gr(){if(ke)return Y;ke=1;var a=S,t=Symbol.for("react.element"),i=Symbol.for("react.fragment"),d=Object.prototype.hasOwnProperty,u=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function h(p,m,E){var b,R={},T=null,k=null;E!==void 0&&(T=""+E),m.key!==void 0&&(T=""+m.key),m.ref!==void 0&&(k=m.ref);for(b in m)d.call(m,b)&&!g.hasOwnProperty(b)&&(R[b]=m[b]);if(p&&p.defaultProps)for(b in m=p.defaultProps,m)R[b]===void 0&&(R[b]=m[b]);return{$$typeof:t,type:p,key:T,ref:k,props:R,_owner:u.current}}return Y.Fragment=i,Y.jsx=h,Y.jsxs=h,Y}var L={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,41 +14,41 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Oe;function pr(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&(function(){var a=S,t=Symbol.for("react.element"),i=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),p=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),
|
|
17
|
+
*/var Oe;function pr(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&(function(){var a=S,t=Symbol.for("react.element"),i=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),p=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),O=Symbol.iterator,z="@@iterator";function M(e){if(e===null||typeof e!="object")return null;var r=O&&e[O]||e[z];return typeof r=="function"?r:null}var A=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){{for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];Pe("error",e,n)}}function Pe(e,r,n){{var o=A.ReactDebugCurrentFrame,c=o.getStackAddendum();c!==""&&(r+="%s",n=n.concat([c]));var f=n.map(function(l){return String(l)});f.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,f)}}var Ae=!1,Fe=!1,De=!1,Ie=!1,Me=!1,ne;ne=Symbol.for("react.module.reference");function We(e){return!!(typeof e=="string"||typeof e=="function"||e===d||e===g||Me||e===u||e===E||e===b||Ie||e===k||Ae||Fe||De||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===R||e.$$typeof===h||e.$$typeof===p||e.$$typeof===m||e.$$typeof===ne||e.getModuleId!==void 0))}function Ne(e,r,n){var o=e.displayName;if(o)return o;var c=r.displayName||r.name||"";return c!==""?n+"("+c+")":n}function ae(e){return e.displayName||"Context"}function j(e){if(e==null)return null;if(typeof e.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case d:return"Fragment";case i:return"Portal";case g:return"Profiler";case u:return"StrictMode";case E:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var r=e;return ae(r)+".Consumer";case h:var n=e;return ae(n._context)+".Provider";case m:return Ne(e,e.render,"ForwardRef");case R:var o=e.displayName||null;return o!==null?o:j(e.type)||"Memo";case T:{var c=e,f=c._payload,l=c._init;try{return j(l(f))}catch{return null}}}return null}var $=Object.assign,W=0,oe,ie,se,le,ue,ce,fe;function de(){}de.__reactDisabledLog=!0;function Ye(){{if(W===0){oe=console.log,ie=console.info,se=console.warn,le=console.error,ue=console.group,ce=console.groupCollapsed,fe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:de,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function Le(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},e,{value:oe}),info:$({},e,{value:ie}),warn:$({},e,{value:se}),error:$({},e,{value:le}),group:$({},e,{value:ue}),groupCollapsed:$({},e,{value:ce}),groupEnd:$({},e,{value:fe})})}W<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=A.ReactCurrentDispatcher,X;function V(e,r,n){{if(X===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);X=o&&o[1]||""}return`
|
|
18
18
|
`+X+e}}var G=!1,U;{var Be=typeof WeakMap=="function"?WeakMap:Map;U=new Be}function ge(e,r){if(!e||G)return"";{var n=U.get(e);if(n!==void 0)return n}var o;G=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var f;f=K.current,K.current=null,Ye();try{if(r){var l=function(){throw Error()};if(Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(C){o=C}Reflect.construct(e,[],l)}else{try{l.call()}catch(C){o=C}e.call(l.prototype)}}else{try{throw Error()}catch(C){o=C}e()}}catch(C){if(C&&o&&typeof C.stack=="string"){for(var s=C.stack.split(`
|
|
19
19
|
`),_=o.stack.split(`
|
|
20
20
|
`),v=s.length-1,y=_.length-1;v>=1&&y>=0&&s[v]!==_[y];)y--;for(;v>=1&&y>=0;v--,y--)if(s[v]!==_[y]){if(v!==1||y!==1)do if(v--,y--,y<0||s[v]!==_[y]){var x=`
|
|
21
|
-
`+s[v].replace(" at new "," at ");return e.displayName&&x.includes("<anonymous>")&&(x=x.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,x),x}while(v>=1&&y>=0);break}}}finally{G=!1,K.current=f,Le(),Error.prepareStackTrace=c}var
|
|
21
|
+
`+s[v].replace(" at new "," at ");return e.displayName&&x.includes("<anonymous>")&&(x=x.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,x),x}while(v>=1&&y>=0);break}}}finally{G=!1,K.current=f,Le(),Error.prepareStackTrace=c}var D=e?e.displayName||e.name:"",P=D?V(D):"";return typeof e=="function"&&U.set(e,P),P}function ze(e,r,n){return ge(e,!1)}function Ve(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,n){if(e==null)return"";if(typeof e=="function")return ge(e,Ve(e));if(typeof e=="string")return V(e);switch(e){case E:return V("Suspense");case b:return V("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case m:return ze(e.render);case R:return H(e.type,r,n);case T:{var o=e,c=o._payload,f=o._init;try{return H(f(c),r,n)}catch{}}}return""}var N=Object.prototype.hasOwnProperty,pe={},me=A.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,n=H(e.type,e._source,r?r.type:null);me.setExtraStackFrame(n)}else me.setExtraStackFrame(null)}function Ue(e,r,n,o,c){{var f=Function.call.bind(N);for(var l in e)if(f(e,l)){var s=void 0;try{if(typeof e[l]!="function"){var _=Error((o||"React class")+": "+n+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw _.name="Invariant Violation",_}s=e[l](r,l,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(v){s=v}s&&!(s instanceof Error)&&(J(c),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",n,l,typeof s),J(null)),s instanceof Error&&!(s.message in pe)&&(pe[s.message]=!0,J(c),w("Failed %s type: %s",n,s.message),J(null))}}}var He=Array.isArray;function Z(e){return He(e)}function Je(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function qe(e){try{return he(e),!1}catch{return!0}}function he(e){return""+e}function ve(e){if(qe(e))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Je(e)),he(e)}var be=A.ReactCurrentOwner,Ke={key:!0,ref:!0,__self:!0,__source:!0},ye,Re;function Xe(e){if(N.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ge(e){if(N.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ze(e,r){typeof e.ref=="string"&&be.current}function Qe(e,r){{var n=function(){ye||(ye=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function er(e,r){{var n=function(){Re||(Re=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var rr=function(e,r,n,o,c,f,l){var s={$$typeof:t,type:e,key:r,ref:n,props:l,_owner:f};return s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s};function tr(e,r,n,o,c){{var f,l={},s=null,_=null;n!==void 0&&(ve(n),s=""+n),Ge(r)&&(ve(r.key),s=""+r.key),Xe(r)&&(_=r.ref,Ze(r,c));for(f in r)N.call(r,f)&&!Ke.hasOwnProperty(f)&&(l[f]=r[f]);if(e&&e.defaultProps){var v=e.defaultProps;for(f in v)l[f]===void 0&&(l[f]=v[f])}if(s||_){var y=typeof e=="function"?e.displayName||e.name||"Unknown":e;s&&Qe(l,y),_&&er(l,y)}return rr(e,s,_,c,o,be.current,l)}}var Q=A.ReactCurrentOwner,Ee=A.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,n=H(e.type,e._source,r?r.type:null);Ee.setExtraStackFrame(n)}else Ee.setExtraStackFrame(null)}var ee;ee=!1;function re(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function we(){{if(Q.current){var e=j(Q.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function nr(e){return""}var _e={};function ar(e){{var r=we();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+n+">.")}return r}}function Ce(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=ar(r);if(_e[n])return;_e[n]=!0;var o="";e&&e._owner&&e._owner!==Q.current&&(o=" It was passed a child from "+
|
|
25
|
+
Check the top-level render call using <`+n+">.")}return r}}function Ce(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=ar(r);if(_e[n])return;_e[n]=!0;var o="";e&&e._owner&&e._owner!==Q.current&&(o=" It was passed a child from "+j(e._owner.type)+"."),F(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,o),F(null)}}function Te(e,r){{if(typeof e!="object")return;if(Z(e))for(var n=0;n<e.length;n++){var o=e[n];re(o)&&Ce(o,r)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var c=M(e);if(typeof c=="function"&&c!==e.entries)for(var f=c.call(e),l;!(l=f.next()).done;)re(l.value)&&Ce(l.value,r)}}}function or(e){{var r=e.type;if(r==null||typeof r=="string")return;var n;if(typeof r=="function")n=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===m||r.$$typeof===R))n=r.propTypes;else return;if(n){var o=j(r);Ue(n,e.props,"prop",o,e)}else if(r.PropTypes!==void 0&&!ee){ee=!0;var c=j(r);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",c||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ir(e){{for(var r=Object.keys(e.props),n=0;n<r.length;n++){var o=r[n];if(o!=="children"&&o!=="key"){F(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),F(null);break}}e.ref!==null&&(F(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}var xe={};function Se(e,r,n,o,c,f){{var l=We(e);if(!l){var s="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(s+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=nr();_?s+=_:s+=we();var v;e===null?v="null":Z(e)?v="array":e!==void 0&&e.$$typeof===t?(v="<"+(j(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):v=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",v,s)}var y=tr(e,r,n,c,f);if(y==null)return y;if(l){var x=r.children;if(x!==void 0)if(o)if(Z(x)){for(var D=0;D<x.length;D++)Te(x[D],e);Object.freeze&&Object.freeze(x)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Te(x,e)}if(N.call(r,"key")){var P=j(e),C=Object.keys(r).filter(function(dr){return dr!=="key"}),te=C.length>0?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}";if(!xe[P+te]){var fr=C.length>0?"{"+C.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,te,P,fr,P),xe[P+te]=!0}}return e===d?ir(y):or(y),y}}function sr(e,r,n){return Se(e,r,n,!0)}function lr(e,r,n){return Se(e,r,n,!1)}var ur=lr,cr=sr;
|
|
31
|
-
`).map((b,R)=>d+R);return S.createElement("pre",{className:`language-markdown ${i?"line-numbers":""} ${u}`.trim(),"data-start":d,style:{position:"relative",counterReset:`linenumber ${d-1}`,...i?{paddingLeft:"1.2em"}:{},...g}},[S.createElement("code",{key:"code",className:"language-markdown"},t),i&&S.createElement("span",{key:"line-numbers",className:"line-numbers-rows","aria-hidden":"true",style:{position:"absolute",pointerEvents:"none",top:`${1+h/16}em`,fontSize:"100%",left:"0em",width:"2.5em",letterSpacing:"-1px",borderRight:"1px solid #999",userSelect:"none",lineHeight:"1.5"}},E.map((b,R)=>S.createElement("span",{key:R,style:{display:"block",textAlign:"right",paddingRight:"0.8em",color:"#999",lineHeight:"1.5"}},b)))].filter(Boolean))}function
|
|
30
|
+
<%s key={someKey} {...props} />`,te,P,fr,P),xe[P+te]=!0}}return e===d?ir(y):or(y),y}}function sr(e,r,n){return Se(e,r,n,!0)}function lr(e,r,n){return Se(e,r,n,!1)}var ur=lr,cr=sr;L.Fragment=d,L.jsx=ur,L.jsxs=cr})()),L}var je;function mr(){return je||(je=1,process.env.NODE_ENV==="production"?q.exports=gr():q.exports=pr()),q.exports}var B=mr();function hr(a){const{children:t,showLineNumbers:i=!1,startLine:d=1,className:u="",style:g={},topPadding:h=16}=a,E=(typeof t=="string"?t:"").split(`
|
|
31
|
+
`).map((b,R)=>d+R);return S.createElement("pre",{className:`language-markdown ${i?"line-numbers":""} ${u}`.trim(),"data-start":d,style:{position:"relative",counterReset:`linenumber ${d-1}`,...i?{paddingLeft:"1.2em"}:{},...g}},[S.createElement("code",{key:"code",className:"language-markdown"},t),i&&S.createElement("span",{key:"line-numbers",className:"line-numbers-rows","aria-hidden":"true",style:{position:"absolute",pointerEvents:"none",top:`${1+h/16}em`,fontSize:"100%",left:"0em",width:"2.5em",letterSpacing:"-1px",borderRight:"1px solid #999",userSelect:"none",lineHeight:"1.5"}},E.map((b,R)=>S.createElement("span",{key:R,style:{display:"block",textAlign:"right",paddingRight:"0.8em",color:"#999",lineHeight:"1.5"}},b)))].filter(Boolean))}function $e(a){let t;return a.useTabs?t=" ":a.hasPadding?t=" ":t="",t}class vr{padding;constructor(t){this.padding=$e(t)}formatCell(t,i,d){const u=d;switch(i){case"right":return`${this.padding}${t.padStart(u)}${this.padding}`;case"center":{const g=u-t.length,h=Math.floor(g/2),p=g-h;return`${this.padding}${" ".repeat(h)}${t}${" ".repeat(p)}${this.padding}`}default:return`${this.padding}${t.padEnd(u)}${this.padding}`}}}class br{static indicators={left:t=>`:${"-".repeat(t-1)}`,right:t=>`${"-".repeat(t-1)}:`,center:t=>`:${"-".repeat(t-2)}:`,none:t=>"-".repeat(t)};static formatIndicator(t,i){return this.indicators[t](i)}}class yr{config;cellFormatter;adjustedAlignments;constructor(t){this.config=t,this.cellFormatter=new vr(t),this.adjustedAlignments=this.getAdjustedAlignments()}getAdjustedAlignments(){return this.config.columnAlignments.length<this.config.columnCount?[...Array.from(this.config.columnAlignments),...Array(this.config.columnCount-this.config.columnAlignments.length).fill("none")]:Array.from(this.config.columnAlignments)}formatRow(t){return`|${Array.from({length:this.config.columnCount},(d,u)=>{let g=t[u]??"";this.config.replaceNewlines&&(g=g.replace(/\n/g,"<br>"));const h=this.adjustedAlignments[u],p=this.config.columnWidths?this.config.columnWidths[u]:g.length;return this.cellFormatter.formatCell(g,h,p)}).join("|")}|`}formatAlignmentRow(){const t=$e(this.config);return`|${Array.from({length:this.config.columnCount},(d,u)=>{const g=this.adjustedAlignments[u],h=this.config.columnWidths?this.config.columnWidths[u]:3,p=br.formatIndicator(g,h);return`${t}${p}${t}`}).join("|")}|`}}function Rr(a,t){const i=new Array(t).fill(3);return a.forEach(d=>{for(let u=0;u<t;u++){const g=d[u]??"";i[u]=Math.max(i[u],g.length)}}),i}function Er(a){const t=a.inputDataHeader.length,i=a.inputDataBody.map(d=>d.length);return Math.max(t,...i)}function wr(a,t,i){return i?Rr([a.inputDataHeader,...a.inputDataBody],t):void 0}function _r(a,t,i=!0,d=!1,u=!1,g=!0){const h=Er(a),p=wr(a,h,i),m={columnCount:h,columnAlignments:t,columnWidths:p,useTabs:d,replaceNewlines:u,hasPadding:g},E=new yr(m),b=E.formatRow(a.inputDataHeader),R=E.formatAlignmentRow(),T=a.inputDataBody.map(k=>E.formatRow(k)).join(`
|
|
32
32
|
`);return`${b}
|
|
33
33
|
${R}
|
|
34
|
-
${T}`.trimEnd()}function Cr(a){let t="",i=a;for(;i>=0;)t=String.fromCharCode(i%26+65)+t,i=Math.floor(i/26)-1;return t}function Tr(a){return Array.from({length:a},(t,i)=>Cr(i))}class
|
|
34
|
+
${T}`.trimEnd()}function Cr(a){let t="",i=a;for(;i>=0;)t=String.fromCharCode(i%26+65)+t,i=Math.floor(i/26)-1;return t}function Tr(a){return Array.from({length:a},(t,i)=>Cr(i))}class I extends Error{constructor(t,i){super(t,i),this.name="MarkdownTableError",Object.setPrototypeOf(this,I.prototype)}}function xr(a){if(a===null||!Array.isArray(a))throw new I("The 'data' prop must be a two-dimensional array.");if(a.length===0)throw new I("The 'data' array must contain at least one row.")}function Sr(a){return a==="light"?{textColor:"#000",textShadow:"0 1px #fff",background:"#f5f2f0",selectionBackground:"#b3d4fc"}:{textColor:"#f8f8f2",textShadow:"0 1px rgba(0,0,0,.3)",background:"#282a36",selectionBackground:"#b3d4fc",borderRadius:".3em"}}function kr(a){const t=Sr(a);return`
|
|
35
35
|
code[class*=language-],pre[class*=language-]{color:${t.textColor};background:0 0;text-shadow:${t.textShadow};font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:${t.selectionBackground}}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:${t.selectionBackground}}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:visible${t.borderRadius?`;border-radius:${t.borderRadius}`:""}}:not(pre)>code[class*=language-],pre[class*=language-]{background:${t.background}}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:3.8em}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block}
|
|
36
|
-
`}function Or(a,t){return t?{inputDataHeader:a[0],inputDataBody:a.slice(1)}:{inputDataHeader:Tr(a[0].length),inputDataBody:a}}function jr(a,t,i,d,u,g,h){try{xr(a);const{inputDataHeader:p,inputDataBody:m}=Or(a,t);return _r({inputDataHeader:p,inputDataBody:m},i,d,u,g,h)}catch(p){if(p instanceof
|
|
36
|
+
`}function Or(a,t){return t?{inputDataHeader:a[0],inputDataBody:a.slice(1)}:{inputDataHeader:Tr(a[0].length),inputDataBody:a}}function jr(a,t,i,d,u,g,h){try{xr(a);const{inputDataHeader:p,inputDataBody:m}=Or(a,t);return _r({inputDataHeader:p,inputDataBody:m},i,d,u,g,h)}catch(p){if(p instanceof I)return`Error: ${p.message}`;throw p}}function $r({inputData:a=null,hasHeader:t=!0,columnAlignments:i=[],isCompact:d=!1,hasTabs:u=!1,hasPadding:g=!0,convertLineBreaks:h=!1,className:p,onGenerate:m,theme:E="light",preStyle:b,topPadding:R=0,minWidth:T,showLineNumbers:k=!0}){const O=S.useId(),z=S.useDeferredValue(a),M=S.useMemo(()=>jr(z,t,i,!d,u,h,g),[z,t,i,d,u,h,g]);return S.useEffect(()=>{m&&m(M)},[M,m]),B.jsxs(B.Fragment,{children:[B.jsxs("style",{children:[kr(E),`
|
|
37
37
|
/* Add top spacing for the table content */
|
|
38
|
-
pre > code {
|
|
38
|
+
#${O} pre > code {
|
|
39
39
|
display: block;
|
|
40
40
|
padding-top: ${R}px !important;
|
|
41
41
|
padding-left: 3em !important;
|
|
42
42
|
}
|
|
43
43
|
/* Hide line numbers when disabled */
|
|
44
|
-
pre:not(.line-numbers) .line-numbers-rows {
|
|
44
|
+
#${O} pre:not(.line-numbers) .line-numbers-rows {
|
|
45
45
|
display: none !important;
|
|
46
46
|
}
|
|
47
|
-
pre:not(.line-numbers) > code {
|
|
47
|
+
#${O} pre:not(.line-numbers) > code {
|
|
48
48
|
padding-left: 0.3em !important;
|
|
49
49
|
}
|
|
50
50
|
/* Ensure line numbers are visible */
|
|
51
|
-
.line-numbers .line-numbers-rows {
|
|
51
|
+
#${O} .line-numbers .line-numbers-rows {
|
|
52
52
|
display: block !important;
|
|
53
53
|
}
|
|
54
|
-
`]}),
|
|
54
|
+
`]}),B.jsx("div",{id:O,style:{position:"relative",isolation:"isolate",display:"inline-block"},children:B.jsx(hr,{showLineNumbers:k,className:`${E==="dark"?"dark-theme":""} ${p||""}`.trim(),topPadding:R,style:{width:"fit-content",minWidth:T?`${T}px`:"min-content",margin:0,...b},children:M})})]})}exports.MarkdownTable=$r;exports.MarkdownTableError=I;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var q = { exports: {} },
|
|
1
|
+
import D, { useId as gr, useDeferredValue as pr, useMemo as mr, useEffect as hr } from "react";
|
|
2
|
+
var q = { exports: {} }, N = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.min.js
|
|
@@ -11,9 +11,9 @@ var q = { exports: {} }, M = {};
|
|
|
11
11
|
*/
|
|
12
12
|
var ke;
|
|
13
13
|
function vr() {
|
|
14
|
-
if (ke) return
|
|
14
|
+
if (ke) return N;
|
|
15
15
|
ke = 1;
|
|
16
|
-
var a =
|
|
16
|
+
var a = D, t = Symbol.for("react.element"), i = Symbol.for("react.fragment"), d = Object.prototype.hasOwnProperty, u = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
17
|
function h(p, m, E) {
|
|
18
18
|
var b, R = {}, x = null, S = null;
|
|
19
19
|
E !== void 0 && (x = "" + E), m.key !== void 0 && (x = "" + m.key), m.ref !== void 0 && (S = m.ref);
|
|
@@ -21,9 +21,9 @@ function vr() {
|
|
|
21
21
|
if (p && p.defaultProps) for (b in m = p.defaultProps, m) R[b] === void 0 && (R[b] = m[b]);
|
|
22
22
|
return { $$typeof: t, type: p, key: x, ref: S, props: R, _owner: u.current };
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return N.Fragment = i, N.jsx = h, N.jsxs = h, N;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var Y = {};
|
|
27
27
|
/**
|
|
28
28
|
* @license React
|
|
29
29
|
* react-jsx-runtime.development.js
|
|
@@ -36,11 +36,11 @@ var N = {};
|
|
|
36
36
|
var Oe;
|
|
37
37
|
function br() {
|
|
38
38
|
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
39
|
-
var a =
|
|
40
|
-
function
|
|
39
|
+
var a = D, t = Symbol.for("react.element"), i = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), h = Symbol.for("react.provider"), p = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), E = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), k = Symbol.iterator, z = "@@iterator";
|
|
40
|
+
function I(e) {
|
|
41
41
|
if (e === null || typeof e != "object")
|
|
42
42
|
return null;
|
|
43
|
-
var r =
|
|
43
|
+
var r = k && e[k] || e[z];
|
|
44
44
|
return typeof r == "function" ? r : null;
|
|
45
45
|
}
|
|
46
46
|
var P = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
@@ -48,10 +48,10 @@ function br() {
|
|
|
48
48
|
{
|
|
49
49
|
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++)
|
|
50
50
|
n[o - 1] = arguments[o];
|
|
51
|
-
|
|
51
|
+
Pe("error", e, n);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Pe(e, r, n) {
|
|
55
55
|
{
|
|
56
56
|
var o = P.ReactDebugCurrentFrame, c = o.getStackAddendum();
|
|
57
57
|
c !== "" && (r += "%s", n = n.concat([c]));
|
|
@@ -61,10 +61,10 @@ function br() {
|
|
|
61
61
|
f.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, f);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
var
|
|
64
|
+
var Ae = !1, Fe = !1, De = !1, Ie = !1, We = !1, ne;
|
|
65
65
|
ne = Symbol.for("react.module.reference");
|
|
66
66
|
function Me(e) {
|
|
67
|
-
return !!(typeof e == "string" || typeof e == "function" || e === d || e === g || We || e === u || e === E || e === b || Ie || e === S ||
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === d || e === g || We || e === u || e === E || e === b || Ie || e === S || Ae || Fe || De || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === R || e.$$typeof === h || e.$$typeof === p || e.$$typeof === m || // This needs to include all possible module reference object
|
|
68
68
|
// types supported by any Flight configuration anywhere since
|
|
69
69
|
// we don't know which Flight build this will end up being used
|
|
70
70
|
// with.
|
|
@@ -80,7 +80,7 @@ function br() {
|
|
|
80
80
|
function ae(e) {
|
|
81
81
|
return e.displayName || "Context";
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function O(e) {
|
|
84
84
|
if (e == null)
|
|
85
85
|
return null;
|
|
86
86
|
if (typeof e.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
@@ -113,11 +113,11 @@ function br() {
|
|
|
113
113
|
return Ne(e, e.render, "ForwardRef");
|
|
114
114
|
case R:
|
|
115
115
|
var o = e.displayName || null;
|
|
116
|
-
return o !== null ? o :
|
|
116
|
+
return o !== null ? o : O(e.type) || "Memo";
|
|
117
117
|
case x: {
|
|
118
118
|
var c = e, f = c._payload, l = c._init;
|
|
119
119
|
try {
|
|
120
|
-
return
|
|
120
|
+
return O(l(f));
|
|
121
121
|
} catch {
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
@@ -125,13 +125,13 @@ function br() {
|
|
|
125
125
|
}
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
|
-
var
|
|
128
|
+
var j = Object.assign, W = 0, oe, ie, se, le, ue, ce, fe;
|
|
129
129
|
function de() {
|
|
130
130
|
}
|
|
131
131
|
de.__reactDisabledLog = !0;
|
|
132
132
|
function Ye() {
|
|
133
133
|
{
|
|
134
|
-
if (
|
|
134
|
+
if (W === 0) {
|
|
135
135
|
oe = console.log, ie = console.info, se = console.warn, le = console.error, ue = console.group, ce = console.groupCollapsed, fe = console.groupEnd;
|
|
136
136
|
var e = {
|
|
137
137
|
configurable: !0,
|
|
@@ -149,42 +149,42 @@ function br() {
|
|
|
149
149
|
groupEnd: e
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
W++;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
function Le() {
|
|
156
156
|
{
|
|
157
|
-
if (
|
|
157
|
+
if (W--, W === 0) {
|
|
158
158
|
var e = {
|
|
159
159
|
configurable: !0,
|
|
160
160
|
enumerable: !0,
|
|
161
161
|
writable: !0
|
|
162
162
|
};
|
|
163
163
|
Object.defineProperties(console, {
|
|
164
|
-
log:
|
|
164
|
+
log: j({}, e, {
|
|
165
165
|
value: oe
|
|
166
166
|
}),
|
|
167
|
-
info:
|
|
167
|
+
info: j({}, e, {
|
|
168
168
|
value: ie
|
|
169
169
|
}),
|
|
170
|
-
warn:
|
|
170
|
+
warn: j({}, e, {
|
|
171
171
|
value: se
|
|
172
172
|
}),
|
|
173
|
-
error:
|
|
173
|
+
error: j({}, e, {
|
|
174
174
|
value: le
|
|
175
175
|
}),
|
|
176
|
-
group:
|
|
176
|
+
group: j({}, e, {
|
|
177
177
|
value: ue
|
|
178
178
|
}),
|
|
179
|
-
groupCollapsed:
|
|
179
|
+
groupCollapsed: j({}, e, {
|
|
180
180
|
value: ce
|
|
181
181
|
}),
|
|
182
|
-
groupEnd:
|
|
182
|
+
groupEnd: j({}, e, {
|
|
183
183
|
value: fe
|
|
184
184
|
})
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
W < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
var K = P.ReactCurrentDispatcher, X;
|
|
@@ -274,8 +274,8 @@ function br() {
|
|
|
274
274
|
} finally {
|
|
275
275
|
G = !1, K.current = f, Le(), Error.prepareStackTrace = c;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
278
|
-
return typeof e == "function" && U.set(e,
|
|
277
|
+
var F = e ? e.displayName || e.name : "", $ = F ? V(F) : "";
|
|
278
|
+
return typeof e == "function" && U.set(e, $), $;
|
|
279
279
|
}
|
|
280
280
|
function ze(e, r, n) {
|
|
281
281
|
return ge(e, !1);
|
|
@@ -313,7 +313,7 @@ function br() {
|
|
|
313
313
|
}
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
|
-
var
|
|
316
|
+
var M = Object.prototype.hasOwnProperty, pe = {}, me = P.ReactDebugCurrentFrame;
|
|
317
317
|
function J(e) {
|
|
318
318
|
if (e) {
|
|
319
319
|
var r = e._owner, n = H(e.type, e._source, r ? r.type : null);
|
|
@@ -323,7 +323,7 @@ function br() {
|
|
|
323
323
|
}
|
|
324
324
|
function Ue(e, r, n, o, c) {
|
|
325
325
|
{
|
|
326
|
-
var f = Function.call.bind(
|
|
326
|
+
var f = Function.call.bind(M);
|
|
327
327
|
for (var l in e)
|
|
328
328
|
if (f(e, l)) {
|
|
329
329
|
var s = void 0;
|
|
@@ -371,7 +371,7 @@ function br() {
|
|
|
371
371
|
__source: !0
|
|
372
372
|
}, ye, Re;
|
|
373
373
|
function Xe(e) {
|
|
374
|
-
if (
|
|
374
|
+
if (M.call(e, "ref")) {
|
|
375
375
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
376
|
if (r && r.isReactWarning)
|
|
377
377
|
return !1;
|
|
@@ -379,7 +379,7 @@ function br() {
|
|
|
379
379
|
return e.ref !== void 0;
|
|
380
380
|
}
|
|
381
381
|
function Ge(e) {
|
|
382
|
-
if (
|
|
382
|
+
if (M.call(e, "key")) {
|
|
383
383
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
384
|
if (r && r.isReactWarning)
|
|
385
385
|
return !1;
|
|
@@ -445,7 +445,7 @@ function br() {
|
|
|
445
445
|
var f, l = {}, s = null, _ = null;
|
|
446
446
|
n !== void 0 && (ve(n), s = "" + n), Ge(r) && (ve(r.key), s = "" + r.key), Xe(r) && (_ = r.ref, Ze(r, c));
|
|
447
447
|
for (f in r)
|
|
448
|
-
|
|
448
|
+
M.call(r, f) && !Ke.hasOwnProperty(f) && (l[f] = r[f]);
|
|
449
449
|
if (e && e.defaultProps) {
|
|
450
450
|
var v = e.defaultProps;
|
|
451
451
|
for (f in v)
|
|
@@ -474,7 +474,7 @@ function br() {
|
|
|
474
474
|
function we() {
|
|
475
475
|
{
|
|
476
476
|
if (Q.current) {
|
|
477
|
-
var e =
|
|
477
|
+
var e = O(Q.current.type);
|
|
478
478
|
if (e)
|
|
479
479
|
return `
|
|
480
480
|
|
|
@@ -509,7 +509,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
509
509
|
return;
|
|
510
510
|
_e[n] = !0;
|
|
511
511
|
var o = "";
|
|
512
|
-
e && e._owner && e._owner !== Q.current && (o = " It was passed a child from " +
|
|
512
|
+
e && e._owner && e._owner !== Q.current && (o = " It was passed a child from " + O(e._owner.type) + "."), A(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, o), A(null);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
function xe(e, r) {
|
|
@@ -524,7 +524,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
524
524
|
else if (re(e))
|
|
525
525
|
e._store && (e._store.validated = !0);
|
|
526
526
|
else if (e) {
|
|
527
|
-
var c =
|
|
527
|
+
var c = I(e);
|
|
528
528
|
if (typeof c == "function" && c !== e.entries)
|
|
529
529
|
for (var f = c.call(e), l; !(l = f.next()).done; )
|
|
530
530
|
re(l.value) && Ce(l.value, r);
|
|
@@ -546,11 +546,11 @@ Check the top-level render call using <` + n + ">.");
|
|
|
546
546
|
else
|
|
547
547
|
return;
|
|
548
548
|
if (n) {
|
|
549
|
-
var o =
|
|
549
|
+
var o = O(r);
|
|
550
550
|
Ue(n, e.props, "prop", o, e);
|
|
551
551
|
} else if (r.PropTypes !== void 0 && !ee) {
|
|
552
552
|
ee = !0;
|
|
553
|
-
var c =
|
|
553
|
+
var c = O(r);
|
|
554
554
|
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", c || "Unknown");
|
|
555
555
|
}
|
|
556
556
|
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
@@ -578,7 +578,7 @@ Check the top-level render call using <` + n + ">.");
|
|
|
578
578
|
var _ = nr();
|
|
579
579
|
_ ? s += _ : s += we();
|
|
580
580
|
var v;
|
|
581
|
-
e === null ? v = "null" : Z(e) ? v = "array" : e !== void 0 && e.$$typeof === t ? (v = "<" + (
|
|
581
|
+
e === null ? v = "null" : Z(e) ? v = "array" : e !== void 0 && e.$$typeof === t ? (v = "<" + (O(e.type) || "Unknown") + " />", s = " Did you accidentally export a JSX literal instead of a component?") : v = typeof e, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, s);
|
|
582
582
|
}
|
|
583
583
|
var y = tr(e, r, n, c, f);
|
|
584
584
|
if (y == null)
|
|
@@ -588,26 +588,26 @@ Check the top-level render call using <` + n + ">.");
|
|
|
588
588
|
if (T !== void 0)
|
|
589
589
|
if (o)
|
|
590
590
|
if (Z(T)) {
|
|
591
|
-
for (var
|
|
592
|
-
xe(T[
|
|
591
|
+
for (var F = 0; F < T.length; F++)
|
|
592
|
+
xe(T[F], e);
|
|
593
593
|
Object.freeze && Object.freeze(T);
|
|
594
594
|
} else
|
|
595
595
|
w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
596
596
|
else
|
|
597
597
|
xe(T, e);
|
|
598
598
|
}
|
|
599
|
-
if (
|
|
600
|
-
var
|
|
599
|
+
if (M.call(r, "key")) {
|
|
600
|
+
var $ = O(e), C = Object.keys(r).filter(function(dr) {
|
|
601
601
|
return dr !== "key";
|
|
602
602
|
}), te = C.length > 0 ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
-
if (!Te[
|
|
603
|
+
if (!Te[$ + te]) {
|
|
604
604
|
var fr = C.length > 0 ? "{" + C.join(": ..., ") + ": ...}" : "{}";
|
|
605
605
|
w(`A props object containing a "key" prop is being spread into JSX:
|
|
606
606
|
let props = %s;
|
|
607
607
|
<%s {...props} />
|
|
608
608
|
React keys must be passed directly to JSX without using spread:
|
|
609
609
|
let props = %s;
|
|
610
|
-
<%s key={someKey} {...props} />`, te,
|
|
610
|
+
<%s key={someKey} {...props} />`, te, $, fr, $), Te[$ + te] = !0;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
return e === d ? ir(y) : or(y), y;
|
|
@@ -620,14 +620,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
620
620
|
return Se(e, r, n, !1);
|
|
621
621
|
}
|
|
622
622
|
var ur = lr, cr = sr;
|
|
623
|
-
|
|
624
|
-
})()),
|
|
623
|
+
Y.Fragment = d, Y.jsx = ur, Y.jsxs = cr;
|
|
624
|
+
})()), Y;
|
|
625
625
|
}
|
|
626
626
|
var je;
|
|
627
627
|
function yr() {
|
|
628
628
|
return je || (je = 1, process.env.NODE_ENV === "production" ? q.exports = vr() : q.exports = br()), q.exports;
|
|
629
629
|
}
|
|
630
|
-
var
|
|
630
|
+
var L = yr();
|
|
631
631
|
function Rr(a) {
|
|
632
632
|
const {
|
|
633
633
|
children: t,
|
|
@@ -638,7 +638,7 @@ function Rr(a) {
|
|
|
638
638
|
topPadding: h = 16
|
|
639
639
|
} = a, E = (typeof t == "string" ? t : "").split(`
|
|
640
640
|
`).map((b, R) => d + R);
|
|
641
|
-
return
|
|
641
|
+
return D.createElement("pre", {
|
|
642
642
|
className: `language-markdown ${i ? "line-numbers" : ""} ${u}`.trim(),
|
|
643
643
|
"data-start": d,
|
|
644
644
|
style: {
|
|
@@ -648,11 +648,11 @@ function Rr(a) {
|
|
|
648
648
|
...g
|
|
649
649
|
}
|
|
650
650
|
}, [
|
|
651
|
-
|
|
651
|
+
D.createElement("code", {
|
|
652
652
|
key: "code",
|
|
653
653
|
className: "language-markdown"
|
|
654
654
|
}, t),
|
|
655
|
-
i &&
|
|
655
|
+
i && D.createElement("span", {
|
|
656
656
|
key: "line-numbers",
|
|
657
657
|
className: "line-numbers-rows",
|
|
658
658
|
"aria-hidden": "true",
|
|
@@ -669,7 +669,7 @@ function Rr(a) {
|
|
|
669
669
|
lineHeight: "1.5"
|
|
670
670
|
}
|
|
671
671
|
}, E.map(
|
|
672
|
-
(b, R) =>
|
|
672
|
+
(b, R) => D.createElement("span", {
|
|
673
673
|
key: R,
|
|
674
674
|
style: {
|
|
675
675
|
display: "block",
|
|
@@ -682,14 +682,14 @@ function Rr(a) {
|
|
|
682
682
|
))
|
|
683
683
|
].filter(Boolean));
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function $e(a) {
|
|
686
686
|
let t;
|
|
687
687
|
return a.useTabs ? t = " " : a.hasPadding ? t = " " : t = "", t;
|
|
688
688
|
}
|
|
689
689
|
class Er {
|
|
690
690
|
padding;
|
|
691
691
|
constructor(t) {
|
|
692
|
-
this.padding =
|
|
692
|
+
this.padding = $e(t);
|
|
693
693
|
}
|
|
694
694
|
formatCell(t, i, d) {
|
|
695
695
|
const u = d;
|
|
@@ -738,7 +738,7 @@ class _r {
|
|
|
738
738
|
}).join("|")}|`;
|
|
739
739
|
}
|
|
740
740
|
formatAlignmentRow() {
|
|
741
|
-
const t =
|
|
741
|
+
const t = $e(this.config);
|
|
742
742
|
return `|${Array.from({ length: this.config.columnCount }, (d, u) => {
|
|
743
743
|
const g = this.adjustedAlignments[u], h = this.config.columnWidths ? this.config.columnWidths[u] : 3, p = wr.formatIndicator(g, h);
|
|
744
744
|
return `${t}${p}${t}`;
|
|
@@ -787,18 +787,18 @@ function kr(a) {
|
|
|
787
787
|
function Or(a) {
|
|
788
788
|
return Array.from({ length: a }, (t, i) => kr(i));
|
|
789
789
|
}
|
|
790
|
-
class
|
|
790
|
+
class B extends Error {
|
|
791
791
|
constructor(t, i) {
|
|
792
|
-
super(t, i), this.name = "MarkdownTableError", Object.setPrototypeOf(this,
|
|
792
|
+
super(t, i), this.name = "MarkdownTableError", Object.setPrototypeOf(this, B.prototype);
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
795
|
function jr(a) {
|
|
796
796
|
if (a === null || !Array.isArray(a))
|
|
797
|
-
throw new
|
|
797
|
+
throw new B("The 'data' prop must be a two-dimensional array.");
|
|
798
798
|
if (a.length === 0)
|
|
799
|
-
throw new
|
|
799
|
+
throw new B("The 'data' array must contain at least one row.");
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function $r(a) {
|
|
802
802
|
return a === "light" ? {
|
|
803
803
|
textColor: "#000",
|
|
804
804
|
textShadow: "0 1px #fff",
|
|
@@ -812,19 +812,19 @@ function Pr(a) {
|
|
|
812
812
|
borderRadius: ".3em"
|
|
813
813
|
};
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
const t =
|
|
815
|
+
function Pr(a) {
|
|
816
|
+
const t = $r(a);
|
|
817
817
|
return `
|
|
818
818
|
code[class*=language-],pre[class*=language-]{color:${t.textColor};background:0 0;text-shadow:${t.textShadow};font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:${t.selectionBackground}}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:${t.selectionBackground}}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:visible${t.borderRadius ? `;border-radius:${t.borderRadius}` : ""}}:not(pre)>code[class*=language-],pre[class*=language-]{background:${t.background}}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:3.8em}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block}
|
|
819
819
|
`;
|
|
820
820
|
}
|
|
821
|
-
function
|
|
821
|
+
function Ar(a, t) {
|
|
822
822
|
return t ? { inputDataHeader: a[0], inputDataBody: a.slice(1) } : { inputDataHeader: Or(a[0].length), inputDataBody: a };
|
|
823
823
|
}
|
|
824
824
|
function Fr(a, t, i, d, u, g, h) {
|
|
825
825
|
try {
|
|
826
826
|
jr(a);
|
|
827
|
-
const { inputDataHeader: p, inputDataBody: m } =
|
|
827
|
+
const { inputDataHeader: p, inputDataBody: m } = Ar(a, t);
|
|
828
828
|
return Sr(
|
|
829
829
|
{ inputDataHeader: p, inputDataBody: m },
|
|
830
830
|
i,
|
|
@@ -834,7 +834,7 @@ function Fr(a, t, i, d, u, g, h) {
|
|
|
834
834
|
h
|
|
835
835
|
);
|
|
836
836
|
} catch (p) {
|
|
837
|
-
if (p instanceof
|
|
837
|
+
if (p instanceof B)
|
|
838
838
|
return `Error: ${p.message}`;
|
|
839
839
|
throw p;
|
|
840
840
|
}
|
|
@@ -851,11 +851,11 @@ function Ir({
|
|
|
851
851
|
onGenerate: m,
|
|
852
852
|
theme: E = "light",
|
|
853
853
|
preStyle: b,
|
|
854
|
-
topPadding: R =
|
|
854
|
+
topPadding: R = 0,
|
|
855
855
|
minWidth: x,
|
|
856
856
|
showLineNumbers: S = !0
|
|
857
857
|
}) {
|
|
858
|
-
const
|
|
858
|
+
const k = gr(), z = pr(a), I = mr(() => Fr(
|
|
859
859
|
z,
|
|
860
860
|
t,
|
|
861
861
|
i,
|
|
@@ -873,40 +873,40 @@ function Ir({
|
|
|
873
873
|
g
|
|
874
874
|
]);
|
|
875
875
|
return hr(() => {
|
|
876
|
-
m && m(
|
|
877
|
-
}, [
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
|
|
876
|
+
m && m(I);
|
|
877
|
+
}, [I, m]), /* @__PURE__ */ L.jsxs(L.Fragment, { children: [
|
|
878
|
+
/* @__PURE__ */ L.jsxs("style", { children: [
|
|
879
|
+
Pr(E),
|
|
880
880
|
`
|
|
881
881
|
/* Add top spacing for the table content */
|
|
882
|
-
pre > code {
|
|
882
|
+
#${k} pre > code {
|
|
883
883
|
display: block;
|
|
884
884
|
padding-top: ${R}px !important;
|
|
885
885
|
padding-left: 3em !important;
|
|
886
886
|
}
|
|
887
887
|
/* Hide line numbers when disabled */
|
|
888
|
-
pre:not(.line-numbers) .line-numbers-rows {
|
|
888
|
+
#${k} pre:not(.line-numbers) .line-numbers-rows {
|
|
889
889
|
display: none !important;
|
|
890
890
|
}
|
|
891
|
-
pre:not(.line-numbers) > code {
|
|
891
|
+
#${k} pre:not(.line-numbers) > code {
|
|
892
892
|
padding-left: 0.3em !important;
|
|
893
893
|
}
|
|
894
894
|
/* Ensure line numbers are visible */
|
|
895
|
-
.line-numbers .line-numbers-rows {
|
|
895
|
+
#${k} .line-numbers .line-numbers-rows {
|
|
896
896
|
display: block !important;
|
|
897
897
|
}
|
|
898
898
|
`
|
|
899
899
|
] }),
|
|
900
|
-
/* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ L.jsx(
|
|
901
901
|
"div",
|
|
902
902
|
{
|
|
903
|
-
id:
|
|
903
|
+
id: k,
|
|
904
904
|
style: {
|
|
905
905
|
position: "relative",
|
|
906
906
|
isolation: "isolate",
|
|
907
907
|
display: "inline-block"
|
|
908
908
|
},
|
|
909
|
-
children: /* @__PURE__ */
|
|
909
|
+
children: /* @__PURE__ */ L.jsx(
|
|
910
910
|
Rr,
|
|
911
911
|
{
|
|
912
912
|
showLineNumbers: S,
|
|
@@ -918,7 +918,7 @@ function Ir({
|
|
|
918
918
|
margin: 0,
|
|
919
919
|
...b
|
|
920
920
|
},
|
|
921
|
-
children:
|
|
921
|
+
children: I
|
|
922
922
|
}
|
|
923
923
|
)
|
|
924
924
|
}
|
|
@@ -927,5 +927,5 @@ function Ir({
|
|
|
927
927
|
}
|
|
928
928
|
export {
|
|
929
929
|
Ir as MarkdownTable,
|
|
930
|
-
|
|
930
|
+
B as MarkdownTableError
|
|
931
931
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-markdown-table-ts",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.11",
|
|
4
4
|
"description": "A React component that converts structured data into formatted Markdown table syntax and displays it in a styled code block with optional line numbers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|