diff --git a/demo/js/demo.js b/demo/js/demo.js index 3c10699..638e149 100644 --- a/demo/js/demo.js +++ b/demo/js/demo.js @@ -1,5 +1,5 @@ const React = require('react') -const ReactDOM = require('react-dom') +const ReactDOM = require('react-dom/client') const Refractor = require('../../src/Refractor') const h = React.createElement @@ -79,7 +79,8 @@ class ReactRefractorDemo extends React.Component { } } -ReactDOM.render(h(ReactRefractorDemo), document.getElementById('root')) +const root = ReactDOM.createRoot(document.getElementById('root')) +root.render(h(ReactRefractorDemo)) // Hiding this ugliness down here. function getDefaultValue() { diff --git a/demo/js/demo.min.js b/demo/js/demo.min.js index 4e76b25..f540d6c 100644 --- a/demo/js/demo.min.js +++ b/demo/js/demo.min.js @@ -1,2 +1,657 @@ -/*! For license information please see demo.min.js.LICENSE.txt */ -(()=>{var e={4812:(e,n,t)=>{var r=t(7294),a=t(5697),l=t(1215),o=t(6899),i=t(5094),u=r.createElement;function s(e){var n="language-".concat(e.language),t={className:n},r={className:[e.className,n].filter(Boolean).join(" ")};e.inline&&(t.style={display:"inline"},t.className=e.className);var a=l.highlight(e.value,e.language);e.markers&&e.markers.length>0&&(a=i(a,{markers:e.markers}));var s=0===a.length?e.value:a.map(o.depth(0)),c=u("code",t,s);return e.inline?c:u("pre",r,c)}s.propTypes={className:a.string,inline:a.bool,language:a.string.isRequired,value:a.string.isRequired,markers:a.arrayOf(a.oneOfType([a.number,a.shape({line:a.number.isRequired,className:a.string,component:a.oneOfType([a.node,a.func])})]))},s.defaultProps={className:"refractor",inline:!1},s.registerLanguage=function(e){return l.register(e)},s.hasLanguage=function(e){return l.registered(e)},e.exports=s},5094:(e,n,t)=>{var r=t(7365),a=t(9294),l=t(3577);function o(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{lineNumber:1};return e.reduce((function(e,t){var r=n.lineNumber;if("text"===t.type){if(-1===t.value.indexOf("\n"))return t.lineStart=r,t.lineEnd=r,e.nodes.push(t),e;for(var a=t.value.split("\n"),l=0;le&&s.some((function(e){return-1!==t.indexOf(e)}))&&c(u,n,t):c(i,n,t))}));var f=r(t,(function(e){return-1===s.indexOf(e)})),d=function(e){var n=e.get(t);return n?(a(n,(function(e,n){if(e.children)return e.lineStart=0,void(e.lineEnd=0);n.forEach((function(n){n.lineStart=Math.max(n.lineStart,e.lineStart),n.lineEnd=Math.max(n.lineEnd,e.lineEnd)}))})),n.children):[]},p=[].concat(d(o),d(i),d(u),f?f.children:[]);return o.clear(),i.clear(),u.clear(),p}(n.line,e)}),e),u=[],s=0,c=0;c0&&u.push(i(p,f,t))}for(;s{function n(){this.map=new WeakMap}function t(){this.keys=[],this.values=[]}e.exports="function"==typeof WeakMap?n:t,n.prototype.has=function(e){return this.map.has(e)},n.prototype.set=function(e,n){return this.map.set(e,n),this},n.prototype.get=function(e){return this.map.get(e)},n.prototype.clear=function(){},t.prototype.has=function(e){return-1!==this.keys.indexOf(e)},t.prototype.set=function(e,n){var t=this.keys.indexOf(e);return-1===t?(this.keys.push(e),this.values.push(n)):this.values[t]=n,this},t.prototype.get=function(e){var n=this.keys.indexOf(e);return-1===n?void 0:this.values[n]},t.prototype.clear=function(){this.keys=[],this.values=[]}},6899:(e,n,t)=>{var r=t(7294);n.depth=function e(n){return function(t,a){return function(n,t,a){if(n.tagName){var l=n.properties&&Array.isArray(n.properties.className)?n.properties.className.join(" "):n.properties.className;return r.createElement(n.tagName,Object.assign({key:"fract-".concat(a,"-").concat(t)},n.properties,{className:l}),n.children&&n.children.map(e(a+1)))}return n.value}(t,a,n)}}},6851:(e,n)=>{"use strict";n.Q=function(e){for(var n,t=[],r=String(e||""),a=r.indexOf(","),l=0,o=!1;!o;)-1===a&&(a=r.length,o=!0),!(n=r.slice(l,a).trim())&&o||t.push(n),l=a+1,a=r.indexOf(",",l);return t}},8892:e=>{"use strict";e.exports=function(e,t){for(var r,a,l,o=e||"",i=t||"div",u={},s=0;s{"use strict";var r=t(9560),a=t(6632),l=t(8892),o=t(6582).Q,i=t(6851).Q;e.exports=function(e,n,t){var a=t?function(e){for(var n,t=e.length,r=-1,a={};++r{"use strict";var r=t(7247),a=t(2502)(r,"div");a.displayName="html",e.exports=a},1742:(e,n,t)=>{"use strict";e.exports=t(2579)},6260:e=>{"use strict";e.exports=function(e){var n="string"==typeof e?e.charCodeAt(0):e;return n>=97&&n<=122||n>=65&&n<=90}},7961:(e,n,t)=>{"use strict";var r=t(6260),a=t(6195);e.exports=function(e){return r(e)||a(e)}},6195:e=>{"use strict";e.exports=function(e){var n="string"==typeof e?e.charCodeAt(0):e;return n>=48&&n<=57}},9480:e=>{"use strict";e.exports=function(e){var n="string"==typeof e?e.charCodeAt(0):e;return n>=97&&n<=102||n>=65&&n<=70||n>=48&&n<=57}},7418:e=>{"use strict";var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map((function(e){return n[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,l){for(var o,i,u=a(e),s=1;s{"use strict";var n;e.exports=function(e){var t,r="&"+e+";";return(n=n||document.createElement("i")).innerHTML=r,(59!==(t=n.textContent).charCodeAt(t.length-1)||"semi"===e)&&(t!==r&&t)}},7574:(e,n,t)=>{"use strict";var r=t(7452),a=t(3580),l=t(6195),o=t(9480),i=t(7961),u=t(9435);e.exports=function(e,n){var t,l,o={};for(l in n||(n={}),d)t=n[l],o[l]=null==t?d[l]:t;return(o.position.indent||o.position.start)&&(o.indent=o.position.indent||[],o.position=o.position.start),function(e,n){var t,l,o,d,w,k,x,S,E,C,_,P,N,O,L,T,F,z,A,M,R=n.additional,j=n.nonTerminated,D=n.text,I=n.reference,U=n.warning,$=n.textContext,B=n.referenceContext,V=n.warningContext,W=n.position,H=n.indent||[],Q=e.length,q=0,K=-1,Y=W.column||1,X=W.line||1,Z="",G=[];for("string"==typeof R&&(R=R.charCodeAt(0)),T=J(),S=U?function(e,n){var t=J();t.column+=n,t.offset+=n,U.call(V,y[e],t,e)}:f,q--,Q++;++q=55296&&M<=57343||M>1114111?(S(7,z),k=c(65533)):k in a?(S(6,z),k=a[k]):(C="",b(k)&&S(6,z),k>65535&&(C+=c((k-=65536)>>>10|55296),k=56320|1023&k),k=C+c(k))):O!==p&&S(4,z)),k?(ee(),T=J(),q=A-1,Y+=A-N+1,G.push(k),(F=J()).offset++,I&&I.call(B,k,{start:T,end:F},e.slice(N-1,A)),T=F):(d=e.slice(N-1,A),Z+=d,Y+=d.length,q=A-1)}else 10===w&&(X++,K++,Y=0),w==w?(Z+=c(w),Y++):ee();return G.join("");function J(){return{line:X,column:Y,offset:q+(W.offset||0)}}function ee(){Z&&(G.push(Z),D&&D.call($,Z,{start:T,end:J()}),Z="")}}(e,o)};var s={}.hasOwnProperty,c=String.fromCharCode,f=Function.prototype,d={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},p="named",g="hexadecimal",h="decimal",m={hexadecimal:16,decimal:10},v={};v.named=i,v[h]=l,v[g]=o;var y={};function b(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||65535==(65535&e)||65534==(65535&e)}y[1]="Named character references must be terminated by a semicolon",y[2]="Numeric character references must be terminated by a semicolon",y[3]="Named character references cannot be empty",y[4]="Numeric character references cannot be empty",y[5]="Named character references must be known",y[6]="Numeric character references cannot be disallowed",y[7]="Numeric character references cannot be outside the permissible Unicode range"},8325:(e,n,t)=>{var r=function(e){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof l?new l(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/=f.reach);S+=x.value.length,x=x.next){var E=x.value;if(n.length>e.length)return;if(!(E instanceof l)){var C,_=1;if(y){if(!(C=o(k,S,e,v))||C.index>=e.length)break;var P=C.index,N=C.index+C[0].length,O=S;for(O+=x.value.length;P>=O;)O+=(x=x.next).value.length;if(S=O-=x.value.length,x.value instanceof l)continue;for(var L=x;L!==n.tail&&(Of.reach&&(f.reach=A);var M=x.prev;if(F&&(M=s(n,M,F),S+=F.length),c(n,M,_),x=s(n,M,new l(d,m?a.tokenize(T,m):T,b,T)),z&&s(n,x,z),_>1){var R={cause:d+","+g,reach:A};i(e,n,t,x.prev,S,R),f&&R.reach>f.reach&&(f.reach=R.reach)}}}}}}function u(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function s(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function c(e,n,t){for(var r=n.next,a=0;a"+l.content+""},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(n){var t=JSON.parse(n.data),r=t.language,l=t.code,o=t.immediateClose;e.postMessage(a.highlight(l,a.languages[r],r)),o&&e.close()}),!1),a):a;var f=a.util.currentScript();function d(){a.manual||a.highlightAll()}if(f&&(a.filename=f.src,f.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var p=document.readyState;"loading"===p||"interactive"===p&&f&&f.defer?document.addEventListener("DOMContentLoaded",d):window.requestAnimationFrame?window.requestAnimationFrame(d):window.setTimeout(d,16)}return a}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=r),void 0!==t.g&&(t.g.Prism=r)},2703:(e,n,t)=>{"use strict";var r=t(414);function a(){}function l(){}l.resetWarningCache=a,e.exports=function(){function e(e,n,t,a,l,o){if(o!==r){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function n(){return e}e.isRequired=e;var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:l,resetWarningCache:a};return t.PropTypes=t,t}},5697:(e,n,t)=>{e.exports=t(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},9560:(e,n,t)=>{"use strict";var r=t(6632),a=t(8805),l=t(7643),o="data";e.exports=function(e,n){var t=r(n),d=n,p=l;return t in e.normal?e.property[e.normal[t]]:(t.length>4&&t.slice(0,4)===o&&i.test(n)&&("-"===n.charAt(4)?d=function(e){var n=e.slice(5).replace(u,f);return o+n.charAt(0).toUpperCase()+n.slice(1)}(n):n=function(e){var n=e.slice(4);return u.test(n)?e:("-"!==(n=n.replace(s,c)).charAt(0)&&(n="-"+n),o+n)}(n),p=a),new p(d,n))};var i=/^data[-\w.:]+$/i,u=/-[a-z]/g,s=/[A-Z]/g;function c(e){return"-"+e.toLowerCase()}function f(e){return e.charAt(1).toUpperCase()}},7247:(e,n,t)=>{"use strict";var r=t(9940),a=t(8289),l=t(5812),o=t(4397),i=t(7716),u=t(1805);e.exports=r([l,a,o,i,u])},7716:(e,n,t)=>{"use strict";var r=t(7e3),a=t(7596),l=r.booleanish,o=r.number,i=r.spaceSeparated;e.exports=a({transform:function(e,n){return"role"===n?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:l,ariaAutoComplete:null,ariaBusy:l,ariaChecked:l,ariaColCount:o,ariaColIndex:o,ariaColSpan:o,ariaControls:i,ariaCurrent:null,ariaDescribedBy:i,ariaDetails:null,ariaDisabled:l,ariaDropEffect:i,ariaErrorMessage:null,ariaExpanded:l,ariaFlowTo:i,ariaGrabbed:l,ariaHasPopup:null,ariaHidden:l,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:i,ariaLevel:o,ariaLive:null,ariaModal:l,ariaMultiLine:l,ariaMultiSelectable:l,ariaOrientation:null,ariaOwns:i,ariaPlaceholder:null,ariaPosInSet:o,ariaPressed:l,ariaReadOnly:l,ariaRelevant:null,ariaRequired:l,ariaRoleDescription:i,ariaRowCount:o,ariaRowIndex:o,ariaRowSpan:o,ariaSelected:l,ariaSetSize:o,ariaSort:null,ariaValueMax:o,ariaValueMin:o,ariaValueNow:o,ariaValueText:null,role:null}})},1805:(e,n,t)=>{"use strict";var r=t(7e3),a=t(7596),l=t(855),o=r.boolean,i=r.overloadedBoolean,u=r.booleanish,s=r.number,c=r.spaceSeparated,f=r.commaSeparated;e.exports=a({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:l,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:f,acceptCharset:c,accessKey:c,action:null,allow:null,allowFullScreen:o,allowPaymentRequest:o,allowUserMedia:o,alt:null,as:null,async:o,autoCapitalize:null,autoComplete:c,autoFocus:o,autoPlay:o,capture:o,charSet:null,checked:o,cite:null,className:c,cols:s,colSpan:null,content:null,contentEditable:u,controls:o,controlsList:c,coords:s|f,crossOrigin:null,data:null,dateTime:null,decoding:null,default:o,defer:o,dir:null,dirName:null,disabled:o,download:i,draggable:u,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:o,formTarget:null,headers:c,height:s,hidden:o,high:s,href:null,hrefLang:null,htmlFor:c,httpEquiv:c,id:null,imageSizes:null,imageSrcSet:f,inputMode:null,integrity:null,is:null,isMap:o,itemId:null,itemProp:c,itemRef:c,itemScope:o,itemType:c,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:o,low:s,manifest:null,max:null,maxLength:s,media:null,method:null,min:null,minLength:s,multiple:o,muted:o,name:null,nonce:null,noModule:o,noValidate:o,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:o,optimum:s,pattern:null,ping:c,placeholder:null,playsInline:o,poster:null,preload:null,readOnly:o,referrerPolicy:null,rel:c,required:o,reversed:o,rows:s,rowSpan:s,sandbox:c,scope:null,scoped:o,seamless:o,selected:o,shape:null,size:s,sizes:null,slot:null,span:s,spellCheck:u,src:null,srcDoc:null,srcLang:null,srcSet:f,start:s,step:null,style:null,tabIndex:s,target:null,title:null,translate:null,type:null,typeMustMatch:o,useMap:null,value:u,width:s,wrap:null,align:null,aLink:null,archive:c,axis:null,background:null,bgColor:null,border:s,borderColor:null,bottomMargin:s,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:o,declare:o,event:null,face:null,frame:null,frameBorder:null,hSpace:s,leftMargin:s,link:null,longDesc:null,lowSrc:null,marginHeight:s,marginWidth:s,noResize:o,noHref:o,noShade:o,noWrap:o,object:null,profile:null,prompt:null,rev:null,rightMargin:s,rules:null,scheme:null,scrolling:u,standby:null,summary:null,text:null,topMargin:s,valueType:null,version:null,vAlign:null,vLink:null,vSpace:s,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:o,disableRemotePlayback:o,prefix:null,property:null,results:s,security:null,unselectable:null}})},855:(e,n,t)=>{"use strict";var r=t(8740);e.exports=function(e,n){return r(e,n.toLowerCase())}},8740:e=>{"use strict";e.exports=function(e,n){return n in e?e[n]:n}},7596:(e,n,t)=>{"use strict";var r=t(6632),a=t(9607),l=t(8805);e.exports=function(e){var n,t,o=e.space,i=e.mustUseProperty||[],u=e.attributes||{},s=e.properties,c=e.transform,f={},d={};for(n in s)t=new l(n,c(u,n),s[n],o),-1!==i.indexOf(n)&&(t.mustUseProperty=!0),f[n]=t,d[r(n)]=n,d[r(t.attribute)]=n;return new a(f,d,o)}},8805:(e,n,t)=>{"use strict";var r=t(7643),a=t(7e3);e.exports=i,i.prototype=new r,i.prototype.defined=!0;var l=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],o=l.length;function i(e,n,t,i){var s,c=-1;for(u(this,"space",i),r.call(this,e,n);++c{"use strict";e.exports=t;var n=t.prototype;function t(e,n){this.property=e,this.attribute=n}n.space=null,n.attribute=null,n.property=null,n.boolean=!1,n.booleanish=!1,n.overloadedBoolean=!1,n.number=!1,n.commaSeparated=!1,n.spaceSeparated=!1,n.commaOrSpaceSeparated=!1,n.mustUseProperty=!1,n.defined=!1},9940:(e,n,t)=>{"use strict";var r=t(7529),a=t(9607);e.exports=function(e){for(var n,t,l=e.length,o=[],i=[],u=-1;++u{"use strict";e.exports=t;var n=t.prototype;function t(e,n,t){this.property=e,this.normal=n,t&&(this.space=t)}n.space=null,n.normal={},n.property={}},7e3:(e,n)=>{"use strict";var t=0;function r(){return Math.pow(2,++t)}n.boolean=r(),n.booleanish=r(),n.overloadedBoolean=r(),n.number=r(),n.spaceSeparated=r(),n.commaSeparated=r(),n.commaOrSpaceSeparated=r()},8289:(e,n,t)=>{"use strict";var r=t(7596);e.exports=r({space:"xlink",transform:function(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}})},5812:(e,n,t)=>{"use strict";var r=t(7596);e.exports=r({space:"xml",transform:function(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}})},4397:(e,n,t)=>{"use strict";var r=t(7596),a=t(855);e.exports=r({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:a,properties:{xmlns:null,xmlnsXLink:null}})},6632:e=>{"use strict";e.exports=function(e){return e.toLowerCase()}},4448:(e,n,t)=>{"use strict";var r=t(7294),a=t(7418),l=t(3840);function o(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t