@capytale/meta-player 0.8.2 → 0.8.3

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.
Files changed (105) hide show
  1. package/.prettierrc.json +4 -4
  2. package/LICENSE +674 -674
  3. package/README.md +12 -12
  4. package/eslint.config.js +28 -28
  5. package/index.html +15 -15
  6. package/package.json +60 -60
  7. package/public/themes/lara-dark-blue/theme.css +7015 -7015
  8. package/public/themes/lara-light-blue/theme.css +7005 -7005
  9. package/src/App.tsx +139 -139
  10. package/src/AppRedux.css +39 -39
  11. package/src/MetaPlayer.tsx +170 -170
  12. package/src/activityJs.ts +7 -7
  13. package/src/app/createAppSlice.ts +6 -6
  14. package/src/app/hooks.ts +12 -12
  15. package/src/app/store.ts +52 -52
  16. package/src/app.module.scss +80 -80
  17. package/src/demo.tsx +87 -87
  18. package/src/external/prime.ts +5 -5
  19. package/src/features/activityData/ExitWarning.ts +28 -28
  20. package/src/features/activityData/IsAntiCheatExitDetectionDisabledSetter.tsx +19 -19
  21. package/src/features/activityData/IsDirtySetter.tsx +17 -17
  22. package/src/features/activityData/MetaPlayerOptionsSetter.tsx +41 -41
  23. package/src/features/activityData/activityDataSlice.ts +256 -256
  24. package/src/features/activityData/activityJsData.ts +82 -82
  25. package/src/features/activityData/hooks.ts +34 -34
  26. package/src/features/activityData/metaPlayerOptions.ts +23 -23
  27. package/src/features/activityData/uiState.ts +20 -20
  28. package/src/features/activityJS/ActivityJSProvider.tsx +339 -339
  29. package/src/features/activityJS/AfterResetAction.tsx +23 -23
  30. package/src/features/activityJS/AfterSaveAction.tsx +23 -23
  31. package/src/features/activityJS/BeforeResetAction.tsx +23 -23
  32. package/src/features/activityJS/BeforeSaveAction.tsx +23 -23
  33. package/src/features/activityJS/Saver.tsx +167 -167
  34. package/src/features/activityJS/hooks.ts +85 -85
  35. package/src/features/activityJS/internal-hooks.ts +96 -96
  36. package/src/features/activityJS/saverSlice.ts +96 -96
  37. package/src/features/activitySettings/ActivitySettingsSetter.tsx +21 -21
  38. package/src/features/activitySettings/hooks.ts +12 -12
  39. package/src/features/activitySettings/index.tsx +43 -43
  40. package/src/features/activitySettings/store.ts +108 -108
  41. package/src/features/activitySettings/style.module.scss +8 -8
  42. package/src/features/activitySettings/types.ts +140 -140
  43. package/src/features/activitySettings/ui.tsx +299 -299
  44. package/src/features/functionalities/AttachedFilesFunctionality.ts +23 -23
  45. package/src/features/functionalities/PreviewDialog.tsx +83 -83
  46. package/src/features/functionalities/functionalitiesSlice.ts +98 -98
  47. package/src/features/functionalities/hooks.ts +70 -70
  48. package/src/features/layout/hooks.ts +7 -7
  49. package/src/features/layout/layoutSlice.ts +90 -90
  50. package/src/features/navbar/activity-info/index.tsx +54 -54
  51. package/src/features/navbar/activity-info/style.module.scss +38 -38
  52. package/src/features/navbar/activity-menu/ActivityQuickActions.tsx +57 -57
  53. package/src/features/navbar/activity-menu/index.tsx +154 -153
  54. package/src/features/navbar/activity-menu/style.module.scss +7 -7
  55. package/src/features/navbar/capytale-menu/CloneDialog.tsx +75 -75
  56. package/src/features/navbar/capytale-menu/Countdown.tsx +312 -312
  57. package/src/features/navbar/capytale-menu/CountdownAndSaveButton.tsx +115 -115
  58. package/src/features/navbar/capytale-menu/index.tsx +260 -260
  59. package/src/features/navbar/capytale-menu/style.module.scss +8 -8
  60. package/src/features/navbar/index.tsx +39 -39
  61. package/src/features/navbar/navbarSlice.ts +79 -79
  62. package/src/features/navbar/review-navbar/GradingNav.tsx +128 -128
  63. package/src/features/navbar/review-navbar/index.tsx +18 -18
  64. package/src/features/navbar/review-navbar/style.module.scss +22 -22
  65. package/src/features/navbar/sidebars/ActivitySidebarActions.tsx +57 -57
  66. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.module.scss +43 -43
  67. package/src/features/navbar/sidebars/AttachedFilesSidebarContent.tsx +181 -181
  68. package/src/features/navbar/sidebars/SettingsSidebarContent.tsx +192 -192
  69. package/src/features/navbar/sidebars/style.module.scss +15 -15
  70. package/src/features/navbar/student-utils.ts +11 -11
  71. package/src/features/navbar/style.module.scss +65 -65
  72. package/src/features/pedago/InstructionsEditor.tsx +102 -102
  73. package/src/features/pedago/PdfEditor.tsx +91 -91
  74. package/src/features/pedago/PedagoCommands.tsx +353 -353
  75. package/src/features/pedago/SharedNotesEditor.tsx +144 -144
  76. package/src/features/pedago/index.tsx +207 -204
  77. package/src/features/pedago/style.module.scss +233 -233
  78. package/src/features/theming/ThemeSwitcher.tsx +51 -51
  79. package/src/features/theming/hooks.ts +6 -6
  80. package/src/features/theming/themingSlice.ts +93 -93
  81. package/src/features/toast.tsx +38 -38
  82. package/src/hooks/index.ts +16 -16
  83. package/src/index.css +132 -132
  84. package/src/index.ts +90 -90
  85. package/src/logo.svg +1 -1
  86. package/src/my_json_data.js +4146 -4146
  87. package/src/settings.ts +6 -6
  88. package/src/types.ts +9 -9
  89. package/src/utils/ButtonDoubleIcon.tsx +35 -35
  90. package/src/utils/CardSelector.tsx +41 -41
  91. package/src/utils/ErrorBoundary.tsx +41 -41
  92. package/src/utils/PopupButton.tsx +134 -134
  93. package/src/utils/activity.ts +8 -8
  94. package/src/utils/breakpoints.ts +4 -4
  95. package/src/utils/capytale.ts +10 -10
  96. package/src/utils/clipboard.ts +11 -11
  97. package/src/utils/download.ts +7 -7
  98. package/src/utils/equality.ts +32 -32
  99. package/src/utils/server-clock.ts +42 -42
  100. package/src/utils/style.module.scss +45 -45
  101. package/src/utils/useFullscreen.ts +65 -65
  102. package/src/vite-env.d.ts +1 -1
  103. package/tsconfig.json +28 -28
  104. package/tsconfig.node.json +9 -9
  105. package/vite.config.ts +11 -11
