js-dos 7.4.9 → 8.1.0

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 (155) hide show
  1. package/.github/workflows/build.yml +51 -0
  2. package/.gitmodules +4 -0
  3. package/README.deployment.md +11 -0
  4. package/README.md +29 -89
  5. package/index.html +106 -0
  6. package/package.json +46 -71
  7. package/postcss.config.cjs +8 -0
  8. package/src/app.css +14 -0
  9. package/src/base.css +10 -0
  10. package/src/components/checkbox.tsx +41 -0
  11. package/src/components/close-button.tsx +17 -0
  12. package/src/components/components.css +28 -0
  13. package/src/components/dos-option-checkbox.tsx +94 -0
  14. package/src/components/dos-option-select.tsx +108 -0
  15. package/src/components/dos-option-slider.tsx +35 -0
  16. package/src/components/error.tsx +16 -0
  17. package/src/components/loading.tsx +26 -0
  18. package/src/components/lock.tsx +10 -0
  19. package/src/components/select.tsx +33 -0
  20. package/src/components/slider.tsx +69 -0
  21. package/src/download-file.ts +18 -0
  22. package/src/frame/account-frame.tsx +156 -0
  23. package/src/frame/editor/defaults.ts +419 -0
  24. package/src/frame/editor/editor-conf-frame.tsx +226 -0
  25. package/src/frame/editor/editor-frame.css +55 -0
  26. package/src/frame/editor/editor-fs-frame.tsx +314 -0
  27. package/src/frame/fat-drives-frame.tsx +135 -0
  28. package/src/frame/frame.css +119 -0
  29. package/src/frame/frame.tsx +34 -0
  30. package/src/frame/image-rendering-frame.tsx +8 -0
  31. package/src/frame/network-frame.tsx +157 -0
  32. package/src/frame/quick-save-frame.tsx +96 -0
  33. package/src/frame/settings-frame.tsx +14 -0
  34. package/src/frame/stats-frame.tsx +87 -0
  35. package/src/host/bundle-storage.ts +91 -0
  36. package/src/host/fullscreen.ts +35 -0
  37. package/src/host/lcache.ts +203 -0
  38. package/src/host/lstorage.ts +156 -0
  39. package/src/i18n.ts +179 -0
  40. package/src/index.css +7 -0
  41. package/src/load.ts +132 -0
  42. package/src/login/login.css +9 -0
  43. package/src/login/login.tsx +77 -0
  44. package/src/main.tsx +197 -0
  45. package/src/public/types.ts +41 -0
  46. package/src/sidebar/account-button.tsx +33 -0
  47. package/src/sidebar/cloud-save-button.tsx +89 -0
  48. package/src/sidebar/diskette-icon.tsx +14 -0
  49. package/src/sidebar/fullscreen-button.tsx +44 -0
  50. package/src/sidebar/network-button.tsx +39 -0
  51. package/src/sidebar/sidebar-button.tsx +244 -0
  52. package/src/sidebar/sidebar.css +47 -0
  53. package/src/sidebar/sidebar.tsx +30 -0
  54. package/src/sockdrive/LICENSE +674 -0
  55. package/src/sockdrive/README.md +45 -0
  56. package/src/sockdrive/include/sockdrive.h +23 -0
  57. package/src/sockdrive/js/.eslintrc.json +43 -0
  58. package/src/sockdrive/js/package.json +29 -0
  59. package/src/sockdrive/js/src/fatfs/chains.js +318 -0
  60. package/src/sockdrive/js/src/fatfs/dir.js +385 -0
  61. package/src/sockdrive/js/src/fatfs/helpers.js +210 -0
  62. package/src/sockdrive/js/src/fatfs/index.js +606 -0
  63. package/src/sockdrive/js/src/fatfs/structs.js +255 -0
  64. package/src/sockdrive/js/src/fatfs/vol.js +166 -0
  65. package/src/sockdrive/js/src/sockdrive/cache.ts +133 -0
  66. package/src/sockdrive/js/src/sockdrive/drive.ts +457 -0
  67. package/src/sockdrive/js/src/sockdrive/lru.ts +221 -0
  68. package/src/sockdrive/js/src/sockdrive/types.ts +14 -0
  69. package/src/sockdrive/js/src/sockdrive-fat.d.ts +64 -0
  70. package/src/sockdrive/js/src/sockdrive-fat.ts +226 -0
  71. package/src/sockdrive/js/src/sockdrive-native.ts +100 -0
  72. package/src/sockdrive/js/src/test/test.ts +288 -0
  73. package/src/sockdrive/js/tsconfig.json +11 -0
  74. package/src/sockdrive/js/webpack.config.js +68 -0
  75. package/src/sockdrive/js/yarn.lock +1808 -0
  76. package/src/store/auth.ts +115 -0
  77. package/src/store/dos.ts +305 -0
  78. package/src/store/editor.ts +61 -0
  79. package/src/store/init.ts +48 -0
  80. package/src/store/storage.ts +32 -0
  81. package/src/store/ui.ts +186 -0
  82. package/src/store.tsx +108 -0
  83. package/src/ui.tsx +104 -0
  84. package/src/v8/changes.ts +56 -0
  85. package/src/v8/config.ts +18 -0
  86. package/src/v8/subscriptions.ts +62 -0
  87. package/src/vite-env.d.ts +2 -0
  88. package/src/window/dos/controls/keyboard.ts +32 -0
  89. package/src/window/dos/controls/keys.ts +331 -0
  90. package/src/window/dos/controls/mouse/mount.ts +99 -0
  91. package/src/window/dos/controls/mouse/mouse-locked.ts +51 -0
  92. package/src/window/dos/controls/mouse/mouse-not-locked.ts +84 -0
  93. package/src/window/dos/controls/mouse/mouse-swipe.ts +57 -0
  94. package/src/window/dos/controls/mouse/pointer.ts +85 -0
  95. package/src/window/dos/controls/mouse.ts +21 -0
  96. package/src/window/dos/dos-dhry2.tsx +191 -0
  97. package/src/window/dos/dos-runtime.tsx +214 -0
  98. package/src/window/dos/dos-window.tsx +84 -0
  99. package/src/window/dos/render/canvas.ts +65 -0
  100. package/src/window/dos/render/resize.ts +31 -0
  101. package/src/window/dos/render/webgl.ts +173 -0
  102. package/src/window/dos/sound/audio-node.ts +148 -0
  103. package/src/window/error-window.tsx +9 -0
  104. package/src/window/loading-window.tsx +54 -0
  105. package/src/window/prerun-window.tsx +123 -0
  106. package/src/window/select-window.tsx +118 -0
  107. package/src/window/window.css +78 -0
  108. package/src/window/window.tsx +49 -0
  109. package/src/ws/ws-sockdrive.ts +101 -0
  110. package/src/ws/ws-transport-layer.ts +455 -0
  111. package/tailwind.config.cjs +48 -0
  112. package/tsconfig.json +32 -0
  113. package/tsconfig.node.json +9 -0
  114. package/vite.config.ts +22 -0
  115. package/LICENSE +0 -339
  116. package/dist/emulators-ui-loader.png +0 -0
  117. package/dist/js-dos.css +0 -1690
  118. package/dist/js-dos.js +0 -17
  119. package/dist/js-dos.js.map +0 -1
  120. package/dist/types/src/backend/v7/latency.d.ts +0 -8
  121. package/dist/types/src/backend/v7/personal.d.ts +0 -2
  122. package/dist/types/src/backend/v7/v7-config.d.ts +0 -16
  123. package/dist/types/src/components/action-bar.d.ts +0 -2
  124. package/dist/types/src/components/action-hide.d.ts +0 -4
  125. package/dist/types/src/components/action-save-or-exit.d.ts +0 -4
  126. package/dist/types/src/components/client.d.ts +0 -6
  127. package/dist/types/src/components/controls.d.ts +0 -8
  128. package/dist/types/src/components/cpu-control.d.ts +0 -2
  129. package/dist/types/src/components/horizontal-slider.d.ts +0 -13
  130. package/dist/types/src/components/region.d.ts +0 -6
  131. package/dist/types/src/components/scale-control.d.ts +0 -3
  132. package/dist/types/src/components/sensitivity-control.d.ts +0 -3
  133. package/dist/types/src/components/sidebar/latency-info.d.ts +0 -7
  134. package/dist/types/src/components/sidebar/main.d.ts +0 -2
  135. package/dist/types/src/components/sidebar/networking.d.ts +0 -2
  136. package/dist/types/src/components/sidebar/token/token-add-time.d.ts +0 -2
  137. package/dist/types/src/components/sidebar/token/token-select.d.ts +0 -2
  138. package/dist/types/src/components/sidebar/token/token.d.ts +0 -17
  139. package/dist/types/src/components/sidebar.d.ts +0 -2
  140. package/dist/types/src/components/sync-control.d.ts +0 -2
  141. package/dist/types/src/components/tip.d.ts +0 -2
  142. package/dist/types/src/components/vertical-slider.d.ts +0 -12
  143. package/dist/types/src/components/volume-control.d.ts +0 -3
  144. package/dist/types/src/dom.d.ts +0 -8
  145. package/dist/types/src/hardware-transport-layer.d.ts +0 -18
  146. package/dist/types/src/icons.d.ts +0 -95
  147. package/dist/types/src/player-app.d.ts +0 -50
  148. package/dist/types/src/player.d.ts +0 -29
  149. package/dist/types/src/request.d.ts +0 -1
  150. package/dist/types/src/xhr.d.ts +0 -6
  151. package/dist/types/v7-services/src/personal.d.ts +0 -3
  152. package/dist/wdosbox.js +0 -55
  153. package/dist/wdosbox.js.symbols +0 -3174
  154. package/dist/wdosbox.wasm +0 -0
  155. package/examples/digger/index.html +0 -71
