Repositories for common Vue 3 components used by MAP components
VSCode + Volar (and disable Vetur).
See Vite Configuration Reference.
npm install
npm run serve
npm run build-bundle
HelpModeTour (a guided tour) and HelpModeHover (hover over a highlighted control to see its help) show the help of the controls marked with the v-help-mode directive.
Add v-help-mode to the control to add it to the help, remove the directive to remove it. Nothing else needs to change.
<map-svg-icon
icon="zoomIn"
v-help-mode="{
id: 'scaffold-zoom-in',
area: 'zoom',
title: 'Zoom in',
description: 'Zoom in to see more detail.',
placement: 'left',
}"
@click="zoomIn()"
/>
import { helpModeDirective } from '@abi-software/map-utilities';
export default {
directives: { helpMode: helpModeDirective },
};
| Field | Description | |
|---|---|---|
id |
required | Unique id, also used for analytics. Prefix it with the component, e.g. flatmap-. |
area |
One of HELP_MODE_AREAS: toolbar, panel-header, map-info, legends, plot-filter, zoom, map-settings, drawing, animation. |
|
title, description |
The help text. Values are reactive, e.g. description: warningMessage. The description can use <b>, <strong>, <i>, <em>, <u>, <p>, <br>, <ul>, <ol>, <li>, <code>, <small>, <sub>, <sup> without attributes, any other tag is shown as text (sanitizeHelpDescription). |
|
placement |
Where the help is shown, defaults to bottom. |
|
order |
Order within the area, defaults to the order in the page. | |
onEnter, onLeave |
Prepare the UI before the help is shown, e.g. open a drawer, and revert it. | |
target |
A function returning the element to highlight, when it is not the element with the directive. | |
hover |
false to leave it out of the hover help. |
|
hoverEnter |
false to call onEnter and onLeave only in the tour, e.g. for a list which would cover other controls during the hover help. |
|
enterDelay, leaveDelay |
Milliseconds to wait after onEnter, or after onLeave before the next step, e.g. for an animation. Default 300. |
collectHelpModeSteps(rootElement) returns the steps of the controls under the element, sorted by area, then order, then page order. Controls inside a hidden element with data-help-scope, e.g. a viewer which is not shown, are left out. Viewers expose it as getHelpModeSteps().
<HelpModeTour v-model="tourOpen" :steps="steps" />
<HelpModeHover v-model="hoverOpen" :steps="steps" :container="viewerElement" />