@adriansteffan/reactive 0.1.23 → 0.1.25

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-CPp-Paa0.js";
1
+ import { W as e } from "./mod-pa8Hci6M.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-CPp-Paa0.js";
1
+ import { W as P, b as x, E } from "./mod-pa8Hci6M.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.23",
3
+ "version": "0.1.25",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -3,7 +3,7 @@ import { ToastContainer } from 'react-toastify';
3
3
 
4
4
  const queryClient = new QueryClient();
5
5
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
6
- import { createContext, ReactNode, useContext } from 'react';
6
+ import { createContext, ReactNode, useContext, useEffect } from 'react';
7
7
  import { SettingsScreen } from './settingsscreen';
8
8
  import { Param } from '../utils/common';
9
9
 
@@ -21,6 +21,19 @@ function parseBooleanProp(value: unknown): boolean {
21
21
 
22
22
  export default function ExperimentProvider({ children, disableSettings, disableHybridSimulation }: { children: ReactNode, disableSettings?: boolean, disableHybridSimulation?: boolean }) {
23
23
 
24
+ useEffect(() => {
25
+ const preventSpaceScroll = (e: KeyboardEvent) => {
26
+ if (e.key === ' ' &&
27
+ !(e.target instanceof HTMLInputElement) &&
28
+ !(e.target instanceof HTMLTextAreaElement) &&
29
+ !(e.target as HTMLElement).isContentEditable) {
30
+ e.preventDefault();
31
+ }
32
+ };
33
+ window.addEventListener('keydown', preventSpaceScroll);
34
+ return () => window.removeEventListener('keydown', preventSpaceScroll);
35
+ }, []);
36
+
24
37
  if (window.location.pathname.endsWith('/settings') && !parseBooleanProp(disableSettings)) {
25
38
  return (
26
39
  <SettingsScreen
@@ -132,7 +132,7 @@ function Quest({
132
132
 
133
133
  const survey = new Model({
134
134
  ...surveyJson,
135
- css: { ...defaultCss, root: 'sd-root-modern custom-root' },
135
+ css: { ...defaultCss, root: `sd-root-modern custom-root${containerClass ? ' survey-custom-bg' : ''}` },
136
136
  });
137
137
  survey.applyTheme(theme ?? ContrastLight);
138
138
 
@@ -146,9 +146,11 @@ function Quest({
146
146
  survey.onComplete.add(saveResults);
147
147
 
148
148
  return (
149
- <div className={`max-w-4xl mx-auto px-4 ${containerClass ?? ''}`}>
149
+ <div className={`min-h-screen ${containerClass ?? ''}`}>
150
150
  {!containerClass && <div className='absolute inset-0 -z-10 h-full w-full bg-white bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:16px_16px]' />}
151
- <Survey model={survey} />
151
+ <div className='max-w-4xl mx-auto px-4'>
152
+ <Survey model={survey} />
153
+ </div>
152
154
  </div>
153
155
  );
154
156
  }
@@ -35,6 +35,10 @@ function Text({
35
35
  } & BaseComponentProps) {
36
36
  const startTimeRef = useRef<number>(0);
37
37
 
38
+ useEffect(() => {
39
+ window.scrollTo(0, 0);
40
+ }, []);
41
+
38
42
  useEffect(() => {
39
43
  startTimeRef.current = now();
40
44
 
@@ -152,8 +152,8 @@ export const Tutorial = ({
152
152
  useEffect(() => {
153
153
  if (nextKey === false && backKey === false) return;
154
154
  const onKey = (e: KeyboardEvent) => {
155
- if (nextKey && e.key === nextKey) goNextIfCan();
156
- if (backKey && e.key === backKey) goBack();
155
+ if (nextKey && e.key === nextKey) { e.preventDefault(); goNextIfCan(); }
156
+ if (backKey && e.key === backKey) { e.preventDefault(); goBack(); }
157
157
  };
158
158
  window.addEventListener('keydown', onKey);
159
159
  return () => window.removeEventListener('keydown', onKey);
package/src/index.css CHANGED
@@ -94,6 +94,11 @@
94
94
  font-family: 'Atkinson Hyperlegible', sans-serif; /* Added this line */
95
95
  }
96
96
 
97
+ .sd-root-modern.survey-custom-bg {
98
+ background-color: transparent !important;
99
+ background-image: none !important;
100
+ }
101
+
97
102
  .sd-root-modern * {
98
103
  font-family: 'Atkinson Hyperlegible', sans-serif;
99
104
  }