js-dos 8.1.4 → 8.1.6

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 (141) hide show
  1. package/README.md +1 -1
  2. package/dist/emulators/emulators.js +2 -0
  3. package/dist/emulators/emulators.js.map +1 -0
  4. package/dist/emulators/types/build.d.ts +28 -0
  5. package/dist/emulators/types/dos/bundle/dos-bundle.d.ts +20 -0
  6. package/dist/emulators/types/dos/dosbox/ts/direct.d.ts +3 -0
  7. package/dist/emulators/types/dos/dosbox/ts/worker.d.ts +3 -0
  8. package/dist/emulators/types/emulators.d.ts +76 -0
  9. package/dist/emulators/types/http.d.ts +9 -0
  10. package/dist/emulators/types/impl/ci-impl.d.ts +29 -0
  11. package/dist/emulators/types/impl/emulators-impl.d.ts +26 -0
  12. package/dist/emulators/types/impl/modules.d.ts +38 -0
  13. package/dist/emulators/types/libzip/libzip.d.ts +16 -0
  14. package/dist/emulators/types/protocol/messages-queue.d.ts +8 -0
  15. package/dist/emulators/types/protocol/protocol.d.ts +128 -0
  16. package/dist/emulators/wdosbox-x.js +55 -0
  17. package/dist/emulators/wdosbox-x.js.symbols +8760 -0
  18. package/dist/emulators/wdosbox-x.wasm +0 -0
  19. package/dist/emulators/wdosbox.js +55 -0
  20. package/dist/emulators/wdosbox.js.symbols +3001 -0
  21. package/dist/emulators/wdosbox.wasm +0 -0
  22. package/dist/emulators/wlibzip.js +21 -0
  23. package/dist/emulators/wlibzip.js.symbols +268 -0
  24. package/dist/emulators/wlibzip.wasm +0 -0
  25. package/dist/js-dos.css +1 -0
  26. package/dist/js-dos.js +22 -0
  27. package/dist/js-dos.js.map +1 -0
  28. package/package.json +1 -1
  29. package/release.zip +0 -0
  30. package/.eslintrc.json +0 -43
  31. package/.github/workflows/build.yml +0 -51
  32. package/.gitmodules +0 -4
  33. package/index.html +0 -110
  34. package/postcss.config.cjs +0 -8
  35. package/src/app.css +0 -14
  36. package/src/base.css +0 -10
  37. package/src/components/checkbox.tsx +0 -41
  38. package/src/components/close-button.tsx +0 -17
  39. package/src/components/components.css +0 -28
  40. package/src/components/dos-option-checkbox.tsx +0 -94
  41. package/src/components/dos-option-select.tsx +0 -108
  42. package/src/components/dos-option-slider.tsx +0 -35
  43. package/src/components/error.tsx +0 -16
  44. package/src/components/loading.tsx +0 -26
  45. package/src/components/lock.tsx +0 -10
  46. package/src/components/select.tsx +0 -33
  47. package/src/components/slider.tsx +0 -69
  48. package/src/download-file.ts +0 -18
  49. package/src/frame/account-frame.tsx +0 -156
  50. package/src/frame/editor/defaults.ts +0 -419
  51. package/src/frame/editor/editor-conf-frame.tsx +0 -227
  52. package/src/frame/editor/editor-frame.css +0 -55
  53. package/src/frame/editor/editor-fs-frame.tsx +0 -314
  54. package/src/frame/fat-drives-frame.tsx +0 -199
  55. package/src/frame/frame.css +0 -119
  56. package/src/frame/frame.tsx +0 -34
  57. package/src/frame/image-rendering-frame.tsx +0 -8
  58. package/src/frame/network-frame.tsx +0 -157
  59. package/src/frame/quick-save-frame.tsx +0 -98
  60. package/src/frame/settings-frame.tsx +0 -14
  61. package/src/frame/stats-frame.tsx +0 -87
  62. package/src/host/bundle-storage.ts +0 -91
  63. package/src/host/fullscreen.ts +0 -35
  64. package/src/host/lcache.ts +0 -203
  65. package/src/host/lstorage.ts +0 -156
  66. package/src/i18n.ts +0 -185
  67. package/src/index.css +0 -7
  68. package/src/load.ts +0 -132
  69. package/src/login/login.css +0 -9
  70. package/src/login/login.tsx +0 -77
  71. package/src/main.tsx +0 -197
  72. package/src/public/types.ts +0 -45
  73. package/src/sidebar/account-button.tsx +0 -33
  74. package/src/sidebar/cloud-save-button.tsx +0 -89
  75. package/src/sidebar/diskette-icon.tsx +0 -14
  76. package/src/sidebar/fullscreen-button.tsx +0 -44
  77. package/src/sidebar/network-button.tsx +0 -39
  78. package/src/sidebar/sidebar-button.tsx +0 -244
  79. package/src/sidebar/sidebar.css +0 -47
  80. package/src/sidebar/sidebar.tsx +0 -30
  81. package/src/sockdrive/LICENSE +0 -674
  82. package/src/sockdrive/README.md +0 -45
  83. package/src/sockdrive/include/sockdrive.h +0 -23
  84. package/src/sockdrive/js/.eslintrc.json +0 -43
  85. package/src/sockdrive/js/package.json +0 -29
  86. package/src/sockdrive/js/src/fatfs/chains.js +0 -318
  87. package/src/sockdrive/js/src/fatfs/dir.js +0 -385
  88. package/src/sockdrive/js/src/fatfs/helpers.js +0 -210
  89. package/src/sockdrive/js/src/fatfs/index.js +0 -606
  90. package/src/sockdrive/js/src/fatfs/structs.js +0 -255
  91. package/src/sockdrive/js/src/fatfs/vol.js +0 -166
  92. package/src/sockdrive/js/src/sockdrive/cache.ts +0 -56
  93. package/src/sockdrive/js/src/sockdrive/drive.ts +0 -471
  94. package/src/sockdrive/js/src/sockdrive/lru.ts +0 -221
  95. package/src/sockdrive/js/src/sockdrive/types.ts +0 -14
  96. package/src/sockdrive/js/src/sockdrive-fat.d.ts +0 -64
  97. package/src/sockdrive/js/src/sockdrive-fat.ts +0 -226
  98. package/src/sockdrive/js/src/sockdrive-native.ts +0 -100
  99. package/src/sockdrive/js/src/test/test.ts +0 -289
  100. package/src/sockdrive/js/tsconfig.json +0 -11
  101. package/src/sockdrive/js/webpack.config.js +0 -68
  102. package/src/sockdrive/js/yarn.lock +0 -1808
  103. package/src/store/auth.ts +0 -115
  104. package/src/store/dos.ts +0 -305
  105. package/src/store/editor.ts +0 -61
  106. package/src/store/init.ts +0 -48
  107. package/src/store/storage.ts +0 -32
  108. package/src/store/ui.ts +0 -191
  109. package/src/store.tsx +0 -116
  110. package/src/ui.tsx +0 -140
  111. package/src/v8/changes.ts +0 -56
  112. package/src/v8/config.ts +0 -20
  113. package/src/v8/subscriptions.ts +0 -62
  114. package/src/vite-env.d.ts +0 -5
  115. package/src/window/dos/controls/keyboard.ts +0 -32
  116. package/src/window/dos/controls/keys.ts +0 -331
  117. package/src/window/dos/controls/mouse/mount.ts +0 -99
  118. package/src/window/dos/controls/mouse/mouse-locked.ts +0 -51
  119. package/src/window/dos/controls/mouse/mouse-not-locked.ts +0 -84
  120. package/src/window/dos/controls/mouse/mouse-swipe.ts +0 -57
  121. package/src/window/dos/controls/mouse/pointer.ts +0 -85
  122. package/src/window/dos/controls/mouse.ts +0 -21
  123. package/src/window/dos/dos-dhry2.tsx +0 -191
  124. package/src/window/dos/dos-runtime.tsx +0 -216
  125. package/src/window/dos/dos-window.tsx +0 -91
  126. package/src/window/dos/render/canvas.ts +0 -65
  127. package/src/window/dos/render/resize.ts +0 -31
  128. package/src/window/dos/render/webgl.ts +0 -173
  129. package/src/window/dos/sound/audio-node.ts +0 -148
  130. package/src/window/error-window.tsx +0 -9
  131. package/src/window/loading-window.tsx +0 -54
  132. package/src/window/prerun-window.tsx +0 -121
  133. package/src/window/select-window.tsx +0 -118
  134. package/src/window/window.css +0 -78
  135. package/src/window/window.tsx +0 -49
  136. package/src/ws/ws-sockdrive.ts +0 -123
  137. package/src/ws/ws-transport-layer.ts +0 -468
  138. package/tailwind.config.cjs +0 -48
  139. package/tsconfig.json +0 -32
  140. package/tsconfig.node.json +0 -9
  141. package/vite.config.ts +0 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-dos",
