Extension:GuidedTour/Refactoring notes 2014-02-11
Based on a meeting with Matthew Flaschen and Sam Smith
These are just for discussion and consideration. We may not want to add code support for all of this.
Cards for next stepsEdit
- Refactoring (tracking) (includes below)
- Domain-specific language
- Review existing tours
- What requires complicated workarounds (make sure it's required, not just that they're doing it that way)
- What works well?
- Refactor user state
- User state is split across modules
- ext.guidedTour.lib.internal and ext.guidedTour.lib both deal with user state in some way. If the user state is going to become more complicated then it should be moved into its own module (or two -- one for parsing/encoding, one for storing/retreiving).
- Integrate more closely with mediawiki UI library for consistency
- May clash with keeping it as a third-party library
- Define the interface for all UI interactions (showDialog etc.)
- Without the third-party library idea, we might not need these abstractions.
- Make it easy to write tours
- Back button?
- Without having to put hook list for this into the main library
- How does a third-party library/extension signal to the tour that new content is available?
- Will probably introduce new API, eventually may deprecate and remove old one
Current modules and their responsibilitiesEdit
- Originally, third party library
- Low-level guider functionality
- Rendering guiders/steps, arrows
- Pre-load/pre-renders next guider in some cases
- Some functionality we've never used (e.g. advance_if_form_content, showIfHashed)
- Our main public API.
- User state persistence
- Calls MW API for rendering wikitext or using the content of a page as a description
- Converts high-level actions (like 'next' or 'wikilink' to buttons understood by mediawiki.libs.guiders)
- Determines whether to flip for RTL support
- Listens to MW-specific hooks
- Auto-loads tour based on initial state (query string and cookie).
- shouldSkip helpers for moving from step to step
- Calls internal library
- Tours depend on that module, so if the tour is added to the page, it launches itself.
- Internal library that can be unit tested but is not public
- Loads tour(s) from on-wiki or extension module
- Parses user state