Compare commits
No commits in common. "webxdc" and "main" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,3 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
wordle.xdc
|
|
||||||
|
12
README.md
12
README.md
@ -1,11 +1,9 @@
|
|||||||
# Wordle.xdc
|
# Vue Wordle
|
||||||
|
|
||||||
This is a fork of [VVordle](https://github.com/yyx990803/vue-wordle), a Vue.js clone of Wordle, which I repackaged for WebXDC, so you can play with your friends on Delta Chat or Cheogram.
|
[Live demo](https://vue-wordle.netlify.app/)
|
||||||
|
|
||||||
[**Download Wordle.xdc**](https://git.linux.ucla.edu/jshiffer/wordle.xdc/releases)
|
A Vue implementation of the [Wordle game](https://www.powerlanguage.co.uk/wordle/). This is just for fun and doesn't aim to 100% replicate the original.
|
||||||
|
|
||||||
[VVordle live demo](https://vue-wordle.netlify.app/)
|
You can make your own Wordle and send it to friends by base64-encoding a word and include it as the URL query, e.g. https://vue-wordle.netlify.app/?YmxpbXA= (this will also allow words that are not in the dictionary.)
|
||||||
|
|
||||||
This is just for fun and doesn't aim to 100% replicate the original.
|
This repository is open sourced for learning purposes only - the original creator(s) of Wordle own all applicable rights to the game itself.
|
||||||
|
|
||||||
This repository is open sourced for learning purposes only - the New York Times owns all applicable rights to the game itself.
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
npm run build
|
|
||||||
(cd dist && zip -9 --recurse-paths - *) > wordle.xdc
|
|
8
env.d.ts
vendored
8
env.d.ts
vendored
@ -1,9 +1 @@
|
|||||||
/// <reference types="vue/macros-global" />
|
/// <reference types="vue/macros-global" />
|
||||||
import { Webxdc } from "webxdc-types";
|
|
||||||
import { Payload } from "./src/types";
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
interface Window {
|
|
||||||
webxdc: Webxdc<Payload>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" href="/icon.png" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<script src="webxdc.js"></script>
|
<title>VVordle - a Wordle clone with Vue.js</title>
|
||||||
<title>WorldeXDC - a Wordle clone for WebXDC</title>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
2747
package-lock.json
generated
2747
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,10 +10,7 @@
|
|||||||
"vue": "^3.2.25"
|
"vue": "^3.2.25"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^2.0.0",
|
||||||
"@vue-macros/reactivity-transform": "^3.0.0-beta.8",
|
"vite": "^2.7.2"
|
||||||
"vite": "^6.3.2",
|
|
||||||
"vite-plugin-singlefile": "^2.2.0",
|
|
||||||
"webxdc-types": "^1.0.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
public/icon.png
BIN
public/icon.png
Binary file not shown.
Before Width: | Height: | Size: 7.1 KiB |
@ -1,2 +0,0 @@
|
|||||||
name = "Wordle"
|
|
||||||
source_code_url = "https://git.linux.ucla.edu/jshiffer/wordle-xdc"
|
|
21
src/Game.vue
21
src/Game.vue
@ -1,6 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onUnmounted } from 'vue'
|
import { onUnmounted } from 'vue'
|
||||||
import { $ref, $computed } from 'vue/macros'
|
|
||||||
import { getWordOfTheDay, allWords } from './words'
|
import { getWordOfTheDay, allWords } from './words'
|
||||||
import Keyboard from './Keyboard.vue'
|
import Keyboard from './Keyboard.vue'
|
||||||
import { LetterState } from './types'
|
import { LetterState } from './types'
|
||||||
@ -34,8 +33,6 @@ const letterStates: Record<string, LetterState> = $ref({})
|
|||||||
// Handle keyboard input.
|
// Handle keyboard input.
|
||||||
let allowInput = true
|
let allowInput = true
|
||||||
|
|
||||||
const webxdc = window.webxdc
|
|
||||||
|
|
||||||
const onKeyup = (e: KeyboardEvent) => onKey(e.key)
|
const onKeyup = (e: KeyboardEvent) => onKey(e.key)
|
||||||
|
|
||||||
window.addEventListener('keyup', onKeyup)
|
window.addEventListener('keyup', onKeyup)
|
||||||
@ -73,18 +70,6 @@ function clearTile() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendFinalResultGrid(won) {
|
|
||||||
let caption = webxdc.selfName;
|
|
||||||
if (won) {
|
|
||||||
caption += " guessed the word!";
|
|
||||||
} else {
|
|
||||||
caption += " didn't guess the word :(";
|
|
||||||
}
|
|
||||||
webxdc.sendToChat({
|
|
||||||
text: caption + '\n\n' + genResultGrid()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function completeRow() {
|
function completeRow() {
|
||||||
if (currentRow.every((tile) => tile.letter)) {
|
if (currentRow.every((tile) => tile.letter)) {
|
||||||
const guess = currentRow.map((tile) => tile.letter).join('')
|
const guess = currentRow.map((tile) => tile.letter).join('')
|
||||||
@ -125,7 +110,6 @@ function completeRow() {
|
|||||||
allowInput = false
|
allowInput = false
|
||||||
if (currentRow.every((tile) => tile.state === LetterState.CORRECT)) {
|
if (currentRow.every((tile) => tile.state === LetterState.CORRECT)) {
|
||||||
// yay!
|
// yay!
|
||||||
sendFinalResultGrid(true)
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
grid = genResultGrid()
|
grid = genResultGrid()
|
||||||
showMessage(
|
showMessage(
|
||||||
@ -144,7 +128,6 @@ function completeRow() {
|
|||||||
}, 1600)
|
}, 1600)
|
||||||
} else {
|
} else {
|
||||||
// game over :(
|
// game over :(
|
||||||
sendFinalResultGrid(false)
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
showMessage(answer.toUpperCase(), -1)
|
showMessage(answer.toUpperCase(), -1)
|
||||||
}, 1600)
|
}, 1600)
|
||||||
@ -196,10 +179,10 @@ function genResultGrid() {
|
|||||||
</div>
|
</div>
|
||||||
</Transition>
|
</Transition>
|
||||||
<header>
|
<header>
|
||||||
<h1>WORDLE</h1>
|
<h1>VVORDLE</h1>
|
||||||
<a
|
<a
|
||||||
id="source-link"
|
id="source-link"
|
||||||
href="https://git.linux.ucla.edu/jshiffer/wordle.xdc"
|
href="https://github.com/yyx990803/vue-wordle"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>Source</a
|
>Source</a
|
||||||
>
|
>
|
||||||
|
@ -4,7 +4,3 @@ export const enum LetterState {
|
|||||||
PRESENT = 'present',
|
PRESENT = 'present',
|
||||||
ABSENT = 'absent'
|
ABSENT = 'absent'
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Payload = {
|
|
||||||
resultGrid: string;
|
|
||||||
};
|
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["esnext", "dom"],
|
"lib": ["esnext", "dom"]
|
||||||
"types": ["@vue-macros/reactivity-transform/macros-global"]
|
|
||||||
},
|
},
|
||||||
"include": ["env.d.ts", "src/**/*"]
|
"include": ["env.d.ts", "src/**/*"]
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import { viteSingleFile } from 'vite-plugin-singlefile'
|
|
||||||
import ReactivityTransform from '@vue-macros/reactivity-transform/vite'
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue(), ReactivityTransform(), viteSingleFile()]
|
plugins: [vue({
|
||||||
|
reactivityTransform: true
|
||||||
|
})]
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user