PageSourceSearch

https://www.basicprimitives.com/assets/HowToUse-CD4Pjk7y.js

js basicprimitives.com collected 2026-10-06 00:54:18 UTC 3,608 bytes, 1 lines download raw bytes

1var T=Object.defineProperty;var k=(i,t,o)=>t in i?T(i,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[t]=o;var C=(i,t,o)=>k(i,typeof t!="symbol"?t+"":t,o);import{r as h,a5 as n,j as e,d3 as v,B as S,dx as R,dy as B,dz as P,u as y,a as E,dA as $,H as D,f as F,M as H,dB as K,m as L,dC as M,dD as W}from"./index-Cp0r4qW8.js";import{R as U,o as z,j as J}from"./index-CeMXqgFs.js";import{T as N,a as A}from"./Tabs-CzxSQ9oT.js";import"./useSlotProps-ocMHbTGG.js";class b extends h.Component{render(){const{content:t,onCodeChange:o}=this.props;return e.jsx(U,{value:t,height:"300px",theme:z,extensions:[J()],onChange:d=>{o(d)},style:{maxHeight:"350px",overflow:"auto",background:"#1D1F27",color:"#f8f8f2",whiteSpace:"pre-wrap",textAlign:"left",fontSize:"0.9em",fontFamily:"Source Code Pro, monospace",marginBottom:"10px"}})}}C(b,"propTypes",{onCodeChange:n.func.isRequired,content:n.string.isRequired});const q=({name:i,onCodeChange:t,activeKey:o,samples:d})=>{const[l,p]=h.useState(o),[m,u]=h.useState(d);h.useEffect(()=>{u(d),p(o)},[d,o]);const s=c=>{u(a=>a.map((g,w)=>w===l?{...g,content:c}:g))},r=()=>{const{content:c}=m[l];t(l,c)},x=()=>{u(c=>c.map((a,g)=>g===l?{...a,url:a.defaultUrl,content:a.defaultContent}:a))},{url:f,content:j}=m[l];return e.jsxs(e.Fragment,{children:[e.jsx(v,{square:!0,children:e.jsx(N,{id:i,value:l,onChange:(c,a)=>p(a),"aria-label":"Samples",indicatorColor:"primary",textColor:"primary",children:m.map(({caption:c},a)=>e.jsx(A,{value:a,label:c},`tab${a}`))})}),e.jsx(b,{content:j,onCodeChange:s}),e.jsxs("div",{style:{width:"100%",border:"none",padding:"10px"},children:[e.jsx(S,{variant:"contained",color:"primary",onClick:x,style:{marginRight:"10px"},children:"Reset code value"}),e.jsxs(S,{variant:"contained",color:"primary",onClick:r,children:["Try it ",e.jsx("span",{children:">>"})]})]}),e.jsx(v,{square:!0,children:e.jsx("iframe",{title:"placeholder",src:f,style:{width:"100%",height:"540px",border:"none"}})})]})};q.propTypes={name:n.string.isRequired,onCodeChange:n.func.isRequired,activeKey:n.number.isRequired,samples:n.arrayOf(n.shape({caption:n.string.isRequired,url:n.string.isRequired,content:n.string.isRequired,defaultUrl:n.string.isRequired,defaultContent:n.string.isRequired})).isRequired};R.registerLanguage("javascript",B);const G=L(()=>({placeholder:{width:"100%",height:"520px",borderLeftWidth:"0px",borderRightWidth:"0px",borderTopWidth:"1px",borderTopStyle:"solid",borderBottomWidth:"1px",borderBottomStyle:"solid"}}));function Y(){const i=G(),{fileName:t}=P(),o=y(s=>{var r;return(r=s.howtouse.files[t])==null?void 0:r.loaded}),d=y(s=>{var r;return(r=s.howtouse.files[t])==null?void 0:r.markdown}),l=y(s=>{var r;return((r=s.howtouse.files[t])==null?void 0:r.groups)||{}}),p=E();h.useEffect(()=>{o||p($(t))},[t,o,p]);const m={p({children:s}){return e.jsx("div",{children:s})},a({children:s,href:r}){const x=l[r];if(s==="group"&&x){const{activeKey:f,samples:j}=x;return e.jsx(q,{className:i.placeholder,name:`group${r}`,samples:j,activeKey:f,onCodeChange:(c,a)=>p(M(t,r,c,a))})}return e.jsx("a",{href:r,children:s})},code({children:s,className:r}){return r!==void 0?e.jsx(R,{language:"javascript",style:W,children:String(s).replace(/\n$/,"")}):e.jsx("code",{children:s})}};let u="";return typeof d=="string"&&([,u]=d.match(/^# (.+)$/m)||[]),d?e.jsxs(e.Fragment,{children:[e.jsxs(D,{children:[e.jsx("title",{children:` for JavaScript - ${u}`}),e.jsx("meta",{name:"description",content:"JavaScript/Bootstrap/PDFKit Product Samples."})]}),e.jsx(F,{fixed:!0,children:e.jsx(H,{components:m,remarkPlugins:[K],children:d})})]}):null}export{Y as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.