playjs-core 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -153473,7 +153473,7 @@ function Code({ code: Ht, language: br, theme: zr, onChange: Ur }) {
153473
153473
  xt.current = Wi, Wi.focus(), Li();
153474
153474
  }
153475
153475
  function Bs() {
153476
- debounce(Li, 200);
153476
+ debounce(Li, 800);
153477
153477
  }
153478
153478
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
153479
153479
  Ft,
@@ -153541,7 +153541,7 @@ function Core({
153541
153541
  }
153542
153542
  );
153543
153543
  }
153544
- const version = "0.6.2";
153544
+ const version = "0.6.3";
153545
153545
  function Logo({
153546
153546
  theme: Ht = THEME.DARK,
153547
153547
  language: br = LANGUAGE.JAVASCRIPT
package/dist/index.umd.js CHANGED
@@ -462,4 +462,4 @@ ${S.message}`),S}return r?m.map(S=>this.mapCodeFixAction(S)):m}getCombinedCodeFi
462
462
  `,prevResult=html}catch(Ut){Ut instanceof ReferenceError&&(result+=Ut),result+=`
463
463
  `}}return result=result.slice(0,-1),result}function resolveHTML(Ut){return typeof Ut=="object"?Ut instanceof Promise?Ut.then(yr=>resolveHTML(yr)):JSON.stringify(Ut):typeof Ut=="string"?Ut.match(/^['"].*['"]$/)?Ut:`'${Ut}'`:typeof Ut=="function"?Ut():typeof Ut=="symbol"?Ut.toString():typeof Ut>"u"?"":Ut}function getConsoleLogs(Ut){var zr;let yr=[];console.log=function(...Ur){var Bs;const xt=((Bs=new Error().stack)==null?void 0:Bs.split(`
464
464
  `)[2].split(":").slice(-2)[0])||null,Li=xt!=null?parseInt(xt)-2:null,Qi=Math.random().toString(36).substr(2,9);Ur.forEach(Wi=>{yr.push({id:Qi,message:resolveHTML(Wi),line:Li})})};try{new Function(Ut)()}catch(Ur){const xt=(zr=Ur.stack)==null?void 0:zr.split(`
465
- `)[1].split(":").slice(-2)[0],Li=xt!=null?parseInt(xt)-2:null;yr.push({id:"",message:Ur.message,line:Li})}return yr}function Console({code:Ut,language:yr,theme:zr,direction:Ur}){const xt=Ur===DIRECTION.HORIZONTAL?"off":"on",Li=K.useRef(null),[Qi,Bs]=K.useState("");return K.useEffect(()=>{getResult({code:Ut,language:yr}).then(Wi=>{Bs(Wi)})},[Ut,yr]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Ft,{language:yr,theme:zr,loading:"",value:Qi,onMount:Wi=>{Li.current=Wi},options:{...EDITOR_OPTIONS,lineNumbers:xt,readOnly:!0,renderLineHighlight:"none"}})})}let throttlePause=null;const debounce=(Ut,yr)=>{throttlePause||(throttlePause=!0,setTimeout(()=>{Ut(),throttlePause=!1},yr))};function Code({code:Ut,language:yr,theme:zr,onChange:Ur}){const xt=K.useRef(null);K.useEffect(()=>{if(Ut==null)return;const Wi=xt.current;Wi&&Ut!==Wi.getValue()&&Wi.setValue(Ut)},[Ut]);function Li(){if(!xt.current)return;const Za=xt.current.getValue();Ur({code:Za,language:yr})}function Qi(Wi){xt.current=Wi,Wi.focus(),Li()}function Bs(){debounce(Li,200)}return jsxRuntimeExports.jsx(Ft,{language:yr,theme:zr,defaultValue:Ut,onMount:Qi,onChange:Bs,loading:"",options:{...EDITOR_OPTIONS,lineNumbers:"on"}})}function Core({code:Ut="",width:yr="100dvw",height:zr="100dvh",direction:Ur=DIRECTION.HORIZONTAL,language:xt=LANGUAGE.JAVASCRIPT,theme:Li=THEME.DARK,onChange:Qi=Bs=>{}}){const Bs=useWindowSize(),[Wi,Za]=K.useState(Ut);K.useEffect(()=>{Za(Ut)},[Ut]);const lo=async({code:jl=""})=>{jl!=null&&(Qi(jl),Za(jl))},[Cr,gr]=K.useState([50,50]);function Rl(jl){const[gu,Uo]=jl;gr([gu,Uo])}const cc=Bs.width<WIDTH_MOBILE?6:3;return jsxRuntimeExports.jsxs(SplitWrapper,{style:{display:Ur===DIRECTION.HORIZONTAL?"flex":"block",width:yr,height:zr},direction:Ur===DIRECTION.HORIZONTAL?"horizontal":"vertical",sizes:Cr,gutterSize:cc,gutterStyle:()=>({backgroundColor:"#3f3f3f",width:Ur===DIRECTION.HORIZONTAL?`${cc}px`:"100%",height:Ur===DIRECTION.HORIZONTAL?"auto":`${cc}px`,cursor:Ur===DIRECTION.HORIZONTAL?"col-resize":"row-resize",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundImage:Ur===DIRECTION.HORIZONTAL?'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==")':'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=")'}),onDragEnd:Rl,children:[jsxRuntimeExports.jsx(Code,{code:Wi,language:xt,onChange:lo,theme:Li}),jsxRuntimeExports.jsx(Console,{code:Wi,language:xt,direction:Ur,theme:Li})]})}const version="0.6.2";function Logo({theme:Ut=THEME.DARK,language:yr=LANGUAGE.JAVASCRIPT}){return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"end",gap:8,fontFamily:"monospace"},children:[jsxRuntimeExports.jsxs("a",{href:"https://playjs.dev",target:"_blank",style:{display:"flex",alignItems:"center",gap:"6px",textDecoration:"none"},rel:"noreferrer",children:[jsxRuntimeExports.jsx("div",{style:{width:"16px",height:"16px",backgroundColor:yr===LANGUAGE.TYPESCRIPT?"#007acc":"#f0db4f"}}),jsxRuntimeExports.jsx("span",{style:{color:Ut===THEME.DARK?"white":"black",fontSize:"16px",lineHeight:"16px",fontWeight:100},children:"PlayJS"})]}),jsxRuntimeExports.jsxs("span",{style:{color:Ut===THEME.DARK?"white":"black",opacity:.5,fontSize:"10px",fontWeight:100},children:["v.",version]})]})}function PlayJS({code:Ut="",width:yr="100dvw",height:zr="100dvh",language:Ur=LANGUAGE.JAVASCRIPT,direction:xt=DIRECTION.HORIZONTAL,theme:Li=THEME.DARK,onChange:Qi=Bs=>{}}){return jsxRuntimeExports.jsxs("section",{style:{position:"relative",display:"flex",flexDirection:"column",fontFamily:"monospace",width:yr,height:zr,backgroundColor:Li===THEME.DARK?"#1e1e1e":"white"},children:[jsxRuntimeExports.jsx("div",{style:{position:"absolute",right:12,bottom:12,zIndex:1,opacity:.3},children:jsxRuntimeExports.jsx(Logo,{theme:Li,language:Ur})}),jsxRuntimeExports.jsx(Core,{width:yr,height:zr,direction:xt,code:Ut,language:Ur,theme:Li,onChange:Qi})]})}exports.PlayJS=PlayJS,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
465
+ `)[1].split(":").slice(-2)[0],Li=xt!=null?parseInt(xt)-2:null;yr.push({id:"",message:Ur.message,line:Li})}return yr}function Console({code:Ut,language:yr,theme:zr,direction:Ur}){const xt=Ur===DIRECTION.HORIZONTAL?"off":"on",Li=K.useRef(null),[Qi,Bs]=K.useState("");return K.useEffect(()=>{getResult({code:Ut,language:yr}).then(Wi=>{Bs(Wi)})},[Ut,yr]),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Ft,{language:yr,theme:zr,loading:"",value:Qi,onMount:Wi=>{Li.current=Wi},options:{...EDITOR_OPTIONS,lineNumbers:xt,readOnly:!0,renderLineHighlight:"none"}})})}let throttlePause=null;const debounce=(Ut,yr)=>{throttlePause||(throttlePause=!0,setTimeout(()=>{Ut(),throttlePause=!1},yr))};function Code({code:Ut,language:yr,theme:zr,onChange:Ur}){const xt=K.useRef(null);K.useEffect(()=>{if(Ut==null)return;const Wi=xt.current;Wi&&Ut!==Wi.getValue()&&Wi.setValue(Ut)},[Ut]);function Li(){if(!xt.current)return;const Za=xt.current.getValue();Ur({code:Za,language:yr})}function Qi(Wi){xt.current=Wi,Wi.focus(),Li()}function Bs(){debounce(Li,800)}return jsxRuntimeExports.jsx(Ft,{language:yr,theme:zr,defaultValue:Ut,onMount:Qi,onChange:Bs,loading:"",options:{...EDITOR_OPTIONS,lineNumbers:"on"}})}function Core({code:Ut="",width:yr="100dvw",height:zr="100dvh",direction:Ur=DIRECTION.HORIZONTAL,language:xt=LANGUAGE.JAVASCRIPT,theme:Li=THEME.DARK,onChange:Qi=Bs=>{}}){const Bs=useWindowSize(),[Wi,Za]=K.useState(Ut);K.useEffect(()=>{Za(Ut)},[Ut]);const lo=async({code:jl=""})=>{jl!=null&&(Qi(jl),Za(jl))},[Cr,gr]=K.useState([50,50]);function Rl(jl){const[gu,Uo]=jl;gr([gu,Uo])}const cc=Bs.width<WIDTH_MOBILE?6:3;return jsxRuntimeExports.jsxs(SplitWrapper,{style:{display:Ur===DIRECTION.HORIZONTAL?"flex":"block",width:yr,height:zr},direction:Ur===DIRECTION.HORIZONTAL?"horizontal":"vertical",sizes:Cr,gutterSize:cc,gutterStyle:()=>({backgroundColor:"#3f3f3f",width:Ur===DIRECTION.HORIZONTAL?`${cc}px`:"100%",height:Ur===DIRECTION.HORIZONTAL?"auto":`${cc}px`,cursor:Ur===DIRECTION.HORIZONTAL?"col-resize":"row-resize",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundImage:Ur===DIRECTION.HORIZONTAL?'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==")':'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=")'}),onDragEnd:Rl,children:[jsxRuntimeExports.jsx(Code,{code:Wi,language:xt,onChange:lo,theme:Li}),jsxRuntimeExports.jsx(Console,{code:Wi,language:xt,direction:Ur,theme:Li})]})}const version="0.6.3";function Logo({theme:Ut=THEME.DARK,language:yr=LANGUAGE.JAVASCRIPT}){return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"end",gap:8,fontFamily:"monospace"},children:[jsxRuntimeExports.jsxs("a",{href:"https://playjs.dev",target:"_blank",style:{display:"flex",alignItems:"center",gap:"6px",textDecoration:"none"},rel:"noreferrer",children:[jsxRuntimeExports.jsx("div",{style:{width:"16px",height:"16px",backgroundColor:yr===LANGUAGE.TYPESCRIPT?"#007acc":"#f0db4f"}}),jsxRuntimeExports.jsx("span",{style:{color:Ut===THEME.DARK?"white":"black",fontSize:"16px",lineHeight:"16px",fontWeight:100},children:"PlayJS"})]}),jsxRuntimeExports.jsxs("span",{style:{color:Ut===THEME.DARK?"white":"black",opacity:.5,fontSize:"10px",fontWeight:100},children:["v.",version]})]})}function PlayJS({code:Ut="",width:yr="100dvw",height:zr="100dvh",language:Ur=LANGUAGE.JAVASCRIPT,direction:xt=DIRECTION.HORIZONTAL,theme:Li=THEME.DARK,onChange:Qi=Bs=>{}}){return jsxRuntimeExports.jsxs("section",{style:{position:"relative",display:"flex",flexDirection:"column",fontFamily:"monospace",width:yr,height:zr,backgroundColor:Li===THEME.DARK?"#1e1e1e":"white"},children:[jsxRuntimeExports.jsx("div",{style:{position:"absolute",right:12,bottom:12,zIndex:1,opacity:.3},children:jsxRuntimeExports.jsx(Logo,{theme:Li,language:Ur})}),jsxRuntimeExports.jsx(Core,{width:yr,height:zr,direction:xt,code:Ut,language:Ur,theme:Li,onChange:Qi})]})}exports.PlayJS=PlayJS,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playjs-core",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "type": "module",
5
5
  "license": "BSD-3-Clause",
6
6
  "keywords": [
@@ -56,4 +56,4 @@
56
56
  "./node_modules/standard/eslintrc.json"
57
57
  ]
58
58
  }
59
- }
59
+ }