@adriansteffan/reactive 0.1.6 → 0.1.7
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.
|
@@ -17131,45 +17131,46 @@ function wae(i) {
|
|
|
17131
17131
|
}
|
|
17132
17132
|
const wb = /* @__PURE__ */ new Set(["index", "trialNumber", "start", "end", "duration", "type", "name", "csv", "responseData", "metadata"]), xae = /* @__PURE__ */ new Set(["index", "trialNumber", "start", "end", "duration", "type", "name"]);
|
|
17133
17133
|
function Eae(i, e, t) {
|
|
17134
|
-
var
|
|
17134
|
+
var a, o;
|
|
17135
17135
|
const s = [], r = {};
|
|
17136
|
-
for (const
|
|
17137
|
-
if (
|
|
17138
|
-
const
|
|
17139
|
-
for (const
|
|
17140
|
-
|
|
17141
|
-
}
|
|
17136
|
+
for (const l of e) {
|
|
17137
|
+
if (l.index === -1) continue;
|
|
17138
|
+
const u = l.csv, h = u ? (Array.isArray(u) ? u : [u]).map((c) => ({ csv: c })) : Gh[l.type] ?? [];
|
|
17139
|
+
for (const c of h)
|
|
17140
|
+
c.csv && (r[c.csv] || (r[c.csv] = []), r[c.csv].push({ item: l, flatten: "flatten" in c ? c.flatten : void 0 }));
|
|
17141
|
+
}
|
|
17142
|
+
const n = {
|
|
17143
|
+
sessionID: i,
|
|
17144
|
+
userAgent: (o = (a = e == null ? void 0 : e[0]) == null ? void 0 : a.responseData) == null ? void 0 : o.userAgent,
|
|
17145
|
+
...wae(e),
|
|
17146
|
+
...t
|
|
17147
|
+
};
|
|
17142
17148
|
if (r.session) {
|
|
17143
|
-
const o = {
|
|
17144
|
-
sessionID: i,
|
|
17145
|
-
userAgent: (a = (n = e == null ? void 0 : e[0]) == null ? void 0 : n.responseData) == null ? void 0 : a.userAgent,
|
|
17146
|
-
...wae(e),
|
|
17147
|
-
...t
|
|
17148
|
-
};
|
|
17149
17149
|
for (const { item: l } of r.session) {
|
|
17150
17150
|
const u = l.name || l.type;
|
|
17151
17151
|
for (const [h, c] of Object.entries(l))
|
|
17152
|
-
wb.has(h) || (
|
|
17152
|
+
wb.has(h) || (n[`${u}_${h}`] = c);
|
|
17153
17153
|
if (l.responseData && typeof l.responseData == "object" && !Array.isArray(l.responseData))
|
|
17154
17154
|
for (const [h, c] of Object.entries(l.responseData))
|
|
17155
|
-
|
|
17155
|
+
n[`${u}_${h}`] = c;
|
|
17156
17156
|
}
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
17161
|
-
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17157
|
+
delete r.session;
|
|
17158
|
+
}
|
|
17159
|
+
Object.keys(n).length > 1 && s.push({
|
|
17160
|
+
filename: `session.${i}.${Date.now()}.csv`,
|
|
17161
|
+
content: Cc([n]),
|
|
17162
|
+
encoding: "utf8"
|
|
17163
|
+
});
|
|
17164
|
+
for (const [l, u] of Object.entries(r)) {
|
|
17165
|
+
const h = u.flatMap(({ item: c, flatten: d }) => {
|
|
17166
|
+
const f = {};
|
|
17167
|
+
for (const [v, m] of Object.entries(c))
|
|
17168
|
+
wb.has(v) ? xae.has(v) && (f[`trial_${v}`] = m) : f[v] = m;
|
|
17169
|
+
return (d ? d(c) : [c.responseData && typeof c.responseData == "object" ? { ...c.responseData } : {}]).map((v) => ({ ...f, ...v }));
|
|
17169
17170
|
});
|
|
17170
|
-
|
|
17171
|
-
filename: `${
|
|
17172
|
-
content: Cc(
|
|
17171
|
+
h.length > 0 && s.push({
|
|
17172
|
+
filename: `${l}.${i}.${Date.now()}.csv`,
|
|
17173
|
+
content: Cc(h),
|
|
17173
17174
|
encoding: "utf8"
|
|
17174
17175
|
});
|
|
17175
17176
|
}
|
|
@@ -78625,7 +78626,7 @@ var Ym;
|
|
|
78625
78626
|
i.UTF8 = "utf8", i.ASCII = "ascii", i.UTF16 = "utf16";
|
|
78626
78627
|
})(Ym || (Ym = {}));
|
|
78627
78628
|
const Ea = wu("Filesystem", {
|
|
78628
|
-
web: () => import("./web-
|
|
78629
|
+
web: () => import("./web-DB83W6nu.js").then((i) => new i.FilesystemWeb())
|
|
78629
78630
|
});
|
|
78630
78631
|
vi("Upload", async (i, e, t, s) => {
|
|
78631
78632
|
const r = i.sessionID || `sim_${Date.now()}_${Math.floor(Lt(0, 2176782336)).toString(36)}`, n = xV({
|
|
@@ -78883,7 +78884,7 @@ var iw;
|
|
|
78883
78884
|
i.None = "NONE", i.Slide = "SLIDE", i.Fade = "FADE";
|
|
78884
78885
|
})(iw || (iw = {}));
|
|
78885
78886
|
const X3 = wu("StatusBar"), e7 = wu("ImmersiveMode", {
|
|
78886
|
-
web: () => import("./web-
|
|
78887
|
+
web: () => import("./web-CBs3GYkE.js").then((i) => new i.ImmersiveModeWeb())
|
|
78887
78888
|
});
|
|
78888
78889
|
Ai("EnterFullscreen", "session");
|
|
78889
78890
|
vi("EnterFullscreen", xu, {});
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as e, C as t, a as i, c as r, d as n, e as o, f as l, Y as m, z as u, M as c, P as p, g as P, h as g, Q as d, R as C, i as D, j as T, F as x, T as h, k, l as E, U as F, X as S, m as f, n as v, o as B, p as R, q as b, r as y, s as I, t as M, u as U, v as w, w as K, x as q, y as A, A as Q, B as Z, D as j, G as z, I as G, J as H, K as J, L, N, O, S as V, V as X, Z as Y, _, $, a0 as W, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ia, a6 as ra, a7 as na, a8 as oa, a9 as la, aa as ma, ab as ua } from "./mod-
|
|
1
|
+
import { H as e, C as t, a as i, c as r, d as n, e as o, f as l, Y as m, z as u, M as c, P as p, g as P, h as g, Q as d, R as C, i as D, j as T, F as x, T as h, k, l as E, U as F, X as S, m as f, n as v, o as B, p as R, q as b, r as y, s as I, t as M, u as U, v as w, w as K, x as q, y as A, A as Q, B as Z, D as j, G as z, I as G, J as H, K as J, L, N, O, S as V, V as X, Z as Y, _, $, a0 as W, a1 as aa, a2 as sa, a3 as ea, a4 as ta, a5 as ia, a6 as ra, a7 as na, a8 as oa, a9 as la, aa as ma, ab as ua } from "./mod-1ywzhVpK.js";
|
|
2
2
|
export {
|
|
3
3
|
e as Bounce,
|
|
4
4
|
t as CanvasBlock,
|
package/dist/reactive.umd.js
CHANGED
|
@@ -10149,7 +10149,7 @@
|
|
|
10149
10149
|
`),u.length>0){console.error(`
|
|
10150
10150
|
${u.length} participant(s) failed:`);for(const{index:f,error:y}of u)console.error(` Participant ${f}: ${y}`)}console.log(`Simulation complete. ${l-u.length}/${n} participants simulated successfully.`)}finally{a.kill(),console.log("Backend stopped.")}}const tc={};function ni(i,e,t){tc[i]||(tc[i]=[]),tc[i].push({csv:e,flatten:t})}function _2(i){const e=i.responseData;return Array.isArray(e)?e.map(t=>({block:i.name,...t})):[]}function D2(i){if(i==null)return"";const e=String(i);return e.includes(",")||e.includes('"')||e.includes(`
|
|
10151
10151
|
`)?`"${e.replace(/"/g,'""')}"`:e}function sc(i){if(!i||i.length===0)return"";const e=new Set;i.forEach(n=>{Object.keys(n).forEach(a=>{e.add(a)})});const t=Array.from(e),s=t.map(n=>D2(n)).join(","),r=i.map(n=>t.map(a=>{const o=n[a];return D2(o)}).join(","));return[s,...r].join(`
|
|
10152
|
-
`)}function rne(i){var s,r;const e=(r=(s=i==null?void 0:i[0])==null?void 0:s.responseData)==null?void 0:r.params;if(!e||typeof e!="object")return{};const t={};for(const[n,a]of Object.entries(e))a&&typeof a=="object"&&(t[n]=a.value??a.defaultValue);return t}const k2=new Set(["index","trialNumber","start","end","duration","type","name","csv","responseData","metadata"]),nne=new Set(["index","trialNumber","start","end","duration","type","name"]);function ane(i,e,t){var
|
|
10152
|
+
`)}function rne(i){var s,r;const e=(r=(s=i==null?void 0:i[0])==null?void 0:s.responseData)==null?void 0:r.params;if(!e||typeof e!="object")return{};const t={};for(const[n,a]of Object.entries(e))a&&typeof a=="object"&&(t[n]=a.value??a.defaultValue);return t}const k2=new Set(["index","trialNumber","start","end","duration","type","name","csv","responseData","metadata"]),nne=new Set(["index","trialNumber","start","end","duration","type","name"]);function ane(i,e,t){var a,o;const s=[],r={};for(const l of e){if(l.index===-1)continue;const u=l.csv,h=u?(Array.isArray(u)?u:[u]).map(c=>({csv:c})):tc[l.type]??[];for(const c of h)c.csv&&(r[c.csv]||(r[c.csv]=[]),r[c.csv].push({item:l,flatten:"flatten"in c?c.flatten:void 0}))}const n={sessionID:i,userAgent:(o=(a=e==null?void 0:e[0])==null?void 0:a.responseData)==null?void 0:o.userAgent,...rne(e),...t};if(r.session){for(const{item:l}of r.session){const u=l.name||l.type;for(const[h,c]of Object.entries(l))k2.has(h)||(n[`${u}_${h}`]=c);if(l.responseData&&typeof l.responseData=="object"&&!Array.isArray(l.responseData))for(const[h,c]of Object.entries(l.responseData))n[`${u}_${h}`]=c}delete r.session}Object.keys(n).length>1&&s.push({filename:`session.${i}.${Date.now()}.csv`,content:sc([n]),encoding:"utf8"});for(const[l,u]of Object.entries(r)){const h=u.flatMap(({item:c,flatten:d})=>{const f={};for(const[v,m]of Object.entries(c))k2.has(v)?nne.has(v)&&(f[`trial_${v}`]=m):f[v]=m;return(d?d(c):[c.responseData&&typeof c.responseData=="object"?{...c.responseData}:{}]).map(v=>({...f,...v}))});h.length>0&&s.push({filename:`${l}.${i}.${Date.now()}.csv`,content:sc(h),encoding:"utf8"})}return s}function O2(i){const{sessionID:e,data:t,store:s,generateFiles:r,sessionData:n,uploadRaw:a=!0}=i,o=r?r(e,t,s):[];return a&&o.push({filename:`${e}.raw.json`,content:JSON.stringify(t),encoding:"utf8"}),o.push(...ane(e,t,n)),o}function ic(i){return typeof i=="number"?i:i.type==="normal"?X.normal(i.mean,i.sd):X.uniform(i.min,i.max)}function M2(i){return Math.max(0,ic(i))}function N2(i){const e=i.dt??1,t=Math.sqrt(e),s=ic(i.startingPoint);if(i.contaminationRate&&X.uniform(0,1)<i.contaminationRate)return{choice:X.uniform(0,1)<.5?0:1,rt:X.uniform(0,i.timeLimit),finalEvidence:s,isContaminated:!0};const r=ic(i.driftRate),n=Math.max(0,ic(i.noiseLevel)),a=i.sensoryDelay!=null?M2(i.sensoryDelay):0,o=i.motorDelay!=null?M2(i.motorDelay):0;let l,u;Array.isArray(i.boundaries)?(u=i.boundaries[0],l=i.boundaries[1]):(l=i.boundaries,u=-i.boundaries);let h=a,c=s,d=!1,f=null;for(;h<i.timeLimit;){h+=e;let v=r,m=n;if(h<=i.stimOffset)i.stimulusCollapse&&h-a>(i.stimulusCollapse.delay??0)&&(l-=i.stimulusCollapse.rate*e,u+=i.stimulusCollapse.rate*e);else{const g=i.postStimStrategy;if(g.type==="snapshot"){const b=Math.abs(c-l),x=Math.abs(c-u);return{choice:b<=x?1:0,rt:h+o,finalEvidence:c,isContaminated:!1}}else g.type==="continue"?(v=g.residualDrift??0,m=n*(g.noiseMultiplier??1)):(v=0,h-i.stimOffset>(g.collapseDef.delay??0)&&(l-=g.collapseDef.rate*e,u+=g.collapseDef.rate*e))}if(c>=l){f=1,d=!0;break}if(c<=u){f=0,d=!0;break}if(c+=v*e+m*t*X.normal(0,1),c>=l){f=1,d=!0;break}if(c<=u){f=0,d=!0;break}}let y;return d?y=h+o:(y=i.timeLimit,f=null),{choice:f,rt:y,finalEvidence:c,isContaminated:!1}}function F2(i,e,t){if(i==null||e.length===0)return null;const s=Array.isArray(t)?t.map(r=>r.toLowerCase()):t?[t.toLowerCase()]:null;if(!s)return e[Math.floor(X.uniform(0,e.length))];if(i===1){const r=e.filter(n=>s.includes(n.toLowerCase()));if(r.length>0)return r[Math.floor(X.uniform(0,r.length))]}else{const r=e.filter(n=>!s.includes(n.toLowerCase()));if(r.length>0)return r[Math.floor(X.uniform(0,r.length))]}return e[Math.floor(X.uniform(0,e.length))]}var bm={exports:{}},kl={};/**
|
|
10153
10153
|
* @license React
|
|
10154
10154
|
* react-jsx-runtime.production.min.js
|
|
10155
10155
|
*
|
package/package.json
CHANGED
package/src/utils/upload.ts
CHANGED
|
@@ -119,13 +119,13 @@ function autoBuildCSVs(sessionID: string, data: any[], sessionData?: Record<stri
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
// 'session' group: one row per participant with metadata + responseData namespaced by trial name
|
|
122
|
+
const row: Record<string, any> = {
|
|
123
|
+
sessionID,
|
|
124
|
+
userAgent: data?.[0]?.responseData?.userAgent,
|
|
125
|
+
...extractParams(data),
|
|
126
|
+
...sessionData,
|
|
127
|
+
};
|
|
122
128
|
if (groups['session']) {
|
|
123
|
-
const row: Record<string, any> = {
|
|
124
|
-
sessionID,
|
|
125
|
-
userAgent: data?.[0]?.responseData?.userAgent,
|
|
126
|
-
...extractParams(data),
|
|
127
|
-
...sessionData,
|
|
128
|
-
};
|
|
129
129
|
for (const { item } of groups['session']) {
|
|
130
130
|
const prefix = item.name || item.type;
|
|
131
131
|
// Add user-provided metadata (non-builtin top-level keys), namespaced by trial name
|
|
@@ -139,12 +139,14 @@ function autoBuildCSVs(sessionID: string, data: any[], sessionData?: Record<stri
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
+
delete groups['session'];
|
|
143
|
+
}
|
|
144
|
+
if (Object.keys(row).length > 1) {
|
|
142
145
|
files.push({
|
|
143
146
|
filename: `session.${sessionID}.${Date.now()}.csv`,
|
|
144
147
|
content: convertArrayOfObjectsToCSV([row]),
|
|
145
148
|
encoding: 'utf8' as const,
|
|
146
149
|
});
|
|
147
|
-
delete groups['session'];
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
// All other groups: multi-row CSVs using registered flatteners (or raw responseData spread).
|