dwmkerr / crosswords-js

Tiny, lightweight crossword control for the web.
https://dwmkerr.github.io/crosswords-js/
MIT License
71 stars 27 forks source link

Implement core features of "The Guardian" style crossword #25

Open dwmkerr opened 1 year ago

dwmkerr commented 1 year ago

Here's a sample:

image

https://www.theguardian.com/crosswords/quick/16472#5-across

Features that this has, that we might implement (note that we should split the samples to have a 'vanilla' sample, then a 'guardian' sample, that changes the styles (showing you can style your crosswords how you like):

pvspain commented 1 year ago

This all looks great Dave! @dwmkerr [reveal, check, reveal all, check all] is core functionality that I'm keen to see RSN.

This will require some design for integration of the crossword solution into the crossword model. Perhaps we start a design document to aid comms and serve as developer documentation as well?

I like the clue URL - great for sharing. We'll need to add a routing interface to the API. Routing would also be a good solution for puzzle selection. Again, we should document the design as a basis for sequencing implementation and breaking into features.

I've been thinking a bit about how to abstract keyboard behaviour to support multiple collections of keyboard shortcuts - guardian, age, nytimes etc. The behaviour is spread across multiple event handlers. I was thinking we could add operation primitives to the crossword model - select a given (clue,cell index), move to next/prev cell, move to next/prev clue. This would move a lot of that code out of the DOM event handlers and simplify implementation of other selection methods like URL. The different short cut collections could then be implemented as collections of event handler groups.

My big picture view is to be able to cooperate on a crossword with other people in real time. This would require socket I/O as well as keyboard events. It may be out of scope for this package. What do you think? @dwmkerr

pvspain commented 8 months ago

https://www.theguardian.com/crosswords/quick/16472#5-across

Features that this has, that we might implement (note that we should split the samples to have a 'vanilla' sample, then a 'guardian' sample, that changes the styles (showing you can style your crosswords how you like):

Are you offering to do the Guardian sample? ;) The anagram helper doesn't seem very helpful! Perhaps I'm missing something?!

  • [ ] url includes current clue, meaning we can share links to clues

Perhaps we could overload the setter for controller.currentClue to take a clue.id string value. This would allow the current clue to be set programmatically from a separate context; for example, a container application. Perhaps a separate controller method would be better, so we don't take the overload parsing hit whenever the controller.currentClue changes.

  • [ ] clue list on RHS

This feature has been added

  • [ ] blinking cursor, better cell highlight

These are styling issues, and can be overridden in the user's application.

  • [ ] backspace to delete cells, rather than move back

This has been fixed

  • [ ] reveal

Feature added for letters and whole clues.

  • [ ] check
  • [ ] reveal all
  • [ ] check all

These features have all been added.

dwmkerr commented 8 months ago

Yep I'd like to work on this! Should be able to carve out some time in a couple of weeks when my current project winds down :)

pvspain commented 8 months ago

Awesome! Thanks.

pvspain commented 8 months ago

I've been doing some research on monorepos. I have an O'Reilly subscription which includes access to the Packt book Modern Frontend Development with Node.js. It includes a survey of the monorepo solutions out there. It seems that the npm workspaces feature may be sufficient for our initial needs. I'd prefer not to drag in additional tooling until we need the benefits.

dwmkerr commented 8 months ago

Yeah I think actually a single repo is probably easier, being able to clone a single repo and see various samples and so on is more convenient that cloning multiple. A monorepo would make sense - I'll hold off any large changes for now though, got a couple of busy weeks at work then should get some more time!