@adriansteffan/reactive 0.1.27 → 0.1.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.
@@ -1,4 +1,4 @@
1
- import { W as e } from "./mod-DExpgO5y.js";
1
+ import { W as e } from "./mod-B1ELalrV.js";
2
2
  class s extends e {
3
3
  async enable() {
4
4
  console.log("Immersive mode is only available on Android");
@@ -1,4 +1,4 @@
1
- import { W as P, b as x, E } from "./mod-DExpgO5y.js";
1
+ import { W as P, b as x, E } from "./mod-B1ELalrV.js";
2
2
  function m(w) {
3
3
  const e = w.split("/").filter((t) => t !== "."), r = [];
4
4
  return e.forEach((t) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adriansteffan/reactive",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -16,6 +16,7 @@ export default function EnterFullscreen({
16
16
  buttonText,
17
17
  className,
18
18
  containerClass,
19
+ centered,
19
20
  animate,
20
21
  next,
21
22
  data,
@@ -27,6 +28,7 @@ export default function EnterFullscreen({
27
28
  buttonText?: string;
28
29
  className?: string;
29
30
  containerClass?: string;
31
+ centered?: boolean;
30
32
  animate?: boolean;
31
33
  delayMs?: number;
32
34
  } & BaseComponentProps) {
@@ -142,6 +144,7 @@ export default function EnterFullscreen({
142
144
  updateStore={updateStore}
143
145
  className={className}
144
146
  containerClass={containerClass}
147
+ centered={centered}
145
148
  animate={animate}
146
149
  content={contentWrap}
147
150
  buttonText={buttonText ?? 'Enter Fullscreen Mode'}
@@ -14,10 +14,11 @@ export default function ProlificEnding({
14
14
  prolificCode,
15
15
  className,
16
16
  containerClass,
17
+ centered,
17
18
  animate,
18
19
  data,
19
20
  updateStore
20
- }: { prolificCode?: string; className?: string; containerClass?: string; animate?: boolean } & BaseComponentProps) {
21
+ }: { prolificCode?: string; className?: string; containerClass?: string; centered?: boolean; animate?: boolean } & BaseComponentProps) {
21
22
  let prolificCodeUsed = prolificCode ?? getParam('cc', '', 'string') ?? null;
22
23
 
23
24
  const content = (
@@ -40,5 +41,5 @@ export default function ProlificEnding({
40
41
  </div>
41
42
  );
42
43
 
43
- return <Text data={data} updateStore={updateStore} className={className} containerClass={containerClass} animate={animate} content={content} buttonText='' next={() => {}} />;
44
+ return <Text data={data} updateStore={updateStore} className={className} containerClass={containerClass} centered={centered} animate={animate} content={content} buttonText='' next={() => {}} />;
44
45
  }
@@ -19,9 +19,10 @@ registerSimulation('Text', (trialProps, _experimentState, simulators, participan
19
19
 
20
20
  function Text({
21
21
  content,
22
- buttonText = 'Click me',
22
+ buttonText = 'Continue',
23
23
  className = '',
24
24
  containerClass,
25
+ centered = false,
25
26
  next,
26
27
  animate = false,
27
28
  allowedKeys = false,
@@ -31,6 +32,7 @@ function Text({
31
32
  onButtonClick?: () => void;
32
33
  className?: string;
33
34
  containerClass?: string;
35
+ centered?: boolean;
34
36
  animate?: boolean;
35
37
  allowedKeys?: string[] | boolean;
36
38
  } & BaseComponentProps) {
@@ -86,7 +88,7 @@ function Text({
86
88
  };
87
89
 
88
90
  return (
89
- <div className={`min-h-screen ${containerClass ?? th.containerBg}`}>
91
+ <div className={`min-h-screen ${centered ? 'flex items-center justify-center' : ''} ${containerClass ?? th.containerBg}`}>
90
92
  <div className={`max-w-prose mx-auto ${className} pt-20 pb-20 px-4 `}>
91
93
  <article
92
94
  className={`prose prose-2xl ${th.prose} text-xl ${th.proseLink} prose-a:underline prose-h1:text-4xl prose-h1:mb-10 prose-h1:font-bold prose-p:mb-4 prose-strong:font-bold ${th.text} leading-relaxed
@@ -231,6 +231,7 @@ export default function Upload({
231
231
  androidFolderName,
232
232
  className,
233
233
  containerClass,
234
+ centered,
234
235
  content,
235
236
  uploadingContent,
236
237
  errorContent,
@@ -243,6 +244,7 @@ export default function Upload({
243
244
  androidFolderName?: string;
244
245
  className?: string;
245
246
  containerClass?: string;
247
+ centered?: boolean;
246
248
  content?: React.ReactNode;
247
249
  uploadingContent?: React.ReactNode;
248
250
  errorContent?: React.ReactNode;
@@ -384,7 +386,7 @@ export default function Upload({
384
386
  const btnClass = `cursor-pointer ${th.buttonBg} px-8 py-3 border-2 ${th.buttonBorder} font-bold ${th.buttonText} text-lg rounded-xl ${th.buttonShadow} hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none`;
385
387
 
386
388
  return (
387
- <div className={containerClass ?? th.containerBg} style={{ position: 'fixed', inset: 0 }}>
389
+ <div className={`${centered ? 'flex items-center justify-center' : ''} ${containerClass ?? th.containerBg}`} style={{ position: 'fixed', inset: 0 }}>
388
390
  <div className={`flex flex-col items-center justify-center gap-4 p-6 text-xl mt-16 px-10 h-full ${th.text} ${className ?? ''}`}>
389
391
  {uploadState == 'initial' && !autoUpload && (
390
392
  <>
package/src/index.css CHANGED
@@ -85,6 +85,14 @@
85
85
  font-style: italic;
86
86
  }
87
87
 
88
+ .reactive-dark-bg {
89
+ background-color: #21294b;
90
+ background-image:
91
+ linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
92
+ linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
93
+ background-size: 48px 48px;
94
+ }
95
+
88
96
  /* customization for the surveyjs elements - a bit hacky and broken*/
89
97
  .sd-root-modern {
90
98
  background-color: white !important;
package/src/mod.tsx CHANGED
@@ -7,7 +7,7 @@ export * from './utils/common';
7
7
  export * from './utils/simulation';
8
8
  export { registerFlattener, arrayFlattener } from './utils/upload';
9
9
  export { normal, poisson, uniform, seedDistributions, sobol, halton, sampleParticipants } from './utils/distributions';
10
- export { useTheme, ThemeContext, THEME, t } from './utils/theme';
10
+ export { useTheme, ThemeContext, THEME, t, DARK_BG_CLASS } from './utils/theme';
11
11
  export type { Theme } from './utils/theme';
12
12
  export type { DimensionSpec, UniformSpec, NormalSpec, PoissonSpec, SamplingMethod } from './utils/distributions';
13
13
  export { simulateDDMTrial, mapDDMChoice } from './utils/ddm';
@@ -32,7 +32,7 @@ export const THEME = {
32
32
  toastTheme: 'light' as const,
33
33
  },
34
34
  dark: {
35
- containerBg: 'bg-[#1a1a2e]',
35
+ containerBg: 'reactive-dark-bg',
36
36
  text: 'text-[#f5f5f5]',
37
37
  prose: 'prose-invert',
38
38
  proseLink: 'prose-a:text-blue-400',
@@ -58,6 +58,8 @@ export const THEME = {
58
58
  },
59
59
  } as const;
60
60
 
61
+ export const DARK_BG_CLASS = 'reactive-dark-bg';
62
+
61
63
  export function t(theme: Theme) {
62
64
  return THEME[theme];
63
65
  }