@@ -0,0 +1,51 @@
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 ADDED
@@ -0,0 +1,4 @@
1
+ [submodule "src/sockdrive"]
2
+ path = src/sockdrive
3
+ url = git@github.com:makevm/sockdrive.git
4
+ branch = main
@@ -0,0 +1,11 @@
1
+ # Deployment
2
+
3
+ Build and push release version:
4
+
5
+ ```
6
+ yarn run vite build --base /latest --sourcemap true --minify terser && \
7
+ aws s3 --endpoint-url=https://storage.yandexcloud.net sync --acl public-read \
8
+ dist s3://jsdos/latest --delete
9
+ ```
10
+
11
+ Clear the CDN cache in dashboard.
package/README.md CHANGED
@@ -1,107 +1,47 @@
1
- # js-dos 7.xx
2
- [![Build](https://github.com/caiiiycuk/js-dos/workflows/Build/badge.svg)](https://github.com/caiiiycuk/js-dos/actions/workflows/build.yml)
1
+ # js-dos v8
2
+ [![Build](https://github.com/caiiiycuk/js-dos/actions/workflows/build.yml/badge.svg?branch=8.xx)](https://github.com/caiiiycuk/js-dos/actions/workflows/build.yml)
3
3
 
4
- js-dos is a javascript library that allows you to run DOS programs in browser. It was designed from the ground up to be easily installed and used to get your DOS program up and running in browser quickly.
4
+ The simplest API to run **DOS/Win** 9x programs in browser or node. js-dos provides full-featured DOS player that can be easily installed and used to get your DOS program up
5
+ and running in browser quickly. js-dos provide many advanced features like multiplayer and cloud storage. All available features are enabled for any integration and free.
5
6
 
6
- ```js
7
- Dos(element).run("game.jsdos")
8
- ```
9
-
10
- [Documentation](https://js-dos.com/)
11
-
12
- ## Quick start with create-dosbox
13
-
14
- Create js-dos web page with no build configuration.
15
-
16
- ```sh
17
- npx create-dosbox my-app
18
- cd my-app
19
- npm install
20
- npm start
21
- ---
22
- Open localhost:8080 in browser
23
- ```
24
-
25
- You will be prompted to select game that you want bootstrap.
26
-
27
- If you've previously installed `create-dosbox` globally via `npm install -g create-dosbox`, we recommend you uninstall the package using `npm uninstall -g create-dosbox` or `yarn global remove create-dosbox` to ensure that npx always uses the latest version.
7
+ The key features:
8
+ * Works in **worker** or render thread
9
+ * Support execution in Node and Browsers
10
+ * Multiple backends: DOSBox, DOSBox-X
11
+ * Mobile support (v8 - WIP, v7 - production)
12
+ * Able to run very big games (like Diablo, etc.)
13
+ * Multiplayer support
14
+ * Cloud storage
15
+ * WebAssembly and pure JS versions
16
+
28
17
 
29
- _([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_
30
18
 
31
- Then open [http://localhost:8080/](http://localhost:8080/) to see your app.<br>
19
+ [![Watch the video](https://github.com/caiiiycuk/js-dos/assets/1727152/a2b481cb-43b1-44aa-8b71-2181d351bb1a)](https://youtu.be/lhFrAe5YrJE)
32
20
 
33
- <p align='center'>
34
- <img src='https://github.com/js-dos/create-dosbox/raw/master/npx-create-dosbox.gif' width='600' alt='npm start'>
35
- </p>
21
+ ## Documentation
36
22
 
37
- It will create a directory called `my-app` inside the current folder.<br>
38
- Inside that directory, it will generate the initial project structure:
39
-
40
- ```
41
- my-app
42
- ├── package.json
43
- └── _site
44
- ├── js-dos
45
- ├── bundle.jsdos
46
- └── index.html
47
- ```
48
-
49
- No configuration or complicated folder structures, only the files you need to build your app.<br>
23
+ * [js-dos 8.xx](https://js-dos.com/overview.html)
24
+ * [js-dos 7.xx](https://js-dos.com/v7/build/)
25
+ * [js-dos 6.22](https://js-dos.com/index_6.22.html)
26
+ * [js-dos 3.xx](https://js-dos.com/index_v3.html)
27
+ * [Repository](https://github.com/caiiiycuk/js-dos-docs)
50
28
 
51
- * **js-dos** - contains last release version of js-dos that you can download from [Releases](https://github.com/caiiiycuk/js-dos/releases) page
52
- * **bundle.jsdos** - is a bundle with game to start [read more](https://js-dos.com/v7/build/docs/jsdos-bundle)
53
- * **index.html** - is a web page template
29
+ Demo:
54
30
 
55
- So, you can host `_site `on static web server no other dependincies is needed.
31
+ [DOS.Zone](https://dos.zone)
56
32
 
57
- Once the installation is done, you can open your project folder:
33
+ ## Development
58
34
 
59
- ```sh
60
- cd my-app
35
+ 1. You need to install node dependencies and put `emulators@beta` into `public/emulators`.
61
36
  ```
62
-
63
- Inside the newly created project, you can run some built-in commands:
64
-
65
- ```sh
66
- npm install
67
- npm start
37
+ yarn
38
+ cp -rv node_modules/emulators/dist/* public/emulators
68
39
  ```
69
-
70
- Open [http://localhost:8080](http://localhost:8080) to view it in the browser.
40
+ 2. Run `yarn run vite` and open [http://localhost:3000](http://localhost:3000) js-dos is ready!
71
41
 
72
42
  ## Community
73
43
 
74
- Ask a technical question in [Q&A](https://talks.dos.zone/c/questions-answers/).
75
-
44
+ * [DOS.Zone](https://dos.zone)
76
45
  * [Discord](https://discord.com/invite/hMVYEbG)
77
46
  * [Twitter](https://twitter.com/intent/user?screen_name=doszone_db)
78
47
  * [Telegram](https://t.me/doszone)
79
-
80
- ## Building
81
-
82
- To build whole project do:
83
- ```
84
- yarn
85
- NODE_ENV=production yarn run gulp
86
- ```
87
-
88
- Also, you can build js and css separately:
89
-
90
- ```
91
- yarn run gulp js
92
- yarn run gulp css
93
- ```
94
-
95
- ## Example
96
-
97
- To run built-in example do:
98
-
99
- ```
100
- hs .
101
- firefox examples/digger/index.html
102
- ```
103
-
104
- # Older releases
105
-
106
- * [js-dos 6.22](https://js-dos.com/index_6.22.html)
107
- * [js-dos 3.xx](https://js-dos.com/index_v3.html)
package/index.html ADDED
@@ -0,0 +1,106 @@
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
+ onEvent: (event) => {
46
+ console.log("Event", event)
47
+ if (event === "ci-ready") {
48
+ // props.setFrame("network");
49
+ // props.setFullScreen(true);
50
+ }
51
+ },
52
+ });
53
+ });
54
+
55
+ const diabloConf = `
56
+ [sdl]
57
+ autolock=false
58
+ mouse_emulation=integration
59
+
60
+ [dosbox]
61
+ title=Windows 95
62
+ memsize=128
63
+
64
+ [video]
65
+ vmemsize=8
66
+ vesa modelist width limit=0
67
+ vesa modelist height limit=0
68
+
69
+ [dos]
70
+ ver=7.1
71
+ hard drive data rate limit=0
72
+ floppy drive data rate limit=0
73
+
74
+ [cpu]
75
+ cputype=pentium_mmx
76
+ core=auto
77
+ integration device=true
78
+
79
+ [sblaster]
80
+ sbtype=sb16vibra
81
+
82
+ [fdc, primary]
83
+ int13fakev86io=true
84
+
85
+ [ide, primary]
86
+ int13fakeio=true
87
+ int13fakev86io=true
88
+
89
+ [ide, secondary]
90
+ int13fakeio=true
91
+ int13fakev86io=true
92
+ cd-rom insertion delay=4000
93
+
94
+ [render]
95
+ scaler=none
96
+
97
+ [autoexec]
98
+ echo off
99
+ imgmount 2 sockdrive wss://backend.make-vm.com:8001 dos.zone diablo_109_c
100
+ imgmount 3 sockdrive wss://backend.make-vm.com:8001 dos.zone diablo_109_d
101
+ boot c:
102
+ `;
103
+ </script>
104
+ </body>
105
+
106
+ </html>
package/package.json CHANGED
@@ -1,73 +1,48 @@
1
1
  {
2
- "name": "js-dos",
3
- "version": "7.4.9",
4
- "description": "Easiest API to run dos programs in browser",
5
- "main": "dist/js-dos.js",
6
- "types": "dist/types/src/player.d.ts",
7
- "browserslist": [
8
- "defaults",
9
- "not ie 11",
10
- "not op_mini all"
11
- ],
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/caiiiycuk/js-dos.git"
15
- },
16
- "keywords": [
17
- "js-dos",
18
- "dos",
19
- "api",
20
- "browser",
21
- "dosbox"
22
- ],
23
- "author": "Alexander Guryanov (aka caiiiycuk)",
24
- "license": "GPL-2.0",
25
- "bugs": {
26
- "url": "https://github.com/caiiiycuk/js-dos/issues"
27
- },
28
- "homepage": "https://js-dos.com",
29
- "devDependencies": {
30
- "@babel/core": "^7.18.6",
31
- "@babel/preset-env": "^7.18.6",
32
- "@types/browserify": "^12.0.37",
33
- "@types/gulp": "^4.0.6",
34
- "@types/gulp-rename": "2.0.1",
35
- "@types/gulp-size": "^4.0.0",
36
- "@types/gulp-sourcemaps": "^0.0.35",
37
- "@types/gulp-terser": "^1.2.1",
38
- "@types/gulp-uglify": "^3.0.7",
39
- "@types/node": "^18.0.6",
40
- "@types/notyf": "^3.0.0",
41
- "@types/undertaker": "^1.2.8",
42
- "@types/vinyl-buffer": "^1.0.0",
43
- "@types/vinyl-source-stream": "^0.0.30",
44
- "@typescript-eslint/eslint-plugin": "^5.30.6",
45
- "@typescript-eslint/parser": "^5.30.6",
46
- "babelify": "^10.0.0",
47
- "base64-js": "^1.5.1",
48
- "browserify": "^17.0.0",
49
- "core-js": "^3.23.5",
50
- "del": "^6.1.1",
51
- "emulators": "0.73.8",
52
- "emulators-ui": "0.73.7",
53
- "eslint": "^8.20.0",
54
- "eslint-config-google": "^0.14.0",
55
- "gulp": "^4.0.2",
56
- "gulp-concat": "^2.6.1",
57
- "gulp-rename": "^2.0.0",
58
- "gulp-size": "^4.0.1",
59
- "gulp-sourcemaps": "^3.0.0",
60
- "gulp-terser": "^2.1.0",
61
- "htm": "^3.1.1",
62
- "preact": "^10.10.0",
63
- "tailwindcss": "^2.2.17",
64
- "ts-node": "^10.9.1",
65
- "tsify": "^5.0.4",
66
- "typescript": "^4.7.4",
67
- "vinyl-buffer": "^1.0.1",
68
- "vinyl-source-stream": "^2.0.0"
69
- },
70
- "dependencies": {
71
- "nanoid": "^3.3.4"
72
- }
2
+ "name": "js-dos",
3
+ "version": "8.1.0",
4
+ "description": "Full-featured DOS player with multiple emulator backends",
5
+ "type": "module",
6
+ "keywords": [
7
+ "js-dos",
8
+ "dos",
9
+ "api",
10
+ "browser",
11
+ "dosbox",
12
+ "emulators",
13
+ "webassembly"
14
+ ],
15
+ "author": "Alexander Guryanov (aka caiiiycuk)",
16
+ "license": "GPL-2.0",
17
+ "bugs": {
18
+ "url": "https://github.com/caiiiycuk/js-dos/issues"
19
+ },
20
+ "homepage": "https://js-dos.com",
21
+ "scripts": {
22
+ "dev": "vite",
23
+ "build": "tsc && vite build",
24
+ "preview": "vite preview"
25
+ },
26
+ "dependencies": {
27
+ "@reduxjs/toolkit": "^1.9.7",
28
+ "preact": "^10.19.3",
29
+ "react-checkbox-tree": "^1.8.0",
30
+ "react-redux": "^8.1.3"
31
+ },
32
+ "devDependencies": {
33
+ "@preact/preset-vite": "^2.8.1",
34
+ "@typescript-eslint/eslint-plugin": "^6.20.0",
35
+ "@typescript-eslint/parser": "^6.20.0",
36
+ "autoprefixer": "^10.4.17",
37
+ "daisyui": "^3.9.3",
38
+ "emulators": "8.1.2",
39
+ "eslint": "^8.56.0",
40
+ "eslint-config-google": "^0.14.0",
41
+ "postcss": "^8.4.33",
42
+ "postcss-import": "^16.0.0",
43
+ "tailwindcss": "^3.4.1",
44
+ "terser": "^5.27.0",
45
+ "typescript": "^5.3.3",
46
+ "vite": "^5.0.12"
47
+ }
73
48
  }
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ plugins: {
3
+ 'postcss-import': {},
4
+ 'tailwindcss/nesting': {},
5
+ tailwindcss: {},
6
+ autoprefixer: {},
7
+ },
8
+ }
package/src/app.css ADDED
@@ -0,0 +1,14 @@
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 ADDED
@@ -0,0 +1,10 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ :root {
7
+ --sidebar-width: 3rem;
8
+ /* w-12 */
9
+ }
10
+ }
@@ -0,0 +1,41 @@
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
+ }
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,28 @@
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
+ }
@@ -0,0 +1,94 @@
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
+ }