Compare commits

..

No commits in common. "master" and "v0.2.0" have entirely different histories.

6 changed files with 695 additions and 922 deletions

View file

@ -27,8 +27,6 @@ npm run build <public-url>
npm run build /some-directory
```
The finalized production bundle will be generated and stored in the `/docs` directory.
## Direct links
You can provide a direct link to a specific game using the following URL format:

1567
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,20 +17,20 @@
"preact/jsx-dev-runtime": "preact/jsx-runtime"
},
"devDependencies": {
"@parcel/transformer-sass": "^2.9.3",
"@parcel/transformer-sass": "^2.9.1",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"eslint": "^8.44.0",
"eslint": "^8.41.0",
"eslint-config-preact": "^1.3.0",
"events": "^3.3.0",
"parcel": "^2.9.3",
"parcel": "^2.9.1",
"parcel-reporter-static-files-copy": "^1.5.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"stream-browserify": "^3.0.0"
},
"dependencies": {
"@fontsource/open-sans": "^5.0.3",
"@fontsource/open-sans": "^5.0.1",
"base32768": "^3.0.1",
"cheap-glkote": "^0.5.1",
"emglken": "^0.5.2",

View file

@ -4,9 +4,6 @@ import TextMessage from '../TextMessage/TextMessage'
import * as s from '../../Player.module.scss'
const eol = { style: 'endOfLine' }
const scrollTarget = { style: 'scrollTarget' }
const isFakeStatus = (w) =>
w.height < 5
@ -25,13 +22,15 @@ const parseInbox = (inbox, currentWindow) => {
if (!currentInbox) {
return {
clear: false,
incoming: [scrollTarget],
incoming: [],
}
}
const { text: inboxMessagesRaw } =
currentInbox
const eol = { style: 'endOfLine' }
const incoming =
inboxMessagesRaw
/* Normalize. */
@ -41,7 +40,7 @@ const parseInbox = (inbox, currentWindow) => {
: [eol])
/* Flatten. */
.reduce((acc, x) =>
acc.concat(x), [scrollTarget])
acc.concat(x), [])
return {
incoming,
@ -64,13 +63,13 @@ export default function TextBuffer ({ inbox, currentWindow }) {
: messages.concat(incoming))
setTimeout(() => {
const scrollTargets =
textBufferEl.current.querySelectorAll(`.${scrollTarget.style}`)
const freshScrollTarget =
scrollTargets[scrollTargets.length - 1]
const inputs =
textBufferEl.current.querySelectorAll('.message.input')
const lastInput =
inputs[inputs.length - 1]
freshScrollTarget
? freshScrollTarget.scrollIntoView()
lastInput
? lastInput.scrollIntoView()
: textBufferEl.current.scrollTo({
top: textBufferEl.current.scrollHeight,
behavior: 'smooth',

View file

@ -15,8 +15,6 @@ export default function TextMessage ({ style, text }) {
(<strong className={[s.message, s.subheader].join(' ')}>{text}</strong>),
emphasized:
(<em className={[s.message, s.emphasized].join(' ')}>{text}</em>),
scrollTarget:
(<div className={[s.scrollTarget, style].join(' ')}></div>),
endOfLine:
(<br />),
})[style] || defaultContent

View file

@ -1,5 +1,6 @@
.message {
&.input {
scroll-margin-top: var(--inner-padding);
color: var(--input-color);
}
@ -8,7 +9,3 @@
color: var(--accent-color);
}
}
.scrollTarget {
scroll-margin-block-start: var(--inner-padding);
}