@adriansteffan/reactive 0.0.27 → 0.0.29
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-CbGhKi2f.js → mod-BY9yD0Pz.js} +5920 -5725
- package/dist/mod.d.ts +21 -8
- package/dist/reactive.es.js +18 -16
- package/dist/reactive.umd.js +33 -33
- package/dist/style.css +1 -1
- package/dist/{web-DOFokKz7.js → web-Crj4uOnK.js} +1 -1
- package/dist/{web-BFGLx41c.js → web-D4yetCSC.js} +1 -1
- package/package.json +1 -1
- package/src/components/canvasblock.tsx +10 -3
- package/src/components/experimentrunner.tsx +28 -13
- package/src/components/storeui.tsx +327 -0
- package/src/utils/array.ts +49 -15
- package/src/utils/bytecode.ts +175 -144
package/dist/mod.d.ts
CHANGED
|
@@ -45,10 +45,16 @@ export declare function CheckDevice({ check, content, data, store, updateStore,
|
|
|
45
45
|
content?: React.ReactNode;
|
|
46
46
|
} & BaseComponentProps): JSX_2.Element | null;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Splits array into chunks
|
|
50
|
+
*/
|
|
51
|
+
export declare function chunk<T>(array: T[], n: number): T[][];
|
|
52
|
+
|
|
48
53
|
declare type ComponentResultData = BaseTrialData & {
|
|
49
54
|
type: string;
|
|
50
55
|
name: string;
|
|
51
56
|
responseData?: any;
|
|
57
|
+
metadata?: Record<string, any>;
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
declare type ComponentsMap = {
|
|
@@ -160,6 +166,11 @@ declare type ParamType = 'string' | 'number' | 'boolean' | 'array' | 'json';
|
|
|
160
166
|
|
|
161
167
|
declare type ParamValue<T extends ParamType> = T extends 'number' ? number : T extends 'boolean' ? boolean : T extends 'array' | 'json' ? any : string;
|
|
162
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Applies a function to an array
|
|
171
|
+
*/
|
|
172
|
+
export declare function pipe<T, U>(array: T[], fn: (arr: T[]) => U): U;
|
|
173
|
+
|
|
163
174
|
export declare function PlainInput({ content, buttonText, className, next, updateStore, animate, storeupdate, placeholder, }: BaseComponentProps & {
|
|
164
175
|
content: React.ReactNode;
|
|
165
176
|
buttonText?: string;
|
|
@@ -195,7 +206,6 @@ declare type RefinedTrialData = ComponentResultData | CanvasResultData;
|
|
|
195
206
|
* import { registerArrayExtensions } from '@adriansteffan/reactive/array';
|
|
196
207
|
* registerArrayExtensions();
|
|
197
208
|
*
|
|
198
|
-
* // Now you can use the methods
|
|
199
209
|
* const myArray = [1, 2, 3, 4, 5];
|
|
200
210
|
* myArray.shuffle();
|
|
201
211
|
* ```
|
|
@@ -215,16 +225,11 @@ export declare function RequestFilePermission({ next }: BaseComponentProps): JSX
|
|
|
215
225
|
|
|
216
226
|
/**
|
|
217
227
|
* Returns random elements from an array
|
|
218
|
-
* @param array The source array
|
|
219
|
-
* @param n Number of random elements to return (defaults to 1)
|
|
220
|
-
* @returns Array of randomly selected elements
|
|
221
228
|
*/
|
|
222
229
|
export declare function sample<T>(array: T[], n?: number): T[];
|
|
223
230
|
|
|
224
231
|
/**
|
|
225
232
|
* Shuffles array elements using Fisher-Yates algorithm
|
|
226
|
-
* @param array The source array
|
|
227
|
-
* @returns A new shuffled array
|
|
228
233
|
*/
|
|
229
234
|
export declare function shuffle<T>(array: T[]): T[];
|
|
230
235
|
|
|
@@ -289,13 +294,21 @@ declare global {
|
|
|
289
294
|
/**
|
|
290
295
|
* Returns random elements from the array
|
|
291
296
|
* @param n Number of random elements to return (defaults to 1)
|
|
292
|
-
* @returns Array of randomly selected elements
|
|
293
297
|
*/
|
|
294
298
|
sample(n?: number): Array<T>;
|
|
295
299
|
/**
|
|
296
300
|
* Shuffles array elements using Fisher-Yates algorithm
|
|
297
|
-
* @returns A new shuffled array
|
|
298
301
|
*/
|
|
299
302
|
shuffle(): Array<T>;
|
|
303
|
+
/**
|
|
304
|
+
* Applies a function to the array
|
|
305
|
+
* @param fn Function to apply to the array
|
|
306
|
+
*/
|
|
307
|
+
pipe<U>(fn: (arr: Array<T>) => U): U;
|
|
308
|
+
/**
|
|
309
|
+
* Splits array into chunks
|
|
310
|
+
* @param n Number of chunks to create
|
|
311
|
+
*/
|
|
312
|
+
chunk(n: number): Array<Array<T>>;
|
|
300
313
|
}
|
|
301
314
|
}
|
package/dist/reactive.es.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import { C as e,
|
|
1
|
+
import { C as e, v as r, o as n, q as i, t, u as o, M as l, P as m, l as p, m as c, Q as u, R as P, T as x, U as E, k as g, c as f, g as k, e as C, d, i as h, n as v, p as F, r as R, h as q, f as w, s as y, a as B, j as D } from "./mod-BY9yD0Pz.js";
|
|
2
2
|
export {
|
|
3
3
|
e as CanvasBlock,
|
|
4
4
|
r as CheckDevice,
|
|
5
5
|
n as EnterFullscreen,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
i as ExitFullscreen,
|
|
7
|
+
t as ExperimentProvider,
|
|
8
8
|
o as ExperimentRunner,
|
|
9
9
|
l as MicCheck,
|
|
10
10
|
m as Param,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
p as PlainInput,
|
|
12
|
+
c as ProlificEnding,
|
|
13
|
+
u as Quest,
|
|
14
|
+
P as RequestFilePermission,
|
|
15
15
|
x as Text,
|
|
16
16
|
E as Upload,
|
|
17
17
|
g as canvasCountdown,
|
|
18
|
-
f as
|
|
18
|
+
f as chunk,
|
|
19
|
+
k as getParam,
|
|
19
20
|
C as getPlatform,
|
|
20
21
|
d as isDesktop,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
h as isFullscreen,
|
|
23
|
+
v as now,
|
|
24
|
+
F as pipe,
|
|
25
|
+
R as registerArrayExtensions,
|
|
26
|
+
q as registerComponentParams,
|
|
27
|
+
w as registerExperimentParams,
|
|
28
|
+
y as sample,
|
|
29
|
+
B as shuffle,
|
|
30
|
+
D as subsetExperimentByParam
|
|
29
31
|
};
|