@@ -1,233 +1,233 @@
1
- .onlyGradingPedago {
2
- display: flex;
3
- width: 100%;
4
- :global(.layout-horizontal) & {
5
- flex-direction: row-reverse;
6
- }
7
- :global(.layout-vertical) & {
8
- flex-direction: column;
9
- }
10
- }
11
-
12
- .pedago {
13
- display: flex;
14
- height: 100%;
15
- width: 100%;
16
- :global(.layout-horizontal) & {
17
- flex-direction: row-reverse;
18
- }
19
- :global(.layout-vertical) & {
20
- flex-direction: column;
21
- }
22
- }
23
-
24
- .closeOnlyPedagoCommands {
25
- flex-direction: column;
26
- flex-shrink: 0;
27
- display: flex;
28
- background-color: var(--surface-200);
29
- :global(.layout-vertical) & {
30
- gap: 8px;
31
- flex-direction: row-reverse;
32
- align-items: center;
33
- }
34
- }
35
-
36
- .pedagoCommands {
37
- flex-direction: column;
38
- flex-shrink: 0;
39
- display: flex;
40
- background-color: var(--surface-200);
41
- :global(.layout-horizontal) & > *:first-child {
42
- background-color: var(--surface-300);
43
- }
44
- :global(.layout-vertical) & {
45
- gap: 8px;
46
- flex-direction: row;
47
- align-items: center;
48
- }
49
- }
50
-
51
- .pdfActions {
52
- padding: 10px 0;
53
- display: flex;
54
- :global(.layout-horizontal) & {
55
- padding-right: 9px;
56
- }
57
- }
58
-
59
- .pedagoHorizontalTabMenu {
60
- display: flex;
61
- flex-direction: column;
62
- overflow-y: auto;
63
- }
64
-
65
- .pedagoHorizontalTab {
66
- display: flex;
67
- gap: 20px;
68
- align-items: center;
69
- justify-content: space-between;
70
- color: var(--text-color-secondary);
71
- padding: 0 16px;
72
- transition: background-color 0.2s;
73
- user-select: none;
74
- cursor: pointer;
75
- &[data-selected="true"] {
76
- background-color: var(--surface-100);
77
- color: var(--text-color);
78
- }
79
- &:hover,
80
- &:focus {
81
- background-color: var(--surface-50);
82
- }
83
- & > span {
84
- padding: 13px 0;
85
- }
86
- & > i {
87
- padding-right: 8px;
88
- }
89
- }
90
-
91
- .dropzone {
92
- width: 100%;
93
- height: 100%;
94
- display: flex;
95
- flex-direction: column;
96
- align-items: center;
97
- justify-content: center;
98
- padding: 16px;
99
- cursor: pointer;
100
- outline: none;
101
- }
102
-
103
- .dropzoneRectangle {
104
- width: 100%;
105
- height: 100%;
106
- display: flex;
107
- flex-direction: column;
108
- align-items: center;
109
- justify-content: center;
110
- flex: 1;
111
- padding: 20px;
112
- border: 2px dashed var(--surface-100);
113
- border-radius: 2px;
114
- background-color: var(--surface-50);
115
- color: var(--text-color-secondary);
116
- cursor: pointer;
117
- outline: none;
118
- transition: border-color 0.2s ease-in-out;
119
-
120
- &[data-is-ficused="true"] {
121
- border-color: var(--primary-300);
122
- }
123
- &[data-is-drag-accept="true"] {
124
- border-color: var(--green-300);
125
- }
126
- &[data-is-drag-reject="true"] {
127
- border-color: var(--red-300);
128
- }
129
- }
130
-
131
- .smallSelectButton {
132
- flex-shrink: 0;
133
- & > * {
134
- padding: 11px 8px;
135
- }
136
- }
137
-
138
- .pedagoSeparator {
139
- flex-grow: 1;
140
- }
141
-
142
- .pedagoSplitter {
143
- height: 100%;
144
- border: none;
145
- border-radius: 0;
146
- background-color: var(--surface-0);
147
- & > :global(.p-splitter-panel) {
148
- overflow-y: hidden;
149
- }
150
- }
151
-
152
- .gradingPanel {
153
- display: flex;
154
- gap: 4px;
155
- width: 100%;
156
- }
157
-
158
- *:has(> .fullSizePanel) {
159
- padding: 4px;
160
- }
161
-
162
- .fullSizePanel {
163
- width: 100%;
164
- height: 100%;
165
- display: flex;
166
- flex-direction: column;
167
- & > :global(.p-panel-header) {
168
- flex-shrink: 0;
169
- }
170
- & > :global(.p-toggleable-content) {
171
- flex-grow: 1;
172
- overflow: hidden;
173
- }
174
- & > :global(.p-toggleable-content) > * {
175
- height: 100%;
176
- padding: 0;
177
- overflow: auto;
178
- display: flex;
179
- }
180
- }
181
-
182
- .pedagoTabMenu {
183
- align-self: stretch;
184
- & > * {
185
- background-color: transparent;
186
- flex-wrap: wrap;
187
- min-height: 100%;
188
- }
189
- }
190
-
191
- .pedagoTab {
192
- background-color: transparent;
193
- padding: 4px 1.25rem;
194
- gap: 16px;
195
- font-weight: normal;
196
- border-right: 1px solid var(--surface-300);
197
- border-radius: 0;
198
- :global(.p-highlight) & {
199
- z-index: 1;
200
- }
201
- }
202
-
203
- .pedagoContent {
204
- flex-grow: 1;
205
- overflow-y: auto;
206
- text-align: center;
207
- }
208
-
209
- .pedagoFeedbackPanel {
210
- flex-grow: 3;
211
- flex-basis: 0;
212
- }
213
-
214
- .pedagoGradePanel {
215
- flex-grow: 2;
216
- flex-basis: 0;
217
- }
218
-
219
- .fullTextarea {
220
- width: 100%;
221
- padding: 0.7em;
222
- border: 1px solid transparent;
223
- resize: none;
224
- height: 100%;
225
- background-color: transparent;
226
- font-family: Arial, Helvetica, sans-serif;
227
- }
228
-
229
- *:has(> .fullTextarea) {
230
- height: 100%;
231
- width: 100%;
232
- overflow: hidden;
233
- }
1
+ .onlyGradingPedago {
2
+ display: flex;
3
+ width: 100%;
4
+ :global(.layout-horizontal) & {
5
+ flex-direction: row-reverse;
6
+ }
7
+ :global(.layout-vertical) & {
8
+ flex-direction: column;
9
+ }
10
+ }
11
+
12
+ .pedago {
13
+ display: flex;
14
+ height: 100%;
15
+ width: 100%;
16
+ :global(.layout-horizontal) & {
17
+ flex-direction: row-reverse;
18
+ }
19
+ :global(.layout-vertical) & {
20
+ flex-direction: column;
21
+ }
22
+ }
23
+
24
+ .closeOnlyPedagoCommands {
25
+ flex-direction: column;
26
+ flex-shrink: 0;
27
+ display: flex;
28
+ background-color: var(--surface-200);
29
+ :global(.layout-vertical) & {
30
+ gap: 8px;
31
+ flex-direction: row-reverse;
32
+ align-items: center;
33
+ }
34
+ }
35
+
36
+ .pedagoCommands {
37
+ flex-direction: column;
38
+ flex-shrink: 0;
39
+ display: flex;
40
+ background-color: var(--surface-200);
41
+ :global(.layout-horizontal) & > *:first-child {
42
+ background-color: var(--surface-300);
43
+ }
44
+ :global(.layout-vertical) & {
45
+ gap: 8px;
46
+ flex-direction: row;
47
+ align-items: center;
48
+ }
49
+ }
50
+
51
+ .pdfActions {
52
+ padding: 10px 0;
53
+ display: flex;
54
+ :global(.layout-horizontal) & {
55
+ padding-right: 9px;
56
+ }
57
+ }
58
+
59
+ .pedagoHorizontalTabMenu {
60
+ display: flex;
61
+ flex-direction: column;
62
+ overflow-y: auto;
63
+ }
64
+
65
+ .pedagoHorizontalTab {
66
+ display: flex;
67
+ gap: 20px;
68
+ align-items: center;
69
+ justify-content: space-between;
70
+ color: var(--text-color-secondary);
71
+ padding: 0 16px;
72
+ transition: background-color 0.2s;
73
+ user-select: none;
74
+ cursor: pointer;
75
+ &[data-selected="true"] {
76
+ background-color: var(--surface-100);
77
+ color: var(--text-color);
78
+ }
79
+ &:hover,
80
+ &:focus {
81
+ background-color: var(--surface-50);
82
+ }
83
+ & > span {
84
+ padding: 13px 0;
85
+ }
86
+ & > i {
87
+ padding-right: 8px;
88
+ }
89
+ }
90
+
91
+ .dropzone {
92
+ width: 100%;
93
+ height: 100%;
94
+ display: flex;
95
+ flex-direction: column;
96
+ align-items: center;
97
+ justify-content: center;
98
+ padding: 16px;
99
+ cursor: pointer;
100
+ outline: none;
101
+ }
102
+
103
+ .dropzoneRectangle {
104
+ width: 100%;
105
+ height: 100%;
106
+ display: flex;
107
+ flex-direction: column;
108
+ align-items: center;
109
+ justify-content: center;
110
+ flex: 1;
111
+ padding: 20px;
112
+ border: 2px dashed var(--surface-100);
113
+ border-radius: 2px;
114
+ background-color: var(--surface-50);
115
+ color: var(--text-color-secondary);
116
+ cursor: pointer;
117
+ outline: none;
118
+ transition: border-color 0.2s ease-in-out;
119
+
120
+ &[data-is-ficused="true"] {
121
+ border-color: var(--primary-300);
122
+ }
123
+ &[data-is-drag-accept="true"] {
124
+ border-color: var(--green-300);
125
+ }
126
+ &[data-is-drag-reject="true"] {
127
+ border-color: var(--red-300);
128
+ }
129
+ }
130
+
131
+ .smallSelectButton {
132
+ flex-shrink: 0;
133
+ & > * {
134
+ padding: 11px 8px;
135
+ }
136
+ }
137
+
138
+ .pedagoSeparator {
139
+ flex-grow: 1;
140
+ }
141
+
142
+ .pedagoSplitter {
143
+ height: 100%;
144
+ border: none;
145
+ border-radius: 0;
146
+ background-color: var(--surface-0);
147
+ & > :global(.p-splitter-panel) {
148
+ overflow-y: hidden;
149
+ }
150
+ }
151
+
152
+ .gradingPanel {
153
+ display: flex;
154
+ gap: 4px;
155
+ width: 100%;
156
+ }
157
+
158
+ *:has(> .fullSizePanel) {
159
+ padding: 4px;
160
+ }
161
+
162
+ .fullSizePanel {
163
+ width: 100%;
164
+ height: 100%;
165
+ display: flex;
166
+ flex-direction: column;
167
+ & > :global(.p-panel-header) {
168
+ flex-shrink: 0;
169
+ }
170
+ & > :global(.p-toggleable-content) {
171
+ flex-grow: 1;
172
+ overflow: hidden;
173
+ }
174
+ & > :global(.p-toggleable-content) > * {
175
+ height: 100%;
176
+ padding: 0;
177
+ overflow: auto;
178
+ display: flex;
179
+ }
180
+ }
181
+
182
+ .pedagoTabMenu {
183
+ align-self: stretch;
184
+ & > * {
185
+ background-color: transparent;
186
+ flex-wrap: wrap;
187
+ min-height: 100%;
188
+ }
189
+ }
190
+
191
+ .pedagoTab {
192
+ background-color: transparent;
193
+ padding: 4px 1.25rem;
194
+ gap: 16px;
195
+ font-weight: normal;
196
+ border-right: 1px solid var(--surface-300);
197
+ border-radius: 0;
198
+ :global(.p-highlight) & {
199
+ z-index: 1;
200
+ }
201
+ }
202
+
203
+ .pedagoContent {
204
+ flex-grow: 1;
205
+ overflow-y: auto;
206
+ text-align: center;
207
+ }
208
+
209
+ .pedagoFeedbackPanel {
210
+ flex-grow: 3;
211
+ flex-basis: 0;
212
+ }
213
+
214
+ .pedagoGradePanel {
215
+ flex-grow: 2;
216
+ flex-basis: 0;
217
+ }
218
+
219
+ .fullTextarea {
220
+ width: 100%;
221
+ padding: 0.7em;
222
+ border: 1px solid transparent;
223
+ resize: none;
224
+ height: 100%;
225
+ background-color: transparent;
226
+ font-family: Arial, Helvetica, sans-serif;
227
+ }
228
+
229
+ *:has(> .fullTextarea) {
230
+ height: 100%;
231
+ width: 100%;
232
+ overflow: hidden;
233
+ }
@@ -1,51 +1,51 @@
1
- import { FC, useCallback, useContext, useEffect, useMemo } from "react";
2
- import { PrimeReactContext } from "primereact/api";
3
- import { useAppDispatch, useAppSelector } from "../../app/hooks";
4
- import {
5
- selectAutoSwitch,
6
- selectPreviousThemePath,
7
- selectThemePath,
8
- switchToTheme,
9
- } from "./themingSlice";
10
-
11
- const ThemeSwitcher: FC = () => {
12
- const dispatch = useAppDispatch();
13
- const mediaMatch = useMemo(
14
- () => window.matchMedia("(prefers-color-scheme: dark)"),
15
- [],
16
- );
17
- const { changeTheme } = useContext(PrimeReactContext);
18
- const themePath = useAppSelector(selectThemePath);
19
- const previousThemePath = useAppSelector(selectPreviousThemePath);
20
- const autoSwitch = useAppSelector(selectAutoSwitch);
21
- const handlePrefersColorScheme = useCallback((e: MediaQueryListEvent) => {
22
- dispatch(switchToTheme(e.matches ? "dark" : "light"));
23
- }, []);
24
- useEffect(() => {
25
- if (themePath !== previousThemePath) {
26
- changeTheme &&
27
- changeTheme(
28
- previousThemePath as string,
29
- themePath as string,
30
- "theme-link",
31
- );
32
- }
33
- }, [themePath]);
34
- useEffect(() => {
35
- if (autoSwitch) {
36
- if (mediaMatch.matches) {
37
- dispatch(switchToTheme("dark"));
38
- } else {
39
- dispatch(switchToTheme("light"));
40
- }
41
- mediaMatch.addEventListener("change", handlePrefersColorScheme);
42
- return () => {
43
- mediaMatch.removeEventListener("change", handlePrefersColorScheme);
44
- };
45
- }
46
- }, [autoSwitch]);
47
-
48
- return <></>;
49
- };
50
-
51
- export default ThemeSwitcher;
1
+ import { FC, useCallback, useContext, useEffect, useMemo } from "react";
2
+ import { PrimeReactContext } from "primereact/api";
3
+ import { useAppDispatch, useAppSelector } from "../../app/hooks";
4
+ import {
5
+ selectAutoSwitch,
6
+ selectPreviousThemePath,
7
+ selectThemePath,
8
+ switchToTheme,
9
+ } from "./themingSlice";
10
+
11
+ const ThemeSwitcher: FC = () => {
12
+ const dispatch = useAppDispatch();
13
+ const mediaMatch = useMemo(
14
+ () => window.matchMedia("(prefers-color-scheme: dark)"),
15
+ [],
16
+ );
17
+ const { changeTheme } = useContext(PrimeReactContext);
18
+ const themePath = useAppSelector(selectThemePath);
19
+ const previousThemePath = useAppSelector(selectPreviousThemePath);
20
+ const autoSwitch = useAppSelector(selectAutoSwitch);
21
+ const handlePrefersColorScheme = useCallback((e: MediaQueryListEvent) => {
22
+ dispatch(switchToTheme(e.matches ? "dark" : "light"));
23
+ }, []);
24
+ useEffect(() => {
25
+ if (themePath !== previousThemePath) {
26
+ changeTheme &&
27
+ changeTheme(
28
+ previousThemePath as string,
29
+ themePath as string,
30
+ "theme-link",
31
+ );
32
+ }
33
+ }, [themePath]);
34
+ useEffect(() => {
35
+ if (autoSwitch) {
36
+ if (mediaMatch.matches) {
37
+ dispatch(switchToTheme("dark"));
38
+ } else {
39
+ dispatch(switchToTheme("light"));
40
+ }
41
+ mediaMatch.addEventListener("change", handlePrefersColorScheme);
42
+ return () => {
43
+ mediaMatch.removeEventListener("change", handlePrefersColorScheme);
44
+ };
45
+ }
46
+ }, [autoSwitch]);
47
+
48
+ return <></>;
49
+ };
50
+
51
+ export default ThemeSwitcher;
@@ -1,7 +1,7 @@
1
- import { useAppSelector } from "../../app/hooks"
2
- import { selectThemeIsDark } from "./themingSlice";
3
-
4
- export const useThemeType = () => {
5
- const themeIsDark = useAppSelector(selectThemeIsDark);
6
- return themeIsDark ? "dark" : "light";
1
+ import { useAppSelector } from "../../app/hooks"
2
+ import { selectThemeIsDark } from "./themingSlice";
3
+
4
+ export const useThemeType = () => {
5
+ const themeIsDark = useAppSelector(selectThemeIsDark);
6
+ return themeIsDark ? "dark" : "light";
7
7
  }