-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Popgun is a pure Javascript popover component for high performance and feature-rich web applications!
This is Popgun's API.
-
init(): Most of the functions are self explanatory, but the most important one is
init()
.init()
will instantiated Popgun by initializing anEventDelegate
and aMutationHandler
on the document. -
registerGroup(): Register a
group
. -
registerSchema(): Register a schema of
options
. -
getPopFromGroupId(): Get a
Pop
from thePopStore
given a groupId. -
getPopState(): Given a pop, return the
state
. - isPopAlreadyOpenForTarget(): Return a boolean for whether a pop is open for a specific target.
- isPopAlreadyOpenForGroup(): Return a boolean for whether a pop is open for a specific group.
- showPop(): make a popover appear for a given popgun target.
- hidePop(): hide a popover for a given popgun target.
Essentially this is an abstract class that the GroupStore
, PopStore
, and SchemaStore
extend from.
A simple module for handling enums.
This is a singleton that instantiates EventListeners on the document that listen events on popgun targets. We listen for:
- click
- mouseover
- focus
- manual
- mouseout
A cache for handling group ids mapped to their Groups
.
A group represents a group of popgun targets that share the same popover. A group is a defined Schema with options defined. Note any defined options will take precedent over options defined in an included schema.
- id: string;
- schema: string;
- options: IOptions;
A simple module for handling class mixins.
This is a singleton that exists on the document that watches for popgun-related mutations in the DOM.
These are the current options that a user can define for popgun and their default values.
- trigger: Trigger[]; [new Trigger('hover')]
- html: string; ''
- text: string; ''
- placement: string; 'top'
- placementOffset: number; 8
- optimizePlacement: boolean; true
- transitionPlacement: boolean; true
- alignment: string; ''
- alignmentOffset: number; 0
- viewportPadding: number; 10
- timeToHoverOnPop: number; 300
- showDelay: number; 0
- fadeDuration: number; 100
- cushion: number; 8
- containerCushion: number; 10
- disableClickOff: boolean; false
- tipClass: string; ''
- darkStyle: boolean; false
A class that handles parsing options defined on elements, JSON objects, schemas, and groups. _Note precendence of options is given to elements first, then JSON objectsm then schema, and finally groups.
A model that represents a popover.
- opts: Options;
- targetEl: Element;
- state: string;
- isPinned: boolean;
- popOver: PopOver;
- trigger: Trigger;
- parentPop: Pop;
- childPops: Pop[];
A singleton that manages pops, their parents, and their children.
This is where the logic for showing and hiding pops lay.
The life cycle of a pop exists through the following states and an event is fired onto the target of each state change:
Show States
- CONTENT_SETUP (PopgunContentSetup)
- PRE_POSITION (PopgunPrePosition)
- PRE_SHOW (PopgunPreShow)
- SHOWING (PopgunShowing)
Hide Staates
- PRE_HIDE (PopgunPreHide)
- HIDDEN (PopgunHidden)
A cache for handling group ids mapped to their open Pops
.
A cache for handling schema ids mapped to their Options
.
The triggers for a pop target are:
- Hover
- Click
- Focus
A simple module for handling browser detection.