Compare commits

..

No commits in common. "webxdc" and "main" have entirely different histories.
webxdc ... main

14 changed files with 562 additions and 2265 deletions

3
.gitignore vendored
View File

@ -2,5 +2,4 @@ node_modules
.DS_Store
dist
dist-ssr
*.local
wordle.xdc
*.local

View File

@ -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 New York Times owns all applicable rights to the game itself.
This repository is open sourced for learning purposes only - the original creator(s) of Wordle own all applicable rights to the game itself.

View File

@ -1,3 +0,0 @@
#!/bin/bash
npm run build
(cd dist && zip -9 --recurse-paths - *) > wordle.xdc

8
env.d.ts vendored
View File

@ -1,9 +1 @@
/// <reference types="vue/macros-global" />
import { Webxdc } from "webxdc-types";
import { Payload } from "./src/types";
declare global {
interface Window {
webxdc: Webxdc<Payload>;
}
}

View File

@ -2,10 +2,9 @@
<html lang="en">
<head>
<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" />
<script src="webxdc.js"></script>
<title>WorldeXDC - a Wordle clone for WebXDC</title>
<title>VVordle - a Wordle clone with Vue.js</title>
</head>
<body>
<div id="app"></div>

2751
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,10 +10,7 @@
"vue": "^3.2.25"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.3",
"@vue-macros/reactivity-transform": "^3.0.0-beta.8",
"vite": "^6.3.2",
"vite-plugin-singlefile": "^2.2.0",
"webxdc-types": "^1.0.1"
"@vitejs/plugin-vue": "^2.0.0",
"vite": "^2.7.2"
}
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,2 +0,0 @@
name = "Wordle"
source_code_url = "https://git.linux.ucla.edu/jshiffer/wordle-xdc"

View File

@ -1,6 +1,5 @@
<script setup lang="ts">
import { onUnmounted } from 'vue'
import { $ref, $computed } from 'vue/macros'
import { getWordOfTheDay, allWords } from './words'
import Keyboard from './Keyboard.vue'
import { LetterState } from './types'
@ -34,8 +33,6 @@ const letterStates: Record<string, LetterState> = $ref({})
// Handle keyboard input.
let allowInput = true
const webxdc = window.webxdc
const onKeyup = (e: KeyboardEvent) => onKey(e.key)
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() {
if (currentRow.every((tile) => tile.letter)) {
const guess = currentRow.map((tile) => tile.letter).join('')
@ -125,7 +110,6 @@ function completeRow() {
allowInput = false
if (currentRow.every((tile) => tile.state === LetterState.CORRECT)) {
// yay!
sendFinalResultGrid(true)
setTimeout(() => {
grid = genResultGrid()
showMessage(
@ -144,7 +128,6 @@ function completeRow() {
}, 1600)
} else {
// game over :(
sendFinalResultGrid(false)
setTimeout(() => {
showMessage(answer.toUpperCase(), -1)
}, 1600)
@ -196,10 +179,10 @@ function genResultGrid() {
</div>
</Transition>
<header>
<h1>WORDLE</h1>
<h1>VVORDLE</h1>
<a
id="source-link"
href="https://git.linux.ucla.edu/jshiffer/wordle.xdc"
href="https://github.com/yyx990803/vue-wordle"
target="_blank"
>Source</a
>

View File

@ -4,7 +4,3 @@ export const enum LetterState {
PRESENT = 'present',
ABSENT = 'absent'
}
export type Payload = {
resultGrid: string;
};

View File

@ -9,8 +9,7 @@
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"types": ["@vue-macros/reactivity-transform/macros-global"]
"lib": ["esnext", "dom"]
},
"include": ["env.d.ts", "src/**/*"]
}

View File

@ -1,9 +1,9 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteSingleFile } from 'vite-plugin-singlefile'
import ReactivityTransform from '@vue-macros/reactivity-transform/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), ReactivityTransform(), viteSingleFile()]
plugins: [vue({
reactivityTransform: true
})]
})