commit missing files in order to fix build
This commit is contained in:
parent
634a01c310
commit
4d349bf8ea
5 changed files with 177 additions and 3 deletions
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
|
|
@ -2,9 +2,9 @@
|
|||
"configurations": [
|
||||
{
|
||||
"type": "msedge",
|
||||
"name": "https://localhost:8080/",
|
||||
"name": "http://localhost:8080/",
|
||||
"request": "launch",
|
||||
"url": "https://localhost:8080/",
|
||||
"url": "http://localhost:8080/",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/public/**/*.js",
|
||||
"!${workspaceFolder}/public/**/*vendors*",
|
||||
|
|
|
|||
71
lib/menus/advanced_options_screen.js
Normal file
71
lib/menus/advanced_options_screen.js
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
//@ts-check
|
||||
const { LitElement, html, css } = require('lit')
|
||||
const { CommonOptionsScreen } = require('./options_store')
|
||||
const { commonCss, isMobile, openURL } = require('./components/common')
|
||||
const { hideCurrentModal } = require('../globalState')
|
||||
|
||||
class AdvancedOptionsScreen extends CommonOptionsScreen {
|
||||
constructor () {
|
||||
super()
|
||||
this.defineOptions({
|
||||
forceMobileControls: { defaultValue: false, convertFn: (v) => v === 'true' }
|
||||
})
|
||||
}
|
||||
|
||||
static get styles () {
|
||||
return css`
|
||||
${commonCss}
|
||||
.title {
|
||||
top: 4px;
|
||||
}
|
||||
|
||||
main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: absolute;
|
||||
top: calc(100% / 6 - 6px);
|
||||
left: 50%;
|
||||
width: 310px;
|
||||
gap: 4px 0;
|
||||
place-items: center;
|
||||
place-content: center;
|
||||
transform: translate(-50%);
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
gap: 0 10px;
|
||||
height: 20px;
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
render () {
|
||||
return html`
|
||||
<div class="${'dirt-bg'}"></div>
|
||||
|
||||
<p class="title">Advanced Options</p>
|
||||
<main>
|
||||
<div class="wrapper">
|
||||
<pmui-button pmui-width="150px" pmui-label=${'Force Mobile Controls: ' + (this.forceMobileControls ? 'ON' : 'OFF')} @pmui-click=${() => {
|
||||
this.forceMobileControls = !this.forceMobileControls
|
||||
if (this.forceMobileControls || isMobile()) {
|
||||
document.getElementById('hud').showMobileControls(true)
|
||||
} else {
|
||||
document.getElementById('hud').showMobileControls(false)
|
||||
}
|
||||
this.requestUpdate()
|
||||
}
|
||||
}></pmui-button>
|
||||
<pmui-button pmui-width="150px" pmui-label="[Guide] Disable Vsync" @click=${() => openURL('https://gist.github.com/zardoy/6e5ce377d2b4c1e322e660973da069cd')}></pmui-button>
|
||||
</div>
|
||||
|
||||
<pmui-button pmui-width="200px" pmui-label="Done" @pmui-click=${() => hideCurrentModal()}></pmui-button>
|
||||
</main>
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('pmui-advanced-optionsscreen', AdvancedOptionsScreen)
|
||||
72
lib/menus/notification.js
Normal file
72
lib/menus/notification.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
//@ts-check
|
||||
|
||||
// create lit element
|
||||
const { LitElement, html, css } = require('lit')
|
||||
const { proxy, subscribe } = require('valtio/vanilla')
|
||||
|
||||
// move to globalState?
|
||||
export const notification = proxy({
|
||||
show: false,
|
||||
autoHide: true,
|
||||
message: '',
|
||||
type: 'info',
|
||||
})
|
||||
|
||||
window.notification = notification
|
||||
|
||||
class Notification extends LitElement {
|
||||
render () {
|
||||
const show = notification.show && notification.message
|
||||
return html`
|
||||
<div class="notification notification-${notification.type} ${show ? 'notification-show' : ''}">
|
||||
${notification.message}
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
||||
constructor () {
|
||||
super()
|
||||
let timeout
|
||||
subscribe(notification, () => {
|
||||
if (timeout) clearTimeout(timeout)
|
||||
this.requestUpdate()
|
||||
if (!notification.autoHide) return
|
||||
timeout = setTimeout(() => {
|
||||
notification.show = false
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
|
||||
static get styles () {
|
||||
return css`
|
||||
.notification {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
min-width: 200px;
|
||||
padding: 10px;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background: #000;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.notification-info {
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.notification-error {
|
||||
background: #d00;
|
||||
}
|
||||
|
||||
.notification-show {
|
||||
opacity: 1;
|
||||
}
|
||||
`
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('pmui-notification', Notification)
|
||||
31
lib/menus/options_store.js
Normal file
31
lib/menus/options_store.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//@ts-check
|
||||
|
||||
import { LitElement } from 'lit'
|
||||
|
||||
export class CommonOptionsScreen extends LitElement {
|
||||
options = {}
|
||||
|
||||
defineOptions (props) {
|
||||
for (const [name, { defaultValue, convertFn }] of Object.entries(props)) {
|
||||
Object.defineProperty(this.options, name, {
|
||||
get () {
|
||||
let value = window.localStorage.getItem(name) ? convertFn(window.localStorage.getItem(name)) : defaultValue
|
||||
if (isNaN(value)) value = defaultValue
|
||||
return value
|
||||
},
|
||||
set (value) {
|
||||
window.localStorage.setItem(name, `${convertFn(value)}`)
|
||||
}
|
||||
})
|
||||
this[name] = this.options[name]
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {any} value
|
||||
*/
|
||||
changeOption (name, value) {
|
||||
this.options[name] = value
|
||||
this[name] = this.options[name]
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@
|
|||
"url": "^0.11.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/three": "0.128.0",
|
||||
"assert": "^2.0.0",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
|
|
@ -67,7 +68,6 @@
|
|||
"prismarine-viewer": "github:PrismarineJS/prismarine-viewer",
|
||||
"process": "github:PrismarineJS/node-process",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"@types/three": "0.128.0",
|
||||
"three": "0.128.0",
|
||||
"timers-browserify": "^2.0.12",
|
||||
"vite": "^4.4.9",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue