MMOframework
Why AI Playground Libraries Documentation Search Agency
FR EN
Index

guide

MMO · 1 symbol · generated 27 Oct 2026

namespace

guide

Guide.js:45

Guided tours: a page shows a user where things are, one highlighted element at a time, with a popover telling about it -- and the ? button of the top bar, which offers the page's tours and the guides' articles.

MMO.guide = {…}
Namespace
MMO
A tour comes from the page or from an element: - a page's is a `.tour.json` written beside its `.phtml` (`declaration.phtml` → `declaration.tour.json`), which the server filters (the steps the user may not see) and hands to `register` (`Guide`); - an element's is given by its script to `add` (`<mmo-page-editor>`'s, one per display level). ```json { "id": "AccidentTravail-declaration", //where it is remembered as seen: `guides/{id}` "title": "Declare a work accident", "article": "guide/declare-accident", //optional: the page of the guide about the same task "autostart": true, //shown once, the first time the user meets it "allowed": "data#create", //optional: the scope the user needs (a page's tour, server side) "level": "standard", //optional: from this display level up (MMO.modes) "levels": ["simple"], //optional: at these display levels only "steps": [ { "title": "The path", "text": "Plain text: a blank line starts a new paragraph.", "target": "#workflow #stepper li", //css; `host >>> inner` looks inside host's shadow root "contains": "Identification", //optional: the first target whose text contains this "placement": "right", //optional: bottom (default), top, left, right "optional": true, //optional: skipped when the target is not on the page "wait": 8000, //optional: how long to wait for the target to show (ms) "level": "expert", "levels": [...] //optional: as a tour's } ] } ``` A step without a target, or whose target never shows up, is shown in the middle of the screen. A tour only shows: the page under it cannot be clicked while it runs, so a tour never saves, creates or sends anything. A tour is started by the `?` menu, by itself the first time (`autostart`), or by `?guide={id}` (`?guide=1`) in the page's url. Where a user left it (`done`, `skipped`, at which step) is saved in their config (mmo.oauth's `MMO.user`), and in the browser.
MMO.guide.add({id: 'my-element', title: 'My element', autostart: true, steps: [{title: 'Here', text: '…', target: '#here'}]});

Index

WAIThow long a step waits for its target to be drawn (the views of a workflow render after the page)
STORAGEthe browser's memory of the tours seen, when there is no user to save it on
PANEL_WIDTHthe width the panel is given for the guide's screenshots, when it is narrower
tours
current
seen
home
extra
panel
register(tour)Make a tour the page's own (from its .tour.json), and start it if it was asked for or was never seen.
add(tour, first)Add a tour to the page's: offered by the ? menu, and started if it was asked for (?guide={id}) or is autostart and was never seen.
remove(id)Take a tour out of the page's (an element that goes)
get(id)
matchesLevel(item)
isSeen(tour)
remember(tour, value)[internal] Remember where the user left $tour: in their config, and in the browser
button()
start(tour, index)Run a tour from one of its steps.
stop(status)Leave the tour, and remember how far the user went so it does not start by itself again.
show(index) asyncShow one step: its target highlighted, its text beside it.
wait(step)Wait for a step's target to be drawn.
match(step)Every element on the page that matches a step's target and its contains, shown or not.
isShown(node)
renderPopover(step, index, count)Fill the popover with a step: its text is text, never html.
place()Put the spotlight on the target and the popover beside it: on the side the step asks for when it fits, on the side with the most room when it does not.
key(event)The keyboard drives the tour: → and Enter go on, ← goes back, Escape leaves.
trapFocus(event)Keep the focus in the popover while the tour runs, as in any modal.
menu(button)The ? menu of the top bar: the page's tours, their articles, and every guide.
closeMenu()
openPanel(url) asyncShow a page of the guides in the shell's side panel, beside the page the user is working on.
panelClick(event)A click in the guide's panel: a page of the guides opens in the panel, the tour of the page the user is on starts right there.

Constants3

WAIT

Guide.js:59

how long a step waits for its target to be drawn (the views of a workflow render after the page)

WAIT = 2000

STORAGE

Guide.js:62

the browser's memory of the tours seen, when there is no user to save it on

STORAGE = 'mmo-guides'

PANEL_WIDTH

Guide.js:507

the width the panel is given for the guide's screenshots, when it is narrower

PANEL_WIDTH = 480

Properties6

current

Guide.js:50
current = null
Type
?{tour: Object, index: number, nodes: Object, target: ?Element

extra

Guide.js:489
extra = []
Type
Array<{icon: ?string, label: string, href: ?string, onclick: ?Function

panel

Guide.js:504
panel = null
Type
?{node: Element, url: ?string, widened: boolean

Methods22

register(tour)

Guide.js:69

Make a tour the page's own (from its .tour.json), and start it if it was asked for or was never seen.

register(tour)
tourObject- as the server filtered it (seen, articleUrl added)
returnsvoid

add(tour, first)

Guide.js:80

Add a tour to the page's: offered by the ? menu, and started if it was asked for (?guide={id}) or is autostart and was never seen. A tour of another display level than the one shown is left out.

add(tour, first = false)
tourObject
first = falseboolean- true: the page's own, first in the menu
returnsbooleanwhether it is one of the page's (not left out by its level, nor without steps)

remove(id)

Guide.js:103

Take a tour out of the page's (an element that goes)

remove(id)
id

get(id)

Guide.js:110
get(id)
id
returns?Objectthe page's tour $id

matchesLevel(item)

Guide.js:115
matchesLevel(item)
item
returnsbooleanwhether the display level shown is one $item (a tour, a step) is for (level, levels)

isSeen(tour)

Guide.js:124
isSeen(tour)
tour
returnsbooleanwhether the user went through $tour, or left it

remember(tour, value)

Guide.js:132

[internal] Remember where the user left $tour: in their config, and in the browser

remember(tour, value)
tour
value

button()

Guide.js:146
button()
returns?HTMLElementthe ? button of the top bar, made when the page has none

start(tour, index)

Guide.js:162

Run a tour from one of its steps.

start(tour = this.tours[0], index = 0)
tour = this.tours[0]?(Object | string)- the page's first by default, or one of its tours' id
index = 0number- the step to start from
returnsvoid

stop(status)

Guide.js:196

Leave the tour, and remember how far the user went so it does not start by itself again.

stop(status = null)
status = null?string- done or skipped; null leaves without remembering anything
returnsvoid

show(index)

asyncGuide.js:224

Show one step: its target highlighted, its text beside it.

async show(index)
indexnumber
returnsPromise<void>

wait(step)

Guide.js:262

Wait for a step's target to be drawn. One that is on the page but hidden is not waited for: the layout hides it, and it will not show up by itself.

wait(step)
stepObject
returnsPromise<?Element>null when it is not shown (or the step has none)

match(step)

Guide.js:283

Every element on the page that matches a step's target and its contains, shown or not.

match(step)
stepObject
returnsArray<Element>

isShown(node)

Guide.js:300
isShown(node)
nodeElement
returnsbooleanwhether it takes room on the screen

renderPopover(step, index, count)

Guide.js:312

Fill the popover with a step: its text is text, never html.

renderPopover(step, index, count)
stepObject
indexnumber
countnumber
returnsvoid

place()

Guide.js:345

Put the spotlight on the target and the popover beside it: on the side the step asks for when it fits, on the side with the most room when it does not. A phone shows the popover as a sheet at the bottom (css).

place()
returnsvoid

key(event)

Guide.js:408

The keyboard drives the tour: → and Enter go on, ← goes back, Escape leaves.

key(event)
eventKeyboardEvent
returnsvoid

trapFocus(event)

Guide.js:429

Keep the focus in the popover while the tour runs, as in any modal.

trapFocus(event)
eventKeyboardEvent
returnsvoid

menu(button)

Guide.js:444

The ? menu of the top bar: the page's tours, their articles, and every guide.

menu(button)
buttonHTMLElement
returnsvoid

closeMenu()

Guide.js:494
closeMenu()
returnsbooleanwhether a menu was open

openPanel(url)

asyncGuide.js:516

Show a page of the guides in the shell's side panel, beside the page the user is working on. The panel then browses the guides by itself (panelClick). The article is the site's own page: its .guide-article (else its main), read from its html without its scripts.

async openPanel(url)
urlstring- a page of the guides
returnsPromise<void>

panelClick(event)

Guide.js:578

A click in the guide's panel: a page of the guides opens in the panel, the tour of the page the user is on starts right there. Any other link, or a ctrl/cmd/shift-click, goes where it says.

panelClick(event)
eventMouseEvent
returnsvoid