@adriansteffan/reactive 0.0.35 → 0.0.37
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/{mod-bwTFfeeq.js → mod-B9pn3CIt.js} +3 -3
- package/dist/reactive.es.js +1 -1
- package/dist/reactive.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{web-BDYezuEB.js → web-B5ojRUs4.js} +1 -1
- package/dist/{web-rfSabFi1.js → web-wJPoJ8Wb.js} +1 -1
- package/package.json +1 -1
- package/src/components/text.tsx +2 -2
- package/template/src/index.css +5 -0
|
@@ -1155,7 +1155,7 @@ function rp({
|
|
|
1155
1155
|
reactionTime: S
|
|
1156
1156
|
});
|
|
1157
1157
|
};
|
|
1158
|
-
return /* @__PURE__ */ z.jsx("div", { className:
|
|
1158
|
+
return /* @__PURE__ */ z.jsx("div", { className: `min-h-screen ${f}`, children: /* @__PURE__ */ z.jsxs("div", { className: `max-w-prose mx-auto ${p} pt-20 pb-20 px-4 `, children: [
|
|
1159
1159
|
/* @__PURE__ */ z.jsx(
|
|
1160
1160
|
"article",
|
|
1161
1161
|
{
|
|
@@ -70880,7 +70880,7 @@ var Yc;
|
|
|
70880
70880
|
d.UTF8 = "utf8", d.ASCII = "ascii", d.UTF16 = "utf16";
|
|
70881
70881
|
})(Yc || (Yc = {}));
|
|
70882
70882
|
const Yi = na("Filesystem", {
|
|
70883
|
-
web: () => import("./web-
|
|
70883
|
+
web: () => import("./web-B5ojRUs4.js").then((d) => new d.FilesystemWeb())
|
|
70884
70884
|
});
|
|
70885
70885
|
ug("Upload", [
|
|
70886
70886
|
{
|
|
@@ -71189,7 +71189,7 @@ var Wh;
|
|
|
71189
71189
|
d.None = "NONE", d.Slide = "SLIDE", d.Fade = "FADE";
|
|
71190
71190
|
})(Wh || (Wh = {}));
|
|
71191
71191
|
const vm = na("StatusBar"), bm = na("ImmersiveMode", {
|
|
71192
|
-
web: () => import("./web-
|
|
71192
|
+
web: () => import("./web-wJPoJ8Wb.js").then((d) => new d.ImmersiveModeWeb())
|
|
71193
71193
|
});
|
|
71194
71194
|
function $x({
|
|
71195
71195
|
content: d,
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as e, C as n, v as r, o as t, q as i, t as o, u as l, Y as c, z as m, M as p, P as u, l as P, m as x, Q as C, R as E, F as g, T, w as d, U as f, X as k, k as F, c as h, x as v, y as B, g as w, e as y, d as R, i as q, n as D, p as I, r as M, h as Q, f as U, s as b, a as j, j as z, B as A, N as H, L } from "./mod-
|
|
1
|
+
import { H as e, C as n, v as r, o as t, q as i, t as o, u as l, Y as c, z as m, M as p, P as u, l as P, m as x, Q as C, R as E, F as g, T, w as d, U as f, X as k, k as F, c as h, x as v, y as B, g as w, e as y, d as R, i as q, n as D, p as I, r as M, h as Q, f as U, s as b, a as j, j as z, B as A, N as H, L } from "./mod-B9pn3CIt.js";
|
|
2
2
|
export {
|
|
3
3
|
e as Bounce,
|
|
4
4
|
n as CanvasBlock,
|
package/dist/reactive.umd.js
CHANGED
|
@@ -27,7 +27,7 @@ Check the top-level render call using <`+je+">.")}return be}}function Kr(Z,be){{
|
|
|
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} />`,Mi,fn,ue,fn),cn[fn+Mi]=!0}}return Z===p?Di(xt):So(xt),xt}}function Eo(Z,be,je){return jo(Z,be,je,!0)}function Ai(Z,be,je){return jo(Z,be,je,!1)}var Li=Ai,ki=Eo;Xo.Fragment=p,Xo.jsx=Li,Xo.jsxs=ki}()),Xo}process.env.NODE_ENV==="production"?eu.exports=ry():eu.exports=ny();var W=eu.exports;function ca({content:h,buttonText:d="Click me",className:c="",containerClass:p="",next:g,animate:C=!1,allowedKeys:x=!1}){const w=ne.useRef(0);ne.useEffect(()=>{w.current=or();const v=P=>{const R=or();if(x===!0||Array.isArray(x)&&x.includes(P.key)){const H=R-w.current;g({key:P.key,time:R,reactionTime:H})}};return x&&window.addEventListener("keydown",v),()=>{x&&window.removeEventListener("keydown",v)}},[g,x]);const V=()=>{const v=or(),P=v-w.current;g({key:"button",time:v,reactionTime:P})};return W.jsx("div",{className
|
|
30
|
+
<%s key={someKey} {...props} />`,Mi,fn,ue,fn),cn[fn+Mi]=!0}}return Z===p?Di(xt):So(xt),xt}}function Eo(Z,be,je){return jo(Z,be,je,!0)}function Ai(Z,be,je){return jo(Z,be,je,!1)}var Li=Ai,ki=Eo;Xo.Fragment=p,Xo.jsx=Li,Xo.jsxs=ki}()),Xo}process.env.NODE_ENV==="production"?eu.exports=ry():eu.exports=ny();var W=eu.exports;function ca({content:h,buttonText:d="Click me",className:c="",containerClass:p="",next:g,animate:C=!1,allowedKeys:x=!1}){const w=ne.useRef(0);ne.useEffect(()=>{w.current=or();const v=P=>{const R=or();if(x===!0||Array.isArray(x)&&x.includes(P.key)){const H=R-w.current;g({key:P.key,time:R,reactionTime:H})}};return x&&window.addEventListener("keydown",v),()=>{x&&window.removeEventListener("keydown",v)}},[g,x]);const V=()=>{const v=or(),P=v-w.current;g({key:"button",time:v,reactionTime:P})};return W.jsx("div",{className:`min-h-screen ${p}`,children:W.jsxs("div",{className:`max-w-prose mx-auto ${c} pt-20 pb-20 px-4 `,children:[W.jsx("article",{className:`prose prose-2xl prose-slate text-xl prose-a:text-blue-600 prose-a:underline prose-h1:text-4xl prose-h1:mb-10 prose-h1:font-bold prose-p:mb-4 prose-strong:font-bold text-black leading-relaxed
|
|
31
31
|
${C?"animate-slide-down opacity-0":""}`,children:h}),d&&W.jsx("div",{className:`mt-16 flex justify-center ${C?"animate-fade-in opacity-0":""}`,style:C?{animationDelay:"1s"}:{},children:W.jsx("button",{onClick:V,className:"bg-white cursor-pointer px-8 py-3 border-2 border-black font-bold text-black text-lg rounded-xl shadow-[2px_2px_0px_rgba(0,0,0,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none",children:d})})]})})}function Sf({content:h,buttonText:d="Click me",className:c="",next:p,updateStore:g,animate:C=!1,storeupdate:x,placeholder:w="Enter your response here"}){const[V,v]=ne.useState(""),P=L=>{v(L.target.value)},R=()=>{x&&g(x(V)),p({value:V})};return W.jsxs("div",{className:`max-w-prose mx-auto ${c} mt-20 mb-20 px-4 `,children:[W.jsx("article",{className:`prose prose-2xl prose-slate text-xl prose-a:text-blue-600 prose-a:underline prose-h1:text-4xl prose-h1:mb-10 prose-h1:font-bold prose-p:mb-4 prose-strong:font-bold text-black leading-relaxed
|
|
32
32
|
${C?"animate-slide-down opacity-0":""}`,children:h}),W.jsx("div",{className:`mt-8 ${C?"animate-slide-down opacity-0":""}`,children:W.jsx("input",{type:"text",value:V,onChange:P,placeholder:w,className:"w-full px-4 py-3 border-2 border-black rounded-xl text-lg focus:outline-none focus:ring-2 focus:ring-blue-500"})}),d&&W.jsx("div",{className:`mt-8 flex justify-center ${C?"animate-fade-in opacity-0":""}`,style:C?{animationDelay:"1s"}:{},children:W.jsx("button",{onClick:R,className:"bg-white cursor-pointer px-8 py-3 border-2 border-black font-bold text-black text-lg rounded-xl shadow-[2px_2px_0px_rgba(0,0,0,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none",children:d})})]})}Yl("ProlificEnding",[{name:"cc",defaultValue:"",type:"string",description:"Completion code of the Profilic experiment (more commonly supplied via the code)"}]);function jf({prolificCode:h,data:d,updateStore:c}){let p=h??lo("cc","","string")??null;const g=W.jsxs("div",{className:"flex flex-col items-center",children:[W.jsx("svg",{className:"w-12 h-12",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:W.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),W.jsxs("p",{className:"",children:["Thank you! Your data has been successfully submitted. ",W.jsx("br",{})," You can go back to Prolific and enter the code ",p," to finish the study. Alternatively, you can click on this link:"," ",W.jsx("a",{target:"_blank",className:"text-blue-400",href:`https://app.prolific.com/submissions/complete?cc=${p}`,children:"Go to Prolific"})]})]});return W.jsx(ca,{data:d,updateStore:c,content:g,buttonText:"",next:()=>{}})}var Ef={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Vf=ne.createContext&&ne.createContext(Ef),iy=["attr","size","title"];function oy(h,d){if(h==null)return{};var c=sy(h,d),p,g;if(Object.getOwnPropertySymbols){var C=Object.getOwnPropertySymbols(h);for(g=0;g<C.length;g++)p=C[g],!(d.indexOf(p)>=0)&&Object.prototype.propertyIsEnumerable.call(h,p)&&(c[p]=h[p])}return c}function sy(h,d){if(h==null)return{};var c={};for(var p in h)if(Object.prototype.hasOwnProperty.call(h,p)){if(d.indexOf(p)>=0)continue;c[p]=h[p]}return c}function fa(){return fa=Object.assign?Object.assign.bind():function(h){for(var d=1;d<arguments.length;d++){var c=arguments[d];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(h[p]=c[p])}return h},fa.apply(this,arguments)}function Of(h,d){var c=Object.keys(h);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(h);d&&(p=p.filter(function(g){return Object.getOwnPropertyDescriptor(h,g).enumerable})),c.push.apply(c,p)}return c}function pa(h){for(var d=1;d<arguments.length;d++){var c=arguments[d]!=null?arguments[d]:{};d%2?Of(Object(c),!0).forEach(function(p){ay(h,p,c[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(c)):Of(Object(c)).forEach(function(p){Object.defineProperty(h,p,Object.getOwnPropertyDescriptor(c,p))})}return h}function ay(h,d,c){return d=ly(d),d in h?Object.defineProperty(h,d,{value:c,enumerable:!0,configurable:!0,writable:!0}):h[d]=c,h}function ly(h){var d=uy(h,"string");return typeof d=="symbol"?d:d+""}function uy(h,d){if(typeof h!="object"||!h)return h;var c=h[Symbol.toPrimitive];if(c!==void 0){var p=c.call(h,d||"default");if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(h)}function Tf(h){return h&&h.map((d,c)=>ne.createElement(d.tag,pa({key:c},d.attr),Tf(d.child)))}function tu(h){return d=>ne.createElement(cy,fa({attr:pa({},h.attr)},d),Tf(h.child))}function cy(h){var d=c=>{var{attr:p,size:g,title:C}=h,x=oy(h,iy),w=g||c.size||"1em",V;return c.className&&(V=c.className),h.className&&(V=(V?V+" ":"")+h.className),ne.createElement("svg",fa({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},c.attr,p,x,{className:V,style:pa(pa({color:h.color||c.color},c.style),h.style),height:w,width:w,xmlns:"http://www.w3.org/2000/svg"}),C&&ne.createElement("title",null,C),h.children)};return Vf!==void 0?ne.createElement(Vf.Consumer,null,c=>d(c)):d(Ef)}function fy(h){return tu({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M8.25 4.5a3.75 3.75 0 1 1 7.5 0v8.25a3.75 3.75 0 1 1-7.5 0V4.5Z"},child:[]},{tag:"path",attr:{d:"M6 10.5a.75.75 0 0 1 .75.75v1.5a5.25 5.25 0 1 0 10.5 0v-1.5a.75.75 0 0 1 1.5 0v1.5a6.751 6.751 0 0 1-6 6.709v2.291h3a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1 0-1.5h3v-2.291a6.751 6.751 0 0 1-6-6.709v-1.5A.75.75 0 0 1 6 10.5Z"},child:[]}]})(h)}function py(h){return tu({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z",clipRule:"evenodd"},child:[]}]})(h)}function dy(h){return tu({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M16.5 4.478v.227a48.816 48.816 0 0 1 3.878.512.75.75 0 1 1-.256 1.478l-.209-.035-1.005 13.07a3 3 0 0 1-2.991 2.77H8.084a3 3 0 0 1-2.991-2.77L4.087 6.66l-.209.035a.75.75 0 0 1-.256-1.478A48.567 48.567 0 0 1 7.5 4.705v-.227c0-1.564 1.213-2.9 2.816-2.951a52.662 52.662 0 0 1 3.369 0c1.603.051 2.815 1.387 2.815 2.951Zm-6.136-1.452a51.196 51.196 0 0 1 3.273 0C14.39 3.05 15 3.684 15 4.478v.113a49.488 49.488 0 0 0-6 0v-.113c0-.794.609-1.428 1.364-1.452Zm-.355 5.945a.75.75 0 1 0-1.5.058l.347 9a.75.75 0 1 0 1.499-.058l-.346-9Zm5.48.058a.75.75 0 1 0-1.498-.058l-.347 9a.75.75 0 0 0 1.5.058l.345-9Z",clipRule:"evenodd"},child:[]}]})(h)}const hy=({stream:h})=>{const d=ne.useRef(null),c=ne.useRef(null),p=ne.useRef(null),g=ne.useRef([]);return ne.useEffect(()=>{if(!h||!d.current)return;const C=new(window.AudioContext||window.webkitAudioContext),x=C.createAnalyser(),w=C.createMediaStreamSource(h);x.fftSize=2048,w.connect(x),p.current=x;const V=d.current,v=V.getContext("2d",{alpha:!1});if(!v)return;v.imageSmoothingEnabled=!0,v.imageSmoothingQuality="high";const P=window.devicePixelRatio||1,R=V.getBoundingClientRect();V.width=R.width*P,V.height=R.height*P,v.scale(P,P),V.style.width=`${R.width}px`,V.style.height=`${R.height}px`;const L=new Uint8Array(x.frequencyBinCount);g.current=Array(x.frequencyBinCount).fill(128);const H=(S,I)=>I+(S-I)*.08,q=(S,I=3)=>{const k=new Array(S.length).fill(0);for(let M=0;M<S.length;M++){let K=0,J=0;for(let U=Math.max(0,M-I);U<Math.min(S.length,M+I+1);U++)K+=S[U],J++;k[M]=K/J}return k},A=()=>{const S=R.width,I=R.height,k=I/2;c.current=requestAnimationFrame(A),x.getByteTimeDomainData(L);const M=Array.from(L).map((G,Q)=>H(G,g.current[Q])),K=q(M);g.current=K,v.fillStyle="#ffffff",v.fillRect(0,0,S*P,I*P),v.beginPath(),v.strokeStyle="rgba(0, 0, 0, 0.1)",v.lineWidth=1,v.moveTo(0,k),v.lineTo(S,k),v.stroke(),v.beginPath(),v.lineWidth=2,v.strokeStyle="rgba(0, 0, 0, 0.85)";const J=4,U=[];for(let G=0;G<K.length;G+=J){const Q=G/K.length*S,B=(K[G]-128)/128,ee=k+B*I*4;U.push([Q,ee])}if(U.length>0){v.moveTo(U[0][0],U[0][1]);for(let G=1;G<U.length-2;G++){const Q=(U[G][0]+U[G+1][0])/2,B=(U[G][1]+U[G+1][1])/2;v.quadraticCurveTo(U[G][0],U[G][1],Q,B)}if(U.length>2){const G=U.length-1;v.quadraticCurveTo(U[G-1][0],U[G-1][1],U[G][0],U[G][1])}}v.stroke()};return A(),()=>{c.current&&cancelAnimationFrame(c.current),w.disconnect(),C.close()}},[h]),W.jsx("canvas",{ref:d,width:300,height:60,className:"mx-auto rounded-lg bg-white shadow-xs"})},If=({question:h,handleSaveVoiceData:d,handleDiscardVoiceData:c})=>{const[p,g]=ne.useState(!1),[C,x]=ne.useState(null),[w,V]=ne.useState(null),v=ne.useRef(null),P=ne.useRef([]),R=async()=>{try{const A=window.audioInputId,S={audio:A?{deviceId:{exact:A}}:!0},I=await navigator.mediaDevices.getUserMedia(S);V(I),v.current=new MediaRecorder(I),P.current=[],v.current.ondataavailable=k=>{k.data.size>0&&P.current.push(k.data)},v.current.onstop=()=>{const k=new Blob(P.current,{type:"audio/webm"}),M=URL.createObjectURL(k);x(M),V(null),H(k,M)},v.current.start(),g(!0)}catch(A){console.error("Error accessing microphone:",A)}},L=()=>{v.current&&p&&(v.current.stop(),v.current.stream.getTracks().forEach(A=>A.stop()),g(!1))},H=async(A,S)=>{if(A&&S){const I=await new Promise(k=>{const M=new FileReader;M.onloadend=()=>{var J;const K=((J=M.result)==null?void 0:J.toString().split(",")[1])||"";k(K)},M.readAsDataURL(A)});d({blob:A,type:"audiorecording",url:S,data64:I,timestamp:new Date().toISOString()})}},q=()=>{C&&URL.revokeObjectURL(C),x(null),h.value=null,c()};return W.jsxs("div",{className:"flex flex-col items-center space-y-4 p-4 bg-white px-8 ",children:[!C&&W.jsx("button",{onClick:p?L:R,className:`flex items-center justify-center space-x-2 p-4 rounded-full border-2 border-black shadow-[2px_2px_0px_rgba(0,0,0,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none cursor-pointer
|
|
33
33
|
${p?"bg-red-500 hover:bg-red-600":""}
|