3
- "version": "8.1.4",
3
+ "version": "8.1.6",
4
4
  "description": "Full-featured DOS player with multiple emulator backends",
5
5
  "type": "module",
6
6
  "keywords": [
package/release.zip ADDED
Binary file
package/.eslintrc.json DELETED
@@ -1,43 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true
5
- },
6
- "extends": [
7
- "google"
8
- ],
9
- "parser": "@typescript-eslint/parser",
10
- "parserOptions": {
11
- "ecmaVersion": 12,
12
- "sourceType": "module"
13
- },
14
- "plugins": [
15
- "@typescript-eslint"
16
- ],
17
- "rules": {
18
- "object-curly-spacing": [
19
- "error",
20
- "always"
21
- ],
22
- "require-jsdoc": "off",
23
- "quotes": [
24
- "error",
25
- "double"
26
- ],
27
- "indent": [
28
- "error",
29
- 4,
30
- {
31
- "SwitchCase": 1,
32
- "FunctionDeclaration": {
33
- "parameters": "first"
34
- }
35
- }
36
- ],
37
- "max-len": [
38
- "error",
39
- 120
40
- ]
41
- },
42
- "ignorePatterns": ["dist/**/*"]
43
- }
@@ -1,51 +0,0 @@
1
- name: Build
2
-
3
- on:
4
- push:
5
- branches: [ 8.xx ]
6
- tags:
7
- - "v*.*.*"
8
- pull_request:
9
- branches: [ 8.xx ]
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
-
15
- strategy:
16
- matrix:
17
- node-version: [18.x]
18
-
19
- steps:
20
- - uses: actions/checkout@v4
21
- with:
22
- submodules: 'recursive'
23
- - name: build js-dos
24
- uses: actions/setup-node@v4
25
- with:
26
- node-version: ${{ matrix.node-version }}
27
- registry-url: 'https://registry.npmjs.org'
28
- cache: 'npm'
29
- - run: npm install -g yarn
30
- - run: yarn
31
- - run: yarn run eslint . --ext ts,tsx --max-warnings 0
32
- - run: mkdir -p public/emulators && cp -rv node_modules/emulators/dist/* public/emulators
33
- - run: NODE_ENV=production yarn run vite build --base /latest --sourcemap true --minify terser
34
- - run: zip -9r release.zip dist/*
35
- - name: publish
36
- if: startsWith(github.ref, 'refs/tags/')
37
- run: npm publish
38
- env:
39
- NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
40
- - name: upload
41
- uses: actions/upload-artifact@v3.0.0
42
- with:
43
- name: 'dist'
44
- path: 'dist'
45
- - name: Release
46
- uses: softprops/action-gh-release@v2
47
- if: startsWith(github.ref, 'refs/tags/')
48
- with:
49
- name: ${{ github.ref_name }}
50
- files: |
51
- ${{github.workspace}}/release.zip
package/.gitmodules DELETED
@@ -1,4 +0,0 @@
1
- [submodule "src/sockdrive"]
2
- path = src/sockdrive
3
- url = git@github.com:makevm/sockdrive.git
4
- branch = main
package/index.html DELETED
@@ -1,110 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>js-dos 8.xx</title>
8
- <style>
9
- html,
10
- body {
11
- width: 100%;
12
- height: 100%;
13
- }
14
- </style>
15
- </head>
16
-
17
- <body>
18
- <div id="app"></div>
19
- <script type="module" src="/src/main.tsx">
20
- </script>
21
- <script>
22
- const params = new URLSearchParams(location.search);
23
- document.addEventListener("DOMContentLoaded", () => {
24
- /* eslint-disable max-len */
25
- /* eslint-enable max-len */
26
- const props = Dos(document.getElementById("app"),
27
- {
28
- // url: decodeURIComponent("https%3A%2F%2Fcdn.dos.zone%2Fcustom%2Fdos%2Fdoom_dm.jsdos"),
29
- // url: decodeURIComponent("https%3A%2F%2Fcdn.dos.zone%2Fcustom%2Fdos%2Fhomm2_netbios.jsdos"),
30
- // url: "https://cdn.dos.zone/original/2X/2/24b00b14f118580763440ecaddcc948f8cb94f14.jsdos", // digger
31
- // url: "https://cdn.dos.zone/custom/dos/doom.jsdos",
32
- // url: "https://cdn.dos.zone/custom/dos/duke3d_ipx.jsdos",
33
- // url: "https://br.cdn.dos.zone/ipx/duke3d/duke3d_ipx.jsdos",
34
- // url: "https://br.cdn.dos.zone/ipx/doom_dm/doom_dm.jsdos",
35
- // url: "https://cdn.dos.zone/original/2X/b/b4b5275904d86a4ab8a20917b2b7e34f0df47bf7.jsdos", // dhry2
36
- // url: "https://cdn.dos.zone/original/2X/7/744842062905f72648a4d492ccc2526d039b3702.jsdos", // sim-city
37
- // dosboxConf: diabloConf,
38
- pathPrefix: "/emulators/",
39
- server: params.get("server"),
40
- room: params.get("room"),
41
- //backendHardware: (backend) => {
42
- // console.log("Hardware backend for", backend);
43
- // return Promise.resolve("ws://127.0.0.1:8080");
44
- //},
45
- // sockdriveBackend: {
46
- // name: "makevm",
47
- // host: "backend.make-vm.com:8001",
48
- // },
49
- onEvent: (event) => {
50
- console.log("Event", event)
51
- if (event === "ci-ready") {
52
- // props.setFrame("network");
53
- // props.setFullScreen(true);
54
- }
55
- },
56
- });
57
- });
58
-
59
- const diabloConf = `
60
- [sdl]
61
- autolock=false
62
- mouse_emulation=integration
63
-
64
- [dosbox]
65
- title=Windows 95
66
- memsize=128
67
-
68
- [video]
69
- vmemsize=8
70
- vesa modelist width limit=0
71
- vesa modelist height limit=0
72
-
73
- [dos]
74
- ver=7.1
75
- hard drive data rate limit=0
76
- floppy drive data rate limit=0
77
-
78
- [cpu]
79
- cputype=pentium_mmx
80
- core=auto
81
- integration device=true
82
-
83
- [sblaster]
84
- sbtype=sb16vibra
85
-
86
- [fdc, primary]
87
- int13fakev86io=true
88
-
89
- [ide, primary]
90
- int13fakeio=true
91
- int13fakev86io=true
92
-
93
- [ide, secondary]
94
- int13fakeio=true
95
- int13fakev86io=true
96
- cd-rom insertion delay=4000
97
-
98
- [render]
99
- scaler=none
100
-
101
- [autoexec]
102
- echo off
103
- imgmount 2 sockdrive wss://sockdrive.js-dos.com:8001 dos.zone diablo_109_c
104
- imgmount 3 sockdrive wss://sockdrive.js-dos.com:8001 dos.zone diablo_109_d
105
- boot c:
106
- `;
107
- </script>
108
- </body>
109
-
110
- </html>
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- 'postcss-import': {},
4
- 'tailwindcss/nesting': {},
5
- tailwindcss: {},
6
- autoprefixer: {},
7
- },
8
- }
package/src/app.css DELETED
@@ -1,14 +0,0 @@
1
- .jsdos-rso {
2
- @apply h-full;
3
- background: hsl(var(--pc));
4
-
5
- .jsdos-fullscreen-workaround {
6
- position: fixed !important;
7
- left: 0;
8
- top: 0;
9
- bottom: 0;
10
- right: 0;
11
- background: black;
12
- z-index: 999;
13
- }
14
- }
package/src/base.css DELETED
@@ -1,10 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- @layer base {
6
- :root {
7
- --sidebar-width: 3rem;
8
- /* w-12 */
9
- }
10
- }
@@ -1,41 +0,0 @@
1
- import { useEffect, useRef } from "preact/hooks";
2
-
3
- export function Checkbox(props: {
4
- class?: string,
5
- toggleClass?: string,
6
- label: string,
7
- checked?: boolean,
8
- onChange?: (value: boolean) => void,
9
- disabled?: boolean,
10
- intermediate?: boolean,
11
- }) {
12
- const ref = useRef<HTMLInputElement>(null);
13
-
14
- useEffect(() => {
15
- if (ref === null || ref.current === null) {
16
- return;
17
- }
18
-
19
- (ref.current as any).indeterminate = props.intermediate;
20
- }, [ref, props.intermediate]);
21
-
22
- function onChange() {
23
- if (props.onChange) {
24
- props.onChange(!(props.checked === true));
25
- }
26
- }
27
-
28
- return <div className={props.class + " form-control option"}
29
- onClick={onChange}>
30
- <label className="label cursor-pointer">
31
- <span className="label-text mr-6">{props.label}</span>
32
- <input
33
- ref={ref}
34
- checked={props.checked === true}
35
- type="checkbox"
36
- className={ "toggle " + (props.checked ? " toggle-primary " : "") +
37
- props.toggleClass }
38
- disabled={props.disabled === true} />
39
- </label>
40
- </div>;
41
- }
@@ -1,17 +0,0 @@
1
- export function CloseButton(props: {
2
- onClose: () => void
3
- class?: string,
4
- }) {
5
- return <div class={ "text-gray-400 hover:text-gray-600 btn " +
6
- props.class } onClick={props.onClose}>
7
- <svg xmlns="http://www.w3.org/2000/svg"
8
- class="w-full h-full"
9
- fill="none"
10
- viewBox="0 0 24 24"
11
- stroke="currentColor"
12
- stroke-width="2">
13
- <path stroke-linecap="round" stroke-linejoin="round"
14
- d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
15
- </svg>
16
- </div>;
17
- }
@@ -1,28 +0,0 @@
1
- .jsdos-rso {
2
- select {
3
- @apply select select-bordered;
4
- }
5
-
6
- .slider {
7
- @apply flex flex-row items-center;
8
-
9
- .label {
10
- @apply mr-4 w-min;
11
- }
12
-
13
- .touch {
14
- @apply cursor-pointer h-16 relative flex-grow flex flex-row items-center;
15
-
16
- .bg {
17
- @apply w-full h-2 rounded-full;
18
- background-color: hsl(var(--b2));
19
- }
20
-
21
- .point {
22
- @apply absolute h-6 w-6 rounded-full;
23
- background-color: hsl(var(--bc));
24
- }
25
- }
26
-
27
- }
28
- }
@@ -1,94 +0,0 @@
1
- import { useDispatch, useSelector } from "react-redux";
2
- import { useT } from "../i18n";
3
- import { State, useNonSerializableStore } from "../store";
4
- import { dosSlice } from "../store/dos";
5
- import { dispatchLoginAction, uiSlice } from "../store/ui";
6
- import { Checkbox } from "./checkbox";
7
-
8
- export function Editor() {
9
- const t = useT();
10
- const dispatch = useDispatch();
11
- const editor = useSelector((state: State) => state.ui.editor);
12
- return <Checkbox
13
- class="mt-4"
14
- label={t("editor")}
15
- checked={editor}
16
- onChange={(e) => dispatch(uiSlice.actions.setEditor(e))}
17
- />;
18
- }
19
-
20
- export function MouseCapture() {
21
- const t = useT();
22
- const dispatch = useDispatch();
23
- const lock = useSelector((state: State) => state.dos.mouseCapture);
24
- return <Checkbox
25
- class="mt-4"
26
- label={t("mouse_lock")}
27
- checked={lock}
28
- onChange={(l) => dispatch(dosSlice.actions.mouseCapture(l))}
29
- />;
30
- }
31
-
32
- export function PauseCheckbox() {
33
- const t = useT();
34
- const dispatch = useDispatch();
35
- const paused = useSelector((state: State) => state.dos.paused);
36
- const disabled = useSelector((state: State) => state.ui.window) !== "run";
37
- return <Checkbox
38
- class="mt-4"
39
- label={t("pause")}
40
- checked={paused}
41
- disabled={disabled}
42
- onChange={(p) => dispatch(dosSlice.actions.paused(p))}
43
- />;
44
- }
45
-
46
- export function WorkerCheckbox() {
47
- const t = useT();
48
- const dispatch = useDispatch();
49
- const worker = useSelector((state: State) => state.dos.worker);
50
- const hardware = useSelector((state: State) => state.dos.backendHardware);
51
- const disabled = useSelector((state: State) => state.ui.window) === "run";
52
- const nonSerializableStore = useNonSerializableStore();
53
- return hardware && nonSerializableStore.options.backendHardware ? null : <Checkbox
54
- class="mt-4"
55
- label={t("worker")}
56
- checked={worker}
57
- disabled={disabled}
58
- onChange={(w) => dispatch(dosSlice.actions.dosWorker(w))}
59
- />;
60
- }
61
-
62
- export function HardwareCheckbox() {
63
- const t = useT();
64
- const dispatch = useDispatch();
65
- const hardware = useSelector((state: State) => state.dos.backendHardware);
66
- const nonSerializableStore = useNonSerializableStore();
67
- return nonSerializableStore.options.backendHardware ? <Checkbox
68
- class="mt-4"
69
- label={t("hardware")}
70
- checked={hardware}
71
- onChange={(h) => dispatch(dosSlice.actions.dosBackendHardware(h))}
72
- /> : null;
73
- }
74
-
75
- export function SockdriveWrite() {
76
- const t = useT();
77
- const dispatch = useDispatch();
78
- const account = useSelector((state: State) => state.auth.account);
79
- const premium = account?.premium === true;
80
- const visible = useSelector((state: State) => state.dos.backend === "dosboxX");
81
- const checked = useSelector((state: State) => state.dos.sockdriveWrite) && premium;
82
- return visible ? <Checkbox
83
- class="mt-4"
84
- label={t("fat_write")}
85
- checked={checked}
86
- onChange={(c) => {
87
- if (!premium) {
88
- dispatchLoginAction(account, dispatch);
89
- } else {
90
- dispatch(dosSlice.actions.setSockdriveWrite(c));
91
- }
92
- }}
93
- /> : null;
94
- }
@@ -1,108 +0,0 @@
1
- import { useDispatch, useSelector } from "react-redux";
2
- import { useT } from "../i18n";
3
- import { State } from "../store";
4
- import { Select } from "./select";
5
- import { AnyAction } from "@reduxjs/toolkit";
6
- import {
7
- Backend, BackendValues, dosSlice, ImageRendering, ImageRenderingValues, RenderAspect, RenderAspectValues,
8
- RenderBackend, RenderBackendValues,
9
- } from "../store/dos";
10
- import { ThemeValues, Theme, uiSlice } from "../store/ui";
11
- import { lStorage } from "../host/lstorage";
12
- import { SockdriveBackendName, initSlice, sockdriveBackendNames } from "../store/init";
13
-
14
- export function BackendSelect() {
15
- const locked = useSelector((state: State) => state.dos.backendLocked);
16
- return <OptionSelect
17
- label="emulation_backend"
18
- values={[...BackendValues]}
19
- disabled={locked}
20
- selector={(state: State) => state.dos.backend}
21
- dispatch={(newValue: Backend) => {
22
- lStorage.setItem("backend", newValue);
23
- return dosSlice.actions.dosBackend(newValue);
24
- }}
25
- />;
26
- }
27
-
28
- export function RenderSelect() {
29
- const disabled = useSelector((state: State) => state.ui.window) === "run";
30
- return <OptionSelect
31
- label="render_backend"
32
- values={[...RenderBackendValues]}
33
- disabled={disabled}
34
- selector={(state: State) => state.dos.renderBackend}
35
- dispatch={(newValue: RenderBackend) => dosSlice.actions.renderBackend(newValue)}
36
- />;
37
- }
38
-
39
- export function RenderAspectSelect(props: { multiline?: boolean }) {
40
- return <OptionSelect
41
- label="render_aspect"
42
- multiline={props.multiline}
43
- values={[...RenderAspectValues]}
44
- selector={(state: State) => state.dos.renderAspect}
45
- dispatch={(newValue: RenderAspect) => dosSlice.actions.renderAspect(newValue)}
46
- />;
47
- }
48
-
49
- export function ImageRenderingSelect(props: { multiline?: boolean }) {
50
- return <OptionSelect
51
- label="image_rendering"
52
- multiline={props.multiline}
53
- values={[...ImageRenderingValues]}
54
- selector={(state: State) => state.dos.imageRendering}
55
- dispatch={(newValue: ImageRendering) => dosSlice.actions.imageRendering(newValue)}
56
- />;
57
- }
58
-
59
- export function ThemeSelect(props: { class?: string, multiline?: boolean }) {
60
- return <OptionSelect
61
- class={props.class}
62
- label="theme"
63
- values={[...ThemeValues]}
64
- selector={(state: State) => state.ui.theme}
65
- dispatch={(newValue: Theme) => uiSlice.actions.theme(newValue)}
66
- multiline={props.multiline}
67
- />;
68
- }
69
-
70
- export function SockdriveBackend(props: { class?: string, multiline?: boolean }) {
71
- return <OptionSelect<SockdriveBackendName>
72
- class={props.class}
73
- label="FAT16/32 Backend"
74
- values={sockdriveBackendNames}
75
- selector={(state: State) => state.init.sockdriveBackendName}
76
- dispatch={(newValue) => initSlice.actions.setSockdriveBackendName(newValue)}
77
- multiline={props.multiline}
78
- />;
79
- }
80
-
81
- function OptionSelect<T>(props: {
82
- class?: string,
83
- selectClass?: string,
84
- label: string,
85
- values: string[]
86
- selector: (state: State) => T,
87
- dispatch: (newValue: T) => AnyAction;
88
- disabled?: boolean,
89
- multiline?: boolean,
90
- }) {
91
- const t = useT();
92
- const value = useSelector(props.selector);
93
- const dispatch = useDispatch();
94
-
95
- function onBackend(newValue: T) {
96
- dispatch(props.dispatch(newValue));
97
- }
98
- return <Select
99
- class={"mt-4 " + props.class}
100
- selectClass={props.selectClass}
101
- disabled={props.disabled}
102
- multiline={props.multiline}
103
- label={t(props.label)}
104
- selected={value as string}
105
- values={props.values}
106
- onSelect={onBackend as any} />;
107
- }
108
-
@@ -1,35 +0,0 @@
1
- import { useDispatch, useSelector } from "react-redux";
2
- import { useT } from "../i18n";
3
- import { dosSlice } from "../store/dos";
4
- import { Slider } from "./slider";
5
- import { State } from "../store";
6
-
7
- export function MouseSensitiviySlider(props: {
8
- class?: string,
9
- }) {
10
- const t = useT();
11
- const sensitivity = useSelector((state: State) => state.dos.mouseSensitivity);
12
- const dispatch = useDispatch();
13
-
14
- return <Slider
15
- class={"mt-4 " + props.class}
16
- label={t("mouse_sensitivity")}
17
- value={sensitivity}
18
- onChange={(value) => dispatch(dosSlice.actions.mouseSensitivity(value)) }
19
- />;
20
- }
21
-
22
- export function VolumeSlider(props: {
23
- class?: string,
24
- }) {
25
- const t = useT();
26
- const volume = useSelector((state: State) => state.dos.volume);
27
- const dispatch = useDispatch();
28
-
29
- return <Slider
30
- class={props.class}
31
- label={t("volume")}
32
- value={volume}
33
- onChange={(value) => dispatch(dosSlice.actions.volume(value)) }
34
- />;
35
- }
@@ -1,16 +0,0 @@
1
- import { useT } from "../i18n";
2
-
3
- export function Error(props: {
4
- error?: string | null,
5
- onSkip?: () => void,
6
- }) {
7
- const t = useT();
8
- const error = props.error ?? "Unexpected error";
9
-
10
- return <div class="flex-grow flex flex-col items-center justify-center px-8 m-auto">
11
- <div class="text-2xl text-center">{t("error")}</div>
12
- <div class="text-red-400 mt-8 text-2xl text-center">"{error}"</div>
13
- <div class="mt-8 text-sm text-center">{t("consult_logs")}</div>
14
- { props.onSkip && <button class="mt-8 btn-primary" onClick={props.onSkip}>{t("skip")}</button> }
15
- </div>;
16
- }
@@ -1,26 +0,0 @@
1
- export function Loading(props: {
2
- head: string,
3
- message: string,
4
- }) {
5
- const { head, message } = props;
6
-
7
- return <div class="flex flex-col items-center justify-center frame-color px-8">
8
- <div class="text-2xl text-center">{head}</div>
9
- <div class="mt-2 text-center">{message}</div>
10
- </div>;
11
- }
12
-
13
- export function formatSize(size: number) {
14
- if (size < 1024) {
15
- return size + "b";
16
- }
17
-
18
- size /= 1024;
19
-
20
- if (size < 1024) {
21
- return Math.round(size) + "kb";
22
- }
23
-
24
- size /= 1024;
25
- return Math.round(size * 10) / 10 + "mb";
26
- }
@@ -1,10 +0,0 @@
1
- export function LockBadge(props: {
2
- class?: string,
3
- }) {
4
- return <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"
5
- class={ props.class ?? "absolute left-0 top-0 -ml-1 -mt-1 text-error w-4 h-4" }>
6
- <path fill-rule="evenodd" d="M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003
7
- 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75
8
- 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z" clip-rule="evenodd" />
9
- </svg>;
10
- }
@@ -1,33 +0,0 @@
1
- import { useT } from "../i18n";
2
-
3
- export function Select(props: {
4
- class?: string,
5
- selectClass?: string,
6
- label: string,
7
- selected: string,
8
- values: string[],
9
- onSelect?: (value: string) => void,
10
- disabled?: boolean,
11
- multiline?: boolean,
12
- }) {
13
- const t = useT();
14
- const multiline = props.multiline === true;
15
- function onSelect(e: any) {
16
- if (props.onSelect !== undefined) {
17
- props.onSelect(e.currentTarget.value);
18
- }
19
- }
20
- return <div class={props.class + " option flex " +
21
- (multiline ? "flex-col" : "flex-row items-center")}>
22
- <div class={ multiline ? "mb-2" : "mr-4" }>{props.label}</div>
23
- <div class="flex-grow">
24
- <select class={ props.selectClass ? props.selectClass :
25
- (multiline ? "w-full" : "w-28") }
26
- onChange={onSelect} disabled={props.disabled === true}>
27
- {props.values.map((v) => {
28
- return <option selected={v === props.selected} value={v}>{t(v)}</option>;
29
- })}
30
- </select>
31
- </div>
32
- </div>;
33
- }